import { jsx as t, jsxs as f } from "react/jsx-runtime";
import { useState as u, useEffect as m } from "react";
import { useParams as d, useLocation as g, Navigate as s, Outlet as h } from "react-router";
import { getComponentByNameIgnoreCase as v } from "../embeddable/index.js";
import { IntlProvider as w } from "react-intl";
import { AppContextProvider as C, SettingProvider as I, SettingsConsumer as L } from "@devgateway/wp-react-lib";
import { Provider as y } from "react-redux";
import "semantic-ui-react";
import "../utils/AppMedia.js";
import "./Footer.js";
import "./Header.js";
import { CustomizerWrapper as E } from "./Customizer.js";
import "./Favicon.js";
import "clsx";
import "../utils/semanticUtils.js";
import "./SearchControl.js";
import { Config as P } from "../conf/index.js";
import "./ClassicHeader.js";
import "./FloatingMenuHeader.js";
import * as b from "../translations/en.json.js";
import * as x from "../translations/fr.json.js";
import * as N from "../translations/af.json.js";
import * as O from "../translations/am.json.js";
import { updateIntl as j } from "../lib/react-intl-redux/index.js";
import "immutable";
import { store as e } from "../redux/store.js";
import { withTracker as k } from "../tracker/withGoogleAnalytics.js";
const r = {
  en: b,
  fr: x,
  am: O,
  af: N
}, A = () => {
  const a = d(), p = g(), i = P.DEFAULT_LOCALE, [D, c] = u(!1), o = a.lan, l = p.pathname;
  return m(() => {
    c(!0), process.env.NODE_ENV === "development" && (console.log("----------.env-----------"), console.log(process.env), console.log("----------.env-----------")), typeof window < "u" && window.setTimeout(() => {
      if (window.location.hash) {
        const n = document.getElementById(window.location.hash.substring(1));
        n && n.scrollIntoView({ behavior: "auto", block: "start" });
      }
    }, 2e3);
  }, []), m(() => {
    e.dispatch(j({ locale: o, formats: {}, messages: r[o ?? "en"] }));
  }, [o]), o ? Object.keys(r).includes(o) ? /* @__PURE__ */ t(y, { store: e, children: /* @__PURE__ */ t(w, { locale: o, messages: r[o], children: /* @__PURE__ */ t(C, { getComponent: v, store: e, locale: o, children: /* @__PURE__ */ t(I, { locale: o, changeUUID: null, children: /* @__PURE__ */ f(L, { children: [
    /* @__PURE__ */ t(E, {}),
    /* @__PURE__ */ t(h, {})
  ] }) }) }) }, o) }) : /* @__PURE__ */ t(s, { to: `/${i}${l}`, replace: !0 }) : /* @__PURE__ */ t(s, { to: i, replace: !0 });
}, eo = k(A);
export {
  eo as default
};
