{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { 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\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\nvar FooterColumn = function FooterColumn(_ref) {\n  var id = _ref.id,\n      open = _ref.open,\n      title = _ref.title,\n      children = _ref.children,\n      onClick = _ref.onClick;\n  var titleRef = useRef();\n  var columnRef = useRef();\n  var isDesktop = useIsDesktop();\n  useEffect(function () {\n    if (!isDesktop) {\n      var handler = function handler(event) {\n        return onClick(id);\n      };\n\n      titleRef.current.addEventListener('click', handler);\n      return function () {\n        titleRef.current && titleRef.current.removeEventListener('click', handler);\n      };\n    }\n  }, [titleRef.current, isDesktop]);\n  useEffect(function () {\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\nvar Footer = function Footer() {\n  var footerContent = localize(footer, useLang());\n\n  var _useState = useState(''),\n      openedColumn = _useState[0],\n      setOpenedColumn = _useState[1];\n\n  var toggleRow = useCallback(function (id) {\n    setOpenedColumn(function (currentColumn) {\n      return currentColumn == id ? '' : id;\n    });\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(function (item, i) {\n          return /*#__PURE__*/_jsx(\"li\", {\n            children: /*#__PURE__*/_jsx(CustomLink, {\n              href: item.href,\n              children: item.label\n            })\n          }, item.href);\n        })\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(function (item, i) {\n          return /*#__PURE__*/_jsx(\"li\", {\n            children: /*#__PURE__*/_jsx(CustomLink, {\n              href: item.url,\n              children: item.label\n            })\n          }, item.url);\n        })\n      })\n    }), /*#__PURE__*/_jsx(\"ul\", {\n      className: cn(styles.socialLinks),\n      children: footerContent.linksSocial.map(function (item, i) {\n        return 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};\n\nexport default Footer;","map":null,"metadata":{},"sourceType":"module"}