import {
  useCurrenciesTableColumns,
  useCurrenciesTableQuery
} from "./chunk-4MNQMTQV.mjs";
import {
  useLocalesTableColumns,
  useLocalesTableQuery
} from "./chunk-6PNOUH6F.mjs";
import "./chunk-DRHDNSJA.mjs";
import {
  StatusCell
} from "./chunk-ADOCJB6L.mjs";
import "./chunk-P3UUX2T6.mjs";
import "./chunk-LQTHYS2Z.mjs";
import {
  _DataTable,
  useDataTable
} from "./chunk-7TWTWTDT.mjs";
import "./chunk-HQKGZADC.mjs";
import "./chunk-EMIHDNB7.mjs";
import "./chunk-XRM7PIRS.mjs";
import {
  SingleColumnPage
} from "./chunk-GIZFNLKK.mjs";
import "./chunk-C76H5USB.mjs";
import "./chunk-3BQAAPDR.mjs";
import {
  useFeatureFlag
} from "./chunk-PJU3RODH.mjs";
import {
  useExtension
} from "./chunk-C5P5PL3E.mjs";
import {
  SingleColumnPageSkeleton
} from "./chunk-LPEUYMRK.mjs";
import {
  ActionMenu
} from "./chunk-OZPB6JBL.mjs";
import "./chunk-OC7BQLYI.mjs";
import "./chunk-S4DMV3ZT.mjs";
import "./chunk-QJ63TWAK.mjs";
import {
  useLocales
} from "./chunk-OW2UL5FI.mjs";
import "./chunk-5DUV4AET.mjs";
import "./chunk-FAB3VINY.mjs";
import "./chunk-Q7YBE4IP.mjs";
import "./chunk-HI6URQ7H.mjs";
import "./chunk-6CLQKVAU.mjs";
import "./chunk-KI7TOXBR.mjs";
import "./chunk-QBIQEVTU.mjs";
import "./chunk-WAXMT4IY.mjs";
import "./chunk-DYDGGABK.mjs";
import {
  useCurrencies
} from "./chunk-LGNTHZ5Y.mjs";
import "./chunk-CN7JXSGW.mjs";
import "./chunk-AO2USOOE.mjs";
import "./chunk-KWWLGCSY.mjs";
import "./chunk-5AFMB7XQ.mjs";
import "./chunk-5U6AZEO7.mjs";
import "./chunk-A63RZVX6.mjs";
import "./chunk-HBXV7ENS.mjs";
import "./chunk-ZBMENGLV.mjs";
import "./chunk-LGLPAUIO.mjs";
import {
  useStockLocation
} from "./chunk-CDORR33H.mjs";
import "./chunk-DE44HCDH.mjs";
import {
  useSalesChannel
} from "./chunk-MUOBXNL6.mjs";
import "./chunk-BEQ5XTWH.mjs";
import {
  useRegion
} from "./chunk-HP2JH45P.mjs";
import {
  retrieveActiveStore,
  storeQueryKeys,
  useStore,
  useUpdateStore
} from "./chunk-VCSSQVPD.mjs";
import {
  usePricePreferences
} from "./chunk-SQDIZZDW.mjs";
import "./chunk-LA2ILUXH.mjs";
import "./chunk-7AXHHXCX.mjs";
import {
  queryClient
} from "./chunk-FXYH54JP.mjs";
import "./chunk-774WSTCC.mjs";
import "./chunk-NFEK63OE.mjs";
import "./chunk-QZ7TP4HQ.mjs";

// src/routes/store/store-detail/loader.ts
var storeDetailQuery = () => ({
  queryKey: storeQueryKeys.details(),
  queryFn: async () => retrieveActiveStore()
});
var storeLoader = async () => {
  const query = storeDetailQuery();
  return queryClient.getQueryData(query.queryKey) ?? await queryClient.fetchQuery(query);
};

// src/routes/store/store-detail/store-detail.tsx
import { useLoaderData } from "react-router-dom";

