'use client';


import { MessageKey } from "./editor/dist/esm/messagesKeys.mjs";
import { useCrossFrameMessageListener } from "./useCrossFrameMessageListener.mjs";
import { useCrossFrameState } from "./useCrossFrameState.mjs";
import { createContext, useContext } from "react";
import { jsx } from "react/jsx-runtime";

//#region ../react-intlayer/dist/esm/@intlayer/editor-react/dist/esm/EditorEnabledContext.mjs
const EditorEnabledContext = createContext({ enabled: false });
const useEditorEnabledState = (options) => useCrossFrameState(MessageKey.INTLAYER_EDITOR_ENABLED, false, options);
const useGetEditorEnabledState = (onEventTriggered) => useCrossFrameMessageListener(`${MessageKey.INTLAYER_EDITOR_ENABLED}/get`, onEventTriggered);
const EditorEnabledProvider = ({ children }) => {
	const [isEnabled] = useEditorEnabledState({
		emit: false,
		receive: true
	});
	return /* @__PURE__ */ jsx(EditorEnabledContext.Provider, {
		value: { enabled: isEnabled },
		children
	});
};
const useEditorEnabled = () => useContext(EditorEnabledContext);

//#endregion
export { EditorEnabledProvider, useEditorEnabled, useGetEditorEnabledState };
//# sourceMappingURL=EditorEnabledContext.mjs.map