LocalCDN-Firefox-Chrome-Brave/resources/angular-ui-router/1.0.25/angular-ui-router.min.jsm

13 lines
113 KiB
JavaScript

/**
* 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.0.25
* @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(d,t){"use strict";var e=angular,$=t&&t.module?t:e,n=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),i=0;for(e=0;e<r;e++)for(var o=arguments[e],a=0,u=o.length;a<u;a++,i++)n[i]=o[a];return n};function s(r){return function t(){if(arguments.length>=r.length)return r.apply(this,arguments);var e=Array.prototype.slice.call(arguments);return t.bind.apply(t,n([this],e))}}function r(){var r=arguments,n=r.length-1;return function(){for(var t=n,e=r[n].apply(this,arguments);t--;)e=r[t].call(this,e);return e}}function c(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return r.apply(null,[].slice.call(arguments).reverse())}var m=function(e){return function(t){return t&&t[e]}},y=s(function(t,e,r){return r&&r[t]===e}),R=function(t){return c.apply(null,t.split(".").map(m))},l=function(r){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return!r.apply(null,t)}};function i(r,n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return r.apply(null,t)&&n.apply(null,t)}}function o(r,n){return function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return r.apply(null,t)||n.apply(null,t)}}function a(e){return function(t){return e===t}}var u=function(r){return function(t){return t.reduce(function(t,e){return t&&!!r(e)},!0)}},f=function(r){return function(t){return t.reduce(function(t,e){return t||!!r(e)},!1)}},h=function(e){return function(t){return null!=t&&t.constructor===e||t instanceof e}},p=function(t){return function(){return t}};function v(e,r){return function(t){return t[e].apply(t,r)}}function g(r){return function(t){for(var e=0;e<r.length;e++)if(r[e][0](t))return r[e][1](t)}}function w(e){return function(t){return typeof t===e}}function _(t){return null===t}var S=Object.prototype.toString,b=w("undefined"),E=l(b),C=o(_,b),T=w("function"),P=w("number"),k=w("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 H(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(T)).length)}return T(t)}function I(r,t){return t.reduce(function(t,e){return t[e]=function(t){return function(){throw new Error("No implementation for "+t+". The framework specific code did not implement this method.")}}(r+"."+e+"()"),t},{})}var A=i(O,c(m("then"),T)),D={$q:void 0,$injector:void 0},q=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var n=Array(t),i=0;for(e=0;e<r;e++)for(var o=arguments[e],a=0,u=o.length;a<u;a++,i++)n[i]=o[a];return n},U="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||void 0,F=U.angular||{},N=F.fromJson||JSON.parse.bind(JSON),L=F.toJson||JSON.stringify.bind(JSON),M=F.forEach||function(e,r,t){if(x(e))return e.forEach(r,t);Object.keys(e).forEach(function(t){return r(e[t],t)})},B=Object.assign||Ot,G=F.equals||xt;function z(t){return t}function W(){}function J(e,r,n,t,i){void 0===i&&(i=!1);function o(t){return e()[t].bind(n())}return(t=t||Object.keys(e())).reduce(function(t,e){return t[e]=i?function(t){return function(){return r[t]=o(t),r[t].apply(null,arguments)}}(e):o(e),t},r)}var Q=function(t,e){return B(Object.create(t),e)},K=s(Y);function Y(t,e){return-1!==t.indexOf(e)}var Z=s(X);function X(t,e){var r=t.indexOf(e);return 0<=r&&t.splice(r,1),t}var tt=s(et);function et(t,e){return t.push(e),e}function rt(e){return e.slice().forEach(function(t){"function"==typeof t&&t(),Z(e,t)})}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()));return B(n,at(t||{},Object.keys(n)))}function it(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(r,t){return Object.keys(r).filter(l(K(t))).reduce(function(t,e){return t[e]=r[e],t},{})}function st(t,e){return ht(t,m(e))}function ct(t,r){var e=x(t),n=e?[]:{},i=e?function(t){return n.push(t)}:function(t,e){return n[e]=t};return M(t,function(t,e){r(t,e)&&i(t,e)}),n}function ft(t,r){var n;return M(t,function(t,e){n||r(t,e)&&(n=t)}),n}var lt=ht;function ht(t,r,n){return n=n||(x(t)?[]:{}),M(t,function(t,e){return n[e]=r(t,e)}),n}function pt(e){return Object.keys(e).map(function(t){return e[t]})}function vt(t,e){return t&&e}function dt(t,e){return t||e}var 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}function wt(t,e){return K(t,e)?t:gt(t,e)}function _t(t){return t.reduce(mt,[])}function St(t){return t.reduce(yt,[])}var bt=Rt,$t=Rt;function Rt(r,n){return void 0===n&&(n="assert failure"),function(t){var e=r(t);if(!e)throw new Error(T(n)?n(t):n);return e}}function Et(e){return Object.keys(e).map(function(t){return[t,e[t]]})}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 Tt(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 Pt(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]}),B(e=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=[t,e];if(u(x)(n))return function(t,e){return t.length===e.length&&Ct(t,e).reduce(function(t,e){return t&&xt(e[0],e[1])},!0)}(t,e);if(u(j)(n))return t.getTime()===e.getTime();if(u(V)(n))return t.toString()===e.toString();if(u(T)(n))return!0;if([T,x,j,V].map(f).reduce(function(t,e){return t||!!e(n)},!1))return!1;var i={};for(var o in t){if(!xt(t[o],e[o]))return!1;i[o]=!0}for(var o in e)if(!i[o])return!1;return!0}function jt(t){return t.catch(function(t){return 0})&&t}function Vt(t){return jt(D.$q.reject(t))}var Ht=(It.is=function(t){return!!/[!,*]+/.exec(t)},It.fromString=function(t){return It.is(t)?new It(t):null},It.prototype.matches=function(t){return this.regexp.test("."+t)},It);function It(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+"$")}var At,Dt=(qt.prototype.enqueue=function(t){var e=this._items;return e.push(t),this._limit&&e.length>this._limit&&this.evict(),t},qt.prototype.evict=function(){var e=this._items.shift();return this._evictListeners.forEach(function(t){return t(e)}),e},qt.prototype.dequeue=function(){if(this.size())return this._items.splice(0,1)[0]},qt.prototype.clear=function(){var t=this._items;return this._items=[],t},qt.prototype.size=function(){return this._items.length},qt.prototype.remove=function(t){var e=this._items.indexOf(t);return-1<e&&this._items.splice(e,1)[0]},qt.prototype.peekTail=function(){return this._items[this._items.length-1]},qt.prototype.peekHead=function(){if(this.size())return this._items[0]},qt);function qt(t,e){void 0===t&&(t=[]),void 0===e&&(e=null),this._items=t,this._limit=e,this._evictListeners=[],this.onEvict=tt(this._evictListeners)}(At=d.RejectType||(d.RejectType={}))[At.SUPERSEDED=2]="SUPERSEDED",At[At.ABORTED=3]="ABORTED",At[At.INVALID=4]="INVALID",At[At.IGNORED=5]="IGNORED",At[At.ERROR=6]="ERROR";var Ut=0,Ft=(Nt.isRejectionPromise=function(t){return t&&"function"==typeof t.then&&h(Nt)(t._transitionRejection)},Nt.superseded=function(t,e){var r=new Nt(d.RejectType.SUPERSEDED,"The transition has been superseded by a different transition",t);return e&&e.redirected&&(r.redirected=!0),r},Nt.redirected=function(t){return Nt.superseded(t,{redirected:!0})},Nt.invalid=function(t){return new Nt(d.RejectType.INVALID,"This transition is invalid",t)},Nt.ignored=function(t){return new Nt(d.RejectType.IGNORED,"The transition was ignored",t)},Nt.aborted=function(t){return new Nt(d.RejectType.ABORTED,"The transition has been aborted",t)},Nt.errored=function(t){return new Nt(d.RejectType.ERROR,"The transition errored",t)},Nt.normalize=function(t){return h(Nt)(t)?t:Nt.errored(t)},Nt.prototype.toString=function(){var t,e=(t=this.detail)&&t.toString!==Object.prototype.toString?t.toString():Qt(t);return"Transition Rejection($id: "+this.$id+" type: "+this.type+", message: "+this.message+", detail: "+e+")"},Nt.prototype.toPromise=function(){return B(Vt(this),{_transitionRejection:this})},Nt);function Nt(t,e,r){this.$id=Ut++,this.type=t,this.message=e,this.detail=r}function Lt(t,e){return e.length<=t?e:e.substr(0,t-3)+"..."}function Mt(t,e){for(;e.length<t;)e+=" ";return e}function Bt(t){return t.replace(/^([A-Z])/,function(t){return t.toLowerCase()}).replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}function Gt(t){var e=zt(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 zt(t){var e=x(t)?t.slice(-1)[0]:t;return e&&e.toString()||"undefined"}var Wt=Ft.isRejectionPromise,Jt=g([[b,p("undefined")],[_,p("null")],[A,p("[Promise]")],[Wt,function(t){return t._transitionRejection.toString()}],[function(t){return O(t)&&!x(t)&&t.constructor!==Object&&T(t.toString)},function(t){return t.toString()}],[H,Gt],[p(!0),z]]);function Qt(t){var e=[];function r(t){if(O(t)){if(-1!==e.indexOf(t))return"[circular ref]";e.push(t)}return Jt(t)}return b(t)?r(t):JSON.stringify(t,function(t,e){return r(e)}).replace(/\\"/g,'"')}function Kt(r){return function(t){if(!t)return["",""];var e=t.indexOf(r);return-1===e?[t,""]:[t.substr(0,e),t.substr(e+1)]}}function Yt(t){return t.replace(/\/[^/]*$/,"")}function Zt(t){return t?t.replace(/^#/,""):""}var Xt=new RegExp("^(?:[a-z]+:)?//[^/]+/"),te=Kt("#"),ee=Kt("?"),re=Kt("=");function ne(t){var e=new RegExp("("+t+")","g");return function(t){return t.split(e).filter(z)}}function ie(t,e){return k(Pt(t))&&k(e)?t.slice(0,-1).concat(Pt(t)+e):gt(t,e)}var oe={log:W,error:W,table:W};var ae,ue,se,ce="undefined"!=typeof document&&document.documentMode&&9===document.documentMode?window&&window.console?(se=window.console,{log:fe(se.log),error:fe(se.log),table:fe(se.log)}):oe:console.table&&console.error?console:(ae=console,{log:ue=ae.log.bind(ae),error:ae.error?ae.error.bind(ae):ue,table:ae.table?ae.table.bind(ae):ue});function fe(t){return Function.prototype.bind.call(t,se)}function le(t){if(!t)return"ui-view (defunct)";var e=t.creationContext?t.creationContext.name||"(root)":"(none)";return"[ui-view#"+t.id+" "+t.$type+":"+t.fqn+" ("+t.name+"@"+e+")]"}var he;function pe(t){return P(t)?d.Category[t]:d.Category[d.Category[t]]}(he=d.Category||(d.Category={}))[he.RESOLVE=0]="RESOLVE",he[he.TRANSITION=1]="TRANSITION",he[he.HOOK=2]="HOOK",he[he.UIVIEW=3]="UIVIEW",he[he.VIEWCONFIG=4]="VIEWCONFIG";function ve(t){return"Transition #"+de(t)+"-"+me(t)}var de=R("$id"),me=R("router.$id"),ye=(ge.prototype._set=function(e,t){var r=this;t.length||(t=Object.keys(d.Category).map(function(t){return parseInt(t,10)}).filter(function(t){return!isNaN(t)}).map(function(t){return d.Category[t]})),t.map(pe).forEach(function(t){return r._enabled[t]=e})},ge.prototype.enable=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._set(!0,t)},ge.prototype.disable=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._set(!1,t)},ge.prototype.enabled=function(t){return!!this._enabled[pe(t)]},ge.prototype.traceTransitionStart=function(t){this.enabled(d.Category.TRANSITION)&&ce.log(ve(t)+": Started -> "+Qt(t))},ge.prototype.traceTransitionIgnored=function(t){this.enabled(d.Category.TRANSITION)&&ce.log(ve(t)+": Ignored <> "+Qt(t))},ge.prototype.traceHookInvocation=function(t,e,r){if(this.enabled(d.Category.HOOK)){var n=R("traceData.hookType")(r)||"internal",i=R("traceData.context.state.name")(r)||R("traceData.context")(r)||"unknown",o=Gt(t.registeredHook.callback);ce.log(ve(e)+": Hook -> "+n+" context: "+i+", "+Lt(200,o))}},ge.prototype.traceHookResult=function(t,e,r){this.enabled(d.Category.HOOK)&&ce.log(ve(e)+": <- Hook returned: "+Lt(200,Qt(t)))},ge.prototype.traceResolvePath=function(t,e,r){this.enabled(d.Category.RESOLVE)&&ce.log(ve(r)+": Resolving "+t+" ("+e+")")},ge.prototype.traceResolvableResolved=function(t,e){this.enabled(d.Category.RESOLVE)&&ce.log(ve(e)+": <- Resolved "+t+" to: "+Lt(200,Qt(t.data)))},ge.prototype.traceError=function(t,e){this.enabled(d.Category.TRANSITION)&&ce.log(ve(e)+": <- Rejected "+Qt(e)+", reason: "+t)},ge.prototype.traceSuccess=function(t,e){this.enabled(d.Category.TRANSITION)&&ce.log(ve(e)+": <- Success "+Qt(e)+", final state: "+t.name)},ge.prototype.traceUIViewEvent=function(t,e,r){void 0===r&&(r=""),this.enabled(d.Category.UIVIEW)&&ce.log("ui-view: "+Mt(30,t)+" "+le(e)+r)},ge.prototype.traceUIViewConfigUpdated=function(t,e){this.enabled(d.Category.UIVIEW)&&this.traceUIViewEvent("Updating",t," with ViewConfig from context='"+e+"'")},ge.prototype.traceUIViewFill=function(t,e){this.enabled(d.Category.UIVIEW)&&this.traceUIViewEvent("Fill",t," with: "+Lt(200,e))},ge.prototype.traceViewSync=function(t){if(this.enabled(d.Category.VIEWCONFIG)){var a="uiview component fqn",e=t.map(function(t){var e,r=t.uiView,n=t.viewConfig,i=r&&r.fqn,o=n&&n.viewDecl.$context.name+": ("+n.viewDecl.$name+")";return(e={})[a]=i,e["view config state (view name)"]=o,e}).sort(function(t,e){return(t[a]||"").localeCompare(e[a]||"")});ce.table(e)}},ge.prototype.traceViewServiceEvent=function(t,e){this.enabled(d.Category.VIEWCONFIG)&&ce.log("VIEWCONFIG: "+t+" "+function(t){var e=t.viewDecl,r=e.$context.name||"(root)";return"[View#"+t.$id+" from '"+r+"' state]: target ui-view: '"+e.$uiViewName+"@"+e.$uiViewContextAnchor+"'"}(e))},ge.prototype.traceViewServiceUIViewEvent=function(t,e){this.enabled(d.Category.VIEWCONFIG)&&ce.log("VIEWCONFIG: "+t+" "+le(e))},ge);function ge(){this._enabled={},this.approximateDigests=0}var we=new ye,_e=(Se.prototype.is=function(t,e){return!0},Se.prototype.encode=function(t,e){return t},Se.prototype.decode=function(t,e){return t},Se.prototype.equals=function(t,e){return t==e},Se.prototype.$subPattern=function(){var t=this.pattern.toString();return t.substr(1,t.length-2)},Se.prototype.toString=function(){return"{ParamType:"+this.name+"}"},Se.prototype.$normalize=function(t){return this.is(t)?t:this.decode(t)},Se.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 be(this,t)},Se);function Se(t){this.pattern=/.*/,this.inherit=!0,B(this,t)}function be(n,i){var o=this;function a(t){return x(t)?t:E(t)?[t]:[]}function u(r,n){return function(t){if(x(t)&&0===t.length)return t;var e=ht(a(t),r);return!0===n?0===ct(e,function(t){return!t}).length:function(t){switch(t.length){case 0:return;case 1:return"auto"===i?t[0]:t;default:return t}}(e)}}function s(o){return function(t,e){var r=a(t),n=a(e);if(r.length!==n.length)return!1;for(var i=0;i<r.length;i++)if(!o(r[i],n[i]))return!1;return!0}}["encode","decode","equals","$normalize"].forEach(function(t){var e=n[t].bind(n),r="equals"===t?s:u;o[t]=r(e)}),B(this,{dynamic:n.dynamic,name:n.name,pattern:n.pattern,inherit:n.inherit,raw:n.raw,is:u(n.is.bind(n),!0),$arrayMode:i})}var $e,Re=Object.prototype.hasOwnProperty,Ee=function(t){return 0===["value","type","squash","array","dynamic"].filter(Re.bind(t||{})).length};function Ce(t,e,r){var n=!1===r.reloadOnSearch&&e===d.DefType.SEARCH||void 0,i=ft([r.dynamic,n],E),o=E(i)?{dynamic:i}:{},a=function(t){function e(){return t.value}t=Ee(t)?{value:t}:t,e.__cacheable=!0;var r=H(t.value)?t.value:e;return B(t,{$$fn:r})}(r&&r.params&&r.params[t]);return B(o,a)}($e=d.DefType||(d.DefType={}))[$e.PATH=0]="PATH",$e[$e.SEARCH=1]="SEARCH",$e[$e.CONFIG=2]="CONFIG";var Te=(Pe.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},Pe.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])})},Pe.equals=function(t,e,r){return void 0===e&&(e={}),void 0===r&&(r={}),0===Pe.changed(t,e,r).length},Pe.validates=function(t,e){return void 0===e&&(e={}),t.map(function(t){return t.validates(e[t.id])}).reduce(vt,!0)},Pe.prototype.isDefaultValue=function(t){return this.isOptional&&this.type.equals(this.value(),t)},Pe.prototype.value=function(t){var i=this;return t=function(t){for(var e=0,r=i.replace;e<r.length;e++){var n=r[e];if(n.from===t)return n.to}return t}(t),b(t)?function(){if(i._defaultValueCache)return i._defaultValueCache.defaultValue;if(!D.$injector)throw new Error("Injectable functions cannot be called at configuration time");var t=D.$injector.invoke(i.config.$$fn);if(null!=t&&!i.type.is(t))throw new Error("Default value ("+t+") for parameter '"+i.id+"' is not an instance of ParamType ("+i.type.name+")");return i.config.$$fn.__cacheable&&(i._defaultValueCache={defaultValue:t}),t}():this.type.$normalize(t)},Pe.prototype.isSearch=function(){return this.location===d.DefType.SEARCH},Pe.prototype.validates=function(t){if((b(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))},Pe.prototype.toString=function(){return"{Param:"+this.id+" "+this.type+" squash: '"+this.squash+"' optional: "+this.isOptional+"}"},Pe);function Pe(t,e,r,n,i){var o=Ce(t,r,i);e=function(t,e,r,n,i){if(t.type&&e&&"string"!==e.name)throw new Error("Param '"+n+"' has two type configurations.");if(t.type&&e&&"string"===e.name&&i.type(t.type))return i.type(t.type);if(e)return e;if(t.type)return t.type instanceof _e?t.type:i.type(t.type);var o=r===d.DefType.CONFIG?"any":r===d.DefType.PATH?"path":r===d.DefType.SEARCH?"query":"string";return i.type(o)}(o,e,r,t,n.paramTypes);var a,u,s=(a={array:r===d.DefType.SEARCH&&"auto"},u=t.match(/\[\]$/)?{array:!0}:{},B(a,u,o).array);e=s?e.$asArray(s,r===d.DefType.SEARCH):e;var c=void 0!==o.value||r===d.DefType.SEARCH,f=E(o.dynamic)?!!o.dynamic:!!e.dynamic,l=E(o.raw)?!!o.raw:!!e.raw,h=function(t,e,r){var n=t.squash;if(!e||!1===n)return!1;if(!E(n)||null==n)return r;if(!0===n||k(n))return n;throw new Error("Invalid squash policy: '"+n+"'. Valid policies: false, true, or arbitrary string")}(o,c,n.defaultSquashPolicy()),p=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,m("from"));return ct(i,function(t){return-1===a.indexOf(t.from)}).concat(o)}(o,s,c,h),v=E(o.inherit)?!!o.inherit:!!e.inherit;B(this,{id:t,type:e,location:r,isOptional:c,dynamic:f,raw:l,squash:h,replace:p,inherit:v,array:s,config:o})}var ke=(Oe.prototype.dispose=function(){this.types={}},Oe.prototype.type=function(t,e,r){if(!E(e))return this.types[t];if(this.types.hasOwnProperty(t))throw new Error("A type named '"+t+"' has already been defined.");return this.types[t]=new _e(B({name:t},e)),r&&(this.typeQueue.push({name:t,def:r}),this.enqueue||this._flushTypeQueue()),this},Oe.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))}},Oe);function Oe(){this.enqueue=!0,this.typeQueue=[],this.defaultTypes=at(Oe.prototype,["hash","string","query","path","int","bool","date","json","any"]);this.types=Q(ht(this.defaultTypes,function(t,e){return new _e(B({name:e},t))}),{})}function xe(t){function e(t){return null!=t?t.toString():t}var r={encode:e,decode:e,is:h(String),pattern:/.*/,equals:function(t,e){return t==e}};return B({},r,t)}B(ke.prototype,{string:xe({}),path:xe({pattern:/[^/]*/}),query:xe({}),hash:xe({inherit:!1}),int:xe({decode:function(t){return parseInt(t,10)},is:function(t){return!C(t)&&this.decode(t.toString())===t},pattern:/-?\d+/}),bool:xe({encode:function(t){return t?1:0},decode:function(t){return 0!==parseInt(t,10)},is:h(Boolean),pattern:/0|1/}),date:xe({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(r,n){return["getFullYear","getMonth","getDate"].reduce(function(t,e){return t&&r[e]()===n[e]()},!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:xe({encode:L,decode:N,is:h(Object),equals:G,pattern:/[^/]*/}),any:xe({encode:z,decode:z,is:function(){return!0},equals:G})});var je=(Ve.prototype.$inherit=function(t,e,r){var n,i=ot(e,r),o={},a=[];for(var u in i)if(i[u]&&i[u].params&&(n=Object.keys(i[u].params)).length)for(var s in n)0<=a.indexOf(n[s])||(a.push(n[s]),o[n[s]]=this[n[s]]);return B({},o,t)},Ve);function Ve(t){void 0===t&&(t={}),B(this,t)}var He=(Ie.prototype.clone=function(){return new Ie(this)},Ie.prototype.applyRawParams=function(r){return this.paramValues=this.paramSchema.reduce(function(t,e){return Tt(t,function(t){return[t.id,t.value(r[t.id])]}(e))},{}),this},Ie.prototype.parameter=function(t){return ft(this.paramSchema,y("id",t))},Ie.prototype.equals=function(t,e){var r=this.diff(t,e);return r&&0===r.length},Ie.prototype.diff=function(t,e){if(this.state!==t.state)return!1;var r=e?e(this):this.paramSchema;return Te.changed(r,this.paramValues,t.paramValues)},Ie.clone=function(t){return t.clone()},Ie);function Ie(t){if(t instanceof Ie){var e=t;this.state=e.state,this.paramSchema=e.paramSchema.slice(),this.paramValues=B({},e.paramValues),this.resolvables=e.resolvables.slice(),this.views=e.views&&e.views.slice()}else{var r=t;this.state=r,this.paramSchema=r.parameters({inherit:!1}),this.paramValues={},this.resolvables=r.resolvables.map(function(t){return t.clone()})}}var Ae=(De.prototype.name=function(){return this._definition&&this._definition.name||this._identifier},De.prototype.identifier=function(){return this._identifier},De.prototype.params=function(){return this._params},De.prototype.$state=function(){return this._definition},De.prototype.state=function(){return this._definition&&this._definition.self},De.prototype.options=function(){return this._options},De.prototype.exists=function(){return!(!this._definition||!this._definition.self)},De.prototype.valid=function(){return!this.error()},De.prototype.error=function(){var t=this.options().relative;if(this._definition||!t)return this._definition?this._definition.self?void 0:"State '"+this.name()+"' has an invalid definition":"No such state '"+this.name()+"'";var e=t.name?t.name:t;return"Could not resolve '"+this.name()+"' from state '"+e+"'"},De.prototype.toString=function(){return"'"+this.name()+"'"+Qt(this.params())},De.prototype.withState=function(t){return new De(this._stateRegistry,t,this._params,this._options)},De.prototype.withParams=function(t,e){void 0===e&&(e=!1);var r=e?t:B({},this._params,t);return new De(this._stateRegistry,this._identifier,r,this._options)},De.prototype.withOptions=function(t,e){void 0===e&&(e=!1);var r=e?t:B({},this._options,t);return new De(this._stateRegistry,this._identifier,this._params,r)},De.isDef=function(t){return t&&t.state&&(k(t.state)||k(t.state.name))},De);function De(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)}var qe=(Ue.makeTargetState=function(t,e){var r=Pt(e).state;return new Ae(t,r,e.map(m("paramValues")).reduce(it,{}),{})},Ue.buildPath=function(t){var e=t.params();return t.$state().path.map(function(t){return new He(t).applyRawParams(e)})},Ue.buildToPath=function(t,e){var r=Ue.buildPath(e);return e.options().inherit?Ue.inheritParams(t,r,Object.keys(e.params())):r},Ue.applyViewConfigs=function(i,o,e){o.filter(function(t){return K(e,t.state)}).forEach(function(e){var t=pt(e.state.views||{}),r=Ue.subPath(o,function(t){return t===e}),n=t.map(function(t){return i.createViewConfig(r,t)});e.views=n.reduce(mt,[])})},Ue.inheritParams=function(o,t,a){void 0===a&&(a=[]);var u=o.map(function(t){return t.paramSchema}).reduce(mt,[]).filter(function(t){return!t.inherit}).map(m("id"));return t.map(function(t){var e=B({},t&&t.paramValues),r=at(e,a);e=ut(e,a);var n=ut(function(t,e){var r=ft(t,y("state",e));return B({},r&&r.paramValues)}(o,t.state)||{},u),i=B(e,n,r);return new He(t.state).applyRawParams(i)})},Ue.treeChanges=function(t,n,e){for(var r,i,o,a,u,s,c=Math.min(t.length,n.length),f=0;f<c&&t[f].state!==e&&(r=t[f],i=n[f],r.equals(i,Ue.nonDynamicParams));)f++;a=(o=t).slice(0,f),u=o.slice(f);var l=a.map(function(t,e){var r=t.clone();return r.paramValues=n[e].paramValues,r});return s=n.slice(f),{from:o,to:l.concat(s),retained:a,retainedWithToParams:l,exiting:u,entering:s}},Ue.matching=function(t,e,i){var o=!1;return Ct(t,e).reduce(function(t,e){var r=e[0],n=e[1];return(o=o||!r.equals(n,i))?t:t.concat(r)},[])},Ue.equals=function(t,e,r){return t.length===e.length&&Ue.matching(t,e,r).length===t.length},Ue.subPath=function(t,e){var r=ft(t,e),n=t.indexOf(r);return-1===n?void 0:t.slice(0,n+1)},Ue.nonDynamicParams=function(t){return t.state.parameters({inherit:!1}).filter(function(t){return!t.dynamic})},Ue.paramValues=function(t){return t.reduce(function(t,e){return B(t,e.paramValues)},{})},Ue);function Ue(){}var Fe={when:{LAZY:"LAZY",EAGER:"EAGER"},async:{WAIT:"WAIT",NOWAIT:"NOWAIT"}},Ne={when:"LAZY",async:"WAIT"},Le=(Me.prototype.getPolicy=function(t){var e=this.policy||{},r=t&&t.resolvePolicy||{};return{when:e.when||r.when||Ne.when,async:e.async||r.async||Ne.async}},Me.prototype.resolve=function(e,r){var n=this,t=D.$q,i=e.findNode(this),o=i&&i.state,a=this.getPolicy(o).async,u=T(a)?a:z;return this.promise=t.when().then(function(){return t.all(e.getDependencies(n).map(function(t){return t.get(e,r)}))}).then(function(t){return n.resolveFn.apply(null,t)}).then(u).then(function(t){return n.data=t,n.resolved=!0,n.resolveFn=null,we.traceResolvableResolved(n,r),n.data})},Me.prototype.get=function(t,e){return this.promise||this.resolve(t,e)},Me.prototype.toString=function(){return"Resolvable(token: "+Qt(this.token)+", requires: ["+this.deps.map(Qt)+"])"},Me.prototype.clone=function(){return new Me(this)},Me.fromData=function(t,e){return new Me(t,function(){return e},null,null,e)},Me);function Me(t,e,r,n,i){if(this.resolved=!1,this.promise=void 0,t instanceof Me)B(this,t);else if(T(e)){if(C(t))throw new Error("new Resolvable(): token argument is required");if(!T(e))throw new Error("new Resolvable(): resolveFn argument must be a function");this.token=t,this.policy=n,this.resolveFn=e,this.deps=r||[],this.data=i,this.resolved=void 0!==i,this.promise=this.resolved?D.$q.when(this.data):void 0}else if(O(t)&&t.token&&(t.hasOwnProperty("resolveFn")||t.hasOwnProperty("data"))){var o=t;return new Me(o.token,o.resolveFn,o.deps,o.policy,o.data)}}var Be=Fe.when,Ge=[Be.EAGER,Be.LAZY],ze=[Be.EAGER],We="Native Injector",Je=(Qe.prototype.getTokens=function(){return this._path.reduce(function(t,e){return t.concat(e.resolvables.map(function(t){return t.token}))},[]).reduce(wt,[])},Qe.prototype.getResolvable=function(e){return Pt(this._path.map(function(t){return t.resolvables}).reduce(mt,[]).filter(function(t){return t.token===e}))},Qe.prototype.getPolicy=function(t){var e=this.findNode(t);return t.getPolicy(e.state)},Qe.prototype.subContext=function(e){return new Qe(qe.subPath(this._path,function(t){return t.state===e}))},Qe.prototype.addResolvables=function(t,e){var r=ft(this._path,y("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)},Qe.prototype.resolvePath=function(t,u){var s=this;void 0===t&&(t="LAZY");var c=(K(Ge,t)?t:"LAZY")===Fe.when.EAGER?ze:Ge;function f(e,r){return function(t){return K(e,s.getPolicy(t)[r])}}we.traceResolvePath(this._path,t,u);var e=this._path.reduce(function(t,e){function r(e){return e.get(a,u).then(function(t){return{token:e.token,value:t}})}var n=e.resolvables.filter(f(c,"when")),i=n.filter(f(["NOWAIT"],"async")),o=n.filter(l(f(["NOWAIT"],"async"))),a=s.subContext(e.state);return i.forEach(r),t.concat(o.map(r))},[]);return D.$q.all(e)},Qe.prototype.injector=function(){return this._injector||(this._injector=new Ke(this))},Qe.prototype.findNode=function(e){return ft(this._path,function(t){return K(t.resolvables,e)})},Qe.prototype.getDependencies=function(e){var n=this,r=this.findNode(e),i=(qe.subPath(this._path,function(t){return t===r})||this._path).reduce(function(t,e){return t.concat(e.resolvables)},[]).filter(function(t){return t!==e});return e.deps.map(function(e){var t=i.filter(function(t){return t.token===e});if(t.length)return Pt(t);var r=n.injector().getNative(e);if(b(r))throw new Error("Could not find Dependency Injection token: "+Qt(e));return new Le(e,function(){return r},[],r)})},Qe);function Qe(t){this._path=t}var Ke=(Ye.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:"+Qt(e.token));return e.data}return this.getNative(t)},Ye.prototype.getAsync=function(t){var e=this.context.getResolvable(t);return e?e.get(this.context):D.$q.when(this.native.get(t))},Ye.prototype.getNative=function(t){return this.native&&this.native.get(t)},Ye);function Ye(t){this.context=t,this.native=this.get(We)||D.$injector}function Ze(t){return t.name}function Xe(t){return t.self.$$state=function(){return t},t.self}function tr(t){return t.parent&&t.parent.data&&(t.data=t.self.data=Q(t.parent.data,t.data)),t.data}function er(a,u){return function(t){var e=t.self;if(e&&e.url&&e.name&&e.name.match(/\.\*\*$/)){var r={};kt(e,r),r.url+="{remainder:any}",e=r}var n=t.parent,i=function(t){if(!k(t))return!1;var e="^"===t.charAt(0);return{val:e?t.substring(1):t,root:e}}(e.url),o=i?a.compile(i.val,{state:e}):e.url;if(!o)return null;if(!a.isMatcher(o))throw new Error("Invalid url '"+o+"' in state '"+t+"'");return i&&i.root?o:(n&&n.navigable||u()).url.append(o)}}function rr(t){return t.parent?t.parent.path.concat(t):[t]}function nr(t){var e=t.parent?B({},t.parent.includes):{};return e[t.name]=!0,e}function ir(t){function e(t){return t.provide||t.token}var r,n,i=g([[m("resolveFn"),function(t){return new Le(e(t),t.resolveFn,t.deps,t.policy)}],[m("useFactory"),function(t){return new Le(e(t),t.useFactory,t.deps||t.dependencies,t.policy)}],[m("useClass"),function(t){return new Le(e(t),function(){return new t.useClass},[],t.policy)}],[m("useValue"),function(t){return new Le(e(t),function(){return t.useValue},[],t.policy,t.useValue)}],[m("useExisting"),function(t){return new Le(e(t),z,[t.useExisting],t.policy)}]]),o=g([[c(m("val"),k),function(t){return new Le(t.token,z,[t.val],t.policy)}],[c(m("val"),x),function(t){return new Le(t.token,Pt(t.val),t.val.slice(0,-1),t.policy)}],[c(m("val"),T),function(t){return new Le(t.token,t.val,function(t){var e=D.$injector;return t.$inject||e&&e.annotate(t,e.strictDi)||"deferred"}(t.val),t.policy)}]]),a=g([[h(Le),function(t){return t}],[function(t){return!(!t.token||!t.resolveFn)},i],[function(t){return!(!t.provide&&!t.token||!(t.useValue||t.useFactory||t.useExisting||t.useClass))},i],[function(t){return!!(t&&t.val&&(k(t.val)||x(t.val)||T(t.val)))},o],[p(!0),function(t){throw new Error("Invalid resolve value: "+Qt(t))}]]),u=t.resolve;return(x(u)?u:(r=u,n=t.resolvePolicy||{},Object.keys(r||{}).map(function(t){return{token:t,val:r[t],deps:void 0,policy:n[t]}}))).map(a)}var or=(ar.prototype.builder=function(t,e){var r=this.builders,n=r[t]||[];return k(t)&&!E(e)?1<n.length?n:n[0]:k(t)&&T(e)?(r[t]=n,r[t].push(e),function(){return r[t].splice(r[t].indexOf(e,1))&&null}):void 0},ar.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(e,r){return function(t){return r(t,e)}},W);t[i]=o(t)}return t},ar.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 ("+e+")");return r.join(".")}return t.parent?k(t.parent)?t.parent:t.parent.name:""},ar.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},ar);function ar(e,t){this.matcher=e;function r(){return e.find("")}function n(t){return""===t.name}var i=this;this.builders={name:[Ze],self:[Xe],parent:[function(t){return n(t)?null:e.find(i.parentName(t))||r()}],data:[tr],url:[er(t,r)],navigable:[function(e){return function(t){return!e(t)&&t.url?t:t.parent?t.parent.navigable:null}}(n)],params:[function(n){return function(r){var t=r.url&&r.url.parameters({inherit:!1})||[],e=pt(lt(ut(r.params||{},t.map(m("id"))),function(t,e){return n.fromConfig(e,null,r.self)}));return t.concat(e).map(function(t){return[t.id,t]}).reduce(Tt,{})}}(t.paramFactory)],views:[],path:[rr],includes:[nr],resolvables:[ir]}}var ur=(sr.create=function(t){t=sr.isStateClass(t)?new t:t;var e=Q(Q(t,sr.prototype));return t.$$state=function(){return e},e.self=t,e.__stateObjectCache={nameGlob:Ht.fromString(e.name)},e},sr.prototype.is=function(t){return this===t||this.self===t||this.fqn()===t},sr.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},sr.prototype.root=function(){return this.parent&&this.parent.root()||this},sr.prototype.parameters=function(e){return((e=nt(e,{inherit:!0,matchingKeys:null})).inherit&&this.parent&&this.parent.parameters()||[]).concat(pt(this.params)).filter(function(t){return!e.matchingKeys||e.matchingKeys.hasOwnProperty(t.id)})},sr.prototype.parameter=function(t,e){return void 0===e&&(e={}),this.url&&this.url.parameter(t,e)||ft(pt(this.params),y("id",t))||e.inherit&&this.parent&&this.parent.parameter(t)},sr.prototype.toString=function(){return this.fqn()},sr.isStateClass=function(t){return T(t)&&!0===t.__uiRouterState},sr.isState=function(t){return O(t.__stateObjectCache)},sr);function sr(t){return sr.create(t||{})}var cr=(fr.prototype.isRelative=function(t){return 0===(t=t||"").indexOf(".")||0===t.indexOf("^")},fr.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 1<a.length&&ce.error("stateMatcher.find: Found multiple matches for "+i+" using glob: ",a.map(function(t){return t.name})),a[0]}}},fr.prototype.resolvePath=function(t,e){if(!e)throw new Error("No reference point given for path '"+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 '"+t+"' not valid for state '"+r.name+"'");a=a.parent}else a=r;var u=n.slice(o).join(".");return a.name+(a.name&&u?".":"")+u},fr);function fr(t){this._states=t}var lr=(hr.prototype.dispose=function(){this.queue=[]},hr.prototype.register=function(t){var e=this.queue,r=ur.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(m("name")),n))throw new Error("State '"+n+"' is already defined");return e.push(r),this.flush(),r},hr.prototype.flush=function(){for(var e=this,t=this.queue,r=this.states,n=this.builder,i=[],o=[],a={},u=function(t){return e.states.hasOwnProperty(t)&&e.states[t]},s=function(){i.length&&e.listeners.forEach(function(t){return t("registered",i.map(function(t){return t.self}))})};0<t.length;){var c=t.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 '"+f+"' is already defined");var v=u(f+".**");v&&this.router.stateRegistry.deregister(v),r[f]=c,this.attachRoute(c),0<=h&&o.splice(h,1),i.push(c)}else{var d=a[f];if(a[f]=t.length,0<=h&&d===t.length)return t.push(c),s(),r;h<0&&o.push(c),t.push(c)}}return s(),r},hr.prototype.attachRoute=function(t){if(!t.abstract&&t.url){var e=this.router.urlService.rules;e.rule(e.urlRuleFactory.create(t))}},hr);function hr(t,e,r,n){this.router=t,this.states=e,this.builder=r,this.listeners=n,this.queue=[]}var pr,vr,dr=(mr.prototype._registerRoot=function(){(this._root=this.stateQueue.register({name:"",url:"^",views:null,params:{"#":{value:null,type:"hash",dynamic:!0}},abstract:!0})).navigable=null},mr.prototype.dispose=function(){var e=this;this.stateQueue.dispose(),this.listeners=[],this.get().forEach(function(t){return e.get(t)&&e.deregister(t)})},mr.prototype.onStatesChanged=function(t){return this.listeners.push(t),function(){Z(this.listeners)(t)}.bind(this)},mr.prototype.root=function(){return this._root},mr.prototype.register=function(t){return this.stateQueue.register(t)},mr.prototype._deregisterTree=function(t){var r=this,n=this.get().map(function(t){return t.$$state()}),i=function(e){var t=n.filter(function(t){return-1!==e.indexOf(t.parent)});return 0===t.length?t:t.concat(i(t))},e=i([t]),o=[t].concat(e).reverse();return o.forEach(function(t){var e=r.router.urlService.rules;e.rules().filter(y("state",t)).forEach(function(t){return e.removeRule(t)}),delete r.states[t.name]}),o},mr.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},mr.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},mr.prototype.decorator=function(t,e){return this.builder.builder(t,e)},mr);function mr(t){this.router=t,this.states={},this.listeners=[],this.matcher=new cr(this.states),this.builder=new or(this.matcher,t.urlMatcherFactory),this.stateQueue=new lr(t,this.states,this.builder,this.listeners),this._registerRoot()}(pr=d.TransitionHookPhase||(d.TransitionHookPhase={}))[pr.CREATE=0]="CREATE",pr[pr.BEFORE=1]="BEFORE",pr[pr.RUN=2]="RUN",pr[pr.SUCCESS=3]="SUCCESS",pr[pr.ERROR=4]="ERROR",(vr=d.TransitionHookScope||(d.TransitionHookScope={}))[vr.TRANSITION=0]="TRANSITION",vr[vr.STATE=1]="STATE";var yr={current:W,transition:null,traceData:{},bind:null},gr=(wr.chain=function(t,e){return t.reduce(function(t,e){return t.then(function(){return e.invokeHook()})},e||D.$q.when())},wr.invokeHooks=function(t,e){for(var r=0;r<t.length;r++){var n=t[r].invokeHook();if(A(n)){var i=t.slice(r+1);return wr.chain(i,n).then(e)}}return e()},wr.runAllHooks=function(t){t.forEach(function(t){return t.invokeHook()})},wr.prototype.logError=function(t){this.transition.router.stateService.defaultErrorHandler()(t)},wr.prototype.invokeHook=function(){var e=this,r=this.registeredHook;if(!r._deregistered){var t=this.getNotCurrentRejection();if(t)return t;var n=this.options;we.traceHookInvocation(this,this.transition,n);var i=function(t){return r.eventType.getErrorHandler(e)(t)},o=function(t){return r.eventType.getResultHandler(e)(t)};try{var a=r.callback.call(n.bind,e.transition,e.stateContext);return!this.type.synchronous&&A(a)?a.catch(function(t){return Ft.normalize(t).toPromise()}).then(o,i):o(a)}catch(t){return i(Ft.normalize(t))}finally{r.invokeLimit&&++r.invokeCount>=r.invokeLimit&&r.deregister()}}},wr.prototype.handleHookResult=function(t){var e=this,r=this.getNotCurrentRejection();return r||(A(t)?t.then(function(t){return e.handleHookResult(t)}):(we.traceHookResult(t,this.transition,this.options),!1===t?Ft.aborted("Hook aborted transition").toPromise():h(Ae)(t)?Ft.redirected(t).toPromise():void 0))},wr.prototype.getNotCurrentRejection=function(){var t=this.transition.router;return t._disposed?Ft.aborted("UIRouter instance #"+t.$id+" has been stopped (disposed)").toPromise():this.transition._aborted?Ft.aborted().toPromise():this.isSuperseded()?Ft.superseded(this.options.current()).toPromise():void 0},wr.prototype.toString=function(){var t=this.options,e=this.registeredHook;return(R("traceData.hookType")(t)||"internal")+" context: "+(R("traceData.context.state.name")(t)||R("traceData.context")(t)||"unknown")+", "+Lt(200,zt(e.callback))},wr.HANDLE_RESULT=function(e){return function(t){return e.handleHookResult(t)}},wr.LOG_REJECTED_RESULT=function(e){return function(t){A(t)&&t.catch(function(t){return e.logError(Ft.normalize(t))})}},wr.LOG_ERROR=function(e){return function(t){return e.logError(t)}},wr.REJECT_ERROR=function(t){return function(t){return Vt(t)}},wr.THROW_ERROR=function(t){return function(t){throw t}},wr);function wr(t,e,r,n){var i=this;this.transition=t,this.stateContext=e,this.registeredHook=r,this.options=n,this.isSuperseded=function(){return i.type.hookPhase===d.TransitionHookPhase.RUN&&!i.options.transition.isActive()},this.options=nt(n,yr),this.type=r.eventType}function _r(t,e,r){var i=k(e)?[e]:e;return!!(T(i)?i:function(t){for(var e=i,r=0;r<e.length;r++){var n=new Ht(e[r]);if(n&&n.matches(t.name)||!n&&e[r]===t.name)return!0}return!1})(t,r)}var Sr=(br.prototype._matchingNodes=function(t,e,r){if(!0===e)return t;var n=t.filter(function(t){return _r(t.state,e,r)});return n.length?n:null},br.prototype._getDefaultMatchCriteria=function(){return lt(this.tranSvc._pluginapi._getPathTypes(),function(){return!0})},br.prototype._getMatchingNodes=function(o,a){var u=this,s=B(this._getDefaultMatchCriteria(),this.matchCriteria);return pt(this.tranSvc._pluginapi._getPathTypes()).reduce(function(t,e){var r=e.scope===d.TransitionHookScope.STATE,n=o[e.name]||[],i=r?n:[Pt(n)];return t[e.name]=u._matchingNodes(i,s[e.name],a),t},{})},br.prototype.matches=function(t,e){var r=this._getMatchingNodes(t,e);return pt(r).every(z)?r:null},br.prototype.deregister=function(){this.removeHookFromRegistry(this),this._deregistered=!0},br);function br(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}function $r(t,i,o){var a=(t._registeredHooks=t._registeredHooks||{})[o.name]=[],u=Z(a);function e(t,e,r){void 0===r&&(r={});var n=new Sr(i,o,e,t,u,r);return a.push(n),n.deregister.bind(n)}return t[o.name]=e}var Rr=(Er.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)},Er.prototype.buildHooks=function(o){var a=this.transition,t=a.treeChanges(),e=this.getMatchingHooks(o,t,a);if(!e)return[];var u={transition:a,current:a.options().current};return e.map(function(i){return i.matches(t,a)[o.criteriaMatchPath.name].map(function(t){var e=B({bind:i.bind,traceData:{hookType:o.name,context:t}},u),r=o.criteriaMatchPath.scope===d.TransitionHookScope.STATE?t.state.self:null,n=new gr(a,r,i,e);return{hook:i,node:t,transitionHook:n}})}).reduce(mt,[]).sort(function(i){return void 0===i&&(i=!1),function(t,e){var r=i?-1:1,n=(t.node.state.path.length-e.node.state.path.length)*r;return 0!=n?n:e.hook.priority-t.hook.priority}}(o.reverseSort)).map(function(t){return t.transitionHook})},Er.prototype.getMatchingHooks=function(e,r,n){var t=e.hookPhase===d.TransitionHookPhase.CREATE,i=this.transition.router.transitionService;return(t?[i]:[this.transition,i]).map(function(t){return t.getHooks(e.name)}).filter(bt(x,"broken event named: "+e.name)).reduce(mt,[]).filter(function(t){return t.matches(r,n)})},Er);function Er(t){this.transition=t}var Cr=m("self"),Tr=(Pr.prototype.onBefore=function(t,e,r){},Pr.prototype.onStart=function(t,e,r){},Pr.prototype.onExit=function(t,e,r){},Pr.prototype.onRetain=function(t,e,r){},Pr.prototype.onEnter=function(t,e,r){},Pr.prototype.onFinish=function(t,e,r){},Pr.prototype.onSuccess=function(t,e,r){},Pr.prototype.onError=function(t,e,r){},Pr.prototype.createTransitionHookRegFns=function(){var e=this;this.router.transitionService._pluginapi._getEvents().filter(function(t){return t.hookPhase!==d.TransitionHookPhase.CREATE}).forEach(function(t){return $r(e,e.router.transitionService,t)})},Pr.prototype.getHooks=function(t){return this._registeredHooks[t]},Pr.prototype.applyViewConfigs=function(t){var e=this._treeChanges.entering.map(function(t){return t.state});qe.applyViewConfigs(t.transitionService.$view,this._treeChanges.to,e)},Pr.prototype.$from=function(){return Pt(this._treeChanges.from).state},Pr.prototype.$to=function(){return Pt(this._treeChanges.to).state},Pr.prototype.from=function(){return this.$from().self},Pr.prototype.to=function(){return this.$to().self},Pr.prototype.targetState=function(){return this._targetState},Pr.prototype.is=function(t){return t instanceof Pr?this.is({to:t.$to().name,from:t.$from().name}):!(t.to&&!_r(this.$to(),t.to,this)||t.from&&!_r(this.$from(),t.from,this))},Pr.prototype.params=function(t){return void 0===t&&(t="to"),Object.freeze(this._treeChanges[t].map(m("paramValues")).reduce(it,{}))},Pr.prototype.paramsChanged=function(){var t=this.params("from"),r=this.params("to"),e=[].concat(this._treeChanges.to).concat(this._treeChanges.from).map(function(t){return t.paramSchema}).reduce(yt,[]).reduce(wt,[]);return Te.changed(e,t,r).reduce(function(t,e){return t[e.id]=r[e.id],t},{})},Pr.prototype.injector=function(e,t){void 0===t&&(t="to");var r=this._treeChanges[t];return e&&(r=qe.subPath(r,function(t){return t.state===e||t.state.name===e})),new Je(r).injector()},Pr.prototype.getResolveTokens=function(t){return void 0===t&&(t="to"),new Je(this._treeChanges[t]).getTokens()},Pr.prototype.addResolvable=function(t,e){void 0===e&&(e=""),t=h(Le)(t)?t:new Le(t);var r="string"==typeof e?e:e.name,n=this._treeChanges.to,i=ft(n,function(t){return t.state.name===r});new Je(n).addResolvables([t],i.state)},Pr.prototype.redirectedFrom=function(){return this._options.redirectedFrom||null},Pr.prototype.originalTransition=function(){var t=this.redirectedFrom();return t&&t.originalTransition()||this},Pr.prototype.options=function(){return this._options},Pr.prototype.entering=function(){return ht(this._treeChanges.entering,m("state")).map(Cr)},Pr.prototype.exiting=function(){return ht(this._treeChanges.exiting,m("state")).map(Cr).reverse()},Pr.prototype.retained=function(){return ht(this._treeChanges.retained,m("state")).map(Cr)},Pr.prototype.views=function(t,e){void 0===t&&(t="entering");var r=this._treeChanges[t];return(r=e?r.filter(y("state",e)):r).map(m("views")).filter(z).reduce(mt,[])},Pr.prototype.treeChanges=function(t){return t?this._treeChanges[t]:this._treeChanges},Pr.prototype.redirect=function(t){for(var e=1,r=this;null!=(r=r.redirectedFrom());)if(20<++e)throw new Error("Too many consecutive Transition redirects (20+)");var n={redirectedFrom:this,source:"redirect"};"url"===this.options().source&&!1!==t.options().location&&(n.location="replace");var i=B({},this.options(),t.options(),n);t=t.withOptions(i,!0);var o,a=this.router.transitionService.create(this._treeChanges.from,t),u=this._treeChanges.entering,s=a._treeChanges.entering;return qe.matching(s,u,qe.nonDynamicParams).filter(l((o=t.options().reloadState,function(t){return o&&t.state.includes[o.name]}))).forEach(function(t,e){t.resolvables=u[e].resolvables}),a},Pr.prototype._changedParams=function(){var t=this._treeChanges;if(!(this._options.reload||t.exiting.length||t.entering.length||t.to.length!==t.from.length||Ct(t.to,t.from).map(function(t){return t[0].state!==t[1].state}).reduce(dt,!1))){var e=t.to.map(function(t){return t.paramSchema}),r=[t.to,t.from].map(function(t){return t.map(function(t){return t.paramValues})});return Ct(e,r[0],r[1]).map(function(t){var e=t[0],r=t[1],n=t[2];return Te.changed(e,r,n)}).reduce(mt,[])}},Pr.prototype.dynamic=function(){var t=this._changedParams();return!!t&&t.map(function(t){return t.dynamic}).reduce(dt,!1)},Pr.prototype.ignored=function(){return!!this._ignoredReason()},Pr.prototype._ignoredReason=function(){function t(t,e){if(t.length!==e.length)return!1;var r=qe.matching(t,e);return t.length===r.filter(function(t){return!n||!t.state.includes[n.name]}).length}var e=this.router.globals.transition,n=this._options.reloadState,r=this.treeChanges(),i=e&&e.treeChanges();return i&&t(i.to,r.to)&&t(i.exiting,r.exiting)?"SameAsPending":0===r.exiting.length&&0===r.entering.length&&t(r.from,r.to)?"SameAsCurrent":void 0},Pr.prototype.run=function(){function e(t){return r._hookBuilder.buildHooksForPhase(t)}var r=this,n=gr.runAllHooks,t=e(d.TransitionHookPhase.BEFORE);return gr.invokeHooks(t,function(){var t=r.router.globals;return t.lastStartedTransitionId=r.$id,t.transition=r,t.transitionHistory.enqueue(r),we.traceTransitionStart(r),D.$q.when(void 0)}).then(function(){var t=e(d.TransitionHookPhase.RUN);return gr.invokeHooks(t,function(){return D.$q.when(void 0)})}).then(function(){we.traceSuccess(r.$to(),r),r.success=!0,r._deferred.resolve(r.to()),n(e(d.TransitionHookPhase.SUCCESS))},function(t){we.traceError(t,r),r.success=!1,r._deferred.reject(t),r._error=t,n(e(d.TransitionHookPhase.ERROR))}),this.promise},Pr.prototype.valid=function(){return!this.error()||void 0!==this.success},Pr.prototype.abort=function(){b(this.success)&&(this._aborted=!0)},Pr.prototype.error=function(){var t=this.$to();if(t.self.abstract)return Ft.invalid("Cannot transition to abstract state '"+t.name+"'");var e=t.parameters(),r=this.params(),n=e.filter(function(t){return!t.validates(r[t.id])});if(n.length){var i=n.map(function(t){return"["+t.id+":"+Qt(r[t.id])+"]"}).join(", "),o="The following parameter values are not valid for state '"+t.name+"': "+i;return Ft.invalid(o)}return!1===this.success?this._error:void 0},Pr.prototype.toString=function(){function t(t){return null!==t["#"]&&void 0!==t["#"]?t:ut(t,["#"])}var e=this.from(),r=this.to();return"Transition#"+this.$id+"( '"+(O(e)?e.name:e)+"'"+Qt(t(this._treeChanges.from.map(m("paramValues")).reduce(it,{})))+" -> "+(this.valid()?"":"(X) ")+"'"+(O(r)?r.name:r)+"'"+Qt(t(this.params()))+" )"},Pr.diToken=Pr);function Pr(t,e,r){var n=this;if(this._deferred=D.$q.defer(),this.promise=this._deferred.promise,this._registeredHooks={},this._hookBuilder=new Rr(this),this.isActive=function(){return n.router.globals.transition===n},this.router=r,!(this._targetState=e).valid())throw new Error(e.error());this._options=B({current:p(this)},e.options()),this.$id=r.transitionService._transitionCount++;var i=qe.buildToPath(t,e);this._treeChanges=qe.treeChanges(t,i,this._options.reloadState),this.createTransitionHookRegFns();var o=this._hookBuilder.buildHooksForPhase(d.TransitionHookPhase.CREATE);gr.invokeHooks(o,function(){return null}),this.applyViewConfigs(r)}function kr(t,e){var r=["",""],n=t.replace(/[\\\[\]\^$*+?.()|{}]/g,"\\$&");if(!e)return n;switch(e.squash){case!1:r=["(",")"+(e.isOptional?"?":"")];break;case!0:n=n.replace(/\/$/,""),r=["(?:/(",")|/)?"];break;default:r=["("+e.squash+"|",")?"]}return n+r[0]+e.type.pattern.source+r[1]}var Or=ne("/"),xr={state:{params:{}},strict:!0,caseInsensitive:!0},jr=(Vr.encodeDashes=function(t){return encodeURIComponent(t).replace(/-/g,function(t){return"%5C%"+t.charCodeAt(0).toString(16).toUpperCase()})},Vr.pathSegmentsAndParams=function(t){return Ct(t._segments,t._params.filter(function(t){return t.location===d.DefType.PATH}).concat(void 0)).reduce(mt,[]).filter(function(t){return""!==t&&E(t)})},Vr.queryParams=function(t){return t._params.filter(function(t){return t.location===d.DefType.SEARCH})},Vr.compare=function(t,e){function r(t){return t._cache.weights=t._cache.weights||function(t){return t._cache.segments=t._cache.segments||t._cache.path.map(Vr.pathSegmentsAndParams).reduce(mt,[]).reduce(ie,[]).map(function(t){return k(t)?Or(t):t}).reduce(mt,[])}(t).map(function(t){return"/"===t?1:k(t)?2:t instanceof Te?3:void 0})}var n=r(t),i=r(e);!function(t,e,r){for(var n=Math.max(t.length,e.length);t.length<n;)t.push(r);for(;e.length<n;)e.push(r)}(n,i,0);var o,a,u=Ct(n,i);for(a=0;a<u.length;a++)if(0!=(o=u[a][0]-u[a][1]))return o;return 0},Vr.prototype.append=function(t){return this._children.push(t),t._cache={path:this._cache.path.concat(t),parent:this,pattern:null},t},Vr.prototype.isRoot=function(){return this._cache.path[0]===this},Vr.prototype.toString=function(){return this.pattern},Vr.prototype.exec=function(t,n,e,r){var i=this;void 0===n&&(n={});var o=function(t,e,r){return t[e]=t[e]||r()}(this._cache,"pattern",function(){return new RegExp(["^",_t(i._cache.path.map(m("_compiled"))).join(""),!1===i.config.strict?"/?":"","$"].join(""),i.config.caseInsensitive?"i":void 0)}).exec(t);if(!o)return null;var a=this.parameters(),u=a.filter(function(t){return!t.isSearch()}),s=a.filter(function(t){return t.isSearch()}),c=this._cache.path.map(function(t){return t._segments.length-1}).reduce(function(t,e){return t+e}),f={};if(c!==o.length-1)throw new Error("Unbalanced capture group in route '"+this.pattern+"'");for(var l=0;l<c;l++){for(var h=u[l],p=o[l+1],v=0;v<h.replace.length;v++)h.replace[v].from===p&&(p=h.replace[v].to);p&&!0===h.array&&(p=ht(ht(d(p).split(/-(?!\\)/),d),function(t){return t.replace(/\\-/g,"-")}).reverse()),E(p)&&(p=h.type.decode(p)),f[h.id]=h.value(p)}function d(t){return t.split("").reverse().join("")}return s.forEach(function(t){for(var e=n[t.id],r=0;r<t.replace.length;r++)t.replace[r].from===e&&(e=t.replace[r].to);E(e)&&(e=t.type.decode(e)),f[t.id]=t.value(e)}),e&&(f["#"]=e),f},Vr.prototype.parameters=function(t){return void 0===t&&(t={}),!1===t.inherit?this._params:_t(this._cache.path.map(function(t){return t._params}))},Vr.prototype.parameter=function(n,t){var i=this;void 0===t&&(t={});var e=this._cache.parent;return function(){for(var t=0,e=i._params;t<e.length;t++){var r=e[t];if(r.id===n)return r}}()||!1!==t.inherit&&e&&e.parameter(n,t)||null},Vr.prototype.validates=function(e){return e=e||{},this.parameters().filter(function(t){return e.hasOwnProperty(t.id)}).map(function(t){return function(t,e){return!t||t.validates(e)}(t,e[t.id])}).reduce(vt,!0)},Vr.prototype.format=function(a){void 0===a&&(a={});var t=this._cache.path,e=t.map(Vr.pathSegmentsAndParams).reduce(mt,[]).map(function(t){return k(t)?t:n(t)}),r=t.map(Vr.queryParams).reduce(mt,[]).map(n);if(e.concat(r).filter(function(t){return!1===t.isValid}).length)return null;function n(t){var e=t.value(a[t.id]),r=t.validates(e),n=t.isDefaultValue(e),i=!!n&&t.squash,o=t.type.encode(e);return{param:t,value:e,isValid:r,isDefaultValue:n,squash:i,encoded:o}}var i=e.reduce(function(t,e){if(k(e))return t+e;var r=e.squash,n=e.encoded,i=e.param;return!0===r?t.match(/\/$/)?t.slice(0,-1):t:k(r)?t+r:!1!==r?t:null==n?t:x(n)?t+ht(n,Vr.encodeDashes).join("-"):i.raw?t+n:t+encodeURIComponent(n)},""),o=r.map(function(t){var e=t.param,r=t.squash,n=t.encoded,i=t.isDefaultValue;if(!(null==n||i&&!1!==r)&&(x(n)||(n=[n]),0!==n.length))return e.raw||(n=ht(n,encodeURIComponent)),n.map(function(t){return e.id+"="+t})}).filter(z).reduce(mt,[]).join("&");return i+(o?"?"+o:"")+(a["#"]?"#"+a["#"]:"")},Vr.nameValidator=/^\w+([-.]+\w+)*(?:\[\])?$/,Vr);function Vr(o,a,t,e){var u=this;this._cache={path:[this]},this._children=[],this._params=[],this._segments=[],this._compiled=[],this.config=e=nt(e,xr),this.pattern=o;for(var r,n,i,s=/([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,c=/([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g,f=[],l=0,h=function(t){if(!Vr.nameValidator.test(t))throw new Error("Invalid parameter name '"+t+"' in pattern '"+o+"'");if(ft(u._params,y("id",t)))throw new Error("Duplicate parameter name '"+t+"' in pattern '"+o+"'")},p=function(t,e){var r,n=t[2]||t[3],i=e?t[4]:t[4]||("*"===t[1]?"[\\s\\S]*":null);return{id:n,regexp:i,segment:o.substring(l,t.index),type:i?a.type(i)||(r=i,Q(a.type(e?"query":"path"),{pattern:new RegExp(r,u.config.caseInsensitive?"i":void 0)})):null}};(r=s.exec(o))&&!(0<=(n=p(r,!1)).segment.indexOf("?"));)h(n.id),this._params.push(t.fromPath(n.id,n.type,e.state)),this._segments.push(n.segment),f.push([n.segment,Pt(this._params)]),l=s.lastIndex;var v=(i=o.substring(l)).indexOf("?");if(0<=v){var d=i.substring(v);if(i=i.substring(0,v),0<d.length)for(l=0;r=c.exec(d);)h((n=p(r,!0)).id),this._params.push(t.fromSearch(n.id,n.type,e.state)),l=s.lastIndex}this._segments.push(i),this._compiled=f.map(function(t){return kr.apply(null,t)}).concat(kr(i))}var Hr=function(){return(Hr=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)},Ir=(Ar.prototype.fromConfig=function(t,e,r){return new Te(t,e,d.DefType.CONFIG,this.router.urlService.config,r)},Ar.prototype.fromPath=function(t,e,r){return new Te(t,e,d.DefType.PATH,this.router.urlService.config,r)},Ar.prototype.fromSearch=function(t,e,r){return new Te(t,e,d.DefType.SEARCH,this.router.urlService.config,r)},Ar);function Ar(t){this.router=t}var Dr=(qr.prototype.compile=function(t,e){var r=this.router.urlService.config,n=e&&!e.state&&e.params;e=n?Hr({state:{params:n}},e):e;var i={strict:r._isStrictMode,caseInsensitive:r._isCaseInsensitive};return new jr(t,r.paramTypes,this.paramFactory,B(i,e))},qr.prototype.isMatcher=function(r){if(!O(r))return!1;var n=!0;return M(jr.prototype,function(t,e){T(t)&&(n=n&&E(r[e])&&T(r[e]))}),n},qr.prototype.$get=function(){var t=this.router.urlService.config;return t.paramTypes.enqueue=!1,t.paramTypes._flushTypeQueue(),this},qr);function qr(t){var n=this;this.router=t,this.paramFactory=new Ir(this.router),this.caseInsensitive=function(t){return n.router.urlService.config.caseInsensitive(t)},this.defaultSquashPolicy=function(t){return n.router.urlService.config.defaultSquashPolicy(t)},this.strictMode=function(t){return n.router.urlService.config.strictMode(t)},this.type=function(t,e,r){return n.router.urlService.config.type(t,e,r)||n},B(this,{UrlMatcher:jr,Param:Te})}var Ur=(Fr.prototype.compile=function(t){return this.router.urlMatcherFactory.compile(t)},Fr.prototype.create=function(t,e){var r=this,n=ur.isState,i=g([[k,function(t){return i(r.compile(t))}],[h(jr),function(t){return r.fromUrlMatcher(t,e)}],[n,function(t){return r.fromState(t,r.router)}],[h(RegExp),function(t){return r.fromRegExp(t,e)}],[T,function(t){return new Nr(t,e)}]]),o=i(t);if(!o)throw new Error("invalid 'what' in when()");return o},Fr.prototype.fromUrlMatcher=function(r,e){var t=e;k(e)&&(e=this.router.urlMatcherFactory.compile(e)),h(jr)(e)&&(t=function(t){return e.format(t)});var n={urlMatcher:r,matchPriority:function(e){var t=r.parameters().filter(function(t){return t.isOptional});return t.length?t.filter(function(t){return e[t.id]}).length/t.length:1e-6},type:"URLMATCHER"};return B(new Nr(function(t){var e=r.exec(t.path,t.search,t.hash);return r.validates(e)&&e},t),n)},Fr.prototype.fromState=function(n,i){var t={state:n,type:"STATE"};return B(this.fromUrlMatcher(n.url,function(t){var e=i.stateService,r=i.globals;e.href(n,t)!==e.href(r.current,r.params)&&e.transitionTo(n,t,{inherit:!0,source:"url"})}),t)},Fr.prototype.fromRegExp=function(e,t){if(e.global||e.sticky)throw new Error("Rule RegExp must not be global or sticky");var r=k(t)?function(r){return t.replace(/\$(\$|\d{1,2})/,function(t,e){return r["$"===e?0:Number(e)]})}:t,n={regexp:e,type:"REGEXP"};return B(new Nr(function(t){return e.exec(t.path)},r),n)},Fr.isUrlRule=function(e){return e&&["type","match","handler"].every(function(t){return E(e[t])})},Fr);function Fr(t){this.router=t}var Nr=function(t,e){var r=this;this.match=t,this.type="RAW",this.matchPriority=function(t){return 0-r.$id},this.handler=e||z};var Lr=(Mr.prototype.update=function(t){var e=this.router.locationService;t?this.location=e.url():e.url()!==this.location&&e.url(this.location,!0)},Mr.prototype.push=function(t,e,r){var n=r&&!!r.replace;this.router.urlService.url(t.format(e||{}),n)},Mr.prototype.href=function(t,e,r){var n=t.format(e);if(null==n)return null;r=r||{absolute:!1};var i=this.router.urlService.config,o=i.html5Mode();if(o||null===n||(n="#"+i.hashPrefix()+n),n=function(t,e,r,n){return"/"===n?t:e?Yt(n)+t:r?n.slice(1)+t:t}(n,o,r.absolute,i.baseHref()),!r.absolute||!n)return n;var a=!o&&n?"/":"",u=i.port(),s=80===u||443===u?"":":"+u;return[i.protocol(),"://",i.host(),s,a,n].join("")},Object.defineProperty(Mr.prototype,"interceptDeferred",{get:function(){return this.router.urlService.interceptDeferred},enumerable:!0,configurable:!0}),Mr);function Mr(t){var n=this;this.router=t,this.sync=function(t){return n.router.urlService.sync(t)},this.listen=function(t){return n.router.urlService.listen(t)},this.deferIntercept=function(t){return n.router.urlService.deferIntercept(t)},this.match=function(t){return n.router.urlService.match(t)},this.initial=function(t){return n.router.urlService.rules.initial(t)},this.otherwise=function(t){return n.router.urlService.rules.otherwise(t)},this.removeRule=function(t){return n.router.urlService.rules.removeRule(t)},this.rule=function(t){return n.router.urlService.rules.rule(t)},this.rules=function(){return n.router.urlService.rules.rules()},this.sort=function(t){return n.router.urlService.rules.sort(t)},this.when=function(t,e,r){return n.router.urlService.rules.when(t,e,r)},this.urlRuleFactory=new Ur(t)}var Br=(Gr.normalizeUIViewTarget=function(t,e){void 0===e&&(e="");var r=e.split("@"),n=r[0]||"$default",i=k(r[1])?r[1]:"^",o=/^(\^(?:\.\^)*)\.(.*$)/.exec(n);return o&&(i=o[1],n=o[2]),"!"===n.charAt(0)&&(n=n.substr(1),i=""),/^(\^(?:\.\^)*)$/.exec(i)?i=i.split(".").reduce(function(t,e){return t.parent},t).name:"."===i&&(i=t.name),{uiViewName:n,uiViewContextAnchor:i}},Gr.prototype._rootViewContext=function(t){return this._rootContext=t||this._rootContext},Gr.prototype._viewConfigFactory=function(t,e){this._viewConfigFactories[t]=e},Gr.prototype.createViewConfig=function(t,e){var r=this._viewConfigFactories[e.$type];if(!r)throw new Error("ViewService: No view config factory registered for type "+e.$type);var n=r(t,e);return x(n)?n:[n]},Gr.prototype.deactivateViewConfig=function(t){we.traceViewServiceEvent("<- Removing",t),Z(this._viewConfigs,t)},Gr.prototype.activateViewConfig=function(t){we.traceViewServiceEvent("-> Registering",t),this._viewConfigs.push(t)},Gr.prototype.sync=function(){var r=this,n=this._uiViews.map(function(t){return[t.fqn,t]}).reduce(Tt,{});function i(t){for(var e=t.viewDecl.$context,r=0;++r&&e.parent;)e=e.parent;return r}var o=s(function(t,e,r,n){return e*(t(r)-t(n))}),t=this._uiViews.sort(o(function(t){var e=function(t){return t&&t.parent?e(t.parent)+1:1};return 1e4*t.fqn.split(".").length+e(t.creationContext)},1)).map(function(t){var e=r._viewConfigs.filter(Gr.matches(n,t));return 1<e.length&&e.sort(o(i,-1)),{uiView:t,viewConfig:e[0]}}),e=t.map(function(t){return t.viewConfig}),a=this._viewConfigs.filter(function(t){return!K(e,t)}).map(function(t){return{uiView:void 0,viewConfig:t}});t.forEach(function(t){-1!==r._uiViews.indexOf(t.uiView)&&t.uiView.configUpdated(t.viewConfig)});var u=t.concat(a);this._listeners.forEach(function(t){return t(u)}),we.traceViewSync(u)},Gr.prototype.registerUIView=function(e){we.traceViewServiceUIViewEvent("-> Registering",e);var t=this._uiViews;return t.filter(function(t){return t.fqn===e.fqn&&t.$type===e.$type}).length&&we.traceViewServiceUIViewEvent("!!!! duplicate uiView named:",e),t.push(e),this.sync(),function(){-1!==t.indexOf(e)?(we.traceViewServiceUIViewEvent("<- Deregistering",e),Z(t)(e)):we.traceViewServiceUIViewEvent("Tried removing non-registered uiView",e)}},Gr.prototype.available=function(){return this._uiViews.map(m("fqn"))},Gr.prototype.active=function(){return this._uiViews.filter(m("$config")).map(m("name"))},Gr.matches=function(u,s){return function(t){if(s.$type!==t.viewDecl.$type)return!1;var e=t.viewDecl,r=e.$uiViewName.split("."),n=s.fqn.split(".");if(!G(r,n.slice(0-r.length)))return!1;var i=1-r.length||void 0,o=n.slice(0,i).join("."),a=u[o].creationContext;return e.$uiViewContextAnchor===(a&&a.name)}},Gr);function Gr(t){var r=this;this.router=t,this._uiViews=[],this._viewConfigs=[],this._viewConfigFactories={},this._listeners=[],this._pluginapi={_rootViewContext:this._rootViewContext.bind(this),_viewConfigFactory:this._viewConfigFactory.bind(this),_registeredUIView:function(e){return ft(r._uiViews,function(t){return r.router.$id+"."+t.id===e})},_registeredUIViews:function(){return r._uiViews},_activeViewConfigs:function(){return r._viewConfigs},_onSync:function(t){return r._listeners.push(t),function(){return Z(r._listeners,t)}}}}var zr=(Wr.prototype.dispose=function(){this.transitionHistory.clear(),this.successfulTransitions.clear(),this.transition=null},Wr);function Wr(){this.params=new je,this.lastStartedTransitionId=-1,this.transitionHistory=new Dt([],1),this.successfulTransitions=new Dt([],1)}var Jr;function Qr(t){if(!(T(t)||k(t)||h(Ae)(t)||Ae.isDef(t)))throw new Error("'handler' must be a string, function, TargetState, or have a state: 'newtarget' property");return T(t)?t:p(t)}Jr=function(t,e){var r=function(t,e){return(e.priority||0)-(t.priority||0)}(t,e);return 0!==r?r:0!==(r=function(t,e){var r={STATE:4,URLMATCHER:4,REGEXP:3,RAW:2,OTHER:1};return(r[t.type]||0)-(r[e.type]||0)}(t,e))?r:0!==(r=function(t,e){return t.urlMatcher&&e.urlMatcher?jr.compare(t.urlMatcher,e.urlMatcher):0}(t,e))?r:function(t,e){var r={STATE:!0,URLMATCHER:!0};return r[t.type]&&r[e.type]?0:(t.$id||0)-(e.$id||0)}(t,e)};var Kr=(Yr.prototype.dispose=function(t){this._rules=[],delete this._otherwiseFn},Yr.prototype.initial=function(t){var e=Qr(t);this.rule(this.urlRuleFactory.create(function(t,e){return 0===e.globals.transitionHistory.size()&&!!/^\/?$/.exec(t.path)},e))},Yr.prototype.otherwise=function(t){var e=Qr(t);this._otherwiseFn=this.urlRuleFactory.create(p(!0),e),this._sorted=!1},Yr.prototype.removeRule=function(t){Z(this._rules,t)},Yr.prototype.rule=function(t){var e=this;if(!Ur.isUrlRule(t))throw new Error("invalid rule");return t.$id=this._id++,t.priority=t.priority||0,this._rules.push(t),this._sorted=!1,function(){return e.removeRule(t)}},Yr.prototype.rules=function(){return this.ensureSorted(),this._rules.concat(this._otherwiseFn?[this._otherwiseFn]:[])},Yr.prototype.sort=function(t){for(var e=this.stableSort(this._rules,this._sortFn=t||this._sortFn),r=0,n=0;n<e.length;n++)e[n]._group=r,n<e.length-1&&0!==this._sortFn(e[n],e[n+1])&&r++;this._rules=e,this._sorted=!0},Yr.prototype.ensureSorted=function(){this._sorted||this.sort()},Yr.prototype.stableSort=function(t,n){var e=t.map(function(t,e){return{elem:t,idx:e}});return e.sort(function(t,e){var r=n(t.elem,e.elem);return 0===r?t.idx-e.idx:r}),e.map(function(t){return t.elem})},Yr.prototype.when=function(t,e,r){var n=this.urlRuleFactory.create(t,e);return E(r&&r.priority)&&(n.priority=r.priority),this.rule(n),n},Yr);function Yr(t){this.router=t,this._sortFn=Jr,this._rules=[],this._id=0,this.urlRuleFactory=new Ur(t)}var Zr=(Xr.prototype.caseInsensitive=function(t){return this._isCaseInsensitive=E(t)?t:this._isCaseInsensitive},Xr.prototype.defaultSquashPolicy=function(t){if(E(t)&&!0!==t&&!1!==t&&!k(t))throw new Error("Invalid squash policy: "+t+". Valid policies: false, true, arbitrary-string");return this._defaultSquashPolicy=E(t)?t:this._defaultSquashPolicy},Xr.prototype.strictMode=function(t){return this._isStrictMode=E(t)?t:this._isStrictMode},Xr.prototype.type=function(t,e,r){var n=this.paramTypes.type(t,e,r);return E(e)?this:n},Xr);function Xr(t){var e=this;this.router=t,this.paramTypes=new ke,this._isCaseInsensitive=!1,this._isStrictMode=!0,this._defaultSquashPolicy=!1,this.dispose=function(){return e.paramTypes.dispose()},this.baseHref=function(){return e.router.locationConfig.baseHref()},this.hashPrefix=function(t){return e.router.locationConfig.hashPrefix(t)},this.host=function(){return e.router.locationConfig.host()},this.html5Mode=function(){return e.router.locationConfig.html5Mode()},this.port=function(){return e.router.locationConfig.port()},this.protocol=function(){return e.router.locationConfig.protocol()}}var tn=(en.prototype.dispose=function(){this.listen(!1),this.rules.dispose()},en.prototype.parts=function(){return{path:this.path(),search:this.search(),hash:this.hash()}},en.prototype.sync=function(t){if(!t||!t.defaultPrevented){var e=this.router,r=e.urlService,n=e.stateService,i={path:r.path(),search:r.search(),hash:r.hash()},o=this.match(i);g([[k,function(t){return r.url(t,!0)}],[Ae.isDef,function(t){return n.go(t.state,t.params,t.options)}],[h(Ae),function(t){return n.go(t.state(),t.params(),t.options())}]])(o&&o.rule.handler(o.match,i,this.router))}},en.prototype.listen=function(t){var e=this;if(!1!==t)return this._stopListeningFn=this._stopListeningFn||this.router.urlService.onChange(function(t){return e.sync(t)});this._stopListeningFn&&this._stopListeningFn(),delete this._stopListeningFn},en.prototype.deferIntercept=function(t){void 0===t&&(t=!0),this.interceptDeferred=t},en.prototype.match=function(t){var e=this;t=B({path:"",search:{},hash:""},t);for(var r,n,i,o=this.rules.rules(),a=0;a<o.length&&(!r||r.rule._group===o[a]._group);a++){var u=(n=o[a],(i=n.match(t,e.router))&&{match:i,rule:n,weight:n.matchPriority(i)});r=!r||u&&u.weight>r.weight?u:r}return r},en);function en(t){var n=this;this.router=t,this.interceptDeferred=!1,this.rules=new Kr(this.router),this.config=new Zr(this.router),this.url=function(t,e,r){return n.router.locationService.url(t,e,r)},this.path=function(){return n.router.locationService.path()},this.search=function(){return n.router.locationService.search()},this.hash=function(){return n.router.locationService.hash()},this.onChange=function(t){return n.router.locationService.onChange(t)}}var rn=0,nn=I("LocationServices",["url","path","search","hash","onChange"]),on=I("LocationConfig",["port","protocol","host","baseHref","html5Mode","hashPrefix"]),an=(un.prototype.disposable=function(t){this._disposables.push(t)},un.prototype.dispose=function(t){var e=this;t&&T(t.dispose)?t.dispose(this):(this._disposed=!0,this._disposables.slice().forEach(function(t){try{"function"==typeof t.dispose&&t.dispose(e),Z(e._disposables,t)}catch(t){}}))},un.prototype.plugin=function(t,e){void 0===e&&(e={});var r=new t(this,e);if(!r.name)throw new Error("Required property `name` missing on plugin: "+r);return this._disposables.push(r),this._plugins[r.name]=r},un.prototype.getPlugin=function(t){return t?this._plugins[t]:pt(this._plugins)},un);function un(t,e){void 0===t&&(t=nn),void 0===e&&(e=on),this.locationService=t,this.locationConfig=e,this.$id=rn++,this._disposed=!1,this._disposables=[],this.trace=we,this.viewService=new Br(this),this.globals=new zr,this.transitionService=new kn(this),this.urlMatcherFactory=new Dr(this),this.urlRouter=new Lr(this),this.urlService=new tn(this),this.stateRegistry=new dr(this),this.stateService=new xn(this),this._plugins={},this.viewService._pluginapi._rootViewContext(this.stateRegistry.root()),this.globals.$current=this.stateRegistry.root(),this.globals.current=this.globals.$current.self,this.disposable(this.globals),this.disposable(this.stateService),this.disposable(this.stateRegistry),this.disposable(this.transitionService),this.disposable(this.urlService),this.disposable(t),this.disposable(e)}function sn(e){e.addResolvable(Le.fromData(an,e.router),""),e.addResolvable(Le.fromData(Tr,e),""),e.addResolvable(Le.fromData("$transition$",e),""),e.addResolvable(Le.fromData("$stateParams",e.params()),""),e.entering().forEach(function(t){e.addResolvable(Le.fromData("$state$",t),t)})}function cn(t){function e(t){return ln(t.token)?Le.fromData(t.token,null):t}pt(t.treeChanges()).reduce(mt,[]).reduce(wt,[]).forEach(function(t){t.resolvables=t.resolvables.map(e)})}function fn(e){var t=e.to().redirectTo;if(t){var r=e.router.stateService;return T(t)?D.$q.when(t(e)).then(n):n(t)}function n(t){if(t)return t instanceof Ae?t:k(t)?r.target(t,e.params(),e.options()):t.state||t.params?r.target(t.state||e.to(),t.params||e.params(),e.options()):void 0}}var ln=K(["$transition$",Tr]);function hn(r){return function(t,e){return(0,e.$$state()[r])(t,e)}}function pn(t){return new Je(t.treeChanges().to).resolvePath("EAGER",t).then(W)}function vn(t,e){return new Je(t.treeChanges().to).subContext(e.$$state()).resolvePath("LAZY",t).then(W)}function dn(t){return new Je(t.treeChanges().to).resolvePath("LAZY",t).then(W)}function mn(t){var e=D.$q,r=t.views("entering");if(r.length)return e.all(r.map(function(t){return e.when(t.load())})).then(W)}function yn(t){var e=t.views("entering"),r=t.views("exiting");if(e.length||r.length){var n=t.router.viewService;r.forEach(function(t){return n.deactivateViewConfig(t)}),e.forEach(function(t){return n.activateViewConfig(t)}),n.sync()}}function gn(t){function e(){r.transition===t&&(r.transition=null)}var r=t.router.globals;t.onSuccess({},function(){r.successfulTransitions.enqueue(t),r.$current=t.$to(),r.current=r.$current.self,kt(t.params(),r.params)},{priority:1e4}),t.promise.then(e,e)}function wn(t){var e=t.options(),r=t.router.stateService,n=t.router.urlRouter;if("url"!==e.source&&e.location&&r.$current.navigable){var i={replace:"replace"===e.location};n.push(r.$current.navigable.url,r.params,i)}n.update(!0)}function _n(a){var u=a.router,t=a.entering().filter(function(t){return!!t.$$state().lazyLoad}).map(function(t){return Rn(a,t)});return D.$q.all(t).then(function(){if("url"!==a.originalTransition().options().source){var t=a.targetState();return u.stateService.target(t.identifier(),t.params(),t.options())}var e=u.urlService,r=e.match(e.parts()),n=r&&r.rule;if(n&&"STATE"===n.type){var i=n.state,o=r.match;return u.stateService.target(i,o,a.options())}u.urlService.sync()})}var Sn=hn("onExit"),bn=hn("onRetain"),$n=hn("onEnter");function Rn(e,r){var n=r.$$state().lazyLoad,t=n._promise;if(!t){t=n._promise=D.$q.when(n(e,r)).then(function(t){t&&Array.isArray(t.states)&&t.states.forEach(function(t){return e.router.stateRegistry.register(t)});return t}).then(function(t){return delete r.lazyLoad,delete r.$$state().lazyLoad,delete n._promise,t},function(t){return delete n._promise,D.$q.reject(t)})}return t}var En=function(t,e,r,n,i,o,a,u){void 0===i&&(i=!1),void 0===o&&(o=gr.HANDLE_RESULT),void 0===a&&(a=gr.REJECT_ERROR),void 0===u&&(u=!1),this.name=t,this.hookPhase=e,this.hookOrder=r,this.criteriaMatchPath=n,this.reverseSort=i,this.getResultHandler=o,this.getErrorHandler=a,this.synchronous=u};function Cn(t){var e=t._ignoredReason();if(e){we.traceTransitionIgnored(t);var r=t.router.globals.transition;return"SameAsCurrent"===e&&r&&r.abort(),Ft.ignored().toPromise()}}function Tn(t){if(!t.valid())throw new Error(t.error().toString())}var Pn={location:!0,relative:null,inherit:!1,notify:!0,reload:!1,supercede:!0,custom:{},current:function(){return null},source:"unknown"},kn=(On.prototype.onCreate=function(t,e,r){},On.prototype.onBefore=function(t,e,r){},On.prototype.onStart=function(t,e,r){},On.prototype.onExit=function(t,e,r){},On.prototype.onRetain=function(t,e,r){},On.prototype.onEnter=function(t,e,r){},On.prototype.onFinish=function(t,e,r){},On.prototype.onSuccess=function(t,e,r){},On.prototype.onError=function(t,e,r){},On.prototype.dispose=function(t){pt(this._registeredHooks).forEach(function(e){return e.forEach(function(t){t._deregistered=!0,Z(e,t)})})},On.prototype.create=function(t,e){return new Tr(t,e,this._router)},On.prototype._defineCoreEvents=function(){var t=d.TransitionHookPhase,e=gr,r=this._criteriaPaths;this._defineEvent("onCreate",t.CREATE,0,r.to,!1,e.LOG_REJECTED_RESULT,e.THROW_ERROR,!0),this._defineEvent("onBefore",t.BEFORE,0,r.to),this._defineEvent("onStart",t.RUN,0,r.to),this._defineEvent("onExit",t.RUN,100,r.exiting,!0),this._defineEvent("onRetain",t.RUN,200,r.retained),this._defineEvent("onEnter",t.RUN,300,r.entering),this._defineEvent("onFinish",t.RUN,400,r.to),this._defineEvent("onSuccess",t.SUCCESS,0,r.to,!1,e.LOG_REJECTED_RESULT,e.LOG_ERROR,!0),this._defineEvent("onError",t.ERROR,0,r.to,!1,e.LOG_REJECTED_RESULT,e.LOG_ERROR,!0)},On.prototype._defineCorePaths=function(){var t=d.TransitionHookScope.STATE,e=d.TransitionHookScope.TRANSITION;this._definePathType("to",e),this._definePathType("from",e),this._definePathType("exiting",t),this._definePathType("retained",t),this._definePathType("entering",t)},On.prototype._defineEvent=function(t,e,r,n,i,o,a,u){void 0===i&&(i=!1),void 0===o&&(o=gr.HANDLE_RESULT),void 0===a&&(a=gr.REJECT_ERROR),void 0===u&&(u=!1);var s=new En(t,e,r,n,i,o,a,u);this._eventTypes.push(s),$r(this,this,s)},On.prototype._getEvents=function(e){return(E(e)?this._eventTypes.filter(function(t){return t.hookPhase===e}):this._eventTypes.slice()).sort(function(t,e){var r=t.hookPhase-e.hookPhase;return 0==r?t.hookOrder-e.hookOrder:r})},On.prototype._definePathType=function(t,e){this._criteriaPaths[t]={name:t,scope:e}},On.prototype._getPathTypes=function(){return this._criteriaPaths},On.prototype.getHooks=function(t){return this._registeredHooks[t]},On.prototype._registerCoreTransitionHooks=function(){var t=this._deregisterHookFns;t.addCoreResolves=function(t){return t.onCreate({},sn)}(this),t.ignored=function(t){return t.onBefore({},Cn,{priority:-9999})}(this),t.invalid=function(t){return t.onBefore({},Tn,{priority:-1e4})}(this),t.redirectTo=function(t){return t.onStart({to:function(t){return!!t.redirectTo}},fn)}(this),t.onExit=function(t){return t.onExit({exiting:function(t){return!!t.onExit}},Sn)}(this),t.onRetain=function(t){return t.onRetain({retained:function(t){return!!t.onRetain}},bn)}(this),t.onEnter=function(t){return t.onEnter({entering:function(t){return!!t.onEnter}},$n)}(this),t.eagerResolve=function(t){return t.onStart({},pn,{priority:1e3})}(this),t.lazyResolve=function(t){return t.onEnter({entering:p(!0)},vn,{priority:1e3})}(this),t.resolveAll=function(t){return t.onFinish({},dn,{priority:1e3})}(this),t.loadViews=function(t){return t.onFinish({},mn)}(this),t.activateViews=function(t){return t.onSuccess({},yn)}(this),t.updateGlobals=function(t){return t.onCreate({},gn)}(this),t.updateUrl=function(t){return t.onSuccess({},wn,{priority:9999})}(this),t.lazyLoad=function(t){return t.onBefore({entering:function(t){return!!t.lazyLoad}},_n)}(this)},On);function On(t){this._transitionCount=0,this._eventTypes=[],this._registeredHooks={},this._criteriaPaths={},this._router=t,this.$view=t.viewService,this._deregisterHookFns={},this._pluginapi=J(p(this),{},p(this),["_definePathType","_defineEvent","_getPathTypes","_getEvents","getHooks"]),this._defineCorePaths(),this._defineCoreEvents(),this._registerCoreTransitionHooks(),t.globals.successfulTransitions.onEvict(cn)}var xn=(Object.defineProperty(jn.prototype,"transition",{get:function(){return this.router.globals.transition},enumerable:!0,configurable:!0}),Object.defineProperty(jn.prototype,"params",{get:function(){return this.router.globals.params},enumerable:!0,configurable:!0}),Object.defineProperty(jn.prototype,"current",{get:function(){return this.router.globals.current},enumerable:!0,configurable:!0}),Object.defineProperty(jn.prototype,"$current",{get:function(){return this.router.globals.$current},enumerable:!0,configurable:!0}),jn.prototype.dispose=function(){this.defaultErrorHandler(W),this.invalidCallbacks=[]},jn.prototype._handleInvalidTargetState=function(t,r){function n(){return e.transitionHistory.peekTail()}var i=this,o=qe.makeTargetState(this.router.stateRegistry,t),e=this.router.globals,a=n(),u=new Dt(this.invalidCallbacks.slice()),s=new Je(t).injector(),c=function(t){if(t instanceof Ae){var e=t;return(e=i.target(e.identifier(),e.params(),e.options())).valid()?n()!==a?Ft.superseded().toPromise():i.transitionTo(e.identifier(),e.params(),e.options()):Ft.invalid(e.error()).toPromise()}};return function e(){var t=u.dequeue();return void 0===t?Ft.invalid(r.error()).toPromise():D.$q.when(t(r,o,s)).then(c).then(function(t){return t||e()})}()},jn.prototype.onInvalid=function(t){return this.invalidCallbacks.push(t),function(){Z(this.invalidCallbacks)(t)}.bind(this)},jn.prototype.reload=function(t){return this.transitionTo(this.current,this.params,{reload:!E(t)||t,inherit:!1,notify:!1})},jn.prototype.go=function(t,e,r){var n=nt(r,{relative:this.$current,inherit:!0},Pn);return this.transitionTo(t,e,n)},jn.prototype.target=function(t,e,r){if(void 0===r&&(r={}),O(r.reload)&&!r.reload.name)throw new Error("Invalid reload state object");var n=this.router.stateRegistry;if(r.reloadState=!0===r.reload?n.root():n.matcher.find(r.reload,r.relative),r.reload&&!r.reloadState)throw new Error("No such reload state '"+(k(r.reload)?r.reload:r.reload.name)+"'");return new Ae(this.router.stateRegistry,t,e,r)},jn.prototype.getCurrentPath=function(){var t=this,e=this.router.globals.successfulTransitions.peekTail();return e?e.treeChanges().to:[new He(t.router.stateRegistry.root())]},jn.prototype.transitionTo=function(t,e,r){var o=this;void 0===e&&(e={}),void 0===r&&(r={});var a=this.router,u=a.globals;function n(){return u.transition}r=nt(r,Pn),r=B(r,{current:n});var i=this.target(t,e,r),s=this.getCurrentPath();if(!i.exists())return this._handleInvalidTargetState(s,i);if(!i.valid())return Vt(i.error());if(!1===r.supercede&&n())return Ft.ignored("Another transition is in progress and supercede has been set to false in TransitionOptions for the transition. So the transition was ignored in favour of the existing one in progress.").toPromise();var c=function(i){return function(t){if(t instanceof Ft){var e=a.globals.lastStartedTransitionId<=i.$id;if(t.type===d.RejectType.IGNORED)return e&&a.urlRouter.update(),D.$q.when(u.current);var r=t.detail;if(t.type===d.RejectType.SUPERSEDED&&t.redirected&&r instanceof Ae){var n=i.redirect(r);return n.run().catch(c(n))}if(t.type===d.RejectType.ABORTED)return e&&a.urlRouter.update(),D.$q.reject(t)}return o.defaultErrorHandler()(t),D.$q.reject(t)}},f=this.router.transitionService.create(s,i),l=f.run().catch(c(f));return jt(l),B(l,{transition:f})},jn.prototype.is=function(t,e,r){r=nt(r,{relative:this.$current});var n=this.router.stateRegistry.matcher.find(t,r.relative);if(E(n)){if(this.$current!==n)return!1;if(!e)return!0;var i=n.parameters({inherit:!0,matchingKeys:e});return Te.equals(i,Te.values(i,e),this.params)}},jn.prototype.includes=function(t,e,r){r=nt(r,{relative:this.$current});var n=k(t)&&Ht.fromString(t);if(n){if(!n.matches(this.$current.name))return!1;t=this.$current.name}var i=this.router.stateRegistry.matcher.find(t,r.relative),o=this.$current.includes;if(E(i)){if(!E(o[i.name]))return!1;if(!e)return!0;var a=i.parameters({inherit:!0,matchingKeys:e});return Te.equals(a,Te.values(a,e),this.params)}},jn.prototype.href=function(t,e,r){r=nt(r,{lossy:!0,inherit:!0,absolute:!1,relative:this.$current}),e=e||{};var n=this.router.stateRegistry.matcher.find(t,r.relative);if(!E(n))return null;r.inherit&&(e=this.params.$inherit(e,this.$current,n));var i=n&&r.lossy?n.navigable:n;return i&&void 0!==i.url&&null!==i.url?this.router.urlRouter.href(i.url,e,{absolute:r.absolute}):null},jn.prototype.defaultErrorHandler=function(t){return this._defaultErrorHandler=t||this._defaultErrorHandler},jn.prototype.get=function(t,e){var r=this.router.stateRegistry;return 0===arguments.length?r.get():r.get(t,e||this.$current)},jn.prototype.lazyLoad=function(t,e){var r=this.get(t);if(!r||!r.lazyLoad)throw new Error("Can not lazy load "+t);var n=this.getCurrentPath(),i=qe.makeTargetState(this.router.stateRegistry,n);return Rn(e=e||this.router.transitionService.create(n,i),r)},jn);function jn(t){this.router=t,this.invalidCallbacks=[],this._defaultErrorHandler=function(t){t instanceof Error&&t.stack?(console.error(t),console.error(t.stack)):t instanceof Ft?(console.error(t.toString()),t.detail&&t.detail.stack&&console.error(t.detail.stack)):console.error(t)};var e=Object.keys(jn.prototype).filter(l(K(["current","$current","params","transition"])));J(p(jn.prototype),this,p(this),e)}function Vn(t,e){var r=e[0],n=e[1];return t.hasOwnProperty(r)?x(t[r])?t[r].push(n):t[r]=[t[r],n]:t[r]=n,t}function Hn(t){return t.split("&").filter(z).map(re).reduce(Vn,{})}var In={when:function(r){return new Promise(function(t,e){return t(r)})},reject:function(r){return new Promise(function(t,e){e(r)})},defer:function(){var r={};return r.promise=new Promise(function(t,e){r.resolve=t,r.reject=e}),r},all:function(t){if(x(t))return Promise.all(t);if(O(t)){var e=Object.keys(t).map(function(e){return t[e].then(function(t){return{key:e,val:t}})});return In.all(e).then(function(t){return t.reduce(function(t,e){return t[e.key]=e.val,t},{})})}}},An={},Dn=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,qn=/([^\s,]+)/g,Un={get:function(t){return An[t]},has:function(t){return null!=Un.get(t)},invoke:function(t,e,r){var n=B({},An,r||{}),i=Un.annotate(t),o=bt(function(t){return n.hasOwnProperty(t)},function(t){return"DI can't find injectable: '"+t+"'"}),a=i.filter(o).map(function(t){return n[t]});return T(t)?t.apply(e,a):t.slice(-1)[0].apply(e,a)},annotate:function(t){if(!H(t))throw new Error("Not an injectable function: "+t);if(t&&t.$inject)return t.$inject;if(x(t))return t.slice(0,-1);var e=t.toString().replace(Dn,"");return e.slice(e.indexOf("(")+1,e.indexOf(")")).match(qn)||[]}};function Fn(t){function e(t){return t||""}var r=te(t).map(e),n=r[0],i=r[1],o=ee(n).map(e);return{path:o[0],search:o[1],hash:i,url:t}}function Nn(t){var e=t.path(),r=t.search(),n=t.hash(),i=Object.keys(r).map(function(e){var t=r[e];return(x(t)?t:[t]).map(function(t){return e+"="+t})}).reduce(mt,[]).join("&");return e+(i?"?"+i:"")+(n?"#"+n:"")}function Ln(n,i,o,a){return function(t){var e=t.locationService=new o(t),r=t.locationConfig=new a(t,i);return{name:n,service:e,configuration:r,dispose:function(t){t.dispose(e),t.dispose(r)}}}}var Mn=(Bn.prototype.url=function(e,t){return void 0===t&&(t=!0),E(e)&&e!==this._get()&&(this._set(null,null,e,t),this.fireAfterUpdate&&this._listeners.forEach(function(t){return t({url:e})})),Nn(this)},Bn.prototype.onChange=function(t){var e=this;return this._listeners.push(t),function(){return Z(e._listeners,t)}},Bn.prototype.dispose=function(t){rt(this._listeners)},Bn);function Bn(t,e){var r=this;this.fireAfterUpdate=e,this._listeners=[],this._listener=function(e){return r._listeners.forEach(function(t){return t(e)})},this.hash=function(){return Fn(r._get()).hash},this.path=function(){return Fn(r._get()).path},this.search=function(){return Hn(Fn(r._get()).search)},this._location=U.location,this._history=U.history}var Gn,zn,Wn=((Gn=function(t,e){return(Gn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}Gn(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)})(Jn,zn=Mn),Jn.prototype._get=function(){return Zt(this._location.hash)},Jn.prototype._set=function(t,e,r,n){this._location.hash=r},Jn.prototype.dispose=function(t){zn.prototype.dispose.call(this,t),U.removeEventListener("hashchange",this._listener)},Jn);function Jn(t){var e=zn.call(this,t,!1)||this;return U.addEventListener("hashchange",e._listener,!1),e}var Qn,Kn,Yn=((Qn=function(t,e){return(Qn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}Qn(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)})(Zn,Kn=Mn),Zn.prototype._get=function(){return this._url},Zn.prototype._set=function(t,e,r,n){this._url=r},Zn);function Zn(t){return Kn.call(this,t,!0)||this}var Xn,ti,ei=((Xn=function(t,e){return(Xn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)},function(t,e){function r(){this.constructor=t}Xn(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)})(ri,ti=Mn),ri.prototype._getBasePrefix=function(){return Yt(this._config.baseHref())},ri.prototype._get=function(){var t=this._location,e=t.pathname,r=t.hash,n=t.search;n=ee(n)[1],r=te(r)[1];var i=this._getBasePrefix(),o=e===this._config.baseHref(),a=e.substr(0,i.length)===i;return(e=o?"/":a?e.substring(i.length):e)+(n?"?"+n:"")+(r?"#"+r:"")},ri.prototype._set=function(t,e,r,n){var i=this._getBasePrefix(),o=r&&"/"!==r[0]?"/":"",a=""===r||"/"===r?this._config.baseHref():i+o+r;n?this._history.replaceState(t,e,a):this._history.pushState(t,e,a)},ri.prototype.dispose=function(t){ti.prototype.dispose.call(this,t),U.removeEventListener("popstate",this._listener)},ri);function ri(t){var e=ti.call(this,t,!0)||this;return e._config=t.urlService.config,U.addEventListener("popstate",e._listener,!1),e}function ni(){var e=this;this.dispose=W,this._baseHref="",this._port=80,this._protocol="http",this._host="localhost",this._hashPrefix="",this.port=function(){return e._port},this.protocol=function(){return e._protocol},this.host=function(){return e._host},this.baseHref=function(){return e._baseHref},this.html5Mode=function(){return!1},this.hashPrefix=function(t){return E(t)?e._hashPrefix=t:e._hashPrefix}}var ii=(oi.prototype.port=function(){return location.port?Number(location.port):"https"===this.protocol()?443:80},oi.prototype.protocol=function(){return location.protocol.replace(/:/g,"")},oi.prototype.host=function(){return location.hostname},oi.prototype.html5Mode=function(){return this._isHtml5},oi.prototype.hashPrefix=function(t){return E(t)?this._hashPrefix=t:this._hashPrefix},oi.prototype.baseHref=function(t){return E(t)&&(this._baseHref=t),b(this._baseHref)&&(this._baseHref=this.getBaseHref()),this._baseHref},oi.prototype.getBaseHref=function(){var t=document.getElementsByTagName("base")[0];return t&&t.href?t.href.replace(/^([^/:]*:)?\/\/[^/]*/,""):this._isHtml5?"/":location.pathname||"/"},oi.prototype.dispose=function(){},oi);function oi(t,e){void 0===e&&(e=!1),this._isHtml5=e,this._baseHref=void 0,this._hashPrefix=""}function ai(t){return D.$injector=Un,{name:"vanilla.services",$q:D.$q=In,$injector:Un,dispose:function(){return null}}}var ui=Ln("vanilla.hashBangLocation",!1,Wn,ii),si=Ln("vanilla.pushStateLocation",!0,ei,ii),ci=Ln("vanilla.memoryLocation",!1,Yn,ni),fi=(li.prototype.dispose=function(t){},li);function li(){}var hi=Object.freeze({__proto__:null,root:U,fromJson:N,toJson:L,forEach:M,extend:B,equals:G,identity:z,noop:W,createProxyFunctions:J,inherit:Q,inArray:K,_inArray:Y,removeFrom:Z,_removeFrom:X,pushTo:tt,_pushTo:et,deregAll:rt,defaults:nt,mergeR:it,ancestors:ot,pick:at,omit:ut,pluck:st,filter:ct,find:ft,mapObj:lt,map:ht,values:pt,allTrueR:vt,anyTrueR:dt,unnestR:mt,flattenR:yt,pushR:gt,uniqR:wt,unnest:_t,flatten:St,assertPredicate:bt,assertMap:$t,assertFn:Rt,pairs:Et,arrayTuples:Ct,applyPairs:Tt,tail:Pt,copy:kt,_extend:Ot,silenceUncaughtInPromise:jt,silentRejection:Vt,makeStub:I,services:D,Glob:Ht,curry:s,compose:r,pipe:c,prop:m,propEq:y,parse:R,not:l,and:i,or:o,all:u,any:f,is:h,eq:a,val:p,invoke:v,pattern:g,isUndefined:b,isDefined:E,isNull:_,isNullOrUndefined:C,isFunction:T,isNumber:P,isString:k,isObject:O,isArray:x,isDate:j,isRegExp:V,isInjectable:H,isPromise:A,Queue:Dt,maxLength:Lt,padString:Mt,kebobString:Bt,functionToString:Gt,fnToString:zt,stringify:Qt,beforeAfterSubstr:Kt,hostRegex:Xt,stripLastPathElement:Yt,splitHash:te,splitQuery:ee,splitEqual:re,trimHashVal:Zt,splitOnDelim:ne,joinNeighborsR:ie,get Category(){return d.Category},Trace:ye,trace:we,get DefType(){return d.DefType},Param:Te,ParamTypes:ke,StateParams:je,ParamType:_e,PathNode:He,PathUtils:qe,resolvePolicies:Fe,defaultResolvePolicy:Ne,Resolvable:Le,NATIVE_INJECTOR_TOKEN:We,ResolveContext:Je,resolvablesBuilder:ir,StateBuilder:or,StateObject:ur,StateMatcher:cr,StateQueueManager:lr,StateRegistry:dr,StateService:xn,TargetState:Ae,get TransitionHookPhase(){return d.TransitionHookPhase},get TransitionHookScope(){return d.TransitionHookScope},HookBuilder:Rr,matchState:_r,RegisteredHook:Sr,makeEvent:$r,get RejectType(){return d.RejectType},Rejection:Ft,Transition:Tr,TransitionHook:gr,TransitionEventType:En,defaultTransOpts:Pn,TransitionService:kn,UrlRules:Kr,UrlConfig:Zr,UrlMatcher:jr,ParamFactory:Ir,UrlMatcherFactory:Dr,UrlRouter:Lr,UrlRuleFactory:Ur,BaseUrlRule:Nr,UrlService:tn,ViewService:Br,UIRouterGlobals:zr,UIRouter:an,$q:In,$injector:Un,BaseLocationServices:Mn,HashLocationService:Wn,MemoryLocationService:Yn,PushStateLocationService:ei,MemoryLocationConfig:ni,BrowserLocationConfig:ii,keyValsToObjectR:Vn,getParams:Hn,parseUrl:Fn,buildUrl:Nn,locationPluginFactory:Ln,servicesPlugin:ai,hashLocationPlugin:ui,pushStateLocationPlugin:si,memoryLocationPlugin:ci,UIRouterPluginBase:fi});function pi(){var r=null;return function(t,e){return r=r||D.$injector.get("$templateFactory"),[new yi(t,e,r)]}}var vi=function(t,r){return t.reduce(function(t,e){return t||E(r[e])},!1)};function di(n){if(!n.parent)return{};var i=["component","bindings","componentProvider"],o=["templateProvider","templateUrl","template","notify","async"].concat(["controller","controllerProvider","controllerAs","resolveAs"]),t=i.concat(o);if(E(n.views)&&vi(t,n))throw new Error("State '"+n.name+"' has a 'views' object. It cannot also have \"view properties\" at the state level. Move the following properties into a view (in the 'views' object): "+t.filter(function(t){return E(n[t])}).join(", "));var a={},e=n.views||{$default:at(n,t)};return M(e,function(t,e){if(e=e||"$default",k(t)&&(t={component:t}),t=B({},t),vi(i,t)&&vi(o,t))throw new Error("Cannot combine: "+i.join("|")+" with: "+o.join("|")+" in stateview: '"+e+"@"+n.name+"'");t.resolveAs=t.resolveAs||"$resolve",t.$type="ng1",t.$context=n,t.$name=e;var r=Br.normalizeUIViewTarget(t.$context,t.$name);t.$uiViewName=r.uiViewName,t.$uiViewContextAnchor=r.uiViewContextAnchor,a[e]=t}),a}var mi=0,yi=(gi.prototype.load=function(){var e=this,t=D.$q,r=new Je(this.path),n=this.path.reduce(function(t,e){return B(t,e.paramValues)},{}),i={template:t.when(this.factory.fromConfig(this.viewDecl,n,r)),controller:t.when(this.getController(r))};return t.all(i).then(function(t){return we.traceViewServiceEvent("Loaded",e),e.controller=t.controller,B(e,t.template),e})},gi.prototype.getController=function(t){var e=this.viewDecl.controllerProvider;if(!H(e))return this.viewDecl.controller;var r=D.$injector.annotate(e),n=x(e)?Pt(e):e;return new Le("",n,r).get(t)},gi);function gi(t,e,r){var n=this;this.path=t,this.viewDecl=e,this.factory=r,this.$id=mi++,this.loaded=!1,this.getTemplate=function(t,e){return n.component?n.factory.makeComponentTemplate(t,e,n.component,n.viewDecl.bindings):n.template}}var wi=(_i.prototype.useHttpService=function(t){this._useHttp=t},_i.prototype.fromConfig=function(t,e,r){function n(t){return D.$q.when(t).then(function(t){return{template:t}})}function i(t){return D.$q.when(t).then(function(t){return{component:t}})}return E(t.template)?n(this.fromString(t.template,e)):E(t.templateUrl)?n(this.fromUrl(t.templateUrl,e)):E(t.templateProvider)?n(this.fromProvider(t.templateProvider,e,r)):E(t.component)?i(t.component):E(t.componentProvider)?i(this.fromComponentProvider(t.componentProvider,e,r)):n("<ui-view></ui-view>")},_i.prototype.fromString=function(t,e){return T(t)?t(e):t},_i.prototype.fromUrl=function(t,e){return T(t)&&(t=t(e)),null==t?null:this._useHttp?this.$http.get(t,{cache:this.$templateCache,headers:{Accept:"text/html"}}).then(function(t){return t.data}):this.$templateRequest(t)},_i.prototype.fromProvider=function(t,e,r){var n=D.$injector.annotate(t),i=x(t)?Pt(t):t;return new Le("",i,n).get(r)},_i.prototype.fromComponentProvider=function(t,e,r){var n=D.$injector.annotate(t),i=x(t)?Pt(t):t;return new Le("",i,n).get(r)},_i.prototype.makeComponentTemplate=function(s,c,t,f){function l(t){var e=Bt(t);return/^(x|data)-/.exec(e)?"x-"+e:e}f=f||{};var h=3<=$.version.minor?"::":"",e=function(t){var e=D.$injector.get(t+"Directive");if(!e||!e.length)throw new Error("Unable to find component named '"+t+"'");return e.map(Si).reduce(mt,[])}(t).map(function(t){var e=t.name,r=t.type,n=l(e);if(s.attr(n)&&!f[e])return n+"='"+s.attr(n)+"'";var i=f[e]||e;if("@"===r)return n+"='{{"+h+"$resolve."+i+"}}'";if("&"!==r)return n+"='"+h+"$resolve."+i+"'";var o=c.getResolvable(i),a=o&&o.data,u=a&&D.$injector.annotate(a)||[];return n+"='$resolve."+i+(x(a)?"["+(a.length-1)+"]":"")+"("+u.join(",")+")'"}).join(" "),r=l(t);return"<"+r+" "+e+"></"+r+">"},_i);function _i(){var n=this;this._useHttp=$.version.minor<3,this.$get=["$http","$templateCache","$injector",function(t,e,r){return n.$templateRequest=r.has&&r.has("$templateRequest")&&r.get("$templateRequest"),n.$http=t,n.$templateCache=e,n}]}var Si=function(t){return O(t.bindToController)?bi(t.bindToController):bi(t.scope)},bi=function(e){return Object.keys(e||{}).map(function(t){return[t,/^([=<@&])[?]?(.*)/.exec(e[t])]}).filter(function(t){return E(t)&&x(t[1])}).map(function(t){return{name:t[1][2]||t[0],type:t[1][1]}})},$i=(Ri.prototype.decorator=function(t,e){return this.stateRegistry.decorator(t,e)||this},Ri.prototype.state=function(t,e){return O(t)?e=t:e.name=t,this.stateRegistry.register(e),this},Ri.prototype.onInvalid=function(t){return this.stateService.onInvalid(t)},Ri);function Ri(t,e){this.stateRegistry=t,this.stateService=e,J(p(Ri.prototype),this,p(this))}function Ei(r){return function(t,e){var i=t[r],o="onExit"===r?"from":"to";return i?function(t,e){var r=new Je(t.treeChanges(o)).subContext(e.$$state()),n=B(Bi(r),{$state$:e,$transition$:t});return D.$injector.invoke(i,this,n)}:void 0}}var Ci=(Ti.monkeyPatchPathParameterType=function(t){var e=t.urlMatcherFactory.type("path");e.encode=function(t){return null!=t?t.toString().replace(/(~|\/)/g,function(t){return{"~":"~~","/":"~2F"}[t]}):t},e.decode=function(t){return null!=t?t.toString().replace(/(~~|~2F)/g,function(t){return{"~~":"~","~2F":"/"}[t]}):t}},Ti.prototype.dispose=function(){},Ti.prototype.onChange=function(t){var e=this;return this._urlListeners.push(t),function(){return Z(e._urlListeners)(t)}},Ti.prototype.html5Mode=function(){var t=this.$locationProvider.html5Mode();return(t=O(t)?t.enabled:t)&&this.$sniffer.history},Ti.prototype.baseHref=function(){return this._baseHref||(this._baseHref=this.$browser.baseHref()||this.$window.location.pathname)},Ti.prototype.url=function(t,e,r){return void 0===e&&(e=!1),E(t)&&this.$location.url(t),e&&this.$location.replace(),r&&this.$location.state(r),this.$location.url()},Ti.prototype._runtimeServices=function(t,e,r,n,i){var o=this;this.$location=e,this.$sniffer=r,this.$browser=n,this.$window=i,t.$on("$locationChangeSuccess",function(e){return o._urlListeners.forEach(function(t){return t(e)})});var a=p(e);J(a,this,a,["replace","path","search","hash"]),J(a,this,a,["port","protocol","host"])},Ti);function Ti(t){this._urlListeners=[],this.$locationProvider=t;var e=p(t);J(e,this,e,["hashPrefix"])}var Pi=(ki.injectableHandler=function(e,r){return function(t){return D.$injector.invoke(r,null,{$match:t,$stateParams:e.globals.params})}},ki.prototype.$get=function(){var t=this.router.urlService;return this.router.urlRouter.update(!0),t.interceptDeferred||t.listen(),this.router.urlRouter},ki.prototype.rule=function(t){var e=this;if(!T(t))throw new Error("'rule' must be a function");var r=new Nr(function(){return t(D.$injector,e.router.locationService)},z);return this.router.urlService.rules.rule(r),this},ki.prototype.otherwise=function(t){var e=this,r=this.router.urlService.rules;if(k(t))r.otherwise(t);else{if(!T(t))throw new Error("'rule' must be a string or function");r.otherwise(function(){return t(D.$injector,e.router.locationService)})}return this},ki.prototype.when=function(t,e){return(x(e)||T(e))&&(e=ki.injectableHandler(this.router,e)),this.router.urlService.rules.when(t,e),this},ki.prototype.deferIntercept=function(t){this.router.urlService.deferIntercept(t)},ki);function ki(t){this.router=t}$.module("ui.router.angular1",[]);var Oi=$.module("ui.router.init",["ng"]),xi=$.module("ui.router.util",["ui.router.init"]),ji=$.module("ui.router.router",["ui.router.util"]),Vi=$.module("ui.router.state",["ui.router.router","ui.router.util","ui.router.angular1"]),Hi=$.module("ui.router",["ui.router.init","ui.router.state","ui.router.angular1"]),Ii=($.module("ui.router.compat",["ui.router"]),null);function Ai(t){(Ii=this.router=new an).stateProvider=new $i(Ii.stateRegistry,Ii.stateService),Ii.stateRegistry.decorator("views",di),Ii.stateRegistry.decorator("onExit",Ei("onExit")),Ii.stateRegistry.decorator("onRetain",Ei("onRetain")),Ii.stateRegistry.decorator("onEnter",Ei("onEnter")),Ii.viewService._pluginapi._viewConfigFactory("ng1",pi());var u=Ii.locationService=Ii.locationConfig=new Ci(t);function e(t,e,r,n,i,o,a){return u._runtimeServices(i,t,n,e,r),delete Ii.router,delete Ii.$get,Ii}return Ci.monkeyPatchPathParameterType(Ii),((Ii.router=Ii).$get=e).$inject=["$location","$browser","$window","$sniffer","$rootScope","$http","$templateCache"],Ii}Ai.$inject=["$locationProvider"];function Di(r){return["$uiRouterProvider",function(t){var e=t.router[r];return e.$get=function(){return e},e}]}function qi(e,t,r){if(D.$injector=e,D.$q=t,!e.hasOwnProperty("strictDi"))try{e.invoke(function(t){})}catch(t){e.strictDi=!!/strict mode/.exec(t&&t.toString())}r.stateRegistry.get().map(function(t){return t.$$state().resolvables}).reduce(mt,[]).filter(function(t){return"deferred"===t.deps}).forEach(function(t){return t.deps=e.annotate(t.resolveFn,e.strictDi)})}qi.$inject=["$injector","$q","$uiRouter"];function Ui(t){t.$watch(function(){we.approximateDigests++})}Ui.$inject=["$rootScope"],Oi.provider("$uiRouter",Ai),ji.provider("$urlRouter",["$uiRouterProvider",function(t){return t.urlRouterProvider=new Pi(t)}]),xi.provider("$urlService",Di("urlService")),xi.provider("$urlMatcherFactory",["$uiRouterProvider",function(){return Ii.urlMatcherFactory}]),xi.provider("$templateFactory",function(){return new wi}),Vi.provider("$stateRegistry",Di("stateRegistry")),Vi.provider("$uiRouterGlobals",Di("globals")),Vi.provider("$transitions",Di("transitionService")),Vi.provider("$state",["$uiRouterProvider",function(){return B(Ii.stateProvider,{$get:function(){return Ii.stateService}})}]),Vi.factory("$stateParams",["$uiRouter",function(t){return t.globals.params}]),Hi.factory("$view",function(){return Ii.viewService}),Hi.service("$trace",function(){return we}),Hi.run(Ui),xi.run(["$urlMatcherFactory",function(t){}]),Vi.run(["$state",function(t){}]),ji.run(["$urlRouter",function(t){}]),Oi.run(qi);var Fi,Ni,Li,Mi,Bi=function(r){return r.getTokens().filter(k).map(function(t){var e=r.getResolvable(t);return[t,"NOWAIT"===r.getPolicy(e).async?e.promise:e.data]}).reduce(Tt,{})};function Gi(t){var e,r=t.match(/^\s*({[^}]*})\s*$/);if(r&&(t="("+r[1]+")"),!(e=t.replace(/\n/g," ").match(/^\s*([^(]*?)\s*(\((.*)\))?\s*$/))||4!==e.length)throw new Error("Invalid state ref '"+t+"'");return{state:e[1]||null,paramExpr:e[3]||null}}function zi(t){var e=t.parent().inheritedData("$uiView"),r=R("$cfg.path")(e);return r?Pt(r).state.name:void 0}function Wi(t,e,r){var n=r.uiState||t.current.name,i=B(function(t,e){return{relative:zi(t)||e.$current,inherit:!0,source:"sref"}}(e,t),r.uiStateOpts||{}),o=t.href(n,r.uiStateParams,i);return{uiState:n,uiStateParams:r.uiStateParams,uiStateOpts:i,href:o}}function Ji(t){var e="[object SVGAnimatedString]"===Object.prototype.toString.call(t.prop("href")),r="FORM"===t[0].nodeName;return{attr:r?"action":e?"xlink:href":"href",isAnchor:"A"===t.prop("tagName").toUpperCase(),clickable:!r}}function Qi(o,a,u,s,c){return function(t){var e=t.which||t.button,r=c();if(!(1<e||t.ctrlKey||t.metaKey||t.shiftKey||o.attr("target"))){var n=u(function(){o.attr("disabled")||a.go(r.uiState,r.uiStateParams,r.uiStateOpts)});t.preventDefault();var i=s.isAnchor&&!r.href?1:0;t.preventDefault=function(){i--<=0&&u.cancel(n)}}}}function Ki(i,t,o,e){var a;e&&(a=e.events),x(a)||(a=["click"]);for(var r=i.on?"on":"bind",n=0,u=a;n<u.length;n++){var s=u[n];i[r](s,o)}t.$on("$destroy",function(){for(var t=i.off?"off":"unbind",e=0,r=a;e<r.length;e++){var n=r[e];i[t](n,o)}})}function Yi(n){function t(t,e,r){return n.is(t,e,r)}return t.$stateful=!0,t}function Zi(n){function t(t,e,r){return n.includes(t,e,r)}return t.$stateful=!0,t}function Xi(d,m,y,t,g,e){var w=R("viewDecl.controllerAs"),_=R("viewDecl.resolveAs");return{restrict:"ECA",priority:-400,compile:function(t){var v=t.html();return t.empty(),function(e,r){var t=r.data("$uiView");if(!t)return r.html(v),void d(r.contents())(e);var n=t.$cfg||{viewDecl:{},getTemplate:W},i=n.path&&new Je(n.path);r.html(n.getTemplate(r,i)||v),we.traceUIViewFill(t.$uiView,r.html());var o=d(r.contents()),a=n.controller,u=w(n),s=_(n),c=i&&Bi(i);if(e[s]=c,a){var f=m(a,B({},c,{$scope:e,$element:r}));u&&(e[u]=f,e[u][s]=c),r.data("$ngControllerController",f),r.children().data("$ngControllerController",f),ro(g,y,f,e,n)}if(k(n.component))var l=Bt(n.component),h=new RegExp("^(x-|data-)?"+l+"$","i"),p=e.$watch(function(){var t=[].slice.call(r[0].children).filter(function(t){return t&&t.tagName&&h.exec(t.tagName)});return t&&$.element(t).data("$"+n.component+"Controller")},function(t){t&&(ro(g,y,t,e,n),p())});o(e)}}}}Fi=["$uiRouter","$timeout",function(h,p){var v=h.stateService;return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(t,e,r,n){function i(){return Wi(v,e,c)}var o,a=Ji(e),u=n[1]||n[0],s=null,c={},f=Gi(r.uiSref);function l(){var t=i();s&&s(),u&&(s=u.$$addStateInfo(t.uiState,t.uiStateParams)),null!=t.href&&r.$set(a.attr,t.href)}c.uiState=f.state,c.uiStateOpts=r.uiSrefOpts?t.$eval(r.uiSrefOpts):{},f.paramExpr&&(t.$watch(f.paramExpr,function(t){c.uiStateParams=B({},t),l()},!0),c.uiStateParams=B({},t.$eval(f.paramExpr))),l(),t.$on("$destroy",h.stateRegistry.onStatesChanged(l)),t.$on("$destroy",h.transitionService.onSuccess({},l)),a.clickable&&(o=Qi(e,v,p,a,i),Ki(e,t,o,c.uiStateOpts))}}}],Ni=["$uiRouter","$timeout",function(p,v){var d=p.stateService;return{restrict:"A",require:["?^uiSrefActive","?^uiSrefActiveEq"],link:function(r,t,n,e){function i(){return Wi(d,t,c)}var o,a=Ji(t),u=e[1]||e[0],s=null,c={},f=["uiState","uiStateParams","uiStateOpts"],l=f.reduce(function(t,e){return t[e]=W,t},{});function h(){var t=i();s&&s(),u&&(s=u.$$addStateInfo(t.uiState,t.uiStateParams)),null!=t.href&&n.$set(a.attr,t.href)}f.forEach(function(e){c[e]=n[e]?r.$eval(n[e]):null,n.$observe(e,function(t){l[e](),l[e]=r.$watch(t,function(t){c[e]=t,h()},!0)})}),h(),r.$on("$destroy",p.stateRegistry.onStatesChanged(h)),r.$on("$destroy",p.transitionService.onSuccess({},h)),a.clickable&&(o=Qi(t,d,v,a,i),Ki(t,r,o,c.uiStateOpts))}}}],Li=["$state","$stateParams","$interpolate","$uiRouter",function(v,t,d,m){return{restrict:"A",controller:["$scope","$element","$attrs",function(u,s,t){var c,n,e,r,i,f=[];c=d(t.uiSrefActiveEq||"",!1)(u);try{n=u.$eval(t.uiSrefActive)}catch(t){}function o(t){t.promise.then(p,W)}function a(){l(n)}function l(t){O(t)&&(f=[],M(t,function(t,e){function r(t,e){var r=Gi(t);h(r.state,u.$eval(r.paramExpr),e)}k(t)?r(t,e):x(t)&&M(t,function(t){r(t,e)})}))}function h(t,e,r){var n={state:v.get(t,zi(s))||{name:t},params:e,activeClass:r};return f.push(n),function(){Z(f)(n)}}function p(){function e(t){return t.split(/\s/).filter(z)}function t(t){return t.map(function(t){return t.activeClass}).map(e).reduce(mt,[])}var r=t(f).concat(e(c)).reduce(wt,[]),n=t(f.filter(function(t){return v.includes(t.state.name,t.params)})),i=!!f.filter(function(t){return v.is(t.state.name,t.params)}).length?e(c):[],o=n.concat(i).reduce(wt,[]),a=r.filter(function(t){return!K(o,t)});u.$evalAsync(function(){o.forEach(function(t){return s.addClass(t)}),a.forEach(function(t){return s.removeClass(t)})})}l(n=n||d(t.uiSrefActive||"",!1)(u)),this.$$addStateInfo=function(t,e){if(!(O(n)&&0<f.length)){var r=h(t,e,n);return p(),r}},u.$on("$destroy",(e=m.stateRegistry.onStatesChanged(a),r=m.transitionService.onStart({},o),i=u.$on("$stateChangeSuccess",p),function(){e(),r(),i()})),m.globals.transition&&o(m.globals.transition),p()}]}}],$.module("ui.router.state").directive("uiSref",Fi).directive("uiSrefActive",Li).directive("uiSrefActiveEq",Li).directive("uiState",Ni),Yi.$inject=["$state"],Zi.$inject=["$state"],$.module("ui.router.state").filter("isState",Yi).filter("includedByState",Zi),Mi=["$view","$animate","$uiViewScroll","$interpolate","$q",function(i,o,g,w,_){var S={$cfg:{viewDecl:{$context:i._pluginapi._rootViewContext()}},$uiView:{}},b={count:0,restrict:"ECA",terminal:!0,priority:400,transclude:"element",compile:function(t,e,y){return function(a,u,t){var s,c,f,l,e,h=t.onload||"",p=t.autoscroll,v={enter:function(t,e,r){2<$.version.minor?o.enter(t,null,e).then(r):o.enter(t,null,e,r)},leave:function(t,e){2<$.version.minor?o.leave(t).then(e):o.leave(t,e)}},r=u.inheritedData("$uiView")||S,d=w(t.uiView||t.name||"")(a)||"$default",m={$type:"ng1",id:b.count++,name:d,fqn:r.$uiView.fqn?r.$uiView.fqn+"."+d:d,config:null,configUpdated:function(t){if(t&&!(t instanceof yi))return;if(function(t,e){return t===e}(l,t))return;we.traceUIViewConfigUpdated(m,t&&t.viewDecl&&t.viewDecl.$context),n(l=t)},get creationContext(){var t=R("$cfg.viewDecl.$context")(r),e=R("$uiView.creationContext")(r);return t||e}};function n(t){var e=a.$new(),r=_.defer(),n=_.defer(),i={$cfg:t,$uiView:m},o={$animEnter:r.promise,$animLeave:n.promise,$$animLeave:n};e.$emit("$viewContentLoading",d),c=y(e,function(t){t.data("$uiViewAnim",o),t.data("$uiView",i),v.enter(t,u,function(){r.resolve(),f&&f.$emit("$viewContentAnimationEnded"),(E(p)&&!p||a.$eval(p))&&g(t)}),function(){if(s&&(we.traceUIViewEvent("Removing (previous) el",s.data("$uiView")),s.remove(),s=null),f&&(we.traceUIViewEvent("Destroying scope",m),f.$destroy(),f=null),c){var t=c.data("$uiViewAnim");we.traceUIViewEvent("Animate out",t),v.leave(c,function(){t.$$animLeave.resolve(),s=null}),s=c,c=null}}()}),(f=e).$emit("$viewContentLoaded",t||l),f.$eval(h)}we.traceUIViewEvent("Linking",m),u.data("$uiView",{$uiView:m}),n(),e=i.registerUIView(m),a.$on("$destroy",function(){we.traceUIViewEvent("Destroying/Unregistering",m),e()})}}};return b}],Xi.$inject=["$compile","$controller","$transitions","$view","$q","$timeout"];var to="function"==typeof $.module("ui.router").component,eo=0;function ro(n,t,c,e,r){!T(c.$onInit)||(r.viewDecl.component||r.viewDecl.componentProvider)&&to||c.$onInit();var f=Pt(r.path).state.self,i={bind:c};if(T(c.uiOnParamsChanged)){var l=new Je(r.path).getResolvable("$transition$").data;e.$on("$destroy",t.onSuccess({},function(t){if(t!==l&&-1===t.exiting().indexOf(f)){var r=t.params("to"),n=t.params("from"),e=function(t){return t.paramSchema},i=t.treeChanges("to").map(e).reduce(mt,[]),o=t.treeChanges("from").map(e).reduce(mt,[]),a=i.filter(function(t){var e=o.indexOf(t);return-1===e||!o[e].type.equals(r[t.id],n[t.id])});if(a.length){var u=a.map(function(t){return t.id}),s=ct(r,function(t,e){return-1!==u.indexOf(e)});c.uiOnParamsChanged(s,t)}}},i))}if(T(c.uiCanExit)){var o=eo++,a="_uiCanExitIds",u=function(t){return!!t&&(t[a]&&!0===t[a][o]||u(t.redirectedFrom()))},s={exiting:f.name};e.$on("$destroy",t.onBefore(s,function(t){var e,r=t[a]=t[a]||{};return u(t)||(e=n.when(c.uiCanExit(t))).then(function(t){return r[o]=!1!==t}),e},i))}}$.module("ui.router.state").directive("uiView",Mi),$.module("ui.router.state").directive("uiView",Xi),$.module("ui.router.state").provider("$uiViewScroll",function(){var r=!1;this.useAnchorScroll=function(){r=!0},this.$get=["$anchorScroll","$timeout",function(t,e){return r?t:function(t){return e(function(){t[0].scrollIntoView()},0,!1)}}]});d.$injector=Un,d.$q=In,d.BaseLocationServices=Mn,d.BaseUrlRule=Nr,d.BrowserLocationConfig=ii,d.Glob=Ht,d.HashLocationService=Wn,d.HookBuilder=Rr,d.MemoryLocationConfig=ni,d.MemoryLocationService=Yn,d.NATIVE_INJECTOR_TOKEN=We,d.Ng1ViewConfig=yi,d.Param=Te,d.ParamFactory=Ir,d.ParamType=_e,d.ParamTypes=ke,d.PathNode=He,d.PathUtils=qe,d.PushStateLocationService=ei,d.Queue=Dt,d.RegisteredHook=Sr,d.Rejection=Ft,d.Resolvable=Le,d.ResolveContext=Je,d.StateBuilder=or,d.StateMatcher=cr,d.StateObject=ur,d.StateParams=je,d.StateProvider=$i,d.StateQueueManager=lr,d.StateRegistry=dr,d.StateService=xn,d.TargetState=Ae,d.Trace=ye,d.Transition=Tr,d.TransitionEventType=En,d.TransitionHook=gr,d.TransitionService=kn,d.UIRouter=an,d.UIRouterGlobals=zr,d.UIRouterPluginBase=fi,d.UrlConfig=Zr,d.UrlMatcher=jr,d.UrlMatcherFactory=Dr,d.UrlRouter=Lr,d.UrlRouterProvider=Pi,d.UrlRuleFactory=Ur,d.UrlRules=Kr,d.UrlService=tn,d.ViewService=Br,d._extend=Ot,d._inArray=Y,d._pushTo=et,d._removeFrom=X,d.all=u,d.allTrueR=vt,d.ancestors=ot,d.and=i,d.any=f,d.anyTrueR=dt,d.applyPairs=Tt,d.arrayTuples=Ct,d.assertFn=Rt,d.assertMap=$t,d.assertPredicate=bt,d.beforeAfterSubstr=Kt,d.buildUrl=Nn,d.compose=r,d.copy=kt,d.core=hi,d.createProxyFunctions=J,d.curry=s,d.default="ui.router",d.defaultResolvePolicy=Ne,d.defaultTransOpts=Pn,d.defaults=nt,d.deregAll=rt,d.eq=a,d.equals=G,d.extend=B,d.filter=ct,d.find=ft,d.flatten=St,d.flattenR=yt,d.fnToString=zt,d.forEach=M,d.fromJson=N,d.functionToString=Gt,d.getLocals=Bi,d.getNg1ViewConfigFactory=pi,d.getParams=Hn,d.hashLocationPlugin=ui,d.hostRegex=Xt,d.identity=z,d.inArray=K,d.inherit=Q,d.invoke=v,d.is=h,d.isArray=x,d.isDate=j,d.isDefined=E,d.isFunction=T,d.isInjectable=H,d.isNull=_,d.isNullOrUndefined=C,d.isNumber=P,d.isObject=O,d.isPromise=A,d.isRegExp=V,d.isString=k,d.isUndefined=b,d.joinNeighborsR=ie,d.kebobString=Bt,d.keyValsToObjectR=Vn,d.locationPluginFactory=Ln,d.makeEvent=$r,d.makeStub=I,d.map=ht,d.mapObj=lt,d.matchState=_r,d.maxLength=Lt,d.memoryLocationPlugin=ci,d.mergeR=it,d.ng1ViewsBuilder=di,d.noop=W,d.not=l,d.omit=ut,d.or=o,d.padString=Mt,d.pairs=Et,d.parse=R,d.parseUrl=Fn,d.pattern=g,d.pick=at,d.pipe=c,d.pluck=st,d.prop=m,d.propEq=y,d.pushR=gt,d.pushStateLocationPlugin=si,d.pushTo=tt,d.removeFrom=Z,d.resolvablesBuilder=ir,d.resolvePolicies=Fe,d.root=U,d.services=D,d.servicesPlugin=ai,d.silenceUncaughtInPromise=jt,d.silentRejection=Vt,d.splitEqual=re,d.splitHash=te,d.splitOnDelim=ne,d.splitQuery=ee,d.stringify=Qt,d.stripLastPathElement=Yt,d.tail=Pt,d.toJson=L,d.trace=we,d.trimHashVal=Zt,d.uniqR=wt,d.unnest=_t,d.unnestR=mt,d.val=p,d.values=pt,d.watchDigests=Ui,Object.defineProperty(d,"__esModule",{value:!0})});
//# sourceMappingURL=angular-ui-router.min.js.map