import { getDocumentsCacheKey as e } from "./query-keys.js";
import { useApiClient as t } from "./useApi.js";
import { useQuery as n } from "@tanstack/react-query";
//#region src/hooks/useDocuments.ts
function r(r) {
	let { envKey: i, api: a } = t(), o = {
		filter: JSON.stringify({
			workflowId: r,
			isInvalidated: !1
		}),
		sortBy: JSON.stringify([{
			field: "index",
			order: "ASC"
		}])
	};
	return n({
		queryKey: e(i, r),
		queryFn: () => a.documents.getAll(o),
		select: (e) => e.data,
		enabled: !!r
	});
}
//#endregion
export { r as useFilterDocuments };
