{
  "version": 3,
  "file": "angular-ui-router.js",
  "sources": [
    "angular-ui-router/src/angular.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/hof.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/predicates.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/coreservices.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/common.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/glob.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/queue.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/rejectFactory.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/strings.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/trace.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/common/@uirouter/core/common/index.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/params/@uirouter/core/params/paramType.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/params/@uirouter/core/params/param.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/params/@uirouter/core/params/paramTypes.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/params/@uirouter/core/params/stateParams.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/path/@uirouter/core/path/pathNode.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/targetState.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/path/@uirouter/core/path/pathUtils.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/path/@uirouter/core/path/index.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/interface.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/resolvable.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/resolveContext.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/resolve/@uirouter/core/resolve/index.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/stateBuilder.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/stateObject.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/stateMatcher.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/stateQueueManager.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/stateRegistry.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/interface.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/transitionHook.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/hookRegistry.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/hookBuilder.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/transition.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/url/@uirouter/core/url/urlMatcher.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/url/@uirouter/core/url/urlMatcherFactory.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/url/@uirouter/core/url/urlRule.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/url/@uirouter/core/url/urlRouter.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/view/@uirouter/core/view/view.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/@uirouter/core/globals.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/url/@uirouter/core/url/urlRules.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/url/@uirouter/core/url/urlConfig.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/url/@uirouter/core/url/urlService.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/@uirouter/core/router.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/coreResolvables.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/redirectTo.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/onEnterExitRetain.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/resolve.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/views.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/updateGlobals.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/url.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/lazyLoad.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/transitionEventType.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/ignoredTransition.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/hooks/@uirouter/core/hooks/invalidTransition.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/transitionService.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/state/@uirouter/core/state/stateService.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/transition/@uirouter/core/transition/index.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/q.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/injector.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/utils.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/baseLocationService.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/hashLocationService.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/memoryLocationService.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/pushStateLocationService.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/memoryLocationConfig.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/browserLocationConfig.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/vanilla/@uirouter/core/vanilla/plugins.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/@uirouter/core/vanilla.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/@uirouter/core/interface.ts",
    "angular-ui-router/node_modules/@uirouter/core/lib-esm/@uirouter/core/index.ts",
    "angular-ui-router/src/statebuilders/views.ts",
    "angular-ui-router/src/templateFactory.ts",
    "angular-ui-router/src/stateProvider.ts",
    "angular-ui-router/src/statebuilders/onEnterExitRetain.ts",
    "angular-ui-router/src/locationServices.ts",
    "angular-ui-router/src/urlRouterProvider.ts",
    "angular-ui-router/src/services.ts",
    "angular-ui-router/src/injectables.ts",
    "angular-ui-router/src/directives/stateDirectives.ts",
    "angular-ui-router/src/stateFilters.ts",
    "angular-ui-router/src/directives/viewDirective.ts",
    "angular-ui-router/src/viewScroll.ts",
    "angular-ui-router/src/index.ts"
  ],
  "sourcesContent": [
    "/** @publicapi @module ng1 */ /** */\nimport * as ng_from_import from 'angular';\n/** @hidden */ declare var angular;\n/** @hidden */ const ng_from_global = angular;\n/** @hidden */ export const ng = ng_from_import && ng_from_import.module ? ng_from_import : ng_from_global;\n",
    "/**\n * Higher order functions\n *\n * These utility functions are exported, but are subject to change without notice.\n *\n * @module common_hof\n */ /** */\n\nimport { Predicate } from './common';\n/**\n * Returns a new function for [Partial Application](https://en.wikipedia.org/wiki/Partial_application) of the original function.\n *\n * Given a function with N parameters, returns a new function that supports partial application.\n * The new function accepts anywhere from 1 to N parameters.  When that function is called with M parameters,\n * where M is less than N, it returns a new function that accepts the remaining parameters.  It continues to\n * accept more parameters until all N parameters have been supplied.\n *\n *\n * This contrived example uses a partially applied function as an predicate, which returns true\n * if an object is found in both arrays.\n * @example\n * ```\n * // returns true if an object is in both of the two arrays\n * function inBoth(array1, array2, object) {\n *   return array1.indexOf(object) !== -1 &&\n *          array2.indexOf(object) !== 1;\n * }\n * let obj1, obj2, obj3, obj4, obj5, obj6, obj7\n * let foos = [obj1, obj3]\n * let bars = [obj3, obj4, obj5]\n *\n * // A curried \"copy\" of inBoth\n * let curriedInBoth = curry(inBoth);\n * // Partially apply both the array1 and array2\n * let inFoosAndBars = curriedInBoth(foos, bars);\n *\n * // Supply the final argument; since all arguments are\n * // supplied, the original inBoth function is then called.\n * let obj1InBoth = inFoosAndBars(obj1); // false\n *\n * // Use the inFoosAndBars as a predicate.\n * // Filter, on each iteration, supplies the final argument\n * let allObjs = [ obj1, obj2, obj3, obj4, obj5, obj6, obj7 ];\n * let foundInBoth = allObjs.filter(inFoosAndBars); // [ obj3 ]\n *\n * ```\n *\n * Stolen from: http://stackoverflow.com/questions/4394747/javascript-curry-function\n *\n * @param fn\n * @returns {*|function(): (*|any)}\n */\nexport function curry(fn: Function): Function {\n  const initial_args = [].slice.apply(arguments, [1]);\n  const func_args_length = fn.length;\n\n  function curried(args: any[]) {\n    if (args.length >= func_args_length) return fn.apply(null, args);\n    return function() {\n      return curried(args.concat([].slice.apply(arguments)));\n    };\n  }\n  return curried(initial_args);\n}\n\n/**\n * Given a varargs list of functions, returns a function that composes the argument functions, right-to-left\n * given: f(x), g(x), h(x)\n * let composed = compose(f,g,h)\n * then, composed is: f(g(h(x)))\n */\nexport function compose() {\n  const args = arguments;\n  const start = args.length - 1;\n  return function() {\n    let i = start,\n      result = args[start].apply(this, arguments);\n    while (i--) result = args[i].call(this, result);\n    return result;\n  };\n}\n\n/**\n * Given a varargs list of functions, returns a function that is composes the argument functions, left-to-right\n * given: f(x), g(x), h(x)\n * let piped = pipe(f,g,h);\n * then, piped is: h(g(f(x)))\n */\nexport function pipe(...funcs: Function[]): (obj: any) => any {\n  return compose.apply(null, [].slice.call(arguments).reverse());\n}\n\n/**\n * Given a property name, returns a function that returns that property from an object\n * let obj = { foo: 1, name: \"blarg\" };\n * let getName = prop(\"name\");\n * getName(obj) === \"blarg\"\n */\nexport const prop = (name: string) => (obj: any) => obj && obj[name];\n\n/**\n * Given a property name and a value, returns a function that returns a boolean based on whether\n * the passed object has a property that matches the value\n * let obj = { foo: 1, name: \"blarg\" };\n * let getName = propEq(\"name\", \"blarg\");\n * getName(obj) === true\n */\nexport const propEq = curry((name: string, _val: any, obj: any) => obj && obj[name] === _val);\n\n/**\n * Given a dotted property name, returns a function that returns a nested property from an object, or undefined\n * let obj = { id: 1, nestedObj: { foo: 1, name: \"blarg\" }, };\n * let getName = prop(\"nestedObj.name\");\n * getName(obj) === \"blarg\"\n * let propNotFound = prop(\"this.property.doesnt.exist\");\n * propNotFound(obj) === undefined\n */\nexport const parse = (name: string) => pipe.apply(null, name.split('.').map(prop));\n\n/**\n * Given a function that returns a truthy or falsey value, returns a\n * function that returns the opposite (falsey or truthy) value given the same inputs\n */\nexport const not: (fn: Predicate<any>) => Predicate<any> = (fn: Predicate<any>) => (...args: any[]) =>\n  !fn.apply(null, args);\n\n/**\n * Given two functions that return truthy or falsey values, returns a function that returns truthy\n * if both functions return truthy for the given arguments\n */\nexport function and(fn1: Predicate<any>, fn2: Predicate<any>): Predicate<any> {\n  return (...args: any[]) => fn1.apply(null, args) && fn2.apply(null, args);\n}\n\n/**\n * Given two functions that return truthy or falsey values, returns a function that returns truthy\n * if at least one of the functions returns truthy for the given arguments\n */\nexport function or(fn1: Predicate<any>, fn2: Predicate<any>): Predicate<any> {\n  return (...args: any[]) => fn1.apply(null, args) || fn2.apply(null, args);\n}\n\n/**\n * Check if all the elements of an array match a predicate function\n *\n * @param fn1 a predicate function `fn1`\n * @returns a function which takes an array and returns true if `fn1` is true for all elements of the array\n */\nexport const all = (fn1: Predicate<any>) => (arr: any[]) => arr.reduce((b, x) => b && !!fn1(x), true) as boolean;\n\n// tslint:disable-next-line:variable-name\nexport const any = (fn1: Predicate<any>) => (arr: any[]) => arr.reduce((b, x) => b || !!fn1(x), false) as boolean;\n\n/** Given a class, returns a Predicate function that returns true if the object is of that class */\nexport const is = <T>(ctor: { new (...args): T }) => (obj: any): obj is T =>\n  (obj != null && obj.constructor === ctor) || obj instanceof ctor;\n\n/** Given a value, returns a Predicate function that returns true if another value is === equal to the original value */\nexport const eq: (comp: any) => Predicate<any> = (value: any) => (other: any) => value === other;\n\n/** Given a value, returns a function which returns the value */\nexport const val = <T>(v: T) => () => v;\n\nexport function invoke(fnName: string): Function;\nexport function invoke(fnName: string, args: any[]): Function;\nexport function invoke(fnName: string, args?: any[]): Function {\n  return (obj: any) => obj[fnName].apply(obj, args);\n}\n\n/**\n * Sorta like Pattern Matching (a functional programming conditional construct)\n *\n * See http://c2.com/cgi/wiki?PatternMatching\n *\n * This is a conditional construct which allows a series of predicates and output functions\n * to be checked and then applied.  Each predicate receives the input.  If the predicate\n * returns truthy, then its matching output function (mapping function) is provided with\n * the input and, then the result is returned.\n *\n * Each combination (2-tuple) of predicate + output function should be placed in an array\n * of size 2: [ predicate, mapFn ]\n *\n * These 2-tuples should be put in an outer array.\n *\n * @example\n * ```\n *\n * // Here's a 2-tuple where the first element is the isString predicate\n * // and the second element is a function that returns a description of the input\n * let firstTuple = [ angular.isString, (input) => `Heres your string ${input}` ];\n *\n * // Second tuple: predicate \"isNumber\", mapfn returns a description\n * let secondTuple = [ angular.isNumber, (input) => `(${input}) That's a number!` ];\n *\n * let third = [ (input) => input === null,  (input) => `Oh, null...` ];\n *\n * let fourth = [ (input) => input === undefined,  (input) => `notdefined` ];\n *\n * let descriptionOf = pattern([ firstTuple, secondTuple, third, fourth ]);\n *\n * console.log(descriptionOf(undefined)); // 'notdefined'\n * console.log(descriptionOf(55)); // '(55) That's a number!'\n * console.log(descriptionOf(\"foo\")); // 'Here's your string foo'\n * ```\n *\n * @param struct A 2D array.  Each element of the array should be an array, a 2-tuple,\n * with a Predicate and a mapping/output function\n * @returns {function(any): *}\n */\nexport function pattern(struct: Function[][]): Function {\n  return function(x: any) {\n    for (let i = 0; i < struct.length; i++) {\n      if (struct[i][0](x)) return struct[i][1](x);\n    }\n  };\n}\n",
    "/** Predicates\n *\n * These predicates return true/false based on the input.\n * Although these functions are exported, they are subject to change without notice.\n *\n * @module common_predicates\n */ /** */\nimport { and, not, pipe, prop, or } from './hof';\nimport { Predicate } from './common'; // has or is using\nimport { StateObject } from '../state/stateObject';\n\nconst toStr = Object.prototype.toString;\nconst tis = (t: string) => (x: any) => typeof x === t;\nexport const isUndefined = tis('undefined');\nexport const isDefined = not(isUndefined);\nexport const isNull = (o: any) => o === null;\nexport const isNullOrUndefined = or(isNull, isUndefined);\nexport const isFunction: (x: any) => x is Function = <any>tis('function');\nexport const isNumber: (x: any) => x is number = <any>tis('number');\nexport const isString = <(x: any) => x is string>tis('string');\nexport const isObject = (x: any) => x !== null && typeof x === 'object';\nexport const isArray = Array.isArray;\nexport const isDate: (x: any) => x is Date = <any>((x: any) => toStr.call(x) === '[object Date]');\nexport const isRegExp: (x: any) => x is RegExp = <any>((x: any) => toStr.call(x) === '[object RegExp]');\n\n/**\n * Predicate which checks if a value is injectable\n *\n * A value is \"injectable\" if it is a function, or if it is an ng1 array-notation-style array\n * where all the elements in the array are Strings, except the last one, which is a Function\n */\nexport function isInjectable(val: any) {\n  if (isArray(val) && val.length) {\n    const head = val.slice(0, -1),\n      tail = val.slice(-1);\n    return !(head.filter(not(isString)).length || tail.filter(not(isFunction)).length);\n  }\n  return isFunction(val);\n}\n\n/**\n * Predicate which checks if a value looks like a Promise\n *\n * It is probably a Promise if it's an object, and it has a `then` property which is a Function\n */\nexport const isPromise = <(x: any) => x is Promise<any>>and(\n  isObject,\n  pipe(\n    prop('then'),\n    isFunction\n  )\n);\n",
    "/**\n * This module is a stub for core services such as Dependency Injection or Browser Location.\n * Core services may be implemented by a specific framework, such as ng1 or ng2, or be pure javascript.\n *\n * @publicapi @module common\n */ /** */\nimport { IInjectable, Obj } from './common';\nimport { Disposable } from '../interface';\nimport { UrlConfig, UrlService } from '../url';\n\nconst noImpl = (fnname: string) => () => {\n  throw new Error(`No implementation for ${fnname}. The framework specific code did not implement this method.`);\n};\n\nexport const makeStub = <T>(service: string, methods: (keyof T)[]): T =>\n  methods.reduce((acc, key) => ((acc[key] = noImpl(`${service}.${key}()`) as any), acc), {} as T);\n\nconst services: CoreServices = {\n  $q: undefined,\n  $injector: undefined,\n};\n\nexport interface $QLikeDeferred {\n  resolve: (val?: any) => void;\n  reject: (reason?: any) => void;\n  promise: Promise<any>;\n}\n\nexport interface $QLike {\n  when<T>(value?: T | PromiseLike<T>): Promise<T>;\n  reject<T>(reason: any): Promise<T>;\n  defer(): $QLikeDeferred;\n  all(promises: { [key: string]: Promise<any> }): Promise<any>;\n  all(promises: Promise<any>[]): Promise<any[]>;\n}\n\nexport interface $InjectorLike {\n  strictDi?: boolean;\n  get(token: any): any;\n  get<T>(token: any): T;\n  has(token: any): boolean;\n  invoke(fn: IInjectable, context?: any, locals?: Obj): any;\n  annotate(fn: IInjectable, strictDi?: boolean): any[];\n}\n\nexport interface CoreServices {\n  $q: $QLike;\n  $injector: $InjectorLike;\n}\n\n/**\n * Handles low level URL read/write\n *\n * This service handles low level reads and updates of the URL and listens for url changes.\n * Implementors should pass these through to the underlying URL mechanism.\n * The underlying URL mechanism might be browser APIs, framework APIs, or some 3rd party URL management library.\n *\n * UI-Router Core includes three basic implementations:\n *\n * - [[PushStateLocationService]]\n * - [[HashLocationService]]\n * - [[MemoryLocationService]]\n */\nexport interface LocationServices extends Disposable {\n  /** See: [[UrlService.url]] */ url: UrlService['url'];\n  /** See: [[UrlService.path]] */ path: UrlService['path'];\n  /** See: [[UrlService.search]] */ search: UrlService['search'];\n  /** See: [[UrlService.hash]] */ hash: UrlService['hash'];\n  /** See: [[UrlService.onChange]] */ onChange: UrlService['onChange'];\n}\n\n/**\n * Returns low level URL configuration and metadata\n *\n * This service returns information about the location configuration.\n * This service is primarily used when building URLs (e.g., for `hrefs`)\n *\n * Implementors should pass these through to the underlying URL APIs.\n * The underlying URL mechanism might be browser APIs, framework APIs, or some 3rd party URL management library.\n *\n * UI-Router Core includes two basic implementations:\n *\n * - [[BrowserLocationConfig]]\n * - [[MemoryLocationConfig]]\n */\nexport interface LocationConfig extends Disposable {\n  /** See: [[UrlConfig.port]] */ port: UrlConfig['port'];\n  /** See: [[UrlConfig.protocol]] */ protocol: UrlConfig['protocol'];\n  /** See: [[UrlConfig.host]] */ host: UrlConfig['host'];\n  /** See: [[UrlConfig.baseHref]] */ baseHref: UrlConfig['baseHref'];\n  /** See: [[UrlConfig.html5Mode]] */ html5Mode: UrlConfig['html5Mode'];\n  /** See: [[UrlConfig.hashPrefix]] */ hashPrefix: UrlConfig['hashPrefix'];\n}\n\nexport { services };\n",
    "/**\n * Random utility functions used in the UI-Router code\n *\n * These functions are exported, but are subject to change without notice.\n *\n * @preferred @publicapi @module common\n */ /** */\nimport { isFunction, isString, isArray, isRegExp, isDate } from './predicates';\nimport { all, any, prop, curry, not } from './hof';\nimport { services } from './coreservices';\nimport { StateObject } from '../state/stateObject';\n\ndeclare const global;\nexport const root: any =\n  (typeof self === 'object' && self.self === self && self) ||\n  (typeof global === 'object' && global.global === global && global) ||\n  this;\nconst angular = root.angular || {};\n\nexport const fromJson = angular.fromJson || JSON.parse.bind(JSON);\nexport const toJson = angular.toJson || JSON.stringify.bind(JSON);\nexport const forEach = angular.forEach || _forEach;\nexport const extend = Object.assign || _extend;\nexport const equals = angular.equals || _equals;\nexport function identity(x: any) {\n  return x;\n}\nexport function noop(): any {}\n\nexport type Mapper<X, T> = (x: X, key?: string | number) => T;\nexport interface TypedMap<T> {\n  [key: string]: T;\n}\nexport type Predicate<X> = (x?: X) => boolean;\nexport type PredicateBinary<X, Y> = (x?: X, y?: Y) => boolean;\n/**\n * An ng1-style injectable\n *\n * This could be a (non-minified) function such as:\n * ```js\n * function injectableFunction(SomeDependency) {\n *\n * }\n * ```\n *\n * or an explicitly annotated function (minify safe)\n * ```js\n * injectableFunction.$inject = [ 'SomeDependency' ];\n * function injectableFunction(SomeDependency) {\n *\n * }\n * ```\n *\n * or an array style annotated function (minify safe)\n * ```js\n * ['SomeDependency', function injectableFunction(SomeDependency) {\n *\n * }];\n * ```\n *\n * @publicapi\n */\nexport type IInjectable = Function | any[];\n\nexport interface Obj extends Object {\n  [key: string]: any;\n}\n\n/**\n * Builds proxy functions on the `to` object which pass through to the `from` object.\n *\n * For each key in `fnNames`, creates a proxy function on the `to` object.\n * The proxy function calls the real function on the `from` object.\n *\n *\n * #### Example:\n * This example creates an new class instance whose functions are prebound to the new'd object.\n * ```js\n * class Foo {\n *   constructor(data) {\n *     // Binds all functions from Foo.prototype to 'this',\n *     // then copies them to 'this'\n *     bindFunctions(Foo.prototype, this, this);\n *     this.data = data;\n *   }\n *\n *   log() {\n *     console.log(this.data);\n *   }\n * }\n *\n * let myFoo = new Foo([1,2,3]);\n * var logit = myFoo.log;\n * logit(); // logs [1, 2, 3] from the myFoo 'this' instance\n * ```\n *\n * #### Example:\n * This example creates a bound version of a service function, and copies it to another object\n * ```\n *\n * var SomeService = {\n *   this.data = [3, 4, 5];\n *   this.log = function() {\n *     console.log(this.data);\n *   }\n * }\n *\n * // Constructor fn\n * function OtherThing() {\n *   // Binds all functions from SomeService to SomeService,\n *   // then copies them to 'this'\n *   bindFunctions(SomeService, this, SomeService);\n * }\n *\n * let myOtherThing = new OtherThing();\n * myOtherThing.log(); // logs [3, 4, 5] from SomeService's 'this'\n * ```\n *\n * @param source A function that returns the source object which contains the original functions to be bound\n * @param target A function that returns the target object which will receive the bound functions\n * @param bind A function that returns the object which the functions will be bound to\n * @param fnNames The function names which will be bound (Defaults to all the functions found on the 'from' object)\n * @param latebind If true, the binding of the function is delayed until the first time it's invoked\n */\nexport function createProxyFunctions(\n  source: Function,\n  target: Obj,\n  bind: Function,\n  fnNames?: string[],\n  latebind = false\n): Obj {\n  const bindFunction = fnName => source()[fnName].bind(bind());\n\n  const makeLateRebindFn = fnName =>\n    function lateRebindFunction() {\n      target[fnName] = bindFunction(fnName);\n      return target[fnName].apply(null, arguments);\n    };\n\n  fnNames = fnNames || Object.keys(source());\n\n  return fnNames.reduce((acc, name) => {\n    acc[name] = latebind ? makeLateRebindFn(name) : bindFunction(name);\n    return acc;\n  }, target);\n}\n\n/**\n * prototypal inheritance helper.\n * Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it\n */\nexport const inherit = (parent: Obj, extra?: Obj) => extend(Object.create(parent), extra);\n\n/** Given an array, returns true if the object is found in the array, (using indexOf) */\nexport const inArray: typeof _inArray = curry(_inArray) as any;\nexport function _inArray(array: any[], obj: any): boolean;\nexport function _inArray(array: any[]): (obj: any) => boolean;\nexport function _inArray(array, obj?): any {\n  return array.indexOf(obj) !== -1;\n}\n\n/**\n * Given an array, and an item, if the item is found in the array, it removes it (in-place).\n * The same array is returned\n */\nexport const removeFrom: typeof _removeFrom = curry(_removeFrom) as any;\nexport function _removeFrom<T>(array: T[], obj: T): T[];\nexport function _removeFrom<T>(array: T[]): (obj: T) => T[];\nexport function _removeFrom(array, obj?) {\n  const idx = array.indexOf(obj);\n  if (idx >= 0) array.splice(idx, 1);\n  return array;\n}\n\n/** pushes a values to an array and returns the value */\nexport const pushTo: typeof _pushTo = curry(_pushTo) as any;\nexport function _pushTo<T>(arr: T[], val: T): T;\nexport function _pushTo<T>(arr: T[]): (val: T) => T;\nexport function _pushTo(arr, val?): any {\n  return arr.push(val), val;\n}\n\n/** Given an array of (deregistration) functions, calls all functions and removes each one from the source array */\nexport const deregAll = (functions: Function[]) =>\n  functions.slice().forEach(fn => {\n    typeof fn === 'function' && fn();\n    removeFrom(functions, fn);\n  });\n/**\n * Applies a set of defaults to an options object.  The options object is filtered\n * to only those properties of the objects in the defaultsList.\n * Earlier objects in the defaultsList take precedence when applying defaults.\n */\nexport function defaults(opts, ...defaultsList: Obj[]) {\n  const defaultVals = extend({}, ...defaultsList.reverse());\n  return extend(defaultVals, pick(opts || {}, Object.keys(defaultVals)));\n}\n\n/** Reduce function that merges each element of the list into a single object, using extend */\nexport const mergeR = (memo: Obj, item: Obj) => extend(memo, item);\n\n/**\n * Finds the common ancestor path between two states.\n *\n * @param {Object} first The first state.\n * @param {Object} second The second state.\n * @return {Array} Returns an array of state names in descending order, not including the root.\n */\nexport function ancestors(first: StateObject, second: StateObject) {\n  const path: StateObject[] = [];\n\n  // tslint:disable-next-line:forin\n  for (const n in first.path) {\n    if (first.path[n] !== second.path[n]) break;\n    path.push(first.path[n]);\n  }\n  return path;\n}\n\n/**\n * Return a copy of the object only containing the whitelisted properties.\n *\n * #### Example:\n * ```\n * var foo = { a: 1, b: 2, c: 3 };\n * var ab = pick(foo, ['a', 'b']); // { a: 1, b: 2 }\n * ```\n * @param obj the source object\n * @param propNames an Array of strings, which are the whitelisted property names\n */\nexport function pick(obj: Obj, propNames: string[]): Obj {\n  const objCopy = {};\n  for (const _prop in obj) {\n    if (propNames.indexOf(_prop) !== -1) {\n      objCopy[_prop] = obj[_prop];\n    }\n  }\n  return objCopy;\n}\n\n/**\n * Return a copy of the object omitting the blacklisted properties.\n *\n * @example\n * ```\n *\n * var foo = { a: 1, b: 2, c: 3 };\n * var ab = omit(foo, ['a', 'b']); // { c: 3 }\n * ```\n * @param obj the source object\n * @param propNames an Array of strings, which are the blacklisted property names\n */\nexport function omit(obj: Obj, propNames: string[]): Obj {\n  return Object.keys(obj)\n    .filter(not(inArray(propNames)))\n    .reduce((acc, key) => ((acc[key] = obj[key]), acc), {});\n}\n\n/** Given an array of objects, maps each element to a named property of the element. */\nexport function pluck<T>(collection: Obj[], propName: string): T[];\n/** Given an object, maps each property of the object to a named property of the property. */\nexport function pluck(collection: { [key: string]: any }, propName: string): { [key: string]: any };\n/**\n * Maps an array, or object to a property (by name)\n */\nexport function pluck(collection: any, propName: string): any {\n  return map(collection, <Mapper<any, string>>prop(propName));\n}\n\n/** Given an array of objects, returns a new array containing only the elements which passed the callback predicate */\nexport function filter<T>(collection: T[], callback: (t: T, key?: number) => boolean): T[];\n/** Given an object, returns a new object with only those properties that passed the callback predicate */\nexport function filter<T>(collection: TypedMap<T>, callback: (t: T, key?: string) => boolean): TypedMap<T>;\n/** Filters an Array or an Object's properties based on a predicate */\nexport function filter<T>(collection: any, callback: Function): T {\n  const arr = isArray(collection),\n    result: any = arr ? [] : {};\n  const accept = arr ? x => result.push(x) : (x, key) => (result[key] = x);\n  forEach(collection, function(item, i) {\n    if (callback(item, i)) accept(item, i);\n  });\n  return <T>result;\n}\n\n/** Given an object, return the first property of that object which passed the callback predicate */\nexport function find<T>(collection: TypedMap<T>, callback: Predicate<T>): T;\n/** Given an array of objects, returns the first object which passed the callback predicate */\nexport function find<T>(collection: T[], callback: Predicate<T>): T;\n/** Finds an object from an array, or a property of an object, that matches a predicate */\nexport function find(collection: any, callback: any) {\n  let result;\n\n  forEach(collection, function(item, i) {\n    if (result) return;\n    if (callback(item, i)) result = item;\n  });\n\n  return result;\n}\n\n/** Given an object, returns a new object, where each property is transformed by the callback function */\nexport let mapObj: <T, U>(\n  collection: { [key: string]: T },\n  callback: Mapper<T, U>,\n  target?: typeof collection\n) => { [key: string]: U } = map;\n/** Given an array, returns a new array, where each element is transformed by the callback function */\nexport function map<T, U>(collection: T[], callback: Mapper<T, U>, target?: typeof collection): U[];\nexport function map<T, U>(\n  collection: { [key: string]: T },\n  callback: Mapper<T, U>,\n  target?: typeof collection\n): { [key: string]: U };\n/** Maps an array or object properties using a callback function */\nexport function map(collection: any, callback: any, target: typeof collection): any {\n  target = target || (isArray(collection) ? [] : {});\n  forEach(collection, (item, i) => (target[i] = callback(item, i)));\n  return target;\n}\n\n/**\n * Given an object, return its enumerable property values\n *\n * @example\n * ```\n *\n * let foo = { a: 1, b: 2, c: 3 }\n * let vals = values(foo); // [ 1, 2, 3 ]\n * ```\n */\nexport const values: (<T>(obj: TypedMap<T>) => T[]) = (obj: Obj) => Object.keys(obj).map(key => obj[key]);\n\n/**\n * Reduce function that returns true if all of the values are truthy.\n *\n * @example\n * ```\n *\n * let vals = [ 1, true, {}, \"hello world\"];\n * vals.reduce(allTrueR, true); // true\n *\n * vals.push(0);\n * vals.reduce(allTrueR, true); // false\n * ```\n */\nexport const allTrueR = (memo: boolean, elem: any) => memo && elem;\n\n/**\n * Reduce function that returns true if any of the values are truthy.\n *\n *  * @example\n * ```\n *\n * let vals = [ 0, null, undefined ];\n * vals.reduce(anyTrueR, true); // false\n *\n * vals.push(\"hello world\");\n * vals.reduce(anyTrueR, true); // true\n * ```\n */\nexport const anyTrueR = (memo: boolean, elem: any) => memo || elem;\n\n/**\n * Reduce function which un-nests a single level of arrays\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * input.reduce(unnestR, []) // [ \"a\", \"b\", \"c\", \"d\", [ \"double, \"nested\" ] ]\n * ```\n */\nexport const unnestR = (memo: any[], elem: any[]) => memo.concat(elem);\n\n/**\n * Reduce function which recursively un-nests all arrays\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * input.reduce(unnestR, []) // [ \"a\", \"b\", \"c\", \"d\", \"double, \"nested\" ]\n * ```\n */\nexport const flattenR = (memo: any[], elem: any) =>\n  isArray(elem) ? memo.concat(elem.reduce(flattenR, [])) : pushR(memo, elem);\n\n/**\n * Reduce function that pushes an object to an array, then returns the array.\n * Mostly just for [[flattenR]] and [[uniqR]]\n */\nexport function pushR(arr: any[], obj: any) {\n  arr.push(obj);\n  return arr;\n}\n\n/** Reduce function that filters out duplicates */\nexport const uniqR = <T>(acc: T[], token: T): T[] => (inArray(acc, token) ? acc : pushR(acc, token));\n\n/**\n * Return a new array with a single level of arrays unnested.\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * unnest(input) // [ \"a\", \"b\", \"c\", \"d\", [ \"double, \"nested\" ] ]\n * ```\n */\nexport const unnest = (arr: any[]) => arr.reduce(unnestR, []);\n/**\n * Return a completely flattened version of an array.\n *\n * @example\n * ```\n *\n * let input = [ [ \"a\", \"b\" ], [ \"c\", \"d\" ], [ [ \"double\", \"nested\" ] ] ];\n * flatten(input) // [ \"a\", \"b\", \"c\", \"d\", \"double, \"nested\" ]\n * ```\n */\nexport const flatten = (arr: any[]) => arr.reduce(flattenR, []);\n\n/**\n * Given a .filter Predicate, builds a .filter Predicate which throws an error if any elements do not pass.\n * @example\n * ```\n *\n * let isNumber = (obj) => typeof(obj) === 'number';\n * let allNumbers = [ 1, 2, 3, 4, 5 ];\n * allNumbers.filter(assertPredicate(isNumber)); //OK\n *\n * let oneString = [ 1, 2, 3, 4, \"5\" ];\n * oneString.filter(assertPredicate(isNumber, \"Not all numbers\")); // throws Error(\"\"Not all numbers\"\");\n * ```\n */\nexport const assertPredicate: <T>(predicate: Predicate<T>, errMsg: string | Function) => Predicate<T> = assertFn;\n/**\n * Given a .map function, builds a .map function which throws an error if any mapped elements do not pass a truthyness test.\n * @example\n * ```\n *\n * var data = { foo: 1, bar: 2 };\n *\n * let keys = [ 'foo', 'bar' ]\n * let values = keys.map(assertMap(key => data[key], \"Key not found\"));\n * // values is [1, 2]\n *\n * let keys = [ 'foo', 'bar', 'baz' ]\n * let values = keys.map(assertMap(key => data[key], \"Key not found\"));\n * // throws Error(\"Key not found\")\n * ```\n */\nexport const assertMap: <T, U>(mapFn: (t: T) => U, errMsg: string | Function) => (t: T) => U = assertFn;\nexport function assertFn(predicateOrMap: Function, errMsg: string | Function = 'assert failure'): any {\n  return obj => {\n    const result = predicateOrMap(obj);\n    if (!result) {\n      throw new Error(isFunction(errMsg) ? (<Function>errMsg)(obj) : errMsg);\n    }\n    return result;\n  };\n}\n\n/**\n * Like _.pairs: Given an object, returns an array of key/value pairs\n *\n * @example\n * ```\n *\n * pairs({ foo: \"FOO\", bar: \"BAR }) // [ [ \"foo\", \"FOO\" ], [ \"bar\": \"BAR\" ] ]\n * ```\n */\nexport const pairs = (obj: Obj) => Object.keys(obj).map(key => [key, obj[key]]);\n\n/**\n * Given two or more parallel arrays, returns an array of tuples where\n * each tuple is composed of [ a[i], b[i], ... z[i] ]\n *\n * @example\n * ```\n *\n * let foo = [ 0, 2, 4, 6 ];\n * let bar = [ 1, 3, 5, 7 ];\n * let baz = [ 10, 30, 50, 70 ];\n * arrayTuples(foo, bar);       // [ [0, 1], [2, 3], [4, 5], [6, 7] ]\n * arrayTuples(foo, bar, baz);  // [ [0, 1, 10], [2, 3, 30], [4, 5, 50], [6, 7, 70] ]\n * ```\n */\nexport function arrayTuples(...args: any[]): any[] {\n  if (args.length === 0) return [];\n  const maxArrayLen = args.reduce((min, arr) => Math.min(arr.length, min), 9007199254740991); // aka 2^53 − 1 aka Number.MAX_SAFE_INTEGER\n  const result = [];\n\n  for (let i = 0; i < maxArrayLen; i++) {\n    // This is a hot function\n    // Unroll when there are 1-4 arguments\n    switch (args.length) {\n      case 1:\n        result.push([args[0][i]]);\n        break;\n      case 2:\n        result.push([args[0][i], args[1][i]]);\n        break;\n      case 3:\n        result.push([args[0][i], args[1][i], args[2][i]]);\n        break;\n      case 4:\n        result.push([args[0][i], args[1][i], args[2][i], args[3][i]]);\n        break;\n      default:\n        result.push(args.map(array => array[i]));\n        break;\n    }\n  }\n\n  return result;\n}\n\n/**\n * Reduce function which builds an object from an array of [key, value] pairs.\n *\n * Each iteration sets the key/val pair on the memo object, then returns the memo for the next iteration.\n *\n * Each keyValueTuple should be an array with values [ key: string, value: any ]\n *\n * @example\n * ```\n *\n * var pairs = [ [\"fookey\", \"fooval\"], [\"barkey\", \"barval\"] ]\n *\n * var pairsToObj = pairs.reduce((memo, pair) => applyPairs(memo, pair), {})\n * // pairsToObj == { fookey: \"fooval\", barkey: \"barval\" }\n *\n * // Or, more simply:\n * var pairsToObj = pairs.reduce(applyPairs, {})\n * // pairsToObj == { fookey: \"fooval\", barkey: \"barval\" }\n * ```\n */\nexport function applyPairs(memo: TypedMap<any>, keyValTuple: any[]) {\n  let key: string, value: any;\n  if (isArray(keyValTuple)) [key, value] = keyValTuple;\n  if (!isString(key)) throw new Error('invalid parameters to applyPairs');\n  memo[key] = value;\n  return memo;\n}\n\n/** Get the last element of an array */\nexport function tail<T>(arr: T[]): T {\n  return (arr.length && arr[arr.length - 1]) || undefined;\n}\n\n/**\n * shallow copy from src to dest\n */\nexport function copy(src: Obj, dest?: Obj) {\n  if (dest) Object.keys(dest).forEach(key => delete dest[key]);\n  if (!dest) dest = {};\n  return extend(dest, src);\n}\n\n/** Naive forEach implementation works with Objects or Arrays */\nfunction _forEach(obj: any[] | any, cb: (el, idx?) => void, _this: Obj) {\n  if (isArray(obj)) return obj.forEach(cb, _this);\n  Object.keys(obj).forEach(key => cb(obj[key], key));\n}\n\n/** Like Object.assign() */\nexport function _extend(toObj: Obj, ...fromObjs: Obj[]): any;\nexport function _extend(toObj: Obj): any {\n  for (let i = 1; i < arguments.length; i++) {\n    const obj = arguments[i];\n    if (!obj) continue;\n    const keys = Object.keys(obj);\n\n    for (let j = 0; j < keys.length; j++) {\n      toObj[keys[j]] = obj[keys[j]];\n    }\n  }\n\n  return toObj;\n}\n\nfunction _equals(o1: any, o2: any): boolean {\n  if (o1 === o2) return true;\n  if (o1 === null || o2 === null) return false;\n  if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN\n  const t1 = typeof o1,\n    t2 = typeof o2;\n  if (t1 !== t2 || t1 !== 'object') return false;\n\n  const tup = [o1, o2];\n  if (all(isArray)(tup)) return _arraysEq(o1, o2);\n  if (all(isDate)(tup)) return o1.getTime() === o2.getTime();\n  if (all(isRegExp)(tup)) return o1.toString() === o2.toString();\n  if (all(isFunction)(tup)) return true; // meh\n\n  const predicates = [isFunction, isArray, isDate, isRegExp];\n  if (predicates.map(any).reduce((b, fn) => b || !!fn(tup), false)) return false;\n\n  const keys: { [i: string]: boolean } = {};\n  // tslint:disable-next-line:forin\n  for (const key in o1) {\n    if (!_equals(o1[key], o2[key])) return false;\n    keys[key] = true;\n  }\n  for (const key in o2) {\n    if (!keys[key]) return false;\n  }\n\n  return true;\n}\n\nfunction _arraysEq(a1: any[], a2: any[]) {\n  if (a1.length !== a2.length) return false;\n  return arrayTuples(a1, a2).reduce((b, t) => b && _equals(t[0], t[1]), true);\n}\n\n// issue #2676\nexport const silenceUncaughtInPromise = (promise: Promise<any>) => promise.catch(e => 0) && promise;\nexport const silentRejection = (error: any) => silenceUncaughtInPromise(services.$q.reject(error));\n",
    "/** @publicapi @module core */\n/**\n * Matches state names using glob-like pattern strings.\n *\n * Globs can be used in specific APIs including:\n *\n * - [[StateService.is]]\n * - [[StateService.includes]]\n * - The first argument to Hook Registration functions like [[TransitionService.onStart]]\n *    - [[HookMatchCriteria]] and [[HookMatchCriterion]]\n *\n * A `Glob` string is a pattern which matches state names.\n * Nested state names are split into segments (separated by a dot) when processing.\n * The state named `foo.bar.baz` is split into three segments ['foo', 'bar', 'baz']\n *\n * Globs work according to the following rules:\n *\n * ### Exact match:\n *\n * The glob `'A.B'` matches the state named exactly `'A.B'`.\n *\n * | Glob        |Matches states named|Does not match state named|\n * |:------------|:--------------------|:---------------------|\n * | `'A'`       | `'A'`               | `'B'` , `'A.C'`      |\n * | `'A.B'`     | `'A.B'`             | `'A'` , `'A.B.C'`    |\n * | `'foo'`     | `'foo'`             | `'FOO'` , `'foo.bar'`|\n *\n * ### Single star (`*`)\n *\n * A single star (`*`) is a wildcard that matches exactly one segment.\n *\n * | Glob        |Matches states named  |Does not match state named |\n * |:------------|:---------------------|:--------------------------|\n * | `'*'`       | `'A'` , `'Z'`        | `'A.B'` , `'Z.Y.X'`       |\n * | `'A.*'`     | `'A.B'` , `'A.C'`    | `'A'` , `'A.B.C'`         |\n * | `'A.*.*'`   | `'A.B.C'` , `'A.X.Y'`| `'A'`, `'A.B'` , `'Z.Y.X'`|\n *\n * ### Double star (`**`)\n *\n * A double star (`'**'`) is a wildcard that matches *zero or more segments*\n *\n * | Glob        |Matches states named                           |Does not match state named         |\n * |:------------|:----------------------------------------------|:----------------------------------|\n * | `'**'`      | `'A'` , `'A.B'`, `'Z.Y.X'`                    | (matches all states)              |\n * | `'A.**'`    | `'A'` , `'A.B'` , `'A.C.X'`                   | `'Z.Y.X'`                         |\n * | `'**.X'`    | `'X'` , `'A.X'` , `'Z.Y.X'`                   | `'A'` , `'A.login.Z'`             |\n * | `'A.**.X'`  | `'A.X'` , `'A.B.X'` , `'A.B.C.X'`             | `'A'` , `'A.B.C'`                 |\n *\n */\nexport class Glob {\n  text: string;\n  glob: Array<string>;\n  regexp: RegExp;\n\n  /** Returns true if the string has glob-like characters in it */\n  static is(text: string) {\n    return !!/[!,*]+/.exec(text);\n  }\n\n  /** Returns a glob from the string, or null if the string isn't Glob-like */\n  static fromString(text: string) {\n    return Glob.is(text) ? new Glob(text) : null;\n  }\n\n  constructor(text: string) {\n    this.text = text;\n    this.glob = text.split('.');\n\n    const regexpString = this.text\n      .split('.')\n      .map(seg => {\n        if (seg === '**') return '(?:|(?:\\\\.[^.]*)*)';\n        if (seg === '*') return '\\\\.[^.]*';\n        return '\\\\.' + seg;\n      })\n      .join('');\n\n    this.regexp = new RegExp('^' + regexpString + '$');\n  }\n\n  matches(name: string) {\n    return this.regexp.test('.' + name);\n  }\n}\n",
    "/** @publicapi @module common */ /** */\nimport { pushTo } from './common';\n\nexport class Queue<T> {\n  private _evictListeners: ((item: T) => void)[] = [];\n  public onEvict = pushTo(this._evictListeners);\n\n  constructor(private _items: T[] = [], private _limit: number = null) {}\n\n  enqueue(item: T) {\n    const items = this._items;\n    items.push(item);\n    if (this._limit && items.length > this._limit) this.evict();\n    return item;\n  }\n\n  evict(): T {\n    const item: T = this._items.shift();\n    this._evictListeners.forEach(fn => fn(item));\n    return item;\n  }\n\n  dequeue(): T {\n    if (this.size()) return this._items.splice(0, 1)[0];\n  }\n\n  clear(): Array<T> {\n    const current = this._items;\n    this._items = [];\n    return current;\n  }\n\n  size(): number {\n    return this._items.length;\n  }\n\n  remove(item: T) {\n    const idx = this._items.indexOf(item);\n    return idx > -1 && this._items.splice(idx, 1)[0];\n  }\n\n  peekTail(): T {\n    return this._items[this._items.length - 1];\n  }\n\n  peekHead(): T {\n    if (this.size()) return this._items[0];\n  }\n}\n",
    "/** @publicapi @module transition */ /** */\n'use strict';\nimport { extend, silentRejection } from '../common/common';\nimport { stringify } from '../common/strings';\nimport { is } from '../common/hof';\n\nenum RejectType {\n  /**\n   * A new transition superseded this one.\n   *\n   * While this transition was running, a new transition started.\n   * This transition is cancelled because it was superseded by new transition.\n   */\n  SUPERSEDED = 2,\n\n  /**\n   * The transition was aborted\n   *\n   * The transition was aborted by a hook which returned `false`\n   */\n  ABORTED = 3,\n\n  /**\n   * The transition was invalid\n   *\n   * The transition was never started because it was invalid\n   */\n  INVALID = 4,\n\n  /**\n   * The transition was ignored\n   *\n   * The transition was ignored because it would have no effect.\n   *\n   * Either:\n   *\n   * - The transition is targeting the current state and parameter values\n   * - The transition is targeting the same state and parameter values as the currently running transition.\n   */\n  IGNORED = 5,\n\n  /**\n   * The transition errored.\n   *\n   * This generally means a hook threw an error or returned a rejected promise\n   */\n  ERROR = 6,\n}\n\nexport { RejectType };\n\n/** @hidden */\nlet id = 0;\n\nexport class Rejection {\n  /** @hidden */\n  $id = id++;\n  /**\n   * The type of the rejection.\n   *\n   * This value is an number representing the type of transition rejection.\n   * If using Typescript, this is a Typescript enum.\n   *\n   * - [[RejectType.SUPERSEDED]] (`2`)\n   * - [[RejectType.ABORTED]] (`3`)\n   * - [[RejectType.INVALID]] (`4`)\n   * - [[RejectType.IGNORED]] (`5`)\n   * - [[RejectType.ERROR]] (`6`)\n   *\n   */\n  type: RejectType;\n\n  /**\n   * A message describing the rejection\n   */\n  message: string;\n\n  /**\n   * A detail object\n   *\n   * This value varies based on the mechanism for rejecting the transition.\n   * For example, if an error was thrown from a hook, the `detail` will be the `Error` object.\n   * If a hook returned a rejected promise, the `detail` will be the rejected value.\n   */\n  detail: any;\n\n  /**\n   * Indicates if the transition was redirected.\n   *\n   * When a transition is redirected, the rejection [[type]] will be [[RejectType.SUPERSEDED]] and this flag will be true.\n   */\n  redirected: boolean;\n\n  /** Returns true if the obj is a rejected promise created from the `asPromise` factory */\n  static isRejectionPromise(obj: any): boolean {\n    return obj && typeof obj.then === 'function' && is(Rejection)(obj._transitionRejection);\n  }\n\n  /** Returns a Rejection due to transition superseded */\n  static superseded(detail?: any, options?: any): Rejection {\n    const message = 'The transition has been superseded by a different transition';\n    const rejection = new Rejection(RejectType.SUPERSEDED, message, detail);\n    if (options && options.redirected) {\n      rejection.redirected = true;\n    }\n    return rejection;\n  }\n\n  /** Returns a Rejection due to redirected transition */\n  static redirected(detail?: any): Rejection {\n    return Rejection.superseded(detail, { redirected: true });\n  }\n\n  /** Returns a Rejection due to invalid transition */\n  static invalid(detail?: any): Rejection {\n    const message = 'This transition is invalid';\n    return new Rejection(RejectType.INVALID, message, detail);\n  }\n\n  /** Returns a Rejection due to ignored transition */\n  static ignored(detail?: any): Rejection {\n    const message = 'The transition was ignored';\n    return new Rejection(RejectType.IGNORED, message, detail);\n  }\n\n  /** Returns a Rejection due to aborted transition */\n  static aborted(detail?: any): Rejection {\n    const message = 'The transition has been aborted';\n    return new Rejection(RejectType.ABORTED, message, detail);\n  }\n\n  /** Returns a Rejection due to aborted transition */\n  static errored(detail?: any): Rejection {\n    const message = 'The transition errored';\n    return new Rejection(RejectType.ERROR, message, detail);\n  }\n\n  /**\n   * Returns a Rejection\n   *\n   * Normalizes a value as a Rejection.\n   * If the value is already a Rejection, returns it.\n   * Otherwise, wraps and returns the value as a Rejection (Rejection type: ERROR).\n   *\n   * @returns `detail` if it is already a `Rejection`, else returns an ERROR Rejection.\n   */\n  static normalize(detail?: Rejection | Error | any): Rejection {\n    return is(Rejection)(detail) ? detail : Rejection.errored(detail);\n  }\n\n  constructor(type: number, message?: string, detail?: any) {\n    this.type = type;\n    this.message = message;\n    this.detail = detail;\n  }\n\n  toString() {\n    const detailString = (d: any) => (d && d.toString !== Object.prototype.toString ? d.toString() : stringify(d));\n    const detail = detailString(this.detail);\n    const { $id, type, message } = this;\n    return `Transition Rejection($id: ${$id} type: ${type}, message: ${message}, detail: ${detail})`;\n  }\n\n  toPromise(): Promise<any> {\n    return extend(silentRejection(this), { _transitionRejection: this });\n  }\n}\n",
    "/**\n * Functions that manipulate strings\n *\n * Although these functions are exported, they are subject to change without notice.\n *\n * @module common_strings\n */ /** */\n\nimport { isArray, isFunction, isInjectable, isNull, isObject, isPromise, isString, isUndefined } from './predicates';\nimport { Rejection } from '../transition/rejectFactory';\nimport { identity, IInjectable, pushR, tail } from './common';\nimport { pattern, val } from './hof';\n\n/**\n * Returns a string shortened to a maximum length\n *\n * If the string is already less than the `max` length, return the string.\n * Else return the string, shortened to `max - 3` and append three dots (\"...\").\n *\n * @param max the maximum length of the string to return\n * @param str the input string\n */\nexport function maxLength(max: number, str: string) {\n  if (str.length <= max) return str;\n  return str.substr(0, max - 3) + '...';\n}\n\n/**\n * Returns a string, with spaces added to the end, up to a desired str length\n *\n * If the string is already longer than the desired length, return the string.\n * Else returns the string, with extra spaces on the end, such that it reaches `length` characters.\n *\n * @param length the desired length of the string to return\n * @param str the input string\n */\nexport function padString(length: number, str: string) {\n  while (str.length < length) str += ' ';\n  return str;\n}\n\nexport function kebobString(camelCase: string) {\n  return camelCase\n    .replace(/^([A-Z])/, $1 => $1.toLowerCase()) // replace first char\n    .replace(/([A-Z])/g, $1 => '-' + $1.toLowerCase()); // replace rest\n}\n\nexport function functionToString(fn: Function) {\n  const fnStr = fnToString(fn);\n  const namedFunctionMatch = fnStr.match(/^(function [^ ]+\\([^)]*\\))/);\n  const toStr = namedFunctionMatch ? namedFunctionMatch[1] : fnStr;\n\n  const fnName = fn['name'] || '';\n  if (fnName && toStr.match(/function \\(/)) {\n    return 'function ' + fnName + toStr.substr(9);\n  }\n  return toStr;\n}\n\nexport function fnToString(fn: IInjectable) {\n  const _fn = isArray(fn) ? fn.slice(-1)[0] : fn;\n  return (_fn && _fn.toString()) || 'undefined';\n}\n\nconst isRejection = Rejection.isRejectionPromise;\nconst hasToString = (obj: any) =>\n  isObject(obj) && !isArray(obj) && obj.constructor !== Object && isFunction(obj.toString);\n\nconst stringifyPattern = pattern([\n  [isUndefined, val('undefined')],\n  [isNull, val('null')],\n  [isPromise, val('[Promise]')],\n  [isRejection, (x: any) => x._transitionRejection.toString()],\n  [hasToString, (x: object) => x.toString()],\n  [isInjectable, functionToString],\n  [val(true), identity],\n]) as (val: any) => string;\n\nexport function stringify(o: any) {\n  const seen: any[] = [];\n\n  function format(value: any) {\n    if (isObject(value)) {\n      if (seen.indexOf(value) !== -1) return '[circular ref]';\n      seen.push(value);\n    }\n    return stringifyPattern(value);\n  }\n\n  if (isUndefined(o)) {\n    // Workaround for IE & Edge Spec incompatibility where replacer function would not be called when JSON.stringify\n    // is given `undefined` as value. To work around that, we simply detect `undefined` and bail out early by\n    // manually stringifying it.\n    return format(o);\n  }\n\n  return JSON.stringify(o, (key, value) => format(value)).replace(/\\\\\"/g, '\"');\n}\n\n/** Returns a function that splits a string on a character or substring */\nexport const beforeAfterSubstr = (char: string) => (str: string): string[] => {\n  if (!str) return ['', ''];\n  const idx = str.indexOf(char);\n  if (idx === -1) return [str, ''];\n  return [str.substr(0, idx), str.substr(idx + 1)];\n};\n\nexport const hostRegex = new RegExp('^(?:[a-z]+:)?//[^/]+/');\nexport const stripLastPathElement = (str: string) => str.replace(/\\/[^/]*$/, '');\nexport const splitHash = beforeAfterSubstr('#');\nexport const splitQuery = beforeAfterSubstr('?');\nexport const splitEqual = beforeAfterSubstr('=');\nexport const trimHashVal = (str: string) => (str ? str.replace(/^#/, '') : '');\n\n/**\n * Splits on a delimiter, but returns the delimiters in the array\n *\n * #### Example:\n * ```js\n * var splitOnSlashes = splitOnDelim('/');\n * splitOnSlashes(\"/foo\"); // [\"/\", \"foo\"]\n * splitOnSlashes(\"/foo/\"); // [\"/\", \"foo\", \"/\"]\n * ```\n */\nexport function splitOnDelim(delim: string) {\n  const re = new RegExp('(' + delim + ')', 'g');\n  return (str: string) => str.split(re).filter(identity);\n}\n\n/**\n * Reduce fn that joins neighboring strings\n *\n * Given an array of strings, returns a new array\n * where all neighboring strings have been joined.\n *\n * #### Example:\n * ```js\n * let arr = [\"foo\", \"bar\", 1, \"baz\", \"\", \"qux\" ];\n * arr.reduce(joinNeighborsR, []) // [\"foobar\", 1, \"bazqux\" ]\n * ```\n */\nexport function joinNeighborsR(acc: any[], x: any) {\n  if (isString(tail(acc)) && isString(x)) return acc.slice(0, -1).concat(tail(acc) + x);\n  return pushR(acc, x);\n}\n",
    "/**\n * # Transition tracing (debug)\n *\n * Enable transition tracing to print transition information to the console,\n * in order to help debug your application.\n * Tracing logs detailed information about each Transition to your console.\n *\n * To enable tracing, import the [[Trace]] singleton and enable one or more categories.\n *\n * ### ES6\n * ```js\n * import {trace} from \"@uirouter/core\";\n * trace.enable(1, 5); // TRANSITION and VIEWCONFIG\n * ```\n *\n * ### CJS\n * ```js\n * let trace = require(\"@uirouter/core\").trace;\n * trace.enable(\"TRANSITION\", \"VIEWCONFIG\");\n * ```\n *\n * ### Globals\n * ```js\n * let trace = window[\"@uirouter/core\"].trace;\n * trace.enable(); // Trace everything (very verbose)\n * ```\n *\n * ### Angular 1:\n * ```js\n * app.run($trace => $trace.enable());\n * ```\n *\n * @publicapi @module trace\n */\n/* tslint:disable:no-console */\nimport { parse } from '../common/hof';\nimport { isFunction, isNumber } from '../common/predicates';\nimport { Transition } from '../transition/transition';\nimport { ViewTuple } from '../view';\nimport { ActiveUIView, ViewConfig, ViewContext } from '../view/interface';\nimport { stringify, functionToString, maxLength, padString } from './strings';\nimport { Resolvable } from '../resolve/resolvable';\nimport { PathNode } from '../path/pathNode';\nimport { PolicyWhen } from '../resolve/interface';\nimport { TransitionHook } from '../transition/transitionHook';\nimport { HookResult } from '../transition/interface';\nimport { StateObject } from '../state/stateObject';\n\n/** @hidden */\nfunction uiViewString(uiview: ActiveUIView) {\n  if (!uiview) return 'ui-view (defunct)';\n  const state = uiview.creationContext ? uiview.creationContext.name || '(root)' : '(none)';\n  return `[ui-view#${uiview.id} ${uiview.$type}:${uiview.fqn} (${uiview.name}@${state})]`;\n}\n\n/** @hidden */\nconst viewConfigString = (viewConfig: ViewConfig) => {\n  const view = viewConfig.viewDecl;\n  const state = view.$context.name || '(root)';\n  return `[View#${viewConfig.$id} from '${state}' state]: target ui-view: '${view.$uiViewName}@${\n    view.$uiViewContextAnchor\n  }'`;\n};\n\n/** @hidden */\nfunction normalizedCat(input: Category | string): string {\n  return isNumber(input) ? Category[input] : Category[Category[input]];\n}\n\n/** @hidden */\nconst consoleLog = Function.prototype.bind.call(console.log, console);\n\n/** @hidden */\nconst consoletable = isFunction(console.table) ? console.table.bind(console) : consoleLog.bind(console);\n\n/**\n * Trace categories Enum\n *\n * Enable or disable a category using [[Trace.enable]] or [[Trace.disable]]\n *\n * `trace.enable(Category.TRANSITION)`\n *\n * These can also be provided using a matching string, or position ordinal\n *\n * `trace.enable(\"TRANSITION\")`\n *\n * `trace.enable(1)`\n */\nenum Category {\n  RESOLVE,\n  TRANSITION,\n  HOOK,\n  UIVIEW,\n  VIEWCONFIG,\n}\n\nexport { Category };\n\n/** @hidden */\nconst _tid = parse('$id');\n\n/** @hidden */\nconst _rid = parse('router.$id');\n\n/** @hidden */\nconst transLbl = trans => `Transition #${_tid(trans)}-${_rid(trans)}`;\n\n/**\n * Prints UI-Router Transition trace information to the console.\n */\nexport class Trace {\n  /** @hidden */\n  approximateDigests: number;\n\n  /** @hidden */\n  private _enabled: { [key: string]: boolean } = {};\n\n  /** @hidden */\n  constructor() {\n    this.approximateDigests = 0;\n  }\n\n  /** @hidden */\n  private _set(enabled: boolean, categories: Category[]) {\n    if (!categories.length) {\n      categories = <any>Object.keys(Category)\n        .map(k => parseInt(k, 10))\n        .filter(k => !isNaN(k))\n        .map(key => Category[key]);\n    }\n    categories.map(normalizedCat).forEach(category => (this._enabled[category] = enabled));\n  }\n\n  /**\n   * Enables a trace [[Category]]\n   *\n   * ```js\n   * trace.enable(\"TRANSITION\");\n   * ```\n   *\n   * @param categories categories to enable. If `categories` is omitted, all categories are enabled.\n   *        Also takes strings (category name) or ordinal (category position)\n   */\n  enable(...categories: (Category | string | number)[]);\n  enable(...categories: any[]) {\n    this._set(true, categories);\n  }\n  /**\n   * Disables a trace [[Category]]\n   *\n   * ```js\n   * trace.disable(\"VIEWCONFIG\");\n   * ```\n   *\n   * @param categories categories to disable. If `categories` is omitted, all categories are disabled.\n   *        Also takes strings (category name) or ordinal (category position)\n   */\n  disable(...categories: (Category | string | number)[]);\n  disable(...categories: any[]) {\n    this._set(false, categories);\n  }\n\n  /**\n   * Retrieves the enabled stateus of a [[Category]]\n   *\n   * ```js\n   * trace.enabled(\"VIEWCONFIG\"); // true or false\n   * ```\n   *\n   * @returns boolean true if the category is enabled\n   */\n  enabled(category: Category | string | number): boolean {\n    return !!this._enabled[normalizedCat(category)];\n  }\n\n  /** @internalapi called by ui-router code */\n  traceTransitionStart(trans: Transition) {\n    if (!this.enabled(Category.TRANSITION)) return;\n    console.log(`${transLbl(trans)}: Started  -> ${stringify(trans)}`);\n  }\n\n  /** @internalapi called by ui-router code */\n  traceTransitionIgnored(trans: Transition) {\n    if (!this.enabled(Category.TRANSITION)) return;\n    console.log(`${transLbl(trans)}: Ignored  <> ${stringify(trans)}`);\n  }\n\n  /** @internalapi called by ui-router code */\n  traceHookInvocation(step: TransitionHook, trans: Transition, options: any) {\n    if (!this.enabled(Category.HOOK)) return;\n    const event = parse('traceData.hookType')(options) || 'internal',\n      context = parse('traceData.context.state.name')(options) || parse('traceData.context')(options) || 'unknown',\n      name = functionToString((step as any).registeredHook.callback);\n    console.log(`${transLbl(trans)}:   Hook -> ${event} context: ${context}, ${maxLength(200, name)}`);\n  }\n\n  /** @internalapi called by ui-router code */\n  traceHookResult(hookResult: HookResult, trans: Transition, transitionOptions: any) {\n    if (!this.enabled(Category.HOOK)) return;\n    console.log(`${transLbl(trans)}:   <- Hook returned: ${maxLength(200, stringify(hookResult))}`);\n  }\n\n  /** @internalapi called by ui-router code */\n  traceResolvePath(path: PathNode[], when: PolicyWhen, trans?: Transition) {\n    if (!this.enabled(Category.RESOLVE)) return;\n    console.log(`${transLbl(trans)}:         Resolving ${path} (${when})`);\n  }\n\n  /** @internalapi called by ui-router code */\n  traceResolvableResolved(resolvable: Resolvable, trans?: Transition) {\n    if (!this.enabled(Category.RESOLVE)) return;\n    console.log(\n      `${transLbl(trans)}:               <- Resolved  ${resolvable} to: ${maxLength(200, stringify(resolvable.data))}`\n    );\n  }\n\n  /** @internalapi called by ui-router code */\n  traceError(reason: any, trans: Transition) {\n    if (!this.enabled(Category.TRANSITION)) return;\n    console.log(`${transLbl(trans)}: <- Rejected ${stringify(trans)}, reason: ${reason}`);\n  }\n\n  /** @internalapi called by ui-router code */\n  traceSuccess(finalState: StateObject, trans: Transition) {\n    if (!this.enabled(Category.TRANSITION)) return;\n    console.log(`${transLbl(trans)}: <- Success  ${stringify(trans)}, final state: ${finalState.name}`);\n  }\n\n  /** @internalapi called by ui-router code */\n  traceUIViewEvent(event: string, viewData: ActiveUIView, extra = '') {\n    if (!this.enabled(Category.UIVIEW)) return;\n    console.log(`ui-view: ${padString(30, event)} ${uiViewString(viewData)}${extra}`);\n  }\n\n  /** @internalapi called by ui-router code */\n  traceUIViewConfigUpdated(viewData: ActiveUIView, context: ViewContext) {\n    if (!this.enabled(Category.UIVIEW)) return;\n    this.traceUIViewEvent('Updating', viewData, ` with ViewConfig from context='${context}'`);\n  }\n\n  /** @internalapi called by ui-router code */\n  traceUIViewFill(viewData: ActiveUIView, html: string) {\n    if (!this.enabled(Category.UIVIEW)) return;\n    this.traceUIViewEvent('Fill', viewData, ` with: ${maxLength(200, html)}`);\n  }\n\n  /** @internalapi called by ui-router code */\n  traceViewSync(pairs: ViewTuple[]) {\n    if (!this.enabled(Category.VIEWCONFIG)) return;\n    const uivheader = 'uiview component fqn';\n    const cfgheader = 'view config state (view name)';\n    const mapping = pairs\n      .map(({ uiView, viewConfig }) => {\n        const uiv = uiView && uiView.fqn;\n        const cfg = viewConfig && `${viewConfig.viewDecl.$context.name}: (${viewConfig.viewDecl.$name})`;\n        return { [uivheader]: uiv, [cfgheader]: cfg };\n      })\n      .sort((a, b) => (a[uivheader] || '').localeCompare(b[uivheader] || ''));\n\n    consoletable(mapping);\n  }\n\n  /** @internalapi called by ui-router code */\n  traceViewServiceEvent(event: string, viewConfig: ViewConfig) {\n    if (!this.enabled(Category.VIEWCONFIG)) return;\n    console.log(`VIEWCONFIG: ${event} ${viewConfigString(viewConfig)}`);\n  }\n\n  /** @internalapi called by ui-router code */\n  traceViewServiceUIViewEvent(event: string, viewData: ActiveUIView) {\n    if (!this.enabled(Category.VIEWCONFIG)) return;\n    console.log(`VIEWCONFIG: ${event} ${uiViewString(viewData)}`);\n  }\n}\n\n/**\n * The [[Trace]] singleton\n *\n * #### Example:\n * ```js\n * import {trace} from \"@uirouter/core\";\n * trace.enable(1, 5);\n * ```\n */\nconst trace = new Trace();\nexport { trace };\n",
    "/** @publicapi @module common */ /** */\nexport * from './common';\nexport * from './coreservices';\nexport * from './glob';\nexport * from './hof';\nexport * from './predicates';\nexport * from './queue';\nexport * from './strings';\nexport * from './trace';\n",
    "/** @publicapi @module params */ /** */\nimport { extend, filter, map } from '../common/common';\nimport { isArray, isDefined } from '../common/predicates';\nimport { ParamTypeDefinition } from './interface';\n\n/**\n * An internal class which implements [[ParamTypeDefinition]].\n *\n * A [[ParamTypeDefinition]] is a plain javascript object used to register custom parameter types.\n * When a param type definition is registered, an instance of this class is created internally.\n *\n * This class has naive implementations for all the [[ParamTypeDefinition]] methods.\n *\n * Used by [[UrlMatcher]] when matching or formatting URLs, or comparing and validating parameter values.\n *\n * #### Example:\n * ```js\n * var paramTypeDef = {\n *   decode: function(val) { return parseInt(val, 10); },\n *   encode: function(val) { return val && val.toString(); },\n *   equals: function(a, b) { return this.is(a) && a === b; },\n *   is: function(val) { return angular.isNumber(val) && isFinite(val) && val % 1 === 0; },\n *   pattern: /\\d+/\n * }\n *\n * var paramType = new ParamType(paramTypeDef);\n * ```\n * @internalapi\n */\nexport class ParamType implements ParamTypeDefinition {\n  /** @inheritdoc */\n  pattern: RegExp = /.*/;\n  /** The name/id of the parameter type */\n  name: string;\n  /** @inheritdoc */\n  raw: boolean;\n  /** @inheritdoc */\n  dynamic: boolean;\n  /** @inheritdoc */\n  inherit = true;\n\n  /**\n   * @param def  A configuration object which contains the custom type definition.  The object's\n   *        properties will override the default methods and/or pattern in `ParamType`'s public interface.\n   * @returns a new ParamType object\n   */\n  constructor(def: ParamTypeDefinition) {\n    extend(this, def);\n  }\n\n  // consider these four methods to be \"abstract methods\" that should be overridden\n  /** @inheritdoc */\n  is(val: any, key?: string): boolean {\n    return true;\n  }\n  /** @inheritdoc */\n  encode(val: any, key?: string): string | string[] {\n    return val;\n  }\n  /** @inheritdoc */\n  decode(val: string, key?: string): any {\n    return val;\n  }\n  /** @inheritdoc */\n  equals(a: any, b: any): boolean {\n    // tslint:disable-next-line:triple-equals\n    return a == b;\n  }\n\n  $subPattern() {\n    const sub = this.pattern.toString();\n    return sub.substr(1, sub.length - 2);\n  }\n\n  toString() {\n    return `{ParamType:${this.name}}`;\n  }\n\n  /** Given an encoded string, or a decoded object, returns a decoded object */\n  $normalize(val: any) {\n    return this.is(val) ? val : this.decode(val);\n  }\n\n  /**\n   * Wraps an existing custom ParamType as an array of ParamType, depending on 'mode'.\n   * e.g.:\n   * - urlmatcher pattern \"/path?{queryParam[]:int}\"\n   * - url: \"/path?queryParam=1&queryParam=2\n   * - $stateParams.queryParam will be [1, 2]\n   * if `mode` is \"auto\", then\n   * - url: \"/path?queryParam=1 will create $stateParams.queryParam: 1\n   * - url: \"/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2]\n   */\n  $asArray(mode: boolean | 'auto', isSearch: boolean) {\n    if (!mode) return this;\n    if (mode === 'auto' && !isSearch) throw new Error(\"'auto' array mode is for query parameters only\");\n    return new (<any>ArrayType)(this, mode);\n  }\n}\n\n/**\n * Wraps up a `ParamType` object to handle array values.\n * @internalapi\n */\nfunction ArrayType(type: ParamType, mode: boolean | 'auto') {\n  // Wrap non-array value as array\n  function arrayWrap(val: any): any[] {\n    return isArray(val) ? val : isDefined(val) ? [val] : [];\n  }\n\n  // Unwrap array value for \"auto\" mode. Return undefined for empty array.\n  function arrayUnwrap(val: any) {\n    switch (val.length) {\n      case 0:\n        return undefined;\n      case 1:\n        return mode === 'auto' ? val[0] : val;\n      default:\n        return val;\n    }\n  }\n\n  // Wraps type (.is/.encode/.decode) functions to operate on each value of an array\n  function arrayHandler(callback: (x: any) => any, allTruthyMode?: boolean) {\n    return function handleArray(val: any) {\n      if (isArray(val) && val.length === 0) return val;\n      const arr = arrayWrap(val);\n      const result = map(arr, callback);\n      return allTruthyMode === true ? filter(result, x => !x).length === 0 : arrayUnwrap(result);\n    };\n  }\n\n  // Wraps type (.equals) functions to operate on each value of an array\n  function arrayEqualsHandler(callback: (l: any, r: any) => boolean) {\n    return function handleArray(val1: any, val2: any) {\n      const left = arrayWrap(val1),\n        right = arrayWrap(val2);\n      if (left.length !== right.length) return false;\n      for (let i = 0; i < left.length; i++) {\n        if (!callback(left[i], right[i])) return false;\n      }\n      return true;\n    };\n  }\n\n  ['encode', 'decode', 'equals', '$normalize'].forEach(name => {\n    const paramTypeFn = type[name].bind(type);\n    const wrapperFn: Function = name === 'equals' ? arrayEqualsHandler : arrayHandler;\n    this[name] = wrapperFn(paramTypeFn);\n  });\n\n  extend(this, {\n    dynamic: type.dynamic,\n    name: type.name,\n    pattern: type.pattern,\n    inherit: type.inherit,\n    raw: type.raw,\n    is: arrayHandler(type.is.bind(type), true),\n    $arrayMode: mode,\n  });\n}\n",
    "/** @publicapi @module params */ /** */\nimport { extend, filter, map, allTrueR, find } from '../common/common';\nimport { prop } from '../common/hof';\nimport { isInjectable, isDefined, isString, isArray, isUndefined } from '../common/predicates';\nimport { RawParams, ParamDeclaration } from '../params/interface';\nimport { services } from '../common/coreservices';\nimport { ParamType } from './paramType';\nimport { ParamTypes } from './paramTypes';\nimport { StateDeclaration } from '../state';\nimport { UrlConfig } from '../url';\n\n/** @hidden */\nconst hasOwn = Object.prototype.hasOwnProperty;\n\n/** @hidden */\nconst isShorthand = (cfg: ParamDeclaration) =>\n  ['value', 'type', 'squash', 'array', 'dynamic'].filter(hasOwn.bind(cfg || {})).length === 0;\n\n/** @internalapi */\nenum DefType {\n  PATH,\n  SEARCH,\n  CONFIG,\n}\nexport { DefType };\n\n/** @internalapi */\nfunction getParamDeclaration(paramName: string, location: DefType, state: StateDeclaration): ParamDeclaration {\n  const noReloadOnSearch = (state.reloadOnSearch === false && location === DefType.SEARCH) || undefined;\n  const dynamic = find([state.dynamic, noReloadOnSearch], isDefined);\n  const defaultConfig = isDefined(dynamic) ? { dynamic } : {};\n  const paramConfig = unwrapShorthand(state && state.params && state.params[paramName]);\n  return extend(defaultConfig, paramConfig);\n}\n\n/** @hidden */\nfunction unwrapShorthand(cfg: ParamDeclaration): ParamDeclaration {\n  cfg = isShorthand(cfg) ? ({ value: cfg } as ParamDeclaration) : cfg;\n\n  getStaticDefaultValue['__cacheable'] = true;\n  function getStaticDefaultValue() {\n    return cfg.value;\n  }\n\n  const $$fn = isInjectable(cfg.value) ? cfg.value : getStaticDefaultValue;\n  return extend(cfg, { $$fn });\n}\n\n/** @hidden */\nfunction getType(cfg: ParamDeclaration, urlType: ParamType, location: DefType, id: string, paramTypes: ParamTypes) {\n  if (cfg.type && urlType && urlType.name !== 'string') throw new Error(`Param '${id}' has two type configurations.`);\n  if (cfg.type && urlType && urlType.name === 'string' && paramTypes.type(cfg.type as string))\n    return paramTypes.type(cfg.type as string);\n  if (urlType) return urlType;\n  if (!cfg.type) {\n    const type =\n      location === DefType.CONFIG\n        ? 'any'\n        : location === DefType.PATH\n        ? 'path'\n        : location === DefType.SEARCH\n        ? 'query'\n        : 'string';\n    return paramTypes.type(type);\n  }\n  return cfg.type instanceof ParamType ? cfg.type : paramTypes.type(cfg.type as string);\n}\n\n/**\n * @internalapi\n * returns false, true, or the squash value to indicate the \"default parameter url squash policy\".\n */\nfunction getSquashPolicy(config: ParamDeclaration, isOptional: boolean, defaultPolicy: boolean | string) {\n  const squash = config.squash;\n  if (!isOptional || squash === false) return false;\n  if (!isDefined(squash) || squash == null) return defaultPolicy;\n  if (squash === true || isString(squash)) return squash;\n  throw new Error(`Invalid squash policy: '${squash}'. Valid policies: false, true, or arbitrary string`);\n}\n\n/** @internalapi */\nfunction getReplace(config: ParamDeclaration, arrayMode: boolean, isOptional: boolean, squash: string | boolean) {\n  const defaultPolicy = [\n    { from: '', to: isOptional || arrayMode ? undefined : '' },\n    { from: null, to: isOptional || arrayMode ? undefined : '' },\n  ];\n\n  const replace = isArray(config.replace) ? config.replace : [];\n  if (isString(squash)) replace.push({ from: squash, to: undefined });\n\n  const configuredKeys = map(replace, prop('from'));\n  return filter(defaultPolicy, item => configuredKeys.indexOf(item.from) === -1).concat(replace);\n}\n\n/** @internalapi */\nexport class Param {\n  id: string;\n  type: ParamType;\n  location: DefType;\n  isOptional: boolean;\n  dynamic: boolean;\n  raw: boolean;\n  squash: boolean | string;\n  replace: [{ to: any; from: any }];\n  inherit: boolean;\n  array: boolean;\n  config: any;\n  /** Cache the default value if it is a static value */\n  _defaultValueCache: {\n    defaultValue: any;\n  };\n\n  static values(params: Param[], values: RawParams = {}): RawParams {\n    const paramValues = {} as RawParams;\n    for (const param of params) {\n      paramValues[param.id] = param.value(values[param.id]);\n    }\n    return paramValues;\n  }\n\n  /**\n   * Finds [[Param]] objects which have different param values\n   *\n   * Filters a list of [[Param]] objects to only those whose parameter values differ in two param value objects\n   *\n   * @param params: The list of Param objects to filter\n   * @param values1: The first set of parameter values\n   * @param values2: the second set of parameter values\n   *\n   * @returns any Param objects whose values were different between values1 and values2\n   */\n  static changed(params: Param[], values1: RawParams = {}, values2: RawParams = {}): Param[] {\n    return params.filter(param => !param.type.equals(values1[param.id], values2[param.id]));\n  }\n\n  /**\n   * Checks if two param value objects are equal (for a set of [[Param]] objects)\n   *\n   * @param params The list of [[Param]] objects to check\n   * @param values1 The first set of param values\n   * @param values2 The second set of param values\n   *\n   * @returns true if the param values in values1 and values2 are equal\n   */\n  static equals(params: Param[], values1 = {}, values2 = {}): boolean {\n    return Param.changed(params, values1, values2).length === 0;\n  }\n\n  /** Returns true if a the parameter values are valid, according to the Param definitions */\n  static validates(params: Param[], values: RawParams = {}): boolean {\n    return params.map(param => param.validates(values[param.id])).reduce(allTrueR, true);\n  }\n\n  constructor(id: string, type: ParamType, location: DefType, urlConfig: UrlConfig, state: StateDeclaration) {\n    const config: ParamDeclaration = getParamDeclaration(id, location, state);\n    type = getType(config, type, location, id, urlConfig.paramTypes);\n    const arrayMode = getArrayMode();\n    type = arrayMode ? type.$asArray(arrayMode, location === DefType.SEARCH) : type;\n    const isOptional = config.value !== undefined || location === DefType.SEARCH;\n    const dynamic = isDefined(config.dynamic) ? !!config.dynamic : !!type.dynamic;\n    const raw = isDefined(config.raw) ? !!config.raw : !!type.raw;\n    const squash = getSquashPolicy(config, isOptional, urlConfig.defaultSquashPolicy());\n    const replace = getReplace(config, arrayMode, isOptional, squash);\n    const inherit = isDefined(config.inherit) ? !!config.inherit : !!type.inherit;\n\n    // array config: param name (param[]) overrides default settings.  explicit config overrides param name.\n    function getArrayMode() {\n      const arrayDefaults = { array: location === DefType.SEARCH ? 'auto' : false };\n      const arrayParamNomenclature = id.match(/\\[\\]$/) ? { array: true } : {};\n      return extend(arrayDefaults, arrayParamNomenclature, config).array;\n    }\n\n    extend(this, { id, type, location, isOptional, dynamic, raw, squash, replace, inherit, array: arrayMode, config });\n  }\n\n  isDefaultValue(value: any): boolean {\n    return this.isOptional && this.type.equals(this.value(), value);\n  }\n\n  /**\n   * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the\n   * default value, which may be the result of an injectable function.\n   */\n  value(value?: any): any {\n    /**\n     * [Internal] Get the default value of a parameter, which may be an injectable function.\n     */\n    const getDefaultValue = () => {\n      if (this._defaultValueCache) return this._defaultValueCache.defaultValue;\n\n      if (!services.$injector) throw new Error('Injectable functions cannot be called at configuration time');\n\n      const defaultValue = services.$injector.invoke(this.config.$$fn);\n\n      if (defaultValue !== null && defaultValue !== undefined && !this.type.is(defaultValue))\n        throw new Error(\n          `Default value (${defaultValue}) for parameter '${this.id}' is not an instance of ParamType (${\n            this.type.name\n          })`\n        );\n\n      if (this.config.$$fn['__cacheable']) {\n        this._defaultValueCache = { defaultValue };\n      }\n\n      return defaultValue;\n    };\n\n    const replaceSpecialValues = (val: any) => {\n      for (const tuple of this.replace) {\n        if (tuple.from === val) return tuple.to;\n      }\n      return val;\n    };\n\n    value = replaceSpecialValues(value);\n\n    return isUndefined(value) ? getDefaultValue() : this.type.$normalize(value);\n  }\n\n  isSearch(): boolean {\n    return this.location === DefType.SEARCH;\n  }\n\n  validates(value: any): boolean {\n    // There was no parameter value, but the param is optional\n    if ((isUndefined(value) || value === null) && this.isOptional) return true;\n\n    // The value was not of the correct ParamType, and could not be decoded to the correct ParamType\n    const normalized = this.type.$normalize(value);\n    if (!this.type.is(normalized)) return false;\n\n    // The value was of the correct type, but when encoded, did not match the ParamType's regexp\n    const encoded = this.type.encode(normalized);\n    return !(isString(encoded) && !this.type.pattern.exec(<string>encoded));\n  }\n\n  toString() {\n    return `{Param:${this.id} ${this.type} squash: '${this.squash}' optional: ${this.isOptional}}`;\n  }\n}\n",
    "/** @publicapi @module params */ /** */\nimport { fromJson, toJson, identity, equals, inherit, map, extend, pick } from '../common/common';\nimport { isDefined, isNullOrUndefined } from '../common/predicates';\nimport { is } from '../common/hof';\nimport { services } from '../common/coreservices';\nimport { ParamType } from './paramType';\nimport { ParamTypeDefinition } from './interface';\n\n/**\n * A registry for parameter types.\n *\n * This registry manages the built-in (and custom) parameter types.\n *\n * The built-in parameter types are:\n *\n * - [[string]]\n * - [[path]]\n * - [[query]]\n * - [[hash]]\n * - [[int]]\n * - [[bool]]\n * - [[date]]\n * - [[json]]\n * - [[any]]\n *\n * To register custom parameter types, use [[UrlConfig.type]], i.e.,\n *\n * ```js\n * router.urlService.config.type(customType)\n * ```\n */\nexport class ParamTypes {\n  /**\n   * Built-in parameter type: `string`\n   *\n   * This parameter type coerces values to strings.\n   * It matches anything (`new RegExp(\".*\")`) in the URL\n   */\n  static string: ParamTypeDefinition;\n\n  /**\n   * Built-in parameter type: `path`\n   *\n   * This parameter type is the default type for path parameters.\n   * A path parameter is any parameter declared in the path portion of a url\n   *\n   * - `/foo/:param1/:param2`: two path parameters\n   *\n   * This parameter type behaves exactly like the [[string]] type with one exception.\n   * When matching parameter values in the URL, the `path` type does not match forward slashes `/`.\n   *\n   * #### Angular 1 note:\n   * In ng1, this type is overridden with one that pre-encodes slashes as `~2F` instead of `%2F`.\n   * For more details about this angular 1 behavior, see: https://github.com/angular-ui/ui-router/issues/2598\n   */\n  static path: ParamTypeDefinition;\n\n  /**\n   * Built-in parameter type: `query`\n   *\n   * This parameter type is the default type for query/search parameters.\n   * It behaves the same as the [[string]] parameter type.\n   *\n   * A query parameter is any parameter declared in the query/search portion of a url\n   *\n   * - `/bar?param2`: a query parameter\n   */\n  static query: ParamTypeDefinition;\n\n  /**\n   * Built-in parameter type: `hash`\n   *\n   * This parameter type is used for the `#` parameter (the hash)\n   * It behaves the same as the [[string]] parameter type.\n   */\n  static hash: ParamTypeDefinition;\n\n  /**\n   * Built-in parameter type: `int`\n   *\n   * This parameter type serializes javascript integers (`number`s which represent an integer) to the URL.\n   *\n   * #### Example:\n   * ```js\n   * .state({\n   *   name: 'user',\n   *   url: '/user/{id:int}'\n   * });\n   * ```\n   * ```js\n   * $state.go('user', { id: 1298547 });\n   * ```\n   *\n   * The URL will serialize to: `/user/1298547`.\n   *\n   * When the parameter value is read, it will be the `number` `1298547`, not the string `\"1298547\"`.\n   */\n  static int: ParamTypeDefinition;\n\n  /**\n   * Built-in parameter type: `bool`\n   *\n   * This parameter type serializes `true`/`false` as `1`/`0`\n   *\n   * #### Example:\n   * ```js\n   * .state({\n   *   name: 'inbox',\n   *   url: '/inbox?{unread:bool}'\n   * });\n   * ```\n   * ```js\n   * $state.go('inbox', { unread: true });\n   * ```\n   *\n   * The URL will serialize to: `/inbox?unread=1`.\n   *\n   * Conversely, if the url is `/inbox?unread=0`, the value of the `unread` parameter will be a `false`.\n   */\n  static bool: ParamTypeDefinition;\n\n  /**\n   * Built-in parameter type: `date`\n   *\n   * This parameter type can be used to serialize Javascript dates as parameter values.\n   *\n   * #### Example:\n   * ```js\n   * .state({\n   *   name: 'search',\n   *   url: '/search?{start:date}'\n   * });\n   * ```\n   * ```js\n   * $state.go('search', { start: new Date(2000, 0, 1) });\n   * ```\n   *\n   * The URL will serialize to: `/search?start=2000-01-01`.\n   *\n   * Conversely, if the url is `/search?start=2016-12-25`, the value of the `start` parameter will be a `Date` object where:\n   *\n   * - `date.getFullYear() === 2016`\n   * - `date.getMonth() === 11` (month is 0-based)\n   * - `date.getDate() === 25`\n   */\n  static date: ParamTypeDefinition;\n\n  /**\n   * Built-in parameter type: `json`\n   *\n   * This parameter type can be used to serialize javascript objects into the URL using JSON serialization.\n   *\n   * #### Example:\n   * This example serializes an plain javascript object to the URL\n   * ```js\n   * .state({\n   *   name: 'map',\n   *   url: '/map/{coords:json}'\n   * });\n   * ```\n   * ```js\n   * $state.go('map', { coords: { x: 10399.2, y: 49071 });\n   * ```\n   *\n   * The URL will serialize to: `/map/%7B%22x%22%3A10399.2%2C%22y%22%3A49071%7D`\n   */\n  static json: ParamTypeDefinition;\n\n  /**\n   * Built-in parameter type: `any`\n   *\n   * This parameter type is used by default for url-less parameters (parameters that do not appear in the URL).\n   * This type does not encode or decode.\n   * It is compared using a deep `equals` comparison.\n   *\n   * #### Example:\n   * This example defines a non-url parameter on a [[StateDeclaration]].\n   * ```js\n   * .state({\n   *   name: 'new',\n   *   url: '/new',\n   *   params: {\n   *     inrepyto: null\n   *   }\n   * });\n   * ```\n   * ```js\n   * $state.go('new', { inreplyto: currentMessage });\n   * ```\n   */\n  static any: ParamTypeDefinition;\n\n  /** @hidden */\n  types: any;\n  /** @hidden */\n  enqueue = true;\n  /** @hidden */\n  typeQueue: any[] = [];\n\n  /** @internalapi */\n  private defaultTypes: any = pick(ParamTypes.prototype, [\n    'hash',\n    'string',\n    'query',\n    'path',\n    'int',\n    'bool',\n    'date',\n    'json',\n    'any',\n  ]);\n\n  /** @internalapi */\n  constructor() {\n    // Register default types. Store them in the prototype of this.types.\n    const makeType = (definition: ParamTypeDefinition, name: string) => new ParamType(extend({ name }, definition));\n    this.types = inherit(map(this.defaultTypes, makeType), {});\n  }\n\n  /** @internalapi */\n  dispose() {\n    this.types = {};\n  }\n\n  /**\n   * Registers a parameter type\n   *\n   * End users should call [[UrlMatcherFactory.type]], which delegates to this method.\n   */\n  type(name: string, definition?: ParamTypeDefinition, definitionFn?: () => ParamTypeDefinition) {\n    if (!isDefined(definition)) return this.types[name];\n    if (this.types.hasOwnProperty(name)) throw new Error(`A type named '${name}' has already been defined.`);\n\n    this.types[name] = new ParamType(extend({ name }, definition));\n\n    if (definitionFn) {\n      this.typeQueue.push({ name, def: definitionFn });\n      if (!this.enqueue) this._flushTypeQueue();\n    }\n\n    return this;\n  }\n\n  /** @internalapi */\n  _flushTypeQueue() {\n    while (this.typeQueue.length) {\n      const type = this.typeQueue.shift();\n      if (type.pattern) throw new Error(\"You cannot override a type's .pattern at runtime.\");\n      extend(this.types[type.name], services.$injector.invoke(type.def));\n    }\n  }\n}\n\n/** @hidden */\nfunction initDefaultTypes() {\n  const makeDefaultType = def => {\n    const valToString = (val: any) => (val != null ? val.toString() : val);\n\n    const defaultTypeBase = {\n      encode: valToString,\n      decode: valToString,\n      is: is(String),\n      pattern: /.*/,\n      // tslint:disable-next-line:triple-equals\n      equals: (a: any, b: any) => a == b, // allow coersion for null/undefined/\"\"\n    };\n\n    return extend({}, defaultTypeBase, def) as ParamTypeDefinition;\n  };\n\n  // Default Parameter Type Definitions\n  extend(ParamTypes.prototype, {\n    string: makeDefaultType({}),\n\n    path: makeDefaultType({\n      pattern: /[^/]*/,\n    }),\n\n    query: makeDefaultType({}),\n\n    hash: makeDefaultType({\n      inherit: false,\n    }),\n\n    int: makeDefaultType({\n      decode: (val: string) => parseInt(val, 10),\n      is: function(val: any) {\n        return !isNullOrUndefined(val) && this.decode(val.toString()) === val;\n      },\n      pattern: /-?\\d+/,\n    }),\n\n    bool: makeDefaultType({\n      encode: (val: any) => (val && 1) || 0,\n      decode: (val: string) => parseInt(val, 10) !== 0,\n      is: is(Boolean),\n      pattern: /0|1/,\n    }),\n\n    date: makeDefaultType({\n      encode: function(val: any) {\n        return !this.is(val)\n          ? undefined\n          : [val.getFullYear(), ('0' + (val.getMonth() + 1)).slice(-2), ('0' + val.getDate()).slice(-2)].join('-');\n      },\n      decode: function(val: string) {\n        if (this.is(val)) return (<any>val) as Date;\n        const match = this.capture.exec(val);\n        return match ? new Date(match[1], match[2] - 1, match[3]) : undefined;\n      },\n      is: (val: any) => val instanceof Date && !isNaN(val.valueOf()),\n      equals(l: any, r: any) {\n        return ['getFullYear', 'getMonth', 'getDate'].reduce((acc, fn) => acc && l[fn]() === r[fn](), true);\n      },\n      pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,\n      capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/,\n    }),\n\n    json: makeDefaultType({\n      encode: toJson,\n      decode: fromJson,\n      is: is(Object),\n      equals: equals,\n      pattern: /[^/]*/,\n    }),\n\n    // does not encode/decode\n    any: makeDefaultType({\n      encode: identity,\n      decode: identity,\n      is: () => true,\n      equals: equals,\n    }),\n  });\n}\n\ninitDefaultTypes();\n",
    "/** @publicapi @module params */ /** */\nimport { extend, ancestors, Obj } from '../common/common';\nimport { StateObject } from '../state/stateObject';\n\n/** @internalapi */\nexport class StateParams {\n  [key: string]: any;\n\n  constructor(params: Obj = {}) {\n    extend(this, params);\n  }\n\n  /**\n   * Merges a set of parameters with all parameters inherited between the common parents of the\n   * current state and a given destination state.\n   *\n   * @param {Object} newParams The set of parameters which will be composited with inherited params.\n   * @param {Object} $current Internal definition of object representing the current state.\n   * @param {Object} $to Internal definition of object representing state to transition to.\n   */\n  $inherit(newParams: Obj, $current: StateObject, $to: StateObject) {\n    let parentParams: string[];\n    const parents = ancestors($current, $to),\n      inherited: Obj = {},\n      inheritList: string[] = [];\n\n    for (const i in parents) {\n      if (!parents[i] || !parents[i].params) continue;\n      parentParams = Object.keys(parents[i].params);\n      if (!parentParams.length) continue;\n\n      for (const j in parentParams) {\n        if (inheritList.indexOf(parentParams[j]) >= 0) continue;\n        inheritList.push(parentParams[j]);\n        inherited[parentParams[j]] = this[parentParams[j]];\n      }\n    }\n    return extend({}, inherited, newParams);\n  }\n}\n",
    "/** @internalapi @module path */ /** */\nimport { extend, applyPairs, find, allTrueR, pairs, arrayTuples } from '../common/common';\nimport { propEq } from '../common/hof';\nimport { StateObject } from '../state/stateObject';\nimport { RawParams } from '../params/interface';\nimport { Param } from '../params/param';\nimport { Resolvable } from '../resolve/resolvable';\nimport { ViewConfig } from '../view/interface';\n\n/**\n * A node in a [[TreeChanges]] path\n *\n * For a [[TreeChanges]] path, this class holds the stateful information for a single node in the path.\n * Each PathNode corresponds to a state being entered, exited, or retained.\n * The stateful information includes parameter values and resolve data.\n */\nexport class PathNode {\n  /** The state being entered, exited, or retained */\n  public state: StateObject;\n  /** The parameters declared on the state */\n  public paramSchema: Param[];\n  /** The parameter values that belong to the state */\n  public paramValues: { [key: string]: any };\n  /** The individual (stateful) resolvable objects that belong to the state */\n  public resolvables: Resolvable[];\n  /** The state's declared view configuration objects */\n  public views: ViewConfig[];\n\n  /**\n   * Returns a clone of the PathNode\n   * @deprecated use instance method `node.clone()`\n   */\n  static clone = (node: PathNode) => node.clone();\n\n  /** Creates a copy of a PathNode */\n  constructor(node: PathNode);\n  /** Creates a new (empty) PathNode for a State */\n  constructor(state: StateObject);\n  constructor(stateOrNode: any) {\n    if (stateOrNode instanceof PathNode) {\n      const node: PathNode = stateOrNode;\n      this.state = node.state;\n      this.paramSchema = node.paramSchema.slice();\n      this.paramValues = extend({}, node.paramValues);\n      this.resolvables = node.resolvables.slice();\n      this.views = node.views && node.views.slice();\n    } else {\n      const state: StateObject = stateOrNode;\n      this.state = state;\n      this.paramSchema = state.parameters({ inherit: false });\n      this.paramValues = {};\n      this.resolvables = state.resolvables.map(res => res.clone());\n    }\n  }\n\n  clone() {\n    return new PathNode(this);\n  }\n\n  /** Sets [[paramValues]] for the node, from the values of an object hash */\n  applyRawParams(params: RawParams): PathNode {\n    const getParamVal = (paramDef: Param) => [paramDef.id, paramDef.value(params[paramDef.id])];\n    this.paramValues = this.paramSchema.reduce((memo, pDef) => applyPairs(memo, getParamVal(pDef)), {});\n    return this;\n  }\n\n  /** Gets a specific [[Param]] metadata that belongs to the node */\n  parameter(name: string): Param {\n    return find(this.paramSchema, propEq('id', name));\n  }\n\n  /**\n   * @returns true if the state and parameter values for another PathNode are\n   * equal to the state and param values for this PathNode\n   */\n  equals(node: PathNode, paramsFn?: GetParamsFn): boolean {\n    const diff = this.diff(node, paramsFn);\n    return diff && diff.length === 0;\n  }\n\n  /**\n   * Finds Params with different parameter values on another PathNode.\n   *\n   * Given another node (of the same state), finds the parameter values which differ.\n   * Returns the [[Param]] (schema objects) whose parameter values differ.\n   *\n   * Given another node for a different state, returns `false`\n   *\n   * @param node The node to compare to\n   * @param paramsFn A function that returns which parameters should be compared.\n   * @returns The [[Param]]s which differ, or null if the two nodes are for different states\n   */\n  diff(node: PathNode, paramsFn?: GetParamsFn): Param[] | false {\n    if (this.state !== node.state) return false;\n\n    const params: Param[] = paramsFn ? paramsFn(this) : this.paramSchema;\n    return Param.changed(params, this.paramValues, node.paramValues);\n  }\n}\n\n/** @hidden */\nexport type GetParamsFn = (pathNode: PathNode) => Param[];\n",
    "/** @publicapi @module state */ /** */\n\nimport { StateDeclaration, StateOrName, TargetStateDef } from './interface';\nimport { TransitionOptions } from '../transition/interface';\nimport { StateObject } from './stateObject';\nimport { isString } from '../common/predicates';\nimport { stringify } from '../common/strings';\nimport { extend } from '../common';\nimport { StateRegistry } from './stateRegistry';\nimport { RawParams } from '../params';\n\n/**\n * Encapsulate the target (destination) state/params/options of a [[Transition]].\n *\n * This class is frequently used to redirect a transition to a new destination.\n *\n * See:\n *\n * - [[HookResult]]\n * - [[TransitionHookFn]]\n * - [[TransitionService.onStart]]\n *\n * To create a `TargetState`, use [[StateService.target]].\n *\n * ---\n *\n * This class wraps:\n *\n * 1) an identifier for a state\n * 2) a set of parameters\n * 3) and transition options\n * 4) the registered state object (the [[StateDeclaration]])\n *\n * Many UI-Router APIs such as [[StateService.go]] take a [[StateOrName]] argument which can\n * either be a *state object* (a [[StateDeclaration]] or [[StateObject]]) or a *state name* (a string).\n * The `TargetState` class normalizes those options.\n *\n * A `TargetState` may be valid (the state being targeted exists in the registry)\n * or invalid (the state being targeted is not registered).\n */\nexport class TargetState {\n  private _definition: StateObject;\n  private _params: RawParams;\n  private _options: TransitionOptions;\n\n  /** Returns true if the object has a state property that might be a state or state name */\n  static isDef = (obj): obj is TargetStateDef => obj && obj.state && (isString(obj.state) || isString(obj.state.name));\n\n  /**\n   * The TargetState constructor\n   *\n   * Note: Do not construct a `TargetState` manually.\n   * To create a `TargetState`, use the [[StateService.target]] factory method.\n   *\n   * @param _stateRegistry The StateRegistry to use to look up the _definition\n   * @param _identifier An identifier for a state.\n   *    Either a fully-qualified state name, or the object used to define the state.\n   * @param _params Parameters for the target state\n   * @param _options Transition options.\n   *\n   * @internalapi\n   */\n  constructor(\n    private _stateRegistry: StateRegistry,\n    private _identifier: StateOrName,\n    _params?: RawParams,\n    _options?: TransitionOptions\n  ) {\n    this._identifier = _identifier;\n    this._params = extend({}, _params || {});\n    this._options = extend({}, _options || {});\n    this._definition = _stateRegistry.matcher.find(_identifier, this._options.relative);\n  }\n\n  /** The name of the state this object targets */\n  name(): string {\n    return (this._definition && this._definition.name) || <string>this._identifier;\n  }\n\n  /** The identifier used when creating this TargetState */\n  identifier(): StateOrName {\n    return this._identifier;\n  }\n\n  /** The target parameter values */\n  params(): RawParams {\n    return this._params;\n  }\n\n  /** The internal state object (if it was found) */\n  $state(): StateObject {\n    return this._definition;\n  }\n\n  /** The internal state declaration (if it was found) */\n  state(): StateDeclaration {\n    return this._definition && this._definition.self;\n  }\n\n  /** The target options */\n  options() {\n    return this._options;\n  }\n\n  /** True if the target state was found */\n  exists(): boolean {\n    return !!(this._definition && this._definition.self);\n  }\n\n  /** True if the object is valid */\n  valid(): boolean {\n    return !this.error();\n  }\n\n  /** If the object is invalid, returns the reason why */\n  error(): string {\n    const base = <any>this.options().relative;\n    if (!this._definition && !!base) {\n      const stateName = base.name ? base.name : base;\n      return `Could not resolve '${this.name()}' from state '${stateName}'`;\n    }\n    if (!this._definition) return `No such state '${this.name()}'`;\n    if (!this._definition.self) return `State '${this.name()}' has an invalid definition`;\n  }\n\n  toString() {\n    return `'${this.name()}'${stringify(this.params())}`;\n  }\n\n  /**\n   * Returns a copy of this TargetState which targets a different state.\n   * The new TargetState has the same parameter values and transition options.\n   *\n   * @param state The new state that should be targeted\n   */\n  withState(state: StateOrName): TargetState {\n    return new TargetState(this._stateRegistry, state, this._params, this._options);\n  }\n\n  /**\n   * Returns a copy of this TargetState, using the specified parameter values.\n   *\n   * @param params the new parameter values to use\n   * @param replace When false (default) the new parameter values will be merged with the current values.\n   *                When true the parameter values will be used instead of the current values.\n   */\n  withParams(params: RawParams, replace = false): TargetState {\n    const newParams: RawParams = replace ? params : extend({}, this._params, params);\n    return new TargetState(this._stateRegistry, this._identifier, newParams, this._options);\n  }\n\n  /**\n   * Returns a copy of this TargetState, using the specified Transition Options.\n   *\n   * @param options the new options to use\n   * @param replace When false (default) the new options will be merged with the current options.\n   *                When true the options will be used instead of the current options.\n   */\n  withOptions(options: TransitionOptions, replace = false): TargetState {\n    const newOpts = replace ? options : extend({}, this._options, options);\n    return new TargetState(this._stateRegistry, this._identifier, this._params, newOpts);\n  }\n}\n",
    "/** @internalapi @module path */ /** */\n\nimport {\n  extend,\n  find,\n  pick,\n  omit,\n  tail,\n  mergeR,\n  values,\n  unnestR,\n  Predicate,\n  inArray,\n  arrayTuples,\n} from '../common/common';\nimport { prop, propEq, not } from '../common/hof';\n\nimport { RawParams } from '../params/interface';\nimport { TreeChanges } from '../transition/interface';\nimport { ViewConfig } from '../view/interface';\nimport { _ViewDeclaration } from '../state/interface';\n\nimport { StateObject } from '../state/stateObject';\nimport { TargetState } from '../state/targetState';\nimport { GetParamsFn, PathNode } from './pathNode';\nimport { ViewService } from '../view/view';\nimport { Param } from '../params/param';\nimport { StateRegistry } from '../state';\n\n/**\n * This class contains functions which convert TargetStates, Nodes and paths from one type to another.\n */\nexport class PathUtils {\n  /** Given a PathNode[], create an TargetState */\n  static makeTargetState(registry: StateRegistry, path: PathNode[]): TargetState {\n    const state = tail(path).state;\n    return new TargetState(registry, state, path.map(prop('paramValues')).reduce(mergeR, {}), {});\n  }\n\n  static buildPath(targetState: TargetState) {\n    const toParams = targetState.params();\n    return targetState.$state().path.map(state => new PathNode(state).applyRawParams(toParams));\n  }\n\n  /** Given a fromPath: PathNode[] and a TargetState, builds a toPath: PathNode[] */\n  static buildToPath(fromPath: PathNode[], targetState: TargetState): PathNode[] {\n    const toPath: PathNode[] = PathUtils.buildPath(targetState);\n    if (targetState.options().inherit) {\n      return PathUtils.inheritParams(fromPath, toPath, Object.keys(targetState.params()));\n    }\n    return toPath;\n  }\n\n  /**\n   * Creates ViewConfig objects and adds to nodes.\n   *\n   * On each [[PathNode]], creates ViewConfig objects from the views: property of the node's state\n   */\n  static applyViewConfigs($view: ViewService, path: PathNode[], states: StateObject[]) {\n    // Only apply the viewConfigs to the nodes for the given states\n    path\n      .filter(node => inArray(states, node.state))\n      .forEach(node => {\n        const viewDecls: _ViewDeclaration[] = values(node.state.views || {});\n        const subPath = PathUtils.subPath(path, n => n === node);\n        const viewConfigs: ViewConfig[][] = viewDecls.map(view => $view.createViewConfig(subPath, view));\n        node.views = viewConfigs.reduce(unnestR, []);\n      });\n  }\n\n  /**\n   * Given a fromPath and a toPath, returns a new to path which inherits parameters from the fromPath\n   *\n   * For a parameter in a node to be inherited from the from path:\n   * - The toPath's node must have a matching node in the fromPath (by state).\n   * - The parameter name must not be found in the toKeys parameter array.\n   *\n   * Note: the keys provided in toKeys are intended to be those param keys explicitly specified by some\n   * caller, for instance, $state.transitionTo(..., toParams).  If a key was found in toParams,\n   * it is not inherited from the fromPath.\n   */\n  static inheritParams(fromPath: PathNode[], toPath: PathNode[], toKeys: string[] = []): PathNode[] {\n    function nodeParamVals(path: PathNode[], state: StateObject): RawParams {\n      const node: PathNode = find(path, propEq('state', state));\n      return extend({}, node && node.paramValues);\n    }\n\n    const noInherit = fromPath\n      .map(node => node.paramSchema)\n      .reduce(unnestR, [])\n      .filter(param => !param.inherit)\n      .map(prop('id'));\n\n    /**\n     * Given an [[PathNode]] \"toNode\", return a new [[PathNode]] with param values inherited from the\n     * matching node in fromPath.  Only inherit keys that aren't found in \"toKeys\" from the node in \"fromPath\"\"\n     */\n    function makeInheritedParamsNode(toNode: PathNode): PathNode {\n      // All param values for the node (may include default key/vals, when key was not found in toParams)\n      let toParamVals = extend({}, toNode && toNode.paramValues);\n      // limited to only those keys found in toParams\n      const incomingParamVals = pick(toParamVals, toKeys);\n      toParamVals = omit(toParamVals, toKeys);\n      const fromParamVals = omit(nodeParamVals(fromPath, toNode.state) || {}, noInherit);\n      // extend toParamVals with any fromParamVals, then override any of those those with incomingParamVals\n      const ownParamVals: RawParams = extend(toParamVals, fromParamVals, incomingParamVals);\n      return new PathNode(toNode.state).applyRawParams(ownParamVals);\n    }\n\n    // The param keys specified by the incoming toParams\n    return <PathNode[]>toPath.map(makeInheritedParamsNode);\n  }\n\n  static nonDynamicParams = (node: PathNode): Param[] =>\n    node.state.parameters({ inherit: false }).filter(param => !param.dynamic);\n\n  /**\n   * Computes the tree changes (entering, exiting) between a fromPath and toPath.\n   */\n  static treeChanges(fromPath: PathNode[], toPath: PathNode[], reloadState: StateObject): TreeChanges {\n    const max = Math.min(fromPath.length, toPath.length);\n    let keep = 0;\n\n    const nodesMatch = (node1: PathNode, node2: PathNode) => node1.equals(node2, PathUtils.nonDynamicParams);\n\n    while (keep < max && fromPath[keep].state !== reloadState && nodesMatch(fromPath[keep], toPath[keep])) {\n      keep++;\n    }\n\n    /** Given a retained node, return a new node which uses the to node's param values */\n    function applyToParams(retainedNode: PathNode, idx: number): PathNode {\n      const cloned = retainedNode.clone();\n      cloned.paramValues = toPath[idx].paramValues;\n      return cloned;\n    }\n\n    let from: PathNode[], retained: PathNode[], exiting: PathNode[], entering: PathNode[], to: PathNode[];\n\n    from = fromPath;\n    retained = from.slice(0, keep);\n    exiting = from.slice(keep);\n\n    // Create a new retained path (with shallow copies of nodes) which have the params of the toPath mapped\n    const retainedWithToParams = retained.map(applyToParams);\n    entering = toPath.slice(keep);\n    to = retainedWithToParams.concat(entering);\n\n    return { from, to, retained, retainedWithToParams, exiting, entering };\n  }\n\n  /**\n   * Returns a new path which is: the subpath of the first path which matches the second path.\n   *\n   * The new path starts from root and contains any nodes that match the nodes in the second path.\n   * It stops before the first non-matching node.\n   *\n   * Nodes are compared using their state property and their parameter values.\n   * If a `paramsFn` is provided, only the [[Param]] returned by the function will be considered when comparing nodes.\n   *\n   * @param pathA the first path\n   * @param pathB the second path\n   * @param paramsFn a function which returns the parameters to consider when comparing\n   *\n   * @returns an array of PathNodes from the first path which match the nodes in the second path\n   */\n  static matching(pathA: PathNode[], pathB: PathNode[], paramsFn?: GetParamsFn): PathNode[] {\n    let done = false;\n    const tuples: PathNode[][] = arrayTuples(pathA, pathB);\n    return tuples.reduce((matching, [nodeA, nodeB]) => {\n      done = done || !nodeA.equals(nodeB, paramsFn);\n      return done ? matching : matching.concat(nodeA);\n    }, []);\n  }\n\n  /**\n   * Returns true if two paths are identical.\n   *\n   * @param pathA\n   * @param pathB\n   * @param paramsFn a function which returns the parameters to consider when comparing\n   * @returns true if the the states and parameter values for both paths are identical\n   */\n  static equals(pathA: PathNode[], pathB: PathNode[], paramsFn?: GetParamsFn): boolean {\n    return pathA.length === pathB.length && PathUtils.matching(pathA, pathB, paramsFn).length === pathA.length;\n  }\n\n  /**\n   * Return a subpath of a path, which stops at the first matching node\n   *\n   * Given an array of nodes, returns a subset of the array starting from the first node,\n   * stopping when the first node matches the predicate.\n   *\n   * @param path a path of [[PathNode]]s\n   * @param predicate a [[Predicate]] fn that matches [[PathNode]]s\n   * @returns a subpath up to the matching node, or undefined if no match is found\n   */\n  static subPath(path: PathNode[], predicate: Predicate<PathNode>): PathNode[] {\n    const node = find(path, predicate);\n    const elementIdx = path.indexOf(node);\n    return elementIdx === -1 ? undefined : path.slice(0, elementIdx + 1);\n  }\n\n  /** Gets the raw parameter values from a path */\n  static paramValues = (path: PathNode[]) => path.reduce((acc, node) => extend(acc, node.paramValues), {});\n}\n",
    "/** @internalapi @module path */ /** */\nexport * from './pathNode';\nexport * from './pathUtils';\n",
    "/**\n * # The Resolve subsystem\n *\n * This subsystem is an asynchronous, hierarchical Dependency Injection system.\n *\n * Typically, resolve is configured on a state using a [[StateDeclaration.resolve]] declaration.\n *\n * @publicapi @module resolve\n */ /** */\nimport { Resolvable } from './resolvable';\n\n/**\n * An interface which is similar to an Angular 2 `Provider`\n */\nexport interface ProviderLike {\n  provide: any;\n  useClass?: any;\n  useFactory?: Function;\n  useValue?: any;\n  useExisting?: any;\n  deps?: any[];\n}\n\n/**\n * A plain object used to describe a [[Resolvable]]\n *\n * These objects may be used in the [[StateDeclaration.resolve]] array to declare\n * async data that the state or substates require.\n *\n * #### Example:\n * ```js\n *\n * var state = {\n *   name: 'main',\n *   resolve: [\n *     { token: 'myData', deps: [MyDataApi], resolveFn: (myDataApi) => myDataApi.getData() },\n *   ],\n * }\n * ```\n */\nexport interface ResolvableLiteral {\n  /**\n   * A Dependency Injection token\n   *\n   * This Resolvable's DI token.\n   * The Resolvable will be injectable elsewhere using the token.\n   */\n  token: any;\n\n  /**\n   * A function which fetches the Resolvable's data\n   *\n   * A function which returns one of:\n   *\n   * - The resolved value (synchronously)\n   * - A promise for the resolved value\n   * - An Observable of the resolved value(s)\n   *\n   * This function will be provided the dependencies listed in [[deps]] as its arguments.\n   * The resolve system will asynchronously fetch the dependencies before invoking this function.\n   */\n  resolveFn: Function;\n\n  /**\n   * Defines the Resolve Policy\n   *\n   * A policy that defines when to invoke the resolve,\n   * and whether to wait for async and unwrap the data\n   */\n  policy?: ResolvePolicy;\n\n  /**\n   * The Dependency Injection tokens\n   *\n   * This is an array of Dependency Injection tokens for the dependencies of the [[resolveFn]].\n   *\n   * The DI tokens are references to other `Resolvables`, or to other\n   * services from the native DI system.\n   */\n  deps?: any[];\n\n  /** Pre-resolved data. */\n  data?: any;\n}\n\n/**\n * Defines how a resolve is processed during a transition\n *\n * This object is the [[StateDeclaration.resolvePolicy]] property.\n *\n * #### Example:\n * ```js\n * // Fetched when the resolve's state is being entered.\n * // Wait for the promise to resolve.\n * var policy1 = { when: \"LAZY\", async: \"WAIT\" }\n *\n * // Fetched when the Transition is starting.\n * // Do not wait for the returned promise to resolve.\n * // Inject the raw promise/value\n * var policy2 = { when: \"EAGER\", async: \"NOWAIT\" }\n * ```\n *\n * The policy for a given Resolvable is merged from three sources (highest priority first):\n *\n * - 1) Individual resolve definition\n * - 2) State definition\n * - 3) Global default\n *\n * #### Example:\n * ```js\n * // Wait for an Observable to emit one item.\n * // Since `wait` is not specified, it uses the `wait`\n * // policy defined on the state, or the global default\n * // if no `wait` policy is defined on the state\n * var myResolvablePolicy = { async: \"RXWAIT\" }\n * ```\n */\nexport interface ResolvePolicy {\n  /**\n   * Defines when a Resolvable is resolved (fetched) during a transition\n   *\n   * - `LAZY` (default)\n   *   - Resolved as the resolve's state is being entered\n   * - `EAGER`\n   *   - Resolved as the transition is starting\n   *\n   * #### Example:\n   * Resolves for `main` and `main.home` are fetched when each state is entered.\n   * All of `main` resolves are processed before fetching `main.home` resolves.\n   * ```js\n   * var state = {\n   *   name: 'main',\n   *   resolve: mainResolves, // defined elsewhere\n   *   resolvePolicy: { when: 'LAZY' }, // default\n   * }\n   *\n   * var state = {\n   *   name: 'main.home',\n   *   resolve: homeResolves, // defined elsewhere\n   *   resolvePolicy: { when: 'LAZY' }, // default\n   * }\n   * ```\n   *\n   * #### Example:\n   * Resolves for `main` and `main.home` are fetched at the same time when the transition starts.\n   * This happens earlier in the lifecycle than when states are entered.\n   * All of the `main` and `main.home` resolves are fetched as soon as possible.\n   * ```js\n   * var mainState = {\n   *   name: 'main',\n   *   resolve: mainResolves, // defined elsewhere\n   *   resolvePolicy: { when: 'EAGER' },\n   * }\n   *\n   * var homeState = {\n   *   name: 'main.home',\n   *   resolve: homeResolves, // defined elsewhere\n   *   resolvePolicy: { when: 'EAGER' },\n   * }\n   * ```\n   */\n  when?: PolicyWhen;\n\n  /**\n   * Determines the unwrapping behavior of asynchronous resolve values.\n   *\n   * - `WAIT` (default)\n   *   - If a promise is returned from the resolveFn, wait for the promise before proceeding\n   *   - The unwrapped value from the promise\n   * - `NOWAIT`\n   *   - If a promise is returned from the resolve, do not wait for the promise.\n   *   - Any other value returned is wrapped in a promise.\n   *   - The promise will not be unwrapped.\n   *   - The promise itself will be provided when the resolve is injected or bound elsewhere.\n   * - `RXWAIT`\n   *   - When an Observable is returned from the resolveFn, wait until the Observable emits at least one item.\n   *   - The Observable item will not be unwrapped.\n   *   - The Observable stream itself will be provided when the resolve is injected or bound elsewhere.\n   *\n   * #### Example:\n   * The `Transition` will not wait for the resolve promise(s) from `main` to settle before continuing.\n   * Resolves for `main` will be provided to components wrapped in a `Promise`.\n   *\n   * The `Transition` will wait for the `main.home` resolve promises.\n   * Resolved values will be unwrapped before being provided to components.\n   * ```js\n   * var mainState = {\n   *   name: 'main',\n   *   resolve: mainResolves, // defined elsewhere\n   *   resolvePolicy: { async: 'NOWAIT' },\n   * }\n   * var homeState = {\n   *   name: 'main.home',\n   *   resolve: homeResolves, // defined elsewhere\n   *   resolvePolicy: { async: 'WAIT' }, // default\n   * }\n   * ```\n   */\n  async?: PolicyAsync;\n}\n\nexport type PolicyWhen = 'LAZY' | 'EAGER';\nexport type PolicyAsync = 'WAIT' | 'NOWAIT' | 'RXWAIT';\n\n/** @internalapi */\nexport let resolvePolicies = {\n  when: {\n    LAZY: 'LAZY',\n    EAGER: 'EAGER',\n  },\n  async: {\n    WAIT: 'WAIT',\n    NOWAIT: 'NOWAIT',\n    RXWAIT: 'RXWAIT',\n  },\n};\n",
    "/** @publicapi @module resolve */ /** */\nimport { extend, equals, inArray, identity } from '../common/common';\nimport { services } from '../common/coreservices';\nimport { trace } from '../common/trace';\nimport { ResolvePolicy, ResolvableLiteral, resolvePolicies } from './interface';\n\nimport { ResolveContext } from './resolveContext';\nimport { stringify } from '../common/strings';\nimport { isFunction, isObject } from '../common/predicates';\nimport { Transition } from '../transition/transition';\nimport { StateObject } from '../state/stateObject';\nimport { PathNode } from '../path/pathNode';\nimport { isNullOrUndefined } from '../common/predicates';\n\n// TODO: explicitly make this user configurable\nexport let defaultResolvePolicy: ResolvePolicy = {\n  when: 'LAZY',\n  async: 'WAIT',\n};\n\n/**\n * The basic building block for the resolve system.\n *\n * Resolvables encapsulate a state's resolve's resolveFn, the resolveFn's declared dependencies, the wrapped (.promise),\n * and the unwrapped-when-complete (.data) result of the resolveFn.\n *\n * Resolvable.get() either retrieves the Resolvable's existing promise, or else invokes resolve() (which invokes the\n * resolveFn) and returns the resulting promise.\n *\n * Resolvable.get() and Resolvable.resolve() both execute within a context path, which is passed as the first\n * parameter to those fns.\n */\nexport class Resolvable implements ResolvableLiteral {\n  token: any;\n  policy: ResolvePolicy;\n  resolveFn: Function;\n  deps: any[];\n\n  data: any;\n  resolved = false;\n  promise: Promise<any> = undefined;\n\n  static fromData = (token: any, data: any) => new Resolvable(token, () => data, null, null, data);\n\n  /** This constructor creates a Resolvable copy */\n  constructor(resolvable: Resolvable);\n\n  /** This constructor creates a new Resolvable from the plain old [[ResolvableLiteral]] javascript object */\n  constructor(resolvable: ResolvableLiteral);\n\n  /**\n   * This constructor creates a new `Resolvable`\n   *\n   * #### Example:\n   * ```js\n   * var resolvable1 = new Resolvable('mytoken', http => http.get('foo.json').toPromise(), [Http]);\n   *\n   * var resolvable2 = new Resolvable(UserService, dep => new UserService(dep.data), [SomeDependency]);\n   *\n   * var resolvable1Clone = new Resolvable(resolvable1);\n   * ```\n   *\n   * @param token The new resolvable's injection token, such as `\"userList\"` (a string) or `UserService` (a class).\n   *              When this token is used during injection, the resolved value will be injected.\n   * @param resolveFn The function that returns the resolved value, or a promise for the resolved value\n   * @param deps An array of dependencies, which will be injected into the `resolveFn`\n   * @param policy the [[ResolvePolicy]] defines when and how the Resolvable is processed\n   * @param data Pre-resolved data. If the resolve value is already known, it may be provided here.\n   */\n  constructor(token: any, resolveFn: Function, deps?: any[], policy?: ResolvePolicy, data?: any);\n  constructor(arg1: any, resolveFn?: Function, deps?: any[], policy?: ResolvePolicy, data?: any) {\n    if (arg1 instanceof Resolvable) {\n      extend(this, arg1);\n    } else if (isFunction(resolveFn)) {\n      if (isNullOrUndefined(arg1)) throw new Error('new Resolvable(): token argument is required');\n      if (!isFunction(resolveFn)) throw new Error('new Resolvable(): resolveFn argument must be a function');\n\n      this.token = arg1;\n      this.policy = policy;\n      this.resolveFn = resolveFn;\n      this.deps = deps || [];\n\n      this.data = data;\n      this.resolved = data !== undefined;\n      this.promise = this.resolved ? services.$q.when(this.data) : undefined;\n    } else if (isObject(arg1) && arg1.token && (arg1.hasOwnProperty('resolveFn') || arg1.hasOwnProperty('data'))) {\n      const literal = <ResolvableLiteral>arg1;\n      return new Resolvable(literal.token, literal.resolveFn, literal.deps, literal.policy, literal.data);\n    }\n  }\n\n  getPolicy(state: StateObject): ResolvePolicy {\n    const thisPolicy = this.policy || {};\n    const statePolicy = (state && state.resolvePolicy) || {};\n    return {\n      when: thisPolicy.when || statePolicy.when || defaultResolvePolicy.when,\n      async: thisPolicy.async || statePolicy.async || defaultResolvePolicy.async,\n    };\n  }\n\n  /**\n   * Asynchronously resolve this Resolvable's data\n   *\n   * Given a ResolveContext that this Resolvable is found in:\n   * Wait for this Resolvable's dependencies, then invoke this Resolvable's function\n   * and update the Resolvable's state\n   */\n  resolve(resolveContext: ResolveContext, trans?: Transition) {\n    const $q = services.$q;\n\n    // Gets all dependencies from ResolveContext and wait for them to be resolved\n    const getResolvableDependencies = () =>\n      $q.all(resolveContext.getDependencies(this).map(resolvable => resolvable.get(resolveContext, trans))) as Promise<\n        any[]\n      >;\n\n    // Invokes the resolve function passing the resolved dependencies as arguments\n    const invokeResolveFn = (resolvedDeps: any[]) => this.resolveFn.apply(null, resolvedDeps);\n\n    /**\n     * For RXWAIT policy:\n     *\n     * Given an observable returned from a resolve function:\n     * - enables .cache() mode (this allows multicast subscribers)\n     * - then calls toPromise() (this triggers subscribe() and thus fetches)\n     * - Waits for the promise, then return the cached observable (not the first emitted value).\n     */\n    const waitForRx = (observable$: any) => {\n      const cached = observable$.cache(1);\n      return cached\n        .take(1)\n        .toPromise()\n        .then(() => cached);\n    };\n\n    // If the resolve policy is RXWAIT, wait for the observable to emit something. otherwise pass through.\n    const node: PathNode = resolveContext.findNode(this);\n    const state: StateObject = node && node.state;\n    const maybeWaitForRx = this.getPolicy(state).async === 'RXWAIT' ? waitForRx : identity;\n\n    // After the final value has been resolved, update the state of the Resolvable\n    const applyResolvedValue = (resolvedValue: any) => {\n      this.data = resolvedValue;\n      this.resolved = true;\n      this.resolveFn = null;\n      trace.traceResolvableResolved(this, trans);\n      return this.data;\n    };\n\n    // Sets the promise property first, then getsResolvableDependencies in the context of the promise chain. Always waits one tick.\n    return (this.promise = $q\n      .when()\n      .then(getResolvableDependencies)\n      .then(invokeResolveFn)\n      .then(maybeWaitForRx)\n      .then(applyResolvedValue));\n  }\n\n  /**\n   * Gets a promise for this Resolvable's data.\n   *\n   * Fetches the data and returns a promise.\n   * Returns the existing promise if it has already been fetched once.\n   */\n  get(resolveContext: ResolveContext, trans?: Transition): Promise<any> {\n    return this.promise || this.resolve(resolveContext, trans);\n  }\n\n  toString() {\n    return `Resolvable(token: ${stringify(this.token)}, requires: [${this.deps.map(stringify)}])`;\n  }\n\n  clone(): Resolvable {\n    return new Resolvable(this);\n  }\n}\n",
    "/** @publicapi @module resolve */ /** */\nimport { find, tail, uniqR, unnestR, inArray } from '../common/common';\nimport { propEq, not } from '../common/hof';\nimport { trace } from '../common/trace';\nimport { services, $InjectorLike } from '../common/coreservices';\nimport { resolvePolicies, PolicyWhen, ResolvePolicy } from './interface';\nimport { PathNode } from '../path/pathNode';\nimport { Resolvable } from './resolvable';\nimport { StateObject } from '../state/stateObject';\nimport { PathUtils } from '../path/pathUtils';\nimport { stringify } from '../common/strings';\nimport { Transition } from '../transition/transition';\nimport { UIInjector } from '../interface';\nimport { isUndefined } from '../common';\n\nconst whens = resolvePolicies.when;\nconst ALL_WHENS = [whens.EAGER, whens.LAZY];\nconst EAGER_WHENS = [whens.EAGER];\n\n// tslint:disable-next-line:no-inferrable-types\nexport const NATIVE_INJECTOR_TOKEN: string = 'Native Injector';\n\n/**\n * Encapsulates Dependency Injection for a path of nodes\n *\n * UI-Router states are organized as a tree.\n * A nested state has a path of ancestors to the root of the tree.\n * When a state is being activated, each element in the path is wrapped as a [[PathNode]].\n * A `PathNode` is a stateful object that holds things like parameters and resolvables for the state being activated.\n *\n * The ResolveContext closes over the [[PathNode]]s, and provides DI for the last node in the path.\n */\nexport class ResolveContext {\n  _injector: UIInjector;\n\n  constructor(private _path: PathNode[]) {}\n\n  /** Gets all the tokens found in the resolve context, de-duplicated */\n  getTokens(): any[] {\n    return this._path.reduce((acc, node) => acc.concat(node.resolvables.map(r => r.token)), []).reduce(uniqR, []);\n  }\n\n  /**\n   * Gets the Resolvable that matches the token\n   *\n   * Gets the last Resolvable that matches the token in this context, or undefined.\n   * Throws an error if it doesn't exist in the ResolveContext\n   */\n  getResolvable(token: any): Resolvable {\n    const matching = this._path\n      .map(node => node.resolvables)\n      .reduce(unnestR, [])\n      .filter((r: Resolvable) => r.token === token);\n    return tail(matching);\n  }\n\n  /** Returns the [[ResolvePolicy]] for the given [[Resolvable]] */\n  getPolicy(resolvable: Resolvable): ResolvePolicy {\n    const node = this.findNode(resolvable);\n    return resolvable.getPolicy(node.state);\n  }\n\n  /**\n   * Returns a ResolveContext that includes a portion of this one\n   *\n   * Given a state, this method creates a new ResolveContext from this one.\n   * The new context starts at the first node (root) and stops at the node for the `state` parameter.\n   *\n   * #### Why\n   *\n   * When a transition is created, the nodes in the \"To Path\" are injected from a ResolveContext.\n   * A ResolveContext closes over a path of [[PathNode]]s and processes the resolvables.\n   * The \"To State\" can inject values from its own resolvables, as well as those from all its ancestor state's (node's).\n   * This method is used to create a narrower context when injecting ancestor nodes.\n   *\n   * @example\n   * `let ABCD = new ResolveContext([A, B, C, D]);`\n   *\n   * Given a path `[A, B, C, D]`, where `A`, `B`, `C` and `D` are nodes for states `a`, `b`, `c`, `d`:\n   * When injecting `D`, `D` should have access to all resolvables from `A`, `B`, `C`, `D`.\n   * However, `B` should only be able to access resolvables from `A`, `B`.\n   *\n   * When resolving for the `B` node, first take the full \"To Path\" Context `[A,B,C,D]` and limit to the subpath `[A,B]`.\n   * `let AB = ABCD.subcontext(a)`\n   */\n  subContext(state: StateObject): ResolveContext {\n    return new ResolveContext(PathUtils.subPath(this._path, node => node.state === state));\n  }\n\n  /**\n   * Adds Resolvables to the node that matches the state\n   *\n   * This adds a [[Resolvable]] (generally one created on the fly; not declared on a [[StateDeclaration.resolve]] block).\n   * The resolvable is added to the node matching the `state` parameter.\n   *\n   * These new resolvables are not automatically fetched.\n   * The calling code should either fetch them, fetch something that depends on them,\n   * or rely on [[resolvePath]] being called when some state is being entered.\n   *\n   * Note: each resolvable's [[ResolvePolicy]] is merged with the state's policy, and the global default.\n   *\n   * @param newResolvables the new Resolvables\n   * @param state Used to find the node to put the resolvable on\n   */\n  addResolvables(newResolvables: Resolvable[], state: StateObject) {\n    const node = <PathNode>find(this._path, propEq('state', state));\n    const keys = newResolvables.map(r => r.token);\n    node.resolvables = node.resolvables.filter(r => keys.indexOf(r.token) === -1).concat(newResolvables);\n  }\n\n  /**\n   * Returns a promise for an array of resolved path Element promises\n   *\n   * @param when\n   * @param trans\n   * @returns {Promise<any>|any}\n   */\n  resolvePath(when: PolicyWhen = 'LAZY', trans?: Transition): Promise<{ token: any; value: any }[]> {\n    // This option determines which 'when' policy Resolvables we are about to fetch.\n    const whenOption: string = inArray(ALL_WHENS, when) ? when : 'LAZY';\n    // If the caller specified EAGER, only the EAGER Resolvables are fetched.\n    // if the caller specified LAZY, both EAGER and LAZY Resolvables are fetched.`\n    const matchedWhens = whenOption === resolvePolicies.when.EAGER ? EAGER_WHENS : ALL_WHENS;\n\n    // get the subpath to the state argument, if provided\n    trace.traceResolvePath(this._path, when, trans);\n\n    const matchesPolicy = (acceptedVals: string[], whenOrAsync: 'when' | 'async') => (resolvable: Resolvable) =>\n      inArray(acceptedVals, this.getPolicy(resolvable)[whenOrAsync]);\n\n    // Trigger all the (matching) Resolvables in the path\n    // Reduce all the \"WAIT\" Resolvables into an array\n    const promises: Promise<any>[] = this._path.reduce((acc, node) => {\n      const nodeResolvables = node.resolvables.filter(matchesPolicy(matchedWhens, 'when'));\n      const nowait = nodeResolvables.filter(matchesPolicy(['NOWAIT'], 'async'));\n      const wait = nodeResolvables.filter(not(matchesPolicy(['NOWAIT'], 'async')));\n\n      // For the matching Resolvables, start their async fetch process.\n      const subContext = this.subContext(node.state);\n      const getResult = (r: Resolvable) =>\n        r\n          .get(subContext, trans)\n          // Return a tuple that includes the Resolvable's token\n          .then(value => ({ token: r.token, value: value }));\n      nowait.forEach(getResult);\n      return acc.concat(wait.map(getResult));\n    }, []);\n\n    // Wait for all the \"WAIT\" resolvables\n    return services.$q.all(promises);\n  }\n\n  injector(): UIInjector {\n    return this._injector || (this._injector = new UIInjectorImpl(this));\n  }\n\n  findNode(resolvable: Resolvable): PathNode {\n    return find(this._path, (node: PathNode) => inArray(node.resolvables, resolvable));\n  }\n\n  /**\n   * Gets the async dependencies of a Resolvable\n   *\n   * Given a Resolvable, returns its dependencies as a Resolvable[]\n   */\n  getDependencies(resolvable: Resolvable): Resolvable[] {\n    const node = this.findNode(resolvable);\n    // Find which other resolvables are \"visible\" to the `resolvable` argument\n    // subpath stopping at resolvable's node, or the whole path (if the resolvable isn't in the path)\n    const subPath: PathNode[] = PathUtils.subPath(this._path, x => x === node) || this._path;\n    const availableResolvables: Resolvable[] = subPath\n      .reduce((acc, _node) => acc.concat(_node.resolvables), []) // all of subpath's resolvables\n      .filter(res => res !== resolvable); // filter out the `resolvable` argument\n\n    const getDependency = (token: any) => {\n      const matching = availableResolvables.filter(r => r.token === token);\n      if (matching.length) return tail(matching);\n\n      const fromInjector = this.injector().getNative(token);\n      if (isUndefined(fromInjector)) {\n        throw new Error('Could not find Dependency Injection token: ' + stringify(token));\n      }\n\n      return new Resolvable(token, () => fromInjector, [], fromInjector);\n    };\n\n    return resolvable.deps.map(getDependency);\n  }\n}\n\n/** @internalapi */\nclass UIInjectorImpl implements UIInjector {\n  native: $InjectorLike;\n\n  constructor(public context: ResolveContext) {\n    this.native = this.get(NATIVE_INJECTOR_TOKEN) || services.$injector;\n  }\n\n  get(token: any) {\n    const resolvable = this.context.getResolvable(token);\n    if (resolvable) {\n      if (this.context.getPolicy(resolvable).async === 'NOWAIT') {\n        return resolvable.get(this.context);\n      }\n\n      if (!resolvable.resolved) {\n        throw new Error('Resolvable async .get() not complete:' + stringify(resolvable.token));\n      }\n      return resolvable.data;\n    }\n\n    return this.getNative(token);\n  }\n\n  getAsync(token: any) {\n    const resolvable = this.context.getResolvable(token);\n    if (resolvable) return resolvable.get(this.context);\n    return services.$q.when(this.native.get(token));\n  }\n\n  getNative(token: any) {\n    return this.native && this.native.get(token);\n  }\n}\n",
    "/** @publicapi @module resolve */ /** */\nexport * from './interface';\nexport * from './resolvable';\nexport * from './resolveContext';\n",
    "/** @publicapi @module state */ /** */\nimport { applyPairs, extend, identity, inherit, mapObj, noop, Obj, omit, tail, values, copy } from '../common/common';\nimport { isArray, isDefined, isFunction, isString } from '../common/predicates';\nimport { stringify } from '../common/strings';\nimport { is, pattern, pipe, prop, val } from '../common/hof';\nimport { StateDeclaration } from './interface';\n\nimport { StateObject } from './stateObject';\nimport { StateMatcher } from './stateMatcher';\nimport { Param } from '../params/param';\nimport { UrlMatcherFactory } from '../url/urlMatcherFactory';\nimport { UrlMatcher } from '../url/urlMatcher';\nimport { Resolvable } from '../resolve/resolvable';\nimport { services } from '../common/coreservices';\nimport { ResolvePolicy } from '../resolve/interface';\nimport { ParamDeclaration } from '../params';\nimport { ParamFactory } from '../url';\n\nconst parseUrl = (url: string): any => {\n  if (!isString(url)) return false;\n  const root = url.charAt(0) === '^';\n  return { val: root ? url.substring(1) : url, root };\n};\n\nexport type BuilderFunction = (state: StateObject, parent?: BuilderFunction) => any;\n\ninterface Builders {\n  [key: string]: BuilderFunction[];\n\n  name: BuilderFunction[];\n  parent: BuilderFunction[];\n  data: BuilderFunction[];\n  url: BuilderFunction[];\n  navigable: BuilderFunction[];\n  params: BuilderFunction[];\n  views: BuilderFunction[];\n  path: BuilderFunction[];\n  includes: BuilderFunction[];\n  resolvables: BuilderFunction[];\n}\n\nfunction nameBuilder(state: StateObject) {\n  return state.name;\n}\n\nfunction selfBuilder(state: StateObject) {\n  state.self.$$state = () => state;\n  return state.self;\n}\n\nfunction dataBuilder(state: StateObject) {\n  if (state.parent && state.parent.data) {\n    state.data = state.self.data = inherit(state.parent.data, state.data);\n  }\n  return state.data;\n}\n\nconst getUrlBuilder = ($urlMatcherFactoryProvider: UrlMatcherFactory, root: () => StateObject) =>\n  function urlBuilder(stateObject: StateObject) {\n    let stateDec: StateDeclaration = stateObject.self;\n\n    // For future states, i.e., states whose name ends with `.**`,\n    // match anything that starts with the url prefix\n    if (stateDec && stateDec.url && stateDec.name && stateDec.name.match(/\\.\\*\\*$/)) {\n      const newStateDec: StateDeclaration = {};\n      copy(stateDec, newStateDec);\n      newStateDec.url += '{remainder:any}'; // match any path (.*)\n      stateDec = newStateDec;\n    }\n\n    const parent = stateObject.parent;\n    const parsed = parseUrl(stateDec.url);\n    const url = !parsed ? stateDec.url : $urlMatcherFactoryProvider.compile(parsed.val, { state: stateDec });\n\n    if (!url) return null;\n    if (!$urlMatcherFactoryProvider.isMatcher(url)) throw new Error(`Invalid url '${url}' in state '${stateObject}'`);\n    return parsed && parsed.root ? url : ((parent && parent.navigable) || root()).url.append(<UrlMatcher>url);\n  };\n\nconst getNavigableBuilder = (isRoot: (state: StateObject) => boolean) =>\n  function navigableBuilder(state: StateObject) {\n    return !isRoot(state) && state.url ? state : state.parent ? state.parent.navigable : null;\n  };\n\nconst getParamsBuilder = (paramFactory: ParamFactory) =>\n  function paramsBuilder(state: StateObject): { [key: string]: Param } {\n    const makeConfigParam = (config: ParamDeclaration, id: string) => paramFactory.fromConfig(id, null, state.self);\n    const urlParams: Param[] = (state.url && state.url.parameters({ inherit: false })) || [];\n    const nonUrlParams: Param[] = values(mapObj(omit(state.params || {}, urlParams.map(prop('id'))), makeConfigParam));\n    return urlParams\n      .concat(nonUrlParams)\n      .map(p => [p.id, p])\n      .reduce(applyPairs, {});\n  };\n\nfunction pathBuilder(state: StateObject) {\n  return state.parent ? state.parent.path.concat(state) : /*root*/ [state];\n}\n\nfunction includesBuilder(state: StateObject) {\n  const includes = state.parent ? extend({}, state.parent.includes) : {};\n  includes[state.name] = true;\n  return includes;\n}\n\n/**\n * This is a [[StateBuilder.builder]] function for the `resolve:` block on a [[StateDeclaration]].\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * validates the `resolve` property and converts it to a [[Resolvable]] array.\n *\n * resolve: input value can be:\n *\n * {\n *   // analyzed but not injected\n *   myFooResolve: function() { return \"myFooData\"; },\n *\n *   // function.toString() parsed, \"DependencyName\" dep as string (not min-safe)\n *   myBarResolve: function(DependencyName) { return DependencyName.fetchSomethingAsPromise() },\n *\n *   // Array split; \"DependencyName\" dep as string\n *   myBazResolve: [ \"DependencyName\", function(dep) { return dep.fetchSomethingAsPromise() },\n *\n *   // Array split; DependencyType dep as token (compared using ===)\n *   myQuxResolve: [ DependencyType, function(dep) { return dep.fetchSometingAsPromise() },\n *\n *   // val.$inject used as deps\n *   // where:\n *   //     corgeResolve.$inject = [\"DependencyName\"];\n *   //     function corgeResolve(dep) { dep.fetchSometingAsPromise() }\n *   // then \"DependencyName\" dep as string\n *   myCorgeResolve: corgeResolve,\n *\n *  // inject service by name\n *  // When a string is found, desugar creating a resolve that injects the named service\n *   myGraultResolve: \"SomeService\"\n * }\n *\n * or:\n *\n * [\n *   new Resolvable(\"myFooResolve\", function() { return \"myFooData\" }),\n *   new Resolvable(\"myBarResolve\", function(dep) { return dep.fetchSomethingAsPromise() }, [ \"DependencyName\" ]),\n *   { provide: \"myBazResolve\", useFactory: function(dep) { dep.fetchSomethingAsPromise() }, deps: [ \"DependencyName\" ] }\n * ]\n */\nexport function resolvablesBuilder(state: StateObject): Resolvable[] {\n  interface Tuple {\n    token: any;\n    val: any;\n    deps: any[];\n    policy: ResolvePolicy;\n  }\n\n  /** convert resolve: {} and resolvePolicy: {} objects to an array of tuples */\n  const objects2Tuples = (resolveObj: Obj, resolvePolicies: { [key: string]: ResolvePolicy }) =>\n    Object.keys(resolveObj || {}).map(token => ({\n      token,\n      val: resolveObj[token],\n      deps: undefined,\n      policy: resolvePolicies[token],\n    }));\n\n  /** fetch DI annotations from a function or ng1-style array */\n  const annotate = (fn: Function) => {\n    const $injector = services.$injector;\n    // ng1 doesn't have an $injector until runtime.\n    // If the $injector doesn't exist, use \"deferred\" literal as a\n    // marker indicating they should be annotated when runtime starts\n    return fn['$inject'] || ($injector && $injector.annotate(fn, $injector.strictDi)) || <any>'deferred';\n  };\n\n  /** true if the object has both `token` and `resolveFn`, and is probably a [[ResolveLiteral]] */\n  const isResolveLiteral = (obj: any) => !!(obj.token && obj.resolveFn);\n\n  /** true if the object looks like a provide literal, or a ng2 Provider */\n  const isLikeNg2Provider = (obj: any) =>\n    !!((obj.provide || obj.token) && (obj.useValue || obj.useFactory || obj.useExisting || obj.useClass));\n\n  /** true if the object looks like a tuple from obj2Tuples */\n  const isTupleFromObj = (obj: any) =>\n    !!(obj && obj.val && (isString(obj.val) || isArray(obj.val) || isFunction(obj.val)));\n\n  /** extracts the token from a Provider or provide literal */\n  const getToken = (p: any) => p.provide || p.token;\n\n  // prettier-ignore: Given a literal resolve or provider object, returns a Resolvable\n  const literal2Resolvable = pattern([\n    [prop('resolveFn'), p => new Resolvable(getToken(p), p.resolveFn, p.deps, p.policy)],\n    [prop('useFactory'), p => new Resolvable(getToken(p), p.useFactory, p.deps || p.dependencies, p.policy)],\n    [prop('useClass'), p => new Resolvable(getToken(p), () => new (<any>p.useClass)(), [], p.policy)],\n    [prop('useValue'), p => new Resolvable(getToken(p), () => p.useValue, [], p.policy, p.useValue)],\n    [prop('useExisting'), p => new Resolvable(getToken(p), identity, [p.useExisting], p.policy)],\n  ]);\n\n  // prettier-ignore\n  const tuple2Resolvable = pattern([\n    [pipe(prop('val'), isString),   (tuple: Tuple) => new Resolvable(tuple.token, identity, [tuple.val], tuple.policy)],\n    [pipe(prop('val'), isArray),    (tuple: Tuple) => new Resolvable(tuple.token, tail(<any[]>tuple.val), tuple.val.slice(0, -1), tuple.policy)],\n    [pipe(prop('val'), isFunction), (tuple: Tuple) => new Resolvable(tuple.token, tuple.val, annotate(tuple.val), tuple.policy)],\n  ]);\n\n  // prettier-ignore\n  const item2Resolvable = <(obj: any) => Resolvable>pattern([\n    [is(Resolvable), (r: Resolvable) => r],\n    [isResolveLiteral, literal2Resolvable],\n    [isLikeNg2Provider, literal2Resolvable],\n    [isTupleFromObj, tuple2Resolvable],\n    [val(true), (obj: any) => { throw new Error('Invalid resolve value: ' + stringify(obj)); }, ],\n  ]);\n\n  // If resolveBlock is already an array, use it as-is.\n  // Otherwise, assume it's an object and convert to an Array of tuples\n  const decl = state.resolve;\n  const items: any[] = isArray(decl) ? decl : objects2Tuples(decl, state.resolvePolicy || {});\n  return items.map(item2Resolvable);\n}\n\n/**\n * @internalapi A internal global service\n *\n * StateBuilder is a factory for the internal [[StateObject]] objects.\n *\n * When you register a state with the [[StateRegistry]], you register a plain old javascript object which\n * conforms to the [[StateDeclaration]] interface.  This factory takes that object and builds the corresponding\n * [[StateObject]] object, which has an API and is used internally.\n *\n * Custom properties or API may be added to the internal [[StateObject]] object by registering a decorator function\n * using the [[builder]] method.\n */\nexport class StateBuilder {\n  /** An object that contains all the BuilderFunctions registered, key'd by the name of the State property they build */\n  private builders: Builders;\n\n  constructor(private matcher: StateMatcher, urlMatcherFactory: UrlMatcherFactory) {\n    const self = this;\n\n    const root = () => matcher.find('');\n    const isRoot = (state: StateObject) => state.name === '';\n\n    function parentBuilder(state: StateObject) {\n      if (isRoot(state)) return null;\n      return matcher.find(self.parentName(state)) || root();\n    }\n\n    this.builders = {\n      name: [nameBuilder],\n      self: [selfBuilder],\n      parent: [parentBuilder],\n      data: [dataBuilder],\n      // Build a URLMatcher if necessary, either via a relative or absolute URL\n      url: [getUrlBuilder(urlMatcherFactory, root)],\n      // Keep track of the closest ancestor state that has a URL (i.e. is navigable)\n      navigable: [getNavigableBuilder(isRoot)],\n      params: [getParamsBuilder(urlMatcherFactory.paramFactory)],\n      // Each framework-specific ui-router implementation should define its own `views` builder\n      // e.g., src/ng1/statebuilders/views.ts\n      views: [],\n      // Keep a full path from the root down to this state as this is needed for state activation.\n      path: [pathBuilder],\n      // Speed up $state.includes() as it's used a lot\n      includes: [includesBuilder],\n      resolvables: [resolvablesBuilder],\n    };\n  }\n\n  /**\n   * Registers a [[BuilderFunction]] for a specific [[StateObject]] property (e.g., `parent`, `url`, or `path`).\n   * More than one BuilderFunction can be registered for a given property.\n   *\n   * The BuilderFunction(s) will be used to define the property on any subsequently built [[StateObject]] objects.\n   *\n   * @param name The name of the State property being registered for.\n   * @param fn The BuilderFunction which will be used to build the State property\n   * @returns a function which deregisters the BuilderFunction\n   */\n  builder(name: string, fn: BuilderFunction): BuilderFunction | BuilderFunction[] | Function {\n    const builders = this.builders;\n    const array = builders[name] || [];\n    // Backwards compat: if only one builder exists, return it, else return whole arary.\n    if (isString(name) && !isDefined(fn)) return array.length > 1 ? array : array[0];\n    if (!isString(name) || !isFunction(fn)) return;\n\n    builders[name] = array;\n    builders[name].push(fn);\n    return () => builders[name].splice(builders[name].indexOf(fn, 1)) && null;\n  }\n\n  /**\n   * Builds all of the properties on an essentially blank State object, returning a State object which has all its\n   * properties and API built.\n   *\n   * @param state an uninitialized State object\n   * @returns the built State object\n   */\n  build(state: StateObject): StateObject {\n    const { matcher, builders } = this;\n    const parent = this.parentName(state);\n\n    if (parent && !matcher.find(parent, undefined, false)) {\n      return null;\n    }\n\n    for (const key in builders) {\n      if (!builders.hasOwnProperty(key)) continue;\n      const chain = builders[key].reduce(\n        (parentFn: BuilderFunction, step: BuilderFunction) => _state => step(_state, parentFn),\n        noop\n      );\n      state[key] = chain(state);\n    }\n    return state;\n  }\n\n  parentName(state: StateObject) {\n    // name = 'foo.bar.baz.**'\n    const name = state.name || '';\n    // segments = ['foo', 'bar', 'baz', '.**']\n    const segments = name.split('.');\n    // segments = ['foo', 'bar', 'baz']\n    const lastSegment = segments.pop();\n    // segments = ['foo', 'bar'] (ignore .** segment for future states)\n    if (lastSegment === '**') segments.pop();\n\n    if (segments.length) {\n      if (state.parent) {\n        throw new Error(`States that specify the 'parent:' property should not have a '.' in their name (${name})`);\n      }\n\n      // 'foo.bar'\n      return segments.join('.');\n    }\n\n    if (!state.parent) return '';\n    return isString(state.parent) ? state.parent : state.parent.name;\n  }\n\n  name(state: StateObject) {\n    const name = state.name;\n    if (name.indexOf('.') !== -1 || !state.parent) return name;\n\n    const parentName = isString(state.parent) ? state.parent : state.parent.name;\n    return parentName ? parentName + '.' + name : name;\n  }\n}\n",
    "/** @publicapi @module state */ /** */\nimport { StateDeclaration, _ViewDeclaration, _StateDeclaration, LazyLoadResult } from './interface';\nimport { defaults, values, find, inherit } from '../common/common';\nimport { propEq } from '../common/hof';\nimport { Param } from '../params/param';\nimport { UrlMatcher } from '../url/urlMatcher';\nimport { Resolvable } from '../resolve/resolvable';\nimport { TransitionStateHookFn } from '../transition/interface';\nimport { TargetState } from './targetState';\nimport { Transition } from '../transition/transition';\nimport { Glob } from '../common/glob';\nimport { isObject, isFunction } from '../common/predicates';\n\n/**\n * Internal representation of a UI-Router state.\n *\n * Instances of this class are created when a [[StateDeclaration]] is registered with the [[StateRegistry]].\n *\n * A registered [[StateDeclaration]] is augmented with a getter ([[StateDeclaration.$$state]]) which returns the corresponding [[StateObject]] object.\n *\n * This class prototypally inherits from the corresponding [[StateDeclaration]].\n * Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]].\n */\nexport class StateObject {\n  /** The parent [[StateObject]] */\n  public parent: StateObject;\n\n  /** The name used to register the state */\n  public name: string;\n\n  /** Prototypally inherits from [[StateDeclaration.abstract]] */\n  public abstract: boolean;\n\n  /** Prototypally inherits from [[StateDeclaration.resolve]] */\n  public resolve: { [key: string]: string | any[] | Function } | any[];\n\n  /** A list of [[Resolvable]] objects.  The internal representation of [[resolve]]. */\n  public resolvables: Resolvable[];\n\n  /** Prototypally inherits from [[StateDeclaration.resolvePolicy]] */\n  public resolvePolicy: any;\n\n  /** A compiled URLMatcher which detects when the state's URL is matched */\n  public url: UrlMatcher;\n\n  /** The parameters for the state, built from the URL and [[StateDeclaration.params]] */\n  public params: { [key: string]: Param };\n\n  /**\n   * The views for the state.\n   * Note: `@uirouter/core` does not register a builder for views.\n   * The framework specific code should register a `views` builder.\n   */\n  public views: { [key: string]: _ViewDeclaration };\n\n  /**\n   * The original [[StateDeclaration]] used to build this [[StateObject]].\n   * Note: `this` object also prototypally inherits from the `self` declaration object.\n   */\n  public self: StateDeclaration;\n\n  /** The nearest parent [[StateObject]] which has a URL */\n  public navigable: StateObject;\n\n  /** The parent [[StateObject]] objects from this state up to the root */\n  public path: StateObject[];\n\n  /**\n   * Prototypally inherits from [[StateDeclaration.data]]\n   * Note: This is the only field on the [[StateDeclaration]] which is mutated.\n   * The definition object's `data` field is replaced with a new object\n   * which prototypally inherits from the parent state definition's `data` field.\n   */\n  public data: any;\n\n  /**\n   * An object containing the parent States' names as keys and\n   * true as their values.\n   */\n  public includes: { [name: string]: boolean };\n\n  /** Prototypally inherits from [[StateDeclaration.onExit]] */\n  public onExit: TransitionStateHookFn;\n  /** Prototypally inherits from [[StateDeclaration.onRetain]] */\n  public onRetain: TransitionStateHookFn;\n  /** Prototypally inherits from [[StateDeclaration.onEnter]] */\n  public onEnter: TransitionStateHookFn;\n\n  /** Prototypally inherits from [[StateDeclaration.lazyLoad]] */\n  public lazyLoad: (transition: Transition, state: StateDeclaration) => Promise<LazyLoadResult>;\n\n  /** Prototypally inherits from [[StateDeclaration.redirectTo]] */\n  redirectTo:\n    | string\n    | (($transition$: Transition) => TargetState)\n    | { state: string | StateDeclaration; params: { [key: string]: any } };\n\n  /** @hidden */\n  __stateObjectCache: {\n    /** Might be null */\n    nameGlob?: Glob;\n  };\n\n  /**\n   * Create a state object to put the private/internal implementation details onto.\n   * The object's prototype chain looks like:\n   * (Internal State Object) -> (Copy of State.prototype) -> (State Declaration object) -> (State Declaration's prototype...)\n   *\n   * @param stateDecl the user-supplied State Declaration\n   * @returns {StateObject} an internal State object\n   */\n  static create(stateDecl: _StateDeclaration): StateObject {\n    stateDecl = StateObject.isStateClass(stateDecl) ? new stateDecl() : stateDecl;\n\n    const state = inherit(inherit(stateDecl, StateObject.prototype)) as StateObject;\n    stateDecl.$$state = () => state;\n    state.self = stateDecl;\n    state.__stateObjectCache = {\n      nameGlob: Glob.fromString(state.name), // might return null\n    };\n    return state;\n  }\n\n  /** Predicate which returns true if the object is an class with @State() decorator */\n  static isStateClass = (stateDecl: _StateDeclaration): stateDecl is { new (): StateDeclaration } =>\n    isFunction(stateDecl) && stateDecl['__uiRouterState'] === true;\n\n  /** Predicate which returns true if the object is an internal [[StateObject]] object */\n  static isState = (obj: any): obj is StateObject => isObject(obj['__stateObjectCache']);\n\n  /** @deprecated use State.create() */\n  constructor(config?: StateDeclaration) {\n    return StateObject.create(config || {});\n  }\n\n  /**\n   * Returns true if the provided parameter is the same state.\n   *\n   * Compares the identity of the state against the passed value, which is either an object\n   * reference to the actual `State` instance, the original definition object passed to\n   * `$stateProvider.state()`, or the fully-qualified name.\n   *\n   * @param ref Can be one of (a) a `State` instance, (b) an object that was passed\n   *        into `$stateProvider.state()`, (c) the fully-qualified name of a state as a string.\n   * @returns Returns `true` if `ref` matches the current `State` instance.\n   */\n  is(ref: StateObject | StateDeclaration | string): boolean {\n    return this === ref || this.self === ref || this.fqn() === ref;\n  }\n\n  /**\n   * @deprecated this does not properly handle dot notation\n   * @returns Returns a dot-separated name of the state.\n   */\n  fqn(): string {\n    if (!this.parent || !(this.parent instanceof this.constructor)) return this.name;\n    const name = this.parent.fqn();\n    return name ? name + '.' + this.name : this.name;\n  }\n\n  /**\n   * Returns the root node of this state's tree.\n   *\n   * @returns The root of this state's tree.\n   */\n  root(): StateObject {\n    return (this.parent && this.parent.root()) || this;\n  }\n\n  /**\n   * Gets the state's `Param` objects\n   *\n   * Gets the list of [[Param]] objects owned by the state.\n   * If `opts.inherit` is true, it also includes the ancestor states' [[Param]] objects.\n   * If `opts.matchingKeys` exists, returns only `Param`s whose `id` is a key on the `matchingKeys` object\n   *\n   * @param opts options\n   */\n  parameters(opts?: { inherit?: boolean; matchingKeys?: any }): Param[] {\n    opts = defaults(opts, { inherit: true, matchingKeys: null });\n    const inherited = (opts.inherit && this.parent && this.parent.parameters()) || [];\n    return inherited\n      .concat(values(this.params))\n      .filter(param => !opts.matchingKeys || opts.matchingKeys.hasOwnProperty(param.id));\n  }\n\n  /**\n   * Returns a single [[Param]] that is owned by the state\n   *\n   * If `opts.inherit` is true, it also searches the ancestor states` [[Param]]s.\n   * @param id the name of the [[Param]] to return\n   * @param opts options\n   */\n  parameter(id: string, opts: { inherit?: boolean } = {}): Param {\n    return (\n      (this.url && this.url.parameter(id, opts)) ||\n      find(values(this.params), propEq('id', id)) ||\n      (opts.inherit && this.parent && this.parent.parameter(id))\n    );\n  }\n\n  toString() {\n    return this.fqn();\n  }\n}\n",
    "/** @publicapi @module state */ /** */\nimport { isString } from '../common/predicates';\nimport { StateOrName } from './interface';\nimport { StateObject } from './stateObject';\nimport { values } from '../common/common';\n\nexport class StateMatcher {\n  constructor(private _states: { [key: string]: StateObject }) {}\n\n  isRelative(stateName: string) {\n    stateName = stateName || '';\n    return stateName.indexOf('.') === 0 || stateName.indexOf('^') === 0;\n  }\n\n  find(stateOrName: StateOrName, base?: StateOrName, matchGlob = true): StateObject {\n    if (!stateOrName && stateOrName !== '') return undefined;\n    const isStr = isString(stateOrName);\n    let name: string = isStr ? stateOrName : (<any>stateOrName).name;\n\n    if (this.isRelative(name)) name = this.resolvePath(name, base);\n    const state = this._states[name];\n\n    if (state && (isStr || (!isStr && (state === stateOrName || state.self === stateOrName)))) {\n      return state;\n    } else if (isStr && matchGlob) {\n      const _states = values(this._states);\n      const matches = _states.filter(\n        _state => _state.__stateObjectCache.nameGlob && _state.__stateObjectCache.nameGlob.matches(name)\n      );\n\n      if (matches.length > 1) {\n        // tslint:disable-next-line:no-console\n        console.log(\n          `stateMatcher.find: Found multiple matches for ${name} using glob: `,\n          matches.map(match => match.name)\n        );\n      }\n      return matches[0];\n    }\n    return undefined;\n  }\n\n  resolvePath(name: string, base: StateOrName) {\n    if (!base) throw new Error(`No reference point given for path '${name}'`);\n\n    const baseState: StateObject = this.find(base);\n\n    const splitName = name.split('.');\n    const pathLength = splitName.length;\n    let i = 0,\n      current = baseState;\n\n    for (; i < pathLength; i++) {\n      if (splitName[i] === '' && i === 0) {\n        current = baseState;\n        continue;\n      }\n      if (splitName[i] === '^') {\n        if (!current.parent) throw new Error(`Path '${name}' not valid for state '${baseState.name}'`);\n        current = current.parent;\n        continue;\n      }\n      break;\n    }\n    const relName = splitName.slice(i).join('.');\n    return current.name + (current.name && relName ? '.' : '') + relName;\n  }\n}\n",
    "/** @publicapi @module state */ /** */\nimport { inArray, isString, prop } from '../common';\nimport { _StateDeclaration } from './interface';\nimport { StateObject } from './stateObject';\nimport { StateBuilder } from './stateBuilder';\nimport { StateRegistryListener } from './stateRegistry';\nimport { Disposable } from '../interface';\nimport { UIRouter } from '../router';\n\n/** @internalapi */\nexport class StateQueueManager implements Disposable {\n  queue: StateObject[] = [];\n\n  constructor(\n    private router: UIRouter,\n    public states: { [key: string]: StateObject },\n    public builder: StateBuilder,\n    public listeners: StateRegistryListener[]\n  ) {}\n\n  /** @internalapi */\n  dispose() {\n    this.queue = [];\n  }\n\n  register(stateDecl: _StateDeclaration) {\n    const queue = this.queue;\n    const state = StateObject.create(stateDecl);\n    const name = state.name;\n\n    if (!isString(name)) throw new Error('State must have a valid name');\n    if (this.states.hasOwnProperty(name) || inArray(queue.map(prop('name')), name))\n      throw new Error(`State '${name}' is already defined`);\n\n    queue.push(state);\n    this.flush();\n\n    return state;\n  }\n\n  flush() {\n    const { queue, states, builder } = this;\n    const registered: StateObject[] = [], // states that got registered\n      orphans: StateObject[] = [], // states that don't yet have a parent registered\n      previousQueueLength = {}; // keep track of how long the queue when an orphan was first encountered\n    const getState = name => this.states.hasOwnProperty(name) && this.states[name];\n    const notifyListeners = () => {\n      if (registered.length) {\n        this.listeners.forEach(listener => listener('registered', registered.map(s => s.self)));\n      }\n    };\n\n    while (queue.length > 0) {\n      const state: StateObject = queue.shift();\n      const name = state.name;\n      const result: StateObject = builder.build(state);\n      const orphanIdx: number = orphans.indexOf(state);\n\n      if (result) {\n        const existingState = getState(name);\n        if (existingState && existingState.name === name) {\n          throw new Error(`State '${name}' is already defined`);\n        }\n\n        const existingFutureState = getState(name + '.**');\n        if (existingFutureState) {\n          // Remove future state of the same name\n          this.router.stateRegistry.deregister(existingFutureState);\n        }\n\n        states[name] = state;\n        this.attachRoute(state);\n        if (orphanIdx >= 0) orphans.splice(orphanIdx, 1);\n        registered.push(state);\n        continue;\n      }\n\n      const prev = previousQueueLength[name];\n      previousQueueLength[name] = queue.length;\n      if (orphanIdx >= 0 && prev === queue.length) {\n        // Wait until two consecutive iterations where no additional states were dequeued successfully.\n        // throw new Error(`Cannot register orphaned state '${name}'`);\n        queue.push(state);\n        notifyListeners();\n        return states;\n      } else if (orphanIdx < 0) {\n        orphans.push(state);\n      }\n\n      queue.push(state);\n    }\n\n    notifyListeners();\n    return states;\n  }\n\n  attachRoute(state: StateObject) {\n    if (state.abstract || !state.url) return;\n    const rulesApi = this.router.urlService.rules;\n    rulesApi.rule(rulesApi.urlRuleFactory.create(state));\n  }\n}\n",
    "/** @publicapi @module state */ /** */\n\nimport { StateObject } from './stateObject';\nimport { StateMatcher } from './stateMatcher';\nimport { StateBuilder } from './stateBuilder';\nimport { StateQueueManager } from './stateQueueManager';\nimport { StateDeclaration, _StateDeclaration } from './interface';\nimport { BuilderFunction } from './stateBuilder';\nimport { StateOrName } from './interface';\nimport { removeFrom } from '../common/common';\nimport { UIRouter } from '../router';\nimport { propEq } from '../common/hof';\n\n/**\n * The signature for the callback function provided to [[StateRegistry.onStatesChanged]].\n *\n * This callback receives two parameters:\n *\n * @param event a string; either \"registered\" or \"deregistered\"\n * @param states the list of [[StateDeclaration]]s that were registered (or deregistered).\n */\nexport type StateRegistryListener = (event: 'registered' | 'deregistered', states: StateDeclaration[]) => void;\n\nexport class StateRegistry {\n  private _root: StateObject;\n  private states: { [key: string]: StateObject } = {};\n\n  matcher: StateMatcher;\n  private builder: StateBuilder;\n  stateQueue: StateQueueManager;\n\n  listeners: StateRegistryListener[] = [];\n\n  /** @internalapi */\n  constructor(private router: UIRouter) {\n    this.matcher = new StateMatcher(this.states);\n    this.builder = new StateBuilder(this.matcher, router.urlMatcherFactory);\n    this.stateQueue = new StateQueueManager(router, this.states, this.builder, this.listeners);\n    this._registerRoot();\n  }\n\n  /** @internalapi */\n  private _registerRoot() {\n    const rootStateDef: StateDeclaration = {\n      name: '',\n      url: '^',\n      views: null,\n      params: {\n        '#': { value: null, type: 'hash', dynamic: true },\n      },\n      abstract: true,\n    };\n\n    const _root = (this._root = this.stateQueue.register(rootStateDef));\n    _root.navigable = null;\n  }\n\n  /** @internalapi */\n  dispose() {\n    this.stateQueue.dispose();\n    this.listeners = [];\n    this.get().forEach(state => this.get(state) && this.deregister(state));\n  }\n\n  /**\n   * Listen for a State Registry events\n   *\n   * Adds a callback that is invoked when states are registered or deregistered with the StateRegistry.\n   *\n   * #### Example:\n   * ```js\n   * let allStates = registry.get();\n   *\n   * // Later, invoke deregisterFn() to remove the listener\n   * let deregisterFn = registry.onStatesChanged((event, states) => {\n   *   switch(event) {\n   *     case: 'registered':\n   *       states.forEach(state => allStates.push(state));\n   *       break;\n   *     case: 'deregistered':\n   *       states.forEach(state => {\n   *         let idx = allStates.indexOf(state);\n   *         if (idx !== -1) allStates.splice(idx, 1);\n   *       });\n   *       break;\n   *   }\n   * });\n   * ```\n   *\n   * @param listener a callback function invoked when the registered states changes.\n   *        The function receives two parameters, `event` and `state`.\n   *        See [[StateRegistryListener]]\n   * @return a function that deregisters the listener\n   */\n  onStatesChanged(listener: StateRegistryListener): () => void {\n    this.listeners.push(listener);\n    return function deregisterListener() {\n      removeFrom(this.listeners)(listener);\n    }.bind(this);\n  }\n\n  /**\n   * Gets the implicit root state\n   *\n   * Gets the root of the state tree.\n   * The root state is implicitly created by UI-Router.\n   * Note: this returns the internal [[StateObject]] representation, not a [[StateDeclaration]]\n   *\n   * @return the root [[StateObject]]\n   */\n  root() {\n    return this._root;\n  }\n\n  /**\n   * Adds a state to the registry\n   *\n   * Registers a [[StateDeclaration]] or queues it for registration.\n   *\n   * Note: a state will be queued if the state's parent isn't yet registered.\n   *\n   * @param stateDefinition the definition of the state to register.\n   * @returns the internal [[StateObject]] object.\n   *          If the state was successfully registered, then the object is fully built (See: [[StateBuilder]]).\n   *          If the state was only queued, then the object is not fully built.\n   */\n  register(stateDefinition: _StateDeclaration): StateObject {\n    return this.stateQueue.register(stateDefinition);\n  }\n\n  /** @hidden */\n  private _deregisterTree(state: StateObject) {\n    const all = this.get().map(s => s.$$state());\n    const getChildren = (states: StateObject[]) => {\n      const _children = all.filter(s => states.indexOf(s.parent) !== -1);\n      return _children.length === 0 ? _children : _children.concat(getChildren(_children));\n    };\n\n    const children = getChildren([state]);\n    const deregistered: StateObject[] = [state].concat(children).reverse();\n\n    deregistered.forEach(_state => {\n      const rulesApi = this.router.urlService.rules;\n\n      // Remove URL rule\n      rulesApi\n        .rules()\n        .filter(propEq('state', _state))\n        .forEach(rule => rulesApi.removeRule(rule));\n\n      // Remove state from registry\n      delete this.states[_state.name];\n    });\n\n    return deregistered;\n  }\n\n  /**\n   * Removes a state from the registry\n   *\n   * This removes a state from the registry.\n   * If the state has children, they are are also removed from the registry.\n   *\n   * @param stateOrName the state's name or object representation\n   * @returns {StateObject[]} a list of removed states\n   */\n  deregister(stateOrName: StateOrName) {\n    const _state = this.get(stateOrName);\n    if (!_state) throw new Error(\"Can't deregister state; not found: \" + stateOrName);\n    const deregisteredStates = this._deregisterTree(_state.$$state());\n\n    this.listeners.forEach(listener => listener('deregistered', deregisteredStates.map(s => s.self)));\n    return deregisteredStates;\n  }\n\n  /**\n   * Gets all registered states\n   *\n   * Calling this method with no arguments will return a list of all the states that are currently registered.\n   * Note: this does not return states that are *queued* but not yet registered.\n   *\n   * @return a list of [[StateDeclaration]]s\n   */\n  get(): StateDeclaration[];\n\n  /**\n   * Gets a registered state\n   *\n   * Given a state or a name, finds and returns the [[StateDeclaration]] from the registry.\n   * Note: this does not return states that are *queued* but not yet registered.\n   *\n   * @param stateOrName either the name of a state, or a state object.\n   * @param base the base state to use when stateOrName is relative.\n   * @return a registered [[StateDeclaration]] that matched the `stateOrName`, or null if the state isn't registered.\n   */\n  get(stateOrName: StateOrName, base?: StateOrName): StateDeclaration;\n  get(stateOrName?: StateOrName, base?: StateOrName): any {\n    if (arguments.length === 0) return <StateDeclaration[]>Object.keys(this.states).map(name => this.states[name].self);\n    const found = this.matcher.find(stateOrName, base);\n    return (found && found.self) || null;\n  }\n\n  decorator(name: string, func: BuilderFunction) {\n    return this.builder.builder(name, func);\n  }\n}\n",
    "/** @publicapi @module transition */ /** */\nimport { StateDeclaration } from '../state/interface';\nimport { PredicateBinary } from '../common/common';\n\nimport { Transition } from './transition';\nimport { StateObject } from '../state/stateObject';\nimport { PathNode } from '../path/pathNode';\nimport { TargetState } from '../state/targetState';\nimport { RegisteredHook } from './hookRegistry';\n\n/**\n * The TransitionOptions object can be used to change the behavior of a transition.\n *\n * It is passed as the third argument to [[StateService.go]], [[StateService.transitionTo]].\n * It can also be used with a `uiSref`.\n */\nexport interface TransitionOptions {\n  /**\n   * This option changes how the Transition interacts with the browser's location bar (URL).\n   *\n   * - If `true`, it will update the url in the location bar.\n   * - If `false`, it will not update the url in the location bar.\n   * - If it is the string `\"replace\"`, it will update the url and also replace the last history record.\n   *\n   * @default `true`\n   */\n  location?: boolean | string;\n\n  /**\n   * When transitioning to relative path (e.g '`^`'), this option defines which state to be relative from.\n   * @default `$state.current`\n   */\n  relative?: string | StateDeclaration | StateObject;\n\n  /**\n   * This option sets whether or not the transition's parameter values should be inherited from\n   * the current parameter values.\n   *\n   * - If `true`, it will inherit parameter values from the current parameter values.\n   * - If `false`, only the parameters which are provided to `transitionTo` will be used.\n   *\n   * @default `false`\n   */\n  inherit?: boolean;\n\n  /**\n   * @deprecated\n   */\n  notify?: boolean;\n\n  /**\n   * This option may be used to force states which are currently active to reload.\n   *\n   * During a normal transition, a state is \"retained\" if:\n   * - It was previously active\n   * - The state's parameter values have not changed\n   * - All the parent states' parameter values have not changed\n   *\n   * Forcing a reload of a state will cause it to be exited and entered, which will:\n   * - Refetch that state's resolve data\n   * - Exit the state (onExit hook)\n   * - Re-enter the state (onEnter hook)\n   * - Re-render the views (controllers and templates)\n   *\n   * - When `true`, the destination state (and all parent states) will be reloaded.\n   * - When it is a string and is the name of a state, or when it is a State object,\n   *   that state and any children states will be reloaded.\n   *\n   * @default `false`\n   */\n  reload?: boolean | string | StateDeclaration | StateObject;\n  /**\n   * You can define your own Transition Options inside this property and use them, e.g., from a Transition Hook\n   */\n  custom?: any;\n  /** @internalapi */\n  reloadState?: StateObject;\n  /** @internalapi\n   * If this transition is a redirect, this property should be the original Transition (which was redirected to this one)\n   */\n  redirectedFrom?: Transition;\n  /** @internalapi */\n  current?: () => Transition;\n  /** @internalapi */\n  source?: 'sref' | 'url' | 'redirect' | 'otherwise' | 'unknown';\n}\n\n/** @internalapi */\nexport interface TransitionHookOptions {\n  current?: () => Transition; // path?\n  transition?: Transition;\n  hookType?: string;\n  target?: any;\n  traceData?: any;\n  bind?: any;\n  stateHook?: boolean;\n}\n\n/**\n * TreeChanges encapsulates the various Paths that are involved in a Transition.\n *\n * Get a TreeChanges object using [[Transition.treeChanges]]\n *\n * A UI-Router Transition is from one Path in a State Tree to another Path.  For a given Transition,\n * this object stores the \"to\" and \"from\" paths, as well as subsets of those: the \"retained\",\n * \"exiting\" and \"entering\" paths.\n *\n * Each path in TreeChanges is an array of [[PathNode]] objects. Each PathNode in the array corresponds to a portion\n * of a nested state.\n *\n * For example, if you had a nested state named `foo.bar.baz`, it would have three\n * portions, `foo, bar, baz`.  If you transitioned **to** `foo.bar.baz` and inspected the [[TreeChanges.to]]\n * Path, you would find a node in the array for each portion: `foo`, `bar`, and `baz`.\n *\n * ---\n *\n * @todo show visual state tree\n */\nexport interface TreeChanges {\n  /** @nodoc */\n  [key: string]: PathNode[];\n\n  /** The path of nodes in the state tree that the transition is coming *from* */\n  from: PathNode[];\n\n  /** The path of nodes in the state tree that the transition is going *to* */\n  to: PathNode[];\n\n  /**\n   * The path of active nodes that the transition is retaining.\n   *\n   * These nodes are neither exited, nor entered.\n   * Before and after the transition is successful, these nodes are active.\n   */\n  retained: PathNode[];\n\n  /**\n   * The path of active nodes that the transition is retaining with updated \"to params\" applied.\n   *\n   * These nodes are neither exited, nor entered.\n   * Before and after the transition is successful, these nodes are active.\n   *\n   * This is a shallow copy of [[retained]], but with new (dynamic) parameter values from [[to]] applied.\n   */\n  retainedWithToParams: PathNode[];\n\n  /**\n   * The path of previously active nodes that the transition is exiting.\n   *\n   * After the Transition is successful, these nodes are no longer active.\n   *\n   * Note that a state that is being reloaded (due to parameter values changing, or `reload: true`) may be in both the\n   * `exiting` and `entering` paths.\n   */\n  exiting: PathNode[];\n\n  /**\n   * The path of nodes that the transition is entering.\n   *\n   * After the Transition is successful, these nodes will be active.\n   * Because they are entering, they have their resolves fetched, `onEnter` hooks run, and their views\n   * (component(s) or controller(s)+template(s)) refreshed.\n   *\n   * Note that a state that is reloaded (due to parameter values changing, or `reload: true`) may be in both the\n   * `exiting` and `entering` paths.\n   */\n  entering: PathNode[];\n}\n\nexport type IHookRegistration = (\n  matchCriteria: HookMatchCriteria,\n  callback: HookFn,\n  options?: HookRegOptions\n) => Function;\n\n/**\n * The signature for Transition Hooks.\n *\n * Transition hooks are callback functions that hook into the lifecycle of transitions.\n * As a transition runs, it reaches certain lifecycle events.\n * As each event occurs, the hooks which are registered for the event are called (in priority order).\n *\n * A transition hook may alter a Transition by returning a [[HookResult]].\n *\n * #### See:\n *\n * - [[IHookRegistry.onBefore]]\n * - [[IHookRegistry.onStart]]\n * - [[IHookRegistry.onFinish]]\n * - [[IHookRegistry.onSuccess]]\n * - [[IHookRegistry.onError]]\n *\n * @param transition the current [[Transition]]\n * @param injector (for ng1 or ng2 only) the injector service\n *\n * @returns a [[HookResult]] which may alter the transition\n *\n */\nexport interface TransitionHookFn {\n  (transition: Transition): HookResult;\n}\n\n/**\n * The signature for Transition State Hooks.\n *\n * A function which hooks into a lifecycle event for a specific state.\n *\n * Transition State Hooks are callback functions that hook into the lifecycle events of specific states during a transition.\n * As a transition runs, it may exit some states, retain (keep) states, and enter states.\n * As each lifecycle event occurs, the hooks which are registered for the event and that state are called (in priority order).\n *\n * #### See:\n *\n * - [[IHookRegistry.onExit]]\n * - [[IHookRegistry.onRetain]]\n * - [[IHookRegistry.onEnter]]\n *\n * @param transition the current [[Transition]]\n * @param state the [[StateObject]] that the hook is bound to\n * @param injector (for ng1 or ng2 only) the injector service\n *\n * @returns a [[HookResult]] which may alter the transition\n */\nexport interface TransitionStateHookFn {\n  (transition: Transition, state: StateDeclaration): HookResult;\n}\n\n/**\n * The signature for Transition onCreate Hooks.\n *\n * Transition onCreate Hooks are callbacks that allow customization or preprocessing of\n * a Transition before it is returned from [[TransitionService.create]]\n *\n * @param transition the [[Transition]] that was just created\n * @return a [[Transition]] which will then be returned from [[TransitionService.create]]\n */\nexport interface TransitionCreateHookFn {\n  (transition: Transition): void;\n}\n\nexport type HookFn = TransitionHookFn | TransitionStateHookFn | TransitionCreateHookFn;\n\n/**\n * The return value of a [[TransitionHookFn]] or [[TransitionStateHookFn]]\n *\n * When returned from a [[TransitionHookFn]] or [[TransitionStateHookFn]], these values alter the running [[Transition]]:\n *\n * - `false`: the transition will be cancelled.\n * - [[TargetState]]: the transition will be redirected to the new target state (see: [[StateService.target]])\n * - `Promise`: the transition will wait for the promise to resolve or reject\n *    - If the promise is rejected (or resolves to `false`), the transition will be cancelled\n *    - If the promise resolves to a [[TargetState]], the transition will be redirected\n *    - If the promise resolves to anything else, the transition will resume\n * - Anything else: the transition will resume\n */\nexport type HookResult = boolean | TargetState | void | Promise<boolean | TargetState | void>;\n\n/**\n * These options may be provided when registering a Transition Hook (such as `onStart`)\n */\nexport interface HookRegOptions {\n  /**\n   * Sets the priority of the registered hook\n   *\n   * Hooks of the same type (onBefore, onStart, etc) are invoked in priority order.  A hook with a higher priority\n   * is invoked before a hook with a lower priority.\n   *\n   * The default hook priority is 0\n   */\n  priority?: number;\n\n  /**\n   * Specifies what `this` is bound to during hook invocation.\n   */\n  bind?: any;\n\n  /**\n   * Limits the number of times that the hook will be invoked.\n   * Once the hook has been invoked this many times, it is automatically deregistered.\n   */\n  invokeLimit?: number;\n}\n\n/**\n * This interface specifies the api for registering Transition Hooks.  Both the\n * [[TransitionService]] and also the [[Transition]] object itself implement this interface.\n * Note: the Transition object only allows hooks to be registered before the Transition is started.\n */\nexport interface IHookRegistry {\n  /** @hidden place to store the hooks */\n  _registeredHooks: { [key: string]: RegisteredHook[] };\n\n  /**\n   * Registers a [[TransitionHookFn]], called *before a transition starts*.\n   *\n   * Registers a transition lifecycle hook, which is invoked before a transition even begins.\n   * This hook can be useful to implement logic which prevents a transition from even starting, such\n   * as authentication, redirection\n   *\n   * See [[TransitionHookFn]] for the signature of the function.\n   *\n   * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n   * To match all Transitions, use an empty criteria object `{}`.\n   *\n   * ### Lifecycle\n   *\n   * `onBefore` hooks are invoked *before a Transition starts*.\n   * No resolves have been fetched yet.\n   * Each `onBefore` hook is invoked synchronously, in the same call stack as [[StateService.transitionTo]].\n   * The registered `onBefore` hooks are invoked in priority order.\n   *\n   * Note: during the `onBefore` phase, additional hooks can be added to the specific [[Transition]] instance.\n   * These \"on-the-fly\" hooks only affect the currently running transition..\n   *\n   * ### Return value\n   *\n   * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n   * See [[HookResult]] for more information.\n   *\n   * If any hook modifies the transition *synchronously* (by throwing, returning `false`, or returning\n   * a [[TargetState]]), the remainder of the hooks are skipped.\n   * If a hook returns a promise, the remainder of the `onBefore` hooks are still invoked synchronously.\n   * All promises are resolved, and processed asynchronously before the `onStart` phase of the Transition.\n   *\n   * ### Examples\n   *\n   * #### Default Substate\n   *\n   * This example redirects any transition from 'home' to 'home.dashboard'.  This is commonly referred to as a\n   * \"default substate\".\n   *\n   * @example\n   * ```js\n   * // ng2\n   * transitionService.onBefore({ to: 'home' }, (trans: Transition) =>\n   *     trans.router.stateService.target(\"home.dashboard\"));\n   * ```\n   *\n   * #### Data Driven Default Substate\n   *\n   * This example provides data-driven default substate functionality. It matches on a transition to any state\n   * which has `defaultSubstate: \"some.sub.state\"` defined.  See: [[Transition.to]] which returns the \"to state\"\n   * definition.\n   *\n   * @example\n   * ```js\n   * // ng1\n   * // state declaration\n   * {\n   *   name: 'home',\n   *   template: '<div ui-view/>',\n   *   defaultSubstate: 'home.dashboard'\n   * }\n   *\n   * var criteria = {\n   *   to: function(state) {\n   *     return state.defaultSubstate != null;\n   *   }\n   * }\n   *\n   * $transitions.onBefore(criteria, function(trans: Transition) {\n   *   var substate = trans.to().defaultSubstate;\n   *   return trans.router.stateService.target(substate);\n   * });\n   * ```\n   *\n   *\n   * #### Require authentication\n   *\n   * This example cancels a transition to a state which requires authentication, if the user is not currently authenticated.\n   *\n   * This example assumes a state tree where all states which require authentication are children of a parent `'requireauth'` state.\n   * This example assumes `MyAuthService` synchronously returns a boolean from `isAuthenticated()`.\n   *\n   * #### Example:\n   * ```js\n   * // ng1\n   * $transitions.onBefore( { to: 'requireauth.**' }, function(trans) {\n   *   var myAuthService = trans.injector().get('MyAuthService');\n   *   // If isAuthenticated returns false, the transition is cancelled.\n   *   return myAuthService.isAuthenticated();\n   * });\n   * ```\n   *\n   * @param matchCriteria defines which Transitions the Hook should be invoked for.\n   * @param callback the hook function which will be invoked.\n   * @returns a function which deregisters the hook.\n   */\n  onBefore(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n  /**\n   * Registers a [[TransitionHookFn]], called when a transition starts.\n   *\n   * Registers a transition lifecycle hook, which is invoked as a transition starts running.\n   * This hook can be useful to perform some asynchronous action before completing a transition.\n   *\n   * See [[TransitionHookFn]] for the signature of the function.\n   *\n   * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n   * To match all Transitions, use an empty criteria object `{}`.\n   *\n   * ### Lifecycle\n   *\n   * `onStart` hooks are invoked asynchronously when the Transition starts running.\n   * This happens after the `onBefore` phase is complete.\n   * At this point, the Transition has not yet exited nor entered any states.\n   * The registered `onStart` hooks are invoked in priority order.\n   *\n   * Note: A built-in `onStart` hook with high priority is used to fetch any eager resolve data.\n   *\n   * ### Return value\n   *\n   * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n   * See [[HookResult]] for more information.\n   *\n   * ### Example\n   *\n   * #### Login during transition\n   *\n   * This example intercepts any transition to a state which requires authentication, when the user is\n   * not currently authenticated.  It allows the user to authenticate asynchronously, then resumes the\n   * transition.  If the user did not authenticate successfully, it redirects to the \"guest\" state, which\n   * does not require authentication.\n   *\n   * This example assumes:\n   * - a state tree where all states which require authentication are children of a parent `'auth'` state.\n   * - `MyAuthService.isAuthenticated()` synchronously returns a boolean.\n   * - `MyAuthService.authenticate()` presents a login dialog, and returns a promise which is resolved\n   *   or rejected, whether or not the login attempt was successful.\n   *\n   * #### Example:\n   * ```js\n   * // ng1\n   * $transitions.onStart( { to: 'auth.**' }, function(trans) {\n   *   var $state = trans.router.stateService;\n   *   var MyAuthService = trans.injector().get('MyAuthService');\n   *\n   *   // If the user is not authenticated\n   *   if (!MyAuthService.isAuthenticated()) {\n   *\n   *     // Then return a promise for a successful login.\n   *     // The transition will wait for this promise to settle\n   *\n   *     return MyAuthService.authenticate().catch(function() {\n   *\n   *       // If the authenticate() method failed for whatever reason,\n   *       // redirect to a 'guest' state which doesn't require auth.\n   *       return $state.target(\"guest\");\n   *     });\n   *   }\n   * });\n   * ```\n   *\n   * @param matchCriteria defines which Transitions the Hook should be invoked for.\n   * @param callback the hook function which will be injected and invoked.\n   * @returns a function which deregisters the hook.\n   */\n  onStart(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n  /**\n   * Registers a [[TransitionStateHookFn]], called when a specific state is entered.\n   *\n   * Registers a lifecycle hook, which is invoked (during a transition) when a specific state is being entered.\n   *\n   * Since this hook is run only when the specific state is being *entered*, it can be useful for\n   * performing tasks when entering a submodule/feature area such as initializing a stateful service,\n   * or for guarding access to a submodule/feature area.\n   *\n   * See [[TransitionStateHookFn]] for the signature of the function.\n   *\n   * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n   * `onEnter` hooks generally specify `{ entering: 'somestate' }`.\n   * To match all Transitions, use an empty criteria object `{}`.\n   *\n   * ### Lifecycle\n   *\n   * `onEnter` hooks are invoked when the Transition is entering a state.\n   * States are entered after the `onRetain` phase is complete.\n   * If more than one state is being entered, the parent state is entered first.\n   * The registered `onEnter` hooks for a state are invoked in priority order.\n   *\n   * Note: A built-in `onEnter` hook with high priority is used to fetch lazy resolve data for states being entered.\n   *\n   * ### Return value\n   *\n   * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n   * See [[HookResult]] for more information.\n   *\n   * ### Inside a state declaration\n   *\n   * Instead of registering `onEnter` hooks using the [[TransitionService]], you may define an `onEnter` hook\n   * directly on a state declaration (see: [[StateDeclaration.onEnter]]).\n   *\n   *\n   * ### Examples\n   *\n   * #### Audit Log\n   *\n   * This example uses a service to log that a user has entered the admin section of an app.\n   * This assumes that there are substates of the \"admin\" state, such as \"admin.users\", \"admin.pages\", etc.\n   * @example\n   * ```\n   *\n   * $transitions.onEnter({ entering: 'admin' }, function(transition, state) {\n   *   var AuditService = trans.injector().get('AuditService');\n   *   AuditService.log(\"Entered \" + state.name + \" module while transitioning to \" + transition.to().name);\n   * }\n   * ```\n   *\n   * #### Audit Log (inside a state declaration)\n   *\n   * The `onEnter` inside this state declaration is syntactic sugar for the previous Audit Log example.\n   * ```\n   * {\n   *   name: 'admin',\n   *   component: 'admin',\n   *   onEnter: function($transition$, $state$) {\n   *     var AuditService = $transition$.injector().get('AuditService');\n   *     AuditService.log(\"Entered \" + state.name + \" module while transitioning to \" + transition.to().name);\n   *   }\n   * }\n   * ```\n   *\n   * Note: A state declaration's `onEnter` function is injected for Angular 1 only.\n   *\n   * @param matchCriteria defines which Transitions the Hook should be invoked for.\n   * @param callback the hook function which will be injected and invoked.\n   * @returns a function which deregisters the hook.\n   */\n  onEnter(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n  /**\n   * Registers a [[TransitionStateHookFn]], called when a specific state is retained/kept.\n   *\n   * Registers a lifecycle hook, which is invoked (during a transition) for\n   * a specific state that was previously active will remain active (is not being entered nor exited).\n   *\n   * This hook is invoked when a state is \"retained\" or \"kept\".\n   * It means the transition is coming *from* a substate of the retained state *to* a substate of the retained state.\n   * This hook can be used to perform actions when the user moves from one substate to another, such as between steps in a wizard.\n   *\n   * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n   * `onRetain` hooks generally specify `{ retained: 'somestate' }`.\n   * To match all Transitions, use an empty criteria object `{}`.\n   *\n   * ### Lifecycle\n   *\n   * `onRetain` hooks are invoked after any `onExit` hooks have been fired.\n   * If more than one state is retained, the child states' `onRetain` hooks are invoked first.\n   * The registered `onRetain` hooks for a state are invoked in priority order.\n   *\n   * ### Return value\n   *\n   * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n   * See [[HookResult]] for more information.\n   *\n   * ### Inside a state declaration\n   *\n   * Instead of registering `onRetain` hooks using the [[TransitionService]], you may define an `onRetain` hook\n   * directly on a state declaration (see: [[StateDeclaration.onRetain]]).\n   *\n   * Note: A state declaration's `onRetain` function is injected for Angular 1 only.\n   *\n   * @param matchCriteria defines which Transitions the Hook should be invoked for.\n   * @param callback the hook function which will be injected and invoked.\n   * @returns a function which deregisters the hook.\n   */\n  onRetain(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n  /**\n   * Registers a [[TransitionStateHookFn]], called when a specific state is exited.\n   *\n   * Registers a lifecycle hook, which is invoked (during a transition) when a specific state is being exited.\n   *\n   * Since this hook is run only when the specific state is being *exited*, it can be useful for\n   * performing tasks when leaving a submodule/feature area such as cleaning up a stateful service,\n   * or for preventing the user from leaving a state or submodule until some criteria is satisfied.\n   *\n   * See [[TransitionStateHookFn]] for the signature of the function.\n   *\n   * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n   * `onExit` hooks generally specify `{ exiting: 'somestate' }`.\n   * To match all Transitions, use an empty criteria object `{}`.\n   *\n   * ### Lifecycle\n   *\n   * `onExit` hooks are invoked when the Transition is exiting a state.\n   * States are exited after any `onStart` phase is complete.\n   * If more than one state is being exited, the child states are exited first.\n   * The registered `onExit` hooks for a state are invoked in priority order.\n   *\n   * ### Return value\n   *\n   * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n   * See [[HookResult]] for more information.\n   *\n   * ### Inside a state declaration\n   *\n   * Instead of registering `onExit` hooks using the [[TransitionService]], you may define an `onExit` hook\n   * directly on a state declaration (see: [[StateDeclaration.onExit]]).\n   *\n   * Note: A state declaration's `onExit` function is injected for Angular 1 only.\n   *\n   * @param matchCriteria defines which Transitions the Hook should be invoked for.\n   * @param callback the hook function which will be injected and invoked.\n   * @returns a function which deregisters the hook.\n   */\n  onExit(matchCriteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function;\n\n  /**\n   * Registers a [[TransitionHookFn]], called *just before a transition finishes*.\n   *\n   * Registers a transition lifecycle hook, which is invoked just before a transition finishes.\n   * This hook is a last chance to cancel or redirect a transition.\n   *\n   * See [[TransitionHookFn]] for the signature of the function.\n   *\n   * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n   * To match all Transitions, use an empty criteria object `{}`.\n   *\n   * ### Lifecycle\n   *\n   * `onFinish` hooks are invoked after the `onEnter` phase is complete.\n   * These hooks are invoked just before the transition is \"committed\".\n   * Each hook is invoked in priority order.\n   *\n   * ### Return value\n   *\n   * The hook's return value can be used to pause, cancel, or redirect the current Transition.\n   * See [[HookResult]] for more information.\n   *\n   * @param matchCriteria defines which Transitions the Hook should be invoked for.\n   * @param callback the hook function which will be injected and invoked.\n   * @returns a function which deregisters the hook.\n   */\n  onFinish(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n  /**\n   * Registers a [[TransitionHookFn]], called after a successful transition completed.\n   *\n   * Registers a transition lifecycle hook, which is invoked after a transition successfully completes.\n   *\n   * See [[TransitionHookFn]] for the signature of the function.\n   *\n   * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n   * To match all Transitions, use an empty criteria object `{}`.\n   *\n   * ### Lifecycle\n   *\n   * `onSuccess` hooks are chained off the Transition's promise (see [[Transition.promise]]).\n   * If the Transition is successful and its promise is resolved, then the `onSuccess` hooks are invoked.\n   * Since these hooks are run after the transition is over, their return value is ignored.\n   * The `onSuccess` hooks are invoked in priority order.\n   *\n   * ### Return value\n   *\n   * Since the Transition is already completed, the hook's return value is ignored\n   *\n   * @param matchCriteria defines which Transitions the Hook should be invoked for.\n   * @param callback the hook function which will be injected and invoked.\n   * @returns a function which deregisters the hook.\n   */\n  onSuccess(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n  /**\n   * Registers a [[TransitionHookFn]], called after a transition has errored.\n   *\n   * Registers a transition lifecycle hook, which is invoked after a transition has been rejected for any reason.\n   *\n   * See [[TransitionHookFn]] for the signature of the function.\n   *\n   * The [[HookMatchCriteria]] is used to determine which Transitions the hook should be invoked for.\n   * To match all Transitions, use an empty criteria object `{}`.\n   *\n   * ### Lifecycle\n   *\n   * The `onError` hooks are chained off the Transition's promise (see [[Transition.promise]]).\n   * If a Transition fails, its promise is rejected and the `onError` hooks are invoked.\n   * The `onError` hooks are invoked in priority order.\n   *\n   * Since these hooks are run after the transition is over, their return value is ignored.\n   *\n   * A transition \"errors\" if it was started, but failed to complete (for any reason).\n   * A *non-exhaustive list* of reasons a transition can error:\n   *\n   * - A transition was cancelled because a new transition started while it was still running (`Transition superseded`)\n   * - A transition was cancelled by a Transition Hook returning false\n   * - A transition was redirected by a Transition Hook returning a [[TargetState]]\n   * - A Transition Hook or resolve function threw an error\n   * - A Transition Hook returned a rejected promise\n   * - A resolve function returned a rejected promise\n   *\n   * To check the failure reason, inspect the return value of [[Transition.error]].\n   *\n   * Note: `onError` should be used for targeted error handling, or error recovery.\n   * For simple catch-all error reporting, use [[StateService.defaultErrorHandler]].\n   *\n   * ### Return value\n   *\n   * Since the Transition is already completed, the hook's return value is ignored\n   *\n   * @param matchCriteria defines which Transitions the Hook should be invoked for.\n   * @param callback the hook function which will be injected and invoked.\n   * @returns a function which deregisters the hook.\n   */\n  onError(matchCriteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function;\n\n  /**\n   * Returns all the registered hooks of a given `hookName` type\n   *\n   * #### Example:\n   * ```\n   * $transitions.getHooks(\"onEnter\")\n   * ```\n   */\n  getHooks(hookName: string): RegisteredHook[];\n}\n\n/** A predicate type which tests if a [[StateObject]] and [[Transition]] passes some test. Returns a boolean. */\nexport type IStateMatch = PredicateBinary<StateObject, Transition>;\n\n/**\n * This object is used to configure whether or not a Transition Hook is invoked for a particular transition,\n * based on the Transition's \"to state\" and \"from state\".\n *\n * Each property (`to`, `from`, `exiting`, `retained`, and `entering`) can be a state [[Glob]] string,\n * a boolean, or a function that takes a state and returns a boolean (see [[HookMatchCriterion]])\n *\n * All properties are optional.  If any property is omitted, it is replaced with the value `true`, and always matches.\n * To match any transition, use an empty criteria object `{}`.\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from the `parent` state and going to the `parent.child` state.\n * var match = {\n *   to: 'parent',\n *   from: 'parent.child'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any substate of `parent` and going directly to the `parent` state.\n * var match = {\n *   to: 'parent',\n *   from: 'parent.**'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any state and going to any substate of `mymodule`\n * var match = {\n *   to: 'mymodule.**'\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition coming from any state and going to any state that has `data.authRequired`\n * // set to a truthy value.\n * var match = {\n *   to: function(state) {\n *     return state.data != null && state.data.authRequired === true;\n *   }\n * }\n * ```\n * #### Example:\n * ```js\n * // This will match when route is just entered (initial load) or when the state is hard-refreshed\n * // by specifying `{refresh: true}` as transition options.\n * var match = {\n *   from: (state, transition) => state.self.name === '' || transition.options().reload\n * }\n * ```\n *\n * #### Example:\n * ```js\n * // This matches a transition that is exiting `parent.child`\n * var match = {\n *   exiting: 'parent.child'\n * }\n * ```\n */\nexport interface HookMatchCriteria {\n  [key: string]: HookMatchCriterion | undefined;\n\n  /** A [[HookMatchCriterion]] to match the destination state */\n  to?: HookMatchCriterion;\n  /** A [[HookMatchCriterion]] to match the original (from) state */\n  from?: HookMatchCriterion;\n  /** A [[HookMatchCriterion]] to match any state that would be exiting */\n  exiting?: HookMatchCriterion;\n  /** A [[HookMatchCriterion]] to match any state that would be retained */\n  retained?: HookMatchCriterion;\n  /** A [[HookMatchCriterion]] to match any state that would be entering */\n  entering?: HookMatchCriterion;\n}\n\nexport interface IMatchingNodes {\n  [key: string]: PathNode[];\n\n  to: PathNode[];\n  from: PathNode[];\n  exiting: PathNode[];\n  retained: PathNode[];\n  entering: PathNode[];\n}\n\n/** @hidden */\nexport interface RegisteredHooks {\n  [key: string]: RegisteredHook[];\n}\n\n/** @hidden */\nexport interface PathTypes {\n  [key: string]: PathType;\n\n  to: PathType;\n  from: PathType;\n  exiting: PathType;\n  retained: PathType;\n  entering: PathType;\n}\n\n/** @hidden */\nexport interface PathType {\n  name: string;\n  scope: TransitionHookScope;\n}\n\n/**\n * Hook Criterion used to match a transition.\n *\n * A [[Glob]] string that matches the name of a state.\n *\n * Or, a function with the signature `function(state, transition) { return matches; }`\n * which should return a boolean to indicate if a state matches.\n *\n * Or, `true` to always match\n */\nexport type HookMatchCriterion = string | IStateMatch | boolean;\n\nenum TransitionHookPhase {\n  CREATE,\n  BEFORE,\n  RUN,\n  SUCCESS,\n  ERROR,\n}\nenum TransitionHookScope {\n  TRANSITION,\n  STATE,\n}\n\nexport { TransitionHookPhase, TransitionHookScope };\n",
    "/** @publicapi @module transition */ /** */\nimport { TransitionHookOptions, HookResult, TransitionHookPhase } from './interface';\nimport { defaults, noop, silentRejection } from '../common/common';\nimport { fnToString, maxLength } from '../common/strings';\nimport { isPromise } from '../common/predicates';\nimport { is, parse } from '../common/hof';\nimport { trace } from '../common/trace';\nimport { services } from '../common/coreservices';\nimport { Rejection } from './rejectFactory';\nimport { TargetState } from '../state/targetState';\nimport { Transition } from './transition';\nimport { TransitionEventType } from './transitionEventType';\nimport { RegisteredHook } from './hookRegistry';\nimport { StateDeclaration } from '../state/interface';\n\nconst defaultOptions: TransitionHookOptions = {\n  current: noop,\n  transition: null,\n  traceData: {},\n  bind: null,\n};\n\nexport type GetResultHandler = (hook: TransitionHook) => ResultHandler;\nexport type GetErrorHandler = (hook: TransitionHook) => ErrorHandler;\n\nexport type ResultHandler = (result: HookResult) => Promise<HookResult>;\nexport type ErrorHandler = (error: any) => Promise<any>;\n\n/** @hidden */\nexport class TransitionHook {\n  type: TransitionEventType;\n\n  /**\n   * These GetResultHandler(s) are used by [[invokeHook]] below\n   * Each HookType chooses a GetResultHandler (See: [[TransitionService._defineCoreEvents]])\n   */\n  static HANDLE_RESULT: GetResultHandler = (hook: TransitionHook) => (result: HookResult) =>\n    hook.handleHookResult(result);\n\n  /**\n   * If the result is a promise rejection, log it.\n   * Otherwise, ignore the result.\n   */\n  static LOG_REJECTED_RESULT: GetResultHandler = (hook: TransitionHook) => (result: HookResult) => {\n    isPromise(result) && result.catch(err => hook.logError(Rejection.normalize(err)));\n    return undefined;\n  };\n\n  /**\n   * These GetErrorHandler(s) are used by [[invokeHook]] below\n   * Each HookType chooses a GetErrorHandler (See: [[TransitionService._defineCoreEvents]])\n   */\n  static LOG_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) => hook.logError(error);\n\n  static REJECT_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) => silentRejection(error);\n\n  static THROW_ERROR: GetErrorHandler = (hook: TransitionHook) => (error: any) => {\n    throw error;\n  };\n\n  /**\n   * Chains together an array of TransitionHooks.\n   *\n   * Given a list of [[TransitionHook]] objects, chains them together.\n   * Each hook is invoked after the previous one completes.\n   *\n   * #### Example:\n   * ```js\n   * var hooks: TransitionHook[] = getHooks();\n   * let promise: Promise<any> = TransitionHook.chain(hooks);\n   *\n   * promise.then(handleSuccess, handleError);\n   * ```\n   *\n   * @param hooks the list of hooks to chain together\n   * @param waitFor if provided, the chain is `.then()`'ed off this promise\n   * @returns a `Promise` for sequentially invoking the hooks (in order)\n   */\n  static chain(hooks: TransitionHook[], waitFor?: Promise<any>): Promise<any> {\n    // Chain the next hook off the previous\n    const createHookChainR = (prev: Promise<any>, nextHook: TransitionHook) => prev.then(() => nextHook.invokeHook());\n    return hooks.reduce(createHookChainR, waitFor || services.$q.when());\n  }\n\n  /**\n   * Invokes all the provided TransitionHooks, in order.\n   * Each hook's return value is checked.\n   * If any hook returns a promise, then the rest of the hooks are chained off that promise, and the promise is returned.\n   * If no hook returns a promise, then all hooks are processed synchronously.\n   *\n   * @param hooks the list of TransitionHooks to invoke\n   * @param doneCallback a callback that is invoked after all the hooks have successfully completed\n   *\n   * @returns a promise for the async result, or the result of the callback\n   */\n  static invokeHooks<T>(hooks: TransitionHook[], doneCallback: (result?: HookResult) => T): Promise<any> | T {\n    for (let idx = 0; idx < hooks.length; idx++) {\n      const hookResult = hooks[idx].invokeHook();\n\n      if (isPromise(hookResult)) {\n        const remainingHooks = hooks.slice(idx + 1);\n\n        return TransitionHook.chain(remainingHooks, hookResult).then(doneCallback);\n      }\n    }\n\n    return doneCallback();\n  }\n\n  /**\n   * Run all TransitionHooks, ignoring their return value.\n   */\n  static runAllHooks(hooks: TransitionHook[]): void {\n    hooks.forEach(hook => hook.invokeHook());\n  }\n\n  constructor(\n    private transition: Transition,\n    private stateContext: StateDeclaration,\n    private registeredHook: RegisteredHook,\n    private options: TransitionHookOptions\n  ) {\n    this.options = defaults(options, defaultOptions);\n    this.type = registeredHook.eventType;\n  }\n\n  private isSuperseded = () => this.type.hookPhase === TransitionHookPhase.RUN && !this.options.transition.isActive();\n\n  logError(err): any {\n    this.transition.router.stateService.defaultErrorHandler()(err);\n  }\n\n  invokeHook(): Promise<HookResult> | void {\n    const hook = this.registeredHook;\n    if (hook._deregistered) return;\n\n    const notCurrent = this.getNotCurrentRejection();\n    if (notCurrent) return notCurrent;\n\n    const options = this.options;\n    trace.traceHookInvocation(this, this.transition, options);\n\n    const invokeCallback = () => hook.callback.call(options.bind, this.transition, this.stateContext);\n\n    const normalizeErr = err => Rejection.normalize(err).toPromise();\n\n    const handleError = err => hook.eventType.getErrorHandler(this)(err);\n\n    const handleResult = result => hook.eventType.getResultHandler(this)(result);\n\n    try {\n      const result = invokeCallback();\n\n      if (!this.type.synchronous && isPromise(result)) {\n        return result.catch(normalizeErr).then(handleResult, handleError);\n      } else {\n        return handleResult(result);\n      }\n    } catch (err) {\n      // If callback throws (synchronously)\n      return handleError(Rejection.normalize(err));\n    } finally {\n      if (hook.invokeLimit && ++hook.invokeCount >= hook.invokeLimit) {\n        hook.deregister();\n      }\n    }\n  }\n\n  /**\n   * This method handles the return value of a Transition Hook.\n   *\n   * A hook can return false (cancel), a TargetState (redirect),\n   * or a promise (which may later resolve to false or a redirect)\n   *\n   * This also handles \"transition superseded\" -- when a new transition\n   * was started while the hook was still running\n   */\n  handleHookResult(result: HookResult): Promise<HookResult> {\n    const notCurrent = this.getNotCurrentRejection();\n    if (notCurrent) return notCurrent;\n\n    // Hook returned a promise\n    if (isPromise(result)) {\n      // Wait for the promise, then reprocess with the resulting value\n      return result.then(val => this.handleHookResult(val));\n    }\n\n    trace.traceHookResult(result, this.transition, this.options);\n\n    // Hook returned false\n    if (result === false) {\n      // Abort this Transition\n      return Rejection.aborted('Hook aborted transition').toPromise();\n    }\n\n    const isTargetState = is(TargetState);\n    // hook returned a TargetState\n    if (isTargetState(result)) {\n      // Halt the current Transition and redirect (a new Transition) to the TargetState.\n      return Rejection.redirected(result).toPromise();\n    }\n  }\n\n  /**\n   * Return a Rejection promise if the transition is no longer current due\n   * to a stopped router (disposed), or a new transition has started and superseded this one.\n   */\n  private getNotCurrentRejection() {\n    const router = this.transition.router;\n\n    // The router is stopped\n    if (router._disposed) {\n      return Rejection.aborted(`UIRouter instance #${router.$id} has been stopped (disposed)`).toPromise();\n    }\n\n    if (this.transition._aborted) {\n      return Rejection.aborted().toPromise();\n    }\n\n    // This transition is no longer current.\n    // Another transition started while this hook was still running.\n    if (this.isSuperseded()) {\n      // Abort this transition\n      return Rejection.superseded(this.options.current()).toPromise();\n    }\n  }\n\n  toString() {\n    const { options, registeredHook } = this;\n    const event = parse('traceData.hookType')(options) || 'internal',\n      context = parse('traceData.context.state.name')(options) || parse('traceData.context')(options) || 'unknown',\n      name = fnToString(registeredHook.callback);\n    return `${event} context: ${context}, ${maxLength(200, name)}`;\n  }\n}\n",
    "/** @publicapi @module transition */ /** */\nimport { isString, isFunction, Glob, extend, removeFrom, tail, values, identity, mapObj } from '../common';\nimport { PathNode } from '../path/pathNode';\nimport {\n  TransitionStateHookFn,\n  TransitionHookFn,\n  TransitionHookPhase, // has or is using\n  TransitionHookScope,\n  IHookRegistry,\n  PathType,\n} from './interface';\n\nimport {\n  HookRegOptions,\n  HookMatchCriteria,\n  TreeChanges,\n  HookMatchCriterion,\n  IMatchingNodes,\n  HookFn,\n} from './interface';\nimport { Transition } from './transition';\nimport { StateObject } from '../state/stateObject';\nimport { TransitionEventType } from './transitionEventType';\nimport { TransitionService } from './transitionService';\n\n/**\n * Determines if the given state matches the matchCriteria\n *\n * @hidden\n *\n * @param state a State Object to test against\n * @param criterion\n * - If a string, matchState uses the string as a glob-matcher against the state name\n * - If an array (of strings), matchState uses each string in the array as a glob-matchers against the state name\n *   and returns a positive match if any of the globs match.\n * - If a function, matchState calls the function with the state and returns true if the function's result is truthy.\n * @returns {boolean}\n */\nexport function matchState(state: StateObject, criterion: HookMatchCriterion, transition: Transition) {\n  const toMatch = isString(criterion) ? [criterion] : criterion;\n\n  function matchGlobs(_state: StateObject) {\n    const globStrings = <string[]>toMatch;\n    for (let i = 0; i < globStrings.length; i++) {\n      const glob = new Glob(globStrings[i]);\n\n      if ((glob && glob.matches(_state.name)) || (!glob && globStrings[i] === _state.name)) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  const matchFn = <any>(isFunction(toMatch) ? toMatch : matchGlobs);\n  return !!matchFn(state, transition);\n}\n\n/**\n * @internalapi\n * The registration data for a registered transition hook\n */\nexport class RegisteredHook {\n  priority: number;\n  bind: any;\n  invokeCount = 0;\n  invokeLimit: number;\n  _deregistered = false;\n\n  constructor(\n    public tranSvc: TransitionService,\n    public eventType: TransitionEventType,\n    public callback: HookFn,\n    public matchCriteria: HookMatchCriteria,\n    public removeHookFromRegistry: (hook: RegisteredHook) => void,\n    options: HookRegOptions = {} as any\n  ) {\n    this.priority = options.priority || 0;\n    this.bind = options.bind || null;\n    this.invokeLimit = options.invokeLimit;\n  }\n\n  /**\n   * Gets the matching [[PathNode]]s\n   *\n   * Given an array of [[PathNode]]s, and a [[HookMatchCriterion]], returns an array containing\n   * the [[PathNode]]s that the criteria matches, or `null` if there were no matching nodes.\n   *\n   * Returning `null` is significant to distinguish between the default\n   * \"match-all criterion value\" of `true` compared to a `() => true` function,\n   * when the nodes is an empty array.\n   *\n   * This is useful to allow a transition match criteria of `entering: true`\n   * to still match a transition, even when `entering === []`.  Contrast that\n   * with `entering: (state) => true` which only matches when a state is actually\n   * being entered.\n   */\n  private _matchingNodes(nodes: PathNode[], criterion: HookMatchCriterion, transition: Transition): PathNode[] {\n    if (criterion === true) return nodes;\n    const matching = nodes.filter(node => matchState(node.state, criterion, transition));\n    return matching.length ? matching : null;\n  }\n\n  /**\n   * Gets the default match criteria (all `true`)\n   *\n   * Returns an object which has all the criteria match paths as keys and `true` as values, i.e.:\n   *\n   * ```js\n   * {\n   *   to: true,\n   *   from: true,\n   *   entering: true,\n   *   exiting: true,\n   *   retained: true,\n   * }\n   */\n  private _getDefaultMatchCriteria(): HookMatchCriteria {\n    return mapObj(this.tranSvc._pluginapi._getPathTypes(), () => true);\n  }\n\n  /**\n   * Gets matching nodes as [[IMatchingNodes]]\n   *\n   * Create a IMatchingNodes object from the TransitionHookTypes that is roughly equivalent to:\n   *\n   * ```js\n   * let matches: IMatchingNodes = {\n   *   to:       _matchingNodes([tail(treeChanges.to)],   mc.to),\n   *   from:     _matchingNodes([tail(treeChanges.from)], mc.from),\n   *   exiting:  _matchingNodes(treeChanges.exiting,      mc.exiting),\n   *   retained: _matchingNodes(treeChanges.retained,     mc.retained),\n   *   entering: _matchingNodes(treeChanges.entering,     mc.entering),\n   * };\n   * ```\n   */\n  private _getMatchingNodes(treeChanges: TreeChanges, transition: Transition): IMatchingNodes {\n    const criteria = extend(this._getDefaultMatchCriteria(), this.matchCriteria);\n    const paths: PathType[] = values(this.tranSvc._pluginapi._getPathTypes());\n\n    return paths.reduce(\n      (mn: IMatchingNodes, pathtype: PathType) => {\n        // STATE scope criteria matches against every node in the path.\n        // TRANSITION scope criteria matches against only the last node in the path\n        const isStateHook = pathtype.scope === TransitionHookScope.STATE;\n        const path = treeChanges[pathtype.name] || [];\n        const nodes: PathNode[] = isStateHook ? path : [tail(path)];\n\n        mn[pathtype.name] = this._matchingNodes(nodes, criteria[pathtype.name], transition);\n        return mn;\n      },\n      {} as IMatchingNodes\n    );\n  }\n\n  /**\n   * Determines if this hook's [[matchCriteria]] match the given [[TreeChanges]]\n   *\n   * @returns an IMatchingNodes object, or null. If an IMatchingNodes object is returned, its values\n   * are the matching [[PathNode]]s for each [[HookMatchCriterion]] (to, from, exiting, retained, entering)\n   */\n  matches(treeChanges: TreeChanges, transition: Transition): IMatchingNodes {\n    const matches = this._getMatchingNodes(treeChanges, transition);\n\n    // Check if all the criteria matched the TreeChanges object\n    const allMatched = values(matches).every(identity);\n    return allMatched ? matches : null;\n  }\n\n  deregister() {\n    this.removeHookFromRegistry(this);\n    this._deregistered = true;\n  }\n}\n\n/** @hidden Return a registration function of the requested type. */\nexport function makeEvent(\n  registry: IHookRegistry,\n  transitionService: TransitionService,\n  eventType: TransitionEventType\n) {\n  // Create the object which holds the registered transition hooks.\n  const _registeredHooks = (registry._registeredHooks = registry._registeredHooks || {});\n  const hooks = (_registeredHooks[eventType.name] = []);\n  const removeHookFn: (hook: RegisteredHook) => void = removeFrom(hooks);\n\n  // Create hook registration function on the IHookRegistry for the event\n  registry[eventType.name] = hookRegistrationFn;\n\n  function hookRegistrationFn(matchObject, callback, options = {}) {\n    const registeredHook = new RegisteredHook(\n      transitionService,\n      eventType,\n      callback,\n      matchObject,\n      removeHookFn,\n      options\n    );\n    hooks.push(registeredHook);\n    return registeredHook.deregister.bind(registeredHook);\n  }\n\n  return hookRegistrationFn;\n}\n",
    "/** @publicapi @module transition */ /** */\nimport { extend, tail, assertPredicate, unnestR, identity } from '../common/common';\nimport { isArray } from '../common/predicates';\n\nimport {\n  TransitionOptions,\n  TransitionHookOptions,\n  IHookRegistry,\n  TreeChanges,\n  IMatchingNodes,\n  TransitionHookPhase,\n  TransitionHookScope,\n} from './interface';\n\nimport { Transition } from './transition';\nimport { TransitionHook } from './transitionHook';\nimport { StateObject } from '../state/stateObject';\nimport { PathNode } from '../path/pathNode';\nimport { TransitionService } from './transitionService';\nimport { TransitionEventType } from './transitionEventType';\nimport { RegisteredHook } from './hookRegistry';\n\n/**\n * This class returns applicable TransitionHooks for a specific Transition instance.\n *\n * Hooks ([[RegisteredHook]]) may be registered globally, e.g., $transitions.onEnter(...), or locally, e.g.\n * myTransition.onEnter(...).  The HookBuilder finds matching RegisteredHooks (where the match criteria is\n * determined by the type of hook)\n *\n * The HookBuilder also converts RegisteredHooks objects to TransitionHook objects, which are used to run a Transition.\n *\n * The HookBuilder constructor is given the $transitions service and a Transition instance.  Thus, a HookBuilder\n * instance may only be used for one specific Transition object. (side note: the _treeChanges accessor is private\n * in the Transition class, so we must also provide the Transition's _treeChanges)\n *\n */\nexport class HookBuilder {\n  constructor(private transition: Transition) {}\n\n  buildHooksForPhase(phase: TransitionHookPhase): TransitionHook[] {\n    const $transitions = this.transition.router.transitionService;\n    return $transitions._pluginapi\n      ._getEvents(phase)\n      .map(type => this.buildHooks(type))\n      .reduce(unnestR, [])\n      .filter(identity);\n  }\n\n  /**\n   * Returns an array of newly built TransitionHook objects.\n   *\n   * - Finds all RegisteredHooks registered for the given `hookType` which matched the transition's [[TreeChanges]].\n   * - Finds [[PathNode]] (or `PathNode[]`) to use as the TransitionHook context(s)\n   * - For each of the [[PathNode]]s, creates a TransitionHook\n   *\n   * @param hookType the type of the hook registration function, e.g., 'onEnter', 'onFinish'.\n   */\n  buildHooks(hookType: TransitionEventType): TransitionHook[] {\n    const transition = this.transition;\n    const treeChanges = transition.treeChanges();\n\n    // Find all the matching registered hooks for a given hook type\n    const matchingHooks = this.getMatchingHooks(hookType, treeChanges, transition);\n    if (!matchingHooks) return [];\n\n    const baseHookOptions = <TransitionHookOptions>{\n      transition: transition,\n      current: transition.options().current,\n    };\n\n    const makeTransitionHooks = (hook: RegisteredHook) => {\n      // Fetch the Nodes that caused this hook to match.\n      const matches: IMatchingNodes = hook.matches(treeChanges, transition);\n      // Select the PathNode[] that will be used as TransitionHook context objects\n      const matchingNodes: PathNode[] = matches[hookType.criteriaMatchPath.name];\n\n      // Return an array of HookTuples\n      return matchingNodes.map(node => {\n        const _options = extend(\n          {\n            bind: hook.bind,\n            traceData: { hookType: hookType.name, context: node },\n          },\n          baseHookOptions\n        );\n\n        const state = hookType.criteriaMatchPath.scope === TransitionHookScope.STATE ? node.state.self : null;\n        const transitionHook = new TransitionHook(transition, state, hook, _options);\n        return <HookTuple>{ hook, node, transitionHook };\n      });\n    };\n\n    return matchingHooks\n      .map(makeTransitionHooks)\n      .reduce(unnestR, [])\n      .sort(tupleSort(hookType.reverseSort))\n      .map(tuple => tuple.transitionHook);\n  }\n\n  /**\n   * Finds all RegisteredHooks from:\n   * - The Transition object instance hook registry\n   * - The TransitionService ($transitions) global hook registry\n   *\n   * which matched:\n   * - the eventType\n   * - the matchCriteria (to, from, exiting, retained, entering)\n   *\n   * @returns an array of matched [[RegisteredHook]]s\n   */\n  public getMatchingHooks(\n    hookType: TransitionEventType,\n    treeChanges: TreeChanges,\n    transition: Transition\n  ): RegisteredHook[] {\n    const isCreate = hookType.hookPhase === TransitionHookPhase.CREATE;\n\n    // Instance and Global hook registries\n    const $transitions = this.transition.router.transitionService;\n    const registries = isCreate ? [$transitions] : [this.transition, $transitions];\n\n    return registries\n      .map((reg: IHookRegistry) => reg.getHooks(hookType.name)) // Get named hooks from registries\n      .filter(assertPredicate(isArray, `broken event named: ${hookType.name}`)) // Sanity check\n      .reduce(unnestR, []) // Un-nest RegisteredHook[][] to RegisteredHook[] array\n      .filter(hook => hook.matches(treeChanges, transition)); // Only those satisfying matchCriteria\n  }\n}\n\ninterface HookTuple {\n  hook: RegisteredHook;\n  node: PathNode;\n  transitionHook: TransitionHook;\n}\n\n/**\n * A factory for a sort function for HookTuples.\n *\n * The sort function first compares the PathNode depth (how deep in the state tree a node is), then compares\n * the EventHook priority.\n *\n * @param reverseDepthSort a boolean, when true, reverses the sort order for the node depth\n * @returns a tuple sort function\n */\nfunction tupleSort(reverseDepthSort = false) {\n  return function nodeDepthThenPriority(l: HookTuple, r: HookTuple): number {\n    const factor = reverseDepthSort ? -1 : 1;\n    const depthDelta = (l.node.state.path.length - r.node.state.path.length) * factor;\n    return depthDelta !== 0 ? depthDelta : r.hook.priority - l.hook.priority;\n  };\n}\n",
    "/** @publicapi @module transition */ /** */\nimport { trace } from '../common/trace';\nimport { services } from '../common/coreservices';\nimport { stringify } from '../common/strings';\nimport { map, find, extend, mergeR, tail, omit, arrayTuples, unnestR, identity, anyTrueR } from '../common/common';\nimport { isObject, isUndefined } from '../common/predicates';\nimport { prop, propEq, val, not, is } from '../common/hof';\nimport { StateDeclaration, StateOrName } from '../state/interface';\nimport {\n  TransitionOptions,\n  TreeChanges,\n  IHookRegistry,\n  TransitionHookPhase,\n  RegisteredHooks,\n  HookRegOptions,\n  HookMatchCriteria,\n  TransitionStateHookFn,\n  TransitionHookFn,\n} from './interface'; // has or is using\nimport { TransitionHook } from './transitionHook';\nimport { matchState, makeEvent, RegisteredHook } from './hookRegistry';\nimport { HookBuilder } from './hookBuilder';\nimport { PathNode } from '../path/pathNode';\nimport { PathUtils } from '../path/pathUtils';\nimport { StateObject } from '../state/stateObject';\nimport { TargetState } from '../state/targetState';\nimport { Param } from '../params/param';\nimport { Resolvable } from '../resolve/resolvable';\nimport { ViewConfig } from '../view/interface';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { UIRouter } from '../router';\nimport { UIInjector } from '../interface';\nimport { RawParams } from '../params/interface';\nimport { ResolvableLiteral } from '../resolve/interface';\nimport { Rejection } from './rejectFactory';\nimport { applyPairs, flattenR, uniqR } from '../common';\n\n/** @hidden */\nconst stateSelf: (_state: StateObject) => StateDeclaration = prop('self');\n\n/**\n * Represents a transition between two states.\n *\n * When navigating to a state, we are transitioning **from** the current state **to** the new state.\n *\n * This object contains all contextual information about the to/from states, parameters, resolves.\n * It has information about all states being entered and exited as a result of the transition.\n */\nexport class Transition implements IHookRegistry {\n  /** @hidden */\n  static diToken = Transition;\n\n  /**\n   * A unique identifier for the transition.\n   *\n   * This is an auto incrementing integer, starting from `0`.\n   */\n  $id: number;\n\n  /**\n   * A reference to the [[UIRouter]] instance\n   *\n   * This reference can be used to access the router services, such as the [[StateService]]\n   */\n  router: UIRouter;\n\n  /** @hidden */\n  private _deferred = services.$q.defer();\n  /**\n   * This promise is resolved or rejected based on the outcome of the Transition.\n   *\n   * When the transition is successful, the promise is resolved\n   * When the transition is unsuccessful, the promise is rejected with the [[Rejection]] or javascript error\n   */\n  promise: Promise<any> = this._deferred.promise;\n  /**\n   * A boolean which indicates if the transition was successful\n   *\n   * After a successful transition, this value is set to true.\n   * After an unsuccessful transition, this value is set to false.\n   *\n   * The value will be undefined if the transition is not complete\n   */\n  success: boolean;\n  /** @hidden */\n  _aborted: boolean;\n  /** @hidden */\n  private _error: Rejection;\n\n  /** @hidden Holds the hook registration functions such as those passed to Transition.onStart() */\n  _registeredHooks: RegisteredHooks = {};\n\n  /** @hidden */\n  private _options: TransitionOptions;\n  /** @hidden */\n  private _treeChanges: TreeChanges;\n  /** @hidden */\n  private _targetState: TargetState;\n  /** @hidden */\n  private _hookBuilder = new HookBuilder(this);\n\n  /** @hidden */\n  onBefore(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function {\n    return;\n  }\n  /** @inheritdoc */\n  onStart(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function {\n    return;\n  }\n  /** @inheritdoc */\n  onExit(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function {\n    return;\n  }\n  /** @inheritdoc */\n  onRetain(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function {\n    return;\n  }\n  /** @inheritdoc */\n  onEnter(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function {\n    return;\n  }\n  /** @inheritdoc */\n  onFinish(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function {\n    return;\n  }\n  /** @inheritdoc */\n  onSuccess(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function {\n    return;\n  }\n  /** @inheritdoc */\n  onError(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function {\n    return;\n  }\n\n  /** @hidden\n   * Creates the transition-level hook registration functions\n   * (which can then be used to register hooks)\n   */\n  private createTransitionHookRegFns() {\n    this.router.transitionService._pluginapi\n      ._getEvents()\n      .filter(type => type.hookPhase !== TransitionHookPhase.CREATE)\n      .forEach(type => makeEvent(this, this.router.transitionService, type));\n  }\n\n  /** @internalapi */\n  getHooks(hookName: string): RegisteredHook[] {\n    return this._registeredHooks[hookName];\n  }\n\n  /**\n   * Creates a new Transition object.\n   *\n   * If the target state is not valid, an error is thrown.\n   *\n   * @internalapi\n   *\n   * @param fromPath The path of [[PathNode]]s from which the transition is leaving.  The last node in the `fromPath`\n   *        encapsulates the \"from state\".\n   * @param targetState The target state and parameters being transitioned to (also, the transition options)\n   * @param router The [[UIRouter]] instance\n   */\n  constructor(fromPath: PathNode[], targetState: TargetState, router: UIRouter) {\n    this.router = router;\n    this._targetState = targetState;\n\n    if (!targetState.valid()) {\n      throw new Error(targetState.error());\n    }\n\n    // current() is assumed to come from targetState.options, but provide a naive implementation otherwise.\n    this._options = extend({ current: val(this) }, targetState.options());\n    this.$id = router.transitionService._transitionCount++;\n    const toPath = PathUtils.buildToPath(fromPath, targetState);\n    this._treeChanges = PathUtils.treeChanges(fromPath, toPath, this._options.reloadState);\n    this.createTransitionHookRegFns();\n\n    const onCreateHooks = this._hookBuilder.buildHooksForPhase(TransitionHookPhase.CREATE);\n    TransitionHook.invokeHooks(onCreateHooks, () => null);\n\n    this.applyViewConfigs(router);\n  }\n\n  private applyViewConfigs(router: UIRouter) {\n    const enteringStates = this._treeChanges.entering.map(node => node.state);\n    PathUtils.applyViewConfigs(router.transitionService.$view, this._treeChanges.to, enteringStates);\n  }\n\n  /**\n   * @internalapi\n   *\n   * @returns the internal from [State] object\n   */\n  $from() {\n    return tail(this._treeChanges.from).state;\n  }\n\n  /**\n   * @internalapi\n   *\n   * @returns the internal to [State] object\n   */\n  $to() {\n    return tail(this._treeChanges.to).state;\n  }\n\n  /**\n   * Returns the \"from state\"\n   *\n   * Returns the state that the transition is coming *from*.\n   *\n   * @returns The state declaration object for the Transition's (\"from state\").\n   */\n  from(): StateDeclaration {\n    return this.$from().self;\n  }\n\n  /**\n   * Returns the \"to state\"\n   *\n   * Returns the state that the transition is going *to*.\n   *\n   * @returns The state declaration object for the Transition's target state (\"to state\").\n   */\n  to(): StateDeclaration {\n    return this.$to().self;\n  }\n\n  /**\n   * Gets the Target State\n   *\n   * A transition's [[TargetState]] encapsulates the [[to]] state, the [[params]], and the [[options]] as a single object.\n   *\n   * @returns the [[TargetState]] of this Transition\n   */\n  targetState() {\n    return this._targetState;\n  }\n\n  /**\n   * Determines whether two transitions are equivalent.\n   * @deprecated\n   */\n  is(compare: Transition | { to?: any; from?: any }): boolean {\n    if (compare instanceof Transition) {\n      // TODO: Also compare parameters\n      return this.is({ to: compare.$to().name, from: compare.$from().name });\n    }\n    return !(\n      (compare.to && !matchState(this.$to(), compare.to, this)) ||\n      (compare.from && !matchState(this.$from(), compare.from, this))\n    );\n  }\n\n  /**\n   * Gets transition parameter values\n   *\n   * Returns the parameter values for a transition as key/value pairs.\n   * This object is immutable.\n   *\n   * By default, returns the new parameter values (for the \"to state\").\n   *\n   * #### Example:\n   * ```js\n   * var toParams = transition.params();\n   * ```\n   *\n   * To return the previous parameter values,  supply `'from'` as the `pathname` argument.\n   *\n   * #### Example:\n   * ```js\n   * var fromParams = transition.params('from');\n   * ```\n   *\n   * @param pathname the name of the treeChanges path to get parameter values for:\n   *   (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n   *\n   * @returns transition parameter values for the desired path.\n   */\n  params(pathname?: string): { [paramName: string]: any };\n  params<T>(pathname?: string): T;\n  params(pathname = 'to') {\n    return Object.freeze(this._treeChanges[pathname].map(prop('paramValues')).reduce(mergeR, {}));\n  }\n\n  /**\n   * Gets the new values of any parameters that changed during this transition.\n   *\n   * Returns any parameter values that have changed during a transition, as key/value pairs.\n   *\n   * - Any parameter values that have changed will be present on the returned object reflecting the new value.\n   * - Any parameters that *not* have changed will not be present on the returned object.\n   * - Any new parameters that weren't present in the \"from\" state, but are now present in the \"to\" state will be present on the returned object.\n   * - Any previous parameters that are no longer present (because the \"to\" state doesn't have them) will be included with a value of `undefined`.\n   *\n   * The returned object is immutable.\n   *\n   * #### Examples:\n   *\n   * Given:\n   * ```js\n   * var stateA = { name: 'stateA', url: '/stateA/:param1/param2' }\n   * var stateB = { name: 'stateB', url: '/stateB/:param3' }\n   * var stateC = { name: 'stateB.nest', url: '/nest/:param4' }\n   * ```\n   *\n   * #### Example 1\n   *\n   * From `/stateA/abc/def` to `/stateA/abc/xyz`\n   *\n   * ```js\n   * var changed = transition.paramsChanged()\n   * // changed is { param2: 'xyz' }\n   * ```\n   *\n   * The value of `param2` changed to `xyz`.\n   * The value of `param1` stayed the same so its value is not present.\n   *\n   * #### Example 2\n   *\n   * From `/stateA/abc/def` to `/stateB/123`\n   *\n   * ```js\n   * var changed = transition.paramsChanged()\n   * // changed is { param1: undefined, param2: undefined, param3: '123' }\n   * ```\n   *\n   * The value `param3` is present because it is a new param.\n   * Both `param1` and `param2` are no longer present so their value is undefined.\n   *\n   * #### Example 3\n   *\n   * From `/stateB/123` to `/stateB/123/nest/456`\n   *\n   * ```js\n   * var changed = transition.paramsChanged()\n   * // changed is { param4: '456' }\n   * ```\n   *\n   * The value `param4` is present because it is a new param.\n   * The value of `param3` did not change, so its value is not present.\n   *\n   * @returns an immutable object with changed parameter keys/values.\n   */\n  paramsChanged(): { [paramName: string]: any };\n  paramsChanged<T>(): T;\n  paramsChanged() {\n    const fromParams = this.params('from');\n    const toParams = this.params('to');\n\n    // All the parameters declared on both the \"to\" and \"from\" paths\n    const allParamDescriptors: Param[] = []\n      .concat(this._treeChanges.to)\n      .concat(this._treeChanges.from)\n      .map(pathNode => pathNode.paramSchema)\n      .reduce(flattenR, [])\n      .reduce(uniqR, []);\n\n    const changedParamDescriptors = Param.changed(allParamDescriptors, fromParams, toParams);\n\n    return changedParamDescriptors.reduce((changedValues, descriptor) => {\n      changedValues[descriptor.id] = toParams[descriptor.id];\n      return changedValues;\n    }, {});\n  }\n\n  /**\n   * Creates a [[UIInjector]] Dependency Injector\n   *\n   * Returns a Dependency Injector for the Transition's target state (to state).\n   * The injector provides resolve values which the target state has access to.\n   *\n   * The `UIInjector` can also provide values from the native root/global injector (ng1/ng2).\n   *\n   * #### Example:\n   * ```js\n   * .onEnter({ entering: 'myState' }, trans => {\n   *   var myResolveValue = trans.injector().get('myResolve');\n   *   // Inject a global service from the global/native injector (if it exists)\n   *   var MyService = trans.injector().get('MyService');\n   * })\n   * ```\n   *\n   * In some cases (such as `onBefore`), you may need access to some resolve data but it has not yet been fetched.\n   * You can use [[UIInjector.getAsync]] to get a promise for the data.\n   * #### Example:\n   * ```js\n   * .onBefore({}, trans => {\n   *   return trans.injector().getAsync('myResolve').then(myResolveValue =>\n   *     return myResolveValue !== 'ABORT';\n   *   });\n   * });\n   * ```\n   *\n   * If a `state` is provided, the injector that is returned will be limited to resolve values that the provided state has access to.\n   * This can be useful if both a parent state `foo` and a child state `foo.bar` have both defined a resolve such as `data`.\n   * #### Example:\n   * ```js\n   * .onEnter({ to: 'foo.bar' }, trans => {\n   *   // returns result of `foo` state's `myResolve` resolve\n   *   // even though `foo.bar` also has a `myResolve` resolve\n   *   var fooData = trans.injector('foo').get('myResolve');\n   * });\n   * ```\n   *\n   * If you need resolve data from the exiting states, pass `'from'` as `pathName`.\n   * The resolve data from the `from` path will be returned.\n   * #### Example:\n   * ```js\n   * .onExit({ exiting: 'foo.bar' }, trans => {\n   *   // Gets the resolve value of `myResolve` from the state being exited\n   *   var fooData = trans.injector(null, 'from').get('myResolve');\n   * });\n   * ```\n   *\n   *\n   * @param state Limits the resolves provided to only the resolves the provided state has access to.\n   * @param pathName Default: `'to'`: Chooses the path for which to create the injector. Use this to access resolves for `exiting` states.\n   *\n   * @returns a [[UIInjector]]\n   */\n  injector(state?: StateOrName, pathName = 'to'): UIInjector {\n    let path: PathNode[] = this._treeChanges[pathName];\n    if (state) path = PathUtils.subPath(path, node => node.state === state || node.state.name === state);\n    return new ResolveContext(path).injector();\n  }\n\n  /**\n   * Gets all available resolve tokens (keys)\n   *\n   * This method can be used in conjunction with [[injector]] to inspect the resolve values\n   * available to the Transition.\n   *\n   * This returns all the tokens defined on [[StateDeclaration.resolve]] blocks, for the states\n   * in the Transition's [[TreeChanges.to]] path.\n   *\n   * #### Example:\n   * This example logs all resolve values\n   * ```js\n   * let tokens = trans.getResolveTokens();\n   * tokens.forEach(token => console.log(token + \" = \" + trans.injector().get(token)));\n   * ```\n   *\n   * #### Example:\n   * This example creates promises for each resolve value.\n   * This triggers fetches of resolves (if any have not yet been fetched).\n   * When all promises have all settled, it logs the resolve values.\n   * ```js\n   * let tokens = trans.getResolveTokens();\n   * let promise = tokens.map(token => trans.injector().getAsync(token));\n   * Promise.all(promises).then(values => console.log(\"Resolved values: \" + values));\n   * ```\n   *\n   * Note: Angular 1 users whould use `$q.all()`\n   *\n   * @param pathname resolve context's path name (e.g., `to` or `from`)\n   *\n   * @returns an array of resolve tokens (keys)\n   */\n  getResolveTokens(pathname = 'to'): any[] {\n    return new ResolveContext(this._treeChanges[pathname]).getTokens();\n  }\n\n  /**\n   * Dynamically adds a new [[Resolvable]] (i.e., [[StateDeclaration.resolve]]) to this transition.\n   *\n   * Allows a transition hook to dynamically add a Resolvable to this Transition.\n   *\n   * Use the [[Transition.injector]] to retrieve the resolved data in subsequent hooks ([[UIInjector.get]]).\n   *\n   * If a `state` argument is provided, the Resolvable is processed when that state is being entered.\n   * If no `state` is provided then the root state is used.\n   * If the given `state` has already been entered, the Resolvable is processed when any child state is entered.\n   * If no child states will be entered, the Resolvable is processed during the `onFinish` phase of the Transition.\n   *\n   * The `state` argument also scopes the resolved data.\n   * The resolved data is available from the injector for that `state` and any children states.\n   *\n   * #### Example:\n   * ```js\n   * transitionService.onBefore({}, transition => {\n   *   transition.addResolvable({\n   *     token: 'myResolve',\n   *     deps: ['MyService'],\n   *     resolveFn: myService => myService.getData()\n   *   });\n   * });\n   * ```\n   *\n   * @param resolvable a [[ResolvableLiteral]] object (or a [[Resolvable]])\n   * @param state the state in the \"to path\" which should receive the new resolve (otherwise, the root state)\n   */\n  addResolvable(resolvable: Resolvable | ResolvableLiteral, state: StateOrName = ''): void {\n    resolvable = is(Resolvable)(resolvable) ? resolvable : new Resolvable(resolvable);\n\n    const stateName: string = typeof state === 'string' ? state : state.name;\n    const topath = this._treeChanges.to;\n    const targetNode = find(topath, node => node.state.name === stateName);\n    const resolveContext: ResolveContext = new ResolveContext(topath);\n    resolveContext.addResolvables([resolvable as Resolvable], targetNode.state);\n  }\n\n  /**\n   * Gets the transition from which this transition was redirected.\n   *\n   * If the current transition is a redirect, this method returns the transition that was redirected.\n   *\n   * #### Example:\n   * ```js\n   * let transitionA = $state.go('A').transition\n   * transitionA.onStart({}, () => $state.target('B'));\n   * $transitions.onSuccess({ to: 'B' }, (trans) => {\n   *   trans.to().name === 'B'; // true\n   *   trans.redirectedFrom() === transitionA; // true\n   * });\n   * ```\n   *\n   * @returns The previous Transition, or null if this Transition is not the result of a redirection\n   */\n  redirectedFrom(): Transition {\n    return this._options.redirectedFrom || null;\n  }\n\n  /**\n   * Gets the original transition in a redirect chain\n   *\n   * A transition might belong to a long chain of multiple redirects.\n   * This method walks the [[redirectedFrom]] chain back to the original (first) transition in the chain.\n   *\n   * #### Example:\n   * ```js\n   * // states\n   * registry.register({ name: 'A', redirectTo: 'B' });\n   * registry.register({ name: 'B', redirectTo: 'C' });\n   * registry.register({ name: 'C', redirectTo: 'D' });\n   * registry.register({ name: 'D' });\n   *\n   * let transitionA = $state.go('A').transition\n   *\n   * $transitions.onSuccess({ to: 'D' }, (trans) => {\n   *   trans.to().name === 'D'; // true\n   *   trans.redirectedFrom().to().name === 'C'; // true\n   *   trans.originalTransition() === transitionA; // true\n   *   trans.originalTransition().to().name === 'A'; // true\n   * });\n   * ```\n   *\n   * @returns The original Transition that started a redirect chain\n   */\n  originalTransition(): Transition {\n    const rf = this.redirectedFrom();\n    return (rf && rf.originalTransition()) || this;\n  }\n\n  /**\n   * Get the transition options\n   *\n   * @returns the options for this Transition.\n   */\n  options(): TransitionOptions {\n    return this._options;\n  }\n\n  /**\n   * Gets the states being entered.\n   *\n   * @returns an array of states that will be entered during this transition.\n   */\n  entering(): StateDeclaration[] {\n    return map(this._treeChanges.entering, prop('state')).map(stateSelf);\n  }\n\n  /**\n   * Gets the states being exited.\n   *\n   * @returns an array of states that will be exited during this transition.\n   */\n  exiting(): StateDeclaration[] {\n    return map(this._treeChanges.exiting, prop('state'))\n      .map(stateSelf)\n      .reverse();\n  }\n\n  /**\n   * Gets the states being retained.\n   *\n   * @returns an array of states that are already entered from a previous Transition, that will not be\n   *    exited during this Transition\n   */\n  retained(): StateDeclaration[] {\n    return map(this._treeChanges.retained, prop('state')).map(stateSelf);\n  }\n\n  /**\n   * Get the [[ViewConfig]]s associated with this Transition\n   *\n   * Each state can define one or more views (template/controller), which are encapsulated as `ViewConfig` objects.\n   * This method fetches the `ViewConfigs` for a given path in the Transition (e.g., \"to\" or \"entering\").\n   *\n   * @param pathname the name of the path to fetch views for:\n   *   (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n   * @param state If provided, only returns the `ViewConfig`s for a single state in the path\n   *\n   * @returns a list of ViewConfig objects for the given path.\n   */\n  views(pathname = 'entering', state?: StateObject): ViewConfig[] {\n    let path = this._treeChanges[pathname];\n    path = !state ? path : path.filter(propEq('state', state));\n    return path\n      .map(prop('views'))\n      .filter(identity)\n      .reduce(unnestR, []);\n  }\n\n  /**\n   * Return the transition's tree changes\n   *\n   * A transition goes from one state/parameters to another state/parameters.\n   * During a transition, states are entered and/or exited.\n   *\n   * This function returns various branches (paths) which represent the changes to the\n   * active state tree that are caused by the transition.\n   *\n   * @param pathname The name of the tree changes path to get:\n   *   (`'to'`, `'from'`, `'entering'`, `'exiting'`, `'retained'`)\n   */\n  treeChanges(pathname: string): PathNode[];\n  treeChanges(): TreeChanges;\n  treeChanges(pathname?: string) {\n    return pathname ? this._treeChanges[pathname] : this._treeChanges;\n  }\n\n  /**\n   * Creates a new transition that is a redirection of the current one.\n   *\n   * This transition can be returned from a [[TransitionService]] hook to\n   * redirect a transition to a new state and/or set of parameters.\n   *\n   * @internalapi\n   *\n   * @returns Returns a new [[Transition]] instance.\n   */\n  redirect(targetState: TargetState): Transition {\n    let redirects = 1,\n      trans: Transition = this;\n    // tslint:disable-next-line:no-conditional-assignment\n    while ((trans = trans.redirectedFrom()) != null) {\n      if (++redirects > 20) throw new Error(`Too many consecutive Transition redirects (20+)`);\n    }\n\n    const redirectOpts: TransitionOptions = { redirectedFrom: this, source: 'redirect' };\n    // If the original transition was caused by URL sync, then use { location: 'replace' }\n    // on the new transition (unless the target state explicitly specifies location: false).\n    // This causes the original url to be replaced with the url for the redirect target\n    // so the original url disappears from the browser history.\n    if (this.options().source === 'url' && targetState.options().location !== false) {\n      redirectOpts.location = 'replace';\n    }\n\n    const newOptions = extend({}, this.options(), targetState.options(), redirectOpts);\n    targetState = targetState.withOptions(newOptions, true);\n\n    const newTransition = this.router.transitionService.create(this._treeChanges.from, targetState);\n    const originalEnteringNodes = this._treeChanges.entering;\n    const redirectEnteringNodes = newTransition._treeChanges.entering;\n\n    // --- Re-use resolve data from original transition ---\n    // When redirecting from a parent state to a child state where the parent parameter values haven't changed\n    // (because of the redirect), the resolves fetched by the original transition are still valid in the\n    // redirected transition.\n    //\n    // This allows you to define a redirect on a parent state which depends on an async resolve value.\n    // You can wait for the resolve, then redirect to a child state based on the result.\n    // The redirected transition does not have to re-fetch the resolve.\n    // ---------------------------------------------------------\n\n    const nodeIsReloading = (reloadState: StateObject) => (node: PathNode) => {\n      return reloadState && node.state.includes[reloadState.name];\n    };\n\n    // Find any \"entering\" nodes in the redirect path that match the original path and aren't being reloaded\n    const matchingEnteringNodes: PathNode[] = PathUtils.matching(\n      redirectEnteringNodes,\n      originalEnteringNodes,\n      PathUtils.nonDynamicParams\n    ).filter(not(nodeIsReloading(targetState.options().reloadState)));\n\n    // Use the existing (possibly pre-resolved) resolvables for the matching entering nodes.\n    matchingEnteringNodes.forEach((node, idx) => {\n      node.resolvables = originalEnteringNodes[idx].resolvables;\n    });\n\n    return newTransition;\n  }\n\n  /** @hidden If a transition doesn't exit/enter any states, returns any [[Param]] whose value changed */\n  private _changedParams(): Param[] {\n    const tc = this._treeChanges;\n\n    /** Return undefined if it's not a \"dynamic\" transition, for the following reasons */\n    // If user explicitly wants a reload\n    if (this._options.reload) return undefined;\n    // If any states are exiting or entering\n    if (tc.exiting.length || tc.entering.length) return undefined;\n    // If to/from path lengths differ\n    if (tc.to.length !== tc.from.length) return undefined;\n    // If the to/from paths are different\n    const pathsDiffer: boolean = arrayTuples(tc.to, tc.from)\n      .map(tuple => tuple[0].state !== tuple[1].state)\n      .reduce(anyTrueR, false);\n    if (pathsDiffer) return undefined;\n\n    // Find any parameter values that differ\n    const nodeSchemas: Param[][] = tc.to.map((node: PathNode) => node.paramSchema);\n    const [toValues, fromValues] = [tc.to, tc.from].map(path => path.map(x => x.paramValues));\n    const tuples = arrayTuples(nodeSchemas, toValues, fromValues);\n\n    return tuples.map(([schema, toVals, fromVals]) => Param.changed(schema, toVals, fromVals)).reduce(unnestR, []);\n  }\n\n  /**\n   * Returns true if the transition is dynamic.\n   *\n   * A transition is dynamic if no states are entered nor exited, but at least one dynamic parameter has changed.\n   *\n   * @returns true if the Transition is dynamic\n   */\n  dynamic(): boolean {\n    const changes = this._changedParams();\n    return !changes ? false : changes.map(x => x.dynamic).reduce(anyTrueR, false);\n  }\n\n  /**\n   * Returns true if the transition is ignored.\n   *\n   * A transition is ignored if no states are entered nor exited, and no parameter values have changed.\n   *\n   * @returns true if the Transition is ignored.\n   */\n  ignored(): boolean {\n    return !!this._ignoredReason();\n  }\n\n  /** @hidden */\n  _ignoredReason(): 'SameAsCurrent' | 'SameAsPending' | undefined {\n    const pending = this.router.globals.transition;\n    const reloadState = this._options.reloadState;\n\n    const same = (pathA, pathB) => {\n      if (pathA.length !== pathB.length) return false;\n      const matching = PathUtils.matching(pathA, pathB);\n      return pathA.length === matching.filter(node => !reloadState || !node.state.includes[reloadState.name]).length;\n    };\n\n    const newTC = this.treeChanges();\n    const pendTC = pending && pending.treeChanges();\n\n    if (pendTC && same(pendTC.to, newTC.to) && same(pendTC.exiting, newTC.exiting)) return 'SameAsPending';\n    if (newTC.exiting.length === 0 && newTC.entering.length === 0 && same(newTC.from, newTC.to)) return 'SameAsCurrent';\n  }\n\n  /**\n   * Runs the transition\n   *\n   * This method is generally called from the [[StateService.transitionTo]]\n   *\n   * @internalapi\n   *\n   * @returns a promise for a successful transition.\n   */\n  run(): Promise<any> {\n    const runAllHooks = TransitionHook.runAllHooks;\n\n    // Gets transition hooks array for the given phase\n    const getHooksFor = (phase: TransitionHookPhase) => this._hookBuilder.buildHooksForPhase(phase);\n\n    // When the chain is complete, then resolve or reject the deferred\n    const transitionSuccess = () => {\n      trace.traceSuccess(this.$to(), this);\n      this.success = true;\n      this._deferred.resolve(this.to());\n      runAllHooks(getHooksFor(TransitionHookPhase.SUCCESS));\n    };\n\n    const transitionError = (reason: Rejection) => {\n      trace.traceError(reason, this);\n      this.success = false;\n      this._deferred.reject(reason);\n      this._error = reason;\n      runAllHooks(getHooksFor(TransitionHookPhase.ERROR));\n    };\n\n    const runTransition = () => {\n      // Wait to build the RUN hook chain until the BEFORE hooks are done\n      // This allows a BEFORE hook to dynamically add additional RUN hooks via the Transition object.\n      const allRunHooks = getHooksFor(TransitionHookPhase.RUN);\n      const done = () => services.$q.when(undefined);\n      return TransitionHook.invokeHooks(allRunHooks, done);\n    };\n\n    const startTransition = () => {\n      const globals = this.router.globals;\n\n      globals.lastStartedTransitionId = this.$id;\n      globals.transition = this;\n      globals.transitionHistory.enqueue(this);\n\n      trace.traceTransitionStart(this);\n\n      return services.$q.when(undefined);\n    };\n\n    const allBeforeHooks = getHooksFor(TransitionHookPhase.BEFORE);\n    TransitionHook.invokeHooks(allBeforeHooks, startTransition)\n      .then(runTransition)\n      .then(transitionSuccess, transitionError);\n\n    return this.promise;\n  }\n\n  /** Checks if this transition is currently active/running. */\n  isActive = () => this.router.globals.transition === this;\n\n  /**\n   * Checks if the Transition is valid\n   *\n   * @returns true if the Transition is valid\n   */\n  valid() {\n    return !this.error() || this.success !== undefined;\n  }\n\n  /**\n   * Aborts this transition\n   *\n   * Imperative API to abort a Transition.\n   * This only applies to Transitions that are not yet complete.\n   */\n  abort() {\n    // Do not set flag if the transition is already complete\n    if (isUndefined(this.success)) {\n      this._aborted = true;\n    }\n  }\n\n  /**\n   * The Transition error reason.\n   *\n   * If the transition is invalid (and could not be run), returns the reason the transition is invalid.\n   * If the transition was valid and ran, but was not successful, returns the reason the transition failed.\n   *\n   * @returns a transition rejection explaining why the transition is invalid, or the reason the transition failed.\n   */\n  error(): Rejection {\n    const state: StateObject = this.$to();\n\n    if (state.self.abstract) {\n      return Rejection.invalid(`Cannot transition to abstract state '${state.name}'`);\n    }\n\n    const paramDefs = state.parameters();\n    const values = this.params();\n    const invalidParams = paramDefs.filter(param => !param.validates(values[param.id]));\n\n    if (invalidParams.length) {\n      const invalidValues = invalidParams.map(param => `[${param.id}:${stringify(values[param.id])}]`).join(', ');\n      const detail = `The following parameter values are not valid for state '${state.name}': ${invalidValues}`;\n      return Rejection.invalid(detail);\n    }\n\n    if (this.success === false) return this._error;\n  }\n\n  /**\n   * A string representation of the Transition\n   *\n   * @returns A string representation of the Transition\n   */\n  toString() {\n    const fromStateOrName = this.from();\n    const toStateOrName = this.to();\n\n    const avoidEmptyHash = (params: RawParams) =>\n      params['#'] !== null && params['#'] !== undefined ? params : omit(params, ['#']);\n\n    // (X) means the to state is invalid.\n    const id = this.$id,\n      from = isObject(fromStateOrName) ? fromStateOrName.name : fromStateOrName,\n      fromParams = stringify(avoidEmptyHash(this._treeChanges.from.map(prop('paramValues')).reduce(mergeR, {}))),\n      toValid = this.valid() ? '' : '(X) ',\n      to = isObject(toStateOrName) ? toStateOrName.name : toStateOrName,\n      toParams = stringify(avoidEmptyHash(this.params()));\n\n    return `Transition#${id}( '${from}'${fromParams} -> ${toValid}'${to}'${toParams} )`;\n  }\n}\n",
    "/** @publicapi @module url */ /** */\nimport { map, inherit, identity, unnest, tail, find, Obj, allTrueR, unnestR, arrayTuples } from '../common/common';\nimport { prop, propEq } from '../common/hof';\nimport { isArray, isString, isDefined } from '../common/predicates';\nimport { Param, DefType } from '../params/param';\nimport { ParamTypes } from '../params/paramTypes';\nimport { RawParams } from '../params/interface';\nimport { UrlMatcherCompileConfig } from './interface';\nimport { joinNeighborsR, splitOnDelim } from '../common/strings';\nimport { ParamType } from '../params';\nimport { defaults } from '../common';\nimport { ParamFactory } from './urlMatcherFactory';\n\n/** @hidden */\nfunction quoteRegExp(str: any, param?: any) {\n  let surroundPattern = ['', ''],\n    result = str.replace(/[\\\\\\[\\]\\^$*+?.()|{}]/g, '\\\\$&');\n  if (!param) return result;\n\n  switch (param.squash) {\n    case false:\n      surroundPattern = ['(', ')' + (param.isOptional ? '?' : '')];\n      break;\n    case true:\n      result = result.replace(/\\/$/, '');\n      surroundPattern = ['(?:/(', ')|/)?'];\n      break;\n    default:\n      surroundPattern = [`(${param.squash}|`, ')?'];\n      break;\n  }\n  return result + surroundPattern[0] + param.type.pattern.source + surroundPattern[1];\n}\n\n/** @hidden */\nconst memoizeTo = (obj: Obj, _prop: string, fn: Function) => (obj[_prop] = obj[_prop] || fn());\n\n/** @hidden */\nconst splitOnSlash = splitOnDelim('/');\n\n/** @hidden */\ninterface UrlMatcherCache {\n  segments?: any[];\n  weights?: number[];\n  path?: UrlMatcher[];\n  parent?: UrlMatcher;\n  pattern?: RegExp;\n}\n\n/** @hidden */\ninterface MatchDetails {\n  id: string;\n  regexp: string;\n  segment: string;\n  type: ParamType;\n}\n\n/** @hidden */\nconst defaultConfig: UrlMatcherCompileConfig = {\n  state: { params: {} },\n  strict: true,\n  caseInsensitive: true,\n};\n\n/**\n * Matches URLs against patterns.\n *\n * Matches URLs against patterns and extracts named parameters from the path or the search\n * part of the URL.\n *\n * A URL pattern consists of a path pattern, optionally followed by '?' and a list of search (query)\n * parameters. Multiple search parameter names are separated by '&'. Search parameters\n * do not influence whether or not a URL is matched, but their values are passed through into\n * the matched parameters returned by [[UrlMatcher.exec]].\n *\n * - *Path parameters* are defined using curly brace placeholders (`/somepath/{param}`)\n * or colon placeholders (`/somePath/:param`).\n *\n * - *A parameter RegExp* may be defined for a param after a colon\n * (`/somePath/{param:[a-zA-Z0-9]+}`) in a curly brace placeholder.\n * The regexp must match for the url to be matched.\n * Should the regexp itself contain curly braces, they must be in matched pairs or escaped with a backslash.\n *\n * Note: a RegExp parameter will encode its value using either [[ParamTypes.path]] or [[ParamTypes.query]].\n *\n * - *Custom parameter types* may also be specified after a colon (`/somePath/{param:int}`) in curly brace parameters.\n *   See [[UrlMatcherFactory.type]] for more information.\n *\n * - *Catch-all parameters* are defined using an asterisk placeholder (`/somepath/*catchallparam`).\n *   A catch-all * parameter value will contain the remainder of the URL.\n *\n * ---\n *\n * Parameter names may contain only word characters (latin letters, digits, and underscore) and\n * must be unique within the pattern (across both path and search parameters).\n * A path parameter matches any number of characters other than '/'. For catch-all\n * placeholders the path parameter matches any number of characters.\n *\n * Examples:\n *\n * * `'/hello/'` - Matches only if the path is exactly '/hello/'. There is no special treatment for\n *   trailing slashes, and patterns have to match the entire path, not just a prefix.\n * * `'/user/:id'` - Matches '/user/bob' or '/user/1234!!!' or even '/user/' but not '/user' or\n *   '/user/bob/details'. The second path segment will be captured as the parameter 'id'.\n * * `'/user/{id}'` - Same as the previous example, but using curly brace syntax.\n * * `'/user/{id:[^/]*}'` - Same as the previous example.\n * * `'/user/{id:[0-9a-fA-F]{1,8}}'` - Similar to the previous example, but only matches if the id\n *   parameter consists of 1 to 8 hex digits.\n * * `'/files/{path:.*}'` - Matches any URL starting with '/files/' and captures the rest of the\n *   path into the parameter 'path'.\n * * `'/files/*path'` - ditto.\n * * `'/calendar/{start:date}'` - Matches \"/calendar/2014-11-12\" (because the pattern defined\n *   in the built-in  `date` ParamType matches `2014-11-12`) and provides a Date object in $stateParams.start\n *\n */\nexport class UrlMatcher {\n  /** @hidden */\n  static nameValidator: RegExp = /^\\w+([-.]+\\w+)*(?:\\[\\])?$/;\n\n  /** @hidden */\n  private _cache: UrlMatcherCache = { path: [this] };\n  /** @hidden */\n  private _children: UrlMatcher[] = [];\n  /** @hidden */\n  private _params: Param[] = [];\n  /** @hidden */\n  private _segments: string[] = [];\n  /** @hidden */\n  private _compiled: string[] = [];\n  /** @hidden */\n  private readonly config: UrlMatcherCompileConfig;\n\n  /** The pattern that was passed into the constructor */\n  public pattern: string;\n\n  /** @hidden */\n  static encodeDashes(str: string) {\n    // Replace dashes with encoded \"\\-\"\n    return encodeURIComponent(str).replace(\n      /-/g,\n      c =>\n        `%5C%${c\n          .charCodeAt(0)\n          .toString(16)\n          .toUpperCase()}`\n    );\n  }\n\n  /** @hidden Given a matcher, return an array with the matcher's path segments and path params, in order */\n  static pathSegmentsAndParams(matcher: UrlMatcher) {\n    const staticSegments = matcher._segments;\n    const pathParams = matcher._params.filter(p => p.location === DefType.PATH);\n    return arrayTuples(staticSegments, pathParams.concat(undefined))\n      .reduce(unnestR, [])\n      .filter(x => x !== '' && isDefined(x));\n  }\n\n  /** @hidden Given a matcher, return an array with the matcher's query params */\n  static queryParams(matcher: UrlMatcher): Param[] {\n    return matcher._params.filter(p => p.location === DefType.SEARCH);\n  }\n\n  /**\n   * Compare two UrlMatchers\n   *\n   * This comparison function converts a UrlMatcher into static and dynamic path segments.\n   * Each static path segment is a static string between a path separator (slash character).\n   * Each dynamic segment is a path parameter.\n   *\n   * The comparison function sorts static segments before dynamic ones.\n   */\n  static compare(a: UrlMatcher, b: UrlMatcher): number {\n    /**\n     * Turn a UrlMatcher and all its parent matchers into an array\n     * of slash literals '/', string literals, and Param objects\n     *\n     * This example matcher matches strings like \"/foo/:param/tail\":\n     * var matcher = $umf.compile(\"/foo\").append($umf.compile(\"/:param\")).append($umf.compile(\"/\")).append($umf.compile(\"tail\"));\n     * var result = segments(matcher); // [ '/', 'foo', '/', Param, '/', 'tail' ]\n     *\n     * Caches the result as `matcher._cache.segments`\n     */\n    const segments = (matcher: UrlMatcher) =>\n      (matcher._cache.segments =\n        matcher._cache.segments ||\n        matcher._cache.path\n          .map(UrlMatcher.pathSegmentsAndParams)\n          .reduce(unnestR, [])\n          .reduce(joinNeighborsR, [])\n          .map(x => (isString(x) ? splitOnSlash(x) : x))\n          .reduce(unnestR, []));\n\n    /**\n     * Gets the sort weight for each segment of a UrlMatcher\n     *\n     * Caches the result as `matcher._cache.weights`\n     */\n    const weights = (matcher: UrlMatcher) =>\n      (matcher._cache.weights =\n        matcher._cache.weights ||\n        segments(matcher).map(segment => {\n          // Sort slashes first, then static strings, the Params\n          if (segment === '/') return 1;\n          if (isString(segment)) return 2;\n          if (segment instanceof Param) return 3;\n        }));\n\n    /**\n     * Pads shorter array in-place (mutates)\n     */\n    const padArrays = (l: any[], r: any[], padVal: any) => {\n      const len = Math.max(l.length, r.length);\n      while (l.length < len) l.push(padVal);\n      while (r.length < len) r.push(padVal);\n    };\n\n    const weightsA = weights(a),\n      weightsB = weights(b);\n    padArrays(weightsA, weightsB, 0);\n\n    const _pairs = arrayTuples(weightsA, weightsB);\n    let cmp, i;\n\n    for (i = 0; i < _pairs.length; i++) {\n      cmp = _pairs[i][0] - _pairs[i][1];\n      if (cmp !== 0) return cmp;\n    }\n\n    return 0;\n  }\n\n  /**\n   * @param pattern The pattern to compile into a matcher.\n   * @param paramTypes The [[ParamTypes]] registry\n   * @param paramFactory A [[ParamFactory]] object\n   * @param config  A [[UrlMatcherCompileConfig]] configuration object\n   */\n  constructor(pattern: string, paramTypes: ParamTypes, paramFactory: ParamFactory, config?: UrlMatcherCompileConfig) {\n    this.config = config = defaults(config, defaultConfig);\n    this.pattern = pattern;\n\n    // Find all placeholders and create a compiled pattern, using either classic or curly syntax:\n    //   '*' name\n    //   ':' name\n    //   '{' name '}'\n    //   '{' name ':' regexp '}'\n    // The regular expression is somewhat complicated due to the need to allow curly braces\n    // inside the regular expression. The placeholder regexp breaks down as follows:\n    //    ([:*])([\\w\\[\\]]+)              - classic placeholder ($1 / $2) (search version has - for snake-case)\n    //    \\{([\\w\\[\\]]+)(?:\\:\\s*( ... ))?\\}  - curly brace placeholder ($3) with optional regexp/type ... ($4) (search version has - for snake-case\n    //    (?: ... | ... | ... )+         - the regexp consists of any number of atoms, an atom being either\n    //    [^{}\\\\]+                       - anything other than curly braces or backslash\n    //    \\\\.                            - a backslash escape\n    //    \\{(?:[^{}\\\\]+|\\\\.)*\\}          - a matched set of curly braces containing other atoms\n    const placeholder = /([:*])([\\w\\[\\]]+)|\\{([\\w\\[\\]]+)(?:\\:\\s*((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g;\n    const searchPlaceholder = /([:]?)([\\w\\[\\].-]+)|\\{([\\w\\[\\].-]+)(?:\\:\\s*((?:[^{}\\\\]+|\\\\.|\\{(?:[^{}\\\\]+|\\\\.)*\\})+))?\\}/g;\n    const patterns: any[][] = [];\n    let last = 0;\n    let matchArray: RegExpExecArray;\n\n    const checkParamErrors = (id: string) => {\n      if (!UrlMatcher.nameValidator.test(id)) throw new Error(`Invalid parameter name '${id}' in pattern '${pattern}'`);\n      if (find(this._params, propEq('id', id)))\n        throw new Error(`Duplicate parameter name '${id}' in pattern '${pattern}'`);\n    };\n\n    // Split into static segments separated by path parameter placeholders.\n    // The number of segments is always 1 more than the number of parameters.\n    const matchDetails = (m: RegExpExecArray, isSearch: boolean): MatchDetails => {\n      // IE[78] returns '' for unmatched groups instead of null\n      const id: string = m[2] || m[3];\n      const regexp: string = isSearch ? m[4] : m[4] || (m[1] === '*' ? '[\\\\s\\\\S]*' : null);\n\n      const makeRegexpType = str =>\n        inherit(paramTypes.type(isSearch ? 'query' : 'path'), {\n          pattern: new RegExp(str, this.config.caseInsensitive ? 'i' : undefined),\n        });\n\n      return {\n        id,\n        regexp,\n        segment: pattern.substring(last, m.index),\n        type: !regexp ? null : paramTypes.type(regexp) || makeRegexpType(regexp),\n      };\n    };\n\n    let details: MatchDetails;\n    let segment: string;\n\n    // tslint:disable-next-line:no-conditional-assignment\n    while ((matchArray = placeholder.exec(pattern))) {\n      details = matchDetails(matchArray, false);\n      if (details.segment.indexOf('?') >= 0) break; // we're into the search part\n\n      checkParamErrors(details.id);\n      this._params.push(paramFactory.fromPath(details.id, details.type, config.state));\n      this._segments.push(details.segment);\n      patterns.push([details.segment, tail(this._params)]);\n      last = placeholder.lastIndex;\n    }\n    segment = pattern.substring(last);\n\n    // Find any search parameter names and remove them from the last segment\n    const i = segment.indexOf('?');\n\n    if (i >= 0) {\n      const search = segment.substring(i);\n      segment = segment.substring(0, i);\n\n      if (search.length > 0) {\n        last = 0;\n\n        // tslint:disable-next-line:no-conditional-assignment\n        while ((matchArray = searchPlaceholder.exec(search))) {\n          details = matchDetails(matchArray, true);\n          checkParamErrors(details.id);\n          this._params.push(paramFactory.fromSearch(details.id, details.type, config.state));\n          last = placeholder.lastIndex;\n          // check if ?&\n        }\n      }\n    }\n\n    this._segments.push(segment);\n    this._compiled = patterns.map(_pattern => quoteRegExp.apply(null, _pattern)).concat(quoteRegExp(segment));\n  }\n\n  /**\n   * Creates a new concatenated UrlMatcher\n   *\n   * Builds a new UrlMatcher by appending another UrlMatcher to this one.\n   *\n   * @param url A `UrlMatcher` instance to append as a child of the current `UrlMatcher`.\n   */\n  append(url: UrlMatcher): UrlMatcher {\n    this._children.push(url);\n    url._cache = {\n      path: this._cache.path.concat(url),\n      parent: this,\n      pattern: null,\n    };\n    return url;\n  }\n\n  /** @hidden */\n  isRoot(): boolean {\n    return this._cache.path[0] === this;\n  }\n\n  /** Returns the input pattern string */\n  toString(): string {\n    return this.pattern;\n  }\n\n  /**\n   * Tests the specified url/path against this matcher.\n   *\n   * Tests if the given url matches this matcher's pattern, and returns an object containing the captured\n   * parameter values.  Returns null if the path does not match.\n   *\n   * The returned object contains the values\n   * of any search parameters that are mentioned in the pattern, but their value may be null if\n   * they are not present in `search`. This means that search parameters are always treated\n   * as optional.\n   *\n   * #### Example:\n   * ```js\n   * new UrlMatcher('/user/{id}?q&r').exec('/user/bob', {\n   *   x: '1', q: 'hello'\n   * });\n   * // returns { id: 'bob', q: 'hello', r: null }\n   * ```\n   *\n   * @param path    The URL path to match, e.g. `$location.path()`.\n   * @param search  URL search parameters, e.g. `$location.search()`.\n   * @param hash    URL hash e.g. `$location.hash()`.\n   * @param options\n   *\n   * @returns The captured parameter values.\n   */\n  exec(path: string, search: any = {}, hash?: string, options: any = {}): RawParams {\n    const match = memoizeTo(this._cache, 'pattern', () => {\n      return new RegExp(\n        [\n          '^',\n          unnest(this._cache.path.map(prop('_compiled'))).join(''),\n          this.config.strict === false ? '/?' : '',\n          '$',\n        ].join(''),\n        this.config.caseInsensitive ? 'i' : undefined\n      );\n    }).exec(path);\n\n    if (!match) return null;\n\n    // options = defaults(options, { isolate: false });\n\n    const allParams: Param[] = this.parameters(),\n      pathParams: Param[] = allParams.filter(param => !param.isSearch()),\n      searchParams: Param[] = allParams.filter(param => param.isSearch()),\n      nPathSegments = this._cache.path.map(urlm => urlm._segments.length - 1).reduce((a, x) => a + x),\n      values: RawParams = {};\n\n    if (nPathSegments !== match.length - 1) throw new Error(`Unbalanced capture group in route '${this.pattern}'`);\n\n    function decodePathArray(paramVal: string) {\n      const reverseString = (str: string) =>\n        str\n          .split('')\n          .reverse()\n          .join('');\n      const unquoteDashes = (str: string) => str.replace(/\\\\-/g, '-');\n\n      const split = reverseString(paramVal).split(/-(?!\\\\)/);\n      const allReversed = map(split, reverseString);\n      return map(allReversed, unquoteDashes).reverse();\n    }\n\n    for (let i = 0; i < nPathSegments; i++) {\n      const param: Param = pathParams[i];\n      let value: any | any[] = match[i + 1];\n\n      // if the param value matches a pre-replace pair, replace the value before decoding.\n      for (let j = 0; j < param.replace.length; j++) {\n        if (param.replace[j].from === value) value = param.replace[j].to;\n      }\n      if (value && param.array === true) value = decodePathArray(value);\n      if (isDefined(value)) value = param.type.decode(value);\n      values[param.id] = param.value(value);\n    }\n    searchParams.forEach(param => {\n      let value = search[param.id];\n      for (let j = 0; j < param.replace.length; j++) {\n        if (param.replace[j].from === value) value = param.replace[j].to;\n      }\n      if (isDefined(value)) value = param.type.decode(value);\n      values[param.id] = param.value(value);\n    });\n\n    if (hash) values['#'] = hash;\n\n    return values;\n  }\n\n  /**\n   * @hidden\n   * Returns all the [[Param]] objects of all path and search parameters of this pattern in order of appearance.\n   *\n   * @returns {Array.<Param>}  An array of [[Param]] objects. Must be treated as read-only. If the\n   *    pattern has no parameters, an empty array is returned.\n   */\n  parameters(opts: any = {}): Param[] {\n    if (opts.inherit === false) return this._params;\n    return unnest(this._cache.path.map(matcher => matcher._params));\n  }\n\n  /**\n   * @hidden\n   * Returns a single parameter from this UrlMatcher by id\n   *\n   * @param id\n   * @param opts\n   * @returns {T|Param|any|boolean|UrlMatcher|null}\n   */\n  parameter(id: string, opts: any = {}): Param {\n    const findParam = () => {\n      for (const param of this._params) {\n        if (param.id === id) return param;\n      }\n    };\n\n    const parent = this._cache.parent;\n    return findParam() || (opts.inherit !== false && parent && parent.parameter(id, opts)) || null;\n  }\n\n  /**\n   * Validates the input parameter values against this UrlMatcher\n   *\n   * Checks an object hash of parameters to validate their correctness according to the parameter\n   * types of this `UrlMatcher`.\n   *\n   * @param params The object hash of parameters to validate.\n   * @returns Returns `true` if `params` validates, otherwise `false`.\n   */\n  validates(params: RawParams): boolean {\n    const validParamVal = (param: Param, val: any) => !param || param.validates(val);\n\n    params = params || {};\n\n    // I'm not sure why this checks only the param keys passed in, and not all the params known to the matcher\n    const paramSchema = this.parameters().filter(paramDef => params.hasOwnProperty(paramDef.id));\n    return paramSchema.map(paramDef => validParamVal(paramDef, params[paramDef.id])).reduce(allTrueR, true);\n  }\n\n  /**\n   * Given a set of parameter values, creates a URL from this UrlMatcher.\n   *\n   * Creates a URL that matches this pattern by substituting the specified values\n   * for the path and search parameters.\n   *\n   * #### Example:\n   * ```js\n   * new UrlMatcher('/user/{id}?q').format({ id:'bob', q:'yes' });\n   * // returns '/user/bob?q=yes'\n   * ```\n   *\n   * @param values  the values to substitute for the parameters in this pattern.\n   * @returns the formatted URL (path and optionally search part).\n   */\n  format(values: RawParams = {}) {\n    // Build the full path of UrlMatchers (including all parent UrlMatchers)\n    const urlMatchers = this._cache.path;\n\n    // Extract all the static segments and Params (processed as ParamDetails)\n    // into an ordered array\n    const pathSegmentsAndParams: Array<string | ParamDetails> = urlMatchers\n      .map(UrlMatcher.pathSegmentsAndParams)\n      .reduce(unnestR, [])\n      .map(x => (isString(x) ? x : getDetails(x)));\n\n    // Extract the query params into a separate array\n    const queryParams: Array<ParamDetails> = urlMatchers\n      .map(UrlMatcher.queryParams)\n      .reduce(unnestR, [])\n      .map(getDetails);\n\n    const isInvalid = (param: ParamDetails) => param.isValid === false;\n    if (pathSegmentsAndParams.concat(queryParams).filter(isInvalid).length) {\n      return null;\n    }\n\n    /**\n     * Given a Param, applies the parameter value, then returns detailed information about it\n     */\n    function getDetails(param: Param): ParamDetails {\n      // Normalize to typed value\n      const value = param.value(values[param.id]);\n      const isValid = param.validates(value);\n      const isDefaultValue = param.isDefaultValue(value);\n      // Check if we're in squash mode for the parameter\n      const squash = isDefaultValue ? param.squash : false;\n      // Allow the Parameter's Type to encode the value\n      const encoded = param.type.encode(value);\n\n      return { param, value, isValid, isDefaultValue, squash, encoded };\n    }\n\n    // Build up the path-portion from the list of static segments and parameters\n    const pathString = pathSegmentsAndParams.reduce((acc: string, x: string | ParamDetails) => {\n      // The element is a static segment (a raw string); just append it\n      if (isString(x)) return acc + x;\n\n      // Otherwise, it's a ParamDetails.\n      const { squash, encoded, param } = x;\n\n      // If squash is === true, try to remove a slash from the path\n      if (squash === true) return acc.match(/\\/$/) ? acc.slice(0, -1) : acc;\n      // If squash is a string, use the string for the param value\n      if (isString(squash)) return acc + squash;\n      if (squash !== false) return acc; // ?\n      if (encoded == null) return acc;\n      // If this parameter value is an array, encode the value using encodeDashes\n      if (isArray(encoded)) return acc + map(<string[]>encoded, UrlMatcher.encodeDashes).join('-');\n      // If the parameter type is \"raw\", then do not encodeURIComponent\n      if (param.raw) return acc + encoded;\n      // Encode the value\n      return acc + encodeURIComponent(<string>encoded);\n    }, '');\n\n    // Build the query string by applying parameter values (array or regular)\n    // then mapping to key=value, then flattening and joining using \"&\"\n    const queryString = queryParams\n      .map((paramDetails: ParamDetails) => {\n        let { param, squash, encoded, isDefaultValue } = paramDetails;\n        if (encoded == null || (isDefaultValue && squash !== false)) return;\n        if (!isArray(encoded)) encoded = [<string>encoded];\n        if (encoded.length === 0) return;\n        if (!param.raw) encoded = map(<string[]>encoded, encodeURIComponent);\n\n        return (<string[]>encoded).map(val => `${param.id}=${val}`);\n      })\n      .filter(identity)\n      .reduce(unnestR, [])\n      .join('&');\n\n    // Concat the pathstring with the queryString (if exists) and the hashString (if exists)\n    return pathString + (queryString ? `?${queryString}` : '') + (values['#'] ? '#' + values['#'] : '');\n  }\n}\n\n/** @hidden */\ninterface ParamDetails {\n  param: Param;\n  value: any;\n  isValid: boolean;\n  isDefaultValue: boolean;\n  squash: boolean | string;\n  encoded: string | string[];\n}\n",
    "/** @publicapi @module url */ /** */\nimport { extend, forEach, isDefined, isFunction, isObject } from '../common';\nimport { UrlMatcher } from './urlMatcher';\nimport { DefType, Param, ParamType, ParamTypeDefinition } from '../params';\nimport { UrlMatcherCompileConfig } from './interface';\nimport { StateDeclaration } from '../state';\nimport { UIRouter } from '../router';\n\n/** @internalapi */\nexport class ParamFactory {\n  fromConfig(id: string, type: ParamType, state: StateDeclaration) {\n    return new Param(id, type, DefType.CONFIG, this.router.urlService.config, state);\n  }\n\n  fromPath(id: string, type: ParamType, state: StateDeclaration) {\n    return new Param(id, type, DefType.PATH, this.router.urlService.config, state);\n  }\n\n  fromSearch(id: string, type: ParamType, state: StateDeclaration) {\n    return new Param(id, type, DefType.SEARCH, this.router.urlService.config, state);\n  }\n\n  constructor(private router: UIRouter) {}\n}\n\n/**\n * Factory for [[UrlMatcher]] instances.\n *\n * The factory is available to ng1 services as\n * `$urlMatcherFactory` or ng1 providers as `$urlMatcherFactoryProvider`.\n *\n * @internalapi\n */\nexport class UrlMatcherFactory {\n  /** @internalapi Creates a new [[Param]] for a given location (DefType) */\n  paramFactory = new ParamFactory(this.router);\n\n  // TODO: move implementations to UrlConfig (urlService.config)\n  constructor(/** @hidden */ private router: UIRouter) {\n    extend(this, { UrlMatcher, Param });\n  }\n\n  /**\n   * Creates a [[UrlMatcher]] for the specified pattern.\n   *\n   * @param pattern  The URL pattern.\n   * @param config  The config object hash.\n   * @returns The UrlMatcher.\n   */\n  compile(pattern: string, config?: UrlMatcherCompileConfig) {\n    const urlConfig = this.router.urlService.config;\n    // backward-compatible support for config.params -> config.state.params\n    const params = config && !config.state && (config as any).params;\n    config = params ? { state: { params }, ...config } : config;\n    const globalConfig = { strict: urlConfig._isStrictMode, caseInsensitive: urlConfig._isCaseInsensitive };\n    return new UrlMatcher(pattern, urlConfig.paramTypes, this.paramFactory, extend(globalConfig, config));\n  }\n\n  /**\n   * Returns true if the specified object is a [[UrlMatcher]], or false otherwise.\n   *\n   * @param object  The object to perform the type check against.\n   * @returns `true` if the object matches the `UrlMatcher` interface, by\n   *          implementing all the same methods.\n   */\n  isMatcher(object: any): boolean {\n    // TODO: typeof?\n    if (!isObject(object)) return false;\n    let result = true;\n\n    forEach(UrlMatcher.prototype, (val, name) => {\n      if (isFunction(val)) result = result && (isDefined(object[name]) && isFunction(object[name]));\n    });\n    return result;\n  }\n\n  /** @hidden */\n  $get() {\n    const urlConfig = this.router.urlService.config;\n    urlConfig.paramTypes.enqueue = false;\n    urlConfig.paramTypes._flushTypeQueue();\n    return this;\n  }\n\n  /** @deprecated use [[UrlConfig.caseInsensitive]] */\n  caseInsensitive = (value?: boolean) => this.router.urlService.config.caseInsensitive(value);\n\n  /** @deprecated use [[UrlConfig.defaultSquashPolicy]] */\n  defaultSquashPolicy = (value?: boolean | string) => this.router.urlService.config.defaultSquashPolicy(value);\n\n  /** @deprecated use [[UrlConfig.strictMode]] */\n  strictMode = (value?: boolean) => this.router.urlService.config.strictMode(value);\n\n  /** @deprecated use [[UrlConfig.type]] */\n  type = (name: string, definition?: ParamTypeDefinition, definitionFn?: () => ParamTypeDefinition) => {\n    return this.router.urlService.config.type(name, definition, definitionFn) || this;\n  };\n}\n",
    "/** @publicapi @module url */ /** */\nimport { UrlMatcher } from './urlMatcher';\nimport { isString, isDefined, isFunction } from '../common/predicates';\nimport { UIRouter } from '../router';\nimport { identity, extend } from '../common/common';\nimport { is, pattern } from '../common/hof';\nimport { StateObject } from '../state/stateObject';\nimport { RawParams } from '../params/interface';\nimport {\n  UrlRule,\n  UrlRuleMatchFn,\n  UrlRuleHandlerFn,\n  UrlRuleType,\n  UrlParts,\n  MatcherUrlRule,\n  StateRule,\n  RegExpRule,\n} from './interface';\n\n/**\n * Creates a [[UrlRule]]\n *\n * Creates a [[UrlRule]] from a:\n *\n * - `string`\n * - [[UrlMatcher]]\n * - `RegExp`\n * - [[StateObject]]\n * @internalapi\n */\nexport class UrlRuleFactory {\n  static isUrlRule = obj => obj && ['type', 'match', 'handler'].every(key => isDefined(obj[key]));\n\n  constructor(public router: UIRouter) {}\n\n  compile(str: string) {\n    return this.router.urlMatcherFactory.compile(str);\n  }\n\n  create(\n    what: string | UrlMatcher | StateObject | RegExp | UrlRuleMatchFn,\n    handler?: string | UrlRuleHandlerFn\n  ): UrlRule {\n    const isState = StateObject.isState;\n    const makeRule = pattern([\n      [isString, (_what: string) => makeRule(this.compile(_what))],\n      [is(UrlMatcher), (_what: UrlMatcher) => this.fromUrlMatcher(_what, handler)],\n      [isState, (_what: StateObject) => this.fromState(_what, this.router)],\n      [is(RegExp), (_what: RegExp) => this.fromRegExp(_what, handler)],\n      [isFunction, (_what: UrlRuleMatchFn) => new BaseUrlRule(_what, handler as UrlRuleHandlerFn)],\n    ]);\n\n    const rule = makeRule(what);\n    if (!rule) throw new Error(\"invalid 'what' in when()\");\n    return rule;\n  }\n\n  /**\n   * A UrlRule which matches based on a UrlMatcher\n   *\n   * The `handler` may be either a `string`, a [[UrlRuleHandlerFn]] or another [[UrlMatcher]]\n   *\n   * ## Handler as a function\n   *\n   * If `handler` is a function, the function is invoked with:\n   *\n   * - matched parameter values ([[RawParams]] from [[UrlMatcher.exec]])\n   * - url: the current Url ([[UrlParts]])\n   * - router: the router object ([[UIRouter]])\n   *\n   * #### Example:\n   * ```js\n   * var urlMatcher = $umf.compile(\"/foo/:fooId/:barId\");\n   * var rule = factory.fromUrlMatcher(urlMatcher, match => \"/home/\" + match.fooId + \"/\" + match.barId);\n   * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n   * var result = rule.handler(match); // '/home/123/456'\n   * ```\n   *\n   * ## Handler as UrlMatcher\n   *\n   * If `handler` is a UrlMatcher, the handler matcher is used to create the new url.\n   * The `handler` UrlMatcher is formatted using the matched param from the first matcher.\n   * The url is replaced with the result.\n   *\n   * #### Example:\n   * ```js\n   * var urlMatcher = $umf.compile(\"/foo/:fooId/:barId\");\n   * var handler = $umf.compile(\"/home/:fooId/:barId\");\n   * var rule = factory.fromUrlMatcher(urlMatcher, handler);\n   * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n   * var result = rule.handler(match); // '/home/123/456'\n   * ```\n   */\n  fromUrlMatcher(urlMatcher: UrlMatcher, handler: string | UrlMatcher | UrlRuleHandlerFn): MatcherUrlRule {\n    let _handler: UrlRuleHandlerFn = handler as any;\n    if (isString(handler)) handler = this.router.urlMatcherFactory.compile(handler);\n    if (is(UrlMatcher)(handler)) _handler = (match: RawParams) => (handler as UrlMatcher).format(match);\n\n    function matchUrlParamters(url: UrlParts): RawParams {\n      const params = urlMatcher.exec(url.path, url.search, url.hash);\n      return urlMatcher.validates(params) && params;\n    }\n\n    // Prioritize URLs, lowest to highest:\n    // - Some optional URL parameters, but none matched\n    // - No optional parameters in URL\n    // - Some optional parameters, some matched\n    // - Some optional parameters, all matched\n    function matchPriority(params: RawParams): number {\n      const optional = urlMatcher.parameters().filter(param => param.isOptional);\n      if (!optional.length) return 0.000001;\n      const matched = optional.filter(param => params[param.id]);\n      return matched.length / optional.length;\n    }\n\n    const details = { urlMatcher, matchPriority, type: 'URLMATCHER' };\n    return extend(new BaseUrlRule(matchUrlParamters, _handler), details) as MatcherUrlRule;\n  }\n\n  /**\n   * A UrlRule which matches a state by its url\n   *\n   * #### Example:\n   * ```js\n   * var rule = factory.fromState($state.get('foo'), router);\n   * var match = rule.match('/foo/123/456'); // results in { fooId: '123', barId: '456' }\n   * var result = rule.handler(match);\n   * // Starts a transition to 'foo' with params: { fooId: '123', barId: '456' }\n   * ```\n   */\n  fromState(state: StateObject, router: UIRouter): StateRule {\n    /**\n     * Handles match by transitioning to matched state\n     *\n     * First checks if the router should start a new transition.\n     * A new transition is not required if the current state's URL\n     * and the new URL are already identical\n     */\n    const handler = (match: RawParams) => {\n      const $state = router.stateService;\n      const globals = router.globals;\n      if ($state.href(state, match) !== $state.href(globals.current, globals.params)) {\n        $state.transitionTo(state, match, { inherit: true, source: 'url' });\n      }\n    };\n\n    const details = { state, type: 'STATE' };\n    return extend(this.fromUrlMatcher(state.url, handler), details) as StateRule;\n  }\n\n  /**\n   * A UrlRule which matches based on a regular expression\n   *\n   * The `handler` may be either a [[UrlRuleHandlerFn]] or a string.\n   *\n   * ## Handler as a function\n   *\n   * If `handler` is a function, the function is invoked with:\n   *\n   * - regexp match array (from `regexp`)\n   * - url: the current Url ([[UrlParts]])\n   * - router: the router object ([[UIRouter]])\n   *\n   * #### Example:\n   * ```js\n   * var rule = factory.fromRegExp(/^\\/foo\\/(bar|baz)$/, match => \"/home/\" + match[1])\n   * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ]\n   * var result = rule.handler(match); // '/home/bar'\n   * ```\n   *\n   * ## Handler as string\n   *\n   * If `handler` is a string, the url is *replaced by the string* when the Rule is invoked.\n   * The string is first interpolated using `string.replace()` style pattern.\n   *\n   * #### Example:\n   * ```js\n   * var rule = factory.fromRegExp(/^\\/foo\\/(bar|baz)$/, \"/home/$1\")\n   * var match = rule.match('/foo/bar'); // results in [ '/foo/bar', 'bar' ]\n   * var result = rule.handler(match); // '/home/bar'\n   * ```\n   */\n  fromRegExp(regexp: RegExp, handler: string | UrlRuleHandlerFn): RegExpRule {\n    if (regexp.global || regexp.sticky) throw new Error('Rule RegExp must not be global or sticky');\n\n    /**\n     * If handler is a string, the url will be replaced by the string.\n     * If the string has any String.replace() style variables in it (like `$2`),\n     * they will be replaced by the captures from [[match]]\n     */\n    const redirectUrlTo = (match: RegExpExecArray) =>\n      // Interpolates matched values into $1 $2, etc using a String.replace()-style pattern\n      (handler as string).replace(/\\$(\\$|\\d{1,2})/, (m, what) => match[what === '$' ? 0 : Number(what)]);\n\n    const _handler = isString(handler) ? redirectUrlTo : handler;\n\n    const matchParamsFromRegexp = (url: UrlParts): RegExpExecArray => regexp.exec(url.path);\n\n    const details = { regexp, type: 'REGEXP' };\n    return extend(new BaseUrlRule(matchParamsFromRegexp, _handler), details) as RegExpRule;\n  }\n}\n\n/**\n * A base rule which calls `match`\n *\n * The value from the `match` function is passed through to the `handler`.\n * @internalapi\n */\nexport class BaseUrlRule implements UrlRule {\n  $id: number;\n  priority: number;\n  _group: number;\n  type: UrlRuleType = 'RAW';\n  handler: UrlRuleHandlerFn;\n  matchPriority = match => 0 - this.$id;\n\n  constructor(public match: UrlRuleMatchFn, handler?: UrlRuleHandlerFn) {\n    this.handler = handler || identity;\n  }\n}\n",
    "/** @publicapi @module url */ /** */\nimport { stripLastPathElement } from '../common';\nimport { UrlMatcher } from './urlMatcher';\nimport { RawParams } from '../params';\nimport { UIRouter } from '../router';\nimport { UrlRuleFactory } from './urlRule';\nimport { MatchResult, UrlParts, UrlRule, UrlRuleHandlerFn } from './interface';\nimport { TargetState, TargetStateDef } from '../state';\n\n/** @hidden */\nfunction appendBasePath(url: string, isHtml5: boolean, absolute: boolean, baseHref: string): string {\n  if (baseHref === '/') return url;\n  if (isHtml5) return stripLastPathElement(baseHref) + url;\n  if (absolute) return baseHref.slice(1) + url;\n  return url;\n}\n\n/**\n * Updates URL and responds to URL changes\n *\n * ### Deprecation warning:\n * This class is now considered to be an internal API\n * Use the [[UrlService]] instead.\n * For configuring URL rules, use the [[UrlRules]] which can be found as [[UrlService.rules]].\n *\n * @internalapi\n */\nexport class UrlRouter {\n  /** used to create [[UrlRule]] objects for common cases */\n  public urlRuleFactory: UrlRuleFactory;\n  /** @hidden */ private location: string;\n\n  /** @hidden */\n  constructor(/** @hidden */ private router: UIRouter) {\n    this.urlRuleFactory = new UrlRuleFactory(router);\n  }\n\n  /**\n   * Internal API.\n   * @internalapi\n   */\n  update(read?: boolean) {\n    const $url = this.router.locationService;\n    if (read) {\n      this.location = $url.url();\n      return;\n    }\n    if ($url.url() === this.location) return;\n\n    $url.url(this.location, true);\n  }\n\n  /**\n   * Internal API.\n   *\n   * Pushes a new location to the browser history.\n   *\n   * @internalapi\n   * @param urlMatcher\n   * @param params\n   * @param options\n   */\n  push(urlMatcher: UrlMatcher, params?: RawParams, options?: { replace?: string | boolean }) {\n    const replace = options && !!options.replace;\n    this.router.urlService.url(urlMatcher.format(params || {}), replace);\n  }\n\n  /**\n   * Builds and returns a URL with interpolated parameters\n   *\n   * #### Example:\n   * ```js\n   * matcher = $umf.compile(\"/about/:person\");\n   * params = { person: \"bob\" };\n   * $bob = $urlRouter.href(matcher, params);\n   * // $bob == \"/about/bob\";\n   * ```\n   *\n   * @param urlMatcher The [[UrlMatcher]] object which is used as the template of the URL to generate.\n   * @param params An object of parameter values to fill the matcher's required parameters.\n   * @param options Options object. The options are:\n   *\n   * - **`absolute`** - {boolean=false},  If true will generate an absolute url, e.g. \"http://www.example.com/fullurl\".\n   *\n   * @returns Returns the fully compiled URL, or `null` if `params` fail validation against `urlMatcher`\n   */\n  href(urlMatcher: UrlMatcher, params?: any, options?: { absolute: boolean }): string {\n    let url = urlMatcher.format(params);\n    if (url == null) return null;\n\n    options = options || { absolute: false };\n\n    const cfg = this.router.urlService.config;\n    const isHtml5 = cfg.html5Mode();\n    if (!isHtml5 && url !== null) {\n      url = '#' + cfg.hashPrefix() + url;\n    }\n    url = appendBasePath(url, isHtml5, options.absolute, cfg.baseHref());\n\n    if (!options.absolute || !url) {\n      return url;\n    }\n\n    const slash = !isHtml5 && url ? '/' : '';\n    const cfgPort = cfg.port();\n    const port = <any>(cfgPort === 80 || cfgPort === 443 ? '' : ':' + cfgPort);\n\n    return [cfg.protocol(), '://', cfg.host(), port, slash, url].join('');\n  }\n\n  // Delegate these calls to [[UrlService]]\n  /** @deprecated use [[UrlService.sync]]*/\n  public sync = (evt?) => this.router.urlService.sync(evt);\n  /** @deprecated use [[UrlService.listen]]*/\n  public listen = (enabled?: boolean): Function => this.router.urlService.listen(enabled);\n  /** @deprecated use [[UrlService.deferIntercept]]*/\n  public deferIntercept = (defer?: boolean) => this.router.urlService.deferIntercept(defer);\n  /** @deprecated use [[UrlService.interceptDeferred]]*/\n  public get interceptDeferred() {\n    return this.router.urlService.interceptDeferred;\n  }\n  /** @deprecated use [[UrlService.match]]*/\n  public match = (urlParts: UrlParts): MatchResult => this.router.urlService.match(urlParts);\n\n  // Delegate these calls to [[UrlRules]]\n  /** @deprecated use [[UrlRules.initial]]*/\n  public initial = (handler: string | UrlRuleHandlerFn | TargetState | TargetStateDef): void =>\n    this.router.urlService.rules.initial(handler);\n  /** @deprecated use [[UrlRules.otherwise]]*/\n  public otherwise = (handler: string | UrlRuleHandlerFn | TargetState | TargetStateDef): void =>\n    this.router.urlService.rules.otherwise(handler);\n  /** @deprecated use [[UrlRules.removeRule]]*/\n  public removeRule = (rule: UrlRule): void => this.router.urlService.rules.removeRule(rule);\n  /** @deprecated use [[UrlRules.rule]]*/\n  public rule = (rule: UrlRule): Function => this.router.urlService.rules.rule(rule);\n  /** @deprecated use [[UrlRules.rules]]*/\n  public rules = (): UrlRule[] => this.router.urlService.rules.rules();\n  /** @deprecated use [[UrlRules.sort]]*/\n  public sort = (compareFn?: (a: UrlRule, b: UrlRule) => number) => this.router.urlService.rules.sort(compareFn);\n  /** @deprecated use [[UrlRules.when]]*/\n  public when = (\n    matcher: RegExp | UrlMatcher | string,\n    handler: string | UrlRuleHandlerFn,\n    options?: { priority: number }\n  ): UrlRule => this.router.urlService.rules.when(matcher, handler, options);\n}\n",
    "/** @publicapi @module view */ /** */\nimport { equals, applyPairs, removeFrom, TypedMap, inArray, find } from '../common/common';\nimport { curry, prop } from '../common/hof';\nimport { isString, isArray } from '../common/predicates';\nimport { trace } from '../common/trace';\nimport { PathNode } from '../path/pathNode';\nimport { ActiveUIView, ViewContext, ViewConfig } from './interface';\nimport { _ViewDeclaration } from '../state/interface';\nimport { UIRouter } from '../router';\n\nexport type ViewConfigFactory = (path: PathNode[], decl: _ViewDeclaration) => ViewConfig | ViewConfig[];\n\nexport interface ViewServicePluginAPI {\n  _rootViewContext(context?: ViewContext): ViewContext;\n  _viewConfigFactory(viewType: string, factory: ViewConfigFactory);\n  /** @param id router.$id + \".\" + uiView.id */\n  _registeredUIView(id: string): ActiveUIView;\n  _registeredUIViews(): ActiveUIView[];\n  _activeViewConfigs(): ViewConfig[];\n  _onSync(listener: ViewSyncListener): Function;\n}\n\n// A uiView and its matching viewConfig\nexport interface ViewTuple {\n  uiView: ActiveUIView;\n  viewConfig: ViewConfig;\n}\n\nexport interface ViewSyncListener {\n  (viewTuples: ViewTuple[]): void;\n}\n\n/**\n * The View service\n *\n * This service pairs existing `ui-view` components (which live in the DOM)\n * with view configs (from the state declaration objects: [[StateDeclaration.views]]).\n *\n * - After a successful Transition, the views from the newly entered states are activated via [[activateViewConfig]].\n *   The views from exited states are deactivated via [[deactivateViewConfig]].\n *   (See: the [[registerActivateViews]] Transition Hook)\n *\n * - As `ui-view` components pop in and out of existence, they register themselves using [[registerUIView]].\n *\n * - When the [[sync]] function is called, the registered `ui-view`(s) ([[ActiveUIView]])\n * are configured with the matching [[ViewConfig]](s)\n *\n */\nexport class ViewService {\n  /** @hidden */ private _uiViews: ActiveUIView[] = [];\n  /** @hidden */ private _viewConfigs: ViewConfig[] = [];\n  /** @hidden */ private _rootContext: ViewContext;\n  /** @hidden */ private _viewConfigFactories: { [key: string]: ViewConfigFactory } = {};\n  /** @hidden */ private _listeners: ViewSyncListener[] = [];\n\n  /** @internalapi */\n  public _pluginapi: ViewServicePluginAPI = {\n    _rootViewContext: this._rootViewContext.bind(this),\n    _viewConfigFactory: this._viewConfigFactory.bind(this),\n    _registeredUIView: (id: string) => find(this._uiViews, view => `${this.router.$id}.${view.id}` === id),\n    _registeredUIViews: () => this._uiViews,\n    _activeViewConfigs: () => this._viewConfigs,\n    _onSync: (listener: ViewSyncListener) => {\n      this._listeners.push(listener);\n      return () => removeFrom(this._listeners, listener);\n    },\n  };\n\n  /**\n   * Given a ui-view and a ViewConfig, determines if they \"match\".\n   *\n   * A ui-view has a fully qualified name (fqn) and a context object.  The fqn is built from its overall location in\n   * the DOM, describing its nesting relationship to any parent ui-view tags it is nested inside of.\n   *\n   * A ViewConfig has a target ui-view name and a context anchor.  The ui-view name can be a simple name, or\n   * can be a segmented ui-view path, describing a portion of a ui-view fqn.\n   *\n   * In order for a ui-view to match ViewConfig, ui-view's $type must match the ViewConfig's $type\n   *\n   * If the ViewConfig's target ui-view name is a simple name (no dots), then a ui-view matches if:\n   * - the ui-view's name matches the ViewConfig's target name\n   * - the ui-view's context matches the ViewConfig's anchor\n   *\n   * If the ViewConfig's target ui-view name is a segmented name (with dots), then a ui-view matches if:\n   * - There exists a parent ui-view where:\n   *    - the parent ui-view's name matches the first segment (index 0) of the ViewConfig's target name\n   *    - the parent ui-view's context matches the ViewConfig's anchor\n   * - And the remaining segments (index 1..n) of the ViewConfig's target name match the tail of the ui-view's fqn\n   *\n   * Example:\n   *\n   * DOM:\n   * <ui-view>                        <!-- created in the root context (name: \"\") -->\n   *   <ui-view name=\"foo\">                <!-- created in the context named: \"A\"      -->\n   *     <ui-view>                    <!-- created in the context named: \"A.B\"    -->\n   *       <ui-view name=\"bar\">            <!-- created in the context named: \"A.B.C\"  -->\n   *       </ui-view>\n   *     </ui-view>\n   *   </ui-view>\n   * </ui-view>\n   *\n   * uiViews: [\n   *  { fqn: \"$default\",                  creationContext: { name: \"\" } },\n   *  { fqn: \"$default.foo\",              creationContext: { name: \"A\" } },\n   *  { fqn: \"$default.foo.$default\",     creationContext: { name: \"A.B\" } }\n   *  { fqn: \"$default.foo.$default.bar\", creationContext: { name: \"A.B.C\" } }\n   * ]\n   *\n   * These four view configs all match the ui-view with the fqn: \"$default.foo.$default.bar\":\n   *\n   * - ViewConfig1: { uiViewName: \"bar\",                       uiViewContextAnchor: \"A.B.C\" }\n   * - ViewConfig2: { uiViewName: \"$default.bar\",              uiViewContextAnchor: \"A.B\" }\n   * - ViewConfig3: { uiViewName: \"foo.$default.bar\",          uiViewContextAnchor: \"A\" }\n   * - ViewConfig4: { uiViewName: \"$default.foo.$default.bar\", uiViewContextAnchor: \"\" }\n   *\n   * Using ViewConfig3 as an example, it matches the ui-view with fqn \"$default.foo.$default.bar\" because:\n   * - The ViewConfig's segmented target name is: [ \"foo\", \"$default\", \"bar\" ]\n   * - There exists a parent ui-view (which has fqn: \"$default.foo\") where:\n   *    - the parent ui-view's name \"foo\" matches the first segment \"foo\" of the ViewConfig's target name\n   *    - the parent ui-view's context \"A\" matches the ViewConfig's anchor context \"A\"\n   * - And the remaining segments [ \"$default\", \"bar\" ].join(\".\"_ of the ViewConfig's target name match\n   *   the tail of the ui-view's fqn \"default.bar\"\n   *\n   * @internalapi\n   */\n  static matches = (uiViewsByFqn: TypedMap<ActiveUIView>, uiView: ActiveUIView) => (viewConfig: ViewConfig) => {\n    // Don't supply an ng1 ui-view with an ng2 ViewConfig, etc\n    if (uiView.$type !== viewConfig.viewDecl.$type) return false;\n\n    // Split names apart from both viewConfig and uiView into segments\n    const vc = viewConfig.viewDecl;\n    const vcSegments = vc.$uiViewName.split('.');\n    const uivSegments = uiView.fqn.split('.');\n\n    // Check if the tails of the segment arrays match. ex, these arrays' tails match:\n    // vc: [\"foo\", \"bar\"], uiv fqn: [\"$default\", \"foo\", \"bar\"]\n    if (!equals(vcSegments, uivSegments.slice(0 - vcSegments.length))) return false;\n\n    // Now check if the fqn ending at the first segment of the viewConfig matches the context:\n    // [\"$default\", \"foo\"].join(\".\") == \"$default.foo\", does the ui-view $default.foo context match?\n    const negOffset = 1 - vcSegments.length || undefined;\n    const fqnToFirstSegment = uivSegments.slice(0, negOffset).join('.');\n    const uiViewContext = uiViewsByFqn[fqnToFirstSegment].creationContext;\n    return vc.$uiViewContextAnchor === (uiViewContext && uiViewContext.name);\n  };\n\n  /**\n   * Normalizes a view's name from a state.views configuration block.\n   *\n   * This should be used by a framework implementation to calculate the values for\n   * [[_ViewDeclaration.$uiViewName]] and [[_ViewDeclaration.$uiViewContextAnchor]].\n   *\n   * @param context the context object (state declaration) that the view belongs to\n   * @param rawViewName the name of the view, as declared in the [[StateDeclaration.views]]\n   *\n   * @returns the normalized uiViewName and uiViewContextAnchor that the view targets\n   */\n  static normalizeUIViewTarget(context: ViewContext, rawViewName = '') {\n    // TODO: Validate incoming view name with a regexp to allow:\n    // ex: \"view.name@foo.bar\" , \"^.^.view.name\" , \"view.name@^.^\" , \"\" ,\n    // \"@\" , \"$default@^\" , \"!$default.$default\" , \"!foo.bar\"\n    const viewAtContext: string[] = rawViewName.split('@');\n    let uiViewName = viewAtContext[0] || '$default'; // default to unnamed view\n    let uiViewContextAnchor = isString(viewAtContext[1]) ? viewAtContext[1] : '^'; // default to parent context\n\n    // Handle relative view-name sugar syntax.\n    // Matches rawViewName \"^.^.^.foo.bar\" into array: [\"^.^.^.foo.bar\", \"^.^.^\", \"foo.bar\"],\n    const relativeViewNameSugar = /^(\\^(?:\\.\\^)*)\\.(.*$)/.exec(uiViewName);\n    if (relativeViewNameSugar) {\n      // Clobbers existing contextAnchor (rawViewName validation will fix this)\n      uiViewContextAnchor = relativeViewNameSugar[1]; // set anchor to \"^.^.^\"\n      uiViewName = relativeViewNameSugar[2]; // set view-name to \"foo.bar\"\n    }\n\n    if (uiViewName.charAt(0) === '!') {\n      uiViewName = uiViewName.substr(1);\n      uiViewContextAnchor = ''; // target absolutely from root\n    }\n\n    // handle parent relative targeting \"^.^.^\"\n    const relativeMatch = /^(\\^(?:\\.\\^)*)$/;\n    if (relativeMatch.exec(uiViewContextAnchor)) {\n      const anchorState = uiViewContextAnchor.split('.').reduce((anchor, x) => anchor.parent, context);\n      uiViewContextAnchor = anchorState.name;\n    } else if (uiViewContextAnchor === '.') {\n      uiViewContextAnchor = context.name;\n    }\n\n    return { uiViewName, uiViewContextAnchor };\n  }\n\n  /** @hidden */\n  constructor(/** @hidden */ private router: UIRouter) {}\n\n  /** @hidden */\n  private _rootViewContext(context?: ViewContext): ViewContext {\n    return (this._rootContext = context || this._rootContext);\n  }\n  /** @hidden */\n  private _viewConfigFactory(viewType: string, factory: ViewConfigFactory) {\n    this._viewConfigFactories[viewType] = factory;\n  }\n\n  createViewConfig(path: PathNode[], decl: _ViewDeclaration): ViewConfig[] {\n    const cfgFactory = this._viewConfigFactories[decl.$type];\n    if (!cfgFactory) throw new Error('ViewService: No view config factory registered for type ' + decl.$type);\n    const cfgs = cfgFactory(path, decl);\n    return isArray(cfgs) ? cfgs : [cfgs];\n  }\n\n  /**\n   * Deactivates a ViewConfig.\n   *\n   * This function deactivates a `ViewConfig`.\n   * After calling [[sync]], it will un-pair from any `ui-view` with which it is currently paired.\n   *\n   * @param viewConfig The ViewConfig view to deregister.\n   */\n  deactivateViewConfig(viewConfig: ViewConfig) {\n    trace.traceViewServiceEvent('<- Removing', viewConfig);\n    removeFrom(this._viewConfigs, viewConfig);\n  }\n\n  activateViewConfig(viewConfig: ViewConfig) {\n    trace.traceViewServiceEvent('-> Registering', <any>viewConfig);\n    this._viewConfigs.push(viewConfig);\n  }\n\n  sync() {\n    const uiViewsByFqn: TypedMap<ActiveUIView> = this._uiViews.map(uiv => [uiv.fqn, uiv]).reduce(applyPairs, <any>{});\n\n    // Return a weighted depth value for a uiView.\n    // The depth is the nesting depth of ui-views (based on FQN; times 10,000)\n    // plus the depth of the state that is populating the uiView\n    function uiViewDepth(uiView: ActiveUIView) {\n      const stateDepth = (context: ViewContext) => (context && context.parent ? stateDepth(context.parent) + 1 : 1);\n      return uiView.fqn.split('.').length * 10000 + stateDepth(uiView.creationContext);\n    }\n\n    // Return the ViewConfig's context's depth in the context tree.\n    function viewConfigDepth(config: ViewConfig) {\n      let context: ViewContext = config.viewDecl.$context,\n        count = 0;\n      while (++count && context.parent) context = context.parent;\n      return count;\n    }\n\n    // Given a depth function, returns a compare function which can return either ascending or descending order\n    const depthCompare = curry((depthFn, posNeg, left, right) => posNeg * (depthFn(left) - depthFn(right)));\n\n    const matchingConfigPair = (uiView: ActiveUIView): ViewTuple => {\n      const matchingConfigs = this._viewConfigs.filter(ViewService.matches(uiViewsByFqn, uiView));\n      if (matchingConfigs.length > 1) {\n        // This is OK.  Child states can target a ui-view that the parent state also targets (the child wins)\n        // Sort by depth and return the match from the deepest child\n        // console.log(`Multiple matching view configs for ${uiView.fqn}`, matchingConfigs);\n        matchingConfigs.sort(depthCompare(viewConfigDepth, -1)); // descending\n      }\n      return { uiView, viewConfig: matchingConfigs[0] };\n    };\n\n    const configureUIView = (tuple: ViewTuple) => {\n      // If a parent ui-view is reconfigured, it could destroy child ui-views.\n      // Before configuring a child ui-view, make sure it's still in the active uiViews array.\n      if (this._uiViews.indexOf(tuple.uiView) !== -1) tuple.uiView.configUpdated(tuple.viewConfig);\n    };\n\n    // Sort views by FQN and state depth. Process uiviews nearest the root first.\n    const uiViewTuples = this._uiViews.sort(depthCompare(uiViewDepth, 1)).map(matchingConfigPair);\n    const matchedViewConfigs = uiViewTuples.map(tuple => tuple.viewConfig);\n    const unmatchedConfigTuples = this._viewConfigs\n      .filter(config => !inArray(matchedViewConfigs, config))\n      .map(viewConfig => ({ uiView: undefined, viewConfig }));\n\n    uiViewTuples.forEach(configureUIView);\n\n    const allTuples: ViewTuple[] = uiViewTuples.concat(unmatchedConfigTuples);\n    this._listeners.forEach(cb => cb(allTuples));\n    trace.traceViewSync(allTuples);\n  }\n\n  /**\n   * Registers a `ui-view` component\n   *\n   * When a `ui-view` component is created, it uses this method to register itself.\n   * After registration the [[sync]] method is used to ensure all `ui-view` are configured with the proper [[ViewConfig]].\n   *\n   * Note: the `ui-view` component uses the `ViewConfig` to determine what view should be loaded inside the `ui-view`,\n   * and what the view's state context is.\n   *\n   * Note: There is no corresponding `deregisterUIView`.\n   *       A `ui-view` should hang on to the return value of `registerUIView` and invoke it to deregister itself.\n   *\n   * @param uiView The metadata for a UIView\n   * @return a de-registration function used when the view is destroyed.\n   */\n  registerUIView(uiView: ActiveUIView) {\n    trace.traceViewServiceUIViewEvent('-> Registering', uiView);\n    const uiViews = this._uiViews;\n    const fqnAndTypeMatches = (uiv: ActiveUIView) => uiv.fqn === uiView.fqn && uiv.$type === uiView.$type;\n    if (uiViews.filter(fqnAndTypeMatches).length)\n      trace.traceViewServiceUIViewEvent('!!!! duplicate uiView named:', uiView);\n\n    uiViews.push(uiView);\n    this.sync();\n\n    return () => {\n      const idx = uiViews.indexOf(uiView);\n      if (idx === -1) {\n        trace.traceViewServiceUIViewEvent('Tried removing non-registered uiView', uiView);\n        return;\n      }\n      trace.traceViewServiceUIViewEvent('<- Deregistering', uiView);\n      removeFrom(uiViews)(uiView);\n    };\n  }\n\n  /**\n   * Returns the list of views currently available on the page, by fully-qualified name.\n   *\n   * @return {Array} Returns an array of fully-qualified view names.\n   */\n  available() {\n    return this._uiViews.map(prop('fqn'));\n  }\n\n  /**\n   * Returns the list of views on the page containing loaded content.\n   *\n   * @return {Array} Returns an array of fully-qualified view names.\n   */\n  active() {\n    return this._uiViews.filter(prop('$config')).map(prop('name'));\n  }\n}\n",
    "/** @publicapi @module core */ /** */\nimport { StateParams } from './params/stateParams';\nimport { StateDeclaration } from './state/interface';\nimport { StateObject } from './state/stateObject';\nimport { Transition } from './transition/transition';\nimport { Queue } from './common/queue';\nimport { Disposable } from './interface';\n\n/**\n * Global router state\n *\n * This is where we hold the global mutable state such as current state, current\n * params, current transition, etc.\n */\nexport class UIRouterGlobals implements Disposable {\n  /**\n   * Current parameter values\n   *\n   * The parameter values from the latest successful transition\n   */\n  params: StateParams = new StateParams();\n\n  /**\n   * Current state\n   *\n   * The to-state from the latest successful transition\n   */\n  current: StateDeclaration;\n\n  /**\n   * Current state (internal object)\n   *\n   * The to-state from the latest successful transition\n   * @internalapi\n   */\n  $current: StateObject;\n\n  /**\n   * The current started/running transition.\n   * This transition has reached at least the onStart phase, but is not yet complete\n   */\n  transition: Transition;\n\n  /** @internalapi */\n  lastStartedTransitionId = -1;\n\n  /** @internalapi */\n  transitionHistory = new Queue<Transition>([], 1);\n\n  /** @internalapi */\n  successfulTransitions = new Queue<Transition>([], 1);\n\n  dispose() {\n    this.transitionHistory.clear();\n    this.successfulTransitions.clear();\n    this.transition = null;\n  }\n}\n",
    "/** @publicapi @module url */ /** */\nimport { UIRouter } from '../router';\nimport { Disposable } from '../interface';\nimport { MatcherUrlRule, UrlRule, UrlRuleHandlerFn, UrlRuleMatchFn, UrlRulesApi } from './interface';\nimport { TargetState, TargetStateDef } from '../state';\nimport { UrlMatcher } from './urlMatcher';\nimport { is, isDefined, isFunction, isString, removeFrom, val } from '../common';\nimport { UrlRuleFactory } from './urlRule';\n\n/** @hidden */\nconst prioritySort = (a: UrlRule, b: UrlRule) => (b.priority || 0) - (a.priority || 0);\n\n/** @hidden */\nconst typeSort = (a: UrlRule, b: UrlRule) => {\n  const weights = { STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1 };\n  return (weights[a.type] || 0) - (weights[b.type] || 0);\n};\n\n/** @hidden */\nconst urlMatcherSort = (a: MatcherUrlRule, b: MatcherUrlRule) =>\n  !a.urlMatcher || !b.urlMatcher ? 0 : UrlMatcher.compare(a.urlMatcher, b.urlMatcher);\n\n/** @hidden */\nconst idSort = (a: UrlRule, b: UrlRule) => {\n  // Identically sorted STATE and URLMATCHER best rule will be chosen by `matchPriority` after each rule matches the URL\n  const useMatchPriority = { STATE: true, URLMATCHER: true };\n  const equal = useMatchPriority[a.type] && useMatchPriority[b.type];\n  return equal ? 0 : (a.$id || 0) - (b.$id || 0);\n};\n\n/**\n * Default rule priority sorting function.\n *\n * Sorts rules by:\n *\n * - Explicit priority (set rule priority using [[UrlRules.when]])\n * - Rule type (STATE: 4, URLMATCHER: 4, REGEXP: 3, RAW: 2, OTHER: 1)\n * - `UrlMatcher` specificity ([[UrlMatcher.compare]]): works for STATE and URLMATCHER types to pick the most specific rule.\n * - Rule registration order (for rule types other than STATE and URLMATCHER)\n *   - Equally sorted State and UrlMatcher rules will each match the URL.\n *     Then, the *best* match is chosen based on how many parameter values were matched.\n *\n * @publicapi\n */\nlet defaultRuleSortFn: (a: UrlRule, b: UrlRule) => number;\ndefaultRuleSortFn = (a, b) => {\n  let cmp = prioritySort(a, b);\n  if (cmp !== 0) return cmp;\n\n  cmp = typeSort(a, b);\n  if (cmp !== 0) return cmp;\n\n  cmp = urlMatcherSort(a as MatcherUrlRule, b as MatcherUrlRule);\n  if (cmp !== 0) return cmp;\n\n  return idSort(a, b);\n};\n\n/** @hidden */\nfunction getHandlerFn(handler: string | UrlRuleHandlerFn | TargetState | TargetStateDef): UrlRuleHandlerFn {\n  if (!isFunction(handler) && !isString(handler) && !is(TargetState)(handler) && !TargetState.isDef(handler)) {\n    throw new Error(\"'handler' must be a string, function, TargetState, or have a state: 'newtarget' property\");\n  }\n  return isFunction(handler) ? (handler as UrlRuleHandlerFn) : val(handler);\n}\n\n/**\n * API for managing URL rules\n *\n * This API is used to create and manage URL rules.\n * URL rules are a mechanism to respond to specific URL patterns.\n *\n * The most commonly used methods are [[otherwise]] and [[when]].\n *\n * This API is a property of [[UrlService]] as [[UrlService.rules]]\n *\n * @publicapi\n */\nexport class UrlRules implements Disposable {\n  /** used to create [[UrlRule]] objects for common cases */\n  public urlRuleFactory: UrlRuleFactory;\n\n  /** @hidden */ private _sortFn = defaultRuleSortFn;\n  /** @hidden */ private _otherwiseFn: UrlRule;\n  /** @hidden */ private _sorted: boolean;\n  /** @hidden */ private _rules: UrlRule[] = [];\n  /** @hidden */ private _id = 0;\n\n  /** @hidden */\n  constructor(/** @hidden */ private router: UIRouter) {\n    this.urlRuleFactory = new UrlRuleFactory(router);\n  }\n\n  /** @hidden */\n  public dispose(router?: UIRouter) {\n    this._rules = [];\n    delete this._otherwiseFn;\n  }\n\n  /**\n   * Defines the initial state, path, or behavior to use when the app starts.\n   *\n   * This rule defines the initial/starting state for the application.\n   *\n   * This rule is triggered the first time the URL is checked (when the app initially loads).\n   * The rule is triggered only when the url matches either `\"\"` or `\"/\"`.\n   *\n   * Note: The rule is intended to be used when the root of the application is directly linked to.\n   * When the URL is *not* `\"\"` or `\"/\"` and doesn't match other rules, the [[otherwise]] rule is triggered.\n   * This allows 404-like behavior when an unknown URL is deep-linked.\n   *\n   * #### Example:\n   * Start app at `home` state.\n   * ```js\n   * .initial({ state: 'home' });\n   * ```\n   *\n   * #### Example:\n   * Start app at `/home` (by url)\n   * ```js\n   * .initial('/home');\n   * ```\n   *\n   * #### Example:\n   * When no other url rule matches, go to `home` state\n   * ```js\n   * .initial((matchValue, url, router) => {\n   *   console.log('initial state');\n   *   return { state: 'home' };\n   * })\n   * ```\n   *\n   * @param handler The initial state or url path, or a function which returns the state or url path (or performs custom logic).\n   */\n  public initial(handler: string | UrlRuleHandlerFn | TargetState | TargetStateDef) {\n    const handlerFn: UrlRuleHandlerFn = getHandlerFn(handler);\n    const matchFn: UrlRuleMatchFn = (urlParts, router) =>\n      router.globals.transitionHistory.size() === 0 && !!/^\\/?$/.exec(urlParts.path);\n\n    this.rule(this.urlRuleFactory.create(matchFn, handlerFn));\n  }\n\n  /**\n   * Defines the state, url, or behavior to use when no other rule matches the URL.\n   *\n   * This rule is matched when *no other rule* matches.\n   * It is generally used to handle unknown URLs (similar to \"404\" behavior, but on the client side).\n   *\n   * - If `handler` a string, it is treated as a url redirect\n   *\n   * #### Example:\n   * When no other url rule matches, redirect to `/index`\n   * ```js\n   * .otherwise('/index');\n   * ```\n   *\n   * - If `handler` is an object with a `state` property, the state is activated.\n   *\n   * #### Example:\n   * When no other url rule matches, redirect to `home` and provide a `dashboard` parameter value.\n   * ```js\n   * .otherwise({ state: 'home', params: { dashboard: 'default' } });\n   * ```\n   *\n   * - If `handler` is a function, the function receives the current url ([[UrlParts]]) and the [[UIRouter]] object.\n   *   The function can perform actions, and/or return a value.\n   *\n   * #### Example:\n   * When no other url rule matches, manually trigger a transition to the `home` state\n   * ```js\n   * .otherwise((matchValue, urlParts, router) => {\n   *   router.stateService.go('home');\n   * });\n   * ```\n   *\n   * #### Example:\n   * When no other url rule matches, go to `home` state\n   * ```js\n   * .otherwise((matchValue, urlParts, router) => {\n   *   return { state: 'home' };\n   * });\n   * ```\n   *\n   * @param handler The url path to redirect to, or a function which returns the url path (or performs custom logic).\n   */\n  public otherwise(handler: string | UrlRuleHandlerFn | TargetState | TargetStateDef) {\n    const handlerFn: UrlRuleHandlerFn = getHandlerFn(handler);\n\n    this._otherwiseFn = this.urlRuleFactory.create(val(true), handlerFn);\n    this._sorted = false;\n  }\n\n  /**\n   * Remove a rule previously registered\n   *\n   * @param rule the matcher rule that was previously registered using [[rule]]\n   */\n  public removeRule(rule): void {\n    removeFrom(this._rules, rule);\n  }\n\n  /**\n   * Manually adds a URL Rule.\n   *\n   * Usually, a url rule is added using [[StateDeclaration.url]] or [[when]].\n   * This api can be used directly for more control (to register a [[BaseUrlRule]], for example).\n   * Rules can be created using [[urlRuleFactory]], or created manually as simple objects.\n   *\n   * A rule should have a `match` function which returns truthy if the rule matched.\n   * It should also have a `handler` function which is invoked if the rule is the best match.\n   *\n   * @return a function that deregisters the rule\n   */\n  public rule(rule: UrlRule): Function {\n    if (!UrlRuleFactory.isUrlRule(rule)) throw new Error('invalid rule');\n    rule.$id = this._id++;\n    rule.priority = rule.priority || 0;\n\n    this._rules.push(rule);\n    this._sorted = false;\n\n    return () => this.removeRule(rule);\n  }\n\n  /**\n   * Gets all registered rules\n   *\n   * @returns an array of all the registered rules\n   */\n  public rules(): UrlRule[] {\n    this.ensureSorted();\n    return this._rules.concat(this._otherwiseFn ? [this._otherwiseFn] : []);\n  }\n\n  /**\n   * Defines URL Rule priorities\n   *\n   * More than one rule ([[UrlRule]]) might match a given URL.\n   * This `compareFn` is used to sort the rules by priority.\n   * Higher priority rules should sort earlier.\n   *\n   * The [[defaultRuleSortFn]] is used by default.\n   *\n   * You only need to call this function once.\n   * The `compareFn` will be used to sort the rules as each is registered.\n   *\n   * If called without any parameter, it will re-sort the rules.\n   *\n   * ---\n   *\n   * Url rules may come from multiple sources: states's urls ([[StateDeclaration.url]]), [[when]], and [[rule]].\n   * Each rule has a (user-provided) [[UrlRule.priority]], a [[UrlRule.type]], and a [[UrlRule.$id]]\n   * The `$id` is is the order in which the rule was registered.\n   *\n   * The sort function should use these data, or data found on a specific type\n   * of [[UrlRule]] (such as [[StateRule.state]]), to order the rules as desired.\n   *\n   * #### Example:\n   * This compare function prioritizes rules by the order in which the rules were registered.\n   * A rule registered earlier has higher priority.\n   *\n   * ```js\n   * function compareFn(a, b) {\n   *   return a.$id - b.$id;\n   * }\n   * ```\n   *\n   * @param compareFn a function that compares to [[UrlRule]] objects.\n   *    The `compareFn` should abide by the `Array.sort` compare function rules.\n   *    Given two rules, `a` and `b`, return a negative number if `a` should be higher priority.\n   *    Return a positive number if `b` should be higher priority.\n   *    Return `0` if the rules are identical.\n   *\n   *    See the [mozilla reference](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Description)\n   *    for details.\n   */\n  sort(compareFn?: (a: UrlRule, b: UrlRule) => number) {\n    const sorted = this.stableSort(this._rules, (this._sortFn = compareFn || this._sortFn));\n\n    // precompute _sortGroup values and apply to each rule\n    let group = 0;\n    for (let i = 0; i < sorted.length; i++) {\n      sorted[i]._group = group;\n      if (i < sorted.length - 1 && this._sortFn(sorted[i], sorted[i + 1]) !== 0) {\n        group++;\n      }\n    }\n\n    this._rules = sorted;\n    this._sorted = true;\n  }\n\n  /** @hidden */\n  private ensureSorted() {\n    this._sorted || this.sort();\n  }\n\n  /** @hidden */\n  private stableSort(arr, compareFn) {\n    const arrOfWrapper = arr.map((elem, idx) => ({ elem, idx }));\n\n    arrOfWrapper.sort((wrapperA, wrapperB) => {\n      const cmpDiff = compareFn(wrapperA.elem, wrapperB.elem);\n      return cmpDiff === 0 ? wrapperA.idx - wrapperB.idx : cmpDiff;\n    });\n\n    return arrOfWrapper.map(wrapper => wrapper.elem);\n  }\n\n  /**\n   * Registers a `matcher` and `handler` for custom URLs handling.\n   *\n   * The `matcher` can be:\n   *\n   * - a [[UrlMatcher]]: See: [[UrlMatcherFactory.compile]]\n   * - a `string`: The string is compiled to a [[UrlMatcher]]\n   * - a `RegExp`: The regexp is used to match the url.\n   *\n   * The `handler` can be:\n   *\n   * - a string: The url is redirected to the value of the string.\n   * - a function: The url is redirected to the return value of the function.\n   *\n   * ---\n   *\n   * When the `handler` is a `string` and the `matcher` is a `UrlMatcher` (or string), the redirect\n   * string is interpolated with parameter values.\n   *\n   * #### Example:\n   * When the URL is `/foo/123` the rule will redirect to `/bar/123`.\n   * ```js\n   * .when(\"/foo/:param1\", \"/bar/:param1\")\n   * ```\n   *\n   * ---\n   *\n   * When the `handler` is a string and the `matcher` is a `RegExp`, the redirect string is\n   * interpolated with capture groups from the RegExp.\n   *\n   * #### Example:\n   * When the URL is `/foo/123` the rule will redirect to `/bar/123`.\n   * ```js\n   * .when(new RegExp(\"^/foo/(.*)$\"), \"/bar/$1\");\n   * ```\n   *\n   * ---\n   *\n   * When the handler is a function, it receives the matched value, the current URL, and the `UIRouter` object (See [[UrlRuleHandlerFn]]).\n   * The \"matched value\" differs based on the `matcher`.\n   * For [[UrlMatcher]]s, it will be the matched state params.\n   * For `RegExp`, it will be the match array from `regexp.exec()`.\n   *\n   * If the handler returns a string, the URL is redirected to the string.\n   *\n   * #### Example:\n   * When the URL is `/foo/123` the rule will redirect to `/bar/123`.\n   * ```js\n   * .when(new RegExp(\"^/foo/(.*)$\"), match => \"/bar/\" + match[1]);\n   * ```\n   *\n   * Note: the `handler` may also invoke arbitrary code, such as `$state.go()`\n   *\n   * @param matcher A pattern `string` to match, compiled as a [[UrlMatcher]], or a `RegExp`.\n   * @param handler The path to redirect to, or a function that returns the path.\n   * @param options `{ priority: number }`\n   *\n   * @return the registered [[UrlRule]]\n   */\n  public when(\n    matcher: RegExp | UrlMatcher | string,\n    handler: string | UrlRuleHandlerFn,\n    options?: { priority: number }\n  ): UrlRule {\n    const rule = this.urlRuleFactory.create(matcher, handler);\n    if (isDefined(options && options.priority)) rule.priority = options.priority;\n    this.rule(rule);\n    return rule;\n  }\n}\n",
    "/** @publicapi @module url */ /** */\nimport { Disposable } from '../interface';\nimport { UIRouter } from '../router';\nimport { ParamTypeDefinition, ParamTypes } from '../params';\nimport { isDefined, isString } from '../common';\n\n/**\n * An API to customize the URL behavior and retrieve URL configuration\n *\n * This API is used to customize the behavior of the URL.\n * This includes optional trailing slashes ([[strictMode]]), case sensitivity ([[caseInsensitive]]),\n * and custom parameter encoding (custom [[type]]).\n *\n * It also has information about the location (url) configuration such as [[port]] and [[baseHref]].\n * This information can be used to build absolute URLs, such as\n * `https://example.com:443/basepath/state/substate?param1=a#hashvalue`;\n *\n * This API is a property of [[UrlService]] as [[UrlService.config]].\n */\nexport class UrlConfig implements Disposable {\n  /** @hidden */ paramTypes = new ParamTypes();\n  /** @hidden */ _isCaseInsensitive = false;\n  /** @hidden */ _isStrictMode = true;\n  /** @hidden */ _defaultSquashPolicy: boolean | string = false;\n\n  /** @hidden */ constructor(/** @hidden */ private router: UIRouter) {}\n  /** @internalapi */ public dispose = () => this.paramTypes.dispose();\n\n  // Delegate these calls to the current LocationConfig implementation\n\n  /**\n   * Gets the base Href, e.g., `http://localhost/approot/`\n   *\n   * @return the application's base href\n   */\n  public baseHref = (): string => this.router.locationConfig.baseHref();\n\n  /**\n   * Gets or sets the hashPrefix\n   *\n   * This only applies when not running in [[html5Mode]] (pushstate mode)\n   *\n   * If the current url is `http://localhost/app#!/uirouter/path/#anchor`, it returns `!` which is the prefix for the \"hashbang\" portion.\n   *\n   * @return the hash prefix\n   */\n\n  public hashPrefix = (newprefix?: string): string => this.router.locationConfig.hashPrefix(newprefix);\n  /**\n   * Gets the host, e.g., `localhost`\n   *\n   * @return the protocol\n   */\n  public host = (): string => this.router.locationConfig.host();\n\n  /**\n   * Returns true when running in pushstate mode\n   *\n   * @return true when running in html5 mode (pushstate mode).\n   */\n  public html5Mode = (): boolean => this.router.locationConfig.html5Mode();\n\n  /**\n   * Gets the port, e.g., `80`\n   *\n   * @return the port number\n   */\n  public port = (): number => this.router.locationConfig.port();\n\n  /**\n   * Gets the protocol, e.g., `http`\n   *\n   * @return the protocol\n   */\n  public protocol = (): string => this.router.locationConfig.protocol();\n\n  /**\n   * Defines whether URL matching should be case sensitive (the default behavior), or not.\n   *\n   * #### Example:\n   * ```js\n   * // Allow case insensitive url matches\n   * urlService.config.caseInsensitive(true);\n   * ```\n   *\n   * @param value `false` to match URL in a case sensitive manner; otherwise `true`;\n   * @returns the current value of caseInsensitive\n   */\n  public caseInsensitive(value?: boolean): boolean {\n    return (this._isCaseInsensitive = isDefined(value) ? value : this._isCaseInsensitive);\n  }\n\n  /**\n   * Sets the default behavior when generating or matching URLs with default parameter values.\n   *\n   * #### Example:\n   * ```js\n   * // Remove default parameter values from the url\n   * urlService.config.defaultSquashPolicy(true);\n   * ```\n   *\n   * @param value A string that defines the default parameter URL squashing behavior.\n   *    - `nosquash`: When generating an href with a default parameter value, do not squash the parameter value from the URL\n   *    - `slash`: When generating an href with a default parameter value, squash (remove) the parameter value, and, if the\n   *      parameter is surrounded by slashes, squash (remove) one slash from the URL\n   *    - any other string, e.g. \"~\": When generating an href with a default parameter value, squash (remove)\n   *      the parameter value from the URL and replace it with this string.\n   * @returns the current value of defaultSquashPolicy\n   */\n  public defaultSquashPolicy(value?: boolean | string) {\n    if (isDefined(value) && value !== true && value !== false && !isString(value))\n      throw new Error(`Invalid squash policy: ${value}. Valid policies: false, true, arbitrary-string`);\n    return (this._defaultSquashPolicy = isDefined(value) ? value : this._defaultSquashPolicy);\n  }\n\n  /**\n   * Defines whether URLs should match trailing slashes, or not (the default behavior).\n   *\n   * #### Example:\n   * ```js\n   * // Allow optional trailing slashes\n   * urlService.config.strictMode(false);\n   * ```\n   *\n   * @param value `false` to match trailing slashes in URLs, otherwise `true`.\n   * @returns the current value of strictMode\n   */\n  public strictMode(value?: boolean): boolean {\n    return (this._isStrictMode = isDefined(value) ? value : this._isStrictMode);\n  }\n\n  /**\n   * Creates and registers a custom [[ParamType]] object\n   *\n   * A custom parameter type can be used to generate URLs with typed parameters or custom encoding/decoding.\n   *\n   * #### Note: Register custom types *before using them* in a state definition.\n   *\n   * #### Example:\n   * ```js\n   * // Encode object parameter as JSON string\n   * urlService.config.type('myjson', {\n   *   encode: (obj) => JSON.stringify(obj),\n   *   decode: (str) => JSON.parse(str),\n   *   is: (val) => typeof(val) === 'object',\n   *   pattern: /[^/]+/,\n   *   equals: (a, b) => _.isEqual(a, b),\n   * });\n   * ```\n   *\n   * See [[ParamTypeDefinition]] for more examples\n   *\n   * @param name The type name.\n   * @param definition The type definition. See [[ParamTypeDefinition]] for information on the values accepted.\n   * @param definitionFn A function that is injected before the app runtime starts.\n   *        The result of this function should be a [[ParamTypeDefinition]].\n   *        The result is merged into the existing `definition`.\n   *        See [[ParamType]] for information on the values accepted.\n   *\n   * @returns if only the `name` parameter was specified: the currently registered [[ParamType]] object, or undefined\n   */\n  type(name: string, definition?: ParamTypeDefinition, definitionFn?: () => ParamTypeDefinition) {\n    const type = this.paramTypes.type(name, definition, definitionFn);\n    return !isDefined(definition) ? type : this;\n  }\n}\n",
    "/** @publicapi @module url */ /** */\nimport { UIRouter } from '../router';\nimport { extend, is, isString, LocationServices, pattern } from '../common';\nimport { MatchResult, UrlParts, UrlRule, UrlSyncApi } from './interface';\nimport { UrlRules } from './urlRules';\nimport { UrlConfig } from './urlConfig';\nimport { TargetState, TargetStateDef } from '../state';\n\n/** API for URL management */\nexport class UrlService implements LocationServices, UrlSyncApi {\n  /** @hidden */ private _stopListeningFn: Function;\n  /** @hidden */ interceptDeferred = false;\n\n  /**\n   * The nested [[UrlRules]] API for managing URL rules and rewrites\n   *\n   * See: [[UrlRules]] for details\n   */\n  public rules = new UrlRules(this.router);\n\n  /**\n   * The nested [[UrlConfig]] API to configure the URL and retrieve URL information\n   *\n   * See: [[UrlConfig]] for details\n   */\n  public config = new UrlConfig(this.router);\n\n  /** @hidden */\n  constructor(/** @hidden */ private router: UIRouter) {}\n  /** @hidden */\n  public dispose() {\n    this.listen(false);\n    (this.rules as UrlRules).dispose();\n  }\n\n  /**\n   * Gets the current URL parts\n   *\n   * This method returns the different parts of the current URL (the [[path]], [[search]], and [[hash]]) as a [[UrlParts]] object.\n   */\n  public parts(): UrlParts {\n    return { path: this.path(), search: this.search(), hash: this.hash() };\n  }\n\n  /**\n   * Activates the best rule for the current URL\n   *\n   * Checks the current URL for a matching [[UrlRule]], then invokes that rule's handler.\n   * This method is called internally any time the URL has changed.\n   *\n   * This effectively activates the state (or redirect, etc) which matches the current URL.\n   *\n   * #### Example:\n   * ```js\n   * urlService.deferIntercept();\n   *\n   * fetch('/states.json').then(resp => resp.json()).then(data => {\n   *   data.forEach(state => $stateRegistry.register(state));\n   *   urlService.listen();\n   *   // Find the matching URL and invoke the handler.\n   *   urlService.sync();\n   * });\n   * ```\n   */\n  public sync(evt?) {\n    if (evt && evt.defaultPrevented) return;\n    const { urlService, stateService } = this.router;\n\n    const url: UrlParts = { path: urlService.path(), search: urlService.search(), hash: urlService.hash() };\n    const best = this.match(url);\n\n    const applyResult = pattern([\n      [isString, (newurl: string) => urlService.url(newurl, true)],\n      [TargetState.isDef, (def: TargetStateDef) => stateService.go(def.state, def.params, def.options)],\n      [is(TargetState), (target: TargetState) => stateService.go(target.state(), target.params(), target.options())],\n    ]);\n\n    applyResult(best && best.rule.handler(best.match, url, this.router));\n  }\n\n  /**\n   * Starts or stops listening for URL changes\n   *\n   * Call this sometime after calling [[deferIntercept]] to start monitoring the url.\n   * This causes UI-Router to start listening for changes to the URL, if it wasn't already listening.\n   *\n   * If called with `false`, UI-Router will stop listening (call listen(true) to start listening again).\n   *\n   * #### Example:\n   * ```js\n   * urlService.deferIntercept();\n   *\n   * fetch('/states.json').then(resp => resp.json()).then(data => {\n   *   data.forEach(state => $stateRegistry.register(state));\n   *   // Start responding to URL changes\n   *   urlService.listen();\n   *   urlService.sync();\n   * });\n   * ```\n   *\n   * @param enabled `true` or `false` to start or stop listening to URL changes\n   */\n  public listen(enabled?: boolean): Function {\n    if (enabled === false) {\n      this._stopListeningFn && this._stopListeningFn();\n      delete this._stopListeningFn;\n    } else {\n      return (this._stopListeningFn = this._stopListeningFn || this.router.urlService.onChange(evt => this.sync(evt)));\n    }\n  }\n\n  /**\n   * Disables monitoring of the URL.\n   *\n   * Call this method before UI-Router has bootstrapped.\n   * It will stop UI-Router from performing the initial url sync.\n   *\n   * This can be useful to perform some asynchronous initialization before the router starts.\n   * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL.\n   *\n   * #### Example:\n   * ```js\n   * // Prevent UI-Router from automatically intercepting URL changes when it starts;\n   * urlService.deferIntercept();\n   *\n   * fetch('/states.json').then(resp => resp.json()).then(data => {\n   *   data.forEach(state => $stateRegistry.register(state));\n   *   urlService.listen();\n   *   urlService.sync();\n   * });\n   * ```\n   *\n   * @param defer Indicates whether to defer location change interception.\n   *        Passing no parameter is equivalent to `true`.\n   */\n  public deferIntercept(defer?: boolean) {\n    if (defer === undefined) defer = true;\n    this.interceptDeferred = defer;\n  }\n\n  /**\n   * Matches a URL\n   *\n   * Given a URL (as a [[UrlParts]] object), check all rules and determine the best matching rule.\n   * Return the result as a [[MatchResult]].\n   */\n  public match(url: UrlParts): MatchResult {\n    url = extend({ path: '', search: {}, hash: '' }, url);\n    const rules = this.rules.rules();\n\n    // Checks a single rule. Returns { rule: rule, match: match, weight: weight } if it matched, or undefined\n    const checkRule = (rule: UrlRule): MatchResult => {\n      const match = rule.match(url, this.router);\n      return match && { match, rule, weight: rule.matchPriority(match) };\n    };\n\n    // The rules are pre-sorted.\n    // - Find the first matching rule.\n    // - Find any other matching rule that sorted *exactly the same*, according to `.sort()`.\n    // - Choose the rule with the highest match weight.\n    let best: MatchResult;\n    for (let i = 0; i < rules.length; i++) {\n      // Stop when there is a 'best' rule and the next rule sorts differently than it.\n      if (best && best.rule._group !== rules[i]._group) break;\n\n      const current = checkRule(rules[i]);\n      // Pick the best MatchResult\n      best = !best || (current && current.weight > best.weight) ? current : best;\n    }\n\n    return best;\n  }\n\n  // Delegate these calls to the current LocationServices implementation\n  /**\n   * Gets the current url, or updates the url\n   *\n   * ### Getting the current URL\n   *\n   * When no arguments are passed, returns the current URL.\n   * The URL is normalized using the internal [[path]]/[[search]]/[[hash]] values.\n   *\n   * For example, the URL may be stored in the hash ([[HashLocationServices]]) or\n   * have a base HREF prepended ([[PushStateLocationServices]]).\n   *\n   * The raw URL in the browser might be:\n   *\n   * ```\n   * http://mysite.com/somepath/index.html#/internal/path/123?param1=foo#anchor\n   * ```\n   *\n   * or\n   *\n   * ```\n   * http://mysite.com/basepath/internal/path/123?param1=foo#anchor\n   * ```\n   *\n   * then this method returns:\n   *\n   * ```\n   * /internal/path/123?param1=foo#anchor\n   * ```\n   *\n   *\n   * #### Example:\n   * ```js\n   * locationServices.url(); // \"/some/path?query=value#anchor\"\n   * ```\n   *\n   * ### Updating the URL\n   *\n   * When `newurl` arguments is provided, changes the URL to reflect `newurl`\n   *\n   * #### Example:\n   * ```js\n   * locationServices.url(\"/some/path?query=value#anchor\", true);\n   * ```\n   *\n   * @param newurl The new value for the URL.\n   *               This url should reflect only the new internal [[path]], [[search]], and [[hash]] values.\n   *               It should not include the protocol, site, port, or base path of an absolute HREF.\n   * @param replace When true, replaces the current history entry (instead of appending it) with this new url\n   * @param state The history's state object, i.e., pushState (if the LocationServices implementation supports it)\n   *\n   * @return the url (after potentially being processed)\n   */\n  public url = (newurl?: string, replace?: boolean, state?: any): string =>\n    this.router.locationService.url(newurl, replace, state);\n\n  /**\n   * Gets the path part of the current url\n   *\n   * If the current URL is `/some/path?query=value#anchor`, this returns `/some/path`\n   *\n   * @return the path portion of the url\n   */\n  public path = (): string => this.router.locationService.path();\n\n  /**\n   * Gets the search part of the current url as an object\n   *\n   * If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }`\n   *\n   * @return the search (query) portion of the url, as an object\n   */\n  public search = (): { [key: string]: any } => this.router.locationService.search();\n\n  /**\n   * Gets the hash part of the current url\n   *\n   * If the current URL is `/some/path?query=value#anchor`, this returns `anchor`\n   *\n   * @return the hash (anchor) portion of the url\n   */\n  public hash = (): string => this.router.locationService.hash();\n\n  /**\n   * @internalapi\n   *\n   * Registers a low level url change handler\n   *\n   * Note: Because this is a low level handler, it's not recommended for general use.\n   *\n   * #### Example:\n   * ```js\n   * let deregisterFn = locationServices.onChange((evt) => console.log(\"url change\", evt));\n   * ```\n   *\n   * @param callback a function that will be called when the url is changing\n   * @return a function that de-registers the callback\n   */\n  public onChange = (callback: EventListener): Function => this.router.locationService.onChange(callback);\n}\n",
    "/** @publicapi @module core */ /** */\nimport { UrlMatcherFactory } from './url/urlMatcherFactory';\nimport { UrlRouter } from './url/urlRouter';\nimport { TransitionService } from './transition/transitionService';\nimport { ViewService } from './view/view';\nimport { StateRegistry } from './state/stateRegistry';\nimport { StateService } from './state/stateService';\nimport { UIRouterGlobals } from './globals';\nimport { UIRouterPlugin, Disposable } from './interface';\nimport { values, removeFrom } from './common/common';\nimport { isFunction } from './common/predicates';\nimport { UrlService } from './url/urlService';\nimport { LocationServices, LocationConfig } from './common/coreservices';\nimport { Trace, trace } from './common/trace';\nimport { makeStub } from './common';\n\n/** @hidden */\nlet _routerInstance = 0;\n\n/** @hidden */\nconst locSvcFns: (keyof LocationServices)[] = ['url', 'path', 'search', 'hash', 'onChange'];\n/** @hidden */\nconst locCfgFns: (keyof LocationConfig)[] = ['port', 'protocol', 'host', 'baseHref', 'html5Mode', 'hashPrefix'];\n/** @hidden */\nconst locationServiceStub = makeStub<LocationServices>('LocationServices', locSvcFns);\n/** @hidden */\nconst locationConfigStub = makeStub<LocationConfig>('LocationConfig', locCfgFns);\n\n/**\n * The master class used to instantiate an instance of UI-Router.\n *\n * UI-Router (for each specific framework) will create an instance of this class during bootstrap.\n * This class instantiates and wires the UI-Router services together.\n *\n * After a new instance of the UIRouter class is created, it should be configured for your app.\n * For instance, app states should be registered with the [[UIRouter.stateRegistry]].\n *\n * ---\n *\n * Normally the framework code will bootstrap UI-Router.\n * If you are bootstrapping UIRouter manually, tell it to monitor the URL by calling\n * [[UrlService.listen]] then [[UrlService.sync]].\n */\nexport class UIRouter {\n  /** @hidden */ $id = _routerInstance++;\n  /** @hidden */ _disposed = false;\n  /** @hidden */ private _disposables: Disposable[] = [];\n\n  /** Provides trace information to the console */\n  trace: Trace = trace;\n\n  /** Provides services related to ui-view synchronization */\n  viewService = new ViewService(this);\n\n  /** Global router state */\n  globals: UIRouterGlobals = new UIRouterGlobals();\n\n  /** Provides services related to Transitions */\n  transitionService: TransitionService = new TransitionService(this);\n\n  /**\n   * Deprecated for public use. Use [[urlService]] instead.\n   * @deprecated Use [[urlService]] instead\n   */\n  urlMatcherFactory: UrlMatcherFactory = new UrlMatcherFactory(this);\n\n  /**\n   * Deprecated for public use. Use [[urlService]] instead.\n   * @deprecated Use [[urlService]] instead\n   */\n  urlRouter: UrlRouter = new UrlRouter(this);\n\n  /** Provides services related to the URL */\n  urlService: UrlService = new UrlService(this);\n\n  /** Provides a registry for states, and related registration services */\n  stateRegistry: StateRegistry = new StateRegistry(this);\n\n  /** Provides services related to states */\n  stateService = new StateService(this);\n\n  /** @hidden plugin instances are registered here */\n  private _plugins: { [key: string]: UIRouterPlugin } = {};\n\n  /** Registers an object to be notified when the router is disposed */\n  disposable(disposable: Disposable) {\n    this._disposables.push(disposable);\n  }\n\n  /**\n   * Disposes this router instance\n   *\n   * When called, clears resources retained by the router by calling `dispose(this)` on all\n   * registered [[disposable]] objects.\n   *\n   * Or, if a `disposable` object is provided, calls `dispose(this)` on that object only.\n   *\n   * @param disposable (optional) the disposable to dispose\n   */\n  dispose(disposable?: any): void {\n    if (disposable && isFunction(disposable.dispose)) {\n      disposable.dispose(this);\n      return undefined;\n    }\n\n    this._disposed = true;\n    this._disposables.slice().forEach(d => {\n      try {\n        typeof d.dispose === 'function' && d.dispose(this);\n        removeFrom(this._disposables, d);\n      } catch (ignored) {}\n    });\n  }\n\n  /**\n   * Creates a new `UIRouter` object\n   *\n   * @param locationService a [[LocationServices]] implementation\n   * @param locationConfig a [[LocationConfig]] implementation\n   * @internalapi\n   */\n  constructor(\n    public locationService: LocationServices = locationServiceStub,\n    public locationConfig: LocationConfig = locationConfigStub\n  ) {\n    this.viewService._pluginapi._rootViewContext(this.stateRegistry.root());\n    this.globals.$current = this.stateRegistry.root();\n    this.globals.current = this.globals.$current.self;\n\n    this.disposable(this.globals);\n    this.disposable(this.stateService);\n    this.disposable(this.stateRegistry);\n    this.disposable(this.transitionService);\n    this.disposable(this.urlService);\n    this.disposable(locationService);\n    this.disposable(locationConfig);\n  }\n\n  /** Add plugin (as ES6 class) */\n  plugin<T extends UIRouterPlugin>(plugin: { new (router: UIRouter, options?: any): T }, options?: any): T;\n  /** Add plugin (as javascript constructor function) */\n  plugin<T extends UIRouterPlugin>(plugin: { (router: UIRouter, options?: any): void }, options?: any): T;\n  /** Add plugin (as javascript factory function) */\n  plugin<T extends UIRouterPlugin>(plugin: PluginFactory<T>, options?: any): T;\n  /**\n   * Adds a plugin to UI-Router\n   *\n   * This method adds a UI-Router Plugin.\n   * A plugin can enhance or change UI-Router behavior using any public API.\n   *\n   * #### Example:\n   * ```js\n   * import { MyCoolPlugin } from \"ui-router-cool-plugin\";\n   *\n   * var plugin = router.addPlugin(MyCoolPlugin);\n   * ```\n   *\n   * ### Plugin authoring\n   *\n   * A plugin is simply a class (or constructor function) which accepts a [[UIRouter]] instance and (optionally) an options object.\n   *\n   * The plugin can implement its functionality using any of the public APIs of [[UIRouter]].\n   * For example, it may configure router options or add a Transition Hook.\n   *\n   * The plugin can then be published as a separate module.\n   *\n   * #### Example:\n   * ```js\n   * export class MyAuthPlugin implements UIRouterPlugin {\n   *   constructor(router: UIRouter, options: any) {\n   *     this.name = \"MyAuthPlugin\";\n   *     let $transitions = router.transitionService;\n   *     let $state = router.stateService;\n   *\n   *     let authCriteria = {\n   *       to: (state) => state.data && state.data.requiresAuth\n   *     };\n   *\n   *     function authHook(transition: Transition) {\n   *       let authService = transition.injector().get('AuthService');\n   *       if (!authService.isAuthenticated()) {\n   *         return $state.target('login');\n   *       }\n   *     }\n   *\n   *     $transitions.onStart(authCriteria, authHook);\n   *   }\n   * }\n   * ```\n   *\n   * @param plugin one of:\n   *        - a plugin class which implements [[UIRouterPlugin]]\n   *        - a constructor function for a [[UIRouterPlugin]] which accepts a [[UIRouter]] instance\n   *        - a factory function which accepts a [[UIRouter]] instance and returns a [[UIRouterPlugin]] instance\n   * @param options options to pass to the plugin class/factory\n   * @returns the registered plugin instance\n   */\n  plugin<T extends UIRouterPlugin>(plugin: any, options: any = {}): T {\n    const pluginInstance = new plugin(this, options);\n    if (!pluginInstance.name) throw new Error('Required property `name` missing on plugin: ' + pluginInstance);\n    this._disposables.push(pluginInstance);\n    return (this._plugins[pluginInstance.name] = pluginInstance);\n  }\n\n  /**\n   * Returns registered plugins\n   *\n   * Returns the registered plugin of the given `pluginName`.\n   * If no `pluginName` is given, returns all registered plugins\n   *\n   * @param pluginName (optional) the name of the plugin to get\n   * @return the named plugin (undefined if not found), or all plugins (if `pluginName` is omitted)\n   */\n  getPlugin(pluginName: string): UIRouterPlugin;\n  getPlugin(): UIRouterPlugin[];\n  getPlugin(pluginName?: string): UIRouterPlugin | UIRouterPlugin[] {\n    return pluginName ? this._plugins[pluginName] : values(this._plugins);\n  }\n}\n\n/** @internalapi */\nexport type PluginFactory<T> = (router: UIRouter, options?: any) => T;\n",
    "/** @internalapi @module hooks */ /** */\nimport { Transition } from '../transition/transition';\nimport { UIRouter } from '../router';\nimport { TransitionService } from '../transition/transitionService';\nimport { Resolvable } from '../resolve';\nimport { inArray, uniqR, unnestR, values } from '../common';\nimport { PathNode } from '../path';\n\nfunction addCoreResolvables(trans: Transition) {\n  trans.addResolvable(Resolvable.fromData(UIRouter, trans.router), '');\n  trans.addResolvable(Resolvable.fromData(Transition, trans), '');\n  trans.addResolvable(Resolvable.fromData('$transition$', trans), '');\n  trans.addResolvable(Resolvable.fromData('$stateParams', trans.params()), '');\n\n  trans.entering().forEach(state => {\n    trans.addResolvable(Resolvable.fromData('$state$', state), state);\n  });\n}\n\nexport const registerAddCoreResolvables = (transitionService: TransitionService) =>\n  transitionService.onCreate({}, addCoreResolvables);\n\nconst TRANSITION_TOKENS = ['$transition$', Transition];\nconst isTransition = inArray(TRANSITION_TOKENS);\n\n// References to Transition in the treeChanges pathnodes makes all\n// previous Transitions reachable in memory, causing a memory leak\n// This function removes resolves for '$transition$' and `Transition` from the treeChanges.\n// Do not use this on current transitions, only on old ones.\nexport const treeChangesCleanup = (trans: Transition) => {\n  const nodes = values(trans.treeChanges())\n    .reduce(unnestR, [])\n    .reduce(uniqR, []);\n\n  // If the resolvable is a Transition, return a new resolvable with null data\n  const replaceTransitionWithNull = (r: Resolvable): Resolvable => {\n    return isTransition(r.token) ? Resolvable.fromData(r.token, null) : r;\n  };\n\n  nodes.forEach((node: PathNode) => {\n    node.resolvables = node.resolvables.map(replaceTransitionWithNull);\n  });\n};\n",
    "/** @internalapi @module hooks */ /** */\nimport { isString, isFunction } from '../common/predicates';\nimport { Transition } from '../transition/transition';\nimport { services } from '../common/coreservices';\nimport { TargetState } from '../state/targetState';\nimport { TransitionService } from '../transition/transitionService';\nimport { TransitionHookFn } from '../transition/interface';\n\n/**\n * A [[TransitionHookFn]] that redirects to a different state or params\n *\n * Registered using `transitionService.onStart({ to: (state) => !!state.redirectTo }, redirectHook);`\n *\n * See [[StateDeclaration.redirectTo]]\n */\nconst redirectToHook: TransitionHookFn = (trans: Transition) => {\n  const redirect = trans.to().redirectTo;\n  if (!redirect) return;\n\n  const $state = trans.router.stateService;\n\n  function handleResult(result: any) {\n    if (!result) return;\n    if (result instanceof TargetState) return result;\n    if (isString(result)) return $state.target(<any>result, trans.params(), trans.options());\n    if (result['state'] || result['params'])\n      return $state.target(result['state'] || trans.to(), result['params'] || trans.params(), trans.options());\n  }\n\n  if (isFunction(redirect)) {\n    return services.$q.when(redirect(trans)).then(handleResult);\n  }\n  return handleResult(redirect);\n};\n\nexport const registerRedirectToHook = (transitionService: TransitionService) =>\n  transitionService.onStart({ to: state => !!state.redirectTo }, redirectToHook);\n",
    "/** @internalapi @module hooks */ /** */\nimport { TransitionStateHookFn } from '../transition/interface';\nimport { Transition } from '../transition/transition';\nimport { TransitionService } from '../transition/transitionService';\nimport { StateDeclaration } from '../state/interface';\nimport { StateObject } from '../state/stateObject';\n\n/**\n * A factory which creates an onEnter, onExit or onRetain transition hook function\n *\n * The returned function invokes the (for instance) state.onEnter hook when the\n * state is being entered.\n *\n * @hidden\n */\nfunction makeEnterExitRetainHook(hookName: string): TransitionStateHookFn {\n  return (transition: Transition, state: StateDeclaration) => {\n    const _state: StateObject = state.$$state();\n    const hookFn: TransitionStateHookFn = _state[hookName];\n    return hookFn(transition, state);\n  };\n}\n\n/**\n * The [[TransitionStateHookFn]] for onExit\n *\n * When the state is being exited, the state's .onExit function is invoked.\n *\n * Registered using `transitionService.onExit({ exiting: (state) => !!state.onExit }, onExitHook);`\n *\n * See: [[IHookRegistry.onExit]]\n */\nconst onExitHook: TransitionStateHookFn = makeEnterExitRetainHook('onExit');\nexport const registerOnExitHook = (transitionService: TransitionService) =>\n  transitionService.onExit({ exiting: state => !!state.onExit }, onExitHook);\n\n/**\n * The [[TransitionStateHookFn]] for onRetain\n *\n * When the state was already entered, and is not being exited or re-entered, the state's .onRetain function is invoked.\n *\n * Registered using `transitionService.onRetain({ retained: (state) => !!state.onRetain }, onRetainHook);`\n *\n * See: [[IHookRegistry.onRetain]]\n */\nconst onRetainHook: TransitionStateHookFn = makeEnterExitRetainHook('onRetain');\nexport const registerOnRetainHook = (transitionService: TransitionService) =>\n  transitionService.onRetain({ retained: state => !!state.onRetain }, onRetainHook);\n\n/**\n * The [[TransitionStateHookFn]] for onEnter\n *\n * When the state is being entered, the state's .onEnter function is invoked.\n *\n * Registered using `transitionService.onEnter({ entering: (state) => !!state.onEnter }, onEnterHook);`\n *\n * See: [[IHookRegistry.onEnter]]\n */\nconst onEnterHook: TransitionStateHookFn = makeEnterExitRetainHook('onEnter');\nexport const registerOnEnterHook = (transitionService: TransitionService) =>\n  transitionService.onEnter({ entering: state => !!state.onEnter }, onEnterHook);\n",
    "/** @internalapi @module hooks */ /** */\nimport { noop } from '../common/common';\nimport { Transition } from '../transition/transition';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { TransitionStateHookFn, TransitionHookFn } from '../transition/interface';\nimport { TransitionService } from '../transition/transitionService';\nimport { val } from '../common/hof';\nimport { StateDeclaration } from '../state/interface';\n\nexport const RESOLVE_HOOK_PRIORITY = 1000;\n\n/**\n * A [[TransitionHookFn]] which resolves all EAGER Resolvables in the To Path\n *\n * Registered using `transitionService.onStart({}, eagerResolvePath, { priority: 1000 });`\n *\n * When a Transition starts, this hook resolves all the EAGER Resolvables, which the transition then waits for.\n *\n * See [[StateDeclaration.resolve]]\n */\nconst eagerResolvePath: TransitionHookFn = (trans: Transition) =>\n  new ResolveContext(trans.treeChanges().to).resolvePath('EAGER', trans).then(noop);\n\nexport const registerEagerResolvePath = (transitionService: TransitionService) =>\n  transitionService.onStart({}, eagerResolvePath, { priority: RESOLVE_HOOK_PRIORITY });\n\n/**\n * A [[TransitionHookFn]] which resolves all LAZY Resolvables for the state (and all its ancestors) in the To Path\n *\n * Registered using `transitionService.onEnter({ entering: () => true }, lazyResolveState, { priority: 1000 });`\n *\n * When a State is being entered, this hook resolves all the Resolvables for this state, which the transition then waits for.\n *\n * See [[StateDeclaration.resolve]]\n */\nconst lazyResolveState: TransitionStateHookFn = (trans: Transition, state: StateDeclaration) =>\n  new ResolveContext(trans.treeChanges().to)\n    .subContext(state.$$state())\n    .resolvePath('LAZY', trans)\n    .then(noop);\n\nexport const registerLazyResolveState = (transitionService: TransitionService) =>\n  transitionService.onEnter({ entering: val(true) }, lazyResolveState, { priority: RESOLVE_HOOK_PRIORITY });\n\n/**\n * A [[TransitionHookFn]] which resolves any dynamically added (LAZY or EAGER) Resolvables.\n *\n * Registered using `transitionService.onFinish({}, eagerResolvePath, { priority: 1000 });`\n *\n * After all entering states have been entered, this hook resolves any remaining Resolvables.\n * These are typically dynamic resolves which were added by some Transition Hook using [[Transition.addResolvable]].\n *\n * See [[StateDeclaration.resolve]]\n */\nconst resolveRemaining: TransitionHookFn = (trans: Transition) =>\n  new ResolveContext(trans.treeChanges().to).resolvePath('LAZY', trans).then(noop);\n\nexport const registerResolveRemaining = (transitionService: TransitionService) =>\n  transitionService.onFinish({}, resolveRemaining, { priority: RESOLVE_HOOK_PRIORITY });\n",
    "/** @internalapi @module hooks */ /** */\nimport { noop } from '../common/common';\nimport { services } from '../common/coreservices';\nimport { Transition } from '../transition/transition';\nimport { ViewService } from '../view/view';\nimport { ViewConfig } from '../view/interface';\nimport { TransitionHookFn } from '../transition/interface';\nimport { TransitionService } from '../transition/transitionService';\n\n/**\n * A [[TransitionHookFn]] which waits for the views to load\n *\n * Registered using `transitionService.onStart({}, loadEnteringViews);`\n *\n * Allows the views to do async work in [[ViewConfig.load]] before the transition continues.\n * In angular 1, this includes loading the templates.\n */\nconst loadEnteringViews: TransitionHookFn = (transition: Transition) => {\n  const $q = services.$q;\n  const enteringViews = transition.views('entering');\n  if (!enteringViews.length) return;\n  return $q.all(enteringViews.map(view => $q.when(view.load()))).then(noop);\n};\n\nexport const registerLoadEnteringViews = (transitionService: TransitionService) =>\n  transitionService.onFinish({}, loadEnteringViews);\n\n/**\n * A [[TransitionHookFn]] which activates the new views when a transition is successful.\n *\n * Registered using `transitionService.onSuccess({}, activateViews);`\n *\n * After a transition is complete, this hook deactivates the old views from the previous state,\n * and activates the new views from the destination state.\n *\n * See [[ViewService]]\n */\nconst activateViews: TransitionHookFn = (transition: Transition) => {\n  const enteringViews = transition.views('entering');\n  const exitingViews = transition.views('exiting');\n  if (!enteringViews.length && !exitingViews.length) return;\n\n  const $view: ViewService = transition.router.viewService;\n\n  exitingViews.forEach((vc: ViewConfig) => $view.deactivateViewConfig(vc));\n  enteringViews.forEach((vc: ViewConfig) => $view.activateViewConfig(vc));\n\n  $view.sync();\n};\n\nexport const registerActivateViews = (transitionService: TransitionService) =>\n  transitionService.onSuccess({}, activateViews);\n",
    "/** @internalapi @module hooks */ /** */\nimport { Transition } from '../transition/transition';\nimport { copy } from '../common/common';\nimport { TransitionService } from '../transition/transitionService';\n\n/**\n * A [[TransitionHookFn]] which updates global UI-Router state\n *\n * Registered using `transitionService.onBefore({}, updateGlobalState);`\n *\n * Before a [[Transition]] starts, updates the global value of \"the current transition\" ([[Globals.transition]]).\n * After a successful [[Transition]], updates the global values of \"the current state\"\n * ([[Globals.current]] and [[Globals.$current]]) and \"the current param values\" ([[Globals.params]]).\n *\n * See also the deprecated properties:\n * [[StateService.transition]], [[StateService.current]], [[StateService.params]]\n */\nconst updateGlobalState = (trans: Transition) => {\n  const globals = trans.router.globals;\n\n  const transitionSuccessful = () => {\n    globals.successfulTransitions.enqueue(trans);\n    globals.$current = trans.$to();\n    globals.current = globals.$current.self;\n\n    copy(trans.params(), globals.params);\n  };\n\n  const clearCurrentTransition = () => {\n    // Do not clear globals.transition if a different transition has started in the meantime\n    if (globals.transition === trans) globals.transition = null;\n  };\n\n  trans.onSuccess({}, transitionSuccessful, { priority: 10000 });\n  trans.promise.then(clearCurrentTransition, clearCurrentTransition);\n};\n\nexport const registerUpdateGlobalState = (transitionService: TransitionService) =>\n  transitionService.onCreate({}, updateGlobalState);\n",
    "/** @internalapi @module hooks */ /** */\nimport { UrlRouter } from '../url/urlRouter';\nimport { StateService } from '../state/stateService';\nimport { Transition } from '../transition/transition';\nimport { TransitionHookFn } from '../transition/interface';\nimport { TransitionService } from '../transition/transitionService';\n\n/**\n * A [[TransitionHookFn]] which updates the URL after a successful transition\n *\n * Registered using `transitionService.onSuccess({}, updateUrl);`\n */\nconst updateUrl: TransitionHookFn = (transition: Transition) => {\n  const options = transition.options();\n  const $state: StateService = transition.router.stateService;\n  const $urlRouter: UrlRouter = transition.router.urlRouter;\n\n  // Dont update the url in these situations:\n  // The transition was triggered by a URL sync (options.source === 'url')\n  // The user doesn't want the url to update (options.location === false)\n  // The destination state, and all parents have no navigable url\n  if (options.source !== 'url' && options.location && $state.$current.navigable) {\n    const urlOptions = { replace: options.location === 'replace' };\n    $urlRouter.push($state.$current.navigable.url, $state.params, urlOptions);\n  }\n\n  $urlRouter.update(true);\n};\n\nexport const registerUpdateUrl = (transitionService: TransitionService) =>\n  transitionService.onSuccess({}, updateUrl, { priority: 9999 });\n",
    "/** @internalapi @module hooks */ /** */\nimport { Transition } from '../transition/transition';\nimport { TransitionService } from '../transition/transitionService';\nimport { TransitionHookFn } from '../transition/interface';\nimport { StateDeclaration, LazyLoadResult } from '../state/interface';\nimport { services } from '../common/coreservices';\nimport { StateRule } from '../url/interface';\n\n/**\n * A [[TransitionHookFn]] that performs lazy loading\n *\n * When entering a state \"abc\" which has a `lazyLoad` function defined:\n * - Invoke the `lazyLoad` function (unless it is already in process)\n *   - Flag the hook function as \"in process\"\n *   - The function should return a promise (that resolves when lazy loading is complete)\n * - Wait for the promise to settle\n *   - If the promise resolves to a [[LazyLoadResult]], then register those states\n *   - Flag the hook function as \"not in process\"\n * - If the hook was successful\n *   - Remove the `lazyLoad` function from the state declaration\n * - If all the hooks were successful\n *   - Retry the transition (by returning a TargetState)\n *\n * ```\n * .state('abc', {\n *   component: 'fooComponent',\n *   lazyLoad: () => System.import('./fooComponent')\n *   });\n * ```\n *\n * See [[StateDeclaration.lazyLoad]]\n */\nconst lazyLoadHook: TransitionHookFn = (transition: Transition) => {\n  const router = transition.router;\n\n  function retryTransition() {\n    if (transition.originalTransition().options().source !== 'url') {\n      // The original transition was not triggered via url sync\n      // The lazy state should be loaded now, so re-try the original transition\n      const orig = transition.targetState();\n      return router.stateService.target(orig.identifier(), orig.params(), orig.options());\n    }\n\n    // The original transition was triggered via url sync\n    // Run the URL rules and find the best match\n    const $url = router.urlService;\n    const result = $url.match($url.parts());\n    const rule = result && result.rule;\n\n    // If the best match is a state, redirect the transition (instead\n    // of calling sync() which supersedes the current transition)\n    if (rule && rule.type === 'STATE') {\n      const state = (rule as StateRule).state;\n      const params = result.match;\n      return router.stateService.target(state, params, transition.options());\n    }\n\n    // No matching state found, so let .sync() choose the best non-state match/otherwise\n    router.urlService.sync();\n  }\n\n  const promises = transition\n    .entering()\n    .filter(state => !!state.$$state().lazyLoad)\n    .map(state => lazyLoadState(transition, state));\n\n  return services.$q.all(promises).then(retryTransition);\n};\n\nexport const registerLazyLoadHook = (transitionService: TransitionService) =>\n  transitionService.onBefore({ entering: state => !!state.lazyLoad }, lazyLoadHook);\n\n/**\n * Invokes a state's lazy load function\n *\n * @param transition a Transition context\n * @param state the state to lazy load\n * @returns A promise for the lazy load result\n */\nexport function lazyLoadState(transition: Transition, state: StateDeclaration): Promise<LazyLoadResult> {\n  const lazyLoadFn = state.$$state().lazyLoad;\n\n  // Store/get the lazy load promise on/from the hookfn so it doesn't get re-invoked\n  let promise = lazyLoadFn['_promise'];\n  if (!promise) {\n    const success = result => {\n      delete state.lazyLoad;\n      delete state.$$state().lazyLoad;\n      delete lazyLoadFn['_promise'];\n      return result;\n    };\n\n    const error = err => {\n      delete lazyLoadFn['_promise'];\n      return services.$q.reject(err);\n    };\n\n    promise = lazyLoadFn['_promise'] = services.$q\n      .when(lazyLoadFn(transition, state))\n      .then(updateStateRegistry)\n      .then(success, error);\n  }\n\n  /** Register any lazy loaded state definitions */\n  function updateStateRegistry(result: LazyLoadResult) {\n    if (result && Array.isArray(result.states)) {\n      result.states.forEach(_state => transition.router.stateRegistry.register(_state));\n    }\n    return result;\n  }\n\n  return promise;\n}\n",
    "/** @publicapi @module transition */ /** */\nimport { TransitionHookPhase, PathType } from './interface';\nimport { GetErrorHandler, GetResultHandler, TransitionHook } from './transitionHook';\n/**\n * This class defines a type of hook, such as `onBefore` or `onEnter`.\n * Plugins can define custom hook types, such as sticky states does for `onInactive`.\n *\n * @interalapi\n */\nexport class TransitionEventType {\n  /* tslint:disable:no-inferrable-types */\n  constructor(\n    public name: string,\n    public hookPhase: TransitionHookPhase,\n    public hookOrder: number,\n    public criteriaMatchPath: PathType,\n    public reverseSort: boolean = false,\n    public getResultHandler: GetResultHandler = TransitionHook.HANDLE_RESULT,\n    public getErrorHandler: GetErrorHandler = TransitionHook.REJECT_ERROR,\n    public synchronous: boolean = false\n  ) {}\n}\n",
    "/** @internalapi @module hooks */ /** */\n\nimport { trace } from '../common/trace';\nimport { Rejection } from '../transition/rejectFactory';\nimport { TransitionService } from '../transition/transitionService';\nimport { Transition } from '../transition/transition';\n\n/**\n * A [[TransitionHookFn]] that skips a transition if it should be ignored\n *\n * This hook is invoked at the end of the onBefore phase.\n *\n * If the transition should be ignored (because no parameter or states changed)\n * then the transition is ignored and not processed.\n */\nfunction ignoredHook(trans: Transition) {\n  const ignoredReason = trans._ignoredReason();\n  if (!ignoredReason) return;\n\n  trace.traceTransitionIgnored(trans);\n\n  const pending = trans.router.globals.transition;\n\n  // The user clicked a link going back to the *current state* ('A')\n  // However, there is also a pending transition in flight (to 'B')\n  // Abort the transition to 'B' because the user now wants to be back at 'A'.\n  if (ignoredReason === 'SameAsCurrent' && pending) {\n    pending.abort();\n  }\n\n  return Rejection.ignored().toPromise();\n}\n\nexport const registerIgnoredTransitionHook = (transitionService: TransitionService) =>\n  transitionService.onBefore({}, ignoredHook, { priority: -9999 });\n",
    "/** @internalapi @module hooks */ /** */\n\nimport { TransitionService } from '../transition/transitionService';\nimport { Transition } from '../transition/transition';\n\n/**\n * A [[TransitionHookFn]] that rejects the Transition if it is invalid\n *\n * This hook is invoked at the end of the onBefore phase.\n * If the transition is invalid (for example, param values do not validate)\n * then the transition is rejected.\n */\nfunction invalidTransitionHook(trans: Transition) {\n  if (!trans.valid()) {\n    throw new Error(trans.error().toString());\n  }\n}\n\nexport const registerInvalidTransitionHook = (transitionService: TransitionService) =>\n  transitionService.onBefore({}, invalidTransitionHook, { priority: -10000 });\n",
    "/** @publicapi @module transition */ /** */\nimport {\n  IHookRegistry,\n  TransitionOptions,\n  TransitionHookScope,\n  TransitionHookPhase,\n  TransitionCreateHookFn,\n  HookMatchCriteria,\n  HookRegOptions,\n  PathTypes,\n  PathType,\n  RegisteredHooks,\n  TransitionHookFn,\n  TransitionStateHookFn,\n} from './interface';\nimport { Transition } from './transition';\nimport { makeEvent, RegisteredHook } from './hookRegistry';\nimport { TargetState } from '../state/targetState';\nimport { PathNode } from '../path/pathNode';\nimport { ViewService } from '../view/view';\nimport { UIRouter } from '../router';\nimport { registerAddCoreResolvables, treeChangesCleanup } from '../hooks/coreResolvables';\nimport { registerRedirectToHook } from '../hooks/redirectTo';\nimport { registerOnExitHook, registerOnRetainHook, registerOnEnterHook } from '../hooks/onEnterExitRetain';\nimport { registerEagerResolvePath, registerLazyResolveState, registerResolveRemaining } from '../hooks/resolve';\nimport { registerLoadEnteringViews, registerActivateViews } from '../hooks/views';\nimport { registerUpdateGlobalState } from '../hooks/updateGlobals';\nimport { registerUpdateUrl } from '../hooks/url';\nimport { registerLazyLoadHook } from '../hooks/lazyLoad';\nimport { TransitionEventType } from './transitionEventType';\nimport { TransitionHook, GetResultHandler, GetErrorHandler } from './transitionHook';\nimport { isDefined } from '../common/predicates';\nimport { removeFrom, values, createProxyFunctions } from '../common/common';\nimport { Disposable } from '../interface'; // has or is using\nimport { val } from '../common/hof';\nimport { registerIgnoredTransitionHook } from '../hooks/ignoredTransition';\nimport { registerInvalidTransitionHook } from '../hooks/invalidTransition';\n\n/**\n * The default [[Transition]] options.\n *\n * Include this object when applying custom defaults:\n * let reloadOpts = { reload: true, notify: true }\n * let options = defaults(theirOpts, customDefaults, defaultOptions);\n */\nexport let defaultTransOpts: TransitionOptions = {\n  location: true,\n  relative: null,\n  inherit: false,\n  notify: true,\n  reload: false,\n  custom: {},\n  current: () => null,\n  source: 'unknown',\n};\n\n/**\n * Plugin API for Transition Service\n * @internalapi\n */\nexport interface TransitionServicePluginAPI {\n  /**\n   * Adds a Path to be used as a criterion against a TreeChanges path\n   *\n   * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path.\n   * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)`\n   * Each state in the exiting path is checked against the criteria and returned as part of the match.\n   *\n   * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path.\n   * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)`\n   * Only the tail of the `to` path is checked against the criteria and returned as part of the match.\n   */\n  _definePathType(name: string, hookScope: TransitionHookScope);\n\n  /**\n   * Gets a Path definition used as a criterion against a TreeChanges path\n   */\n  _getPathTypes(): PathTypes;\n\n  /**\n   * Defines a transition hook type and returns a transition hook registration\n   * function (which can then be used to register hooks of this type).\n   */\n  _defineEvent(\n    name: string,\n    hookPhase: TransitionHookPhase,\n    hookOrder: number,\n    criteriaMatchPath: PathType,\n    reverseSort?: boolean,\n    getResultHandler?: GetResultHandler,\n    getErrorHandler?: GetErrorHandler,\n    rejectIfSuperseded?: boolean\n  );\n\n  /**\n   * Returns the known event types, such as `onBefore`\n   * If a phase argument is provided, returns only events for the given phase.\n   */\n  _getEvents(phase?: TransitionHookPhase): TransitionEventType[];\n\n  /** Returns the hooks registered for the given hook name */\n  getHooks(hookName: string): RegisteredHook[];\n}\n\n/**\n * This class provides services related to Transitions.\n *\n * - Most importantly, it allows global Transition Hooks to be registered.\n * - It allows the default transition error handler to be set.\n * - It also has a factory function for creating new [[Transition]] objects, (used internally by the [[StateService]]).\n *\n * At bootstrap, [[UIRouter]] creates a single instance (singleton) of this class.\n */\nexport class TransitionService implements IHookRegistry, Disposable {\n  /** @hidden */\n  _transitionCount = 0;\n\n  /** @hidden */\n  public $view: ViewService;\n\n  /** @hidden The transition hook types, such as `onEnter`, `onStart`, etc */\n  private _eventTypes: TransitionEventType[] = [];\n  /** @hidden The registered transition hooks */\n  _registeredHooks = {} as RegisteredHooks;\n  /** @hidden The  paths on a criteria object */\n  private _criteriaPaths = {} as PathTypes;\n  /** @hidden */\n  private _router: UIRouter;\n\n  /** @internalapi */\n  _pluginapi: TransitionServicePluginAPI;\n\n  /**\n   * This object has hook de-registration functions for the built-in hooks.\n   * This can be used by third parties libraries that wish to customize the behaviors\n   *\n   * @hidden\n   */\n  _deregisterHookFns: {\n    addCoreResolves: Function;\n    ignored: Function;\n    invalid: Function;\n    redirectTo: Function;\n    onExit: Function;\n    onRetain: Function;\n    onEnter: Function;\n    eagerResolve: Function;\n    lazyResolve: Function;\n    resolveAll: Function;\n    loadViews: Function;\n    activateViews: Function;\n    updateGlobals: Function;\n    updateUrl: Function;\n    lazyLoad: Function;\n  };\n\n  /** @hidden */\n  constructor(_router: UIRouter) {\n    this._router = _router;\n    this.$view = _router.viewService;\n    this._deregisterHookFns = <any>{};\n    this._pluginapi = <TransitionServicePluginAPI>(\n      createProxyFunctions(val(this), {}, val(this), [\n        '_definePathType',\n        '_defineEvent',\n        '_getPathTypes',\n        '_getEvents',\n        'getHooks',\n      ])\n    );\n\n    this._defineCorePaths();\n    this._defineCoreEvents();\n    this._registerCoreTransitionHooks();\n    _router.globals.successfulTransitions.onEvict(treeChangesCleanup);\n  }\n\n  /**\n   * Registers a [[TransitionHookFn]], called *while a transition is being constructed*.\n   *\n   * Registers a transition lifecycle hook, which is invoked during transition construction.\n   *\n   * This low level hook should only be used by plugins.\n   * This can be a useful time for plugins to add resolves or mutate the transition as needed.\n   * The Sticky States plugin uses this hook to modify the treechanges.\n   *\n   * ### Lifecycle\n   *\n   * `onCreate` hooks are invoked *while a transition is being constructed*.\n   *\n   * ### Return value\n   *\n   * The hook's return value is ignored\n   *\n   * @internalapi\n   * @param criteria defines which Transitions the Hook should be invoked for.\n   * @param callback the hook function which will be invoked.\n   * @param options the registration options\n   * @returns a function which deregisters the hook.\n   */\n  onCreate(criteria: HookMatchCriteria, callback: TransitionCreateHookFn, options?: HookRegOptions): Function {\n    return;\n  }\n  /** @inheritdoc */\n  onBefore(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function {\n    return;\n  }\n  /** @inheritdoc */\n  onStart(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function {\n    return;\n  }\n  /** @inheritdoc */\n  onExit(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function {\n    return;\n  }\n  /** @inheritdoc */\n  onRetain(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function {\n    return;\n  }\n  /** @inheritdoc */\n  onEnter(criteria: HookMatchCriteria, callback: TransitionStateHookFn, options?: HookRegOptions): Function {\n    return;\n  }\n  /** @inheritdoc */\n  onFinish(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function {\n    return;\n  }\n  /** @inheritdoc */\n  onSuccess(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function {\n    return;\n  }\n  /** @inheritdoc */\n  onError(criteria: HookMatchCriteria, callback: TransitionHookFn, options?: HookRegOptions): Function {\n    return;\n  }\n\n  /**\n   * dispose\n   * @internalapi\n   */\n  dispose(router: UIRouter) {\n    values(this._registeredHooks).forEach((hooksArray: RegisteredHook[]) =>\n      hooksArray.forEach(hook => {\n        hook._deregistered = true;\n        removeFrom(hooksArray, hook);\n      })\n    );\n  }\n\n  /**\n   * Creates a new [[Transition]] object\n   *\n   * This is a factory function for creating new Transition objects.\n   * It is used internally by the [[StateService]] and should generally not be called by application code.\n   *\n   * @param fromPath the path to the current state (the from state)\n   * @param targetState the target state (destination)\n   * @returns a Transition\n   */\n  create(fromPath: PathNode[], targetState: TargetState): Transition {\n    return new Transition(fromPath, targetState, this._router);\n  }\n\n  /** @hidden */\n  private _defineCoreEvents() {\n    const Phase = TransitionHookPhase;\n    const TH = TransitionHook;\n    const paths = this._criteriaPaths;\n    const NORMAL_SORT = false,\n      REVERSE_SORT = true;\n    const SYNCHRONOUS = true;\n\n    this._defineEvent(\n      'onCreate',\n      Phase.CREATE,\n      0,\n      paths.to,\n      NORMAL_SORT,\n      TH.LOG_REJECTED_RESULT,\n      TH.THROW_ERROR,\n      SYNCHRONOUS\n    );\n\n    this._defineEvent('onBefore', Phase.BEFORE, 0, paths.to);\n\n    this._defineEvent('onStart', Phase.RUN, 0, paths.to);\n    this._defineEvent('onExit', Phase.RUN, 100, paths.exiting, REVERSE_SORT);\n    this._defineEvent('onRetain', Phase.RUN, 200, paths.retained);\n    this._defineEvent('onEnter', Phase.RUN, 300, paths.entering);\n    this._defineEvent('onFinish', Phase.RUN, 400, paths.to);\n\n    this._defineEvent(\n      'onSuccess',\n      Phase.SUCCESS,\n      0,\n      paths.to,\n      NORMAL_SORT,\n      TH.LOG_REJECTED_RESULT,\n      TH.LOG_ERROR,\n      SYNCHRONOUS\n    );\n    this._defineEvent(\n      'onError',\n      Phase.ERROR,\n      0,\n      paths.to,\n      NORMAL_SORT,\n      TH.LOG_REJECTED_RESULT,\n      TH.LOG_ERROR,\n      SYNCHRONOUS\n    );\n  }\n\n  /** @hidden */\n  private _defineCorePaths() {\n    const { STATE, TRANSITION } = TransitionHookScope;\n\n    this._definePathType('to', TRANSITION);\n    this._definePathType('from', TRANSITION);\n    this._definePathType('exiting', STATE);\n    this._definePathType('retained', STATE);\n    this._definePathType('entering', STATE);\n  }\n\n  /** @hidden */\n  _defineEvent(\n    name: string,\n    hookPhase: TransitionHookPhase,\n    hookOrder: number,\n    criteriaMatchPath: PathType,\n    reverseSort = false,\n    getResultHandler: GetResultHandler = TransitionHook.HANDLE_RESULT,\n    getErrorHandler: GetErrorHandler = TransitionHook.REJECT_ERROR,\n    synchronous = false\n  ) {\n    const eventType = new TransitionEventType(\n      name,\n      hookPhase,\n      hookOrder,\n      criteriaMatchPath,\n      reverseSort,\n      getResultHandler,\n      getErrorHandler,\n      synchronous\n    );\n\n    this._eventTypes.push(eventType);\n    makeEvent(this, this, eventType);\n  }\n\n  /** @hidden */\n  // tslint:disable-next-line\n  private _getEvents(phase?: TransitionHookPhase): TransitionEventType[] {\n    const transitionHookTypes = isDefined(phase)\n      ? this._eventTypes.filter(type => type.hookPhase === phase)\n      : this._eventTypes.slice();\n\n    return transitionHookTypes.sort((l, r) => {\n      const cmpByPhase = l.hookPhase - r.hookPhase;\n      return cmpByPhase === 0 ? l.hookOrder - r.hookOrder : cmpByPhase;\n    });\n  }\n\n  /**\n   * Adds a Path to be used as a criterion against a TreeChanges path\n   *\n   * For example: the `exiting` path in [[HookMatchCriteria]] is a STATE scoped path.\n   * It was defined by calling `defineTreeChangesCriterion('exiting', TransitionHookScope.STATE)`\n   * Each state in the exiting path is checked against the criteria and returned as part of the match.\n   *\n   * Another example: the `to` path in [[HookMatchCriteria]] is a TRANSITION scoped path.\n   * It was defined by calling `defineTreeChangesCriterion('to', TransitionHookScope.TRANSITION)`\n   * Only the tail of the `to` path is checked against the criteria and returned as part of the match.\n   *\n   * @hidden\n   */\n  private _definePathType(name: string, hookScope: TransitionHookScope) {\n    this._criteriaPaths[name] = { name, scope: hookScope };\n  }\n\n  /** * @hidden */\n  // tslint:disable-next-line\n  private _getPathTypes(): PathTypes {\n    return this._criteriaPaths;\n  }\n\n  /** @hidden */\n  public getHooks(hookName: string): RegisteredHook[] {\n    return this._registeredHooks[hookName];\n  }\n\n  /** @hidden */\n  private _registerCoreTransitionHooks() {\n    const fns = this._deregisterHookFns;\n\n    fns.addCoreResolves = registerAddCoreResolvables(this);\n    fns.ignored = registerIgnoredTransitionHook(this);\n    fns.invalid = registerInvalidTransitionHook(this);\n\n    // Wire up redirectTo hook\n    fns.redirectTo = registerRedirectToHook(this);\n\n    // Wire up onExit/Retain/Enter state hooks\n    fns.onExit = registerOnExitHook(this);\n    fns.onRetain = registerOnRetainHook(this);\n    fns.onEnter = registerOnEnterHook(this);\n\n    // Wire up Resolve hooks\n    fns.eagerResolve = registerEagerResolvePath(this);\n    fns.lazyResolve = registerLazyResolveState(this);\n    fns.resolveAll = registerResolveRemaining(this);\n\n    // Wire up the View management hooks\n    fns.loadViews = registerLoadEnteringViews(this);\n    fns.activateViews = registerActivateViews(this);\n\n    // Updates global state after a transition\n    fns.updateGlobals = registerUpdateGlobalState(this);\n\n    // After globals.current is updated at priority: 10000\n    fns.updateUrl = registerUpdateUrl(this);\n\n    // Lazy load state trees\n    fns.lazyLoad = registerLazyLoadHook(this);\n  }\n}\n",
    "/** @publicapi @module state */ /** */\nimport {\n  createProxyFunctions,\n  defaults,\n  extend,\n  inArray,\n  noop,\n  removeFrom,\n  silenceUncaughtInPromise,\n  silentRejection,\n} from '../common/common';\nimport { isDefined, isObject, isString } from '../common/predicates';\nimport { Queue } from '../common/queue';\nimport { services } from '../common/coreservices';\n\nimport { PathUtils } from '../path/pathUtils';\nimport { PathNode } from '../path/pathNode';\n\nimport { HookResult, TransitionOptions } from '../transition/interface';\nimport { defaultTransOpts } from '../transition/transitionService';\nimport { Rejection, RejectType } from '../transition/rejectFactory';\nimport { Transition } from '../transition/transition';\n\nimport { HrefOptions, LazyLoadResult, StateDeclaration, StateOrName, TransitionPromise } from './interface';\nimport { StateObject } from './stateObject';\nimport { TargetState } from './targetState';\n\nimport { RawParams } from '../params/interface';\nimport { Param } from '../params/param';\nimport { Glob } from '../common/glob';\nimport { UIRouter } from '../router';\nimport { UIInjector } from '../interface';\nimport { ResolveContext } from '../resolve/resolveContext';\nimport { lazyLoadState } from '../hooks/lazyLoad';\nimport { not, val } from '../common/hof';\nimport { StateParams } from '../params/stateParams';\n\nexport type OnInvalidCallback = (toState?: TargetState, fromState?: TargetState, injector?: UIInjector) => HookResult;\n\n/**\n * Provides state related service functions\n *\n * This class provides services related to ui-router states.\n * An instance of this class is located on the global [[UIRouter]] object.\n */\nexport class StateService {\n  /** @internalapi */\n  invalidCallbacks: OnInvalidCallback[] = [];\n\n  /**\n   * The [[Transition]] currently in progress (or null)\n   *\n   * This is a passthrough through to [[UIRouterGlobals.transition]]\n   */\n  get transition() {\n    return this.router.globals.transition;\n  }\n  /**\n   * The latest successful state parameters\n   *\n   * This is a passthrough through to [[UIRouterGlobals.params]]\n   */\n  get params(): StateParams {\n    return this.router.globals.params;\n  }\n  /**\n   * The current [[StateDeclaration]]\n   *\n   * This is a passthrough through to [[UIRouterGlobals.current]]\n   */\n  get current() {\n    return this.router.globals.current;\n  }\n  /**\n   * The current [[StateObject]]\n   *\n   * This is a passthrough through to [[UIRouterGlobals.$current]]\n   */\n  get $current() {\n    return this.router.globals.$current;\n  }\n\n  /** @internalapi */\n  constructor(/** @hidden */ private router: UIRouter) {\n    const getters = ['current', '$current', 'params', 'transition'];\n    const boundFns = Object.keys(StateService.prototype).filter(not(inArray(getters)));\n    createProxyFunctions(val(StateService.prototype), this, val(this), boundFns);\n  }\n\n  /** @internalapi */\n  dispose() {\n    this.defaultErrorHandler(noop);\n    this.invalidCallbacks = [];\n  }\n\n  /**\n   * Handler for when [[transitionTo]] is called with an invalid state.\n   *\n   * Invokes the [[onInvalid]] callbacks, in natural order.\n   * Each callback's return value is checked in sequence until one of them returns an instance of TargetState.\n   * The results of the callbacks are wrapped in $q.when(), so the callbacks may return promises.\n   *\n   * If a callback returns an TargetState, then it is used as arguments to $state.transitionTo() and the result returned.\n   *\n   * @internalapi\n   */\n  private _handleInvalidTargetState(fromPath: PathNode[], toState: TargetState) {\n    const fromState = PathUtils.makeTargetState(this.router.stateRegistry, fromPath);\n    const globals = this.router.globals;\n    const latestThing = () => globals.transitionHistory.peekTail();\n    const latest = latestThing();\n    const callbackQueue = new Queue<OnInvalidCallback>(this.invalidCallbacks.slice());\n    const injector = new ResolveContext(fromPath).injector();\n\n    const checkForRedirect = (result: HookResult) => {\n      if (!(result instanceof TargetState)) {\n        return;\n      }\n\n      let target = <TargetState>result;\n      // Recreate the TargetState, in case the state is now defined.\n      target = this.target(target.identifier(), target.params(), target.options());\n\n      if (!target.valid()) {\n        return Rejection.invalid(target.error()).toPromise();\n      }\n\n      if (latestThing() !== latest) {\n        return Rejection.superseded().toPromise();\n      }\n\n      return this.transitionTo(target.identifier(), target.params(), target.options());\n    };\n\n    function invokeNextCallback() {\n      const nextCallback = callbackQueue.dequeue();\n      if (nextCallback === undefined) return Rejection.invalid(toState.error()).toPromise();\n\n      const callbackResult = services.$q.when(nextCallback(toState, fromState, injector));\n      return callbackResult.then(checkForRedirect).then(result => result || invokeNextCallback());\n    }\n\n    return invokeNextCallback();\n  }\n\n  /**\n   * Registers an Invalid State handler\n   *\n   * Registers a [[OnInvalidCallback]] function to be invoked when [[StateService.transitionTo]]\n   * has been called with an invalid state reference parameter\n   *\n   * Example:\n   * ```js\n   * stateService.onInvalid(function(to, from, injector) {\n   *   if (to.name() === 'foo') {\n   *     let lazyLoader = injector.get('LazyLoadService');\n   *     return lazyLoader.load('foo')\n   *         .then(() => stateService.target('foo'));\n   *   }\n   * });\n   * ```\n   *\n   * @param {function} callback invoked when the toState is invalid\n   *   This function receives the (invalid) toState, the fromState, and an injector.\n   *   The function may optionally return a [[TargetState]] or a Promise for a TargetState.\n   *   If one is returned, it is treated as a redirect.\n   *\n   * @returns a function which deregisters the callback\n   */\n  onInvalid(callback: OnInvalidCallback): Function {\n    this.invalidCallbacks.push(callback);\n    return function deregisterListener() {\n      removeFrom(this.invalidCallbacks)(callback);\n    }.bind(this);\n  }\n\n  /**\n   * Reloads the current state\n   *\n   * A method that force reloads the current state, or a partial state hierarchy.\n   * All resolves are re-resolved, and components reinstantiated.\n   *\n   * #### Example:\n   * ```js\n   * let app angular.module('app', ['ui.router']);\n   *\n   * app.controller('ctrl', function ($scope, $state) {\n   *   $scope.reload = function(){\n   *     $state.reload();\n   *   }\n   * });\n   * ```\n   *\n   * Note: `reload()` is just an alias for:\n   *\n   * ```js\n   * $state.transitionTo($state.current, $state.params, {\n   *   reload: true, inherit: false\n   * });\n   * ```\n   *\n   * @param reloadState A state name or a state object.\n   *    If present, this state and all its children will be reloaded, but ancestors will not reload.\n   *\n   * #### Example:\n   * ```js\n   * //assuming app application consists of 3 states: 'contacts', 'contacts.detail', 'contacts.detail.item'\n   * //and current state is 'contacts.detail.item'\n   * let app angular.module('app', ['ui.router']);\n   *\n   * app.controller('ctrl', function ($scope, $state) {\n   *   $scope.reload = function(){\n   *     //will reload 'contact.detail' and nested 'contact.detail.item' states\n   *     $state.reload('contact.detail');\n   *   }\n   * });\n   * ```\n   *\n   * @returns A promise representing the state of the new transition. See [[StateService.go]]\n   */\n  reload(reloadState?: StateOrName): Promise<StateObject> {\n    return this.transitionTo(this.current, this.params, {\n      reload: isDefined(reloadState) ? reloadState : true,\n      inherit: false,\n      notify: false,\n    });\n  }\n\n  /**\n   * Transition to a different state and/or parameters\n   *\n   * Convenience method for transitioning to a new state.\n   *\n   * `$state.go` calls `$state.transitionTo` internally but automatically sets options to\n   * `{ location: true, inherit: true, relative: router.globals.$current, notify: true }`.\n   * This allows you to use either an absolute or relative `to` argument (because of `relative: router.globals.$current`).\n   * It also allows you to specify * only the parameters you'd like to update, while letting unspecified parameters\n   * inherit from the current parameter values (because of `inherit: true`).\n   *\n   * #### Example:\n   * ```js\n   * let app = angular.module('app', ['ui.router']);\n   *\n   * app.controller('ctrl', function ($scope, $state) {\n   *   $scope.changeState = function () {\n   *     $state.go('contact.detail');\n   *   };\n   * });\n   * ```\n   *\n   * @param to Absolute state name, state object, or relative state path (relative to current state).\n   *\n   * Some examples:\n   *\n   * - `$state.go('contact.detail')` - will go to the `contact.detail` state\n   * - `$state.go('^')` - will go to the parent state\n   * - `$state.go('^.sibling')` - if current state is `home.child`, will go to the `home.sibling` state\n   * - `$state.go('.child.grandchild')` - if current state is home, will go to the `home.child.grandchild` state\n   *\n   * @param params A map of the parameters that will be sent to the state, will populate $stateParams.\n   *\n   *    Any parameters that are not specified will be inherited from current parameter values (because of `inherit: true`).\n   *    This allows, for example, going to a sibling state that shares parameters defined by a parent state.\n   *\n   * @param options Transition options\n   *\n   * @returns {promise} A promise representing the state of the new transition.\n   */\n  go(to: StateOrName, params?: RawParams, options?: TransitionOptions): TransitionPromise {\n    const defautGoOpts = { relative: this.$current, inherit: true };\n    const transOpts = defaults(options, defautGoOpts, defaultTransOpts);\n    return this.transitionTo(to, params, transOpts);\n  }\n\n  /**\n   * Creates a [[TargetState]]\n   *\n   * This is a factory method for creating a TargetState\n   *\n   * This may be returned from a Transition Hook to redirect a transition, for example.\n   */\n  target(identifier: StateOrName, params?: RawParams, options: TransitionOptions = {}): TargetState {\n    // If we're reloading, find the state object to reload from\n    if (isObject(options.reload) && !(<any>options.reload).name) throw new Error('Invalid reload state object');\n    const reg = this.router.stateRegistry;\n    options.reloadState =\n      options.reload === true ? reg.root() : reg.matcher.find(<any>options.reload, options.relative);\n\n    if (options.reload && !options.reloadState)\n      throw new Error(\n        `No such reload state '${isString(options.reload) ? options.reload : (<any>options.reload).name}'`\n      );\n\n    return new TargetState(this.router.stateRegistry, identifier, params, options);\n  }\n\n  private getCurrentPath(): PathNode[] {\n    const globals = this.router.globals;\n    const latestSuccess: Transition = globals.successfulTransitions.peekTail();\n    const rootPath = () => [new PathNode(this.router.stateRegistry.root())];\n    return latestSuccess ? latestSuccess.treeChanges().to : rootPath();\n  }\n\n  /**\n   * Low-level method for transitioning to a new state.\n   *\n   * The [[go]] method (which uses `transitionTo` internally) is recommended in most situations.\n   *\n   * #### Example:\n   * ```js\n   * let app = angular.module('app', ['ui.router']);\n   *\n   * app.controller('ctrl', function ($scope, $state) {\n   *   $scope.changeState = function () {\n   *     $state.transitionTo('contact.detail');\n   *   };\n   * });\n   * ```\n   *\n   * @param to State name or state object.\n   * @param toParams A map of the parameters that will be sent to the state,\n   *      will populate $stateParams.\n   * @param options Transition options\n   *\n   * @returns A promise representing the state of the new transition. See [[go]]\n   */\n  transitionTo(to: StateOrName, toParams: RawParams = {}, options: TransitionOptions = {}): TransitionPromise {\n    const router = this.router;\n    const globals = router.globals;\n    options = defaults(options, defaultTransOpts);\n    const getCurrent = () => globals.transition;\n    options = extend(options, { current: getCurrent });\n\n    const ref: TargetState = this.target(to, toParams, options);\n    const currentPath = this.getCurrentPath();\n\n    if (!ref.exists()) return this._handleInvalidTargetState(currentPath, ref);\n\n    if (!ref.valid()) return <TransitionPromise>silentRejection(ref.error());\n\n    /**\n     * Special handling for Ignored, Aborted, and Redirected transitions\n     *\n     * The semantics for the transition.run() promise and the StateService.transitionTo()\n     * promise differ. For instance, the run() promise may be rejected because it was\n     * IGNORED, but the transitionTo() promise is resolved because from the user perspective\n     * no error occurred.  Likewise, the transition.run() promise may be rejected because of\n     * a Redirect, but the transitionTo() promise is chained to the new Transition's promise.\n     */\n    const rejectedTransitionHandler = (trans: Transition) => (error: any): Promise<any> => {\n      if (error instanceof Rejection) {\n        const isLatest = router.globals.lastStartedTransitionId <= trans.$id;\n\n        if (error.type === RejectType.IGNORED) {\n          isLatest && router.urlRouter.update();\n          // Consider ignored `Transition.run()` as a successful `transitionTo`\n          return services.$q.when(globals.current);\n        }\n\n        const detail: any = error.detail;\n        if (error.type === RejectType.SUPERSEDED && error.redirected && detail instanceof TargetState) {\n          // If `Transition.run()` was redirected, allow the `transitionTo()` promise to resolve successfully\n          // by returning the promise for the new (redirect) `Transition.run()`.\n          const redirect: Transition = trans.redirect(detail);\n          return redirect.run().catch(rejectedTransitionHandler(redirect));\n        }\n\n        if (error.type === RejectType.ABORTED) {\n          isLatest && router.urlRouter.update();\n          return services.$q.reject(error);\n        }\n      }\n\n      const errorHandler = this.defaultErrorHandler();\n      errorHandler(error);\n\n      return services.$q.reject(error);\n    };\n\n    const transition = this.router.transitionService.create(currentPath, ref);\n    const transitionToPromise = transition.run().catch(rejectedTransitionHandler(transition));\n    silenceUncaughtInPromise(transitionToPromise); // issue #2676\n\n    // Return a promise for the transition, which also has the transition object on it.\n    return extend(transitionToPromise, { transition });\n  }\n\n  /**\n   * Checks if the current state *is* the provided state\n   *\n   * Similar to [[includes]] but only checks for the full state name.\n   * If params is supplied then it will be tested for strict equality against the current\n   * active params object, so all params must match with none missing and no extras.\n   *\n   * #### Example:\n   * ```js\n   * $state.$current.name = 'contacts.details.item';\n   *\n   * // absolute name\n   * $state.is('contact.details.item'); // returns true\n   * $state.is(contactDetailItemStateObject); // returns true\n   * ```\n   *\n   * // relative name (. and ^), typically from a template\n   * // E.g. from the 'contacts.details' template\n   * ```html\n   * <div ng-class=\"{highlighted: $state.is('.item')}\">Item</div>\n   * ```\n   *\n   * @param stateOrName The state name (absolute or relative) or state object you'd like to check.\n   * @param params A param object, e.g. `{sectionId: section.id}`, that you'd like\n   * to test against the current active state.\n   * @param options An options object. The options are:\n   *   - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will\n   *     test relative to `options.relative` state (or name).\n   *\n   * @returns Returns true if it is the state.\n   */\n  is(stateOrName: StateOrName, params?: RawParams, options?: { relative?: StateOrName }): boolean {\n    options = defaults(options, { relative: this.$current });\n    const state = this.router.stateRegistry.matcher.find(stateOrName, options.relative);\n    if (!isDefined(state)) return undefined;\n    if (this.$current !== state) return false;\n    if (!params) return true;\n\n    const schema: Param[] = state.parameters({ inherit: true, matchingKeys: params });\n    return Param.equals(schema, Param.values(schema, params), this.params);\n  }\n\n  /**\n   * Checks if the current state *includes* the provided state\n   *\n   * A method to determine if the current active state is equal to or is the child of the\n   * state stateName. If any params are passed then they will be tested for a match as well.\n   * Not all the parameters need to be passed, just the ones you'd like to test for equality.\n   *\n   * #### Example when `$state.$current.name === 'contacts.details.item'`\n   * ```js\n   * // Using partial names\n   * $state.includes(\"contacts\"); // returns true\n   * $state.includes(\"contacts.details\"); // returns true\n   * $state.includes(\"contacts.details.item\"); // returns true\n   * $state.includes(\"contacts.list\"); // returns false\n   * $state.includes(\"about\"); // returns false\n   * ```\n   *\n   * #### Glob Examples when `* $state.$current.name === 'contacts.details.item.url'`:\n   * ```js\n   * $state.includes(\"*.details.*.*\"); // returns true\n   * $state.includes(\"*.details.**\"); // returns true\n   * $state.includes(\"**.item.**\"); // returns true\n   * $state.includes(\"*.details.item.url\"); // returns true\n   * $state.includes(\"*.details.*.url\"); // returns true\n   * $state.includes(\"*.details.*\"); // returns false\n   * $state.includes(\"item.**\"); // returns false\n   * ```\n   *\n   * @param stateOrName A partial name, relative name, glob pattern,\n   *   or state object to be searched for within the current state name.\n   * @param params A param object, e.g. `{sectionId: section.id}`,\n   *   that you'd like to test against the current active state.\n   * @param options An options object. The options are:\n   *   - `relative`: If `stateOrName` is a relative state name and `options.relative` is set, .is will\n   *     test relative to `options.relative` state (or name).\n   *\n   * @returns {boolean} Returns true if it does include the state\n   */\n  includes(stateOrName: StateOrName, params?: RawParams, options?: TransitionOptions): boolean {\n    options = defaults(options, { relative: this.$current });\n    const glob = isString(stateOrName) && Glob.fromString(<string>stateOrName);\n\n    if (glob) {\n      if (!glob.matches(this.$current.name)) return false;\n      stateOrName = this.$current.name;\n    }\n    const state = this.router.stateRegistry.matcher.find(stateOrName, options.relative),\n      include = this.$current.includes;\n\n    if (!isDefined(state)) return undefined;\n    if (!isDefined(include[state.name])) return false;\n    if (!params) return true;\n\n    const schema: Param[] = state.parameters({ inherit: true, matchingKeys: params });\n    return Param.equals(schema, Param.values(schema, params), this.params);\n  }\n\n  /**\n   * Generates a URL for a state and parameters\n   *\n   * Returns the url for the given state populated with the given params.\n   *\n   * #### Example:\n   * ```js\n   * expect($state.href(\"about.person\", { person: \"bob\" })).toEqual(\"/about/bob\");\n   * ```\n   *\n   * @param stateOrName The state name or state object you'd like to generate a url from.\n   * @param params An object of parameter values to fill the state's required parameters.\n   * @param options Options object. The options are:\n   *\n   * @returns {string} compiled state url\n   */\n  href(stateOrName: StateOrName, params?: RawParams, options?: HrefOptions): string {\n    const defaultHrefOpts = {\n      lossy: true,\n      inherit: true,\n      absolute: false,\n      relative: this.$current,\n    };\n    options = defaults(options, defaultHrefOpts);\n    params = params || {};\n\n    const state = this.router.stateRegistry.matcher.find(stateOrName, options.relative);\n\n    if (!isDefined(state)) return null;\n    if (options.inherit) params = <any>this.params.$inherit(params, this.$current, state);\n\n    const nav = state && options.lossy ? state.navigable : state;\n\n    if (!nav || nav.url === undefined || nav.url === null) {\n      return null;\n    }\n\n    return this.router.urlRouter.href(nav.url, params, { absolute: options.absolute });\n  }\n\n  /** @hidden */\n  private _defaultErrorHandler: ((_error: any) => void) = function $defaultErrorHandler($error$) {\n    if ($error$ instanceof Error && $error$.stack) {\n      console.error($error$);\n      console.error($error$.stack);\n    } else if ($error$ instanceof Rejection) {\n      console.error($error$.toString());\n      if ($error$.detail && $error$.detail.stack) console.error($error$.detail.stack);\n    } else {\n      console.error($error$);\n    }\n  };\n\n  /**\n   * Sets or gets the default [[transitionTo]] error handler.\n   *\n   * The error handler is called when a [[Transition]] is rejected or when any error occurred during the Transition.\n   * This includes errors caused by resolves and transition hooks.\n   *\n   * Note:\n   * This handler does not receive certain Transition rejections.\n   * Redirected and Ignored Transitions are not considered to be errors by [[StateService.transitionTo]].\n   *\n   * The built-in default error handler logs the error to the console.\n   *\n   * You can provide your own custom handler.\n   *\n   * #### Example:\n   * ```js\n   * stateService.defaultErrorHandler(function() {\n   *   // Do not log transitionTo errors\n   * });\n   * ```\n   *\n   * @param handler a global error handler function\n   * @returns the current global error handler\n   */\n  defaultErrorHandler(handler?: (error: any) => void): (error: any) => void {\n    return (this._defaultErrorHandler = handler || this._defaultErrorHandler);\n  }\n\n  /**\n   * Gets a registered [[StateDeclaration]] object\n   *\n   * Returns the state declaration object for any specific state, or for all registered states.\n   *\n   * @param stateOrName (absolute or relative) If provided, will only get the declaration object for the requested state.\n   * If not provided, returns an array of ALL states.\n   * @param base When `stateOrName` is a relative state reference (such as `.bar.baz`), the state will be retrieved relative to this state.\n   *\n   * @returns a [[StateDeclaration]] object (or array of all registered [[StateDeclaration]] objects.)\n   */\n  get(stateOrName: StateOrName, base: StateOrName): StateDeclaration;\n  get(stateOrName: StateOrName): StateDeclaration;\n  get(): StateDeclaration[];\n  get(stateOrName?: StateOrName, base?: StateOrName): any {\n    const reg = this.router.stateRegistry;\n    if (arguments.length === 0) return reg.get();\n    return reg.get(stateOrName, base || this.$current);\n  }\n\n  /**\n   * Lazy loads a state\n   *\n   * Explicitly runs a state's [[StateDeclaration.lazyLoad]] function.\n   *\n   * @param stateOrName the state that should be lazy loaded\n   * @param transition the optional Transition context to use (if the lazyLoad function requires an injector, etc)\n   * Note: If no transition is provided, a noop transition is created using the from the current state to the current state.\n   * This noop transition is not actually run.\n   *\n   * @returns a promise to lazy load\n   */\n  lazyLoad(stateOrName: StateOrName, transition?: Transition): Promise<LazyLoadResult> {\n    const state: StateDeclaration = this.get(stateOrName);\n    if (!state || !state.lazyLoad) throw new Error('Can not lazy load ' + stateOrName);\n\n    const currentPath = this.getCurrentPath();\n    const target = PathUtils.makeTargetState(this.router.stateRegistry, currentPath);\n    transition = transition || this.router.transitionService.create(currentPath, target);\n\n    return lazyLoadState(transition, state);\n  }\n}\n",
    "/**\n * # Transition subsystem\n *\n * This module contains APIs related to a Transition.\n *\n * See:\n * - [[TransitionService]]\n * - [[Transition]]\n * - [[HookFn]], [[TransitionHookFn]], [[TransitionStateHookFn]], [[HookMatchCriteria]], [[HookResult]]\n *\n * @preferred @publicapi @module transition\n */ /** */\nexport * from './interface';\nexport * from './hookBuilder';\nexport * from './hookRegistry';\nexport * from './rejectFactory';\nexport * from './transition';\nexport * from './transitionHook';\nexport * from './transitionEventType';\nexport * from './transitionService';\n",
    "/** @internalapi @module vanilla */ /** */\nimport { isArray, isObject, $QLike } from '../common/index';\n\n/**\n * An angular1-like promise api\n *\n * This object implements four methods similar to the\n * [angular 1 promise api](https://docs.angularjs.org/api/ng/service/$q)\n *\n * UI-Router evolved from an angular 1 library to a framework agnostic library.\n * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection.\n *\n * This API provides native ES6 promise support wrapped as a $q-like API.\n * Internally, UI-Router uses this $q object to perform promise operations.\n * The `angular-ui-router` (ui-router for angular 1) uses the $q API provided by angular.\n *\n * $q-like promise api\n */\nexport const $q = {\n  /** Normalizes a value as a promise */\n  when: val => new Promise((resolve, reject) => resolve(val)),\n\n  /** Normalizes a value as a promise rejection */\n  reject: val =>\n    new Promise((resolve, reject) => {\n      reject(val);\n    }),\n\n  /** @returns a deferred object, which has `resolve` and `reject` functions */\n  defer: () => {\n    const deferred: any = {};\n    deferred.promise = new Promise((resolve, reject) => {\n      deferred.resolve = resolve;\n      deferred.reject = reject;\n    });\n    return deferred;\n  },\n\n  /** Like Promise.all(), but also supports object key/promise notation like $q */\n  all: (promises: { [key: string]: Promise<any> } | Promise<any>[]) => {\n    if (isArray(promises)) {\n      return Promise.all(promises);\n    }\n\n    if (isObject(promises)) {\n      // Convert promises map to promises array.\n      // When each promise resolves, map it to a tuple { key: key, val: val }\n      const chain = Object.keys(promises).map(key => promises[key].then(val => ({ key, val })));\n\n      // Then wait for all promises to resolve, and convert them back to an object\n      return $q.all(chain).then(values =>\n        values.reduce((acc, tuple) => {\n          acc[tuple.key] = tuple.val;\n          return acc;\n        }, {})\n      );\n    }\n  },\n} as $QLike;\n",
    "/** @internalapi @module vanilla */ /** */\nimport {\n  extend,\n  assertPredicate,\n  isFunction,\n  isArray,\n  isInjectable,\n  $InjectorLike,\n  IInjectable,\n} from '../common/index';\n\n// globally available injectables\nconst globals = {};\nconst STRIP_COMMENTS = /((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/gm;\nconst ARGUMENT_NAMES = /([^\\s,]+)/g;\n\n/**\n * A basic angular1-like injector api\n *\n * This object implements four methods similar to the\n * [angular 1 dependency injector](https://docs.angularjs.org/api/auto/service/$injector)\n *\n * UI-Router evolved from an angular 1 library to a framework agnostic library.\n * However, some of the `@uirouter/core` code uses these ng1 style APIs to support ng1 style dependency injection.\n *\n * This object provides a naive implementation of a globally scoped dependency injection system.\n * It supports the following DI approaches:\n *\n * ### Function parameter names\n *\n * A function's `.toString()` is called, and the parameter names are parsed.\n * This only works when the parameter names aren't \"mangled\" by a minifier such as UglifyJS.\n *\n * ```js\n * function injectedFunction(FooService, BarService) {\n *   // FooService and BarService are injected\n * }\n * ```\n *\n * ### Function annotation\n *\n * A function may be annotated with an array of dependency names as the `$inject` property.\n *\n * ```js\n * injectedFunction.$inject = [ 'FooService', 'BarService' ];\n * function injectedFunction(fs, bs) {\n *   // FooService and BarService are injected as fs and bs parameters\n * }\n * ```\n *\n * ### Array notation\n *\n * An array provides the names of the dependencies to inject (as strings).\n * The function is the last element of the array.\n *\n * ```js\n * [ 'FooService', 'BarService', function (fs, bs) {\n *   // FooService and BarService are injected as fs and bs parameters\n * }]\n * ```\n *\n * @type {$InjectorLike}\n */\nexport const $injector = {\n  /** Gets an object from DI based on a string token */\n  get: name => globals[name],\n\n  /** Returns true if an object named `name` exists in global DI */\n  has: name => $injector.get(name) != null,\n\n  /**\n   * Injects a function\n   *\n   * @param fn the function to inject\n   * @param context the function's `this` binding\n   * @param locals An object with additional DI tokens and values, such as `{ someToken: { foo: 1 } }`\n   */\n  invoke: (fn: IInjectable, context?, locals?) => {\n    const all = extend({}, globals, locals || {});\n    const params = $injector.annotate(fn);\n    const ensureExist = assertPredicate(\n      (key: string) => all.hasOwnProperty(key),\n      key => `DI can't find injectable: '${key}'`\n    );\n    const args = params.filter(ensureExist).map(x => all[x]);\n    if (isFunction(fn)) return fn.apply(context, args);\n    else return (fn as any[]).slice(-1)[0].apply(context, args);\n  },\n\n  /**\n   * Returns a function's dependencies\n   *\n   * Analyzes a function (or array) and returns an array of DI tokens that the function requires.\n   * @return an array of `string`s\n   */\n  annotate: (fn: IInjectable): any[] => {\n    if (!isInjectable(fn)) throw new Error(`Not an injectable function: ${fn}`);\n    if (fn && (fn as any).$inject) return (fn as any).$inject;\n    if (isArray(fn)) return fn.slice(0, -1);\n    const fnStr = fn.toString().replace(STRIP_COMMENTS, '');\n    const result = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(ARGUMENT_NAMES);\n    return result || [];\n  },\n} as $InjectorLike;\n",
    "/** @internalapi @module vanilla */ /** */\nimport {\n  LocationConfig,\n  LocationServices,\n  identity,\n  unnestR,\n  isArray,\n  splitEqual,\n  splitHash,\n  splitQuery,\n} from '../common';\nimport { UIRouter } from '../router';\n\nexport const keyValsToObjectR = (accum, [key, val]) => {\n  if (!accum.hasOwnProperty(key)) {\n    accum[key] = val;\n  } else if (isArray(accum[key])) {\n    accum[key].push(val);\n  } else {\n    accum[key] = [accum[key], val];\n  }\n  return accum;\n};\n\nexport const getParams = (queryString: string): any =>\n  queryString\n    .split('&')\n    .filter(identity)\n    .map(splitEqual)\n    .reduce(keyValsToObjectR, {});\n\nexport function parseUrl(url: string) {\n  const orEmptyString = x => x || '';\n  const [beforehash, hash] = splitHash(url).map(orEmptyString);\n  const [path, search] = splitQuery(beforehash).map(orEmptyString);\n\n  return { path, search, hash, url };\n}\n\nexport const buildUrl = (loc: LocationServices) => {\n  const path = loc.path();\n  const searchObject = loc.search();\n  const hash = loc.hash();\n\n  const search = Object.keys(searchObject)\n    .map(key => {\n      const param = searchObject[key];\n      const vals = isArray(param) ? param : [param];\n      return vals.map(val => key + '=' + val);\n    })\n    .reduce(unnestR, [])\n    .join('&');\n\n  return path + (search ? '?' + search : '') + (hash ? '#' + hash : '');\n};\n\nexport function locationPluginFactory(\n  name: string,\n  isHtml5: boolean,\n  serviceClass: { new (uiRouter?: UIRouter): LocationServices },\n  configurationClass: { new (uiRouter?: UIRouter, isHtml5?: boolean): LocationConfig }\n) {\n  return function(uiRouter: UIRouter) {\n    const service = (uiRouter.locationService = new serviceClass(uiRouter));\n    const configuration = (uiRouter.locationConfig = new configurationClass(uiRouter, isHtml5));\n\n    function dispose(router: UIRouter) {\n      router.dispose(service);\n      router.dispose(configuration);\n    }\n\n    return { name, service, configuration, dispose };\n  };\n}\n",
    "/** @internalapi @module vanilla */ /** */\nimport { deregAll, isDefined, LocationServices, removeFrom, root } from '../common';\nimport { Disposable } from '../interface';\nimport { UIRouter } from '../router';\nimport { HistoryLike, LocationLike } from './interface';\nimport { buildUrl, getParams, parseUrl } from './utils';\n\n/** A base `LocationServices` */\nexport abstract class BaseLocationServices implements LocationServices, Disposable {\n  private _listeners: Function[] = [];\n  _location: LocationLike;\n  _history: HistoryLike;\n\n  _listener = evt => this._listeners.forEach(cb => cb(evt));\n\n  constructor(router: UIRouter, public fireAfterUpdate: boolean) {\n    this._location = root.location;\n    this._history = root.history;\n  }\n\n  /**\n   * This should return the current internal URL representation.\n   *\n   * The internal URL includes only the portion that UI-Router matches.\n   * It does not include:\n   * - protocol\n   * - server\n   * - port\n   * - base href or hash\n   */\n  protected abstract _get(): string;\n\n  /**\n   * This should set the current URL.\n   *\n   * The `url` param should include only the portion that UI-Router matches on.\n   * It should not include:\n   * - protocol\n   * - server\n   * - port\n   * - base href or hash\n   *\n   * However, after this function completes, the browser URL should reflect the entire (fully qualified)\n   * HREF including those data.\n   */\n  protected abstract _set(state: any, title: string, url: string, replace: boolean);\n\n  hash = () => parseUrl(this._get()).hash;\n  path = () => parseUrl(this._get()).path;\n  search = () => getParams(parseUrl(this._get()).search);\n\n  url(url?: string, replace = true): string {\n    if (isDefined(url) && url !== this._get()) {\n      this._set(null, null, url, replace);\n\n      if (this.fireAfterUpdate) {\n        this._listeners.forEach(cb => cb({ url }));\n      }\n    }\n\n    return buildUrl(this);\n  }\n\n  onChange(cb: EventListener) {\n    this._listeners.push(cb);\n    return () => removeFrom(this._listeners, cb);\n  }\n\n  dispose(router: UIRouter) {\n    deregAll(this._listeners);\n  }\n}\n",
    "/** @internalapi @module vanilla */ /** */\nimport { root, trimHashVal } from '../common';\nimport { UIRouter } from '../router';\nimport { BaseLocationServices } from './baseLocationService';\n\n/** A `LocationServices` that uses the browser hash \"#\" to get/set the current location */\nexport class HashLocationService extends BaseLocationServices {\n  constructor(router: UIRouter) {\n    super(router, false);\n    root.addEventListener('hashchange', this._listener, false);\n  }\n\n  _get() {\n    return trimHashVal(this._location.hash);\n  }\n  _set(state: any, title: string, url: string, replace: boolean) {\n    this._location.hash = url;\n  }\n\n  dispose(router: UIRouter) {\n    super.dispose(router);\n    root.removeEventListener('hashchange', this._listener);\n  }\n}\n",
    "/** @internalapi @module vanilla */ /** */\nimport { BaseLocationServices } from './baseLocationService';\nimport { UIRouter } from '../router';\n\n/** A `LocationServices` that gets/sets the current location from an in-memory object */\nexport class MemoryLocationService extends BaseLocationServices {\n  _url: string;\n\n  constructor(router: UIRouter) {\n    super(router, true);\n  }\n\n  _get() {\n    return this._url;\n  }\n\n  _set(state: any, title: string, url: string, replace: boolean) {\n    this._url = url;\n  }\n}\n",
    "/** @internalapi @module vanilla */ /** */\nimport { UIRouter } from '../router';\nimport { BaseLocationServices } from './baseLocationService';\nimport { LocationConfig, root, splitHash, splitQuery, stripLastPathElement } from '../common';\n\n/**\n * A `LocationServices` that gets/sets the current location using the browser's `location` and `history` apis\n *\n * Uses `history.pushState` and `history.replaceState`\n */\nexport class PushStateLocationService extends BaseLocationServices {\n  _config: LocationConfig;\n\n  constructor(router: UIRouter) {\n    super(router, true);\n    this._config = router.urlService.config;\n    root.addEventListener('popstate', this._listener, false);\n  }\n\n  /**\n   * Gets the base prefix without:\n   * - trailing slash\n   * - trailing filename\n   * - protocol and hostname\n   *\n   * If <base href='/base/'>, this returns '/base'.\n   * If <base href='/foo/base/'>, this returns '/foo/base'.\n   * If <base href='/base/index.html'>, this returns '/base'.\n   * If <base href='http://localhost:8080/base/index.html'>, this returns '/base'.\n   * If <base href='/base'>, this returns ''.\n   * If <base href='http://localhost:8080'>, this returns ''.\n   * If <base href='http://localhost:8080/'>, this returns ''.\n   *\n   * See: https://html.spec.whatwg.org/dev/semantics.html#the-base-element\n   */\n  private _getBasePrefix() {\n    return stripLastPathElement(this._config.baseHref());\n  }\n\n  protected _get() {\n    let { pathname, hash, search } = this._location;\n    search = splitQuery(search)[1]; // strip ? if found\n    hash = splitHash(hash)[1]; // strip # if found\n\n    const basePrefix = this._getBasePrefix();\n    const exactBaseHrefMatch = pathname === this._config.baseHref();\n    const startsWithBase = pathname.substr(0, basePrefix.length) === basePrefix;\n    pathname = exactBaseHrefMatch ? '/' : startsWithBase ? pathname.substring(basePrefix.length) : pathname;\n\n    return pathname + (search ? '?' + search : '') + (hash ? '#' + hash : '');\n  }\n\n  protected _set(state: any, title: string, url: string, replace: boolean) {\n    const basePrefix = this._getBasePrefix();\n    const slash = url && url[0] !== '/' ? '/' : '';\n    const fullUrl = url === '' || url === '/' ? this._config.baseHref() : basePrefix + slash + url;\n\n    if (replace) {\n      this._history.replaceState(state, title, fullUrl);\n    } else {\n      this._history.pushState(state, title, fullUrl);\n    }\n  }\n\n  public dispose(router: UIRouter) {\n    super.dispose(router);\n    root.removeEventListener('popstate', this._listener);\n  }\n}\n",
    "/** @internalapi @module vanilla */ /** */\nimport { LocationConfig } from '../common/coreservices';\nimport { isDefined } from '../common/predicates';\nimport { noop } from '../common/common';\n\n/** A `LocationConfig` mock that gets/sets all config from an in-memory object */\nexport class MemoryLocationConfig implements LocationConfig {\n  dispose = noop;\n\n  _baseHref = '';\n  _port = 80;\n  _protocol = 'http';\n  _host = 'localhost';\n  _hashPrefix = '';\n\n  port = () => this._port;\n  protocol = () => this._protocol;\n  host = () => this._host;\n  baseHref = () => this._baseHref;\n  html5Mode = () => false;\n  hashPrefix = (newval?) => (isDefined(newval) ? (this._hashPrefix = newval) : this._hashPrefix);\n}\n",
    "/** @internalapi @module vanilla */\n/** */\nimport { isDefined, isUndefined } from '../common/predicates';\nimport { LocationConfig } from '../common/coreservices';\n\n/** A `LocationConfig` that delegates to the browser's `location` object */\nexport class BrowserLocationConfig implements LocationConfig {\n  private _baseHref = undefined;\n  private _hashPrefix = '';\n\n  constructor(router?, private _isHtml5 = false) {}\n\n  port(): number {\n    if (location.port) {\n      return Number(location.port);\n    }\n\n    return this.protocol() === 'https' ? 443 : 80;\n  }\n\n  protocol(): string {\n    return location.protocol.replace(/:/g, '');\n  }\n\n  host(): string {\n    return location.hostname;\n  }\n\n  html5Mode(): boolean {\n    return this._isHtml5;\n  }\n\n  hashPrefix(): string;\n  hashPrefix(newprefix?: string): string {\n    return isDefined(newprefix) ? (this._hashPrefix = newprefix) : this._hashPrefix;\n  }\n\n  baseHref(href?: string): string {\n    if (isDefined(href)) this._baseHref = href;\n    if (isUndefined(this._baseHref)) this._baseHref = this.getBaseHref();\n    return this._baseHref;\n  }\n\n  private getBaseHref() {\n    const baseTag: HTMLBaseElement = document.getElementsByTagName('base')[0];\n    if (baseTag && baseTag.href) {\n      return baseTag.href.replace(/^([^/:]*:)?\\/\\/[^/]*/, '');\n    }\n\n    return this._isHtml5 ? '/' : location.pathname || '/';\n  }\n\n  dispose() {}\n}\n",
    "/** @internalapi @module vanilla */ /** */\nimport { BrowserLocationConfig } from './browserLocationConfig';\nimport { HashLocationService } from './hashLocationService';\nimport { locationPluginFactory } from './utils';\nimport { LocationPlugin, ServicesPlugin } from './interface';\nimport { UIRouter } from '../router';\nimport { PushStateLocationService } from './pushStateLocationService';\nimport { MemoryLocationService } from './memoryLocationService';\nimport { MemoryLocationConfig } from './memoryLocationConfig';\nimport { $injector } from './injector';\nimport { $q } from './q';\nimport { services } from '../common/coreservices';\n\nexport function servicesPlugin(router: UIRouter): ServicesPlugin {\n  services.$injector = $injector;\n  services.$q = $q;\n\n  return { name: 'vanilla.services', $q, $injector, dispose: () => null };\n}\n\n/** A `UIRouterPlugin` uses the browser hash to get/set the current location */\nexport const hashLocationPlugin: (router: UIRouter) => LocationPlugin = locationPluginFactory(\n  'vanilla.hashBangLocation',\n  false,\n  HashLocationService,\n  BrowserLocationConfig\n);\n\n/** A `UIRouterPlugin` that gets/sets the current location using the browser's `location` and `history` apis */\nexport const pushStateLocationPlugin: (router: UIRouter) => LocationPlugin = locationPluginFactory(\n  'vanilla.pushStateLocation',\n  true,\n  PushStateLocationService,\n  BrowserLocationConfig\n);\n\n/** A `UIRouterPlugin` that gets/sets the current location from an in-memory object */\nexport const memoryLocationPlugin: (router: UIRouter) => LocationPlugin = locationPluginFactory(\n  'vanilla.memoryLocation',\n  false,\n  MemoryLocationService,\n  MemoryLocationConfig\n);\n",
    "/** @internalapi @module vanilla */ /** */\nexport * from './vanilla/index';\n",
    "/**\n * # Core classes and interfaces\n *\n * The classes and interfaces that are core to ui-router and do not belong\n * to a more specific subsystem (such as resolve).\n *\n * @preferred @publicapi @module core\n */ /** */\n\n// Need to import or export at least one concrete something\nimport { noop } from './common/common';\nimport { UIRouter } from './router';\n\n/**\n * An interface for getting values from dependency injection.\n *\n * This is primarily used to get resolve values for a given token.\n * An instance of the `UIInjector` can be retrieved from the current transition using [[Transition.injector]].\n *\n * ---\n *\n * If no resolve is found for a token, then it will delegate to the native injector.\n * The native injector may be Angular 1 `$injector`, Angular 2 `Injector`, or a simple polyfill.\n *\n * In Angular 2, the native injector might be the root Injector,\n * or it might be a lazy loaded `NgModule` injector scoped to a lazy load state tree.\n */\nexport interface UIInjector {\n  /**\n   * Gets a value from the injector.\n   *\n   * For a given token, returns the value from the injector that matches the token.\n   * If the token is for a resolve that has not yet been fetched, this throws an error.\n   *\n   * #### Example:\n   * ```js\n   * var myResolve = injector.get('myResolve');\n   * ```\n   *\n   * #### ng1 Example:\n   * ```js\n   * // Fetch StateService\n   * injector.get('$state').go('home');\n   * ```\n   *\n   * #### ng2 Example:\n   * ```js\n   * import {StateService} from \"ui-router-ng2\";\n   * // Fetch StateService\n   * injector.get(StateService).go('home');\n   * ```\n   *\n   * #### Typescript Example:\n   * ```js\n   * var stringArray = injector.get<string[]>('myStringArray');\n   * ```\n   *\n   * ### `NOWAIT` policy\n   *\n   * When using [[ResolvePolicy.async]] === `NOWAIT`, the value returned from `get()` is a promise for the result.\n   * The promise is not automatically unwrapped.\n   *\n   * @param token the key for the value to get.  May be a string, a class, or any arbitrary object.\n   * @return the Dependency Injection value that matches the token\n   */\n  get(token: any): any;\n  /** Gets a value as type `T` (generics parameter) */\n  get<T>(token: any): T;\n\n  /**\n   * Asynchronously gets a value from the injector\n   *\n   * For a given token, returns a promise for the value from the injector that matches the token.\n   * If the token is for a resolve that has not yet been fetched, this triggers the resolve to load.\n   *\n   * #### Example:\n   * ```js\n   * return injector.getAsync('myResolve').then(value => {\n   *   if (value === 'declined') return false;\n   * });\n   * ```\n   *\n   * @param token the key for the value to get.  May be a string or arbitrary object.\n   * @return a Promise for the Dependency Injection value that matches the token\n   */\n  getAsync(token: any): Promise<any>;\n  /** Asynchronously gets a value as type `T` (generics parameter) */\n  getAsync<T>(token: any): Promise<T>;\n\n  /**\n   * Gets a value from the native injector\n   *\n   * Returns a value from the native injector, bypassing anything in the [[ResolveContext]].\n   *\n   * Example:\n   * ```js\n   * let someThing = injector.getNative(SomeToken);\n   * ```\n   *\n   * @param token the key for the value to get.  May be a string or arbitrary object.\n   * @return the Dependency Injection value that matches the token\n   */\n  getNative(token: any): any;\n  getNative<T>(token: any): T;\n}\n\n/** @internalapi */\nexport interface UIRouterPlugin extends Disposable {\n  name: string;\n}\n\n/** @internalapi */\nexport abstract class UIRouterPluginBase implements UIRouterPlugin, Disposable {\n  abstract name: string;\n  dispose(router: UIRouter) {}\n}\n\n/** @internalapi */\nexport interface Disposable {\n  /** Instructs the Disposable to clean up any resources */\n  dispose(router?: UIRouter);\n}\n",
    "/** @publicapi @module common */ /** */\n\nexport * from './common/index';\nexport * from './params/index';\nexport * from './path/index';\nexport * from './resolve/index';\nexport * from './state/index';\nexport * from './transition/index';\nexport * from './url/index';\nexport * from './view/index';\nexport * from './globals';\n\nexport * from './router';\nexport * from './vanilla';\nexport * from './interface';\n",
    "/** @publicapi @module ng1 */ /** */\nimport { ng as angular } from '../angular';\nimport {\n  StateObject,\n  pick,\n  forEach,\n  tail,\n  extend,\n  isArray,\n  isInjectable,\n  isDefined,\n  isString,\n  services,\n  trace,\n  ViewConfig,\n  ViewService,\n  ViewConfigFactory,\n  PathNode,\n  ResolveContext,\n  Resolvable,\n  IInjectable,\n} from '@uirouter/core';\nimport { Ng1ViewDeclaration } from '../interface';\nimport { TemplateFactory } from '../templateFactory';\nimport IInjectorService = angular.auto.IInjectorService;\n\n/** @internalapi */\nexport function getNg1ViewConfigFactory(): ViewConfigFactory {\n  let templateFactory: TemplateFactory = null;\n  return (path, view) => {\n    templateFactory = templateFactory || services.$injector.get('$templateFactory');\n    return [new Ng1ViewConfig(path, view, templateFactory)];\n  };\n}\n\n/** @internalapi */\nconst hasAnyKey = (keys, obj) => keys.reduce((acc, key) => acc || isDefined(obj[key]), false);\n\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `views`.\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * handles the `views` property with logic specific to @uirouter/angularjs (ng1).\n *\n * If no `views: {}` property exists on the [[StateDeclaration]], then it creates the `views` object\n * and applies the state-level configuration to a view named `$default`.\n *\n * @internalapi\n */\nexport function ng1ViewsBuilder(state: StateObject) {\n  // Do not process root state\n  if (!state.parent) return {};\n\n  const tplKeys = ['templateProvider', 'templateUrl', 'template', 'notify', 'async'],\n    ctrlKeys = ['controller', 'controllerProvider', 'controllerAs', 'resolveAs'],\n    compKeys = ['component', 'bindings', 'componentProvider'],\n    nonCompKeys = tplKeys.concat(ctrlKeys),\n    allViewKeys = compKeys.concat(nonCompKeys);\n\n  // Do not allow a state to have both state-level props and also a `views: {}` property.\n  // A state without a `views: {}` property can declare properties for the `$default` view as properties of the state.\n  // However, the `$default` approach should not be mixed with a separate `views: ` block.\n  if (isDefined(state.views) && hasAnyKey(allViewKeys, state)) {\n    throw new Error(\n      `State '${state.name}' has a 'views' object. ` +\n        `It cannot also have \"view properties\" at the state level.  ` +\n        `Move the following properties into a view (in the 'views' object): ` +\n        ` ${allViewKeys.filter(key => isDefined(state[key])).join(', ')}`\n    );\n  }\n\n  const views: { [key: string]: Ng1ViewDeclaration } = {},\n    viewsObject = state.views || { $default: pick(state, allViewKeys) };\n\n  forEach(viewsObject, function(config: Ng1ViewDeclaration, name: string) {\n    // Account for views: { \"\": { template... } }\n    name = name || '$default';\n    // Account for views: { header: \"headerComponent\" }\n    if (isString(config)) config = { component: <string>config };\n\n    // Make a shallow copy of the config object\n    config = extend({}, config);\n\n    // Do not allow a view to mix props for component-style view with props for template/controller-style view\n    if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) {\n      throw new Error(\n        `Cannot combine: ${compKeys.join('|')} with: ${nonCompKeys.join('|')} in stateview: '${name}@${state.name}'`\n      );\n    }\n\n    config.resolveAs = config.resolveAs || '$resolve';\n    config.$type = 'ng1';\n    config.$context = state;\n    config.$name = name;\n\n    const normalized = ViewService.normalizeUIViewTarget(config.$context, config.$name);\n    config.$uiViewName = normalized.uiViewName;\n    config.$uiViewContextAnchor = normalized.uiViewContextAnchor;\n\n    views[name] = config;\n  });\n  return views;\n}\n\n/** @hidden */\nlet id = 0;\n\n/** @internalapi */\nexport class Ng1ViewConfig implements ViewConfig {\n  $id = id++;\n  loaded = false;\n  controller: Function; // actually IInjectable|string\n  template: string;\n  component: string;\n  locals: any; // TODO: delete me\n\n  constructor(public path: PathNode[], public viewDecl: Ng1ViewDeclaration, public factory: TemplateFactory) {}\n\n  load() {\n    const $q = services.$q;\n    const context = new ResolveContext(this.path);\n    const params = this.path.reduce((acc, node) => extend(acc, node.paramValues), {});\n\n    const promises: any = {\n      template: $q.when(this.factory.fromConfig(this.viewDecl, params, context)),\n      controller: $q.when(this.getController(context)),\n    };\n\n    return $q.all(promises).then(results => {\n      trace.traceViewServiceEvent('Loaded', this);\n      this.controller = results.controller;\n      extend(this, results.template); // Either { template: \"tpl\" } or { component: \"cmpName\" }\n      return this;\n    });\n  }\n\n  getTemplate = (uiView, context: ResolveContext) =>\n    this.component\n      ? this.factory.makeComponentTemplate(uiView, context, this.component, this.viewDecl.bindings)\n      : this.template;\n\n  /**\n   * Gets the controller for a view configuration.\n   *\n   * @returns {Function|Promise.<Function>} Returns a controller, or a promise that resolves to a controller.\n   */\n  getController(context: ResolveContext): IInjectable | string | Promise<IInjectable | string> {\n    const provider = this.viewDecl.controllerProvider;\n    if (!isInjectable(provider)) return this.viewDecl.controller;\n    const deps = services.$injector.annotate(provider);\n    const providerFn = isArray(provider) ? tail(<any>provider) : provider;\n    const resolvable = new Resolvable('', <any>providerFn, deps);\n    return resolvable.get(context);\n  }\n}\n",
    "/** @publicapi @module view */ /** */\nimport { ng as angular } from './angular';\nimport { IAugmentedJQuery } from 'angular';\nimport {\n  isArray,\n  isDefined,\n  isFunction,\n  isObject,\n  services,\n  Obj,\n  IInjectable,\n  tail,\n  kebobString,\n  unnestR,\n  ResolveContext,\n  Resolvable,\n  RawParams,\n} from '@uirouter/core';\nimport { Ng1ViewDeclaration, TemplateFactoryProvider } from './interface';\n\n/**\n * Service which manages loading of templates from a ViewConfig.\n */\nexport class TemplateFactory implements TemplateFactoryProvider {\n  /** @hidden */ private _useHttp = angular.version.minor < 3;\n  /** @hidden */ private $templateRequest;\n  /** @hidden */ private $templateCache;\n  /** @hidden */ private $http;\n\n  /** @hidden */ $get = [\n    '$http',\n    '$templateCache',\n    '$injector',\n    ($http, $templateCache, $injector) => {\n      this.$templateRequest = $injector.has && $injector.has('$templateRequest') && $injector.get('$templateRequest');\n      this.$http = $http;\n      this.$templateCache = $templateCache;\n      return this;\n    },\n  ];\n\n  /** @hidden */\n  useHttpService(value: boolean) {\n    this._useHttp = value;\n  }\n\n  /**\n   * Creates a template from a configuration object.\n   *\n   * @param config Configuration object for which to load a template.\n   * The following properties are search in the specified order, and the first one\n   * that is defined is used to create the template:\n   *\n   * @param params  Parameters to pass to the template function.\n   * @param context The resolve context associated with the template's view\n   *\n   * @return {string|object}  The template html as a string, or a promise for\n   * that string,or `null` if no template is configured.\n   */\n  fromConfig(\n    config: Ng1ViewDeclaration,\n    params: any,\n    context: ResolveContext\n  ): Promise<{ template?: string; component?: string }> {\n    const defaultTemplate = '<ui-view></ui-view>';\n\n    const asTemplate = result => services.$q.when(result).then(str => ({ template: str }));\n    const asComponent = result => services.$q.when(result).then(str => ({ component: str }));\n\n    return isDefined(config.template)\n      ? asTemplate(this.fromString(config.template, params))\n      : isDefined(config.templateUrl)\n      ? asTemplate(this.fromUrl(config.templateUrl, params))\n      : isDefined(config.templateProvider)\n      ? asTemplate(this.fromProvider(config.templateProvider, params, context))\n      : isDefined(config.component)\n      ? asComponent(config.component)\n      : isDefined(config.componentProvider)\n      ? asComponent(this.fromComponentProvider(config.componentProvider, params, context))\n      : asTemplate(defaultTemplate);\n  }\n\n  /**\n   * Creates a template from a string or a function returning a string.\n   *\n   * @param template html template as a string or function that returns an html template as a string.\n   * @param params Parameters to pass to the template function.\n   *\n   * @return {string|object} The template html as a string, or a promise for that\n   * string.\n   */\n  fromString(template: string | Function, params?: RawParams) {\n    return isFunction(template) ? (<any>template)(params) : template;\n  }\n\n  /**\n   * Loads a template from the a URL via `$http` and `$templateCache`.\n   *\n   * @param {string|Function} url url of the template to load, or a function\n   * that returns a url.\n   * @param {Object} params Parameters to pass to the url function.\n   * @return {string|Promise.<string>} The template html as a string, or a promise\n   * for that string.\n   */\n  fromUrl(url: string | Function, params: any) {\n    if (isFunction(url)) url = (<any>url)(params);\n    if (url == null) return null;\n\n    if (this._useHttp) {\n      return this.$http\n        .get(url, { cache: this.$templateCache, headers: { Accept: 'text/html' } })\n        .then(function(response) {\n          return response.data;\n        });\n    }\n\n    return this.$templateRequest(url);\n  }\n\n  /**\n   * Creates a template by invoking an injectable provider function.\n   *\n   * @param provider Function to invoke via `locals`\n   * @param {Function} injectFn a function used to invoke the template provider\n   * @return {string|Promise.<string>} The template html as a string, or a promise\n   * for that string.\n   */\n  fromProvider(provider: IInjectable, params: any, context: ResolveContext) {\n    const deps = services.$injector.annotate(provider);\n    const providerFn = isArray(provider) ? tail(<any[]>provider) : provider;\n    const resolvable = new Resolvable('', <Function>providerFn, deps);\n    return resolvable.get(context);\n  }\n\n  /**\n   * Creates a component's template by invoking an injectable provider function.\n   *\n   * @param provider Function to invoke via `locals`\n   * @param {Function} injectFn a function used to invoke the template provider\n   * @return {string} The template html as a string: \"<component-name input1='::$resolve.foo'></component-name>\".\n   */\n  fromComponentProvider(provider: IInjectable, params: any, context: ResolveContext) {\n    const deps = services.$injector.annotate(provider);\n    const providerFn = isArray(provider) ? tail(<any[]>provider) : provider;\n    const resolvable = new Resolvable('', <Function>providerFn, deps);\n    return resolvable.get(context);\n  }\n\n  /**\n   * Creates a template from a component's name\n   *\n   * This implements route-to-component.\n   * It works by retrieving the component (directive) metadata from the injector.\n   * It analyses the component's bindings, then constructs a template that instantiates the component.\n   * The template wires input and output bindings to resolves or from the parent component.\n   *\n   * @param uiView {object} The parent ui-view (for binding outputs to callbacks)\n   * @param context The ResolveContext (for binding outputs to callbacks returned from resolves)\n   * @param component {string} Component's name in camel case.\n   * @param bindings An object defining the component's bindings: {foo: '<'}\n   * @return {string} The template as a string: \"<component-name input1='::$resolve.foo'></component-name>\".\n   */\n  makeComponentTemplate(uiView: IAugmentedJQuery, context: ResolveContext, component: string, bindings?: any) {\n    bindings = bindings || {};\n\n    // Bind once prefix\n    const prefix = angular.version.minor >= 3 ? '::' : '';\n    // Convert to kebob name. Add x- prefix if the string starts with `x-` or `data-`\n    const kebob = (camelCase: string) => {\n      const kebobed = kebobString(camelCase);\n      return /^(x|data)-/.exec(kebobed) ? `x-${kebobed}` : kebobed;\n    };\n\n    const attributeTpl = (input: BindingTuple) => {\n      const { name, type } = input;\n      const attrName = kebob(name);\n      // If the ui-view has an attribute which matches a binding on the routed component\n      // then pass that attribute through to the routed component template.\n      // Prefer ui-view wired mappings to resolve data, unless the resolve was explicitly bound using `bindings:`\n      if (uiView.attr(attrName) && !bindings[name]) return `${attrName}='${uiView.attr(attrName)}'`;\n\n      const resolveName = bindings[name] || name;\n      // Pre-evaluate the expression for \"@\" bindings by enclosing in {{ }}\n      // some-attr=\"{{ ::$resolve.someResolveName }}\"\n      if (type === '@') return `${attrName}='{{${prefix}$resolve.${resolveName}}}'`;\n\n      // Wire \"&\" callbacks to resolves that return a callback function\n      // Get the result of the resolve (should be a function) and annotate it to get its arguments.\n      // some-attr=\"$resolve.someResolveResultName(foo, bar)\"\n      if (type === '&') {\n        const res = context.getResolvable(resolveName);\n        const fn = res && res.data;\n        const args = (fn && services.$injector.annotate(fn)) || [];\n        // account for array style injection, i.e., ['foo', function(foo) {}]\n        const arrayIdxStr = isArray(fn) ? `[${fn.length - 1}]` : '';\n        return `${attrName}='$resolve.${resolveName}${arrayIdxStr}(${args.join(',')})'`;\n      }\n\n      // some-attr=\"::$resolve.someResolveName\"\n      return `${attrName}='${prefix}$resolve.${resolveName}'`;\n    };\n\n    const attrs = getComponentBindings(component)\n      .map(attributeTpl)\n      .join(' ');\n    const kebobName = kebob(component);\n    return `<${kebobName} ${attrs}></${kebobName}>`;\n  }\n}\n\n// Gets all the directive(s)' inputs ('@', '=', and '<') and outputs ('&')\nfunction getComponentBindings(name: string) {\n  const cmpDefs = <any[]>services.$injector.get(name + 'Directive'); // could be multiple\n  if (!cmpDefs || !cmpDefs.length) throw new Error(`Unable to find component named '${name}'`);\n  return cmpDefs.map(getBindings).reduce(unnestR, []);\n}\n\n// Given a directive definition, find its object input attributes\n// Use different properties, depending on the type of directive (component, bindToController, normal)\nconst getBindings = (def: any) => {\n  if (isObject(def.bindToController)) return scopeBindings(def.bindToController);\n  return scopeBindings(def.scope);\n};\n\ninterface BindingTuple {\n  name: string;\n  type: string;\n}\n\n// for ng 1.2 style, process the scope: { input: \"=foo\" }\n// for ng 1.3 through ng 1.5, process the component's bindToController: { input: \"=foo\" } object\nconst scopeBindings = (bindingsObj: Obj) =>\n  Object.keys(bindingsObj || {})\n    // [ 'input', [ '=foo', '=', 'foo' ] ]\n    .map(key => [key, /^([=<@&])[?]?(.*)/.exec(bindingsObj[key])])\n    // skip malformed values\n    .filter(tuple => isDefined(tuple) && isArray(tuple[1]))\n    // { name: ('foo' || 'input'), type: '=' }\n    .map(tuple => ({ name: tuple[1][2] || tuple[0], type: tuple[1][1] } as BindingTuple));\n",
    "/** @publicapi @module ng1 */ /** */\nimport {\n  val,\n  isObject,\n  createProxyFunctions,\n  BuilderFunction,\n  StateRegistry,\n  StateService,\n  OnInvalidCallback,\n} from '@uirouter/core';\nimport { Ng1StateDeclaration } from './interface';\n\n/**\n * The Angular 1 `StateProvider`\n *\n * The `$stateProvider` works similar to Angular's v1 router, but it focuses purely\n * on state.\n *\n * A state corresponds to a \"place\" in the application in terms of the overall UI and\n * navigation. A state describes (via the controller / template / view properties) what\n * the UI looks like and does at that place.\n *\n * States often have things in common, and the primary way of factoring out these\n * commonalities in this model is via the state hierarchy, i.e. parent/child states aka\n * nested states.\n *\n * The `$stateProvider` provides interfaces to declare these states for your app.\n */\nexport class StateProvider {\n  constructor(private stateRegistry: StateRegistry, private stateService: StateService) {\n    createProxyFunctions(val(StateProvider.prototype), this, val(this));\n  }\n\n  /**\n   * Decorates states when they are registered\n   *\n   * Allows you to extend (carefully) or override (at your own peril) the\n   * `stateBuilder` object used internally by [[StateRegistry]].\n   * This can be used to add custom functionality to ui-router,\n   * for example inferring templateUrl based on the state name.\n   *\n   * When passing only a name, it returns the current (original or decorated) builder\n   * function that matches `name`.\n   *\n   * The builder functions that can be decorated are listed below. Though not all\n   * necessarily have a good use case for decoration, that is up to you to decide.\n   *\n   * In addition, users can attach custom decorators, which will generate new\n   * properties within the state's internal definition. There is currently no clear\n   * use-case for this beyond accessing internal states (i.e. $state.$current),\n   * however, expect this to become increasingly relevant as we introduce additional\n   * meta-programming features.\n   *\n   * **Warning**: Decorators should not be interdependent because the order of\n   * execution of the builder functions in non-deterministic. Builder functions\n   * should only be dependent on the state definition object and super function.\n   *\n   *\n   * Existing builder functions and current return values:\n   *\n   * - **parent** `{object}` - returns the parent state object.\n   * - **data** `{object}` - returns state data, including any inherited data that is not\n   *   overridden by own values (if any).\n   * - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher}\n   *   or `null`.\n   * - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is\n   *   navigable).\n   * - **params** `{object}` - returns an array of state params that are ensured to\n   *   be a super-set of parent's params.\n   * - **views** `{object}` - returns a views object where each key is an absolute view\n   *   name (i.e. \"viewName@stateName\") and each value is the config object\n   *   (template, controller) for the view. Even when you don't use the views object\n   *   explicitly on a state config, one is still created for you internally.\n   *   So by decorating this builder function you have access to decorating template\n   *   and controller properties.\n   * - **ownParams** `{object}` - returns an array of params that belong to the state,\n   *   not including any params defined by ancestor states.\n   * - **path** `{string}` - returns the full path from the root down to this state.\n   *   Needed for state activation.\n   * - **includes** `{object}` - returns an object that includes every state that\n   *   would pass a `$state.includes()` test.\n   *\n   * #### Example:\n   * Override the internal 'views' builder with a function that takes the state\n   * definition, and a reference to the internal function being overridden:\n   * ```js\n   * $stateProvider.decorator('views', function (state, parent) {\n   *   let result = {},\n   *       views = parent(state);\n   *\n   *   angular.forEach(views, function (config, name) {\n   *     let autoName = (state.name + '.' + name).replace('.', '/');\n   *     config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';\n   *     result[name] = config;\n   *   });\n   *   return result;\n   * });\n   *\n   * $stateProvider.state('home', {\n   *   views: {\n   *     'contact.list': { controller: 'ListController' },\n   *     'contact.item': { controller: 'ItemController' }\n   *   }\n   * });\n   * ```\n   *\n   *\n   * ```js\n   * // Auto-populates list and item views with /partials/home/contact/list.html,\n   * // and /partials/home/contact/item.html, respectively.\n   * $state.go('home');\n   * ```\n   *\n   * @param {string} name The name of the builder function to decorate.\n   * @param {object} func A function that is responsible for decorating the original\n   * builder function. The function receives two parameters:\n   *\n   *   - `{object}` - state - The state config object.\n   *   - `{object}` - super - The original builder function.\n   *\n   * @return {object} $stateProvider - $stateProvider instance\n   */\n  decorator(name: string, func: BuilderFunction) {\n    return this.stateRegistry.decorator(name, func) || this;\n  }\n\n  /**\n   * Registers a state\n   *\n   * ### This is a passthrough to [[StateRegistry.register]].\n   *\n   * Registers a state configuration under a given state name.\n   * The stateConfig object has the following acceptable properties.\n   *\n   * <a id='template'></a>\n   *\n   * - **`template`** - {string|function=} - html template as a string or a function that returns\n   *   an html template as a string which should be used by the uiView directives. This property\n   *   takes precedence over templateUrl.\n   *\n   *   If `template` is a function, it will be called with the following parameters:\n   *\n   *   - {array.&lt;object&gt;} - state parameters extracted from the current $location.path() by\n   *     applying the current state\n   *\n   * <a id='templateUrl'></a>\n   *\n   * - **`templateUrl`** - {string|function=} - path or function that returns a path to an html\n   *   template that should be used by uiView.\n   *\n   *   If `templateUrl` is a function, it will be called with the following parameters:\n   *\n   *   - {array.&lt;object&gt;} - state parameters extracted from the current $location.path() by\n   *     applying the current state\n   *\n   * <a id='templateProvider'></a>\n   *\n   * - **`templateProvider`** - {function=} - Provider function that returns HTML content\n   *   string.\n   *\n   * <a id='controller'></a>\n   *\n   * - **`controller`** - {string|function=} -  Controller fn that should be associated with newly\n   *   related scope or the name of a registered controller if passed as a string.\n   *\n   * <a id='controllerProvider'></a>\n   *\n   * - **`controllerProvider`** - {function=} - Injectable provider function that returns\n   *   the actual controller or string.\n   *\n   * <a id='controllerAs'></a>\n   *\n   * - **`controllerAs`** – {string=} – A controller alias name. If present the controller will be\n   *   published to scope under the controllerAs name.\n   *\n   * <a id='resolve'></a>\n   *\n   * - **`resolve`** - {object.&lt;string, function&gt;=} - An optional map of dependencies which\n   *   should be injected into the controller. If any of these dependencies are promises,\n   *   the router will wait for them all to be resolved or one to be rejected before the\n   *   controller is instantiated. If all the promises are resolved successfully, the values\n   *   of the resolved promises are injected and $stateChangeSuccess event is fired. If any\n   *   of the promises are rejected the $stateChangeError event is fired. The map object is:\n   *\n   *   - key - {string}: name of dependency to be injected into controller\n   *   - factory - {string|function}: If string then it is alias for service. Otherwise if function,\n   *     it is injected and return value it treated as dependency. If result is a promise, it is\n   *     resolved before its value is injected into controller.\n   *\n   * <a id='url'></a>\n   *\n   * - **`url`** - {string=} - A url with optional parameters. When a state is navigated or\n   *   transitioned to, the `$stateParams` service will be populated with any\n   *   parameters that were passed.\n   *\n   * <a id='params'></a>\n   *\n   * - **`params`** - {object=} - An array of parameter names or regular expressions. Only\n   *   use this within a state if you are not using url. Otherwise you can specify your\n   *   parameters within the url. When a state is navigated or transitioned to, the\n   *   $stateParams service will be populated with any parameters that were passed.\n   *\n   * <a id='views'></a>\n   *\n   * - **`views`** - {object=} - Use the views property to set up multiple views or to target views\n   *   manually/explicitly.\n   *\n   * <a id='abstract'></a>\n   *\n   * - **`abstract`** - {boolean=} - An abstract state will never be directly activated,\n   *   but can provide inherited properties to its common children states.\n   *\n   * <a id='onEnter'></a>\n   *\n   * - **`onEnter`** - {object=} - Callback function for when a state is entered. Good way\n   *   to trigger an action or dispatch an event, such as opening a dialog.\n   * If minifying your scripts, make sure to use the `['injection1', 'injection2', function(injection1, injection2){}]` syntax.\n   *\n   * <a id='onExit'></a>\n   *\n   * - **`onExit`** - {object=} - Callback function for when a state is exited. Good way to\n   *   trigger an action or dispatch an event, such as opening a dialog.\n   * If minifying your scripts, make sure to use the `['injection1', 'injection2', function(injection1, injection2){}]` syntax.\n   *\n   * <a id='reloadOnSearch'></a>\n   *\n   * - **`reloadOnSearch = true`** - {boolean=} - If `false`, will not retrigger the same state\n   *   just because a search/query parameter has changed (via $location.search() or $location.hash()).\n   *   Useful for when you'd like to modify $location.search() without triggering a reload.\n   *\n   * <a id='data'></a>\n   *\n   * - **`data`** - {object=} - Arbitrary data object, useful for custom configuration.\n   *\n   * #### Example:\n   * Some state name examples\n   * ```js\n   * // stateName can be a single top-level name (must be unique).\n   * $stateProvider.state(\"home\", {});\n   *\n   * // Or it can be a nested state name. This state is a child of the\n   * // above \"home\" state.\n   * $stateProvider.state(\"home.newest\", {});\n   *\n   * // Nest states as deeply as needed.\n   * $stateProvider.state(\"home.newest.abc.xyz.inception\", {});\n   *\n   * // state() returns $stateProvider, so you can chain state declarations.\n   * $stateProvider\n   *   .state(\"home\", {})\n   *   .state(\"about\", {})\n   *   .state(\"contacts\", {});\n   * ```\n   *\n   * @param {string} name A unique state name, e.g. \"home\", \"about\", \"contacts\".\n   * To create a parent/child state use a dot, e.g. \"about.sales\", \"home.newest\".\n   * @param {object} definition State configuration object.\n   */\n  state(name: string, definition: Ng1StateDeclaration): StateProvider;\n  state(definition: Ng1StateDeclaration): StateProvider;\n  state(name: any, definition?: any) {\n    if (isObject(name)) {\n      definition = name;\n    } else {\n      definition.name = name;\n    }\n    this.stateRegistry.register(definition);\n    return this;\n  }\n\n  /**\n   * Registers an invalid state handler\n   *\n   * This is a passthrough to [[StateService.onInvalid]] for ng1.\n   */\n\n  onInvalid(callback: OnInvalidCallback): Function {\n    return this.stateService.onInvalid(callback);\n  }\n}\n",
    "/** @publicapi @module ng1 */ /** */\nimport {\n  StateObject,\n  TransitionStateHookFn,\n  HookResult,\n  Transition,\n  services,\n  ResolveContext,\n  extend,\n  BuilderFunction,\n} from '@uirouter/core';\nimport { getLocals } from '../services';\nimport { Ng1StateDeclaration } from '../interface';\n\n/**\n * This is a [[StateBuilder.builder]] function for angular1 `onEnter`, `onExit`,\n * `onRetain` callback hooks on a [[Ng1StateDeclaration]].\n *\n * When the [[StateBuilder]] builds a [[StateObject]] object from a raw [[StateDeclaration]], this builder\n * ensures that those hooks are injectable for @uirouter/angularjs (ng1).\n *\n * @internalapi\n */\nexport const getStateHookBuilder = (hookName: 'onEnter' | 'onExit' | 'onRetain') =>\n  function stateHookBuilder(stateObject: StateObject, parentFn: BuilderFunction): TransitionStateHookFn {\n    const hook = stateObject[hookName];\n    const pathname = hookName === 'onExit' ? 'from' : 'to';\n\n    function decoratedNg1Hook(trans: Transition, state: Ng1StateDeclaration): HookResult {\n      const resolveContext = new ResolveContext(trans.treeChanges(pathname));\n      const subContext = resolveContext.subContext(state.$$state());\n      const locals = extend(getLocals(subContext), { $state$: state, $transition$: trans });\n      return services.$injector.invoke(hook, this, locals);\n    }\n\n    return hook ? decoratedNg1Hook : undefined;\n  };\n",
    "/** @publicapi @module ng1 */ /** */\nimport { LocationConfig, LocationServices, UIRouter, ParamType, isDefined } from '@uirouter/core';\nimport { val, createProxyFunctions, removeFrom, isObject } from '@uirouter/core';\nimport { ILocationService, ILocationProvider, IWindowService } from 'angular';\n\n/**\n * Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service\n * @internalapi\n */\nexport class Ng1LocationServices implements LocationConfig, LocationServices {\n  private $locationProvider: ILocationProvider;\n  private $location: ILocationService;\n  private $sniffer: any;\n  private $browser: any;\n  private $window: IWindowService;\n\n  path;\n  search;\n  hash;\n  hashPrefix;\n  port;\n  protocol;\n  host;\n\n  private _baseHref: string;\n\n  // .onChange() registry\n  private _urlListeners: Function[] = [];\n\n  /**\n   * Applys ng1-specific path parameter encoding\n   *\n   * The Angular 1 `$location` service is a bit weird.\n   * It doesn't allow slashes to be encoded/decoded bi-directionally.\n   *\n   * See the writeup at https://github.com/angular-ui/ui-router/issues/2598\n   *\n   * This code patches the `path` parameter type so it encoded/decodes slashes as ~2F\n   *\n   * @param router\n   */\n  static monkeyPatchPathParameterType(router: UIRouter) {\n    const pathType: ParamType = router.urlMatcherFactory.type('path');\n\n    pathType.encode = (x: any) =>\n      x != null ? x.toString().replace(/(~|\\/)/g, m => ({ '~': '~~', '/': '~2F' }[m])) : x;\n\n    pathType.decode = (x: string) =>\n      x != null ? x.toString().replace(/(~~|~2F)/g, m => ({ '~~': '~', '~2F': '/' }[m])) : x;\n  }\n\n  dispose() {}\n\n  constructor($locationProvider: ILocationProvider) {\n    this.$locationProvider = $locationProvider;\n    const _lp = val($locationProvider);\n    createProxyFunctions(_lp, this, _lp, ['hashPrefix']);\n  }\n\n  onChange(callback: Function) {\n    this._urlListeners.push(callback);\n    return () => removeFrom(this._urlListeners)(callback);\n  }\n\n  html5Mode() {\n    let html5Mode: any = this.$locationProvider.html5Mode();\n    html5Mode = isObject(html5Mode) ? html5Mode.enabled : html5Mode;\n    return html5Mode && this.$sniffer.history;\n  }\n\n  baseHref() {\n    return this._baseHref || (this._baseHref = this.$browser.baseHref() || this.$window.location.pathname);\n  }\n\n  url(newUrl?: string, replace = false, state?) {\n    if (isDefined(newUrl)) this.$location.url(newUrl);\n    if (replace) this.$location.replace();\n    if (state) this.$location.state(state);\n    return this.$location.url();\n  }\n\n  _runtimeServices($rootScope, $location: ILocationService, $sniffer, $browser, $window: IWindowService) {\n    this.$location = $location;\n    this.$sniffer = $sniffer;\n    this.$browser = $browser;\n    this.$window = $window;\n\n    // Bind $locationChangeSuccess to the listeners registered in LocationService.onChange\n    $rootScope.$on('$locationChangeSuccess', evt => this._urlListeners.forEach(fn => fn(evt)));\n    const _loc = val($location);\n\n    // Bind these LocationService functions to $location\n    createProxyFunctions(_loc, this, _loc, ['replace', 'path', 'search', 'hash']);\n    // Bind these LocationConfig functions to $location\n    createProxyFunctions(_loc, this, _loc, ['port', 'protocol', 'host']);\n  }\n}\n",
    "/** @publicapi @module url */ /** */\nimport {\n  UIRouter,\n  LocationServices,\n  $InjectorLike,\n  BaseUrlRule,\n  UrlRuleHandlerFn,\n  UrlMatcher,\n  IInjectable,\n  UrlRouter,\n} from '@uirouter/core';\nimport { services, isString, isFunction, isArray, identity } from '@uirouter/core';\n\nexport interface RawNg1RuleFunction {\n  ($injector: $InjectorLike, $location: LocationServices): string | void;\n}\n\n/**\n * Manages rules for client-side URL\n *\n * ### Deprecation warning:\n * This class is now considered to be an internal API\n * Use the [[UrlService]] instead.\n * For configuring URL rules, use the [[UrlRulesApi]] which can be found as [[UrlService.rules]].\n *\n * This class manages the router rules for what to do when the URL changes.\n *\n * This provider remains for backwards compatibility.\n *\n * @internalapi\n * @deprecated\n */\nexport class UrlRouterProvider {\n  static injectableHandler(router: UIRouter, handler): UrlRuleHandlerFn {\n    return match => services.$injector.invoke(handler, null, { $match: match, $stateParams: router.globals.params });\n  }\n\n  /** @hidden */\n  constructor(/** @hidden */ private router: UIRouter) {}\n\n  /** @hidden */\n  $get(): UrlRouter {\n    const urlService = this.router.urlService;\n    this.router.urlRouter.update(true);\n    if (!urlService.interceptDeferred) urlService.listen();\n    return this.router.urlRouter;\n  }\n\n  /**\n   * Registers a url handler function.\n   *\n   * Registers a low level url handler (a `rule`).\n   * A rule detects specific URL patterns and returns a redirect, or performs some action.\n   *\n   * If a rule returns a string, the URL is replaced with the string, and all rules are fired again.\n   *\n   * #### Example:\n   * ```js\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   // Here's an example of how you might allow case insensitive urls\n   *   $urlRouterProvider.rule(function ($injector, $location) {\n   *     var path = $location.path(),\n   *         normalized = path.toLowerCase();\n   *\n   *     if (path !== normalized) {\n   *       return normalized;\n   *     }\n   *   });\n   * });\n   * ```\n   *\n   * @param ruleFn\n   * Handler function that takes `$injector` and `$location` services as arguments.\n   * You can use them to detect a url and return a different url as a string.\n   *\n   * @return [[UrlRouterProvider]] (`this`)\n   */\n  rule(ruleFn: RawNg1RuleFunction): UrlRouterProvider {\n    if (!isFunction(ruleFn)) throw new Error(\"'rule' must be a function\");\n\n    const match = () => ruleFn(services.$injector, this.router.locationService);\n\n    const rule = new BaseUrlRule(match, identity);\n    this.router.urlService.rules.rule(rule);\n    return this;\n  }\n\n  /**\n   * Defines the path or behavior to use when no url can be matched.\n   *\n   * #### Example:\n   * ```js\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   // if the path doesn't match any of the urls you configured\n   *   // otherwise will take care of routing the user to the\n   *   // specified url\n   *   $urlRouterProvider.otherwise('/index');\n   *\n   *   // Example of using function rule as param\n   *   $urlRouterProvider.otherwise(function ($injector, $location) {\n   *     return '/a/valid/url';\n   *   });\n   * });\n   * ```\n   *\n   * @param rule\n   * The url path you want to redirect to or a function rule that returns the url path or performs a `$state.go()`.\n   * The function version is passed two params: `$injector` and `$location` services, and should return a url string.\n   *\n   * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance\n   */\n  otherwise(rule: string | RawNg1RuleFunction): UrlRouterProvider {\n    const urlRules = this.router.urlService.rules;\n    if (isString(rule)) {\n      urlRules.otherwise(rule);\n    } else if (isFunction(rule)) {\n      urlRules.otherwise(() => rule(services.$injector, this.router.locationService));\n    } else {\n      throw new Error(\"'rule' must be a string or function\");\n    }\n\n    return this;\n  }\n\n  /**\n   * Registers a handler for a given url matching.\n   *\n   * If the handler is a string, it is\n   * treated as a redirect, and is interpolated according to the syntax of match\n   * (i.e. like `String.replace()` for `RegExp`, or like a `UrlMatcher` pattern otherwise).\n   *\n   * If the handler is a function, it is injectable.\n   * It gets invoked if `$location` matches.\n   * You have the option of inject the match object as `$match`.\n   *\n   * The handler can return\n   *\n   * - **falsy** to indicate that the rule didn't match after all, then `$urlRouter`\n   *   will continue trying to find another one that matches.\n   * - **string** which is treated as a redirect and passed to `$location.url()`\n   * - **void** or any **truthy** value tells `$urlRouter` that the url was handled.\n   *\n   * #### Example:\n   * ```js\n   * var app = angular.module('app', ['ui.router.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   $urlRouterProvider.when($state.url, function ($match, $stateParams) {\n   *     if ($state.$current.navigable !== state ||\n   *         !equalForKeys($match, $stateParams) {\n   *      $state.transitionTo(state, $match, false);\n   *     }\n   *   });\n   * });\n   * ```\n   *\n   * @param what A pattern string to match, compiled as a [[UrlMatcher]].\n   * @param handler The path (or function that returns a path) that you want to redirect your user to.\n   * @param ruleCallback [optional] A callback that receives the `rule` registered with [[UrlMatcher.rule]]\n   *\n   * Note: the handler may also invoke arbitrary code, such as `$state.go()`\n   */\n  when(what: RegExp | UrlMatcher | string, handler: string | IInjectable) {\n    if (isArray(handler) || isFunction(handler)) {\n      handler = UrlRouterProvider.injectableHandler(this.router, handler);\n    }\n\n    this.router.urlService.rules.when(what, handler as any);\n    return this;\n  }\n\n  /**\n   * Disables monitoring of the URL.\n   *\n   * Call this method before UI-Router has bootstrapped.\n   * It will stop UI-Router from performing the initial url sync.\n   *\n   * This can be useful to perform some asynchronous initialization before the router starts.\n   * Once the initialization is complete, call [[listen]] to tell UI-Router to start watching and synchronizing the URL.\n   *\n   * #### Example:\n   * ```js\n   * var app = angular.module('app', ['ui.router']);\n   *\n   * app.config(function ($urlRouterProvider) {\n   *   // Prevent $urlRouter from automatically intercepting URL changes;\n   *   $urlRouterProvider.deferIntercept();\n   * })\n   *\n   * app.run(function (MyService, $urlRouter, $http) {\n   *   $http.get(\"/stuff\").then(function(resp) {\n   *     MyService.doStuff(resp.data);\n   *     $urlRouter.listen();\n   *     $urlRouter.sync();\n   *   });\n   * });\n   * ```\n   *\n   * @param defer Indicates whether to defer location change interception.\n   *        Passing no parameter is equivalent to `true`.\n   */\n  deferIntercept(defer?: boolean) {\n    this.router.urlService.deferIntercept(defer);\n  }\n}\n",
    "/**\n * # Angular 1 types\n *\n * UI-Router core provides various Typescript types which you can use for code completion and validating parameter values, etc.\n * The customizations to the core types for Angular UI-Router are documented here.\n *\n * The optional [[$resolve]] service is also documented here.\n *\n * @preferred @publicapi @module ng1\n */ /** */\nimport { ng as angular } from './angular';\nimport {\n  IRootScopeService,\n  IQService,\n  ILocationService,\n  ILocationProvider,\n  IHttpService,\n  ITemplateCacheService,\n} from 'angular';\nimport {\n  services,\n  applyPairs,\n  isString,\n  trace,\n  extend,\n  UIRouter,\n  StateService,\n  UrlRouter,\n  UrlMatcherFactory,\n  ResolveContext,\n  unnestR,\n  TypedMap,\n} from '@uirouter/core';\nimport { ng1ViewsBuilder, getNg1ViewConfigFactory } from './statebuilders/views';\nimport { TemplateFactory } from './templateFactory';\nimport { StateProvider } from './stateProvider';\nimport { getStateHookBuilder } from './statebuilders/onEnterExitRetain';\nimport { Ng1LocationServices } from './locationServices';\nimport { UrlRouterProvider } from './urlRouterProvider';\nimport IInjectorService = angular.auto.IInjectorService; // tslint:disable-line\n\nangular.module('ui.router.angular1', []);\nconst mod_init = angular.module('ui.router.init', ['ng']);\nconst mod_util = angular.module('ui.router.util', ['ui.router.init']);\nconst mod_rtr = angular.module('ui.router.router', ['ui.router.util']);\nconst mod_state = angular.module('ui.router.state', ['ui.router.router', 'ui.router.util', 'ui.router.angular1']);\nconst mod_main = angular.module('ui.router', ['ui.router.init', 'ui.router.state', 'ui.router.angular1']);\nconst mod_cmpt = angular.module('ui.router.compat', ['ui.router']); // tslint:disable-line\n\ndeclare module '@uirouter/core/lib/router' {\n  interface UIRouter {\n    // tslint:disable-line:no-shadowed-variable\n    /** @hidden */\n    stateProvider: StateProvider;\n    /** @hidden */\n    urlRouterProvider: UrlRouterProvider;\n  }\n}\n\nlet router: UIRouter = null;\n\n$uiRouterProvider.$inject = ['$locationProvider'];\n/** This angular 1 provider instantiates a Router and exposes its services via the angular injector */\nfunction $uiRouterProvider($locationProvider: ILocationProvider) {\n  // Create a new instance of the Router when the $uiRouterProvider is initialized\n  router = this.router = new UIRouter();\n  router.stateProvider = new StateProvider(router.stateRegistry, router.stateService);\n\n  // Apply ng1 specific StateBuilder code for `views`, `resolve`, and `onExit/Retain/Enter` properties\n  router.stateRegistry.decorator('views', ng1ViewsBuilder);\n  router.stateRegistry.decorator('onExit', getStateHookBuilder('onExit'));\n  router.stateRegistry.decorator('onRetain', getStateHookBuilder('onRetain'));\n  router.stateRegistry.decorator('onEnter', getStateHookBuilder('onEnter'));\n\n  router.viewService._pluginapi._viewConfigFactory('ng1', getNg1ViewConfigFactory());\n\n  const ng1LocationService = (router.locationService = router.locationConfig = new Ng1LocationServices(\n    $locationProvider\n  ));\n\n  Ng1LocationServices.monkeyPatchPathParameterType(router);\n\n  // backwards compat: also expose router instance as $uiRouterProvider.router\n  router['router'] = router;\n  router['$get'] = $get;\n  $get.$inject = ['$location', '$browser', '$window', '$sniffer', '$rootScope', '$http', '$templateCache'];\n  function $get(\n    $location: ILocationService,\n    $browser: any,\n    $window: any,\n    $sniffer: any,\n    $rootScope: ng.IScope,\n    $http: IHttpService,\n    $templateCache: ITemplateCacheService\n  ) {\n    ng1LocationService._runtimeServices($rootScope, $location, $sniffer, $browser, $window);\n    delete router['router'];\n    delete router['$get'];\n    return router;\n  }\n  return router;\n}\n\nconst getProviderFor = serviceName => [\n  '$uiRouterProvider',\n  $urp => {\n    const service = $urp.router[serviceName];\n    service['$get'] = () => service;\n    return service;\n  },\n];\n\n// This effectively calls $get() on `$uiRouterProvider` to trigger init (when ng enters runtime)\nrunBlock.$inject = ['$injector', '$q', '$uiRouter'];\nfunction runBlock($injector: IInjectorService, $q: IQService, $uiRouter: UIRouter) {\n  services.$injector = $injector;\n  services.$q = <any>$q;\n\n  // https://github.com/angular-ui/ui-router/issues/3678\n  if (!$injector.hasOwnProperty('strictDi')) {\n    try {\n      $injector.invoke(function(checkStrictDi) {});\n    } catch (error) {\n      $injector.strictDi = !!/strict mode/.exec(error && error.toString());\n    }\n  }\n\n  // The $injector is now available.\n  // Find any resolvables that had dependency annotation deferred\n  $uiRouter.stateRegistry\n    .get()\n    .map(x => x.$$state().resolvables)\n    .reduce(unnestR, [])\n    .filter(x => x.deps === 'deferred')\n    .forEach(resolvable => (resolvable.deps = $injector.annotate(resolvable.resolveFn, $injector.strictDi)));\n}\n\n// $urlRouter service and $urlRouterProvider\nconst getUrlRouterProvider = (uiRouter: UIRouter) => (uiRouter.urlRouterProvider = new UrlRouterProvider(uiRouter));\n\n// $state service and $stateProvider\n// $urlRouter service and $urlRouterProvider\nconst getStateProvider = () => extend(router.stateProvider, { $get: () => router.stateService });\n\nwatchDigests.$inject = ['$rootScope'];\nexport function watchDigests($rootScope: IRootScopeService) {\n  $rootScope.$watch(function() {\n    trace.approximateDigests++;\n  });\n}\n\nmod_init.provider('$uiRouter', <any>$uiRouterProvider);\nmod_rtr.provider('$urlRouter', ['$uiRouterProvider', getUrlRouterProvider]);\nmod_util.provider('$urlService', getProviderFor('urlService'));\nmod_util.provider('$urlMatcherFactory', ['$uiRouterProvider', () => router.urlMatcherFactory]);\nmod_util.provider('$templateFactory', () => new TemplateFactory());\nmod_state.provider('$stateRegistry', getProviderFor('stateRegistry'));\nmod_state.provider('$uiRouterGlobals', getProviderFor('globals'));\nmod_state.provider('$transitions', getProviderFor('transitionService'));\nmod_state.provider('$state', ['$uiRouterProvider', getStateProvider]);\n\nmod_state.factory('$stateParams', ['$uiRouter', ($uiRouter: UIRouter) => $uiRouter.globals.params]);\nmod_main.factory('$view', () => router.viewService);\nmod_main.service('$trace', () => trace);\n\nmod_main.run(watchDigests);\nmod_util.run(['$urlMatcherFactory', function($urlMatcherFactory: UrlMatcherFactory) {}]);\nmod_state.run(['$state', function($state: StateService) {}]);\nmod_rtr.run(['$urlRouter', function($urlRouter: UrlRouter) {}]);\nmod_init.run(runBlock);\n\n/** @hidden TODO: find a place to move this */\nexport const getLocals = (ctx: ResolveContext): TypedMap<any> => {\n  const tokens = ctx.getTokens().filter(isString);\n\n  const tuples = tokens.map(key => {\n    const resolvable = ctx.getResolvable(key);\n    const waitPolicy = ctx.getPolicy(resolvable).async;\n    return [key, waitPolicy === 'NOWAIT' ? resolvable.promise : resolvable.data];\n  });\n\n  return tuples.reduce(applyPairs, {});\n};\n",
    "/**\n * # Angular 1 injectable services\n *\n * This is a list of the objects which can be injected using angular's injector.\n *\n * There are three different kind of injectable objects:\n *\n * ## **Provider** objects\n * #### injectable into a `.config()` block during configtime\n *\n * - [[$uiRouterProvider]]: The UI-Router instance\n * - [[$stateProvider]]: State registration\n * - [[$transitionsProvider]]: Transition hooks\n * - [[$urlServiceProvider]]: All URL related public APIs\n *\n * - [[$uiViewScrollProvider]]: Disable ui-router view scrolling\n * - [[$urlRouterProvider]]: (deprecated) Url matching rules\n * - [[$urlMatcherFactoryProvider]]: (deprecated) Url parsing config\n *\n * ## **Service** objects\n * #### injectable globally during runtime\n *\n * - [[$uiRouter]]: The UI-Router instance\n * - [[$trace]]: Enable transition trace/debug\n * - [[$transitions]]: Transition hooks\n * - [[$state]]: Imperative state related APIs\n * - [[$stateRegistry]]: State registration\n * - [[$urlService]]: All URL related public APIs\n * - [[$uiRouterGlobals]]: Global variables\n * - [[$uiViewScroll]]: Scroll an element into view\n *\n * - [[$stateParams]]: (deprecated) Global state param values\n * - [[$urlRouter]]: (deprecated) URL synchronization\n * - [[$urlMatcherFactory]]: (deprecated) URL parsing config\n *\n * ## **Per-Transition** objects\n *\n * - These kind of objects are injectable into:\n *   - Resolves ([[Ng1StateDeclaration.resolve]]),\n *   - Transition Hooks ([[TransitionService.onStart]], etc),\n *   - Routed Controllers ([[Ng1ViewDeclaration.controller]])\n *\n * #### Different instances are injected based on the [[Transition]]\n *\n * - [[$transition$]]: The current Transition object\n * - [[$stateParams]]: State param values for pending Transition (deprecated)\n * - Any resolve data defined using [[Ng1StateDeclaration.resolve]]\n *\n * @preferred @publicapi @module injectables\n */ /** */\n/* tslint:disable:prefer-const */\nimport { StateProvider } from './stateProvider';\nimport {\n  StateService,\n  TransitionService,\n  Transition,\n  UrlRouter,\n  UrlMatcherFactory,\n  StateParams,\n  StateRegistry,\n  UIRouterGlobals,\n  UIRouter,\n  Trace,\n  UrlService,\n} from '@uirouter/core';\nimport { UIViewScrollProvider } from './viewScroll';\nimport { UrlRouterProvider } from './urlRouterProvider';\n\n/**\n * The current (or pending) State Parameters\n *\n * An injectable global **Service Object** which holds the state parameters for the latest **SUCCESSFUL** transition.\n *\n * The values are not updated until *after* a `Transition` successfully completes.\n *\n * **Also:** an injectable **Per-Transition Object** object which holds the pending state parameters for the pending `Transition` currently running.\n *\n * ### Deprecation warning:\n *\n * The value injected for `$stateParams` is different depending on where it is injected.\n *\n * - When injected into an angular service, the object injected is the global **Service Object** with the parameter values for the latest successful `Transition`.\n * - When injected into transition hooks, resolves, or view controllers, the object is the **Per-Transition Object** with the parameter values for the running `Transition`.\n *\n * Because of these confusing details, this service is deprecated.\n *\n * ### Instead of using the global `$stateParams` service object,\n * inject [[$uiRouterGlobals]] and use [[UIRouterGlobals.params]]\n *\n * ```js\n * MyService.$inject = ['$uiRouterGlobals'];\n * function MyService($uiRouterGlobals) {\n *   return {\n *     paramValues: function () {\n *       return $uiRouterGlobals.params;\n *     }\n *   }\n * }\n * ```\n *\n * ### Instead of using the per-transition `$stateParams` object,\n * inject the current `Transition` (as [[$transition$]]) and use [[Transition.params]]\n *\n * ```js\n * MyController.$inject = ['$transition$'];\n * function MyController($transition$) {\n *   var username = $transition$.params().username;\n *   // .. do something with username\n * }\n * ```\n *\n * ---\n *\n * This object can be injected into other services.\n *\n * #### Deprecated Example:\n * ```js\n * SomeService.$inject = ['$http', '$stateParams'];\n * function SomeService($http, $stateParams) {\n *   return {\n *     getUser: function() {\n *       return $http.get('/api/users/' + $stateParams.username);\n *     }\n *   }\n * };\n * angular.service('SomeService', SomeService);\n * ```\n * @deprecated\n */\nlet $stateParams: StateParams;\n\n/**\n * Global UI-Router variables\n *\n * The router global state as a **Service Object** (injectable during runtime).\n *\n * This object contains globals such as the current state and current parameter values.\n */\nlet $uiRouterGlobals: UIRouterGlobals;\n\n/**\n * The UI-Router instance\n *\n * The [[UIRouter]] singleton (the router instance) as a **Service Object** (injectable during runtime).\n *\n * This object is the UI-Router singleton instance, created by angular dependency injection during application bootstrap.\n * It has references to the other UI-Router services\n *\n * #### Note: This object is also exposed as [[$uiRouterProvider]] for injection during angular config time.\n */\nlet $uiRouter: UIRouter;\n\n/**\n * The UI-Router instance\n *\n * The [[UIRouter]] singleton (the router instance) as a **Provider Object** (injectable during config phase).\n *\n * This object is the UI-Router singleton instance, created by angular dependency injection during application bootstrap.\n * It has references to the other UI-Router services\n *\n * #### Note: This object is also exposed as [[$uiRouter]] for injection during runtime.\n */\nlet $uiRouterProvider: UIRouter;\n\n/**\n * Transition debug/tracing\n *\n * The [[Trace]] singleton as a **Service Object** (injectable during runtime).\n *\n * Enables or disables Transition tracing which can help to debug issues.\n */\nlet $trace: Trace;\n\n/**\n * The Transition Service\n *\n * The [[TransitionService]] singleton as a **Service Object** (injectable during runtime).\n *\n * This angular service exposes the [[TransitionService]] singleton, which is primarily\n * used to register global transition hooks.\n *\n * #### Note: This object is also exposed as [[$transitionsProvider]] for injection during the config phase.\n */\nlet $transitions: TransitionService;\n\n/**\n * The Transition Service\n *\n * The [[TransitionService]] singleton as a **Provider Object** (injectable during config phase)\n *\n * This angular service exposes the [[TransitionService]] singleton, which is primarily\n * used to register global transition hooks.\n *\n * #### Note: This object is also exposed as [[$transitions]] for injection during runtime.\n */\nlet $transitionsProvider: TransitionService;\n\n/**\n * The current [[Transition]] object\n *\n * The current [[Transition]] object as a **Per-Transition Object** (injectable into Resolve, Hooks, Controllers)\n *\n * This object returns information about the current transition, including:\n *\n * - To/from states\n * - To/from parameters\n * - Transition options\n * - States being entered, exited, and retained\n * - Resolve data\n * - A Promise for the transition\n * - Any transition failure information\n * - An injector for both Service and Per-Transition Objects\n */\nlet $transition$: Transition;\n\n/**\n * The State Service\n *\n * The [[StateService]] singleton as a **Service Object** (injectable during runtime).\n *\n * This service used to manage and query information on registered states.\n * It exposes state related APIs including:\n *\n * - Start a [[Transition]]\n * - Imperatively lazy load states\n * - Check if a state is currently active\n * - Look up states by name\n * - Build URLs for a state+parameters\n * - Configure the global Transition error handler\n *\n * This angular service exposes the [[StateService]] singleton.\n */\nlet $state: StateService;\n\n/**\n * The State Registry\n *\n * The [[StateRegistry]] singleton as a **Service Object** (injectable during runtime).\n *\n * This service is used to register/deregister states.\n * It has state registration related APIs including:\n *\n * - Register/deregister states\n * - Listen for state registration/deregistration\n * - Get states by name\n * - Add state decorators (to customize the state creation process)\n *\n * #### Note: This object is also exposed as [[$stateRegistryProvider]] for injection during the config phase.\n */\nlet $stateRegistry: StateRegistry;\n\n/**\n * The State Registry\n *\n * The [[StateRegistry]] singleton as a **Provider Object** (injectable during config time).\n *\n * This service is used to register/deregister states.\n * It has state registration related APIs including:\n *\n * - Register/deregister states\n * - Listen for state registration/deregistration\n * - Get states by name\n * - Add state decorators (to customize the state creation process)\n *\n * #### Note: This object is also exposed as [[$stateRegistry]] for injection during runtime.\n */\nlet $stateRegistryProvider: StateRegistry;\n\n/**\n * The View Scroll provider\n *\n * The [[UIViewScrollProvider]] as a **Provider Object** (injectable during config time).\n *\n * This angular service exposes the [[UIViewScrollProvider]] singleton and is\n * used to disable UI-Router's scroll behavior.\n */\nlet $uiViewScrollProvider: UIViewScrollProvider;\n\n/**\n * The View Scroll function\n *\n * The View Scroll function as a **Service Object** (injectable during runtime).\n *\n * This is a function that scrolls an element into view.\n * The element is scrolled after a `$timeout` so the DOM has time to refresh.\n *\n * If you prefer to rely on `$anchorScroll` to scroll the view to the anchor,\n * this can be enabled by calling [[UIViewScrollProvider.useAnchorScroll]].\n *\n * Note: this function is used by the [[directives.uiView]] when the `autoscroll` expression evaluates to true.\n */\nlet $uiViewScroll: ($element: JQuery) => void;\n\n/**\n * The StateProvider\n *\n * An angular1-only [[StateProvider]] as a **Provider Object** (injectable during config time).\n *\n * This angular service exposes the [[StateProvider]] singleton.\n *\n * The `StateProvider` is primarily used to register states or add custom state decorators.\n *\n * ##### Note: This provider is a ng1 vestige.\n * It is a passthrough to [[$stateRegistry]] and [[$state]].\n */\nlet $stateProvider: StateProvider;\n\n/**\n * The URL Service Provider\n *\n * The [[UrlService]] singleton as a **Provider Object** (injectable during the angular config phase).\n *\n * A service used to configure and interact with the URL.\n * It has URL related APIs including:\n *\n * - register custom Parameter types `UrlService.config.type` ([[UrlConfigApi.type]])\n * - add URL rules: `UrlService.rules.when` ([[UrlRulesApi.when]])\n * - configure behavior when no url matches: `UrlService.rules.otherwise` ([[UrlRulesApi.otherwise]])\n * - delay initial URL synchronization [[UrlService.deferIntercept]].\n * - get or set the current url: [[UrlService.url]]\n *\n * ##### Note: This service can also be injected during runtime as [[$urlService]].\n */\nlet $urlServiceProvider: UrlService;\n\n/**\n * The URL Service\n *\n * The [[UrlService]] singleton as a **Service Object** (injectable during runtime).\n *\n * Note: This service can also be injected during the config phase as [[$urlServiceProvider]].\n *\n * Used to configure the URL.\n * It has URL related APIs including:\n *\n * - register custom Parameter types `UrlService.config.type` ([[UrlConfigApi.type]])\n * - add URL rules: `UrlService.rules.when` ([[UrlRulesApi.when]])\n * - configure behavior when no url matches: `UrlService.rules.otherwise` ([[UrlRulesApi.otherwise]])\n * - delay initial URL synchronization [[UrlService.deferIntercept]].\n * - get or set the current url: [[UrlService.url]]\n *\n * ##### Note: This service can also be injected during the config phase as [[$urlServiceProvider]].\n */\nlet $urlService: UrlService;\n\n/**\n * The URL Router Provider\n *\n * ### Deprecation warning: This object is now considered internal. Use [[$urlServiceProvider]] instead.\n *\n * The [[UrlRouter]] singleton as a **Provider Object** (injectable during config time).\n *\n * #### Note: This object is also exposed as [[$urlRouter]] for injection during runtime.\n *\n * @deprecated\n */\nlet $urlRouterProvider: UrlRouterProvider;\n\n/**\n * The Url Router\n *\n * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead.\n *\n * The [[UrlRouter]] singleton as a **Service Object** (injectable during runtime).\n *\n * #### Note: This object is also exposed as [[$urlRouterProvider]] for injection during angular config time.\n *\n * @deprecated\n */\nlet $urlRouter: UrlRouter;\n\n/**\n * The URL Matcher Factory\n *\n * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead.\n *\n * The [[UrlMatcherFactory]] singleton as a **Service Object** (injectable during runtime).\n *\n * This service is used to set url mapping options, define custom parameter types, and create [[UrlMatcher]] objects.\n *\n * #### Note: This object is also exposed as [[$urlMatcherFactoryProvider]] for injection during angular config time.\n *\n * @deprecated\n */\nlet $urlMatcherFactory: UrlMatcherFactory;\n\n/**\n * The URL Matcher Factory\n *\n * ### Deprecation warning: This object is now considered internal. Use [[$urlService]] instead.\n *\n * The [[UrlMatcherFactory]] singleton as a **Provider Object** (injectable during config time).\n *\n * This service is used to set url mapping options, define custom parameter types, and create [[UrlMatcher]] objects.\n *\n * #### Note: This object is also exposed as [[$urlMatcherFactory]] for injection during runtime.\n *\n * @deprecated\n */\nlet $urlMatcherFactoryProvider: UrlMatcherFactory;\n",
    "/**\n * # Angular 1 Directives\n *\n * These are the directives included in UI-Router for Angular 1.\n * These directives are used in templates to create viewports and link/navigate to states.\n *\n * @preferred @publicapi @module directives\n */ /** */\nimport { ng as angular } from '../angular';\nimport { IAugmentedJQuery, ITimeoutService, IScope, IInterpolateService } from 'angular';\n\nimport {\n  Obj,\n  extend,\n  forEach,\n  tail,\n  isString,\n  isObject,\n  isArray,\n  parse,\n  noop,\n  unnestR,\n  identity,\n  uniqR,\n  inArray,\n  removeFrom,\n  RawParams,\n  PathNode,\n  StateOrName,\n  StateService,\n  StateDeclaration,\n  UIRouter,\n} from '@uirouter/core';\nimport { UIViewData } from './viewDirective';\nimport EventHandler = JQuery.EventHandler;\n\n/** @hidden Used for typedoc */\nexport interface ng1_directive {} // tslint:disable-line:class-name\n\n/** @hidden */\nfunction parseStateRef(ref: string) {\n  let parsed;\n  const paramsOnly = ref.match(/^\\s*({[^}]*})\\s*$/);\n  if (paramsOnly) ref = '(' + paramsOnly[1] + ')';\n\n  parsed = ref.replace(/\\n/g, ' ').match(/^\\s*([^(]*?)\\s*(\\((.*)\\))?\\s*$/);\n  if (!parsed || parsed.length !== 4) throw new Error(\"Invalid state ref '\" + ref + \"'\");\n  return { state: parsed[1] || null, paramExpr: parsed[3] || null };\n}\n\n/** @hidden */\nfunction stateContext(el: IAugmentedJQuery) {\n  const $uiView: UIViewData = (el.parent() as IAugmentedJQuery).inheritedData('$uiView');\n  const path: PathNode[] = parse('$cfg.path')($uiView);\n  return path ? tail(path).state.name : undefined;\n}\n\n/** @hidden */\nfunction processedDef($state: StateService, $element: IAugmentedJQuery, def: Def): Def {\n  const uiState = def.uiState || $state.current.name;\n  const uiStateOpts = extend(defaultOpts($element, $state), def.uiStateOpts || {});\n  const href = $state.href(uiState, def.uiStateParams, uiStateOpts);\n  return { uiState, uiStateParams: def.uiStateParams, uiStateOpts, href };\n}\n\n/** @hidden */\ninterface TypeInfo {\n  attr: string;\n  isAnchor: boolean;\n  clickable: boolean;\n}\n\n/** @hidden */\nfunction getTypeInfo(el: IAugmentedJQuery): TypeInfo {\n  // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.\n  const isSvg = Object.prototype.toString.call(el.prop('href')) === '[object SVGAnimatedString]';\n  const isForm = el[0].nodeName === 'FORM';\n\n  return {\n    attr: isForm ? 'action' : isSvg ? 'xlink:href' : 'href',\n    isAnchor: el.prop('tagName').toUpperCase() === 'A',\n    clickable: !isForm,\n  };\n}\n\n/** @hidden */\nfunction clickHook(\n  el: IAugmentedJQuery,\n  $state: StateService,\n  $timeout: ITimeoutService,\n  type: TypeInfo,\n  getDef: () => Def\n) {\n  return function(e: JQueryMouseEventObject) {\n    const button = e.which || e.button,\n      target = getDef();\n\n    if (!(button > 1 || e.ctrlKey || e.metaKey || e.shiftKey || el.attr('target'))) {\n      // HACK: This is to allow ng-clicks to be processed before the transition is initiated:\n      const transition = $timeout(function() {\n        if (!el.attr('disabled')) {\n          $state.go(target.uiState, target.uiStateParams, target.uiStateOpts);\n        }\n      });\n      e.preventDefault();\n\n      // if the state has no URL, ignore one preventDefault from the <a> directive.\n      let ignorePreventDefaultCount = type.isAnchor && !target.href ? 1 : 0;\n\n      e.preventDefault = function() {\n        if (ignorePreventDefaultCount-- <= 0) $timeout.cancel(transition);\n      };\n    }\n  };\n}\n\n/** @hidden */\nfunction defaultOpts(el: IAugmentedJQuery, $state: StateService) {\n  return {\n    relative: stateContext(el) || $state.$current,\n    inherit: true,\n    source: 'sref',\n  };\n}\n\n/** @hidden */\nfunction bindEvents(element: IAugmentedJQuery, scope: IScope, hookFn: EventHandler<any>, uiStateOpts: any): void {\n  let events;\n\n  if (uiStateOpts) {\n    events = uiStateOpts.events;\n  }\n\n  if (!isArray(events)) {\n    events = ['click'];\n  }\n\n  const on = element.on ? 'on' : 'bind';\n  for (const event of events) {\n    element[on](event, hookFn);\n  }\n\n  scope.$on('$destroy', function() {\n    const off = element.off ? 'off' : 'unbind';\n    for (const event of events) {\n      element[off](event, hookFn as any);\n    }\n  });\n}\n\n/**\n * `ui-sref`: A directive for linking to a state\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * ### Linked State\n * The attribute value of the `ui-sref` is the name of the state to link to.\n *\n * #### Example:\n * This will activate the `home` state when the link is clicked.\n * ```html\n * <a ui-sref=\"home\">Home</a>\n * ```\n *\n * ### Relative Links\n * You can also use relative state paths within `ui-sref`, just like a relative path passed to `$state.go()` ([[StateService.go]]).\n * You just need to be aware that the path is relative to the state that *created* the link.\n * This allows a state to create a relative `ui-sref` which always targets the same destination.\n *\n * #### Example:\n * Both these links are relative to the parent state, even when a child state is currently active.\n * ```html\n * <a ui-sref=\".child1\">child 1 state</a>\n * <a ui-sref=\".child2\">child 2 state</a>\n * ```\n *\n * This link activates the parent state.\n * ```html\n * <a ui-sref=\"^\">Return</a>\n * ```\n *\n * ### hrefs\n * If the linked state has a URL, the directive will automatically generate and\n * update the `href` attribute (using the [[StateService.href]]  method).\n *\n * #### Example:\n * Assuming the `users` state has a url of `/users/`\n * ```html\n * <a ui-sref=\"users\" href=\"/users/\">Users</a>\n * ```\n *\n * ### Parameter Values\n * In addition to the state name, a `ui-sref` can include parameter values which are applied when activating the state.\n * Param values can be provided in the `ui-sref` value after the state name, enclosed by parentheses.\n * The content inside the parentheses is an expression, evaluated to the parameter values.\n *\n * #### Example:\n * This example renders a list of links to users.\n * The state's `userId` parameter value comes from each user's `user.id` property.\n * ```html\n * <li ng-repeat=\"user in users\">\n *   <a ui-sref=\"users.detail({ userId: user.id })\">{{ user.displayName }}</a>\n * </li>\n * ```\n *\n * Note:\n * The parameter values expression is `$watch`ed for updates.\n *\n * ### Transition Options\n * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-sref-opts` attribute.\n * Options are restricted to `location`, `inherit`, and `reload`.\n *\n * #### Example:\n * ```html\n * <a ui-sref=\"home\" ui-sref-opts=\"{ reload: true }\">Home</a>\n * ```\n *\n * ### Other DOM Events\n *\n * You can also customize which DOM events to respond to (instead of `click`) by\n * providing an `events` array in the `ui-sref-opts` attribute.\n *\n * #### Example:\n * ```html\n * <input type=\"text\" ui-sref=\"contacts\" ui-sref-opts=\"{ events: ['change', 'blur'] }\">\n * ```\n *\n * ### Highlighting the active link\n * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link.\n *\n * ### Examples\n * If you have the following template:\n *\n * ```html\n * <a ui-sref=\"home\">Home</a>\n * <a ui-sref=\"about\">About</a>\n * <a ui-sref=\"{page: 2}\">Next page</a>\n *\n * <ul>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a ui-sref=\"contacts.detail({ id: contact.id })\">{{ contact.name }}</a>\n *     </li>\n * </ul>\n * ```\n *\n * Then (assuming the current state is `contacts`) the rendered html including hrefs would be:\n *\n * ```html\n * <a href=\"#/home\" ui-sref=\"home\">Home</a>\n * <a href=\"#/about\" ui-sref=\"about\">About</a>\n * <a href=\"#/contacts?page=2\" ui-sref=\"{page: 2}\">Next page</a>\n *\n * <ul>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/1\" ui-sref=\"contacts.detail({ id: contact.id })\">Joe</a>\n *     </li>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/2\" ui-sref=\"contacts.detail({ id: contact.id })\">Alice</a>\n *     </li>\n *     <li ng-repeat=\"contact in contacts\">\n *         <a href=\"#/contacts/3\" ui-sref=\"contacts.detail({ id: contact.id })\">Bob</a>\n *     </li>\n * </ul>\n *\n * <a href=\"#/home\" ui-sref=\"home\" ui-sref-opts=\"{reload: true}\">Home</a>\n * ```\n *\n * ### Notes\n *\n * - You can use `ui-sref` to change **only the parameter values** by omitting the state name and parentheses.\n * #### Example:\n * Sets the `lang` parameter to `en` and remains on the same state.\n *\n * ```html\n * <a ui-sref=\"{ lang: 'en' }\">English</a>\n * ```\n *\n * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.\n *\n * - Unlike the parameter values expression, the state name is not `$watch`ed (for performance reasons).\n * If you need to dynamically update the state being linked to, use the fully dynamic [[uiState]] directive.\n */\nlet uiSrefDirective: ng1_directive;\nuiSrefDirective = [\n  '$uiRouter',\n  '$timeout',\n  function $StateRefDirective($uiRouter: UIRouter, $timeout: ITimeoutService) {\n    const $state = $uiRouter.stateService;\n\n    return {\n      restrict: 'A',\n      require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n      link: function(scope: IScope, element: IAugmentedJQuery, attrs: any, uiSrefActive: any) {\n        const type = getTypeInfo(element);\n        const active = uiSrefActive[1] || uiSrefActive[0];\n        let unlinkInfoFn: Function = null;\n        let hookFn;\n\n        const rawDef = {} as Def;\n        const getDef = () => processedDef($state, element, rawDef);\n\n        const ref = parseStateRef(attrs.uiSref);\n        rawDef.uiState = ref.state;\n        rawDef.uiStateOpts = attrs.uiSrefOpts ? scope.$eval(attrs.uiSrefOpts) : {};\n\n        function update() {\n          const def = getDef();\n          if (unlinkInfoFn) unlinkInfoFn();\n          if (active) unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams);\n          if (def.href != null) attrs.$set(type.attr, def.href);\n        }\n\n        if (ref.paramExpr) {\n          scope.$watch(\n            ref.paramExpr,\n            function(val) {\n              rawDef.uiStateParams = extend({}, val);\n              update();\n            },\n            true\n          );\n          rawDef.uiStateParams = extend({}, scope.$eval(ref.paramExpr));\n        }\n\n        update();\n\n        scope.$on('$destroy', <any>$uiRouter.stateRegistry.onStatesChanged(update));\n        scope.$on('$destroy', <any>$uiRouter.transitionService.onSuccess({}, update));\n\n        if (!type.clickable) return;\n        hookFn = clickHook(element, $state, $timeout, type, getDef);\n        bindEvents(element, scope, hookFn, rawDef.uiStateOpts);\n      },\n    };\n  },\n];\n\n/**\n * `ui-state`: A fully dynamic directive for linking to a state\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * **This directive is very similar to [[uiSref]], but it `$observe`s and `$watch`es/evaluates all its inputs.**\n *\n * A directive which links to a state (and optionally, parameters).\n * When clicked, this directive activates the linked state with the supplied parameter values.\n *\n * ### Linked State\n * The attribute value of `ui-state` is an expression which is `$watch`ed and evaluated as the state to link to.\n * **This is in contrast with `ui-sref`, which takes a state name as a string literal.**\n *\n * #### Example:\n * Create a list of links.\n * ```html\n * <li ng-repeat=\"link in navlinks\">\n *   <a ui-state=\"link.state\">{{ link.displayName }}</a>\n * </li>\n * ```\n *\n * ### Relative Links\n * If the expression evaluates to a relative path, it is processed like [[uiSref]].\n * You just need to be aware that the path is relative to the state that *created* the link.\n * This allows a state to create relative `ui-state` which always targets the same destination.\n *\n * ### hrefs\n * If the linked state has a URL, the directive will automatically generate and\n * update the `href` attribute (using the [[StateService.href]]  method).\n *\n * ### Parameter Values\n * In addition to the state name expression, a `ui-state` can include parameter values which are applied when activating the state.\n * Param values should be provided using the `ui-state-params` attribute.\n * The `ui-state-params` attribute value is `$watch`ed and evaluated as an expression.\n *\n * #### Example:\n * This example renders a list of links with param values.\n * The state's `userId` parameter value comes from each user's `user.id` property.\n * ```html\n * <li ng-repeat=\"link in navlinks\">\n *   <a ui-state=\"link.state\" ui-state-params=\"link.params\">{{ link.displayName }}</a>\n * </li>\n * ```\n *\n * ### Transition Options\n * You can specify [[TransitionOptions]] to pass to [[StateService.go]] by using the `ui-state-opts` attribute.\n * Options are restricted to `location`, `inherit`, and `reload`.\n * The value of the `ui-state-opts` is `$watch`ed and evaluated as an expression.\n *\n * #### Example:\n * ```html\n * <a ui-state=\"returnto.state\" ui-state-opts=\"{ reload: true }\">Home</a>\n * ```\n *\n * ### Other DOM Events\n *\n * You can also customize which DOM events to respond to (instead of `click`) by\n * providing an `events` array in the `ui-state-opts` attribute.\n *\n * #### Example:\n * ```html\n * <input type=\"text\" ui-state=\"contacts\" ui-state-opts=\"{ events: ['change', 'blur'] }\">\n * ```\n *\n * ### Highlighting the active link\n * This directive can be used in conjunction with [[uiSrefActive]] to highlight the active link.\n *\n * ### Notes\n *\n * - You can use `ui-params` to change **only the parameter values** by omitting the state name and supplying only `ui-state-params`.\n *   However, it might be simpler to use [[uiSref]] parameter-only links.\n *\n * #### Example:\n * Sets the `lang` parameter to `en` and remains on the same state.\n *\n * ```html\n * <a ui-state=\"\" ui-state-params=\"{ lang: 'en' }\">English</a>\n * ```\n *\n * - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.\n * ```\n */\nlet uiStateDirective: ng1_directive;\nuiStateDirective = [\n  '$uiRouter',\n  '$timeout',\n  function $StateRefDynamicDirective($uiRouter: UIRouter, $timeout: ITimeoutService) {\n    const $state = $uiRouter.stateService;\n\n    return {\n      restrict: 'A',\n      require: ['?^uiSrefActive', '?^uiSrefActiveEq'],\n      link: function(scope: IScope, element: IAugmentedJQuery, attrs: any, uiSrefActive: any) {\n        const type = getTypeInfo(element);\n        const active = uiSrefActive[1] || uiSrefActive[0];\n        let unlinkInfoFn: Function = null;\n        let hookFn;\n\n        const rawDef = {} as Def;\n        const getDef = () => processedDef($state, element, rawDef);\n\n        const inputAttrs = ['uiState', 'uiStateParams', 'uiStateOpts'];\n        const watchDeregFns = inputAttrs.reduce((acc, attr) => ((acc[attr] = noop), acc), {});\n\n        function update() {\n          const def = getDef();\n          if (unlinkInfoFn) unlinkInfoFn();\n          if (active) unlinkInfoFn = active.$$addStateInfo(def.uiState, def.uiStateParams);\n          if (def.href != null) attrs.$set(type.attr, def.href);\n        }\n\n        inputAttrs.forEach(field => {\n          rawDef[field] = attrs[field] ? scope.$eval(attrs[field]) : null;\n\n          attrs.$observe(field, expr => {\n            watchDeregFns[field]();\n            watchDeregFns[field] = scope.$watch(\n              expr,\n              newval => {\n                rawDef[field] = newval;\n                update();\n              },\n              true\n            );\n          });\n        });\n\n        update();\n\n        scope.$on('$destroy', <any>$uiRouter.stateRegistry.onStatesChanged(update));\n        scope.$on('$destroy', <any>$uiRouter.transitionService.onSuccess({}, update));\n\n        if (!type.clickable) return;\n        hookFn = clickHook(element, $state, $timeout, type, getDef);\n        bindEvents(element, scope, hookFn, rawDef.uiStateOpts);\n      },\n    };\n  },\n];\n\n/**\n * `ui-sref-active` and `ui-sref-active-eq`: A directive that adds a CSS class when a `ui-sref` is active\n *\n * A directive working alongside [[uiSref]] and [[uiState]] to add classes to an element when the\n * related directive's state is active (and remove them when it is inactive).\n *\n * The primary use-case is to highlight the active link in navigation menus,\n * distinguishing it from the inactive menu items.\n *\n * ### Linking to a `ui-sref` or `ui-state`\n * `ui-sref-active` can live on the same element as `ui-sref`/`ui-state`, or it can be on a parent element.\n * If a `ui-sref-active` is a parent to more than one `ui-sref`/`ui-state`, it will apply the CSS class when **any of the links are active**.\n *\n * ### Matching\n *\n * The `ui-sref-active` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state **or any child state is active**.\n * This is a \"fuzzy match\" which uses [[StateService.includes]].\n *\n * The `ui-sref-active-eq` directive applies the CSS class when the `ui-sref`/`ui-state`'s target state is directly active (not when child states are active).\n * This is an \"exact match\" which uses [[StateService.is]].\n *\n * ### Parameter values\n * If the `ui-sref`/`ui-state` includes parameter values, the current parameter values must match the link's values for the link to be highlighted.\n * This allows a list of links to the same state with different parameters to be rendered, and the correct one highlighted.\n *\n * #### Example:\n * ```html\n * <li ng-repeat=\"user in users\" ui-sref-active=\"active\">\n *   <a ui-sref=\"user.details({ userId: user.id })\">{{ user.lastName }}</a>\n * </li>\n * ```\n *\n * ### Examples\n *\n * Given the following template:\n * #### Example:\n * ```html\n * <ul>\n *   <li ui-sref-active=\"active\" class=\"item\">\n *     <a href ui-sref=\"app.user({user: 'bilbobaggins'})\">@bilbobaggins</a>\n *   </li>\n * </ul>\n * ```\n *\n * When the app state is `app.user` (or any child state),\n * and contains the state parameter \"user\" with value \"bilbobaggins\",\n * the resulting HTML will appear as (note the 'active' class):\n *\n * ```html\n * <ul>\n *   <li ui-sref-active=\"active\" class=\"item active\">\n *     <a ui-sref=\"app.user({user: 'bilbobaggins'})\" href=\"/users/bilbobaggins\">@bilbobaggins</a>\n *   </li>\n * </ul>\n * ```\n *\n * ### Glob mode\n *\n * It is possible to pass `ui-sref-active` an expression that evaluates to an object.\n * The objects keys represent active class names and values represent the respective state names/globs.\n * `ui-sref-active` will match if the current active state **includes** any of\n * the specified state names/globs, even the abstract ones.\n *\n * #### Example:\n * Given the following template, with \"admin\" being an abstract state:\n * ```html\n * <div ui-sref-active=\"{'active': 'admin.**'}\">\n *   <a ui-sref-active=\"active\" ui-sref=\"admin.roles\">Roles</a>\n * </div>\n * ```\n *\n * Arrays are also supported as values in the `ngClass`-like interface.\n * This allows multiple states to add `active` class.\n *\n * #### Example:\n * Given the following template, with \"admin.roles\" being the current state, the class will be added too:\n * ```html\n * <div ui-sref-active=\"{'active': ['owner.**', 'admin.**']}\">\n *   <a ui-sref-active=\"active\" ui-sref=\"admin.roles\">Roles</a>\n * </div>\n * ```\n *\n * When the current state is \"admin.roles\" the \"active\" class will be applied to both the `<div>` and `<a>` elements.\n * It is important to note that the state names/globs passed to `ui-sref-active` override any state provided by a linked `ui-sref`.\n *\n * ### Notes:\n *\n * - The class name is interpolated **once** during the directives link time (any further changes to the\n * interpolated value are ignored).\n *\n * - Multiple classes may be specified in a space-separated format: `ui-sref-active='class1 class2 class3'`\n */\nlet uiSrefActiveDirective: ng1_directive;\nuiSrefActiveDirective = [\n  '$state',\n  '$stateParams',\n  '$interpolate',\n  '$uiRouter',\n  function $StateRefActiveDirective(\n    $state: StateService,\n    $stateParams: Obj,\n    $interpolate: IInterpolateService,\n    $uiRouter: UIRouter\n  ) {\n    return {\n      restrict: 'A',\n      controller: [\n        '$scope',\n        '$element',\n        '$attrs',\n        function($scope: IScope, $element: IAugmentedJQuery, $attrs: any) {\n          let states: StateData[] = [];\n          let activeEqClass: string;\n          let uiSrefActive: any;\n\n          // There probably isn't much point in $observing this\n          // uiSrefActive and uiSrefActiveEq share the same directive object with some\n          // slight difference in logic routing\n          activeEqClass = $interpolate($attrs.uiSrefActiveEq || '', false)($scope);\n\n          try {\n            uiSrefActive = $scope.$eval($attrs.uiSrefActive);\n          } catch (e) {\n            // Do nothing. uiSrefActive is not a valid expression.\n            // Fall back to using $interpolate below\n          }\n          uiSrefActive = uiSrefActive || $interpolate($attrs.uiSrefActive || '', false)($scope);\n          setStatesFromDefinitionObject(uiSrefActive);\n\n          // Allow uiSref to communicate with uiSrefActive[Equals]\n          this.$$addStateInfo = function(newState: string, newParams: Obj) {\n            // we already got an explicit state provided by ui-sref-active, so we\n            // shadow the one that comes from ui-sref\n            if (isObject(uiSrefActive) && states.length > 0) {\n              return;\n            }\n            const deregister = addState(newState, newParams, uiSrefActive);\n            update();\n            return deregister;\n          };\n\n          function updateAfterTransition(trans) {\n            trans.promise.then(update, noop);\n          }\n          $scope.$on('$destroy', setupEventListeners());\n          if ($uiRouter.globals.transition) {\n            updateAfterTransition($uiRouter.globals.transition);\n          }\n\n          function setupEventListeners() {\n            const deregisterStatesChangedListener = $uiRouter.stateRegistry.onStatesChanged(handleStatesChanged);\n            const deregisterOnStartListener = $uiRouter.transitionService.onStart({}, updateAfterTransition);\n            const deregisterStateChangeSuccessListener = $scope.$on('$stateChangeSuccess', update);\n            return function cleanUp() {\n              deregisterStatesChangedListener();\n              deregisterOnStartListener();\n              deregisterStateChangeSuccessListener();\n            };\n          }\n\n          function handleStatesChanged() {\n            setStatesFromDefinitionObject(uiSrefActive);\n          }\n\n          function setStatesFromDefinitionObject(statesDefinition: object) {\n            if (isObject(statesDefinition)) {\n              states = [];\n              forEach(statesDefinition, function(stateOrName: StateOrName | Array<StateOrName>, activeClass: string) {\n                // Helper function to abstract adding state.\n                const addStateForClass = function(stateOrName: string, activeClass: string) {\n                  const ref = parseStateRef(stateOrName);\n                  addState(ref.state, $scope.$eval(ref.paramExpr), activeClass);\n                };\n\n                if (isString(stateOrName)) {\n                  // If state is string, just add it.\n                  addStateForClass(stateOrName as string, activeClass);\n                } else if (isArray(stateOrName)) {\n                  // If state is an array, iterate over it and add each array item individually.\n                  forEach(stateOrName, function(stateOrName: string) {\n                    addStateForClass(stateOrName, activeClass);\n                  });\n                }\n              });\n            }\n          }\n\n          function addState(stateName: string, stateParams: Obj, activeClass: string) {\n            const state = $state.get(stateName, stateContext($element));\n\n            const stateInfo = {\n              state: state || { name: stateName },\n              params: stateParams,\n              activeClass: activeClass,\n            };\n\n            states.push(stateInfo);\n\n            return function removeState() {\n              removeFrom(states)(stateInfo);\n            };\n          }\n\n          // Update route state\n          function update() {\n            const splitClasses = str => str.split(/\\s/).filter(identity);\n            const getClasses = (stateList: StateData[]) =>\n              stateList\n                .map(x => x.activeClass)\n                .map(splitClasses)\n                .reduce(unnestR, []);\n\n            const allClasses = getClasses(states)\n              .concat(splitClasses(activeEqClass))\n              .reduce(uniqR, []);\n            const fuzzyClasses = getClasses(states.filter(x => $state.includes(x.state.name, x.params)));\n            const exactlyMatchesAny = !!states.filter(x => $state.is(x.state.name, x.params)).length;\n            const exactClasses = exactlyMatchesAny ? splitClasses(activeEqClass) : [];\n\n            const addClasses = fuzzyClasses.concat(exactClasses).reduce(uniqR, []);\n            const removeClasses = allClasses.filter(cls => !inArray(addClasses, cls));\n\n            $scope.$evalAsync(() => {\n              addClasses.forEach(className => $element.addClass(className));\n              removeClasses.forEach(className => $element.removeClass(className));\n            });\n          }\n\n          update();\n        },\n      ],\n    };\n  },\n];\n\n/** @hidden */\ninterface Def {\n  uiState: string;\n  href: string;\n  uiStateParams: Obj;\n  uiStateOpts: any;\n}\n/** @hidden */\ninterface StateData {\n  state: StateDeclaration;\n  params: RawParams;\n  activeClass: string;\n}\n\nangular\n  .module('ui.router.state')\n  .directive('uiSref', uiSrefDirective)\n  .directive('uiSrefActive', uiSrefActiveDirective)\n  .directive('uiSrefActiveEq', uiSrefActiveDirective)\n  .directive('uiState', uiStateDirective);\n",
    "/** @publicapi @module ng1 */ /** */\n\nimport { ng as angular } from './angular';\nimport { Obj, StateService, StateOrName } from '@uirouter/core';\n\n/**\n * `isState` Filter: truthy if the current state is the parameter\n *\n * Translates to [[StateService.is]] `$state.is(\"stateName\")`.\n *\n * #### Example:\n * ```html\n * <div ng-if=\"'stateName' | isState\">show if state is 'stateName'</div>\n * ```\n */\n$IsStateFilter.$inject = ['$state'];\nexport function $IsStateFilter($state: StateService) {\n  const isFilter: any = function(state: StateOrName, params: Obj, options?: { relative?: StateOrName }) {\n    return $state.is(state, params, options);\n  };\n  isFilter.$stateful = true;\n  return isFilter;\n}\n\n/**\n * `includedByState` Filter: truthy if the current state includes the parameter\n *\n * Translates to [[StateService.includes]]` $state.is(\"fullOrPartialStateName\")`.\n *\n * #### Example:\n * ```html\n * <div ng-if=\"'fullOrPartialStateName' | includedByState\">show if state includes 'fullOrPartialStateName'</div>\n * ```\n */\n$IncludedByStateFilter.$inject = ['$state'];\nexport function $IncludedByStateFilter($state: StateService) {\n  const includesFilter: any = function(state: StateOrName, params: Obj, options: { relative?: StateOrName }) {\n    return $state.includes(state, params, options);\n  };\n  includesFilter.$stateful = true;\n  return includesFilter;\n}\n\nangular\n  .module('ui.router.state')\n  .filter('isState', $IsStateFilter)\n  .filter('includedByState', $IncludedByStateFilter);\n",
    "/** @publicapi @module directives */ /** */\nimport {\n  $QLike,\n  ActiveUIView,\n  extend,\n  filter,\n  HookRegOptions,\n  isDefined,\n  isFunction,\n  isString,\n  kebobString,\n  noop,\n  Obj,\n  Param,\n  parse,\n  PathNode,\n  ResolveContext,\n  StateDeclaration,\n  tail,\n  trace,\n  Transition,\n  TransitionService,\n  TypedMap,\n  unnestR,\n  ViewService,\n} from '@uirouter/core';\nimport { IAugmentedJQuery, IInterpolateService, IScope, ITimeoutService, ITranscludeFunction } from 'angular';\nimport { ng as angular } from '../angular';\nimport { Ng1Controller, Ng1StateDeclaration } from '../interface';\nimport { getLocals } from '../services';\nimport { Ng1ViewConfig } from '../statebuilders/views';\nimport { ng1_directive } from './stateDirectives';\n\n/** @hidden */\nexport type UIViewData = {\n  $cfg: Ng1ViewConfig;\n  $uiView: ActiveUIView;\n};\n\n/** @hidden */\nexport type UIViewAnimData = {\n  $animEnter: Promise<any>;\n  $animLeave: Promise<any>;\n  $$animLeave: { resolve: () => any }; // \"deferred\"\n};\n\n/**\n * `ui-view`: A viewport directive which is filled in by a view from the active state.\n *\n * ### Attributes\n *\n * - `name`: (Optional) A view name.\n *   The name should be unique amongst the other views in the same state.\n *   You can have views of the same name that live in different states.\n *   The ui-view can be targeted in a View using the name ([[Ng1StateDeclaration.views]]).\n *\n * - `autoscroll`: an expression. When it evaluates to true, the `ui-view` will be scrolled into view when it is activated.\n *   Uses [[$uiViewScroll]] to do the scrolling.\n *\n * - `onload`: Expression to evaluate whenever the view updates.\n *\n * #### Example:\n * A view can be unnamed or named.\n * ```html\n * <!-- Unnamed -->\n * <div ui-view></div>\n *\n * <!-- Named -->\n * <div ui-view=\"viewName\"></div>\n *\n * <!-- Named (different style) -->\n * <ui-view name=\"viewName\"></ui-view>\n * ```\n *\n * You can only have one unnamed view within any template (or root html). If you are only using a\n * single view and it is unnamed then you can populate it like so:\n *\n * ```html\n * <div ui-view></div>\n * $stateProvider.state(\"home\", {\n *   template: \"<h1>HELLO!</h1>\"\n * })\n * ```\n *\n * The above is a convenient shortcut equivalent to specifying your view explicitly with the\n * [[Ng1StateDeclaration.views]] config property, by name, in this case an empty name:\n *\n * ```js\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     }\n *   }\n * })\n * ```\n *\n * But typically you'll only use the views property if you name your view or have more than one view\n * in the same template. There's not really a compelling reason to name a view if its the only one,\n * but you could if you wanted, like so:\n *\n * ```html\n * <div ui-view=\"main\"></div>\n * ```\n *\n * ```js\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"main\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     }\n *   }\n * })\n * ```\n *\n * Really though, you'll use views to set up multiple views:\n *\n * ```html\n * <div ui-view></div>\n * <div ui-view=\"chart\"></div>\n * <div ui-view=\"data\"></div>\n * ```\n *\n * ```js\n * $stateProvider.state(\"home\", {\n *   views: {\n *     \"\": {\n *       template: \"<h1>HELLO!</h1>\"\n *     },\n *     \"chart\": {\n *       template: \"<chart_thing/>\"\n *     },\n *     \"data\": {\n *       template: \"<data_thing/>\"\n *     }\n *   }\n * })\n * ```\n *\n * #### Examples for `autoscroll`:\n * ```html\n * <!-- If autoscroll present with no expression,\n *      then scroll ui-view into view -->\n * <ui-view autoscroll/>\n *\n * <!-- If autoscroll present with valid expression,\n *      then scroll ui-view into view if expression evaluates to true -->\n * <ui-view autoscroll='true'/>\n * <ui-view autoscroll='false'/>\n * <ui-view autoscroll='scopeVariable'/>\n * ```\n *\n * Resolve data:\n *\n * The resolved data from the state's `resolve` block is placed on the scope as `$resolve` (this\n * can be customized using [[Ng1ViewDeclaration.resolveAs]]).  This can be then accessed from the template.\n *\n * Note that when `controllerAs` is being used, `$resolve` is set on the controller instance *after* the\n * controller is instantiated.  The `$onInit()` hook can be used to perform initialization code which\n * depends on `$resolve` data.\n *\n * #### Example:\n * ```js\n * $stateProvider.state('home', {\n *   template: '<my-component user=\"$resolve.user\"></my-component>',\n *   resolve: {\n *     user: function(UserService) { return UserService.fetchUser(); }\n *   }\n * });\n * ```\n */\nexport let uiView: ng1_directive;\nuiView = [\n  '$view',\n  '$animate',\n  '$uiViewScroll',\n  '$interpolate',\n  '$q',\n  function $ViewDirective(\n    $view: ViewService,\n    $animate: any,\n    $uiViewScroll: any,\n    $interpolate: IInterpolateService,\n    $q: $QLike\n  ) {\n    function getRenderer(attrs: Obj, scope: IScope) {\n      return {\n        enter: function(element: JQuery, target: any, cb: Function) {\n          if (angular.version.minor > 2) {\n            $animate.enter(element, null, target).then(cb);\n          } else {\n            $animate.enter(element, null, target, cb);\n          }\n        },\n        leave: function(element: JQuery, cb: Function) {\n          if (angular.version.minor > 2) {\n            $animate.leave(element).then(cb);\n          } else {\n            $animate.leave(element, cb);\n          }\n        },\n      };\n    }\n\n    function configsEqual(config1: Ng1ViewConfig, config2: Ng1ViewConfig) {\n      return config1 === config2;\n    }\n\n    const rootData = {\n      $cfg: { viewDecl: { $context: $view._pluginapi._rootViewContext() } },\n      $uiView: {},\n    };\n\n    const directive = {\n      count: 0,\n      restrict: 'ECA',\n      terminal: true,\n      priority: 400,\n      transclude: 'element',\n      compile: function(tElement: JQuery, tAttrs: Obj, $transclude: ITranscludeFunction) {\n        return function(scope: IScope, $element: IAugmentedJQuery, attrs: Obj) {\n          const onloadExp = attrs['onload'] || '',\n            autoScrollExp = attrs['autoscroll'],\n            renderer = getRenderer(attrs, scope),\n            inherited = $element.inheritedData('$uiView') || rootData,\n            name = $interpolate(attrs['uiView'] || attrs['name'] || '')(scope) || '$default';\n\n          let previousEl: JQuery,\n            currentEl: JQuery,\n            currentScope: IScope,\n            viewConfig: Ng1ViewConfig,\n            unregister: Function;\n\n          const activeUIView: ActiveUIView = {\n            $type: 'ng1',\n            id: directive.count++, // Global sequential ID for ui-view tags added to DOM\n            name: name, // ui-view name (<div ui-view=\"name\"></div>\n            fqn: inherited.$uiView.fqn ? inherited.$uiView.fqn + '.' + name : name, // fully qualified name, describes location in DOM\n            config: null, // The ViewConfig loaded (from a state.views definition)\n            configUpdated: configUpdatedCallback, // Called when the matching ViewConfig changes\n            get creationContext() {\n              // The context in which this ui-view \"tag\" was created\n              const fromParentTagConfig = parse('$cfg.viewDecl.$context')(inherited);\n              // Allow <ui-view name=\"foo\"><ui-view name=\"bar\"></ui-view></ui-view>\n              // See https://github.com/angular-ui/ui-router/issues/3355\n              const fromParentTag = parse('$uiView.creationContext')(inherited);\n              return fromParentTagConfig || fromParentTag;\n            },\n          };\n\n          trace.traceUIViewEvent('Linking', activeUIView);\n\n          function configUpdatedCallback(config?: Ng1ViewConfig) {\n            if (config && !(config instanceof Ng1ViewConfig)) return;\n            if (configsEqual(viewConfig, config)) return;\n            trace.traceUIViewConfigUpdated(activeUIView, config && config.viewDecl && config.viewDecl.$context);\n\n            viewConfig = config;\n            updateView(config);\n          }\n\n          $element.data('$uiView', { $uiView: activeUIView });\n\n          updateView();\n\n          unregister = $view.registerUIView(activeUIView);\n          scope.$on('$destroy', function() {\n            trace.traceUIViewEvent('Destroying/Unregistering', activeUIView);\n            unregister();\n          });\n\n          function cleanupLastView() {\n            if (previousEl) {\n              trace.traceUIViewEvent('Removing (previous) el', previousEl.data('$uiView'));\n              previousEl.remove();\n              previousEl = null;\n            }\n\n            if (currentScope) {\n              trace.traceUIViewEvent('Destroying scope', activeUIView);\n              currentScope.$destroy();\n              currentScope = null;\n            }\n\n            if (currentEl) {\n              const _viewData = currentEl.data('$uiViewAnim');\n              trace.traceUIViewEvent('Animate out', _viewData);\n              renderer.leave(currentEl, function() {\n                _viewData.$$animLeave.resolve();\n                previousEl = null;\n              });\n\n              previousEl = currentEl;\n              currentEl = null;\n            }\n          }\n\n          function updateView(config?: Ng1ViewConfig) {\n            const newScope = scope.$new();\n            const animEnter = $q.defer(),\n              animLeave = $q.defer();\n\n            const $uiViewData: UIViewData = {\n              $cfg: config,\n              $uiView: activeUIView,\n            };\n\n            const $uiViewAnim: UIViewAnimData = {\n              $animEnter: animEnter.promise,\n              $animLeave: animLeave.promise,\n              $$animLeave: animLeave,\n            };\n\n            /**\n             * @ngdoc event\n             * @name ui.router.state.directive:ui-view#$viewContentLoading\n             * @eventOf ui.router.state.directive:ui-view\n             * @eventType emits on ui-view directive scope\n             * @description\n             *\n             * Fired once the view **begins loading**, *before* the DOM is rendered.\n             *\n             * @param {Object} event Event object.\n             * @param {string} viewName Name of the view.\n             */\n            newScope.$emit('$viewContentLoading', name);\n\n            const cloned = $transclude(newScope, function(clone) {\n              clone.data('$uiViewAnim', $uiViewAnim);\n              clone.data('$uiView', $uiViewData);\n              renderer.enter(clone, $element, function onUIViewEnter() {\n                animEnter.resolve();\n                if (currentScope) currentScope.$emit('$viewContentAnimationEnded');\n\n                if ((isDefined(autoScrollExp) && !autoScrollExp) || scope.$eval(autoScrollExp)) {\n                  $uiViewScroll(clone);\n                }\n              });\n\n              cleanupLastView();\n            });\n\n            currentEl = cloned;\n            currentScope = newScope;\n            /**\n             * @ngdoc event\n             * @name ui.router.state.directive:ui-view#$viewContentLoaded\n             * @eventOf ui.router.state.directive:ui-view\n             * @eventType emits on ui-view directive scope\n             * @description           *\n             * Fired once the view is **loaded**, *after* the DOM is rendered.\n             *\n             * @param {Object} event Event object.\n             */\n            currentScope.$emit('$viewContentLoaded', config || viewConfig);\n            currentScope.$eval(onloadExp);\n          }\n        };\n      },\n    };\n\n    return directive;\n  },\n];\n\n$ViewDirectiveFill.$inject = ['$compile', '$controller', '$transitions', '$view', '$q', '$timeout'];\n\n/** @hidden */\nfunction $ViewDirectiveFill(\n  $compile: angular.ICompileService,\n  $controller: angular.IControllerService,\n  $transitions: TransitionService,\n  $view: ViewService,\n  $q: angular.IQService,\n  $timeout: ITimeoutService\n) {\n  const getControllerAs = parse('viewDecl.controllerAs');\n  const getResolveAs = parse('viewDecl.resolveAs');\n\n  return {\n    restrict: 'ECA',\n    priority: -400,\n    compile: function(tElement: JQuery) {\n      const initial = tElement.html();\n      tElement.empty();\n\n      return function(scope: IScope, $element: JQuery) {\n        const data: UIViewData = $element.data('$uiView');\n        if (!data) {\n          $element.html(initial);\n          $compile($element.contents() as any)(scope);\n          return;\n        }\n\n        const cfg: Ng1ViewConfig = data.$cfg || <any>{ viewDecl: {}, getTemplate: noop };\n        const resolveCtx: ResolveContext = cfg.path && new ResolveContext(cfg.path);\n        $element.html(cfg.getTemplate($element, resolveCtx) || initial);\n        trace.traceUIViewFill(data.$uiView, $element.html());\n\n        const link = $compile($element.contents() as any);\n        const controller = cfg.controller as angular.IControllerService;\n        const controllerAs: string = getControllerAs(cfg);\n        const resolveAs: string = getResolveAs(cfg);\n        const locals = resolveCtx && getLocals(resolveCtx);\n\n        scope[resolveAs] = locals;\n\n        if (controller) {\n          const controllerInstance = <Ng1Controller>(\n            $controller(controller, extend({}, locals, { $scope: scope, $element: $element }))\n          );\n          if (controllerAs) {\n            scope[controllerAs] = controllerInstance;\n            scope[controllerAs][resolveAs] = locals;\n          }\n\n          // TODO: Use $view service as a central point for registering component-level hooks\n          // Then, when a component is created, tell the $view service, so it can invoke hooks\n          // $view.componentLoaded(controllerInstance, { $scope: scope, $element: $element });\n          // scope.$on('$destroy', () => $view.componentUnloaded(controllerInstance, { $scope: scope, $element: $element }));\n\n          $element.data('$ngControllerController', controllerInstance);\n          $element.children().data('$ngControllerController', controllerInstance);\n\n          registerControllerCallbacks($q, $transitions, controllerInstance, scope, cfg);\n        }\n\n        // Wait for the component to appear in the DOM\n        if (isString(cfg.component)) {\n          const kebobName = kebobString(cfg.component);\n          const tagRegexp = new RegExp(`^(x-|data-)?${kebobName}$`, 'i');\n\n          const getComponentController = () => {\n            const directiveEl = [].slice\n              .call($element[0].children)\n              .filter((el: Element) => el && el.tagName && tagRegexp.exec(el.tagName));\n\n            return directiveEl && angular.element(directiveEl).data(`$${cfg.component}Controller`);\n          };\n\n          const deregisterWatch = scope.$watch(getComponentController, function(ctrlInstance) {\n            if (!ctrlInstance) return;\n            registerControllerCallbacks($q, $transitions, ctrlInstance, scope, cfg);\n            deregisterWatch();\n          });\n        }\n\n        link(scope);\n      };\n    },\n  };\n}\n\n/** @hidden */\nconst hasComponentImpl = typeof (angular as any).module('ui.router')['component'] === 'function';\n/** @hidden incrementing id */\nlet _uiCanExitId = 0;\n\n/** @hidden TODO: move these callbacks to $view and/or `/hooks/components.ts` or something */\nfunction registerControllerCallbacks(\n  $q: angular.IQService,\n  $transitions: TransitionService,\n  controllerInstance: Ng1Controller,\n  $scope: IScope,\n  cfg: Ng1ViewConfig\n) {\n  // Call $onInit() ASAP\n  if (isFunction(controllerInstance.$onInit) && !(cfg.viewDecl.component && hasComponentImpl)) {\n    controllerInstance.$onInit();\n  }\n\n  const viewState: Ng1StateDeclaration = tail(cfg.path).state.self;\n\n  const hookOptions: HookRegOptions = { bind: controllerInstance };\n  // Add component-level hook for onUiParamsChanged\n  if (isFunction(controllerInstance.uiOnParamsChanged)) {\n    const resolveContext: ResolveContext = new ResolveContext(cfg.path);\n    const viewCreationTrans = resolveContext.getResolvable('$transition$').data;\n\n    // Fire callback on any successful transition\n    const paramsUpdated = ($transition$: Transition) => {\n      // Exit early if the $transition$ is the same as the view was created within.\n      // Exit early if the $transition$ will exit the state the view is for.\n      if ($transition$ === viewCreationTrans || $transition$.exiting().indexOf(viewState as StateDeclaration) !== -1)\n        return;\n\n      const toParams = $transition$.params('to') as TypedMap<any>;\n      const fromParams = $transition$.params<TypedMap<any>>('from') as TypedMap<any>;\n      const getNodeSchema = (node: PathNode) => node.paramSchema;\n      const toSchema: Param[] = $transition$\n        .treeChanges('to')\n        .map(getNodeSchema)\n        .reduce(unnestR, []);\n      const fromSchema: Param[] = $transition$\n        .treeChanges('from')\n        .map(getNodeSchema)\n        .reduce(unnestR, []);\n\n      // Find the to params that have different values than the from params\n      const changedToParams = toSchema.filter((param: Param) => {\n        const idx = fromSchema.indexOf(param);\n        return idx === -1 || !fromSchema[idx].type.equals(toParams[param.id], fromParams[param.id]);\n      });\n\n      // Only trigger callback if a to param has changed or is new\n      if (changedToParams.length) {\n        const changedKeys: string[] = changedToParams.map(x => x.id);\n        // Filter the params to only changed/new to params.  `$transition$.params()` may be used to get all params.\n        const newValues = filter(toParams, (val, key) => changedKeys.indexOf(key) !== -1);\n        controllerInstance.uiOnParamsChanged(newValues, $transition$);\n      }\n    };\n    $scope.$on('$destroy', <any>$transitions.onSuccess({}, paramsUpdated, hookOptions));\n  }\n\n  // Add component-level hook for uiCanExit\n  if (isFunction(controllerInstance.uiCanExit)) {\n    const id = _uiCanExitId++;\n    const cacheProp = '_uiCanExitIds';\n\n    // Returns true if a redirect transition already answered truthy\n    const prevTruthyAnswer = (trans: Transition) =>\n      !!trans && ((trans[cacheProp] && trans[cacheProp][id] === true) || prevTruthyAnswer(trans.redirectedFrom()));\n\n    // If a user answered yes, but the transition was later redirected, don't also ask for the new redirect transition\n    const wrappedHook = (trans: Transition) => {\n      let promise;\n      const ids = (trans[cacheProp] = trans[cacheProp] || {});\n\n      if (!prevTruthyAnswer(trans)) {\n        promise = $q.when(controllerInstance.uiCanExit(trans));\n        promise.then(val => (ids[id] = val !== false));\n      }\n      return promise;\n    };\n\n    const criteria = { exiting: viewState.name };\n    $scope.$on('$destroy', <any>$transitions.onBefore(criteria, wrappedHook, hookOptions));\n  }\n}\n\nangular.module('ui.router.state').directive('uiView', <any>uiView);\nangular.module('ui.router.state').directive('uiView', <any>$ViewDirectiveFill);\n",
    "/** @publicapi @module ng1 */ /** */\nimport { ng as angular } from './angular';\nimport { IServiceProviderFactory } from 'angular';\nimport IAnchorScrollService = angular.IAnchorScrollService;\nimport ITimeoutService = angular.ITimeoutService;\n\nexport interface UIViewScrollProvider {\n  /**\n   * Uses standard anchorScroll behavior\n   *\n   * Reverts [[$uiViewScroll]] back to using the core [`$anchorScroll`](http://docs.angularjs.org/api/ng.$anchorScroll)\n   * service for scrolling based on the url anchor.\n   */\n  useAnchorScroll(): void;\n}\n\n/** @hidden */\nfunction $ViewScrollProvider() {\n  let useAnchorScroll = false;\n\n  this.useAnchorScroll = function() {\n    useAnchorScroll = true;\n  };\n\n  this.$get = [\n    '$anchorScroll',\n    '$timeout',\n    function($anchorScroll: IAnchorScrollService, $timeout: ITimeoutService): Function {\n      if (useAnchorScroll) {\n        return $anchorScroll;\n      }\n\n      return function($element: JQuery) {\n        return $timeout(\n          function() {\n            $element[0].scrollIntoView();\n          },\n          0,\n          false\n        );\n      };\n    },\n  ];\n}\n\nangular.module('ui.router.state').provider('$uiViewScroll', <IServiceProviderFactory>$ViewScrollProvider);\n",
    "/**\n * Main entry point for angular 1.x build\n * @publicapi @module ng1\n */ /** */\nexport * from './interface';\nexport * from './services';\nexport * from './statebuilders/views';\nexport * from './stateProvider';\nexport * from './urlRouterProvider';\n\nimport './injectables';\nimport './directives/stateDirectives';\nimport './stateFilters';\nimport './directives/viewDirective';\nimport './viewScroll';\n\nexport default 'ui.router';\n\nimport * as core from '@uirouter/core';\nexport { core };\nexport * from '@uirouter/core';\n"
  ],
  "names": [
    "ng_from_import.module",
    "val",
    "this",
    "angular",
    "RejectType",
    "Category",
    "DefType",
    "inherit",
    "values",
    "root",
    "all",
    "TransitionHookPhase",
    "TransitionHookScope",
    "pattern",
    "parseUrl",
    "__extends",
    "id",
    "$q",
    "$injector"
  ],
  "mappings": ";;;;;;;;;;;;;;;;IAAA;AACA,IAEA,eAAe,IAAM,cAAc,GAAG,OAAO,CAAC;IAC9C,eAAe,AAAO,IAAM,EAAE,GAAG,cAAc,IAAIA,qBAAqB,GAAG,cAAc,GAAG,cAAc,CAAC;;ICJ3G;;;;;;;IASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,aAAgB,KAAK,CAAC,EAAY;QAChC,IAAM,YAAY,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,IAAM,gBAAgB,GAAG,EAAE,CAAC,MAAM,CAAC;QAEnC,SAAS,OAAO,CAAC,IAAW;YAC1B,IAAI,IAAI,CAAC,MAAM,IAAI,gBAAgB;gBAAE,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACjE,OAAO;gBACL,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;aACxD,CAAC;SACH;QACD,OAAO,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,CAAC;IAED;;;;;;AAMA,aAAgB,OAAO;QACrB,IAAM,IAAI,GAAG,SAAS,CAAC;QACvB,IAAM,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAC9B,OAAO;YACL,IAAI,CAAC,GAAG,KAAK,EACX,MAAM,GAAG,IA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