react-hooks-global-states 8.0.1 → 8.0.3
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/GlobalStore.js +1 -1
- package/GlobalStoreAbstract.js +1 -1
- package/bundle.js +1 -1
- package/createContext.js +1 -1
- package/createCustomGlobalState.js +1 -1
- package/createGlobalState.js +1 -1
- package/generateStackHash.js +1 -1
- package/isRecord.js +1 -1
- package/package.json +1 -1
- package/shallowCompare.js +1 -1
- package/throwWrongKeyOnActionCollectionConfig.js +1 -1
- package/types.js +1 -1
- package/uniqueId.js +1 -1
- package/uniqueSymbol.js +1 -1
- package/useStableState.js +1 -1
- package/webpack.config.js +2 -2
package/GlobalStore.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("./generateStackHash.js"),require("./isRecord.js"),require("./shallowCompare.js"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./uniqueId.js"),require("./uniqueSymbol.js"),require("json-storage-formatter/isFunction"),require("json-storage-formatter/isNil"),require("json-storage-formatter/isString"),require("react")):"function"==typeof define&&define.amd?define(["./generateStackHash.js","./isRecord.js","./shallowCompare.js","./throwWrongKeyOnActionCollectionConfig.js","./uniqueId.js","./uniqueSymbol.js","json-storage-formatter/isFunction","json-storage-formatter/isNil","json-storage-formatter/isString","react"],e):"object"==typeof exports?exports["react-hooks-global-states"]=e(require("./generateStackHash.js"),require("./isRecord.js"),require("./shallowCompare.js"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./uniqueId.js"),require("./uniqueSymbol.js"),require("json-storage-formatter/isFunction"),require("json-storage-formatter/isNil"),require("json-storage-formatter/isString"),require("react")):t["react-hooks-global-states"]=e(t["./generateStackHash.js"],t["./isRecord.js"],t["./shallowCompare.js"],t["./throwWrongKeyOnActionCollectionConfig.js"],t["./uniqueId.js"],t["./uniqueSymbol.js"],t["json-storage-formatter/isFunction"],t["json-storage-formatter/isNil"],t["json-storage-formatter/isString"],t.react)}(this,((t,e,r,n,o,i,a,s,u,c)=>(()=>{"use strict";var l={109:e=>{e.exports=t},664:t=>{t.exports=e},682:t=>{t.exports=r},286:t=>{t.exports=n},865:t=>{t.exports=o},69:t=>{t.exports=i},122:t=>{t.exports=a},538:t=>{t.exports=s},582:t=>{t.exports=u},156:t=>{t.exports=c}},f={};function p(t){var e=f[t];if(void 0!==e)return e.exports;var r=f[t]={exports:{}};return l[t](r,r.exports,p),r.exports}var d={};return(()=>{var t=d;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,s=[],u=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||n(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 n(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}}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}function i(){i=function(){return t};var t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.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 h?e:h,a=Object.create(i.prototype),s=new C(n||[]);return o(a,"_invoke",{value:j(t,r,s)}),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 h(){}function v(){}function b(){}var g={};l(g,s,(function(){return this}));var y=Object.getPrototypeOf,S=y&&y(y(k([])));S&&S!==r&&n.call(S,s)&&(g=S);var m=b.prototype=h.prototype=Object.create(g);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,s,u){var c=p(t[o],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==e(f)&&n.call(f,"__await")?r.resolve(f.__await).then((function(t){i("next",t,s,u)}),(function(t){i("throw",t,s,u)})):r.resolve(f).then((function(t){l.value=t,s(l)}),(function(t){return i("throw",t,s,u)}))}u(c.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{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=E(a,r);if(s){if(s===d)continue;return s}}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 u=p(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.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=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 _(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 x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function k(t){if(t){var e=t[s];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:T}}function T(){return{value:void 0,done:!0}}return v.prototype=b,o(m,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:v,configurable:!0}),v.displayName=l(b,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,l(t,c,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},w(O.prototype),l(O.prototype,u,(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(m),l(m,c,"Generator"),l(m,s,(function(){return this})),l(m,"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(x),!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 s=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)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,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),x(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;x(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 a(t){var r=function(t){if("object"!==e(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===e(r)?r:String(r)}Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalStore=void 0;var s=p(156),u=p(122),c=p(538),l=p(582),f=p(664),h=p(682),v=p(286),b=p(865),g=p(69),y=p(109),S=globalThis;!function(){if(!S.REACT_GLOBAL_STATE_HOOK_DEBUG&&!(0,c.isNil)(S.sessionStorage)){try{if(!S.sessionStorage.getItem("REACT_GLOBAL_STATE_HOOK_DEBUG"))return}catch(t){return}S.REACT_GLOBAL_STATE_TEMP_HOOKS=new Map,setTimeout((function(){S.REACT_GLOBAL_STATE_TEMP_HOOKS=null}),6e4)}}();var m=function(){function t(e){var o,p=this,d=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.wasDisposed=!1,this.actionsConfig=null,this.callbacks=null,this.actions=null,this.subscribers=new Map,this.initialize=function(){return t=p,e=void 0,r=i().mark((function t(){var e,r,n,o,a,s;return i().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:{},a=o.onInit,n||a){t.next=6;break}return t.abrupt("return");case 6:s=this.getConfigCallbackParam(),null==n||n(s),(0,c.isNil)(a)||null==a||a(s);case 9:case"end":return t.stop()}}),t,this)})),new(e||(e=Promise))((function(n,o){function i(t){try{s(r.next(t))}catch(t){o(t)}}function a(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var r;t.done?n(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(i,a)}s((r=r.apply(t,[])).next())}));var t,e,r},this.executeSetStateForSubscriber=function(t,e){var r,n,o=t.selector,i=t.callback,a=t.currentState,s=t.config;if(!e.forceUpdate&&(null!==(r=null==s?void 0:s.isEqualRoot)&&void 0!==r?r:function(t,e){return t===e})(e.currentRootState,e.newRootState))return{didUpdate:!1};var u=o?o(e.newRootState):e.newRootState;return!e.forceUpdate&&(null!==(n=null==s?void 0:s.isEqual)&&void 0!==n?n:function(t,e){return t===e})(a,u)?{didUpdate:!1}:(p.partialUpdateSubscription(t.subscriptionId,{currentState:u}),i({state:u},{identifier:e.identifier}),{didUpdate:!0})},this.setState=function(t,e){var r=t.state,o=e.forceUpdate,i=e.identifier,a=p.stateWrapper.state;if(o||a!==r){p.stateWrapper={state:r};var s,u={forceUpdate:o,newRootState:r,currentRootState:a,identifier:i},c=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=n(t))){e&&(t=e);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},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 i,a=!0,s=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(s)throw i}}}}(p.subscribers.values());try{for(c.s();!(s=c.n()).done;){var l=s.value;p.executeSetStateForSubscriber(l,u)}}catch(t){c.e(t)}finally{c.f()}}},this.setMetadata=function(t){var e=(0,u.isFunction)(t)?t(p.metadata):t;p.metadata=e},this.getMetadata=function(){return p.metadata},this.getState=function(t,e,r){var n;if(!t)return p.stateWrapper.state;var o=(0,u.isFunction)(e),i=o?t:void 0,a=o?e:t,s=null!==(n=o?r:e)&&void 0!==n?n:void 0,c=i?i(p.stateWrapper.state):p.stateWrapper.state;(null==s?void 0:s.skipFirst)||a(c);var l=(0,b.uniqueId)("gs:");return p.setOrUpdateSubscription({subscriptionId:l,selector:i,config:s,currentState:c,callback:function(t){var e=t.state;return a(e)},isSetStateCallback:!1}),function(){p.subscribers.delete(l)}},this.getConfigCallbackParam=function(){var t=p.setMetadata,e=p.getMetadata,r=p.getState,n=p.actions;return{setMetadata:t,getMetadata:e,getState:r,setState:p.setStateWrapper,actions:n}},this.lastSubscriptionId=null,this.setOrUpdateSubscription=function(t){var e=t.subscriptionId;if(!e)return{isNewSubscription:!1};var r=p.subscribers.get(e);return(0,f.isRecord)(r)?(Object.assign(r,t),{isNewSubscription:!1}):(p.executeOnSubscribed(),p.subscribers.set(e,t),p.lastSubscriptionId=e,{isNewSubscription:!0})},this.partialUpdateSubscription=function(t,e){var r=p.subscribers.get(t);(0,f.isRecord)(r)&&Object.assign(r,e)},this.executeOnSubscribed=function(){var t,e=p.onSubscribed,r=null===(t=p.callbacks)||void 0===t?void 0:t.onSubscribed;if(e||r){var n=p.getConfigCallbackParam();null==e||e(n),null==r||r(n)}},this.getHook=function(){var t=function(t){var e,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(p.wasDisposed)throw new Error("The global state was disposed");var i=Array.isArray(o)?{dependencies:o}:null!=o?o:{},a=(0,s.useRef)({subscriptionId:null,tempInitialRootState:p.stateWrapper.state}),u=function(){return t?{state:t(p.stateWrapper.state)}:p.stateWrapper},f=r((0,s.useState)(u),2),d=f[0],h=f[1];(0,s.useEffect)((function(){if(!(0,c.isNil)(a.current)){(0,c.isNil)(a.current.subscriptionId)&&(a.current.subscriptionId=(0,b.uniqueId)("ss:"));var e=a.current.subscriptionId,r={subscriptionId:e,currentState:d.state,selector:t,config:i,callback:h,isSetStateCallback:!0};return p.setOrUpdateSubscription(r).isNewSubscription&&(p.executeSetStateForSubscriber(r,{forceUpdate:!1,newRootState:p.stateWrapper.state,currentRootState:a.current.tempInitialRootState===g.uniqueSymbol?p.stateWrapper.state:a.current.tempInitialRootState,identifier:"on mount state update"}),a.current.tempInitialRootState=g.uniqueSymbol),function(){p.subscribers.delete(e)}}}),[]);var v=(0,l.isString)(null===(e=a.current)||void 0===e?void 0:e.subscriptionId)?a.current.subscriptionId:"",y=p.subscribers.get(v),S=(null!==(n=null==y?void 0:y.config)&&void 0!==n?n:{dependencies:i.dependencies}).dependencies;return p.partialUpdateSubscription(v,{currentState:d.state,selector:t,config:i,callback:h}),[p.computeSelectedState({selector:t,subscriptionId:v,config:i,currentDependencies:S,computeChildState:u,stateWrapperRef:d}),p.getStateOrchestrator(),p.metadata]};return t.stateControls=p.stateControls,t.createSelectorHook=p.createSelectorHook,t.createObservable=p.createObservable,t.removeSubscriptions=p.removeSubscriptions,t.dispose=p.dispose,t},this.computeSelectedState=function(t){var e=t.selector,r=t.subscriptionId,n=t.config,o=t.currentDependencies,i=t.computeChildState,a=t.stateWrapperRef;if(!e||!r)return a.state;var s=n.dependencies;if(o===s)return a.state;if((null==o?void 0:o.length)===(null==s?void 0:s.length)&&(0,h.shallowCompare)(o,s))return a.state;var u=i().state;return p.partialUpdateSubscription(r,{currentState:u}),a.state=u,u},this.createSelectorHook=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.isEqualRoot,i=n.isEqual,a=n.name,s=r(p.stateControls(),3),c=s[0],l=s[1],f=s[2],d=c(),h=(null!=e?e:function(t){return t})(d),v=new t(h,{name:null!=a?a:(0,b.uniqueId)("sh:")}),g=r(v.stateControls(),2),y=g[0],S=g[1],m=c((function(t){if(!(null!=o?o:Object.is)(d,t)){d=t;var r=e(t);(null!=i?i:Object.is)(h,r)||(h=r,S(r))}}),{skipFirst:!0}),w=v.getHook(),O=function(t,e){return[r((0,u.isFunction)(t)?w(t,e):w(),1)[0],l,f]};return O.stateControls=function(){return[y,l,f]},O.createSelectorHook=p.createSelectorHook.bind(O),O.createObservable=p.createObservable.bind(O),O.removeSubscriptions=function(){m(),v.removeSubscriptions()},O.dispose=function(){O.removeSubscriptions(),v.dispose()},O},this.stateControls=function(){var t=p.getStateOrchestrator(),e=p.getMetadata;return[p.getState,t,e]},this.getStateOrchestrator=function(){return p.actions?p.actions:p.setStateWrapper},this.setStateWrapper=function(t){var e,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.forceUpdate,i=n.identifier,a=p.stateWrapper.state,s=(0,u.isFunction)(t)?t(a):t;if(o||p.stateWrapper.state!==s){var c=p.setMetadata,l=p.getMetadata,f=p.getState,d=p.actions,h={setMetadata:c,getMetadata:l,setState:p.setState,getState:f,actions:d,previousState:a,state:s,identifier:i},v=p.computePreventStateChange,b=null===(e=p.callbacks)||void 0===e?void 0:e.computePreventStateChange;if((v||b)&&((null==v?void 0:v(h))||(null==b?void 0:b(h))))return;p.setState({state:s},{forceUpdate:o,identifier:i});var g=p.onStateChanged,y=null===(r=p.callbacks)||void 0===r?void 0:r.onStateChanged;(g||y)&&(null==g||g(h),null==y||y(h))}},this.getStoreActionsMap=function(){if(!(0,f.isRecord)(p.actionsConfig))return null;var t=p.actionsConfig,e=p.setMetadata,r=p.setStateWrapper,n=p.getState,o=p.getMetadata,i=Object.keys(t).reduce((function(s,u){var c,l,f;return Object.assign(s,(c={},f=function(){for(var a=t[u],s=arguments.length,c=new Array(s),l=0;l<s;l++)c[l]=arguments[l];var f=a.apply(i,c);return"function"!=typeof f&&(0,v.throwWrongKeyOnActionCollectionConfig)(u),f.call(i,{setState:r,getState:n,setMetadata:e,getMetadata:o,actions:i})},(l=a(l=u))in c?Object.defineProperty(c,l,{value:f,enumerable:!0,configurable:!0,writable:!0}):c[l]=f,c)),s}),{});return i},this.removeSubscriptions=function(){p.subscribers.clear()},this.dispose=function(){p.wasDisposed=!0,p.removeSubscriptions(),p._name="",p.actionsConfig=null,p.callbacks=null,p.metadata={},p.actions=null,p.subscribers.clear(),p.stateWrapper={state:null}};var m=d.metadata,w=d.callbacks,O=d.actions,j=d.name;this.stateWrapper={state:e},this._name=null!=j?j:(0,b.uniqueId)("gs:"),this.metadata=null!=m?m:{},this.callbacks=null!=w?w:null,this.actionsConfig=null!=O?O:null;var E="";if((S.REACT_GLOBAL_STATE_HOOK_DEBUG||S.REACT_GLOBAL_STATE_TEMP_HOOKS)&&(E=(0,y.generateStackHash)(null!==(o=(new Error).stack)&&void 0!==o?o:"")),S.REACT_GLOBAL_STATE_HOOK_DEBUG)S.REACT_GLOBAL_STATE_HOOK_DEBUG(this,d,E);else if(S.REACT_GLOBAL_STATE_TEMP_HOOKS){var _=void 0!==globalThis.WeakRef?new globalThis.WeakRef(this):this,x=void 0!==globalThis.WeakRef?new globalThis.WeakRef(d):d;S.REACT_GLOBAL_STATE_TEMP_HOOKS.set(E,[_,x])}this.constructor!==t||this.initialize()}var e,o;return e=t,o=[{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],s=[],c=a(),l=(null!=t?t:function(t){return t})(a()),f=a((function(e){if(!(null!=n?n:Object.is)(c,e)){c=e;var r=t(e);(null!=o?o:Object.is)(l,r)||(l=r,s.forEach((function(t){return t()})))}}),{skipFirst:!0}),p=function(t,e,r){var n;if(!t)return l;var o=(0,u.isFunction)(e),i=o?t:void 0,a=o?e:t,c=null!==(n=o?r:e)&&void 0!==n?n:void 0,f=function(){return a(i?i(l):l)};(null==c?void 0:c.skipFirst)||f();var p=function(){f()};return s.push(p),function(){s.splice(s.indexOf(p),1)}};return p._name=null!=i?i:(0,b.uniqueId)("ob:"),p.createObservable=this.createObservable.bind(p),p.removeSubscriptions=function(){s.forEach((function(t){return t()})),s.length=0,f()},p.stateControls=function(){return[p]},p}}],o&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,a(n.key),n)}}(e.prototype,o),Object.defineProperty(e,"prototype",{writable:!1}),t}();t.GlobalStore=m,t.default=m})(),d})()));
|
|
1
|
+
var t,e;t=this,e=(t,e,r,n,o,i,a,s,u,c)=>(()=>{"use strict";var l={109:e=>{e.exports=t},664:t=>{t.exports=e},682:t=>{t.exports=r},286:t=>{t.exports=n},865:t=>{t.exports=o},69:t=>{t.exports=i},122:t=>{t.exports=a},538:t=>{t.exports=s},582:t=>{t.exports=u},156:t=>{t.exports=c}},f={};function p(t){var e=f[t];if(void 0!==e)return e.exports;var r=f[t]={exports:{}};return l[t](r,r.exports,p),r.exports}var d={};return(()=>{var t=d;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,s=[],u=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){c=!0,o=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(t,e)||n(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 n(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}}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}function i(){i=function(){return t};var t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.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 h?e:h,a=Object.create(i.prototype),s=new C(n||[]);return o(a,"_invoke",{value:j(t,r,s)}),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 h(){}function v(){}function b(){}var g={};l(g,s,(function(){return this}));var y=Object.getPrototypeOf,S=y&&y(y(k([])));S&&S!==r&&n.call(S,s)&&(g=S);var m=b.prototype=h.prototype=Object.create(g);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,s,u){var c=p(t[o],t,a);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==e(f)&&n.call(f,"__await")?r.resolve(f.__await).then((function(t){i("next",t,s,u)}),(function(t){i("throw",t,s,u)})):r.resolve(f).then((function(t){l.value=t,s(l)}),(function(t){return i("throw",t,s,u)}))}u(c.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{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=E(a,r);if(s){if(s===d)continue;return s}}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 u=p(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===d)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.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=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 _(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 x(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function C(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function k(t){if(t){var e=t[s];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:T}}function T(){return{value:void 0,done:!0}}return v.prototype=b,o(m,"constructor",{value:b,configurable:!0}),o(b,"constructor",{value:v,configurable:!0}),v.displayName=l(b,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===v||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,l(t,c,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},w(O.prototype),l(O.prototype,u,(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(m),l(m,c,"Generator"),l(m,s,(function(){return this})),l(m,"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(x),!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 s=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)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,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),x(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;x(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 a(t){var r=function(t){if("object"!==e(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==e(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===e(r)?r:String(r)}Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalStore=void 0;var s=p(156),u=p(122),c=p(538),l=p(582),f=p(664),h=p(682),v=p(286),b=p(865),g=p(69),y=p(109),S=globalThis;!function(){if(!S.REACT_GLOBAL_STATE_HOOK_DEBUG&&!(0,c.isNil)(S.sessionStorage)){try{if(!S.sessionStorage.getItem("REACT_GLOBAL_STATE_HOOK_DEBUG"))return}catch(t){return}S.REACT_GLOBAL_STATE_TEMP_HOOKS=new Map,setTimeout((function(){S.REACT_GLOBAL_STATE_TEMP_HOOKS=null}),6e4)}}();var m=function(){function t(e){var o,p=this,d=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.wasDisposed=!1,this.actionsConfig=null,this.callbacks=null,this.actions=null,this.subscribers=new Map,this.initialize=function(){return t=p,e=void 0,r=i().mark((function t(){var e,r,n,o,a,s;return i().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:{},a=o.onInit,n||a){t.next=6;break}return t.abrupt("return");case 6:s=this.getConfigCallbackParam(),null==n||n(s),(0,c.isNil)(a)||null==a||a(s);case 9:case"end":return t.stop()}}),t,this)})),new(e||(e=Promise))((function(n,o){function i(t){try{s(r.next(t))}catch(t){o(t)}}function a(t){try{s(r.throw(t))}catch(t){o(t)}}function s(t){var r;t.done?n(t.value):(r=t.value,r instanceof e?r:new e((function(t){t(r)}))).then(i,a)}s((r=r.apply(t,[])).next())}));var t,e,r},this.executeSetStateForSubscriber=function(t,e){var r,n,o=t.selector,i=t.callback,a=t.currentState,s=t.config;if(!e.forceUpdate&&(null!==(r=null==s?void 0:s.isEqualRoot)&&void 0!==r?r:function(t,e){return t===e})(e.currentRootState,e.newRootState))return{didUpdate:!1};var u=o?o(e.newRootState):e.newRootState;return!e.forceUpdate&&(null!==(n=null==s?void 0:s.isEqual)&&void 0!==n?n:function(t,e){return t===e})(a,u)?{didUpdate:!1}:(p.partialUpdateSubscription(t.subscriptionId,{currentState:u}),i({state:u},{identifier:e.identifier}),{didUpdate:!0})},this.setState=function(t,e){var r=t.state,o=e.forceUpdate,i=e.identifier,a=p.stateWrapper.state;if(o||a!==r){p.stateWrapper={state:r};var s,u={forceUpdate:o,newRootState:r,currentRootState:a,identifier:i},c=function(t){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=n(t))){e&&(t=e);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},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 i,a=!0,s=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(s)throw i}}}}(p.subscribers.values());try{for(c.s();!(s=c.n()).done;){var l=s.value;p.executeSetStateForSubscriber(l,u)}}catch(t){c.e(t)}finally{c.f()}}},this.setMetadata=function(t){var e=(0,u.isFunction)(t)?t(p.metadata):t;p.metadata=e},this.getMetadata=function(){return p.metadata},this.getState=function(t,e,r){var n;if(!t)return p.stateWrapper.state;var o=(0,u.isFunction)(e),i=o?t:void 0,a=o?e:t,s=null!==(n=o?r:e)&&void 0!==n?n:void 0,c=i?i(p.stateWrapper.state):p.stateWrapper.state;(null==s?void 0:s.skipFirst)||a(c);var l=(0,b.uniqueId)("gs:");return p.setOrUpdateSubscription({subscriptionId:l,selector:i,config:s,currentState:c,callback:function(t){var e=t.state;return a(e)},isSetStateCallback:!1}),function(){p.subscribers.delete(l)}},this.getConfigCallbackParam=function(){var t=p.setMetadata,e=p.getMetadata,r=p.getState,n=p.actions;return{setMetadata:t,getMetadata:e,getState:r,setState:p.setStateWrapper,actions:n}},this.lastSubscriptionId=null,this.setOrUpdateSubscription=function(t){var e=t.subscriptionId;if(!e)return{isNewSubscription:!1};var r=p.subscribers.get(e);return(0,f.isRecord)(r)?(Object.assign(r,t),{isNewSubscription:!1}):(p.executeOnSubscribed(),p.subscribers.set(e,t),p.lastSubscriptionId=e,{isNewSubscription:!0})},this.partialUpdateSubscription=function(t,e){var r=p.subscribers.get(t);(0,f.isRecord)(r)&&Object.assign(r,e)},this.executeOnSubscribed=function(){var t,e=p.onSubscribed,r=null===(t=p.callbacks)||void 0===t?void 0:t.onSubscribed;if(e||r){var n=p.getConfigCallbackParam();null==e||e(n),null==r||r(n)}},this.getHook=function(){var t=function(t){var e,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(p.wasDisposed)throw new Error("The global state was disposed");var i=Array.isArray(o)?{dependencies:o}:null!=o?o:{},a=(0,s.useRef)({subscriptionId:null,tempInitialRootState:p.stateWrapper.state}),u=function(){return t?{state:t(p.stateWrapper.state)}:p.stateWrapper},f=r((0,s.useState)(u),2),d=f[0],h=f[1];(0,s.useEffect)((function(){if(!(0,c.isNil)(a.current)){(0,c.isNil)(a.current.subscriptionId)&&(a.current.subscriptionId=(0,b.uniqueId)("ss:"));var e=a.current.subscriptionId,r={subscriptionId:e,currentState:d.state,selector:t,config:i,callback:h,isSetStateCallback:!0};return p.setOrUpdateSubscription(r).isNewSubscription&&(p.executeSetStateForSubscriber(r,{forceUpdate:!1,newRootState:p.stateWrapper.state,currentRootState:a.current.tempInitialRootState===g.uniqueSymbol?p.stateWrapper.state:a.current.tempInitialRootState,identifier:"on mount state update"}),a.current.tempInitialRootState=g.uniqueSymbol),function(){p.subscribers.delete(e)}}}),[]);var v=(0,l.isString)(null===(e=a.current)||void 0===e?void 0:e.subscriptionId)?a.current.subscriptionId:"",y=p.subscribers.get(v),S=(null!==(n=null==y?void 0:y.config)&&void 0!==n?n:{dependencies:i.dependencies}).dependencies;return p.partialUpdateSubscription(v,{currentState:d.state,selector:t,config:i,callback:h}),[p.computeSelectedState({selector:t,subscriptionId:v,config:i,currentDependencies:S,computeChildState:u,stateWrapperRef:d}),p.getStateOrchestrator(),p.metadata]};return t.stateControls=p.stateControls,t.createSelectorHook=p.createSelectorHook,t.createObservable=p.createObservable,t.removeSubscriptions=p.removeSubscriptions,t.dispose=p.dispose,t},this.computeSelectedState=function(t){var e=t.selector,r=t.subscriptionId,n=t.config,o=t.currentDependencies,i=t.computeChildState,a=t.stateWrapperRef;if(!e||!r)return a.state;var s=n.dependencies;if(o===s)return a.state;if((null==o?void 0:o.length)===(null==s?void 0:s.length)&&(0,h.shallowCompare)(o,s))return a.state;var u=i().state;return p.partialUpdateSubscription(r,{currentState:u}),a.state=u,u},this.createSelectorHook=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.isEqualRoot,i=n.isEqual,a=n.name,s=r(p.stateControls(),3),c=s[0],l=s[1],f=s[2],d=c(),h=(null!=e?e:function(t){return t})(d),v=new t(h,{name:null!=a?a:(0,b.uniqueId)("sh:")}),g=r(v.stateControls(),2),y=g[0],S=g[1],m=c((function(t){if(!(null!=o?o:Object.is)(d,t)){d=t;var r=e(t);(null!=i?i:Object.is)(h,r)||(h=r,S(r))}}),{skipFirst:!0}),w=v.getHook(),O=function(t,e){return[r((0,u.isFunction)(t)?w(t,e):w(),1)[0],l,f]};return O.stateControls=function(){return[y,l,f]},O.createSelectorHook=p.createSelectorHook.bind(O),O.createObservable=p.createObservable.bind(O),O.removeSubscriptions=function(){m(),v.removeSubscriptions()},O.dispose=function(){O.removeSubscriptions(),v.dispose()},O},this.stateControls=function(){var t=p.getStateOrchestrator(),e=p.getMetadata;return[p.getState,t,e]},this.getStateOrchestrator=function(){return p.actions?p.actions:p.setStateWrapper},this.setStateWrapper=function(t){var e,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.forceUpdate,i=n.identifier,a=p.stateWrapper.state,s=(0,u.isFunction)(t)?t(a):t;if(o||p.stateWrapper.state!==s){var c=p.setMetadata,l=p.getMetadata,f=p.getState,d=p.actions,h={setMetadata:c,getMetadata:l,setState:p.setState,getState:f,actions:d,previousState:a,state:s,identifier:i},v=p.computePreventStateChange,b=null===(e=p.callbacks)||void 0===e?void 0:e.computePreventStateChange;if((v||b)&&((null==v?void 0:v(h))||(null==b?void 0:b(h))))return;p.setState({state:s},{forceUpdate:o,identifier:i});var g=p.onStateChanged,y=null===(r=p.callbacks)||void 0===r?void 0:r.onStateChanged;(g||y)&&(null==g||g(h),null==y||y(h))}},this.getStoreActionsMap=function(){if(!(0,f.isRecord)(p.actionsConfig))return null;var t=p.actionsConfig,e=p.setMetadata,r=p.setStateWrapper,n=p.getState,o=p.getMetadata,i=Object.keys(t).reduce((function(s,u){var c,l,f;return Object.assign(s,(c={},f=function(){for(var a=t[u],s=arguments.length,c=new Array(s),l=0;l<s;l++)c[l]=arguments[l];var f=a.apply(i,c);return"function"!=typeof f&&(0,v.throwWrongKeyOnActionCollectionConfig)(u),f.call(i,{setState:r,getState:n,setMetadata:e,getMetadata:o,actions:i})},(l=a(l=u))in c?Object.defineProperty(c,l,{value:f,enumerable:!0,configurable:!0,writable:!0}):c[l]=f,c)),s}),{});return i},this.removeSubscriptions=function(){p.subscribers.clear()},this.dispose=function(){p.wasDisposed=!0,p.removeSubscriptions(),p._name="",p.actionsConfig=null,p.callbacks=null,p.metadata={},p.actions=null,p.subscribers.clear(),p.stateWrapper={state:null}};var m=d.metadata,w=d.callbacks,O=d.actions,j=d.name;this.stateWrapper={state:e},this._name=null!=j?j:(0,b.uniqueId)("gs:"),this.metadata=null!=m?m:{},this.callbacks=null!=w?w:null,this.actionsConfig=null!=O?O:null;var E="";if((S.REACT_GLOBAL_STATE_HOOK_DEBUG||S.REACT_GLOBAL_STATE_TEMP_HOOKS)&&(E=(0,y.generateStackHash)(null!==(o=(new Error).stack)&&void 0!==o?o:"")),S.REACT_GLOBAL_STATE_HOOK_DEBUG)S.REACT_GLOBAL_STATE_HOOK_DEBUG(this,d,E);else if(S.REACT_GLOBAL_STATE_TEMP_HOOKS){var _=void 0!==globalThis.WeakRef?new globalThis.WeakRef(this):this,x=void 0!==globalThis.WeakRef?new globalThis.WeakRef(d):d;S.REACT_GLOBAL_STATE_TEMP_HOOKS.set(E,[_,x])}this.constructor!==t||this.initialize()}var e,o;return e=t,o=[{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],s=[],c=a(),l=(null!=t?t:function(t){return t})(a()),f=a((function(e){if(!(null!=n?n:Object.is)(c,e)){c=e;var r=t(e);(null!=o?o:Object.is)(l,r)||(l=r,s.forEach((function(t){return t()})))}}),{skipFirst:!0}),p=function(t,e,r){var n;if(!t)return l;var o=(0,u.isFunction)(e),i=o?t:void 0,a=o?e:t,c=null!==(n=o?r:e)&&void 0!==n?n:void 0,f=function(){return a(i?i(l):l)};(null==c?void 0:c.skipFirst)||f();var p=function(){f()};return s.push(p),function(){s.splice(s.indexOf(p),1)}};return p._name=null!=i?i:(0,b.uniqueId)("ob:"),p.createObservable=this.createObservable.bind(p),p.removeSubscriptions=function(){s.forEach((function(t){return t()})),s.length=0,f()},p.stateControls=function(){return[p]},p}}],o&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,a(n.key),n)}}(e.prototype,o),Object.defineProperty(e,"prototype",{writable:!1}),t}();t.GlobalStore=m,t.default=m})(),d})(),"object"==typeof exports&&"object"==typeof module?module.exports=e(require("./generateStackHash.js"),require("./isRecord.js"),require("./shallowCompare.js"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./uniqueId.js"),require("./uniqueSymbol.js"),require("json-storage-formatter/isFunction"),require("json-storage-formatter/isNil"),require("json-storage-formatter/isString"),require("react")):"function"==typeof define&&define.amd?define(["./generateStackHash.js","./isRecord.js","./shallowCompare.js","./throwWrongKeyOnActionCollectionConfig.js","./uniqueId.js","./uniqueSymbol.js","json-storage-formatter/isFunction","json-storage-formatter/isNil","json-storage-formatter/isString","react"],e):"object"==typeof exports?exports["react-hooks-global-states"]=e(require("./generateStackHash.js"),require("./isRecord.js"),require("./shallowCompare.js"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./uniqueId.js"),require("./uniqueSymbol.js"),require("json-storage-formatter/isFunction"),require("json-storage-formatter/isNil"),require("json-storage-formatter/isString"),require("react")):t["react-hooks-global-states"]=e(t["./generateStackHash.js"],t["./isRecord.js"],t["./shallowCompare.js"],t["./throwWrongKeyOnActionCollectionConfig.js"],t["./uniqueId.js"],t["./uniqueSymbol.js"],t["json-storage-formatter/isFunction"],t["json-storage-formatter/isNil"],t["json-storage-formatter/isString"],t.react);
|
package/GlobalStoreAbstract.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var t;t=t=>(()=>{"use strict";var e={352:e=>{e.exports=t}},o={};function r(t){var n=o[t];if(void 0!==n)return n.exports;var i=o[t]={exports:{}};return e[t](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)}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(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&&o(t,e)}(f,t);var r,n,c,u=(n=f,c=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,o=i(n);if(c){var r=i(this).constructor;t=Reflect.construct(o,arguments,r)}else t=o.apply(this,arguments);return function(t,o){if(o&&("object"===e(o)||"function"==typeof o))return o;if(void 0!==o)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 f(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,f),(t=u.apply(this,arguments)).onInit=function(e){t.onInitialize(e)},t.onStateChanged=function(e){t.onChange(e)},t}return r=f,Object.defineProperty(r,"prototype",{writable:!1}),r}(r(352).GlobalStore);t.GlobalStoreAbstract=c,t.default=c})(),n})(),"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./GlobalStore.js")):"function"==typeof define&&define.amd?define(["./GlobalStore.js"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("./GlobalStore.js")):this["react-hooks-global-states"]=t(this["./GlobalStore.js"]);
|
package/bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e,t;e=this,t=(e,t,r,o,a,n,s,l,u,i,c,b)=>(()=>{"use strict";var j={352:t=>{t.exports=e},674:e=>{e.exports=t},104:e=>{e.exports=r},842:e=>{e.exports=o},963:e=>{e.exports=a},109:e=>{e.exports=n},664:e=>{e.exports=s},682:e=>{e.exports=l},286:e=>{e.exports=u},865:e=>{e.exports=i},69:e=>{e.exports=c},503:e=>{e.exports=b}},S={};function p(e){var t=S[e];if(void 0!==t)return t.exports;var r=S[e]={exports:{}};return j[e](r,r.exports,p),r.exports}var f={};return(()=>{var e=f;Object.defineProperty(e,"__esModule",{value:!0}),e.generateStackHash=e.createContext=e.useStableState=e.uniqueSymbol=e.isRecord=e.throwWrongKeyOnActionCollectionConfig=e.uniqueId=e.shallowCompare=e.createCustomGlobalState=e.createGlobalState=e.GlobalStoreAbstract=e.GlobalStore=void 0;var t=p(352);Object.defineProperty(e,"GlobalStore",{enumerable:!0,get:function(){return t.GlobalStore}});var r=p(674);Object.defineProperty(e,"GlobalStoreAbstract",{enumerable:!0,get:function(){return r.GlobalStoreAbstract}});var o=p(963);Object.defineProperty(e,"createGlobalState",{enumerable:!0,get:function(){return o.createGlobalState}});var a=p(842);Object.defineProperty(e,"createCustomGlobalState",{enumerable:!0,get:function(){return a.createCustomGlobalState}});var n=p(682);Object.defineProperty(e,"shallowCompare",{enumerable:!0,get:function(){return n.shallowCompare}});var s=p(865);Object.defineProperty(e,"uniqueId",{enumerable:!0,get:function(){return s.uniqueId}});var l=p(286);Object.defineProperty(e,"throwWrongKeyOnActionCollectionConfig",{enumerable:!0,get:function(){return l.throwWrongKeyOnActionCollectionConfig}});var u=p(664);Object.defineProperty(e,"isRecord",{enumerable:!0,get:function(){return u.isRecord}});var i=p(69);Object.defineProperty(e,"uniqueSymbol",{enumerable:!0,get:function(){return i.uniqueSymbol}});var c=p(503);Object.defineProperty(e,"useStableState",{enumerable:!0,get:function(){return c.useStableState}});var b=p(104);Object.defineProperty(e,"createContext",{enumerable:!0,get:function(){return b.createContext}});var j=p(109);Object.defineProperty(e,"generateStackHash",{enumerable:!0,get:function(){return j.generateStackHash}})})(),f})(),"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./GlobalStore.js"),require("./GlobalStoreAbstract.js"),require("./createContext.js"),require("./createCustomGlobalState.js"),require("./createGlobalState.js"),require("./generateStackHash.js"),require("./isRecord.js"),require("./shallowCompare.js"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./uniqueId.js"),require("./uniqueSymbol.js"),require("./useStableState.js")):"function"==typeof define&&define.amd?define(["./GlobalStore.js","./GlobalStoreAbstract.js","./createContext.js","./createCustomGlobalState.js","./createGlobalState.js","./generateStackHash.js","./isRecord.js","./shallowCompare.js","./throwWrongKeyOnActionCollectionConfig.js","./uniqueId.js","./uniqueSymbol.js","./useStableState.js"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("./GlobalStore.js"),require("./GlobalStoreAbstract.js"),require("./createContext.js"),require("./createCustomGlobalState.js"),require("./createGlobalState.js"),require("./generateStackHash.js"),require("./isRecord.js"),require("./shallowCompare.js"),require("./throwWrongKeyOnActionCollectionConfig.js"),require("./uniqueId.js"),require("./uniqueSymbol.js"),require("./useStableState.js")):e["react-hooks-global-states"]=t(e["./GlobalStore.js"],e["./GlobalStoreAbstract.js"],e["./createContext.js"],e["./createCustomGlobalState.js"],e["./createGlobalState.js"],e["./generateStackHash.js"],e["./isRecord.js"],e["./shallowCompare.js"],e["./throwWrongKeyOnActionCollectionConfig.js"],e["./uniqueId.js"],e["./uniqueSymbol.js"],e["./useStableState.js"]);
|
package/createContext.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e,t;e=this,t=(e,t,r,o,n)=>(()=>{"use strict";var a={564:(e,t,r)=>{function o(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 o,n,a,i,u=[],s=!0,l=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(o=a.call(r)).done)&&(u.push(o.value),u.length!==t);s=!0);}catch(e){l=!0,n=e}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(l)throw n}}return u}}(e,t)||function(e,t){if(e){if("string"==typeof e)return n(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)?n(e,t):void 0}}(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 n(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,o=new Array(t);r<t;r++)o[r]=e[r];return o}Object.defineProperty(t,"__esModule",{value:!0}),t.createContext=void 0;var a=r(156),i=r(352),u=r(122),s=r(538),l=r(503);t.createContext=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=(0,a.createContext)(null),n=function(){var e=(0,a.useContext)(r);if(!e)throw new Error("ContextHook must be used within a ContextProvider");return e()};n.createSelectorHook=function(e,t){return function(){var n=(0,a.useContext)(r);if((0,s.isNil)(n))throw new Error("SelectorHook must be used within a ContextProvider");return o((0,l.useStableState)((function(){return n.createSelectorHook(e,t)}),(function(e){return e.removeSubscriptions()}),[n]),1)[0].value.apply(void 0,arguments)}};var c=function(){var e=(0,a.useContext)(r);if((0,s.isNil)(e))throw new Error("useStateControls must be used within a ContextProvider");return e.stateControls()},f=function(e,t){var o=(0,a.useContext)(r);if((0,s.isNil)(o))throw new Error("useObservableBuilder must be used within a ContextProvider");return o.createObservable(e,t)};return n.stateControls=function(){return[c,f]},[n,function(n){var c=n.children,f=n.value,v=n.ref,d=o((0,l.useStableState)((function(){var r,o=function(){return(0,u.isFunction)(e)?e():e},n=(0,s.isNil)(f)?o():(0,u.isFunction)(f)?f(o()):f,a=new i.GlobalStore(n,Object.assign(Object.assign({},t),{metadata:null!==(r=(0,u.isFunction)(t.metadata)?t.metadata():t.metadata)&&void 0!==r?r:{}})),l=a.getHook();return{store:a,parentHook:l}}),(function(e){var t,r,o,n;e.store.dispose(),null===(r=null===(t=d.value.store.callbacks)||void 0===t?void 0:t.onUnMount)||void 0===r||r.call(t),null===(n=(o=d.value.store).__onUnMountContext)||void 0===n||n.call(o,d.value.store,d.value.parentHook)}),[]),1)[0];return(0,a.useImperativeHandle)(v,(function(){return v?d.value.store.getConfigCallbackParam():{}}),[d.value.store,v]),(0,a.createElement)(r.Provider,{value:d.value.parentHook},c)}]},t.default=t.createContext},352:t=>{t.exports=e},503:e=>{e.exports=t},122:e=>{e.exports=r},538:e=>{e.exports=o},156:e=>{e.exports=n}},i={};return function e(t){var r=i[t];if(void 0!==r)return r.exports;var o=i[t]={exports:{}};return a[t](o,o.exports,e),o.exports}(564)})(),"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./GlobalStore.js"),require("./useStableState.js"),require("json-storage-formatter/isFunction"),require("json-storage-formatter/isNil"),require("react")):"function"==typeof define&&define.amd?define(["./GlobalStore.js","./useStableState.js","json-storage-formatter/isFunction","json-storage-formatter/isNil","react"],t):"object"==typeof exports?exports["react-hooks-global-states"]=t(require("./GlobalStore.js"),require("./useStableState.js"),require("json-storage-formatter/isFunction"),require("json-storage-formatter/isNil"),require("react")):e["react-hooks-global-states"]=t(e["./GlobalStore.js"],e["./useStableState.js"],e["json-storage-formatter/isFunction"],e["json-storage-formatter/isNil"],e.react);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e;e=e=>(()=>{"use strict";var t={362:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createCustomGlobalState=void 0;var a=o(963);t.createCustomGlobalState=function(e){var t=e.onInitialize,o=e.onChange;return function(e){var l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=l.callbacks,r=function(e,t){var o={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(o[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var l=0;for(a=Object.getOwnPropertySymbols(e);l<a.length;l++)t.indexOf(a[l])<0&&Object.prototype.propertyIsEnumerable.call(e,a[l])&&(o[a[l]]=e[a[l]])}return o}(l,["callbacks"]);return(0,a.createGlobalState)(e,Object.assign(Object.assign({},r),{callbacks:Object.assign(Object.assign({},null!=n?n:{}),{onInit:function(e){var o;null==t||t(e,null==r?void 0:r.config),null===(o=null==n?void 0:n.onInit)||void 0===o||o.call(n,e)},onStateChanged:function(e){var t;null==o||o(e,null==r?void 0:r.config),null===(t=null==n?void 0:n.onStateChanged)||void 0===t||t.call(n,e)}})}))}},t.default=t.createCustomGlobalState},963:t=>{t.exports=e}},o={};return function e(a){var l=o[a];if(void 0!==l)return l.exports;var n=o[a]={exports:{}};return t[a](n,n.exports,e),n.exports}(362)})(),"object"==typeof exports&&"object"==typeof module?module.exports=e(require("./createGlobalState.js")):"function"==typeof define&&define.amd?define(["./createGlobalState.js"],e):"object"==typeof exports?exports["react-hooks-global-states"]=e(require("./createGlobalState.js")):this["react-hooks-global-states"]=e(this["./createGlobalState.js"]);
|
package/createGlobalState.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e;e=e=>(()=>{"use strict";var t={196:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createGlobalState=void 0;var r=o(352);t.createGlobalState=function(e,t){return new r.GlobalStore(e,t).getHook()},t.default=t.createGlobalState},352:t=>{t.exports=e}},o={};return function e(r){var a=o[r];if(void 0!==a)return a.exports;var l=o[r]={exports:{}};return t[r](l,l.exports,e),l.exports}(196)})(),"object"==typeof exports&&"object"==typeof module?module.exports=e(require("./GlobalStore.js")):"function"==typeof define&&define.amd?define(["./GlobalStore.js"],e):"object"==typeof exports?exports["react-hooks-global-states"]=e(require("./GlobalStore.js")):this["react-hooks-global-states"]=e(this["./GlobalStore.js"]);
|
package/generateStackHash.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e;e=()=>(()=>{"use strict";var e={};return((e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.generateStackHash=void 0,t.generateStackHash=function(e){if(!e.trim())return"unknown";e=e.replace(/\s/g,"");for(var t=2166136261,o=0;o<e.length;o++)t^=e.charCodeAt(o),t*=16777619,t&=4294967295;return function(e){for(var t="";e>0;)t="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[e%62]+t,e=Math.floor(e/62);return t||"0"}(t>>>0)},t.default=t.generateStackHash})(0,e),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():this["react-hooks-global-states"]=e();
|
package/isRecord.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var o;o=o=>(()=>{"use strict";var t={143:(o,t,e)=>{function r(o){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},r(o)}Object.defineProperty(t,"__esModule",{value:!0}),t.isRecord=void 0;var s=e(538);t.isRecord=function(o){return!(0,s.isNil)(o)&&"object"===r(o)},t.default=t.isRecord},538:t=>{t.exports=o}},e={};return function o(r){var s=e[r];if(void 0!==s)return s.exports;var i=e[r]={exports:{}};return t[r](i,i.exports,o),i.exports}(143)})(),"object"==typeof exports&&"object"==typeof module?module.exports=o(require("json-storage-formatter/isNil")):"function"==typeof define&&define.amd?define(["json-storage-formatter/isNil"],o):"object"==typeof exports?exports["react-hooks-global-states"]=o(require("json-storage-formatter/isNil")):this["react-hooks-global-states"]=o(this["json-storage-formatter/isNil"]);
|
package/package.json
CHANGED
package/shallowCompare.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var r,e;r=this,e=(r,e,t,o)=>(()=>{"use strict";var n={561:(r,e,t)=>{function o(r,e){return function(r){if(Array.isArray(r))return r}(r)||function(r,e){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var o,n,i,a,s=[],f=!0,u=!1;try{if(i=(t=t.call(r)).next,0===e){if(Object(t)!==t)return;f=!1}else for(;!(f=(o=i.call(t)).done)&&(s.push(o.value),s.length!==e);f=!0);}catch(r){u=!0,n=r}finally{try{if(!f&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(u)throw n}}return s}}(r,e)||i(r,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 n(r,e){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(!t){if(Array.isArray(r)||(t=i(r))||e&&r&&"number"==typeof r.length){t&&(r=t);var o=0,n=function(){};return{s:n,n:function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}},e:function(r){throw r},f:n}}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,s=!0,f=!1;return{s:function(){t=t.call(r)},n:function(){var r=t.next();return s=r.done,r},e:function(r){f=!0,a=r},f:function(){try{s||null==t.return||t.return()}finally{if(f)throw a}}}}function i(r,e){if(r){if("string"==typeof r)return a(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?a(r,e):void 0}}function a(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,o=new Array(e);t<e;t++)o[t]=r[t];return o}function s(r){return s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(r){return typeof r}:function(r){return r&&"function"==typeof Symbol&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},s(r)}Object.defineProperty(e,"__esModule",{value:!0}),e.shallowCompare=void 0;var f=t(834),u=t(266),l=t(538),c=t(664);e.shallowCompare=function(r,e){if(r===e)return!0;var t=s(r),i=s(e);if(t!==i)return!1;if((0,l.isNil)(r)||(0,l.isNil)(e)||(0,f.isPrimitive)(r)&&(0,f.isPrimitive)(e)||(0,u.isDate)(r)&&(0,u.isDate)(e)||"function"===t&&"function"===i)return r===e;if(Array.isArray(r)){var a=r,y=e;if(a.length!==y.length)return!1;for(var m=0;m<a.length;m++)if(a[m]!==y[m])return!1}if(r instanceof Map){var v=r,p=e;if(v.size!==p.size)return!1;var d,b=n(v);try{for(b.s();!(d=b.n()).done;){var h=o(d.value,2),g=h[0];if(h[1]!==p.get(g))return!1}}catch(r){b.e(r)}finally{b.f()}}if(r instanceof Set){var j=r,x=e;if(j.size!==x.size)return!1;var S,w=n(j);try{for(w.s();!(S=w.n()).done;){var A=S.value;if(!x.has(A))return!1}}catch(r){w.e(r)}finally{w.f()}}if(!(0,c.isRecord)(r)||!(0,c.isRecord)(e))return r===e;var q=Object.keys(r),O=Object.keys(e);if(q.length!==O.length)return!1;for(var P=0,D=q;P<D.length;P++){var N=D[P];if(r[N]!==e[N])return!1}return!0},e.default=e.shallowCompare},664:e=>{e.exports=r},266:r=>{r.exports=e},538:r=>{r.exports=t},834:r=>{r.exports=o}},i={};return function r(e){var t=i[e];if(void 0!==t)return t.exports;var o=i[e]={exports:{}};return n[e](o,o.exports,r),o.exports}(561)})(),"object"==typeof exports&&"object"==typeof module?module.exports=e(require("./isRecord.js"),require("json-storage-formatter/isDate"),require("json-storage-formatter/isNil"),require("json-storage-formatter/isPrimitive")):"function"==typeof define&&define.amd?define(["./isRecord.js","json-storage-formatter/isDate","json-storage-formatter/isNil","json-storage-formatter/isPrimitive"],e):"object"==typeof exports?exports["react-hooks-global-states"]=e(require("./isRecord.js"),require("json-storage-formatter/isDate"),require("json-storage-formatter/isNil"),require("json-storage-formatter/isPrimitive")):r["react-hooks-global-states"]=e(r["./isRecord.js"],r["json-storage-formatter/isDate"],r["json-storage-formatter/isNil"],r["json-storage-formatter/isPrimitive"]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var t;t=()=>(()=>{"use strict";var t={};return((t,e)=>{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"))},e.default=e.throwWrongKeyOnActionCollectionConfig})(0,t),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():this["react-hooks-global-states"]=t();
|
package/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e;e=()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0})})(),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():this["react-hooks-global-states"]=e();
|
package/uniqueId.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e;e=()=>(()=>{"use strict";var e={};return((e,t)=>{var o;Object.defineProperty(t,"__esModule",{value:!0}),t.uniqueId=void 0,t.uniqueId=(o=0,function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return o===Number.MAX_SAFE_INTEGER&&(o=0),e+Date.now().toString(36)+(o++).toString(36)}),t.default=t.uniqueId})(0,e),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():this["react-hooks-global-states"]=e();
|
package/uniqueSymbol.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e;e=()=>(()=>{"use strict";var e={};return((e,o)=>{Object.defineProperty(o,"__esModule",{value:!0}),o.uniqueSymbol=void 0,o.uniqueSymbol=Symbol("unique"),o.default=o.uniqueSymbol})(0,e),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():this["react-hooks-global-states"]=e();
|
package/useStableState.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e,r;e=this,r=(e,r,t,n)=>(()=>{"use strict";var o={965:(e,r,t)=>{function n(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(r,"__esModule",{value:!0}),r.useStableState=void 0;var o=t(156),a=t(122),u=t(538),i=t(682),s=t(156),l=t(156);r.useStableState=function(e){var r,t=(0,a.isFunction)(arguments.length<=1?void 0:arguments[1])?arguments.length<=1?void 0:arguments[1]:void 0,c=t?arguments.length<=2?void 0:arguments[2]:arguments.length<=1?void 0:arguments[1],f=(0,o.useRef)({builder:null,cleanup:t,dependencies:c}),p=(0,a.isFunction)(e)?e:function(){return e},d=function(e){if(Array.isArray(e))return e}(r=(0,s.useState)((function(){return{value:p()}})))||function(e){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var t,n,o,a,u=[],i=!0,s=!1;try{for(o=(r=r.call(e)).next;!(i=(t=o.call(r)).done)&&(u.push(t.value),2!==u.length);i=!0);}catch(e){s=!0,n=e}finally{try{if(!i&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(s)throw n}}return u}}(r)||function(e){if(e){if("string"==typeof e)return n(e,2);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)?n(e,2):void 0}}(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.")}(),v=d[0],m=d[1],b=(0,u.isNil)(f.current.builder),y=(0,u.isNil)(c)||!(0,i.shallowCompare)(f.current.dependencies,c);!b&&y&&(v.value=p()),f.current.dependencies=c,f.current.builder=p,f.current.cleanup=t;var h=(0,l.useCallback)((function(){m({value:f.current.builder()})}),[]);return(0,o.useEffect)((function(){return function(){f.current.cleanup&&f.current.cleanup(v.value)}}),[]),[v,h]},r.default=r.useStableState},682:r=>{r.exports=e},122:e=>{e.exports=r},538:e=>{e.exports=t},156:e=>{e.exports=n}},a={};return function e(r){var t=a[r];if(void 0!==t)return t.exports;var n=a[r]={exports:{}};return o[r](n,n.exports,e),n.exports}(965)})(),"object"==typeof exports&&"object"==typeof module?module.exports=r(require("./shallowCompare.js"),require("json-storage-formatter/isFunction"),require("json-storage-formatter/isNil"),require("react")):"function"==typeof define&&define.amd?define(["./shallowCompare.js","json-storage-formatter/isFunction","json-storage-formatter/isNil","react"],r):"object"==typeof exports?exports["react-hooks-global-states"]=r(require("./shallowCompare.js"),require("json-storage-formatter/isFunction"),require("json-storage-formatter/isNil"),require("react")):e["react-hooks-global-states"]=r(e["./shallowCompare.js"],e["json-storage-formatter/isFunction"],e["json-storage-formatter/isNil"],e.react);
|
package/webpack.config.js
CHANGED