// src/routes/store/store-detail/components/store-general-section/store-general-section.tsx
import { PencilSquare } from "@medusajs/icons";
import { Badge, Container, Heading, Text } from "@medusajs/ui";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
import { jsx, jsxs } from "react/jsx-runtime";
var StoreGeneralSection = ({ store }) => {
  const { t } = useTranslation();
  const { region } = useRegion(store.default_region_id, void 0, {
    enabled: !!store.default_region_id
  });
  const defaultCurrency = store.supported_currencies?.find((c) => c.is_default);
  const { sales_channel } = useSalesChannel(store.default_sales_channel_id, {
    enabled: !!store.default_sales_channel_id
  });
  const { stock_location } = useStockLocation(
    store.default_location_id,
    {
      fields: "id,name"
    },
    {
      enabled: !!store.default_location_id
    }
  );
  return /* @__PURE__ */ jsxs(Container, { className: "divide-y p-0", children: [
    /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-6 py-4", children: [
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx(Heading, { children: t("store.domain") }),
        /* @__PURE__ */ jsx(Text, { className: "text-ui-fg-subtle", size: "small", children: t("store.manageYourStoresDetails") })
      ] }),
      /* @__PURE__ */ jsx(
        ActionMenu,
        {
          groups: [
            {
              actions: [
                {
                  icon: /* @__PURE__ */ jsx(PencilSquare, {}),
                  label: t("actions.edit"),
                  to: "edit"
                }
              ]
            }
          ]
        }
      )
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle grid grid-cols-2 px-6 py-4", children: [
      /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", weight: "plus", children: t("fields.name") }),
      /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: store.name })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle grid grid-cols-2 px-6 py-4", children: [
      /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", weight: "plus", children: t("store.defaultCurrency") }),
      defaultCurrency ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-x-2", children: [
        /* @__PURE__ */ jsx(Badge, { size: "2xsmall", children: defaultCurrency.currency_code?.toUpperCase() }),
        /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: defaultCurrency.currency?.name })
      ] }) : /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: "-" })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle grid grid-cols-2 px-6 py-4", children: [
      /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", weight: "plus", children: t("store.defaultRegion") }),
      /* @__PURE__ */ jsx("div", { className: "flex items-center gap-x-2", children: region ? /* @__PURE__ */ jsx(Badge, { size: "2xsmall", asChild: true, children: /* @__PURE__ */ jsx(Link, { to: `/settings/regions/${region.id}`, children: region.name }) }) : /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: "-" }) })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle grid grid-cols-2 px-6 py-4", children: [
      /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", weight: "plus", children: t("store.defaultSalesChannel") }),
      /* @__PURE__ */ jsx("div", { className: "flex items-center gap-x-2", children: sales_channel ? /* @__PURE__ */ jsx(Badge, { size: "2xsmall", asChild: true, children: /* @__PURE__ */ jsx(Link, { to: `/settings/sales-channels/${sales_channel.id}`, children: sales_channel.name }) }) : /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: "-" }) })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "text-ui-fg-subtle grid grid-cols-2 px-6 py-4", children: [
      /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", weight: "plus", children: t("store.defaultLocation") }),
      /* @__PURE__ */ jsx("div", { className: "flex items-center gap-x-2", children: stock_location ? /* @__PURE__ */ jsx(Badge, { size: "2xsmall", asChild: true, children: /* @__PURE__ */ jsx(Link, { to: `/settings/locations/${stock_location.id}`, children: stock_location.name }) }) : /* @__PURE__ */ jsx(Text, { size: "small", leading: "compact", children: "-" }) })
    ] })
  ] });
};

