UNPKG

@uirouter/angularjs

Version:

State-based routing for AngularJS 1.x

11 lines 119 kB
/** * State-based routing for AngularJS 1.x * NOTICE: This monolithic bundle also bundles the @uirouter/core code. * This causes it to be incompatible with plugins that depend on @uirouter/core. * We recommend switching to the ui-router-core.js and ui-router-angularjs.js bundles instead. * For more information, see https://ui-router.github.io/blog/uirouter-for-angularjs-umd-bundles * @version v1.1.2 * @link https://ui-router.github.io * @license MIT License, http://www.opensource.org/licenses/MIT */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("angular")):"function"==typeof define&&define.amd?define(["exports","angular"],e):e((t=t||self)["@uirouter/angularjs"]={},t.angular)}(this,(function(t,e){"use strict";var r=angular,n=e&&e.module?e:r,i=function(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))};function o(t){return function e(){if(arguments.length>=t.length)return t.apply(this,arguments);var r=Array.prototype.slice.call(arguments);return e.bind.apply(e,i([this],r,!1))}}function a(){var t=arguments,e=t.length-1;return function(){for(var r=e,n=t[e].apply(this,arguments);r--;)n=t[r].call(this,n);return n}}function u(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return a.apply(null,[].slice.call(arguments).reverse())}var s=function(t){return function(e){return e&&e[t]}},c=o((function(t,e,r){return r&&r[t]===e})),f=function(t){return u.apply(null,t.split(".").map(s))},l=function(t){return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return!t.apply(null,e)}};function h(t,e){return function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.apply(null,r)&&e.apply(null,r)}}function p(t,e){return function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return t.apply(null,r)||e.apply(null,r)}}var v=function(t){return function(e){return e.reduce((function(e,r){return e&&!!t(r)}),!0)}},d=function(t){return function(e){return e.reduce((function(e,r){return e||!!t(r)}),!1)}},m=function(t){return function(e){return null!=e&&e.constructor===t||e instanceof t}},y=function(t){return function(e){return t===e}},g=function(t){return function(){return t}};function w(t,e){return function(r){return r[t].apply(r,e)}}function _(t){return function(e){for(var r=0;r<t.length;r++)if(t[r][0](e))return t[r][1](e)}}var S=Object.prototype.toString,b=function(t){return function(e){return typeof e===t}},$=b("undefined"),R=l($),E=function(t){return null===t},C=p(E,$),P=b("function"),T=b("number"),k=b("string"),O=function(t){return null!==t&&"object"==typeof t},x=Array.isArray,j=function(t){return"[object Date]"===S.call(t)},V=function(t){return"[object RegExp]"===S.call(t)};function I(t){if(x(t)&&t.length){var e=t.slice(0,-1),r=t.slice(-1);return!(e.filter(l(k)).length||r.filter(l(P)).length)}return P(t)}var H=h(O,u(s("then"),P)),A=function(t,e){return e.reduce((function(e,r){return e[r]=(n="".concat(t,".").concat(String(r),"()"),function(){throw new Error("No implementation for ".concat(n,". The framework specific code did not implement this method."))}),e;var n}),{})},D={$q:void 0,$injector:void 0},q=function(t,e,r){if(r||2===arguments.length)for(var n,i=0,o=e.length;i<o;i++)!n&&i in e||(n||(n=Array.prototype.slice.call(e,0,i)),n[i]=e[i]);return t.concat(n||Array.prototype.slice.call(e))},U="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||void 0,N=U.angular||{},F=N.fromJson||JSON.parse.bind(JSON),L=N.toJson||JSON.stringify.bind(JSON),M=N.forEach||function(t,e,r){if(x(t))return t.forEach(e,r);Object.keys(t).forEach((function(r){return e(t[r],r)}))},B=Object.assign||Ot,G=N.equals||xt;function z(t){return t}function W(){}function J(t,e,r,n,i){void 0===i&&(i=!1);var o=function(e){return t()[e].bind(r())};return(n=n||Object.keys(t())).reduce((function(t,r){var n;return t[r]=i?(n=r,function(){return e[n]=o(n),e[n].apply(null,arguments)}):o(r),t}),e)}var Q=function(t,e){return B(Object.create(t),e)},K=o(Y);function Y(t,e){return-1!==t.indexOf(e)}var Z=o(X);function X(t,e){var r=t.indexOf(e);return r>=0&&t.splice(r,1),t}var tt=o(et);function et(t,e){return t.push(e),e}var rt=function(t){return t.slice().forEach((function(e){"function"==typeof e&&e(),Z(t,e)}))};function nt(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];var n=B.apply(void 0,q([{}],e.reverse(),!1));return B(n,at(t||{},Object.keys(n)))}var it=function(t,e){return B(t,e)};function ot(t,e){var r=[];for(var n in t.path){if(t.path[n]!==e.path[n])break;r.push(t.path[n])}return r}function at(t,e){var r={};for(var n in t)-1!==e.indexOf(n)&&(r[n]=t[n]);return r}function ut(t,e){return Object.keys(t).filter(l(K(e))).reduce((function(e,r){return e[r]=t[r],e}),{})}function st(t,e){return ht(t,s(e))}function ct(t,e){var r=x(t),n=r?[]:{},i=r?function(t){return n.push(t)}:function(t,e){return n[e]=t};return M(t,(function(t,r){e(t,r)&&i(t,r)})),n}function ft(t,e){var r;return M(t,(function(t,n){r||e(t,n)&&(r=t)})),r}var lt=ht;function ht(t,e,r){return r=r||(x(t)?[]:{}),M(t,(function(t,n){return r[n]=e(t,n)})),r}var pt=function(t){return Object.keys(t).map((function(e){return t[e]}))},vt=function(t,e){return t&&e},dt=function(t,e){return t||e},mt=function(t,e){return t.concat(e)},yt=function(t,e){return x(e)?t.concat(e.reduce(yt,[])):gt(t,e)};function gt(t,e){return t.push(e),t}var wt=function(t,e){return K(t,e)?t:gt(t,e)},_t=function(t){return t.reduce(mt,[])},St=function(t){return t.reduce(yt,[])},bt=Rt,$t=Rt;function Rt(t,e){return void 0===e&&(e="assert failure"),function(r){var n=t(r);if(!n)throw new Error(P(e)?e(r):e);return n}}var Et=function(t){return Object.keys(t).map((function(e){return[e,t[e]]}))};function Ct(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(0===t.length)return[];for(var r=t.reduce((function(t,e){return Math.min(e.length,t)}),9007199254740991),n=[],i=function(e){switch(t.length){case 1:n.push([t[0][e]]);break;case 2:n.push([t[0][e],t[1][e]]);break;case 3:n.push([t[0][e],t[1][e],t[2][e]]);break;case 4:n.push([t[0][e],t[1][e],t[2][e],t[3][e]]);break;default:n.push(t.map((function(t){return t[e]})))}},o=0;o<r;o++)i(o);return n}function Pt(t,e){var r,n;if(x(e)&&(r=e[0],n=e[1]),!k(r))throw new Error("invalid parameters to applyPairs");return t[r]=n,t}function Tt(t){return t.length&&t[t.length-1]||void 0}function kt(t,e){return e&&Object.keys(e).forEach((function(t){return delete e[t]})),e||(e={}),B(e,t)}function Ot(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];if(r)for(var n=Object.keys(r),i=0;i<n.length;i++)t[n[i]]=r[n[i]]}return t}function xt(t,e){if(t===e)return!0;if(null===t||null===e)return!1;if(t!=t&&e!=e)return!0;var r=typeof t;if(r!==typeof e||"object"!==r)return!1;var n,i,o=[t,e];if(v(x)(o))return i=e,(n=t).length===i.length&&Ct(n,i).reduce((function(t,e){return t&&xt(e[0],e[1])}),!0);if(v(j)(o))return t.getTime()===e.getTime();if(v(V)(o))return t.toString()===e.toString();if(v(P)(o))return!0;if([P,x,j,V].map(d).reduce((function(t,e){return t||!!e(o)}),!1))return!1;var a={};for(var u in t){if(!xt(t[u],e[u]))return!1;a[u]=!0}for(var u in e)if(!a[u])return!1;return!0}var jt,Vt=function(t){return t.catch((function(t){return 0}))&&t},It=function(t){return Vt(D.$q.reject(t))},Ht=function(){function t(t){this.text=t,this.glob=t.split(".");var e=this.text.split(".").map((function(t){return"**"===t?"(?:|(?:\\.[^.]*)*)":"*"===t?"\\.[^.]*":"\\."+t})).join("");this.regexp=new RegExp("^"+e+"$")}return t.is=function(t){return!!/[!,*]+/.exec(t)},t.fromString=function(e){return t.is(e)?new t(e):null},t.prototype.matches=function(t){return this.regexp.test("."+t)},t}(),At=function(){function t(t,e){void 0===t&&(t=[]),void 0===e&&(e=null),this._items=t,this._limit=e,this._evictListeners=[],this.onEvict=tt(this._evictListeners)}return t.prototype.enqueue=function(t){var e=this._items;return e.push(t),this._limit&&e.length>this._limit&&this.evict(),t},t.prototype.evict=function(){var t=this._items.shift();return this._evictListeners.forEach((function(e){return e(t)})),t},t.prototype.dequeue=function(){if(this.size())return this._items.splice(0,1)[0]},t.prototype.clear=function(){var t=this._items;return this._items=[],t},t.prototype.size=function(){return this._items.length},t.prototype.remove=function(t){var e=this._items.indexOf(t);return e>-1&&this._items.splice(e,1)[0]},t.prototype.peekTail=function(){return this._items[this._items.length-1]},t.prototype.peekHead=function(){if(this.size())return this._items[0]},t}();(jt=t.RejectType||(t.RejectType={}))[jt.SUPERSEDED=2]="SUPERSEDED",jt[jt.ABORTED=3]="ABORTED",jt[jt.INVALID=4]="INVALID",jt[jt.IGNORED=5]="IGNORED",jt[jt.ERROR=6]="ERROR";var Dt=0,qt=function(){function e(t,e,r){this.$id=Dt++,this.type=t,this.message=e,this.detail=r}return e.isRejectionPromise=function(t){return t&&"function"==typeof t.then&&m(e)(t._transitionRejection)},e.superseded=function(r,n){var i=new e(t.RejectType.SUPERSEDED,"The transition has been superseded by a different transition",r);return n&&n.redirected&&(i.redirected=!0),i},e.redirected=function(t){return e.superseded(t,{redirected:!0})},e.invalid=function(r){return new e(t.RejectType.INVALID,"This transition is invalid",r)},e.ignored=function(r){return new e(t.RejectType.IGNORED,"The transition was ignored",r)},e.aborted=function(r){return new e(t.RejectType.ABORTED,"The transition has been aborted",r)},e.errored=function(r){return new e(t.RejectType.ERROR,"The transition errored",r)},e.normalize=function(t){return m(e)(t)?t:e.errored(t)},e.prototype.toString=function(){var t,e=(t=this.detail)&&t.toString!==Object.prototype.toString?t.toString():Bt(t),r=this.$id,n=this.type,i=this.message;return"Transition Rejection($id: ".concat(r," type: ").concat(n,", message: ").concat(i,", detail: ").concat(e,")")},e.prototype.toPromise=function(){return B(It(this),{_transitionRejection:this})},e}();function Ut(t,e){return e.length<=t?e:e.substr(0,t-3)+"..."}function Nt(t,e){for(;e.length<t;)e+=" ";return e}function Ft(t){return t.replace(/^([A-Z])/,(function(t){return t.toLowerCase()})).replace(/([A-Z])/g,(function(t){return"-"+t.toLowerCase()}))}function Lt(t){var e=Mt(t),r=e.match(/^(function [^ ]+\([^)]*\))/),n=r?r[1]:e,i=t.name||"";return i&&n.match(/function \(/)?"function "+i+n.substr(9):n}function Mt(t){var e=x(t)?t.slice(-1)[0]:t;return e&&e.toString()||"undefined"}function Bt(t){var e=[],r=qt.isRejectionPromise,n=_([[$,g("undefined")],[E,g("null")],[H,g("[Promise]")],[r,function(t){return t._transitionRejection.toString()}],[function(t){return O(t)&&!x(t)&&t.constructor!==Object&&P(t.toString)},function(t){return t.toString()}],[I,Lt],[g(!0),z]]);function i(t){if(O(t)){if(-1!==e.indexOf(t))return"[circular ref]";e.push(t)}return n(t)}return $(t)?i(t):JSON.stringify(t,(function(t,e){return i(e)})).replace(/\\"/g,'"')}var Gt=function(t){return function(e){if(!e)return["",""];var r=e.indexOf(t);return-1===r?[e,""]:[e.substr(0,r),e.substr(r+1)]}},zt=new RegExp("^(?:[a-z]+:)?//[^/]+/"),Wt=function(t){return t.replace(/\/[^/]*$/,"")},Jt=Gt("#"),Qt=Gt("?"),Kt=Gt("="),Yt=function(t){return t?t.replace(/^#/,""):""};function Zt(t){var e=new RegExp("("+t+")","g");return function(t){return t.split(e).filter(z)}}function Xt(t,e){return k(Tt(t))&&k(e)?t.slice(0,-1).concat(Tt(t)+e):gt(t,e)}var te={log:W,error:W,table:W};var ee="undefined"!=typeof document&&document.documentMode&&9===document.documentMode?window&&window.console?function(t){var e=function(e){return Function.prototype.bind.call(e,t)};return{log:e(t.log),error:e(t.log),table:e(t.log)}}(window.console):te:console.table&&console.error?console:function(t){var e=t.log.bind(t);return{log:e,error:t.error?t.error.bind(t):e,table:t.table?t.table.bind(t):e}}(console);function re(t){if(!t)return"ui-view (defunct)";var e=t.creationContext?t.creationContext.name||"(root)":"(none)";return"[ui-view#".concat(t.id," ").concat(t.$type,":").concat(t.fqn," (").concat(t.name,"@").concat(e,")]")}var ne;function ie(e){return T(e)?t.Category[e]:t.Category[t.Category[e]]}(ne=t.Category||(t.Category={}))[ne.RESOLVE=0]="RESOLVE",ne[ne.TRANSITION=1]="TRANSITION",ne[ne.HOOK=2]="HOOK",ne[ne.UIVIEW=3]="UIVIEW",ne[ne.VIEWCONFIG=4]="VIEWCONFIG";var oe=f("$id"),ae=f("router.$id"),ue=function(t){return"Transition #".concat(oe(t),"-").concat(ae(t))},se=function(){function e(){this._enabled={},this.approximateDigests=0}return e.prototype._set=function(e,r){var n=this;r.length||(r=Object.keys(t.Category).map((function(t){return parseInt(t,10)})).filter((function(t){return!isNaN(t)})).map((function(e){return t.Category[e]}))),r.map(ie).forEach((function(t){return n._enabled[t]=e}))},e.prototype.enable=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._set(!0,t)},e.prototype.disable=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._set(!1,t)},e.prototype.enabled=function(t){return!!this._enabled[ie(t)]},e.prototype.traceTransitionStart=function(e){this.enabled(t.Category.TRANSITION)&&ee.log("".concat(ue(e),": Started -> ").concat(Bt(e)))},e.prototype.traceTransitionIgnored=function(e){this.enabled(t.Category.TRANSITION)&&ee.log("".concat(ue(e),": Ignored <> ").concat(Bt(e)))},e.prototype.traceHookInvocation=function(e,r,n){if(this.enabled(t.Category.HOOK)){var i=f("traceData.hookType")(n)||"internal",o=f("traceData.context.state.name")(n)||f("traceData.context")(n)||"unknown",a=Lt(e.registeredHook.callback);ee.log("".concat(ue(r),": Hook -> ").concat(i," context: ").concat(o,", ").concat(Ut(200,a)))}},e.prototype.traceHookResult=function(e,r,n){this.enabled(t.Category.HOOK)&&ee.log("".concat(ue(r),": <- Hook returned: ").concat(Ut(200,Bt(e))))},e.prototype.traceResolvePath=function(e,r,n){this.enabled(t.Category.RESOLVE)&&ee.log("".concat(ue(n),": Resolving ").concat(e," (").concat(r,")"))},e.prototype.traceResolvableResolved=function(e,r){this.enabled(t.Category.RESOLVE)&&ee.log("".concat(ue(r),": <- Resolved ").concat(e," to: ").concat(Ut(200,Bt(e.data))))},e.prototype.traceError=function(e,r){this.enabled(t.Category.TRANSITION)&&ee.log("".concat(ue(r),": <- Rejected ").concat(Bt(r),", reason: ").concat(e))},e.prototype.traceSuccess=function(e,r){this.enabled(t.Category.TRANSITION)&&ee.log("".concat(ue(r),": <- Success ").concat(Bt(r),", final state: ").concat(e.name))},e.prototype.traceUIViewEvent=function(e,r,n){void 0===n&&(n=""),this.enabled(t.Category.UIVIEW)&&ee.log("ui-view: ".concat(Nt(30,e)," ").concat(re(r)).concat(n))},e.prototype.traceUIViewConfigUpdated=function(e,r){this.enabled(t.Category.UIVIEW)&&this.traceUIViewEvent("Updating",e," with ViewConfig from context='".concat(r,"'"))},e.prototype.traceUIViewFill=function(e,r){this.enabled(t.Category.UIVIEW)&&this.traceUIViewEvent("Fill",e," with: ".concat(Ut(200,r)))},e.prototype.traceViewSync=function(e){if(this.enabled(t.Category.VIEWCONFIG)){var r="uiview component fqn",n=e.map((function(t){var e,n=t.uiView,i=t.viewConfig,o=n&&n.fqn,a=i&&"".concat(i.viewDecl.$context.name,": (").concat(i.viewDecl.$name,")");return(e={})[r]=o,e["view config state (view name)"]=a,e})).sort((function(t,e){return(t[r]||"").localeCompare(e[r]||"")}));ee.table(n)}},e.prototype.traceViewServiceEvent=function(e,r){this.enabled(t.Category.VIEWCONFIG)&&ee.log("VIEWCONFIG: ".concat(e," ").concat(function(t){var e=t.viewDecl,r=e.$context.name||"(root)";return"[View#".concat(t.$id," from '").concat(r,"' state]: target ui-view: '").concat(e.$uiViewName,"@").concat(e.$uiViewContextAnchor,"'")}(r)))},e.prototype.traceViewServiceUIViewEvent=function(e,r){this.enabled(t.Category.VIEWCONFIG)&&ee.log("VIEWCONFIG: ".concat(e," ").concat(re(r)))},e}(),ce=new se,fe=function(){function t(t){this.pattern=/.*/,this.inherit=!0,B(this,t)}return t.prototype.is=function(t,e){return!0},t.prototype.encode=function(t,e){return t},t.prototype.decode=function(t,e){return t},t.prototype.equals=function(t,e){return t==e},t.prototype.$subPattern=function(){var t=this.pattern.toString();return t.substr(1,t.length-2)},t.prototype.toString=function(){return"{ParamType:".concat(this.name,"}")},t.prototype.$normalize=function(t){return this.is(t)?t:this.decode(t)},t.prototype.$asArray=function(t,e){if(!t)return this;if("auto"===t&&!e)throw new Error("'auto' array mode is for query parameters only");return new le(this,t)},t}();function le(t,e){var r=this;function n(t){return x(t)?t:R(t)?[t]:[]}function i(t,r){return function(i){if(x(i)&&0===i.length)return i;var o=ht(n(i),t);return!0===r?0===ct(o,(function(t){return!t})).length:function(t){switch(t.length){case 0:return;case 1:return"auto"===e?t[0]:t;default:return t}}(o)}}function o(t){return function(e,r){var i=n(e),o=n(r);if(i.length!==o.length)return!1;for(var a=0;a<i.length;a++)if(!t(i[a],o[a]))return!1;return!0}}["encode","decode","equals","$normalize"].forEach((function(e){var n=t[e].bind(t),a="equals"===e?o:i;r[e]=a(n)})),B(this,{dynamic:t.dynamic,name:t.name,pattern:t.pattern,inherit:t.inherit,raw:t.raw,is:i(t.is.bind(t),!0),$arrayMode:e})}var he,pe=Object.prototype.hasOwnProperty;function ve(e,r,n){var i=!1===n.reloadOnSearch&&r===t.DefType.SEARCH||void 0,o=ft([n.dynamic,i],R),a=R(o)?{dynamic:o}:{},u=function(t){function e(){return t.value}t=function(t){return 0===["value","type","squash","array","dynamic"].filter(pe.bind(t||{})).length}(t)?{value:t}:t,e.__cacheable=!0;var r=I(t.value)?t.value:e;return B(t,{$$fn:r})}(n&&n.params&&n.params[e]);return B(a,u)}(he=t.DefType||(t.DefType={}))[he.PATH=0]="PATH",he[he.SEARCH=1]="SEARCH",he[he.CONFIG=2]="CONFIG";var de,me=function(){function e(e,r,n,i,o){var a=ve(e,n,o);r=function(e,r,n,i,o){if(e.type&&r&&"string"!==r.name)throw new Error("Param '".concat(i,"' has two type configurations."));if(e.type&&r&&"string"===r.name&&o.type(e.type))return o.type(e.type);if(r)return r;if(!e.type){var a=n===t.DefType.CONFIG?"any":n===t.DefType.PATH?"path":n===t.DefType.SEARCH?"query":"string";return o.type(a)}return e.type instanceof fe?e.type:o.type(e.type)}(a,r,n,e,i.paramTypes);var u,c,f=(u={array:n===t.DefType.SEARCH&&"auto"},c=e.match(/\[\]$/)?{array:!0}:{},B(u,c,a).array);r=f?r.$asArray(f,n===t.DefType.SEARCH):r;var l=void 0!==a.value||n===t.DefType.SEARCH,h=R(a.dynamic)?!!a.dynamic:!!r.dynamic,p=R(a.raw)?!!a.raw:!!r.raw,v=function(t,e,r){var n=t.squash;if(!e||!1===n)return!1;if(!R(n)||null==n)return r;if(!0===n||k(n))return n;throw new Error("Invalid squash policy: '".concat(n,"'. Valid policies: false, true, or arbitrary string"))}(a,l,i.defaultSquashPolicy()),d=function(t,e,r,n){var i=[{from:"",to:r||e?void 0:""},{from:null,to:r||e?void 0:""}],o=x(t.replace)?t.replace:[];k(n)&&o.push({from:n,to:void 0});var a=ht(o,s("from"));return ct(i,(function(t){return-1===a.indexOf(t.from)})).concat(o)}(a,f,l,v),m=R(a.inherit)?!!a.inherit:!!r.inherit;B(this,{id:e,type:r,location:n,isOptional:l,dynamic:h,raw:p,squash:v,replace:d,inherit:m,array:f,config:a})}return e.values=function(t,e){void 0===e&&(e={});for(var r={},n=0,i=t;n<i.length;n++){var o=i[n];r[o.id]=o.value(e[o.id])}return r},e.changed=function(t,e,r){return void 0===e&&(e={}),void 0===r&&(r={}),t.filter((function(t){return!t.type.equals(e[t.id],r[t.id])}))},e.equals=function(t,r,n){return void 0===r&&(r={}),void 0===n&&(n={}),0===e.changed(t,r,n).length},e.validates=function(t,e){return void 0===e&&(e={}),t.map((function(t){return t.validates(e[t.id])})).reduce(vt,!0)},e.prototype.isDefaultValue=function(t){return this.isOptional&&this.type.equals(this.value(),t)},e.prototype.value=function(t){var e=this;return t=function(t){for(var r=0,n=e.replace;r<n.length;r++){var i=n[r];if(i.from===t)return i.to}return t}(t),$(t)?function(){if(e._defaultValueCache)return e._defaultValueCache.defaultValue;if(!D.$injector)throw new Error("Injectable functions cannot be called at configuration time");var t=D.$injector.invoke(e.config.$$fn);if(null!=t&&!e.type.is(t))throw new Error("Default value (".concat(t,") for parameter '").concat(e.id,"' is not an instance of ParamType (").concat(e.type.name,")"));return e.config.$$fn.__cacheable&&(e._defaultValueCache={defaultValue:t}),t}():this.type.$normalize(t)},e.prototype.isSearch=function(){return this.location===t.DefType.SEARCH},e.prototype.validates=function(t){if(($(t)||null===t)&&this.isOptional)return!0;var e=this.type.$normalize(t);if(!this.type.is(e))return!1;var r=this.type.encode(e);return!(k(r)&&!this.type.pattern.exec(r))},e.prototype.toString=function(){return"{Param:".concat(this.id," ").concat(this.type," squash: '").concat(this.squash,"' optional: ").concat(this.isOptional,"}")},e}(),ye=function(){function t(){this.enqueue=!0,this.typeQueue=[],this.defaultTypes=at(t.prototype,["hash","string","query","path","int","bool","date","json","any"]);this.types=Q(ht(this.defaultTypes,(function(t,e){return new fe(B({name:e},t))})),{})}return t.prototype.dispose=function(){this.types={}},t.prototype.type=function(t,e,r){if(!R(e))return this.types[t];if(this.types.hasOwnProperty(t))throw new Error("A type named '".concat(t,"' has already been defined."));return this.types[t]=new fe(B({name:t},e)),r&&(this.typeQueue.push({name:t,def:r}),this.enqueue||this._flushTypeQueue()),this},t.prototype._flushTypeQueue=function(){for(;this.typeQueue.length;){var t=this.typeQueue.shift();if(t.pattern)throw new Error("You cannot override a type's .pattern at runtime.");B(this.types[t.name],D.$injector.invoke(t.def))}},t}();de=function(t){var e=function(t){return null!=t?t.toString():t},r={encode:e,decode:e,is:m(String),pattern:/.*/,equals:function(t,e){return t==e}};return B({},r,t)},B(ye.prototype,{string:de({}),path:de({pattern:/[^/]*/}),query:de({}),hash:de({inherit:!1}),int:de({decode:function(t){return parseInt(t,10)},is:function(t){return!C(t)&&this.decode(t.toString())===t},pattern:/-?\d+/}),bool:de({encode:function(t){return t?1:0},decode:function(t){return 0!==parseInt(t,10)},is:m(Boolean),pattern:/0|1/}),date:de({encode:function(t){return this.is(t)?[t.getFullYear(),("0"+(t.getMonth()+1)).slice(-2),("0"+t.getDate()).slice(-2)].join("-"):void 0},decode:function(t){if(this.is(t))return t;var e=this.capture.exec(t);return e?new Date(e[1],e[2]-1,e[3]):void 0},is:function(t){return t instanceof Date&&!isNaN(t.valueOf())},equals:function(t,e){return["getFullYear","getMonth","getDate"].reduce((function(r,n){return r&&t[n]()===e[n]()}),!0)},pattern:/[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,capture:/([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/}),json:de({encode:L,decode:F,is:m(Object),equals:G,pattern:/[^/]*/}),any:de({encode:z,decode:z,is:function(){return!0},equals:G})});var ge=function(){function t(t){void 0===t&&(t={}),B(this,t)}return t.prototype.$inherit=function(t,e,r){var n=ot(e,r),i={},o=[];for(var a in n)if(n[a]&&n[a].params){var u=n[a].params,s=Object.keys(u);if(s.length)for(var c in s)!s.hasOwnProperty(c)||0==u[s[c]].inherit||o.indexOf(s[c])>=0||(o.push(s[c]),i[s[c]]=this[s[c]])}return B({},i,t)},t}(),we=function(){function t(e){if(e instanceof t){var r=e;this.state=r.state,this.paramSchema=r.paramSchema.slice(),this.paramValues=B({},r.paramValues),this.resolvables=r.resolvables.slice(),this.views=r.views&&r.views.slice()}else{var n=e;this.state=n,this.paramSchema=n.parameters({inherit:!1}),this.paramValues={},this.resolvables=n.resolvables.map((function(t){return t.clone()}))}}return t.prototype.clone=function(){return new t(this)},t.prototype.applyRawParams=function(t){return this.paramValues=this.paramSchema.reduce((function(e,r){return Pt(e,[(n=r).id,n.value(t[n.id])]);var n}),{}),this},t.prototype.parameter=function(t){return ft(this.paramSchema,c("id",t))},t.prototype.equals=function(t,e){var r=this.diff(t,e);return r&&0===r.length},t.prototype.diff=function(t,e){if(this.state!==t.state)return!1;var r=e?e(this):this.paramSchema;return me.changed(r,this.paramValues,t.paramValues)},t.clone=function(t){return t.clone()},t}(),_e=function(){function t(t,e,r,n){this._stateRegistry=t,this._identifier=e,this._identifier=e,this._params=B({},r||{}),this._options=B({},n||{}),this._definition=t.matcher.find(e,this._options.relative)}return t.prototype.name=function(){return this._definition&&this._definition.name||this._identifier},t.prototype.identifier=function(){return this._identifier},t.prototype.params=function(){return this._params},t.prototype.$state=function(){return this._definition},t.prototype.state=function(){return this._definition&&this._definition.self},t.prototype.options=function(){return this._options},t.prototype.exists=function(){return!(!this._definition||!this._definition.self)},t.prototype.valid=function(){return!this.error()},t.prototype.error=function(){var t=this.options().relative;if(!this._definition&&t){var e=t.name?t.name:t;return"Could not resolve '".concat(this.name(),"' from state '").concat(e,"'")}return this._definition?this._definition.self?void 0:"State '".concat(this.name(),"' has an invalid definition"):"No such state '".concat(this.name(),"'")},t.prototype.toString=function(){return"'".concat(this.name(),"'").concat(Bt(this.params()))},t.prototype.withState=function(e){return new t(this._stateRegistry,e,this._params,this._options)},t.prototype.withParams=function(e,r){void 0===r&&(r=!1);var n=r?e:B({},this._params,e);return new t(this._stateRegistry,this._identifier,n,this._options)},t.prototype.withOptions=function(e,r){void 0===r&&(r=!1);var n=r?e:B({},this._options,e);return new t(this._stateRegistry,this._identifier,this._params,n)},t.isDef=function(t){return t&&t.state&&(k(t.state)||O(t.state)&&k(t.state.name))},t}(),Se=function(){function t(){}return t.makeTargetState=function(t,e){var r=Tt(e).state;return new _e(t,r,e.map(s("paramValues")).reduce(it,{}),{})},t.buildPath=function(t){var e=t.params();return t.$state().path.map((function(t){return new we(t).applyRawParams(e)}))},t.buildToPath=function(e,r){var n=t.buildPath(r);return r.options().inherit?t.inheritParams(e,n,Object.keys(r.params())):n},t.applyViewConfigs=function(e,r,n){r.filter((function(t){return K(n,t.state)})).forEach((function(n){var i=pt(n.state.views||{}),o=t.subPath(r,(function(t){return t===n})),a=i.map((function(t){return e.createViewConfig(o,t)}));n.views=a.reduce(mt,[])}))},t.inheritParams=function(t,e,r){void 0===r&&(r=[]);var n=t.map((function(t){return t.paramSchema})).reduce(mt,[]).filter((function(t){return!t.inherit})).map(s("id"));return e.map((function(e){var i=B({},e&&e.paramValues),o=at(i,r);i=ut(i,r);var a,u,s,f=ut((a=t,u=e.state,s=ft(a,c("state",u)),B({},s&&s.paramValues)||{}),n),l=B(i,f,o);return new we(e.state).applyRawParams(l)}))},t.treeChanges=function(e,r,n){for(var i,o,a,u,s,c,f=Math.min(e.length,r.length),l=0;l<f&&e[l].state!==n&&(i=e[l],o=r[l],i.equals(o,t.nonDynamicParams));)l++;u=(a=e).slice(0,l),s=a.slice(l);var h=u.map((function(t,e){var n=t.clone();return n.paramValues=r[e].paramValues,n}));return c=r.slice(l),{from:a,to:h.concat(c),retained:u,retainedWithToParams:h,exiting:s,entering:c}},t.matching=function(t,e,r){var n=!1;return Ct(t,e).reduce((function(t,e){var i=e[0],o=e[1];return(n=n||!i.equals(o,r))?t:t.concat(i)}),[])},t.equals=function(e,r,n){return e.length===r.length&&t.matching(e,r,n).length===e.length},t.subPath=function(t,e){var r=ft(t,e),n=t.indexOf(r);return-1===n?void 0:t.slice(0,n+1)},t.nonDynamicParams=function(t){return t.state.parameters({inherit:!1}).filter((function(t){return!t.dynamic}))},t.paramValues=function(t){return t.reduce((function(t,e){return B(t,e.paramValues)}),{})},t}(),be={when:{LAZY:"LAZY",EAGER:"EAGER"},async:{WAIT:"WAIT",NOWAIT:"NOWAIT"}},$e={when:"LAZY",async:"WAIT"},Re=function(){function t(e,r,n,i,o){if(this.resolved=!1,this.promise=void 0,e instanceof t)B(this,e);else if(P(r)){if(C(e))throw new Error("new Resolvable(): token argument is required");if(!P(r))throw new Error("new Resolvable(): resolveFn argument must be a function");this.token=e,this.policy=i,this.resolveFn=r,this.deps=n||[],this.data=o,this.resolved=void 0!==o,this.promise=this.resolved?D.$q.when(this.data):void 0}else if(O(e)&&e.token&&(e.hasOwnProperty("resolveFn")||e.hasOwnProperty("data"))){var a=e;return new t(a.token,a.resolveFn,a.deps,a.policy,a.data)}}return t.prototype.getPolicy=function(t){var e=this.policy||{},r=t&&t.resolvePolicy||{};return{when:e.when||r.when||$e.when,async:e.async||r.async||$e.async}},t.prototype.resolve=function(t,e){var r=this,n=D.$q,i=t.findNode(this),o=i&&i.state,a=this.getPolicy(o).async,u=P(a)?a:z;return this.promise=n.when().then((function(){return n.all(t.getDependencies(r).map((function(r){return r.get(t,e)})))})).then((function(t){return r.resolveFn.apply(null,t)})).then(u).then((function(t){return r.data=t,r.resolved=!0,r.resolveFn=null,ce.traceResolvableResolved(r,e),r.data}))},t.prototype.get=function(t,e){return this.promise||this.resolve(t,e)},t.prototype.toString=function(){return"Resolvable(token: ".concat(Bt(this.token),", requires: [").concat(this.deps.map(Bt),"])")},t.prototype.clone=function(){return new t(this)},t.fromData=function(e,r){return new t(e,(function(){return r}),null,null,r)},t}(),Ee=be.when,Ce=[Ee.EAGER,Ee.LAZY],Pe=[Ee.EAGER],Te=function(){function t(t){this._path=t}return t.prototype.getTokens=function(){return this._path.reduce((function(t,e){return t.concat(e.resolvables.map((function(t){return t.token})))}),[]).reduce(wt,[])},t.prototype.getResolvable=function(t){return Tt(this._path.map((function(t){return t.resolvables})).reduce(mt,[]).filter((function(e){return e.token===t})))},t.prototype.getPolicy=function(t){var e=this.findNode(t);return t.getPolicy(e.state)},t.prototype.subContext=function(e){return new t(Se.subPath(this._path,(function(t){return t.state===e})))},t.prototype.addResolvables=function(t,e){var r=ft(this._path,c("state",e)),n=t.map((function(t){return t.token}));r.resolvables=r.resolvables.filter((function(t){return-1===n.indexOf(t.token)})).concat(t)},t.prototype.resolvePath=function(t,e){var r=this;void 0===t&&(t="LAZY");var n=(K(Ce,t)?t:"LAZY")===be.when.EAGER?Pe:Ce;ce.traceResolvePath(this._path,t,e);var i=function(t,e){return function(n){return K(t,r.getPolicy(n)[e])}},o=this._path.reduce((function(t,o){var a=o.resolvables.filter(i(n,"when")),u=a.filter(i(["NOWAIT"],"async")),s=a.filter(l(i(["NOWAIT"],"async"))),c=r.subContext(o.state),f=function(t){return t.get(c,e).then((function(e){return{token:t.token,value:e}}))};return u.forEach(f),t.concat(s.map(f))}),[]);return D.$q.all(o)},t.prototype.injector=function(){return this._injector||(this._injector=new ke(this))},t.prototype.findNode=function(t){return ft(this._path,(function(e){return K(e.resolvables,t)}))},t.prototype.getDependencies=function(t){var e=this,r=this.findNode(t),n=(Se.subPath(this._path,(function(t){return t===r}))||this._path).reduce((function(t,e){return t.concat(e.resolvables)}),[]).filter((function(e){return e!==t}));return t.deps.map((function(t){var r=n.filter((function(e){return e.token===t}));if(r.length)return Tt(r);var i=e.injector().getNative(t);if($(i))throw new Error("Could not find Dependency Injection token: "+Bt(t));return new Re(t,(function(){return i}),[],i)}))},t}(),ke=function(){function t(t){this.context=t,this.native=this.get("Native Injector")||D.$injector}return t.prototype.get=function(t){var e=this.context.getResolvable(t);if(e){if("NOWAIT"===this.context.getPolicy(e).async)return e.get(this.context);if(!e.resolved)throw new Error("Resolvable async .get() not complete:"+Bt(e.token));return e.data}return this.getNative(t)},t.prototype.getAsync=function(t){var e=this.context.getResolvable(t);return e?e.get(this.context):D.$q.when(this.native.get(t))},t.prototype.getNative=function(t){return this.native&&this.native.get(t)},t}();function Oe(t){return t.name}function xe(t){return t.self.$$state=function(){return t},t.self}function je(t){return t.parent&&t.parent.data&&(t.data=t.self.data=Q(t.parent.data,t.data)),t.data}var Ve=function(t,e){return function(r){var n=r.self;if(n&&n.url&&n.name&&n.name.match(/\.\*\*$/)){var i={};kt(n,i),i.url+="{remainder:any}",n=i}var o=r.parent,a=function(t){if(!k(t))return!1;var e="^"===t.charAt(0);return{val:e?t.substring(1):t,root:e}}(n.url),u=a?t.compile(a.val,{state:n}):n.url;if(!u)return null;if(!t.isMatcher(u))throw new Error("Invalid url '".concat(u,"' in state '").concat(r,"'"));return a&&a.root?u:(o&&o.navigable||e()).url.append(u)}},Ie=function(t){return function(e){return!t(e)&&e.url?e:e.parent?e.parent.navigable:null}};function He(t){return t.parent?t.parent.path.concat(t):[t]}function Ae(t){var e=t.parent?B({},t.parent.includes):{};return e[t.name]=!0,e}function De(t){var e=function(t){return t.provide||t.token},r=_([[s("resolveFn"),function(t){return new Re(e(t),t.resolveFn,t.deps,t.policy)}],[s("useFactory"),function(t){return new Re(e(t),t.useFactory,t.deps||t.dependencies,t.policy)}],[s("useClass"),function(t){return new Re(e(t),(function(){return new t.useClass}),[],t.policy)}],[s("useValue"),function(t){return new Re(e(t),(function(){return t.useValue}),[],t.policy,t.useValue)}],[s("useExisting"),function(t){return new Re(e(t),z,[t.useExisting],t.policy)}]]),n=_([[u(s("val"),k),function(t){return new Re(t.token,z,[t.val],t.policy)}],[u(s("val"),x),function(t){return new Re(t.token,Tt(t.val),t.val.slice(0,-1),t.policy)}],[u(s("val"),P),function(t){return new Re(t.token,t.val,function(t){var e=D.$injector;return t.$inject||e&&e.annotate(t,e.strictDi)||"deferred"}(t.val),t.policy)}]]),i=_([[m(Re),function(t){return t}],[function(t){return!(!t.token||!t.resolveFn)},r],[function(t){return!(!t.provide&&!t.token||!(t.useValue||t.useFactory||t.useExisting||t.useClass))},r],[function(t){return!!(t&&t.val&&(k(t.val)||x(t.val)||P(t.val)))},n],[g(!0),function(t){throw new Error("Invalid resolve value: "+Bt(t))}]]),o=t.resolve;return(x(o)?o:function(t,e){return Object.keys(t||{}).map((function(r){return{token:r,val:t[r],deps:void 0,policy:e[r]}}))}(o,t.resolvePolicy||{})).map(i)}var qe,Ue,Ne=function(){function t(t,e){this.matcher=t;var r,n=this,i=function(){return t.find("")},o=function(t){return""===t.name};this.builders={name:[Oe],self:[xe],parent:[function(e){return o(e)?null:t.find(n.parentName(e))||i()}],data:[je],url:[Ve(e,i)],navigable:[Ie(o)],params:[(r=e.paramFactory,function(t){var e=t.url&&t.url.parameters({inherit:!1})||[],n=pt(lt(ut(t.params||{},e.map(s("id"))),(function(e,n){return r.fromConfig(n,null,t.self)})));return e.concat(n).map((function(t){return[t.id,t]})).reduce(Pt,{})})],views:[],path:[He],includes:[Ae],resolvables:[De]}}return t.prototype.builder=function(t,e){var r=this.builders,n=r[t]||[];return k(t)&&!R(e)?n.length>1?n:n[0]:k(t)&&P(e)?(r[t]=n,r[t].push(e),function(){return r[t].splice(r[t].indexOf(e,1))&&null}):void 0},t.prototype.build=function(t){var e=this.matcher,r=this.builders,n=this.parentName(t);if(n&&!e.find(n,void 0,!1))return null;for(var i in r)if(r.hasOwnProperty(i)){var o=r[i].reduce((function(t,e){return function(r){return e(r,t)}}),W);t[i]=o(t)}return t},t.prototype.parentName=function(t){var e=t.name||"",r=e.split(".");if("**"===r.pop()&&r.pop(),r.length){if(t.parent)throw new Error("States that specify the 'parent:' property should not have a '.' in their name (".concat(e,")"));return r.join(".")}return t.parent?k(t.parent)?t.parent:t.parent.name:""},t.prototype.name=function(t){var e=t.name;if(-1!==e.indexOf(".")||!t.parent)return e;var r=k(t.parent)?t.parent:t.parent.name;return r?r+"."+e:e},t}(),Fe=function(){function t(e){return t.create(e||{})}return t.create=function(e){e=t.isStateClass(e)?new e:e;var r=Q(Q(e,t.prototype));return e.$$state=function(){return r},r.self=e,r.__stateObjectCache={nameGlob:Ht.fromString(r.name)},r},t.prototype.is=function(t){return this===t||this.self===t||this.fqn()===t},t.prototype.fqn=function(){if(!(this.parent&&this.parent instanceof this.constructor))return this.name;var t=this.parent.fqn();return t?t+"."+this.name:this.name},t.prototype.root=function(){return this.parent&&this.parent.root()||this},t.prototype.parameters=function(t){return((t=nt(t,{inherit:!0,matchingKeys:null})).inherit&&this.parent&&this.parent.parameters()||[]).concat(pt(this.params)).filter((function(e){return!t.matchingKeys||t.matchingKeys.hasOwnProperty(e.id)}))},t.prototype.parameter=function(t,e){return void 0===e&&(e={}),this.url&&this.url.parameter(t,e)||ft(pt(this.params),c("id",t))||e.inherit&&this.parent&&this.parent.parameter(t)},t.prototype.toString=function(){return this.fqn()},t.isStateClass=function(t){return P(t)&&!0===t.__uiRouterState},t.isStateDeclaration=function(t){return P(t.$$state)},t.isState=function(t){return O(t.__stateObjectCache)},t}(),Le=function(){function t(t){this._states=t}return t.prototype.isRelative=function(t){return 0===(t=t||"").indexOf(".")||0===t.indexOf("^")},t.prototype.find=function(t,e,r){if(void 0===r&&(r=!0),t||""===t){var n=k(t),i=n?t:t.name;this.isRelative(i)&&(i=this.resolvePath(i,e));var o=this._states[i];if(o&&(n||!(n||o!==t&&o.self!==t)))return o;if(n&&r){var a=pt(this._states).filter((function(t){return t.__stateObjectCache.nameGlob&&t.__stateObjectCache.nameGlob.matches(i)}));return a.length>1&&ee.error("stateMatcher.find: Found multiple matches for ".concat(i," using glob: "),a.map((function(t){return t.name}))),a[0]}}},t.prototype.resolvePath=function(t,e){if(!e)throw new Error("No reference point given for path '".concat(t,"'"));for(var r=this.find(e),n=t.split("."),i=n.length,o=0,a=r;o<i;o++)if(""!==n[o]||0!==o){if("^"!==n[o])break;if(!a.parent)throw new Error("Path '".concat(t,"' not valid for state '").concat(r.name,"'"));a=a.parent}else a=r;var u=n.slice(o).join(".");return a.name+(a.name&&u?".":"")+u},t}(),Me=function(){function t(t,e,r,n){this.router=t,this.states=e,this.builder=r,this.listeners=n,this.queue=[]}return t.prototype.dispose=function(){this.queue=[]},t.prototype.register=function(t){var e=this.queue,r=Fe.create(t),n=r.name;if(!k(n))throw new Error("State must have a valid name");if(this.states.hasOwnProperty(n)||K(e.map(s("name")),n))throw new Error("State '".concat(n,"' is already defined"));return e.push(r),this.flush(),r},t.prototype.flush=function(){for(var t=this,e=this.queue,r=this.states,n=this.builder,i=[],o=[],a={},u=function(e){return t.states.hasOwnProperty(e)&&t.states[e]},s=function(){i.length&&t.listeners.forEach((function(t){return t("registered",i.map((function(t){return t.self})))}))};e.length>0;){var c=e.shift(),f=c.name,l=n.build(c),h=o.indexOf(c);if(l){var p=u(f);if(p&&p.name===f)throw new Error("State '".concat(f,"' is already defined"));var v=u(f+".**");v&&this.router.stateRegistry.deregister(v),r[f]=c,this.attachRoute(c),h>=0&&o.splice(h,1),i.push(c)}else{var d=a[f];if(a[f]=e.length,h>=0&&d===e.length)return e.push(c),s(),r;h<0&&o.push(c),e.push(c)}}return s(),r},t.prototype.attachRoute=function(t){if(!t.abstract&&t.url){var e=this.router.urlService.rules;e.rule(e.urlRuleFactory.create(t))}},t}(),Be=function(){function t(t){this.router=t,this.states={},this.listeners=[],this.matcher=new Le(this.states),this.builder=new Ne(this.matcher,t.urlMatcherFactory),this.stateQueue=new Me(t,this.states,this.builder,this.listeners),this._registerRoot()}return t.prototype._registerRoot=function(){(this._root=this.stateQueue.register({name:"",url:"^",views:null,params:{"#":{value:null,type:"hash",dynamic:!0}},abstract:!0})).navigable=null},t.prototype.dispose=function(){var t=this;this.stateQueue.dispose(),this.listeners=[],this.get().forEach((function(e){return t.get(e)&&t.deregister(e)}))},t.prototype.onStatesChanged=function(t){return this.listeners.push(t),function(){Z(this.listeners)(t)}.bind(this)},t.prototype.root=function(){return this._root},t.prototype.register=function(t){return this.stateQueue.register(t)},t.prototype._deregisterTree=function(t){var e=this,r=this.get().map((function(t){return t.$$state()})),n=function(t){var e=r.filter((function(e){return-1!==t.indexOf(e.parent)}));return 0===e.length?e:e.concat(n(e))},i=n([t]),o=[t].concat(i).reverse();return o.forEach((function(t){var r=e.router.urlService.rules;r.rules().filter(c("state",t)).forEach((function(t){return r.removeRule(t)})),delete e.states[t.name]})),o},t.prototype.deregister=function(t){var e=this.get(t);if(!e)throw new Error("Can't deregister state; not found: "+t);var r=this._deregisterTree(e.$$state());return this.listeners.forEach((function(t){return t("deregistered",r.map((function(t){return t.self})))})),r},t.prototype.get=function(t,e){var r=this;if(0===arguments.length)return Object.keys(this.states).map((function(t){return r.states[t].self}));var n=this.matcher.find(t,e);return n&&n.self||null},t.prototype.decorator=function(t,e){return this.builder.builder(t,e)},t}();(qe=t.TransitionHookPhase||(t.TransitionHookPhase={}))[qe.CREATE=0]="CREATE",qe[qe.BEFORE=1]="BEFORE",qe[qe.RUN=2]="RUN",qe[qe.SUCCESS=3]="SUCCESS",qe[qe.ERROR=4]="ERROR",(Ue=t.TransitionHookScope||(t.TransitionHookScope={}))[Ue.TRANSITION=0]="TRANSITION",Ue[Ue.STATE=1]="STATE";var Ge={current:W,transition:null,traceData:{},bind:null},ze=function(){function e(e,r,n,i){var o=this;this.transition=e,this.stateContext=r,this.registeredHook=n,this.options=i,this.isSuperseded=function(){return o.type.hookPhase===t.TransitionHookPhase.RUN&&!o.options.transition.isActive()},this.options=nt(i,Ge),this.type=n.eventType}return e.chain=function(t,e){return t.reduce((function(t,e){return t.then((function(){return e.invokeHook()}))}),e||D.$q.when())},e.invokeHooks=function(t,r){for(var n=0;n<t.length;n++){var i=t[n].invokeHook();if(H(i)){var o=t.slice(n+1);return e.chain(o,i).then(r)}}return r()},e.runAllHooks=function(t){t.forEach((function(t){return t.invokeHook()}))},e.prototype.logError=function(t){this.transition.router.stateService.defaultErrorHandler()(t)},e.prototype.invokeHook=function(){var t=this,e=this.registeredHook;if(!e._deregistered){var r=this.getNotCurrentRejection();if(r)return r;var n=this.options;ce.traceHookInvocation(this,this.transition,n);var i=function(r){return e.eventType.getErrorHandler(t)(r)},o=function(r){return e.eventType.getResultHandler(t)(r)};try{var a=e.callback.call(n.bind,t.transition,t.stateContext);return!this.type.synchronous&&H(a)?a.catch((function(t){return qt.normalize(t).toPromise()})).then(o,i):o(a)}catch(t){return i(qt.normalize(t))}finally{e.invokeLimit&&++e.invokeCount>=e.invokeLimit&&e.deregister()}}},e.prototype.handleHookResult=function(t){var e=this,r=this.getNotCurrentRejection();return r||(H(t)?t.then((function(t){return e.handleHookResult(t)})):(ce.traceHookResult(t,this.transition,this.options),!1===t?qt.aborted("Hook aborted transition").toPromise():m(_e)(t)?qt.redirected(t).toPromise():void 0))},e.prototype.getNotCurrentRejection=function(){var t=this.transition.router;return t._disposed?qt.aborted("UIRouter instance #".concat(t.$id," has been stopped (disposed)")).toPromise():this.transition._aborted?qt.aborted().toPromise():this.isSuperseded()?qt.superseded(this.options.current()).toPromise():void 0},e.prototype.toString=function(){var t=this.options,e=this.registeredHook,r=f("traceData.hookType")(t)||"internal",n=f("traceData.context.state.name")(t)||f("traceData.context")(t)||"unknown",i=Mt(e.callback);return"".concat(r," context: ").concat(n,", ").concat(Ut(200,i))},e.HANDLE_RESULT=function(t){return function(e){return t.handleHookResult(e)}},e.LOG_REJECTED_RESULT=function(t){return function(e){H(e)&&e.catch((function(e){return t.logError(qt.normalize(e))}))}},e.LOG_ERROR=function(t){return function(e){return t.logError(e)}},e.REJECT_ERROR=function(t){return function(t){return It(t)}},e.THROW_ERROR=function(t){return function(t){throw t}},e}();function We(t,e,r){var n=k(e)?[e]:e;return!!(P(n)?n:function(t){for(var e=n,r=0;r<e.length;r++){var i=new Ht(e[r]);if(i&&i.matches(t.name)||!i&&e[r]===t.name)return!0}return!1})(t,r)}var Je=function(){function e(t,e,r,n,i,o){void 0===o&&(o={}),this.tranSvc=t,this.eventType=e,this.callback=r,this.matchCriteria=n,this.removeHookFromRegistry=i,this.invokeCount=0,this._deregistered=!1,this.priority=o.priority||0,this.bind=o.bind||null,this.invokeLimit=o.invokeLimit}return e.prototype._matchingNodes=function(t,e,r){if(!0===e)return t;var n=t.filter((function(t){return We(t.state,e,r)}));return n.length?n:null},e.prototype._getDefaultMatchCriteria=function(){return lt(this.tranSvc._pluginapi._getPathTypes(),(function(){return!0}))},e.prototype._getMatchingNodes=function(e,r){var n=this,i=B(this._getDefaultMatchCriteria(),this.matchCriteria);return pt(this.tranSvc._pluginapi._getPathTypes()).reduce((function(o,a){var u=a.scope===t.TransitionHookScope.STATE,s=e[a.name]||[],c=u?s:[Tt(s)];return o[a.name]=n._matchingNodes(c,i[a.name],r),o}),{})},e.prototype.matches=function(t,e){var r=this._getMatchingNodes(t,e);return pt(r).every(z)?r:null},e.prototype.deregister=function(){this.removeHookFromRegistry(this),this._deregistered=!0},e}();function Qe(t,e,r){var n=(t._registeredHooks=t._registeredHooks||{})[r.name]=[],i=Z(n);function o(t,o,a){void 0===a&&(a={});var u=new Je(e,r,o,t,i,a);return n.push(u),u.deregister.bind(u)}return t[r.name]=o,o}var Ke=function(){function e(t){this.transition=t}return e.prototype.buildHooksForPhase=function(t){var e=this;return this.transition.router.transitionService._pluginapi._getEvents(t).map((function(t){return e.buildHooks(t)})).reduce(mt,[]).filter(z)},e.prototype.buildHooks=function(e){var r=this.transition,n=r.treeChanges(),i=this.getMatchingHooks(e,n,r);if(!i)return[];var o={transition:r,current:r.options().current};return i.map((function(i){return i.matches(n,r)[e.criteriaMatchPath.name].map((function(n){var a=B({bind:i.bind,traceData:{hookType:e.name,context:n}},o),u=e.criteriaMatchPath.scope===t.TransitionHookScope.STATE?n.state.self:null,s=new ze(r,u,i,a);return{hook:i,node:n,transitionHook:s}}))})).reduce(mt,[]).sort(function(t){void 0===t&&(t=!1);return function(e,r){var n=t?-1:1,i=(e.node.state.path.length-r.node.state.path.length)*n;return 0!==i?i:r.hook.priority-e.hook.priority}}(e.reverseSort)).map((function(t){return t.transitionHook}))},e.prototype.getMatchingHooks=function(e,r,n){var i=e.hookPhase===t.TransitionHookPhase.CREATE,o=this.transition.router.transitionService;return(i?[o]:[this.transition,o]).map((function(t){return t.getHooks(e.name)})).filter(bt(x,"broken event named: ".concat(e.name))).reduce(mt,[]).filter((function(t){return t.matches(r,n)}))},e}();var Ye=s("self"),Ze=function(){function e(e,r,n){var i=this;if(this._deferred=D.$q.defer(),this.promise=this._deferred.promise,this._registeredHooks={},this._hookBuilder=new Ke(this),this.isActive=function(){return i.router.globals.transition===i},this.router=n,this._targetState=r,!r.valid())throw new Error(r.error());this._options=B({current:g(this)},r.options()),this.$id=n.transitionService._transitionCount++;var o=Se.buildToPath(e,r);this._treeChanges=Se.treeChanges(e,o,this._options.reloadState),this.createTransitionHookRegFns();var a=this._hookBuilder.buildHooksForPhase(t.TransitionHookPhase.CREATE);ze.invokeHooks(a,(function(){return null})),this.applyViewConfigs(n)}return e.prototype.onBefore=function(t,e,r){},e.prototype.onStart=function(t,e,r){},e.prototype.onExit=function(t,e,r){},e.prototype.onRetain=function(t,e,r){},e.prototype.onEnter=function(t,e,r){},e.prototype.onFinish=function(t,e,r){},e.prototype.onSuccess=function(t,e,r){},e.prototype.onError=function(t,e,r){},e.prototype.createTransitionHookRegFns=function(){var e=this;this.router.transitionService._pluginapi._getEvents().filter((function(e){return e.hookPhase!==t.TransitionHookPhase.CREATE})).forEach((function(t){return Qe(e,e.router.transitionService,t)}))},e.prototype.getHooks=function(t){return this._registeredHooks[t]},e.prototype.applyViewConfigs=function(t){var e=this._treeChanges.entering.map((function(t){return t.state}));Se.applyViewConfigs(t.transitionService.$view,this._treeChanges.to,e)},e.prototype.$from=function(){return Tt(this._treeChanges.from).state},e.prototype.$to=function(){return Tt(this._treeChanges.to).state},e.prototype.from=function(){return this.$from().self},e.prototype.to=function(){return this.$to().self},e.prototype.targetState=function(){return this._targetState},e.prototype.is=function(t){return t instanceof e?this.is({to:t.$to().name,from:t.$from().name}):!(t.to&&!We(this.$to(),t.to,this)||t.from&&!We(this.$from(),t.from,this))},e.prototype.params=function(t){return void 0===t&&(t="to"),Object.freeze(this._treeChanges[t].map(s("paramValues")).reduce(it,{}))},e.prototype.paramsChanged=function(){var t=this.params("from"),e=this.params("to"),r=[].concat(this._treeChanges.to).concat(this._treeChanges.from).map((function(t){return t.paramSchema})).reduce(yt,[]).reduce(wt,[]);return me.changed(r,t,e).reduce((function(t,r){return t[r.id]=e[r.id],t}),{})},e.prototype.injector=function(t,e){void 0===e&&(e="to");var r=this._treeChanges[e];return t&&(r=Se.subPath(r,(function(e){return e.state===t||e.state.name===t}))),new Te(r).injector()},e.prototype.getResolveTokens=function(t){return void 0===t&&(t="to"),new Te(this._treeChanges[t]).getTokens()},e.prototype.addResolvable=function(t,e){void 0===e&&(e=""),t=m(Re)(t)?t:new Re(t);var r="string"==typeof e?e:e.name,n=this._treeChanges.to,i=ft(n,(function(t){return t.state.name===r}));new Te(n).addResolvables([t],i.state)},e.prototype.redirectedFrom=function(){return this._options.redirectedFrom||null},e.prototype.originalTransition=function(){var t=this.redirectedFrom();return t&&t.originalTransition()||this},e.prototype.options=function(){return this._options},e.prototype.entering=function(){return ht(this._treeChanges.entering,s("state")).map(Ye)},e.prototype.exiting=function(){return ht(this._treeChanges.exiting,s("state")).map(Ye).reverse()},e.prototype.retained=function(){return ht(this._treeChanges.retained,s("state")).map(Ye)},e.prototype.views=function(t,e