Greasy Fork is available in English.

Redux-persist

Redux-persist bundled

Ezt a szkriptet nem ajánlott közvetlenül telepíteni. Ez egy könyvtár más szkriptek számára, amik tartalmazzák a // @require https://update.greasyfork.org/scripts/396830/775084/Redux-persist.js hivatkozást.

// ==UserScript==
// @name         Redux-persist
// @namespace    eisen-stein
// @version      1.0.0
// @description  Redux-persist bundled
// ==/UserScript==

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["redux-persist"]=t():e["redux-persist"]=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}([function(e,t,r){"use strict";(function(e,n){var o,i=r(1);o="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:n;var u=Object(i.a)(o);t.a=u}).call(this,r(2),r(3)(e))},function(e,t,r){"use strict";function n(e){var t,r=e.Symbol;return"function"==typeof r?r.observable?t=r.observable:(t=r("observable"),r.observable=t):t="@@observable",t}r.d(t,"a",(function(){return n}))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t,r){"use strict";r.r(t);var n="persist/FLUSH",o="persist/REHYDRATE",i="persist/PAUSE",u="persist/PERSIST",c="persist/PURGE",s="persist/REGISTER";function f(e){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t,r,n){n.debug;var o=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(r,!0).forEach((function(t){l(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(r).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},r);return e&&"object"===f(e)&&Object.keys(e).forEach((function(n){"_persist"!==n&&t[n]===r[n]&&(o[n]=e[n])})),o}function d(e){var t,r=e.blacklist||null,n=e.whitelist||null,o=e.transforms||[],i=e.throttle||0,u="".concat(void 0!==e.keyPrefix?e.keyPrefix:"persist:").concat(e.key),c=e.storage;t=!1===e.serialize?function(e){return e}:"function"==typeof e.serialize?e.serialize:y;var s=e.writeFailHandler||null,f={},a={},l=[],p=null,d=null;function b(){if(0===l.length)return p&&clearInterval(p),void(p=null);var e=l.shift(),r=o.reduce((function(t,r){return r.in(t,e,f)}),f[e]);if(void 0!==r)try{a[e]=t(r)}catch(e){console.error("redux-persist/createPersistoid: error serializing state",e)}else delete a[e];0===l.length&&(Object.keys(a).forEach((function(e){void 0===f[e]&&delete a[e]})),d=c.setItem(u,t(a)).catch(v))}function h(e){return(!n||-1!==n.indexOf(e)||"_persist"===e)&&(!r||-1===r.indexOf(e))}function v(e){s&&s(e)}return{update:function(e){Object.keys(e).forEach((function(t){h(t)&&f[t]!==e[t]&&-1===l.indexOf(t)&&l.push(t)})),Object.keys(f).forEach((function(t){void 0===e[t]&&h(t)&&-1===l.indexOf(t)&&void 0!==f[t]&&l.push(t)})),null===p&&(p=setInterval(b,i)),f=e},flush:function(){for(;0!==l.length;)b();return d||Promise.resolve()}}}function y(e){return JSON.stringify(e)}function b(e){var t,r=e.transforms||[],n="".concat(void 0!==e.keyPrefix?e.keyPrefix:"persist:").concat(e.key),o=e.storage;e.debug;return t=!1===e.deserialize?function(e){return e}:"function"==typeof e.deserialize?e.deserialize:h,o.getItem(n).then((function(e){if(e)try{var n={},o=t(e);return Object.keys(o).forEach((function(e){n[e]=r.reduceRight((function(t,r){return r.out(t,e,o)}),t(o[e]))})),n}catch(e){throw e}}))}function h(e){return JSON.parse(e)}function v(e){var t=e.storage,r="".concat(void 0!==e.keyPrefix?e.keyPrefix:"persist:").concat(e.key);return t.removeItem(r,O)}function O(e){0}function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?g(r,!0).forEach((function(t){w(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g(r).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function w(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function P(e,t){var r=void 0!==e.version?e.version:-1,s=(e.debug,void 0===e.stateReconciler?p:e.stateReconciler),f=e.getStoredState||b,a=void 0!==e.timeout?e.timeout:5e3,l=null,y=!1,h=!0,O=function(e){return e._persist.rehydrated&&l&&!h&&l.update(e),e};return function(p,b){var g=p||{},w=g._persist,P=j(g,["_persist"]);if(b.type===u){var E=!1,S=function(t,r){E||(b.rehydrate(e.key,t,r),E=!0)};if(a&&setTimeout((function(){!E&&S(void 0,new Error('redux-persist: persist timed out for persist key "'.concat(e.key,'"')))}),a),h=!1,l||(l=d(e)),w)return m({},t(P,b),{_persist:w});if("function"!=typeof b.rehydrate||"function"!=typeof b.register)throw new Error("redux-persist: either rehydrate or register is not a function on the PERSIST action. This can happen if the action is being replayed. This is an unexplored use case, please open an issue and we will figure out a resolution.");return b.register(e.key),f(e).then((function(t){(e.migrate||function(e,t){return Promise.resolve(e)})(t,r).then((function(e){S(e)}),(function(e){S(void 0,e)}))}),(function(e){S(void 0,e)})),m({},t(P,b),{_persist:{version:r,rehydrated:!1}})}if(b.type===c)return y=!0,b.result(v(e)),m({},t(P,b),{_persist:w});if(b.type===n)return b.result(l&&l.flush()),m({},t(P,b),{_persist:w});if(b.type===i)h=!0;else if(b.type===o){if(y)return m({},P,{_persist:m({},w,{rehydrated:!0})});if(b.key===e.key){var x=t(P,b),k=b.payload,I=m({},!1!==s&&void 0!==k?s(k,p,x,e):x,{_persist:m({},w,{rehydrated:!0})});return O(I)}}if(!w)return t(p,b);var R=t(P,b);return R===P?p:O(m({},R,{_persist:w}))}}var E=r(0),S=function(){return Math.random().toString(36).substring(7).split("").join(".")},x={INIT:"@@redux/INIT"+S(),REPLACE:"@@redux/REPLACE"+S(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+S()}};function k(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function I(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error("Expected the enhancer to be a function.");return r(I)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var o=e,i=t,u=[],c=u,s=!1;function f(){c===u&&(c=u.slice())}function a(){if(s)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return i}function l(e){if("function"!=typeof e)throw new Error("Expected the listener to be a function.");if(s)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribelistener for more details.");var t=!0;return f(),c.push(e),function(){if(t){if(s)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribelistener for more details.");t=!1,f();var r=c.indexOf(e);c.splice(r,1),u=null}}}function p(e){if(!k(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(s)throw new Error("Reducers may not dispatch actions.");try{s=!0,i=o(i,e)}finally{s=!1}for(var t=u=c,r=0;r<t.length;r++){(0,t[r])()}return e}function d(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");o=e,p({type:x.REPLACE})}function y(){var e,t=l;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new TypeError("Expected the observer to be an object.");function r(){e.next&&e.next(a())}return r(),{unsubscribe:t(r)}}})[E.a]=function(){return this},e}return p({type:x.INIT}),(n={dispatch:p,subscribe:l,getState:a,replaceReducer:d})[E.a]=y,n}function R(e,t){var r=t&&t.type;return"Given "+(r&&'action "'+String(r)+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function T(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++){var o=t[n];0,"function"==typeof e[o]&&(r[o]=e[o])}var i,u=Object.keys(r);try{!function(e){Object.keys(e).forEach((function(t){var r=e[t];if(void 0===r(void 0,{type:x.INIT}))throw new Error('Reducer "'+t+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===r(void 0,{type:x.PROBE_UNKNOWN_ACTION()}))throw new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+x.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')}))}(r)}catch(e){i=e}return function(e,t){if(void 0===e&&(e={}),i)throw i;for(var n=!1,o={},c=0;c<u.length;c++){var s=u[c],f=r[s],a=e[s],l=f(a,t);if(void 0===l){var p=R(s,t);throw new Error(p)}o[s]=l,n=n||l!==a}return(n=n||u.length!==Object.keys(e).length)?o:e}}function _(e){return(_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function A(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function D(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?A(r,!0).forEach((function(t){N(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A(r).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function N(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function U(e,t,r,n){n.debug;var o=D({},r);return e&&"object"===_(e)&&Object.keys(e).forEach((function(n){var i;"_persist"!==n&&(t[n]===r[n]&&(null===(i=r[n])||Array.isArray(i)||"object"!==_(i)?o[n]=e[n]:o[n]=D({},o[n],{},e[n])))})),o}function z(e,t){return e.stateReconciler=void 0===e.stateReconciler?U:e.stateReconciler,P(e,T(t))}function C(e){return function(e){if(Array.isArray(e)){for(var t=0,r=new Array(e.length);t<e.length;t++)r[t]=e[t];return r}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function F(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function H(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?F(r,!0).forEach((function(t){L(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):F(r).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function L(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var M={registry:[],bootstrapped:!1},Y=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:M,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case s:return H({},e,{registry:[].concat(C(e.registry),[t.key])});case o:var r=e.registry.indexOf(t.key),n=C(e.registry);return n.splice(r,1),H({},e,{registry:n,bootstrapped:0===n.length});default:return e}};function G(e,t,r){var f=r||!1,a=I(Y,M,t&&t.enhancer?t.enhancer:void 0),l=function(e){a.dispatch({type:s,key:e})},p=function(t,r,n){var i={type:o,payload:r,err:n,key:t};e.dispatch(i),a.dispatch(i),f&&d.getState().bootstrapped&&(f(),f=!1)},d=H({},a,{purge:function(){var t=[];return e.dispatch({type:c,result:function(e){t.push(e)}}),Promise.all(t)},flush:function(){var t=[];return e.dispatch({type:n,result:function(e){t.push(e)}}),Promise.all(t)},pause:function(){e.dispatch({type:i})},persist:function(){e.dispatch({type:u,register:l,rehydrate:p})}});return t&&t.manualPersist||d.persist(),d}function K(e,t){(t||{}).debug;return function(t,r){if(!t)return Promise.resolve(void 0);var n=t._persist&&void 0!==t._persist.version?t._persist.version:-1;if(n===r)return Promise.resolve(t);if(n>r)return Promise.resolve(t);var o=Object.keys(e).map((function(e){return parseInt(e)})).filter((function(e){return r>=e&&e>n})).sort((function(e,t){return e-t}));try{var i=o.reduce((function(t,r){return e[r](t)}),t);return Promise.resolve(i)}catch(e){return Promise.reject(e)}}}function B(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.whitelist||null,o=r.blacklist||null;function i(e){return!(!n||-1!==n.indexOf(e))||!(!o||-1===o.indexOf(e))}return{in:function(t,r,n){return!i(r)&&e?e(t,r,n):t},out:function(e,r,n){return!i(r)&&t?t(e,r,n):e}}}r.d(t,"persistReducer",(function(){return P})),r.d(t,"persistCombineReducers",(function(){return z})),r.d(t,"persistStore",(function(){return G})),r.d(t,"createMigrate",(function(){return K})),r.d(t,"createTransform",(function(){return B})),r.d(t,"getStoredState",(function(){return b})),r.d(t,"createPersistoid",(function(){return d})),r.d(t,"purgeStoredState",(function(){return v})),r.d(t,"KEY_PREFIX",(function(){return"persist:"})),r.d(t,"FLUSH",(function(){return n})),r.d(t,"REHYDRATE",(function(){return o})),r.d(t,"PAUSE",(function(){return i})),r.d(t,"PERSIST",(function(){return u})),r.d(t,"PURGE",(function(){return c})),r.d(t,"REGISTER",(function(){return s})),r.d(t,"DEFAULT_VERSION",(function(){return-1}))}])}));