// src/routes/store/store-detail/components/store-currency-section/store-currency-section.tsx
import { CheckCircle, Plus, Trash, XCircle } from "@medusajs/icons";
import {
  Checkbox,
  CommandBar,
  Container as Container2,
  Heading as Heading2,
  toast,
  usePrompt
} from "@medusajs/ui";
import { keepPreviousData } from "@tanstack/react-query";
import { createColumnHelper } from "@tanstack/react-table";
import { useMemo, useState } from "react";
import { useTranslation as useTranslation2 } from "react-i18next";
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
var PAGE_SIZE = 10;
var StoreCurrencySection = ({ store }) => {
  const [rowSelection, setRowSelection] = useState({});
  const { searchParams, raw } = useCurrenciesTableQuery({ pageSize: PAGE_SIZE });
  const {
    currencies,
    count,
    isPending: isCurrenciesPending,
    isError: isCurrenciesError,
    error: currenciesError
  } = useCurrencies(
    {
      code: store.supported_currencies?.map((c) => c.currency_code),
      ...searchParams
    },
    {
      placeholderData: keepPreviousData,
      enabled: !!store.supported_currencies?.length
    }
  );
  const {
    price_preferences: pricePreferences,
    isPending: isPricePreferencesPending,
    isError: isPricePreferencesError,
    error: pricePreferencesError
  } = usePricePreferences(
    {
      attribute: "currency_code",
      value: store.supported_currencies?.map((c) => c.currency_code)
    },
    {
      enabled: !!store.supported_currencies?.length
    }
  );
  const columns = useColumns();
  const prefMap = useMemo(() => {
    return new Map(pricePreferences?.map((pref) => [pref.value, pref]));
  }, [pricePreferences]);
  const withTaxInclusivity = currencies?.map((c) => ({
    ...c,
    is_tax_inclusive: prefMap.get(c.code)?.is_tax_inclusive
  }));
  const { table } = useDataTable({
    data: withTaxInclusivity ?? [],
    columns,
    count,
    getRowId: (row) => row.code,
    rowSelection: {
      state: rowSelection,
      updater: setRowSelection
    },
    enablePagination: true,
    enableRowSelection: true,
    pageSize: PAGE_SIZE,
    meta: {
      storeId: store.id,
      supportedCurrencies: store.supported_currencies,
      defaultCurrencyCode: store.supported_currencies?.find((c) => c.is_default)?.currency_code,
      preferencesMap: prefMap
    }
  });
  const { mutateAsync } = useUpdateStore(store.id);
  const { t } = useTranslation2();
  const prompt = usePrompt();
  const handleDeleteCurrencies = async () => {
    const ids = Object.keys(rowSelection);
    const result = await prompt({
      title: t("general.areYouSure"),
      description: t("store.removeCurrencyWarning", {
        count: ids.length
      }),
      confirmText: t("actions.remove"),
      cancelText: t("actions.cancel")
    });
    if (!result) {
      return;
    }
    await mutateAsync(
      {
        supported_currencies: store.supported_currencies?.filter(
          (c) => !ids.includes(c.currency_code)
        ) ?? []
      },
      {
        onSuccess: () => {
          setRowSelection({});
          toast.success(t("store.toast.currenciesRemoved"));
        },
        onError: (e) => {
          toast.error(e.message);
        }
      }
    );
  };
  if (isCurrenciesError) {
    throw currenciesError;
  }
  if (isPricePreferencesError) {
    throw pricePreferencesError;
  }
  const isLoading = isCurrenciesPending || isPricePreferencesPending;
  return /* @__PURE__ */ jsxs2(Container2, { className: "divide-y p-0", children: [
    /* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between px-6 py-4", children: [
      /* @__PURE__ */ jsx2(Heading2, { level: "h2", children: t("store.currencies") }),
      /* @__PURE__ */ jsx2(
        ActionMenu,
        {
          groups: [
            {
              actions: [
                {
                  icon: /* @__PURE__ */ jsx2(Plus, {}),
                  label: t("actions.add"),
                  to: "currencies"
                }
              ]
            }
          ]
        }
      )
    ] }),
    /* @__PURE__ */ jsx2(
      _DataTable,
      {
        orderBy: [
          { key: "name", label: t("fields.name") },
          { key: "code", label: t("fields.code") }
        ],
        search: true,
        pagination: true,
        table,
        pageSize: PAGE_SIZE,
        columns,
        count: !store.supported_currencies?.length ? 0 : count,
        isLoading: !store.supported_currencies?.length ? false : isLoading,
        queryObject: raw
      }
    ),
    /* @__PURE__ */ jsx2(CommandBar, { open: !!Object.keys(rowSelection).length, children: /* @__PURE__ */ jsxs2(CommandBar.Bar, { children: [
      /* @__PURE__ */ jsx2(CommandBar.Value, { children: t("general.countSelected", {
        count: Object.keys(rowSelection).length
      }) }),
      /* @__PURE__ */ jsx2(CommandBar.Seperator, {}),
      /* @__PURE__ */ jsx2(
        CommandBar.Command,
        {
          action: handleDeleteCurrencies,
          shortcut: "r",
          label: t("actions.remove")
        }
      )
    ] }) })
  ] });
};
var CurrencyActions = ({
  storeId,
  currency,
  supportedCurrencies,
  defaultCurrencyCode,
  preferencesMap
}) => {
  const { mutateAsync } = useUpdateStore(storeId);
  const { t } = useTranslation2();
  const prompt = usePrompt();
  const handleRemove = async () => {
    const result = await prompt({
      title: t("general.areYouSure"),
      description: t("store.removeCurrencyWarning", {
        count: 1
      }),
      verificationInstruction: t("general.typeToConfirm"),
      verificationText: currency.name,
      confirmText: t("actions.remove"),
      cancelText: t("actions.cancel")
    });
    if (!result) {
      return;
    }
    await mutateAsync(
      {
        supported_currencies: supportedCurrencies.filter(
          (c) => c.currency_code !== currency.code
        )
      },
      {
        onSuccess: () => {
          toast.success(t("store.toast.currenciesRemoved"));
        },
        onError: (e) => {
          toast.error(e.message);
        }
      }
    );
  };
  const handleToggleTaxInclusivity = async () => {
    await mutateAsync(
      {
        supported_currencies: supportedCurrencies.map((c) => {
          const pref = preferencesMap.get(c.currency_code);
          return {
            ...c,
            is_tax_inclusive: c.currency_code === currency.code ? !pref?.is_tax_inclusive : void 0
          };
        })
      },
      {
        onSuccess: () => {
          toast.success(t("store.toast.updatedTaxInclusivitySuccessfully"));
        },
        onError: (e) => {
          toast.error(e.message);
        }
      }
    );
  };
  return /* @__PURE__ */ jsx2(
    ActionMenu,
    {
      groups: [
        {
          actions: [
            {
              icon: preferencesMap.get(currency.code)?.is_tax_inclusive ? /* @__PURE__ */ jsx2(XCircle, {}) : /* @__PURE__ */ jsx2(CheckCircle, {}),
              label: preferencesMap.get(currency.code)?.is_tax_inclusive ? t("store.disableTaxInclusivePricing") : t("store.enableTaxInclusivePricing"),
              onClick: handleToggleTaxInclusivity
            }
          ]
        },
        {
          actions: [
            {
              icon: /* @__PURE__ */ jsx2(Trash, {}),
              label: t("actions.remove"),
              onClick: handleRemove,
              disabled: currency.code === defaultCurrencyCode
            }
          ]
        }
      ]
    }
  );
};
var columnHelper = createColumnHelper();
var useColumns = () => {
  const base = useCurrenciesTableColumns();
  const { t } = useTranslation2();
  return useMemo(
    () => [
      columnHelper.display({
        id: "select",
        header: ({ table }) => {
          return /* @__PURE__ */ jsx2(
            Checkbox,
            {
              checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
              onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value)
            }
          );
        },
        cell: ({ row }) => {
          return /* @__PURE__ */ jsx2(
            Checkbox,
            {
              checked: row.getIsSelected(),
              onCheckedChange: (value) => row.toggleSelected(!!value),
              onClick: (e) => {
                e.stopPropagation();
              }
            }
          );
        }
      }),
      ...base,
      columnHelper.accessor("is_tax_inclusive", {
        header: t("fields.taxInclusivePricing"),
        cell: ({ getValue }) => {
          const isTaxInclusive = getValue();
          return /* @__PURE__ */ jsx2(StatusCell, { color: isTaxInclusive ? "green" : "grey", children: isTaxInclusive ? t("fields.true") : t("fields.false") });
        }
      }),
      columnHelper.display({
        id: "actions",
        cell: ({ row, table }) => {
          const {
            supportedCurrencies,
            storeId,
            defaultCurrencyCode,
            preferencesMap
          } = table.options.meta;
          return /* @__PURE__ */ jsx2(
            CurrencyActions,
            {
              storeId,
              currency: row.original,
              supportedCurrencies,
              defaultCurrencyCode,
              preferencesMap
            }
          );
        }
      })
    ],
    [base, t]
  );
};

