vuejs-rails 2.3.2 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /**
2
- * vue-router v2.5.2
2
+ * vue-router v2.7.0
3
3
  * (c) 2017 Evan You
4
4
  * @license MIT
5
5
  */
6
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueRouter=e()}(this,function(){"use strict";function t(t,e){}function e(t,e){switch(typeof e){case"undefined":return;case"object":return e;case"function":return e(t);case"boolean":return e?t.params:void 0}}function n(t,e,n){void 0===e&&(e={});var o,i=n||r;try{o=i(t||"")}catch(t){o={}}for(var a in e){var u=e[a];o[a]=Array.isArray(u)?u.slice():u}return o}function r(t){var e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach(function(t){var n=t.replace(/\+/g," ").split("="),r=$t(n.shift()),o=n.length>0?$t(n.join("=")):null;void 0===e[r]?e[r]=o:Array.isArray(e[r])?e[r].push(o):e[r]=[e[r],o]}),e):e}function o(t){var e=t?Object.keys(t).map(function(e){var n=t[e];if(void 0===n)return"";if(null===n)return _t(e);if(Array.isArray(n)){var r=[];return n.slice().forEach(function(t){void 0!==t&&(null===t?r.push(_t(e)):r.push(_t(e)+"="+_t(t)))}),r.join("&")}return _t(e)+"="+_t(n)}).filter(function(t){return t.length>0}).join("&"):null;return e?"?"+e:""}function i(t,e,n,r){var o=r&&r.options.stringifyQuery,i={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:e.query||{},params:e.params||{},fullPath:u(e,o),matched:t?a(t):[]};return n&&(i.redirectedFrom=u(n,o)),Object.freeze(i)}function a(t){for(var e=[];t;)e.unshift(t),t=t.parent;return e}function u(t,e){var n=t.path,r=t.query;void 0===r&&(r={});var i=t.hash;void 0===i&&(i="");var a=e||o;return(n||"/")+a(r)+i}function c(t,e){return e===qt?t===e:!!e&&(t.path&&e.path?t.path.replace(St,"")===e.path.replace(St,"")&&t.hash===e.hash&&s(t.query,e.query):!(!t.name||!e.name)&&(t.name===e.name&&t.hash===e.hash&&s(t.query,e.query)&&s(t.params,e.params)))}function s(t,e){void 0===t&&(t={}),void 0===e&&(e={});var n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(function(n){return String(t[n])===String(e[n])})}function p(t,e){return 0===t.path.replace(St,"/").indexOf(e.path.replace(St,"/"))&&(!e.hash||t.hash===e.hash)&&f(t.query,e.query)}function f(t,e){for(var n in e)if(!(n in t))return!1;return!0}function h(t){if(!(t.metaKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||void 0!==t.button&&0!==t.button)){if(t.currentTarget&&t.currentTarget.getAttribute){var e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function l(t){if(t)for(var e,n=0;n<t.length;n++){if(e=t[n],"a"===e.tag)return e;if(e.children&&(e=l(e.children)))return e}}function d(t){if(!d.installed){d.installed=!0,Rt=t,Object.defineProperty(t.prototype,"$router",{get:function(){return this.$root._router}}),Object.defineProperty(t.prototype,"$route",{get:function(){return this.$root._route}});var e=function(t){return void 0!==t},n=function(t,n){var r=t.$options._parentVnode;e(r)&&e(r=r.data)&&e(r=r.registerRouteInstance)&&r(t,n)};t.mixin({beforeCreate:function(){e(this.$options.router)&&(this._router=this.$options.router,this._router.init(this),t.util.defineReactive(this,"_route",this._router.history.current)),n(this,this)},destroyed:function(){n(this)}}),t.component("router-view",Ct),t.component("router-link",Ut);var r=t.config.optionMergeStrategies;r.beforeRouteEnter=r.beforeRouteLeave=r.created}}function y(t,e,n){var r=t.charAt(0);if("/"===r)return t;if("?"===r||"#"===r)return e+t;var o=e.split("/");n&&o[o.length-1]||o.pop();for(var i=t.replace(/^\//,"").split("/"),a=0;a<i.length;a++){var u=i[a];".."===u?o.pop():"."!==u&&o.push(u)}return""!==o[0]&&o.unshift(""),o.join("/")}function v(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 m(t){return t.replace(/\/\//g,"/")}function g(t,e){for(var n,r=[],o=0,i=0,a="",u=e&&e.delimiter||"/";null!=(n=Kt.exec(t));){var c=n[0],s=n[1],p=n.index;if(a+=t.slice(i,p),i=p+c.length,s)a+=s[1];else{var f=t[i],h=n[2],l=n[3],d=n[4],y=n[5],v=n[6],m=n[7];a&&(r.push(a),a="");var g=null!=h&&null!=f&&f!==h,w="+"===v||"*"===v,b="?"===v||"*"===v,x=n[2]||u,k=d||y;r.push({name:l||o++,prefix:h||"",delimiter:x,optional:b,repeat:w,partial:g,asterisk:!!m,pattern:k?O(k):m?".*":"[^"+E(x)+"]+?"})}}return i<t.length&&(a+=t.substr(i)),a&&r.push(a),r}function w(t,e){return k(g(t,e))}function b(t){return encodeURI(t).replace(/[\/?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function x(t){return encodeURI(t).replace(/[?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function k(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,r){for(var o="",i=n||{},a=r||{},u=a.pretty?b:encodeURIComponent,c=0;c<t.length;c++){var s=t[c];if("string"!=typeof s){var p,f=i[s.name];if(null==f){if(s.optional){s.partial&&(o+=s.prefix);continue}throw new TypeError('Expected "'+s.name+'" to be defined')}if(Vt(f)){if(!s.repeat)throw new TypeError('Expected "'+s.name+'" to not repeat, but received `'+JSON.stringify(f)+"`");if(0===f.length){if(s.optional)continue;throw new TypeError('Expected "'+s.name+'" to not be empty')}for(var h=0;h<f.length;h++){if(p=u(f[h]),!e[c].test(p))throw new TypeError('Expected all "'+s.name+'" to match "'+s.pattern+'", but received `'+JSON.stringify(p)+"`");o+=(0===h?s.prefix:s.delimiter)+p}}else{if(p=s.asterisk?x(f):u(f),!e[c].test(p))throw new TypeError('Expected "'+s.name+'" to match "'+s.pattern+'", but received "'+p+'"');o+=s.prefix+p}}else o+=s}return o}}function E(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function O(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function R(t,e){return t.keys=e,t}function C(t){return t.sensitive?"":"i"}function A(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 R(t,e)}function j(t,e,n){for(var r=[],o=0;o<t.length;o++)r.push($(t[o],e,n).source);var i=new RegExp("(?:"+r.join("|")+")",C(n));return R(i,e)}function T(t,e,n){return _(g(t,n),e,n)}function _(t,e,n){Vt(e)||(n=e||n,e=[]),n=n||{};for(var r=n.strict,o=n.end!==!1,i="",a=0;a<t.length;a++){var u=t[a];if("string"==typeof u)i+=E(u);else{var c=E(u.prefix),s="(?:"+u.pattern+")";e.push(u),u.repeat&&(s+="(?:"+c+s+")*"),s=u.optional?u.partial?c+"("+s+")?":"(?:"+c+"("+s+"))?":c+"("+s+")",i+=s}}var p=E(n.delimiter||"/"),f=i.slice(-p.length)===p;return r||(i=(f?i.slice(0,-p.length):i)+"(?:"+p+"(?=$))?"),i+=o?"$":r&&f?"":"(?="+p+"|$)",R(new RegExp("^"+i,C(n)),e)}function $(t,e,n){return Vt(e)||(n=e||n,e=[]),n=n||{},t instanceof RegExp?A(t,e):Vt(t)?j(t,e,n):T(t,e,n)}function S(t,e,n){try{var r=Jt[t]||(Jt[t]=zt.compile(t));return r(e||{},{pretty:!0})}catch(t){return""}}function q(t,e,n,r){var o=e||[],i=n||Object.create(null),a=r||Object.create(null);t.forEach(function(t){L(o,i,a,t)});for(var u=0,c=o.length;u<c;u++)"*"===o[u]&&(o.push(o.splice(u,1)[0]),c--,u--);return{pathList:o,pathMap:i,nameMap:a}}function L(t,e,n,r,o,i){var a=r.path,u=r.name,c=U(a,o),s={path:c,regex:P(c),components:r.components||{default:r.component},instances:{},name:u,parent:o,matchAs:i,redirect:r.redirect,beforeEnter:r.beforeEnter,meta:r.meta||{},props:null==r.props?{}:r.components?r.props:{default:r.props}};if(r.children&&r.children.forEach(function(r){var o=i?m(i+"/"+r.path):void 0;L(t,e,n,r,s,o)}),void 0!==r.alias)if(Array.isArray(r.alias))r.alias.forEach(function(i){var a={path:i,children:r.children};L(t,e,n,a,o,s.path)});else{var p={path:r.alias,children:r.children};L(t,e,n,p,o,s.path)}e[s.path]||(t.push(s.path),e[s.path]=s),u&&(n[u]||(n[u]=s))}function P(t){var e=zt(t);return e}function U(t,e){return t=t.replace(/\/$/,""),"/"===t[0]?t:null==e?t:m(e.path+"/"+t)}function H(t,e,r,o){var i="string"==typeof t?{path:t}:t;if(i.name||i._normalized)return i;if(!i.path&&i.params&&e){i=I({},i),i._normalized=!0;var a=I(I({},e.params),i.params);if(e.name)i.name=e.name,i.params=a;else if(e.matched){var u=e.matched[e.matched.length-1].path;i.path=S(u,a,"path "+e.path)}return i}var c=v(i.path||""),s=e&&e.path||"/",p=c.path?y(c.path,s,r||i.append):s,f=n(c.query,i.query,o&&o.options.parseQuery),h=i.hash||c.hash;return h&&"#"!==h.charAt(0)&&(h="#"+h),{_normalized:!0,path:p,query:f,hash:h}}function I(t,e){for(var n in e)t[n]=e[n];return t}function V(t,e){function n(t){q(t,s,p,f)}function r(t,n,r){var o=H(t,n,!1,e),i=o.name;if(i){var a=f[i],c=a.regex.keys.filter(function(t){return!t.optional}).map(function(t){return t.name});if("object"!=typeof o.params&&(o.params={}),n&&"object"==typeof n.params)for(var h in n.params)!(h in o.params)&&c.indexOf(h)>-1&&(o.params[h]=n.params[h]);if(a)return o.path=S(a.path,o.params,'named route "'+i+'"'),u(a,o,r)}else if(o.path){o.params={};for(var l=0;l<s.length;l++){var d=s[l],y=p[d];if(z(y.regex,o.path,o.params))return u(y,o,r)}}return u(null,o)}function o(t,n){var o=t.redirect,a="function"==typeof o?o(i(t,n,null,e)):o;if("string"==typeof a&&(a={path:a}),!a||"object"!=typeof a)return u(null,n);var c=a,s=c.name,p=c.path,h=n.query,l=n.hash,d=n.params;if(h=c.hasOwnProperty("query")?c.query:h,l=c.hasOwnProperty("hash")?c.hash:l,d=c.hasOwnProperty("params")?c.params:d,s){f[s];return r({_normalized:!0,name:s,query:h,hash:l,params:d},void 0,n)}if(p){var y=M(p,t),v=S(y,d,'redirect route with path "'+y+'"');return r({_normalized:!0,path:v,query:h,hash:l},void 0,n)}return u(null,n)}function a(t,e,n){var o=S(n,e.params,'aliased route with path "'+n+'"'),i=r({_normalized:!0,path:o});if(i){var a=i.matched,c=a[a.length-1];return e.params=i.params,u(c,e)}return u(null,e)}function u(t,n,r){return t&&t.redirect?o(t,r||n):t&&t.matchAs?a(t,n,t.matchAs):i(t,n,r,e)}var c=q(t),s=c.pathList,p=c.pathMap,f=c.nameMap;return{match:r,addRoutes:n}}function z(t,e,n){var r=e.match(t);if(!r)return!1;if(!n)return!0;for(var o=1,i=r.length;o<i;++o){var a=t.keys[o-1],u="string"==typeof r[o]?decodeURIComponent(r[o]):r[o];a&&(n[a.name]=u)}return!0}function M(t,e){return y(t,e.parent?e.parent.path:"/",!0)}function B(){window.addEventListener("popstate",function(t){D(),t.state&&t.state.key&&G(t.state.key)})}function F(t,e,n,r){if(t.app){var o=t.options.scrollBehavior;o&&t.app.$nextTick(function(){var t=K(),i=o(e,n,r?t:null);if(i){var a="object"==typeof i;if(a&&"string"==typeof i.selector){var u=document.querySelector(i.selector);u?t=J(u):N(i)&&(t=Q(i))}else a&&N(i)&&(t=Q(i));t&&window.scrollTo(t.x,t.y)}})}}function D(){var t=W();t&&(Nt[t]={x:window.pageXOffset,y:window.pageYOffset})}function K(){var t=W();if(t)return Nt[t]}function J(t){var e=document.documentElement,n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return{x:r.left-n.left,y:r.top-n.top}}function N(t){return X(t.x)||X(t.y)}function Q(t){return{x:X(t.x)?t.x:window.pageXOffset,y:X(t.y)?t.y:window.pageYOffset}}function X(t){return"number"==typeof t}function Y(){return Xt.now().toFixed(3)}function W(){return Yt}function G(t){Yt=t}function Z(t,e){D();var n=window.history;try{e?n.replaceState({key:Yt},"",t):(Yt=Y(),n.pushState({key:Yt},"",t))}catch(n){window.location[e?"replace":"assign"](t)}}function tt(t){Z(t,!0)}function et(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 nt(t){if(!t)if(Ht){var e=document.querySelector("base");t=e&&e.getAttribute("href")||"/"}else t="/";return"/"!==t.charAt(0)&&(t="/"+t),t.replace(/\/$/,"")}function rt(t,e){var n,r=Math.max(t.length,e.length);for(n=0;n<r&&t[n]===e[n];n++);return{updated:e.slice(0,n),activated:e.slice(n),deactivated:t.slice(n)}}function ot(t,e,n,r){var o=lt(t,function(t,r,o,i){var a=it(t,e);if(a)return Array.isArray(a)?a.map(function(t){return n(t,r,o,i)}):n(a,r,o,i)});return dt(r?o.reverse():o)}function it(t,e){return"function"!=typeof t&&(t=Rt.extend(t)),t.options[e]}function at(t){return ot(t,"beforeRouteLeave",ct,!0)}function ut(t){return ot(t,"beforeRouteUpdate",ct)}function ct(t,e){if(e)return function(){return t.apply(e,arguments)}}function st(t,e,n){return ot(t,"beforeRouteEnter",function(t,r,o,i){return pt(t,o,i,e,n)})}function pt(t,e,n,r,o){return function(i,a,u){return t(i,a,function(t){u(t),"function"==typeof t&&r.push(function(){ft(t,e.instances,n,o)})})}}function ft(t,e,n,r){e[n]?t(e[n]):r()&&setTimeout(function(){ft(t,e,n,r)},16)}function ht(t){return function(e,n,r){var o=!1,i=0,a=null;lt(t,function(t,e,n,u){if("function"==typeof t&&void 0===t.cid){o=!0,i++;var c,s=yt(function(e){t.resolved="function"==typeof e?e:Rt.extend(e),n.components[u]=e,i--,i<=0&&r()}),p=yt(function(t){var e="Failed to resolve async component "+u+": "+t;a||(a=vt(t)?t:new Error(e),r(a))});try{c=t(s,p)}catch(t){p(t)}if(c)if("function"==typeof c.then)c.then(s,p);else{var f=c.component;f&&"function"==typeof f.then&&f.then(s,p)}}}),o||r()}}function lt(t,e){return dt(t.map(function(t){return Object.keys(t.components).map(function(n){return e(t.components[n],t.instances[n],t,n)})}))}function dt(t){return Array.prototype.concat.apply([],t)}function yt(t){var e=!1;return function(){if(!e)return e=!0,t.apply(this,arguments)}}function vt(t){return Object.prototype.toString.call(t).indexOf("Error")>-1}function mt(t){var e=window.location.pathname;return t&&0===e.indexOf(t)&&(e=e.slice(t.length)),(e||"/")+window.location.search+window.location.hash}function gt(t){var e=mt(t);if(!/^\/#/.test(e))return window.location.replace(m(t+"/#"+e)),!0}function wt(){var t=bt();return"/"===t.charAt(0)||(kt("/"+t),!1)}function bt(){var t=window.location.href,e=t.indexOf("#");return e===-1?"":t.slice(e+1)}function xt(t){window.location.hash=t}function kt(t){var e=window.location.href.indexOf("#");window.location.replace(window.location.href.slice(0,e>=0?e:0)+"#"+t)}function Et(t,e){return t.push(e),function(){var n=t.indexOf(e);n>-1&&t.splice(n,1)}}function Ot(t,e,n){var r="hash"===n?"#"+e:e;return t?m(t+"/"+r):r}var Rt,Ct={name:"router-view",functional:!0,props:{name:{type:String,default:"default"}},render:function(t,n){var r=n.props,o=n.children,i=n.parent,a=n.data;a.routerView=!0;for(var u=i.$createElement,c=r.name,s=i.$route,p=i._routerViewCache||(i._routerViewCache={}),f=0,h=!1;i;)i.$vnode&&i.$vnode.data.routerView&&f++,i._inactive&&(h=!0),i=i.$parent;if(a.routerViewDepth=f,h)return u(p[c],a,o);var l=s.matched[f];if(!l)return p[c]=null,u();var d=p[c]=l.components[c];return a.registerRouteInstance=function(t,e){l.instances[c]!==t&&(l.instances[c]=e)},(a.hook||(a.hook={})).prepatch=function(t,e){l.instances[c]=e.componentInstance},a.props=e(s,l.props&&l.props[c]),u(d,a,o)}},At=/[!'()*]/g,jt=function(t){return"%"+t.charCodeAt(0).toString(16)},Tt=/%2C/g,_t=function(t){return encodeURIComponent(t).replace(At,jt).replace(Tt,",")},$t=decodeURIComponent,St=/\/?$/,qt=i(null,{path:"/"}),Lt=[String,Object],Pt=[String,Array],Ut={name:"router-link",props:{to:{type:Lt,required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,event:{type:Pt,default:"click"}},render:function(t){var e=this,n=this.$router,r=this.$route,o=n.resolve(this.to,r,this.append),a=o.location,u=o.route,s=o.href,f={},d=n.options.linkActiveClass,y=n.options.linkExactActiveClass,v=null==d?"router-link-active":d,m=null==y?"router-link-exact-active":y,g=null==this.activeClass?v:this.activeClass,w=null==this.exactActiveClass?m:this.exactActiveClass,b=a.path?i(null,a,null,n):u;f[w]=c(r,b),f[g]=this.exact?f[w]:p(r,b);var x=function(t){h(t)&&(e.replace?n.replace(a):n.push(a))},k={click:h};Array.isArray(this.event)?this.event.forEach(function(t){k[t]=x}):k[this.event]=x;var E={class:f};if("a"===this.tag)E.on=k,E.attrs={href:s};else{var O=l(this.$slots.default);if(O){O.isStatic=!1;var R=Rt.util.extend,C=O.data=R({},O.data);C.on=k;var A=O.data.attrs=R({},O.data.attrs);A.href=s}else E.on=k}return t(this.tag,E,this.$slots.default)}},Ht="undefined"!=typeof window,It=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},Vt=It,zt=$,Mt=g,Bt=w,Ft=k,Dt=_,Kt=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");zt.parse=Mt,zt.compile=Bt,zt.tokensToFunction=Ft,zt.tokensToRegExp=Dt;var Jt=Object.create(null),Nt=Object.create(null),Qt=Ht&&function(){var t=window.navigator.userAgent;return(t.indexOf("Android 2.")===-1&&t.indexOf("Android 4.0")===-1||t.indexOf("Mobile Safari")===-1||t.indexOf("Chrome")!==-1||t.indexOf("Windows Phone")!==-1)&&(window.history&&"pushState"in window.history)}(),Xt=Ht&&window.performance&&window.performance.now?window.performance:Date,Yt=Y(),Wt=function(t,e){this.router=t,this.base=nt(e),this.current=qt,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[]};Wt.prototype.listen=function(t){this.cb=t},Wt.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},Wt.prototype.onError=function(t){this.errorCbs.push(t)},Wt.prototype.transitionTo=function(t,e,n){var r=this,o=this.router.match(t,this.current);this.confirmTransition(o,function(){r.updateRoute(o),e&&e(o),r.ensureURL(),r.ready||(r.ready=!0,r.readyCbs.forEach(function(t){t(o)}))},function(t){n&&n(t),t&&!r.ready&&(r.ready=!0,r.readyErrorCbs.forEach(function(e){e(t)}))})},Wt.prototype.confirmTransition=function(e,n,r){var o=this,i=this.current,a=function(e){vt(e)&&(o.errorCbs.length?o.errorCbs.forEach(function(t){t(e)}):(t(!1,"uncaught error during route navigation:"),console.error(e))),r&&r(e)};if(c(e,i)&&e.matched.length===i.matched.length)return this.ensureURL(),a();var u=rt(this.current.matched,e.matched),s=u.updated,p=u.deactivated,f=u.activated,h=[].concat(at(p),this.router.beforeHooks,ut(s),f.map(function(t){return t.beforeEnter}),ht(f));this.pending=e;var l=function(t,n){if(o.pending!==e)return a();try{t(e,i,function(t){t===!1||vt(t)?(o.ensureURL(!0),a(t)):"string"==typeof t||"object"==typeof t&&("string"==typeof t.path||"string"==typeof t.name)?(a(),"object"==typeof t&&t.replace?o.replace(t):o.push(t)):n(t)})}catch(t){a(t)}};et(h,l,function(){var t=[],r=function(){return o.current===e},i=st(f,t,r),u=i.concat(o.router.resolveHooks);et(u,l,function(){return o.pending!==e?a():(o.pending=null,n(e),void(o.router.app&&o.router.app.$nextTick(function(){t.forEach(function(t){t()})})))})})},Wt.prototype.updateRoute=function(t){var e=this.current;this.current=t,this.cb&&this.cb(t),this.router.afterHooks.forEach(function(n){n&&n(t,e)})};var Gt=function(t){function e(e,n){var r=this;t.call(this,e,n);var o=e.options.scrollBehavior;o&&B(),window.addEventListener("popstate",function(t){r.transitionTo(mt(r.base),function(t){o&&F(e,t,r.current,!0)})})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.go=function(t){window.history.go(t)},e.prototype.push=function(t,e,n){var r=this,o=this,i=o.current;this.transitionTo(t,function(t){Z(m(r.base+t.fullPath)),F(r.router,t,i,!1),e&&e(t)},n)},e.prototype.replace=function(t,e,n){var r=this,o=this,i=o.current;this.transitionTo(t,function(t){tt(m(r.base+t.fullPath)),F(r.router,t,i,!1),e&&e(t)},n)},e.prototype.ensureURL=function(t){if(mt(this.base)!==this.current.fullPath){var e=m(this.base+this.current.fullPath);t?Z(e):tt(e)}},e.prototype.getCurrentLocation=function(){return mt(this.base)},e}(Wt),Zt=function(t){function e(e,n,r){t.call(this,e,n),r&&gt(this.base)||wt()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this;window.addEventListener("hashchange",function(){wt()&&t.transitionTo(bt(),function(t){kt(t.fullPath)})})},e.prototype.push=function(t,e,n){this.transitionTo(t,function(t){xt(t.fullPath),e&&e(t)},n)},e.prototype.replace=function(t,e,n){this.transitionTo(t,function(t){kt(t.fullPath),e&&e(t)},n)},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;bt()!==e&&(t?xt(e):kt(e))},e.prototype.getCurrentLocation=function(){return bt()},e}(Wt),te=function(t){function e(e,n){t.call(this,e,n),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t,e,n){var r=this;this.transitionTo(t,function(t){r.stack=r.stack.slice(0,r.index+1).concat(t),r.index++,e&&e(t)},n)},e.prototype.replace=function(t,e,n){var r=this;this.transitionTo(t,function(t){r.stack=r.stack.slice(0,r.index).concat(t),e&&e(t)},n)},e.prototype.go=function(t){var e=this,n=this.index+t;if(!(n<0||n>=this.stack.length)){var r=this.stack[n];this.confirmTransition(r,function(){e.index=n,e.updateRoute(r)})}},e.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},e.prototype.ensureURL=function(){},e}(Wt),ee=function(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=V(t.routes||[],this);var e=t.mode||"hash";switch(this.fallback="history"===e&&!Qt,this.fallback&&(e="hash"),Ht||(e="abstract"),this.mode=e,e){case"history":this.history=new Gt(this,t.base);break;case"hash":this.history=new Zt(this,t.base,this.fallback);break;case"abstract":this.history=new te(this,t.base)}},ne={currentRoute:{}};return ee.prototype.match=function(t,e,n){return this.matcher.match(t,e,n)},ne.currentRoute.get=function(){return this.history&&this.history.current},ee.prototype.init=function(t){var e=this;if(this.apps.push(t),!this.app){this.app=t;var n=this.history;if(n instanceof Gt)n.transitionTo(n.getCurrentLocation());else if(n instanceof Zt){var r=function(){n.setupListeners()};n.transitionTo(n.getCurrentLocation(),r,r)}n.listen(function(t){e.apps.forEach(function(e){e._route=t})})}},ee.prototype.beforeEach=function(t){return Et(this.beforeHooks,t)},ee.prototype.beforeResolve=function(t){return Et(this.resolveHooks,t)},ee.prototype.afterEach=function(t){return Et(this.afterHooks,t)},ee.prototype.onReady=function(t,e){this.history.onReady(t,e)},ee.prototype.onError=function(t){this.history.onError(t)},ee.prototype.push=function(t,e,n){this.history.push(t,e,n)},ee.prototype.replace=function(t,e,n){this.history.replace(t,e,n)},ee.prototype.go=function(t){this.history.go(t)},ee.prototype.back=function(){this.go(-1)},ee.prototype.forward=function(){this.go(1)},ee.prototype.getMatchedComponents=function(t){var e=t?this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map(function(t){return Object.keys(t.components).map(function(e){return t.components[e]})})):[]},ee.prototype.resolve=function(t,e,n){var r=H(t,e||this.history.current,n,this),o=this.match(r,e),i=o.redirectedFrom||o.fullPath,a=this.history.base,u=Ot(a,i,this.mode);return{location:r,route:o,href:u,normalizedTo:r,resolved:o}},ee.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==qt&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(ee.prototype,ne),ee.install=d,ee.version="2.5.2",Ht&&window.Vue&&window.Vue.use(ee),ee});
6
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.VueRouter=e()}(this,function(){"use strict";function t(t,e){}function e(t){return Object.prototype.toString.call(t).indexOf("Error")>-1}function r(t,e){switch(typeof e){case"undefined":return;case"object":return e;case"function":return e(t);case"boolean":return e?t.params:void 0}}function n(t,e,r){void 0===e&&(e={});var n,i=r||o;try{n=i(t||"")}catch(t){n={}}for(var a in e){var u=e[a];n[a]=Array.isArray(u)?u.slice():u}return n}function o(t){var e={};return(t=t.trim().replace(/^(\?|#|&)/,""))?(t.split("&").forEach(function(t){var r=t.replace(/\+/g," ").split("="),n=$t(r.shift()),o=r.length>0?$t(r.join("=")):null;void 0===e[n]?e[n]=o:Array.isArray(e[n])?e[n].push(o):e[n]=[e[n],o]}),e):e}function i(t){var e=t?Object.keys(t).map(function(e){var r=t[e];if(void 0===r)return"";if(null===r)return Tt(e);if(Array.isArray(r)){var n=[];return r.forEach(function(t){void 0!==t&&(null===t?n.push(Tt(e)):n.push(Tt(e)+"="+Tt(t)))}),n.join("&")}return Tt(e)+"="+Tt(r)}).filter(function(t){return t.length>0}).join("&"):null;return e?"?"+e:""}function a(t,e,r,n){var o=n&&n.options.stringifyQuery,i={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:e.query||{},params:e.params||{},fullPath:c(e,o),matched:t?u(t):[]};return r&&(i.redirectedFrom=c(r,o)),Object.freeze(i)}function u(t){for(var e=[];t;)e.unshift(t),t=t.parent;return e}function c(t,e){var r=t.path,n=t.query;void 0===n&&(n={});var o=t.hash;void 0===o&&(o="");var a=e||i;return(r||"/")+a(n)+o}function s(t,e){return e===qt?t===e:!!e&&(t.path&&e.path?t.path.replace(St,"")===e.path.replace(St,"")&&t.hash===e.hash&&p(t.query,e.query):!(!t.name||!e.name)&&(t.name===e.name&&t.hash===e.hash&&p(t.query,e.query)&&p(t.params,e.params)))}function p(t,e){void 0===t&&(t={}),void 0===e&&(e={});var r=Object.keys(t),n=Object.keys(e);return r.length===n.length&&r.every(function(r){var n=t[r],o=e[r];return"object"==typeof n&&"object"==typeof o?p(n,o):String(n)===String(o)})}function f(t,e){return 0===t.path.replace(St,"/").indexOf(e.path.replace(St,"/"))&&(!e.hash||t.hash===e.hash)&&h(t.query,e.query)}function h(t,e){for(var r in e)if(!(r in t))return!1;return!0}function l(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey||t.defaultPrevented||void 0!==t.button&&0!==t.button)){if(t.currentTarget&&t.currentTarget.getAttribute){var e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function d(t){if(t)for(var e,r=0;r<t.length;r++){if("a"===(e=t[r]).tag)return e;if(e.children&&(e=d(e.children)))return e}}function y(t){if(!y.installed){y.installed=!0,Ot=t;var e=function(t){return void 0!==t},r=function(t,r){var n=t.$options._parentVnode;e(n)&&e(n=n.data)&&e(n=n.registerRouteInstance)&&n(t,r)};t.mixin({beforeCreate:function(){e(this.$options.router)?(this._routerRoot=this,this._router=this.$options.router,this._router.init(this),t.util.defineReactive(this,"_route",this._router.history.current)):this._routerRoot=this.$parent&&this.$parent._routerRoot||this,r(this,this)},destroyed:function(){r(this)}}),Object.defineProperty(t.prototype,"$router",{get:function(){return this._routerRoot._router}}),Object.defineProperty(t.prototype,"$route",{get:function(){return this._routerRoot._route}}),t.component("router-view",Ct),t.component("router-link",Ut);var n=t.config.optionMergeStrategies;n.beforeRouteEnter=n.beforeRouteLeave=n.beforeRouteUpdate=n.created}}function v(t,e,r){var n=t.charAt(0);if("/"===n)return t;if("?"===n||"#"===n)return e+t;var o=e.split("/");r&&o[o.length-1]||o.pop();for(var i=t.replace(/^\//,"").split("/"),a=0;a<i.length;a++){var u=i[a];".."===u?o.pop():"."!==u&&o.push(u)}return""!==o[0]&&o.unshift(""),o.join("/")}function m(t){var e="",r="",n=t.indexOf("#");n>=0&&(e=t.slice(n),t=t.slice(0,n));var o=t.indexOf("?");return o>=0&&(r=t.slice(o+1),t=t.slice(0,o)),{path:t,query:r,hash:e}}function g(t){return t.replace(/\/\//g,"/")}function b(t,e){for(var r,n=[],o=0,i=0,a="",u=e&&e.delimiter||"/";null!=(r=Ft.exec(t));){var c=r[0],s=r[1],p=r.index;if(a+=t.slice(i,p),i=p+c.length,s)a+=s[1];else{var f=t[i],h=r[2],l=r[3],d=r[4],y=r[5],v=r[6],m=r[7];a&&(n.push(a),a="");var g=null!=h&&null!=f&&f!==h,b="+"===v||"*"===v,w="?"===v||"*"===v,x=r[2]||u,k=d||y;n.push({name:l||o++,prefix:h||"",delimiter:x,optional:w,repeat:b,partial:g,asterisk:!!m,pattern:k?E(k):m?".*":"[^"+R(x)+"]+?"})}}return i<t.length&&(a+=t.substr(i)),a&&n.push(a),n}function w(t){return encodeURI(t).replace(/[\/?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function x(t){return encodeURI(t).replace(/[?#]/g,function(t){return"%"+t.charCodeAt(0).toString(16).toUpperCase()})}function k(t){for(var e=new Array(t.length),r=0;r<t.length;r++)"object"==typeof t[r]&&(e[r]=new RegExp("^(?:"+t[r].pattern+")$"));return function(r,n){for(var o="",i=r||{},a=(n||{}).pretty?w:encodeURIComponent,u=0;u<t.length;u++){var c=t[u];if("string"!=typeof c){var s,p=i[c.name];if(null==p){if(c.optional){c.partial&&(o+=c.prefix);continue}throw new TypeError('Expected "'+c.name+'" to be defined')}if(It(p)){if(!c.repeat)throw new TypeError('Expected "'+c.name+'" to not repeat, but received `'+JSON.stringify(p)+"`");if(0===p.length){if(c.optional)continue;throw new TypeError('Expected "'+c.name+'" to not be empty')}for(var f=0;f<p.length;f++){if(s=a(p[f]),!e[u].test(s))throw new TypeError('Expected all "'+c.name+'" to match "'+c.pattern+'", but received `'+JSON.stringify(s)+"`");o+=(0===f?c.prefix:c.delimiter)+s}}else{if(s=c.asterisk?x(p):a(p),!e[u].test(s))throw new TypeError('Expected "'+c.name+'" to match "'+c.pattern+'", but received "'+s+'"');o+=c.prefix+s}}else o+=c}return o}}function R(t){return t.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function E(t){return t.replace(/([=!:$\/()])/g,"\\$1")}function O(t,e){return t.keys=e,t}function C(t){return t.sensitive?"":"i"}function A(t,e){var r=t.source.match(/\((?!\?)/g);if(r)for(var n=0;n<r.length;n++)e.push({name:n,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return O(t,e)}function j(t,e,r){for(var n=[],o=0;o<t.length;o++)n.push($(t[o],e,r).source);return O(new RegExp("(?:"+n.join("|")+")",C(r)),e)}function _(t,e,r){return T(b(t,r),e,r)}function T(t,e,r){It(e)||(r=e||r,e=[]);for(var n=(r=r||{}).strict,o=!1!==r.end,i="",a=0;a<t.length;a++){var u=t[a];if("string"==typeof u)i+=R(u);else{var c=R(u.prefix),s="(?:"+u.pattern+")";e.push(u),u.repeat&&(s+="(?:"+c+s+")*"),i+=s=u.optional?u.partial?c+"("+s+")?":"(?:"+c+"("+s+"))?":c+"("+s+")"}}var p=R(r.delimiter||"/"),f=i.slice(-p.length)===p;return n||(i=(f?i.slice(0,-p.length):i)+"(?:"+p+"(?=$))?"),i+=o?"$":n&&f?"":"(?="+p+"|$)",O(new RegExp("^"+i,C(r)),e)}function $(t,e,r){return It(e)||(r=e||r,e=[]),r=r||{},t instanceof RegExp?A(t,e):It(t)?j(t,e,r):_(t,e,r)}function S(t,e,r){try{return(Dt[t]||(Dt[t]=Mt.compile(t)))(e||{},{pretty:!0})}catch(t){return""}}function q(t,e,r,n){var o=e||[],i=r||Object.create(null),a=n||Object.create(null);t.forEach(function(t){L(o,i,a,t)});for(var u=0,c=o.length;u<c;u++)"*"===o[u]&&(o.push(o.splice(u,1)[0]),c--,u--);return{pathList:o,pathMap:i,nameMap:a}}function L(t,e,r,n,o,i){var a=n.path,u=n.name,c=U(a,o),s=n.pathToRegexpOptions||{};"boolean"==typeof n.caseSensitive&&(s.sensitive=n.caseSensitive);var p={path:c,regex:P(c,s),components:n.components||{default:n.component},instances:{},name:u,parent:o,matchAs:i,redirect:n.redirect,beforeEnter:n.beforeEnter,meta:n.meta||{},props:null==n.props?{}:n.components?n.props:{default:n.props}};n.children&&n.children.forEach(function(n){var o=i?g(i+"/"+n.path):void 0;L(t,e,r,n,p,o)}),void 0!==n.alias&&(Array.isArray(n.alias)?n.alias:[n.alias]).forEach(function(i){var a={path:i,children:n.children};L(t,e,r,a,o,p.path||"/")}),e[p.path]||(t.push(p.path),e[p.path]=p),u&&(r[u]||(r[u]=p))}function P(t,e){return Mt(t,[],e)}function U(t,e){return t=t.replace(/\/$/,""),"/"===t[0]?t:null==e?t:g(e.path+"/"+t)}function H(t,e,r,o){var i="string"==typeof t?{path:t}:t;if(i.name||i._normalized)return i;if(!i.path&&i.params&&e){(i=I({},i))._normalized=!0;var a=I(I({},e.params),i.params);if(e.name)i.name=e.name,i.params=a;else if(e.matched.length){var u=e.matched[e.matched.length-1].path;i.path=S(u,a,"path "+e.path)}return i}var c=m(i.path||""),s=e&&e.path||"/",p=c.path?v(c.path,s,r||i.append):s,f=n(c.query,i.query,o&&o.options.parseQuery),h=i.hash||c.hash;return h&&"#"!==h.charAt(0)&&(h="#"+h),{_normalized:!0,path:p,query:f,hash:h}}function I(t,e){for(var r in e)t[r]=e[r];return t}function M(t,e){function r(t,r,n){var o=H(t,r,!1,e),a=o.name;if(a){var u=p[a];if(!u)return i(null,o);var f=u.regex.keys.filter(function(t){return!t.optional}).map(function(t){return t.name});if("object"!=typeof o.params&&(o.params={}),r&&"object"==typeof r.params)for(var h in r.params)!(h in o.params)&&f.indexOf(h)>-1&&(o.params[h]=r.params[h]);if(u)return o.path=S(u.path,o.params,'named route "'+a+'"'),i(u,o,n)}else if(o.path){o.params={};for(var l=0;l<c.length;l++){var d=c[l],y=s[d];if(V(y.regex,o.path,o.params))return i(y,o,n)}}return i(null,o)}function n(t,n){var o=t.redirect,u="function"==typeof o?o(a(t,n,null,e)):o;if("string"==typeof u&&(u={path:u}),!u||"object"!=typeof u)return i(null,n);var c=u,s=c.name,f=c.path,h=n.query,l=n.hash,d=n.params;if(h=c.hasOwnProperty("query")?c.query:h,l=c.hasOwnProperty("hash")?c.hash:l,d=c.hasOwnProperty("params")?c.params:d,s){p[s];return r({_normalized:!0,name:s,query:h,hash:l,params:d},void 0,n)}if(f){var y=z(f,t);return r({_normalized:!0,path:S(y,d,'redirect route with path "'+y+'"'),query:h,hash:l},void 0,n)}return i(null,n)}function o(t,e,n){var o=r({_normalized:!0,path:S(n,e.params,'aliased route with path "'+n+'"')});if(o){var a=o.matched,u=a[a.length-1];return e.params=o.params,i(u,e)}return i(null,e)}function i(t,r,i){return t&&t.redirect?n(t,i||r):t&&t.matchAs?o(t,r,t.matchAs):a(t,r,i,e)}var u=q(t),c=u.pathList,s=u.pathMap,p=u.nameMap;return{match:r,addRoutes:function(t){q(t,c,s,p)}}}function V(t,e,r){var n=e.match(t);if(!n)return!1;if(!r)return!0;for(var o=1,i=n.length;o<i;++o){var a=t.keys[o-1],u="string"==typeof n[o]?decodeURIComponent(n[o]):n[o];a&&(r[a.name]=u)}return!0}function z(t,e){return v(t,e.parent?e.parent.path:"/",!0)}function B(){window.addEventListener("popstate",function(t){D(),t.state&&t.state.key&&Z(t.state.key)})}function F(t,e,r,n){if(t.app){var o=t.options.scrollBehavior;o&&t.app.$nextTick(function(){var t=K(),i=o(e,r,n?t:null);if(i){var a="object"==typeof i;if(a&&"string"==typeof i.selector){var u=document.querySelector(i.selector);if(u){var c=i.offset&&"object"==typeof i.offset?i.offset:{};t=J(u,c=X(c))}else N(i)&&(t=Q(i))}else a&&N(i)&&(t=Q(i));t&&window.scrollTo(t.x,t.y)}})}}function D(){var t=G();t&&(Kt[t]={x:window.pageXOffset,y:window.pageYOffset})}function K(){var t=G();if(t)return Kt[t]}function J(t,e){var r=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{x:n.left-r.left-e.x,y:n.top-r.top-e.y}}function N(t){return Y(t.x)||Y(t.y)}function Q(t){return{x:Y(t.x)?t.x:window.pageXOffset,y:Y(t.y)?t.y:window.pageYOffset}}function X(t){return{x:Y(t.x)?t.x:0,y:Y(t.y)?t.y:0}}function Y(t){return"number"==typeof t}function W(){return Nt.now().toFixed(3)}function G(){return Qt}function Z(t){Qt=t}function tt(t,e){D();var r=window.history;try{e?r.replaceState({key:Qt},"",t):(Qt=W(),r.pushState({key:Qt},"",t))}catch(r){window.location[e?"replace":"assign"](t)}}function et(t){tt(t,!0)}function rt(t,e,r){var n=function(o){o>=t.length?r():t[o]?e(t[o],function(){n(o+1)}):n(o+1)};n(0)}function nt(t){return function(r,n,o){var i=!1,a=0,u=null;ot(t,function(t,r,n,c){if("function"==typeof t&&void 0===t.cid){i=!0,a++;var s,p=at(function(e){e.__esModule&&e.default&&(e=e.default),t.resolved="function"==typeof e?e:Ot.extend(e),n.components[c]=e,--a<=0&&o()}),f=at(function(t){var r="Failed to resolve async component "+c+": "+t;u||(u=e(t)?t:new Error(r),o(u))});try{s=t(p,f)}catch(t){f(t)}if(s)if("function"==typeof s.then)s.then(p,f);else{var h=s.component;h&&"function"==typeof h.then&&h.then(p,f)}}}),i||o()}}function ot(t,e){return it(t.map(function(t){return Object.keys(t.components).map(function(r){return e(t.components[r],t.instances[r],t,r)})}))}function it(t){return Array.prototype.concat.apply([],t)}function at(t){var e=!1;return function(){for(var r=[],n=arguments.length;n--;)r[n]=arguments[n];if(!e)return e=!0,t.apply(this,r)}}function ut(t){if(!t)if(Ht){var e=document.querySelector("base");t=(t=e&&e.getAttribute("href")||"/").replace(/^https?:\/\/[^\/]+/,"")}else t="/";return"/"!==t.charAt(0)&&(t="/"+t),t.replace(/\/$/,"")}function ct(t,e){var r,n=Math.max(t.length,e.length);for(r=0;r<n&&t[r]===e[r];r++);return{updated:e.slice(0,r),activated:e.slice(r),deactivated:t.slice(r)}}function st(t,e,r,n){var o=ot(t,function(t,n,o,i){var a=pt(t,e);if(a)return Array.isArray(a)?a.map(function(t){return r(t,n,o,i)}):r(a,n,o,i)});return it(n?o.reverse():o)}function pt(t,e){return"function"!=typeof t&&(t=Ot.extend(t)),t.options[e]}function ft(t){return st(t,"beforeRouteLeave",lt,!0)}function ht(t){return st(t,"beforeRouteUpdate",lt)}function lt(t,e){if(e)return function(){return t.apply(e,arguments)}}function dt(t,e,r){return st(t,"beforeRouteEnter",function(t,n,o,i){return yt(t,o,i,e,r)})}function yt(t,e,r,n,o){return function(i,a,u){return t(i,a,function(t){u(t),"function"==typeof t&&n.push(function(){vt(t,e.instances,r,o)})})}}function vt(t,e,r,n){e[r]?t(e[r]):n()&&setTimeout(function(){vt(t,e,r,n)},16)}function mt(t){var e=window.location.pathname;return t&&0===e.indexOf(t)&&(e=e.slice(t.length)),(e||"/")+window.location.search+window.location.hash}function gt(t){var e=mt(t);if(!/^\/#/.test(e))return window.location.replace(g(t+"/#"+e)),!0}function bt(){var t=wt();return"/"===t.charAt(0)||(kt("/"+t),!1)}function wt(){var t=window.location.href,e=t.indexOf("#");return-1===e?"":t.slice(e+1)}function xt(t){window.location.hash=t}function kt(t){var e=window.location.href,r=e.indexOf("#"),n=r>=0?e.slice(0,r):e;window.location.replace(n+"#"+t)}function Rt(t,e){return t.push(e),function(){var r=t.indexOf(e);r>-1&&t.splice(r,1)}}function Et(t,e,r){var n="hash"===r?"#"+e:e;return t?g(t+"/"+n):n}var Ot,Ct={name:"router-view",functional:!0,props:{name:{type:String,default:"default"}},render:function(t,e){var n=e.props,o=e.children,i=e.parent,a=e.data;a.routerView=!0;for(var u=i.$createElement,c=n.name,s=i.$route,p=i._routerViewCache||(i._routerViewCache={}),f=0,h=!1;i&&i._routerRoot!==i;)i.$vnode&&i.$vnode.data.routerView&&f++,i._inactive&&(h=!0),i=i.$parent;if(a.routerViewDepth=f,h)return u(p[c],a,o);var l=s.matched[f];if(!l)return p[c]=null,u();var d=p[c]=l.components[c];return a.registerRouteInstance=function(t,e){var r=l.instances[c];(e&&r!==t||!e&&r===t)&&(l.instances[c]=e)},(a.hook||(a.hook={})).prepatch=function(t,e){l.instances[c]=e.componentInstance},a.props=r(s,l.props&&l.props[c]),u(d,a,o)}},At=/[!'()*]/g,jt=function(t){return"%"+t.charCodeAt(0).toString(16)},_t=/%2C/g,Tt=function(t){return encodeURIComponent(t).replace(At,jt).replace(_t,",")},$t=decodeURIComponent,St=/\/?$/,qt=a(null,{path:"/"}),Lt=[String,Object],Pt=[String,Array],Ut={name:"router-link",props:{to:{type:Lt,required:!0},tag:{type:String,default:"a"},exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,event:{type:Pt,default:"click"}},render:function(t){var e=this,r=this.$router,n=this.$route,o=r.resolve(this.to,n,this.append),i=o.location,u=o.route,c=o.href,p={},h=r.options.linkActiveClass,y=r.options.linkExactActiveClass,v=null==h?"router-link-active":h,m=null==y?"router-link-exact-active":y,g=null==this.activeClass?v:this.activeClass,b=null==this.exactActiveClass?m:this.exactActiveClass,w=i.path?a(null,i,null,r):u;p[b]=s(n,w),p[g]=this.exact?p[b]:f(n,w);var x=function(t){l(t)&&(e.replace?r.replace(i):r.push(i))},k={click:l};Array.isArray(this.event)?this.event.forEach(function(t){k[t]=x}):k[this.event]=x;var R={class:p};if("a"===this.tag)R.on=k,R.attrs={href:c};else{var E=d(this.$slots.default);if(E){E.isStatic=!1;var O=Ot.util.extend;(E.data=O({},E.data)).on=k,(E.data.attrs=O({},E.data.attrs)).href=c}else R.on=k}return t(this.tag,R,this.$slots.default)}},Ht="undefined"!=typeof window,It=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},Mt=$,Vt=b,zt=k,Bt=T,Ft=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");Mt.parse=Vt,Mt.compile=function(t,e){return k(b(t,e))},Mt.tokensToFunction=zt,Mt.tokensToRegExp=Bt;var Dt=Object.create(null),Kt=Object.create(null),Jt=Ht&&function(){var t=window.navigator.userAgent;return(-1===t.indexOf("Android 2.")&&-1===t.indexOf("Android 4.0")||-1===t.indexOf("Mobile Safari")||-1!==t.indexOf("Chrome")||-1!==t.indexOf("Windows Phone"))&&(window.history&&"pushState"in window.history)}(),Nt=Ht&&window.performance&&window.performance.now?window.performance:Date,Qt=W(),Xt=function(t,e){this.router=t,this.base=ut(e),this.current=qt,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[]};Xt.prototype.listen=function(t){this.cb=t},Xt.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},Xt.prototype.onError=function(t){this.errorCbs.push(t)},Xt.prototype.transitionTo=function(t,e,r){var n=this,o=this.router.match(t,this.current);this.confirmTransition(o,function(){n.updateRoute(o),e&&e(o),n.ensureURL(),n.ready||(n.ready=!0,n.readyCbs.forEach(function(t){t(o)}))},function(t){r&&r(t),t&&!n.ready&&(n.ready=!0,n.readyErrorCbs.forEach(function(e){e(t)}))})},Xt.prototype.confirmTransition=function(r,n,o){var i=this,a=this.current,u=function(r){e(r)&&(i.errorCbs.length?i.errorCbs.forEach(function(t){t(r)}):(t(!1,"uncaught error during route navigation:"),console.error(r))),o&&o(r)};if(s(r,a)&&r.matched.length===a.matched.length)return this.ensureURL(),u();var c=ct(this.current.matched,r.matched),p=c.updated,f=c.deactivated,h=c.activated,l=[].concat(ft(f),this.router.beforeHooks,ht(p),h.map(function(t){return t.beforeEnter}),nt(h));this.pending=r;var d=function(t,n){if(i.pending!==r)return u();try{t(r,a,function(t){!1===t||e(t)?(i.ensureURL(!0),u(t)):"string"==typeof t||"object"==typeof t&&("string"==typeof t.path||"string"==typeof t.name)?(u(),"object"==typeof t&&t.replace?i.replace(t):i.push(t)):n(t)})}catch(t){u(t)}};rt(l,d,function(){var t=[];rt(dt(h,t,function(){return i.current===r}).concat(i.router.resolveHooks),d,function(){if(i.pending!==r)return u();i.pending=null,n(r),i.router.app&&i.router.app.$nextTick(function(){t.forEach(function(t){t()})})})})},Xt.prototype.updateRoute=function(t){var e=this.current;this.current=t,this.cb&&this.cb(t),this.router.afterHooks.forEach(function(r){r&&r(t,e)})};var Yt=function(t){function e(e,r){var n=this;t.call(this,e,r);var o=e.options.scrollBehavior;o&&B(),window.addEventListener("popstate",function(t){var r=n.current;n.transitionTo(mt(n.base),function(t){o&&F(e,t,r,!0)})})}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.go=function(t){window.history.go(t)},e.prototype.push=function(t,e,r){var n=this,o=this.current;this.transitionTo(t,function(t){tt(g(n.base+t.fullPath)),F(n.router,t,o,!1),e&&e(t)},r)},e.prototype.replace=function(t,e,r){var n=this,o=this.current;this.transitionTo(t,function(t){et(g(n.base+t.fullPath)),F(n.router,t,o,!1),e&&e(t)},r)},e.prototype.ensureURL=function(t){if(mt(this.base)!==this.current.fullPath){var e=g(this.base+this.current.fullPath);t?tt(e):et(e)}},e.prototype.getCurrentLocation=function(){return mt(this.base)},e}(Xt),Wt=function(t){function e(e,r,n){t.call(this,e,r),n&&gt(this.base)||bt()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this;window.addEventListener("hashchange",function(){bt()&&t.transitionTo(wt(),function(t){kt(t.fullPath)})})},e.prototype.push=function(t,e,r){this.transitionTo(t,function(t){xt(t.fullPath),e&&e(t)},r)},e.prototype.replace=function(t,e,r){this.transitionTo(t,function(t){kt(t.fullPath),e&&e(t)},r)},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;wt()!==e&&(t?xt(e):kt(e))},e.prototype.getCurrentLocation=function(){return wt()},e}(Xt),Gt=function(t){function e(e,r){t.call(this,e,r),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t,e,r){var n=this;this.transitionTo(t,function(t){n.stack=n.stack.slice(0,n.index+1).concat(t),n.index++,e&&e(t)},r)},e.prototype.replace=function(t,e,r){var n=this;this.transitionTo(t,function(t){n.stack=n.stack.slice(0,n.index).concat(t),e&&e(t)},r)},e.prototype.go=function(t){var e=this,r=this.index+t;if(!(r<0||r>=this.stack.length)){var n=this.stack[r];this.confirmTransition(n,function(){e.index=r,e.updateRoute(n)})}},e.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},e.prototype.ensureURL=function(){},e}(Xt),Zt=function(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=M(t.routes||[],this);var e=t.mode||"hash";switch(this.fallback="history"===e&&!Jt&&!1!==t.fallback,this.fallback&&(e="hash"),Ht||(e="abstract"),this.mode=e,e){case"history":this.history=new Yt(this,t.base);break;case"hash":this.history=new Wt(this,t.base,this.fallback);break;case"abstract":this.history=new Gt(this,t.base)}},te={currentRoute:{}};return Zt.prototype.match=function(t,e,r){return this.matcher.match(t,e,r)},te.currentRoute.get=function(){return this.history&&this.history.current},Zt.prototype.init=function(t){var e=this;if(this.apps.push(t),!this.app){this.app=t;var r=this.history;if(r instanceof Yt)r.transitionTo(r.getCurrentLocation());else if(r instanceof Wt){var n=function(){r.setupListeners()};r.transitionTo(r.getCurrentLocation(),n,n)}r.listen(function(t){e.apps.forEach(function(e){e._route=t})})}},Zt.prototype.beforeEach=function(t){return Rt(this.beforeHooks,t)},Zt.prototype.beforeResolve=function(t){return Rt(this.resolveHooks,t)},Zt.prototype.afterEach=function(t){return Rt(this.afterHooks,t)},Zt.prototype.onReady=function(t,e){this.history.onReady(t,e)},Zt.prototype.onError=function(t){this.history.onError(t)},Zt.prototype.push=function(t,e,r){this.history.push(t,e,r)},Zt.prototype.replace=function(t,e,r){this.history.replace(t,e,r)},Zt.prototype.go=function(t){this.history.go(t)},Zt.prototype.back=function(){this.go(-1)},Zt.prototype.forward=function(){this.go(1)},Zt.prototype.getMatchedComponents=function(t){var e=t?t.matched?t:this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map(function(t){return Object.keys(t.components).map(function(e){return t.components[e]})})):[]},Zt.prototype.resolve=function(t,e,r){var n=H(t,e||this.history.current,r,this),o=this.match(n,e),i=o.redirectedFrom||o.fullPath;return{location:n,route:o,href:Et(this.history.base,i,this.mode),normalizedTo:n,resolved:o}},Zt.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==qt&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(Zt.prototype,te),Zt.install=y,Zt.version="2.7.0",Ht&&window.Vue&&window.Vue.use(Zt),Zt});
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vue.js v2.3.2
2
+ * Vue.js v2.4.2
3
3
  * (c) 2014-2017 Evan You
4
4
  * Released under the MIT License.
5
5
  */
@@ -25,11 +25,19 @@ function isTrue (v) {
25
25
  return v === true
26
26
  }
27
27
 
28
+ function isFalse (v) {
29
+ return v === false
30
+ }
31
+
28
32
  /**
29
33
  * Check if value is primitive
30
34
  */
31
35
  function isPrimitive (value) {
32
- return typeof value === 'string' || typeof value === 'number'
36
+ return (
37
+ typeof value === 'string' ||
38
+ typeof value === 'number' ||
39
+ typeof value === 'boolean'
40
+ )
33
41
  }
34
42
 
35
43
  /**
@@ -55,6 +63,14 @@ function isRegExp (v) {
55
63
  return _toString.call(v) === '[object RegExp]'
56
64
  }
57
65
 
66
+ /**
67
+ * Check if val is a valid array index.
68
+ */
69
+ function isValidArrayIndex (val) {
70
+ var n = parseFloat(val);
71
+ return n >= 0 && Math.floor(n) === n && isFinite(val)
72
+ }
73
+
58
74
  /**
59
75
  * Convert a value to a string that is actually rendered.
60
76
  */
@@ -98,6 +114,11 @@ function makeMap (
98
114
  */
99
115
  var isBuiltInTag = makeMap('slot,component', true);
100
116
 
117
+ /**
118
+ * Check if a attribute is a reserved attribute.
119
+ */
120
+ var isReservedAttribute = makeMap('key,ref,slot,is');
121
+
101
122
  /**
102
123
  * Remove an item from an array
103
124
  */
@@ -210,13 +231,15 @@ function toObject (arr) {
210
231
 
211
232
  /**
212
233
  * Perform no operation.
234
+ * Stubbing args to make Flow happy without leaving useless transpiled code
235
+ * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/)
213
236
  */
214
- function noop () {}
237
+ function noop (a, b, c) {}
215
238
 
216
239
  /**
217
240
  * Always return false.
218
241
  */
219
- var no = function () { return false; };
242
+ var no = function (a, b, c) { return false; };
220
243
 
221
244
  /**
222
245
  * Return same value
@@ -237,14 +260,30 @@ function genStaticKeys (modules) {
237
260
  * if they are plain objects, do they have the same shape?
238
261
  */
239
262
  function looseEqual (a, b) {
263
+ if (a === b) { return true }
240
264
  var isObjectA = isObject(a);
241
265
  var isObjectB = isObject(b);
242
266
  if (isObjectA && isObjectB) {
243
267
  try {
244
- return JSON.stringify(a) === JSON.stringify(b)
268
+ var isArrayA = Array.isArray(a);
269
+ var isArrayB = Array.isArray(b);
270
+ if (isArrayA && isArrayB) {
271
+ return a.length === b.length && a.every(function (e, i) {
272
+ return looseEqual(e, b[i])
273
+ })
274
+ } else if (!isArrayA && !isArrayB) {
275
+ var keysA = Object.keys(a);
276
+ var keysB = Object.keys(b);
277
+ return keysA.length === keysB.length && keysA.every(function (key) {
278
+ return looseEqual(a[key], b[key])
279
+ })
280
+ } else {
281
+ /* istanbul ignore next */
282
+ return false
283
+ }
245
284
  } catch (e) {
246
- // possible circular reference
247
- return a === b
285
+ /* istanbul ignore next */
286
+ return false
248
287
  }
249
288
  } else if (!isObjectA && !isObjectB) {
250
289
  return String(a) === String(b)
@@ -327,6 +366,11 @@ var config = ({
327
366
  */
328
367
  errorHandler: null,
329
368
 
369
+ /**
370
+ * Warn handler for watcher warns
371
+ */
372
+ warnHandler: null,
373
+
330
374
  /**
331
375
  * Ignore certain custom elements
332
376
  */
@@ -433,10 +477,12 @@ var formatComponentName = (null); // work around flow check
433
477
  .replace(/[-_]/g, ''); };
434
478
 
435
479
  warn = function (msg, vm) {
436
- if (hasConsole && (!config.silent)) {
437
- console.error("[Vue warn]: " + msg + (
438
- vm ? generateComponentTrace(vm) : ''
439
- ));
480
+ var trace = vm ? generateComponentTrace(vm) : '';
481
+
482
+ if (config.warnHandler) {
483
+ config.warnHandler.call(null, msg, vm, trace);
484
+ } else if (hasConsole && (!config.silent)) {
485
+ console.error(("[Vue warn]: " + msg + trace));
440
486
  }
441
487
  };
442
488
 
@@ -546,6 +592,9 @@ var isAndroid = UA && UA.indexOf('android') > 0;
546
592
  var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
547
593
  var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
548
594
 
595
+ // Firefix has a "watch" function on Object.prototype...
596
+ var nativeWatch = ({}).watch;
597
+
549
598
  var supportsPassive = false;
550
599
  if (inBrowser) {
551
600
  try {
@@ -555,7 +604,7 @@ if (inBrowser) {
555
604
  /* istanbul ignore next */
556
605
  supportsPassive = true;
557
606
  }
558
- } )); // https://github.com/facebook/flow/issues/285
607
+ })); // https://github.com/facebook/flow/issues/285
559
608
  window.addEventListener('test-passive', null, opts);
560
609
  } catch (e) {}
561
610
  }
@@ -770,22 +819,14 @@ var arrayMethods = Object.create(arrayProto);[
770
819
  // cache original method
771
820
  var original = arrayProto[method];
772
821
  def(arrayMethods, method, function mutator () {
773
- var arguments$1 = arguments;
822
+ var args = [], len = arguments.length;
823
+ while ( len-- ) args[ len ] = arguments[ len ];
774
824
 
775
- // avoid leaking arguments:
776
- // http://jsperf.com/closure-with-arguments
777
- var i = arguments.length;
778
- var args = new Array(i);
779
- while (i--) {
780
- args[i] = arguments$1[i];
781
- }
782
825
  var result = original.apply(this, args);
783
826
  var ob = this.__ob__;
784
827
  var inserted;
785
828
  switch (method) {
786
829
  case 'push':
787
- inserted = args;
788
- break
789
830
  case 'unshift':
790
831
  inserted = args;
791
832
  break
@@ -811,8 +852,7 @@ var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
811
852
  * under a frozen data structure. Converting it would defeat the optimization.
812
853
  */
813
854
  var observerState = {
814
- shouldConvert: true,
815
- isSettingProps: false
855
+ shouldConvert: true
816
856
  };
817
857
 
818
858
  /**
@@ -864,7 +904,7 @@ Observer.prototype.observeArray = function observeArray (items) {
864
904
  * Augment an target Object or Array by intercepting
865
905
  * the prototype chain using __proto__
866
906
  */
867
- function protoAugment (target, src) {
907
+ function protoAugment (target, src, keys) {
868
908
  /* eslint-disable no-proto */
869
909
  target.__proto__ = src;
870
910
  /* eslint-enable no-proto */
@@ -916,7 +956,8 @@ function defineReactive$$1 (
916
956
  obj,
917
957
  key,
918
958
  val,
919
- customSetter
959
+ customSetter,
960
+ shallow
920
961
  ) {
921
962
  var dep = new Dep();
922
963
 
@@ -929,7 +970,7 @@ function defineReactive$$1 (
929
970
  var getter = property && property.get;
930
971
  var setter = property && property.set;
931
972
 
932
- var childOb = observe(val);
973
+ var childOb = !shallow && observe(val);
933
974
  Object.defineProperty(obj, key, {
934
975
  enumerable: true,
935
976
  configurable: true,
@@ -961,7 +1002,7 @@ function defineReactive$$1 (
961
1002
  } else {
962
1003
  val = newVal;
963
1004
  }
964
- childOb = observe(newVal);
1005
+ childOb = !shallow && observe(newVal);
965
1006
  dep.notify();
966
1007
  }
967
1008
  });
@@ -973,7 +1014,7 @@ function defineReactive$$1 (
973
1014
  * already exist.
974
1015
  */
975
1016
  function set (target, key, val) {
976
- if (Array.isArray(target) && typeof key === 'number') {
1017
+ if (Array.isArray(target) && isValidArrayIndex(key)) {
977
1018
  target.length = Math.max(target.length, key);
978
1019
  target.splice(key, 1, val);
979
1020
  return val
@@ -982,7 +1023,7 @@ function set (target, key, val) {
982
1023
  target[key] = val;
983
1024
  return val
984
1025
  }
985
- var ob = (target ).__ob__;
1026
+ var ob = (target).__ob__;
986
1027
  if (target._isVue || (ob && ob.vmCount)) {
987
1028
  "development" !== 'production' && warn(
988
1029
  'Avoid adding reactive properties to a Vue instance or its root $data ' +
@@ -1003,11 +1044,11 @@ function set (target, key, val) {
1003
1044
  * Delete a property and trigger change if necessary.
1004
1045
  */
1005
1046
  function del (target, key) {
1006
- if (Array.isArray(target) && typeof key === 'number') {
1047
+ if (Array.isArray(target) && isValidArrayIndex(key)) {
1007
1048
  target.splice(key, 1);
1008
1049
  return
1009
1050
  }
1010
- var ob = (target ).__ob__;
1051
+ var ob = (target).__ob__;
1011
1052
  if (target._isVue || (ob && ob.vmCount)) {
1012
1053
  "development" !== 'production' && warn(
1013
1054
  'Avoid deleting properties on a Vue instance or its root $data ' +
@@ -1086,7 +1127,7 @@ function mergeData (to, from) {
1086
1127
  /**
1087
1128
  * Data
1088
1129
  */
1089
- strats.data = function (
1130
+ function mergeDataOrFn (
1090
1131
  parentVal,
1091
1132
  childVal,
1092
1133
  vm
@@ -1096,15 +1137,6 @@ strats.data = function (
1096
1137
  if (!childVal) {
1097
1138
  return parentVal
1098
1139
  }
1099
- if (typeof childVal !== 'function') {
1100
- "development" !== 'production' && warn(
1101
- 'The "data" option should be a function ' +
1102
- 'that returns a per-instance value in component ' +
1103
- 'definitions.',
1104
- vm
1105
- );
1106
- return parentVal
1107
- }
1108
1140
  if (!parentVal) {
1109
1141
  return childVal
1110
1142
  }
@@ -1115,8 +1147,8 @@ strats.data = function (
1115
1147
  // it has to be a function to pass previous merges.
1116
1148
  return function mergedDataFn () {
1117
1149
  return mergeData(
1118
- childVal.call(this),
1119
- parentVal.call(this)
1150
+ typeof childVal === 'function' ? childVal.call(this) : childVal,
1151
+ typeof parentVal === 'function' ? parentVal.call(this) : parentVal
1120
1152
  )
1121
1153
  }
1122
1154
  } else if (parentVal || childVal) {
@@ -1135,6 +1167,28 @@ strats.data = function (
1135
1167
  }
1136
1168
  }
1137
1169
  }
1170
+ }
1171
+
1172
+ strats.data = function (
1173
+ parentVal,
1174
+ childVal,
1175
+ vm
1176
+ ) {
1177
+ if (!vm) {
1178
+ if (childVal && typeof childVal !== 'function') {
1179
+ "development" !== 'production' && warn(
1180
+ 'The "data" option should be a function ' +
1181
+ 'that returns a per-instance value in component ' +
1182
+ 'definitions.',
1183
+ vm
1184
+ );
1185
+
1186
+ return parentVal
1187
+ }
1188
+ return mergeDataOrFn.call(this, parentVal, childVal)
1189
+ }
1190
+
1191
+ return mergeDataOrFn(parentVal, childVal, vm)
1138
1192
  };
1139
1193
 
1140
1194
  /**
@@ -1182,6 +1236,9 @@ ASSET_TYPES.forEach(function (type) {
1182
1236
  * another, so we merge them as arrays.
1183
1237
  */
1184
1238
  strats.watch = function (parentVal, childVal) {
1239
+ // work around Firefox's Object.prototype.watch...
1240
+ if (parentVal === nativeWatch) { parentVal = undefined; }
1241
+ if (childVal === nativeWatch) { childVal = undefined; }
1185
1242
  /* istanbul ignore if */
1186
1243
  if (!childVal) { return Object.create(parentVal || null) }
1187
1244
  if (!parentVal) { return childVal }
@@ -1195,7 +1252,7 @@ strats.watch = function (parentVal, childVal) {
1195
1252
  }
1196
1253
  ret[key] = parent
1197
1254
  ? parent.concat(child)
1198
- : [child];
1255
+ : Array.isArray(child) ? child : [child];
1199
1256
  }
1200
1257
  return ret
1201
1258
  };
@@ -1205,14 +1262,15 @@ strats.watch = function (parentVal, childVal) {
1205
1262
  */
1206
1263
  strats.props =
1207
1264
  strats.methods =
1265
+ strats.inject =
1208
1266
  strats.computed = function (parentVal, childVal) {
1209
- if (!childVal) { return Object.create(parentVal || null) }
1210
1267
  if (!parentVal) { return childVal }
1211
1268
  var ret = Object.create(null);
1212
1269
  extend(ret, parentVal);
1213
- extend(ret, childVal);
1270
+ if (childVal) { extend(ret, childVal); }
1214
1271
  return ret
1215
1272
  };
1273
+ strats.provide = mergeDataOrFn;
1216
1274
 
1217
1275
  /**
1218
1276
  * Default strategy.
@@ -1270,6 +1328,19 @@ function normalizeProps (options) {
1270
1328
  options.props = res;
1271
1329
  }
1272
1330
 
1331
+ /**
1332
+ * Normalize all injections into Object-based format
1333
+ */
1334
+ function normalizeInject (options) {
1335
+ var inject = options.inject;
1336
+ if (Array.isArray(inject)) {
1337
+ var normalized = options.inject = {};
1338
+ for (var i = 0; i < inject.length; i++) {
1339
+ normalized[inject[i]] = inject[i];
1340
+ }
1341
+ }
1342
+ }
1343
+
1273
1344
  /**
1274
1345
  * Normalize raw function directives into object format.
1275
1346
  */
@@ -1303,6 +1374,7 @@ function mergeOptions (
1303
1374
  }
1304
1375
 
1305
1376
  normalizeProps(child);
1377
+ normalizeInject(child);
1306
1378
  normalizeDirectives(child);
1307
1379
  var extendsFrom = child.extends;
1308
1380
  if (extendsFrom) {
@@ -1420,7 +1492,8 @@ function getPropDefaultValue (vm, prop, key) {
1420
1492
  // return previous default value to avoid unnecessary watcher trigger
1421
1493
  if (vm && vm.$options.propsData &&
1422
1494
  vm.$options.propsData[key] === undefined &&
1423
- vm._props[key] !== undefined) {
1495
+ vm._props[key] !== undefined
1496
+ ) {
1424
1497
  return vm._props[key]
1425
1498
  }
1426
1499
  // call factory function for non-Function types
@@ -1634,7 +1707,8 @@ var VNode = function VNode (
1634
1707
  text,
1635
1708
  elm,
1636
1709
  context,
1637
- componentOptions
1710
+ componentOptions,
1711
+ asyncFactory
1638
1712
  ) {
1639
1713
  this.tag = tag;
1640
1714
  this.data = data;
@@ -1654,6 +1728,9 @@ var VNode = function VNode (
1654
1728
  this.isComment = false;
1655
1729
  this.isCloned = false;
1656
1730
  this.isOnce = false;
1731
+ this.asyncFactory = asyncFactory;
1732
+ this.asyncMeta = undefined;
1733
+ this.isAsyncPlaceholder = false;
1657
1734
  };
1658
1735
 
1659
1736
  var prototypeAccessors = { child: {} };
@@ -1666,9 +1743,11 @@ prototypeAccessors.child.get = function () {
1666
1743
 
1667
1744
  Object.defineProperties( VNode.prototype, prototypeAccessors );
1668
1745
 
1669
- var createEmptyVNode = function () {
1746
+ var createEmptyVNode = function (text) {
1747
+ if ( text === void 0 ) text = '';
1748
+
1670
1749
  var node = new VNode();
1671
- node.text = '';
1750
+ node.text = text;
1672
1751
  node.isComment = true;
1673
1752
  return node
1674
1753
  };
@@ -1689,11 +1768,13 @@ function cloneVNode (vnode) {
1689
1768
  vnode.text,
1690
1769
  vnode.elm,
1691
1770
  vnode.context,
1692
- vnode.componentOptions
1771
+ vnode.componentOptions,
1772
+ vnode.asyncFactory
1693
1773
  );
1694
1774
  cloned.ns = vnode.ns;
1695
1775
  cloned.isStatic = vnode.isStatic;
1696
1776
  cloned.key = vnode.key;
1777
+ cloned.isComment = vnode.isComment;
1697
1778
  cloned.isCloned = true;
1698
1779
  return cloned
1699
1780
  }
@@ -1730,8 +1811,9 @@ function createFnInvoker (fns) {
1730
1811
 
1731
1812
  var fns = invoker.fns;
1732
1813
  if (Array.isArray(fns)) {
1733
- for (var i = 0; i < fns.length; i++) {
1734
- fns[i].apply(null, arguments$1);
1814
+ var cloned = fns.slice();
1815
+ for (var i = 0; i < cloned.length; i++) {
1816
+ cloned[i].apply(null, arguments$1);
1735
1817
  }
1736
1818
  } else {
1737
1819
  // return handler return value for single handlers
@@ -1912,6 +1994,10 @@ function normalizeChildren (children) {
1912
1994
  : undefined
1913
1995
  }
1914
1996
 
1997
+ function isTextNode (node) {
1998
+ return isDef(node) && isDef(node.text) && isFalse(node.isComment)
1999
+ }
2000
+
1915
2001
  function normalizeArrayChildren (children, nestedIndex) {
1916
2002
  var res = [];
1917
2003
  var i, c, last;
@@ -1923,18 +2009,25 @@ function normalizeArrayChildren (children, nestedIndex) {
1923
2009
  if (Array.isArray(c)) {
1924
2010
  res.push.apply(res, normalizeArrayChildren(c, ((nestedIndex || '') + "_" + i)));
1925
2011
  } else if (isPrimitive(c)) {
1926
- if (isDef(last) && isDef(last.text)) {
1927
- last.text += String(c);
2012
+ if (isTextNode(last)) {
2013
+ // merge adjacent text nodes
2014
+ // this is necessary for SSR hydration because text nodes are
2015
+ // essentially merged when rendered to HTML strings
2016
+ (last).text += String(c);
1928
2017
  } else if (c !== '') {
1929
2018
  // convert primitive to vnode
1930
2019
  res.push(createTextVNode(c));
1931
2020
  }
1932
2021
  } else {
1933
- if (isDef(c.text) && isDef(last) && isDef(last.text)) {
2022
+ if (isTextNode(c) && isTextNode(last)) {
2023
+ // merge adjacent text nodes
1934
2024
  res[res.length - 1] = createTextVNode(last.text + c.text);
1935
2025
  } else {
1936
2026
  // default key for nested array children (likely generated by v-for)
1937
- if (isDef(c.tag) && isUndef(c.key) && isDef(nestedIndex)) {
2027
+ if (isTrue(children._isVList) &&
2028
+ isDef(c.tag) &&
2029
+ isUndef(c.key) &&
2030
+ isDef(nestedIndex)) {
1938
2031
  c.key = "__vlist" + nestedIndex + "_" + i + "__";
1939
2032
  }
1940
2033
  res.push(c);
@@ -1947,11 +2040,27 @@ function normalizeArrayChildren (children, nestedIndex) {
1947
2040
  /* */
1948
2041
 
1949
2042
  function ensureCtor (comp, base) {
2043
+ if (comp.__esModule && comp.default) {
2044
+ comp = comp.default;
2045
+ }
1950
2046
  return isObject(comp)
1951
2047
  ? base.extend(comp)
1952
2048
  : comp
1953
2049
  }
1954
2050
 
2051
+ function createAsyncPlaceholder (
2052
+ factory,
2053
+ data,
2054
+ context,
2055
+ children,
2056
+ tag
2057
+ ) {
2058
+ var node = createEmptyVNode();
2059
+ node.asyncFactory = factory;
2060
+ node.asyncMeta = { data: data, context: context, children: children, tag: tag };
2061
+ return node
2062
+ }
2063
+
1955
2064
  function resolveAsyncComponent (
1956
2065
  factory,
1957
2066
  baseCtor,
@@ -2034,9 +2143,11 @@ function resolveAsyncComponent (
2034
2143
 
2035
2144
  if (isDef(res.timeout)) {
2036
2145
  setTimeout(function () {
2037
- reject(
2038
- "timeout (" + (res.timeout) + "ms)"
2039
- );
2146
+ if (isUndef(factory.resolved)) {
2147
+ reject(
2148
+ "timeout (" + (res.timeout) + "ms)"
2149
+ );
2150
+ }
2040
2151
  }, res.timeout);
2041
2152
  }
2042
2153
  }
@@ -2189,7 +2300,11 @@ function eventsMixin (Vue) {
2189
2300
  cbs = cbs.length > 1 ? toArray(cbs) : cbs;
2190
2301
  var args = toArray(arguments, 1);
2191
2302
  for (var i = 0, l = cbs.length; i < l; i++) {
2192
- cbs[i].apply(vm, args);
2303
+ try {
2304
+ cbs[i].apply(vm, args);
2305
+ } catch (e) {
2306
+ handleError(e, vm, ("event handler for \"" + event + "\""));
2307
+ }
2193
2308
  }
2194
2309
  }
2195
2310
  return vm
@@ -2215,7 +2330,8 @@ function resolveSlots (
2215
2330
  // named slots should only be respected if the vnode was rendered in the
2216
2331
  // same context.
2217
2332
  if ((child.context === context || child.functionalContext === context) &&
2218
- child.data && child.data.slot != null) {
2333
+ child.data && child.data.slot != null
2334
+ ) {
2219
2335
  var name = child.data.slot;
2220
2336
  var slot = (slots[name] || (slots[name] = []));
2221
2337
  if (child.tag === 'template') {
@@ -2239,11 +2355,16 @@ function isWhitespace (node) {
2239
2355
  }
2240
2356
 
2241
2357
  function resolveScopedSlots (
2242
- fns
2358
+ fns, // see flow/vnode
2359
+ res
2243
2360
  ) {
2244
- var res = {};
2361
+ res = res || {};
2245
2362
  for (var i = 0; i < fns.length; i++) {
2246
- res[fns[i][0]] = fns[i][1];
2363
+ if (Array.isArray(fns[i])) {
2364
+ resolveScopedSlots(fns[i], res);
2365
+ } else {
2366
+ res[fns[i].key] = fns[i].fn;
2367
+ }
2247
2368
  }
2248
2369
  return res
2249
2370
  }
@@ -2251,6 +2372,7 @@ function resolveScopedSlots (
2251
2372
  /* */
2252
2373
 
2253
2374
  var activeInstance = null;
2375
+ var isUpdatingChildComponent = false;
2254
2376
 
2255
2377
  function initLifecycle (vm) {
2256
2378
  var options = vm.$options;
@@ -2298,6 +2420,9 @@ function lifecycleMixin (Vue) {
2298
2420
  vm.$options._parentElm,
2299
2421
  vm.$options._refElm
2300
2422
  );
2423
+ // no need for the ref nodes after initial patch
2424
+ // this prevents keeping a detached DOM tree in memory (#5851)
2425
+ vm.$options._parentElm = vm.$options._refElm = null;
2301
2426
  } else {
2302
2427
  // updates
2303
2428
  vm.$el = vm.__patch__(prevVnode, vnode);
@@ -2362,8 +2487,6 @@ function lifecycleMixin (Vue) {
2362
2487
  if (vm.$el) {
2363
2488
  vm.$el.__vue__ = null;
2364
2489
  }
2365
- // remove reference to DOM nodes (prevents leak)
2366
- vm.$options._parentElm = vm.$options._refElm = null;
2367
2490
  };
2368
2491
  }
2369
2492
 
@@ -2439,6 +2562,10 @@ function updateChildComponent (
2439
2562
  parentVnode,
2440
2563
  renderChildren
2441
2564
  ) {
2565
+ {
2566
+ isUpdatingChildComponent = true;
2567
+ }
2568
+
2442
2569
  // determine whether component has slot children
2443
2570
  // we need to do this before overwriting $options._renderChildren
2444
2571
  var hasChildren = !!(
@@ -2450,17 +2577,21 @@ function updateChildComponent (
2450
2577
 
2451
2578
  vm.$options._parentVnode = parentVnode;
2452
2579
  vm.$vnode = parentVnode; // update vm's placeholder node without re-render
2580
+
2453
2581
  if (vm._vnode) { // update child tree's parent
2454
2582
  vm._vnode.parent = parentVnode;
2455
2583
  }
2456
2584
  vm.$options._renderChildren = renderChildren;
2457
2585
 
2586
+ // update $attrs and $listensers hash
2587
+ // these are also reactive so they may trigger child update if the child
2588
+ // used them during render
2589
+ vm.$attrs = parentVnode.data && parentVnode.data.attrs;
2590
+ vm.$listeners = listeners;
2591
+
2458
2592
  // update props
2459
2593
  if (propsData && vm.$options.props) {
2460
2594
  observerState.shouldConvert = false;
2461
- {
2462
- observerState.isSettingProps = true;
2463
- }
2464
2595
  var props = vm._props;
2465
2596
  var propKeys = vm.$options._propKeys || [];
2466
2597
  for (var i = 0; i < propKeys.length; i++) {
@@ -2468,12 +2599,10 @@ function updateChildComponent (
2468
2599
  props[key] = validateProp(key, vm.$options.props, propsData, vm);
2469
2600
  }
2470
2601
  observerState.shouldConvert = true;
2471
- {
2472
- observerState.isSettingProps = false;
2473
- }
2474
2602
  // keep a copy of raw propsData
2475
2603
  vm.$options.propsData = propsData;
2476
2604
  }
2605
+
2477
2606
  // update listeners
2478
2607
  if (listeners) {
2479
2608
  var oldListeners = vm.$options._parentListeners;
@@ -2485,6 +2614,10 @@ function updateChildComponent (
2485
2614
  vm.$slots = resolveSlots(renderChildren, parentVnode.context);
2486
2615
  vm.$forceUpdate();
2487
2616
  }
2617
+
2618
+ {
2619
+ isUpdatingChildComponent = false;
2620
+ }
2488
2621
  }
2489
2622
 
2490
2623
  function isInInactiveTree (vm) {
@@ -2561,7 +2694,7 @@ var index = 0;
2561
2694
  * Reset the scheduler's state.
2562
2695
  */
2563
2696
  function resetSchedulerState () {
2564
- queue.length = activatedChildren.length = 0;
2697
+ index = queue.length = activatedChildren.length = 0;
2565
2698
  has = {};
2566
2699
  {
2567
2700
  circular = {};
@@ -2618,7 +2751,7 @@ function flushSchedulerQueue () {
2618
2751
 
2619
2752
  // call component updated and activated hooks
2620
2753
  callActivatedHooks(activatedQueue);
2621
- callUpdateHooks(updatedQueue);
2754
+ callUpdatedHooks(updatedQueue);
2622
2755
 
2623
2756
  // devtool hook
2624
2757
  /* istanbul ignore if */
@@ -2627,7 +2760,7 @@ function flushSchedulerQueue () {
2627
2760
  }
2628
2761
  }
2629
2762
 
2630
- function callUpdateHooks (queue) {
2763
+ function callUpdatedHooks (queue) {
2631
2764
  var i = queue.length;
2632
2765
  while (i--) {
2633
2766
  var watcher = queue[i];
@@ -2671,10 +2804,10 @@ function queueWatcher (watcher) {
2671
2804
  // if already flushing, splice the watcher based on its id
2672
2805
  // if already past its id, it will be run next immediately.
2673
2806
  var i = queue.length - 1;
2674
- while (i >= 0 && queue[i].id > watcher.id) {
2807
+ while (i > index && queue[i].id > watcher.id) {
2675
2808
  i--;
2676
2809
  }
2677
- queue.splice(Math.max(i, index) + 1, 0, watcher);
2810
+ queue.splice(i + 1, 0, watcher);
2678
2811
  }
2679
2812
  // queue the flush
2680
2813
  if (!waiting) {
@@ -2746,22 +2879,23 @@ Watcher.prototype.get = function get () {
2746
2879
  pushTarget(this);
2747
2880
  var value;
2748
2881
  var vm = this.vm;
2749
- if (this.user) {
2750
- try {
2751
- value = this.getter.call(vm, vm);
2752
- } catch (e) {
2882
+ try {
2883
+ value = this.getter.call(vm, vm);
2884
+ } catch (e) {
2885
+ if (this.user) {
2753
2886
  handleError(e, vm, ("getter for watcher \"" + (this.expression) + "\""));
2887
+ } else {
2888
+ throw e
2754
2889
  }
2755
- } else {
2756
- value = this.getter.call(vm, vm);
2757
- }
2758
- // "touch" every property so they are all tracked as
2759
- // dependencies for deep watching
2760
- if (this.deep) {
2761
- traverse(value);
2890
+ } finally {
2891
+ // "touch" every property so they are all tracked as
2892
+ // dependencies for deep watching
2893
+ if (this.deep) {
2894
+ traverse(value);
2895
+ }
2896
+ popTarget();
2897
+ this.cleanupDeps();
2762
2898
  }
2763
- popTarget();
2764
- this.cleanupDeps();
2765
2899
  return value
2766
2900
  };
2767
2901
 
@@ -2954,14 +3088,20 @@ function initState (vm) {
2954
3088
  observe(vm._data = {}, true /* asRootData */);
2955
3089
  }
2956
3090
  if (opts.computed) { initComputed(vm, opts.computed); }
2957
- if (opts.watch) { initWatch(vm, opts.watch); }
3091
+ if (opts.watch && opts.watch !== nativeWatch) {
3092
+ initWatch(vm, opts.watch);
3093
+ }
2958
3094
  }
2959
3095
 
2960
- var isReservedProp = {
2961
- key: 1,
2962
- ref: 1,
2963
- slot: 1
2964
- };
3096
+ function checkOptionType (vm, name) {
3097
+ var option = vm.$options[name];
3098
+ if (!isPlainObject(option)) {
3099
+ warn(
3100
+ ("component option \"" + name + "\" should be an object."),
3101
+ vm
3102
+ );
3103
+ }
3104
+ }
2965
3105
 
2966
3106
  function initProps (vm, propsOptions) {
2967
3107
  var propsData = vm.$options.propsData || {};
@@ -2977,14 +3117,14 @@ function initProps (vm, propsOptions) {
2977
3117
  var value = validateProp(key, propsOptions, propsData, vm);
2978
3118
  /* istanbul ignore else */
2979
3119
  {
2980
- if (isReservedProp[key] || config.isReservedAttr(key)) {
3120
+ if (isReservedAttribute(key) || config.isReservedAttr(key)) {
2981
3121
  warn(
2982
3122
  ("\"" + key + "\" is a reserved attribute and cannot be used as component prop."),
2983
3123
  vm
2984
3124
  );
2985
3125
  }
2986
3126
  defineReactive$$1(props, key, value, function () {
2987
- if (vm.$parent && !observerState.isSettingProps) {
3127
+ if (vm.$parent && !isUpdatingChildComponent) {
2988
3128
  warn(
2989
3129
  "Avoid mutating a prop directly since the value will be " +
2990
3130
  "overwritten whenever the parent component re-renders. " +
@@ -3023,16 +3163,26 @@ function initData (vm) {
3023
3163
  // proxy data on instance
3024
3164
  var keys = Object.keys(data);
3025
3165
  var props = vm.$options.props;
3166
+ var methods = vm.$options.methods;
3026
3167
  var i = keys.length;
3027
3168
  while (i--) {
3028
- if (props && hasOwn(props, keys[i])) {
3169
+ var key = keys[i];
3170
+ {
3171
+ if (methods && hasOwn(methods, key)) {
3172
+ warn(
3173
+ ("method \"" + key + "\" has already been defined as a data property."),
3174
+ vm
3175
+ );
3176
+ }
3177
+ }
3178
+ if (props && hasOwn(props, key)) {
3029
3179
  "development" !== 'production' && warn(
3030
- "The data property \"" + (keys[i]) + "\" is already declared as a prop. " +
3180
+ "The data property \"" + key + "\" is already declared as a prop. " +
3031
3181
  "Use prop default value instead.",
3032
3182
  vm
3033
3183
  );
3034
- } else if (!isReserved(keys[i])) {
3035
- proxy(vm, "_data", keys[i]);
3184
+ } else if (!isReserved(key)) {
3185
+ proxy(vm, "_data", key);
3036
3186
  }
3037
3187
  }
3038
3188
  // observe data
@@ -3051,22 +3201,20 @@ function getData (data, vm) {
3051
3201
  var computedWatcherOptions = { lazy: true };
3052
3202
 
3053
3203
  function initComputed (vm, computed) {
3204
+ "development" !== 'production' && checkOptionType(vm, 'computed');
3054
3205
  var watchers = vm._computedWatchers = Object.create(null);
3055
3206
 
3056
3207
  for (var key in computed) {
3057
3208
  var userDef = computed[key];
3058
3209
  var getter = typeof userDef === 'function' ? userDef : userDef.get;
3059
- {
3060
- if (getter === undefined) {
3061
- warn(
3062
- ("No getter function has been defined for computed property \"" + key + "\"."),
3063
- vm
3064
- );
3065
- getter = noop;
3066
- }
3210
+ if ("development" !== 'production' && getter == null) {
3211
+ warn(
3212
+ ("Getter is missing for computed property \"" + key + "\"."),
3213
+ vm
3214
+ );
3067
3215
  }
3068
3216
  // create internal watcher for the computed property.
3069
- watchers[key] = new Watcher(vm, getter, noop, computedWatcherOptions);
3217
+ watchers[key] = new Watcher(vm, getter || noop, noop, computedWatcherOptions);
3070
3218
 
3071
3219
  // component-defined computed properties are already defined on the
3072
3220
  // component prototype. We only need to define computed properties defined
@@ -3097,6 +3245,15 @@ function defineComputed (target, key, userDef) {
3097
3245
  ? userDef.set
3098
3246
  : noop;
3099
3247
  }
3248
+ if ("development" !== 'production' &&
3249
+ sharedPropertyDefinition.set === noop) {
3250
+ sharedPropertyDefinition.set = function () {
3251
+ warn(
3252
+ ("Computed property \"" + key + "\" was assigned to but it has no setter."),
3253
+ this
3254
+ );
3255
+ };
3256
+ }
3100
3257
  Object.defineProperty(target, key, sharedPropertyDefinition);
3101
3258
  }
3102
3259
 
@@ -3116,6 +3273,7 @@ function createComputedGetter (key) {
3116
3273
  }
3117
3274
 
3118
3275
  function initMethods (vm, methods) {
3276
+ "development" !== 'production' && checkOptionType(vm, 'methods');
3119
3277
  var props = vm.$options.props;
3120
3278
  for (var key in methods) {
3121
3279
  vm[key] = methods[key] == null ? noop : bind(methods[key], vm);
@@ -3138,6 +3296,7 @@ function initMethods (vm, methods) {
3138
3296
  }
3139
3297
 
3140
3298
  function initWatch (vm, watch) {
3299
+ "development" !== 'production' && checkOptionType(vm, 'watch');
3141
3300
  for (var key in watch) {
3142
3301
  var handler = watch[key];
3143
3302
  if (Array.isArray(handler)) {
@@ -3150,8 +3309,12 @@ function initWatch (vm, watch) {
3150
3309
  }
3151
3310
  }
3152
3311
 
3153
- function createWatcher (vm, key, handler) {
3154
- var options;
3312
+ function createWatcher (
3313
+ vm,
3314
+ keyOrFn,
3315
+ handler,
3316
+ options
3317
+ ) {
3155
3318
  if (isPlainObject(handler)) {
3156
3319
  options = handler;
3157
3320
  handler = handler.handler;
@@ -3159,7 +3322,7 @@ function createWatcher (vm, key, handler) {
3159
3322
  if (typeof handler === 'string') {
3160
3323
  handler = vm[handler];
3161
3324
  }
3162
- vm.$watch(key, handler, options);
3325
+ return vm.$watch(keyOrFn, handler, options)
3163
3326
  }
3164
3327
 
3165
3328
  function stateMixin (Vue) {
@@ -3194,6 +3357,9 @@ function stateMixin (Vue) {
3194
3357
  options
3195
3358
  ) {
3196
3359
  var vm = this;
3360
+ if (isPlainObject(cb)) {
3361
+ return createWatcher(vm, expOrFn, cb, options)
3362
+ }
3197
3363
  options = options || {};
3198
3364
  options.user = true;
3199
3365
  var watcher = new Watcher(vm, expOrFn, cb, options);
@@ -3220,6 +3386,7 @@ function initProvide (vm) {
3220
3386
  function initInjections (vm) {
3221
3387
  var result = resolveInject(vm.$options.inject, vm);
3222
3388
  if (result) {
3389
+ observerState.shouldConvert = false;
3223
3390
  Object.keys(result).forEach(function (key) {
3224
3391
  /* istanbul ignore else */
3225
3392
  {
@@ -3233,24 +3400,21 @@ function initInjections (vm) {
3233
3400
  });
3234
3401
  }
3235
3402
  });
3403
+ observerState.shouldConvert = true;
3236
3404
  }
3237
3405
  }
3238
3406
 
3239
3407
  function resolveInject (inject, vm) {
3240
3408
  if (inject) {
3241
3409
  // inject is :any because flow is not smart enough to figure out cached
3242
- // isArray here
3243
- var isArray = Array.isArray(inject);
3244
3410
  var result = Object.create(null);
3245
- var keys = isArray
3246
- ? inject
3247
- : hasSymbol
3411
+ var keys = hasSymbol
3248
3412
  ? Reflect.ownKeys(inject)
3249
3413
  : Object.keys(inject);
3250
3414
 
3251
3415
  for (var i = 0; i < keys.length; i++) {
3252
3416
  var key = keys[i];
3253
- var provideKey = isArray ? key : inject[key];
3417
+ var provideKey = inject[key];
3254
3418
  var source = vm;
3255
3419
  while (source) {
3256
3420
  if (source._provided && provideKey in source._provided) {
@@ -3259,6 +3423,9 @@ function resolveInject (inject, vm) {
3259
3423
  }
3260
3424
  source = source.$parent;
3261
3425
  }
3426
+ if ("development" !== 'production' && !source) {
3427
+ warn(("Injection \"" + key + "\" not found"), vm);
3428
+ }
3262
3429
  }
3263
3430
  return result
3264
3431
  }
@@ -3412,21 +3579,30 @@ function createComponent (
3412
3579
  }
3413
3580
 
3414
3581
  // async component
3582
+ var asyncFactory;
3415
3583
  if (isUndef(Ctor.cid)) {
3416
- Ctor = resolveAsyncComponent(Ctor, baseCtor, context);
3584
+ asyncFactory = Ctor;
3585
+ Ctor = resolveAsyncComponent(asyncFactory, baseCtor, context);
3417
3586
  if (Ctor === undefined) {
3418
- // return nothing if this is indeed an async component
3419
- // wait for the callback to trigger parent update.
3420
- return
3587
+ // return a placeholder node for async component, which is rendered
3588
+ // as a comment node but preserves all the raw information for the node.
3589
+ // the information will be used for async server-rendering and hydration.
3590
+ return createAsyncPlaceholder(
3591
+ asyncFactory,
3592
+ data,
3593
+ context,
3594
+ children,
3595
+ tag
3596
+ )
3421
3597
  }
3422
3598
  }
3423
3599
 
3600
+ data = data || {};
3601
+
3424
3602
  // resolve constructor options in case global mixins are applied after
3425
3603
  // component constructor creation
3426
3604
  resolveConstructorOptions(Ctor);
3427
3605
 
3428
- data = data || {};
3429
-
3430
3606
  // transform component v-model data into props & events
3431
3607
  if (isDef(data.model)) {
3432
3608
  transformModel(Ctor.options, data);
@@ -3444,12 +3620,19 @@ function createComponent (
3444
3620
  // child component listeners instead of DOM listeners
3445
3621
  var listeners = data.on;
3446
3622
  // replace with listeners with .native modifier
3623
+ // so it gets processed during parent component patch.
3447
3624
  data.on = data.nativeOn;
3448
3625
 
3449
3626
  if (isTrue(Ctor.options.abstract)) {
3450
3627
  // abstract components do not keep anything
3451
- // other than props & listeners
3628
+ // other than props & listeners & slot
3629
+
3630
+ // work around flow
3631
+ var slot = data.slot;
3452
3632
  data = {};
3633
+ if (slot) {
3634
+ data.slot = slot;
3635
+ }
3453
3636
  }
3454
3637
 
3455
3638
  // merge component management hooks onto the placeholder node
@@ -3460,7 +3643,8 @@ function createComponent (
3460
3643
  var vnode = new VNode(
3461
3644
  ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
3462
3645
  data, undefined, undefined, undefined, context,
3463
- { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }
3646
+ { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children },
3647
+ asyncFactory
3464
3648
  );
3465
3649
  return vnode
3466
3650
  }
@@ -3565,13 +3749,28 @@ function _createElement (
3565
3749
  );
3566
3750
  return createEmptyVNode()
3567
3751
  }
3752
+ // object syntax in v-bind
3753
+ if (isDef(data) && isDef(data.is)) {
3754
+ tag = data.is;
3755
+ }
3568
3756
  if (!tag) {
3569
3757
  // in case of component :is set to falsy value
3570
3758
  return createEmptyVNode()
3571
3759
  }
3760
+ // warn against non-primitive key
3761
+ if ("development" !== 'production' &&
3762
+ isDef(data) && isDef(data.key) && !isPrimitive(data.key)
3763
+ ) {
3764
+ warn(
3765
+ 'Avoid using non-primitive value as key, ' +
3766
+ 'use string/number value instead.',
3767
+ context
3768
+ );
3769
+ }
3572
3770
  // support single function children as default scoped slot
3573
3771
  if (Array.isArray(children) &&
3574
- typeof children[0] === 'function') {
3772
+ typeof children[0] === 'function'
3773
+ ) {
3575
3774
  data = data || {};
3576
3775
  data.scopedSlots = { default: children[0] };
3577
3776
  children.length = 0;
@@ -3659,6 +3858,9 @@ function renderList (
3659
3858
  ret[i] = render(val[key], key, i);
3660
3859
  }
3661
3860
  }
3861
+ if (isDef(ret)) {
3862
+ (ret)._isVList = true;
3863
+ }
3662
3864
  return ret
3663
3865
  }
3664
3866
 
@@ -3677,7 +3879,7 @@ function renderSlot (
3677
3879
  if (scopedSlotFn) { // scoped slot
3678
3880
  props = props || {};
3679
3881
  if (bindObject) {
3680
- extend(props, bindObject);
3882
+ props = extend(extend({}, bindObject), props);
3681
3883
  }
3682
3884
  return scopedSlotFn(props) || fallback
3683
3885
  } else {
@@ -3731,7 +3933,8 @@ function bindObjectProps (
3731
3933
  data,
3732
3934
  tag,
3733
3935
  value,
3734
- asProp
3936
+ asProp,
3937
+ isSync
3735
3938
  ) {
3736
3939
  if (value) {
3737
3940
  if (!isObject(value)) {
@@ -3744,8 +3947,12 @@ function bindObjectProps (
3744
3947
  value = toObject(value);
3745
3948
  }
3746
3949
  var hash;
3747
- for (var key in value) {
3748
- if (key === 'class' || key === 'style') {
3950
+ var loop = function ( key ) {
3951
+ if (
3952
+ key === 'class' ||
3953
+ key === 'style' ||
3954
+ isReservedAttribute(key)
3955
+ ) {
3749
3956
  hash = data;
3750
3957
  } else {
3751
3958
  var type = data.attrs && data.attrs.type;
@@ -3755,8 +3962,17 @@ function bindObjectProps (
3755
3962
  }
3756
3963
  if (!(key in hash)) {
3757
3964
  hash[key] = value[key];
3965
+
3966
+ if (isSync) {
3967
+ var on = data.on || (data.on = {});
3968
+ on[("update:" + key)] = function ($event) {
3969
+ value[key] = $event;
3970
+ };
3971
+ }
3758
3972
  }
3759
- }
3973
+ };
3974
+
3975
+ for (var key in value) loop( key );
3760
3976
  }
3761
3977
  }
3762
3978
  return data
@@ -3823,6 +4039,27 @@ function markStaticNode (node, key, isOnce) {
3823
4039
 
3824
4040
  /* */
3825
4041
 
4042
+ function bindObjectListeners (data, value) {
4043
+ if (value) {
4044
+ if (!isPlainObject(value)) {
4045
+ "development" !== 'production' && warn(
4046
+ 'v-on without argument expects an Object value',
4047
+ this
4048
+ );
4049
+ } else {
4050
+ var on = data.on = data.on ? extend({}, data.on) : {};
4051
+ for (var key in value) {
4052
+ var existing = on[key];
4053
+ var ours = value[key];
4054
+ on[key] = existing ? [].concat(ours, existing) : ours;
4055
+ }
4056
+ }
4057
+ }
4058
+ return data
4059
+ }
4060
+
4061
+ /* */
4062
+
3826
4063
  function initRender (vm) {
3827
4064
  vm._vnode = null; // the root of the child tree
3828
4065
  vm._staticTrees = null;
@@ -3838,6 +4075,19 @@ function initRender (vm) {
3838
4075
  // normalization is always applied for the public version, used in
3839
4076
  // user-written render functions.
3840
4077
  vm.$createElement = function (a, b, c, d) { return createElement(vm, a, b, c, d, true); };
4078
+
4079
+ // $attrs & $listeners are exposed for easier HOC creation.
4080
+ // they need to be reactive so that HOCs using them are always updated
4081
+ var parentData = parentVnode && parentVnode.data;
4082
+ /* istanbul ignore else */
4083
+ {
4084
+ defineReactive$$1(vm, '$attrs', parentData && parentData.attrs, function () {
4085
+ !isUpdatingChildComponent && warn("$attrs is readonly.", vm);
4086
+ }, true);
4087
+ defineReactive$$1(vm, '$listeners', vm.$options._parentListeners, function () {
4088
+ !isUpdatingChildComponent && warn("$listeners is readonly.", vm);
4089
+ }, true);
4090
+ }
3841
4091
  }
3842
4092
 
3843
4093
  function renderMixin (Vue) {
@@ -3915,6 +4165,7 @@ function renderMixin (Vue) {
3915
4165
  Vue.prototype._v = createTextVNode;
3916
4166
  Vue.prototype._e = createEmptyVNode;
3917
4167
  Vue.prototype._u = resolveScopedSlots;
4168
+ Vue.prototype._g = bindObjectListeners;
3918
4169
  }
3919
4170
 
3920
4171
  /* */
@@ -4054,7 +4305,8 @@ function dedupe (latest, extended, sealed) {
4054
4305
 
4055
4306
  function Vue$3 (options) {
4056
4307
  if ("development" !== 'production' &&
4057
- !(this instanceof Vue$3)) {
4308
+ !(this instanceof Vue$3)
4309
+ ) {
4058
4310
  warn('Vue is a constructor and should be called with the `new` keyword');
4059
4311
  }
4060
4312
  this._init(options);
@@ -4070,10 +4322,11 @@ renderMixin(Vue$3);
4070
4322
 
4071
4323
  function initUse (Vue) {
4072
4324
  Vue.use = function (plugin) {
4073
- /* istanbul ignore if */
4074
- if (plugin.installed) {
4075
- return
4325
+ var installedPlugins = (this._installedPlugins || (this._installedPlugins = []));
4326
+ if (installedPlugins.indexOf(plugin) > -1) {
4327
+ return this
4076
4328
  }
4329
+
4077
4330
  // additional parameters
4078
4331
  var args = toArray(arguments, 1);
4079
4332
  args.unshift(this);
@@ -4082,7 +4335,7 @@ function initUse (Vue) {
4082
4335
  } else if (typeof plugin === 'function') {
4083
4336
  plugin.apply(null, args);
4084
4337
  }
4085
- plugin.installed = true;
4338
+ installedPlugins.push(plugin);
4086
4339
  return this
4087
4340
  };
4088
4341
  }
@@ -4092,6 +4345,7 @@ function initUse (Vue) {
4092
4345
  function initMixin$1 (Vue) {
4093
4346
  Vue.mixin = function (mixin) {
4094
4347
  this.options = mergeOptions(this.options, mixin);
4348
+ return this
4095
4349
  };
4096
4350
  }
4097
4351
 
@@ -4232,14 +4486,16 @@ function initAssetRegisters (Vue) {
4232
4486
 
4233
4487
  /* */
4234
4488
 
4235
- var patternTypes = [String, RegExp];
4489
+ var patternTypes = [String, RegExp, Array];
4236
4490
 
4237
4491
  function getComponentName (opts) {
4238
4492
  return opts && (opts.Ctor.options.name || opts.tag)
4239
4493
  }
4240
4494
 
4241
4495
  function matches (pattern, name) {
4242
- if (typeof pattern === 'string') {
4496
+ if (Array.isArray(pattern)) {
4497
+ return pattern.indexOf(name) > -1
4498
+ } else if (typeof pattern === 'string') {
4243
4499
  return pattern.split(',').indexOf(name) > -1
4244
4500
  } else if (isRegExp(pattern)) {
4245
4501
  return pattern.test(name)
@@ -4385,11 +4641,12 @@ Object.defineProperty(Vue$3.prototype, '$isServer', {
4385
4641
 
4386
4642
  Object.defineProperty(Vue$3.prototype, '$ssrContext', {
4387
4643
  get: function get () {
4388
- return this.$vnode.ssrContext
4644
+ /* istanbul ignore next */
4645
+ return this.$vnode && this.$vnode.ssrContext
4389
4646
  }
4390
4647
  });
4391
4648
 
4392
- Vue$3.version = '2.3.2';
4649
+ Vue$3.version = '2.4.2';
4393
4650
 
4394
4651
  /* */
4395
4652
 
@@ -4450,7 +4707,7 @@ function genClassForVnode (vnode) {
4450
4707
  data = mergeClassData(data, parentNode.data);
4451
4708
  }
4452
4709
  }
4453
- return genClassFromData(data)
4710
+ return renderClass(data.staticClass, data.class)
4454
4711
  }
4455
4712
 
4456
4713
  function mergeClassData (child, parent) {
@@ -4462,9 +4719,10 @@ function mergeClassData (child, parent) {
4462
4719
  }
4463
4720
  }
4464
4721
 
4465
- function genClassFromData (data) {
4466
- var dynamicClass = data.class;
4467
- var staticClass = data.staticClass;
4722
+ function renderClass (
4723
+ staticClass,
4724
+ dynamicClass
4725
+ ) {
4468
4726
  if (isDef(staticClass) || isDef(dynamicClass)) {
4469
4727
  return concat(staticClass, stringifyClass(dynamicClass))
4470
4728
  }
@@ -4477,31 +4735,39 @@ function concat (a, b) {
4477
4735
  }
4478
4736
 
4479
4737
  function stringifyClass (value) {
4480
- if (isUndef(value)) {
4481
- return ''
4738
+ if (Array.isArray(value)) {
4739
+ return stringifyArray(value)
4740
+ }
4741
+ if (isObject(value)) {
4742
+ return stringifyObject(value)
4482
4743
  }
4483
4744
  if (typeof value === 'string') {
4484
4745
  return value
4485
4746
  }
4747
+ /* istanbul ignore next */
4748
+ return ''
4749
+ }
4750
+
4751
+ function stringifyArray (value) {
4486
4752
  var res = '';
4487
- if (Array.isArray(value)) {
4488
- var stringified;
4489
- for (var i = 0, l = value.length; i < l; i++) {
4490
- if (isDef(value[i])) {
4491
- if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
4492
- res += stringified + ' ';
4493
- }
4494
- }
4753
+ var stringified;
4754
+ for (var i = 0, l = value.length; i < l; i++) {
4755
+ if (isDef(stringified = stringifyClass(value[i])) && stringified !== '') {
4756
+ if (res) { res += ' '; }
4757
+ res += stringified;
4495
4758
  }
4496
- return res.slice(0, -1)
4497
4759
  }
4498
- if (isObject(value)) {
4499
- for (var key in value) {
4500
- if (value[key]) { res += key + ' '; }
4760
+ return res
4761
+ }
4762
+
4763
+ function stringifyObject (value) {
4764
+ var res = '';
4765
+ for (var key in value) {
4766
+ if (value[key]) {
4767
+ if (res) { res += ' '; }
4768
+ res += key;
4501
4769
  }
4502
- return res.slice(0, -1)
4503
4770
  }
4504
- /* istanbul ignore next */
4505
4771
  return res
4506
4772
  }
4507
4773
 
@@ -4515,7 +4781,7 @@ var namespaceMap = {
4515
4781
  var isHTMLTag = makeMap(
4516
4782
  'html,body,base,head,link,meta,style,title,' +
4517
4783
  'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
4518
- 'div,dd,dl,dt,figcaption,figure,hr,img,li,main,ol,p,pre,ul,' +
4784
+ 'div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,' +
4519
4785
  'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
4520
4786
  's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
4521
4787
  'embed,object,param,source,canvas,script,noscript,del,ins,' +
@@ -4523,7 +4789,7 @@ var isHTMLTag = makeMap(
4523
4789
  'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
4524
4790
  'output,progress,select,textarea,' +
4525
4791
  'details,dialog,menu,menuitem,summary,' +
4526
- 'content,element,shadow,template'
4792
+ 'content,element,shadow,template,blockquote,iframe,tfoot'
4527
4793
  );
4528
4794
 
4529
4795
  // this map is intentionally selective, only covering SVG elements that may
@@ -4704,10 +4970,11 @@ function registerRef (vnode, isRemoval) {
4704
4970
  }
4705
4971
  } else {
4706
4972
  if (vnode.data.refInFor) {
4707
- if (Array.isArray(refs[key]) && refs[key].indexOf(ref) < 0) {
4708
- refs[key].push(ref);
4709
- } else {
4973
+ if (!Array.isArray(refs[key])) {
4710
4974
  refs[key] = [ref];
4975
+ } else if (refs[key].indexOf(ref) < 0) {
4976
+ // $flow-disable-line
4977
+ refs[key].push(ref);
4711
4978
  }
4712
4979
  } else {
4713
4980
  refs[key] = ref;
@@ -4735,11 +5002,18 @@ var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
4735
5002
 
4736
5003
  function sameVnode (a, b) {
4737
5004
  return (
4738
- a.key === b.key &&
4739
- a.tag === b.tag &&
4740
- a.isComment === b.isComment &&
4741
- isDef(a.data) === isDef(b.data) &&
4742
- sameInputType(a, b)
5005
+ a.key === b.key && (
5006
+ (
5007
+ a.tag === b.tag &&
5008
+ a.isComment === b.isComment &&
5009
+ isDef(a.data) === isDef(b.data) &&
5010
+ sameInputType(a, b)
5011
+ ) || (
5012
+ isTrue(a.isAsyncPlaceholder) &&
5013
+ a.asyncFactory === b.asyncFactory &&
5014
+ isUndef(b.asyncFactory.error)
5015
+ )
5016
+ )
4743
5017
  )
4744
5018
  }
4745
5019
 
@@ -4880,6 +5154,7 @@ function createPatchFunction (backend) {
4880
5154
  function initComponent (vnode, insertedVnodeQueue) {
4881
5155
  if (isDef(vnode.data.pendingInsert)) {
4882
5156
  insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
5157
+ vnode.data.pendingInsert = null;
4883
5158
  }
4884
5159
  vnode.elm = vnode.componentInstance.$el;
4885
5160
  if (isPatchable(vnode)) {
@@ -4916,11 +5191,11 @@ function createPatchFunction (backend) {
4916
5191
  insert(parentElm, vnode.elm, refElm);
4917
5192
  }
4918
5193
 
4919
- function insert (parent, elm, ref) {
5194
+ function insert (parent, elm, ref$$1) {
4920
5195
  if (isDef(parent)) {
4921
- if (isDef(ref)) {
4922
- if (ref.parentNode === parent) {
4923
- nodeOps.insertBefore(parent, elm, ref);
5196
+ if (isDef(ref$$1)) {
5197
+ if (ref$$1.parentNode === parent) {
5198
+ nodeOps.insertBefore(parent, elm, ref$$1);
4924
5199
  }
4925
5200
  } else {
4926
5201
  nodeOps.appendChild(parent, elm);
@@ -4970,8 +5245,9 @@ function createPatchFunction (backend) {
4970
5245
  }
4971
5246
  // for slot content they should also get the scopeId from the host instance.
4972
5247
  if (isDef(i = activeInstance) &&
4973
- i !== vnode.context &&
4974
- isDef(i = i.$options._scopeId)) {
5248
+ i !== vnode.context &&
5249
+ isDef(i = i.$options._scopeId)
5250
+ ) {
4975
5251
  nodeOps.setAttribute(vnode.elm, i, '');
4976
5252
  }
4977
5253
  }
@@ -5096,7 +5372,7 @@ function createPatchFunction (backend) {
5096
5372
  if (sameVnode(elmToMove, newStartVnode)) {
5097
5373
  patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
5098
5374
  oldCh[idxInOld] = undefined;
5099
- canMove && nodeOps.insertBefore(parentElm, newStartVnode.elm, oldStartVnode.elm);
5375
+ canMove && nodeOps.insertBefore(parentElm, elmToMove.elm, oldStartVnode.elm);
5100
5376
  newStartVnode = newCh[++newStartIdx];
5101
5377
  } else {
5102
5378
  // same key but different element. treat as new element
@@ -5118,24 +5394,37 @@ function createPatchFunction (backend) {
5118
5394
  if (oldVnode === vnode) {
5119
5395
  return
5120
5396
  }
5397
+
5398
+ var elm = vnode.elm = oldVnode.elm;
5399
+
5400
+ if (isTrue(oldVnode.isAsyncPlaceholder)) {
5401
+ if (isDef(vnode.asyncFactory.resolved)) {
5402
+ hydrate(oldVnode.elm, vnode, insertedVnodeQueue);
5403
+ } else {
5404
+ vnode.isAsyncPlaceholder = true;
5405
+ }
5406
+ return
5407
+ }
5408
+
5121
5409
  // reuse element for static trees.
5122
5410
  // note we only do this if the vnode is cloned -
5123
5411
  // if the new node is not cloned it means the render functions have been
5124
5412
  // reset by the hot-reload-api and we need to do a proper re-render.
5125
5413
  if (isTrue(vnode.isStatic) &&
5126
- isTrue(oldVnode.isStatic) &&
5127
- vnode.key === oldVnode.key &&
5128
- (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))) {
5129
- vnode.elm = oldVnode.elm;
5414
+ isTrue(oldVnode.isStatic) &&
5415
+ vnode.key === oldVnode.key &&
5416
+ (isTrue(vnode.isCloned) || isTrue(vnode.isOnce))
5417
+ ) {
5130
5418
  vnode.componentInstance = oldVnode.componentInstance;
5131
5419
  return
5132
5420
  }
5421
+
5133
5422
  var i;
5134
5423
  var data = vnode.data;
5135
5424
  if (isDef(data) && isDef(i = data.hook) && isDef(i = i.prepatch)) {
5136
5425
  i(oldVnode, vnode);
5137
5426
  }
5138
- var elm = vnode.elm = oldVnode.elm;
5427
+
5139
5428
  var oldCh = oldVnode.children;
5140
5429
  var ch = vnode.children;
5141
5430
  if (isDef(data) && isPatchable(vnode)) {
@@ -5180,6 +5469,11 @@ function createPatchFunction (backend) {
5180
5469
 
5181
5470
  // Note: this is a browser-only function so we can assume elms are DOM nodes.
5182
5471
  function hydrate (elm, vnode, insertedVnodeQueue) {
5472
+ if (isTrue(vnode.isComment) && isDef(vnode.asyncFactory)) {
5473
+ vnode.elm = elm;
5474
+ vnode.isAsyncPlaceholder = true;
5475
+ return true
5476
+ }
5183
5477
  {
5184
5478
  if (!assertNodeMatch(elm, vnode)) {
5185
5479
  return false
@@ -5216,8 +5510,9 @@ function createPatchFunction (backend) {
5216
5510
  // longer than the virtual children list.
5217
5511
  if (!childrenMatch || childNode) {
5218
5512
  if ("development" !== 'production' &&
5219
- typeof console !== 'undefined' &&
5220
- !bailed) {
5513
+ typeof console !== 'undefined' &&
5514
+ !bailed
5515
+ ) {
5221
5516
  bailed = true;
5222
5517
  console.warn('Parent: ', elm);
5223
5518
  console.warn('Mismatching childNodes vs. VNodes: ', elm.childNodes, children);
@@ -5458,6 +5753,10 @@ var baseModules = [
5458
5753
  /* */
5459
5754
 
5460
5755
  function updateAttrs (oldVnode, vnode) {
5756
+ var opts = vnode.componentOptions;
5757
+ if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {
5758
+ return
5759
+ }
5461
5760
  if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {
5462
5761
  return
5463
5762
  }
@@ -5823,10 +6122,7 @@ function genAssignmentCode (
5823
6122
  if (modelRs.idx === null) {
5824
6123
  return (value + "=" + assignment)
5825
6124
  } else {
5826
- return "var $$exp = " + (modelRs.exp) + ", $$idx = " + (modelRs.idx) + ";" +
5827
- "if (!Array.isArray($$exp)){" +
5828
- value + "=" + assignment + "}" +
5829
- "else{$$exp.splice($$idx, 1, " + assignment + ")}"
6125
+ return ("$set(" + (modelRs.exp) + ", " + (modelRs.idx) + ", " + assignment + ")")
5830
6126
  }
5831
6127
  }
5832
6128
 
@@ -5957,7 +6253,11 @@ function model (
5957
6253
  }
5958
6254
  }
5959
6255
 
5960
- if (tag === 'select') {
6256
+ if (el.component) {
6257
+ genComponentModel(el, value, modifiers);
6258
+ // component v-model doesn't need extra runtime
6259
+ return false
6260
+ } else if (tag === 'select') {
5961
6261
  genSelect(el, value, modifiers);
5962
6262
  } else if (tag === 'input' && type === 'checkbox') {
5963
6263
  genCheckboxModel(el, value, modifiers);
@@ -6006,7 +6306,7 @@ function genCheckboxModel (
6006
6306
  'if(Array.isArray($$a)){' +
6007
6307
  "var $$v=" + (number ? '_n(' + valueBinding + ')' : valueBinding) + "," +
6008
6308
  '$$i=_i($$a,$$v);' +
6009
- "if($$c){$$i<0&&(" + value + "=$$a.concat($$v))}" +
6309
+ "if($$el.checked){$$i<0&&(" + value + "=$$a.concat($$v))}" +
6010
6310
  "else{$$i>-1&&(" + value + "=$$a.slice(0,$$i).concat($$a.slice($$i+1)))}" +
6011
6311
  "}else{" + (genAssignmentCode(value, '$$c')) + "}",
6012
6312
  null, true
@@ -6074,7 +6374,7 @@ function genDefaultModel (
6074
6374
 
6075
6375
  addProp(el, 'value', ("(" + value + ")"));
6076
6376
  addHandler(el, event, code, null, true);
6077
- if (trim || number || type === 'number') {
6377
+ if (trim || number) {
6078
6378
  addHandler(el, 'blur', '$forceUpdate()');
6079
6379
  }
6080
6380
  }
@@ -6218,14 +6518,19 @@ function shouldUpdateValue (
6218
6518
  }
6219
6519
 
6220
6520
  function isDirty (elm, checkVal) {
6221
- // return true when textbox (.number and .trim) loses focus and its value is not equal to the updated value
6222
- return document.activeElement !== elm && elm.value !== checkVal
6521
+ // return true when textbox (.number and .trim) loses focus and its value is
6522
+ // not equal to the updated value
6523
+ var notInFocus = true;
6524
+ // #6157
6525
+ // work around IE bug when accessing document.activeElement in an iframe
6526
+ try { notInFocus = document.activeElement !== elm; } catch (e) {}
6527
+ return notInFocus && elm.value !== checkVal
6223
6528
  }
6224
6529
 
6225
6530
  function isInputChanged (elm, newVal) {
6226
6531
  var value = elm.value;
6227
6532
  var modifiers = elm._vModifiers; // injected by v-model runtime
6228
- if ((isDef(modifiers) && modifiers.number) || elm.type === 'number') {
6533
+ if (isDef(modifiers) && modifiers.number) {
6229
6534
  return toNumber(value) !== toNumber(newVal)
6230
6535
  }
6231
6536
  if (isDef(modifiers) && modifiers.trim) {
@@ -6331,20 +6636,20 @@ var setProp = function (el, name, val) {
6331
6636
  }
6332
6637
  };
6333
6638
 
6334
- var prefixes = ['Webkit', 'Moz', 'ms'];
6639
+ var vendorNames = ['Webkit', 'Moz', 'ms'];
6335
6640
 
6336
- var testEl;
6641
+ var emptyStyle;
6337
6642
  var normalize = cached(function (prop) {
6338
- testEl = testEl || document.createElement('div');
6643
+ emptyStyle = emptyStyle || document.createElement('div').style;
6339
6644
  prop = camelize(prop);
6340
- if (prop !== 'filter' && (prop in testEl.style)) {
6645
+ if (prop !== 'filter' && (prop in emptyStyle)) {
6341
6646
  return prop
6342
6647
  }
6343
- var upper = prop.charAt(0).toUpperCase() + prop.slice(1);
6344
- for (var i = 0; i < prefixes.length; i++) {
6345
- var prefixed = prefixes[i] + upper;
6346
- if (prefixed in testEl.style) {
6347
- return prefixed
6648
+ var capName = prop.charAt(0).toUpperCase() + prop.slice(1);
6649
+ for (var i = 0; i < vendorNames.length; i++) {
6650
+ var name = vendorNames[i] + capName;
6651
+ if (name in emptyStyle) {
6652
+ return name
6348
6653
  }
6349
6654
  }
6350
6655
  });
@@ -6354,7 +6659,8 @@ function updateStyle (oldVnode, vnode) {
6354
6659
  var oldData = oldVnode.data;
6355
6660
 
6356
6661
  if (isUndef(data.staticStyle) && isUndef(data.style) &&
6357
- isUndef(oldData.staticStyle) && isUndef(oldData.style)) {
6662
+ isUndef(oldData.staticStyle) && isUndef(oldData.style)
6663
+ ) {
6358
6664
  return
6359
6665
  }
6360
6666
 
@@ -6440,13 +6746,21 @@ function removeClass (el, cls) {
6440
6746
  } else {
6441
6747
  el.classList.remove(cls);
6442
6748
  }
6749
+ if (!el.classList.length) {
6750
+ el.removeAttribute('class');
6751
+ }
6443
6752
  } else {
6444
6753
  var cur = " " + (el.getAttribute('class') || '') + " ";
6445
6754
  var tar = ' ' + cls + ' ';
6446
6755
  while (cur.indexOf(tar) >= 0) {
6447
6756
  cur = cur.replace(tar, ' ');
6448
6757
  }
6449
- el.setAttribute('class', cur.trim());
6758
+ cur = cur.trim();
6759
+ if (cur) {
6760
+ el.setAttribute('class', cur);
6761
+ } else {
6762
+ el.removeAttribute('class');
6763
+ }
6450
6764
  }
6451
6765
  }
6452
6766
 
@@ -6492,12 +6806,14 @@ var animationEndEvent = 'animationend';
6492
6806
  if (hasTransition) {
6493
6807
  /* istanbul ignore if */
6494
6808
  if (window.ontransitionend === undefined &&
6495
- window.onwebkittransitionend !== undefined) {
6809
+ window.onwebkittransitionend !== undefined
6810
+ ) {
6496
6811
  transitionProp = 'WebkitTransition';
6497
6812
  transitionEndEvent = 'webkitTransitionEnd';
6498
6813
  }
6499
6814
  if (window.onanimationend === undefined &&
6500
- window.onwebkitanimationend !== undefined) {
6815
+ window.onwebkitanimationend !== undefined
6816
+ ) {
6501
6817
  animationProp = 'WebkitAnimation';
6502
6818
  animationEndEvent = 'webkitAnimationEnd';
6503
6819
  }
@@ -6515,8 +6831,11 @@ function nextFrame (fn) {
6515
6831
  }
6516
6832
 
6517
6833
  function addTransitionClass (el, cls) {
6518
- (el._transitionClasses || (el._transitionClasses = [])).push(cls);
6519
- addClass(el, cls);
6834
+ var transitionClasses = el._transitionClasses || (el._transitionClasses = []);
6835
+ if (transitionClasses.indexOf(cls) < 0) {
6836
+ transitionClasses.push(cls);
6837
+ addClass(el, cls);
6838
+ }
6520
6839
  }
6521
6840
 
6522
6841
  function removeTransitionClass (el, cls) {
@@ -6737,8 +7056,9 @@ function enter (vnode, toggleDisplay) {
6737
7056
  var parent = el.parentNode;
6738
7057
  var pendingNode = parent && parent._pending && parent._pending[vnode.key];
6739
7058
  if (pendingNode &&
6740
- pendingNode.tag === vnode.tag &&
6741
- pendingNode.elm._leaveCb) {
7059
+ pendingNode.tag === vnode.tag &&
7060
+ pendingNode.elm._leaveCb
7061
+ ) {
6742
7062
  pendingNode.elm._leaveCb();
6743
7063
  }
6744
7064
  enterHook && enterHook(el, cb);
@@ -6960,6 +7280,8 @@ var patch = createPatchFunction({ nodeOps: nodeOps, modules: modules });
6960
7280
  * properties to Elements.
6961
7281
  */
6962
7282
 
7283
+ var isTextInputType = makeMap('text,number,password,search,email,tel,url');
7284
+
6963
7285
  /* istanbul ignore if */
6964
7286
  if (isIE9) {
6965
7287
  // http://www.matts411.com/post/internet-explorer-9-oninput/
@@ -6982,7 +7304,8 @@ var model$1 = {
6982
7304
  if (isIE || isEdge) {
6983
7305
  setTimeout(cb, 0);
6984
7306
  }
6985
- } else if (vnode.tag === 'textarea' || el.type === 'text' || el.type === 'password') {
7307
+ el._vOptions = [].map.call(el.options, getValue);
7308
+ } else if (vnode.tag === 'textarea' || isTextInputType(el.type)) {
6986
7309
  el._vModifiers = binding.modifiers;
6987
7310
  if (!binding.modifiers.lazy) {
6988
7311
  // Safari < 10.2 & UIWebView doesn't fire compositionend when
@@ -7008,10 +7331,9 @@ var model$1 = {
7008
7331
  // it's possible that the value is out-of-sync with the rendered options.
7009
7332
  // detect such cases and filter out values that no longer has a matching
7010
7333
  // option in the DOM.
7011
- var needReset = el.multiple
7012
- ? binding.value.some(function (v) { return hasNoMatchingOption(v, el.options); })
7013
- : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, el.options);
7014
- if (needReset) {
7334
+ var prevOptions = el._vOptions;
7335
+ var curOptions = el._vOptions = [].map.call(el.options, getValue);
7336
+ if (curOptions.some(function (o, i) { return !looseEqual(o, prevOptions[i]); })) {
7015
7337
  trigger(el, 'change');
7016
7338
  }
7017
7339
  }
@@ -7051,15 +7373,6 @@ function setSelected (el, binding, vm) {
7051
7373
  }
7052
7374
  }
7053
7375
 
7054
- function hasNoMatchingOption (value, options) {
7055
- for (var i = 0, l = options.length; i < l; i++) {
7056
- if (looseEqual(getValue(options[i]), value)) {
7057
- return false
7058
- }
7059
- }
7060
- return true
7061
- }
7062
-
7063
7376
  function getValue (option) {
7064
7377
  return '_value' in option
7065
7378
  ? option._value
@@ -7071,6 +7384,8 @@ function onCompositionStart (e) {
7071
7384
  }
7072
7385
 
7073
7386
  function onCompositionEnd (e) {
7387
+ // prevent triggering an input event for no reason
7388
+ if (!e.target.composing) { return }
7074
7389
  e.target.composing = false;
7075
7390
  trigger(e.target, 'input');
7076
7391
  }
@@ -7095,10 +7410,10 @@ var show = {
7095
7410
  var value = ref.value;
7096
7411
 
7097
7412
  vnode = locateNode(vnode);
7098
- var transition = vnode.data && vnode.data.transition;
7413
+ var transition$$1 = vnode.data && vnode.data.transition;
7099
7414
  var originalDisplay = el.__vOriginalDisplay =
7100
7415
  el.style.display === 'none' ? '' : el.style.display;
7101
- if (value && transition && !isIE9) {
7416
+ if (value && transition$$1) {
7102
7417
  vnode.data.show = true;
7103
7418
  enter(vnode, function () {
7104
7419
  el.style.display = originalDisplay;
@@ -7115,8 +7430,8 @@ var show = {
7115
7430
  /* istanbul ignore if */
7116
7431
  if (value === oldValue) { return }
7117
7432
  vnode = locateNode(vnode);
7118
- var transition = vnode.data && vnode.data.transition;
7119
- if (transition && !isIE9) {
7433
+ var transition$$1 = vnode.data && vnode.data.transition;
7434
+ if (transition$$1) {
7120
7435
  vnode.data.show = true;
7121
7436
  if (value) {
7122
7437
  enter(vnode, function () {
@@ -7220,7 +7535,11 @@ function isSameChild (child, oldChild) {
7220
7535
  return oldChild.key === child.key && oldChild.tag === child.tag
7221
7536
  }
7222
7537
 
7223
- var Transition = {
7538
+ function isAsyncPlaceholder (node) {
7539
+ return node.isComment && node.asyncFactory
7540
+ }
7541
+
7542
+ var Transition = {
7224
7543
  name: 'transition',
7225
7544
  props: transitionProps,
7226
7545
  abstract: true,
@@ -7228,13 +7547,13 @@ var Transition = {
7228
7547
  render: function render (h) {
7229
7548
  var this$1 = this;
7230
7549
 
7231
- var children = this.$slots.default;
7550
+ var children = this.$options._renderChildren;
7232
7551
  if (!children) {
7233
7552
  return
7234
7553
  }
7235
7554
 
7236
7555
  // filter out text nodes (possible whitespaces)
7237
- children = children.filter(function (c) { return c.tag; });
7556
+ children = children.filter(function (c) { return c.tag || isAsyncPlaceholder(c); });
7238
7557
  /* istanbul ignore if */
7239
7558
  if (!children.length) {
7240
7559
  return
@@ -7253,7 +7572,8 @@ var Transition = {
7253
7572
 
7254
7573
  // warn invalid mode
7255
7574
  if ("development" !== 'production' &&
7256
- mode && mode !== 'in-out' && mode !== 'out-in') {
7575
+ mode && mode !== 'in-out' && mode !== 'out-in'
7576
+ ) {
7257
7577
  warn(
7258
7578
  'invalid <transition> mode: ' + mode,
7259
7579
  this.$parent
@@ -7285,7 +7605,9 @@ var Transition = {
7285
7605
  // during entering.
7286
7606
  var id = "__transition-" + (this._uid) + "-";
7287
7607
  child.key = child.key == null
7288
- ? id + child.tag
7608
+ ? child.isComment
7609
+ ? id + 'comment'
7610
+ : id + child.tag
7289
7611
  : isPrimitive(child.key)
7290
7612
  ? (String(child.key).indexOf(id) === 0 ? child.key : id + child.key)
7291
7613
  : child.key;
@@ -7300,7 +7622,12 @@ var Transition = {
7300
7622
  child.data.show = true;
7301
7623
  }
7302
7624
 
7303
- if (oldChild && oldChild.data && !isSameChild(child, oldChild)) {
7625
+ if (
7626
+ oldChild &&
7627
+ oldChild.data &&
7628
+ !isSameChild(child, oldChild) &&
7629
+ !isAsyncPlaceholder(oldChild)
7630
+ ) {
7304
7631
  // replace old child transition data with fresh one
7305
7632
  // important for dynamic transitions!
7306
7633
  var oldData = oldChild && (oldChild.data.transition = extend({}, data));
@@ -7314,6 +7641,9 @@ var Transition = {
7314
7641
  });
7315
7642
  return placeholder(h, rawChild)
7316
7643
  } else if (mode === 'in-out') {
7644
+ if (isAsyncPlaceholder(child)) {
7645
+ return oldRawChild
7646
+ }
7317
7647
  var delayedLeave;
7318
7648
  var performLeave = function () { delayedLeave(); };
7319
7649
  mergeVNodeHook(data, 'afterEnter', performLeave);
@@ -7443,7 +7773,8 @@ var TransitionGroup = {
7443
7773
  if (!hasTransition) {
7444
7774
  return false
7445
7775
  }
7446
- if (this._hasMove != null) {
7776
+ /* istanbul ignore if */
7777
+ if (this._hasMove) {
7447
7778
  return this._hasMove
7448
7779
  }
7449
7780
  // Detect whether an element with the move class applied has
@@ -7537,8 +7868,9 @@ setTimeout(function () {
7537
7868
  }
7538
7869
  }
7539
7870
  if ("development" !== 'production' &&
7540
- config.productionTip !== false &&
7541
- inBrowser && typeof console !== 'undefined') {
7871
+ config.productionTip !== false &&
7872
+ inBrowser && typeof console !== 'undefined'
7873
+ ) {
7542
7874
  console[console.info ? 'info' : 'log'](
7543
7875
  "You are running Vue in development mode.\n" +
7544
7876
  "Make sure to turn on production mode when deploying for production.\n" +
@@ -7552,7 +7884,7 @@ setTimeout(function () {
7552
7884
  // check whether current browser encodes a char inside attribute values
7553
7885
  function shouldDecode (content, encoded) {
7554
7886
  var div = document.createElement('div');
7555
- div.innerHTML = "<div a=\"" + content + "\">";
7887
+ div.innerHTML = "<div a=\"" + content + "\"/>";
7556
7888
  return div.innerHTML.indexOf(encoded) > 0
7557
7889
  }
7558
7890
 
@@ -7562,6 +7894,158 @@ var shouldDecodeNewlines = inBrowser ? shouldDecode('\n', '&#10;') : false;
7562
7894
 
7563
7895
  /* */
7564
7896
 
7897
+ var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
7898
+ var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
7899
+
7900
+ var buildRegex = cached(function (delimiters) {
7901
+ var open = delimiters[0].replace(regexEscapeRE, '\\$&');
7902
+ var close = delimiters[1].replace(regexEscapeRE, '\\$&');
7903
+ return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
7904
+ });
7905
+
7906
+ function parseText (
7907
+ text,
7908
+ delimiters
7909
+ ) {
7910
+ var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
7911
+ if (!tagRE.test(text)) {
7912
+ return
7913
+ }
7914
+ var tokens = [];
7915
+ var lastIndex = tagRE.lastIndex = 0;
7916
+ var match, index;
7917
+ while ((match = tagRE.exec(text))) {
7918
+ index = match.index;
7919
+ // push text token
7920
+ if (index > lastIndex) {
7921
+ tokens.push(JSON.stringify(text.slice(lastIndex, index)));
7922
+ }
7923
+ // tag token
7924
+ var exp = parseFilters(match[1].trim());
7925
+ tokens.push(("_s(" + exp + ")"));
7926
+ lastIndex = index + match[0].length;
7927
+ }
7928
+ if (lastIndex < text.length) {
7929
+ tokens.push(JSON.stringify(text.slice(lastIndex)));
7930
+ }
7931
+ return tokens.join('+')
7932
+ }
7933
+
7934
+ /* */
7935
+
7936
+ function transformNode (el, options) {
7937
+ var warn = options.warn || baseWarn;
7938
+ var staticClass = getAndRemoveAttr(el, 'class');
7939
+ if ("development" !== 'production' && staticClass) {
7940
+ var expression = parseText(staticClass, options.delimiters);
7941
+ if (expression) {
7942
+ warn(
7943
+ "class=\"" + staticClass + "\": " +
7944
+ 'Interpolation inside attributes has been removed. ' +
7945
+ 'Use v-bind or the colon shorthand instead. For example, ' +
7946
+ 'instead of <div class="{{ val }}">, use <div :class="val">.'
7947
+ );
7948
+ }
7949
+ }
7950
+ if (staticClass) {
7951
+ el.staticClass = JSON.stringify(staticClass);
7952
+ }
7953
+ var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
7954
+ if (classBinding) {
7955
+ el.classBinding = classBinding;
7956
+ }
7957
+ }
7958
+
7959
+ function genData (el) {
7960
+ var data = '';
7961
+ if (el.staticClass) {
7962
+ data += "staticClass:" + (el.staticClass) + ",";
7963
+ }
7964
+ if (el.classBinding) {
7965
+ data += "class:" + (el.classBinding) + ",";
7966
+ }
7967
+ return data
7968
+ }
7969
+
7970
+ var klass$1 = {
7971
+ staticKeys: ['staticClass'],
7972
+ transformNode: transformNode,
7973
+ genData: genData
7974
+ };
7975
+
7976
+ /* */
7977
+
7978
+ function transformNode$1 (el, options) {
7979
+ var warn = options.warn || baseWarn;
7980
+ var staticStyle = getAndRemoveAttr(el, 'style');
7981
+ if (staticStyle) {
7982
+ /* istanbul ignore if */
7983
+ {
7984
+ var expression = parseText(staticStyle, options.delimiters);
7985
+ if (expression) {
7986
+ warn(
7987
+ "style=\"" + staticStyle + "\": " +
7988
+ 'Interpolation inside attributes has been removed. ' +
7989
+ 'Use v-bind or the colon shorthand instead. For example, ' +
7990
+ 'instead of <div style="{{ val }}">, use <div :style="val">.'
7991
+ );
7992
+ }
7993
+ }
7994
+ el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
7995
+ }
7996
+
7997
+ var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
7998
+ if (styleBinding) {
7999
+ el.styleBinding = styleBinding;
8000
+ }
8001
+ }
8002
+
8003
+ function genData$1 (el) {
8004
+ var data = '';
8005
+ if (el.staticStyle) {
8006
+ data += "staticStyle:" + (el.staticStyle) + ",";
8007
+ }
8008
+ if (el.styleBinding) {
8009
+ data += "style:(" + (el.styleBinding) + "),";
8010
+ }
8011
+ return data
8012
+ }
8013
+
8014
+ var style$1 = {
8015
+ staticKeys: ['staticStyle'],
8016
+ transformNode: transformNode$1,
8017
+ genData: genData$1
8018
+ };
8019
+
8020
+ var modules$1 = [
8021
+ klass$1,
8022
+ style$1
8023
+ ];
8024
+
8025
+ /* */
8026
+
8027
+ function text (el, dir) {
8028
+ if (dir.value) {
8029
+ addProp(el, 'textContent', ("_s(" + (dir.value) + ")"));
8030
+ }
8031
+ }
8032
+
8033
+ /* */
8034
+
8035
+ function html (el, dir) {
8036
+ if (dir.value) {
8037
+ addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"));
8038
+ }
8039
+ }
8040
+
8041
+ var directives$1 = {
8042
+ model: model,
8043
+ text: text,
8044
+ html: html
8045
+ };
8046
+
8047
+ /* */
8048
+
7565
8049
  var isUnaryTag = makeMap(
7566
8050
  'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
7567
8051
  'link,meta,param,source,track,wbr'
@@ -7585,13 +8069,30 @@ var isNonPhrasingTag = makeMap(
7585
8069
 
7586
8070
  /* */
7587
8071
 
8072
+ var baseOptions = {
8073
+ expectHTML: true,
8074
+ modules: modules$1,
8075
+ directives: directives$1,
8076
+ isPreTag: isPreTag,
8077
+ isUnaryTag: isUnaryTag,
8078
+ mustUseProp: mustUseProp,
8079
+ canBeLeftOpenTag: canBeLeftOpenTag,
8080
+ isReservedTag: isReservedTag,
8081
+ getTagNamespace: getTagNamespace,
8082
+ staticKeys: genStaticKeys(modules$1)
8083
+ };
8084
+
8085
+ /* */
8086
+
7588
8087
  var decoder;
7589
8088
 
7590
- function decode (html) {
7591
- decoder = decoder || document.createElement('div');
7592
- decoder.innerHTML = html;
7593
- return decoder.textContent
7594
- }
8089
+ var he = {
8090
+ decode: function decode (html) {
8091
+ decoder = decoder || document.createElement('div');
8092
+ decoder.innerHTML = html;
8093
+ return decoder.textContent
8094
+ }
8095
+ };
7595
8096
 
7596
8097
  /**
7597
8098
  * Not type-checking this file because it's mostly vendor code.
@@ -7651,6 +8152,10 @@ var decodingMap = {
7651
8152
  var encodedAttr = /&(?:lt|gt|quot|amp);/g;
7652
8153
  var encodedAttrWithNewLines = /&(?:lt|gt|quot|amp|#10);/g;
7653
8154
 
8155
+ // #5992
8156
+ var isIgnoreNewlineTag = makeMap('pre,textarea', true);
8157
+ var shouldIgnoreFirstNewline = function (tag, html) { return tag && isIgnoreNewlineTag(tag) && html[0] === '\n'; };
8158
+
7654
8159
  function decodeAttr (value, shouldDecodeNewlines) {
7655
8160
  var re = shouldDecodeNewlines ? encodedAttrWithNewLines : encodedAttr;
7656
8161
  return value.replace(re, function (match) { return decodingMap[match]; })
@@ -7674,6 +8179,9 @@ function parseHTML (html, options) {
7674
8179
  var commentEnd = html.indexOf('-->');
7675
8180
 
7676
8181
  if (commentEnd >= 0) {
8182
+ if (options.shouldKeepComment) {
8183
+ options.comment(html.substring(4, commentEnd));
8184
+ }
7677
8185
  advance(commentEnd + 3);
7678
8186
  continue
7679
8187
  }
@@ -7709,24 +8217,27 @@ function parseHTML (html, options) {
7709
8217
  var startTagMatch = parseStartTag();
7710
8218
  if (startTagMatch) {
7711
8219
  handleStartTag(startTagMatch);
8220
+ if (shouldIgnoreFirstNewline(lastTag, html)) {
8221
+ advance(1);
8222
+ }
7712
8223
  continue
7713
8224
  }
7714
8225
  }
7715
8226
 
7716
- var text = (void 0), rest$1 = (void 0), next = (void 0);
8227
+ var text = (void 0), rest = (void 0), next = (void 0);
7717
8228
  if (textEnd >= 0) {
7718
- rest$1 = html.slice(textEnd);
8229
+ rest = html.slice(textEnd);
7719
8230
  while (
7720
- !endTag.test(rest$1) &&
7721
- !startTagOpen.test(rest$1) &&
7722
- !comment.test(rest$1) &&
7723
- !conditionalComment.test(rest$1)
8231
+ !endTag.test(rest) &&
8232
+ !startTagOpen.test(rest) &&
8233
+ !comment.test(rest) &&
8234
+ !conditionalComment.test(rest)
7724
8235
  ) {
7725
8236
  // < in plain text, be forgiving and treat it as text
7726
- next = rest$1.indexOf('<', 1);
8237
+ next = rest.indexOf('<', 1);
7727
8238
  if (next < 0) { break }
7728
8239
  textEnd += next;
7729
- rest$1 = html.slice(textEnd);
8240
+ rest = html.slice(textEnd);
7730
8241
  }
7731
8242
  text = html.substring(0, textEnd);
7732
8243
  advance(textEnd);
@@ -7741,23 +8252,26 @@ function parseHTML (html, options) {
7741
8252
  options.chars(text);
7742
8253
  }
7743
8254
  } else {
8255
+ var endTagLength = 0;
7744
8256
  var stackedTag = lastTag.toLowerCase();
7745
8257
  var reStackedTag = reCache[stackedTag] || (reCache[stackedTag] = new RegExp('([\\s\\S]*?)(</' + stackedTag + '[^>]*>)', 'i'));
7746
- var endTagLength = 0;
7747
- var rest = html.replace(reStackedTag, function (all, text, endTag) {
8258
+ var rest$1 = html.replace(reStackedTag, function (all, text, endTag) {
7748
8259
  endTagLength = endTag.length;
7749
8260
  if (!isPlainTextElement(stackedTag) && stackedTag !== 'noscript') {
7750
8261
  text = text
7751
8262
  .replace(/<!--([\s\S]*?)-->/g, '$1')
7752
8263
  .replace(/<!\[CDATA\[([\s\S]*?)]]>/g, '$1');
7753
8264
  }
8265
+ if (shouldIgnoreFirstNewline(stackedTag, text)) {
8266
+ text = text.slice(1);
8267
+ }
7754
8268
  if (options.chars) {
7755
8269
  options.chars(text);
7756
8270
  }
7757
8271
  return ''
7758
8272
  });
7759
- index += html.length - rest.length;
7760
- html = rest;
8273
+ index += html.length - rest$1.length;
8274
+ html = rest$1;
7761
8275
  parseEndTag(stackedTag, index - endTagLength, index);
7762
8276
  }
7763
8277
 
@@ -7814,7 +8328,7 @@ function parseHTML (html, options) {
7814
8328
  }
7815
8329
  }
7816
8330
 
7817
- var unary = isUnaryTag$$1(tagName) || tagName === 'html' && lastTag === 'head' || !!unarySlash;
8331
+ var unary = isUnaryTag$$1(tagName) || !!unarySlash;
7818
8332
 
7819
8333
  var l = match.attrs.length;
7820
8334
  var attrs = new Array(l);
@@ -7871,8 +8385,9 @@ function parseHTML (html, options) {
7871
8385
  // Close all the open elements, up the stack
7872
8386
  for (var i = stack.length - 1; i >= pos; i--) {
7873
8387
  if ("development" !== 'production' &&
7874
- (i > pos || !tagName) &&
7875
- options.warn) {
8388
+ (i > pos || !tagName) &&
8389
+ options.warn
8390
+ ) {
7876
8391
  options.warn(
7877
8392
  ("tag <" + (stack[i].tag) + "> has no matching end tag.")
7878
8393
  );
@@ -7902,45 +8417,6 @@ function parseHTML (html, options) {
7902
8417
 
7903
8418
  /* */
7904
8419
 
7905
- var defaultTagRE = /\{\{((?:.|\n)+?)\}\}/g;
7906
- var regexEscapeRE = /[-.*+?^${}()|[\]\/\\]/g;
7907
-
7908
- var buildRegex = cached(function (delimiters) {
7909
- var open = delimiters[0].replace(regexEscapeRE, '\\$&');
7910
- var close = delimiters[1].replace(regexEscapeRE, '\\$&');
7911
- return new RegExp(open + '((?:.|\\n)+?)' + close, 'g')
7912
- });
7913
-
7914
- function parseText (
7915
- text,
7916
- delimiters
7917
- ) {
7918
- var tagRE = delimiters ? buildRegex(delimiters) : defaultTagRE;
7919
- if (!tagRE.test(text)) {
7920
- return
7921
- }
7922
- var tokens = [];
7923
- var lastIndex = tagRE.lastIndex = 0;
7924
- var match, index;
7925
- while ((match = tagRE.exec(text))) {
7926
- index = match.index;
7927
- // push text token
7928
- if (index > lastIndex) {
7929
- tokens.push(JSON.stringify(text.slice(lastIndex, index)));
7930
- }
7931
- // tag token
7932
- var exp = parseFilters(match[1].trim());
7933
- tokens.push(("_s(" + exp + ")"));
7934
- lastIndex = index + match[0].length;
7935
- }
7936
- if (lastIndex < text.length) {
7937
- tokens.push(JSON.stringify(text.slice(lastIndex)));
7938
- }
7939
- return tokens.join('+')
7940
- }
7941
-
7942
- /* */
7943
-
7944
8420
  var onRE = /^@|^v-on:/;
7945
8421
  var dirRE = /^v-|^@|^:/;
7946
8422
  var forAliasRE = /(.*?)\s+(?:in|of)\s+(.*)/;
@@ -7950,7 +8426,7 @@ var argRE = /:(.*)$/;
7950
8426
  var bindRE = /^:|^v-bind:/;
7951
8427
  var modifierRE = /\.[^.]+/g;
7952
8428
 
7953
- var decodeHTMLCached = cached(decode);
8429
+ var decodeHTMLCached = cached(he.decode);
7954
8430
 
7955
8431
  // configurable state
7956
8432
  var warn$2;
@@ -7970,12 +8446,15 @@ function parse (
7970
8446
  options
7971
8447
  ) {
7972
8448
  warn$2 = options.warn || baseWarn;
7973
- platformGetTagNamespace = options.getTagNamespace || no;
7974
- platformMustUseProp = options.mustUseProp || no;
8449
+
7975
8450
  platformIsPreTag = options.isPreTag || no;
7976
- preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
8451
+ platformMustUseProp = options.mustUseProp || no;
8452
+ platformGetTagNamespace = options.getTagNamespace || no;
8453
+
7977
8454
  transforms = pluckModuleFunction(options.modules, 'transformNode');
8455
+ preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
7978
8456
  postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
8457
+
7979
8458
  delimiters = options.delimiters;
7980
8459
 
7981
8460
  var stack = [];
@@ -8009,6 +8488,7 @@ function parse (
8009
8488
  isUnaryTag: options.isUnaryTag,
8010
8489
  canBeLeftOpenTag: options.canBeLeftOpenTag,
8011
8490
  shouldDecodeNewlines: options.shouldDecodeNewlines,
8491
+ shouldKeepComment: options.comments,
8012
8492
  start: function start (tag, attrs, unary) {
8013
8493
  // check namespace.
8014
8494
  // inherit parent ns if there is one
@@ -8167,8 +8647,9 @@ function parse (
8167
8647
  // IE textarea placeholder bug
8168
8648
  /* istanbul ignore if */
8169
8649
  if (isIE &&
8170
- currentParent.tag === 'textarea' &&
8171
- currentParent.attrsMap.placeholder === text) {
8650
+ currentParent.tag === 'textarea' &&
8651
+ currentParent.attrsMap.placeholder === text
8652
+ ) {
8172
8653
  return
8173
8654
  }
8174
8655
  var children = currentParent.children;
@@ -8191,6 +8672,13 @@ function parse (
8191
8672
  });
8192
8673
  }
8193
8674
  }
8675
+ },
8676
+ comment: function comment (text) {
8677
+ currentParent.children.push({
8678
+ type: 3,
8679
+ text: text,
8680
+ isComment: true
8681
+ });
8194
8682
  }
8195
8683
  });
8196
8684
  return root
@@ -8392,7 +8880,9 @@ function processAttrs (el) {
8392
8880
  );
8393
8881
  }
8394
8882
  }
8395
- if (isProp || platformMustUseProp(el.tag, el.attrsMap.type, name)) {
8883
+ if (isProp || (
8884
+ !el.component && platformMustUseProp(el.tag, el.attrsMap.type, name)
8885
+ )) {
8396
8886
  addProp(el, name, value);
8397
8887
  } else {
8398
8888
  addAttr(el, name, value);
@@ -8567,6 +9057,15 @@ function markStatic$1 (node) {
8567
9057
  node.static = false;
8568
9058
  }
8569
9059
  }
9060
+ if (node.ifConditions) {
9061
+ for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
9062
+ var block = node.ifConditions[i$1].block;
9063
+ markStatic$1(block);
9064
+ if (!block.static) {
9065
+ node.static = false;
9066
+ }
9067
+ }
9068
+ }
8570
9069
  }
8571
9070
  }
8572
9071
 
@@ -8593,17 +9092,13 @@ function markStaticRoots (node, isInFor) {
8593
9092
  }
8594
9093
  }
8595
9094
  if (node.ifConditions) {
8596
- walkThroughConditionsBlocks(node.ifConditions, isInFor);
9095
+ for (var i$1 = 1, l$1 = node.ifConditions.length; i$1 < l$1; i$1++) {
9096
+ markStaticRoots(node.ifConditions[i$1].block, isInFor);
9097
+ }
8597
9098
  }
8598
9099
  }
8599
9100
  }
8600
9101
 
8601
- function walkThroughConditionsBlocks (conditionBlocks, isInFor) {
8602
- for (var i = 1, len = conditionBlocks.length; i < len; i++) {
8603
- markStaticRoots(conditionBlocks[i].block, isInFor);
8604
- }
8605
- }
8606
-
8607
9102
  function isStatic (node) {
8608
9103
  if (node.type === 2) { // expression
8609
9104
  return false
@@ -8672,17 +9167,17 @@ var modifierCode = {
8672
9167
 
8673
9168
  function genHandlers (
8674
9169
  events,
8675
- native,
9170
+ isNative,
8676
9171
  warn
8677
9172
  ) {
8678
- var res = native ? 'nativeOn:{' : 'on:{';
9173
+ var res = isNative ? 'nativeOn:{' : 'on:{';
8679
9174
  for (var name in events) {
8680
9175
  var handler = events[name];
8681
9176
  // #5330: warn click.right, since right clicks do not actually fire click events.
8682
9177
  if ("development" !== 'production' &&
8683
- name === 'click' &&
8684
- handler && handler.modifiers && handler.modifiers.right
8685
- ) {
9178
+ name === 'click' &&
9179
+ handler && handler.modifiers && handler.modifiers.right
9180
+ ) {
8686
9181
  warn(
8687
9182
  "Use \"contextmenu\" instead of \"click.right\" since right clicks " +
8688
9183
  "do not actually fire \"click\" events."
@@ -8758,99 +9253,101 @@ function genFilterCode (key) {
8758
9253
 
8759
9254
  /* */
8760
9255
 
9256
+ function on (el, dir) {
9257
+ if ("development" !== 'production' && dir.modifiers) {
9258
+ warn("v-on without argument does not support modifiers.");
9259
+ }
9260
+ el.wrapListeners = function (code) { return ("_g(" + code + "," + (dir.value) + ")"); };
9261
+ }
9262
+
9263
+ /* */
9264
+
8761
9265
  function bind$1 (el, dir) {
8762
9266
  el.wrapData = function (code) {
8763
- return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + (dir.modifiers && dir.modifiers.prop ? ',true' : '') + ")")
9267
+ return ("_b(" + code + ",'" + (el.tag) + "'," + (dir.value) + "," + (dir.modifiers && dir.modifiers.prop ? 'true' : 'false') + (dir.modifiers && dir.modifiers.sync ? ',true' : '') + ")")
8764
9268
  };
8765
9269
  }
8766
9270
 
8767
9271
  /* */
8768
9272
 
8769
9273
  var baseDirectives = {
9274
+ on: on,
8770
9275
  bind: bind$1,
8771
9276
  cloak: noop
8772
9277
  };
8773
9278
 
8774
9279
  /* */
8775
9280
 
8776
- // configurable state
8777
- var warn$3;
8778
- var transforms$1;
8779
- var dataGenFns;
8780
- var platformDirectives$1;
8781
- var isPlatformReservedTag$1;
8782
- var staticRenderFns;
8783
- var onceCount;
8784
- var currentOptions;
9281
+ var CodegenState = function CodegenState (options) {
9282
+ this.options = options;
9283
+ this.warn = options.warn || baseWarn;
9284
+ this.transforms = pluckModuleFunction(options.modules, 'transformCode');
9285
+ this.dataGenFns = pluckModuleFunction(options.modules, 'genData');
9286
+ this.directives = extend(extend({}, baseDirectives), options.directives);
9287
+ var isReservedTag = options.isReservedTag || no;
9288
+ this.maybeComponent = function (el) { return !isReservedTag(el.tag); };
9289
+ this.onceId = 0;
9290
+ this.staticRenderFns = [];
9291
+ };
9292
+
9293
+
8785
9294
 
8786
9295
  function generate (
8787
9296
  ast,
8788
9297
  options
8789
9298
  ) {
8790
- // save previous staticRenderFns so generate calls can be nested
8791
- var prevStaticRenderFns = staticRenderFns;
8792
- var currentStaticRenderFns = staticRenderFns = [];
8793
- var prevOnceCount = onceCount;
8794
- onceCount = 0;
8795
- currentOptions = options;
8796
- warn$3 = options.warn || baseWarn;
8797
- transforms$1 = pluckModuleFunction(options.modules, 'transformCode');
8798
- dataGenFns = pluckModuleFunction(options.modules, 'genData');
8799
- platformDirectives$1 = options.directives || {};
8800
- isPlatformReservedTag$1 = options.isReservedTag || no;
8801
- var code = ast ? genElement(ast) : '_c("div")';
8802
- staticRenderFns = prevStaticRenderFns;
8803
- onceCount = prevOnceCount;
9299
+ var state = new CodegenState(options);
9300
+ var code = ast ? genElement(ast, state) : '_c("div")';
8804
9301
  return {
8805
9302
  render: ("with(this){return " + code + "}"),
8806
- staticRenderFns: currentStaticRenderFns
9303
+ staticRenderFns: state.staticRenderFns
8807
9304
  }
8808
9305
  }
8809
9306
 
8810
- function genElement (el) {
9307
+ function genElement (el, state) {
8811
9308
  if (el.staticRoot && !el.staticProcessed) {
8812
- return genStatic(el)
9309
+ return genStatic(el, state)
8813
9310
  } else if (el.once && !el.onceProcessed) {
8814
- return genOnce(el)
9311
+ return genOnce(el, state)
8815
9312
  } else if (el.for && !el.forProcessed) {
8816
- return genFor(el)
9313
+ return genFor(el, state)
8817
9314
  } else if (el.if && !el.ifProcessed) {
8818
- return genIf(el)
9315
+ return genIf(el, state)
8819
9316
  } else if (el.tag === 'template' && !el.slotTarget) {
8820
- return genChildren(el) || 'void 0'
9317
+ return genChildren(el, state) || 'void 0'
8821
9318
  } else if (el.tag === 'slot') {
8822
- return genSlot(el)
9319
+ return genSlot(el, state)
8823
9320
  } else {
8824
9321
  // component or element
8825
9322
  var code;
8826
9323
  if (el.component) {
8827
- code = genComponent(el.component, el);
9324
+ code = genComponent(el.component, el, state);
8828
9325
  } else {
8829
- var data = el.plain ? undefined : genData(el);
9326
+ var data = el.plain ? undefined : genData$2(el, state);
8830
9327
 
8831
- var children = el.inlineTemplate ? null : genChildren(el, true);
9328
+ var children = el.inlineTemplate ? null : genChildren(el, state, true);
8832
9329
  code = "_c('" + (el.tag) + "'" + (data ? ("," + data) : '') + (children ? ("," + children) : '') + ")";
8833
9330
  }
8834
9331
  // module transforms
8835
- for (var i = 0; i < transforms$1.length; i++) {
8836
- code = transforms$1[i](el, code);
9332
+ for (var i = 0; i < state.transforms.length; i++) {
9333
+ code = state.transforms[i](el, code);
8837
9334
  }
8838
9335
  return code
8839
9336
  }
8840
9337
  }
8841
9338
 
8842
9339
  // hoist static sub-trees out
8843
- function genStatic (el) {
9340
+ function genStatic (el, state) {
8844
9341
  el.staticProcessed = true;
8845
- staticRenderFns.push(("with(this){return " + (genElement(el)) + "}"));
8846
- return ("_m(" + (staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
9342
+ state.staticRenderFns.push(("with(this){return " + (genElement(el, state)) + "}"));
9343
+ return ("_m(" + (state.staticRenderFns.length - 1) + (el.staticInFor ? ',true' : '') + ")")
8847
9344
  }
8848
9345
 
8849
9346
  // v-once
8850
- function genOnce (el) {
9347
+ function genOnce (el, state) {
8851
9348
  el.onceProcessed = true;
8852
9349
  if (el.if && !el.ifProcessed) {
8853
- return genIf(el)
9350
+ return genIf(el, state)
8854
9351
  } else if (el.staticInFor) {
8855
9352
  var key = '';
8856
9353
  var parent = el.parent;
@@ -8862,51 +9359,72 @@ function genOnce (el) {
8862
9359
  parent = parent.parent;
8863
9360
  }
8864
9361
  if (!key) {
8865
- "development" !== 'production' && warn$3(
9362
+ "development" !== 'production' && state.warn(
8866
9363
  "v-once can only be used inside v-for that is keyed. "
8867
9364
  );
8868
- return genElement(el)
9365
+ return genElement(el, state)
8869
9366
  }
8870
- return ("_o(" + (genElement(el)) + "," + (onceCount++) + (key ? ("," + key) : "") + ")")
9367
+ return ("_o(" + (genElement(el, state)) + "," + (state.onceId++) + (key ? ("," + key) : "") + ")")
8871
9368
  } else {
8872
- return genStatic(el)
9369
+ return genStatic(el, state)
8873
9370
  }
8874
9371
  }
8875
9372
 
8876
- function genIf (el) {
9373
+ function genIf (
9374
+ el,
9375
+ state,
9376
+ altGen,
9377
+ altEmpty
9378
+ ) {
8877
9379
  el.ifProcessed = true; // avoid recursion
8878
- return genIfConditions(el.ifConditions.slice())
9380
+ return genIfConditions(el.ifConditions.slice(), state, altGen, altEmpty)
8879
9381
  }
8880
9382
 
8881
- function genIfConditions (conditions) {
9383
+ function genIfConditions (
9384
+ conditions,
9385
+ state,
9386
+ altGen,
9387
+ altEmpty
9388
+ ) {
8882
9389
  if (!conditions.length) {
8883
- return '_e()'
9390
+ return altEmpty || '_e()'
8884
9391
  }
8885
9392
 
8886
9393
  var condition = conditions.shift();
8887
9394
  if (condition.exp) {
8888
- return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions)))
9395
+ return ("(" + (condition.exp) + ")?" + (genTernaryExp(condition.block)) + ":" + (genIfConditions(conditions, state, altGen, altEmpty)))
8889
9396
  } else {
8890
9397
  return ("" + (genTernaryExp(condition.block)))
8891
9398
  }
8892
9399
 
8893
9400
  // v-if with v-once should generate code like (a)?_m(0):_m(1)
8894
9401
  function genTernaryExp (el) {
8895
- return el.once ? genOnce(el) : genElement(el)
9402
+ return altGen
9403
+ ? altGen(el, state)
9404
+ : el.once
9405
+ ? genOnce(el, state)
9406
+ : genElement(el, state)
8896
9407
  }
8897
9408
  }
8898
9409
 
8899
- function genFor (el) {
9410
+ function genFor (
9411
+ el,
9412
+ state,
9413
+ altGen,
9414
+ altHelper
9415
+ ) {
8900
9416
  var exp = el.for;
8901
9417
  var alias = el.alias;
8902
9418
  var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
8903
9419
  var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
8904
9420
 
8905
- if (
8906
- "development" !== 'production' &&
8907
- maybeComponent(el) && el.tag !== 'slot' && el.tag !== 'template' && !el.key
9421
+ if ("development" !== 'production' &&
9422
+ state.maybeComponent(el) &&
9423
+ el.tag !== 'slot' &&
9424
+ el.tag !== 'template' &&
9425
+ !el.key
8908
9426
  ) {
8909
- warn$3(
9427
+ state.warn(
8910
9428
  "<" + (el.tag) + " v-for=\"" + alias + " in " + exp + "\">: component lists rendered with " +
8911
9429
  "v-for should have explicit keys. " +
8912
9430
  "See https://vuejs.org/guide/list.html#key for more info.",
@@ -8915,18 +9433,18 @@ function genFor (el) {
8915
9433
  }
8916
9434
 
8917
9435
  el.forProcessed = true; // avoid recursion
8918
- return "_l((" + exp + ")," +
9436
+ return (altHelper || '_l') + "((" + exp + ")," +
8919
9437
  "function(" + alias + iterator1 + iterator2 + "){" +
8920
- "return " + (genElement(el)) +
9438
+ "return " + ((altGen || genElement)(el, state)) +
8921
9439
  '})'
8922
9440
  }
8923
9441
 
8924
- function genData (el) {
9442
+ function genData$2 (el, state) {
8925
9443
  var data = '{';
8926
9444
 
8927
9445
  // directives first.
8928
9446
  // directives may mutate the el's other properties before they are generated.
8929
- var dirs = genDirectives(el);
9447
+ var dirs = genDirectives(el, state);
8930
9448
  if (dirs) { data += dirs + ','; }
8931
9449
 
8932
9450
  // key
@@ -8949,8 +9467,8 @@ function genData (el) {
8949
9467
  data += "tag:\"" + (el.tag) + "\",";
8950
9468
  }
8951
9469
  // module data generation functions
8952
- for (var i = 0; i < dataGenFns.length; i++) {
8953
- data += dataGenFns[i](el);
9470
+ for (var i = 0; i < state.dataGenFns.length; i++) {
9471
+ data += state.dataGenFns[i](el);
8954
9472
  }
8955
9473
  // attributes
8956
9474
  if (el.attrs) {
@@ -8962,10 +9480,10 @@ function genData (el) {
8962
9480
  }
8963
9481
  // event handlers
8964
9482
  if (el.events) {
8965
- data += (genHandlers(el.events, false, warn$3)) + ",";
9483
+ data += (genHandlers(el.events, false, state.warn)) + ",";
8966
9484
  }
8967
9485
  if (el.nativeEvents) {
8968
- data += (genHandlers(el.nativeEvents, true, warn$3)) + ",";
9486
+ data += (genHandlers(el.nativeEvents, true, state.warn)) + ",";
8969
9487
  }
8970
9488
  // slot target
8971
9489
  if (el.slotTarget) {
@@ -8973,7 +9491,7 @@ function genData (el) {
8973
9491
  }
8974
9492
  // scoped slots
8975
9493
  if (el.scopedSlots) {
8976
- data += (genScopedSlots(el.scopedSlots)) + ",";
9494
+ data += (genScopedSlots(el.scopedSlots, state)) + ",";
8977
9495
  }
8978
9496
  // component v-model
8979
9497
  if (el.model) {
@@ -8981,7 +9499,7 @@ function genData (el) {
8981
9499
  }
8982
9500
  // inline-template
8983
9501
  if (el.inlineTemplate) {
8984
- var inlineTemplate = genInlineTemplate(el);
9502
+ var inlineTemplate = genInlineTemplate(el, state);
8985
9503
  if (inlineTemplate) {
8986
9504
  data += inlineTemplate + ",";
8987
9505
  }
@@ -8991,10 +9509,14 @@ function genData (el) {
8991
9509
  if (el.wrapData) {
8992
9510
  data = el.wrapData(data);
8993
9511
  }
9512
+ // v-on data wrap
9513
+ if (el.wrapListeners) {
9514
+ data = el.wrapListeners(data);
9515
+ }
8994
9516
  return data
8995
9517
  }
8996
9518
 
8997
- function genDirectives (el) {
9519
+ function genDirectives (el, state) {
8998
9520
  var dirs = el.directives;
8999
9521
  if (!dirs) { return }
9000
9522
  var res = 'directives:[';
@@ -9003,11 +9525,11 @@ function genDirectives (el) {
9003
9525
  for (i = 0, l = dirs.length; i < l; i++) {
9004
9526
  dir = dirs[i];
9005
9527
  needRuntime = true;
9006
- var gen = platformDirectives$1[dir.name] || baseDirectives[dir.name];
9528
+ var gen = state.directives[dir.name];
9007
9529
  if (gen) {
9008
9530
  // compile-time directive that manipulates AST.
9009
9531
  // returns true if it also needs a runtime counterpart.
9010
- needRuntime = !!gen(el, dir, warn$3);
9532
+ needRuntime = !!gen(el, dir, state.warn);
9011
9533
  }
9012
9534
  if (needRuntime) {
9013
9535
  hasRuntime = true;
@@ -9019,43 +9541,81 @@ function genDirectives (el) {
9019
9541
  }
9020
9542
  }
9021
9543
 
9022
- function genInlineTemplate (el) {
9544
+ function genInlineTemplate (el, state) {
9023
9545
  var ast = el.children[0];
9024
9546
  if ("development" !== 'production' && (
9025
9547
  el.children.length > 1 || ast.type !== 1
9026
9548
  )) {
9027
- warn$3('Inline-template components must have exactly one child element.');
9549
+ state.warn('Inline-template components must have exactly one child element.');
9028
9550
  }
9029
9551
  if (ast.type === 1) {
9030
- var inlineRenderFns = generate(ast, currentOptions);
9552
+ var inlineRenderFns = generate(ast, state.options);
9031
9553
  return ("inlineTemplate:{render:function(){" + (inlineRenderFns.render) + "},staticRenderFns:[" + (inlineRenderFns.staticRenderFns.map(function (code) { return ("function(){" + code + "}"); }).join(',')) + "]}")
9032
9554
  }
9033
9555
  }
9034
9556
 
9035
- function genScopedSlots (slots) {
9036
- return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) { return genScopedSlot(key, slots[key]); }).join(',')) + "])")
9557
+ function genScopedSlots (
9558
+ slots,
9559
+ state
9560
+ ) {
9561
+ return ("scopedSlots:_u([" + (Object.keys(slots).map(function (key) {
9562
+ return genScopedSlot(key, slots[key], state)
9563
+ }).join(',')) + "])")
9037
9564
  }
9038
9565
 
9039
- function genScopedSlot (key, el) {
9040
- return "[" + key + ",function(" + (String(el.attrsMap.scope)) + "){" +
9566
+ function genScopedSlot (
9567
+ key,
9568
+ el,
9569
+ state
9570
+ ) {
9571
+ if (el.for && !el.forProcessed) {
9572
+ return genForScopedSlot(key, el, state)
9573
+ }
9574
+ return "{key:" + key + ",fn:function(" + (String(el.attrsMap.scope)) + "){" +
9041
9575
  "return " + (el.tag === 'template'
9042
- ? genChildren(el) || 'void 0'
9043
- : genElement(el)) + "}]"
9576
+ ? genChildren(el, state) || 'void 0'
9577
+ : genElement(el, state)) + "}}"
9044
9578
  }
9045
9579
 
9046
- function genChildren (el, checkSkip) {
9580
+ function genForScopedSlot (
9581
+ key,
9582
+ el,
9583
+ state
9584
+ ) {
9585
+ var exp = el.for;
9586
+ var alias = el.alias;
9587
+ var iterator1 = el.iterator1 ? ("," + (el.iterator1)) : '';
9588
+ var iterator2 = el.iterator2 ? ("," + (el.iterator2)) : '';
9589
+ el.forProcessed = true; // avoid recursion
9590
+ return "_l((" + exp + ")," +
9591
+ "function(" + alias + iterator1 + iterator2 + "){" +
9592
+ "return " + (genScopedSlot(key, el, state)) +
9593
+ '})'
9594
+ }
9595
+
9596
+ function genChildren (
9597
+ el,
9598
+ state,
9599
+ checkSkip,
9600
+ altGenElement,
9601
+ altGenNode
9602
+ ) {
9047
9603
  var children = el.children;
9048
9604
  if (children.length) {
9049
9605
  var el$1 = children[0];
9050
9606
  // optimize single v-for
9051
9607
  if (children.length === 1 &&
9052
- el$1.for &&
9053
- el$1.tag !== 'template' &&
9054
- el$1.tag !== 'slot') {
9055
- return genElement(el$1)
9608
+ el$1.for &&
9609
+ el$1.tag !== 'template' &&
9610
+ el$1.tag !== 'slot'
9611
+ ) {
9612
+ return (altGenElement || genElement)(el$1, state)
9056
9613
  }
9057
- var normalizationType = checkSkip ? getNormalizationType(children) : 0;
9058
- return ("[" + (children.map(genNode).join(',')) + "]" + (normalizationType ? ("," + normalizationType) : ''))
9614
+ var normalizationType = checkSkip
9615
+ ? getNormalizationType(children, state.maybeComponent)
9616
+ : 0;
9617
+ var gen = altGenNode || genNode;
9618
+ return ("[" + (children.map(function (c) { return gen(c, state); }).join(',')) + "]" + (normalizationType ? ("," + normalizationType) : ''))
9059
9619
  }
9060
9620
  }
9061
9621
 
@@ -9063,7 +9623,10 @@ function genChildren (el, checkSkip) {
9063
9623
  // 0: no normalization needed
9064
9624
  // 1: simple normalization needed (possible 1-level deep nested array)
9065
9625
  // 2: full normalization needed
9066
- function getNormalizationType (children) {
9626
+ function getNormalizationType (
9627
+ children,
9628
+ maybeComponent
9629
+ ) {
9067
9630
  var res = 0;
9068
9631
  for (var i = 0; i < children.length; i++) {
9069
9632
  var el = children[i];
@@ -9087,13 +9650,11 @@ function needsNormalization (el) {
9087
9650
  return el.for !== undefined || el.tag === 'template' || el.tag === 'slot'
9088
9651
  }
9089
9652
 
9090
- function maybeComponent (el) {
9091
- return !isPlatformReservedTag$1(el.tag)
9092
- }
9093
-
9094
- function genNode (node) {
9653
+ function genNode (node, state) {
9095
9654
  if (node.type === 1) {
9096
- return genElement(node)
9655
+ return genElement(node, state)
9656
+ } if (node.type === 3 && node.isComment) {
9657
+ return genComment(node)
9097
9658
  } else {
9098
9659
  return genText(node)
9099
9660
  }
@@ -9105,9 +9666,13 @@ function genText (text) {
9105
9666
  : transformSpecialNewlines(JSON.stringify(text.text))) + ")")
9106
9667
  }
9107
9668
 
9108
- function genSlot (el) {
9669
+ function genComment (comment) {
9670
+ return ("_e(" + (JSON.stringify(comment.text)) + ")")
9671
+ }
9672
+
9673
+ function genSlot (el, state) {
9109
9674
  var slotName = el.slotName || '"default"';
9110
- var children = genChildren(el);
9675
+ var children = genChildren(el, state);
9111
9676
  var res = "_t(" + slotName + (children ? ("," + children) : '');
9112
9677
  var attrs = el.attrs && ("{" + (el.attrs.map(function (a) { return ((camelize(a.name)) + ":" + (a.value)); }).join(',')) + "}");
9113
9678
  var bind$$1 = el.attrsMap['v-bind'];
@@ -9124,9 +9689,13 @@ function genSlot (el) {
9124
9689
  }
9125
9690
 
9126
9691
  // componentName is el.component, take it as argument to shun flow's pessimistic refinement
9127
- function genComponent (componentName, el) {
9128
- var children = el.inlineTemplate ? null : genChildren(el, true);
9129
- return ("_c(" + componentName + "," + (genData(el)) + (children ? ("," + children) : '') + ")")
9692
+ function genComponent (
9693
+ componentName,
9694
+ el,
9695
+ state
9696
+ ) {
9697
+ var children = el.inlineTemplate ? null : genChildren(el, state, true);
9698
+ return ("_c(" + componentName + "," + (genData$2(el, state)) + (children ? ("," + children) : '') + ")")
9130
9699
  }
9131
9700
 
9132
9701
  function genProps (props) {
@@ -9244,21 +9813,7 @@ function checkExpression (exp, text, errors) {
9244
9813
 
9245
9814
  /* */
9246
9815
 
9247
- function baseCompile (
9248
- template,
9249
- options
9250
- ) {
9251
- var ast = parse(template.trim(), options);
9252
- optimize(ast, options);
9253
- var code = generate(ast, options);
9254
- return {
9255
- ast: ast,
9256
- render: code.render,
9257
- staticRenderFns: code.staticRenderFns
9258
- }
9259
- }
9260
-
9261
- function makeFunction (code, errors) {
9816
+ function createFunction (code, errors) {
9262
9817
  try {
9263
9818
  return new Function(code)
9264
9819
  } catch (err) {
@@ -9267,50 +9822,10 @@ function makeFunction (code, errors) {
9267
9822
  }
9268
9823
  }
9269
9824
 
9270
- function createCompiler (baseOptions) {
9271
- var functionCompileCache = Object.create(null);
9272
-
9273
- function compile (
9274
- template,
9275
- options
9276
- ) {
9277
- var finalOptions = Object.create(baseOptions);
9278
- var errors = [];
9279
- var tips = [];
9280
- finalOptions.warn = function (msg, tip$$1) {
9281
- (tip$$1 ? tips : errors).push(msg);
9282
- };
9283
-
9284
- if (options) {
9285
- // merge custom modules
9286
- if (options.modules) {
9287
- finalOptions.modules = (baseOptions.modules || []).concat(options.modules);
9288
- }
9289
- // merge custom directives
9290
- if (options.directives) {
9291
- finalOptions.directives = extend(
9292
- Object.create(baseOptions.directives),
9293
- options.directives
9294
- );
9295
- }
9296
- // copy other options
9297
- for (var key in options) {
9298
- if (key !== 'modules' && key !== 'directives') {
9299
- finalOptions[key] = options[key];
9300
- }
9301
- }
9302
- }
9303
-
9304
- var compiled = baseCompile(template, finalOptions);
9305
- {
9306
- errors.push.apply(errors, detectErrors(compiled.ast));
9307
- }
9308
- compiled.errors = errors;
9309
- compiled.tips = tips;
9310
- return compiled
9311
- }
9825
+ function createCompileToFunctionFn (compile) {
9826
+ var cache = Object.create(null);
9312
9827
 
9313
- function compileToFunctions (
9828
+ return function compileToFunctions (
9314
9829
  template,
9315
9830
  options,
9316
9831
  vm
@@ -9339,8 +9854,8 @@ function createCompiler (baseOptions) {
9339
9854
  var key = options.delimiters
9340
9855
  ? String(options.delimiters) + template
9341
9856
  : template;
9342
- if (functionCompileCache[key]) {
9343
- return functionCompileCache[key]
9857
+ if (cache[key]) {
9858
+ return cache[key]
9344
9859
  }
9345
9860
 
9346
9861
  // compile
@@ -9363,12 +9878,10 @@ function createCompiler (baseOptions) {
9363
9878
  // turn code into functions
9364
9879
  var res = {};
9365
9880
  var fnGenErrors = [];
9366
- res.render = makeFunction(compiled.render, fnGenErrors);
9367
- var l = compiled.staticRenderFns.length;
9368
- res.staticRenderFns = new Array(l);
9369
- for (var i = 0; i < l; i++) {
9370
- res.staticRenderFns[i] = makeFunction(compiled.staticRenderFns[i], fnGenErrors);
9371
- }
9881
+ res.render = createFunction(compiled.render, fnGenErrors);
9882
+ res.staticRenderFns = compiled.staticRenderFns.map(function (code) {
9883
+ return createFunction(code, fnGenErrors)
9884
+ });
9372
9885
 
9373
9886
  // check function generation errors.
9374
9887
  // this should only happen if there is a bug in the compiler itself.
@@ -9389,143 +9902,83 @@ function createCompiler (baseOptions) {
9389
9902
  }
9390
9903
  }
9391
9904
 
9392
- return (functionCompileCache[key] = res)
9393
- }
9394
-
9395
- return {
9396
- compile: compile,
9397
- compileToFunctions: compileToFunctions
9905
+ return (cache[key] = res)
9398
9906
  }
9399
9907
  }
9400
9908
 
9401
9909
  /* */
9402
9910
 
9403
- function transformNode (el, options) {
9404
- var warn = options.warn || baseWarn;
9405
- var staticClass = getAndRemoveAttr(el, 'class');
9406
- if ("development" !== 'production' && staticClass) {
9407
- var expression = parseText(staticClass, options.delimiters);
9408
- if (expression) {
9409
- warn(
9410
- "class=\"" + staticClass + "\": " +
9411
- 'Interpolation inside attributes has been removed. ' +
9412
- 'Use v-bind or the colon shorthand instead. For example, ' +
9413
- 'instead of <div class="{{ val }}">, use <div :class="val">.'
9414
- );
9415
- }
9416
- }
9417
- if (staticClass) {
9418
- el.staticClass = JSON.stringify(staticClass);
9419
- }
9420
- var classBinding = getBindingAttr(el, 'class', false /* getStatic */);
9421
- if (classBinding) {
9422
- el.classBinding = classBinding;
9423
- }
9424
- }
9425
-
9426
- function genData$1 (el) {
9427
- var data = '';
9428
- if (el.staticClass) {
9429
- data += "staticClass:" + (el.staticClass) + ",";
9430
- }
9431
- if (el.classBinding) {
9432
- data += "class:" + (el.classBinding) + ",";
9433
- }
9434
- return data
9435
- }
9436
-
9437
- var klass$1 = {
9438
- staticKeys: ['staticClass'],
9439
- transformNode: transformNode,
9440
- genData: genData$1
9441
- };
9911
+ function createCompilerCreator (baseCompile) {
9912
+ return function createCompiler (baseOptions) {
9913
+ function compile (
9914
+ template,
9915
+ options
9916
+ ) {
9917
+ var finalOptions = Object.create(baseOptions);
9918
+ var errors = [];
9919
+ var tips = [];
9920
+ finalOptions.warn = function (msg, tip) {
9921
+ (tip ? tips : errors).push(msg);
9922
+ };
9442
9923
 
9443
- /* */
9924
+ if (options) {
9925
+ // merge custom modules
9926
+ if (options.modules) {
9927
+ finalOptions.modules =
9928
+ (baseOptions.modules || []).concat(options.modules);
9929
+ }
9930
+ // merge custom directives
9931
+ if (options.directives) {
9932
+ finalOptions.directives = extend(
9933
+ Object.create(baseOptions.directives),
9934
+ options.directives
9935
+ );
9936
+ }
9937
+ // copy other options
9938
+ for (var key in options) {
9939
+ if (key !== 'modules' && key !== 'directives') {
9940
+ finalOptions[key] = options[key];
9941
+ }
9942
+ }
9943
+ }
9444
9944
 
9445
- function transformNode$1 (el, options) {
9446
- var warn = options.warn || baseWarn;
9447
- var staticStyle = getAndRemoveAttr(el, 'style');
9448
- if (staticStyle) {
9449
- /* istanbul ignore if */
9450
- {
9451
- var expression = parseText(staticStyle, options.delimiters);
9452
- if (expression) {
9453
- warn(
9454
- "style=\"" + staticStyle + "\": " +
9455
- 'Interpolation inside attributes has been removed. ' +
9456
- 'Use v-bind or the colon shorthand instead. For example, ' +
9457
- 'instead of <div style="{{ val }}">, use <div :style="val">.'
9458
- );
9945
+ var compiled = baseCompile(template, finalOptions);
9946
+ {
9947
+ errors.push.apply(errors, detectErrors(compiled.ast));
9459
9948
  }
9949
+ compiled.errors = errors;
9950
+ compiled.tips = tips;
9951
+ return compiled
9460
9952
  }
9461
- el.staticStyle = JSON.stringify(parseStyleText(staticStyle));
9462
- }
9463
-
9464
- var styleBinding = getBindingAttr(el, 'style', false /* getStatic */);
9465
- if (styleBinding) {
9466
- el.styleBinding = styleBinding;
9467
- }
9468
- }
9469
-
9470
- function genData$2 (el) {
9471
- var data = '';
9472
- if (el.staticStyle) {
9473
- data += "staticStyle:" + (el.staticStyle) + ",";
9474
- }
9475
- if (el.styleBinding) {
9476
- data += "style:(" + (el.styleBinding) + "),";
9477
- }
9478
- return data
9479
- }
9480
9953
 
9481
- var style$1 = {
9482
- staticKeys: ['staticStyle'],
9483
- transformNode: transformNode$1,
9484
- genData: genData$2
9485
- };
9486
-
9487
- var modules$1 = [
9488
- klass$1,
9489
- style$1
9490
- ];
9491
-
9492
- /* */
9493
-
9494
- function text (el, dir) {
9495
- if (dir.value) {
9496
- addProp(el, 'textContent', ("_s(" + (dir.value) + ")"));
9954
+ return {
9955
+ compile: compile,
9956
+ compileToFunctions: createCompileToFunctionFn(compile)
9957
+ }
9497
9958
  }
9498
9959
  }
9499
9960
 
9500
9961
  /* */
9501
9962
 
9502
- function html (el, dir) {
9503
- if (dir.value) {
9504
- addProp(el, 'innerHTML', ("_s(" + (dir.value) + ")"));
9963
+ // `createCompilerCreator` allows creating compilers that use alternative
9964
+ // parser/optimizer/codegen, e.g the SSR optimizing compiler.
9965
+ // Here we just export a default compiler using the default parts.
9966
+ var createCompiler = createCompilerCreator(function baseCompile (
9967
+ template,
9968
+ options
9969
+ ) {
9970
+ var ast = parse(template.trim(), options);
9971
+ optimize(ast, options);
9972
+ var code = generate(ast, options);
9973
+ return {
9974
+ ast: ast,
9975
+ render: code.render,
9976
+ staticRenderFns: code.staticRenderFns
9505
9977
  }
9506
- }
9507
-
9508
- var directives$1 = {
9509
- model: model,
9510
- text: text,
9511
- html: html
9512
- };
9978
+ });
9513
9979
 
9514
9980
  /* */
9515
9981
 
9516
- var baseOptions = {
9517
- expectHTML: true,
9518
- modules: modules$1,
9519
- directives: directives$1,
9520
- isPreTag: isPreTag,
9521
- isUnaryTag: isUnaryTag,
9522
- mustUseProp: mustUseProp,
9523
- canBeLeftOpenTag: canBeLeftOpenTag,
9524
- isReservedTag: isReservedTag,
9525
- getTagNamespace: getTagNamespace,
9526
- staticKeys: genStaticKeys(modules$1)
9527
- };
9528
-
9529
9982
  var ref$1 = createCompiler(baseOptions);
9530
9983
  var compileToFunctions = ref$1.compileToFunctions;
9531
9984
 
@@ -9586,7 +10039,8 @@ Vue$3.prototype.$mount = function (
9586
10039
 
9587
10040
  var ref = compileToFunctions(template, {
9588
10041
  shouldDecodeNewlines: shouldDecodeNewlines,
9589
- delimiters: options.delimiters
10042
+ delimiters: options.delimiters,
10043
+ comments: options.comments
9590
10044
  }, this);
9591
10045
  var render = ref.render;
9592
10046
  var staticRenderFns = ref.staticRenderFns;