import React, { useContext, createContext, useMemo } from "react";
import { useLocalLiveApp } from "../react";
const initialState = [];
export const liveAppContext = createContext({
    state: initialState,
    addLocalManifest: () => { },
    removeLocalManifestById: () => { },
    getLocalLiveAppManifestById: id => id,
});
export function LocalLiveAppProvider({ children, db }) {
    const { state, addLocalManifest, removeLocalManifestById, getLocalLiveAppManifestById } = useLocalLiveApp(db);
    const value = useMemo(() => ({
        state,
        addLocalManifest,
        removeLocalManifestById,
        getLocalLiveAppManifestById,
    }), [state, addLocalManifest, removeLocalManifestById, getLocalLiveAppManifestById]);
    return React.createElement(liveAppContext.Provider, { value: value }, children);
}
export function useLocalLiveAppManifest(appId) {
    const getLocalLiveAppManifestById = useContext(liveAppContext).getLocalLiveAppManifestById;
    return appId ? getLocalLiveAppManifestById(appId) : undefined;
}
export function useLocalLiveAppContext() {
    return useContext(liveAppContext);
}
//# sourceMappingURL=index.js.map