{"version":3,"sources":["webpack:///./src/js/modules/snowAndTrailReport.js","webpack:///./node_modules/prop-types/index.js","webpack:///./node_modules/prop-types/factoryWithThrowingShims.js","webpack:///./node_modules/prop-types/lib/ReactPropTypesSecret.js","webpack:///./src/js/helpers/hooks.js"],"names":["SnowAndTrailReport","endpoint","mountain","snowfallTitle","liftAndGroomingTitle","updatedLabel","inchesLabel","centimetersLabel","snow24HoursLabel","snow48HoursLabel","snow72HoursLabel","snow7DaysLabel","snowBaseLabel","showSnowfallLabel","hideSnowfallLabel","showReportLabel","hideReportLabel","liftsOpenLabel","trailsOpenLabel","acresOpenLabel","liftCtaLabel","liftCtaUrl","liftCtaTarget","percentBeginnerTerrainOpenLabel","percentIntermediateTerrainOpenLabel","percentAdvancedTerrainOpenLabel","percentExpertTerrainOpenLabel","terrainOpenLabel","groomingCtaLabel","groomingCtaUrl","groomingCtaTarget","snowfallId","useMemo","uuidv4","liftAndGroomingId","useState","report","setReport","unit","setUnit","isDesktop","useMediaQuery","useEffect","Axios","method","url","params","data","fetchData","togglePanel","e","toggle","target","panel","document","getElementById","getAttribute","setAttribute","innerHTML","close","element","open","nf","Intl","NumberFormat","className","lastUpdated","type","name","onChange","checked","aria-controls","aria-expanded","onClick","id","snow24Hours","snow48Hours","snow72Hours","snow7Days","snowBase","lifts","total","trails","format","acres","href","percentBeginnerTerrainOpen","percentIntermediateTerrainOpen","percentAdvancedTerrainOpen","percentExpertTerrainOpen","propTypes","PropTypes","string","isRequired","module","exports","ReactPropTypesSecret","emptyFunction","emptyFunctionWithReset","resetWarningCache","shim","props","propName","componentName","location","propFullName","secret","err","Error","getShim","ReactPropTypes","array","bool","func","number","object","symbol","any","arrayOf","elementType","instanceOf","node","objectOf","oneOf","oneOfType","shape","exact","checkPropTypes","query","matches","setMatches","media","window","matchMedia","listener","addListener","removeListener","useOnClickOutside","ref","handler","event","current","contains","addEventListener","removeEventListener","useElementClientRect","useRef","elementClientRect","setElementClientRect","setValues","clientRect","getBoundingClientRect","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B,SAAUM,GAC3B,kBAAMjB,OAAOY,oBAAoB,SAAUK,MACjD,CAACX,EAAIG,UAED,CAACH,EAAKS","file":"25.d18c105febb4d2b97dd5.js","sourcesContent":["import React, { useMemo, useState, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { v4 as uuidv4 } from 'uuid';\nimport Axios from 'axios';\nimport { useMediaQuery } from '../helpers/hooks';\nimport { open, close } from '../helpers';\n\nconst SnowAndTrailReport = ({\n  endpoint,\n  mountain,\n  snowfallTitle,\n  liftAndGroomingTitle,\n  updatedLabel,\n  inchesLabel,\n  centimetersLabel,\n  snow24HoursLabel,\n  snow48HoursLabel,\n  snow72HoursLabel,\n  snow7DaysLabel,\n  snowBaseLabel,\n  showSnowfallLabel,\n  hideSnowfallLabel,\n  showReportLabel,\n  hideReportLabel,\n  liftsOpenLabel,\n  trailsOpenLabel,\n  acresOpenLabel,\n  liftCtaLabel,\n  liftCtaUrl,\n  liftCtaTarget,\n  percentBeginnerTerrainOpenLabel,\n  percentIntermediateTerrainOpenLabel,\n  percentAdvancedTerrainOpenLabel,\n  percentExpertTerrainOpenLabel,\n  terrainOpenLabel,\n  groomingCtaLabel,\n  groomingCtaUrl,\n  groomingCtaTarget\n}) => {\n  const snowfallId = useMemo(() => uuidv4(), []);\n  const liftAndGroomingId = useMemo(() => uuidv4(), []);\n  const [report, setReport] = useState({});\n  const [unit, setUnit] = useState('inches');\n  const isDesktop = useMediaQuery('(min-width: 1280px)');\n\n  useEffect(() => {\n    const fetchData = async () => {\n      const { data } = await Axios({\n        method: 'GET',\n        url: endpoint,\n        params: {\n          mountain\n        }\n      });\n\n      setReport(data);\n    };\n\n    fetchData();\n  }, [endpoint, mountain]);\n\n  const togglePanel = (e, toggle) => {\n    const { target } = e;\n    const panel = document.getElementById(target.getAttribute('aria-controls'));\n\n    if (target.getAttribute('aria-expanded') === 'true') {\n      target.setAttribute('aria-expanded', 'false');\n      target.innerHTML =\n        toggle === 'snowfall' ? showSnowfallLabel : showReportLabel;\n      close({\n        element: panel\n      });\n    } else {\n      target.setAttribute('aria-expanded', 'true');\n      target.innerHTML =\n        toggle === 'snowfall' ? hideSnowfallLabel : hideReportLabel;\n      open({\n        element: panel\n      });\n    }\n  };\n\n  const nf = new Intl.NumberFormat();\n\n  return (\n    <div className=\"snow-and-trail-report__box\">\n      <div className=\"snow-and-trail-report__box-top\">\n        <div className=\"snow-and-trail-report__box-header\">\n          <div className=\"snow-and-trail-report__box-header-inner\">\n            <h3 className=\"snow-and-trail-report__subtitle\">{snowfallTitle}</h3>\n            <p className=\"snow-and-trail-report__update-time\">\n              {updatedLabel} {report.lastUpdated}\n            </p>\n          </div>\n          {isDesktop && (\n            <fieldset className=\"snow-and-trail-report__switch\">\n              <label className=\"snow-and-trail-report__switch-option\">\n                <input\n                  type=\"radio\"\n                  name=\"unit\"\n                  onChange={() => setUnit('inches')}\n                  checked={unit === 'inches'}\n                />\n                <span>{inchesLabel}</span>\n              </label>\n              <label className=\"snow-and-trail-report__switch-option\">\n                <input\n                  type=\"radio\"\n                  name=\"unit\"\n                  onChange={() => setUnit('centimeters')}\n                  checked={unit === 'centimeters'}\n                />\n                <span>{centimetersLabel}</span>\n              </label>\n            </fieldset>\n          )}\n        </div>\n\n        {!isDesktop && (\n          <button\n            className=\"snow-and-trail-report__toggle\"\n            aria-controls={snowfallId}\n            aria-expanded=\"false\"\n            onClick={e => togglePanel(e, 'snowfall')}\n          >\n            {showSnowfallLabel}\n          </button>\n        )}\n        <div className=\"snow-and-trail-report__panel\" id={snowfallId}>\n          <div className=\"snow-and-trail-report__panel-inner\">\n            {!isDesktop && (\n              <fieldset className=\"snow-and-trail-report__switch\">\n                <label className=\"snow-and-trail-report__switch-option\">\n                  <input\n                    type=\"radio\"\n                    name=\"unit\"\n                    onChange={() => setUnit('inches')}\n                    checked={unit === 'inches'}\n                  />\n                  <span>{inchesLabel}</span>\n                </label>\n                <label className=\"snow-and-trail-report__switch-option\">\n                  <input\n                    type=\"radio\"\n                    name=\"unit\"\n                    onChange={() => setUnit('centimeters')}\n                    checked={unit === 'centimeters'}\n                  />\n                  <span>{centimetersLabel}</span>\n                </label>\n              </fieldset>\n            )}\n            <div className=\"snow-and-trail-report__report\">\n              <div className=\"snow-and-trail-report__metric\">\n                <p className=\"snow-and-trail-report__value\">\n                  {report.snow24Hours?.[unit] || '0'}\n                  {unit === 'inches' ? '”' : <small>cm</small>}\n                </p>\n                <p className=\"snow-and-trail-report__label\">\n                  {snow24HoursLabel}\n                </p>\n              </div>\n              <div className=\"snow-and-trail-report__metric\">\n                <p className=\"snow-and-trail-report__value\">\n                  {report.snow48Hours?.[unit] || '0'}\n                  {unit === 'inches' ? '”' : <small>cm</small>}\n                </p>\n                <p className=\"snow-and-trail-report__label\">\n                  {snow48HoursLabel}\n                </p>\n              </div>\n              <div className=\"snow-and-trail-report__metric\">\n                <p className=\"snow-and-trail-report__value\">\n                  {report.snow72Hours?.[unit] || '0'}\n                  {unit === 'inches' ? '”' : <small>cm</small>}\n                </p>\n                <p className=\"snow-and-trail-report__label\">\n                  {snow72HoursLabel}\n                </p>\n              </div>\n              <div className=\"snow-and-trail-report__metric\">\n                <p className=\"snow-and-trail-report__value\">\n                  {report.snow7Days?.[unit] || '0'}\n                  {unit === 'inches' ? '”' : <small>cm</small>}\n                </p>\n                <p className=\"snow-and-trail-report__label\">{snow7DaysLabel}</p>\n              </div>\n              <div className=\"snow-and-trail-report__metric\">\n                <p className=\"snow-and-trail-report__value\">\n                  {report.snowBase?.[unit] || '0'}\n                  {unit === 'inches' ? '”' : <small>cm</small>}\n                </p>\n                <p className=\"snow-and-trail-report__label\">{snowBaseLabel}</p>\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n      <div className=\"snow-and-trail-report__box-bottom\">\n        <div className=\"snow-and-trail-report__box-header\">\n          <div className=\"snow-and-trail-report__box-header-inner\">\n            <h3 className=\"snow-and-trail-report__subtitle\">\n              {liftAndGroomingTitle}\n            </h3>\n            <p className=\"snow-and-trail-report__update-time\">\n              {updatedLabel} {report.lastUpdated}\n            </p>\n          </div>\n        </div>\n        {!isDesktop && (\n          <button\n            className=\"snow-and-trail-report__toggle\"\n            aria-controls={liftAndGroomingId}\n            aria-expanded=\"false\"\n            onClick={e => togglePanel(e, 'report')}\n          >\n            {showReportLabel}\n          </button>\n        )}\n        <div className=\"snow-and-trail-report__panel\" id={liftAndGroomingId}>\n          <div className=\"snow-and-trail-report__panel-inner\">\n            <div className=\"snow-and-trail-report__report\">\n              <div className=\"snow-and-trail-report__metric\">\n                <p className=\"snow-and-trail-report__value\">\n                  {report.lifts?.open || '0'}{' '}\n                  <span className=\"snow-and-trail-report__subvalue\">\n                    of {report.lifts?.total || '0'}\n                  </span>\n                </p>\n                <p className=\"snow-and-trail-report__label\">{liftsOpenLabel}</p>\n              </div>\n              <div className=\"snow-and-trail-report__metric\">\n                <p className=\"snow-and-trail-report__value\">\n                  {report.trails?.open || '0'}{' '}\n                  <span className=\"snow-and-trail-report__subvalue\">\n                    of {report.trails?.total || '0'}\n                  </span>\n                </p>\n                <p className=\"snow-and-trail-report__label\">\n                  {trailsOpenLabel}\n                </p>\n              </div>\n              <div className=\"snow-and-trail-report__metric\">\n                <p className=\"snow-and-trail-report__value\">\n                  {nf.format(report.acres?.open || 0)}{' '}\n                  <span className=\"snow-and-trail-report__subvalue\">\n                    of {nf.format(report.acres?.total || 0)}\n                  </span>\n                </p>\n                <p className=\"snow-and-trail-report__label\">{acresOpenLabel}</p>\n              </div>\n            </div>\n            {liftCtaLabel && (\n              <a\n                href={liftCtaUrl}\n                target={liftCtaTarget || '_self'}\n                className=\"snow-and-trail-report__link\"\n              >\n                {liftCtaLabel}\n              </a>\n            )}\n            <div className=\"snow-and-trail-report__report\">\n              <div className=\"snow-and-trail-report__metric\">\n                <p className=\"snow-and-trail-report__value\">\n                  <span className=\"snow-and-trail-report__percentage\">\n                    {report.percentBeginnerTerrainOpen || '0'}%\n                  </span>\n                  <span className=\"snow-and-trail-report__subvalue\">\n                    {percentBeginnerTerrainOpenLabel}\n                  </span>\n                </p>\n                <p className=\"snow-and-trail-report__label\">\n                  {terrainOpenLabel}\n                </p>\n              </div>\n\n              <div className=\"snow-and-trail-report__metric\">\n                <p className=\"snow-and-trail-report__value\">\n                  <span className=\"snow-and-trail-report__percentage\">\n                    {report.percentIntermediateTerrainOpen || '0'}%\n                  </span>\n                  <span className=\"snow-and-trail-report__subvalue\">\n                    {percentIntermediateTerrainOpenLabel}\n                  </span>\n                </p>\n                <p className=\"snow-and-trail-report__label\">\n                  {terrainOpenLabel}\n                </p>\n              </div>\n\n              <div className=\"snow-and-trail-report__metric\">\n                <p className=\"snow-and-trail-report__value\">\n                  <span className=\"snow-and-trail-report__percentage\">\n                    {report.percentAdvancedTerrainOpen || '0'}%\n                  </span>\n                  <span className=\"snow-and-trail-report__subvalue\">\n                    {percentAdvancedTerrainOpenLabel}\n                  </span>\n                </p>\n                <p className=\"snow-and-trail-report__label\">\n                  {terrainOpenLabel}\n                </p>\n              </div>\n\n              <div className=\"snow-and-trail-report__metric\">\n                <p className=\"snow-and-trail-report__value\">\n                  <span className=\"snow-and-trail-report__percentage\">\n                    {report.percentExpertTerrainOpen || '0'}%\n                  </span>\n                  <span className=\"snow-and-trail-report__subvalue\">\n                    {percentExpertTerrainOpenLabel}\n                  </span>\n                </p>\n                <p className=\"snow-and-trail-report__label\">\n                  {terrainOpenLabel}\n                </p>\n              </div>\n            </div>\n            {groomingCtaLabel && (\n              <a\n                href={groomingCtaUrl}\n                target={groomingCtaTarget || '_self'}\n                className=\"snow-and-trail-report__link\"\n              >\n                {groomingCtaLabel}\n              </a>\n            )}\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n};\n\nSnowAndTrailReport.propTypes = {\n  endpoint: PropTypes.string.isRequired,\n  mountain: PropTypes.string.isRequired,\n  snowfallTitle: PropTypes.string.isRequired,\n  liftAndGroomingTitle: PropTypes.string.isRequired,\n  updatedLabel: PropTypes.string.isRequired,\n  inchesLabel: PropTypes.string.isRequired,\n  centimetersLabel: PropTypes.string.isRequired,\n  snow24HoursLabel: PropTypes.string.isRequired,\n  snow48HoursLabel: PropTypes.string.isRequired,\n  snow72HoursLabel: PropTypes.string.isRequired,\n  snow7DaysLabel: PropTypes.string.isRequired,\n  snowBaseLabel: PropTypes.string.isRequired,\n  showSnowfallLabel: PropTypes.string.isRequired,\n  hideSnowfallLabel: PropTypes.string.isRequired,\n  showReportLabel: PropTypes.string.isRequired,\n  hideReportLabel: PropTypes.string.isRequired,\n  liftsOpenLabel: PropTypes.string.isRequired,\n  trailsOpenLabel: PropTypes.string.isRequired,\n  acresOpenLabel: PropTypes.string.isRequired,\n  liftCtaLabel: PropTypes.string.isRequired,\n  liftCtaUrl: PropTypes.string.isRequired,\n  liftCtaTarget: PropTypes.string,\n  percentBeginnerTerrainOpenLabel: PropTypes.string.isRequired,\n  percentIntermediateTerrainOpenLabel: PropTypes.string.isRequired,\n  percentAdvancedTerrainOpenLabel: PropTypes.string.isRequired,\n  percentExpertTerrainOpenLabel: PropTypes.string.isRequired,\n  terrainOpenLabel: PropTypes.string.isRequired,\n  groomingCtaLabel: PropTypes.string.isRequired,\n  groomingCtaUrl: PropTypes.string.isRequired,\n  groomingCtaTarget: PropTypes.string\n};\n\nexport default SnowAndTrailReport;\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n  var ReactIs = require('react-is');\n\n  // By explicitly using `prop-types` you are opting into new development behavior.\n  // http://fb.me/prop-types-in-prod\n  var throwOnDirectAccess = true;\n  module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n  // By explicitly using `prop-types` you are opting into new production behavior.\n  // http://fb.me/prop-types-in-prod\n  module.exports = require('./factoryWithThrowingShims')();\n}\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n\nfunction emptyFunction() {}\nfunction emptyFunctionWithReset() {}\nemptyFunctionWithReset.resetWarningCache = emptyFunction;\n\nmodule.exports = function() {\n  function shim(props, propName, componentName, location, propFullName, secret) {\n    if (secret === ReactPropTypesSecret) {\n      // It is still safe when called from React.\n      return;\n    }\n    var err = new Error(\n      'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n      'Use PropTypes.checkPropTypes() to call them. ' +\n      'Read more at http://fb.me/use-check-prop-types'\n    );\n    err.name = 'Invariant Violation';\n    throw err;\n  };\n  shim.isRequired = shim;\n  function getShim() {\n    return shim;\n  };\n  // Important!\n  // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n  var ReactPropTypes = {\n    array: shim,\n    bool: shim,\n    func: shim,\n    number: shim,\n    object: shim,\n    string: shim,\n    symbol: shim,\n\n    any: shim,\n    arrayOf: getShim,\n    element: shim,\n    elementType: shim,\n    instanceOf: getShim,\n    node: shim,\n    objectOf: getShim,\n    oneOf: getShim,\n    oneOfType: getShim,\n    shape: getShim,\n    exact: getShim,\n\n    checkPropTypes: emptyFunctionWithReset,\n    resetWarningCache: emptyFunction\n  };\n\n  ReactPropTypes.PropTypes = ReactPropTypes;\n\n  return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n","import { useState, useEffect, useLayoutEffect, useRef } from 'react';\n\nexport const useMediaQuery = query => {\n  const [matches, setMatches] = useState(false);\n\n  useEffect(() => {\n    const media = window.matchMedia(query);\n    if (media.matches !== matches) {\n      setMatches(media.matches);\n    }\n    const listener = () => {\n      setMatches(media.matches);\n    };\n    media.addListener(listener);\n    return () => media.removeListener(listener);\n  }, [matches, query]);\n\n  return matches;\n};\n\nexport const useOnClickOutside = (ref, handler) => {\n  useEffect(() => {\n    const listener = event => {\n      // Do nothing if clicking ref's element or descendent elements\n      if (!ref.current || ref.current.contains(event.target)) {\n        return;\n      }\n      handler(event);\n    };\n    document.addEventListener('click', listener);\n    return () => {\n      document.removeEventListener('click', listener);\n    };\n  }, [ref, handler]);\n};\n\n\nexport const useElementClientRect = () => {\n  const ref = useRef(null);\n  const [elementClientRect, setElementClientRect] = useState({});\n\n  const setValues = () => {\n    if (!ref.current) return;\n    const clientRect = ref.current.getBoundingClientRect();\n    setElementClientRect(clientRect);\n  };\n\n  useLayoutEffect(() => {\n    setValues();\n  }, [ref.current]);\n\n  useEffect(() => {\n    window.addEventListener('resize', setValues);\n    return () => window.removeEventListener('resize', setValues);\n  }, [ref.current]);\n\n  return [ref, elementClientRect];\n};\n\n"],"sourceRoot":""}