l-assiette/dist/dependencias/vuerouter.min.js

1 line
38 KiB
JavaScript

!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?module.exports=factory():"function"==typeof define&&define.amd?define(factory):global.VueRouter=factory()}(this,function(){"use strict";function assert(condition,message){if(!condition)throw new Error("[vue-router] "+message)}function warn(condition,message){condition||"undefined"!=typeof console&&console.warn("[vue-router] "+message)}function isError(err){return Object.prototype.toString.call(err).indexOf("Error")>-1}var View={name:"router-view",functional:!0,props:{name:{type:String,default:"default"}},render:function(_,ref){var props=ref.props,children=ref.children,parent=ref.parent,data=ref.data;data.routerView=!0;for(var h=parent.$createElement,name=props.name,route=parent.$route,cache=parent._routerViewCache||(parent._routerViewCache={}),depth=0,inactive=!1;parent&&parent._routerRoot!==parent;)parent.$vnode&&parent.$vnode.data.routerView&&depth++,parent._inactive&&(inactive=!0),parent=parent.$parent;if(data.routerViewDepth=depth,inactive)return h(cache[name],data,children);var matched=route.matched[depth];if(!matched)return cache[name]=null,h();var component=cache[name]=matched.components[name];data.registerRouteInstance=function(vm,val){var current=matched.instances[name];(val&&current!==vm||!val&&current===vm)&&(matched.instances[name]=val)},(data.hook||(data.hook={})).prepatch=function(_,vnode){matched.instances[name]=vnode.componentInstance};var propsToPass=data.props=function(route,config){switch(typeof config){case"undefined":return;case"object":return config;case"function":return config(route);case"boolean":return config?route.params:void 0;default:warn(!1,'props in "'+route.path+'" is a '+typeof config+", expecting an object, function or boolean.")}}(route,matched.props&&matched.props[name]);if(propsToPass){propsToPass=data.props=function(to,from){for(var key in from)to[key]=from[key];return to}({},propsToPass);var attrs=data.attrs=data.attrs||{};for(var key in propsToPass)component.props&&key in component.props||(attrs[key]=propsToPass[key],delete propsToPass[key])}return h(component,data,children)}};var encodeReserveRE=/[!'()*]/g,encodeReserveReplacer=function(c){return"%"+c.charCodeAt(0).toString(16)},commaRE=/%2C/g,encode=function(str){return encodeURIComponent(str).replace(encodeReserveRE,encodeReserveReplacer).replace(commaRE,",")},decode=decodeURIComponent;function parseQuery(query){var res={};return(query=query.trim().replace(/^(\?|#|&)/,""))?(query.split("&").forEach(function(param){var parts=param.replace(/\+/g," ").split("="),key=decode(parts.shift()),val=parts.length>0?decode(parts.join("=")):null;void 0===res[key]?res[key]=val:Array.isArray(res[key])?res[key].push(val):res[key]=[res[key],val]}),res):res}function stringifyQuery(obj){var res=obj?Object.keys(obj).map(function(key){var val=obj[key];if(void 0===val)return"";if(null===val)return encode(key);if(Array.isArray(val)){var result=[];return val.forEach(function(val2){void 0!==val2&&(null===val2?result.push(encode(key)):result.push(encode(key)+"="+encode(val2)))}),result.join("&")}return encode(key)+"="+encode(val)}).filter(function(x){return x.length>0}).join("&"):null;return res?"?"+res:""}var trailingSlashRE=/\/?$/;function createRoute(record,location,redirectedFrom,router){var stringifyQuery$$1=router&&router.options.stringifyQuery,query=location.query||{};try{query=clone(query)}catch(e){}var route={name:location.name||record&&record.name,meta:record&&record.meta||{},path:location.path||"/",hash:location.hash||"",query:query,params:location.params||{},fullPath:getFullPath(location,stringifyQuery$$1),matched:record?function(record){var res=[];for(;record;)res.unshift(record),record=record.parent;return res}(record):[]};return redirectedFrom&&(route.redirectedFrom=getFullPath(redirectedFrom,stringifyQuery$$1)),Object.freeze(route)}function clone(value){if(Array.isArray(value))return value.map(clone);if(value&&"object"==typeof value){var res={};for(var key in value)res[key]=clone(value[key]);return res}return value}var START=createRoute(null,{path:"/"});function getFullPath(ref,_stringifyQuery){var path=ref.path,query=ref.query;void 0===query&&(query={});var hash=ref.hash;return void 0===hash&&(hash=""),(path||"/")+(_stringifyQuery||stringifyQuery)(query)+hash}function isSameRoute(a,b){return b===START?a===b:!!b&&(a.path&&b.path?a.path.replace(trailingSlashRE,"")===b.path.replace(trailingSlashRE,"")&&a.hash===b.hash&&isObjectEqual(a.query,b.query):!(!a.name||!b.name)&&(a.name===b.name&&a.hash===b.hash&&isObjectEqual(a.query,b.query)&&isObjectEqual(a.params,b.params)))}function isObjectEqual(a,b){if(void 0===a&&(a={}),void 0===b&&(b={}),!a||!b)return a===b;var aKeys=Object.keys(a),bKeys=Object.keys(b);return aKeys.length===bKeys.length&&aKeys.every(function(key){var aVal=a[key],bVal=b[key];return"object"==typeof aVal&&"object"==typeof bVal?isObjectEqual(aVal,bVal):String(aVal)===String(bVal)})}var _Vue,toTypes=[String,Object],eventTypes=[String,Array],Link={name:"router-link",props:{to:{type:toTypes,required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,event:{type:eventTypes,default:"click"}},render:function(h){var this$1=this,router=this.$router,current=this.$route,ref=router.resolve(this.to,current,this.append),location=ref.location,route=ref.route,href=ref.href,classes={},globalActiveClass=router.options.linkActiveClass,globalExactActiveClass=router.options.linkExactActiveClass,activeClassFallback=null==globalActiveClass?"router-link-active":globalActiveClass,exactActiveClassFallback=null==globalExactActiveClass?"router-link-exact-active":globalExactActiveClass,activeClass=null==this.activeClass?activeClassFallback:this.activeClass,exactActiveClass=null==this.exactActiveClass?exactActiveClassFallback:this.exactActiveClass,compareTarget=location.path?createRoute(null,location,null,router):route;classes[exactActiveClass]=isSameRoute(current,compareTarget),classes[activeClass]=this.exact?classes[exactActiveClass]:function(current,target){return 0===current.path.replace(trailingSlashRE,"/").indexOf(target.path.replace(trailingSlashRE,"/"))&&(!target.hash||current.hash===target.hash)&&function(current,target){for(var key in target)if(!(key in current))return!1;return!0}(current.query,target.query)}(current,compareTarget);var handler=function(e){guardEvent(e)&&(this$1.replace?router.replace(location):router.push(location))},on={click:guardEvent};Array.isArray(this.event)?this.event.forEach(function(e){on[e]=handler}):on[this.event]=handler;var data={class:classes};if("a"===this.tag)data.on=on,data.attrs={href:href};else{var a=function findAnchor(children){if(children)for(var child,i=0;i<children.length;i++){if("a"===(child=children[i]).tag)return child;if(child.children&&(child=findAnchor(child.children)))return child}}(this.$slots.default);if(a){a.isStatic=!1;var extend=_Vue.util.extend;(a.data=extend({},a.data)).on=on,(a.data.attrs=extend({},a.data.attrs)).href=href}else data.on=on}return h(this.tag,data,this.$slots.default)}};function guardEvent(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey||e.defaultPrevented||void 0!==e.button&&0!==e.button)){if(e.currentTarget&&e.currentTarget.getAttribute){var target=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(target))return}return e.preventDefault&&e.preventDefault(),!0}}function install(Vue){if(!install.installed||_Vue!==Vue){install.installed=!0,_Vue=Vue;var isDef=function(v){return void 0!==v},registerInstance=function(vm,callVal){var i=vm.$options._parentVnode;isDef(i)&&isDef(i=i.data)&&isDef(i=i.registerRouteInstance)&&i(vm,callVal)};Vue.mixin({beforeCreate:function(){isDef(this.$options.router)?(this._routerRoot=this,this._router=this.$options.router,this._router.init(this),Vue.util.defineReactive(this,"_route",this._router.history.current)):this._routerRoot=this.$parent&&this.$parent._routerRoot||this,registerInstance(this,this)},destroyed:function(){registerInstance(this)}}),Object.defineProperty(Vue.prototype,"$router",{get:function(){return this._routerRoot._router}}),Object.defineProperty(Vue.prototype,"$route",{get:function(){return this._routerRoot._route}}),Vue.component("router-view",View),Vue.component("router-link",Link);var strats=Vue.config.optionMergeStrategies;strats.beforeRouteEnter=strats.beforeRouteLeave=strats.beforeRouteUpdate=strats.created}}var inBrowser="undefined"!=typeof window;function resolvePath(relative,base,append){var firstChar=relative.charAt(0);if("/"===firstChar)return relative;if("?"===firstChar||"#"===firstChar)return base+relative;var stack=base.split("/");append&&stack[stack.length-1]||stack.pop();for(var segments=relative.replace(/^\//,"").split("/"),i=0;i<segments.length;i++){var segment=segments[i];".."===segment?stack.pop():"."!==segment&&stack.push(segment)}return""!==stack[0]&&stack.unshift(""),stack.join("/")}function cleanPath(path){return path.replace(/\/\//g,"/")}var isarray=Array.isArray||function(arr){return"[object Array]"==Object.prototype.toString.call(arr)},pathToRegexp_1=pathToRegexp,parse_1=parse,compile_1=function(str,options){return tokensToFunction(parse(str,options))},tokensToFunction_1=tokensToFunction,tokensToRegExp_1=tokensToRegExp,PATH_REGEXP=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function parse(str,options){for(var res,tokens=[],key=0,index=0,path="",defaultDelimiter=options&&options.delimiter||"/";null!=(res=PATH_REGEXP.exec(str));){var m=res[0],escaped=res[1],offset=res.index;if(path+=str.slice(index,offset),index=offset+m.length,escaped)path+=escaped[1];else{var next=str[index],prefix=res[2],name=res[3],capture=res[4],group=res[5],modifier=res[6],asterisk=res[7];path&&(tokens.push(path),path="");var partial=null!=prefix&&null!=next&&next!==prefix,repeat="+"===modifier||"*"===modifier,optional="?"===modifier||"*"===modifier,delimiter=res[2]||defaultDelimiter,pattern=capture||group;tokens.push({name:name||key++,prefix:prefix||"",delimiter:delimiter,optional:optional,repeat:repeat,partial:partial,asterisk:!!asterisk,pattern:pattern?escapeGroup(pattern):asterisk?".*":"[^"+escapeString(delimiter)+"]+?"})}}return index<str.length&&(path+=str.substr(index)),path&&tokens.push(path),tokens}function encodeURIComponentPretty(str){return encodeURI(str).replace(/[\/?#]/g,function(c){return"%"+c.charCodeAt(0).toString(16).toUpperCase()})}function tokensToFunction(tokens){for(var matches=new Array(tokens.length),i=0;i<tokens.length;i++)"object"==typeof tokens[i]&&(matches[i]=new RegExp("^(?:"+tokens[i].pattern+")$"));return function(obj,opts){for(var path="",data=obj||{},encode=(opts||{}).pretty?encodeURIComponentPretty:encodeURIComponent,i=0;i<tokens.length;i++){var token=tokens[i];if("string"!=typeof token){var segment,value=data[token.name];if(null==value){if(token.optional){token.partial&&(path+=token.prefix);continue}throw new TypeError('Expected "'+token.name+'" to be defined')}if(isarray(value)){if(!token.repeat)throw new TypeError('Expected "'+token.name+'" to not repeat, but received `'+JSON.stringify(value)+"`");if(0===value.length){if(token.optional)continue;throw new TypeError('Expected "'+token.name+'" to not be empty')}for(var j=0;j<value.length;j++){if(segment=encode(value[j]),!matches[i].test(segment))throw new TypeError('Expected all "'+token.name+'" to match "'+token.pattern+'", but received `'+JSON.stringify(segment)+"`");path+=(0===j?token.prefix:token.delimiter)+segment}}else{if(segment=token.asterisk?encodeURI(value).replace(/[?#]/g,function(c){return"%"+c.charCodeAt(0).toString(16).toUpperCase()}):encode(value),!matches[i].test(segment))throw new TypeError('Expected "'+token.name+'" to match "'+token.pattern+'", but received "'+segment+'"');path+=token.prefix+segment}}else path+=token}return path}}function escapeString(str){return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function escapeGroup(group){return group.replace(/([=!:$\/()])/g,"\\$1")}function attachKeys(re,keys){return re.keys=keys,re}function flags(options){return options.sensitive?"":"i"}function tokensToRegExp(tokens,keys,options){isarray(keys)||(options=keys||options,keys=[]);for(var strict=(options=options||{}).strict,end=!1!==options.end,route="",i=0;i<tokens.length;i++){var token=tokens[i];if("string"==typeof token)route+=escapeString(token);else{var prefix=escapeString(token.prefix),capture="(?:"+token.pattern+")";keys.push(token),token.repeat&&(capture+="(?:"+prefix+capture+")*"),route+=capture=token.optional?token.partial?prefix+"("+capture+")?":"(?:"+prefix+"("+capture+"))?":prefix+"("+capture+")"}}var delimiter=escapeString(options.delimiter||"/"),endsWithDelimiter=route.slice(-delimiter.length)===delimiter;return strict||(route=(endsWithDelimiter?route.slice(0,-delimiter.length):route)+"(?:"+delimiter+"(?=$))?"),route+=end?"$":strict&&endsWithDelimiter?"":"(?="+delimiter+"|$)",attachKeys(new RegExp("^"+route,flags(options)),keys)}function pathToRegexp(path,keys,options){return isarray(keys)||(options=keys||options,keys=[]),options=options||{},path instanceof RegExp?function(path,keys){var groups=path.source.match(/\((?!\?)/g);if(groups)for(var i=0;i<groups.length;i++)keys.push({name:i,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return attachKeys(path,keys)}(path,keys):isarray(path)?function(path,keys,options){for(var parts=[],i=0;i<path.length;i++)parts.push(pathToRegexp(path[i],keys,options).source);return attachKeys(new RegExp("(?:"+parts.join("|")+")",flags(options)),keys)}(path,keys,options):function(path,keys,options){return tokensToRegExp(parse(path,options),keys,options)}(path,keys,options)}pathToRegexp_1.parse=parse_1,pathToRegexp_1.compile=compile_1,pathToRegexp_1.tokensToFunction=tokensToFunction_1,pathToRegexp_1.tokensToRegExp=tokensToRegExp_1;var regexpCompileCache=Object.create(null);function fillParams(path,params,routeMsg){try{return(regexpCompileCache[path]||(regexpCompileCache[path]=pathToRegexp_1.compile(path)))(params||{},{pretty:!0})}catch(e){return warn(!1,"missing param for "+routeMsg+": "+e.message),""}}function createRouteMap(routes,oldPathList,oldPathMap,oldNameMap){var pathList=oldPathList||[],pathMap=oldPathMap||Object.create(null),nameMap=oldNameMap||Object.create(null);routes.forEach(function(route){!function addRouteRecord(pathList,pathMap,nameMap,route,parent,matchAs){var path=route.path;var name=route.name;assert(null!=path,'"path" is required in a route configuration.'),assert("string"!=typeof route.component,'route config "component" for path: '+String(path||name)+" cannot be a string id. Use an actual component instead.");var pathToRegexpOptions=route.pathToRegexpOptions||{};var normalizedPath=function(path,parent,strict){strict||(path=path.replace(/\/$/,""));if("/"===path[0])return path;if(null==parent)return path;return cleanPath(parent.path+"/"+path)}(path,parent,pathToRegexpOptions.strict);"boolean"==typeof route.caseSensitive&&(pathToRegexpOptions.sensitive=route.caseSensitive);var record={path:normalizedPath,regex:function(path,pathToRegexpOptions){var regex=pathToRegexp_1(path,[],pathToRegexpOptions),keys=Object.create(null);return regex.keys.forEach(function(key){warn(!keys[key.name],'Duplicate param keys in route with path: "'+path+'"'),keys[key.name]=!0}),regex}(normalizedPath,pathToRegexpOptions),components:route.components||{default:route.component},instances:{},name:name,parent:parent,matchAs:matchAs,redirect:route.redirect,beforeEnter:route.beforeEnter,meta:route.meta||{},props:null==route.props?{}:route.components?route.props:{default:route.props}};route.children&&(route.name&&!route.redirect&&route.children.some(function(child){return/^\/?$/.test(child.path)})&&warn(!1,"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(function(child){var childMatchAs=matchAs?cleanPath(matchAs+"/"+child.path):void 0;addRouteRecord(pathList,pathMap,nameMap,child,record,childMatchAs)}));if(void 0!==route.alias){var aliases=Array.isArray(route.alias)?route.alias:[route.alias];aliases.forEach(function(alias){var aliasRoute={path:alias,children:route.children};addRouteRecord(pathList,pathMap,nameMap,aliasRoute,parent,record.path||"/")})}pathMap[record.path]||(pathList.push(record.path),pathMap[record.path]=record);name&&(nameMap[name]?matchAs||warn(!1,'Duplicate named routes definition: { name: "'+name+'", path: "'+record.path+'" }'):nameMap[name]=record)}(pathList,pathMap,nameMap,route)});for(var i=0,l=pathList.length;i<l;i++)"*"===pathList[i]&&(pathList.push(pathList.splice(i,1)[0]),l--,i--);return{pathList:pathList,pathMap:pathMap,nameMap:nameMap}}function normalizeLocation(raw,current,append,router){var next="string"==typeof raw?{path:raw}:raw;if(next.name||next._normalized)return next;if(!next.path&&next.params&&current){(next=assign({},next))._normalized=!0;var params=assign(assign({},current.params),next.params);if(current.name)next.name=current.name,next.params=params;else if(current.matched.length){var rawPath=current.matched[current.matched.length-1].path;next.path=fillParams(rawPath,params,"path "+current.path)}else warn(!1,"relative params navigation requires a current route.");return next}var parsedPath=function(path){var hash="",query="",hashIndex=path.indexOf("#");hashIndex>=0&&(hash=path.slice(hashIndex),path=path.slice(0,hashIndex));var queryIndex=path.indexOf("?");return queryIndex>=0&&(query=path.slice(queryIndex+1),path=path.slice(0,queryIndex)),{path:path,query:query,hash:hash}}(next.path||""),basePath=current&&current.path||"/",path=parsedPath.path?resolvePath(parsedPath.path,basePath,append||next.append):basePath,query=function(query,extraQuery,_parseQuery){void 0===extraQuery&&(extraQuery={});var parsedQuery,parse=_parseQuery||parseQuery;try{parsedQuery=parse(query||"")}catch(e){warn(!1,e.message),parsedQuery={}}for(var key in extraQuery)parsedQuery[key]=extraQuery[key];return parsedQuery}(parsedPath.query,next.query,router&&router.options.parseQuery),hash=next.hash||parsedPath.hash;return hash&&"#"!==hash.charAt(0)&&(hash="#"+hash),{_normalized:!0,path:path,query:query,hash:hash}}function assign(a,b){for(var key in b)a[key]=b[key];return a}function createMatcher(routes,router){var ref=createRouteMap(routes),pathList=ref.pathList,pathMap=ref.pathMap,nameMap=ref.nameMap;function match(raw,currentRoute,redirectedFrom){var location=normalizeLocation(raw,currentRoute,!1,router),name=location.name;if(name){var record=nameMap[name];if(warn(record,"Route with name '"+name+"' does not exist"),!record)return _createRoute(null,location);var paramNames=record.regex.keys.filter(function(key){return!key.optional}).map(function(key){return key.name});if("object"!=typeof location.params&&(location.params={}),currentRoute&&"object"==typeof currentRoute.params)for(var key in currentRoute.params)!(key in location.params)&&paramNames.indexOf(key)>-1&&(location.params[key]=currentRoute.params[key]);if(record)return location.path=fillParams(record.path,location.params,'named route "'+name+'"'),_createRoute(record,location,redirectedFrom)}else if(location.path){location.params={};for(var i=0;i<pathList.length;i++){var path=pathList[i],record$1=pathMap[path];if(matchRoute(record$1.regex,location.path,location.params))return _createRoute(record$1,location,redirectedFrom)}}return _createRoute(null,location)}function redirect(record,location){var originalRedirect=record.redirect,redirect="function"==typeof originalRedirect?originalRedirect(createRoute(record,location,null,router)):originalRedirect;if("string"==typeof redirect&&(redirect={path:redirect}),!redirect||"object"!=typeof redirect)return warn(!1,"invalid redirect option: "+JSON.stringify(redirect)),_createRoute(null,location);var re=redirect,name=re.name,path=re.path,query=location.query,hash=location.hash,params=location.params;if(query=re.hasOwnProperty("query")?re.query:query,hash=re.hasOwnProperty("hash")?re.hash:hash,params=re.hasOwnProperty("params")?re.params:params,name)return assert(nameMap[name],'redirect failed: named route "'+name+'" not found.'),match({_normalized:!0,name:name,query:query,hash:hash,params:params},void 0,location);if(path){var rawPath=function(path,record){return resolvePath(path,record.parent?record.parent.path:"/",!0)}(path,record);return match({_normalized:!0,path:fillParams(rawPath,params,'redirect route with path "'+rawPath+'"'),query:query,hash:hash},void 0,location)}return warn(!1,"invalid redirect option: "+JSON.stringify(redirect)),_createRoute(null,location)}function _createRoute(record,location,redirectedFrom){return record&&record.redirect?redirect(record,redirectedFrom||location):record&&record.matchAs?function(record,location,matchAs){var aliasedMatch=match({_normalized:!0,path:fillParams(matchAs,location.params,'aliased route with path "'+matchAs+'"')});if(aliasedMatch){var matched=aliasedMatch.matched,aliasedRecord=matched[matched.length-1];return location.params=aliasedMatch.params,_createRoute(aliasedRecord,location)}return _createRoute(null,location)}(0,location,record.matchAs):createRoute(record,location,redirectedFrom,router)}return{match:match,addRoutes:function(routes){createRouteMap(routes,pathList,pathMap,nameMap)}}}function matchRoute(regex,path,params){var m=path.match(regex);if(!m)return!1;if(!params)return!0;for(var i=1,len=m.length;i<len;++i){var key=regex.keys[i-1],val="string"==typeof m[i]?decodeURIComponent(m[i]):m[i];key&&(params[key.name]=val)}return!0}var positionStore=Object.create(null);function setupScroll(){window.history.replaceState({key:getStateKey()},""),window.addEventListener("popstate",function(e){var key;saveScrollPosition(),e.state&&e.state.key&&(key=e.state.key,_key=key)})}function handleScroll(router,to,from,isPop){if(router.app){var behavior=router.options.scrollBehavior;behavior&&(assert("function"==typeof behavior,"scrollBehavior must be a function"),router.app.$nextTick(function(){var position=function(){var key=getStateKey();if(key)return positionStore[key]}(),shouldScroll=behavior(to,from,isPop?position:null);shouldScroll&&("function"==typeof shouldScroll.then?shouldScroll.then(function(shouldScroll){scrollToPosition(shouldScroll,position)}).catch(function(err){assert(!1,err.toString())}):scrollToPosition(shouldScroll,position))}))}}function saveScrollPosition(){var key=getStateKey();key&&(positionStore[key]={x:window.pageXOffset,y:window.pageYOffset})}function isValidPosition(obj){return isNumber(obj.x)||isNumber(obj.y)}function normalizePosition(obj){return{x:isNumber(obj.x)?obj.x:window.pageXOffset,y:isNumber(obj.y)?obj.y:window.pageYOffset}}function isNumber(v){return"number"==typeof v}function scrollToPosition(shouldScroll,position){var obj,isObject="object"==typeof shouldScroll;if(isObject&&"string"==typeof shouldScroll.selector){var el=document.querySelector(shouldScroll.selector);if(el){var offset=shouldScroll.offset&&"object"==typeof shouldScroll.offset?shouldScroll.offset:{};position=function(el,offset){var docRect=document.documentElement.getBoundingClientRect(),elRect=el.getBoundingClientRect();return{x:elRect.left-docRect.left-offset.x,y:elRect.top-docRect.top-offset.y}}(el,offset={x:isNumber((obj=offset).x)?obj.x:0,y:isNumber(obj.y)?obj.y:0})}else isValidPosition(shouldScroll)&&(position=normalizePosition(shouldScroll))}else isObject&&isValidPosition(shouldScroll)&&(position=normalizePosition(shouldScroll));position&&window.scrollTo(position.x,position.y)}var ua,supportsPushState=inBrowser&&((-1===(ua=window.navigator.userAgent).indexOf("Android 2.")&&-1===ua.indexOf("Android 4.0")||-1===ua.indexOf("Mobile Safari")||-1!==ua.indexOf("Chrome")||-1!==ua.indexOf("Windows Phone"))&&window.history&&"pushState"in window.history),Time=inBrowser&&window.performance&&window.performance.now?window.performance:Date,_key=genKey();function genKey(){return Time.now().toFixed(3)}function getStateKey(){return _key}function pushState(url,replace){saveScrollPosition();var history=window.history;try{replace?history.replaceState({key:_key},"",url):(_key=genKey(),history.pushState({key:_key},"",url))}catch(e){window.location[replace?"replace":"assign"](url)}}function replaceState(url){pushState(url,!0)}function runQueue(queue,fn,cb){var step=function(index){index>=queue.length?cb():queue[index]?fn(queue[index],function(){step(index+1)}):step(index+1)};step(0)}function resolveAsyncComponents(matched){return function(to,from,next){var hasAsync=!1,pending=0,error=null;flatMapComponents(matched,function(def,_,match,key){if("function"==typeof def&&void 0===def.cid){hasAsync=!0,pending++;var res,resolve=once(function(resolvedDef){var obj;((obj=resolvedDef).__esModule||hasSymbol&&"Module"===obj[Symbol.toStringTag])&&(resolvedDef=resolvedDef.default),def.resolved="function"==typeof resolvedDef?resolvedDef:_Vue.extend(resolvedDef),match.components[key]=resolvedDef,--pending<=0&&next()}),reject=once(function(reason){var msg="Failed to resolve async component "+key+": "+reason;warn(!1,msg),error||(error=isError(reason)?reason:new Error(msg),next(error))});try{res=def(resolve,reject)}catch(e){reject(e)}if(res)if("function"==typeof res.then)res.then(resolve,reject);else{var comp=res.component;comp&&"function"==typeof comp.then&&comp.then(resolve,reject)}}}),hasAsync||next()}}function flatMapComponents(matched,fn){return flatten(matched.map(function(m){return Object.keys(m.components).map(function(key){return fn(m.components[key],m.instances[key],m,key)})}))}function flatten(arr){return Array.prototype.concat.apply([],arr)}var hasSymbol="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function once(fn){var called=!1;return function(){for(var args=[],len=arguments.length;len--;)args[len]=arguments[len];if(!called)return called=!0,fn.apply(this,args)}}var History=function(router,base){this.router=router,this.base=function(base){if(!base)if(inBrowser){var baseEl=document.querySelector("base");base=(base=baseEl&&baseEl.getAttribute("href")||"/").replace(/^https?:\/\/[^\/]+/,"")}else base="/";"/"!==base.charAt(0)&&(base="/"+base);return base.replace(/\/$/,"")}(base),this.current=START,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[]};function extractGuards(records,name,bind,reverse){var guards=flatMapComponents(records,function(def,instance,match,key){var guard=function(def,key){"function"!=typeof def&&(def=_Vue.extend(def));return def.options[key]}(def,name);if(guard)return Array.isArray(guard)?guard.map(function(guard){return bind(guard,instance,match,key)}):bind(guard,instance,match,key)});return flatten(reverse?guards.reverse():guards)}function bindGuard(guard,instance){if(instance)return function(){return guard.apply(instance,arguments)}}History.prototype.listen=function(cb){this.cb=cb},History.prototype.onReady=function(cb,errorCb){this.ready?cb():(this.readyCbs.push(cb),errorCb&&this.readyErrorCbs.push(errorCb))},History.prototype.onError=function(errorCb){this.errorCbs.push(errorCb)},History.prototype.transitionTo=function(location,onComplete,onAbort){var this$1=this,route=this.router.match(location,this.current);this.confirmTransition(route,function(){this$1.updateRoute(route),onComplete&&onComplete(route),this$1.ensureURL(),this$1.ready||(this$1.ready=!0,this$1.readyCbs.forEach(function(cb){cb(route)}))},function(err){onAbort&&onAbort(err),err&&!this$1.ready&&(this$1.ready=!0,this$1.readyErrorCbs.forEach(function(cb){cb(err)}))})},History.prototype.confirmTransition=function(route,onComplete,onAbort){var this$1=this,current=this.current,abort=function(err){isError(err)&&(this$1.errorCbs.length?this$1.errorCbs.forEach(function(cb){cb(err)}):(warn(!1,"uncaught error during route navigation:"),console.error(err))),onAbort&&onAbort(err)};if(isSameRoute(route,current)&&route.matched.length===current.matched.length)return this.ensureURL(),abort();var ref=function(current,next){var i,max=Math.max(current.length,next.length);for(i=0;i<max&&current[i]===next[i];i++);return{updated:next.slice(0,i),activated:next.slice(i),deactivated:current.slice(i)}}(this.current.matched,route.matched),updated=ref.updated,deactivated=ref.deactivated,activated=ref.activated,queue=[].concat(function(deactivated){return extractGuards(deactivated,"beforeRouteLeave",bindGuard,!0)}(deactivated),this.router.beforeHooks,function(updated){return extractGuards(updated,"beforeRouteUpdate",bindGuard)}(updated),activated.map(function(m){return m.beforeEnter}),resolveAsyncComponents(activated));this.pending=route;var iterator=function(hook,next){if(this$1.pending!==route)return abort();try{hook(route,current,function(to){!1===to||isError(to)?(this$1.ensureURL(!0),abort(to)):"string"==typeof to||"object"==typeof to&&("string"==typeof to.path||"string"==typeof to.name)?(abort(),"object"==typeof to&&to.replace?this$1.replace(to):this$1.push(to)):next(to)})}catch(e){abort(e)}};runQueue(queue,iterator,function(){var postEnterCbs=[];runQueue(function(activated,cbs,isValid){return extractGuards(activated,"beforeRouteEnter",function(guard,_,match,key){return function(guard,match,key,cbs,isValid){return function(to,from,next){return guard(to,from,function(cb){next(cb),"function"==typeof cb&&cbs.push(function(){!function poll(cb,instances,key,isValid){instances[key]?cb(instances[key]):isValid()&&setTimeout(function(){poll(cb,instances,key,isValid)},16)}(cb,match.instances,key,isValid)})})}}(guard,match,key,cbs,isValid)})}(activated,postEnterCbs,function(){return this$1.current===route}).concat(this$1.router.resolveHooks),iterator,function(){if(this$1.pending!==route)return abort();this$1.pending=null,onComplete(route),this$1.router.app&&this$1.router.app.$nextTick(function(){postEnterCbs.forEach(function(cb){cb()})})})})},History.prototype.updateRoute=function(route){var prev=this.current;this.current=route,this.cb&&this.cb(route),this.router.afterHooks.forEach(function(hook){hook&&hook(route,prev)})};var HTML5History=function(History$$1){function HTML5History(router,base){var this$1=this;History$$1.call(this,router,base);var expectScroll=router.options.scrollBehavior;expectScroll&&setupScroll();var initLocation=getLocation(this.base);window.addEventListener("popstate",function(e){var current=this$1.current,location=getLocation(this$1.base);this$1.current===START&&location===initLocation||this$1.transitionTo(location,function(route){expectScroll&&handleScroll(router,route,current,!0)})})}return History$$1&&(HTML5History.__proto__=History$$1),HTML5History.prototype=Object.create(History$$1&&History$$1.prototype),HTML5History.prototype.constructor=HTML5History,HTML5History.prototype.go=function(n){window.history.go(n)},HTML5History.prototype.push=function(location,onComplete,onAbort){var this$1=this,fromRoute=this.current;this.transitionTo(location,function(route){pushState(cleanPath(this$1.base+route.fullPath)),handleScroll(this$1.router,route,fromRoute,!1),onComplete&&onComplete(route)},onAbort)},HTML5History.prototype.replace=function(location,onComplete,onAbort){var this$1=this,fromRoute=this.current;this.transitionTo(location,function(route){replaceState(cleanPath(this$1.base+route.fullPath)),handleScroll(this$1.router,route,fromRoute,!1),onComplete&&onComplete(route)},onAbort)},HTML5History.prototype.ensureURL=function(push){if(getLocation(this.base)!==this.current.fullPath){var current=cleanPath(this.base+this.current.fullPath);push?pushState(current):replaceState(current)}},HTML5History.prototype.getCurrentLocation=function(){return getLocation(this.base)},HTML5History}(History);function getLocation(base){var path=window.location.pathname;return base&&0===path.indexOf(base)&&(path=path.slice(base.length)),(path||"/")+window.location.search+window.location.hash}var HashHistory=function(History$$1){function HashHistory(router,base,fallback){History$$1.call(this,router,base),fallback&&function(base){var location=getLocation(base);if(!/^\/#/.test(location))return window.location.replace(cleanPath(base+"/#"+location)),!0}(this.base)||ensureSlash()}return History$$1&&(HashHistory.__proto__=History$$1),HashHistory.prototype=Object.create(History$$1&&History$$1.prototype),HashHistory.prototype.constructor=HashHistory,HashHistory.prototype.setupListeners=function(){var this$1=this,expectScroll=this.router.options.scrollBehavior,supportsScroll=supportsPushState&&expectScroll;supportsScroll&&setupScroll(),window.addEventListener(supportsPushState?"popstate":"hashchange",function(){var current=this$1.current;ensureSlash()&&this$1.transitionTo(getHash(),function(route){supportsScroll&&handleScroll(this$1.router,route,current,!0),supportsPushState||replaceHash(route.fullPath)})})},HashHistory.prototype.push=function(location,onComplete,onAbort){var this$1=this,fromRoute=this.current;this.transitionTo(location,function(route){pushHash(route.fullPath),handleScroll(this$1.router,route,fromRoute,!1),onComplete&&onComplete(route)},onAbort)},HashHistory.prototype.replace=function(location,onComplete,onAbort){var this$1=this,fromRoute=this.current;this.transitionTo(location,function(route){replaceHash(route.fullPath),handleScroll(this$1.router,route,fromRoute,!1),onComplete&&onComplete(route)},onAbort)},HashHistory.prototype.go=function(n){window.history.go(n)},HashHistory.prototype.ensureURL=function(push){var current=this.current.fullPath;getHash()!==current&&(push?pushHash(current):replaceHash(current))},HashHistory.prototype.getCurrentLocation=function(){return getHash()},HashHistory}(History);function ensureSlash(){var path=getHash();return"/"===path.charAt(0)||(replaceHash("/"+path),!1)}function getHash(){var href=window.location.href,index=href.indexOf("#");return-1===index?"":href.slice(index+1)}function getUrl(path){var href=window.location.href,i=href.indexOf("#");return(i>=0?href.slice(0,i):href)+"#"+path}function pushHash(path){supportsPushState?pushState(getUrl(path)):window.location.hash=path}function replaceHash(path){supportsPushState?replaceState(getUrl(path)):window.location.replace(getUrl(path))}var AbstractHistory=function(History$$1){function AbstractHistory(router,base){History$$1.call(this,router,base),this.stack=[],this.index=-1}return History$$1&&(AbstractHistory.__proto__=History$$1),AbstractHistory.prototype=Object.create(History$$1&&History$$1.prototype),AbstractHistory.prototype.constructor=AbstractHistory,AbstractHistory.prototype.push=function(location,onComplete,onAbort){var this$1=this;this.transitionTo(location,function(route){this$1.stack=this$1.stack.slice(0,this$1.index+1).concat(route),this$1.index++,onComplete&&onComplete(route)},onAbort)},AbstractHistory.prototype.replace=function(location,onComplete,onAbort){var this$1=this;this.transitionTo(location,function(route){this$1.stack=this$1.stack.slice(0,this$1.index).concat(route),onComplete&&onComplete(route)},onAbort)},AbstractHistory.prototype.go=function(n){var this$1=this,targetIndex=this.index+n;if(!(targetIndex<0||targetIndex>=this.stack.length)){var route=this.stack[targetIndex];this.confirmTransition(route,function(){this$1.index=targetIndex,this$1.updateRoute(route)})}},AbstractHistory.prototype.getCurrentLocation=function(){var current=this.stack[this.stack.length-1];return current?current.fullPath:"/"},AbstractHistory.prototype.ensureURL=function(){},AbstractHistory}(History),VueRouter=function(options){void 0===options&&(options={}),this.app=null,this.apps=[],this.options=options,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=createMatcher(options.routes||[],this);var mode=options.mode||"hash";switch(this.fallback="history"===mode&&!supportsPushState&&!1!==options.fallback,this.fallback&&(mode="hash"),inBrowser||(mode="abstract"),this.mode=mode,mode){case"history":this.history=new HTML5History(this,options.base);break;case"hash":this.history=new HashHistory(this,options.base,this.fallback);break;case"abstract":this.history=new AbstractHistory(this,options.base);break;default:assert(!1,"invalid mode: "+mode)}},prototypeAccessors={currentRoute:{configurable:!0}};function registerHook(list,fn){return list.push(fn),function(){var i=list.indexOf(fn);i>-1&&list.splice(i,1)}}return VueRouter.prototype.match=function(raw,current,redirectedFrom){return this.matcher.match(raw,current,redirectedFrom)},prototypeAccessors.currentRoute.get=function(){return this.history&&this.history.current},VueRouter.prototype.init=function(app){var this$1=this;if(assert(install.installed,"not installed. Make sure to call `Vue.use(VueRouter)` before creating root instance."),this.apps.push(app),!this.app){this.app=app;var history=this.history;if(history instanceof HTML5History)history.transitionTo(history.getCurrentLocation());else if(history instanceof HashHistory){var setupHashListener=function(){history.setupListeners()};history.transitionTo(history.getCurrentLocation(),setupHashListener,setupHashListener)}history.listen(function(route){this$1.apps.forEach(function(app){app._route=route})})}},VueRouter.prototype.beforeEach=function(fn){return registerHook(this.beforeHooks,fn)},VueRouter.prototype.beforeResolve=function(fn){return registerHook(this.resolveHooks,fn)},VueRouter.prototype.afterEach=function(fn){return registerHook(this.afterHooks,fn)},VueRouter.prototype.onReady=function(cb,errorCb){this.history.onReady(cb,errorCb)},VueRouter.prototype.onError=function(errorCb){this.history.onError(errorCb)},VueRouter.prototype.push=function(location,onComplete,onAbort){this.history.push(location,onComplete,onAbort)},VueRouter.prototype.replace=function(location,onComplete,onAbort){this.history.replace(location,onComplete,onAbort)},VueRouter.prototype.go=function(n){this.history.go(n)},VueRouter.prototype.back=function(){this.go(-1)},VueRouter.prototype.forward=function(){this.go(1)},VueRouter.prototype.getMatchedComponents=function(to){var route=to?to.matched?to:this.resolve(to).route:this.currentRoute;return route?[].concat.apply([],route.matched.map(function(m){return Object.keys(m.components).map(function(key){return m.components[key]})})):[]},VueRouter.prototype.resolve=function(to,current,append){var location=normalizeLocation(to,current||this.history.current,append,this),route=this.match(location,current),fullPath=route.redirectedFrom||route.fullPath;return{location:location,route:route,href:function(base,fullPath,mode){var path="hash"===mode?"#"+fullPath:fullPath;return base?cleanPath(base+"/"+path):path}(this.history.base,fullPath,this.mode),normalizedTo:location,resolved:route}},VueRouter.prototype.addRoutes=function(routes){this.matcher.addRoutes(routes),this.history.current!==START&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(VueRouter.prototype,prototypeAccessors),VueRouter.install=install,VueRouter.version="3.0.1",inBrowser&&window.Vue&&window.Vue.use(VueRouter),VueRouter});