@anywayseo/tools 4.2.2 → 5.1.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 (76) 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 +9 -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-At00w6EN.js +9 -0
  29. package/dist/index-B9GEoC68.js +63 -0
  30. package/dist/{index-DAbZBo7_.mjs → index-BCuXOiT9.mjs} +201 -67
  31. package/dist/{index-BPLxhZG_.js → index-BHfpWNqh.js} +183 -73
  32. package/dist/{index-DF_u_tzx.js → index-BIdYBT1G.js} +7 -3
  33. package/dist/{index-MpNfBHkQ.mjs → index-BJRvnR8Q.mjs} +1 -5
  34. package/dist/index-BRVKhbs6.mjs +6 -0
  35. package/dist/index-BmaWfWLV.mjs +10 -0
  36. package/dist/{index-BV0hDmYP.js → index-BnmGE5_x.js} +3 -2
  37. package/dist/{index-DPO0aIC3.mjs → index-Bu4S7kG8.mjs} +7 -10
  38. package/dist/index-BzbpMLDD.mjs +23 -0
  39. package/dist/{index-DVcQxWMZ.js → index-C6MG_f24.js} +0 -4
  40. package/dist/{index-BE9gNdXx.mjs → index-CACDltm3.mjs} +183 -73
  41. package/dist/index-CYr1ct1t.js +93 -0
  42. package/dist/index-CbuiYkSg.js +5 -0
  43. package/dist/{index-CcsbqDXL.mjs → index-CrmmG8yy.mjs} +7 -3
  44. package/dist/{index-N8nXj4-i.js → index-D0yXUsJz.js} +220 -86
  45. package/dist/{index-DuQjQMNN.js → index-D34TfBTR.js} +7 -10
  46. package/dist/{index-CkTgVjZS.mjs → index-QazOxABc.mjs} +3 -2
  47. package/dist/index-WFgDSB1A.js +22 -0
  48. package/dist/index-cQqALZIW.mjs +94 -0
  49. package/dist/index-tJcccH0B.mjs +64 -0
  50. package/dist/index.cjs +43 -31
  51. package/dist/index.mjs +33 -21
  52. package/dist/providers/index.cjs +4 -2
  53. package/dist/providers/index.d.ts +1 -0
  54. package/dist/providers/index.mjs +5 -3
  55. package/dist/providers/page-provider/index.d.ts +11 -0
  56. package/dist/providers/site-provider/index.d.ts +5 -4
  57. package/dist/types/api/index.d.ts +2 -2
  58. package/dist/types/components/icon/index.d.ts +2 -0
  59. package/dist/types/components/index.d.ts +2 -0
  60. package/dist/types/components/locale-switcher/index.d.ts +5 -0
  61. package/dist/types/components/navigation/index.d.ts +9 -10
  62. package/dist/types/i18n/index.d.ts +7 -1
  63. package/dist/types/site/index.d.ts +15 -13
  64. package/dist/utils/api/index.d.ts +5 -0
  65. package/dist/utils/date/index.d.ts +4 -3
  66. package/dist/utils/index.cjs +23 -16
  67. package/dist/utils/index.d.ts +1 -0
  68. package/dist/utils/index.mjs +16 -9
  69. package/dist/utils/navigation/index.d.ts +2 -2
  70. package/dist/utils/numbers/index.d.ts +3 -3
  71. package/package.json +1 -1
  72. package/dist/components/layout/header/navigation/types.d.ts +0 -4
  73. package/dist/index-BClxYYix.js +0 -40
  74. package/dist/index-BNb-P8a6.mjs +0 -17
  75. package/dist/index-BhsXlbd8.js +0 -16
  76. package/dist/index-Ca_M-II5.mjs +0 -41
@@ -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 { a as useSiteContext, L as Link, u as usePageContext } from "./index-tJcccH0B.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,11 @@ 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 { currentLocale } = usePageContext();
558
+ const locale = currentLocale.code;
559
+ const currency = localization.currency;
558
560
  return /* @__PURE__ */ jsx(
559
561
  Box,
560
562
  {
@@ -573,7 +575,7 @@ const GameInfo = ({ info }) => {
573
575
  return null;
574
576
  }
575
577
  const feature = itemKey;
576
- const value = getGameInfoItemValue(feature, itemValue, currency);
578
+ const value = getGameInfoItemValue(feature, itemValue, locale, currency);
577
579
  return /* @__PURE__ */ jsx(GameInfoItem, { title: t2(`feature.${feature}`), value }, itemKey);
578
580
  })
