@anywayseo/tools 4.2.2 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/components/base/index.d.ts +1 -0
  2. package/dist/components/base/link/index.d.ts +2 -0
  3. package/dist/components/base/link/utils.d.ts +1 -0
  4. package/dist/components/game-info/utils.d.ts +2 -2
  5. package/dist/components/index.cjs +3 -1
  6. package/dist/components/index.mjs +3 -1
  7. package/dist/components/layout/header/locale-switcher/icons/earth/index.d.ts +2 -0
  8. package/dist/components/layout/header/locale-switcher/icons/france/index.d.ts +2 -0
  9. package/dist/components/layout/header/locale-switcher/icons/germany/index.d.ts +2 -0
  10. package/dist/components/layout/header/locale-switcher/icons/globe/index.d.ts +2 -0
  11. package/dist/components/layout/header/locale-switcher/icons/index.d.ts +6 -0
  12. package/dist/components/layout/header/locale-switcher/icons/italy/index.d.ts +2 -0
  13. package/dist/components/layout/header/locale-switcher/icons/russia/index.d.ts +2 -0
  14. package/dist/components/layout/header/locale-switcher/index.d.ts +8 -0
  15. package/dist/components/layout/header/locale-switcher/utils.d.ts +2 -0
  16. package/dist/components/layout/header/navigation/desktop/index.d.ts +1 -1
  17. package/dist/components/layout/header/navigation/index.d.ts +1 -1
  18. package/dist/components/layout/header/navigation/mobile/index.d.ts +1 -1
  19. package/dist/components/seo/index.d.ts +2 -3
  20. package/dist/hooks/index.cjs +4 -2
  21. package/dist/hooks/index.d.ts +1 -0
  22. package/dist/hooks/index.mjs +4 -2
  23. package/dist/hooks/use-localization/index.d.ts +6 -0
  24. package/dist/i18n/index.cjs +11 -5
  25. package/dist/i18n/index.d.ts +3 -2
  26. package/dist/i18n/index.mjs +11 -5
  27. package/dist/i18n/resources/fr/index.d.ts +112 -0
  28. package/dist/{index-N8nXj4-i.js → index-3nQCWHPU.js} +219 -86
  29. package/dist/index-At00w6EN.js +9 -0
  30. package/dist/{index-BPLxhZG_.js → index-BHfpWNqh.js} +183 -73
  31. package/dist/{index-MpNfBHkQ.mjs → index-BJRvnR8Q.mjs} +1 -5
  32. package/dist/index-BRVKhbs6.mjs +6 -0
  33. package/dist/index-BmaWfWLV.mjs +10 -0
  34. package/dist/{index-BV0hDmYP.js → index-BnmGE5_x.js} +3 -2
  35. package/dist/{index-DPO0aIC3.mjs → index-Bu4S7kG8.mjs} +7 -10
  36. package/dist/{index-DVcQxWMZ.js → index-C6MG_f24.js} +0 -4
  37. package/dist/{index-BE9gNdXx.mjs → index-CACDltm3.mjs} +183 -73
  38. package/dist/index-CYr1ct1t.js +93 -0
  39. package/dist/index-CbuiYkSg.js +5 -0
  40. package/dist/index-Cc85xj4h.mjs +27 -0
  41. package/dist/index-D1bJmcpz.js +49 -0
  42. package/dist/{index-DuQjQMNN.js → index-D34TfBTR.js} +7 -10
  43. package/dist/{index-CcsbqDXL.mjs → index-DVAydNYV.mjs} +7 -3
  44. package/dist/index-DnvTeCy9.mjs +50 -0
  45. package/dist/index-DqGO34ef.js +26 -0
  46. package/dist/{index-DF_u_tzx.js → index-Dur8aLpm.js} +7 -3
  47. package/dist/{index-CkTgVjZS.mjs → index-QazOxABc.mjs} +3 -2
  48. package/dist/{index-DAbZBo7_.mjs → index-X2ihbchG.mjs} +200 -67
  49. package/dist/index-cQqALZIW.mjs +94 -0
  50. package/dist/index.cjs +41 -31
  51. package/dist/index.mjs +30 -20
  52. package/dist/providers/index.cjs +2 -2
  53. package/dist/providers/index.mjs +2 -2
  54. package/dist/providers/site-provider/index.d.ts +11 -5
  55. package/dist/types/api/index.d.ts +2 -2
  56. package/dist/types/components/icon/index.d.ts +2 -0
  57. package/dist/types/components/index.d.ts +2 -0
  58. package/dist/types/components/locale-switcher/index.d.ts +5 -0
  59. package/dist/types/components/navigation/index.d.ts +9 -10
  60. package/dist/types/i18n/index.d.ts +7 -1
  61. package/dist/types/site/index.d.ts +15 -13
  62. package/dist/utils/api/index.d.ts +5 -0
  63. package/dist/utils/date/index.d.ts +4 -3
  64. package/dist/utils/index.cjs +23 -16
  65. package/dist/utils/index.d.ts +1 -0
  66. package/dist/utils/index.mjs +16 -9
  67. package/dist/utils/navigation/index.d.ts +2 -2
  68. package/dist/utils/numbers/index.d.ts +3 -3
  69. package/package.json +1 -1
  70. package/dist/components/layout/header/navigation/types.d.ts +0 -4
  71. package/dist/index-BClxYYix.js +0 -40
  72. package/dist/index-BNb-P8a6.mjs +0 -17
  73. package/dist/index-BhsXlbd8.js +0 -16
  74. package/dist/index-Ca_M-II5.mjs +0 -41
@@ -1,7 +1,12 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { Text, UnorderedList, OrderedList, Heading, Link } from "@chakra-ui/react";
3
3
  import { MDXProvider } from "@mdx-js/react";
