import { getCurrentYear } from "../utils/dates.js";
import { cs } from "../utils/styles.js";
import "../utils/index.js";
import { useStyleConfig } from "../core/theme.js";
import { useDown } from "../core/media.js";
import { styled } from "../core/styled.js";
import { vui } from "../core/vui.js";
import { Box } from "../box/box.js";
import "../box/index.js";
import { T } from "../t/t.js";
import "../t/index.js";
import "../core/index.js";
import { Divider } from "../divider/divider.js";
import "../divider/index.js";
import { Link } from "../link/link.js";
import "../link/index.js";
import menu_default from "../menu/menu.js";
import "../menu/index.js";
import { FooterProvider } from "./context.js";
import footerHeading_default from "./footerHeading.js";
import footerLink_default from "./footerLink.js";
import footerSection_default from "./footerSection.js";
import footerColumn_default from "./footerColumn.js";
import footerRow_default from "./footerRow.js";
import footerColumns_default from "./footerColumns.js";
import footerContent_default from "./footerContent.js";
import footerSlimColumn_default from "./footerSlimColumn.js";
import { FooterTrademark, defaultLinkedInUrl } from "./footerTrademark.js";
import { jsx, jsxs } from "react/jsx-runtime";

//#region src/footer/footer.tsx
const FooterBase = styled.divBox`
  background-color: darkBlue.main;
  color: white;
  padding: 5 3;
`;
const currentYear = getCurrentYear();
/** Branded Veracity Footer with trademark and links sections. Controls max-width of the content. */
const Footer = vui((props, ref) => {
	const { applicationLinks, applicationSocialLinks = [], applicationStaticItems = [], children, className, columns, isApplication = false, isDNV = false, linkedIn, size, variant, isSlim, ...rest } = props;
	const context = {
		size,
		variant
	};
	const styles = useStyleConfig("Footer", props);
	if (isApplication && !applicationLinks) console.error("Footer: isApplication is true but applicationLinks  not set.");
	const slimLinks = [{
		id: "home",
		text: "veracity.com",
		url: "https://www.veracity.com/"
	}];
	columns?.map((column) => {
		column.map((section) => {
			section.links?.map((link) => {
				if (!link) return;
				if ([
					"home",
					"support",
					"status"
				].includes(link.id || "")) slimLinks.push(link);
			});
		});
	});
	const downMd = useDown("md");
	const downLg = useDown("lg");
	return /* @__PURE__ */ jsx(FooterProvider, {
		value: context,
		children: /* @__PURE__ */ jsxs(FooterBase, {
			className: cs("vui-footer", isApplication ? "vui-footer-app" : "", className),
			px: isApplication ? "40px" : 3,
			py: isSlim ? downMd ? "16px" : "9px" : 5,
			role: "contentinfo",
			...styles.container,
			ref,
			...rest,
			children: [
				isApplication && /* @__PURE__ */ jsx(footerContent_default, {
					alignContent: "center",
					alignItems: "center",
					maxW: "100%",
					children: /* @__PURE__ */ jsxs(footerRow_default, {
						alignContent: "space-between",
						w: 1,
						children: [
							/* @__PURE__ */ jsx(Box, {
								alignItems: "self-start",
								columnGap: 3,
								flex: {
									xs: "0 0 100%",
									sm: "0 0 100%",
									md: "0 0 100%",
									lg: "0 0 50%"
								},
								py: {
									xs: 1,
									sm: 1,
									md: 1.25,
									lg: 1.5
								},
								wrap: true,
								children: applicationLinks?.map((link, index) => /* @__PURE__ */ jsxs(Box, {
									flex: {
										xs: "0 0 100%",
										sm: "0 0 auto"
									},
									children: [link.items && /* @__PURE__ */ jsxs(menu_default, {
										isLazy: false,
										offset: [-16, 9],
										placement: "top-start",
										size: "sm",
										...rest,
										children: [/* @__PURE__ */ jsx(menu_default.Button, {
											as: Link,
											className: "vui-footerLink-trigger",
											pt: "3px",
											role: "button",
											text: link.text,
											title: link.text,
											...styles.link,
											...rest
										}), /* @__PURE__ */ jsx(menu_default.List, {
											maxH: 400,
											right: 0,
											w: 320,
											...styles.list,
											children: link.items.map(({ text, url }, index$1) => /* @__PURE__ */ jsx(menu_default.Item, {
												isTruncated: true,
												linkProps: { href: url },
												text,
												title: text,
												...styles.item
											}, index$1))
										})]
									}), !link.items && /* @__PURE__ */ jsx(footerLink_default, {
										...link,
										href: link.url
									})]
								}, index))
							}),
							downLg && /* @__PURE__ */ jsx(Divider, {
								borderColor: "sandstone.main",
								mb: .5,
								mt: 1,
								w: 1
							}),
							/* @__PURE__ */ jsxs(Box, {
								centerV: true,
								columnGap: 3,
								flex: {
									xs: "0 0 100%",
									sm: "0 0 100%",
									md: "0 0 100%",
									lg: "0 0 50%"
								},
								justifyContent: {
									sm: "center",
									lg: "flex-end"
								},
								py: {
									xs: 1,
									sm: 1,
									md: 1.25,
									lg: 1.5
								},
								wrap: true,
								children: [
									applicationStaticItems?.map((text, index) => /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(T, {
										size: "sm",
										children: text
									}) }, index)),
									isDNV ? /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(T, {
										size: "sm",
										children: ["© DNV AS ", currentYear]
									}) }) : /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsxs(T, {
										size: "sm",
										children: [/* @__PURE__ */ jsx(T, {
											fontWeight: "600",
											children: "Veracity by DNV"
										}), ", DNV AS"]
									}) }),
									/* @__PURE__ */ jsxs(Box, { children: [applicationSocialLinks?.map((link, index) => /* @__PURE__ */ jsx(Link, {
										"aria-label": link.text,
										fontWeight: "demi",
										href: link.url,
										iconLeft: /* @__PURE__ */ jsx(Link.Icon, {
											name: `${link.text === "Twitter" ? "brandX" + link.text + "Solid" : "brandCircle" + link.text}`,
											radius: "50%",
											size: "xs"
										}),
										isExternal: true,
										mr: 1,
										size: {
											_: "sm",
											md: "md"
										},
										...styles.link
									}, index)), /* @__PURE__ */ jsx(Link, {
										fontWeight: "demi",
										href: linkedIn ?? defaultLinkedInUrl,
										isExternal: true,
										size: {
											_: "sm",
											md: "md"
										},
										...styles.link,
										children: /* @__PURE__ */ jsx(footerHeading_default, {
											fontSize: "16px",
											mb: 0,
											text: "Follow us"
										})
									})] })
								]
							})
						]
					})
				}),
				!isApplication && isSlim && /* @__PURE__ */ jsx(footerContent_default, {
					alignContent: "center",
					alignItems: "center",
					maxW: {
						xs: 343,
						sm: 305,
						md: 720,
						lg: 975
					},
					children: /* @__PURE__ */ jsxs(footerRow_default, { children: [
						slimLinks.map(({ text, url, id }, index) => {
							/** if the screen is small drop one specific link */
							if (downLg && id === "support") return;
							return /* @__PURE__ */ jsx(footerSlimColumn_default, { children: /* @__PURE__ */ jsx(footerLink_default, {
								href: url,
								text
							}) }, index);
						}),
						downMd && /* @__PURE__ */ jsx(Divider, {
							borderColor: "sandstone.main",
							mb: .5,
							mt: 1,
							w: 1
						}),
						/* @__PURE__ */ jsx(footerSlimColumn_default, {
							centerV: true,
							children: /* @__PURE__ */ jsxs(T, {
								size: "xs",
								children: [/* @__PURE__ */ jsx(T, {
									fontWeight: "demi",
									children: "Veracity by DNV"
								}), ", DNV AS"]
							})
						}),
						/* @__PURE__ */ jsx(footerSlimColumn_default, { children: /* @__PURE__ */ jsx(Link, {
							fontWeight: "demi",
							href: linkedIn ?? defaultLinkedInUrl,
							iconLeft: /* @__PURE__ */ jsx(Link.Icon, {
								mr: 1,
								name: "brandCircleLinkedIn",
								radius: "50%",
								size: "xs"
							}),
							isExternal: true,
							size: {
								_: "sm",
								md: "md"
							},
							...styles.link,
							children: /* @__PURE__ */ jsx(footerHeading_default, {
								fontSize: "16px",
								mb: 0,
								text: "Follow us"
							})
						}) })
					] })
				}),
				!isApplication && !isSlim && /* @__PURE__ */ jsxs(footerContent_default, { children: [
					/* @__PURE__ */ jsx(footerColumns_default, { columns }),
					children || columns ? /* @__PURE__ */ jsx(Divider, {
						borderColor: "sandstone.main",
						my: 4
					}) : null,
					/* @__PURE__ */ jsx(footerRow_default, { children: /* @__PURE__ */ jsx(FooterTrademark, { linkedIn }) })
				] })
			]
		})
	});
});
Footer.Column = footerColumn_default;
Footer.Content = footerContent_default;
Footer.Heading = footerHeading_default;
Footer.Link = footerLink_default;
Footer.Row = footerRow_default;
Footer.Section = footerSection_default;
Footer.displayName = "Footer";
var footer_default = Footer;

//#endregion
export { Footer, FooterBase, footer_default as default };
globalThis.__vuiVersion__ = "4.0.0-beta.1"
//# sourceMappingURL=footer.js.map