diff --git a/dist/vue-router.common.js b/dist/vue-router.common.js index 993cf06b8..84ca9e3b6 100644 --- a/dist/vue-router.common.js +++ b/dist/vue-router.common.js @@ -1,5 +1,5 @@ /** - * vue-router v2.5.1 + * vue-router v2.5.2 * (c) 2017 Evan You * @license MIT */ @@ -28,7 +28,7 @@ var View = { default: 'default' } }, - render: function render (h, ref) { + render: function render (_, ref) { var props = ref.props; var children = ref.children; var parent = ref.parent; @@ -36,6 +36,9 @@ var View = { data.routerView = true; + // directly use parent context's createElement() function + // so that components rendered by router-view can resolve named slots + var h = parent.$createElement; var name = props.name; var route = parent.$route; var cache = parent._routerViewCache || (parent._routerViewCache = {}); @@ -1686,7 +1689,7 @@ History.prototype.confirmTransition = function confirmTransition (route, onCompl var current = this.current; var abort = function (err) { - if (err instanceof Error) { + if (isError(err)) { if (this$1.errorCbs.length) { this$1.errorCbs.forEach(function (cb) { cb(err); }); } else { @@ -1730,7 +1733,7 @@ History.prototype.confirmTransition = function confirmTransition (route, onCompl } try { hook(route, current, function (to) { - if (to === false || to instanceof Error) { + if (to === false || isError(to)) { // next(false) -> abort navigation, ensure current URL this$1.ensureURL(true); abort(to); @@ -1950,7 +1953,7 @@ function resolveAsyncComponents (matched) { var msg = "Failed to resolve async component " + key + ": " + reason; process.env.NODE_ENV !== 'production' && warn(false, msg); if (!error) { - error = reason instanceof Error + error = isError(reason) ? reason : new Error(msg); next(error); @@ -2011,6 +2014,10 @@ function once (fn) { } } +function isError (err) { + return Object.prototype.toString.call(err).indexOf('Error') > -1 +} + /* */ @@ -2446,7 +2453,7 @@ function createHref (base, fullPath, mode) { } VueRouter.install = install; -VueRouter.version = '2.5.1'; +VueRouter.version = '2.5.2'; if (inBrowser && window.Vue) { window.Vue.use(VueRouter); diff --git a/dist/vue-router.esm.js b/dist/vue-router.esm.js index c18082a5d..cb0eff29d 100644 --- a/dist/vue-router.esm.js +++ b/dist/vue-router.esm.js @@ -1,5 +1,5 @@ /** - * vue-router v2.5.1 + * vue-router v2.5.2 * (c) 2017 Evan You * @license MIT */ @@ -26,7 +26,7 @@ var View = { default: 'default' } }, - render: function render (h, ref) { + render: function render (_, ref) { var props = ref.props; var children = ref.children; var parent = ref.parent; @@ -34,6 +34,9 @@ var View = { data.routerView = true; + // directly use parent context's createElement() function + // so that components rendered by router-view can resolve named slots + var h = parent.$createElement; var name = props.name; var route = parent.$route; var cache = parent._routerViewCache || (parent._routerViewCache = {}); @@ -1684,7 +1687,7 @@ History.prototype.confirmTransition = function confirmTransition (route, onCompl var current = this.current; var abort = function (err) { - if (err instanceof Error) { + if (isError(err)) { if (this$1.errorCbs.length) { this$1.errorCbs.forEach(function (cb) { cb(err); }); } else { @@ -1728,7 +1731,7 @@ History.prototype.confirmTransition = function confirmTransition (route, onCompl } try { hook(route, current, function (to) { - if (to === false || to instanceof Error) { + if (to === false || isError(to)) { // next(false) -> abort navigation, ensure current URL this$1.ensureURL(true); abort(to); @@ -1948,7 +1951,7 @@ function resolveAsyncComponents (matched) { var msg = "Failed to resolve async component " + key + ": " + reason; process.env.NODE_ENV !== 'production' && warn(false, msg); if (!error) { - error = reason instanceof Error + error = isError(reason) ? reason : new Error(msg); next(error); @@ -2009,6 +2012,10 @@ function once (fn) { } } +function isError (err) { + return Object.prototype.toString.call(err).indexOf('Error') > -1 +} + /* */ @@ -2444,7 +2451,7 @@ function createHref (base, fullPath, mode) { } VueRouter.install = install; -VueRouter.version = '2.5.1'; +VueRouter.version = '2.5.2'; if (inBrowser && window.Vue) { window.Vue.use(VueRouter); diff --git a/dist/vue-router.js b/dist/vue-router.js index 975b6aba7..b003e5bfd 100644 --- a/dist/vue-router.js +++ b/dist/vue-router.js @@ -1,5 +1,5 @@ /** - * vue-router v2.5.1 + * vue-router v2.5.2 * (c) 2017 Evan You * @license MIT */ @@ -32,7 +32,7 @@ var View = { default: 'default' } }, - render: function render (h, ref) { + render: function render (_, ref) { var props = ref.props; var children = ref.children; var parent = ref.parent; @@ -40,6 +40,9 @@ var View = { data.routerView = true; + // directly use parent context's createElement() function + // so that components rendered by router-view can resolve named slots + var h = parent.$createElement; var name = props.name; var route = parent.$route; var cache = parent._routerViewCache || (parent._routerViewCache = {}); @@ -1690,7 +1693,7 @@ History.prototype.confirmTransition = function confirmTransition (route, onCompl var current = this.current; var abort = function (err) { - if (err instanceof Error) { + if (isError(err)) { if (this$1.errorCbs.length) { this$1.errorCbs.forEach(function (cb) { cb(err); }); } else { @@ -1734,7 +1737,7 @@ History.prototype.confirmTransition = function confirmTransition (route, onCompl } try { hook(route, current, function (to) { - if (to === false || to instanceof Error) { + if (to === false || isError(to)) { // next(false) -> abort navigation, ensure current URL this$1.ensureURL(true); abort(to); @@ -1954,7 +1957,7 @@ function resolveAsyncComponents (matched) { var msg = "Failed to resolve async component " + key + ": " + reason; "development" !== 'production' && warn(false, msg); if (!error) { - error = reason instanceof Error + error = isError(reason) ? reason : new Error(msg); next(error); @@ -2015,6 +2018,10 @@ function once (fn) { } } +function isError (err) { + return Object.prototype.toString.call(err).indexOf('Error') > -1 +} + /* */ @@ -2450,7 +2457,7 @@ function createHref (base, fullPath, mode) { } VueRouter.install = install; -VueRouter.version = '2.5.1'; +VueRouter.version = '2.5.2'; if (inBrowser && window.Vue) { window.Vue.use(VueRouter); diff --git a/dist/vue-router.min.js b/dist/vue-router.min.js index 73c540db4..5df8a80b3 100644 --- a/dist/vue-router.min.js +++ b/dist/vue-router.min.js @@ -1,6 +1,6 @@ /** - * vue-router v2.5.1 + * vue-router v2.5.2 * (c) 2017 Evan You * @license MIT */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueRouter=e()}(this,function(){"use strict";function t(t,e){}function e(t,e){switch(typeof e){case"undefined":return;case"object":return e;case"function":return e(t);case"boolean":return e?t.params:void 0}}function n(t,e,n){void 0===e&&(e={});var o,i=n||r;try{o=i(t||"")}catch(t){o={}}for(var a in e){var u=e[a];o[a]=Array.isArray(u)?u.slice():u}return o}function r(t){var e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach(function(t){var n=t.replace(/\+/g," ").split("="),r=_t(n.shift()),o=n.length>0?_t(n.join("=")):null;void 0===e[r]?e[r]=o:Array.isArray(e[r])?e[r].push(o):e[r]=[e[r],o]}),e):e}function o(t){var e=t?Object.keys(t).map(function(e){var n=t[e];if(void 0===n)return"";if(null===n)return Tt(e);if(Array.isArray(n)){var r=[];return n.slice().forEach(function(t){void 0!==t&&(null===t?r.push(Tt(e)):r.push(Tt(e)+"="+Tt(t)))}),r.join("&")}return Tt(e)+"="+Tt(n)}).filter(function(t){return t.length>0}).join("&"):null;return e?"?"+e:""}function i(t,e,n,r){var o=r&&r.options.stringifyQuery,i={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:e.query||{},params:e.params||{},fullPath:u(e,o),matched:t?a(t):[]};return n&&(i.redirectedFrom=u(n,o)),Object.freeze(i)}function a(t){for(var e=[];t;)e.unshift(t),t=t.parent;return e}function u(t,e){var n=t.path,r=t.query;void 0===r&&(r={});var i=t.hash;void 0===i&&(i="");var a=e||o;return(n||"/")+a(r)+i}function c(t,e){return e===St?t===e:!!e&&(t.path&&e.path?t.path.replace($t,"")===e.path.replace($t,"")&&t.hash===e.hash&&s(t.query,e.query):!(!t.name||!e.name)&&(t.name===e.name&&t.hash===e.hash&&s(t.query,e.query)&&s(t.params,e.params)))}function s(t,e){void 0===t&&(t={}),void 0===e&&(e={});var n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(function(n){return String(t[n])===String(e[n])})}function p(t,e){return 0===t.path.replace($t,"/").indexOf(e.path.replace($t,"/"))&&(!e.hash||t.hash===e.hash)&&f(t.query,e.query)}function f(t,e){for(var n in e)if(!(n in t))return!1;return!0}function h(t){if(!(t.metaKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||void 0!==t.button&&0!==t.button)){if(t.currentTarget&&t.currentTarget.getAttribute){var e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function l(t){if(t)for(var e,n=0;n=0&&(e=t.slice(r),t=t.slice(0,r));var o=t.indexOf("?");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{path:t,query:n,hash:e}}function m(t){return t.replace(/\/\//g,"/")}function g(t,e){for(var n,r=[],o=0,i=0,a="",u=e&&e.delimiter||"/";null!=(n=Dt.exec(t));){var c=n[0],s=n[1],p=n.index;if(a+=t.slice(i,p),i=p+c.length,s)a+=s[1];else{var f=t[i],h=n[2],l=n[3],d=n[4],y=n[5],v=n[6],m=n[7];a&&(r.push(a),a="");var g=null!=h&&null!=f&&f!==h,w="+"===v||"*"===v,b="?"===v||"*"===v,x=n[2]||u,k=d||y;r.push({name:l||o++,prefix:h||"",delimiter:x,optional:b,repeat:w,partial:g,asterisk:!!m,pattern:k?R(k):m?".*":"[^"+E(x)+"]+?"})}}return i-1&&(o.params[h]=n.params[h]);if(a)return o.path=S(a.path,o.params,'named route "'+i+'"'),u(a,o,r)}else if(o.path){o.params={};for(var l=0;l=t.length?n():t[o]?e(t[o],function(){r(o+1)}):r(o+1)};r(0)}function nt(t){if(!t)if(Ut){var e=document.querySelector("base");t=e&&e.getAttribute("href")||"/"}else t="/";return"/"!==t.charAt(0)&&(t="/"+t),t.replace(/\/$/,"")}function rt(t,e){var n,r=Math.max(t.length,e.length);for(n=0;n=0?e:0)+"#"+t)}function kt(t,e){return t.push(e),function(){var n=t.indexOf(e);n>-1&&t.splice(n,1)}}function Et(t,e,n){var r="hash"===n?"#"+e:e;return t?m(t+"/"+r):r}var Rt,Ct={name:"router-view",functional:!0,props:{name:{type:String,default:"default"}},render:function(t,n){var r=n.props,o=n.children,i=n.parent,a=n.data;a.routerView=!0;for(var u=r.name,c=i.$route,s=i._routerViewCache||(i._routerViewCache={}),p=0,f=!1;i;)i.$vnode&&i.$vnode.data.routerView&&p++,i._inactive&&(f=!0),i=i.$parent;if(a.routerViewDepth=p,f)return t(s[u],a,o);var h=c.matched[p];if(!h)return s[u]=null,t();var l=s[u]=h.components[u];return a.registerRouteInstance=function(t,e){h.instances[u]!==t&&(h.instances[u]=e)},(a.hook||(a.hook={})).prepatch=function(t,e){h.instances[u]=e.componentInstance},a.props=e(c,h.props&&h.props[u]),t(l,a,o)}},Ot=/[!'()*]/g,At=function(t){return"%"+t.charCodeAt(0).toString(16)},jt=/%2C/g,Tt=function(t){return encodeURIComponent(t).replace(Ot,At).replace(jt,",")},_t=decodeURIComponent,$t=/\/?$/,St=i(null,{path:"/"}),qt=[String,Object],Lt=[String,Array],Pt={name:"router-link",props:{to:{type:qt,required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,event:{type:Lt,default:"click"}},render:function(t){var e=this,n=this.$router,r=this.$route,o=n.resolve(this.to,r,this.append),a=o.location,u=o.route,s=o.href,f={},d=n.options.linkActiveClass,y=n.options.linkExactActiveClass,v=null==d?"router-link-active":d,m=null==y?"router-link-exact-active":y,g=null==this.activeClass?v:this.activeClass,w=null==this.exactActiveClass?m:this.exactActiveClass,b=a.path?i(null,a,null,n):u;f[w]=c(r,b),f[g]=this.exact?f[w]:p(r,b);var x=function(t){h(t)&&(e.replace?n.replace(a):n.push(a))},k={click:h};Array.isArray(this.event)?this.event.forEach(function(t){k[t]=x}):k[this.event]=x;var E={class:f};if("a"===this.tag)E.on=k,E.attrs={href:s};else{var R=l(this.$slots.default);if(R){R.isStatic=!1;var C=Rt.util.extend,O=R.data=C({},R.data);O.on=k;var A=R.data.attrs=C({},R.data.attrs);A.href=s}else E.on=k}return t(this.tag,E,this.$slots.default)}},Ut="undefined"!=typeof window,Ht=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},It=Ht,Vt=$,zt=g,Mt=w,Bt=k,Ft=_,Dt=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");Vt.parse=zt,Vt.compile=Mt,Vt.tokensToFunction=Bt,Vt.tokensToRegExp=Ft;var Kt=Object.create(null),Jt=Object.create(null),Nt=Ut&&function(){var t=window.navigator.userAgent;return(t.indexOf("Android 2.")===-1&&t.indexOf("Android 4.0")===-1||t.indexOf("Mobile Safari")===-1||t.indexOf("Chrome")!==-1||t.indexOf("Windows Phone")!==-1)&&(window.history&&"pushState"in window.history)}(),Qt=Ut&&window.performance&&window.performance.now?window.performance:Date,Xt=Y(),Yt=function(t,e){this.router=t,this.base=nt(e),this.current=St,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[]};Yt.prototype.listen=function(t){this.cb=t},Yt.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},Yt.prototype.onError=function(t){this.errorCbs.push(t)},Yt.prototype.transitionTo=function(t,e,n){var r=this,o=this.router.match(t,this.current);this.confirmTransition(o,function(){r.updateRoute(o),e&&e(o),r.ensureURL(),r.ready||(r.ready=!0,r.readyCbs.forEach(function(t){t(o)}))},function(t){n&&n(t),t&&!r.ready&&(r.ready=!0,r.readyErrorCbs.forEach(function(e){e(t)}))})},Yt.prototype.confirmTransition=function(e,n,r){var o=this,i=this.current,a=function(e){e instanceof Error&&(o.errorCbs.length?o.errorCbs.forEach(function(t){t(e)}):(t(!1,"uncaught error during route navigation:"),console.error(e))),r&&r(e)};if(c(e,i)&&e.matched.length===i.matched.length)return this.ensureURL(),a();var u=rt(this.current.matched,e.matched),s=u.updated,p=u.deactivated,f=u.activated,h=[].concat(at(p),this.router.beforeHooks,ut(s),f.map(function(t){return t.beforeEnter}),ht(f));this.pending=e;var l=function(t,n){if(o.pending!==e)return a();try{t(e,i,function(t){t===!1||t instanceof Error?(o.ensureURL(!0),a(t)):"string"==typeof t||"object"==typeof t&&("string"==typeof t.path||"string"==typeof t.name)?(a(),"object"==typeof t&&t.replace?o.replace(t):o.push(t)):n(t)})}catch(t){a(t)}};et(h,l,function(){var t=[],r=function(){return o.current===e},i=st(f,t,r),u=i.concat(o.router.resolveHooks);et(u,l,function(){return o.pending!==e?a():(o.pending=null,n(e),void(o.router.app&&o.router.app.$nextTick(function(){t.forEach(function(t){t()})})))})})},Yt.prototype.updateRoute=function(t){var e=this.current;this.current=t,this.cb&&this.cb(t),this.router.afterHooks.forEach(function(n){n&&n(t,e)})};var Wt=function(t){function e(e,n){var r=this;t.call(this,e,n);var o=e.options.scrollBehavior;o&&B(),window.addEventListener("popstate",function(t){r.transitionTo(vt(r.base),function(t){o&&F(e,t,r.current,!0)})})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.go=function(t){window.history.go(t)},e.prototype.push=function(t,e,n){var r=this,o=this,i=o.current;this.transitionTo(t,function(t){Z(m(r.base+t.fullPath)),F(r.router,t,i,!1),e&&e(t)},n)},e.prototype.replace=function(t,e,n){var r=this,o=this,i=o.current;this.transitionTo(t,function(t){tt(m(r.base+t.fullPath)),F(r.router,t,i,!1),e&&e(t)},n)},e.prototype.ensureURL=function(t){if(vt(this.base)!==this.current.fullPath){var e=m(this.base+this.current.fullPath);t?Z(e):tt(e)}},e.prototype.getCurrentLocation=function(){return vt(this.base)},e}(Yt),Gt=function(t){function e(e,n,r){t.call(this,e,n),r&&mt(this.base)||gt()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this;window.addEventListener("hashchange",function(){gt()&&t.transitionTo(wt(),function(t){xt(t.fullPath)})})},e.prototype.push=function(t,e,n){this.transitionTo(t,function(t){bt(t.fullPath),e&&e(t)},n)},e.prototype.replace=function(t,e,n){this.transitionTo(t,function(t){xt(t.fullPath),e&&e(t)},n)},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;wt()!==e&&(t?bt(e):xt(e))},e.prototype.getCurrentLocation=function(){return wt()},e}(Yt),Zt=function(t){function e(e,n){t.call(this,e,n),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t,e,n){var r=this;this.transitionTo(t,function(t){r.stack=r.stack.slice(0,r.index+1).concat(t),r.index++,e&&e(t)},n)},e.prototype.replace=function(t,e,n){var r=this;this.transitionTo(t,function(t){r.stack=r.stack.slice(0,r.index).concat(t),e&&e(t)},n)},e.prototype.go=function(t){var e=this,n=this.index+t;if(!(n<0||n>=this.stack.length)){var r=this.stack[n];this.confirmTransition(r,function(){e.index=n,e.updateRoute(r)})}},e.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},e.prototype.ensureURL=function(){},e}(Yt),te=function(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=V(t.routes||[],this);var e=t.mode||"hash";switch(this.fallback="history"===e&&!Nt,this.fallback&&(e="hash"),Ut||(e="abstract"),this.mode=e,e){case"history":this.history=new Wt(this,t.base);break;case"hash":this.history=new Gt(this,t.base,this.fallback);break;case"abstract":this.history=new Zt(this,t.base)}},ee={currentRoute:{}};return te.prototype.match=function(t,e,n){return this.matcher.match(t,e,n)},ee.currentRoute.get=function(){return this.history&&this.history.current},te.prototype.init=function(t){var e=this;if(this.apps.push(t),!this.app){this.app=t;var n=this.history;if(n instanceof Wt)n.transitionTo(n.getCurrentLocation());else if(n instanceof Gt){var r=function(){n.setupListeners()};n.transitionTo(n.getCurrentLocation(),r,r)}n.listen(function(t){e.apps.forEach(function(e){e._route=t})})}},te.prototype.beforeEach=function(t){return kt(this.beforeHooks,t)},te.prototype.beforeResolve=function(t){return kt(this.resolveHooks,t)},te.prototype.afterEach=function(t){return kt(this.afterHooks,t)},te.prototype.onReady=function(t,e){this.history.onReady(t,e)},te.prototype.onError=function(t){this.history.onError(t)},te.prototype.push=function(t,e,n){this.history.push(t,e,n)},te.prototype.replace=function(t,e,n){this.history.replace(t,e,n)},te.prototype.go=function(t){this.history.go(t)},te.prototype.back=function(){this.go(-1)},te.prototype.forward=function(){this.go(1)},te.prototype.getMatchedComponents=function(t){var e=t?this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map(function(t){return Object.keys(t.components).map(function(e){return t.components[e]})})):[]},te.prototype.resolve=function(t,e,n){var r=H(t,e||this.history.current,n,this),o=this.match(r,e),i=o.redirectedFrom||o.fullPath,a=this.history.base,u=Et(a,i,this.mode);return{location:r,route:o,href:u,normalizedTo:r,resolved:o}},te.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==St&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(te.prototype,ee),te.install=d,te.version="2.5.1",Ut&&window.Vue&&window.Vue.use(te),te}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueRouter=e()}(this,function(){"use strict";function t(t,e){}function e(t,e){switch(typeof e){case"undefined":return;case"object":return e;case"function":return e(t);case"boolean":return e?t.params:void 0}}function n(t,e,n){void 0===e&&(e={});var o,i=n||r;try{o=i(t||"")}catch(t){o={}}for(var a in e){var u=e[a];o[a]=Array.isArray(u)?u.slice():u}return o}function r(t){var e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach(function(t){var n=t.replace(/\+/g," ").split("="),r=$t(n.shift()),o=n.length>0?$t(n.join("=")):null;void 0===e[r]?e[r]=o:Array.isArray(e[r])?e[r].push(o):e[r]=[e[r],o]}),e):e}function o(t){var e=t?Object.keys(t).map(function(e){var n=t[e];if(void 0===n)return"";if(null===n)return _t(e);if(Array.isArray(n)){var r=[];return n.slice().forEach(function(t){void 0!==t&&(null===t?r.push(_t(e)):r.push(_t(e)+"="+_t(t)))}),r.join("&")}return _t(e)+"="+_t(n)}).filter(function(t){return t.length>0}).join("&"):null;return e?"?"+e:""}function i(t,e,n,r){var o=r&&r.options.stringifyQuery,i={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:e.query||{},params:e.params||{},fullPath:u(e,o),matched:t?a(t):[]};return n&&(i.redirectedFrom=u(n,o)),Object.freeze(i)}function a(t){for(var e=[];t;)e.unshift(t),t=t.parent;return e}function u(t,e){var n=t.path,r=t.query;void 0===r&&(r={});var i=t.hash;void 0===i&&(i="");var a=e||o;return(n||"/")+a(r)+i}function c(t,e){return e===qt?t===e:!!e&&(t.path&&e.path?t.path.replace(St,"")===e.path.replace(St,"")&&t.hash===e.hash&&s(t.query,e.query):!(!t.name||!e.name)&&(t.name===e.name&&t.hash===e.hash&&s(t.query,e.query)&&s(t.params,e.params)))}function s(t,e){void 0===t&&(t={}),void 0===e&&(e={});var n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(function(n){return String(t[n])===String(e[n])})}function p(t,e){return 0===t.path.replace(St,"/").indexOf(e.path.replace(St,"/"))&&(!e.hash||t.hash===e.hash)&&f(t.query,e.query)}function f(t,e){for(var n in e)if(!(n in t))return!1;return!0}function h(t){if(!(t.metaKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||void 0!==t.button&&0!==t.button)){if(t.currentTarget&&t.currentTarget.getAttribute){var e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function l(t){if(t)for(var e,n=0;n=0&&(e=t.slice(r),t=t.slice(0,r));var o=t.indexOf("?");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{path:t,query:n,hash:e}}function m(t){return t.replace(/\/\//g,"/")}function g(t,e){for(var n,r=[],o=0,i=0,a="",u=e&&e.delimiter||"/";null!=(n=Kt.exec(t));){var c=n[0],s=n[1],p=n.index;if(a+=t.slice(i,p),i=p+c.length,s)a+=s[1];else{var f=t[i],h=n[2],l=n[3],d=n[4],y=n[5],v=n[6],m=n[7];a&&(r.push(a),a="");var g=null!=h&&null!=f&&f!==h,w="+"===v||"*"===v,b="?"===v||"*"===v,x=n[2]||u,k=d||y;r.push({name:l||o++,prefix:h||"",delimiter:x,optional:b,repeat:w,partial:g,asterisk:!!m,pattern:k?O(k):m?".*":"[^"+E(x)+"]+?"})}}return i-1&&(o.params[h]=n.params[h]);if(a)return o.path=S(a.path,o.params,'named route "'+i+'"'),u(a,o,r)}else if(o.path){o.params={};for(var l=0;l=t.length?n():t[o]?e(t[o],function(){r(o+1)}):r(o+1)};r(0)}function nt(t){if(!t)if(Ht){var e=document.querySelector("base");t=e&&e.getAttribute("href")||"/"}else t="/";return"/"!==t.charAt(0)&&(t="/"+t),t.replace(/\/$/,"")}function rt(t,e){var n,r=Math.max(t.length,e.length);for(n=0;n-1}function mt(t){var e=window.location.pathname;return t&&0===e.indexOf(t)&&(e=e.slice(t.length)),(e||"/")+window.location.search+window.location.hash}function gt(t){var e=mt(t);if(!/^\/#/.test(e))return window.location.replace(m(t+"/#"+e)),!0}function wt(){var t=bt();return"/"===t.charAt(0)||(kt("/"+t),!1)}function bt(){var t=window.location.href,e=t.indexOf("#");return e===-1?"":t.slice(e+1)}function xt(t){window.location.hash=t}function kt(t){var e=window.location.href.indexOf("#");window.location.replace(window.location.href.slice(0,e>=0?e:0)+"#"+t)}function Et(t,e){return t.push(e),function(){var n=t.indexOf(e);n>-1&&t.splice(n,1)}}function Ot(t,e,n){var r="hash"===n?"#"+e:e;return t?m(t+"/"+r):r}var Rt,Ct={name:"router-view",functional:!0,props:{name:{type:String,default:"default"}},render:function(t,n){var r=n.props,o=n.children,i=n.parent,a=n.data;a.routerView=!0;for(var u=i.$createElement,c=r.name,s=i.$route,p=i._routerViewCache||(i._routerViewCache={}),f=0,h=!1;i;)i.$vnode&&i.$vnode.data.routerView&&f++,i._inactive&&(h=!0),i=i.$parent;if(a.routerViewDepth=f,h)return u(p[c],a,o);var l=s.matched[f];if(!l)return p[c]=null,u();var d=p[c]=l.components[c];return a.registerRouteInstance=function(t,e){l.instances[c]!==t&&(l.instances[c]=e)},(a.hook||(a.hook={})).prepatch=function(t,e){l.instances[c]=e.componentInstance},a.props=e(s,l.props&&l.props[c]),u(d,a,o)}},At=/[!'()*]/g,jt=function(t){return"%"+t.charCodeAt(0).toString(16)},Tt=/%2C/g,_t=function(t){return encodeURIComponent(t).replace(At,jt).replace(Tt,",")},$t=decodeURIComponent,St=/\/?$/,qt=i(null,{path:"/"}),Lt=[String,Object],Pt=[String,Array],Ut={name:"router-link",props:{to:{type:Lt,required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,event:{type:Pt,default:"click"}},render:function(t){var e=this,n=this.$router,r=this.$route,o=n.resolve(this.to,r,this.append),a=o.location,u=o.route,s=o.href,f={},d=n.options.linkActiveClass,y=n.options.linkExactActiveClass,v=null==d?"router-link-active":d,m=null==y?"router-link-exact-active":y,g=null==this.activeClass?v:this.activeClass,w=null==this.exactActiveClass?m:this.exactActiveClass,b=a.path?i(null,a,null,n):u;f[w]=c(r,b),f[g]=this.exact?f[w]:p(r,b);var x=function(t){h(t)&&(e.replace?n.replace(a):n.push(a))},k={click:h};Array.isArray(this.event)?this.event.forEach(function(t){k[t]=x}):k[this.event]=x;var E={class:f};if("a"===this.tag)E.on=k,E.attrs={href:s};else{var O=l(this.$slots.default);if(O){O.isStatic=!1;var R=Rt.util.extend,C=O.data=R({},O.data);C.on=k;var A=O.data.attrs=R({},O.data.attrs);A.href=s}else E.on=k}return t(this.tag,E,this.$slots.default)}},Ht="undefined"!=typeof window,It=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},Vt=It,zt=$,Mt=g,Bt=w,Ft=k,Dt=_,Kt=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");zt.parse=Mt,zt.compile=Bt,zt.tokensToFunction=Ft,zt.tokensToRegExp=Dt;var Jt=Object.create(null),Nt=Object.create(null),Qt=Ht&&function(){var t=window.navigator.userAgent;return(t.indexOf("Android 2.")===-1&&t.indexOf("Android 4.0")===-1||t.indexOf("Mobile Safari")===-1||t.indexOf("Chrome")!==-1||t.indexOf("Windows Phone")!==-1)&&(window.history&&"pushState"in window.history)}(),Xt=Ht&&window.performance&&window.performance.now?window.performance:Date,Yt=Y(),Wt=function(t,e){this.router=t,this.base=nt(e),this.current=qt,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[]};Wt.prototype.listen=function(t){this.cb=t},Wt.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},Wt.prototype.onError=function(t){this.errorCbs.push(t)},Wt.prototype.transitionTo=function(t,e,n){var r=this,o=this.router.match(t,this.current);this.confirmTransition(o,function(){r.updateRoute(o),e&&e(o),r.ensureURL(),r.ready||(r.ready=!0,r.readyCbs.forEach(function(t){t(o)}))},function(t){n&&n(t),t&&!r.ready&&(r.ready=!0,r.readyErrorCbs.forEach(function(e){e(t)}))})},Wt.prototype.confirmTransition=function(e,n,r){var o=this,i=this.current,a=function(e){vt(e)&&(o.errorCbs.length?o.errorCbs.forEach(function(t){t(e)}):(t(!1,"uncaught error during route navigation:"),console.error(e))),r&&r(e)};if(c(e,i)&&e.matched.length===i.matched.length)return this.ensureURL(),a();var u=rt(this.current.matched,e.matched),s=u.updated,p=u.deactivated,f=u.activated,h=[].concat(at(p),this.router.beforeHooks,ut(s),f.map(function(t){return t.beforeEnter}),ht(f));this.pending=e;var l=function(t,n){if(o.pending!==e)return a();try{t(e,i,function(t){t===!1||vt(t)?(o.ensureURL(!0),a(t)):"string"==typeof t||"object"==typeof t&&("string"==typeof t.path||"string"==typeof t.name)?(a(),"object"==typeof t&&t.replace?o.replace(t):o.push(t)):n(t)})}catch(t){a(t)}};et(h,l,function(){var t=[],r=function(){return o.current===e},i=st(f,t,r),u=i.concat(o.router.resolveHooks);et(u,l,function(){return o.pending!==e?a():(o.pending=null,n(e),void(o.router.app&&o.router.app.$nextTick(function(){t.forEach(function(t){t()})})))})})},Wt.prototype.updateRoute=function(t){var e=this.current;this.current=t,this.cb&&this.cb(t),this.router.afterHooks.forEach(function(n){n&&n(t,e)})};var Gt=function(t){function e(e,n){var r=this;t.call(this,e,n);var o=e.options.scrollBehavior;o&&B(),window.addEventListener("popstate",function(t){r.transitionTo(mt(r.base),function(t){o&&F(e,t,r.current,!0)})})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.go=function(t){window.history.go(t)},e.prototype.push=function(t,e,n){var r=this,o=this,i=o.current;this.transitionTo(t,function(t){Z(m(r.base+t.fullPath)),F(r.router,t,i,!1),e&&e(t)},n)},e.prototype.replace=function(t,e,n){var r=this,o=this,i=o.current;this.transitionTo(t,function(t){tt(m(r.base+t.fullPath)),F(r.router,t,i,!1),e&&e(t)},n)},e.prototype.ensureURL=function(t){if(mt(this.base)!==this.current.fullPath){var e=m(this.base+this.current.fullPath);t?Z(e):tt(e)}},e.prototype.getCurrentLocation=function(){return mt(this.base)},e}(Wt),Zt=function(t){function e(e,n,r){t.call(this,e,n),r&>(this.base)||wt()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this;window.addEventListener("hashchange",function(){wt()&&t.transitionTo(bt(),function(t){kt(t.fullPath)})})},e.prototype.push=function(t,e,n){this.transitionTo(t,function(t){xt(t.fullPath),e&&e(t)},n)},e.prototype.replace=function(t,e,n){this.transitionTo(t,function(t){kt(t.fullPath),e&&e(t)},n)},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;bt()!==e&&(t?xt(e):kt(e))},e.prototype.getCurrentLocation=function(){return bt()},e}(Wt),te=function(t){function e(e,n){t.call(this,e,n),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t,e,n){var r=this;this.transitionTo(t,function(t){r.stack=r.stack.slice(0,r.index+1).concat(t),r.index++,e&&e(t)},n)},e.prototype.replace=function(t,e,n){var r=this;this.transitionTo(t,function(t){r.stack=r.stack.slice(0,r.index).concat(t),e&&e(t)},n)},e.prototype.go=function(t){var e=this,n=this.index+t;if(!(n<0||n>=this.stack.length)){var r=this.stack[n];this.confirmTransition(r,function(){e.index=n,e.updateRoute(r)})}},e.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},e.prototype.ensureURL=function(){},e}(Wt),ee=function(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=V(t.routes||[],this);var e=t.mode||"hash";switch(this.fallback="history"===e&&!Qt,this.fallback&&(e="hash"),Ht||(e="abstract"),this.mode=e,e){case"history":this.history=new Gt(this,t.base);break;case"hash":this.history=new Zt(this,t.base,this.fallback);break;case"abstract":this.history=new te(this,t.base)}},ne={currentRoute:{}};return ee.prototype.match=function(t,e,n){return this.matcher.match(t,e,n)},ne.currentRoute.get=function(){return this.history&&this.history.current},ee.prototype.init=function(t){var e=this;if(this.apps.push(t),!this.app){this.app=t;var n=this.history;if(n instanceof Gt)n.transitionTo(n.getCurrentLocation());else if(n instanceof Zt){var r=function(){n.setupListeners()};n.transitionTo(n.getCurrentLocation(),r,r)}n.listen(function(t){e.apps.forEach(function(e){e._route=t})})}},ee.prototype.beforeEach=function(t){return Et(this.beforeHooks,t)},ee.prototype.beforeResolve=function(t){return Et(this.resolveHooks,t)},ee.prototype.afterEach=function(t){return Et(this.afterHooks,t)},ee.prototype.onReady=function(t,e){this.history.onReady(t,e)},ee.prototype.onError=function(t){this.history.onError(t)},ee.prototype.push=function(t,e,n){this.history.push(t,e,n)},ee.prototype.replace=function(t,e,n){this.history.replace(t,e,n)},ee.prototype.go=function(t){this.history.go(t)},ee.prototype.back=function(){this.go(-1)},ee.prototype.forward=function(){this.go(1)},ee.prototype.getMatchedComponents=function(t){var e=t?this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map(function(t){return Object.keys(t.components).map(function(e){return t.components[e]})})):[]},ee.prototype.resolve=function(t,e,n){var r=H(t,e||this.history.current,n,this),o=this.match(r,e),i=o.redirectedFrom||o.fullPath,a=this.history.base,u=Ot(a,i,this.mode);return{location:r,route:o,href:u,normalizedTo:r,resolved:o}},ee.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==qt&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(ee.prototype,ne),ee.install=d,ee.version="2.5.2",Ht&&window.Vue&&window.Vue.use(ee),ee}); \ No newline at end of file