579
581
  ] }, group)) })
@@ -611,14 +613,15 @@ const Brand$1 = ({ brand }) => {
611
613
  };
612
614
  const Copyright = () => {
613
615
  const { metadata } = useSiteContext();
614
- const { name: siteName } = metadata;
615
616
  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 }) });
617
+ const siteName = metadata.name;
618
+ const lang = metadata.lang;
619
+ return /* @__PURE__ */ jsx(Text, { as: "small", colorScheme: "gray", display: "flex", align: "center", justifyContent: "center", children: t2("copyright", { year: getCurrentYear(lang), siteName }) });
617
620
  };
618
621
  const Disclaimer = () => {
619
622
  const { metadata } = useSiteContext();
620
- const { name: siteName } = metadata;
621
623
  const { t: t2 } = useTranslation("footer");
624
+ const siteName = metadata.name;
622
625
  return /* @__PURE__ */ jsxs(Text, { as: "small", colorScheme: "gray", fontSize: "sm", children: [
623
626
  /* @__PURE__ */ jsx(Text, { as: "span", fontWeight: "bold", color: "red.600", children: t2("disclaimer.title") }),
624
627
  t2("disclaimer.description", { siteName })
@@ -639,29 +642,29 @@ const Navigation$1 = ({ menu }) => {
639
642
  spacing: 4,
640
643
  justifyItems: { base: "flex-start", md: "center" },
641
644
  justifyContent: "space-between",
642
- children: menu.map(({ path, label }, index) => /* @__PURE__ */ jsx(Flex, { as: "li", children: /* @__PURE__ */ jsx(
645
+ children: menu.map(({ slug, label }, index) => /* @__PURE__ */ jsx(Flex, { as: "li", children: /* @__PURE__ */ jsx(
643
646
  Text,
644
647
  {
645
648
  as: Link,
646
- to: path,
649
+ to: slug,
647
650
  fontSize: "md",
648
651
  fontWeight: "semibold",
649
652
  colorScheme: "gray",
650
653
  _hover: { textDecoration: "none", color: "brand.400" },
651
654
  children: label
652
- },
653
- path
655
+ }
654
656
  ) }, index))
655
657
  }
656
658
  );
657
659
  };
658
660
  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;
661
+ var _a, _b;
662
+ const { navigation, config } = useSiteContext();
663
+ const { currentLocale } = usePageContext();
664
+ const menu = navigation.footer[currentLocale.code] ?? [];
665
+ const extra = (_a = config == null ? void 0 : config.footer) == null ? void 0 : _a.extra;
666
+ const showDisclaimer = ((_b = config == null ? void 0 : config.footer) == null ? void 0 : _b.showDisclaimer) ?? true;
667
+ const hasNavigation = !!menu.length;
665
668
  const hasExtra = !!extra;
666
669
  return /* @__PURE__ */ jsx(
667
670
  Box,
@@ -671,7 +674,7 @@ const Footer = () => {
671
674
  color: useColorModeValue("gray.700", "gray.200"),
672
675
  py: 4,
673
676
  children: /* @__PURE__ */ jsxs(Container, { children: [
674
- hasNavigation && /* @__PURE__ */ jsx(Navigation$1, { menu: navigation }),
677
+ hasNavigation && /* @__PURE__ */ jsx(Navigation$1, { menu }),
675
678
  hasExtra && /* @__PURE__ */ jsx(Extra, { children: extra }),
676
679
  showDisclaimer && /* @__PURE__ */ jsx(Disclaimer, {}),
677
680
  /* @__PURE__ */ jsx(Brand$1, { brand: /* @__PURE__ */ jsx(Logo, {}) }),
@@ -683,13 +686,109 @@ const Footer = () => {
683
686
  const Brand = ({ brand }) => {
684
687
  return /* @__PURE__ */ jsx(Link, { to: "/", children: brand });
685
688
  };
686
- const NavLink = forwardRef(({ path, label }, ref) => {
689
+ const FranceIcon = (props) => {
690
+ return /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", width: "1em", height: "1em", ...props, children: [
691
+ /* @__PURE__ */ jsx("mask", { id: "circleFlagsFr0", children: /* @__PURE__ */ jsx("circle", { cx: "256", cy: "256", r: "256", fill: "#fff" }) }),
692
+ /* @__PURE__ */ jsxs("g", { mask: "url(#circleFlagsFr0)", children: [
693
+ /* @__PURE__ */ jsx("path", { fill: "#eee", d: "M167 0h178l25.9 252.3L345 512H167l-29.8-253.4z" }),
694
+ /* @__PURE__ */ jsx("path", { fill: "#0052b4", d: "M0 0h167v512H0z" }),
695
+ /* @__PURE__ */ jsx("path", { fill: "#d80027", d: "M345 0h167v512H345z" })
696
+ ] })
697
+ ] });
698
+ };
699
+ const GermanyIcon = (props) => {
700
+ return /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", width: "1em", height: "1em", ...props, children: [
701
+ /* @__PURE__ */ jsx("mask", { id: "circleFlagsDe0", children: /* @__PURE__ */ jsx("circle", { cx: "256", cy: "256", r: "256", fill: "#fff" }) }),
702
+ /* @__PURE__ */ jsxs("g", { mask: "url(#circleFlagsDe0)", children: [
703
+ /* @__PURE__ */ jsx("path", { fill: "#ffda44", d: "m0 345l256.7-25.5L512 345v167H0z" }),
704
+ /* @__PURE__ */ jsx("path", { fill: "#d80027", d: "m0 167l255-23l257 23v178H0z" }),
705
+ /* @__PURE__ */ jsx("path", { fill: "#333", d: "M0 0h512v167H0z" })
706
+ ] })
707
+ ] });
708
+ };
709
+ const GlobeIcon = (props) => {
710
+ return /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 496", width: "1em", height: "1em", ...props, children: /* @__PURE__ */ jsx(
711
+ "path",
712
+ {
713
+ fill: "currentColor",
714
+ 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"
715
+ }
716
+ ) });
717
+ };
718
+ const ItalyIcon = (props) => {
719
+ return /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", width: "1em", height: "1em", ...props, children: [
720
+ /* @__PURE__ */ jsx("mask", { id: "circleFlagsIt0", children: /* @__PURE__ */ jsx("circle", { cx: "256", cy: "256", r: "256", fill: "#fff" }) }),
721
+ /* @__PURE__ */ jsxs("g", { mask: "url(#circleFlagsIt0)", children: [
722
+ /* @__PURE__ */ jsx("path", { fill: "#eee", d: "M167 0h178l25.9 252.3L345 512H167l-29.8-253.4z" }),
723
+ /* @__PURE__ */ jsx("path", { fill: "#6da544", d: "M0 0h167v512H0z" }),
724
+ /* @__PURE__ */ jsx("path", { fill: "#d80027", d: "M345 0h167v512H345z" })
725
+ ] })
726
+ ] });
727
+ };
728
+ const RussiaIcon = (props) => {
729
+ return /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", width: "1em", height: "1em", ...props, children: [
730
+ /* @__PURE__ */ jsx("mask", { id: "circleFlagsRu0", children: /* @__PURE__ */ jsx("circle", { cx: "256", cy: "256", r: "256", fill: "#fff" }) }),
731
+ /* @__PURE__ */ jsxs("g", { mask: "url(#circleFlagsRu0)", children: [
732
+ /* @__PURE__ */ jsx("path", { fill: "#0052b4", d: "M512 170v172l-256 32L0 342V170l256-32z" }),
733
+ /* @__PURE__ */ jsx("path", { fill: "#eee", d: "M512 0v170H0V0Z" }),
734
+ /* @__PURE__ */ jsx("path", { fill: "#d80027", d: "M512 342v170H0V342Z" })
735
+ ] })
736
+ ] });
737
+ };
738
+ function getMappedIcon(code) {
739
+ let icon = GlobeIcon;
740
+ switch (code) {
741
+ case "de":
742
+ icon = GermanyIcon;
743
+ break;
744
+ case "it":
745
+ icon = ItalyIcon;
746
+ break;
747
+ case "ru":
748
+ icon = RussiaIcon;
749
+ break;
750
+ case "fr":
751
+ icon = FranceIcon;
752
+ break;
753
+ case "en":
754
+ default:
755
+ icon = GlobeIcon;
756
+ break;
757
+ }
758
+ return icon;
759
+ }
760
+ const LocaleSwitcher = ({ currentLocale, locales }) => {
761
+ const localeCode = currentLocale.code;
762
+ const localeIcon = getMappedIcon(localeCode);
763
+ const localeMenuItems = useMemo(
764
+ () => locales.map((locale) => ({ ...locale, icon: getMappedIcon(locale.code) })),
765
+ [locales]
766
+ );
767
+ return /* @__PURE__ */ jsxs(Menu, { placement: "bottom-end", children: [
768
+ /* @__PURE__ */ jsx(
769
+ MenuButton,
770
+ {
771
+ as: Button,
772
+ rightIcon: /* @__PURE__ */ jsx(ChevronDownIcon, {}),
773
+ w: { base: 20, md: "28" },
774
+ px: { base: 1, md: 4 },
775
+ size: { base: "sm", md: "lg" },
776
+ children: /* @__PURE__ */ jsxs(HStack, { children: [
777
+ /* @__PURE__ */ jsx(Icon, { as: localeIcon }),
778
+ /* @__PURE__ */ jsx("span", { children: localeCode.toUpperCase() })
779
+ ] })
780
+ }
781
+ ),
782
+ /* @__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)) })
783
+ ] });
784
+ };
785
+ const NavLink = forwardRef(({ slug, label }, ref) => {
687
786
  return /* @__PURE__ */ jsx(
688
787
  Text,
689
788
  {
690
789
  ref,
691
790
  as: Link,
692
- to: path,
791
+ to: slug,
693
792
  p: 2,
694
793
  fontWeight: "semibold",
695
794
  _hover: { textDecoration: "none", color: "brand.400" },
@@ -698,7 +797,7 @@ const NavLink = forwardRef(({ path, label }, ref) => {
698
797
  );
699
798
  });
700
799
  NavLink.displayName = "NavLink";
701
- const NavList$1 = ({ path, label, children }) => {
800
+ const NavList$1 = ({ slug, label, children }) => {
702
801
  const background = useColorModeValue("white", "gray.800");
703
802
  const backgroundHover = useColorModeValue("brand.50", "gray.900");
704
803
  return /* @__PURE__ */ jsxs(Popover, { trigger: "hover", placement: "bottom-start", children: [
@@ -713,22 +812,37 @@ const NavList$1 = ({ path, label, children }) => {
713
812
  children: label
714
813
  }
715
814
  ) }),
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)) }) })
815
+ /* @__PURE__ */ jsx(
816
+ PopoverContent,
817
+ {
818
+ p: 2,
819
+ border: 0,
820
+ minW: "sm",
821
+ maxH: 300,
822
+ overflowY: "auto",
823
+ rounded: "xl",
824
+ boxShadow: "xl",
825
+ bg: background,
826
+ children: /* @__PURE__ */ jsx(List$1, { spacing: 2, p: 0, children: children == null ? void 0 : children.map((child, index) => {
827
+ 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: [
828
+ /* @__PURE__ */ jsx(Text, { fontWeight: 500, transition: "all .3s ease", _groupHover: { color: "brand.400" }, children: child.label }),
829
+ /* @__PURE__ */ jsx(
830
+ Flex,
831
+ {
832
+ flex: 1,
833
+ justify: "flex-end",
834
+ align: "center",
835
+ opacity: 0,
836
+ transition: "all .3s ease",
837
+ transform: "translateX(-10px)",
838
+ _groupHover: { opacity: 1, transform: "translateX(0)" },
839
+ children: /* @__PURE__ */ jsx(Icon, { as: ChevronRightIcon, color: "brand.400", w: 5, h: 5 })
840
+ }
841
+ )
842
+ ] }) }, index);
843
+ }) })
844
+ }
845
+ )
732
846
  ] });
