import {
  getCountryByIso2
} from "./chunk-JRTZWK77.js";
import {
  taxRegionsQueryKeys,
  useTaxRegion
} from "./chunk-LYD3C73Z.js";
import {
  queryClient
} from "./chunk-RHKRREUU.js";
import {
  sdk
} from "./chunk-ZBWL72TB.js";

// src/pages/tax-regions/tax-region-detail/breadcrumb.tsx
import { jsx } from "react/jsx-runtime";
var TaxRegionDetailBreadcrumb = (props) => {
  const { id } = props.params || {};
  const { tax_region } = useTaxRegion(id, void 0, {
    initialData: props.data,
    enabled: Boolean(id)
  });
  if (!tax_region) {
    return null;
  }
  return /* @__PURE__ */ jsx("span", { children: getCountryByIso2(tax_region.country_code)?.display_name || tax_region.country_code?.toUpperCase() });
};

// src/pages/tax-regions/tax-region-detail/loader.ts
var taxRegionDetailQuery = (id) => ({
  queryKey: taxRegionsQueryKeys.detail(id),
  queryFn: async () => sdk.admin.taxRegions.$id.query({ $id: id })
});
var taxRegionLoader = async ({ params }) => {
  const id = params.id;
  const query = taxRegionDetailQuery(id);
  return queryClient.ensureQueryData(query);
};

export {
  TaxRegionDetailBreadcrumb,
  taxRegionLoader
};
