react-global-state-hooks 4.3.2 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -280,9 +280,15 @@ const initialState = {
280
280
 
281
281
  type State = typeof initialState;
282
282
 
283
- export const useContacts = createGlobalState(initialState, {
284
- // this are the actions available for this state
285
- actions: {
283
+ export const useContacts = createGlobalState(
284
+ initialState,
285
+ {
286
+ // this are the actions available for this state
287
+ onInit: async ({ setState }: StoreTools<State>) => {
288
+ // fetch contacts
289
+ },
290
+ },
291
+ {
286
292
  setFilter(filter: string) {
287
293
  return ({ setState }: StoreTools<State>) => {
288
294
  setState((state) => ({
@@ -291,11 +297,8 @@ export const useContacts = createGlobalState(initialState, {
291
297
  }));
292
298
  };
293
299
  },
294
- } as const,
295
- onInit: async ({ setState }: StoreTools<State>) => {
296
- // fetch contacts
297
- },
298
- });
300
+ }
301
+ );
299
302
  ```
300
303
 
301
304
  That's it! In this updated version, the **useContacts** hook will no longer return [**state**, **stateMutator**] but instead will return [**state**, **actions**]. This change will provide a more intuitive and convenient way to access and interact with the state and its associated actions.
@@ -377,8 +380,7 @@ Here's an example of adding multiple actions to the state and utilizing one acti
377
380
  ```ts
378
381
  import { createGlobalState } from 'react-hooks-global-states';
379
382
 
380
- export const useCount = createGlobalState(0, {
381
- actions: {
383
+ export const useCount = createGlobalState(0, () => ({{
382
384
  log: (currentValue: string) => {
383
385
  return ({ getState }: StoreTools<number>): void => {
384
386
  console.log(`Current Value: ${getState()}`);
@@ -400,8 +402,7 @@ export const useCount = createGlobalState(0, {
400
402
  actions.log(message);
401
403
  };
402
404
  },
403
- } as const,
404
- });
405
+ }}));
405
406
  ```
406
407
 
407
408
  Notice that the **StoreTools** will contain a reference to the generated actions API. From there, you'll be able to access all actions from inside another one... the **StoreTools** is generic and allow your to set an interface for getting the typing on the actions.
@@ -489,30 +490,28 @@ const initialState: CounterState = {
489
490
 
490
491
  export const [useCounterContext, CounterProvider] = createStatefulContext(
491
492
  initialState,
492
- {
493
- actions: {
494
- increase: (value: number = 1) => {
495
- return ({ setState }: StoreTools<CounterState>) => {
496
- setState((state) => ({
497
- ...state,
498
- count: state.count + value,
499
- }));
500
- };
501
- },
502
- decrease: (value: number = 1) => {
503
- return ({ setState }: StoreTools<CounterState>) => {
504
- setState((state) => ({
505
- ...state,
506
- count: state.count - value,
507
- }));
508
- };
509
- },
510
- } as const,
511
- }
493
+ () => ({
494
+ increase: (value: number = 1) => {
495
+ return ({ setState }: StoreTools<CounterState>) => {
496
+ setState((state) => ({
497
+ ...state,
498
+ count: state.count + value,
499
+ }));
500
+ };
501
+ },
502
+ decrease: (value: number = 1) => {
503
+ return ({ setState }: StoreTools<CounterState>) => {
504
+ setState((state) => ({
505
+ ...state,
506
+ count: state.count - value,
507
+ }));
508
+ };
509
+ },
510
+ })
512
511
  );
513
512
  ```
514
513
 
515
- And just like with regular global hooks, now instead of a setState function, the hook will return the collection of actions:
514
+ And just like with regular global hooks, now instead of a setState function, the hook will return the collection of actions
516
515
 
517
516
  ```tsx
518
517
  const MyComponent = () => {
@@ -991,7 +990,7 @@ const storage = new GlobalStore(0, {
991
990
  },
992
991
  });
993
992
 
994
- const [getState, _, getMetadata] = storage.getHookDecoupled();
993
+ const [getState, _, getMetadata] = storage.stateControls();
995
994
  const useState = storage.getHook();
996
995
  ```
997
996
 
package/lib/bundle.js CHANGED
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports["react-global-state-hooks"]=e(require("react")):t["react-global-state-hooks"]=e(t.react)}(this,(t=>{return e={113:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createStatefulContext=void 0;var n,o=r(853),i=r(684),a=(n=r(156))&&n.__esModule?n:{default:n};e.createStatefulContext=function(t,e){var r=a.default.createContext(null);return[function(){return a.default.useContext(r)},function(n){var u=n.children,c=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(n,["children"]),l=(0,o.createGlobalStateWithDecoupledFuncs)(function(){if(c.initialValue){if("function"==typeof c.initialValue)return c.initialValue((0,i.clone)(t));var e=Array.isArray(c.initialValue),r=c.initialValue instanceof Map,n=c.initialValue instanceof Set;return(0,i.isPrimitive)(c.initialValue)||(0,i.isDate)(c.initialValue)||e||r||n?c.initialValue:Object.assign(Object.assign({},t),c.initialValue)}return(0,i.clone)(t)}(),e);return a.default.createElement(r.Provider,{value:l},u)}]}},853:(t,e,r)=>{"use strict";function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var i=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r};Object.defineProperty(e,"__esModule",{value:!0}),e.createCustomGlobalStateWithDecoupledFuncs=e.createGlobalState=e.createGlobalStateWithDecoupledFuncs=void 0;var a=r(774);e.createGlobalStateWithDecoupledFuncs=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.actions,o=i(e,["actions"]),u=new a.GlobalStore(t,o,r),c=n(u.getHook().stateControls(),2),l=c[0],s=c[1];return[u.getHook(),l,s]},e.createGlobalState=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n((0,e.createGlobalStateWithDecoupledFuncs)(t,r),1)[0]},e.createCustomGlobalStateWithDecoupledFuncs=function(t){var r=t.onInitialize,n=t.onChange;return function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{config:null},a=o.config,u=o.onInit,c=o.onStateChanged,l=i(o,["config","onInit","onStateChanged"]);return(0,e.createGlobalStateWithDecoupledFuncs)(t,Object.assign({onInit:function(t){r(t,a),null==u||u(t)},onStateChanged:function(t){n(t,a),null==c||c(t)}},l))}}},774:(t,e,r)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}function i(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return a(t)}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStore=void 0;var c=r(608),l=r(734),s=function(){return!!(null===globalThis||void 0===globalThis?void 0:globalThis.localStorage)},f=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(f,t);var e,r,n,l=(r=f,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=u(r);if(n){var o=u(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return i(this,t)});function f(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,f),(e=l.call(this,t,r,n))._onInitialize=function(t){var r,n,o=t.setState,i=t.getState;if(s()&&(null===(n=null===(r=e.config)||void 0===r?void 0:r.localStorage)||void 0===n?void 0:n.key)){var a=(0,c.getLocalStorageItem)({config:e.config});if(null!==a)o(a);else{var u=i();(0,c.setLocalStorageItem)({item:u,config:e.config})}}},e._onChange=function(t){var r=t.getState;s()&&(0,c.setLocalStorageItem)({item:r(),config:e.config})},e.onInitialize=null,e.onChange=null,e.onInit=function(t){var r;null===(r=e._onInitialize)||void 0===r||r.call(a(e),t)},e.onStateChanged=function(t){var r;null===(r=e._onChange)||void 0===r||r.call(a(e),t)},e.constructor!==f?i(e):(e.initialize(),e)}return e=f,Object.defineProperty(e,"prototype",{writable:!1}),e}(l.GlobalStoreAbstract);e.GlobalStore=f},608:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setLocalStorageItem=e.getLocalStorageItem=void 0;var n=r(734);e.getLocalStorageItem=function(t){var e,r=t.config,o=null===(e=null==r?void 0:r.localStorage)||void 0===e?void 0:e.key;if(!o)return null;var i=localStorage.getItem(o);if(null===i)return null;var a=function(){var t,e=null!==(t=null==r?void 0:r.localStorage)&&void 0!==t?t:{},n=e.decrypt,o=e.encrypt;return n||o?"function"==typeof n?n(i):atob(i):i}();return(0,n.formatFromStore)(a,{jsonParse:!0})},e.setLocalStorageItem=function(t){var e,r=t.item,o=t.config,i=null===(e=null==o?void 0:o.localStorage)||void 0===e?void 0:e.key;if(!i)return null;var a=(0,n.formatToStore)(r,{stringify:!0,excludeTypes:["function"]}),u=function(){var t,e=(null!==(t=null==o?void 0:o.localStorage)&&void 0!==t?t:{}).encrypt;return e?"function"==typeof e?e(a):btoa(a):a}();localStorage.setItem(i,u)}},195:(t,e,r)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}function i(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function a(t){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},a(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStoreAbstract=void 0;var u=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(l,t);var e,r,u,c=(r=l,u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=a(r);if(u){var o=a(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return i(t)}(this,t)});function l(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l),(e=c.call(this,t,r,n)).onInit=function(t){var r;e._onInitialize(t),null===(r=e.onInitialize)||void 0===r||r.call(i(e),t)},e.onStateChanged=function(t){var r;e._onInitialize(t),null===(r=e.onChange)||void 0===r||r.call(i(e),t)},e}return e=l,Object.defineProperty(e,"prototype",{writable:!1}),e}(r(774).GlobalStore);e.GlobalStoreAbstract=u},991:(t,e,r)=>{"use strict";var n=Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]};Object.defineProperty(e,"__esModule",{value:!0}),e.setLocalStorageItem=e.getLocalStorageItem=e.createCustomGlobalStateWithDecoupledFuncs=e.createGlobalState=e.createGlobalStateWithDecoupledFuncs=e.GlobalStoreAbstract=e.GlobalStore=e.combineRetrieverAsynchronously=e.combineAsyncGetters=e.combineRetrieverEmitterAsynchronously=e.combineAsyncGettersEmitter=e.debounce=e.shallowCompare=e.createDerivateEmitter=e.createDerivate=e.throwNoSubscribersWereAdded=e.formatToStore=e.formatFromStore=e.isPrimitive=e.isFunction=e.isRegex=e.isDate=e.isString=e.isBoolean=e.isNumber=e.isNil=e.clone=void 0;var o=r(734);Object.defineProperty(e,"clone",{enumerable:!0,get:function(){return o.clone}}),Object.defineProperty(e,"isNil",{enumerable:!0,get:function(){return o.isNil}}),Object.defineProperty(e,"isNumber",{enumerable:!0,get:function(){return o.isNumber}}),Object.defineProperty(e,"isBoolean",{enumerable:!0,get:function(){return o.isBoolean}}),Object.defineProperty(e,"isString",{enumerable:!0,get:function(){return o.isString}}),Object.defineProperty(e,"isDate",{enumerable:!0,get:function(){return o.isDate}}),Object.defineProperty(e,"isRegex",{enumerable:!0,get:function(){return o.isRegex}}),Object.defineProperty(e,"isFunction",{enumerable:!0,get:function(){return o.isFunction}}),Object.defineProperty(e,"isPrimitive",{enumerable:!0,get:function(){return o.isPrimitive}}),Object.defineProperty(e,"formatFromStore",{enumerable:!0,get:function(){return o.formatFromStore}}),Object.defineProperty(e,"formatToStore",{enumerable:!0,get:function(){return o.formatToStore}}),Object.defineProperty(e,"throwNoSubscribersWereAdded",{enumerable:!0,get:function(){return o.throwNoSubscribersWereAdded}}),Object.defineProperty(e,"createDerivate",{enumerable:!0,get:function(){return o.createDerivate}}),Object.defineProperty(e,"createDerivateEmitter",{enumerable:!0,get:function(){return o.createDerivateEmitter}}),Object.defineProperty(e,"shallowCompare",{enumerable:!0,get:function(){return o.shallowCompare}}),Object.defineProperty(e,"debounce",{enumerable:!0,get:function(){return o.debounce}}),Object.defineProperty(e,"combineAsyncGettersEmitter",{enumerable:!0,get:function(){return o.combineAsyncGettersEmitter}}),Object.defineProperty(e,"combineRetrieverEmitterAsynchronously",{enumerable:!0,get:function(){return o.combineRetrieverEmitterAsynchronously}}),Object.defineProperty(e,"combineAsyncGetters",{enumerable:!0,get:function(){return o.combineAsyncGetters}}),Object.defineProperty(e,"combineRetrieverAsynchronously",{enumerable:!0,get:function(){return o.combineRetrieverAsynchronously}});var i=r(774);Object.defineProperty(e,"GlobalStore",{enumerable:!0,get:function(){return i.GlobalStore}});var a=r(195);Object.defineProperty(e,"GlobalStoreAbstract",{enumerable:!0,get:function(){return a.GlobalStoreAbstract}});var u=r(853);Object.defineProperty(e,"createGlobalStateWithDecoupledFuncs",{enumerable:!0,get:function(){return u.createGlobalStateWithDecoupledFuncs}}),Object.defineProperty(e,"createGlobalState",{enumerable:!0,get:function(){return u.createGlobalState}}),Object.defineProperty(e,"createCustomGlobalStateWithDecoupledFuncs",{enumerable:!0,get:function(){return u.createCustomGlobalStateWithDecoupledFuncs}});var c=r(608);Object.defineProperty(e,"getLocalStorageItem",{enumerable:!0,get:function(){return c.getLocalStorageItem}}),Object.defineProperty(e,"setLocalStorageItem",{enumerable:!0,get:function(){return c.setLocalStorageItem}}),function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)}(r(113),e)},684:function(t){t.exports=(()=>{"use strict";var t={991:(t,e,r)=>{var n=Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]};Object.defineProperty(e,"__esModule",{value:!0}),function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)}(r(729),e)},729:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t,e,n){return(e=function(t){var e=function(t,e){if("object"!==r(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,"string");if("object"!==r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===r(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){if(t){if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}Object.defineProperty(e,"__esModule",{value:!0}),e.formatToStore=e.formatFromStore=e.isPrimitive=e.isFunction=e.isRegex=e.isDate=e.isString=e.isBoolean=e.isNumber=e.isNil=e.clone=void 0,e.clone=function(t){var r,a=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).shallow;if((0,e.isPrimitive)(t)||(0,e.isDate)(t))return t;if(Array.isArray(t))return a?function(t){if(Array.isArray(t))return i(t)}(r=t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||o(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}():t.map((function(t){return(0,e.clone)(t)}));if(t instanceof Map){var u=Array.from(t.entries());return a?new Map(u):new Map(u.map((function(t){return(0,e.clone)(t)})))}if(t instanceof Set){var c=Array.from(t.values());return a?new Set(c):new Set(c.map((function(t){return(0,e.clone)(t)})))}return t instanceof RegExp?new RegExp(t.toString()):(0,e.isFunction)(t)?a?t:Object.create(t):a?Object.assign({},t):t instanceof Error?new Error(t.message):Object.keys(t).reduce((function(r,o){var i=t[o];return Object.assign(Object.assign({},r),n({},o,(0,e.clone)(i)))}),{})},e.isNil=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isBoolean=function(t){return"boolean"==typeof t},e.isString=function(t){return"string"==typeof t},e.isDate=function(t){return t instanceof Date},e.isRegex=function(t){return t instanceof RegExp},e.isFunction=function(t){return"function"==typeof t||t instanceof Function},e.isPrimitive=function(t){return(0,e.isNil)(t)||(0,e.isNumber)(t)||(0,e.isBoolean)(t)||(0,e.isString)(t)||"symbol"===r(t)},e.formatFromStore=function(t){return function(t){var r,i;if((0,e.isPrimitive)(t))return t;if("date"===(null==t?void 0:t.$t))return new Date(t.$v);if("map"===(null==t?void 0:t.$t)){var a=(null!==(r=t.$v)&&void 0!==r?r:[]).map((function(t){var r,n=(2,function(t){if(Array.isArray(t))return t}(r=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{for(i=(r=r.call(t)).next,0;!(c=(n=i.call(r)).done)&&(u.push(n.value),2!==u.length);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(r)||o(r,2)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=n[0],a=n[1];return[i,(0,e.formatFromStore)(a)]}));return new Map(a)}if("set"===(null==t?void 0:t.$t)){var u=null!==(i=t.$v)&&void 0!==i?i:[].map((function(t){return(0,e.formatFromStore)(t)}));return new Set(u)}return"regex"===(null==t?void 0:t.$t)?new RegExp(t.$v):"error"===(null==t?void 0:t.$t)?new Error(t.$v):Array.isArray(t)?t.map((function(t){return(0,e.formatFromStore)(t)})):"function"===(null==t?void 0:t.$t)?Function("(".concat(t.$v,")(...arguments)")):Object.keys(t).reduce((function(r,o){var i=t[o];return Object.assign(Object.assign({},r),n({},o,(0,e.formatFromStore)(i)))}),{})}((arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).jsonParse?JSON.parse(t):(0,e.clone)(t))},e.formatToStore=function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{stringify:!1},i=o.stringify,a=o.validator,u=o.excludeTypes,c=o.excludeKeys,l=new Set(null!=u?u:[]),s=new Set(null!=c?c:[]),f=l.size||s.size,p=null!=a?a:function(t){var e=t.key,n=t.value;if(!f)return!0;var o=s.has(e),i=l.has(r(n));return!o&&!i},b=function t(r){if((0,e.isPrimitive)(r))return r;if(Array.isArray(r))return r.map((function(e){return t(e)}));if(r instanceof Map)return{$t:"map",$v:Array.from(r.entries()).map((function(e){return t(e)}))};if(r instanceof Set)return{$t:"set",$v:Array.from(r.values()).map((function(e){return t(e)}))};if((0,e.isDate)(r))return{$t:"date",$v:r.toISOString()};if((0,e.isRegex)(r))return{$t:"regex",$v:r.toString()};if((0,e.isFunction)(r)){var o;try{o={$t:"function",$v:r.toString()}}catch(t){o={$t:"error",$v:"Error: Could not serialize function"}}return o}return r instanceof Error?{$t:"error",$v:r.message}:Object.keys(r).reduce((function(e,o){var i=r[o],a=t(i);return p({obj:r,key:o,value:a})?Object.assign(Object.assign({},e),n({},o,t(i))):e}),{})}((0,e.clone)(t));return i?JSON.stringify(b):b}}},e={};return function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}(991)})()},734:function(t,e,r){var n;n=t=>{return e={852:(t,e,r)=>{"use strict";function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}Object.defineProperty(e,"__esModule",{value:!0}),e.combineRetrieverAsynchronously=e.combineAsyncGetters=e.combineRetrieverEmitterAsynchronously=e.combineAsyncGettersEmitter=void 0;var i=r(608),a=r(156),u=r(774);e.combineAsyncGettersEmitter=function(t){for(var e,r,n,o=arguments.length,a=new Array(o>1?o-1:0),c=1;c<o;c++)a[c-1]=arguments[c];var l=a,s=new Map(l.map((function(t,e){return[e,t()]}))),f=t.selector(Array.from(s.values())),p=void 0!==(null===(e=null==t?void 0:t.config)||void 0===e?void 0:e.isEqual)?null===(r=null==t?void 0:t.config)||void 0===r?void 0:r.isEqual:i.shallowCompare,b=new Set,v=(0,i.debounce)((function(){var e=t.selector(Array.from(s.values()));(null==p?void 0:p(f,e))||(f=e,b.forEach((function(t){return t()})))}),null===(n=null==t?void 0:t.config)||void 0===n?void 0:n.delay),y=l.map((function(t,e){return t((function(t){t((function(t){s.set(e,t),v()}))}))})),d=function(t,e,r){var n,o,a="function"==typeof e,u=a?t:null,c=a?e:t,l=a?r:e,s=Object.assign({delay:0,isEqual:i.shallowCompare},null!=l?l:{}),p=null!==(n=null==u?void 0:u(f))&&void 0!==n?n:f;s.skipFirst||c(p);var v=(0,i.debounce)((function(){var t,e,r=null!==(t=null==u?void 0:u(f))&&void 0!==t?t:f;(null===(e=s.isEqual)||void 0===e?void 0:e.call(s,p,r))||(p=r,c(r))}),null!==(o=s.delay)&&void 0!==o?o:0);return b.add(v),function(){b.delete(v)}};return[d,function(t){if(!t)return f;var e=[];return t((function(){e.push(d.apply(void 0,arguments))})),e.length||(0,u.throwNoSubscribersWereAdded)(),function(){e.forEach((function(t){t(),b.delete(t)}))}},function(){y.forEach((function(t){return t()}))}]},e.combineRetrieverEmitterAsynchronously=e.combineAsyncGettersEmitter,e.combineAsyncGetters=function(t){for(var r=arguments.length,o=new Array(r>1?r-1:0),u=1;u<r;u++)o[u-1]=arguments[u];var c=n(e.combineAsyncGettersEmitter.apply(void 0,[t].concat(o)),3),l=c[0],s=c[1],f=c[2];return[function(t,e){var r=n((0,a.useState)((function(){var e=s();return t?t(e):e})),2),o=r[0],u=r[1];return(0,a.useEffect)((function(){var r,n=Object.assign({delay:0,isEqual:i.shallowCompare},null!=e?e:{}),o=void 0!==n.isEqual?n.isEqual:i.shallowCompare,a=l((function(e){return t?t(e):e}),(0,i.debounce)((function(e){var r=t?t(e):e;(null==o?void 0:o(e,r))||u(r)}),null!==(r=n.delay)&&void 0!==r?r:0));return function(){a()}}),[]),[o,null,null]},s,f]},e.combineRetrieverAsynchronously=e.combineAsyncGetters},113:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createStatefulContext=void 0;var n,o=r(853),i=r(684),a=(n=r(156))&&n.__esModule?n:{default:n};e.createStatefulContext=function(t,e){var r=a.default.createContext(null);return[function(){return a.default.useContext(r)},function(n){var u=n.children,c=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(n,["children"]),l=(0,o.createGlobalStateWithDecoupledFuncs)(function(){if(c.initialValue){if("function"==typeof c.initialValue)return c.initialValue((0,i.clone)(t));var e=Array.isArray(c.initialValue),r=c.initialValue instanceof Map,n=c.initialValue instanceof Set;return(0,i.isPrimitive)(c.initialValue)||(0,i.isDate)(c.initialValue)||e||r||n?c.initialValue:Object.assign(Object.assign({},t),c.initialValue)}return(0,i.clone)(t)}(),e);return a.default.createElement(r.Provider,{value:l},u)}]}},853:(t,e,r)=>{"use strict";function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var o=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r};Object.defineProperty(e,"__esModule",{value:!0}),e.createDerivateEmitter=e.createDerivate=e.createCustomGlobalStateWithDecoupledFuncs=e.createGlobalState=e.createGlobalStateWithDecoupledFuncs=void 0;var i=r(774);e.createGlobalStateWithDecoupledFuncs=function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.actions,u=o(r,["actions"]),c=new i.GlobalStore(t,u,a).getHook(),l=function(t){if(Array.isArray(t))return t}(e=c.stateControls())||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{for(i=(r=r.call(t)).next;!(c=(n=i.call(r)).done)&&(u.push(n.value),2!==u.length);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(e)||function(t,e){if(t){if("string"==typeof t)return n(t,2);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,2):void 0}}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}();return[c,l[0],l[1]]},e.createGlobalState=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.actions,n=o(e,["actions"]);return new i.GlobalStore(t,n,r).getHook()},e.createCustomGlobalStateWithDecoupledFuncs=function(t){var r=t.onInitialize,n=t.onChange;return function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{config:null},a=i.config,u=i.onInit,c=i.onStateChanged,l=o(i,["config","onInit","onStateChanged"]);return(0,e.createGlobalStateWithDecoupledFuncs)(t,Object.assign({onInit:function(t){r(t,a),null==u||u(t)},onStateChanged:function(t){n(t,a),null==c||c(t)}},l))}},e.createDerivate=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.createSelectorHook(e,r)},e.createDerivateEmitter=function(t,r){var n=t._father_emitter;if(n){var o=function(t){var e=n.selector(t);return r(e)},i=(0,e.createDerivateEmitter)(n.getter,o);return i._father_emitter={getter:n.getter,selector:o},i}var a=function(e,n){var o="function"==typeof n,i=o?e:null,a=o?n:e,u=o?arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}:n;return t((function(t){t((function(t){var e,n=r(t);return null!==(e=null==i?void 0:i(n))&&void 0!==e?e:n}),a,u)}))};return a._father_emitter={getter:t,selector:r},a}},774:(t,e,r)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function a(){a=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),u=new _(n||[]);return o(a,"_invoke",{value:j(t,r,u)}),a}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var b={};function v(){}function y(){}function d(){}var h={};s(h,u,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(x([])));m&&m!==e&&r.call(m,u)&&(h=m);var S=d.prototype=v.prototype=Object.create(h);function O(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,a,u,c){var l=p(t[o],t,a);if("throw"!==l.type){var s=l.arg,f=s.value;return f&&"object"==n(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){i("next",t,u,c)}),(function(t){i("throw",t,u,c)})):e.resolve(f).then((function(t){s.value=t,u(s)}),(function(t){return i("throw",t,u,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return a=a?a.then(n,n):n()}})}function j(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=P(a,r);if(u){if(u===b)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=p(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===b)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function P(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,P(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),b;var o=p(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,b;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,b):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,b)}function A(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(A,this),this.reset(!0)}function x(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:C}}function C(){return{value:void 0,done:!0}}return y.prototype=d,o(S,"constructor",{value:d,configurable:!0}),o(d,"constructor",{value:y,configurable:!0}),y.displayName=s(d,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},O(w.prototype),s(w.prototype,c,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(S),s(S,l,"Generator"),s(S,u,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=x,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,b):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),b},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),E(r),b}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;E(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:x(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),b}},t}function u(t){var e=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===n(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStore=e.throwNoSubscribersWereAdded=void 0;var c=r(608),l=r(156);e.throwNoSubscribersWereAdded=function(){throw new Error("No new subscribers were added, please make sure to add at least one subscriber with the subscribe method")};var s=function(){function t(r){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actionsConfig=s,this.subscribers=new Map,this.actions=null,this.config={metadata:null},this.onInit=null,this.onStateChanged=null,this.onSubscribed=null,this.computePreventStateChange=null,this.initialize=function(){return t=n,e=void 0,r=a().mark((function t(){var e,r,n;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.actionsConfig&&(this.actions=this.getStoreActionsMap()),e=this.onInit,r=this.config.onInit,e||r){t.next=5;break}return t.abrupt("return");case 5:n=this.getConfigCallbackParam(),null==e||e(n),null==r||r(n);case 8:case"end":return t.stop()}}),t,this)})),new(e||(e=Promise))((function(n,o){function i(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var r;t.done?n(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(i,a)}u((r=r.apply(t,[])).next())}));var t,e,r},this.setState=function(t){var e=t.state,r=t.forceUpdate,o=t.identifier,i=n.stateWrapper.state;n.stateWrapper={state:e};for(var a=function(t){var n,a,u=t.selector,c=t.callback,l=t.currentState,s=t.config;if(r||!(null!==(n=null==s?void 0:s.isEqualRoot)&&void 0!==n?n:function(t,e){return Object.is(t,e)})(i,e)){var f=u?u(e):e;!r&&(null!==(a=null==s?void 0:s.isEqual)&&void 0!==a?a:function(t,e){return Object.is(t,e)})(l,f)||c({state:f,identifier:o})}},u=Array.from(n.subscribers.values()),c=0;c<u.length;c++)a(u[c])},this.setMetadata=function(t){var e,r,o="function"==typeof t?t(null!==(e=n.config.metadata)&&void 0!==e?e:null):t;n.config=Object.assign(Object.assign({},null!==(r=n.config)&&void 0!==r?r:{}),{metadata:o})},this.getMetadata=function(){var t;return null!==(t=n.config.metadata)&&void 0!==t?t:null},this.createChangesSubscriber=function(t){var e=t.callback,r=t.selector,o=t.config,i=r?r(n.stateWrapper.state):n.stateWrapper.state,a={state:i};return(null==o?void 0:o.skipFirst)||e(i),{stateWrapper:a,subscriptionCallback:function(t){var r=t.state;a.state=r,e(r)}}},this.getState=function(t){if(!t)return n.stateWrapper.state;var r=[];return t((function(t,e,o){var i="function"==typeof e,a=i?t:null,u=i?e:t,l=i?o:e,s=n.createChangesSubscriber({selector:a,callback:u,config:l}),f=s.subscriptionCallback,p=s.stateWrapper,b=(0,c.uniqueId)();n.addNewSubscriber(b,{selector:a,config:l,stateWrapper:p,callback:f}),r.push(b)})),r.length||(0,e.throwNoSubscribersWereAdded)(),function(){for(var t=0;t<r.length;t++){var e=r[t];n.subscribers.delete(e)}}},this.getConfigCallbackParam=function(){var t=n.setMetadata,e=n.getMetadata,r=n.getState,o=n.actions;return{setMetadata:t,getMetadata:e,getState:r,setState:n.setStateWrapper,actions:o}},this.addNewSubscriber=function(t,e){n.subscribers.set(t,{subscriptionId:t,currentState:e.stateWrapper.state,selector:e.selector,config:e.config,callback:e.callback}),Object.assign(e.callback,{__global_state_subscription_id__:t})},this.updateSubscriptionIfExists=function(t,e){if(n.subscribers.has(t)){var r=n.subscribers.get(t);r.currentState=e.stateWrapper.state,r.selector=e.selector,r.config=e.config,r.callback=e.callback}},this.executeOnSubscribed=function(){var t=n.onSubscribed,e=n.config.onSubscribed;if(t||e){var r=n.getConfigCallbackParam();null==t||t(r),null==e||e(r)}},this.getHook=function(){var t=function(t){var e,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=(0,l.useRef)(null),u=function(){return t?{state:t(n.stateWrapper.state)}:{state:n.stateWrapper.state}},s=o((0,l.useState)(u),2),f=s[0],p=s[1];(0,l.useEffect)((function(){return null===a.current&&(a.current=(0,c.uniqueId)()),function(){n.subscribers.delete(a.current)}}),[]);var b=n.subscribers.get(a.current),v=(null!==(e=null==b?void 0:b.config)&&void 0!==e?e:{dependencies:i.dependencies}).dependencies;return n.updateSubscriptionIfExists(a.current,{stateWrapper:f,selector:t,config:i,callback:p}),(0,l.useEffect)((function(){var e=a.current;null!==e&&!n.subscribers.has(e)&&(n.addNewSubscriber(e,{stateWrapper:f,selector:t,config:i,callback:p}),n.executeOnSubscribed())}),[f]),[function(){if(!t||!a.current)return f.state;var e=i.dependencies;if(v===e)return f.state;if((null==v?void 0:v.length)===(null==e?void 0:e.length)&&(0,c.shallowCompare)(v,e))return f.state;var r=u();return n.updateSubscriptionIfExists(a.current,{stateWrapper:r,selector:t,config:i,callback:p}),f.state=r.state,r.state}(),n.getStateOrchestrator(),null!==(r=n.config.metadata)&&void 0!==r?r:null]};return t.stateControls=n.stateControls,t.createSelectorHook=n.createSelectorHook,t},this.createSelectorHook=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.isEqualRoot,a=r.isEqual,u=new Map,s=n,f=o(s.stateControls(),3),p=f[0],b=f[1],v=f[2],y=p(),d=(null!=t?t:function(t){return t})(p());p((function(e){e((function(e){if(!(null!=i?i:Object.is)(y,e)){y=e;var r=t(e);(null!=a?a:Object.is)(d,r)||(d=r,u.forEach((function(t){t.callback({state:d})})))}}),{skipFirst:!0})}));var h=function(t,e){u.set(t,{subscriptionId:t,currentState:e.stateWrapper.state,selector:e.selector,config:e.config,callback:e.callback}),Object.assign(e.callback,{__global_state_subscription_id__:t})},g=function(t,e){if(u.has(t)){var r=u.get(t);r.currentState=e.stateWrapper.state,r.selector=e.selector,r.config=e.config,r.callback=e.callback}},m=function(t){if(!t)return d;var r=[];return t((function(t,e,n){var o="function"==typeof e,i=o?t:null,a=o?n:e,u=function(t){var e=t.callback,r=t.selector,n=t.config,o=(null!=r?r:function(t){return t})(d),i={state:o};return(null==n?void 0:n.skipFirst)||e(o),{stateWrapper:i,subscriptionCallback:function(t){var r=t.state;i.state=r,e(r)}}}({selector:i,callback:o?e:t,config:a}),l=u.subscriptionCallback,s=u.stateWrapper,f=(0,c.uniqueId)();h(f,{selector:i,config:a,stateWrapper:s,callback:l}),r.push(f)})),r.length||(0,e.throwNoSubscribersWereAdded)(),function(){for(var t=0;t<r.length;t++){var e=r[t];u.delete(e)}}},S=function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.isEqualRoot,i=r.isEqual,a=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(r,["isEqualRoot","isEqual"]),s=function(){return t?{state:t(d)}:{state:d}},f=(0,l.useRef)(null),p=o((0,l.useState)(s),2),y=p[0],S=p[1];(0,l.useEffect)((function(){null===f.current&&(f.current=(0,c.uniqueId)());var e=m((function(e){var r=d;e((function(e){var o=u.get(f.current);if(!(null!=n?n:Object.is)(r,e)){r=e;var a=(null!=t?t:function(t){return t})(d);(null!=i?i:Object.is)(a,o.currentState)||(o.currentState=a,S({state:a}))}}),{skipFirst:!0})}));return function(){e(),u.delete(f.current)}}),[]);var O=u.get(f.current),w=(null!==(e=null==O?void 0:O.config)&&void 0!==e?e:{dependencies:a.dependencies}).dependencies;return g(f.current,{stateWrapper:y,selector:t,config:a,callback:S}),(0,l.useEffect)((function(){var e=f.current;null!==e&&!u.has(e)&&h(e,{stateWrapper:y,selector:t,config:a,callback:S})}),[y]),[function(){if(!t||!f.current)return y.state;var e=a.dependencies;if(w===e)return y.state;if((null==w?void 0:w.length)===(null==e?void 0:e.length)&&(0,c.shallowCompare)(w,e))return y.state;var r=s();return g(f.current,{stateWrapper:r,selector:t,config:a,callback:S}),y.state=r.state,r.state}(),b,v]};return S.stateControls=function(){return[m,b,v]},S.createSelectorHook=n.createSelectorHook.bind(S),Object.assign(S,{_parent:s,_subscribers:u}),S},this.stateControls=function(){var t=n.getStateOrchestrator(),e=n.getMetadata;return[n.getState,t,e]},this.getHookDecoupled=function(){return n.stateControls()},this.getStateOrchestrator=function(){return n.actions?n.actions:n.setStateWrapper},this.hasStateCallbacks=function(){var t=n.computePreventStateChange,e=n.onStateChanged,r=n.config,o=r.computePreventStateChange,i=r.onStateChanged;return!!(t||o||e||i)},this.setStateWrapper=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.forceUpdate,o=e.identifier,i="function"==typeof t,a=n.stateWrapper.state,u=i?t(a):t;if(r||!Object.is(n.stateWrapper.state,u)){var c=n.setMetadata,l=n.getMetadata,s=n.getState,f=n.actions,p={setMetadata:c,getMetadata:l,setState:n.setState,getState:s,actions:f,previousState:a,state:u,identifier:o},b=n.computePreventStateChange,v=n.config.computePreventStateChange;if((b||v)&&((null==b?void 0:b(p))||(null==v?void 0:v(p))))return;n.setState({forceUpdate:r,identifier:o,state:u});var y=n.onStateChanged,d=n.config.onStateChanged;(y||d)&&(null==y||y(p),null==d||d(p))}},this.getStoreActionsMap=function(){if(!n.actionsConfig)return null;var t=n.actionsConfig,e=n.setMetadata,r=n.setStateWrapper,o=n.getState,i=n.getMetadata,a=Object.keys(t).reduce((function(n,c){var l,s,f;return Object.assign(n,(l={},f=function(){for(var n=t[c],u=arguments.length,l=new Array(u),s=0;s<u;s++)l[s]=arguments[s];var f=n.apply(a,l);return"function"!=typeof f&&function(t){throw new Error("[WRONG CONFIGURATION!]: Every key inside the storeActionsConfig must be a higher order function that returns a function \n[".concat(t,"]: key is not a valid function, try something like this: \n{\n\n ").concat(t,": (param) => ({ setState, getState, setMetadata, getMetadata, actions }) => {\n\n setState((state) => ({ ...state, ...param }))\n\n }\n\n}\n"))}(c),f.call(a,{setState:r,getState:o,setMetadata:e,getMetadata:i,actions:a})},(s=u(s=c))in l?Object.defineProperty(l,s,{value:f,enumerable:!0,configurable:!0,writable:!0}):l[s]=f,l)),n}),{});return a},this.stateWrapper={state:r},this.config=Object.assign({metadata:null},null!=i?i:{}),(null===globalThis||void 0===globalThis?void 0:globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG)&&globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG(this,r,i,s),this.constructor!==t||this.initialize()}var r,n;return r=t,(n=[{key:"state",get:function(){return this.stateWrapper.state}}])&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u(n.key),n)}}(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),t}();e.GlobalStore=s},530:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},608:(t,e,r)=>{"use strict";function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||i(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=i(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw a}}}}function i(t,e){if(t){if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function u(t){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.uniqueId=e.debounce=e.shallowCompare=void 0;var c=r(684);e.shallowCompare=function(t,e){if(t===e)return!0;var r=u(t),i=u(e);if(r!==i)return!1;if((0,c.isNil)(t)||(0,c.isNil)(e)||(0,c.isPrimitive)(t)&&(0,c.isPrimitive)(e)||(0,c.isDate)(t)&&(0,c.isDate)(e)||"function"===r&&"function"===i)return t===e;if(Array.isArray(t)){var a=t,l=e;if(a.length!==l.length)return!1;for(var s=0;s<a.length;s++)if(a[s]!==l[s])return!1}if(t instanceof Map){var f=t,p=e;if(f.size!==p.size)return!1;var b,v=o(f);try{for(v.s();!(b=v.n()).done;){var y=n(b.value,2),d=y[0];if(y[1]!==p.get(d))return!1}}catch(t){v.e(t)}finally{v.f()}}if(t instanceof Set){var h=t,g=e;if(h.size!==g.size)return!1;var m,S=o(h);try{for(S.s();!(m=S.n()).done;){var O=m.value;if(!g.has(O))return!1}}catch(t){S.e(t)}finally{S.f()}}var w=Object.keys(t),j=Object.keys(e);if(w.length!==j.length)return!1;for(var P=0,A=w;P<A.length;P++){var E=A[P];if(t[E]!==e[E])return!1}return!0},e.debounce=function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];e&&clearTimeout(e),e=setTimeout((function(){t.apply(void 0,o)}),r)}},e.uniqueId=function(){return Date.now().toString(36)+Math.random().toString(36).substr(2,5)}},195:(t,e,r)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}function i(t){return i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},i(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStoreAbstract=void 0;var a=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(c,t);var e,r,a,u=(r=c,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=i(r);if(a){var o=i(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function c(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(e=u.call(this,t,r,n)).onInit=function(t){e.onInitialize(t)},e.onStateChanged=function(t){e.onChange(t)},e}return e=c,Object.defineProperty(e,"prototype",{writable:!1}),e}(r(774).GlobalStore);e.GlobalStoreAbstract=a},991:(t,e,r)=>{"use strict";var n=Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]},o=function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r(684),e),o(r(530),e),o(r(774),e),o(r(195),e),o(r(853),e),o(r(608),e),o(r(852),e),o(r(113),e)},684:function(t){t.exports=(()=>{"use strict";var t={991:(t,e,r)=>{var n=Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]};Object.defineProperty(e,"__esModule",{value:!0}),function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)}(r(729),e)},729:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t,e,n){return(e=function(t){var e=function(t,e){if("object"!==r(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,"string");if("object"!==r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===r(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){if(t){if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}Object.defineProperty(e,"__esModule",{value:!0}),e.formatToStore=e.formatFromStore=e.isPrimitive=e.isFunction=e.isRegex=e.isDate=e.isString=e.isBoolean=e.isNumber=e.isNil=e.clone=void 0,e.clone=function(t){var r,a=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).shallow;if((0,e.isPrimitive)(t)||(0,e.isDate)(t))return t;if(Array.isArray(t))return a?function(t){if(Array.isArray(t))return i(t)}(r=t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||o(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}():t.map((function(t){return(0,e.clone)(t)}));if(t instanceof Map){var u=Array.from(t.entries());return a?new Map(u):new Map(u.map((function(t){return(0,e.clone)(t)})))}if(t instanceof Set){var c=Array.from(t.values());return a?new Set(c):new Set(c.map((function(t){return(0,e.clone)(t)})))}return t instanceof RegExp?new RegExp(t.toString()):(0,e.isFunction)(t)?a?t:Object.create(t):a?Object.assign({},t):t instanceof Error?new Error(t.message):Object.keys(t).reduce((function(r,o){var i=t[o];return Object.assign(Object.assign({},r),n({},o,(0,e.clone)(i)))}),{})},e.isNil=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isBoolean=function(t){return"boolean"==typeof t},e.isString=function(t){return"string"==typeof t},e.isDate=function(t){return t instanceof Date},e.isRegex=function(t){return t instanceof RegExp},e.isFunction=function(t){return"function"==typeof t||t instanceof Function},e.isPrimitive=function(t){return(0,e.isNil)(t)||(0,e.isNumber)(t)||(0,e.isBoolean)(t)||(0,e.isString)(t)||"symbol"===r(t)},e.formatFromStore=function(t){return function(t){var r,i;if((0,e.isPrimitive)(t))return t;if("date"===(null==t?void 0:t.$t))return new Date(t.$v);if("map"===(null==t?void 0:t.$t)){var a=(null!==(r=t.$v)&&void 0!==r?r:[]).map((function(t){var r,n=function(t){if(Array.isArray(t))return t}(r=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{for(i=(r=r.call(t)).next;!(c=(n=i.call(r)).done)&&(u.push(n.value),2!==u.length);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(r)||o(r,2)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),i=n[0],a=n[1];return[i,(0,e.formatFromStore)(a)]}));return new Map(a)}if("set"===(null==t?void 0:t.$t)){var u=null!==(i=t.$v)&&void 0!==i?i:[].map((function(t){return(0,e.formatFromStore)(t)}));return new Set(u)}return"regex"===(null==t?void 0:t.$t)?new RegExp(t.$v):"error"===(null==t?void 0:t.$t)?new Error(t.$v):Array.isArray(t)?t.map((function(t){return(0,e.formatFromStore)(t)})):"function"===(null==t?void 0:t.$t)?Function("(".concat(t.$v,")(...arguments)")):Object.keys(t).reduce((function(r,o){var i=t[o];return Object.assign(Object.assign({},r),n({},o,(0,e.formatFromStore)(i)))}),{})}((arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).jsonParse?JSON.parse(t):(0,e.clone)(t))},e.formatToStore=function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{stringify:!1},i=o.stringify,a=o.validator,u=o.excludeTypes,c=o.excludeKeys,l=new Set(null!=u?u:[]),s=new Set(null!=c?c:[]),f=l.size||s.size,p=null!=a?a:function(t){var e=t.key,n=t.value;if(!f)return!0;var o=s.has(e),i=l.has(r(n));return!o&&!i},b=function t(r){if((0,e.isPrimitive)(r))return r;if(Array.isArray(r))return r.map((function(e){return t(e)}));if(r instanceof Map)return{$t:"map",$v:Array.from(r.entries()).map((function(e){return t(e)}))};if(r instanceof Set)return{$t:"set",$v:Array.from(r.values()).map((function(e){return t(e)}))};if((0,e.isDate)(r))return{$t:"date",$v:r.toISOString()};if((0,e.isRegex)(r))return{$t:"regex",$v:r.toString()};if((0,e.isFunction)(r)){var o;try{o={$t:"function",$v:r.toString()}}catch(t){o={$t:"error",$v:"Error: Could not serialize function"}}return o}return r instanceof Error?{$t:"error",$v:r.message}:Object.keys(r).reduce((function(e,o){var i=r[o],a=t(i);return p({obj:r,key:o,value:a})?Object.assign(Object.assign({},e),n({},o,t(i))):e}),{})}((0,e.clone)(t));return i?JSON.stringify(b):b}}},e={};return function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}(991)})()},156:e=>{"use strict";e.exports=t}},r={},function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n].call(i.exports,i,i.exports,t),i.exports}(991);var e,r},t.exports=n(r(156))},156:e=>{"use strict";e.exports=t}},r={},function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n].call(i.exports,i,i.exports,t),i.exports}(991);var e,r}));
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports["react-global-state-hooks"]=e(require("react")):t["react-global-state-hooks"]=e(t.react)}(this,(t=>{return e={113:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createStatefulContext=void 0;var n,o=r(853),i=r(684),a=(n=r(156))&&n.__esModule?n:{default:n};e.createStatefulContext=function(t,e){var r=a.default.createContext(null);return[function(){return a.default.useContext(r)},function(n){var u=n.children,c=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(n,["children"]),l=(0,o.createGlobalState)(function(){if(c.initialValue){if("function"==typeof c.initialValue)return c.initialValue((0,i.clone)(t));var e=Array.isArray(c.initialValue),r=c.initialValue instanceof Map,n=c.initialValue instanceof Set;return(0,i.isPrimitive)(c.initialValue)||(0,i.isDate)(c.initialValue)||e||r||n?c.initialValue:Object.assign(Object.assign({},t),c.initialValue)}return(0,i.clone)(t)}(),e);return a.default.createElement(r.Provider,{value:l},u)}]}},853:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createCustomGlobalStateWithDecoupledFuncs=e.createCustomGlobalState=e.createGlobalState=void 0;var n=r(774);e.createGlobalState=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];var i="function"==typeof r[0],a=function(){var t;if(i){var e=r[0];return{config:r[1],actions:e()}}var n=r[0];return{config:n,actions:null!==(t=r[1])&&void 0!==t?t:null==n?void 0:n.actions}}(),u=a.config,c=a.actions;return new n.GlobalStore(t,u,c).getHook()},e.createCustomGlobalState=function(t){var r=t.onInitialize,n=t.onChange;return function(t,o){var i=null!=o?o:{},a=i.onInit,u=i.onStateChanged,c=i.config,l=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(i,["onInit","onStateChanged","config"]);return(0,e.createGlobalState)(t,Object.assign({onInit:function(t){r(t,c),null==a||a(t)},onStateChanged:function(t){n(t,c),null==u||u(t)}},l))}},e.createCustomGlobalStateWithDecoupledFuncs=e.createCustomGlobalState},774:(t,e,r)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}function i(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return a(t)}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStore=void 0;var c=r(608),l=r(734),s=function(){return!!(null===globalThis||void 0===globalThis?void 0:globalThis.localStorage)},f=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(f,t);var e,r,n,l=(r=f,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=u(r);if(n){var o=u(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return i(this,t)});function f(t,e,r){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,f),(n=l.call(this,t,e,r))._onInitialize=function(t){var e,r,o=t.setState,i=t.getState;if(s()&&(null===(r=null===(e=n.config)||void 0===e?void 0:e.localStorage)||void 0===r?void 0:r.key)){var a=(0,c.getLocalStorageItem)({config:n.config});if(null!==a)o(a);else{var u=i();(0,c.setLocalStorageItem)({item:u,config:n.config})}}},n._onChange=function(t){var e=t.getState;s()&&(0,c.setLocalStorageItem)({item:e(),config:n.config})},n.onInitialize=null,n.onChange=null,n.onInit=function(t){var e;null===(e=n._onInitialize)||void 0===e||e.call(a(n),t)},n.onStateChanged=function(t){var e;null===(e=n._onChange)||void 0===e||e.call(a(n),t)},n.constructor!==f?i(n):(n.initialize(),n)}return e=f,Object.defineProperty(e,"prototype",{writable:!1}),e}(l.GlobalStoreAbstract);e.GlobalStore=f},608:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.setLocalStorageItem=e.getLocalStorageItem=void 0;var n=r(734);e.getLocalStorageItem=function(t){var e,r=t.config,o=null===(e=null==r?void 0:r.localStorage)||void 0===e?void 0:e.key;if(!o)return null;var i=localStorage.getItem(o);if(null===i)return null;var a=function(){var t,e=null!==(t=null==r?void 0:r.localStorage)&&void 0!==t?t:{},n=e.decrypt,o=e.encrypt;return n||o?"function"==typeof n?n(i):atob(i):i}();return(0,n.formatFromStore)(a,{jsonParse:!0})},e.setLocalStorageItem=function(t){var e,r=t.item,o=t.config,i=null===(e=null==o?void 0:o.localStorage)||void 0===e?void 0:e.key;if(!i)return null;var a=(0,n.formatToStore)(r,{stringify:!0,excludeTypes:["function"]}),u=function(){var t,e=(null!==(t=null==o?void 0:o.localStorage)&&void 0!==t?t:{}).encrypt;return e?"function"==typeof e?e(a):btoa(a):a}();localStorage.setItem(i,u)}},195:(t,e,r)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}function i(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function a(t){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},a(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStoreAbstract=void 0;var u=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(l,t);var e,r,u,c=(r=l,u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=a(r);if(u){var o=a(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return i(t)}(this,t)});function l(t,e,r){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l),(n=c.call(this,t,e,r)).onInit=function(t){var e;n._onInitialize(t),null===(e=n.onInitialize)||void 0===e||e.call(i(n),t)},n.onStateChanged=function(t){var e;n._onInitialize(t),null===(e=n.onChange)||void 0===e||e.call(i(n),t)},n}return e=l,Object.defineProperty(e,"prototype",{writable:!1}),e}(r(774).GlobalStore);e.GlobalStoreAbstract=u},991:(t,e,r)=>{"use strict";var n=Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]};Object.defineProperty(e,"__esModule",{value:!0}),e.setLocalStorageItem=e.getLocalStorageItem=e.createCustomGlobalState=e.createGlobalState=e.GlobalStoreAbstract=e.GlobalStore=e.combineRetrieverAsynchronously=e.combineAsyncGetters=e.combineRetrieverEmitterAsynchronously=e.combineAsyncGettersEmitter=e.debounce=e.shallowCompare=e.createDerivateEmitter=e.createDerivate=e.throwNoSubscribersWereAdded=e.formatToStore=e.formatFromStore=e.isPrimitive=e.isFunction=e.isRegex=e.isDate=e.isString=e.isBoolean=e.isNumber=e.isNil=e.clone=void 0;var o=r(734);Object.defineProperty(e,"clone",{enumerable:!0,get:function(){return o.clone}}),Object.defineProperty(e,"isNil",{enumerable:!0,get:function(){return o.isNil}}),Object.defineProperty(e,"isNumber",{enumerable:!0,get:function(){return o.isNumber}}),Object.defineProperty(e,"isBoolean",{enumerable:!0,get:function(){return o.isBoolean}}),Object.defineProperty(e,"isString",{enumerable:!0,get:function(){return o.isString}}),Object.defineProperty(e,"isDate",{enumerable:!0,get:function(){return o.isDate}}),Object.defineProperty(e,"isRegex",{enumerable:!0,get:function(){return o.isRegex}}),Object.defineProperty(e,"isFunction",{enumerable:!0,get:function(){return o.isFunction}}),Object.defineProperty(e,"isPrimitive",{enumerable:!0,get:function(){return o.isPrimitive}}),Object.defineProperty(e,"formatFromStore",{enumerable:!0,get:function(){return o.formatFromStore}}),Object.defineProperty(e,"formatToStore",{enumerable:!0,get:function(){return o.formatToStore}}),Object.defineProperty(e,"throwNoSubscribersWereAdded",{enumerable:!0,get:function(){return o.throwNoSubscribersWereAdded}}),Object.defineProperty(e,"createDerivate",{enumerable:!0,get:function(){return o.createDerivate}}),Object.defineProperty(e,"createDerivateEmitter",{enumerable:!0,get:function(){return o.createDerivateEmitter}}),Object.defineProperty(e,"shallowCompare",{enumerable:!0,get:function(){return o.shallowCompare}}),Object.defineProperty(e,"debounce",{enumerable:!0,get:function(){return o.debounce}}),Object.defineProperty(e,"combineAsyncGettersEmitter",{enumerable:!0,get:function(){return o.combineAsyncGettersEmitter}}),Object.defineProperty(e,"combineRetrieverEmitterAsynchronously",{enumerable:!0,get:function(){return o.combineRetrieverEmitterAsynchronously}}),Object.defineProperty(e,"combineAsyncGetters",{enumerable:!0,get:function(){return o.combineAsyncGetters}}),Object.defineProperty(e,"combineRetrieverAsynchronously",{enumerable:!0,get:function(){return o.combineRetrieverAsynchronously}});var i=r(774);Object.defineProperty(e,"GlobalStore",{enumerable:!0,get:function(){return i.GlobalStore}});var a=r(195);Object.defineProperty(e,"GlobalStoreAbstract",{enumerable:!0,get:function(){return a.GlobalStoreAbstract}});var u=r(853);Object.defineProperty(e,"createGlobalState",{enumerable:!0,get:function(){return u.createGlobalState}}),Object.defineProperty(e,"createCustomGlobalState",{enumerable:!0,get:function(){return u.createCustomGlobalState}});var c=r(608);Object.defineProperty(e,"getLocalStorageItem",{enumerable:!0,get:function(){return c.getLocalStorageItem}}),Object.defineProperty(e,"setLocalStorageItem",{enumerable:!0,get:function(){return c.setLocalStorageItem}}),function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)}(r(113),e)},684:function(t){t.exports=(()=>{"use strict";var t={991:(t,e,r)=>{var n=Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]};Object.defineProperty(e,"__esModule",{value:!0}),function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)}(r(729),e)},729:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t,e,n){return(e=function(t){var e=function(t,e){if("object"!==r(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,"string");if("object"!==r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===r(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){if(t){if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}Object.defineProperty(e,"__esModule",{value:!0}),e.formatToStore=e.formatFromStore=e.isPrimitive=e.isFunction=e.isRegex=e.isDate=e.isString=e.isBoolean=e.isNumber=e.isNil=e.clone=void 0,e.clone=function(t){var r,a=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).shallow;if((0,e.isPrimitive)(t)||(0,e.isDate)(t))return t;if(Array.isArray(t))return a?function(t){if(Array.isArray(t))return i(t)}(r=t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||o(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}():t.map((function(t){return(0,e.clone)(t)}));if(t instanceof Map){var u=Array.from(t.entries());return a?new Map(u):new Map(u.map((function(t){return(0,e.clone)(t)})))}if(t instanceof Set){var c=Array.from(t.values());return a?new Set(c):new Set(c.map((function(t){return(0,e.clone)(t)})))}return t instanceof RegExp?new RegExp(t.toString()):(0,e.isFunction)(t)?a?t:Object.create(t):a?Object.assign({},t):t instanceof Error?new Error(t.message):Object.keys(t).reduce((function(r,o){var i=t[o];return Object.assign(Object.assign({},r),n({},o,(0,e.clone)(i)))}),{})},e.isNil=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isBoolean=function(t){return"boolean"==typeof t},e.isString=function(t){return"string"==typeof t},e.isDate=function(t){return t instanceof Date},e.isRegex=function(t){return t instanceof RegExp},e.isFunction=function(t){return"function"==typeof t||t instanceof Function},e.isPrimitive=function(t){return(0,e.isNil)(t)||(0,e.isNumber)(t)||(0,e.isBoolean)(t)||(0,e.isString)(t)||"symbol"===r(t)},e.formatFromStore=function(t){return function(t){var r,i;if((0,e.isPrimitive)(t))return t;if("date"===(null==t?void 0:t.$t))return new Date(t.$v);if("map"===(null==t?void 0:t.$t)){var a=(null!==(r=t.$v)&&void 0!==r?r:[]).map((function(t){var r,n=(2,function(t){if(Array.isArray(t))return t}(r=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{for(i=(r=r.call(t)).next,0;!(c=(n=i.call(r)).done)&&(u.push(n.value),2!==u.length);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(r)||o(r,2)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=n[0],a=n[1];return[i,(0,e.formatFromStore)(a)]}));return new Map(a)}if("set"===(null==t?void 0:t.$t)){var u=null!==(i=t.$v)&&void 0!==i?i:[].map((function(t){return(0,e.formatFromStore)(t)}));return new Set(u)}return"regex"===(null==t?void 0:t.$t)?new RegExp(t.$v):"error"===(null==t?void 0:t.$t)?new Error(t.$v):Array.isArray(t)?t.map((function(t){return(0,e.formatFromStore)(t)})):"function"===(null==t?void 0:t.$t)?Function("(".concat(t.$v,")(...arguments)")):Object.keys(t).reduce((function(r,o){var i=t[o];return Object.assign(Object.assign({},r),n({},o,(0,e.formatFromStore)(i)))}),{})}((arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).jsonParse?JSON.parse(t):(0,e.clone)(t))},e.formatToStore=function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{stringify:!1},i=o.stringify,a=o.validator,u=o.excludeTypes,c=o.excludeKeys,l=new Set(null!=u?u:[]),s=new Set(null!=c?c:[]),f=l.size||s.size,v=null!=a?a:function(t){var e=t.key,n=t.value;if(!f)return!0;var o=s.has(e),i=l.has(r(n));return!o&&!i},p=function t(r){if((0,e.isPrimitive)(r))return r;if(Array.isArray(r))return r.map((function(e){return t(e)}));if(r instanceof Map)return{$t:"map",$v:Array.from(r.entries()).map((function(e){return t(e)}))};if(r instanceof Set)return{$t:"set",$v:Array.from(r.values()).map((function(e){return t(e)}))};if((0,e.isDate)(r))return{$t:"date",$v:r.toISOString()};if((0,e.isRegex)(r))return{$t:"regex",$v:r.toString()};if((0,e.isFunction)(r)){var o;try{o={$t:"function",$v:r.toString()}}catch(t){o={$t:"error",$v:"Error: Could not serialize function"}}return o}return r instanceof Error?{$t:"error",$v:r.message}:Object.keys(r).reduce((function(e,o){var i=r[o],a=t(i);return v({obj:r,key:o,value:a})?Object.assign(Object.assign({},e),n({},o,t(i))):e}),{})}((0,e.clone)(t));return i?JSON.stringify(p):p}}},e={};return function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}(991)})()},734:function(t,e,r){var n;n=t=>{return e={852:(t,e,r)=>{"use strict";function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}Object.defineProperty(e,"__esModule",{value:!0}),e.combineRetrieverAsynchronously=e.combineAsyncGetters=e.combineRetrieverEmitterAsynchronously=e.combineAsyncGettersEmitter=void 0;var i=r(608),a=r(156),u=r(774);e.combineAsyncGettersEmitter=function(t){for(var e,r,n,o=arguments.length,a=new Array(o>1?o-1:0),c=1;c<o;c++)a[c-1]=arguments[c];var l=a,s=new Map(l.map((function(t,e){return[e,t()]}))),f=t.selector(Array.from(s.values())),v=void 0!==(null===(e=null==t?void 0:t.config)||void 0===e?void 0:e.isEqual)?null===(r=null==t?void 0:t.config)||void 0===r?void 0:r.isEqual:i.shallowCompare,p=new Set,b=(0,i.debounce)((function(){var e=t.selector(Array.from(s.values()));(null==v?void 0:v(f,e))||(f=e,p.forEach((function(t){return t()})))}),null===(n=null==t?void 0:t.config)||void 0===n?void 0:n.delay),y=l.map((function(t,e){return t((function(t){t((function(t){s.set(e,t),b()}))}))})),d=function(t,e,r){var n,o,a="function"==typeof e,u=a?t:null,c=a?e:t,l=a?r:e,s=Object.assign({delay:0,isEqual:i.shallowCompare},null!=l?l:{}),v=null!==(n=null==u?void 0:u(f))&&void 0!==n?n:f;s.skipFirst||c(v);var b=(0,i.debounce)((function(){var t,e,r=null!==(t=null==u?void 0:u(f))&&void 0!==t?t:f;(null===(e=s.isEqual)||void 0===e?void 0:e.call(s,v,r))||(v=r,c(r))}),null!==(o=s.delay)&&void 0!==o?o:0);return p.add(b),function(){p.delete(b)}};return[d,function(t){if(!t)return f;var e=[];return t((function(){e.push(d.apply(void 0,arguments))})),e.length||(0,u.throwNoSubscribersWereAdded)(),function(){e.forEach((function(t){t(),p.delete(t)}))}},function(){y.forEach((function(t){return t()}))}]},e.combineRetrieverEmitterAsynchronously=e.combineAsyncGettersEmitter,e.combineAsyncGetters=function(t){for(var r=arguments.length,o=new Array(r>1?r-1:0),u=1;u<r;u++)o[u-1]=arguments[u];var c=n(e.combineAsyncGettersEmitter.apply(void 0,[t].concat(o)),3),l=c[0],s=c[1],f=c[2];return[function(t,e){var r=n((0,a.useState)((function(){var e=s();return t?t(e):e})),2),o=r[0],u=r[1];return(0,a.useEffect)((function(){var r,n=Object.assign({delay:0,isEqual:i.shallowCompare},null!=e?e:{}),o=void 0!==n.isEqual?n.isEqual:i.shallowCompare,a=l((function(e){return t?t(e):e}),(0,i.debounce)((function(e){var r=t?t(e):e;(null==o?void 0:o(e,r))||u(r)}),null!==(r=n.delay)&&void 0!==r?r:0));return function(){a()}}),[]),[o,null,null]},s,f]},e.combineRetrieverAsynchronously=e.combineAsyncGetters},113:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createStatefulContext=void 0;var n,o=r(853),i=r(684),a=(n=r(156))&&n.__esModule?n:{default:n};e.createStatefulContext=function(t,e){var r=a.default.createContext(null);return[function(){return a.default.useContext(r)},function(n){var u=n.children,c=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(n,["children"]),l=(0,o.createGlobalState)(function(){if(c.initialValue){if("function"==typeof c.initialValue)return c.initialValue((0,i.clone)(t));var e=Array.isArray(c.initialValue),r=c.initialValue instanceof Map,n=c.initialValue instanceof Set;return(0,i.isPrimitive)(c.initialValue)||(0,i.isDate)(c.initialValue)||e||r||n?c.initialValue:Object.assign(Object.assign({},t),c.initialValue)}return t}(),e);return a.default.createElement(r.Provider,{value:l},u)}]}},853:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createDerivateEmitter=e.createDerivate=e.createCustomGlobalStateWithDecoupledFuncs=e.createCustomGlobalState=e.createGlobalState=void 0;var n=r(774);e.createGlobalState=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),o=1;o<e;o++)r[o-1]=arguments[o];var i="function"==typeof r[0],a=function(){var t;if(i){var e=r[0];return{config:r[1],actions:e()}}var n=r[0];return{config:n,actions:null!==(t=r[1])&&void 0!==t?t:null==n?void 0:n.actions}}(),u=a.config,c=a.actions;return new n.GlobalStore(t,u,c).getHook()},e.createCustomGlobalState=function(t){var r=t.onInitialize,n=t.onChange;return function(t,o){var i=null!=o?o:{},a=(i.actions,i.config),u=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(i,["actions","config"]);return(0,e.createGlobalState)(t,Object.assign({onInit:function(t){var e;r(t,a),null===(e=null==u?void 0:u.onInit)||void 0===e||e.call(u,t)},onStateChanged:function(t){var e;n(t,a),null===(e=null==u?void 0:u.onStateChanged)||void 0===e||e.call(u,t)}},u))}},e.createCustomGlobalStateWithDecoupledFuncs=e.createCustomGlobalState,e.createDerivate=function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.createSelectorHook(e,r)},e.createDerivateEmitter=function(t,r){var n=t._father_emitter;if(n){var o=function(t){var e=n.selector(t);return r(e)},i=(0,e.createDerivateEmitter)(n.getter,o);return i._father_emitter={getter:n.getter,selector:o},i}var a=function(e,n){var o="function"==typeof n,i=o?e:null,a=o?n:e,u=o?arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}:n;return t((function(t){t((function(t){var e,n=r(t);return null!==(e=null==i?void 0:i(n))&&void 0!==e?e:n}),a,u)}))};return a._father_emitter={getter:t,selector:r},a}},774:(t,e,r)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||function(t,e){if(t){if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function a(){a=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",l=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,a=Object.create(i.prototype),u=new x(n||[]);return o(a,"_invoke",{value:j(t,r,u)}),a}function v(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var p={};function b(){}function y(){}function d(){}var m={};s(m,u,(function(){return this}));var g=Object.getPrototypeOf,h=g&&g(g(_([])));h&&h!==e&&r.call(h,u)&&(m=h);var S=d.prototype=b.prototype=Object.create(m);function O(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function i(o,a,u,c){var l=v(t[o],t,a);if("throw"!==l.type){var s=l.arg,f=s.value;return f&&"object"==n(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){i("next",t,u,c)}),(function(t){i("throw",t,u,c)})):e.resolve(f).then((function(t){s.value=t,u(s)}),(function(t){return i("throw",t,u,c)}))}c(l.arg)}var a;o(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return a=a?a.then(n,n):n()}})}function j(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=P(a,r);if(u){if(u===p)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=v(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===p)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function P(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,P(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),p;var o=v(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,p;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function x(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function _(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:C}}function C(){return{value:void 0,done:!0}}return y.prototype=d,o(S,"constructor",{value:d,configurable:!0}),o(d,"constructor",{value:y,configurable:!0}),y.displayName=s(d,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,s(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},O(w.prototype),s(w.prototype,c,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(S),s(S,l,"Generator"),s(S,u,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=_,x.prototype={constructor:x,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(A),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:_(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function u(t){var e=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,"string");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===n(e)?e:String(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStore=e.throwNoSubscribersWereAdded=void 0;var c=r(608),l=r(156);e.throwNoSubscribersWereAdded=function(){throw new Error("No new subscribers were added, please make sure to add at least one subscriber with the subscribe method")};var s=function(){function t(r,n){var i=this,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actionsConfig=s,this.subscribers=new Map,this.actions=null,this.config={metadata:null},this.initialize=function(){return t=i,e=void 0,r=a().mark((function t(){var e,r,n;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.actionsConfig&&(this.actions=this.getStoreActionsMap()),e=this.onInit,r=this.config.onInit,e||r){t.next=5;break}return t.abrupt("return");case 5:n=this.getConfigCallbackParam(),null==e||e(n),null==r||r(n);case 8:case"end":return t.stop()}}),t,this)})),new(e||(e=Promise))((function(n,o){function i(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var r;t.done?n(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(i,a)}u((r=r.apply(t,[])).next())}));var t,e,r},this.setState=function(t){var e=t.state,r=t.forceUpdate,n=t.identifier,o=i.stateWrapper.state;i.stateWrapper={state:e};for(var a=function(t){var i,a,u=t.selector,c=t.callback,l=t.currentState,s=t.config;if(r||!(null!==(i=null==s?void 0:s.isEqualRoot)&&void 0!==i?i:function(t,e){return Object.is(t,e)})(o,e)){var f=u?u(e):e;!r&&(null!==(a=null==s?void 0:s.isEqual)&&void 0!==a?a:function(t,e){return Object.is(t,e)})(l,f)||c({state:f,identifier:n})}},u=Array.from(i.subscribers.values()),c=0;c<u.length;c++)a(u[c])},this.setMetadata=function(t){var e,r,n="function"==typeof t?t(null!==(e=i.config.metadata)&&void 0!==e?e:null):t;i.config=Object.assign(Object.assign({},null!==(r=i.config)&&void 0!==r?r:{}),{metadata:n})},this.getMetadata=function(){var t;return null!==(t=i.config.metadata)&&void 0!==t?t:null},this.createChangesSubscriber=function(t){var e=t.callback,r=t.selector,n=t.config,o=r?r(i.stateWrapper.state):i.stateWrapper.state,a={state:o};return(null==n?void 0:n.skipFirst)||e(o),{stateWrapper:a,subscriptionCallback:function(t){var r=t.state;a.state=r,e(r)}}},this.getState=function(t){if(!t)return i.stateWrapper.state;var r=[];return t((function(t,e,n){var o="function"==typeof e,a=o?t:null,u=o?e:t,l=o?n:e,s=i.createChangesSubscriber({selector:a,callback:u,config:l}),f=s.subscriptionCallback,v=s.stateWrapper,p=(0,c.uniqueId)();i.addNewSubscriber(p,{subscriptionId:p,selector:a,config:l,currentState:v.state,callback:f}),r.push(p)})),r.length||(0,e.throwNoSubscribersWereAdded)(),function(){for(var t=0;t<r.length;t++){var e=r[t];i.subscribers.delete(e)}}},this.getConfigCallbackParam=function(){var t=i.setMetadata,e=i.getMetadata,r=i.getState,n=i.actions;return{setMetadata:t,getMetadata:e,getState:r,setState:i.setStateWrapper,actions:n}},this.addNewSubscriber=function(t,e){i.subscribers.set(t,e)},this.updateSubscriptionIfExists=function(t,e){i.subscribers.has(t)&&Object.assign(i.subscribers.get(t),e)},this.executeOnSubscribed=function(){var t=i.onSubscribed,e=i.config.onSubscribed;if(t||e){var r=i.getConfigCallbackParam();null==t||t(r),null==e||e(r)}},this.getHook=function(){var t=function(t){var e,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=function(){return t?{state:t(i.stateWrapper.state)}:{state:i.stateWrapper.state}},u=o((0,l.useState)(a),2),s=u[0],f=u[1],v=(0,l.useRef)(null);(0,l.useEffect)((function(){if(null===v.current){var e=(0,c.uniqueId)();v.current=e,i.addNewSubscriber(e,{subscriptionId:e,currentState:s.state,selector:t,config:n,callback:f}),i.executeOnSubscribed()}var r=v.current;return i.updateSubscriptionIfExists(r,{subscriptionId:r,currentState:s.state,selector:t,config:n,callback:f}),function(){i.subscribers.delete(v.current)}}),[]);var p=v.current,b=i.subscribers.get(p),y=(null!==(e=null==b?void 0:b.config)&&void 0!==e?e:{dependencies:n.dependencies}).dependencies;return i.updateSubscriptionIfExists(p,{subscriptionId:p,currentState:s.state,selector:t,config:n,callback:f}),[function(){if(!t||!p)return s.state;var e=n.dependencies;if(y===e)return s.state;if((null==y?void 0:y.length)===(null==e?void 0:e.length)&&(0,c.shallowCompare)(y,e))return s.state;var r=a();return i.updateSubscriptionIfExists(p,{subscriptionId:p,currentState:r.state,selector:t,config:n,callback:f}),s.state=r.state,r.state}(),i.getStateOrchestrator(),null!==(r=i.config.metadata)&&void 0!==r?r:null]};return t.stateControls=i.stateControls,t.createSelectorHook=i.createSelectorHook,t},this.createSelectorHook=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.isEqualRoot,a=r.isEqual,u=new Map,s=o(i.stateControls(),3),f=s[0],v=s[1],p=s[2],b=f(),y=(null!=t?t:function(t){return t})(f());f((function(e){e((function(e){if(!(null!=n?n:Object.is)(b,e)){b=e;var r=t(e);(null!=a?a:Object.is)(y,r)||(y=r,u.forEach((function(t){t.callback({state:y})})))}}),{skipFirst:!0})}));var d=function(t,e){u.set(t,e)},m=function(t,e){u.has(t)&&Object.assign(u.get(t),e)},g=function(t){if(!t)return y;var r=[];return t((function(t,e,n){var o="function"==typeof e,i=o?t:null,a=o?n:e,u=function(t){var e=t.callback,r=t.selector,n=t.config,o=(null!=r?r:function(t){return t})(y),i={state:o};return(null==n?void 0:n.skipFirst)||e(o),{stateWrapper:i,subscriptionCallback:function(t){var r=t.state;i.state=r,e(r)}}}({selector:i,callback:o?e:t,config:a}),l=u.subscriptionCallback,s=u.stateWrapper,f=(0,c.uniqueId)();d(f,{subscriptionId:f,selector:i,config:a,currentState:s.state,callback:l}),r.push(f)})),r.length||(0,e.throwNoSubscribersWereAdded)(),function(){for(var t=0;t<r.length;t++){var e=r[t];u.delete(e)}}},h=function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=(r.isEqualRoot,r.isEqual,function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(t);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(r[n[o]]=t[n[o]])}return r}(r,["isEqualRoot","isEqual"])),a=function(){return t?{state:t(y)}:{state:y}},s=o((0,l.useState)(a),2),f=s[0],b=s[1],h=(0,l.useRef)(null);(0,l.useEffect)((function(){if(null===h.current){var e=(0,c.uniqueId)();h.current=e,d(e,{subscriptionId:e,currentState:f.state,selector:t,config:n,callback:b})}var r=h.current;i.updateSubscriptionIfExists(r,{subscriptionId:r,currentState:f.state,selector:t,config:n,callback:b});var o=g((function(t){var e=y;t((function(t){var r,n,o,i,a=u.get(h.current);if(!(null!==(n=null===(r=a.config)||void 0===r?void 0:r.isEqualRoot)&&void 0!==n?n:Object.is)(e,t)){e=t;var c=(null!==(o=a.selector)&&void 0!==o?o:function(t){return t})(y);(null!==(i=null==a?void 0:a.config.isEqual)&&void 0!==i?i:Object.is)(c,a.currentState)||(a.currentState=c,a.callback({state:c}))}}))}));return function(){o(),u.delete(h.current)}}),[]);var S=h.current,O=u.get(S),w=(null!==(e=null==O?void 0:O.config)&&void 0!==e?e:{dependencies:n.dependencies}).dependencies;return m(S,{subscriptionId:S,currentState:f.state,selector:t,config:n,callback:b}),[function(){if(!t||!S)return f.state;var e=n.dependencies;if(w===e)return f.state;if((null==w?void 0:w.length)===(null==e?void 0:e.length)&&(0,c.shallowCompare)(w,e))return f.state;var r=a();return m(S,{subscriptionId:S,currentState:r.state,selector:t,config:n,callback:b}),f.state=r.state,r.state}(),v,p]};return h.stateControls=function(){return[g,v,p]},h.createSelectorHook=i.createSelectorHook.bind(h),Object.assign(h,{subscribers:u}),h},this.stateControls=function(){var t=i.getStateOrchestrator(),e=i.getMetadata;return[i.getState,t,e]},this.getStateOrchestrator=function(){return i.actions?i.actions:i.setStateWrapper},this.hasStateCallbacks=function(){var t=i.computePreventStateChange,e=i.onStateChanged,r=i.config,n=r.computePreventStateChange,o=r.onStateChanged;return!!(t||n||e||o)},this.setStateWrapper=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.forceUpdate,n=e.identifier,o="function"==typeof t,a=i.stateWrapper.state,u=o?t(a):t;if(r||!Object.is(i.stateWrapper.state,u)){var c=i.setMetadata,l=i.getMetadata,s=i.getState,f=i.actions,v={setMetadata:c,getMetadata:l,setState:i.setState,getState:s,actions:f,previousState:a,state:u,identifier:n},p=i.computePreventStateChange,b=i.config.computePreventStateChange;if((p||b)&&((null==p?void 0:p(v))||(null==b?void 0:b(v))))return;i.setState({forceUpdate:r,identifier:n,state:u});var y=i.onStateChanged,d=i.config.onStateChanged;(y||d)&&(null==y||y(v),null==d||d(v))}},this.getStoreActionsMap=function(){if(!i.actionsConfig)return null;var t=i.actionsConfig,e=i.setMetadata,r=i.setStateWrapper,n=i.getState,o=i.getMetadata,a=Object.keys(t).reduce((function(i,c){var l,s,f;return Object.assign(i,(l={},f=function(){for(var i=t[c],u=arguments.length,l=new Array(u),s=0;s<u;s++)l[s]=arguments[s];var f=i.apply(a,l);return"function"!=typeof f&&function(t){throw new Error("[WRONG CONFIGURATION!]: Every key inside the storeActionsConfig must be a higher order function that returns a function \n[".concat(t,"]: key is not a valid function, try something like this: \n{\n\n ").concat(t,": (param) => ({ setState, getState, setMetadata, getMetadata, actions }) => {\n\n setState((state) => ({ ...state, ...param }))\n\n }\n\n}\n"))}(c),f.call(a,{setState:r,getState:n,setMetadata:e,getMetadata:o,actions:a})},(s=u(s=c))in l?Object.defineProperty(l,s,{value:f,enumerable:!0,configurable:!0,writable:!0}):l[s]=f,l)),i}),{});return a},this.stateWrapper={state:r},this.config=Object.assign({metadata:null},null!=n?n:{}),(null===globalThis||void 0===globalThis?void 0:globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG)&&globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG(this,r,n,s),this.constructor!==t||this.initialize()}var r,n;return r=t,(n=[{key:"state",get:function(){return this.stateWrapper.state}}])&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,u(n.key),n)}}(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),t}();e.GlobalStore=s},530:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0})},608:(t,e,r)=>{"use strict";function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(u.push(n.value),u.length!==e);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(t,e)||i(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=i(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){c=!0,a=t},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw a}}}}function i(t,e){if(t){if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(t,e):void 0}}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function u(t){return u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},u(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.uniqueId=e.debounce=e.shallowCompare=void 0;var c=r(684);e.shallowCompare=function(t,e){if(t===e)return!0;var r=u(t),i=u(e);if(r!==i)return!1;if((0,c.isNil)(t)||(0,c.isNil)(e)||(0,c.isPrimitive)(t)&&(0,c.isPrimitive)(e)||(0,c.isDate)(t)&&(0,c.isDate)(e)||"function"===r&&"function"===i)return t===e;if(Array.isArray(t)){var a=t,l=e;if(a.length!==l.length)return!1;for(var s=0;s<a.length;s++)if(a[s]!==l[s])return!1}if(t instanceof Map){var f=t,v=e;if(f.size!==v.size)return!1;var p,b=o(f);try{for(b.s();!(p=b.n()).done;){var y=n(p.value,2),d=y[0];if(y[1]!==v.get(d))return!1}}catch(t){b.e(t)}finally{b.f()}}if(t instanceof Set){var m=t,g=e;if(m.size!==g.size)return!1;var h,S=o(m);try{for(S.s();!(h=S.n()).done;){var O=h.value;if(!g.has(O))return!1}}catch(t){S.e(t)}finally{S.f()}}var w=Object.keys(t),j=Object.keys(e);if(w.length!==j.length)return!1;for(var P=0,E=w;P<E.length;P++){var A=E[P];if(t[A]!==e[A])return!1}return!0},e.debounce=function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];e&&clearTimeout(e),e=setTimeout((function(){t.apply(void 0,o)}),r)}},e.uniqueId=function(){return Date.now().toString(36)+Math.random().toString(36).substr(2,5)}},195:(t,e,r)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}function i(t){return i=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},i(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStoreAbstract=void 0;var a=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&o(t,e)}(c,t);var e,r,a,u=(r=c,a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=i(r);if(a){var o=i(this).constructor;t=Reflect.construct(e,arguments,o)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function c(t,e,r){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(n=u.call(this,t,e,r)).onInit=function(t){n.onInitialize(t)},n.onStateChanged=function(t){n.onChange(t)},n}return e=c,Object.defineProperty(e,"prototype",{writable:!1}),e}(r(774).GlobalStore);e.GlobalStoreAbstract=a},991:(t,e,r)=>{"use strict";var n=Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]},o=function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),o(r(684),e),o(r(530),e),o(r(774),e),o(r(195),e),o(r(853),e),o(r(608),e),o(r(852),e),o(r(113),e)},684:function(t){t.exports=(()=>{"use strict";var t={991:(t,e,r)=>{var n=Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]};Object.defineProperty(e,"__esModule",{value:!0}),function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)}(r(729),e)},729:(t,e)=>{function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t,e,n){return(e=function(t){var e=function(t,e){if("object"!==r(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,"string");if("object"!==r(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===r(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){if(t){if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(t,e):void 0}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}Object.defineProperty(e,"__esModule",{value:!0}),e.formatToStore=e.formatFromStore=e.isPrimitive=e.isFunction=e.isRegex=e.isDate=e.isString=e.isBoolean=e.isNumber=e.isNil=e.clone=void 0,e.clone=function(t){var r,a=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).shallow;if((0,e.isPrimitive)(t)||(0,e.isDate)(t))return t;if(Array.isArray(t))return a?function(t){if(Array.isArray(t))return i(t)}(r=t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(r)||o(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}():t.map((function(t){return(0,e.clone)(t)}));if(t instanceof Map){var u=Array.from(t.entries());return a?new Map(u):new Map(u.map((function(t){return(0,e.clone)(t)})))}if(t instanceof Set){var c=Array.from(t.values());return a?new Set(c):new Set(c.map((function(t){return(0,e.clone)(t)})))}return t instanceof RegExp?new RegExp(t.toString()):(0,e.isFunction)(t)?a?t:Object.create(t):a?Object.assign({},t):t instanceof Error?new Error(t.message):Object.keys(t).reduce((function(r,o){var i=t[o];return Object.assign(Object.assign({},r),n({},o,(0,e.clone)(i)))}),{})},e.isNil=function(t){return null==t},e.isNumber=function(t){return"number"==typeof t},e.isBoolean=function(t){return"boolean"==typeof t},e.isString=function(t){return"string"==typeof t},e.isDate=function(t){return t instanceof Date},e.isRegex=function(t){return t instanceof RegExp},e.isFunction=function(t){return"function"==typeof t||t instanceof Function},e.isPrimitive=function(t){return(0,e.isNil)(t)||(0,e.isNumber)(t)||(0,e.isBoolean)(t)||(0,e.isString)(t)||"symbol"===r(t)},e.formatFromStore=function(t){return function(t){var r,i;if((0,e.isPrimitive)(t))return t;if("date"===(null==t?void 0:t.$t))return new Date(t.$v);if("map"===(null==t?void 0:t.$t)){var a=(null!==(r=t.$v)&&void 0!==r?r:[]).map((function(t){var r,n=function(t){if(Array.isArray(t))return t}(r=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,u=[],c=!0,l=!1;try{for(i=(r=r.call(t)).next;!(c=(n=i.call(r)).done)&&(u.push(n.value),2!==u.length);c=!0);}catch(t){l=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return u}}(r)||o(r,2)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),i=n[0],a=n[1];return[i,(0,e.formatFromStore)(a)]}));return new Map(a)}if("set"===(null==t?void 0:t.$t)){var u=null!==(i=t.$v)&&void 0!==i?i:[].map((function(t){return(0,e.formatFromStore)(t)}));return new Set(u)}return"regex"===(null==t?void 0:t.$t)?new RegExp(t.$v):"error"===(null==t?void 0:t.$t)?new Error(t.$v):Array.isArray(t)?t.map((function(t){return(0,e.formatFromStore)(t)})):"function"===(null==t?void 0:t.$t)?Function("(".concat(t.$v,")(...arguments)")):Object.keys(t).reduce((function(r,o){var i=t[o];return Object.assign(Object.assign({},r),n({},o,(0,e.formatFromStore)(i)))}),{})}((arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).jsonParse?JSON.parse(t):(0,e.clone)(t))},e.formatToStore=function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{stringify:!1},i=o.stringify,a=o.validator,u=o.excludeTypes,c=o.excludeKeys,l=new Set(null!=u?u:[]),s=new Set(null!=c?c:[]),f=l.size||s.size,v=null!=a?a:function(t){var e=t.key,n=t.value;if(!f)return!0;var o=s.has(e),i=l.has(r(n));return!o&&!i},p=function t(r){if((0,e.isPrimitive)(r))return r;if(Array.isArray(r))return r.map((function(e){return t(e)}));if(r instanceof Map)return{$t:"map",$v:Array.from(r.entries()).map((function(e){return t(e)}))};if(r instanceof Set)return{$t:"set",$v:Array.from(r.values()).map((function(e){return t(e)}))};if((0,e.isDate)(r))return{$t:"date",$v:r.toISOString()};if((0,e.isRegex)(r))return{$t:"regex",$v:r.toString()};if((0,e.isFunction)(r)){var o;try{o={$t:"function",$v:r.toString()}}catch(t){o={$t:"error",$v:"Error: Could not serialize function"}}return o}return r instanceof Error?{$t:"error",$v:r.message}:Object.keys(r).reduce((function(e,o){var i=r[o],a=t(i);return v({obj:r,key:o,value:a})?Object.assign(Object.assign({},e),n({},o,t(i))):e}),{})}((0,e.clone)(t));return i?JSON.stringify(p):p}}},e={};return function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}(991)})()},156:e=>{"use strict";e.exports=t}},r={},function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n].call(i.exports,i,i.exports,t),i.exports}(991);var e,r},t.exports=n(r(156))},156:e=>{"use strict";e.exports=t}},r={},function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n].call(i.exports,i,i.exports,t),i.exports}(991);var e,r}));
@@ -1,5 +1,18 @@
1
1
  import React from 'react';
2
- import { ActionCollectionConfig, createStateConfig, StateHook, StateSetter, ActionCollectionResult, StateGetter } from 'react-hooks-global-states';
3
- export declare const createStatefulContext: <TState, TMetadata = null, TActions extends ActionCollectionConfig<TState, TMetadata> = null>(initialValue: TState, parameters?: createStateConfig<TState, TMetadata, TActions>) => readonly [() => [hook: StateHook<TState, keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TActions>, TMetadata>, stateRetriever: StateGetter<TState>, stateRetriever: keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TActions>], React.FC<React.PropsWithChildren<{
4
- initialValue?: Partial<TState>;
2
+ import { ActionCollectionConfig, StateHook, StateSetter, ActionCollectionResult, StateGetter, StateChanges, StoreTools } from 'react-hooks-global-states';
3
+ export declare const createStatefulContext: <State, Metadata = null, ActionsConfig extends {} | ActionCollectionConfig<State, Metadata> = null>(initialValue: State, parameters?: Readonly<{
4
+ /**
5
+ * Non reactive data of the store
6
+ * */
7
+ metadata?: Metadata;
8
+ /**
9
+ * actions configuration for restricting the manipulation of the state
10
+ */
11
+ actions?: ActionsConfig;
12
+ onInit?: (storeAPI: StoreTools<State, Metadata>) => void;
13
+ onStateChanged?: (storeAPI: StoreTools<State, Metadata> & StateChanges<State>) => void;
14
+ onSubscribed?: (storeAPI: StoreTools<State, Metadata>) => void;
15
+ computePreventStateChange?: (storeAPI: StoreTools<State, Metadata>) => boolean;
16
+ }>) => readonly [() => [hook: StateHook<State, ActionsConfig extends null ? StateSetter<State> : ActionCollectionResult<State, Metadata, ActionsConfig>, Metadata>, stateRetriever: StateGetter<State>, stateMutator: ActionsConfig extends null ? StateSetter<State> : ActionCollectionResult<State, Metadata, ActionsConfig>], React.FC<React.PropsWithChildren<{
17
+ initialValue?: Partial<State>;
5
18
  }>>];
@@ -1,10 +1,10 @@
1
1
  import { GlobalStoreConfig } from './GlobalStore.types';
2
- import { ActionCollectionConfig, GlobalStoreAbstract, StateChangesParam, StateConfigCallbackParam, StateSetter } from 'react-hooks-global-states';
3
- export declare class GlobalStore<TState, TMetadata = null, TStateMutator extends ActionCollectionConfig<TState, TMetadata> | StateSetter<TState> = StateSetter<TState>> extends GlobalStoreAbstract<TState, TMetadata, NonNullable<TStateMutator>> {
4
- protected config: GlobalStoreConfig<TState, TMetadata, TStateMutator>;
5
- constructor(state: TState, config?: GlobalStoreConfig<TState, TMetadata, TStateMutator>, actionsConfig?: TStateMutator | null);
6
- protected _onInitialize: ({ setState, getState, }: StateConfigCallbackParam<TState, TMetadata>) => void;
7
- protected _onChange: ({ getState, }: StateChangesParam<TState, TMetadata, NonNullable<TStateMutator>>) => void;
2
+ import { ActionCollectionConfig, BaseMetadata, GlobalStoreAbstract, StateChanges, StoreTools } from 'react-hooks-global-states';
3
+ export declare class GlobalStore<State, Metadata extends BaseMetadata, ActionsConfig extends ActionCollectionConfig<State, Metadata> | null | {} = null> extends GlobalStoreAbstract<State, Metadata, ActionsConfig> {
4
+ protected config: GlobalStoreConfig<State, Metadata>;
5
+ constructor(state: State, config?: GlobalStoreConfig<State, Metadata>, actionsConfig?: ActionsConfig);
6
+ protected _onInitialize: ({ setState, getState, }: StoreTools<State, Metadata>) => void;
7
+ protected _onChange: ({ getState, }: StoreTools<State, Metadata> & StateChanges<State>) => void;
8
8
  /**
9
9
  * We set it to null so the instances of the GlobalStoreAbstract can override it.
10
10
  */
@@ -14,6 +14,6 @@ export declare class GlobalStore<TState, TMetadata = null, TStateMutator extends
14
14
  * Instead of calling onInitialize and onChange directly, we call the _onInitialize and _onChange
15
15
  * This allows the concat the logic of the GlobalStore with the logic of the extension class.
16
16
  */
17
- protected onInit: (parameters: StateConfigCallbackParam<TState, TMetadata, TStateMutator>) => void;
18
- protected onStateChanged: (parameters: StateChangesParam<TState, TMetadata, TStateMutator>) => void;
17
+ protected onInit: any;
18
+ protected onStateChanged: any;
19
19
  }
@@ -1,18 +1,115 @@
1
- import { createStateConfig, CustomGlobalHookParams } from './GlobalStore.types';
2
- import { ActionCollectionConfig, ActionCollectionResult, AvoidNever, CustomGlobalHookBuilderParams, StateGetter, StateHook, StateSetter } from 'react-hooks-global-states';
1
+ import { LocalStorageConfig } from './GlobalStore.types';
2
+ import { ActionCollectionConfig, ActionCollectionResult, BaseMetadata, CustomGlobalHookBuilderParams, MetadataSetter, StateChanges, StateGetter, StateHook, StateSetter, StoreTools } from 'react-hooks-global-states';
3
3
  /**
4
- * Creates a global state with the given state and config.
5
- * @returns {} [HOOK, DECOUPLED_RETRIEVER, DECOUPLED_MUTATOR] this is an array with the hook, the decoupled getState function and the decoupled setter of the state
4
+ * Creates a global hook that can be used to access the state and actions across the application
5
+ * @returns {} - () => [TState, Setter, TMetadata] the hook that can be used to access the state and the setter of the state
6
6
  */
7
- export declare const createGlobalStateWithDecoupledFuncs: <TState, TMetadata = null, TActions extends ActionCollectionConfig<TState, TMetadata> = null>(state: TState, { actions, ...config }?: createStateConfig<TState, TMetadata, TActions>) => [hook: StateHook<TState, keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TActions>, TMetadata>, stateRetriever: StateGetter<TState>, stateMutator: keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TActions>];
7
+ export declare const createGlobalState: {
8
+ <State>(state: State): StateHook<State, StateSetter<State>, BaseMetadata>;
9
+ <State_1, Metadata extends BaseMetadata, ActionsConfig extends {} | ActionCollectionConfig<State_1, Metadata> = null, StoreAPI = {
10
+ setMetadata: MetadataSetter<Metadata>;
11
+ setState: StateSetter<State_1>;
12
+ getState: StateGetter<State_1>;
13
+ getMetadata: () => Metadata;
14
+ actions: ActionsConfig extends null ? null : Record<string, (...args: any[]) => void>;
15
+ }>(state: State_1, config: Readonly<{
16
+ /**
17
+ * @deprecated We needed to move the actions parameter as a third argument to fix several issues with the type inference of the actions
18
+ */
19
+ actions?: ActionsConfig;
20
+ /**
21
+ * Non reactive information about the state
22
+ */
23
+ metadata?: Metadata;
24
+ /**
25
+ * executes immediately after the store is created
26
+ * */
27
+ onInit?: (args: StoreAPI) => void;
28
+ onStateChanged?: (args: StoreAPI & StateChanges<State_1>) => void;
29
+ onSubscribed?: (args: StoreAPI) => void;
30
+ /**
31
+ * callback function called every time the state is about to change and it allows you to prevent the state change
32
+ */
33
+ computePreventStateChange?: (args: StoreAPI & StateChanges<State_1>) => boolean;
34
+ } & LocalStorageConfig>): StateHook<State_1, ActionsConfig extends null ? StateSetter<State_1> : ActionCollectionResult<State_1, Metadata, ActionsConfig>, Metadata>;
35
+ <State_2, Metadata_1 extends BaseMetadata, ActionsConfig_1 extends ActionCollectionConfig<State_2, Metadata_1>, StoreAPI_1 = {
36
+ setMetadata: MetadataSetter<Metadata_1>;
37
+ setState: StateSetter<State_2>;
38
+ getState: StateGetter<State_2>;
39
+ getMetadata: () => Metadata_1;
40
+ actions: Record<string, (...args: any[]) => void>;
41
+ }>(state: State_2, config: Readonly<{
42
+ /**
43
+ * Non reactive information about the state
44
+ */
45
+ metadata?: Metadata_1;
46
+ /**
47
+ * executes immediately after the store is created
48
+ * */
49
+ onInit?: (args: StoreAPI_1) => void;
50
+ onStateChanged?: (args: StoreAPI_1 & StateChanges<State_2>) => void;
51
+ onSubscribed?: (args: StoreAPI_1) => void;
52
+ /**
53
+ * callback function called every time the state is about to change and it allows you to prevent the state change
54
+ */
55
+ computePreventStateChange?: (args: StoreAPI_1 & StateChanges<State_2>) => boolean;
56
+ } & LocalStorageConfig>, actions: ActionsConfig_1): StateHook<State_2, ActionCollectionResult<State_2, Metadata_1, ActionsConfig_1>, Metadata_1>;
57
+ <State_3, Metadata_2 extends BaseMetadata, ActionsConfig_2 extends ActionCollectionConfig<State_3, Metadata_2>, StoreAPI_2 = {
58
+ setMetadata: MetadataSetter<Metadata_2>;
59
+ setState: StateSetter<State_3>;
60
+ getState: StateGetter<State_3>;
61
+ getMetadata: () => Metadata_2;
62
+ }>(state: State_3, builder: () => ActionsConfig_2, config?: Readonly<{
63
+ /**
64
+ * Non reactive information about the state
65
+ */
66
+ metadata?: Metadata_2;
67
+ /**
68
+ * executes immediately after the store is created
69
+ * */
70
+ onInit?: (args: StoreAPI_2) => void;
71
+ onStateChanged?: (args: StoreAPI_2 & StateChanges<State_3>) => void;
72
+ onSubscribed?: (args: StoreAPI_2) => void;
73
+ /**
74
+ * callback function called every time the state is about to change and it allows you to prevent the state change
75
+ */
76
+ computePreventStateChange?: (args: StoreAPI_2 & StateChanges<State_3>) => boolean;
77
+ } & LocalStorageConfig>): StateHook<State_3, ActionCollectionResult<State_3, Metadata_2, ActionsConfig_2>, Metadata_2>;
78
+ };
8
79
  /**
9
- * Creates a global hook that can be used to access the state and actions across the application
10
- * @returns {} - () => [TState, stateMutator, TMetadata] the hook that can be used to access the state and the stateMutator of the state
80
+ * @description
81
+ * Use this function to create a custom global store.
82
+ * You can use this function to create a store with async storage.
11
83
  */
12
- export declare const createGlobalState: <TState, TMetadata = null, TActions extends ActionCollectionConfig<TState, TMetadata> = null>(state: TState, config?: createStateConfig<TState, TMetadata, TActions>) => StateHook<TState, keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, TMetadata, TActions>, TMetadata>;
84
+ export declare const createCustomGlobalState: <InheritMetadata extends BaseMetadata, CustomConfig extends Record<string, any>>({ onInitialize, onChange, }: CustomGlobalHookBuilderParams<InheritMetadata, CustomConfig>) => <State, Metadata extends BaseMetadata = InheritMetadata, ActionsConfig extends Readonly<ActionCollectionConfig<State, Metadata & InheritMetadata>> = null>(state: State, _config?: Readonly<{
85
+ metadata?: Metadata & InheritMetadata;
86
+ readonly actions?: Readonly<ActionsConfig>;
87
+ onInit?: (args: StoreTools<State, Metadata & InheritMetadata>) => void;
88
+ onStateChanged?: (args: StoreTools<State, Metadata & InheritMetadata> & StateChanges<State>) => void;
89
+ onSubscribed?: (parameters: StoreTools<State, Metadata & InheritMetadata>) => void;
90
+ computePreventStateChange?: (args: StoreTools<State, Metadata & InheritMetadata> & StateChanges<State>) => boolean;
91
+ /**
92
+ * @description
93
+ * Type of the configuration object that the custom hook will require or accept
94
+ */
95
+ config?: CustomConfig;
96
+ }>) => StateHook<State, Readonly<ActionsConfig> extends infer T ? T extends Readonly<ActionsConfig> ? T extends null ? StateSetter<State> : ActionCollectionResult<State, Metadata & InheritMetadata, T> : never : never, Metadata & InheritMetadata>;
13
97
  /**
14
98
  * @description
15
99
  * Use this function to create a custom global store.
16
100
  * You can use this function to create a store with async storage.
101
+ * @deprecated
17
102
  */
18
- export declare const createCustomGlobalStateWithDecoupledFuncs: <TInheritMetadata = null, TCustomConfig = null>({ onInitialize, onChange, }: CustomGlobalHookBuilderParams<TInheritMetadata, TCustomConfig>) => <TState, TMetadata = null, TActions extends ActionCollectionConfig<TState, AvoidNever<TInheritMetadata> & AvoidNever<TMetadata>> = null>(state: TState, { config: customConfig, onInit, onStateChanged, ...parameters }?: CustomGlobalHookParams<TCustomConfig, TState, AvoidNever<TInheritMetadata> & AvoidNever<TMetadata>, TActions>) => [hook: StateHook<TState, keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, AvoidNever<TInheritMetadata> & AvoidNever<TMetadata>, TActions>, AvoidNever<TInheritMetadata> & AvoidNever<TMetadata>>, stateRetriever: StateGetter<TState>, stateMutator: keyof TActions extends never ? StateSetter<TState> : ActionCollectionResult<TState, AvoidNever<TInheritMetadata> & AvoidNever<TMetadata>, TActions>];
103
+ export declare const createCustomGlobalStateWithDecoupledFuncs: <InheritMetadata extends BaseMetadata, CustomConfig extends Record<string, any>>({ onInitialize, onChange, }: CustomGlobalHookBuilderParams<InheritMetadata, CustomConfig>) => <State, Metadata extends BaseMetadata = InheritMetadata, ActionsConfig extends Readonly<ActionCollectionConfig<State, Metadata & InheritMetadata>> = null>(state: State, _config?: Readonly<{
104
+ metadata?: Metadata & InheritMetadata;
105
+ readonly actions?: Readonly<ActionsConfig>;
106
+ onInit?: (args: StoreTools<State, Metadata & InheritMetadata>) => void;
107
+ onStateChanged?: (args: StoreTools<State, Metadata & InheritMetadata> & StateChanges<State>) => void;
108
+ onSubscribed?: (parameters: StoreTools<State, Metadata & InheritMetadata>) => void;
109
+ computePreventStateChange?: (args: StoreTools<State, Metadata & InheritMetadata> & StateChanges<State>) => boolean;
110
+ /**
111
+ * @description
112
+ * Type of the configuration object that the custom hook will require or accept
113
+ */
114
+ config?: CustomConfig;
115
+ }>) => StateHook<State, Readonly<ActionsConfig> extends infer T ? T extends Readonly<ActionsConfig> ? T extends null ? StateSetter<State> : ActionCollectionResult<State, Metadata & InheritMetadata, T> : never : never, Metadata & InheritMetadata>;
@@ -21,23 +21,9 @@ export type LocalStorageConfig = {
21
21
  decrypt?: boolean | ((value: string) => string);
22
22
  };
23
23
  };
24
- /**
25
- * Configuration of the store (optional) - if you don't need to use the store configuration you don't need to pass this parameter
26
- * @param {StateConfigCallbackParam<TState, TMetadata> => void} onInit - callback function called when the store is initialized
27
- * @param {StateConfigCallbackParam<TState, TMetadata> => void} onSubscribed - callback function called every time a component is subscribed to the store
28
- * @param {StateChangesParam<TState, TMetadata> => boolean} computePreventStateChange - callback function called every time the state is changed and it allows you to prevent the state change
29
- * @param {StateChangesParam<TState, TMetadata> => void} onStateChanged - callback function called every time the state is changed
30
- * @template TState - the type of the state
31
- * @template TMetadata - the type of the metadata (optional) - if you don't pass an metadata as a parameter, you can pass null
32
- * @template {ActionCollectionConfig<TState,TMetadata> | null} TStateSetter - the configuration of the API (optional) - if you don't pass an API as a parameter, you can pass null
33
- * */
34
- export type GlobalStoreConfig<TState, TMetadata, TStateSetter extends GlobalStoreBase.ActionCollectionConfig<TState, TMetadata> | GlobalStoreBase.StateSetter<TState> = GlobalStoreBase.StateSetter<TState>> = GlobalStoreBase.GlobalStoreConfig<TState, TMetadata, TStateSetter> & LocalStorageConfig;
35
- /**
36
- * Configuration of the state (optional) - if you don't need to use the state configuration you don't need to pass this parameter
37
- */
38
- export type createStateConfig<TState, TMetadata, TActions extends GlobalStoreBase.ActionCollectionConfig<TState, TMetadata> | null = null> = GlobalStoreBase.createStateConfig<TState, TMetadata, TActions> & LocalStorageConfig;
24
+ export type GlobalStoreConfig<State, Metadata> = GlobalStoreBase.GlobalStoreConfig<State, Metadata> & LocalStorageConfig;
39
25
  /**
40
26
  * @description
41
27
  * Configuration of the custom global hook
42
28
  */
43
- export type CustomGlobalHookParams<TCustomConfig, TState, TMetadata, TActions extends GlobalStoreBase.ActionCollectionConfig<TState, TMetadata> | null> = GlobalStoreBase.CustomGlobalHookParams<TCustomConfig, TState, TMetadata, TActions> & LocalStorageConfig;
29
+ export type CustomGlobalHookParams<TCustomConfig, TMetadata> = GlobalStoreBase.CustomGlobalHookBuilderParams<TCustomConfig, TMetadata> & LocalStorageConfig;
@@ -1,4 +1,4 @@
1
- import { ActionCollectionConfig, StateSetter, StateConfigCallbackParam, StateChangesParam } from 'react-hooks-global-states';
1
+ import { ActionCollectionConfig, BaseMetadata, StateChanges, StoreTools } from 'react-hooks-global-states';
2
2
  import { GlobalStore } from './GlobalStore';
3
3
  import { GlobalStoreConfig } from './GlobalStore.types';
4
4
  /**
@@ -7,10 +7,10 @@ import { GlobalStoreConfig } from './GlobalStore.types';
7
7
  * by implementing the abstract methods onInitialize and onChange.
8
8
  * You can use this class to create a store with async storage.
9
9
  */
10
- export declare abstract class GlobalStoreAbstract<TState, TMetadata = null, TStateMutator extends ActionCollectionConfig<TState, TMetadata> | StateSetter<TState> = StateSetter<TState>> extends GlobalStore<TState, TMetadata, TStateMutator> {
11
- constructor(state: TState, config?: GlobalStoreConfig<TState, TMetadata, TStateMutator>, actionsConfig?: TStateMutator | null);
12
- protected onInit: (parameters: StateConfigCallbackParam<TState, TMetadata, TStateMutator>) => void;
13
- protected onStateChanged: (parameters: StateChangesParam<TState, TMetadata, TStateMutator>) => void;
14
- protected abstract onInitialize: ({ setState, setMetadata, getMetadata, getState, actions, }: StateConfigCallbackParam<TState, TMetadata, TStateMutator>) => void;
15
- protected abstract onChange: ({ setState, setMetadata, getMetadata, getState, actions, }: StateChangesParam<TState, TMetadata, TStateMutator>) => void;
10
+ export declare abstract class GlobalStoreAbstract<State, Metadata extends BaseMetadata, ActionsConfig extends ActionCollectionConfig<State, Metadata> | null | {} = null> extends GlobalStore<State, Metadata, ActionsConfig> {
11
+ constructor(state: State, config: GlobalStoreConfig<State, Metadata>, actionsConfig: ActionsConfig);
12
+ protected onInit: (args: StoreTools<State, Metadata>) => void;
13
+ protected onStateChanged: (args: StoreTools<State, Metadata> & StateChanges<State>) => void;
14
+ protected abstract onInitialize: (args: StoreTools<State, Metadata>) => void;
15
+ protected abstract onChange: (args: StoreTools<State, Metadata> & StateChanges<State>) => void;
16
16
  }
@@ -3,10 +3,10 @@
3
3
  * The intention is to extend the capabilities to specially web development.
4
4
  * The original library is intended to be used just with react,
5
5
  */
6
- export { clone, isNil, isNumber, isBoolean, isString, isDate, isRegex, isFunction, isPrimitive, formatFromStore, formatToStore, throwNoSubscribersWereAdded, createDerivate, createDerivateEmitter, shallowCompare, debounce, combineAsyncGettersEmitter, combineRetrieverEmitterAsynchronously, combineAsyncGetters, combineRetrieverAsynchronously, StateSetter, StateHook, AvoidNever, MetadataSetter, StateChanges, StoreTools, ActionCollectionConfig, ActionCollectionResult, UseHookConfig, UnsubscribeCallback, SubscribeCallbackConfig, SubscribeCallback, SubscriberCallback, StateGetter, Subscribe, CustomGlobalHookBuilderParams, SelectorCallback, SubscribeToEmitter, SubscriberParameters, SubscriptionCallback, SetStateCallback, StateChangesParam, StateConfigCallbackParam, } from 'react-hooks-global-states';
7
- export { LocalStorageConfig, GlobalStoreConfig, createStateConfig, CustomGlobalHookParams, } from './GlobalStore.types';
6
+ export { clone, isNil, isNumber, isBoolean, isString, isDate, isRegex, isFunction, isPrimitive, formatFromStore, formatToStore, throwNoSubscribersWereAdded, createDerivate, createDerivateEmitter, shallowCompare, debounce, combineAsyncGettersEmitter, combineRetrieverEmitterAsynchronously, combineAsyncGetters, combineRetrieverAsynchronously, StateSetter, StateHook, MetadataSetter, StateChanges, StoreTools, ActionCollectionConfig, ActionCollectionResult, UseHookConfig, UnsubscribeCallback, SubscribeCallbackConfig, SubscribeCallback, SubscriberCallback, StateGetter, Subscribe, CustomGlobalHookBuilderParams, SelectorCallback, SubscribeToEmitter, SubscriberParameters, SubscriptionCallback, SetStateCallback, BaseMetadata, } from 'react-hooks-global-states';
7
+ export { LocalStorageConfig, GlobalStoreConfig, CustomGlobalHookParams, } from './GlobalStore.types';
8
8
  export { GlobalStore } from './GlobalStore';
9
9
  export { GlobalStoreAbstract } from './GlobalStoreAbstract';
10
- export { createGlobalStateWithDecoupledFuncs, createGlobalState, createCustomGlobalStateWithDecoupledFuncs, } from './GlobalStore.functionHooks';
10
+ export { createGlobalState, createCustomGlobalState, } from './GlobalStore.functionHooks';
11
11
  export { getLocalStorageItem, setLocalStorageItem } from './GlobalStore.utils';
12
12
  export * from './GlobalStore.context';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-global-state-hooks",
3
- "version": "4.3.2",
3
+ "version": "5.0.0",
4
4
  "description": "This is a package to easily handling global-state across your react components No-redux, No-context.",
5
5
  "main": "lib/bundle.js",
6
6
  "types": "lib/src/index.d.ts",
@@ -76,6 +76,6 @@
76
76
  "react": ">=17.0.0"
77
77
  },
78
78
  "dependencies": {
79
- "react-hooks-global-states": "2.4.2"
79
+ "react-hooks-global-states": "3.0.0"
80
80
  }
81
81
  }