733
847
  };
734
848
  const DesktopNavigation = ({ menu }) => {
@@ -738,7 +852,7 @@ const DesktopNavigation = ({ menu }) => {
738
852
  }) });
739
853
  };
740
854
  const CHEVRON_DOWN_ICON_SIZE = "1.5rem";
741
- const NavList = ({ path, label, children, isExpanded, onExpand }) => {
855
+ const NavList = ({ slug, label, children, isExpanded, onExpand }) => {
742
856
  return /* @__PURE__ */ jsxs(Stack, { flex: 1, children: [
743
857
  /* @__PURE__ */ jsxs(
744
858
  Flex,
@@ -764,7 +878,19 @@ const NavList = ({ path, label, children, isExpanded, onExpand }) => {
764
878
  ]
765
879
  }
766
880
  ),
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)) }) })
881
+ /* @__PURE__ */ jsx(Collapse, { in: isExpanded, transition: { enter: { ease: "easeIn" }, exit: { duration: 0.2 } }, children: /* @__PURE__ */ jsx(
882
+ List$1,
883
+ {
884
+ ml: 2,
885
+ pl: 0,
886
+ maxH: 300,
887
+ overflowY: "auto",
888
+ borderLeft: 1,
889
+ borderStyle: "solid",
890
+ borderColor: useColorModeValue("gray.200", "gray.700"),
891
+ 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))
892
+ }
893
+ ) })
768
894
  ] });
