{"version":3,"sources":["webpack:///./Avensia.Common/Features/Shared/Blocks/AudioPlayer/index.tsx","webpack:///./Avensia.Common/Features/Shared/Blocks/AudioPlayer/audio-utils.ts","webpack:///./Avensia.Common/Features/Shared/Partials/PropertyTypes/Html.tsx"],"names":["props","url","title","target","isValidAudio","indexOf","split","pop","trim","getUrlExtension","isAudio","createElement","Base","Div","CampaignThemeLink","as","themeType","to","fillInBlock","Title","AudioControl","playsInline","controls","preload","src","InvalidAudio","position","display","flexDirection","maxWidth","boxShadow","transition","property","duration","marginBottom","textAlign","margin","xy","audio","width","HtmlTagContext","createContext","noMargin","twoColumn","HtmlSettingsProvider","Provider","value","children","noMarginDecorator","generateDecorator","Component","mapProps","item","i","componentProps","contextualStyle","Object","assign","css","_a","_b","_c","_d","_e","_f","_g","_h","attr","parseInt","height","keepImageSizes","size","Medium","Small","widths","entries","filter","k","v","alignStyle","style","marginLeft","x","float","Wrapper","subscribeToCache","preset","key","Image","href","restProps","className","anchorStyle","y","CampaignThemeButton","Button","Primary","ctaStyle","Secondary","div","maxHeight"],"mappings":";qRAgBe,mBATKA,IAChB,MAAM,IAAEC,EAAG,MAAEC,EAAK,OAAEC,GAAWH,EACzBI,ECTH,SAAiBH,GACpB,QAAKA,IAGuD,IADlC,CAAC,MAAO,OACTI,QAEtB,SAAyBJ,GAC5B,OAAOA,EAAIK,MAAM,QAAQ,GAAGA,MAAM,KAAKC,MAAMC,OAHZC,CAAgBR,IDK5BS,CAAQT,GAC7B,OAAQ,IAAMU,cAAcC,EAAM,KAAMR,EAAgB,IAAMO,cAAc,IAAOE,IAAK,KACpF,IAAMF,cAAcG,EAAA,EAAmB,CAAEC,GAAI,QAASC,UAAW,QAASC,GAAIhB,EAAKE,OAAQA,EAAQe,aAAa,GAC5G,IAAMP,cAAcQ,EAAO,KAAMjB,IACrC,IAAMS,cAAcS,EAAc,CAAEC,aAAa,EAAMC,UAAU,EAAMC,QAAS,QAC5E,IAAMZ,cAAc,SAAU,CAAEa,IAAK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82b4fc67e2ec67.js","sourcesContent":["import React from 'react';\r\nimport { styled } from '@glitz/react';\r\nimport { WhiteThemeBlock } from 'Shared/Theme';\r\nimport { isAudio } from './audio-utils';\r\nimport { translate } from '@avensia/scope';\r\nimport CampaignThemeLink from 'Shared/Sigvaris/CampaignThemeLink';\r\nimport { P } from 'Shared/Generic';\r\nconst AudioPlayer = props => {\r\n const { url, title, target } = props;\r\n const isValidAudio = isAudio(url);\r\n return (React.createElement(Base, null, isValidAudio ? (React.createElement(styled.Div, null,\r\n React.createElement(CampaignThemeLink, { as: 'theme', themeType: 'theme', to: url, target: target, fillInBlock: true },\r\n React.createElement(Title, null, title)),\r\n React.createElement(AudioControl, { playsInline: true, controls: true, preload: \"none\" },\r\n React.createElement(\"source\", { src: url })))) : (React.createElement(InvalidAudio, null, translate('/Shared/AudioPlayer/InvalidAudio')))));\r\n};\r\nexport default styled(AudioPlayer);\r\nconst Base = styled(WhiteThemeBlock, {\r\n position: 'relative',\r\n display: 'flex',\r\n flexDirection: 'column',\r\n maxWidth: 350,\r\n boxShadow: '0px 2px 6px rgba(0,0,0,0.15)',\r\n transition: {\r\n property: 'box-shadow',\r\n duration: '.2s',\r\n },\r\n});\r\nconst Title = styled(P, {\r\n marginBottom: 16,\r\n textAlign: 'center',\r\n});\r\nconst InvalidAudio = styled(P, {\r\n margin: {\r\n xy: 16,\r\n },\r\n});\r\nconst AudioControl = styled.audio({\r\n width: '100%',\r\n});\r\n","export function isAudio(url) {\r\n if (!url)\r\n return false;\r\n const SUPPORTED_FORMATS = ['mp3', 'mp4'];\r\n return SUPPORTED_FORMATS.indexOf(getUrlExtension(url)) !== -1;\r\n}\r\nexport function getUrlExtension(url) {\r\n return url.split(/[#?]/)[0].split('.').pop().trim();\r\n}\r\n","import { __rest } from \"tslib\";\r\n/**\r\n * @ComponentFor EPiServer.Core.XhtmlString\r\n */\r\nimport React, { useContext } from 'react';\r\nimport { Html, registerDecorator } from '@avensia/scope-episerver';\r\nimport Image from 'Shared/Image';\r\nimport AspectRatioImage from 'Shared/Image/Ratio';\r\nimport { imageSizes, Size } from 'Shared/image-sizes';\r\nimport { H1, H2, H3, H4, H5, H6, Hr, P, Ul } from 'Shared/Generic';\r\nimport { Theme as ButtonTheme } from 'Shared/Button';\r\nimport { styled } from '@glitz/react';\r\nimport { small } from 'Shared/Style';\r\nimport CampaignThemeButton from 'Shared/Sigvaris/CampaignThemeButton';\r\nimport CampaignThemeLink from 'Shared/Sigvaris/CampaignThemeLink';\r\nimport AudioPlayer from 'Shared/Blocks/AudioPlayer';\r\nconst HtmlTagContext = React.createContext({ noMargin: false, twoColumn: false, themeType: null });\r\nexport const HtmlSettingsProvider = props => (React.createElement(HtmlTagContext.Provider, { value: props }, props.children));\r\nconst noMarginDecorator = styled({ margin: { xy: 0 } });\r\nregisterDecorator('img', (item, i, props, componentProps) => {\r\n var _a, _b, _c, _d, _e, _f, _g, _h;\r\n const { twoColumn } = useContext(HtmlTagContext);\r\n let width;\r\n if ((_a = item === null || item === void 0 ? void 0 : item.attr) === null || _a === void 0 ? void 0 : _a.width) {\r\n props.width = parseInt((_b = item === null || item === void 0 ? void 0 : item.attr) === null || _b === void 0 ? void 0 : _b.width);\r\n // To be used by aspect ratio wrapper\r\n width = props.width;\r\n }\r\n if ((_c = item === null || item === void 0 ? void 0 : item.attr) === null || _c === void 0 ? void 0 : _c.height) {\r\n props.height = parseInt((_d = item === null || item === void 0 ? void 0 : item.attr) === null || _d === void 0 ? void 0 : _d.height);\r\n }\r\n if (componentProps.keepImageSizes !== true) {\r\n if (props.width) {\r\n delete props.width;\r\n }\r\n if (props.height) {\r\n delete props.height;\r\n }\r\n // Fall back to original image width\r\n width = props.src.width;\r\n }\r\n let size = Size.Medium;\r\n if (twoColumn) {\r\n size = Size.Small;\r\n }\r\n else if (props.width) {\r\n // Set size to the lowest preset that is larger or equal to the image width set in tinymce\r\n const widths = Object.entries(imageSizes).filter(([k, v]) => v >= props.width);\r\n size = parseInt(widths[0][0]);\r\n }\r\n if (props['data-size']) {\r\n size = props['data-size'];\r\n }\r\n let alignStyle = {};\r\n if (((_f = (_e = item === null || item === void 0 ? void 0 : item.attr) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.marginLeft) === 'auto') {\r\n // img tag is centered in editor\r\n alignStyle = { display: 'block', margin: { x: 'auto' } };\r\n }\r\n if ((_h = (_g = item === null || item === void 0 ? void 0 : item.attr) === null || _g === void 0 ? void 0 : _g.style) === null || _h === void 0 ? void 0 : _h.float) {\r\n // img tag is left or right aligned in editor\r\n alignStyle = { float: item.attr.style.float };\r\n }\r\n if (width) {\r\n return (React.createElement(Wrapper, { css: Object.assign({ width }, alignStyle) },\r\n React.createElement(AspectRatioImage, Object.assign({}, props, { subscribeToCache: true, preset: size, key: i }))));\r\n }\r\n else {\r\n return React.createElement(Image, Object.assign({}, props, { subscribeToCache: true, preset: size, key: i }));\r\n }\r\n});\r\nfunction generateDecorator(Component, mapProps) {\r\n return (item, i, props, componentProps, children) => {\r\n const { noMargin } = useContext(HtmlTagContext);\r\n let contextualStyle = null;\r\n if (noMargin) {\r\n contextualStyle = noMarginDecorator;\r\n }\r\n return (React.createElement(Component, Object.assign({}, (mapProps ? mapProps(props) : props), { css: contextualStyle && contextualStyle }), children));\r\n };\r\n}\r\nregisterDecorator('h1', generateDecorator(H1));\r\nregisterDecorator('h2', generateDecorator(H2));\r\nregisterDecorator('h3', generateDecorator(H3));\r\nregisterDecorator('h4', generateDecorator(H4));\r\nregisterDecorator('h5', generateDecorator(H5));\r\nregisterDecorator('h6', generateDecorator(H6));\r\nregisterDecorator('hr', generateDecorator(Hr));\r\nregisterDecorator('p', generateDecorator(P));\r\nregisterDecorator('ul', generateDecorator(Ul));\r\n// Since `` is special we need to take its props into consideration\r\nregisterDecorator('a', (item, i, props, componentProps, children) => {\r\n const { themeType } = useContext(HtmlTagContext);\r\n const { href, target } = props, restProps = __rest(props, [\"href\", \"target\"]);\r\n const className = props['className'];\r\n const anchorStyle = {\r\n margin: {\r\n y: small,\r\n },\r\n };\r\n if (className) {\r\n switch (className) {\r\n case 'btn-primary':\r\n return (React.createElement(CampaignThemeButton, Object.assign({ as: ButtonTheme.Primary }, restProps, { ctaStyle: 'solid', themeType: themeType, to: href, css: anchorStyle }), children));\r\n case 'btn-secondary':\r\n return (React.createElement(CampaignThemeButton, Object.assign({ as: ButtonTheme.Secondary }, restProps, { ctaStyle: 'outlined', themeType: themeType, to: href, css: anchorStyle }), children));\r\n case 'audio-player':\r\n return (React.createElement(AudioPlayer, Object.assign({}, restProps, { url: href, target: target }), children));\r\n }\r\n }\r\n return (React.createElement(CampaignThemeLink, Object.assign({}, restProps, { themeType: themeType, target: target, to: href }), children));\r\n});\r\nexport default Html;\r\nconst Wrapper = styled.div({\r\n // Centers this wrapper if it is within a

with `text-align: center`\r\n display: 'inline-block',\r\n // Fit inside accordion\r\n maxWidth: '100%',\r\n maxHeight: '100%',\r\n // Remove alignment of image inside this wrapper, align the wrapper instead ^\r\n textAlign: 'initial',\r\n});\r\n"],"sourceRoot":""}