{
  "version": 3,
  "sources": ["map_scrubber_reveal.js"],
  "sourcesContent": ["/*\n * static/js/map_scrubber_reveal.js \u2014 the calendar is the scrubber's reveal\n * (SNOW-794).\n *\n * The season scrubber's track IS the avalanche season. A day outside it \u2014\n * July, or anything in the off-season \u2014 has no position on that track, and\n * the thumb clamping to whichever end it is past was the defect this ticket\n * opened with: the URL said one day and the thumb said another.\n *\n * So the scrubber is present only while the day the map is showing falls\n * inside the season, and the calendar is what puts you either side of that\n * line. Two controls, each honest about its own job: the calendar is \"pick a\n * date, any date\"; the scrubber is a season scrubber.\n *\n * WHY THE ELEMENT IS ALWAYS RENDERED. _map_embed.html could have wrapped it\n * in an {% if %} \u2014 the server knows the answer at first paint, and does\n * render `data-in-season` from it. But an element that is not in the DOM\n * cannot come back: pick an in-season day from the calendar during the\n * off-season and the scrubber would stay gone until a reload. The server\n * settles the FIRST answer so nothing has to correct itself a frame later;\n * this module keeps it current after that.\n *\n * It owns visibility and nothing else. The date itself belongs to\n * map_scrubber.js, which is also what dispatches the event read here.\n */\n\n(function mapScrubberRevealInit() {\n  const scrubber = document.getElementById('season-scrubber');\n  if (!scrubber) return;\n\n  const seasonStart = scrubber.dataset.seasonStart || '';\n  const seasonEnd = scrubber.dataset.seasonEnd || '';\n  const todayKey = scrubber.dataset.today || '';\n\n  /**\n   * Whether `dateKey` falls inside the season the track spans.\n   *\n   * String comparison, not Date.parse: these are all ``YYYY-MM-DD``, a\n   * format whose lexical order IS its chronological order, and the calendar\n   * grid compares its own bounds the same way (calendar_core.js's\n   * ``inSeason``). Two surfaces answering one question must answer it the\n   * same way.\n   *\n   * @param {string} dateKey\n   * @returns {boolean} False when the bounds are missing, which is the safe\n   *   reading \u2014 no season means no season scrubber.\n   */\n  const inSeason = (dateKey) => {\n    if (!dateKey || !seasonStart || !seasonEnd) return false;\n    return dateKey >= seasonStart && dateKey <= seasonEnd;\n  };\n\n  /**\n   * @param {boolean} shown\n   * @returns {void}\n   */\n  const apply = (shown) => {\n    scrubber.dataset.inSeason = String(shown);\n  };\n\n  // ``date: null`` means the visitor has chosen no day (SNOW-660) \u2014 a cold\n  // boot, or a step back out of a chosen one. Today is the day the scrubber\n  // would rest on in that state, so today decides. In winter that shows the\n  // scrubber on an unchosen map; in September it does not, which is correct:\n  // the season is over and there is nothing to scrub through.\n  document.addEventListener('snowdesk:date-changed', (e) => {\n    const dateKey = (e.detail && e.detail.date) || todayKey;\n    apply(inSeason(dateKey));\n  });\n})();\n"],
  "mappings": "CA0BC,UAAiC,CAChC,MAAMA,EAAW,SAAS,eAAe,iBAAiB,EAC1D,GAAI,CAACA,EAAU,OAEf,MAAMC,EAAcD,EAAS,QAAQ,aAAe,GAC9CE,EAAYF,EAAS,QAAQ,WAAa,GAC1CG,EAAWH,EAAS,QAAQ,OAAS,GAerCI,EAAYC,GACZ,CAACA,GAAW,CAACJ,GAAe,CAACC,EAAkB,GAC5CG,GAAWJ,GAAeI,GAAWH,EAOxCI,EAASC,GAAU,CACvBP,EAAS,QAAQ,SAAW,OAAOO,CAAK,CAC1C,EAOA,SAAS,iBAAiB,wBAA0BC,GAAM,CACxD,MAAMH,EAAWG,EAAE,QAAUA,EAAE,OAAO,MAASL,EAC/CG,EAAMF,EAASC,CAAO,CAAC,CACzB,CAAC,CACH,GAAG",
  "names": ["scrubber", "seasonStart", "seasonEnd", "todayKey", "inSeason", "dateKey", "apply", "shown", "e"]
}
