react-hooks-global-states 5.0.1 → 6.0.1
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/{lib/src/GlobalStore.d.ts → GlobalStore.d.ts} +2 -2
- package/GlobalStore.js +1 -0
- package/{lib/src/GlobalStoreAbstract.d.ts → GlobalStoreAbstract.d.ts} +1 -1
- package/GlobalStoreAbstract.js +1 -0
- package/bundle.js +1 -0
- package/combineRetrieverAsynchronously.js +1 -0
- package/combineRetrieverEmitterAsynchronously.js +1 -0
- package/{lib/src/GlobalStore.combiners.d.ts → combiners.combineRetrieverAsynchronously.d.ts} +1 -14
- package/combiners.combineRetrieverEmitterAsynchronously.d.ts +14 -0
- package/{lib/src/GlobalStore.context.d.ts → createContext.d.ts} +1 -8
- package/createContext.js +1 -0
- package/createCustomGlobalState.js +1 -0
- package/createGlobalState.js +1 -0
- package/debounce.js +1 -0
- package/{lib/src/GlobalStore.functionHooks.d.ts → functionHooks.createCustomGlobalState.d.ts} +1 -17
- package/functionHooks.createGlobalState.d.ts +17 -0
- package/index.d.ts +15 -0
- package/isRecord.js +1 -0
- package/package.json +9 -6
- package/shallowCompare.js +1 -0
- package/throwWrongKeyOnActionCollectionConfig.js +1 -0
- package/types.js +1 -0
- package/uniqueId.js +1 -0
- package/uniqueSymbol.js +1 -0
- package/useConstantValueRef.js +1 -0
- package/utils.debounce.d.ts +1 -0
- package/utils.isRecord.d.ts +1 -0
- package/utils.shallowCompare.d.ts +1 -0
- package/utils.throwWrongKeyOnActionCollectionConfig.d.ts +1 -0
- package/utils.uniqueId.d.ts +1 -0
- package/utils.uniqueSymbol.d.ts +2 -0
- package/utils.useConstantValueRef.d.ts +2 -0
- package/webpack.config.js +82 -0
- package/lib/bundle.js +0 -2
- package/lib/bundle.js.LICENSE.txt +0 -1
- package/lib/src/GlobalStore.utils.d.ts +0 -9
- package/lib/src/index.d.ts +0 -8
- /package/{lib/src/GlobalStore.types.d.ts → types.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ActionCollectionConfig, StateSetter, GlobalStoreCallbacks, ActionCollectionResult, MetadataSetter, UseHookConfig, StateGetter, SelectorCallback, SubscriberParameters, MetadataGetter, StateHook, BaseMetadata, StateChanges, StoreTools, ObservableFragment } from './types';
|
|
2
|
+
import { UniqueSymbol } from './utils.uniqueSymbol';
|
|
3
3
|
/**
|
|
4
4
|
* The GlobalStore class is the main class of the library and it is used to create a GlobalStore instances
|
|
5
5
|
* */
|
package/GlobalStore.js
ADDED
|
@@ -0,0 +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-hooks-global-states"]=e(require("react")):t["react-hooks-global-states"]=e(t.react)}(this,(t=>(()=>{var e={858:(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)}Object.defineProperty(e,"__esModule",{value:!0}),e.isRecord=void 0;var o=r(125);e.isRecord=function(t){return!(0,o.isNil)(t)&&"object"===n(t)}},947:(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,s=!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){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)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.shallowCompare=void 0;var c=r(416),s=r(231),l=r(125),f=r(858);e.shallowCompare=function(t,e){if(t===e)return!0;var r=u(t),i=u(e);if(r!==i)return!1;if((0,l.isNil)(t)||(0,l.isNil)(e)||(0,c.isPrimitive)(t)&&(0,c.isPrimitive)(e)||(0,s.isDate)(t)&&(0,s.isDate)(e)||"function"===r&&"function"===i)return t===e;if(Array.isArray(t)){var a=t,d=e;if(a.length!==d.length)return!1;for(var p=0;p<a.length;p++){if(a[p]!==d[p])return!1}}if(t instanceof Map){var v=t,h=e;if(v.size!==h.size)return!1;var y,b=o(v);try{for(b.s();!(y=b.n()).done;){var g=n(y.value,2),m=g[0];if(g[1]!==h.get(m))return!1}}catch(t){b.e(t)}finally{b.f()}}if(t instanceof Set){var S=t,w=e;if(S.size!==w.size)return!1;var O,j=o(S);try{for(j.s();!(O=j.n()).done;){var x=O.value;if(!w.has(x))return!1}}catch(t){j.e(t)}finally{j.f()}}if(!(0,f.isRecord)(t)||!(0,f.isRecord)(e))return t===e;var _=Object.keys(t),k=Object.keys(e);if(_.length!==k.length)return!1;for(var E=0,C=_;E<C.length;E++){var I=C[E];if(t[I]!==e[I])return!1}return!0}},544:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.throwWrongKeyOnActionCollectionConfig=void 0;e.throwWrongKeyOnActionCollectionConfig=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"))}},176:(t,e)=>{"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),e.uniqueId=void 0,e.uniqueId=(r=0,function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return r===Number.MAX_SAFE_INTEGER&&(r=0),t+Date.now().toString(36)+(r++).toString(36)})},93:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.uniqueSymbol=void 0,e.uniqueSymbol=Symbol("unique")},607:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.useConstantValueRef=void 0;var n=r(156),o=r(93);e.useConstantValueRef=function(t){var e=(0,n.useRef)(o.uniqueSymbol);return e.current===o.uniqueSymbol&&(e.current=t()),e}},231:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isDate=void 0,e.isDate=function(t){return t instanceof Date}})(),t})()},244:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isFunction=void 0,e.isFunction=function(t){return"function"==typeof t||t instanceof Function}})(),t})()},125:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isNil=void 0,e.isNil=function(t){return null==t}})(),t})()},416:function(t){t.exports=(()=>{"use strict";var t={112:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isBoolean=void 0,e.isBoolean=function(t){return"boolean"==typeof t}},243:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isNil=void 0,e.isNil=function(t){return null==t}},11:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isNumber=void 0,e.isNumber=function(t){return"number"==typeof t}},671:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isString=void 0,e.isString=function(t){return"string"==typeof t}}},e={};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}var n={};return(()=>{var t=n;function e(t){return e="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},e(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.isPrimitive=void 0;var o=r(112),i=r(243),a=r(11),u=r(671);t.isPrimitive=function(t){return(0,i.isNil)(t)||(0,a.isNumber)(t)||(0,o.isBoolean)(t)||(0,u.isString)(t)||"symbol"===e(t)}})(),n})()},281:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isString=void 0,e.isString=function(t){return"string"==typeof t}})(),t})()},156:e=>{"use strict";e.exports=t}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var i=r[t]={exports:{}};return e[t].call(i.exports,i,i.exports,n),i.exports}var o={};return(()=>{"use strict";var t=o;function e(t){return e="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},e(t)}function r(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,s=!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){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)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 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(){u=function(){return t};var t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=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 E(n||[]);return o(a,"_invoke",{value:j(t,r,u)}),a}function d(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 v(){}function h(){}function y(){}var b={};l(b,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(C([])));m&&m!==r&&n.call(m,a)&&(b=m);var S=y.prototype=v.prototype=Object.create(b);function w(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,r){function i(o,a,u,c){var s=d(t[o],t,a);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==e(f)&&n.call(f,"__await")?r.resolve(f.__await).then((function(t){i("next",t,u,c)}),(function(t){i("throw",t,u,c)})):r.resolve(f).then((function(t){l.value=t,u(l)}),(function(t){return i("throw",t,u,c)}))}c(s.arg)}var a;o(this,"_invoke",{value:function(t,e){function n(){return new r((function(r,n){i(t,e,r,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 I()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=x(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=d(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 x(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,x(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=d(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 _(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 k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function C(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:I}}function I(){return{value:void 0,done:!0}}return h.prototype=y,o(S,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:h,configurable:!0}),h.displayName=l(y,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,l(t,s,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},w(O.prototype),l(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new O(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(S),l(S,s,"Generator"),l(S,a,(function(){return this})),l(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=C,E.prototype={constructor:E,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(k),!t)for(var e in this)"t"===e.charAt(0)&&n.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 r(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 r("end");if(i.tryLoc<=this.prev){var u=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.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),k(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;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:C(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function c(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,s(n.key),n)}}function s(t){var r=function(t,r){if("object"!==e(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,r||"default");if("object"!==e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"===e(r)?r:String(r)}var l=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function u(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalStore=void 0;var f=n(156),d=n(244),p=n(125),v=n(281),h=n(858),y=n(947),b=n(544),g=n(176),m=n(93),S=n(607),w=function(){function t(e){var n=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{metadata:{}};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actionsConfig=null,this.callbacks=null,this.actions=null,this.subscribers=new Map,this.initialize=function(){return l(n,void 0,void 0,u().mark((function t(){var e,r,n,o,i,a;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Object.keys(null!==(e=this.actionsConfig)&&void 0!==e?e:{}).length>0&&(this.actions=this.getStoreActionsMap()),n=this.onInit,o=null!==(r=this.callbacks)&&void 0!==r?r:{},i=o.onInit,n||i){t.next=6;break}return t.abrupt("return");case 6:a=this.getConfigCallbackParam(),null==n||n(a),(0,p.isNil)(i)||null==i||i(a);case 9:case"end":return t.stop()}}),t,this)})))},this.executeSetStateForSubscriber=function(t,e){var r,o,i=t.selector,a=t.callback,u=t.currentState,c=t.config;if(!e.forceUpdate&&(null!==(r=null==c?void 0:c.isEqualRoot)&&void 0!==r?r:function(t,e){return t===e})(e.currentRootState,e.newRootState))return{didUpdate:!1};var s=i?i(e.newRootState):e.newRootState;return!e.forceUpdate&&(null!==(o=null==c?void 0:c.isEqual)&&void 0!==o?o:function(t,e){return t===e})(u,s)?{didUpdate:!1}:(n.partialUpdateSubscription(t.subscriptionId,{currentState:s}),a({state:s},{identifier:e.identifier}),{didUpdate:!0})},this.setState=function(t,e){var r=t.state,o=e.forceUpdate,a=e.identifier,u=n.stateWrapper.state;if(o||u!==r){n.stateWrapper={state:r};var c,s={forceUpdate:o,newRootState:r,currentRootState:u,identifier:a},l=function(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}}}}(n.subscribers.values());try{for(l.s();!(c=l.n()).done;){var f=c.value;n.executeSetStateForSubscriber(f,s)}}catch(t){l.e(t)}finally{l.f()}}},this.setMetadata=function(t){var e=(0,d.isFunction)(t)?t(n.metadata):t;n.metadata=e},this.getMetadata=function(){return n.metadata},this.getState=function(t,e,r){var o;if(!t)return n.stateWrapper.state;var i=(0,d.isFunction)(e),a=i?t:void 0,u=i?e:t,c=null!==(o=i?r:e)&&void 0!==o?o:void 0,s=a?a(n.stateWrapper.state):n.stateWrapper.state;(null==c?void 0:c.skipFirst)||u(s);var l=(0,g.uniqueId)("gs:");return n.setOrUpdateSubscription({subscriptionId:l,selector:a,config:c,currentState:s,callback:function(t){var e=t.state;return u(e)},isSetStateCallback:!1}),function(){n.subscribers.delete(l)}},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.lastSubscriptionId=null,this.setOrUpdateSubscription=function(t){var e=t.subscriptionId;if(!e)return{isNewSubscription:!1};var r=n.subscribers.get(e);return(0,h.isRecord)(r)?(Object.assign(r,t),{isNewSubscription:!1}):(n.executeOnSubscribed(),n.subscribers.set(e,t),n.lastSubscriptionId=e,{isNewSubscription:!0})},this.partialUpdateSubscription=function(t,e){var r=n.subscribers.get(t);(0,h.isRecord)(r)&&Object.assign(r,e)},this.executeOnSubscribed=function(){var t,e=n.onSubscribed,r=null===(t=n.callbacks)||void 0===t?void 0:t.onSubscribed;if(e||r){var o=n.getConfigCallbackParam();null==e||e(o),null==r||r(o)}},this.getHook=function(){var t=function(t){var e,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=(0,S.useConstantValueRef)((function(){return{subscriptionId:null,tempInitialRootState:n.stateWrapper.state}})),a=function(){return t?{state:t(n.stateWrapper.state)}:n.stateWrapper},u=r((0,f.useState)(a),2),c=u[0],s=u[1];(0,f.useEffect)((function(){if(!(0,p.isNil)(i.current)){(0,p.isNil)(i.current.subscriptionId)&&(i.current.subscriptionId=(0,g.uniqueId)("ss:"));var e=i.current.subscriptionId,r={subscriptionId:e,currentState:c.state,selector:t,config:o,callback:s,isSetStateCallback:!0};return n.setOrUpdateSubscription(r).isNewSubscription&&(n.executeSetStateForSubscriber(r,{forceUpdate:!1,newRootState:n.stateWrapper.state,currentRootState:i.current.tempInitialRootState,identifier:"on mount state update"}),i.current.tempInitialRootState=m.uniqueSymbol),function(){n.subscribers.delete(e)}}}),[]);var l=(0,v.isString)(i.current)?i.current:"",d=n.subscribers.get(l),h=(null!==(e=null==d?void 0:d.config)&&void 0!==e?e:{dependencies:o.dependencies}).dependencies;return n.partialUpdateSubscription(l,{currentState:c.state,selector:t,config:o,callback:s}),[n.computeSelectedState({selector:t,subscriptionId:l,config:o,currentDependencies:h,computeChildState:a,stateWrapperRef:c}),n.getStateOrchestrator(),n.metadata]};return t.stateControls=n.stateControls,t.createSelectorHook=n.createSelectorHook,t.createObservable=n.createObservable,t},this.computeSelectedState=function(t){var e=t.selector,r=t.subscriptionId,o=t.config,i=t.currentDependencies,a=t.computeChildState,u=t.stateWrapperRef;if(!e||!r)return u.state;var c=o.dependencies;if(i===c)return u.state;if((null==i?void 0:i.length)===(null==c?void 0:c.length)&&(0,y.shallowCompare)(i,c))return u.state;var s=a().state;return n.partialUpdateSubscription(r,{currentState:s}),u.state=s,s},this.createSelectorHook=function(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.isEqualRoot,a=o.isEqual,u=o.name,c=r(n.stateControls(),3),s=c[0],l=c[1],f=c[2],p=s(),v=(null!=e?e:function(t){return t})(p),h=new t(v,{name:null!=u?u:(0,g.uniqueId)("sh:")}),y=r(h.stateControls(),2),b=y[0],m=y[1];s((function(t){if(!(null!=i?i:Object.is)(p,t)){p=t;var r=e(t);(null!=a?a:Object.is)(v,r)||(v=r,m(r))}}),{skipFirst:!0});var S=h.getHook(),w=function(t,e){return[r((0,d.isFunction)(t)?S(t,e):S(),1)[0],l,f]};return w.stateControls=function(){return[b,l,f]},w.createSelectorHook=n.createSelectorHook.bind(w),w.createObservable=n.createObservable.bind(w),w},this.stateControls=function(){var t=n.getStateOrchestrator(),e=n.getMetadata;return[n.getState,t,e]},this.getStateOrchestrator=function(){return n.actions?n.actions:n.setStateWrapper},this.setStateWrapper=function(t){var e,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.forceUpdate,a=o.identifier,u=n.stateWrapper.state,c=(0,d.isFunction)(t)?t(u):t;if(i||n.stateWrapper.state!==c){var s=n.setMetadata,l=n.getMetadata,f=n.getState,p=n.actions,v={setMetadata:s,getMetadata:l,setState:n.setState,getState:f,actions:p,previousState:u,state:c,identifier:a},h=n.computePreventStateChange,y=null===(e=n.callbacks)||void 0===e?void 0:e.computePreventStateChange;if(h||y)if((null==h?void 0:h(v))||(null==y?void 0:y(v)))return;n.setState({state:c},{forceUpdate:i,identifier:a});var b=n.onStateChanged,g=null===(r=n.callbacks)||void 0===r?void 0:r.onStateChanged;(b||g)&&(null==b||b(v),null==g||g(v))}},this.getStoreActionsMap=function(){if(!(0,h.isRecord)(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,u){var c,l,f;return Object.assign(n,(c={},f=function(){for(var n=t[u],c=arguments.length,s=new Array(c),l=0;l<c;l++)s[l]=arguments[l];var f=n.apply(a,s);return"function"!=typeof f&&(0,b.throwWrongKeyOnActionCollectionConfig)(u),f.call(a,{setState:r,getState:o,setMetadata:e,getMetadata:i,actions:a})},(l=s(l=u))in c?Object.defineProperty(c,l,{value:f,enumerable:!0,configurable:!0,writable:!0}):c[l]=f,c)),n}),{});return a};var a=o.metadata,c=o.callbacks,w=o.actions,O=o.name;this.stateWrapper={state:e},this._name=null!=O?O:(0,g.uniqueId)("gs:"),this.metadata=null!=a?a:{},this.callbacks=null!=c?c:null,this.actionsConfig=null!=w?w:null,(null===globalThis||void 0===globalThis?void 0:globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG)&&globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG(this),this.constructor!==t||this.initialize()}var e,n,o;return e=t,n=[{key:"createObservable",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.isEqualRoot,o=e.isEqual,i=e.name,a=r(this.stateControls(),1)[0],u=[],c=a(),s=(null!=t?t:function(t){return t})(a());a((function(e){if(!(null!=n?n:Object.is)(c,e)){c=e;var r=t(e);(null!=o?o:Object.is)(s,r)||(s=r,u.forEach((function(t){return t()})))}}),{skipFirst:!0});var l=function(t,e,r){var n;if(!t)return s;var o=(0,d.isFunction)(e),i=o?t:void 0,a=o?e:t,c=null!==(n=o?r:e)&&void 0!==n?n:void 0,l=function(){return a(i?i(s):s)};(null==c?void 0:c.skipFirst)||l();var f=function(){l()};return u.push(f),function(){u.splice(u.indexOf(f),1)}};return l._name=null!=i?i:(0,g.uniqueId)("ob:"),l.createObservable=this.createObservable.bind(l),l.stateControls=function(){return[l]},l}}],n&&c(e.prototype,n),o&&c(e,o),Object.defineProperty(e,"prototype",{writable:!1}),t}();t.GlobalStore=w})(),o})()));
|
|
@@ -0,0 +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-hooks-global-states"]=e(require("react")):t["react-hooks-global-states"]=e(t.react)}(this,(t=>(()=>{var e={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,s=!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){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)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 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(){u=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:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=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 P(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 d={};function v(){}function y(){}function b(){}var h={};l(h,a,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(k([])));g&&g!==e&&r.call(g,a)&&(h=g);var S=b.prototype=v.prototype=Object.create(h);function w(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function i(o,a,u,c){var s=p(t[o],t,a);if("throw"!==s.type){var l=s.arg,f=l.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){l.value=t,u(l)}),(function(t){return i("throw",t,u,c)}))}c(s.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 C()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=_(a,r);if(u){if(u===d)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===d)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function _(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,_(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=p(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,d;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,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function x(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 P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function k(t){if(t){var e=t[a];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=b,o(S,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:y,configurable:!0}),y.displayName=l(b,s,"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,b):(t.__proto__=b,l(t,s,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},w(O.prototype),l(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new O(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(S),l(S,s,"Generator"),l(S,a,(function(){return this})),l(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=k,P.prototype={constructor:P,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,d):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),d},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),d}},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:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},t}function c(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,s(n.key),n)}}function s(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,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===n(e)?e:String(e)}var l=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function u(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStore=void 0;var f=r(156),p=r(244),d=r(125),v=r(281),y=r(858),b=r(947),h=r(544),m=r(176),g=r(93),S=r(607),w=function(){function t(e){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{metadata:{}};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actionsConfig=null,this.callbacks=null,this.actions=null,this.subscribers=new Map,this.initialize=function(){return l(r,void 0,void 0,u().mark((function t(){var e,r,n,o,i,a;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Object.keys(null!==(e=this.actionsConfig)&&void 0!==e?e:{}).length>0&&(this.actions=this.getStoreActionsMap()),n=this.onInit,o=null!==(r=this.callbacks)&&void 0!==r?r:{},i=o.onInit,n||i){t.next=6;break}return t.abrupt("return");case 6:a=this.getConfigCallbackParam(),null==n||n(a),(0,d.isNil)(i)||null==i||i(a);case 9:case"end":return t.stop()}}),t,this)})))},this.executeSetStateForSubscriber=function(t,e){var n,o,i=t.selector,a=t.callback,u=t.currentState,c=t.config;if(!e.forceUpdate&&(null!==(n=null==c?void 0:c.isEqualRoot)&&void 0!==n?n:function(t,e){return t===e})(e.currentRootState,e.newRootState))return{didUpdate:!1};var s=i?i(e.newRootState):e.newRootState;return!e.forceUpdate&&(null!==(o=null==c?void 0:c.isEqual)&&void 0!==o?o:function(t,e){return t===e})(u,s)?{didUpdate:!1}:(r.partialUpdateSubscription(t.subscriptionId,{currentState:s}),a({state:s},{identifier:e.identifier}),{didUpdate:!0})},this.setState=function(t,e){var n=t.state,o=e.forceUpdate,a=e.identifier,u=r.stateWrapper.state;if(o||u!==n){r.stateWrapper={state:n};var c,s={forceUpdate:o,newRootState:n,currentRootState:u,identifier:a},l=function(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}}}}(r.subscribers.values());try{for(l.s();!(c=l.n()).done;){var f=c.value;r.executeSetStateForSubscriber(f,s)}}catch(t){l.e(t)}finally{l.f()}}},this.setMetadata=function(t){var e=(0,p.isFunction)(t)?t(r.metadata):t;r.metadata=e},this.getMetadata=function(){return r.metadata},this.getState=function(t,e,n){var o;if(!t)return r.stateWrapper.state;var i=(0,p.isFunction)(e),a=i?t:void 0,u=i?e:t,c=null!==(o=i?n:e)&&void 0!==o?o:void 0,s=a?a(r.stateWrapper.state):r.stateWrapper.state;(null==c?void 0:c.skipFirst)||u(s);var l=(0,m.uniqueId)("gs:");return r.setOrUpdateSubscription({subscriptionId:l,selector:a,config:c,currentState:s,callback:function(t){var e=t.state;return u(e)},isSetStateCallback:!1}),function(){r.subscribers.delete(l)}},this.getConfigCallbackParam=function(){var t=r.setMetadata,e=r.getMetadata,n=r.getState,o=r.actions;return{setMetadata:t,getMetadata:e,getState:n,setState:r.setStateWrapper,actions:o}},this.lastSubscriptionId=null,this.setOrUpdateSubscription=function(t){var e=t.subscriptionId;if(!e)return{isNewSubscription:!1};var n=r.subscribers.get(e);return(0,y.isRecord)(n)?(Object.assign(n,t),{isNewSubscription:!1}):(r.executeOnSubscribed(),r.subscribers.set(e,t),r.lastSubscriptionId=e,{isNewSubscription:!0})},this.partialUpdateSubscription=function(t,e){var n=r.subscribers.get(t);(0,y.isRecord)(n)&&Object.assign(n,e)},this.executeOnSubscribed=function(){var t,e=r.onSubscribed,n=null===(t=r.callbacks)||void 0===t?void 0:t.onSubscribed;if(e||n){var o=r.getConfigCallbackParam();null==e||e(o),null==n||n(o)}},this.getHook=function(){var t=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=(0,S.useConstantValueRef)((function(){return{subscriptionId:null,tempInitialRootState:r.stateWrapper.state}})),a=function(){return t?{state:t(r.stateWrapper.state)}:r.stateWrapper},u=o((0,f.useState)(a),2),c=u[0],s=u[1];(0,f.useEffect)((function(){if(!(0,d.isNil)(i.current)){(0,d.isNil)(i.current.subscriptionId)&&(i.current.subscriptionId=(0,m.uniqueId)("ss:"));var e=i.current.subscriptionId,o={subscriptionId:e,currentState:c.state,selector:t,config:n,callback:s,isSetStateCallback:!0};return r.setOrUpdateSubscription(o).isNewSubscription&&(r.executeSetStateForSubscriber(o,{forceUpdate:!1,newRootState:r.stateWrapper.state,currentRootState:i.current.tempInitialRootState,identifier:"on mount state update"}),i.current.tempInitialRootState=g.uniqueSymbol),function(){r.subscribers.delete(e)}}}),[]);var l=(0,v.isString)(i.current)?i.current:"",p=r.subscribers.get(l),y=(null!==(e=null==p?void 0:p.config)&&void 0!==e?e:{dependencies:n.dependencies}).dependencies;return r.partialUpdateSubscription(l,{currentState:c.state,selector:t,config:n,callback:s}),[r.computeSelectedState({selector:t,subscriptionId:l,config:n,currentDependencies:y,computeChildState:a,stateWrapperRef:c}),r.getStateOrchestrator(),r.metadata]};return t.stateControls=r.stateControls,t.createSelectorHook=r.createSelectorHook,t.createObservable=r.createObservable,t},this.computeSelectedState=function(t){var e=t.selector,n=t.subscriptionId,o=t.config,i=t.currentDependencies,a=t.computeChildState,u=t.stateWrapperRef;if(!e||!n)return u.state;var c=o.dependencies;if(i===c)return u.state;if((null==i?void 0:i.length)===(null==c?void 0:c.length)&&(0,b.shallowCompare)(i,c))return u.state;var s=a().state;return r.partialUpdateSubscription(n,{currentState:s}),u.state=s,s},this.createSelectorHook=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.isEqualRoot,a=n.isEqual,u=n.name,c=o(r.stateControls(),3),s=c[0],l=c[1],f=c[2],d=s(),v=(null!=e?e:function(t){return t})(d),y=new t(v,{name:null!=u?u:(0,m.uniqueId)("sh:")}),b=o(y.stateControls(),2),h=b[0],g=b[1];s((function(t){if(!(null!=i?i:Object.is)(d,t)){d=t;var r=e(t);(null!=a?a:Object.is)(v,r)||(v=r,g(r))}}),{skipFirst:!0});var S=y.getHook(),w=function(t,e){return[o((0,p.isFunction)(t)?S(t,e):S(),1)[0],l,f]};return w.stateControls=function(){return[h,l,f]},w.createSelectorHook=r.createSelectorHook.bind(w),w.createObservable=r.createObservable.bind(w),w},this.stateControls=function(){var t=r.getStateOrchestrator(),e=r.getMetadata;return[r.getState,t,e]},this.getStateOrchestrator=function(){return r.actions?r.actions:r.setStateWrapper},this.setStateWrapper=function(t){var e,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.forceUpdate,a=o.identifier,u=r.stateWrapper.state,c=(0,p.isFunction)(t)?t(u):t;if(i||r.stateWrapper.state!==c){var s=r.setMetadata,l=r.getMetadata,f=r.getState,d=r.actions,v={setMetadata:s,getMetadata:l,setState:r.setState,getState:f,actions:d,previousState:u,state:c,identifier:a},y=r.computePreventStateChange,b=null===(e=r.callbacks)||void 0===e?void 0:e.computePreventStateChange;if(y||b)if((null==y?void 0:y(v))||(null==b?void 0:b(v)))return;r.setState({state:c},{forceUpdate:i,identifier:a});var h=r.onStateChanged,m=null===(n=r.callbacks)||void 0===n?void 0:n.onStateChanged;(h||m)&&(null==h||h(v),null==m||m(v))}},this.getStoreActionsMap=function(){if(!(0,y.isRecord)(r.actionsConfig))return null;var t=r.actionsConfig,e=r.setMetadata,n=r.setStateWrapper,o=r.getState,i=r.getMetadata,a=Object.keys(t).reduce((function(r,u){var c,l,f;return Object.assign(r,(c={},f=function(){for(var r=t[u],c=arguments.length,s=new Array(c),l=0;l<c;l++)s[l]=arguments[l];var f=r.apply(a,s);return"function"!=typeof f&&(0,h.throwWrongKeyOnActionCollectionConfig)(u),f.call(a,{setState:n,getState:o,setMetadata:e,getMetadata:i,actions:a})},(l=s(l=u))in c?Object.defineProperty(c,l,{value:f,enumerable:!0,configurable:!0,writable:!0}):c[l]=f,c)),r}),{});return a};var a=n.metadata,c=n.callbacks,w=n.actions,O=n.name;this.stateWrapper={state:e},this._name=null!=O?O:(0,m.uniqueId)("gs:"),this.metadata=null!=a?a:{},this.callbacks=null!=c?c:null,this.actionsConfig=null!=w?w:null,(null===globalThis||void 0===globalThis?void 0:globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG)&&globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG(this),this.constructor!==t||this.initialize()}var e,r,n;return e=t,r=[{key:"createObservable",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.isEqualRoot,n=e.isEqual,i=e.name,a=o(this.stateControls(),1)[0],u=[],c=a(),s=(null!=t?t:function(t){return t})(a());a((function(e){if(!(null!=r?r:Object.is)(c,e)){c=e;var o=t(e);(null!=n?n:Object.is)(s,o)||(s=o,u.forEach((function(t){return t()})))}}),{skipFirst:!0});var l=function(t,e,r){var n;if(!t)return s;var o=(0,p.isFunction)(e),i=o?t:void 0,a=o?e:t,c=null!==(n=o?r:e)&&void 0!==n?n:void 0,l=function(){return a(i?i(s):s)};(null==c?void 0:c.skipFirst)||l();var f=function(){l()};return u.push(f),function(){u.splice(u.indexOf(f),1)}};return l._name=null!=i?i:(0,m.uniqueId)("ob:"),l.createObservable=this.createObservable.bind(l),l.stateControls=function(){return[l]},l}}],r&&c(e.prototype,r),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.GlobalStore=w},858:(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)}Object.defineProperty(e,"__esModule",{value:!0}),e.isRecord=void 0;var o=r(125);e.isRecord=function(t){return!(0,o.isNil)(t)&&"object"===n(t)}},947:(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,s=!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){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)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.shallowCompare=void 0;var c=r(416),s=r(231),l=r(125),f=r(858);e.shallowCompare=function(t,e){if(t===e)return!0;var r=u(t),i=u(e);if(r!==i)return!1;if((0,l.isNil)(t)||(0,l.isNil)(e)||(0,c.isPrimitive)(t)&&(0,c.isPrimitive)(e)||(0,s.isDate)(t)&&(0,s.isDate)(e)||"function"===r&&"function"===i)return t===e;if(Array.isArray(t)){var a=t,p=e;if(a.length!==p.length)return!1;for(var d=0;d<a.length;d++){if(a[d]!==p[d])return!1}}if(t instanceof Map){var v=t,y=e;if(v.size!==y.size)return!1;var b,h=o(v);try{for(h.s();!(b=h.n()).done;){var m=n(b.value,2),g=m[0];if(m[1]!==y.get(g))return!1}}catch(t){h.e(t)}finally{h.f()}}if(t instanceof Set){var S=t,w=e;if(S.size!==w.size)return!1;var O,j=o(S);try{for(j.s();!(O=j.n()).done;){var _=O.value;if(!w.has(_))return!1}}catch(t){j.e(t)}finally{j.f()}}if(!(0,f.isRecord)(t)||!(0,f.isRecord)(e))return t===e;var x=Object.keys(t),E=Object.keys(e);if(x.length!==E.length)return!1;for(var P=0,k=x;P<k.length;P++){var C=k[P];if(t[C]!==e[C])return!1}return!0}},544:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.throwWrongKeyOnActionCollectionConfig=void 0;e.throwWrongKeyOnActionCollectionConfig=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"))}},176:(t,e)=>{"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),e.uniqueId=void 0,e.uniqueId=(r=0,function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return r===Number.MAX_SAFE_INTEGER&&(r=0),t+Date.now().toString(36)+(r++).toString(36)})},93:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.uniqueSymbol=void 0,e.uniqueSymbol=Symbol("unique")},607:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.useConstantValueRef=void 0;var n=r(156),o=r(93);e.useConstantValueRef=function(t){var e=(0,n.useRef)(o.uniqueSymbol);return e.current===o.uniqueSymbol&&(e.current=t()),e}},231:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isDate=void 0,e.isDate=function(t){return t instanceof Date}})(),t})()},244:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isFunction=void 0,e.isFunction=function(t){return"function"==typeof t||t instanceof Function}})(),t})()},125:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isNil=void 0,e.isNil=function(t){return null==t}})(),t})()},416:function(t){t.exports=(()=>{"use strict";var t={112:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isBoolean=void 0,e.isBoolean=function(t){return"boolean"==typeof t}},243:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isNil=void 0,e.isNil=function(t){return null==t}},11:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isNumber=void 0,e.isNumber=function(t){return"number"==typeof t}},671:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isString=void 0,e.isString=function(t){return"string"==typeof t}}},e={};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}var n={};return(()=>{var t=n;function e(t){return e="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},e(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.isPrimitive=void 0;var o=r(112),i=r(243),a=r(11),u=r(671);t.isPrimitive=function(t){return(0,i.isNil)(t)||(0,a.isNumber)(t)||(0,o.isBoolean)(t)||(0,u.isString)(t)||"symbol"===e(t)}})(),n})()},281:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isString=void 0,e.isString=function(t){return"string"==typeof t}})(),t})()},156:e=>{"use strict";e.exports=t}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var i=r[t]={exports:{}};return e[t].call(i.exports,i,i.exports,n),i.exports}var o={};return(()=>{"use strict";var t=o;function e(t){return e="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},e(t)}function r(t,r){for(var n=0;n<r.length;n++){var o=r[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,a=void 0,a=function(t,r){if("object"!==e(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,r||"default");if("object"!==e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(i,"string"),"symbol"===e(a)?a:String(a)),o)}var i,a}function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}function a(t){var r=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}}();return function(){var n,o=u(t);if(r){var i=u(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(t,r){if(r&&("object"===e(r)||"function"==typeof r))return r;if(void 0!==r)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,n)}}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalStoreAbstract=void 0;var c=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&&i(t,e)}(c,t);var e,n,o,u=a(c);function c(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(t=u.apply(this,arguments)).onInit=function(e){t.onInitialize(e)},t.onStateChanged=function(e){t.onChange(e)},t}return e=c,n&&r(e.prototype,n),o&&r(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e}(n(774).GlobalStore);t.GlobalStoreAbstract=c})(),o})()));
|
package/bundle.js
ADDED
|
@@ -0,0 +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-hooks-global-states"]=e(require("react")):t["react-hooks-global-states"]=e(t.react)}(this,(t=>(()=>{var e={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)||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 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(){u=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:{},a=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 p?e:p,a=Object.create(i.prototype),u=new E(n||[]);return o(a,"_invoke",{value:j(t,r,u)}),a}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var v={};function p(){}function b(){}function y(){}var h={};s(h,a,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(x([])));g&&g!==e&&r.call(g,a)&&(h=g);var S=y.prototype=p.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=d(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 A()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=_(a,r);if(u){if(u===v)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=d(t,e,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===v)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function _(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,_(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),v;var o=d(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,v;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,v):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,v)}function C(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 P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function x(t){if(t){var e=t[a];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:A}}function A(){return{value:void 0,done:!0}}return b.prototype=y,o(S,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:b,configurable:!0}),b.displayName=s(y,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,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,a,(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,E.prototype={constructor:E,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(P),!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,v):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),v},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),P(r),v}},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;P(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),v}},t}function c(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,l(n.key),n)}}function l(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,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===n(e)?e:String(e)}var s=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function u(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStore=void 0;var f=r(156),d=r(244),v=r(125),p=r(281),b=r(858),y=r(947),h=r(544),m=r(176),g=r(93),S=r(607),O=function(){function t(e){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{metadata:{}};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actionsConfig=null,this.callbacks=null,this.actions=null,this.subscribers=new Map,this.initialize=function(){return s(r,void 0,void 0,u().mark((function t(){var e,r,n,o,i,a;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Object.keys(null!==(e=this.actionsConfig)&&void 0!==e?e:{}).length>0&&(this.actions=this.getStoreActionsMap()),n=this.onInit,o=null!==(r=this.callbacks)&&void 0!==r?r:{},i=o.onInit,n||i){t.next=6;break}return t.abrupt("return");case 6:a=this.getConfigCallbackParam(),null==n||n(a),(0,v.isNil)(i)||null==i||i(a);case 9:case"end":return t.stop()}}),t,this)})))},this.executeSetStateForSubscriber=function(t,e){var n,o,i=t.selector,a=t.callback,u=t.currentState,c=t.config;if(!e.forceUpdate&&(null!==(n=null==c?void 0:c.isEqualRoot)&&void 0!==n?n:function(t,e){return t===e})(e.currentRootState,e.newRootState))return{didUpdate:!1};var l=i?i(e.newRootState):e.newRootState;return!e.forceUpdate&&(null!==(o=null==c?void 0:c.isEqual)&&void 0!==o?o:function(t,e){return t===e})(u,l)?{didUpdate:!1}:(r.partialUpdateSubscription(t.subscriptionId,{currentState:l}),a({state:l},{identifier:e.identifier}),{didUpdate:!0})},this.setState=function(t,e){var n=t.state,o=e.forceUpdate,a=e.identifier,u=r.stateWrapper.state;if(o||u!==n){r.stateWrapper={state:n};var c,l={forceUpdate:o,newRootState:n,currentRootState:u,identifier:a},s=function(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}}}}(r.subscribers.values());try{for(s.s();!(c=s.n()).done;){var f=c.value;r.executeSetStateForSubscriber(f,l)}}catch(t){s.e(t)}finally{s.f()}}},this.setMetadata=function(t){var e=(0,d.isFunction)(t)?t(r.metadata):t;r.metadata=e},this.getMetadata=function(){return r.metadata},this.getState=function(t,e,n){var o;if(!t)return r.stateWrapper.state;var i=(0,d.isFunction)(e),a=i?t:void 0,u=i?e:t,c=null!==(o=i?n:e)&&void 0!==o?o:void 0,l=a?a(r.stateWrapper.state):r.stateWrapper.state;(null==c?void 0:c.skipFirst)||u(l);var s=(0,m.uniqueId)("gs:");return r.setOrUpdateSubscription({subscriptionId:s,selector:a,config:c,currentState:l,callback:function(t){var e=t.state;return u(e)},isSetStateCallback:!1}),function(){r.subscribers.delete(s)}},this.getConfigCallbackParam=function(){var t=r.setMetadata,e=r.getMetadata,n=r.getState,o=r.actions;return{setMetadata:t,getMetadata:e,getState:n,setState:r.setStateWrapper,actions:o}},this.lastSubscriptionId=null,this.setOrUpdateSubscription=function(t){var e=t.subscriptionId;if(!e)return{isNewSubscription:!1};var n=r.subscribers.get(e);return(0,b.isRecord)(n)?(Object.assign(n,t),{isNewSubscription:!1}):(r.executeOnSubscribed(),r.subscribers.set(e,t),r.lastSubscriptionId=e,{isNewSubscription:!0})},this.partialUpdateSubscription=function(t,e){var n=r.subscribers.get(t);(0,b.isRecord)(n)&&Object.assign(n,e)},this.executeOnSubscribed=function(){var t,e=r.onSubscribed,n=null===(t=r.callbacks)||void 0===t?void 0:t.onSubscribed;if(e||n){var o=r.getConfigCallbackParam();null==e||e(o),null==n||n(o)}},this.getHook=function(){var t=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=(0,S.useConstantValueRef)((function(){return{subscriptionId:null,tempInitialRootState:r.stateWrapper.state}})),a=function(){return t?{state:t(r.stateWrapper.state)}:r.stateWrapper},u=o((0,f.useState)(a),2),c=u[0],l=u[1];(0,f.useEffect)((function(){if(!(0,v.isNil)(i.current)){(0,v.isNil)(i.current.subscriptionId)&&(i.current.subscriptionId=(0,m.uniqueId)("ss:"));var e=i.current.subscriptionId,o={subscriptionId:e,currentState:c.state,selector:t,config:n,callback:l,isSetStateCallback:!0};return r.setOrUpdateSubscription(o).isNewSubscription&&(r.executeSetStateForSubscriber(o,{forceUpdate:!1,newRootState:r.stateWrapper.state,currentRootState:i.current.tempInitialRootState,identifier:"on mount state update"}),i.current.tempInitialRootState=g.uniqueSymbol),function(){r.subscribers.delete(e)}}}),[]);var s=(0,p.isString)(i.current)?i.current:"",d=r.subscribers.get(s),b=(null!==(e=null==d?void 0:d.config)&&void 0!==e?e:{dependencies:n.dependencies}).dependencies;return r.partialUpdateSubscription(s,{currentState:c.state,selector:t,config:n,callback:l}),[r.computeSelectedState({selector:t,subscriptionId:s,config:n,currentDependencies:b,computeChildState:a,stateWrapperRef:c}),r.getStateOrchestrator(),r.metadata]};return t.stateControls=r.stateControls,t.createSelectorHook=r.createSelectorHook,t.createObservable=r.createObservable,t},this.computeSelectedState=function(t){var e=t.selector,n=t.subscriptionId,o=t.config,i=t.currentDependencies,a=t.computeChildState,u=t.stateWrapperRef;if(!e||!n)return u.state;var c=o.dependencies;if(i===c)return u.state;if((null==i?void 0:i.length)===(null==c?void 0:c.length)&&(0,y.shallowCompare)(i,c))return u.state;var l=a().state;return r.partialUpdateSubscription(n,{currentState:l}),u.state=l,l},this.createSelectorHook=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.isEqualRoot,a=n.isEqual,u=n.name,c=o(r.stateControls(),3),l=c[0],s=c[1],f=c[2],v=l(),p=(null!=e?e:function(t){return t})(v),b=new t(p,{name:null!=u?u:(0,m.uniqueId)("sh:")}),y=o(b.stateControls(),2),h=y[0],g=y[1];l((function(t){if(!(null!=i?i:Object.is)(v,t)){v=t;var r=e(t);(null!=a?a:Object.is)(p,r)||(p=r,g(r))}}),{skipFirst:!0});var S=b.getHook(),O=function(t,e){return[o((0,d.isFunction)(t)?S(t,e):S(),1)[0],s,f]};return O.stateControls=function(){return[h,s,f]},O.createSelectorHook=r.createSelectorHook.bind(O),O.createObservable=r.createObservable.bind(O),O},this.stateControls=function(){var t=r.getStateOrchestrator(),e=r.getMetadata;return[r.getState,t,e]},this.getStateOrchestrator=function(){return r.actions?r.actions:r.setStateWrapper},this.setStateWrapper=function(t){var e,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.forceUpdate,a=o.identifier,u=r.stateWrapper.state,c=(0,d.isFunction)(t)?t(u):t;if(i||r.stateWrapper.state!==c){var l=r.setMetadata,s=r.getMetadata,f=r.getState,v=r.actions,p={setMetadata:l,getMetadata:s,setState:r.setState,getState:f,actions:v,previousState:u,state:c,identifier:a},b=r.computePreventStateChange,y=null===(e=r.callbacks)||void 0===e?void 0:e.computePreventStateChange;if(b||y)if((null==b?void 0:b(p))||(null==y?void 0:y(p)))return;r.setState({state:c},{forceUpdate:i,identifier:a});var h=r.onStateChanged,m=null===(n=r.callbacks)||void 0===n?void 0:n.onStateChanged;(h||m)&&(null==h||h(p),null==m||m(p))}},this.getStoreActionsMap=function(){if(!(0,b.isRecord)(r.actionsConfig))return null;var t=r.actionsConfig,e=r.setMetadata,n=r.setStateWrapper,o=r.getState,i=r.getMetadata,a=Object.keys(t).reduce((function(r,u){var c,s,f;return Object.assign(r,(c={},f=function(){for(var r=t[u],c=arguments.length,l=new Array(c),s=0;s<c;s++)l[s]=arguments[s];var f=r.apply(a,l);return"function"!=typeof f&&(0,h.throwWrongKeyOnActionCollectionConfig)(u),f.call(a,{setState:n,getState:o,setMetadata:e,getMetadata:i,actions:a})},(s=l(s=u))in c?Object.defineProperty(c,s,{value:f,enumerable:!0,configurable:!0,writable:!0}):c[s]=f,c)),r}),{});return a};var a=n.metadata,c=n.callbacks,O=n.actions,w=n.name;this.stateWrapper={state:e},this._name=null!=w?w:(0,m.uniqueId)("gs:"),this.metadata=null!=a?a:{},this.callbacks=null!=c?c:null,this.actionsConfig=null!=O?O:null,(null===globalThis||void 0===globalThis?void 0:globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG)&&globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG(this),this.constructor!==t||this.initialize()}var e,r,n;return e=t,r=[{key:"createObservable",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.isEqualRoot,n=e.isEqual,i=e.name,a=o(this.stateControls(),1)[0],u=[],c=a(),l=(null!=t?t:function(t){return t})(a());a((function(e){if(!(null!=r?r:Object.is)(c,e)){c=e;var o=t(e);(null!=n?n:Object.is)(l,o)||(l=o,u.forEach((function(t){return t()})))}}),{skipFirst:!0});var s=function(t,e,r){var n;if(!t)return l;var o=(0,d.isFunction)(e),i=o?t:void 0,a=o?e:t,c=null!==(n=o?r:e)&&void 0!==n?n:void 0,s=function(){return a(i?i(l):l)};(null==c?void 0:c.skipFirst)||s();var f=function(){s()};return u.push(f),function(){u.splice(u.indexOf(f),1)}};return s._name=null!=i?i:(0,m.uniqueId)("ob:"),s.createObservable=this.createObservable.bind(s),s.stateControls=function(){return[s]},s}}],r&&c(e.prototype,r),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.GlobalStore=O},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){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,a=void 0,a=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,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(a)?a:String(a)),o)}var i,a}function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}function a(t){var e=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}}();return function(){var r,o=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(o,arguments,i)}else r=o.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,r)}}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.GlobalStoreAbstract=void 0;var c=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&&i(t,e)}(c,t);var e,r,n,u=a(c);function c(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(t=u.apply(this,arguments)).onInit=function(e){t.onInitialize(e)},t.onStateChanged=function(e){t.onChange(e)},t}return e=c,r&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}(r(774).GlobalStore);e.GlobalStoreAbstract=c},446:(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)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(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=void 0;var i=r(156),a=r(871),u=r(100),c=r(947);e.combineRetrieverAsynchronously=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 l=n(a.combineRetrieverEmitterAsynchronously.apply(void 0,[t].concat(r)),3),s=l[0],f=l[1],d=l[2];return[function(t,e){var r=n((0,i.useState)((function(){var e=f();return t?t(e):e})),2),o=r[0],a=r[1];return(0,i.useEffect)((function(){var r,n=Object.assign({delay:0,isEqual:c.shallowCompare},null!=e?e:{}),o=void 0!==n.isEqual?n.isEqual:c.shallowCompare,i=s((function(e){return t?t(e):e}),(0,u.debounce)((function(e){var r=t?t(e):e;(null==o?void 0:o(e,r))||a(r)}),null!==(r=n.delay)&&void 0!==r?r:0));return function(){i()}}),[]),[o,null,null]},f,d]}},871:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.combineRetrieverEmitterAsynchronously=void 0;var n=r(100),o=r(947);e.combineRetrieverEmitterAsynchronously=function(t){for(var e,r,i,a=arguments.length,u=new Array(a>1?a-1:0),c=1;c<a;c++)u[c-1]=arguments[c];var l=u,s=new Map(l.map((function(t,e){return[e,t()]}))),f=t.selector(Array.from(s.values())),d=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:o.shallowCompare,v=new Set,p=(0,n.debounce)((function(){var e=t.selector(Array.from(s.values()));(null==d?void 0:d(f,e))||(f=e,v.forEach((function(t){return t()})))}),null===(i=null==t?void 0:t.config)||void 0===i?void 0:i.delay),b=l.map((function(t,e){return t((function(t){s.set(e,t),p()}))})),y=function(t,e,r){var i,a,u="function"==typeof e,c=u?t:null,l=u?e:t,s=u?r:e,d=Object.assign({delay:0,isEqual:o.shallowCompare},null!=s?s:{}),p=null!==(i=null==c?void 0:c(f))&&void 0!==i?i:f;d.skipFirst||l(p);var b=(0,n.debounce)((function(){var t,e,r=null!==(t=null==c?void 0:c(f))&&void 0!==t?t:f;(null===(e=d.isEqual)||void 0===e?void 0:e.call(d,p,r))||(p=r,l(r))}),null!==(a=d.delay)&&void 0!==a?a:0);return v.add(b),function(){v.delete(b)}};return[y,function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e[0]?y.apply(void 0,e):f},function(){b.forEach((function(t){return t()}))}]}},564:(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=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e},i=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.createContext=void 0;var a=i(r(156)),u=r(774),c=r(244),l=r(125),s=r(176),f=r(93);e.createContext=function(t,e){var r=new Map,n=a.default.createContext(f.uniqueSymbol),o=function(){var t=a.default.useContext(n);if(t===f.uniqueSymbol)throw new Error("context hooks need to be used inside a provider");return t};o.createSelectorHook=function(t,e){var n=(0,s.uniqueId)("cs:");return function(){var i,a,u=o(),c=(i=u,null!==(a=r.get(i))&&void 0!==a?a:r.set(i,new Map).get(i));c.has(n)||c.set(n,u.createSelectorHook(t,e));var s=c.get(n);if((0,l.isNil)(s))throw new Error("useSelectedHook is nil");return s.apply(void 0,arguments)}};return[o,function(o){var i=o.children,l=o.value,s=o.ref,f=(0,a.useMemo)((function(){var r=void 0===l?t():(0,c.isFunction)(l)?l(t()):l,n=new u.GlobalStore(r,e);return{store:n,hook:n.getHook()}}),[]),d=f.store,v=f.hook;return r.has(v)||r.set(v,new Map),(0,a.useEffect)((function(){return function(){var t,e,n,o;r.delete(v),null===(e=null===(t=d.callbacks)||void 0===t?void 0:t.onUnMount)||void 0===e||e.call(t),null===(o=(n=d).__onUnMountContext)||void 0===o||o.call(n,d,v)}}),[]),(0,a.useImperativeHandle)(s,(function(){return s?d.getConfigCallbackParam():{}}),[d,s]),a.default.createElement(n.Provider,{value:v},i)}]}},213:(t,e,r)=>{"use strict";var n=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.createCustomGlobalState=void 0;var o=r(553);e.createCustomGlobalState=function(t){var e=t.onInitialize,r=t.onChange;return function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=i.callbacks,u=n(i,["callbacks"]);return(0,o.createGlobalState)(t,Object.assign(Object.assign({},u),{callbacks:Object.assign(Object.assign({},null!=a?a:{}),{onInit:function(t){var r;null==e||e(t,null==u?void 0:u.config),null===(r=null==a?void 0:a.onInit)||void 0===r||r.call(a,t)},onStateChanged:function(t){var e;null==r||r(t,null==u?void 0:u.config),null===(e=null==a?void 0:a.onStateChanged)||void 0===e||e.call(a,t)}})}))}}},553:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createGlobalState=void 0;var n=r(774);e.createGlobalState=function(t,e){return new n.GlobalStore(t,e).getHook()}},100:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.debounce=void 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)}}},858:(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)}Object.defineProperty(e,"__esModule",{value:!0}),e.isRecord=void 0;var o=r(125);e.isRecord=function(t){return!(0,o.isNil)(t)&&"object"===n(t)}},947:(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.shallowCompare=void 0;var c=r(416),l=r(231),s=r(125),f=r(858);e.shallowCompare=function(t,e){if(t===e)return!0;var r=u(t),i=u(e);if(r!==i)return!1;if((0,s.isNil)(t)||(0,s.isNil)(e)||(0,c.isPrimitive)(t)&&(0,c.isPrimitive)(e)||(0,l.isDate)(t)&&(0,l.isDate)(e)||"function"===r&&"function"===i)return t===e;if(Array.isArray(t)){var a=t,d=e;if(a.length!==d.length)return!1;for(var v=0;v<a.length;v++){if(a[v]!==d[v])return!1}}if(t instanceof Map){var p=t,b=e;if(p.size!==b.size)return!1;var y,h=o(p);try{for(h.s();!(y=h.n()).done;){var m=n(y.value,2),g=m[0];if(m[1]!==b.get(g))return!1}}catch(t){h.e(t)}finally{h.f()}}if(t instanceof Set){var S=t,O=e;if(S.size!==O.size)return!1;var w,j=o(S);try{for(j.s();!(w=j.n()).done;){var _=w.value;if(!O.has(_))return!1}}catch(t){j.e(t)}finally{j.f()}}if(!(0,f.isRecord)(t)||!(0,f.isRecord)(e))return t===e;var C=Object.keys(t),P=Object.keys(e);if(C.length!==P.length)return!1;for(var E=0,x=C;E<x.length;E++){var A=x[E];if(t[A]!==e[A])return!1}return!0}},544:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.throwWrongKeyOnActionCollectionConfig=void 0;e.throwWrongKeyOnActionCollectionConfig=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"))}},176:(t,e)=>{"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),e.uniqueId=void 0,e.uniqueId=(r=0,function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return r===Number.MAX_SAFE_INTEGER&&(r=0),t+Date.now().toString(36)+(r++).toString(36)})},93:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.uniqueSymbol=void 0,e.uniqueSymbol=Symbol("unique")},607:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.useConstantValueRef=void 0;var n=r(156),o=r(93);e.useConstantValueRef=function(t){var e=(0,n.useRef)(o.uniqueSymbol);return e.current===o.uniqueSymbol&&(e.current=t()),e}},231:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isDate=void 0,e.isDate=function(t){return t instanceof Date}})(),t})()},244:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isFunction=void 0,e.isFunction=function(t){return"function"==typeof t||t instanceof Function}})(),t})()},125:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isNil=void 0,e.isNil=function(t){return null==t}})(),t})()},416:function(t){t.exports=(()=>{"use strict";var t={112:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isBoolean=void 0,e.isBoolean=function(t){return"boolean"==typeof t}},243:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isNil=void 0,e.isNil=function(t){return null==t}},11:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isNumber=void 0,e.isNumber=function(t){return"number"==typeof t}},671:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isString=void 0,e.isString=function(t){return"string"==typeof t}}},e={};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}var n={};return(()=>{var t=n;function e(t){return e="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},e(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.isPrimitive=void 0;var o=r(112),i=r(243),a=r(11),u=r(671);t.isPrimitive=function(t){return(0,i.isNil)(t)||(0,a.isNumber)(t)||(0,o.isBoolean)(t)||(0,u.isString)(t)||"symbol"===e(t)}})(),n})()},281:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isString=void 0,e.isString=function(t){return"string"==typeof t}})(),t})()},156:e=>{"use strict";e.exports=t}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var i=r[t]={exports:{}};return e[t].call(i.exports,i,i.exports,n),i.exports}var o={};return(()=>{"use strict";var t=o;Object.defineProperty(t,"__esModule",{value:!0}),t.createContext=t.combineRetrieverEmitterAsynchronously=t.combineRetrieverAsynchronously=t.useConstantValueRef=t.uniqueSymbol=t.isRecord=t.throwWrongKeyOnActionCollectionConfig=t.uniqueId=t.debounce=t.shallowCompare=t.createCustomGlobalState=t.createGlobalState=t.GlobalStoreAbstract=t.GlobalStore=void 0;var e=n(774);Object.defineProperty(t,"GlobalStore",{enumerable:!0,get:function(){return e.GlobalStore}});var r=n(195);Object.defineProperty(t,"GlobalStoreAbstract",{enumerable:!0,get:function(){return r.GlobalStoreAbstract}});var i=n(553);Object.defineProperty(t,"createGlobalState",{enumerable:!0,get:function(){return i.createGlobalState}});var a=n(213);Object.defineProperty(t,"createCustomGlobalState",{enumerable:!0,get:function(){return a.createCustomGlobalState}});var u=n(947);Object.defineProperty(t,"shallowCompare",{enumerable:!0,get:function(){return u.shallowCompare}});var c=n(100);Object.defineProperty(t,"debounce",{enumerable:!0,get:function(){return c.debounce}});var l=n(176);Object.defineProperty(t,"uniqueId",{enumerable:!0,get:function(){return l.uniqueId}});var s=n(544);Object.defineProperty(t,"throwWrongKeyOnActionCollectionConfig",{enumerable:!0,get:function(){return s.throwWrongKeyOnActionCollectionConfig}});var f=n(858);Object.defineProperty(t,"isRecord",{enumerable:!0,get:function(){return f.isRecord}});var d=n(93);Object.defineProperty(t,"uniqueSymbol",{enumerable:!0,get:function(){return d.uniqueSymbol}});var v=n(607);Object.defineProperty(t,"useConstantValueRef",{enumerable:!0,get:function(){return v.useConstantValueRef}});var p=n(446);Object.defineProperty(t,"combineRetrieverAsynchronously",{enumerable:!0,get:function(){return p.combineRetrieverAsynchronously}});var b=n(871);Object.defineProperty(t,"combineRetrieverEmitterAsynchronously",{enumerable:!0,get:function(){return b.combineRetrieverEmitterAsynchronously}});var y=n(564);Object.defineProperty(t,"createContext",{enumerable:!0,get:function(){return y.createContext}})})(),o})()));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("react")):"function"==typeof define&&define.amd?define(["react"],r):"object"==typeof exports?exports["react-hooks-global-states"]=r(require("react")):e["react-hooks-global-states"]=r(e.react)}(this,(e=>(()=>{var r={871:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.combineRetrieverEmitterAsynchronously=void 0;var n=t(100),o=t(947);r.combineRetrieverEmitterAsynchronously=function(e){for(var r,t,i,u=arguments.length,l=new Array(u>1?u-1:0),a=1;a<u;a++)l[a-1]=arguments[a];var f=l,c=new Map(f.map((function(e,r){return[r,e()]}))),s=e.selector(Array.from(c.values())),y=void 0!==(null===(r=null==e?void 0:e.config)||void 0===r?void 0:r.isEqual)?null===(t=null==e?void 0:e.config)||void 0===t?void 0:t.isEqual:o.shallowCompare,v=new Set,d=(0,n.debounce)((function(){var r=e.selector(Array.from(c.values()));(null==y?void 0:y(s,r))||(s=r,v.forEach((function(e){return e()})))}),null===(i=null==e?void 0:e.config)||void 0===i?void 0:i.delay),p=f.map((function(e,r){return e((function(e){c.set(r,e),d()}))})),b=function(e,r,t){var i,u,l="function"==typeof r,a=l?e:null,f=l?r:e,c=l?t:r,y=Object.assign({delay:0,isEqual:o.shallowCompare},null!=c?c:{}),d=null!==(i=null==a?void 0:a(s))&&void 0!==i?i:s;y.skipFirst||f(d);var p=(0,n.debounce)((function(){var e,r,t=null!==(e=null==a?void 0:a(s))&&void 0!==e?e:s;(null===(r=y.isEqual)||void 0===r?void 0:r.call(y,d,t))||(d=t,f(t))}),null!==(u=y.delay)&&void 0!==u?u:0);return v.add(p),function(){v.delete(p)}};return[b,function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return r[0]?b.apply(void 0,r):s},function(){p.forEach((function(e){return e()}))}]}},100:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.debounce=void 0;r.debounce=function(e){var r,t=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];r&&clearTimeout(r),r=setTimeout((function(){e.apply(void 0,o)}),t)}}},858:(e,r,t)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.isRecord=void 0;var o=t(125);r.isRecord=function(e){return!(0,o.isNil)(e)&&"object"===n(e)}},947:(e,r,t)=>{"use strict";function n(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,u,l=[],a=!0,f=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;a=!1}else for(;!(a=(n=i.call(t)).done)&&(l.push(n.value),l.length!==r);a=!0);}catch(e){f=!0,o=e}finally{try{if(!a&&null!=t.return&&(u=t.return(),Object(u)!==u))return}finally{if(f)throw o}}return l}}(e,r)||i(e,r)||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(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=i(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},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 u,l=!0,a=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return l=e.done,e},e:function(e){a=!0,u=e},f:function(){try{l||null==t.return||t.return()}finally{if(a)throw u}}}}function i(e,r){if(e){if("string"==typeof e)return u(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(e,r):void 0}}function u(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.shallowCompare=void 0;var a=t(416),f=t(231),c=t(125),s=t(858);r.shallowCompare=function(e,r){if(e===r)return!0;var t=l(e),i=l(r);if(t!==i)return!1;if((0,c.isNil)(e)||(0,c.isNil)(r)||(0,a.isPrimitive)(e)&&(0,a.isPrimitive)(r)||(0,f.isDate)(e)&&(0,f.isDate)(r)||"function"===t&&"function"===i)return e===r;if(Array.isArray(e)){var u=e,y=r;if(u.length!==y.length)return!1;for(var v=0;v<u.length;v++){if(u[v]!==y[v])return!1}}if(e instanceof Map){var d=e,p=r;if(d.size!==p.size)return!1;var b,m=o(d);try{for(m.s();!(b=m.n()).done;){var h=n(b.value,2),g=h[0];if(h[1]!==p.get(g))return!1}}catch(e){m.e(e)}finally{m.f()}}if(e instanceof Set){var S=e,j=r;if(S.size!==j.size)return!1;var A,w=o(S);try{for(w.s();!(A=w.n()).done;){var O=A.value;if(!j.has(O))return!1}}catch(e){w.e(e)}finally{w.f()}}if(!(0,s.isRecord)(e)||!(0,s.isRecord)(r))return e===r;var _=Object.keys(e),x=Object.keys(r);if(_.length!==x.length)return!1;for(var E=0,M=_;E<M.length;E++){var P=M[E];if(e[P]!==r[P])return!1}return!0}},231:function(e){e.exports=(()=>{"use strict";var e={};return(()=>{var r=e;Object.defineProperty(r,"__esModule",{value:!0}),r.isDate=void 0,r.isDate=function(e){return e instanceof Date}})(),e})()},125:function(e){e.exports=(()=>{"use strict";var e={};return(()=>{var r=e;Object.defineProperty(r,"__esModule",{value:!0}),r.isNil=void 0,r.isNil=function(e){return null==e}})(),e})()},416:function(e){e.exports=(()=>{"use strict";var e={112:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isBoolean=void 0,r.isBoolean=function(e){return"boolean"==typeof e}},243:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isNil=void 0,r.isNil=function(e){return null==e}},11:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isNumber=void 0,r.isNumber=function(e){return"number"==typeof e}},671:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isString=void 0,r.isString=function(e){return"string"==typeof e}}},r={};function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n](i,i.exports,t),i.exports}var n={};return(()=>{var e=n;function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.isPrimitive=void 0;var o=t(112),i=t(243),u=t(11),l=t(671);e.isPrimitive=function(e){return(0,i.isNil)(e)||(0,u.isNumber)(e)||(0,o.isBoolean)(e)||(0,l.isString)(e)||"symbol"===r(e)}})(),n})()},156:r=>{"use strict";r.exports=e}},t={};function n(e){var o=t[e];if(void 0!==o)return o.exports;var i=t[e]={exports:{}};return r[e].call(i.exports,i,i.exports,n),i.exports}var o={};return(()=>{"use strict";var e=o;function r(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,u,l=[],a=!0,f=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;a=!1}else for(;!(a=(n=i.call(t)).done)&&(l.push(n.value),l.length!==r);a=!0);}catch(e){f=!0,o=e}finally{try{if(!a&&null!=t.return&&(u=t.return(),Object(u)!==u))return}finally{if(f)throw o}}return l}}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t(e,r)}(e,r)||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 t(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}Object.defineProperty(e,"__esModule",{value:!0}),e.combineRetrieverAsynchronously=void 0;var i=n(156),u=n(871),l=n(100),a=n(947);e.combineRetrieverAsynchronously=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];var f=r(u.combineRetrieverEmitterAsynchronously.apply(void 0,[e].concat(n)),3),c=f[0],s=f[1],y=f[2];return[function(e,t){var n=r((0,i.useState)((function(){var r=s();return e?e(r):r})),2),o=n[0],u=n[1];return(0,i.useEffect)((function(){var r,n=Object.assign({delay:0,isEqual:a.shallowCompare},null!=t?t:{}),o=void 0!==n.isEqual?n.isEqual:a.shallowCompare,i=c((function(r){return e?e(r):r}),(0,l.debounce)((function(r){var t=e?e(r):r;(null==o?void 0:o(r,t))||u(t)}),null!==(r=n.delay)&&void 0!==r?r:0));return function(){i()}}),[]),[o,null,null]},s,y]}})(),o})()));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports["react-hooks-global-states"]=r():e["react-hooks-global-states"]=r()}(this,(()=>(()=>{var e={100:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.debounce=void 0;r.debounce=function(e){var r,t=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];r&&clearTimeout(r),r=setTimeout((function(){e.apply(void 0,o)}),t)}}},858:(e,r,t)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.isRecord=void 0;var o=t(125);r.isRecord=function(e){return!(0,o.isNil)(e)&&"object"===n(e)}},947:(e,r,t)=>{"use strict";function n(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var n,o,i,u,l=[],a=!0,f=!1;try{if(i=(t=t.call(e)).next,0===r){if(Object(t)!==t)return;a=!1}else for(;!(a=(n=i.call(t)).done)&&(l.push(n.value),l.length!==r);a=!0);}catch(e){f=!0,o=e}finally{try{if(!a&&null!=t.return&&(u=t.return(),Object(u)!==u))return}finally{if(f)throw o}}return l}}(e,r)||i(e,r)||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(e,r){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=i(e))||r&&e&&"number"==typeof e.length){t&&(e=t);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},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 u,l=!0,a=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return l=e.done,e},e:function(e){a=!0,u=e},f:function(){try{l||null==t.return||t.return()}finally{if(a)throw u}}}}function i(e,r){if(e){if("string"==typeof e)return u(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?u(e,r):void 0}}function u(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}Object.defineProperty(r,"__esModule",{value:!0}),r.shallowCompare=void 0;var a=t(416),f=t(231),c=t(125),s=t(858);r.shallowCompare=function(e,r){if(e===r)return!0;var t=l(e),i=l(r);if(t!==i)return!1;if((0,c.isNil)(e)||(0,c.isNil)(r)||(0,a.isPrimitive)(e)&&(0,a.isPrimitive)(r)||(0,f.isDate)(e)&&(0,f.isDate)(r)||"function"===t&&"function"===i)return e===r;if(Array.isArray(e)){var u=e,v=r;if(u.length!==v.length)return!1;for(var y=0;y<u.length;y++){if(u[y]!==v[y])return!1}}if(e instanceof Map){var d=e,p=r;if(d.size!==p.size)return!1;var b,m=o(d);try{for(m.s();!(b=m.n()).done;){var h=n(b.value,2),g=h[0];if(h[1]!==p.get(g))return!1}}catch(e){m.e(e)}finally{m.f()}}if(e instanceof Set){var S=e,j=r;if(S.size!==j.size)return!1;var _,x=o(S);try{for(x.s();!(_=x.n()).done;){var O=_.value;if(!j.has(O))return!1}}catch(e){x.e(e)}finally{x.f()}}if(!(0,s.isRecord)(e)||!(0,s.isRecord)(r))return e===r;var w=Object.keys(e),A=Object.keys(r);if(w.length!==A.length)return!1;for(var P=0,M=w;P<M.length;P++){var N=M[P];if(e[N]!==r[N])return!1}return!0}},231:function(e){e.exports=(()=>{"use strict";var e={};return(()=>{var r=e;Object.defineProperty(r,"__esModule",{value:!0}),r.isDate=void 0,r.isDate=function(e){return e instanceof Date}})(),e})()},125:function(e){e.exports=(()=>{"use strict";var e={};return(()=>{var r=e;Object.defineProperty(r,"__esModule",{value:!0}),r.isNil=void 0,r.isNil=function(e){return null==e}})(),e})()},416:function(e){e.exports=(()=>{"use strict";var e={112:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isBoolean=void 0,r.isBoolean=function(e){return"boolean"==typeof e}},243:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isNil=void 0,r.isNil=function(e){return null==e}},11:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isNumber=void 0,r.isNumber=function(e){return"number"==typeof e}},671:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isString=void 0,r.isString=function(e){return"string"==typeof e}}},r={};function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={exports:{}};return e[n](i,i.exports,t),i.exports}var n={};return(()=>{var e=n;function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.isPrimitive=void 0;var o=t(112),i=t(243),u=t(11),l=t(671);e.isPrimitive=function(e){return(0,i.isNil)(e)||(0,u.isNumber)(e)||(0,o.isBoolean)(e)||(0,l.isString)(e)||"symbol"===r(e)}})(),n})()}},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}var n={};return(()=>{"use strict";var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.combineRetrieverEmitterAsynchronously=void 0;var r=t(100),o=t(947);e.combineRetrieverEmitterAsynchronously=function(e){for(var t,n,i,u=arguments.length,l=new Array(u>1?u-1:0),a=1;a<u;a++)l[a-1]=arguments[a];var f=l,c=new Map(f.map((function(e,r){return[r,e()]}))),s=e.selector(Array.from(c.values())),v=void 0!==(null===(t=null==e?void 0:e.config)||void 0===t?void 0:t.isEqual)?null===(n=null==e?void 0:e.config)||void 0===n?void 0:n.isEqual:o.shallowCompare,y=new Set,d=(0,r.debounce)((function(){var r=e.selector(Array.from(c.values()));(null==v?void 0:v(s,r))||(s=r,y.forEach((function(e){return e()})))}),null===(i=null==e?void 0:e.config)||void 0===i?void 0:i.delay),p=f.map((function(e,r){return e((function(e){c.set(r,e),d()}))})),b=function(e,t,n){var i,u,l="function"==typeof t,a=l?e:null,f=l?t:e,c=l?n:t,v=Object.assign({delay:0,isEqual:o.shallowCompare},null!=c?c:{}),d=null!==(i=null==a?void 0:a(s))&&void 0!==i?i:s;v.skipFirst||f(d);var p=(0,r.debounce)((function(){var e,r,t=null!==(e=null==a?void 0:a(s))&&void 0!==e?e:s;(null===(r=v.isEqual)||void 0===r?void 0:r.call(v,d,t))||(d=t,f(t))}),null!==(u=v.delay)&&void 0!==u?u:0);return y.add(p),function(){y.delete(p)}};return[b,function(){for(var e=arguments.length,r=new Array(e),t=0;t<e;t++)r[t]=arguments[t];return r[0]?b.apply(void 0,r):s},function(){p.forEach((function(e){return e()}))}]}})(),n})()));
|
package/{lib/src/GlobalStore.combiners.d.ts → combiners.combineRetrieverAsynchronously.d.ts}
RENAMED
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
import { StateGetter, UnsubscribeCallback, SelectorCallback, UseHookConfig, StateHook, BaseMetadata } from './
|
|
2
|
-
/**
|
|
3
|
-
* @description
|
|
4
|
-
* This function allows you to create a derivate state by merging the state of multiple hooks.
|
|
5
|
-
* The update of the derivate state is debounced to avoid unnecessary re-renders.
|
|
6
|
-
* By default, the debounce delay is 0, but you can change it by passing a delay in milliseconds as the third parameter.
|
|
7
|
-
* @returns a tuple with the following elements: [subscribe, getState, dispose]
|
|
8
|
-
*/
|
|
9
|
-
export declare const combineRetrieverEmitterAsynchronously: <TDerivate, TArguments extends StateGetter<unknown>[], TResults = { [K in keyof TArguments]: TArguments[K] extends () => infer TResult ? Exclude<TResult, UnsubscribeCallback> : never; }>(parameters: {
|
|
10
|
-
selector: SelectorCallback<TResults, TDerivate>;
|
|
11
|
-
config?: (UseHookConfig<TDerivate> & {
|
|
12
|
-
delay?: number | undefined;
|
|
13
|
-
}) | undefined;
|
|
14
|
-
}, ...args: TArguments) => [subscribe: StateGetter<TDerivate>, getState: StateGetter<unknown>, dispose: UnsubscribeCallback];
|
|
1
|
+
import { StateGetter, UnsubscribeCallback, SelectorCallback, UseHookConfig, StateHook, BaseMetadata } from './types';
|
|
15
2
|
/**
|
|
16
3
|
* @description
|
|
17
4
|
* This function allows you to create a derivate state by merging the state of multiple hooks.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StateGetter, UnsubscribeCallback, SelectorCallback, UseHookConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* @description
|
|
4
|
+
* This function allows you to create a derivate state by merging the state of multiple hooks.
|
|
5
|
+
* The update of the derivate state is debounced to avoid unnecessary re-renders.
|
|
6
|
+
* By default, the debounce delay is 0, but you can change it by passing a delay in milliseconds as the third parameter.
|
|
7
|
+
* @returns a tuple with the following elements: [subscribe, getState, dispose]
|
|
8
|
+
*/
|
|
9
|
+
export declare const combineRetrieverEmitterAsynchronously: <TDerivate, TArguments extends StateGetter<unknown>[], TResults = { [K in keyof TArguments]: TArguments[K] extends () => infer TResult ? Exclude<TResult, UnsubscribeCallback> : never; }>(parameters: {
|
|
10
|
+
selector: SelectorCallback<TResults, TDerivate>;
|
|
11
|
+
config?: (UseHookConfig<TDerivate> & {
|
|
12
|
+
delay?: number | undefined;
|
|
13
|
+
}) | undefined;
|
|
14
|
+
}, ...args: TArguments) => [subscribe: StateGetter<TDerivate>, getState: StateGetter<unknown>, dispose: UnsubscribeCallback];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ActionCollectionConfig, StateHook, StateSetter, ActionCollectionResult, StateGetter, BaseMetadata, MetadataSetter, GlobalStoreCallbacks } from './GlobalStore.types';
|
|
2
1
|
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { ActionCollectionConfig, StateHook, StateSetter, ActionCollectionResult, StateGetter, BaseMetadata, MetadataSetter, GlobalStoreCallbacks } from './types';
|
|
3
3
|
export type ContextProviderAPI<Value, Metadata extends BaseMetadata | unknown> = {
|
|
4
4
|
setMetadata: MetadataSetter<Metadata>;
|
|
5
5
|
setState: StateSetter<Value>;
|
|
@@ -23,13 +23,6 @@ export interface CreateContext {
|
|
|
23
23
|
Hook,
|
|
24
24
|
ContextProvider<Hook, BaseMetadata>
|
|
25
25
|
];
|
|
26
|
-
<Value, Metadata extends BaseMetadata | unknown, Hook = ContextHook<Value, StateSetter<Value>, Metadata>>(builder: () => Value, args: {
|
|
27
|
-
name?: string;
|
|
28
|
-
metadata?: unknown;
|
|
29
|
-
callbacks?: GlobalStoreCallbacks<Value, Metadata> & {
|
|
30
|
-
onUnMount?: () => void;
|
|
31
|
-
};
|
|
32
|
-
}): readonly [Hook, ContextProvider<Hook, Metadata>];
|
|
33
26
|
<Value, Metadata extends BaseMetadata | unknown, ActionsConfig extends ActionCollectionConfig<Value, Metadata>, PublicStateMutator = keyof ActionsConfig extends never | undefined ? StateSetter<Value> : ActionCollectionResult<Value, Metadata, NonNullable<ActionsConfig>>, Hook = ContextHook<Value, PublicStateMutator, Metadata>>(builder: () => Value, args: {
|
|
34
27
|
name?: string;
|
|
35
28
|
metadata?: unknown;
|
package/createContext.js
ADDED
|
@@ -0,0 +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-hooks-global-states"]=e(require("react")):t["react-hooks-global-states"]=e(t.react)}(this,(t=>(()=>{var e={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,s=!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){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)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 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(){u=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:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=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 C(n||[]);return o(a,"_invoke",{value:j(t,r,u)}),a}function d(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 v(){}function h(){}function b(){}var y={};l(y,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(E([])));m&&m!==e&&r.call(m,a)&&(y=m);var S=b.prototype=v.prototype=Object.create(y);function w(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function i(o,a,u,c){var s=d(t[o],t,a);if("throw"!==s.type){var l=s.arg,f=l.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){l.value=t,u(l)}),(function(t){return i("throw",t,u,c)}))}c(s.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 M()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=_(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=d(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 _(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,_(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=d(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 x(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 k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(t){if(t){var e=t[a];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:M}}function M(){return{value:void 0,done:!0}}return h.prototype=b,o(S,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:h,configurable:!0}),h.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,l(t,s,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},w(O.prototype),l(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new O(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(S),l(S,s,"Generator"),l(S,a,(function(){return this})),l(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=E,C.prototype={constructor:C,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(k),!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),k(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;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function c(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,s(n.key),n)}}function s(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,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===n(e)?e:String(e)}var l=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function u(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStore=void 0;var f=r(156),d=r(244),p=r(125),v=r(281),h=r(858),b=r(947),y=r(544),g=r(176),m=r(93),S=r(607),w=function(){function t(e){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{metadata:{}};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actionsConfig=null,this.callbacks=null,this.actions=null,this.subscribers=new Map,this.initialize=function(){return l(r,void 0,void 0,u().mark((function t(){var e,r,n,o,i,a;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Object.keys(null!==(e=this.actionsConfig)&&void 0!==e?e:{}).length>0&&(this.actions=this.getStoreActionsMap()),n=this.onInit,o=null!==(r=this.callbacks)&&void 0!==r?r:{},i=o.onInit,n||i){t.next=6;break}return t.abrupt("return");case 6:a=this.getConfigCallbackParam(),null==n||n(a),(0,p.isNil)(i)||null==i||i(a);case 9:case"end":return t.stop()}}),t,this)})))},this.executeSetStateForSubscriber=function(t,e){var n,o,i=t.selector,a=t.callback,u=t.currentState,c=t.config;if(!e.forceUpdate&&(null!==(n=null==c?void 0:c.isEqualRoot)&&void 0!==n?n:function(t,e){return t===e})(e.currentRootState,e.newRootState))return{didUpdate:!1};var s=i?i(e.newRootState):e.newRootState;return!e.forceUpdate&&(null!==(o=null==c?void 0:c.isEqual)&&void 0!==o?o:function(t,e){return t===e})(u,s)?{didUpdate:!1}:(r.partialUpdateSubscription(t.subscriptionId,{currentState:s}),a({state:s},{identifier:e.identifier}),{didUpdate:!0})},this.setState=function(t,e){var n=t.state,o=e.forceUpdate,a=e.identifier,u=r.stateWrapper.state;if(o||u!==n){r.stateWrapper={state:n};var c,s={forceUpdate:o,newRootState:n,currentRootState:u,identifier:a},l=function(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}}}}(r.subscribers.values());try{for(l.s();!(c=l.n()).done;){var f=c.value;r.executeSetStateForSubscriber(f,s)}}catch(t){l.e(t)}finally{l.f()}}},this.setMetadata=function(t){var e=(0,d.isFunction)(t)?t(r.metadata):t;r.metadata=e},this.getMetadata=function(){return r.metadata},this.getState=function(t,e,n){var o;if(!t)return r.stateWrapper.state;var i=(0,d.isFunction)(e),a=i?t:void 0,u=i?e:t,c=null!==(o=i?n:e)&&void 0!==o?o:void 0,s=a?a(r.stateWrapper.state):r.stateWrapper.state;(null==c?void 0:c.skipFirst)||u(s);var l=(0,g.uniqueId)("gs:");return r.setOrUpdateSubscription({subscriptionId:l,selector:a,config:c,currentState:s,callback:function(t){var e=t.state;return u(e)},isSetStateCallback:!1}),function(){r.subscribers.delete(l)}},this.getConfigCallbackParam=function(){var t=r.setMetadata,e=r.getMetadata,n=r.getState,o=r.actions;return{setMetadata:t,getMetadata:e,getState:n,setState:r.setStateWrapper,actions:o}},this.lastSubscriptionId=null,this.setOrUpdateSubscription=function(t){var e=t.subscriptionId;if(!e)return{isNewSubscription:!1};var n=r.subscribers.get(e);return(0,h.isRecord)(n)?(Object.assign(n,t),{isNewSubscription:!1}):(r.executeOnSubscribed(),r.subscribers.set(e,t),r.lastSubscriptionId=e,{isNewSubscription:!0})},this.partialUpdateSubscription=function(t,e){var n=r.subscribers.get(t);(0,h.isRecord)(n)&&Object.assign(n,e)},this.executeOnSubscribed=function(){var t,e=r.onSubscribed,n=null===(t=r.callbacks)||void 0===t?void 0:t.onSubscribed;if(e||n){var o=r.getConfigCallbackParam();null==e||e(o),null==n||n(o)}},this.getHook=function(){var t=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=(0,S.useConstantValueRef)((function(){return{subscriptionId:null,tempInitialRootState:r.stateWrapper.state}})),a=function(){return t?{state:t(r.stateWrapper.state)}:r.stateWrapper},u=o((0,f.useState)(a),2),c=u[0],s=u[1];(0,f.useEffect)((function(){if(!(0,p.isNil)(i.current)){(0,p.isNil)(i.current.subscriptionId)&&(i.current.subscriptionId=(0,g.uniqueId)("ss:"));var e=i.current.subscriptionId,o={subscriptionId:e,currentState:c.state,selector:t,config:n,callback:s,isSetStateCallback:!0};return r.setOrUpdateSubscription(o).isNewSubscription&&(r.executeSetStateForSubscriber(o,{forceUpdate:!1,newRootState:r.stateWrapper.state,currentRootState:i.current.tempInitialRootState,identifier:"on mount state update"}),i.current.tempInitialRootState=m.uniqueSymbol),function(){r.subscribers.delete(e)}}}),[]);var l=(0,v.isString)(i.current)?i.current:"",d=r.subscribers.get(l),h=(null!==(e=null==d?void 0:d.config)&&void 0!==e?e:{dependencies:n.dependencies}).dependencies;return r.partialUpdateSubscription(l,{currentState:c.state,selector:t,config:n,callback:s}),[r.computeSelectedState({selector:t,subscriptionId:l,config:n,currentDependencies:h,computeChildState:a,stateWrapperRef:c}),r.getStateOrchestrator(),r.metadata]};return t.stateControls=r.stateControls,t.createSelectorHook=r.createSelectorHook,t.createObservable=r.createObservable,t},this.computeSelectedState=function(t){var e=t.selector,n=t.subscriptionId,o=t.config,i=t.currentDependencies,a=t.computeChildState,u=t.stateWrapperRef;if(!e||!n)return u.state;var c=o.dependencies;if(i===c)return u.state;if((null==i?void 0:i.length)===(null==c?void 0:c.length)&&(0,b.shallowCompare)(i,c))return u.state;var s=a().state;return r.partialUpdateSubscription(n,{currentState:s}),u.state=s,s},this.createSelectorHook=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.isEqualRoot,a=n.isEqual,u=n.name,c=o(r.stateControls(),3),s=c[0],l=c[1],f=c[2],p=s(),v=(null!=e?e:function(t){return t})(p),h=new t(v,{name:null!=u?u:(0,g.uniqueId)("sh:")}),b=o(h.stateControls(),2),y=b[0],m=b[1];s((function(t){if(!(null!=i?i:Object.is)(p,t)){p=t;var r=e(t);(null!=a?a:Object.is)(v,r)||(v=r,m(r))}}),{skipFirst:!0});var S=h.getHook(),w=function(t,e){return[o((0,d.isFunction)(t)?S(t,e):S(),1)[0],l,f]};return w.stateControls=function(){return[y,l,f]},w.createSelectorHook=r.createSelectorHook.bind(w),w.createObservable=r.createObservable.bind(w),w},this.stateControls=function(){var t=r.getStateOrchestrator(),e=r.getMetadata;return[r.getState,t,e]},this.getStateOrchestrator=function(){return r.actions?r.actions:r.setStateWrapper},this.setStateWrapper=function(t){var e,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.forceUpdate,a=o.identifier,u=r.stateWrapper.state,c=(0,d.isFunction)(t)?t(u):t;if(i||r.stateWrapper.state!==c){var s=r.setMetadata,l=r.getMetadata,f=r.getState,p=r.actions,v={setMetadata:s,getMetadata:l,setState:r.setState,getState:f,actions:p,previousState:u,state:c,identifier:a},h=r.computePreventStateChange,b=null===(e=r.callbacks)||void 0===e?void 0:e.computePreventStateChange;if(h||b)if((null==h?void 0:h(v))||(null==b?void 0:b(v)))return;r.setState({state:c},{forceUpdate:i,identifier:a});var y=r.onStateChanged,g=null===(n=r.callbacks)||void 0===n?void 0:n.onStateChanged;(y||g)&&(null==y||y(v),null==g||g(v))}},this.getStoreActionsMap=function(){if(!(0,h.isRecord)(r.actionsConfig))return null;var t=r.actionsConfig,e=r.setMetadata,n=r.setStateWrapper,o=r.getState,i=r.getMetadata,a=Object.keys(t).reduce((function(r,u){var c,l,f;return Object.assign(r,(c={},f=function(){for(var r=t[u],c=arguments.length,s=new Array(c),l=0;l<c;l++)s[l]=arguments[l];var f=r.apply(a,s);return"function"!=typeof f&&(0,y.throwWrongKeyOnActionCollectionConfig)(u),f.call(a,{setState:n,getState:o,setMetadata:e,getMetadata:i,actions:a})},(l=s(l=u))in c?Object.defineProperty(c,l,{value:f,enumerable:!0,configurable:!0,writable:!0}):c[l]=f,c)),r}),{});return a};var a=n.metadata,c=n.callbacks,w=n.actions,O=n.name;this.stateWrapper={state:e},this._name=null!=O?O:(0,g.uniqueId)("gs:"),this.metadata=null!=a?a:{},this.callbacks=null!=c?c:null,this.actionsConfig=null!=w?w:null,(null===globalThis||void 0===globalThis?void 0:globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG)&&globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG(this),this.constructor!==t||this.initialize()}var e,r,n;return e=t,r=[{key:"createObservable",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.isEqualRoot,n=e.isEqual,i=e.name,a=o(this.stateControls(),1)[0],u=[],c=a(),s=(null!=t?t:function(t){return t})(a());a((function(e){if(!(null!=r?r:Object.is)(c,e)){c=e;var o=t(e);(null!=n?n:Object.is)(s,o)||(s=o,u.forEach((function(t){return t()})))}}),{skipFirst:!0});var l=function(t,e,r){var n;if(!t)return s;var o=(0,d.isFunction)(e),i=o?t:void 0,a=o?e:t,c=null!==(n=o?r:e)&&void 0!==n?n:void 0,l=function(){return a(i?i(s):s)};(null==c?void 0:c.skipFirst)||l();var f=function(){l()};return u.push(f),function(){u.splice(u.indexOf(f),1)}};return l._name=null!=i?i:(0,g.uniqueId)("ob:"),l.createObservable=this.createObservable.bind(l),l.stateControls=function(){return[l]},l}}],r&&c(e.prototype,r),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.GlobalStore=w},858:(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)}Object.defineProperty(e,"__esModule",{value:!0}),e.isRecord=void 0;var o=r(125);e.isRecord=function(t){return!(0,o.isNil)(t)&&"object"===n(t)}},947:(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,s=!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){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)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.shallowCompare=void 0;var c=r(416),s=r(231),l=r(125),f=r(858);e.shallowCompare=function(t,e){if(t===e)return!0;var r=u(t),i=u(e);if(r!==i)return!1;if((0,l.isNil)(t)||(0,l.isNil)(e)||(0,c.isPrimitive)(t)&&(0,c.isPrimitive)(e)||(0,s.isDate)(t)&&(0,s.isDate)(e)||"function"===r&&"function"===i)return t===e;if(Array.isArray(t)){var a=t,d=e;if(a.length!==d.length)return!1;for(var p=0;p<a.length;p++){if(a[p]!==d[p])return!1}}if(t instanceof Map){var v=t,h=e;if(v.size!==h.size)return!1;var b,y=o(v);try{for(y.s();!(b=y.n()).done;){var g=n(b.value,2),m=g[0];if(g[1]!==h.get(m))return!1}}catch(t){y.e(t)}finally{y.f()}}if(t instanceof Set){var S=t,w=e;if(S.size!==w.size)return!1;var O,j=o(S);try{for(j.s();!(O=j.n()).done;){var _=O.value;if(!w.has(_))return!1}}catch(t){j.e(t)}finally{j.f()}}if(!(0,f.isRecord)(t)||!(0,f.isRecord)(e))return t===e;var x=Object.keys(t),k=Object.keys(e);if(x.length!==k.length)return!1;for(var C=0,E=x;C<E.length;C++){var M=E[C];if(t[M]!==e[M])return!1}return!0}},544:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.throwWrongKeyOnActionCollectionConfig=void 0;e.throwWrongKeyOnActionCollectionConfig=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"))}},176:(t,e)=>{"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),e.uniqueId=void 0,e.uniqueId=(r=0,function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return r===Number.MAX_SAFE_INTEGER&&(r=0),t+Date.now().toString(36)+(r++).toString(36)})},93:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.uniqueSymbol=void 0,e.uniqueSymbol=Symbol("unique")},607:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.useConstantValueRef=void 0;var n=r(156),o=r(93);e.useConstantValueRef=function(t){var e=(0,n.useRef)(o.uniqueSymbol);return e.current===o.uniqueSymbol&&(e.current=t()),e}},231:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isDate=void 0,e.isDate=function(t){return t instanceof Date}})(),t})()},244:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isFunction=void 0,e.isFunction=function(t){return"function"==typeof t||t instanceof Function}})(),t})()},125:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isNil=void 0,e.isNil=function(t){return null==t}})(),t})()},416:function(t){t.exports=(()=>{"use strict";var t={112:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isBoolean=void 0,e.isBoolean=function(t){return"boolean"==typeof t}},243:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isNil=void 0,e.isNil=function(t){return null==t}},11:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isNumber=void 0,e.isNumber=function(t){return"number"==typeof t}},671:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isString=void 0,e.isString=function(t){return"string"==typeof t}}},e={};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}var n={};return(()=>{var t=n;function e(t){return e="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},e(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.isPrimitive=void 0;var o=r(112),i=r(243),a=r(11),u=r(671);t.isPrimitive=function(t){return(0,i.isNil)(t)||(0,a.isNumber)(t)||(0,o.isBoolean)(t)||(0,u.isString)(t)||"symbol"===e(t)}})(),n})()},281:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isString=void 0,e.isString=function(t){return"string"==typeof t}})(),t})()},156:e=>{"use strict";e.exports=t}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var i=r[t]={exports:{}};return e[t].call(i.exports,i,i.exports,n),i.exports}var o={};return(()=>{"use strict";var t=o,e=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]},r=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e},i=function(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var o in t)"default"!==o&&Object.prototype.hasOwnProperty.call(t,o)&&e(n,t,o);return r(n,t),n};Object.defineProperty(t,"__esModule",{value:!0}),t.createContext=void 0;var a=i(n(156)),u=n(774),c=n(244),s=n(125),l=n(176),f=n(93);t.createContext=function(t,e){var r=new Map,n=a.default.createContext(f.uniqueSymbol),o=function(){var t=a.default.useContext(n);if(t===f.uniqueSymbol)throw new Error("context hooks need to be used inside a provider");return t};o.createSelectorHook=function(t,e){var n=(0,l.uniqueId)("cs:");return function(){var i,a,u=o(),c=(i=u,null!==(a=r.get(i))&&void 0!==a?a:r.set(i,new Map).get(i));c.has(n)||c.set(n,u.createSelectorHook(t,e));var l=c.get(n);if((0,s.isNil)(l))throw new Error("useSelectedHook is nil");return l.apply(void 0,arguments)}};return[o,function(o){var i=o.children,s=o.value,l=o.ref,f=(0,a.useMemo)((function(){var r=void 0===s?t():(0,c.isFunction)(s)?s(t()):s,n=new u.GlobalStore(r,e);return{store:n,hook:n.getHook()}}),[]),d=f.store,p=f.hook;return r.has(p)||r.set(p,new Map),(0,a.useEffect)((function(){return function(){var t,e,n,o;r.delete(p),null===(e=null===(t=d.callbacks)||void 0===t?void 0:t.onUnMount)||void 0===e||e.call(t),null===(o=(n=d).__onUnMountContext)||void 0===o||o.call(n,d,p)}}),[]),(0,a.useImperativeHandle)(l,(function(){return l?d.getConfigCallbackParam():{}}),[d,l]),a.default.createElement(n.Provider,{value:p},i)}]}})(),o})()));
|
|
@@ -0,0 +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-hooks-global-states"]=e(require("react")):t["react-hooks-global-states"]=e(t.react)}(this,(t=>(()=>{var e={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,s=!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){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)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 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(){u=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:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=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 C(n||[]);return o(a,"_invoke",{value:j(t,r,u)}),a}function d(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 v(){}function h(){}function b(){}var y={};l(y,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(E([])));m&&m!==e&&r.call(m,a)&&(y=m);var S=b.prototype=v.prototype=Object.create(y);function w(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function i(o,a,u,c){var s=d(t[o],t,a);if("throw"!==s.type){var l=s.arg,f=l.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){l.value=t,u(l)}),(function(t){return i("throw",t,u,c)}))}c(s.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 I()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=_(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=d(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 _(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,_(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=d(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 x(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 k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function E(t){if(t){var e=t[a];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:I}}function I(){return{value:void 0,done:!0}}return h.prototype=b,o(S,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:h,configurable:!0}),h.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,l(t,s,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},w(O.prototype),l(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new O(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(S),l(S,s,"Generator"),l(S,a,(function(){return this})),l(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=E,C.prototype={constructor:C,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(k),!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),k(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;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:E(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function c(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,s(n.key),n)}}function s(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,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===n(e)?e:String(e)}var l=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function u(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStore=void 0;var f=r(156),d=r(244),p=r(125),v=r(281),h=r(858),b=r(947),y=r(544),g=r(176),m=r(93),S=r(607),w=function(){function t(e){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{metadata:{}};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actionsConfig=null,this.callbacks=null,this.actions=null,this.subscribers=new Map,this.initialize=function(){return l(r,void 0,void 0,u().mark((function t(){var e,r,n,o,i,a;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Object.keys(null!==(e=this.actionsConfig)&&void 0!==e?e:{}).length>0&&(this.actions=this.getStoreActionsMap()),n=this.onInit,o=null!==(r=this.callbacks)&&void 0!==r?r:{},i=o.onInit,n||i){t.next=6;break}return t.abrupt("return");case 6:a=this.getConfigCallbackParam(),null==n||n(a),(0,p.isNil)(i)||null==i||i(a);case 9:case"end":return t.stop()}}),t,this)})))},this.executeSetStateForSubscriber=function(t,e){var n,o,i=t.selector,a=t.callback,u=t.currentState,c=t.config;if(!e.forceUpdate&&(null!==(n=null==c?void 0:c.isEqualRoot)&&void 0!==n?n:function(t,e){return t===e})(e.currentRootState,e.newRootState))return{didUpdate:!1};var s=i?i(e.newRootState):e.newRootState;return!e.forceUpdate&&(null!==(o=null==c?void 0:c.isEqual)&&void 0!==o?o:function(t,e){return t===e})(u,s)?{didUpdate:!1}:(r.partialUpdateSubscription(t.subscriptionId,{currentState:s}),a({state:s},{identifier:e.identifier}),{didUpdate:!0})},this.setState=function(t,e){var n=t.state,o=e.forceUpdate,a=e.identifier,u=r.stateWrapper.state;if(o||u!==n){r.stateWrapper={state:n};var c,s={forceUpdate:o,newRootState:n,currentRootState:u,identifier:a},l=function(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}}}}(r.subscribers.values());try{for(l.s();!(c=l.n()).done;){var f=c.value;r.executeSetStateForSubscriber(f,s)}}catch(t){l.e(t)}finally{l.f()}}},this.setMetadata=function(t){var e=(0,d.isFunction)(t)?t(r.metadata):t;r.metadata=e},this.getMetadata=function(){return r.metadata},this.getState=function(t,e,n){var o;if(!t)return r.stateWrapper.state;var i=(0,d.isFunction)(e),a=i?t:void 0,u=i?e:t,c=null!==(o=i?n:e)&&void 0!==o?o:void 0,s=a?a(r.stateWrapper.state):r.stateWrapper.state;(null==c?void 0:c.skipFirst)||u(s);var l=(0,g.uniqueId)("gs:");return r.setOrUpdateSubscription({subscriptionId:l,selector:a,config:c,currentState:s,callback:function(t){var e=t.state;return u(e)},isSetStateCallback:!1}),function(){r.subscribers.delete(l)}},this.getConfigCallbackParam=function(){var t=r.setMetadata,e=r.getMetadata,n=r.getState,o=r.actions;return{setMetadata:t,getMetadata:e,getState:n,setState:r.setStateWrapper,actions:o}},this.lastSubscriptionId=null,this.setOrUpdateSubscription=function(t){var e=t.subscriptionId;if(!e)return{isNewSubscription:!1};var n=r.subscribers.get(e);return(0,h.isRecord)(n)?(Object.assign(n,t),{isNewSubscription:!1}):(r.executeOnSubscribed(),r.subscribers.set(e,t),r.lastSubscriptionId=e,{isNewSubscription:!0})},this.partialUpdateSubscription=function(t,e){var n=r.subscribers.get(t);(0,h.isRecord)(n)&&Object.assign(n,e)},this.executeOnSubscribed=function(){var t,e=r.onSubscribed,n=null===(t=r.callbacks)||void 0===t?void 0:t.onSubscribed;if(e||n){var o=r.getConfigCallbackParam();null==e||e(o),null==n||n(o)}},this.getHook=function(){var t=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=(0,S.useConstantValueRef)((function(){return{subscriptionId:null,tempInitialRootState:r.stateWrapper.state}})),a=function(){return t?{state:t(r.stateWrapper.state)}:r.stateWrapper},u=o((0,f.useState)(a),2),c=u[0],s=u[1];(0,f.useEffect)((function(){if(!(0,p.isNil)(i.current)){(0,p.isNil)(i.current.subscriptionId)&&(i.current.subscriptionId=(0,g.uniqueId)("ss:"));var e=i.current.subscriptionId,o={subscriptionId:e,currentState:c.state,selector:t,config:n,callback:s,isSetStateCallback:!0};return r.setOrUpdateSubscription(o).isNewSubscription&&(r.executeSetStateForSubscriber(o,{forceUpdate:!1,newRootState:r.stateWrapper.state,currentRootState:i.current.tempInitialRootState,identifier:"on mount state update"}),i.current.tempInitialRootState=m.uniqueSymbol),function(){r.subscribers.delete(e)}}}),[]);var l=(0,v.isString)(i.current)?i.current:"",d=r.subscribers.get(l),h=(null!==(e=null==d?void 0:d.config)&&void 0!==e?e:{dependencies:n.dependencies}).dependencies;return r.partialUpdateSubscription(l,{currentState:c.state,selector:t,config:n,callback:s}),[r.computeSelectedState({selector:t,subscriptionId:l,config:n,currentDependencies:h,computeChildState:a,stateWrapperRef:c}),r.getStateOrchestrator(),r.metadata]};return t.stateControls=r.stateControls,t.createSelectorHook=r.createSelectorHook,t.createObservable=r.createObservable,t},this.computeSelectedState=function(t){var e=t.selector,n=t.subscriptionId,o=t.config,i=t.currentDependencies,a=t.computeChildState,u=t.stateWrapperRef;if(!e||!n)return u.state;var c=o.dependencies;if(i===c)return u.state;if((null==i?void 0:i.length)===(null==c?void 0:c.length)&&(0,b.shallowCompare)(i,c))return u.state;var s=a().state;return r.partialUpdateSubscription(n,{currentState:s}),u.state=s,s},this.createSelectorHook=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.isEqualRoot,a=n.isEqual,u=n.name,c=o(r.stateControls(),3),s=c[0],l=c[1],f=c[2],p=s(),v=(null!=e?e:function(t){return t})(p),h=new t(v,{name:null!=u?u:(0,g.uniqueId)("sh:")}),b=o(h.stateControls(),2),y=b[0],m=b[1];s((function(t){if(!(null!=i?i:Object.is)(p,t)){p=t;var r=e(t);(null!=a?a:Object.is)(v,r)||(v=r,m(r))}}),{skipFirst:!0});var S=h.getHook(),w=function(t,e){return[o((0,d.isFunction)(t)?S(t,e):S(),1)[0],l,f]};return w.stateControls=function(){return[y,l,f]},w.createSelectorHook=r.createSelectorHook.bind(w),w.createObservable=r.createObservable.bind(w),w},this.stateControls=function(){var t=r.getStateOrchestrator(),e=r.getMetadata;return[r.getState,t,e]},this.getStateOrchestrator=function(){return r.actions?r.actions:r.setStateWrapper},this.setStateWrapper=function(t){var e,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.forceUpdate,a=o.identifier,u=r.stateWrapper.state,c=(0,d.isFunction)(t)?t(u):t;if(i||r.stateWrapper.state!==c){var s=r.setMetadata,l=r.getMetadata,f=r.getState,p=r.actions,v={setMetadata:s,getMetadata:l,setState:r.setState,getState:f,actions:p,previousState:u,state:c,identifier:a},h=r.computePreventStateChange,b=null===(e=r.callbacks)||void 0===e?void 0:e.computePreventStateChange;if(h||b)if((null==h?void 0:h(v))||(null==b?void 0:b(v)))return;r.setState({state:c},{forceUpdate:i,identifier:a});var y=r.onStateChanged,g=null===(n=r.callbacks)||void 0===n?void 0:n.onStateChanged;(y||g)&&(null==y||y(v),null==g||g(v))}},this.getStoreActionsMap=function(){if(!(0,h.isRecord)(r.actionsConfig))return null;var t=r.actionsConfig,e=r.setMetadata,n=r.setStateWrapper,o=r.getState,i=r.getMetadata,a=Object.keys(t).reduce((function(r,u){var c,l,f;return Object.assign(r,(c={},f=function(){for(var r=t[u],c=arguments.length,s=new Array(c),l=0;l<c;l++)s[l]=arguments[l];var f=r.apply(a,s);return"function"!=typeof f&&(0,y.throwWrongKeyOnActionCollectionConfig)(u),f.call(a,{setState:n,getState:o,setMetadata:e,getMetadata:i,actions:a})},(l=s(l=u))in c?Object.defineProperty(c,l,{value:f,enumerable:!0,configurable:!0,writable:!0}):c[l]=f,c)),r}),{});return a};var a=n.metadata,c=n.callbacks,w=n.actions,O=n.name;this.stateWrapper={state:e},this._name=null!=O?O:(0,g.uniqueId)("gs:"),this.metadata=null!=a?a:{},this.callbacks=null!=c?c:null,this.actionsConfig=null!=w?w:null,(null===globalThis||void 0===globalThis?void 0:globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG)&&globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG(this),this.constructor!==t||this.initialize()}var e,r,n;return e=t,r=[{key:"createObservable",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.isEqualRoot,n=e.isEqual,i=e.name,a=o(this.stateControls(),1)[0],u=[],c=a(),s=(null!=t?t:function(t){return t})(a());a((function(e){if(!(null!=r?r:Object.is)(c,e)){c=e;var o=t(e);(null!=n?n:Object.is)(s,o)||(s=o,u.forEach((function(t){return t()})))}}),{skipFirst:!0});var l=function(t,e,r){var n;if(!t)return s;var o=(0,d.isFunction)(e),i=o?t:void 0,a=o?e:t,c=null!==(n=o?r:e)&&void 0!==n?n:void 0,l=function(){return a(i?i(s):s)};(null==c?void 0:c.skipFirst)||l();var f=function(){l()};return u.push(f),function(){u.splice(u.indexOf(f),1)}};return l._name=null!=i?i:(0,g.uniqueId)("ob:"),l.createObservable=this.createObservable.bind(l),l.stateControls=function(){return[l]},l}}],r&&c(e.prototype,r),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.GlobalStore=w},553:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createGlobalState=void 0;var n=r(774);e.createGlobalState=function(t,e){return new n.GlobalStore(t,e).getHook()}},858:(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)}Object.defineProperty(e,"__esModule",{value:!0}),e.isRecord=void 0;var o=r(125);e.isRecord=function(t){return!(0,o.isNil)(t)&&"object"===n(t)}},947:(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,s=!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){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)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.shallowCompare=void 0;var c=r(416),s=r(231),l=r(125),f=r(858);e.shallowCompare=function(t,e){if(t===e)return!0;var r=u(t),i=u(e);if(r!==i)return!1;if((0,l.isNil)(t)||(0,l.isNil)(e)||(0,c.isPrimitive)(t)&&(0,c.isPrimitive)(e)||(0,s.isDate)(t)&&(0,s.isDate)(e)||"function"===r&&"function"===i)return t===e;if(Array.isArray(t)){var a=t,d=e;if(a.length!==d.length)return!1;for(var p=0;p<a.length;p++){if(a[p]!==d[p])return!1}}if(t instanceof Map){var v=t,h=e;if(v.size!==h.size)return!1;var b,y=o(v);try{for(y.s();!(b=y.n()).done;){var g=n(b.value,2),m=g[0];if(g[1]!==h.get(m))return!1}}catch(t){y.e(t)}finally{y.f()}}if(t instanceof Set){var S=t,w=e;if(S.size!==w.size)return!1;var O,j=o(S);try{for(j.s();!(O=j.n()).done;){var _=O.value;if(!w.has(_))return!1}}catch(t){j.e(t)}finally{j.f()}}if(!(0,f.isRecord)(t)||!(0,f.isRecord)(e))return t===e;var x=Object.keys(t),k=Object.keys(e);if(x.length!==k.length)return!1;for(var C=0,E=x;C<E.length;C++){var I=E[C];if(t[I]!==e[I])return!1}return!0}},544:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.throwWrongKeyOnActionCollectionConfig=void 0;e.throwWrongKeyOnActionCollectionConfig=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"))}},176:(t,e)=>{"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),e.uniqueId=void 0,e.uniqueId=(r=0,function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return r===Number.MAX_SAFE_INTEGER&&(r=0),t+Date.now().toString(36)+(r++).toString(36)})},93:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.uniqueSymbol=void 0,e.uniqueSymbol=Symbol("unique")},607:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.useConstantValueRef=void 0;var n=r(156),o=r(93);e.useConstantValueRef=function(t){var e=(0,n.useRef)(o.uniqueSymbol);return e.current===o.uniqueSymbol&&(e.current=t()),e}},231:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isDate=void 0,e.isDate=function(t){return t instanceof Date}})(),t})()},244:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isFunction=void 0,e.isFunction=function(t){return"function"==typeof t||t instanceof Function}})(),t})()},125:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isNil=void 0,e.isNil=function(t){return null==t}})(),t})()},416:function(t){t.exports=(()=>{"use strict";var t={112:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isBoolean=void 0,e.isBoolean=function(t){return"boolean"==typeof t}},243:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isNil=void 0,e.isNil=function(t){return null==t}},11:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isNumber=void 0,e.isNumber=function(t){return"number"==typeof t}},671:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isString=void 0,e.isString=function(t){return"string"==typeof t}}},e={};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}var n={};return(()=>{var t=n;function e(t){return e="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},e(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.isPrimitive=void 0;var o=r(112),i=r(243),a=r(11),u=r(671);t.isPrimitive=function(t){return(0,i.isNil)(t)||(0,a.isNumber)(t)||(0,o.isBoolean)(t)||(0,u.isString)(t)||"symbol"===e(t)}})(),n})()},281:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isString=void 0,e.isString=function(t){return"string"==typeof t}})(),t})()},156:e=>{"use strict";e.exports=t}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var i=r[t]={exports:{}};return e[t].call(i.exports,i,i.exports,n),i.exports}var o={};return(()=>{"use strict";var t=o,e=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(t,"__esModule",{value:!0}),t.createCustomGlobalState=void 0;var r=n(553);t.createCustomGlobalState=function(t){var n=t.onInitialize,o=t.onChange;return function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=i.callbacks,u=e(i,["callbacks"]);return(0,r.createGlobalState)(t,Object.assign(Object.assign({},u),{callbacks:Object.assign(Object.assign({},null!=a?a:{}),{onInit:function(t){var e;null==n||n(t,null==u?void 0:u.config),null===(e=null==a?void 0:a.onInit)||void 0===e||e.call(a,t)},onStateChanged:function(t){var e;null==o||o(t,null==u?void 0:u.config),null===(e=null==a?void 0:a.onStateChanged)||void 0===e||e.call(a,t)}})}))}}})(),o})()));
|
|
@@ -0,0 +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-hooks-global-states"]=e(require("react")):t["react-hooks-global-states"]=e(t.react)}(this,(t=>(()=>{var e={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,s=!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){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)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 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(){u=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:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=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 E(n||[]);return o(a,"_invoke",{value:j(t,r,u)}),a}function d(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 v(){}function h(){}function y(){}var b={};l(b,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(C([])));m&&m!==e&&r.call(m,a)&&(b=m);var S=y.prototype=v.prototype=Object.create(b);function w(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function O(t,e){function i(o,a,u,c){var s=d(t[o],t,a);if("throw"!==s.type){var l=s.arg,f=l.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){l.value=t,u(l)}),(function(t){return i("throw",t,u,c)}))}c(s.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 M()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var u=_(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=d(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 _(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,_(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=d(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 x(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 k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function C(t){if(t){var e=t[a];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:M}}function M(){return{value:void 0,done:!0}}return h.prototype=y,o(S,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:h,configurable:!0}),h.displayName=l(y,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,l(t,s,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},w(O.prototype),l(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new O(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(S),l(S,s,"Generator"),l(S,a,(function(){return this})),l(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=C,E.prototype={constructor:E,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(k),!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),k(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;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:C(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function c(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,s(n.key),n)}}function s(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,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===n(e)?e:String(e)}var l=function(t,e,r,n){return new(r||(r=Promise))((function(o,i){function a(t){try{c(n.next(t))}catch(t){i(t)}}function u(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,u)}c((n=n.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalStore=void 0;var f=r(156),d=r(244),p=r(125),v=r(281),h=r(858),y=r(947),b=r(544),g=r(176),m=r(93),S=r(607),w=function(){function t(e){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{metadata:{}};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actionsConfig=null,this.callbacks=null,this.actions=null,this.subscribers=new Map,this.initialize=function(){return l(r,void 0,void 0,u().mark((function t(){var e,r,n,o,i,a;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Object.keys(null!==(e=this.actionsConfig)&&void 0!==e?e:{}).length>0&&(this.actions=this.getStoreActionsMap()),n=this.onInit,o=null!==(r=this.callbacks)&&void 0!==r?r:{},i=o.onInit,n||i){t.next=6;break}return t.abrupt("return");case 6:a=this.getConfigCallbackParam(),null==n||n(a),(0,p.isNil)(i)||null==i||i(a);case 9:case"end":return t.stop()}}),t,this)})))},this.executeSetStateForSubscriber=function(t,e){var n,o,i=t.selector,a=t.callback,u=t.currentState,c=t.config;if(!e.forceUpdate&&(null!==(n=null==c?void 0:c.isEqualRoot)&&void 0!==n?n:function(t,e){return t===e})(e.currentRootState,e.newRootState))return{didUpdate:!1};var s=i?i(e.newRootState):e.newRootState;return!e.forceUpdate&&(null!==(o=null==c?void 0:c.isEqual)&&void 0!==o?o:function(t,e){return t===e})(u,s)?{didUpdate:!1}:(r.partialUpdateSubscription(t.subscriptionId,{currentState:s}),a({state:s},{identifier:e.identifier}),{didUpdate:!0})},this.setState=function(t,e){var n=t.state,o=e.forceUpdate,a=e.identifier,u=r.stateWrapper.state;if(o||u!==n){r.stateWrapper={state:n};var c,s={forceUpdate:o,newRootState:n,currentRootState:u,identifier:a},l=function(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}}}}(r.subscribers.values());try{for(l.s();!(c=l.n()).done;){var f=c.value;r.executeSetStateForSubscriber(f,s)}}catch(t){l.e(t)}finally{l.f()}}},this.setMetadata=function(t){var e=(0,d.isFunction)(t)?t(r.metadata):t;r.metadata=e},this.getMetadata=function(){return r.metadata},this.getState=function(t,e,n){var o;if(!t)return r.stateWrapper.state;var i=(0,d.isFunction)(e),a=i?t:void 0,u=i?e:t,c=null!==(o=i?n:e)&&void 0!==o?o:void 0,s=a?a(r.stateWrapper.state):r.stateWrapper.state;(null==c?void 0:c.skipFirst)||u(s);var l=(0,g.uniqueId)("gs:");return r.setOrUpdateSubscription({subscriptionId:l,selector:a,config:c,currentState:s,callback:function(t){var e=t.state;return u(e)},isSetStateCallback:!1}),function(){r.subscribers.delete(l)}},this.getConfigCallbackParam=function(){var t=r.setMetadata,e=r.getMetadata,n=r.getState,o=r.actions;return{setMetadata:t,getMetadata:e,getState:n,setState:r.setStateWrapper,actions:o}},this.lastSubscriptionId=null,this.setOrUpdateSubscription=function(t){var e=t.subscriptionId;if(!e)return{isNewSubscription:!1};var n=r.subscribers.get(e);return(0,h.isRecord)(n)?(Object.assign(n,t),{isNewSubscription:!1}):(r.executeOnSubscribed(),r.subscribers.set(e,t),r.lastSubscriptionId=e,{isNewSubscription:!0})},this.partialUpdateSubscription=function(t,e){var n=r.subscribers.get(t);(0,h.isRecord)(n)&&Object.assign(n,e)},this.executeOnSubscribed=function(){var t,e=r.onSubscribed,n=null===(t=r.callbacks)||void 0===t?void 0:t.onSubscribed;if(e||n){var o=r.getConfigCallbackParam();null==e||e(o),null==n||n(o)}},this.getHook=function(){var t=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=(0,S.useConstantValueRef)((function(){return{subscriptionId:null,tempInitialRootState:r.stateWrapper.state}})),a=function(){return t?{state:t(r.stateWrapper.state)}:r.stateWrapper},u=o((0,f.useState)(a),2),c=u[0],s=u[1];(0,f.useEffect)((function(){if(!(0,p.isNil)(i.current)){(0,p.isNil)(i.current.subscriptionId)&&(i.current.subscriptionId=(0,g.uniqueId)("ss:"));var e=i.current.subscriptionId,o={subscriptionId:e,currentState:c.state,selector:t,config:n,callback:s,isSetStateCallback:!0};return r.setOrUpdateSubscription(o).isNewSubscription&&(r.executeSetStateForSubscriber(o,{forceUpdate:!1,newRootState:r.stateWrapper.state,currentRootState:i.current.tempInitialRootState,identifier:"on mount state update"}),i.current.tempInitialRootState=m.uniqueSymbol),function(){r.subscribers.delete(e)}}}),[]);var l=(0,v.isString)(i.current)?i.current:"",d=r.subscribers.get(l),h=(null!==(e=null==d?void 0:d.config)&&void 0!==e?e:{dependencies:n.dependencies}).dependencies;return r.partialUpdateSubscription(l,{currentState:c.state,selector:t,config:n,callback:s}),[r.computeSelectedState({selector:t,subscriptionId:l,config:n,currentDependencies:h,computeChildState:a,stateWrapperRef:c}),r.getStateOrchestrator(),r.metadata]};return t.stateControls=r.stateControls,t.createSelectorHook=r.createSelectorHook,t.createObservable=r.createObservable,t},this.computeSelectedState=function(t){var e=t.selector,n=t.subscriptionId,o=t.config,i=t.currentDependencies,a=t.computeChildState,u=t.stateWrapperRef;if(!e||!n)return u.state;var c=o.dependencies;if(i===c)return u.state;if((null==i?void 0:i.length)===(null==c?void 0:c.length)&&(0,y.shallowCompare)(i,c))return u.state;var s=a().state;return r.partialUpdateSubscription(n,{currentState:s}),u.state=s,s},this.createSelectorHook=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.isEqualRoot,a=n.isEqual,u=n.name,c=o(r.stateControls(),3),s=c[0],l=c[1],f=c[2],p=s(),v=(null!=e?e:function(t){return t})(p),h=new t(v,{name:null!=u?u:(0,g.uniqueId)("sh:")}),y=o(h.stateControls(),2),b=y[0],m=y[1];s((function(t){if(!(null!=i?i:Object.is)(p,t)){p=t;var r=e(t);(null!=a?a:Object.is)(v,r)||(v=r,m(r))}}),{skipFirst:!0});var S=h.getHook(),w=function(t,e){return[o((0,d.isFunction)(t)?S(t,e):S(),1)[0],l,f]};return w.stateControls=function(){return[b,l,f]},w.createSelectorHook=r.createSelectorHook.bind(w),w.createObservable=r.createObservable.bind(w),w},this.stateControls=function(){var t=r.getStateOrchestrator(),e=r.getMetadata;return[r.getState,t,e]},this.getStateOrchestrator=function(){return r.actions?r.actions:r.setStateWrapper},this.setStateWrapper=function(t){var e,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.forceUpdate,a=o.identifier,u=r.stateWrapper.state,c=(0,d.isFunction)(t)?t(u):t;if(i||r.stateWrapper.state!==c){var s=r.setMetadata,l=r.getMetadata,f=r.getState,p=r.actions,v={setMetadata:s,getMetadata:l,setState:r.setState,getState:f,actions:p,previousState:u,state:c,identifier:a},h=r.computePreventStateChange,y=null===(e=r.callbacks)||void 0===e?void 0:e.computePreventStateChange;if(h||y)if((null==h?void 0:h(v))||(null==y?void 0:y(v)))return;r.setState({state:c},{forceUpdate:i,identifier:a});var b=r.onStateChanged,g=null===(n=r.callbacks)||void 0===n?void 0:n.onStateChanged;(b||g)&&(null==b||b(v),null==g||g(v))}},this.getStoreActionsMap=function(){if(!(0,h.isRecord)(r.actionsConfig))return null;var t=r.actionsConfig,e=r.setMetadata,n=r.setStateWrapper,o=r.getState,i=r.getMetadata,a=Object.keys(t).reduce((function(r,u){var c,l,f;return Object.assign(r,(c={},f=function(){for(var r=t[u],c=arguments.length,s=new Array(c),l=0;l<c;l++)s[l]=arguments[l];var f=r.apply(a,s);return"function"!=typeof f&&(0,b.throwWrongKeyOnActionCollectionConfig)(u),f.call(a,{setState:n,getState:o,setMetadata:e,getMetadata:i,actions:a})},(l=s(l=u))in c?Object.defineProperty(c,l,{value:f,enumerable:!0,configurable:!0,writable:!0}):c[l]=f,c)),r}),{});return a};var a=n.metadata,c=n.callbacks,w=n.actions,O=n.name;this.stateWrapper={state:e},this._name=null!=O?O:(0,g.uniqueId)("gs:"),this.metadata=null!=a?a:{},this.callbacks=null!=c?c:null,this.actionsConfig=null!=w?w:null,(null===globalThis||void 0===globalThis?void 0:globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG)&&globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG(this),this.constructor!==t||this.initialize()}var e,r,n;return e=t,r=[{key:"createObservable",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.isEqualRoot,n=e.isEqual,i=e.name,a=o(this.stateControls(),1)[0],u=[],c=a(),s=(null!=t?t:function(t){return t})(a());a((function(e){if(!(null!=r?r:Object.is)(c,e)){c=e;var o=t(e);(null!=n?n:Object.is)(s,o)||(s=o,u.forEach((function(t){return t()})))}}),{skipFirst:!0});var l=function(t,e,r){var n;if(!t)return s;var o=(0,d.isFunction)(e),i=o?t:void 0,a=o?e:t,c=null!==(n=o?r:e)&&void 0!==n?n:void 0,l=function(){return a(i?i(s):s)};(null==c?void 0:c.skipFirst)||l();var f=function(){l()};return u.push(f),function(){u.splice(u.indexOf(f),1)}};return l._name=null!=i?i:(0,g.uniqueId)("ob:"),l.createObservable=this.createObservable.bind(l),l.stateControls=function(){return[l]},l}}],r&&c(e.prototype,r),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.GlobalStore=w},858:(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)}Object.defineProperty(e,"__esModule",{value:!0}),e.isRecord=void 0;var o=r(125);e.isRecord=function(t){return!(0,o.isNil)(t)&&"object"===n(t)}},947:(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,s=!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){s=!0,o=t}finally{try{if(!c&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)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.shallowCompare=void 0;var c=r(416),s=r(231),l=r(125),f=r(858);e.shallowCompare=function(t,e){if(t===e)return!0;var r=u(t),i=u(e);if(r!==i)return!1;if((0,l.isNil)(t)||(0,l.isNil)(e)||(0,c.isPrimitive)(t)&&(0,c.isPrimitive)(e)||(0,s.isDate)(t)&&(0,s.isDate)(e)||"function"===r&&"function"===i)return t===e;if(Array.isArray(t)){var a=t,d=e;if(a.length!==d.length)return!1;for(var p=0;p<a.length;p++){if(a[p]!==d[p])return!1}}if(t instanceof Map){var v=t,h=e;if(v.size!==h.size)return!1;var y,b=o(v);try{for(b.s();!(y=b.n()).done;){var g=n(y.value,2),m=g[0];if(g[1]!==h.get(m))return!1}}catch(t){b.e(t)}finally{b.f()}}if(t instanceof Set){var S=t,w=e;if(S.size!==w.size)return!1;var O,j=o(S);try{for(j.s();!(O=j.n()).done;){var _=O.value;if(!w.has(_))return!1}}catch(t){j.e(t)}finally{j.f()}}if(!(0,f.isRecord)(t)||!(0,f.isRecord)(e))return t===e;var x=Object.keys(t),k=Object.keys(e);if(x.length!==k.length)return!1;for(var E=0,C=x;E<C.length;E++){var M=C[E];if(t[M]!==e[M])return!1}return!0}},544:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.throwWrongKeyOnActionCollectionConfig=void 0;e.throwWrongKeyOnActionCollectionConfig=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"))}},176:(t,e)=>{"use strict";var r;Object.defineProperty(e,"__esModule",{value:!0}),e.uniqueId=void 0,e.uniqueId=(r=0,function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return r===Number.MAX_SAFE_INTEGER&&(r=0),t+Date.now().toString(36)+(r++).toString(36)})},93:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.uniqueSymbol=void 0,e.uniqueSymbol=Symbol("unique")},607:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.useConstantValueRef=void 0;var n=r(156),o=r(93);e.useConstantValueRef=function(t){var e=(0,n.useRef)(o.uniqueSymbol);return e.current===o.uniqueSymbol&&(e.current=t()),e}},231:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isDate=void 0,e.isDate=function(t){return t instanceof Date}})(),t})()},244:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isFunction=void 0,e.isFunction=function(t){return"function"==typeof t||t instanceof Function}})(),t})()},125:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isNil=void 0,e.isNil=function(t){return null==t}})(),t})()},416:function(t){t.exports=(()=>{"use strict";var t={112:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isBoolean=void 0,e.isBoolean=function(t){return"boolean"==typeof t}},243:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isNil=void 0,e.isNil=function(t){return null==t}},11:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isNumber=void 0,e.isNumber=function(t){return"number"==typeof t}},671:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isString=void 0,e.isString=function(t){return"string"==typeof t}}},e={};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}var n={};return(()=>{var t=n;function e(t){return e="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},e(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.isPrimitive=void 0;var o=r(112),i=r(243),a=r(11),u=r(671);t.isPrimitive=function(t){return(0,i.isNil)(t)||(0,a.isNumber)(t)||(0,o.isBoolean)(t)||(0,u.isString)(t)||"symbol"===e(t)}})(),n})()},281:function(t){t.exports=(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.isString=void 0,e.isString=function(t){return"string"==typeof t}})(),t})()},156:e=>{"use strict";e.exports=t}},r={};function n(t){var o=r[t];if(void 0!==o)return o.exports;var i=r[t]={exports:{}};return e[t].call(i.exports,i,i.exports,n),i.exports}var o={};return(()=>{"use strict";var t=o;Object.defineProperty(t,"__esModule",{value:!0}),t.createGlobalState=void 0;var e=n(774);t.createGlobalState=function(t,r){return new e.GlobalStore(t,r).getHook()}})(),o})()));
|
package/debounce.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports["react-hooks-global-states"]=o():e["react-hooks-global-states"]=o()}(this,(()=>(()=>{"use strict";var e={};return(()=>{var o=e;Object.defineProperty(o,"__esModule",{value:!0}),o.debounce=void 0;o.debounce=function(e){var o,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];o&&clearTimeout(o),o=setTimeout((function(){e.apply(void 0,r)}),t)}}})(),e})()));
|
package/{lib/src/GlobalStore.functionHooks.d.ts → functionHooks.createCustomGlobalState.d.ts}
RENAMED
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
import { ActionCollectionConfig, StateSetter, ActionCollectionResult, StateHook, CustomGlobalHookBuilderParams, BaseMetadata, GlobalStoreCallbacks } from './
|
|
2
|
-
export interface CreateGlobalState {
|
|
3
|
-
<State>(state: State): StateHook<State, StateSetter<State>, BaseMetadata>;
|
|
4
|
-
<State, Metadata extends BaseMetadata | unknown, ActionsConfig extends ActionCollectionConfig<State, Metadata> | null | {}, PublicStateMutator = keyof ActionsConfig extends never | undefined ? StateSetter<State> : ActionCollectionResult<State, Metadata, NonNullable<ActionsConfig>>>(state: State, args: {
|
|
5
|
-
name?: string;
|
|
6
|
-
metadata?: Metadata;
|
|
7
|
-
callbacks?: GlobalStoreCallbacks<State, Metadata>;
|
|
8
|
-
actions?: ActionsConfig;
|
|
9
|
-
}): StateHook<State, PublicStateMutator, Metadata>;
|
|
10
|
-
<State, Metadata extends BaseMetadata | unknown, ActionsConfig extends ActionCollectionConfig<State, Metadata>>(state: State, args: {
|
|
11
|
-
name?: string;
|
|
12
|
-
metadata?: Metadata;
|
|
13
|
-
callbacks?: GlobalStoreCallbacks<State, Metadata>;
|
|
14
|
-
actions: ActionsConfig;
|
|
15
|
-
}): StateHook<State, ActionCollectionResult<State, Metadata, ActionsConfig>, Metadata>;
|
|
16
|
-
}
|
|
17
|
-
export declare const createGlobalState: CreateGlobalState;
|
|
1
|
+
import { ActionCollectionConfig, StateSetter, ActionCollectionResult, StateHook, CustomGlobalHookBuilderParams, BaseMetadata, GlobalStoreCallbacks } from './types';
|
|
18
2
|
export interface CustomCreateGlobalState<TCustomConfig extends BaseMetadata | unknown, InheritMetadata extends BaseMetadata | unknown = BaseMetadata> {
|
|
19
3
|
<State>(state: State): StateHook<State, StateSetter<State>, BaseMetadata>;
|
|
20
4
|
<State, Metadata extends BaseMetadata | unknown, ActionsConfig extends ActionCollectionConfig<State, InheritMetadata & Metadata> | null | {}, PublicStateMutator = keyof ActionsConfig extends never | undefined ? StateSetter<State> : ActionCollectionResult<State, InheritMetadata & Metadata, NonNullable<ActionsConfig>>>(state: State, args: {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ActionCollectionConfig, StateSetter, ActionCollectionResult, StateHook, BaseMetadata, GlobalStoreCallbacks } from './types';
|
|
2
|
+
export interface CreateGlobalState {
|
|
3
|
+
<State>(state: State): StateHook<State, StateSetter<State>, BaseMetadata>;
|
|
4
|
+
<State, Metadata extends BaseMetadata | unknown, ActionsConfig extends ActionCollectionConfig<State, Metadata> | null | {}, PublicStateMutator = keyof ActionsConfig extends never | undefined ? StateSetter<State> : ActionCollectionResult<State, Metadata, NonNullable<ActionsConfig>>>(state: State, args: {
|
|
5
|
+
name?: string;
|
|
6
|
+
metadata?: Metadata;
|
|
7
|
+
callbacks?: GlobalStoreCallbacks<State, Metadata>;
|
|
8
|
+
actions?: ActionsConfig;
|
|
9
|
+
}): StateHook<State, PublicStateMutator, Metadata>;
|
|
10
|
+
<State, Metadata extends BaseMetadata | unknown, ActionsConfig extends ActionCollectionConfig<State, Metadata>>(state: State, args: {
|
|
11
|
+
name?: string;
|
|
12
|
+
metadata?: Metadata;
|
|
13
|
+
callbacks?: GlobalStoreCallbacks<State, Metadata>;
|
|
14
|
+
actions: ActionsConfig;
|
|
15
|
+
}): StateHook<State, ActionCollectionResult<State, Metadata, ActionsConfig>, Metadata>;
|
|
16
|
+
}
|
|
17
|
+
export declare const createGlobalState: CreateGlobalState;
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { StateSetter, HookExtensions, ObservableFragment, MetadataSetter, StateChanges, StoreTools, ActionCollectionResult, GlobalStoreCallbacks, UseHookConfig, UnsubscribeCallback, SubscribeCallbackConfig, SubscribeCallback, StateGetter, BaseMetadata, MetadataGetter, CustomGlobalHookBuilderParams, SelectorCallback, SubscriberParameters, SubscriptionCallback, StateHook, ActionCollectionConfig, } from './types';
|
|
2
|
+
export { GlobalStore } from './GlobalStore';
|
|
3
|
+
export { GlobalStoreAbstract } from './GlobalStoreAbstract';
|
|
4
|
+
export { createGlobalState } from './functionHooks.createGlobalState';
|
|
5
|
+
export { createCustomGlobalState } from './functionHooks.createCustomGlobalState';
|
|
6
|
+
export { shallowCompare } from './utils.shallowCompare';
|
|
7
|
+
export { debounce } from './utils.debounce';
|
|
8
|
+
export { uniqueId } from './utils.uniqueId';
|
|
9
|
+
export { throwWrongKeyOnActionCollectionConfig } from './utils.throwWrongKeyOnActionCollectionConfig';
|
|
10
|
+
export { isRecord } from './utils.isRecord';
|
|
11
|
+
export { uniqueSymbol, UniqueSymbol } from './utils.uniqueSymbol';
|
|
12
|
+
export { useConstantValueRef } from './utils.useConstantValueRef';
|
|
13
|
+
export { combineRetrieverAsynchronously } from './combiners.combineRetrieverAsynchronously';
|
|
14
|
+
export { combineRetrieverEmitterAsynchronously } from './combiners.combineRetrieverEmitterAsynchronously';
|
|
15
|
+
export { ContextProviderAPI, ContextProvider, ContextHook, CreateContext, createContext, } from './createContext';
|
package/isRecord.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["react-hooks-global-states"]=t():e["react-hooks-global-states"]=t()}(this,(()=>(()=>{var e={125:function(e){e.exports=(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.isNil=void 0,t.isNil=function(e){return null==e}})(),e})()}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,o),i.exports}var r={};return(()=>{"use strict";var e=r;function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.isRecord=void 0;var n=o(125);e.isRecord=function(e){return!(0,n.isNil)(e)&&"object"===t(e)}})(),r})()));
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-hooks-global-states",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "This is a package to easily handling global-state across your react-components No-redux",
|
|
5
|
-
"main": "
|
|
6
|
-
"types": "
|
|
5
|
+
"main": "./bundle.js",
|
|
6
|
+
"types": "./index.d.ts",
|
|
7
|
+
"sideEffects": false,
|
|
7
8
|
"files": [
|
|
8
|
-
"
|
|
9
|
+
"*.js",
|
|
10
|
+
"*.d.ts"
|
|
9
11
|
],
|
|
10
12
|
"scripts": {
|
|
11
13
|
"test:debug": "node --inspect-brk node_modules/.bin/jest --watch --runInBand",
|
|
@@ -16,7 +18,8 @@
|
|
|
16
18
|
"version": "npm run format && git add -A src",
|
|
17
19
|
"postversion": "git push && git push --tags",
|
|
18
20
|
"lint": "eslint src --ext .js,.jsx,.ts,.tsx --max-warnings=0",
|
|
19
|
-
"lint:fix": "eslint --fix src --ext .js,.jsx,.ts,.tsx --max-warnings=0"
|
|
21
|
+
"lint:fix": "eslint --fix src --ext .js,.jsx,.ts,.tsx --max-warnings=0",
|
|
22
|
+
"clean": "find . -maxdepth 1 -type f \\( -name '*.js' -o -name '*.d.ts' \\) ! -name 'webpack.config.js' -exec rm {} +"
|
|
20
23
|
},
|
|
21
24
|
"repository": {
|
|
22
25
|
"type": "git",
|
|
@@ -80,6 +83,6 @@
|
|
|
80
83
|
}
|
|
81
84
|
},
|
|
82
85
|
"dependencies": {
|
|
83
|
-
"json-storage-formatter": "^
|
|
86
|
+
"json-storage-formatter": "^2.0.5"
|
|
84
87
|
}
|
|
85
88
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["react-hooks-global-states"]=t():e["react-hooks-global-states"]=t()}(this,(()=>(()=>{var e={858:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.isRecord=void 0;var o=r(125);t.isRecord=function(e){return!(0,o.isNil)(e)&&"object"===n(e)}},231:function(e){e.exports=(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.isDate=void 0,t.isDate=function(e){return e instanceof Date}})(),e})()},125:function(e){e.exports=(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.isNil=void 0,t.isNil=function(e){return null==e}})(),e})()},416:function(e){e.exports=(()=>{"use strict";var e={112:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isBoolean=void 0,t.isBoolean=function(e){return"boolean"==typeof e}},243:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isNil=void 0,t.isNil=function(e){return null==e}},11:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isNumber=void 0,t.isNumber=function(e){return"number"==typeof e}},671:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isString=void 0,t.isString=function(e){return"string"==typeof e}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}var n={};return(()=>{var e=n;function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.isPrimitive=void 0;var o=r(112),i=r(243),u=r(11),f=r(671);e.isPrimitive=function(e){return(0,i.isNil)(e)||(0,u.isNumber)(e)||(0,o.isBoolean)(e)||(0,f.isString)(e)||"symbol"===t(e)}})(),n})()}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}var n={};return(()=>{"use strict";var e=n;function t(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,u,f=[],a=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;a=!1}else for(;!(a=(n=i.call(r)).done)&&(f.push(n.value),f.length!==t);a=!0);}catch(e){l=!0,o=e}finally{try{if(!a&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(l)throw o}}return f}}(e,t)||i(e,t)||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(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=i(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},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 u,f=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return f=e.done,e},e:function(e){a=!0,u=e},f:function(){try{f||null==r.return||r.return()}finally{if(a)throw u}}}}function i(e,t){if(e){if("string"==typeof e)return u(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}Object.defineProperty(e,"__esModule",{value:!0}),e.shallowCompare=void 0;var a=r(416),l=r(231),s=r(125),c=r(858);e.shallowCompare=function(e,r){if(e===r)return!0;var n=f(e),i=f(r);if(n!==i)return!1;if((0,s.isNil)(e)||(0,s.isNil)(r)||(0,a.isPrimitive)(e)&&(0,a.isPrimitive)(r)||(0,l.isDate)(e)&&(0,l.isDate)(r)||"function"===n&&"function"===i)return e===r;if(Array.isArray(e)){var u=e,y=r;if(u.length!==y.length)return!1;for(var v=0;v<u.length;v++){if(u[v]!==y[v])return!1}}if(e instanceof Map){var p=e,b=r;if(p.size!==b.size)return!1;var d,m=o(p);try{for(m.s();!(d=m.n()).done;){var h=t(d.value,2),S=h[0];if(h[1]!==b.get(S))return!1}}catch(e){m.e(e)}finally{m.f()}}if(e instanceof Set){var g=e,j=r;if(g.size!==j.size)return!1;var x,_=o(g);try{for(_.s();!(x=_.n()).done;){var O=x.value;if(!j.has(O))return!1}}catch(e){_.e(e)}finally{_.f()}}if(!(0,c.isRecord)(e)||!(0,c.isRecord)(r))return e===r;var P=Object.keys(e),M=Object.keys(r);if(P.length!==M.length)return!1;for(var N=0,w=P;N<w.length;N++){var A=w[N];if(e[A]!==r[A])return!1}return!0}})(),n})()));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["react-hooks-global-states"]=e():t["react-hooks-global-states"]=e()}(this,(()=>(()=>{"use strict";var t={};return(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0}),e.throwWrongKeyOnActionCollectionConfig=void 0;e.throwWrongKeyOnActionCollectionConfig=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"))}})(),t})()));
|
package/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["react-hooks-global-states"]=t():e["react-hooks-global-states"]=t()}(this,(()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0})})(),e})()));
|
package/uniqueId.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["react-hooks-global-states"]=t():e["react-hooks-global-states"]=t()}(this,(()=>(()=>{"use strict";var e={};return(()=>{var t,o=e;Object.defineProperty(o,"__esModule",{value:!0}),o.uniqueId=void 0,o.uniqueId=(t=0,function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return t===Number.MAX_SAFE_INTEGER&&(t=0),e+Date.now().toString(36)+(t++).toString(36)})})(),e})()));
|
package/uniqueSymbol.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,o){"object"==typeof exports&&"object"==typeof module?module.exports=o():"function"==typeof define&&define.amd?define([],o):"object"==typeof exports?exports["react-hooks-global-states"]=o():e["react-hooks-global-states"]=o()}(this,(()=>(()=>{"use strict";var e={};return(()=>{var o=e;Object.defineProperty(o,"__esModule",{value:!0}),o.uniqueSymbol=void 0,o.uniqueSymbol=Symbol("unique")})(),e})()));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("react")):e["react-hooks-global-states"]=t(e.react)}(this,(e=>(()=>{"use strict";var t={93:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.uniqueSymbol=void 0,t.uniqueSymbol=Symbol("unique")},156:t=>{t.exports=e}},r={};function o(e){var u=r[e];if(void 0!==u)return u.exports;var n=r[e]={exports:{}};return t[e](n,n.exports,o),n.exports}var u={};return(()=>{var e=u;Object.defineProperty(e,"__esModule",{value:!0}),e.useConstantValueRef=void 0;var t=o(156),r=o(93);e.useConstantValueRef=function(e){var o=(0,t.useRef)(r.uniqueSymbol);return o.current===r.uniqueSymbol&&(o.current=e()),o}})(),u})()));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const debounce: <T extends (...args: Parameters<T>) => void>(callback: T, delay?: number) => (...args: Parameters<T>) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isRecord: (value: unknown) => value is Record<string, unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const shallowCompare: <T>(value1: T, value2: T) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const throwWrongKeyOnActionCollectionConfig: (action_key: string) => never;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const uniqueId: (prefix?: string) => string;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const TerserPlugin = require('terser-webpack-plugin');
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
mode: 'production',
|
|
6
|
+
entry: {
|
|
7
|
+
bundle: './src/index.ts',
|
|
8
|
+
createContext: './src/createContext.ts',
|
|
9
|
+
GlobalStore: './src/GlobalStore.ts',
|
|
10
|
+
GlobalStoreAbstract: './src/GlobalStoreAbstract.ts',
|
|
11
|
+
createCustomGlobalState: './src/functionHooks.createCustomGlobalState.ts',
|
|
12
|
+
createGlobalState: './src/functionHooks.createGlobalState.ts',
|
|
13
|
+
combineRetrieverAsynchronously: './src/combiners.combineRetrieverAsynchronously.ts',
|
|
14
|
+
combineRetrieverEmitterAsynchronously: './src/combiners.combineRetrieverEmitterAsynchronously.ts',
|
|
15
|
+
types: './src/types.ts',
|
|
16
|
+
debounce: './src/utils.debounce.ts',
|
|
17
|
+
isRecord: './src/utils.isRecord.ts',
|
|
18
|
+
shallowCompare: './src/utils.shallowCompare.ts',
|
|
19
|
+
throwWrongKeyOnActionCollectionConfig: './src/utils.throwWrongKeyOnActionCollectionConfig.ts',
|
|
20
|
+
uniqueId: './src/utils.uniqueId.ts',
|
|
21
|
+
uniqueSymbol: './src/utils.uniqueSymbol.ts',
|
|
22
|
+
useConstantValueRef: './src/utils.useConstantValueRef.ts',
|
|
23
|
+
},
|
|
24
|
+
externals: {
|
|
25
|
+
react: 'react',
|
|
26
|
+
},
|
|
27
|
+
output: {
|
|
28
|
+
path: path.resolve(__dirname),
|
|
29
|
+
filename: ({ chunk: { name } }) => {
|
|
30
|
+
return `${name}.js`;
|
|
31
|
+
},
|
|
32
|
+
libraryTarget: 'umd',
|
|
33
|
+
library: 'react-hooks-global-states',
|
|
34
|
+
globalObject: 'this',
|
|
35
|
+
},
|
|
36
|
+
resolve: {
|
|
37
|
+
extensions: ['.ts', '.js'],
|
|
38
|
+
alias: {
|
|
39
|
+
'react-hooks-global-states': path.resolve(
|
|
40
|
+
__dirname,
|
|
41
|
+
'node_modules/react-hooks-global-states/package.json'
|
|
42
|
+
),
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
module: {
|
|
46
|
+
rules: [
|
|
47
|
+
{
|
|
48
|
+
test: /\.ts$/,
|
|
49
|
+
use: [
|
|
50
|
+
{
|
|
51
|
+
loader: 'babel-loader',
|
|
52
|
+
options: {
|
|
53
|
+
presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'],
|
|
54
|
+
plugins: [
|
|
55
|
+
'@babel/plugin-transform-modules-commonjs',
|
|
56
|
+
'@babel/plugin-proposal-class-properties',
|
|
57
|
+
'@babel/plugin-proposal-export-namespace-from',
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
loader: 'ts-loader',
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
exclude: /node_modules/,
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
optimization: {
|
|
70
|
+
minimize: true,
|
|
71
|
+
minimizer: [
|
|
72
|
+
new TerserPlugin({
|
|
73
|
+
extractComments: false,
|
|
74
|
+
terserOptions: {
|
|
75
|
+
format: {
|
|
76
|
+
comments: false,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
}),
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
};
|
package/lib/bundle.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see bundle.js.LICENSE.txt */
|
|
2
|
-
!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-hooks-global-states"]=e(require("react")):t["react-hooks-global-states"]=e(t.react)}(this,(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.combineRetrieverEmitterAsynchronously=void 0;var i=r(608),a=r(156);e.combineRetrieverEmitterAsynchronously=function(t){for(var e,r,n,o=arguments.length,a=new Array(o>1?o-1:0),u=1;u<o;u++)a[u-1]=arguments[u];var c=a,l=new Map(c.map((function(t,e){return[e,t()]}))),s=t.selector(Array.from(l.values())),f=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,v=new Set,d=(0,i.debounce)((function(){var e=t.selector(Array.from(l.values()));(null==f?void 0:f(s,e))||(s=e,v.forEach((function(t){return t()})))}),null===(n=null==t?void 0:t.config)||void 0===n?void 0:n.delay),p=c.map((function(t,e){return t((function(t){l.set(e,t),d()}))})),y=function(t,e,r){var n,o,a="function"==typeof e,u=a?t:null,c=a?e:t,l=a?r:e,f=Object.assign({delay:0,isEqual:i.shallowCompare},null!=l?l:{}),d=null!==(n=null==u?void 0:u(s))&&void 0!==n?n:s;f.skipFirst||c(d);var p=(0,i.debounce)((function(){var t,e,r=null!==(t=null==u?void 0:u(s))&&void 0!==t?t:s;(null===(e=f.isEqual)||void 0===e?void 0:e.call(f,d,r))||(d=r,c(r))}),null!==(o=f.delay)&&void 0!==o?o:0);return v.add(p),function(){v.delete(p)}};return[y,function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e[0]?y.apply(void 0,e):s},function(){p.forEach((function(t){return t()}))}]},e.combineRetrieverAsynchronously=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.combineRetrieverEmitterAsynchronously.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]}},113:(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=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};Object.defineProperty(e,"__esModule",{value:!0}),e.createContext=void 0;var i=r(608),a=r(774),u=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e}(r(156)),c=r(684);e.createContext=function(t,e){var r=new Map,n=u.default.createContext(i.uniqueSymbol),o=function(){var t=u.default.useContext(n);if(t===i.uniqueSymbol)throw new Error("context hooks need to be used inside a provider");return t};return o.createSelectorHook=function(t,e){var n=(0,i.uniqueId)("cs:");return function(){var i,a,u=o(),l=(i=u,null!==(a=r.get(i))&&void 0!==a?a:r.set(i,new Map).get(i));l.has(n)||l.set(n,u.createSelectorHook(t,e));var s=l.get(n);if((0,c.isNil)(s))throw new Error("useSelectedHook is nil");return s.apply(void 0,arguments)}},[o,function(o){var i=o.children,l=o.value,s=o.ref,f=(0,u.useMemo)((function(){var r=void 0===l?t():(0,c.isFunction)(l)?l(t()):l,n=new a.GlobalStore(r,e);return{store:n,hook:n.getHook()}}),[]),v=f.store,d=f.hook;return r.has(d)||r.set(d,new Map),(0,u.useEffect)((function(){return function(){var t,e,n,o;r.delete(d),null===(e=null===(t=v.callbacks)||void 0===t?void 0:t.onUnMount)||void 0===e||e.call(t),null===(o=(n=v).__onUnMountContext)||void 0===o||o.call(n,v,d)}}),[]),(0,u.useImperativeHandle)(s,(function(){return s?v.getConfigCallbackParam():{}}),[v,s]),u.default.createElement(n.Provider,{value:d},i)}]}},853:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.createCustomGlobalState=e.createGlobalState=void 0;var n=r(774);e.createGlobalState=function(t,e){return new n.GlobalStore(t,e).getHook()},e.createCustomGlobalState=function(t){var r=t.onInitialize,n=t.onChange;return function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.callbacks,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}(o,["callbacks"]);return(0,e.createGlobalState)(t,Object.assign(Object.assign({},a),{callbacks:Object.assign(Object.assign({},null!=i?i:{}),{onInit:function(t){var e;null==r||r(t,null==a?void 0:a.config),null===(e=null==i?void 0:i.onInit)||void 0===e||e.call(i,t)},onStateChanged:function(t){var e;null==n||n(t,null==a?void 0:a.config),null===(e=null==i?void 0:i.onStateChanged)||void 0===e||e.call(i,t)}})}))}}},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)||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 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(){u=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:{},a=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 p?e:p,a=Object.create(i.prototype),u=new C(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 d={};function p(){}function y(){}function b(){}var h={};s(h,a,(function(){return this}));var m=Object.getPrototypeOf,g=m&&m(m(k([])));g&&g!==e&&r.call(g,a)&&(h=g);var S=b.prototype=p.prototype=Object.create(h);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function O(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=E(a,r);if(u){if(u===d)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===d)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function E(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,E(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),d;var o=v(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,d;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,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function x(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 C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function k(t){if(t){var e=t[a];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:_}}function _(){return{value:void 0,done:!0}}return y.prototype=b,o(S,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:y,configurable:!0}),y.displayName=s(b,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,b):(t.__proto__=b,s(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},t.awrap=function(t){return{__await:t}},w(O.prototype),s(O.prototype,c,(function(){return this})),t.AsyncIterator=O,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new O(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(S),s(S,l,"Generator"),s(S,a,(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=k,C.prototype={constructor:C,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,d):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),d},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),d}},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:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},t}function c(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,l(n.key),n)}}function l(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=void 0;var s=r(608),f=r(156),v=r(684),d=function(){function t(e){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{metadata:{}};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.actionsConfig=null,this.callbacks=null,this.actions=null,this.subscribers=new Map,this.initialize=function(){return t=r,e=void 0,n=void 0,o=u().mark((function t(){var e,r,n,o,i,a;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Object.keys(null!==(e=this.actionsConfig)&&void 0!==e?e:{}).length>0&&(this.actions=this.getStoreActionsMap()),n=this.onInit,o=null!==(r=this.callbacks)&&void 0!==r?r:{},i=o.onInit,n||i){t.next=6;break}return t.abrupt("return");case 6:a=this.getConfigCallbackParam(),null==n||n(a),(0,v.isNil)(i)||null==i||i(a);case 9:case"end":return t.stop()}}),t,this)})),new(n||(n=Promise))((function(r,i){function a(t){try{c(o.next(t))}catch(t){i(t)}}function u(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}c((o=o.apply(t,e||[])).next())}));var t,e,n,o},this.executeSetStateForSubscriber=function(t,e){var n,o,i=t.selector,a=t.callback,u=t.currentState,c=t.config;if(!e.forceUpdate&&(null!==(n=null==c?void 0:c.isEqualRoot)&&void 0!==n?n:function(t,e){return t===e})(e.currentRootState,e.newRootState))return{didUpdate:!1};var l=i?i(e.newRootState):e.newRootState;return!e.forceUpdate&&(null!==(o=null==c?void 0:c.isEqual)&&void 0!==o?o:function(t,e){return t===e})(u,l)?{didUpdate:!1}:(r.partialUpdateSubscription(t.subscriptionId,{currentState:l}),a({state:l},{identifier:e.identifier}),{didUpdate:!0})},this.setState=function(t,e){var n=t.state,o=e.forceUpdate,a=e.identifier,u=r.stateWrapper.state;if(o||u!==n){r.stateWrapper={state:n};var c,l={forceUpdate:o,newRootState:n,currentRootState:u,identifier:a},s=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=i(t))){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}}}}(r.subscribers.values());try{for(s.s();!(c=s.n()).done;){var f=c.value;r.executeSetStateForSubscriber(f,l)}}catch(t){s.e(t)}finally{s.f()}}},this.setMetadata=function(t){var e=(0,v.isFunction)(t)?t(r.metadata):t;r.metadata=e},this.getMetadata=function(){return r.metadata},this.getState=function(t,e,n){var o;if(!t)return r.stateWrapper.state;var i=(0,v.isFunction)(e),a=i?t:void 0,u=i?e:t,c=null!==(o=i?n:e)&&void 0!==o?o:void 0,l=a?a(r.stateWrapper.state):r.stateWrapper.state;(null==c?void 0:c.skipFirst)||u(l);var f=(0,s.uniqueId)("gs:");return r.setOrUpdateSubscription({subscriptionId:f,selector:a,config:c,currentState:l,callback:function(t){var e=t.state;return u(e)},isSetStateCallback:!1}),function(){r.subscribers.delete(f)}},this.getConfigCallbackParam=function(){var t=r.setMetadata,e=r.getMetadata,n=r.getState,o=r.actions;return{setMetadata:t,getMetadata:e,getState:n,setState:r.setStateWrapper,actions:o}},this.lastSubscriptionId=null,this.setOrUpdateSubscription=function(t){var e=t.subscriptionId;if(!e)return{isNewSubscription:!1};var n=r.subscribers.get(e);return(0,s.isRecord)(n)?(Object.assign(n,t),{isNewSubscription:!1}):(r.executeOnSubscribed(),r.subscribers.set(e,t),r.lastSubscriptionId=e,{isNewSubscription:!0})},this.partialUpdateSubscription=function(t,e){var n=r.subscribers.get(t);(0,s.isRecord)(n)&&Object.assign(n,e)},this.executeOnSubscribed=function(){var t,e=r.onSubscribed,n=null===(t=r.callbacks)||void 0===t?void 0:t.onSubscribed;if(e||n){var o=r.getConfigCallbackParam();null==e||e(o),null==n||n(o)}},this.getHook=function(){var t=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=(0,s.useConstantValueRef)((function(){return{subscriptionId:null,tempInitialRootState:r.stateWrapper.state}})),a=function(){return t?{state:t(r.stateWrapper.state)}:r.stateWrapper},u=o((0,f.useState)(a),2),c=u[0],l=u[1];(0,f.useEffect)((function(){if(!(0,v.isNil)(i.current)){(0,v.isNil)(i.current.subscriptionId)&&(i.current.subscriptionId=(0,s.uniqueId)("ss:"));var e=i.current.subscriptionId,o={subscriptionId:e,currentState:c.state,selector:t,config:n,callback:l,isSetStateCallback:!0};return r.setOrUpdateSubscription(o).isNewSubscription&&(r.executeSetStateForSubscriber(o,{forceUpdate:!1,newRootState:r.stateWrapper.state,currentRootState:i.current.tempInitialRootState,identifier:"on mount state update"}),i.current.tempInitialRootState=s.uniqueSymbol),function(){r.subscribers.delete(e)}}}),[]);var d=(0,v.isString)(i.current)?i.current:"",p=r.subscribers.get(d),y=(null!==(e=null==p?void 0:p.config)&&void 0!==e?e:{dependencies:n.dependencies}).dependencies;return r.partialUpdateSubscription(d,{currentState:c.state,selector:t,config:n,callback:l}),[r.computeSelectedState({selector:t,subscriptionId:d,config:n,currentDependencies:y,computeChildState:a,stateWrapperRef:c}),r.getStateOrchestrator(),r.metadata]};return t.stateControls=r.stateControls,t.createSelectorHook=r.createSelectorHook,t.createObservable=r.createObservable,t},this.computeSelectedState=function(t){var e=t.selector,n=t.subscriptionId,o=t.config,i=t.currentDependencies,a=t.computeChildState,u=t.stateWrapperRef;if(!e||!n)return u.state;var c=o.dependencies;if(i===c)return u.state;if((null==i?void 0:i.length)===(null==c?void 0:c.length)&&(0,s.shallowCompare)(i,c))return u.state;var l=a().state;return r.partialUpdateSubscription(n,{currentState:l}),u.state=l,l},this.createSelectorHook=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.isEqualRoot,a=n.isEqual,u=n.name,c=o(r.stateControls(),3),l=c[0],f=c[1],d=c[2],p=l(),y=(null!=e?e:function(t){return t})(p),b=new t(y,{name:null!=u?u:(0,s.uniqueId)("sh:")}),h=o(b.stateControls(),2),m=h[0],g=h[1];l((function(t){if(!(null!=i?i:Object.is)(p,t)){p=t;var r=e(t);(null!=a?a:Object.is)(y,r)||(y=r,g(r))}}),{skipFirst:!0});var S=b.getHook(),w=function(t,e){return[o((0,v.isFunction)(t)?S(t,e):S(),1)[0],f,d]};return w.stateControls=function(){return[m,f,d]},w.createSelectorHook=r.createSelectorHook.bind(w),w.createObservable=r.createObservable.bind(w),w},this.stateControls=function(){var t=r.getStateOrchestrator(),e=r.getMetadata;return[r.getState,t,e]},this.getStateOrchestrator=function(){return r.actions?r.actions:r.setStateWrapper},this.setStateWrapper=function(t){var e,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=o.forceUpdate,a=o.identifier,u=r.stateWrapper.state,c=(0,v.isFunction)(t)?t(u):t;if(i||r.stateWrapper.state!==c){var l=r.setMetadata,s=r.getMetadata,f=r.getState,d=r.actions,p={setMetadata:l,getMetadata:s,setState:r.setState,getState:f,actions:d,previousState:u,state:c,identifier:a},y=r.computePreventStateChange,b=null===(e=r.callbacks)||void 0===e?void 0:e.computePreventStateChange;if((y||b)&&((null==y?void 0:y(p))||(null==b?void 0:b(p))))return;r.setState({state:c},{forceUpdate:i,identifier:a});var h=r.onStateChanged,m=null===(n=r.callbacks)||void 0===n?void 0:n.onStateChanged;(h||m)&&(null==h||h(p),null==m||m(p))}},this.getStoreActionsMap=function(){if(!(0,s.isRecord)(r.actionsConfig))return null;var t=r.actionsConfig,e=r.setMetadata,n=r.setStateWrapper,o=r.getState,i=r.getMetadata,a=Object.keys(t).reduce((function(r,u){var c,f,v;return Object.assign(r,(c={},v=function(){for(var r=t[u],c=arguments.length,l=new Array(c),f=0;f<c;f++)l[f]=arguments[f];var v=r.apply(a,l);return"function"!=typeof v&&(0,s.throwWrongKeyOnActionCollectionConfig)(u),v.call(a,{setState:n,getState:o,setMetadata:e,getMetadata:i,actions:a})},(f=l(f=u))in c?Object.defineProperty(c,f,{value:v,enumerable:!0,configurable:!0,writable:!0}):c[f]=v,c)),r}),{});return a};var a=n.metadata,c=n.callbacks,d=n.actions,p=n.name;this.stateWrapper={state:e},this._name=null!=p?p:(0,s.uniqueId)("gs:"),this.metadata=null!=a?a:{},this.callbacks=null!=c?c:null,this.actionsConfig=null!=d?d:null,(null===globalThis||void 0===globalThis?void 0:globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG)&&globalThis.REACT_GLOBAL_STATE_HOOK_DEBUG(this),this.constructor!==t||this.initialize()}var e,r;return e=t,r=[{key:"createObservable",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.isEqualRoot,n=e.isEqual,i=e.name,a=o(this.stateControls(),1)[0],u=[],c=a(),l=(null!=t?t:function(t){return t})(a());a((function(e){if(!(null!=r?r:Object.is)(c,e)){c=e;var o=t(e);(null!=n?n:Object.is)(l,o)||(l=o,u.forEach((function(t){return t()})))}}),{skipFirst:!0});var f=function(t,e,r){var n;if(!t)return l;var o=(0,v.isFunction)(e),i=o?t:void 0,a=o?e:t,c=null!==(n=o?r:e)&&void 0!==n?n:void 0,s=function(){return a(i?i(l):l)};(null==c?void 0:c.skipFirst)||s();var f=function(){s()};return u.push(f),function(){u.splice(u.indexOf(f),1)}};return f._name=null!=i?i:(0,s.uniqueId)("ob:"),f.createObservable=this.createObservable.bind(f),f.stateControls=function(){return[f]},f}}],r&&c(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.GlobalStore=d},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.useConstantValueRef=e.uniqueSymbol=e.isRecord=e.throwWrongKeyOnActionCollectionConfig=e.uniqueId=e.debounce=e.shallowCompare=void 0;var c,l=r(684),s=r(156);e.shallowCompare=function(t,r){if(t===r)return!0;var i=u(t),a=u(r);if(i!==a)return!1;if((0,l.isNil)(t)||(0,l.isNil)(r)||(0,l.isPrimitive)(t)&&(0,l.isPrimitive)(r)||(0,l.isDate)(t)&&(0,l.isDate)(r)||"function"===i&&"function"===a)return t===r;if(Array.isArray(t)){var c=t,s=r;if(c.length!==s.length)return!1;for(var f=0;f<c.length;f++)if(c[f]!==s[f])return!1}if(t instanceof Map){var v=t,d=r;if(v.size!==d.size)return!1;var p,y=o(v);try{for(y.s();!(p=y.n()).done;){var b=n(p.value,2),h=b[0];if(b[1]!==d.get(h))return!1}}catch(t){y.e(t)}finally{y.f()}}if(t instanceof Set){var m=t,g=r;if(m.size!==g.size)return!1;var S,w=o(m);try{for(w.s();!(S=w.n()).done;){var O=S.value;if(!g.has(O))return!1}}catch(t){w.e(t)}finally{w.f()}}if(!(0,e.isRecord)(t)||!(0,e.isRecord)(r))return t===r;var j=Object.keys(t),E=Object.keys(r);if(j.length!==E.length)return!1;for(var x=0,A=j;x<A.length;x++){var C=A[x];if(t[C]!==r[C])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=(c=0,function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return c===Number.MAX_SAFE_INTEGER&&(c=0),t+Date.now().toString(36)+(c++).toString(36)}),e.throwWrongKeyOnActionCollectionConfig=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"))},e.isRecord=function(t){return!(0,l.isNil)(t)&&"object"===u(t)},e.uniqueSymbol=Symbol("unique"),e.useConstantValueRef=function(t){var r=(0,s.useRef)(e.uniqueSymbol);return r.current===e.uniqueSymbol&&(r.current=t()),r}},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(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,c),(t=u.apply(this,arguments)).onInit=function(e){t.onInitialize(e)},t.onStateChanged=function(e){t.onChange(e)},t}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={124:(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(331),e)},331:(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){if("object"!=r(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e: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={}.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=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){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.jsonParse,a=r.sortKeys;return function(t){var r,i,u;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 c=(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(c)}if("set"===(null==t?void 0:t.$t)){var l=null!==(i=t.$v)&&void 0!==i?i:[].map((function(t){return(0,e.formatFromStore)(t)}));return new Set(l)}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)")):(u=Object.keys(t),a?(0,e.isFunction)(a)?u.sort(a):u.sort((function(t,e){return(null!=t?t:"").localeCompare(e)})):u).reduce((function(r,o){var i=t[o];return Object.assign(Object.assign({},r),n({},o,(0,e.formatFromStore)(i)))}),{})}(i?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=o.sortKeys,s=new Set(null!=u?u:[]),f=new Set(null!=c?c:[]),v=s.size||f.size,d=null!=a?a:function(t){var e=t.key,n=t.value;if(!v)return!0;var o=f.has(e),i=s.has(r(n));return!o&&!i},p=function(t){if((0,e.isPrimitive)(t))return t;var r;if(Array.isArray(t))return t.map((function(t){return p(t)}));if(t instanceof Map)return{$t:"map",$v:Array.from(t.entries()).map((function(t){return p(t)}))};if(t instanceof Set)return{$t:"set",$v:Array.from(t.values()).map((function(t){return p(t)}))};if((0,e.isDate)(t))return{$t:"date",$v:t.toISOString()};if((0,e.isRegex)(t))return{$t:"regex",$v:t.toString()};if((0,e.isFunction)(t)){var o;try{o={$t:"function",$v:t.toString()}}catch(t){o={$t:"error",$v:"Error: Could not serialize function"}}return o}return t instanceof Error?{$t:"error",$v:t.message}:(r=Object.keys(t),l?(0,e.isFunction)(l)?r.sort(l):r.sort((function(t,e){return(null!=t?t:"").localeCompare(e)})):r).reduce((function(e,r){var o=t[r],i=p(o);return d({obj:t,key:r,value:i})?Object.assign(Object.assign({},e),n({},r,p(o))):e}),{})},y=p((0,e.clone)(t));return i?JSON.stringify(y):y}}},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}(124)})()},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 +0,0 @@
|
|
|
1
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare const shallowCompare: <T>(value1: T, value2: T) => boolean;
|
|
3
|
-
export declare const debounce: <T extends (...args: Parameters<T>) => void>(callback: T, delay?: number) => (...args: Parameters<T>) => void;
|
|
4
|
-
export declare const uniqueId: (prefix?: string) => string;
|
|
5
|
-
export declare const throwWrongKeyOnActionCollectionConfig: (action_key: string) => never;
|
|
6
|
-
export declare const isRecord: (value: unknown) => value is Record<string, unknown>;
|
|
7
|
-
export declare const uniqueSymbol: unique symbol;
|
|
8
|
-
export type UniqueSymbol = typeof uniqueSymbol;
|
|
9
|
-
export declare const useConstantValueRef: <T>(initializer: () => T) => import("react").RefObject<T>;
|
package/lib/src/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from 'json-storage-formatter';
|
|
2
|
-
export * from './GlobalStore.types';
|
|
3
|
-
export * from './GlobalStore';
|
|
4
|
-
export * from './GlobalStoreAbstract';
|
|
5
|
-
export * from './GlobalStore.functionHooks';
|
|
6
|
-
export * from './GlobalStore.utils';
|
|
7
|
-
export * from './GlobalStore.combiners';
|
|
8
|
-
export * from './GlobalStore.context';
|
|
File without changes
|