/*! * Vuex v1.0.0-rc.2 * (c) 2016 Evan You * Released under the MIT License. */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Vuex=e()}(this,function(){"use strict";function t(t){return t.reduce(function(t,e){return Object.keys(e).forEach(function(n){var o=t[n];o?Array.isArray(o)?t[n]=o.concat(e[n]):t[n]=[o].concat(e[n]):t[n]=e[n]}),t},{})}function e(t){return null!==t&&"object"===("undefined"==typeof t?"undefined":s(t))}function n(t,e){return e.reduce(function(t,e){return t[e]},t)}function o(t){if(!d){var e=function(){},n=t.$watch(e,e);d=t._watchers[0].constructor,n()}return d}function i(t){return v||(v=t._data.__ob__.dep.constructor),v}function r(t){h&&(h.emit("vuex:init",t),h.on("vuex:travel-to-state",function(e){t.replaceState(e)}),t.subscribe(function(t,e){h.emit("vuex:mutation",t,e)}))}function u(t){function e(){var t=this.$options,e=t.store,n=t.vuex;if(e?this.$store=e:t.parent&&t.parent.$store&&(this.$store=t.parent.$store),n){this.$store||console.warn("[vuex] store not injected. make sure to provide the store option in your root component.");var o=n.state,i=n.actions,u=n.getters;if(o&&!u&&(console.warn("[vuex] vuex.state option will been deprecated in 1.0. Use vuex.getters instead."),u=o),u){t.computed=t.computed||{};for(var s in u)r(this,s,u[s])}if(i){t.methods=t.methods||{};for(var c in i)t.methods[c]=a(this.$store,i[c],c)}}}function n(){throw new Error("vuex getter properties are read-only.")}function r(t,e,o){"function"!=typeof o?console.warn("[vuex] Getter bound to key 'vuex.getters."+e+"' is not a function."):Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:u(t.$store,o),set:n})}function u(t,e){var n=t._getterCacheId;if(e[n])return e[n];var r=t._vm,u=o(r),a=i(r),s=new u(r,function(t){return e(t.state)},null,{lazy:!0}),c=function(){return s.dirty&&s.evaluate(),a.target&&s.depend(),s.value};return e[n]=c,c}function a(t,e,n){return"function"!=typeof e&&console.warn("[vuex] Action bound to key 'vuex.actions."+n+"' is not a function."),function(){for(var n=arguments.length,o=Array(n),i=0;i=2){var c=t.config._lifecycleHooks.indexOf("init")>-1;t.mixin(c?{init:e}:{beforeCreate:e})}else!function(){var n=t.prototype._init;t.prototype._init=function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];t.init=t.init?[e].concat(t.init):e,n.call(this,t)}}();var f=t.config.optionMergeStrategies.computed;t.config.optionMergeStrategies.vuex=function(t,e){return t?e?{getters:f(t.getters,e.getters),state:f(t.state,e.state),actions:f(t.actions,e.actions)}:t:e}}function a(t){return p?void console.warn("[vuex] already installed. Vue.use(Vuex) should be called only once."):(p=t,void u(p))}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},c=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},f=function(){function t(t,e){for(var n=0;n1?n-1:0),i=1;i-1&&e.splice(n,1)}}},{key:"hotUpdate",value:function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],e=t.mutations,n=t.modules;this._rootMutations=this._mutations=e||this._rootMutations,this._setupModuleMutations(n||this._modules)}},{key:"_setupModuleState",value:function(t,n){var o=this;e(n)&&Object.keys(n).forEach(function(e){var i=n[e];p.set(t,e,i.state||{}),o._setupModuleState(t[e],i.modules)})}},{key:"_setupModuleMutations",value:function(e){var n=this._modules;Object.keys(e).forEach(function(t){n[t]=e[t]});var o=this._createModuleMutations(n,[]);this._mutations=t([this._rootMutations].concat(l(o)))}},{key:"_createModuleMutations",value:function(o,i){var r=this;return e(o)?Object.keys(o).map(function(e){var u=o[e],a=i.concat(e),s=r._createModuleMutations(u.modules,a);if(!u||!u.mutations)return t(s);var c={};return Object.keys(u.mutations).forEach(function(t){var e=u.mutations[t];c[t]=function(t){for(var o=arguments.length,i=Array(o>1?o-1:0),r=1;r