import _defineProperty from"@babel/runtime/helpers/defineProperty";function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}import{reatomContext,useCreateCtx}from"@reatom/npm-react";import React,{createElement,forwardRef,useContext}from"react";var ProviderWithCtx=function(a){var b=a.children;return React.createElement(reatomContext.Provider,{value:useCreateCtx()},b)};export var withCtx=function(a){return forwardRef(function(b,c){var d=createElement(a,_objectSpread(_objectSpread({},b),{},{ref:c}));return useContext(reatomContext)?d:React.createElement(ProviderWithCtx,null,d)})};
//# sourceMappingURL=withCtx.js.map