Socket
Socket
Sign inDemoInstall

vue-router

Package Overview
Dependencies
Maintainers
1
Versions
185
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-router - npm Package Compare versions

Comparing version 2.0.0-rc.4 to 2.0.0-rc.5

272

dist/vue-router.js
/**
* vue-router v2.0.0-rc.4
* vue-router v2.0.0-rc.5
* (c) 2016 Evan You

@@ -54,8 +54,9 @@ * @license MIT

var vnode = h(component, data, children)
if (!inactive) {
matched.instances[props.name] = vnode
(data.hook || (data.hook = {})).init = function (vnode) {
matched.instances[props.name] = vnode.child
}
}
return vnode
return h(component, data, children)
}

@@ -142,54 +143,2 @@ }

function isSameRoute (a , b ) {
if (!b) {
return false
} else if (a.path && b.path) {
return (
a.path === b.path &&
a.hash === b.hash &&
isObjectEqual(a.query, b.query)
)
} else if (a.name && b.name) {
return (
a.name === b.name &&
a.hash === b.hash &&
isObjectEqual(a.query, b.query) &&
isObjectEqual(a.params, b.params)
)
} else {
return false
}
}
function isObjectEqual (a, b) {
if ( a === void 0 ) a = {};
if ( b === void 0 ) b = {};
var aKeys = Object.keys(a)
var bKeys = Object.keys(b)
if (aKeys.length !== bKeys.length) {
return false
}
return aKeys.every(function (key) { return String(a[key]) === String(b[key]); })
}
function isIncludedRoute (current , target ) {
return (
current.path.indexOf(target.path) === 0 &&
(!target.hash || current.hash === target.hash) &&
queryIncludes(current.query, target.query)
)
}
function queryIncludes (current , target ) {
for (var key in target) {
if (!(key in current)) {
return false
}
}
return true
}
/* */
function assert (condition , message ) {

@@ -297,2 +246,93 @@ if (!condition) {

function createRoute (
record ,
location ,
redirectedFrom
) {
var route = {
name: location.name || (record && record.name),
meta: (record && record.meta) || {},
path: location.path || '/',
hash: location.hash || '',
query: location.query || {},
params: location.params || {},
fullPath: getFullPath(location),
matched: record ? formatMatch(record) : []
}
if (redirectedFrom) {
route.redirectedFrom = getFullPath(redirectedFrom)
}
return Object.freeze(route)
}
function formatMatch (record ) {
var res = []
while (record) {
res.unshift(record)
record = record.parent
}
return res
}
function getFullPath (ref) {
var path = ref.path;
var query = ref.query; if ( query === void 0 ) query = {};
var hash = ref.hash; if ( hash === void 0 ) hash = '';
return (path || '/') + stringifyQuery(query) + hash
}
var trailingSlashRE = /\/$/
function isSameRoute (a , b ) {
if (!b) {
return false
} else if (a.path && b.path) {
return (
a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
a.hash === b.hash &&
isObjectEqual(a.query, b.query)
)
} else if (a.name && b.name) {
return (
a.name === b.name &&
a.hash === b.hash &&
isObjectEqual(a.query, b.query) &&
isObjectEqual(a.params, b.params)
)
} else {
return false
}
}
function isObjectEqual (a, b) {
if ( a === void 0 ) a = {};
if ( b === void 0 ) b = {};
var aKeys = Object.keys(a)
var bKeys = Object.keys(b)
if (aKeys.length !== bKeys.length) {
return false
}
return aKeys.every(function (key) { return String(a[key]) === String(b[key]); })
}
function isIncludedRoute (current , target ) {
return (
current.path.indexOf(target.path) === 0 &&
(!target.hash || current.hash === target.hash) &&
queryIncludes(current.query, target.query)
)
}
function queryIncludes (current , target ) {
for (var key in target) {
if (!(key in current)) {
return false
}
}
return true
}
/* */
function normalizeLocation (

@@ -327,2 +367,7 @@ raw ,

/* */
// work around weird flow bug
var toTypes = [String, Object]
var Link = {

@@ -332,3 +377,3 @@ name: 'router-link',

to: {
type: [String, Object],
type: toTypes,
required: true

@@ -345,3 +390,3 @@ },

},
render: function render (h) {
render: function render (h ) {
var this$1 = this;

@@ -358,3 +403,3 @@

var activeClass = this.activeClass || router.options.linkActiveClass || 'router-link-active'
var compareTarget = to.path ? to : resolved
var compareTarget = to.path ? createRoute(null, to) : resolved
classes[activeClass] = this.exact

@@ -364,3 +409,3 @@ ? isSameRoute(current, compareTarget)

var data = {
var data = {
class: classes,

@@ -931,2 +976,6 @@ on: {

if (route.children) {
// Warn if route is named and has a default child route.
// If users navigate to this route by name, the default child will
// not be rendered (GH Issue #629)
if ("production" !== 'production') {}
route.children.forEach(function (child) {

@@ -1006,7 +1055,26 @@ addRouteRecord(pathMap, nameMap, child, record)

) {
var originalRedirect = record.redirect
var redirect = typeof originalRedirect === 'function'
? originalRedirect(createRoute(record, location))
: originalRedirect
if (typeof redirect === 'string') {
redirect = { path: redirect }
}
if (!redirect || typeof redirect !== 'object') {
warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))))
return _createRoute(null, location)
}
var re = redirect
var name = re.name;
var path = re.path;
var query = location.query;
var hash = location.hash;
var params = location.params;
var redirect = record.redirect;
var name = redirect && typeof redirect === 'object' && redirect.name
query = re.hasOwnProperty('query') ? re.query : query
hash = re.hasOwnProperty('hash') ? re.hash : hash
params = re.hasOwnProperty('params') ? re.params : params
if (name) {

@@ -1023,11 +1091,11 @@ // resolved named direct

}, undefined, location)
} else if (typeof redirect === 'string') {
} else if (path) {
// 1. resolve relative redirect
var rawPath = resolveRecordPath(redirect, record)
var rawPath = resolveRecordPath(path, record)
// 2. resolve params
var path = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""))
var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""))
// 3. rematch with existing query and hash
return match({
_normalized: true,
path: path,
path: resolvedPath,
query: query,

@@ -1078,23 +1146,2 @@ hash: hash

function createRoute (
record ,
location ,
redirectedFrom
) {
var route = {
name: location.name || (record && record.name),
meta: (record && record.meta) || {},
path: location.path || '/',
hash: location.hash || '',
query: location.query || {},
params: location.params || {},
fullPath: getFullPath(location),
matched: record ? formatMatch(record) : []
}
if (redirectedFrom) {
route.redirectedFrom = getFullPath(redirectedFrom)
}
return Object.freeze(route)
}
function matchRoute (

@@ -1148,11 +1195,2 @@ path ,

function formatMatch (record ) {
var res = []
while (record) {
res.unshift(record)
record = record.parent
}
return res
}
function resolveRecordPath (path , record ) {

@@ -1162,10 +1200,2 @@ return resolvePath(path, record.parent ? record.parent.path : '/', true)

function getFullPath (ref) {
var path = ref.path;
var query = ref.query; if ( query === void 0 ) query = {};
var hash = ref.hash; if ( hash === void 0 ) hash = '';
return (path || '/') + stringifyQuery(query) + hash
}
/* */

@@ -1197,5 +1227,9 @@

} else {
fn(queue[index], function () {
if (queue[index]) {
fn(queue[index], function () {
step(index + 1)
})
} else {
step(index + 1)
})
}
}

@@ -1244,3 +1278,2 @@ }

var postEnterCbs = []
var queue = [].concat(

@@ -1254,14 +1287,14 @@ // in-component leave guards

// async components
resolveAsyncComponents(activated),
// in-component enter guards
extractEnterGuards(activated, postEnterCbs)
).filter(function (_) { return _; })
resolveAsyncComponents(activated)
)
this.pending = route
var redirect = function (location) { return this$1.push(location); }
var iterator = function (hook, next) { return hook(route, redirect, next); }
runQueue(
queue,
function (hook, next) { hook(route, redirect, next) },
function () {
runQueue(queue, iterator, function () {
var postEnterCbs = []
// wait until async components are resolved before
// extracting in-component enter guards
runQueue(extractEnterGuards(activated, postEnterCbs), iterator, function () {
if (isSameRoute(route, this$1.pending)) {

@@ -1274,4 +1307,4 @@ this$1.pending = null

}
}
)
})
})
};

@@ -1344,3 +1377,3 @@

cb && cbs.push(function () {
cb(match.instances[key] && match.instances[key].child)
cb(match.instances[key])
})

@@ -1387,3 +1420,3 @@ })

