{"ast":null,"code":"import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { jsxs as _jsxs } from \"react/jsx-runtime\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport React from \"react\";\nimport cn from 'classnames';\nimport CustomLink from 'components/customLink/CustomLink';\nimport PlusOrMinus from 'components/gui/PlusOrMinus';\nimport useLang from 'contexts/useLang';\nimport { footer } from 'global/globalData';\nimport { useIsDesktop } from 'hooks/useIsDevice';\nimport HTMLReactParser from 'html-react-parser';\nimport { localize } from 'lib/api';\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nvar MinusSVG = function MinusSVG(props) {\n  return /*#__PURE__*/_jsx(\"svg\", _objectSpread(_objectSpread({}, props), {}, {\n    children: /*#__PURE__*/_jsx(\"path\", {\n      fill: \"#EEE9E2\",\n      d: \"M1 4h8v2H1z\"\n    })\n  }));\n};\n\nMinusSVG.defaultProps = {\n  width: \"10\",\n  height: \"10\",\n  viewBox: \"0 0 10 10\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n};\n\nvar PlusSVG = function PlusSVG(props) {\n  return /*#__PURE__*/_jsx(\"svg\", _objectSpread(_objectSpread({}, props), {}, {\n    children: /*#__PURE__*/_jsx(\"path\", {\n      d: \"M9.54 4.397H6.18V.973H4.1v3.424H.74v1.92H4.1v3.44h2.08v-3.44h3.36v-1.92z\",\n      fill: \"#EEE9E2\"\n    })\n  }));\n};\n\nPlusSVG.defaultProps = {\n  width: \"10\",\n  height: \"10\",\n  viewBox: \"0 0 10 10\",\n  fill: \"none\",\n  xmlns: \"http://www.w3.org/2000/svg\"\n};\nimport styles from './Footer.module.scss';\n\nconst FooterColumn = ({\n  id,\n  open,\n  title,\n  children,\n  onClick\n}) => {\n  const titleRef = useRef();\n  const columnRef = useRef();\n  const isDesktop = useIsDesktop();\n  useEffect(() => {\n    if (!isDesktop) {\n      const handler = event => onClick(id);\n\n      titleRef.current.addEventListener('click', handler);\n      return () => {\n        titleRef.current && titleRef.current.removeEventListener('click', handler);\n      };\n    }\n  }, [titleRef.current, isDesktop]);\n  useEffect(() => {\n    if (!isDesktop) {\n      columnRef.current.style.height = open ? columnRef.current.scrollHeight + 'px' : 0;\n    }\n  }, [open]);\n  return /*#__PURE__*/_jsxs(\"div\", {\n    className: cn(styles.footerColumn, open && styles.open),\n    children: [/*#__PURE__*/_jsxs(\"h5\", {\n      ref: titleRef,\n      className: cn('h--5'),\n      children: [title, /*#__PURE__*/_jsx(PlusOrMinus, {\n        className: cn('mobile-only', styles.icon),\n        plus: !open,\n        color: \"white\",\n        size: \"small\"\n      })]\n    }), /*#__PURE__*/_jsx(\"div\", {\n      ref: columnRef,\n      className: cn(styles.columnContent),\n      children: children\n    })]\n  });\n};\n\nconst Footer = () => {\n  const footerContent = localize(footer, useLang());\n  const {\n    0: openedColumn,\n    1: setOpenedColumn\n  } = useState('');\n  const toggleRow = useCallback(id => {\n    setOpenedColumn(currentColumn => currentColumn == id ? '' : id);\n  }, [openedColumn]);\n  return /*#__PURE__*/_jsxs(\"footer\", {\n    className: styles.footer,\n    children: [/*#__PURE__*/_jsx(FooterColumn, {\n      title: footerContent.addressTitle,\n      id: '0',\n      open: openedColumn == '0',\n      onClick: toggleRow,\n      children: /*#__PURE__*/_jsx(\"p\", {\n        className: cn('p--m'),\n        children: HTMLReactParser(footerContent.address.split('\\n').join('<br/>'))\n      })\n    }), /*#__PURE__*/_jsx(FooterColumn, {\n      title: footerContent.aboutTitle,\n      id: '1',\n      open: openedColumn == '1',\n      onClick: toggleRow,\n      children: /*#__PURE__*/_jsx(\"ul\", {\n        className: cn('p--m'),\n        children: footerContent.linksAbout.map((item, i) => /*#__PURE__*/_jsx(\"li\", {\n          children: /*#__PURE__*/_jsx(CustomLink, {\n            href: item.href,\n            children: item.label\n          })\n        }, item.href))\n      })\n    }), /*#__PURE__*/_jsx(FooterColumn, {\n      title: footerContent.partnersTitle,\n      id: '3',\n      open: openedColumn == '3',\n      onClick: toggleRow,\n      children: /*#__PURE__*/_jsx(\"ul\", {\n        className: cn('p--m'),\n        children: footerContent.linksPartners.map((item, i) => /*#__PURE__*/_jsx(\"li\", {\n          children: /*#__PURE__*/_jsx(CustomLink, {\n            href: item.url,\n            children: item.label\n          })\n        }, item.url))\n      })\n    }), /*#__PURE__*/_jsx(\"ul\", {\n      className: cn(styles.socialLinks),\n      children: footerContent.linksSocial.map((item, i) => item.icon && /*#__PURE__*/_jsx(\"li\", {\n        children: /*#__PURE__*/_jsx(CustomLink, {\n          href: item.url,\n          children: HTMLReactParser(item.icon)\n        })\n      }, item.url))\n    })]\n  });\n};\n\nexport default Footer;","map":null,"metadata":{},"sourceType":"module"}