diff --git a/lib/apis.js b/lib/apis.js index 8e6744da6d25632b1e2c816f9ec948a248b625c9..b41adedcf9ae834c34ef91336a1f171da675c916 100644 --- a/lib/apis.js +++ b/lib/apis.js @@ -204,7 +204,8 @@ const third = [ 'getCurrentSubNVue', 'setPageMeta', 'onNativeEventReceive', - 'sendNativeEvent' + 'sendNativeEvent', + 'preloadPage' ] const ad = [ diff --git a/packages/uni-app-plus/dist/index.v3.js b/packages/uni-app-plus/dist/index.v3.js index aa90a5bfb8b55f02c6c17edccd4551c213ba4e0b..b45606bd11d2953f791d7e7629b82acdcc1be727 100644 --- a/packages/uni-app-plus/dist/index.v3.js +++ b/packages/uni-app-plus/dist/index.v3.js @@ -215,7 +215,8 @@ var serviceContext = (function () { 'getCurrentSubNVue', 'setPageMeta', 'onNativeEventReceive', - 'sendNativeEvent' + 'sendNativeEvent', + 'preloadPage' ]; const ad = [ @@ -1625,7 +1626,7 @@ var serviceContext = (function () { getProvider: getProvider }); - function encodeQueryString (url) { + function encodeQueryString(url) { if (typeof url !== 'string') { return url } @@ -1648,9 +1649,9 @@ var serviceContext = (function () { query.split('&').forEach(param => { const parts = param.replace(/\+/g, ' ').split('='); const key = parts.shift(); - const val = parts.length > 0 - ? parts.join('=') - : ''; + const val = parts.length > 0 ? + parts.join('=') : + ''; params.push(key + '=' + encodeURIComponent(val)); }); @@ -1658,8 +1659,8 @@ var serviceContext = (function () { return params.length ? url + '?' + params.join('&') : url } - function createValidator (type) { - return function validator (url, params) { + function createValidator(type) { + return function validator(url, params) { // 格式化为绝对路径路由 url = getRealRoute(url); @@ -1687,7 +1688,7 @@ var serviceContext = (function () { // switchTab不允许传递参数,reLaunch到一个tabBar页面是可以的 if ( - type === 'switchTab' && + (type === 'switchTab' || type === 'preloadPage') && routeOptions.meta.isTabBar && params.openType !== 'appLaunch' ) { @@ -1702,6 +1703,22 @@ var serviceContext = (function () { // 参数格式化 params.url = encodeQueryString(url); + if (type === 'preloadPage') { + { + if (!routeOptions.meta.isNVue) { + return 'can not preload vue page' + } + } + if (routeOptions.meta.isTabBar) { + const pages = getCurrentPages(true); + const tabBarPagePath = (routeOptions.alias || routeOptions.path).substr(1); + if (pages.find(page => page.route === tabBarPagePath)) { + return 'tabBar page `' + tabBarPagePath + '` already exists' + } + } + return + } + // 主要拦截目标为用户快速点击时触发的多次跳转,该情况,通常前后 url 是一样的 if (navigatorLock === url) { return `${navigatorLock} locked` @@ -1716,24 +1733,24 @@ var serviceContext = (function () { let navigatorLock; - function createProtocol (type, extras = {}) { + function createProtocol(type, extras = {}) { return Object.assign({ url: { type: String, required: true, validator: createValidator(type) }, - beforeAll () { + beforeAll() { navigatorLock = ''; } }, extras) } - function createAnimationProtocol (animationTypes) { + function createAnimationProtocol(animationTypes) { return { animationType: { type: String, - validator (type) { + validator(type) { if (type && animationTypes.indexOf(type) === -1) { return '`' + type + '` is not supported for `animationType` (supported values are: `' + animationTypes.join( '`|`') + '`)' @@ -1769,7 +1786,7 @@ var serviceContext = (function () { const navigateBack = Object.assign({ delta: { type: Number, - validator (delta, params) { + validator(delta, params) { delta = parseInt(delta) || 1; params.delta = Math.min(getCurrentPages().length - 1, delta); } @@ -1786,7 +1803,15 @@ var serviceContext = (function () { 'pop-out', 'none' ] - )); + )); + + const preloadPage = { + url: { + type: String, + required: true, + validator: createValidator('preloadPage') + } + }; var require_context_module_0_23 = /*#__PURE__*/Object.freeze({ __proto__: null, @@ -1794,7 +1819,8 @@ var serviceContext = (function () { reLaunch: reLaunch, navigateTo: navigateTo, switchTab: switchTab, - navigateBack: navigateBack + navigateBack: navigateBack, + preloadPage: preloadPage }); const getStorage = { @@ -8079,7 +8105,7 @@ var serviceContext = (function () { } } - function createWebview (path, routeOptions, query) { + function createWebview (path, routeOptions, query, extras = {}) { if (routeOptions.meta.isNVue) { const webviewId = id$1++; const webviewStyle = parseWebviewStyle( @@ -8093,9 +8119,9 @@ var serviceContext = (function () { } // android 需要使用 webviewStyle.isTab = !!routeOptions.meta.isTabBar; - return plus.webview.create('', String(webviewId), webviewStyle, { + return plus.webview.create('', String(webviewId), webviewStyle, Object.assign({ nvue: true - }) + }, extras)) } if (id$1 === 2) { // 如果首页非 nvue,则直接返回 Launch Webview return plus.webview.getLaunchWebview() @@ -8347,22 +8373,43 @@ var serviceContext = (function () { const pages = []; - function getCurrentPages$1 (returnAll) { + function getCurrentPages$1(returnAll) { return returnAll ? pages.slice(0) : pages.filter(page => { return !page.$page.meta.isTabBar || page.$page.meta.visible }) } + const preloadWebviews = {}; + + function preloadWebview$1({ + url, + path, + query + }) { + if (!preloadWebviews[url]) { + const routeOptions = JSON.parse(JSON.stringify(__uniRoutes.find(route => route.path === path))); + preloadWebviews[url] = createWebview(path, routeOptions, query, { + __preload__: true, + __query__: JSON.stringify(query) + }); + } + return preloadWebviews[url] + } + /** * 首页需要主动registerPage,二级页面路由跳转时registerPage */ - function registerPage ({ + function registerPage({ url, path, query, openType, webview }) { + if (preloadWebviews[url]) { + webview = preloadWebviews[url]; + delete preloadWebviews[url]; + } const routeOptions = JSON.parse(JSON.stringify(__uniRoutes.find(route => route.path === path))); if ( @@ -8405,7 +8452,7 @@ var serviceContext = (function () { const pageInstance = { route, options: Object.assign({}, query || {}), - $getAppWebview () { + $getAppWebview() { // 重要,不能直接返回 webview 对象,因为 plus 可能会被二次替换,返回的 webview 对象内部的 plus 不正确 // 导致 webview.getStyle 等逻辑出错(旧的 webview 内部 plus 被释放) return plus.webview.getWebviewById(webview.id) @@ -8417,7 +8464,7 @@ var serviceContext = (function () { route, openType }, - $remove () { + $remove() { const index = pages.findIndex(page => page === this); if (index !== -1) { if (!webview.nvue) { @@ -8430,16 +8477,20 @@ var serviceContext = (function () { } }, // 兼容小程序框架 - selectComponent (selector) { + selectComponent(selector) { return this.$vm.selectComponent(selector) }, - selectAllComponents (selector) { + selectAllComponents(selector) { return this.$vm.selectAllComponents(selector) } }; pages.push(pageInstance); + // if (webview.__preload__) { + // // TODO 触发 onShow 以及绑定vm,page 关系 + // } + // 首页是 nvue 时,在 registerPage 时,执行路由堆栈 if (webview.id === '1' && webview.nvue) { if ( @@ -8449,7 +8500,7 @@ var serviceContext = (function () { ) { plus.navigator.closeSplashscreen(); } - __uniConfig.onReady(function () { + __uniConfig.onReady(function() { navigateFinish(); }); } @@ -8729,6 +8780,24 @@ var serviceContext = (function () { }, openType === 'appLaunch'); } + function preloadPage$1({ + url + }, callbackId) { + const urls = url.split('?'); + const path = urls[0]; + const query = parseQuery(urls[1] || ''); + const webview = preloadWebview$1({ + url, + path, + query + }); + invoke$1(callbackId, { + id: webview.id, + url, + errMsg: 'preloadPage:ok' + }); + } + const STORAGE_DATA_TYPE = '__TYPE'; const STORAGE_KEYS = 'uni-storage-keys'; @@ -9653,6 +9722,7 @@ var serviceContext = (function () { reLaunch: reLaunch$1, redirectTo: redirectTo$1, switchTab: switchTab$1, + preloadPage: preloadPage$1, setStorage: setStorage$1, setStorageSync: setStorageSync$1, getStorage: getStorage$1, diff --git a/packages/uni-app-plus/dist/service.runtime.esm.prod.js b/packages/uni-app-plus/dist/service.runtime.esm.prod.js index e205d814bd429fc87530154a18e9d59e04a9e8ed..f62b2bbf848e61516a25752feee04a3abe4885e8 100644 --- a/packages/uni-app-plus/dist/service.runtime.esm.prod.js +++ b/packages/uni-app-plus/dist/service.runtime.esm.prod.js @@ -1 +1,6525 @@ -export default function t(t,e){var n=Object.freeze({});function r(t){return null==t}function o(t){return null!=t}function i(t){return!0===t}function a(t){return"string"==typeof t||"number"==typeof t||"symbol"==typeof t||"boolean"==typeof t}function s(t){return null!==t&&"object"==typeof t}var c=Object.prototype.toString;function u(t){return"[object Object]"===c.call(t)}function f(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function l(t){return o(t)&&"function"==typeof t.then&&"function"==typeof t.catch}function p(t){return null==t?"":Array.isArray(t)||u(t)&&t.toString===c?JSON.stringify(t,null,2):String(t)}function d(t){var e=parseFloat(t);return isNaN(e)?t:e}function h(t,e){for(var n=Object.create(null),r=t.split(","),o=0;o-1)return t.splice(n,1)}}var m=Object.prototype.hasOwnProperty;function g(t,e){return m.call(t,e)}function _(t){var e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}var b=/-(\w)/g,$=_(function(t){return t.replace(b,function(t,e){return e?e.toUpperCase():""})}),x=_(function(t){return t.charAt(0).toUpperCase()+t.slice(1)}),O=/\B([A-Z])/g,w=_(function(t){return t.replace(O,"-$1").toLowerCase()});var A=Function.prototype.bind?function(t,e){return t.bind(e)}:function(t,e){function n(n){var r=arguments.length;return r?r>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n};function S(t,e){e=e||0;for(var n=t.length-e,r=new Array(n);n--;)r[n]=t[n+e];return r}function C(t,e){for(var n in e)t[n]=e[n];return t}function k(t){for(var e={},n=0;n0),X=(K&&K.indexOf("android"),K&&/iphone|ipad|ipod|ios/.test(K),K&&/chrome\/\d+/.test(K),K&&/phantomjs/.test(K),K&&K.match(/firefox\/(\d+)/),{}.watch);if(z)try{var Z={};Object.defineProperty(Z,"passive",{get:function(){}}),window.addEventListener("test-passive",null,Z)}catch(t){}var G=function(){return void 0===B&&(B=!z&&!H&&"undefined"!=typeof global&&(global.process&&"server"===global.process.env.VUE_ENV)),B},Q=z&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function Y(t){return"function"==typeof t&&/native code/.test(t.toString())}var tt,et="undefined"!=typeof Symbol&&Y(Symbol)&&"undefined"!=typeof Reflect&&Y(Reflect.ownKeys);tt="undefined"!=typeof Set&&Y(Set)?Set:function(){function t(){this.set=Object.create(null)}return t.prototype.has=function(t){return!0===this.set[t]},t.prototype.add=function(t){this.set[t]=!0},t.prototype.clear=function(){this.set=Object.create(null)},t}();var nt=j,rt=0,ot=function(){this.id=void 0!==e?e.uid++:rt++,this.subs=[]};function it(t){ot.SharedObject.targetStack.push(t),ot.SharedObject.target=t}function at(){ot.SharedObject.targetStack.pop(),ot.SharedObject.target=ot.SharedObject.targetStack[ot.SharedObject.targetStack.length-1]}ot.prototype.addSub=function(t){this.subs.push(t)},ot.prototype.removeSub=function(t){y(this.subs,t)},ot.prototype.depend=function(){ot.SharedObject.target&&ot.SharedObject.target.addDep(this)},ot.prototype.notify=function(){for(var t=this.subs.slice(),e=0,n=t.length;e-1)if(i&&!g(o,"default"))a=!1;else if(""===a||a===w(t)){var c=Tt(String,o.type);(c<0||s0&&(Qt((u=t(u,(n||"")+"_"+c))[0])&&Qt(l)&&(s[f]=ft(l.text+u[0].text),u.shift()),s.push.apply(s,u)):a(u)?Qt(l)?s[f]=ft(l.text+u):""!==u&&s.push(ft(u)):Qt(u)&&Qt(l)?s[f]=ft(l.text+u.text):(i(e._isVList)&&o(u.tag)&&r(u.key)&&o(n)&&(u.key="__vlist"+n+"_"+c+"__"),s.push(u)));return s}(t):void 0}function Qt(t){return o(t)&&o(t.text)&&!1===t.isComment}function Yt(t,e){if(t){for(var n=Object.create(null),r=et?Reflect.ownKeys(t):Object.keys(t),o=0;o0,a=t?!!t.$stable:!i,s=t&&t.$key;if(t){if(t._normalized)return t._normalized;if(a&&r&&r!==n&&s===r.$key&&!i&&!r.$hasNormal)return r;for(var c in o={},t)t[c]&&"$"!==c[0]&&(o[c]=re(e,c,t[c]))}else o={};for(var u in e)u in o||(o[u]=oe(e,u));return t&&Object.isExtensible(t)&&(t._normalized=o),R(o,"$stable",a),R(o,"$key",s),R(o,"$hasNormal",i),o}function re(t,e,n){var r=function(){var t=arguments.length?n.apply(null,arguments):n({});return(t=t&&"object"==typeof t&&!Array.isArray(t)?[t]:Gt(t))&&(0===t.length||1===t.length&&t[0].isComment)?void 0:t};return n.proxy&&Object.defineProperty(t,e,{get:r,enumerable:!0,configurable:!0}),r}function oe(t,e){return function(){return t[e]}}function ie(t,e){var n,r,i,a,c;if(Array.isArray(t)||"string"==typeof t)for(n=new Array(t.length),r=0,i=t.length;rdocument.createEvent("Event").timeStamp&&(qe=function(){return Je.now()})}function Xe(){var t,e;for(qe(),We=!0,Be.sort(function(t,e){return t.id-e.id}),Ke=0;KeKe&&Be[n].id>t.id;)n--;Be.splice(n+1,0,t)}else Be.push(t);He||(He=!0,Ut(Xe))}}(this)},Ge.prototype.run=function(){if(this.active){var t=this.get();if(t!==this.value||s(t)||this.deep){var e=this.value;if(this.value=t,this.user)try{this.cb.call(this.vm,t,e)}catch(t){Pt(t,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,t,e)}}},Ge.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},Ge.prototype.depend=function(){for(var t=this.deps.length;t--;)this.deps[t].depend()},Ge.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||y(this.vm._watchers,this);for(var t=this.deps.length;t--;)this.deps[t].removeSub(this);this.active=!1}};var Qe={enumerable:!0,configurable:!0,get:j,set:j};function Ye(t,e,n){Qe.get=function(){return this[e][n]},Qe.set=function(t){this[e][n]=t},Object.defineProperty(t,n,Qe)}function tn(t){t._watchers=[];var e=t.$options;e.props&&function(t,e){var n=t.$options.propsData||{},r=t._props={},o=t.$options._propKeys=[];t.$parent&&yt(!1);var i=function(i){o.push(i);var a=It(i,e,n,t);_t(r,i,a),i in t||Ye(t,"_props",i)};for(var a in e)i(a);yt(!0)}(t,e.props),e.methods&&function(t,e){t.$options.props;for(var n in e)t[n]="function"!=typeof e[n]?j:A(e[n],t)}(t,e.methods),e.data?function(t){var e=t.$options.data;u(e=t._data="function"==typeof e?function(t,e){it();try{return t.call(e,e)}catch(t){return Pt(t,e,"data()"),{}}finally{at()}}(e,t):e||{})||(e={});var n=Object.keys(e),r=t.$options.props,o=(t.$options.methods,n.length);for(;o--;){var i=n[o];r&&g(r,i)||(a=void 0,36!==(a=(i+"").charCodeAt(0))&&95!==a&&Ye(t,"_data",i))}var a;gt(e,!0)}(t):gt(t._data={},!0),e.computed&&function(t,e){var n=t._computedWatchers=Object.create(null),r=G();for(var o in e){var i=e[o],a="function"==typeof i?i:i.get;r||(n[o]=new Ge(t,a||j,j,en)),o in t||nn(t,o,i)}}(t,e.computed),e.watch&&e.watch!==X&&function(t,e){for(var n in e){var r=e[n];if(Array.isArray(r))for(var o=0;o-1:"string"==typeof t?t.split(",").indexOf(e)>-1:(n=t,"[object RegExp]"===c.call(n)&&t.test(e));var n}function dn(t,e){var n=t.cache,r=t.keys,o=t._vnode;for(var i in n){var a=n[i];if(a){var s=ln(a.componentOptions);s&&!e(s)&&hn(n,i,r,o)}}}function hn(t,e,n,r){var o=t[e];!o||r&&o.tag===r.tag||o.componentInstance.$destroy(),t[e]=null,y(n,e)}!function(t){t.prototype._init=function(t){var e=this;e._uid=sn++,e._isVue=!0,t&&t._isComponent?function(t,e){var n=t.$options=Object.create(t.constructor.options),r=e._parentVnode;n.parent=e.parent,n._parentVnode=r;var o=r.componentOptions;n.propsData=o.propsData,n._parentListeners=o.listeners,n._renderChildren=o.children,n._componentTag=o.tag,e.render&&(n.render=e.render,n.staticRenderFns=e.staticRenderFns)}(e,t):e.$options=kt(cn(e.constructor),t||{},e),e._renderProxy=e,e._self=e,function(t){var e=t.$options,n=e.parent;if(n&&!e.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(t)}t.$parent=n,t.$root=n?n.$root:t,t.$children=[],t.$refs={},t._watcher=null,t._inactive=null,t._directInactive=!1,t._isMounted=!1,t._isDestroyed=!1,t._isBeingDestroyed=!1}(e),function(t){t._events=Object.create(null),t._hasHookEvent=!1;var e=t.$options._parentListeners;e&&Fe(t,e)}(e),function(t){t._vnode=null,t._staticTrees=null;var e=t.$options,r=t.$vnode=e._parentVnode,o=r&&r.context;t.$slots=te(e._renderChildren,o),t.$scopedSlots=n,t._c=function(e,n,r,o){return je(t,e,n,r,o,!1)},t.$createElement=function(e,n,r,o){return je(t,e,n,r,o,!0)};var i=r&&r.data;_t(t,"$attrs",i&&i.attrs||n,null,!0),_t(t,"$listeners",e._parentListeners||n,null,!0)}(e),Ve(e,"beforeCreate"),function(t){var e=Yt(t.$options.inject,t);e&&(yt(!1),Object.keys(e).forEach(function(n){_t(t,n,e[n])}),yt(!0))}(e),tn(e),function(t){var e=t.$options.provide;e&&(t._provided="function"==typeof e?e.call(t):e)}(e),Ve(e,"created"),e.$options.el&&e.$mount(e.$options.el)}}(un),function(t){var e={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(t.prototype,"$data",e),Object.defineProperty(t.prototype,"$props",n),t.prototype.$set=bt,t.prototype.$delete=$t,t.prototype.$watch=function(t,e,n){if(u(e))return an(this,t,e,n);(n=n||{}).user=!0;var r=new Ge(this,t,e,n);if(n.immediate)try{e.call(this,r.value)}catch(t){Pt(t,this,'callback for immediate watcher "'+r.expression+'"')}return function(){r.teardown()}}}(un),function(t){var e=/^hook:/;t.prototype.$on=function(t,n){var r=this;if(Array.isArray(t))for(var o=0,i=t.length;o1?S(e):e;for(var n=S(arguments,1),r='event handler for "'+t+'"',o=0,i=e.length;oparseInt(this.max)&&hn(s,c[0],c,this._vnode)),e.data.keepAlive=!0}return e||t&&t[0]}}};!function(t){var e={get:function(){return M}};Object.defineProperty(t,"config",e),t.util={warn:nt,extend:C,mergeOptions:kt,defineReactive:_t},t.set=bt,t.delete=$t,t.nextTick=Ut,t.observable=function(t){return gt(t),t},t.options=Object.create(null),F.forEach(function(e){t.options[e+"s"]=Object.create(null)}),t.options._base=t,C(t.options.components,yn),function(t){t.use=function(t){var e=this._installedPlugins||(this._installedPlugins=[]);if(e.indexOf(t)>-1)return this;var n=S(arguments,1);return n.unshift(this),"function"==typeof t.install?t.install.apply(t,n):"function"==typeof t&&t.apply(null,n),e.push(t),this}}(t),function(t){t.mixin=function(t){return this.options=kt(this.options,t),this}}(t),fn(t),function(t){F.forEach(function(e){t[e]=function(t,n){return n?("component"===e&&u(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),"directive"===e&&"function"==typeof n&&(n={bind:n,update:n}),this.options[e+"s"][t]=n,n):this.options[e+"s"][t]}})}(t)}(un),Object.defineProperty(un.prototype,"$isServer",{get:G}),Object.defineProperty(un.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(un,"FunctionalRenderContext",{value:be}),un.version="2.6.11";var mn=1;function gn(){return(mn++).toString()}var _n=function(){this.nodeId=gn(),this.ref=this.nodeId,this.children=[],this.pureChildren=[],this.parentNode=null,this.nextSibling=null,this.previousSibling=null};_n.prototype.destroy=function(){this._$vd&&this._$vd.removeElement(this),this.children.forEach(function(t){t.destroy()})};var bn=function(t){function e(e){t.call(this),this.nodeType=8,this.nodeId=gn(),this.ref=this.nodeId,this.type="comment",this.value=e,this.children=[],this.pureChildren=[]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.toString=function(){return"\x3c!-- "+this.value+" --\x3e"},e}(_n);function $n(t,e,n){var r=t.documentElement;if(!(r.pureChildren.length>0||e.parentNode)){var o=r.children,i=o.indexOf(n);i<0?o.push(e):o.splice(i,0,e),1===e.nodeType?("body"===e.role?(e.docId=t.id,e.ownerDocument=t,e.parentNode=r,On(e,r)):(e.children.forEach(function(t){t.parentNode=e}),xn(t,e),e.docId=t.id,e.ownerDocument=t,On(e,r)),r.pureChildren.push(e)):e.parentNode=r}}function xn(t,e){e.role="body",e.depth=1,e.ref="_root",t.body=e}function On(t,e){t.parentNode=e,e.docId&&(t.docId=e.docId,t.ownerDocument=e.ownerDocument,t.depth=e.depth+1),t.children.forEach(function(e){On(e,t)})}function wn(t){for(;t;){if(1===t.nodeType)return t;t=t.nextSibling}}function An(t){for(;t;){if(1===t.nodeType)return t;t=t.previousSibling}}function Sn(t,e,n,r){n<0&&(n=0);var o=e[n-1],i=e[n];return e.splice(n,0,t),r&&(o&&(o.nextSibling=t),t.previousSibling=o,t.nextSibling=i,i&&(i.previousSibling=t)),n}function Cn(t,e,n,r){var o=e.indexOf(t);if(o<0)return-1;if(r){var i=e[o-1],a=e[o+1];i&&(i.nextSibling=a),a&&(a.previousSibling=i)}e.splice(o,1);var s=n;o<=n&&(s=n-1);var c=e[s-1],u=e[s];return e.splice(s,0,t),r&&(c&&(c.nextSibling=t),t.previousSibling=c,t.nextSibling=u,u&&(u.previousSibling=t)),o===s?-1:n}function kn(t,e,n){var r=e.indexOf(t);if(!(r<0)){if(n){var o=e[r-1],i=e[r+1];o&&(o.nextSibling=i),i&&(i.previousSibling=o)}e.splice(r,1)}}var jn="view",In=function(t){function e(e){void 0===e&&(e=jn),t.call(this),this.nodeType=1,this.nodeId=gn(),this.ref=this.nodeId,this.type=e,this.attr={},this.events={},this.children=[],this.pureChildren=[]}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setAttribute=function(t,e){"cid"===t?this.cid=e:"nid"===t&&(this.nid=e)},e.prototype.dispatchEvent=function(t,e){var n=this.events[t];n&&n.forEach(function(t){t(e)})},e.prototype.addEventListener=function(t,e){if(""===this.cid||""===this.nid)return console.error("cid="+this.cid+",nid="+this.nid+" addEventListener("+t+") not found");(this.events[t]||(this.events[t]=[])).push(e),this._$vd.addElement(this)},e.prototype.removeEventListener=function(t,e){var n=this;if(""===this.cid||""===this.nid)return console.error("cid="+this.cid+",nid="+this.nid+" removeEventListener("+t+") not found");var r=!1;if(this.events[t]){var o=this.events[t].indexOf(e);-1!==o&&(this.events[t].splice(o,1),r=!0)}r||console.error("cid="+this.cid+",nid="+this.nid+" removeEventListener("+t+") handler not found"),Object.keys(this.events).every(function(t){return 0===n.events[t].length})&&this._$vd.removeElement(this)},e.prototype.appendChild=function(t){t.parentNode&&t.parentNode!==this||(t.parentNode?(Cn(t,this.children,this.children.length,!0),1===t.nodeType&&Cn(t,this.pureChildren,this.pureChildren.length)):(On(t,this),Sn(t,this.children,this.children.length,!0),1===t.nodeType&&Sn(t,this.pureChildren,this.pureChildren.length)))},e.prototype.insertBefore=function(t,e){if(!(t.parentNode&&t.parentNode!==this||t===e||t.nextSibling&&t.nextSibling===e))if(t.parentNode){if(Cn(t,this.children,this.children.indexOf(e),!0),1===t.nodeType){var n=wn(e);Cn(t,this.pureChildren,n?this.pureChildren.indexOf(n):this.pureChildren.length)}}else if(On(t,this),Sn(t,this.children,this.children.indexOf(e),!0),1===t.nodeType){var r=wn(e);Sn(t,this.pureChildren,r?this.pureChildren.indexOf(r):this.pureChildren.length)}},e.prototype.insertAfter=function(t,e){t.parentNode&&t.parentNode!==this||t===e||t.previousSibling&&t.previousSibling===e||(t.parentNode?(Cn(t,this.children,this.children.indexOf(e)+1,!0),1===t.nodeType&&Cn(t,this.pureChildren,this.pureChildren.indexOf(An(e))+1)):(On(t,this),Sn(t,this.children,this.children.indexOf(e)+1,!0),1===t.nodeType&&Sn(t,this.pureChildren,this.pureChildren.indexOf(An(e))+1)))},e.prototype.removeChild=function(t,e){t.parentNode&&(kn(t,this.children,!0),1===t.nodeType&&kn(t,this.pureChildren)),e||t.destroy()},e.prototype.clear=function(){this.children.forEach(function(t){t.destroy()}),this.children.length=0,this.pureChildren.length=0},e.prototype.toString=function(){return"<"+this.type+" attr="+JSON.stringify(this.attr)+" style="+JSON.stringify(this.toStyle())+">"+this.pureChildren.map(function(t){return t.toString()}).join("")+""},e}(_n),En=function(t,e){this.id=t?t.toString():"",this.URL=e,this.createDocumentElement()};En.prototype.createDocumentElement=function(){var t=this;if(!this.documentElement){var e=new In("document");e.docId=this.id,e.ownerDocument=this,e.role="documentElement",e.depth=0,e.ref="_documentElement",this.documentElement=e,Object.defineProperty(e,"appendChild",{configurable:!0,enumerable:!0,writable:!0,value:function(e){$n(t,e)}}),Object.defineProperty(e,"insertBefore",{configurable:!0,enumerable:!0,writable:!0,value:function(e,n){$n(t,e,n)}})}return this.documentElement},En.prototype.createBody=function(t){this.body||xn(this,new In(t));return this.body},En.prototype.createElement=function(t){return new In(t)},En.prototype.createComment=function(t){return new bn(t)},En.prototype.destroy=function(){};var Dn=h("style,class"),Tn=h("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template,blockquote,iframe,tfoot");var Pn=Object.freeze({createElement:function(t){return new In(t)},createElementNS:function(t,e){return new In(t+":"+e)},createTextNode:function(){return new In("text")},createComment:function(t){return new bn(t)},insertBefore:function(t,e,n){t.insertBefore(e,n)},removeChild:function(t,e){t.removeChild(e)},appendChild:function(t,e){t.appendChild(e)},parentNode:function(t){return t.parentNode},nextSibling:function(t){return t.nextSibling},tagName:function(t){return t.type},setTextContent:function(){},setStyleScope:function(){}}),Nn={create:function(t,e){Fn(e)},update:function(t,e){t.data.ref!==e.data.ref&&(Fn(t,!0),Fn(e))},destroy:function(t){Fn(t,!0)}};function Fn(t,e){var n=t.data.ref;if(o(n)){var r=t.context,i=t.componentInstance||t.elm,a=r.$refs;e?Array.isArray(a[n])?y(a[n],i):a[n]===i&&(a[n]=void 0):t.data.refInFor?Array.isArray(a[n])?a[n].indexOf(i)<0&&a[n].push(i):a[n]=[i]:a[n]=i}}var Ln=h("text,number,password,search,email,tel,url"),Mn=new st("",{},[]),Rn=["create","activate","update","remove","destroy"];function Vn(t,e){return t.key===e.key&&(t.tag===e.tag&&t.isComment===e.isComment&&o(t.data)===o(e.data)&&function(t,e){if("input"!==t.tag)return!0;var n,r=o(n=t.data)&&o(n=n.attrs)&&n.type,i=o(n=e.data)&&o(n=n.attrs)&&n.type;return r===i||Ln(r)&&Ln(i)}(t,e)||i(t.isAsyncPlaceholder)&&t.asyncFactory===e.asyncFactory&&r(e.asyncFactory.error))}function Bn(t,e,n){var r,i,a={};for(r=e;r<=n;++r)o(i=t[r].key)&&(a[i]=r);return a}var Un={create:zn,update:zn,destroy:function(t){zn(t,Mn)}};function zn(t,e){(t.data.directives||e.data.directives)&&function(t,e){var n,r,o,i=t===Mn,a=e===Mn,s=Wn(t.data.directives,t.context),c=Wn(e.data.directives,e.context),u=[],f=[];for(n in c)r=s[n],o=c[n],r?(o.oldValue=r.value,o.oldArg=r.arg,qn(o,"update",e,t),o.def&&o.def.componentUpdated&&f.push(o)):(qn(o,"bind",e,t),o.def&&o.def.inserted&&u.push(o));if(u.length){var l=function(){for(var n=0;nh?_(t,r(n[m+1])?null:n[m+1].elm,n,d,m,i):d>m&&$(e,p,h)}(p,v,m,n,f):o(m)?(o(t.text)&&u.setTextContent(p,""),_(p,null,m,0,m.length-1,n)):o(v)?$(v,0,v.length-1):o(t.text)&&u.setTextContent(p,""):t.text!==e.text&&u.setTextContent(p,e.text),o(h)&&o(d=h.hook)&&o(d=d.postpatch)&&d(t,e)}}}function A(t,e,n){if(i(n)&&o(t.parent))t.parent.data.pendingInsert=e;else for(var r=0;r1&&(e[r[0].trim()]=r[1].trim())}}),e});function sr(t){return Array.isArray(t)?k(t):"string"==typeof t?ar(t):t}function cr(t,e){var n=this;it();var r,o=n.$options[t],i=t+" hook";if(o)for(var a=0,s=o.length;a= 0 && Math.floor(n) === n && isFinite(val) +} + +function isPromise (val) { + return ( + isDef(val) && + typeof val.then === 'function' && + typeof val.catch === 'function' + ) +} + +/** + * Convert a value to a string that is actually rendered. + */ +function toString (val) { + return val == null + ? '' + : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString) + ? JSON.stringify(val, null, 2) + : String(val) +} + +/** + * Convert an input value to a number for persistence. + * If the conversion fails, return original string. + */ +function toNumber (val) { + var n = parseFloat(val); + return isNaN(n) ? val : n +} + +/** + * Make a map and return a function for checking if a key + * is in that map. + */ +function makeMap ( + str, + expectsLowerCase +) { + var map = Object.create(null); + var list = str.split(','); + for (var i = 0; i < list.length; i++) { + map[list[i]] = true; + } + return expectsLowerCase + ? function (val) { return map[val.toLowerCase()]; } + : function (val) { return map[val]; } +} + +/** + * Check if a tag is a built-in tag. + */ +var isBuiltInTag = makeMap('slot,component', true); + +/** + * Check if an attribute is a reserved attribute. + */ +var isReservedAttribute = makeMap('key,ref,slot,slot-scope,is'); + +/** + * Remove an item from an array. + */ +function remove (arr, item) { + if (arr.length) { + var index = arr.indexOf(item); + if (index > -1) { + return arr.splice(index, 1) + } + } +} + +/** + * Check whether an object has the property. + */ +var hasOwnProperty = Object.prototype.hasOwnProperty; +function hasOwn (obj, key) { + return hasOwnProperty.call(obj, key) +} + +/** + * Create a cached version of a pure function. + */ +function cached (fn) { + var cache = Object.create(null); + return (function cachedFn (str) { + var hit = cache[str]; + return hit || (cache[str] = fn(str)) + }) +} + +/** + * Camelize a hyphen-delimited string. + */ +var camelizeRE = /-(\w)/g; +var camelize = cached(function (str) { + return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; }) +}); + +/** + * Capitalize a string. + */ +var capitalize = cached(function (str) { + return str.charAt(0).toUpperCase() + str.slice(1) +}); + +/** + * Hyphenate a camelCase string. + */ +var hyphenateRE = /\B([A-Z])/g; +var hyphenate = cached(function (str) { + return str.replace(hyphenateRE, '-$1').toLowerCase() +}); + +/** + * Simple bind polyfill for environments that do not support it, + * e.g., PhantomJS 1.x. Technically, we don't need this anymore + * since native bind is now performant enough in most browsers. + * But removing it would mean breaking code that was able to run in + * PhantomJS 1.x, so this must be kept for backward compatibility. + */ + +/* istanbul ignore next */ +function polyfillBind (fn, ctx) { + function boundFn (a) { + var l = arguments.length; + return l + ? l > 1 + ? fn.apply(ctx, arguments) + : fn.call(ctx, a) + : fn.call(ctx) + } + + boundFn._length = fn.length; + return boundFn +} + +function nativeBind (fn, ctx) { + return fn.bind(ctx) +} + +var bind = Function.prototype.bind + ? nativeBind + : polyfillBind; + +/** + * Convert an Array-like object to a real Array. + */ +function toArray (list, start) { + start = start || 0; + var i = list.length - start; + var ret = new Array(i); + while (i--) { + ret[i] = list[i + start]; + } + return ret +} + +/** + * Mix properties into target object. + */ +function extend (to, _from) { + for (var key in _from) { + to[key] = _from[key]; + } + return to +} + +/** + * Merge an Array of Objects into a single Object. + */ +function toObject (arr) { + var res = {}; + for (var i = 0; i < arr.length; i++) { + if (arr[i]) { + extend(res, arr[i]); + } + } + return res +} + +/* eslint-disable no-unused-vars */ + +/** + * Perform no operation. + * Stubbing args to make Flow happy without leaving useless transpiled code + * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/). + */ +function noop (a, b, c) {} + +/** + * Always return false. + */ +var no = function (a, b, c) { return false; }; + +/* eslint-enable no-unused-vars */ + +/** + * Return the same value. + */ +var identity = function (_) { return _; }; + +/** + * Check if two values are loosely equal - that is, + * if they are plain objects, do they have the same shape? + */ +function looseEqual (a, b) { + if (a === b) { return true } + var isObjectA = isObject(a); + var isObjectB = isObject(b); + if (isObjectA && isObjectB) { + try { + var isArrayA = Array.isArray(a); + var isArrayB = Array.isArray(b); + if (isArrayA && isArrayB) { + return a.length === b.length && a.every(function (e, i) { + return looseEqual(e, b[i]) + }) + } else if (a instanceof Date && b instanceof Date) { + return a.getTime() === b.getTime() + } else if (!isArrayA && !isArrayB) { + var keysA = Object.keys(a); + var keysB = Object.keys(b); + return keysA.length === keysB.length && keysA.every(function (key) { + return looseEqual(a[key], b[key]) + }) + } else { + /* istanbul ignore next */ + return false + } + } catch (e) { + /* istanbul ignore next */ + return false + } + } else if (!isObjectA && !isObjectB) { + return String(a) === String(b) + } else { + return false + } +} + +/** + * Return the first index at which a loosely equal value can be + * found in the array (if value is a plain object, the array must + * contain an object of the same shape), or -1 if it is not present. + */ +function looseIndexOf (arr, val) { + for (var i = 0; i < arr.length; i++) { + if (looseEqual(arr[i], val)) { return i } + } + return -1 +} + +/** + * Ensure a function is called only once. + */ +function once (fn) { + var called = false; + return function () { + if (!called) { + called = true; + fn.apply(this, arguments); + } + } +} + +var SSR_ATTR = 'data-server-rendered'; + +var ASSET_TYPES = [ + 'component', + 'directive', + 'filter' +]; + +var LIFECYCLE_HOOKS = [ + 'beforeCreate', + 'created', + 'beforeMount', + 'mounted', + 'beforeUpdate', + 'updated', + 'beforeDestroy', + 'destroyed', + 'activated', + 'deactivated', + 'errorCaptured', + 'serverPrefetch' +]; + +/* */ + + + +var config = ({ + /** + * Option merge strategies (used in core/util/options) + */ + // $flow-disable-line + optionMergeStrategies: Object.create(null), + + /** + * Whether to suppress warnings. + */ + silent: false, + + /** + * Show production mode tip message on boot? + */ + productionTip: "production" !== 'production', + + /** + * Whether to enable devtools + */ + devtools: "production" !== 'production', + + /** + * Whether to record perf + */ + performance: false, + + /** + * Error handler for watcher errors + */ + errorHandler: null, + + /** + * Warn handler for watcher warns + */ + warnHandler: null, + + /** + * Ignore certain custom elements + */ + ignoredElements: [], + + /** + * Custom user key aliases for v-on + */ + // $flow-disable-line + keyCodes: Object.create(null), + + /** + * Check if a tag is reserved so that it cannot be registered as a + * component. This is platform-dependent and may be overwritten. + */ + isReservedTag: no, + + /** + * Check if an attribute is reserved so that it cannot be used as a component + * prop. This is platform-dependent and may be overwritten. + */ + isReservedAttr: no, + + /** + * Check if a tag is an unknown element. + * Platform-dependent. + */ + isUnknownElement: no, + + /** + * Get the namespace of an element + */ + getTagNamespace: noop, + + /** + * Parse the real tag name for the specific platform. + */ + parsePlatformTagName: identity, + + /** + * Check if an attribute must be bound using property, e.g. value + * Platform-dependent. + */ + mustUseProp: no, + + /** + * Perform updates asynchronously. Intended to be used by Vue Test Utils + * This will significantly reduce performance if set to false. + */ + async: true, + + /** + * Exposed for legacy reasons + */ + _lifecycleHooks: LIFECYCLE_HOOKS +}); + +/* */ + +/** + * unicode letters used for parsing html tags, component names and property paths. + * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname + * skipping \u10000-\uEFFFF due to it freezing up PhantomJS + */ +var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/; + +/** + * Check if a string starts with $ or _ + */ +function isReserved (str) { + var c = (str + '').charCodeAt(0); + return c === 0x24 || c === 0x5F +} + +/** + * Define a property. + */ +function def (obj, key, val, enumerable) { + Object.defineProperty(obj, key, { + value: val, + enumerable: !!enumerable, + writable: true, + configurable: true + }); +} + +/** + * Parse simple path. + */ +var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]")); +function parsePath (path) { + if (bailRE.test(path)) { + return + } + var segments = path.split('.'); + return function (obj) { + for (var i = 0; i < segments.length; i++) { + if (!obj) { return } + obj = obj[segments[i]]; + } + return obj + } +} + +/* */ + +// can we use __proto__? +var hasProto = '__proto__' in {}; + +// Browser environment sniffing +var inBrowser = typeof window !== 'undefined'; +var inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform; +var weexPlatform = inWeex && WXEnvironment.platform.toLowerCase(); +var UA = inBrowser && window.navigator.userAgent.toLowerCase(); +var isIE = UA && /msie|trident/.test(UA); +var isIE9 = UA && UA.indexOf('msie 9.0') > 0; +var isEdge = UA && UA.indexOf('edge/') > 0; +var isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android'); +var isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios'); +var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge; +var isPhantomJS = UA && /phantomjs/.test(UA); +var isFF = UA && UA.match(/firefox\/(\d+)/); + +// Firefox has a "watch" function on Object.prototype... +var nativeWatch = ({}).watch; +if (inBrowser) { + try { + var opts = {}; + Object.defineProperty(opts, 'passive', ({ + get: function get () { + } + })); // https://github.com/facebook/flow/issues/285 + window.addEventListener('test-passive', null, opts); + } catch (e) {} +} + +// this needs to be lazy-evaled because vue may be required before +// vue-server-renderer can set VUE_ENV +var _isServer; +var isServerRendering = function () { + if (_isServer === undefined) { + /* istanbul ignore if */ + if (!inBrowser && !inWeex && typeof global !== 'undefined') { + // detect presence of vue-server-renderer and avoid + // Webpack shimming the process + _isServer = global['process'] && global['process'].env.VUE_ENV === 'server'; + } else { + _isServer = false; + } + } + return _isServer +}; + +// detect devtools +var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__; + +/* istanbul ignore next */ +function isNative (Ctor) { + return typeof Ctor === 'function' && /native code/.test(Ctor.toString()) +} + +var hasSymbol = + typeof Symbol !== 'undefined' && isNative(Symbol) && + typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys); + +var _Set; +/* istanbul ignore if */ // $flow-disable-line +if (typeof Set !== 'undefined' && isNative(Set)) { + // use native Set when available. + _Set = Set; +} else { + // a non-standard Set polyfill that only works with primitive keys. + _Set = /*@__PURE__*/(function () { + function Set () { + this.set = Object.create(null); + } + Set.prototype.has = function has (key) { + return this.set[key] === true + }; + Set.prototype.add = function add (key) { + this.set[key] = true; + }; + Set.prototype.clear = function clear () { + this.set = Object.create(null); + }; + + return Set; + }()); +} + +/* */ + +var warn = noop; + +/* */ + +var uid = 0; + +/** + * A dep is an observable that can have multiple + * directives subscribing to it. + */ +var Dep = function Dep () { + // fixed by xxxxxx (nvue vuex) + /* eslint-disable no-undef */ + if(typeof SharedObject !== 'undefined'){ + this.id = SharedObject.uid++; + } else { + this.id = uid++; + } + this.subs = []; +}; + +Dep.prototype.addSub = function addSub (sub) { + this.subs.push(sub); +}; + +Dep.prototype.removeSub = function removeSub (sub) { + remove(this.subs, sub); +}; + +Dep.prototype.depend = function depend () { + if (Dep.SharedObject.target) { // fixed by xxxxxx + Dep.SharedObject.target.addDep(this); + } +}; + +Dep.prototype.notify = function notify () { + // stabilize the subscriber list first + var subs = this.subs.slice(); + for (var i = 0, l = subs.length; i < l; i++) { + subs[i].update(); + } +}; + +// The current target watcher being evaluated. +// This is globally unique because only one watcher +// can be evaluated at a time. +// fixed by xxxxxx (nvue shared vuex) +/* eslint-disable no-undef */ +Dep.SharedObject = typeof SharedObject !== 'undefined' ? SharedObject : {}; +Dep.SharedObject.target = null; +Dep.SharedObject.targetStack = []; + +function pushTarget (target) { + Dep.SharedObject.targetStack.push(target); + Dep.SharedObject.target = target; +} + +function popTarget () { + Dep.SharedObject.targetStack.pop(); + Dep.SharedObject.target = Dep.SharedObject.targetStack[Dep.SharedObject.targetStack.length - 1]; +} + +/* */ + +var VNode = function VNode ( + tag, + data, + children, + text, + elm, + context, + componentOptions, + asyncFactory +) { + this.tag = tag; + this.data = data; + this.children = children; + this.text = text; + this.elm = elm; + this.ns = undefined; + this.context = context; + this.fnContext = undefined; + this.fnOptions = undefined; + this.fnScopeId = undefined; + this.key = data && data.key; + this.componentOptions = componentOptions; + this.componentInstance = undefined; + this.parent = undefined; + this.raw = false; + this.isStatic = false; + this.isRootInsert = true; + this.isComment = false; + this.isCloned = false; + this.isOnce = false; + this.asyncFactory = asyncFactory; + this.asyncMeta = undefined; + this.isAsyncPlaceholder = false; +}; + +var prototypeAccessors = { child: { configurable: true } }; + +// DEPRECATED: alias for componentInstance for backwards compat. +/* istanbul ignore next */ +prototypeAccessors.child.get = function () { + return this.componentInstance +}; + +Object.defineProperties( VNode.prototype, prototypeAccessors ); + +var createEmptyVNode = function (text) { + if ( text === void 0 ) text = ''; + + var node = new VNode(); + node.text = text; + node.isComment = true; + return node +}; + +function createTextVNode (val) { + return new VNode(undefined, undefined, undefined, String(val)) +} + +// optimized shallow clone +// used for static nodes and slot nodes because they may be reused across +// multiple renders, cloning them avoids errors when DOM manipulations rely +// on their elm reference. +function cloneVNode (vnode) { + var cloned = new VNode( + vnode.tag, + vnode.data, + // #7975 + // clone children array to avoid mutating original in case of cloning + // a child. + vnode.children && vnode.children.slice(), + vnode.text, + vnode.elm, + vnode.context, + vnode.componentOptions, + vnode.asyncFactory + ); + cloned.ns = vnode.ns; + cloned.isStatic = vnode.isStatic; + cloned.key = vnode.key; + cloned.isComment = vnode.isComment; + cloned.fnContext = vnode.fnContext; + cloned.fnOptions = vnode.fnOptions; + cloned.fnScopeId = vnode.fnScopeId; + cloned.asyncMeta = vnode.asyncMeta; + cloned.isCloned = true; + return cloned +} + +/* + * not type checking this file because flow doesn't play well with + * dynamically accessing methods on Array prototype + */ + +var arrayProto = Array.prototype; +var arrayMethods = Object.create(arrayProto); + +var methodsToPatch = [ + 'push', + 'pop', + 'shift', + 'unshift', + 'splice', + 'sort', + 'reverse' +]; + +/** + * Intercept mutating methods and emit events + */ +methodsToPatch.forEach(function (method) { + // cache original method + var original = arrayProto[method]; + def(arrayMethods, method, function mutator () { + var args = [], len = arguments.length; + while ( len-- ) args[ len ] = arguments[ len ]; + + var result = original.apply(this, args); + var ob = this.__ob__; + var inserted; + switch (method) { + case 'push': + case 'unshift': + inserted = args; + break + case 'splice': + inserted = args.slice(2); + break + } + if (inserted) { ob.observeArray(inserted); } + // notify change + ob.dep.notify(); + return result + }); +}); + +/* */ + +var arrayKeys = Object.getOwnPropertyNames(arrayMethods); + +/** + * In some cases we may want to disable observation inside a component's + * update computation. + */ +var shouldObserve = true; + +function toggleObserving (value) { + shouldObserve = value; +} + +/** + * Observer class that is attached to each observed + * object. Once attached, the observer converts the target + * object's property keys into getter/setters that + * collect dependencies and dispatch updates. + */ +var Observer = function Observer (value) { + this.value = value; + this.dep = new Dep(); + this.vmCount = 0; + def(value, '__ob__', this); + if (Array.isArray(value)) { + if (hasProto) { + protoAugment(value, arrayMethods); + } else { + copyAugment(value, arrayMethods, arrayKeys); + } + this.observeArray(value); + } else { + this.walk(value); + } +}; + +/** + * Walk through all properties and convert them into + * getter/setters. This method should only be called when + * value type is Object. + */ +Observer.prototype.walk = function walk (obj) { + var keys = Object.keys(obj); + for (var i = 0; i < keys.length; i++) { + defineReactive$$1(obj, keys[i]); + } +}; + +/** + * Observe a list of Array items. + */ +Observer.prototype.observeArray = function observeArray (items) { + for (var i = 0, l = items.length; i < l; i++) { + observe(items[i]); + } +}; + +// helpers + +/** + * Augment a target Object or Array by intercepting + * the prototype chain using __proto__ + */ +function protoAugment (target, src) { + /* eslint-disable no-proto */ + target.__proto__ = src; + /* eslint-enable no-proto */ +} + +/** + * Augment a target Object or Array by defining + * hidden properties. + */ +/* istanbul ignore next */ +function copyAugment (target, src, keys) { + for (var i = 0, l = keys.length; i < l; i++) { + var key = keys[i]; + def(target, key, src[key]); + } +} + +/** + * Attempt to create an observer instance for a value, + * returns the new observer if successfully observed, + * or the existing observer if the value already has one. + */ +function observe (value, asRootData) { + if (!isObject(value) || value instanceof VNode) { + return + } + var ob; + if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) { + ob = value.__ob__; + } else if ( + shouldObserve && + !isServerRendering() && + (Array.isArray(value) || isPlainObject(value)) && + Object.isExtensible(value) && + !value._isVue + ) { + ob = new Observer(value); + } + if (asRootData && ob) { + ob.vmCount++; + } + return ob +} + +/** + * Define a reactive property on an Object. + */ +function defineReactive$$1 ( + obj, + key, + val, + customSetter, + shallow +) { + var dep = new Dep(); + + var property = Object.getOwnPropertyDescriptor(obj, key); + if (property && property.configurable === false) { + return + } + + // cater for pre-defined getter/setters + var getter = property && property.get; + var setter = property && property.set; + if ((!getter || setter) && arguments.length === 2) { + val = obj[key]; + } + + var childOb = !shallow && observe(val); + Object.defineProperty(obj, key, { + enumerable: true, + configurable: true, + get: function reactiveGetter () { + var value = getter ? getter.call(obj) : val; + if (Dep.SharedObject.target) { // fixed by xxxxxx + dep.depend(); + if (childOb) { + childOb.dep.depend(); + if (Array.isArray(value)) { + dependArray(value); + } + } + } + return value + }, + set: function reactiveSetter (newVal) { + var value = getter ? getter.call(obj) : val; + /* eslint-disable no-self-compare */ + if (newVal === value || (newVal !== newVal && value !== value)) { + return + } + // #7981: for accessor properties without setter + if (getter && !setter) { return } + if (setter) { + setter.call(obj, newVal); + } else { + val = newVal; + } + childOb = !shallow && observe(newVal); + dep.notify(); + } + }); +} + +/** + * Set a property on an object. Adds the new property and + * triggers change notification if the property doesn't + * already exist. + */ +function set (target, key, val) { + if (Array.isArray(target) && isValidArrayIndex(key)) { + target.length = Math.max(target.length, key); + target.splice(key, 1, val); + return val + } + if (key in target && !(key in Object.prototype)) { + target[key] = val; + return val + } + var ob = (target).__ob__; + if (target._isVue || (ob && ob.vmCount)) { + return val + } + if (!ob) { + target[key] = val; + return val + } + defineReactive$$1(ob.value, key, val); + ob.dep.notify(); + return val +} + +/** + * Delete a property and trigger change if necessary. + */ +function del (target, key) { + if (Array.isArray(target) && isValidArrayIndex(key)) { + target.splice(key, 1); + return + } + var ob = (target).__ob__; + if (target._isVue || (ob && ob.vmCount)) { + return + } + if (!hasOwn(target, key)) { + return + } + delete target[key]; + if (!ob) { + return + } + ob.dep.notify(); +} + +/** + * Collect dependencies on array elements when the array is touched, since + * we cannot intercept array element access like property getters. + */ +function dependArray (value) { + for (var e = (void 0), i = 0, l = value.length; i < l; i++) { + e = value[i]; + e && e.__ob__ && e.__ob__.dep.depend(); + if (Array.isArray(e)) { + dependArray(e); + } + } +} + +/* */ + +/** + * Option overwriting strategies are functions that handle + * how to merge a parent option value and a child option + * value into the final value. + */ +var strats = config.optionMergeStrategies; + +/** + * Helper that recursively merges two data objects together. + */ +function mergeData (to, from) { + if (!from) { return to } + var key, toVal, fromVal; + + var keys = hasSymbol + ? Reflect.ownKeys(from) + : Object.keys(from); + + for (var i = 0; i < keys.length; i++) { + key = keys[i]; + // in case the object is already observed... + if (key === '__ob__') { continue } + toVal = to[key]; + fromVal = from[key]; + if (!hasOwn(to, key)) { + set(to, key, fromVal); + } else if ( + toVal !== fromVal && + isPlainObject(toVal) && + isPlainObject(fromVal) + ) { + mergeData(toVal, fromVal); + } + } + return to +} + +/** + * Data + */ +function mergeDataOrFn ( + parentVal, + childVal, + vm +) { + if (!vm) { + // in a Vue.extend merge, both should be functions + if (!childVal) { + return parentVal + } + if (!parentVal) { + return childVal + } + // when parentVal & childVal are both present, + // we need to return a function that returns the + // merged result of both functions... no need to + // check if parentVal is a function here because + // it has to be a function to pass previous merges. + return function mergedDataFn () { + return mergeData( + typeof childVal === 'function' ? childVal.call(this, this) : childVal, + typeof parentVal === 'function' ? parentVal.call(this, this) : parentVal + ) + } + } else { + return function mergedInstanceDataFn () { + // instance merge + var instanceData = typeof childVal === 'function' + ? childVal.call(vm, vm) + : childVal; + var defaultData = typeof parentVal === 'function' + ? parentVal.call(vm, vm) + : parentVal; + if (instanceData) { + return mergeData(instanceData, defaultData) + } else { + return defaultData + } + } + } +} + +strats.data = function ( + parentVal, + childVal, + vm +) { + if (!vm) { + if (childVal && typeof childVal !== 'function') { + + return parentVal + } + return mergeDataOrFn(parentVal, childVal) + } + + return mergeDataOrFn(parentVal, childVal, vm) +}; + +/** + * Hooks and props are merged as arrays. + */ +function mergeHook ( + parentVal, + childVal +) { + var res = childVal + ? parentVal + ? parentVal.concat(childVal) + : Array.isArray(childVal) + ? childVal + : [childVal] + : parentVal; + return res + ? dedupeHooks(res) + : res +} + +function dedupeHooks (hooks) { + var res = []; + for (var i = 0; i < hooks.length; i++) { + if (res.indexOf(hooks[i]) === -1) { + res.push(hooks[i]); + } + } + return res +} + +LIFECYCLE_HOOKS.forEach(function (hook) { + strats[hook] = mergeHook; +}); + +/** + * Assets + * + * When a vm is present (instance creation), we need to do + * a three-way merge between constructor options, instance + * options and parent options. + */ +function mergeAssets ( + parentVal, + childVal, + vm, + key +) { + var res = Object.create(parentVal || null); + if (childVal) { + return extend(res, childVal) + } else { + return res + } +} + +ASSET_TYPES.forEach(function (type) { + strats[type + 's'] = mergeAssets; +}); + +/** + * Watchers. + * + * Watchers hashes should not overwrite one + * another, so we merge them as arrays. + */ +strats.watch = function ( + parentVal, + childVal, + vm, + key +) { + // work around Firefox's Object.prototype.watch... + if (parentVal === nativeWatch) { parentVal = undefined; } + if (childVal === nativeWatch) { childVal = undefined; } + /* istanbul ignore if */ + if (!childVal) { return Object.create(parentVal || null) } + if (!parentVal) { return childVal } + var ret = {}; + extend(ret, parentVal); + for (var key$1 in childVal) { + var parent = ret[key$1]; + var child = childVal[key$1]; + if (parent && !Array.isArray(parent)) { + parent = [parent]; + } + ret[key$1] = parent + ? parent.concat(child) + : Array.isArray(child) ? child : [child]; + } + return ret +}; + +/** + * Other object hashes. + */ +strats.props = +strats.methods = +strats.inject = +strats.computed = function ( + parentVal, + childVal, + vm, + key +) { + if (childVal && "production" !== 'production') { + assertObjectType(key, childVal, vm); + } + if (!parentVal) { return childVal } + var ret = Object.create(null); + extend(ret, parentVal); + if (childVal) { extend(ret, childVal); } + return ret +}; +strats.provide = mergeDataOrFn; + +/** + * Default strategy. + */ +var defaultStrat = function (parentVal, childVal) { + return childVal === undefined + ? parentVal + : childVal +}; + +/** + * Ensure all props option syntax are normalized into the + * Object-based format. + */ +function normalizeProps (options, vm) { + var props = options.props; + if (!props) { return } + var res = {}; + var i, val, name; + if (Array.isArray(props)) { + i = props.length; + while (i--) { + val = props[i]; + if (typeof val === 'string') { + name = camelize(val); + res[name] = { type: null }; + } + } + } else if (isPlainObject(props)) { + for (var key in props) { + val = props[key]; + name = camelize(key); + res[name] = isPlainObject(val) + ? val + : { type: val }; + } + } + options.props = res; +} + +/** + * Normalize all injections into Object-based format + */ +function normalizeInject (options, vm) { + var inject = options.inject; + if (!inject) { return } + var normalized = options.inject = {}; + if (Array.isArray(inject)) { + for (var i = 0; i < inject.length; i++) { + normalized[inject[i]] = { from: inject[i] }; + } + } else if (isPlainObject(inject)) { + for (var key in inject) { + var val = inject[key]; + normalized[key] = isPlainObject(val) + ? extend({ from: key }, val) + : { from: val }; + } + } +} + +/** + * Normalize raw function directives into object format. + */ +function normalizeDirectives (options) { + var dirs = options.directives; + if (dirs) { + for (var key in dirs) { + var def$$1 = dirs[key]; + if (typeof def$$1 === 'function') { + dirs[key] = { bind: def$$1, update: def$$1 }; + } + } + } +} + +function assertObjectType (name, value, vm) { + if (!isPlainObject(value)) { + warn( + "Invalid value for option \"" + name + "\": expected an Object, " + + "but got " + (toRawType(value)) + ".", + vm + ); + } +} + +/** + * Merge two option objects into a new one. + * Core utility used in both instantiation and inheritance. + */ +function mergeOptions ( + parent, + child, + vm +) { + + if (typeof child === 'function') { + child = child.options; + } + + normalizeProps(child, vm); + normalizeInject(child, vm); + normalizeDirectives(child); + + // Apply extends and mixins on the child options, + // but only if it is a raw options object that isn't + // the result of another mergeOptions call. + // Only merged options has the _base property. + if (!child._base) { + if (child.extends) { + parent = mergeOptions(parent, child.extends, vm); + } + if (child.mixins) { + for (var i = 0, l = child.mixins.length; i < l; i++) { + parent = mergeOptions(parent, child.mixins[i], vm); + } + } + } + + var options = {}; + var key; + for (key in parent) { + mergeField(key); + } + for (key in child) { + if (!hasOwn(parent, key)) { + mergeField(key); + } + } + function mergeField (key) { + var strat = strats[key] || defaultStrat; + options[key] = strat(parent[key], child[key], vm, key); + } + return options +} + +/** + * Resolve an asset. + * This function is used because child instances need access + * to assets defined in its ancestor chain. + */ +function resolveAsset ( + options, + type, + id, + warnMissing +) { + /* istanbul ignore if */ + if (typeof id !== 'string') { + return + } + var assets = options[type]; + // check local registration variations first + if (hasOwn(assets, id)) { return assets[id] } + var camelizedId = camelize(id); + if (hasOwn(assets, camelizedId)) { return assets[camelizedId] } + var PascalCaseId = capitalize(camelizedId); + if (hasOwn(assets, PascalCaseId)) { return assets[PascalCaseId] } + // fallback to prototype chain + var res = assets[id] || assets[camelizedId] || assets[PascalCaseId]; + return res +} + +/* */ + + + +function validateProp ( + key, + propOptions, + propsData, + vm +) { + var prop = propOptions[key]; + var absent = !hasOwn(propsData, key); + var value = propsData[key]; + // boolean casting + var booleanIndex = getTypeIndex(Boolean, prop.type); + if (booleanIndex > -1) { + if (absent && !hasOwn(prop, 'default')) { + value = false; + } else if (value === '' || value === hyphenate(key)) { + // only cast empty string / same name to boolean if + // boolean has higher priority + var stringIndex = getTypeIndex(String, prop.type); + if (stringIndex < 0 || booleanIndex < stringIndex) { + value = true; + } + } + } + // check default value + if (value === undefined) { + value = getPropDefaultValue(vm, prop, key); + // since the default value is a fresh copy, + // make sure to observe it. + var prevShouldObserve = shouldObserve; + toggleObserving(true); + observe(value); + toggleObserving(prevShouldObserve); + } + return value +} + +/** + * Get the default value of a prop. + */ +function getPropDefaultValue (vm, prop, key) { + // no default, return undefined + if (!hasOwn(prop, 'default')) { + return undefined + } + var def = prop.default; + // the raw prop value was also undefined from previous render, + // return previous default value to avoid unnecessary watcher trigger + if (vm && vm.$options.propsData && + vm.$options.propsData[key] === undefined && + vm._props[key] !== undefined + ) { + return vm._props[key] + } + // call factory function for non-Function types + // a value is Function if its prototype is function even across different execution context + return typeof def === 'function' && getType(prop.type) !== 'Function' + ? def.call(vm) + : def +} + +/** + * Use function string name to check built-in types, + * because a simple equality check will fail when running + * across different vms / iframes. + */ +function getType (fn) { + var match = fn && fn.toString().match(/^\s*function (\w+)/); + return match ? match[1] : '' +} + +function isSameType (a, b) { + return getType(a) === getType(b) +} + +function getTypeIndex (type, expectedTypes) { + if (!Array.isArray(expectedTypes)) { + return isSameType(expectedTypes, type) ? 0 : -1 + } + for (var i = 0, len = expectedTypes.length; i < len; i++) { + if (isSameType(expectedTypes[i], type)) { + return i + } + } + return -1 +} + +/* */ + +function handleError (err, vm, info) { + // Deactivate deps tracking while processing error handler to avoid possible infinite rendering. + // See: https://github.com/vuejs/vuex/issues/1505 + pushTarget(); + try { + if (vm) { + var cur = vm; + while ((cur = cur.$parent)) { + var hooks = cur.$options.errorCaptured; + if (hooks) { + for (var i = 0; i < hooks.length; i++) { + try { + var capture = hooks[i].call(cur, err, vm, info) === false; + if (capture) { return } + } catch (e) { + globalHandleError(e, cur, 'errorCaptured hook'); + } + } + } + } + } + globalHandleError(err, vm, info); + } finally { + popTarget(); + } +} + +function invokeWithErrorHandling ( + handler, + context, + args, + vm, + info +) { + var res; + try { + res = args ? handler.apply(context, args) : handler.call(context); + if (res && !res._isVue && isPromise(res) && !res._handled) { + res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); }); + // issue #9511 + // avoid catch triggering multiple times when nested calls + res._handled = true; + } + } catch (e) { + handleError(e, vm, info); + } + return res +} + +function globalHandleError (err, vm, info) { + if (config.errorHandler) { + try { + return config.errorHandler.call(null, err, vm, info) + } catch (e) { + // if the user intentionally throws the original error in the handler, + // do not log it twice + if (e !== err) { + logError(e, null, 'config.errorHandler'); + } + } + } + logError(err, vm, info); +} + +function logError (err, vm, info) { + /* istanbul ignore else */ + if ((inBrowser || inWeex) && typeof console !== 'undefined') { + console.error(err); + } else { + throw err + } +} + +/* */ + +var callbacks = []; +var pending = false; + +function flushCallbacks () { + pending = false; + var copies = callbacks.slice(0); + callbacks.length = 0; + for (var i = 0; i < copies.length; i++) { + copies[i](); + } +} + +// Here we have async deferring wrappers using microtasks. +// In 2.5 we used (macro) tasks (in combination with microtasks). +// However, it has subtle problems when state is changed right before repaint +// (e.g. #6813, out-in transitions). +// Also, using (macro) tasks in event handler would cause some weird behaviors +// that cannot be circumvented (e.g. #7109, #7153, #7546, #7834, #8109). +// So we now use microtasks everywhere, again. +// A major drawback of this tradeoff is that there are some scenarios +// where microtasks have too high a priority and fire in between supposedly +// sequential events (e.g. #4521, #6690, which have workarounds) +// or even between bubbling of the same event (#6566). +// fixed by xxxxxx app-plus 平台 Promise 执行顺序不一致,导致各种乱七八糟的 Bug,统一使用 setTimeout +var timerFunc = function () { + setTimeout(flushCallbacks, 0); +}; + +// The nextTick behavior leverages the microtask queue, which can be accessed +// via either native Promise.then or MutationObserver. +// MutationObserver has wider support, however it is seriously bugged in +// UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It +// completely stops working after triggering a few times... so, if native +// Promise is available, we will use it: +/* istanbul ignore next, $flow-disable-line */ +// if (typeof Promise !== 'undefined' && isNative(Promise)) { +// const p = Promise.resolve() +// timerFunc = () => { +// p.then(flushCallbacks) +// // In problematic UIWebViews, Promise.then doesn't completely break, but +// // it can get stuck in a weird state where callbacks are pushed into the +// // microtask queue but the queue isn't being flushed, until the browser +// // needs to do some other work, e.g. handle a timer. Therefore we can +// // "force" the microtask queue to be flushed by adding an empty timer. +// if (isIOS) setTimeout(noop) +// } +// isUsingMicroTask = true +// } else if (!isIE && typeof MutationObserver !== 'undefined' && ( +// isNative(MutationObserver) || +// // PhantomJS and iOS 7.x +// MutationObserver.toString() === '[object MutationObserverConstructor]' +// )) { +// // Use MutationObserver where native Promise is not available, +// // e.g. PhantomJS, iOS7, Android 4.4 +// // (#6466 MutationObserver is unreliable in IE11) +// let counter = 1 +// const observer = new MutationObserver(flushCallbacks) +// const textNode = document.createTextNode(String(counter)) +// observer.observe(textNode, { +// characterData: true +// }) +// timerFunc = () => { +// counter = (counter + 1) % 2 +// textNode.data = String(counter) +// } +// isUsingMicroTask = true +// } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) { +// // Fallback to setImmediate. +// // Technically it leverages the (macro) task queue, +// // but it is still a better choice than setTimeout. +// timerFunc = () => { +// setImmediate(flushCallbacks) +// } +// } else { +// // Fallback to setTimeout. +// timerFunc = () => { +// setTimeout(flushCallbacks, 0) +// } +// } + +function nextTick (cb, ctx) { + var _resolve; + callbacks.push(function () { + if (cb) { + try { + cb.call(ctx); + } catch (e) { + handleError(e, ctx, 'nextTick'); + } + } else if (_resolve) { + _resolve(ctx); + } + }); + if (!pending) { + pending = true; + timerFunc(); + } + // $flow-disable-line + if (!cb && typeof Promise !== 'undefined') { + return new Promise(function (resolve) { + _resolve = resolve; + }) + } +} + +/* */ + +/* not type checking this file because flow doesn't play well with Proxy */ + +/* */ + +var seenObjects = new _Set(); + +/** + * Recursively traverse an object to evoke all converted + * getters, so that every nested property inside the object + * is collected as a "deep" dependency. + */ +function traverse (val) { + _traverse(val, seenObjects); + seenObjects.clear(); +} + +function _traverse (val, seen) { + var i, keys; + var isA = Array.isArray(val); + if ((!isA && !isObject(val)) || Object.isFrozen(val) || val instanceof VNode) { + return + } + if (val.__ob__) { + var depId = val.__ob__.dep.id; + if (seen.has(depId)) { + return + } + seen.add(depId); + } + if (isA) { + i = val.length; + while (i--) { _traverse(val[i], seen); } + } else { + keys = Object.keys(val); + i = keys.length; + while (i--) { _traverse(val[keys[i]], seen); } + } +} + +/* */ + +var normalizeEvent = cached(function (name) { + var passive = name.charAt(0) === '&'; + name = passive ? name.slice(1) : name; + var once$$1 = name.charAt(0) === '~'; // Prefixed last, checked first + name = once$$1 ? name.slice(1) : name; + var capture = name.charAt(0) === '!'; + name = capture ? name.slice(1) : name; + return { + name: name, + once: once$$1, + capture: capture, + passive: passive + } +}); + +function createFnInvoker (fns, vm) { + function invoker () { + var arguments$1 = arguments; + + var fns = invoker.fns; + if (Array.isArray(fns)) { + var cloned = fns.slice(); + for (var i = 0; i < cloned.length; i++) { + invokeWithErrorHandling(cloned[i], null, arguments$1, vm, "v-on handler"); + } + } else { + // return handler return value for single handlers + return invokeWithErrorHandling(fns, null, arguments, vm, "v-on handler") + } + } + invoker.fns = fns; + return invoker +} + +function updateListeners ( + on, + oldOn, + add, + remove$$1, + createOnceHandler, + vm +) { + var name, def$$1, cur, old, event; + for (name in on) { + def$$1 = cur = on[name]; + old = oldOn[name]; + event = normalizeEvent(name); + if (isUndef(cur)) ; else if (isUndef(old)) { + if (isUndef(cur.fns)) { + cur = on[name] = createFnInvoker(cur, vm); + } + if (isTrue(event.once)) { + cur = on[name] = createOnceHandler(event.name, cur, event.capture); + } + add(event.name, cur, event.capture, event.passive, event.params); + } else if (cur !== old) { + old.fns = cur; + on[name] = old; + } + } + for (name in oldOn) { + if (isUndef(on[name])) { + event = normalizeEvent(name); + remove$$1(event.name, oldOn[name], event.capture); + } + } +} + +/* */ + +function mergeVNodeHook (def, hookKey, hook) { + if (def instanceof VNode) { + def = def.data.hook || (def.data.hook = {}); + } + var invoker; + var oldHook = def[hookKey]; + + function wrappedHook () { + hook.apply(this, arguments); + // important: remove merged hook to ensure it's called only once + // and prevent memory leak + remove(invoker.fns, wrappedHook); + } + + if (isUndef(oldHook)) { + // no existing hook + invoker = createFnInvoker([wrappedHook]); + } else { + /* istanbul ignore if */ + if (isDef(oldHook.fns) && isTrue(oldHook.merged)) { + // already a merged invoker + invoker = oldHook; + invoker.fns.push(wrappedHook); + } else { + // existing plain hook + invoker = createFnInvoker([oldHook, wrappedHook]); + } + } + + invoker.merged = true; + def[hookKey] = invoker; +} + +/* */ + +// fixed by xxxxxx (mp properties) +function extractPropertiesFromVNodeData(data, Ctor, res, context) { + var propOptions = Ctor.options.mpOptions && Ctor.options.mpOptions.properties; + if (isUndef(propOptions)) { + return res + } + var externalClasses = Ctor.options.mpOptions.externalClasses || []; + var attrs = data.attrs; + var props = data.props; + if (isDef(attrs) || isDef(props)) { + for (var key in propOptions) { + var altKey = hyphenate(key); + var result = checkProp(res, props, key, altKey, true) || + checkProp(res, attrs, key, altKey, false); + // externalClass + if ( + result && + res[key] && + externalClasses.indexOf(altKey) !== -1 && + context[camelize(res[key])] + ) { + // 赋值 externalClass 真正的值(模板里 externalClass 的值可能是字符串) + res[key] = context[camelize(res[key])]; + } + } + } + return res +} + +function extractPropsFromVNodeData ( + data, + Ctor, + tag, + context// fixed by xxxxxx +) { + // we are only extracting raw values here. + // validation and default values are handled in the child + // component itself. + var propOptions = Ctor.options.props; + if (isUndef(propOptions)) { + // fixed by xxxxxx + return extractPropertiesFromVNodeData(data, Ctor, {}, context) + } + var res = {}; + var attrs = data.attrs; + var props = data.props; + if (isDef(attrs) || isDef(props)) { + for (var key in propOptions) { + var altKey = hyphenate(key); + checkProp(res, props, key, altKey, true) || + checkProp(res, attrs, key, altKey, false); + } + } + // fixed by xxxxxx + return extractPropertiesFromVNodeData(data, Ctor, res, context) +} + +function checkProp ( + res, + hash, + key, + altKey, + preserve +) { + if (isDef(hash)) { + if (hasOwn(hash, key)) { + res[key] = hash[key]; + if (!preserve) { + delete hash[key]; + } + return true + } else if (hasOwn(hash, altKey)) { + res[key] = hash[altKey]; + if (!preserve) { + delete hash[altKey]; + } + return true + } + } + return false +} + +/* */ + +// The template compiler attempts to minimize the need for normalization by +// statically analyzing the template at compile time. +// +// For plain HTML markup, normalization can be completely skipped because the +// generated render function is guaranteed to return Array. There are +// two cases where extra normalization is needed: + +// 1. When the children contains components - because a functional component +// may return an Array instead of a single root. In this case, just a simple +// normalization is needed - if any child is an Array, we flatten the whole +// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep +// because functional components already normalize their own children. +function simpleNormalizeChildren (children) { + for (var i = 0; i < children.length; i++) { + if (Array.isArray(children[i])) { + return Array.prototype.concat.apply([], children) + } + } + return children +} + +// 2. When the children contains constructs that always generated nested Arrays, +// e.g.