import * as React from "react";
//#region src/lib/create-safe-context.ts
/**
* Creates a React context with a companion hook that throws
* if used outside of the context provider.
*
* @param displayName - Component name shown in error messages and React DevTools
* @returns Tuple of [Context, useSafeContext]
*/
function createSafeContext(displayName) {
	const Context = React.createContext(null);
	Context.displayName = displayName;
	function useSafeContext() {
		const ctx = React.useContext(Context);
		if (!ctx) throw new Error(`${displayName} compound components must be used within <${displayName}>`);
		return ctx;
	}
	return [Context, useSafeContext];
}
//#endregion
export { createSafeContext };

//# sourceMappingURL=index21.js.map