import t,{useMemo as e}from"react";import r from"../../../prop-types/index.js";import{ReactReduxContext as n}from"./Context.js";import o from"../utils/Subscription.js";import{useIsomorphicLayoutEffect as i}from"../utils/useIsomorphicLayoutEffect.js";function s(r){var s=r.store,u=r.context,c=r.children,p=e((function(){var t=new o(s);return t.onStateChange=t.notifyNestedSubs,{store:s,subscription:t}}),[s]),a=e((function(){return s.getState()}),[s]);i((function(){var t=p.subscription;return t.trySubscribe(),a!==s.getState()&&t.notifyNestedSubs(),function(){t.tryUnsubscribe(),t.onStateChange=null}}),[p,a]);var f=u||n;return t.createElement(f.Provider,{value:p},c)}"production"!==process.env.NODE_ENV&&(s.propTypes={store:r.shape({subscribe:r.func.isRequired,dispatch:r.func.isRequired,getState:r.func.isRequired}),context:r.object,children:r.any});export default s;
//# sourceMappingURL=Provider.js.map
