import { useApiClient } from "./useApi.js";
import { c } from "react/compiler-runtime";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
function useMe(n) {
	let i = c(8), a = n === void 0 ? !0 : n, { envKey: s, api: l } = useApiClient(), u;
	i[0] === s ? u = i[1] : (u = ["me", s], i[0] = s, i[1] = u);
	let d;
	i[2] === l ? d = i[3] : (d = () => {
		if (!l) throw Error("API not available");
		return l.ApiV1AuthApi.authControllerMe();
	}, i[2] = l, i[3] = d);
	let f;
	return i[4] !== a || i[5] !== u || i[6] !== d ? (f = {
		queryKey: u,
		queryFn: d,
		select: _temp,
		retry: !1,
		staleTime: 3e5,
		enabled: a
	}, i[4] = a, i[5] = u, i[6] = d, i[7] = f) : f = i[7], useQuery(f);
}
function _temp(e) {
	return e.data;
}
function useGetHealthInfo(n) {
	let i = c(8), a = n === void 0 ? !0 : n, { envKey: o, api: s } = useApiClient(), u;
	i[0] === o ? u = i[1] : (u = ["health", o], i[0] = o, i[1] = u);
	let d;
	i[2] === s ? d = i[3] : (d = () => {
		if (!s) throw Error("API not available");
		return s.ApiV1AuthApi.authControllerGetInfo();
	}, i[2] = s, i[3] = d);
	let f;
	return i[4] !== a || i[5] !== u || i[6] !== d ? (f = {
		queryKey: u,
		queryFn: d,
		select: _temp2,
		staleTime: 3e5,
		enabled: a
	}, i[4] = a, i[5] = u, i[6] = d, i[7] = f) : f = i[7], useQuery(f);
}
function _temp2(e) {
	return e.data;
}
function useWorkerAuth() {
	let r = c(7), { api: a } = useApiClient(), o = useQueryClient(), s;
	r[0] === a ? s = r[1] : (s = (e) => {
		if (!a) throw Error("API not available");
		return a.ApiV1AuthApi.authControllerHubLogin(e);
	}, r[0] = a, r[1] = s);
	let l;
	r[2] === o ? l = r[3] : (l = () => {
		o.invalidateQueries();
	}, r[2] = o, r[3] = l);
	let u;
	return r[4] !== s || r[5] !== l ? (u = {
		mutationFn: s,
		onSuccess: l
	}, r[4] = s, r[5] = l, r[6] = u) : u = r[6], useMutation(u);
}
function useWorkerAuthTokenRefresh() {
	let r = c(7), { api: a } = useApiClient(), o = useQueryClient(), s;
	r[0] === a ? s = r[1] : (s = () => {
		if (!a) throw Error("API not available");
		return a.ApiV1AuthApi.authControllerRefresh();
	}, r[0] = a, r[1] = s);
	let l;
	r[2] === o ? l = r[3] : (l = () => {
		o.invalidateQueries();
	}, r[2] = o, r[3] = l);
	let u;
	return r[4] !== s || r[5] !== l ? (u = {
		mutationFn: s,
		onSuccess: l
	}, r[4] = s, r[5] = l, r[6] = u) : u = r[6], useMutation(u);
}
export { useGetHealthInfo, useMe, useWorkerAuth, useWorkerAuthTokenRefresh };
