//#region src/gateway/resolve-channel-connect-defer.ts
/**
* Resolve which channel plugin ids should skip `start()` in phase1 when HTTP lifecycle defer is on.
*/
function resolveChannelConnectDeferSet(params) {
	if (!params.deferChannelConnectUntilAfterHttp) return {
		deferPluginIds: /* @__PURE__ */ new Set(),
		mode: "auto",
		source: "off"
	};
	const gw = params.config.gateway;
	const mode = gw?.channelConnectDeferMode ?? "auto";
	if (mode === "off") return {
		deferPluginIds: /* @__PURE__ */ new Set(),
		mode: "off",
		source: "off"
	};
	if (mode === "explicit") {
		const ids = [...new Set((gw?.channelConnectDeferIds ?? []).map((s) => s.trim()).filter(Boolean))];
		const skip = new Set((gw?.channelConnectDeferSkipIds ?? []).map((s) => s.trim()).filter(Boolean));
		return {
			deferPluginIds: new Set(ids.filter((id) => !skip.has(id))),
			mode: "explicit",
			source: "explicit"
		};
	}
	const metaIds = params.channelManager.listDeferConnectChannelIds(params.config);
	const skip = new Set((gw?.channelConnectDeferSkipIds ?? []).map((s) => s.trim()).filter(Boolean));
	return {
		deferPluginIds: new Set(metaIds.filter((id) => !skip.has(id))),
		mode: "auto",
		source: "meta"
	};
}
//#endregion
export { resolveChannelConnectDeferSet };

//# sourceMappingURL=resolve-channel-connect-defer.js.map