// src/routes/store/store-detail/components/store-locale-section/store-locale-section.tsx
import { Plus as Plus2, Trash as Trash2 } from "@medusajs/icons";
import {
  Checkbox as Checkbox2,
  CommandBar as CommandBar2,
  Container as Container3,
  Heading as Heading3,
  toast as toast2,
  usePrompt as usePrompt2
} from "@medusajs/ui";
import { keepPreviousData as keepPreviousData2 } from "@tanstack/react-query";
import { createColumnHelper as createColumnHelper2 } from "@tanstack/react-table";
import { useMemo as useMemo2, useState as useState2 } from "react";
import { useTranslation as useTranslation3 } from "react-i18next";
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
var PAGE_SIZE2 = 10;
var StoreLocaleSection = ({ store }) => {
  const [rowSelection, setRowSelection] = useState2({});
  const { searchParams, raw } = useLocalesTableQuery({ pageSize: PAGE_SIZE2 });
  const { locales, count, isPending, isError, error } = useLocales(
    {
      code: store.supported_locales?.map((l) => l.locale_code),
      ...searchParams
    },
    {
      placeholderData: keepPreviousData2,
      enabled: !!store.supported_locales?.length
    }
  );
  const columns = useColumns2();
  const { table } = useDataTable({
    data: locales ?? [],
    columns,
    count,
    getRowId: (row) => row.code,
    rowSelection: {
      state: rowSelection,
      updater: setRowSelection
    },
    enablePagination: true,
    enableRowSelection: true,
    pageSize: PAGE_SIZE2,
    meta: {
      storeId: store.id,
      supportedLocales: store.supported_locales
    }
  });
  const { mutateAsync } = useUpdateStore(store.id);
  const { t } = useTranslation3();
  const prompt = usePrompt2();
  const handleDeleteLocales = async () => {
    const ids = Object.keys(rowSelection);
    const result = await prompt({
      title: t("general.areYouSure"),
      description: t("store.removeLocaleWarning", {
        count: ids.length
      }),
      confirmText: t("actions.remove"),
      cancelText: t("actions.cancel")
    });
    if (!result) {
      return;
    }
    await mutateAsync(
      {
        supported_locales: store.supported_locales?.filter(
          (l) => !ids.includes(l.locale_code)
        ) ?? []
      },
      {
        onSuccess: () => {
          setRowSelection({});
          toast2.success(t("store.toast.localesRemoved"));
        },
        onError: (e) => {
          toast2.error(e.message);
        }
      }
    );
  };
  if (isError) {
    throw error;
  }
  const isLoading = isPending;
  return /* @__PURE__ */ jsxs3(Container3, { className: "divide-y p-0", children: [
    /* @__PURE__ */ jsxs3("div", { className: "flex items-center justify-between px-6 py-4", children: [
      /* @__PURE__ */ jsx3(Heading3, { level: "h2", children: t("store.locales") }),
      /* @__PURE__ */ jsx3(
        ActionMenu,
        {
          groups: [
            {
              actions: [
                {
                  icon: /* @__PURE__ */ jsx3(Plus2, {}),
                  label: t("actions.add"),
                  to: "locales"
                }
              ]
            }
          ]
        }
      )
    ] }),
    /* @__PURE__ */ jsx3(
      _DataTable,
      {
        orderBy: [
          { key: "name", label: t("fields.name") },
          { key: "code", label: t("fields.code") }
        ],
        search: true,
        pagination: true,
        table,
        pageSize: PAGE_SIZE2,
        columns,
        count: !store.supported_locales?.length ? 0 : count,
        isLoading: !store.supported_locales?.length ? false : isLoading,
        queryObject: raw
      }
    ),
    /* @__PURE__ */ jsx3(CommandBar2, { open: !!Object.keys(rowSelection).length, children: /* @__PURE__ */ jsxs3(CommandBar2.Bar, { children: [
      /* @__PURE__ */ jsx3(CommandBar2.Value, { children: t("general.countSelected", {
        count: Object.keys(rowSelection).length
      }) }),
      /* @__PURE__ */ jsx3(CommandBar2.Seperator, {}),
      /* @__PURE__ */ jsx3(
        CommandBar2.Command,
        {
          action: handleDeleteLocales,
          shortcut: "r",
          label: t("actions.remove")
        }
      )
    ] }) })
  ] });
};
var LocaleActions = ({
  storeId,
  locale,
  supportedLocales
}) => {
  const { mutateAsync } = useUpdateStore(storeId);
  const { t } = useTranslation3();
  const prompt = usePrompt2();
  const handleRemove = async () => {
    const result = await prompt({
      title: t("general.areYouSure"),
      description: t("store.removeLocaleWarning", {
        count: 1
      }),
      verificationInstruction: t("general.typeToConfirm"),
      verificationText: locale.name,
      confirmText: t("actions.remove"),
      cancelText: t("actions.cancel")
    });
    if (!result) {
      return;
    }
    await mutateAsync(
      {
        supported_locales: supportedLocales.filter(
          (l) => l.locale_code !== locale.code
        )
      },
      {
        onSuccess: () => {
          toast2.success(t("store.toast.localesRemoved"));
        },
        onError: (e) => {
          toast2.error(e.message);
        }
      }
    );
  };
  return /* @__PURE__ */ jsx3(
    ActionMenu,
    {
      groups: [
        {
          actions: [
            {
              icon: /* @__PURE__ */ jsx3(Trash2, {}),
              label: t("actions.remove"),
              onClick: handleRemove
            }
          ]
        }
      ]
    }
  );
};
var columnHelper2 = createColumnHelper2();
var useColumns2 = () => {
  const base = useLocalesTableColumns();
  const { t } = useTranslation3();
  return useMemo2(
    () => [
      columnHelper2.display({
        id: "select",
        header: ({ table }) => {
          return /* @__PURE__ */ jsx3(
            Checkbox2,
            {
              checked: table.getIsSomePageRowsSelected() ? "indeterminate" : table.getIsAllPageRowsSelected(),
              onCheckedChange: (value) => table.toggleAllPageRowsSelected(!!value)
            }
          );
        },
        cell: ({ row }) => {
          return /* @__PURE__ */ jsx3(
            Checkbox2,
            {
              checked: row.getIsSelected(),
              onCheckedChange: (value) => row.toggleSelected(!!value),
              onClick: (e) => {
                e.stopPropagation();
              }
            }
          );
        }
      }),
      ...base,
      columnHelper2.display({
        id: "actions",
        cell: ({ row, table }) => {
          const { supportedLocales, storeId } = table.options.meta;
          return /* @__PURE__ */ jsx3(
            LocaleActions,
            {
              storeId,
              locale: row.original,
              supportedLocales
            }
          );
        }
      })
    ],
    [base, t]
  );
};

// src/routes/store/store-detail/store-detail.tsx
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
var StoreDetail = () => {
  const initialData = useLoaderData();
  const isTranslationsEnabled = useFeatureFlag("translation");
  const { store, isPending, isError, error } = useStore(void 0, {
    initialData
  });
  const { getWidgets } = useExtension();
  if (isPending || !store) {
    return /* @__PURE__ */ jsx4(SingleColumnPageSkeleton, { sections: 2, showJSON: true, showMetadata: true });
  }
  if (isError) {
    throw error;
  }
  return /* @__PURE__ */ jsxs4(
    SingleColumnPage,
    {
      widgets: {
        before: getWidgets("store.details.before"),
        after: getWidgets("store.details.after")
      },
      data: store,
      hasOutlet: true,
      showMetadata: true,
      showJSON: true,
      children: [
        /* @__PURE__ */ jsx4(StoreGeneralSection, { store }),
        /* @__PURE__ */ jsx4(StoreCurrencySection, { store }),
        isTranslationsEnabled && /* @__PURE__ */ jsx4(StoreLocaleSection, { store })
      ]
    }
  );
};
export {
  StoreDetail as Component,
  storeLoader as loader
};