769
895
  };
770
896
  const CLOSE_ICON_SIZE = "0.75rem";
@@ -819,12 +945,15 @@ const Navigation = ({ menu }) => {
819
945
  ] });
820
946
  };
821
947
  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;
948
+ var _a;
949
+ const { navigation, localization, config } = useSiteContext();
950
+ const { currentLocale } = usePageContext();
951
+ const locales = localization.locales;
952
+ const menu = navigation.header[currentLocale.code] ?? [];
953
+ const toolbar = (_a = config == null ? void 0 : config.header) == null ? void 0 : _a.toolbar;
954
+ const isMultiLanguage = locales.length > 1;
955
+ const hasNavigation = !!menu.length;
956
+ const hasToolbar = !!toolbar || isMultiLanguage;
828
957
  return /* @__PURE__ */ jsx(
829
958
  Box,
830
959
  {
@@ -847,8 +976,11 @@ const Header = () => {
847
976
  align: "center",
848
977
  gap: 2,
849
978
  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 })
979
+ hasNavigation && /* @__PURE__ */ jsx(Flex, { flex: { base: 0, md: 1 }, children: /* @__PURE__ */ jsx(Navigation, { menu }) }),
980
+ hasToolbar && /* @__PURE__ */ jsxs(Flex, { gap: 2, flex: { base: 1, md: 0 }, justifyContent: "flex-end", children: [
981
+ !!toolbar && toolbar,
982
+ isMultiLanguage && /* @__PURE__ */ jsx(LocaleSwitcher, { currentLocale, locales })
983
+ ] })
852
984
  ]
