import { useApiClient } from "./useApi.js";
import { c } from "react/compiler-runtime";
import { useQuery } from "@tanstack/react-query";
function getNamespacesByPipelineCacheKey(e, i) {
	return [
		"namespaces",
		e,
		i
	];
}
function useFilterNamespaces(a) {
	let o = c(14), { envKey: s, api: l } = useApiClient(), u;
	o[0] === a ? u = o[1] : (u = JSON.stringify({ pipelineId: a }), o[0] = a, o[1] = u);
	let d;
	o[2] === u ? d = o[3] : (d = { filter: u }, o[2] = u, o[3] = d);
	let f = d, p;
	o[4] !== s || o[5] !== a ? (p = getNamespacesByPipelineCacheKey(s, a), o[4] = s, o[5] = a, o[6] = p) : p = o[6];
	let m;
	o[7] !== l || o[8] !== f ? (m = () => {
		if (!l) throw Error("API not available");
		return l.ApiV1NamespacesApi.namespaceControllerGetWorkflows(f);
	}, o[7] = l, o[8] = f, o[9] = m) : m = o[9];
	let h = !!a, g;
	return o[10] !== p || o[11] !== m || o[12] !== h ? (g = {
		queryKey: p,
		queryFn: m,
		enabled: h,
		select: _temp2
	}, o[10] = p, o[11] = m, o[12] = h, o[13] = g) : g = o[13], useQuery(g);
}
function _temp2(e) {
	return e.data.data;
}
export { getNamespacesByPipelineCacheKey, useFilterNamespaces };
