//#region src/extensions/sdk/lazy.ts
/**
* Lazy dynamic import helpers for extension entrypoints.
*/
function lazyModule(loader) {
	let cached;
	let loading;
	return async () => {
		if (cached) return cached;
		if (!loading) loading = loader().then((module) => {
			cached = module;
			loading = void 0;
			return module;
		});
		return loading;
	};
}
function lazyFunction(loader, selector) {
	const load = lazyModule(loader);
	return async (...args) => {
		return selector(await load())(...args);
	};
}
//#endregion
export { lazyFunction, lazyModule };

//# sourceMappingURL=lazy.js.map