import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
import * as __WEBPACK_EXTERNAL_MODULE__api_client_index_mjs__ from "../api-client/index.mjs";
const AsyncDataContext = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.createContext)(null);
AsyncDataContext.displayName = 'AsyncDataContext';
const AsyncDataProvider = (props)=>{
    const { value, request, children, ...others } = props;
    const result = (0, __WEBPACK_EXTERNAL_MODULE__api_client_index_mjs__.useRequest)(request, {
        ...others
    });
    if (value) return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(AsyncDataContext.Provider, {
        value: value,
        children: children
    });
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(AsyncDataContext.Provider, {
        value: result,
        children: children
    });
};
const useAsyncData = ()=>(0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(AsyncDataContext);
export { AsyncDataContext, AsyncDataProvider, useAsyncData };
