try {
	let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
	n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "911887f0-10c2-4847-9535-388421e379b8", e._sentryDebugIdIdentifier = "sentry-dbid-911887f0-10c2-4847-9535-388421e379b8");
} catch (e) {}
import { r as httpPost, s as useApiContext } from "./http-CHTzpXCd.js";
import { t as useInvalidateRootLegalEntity } from "./invalidateRootLegalEntity-BHyct4ev.js";
import { useMutation, useQueryClient } from "@tanstack/preact-query";
//#region src/api/legalEntity/useUpdateLegalEntity.ts
var updateLegalEntity = async (rootLegalEntityId, baseUrl, data) => {
	return httpPost({
		baseUrl,
		path: `legalEntities/${rootLegalEntityId}`
	}, data);
};
var useUpdateLegalEntity = (options) => {
	const { rootLegalEntityId, baseUrl } = useApiContext();
	const invalidateRootLegalEntity = useInvalidateRootLegalEntity();
	const queryClient = useQueryClient();
	return useMutation({
		mutationFn: (payload) => updateLegalEntity(rootLegalEntityId.value, baseUrl.value, payload),
		onSuccess: async (response, payload) => {
			if (response.id === rootLegalEntityId.value) await invalidateRootLegalEntity();
			else queryClient.setQueryData(["legalEntity", payload.id], response);
		},
		...options
	});
};
//#endregion
export { useUpdateLegalEntity as t };