m.components[key],
m.instances[key] && m.instances[key].child,
m.instances[key],
m, key

@@ -1701,3 +1734,2 @@ ); })

var targetIndex = this.index + n
if (!this.stack) debugger
if (targetIndex < 0 || targetIndex >= this.stack.length) {

@@ -1704,0 +1736,0 @@ return

/**
* vue-router v2.0.0-rc.4
* vue-router v2.0.0-rc.5
* (c) 2016 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,n){if("/"===t.charAt(0))return t;if("?"===t.charAt(0)||"#"===t.charAt(0))return e+t;var r=e.split("/");n&&r[r.length-1]||r.pop();for(var o=t.replace(/^\//,"").split("/"),i=0;i<o.length;i++){var a=o[i];"."!==a&&(".."===a?r.pop():r.push(a))}return""!==r[0]&&r.unshift(""),r.join("/")}function e(t){var e="",n="",r=t.indexOf("#");r>=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 n(t){return t.replace(/\/\//g,"/")}function r(t,e){return!!e&&(t.path&&e.path?t.path===e.path&&t.hash===e.hash&&o(t.query,e.query):!(!t.name||!e.name)&&(t.name===e.name&&t.hash===e.hash&&o(t.query,e.query)&&o(t.params,e.params)))}function o(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 i(t,e){return 0===t.path.indexOf(e.path)&&(!e.hash||t.hash===e.hash)&&a(t.query,e.query)}function a(t,e){for(var n in e)if(!(n in t))return!1;return!0}function u(t,e){if(!t)throw new Error("[vue-router] "+e)}function c(t,e){t||"undefined"!=typeof console&&console.warn("[vue-router] "+e)}function s(t,e){if(void 0===e&&(e={}),t){var n;try{n=p(t)}catch(t){c(!1,t.message),n={}}for(var r in e)n[r]=e[r];return n}return e}function p(t){var e=Object.create(null);return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach(function(t){var n=t.replace(/\+/g," ").split("="),r=W(n.shift()),o=n.length>0?W(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 f(t){var e=t?Object.keys(t).sort().map(function(e){var n=t[e];if(void 0===n)return"";if(null===n)return Y(e);if(Array.isArray(n)){var r=[];return n.slice().forEach(function(t){void 0!==t&&(null===t?r.push(Y(e)):r.push(Y(e)+"="+Y(t)))}),r.join("&")}return Y(e)+"="+Y(n)}).filter(function(t){return t.length>0}).join("&"):null;return e?"?"+e:""}function h(n,r,o){var i="string"==typeof n?{path:n}:n;if(i.name||i._normalized)return i;var a=e(i.path||""),u=r&&r.path||"/",c=a.path?t(a.path,u,o):r&&r.path||"/",p=s(a.query,i.query),f=i.hash||a.hash;return f&&"#"!==f.charAt(0)&&(f="#"+f),{_normalized:!0,path:c,query:p,hash:f}}function l(t){if(t)for(var e,n=0;n<t.length;n++){if(e=t[n],"a"===e.tag)return e;if(e.children&&(e=l(e.children)))return e}}function d(t){d.installed||(d.installed=!0,Object.defineProperty(t.prototype,"$router",{get:function(){return this.$root._router}}),Object.defineProperty(t.prototype,"$route",{get:function(){return this.$root._route}}),t.mixin({beforeCreate:function(){this.$options.router&&(this._router=this.$options.router,this._router.init(this),t.util.defineReactive(this,"_route",this._router.history.current))}}),t.component("router-view",X),t.component("router-link",G))}function y(t){return t&&"object"==typeof t&&"default"in t?t.default:t}function v(t,e){return e={exports:{}},t(e,e.exports),e.exports}function m(t){var e=Object.create(null),n=Object.create(null);return t.forEach(function(t){g(e,n,t)}),{pathMap:e,nameMap:n}}function g(t,e,n,r,o){var i=n.path,a=n.name;u(null!=i,'"path" is required in a route configuration.');var c={path:w(i,r),components:n.components||{default:n.component},instances:{},name:a,parent:r,matchAs:o,redirect:n.redirect,beforeEnter:n.beforeEnter,meta:n.meta||{}};n.children&&n.children.forEach(function(n){g(t,e,n,c)}),n.alias&&(Array.isArray(n.alias)?n.alias.forEach(function(n){g(t,e,{path:n},r,c.path)}):g(t,e,{path:n.alias},r,c.path)),t[c.path]=c,a&&(e[a]=c)}function w(t,e){return t=t.replace(/\/$/,""),"/"===t[0]?t:null==e?t:n(e.path+"/"+t)}function b(t){function e(t,e,n){var r=h(t,e),i=r.name;if(i){var u=s[i];if(u)return r.path=O(u.path,r.params,'named route "'+i+'"'),o(u,r,n)}else if(r.path){r.params={};for(var c in a)if(k(c,r.params,r.path))return o(a[c],r,n)}return o(null,r)}function n(t,n){var r=n.query,i=n.hash,a=n.params,p=t.redirect,f=p&&"object"==typeof p&&p.name;if(f){var h=s[f];return u(h,'redirect failed: named route "'+f+'" not found.'),e({_normalized:!0,name:f,query:r,hash:i,params:a},void 0,n)}if("string"==typeof p){var l=_(p,t),d=O(l,a,'redirect route with path "'+l+'"');return e({_normalized:!0,path:d,query:r,hash:i},void 0,n)}return c(!1,"invalid redirect option: "+JSON.stringify(p)),o(null,n)}function r(t,n,r){var i=O(r,n.params,'aliased route with path "'+r+'"'),a=e({_normalized:!0,path:i});if(a){var u=a.matched,c=u[u.length-1];return n.params=a.params,o(c,n)}return o(null,n)}function o(t,e,o){return t&&t.redirect?n(t,o||e):t&&t.matchAs?r(t,e,t.matchAs):x(t,e,o)}var i=m(t),a=i.pathMap,s=i.nameMap;return e}function x(t,e,n){var r={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:e.query||{},params:e.params||{},fullPath:j(e),matched:t?E(t):[]};return n&&(r.redirectedFrom=j(n)),Object.freeze(r)}function k(t,e,n){var r,o,i=nt[t];i?(r=i.keys,o=i.regexp):(r=[],o=et(t,r),nt[t]={keys:r,regexp:o});var a=n.match(o);if(!a)return!1;if(!e)return!0;for(var u=1,c=a.length;u<c;++u){var s=r[u-1],p="string"==typeof a[u]?decodeURIComponent(a[u]):a[u];s&&(e[s.name]=p)}return!0}function O(t,e,n){try{var r=rt[t]||(rt[t]=et.compile(t));return r(e||{},{pretty:!0})}catch(t){return u(!1,"missing param for "+n+": "+t.message),""}}function E(t){for(var e=[];t;)e.unshift(t),t=t.parent;return e}function _(e,n){return t(e,n.parent?n.parent.path:"/",!0)}function j(t){var e=t.path,n=t.query;void 0===n&&(n={});var r=t.hash;return void 0===r&&(r=""),(e||"/")+f(n)+r}function A(t,e,n){var r=function(o){o>=t.length?n():e(t[o],function(){r(o+1)})};r(0)}function S(t){if(!t)if(ot){var e=document.querySelector("base");t=e?e.getAttribute("href"):"/"}else t="/";return"/"!==t.charAt(0)&&(t="/"+t),t.replace(/\/$/,"")}function $(t,e){var n,r=Math.max(t.length,e.length);for(n=0;n<r&&t[n]===e[n];n++);return{activated:e.slice(n),deactivated:t.slice(n)}}function R(t){return C(t,function(t,e){var n=t&&t.beforeRouteLeave;if(n)return function(){return n.apply(e,arguments)}}).reverse()}function T(t,e){return C(t,function(t,n,r,o){var i=t&&t.beforeRouteEnter;if(i)return function(t,n,a){return i(t,n,function(t){a(),t&&e.push(function(){t(r.instances[o]&&r.instances[o].child)})})}})}function q(t){return C(t,function(t,e,n,r){if("function"==typeof t&&!t.options)return function(e,o,i){var a=function(t){n.components[r]=t,i()},u=function(t){c(!1,"Failed to resolve async component "+r+": "+t)},s=t(a,u);s&&"function"==typeof s.then&&s.then(a,u)}})}function C(t,e){return Array.prototype.concat.apply([],t.map(function(t){return Object.keys(t.components).map(function(n){return e(t.components[n],t.instances[n]&&t.instances[n].child,t,n)})}))}function P(t){t&&window.sessionStorage.setItem(t,JSON.stringify({x:window.pageXOffset,y:window.pageYOffset}))}function V(t){if(t)return JSON.parse(window.sessionStorage.getItem(t))}function B(t){var e=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{x:n.left-e.left,y:n.top-e.top}}function H(t){return M(t.x)||M(t.y)}function I(t){return{x:M(t.x)?t.x:window.pageXOffset,y:M(t.y)?t.y:window.pageYOffset}}function M(t){return"number"==typeof t}function U(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 z(t,e){var n=window.history;try{e?n.replaceState({key:ct},"",t):(ct=ut(),n.pushState({key:ct},"",t)),P(ct)}catch(n){window.location[e?"assign":"replace"](t)}}function F(t){z(t,!0)}function J(){var t=N();return"/"===t.charAt(0)||(D("/"+t),!1)}function N(){var t=window.location.href,e=t.indexOf("#");return e===-1?"":t.slice(e+1)}function L(t){window.location.hash=t}function D(t){var e=window.location.href.indexOf("#");window.location.replace(window.location.href.slice(0,e>=0?e:0)+"#"+t)}var X={name:"router-view",functional:!0,props:{name:{type:String,default:"default"}},render:function(t,e){var n=e.props,r=e.children,o=e.parent,i=e.data;i.routerView=!0;for(var a=o.$route,u=o._routerViewCache||(o._routerViewCache={}),c=0,s=!1;o;)o.$vnode&&o.$vnode.data.routerView&&c++,o._inactive&&(s=!0),o=o.$parent;i.routerViewDepth=c;var p=a.matched[c];if(!p)return t();var f=s?u[n.name]:u[n.name]=p.components[n.name],h=t(f,i,r);return s||(p.instances[n.name]=h),h}},Y=encodeURIComponent,W=decodeURIComponent,G={name:"router-link",props:{to:{type:[String,Object],required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String},render:function(t){var e=this,o=this.$router,a=this.$route,u=h(this.to,a,this.append),c=o.match(u),s=c.redirectedFrom||c.fullPath,p=o.history.base,f=p?n(p+s):s,d={},y=this.activeClass||o.options.linkActiveClass||"router-link-active",v=u.path?u:c;d[y]=this.exact?r(a,v):i(a,v);var m={class:d,on:{click:function(t){t.preventDefault(),e.replace?o.replace(u):o.push(u)}}};if("a"===this.tag)m.attrs={href:f};else{var g=l(this.$slots.default);if(g){var w=g.data||(g.data={}),b=w.attrs||(w.attrs={});b.href=f}}return t(this.tag,m,this.$slots.default)}},K=v(function(t){t.exports=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)}}),Q=y(K),Z=Object.freeze({default:Q}),tt=v(function(t){function e(t){for(var e,n=[],r=0,o=0,i="";null!=(e=m.exec(t));){var a=e[0],c=e[1],s=e.index;if(i+=t.slice(o,s),o=s+a.length,c)i+=c[1];else{var p=t[o],f=e[2],h=e[3],l=e[4],d=e[5],y=e[6],v=e[7];i&&(n.push(i),i="");var g=null!=f&&null!=p&&p!==f,w="+"===y||"*"===y,b="?"===y||"*"===y,x=e[2]||"/",k=l||d||(v?".*":"[^"+x+"]+?");n.push({name:h||r++,prefix:f||"",delimiter:x,optional:b,repeat:w,partial:g,asterisk:!!v,pattern:u(k)})}}return o<t.length&&(i+=t.substr(o)),i&&n.push(i),n}function n(t){return i(e(t))}function r(t){return encodeURI(t).replace(/[\/?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function o(t){return encodeURI(t).replace(/[?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function i(t){for(var e=new Array(t.length),n=0;n<t.length;n++)"object"==typeof t[n]&&(e[n]=new RegExp("^(?:"+t[n].pattern+")$"));return function(n,i){for(var a="",u=n||{},c=i||{},s=c.pretty?r:encodeURIComponent,p=0;p<t.length;p++){var f=t[p];if("string"!=typeof f){var h,l=u[f.name];if(null==l){if(f.optional){f.partial&&(a+=f.prefix);continue}throw new TypeError('Expected "'+f.name+'" to be defined')}if(v(l)){if(!f.repeat)throw new TypeError('Expected "'+f.name+'" to not repeat, but received `'+JSON.stringify(l)+"`");if(0===l.length){if(f.optional)continue;throw new TypeError('Expected "'+f.name+'" to not be empty')}for(var d=0;d<l.length;d++){if(h=s(l[d]),!e[p].test(h))throw new TypeError('Expected all "'+f.name+'" to match "'+f.pattern+'", but received `'+JSON.stringify(h)+"`");a+=(0===d?f.prefix:f.delimiter)+h}}else{if(h=f.asterisk?o(l):s(l),!e[p].test(h))throw new TypeError('Expected "'+f.name+'" to match "'+f.pattern+'", but received "'+h+'"');a+=f.prefix+h}}else a+=f}return a}}function a(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function u(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function c(t,e){return t.keys=e,t}function s(t){return t.sensitive?"":"i"}function p(t,e){var n=t.source.match(/\((?!\?)/g);if(n)for(var r=0;r<n.length;r++)e.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return c(t,e)}function f(t,e,n){for(var r=[],o=0;o<t.length;o++)r.push(d(t[o],e,n).source);var i=new RegExp("(?:"+r.join("|")+")",s(n));return c(i,e)}function h(t,n,r){for(var o=e(t),i=l(o,r),a=0;a<o.length;a++)"string"!=typeof o[a]&&n.push(o[a]);return c(i,n)}function l(t,e){e=e||{};for(var n=e.strict,r=e.end!==!1,o="",i=t[t.length-1],u="string"==typeof i&&/\/$/.test(i),c=0;c<t.length;c++){var p=t[c];if("string"==typeof p)o+=a(p);else{var f=a(p.prefix),h="(?:"+p.pattern+")";p.repeat&&(h+="(?:"+f+h+")*"),h=p.optional?p.partial?f+"("+h+")?":"(?:"+f+"("+h+"))?":f+"("+h+")",o+=h}}return n||(o=(u?o.slice(0,-2):o)+"(?:\\/(?=$))?"),o+=r?"$":n&&u?"":"(?=\\/|$)",new RegExp("^"+o,s(e))}function d(t,e,n){return e=e||[],v(e)?n||(n={}):(n=e,e=[]),t instanceof RegExp?p(t,e):v(t)?f(t,e,n):h(t,e,n)}var v=y(Z);t.exports=d,t.exports.parse=e,t.exports.compile=n,t.exports.tokensToFunction=i,t.exports.tokensToRegExp=l;var m=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g")}),et=y(tt),nt=Object.create(null),rt=Object.create(null),ot="undefined"!=typeof window,it=ot&&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)}(),at=function(t,e){this.router=t,this.base=S(e),this.current=x(null,{path:"__vue_router_init__"}),this.pending=null};at.prototype.listen=function(t){this.cb=t},at.prototype.transitionTo=function(t,e){var n=this,r=this.router.match(t,this.current);this.confirmTransition(r,function(){n.updateRoute(r),e&&e(r)})},at.prototype.confirmTransition=function(t,e){var n=this;if(!r(t,this.current)){var o=$(this.current.matched,t.matched),i=o.deactivated,a=o.activated,u=[],c=[].concat(R(i),this.router.beforeHooks,a.map(function(t){return t.beforeEnter}),q(a),T(a,u)).filter(function(t){return t});this.pending=t;var s=function(t){return n.push(t)};A(c,function(e,n){e(t,s,n)},function(){r(t,n.pending)&&(n.pending=null,e(t),n.router.app.$nextTick(function(){u.forEach(function(t){return t()})}))})}},at.prototype.updateRoute=function(t){this.current=t,this.cb&&this.cb(t),this.router.afterHooks.forEach(function(e){e&&e(t)})};var ut=function(){return String(Date.now())},ct=ut(),st=function(t){function e(e,r){var o=this;t.call(this,e,r);var i=U(this.base);this.transitionTo(i,function(t){var e=n(o.base+o.current.fullPath);i!==e&&F(e)});var a=e.options.scrollBehavior;window.addEventListener("popstate",function(t){ct=t.state&&t.state.key;var e=o.current;o.transitionTo(U(o.base),function(t){a&&o.handleScroll(t,e,!0)})}),a&&window.addEventListener("scroll",function(){P(ct)})}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(e){var r=this,o=this.current;t.prototype.transitionTo.call(this,e,function(t){z(n(r.base+t.fullPath)),r.handleScroll(t,o,!1)})},e.prototype.replace=function(e){var r=this,o=this.current;t.prototype.transitionTo.call(this,e,function(t){F(n(r.base+t.fullPath)),r.handleScroll(t,o,!1)})},e.prototype.handleScroll=function(t,e,n){var r=this.router;if(r.app){var o=r.options.scrollBehavior;o&&(u("function"==typeof o,"scrollBehavior must be a function"),r.app.$nextTick(function(){var r=V(ct),i=o(t,e,n?r:null);if(i){var a="object"==typeof i;if(a&&i.selector){var u=document.querySelector(i.selector);u?r=B(u):H(i)&&(r=I(i))}else a&&H(i)&&(r=I(i));r&&window.scrollTo(r.x,r.y)}}))}},e}(at),pt=function(t){function e(e,n,r){var o=this;t.call(this,e,n),r&&this.checkFallback()||(J(),this.transitionTo(N(),function(t){N()!==t.fullPath&&D(t.fullPath)}),window.addEventListener("hashchange",function(){o.onHashChange()}))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.checkFallback=function(){var t=U(this.base);if(!/^\/#/.test(t))return window.location.replace(n(this.base+"/#"+t)),!0},e.prototype.onHashChange=function(){J()&&this.transitionTo(N(),function(t){D(t.fullPath)})},e.prototype.push=function(e){t.prototype.transitionTo.call(this,e,function(t){L(t.fullPath)})},e.prototype.replace=function(e){t.prototype.transitionTo.call(this,e,function(t){D(t.fullPath)})},e.prototype.go=function(t){window.history.go(t)},e}(at),ft=function(t){function e(e){t.call(this,e),this.stack=[],this.index=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(e){var n=this;t.prototype.transitionTo.call(this,e,function(t){n.stack=n.stack.slice(0,n.index+1).concat(t),n.index++})},e.prototype.replace=function(e){var n=this;t.prototype.transitionTo.call(this,e,function(t){n.stack=n.stack.slice(0,n.index).concat(t)})},e.prototype.go=function(t){var e=this,n=this.index+t;if(!this.stack,!(n<0||n>=this.stack.length)){var r=this.stack[n];this.confirmTransition(r,function(){e.index=n,e.updateRoute(r)})}},e}(at),ht=function(t){void 0===t&&(t={}),this.app=null,this.options=t,this.beforeHooks=[],this.afterHooks=[],this.match=b(t.routes||[]);var e=t.mode||"hash";this.fallback="history"===e&&!it,this.fallback&&(e="hash"),ot||(e="abstract"),this.mode=e},lt={currentRoute:{}};return lt.currentRoute.get=function(){return this.history&&this.history.current},ht.prototype.init=function(t){var e=this;u(d.installed,"not installed. Make sure to call `Vue.use(VueRouter)` before creating root instance."),this.app=t;var n=this,r=n.mode,o=n.options,i=n.fallback;switch(r){case"history":this.history=new st(this,o.base);break;case"hash":this.history=new pt(this,o.base,i);break;case"abstract":this.history=new ft(this);break;default:u(!1,"invalid mode: "+r)}this.history.listen(function(t){e.app._route=t})},ht.prototype.beforeEach=function(t){this.beforeHooks.push(t)},ht.prototype.afterEach=function(t){this.afterHooks.push(t)},ht.prototype.push=function(t){this.history.push(t)},ht.prototype.replace=function(t){this.history.replace(t)},ht.prototype.go=function(t){this.history.go(t)},ht.prototype.back=function(){this.go(-1)},ht.prototype.forward=function(){this.go(1)},ht.prototype.getMatchedComponents=function(){return this.currentRoute?[].concat.apply([],this.currentRoute.matched.map(function(t){return Object.keys(t.components).map(function(e){return t.components[e]})})):[]},Object.defineProperties(ht.prototype,lt),ht.install=d,ot&&window.Vue&&window.Vue.use(ht),ht});
!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,n){if("/"===t.charAt(0))return t;if("?"===t.charAt(0)||"#"===t.charAt(0))return e+t;var r=e.split("/");n&&r[r.length-1]||r.pop();for(var o=t.replace(/^\//,"").split("/"),i=0;i<o.length;i++){var a=o[i];"."!==a&&(".."===a?r.pop():r.push(a))}return""!==r[0]&&r.unshift(""),r.join("/")}function e(t){var e="",n="",r=t.indexOf("#");r>=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 n(t){return t.replace(/\/\//g,"/")}function r(t,e){if(!t)throw new Error("[vue-router] "+e)}function o(t,e){t||"undefined"!=typeof console&&console.warn("[vue-router] "+e)}function i(t,e){if(void 0===e&&(e={}),t){var n;try{n=a(t)}catch(t){o(!1,t.message),n={}}for(var r in e)n[r]=e[r];return n}return e}function a(t){var e=Object.create(null);return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach(function(t){var n=t.replace(/\+/g," ").split("="),r=W(n.shift()),o=n.length>0?W(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 u(t){var e=t?Object.keys(t).sort().map(function(e){var n=t[e];if(void 0===n)return"";if(null===n)return Y(e);if(Array.isArray(n)){var r=[];return n.slice().forEach(function(t){void 0!==t&&(null===t?r.push(Y(e)):r.push(Y(e)+"="+Y(t)))}),r.join("&")}return Y(e)+"="+Y(n)}).filter(function(t){return t.length>0}).join("&"):null;return e?"?"+e:""}function c(t,e,n){var r={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:e.query||{},params:e.params||{},fullPath:p(e),matched:t?s(t):[]};return n&&(r.redirectedFrom=p(n)),Object.freeze(r)}function s(t){for(var e=[];t;)e.unshift(t),t=t.parent;return e}function p(t){var e=t.path,n=t.query;void 0===n&&(n={});var r=t.hash;return void 0===r&&(r=""),(e||"/")+u(n)+r}function f(t,e){return!!e&&(t.path&&e.path?t.path.replace(G,"")===e.path.replace(G,"")&&t.hash===e.hash&&h(t.query,e.query):!(!t.name||!e.name)&&(t.name===e.name&&t.hash===e.hash&&h(t.query,e.query)&&h(t.params,e.params)))}function h(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 l(t,e){return 0===t.path.indexOf(e.path)&&(!e.hash||t.hash===e.hash)&&d(t.query,e.query)}function d(t,e){for(var n in e)if(!(n in t))return!1;return!0}function y(n,r,o){var a="string"==typeof n?{path:n}:n;if(a.name||a._normalized)return a;var u=e(a.path||""),c=r&&r.path||"/",s=u.path?t(u.path,c,o):r&&r.path||"/",p=i(u.query,a.query),f=a.hash||u.hash;return f&&"#"!==f.charAt(0)&&(f="#"+f),{_normalized:!0,path:s,query:p,hash:f}}function v(t){if(t)for(var e,n=0;n<t.length;n++){if(e=t[n],"a"===e.tag)return e;if(e.children&&(e=v(e.children)))return e}}function m(t){m.installed||(m.installed=!0,Object.defineProperty(t.prototype,"$router",{get:function(){return this.$root._router}}),Object.defineProperty(t.prototype,"$route",{get:function(){return this.$root._route}}),t.mixin({beforeCreate:function(){this.$options.router&&(this._router=this.$options.router,this._router.init(this),t.util.defineReactive(this,"_route",this._router.history.current))}}),t.component("router-view",X),t.component("router-link",Q))}function g(t){return t&&"object"==typeof t&&"default"in t?t.default:t}function w(t,e){return e={exports:{}},t(e,e.exports),e.exports}function b(t){var e=Object.create(null),n=Object.create(null);return t.forEach(function(t){x(e,n,t)}),{pathMap:e,nameMap:n}}function x(t,e,n,o,i){var a=n.path,u=n.name;r(null!=a,'"path" is required in a route configuration.');var c={path:k(a,o),components:n.components||{default:n.component},instances:{},name:u,parent:o,matchAs:i,redirect:n.redirect,beforeEnter:n.beforeEnter,meta:n.meta||{}};n.children&&n.children.forEach(function(n){x(t,e,n,c)}),n.alias&&(Array.isArray(n.alias)?n.alias.forEach(function(n){x(t,e,{path:n},o,c.path)}):x(t,e,{path:n.alias},o,c.path)),t[c.path]=c,u&&(e[u]=c)}function k(t,e){return t=t.replace(/\/$/,""),"/"===t[0]?t:null==e?t:n(e.path+"/"+t)}function O(t){function e(t,e,n){var r=y(t,e),o=r.name;if(o){var i=p[o];if(i)return r.path=_(i.path,r.params,'named route "'+o+'"'),a(i,r,n)}else if(r.path){r.params={};for(var u in s)if(E(u,r.params,r.path))return a(s[u],r,n)}return a(null,r)}function n(t,n){var i=t.redirect,u="function"==typeof i?i(c(t,n)):i;if("string"==typeof u&&(u={path:u}),!u||"object"!=typeof u)return o(!1,"invalid redirect option: "+JSON.stringify(u)),a(null,n);var s=u,f=s.name,h=s.path,l=n.query,d=n.hash,y=n.params;if(l=s.hasOwnProperty("query")?s.query:l,d=s.hasOwnProperty("hash")?s.hash:d,y=s.hasOwnProperty("params")?s.params:y,f){var v=p[f];return r(v,'redirect failed: named route "'+f+'" not found.'),e({_normalized:!0,name:f,query:l,hash:d,params:y},void 0,n)}if(h){var m=j(h,t),g=_(m,y,'redirect route with path "'+m+'"');return e({_normalized:!0,path:g,query:l,hash:d},void 0,n)}return o(!1,"invalid redirect option: "+JSON.stringify(u)),a(null,n)}function i(t,n,r){var o=_(r,n.params,'aliased route with path "'+r+'"'),i=e({_normalized:!0,path:o});if(i){var u=i.matched,c=u[u.length-1];return n.params=i.params,a(c,n)}return a(null,n)}function a(t,e,r){return t&&t.redirect?n(t,r||e):t&&t.matchAs?i(t,e,t.matchAs):c(t,e,r)}var u=b(t),s=u.pathMap,p=u.nameMap;return e}function E(t,e,n){var r,o,i=ot[t];i?(r=i.keys,o=i.regexp):(r=[],o=rt(t,r),ot[t]={keys:r,regexp:o});var a=n.match(o);if(!a)return!1;if(!e)return!0;for(var u=1,c=a.length;u<c;++u){var s=r[u-1],p="string"==typeof a[u]?decodeURIComponent(a[u]):a[u];s&&(e[s.name]=p)}return!0}function _(t,e,n){try{var o=it[t]||(it[t]=rt.compile(t));return o(e||{},{pretty:!0})}catch(t){return r(!1,"missing param for "+n+": "+t.message),""}}function j(e,n){return t(e,n.parent?n.parent.path:"/",!0)}function S(t,e,n){var r=function(o){o>=t.length?n():t[o]?e(t[o],function(){r(o+1)}):r(o+1)};r(0)}function $(t){if(!t)if(at){var e=document.querySelector("base");t=e?e.getAttribute("href"):"/"}else t="/";return"/"!==t.charAt(0)&&(t="/"+t),t.replace(/\/$/,"")}function A(t,e){var n,r=Math.max(t.length,e.length);for(n=0;n<r&&t[n]===e[n];n++);return{activated:e.slice(n),deactivated:t.slice(n)}}function R(t){return C(t,function(t,e){var n=t&&t.beforeRouteLeave;if(n)return function(){return n.apply(e,arguments)}}).reverse()}function T(t,e){return C(t,function(t,n,r,o){var i=t&&t.beforeRouteEnter;if(i)return function(t,n,a){return i(t,n,function(t){a(),t&&e.push(function(){t(r.instances[o])})})}})}function q(t){return C(t,function(t,e,n,r){if("function"==typeof t&&!t.options)return function(e,i,a){var u=function(t){n.components[r]=t,a()},c=function(t){o(!1,"Failed to resolve async component "+r+": "+t)},s=t(u,c);s&&"function"==typeof s.then&&s.then(u,c)}})}function C(t,e){return Array.prototype.concat.apply([],t.map(function(t){return Object.keys(t.components).map(function(n){return e(t.components[n],t.instances[n],t,n)})}))}function P(t){t&&window.sessionStorage.setItem(t,JSON.stringify({x:window.pageXOffset,y:window.pageYOffset}))}function V(t){if(t)return JSON.parse(window.sessionStorage.getItem(t))}function B(t){var e=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{x:n.left-e.left,y:n.top-e.top}}function H(t){return M(t.x)||M(t.y)}function I(t){return{x:M(t.x)?t.x:window.pageXOffset,y:M(t.y)?t.y:window.pageYOffset}}function M(t){return"number"==typeof t}function U(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 z(t,e){var n=window.history;try{e?n.replaceState({key:pt},"",t):(pt=st(),n.pushState({key:pt},"",t)),P(pt)}catch(n){window.location[e?"assign":"replace"](t)}}function F(t){z(t,!0)}function J(){var t=N();return"/"===t.charAt(0)||(D("/"+t),!1)}function N(){var t=window.location.href,e=t.indexOf("#");return e===-1?"":t.slice(e+1)}function L(t){window.location.hash=t}function D(t){var e=window.location.href.indexOf("#");window.location.replace(window.location.href.slice(0,e>=0?e:0)+"#"+t)}var X={name:"router-view",functional:!0,props:{name:{type:String,default:"default"}},render:function(t,e){var n=e.props,r=e.children,o=e.parent,i=e.data;i.routerView=!0;for(var a=o.$route,u=o._routerViewCache||(o._routerViewCache={}),c=0,s=!1;o;)o.$vnode&&o.$vnode.data.routerView&&c++,o._inactive&&(s=!0),o=o.$parent;i.routerViewDepth=c;var p=a.matched[c];if(!p)return t();var f=s?u[n.name]:u[n.name]=p.components[n.name];return s||((i.hook||(i.hook={})).init=function(t){p.instances[n.name]=t.child}),t(f,i,r)}},Y=encodeURIComponent,W=decodeURIComponent,G=/\/$/,K=[String,Object],Q={name:"router-link",props:{to:{type:K,required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String},render:function(t){var e=this,r=this.$router,o=this.$route,i=y(this.to,o,this.append),a=r.match(i),u=a.redirectedFrom||a.fullPath,s=r.history.base,p=s?n(s+u):u,h={},d=this.activeClass||r.options.linkActiveClass||"router-link-active",m=i.path?c(null,i):a;h[d]=this.exact?f(o,m):l(o,m);var g={class:h,on:{click:function(t){t.preventDefault(),e.replace?r.replace(i):r.push(i)}}};if("a"===this.tag)g.attrs={href:p};else{var w=v(this.$slots.default);if(w){var b=w.data||(w.data={}),x=b.attrs||(b.attrs={});x.href=p}}return t(this.tag,g,this.$slots.default)}},Z=w(function(t){t.exports=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)}}),tt=g(Z),et=Object.freeze({default:tt}),nt=w(function(t){function e(t){for(var e,n=[],r=0,o=0,i="";null!=(e=v.exec(t));){var a=e[0],c=e[1],s=e.index;if(i+=t.slice(o,s),o=s+a.length,c)i+=c[1];else{var p=t[o],f=e[2],h=e[3],l=e[4],d=e[5],y=e[6],m=e[7];i&&(n.push(i),i="");var g=null!=f&&null!=p&&p!==f,w="+"===y||"*"===y,b="?"===y||"*"===y,x=e[2]||"/",k=l||d||(m?".*":"[^"+x+"]+?");n.push({name:h||r++,prefix:f||"",delimiter:x,optional:b,repeat:w,partial:g,asterisk:!!m,pattern:u(k)})}}return o<t.length&&(i+=t.substr(o)),i&&n.push(i),n}function n(t){return i(e(t))}function r(t){return encodeURI(t).replace(/[\/?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function o(t){return encodeURI(t).replace(/[?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function i(t){for(var e=new Array(t.length),n=0;n<t.length;n++)"object"==typeof t[n]&&(e[n]=new RegExp("^(?:"+t[n].pattern+")$"));return function(n,i){for(var a="",u=n||{},c=i||{},s=c.pretty?r:encodeURIComponent,p=0;p<t.length;p++){var f=t[p];if("string"!=typeof f){var h,l=u[f.name];if(null==l){if(f.optional){f.partial&&(a+=f.prefix);continue}throw new TypeError('Expected "'+f.name+'" to be defined')}if(y(l)){if(!f.repeat)throw new TypeError('Expected "'+f.name+'" to not repeat, but received `'+JSON.stringify(l)+"`");if(0===l.length){if(f.optional)continue;throw new TypeError('Expected "'+f.name+'" to not be empty')}for(var d=0;d<l.length;d++){if(h=s(l[d]),!e[p].test(h))throw new TypeError('Expected all "'+f.name+'" to match "'+f.pattern+'", but received `'+JSON.stringify(h)+"`");a+=(0===d?f.prefix:f.delimiter)+h}}else{if(h=f.asterisk?o(l):s(l),!e[p].test(h))throw new TypeError('Expected "'+f.name+'" to match "'+f.pattern+'", but received "'+h+'"');a+=f.prefix+h}}else a+=f}return a}}function a(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function u(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function c(t,e){return t.keys=e,t}function s(t){return t.sensitive?"":"i"}function p(t,e){var n=t.source.match(/\((?!\?)/g);if(n)for(var r=0;r<n.length;r++)e.push({name:r,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return c(t,e)}function f(t,e,n){for(var r=[],o=0;o<t.length;o++)r.push(d(t[o],e,n).source);var i=new RegExp("(?:"+r.join("|")+")",s(n));return c(i,e)}function h(t,n,r){for(var o=e(t),i=l(o,r),a=0;a<o.length;a++)"string"!=typeof o[a]&&n.push(o[a]);return c(i,n)}function l(t,e){e=e||{};for(var n=e.strict,r=e.end!==!1,o="",i=t[t.length-1],u="string"==typeof i&&/\/$/.test(i),c=0;c<t.length;c++){var p=t[c];if("string"==typeof p)o+=a(p);else{var f=a(p.prefix),h="(?:"+p.pattern+")";p.repeat&&(h+="(?:"+f+h+")*"),h=p.optional?p.partial?f+"("+h+")?":"(?:"+f+"("+h+"))?":f+"("+h+")",o+=h}}return n||(o=(u?o.slice(0,-2):o)+"(?:\\/(?=$))?"),o+=r?"$":n&&u?"":"(?=\\/|$)",new RegExp("^"+o,s(e))}function d(t,e,n){return e=e||[],y(e)?n||(n={}):(n=e,e=[]),t instanceof RegExp?p(t,e):y(t)?f(t,e,n):h(t,e,n)}var y=g(et);t.exports=d,t.exports.parse=e,t.exports.compile=n,t.exports.tokensToFunction=i,t.exports.tokensToRegExp=l;var v=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g")}),rt=g(nt),ot=Object.create(null),it=Object.create(null),at="undefined"!=typeof window,ut=at&&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)}(),ct=function(t,e){this.router=t,this.base=$(e),this.current=c(null,{path:"__vue_router_init__"}),this.pending=null};ct.prototype.listen=function(t){this.cb=t},ct.prototype.transitionTo=function(t,e){var n=this,r=this.router.match(t,this.current);this.confirmTransition(r,function(){n.updateRoute(r),e&&e(r)})},ct.prototype.confirmTransition=function(t,e){var n=this;if(!f(t,this.current)){var r=A(this.current.matched,t.matched),o=r.deactivated,i=r.activated,a=[].concat(R(o),this.router.beforeHooks,i.map(function(t){return t.beforeEnter}),q(i));this.pending=t;var u=function(t){return n.push(t)},c=function(e,n){return e(t,u,n)};S(a,c,function(){var r=[];S(T(i,r),c,function(){f(t,n.pending)&&(n.pending=null,e(t),n.router.app.$nextTick(function(){r.forEach(function(t){return t()})}))})})}},ct.prototype.updateRoute=function(t){this.current=t,this.cb&&this.cb(t),this.router.afterHooks.forEach(function(e){e&&e(t)})};var st=function(){return String(Date.now())},pt=st(),ft=function(t){function e(e,r){var o=this;t.call(this,e,r);var i=U(this.base);this.transitionTo(i,function(t){var e=n(o.base+o.current.fullPath);i!==e&&F(e)});var a=e.options.scrollBehavior;window.addEventListener("popstate",function(t){pt=t.state&&t.state.key;var e=o.current;o.transitionTo(U(o.base),function(t){a&&o.handleScroll(t,e,!0)})}),a&&window.addEventListener("scroll",function(){P(pt)})}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(e){var r=this,o=this.current;t.prototype.transitionTo.call(this,e,function(t){z(n(r.base+t.fullPath)),r.handleScroll(t,o,!1)})},e.prototype.replace=function(e){var r=this,o=this.current;t.prototype.transitionTo.call(this,e,function(t){F(n(r.base+t.fullPath)),r.handleScroll(t,o,!1)})},e.prototype.handleScroll=function(t,e,n){var o=this.router;if(o.app){var i=o.options.scrollBehavior;i&&(r("function"==typeof i,"scrollBehavior must be a function"),o.app.$nextTick(function(){var r=V(pt),o=i(t,e,n?r:null);if(o){var a="object"==typeof o;if(a&&o.selector){var u=document.querySelector(o.selector);u?r=B(u):H(o)&&(r=I(o))}else a&&H(o)&&(r=I(o));r&&window.scrollTo(r.x,r.y)}}))}},e}(ct),ht=function(t){function e(e,n,r){var o=this;t.call(this,e,n),r&&this.checkFallback()||(J(),this.transitionTo(N(),function(t){N()!==t.fullPath&&D(t.fullPath)}),window.addEventListener("hashchange",function(){o.onHashChange()}))}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.checkFallback=function(){var t=U(this.base);if(!/^\/#/.test(t))return window.location.replace(n(this.base+"/#"+t)),!0},e.prototype.onHashChange=function(){J()&&this.transitionTo(N(),function(t){D(t.fullPath)})},e.prototype.push=function(e){t.prototype.transitionTo.call(this,e,function(t){L(t.fullPath)})},e.prototype.replace=function(e){t.prototype.transitionTo.call(this,e,function(t){D(t.fullPath)})},e.prototype.go=function(t){window.history.go(t)},e}(ct),lt=function(t){function e(e){t.call(this,e),this.stack=[],this.index=0}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(e){var n=this;t.prototype.transitionTo.call(this,e,function(t){n.stack=n.stack.slice(0,n.index+1).concat(t),n.index++})},e.prototype.replace=function(e){var n=this;t.prototype.transitionTo.call(this,e,function(t){n.stack=n.stack.slice(0,n.index).concat(t)})},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}(ct),dt=function(t){void 0===t&&(t={}),this.app=null,this.options=t,this.beforeHooks=[],this.afterHooks=[],this.match=O(t.routes||[]);var e=t.mode||"hash";this.fallback="history"===e&&!ut,this.fallback&&(e="hash"),at||(e="abstract"),this.mode=e},yt={currentRoute:{}};return yt.currentRoute.get=function(){return this.history&&this.history.current},dt.prototype.init=function(t){var e=this;r(m.installed,"not installed. Make sure to call `Vue.use(VueRouter)` before creating root instance."),this.app=t;var n=this,o=n.mode,i=n.options,a=n.fallback;switch(o){case"history":this.history=new ft(this,i.base);break;case"hash":this.history=new ht(this,i.base,a);break;case"abstract":this.history=new lt(this);break;default:r(!1,"invalid mode: "+o)}this.history.listen(function(t){e.app._route=t})},dt.prototype.beforeEach=function(t){this.beforeHooks.push(t)},dt.prototype.afterEach=function(t){this.afterHooks.push(t)},dt.prototype.push=function(t){this.history.push(t)},dt.prototype.replace=function(t){this.history.replace(t)},dt.prototype.go=function(t){this.history.go(t)},dt.prototype.back=function(){this.go(-1)},dt.prototype.forward=function(){this.go(1)},dt.prototype.getMatchedComponents=function(){return this.currentRoute?[].concat.apply([],this.currentRoute.matched.map(function(t){return Object.keys(t.components).map(function(e){return t.components[e]})})):[]},Object.defineProperties(dt.prototype,yt),dt.install=m,at&&window.Vue&&window.Vue.use(dt),dt});
{
"name": "vue-router",
"version": "2.0.0-rc.4",
"version": "2.0.0-rc.5",
"description": "Official router for Vue.js 2.0",

@@ -21,3 +21,3 @@ "author": "Evan You",

"dev:dist": "rollup -wm -c build/rollup.config.js",
"build": "rollup -c build/rollup.config.js && uglifyjs dist/vue-router.js -cm --comments -o dist/vue-router.min.js",
"build": "rollup --environment NODE_ENV:production -c build/rollup.config.js && uglifyjs dist/vue-router.js -cm --comments -o dist/vue-router.min.js",
"lint": "eslint src examples",

@@ -47,3 +47,3 @@ "test": "npm run lint && flow check && npm run test:unit && npm run test:e2e",

"flow-bin": "^0.31.1",
"jasmine": "^2.4.1",
"jasmine": "2.4.1",
"nightwatch": "^0.9.5",

@@ -58,6 +58,7 @@ "nightwatch-helpers": "^1.0.0",

"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-replace": "^1.1.1",
"rollup-watch": "^2.4.0",
"selenium-server": "^2.53.1",
"uglify-js": "^2.7.0",
"vue": "^2.0.0-rc.3",
"vue": "^2.0.0-rc.6",
"vue-loader": "^9.4.0",

@@ -64,0 +65,0 @@ "webpack": "^1.13.1",

@@ -0,5 +1,10 @@

/* @flow */
import { cleanPath } from '../util/path'
import { isSameRoute, isIncludedRoute } from '../util/route'
import { createRoute, isSameRoute, isIncludedRoute } from '../util/route'
import { normalizeLocation } from '../util/location'
// work around weird flow bug
const toTypes: Array<Function> = [String, Object]
export default {

@@ -9,3 +14,3 @@ name: 'router-link',

to: {
type: [String, Object],
type: toTypes,
required: true

@@ -22,3 +27,3 @@ },

},
render (h) {
render (h: Function) {
const router = this.$router

@@ -33,3 +38,3 @@ const current = this.$route

const activeClass = this.activeClass || router.options.linkActiveClass || 'router-link-active'
const compareTarget = to.path ? to : resolved
const compareTarget = to.path ? createRoute(null, to) : resolved
classes[activeClass] = this.exact

@@ -39,3 +44,3 @@ ? isSameRoute(current, compareTarget)

const data = {
const data: any = {
class: classes,

@@ -42,0 +47,0 @@ on: {

@@ -38,9 +38,10 @@ export default {

const vnode = h(component, data, children)
if (!inactive) {
matched.instances[props.name] = vnode
(data.hook || (data.hook = {})).init = vnode => {
matched.instances[props.name] = vnode.child
}
}
return vnode
return h(component, data, children)
}
}

@@ -5,5 +5,5 @@ /* @flow */

import { assert, warn } from './util/warn'
import { createRoute } from './util/route'
import { createRouteMap } from './create-route-map'
import { resolvePath } from './util/path'
import { stringifyQuery } from './util/query'
import { normalizeLocation } from './util/location'

@@ -55,5 +55,23 @@

): Route {
const { query, hash, params } = location
const { redirect } = record
const name = redirect && typeof redirect === 'object' && redirect.name
const originalRedirect = record.redirect
let redirect = typeof originalRedirect === 'function'
? originalRedirect(createRoute(record, location))
: originalRedirect
if (typeof redirect === 'string') {
redirect = { path: redirect }
}
if (!redirect || typeof redirect !== 'object') {
warn(false, `invalid redirect option: ${JSON.stringify(redirect)}`)
return _createRoute(null, location)
}
const re: Object = redirect
const { name, path } = re
let { query, hash, params } = location
query = re.hasOwnProperty('query') ? re.query : query
hash = re.hasOwnProperty('hash') ? re.hash : hash
params = re.hasOwnProperty('params') ? re.params : params
if (name) {

@@ -70,11 +88,11 @@ // resolved named direct

}, undefined, location)
} else if (typeof redirect === 'string') {
} else if (path) {
// 1. resolve relative redirect
const rawPath = resolveRecordPath(redirect, record)
const rawPath = resolveRecordPath(path, record)
// 2. resolve params
const path = fillParams(rawPath, params, `redirect route with path "${rawPath}"`)
const resolvedPath = fillParams(rawPath, params, `redirect route with path "${rawPath}"`)
// 3. rematch with existing query and hash
return match({
_normalized: true,
path,
path: resolvedPath,
query,

@@ -125,23 +143,2 @@ hash

export function createRoute (
record: ?RouteRecord,
location: Location,
redirectedFrom?: Location
): Route {
const route: Route = {
name: location.name || (record && record.name),
meta: (record && record.meta) || {},
path: location.path || '/',
hash: location.hash || '',
query: location.query || {},
params: location.params || {},
fullPath: getFullPath(location),
matched: record ? formatMatch(record) : []
}
if (redirectedFrom) {
route.redirectedFrom = getFullPath(redirectedFrom)
}
return Object.freeze(route)
}
function matchRoute (

@@ -195,17 +192,4 @@ path: string,

function formatMatch (record: ?RouteRecord): Array<RouteRecord> {
const res = []
while (record) {
res.unshift(record)
record = record.parent
}
return res
}
function resolveRecordPath (path: string, record: RouteRecord): string {
return resolvePath(path, record.parent ? record.parent.path : '/', true)
}
function getFullPath ({ path, query = {}, hash = '' }) {
return (path || '/') + stringifyQuery(query) + hash
}
/* @flow */
import { assert } from './util/warn'
import { assert, warn } from './util/warn'
import { cleanPath } from './util/path'

@@ -46,2 +46,13 @@

if (route.children) {
// Warn if route is named and has a default child route.
// If users navigate to this route by name, the default child will
// not be rendered (GH Issue #629)
if (process.env.NODE_ENV !== 'production') {
if (route.name && route.children.some(child => /^\/?$/.test(child.path))) {
warn(false, `Named Route '${route.name}' has a default child route.
When navigating to this named route (:to="{name: '${route.name}'"), the default child route will not be rendered.
Remove the name from this route and use the name of the default child route for named links instead.`
)
}
}
route.children.forEach(child => {

@@ -48,0 +59,0 @@ addRouteRecord(pathMap, nameMap, child, record)

@@ -31,3 +31,2 @@ /* @flow */

const targetIndex = this.index + n
if (!this.stack) debugger
if (targetIndex < 0 || targetIndex >= this.stack.length) {

@@ -34,0 +33,0 @@ return

@@ -7,4 +7,3 @@ /* @flow */

import { runQueue } from '../util/async'
import { isSameRoute } from '../util/route'
import { createRoute } from '../create-matcher'
import { createRoute, isSameRoute } from '../util/route'

@@ -55,3 +54,2 @@ export class History {

const postEnterCbs = []
const queue = [].concat(

@@ -65,14 +63,14 @@ // in-component leave guards

// async components
resolveAsyncComponents(activated),
// in-component enter guards
extractEnterGuards(activated, postEnterCbs)
).filter(_ => _)
resolveAsyncComponents(activated)
)
this.pending = route
const redirect = location => this.push(location)
const iterator = (hook, next) => hook(route, redirect, next)
runQueue(
queue,
(hook, next) => { hook(route, redirect, next) },
() => {
runQueue(queue, iterator, () => {
const postEnterCbs = []
// wait until async components are resolved before
// extracting in-component enter guards
runQueue(extractEnterGuards(activated, postEnterCbs), iterator, () => {
if (isSameRoute(route, this.pending)) {

@@ -85,4 +83,4 @@ this.pending = null

}
}
)
})
})
}

@@ -156,3 +154,3 @@

cb && cbs.push(() => {
cb(match.instances[key] && match.instances[key].child)
cb(match.instances[key])
})

@@ -199,3 +197,3 @@ })

m.components[key],
m.instances[key] && m.instances[key].child,
m.instances[key],
m, key

@@ -202,0 +200,0 @@ ))

@@ -8,5 +8,9 @@ /* @flow */

} else {
fn(queue[index], () => {
if (queue[index]) {
fn(queue[index], () => {
step(index + 1)
})
} else {
step(index + 1)
})
}
}

@@ -13,0 +17,0 @@ }

/* @flow */
import { stringifyQuery } from './query'
export function createRoute (
record: ?RouteRecord,
location: Location,
redirectedFrom?: Location
): Route {
const route: Route = {
name: location.name || (record && record.name),
meta: (record && record.meta) || {},
path: location.path || '/',
hash: location.hash || '',
query: location.query || {},
params: location.params || {},
fullPath: getFullPath(location),
matched: record ? formatMatch(record) : []
}
if (redirectedFrom) {
route.redirectedFrom = getFullPath(redirectedFrom)
}
return Object.freeze(route)
}
function formatMatch (record: ?RouteRecord): Array<RouteRecord> {
const res = []
while (record) {
res.unshift(record)
record = record.parent
}
return res
}
function getFullPath ({ path, query = {}, hash = '' }) {
return (path || '/') + stringifyQuery(query) + hash
}
const trailingSlashRE = /\/$/
export function isSameRoute (a: Route, b: ?Route): boolean {

@@ -8,3 +45,3 @@ if (!b) {

return (
a.path === b.path &&
a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
a.hash === b.hash &&

@@ -11,0 +48,0 @@ isObjectEqual(a.query, b.query)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc