{"version":3,"file":"index.D92hDHa-.js","sources":["../../../../../../../node_modules/@babylon/ui-kit-common/esm/components/others/price-chart/utils/index.mjs","../../../../../../../node_modules/@babylon/ui-kit-common/esm/components/others/price-chart/views/desktop/styled.mjs","../../../../../../../node_modules/@babylon/ui-kit-common/esm/components/others/price-chart/views/desktop/bar-item/index.mjs","../../../../../../../node_modules/@babylon/ui-kit-common/esm/components/others/price-chart/views/desktop/index.mjs"],"sourcesContent":["const getPricesInfo = (items)=>{\n const prices = items.map((item)=>item.price ?? 0);\n const pricesHigherThanZero = prices.filter((item)=>item > 0);\n const cheapestPrice = Math.min(...pricesHigherThanZero);\n const higherPrice = Math.max(...prices);\n const cheapestPointers = [];\n prices.forEach((element, index)=>{\n if (element === cheapestPrice) cheapestPointers.push(index);\n });\n return {\n higherPrice,\n cheapestPointers\n };\n};\nconst getPricesHeightAndCheapest = ({ cheapestPointers, index, price, higherPrice, MAXHEIGHT })=>{\n const isCheapest = cheapestPointers.find((element)=>element === index);\n const cheapestClass = isCheapest ? 'is-cheapest' : '';\n const blockHeight = Math.round(price / higherPrice * MAXHEIGHT);\n return {\n cheapestClass,\n blockHeight\n };\n};\nconst getProduct = (props)=>{\n if (props.searcherDefault && 'config' in props.searcherDefault && props.searcherDefault.config && 'type' in props.searcherDefault.config && typeof props.searcherDefault.config.type === 'string') return props.searcherDefault.config.type.toUpperCase();\n if ('type' in props && typeof props.type === 'string') {\n return props.type.toUpperCase();\n }\n if (props.searcherDefault && 'product' in props.searcherDefault) {\n if (typeof props.searcherDefault?.product === 'string') return props.searcherDefault?.product.toUpperCase();\n }\n return 'FLIGHT';\n};\n\nexport { getPricesHeightAndCheapest, getPricesInfo, getProduct };\n","import { FlexMixin, FontMixin } from '@babylon/ui-kit-styles/common/mixins/helpers.styled';\nimport styled from 'styled-components';\n\nconst PriceChartBox = /*#__PURE__*/ styled.div.withConfig({\n displayName: \"PriceChartBox\",\n componentId: \"sc-71a0b852-0\"\n})([\n ``\n]);\nconst Wrapper = /*#__PURE__*/ styled.div.withConfig({\n displayName: \"Wrapper\",\n componentId: \"sc-71a0b852-1\"\n})([\n ``,\n ` overflow-y:auto;padding-bottom:10px;&::-webkit-scrollbar{height:6px;background-color:`,\n `;}&::-webkit-scrollbar-track{border-radius:10px;background-color:`,\n `;}&::-webkit-scrollbar-thumb{border-radius:3px;background-color:`,\n `;}`\n], FlexMixin({\n align: 'end',\n justify: 'center'\n}), ({ theme })=>theme.colors.grays.light, ({ theme })=>theme.colors.grays.light, ({ theme })=>theme.colors.grays.base);\nconst Item = /*#__PURE__*/ styled.div.withConfig({\n displayName: \"Item\",\n componentId: \"sc-71a0b852-2\"\n})([\n ``,\n ` margin-right:10px;`\n], FlexMixin({\n direction: 'column',\n align: 'center',\n justify: 'center'\n}));\nconst Block = /*#__PURE__*/ styled.div.withConfig({\n displayName: \"Block\",\n componentId: \"sc-71a0b852-3\"\n})([\n ``,\n ` `,\n ` background-color:`,\n `;color:`,\n `;border-top-left-radius:4px;border-top-right-radius:4px;cursor:pointer;padding:6px 8px 8px;width:80px;min-height:40px;&.is-cheapest{background-color:`,\n `;}`\n], FlexMixin({\n align: 'end',\n justify: 'center'\n}), FontMixin({\n size: 'large',\n weight: 'light',\n height: 'large'\n}), ({ theme })=>theme.colors.primary.lighter, ({ theme })=>theme.colors.white.base, ({ theme })=>theme.colors.secondary.base);\nconst Link = /*#__PURE__*/ styled.a.withConfig({\n displayName: \"Link\",\n componentId: \"sc-71a0b852-4\"\n})([\n ``,\n ` color:`,\n `;margin-top:12px;`\n], FontMixin({\n size: 'base',\n weight: 'regular',\n height: 'small'\n}), ({ theme })=>theme.colors.text.dark);\n\nexport { Block, Item, Link, PriceChartBox, Wrapper };\n","import { jsxs, jsx } from 'react/jsx-runtime';\nimport Icon from '@babylon/ui-kit-base/components/icons/icon';\nimport CardProductModal from '@babylon/ui-kit-cards/components/cards/product-card/views/desktop/card-product-modal';\nimport contextBabylon from '@babylon/ui-kit-context';\nimport { formatPriceWithCurrency } from '@babylon/ui-kit-helpers/currency';\nimport { useContext } from 'react';\nimport { useBoolean } from 'usehooks-ts';\nimport { getPricesHeightAndCheapest } from '../../../utils/index.mjs';\nimport { Item, Block, Link } from '../styled.mjs';\n\nconst BarItem = ({ cheapestPointers, higherPrice, item, index, titleModal, imageModal, literals, searcherDefault, type })=>{\n const { price = 0, link } = item;\n const searcher = {\n ...searcherDefault,\n ...item.searcher\n };\n const { Currency, Language } = useContext(contextBabylon);\n const pricesData = getPricesHeightAndCheapest({\n cheapestPointers,\n index,\n price,\n higherPrice,\n MAXHEIGHT: 100\n });\n const { value: isVisible, toggle: toggleVisibility } = useBoolean();\n const onClickBar = (event)=>{\n event.preventDefault();\n toggleVisibility();\n };\n return /*#__PURE__*/ jsxs(Item, {\n children: [\n /*#__PURE__*/ jsx(Block, {\n className: pricesData.cheapestClass,\n style: {\n height: pricesData.blockHeight + 30\n },\n onClick: onClickBar,\n \"data-testid\": \"priceChartBlock\",\n children: price > 0 ? /*#__PURE__*/ jsx(\"span\", {\n className: \"price\",\n children: formatPriceWithCurrency(Math.floor(price), Currency, Language)\n }) : /*#__PURE__*/ jsx(Icon, {\n className: `nico-magnifier`\n })\n }),\n link && /*#__PURE__*/ jsx(Link, {\n \"data-testid\": \"link\",\n href: link?.href,\n title: link?.title,\n target: link?.target ?? '_blank',\n children: link.content\n }),\n /*#__PURE__*/ jsx(CardProductModal, {\n title: titleModal ?? '',\n zone: false,\n literals: literals,\n ratingIco: 'star',\n searcher: searcher,\n image: {\n src: imageModal ?? ''\n },\n price: {\n value: Math.round(price)\n },\n isVisible: isVisible,\n toggleVisibility: toggleVisibility,\n product: type\n })\n ]\n });\n};\n\nexport { BarItem as default };\n","import { jsx, Fragment, jsxs } from 'react/jsx-runtime';\nimport Title from '@babylon/ui-kit-base/components/text/title';\nimport { genKey } from '@babylon/ui-kit-helpers/keys';\nimport classNames from 'classnames';\nimport { getPricesInfo } from '../../utils/index.mjs';\nimport BarItem from './bar-item/index.mjs';\nimport { PriceChartBox, Wrapper } from './styled.mjs';\n\nconst PriceChartDesktop = ({ props, className })=>{\n const { title, subtitle, items = [], searcher, titleModal, imageModal, config } = props ?? {};\n const { literals, type } = config ?? {};\n const priceInfo = getPricesInfo(items);\n return /*#__PURE__*/ jsx(Fragment, {\n children: /*#__PURE__*/ jsxs(PriceChartBox, {\n className: classNames(`${className}`),\n \"data-testid\": \"priceChart\",\n children: [\n /*#__PURE__*/ jsx(Title, {\n title: title,\n subTitle: subtitle\n }),\n /*#__PURE__*/ jsx(Wrapper, {\n children: items.map((item, index)=>/*#__PURE__*/ jsx(BarItem, {\n item: item,\n cheapestPointers: priceInfo.cheapestPointers,\n higherPrice: priceInfo.higherPrice,\n index: index,\n titleModal: titleModal,\n imageModal: imageModal,\n literals: literals,\n searcherDefault: searcher,\n type: type\n }, genKey(item)))\n })\n ]\n })\n });\n};\n\nexport { PriceChartDesktop as default };\n"],"names":["getPricesInfo","items","prices","item","pricesHigherThanZero","cheapestPrice","higherPrice","cheapestPointers","element","index","getPricesHeightAndCheapest","price","MAXHEIGHT","cheapestClass","blockHeight","getProduct","props","_a","_b","PriceChartBox","styled","Wrapper","FlexMixin","theme","Item","Block","FontMixin","Link","BarItem","titleModal","imageModal","literals","searcherDefault","type","link","searcher","Currency","Language","useContext","contextBabylon","pricesData","isVisible","toggleVisibility","useBoolean","onClickBar","event","jsxs","jsx","formatPriceWithCurrency","Icon","CardProductModal","PriceChartDesktop","className","title","subtitle","config","priceInfo","Fragment","classNames","Title","genKey"],"mappings":"iKAAK,MAACA,EAAiBC,GAAQ,CAC3B,MAAMC,EAASD,EAAM,IAAKE,GAAOA,EAAK,OAAS,CAAC,EAC1CC,EAAuBF,EAAO,OAAQC,GAAOA,EAAO,CAAC,EACrDE,EAAgB,KAAK,IAAI,GAAGD,CAAoB,EAChDE,EAAc,KAAK,IAAI,GAAGJ,CAAM,EAChCK,EAAmB,CAAA,EACzB,OAAAL,EAAO,QAAQ,CAACM,EAASC,IAAQ,CACz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