import { useApiClient } from "./useApi.js";
import { c } from "react/compiler-runtime";
import { useQuery } from "@tanstack/react-query";
function useFileTree(r, o) {
	let s = c(10), l = o === void 0 ? !0 : o, { envKey: u, api: d } = useApiClient(), f;
	s[0] !== u || s[1] !== r ? (f = [
		"fileTree",
		r,
		u
	], s[0] = u, s[1] = r, s[2] = f) : f = s[2];
	let p;
	s[3] !== d || s[4] !== r ? (p = () => {
		if (!d) throw Error("API not available");
		if (!r) throw Error("Pipeline ID is required");
		return d.ApiV1PipelinesApi.fileControllerGetFileTree({ pipelineId: r });
	}, s[3] = d, s[4] = r, s[5] = p) : p = s[5];
	let m = !!r && l, h;
	return s[6] !== f || s[7] !== p || s[8] !== m ? (h = {
		queryKey: f,
		queryFn: p,
		enabled: m,
		select: _temp,
		staleTime: 3e5,
		refetchOnMount: !1,
		refetchOnWindowFocus: !1,
		placeholderData: _temp2
	}, s[6] = f, s[7] = p, s[8] = m, s[9] = h) : h = s[9], useQuery(h);
}
function _temp2(e) {
	return e;
}
function _temp(e) {
	return e.data;
}
function useFileContent(r, i, a) {
	let o = c(12), l = a === void 0 ? !0 : a, { envKey: u, api: d } = useApiClient(), f;
	o[0] !== u || o[1] !== i || o[2] !== r ? (f = [
		"fileContent",
		r,
		i,
		u
	], o[0] = u, o[1] = i, o[2] = r, o[3] = f) : f = o[3];
	let p;
	o[4] !== d || o[5] !== i || o[6] !== r ? (p = () => {
		if (!d) throw Error("API not available");
		if (!r || !i) throw Error("Pipeline ID and file path are required");
		return d.ApiV1PipelinesApi.fileControllerGetFileContent({
			pipelineId: r,
			filePath: i
		});
	}, o[4] = d, o[5] = i, o[6] = r, o[7] = p) : p = o[7];
	let m = !!r && !!i && l, h;
	return o[8] !== f || o[9] !== p || o[10] !== m ? (h = {
		queryKey: f,
		queryFn: p,
		enabled: m,
		select: _temp3
	}, o[8] = f, o[9] = p, o[10] = m, o[11] = h) : h = o[11], useQuery(h);
}
function _temp3(e) {
	return e.data;
}
export { useFileContent, useFileTree };