853
985
  }
854
986
  )
@@ -1027,19 +1159,21 @@ function replacePlaceholders(text, placeholders) {
1027
1159
  });
1028
1160
  return text;
1029
1161
  }
1030
- const Seo = ({ children, siteMetadata, title, description, lang }) => {
1031
- const { name: siteName, lang: defaultLang, seo } = siteMetadata;
1162
+ const Seo = ({ children, title, description, lang }) => {
1163
+ const { metadata } = useSiteContext();
1164
+ const { name: siteName, lang: defaultLang, seo } = metadata;
1032
1165
  const { title: defaultTitle, description: defaultDescription } = seo;
1166
+ const siteLang = lang || defaultLang;
1033
1167
  const placeholders = useMemo(
1034
1168
  () => ({
1035
1169
  siteName,
1036
- currentYear: getCurrentYear(),
1037
- currentMonth: getCurrentMonth()
1170
+ currentYear: getCurrentYear(siteLang),
1171
+ currentMonth: getCurrentMonth(siteLang)
1038
1172
  }),
1039
- [siteName]
1173
+ [siteName, siteLang]
1040
1174
  );
1041
1175
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1042
- /* @__PURE__ */ jsx("html", { lang: lang ?? defaultLang }),
1176
+ /* @__PURE__ */ jsx("html", { lang: siteLang }),
1043
1177
  /* @__PURE__ */ jsx("title", { children: title ? typeof title === "string" ? replacePlaceholders(title, placeholders) : title(placeholders) : defaultTitle }),
1044
1178
  /* @__PURE__ */ jsx(
1045
1179
  "meta",