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GAAGA,EAAIF,EAAaG,SAAUD,EAAI,IAAD,QAC5ClB,EAAe,CAAEE,KAAMc,EAAaE,QAiCvC3D,IAAAA,EAAAA,MAEDwD,SAASnB,iBAAiB,sBAd1B,SAAiC3E,GAAI,IAAD,QAClC,OAAgCsC,IAAAA,EAAAA,MAAGtC,EAAEmG,QAA7BlB,EAAR,EAAQA,KAAMC,EAAd,EAAcA,UAAW3E,EAAzB,EAAyBA,MACzB,GAD4C+B,IAAAA,EAAAA,OACvC2C,EACH,OADU,IAAD,2BAEV,cAED,IAAMmB,GAAa,YAAGnB,EAAKiB,QAAM5D,IAAAA,EAAAA,IAAAA,KAAG2C,EAAK,KAAE3C,IAAAA,EAAAA,IAAAA,KAAG2C,IAC9C,GADmD3C,IAAAA,EAAAA,OAC9C8D,EACH,OADmB,IAAD,4BAEnB,2BAEDrB,EAAe,CAAEE,KAAMmB,EAAelB,UAAAA,EAAW3E,MAAAA,OAKnD+B,IAAAA,EAAAA,MAMAwD,SAASnB,iBAAiB,sBAAuB3E,SAAAA,GAAO,IAAD,oBACrD2F,EAAAA,uBAAgC3F,EAAEmG,OAAOlB,SAG3C,KAAiBoB,SArHjB,SAAkBC,GAAa,IAAD,mBAO5BxB,EAAoB,iBAAQA,EAAyBwB,IA8G5BvB,eAAAA","sources":["webpack://StravaModern/./app/javascript/components/shared/FormattedHTMLMessage/index.js","webpack://StravaModern/./app/javascript/utils/I18n.js","webpack://StravaModern/./app/javascript/utils/react-component-mounter.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst FormattedHTMLMessage = ({ tagName, message, className, onLinkClick }) => {\n const handleLinkClick = (e) => {\n if (e.target.nodeName === 'A' && !!onLinkClick) {\n onLinkClick(e);\n }\n };\n\n return React.createElement(tagName, {\n className,\n dangerouslySetInnerHTML: {\n __html: message\n },\n onClick: handleLinkClick\n });\n};\n\nFormattedHTMLMessage.propTypes = {\n message: PropTypes.string.isRequired,\n tagName: PropTypes.string,\n className: PropTypes.string,\n onLinkClick: PropTypes.func\n};\n\nFormattedHTMLMessage.defaultProps = {\n tagName: 'span',\n className: null,\n onLinkClick: null\n};\n\nexport default FormattedHTMLMessage;\n","import React from 'react';\n\nimport FormattedHTMLMessage from '../components/shared/FormattedHTMLMessage';\n\nfunction t(key, props = {}) {\n return window.Strava.I18n.Locale.t(key, props);\n}\n\nfunction elevationFormatter(unitSystem) {\n return new window.Strava.I18n.ElevationFormatter(unitSystem);\n}\n\nfunction elevationLabelFormatter(unitSystem) {\n return new window.Strava.I18n.ChartLabelElevationFormatter(unitSystem);\n}\n\nfunction distanceFormatter(unitSystem) {\n return new window.Strava.I18n.DistanceFormatter(unitSystem);\n}\n\nfunction distanceLabelFormatter(unitSystem) {\n return new window.Strava.I18n.ChartLabelDistanceFormatter(unitSystem);\n}\n\nfunction distancePerTimeFormatter(unitSystem) {\n return new window.Strava.I18n.DistancePerTimeFormatter(unitSystem);\n}\n\nfunction distancePerTimeLabelFormatter(unitSystem) {\n return new window.Strava.I18n.ChartLabelDistancePerTimeFormatter(unitSystem);\n}\n\nfunction percentFormatter() {\n return new window.Strava.I18n.PercentFormatter();\n}\n\nfunction timespanFormatter() {\n return new window.Strava.I18n.TimespanFormatter();\n}\n\nexport default {\n t,\n t_html(key, props = {}, options = {}) {\n return ;\n },\n elevationFormatter,\n elevationLabelFormatter,\n distanceFormatter,\n distanceLabelFormatter,\n distancePerTimeFormatter,\n distancePerTimeLabelFormatter,\n percentFormatter,\n timespanFormatter,\n language() {\n return window.Strava.I18n.Locales.LANGUAGE_CODE;\n },\n measurementUnits() {\n return window.Strava.I18n.UnitSystem.get();\n }\n};\n","import React, { useCallback, useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport ReactDOM from 'react-dom';\nimport * as ContainerContext from '@strava/container-context';\nimport { useBranchIO } from '@strava/react-hooks';\nimport {\n logError,\n logMessage,\n setTag,\n setTags,\n setContext,\n withScope\n} from './sentry';\nimport I18n from '../utils/I18n';\n\nconst {\n AnalyticsContext,\n ErrorLoggingContext,\n TranslationContext,\n BranchContext\n} = ContainerContext;\n\nconst { Provider: AnalyticsProvider } = AnalyticsContext;\nconst { Provider: TranslationProvider } = TranslationContext;\nconst { Provider: ErrorLoggingProvider } = ErrorLoggingContext;\nconst { Provider: BranchContextProvider } = BranchContext;\n\nconst analyticsContext = {\n track: (data) => window.Strava.ExternalAnalytics.trackV2(data)\n};\n\nconst translationContext = {\n t: (key, props = {}) => I18n.t(key, props),\n getLanguage: () => I18n.language()\n};\n\nconst errorLoggingContext = {\n logError,\n logMessage,\n setContext,\n setTag,\n setTags,\n withScope\n};\n\nconst BranchContextProxy = ({\n dataSharingOptedOut = false,\n denyNonessentialCookies = true,\n children\n}) => {\n // non-essential third party cookies\n const [cookiesAccepted, setCookiesAccepted] = useState(\n !denyNonessentialCookies\n );\n\n const branch = useBranchIO({\n dataSharingOptedOut,\n cookiesAccepted,\n logError\n });\n\n const handleAcceptCookiesEvent = useCallback(() => {\n setCookiesAccepted(true);\n }, [setCookiesAccepted]);\n\n useEffect(() => {\n window.addEventListener('AcceptCookies', handleAcceptCookiesEvent);\n return () => {\n window.removeEventListener('AcceptCookies', handleAcceptCookiesEvent);\n };\n }, [handleAcceptCookiesEvent]);\n\n return {children}\n};\n\nBranchContextProxy.propTypes = {\n dataSharingOptedOut: PropTypes.bool.isRequired,\n denyNonessentialCookies: PropTypes.bool.isRequired,\n children: PropTypes.node.isRequired,\n};\n\n// Object that stores references to all the registered components\nlet registeredComponents = {};\n\n// Track a single component that should be mounted after the DOM content has loaded\nfunction register(components) {\n // Registered components are passed in as Hash keys (as opposed to individual arguments)\n // in order to preserve their names during JavaScript minification.\n //\n // For example:\n // ReactComponentMounter.register({ Hello });\n\n registeredComponents = { ...registeredComponents, ...components };\n}\n\nfunction mountComponent({ node, component, props }) {\n const className = component || node.getAttribute('data-react-class');\n const reactComponent = registeredComponents[className];\n\n if (!reactComponent) {\n logMessage(`Cannot find a component registered with the name ${className}`);\n return;\n }\n\n const propsJson = node.getAttribute('data-react-props');\n try {\n const reactProps = {\n ...(propsJson && JSON.parse(propsJson)),\n ...props\n };\n\n const { dataSharingOptedOut, denyNonessentialCookies } = reactProps || {};\n\n let reactElement = React.createElement(reactComponent, reactProps);\n\n // react-components imported from published `web` packages\n // these packages are developed locally using MFEs so they need\n // providers from @strava-container-context\n const isPublished = node.getAttribute('data-is-published') === 'true';\n if (isPublished) {\n reactElement = (\n \n \n \n \n {reactElement}\n \n \n \n \n );\n }\n\n ReactDOM.render(reactElement, node);\n } catch (e) {\n logError(e);\n }\n}\n\n// Allows a page to mount a component right away rather than\n// wait for the DOMContentLoaded event\nfunction inlineMount(node, component) {\n mountComponent({ node, component });\n}\n\n// Search the DOM for all react components to be mounted,\n// and mount them into the DOM\nfunction mountComponents() {\n const nodesToMount = document.querySelectorAll('[data-react-class]');\n // IE does not support NodeList.forEach, so we need to do it the old fashion way\n /* eslint-disable-next-line no-plusplus */\n for (let i = 0; i < nodesToMount.length; ++i) {\n mountComponent({ node: nodesToMount[i] });\n }\n}\n\n// Ensure pages can mount components more specifically\nif (window.stravaInlineMount === undefined) {\n window.stravaInlineMount = inlineMount;\n}\n\n// Add this listener only once, when the module is first imported\ndocument.addEventListener('DOMContentLoaded', mountComponents);\n\n/**\n * Also added once, this listener can be used to render react components\n * that were created after the DOM was loaded via the ruby `react_component` helper\n *\n * example usage:\n *\n * document.dispatchEvent(new CustomEvent('JSCreatedReactNode', {detail: {node: $('#my-react-component')}}))\n * document.dispatchEvent(new CustomEvent('JSCreatedReactNode', {detail: {node: $('#my-react-component')[index]}}))\n */\nfunction mountJSCreatedComponent(e) {\n const { node, component, props } = e.detail;\n if (!node) {\n return;\n }\n\n const unwrappedNode = node.length ? node[0] : node;\n if (!unwrappedNode) {\n return;\n }\n\n mountComponent({ node: unwrappedNode, component, props });\n}\n\ndocument.addEventListener('JSCreatedReactNode', mountJSCreatedComponent);\n\n/**\n * Components mounted using certain erb - jquery setup do not go through their whole\n * lifecyle so they are left unmounted as the athlete interacts on the page.\n *\n * For examples, see interval.js.rb, graph_data_range.js.rb and interval_type.js.rb\n */\ndocument.addEventListener('JSUnmountReactNode', (e) => {\n ReactDOM.unmountComponentAtNode(e.detail.node);\n});\n\nexport default { register, mountComponent };\n"],"names":["cov_26k0eqz9ch","FormattedHTMLMessage","_ref","tagName","message","className","onLinkClick","React","dangerouslySetInnerHTML","__html","onClick","e","target","nodeName","defaultProps","cov_2r1tokpcg7","t","key","props","window","Strava","I18n","Locale","t_html","options","_extends","elevationFormatter","unitSystem","ElevationFormatter","elevationLabelFormatter","ChartLabelElevationFormatter","distanceFormatter","DistanceFormatter","distanceLabelFormatter","ChartLabelDistanceFormatter","distancePerTimeFormatter","DistancePerTimeFormatter","distancePerTimeLabelFormatter","ChartLabelDistancePerTimeFormatter","percentFormatter","PercentFormatter","timespanFormatter","TimespanFormatter","language","Locales","LANGUAGE_CODE","measurementUnits","UnitSystem","get","cov_nd2f96vxg","ContainerContext","AnalyticsContext","ErrorLoggingContext","TranslationContext","BranchContext","AnalyticsProvider","Provider","TranslationProvider","ErrorLoggingProvider","BranchContextProvider","analyticsContext","track","data","ExternalAnalytics","trackV2","translationContext","getLanguage","errorLoggingContext","logError","logMessage","setContext","setTag","setTags","withScope","BranchContextProxy","dataSharingOptedOut","denyNonessentialCookies","children","useState","cookiesAccepted","setCookiesAccepted","branch","useBranchIO","handleAcceptCookiesEvent","useCallback","useEffect","addEventListener","removeEventListener","value","registeredComponents","mountComponent","_ref2","node","component","getAttribute","reactComponent","propsJson","reactProps","JSON","parse","reactElement","isPublished","ReactDOM","undefined","stravaInlineMount","document","nodesToMount","querySelectorAll","i","length","detail","unwrappedNode","register","components"],"sourceRoot":""}