import { inject, provide } from 'vue'; function createContext(providerComponentName, contextName) { const symbolDescription = typeof providerComponentName === "string" && !contextName ? `${providerComponentName}Context` : contextName; const injectionKey = Symbol(symbolDescription); const injectContext = (fallback) => { const context = inject(injectionKey, fallback); if (context) return context; if (context === null) return context; throw new Error( `Injection \`${injectionKey.toString()}\` not found. Component must be used within ${Array.isArray(providerComponentName) ? `one of the following components: ${providerComponentName.join( ", " )}` : `\`${providerComponentName}\``}` ); }; const provideContext = (contextValue) => { provide(injectionKey, contextValue); return contextValue; }; return [injectContext, provideContext]; } export { createContext as c }; //# sourceMappingURL=createContext.js.map