1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2024-12-12 11:26:17 +01:00
LocalCDN-Firefox-Chrome-Brave/resources/vuex/4.0.2/vuex.min.jsm

1 line
21 KiB
JavaScript
Raw Normal View History

2021-06-25 06:33:02 +02:00
"use strict";var vue=require("vue"),devtoolsApi=require("@vue/devtools-api"),storeKey="store";function useStore(t){return vue.inject(null!==(t=void 0===t?null:t)?t:storeKey)}function find(t,e){return t.filter(e)[0]}function deepCopy(e,o){if(void 0===o&&(o=[]),null===e||"object"!=typeof e)return e;var t=find(o,function(t){return t.original===e});if(t)return t.copy;var r=Array.isArray(e)?[]:{};return o.push({original:e,copy:r}),Object.keys(e).forEach(function(t){r[t]=deepCopy(e[t],o)}),r}function forEachValue(e,o){Object.keys(e).forEach(function(t){return o(e[t],t)})}function isObject(t){return null!==t&&"object"==typeof t}function isPromise(t){return t&&"function"==typeof t.then}function assert(t,e){if(!t)throw new Error("[vuex] "+e)}function partial(t,e){return function(){return t(e)}}function genericSubscribe(e,o,t){return o.indexOf(e)<0&&(t&&t.prepend?o.unshift(e):o.push(e)),function(){var t=o.indexOf(e);-1<t&&o.splice(t,1)}}function resetStore(t,e){t._actions=Object.create(null),t._mutations=Object.create(null),t._wrappedGetters=Object.create(null),t._modulesNamespaceMap=Object.create(null);var o=t.state;installModule(t,o,[],t._modules.root,!0),resetStoreState(t,o,e)}function resetStoreState(o,t,e){var r=o._state;o.getters={},o._makeLocalGettersCache=Object.create(null);var n=o._wrappedGetters,i={};forEachValue(n,function(t,e){i[e]=partial(t,o),Object.defineProperty(o.getters,e,{get:function(){return i[e]()},enumerable:!0})}),o._state=vue.reactive({data:t}),o.strict&&enableStrictMode(o),r&&e&&o._withCommit(function(){r.data=null})}function installModule(o,r,n,t,i){var e,a,s=!n.length,c=o._modules.getNamespace(n);t.namespaced&&(o._modulesNamespaceMap[c]&&"production"!==process.env.NODE_ENV&&console.error("[vuex] duplicate namespace "+c+" for the namespaced module "+n.join("/")),o._modulesNamespaceMap[c]=t),s||i||(e=getNestedState(r,n.slice(0,-1)),a=n[n.length-1],o._withCommit(function(){"production"!==process.env.NODE_ENV&&a in e&&console.warn('[vuex] state field "'+a+'" was overridden by a module with the same name at "'+n.join(".")+'"'),e[a]=t.state}));var u=t.context=makeLocalContext(o,c,n);t.forEachMutation(function(t,e){registerMutation(o,c+e,t,u)}),t.forEachAction(function(t,e){e=t.root?e:c+e,t=t.handler||t;registerAction(o,e,t,u)}),t.forEachGetter(function(t,e){registerGetter(o,c+e,t,u)}),t.forEachChild(function(t,e){installModule(o,r,n.concat(e),t,i)})}function makeLocalContext(n,i,t){var e=""===i,o={dispatch:e?n.dispatch:function(t,e,o){var r=unifyObjectStyle(t,e,o),t=r.payload,e=r.options,o=r.type;if(e&&e.root||(o=i+o,"production"===process.env.NODE_ENV||n._actions[o]))return n.dispatch(o,t);console.error("[vuex] unknown local action type: "+r.type+", global type: "+o)},commit:e?n.commit:function(t,e,o){var r=unifyObjectStyle(t,e,o),t=r.payload,e=r.options,o=r.type;e&&e.root||(o=i+o,"production"===process.env.NODE_ENV||n._mutations[o])?n.commit(o,t,e):console.error("[vuex] unknown local mutation type: "+r.type+", global type: "+o)}};return Object.defineProperties(o,{getters:{get:e?function(){return n.getters}:function(){return makeLocalGetters(n,i)}},state:{get:function(){return getNestedState(n.state,t)}}}),o}function makeLocalGetters(o,r){var n,i;return o._makeLocalGettersCache[r]||(n={},i=r.length,Object.keys(o.getters).forEach(function(t){var e;t.slice(0,i)===r&&(e=t.slice(i),Object.defineProperty(n,e,{get:function(){return o.getters[t]},enumerable:!0}))}),o._makeLocalGettersCache[r]=n),o._makeLocalGettersCache[r]}function registerMutation(e,t,o,r){(e._mutations[t]||(e._mutations[t]=[])).push(function(t){o.call(e,r.state,t)})}function registerAction(e,t,o,r){(e._actions[t]||(e._actions[t]=[])).push(function(t){t=o.call(e,{dispatch:r.dispatch,commit:r.commit,getters:r.getters,state:r.state,rootGetters:e.getters,rootState:e.state},t);return isPromise(t)||(t=Promise.resolve(t)),e._devtoolHook?t.catch(function(t){throw e._devtoolHook.emit("vuex:error",t),t}):t})}function registerGetter(t,e,o,r){t._wrappedGetters[e]?"production"!==process.env.NODE_ENV&&console.error("[vuex] duplicate getter key: "+e):t._wrapp