import { useQueryClient as d } from "../../../../../@tanstack_preact-query@5.95.2_preact@10.29.0/node_modules/@tanstack/preact-query/build/modern/QueryClientProvider.js";
import { useMutation as l } from "../../../../../@tanstack_preact-query@5.95.2_preact@10.29.0/node_modules/@tanstack/preact-query/build/modern/useMutation.js";
import { a as r } from "./useToastContext-C2BAjZxO.js";
import { b as u, h as f } from "./StoreProvider-CBB99upB.js";
try {
  let e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}, t = new e.Error().stack;
  t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "bf4bae1f-7660-4dde-87d7-a59be5eaf593", e._sentryDebugIdIdentifier = "sentry-dbid-bf4bae1f-7660-4dde-87d7-a59be5eaf593");
} catch {
}
const y = async (e, t, n) => f(
  {
    baseUrl: t,
    path: `legalEntities/${e}`
  },
  n
), m = (e) => {
  const { rootLegalEntityId: t, baseUrl: n } = u(), i = r(), o = d();
  return l({
    mutationFn: (a) => y(t.value, n.value, a),
    onSuccess: async (a, s) => {
      a.id === t.value ? await i() : o.setQueryData(["legalEntity", s.id], a);
    },
    ...e
  });
};
export {
  m as u
};