4
- import { Link as Link$1 } from "gatsby";
4
+ import "react";
5
+ import "react-i18next";
6
+ import { L as Link$1 } from "./index-DnvTeCy9.mjs";
7
+ import "./index-BJRvnR8Q.mjs";
8
+ import "./index-CACDltm3.mjs";
9
+ import { i as isRelativePath } from "./index-BmaWfWLV.mjs";
5
10
  function omitProps(props, omittedKeys) {
6
11
  const result = { ...props };
7
12
  omittedKeys.forEach((key) => {
@@ -19,8 +24,7 @@ function renderLink({
19
24
  href,
20
25
  ...props
21
26
  }) {
22
- const isInternalLink = href == null ? void 0 : href.startsWith("/");
23
- return isInternalLink ? /* @__PURE__ */ jsx(Link, { as: Link$1, to: href, color: "brand.400", ...props }) : /* @__PURE__ */ jsx(
27
+ return isRelativePath(href) ? /* @__PURE__ */ jsx(Link, { as: Link$1, to: href, color: "brand.400", ...props }) : /* @__PURE__ */ jsx(
24
28
  Link,
25
29
  {
26
30
  href,
@@ -0,0 +1,50 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useMemo, forwardRef } from "react";
3
+ import { Link as Link$1 } from "gatsby";
4
+ import "@chakra-ui/react";
5
+ import "@mdx-js/react";
6
+ import "react-i18next";
7
+ import "./index-BJRvnR8Q.mjs";
8
+ import "./index-CACDltm3.mjs";
9
+ import { u as useLocalization } from "./index-Cc85xj4h.mjs";
10
+ import { i as isRelativePath } from "./index-BmaWfWLV.mjs";
11
+ const SiteContext = createContext(null);
12
+ const SiteProvider = ({ children, ...context }) => {
13
+ const { currentLocale } = useLocalization(context.localization);
14
+ const value = useMemo(() => {
15
+ return { ...context, localization: { ...context.localization, currentLocale } };
16
+ }, [currentLocale]);
17
+ return /* @__PURE__ */ jsx(SiteContext.Provider, { value, children });
18
+ };
19
+ function useSiteContext() {
20
+ const context = useContext(SiteContext);
21
+ if (!context) {
22
+ throw new Error("useSiteContext must be used within SiteProvider");
23
+ }
24
+ return context;
25
+ }
26
+ function normalizePath(path = "") {
27
+ return path.replace(/^\/+|\/+$/g, "").replace(/\/+/g, "/");
28
+ }
29
+ function getLocalizedPath(path, currentLocaleCode, defaultLocaleCode) {
30
+ const localePrefix = currentLocaleCode === defaultLocaleCode ? "/" : `/${currentLocaleCode}/`;
31
+ if (path === "/") {
32
+ return localePrefix;
33
+ }
34
+ if (isRelativePath(path)) {
35
+ const maybeLocaleCode = path.split("/")[1];
36
+ return maybeLocaleCode === defaultLocaleCode ? "/" : path;
37
+ }
38
+ return `${localePrefix}${normalizePath(path)}`;
39
+ }
40
+ const Link = forwardRef(({ to, ...props }, ref) => {
41
+ const { localization } = useSiteContext();
42
+ const { currentLocale, defaultLocale } = localization;
43
+ const path = getLocalizedPath(to, currentLocale.code, defaultLocale.code);
44
+ return /* @__PURE__ */ jsx(Link$1, { ref, to: path, ...props });
45
+ });
46
+ export {
47
+ Link as L,
48
+ SiteProvider as S,
49
+ useSiteContext as u
50
+ };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ const react = require("react");
3
+ const reactI18next = require("react-i18next");
4
+ function useLocalization({ defaultLocale, locales }) {
5
+ var _a;
6
+ const [currentLocale, setCurrentLocale] = react.useState(defaultLocale);
7
+ const { i18n } = reactI18next.useTranslation();
8
+ const path = ((_a = window == null ? void 0 : window.location) == null ? void 0 : _a.pathname) ?? "";
9
+ react.useEffect(() => {
10
+ if (typeof window === "undefined") {
11
+ return;
12
+ }
13
+ const cleanPath = path.replace(/^\/+|\/+$/g, "");
14
+ const maybeLocaleCode = cleanPath.split("/")[0];
15
+ const maybeLocale = locales.find(({ code }) => code === maybeLocaleCode);
16
+ const locale = maybeLocale ? maybeLocale : defaultLocale;
17
+ if (locale.code !== currentLocale.code) {
18
+ setCurrentLocale(locale);
19
+ }
20
+ if (i18n.language !== locale.code) {
21
+ i18n.changeLanguage(locale.code);
22
+ }
23
+ }, [path]);
24
+ return { currentLocale };
25
+ }
26
+ exports.useLocalization = useLocalization;
@@ -2,7 +2,12 @@
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
3
  const react$1 = require("@chakra-ui/react");
4
4
  const react = require("@mdx-js/react");
5
- const gatsby = require("gatsby");
5
+ require("react");
6
+ require("react-i18next");
7
+ const index$1 = require("./index-D1bJmcpz.js");
8
+ require("./index-C6MG_f24.js");
9
+ require("./index-BHfpWNqh.js");
10
+ const index = require("./index-At00w6EN.js");
6
11
  function omitProps(props, omittedKeys) {
7
12
  const result = { ...props };
8
13
  omittedKeys.forEach((key) => {
@@ -20,8 +25,7 @@ function renderLink({
20
25
  href,
21
26
  ...props
22
27
  }) {
23
- const isInternalLink = href == null ? void 0 : href.startsWith("/");
24
- return isInternalLink ? /* @__PURE__ */ jsxRuntime.jsx(react$1.Link, { as: gatsby.Link, to: href, color: "brand.400", ...props }) : /* @__PURE__ */ jsxRuntime.jsx(
28
+ return index.isRelativePath(href) ? /* @__PURE__ */ jsxRuntime.jsx(react$1.Link, { as: index$1.Link, to: href, color: "brand.400", ...props }) : /* @__PURE__ */ jsxRuntime.jsx(
25
29
  react$1.Link,
26
30
  {
27
31
  href,
@@ -1,6 +1,7 @@
1
1
  import { useColorModeValue } from "@chakra-ui/react";
2
- import { L as LIGHT_THEME_COLOR, D as DARK_THEME_COLOR } from "./index-MpNfBHkQ.mjs";
3
- import "./index-BE9gNdXx.mjs";
2
+ import "./index-BJRvnR8Q.mjs";
3
+ import "./index-CACDltm3.mjs";
4
+ import { L as LIGHT_THEME_COLOR, D as DARK_THEME_COLOR } from "./index-BRVKhbs6.mjs";
4
5
  function usePrimaryColors() {
5
6
  const color = useColorModeValue(LIGHT_THEME_COLOR, DARK_THEME_COLOR);
6
7
  const bgColor = useColorModeValue("brand.500", "brand.200");
@@ -1,15 +1,15 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { Box, Collapse, Text, Button, Flex, Stack, Image, Center as Center$1, SimpleGrid, Link as Link$1, Card, CardHeader, Heading, CardBody, Popover, PopoverTrigger, Portal, PopoverContent, PopoverBody, CardFooter, useToast, useColorModeValue, VStack, FormControl, FormLabel, InputGroup, InputLeftElement, Input, Textarea, Accordion, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, LinkBox, LinkOverlay, IconButton, AbsoluteCenter, Spinner, useDisclosure, Divider, Circle, Container as Container$1, List as List$1, ListItem, Icon, ListIcon, TableContainer, Table as Table$1, Thead, Tr, Th, Tbody, Td, TableCaption, Tabs as Tabs$1, TabList, Tab, TabPanels, TabPanel } from "@chakra-ui/react";
2
+ import { Box, Collapse, Text, Button, Flex, Stack, Image, Center as Center$1, SimpleGrid, Link as Link$1, Card, CardHeader, Heading, CardBody, Popover, PopoverTrigger, Portal, PopoverContent, PopoverBody, CardFooter, useToast, useColorModeValue, VStack, FormControl, FormLabel, InputGroup, InputLeftElement, Input, Textarea, Accordion, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, LinkBox, LinkOverlay, IconButton, AbsoluteCenter, Spinner, useDisclosure, Divider, Circle, Container as Container$1, Menu, MenuButton, HStack, Icon, MenuList, MenuItem, List as List$1, ListItem, ListIcon, TableContainer, Table as Table$1, Thead, Tr, Th, Tbody, Td, TableCaption, Tabs as Tabs$1, TabList, Tab, TabPanels, TabPanel } from "@chakra-ui/react";
3
3
  import { useTranslation } from "react-i18next";
4
- import { Link } from "gatsby";
5
- import { A as Animation } from "./index-MpNfBHkQ.mjs";
6
- import { a as GameCharacteristic } from "./index-BE9gNdXx.mjs";
4
+ import { u as useSiteContext, L as Link } from "./index-DnvTeCy9.mjs";
5
+ import { useRef, useState, useLayoutEffect, Fragment as Fragment$1, useMemo, forwardRef, useEffect } from "react";
6
+ import { A as Animation } from "./index-BJRvnR8Q.mjs";
7
+ import { a as GameCharacteristic } from "./index-CACDltm3.mjs";
7
8
  import { useMDXComponents } from "@mdx-js/react";
8
- import { u as useSiteContext } from "./index-BNb-P8a6.mjs";
9
- import { useRef, useState, useLayoutEffect, Fragment as Fragment$1, forwardRef, useEffect, useMemo } from "react";
10
- import { EmailIcon, StarIcon, CloseIcon, ViewOffIcon, ViewIcon, ChevronRightIcon, ChevronDownIcon, HamburgerIcon, ChevronUpIcon, WarningIcon, CheckCircleIcon } from "@chakra-ui/icons";
11
- import { e as getSeededRandomComparator, d as randomComparator, b as formatNumber, c as getCurrencySymbol, f as formatDate, g as getCurrentYear, a as getCurrentMonth } from "./index-DPO0aIC3.mjs";
12
- import { u as usePrimaryColors } from "./index-CkTgVjZS.mjs";
9
+ import { EmailIcon, StarIcon, CloseIcon, ViewOffIcon, ViewIcon, ChevronDownIcon, ChevronRightIcon, HamburgerIcon, ChevronUpIcon, WarningIcon, CheckCircleIcon } from "@chakra-ui/icons";
10
+ import { e as getSeededRandomComparator, d as randomComparator, b as formatNumber, c as getCurrencySymbol, f as formatDate, g as getCurrentYear, a as getCurrentMonth } from "./index-Bu4S7kG8.mjs";
11
+ import { i as isRelativePath, b as buildPath } from "./index-BmaWfWLV.mjs";
12
+ import { u as usePrimaryColors } from "./index-QazOxABc.mjs";
13
13
  import { t } from "i18next";
14
14
  import Markdown from "react-markdown";
15
15
  const ONE_LINE_HEIGHT = 24;
@@ -80,10 +80,10 @@ const LinkButton = ({
80
80
  ...boxProps
81
81
  }) => {
82
82
  var _a;
83
- const { configs } = useSiteContext();
83
+ const { config } = useSiteContext();
84
84
  const { color, invertedColor } = usePrimaryColors();
85
- const isInvertedColor = (_a = configs == null ? void 0 : configs.theme) == null ? void 0 : _a.isInvertedColor;
86
- const isInternalLink = linkType === "redirect" || (href == null ? void 0 : href.startsWith("/"));
85
+ const isInvertedColor = (_a = config == null ? void 0 : config.theme) == null ? void 0 : _a.isInvertedColor;
86
+ const isInternalLink = linkType === "redirect" || isRelativePath(href);
87
87
  const LinkComponent = isInternalLink ? Link : Link$1;
88
88
  const hrefKey = isInternalLink ? "to" : "href";
89
89
  const hrefValue = linkType === "redirect" ? `/follow?to=${href}` : href;
@@ -515,7 +515,7 @@ function stringifyArray(array) {
515
515
  function stringifyLanguageArray(languages) {
516
516
  return languages.length > VISIBLE_LANGUAGE_NUMBER ? `${stringifyArray(languages.slice(0, VISIBLE_LANGUAGE_NUMBER))}, +${languages.length - VISIBLE_LANGUAGE_NUMBER}` : stringifyArray(languages);
517
517
  }
518
- function getGameInfoItemValue(key, value, currency) {
518
+ function getGameInfoItemValue(key, value, locale, currency) {
519
519
  let formattedValue = "";
520
520
  if (typeof value !== "string") {
521
521
  if (key === GameCharacteristic.Rtp) {
@@ -525,7 +525,7 @@ function getGameInfoItemValue(key, value, currency) {
525
525
  if (Array.isArray(currency)) {
526
526
  const [primary, ...secondaries] = currency || ["USD"];
527
527
  const primaryValue = formatNumber(value, { currency: primary });
528
- formattedValue = secondaries.length ? `${primaryValue} (${secondaries.map((currency2) => getCurrencySymbol(currency2)).join(", ")})` : primaryValue;
528
+ formattedValue = secondaries.length ? `${primaryValue} (${secondaries.map((currency2) => getCurrencySymbol(currency2, locale)).join(", ")})` : primaryValue;
529
529
  } else {
530
530
  formattedValue = formatNumber(value, { currency });
531
531
  }
@@ -541,7 +541,7 @@ function getGameInfoItemValue(key, value, currency) {
541
541
  }
542
542
  }
543
543
  if (key === GameCharacteristic.ReleaseDate) {
544
- formattedValue = formatDate({ value, options: { year: "numeric", month: "long" } });
544
+ formattedValue = formatDate({ value, locale, options: { year: "numeric", month: "long" } });
545
545
  }
546
546
  if (key === GameCharacteristic.Volatility) {
547
547
  formattedValue = stringifyVolatility(value);
@@ -552,9 +552,10 @@ function getGameInfoItemValue(key, value, currency) {
552
552
  return formattedValue;
553
553
  }
554
554
  const GameInfo = ({ info }) => {
555
- const { metadata } = useSiteContext();
556
- const { currency } = metadata;
557
555
  const { t: t2 } = useTranslation("gameInfo");
556
+ const { localization } = useSiteContext();
557
+ const locale = localization.currentLocale.code;
558
+ const currency = localization.currency;
558
559
  return /* @__PURE__ */ jsx(
559
560
  Box,
560
561
  {
@@ -573,7 +574,7 @@ const GameInfo = ({ info }) => {
573
574
  return null;
574
575
  }
575
576
  const feature = itemKey;
576
- const value = getGameInfoItemValue(feature, itemValue, currency);
577
+ const value = getGameInfoItemValue(feature, itemValue, locale, currency);
577
578
  return /* @__PURE__ */ jsx(GameInfoItem, { title: t2(`feature.${feature}`), value }, itemKey);
578
579
  })
579
580
  ] }, group)) })
@@ -611,14 +612,15 @@ const Brand$1 = ({ brand }) => {
611
612
  };
612
613
  const Copyright = () => {
613
614
  const { metadata } = useSiteContext();
614
- const { name: siteName } = metadata;
615
615
  const { t: t2 } = useTranslation("footer");
616
- return /* @__PURE__ */ jsx(Text, { as: "small", colorScheme: "gray", display: "flex", align: "center", justifyContent: "center", children: t2("copyright", { year: getCurrentYear(), siteName }) });
616
+ const siteName = metadata.name;
617
+ const lang = metadata.lang;
618
+ return /* @__PURE__ */ jsx(Text, { as: "small", colorScheme: "gray", display: "flex", align: "center", justifyContent: "center", children: t2("copyright", { year: getCurrentYear(lang), siteName }) });
617
619
  };
618
620
  const Disclaimer = () => {
619
621
  const { metadata } = useSiteContext();
620
- const { name: siteName } = metadata;
621
622
  const { t: t2 } = useTranslation("footer");
623
+ const siteName = metadata.name;
622
624
  return /* @__PURE__ */ jsxs(Text, { as: "small", colorScheme: "gray", fontSize: "sm", children: [
623
625
  /* @__PURE__ */ jsx(Text, { as: "span", fontWeight: "bold", color: "red.600", children: t2("disclaimer.title") }),
624
626
  t2("disclaimer.description", { siteName })
@@ -639,29 +641,29 @@ const Navigation$1 = ({ menu }) => {
639
641
  spacing: 4,
640
642
  justifyItems: { base: "flex-start", md: "center" },
641
643
  justifyContent: "space-between",
642
- children: menu.map(({ path, label }, index) => /* @__PURE__ */ jsx(Flex, { as: "li", children: /* @__PURE__ */ jsx(
644
+ children: menu.map(({ slug, label }, index) => /* @__PURE__ */ jsx(Flex, { as: "li", children: /* @__PURE__ */ jsx(
643
645
  Text,
644
646
  {
645
647
  as: Link,
646
- to: path,
648
+ to: slug,
647
649
  fontSize: "md",
648
650
  fontWeight: "semibold",
649
651
  colorScheme: "gray",
650
652
  _hover: { textDecoration: "none", color: "brand.400" },
651
653
  children: label
652
- },
653
- path
654
+ }
654
655
  ) }, index))
655
656
  }
656
657
  );
657
658
  };
658
659
  const Footer = () => {
659
- var _a, _b, _c;
660
- const { configs } = useSiteContext();
661
- const navigation = ((_a = configs == null ? void 0 : configs.footer) == null ? void 0 : _a.navigation) ?? [];
662
- const extra = (_b = configs == null ? void 0 : configs.footer) == null ? void 0 : _b.extra;
663
- const showDisclaimer = ((_c = configs == null ? void 0 : configs.footer) == null ? void 0 : _c.showDisclaimer) ?? true;
664
- const hasNavigation = !!navigation.length;
660
+ var _a, _b;
661
+ const { navigation, localization, config } = useSiteContext();
662
+ const currentLocale = localization.currentLocale;
663
+ const menu = navigation.footer[currentLocale.code] ?? [];
664
+ const extra = (_a = config == null ? void 0 : config.footer) == null ? void 0 : _a.extra;
665
+ const showDisclaimer = ((_b = config == null ? void 0 : config.footer) == null ? void 0 : _b.showDisclaimer) ?? true;
666
+ const hasNavigation = !!menu.length;
665
667
  const hasExtra = !!extra;
666
668
  return /* @__PURE__ */ jsx(
667
669
  Box,
@@ -671,7 +673,7 @@ const Footer = () => {
671
673
  color: useColorModeValue("gray.700", "gray.200"),
672
674
  py: 4,
673
675
  children: /* @__PURE__ */ jsxs(Container, { children: [
674
- hasNavigation && /* @__PURE__ */ jsx(Navigation$1, { menu: navigation }),
676
+ hasNavigation && /* @__PURE__ */ jsx(Navigation$1, { menu }),
675
677
  hasExtra && /* @__PURE__ */ jsx(Extra, { children: extra }),
676
678
  showDisclaimer && /* @__PURE__ */ jsx(Disclaimer, {}),
677
679
  /* @__PURE__ */ jsx(Brand$1, { brand: /* @__PURE__ */ jsx(Logo, {}) }),
@@ -683,13 +685,109 @@ const Footer = () => {
683
685
  const Brand = ({ brand }) => {
684
686
  return /* @__PURE__ */ jsx(Link, { to: "/", children: brand });
685
687
  };
686
- const NavLink = forwardRef(({ path, label }, ref) => {
688
+ const FranceIcon = (props) => {
689
+ return /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", width: "1em", height: "1em", ...props, children: [
690
+ /* @__PURE__ */ jsx("mask", { id: "circleFlagsFr0", children: /* @__PURE__ */ jsx("circle", { cx: "256", cy: "256", r: "256", fill: "#fff" }) }),
691
+ /* @__PURE__ */ jsxs("g", { mask: "url(#circleFlagsFr0)", children: [
692
+ /* @__PURE__ */ jsx("path", { fill: "#eee", d: "M167 0h178l25.9 252.3L345 512H167l-29.8-253.4z" }),
693
+ /* @__PURE__ */ jsx("path", { fill: "#0052b4", d: "M0 0h167v512H0z" }),
694
+ /* @__PURE__ */ jsx("path", { fill: "#d80027", d: "M345 0h167v512H345z" })
695
+ ] })
696
+ ] });
697
+ };
698
+ const GermanyIcon = (props) => {
699
+ return /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", width: "1em", height: "1em", ...props, children: [
700
+ /* @__PURE__ */ jsx("mask", { id: "circleFlagsDe0", children: /* @__PURE__ */ jsx("circle", { cx: "256", cy: "256", r: "256", fill: "#fff" }) }),
701
+ /* @__PURE__ */ jsxs("g", { mask: "url(#circleFlagsDe0)", children: [
702
+ /* @__PURE__ */ jsx("path", { fill: "#ffda44", d: "m0 345l256.7-25.5L512 345v167H0z" }),
703
+ /* @__PURE__ */ jsx("path", { fill: "#d80027", d: "m0 167l255-23l257 23v178H0z" }),
704
+ /* @__PURE__ */ jsx("path", { fill: "#333", d: "M0 0h512v167H0z" })
705
+ ] })
706
+ ] });
707
+ };
708
+ const GlobeIcon = (props) => {
709
+ return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 496", width: "1em", height: "1em", ...props, children: /* @__PURE__ */ jsx(
710
+ "path",
711
+ {
712
+ fill: "currentColor",
713
+ d: "M336.5 160C322 70.7 287.8 8 248 8s-74 62.7-88.5 152zM152 256c0 22.2 1.2 43.5 3.3 64h185.3c2.1-20.5 3.3-41.8 3.3-64s-1.2-43.5-3.3-64H155.3c-2.1 20.5-3.3 41.8-3.3 64m324.7-96c-28.6-67.9-86.5-120.4-158-141.6c24.4 33.8 41.2 84.7 50 141.6zM177.2 18.4C105.8 39.6 47.8 92.1 19.3 160h108c8.7-56.9 25.5-107.8 49.9-141.6M487.4 192H372.7c2.1 21 3.3 42.5 3.3 64s-1.2 43-3.3 64h114.6c5.5-20.5 8.6-41.8 8.6-64s-3.1-43.5-8.5-64M120 256c0-21.5 1.2-43 3.3-64H8.6C3.2 212.5 0 233.8 0 256s3.2 43.5 8.6 64h114.6c-2-21-3.2-42.5-3.2-64m39.5 96c14.5 89.3 48.7 152 88.5 152s74-62.7 88.5-152zm159.3 141.6c71.4-21.2 129.4-73.7 158-141.6h-108c-8.8 56.9-25.6 107.8-50 141.6M19.3 352c28.6 67.9 86.5 120.4 158 141.6c-24.4-33.8-41.2-84.7-50-141.6z"
714
+ }
715
+ ) });
716
+ };
717
+ const ItalyIcon = (props) => {
718
+ return /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", width: "1em", height: "1em", ...props, children: [
719
+ /* @__PURE__ */ jsx("mask", { id: "circleFlagsIt0", children: /* @__PURE__ */ jsx("circle", { cx: "256", cy: "256", r: "256", fill: "#fff" }) }),
720
+ /* @__PURE__ */ jsxs("g", { mask: "url(#circleFlagsIt0)", children: [
721
+ /* @__PURE__ */ jsx("path", { fill: "#eee", d: "M167 0h178l25.9 252.3L345 512H167l-29.8-253.4z" }),
722
+ /* @__PURE__ */ jsx("path", { fill: "#6da544", d: "M0 0h167v512H0z" }),
723
+ /* @__PURE__ */ jsx("path", { fill: "#d80027", d: "M345 0h167v512H345z" })
724
+ ] })
725
+ ] });
726
+ };
727
+ const RussiaIcon = (props) => {
728
+ return /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", width: "1em", height: "1em", ...props, children: [
729
+ /* @__PURE__ */ jsx("mask", { id: "circleFlagsRu0", children: /* @__PURE__ */ jsx("circle", { cx: "256", cy: "256", r: "256", fill: "#fff" }) }),
730
+ /* @__PURE__ */ jsxs("g", { mask: "url(#circleFlagsRu0)", children: [
731
+ /* @__PURE__ */ jsx("path", { fill: "#0052b4", d: "M512 170v172l-256 32L0 342V170l256-32z" }),
732
+ /* @__PURE__ */ jsx("path", { fill: "#eee", d: "M512 0v170H0V0Z" }),
733
+ /* @__PURE__ */ jsx("path", { fill: "#d80027", d: "M512 342v170H0V342Z" })
734
+ ] })
735
+ ] });
736
+ };
737
+ function getMappedIcon(code) {
738
+ let icon = GlobeIcon;
739
+ switch (code) {
740
+ case "de":
741
+ icon = GermanyIcon;
742
+ break;
743
+ case "it":
744
+ icon = ItalyIcon;
745
+ break;
746
+ case "ru":
747
+ icon = RussiaIcon;
748
+ break;
749
+ case "fr":
750
+ icon = FranceIcon;
751
+ break;
752
+ case "en":
753
+ default:
754
+ icon = GlobeIcon;
755
+ break;
756
+ }
757
+ return icon;
758
+ }
759
+ const LocaleSwitcher = ({ currentLocale, locales }) => {
760
+ const localeCode = currentLocale.code;
761
+ const localeIcon = getMappedIcon(localeCode);
762
+ const localeMenuItems = useMemo(
763
+ () => locales.map((locale) => ({ ...locale, icon: getMappedIcon(locale.code) })),
764
+ [locales]
765
+ );
766
+ return /* @__PURE__ */ jsxs(Menu, { placement: "bottom-end", children: [
767
+ /* @__PURE__ */ jsx(
768
+ MenuButton,
769
+ {
770
+ as: Button,
771
+ rightIcon: /* @__PURE__ */ jsx(ChevronDownIcon, {}),
772
+ w: { base: 20, md: "28" },
773
+ px: { base: 1, md: 4 },
774
+ size: { base: "sm", md: "lg" },
775
+ children: /* @__PURE__ */ jsxs(HStack, { children: [
776
+ /* @__PURE__ */ jsx(Icon, { as: localeIcon }),
777
+ /* @__PURE__ */ jsx("span", { children: localeCode.toUpperCase() })
778
+ ] })
779
+ }
780
+ ),
781
+ /* @__PURE__ */ jsx(MenuList, { minW: "fit-content", children: localeMenuItems.map(({ code, name, icon }) => /* @__PURE__ */ jsx(MenuItem, { as: Link, to: `/${code}`, icon: /* @__PURE__ */ jsx(Icon, { as: icon, w: 4, h: 4 }), children: name }, code)) })
782
+ ] });
783
+ };
784
+ const NavLink = forwardRef(({ slug, label }, ref) => {
687
785
  return /* @__PURE__ */ jsx(
688
786
  Text,
689
787
  {
690
788
  ref,
691
789
  as: Link,
692
- to: path,
790
+ to: slug,
693
791
  p: 2,
694
792
  fontWeight: "semibold",
695
793
  _hover: { textDecoration: "none", color: "brand.400" },
@@ -698,7 +796,7 @@ const NavLink = forwardRef(({ path, label }, ref) => {
698
796
  );
699
797
  });
700
798
  NavLink.displayName = "NavLink";
701
- const NavList$1 = ({ path, label, children }) => {
799
+ const NavList$1 = ({ slug, label, children }) => {
702
800
  const background = useColorModeValue("white", "gray.800");
703
801
  const backgroundHover = useColorModeValue("brand.50", "gray.900");
704
802
  return /* @__PURE__ */ jsxs(Popover, { trigger: "hover", placement: "bottom-start", children: [
@@ -713,22 +811,37 @@ const NavList$1 = ({ path, label, children }) => {
713
811
  children: label
714
812
  }
715
813
  ) }),
716
- /* @__PURE__ */ jsx(PopoverContent, { p: 2, border: 0, minW: "sm", rounded: "xl", boxShadow: "xl", bg: background, children: /* @__PURE__ */ jsx(List$1, { spacing: 2, p: 0, children: children == null ? void 0 : children.map((child, index) => /* @__PURE__ */ jsx(ListItem, { rounded: "md", _hover: { bg: backgroundHover }, children: /* @__PURE__ */ jsxs(Flex, { as: Link, to: `${path}${child.path}`, p: 2, role: "group", children: [
717
- /* @__PURE__ */ jsx(Text, { fontWeight: 500, transition: "all .3s ease", _groupHover: { color: "brand.400" }, children: child.label }),
718
- /* @__PURE__ */ jsx(
719
- Flex,
720
- {
721
- flex: 1,
722
- justify: "flex-end",
723
- align: "center",
724
- opacity: 0,
725
- transition: "all .3s ease",
726
- transform: "translateX(-10px)",
727
- _groupHover: { opacity: 1, transform: "translateX(0)" },
728
- children: /* @__PURE__ */ jsx(Icon, { as: ChevronRightIcon, color: "brand.400", w: 5, h: 5 })
729
- }
730
- )
731
- ] }) }, index)) }) })
814
+ /* @__PURE__ */ jsx(
815
+ PopoverContent,
816
+ {
817
+ p: 2,
818
+ border: 0,
819
+ minW: "sm",
820
+ maxH: 300,
821
+ overflowY: "auto",
822
+ rounded: "xl",
823
+ boxShadow: "xl",
824
+ bg: background,
825
+ children: /* @__PURE__ */ jsx(List$1, { spacing: 2, p: 0, children: children == null ? void 0 : children.map((child, index) => {
826
+ return /* @__PURE__ */ jsx(ListItem, { rounded: "md", _hover: { bg: backgroundHover }, children: /* @__PURE__ */ jsxs(Flex, { as: Link, to: buildPath(child.slug, slug), p: 2, role: "group", children: [
827
+ /* @__PURE__ */ jsx(Text, { fontWeight: 500, transition: "all .3s ease", _groupHover: { color: "brand.400" }, children: child.label }),
828
+ /* @__PURE__ */ jsx(
829
+ Flex,
830
+ {
831
+ flex: 1,
832
+ justify: "flex-end",
833
+ align: "center",
834
+ opacity: 0,
835
+ transition: "all .3s ease",
836
+ transform: "translateX(-10px)",
837
+ _groupHover: { opacity: 1, transform: "translateX(0)" },
838
+ children: /* @__PURE__ */ jsx(Icon, { as: ChevronRightIcon, color: "brand.400", w: 5, h: 5 })
839
+ }
840
+ )
841
+ ] }) }, index);
842
+ }) })
843
+ }
844
+ )
732
845
  ] });
733
846
  };
734
847
  const DesktopNavigation = ({ menu }) => {
@@ -738,7 +851,7 @@ const DesktopNavigation = ({ menu }) => {
738
851
  }) });
739
852
  };
740
853
  const CHEVRON_DOWN_ICON_SIZE = "1.5rem";
741
- const NavList = ({ path, label, children, isExpanded, onExpand }) => {
854
+ const NavList = ({ slug, label, children, isExpanded, onExpand }) => {
742
855
  return /* @__PURE__ */ jsxs(Stack, { flex: 1, children: [
743
856
  /* @__PURE__ */ jsxs(
744
857
  Flex,
@@ -764,7 +877,19 @@ const NavList = ({ path, label, children, isExpanded, onExpand }) => {
764
877
  ]
765
878
  }
766
879
  ),
767
- /* @__PURE__ */ jsx(Collapse, { in: isExpanded, transition: { enter: { ease: "easeIn" }, exit: { duration: 0.2 } }, children: /* @__PURE__ */ jsx(List$1, { ml: 2, pl: 0, borderLeft: 1, borderStyle: "solid", borderColor: useColorModeValue("gray.200", "gray.700"), children: children == null ? void 0 : children.map((child, index) => /* @__PURE__ */ jsx(Flex, { as: "li", role: "listitem", children: /* @__PURE__ */ jsx(Text, { as: Link, to: `${path}${child.path}`, p: 2, fontSize: "sm", children: child.label }) }, index)) }) })
880
+ /* @__PURE__ */ jsx(Collapse, { in: isExpanded, transition: { enter: { ease: "easeIn" }, exit: { duration: 0.2 } }, children: /* @__PURE__ */ jsx(
881
+ List$1,
882
+ {
883
+ ml: 2,
884
+ pl: 0,
885
+ maxH: 300,
886
+ overflowY: "auto",
887
+ borderLeft: 1,
888
+ borderStyle: "solid",
889
+ borderColor: useColorModeValue("gray.200", "gray.700"),
890
+ children: children == null ? void 0 : children.map((child, index) => /* @__PURE__ */ jsx(Flex, { as: "li", role: "listitem", children: /* @__PURE__ */ jsx(Text, { as: Link, to: buildPath(child.slug, slug), p: 2, fontSize: "sm", children: child.label }) }, index))
891
+ }
892
+ ) })
768
893
  ] });
769
894
  };
770
895
  const CLOSE_ICON_SIZE = "0.75rem";
@@ -819,12 +944,15 @@ const Navigation = ({ menu }) => {
819
944
  ] });
820
945
  };
821
946
  const Header = () => {
822
- var _a, _b;
823
- const { configs } = useSiteContext();
824
- const navigation = ((_a = configs == null ? void 0 : configs.header) == null ? void 0 : _a.navigation) ?? [];
825
- const toolbar = (_b = configs == null ? void 0 : configs.header) == null ? void 0 : _b.toolbar;
826
- const hasToolbar = !!toolbar;
827
- const hasNavigation = !!navigation.length;
947
+ var _a;
948
+ const { navigation, localization, config } = useSiteContext();
949
+ const locales = localization.locales;
950
+ const currentLocale = localization.currentLocale;
951
+ const menu = navigation.header[currentLocale.code] ?? [];
952
+ const toolbar = (_a = config == null ? void 0 : config.header) == null ? void 0 : _a.toolbar;
953
+ const isMultiLanguage = locales.length > 1;
954
+ const hasNavigation = !!menu.length;
955
+ const hasToolbar = !!toolbar || isMultiLanguage;
828
956
  return /* @__PURE__ */ jsx(
829
957
  Box,
830
958
  {
@@ -847,8 +975,11 @@ const Header = () => {
847
975
  align: "center",
848
976
  gap: 2,
849
977
  children: [
850
- hasNavigation && /* @__PURE__ */ jsx(Flex, { flex: { base: 0, md: 1 }, children: /* @__PURE__ */ jsx(Navigation, { menu: navigation }) }),
851
- hasToolbar && /* @__PURE__ */ jsx(Flex, { gap: 2, flex: { base: 1, md: 0 }, justifyContent: "flex-end", children: toolbar })
978
+ hasNavigation && /* @__PURE__ */ jsx(Flex, { flex: { base: 0, md: 1 }, children: /* @__PURE__ */ jsx(Navigation, { menu }) }),
979
+ hasToolbar && /* @__PURE__ */ jsxs(Flex, { gap: 2, flex: { base: 1, md: 0 }, justifyContent: "flex-end", children: [
980
+ !!toolbar && toolbar,
981
+ isMultiLanguage && /* @__PURE__ */ jsx(LocaleSwitcher, { currentLocale, locales })
982
+ ] })
852
983
  ]
853
984
  }
854
985
  )
@@ -1027,19 +1158,21 @@ function replacePlaceholders(text, placeholders) {
1027
1158
  });
1028
1159
  return text;
1029
1160
  }
1030
- const Seo = ({ children, siteMetadata, title, description, lang }) => {
1031
- const { name: siteName, lang: defaultLang, seo } = siteMetadata;
1161
+ const Seo = ({ children, title, description, lang }) => {
1162
+ const { metadata } = useSiteContext();
1163
+ const { name: siteName, lang: defaultLang, seo } = metadata;
1032
1164
  const { title: defaultTitle, description: defaultDescription } = seo;
1165
+ const siteLang = lang || defaultLang;
1033
1166
  const placeholders = useMemo(
1034
1167
  () => ({
1035
1168
  siteName,
1036
- currentYear: getCurrentYear(),
1037
- currentMonth: getCurrentMonth()
1169
+ currentYear: getCurrentYear(siteLang),
1170
+ currentMonth: getCurrentMonth(siteLang)
1038
1171
  }),
1039
- [siteName]
1172
+ [siteName, siteLang]
1040
1173
  );
1041
1174
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1042
- /* @__PURE__ */ jsx("html", { lang: lang ?? defaultLang }),
1175
+ /* @__PURE__ */ jsx("html", { lang: siteLang }),
1043
1176
  /* @__PURE__ */ jsx("title", { children: title ? typeof title === "string" ? replacePlaceholders(title, placeholders) : title(placeholders) : defaultTitle }),
1044
1177
  /* @__PURE__ */ jsx(
1045
1178
  "meta",
@@ -0,0 +1,94 @@
1
+ const DUMMY_PAGE_TYPE = "DUMMY";
2
+ const NavigationSlug = {
3
+ HEADER: "header-navigation",
4
+ FOOTER: "footer-navigation"
5
+ };
6
+ function isValidPath(value) {
7
+ return typeof value === "string" && (value === "" || value.startsWith("/"));
8
+ }
9
+ function isValidType(value) {
10
+ return typeof value === "string" && value !== DUMMY_PAGE_TYPE;
11
+ }
12
+ function transformNavItems(items) {
13
+ if (!items || !items.length) {
14
+ return [];
15
+ }
16
+ const transformed = [];
17
+ items.forEach((item) => {
18
+ var _a;
19
+ if (item && item.title && isValidType(item.type) && isValidPath(item.path)) {
20
+ const isNavGroup = (_a = item.items) == null ? void 0 : _a.length;
21
+ transformed.push({
22
+ label: item.title,
23
+ slug: isNavGroup ? "" : item.path.slice(1),
24
+ ...isNavGroup && { children: transformNavItems(item.items) }
25
+ });
26
+ }
27
+ });
28
+ return transformed;
29
+ }
30
+ function transformSiteNavigation(strapiNavigation) {
31
+ const siteNavigation = {
32
+ header: {},
33
+ footer: {}
34
+ };
35
+ if (!strapiNavigation) {
36
+ return siteNavigation;
37
+ }
38
+ const groups = strapiNavigation.items;
39
+ for (const group of groups ?? []) {
40
+ const { slug, locale, items } = group ?? {};
41
+ if (locale && slug === NavigationSlug.HEADER) {
42
+ siteNavigation.header[locale] = transformNavItems(items ?? []);
43
+ }
44
+ if (locale && slug === NavigationSlug.FOOTER) {
45
+ siteNavigation.footer[locale] = transformNavItems(items ?? []);
46
+ }
47
+ }
48
+ return siteNavigation;
49
+ }
50
+ function getNavigation(fallback, strapiNavigation) {
51
+ const siteNavigation = {
52
+ header: fallback.header,
53
+ footer: fallback.footer
54
+ };
55
+ if (!strapiNavigation) {
56
+ return siteNavigation;
57
+ }
58
+ const navigation = transformSiteNavigation(strapiNavigation);
59
+ siteNavigation.header = { ...siteNavigation.header, ...navigation.header };
60
+ siteNavigation.footer = { ...siteNavigation.footer, ...navigation.footer };
61
+ return siteNavigation;
62
+ }
63
+ function getSiteName(url) {
64
+ if (!url) {
65
+ return "";
66
+ }
67
+ return url.replace(/^https?:\/\//, "");
68
+ }
69
+ function getLocale(defaultLocaleCode, locales) {
70
+ let locale = { code: "en", name: "Default" };
71
+ if (defaultLocaleCode && (locales == null ? void 0 : locales.length)) {
72
+ const foundLocale = locales.find(({ code }) => code === defaultLocaleCode);
73
+ if (foundLocale) {
74
+ locale = foundLocale;
75
+ }
76
+ }
77
+ return locale;
78
+ }
79
+ function getLocales(defaultLocaleCode, locales) {
80
+ if (!locales) {
81
+ return [];
82
+ }
83
+ return [...locales].sort((a, b) => {
84
+ if (a.code === defaultLocaleCode) return -1;
85
+ if (b.code === defaultLocaleCode) return 1;
86
+ return 0;
87
+ });
88
+ }
89
+ export {
90
+ getSiteName as a,
91
+ getLocale as b,
92
+ getLocales as c,
93
+ getNavigation as g
94
+ };