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] = "9b692f08-d0b3-4161-97b3-29412fe2dcfb", e._sentryDebugIdIdentifier = "sentry-dbid-9b692f08-d0b3-4161-97b3-29412fe2dcfb");
} catch (e) {}
import { n as httpGet, r as httpPost, s as useApiContext } from "./http-CHTzpXCd.js";
import { useMutation, useQuery } from "@tanstack/preact-query";
//#region src/api/industryCodes/useIndustryCodes.ts
var fetchIndustryCodes = async (legalEntityId, baseUrl, businessLineTypes, locale) => {
	const results = await Promise.all(businessLineTypes.map((businessLineType) => {
		return httpGet({
			baseUrl,
			path: `legalEntities/${legalEntityId}/businessLines/${businessLineType}/industryCodes?locale=${locale}`
		});
	}));
	const deduped = [];
	for (const result of results) for (const industryCodeDTO of result) if (!deduped.find((item) => item.code === industryCodeDTO.code)) deduped.push(industryCodeDTO);
	return deduped;
};
var useIndustryCodes = (businessLineTypes, locale, options) => {
	const { rootLegalEntityId, baseUrl } = useApiContext();
	return useQuery({
		queryKey: [
			"industryCodes",
			businessLineTypes.join(","),
			locale
		],
		queryFn: () => fetchIndustryCodes(rootLegalEntityId.value, baseUrl.value, businessLineTypes, locale),
		...options
	});
};
//#endregion
//#region src/api/businessLines/useCreateBusinessLine.ts
var createBusinessLine = async (legalEntityId, baseUrl, data) => {
	return httpPost({
		baseUrl,
		path: `legalEntities/${legalEntityId}/businessLines`
	}, data);
};
/**
* @param options additional options passed to Tanstack Query, eg; refetchInterval for polling
*/
var useCreateBusinessLine = (options) => {
	const { rootLegalEntityId, baseUrl } = useApiContext();
	return useMutation({
		mutationFn: (data) => createBusinessLine(rootLegalEntityId.value, baseUrl.value, data),
		...options
	});
};
//#endregion
//#region src/api/businessLines/useUpdateBusinessLines.ts
var updateBusinessLine = async (legalEntityId, baseUrl, data) => {
	return httpPost({
		baseUrl,
		path: `legalEntities/${legalEntityId}/businessLines/${data.id}`
	}, data);
};
/**
* @param options additional options passed to Tanstack Query, eg; refetchInterval for polling
*/
var useUpdateBusinessLine = (options) => {
	const { rootLegalEntityId, baseUrl } = useApiContext();
	return useMutation({
		mutationFn: (data) => updateBusinessLine(rootLegalEntityId.value, baseUrl.value, data),
		...options
	});
};
//#endregion
export { useCreateBusinessLine as n, useIndustryCodes as r, useUpdateBusinessLine as t };
