liftie 3.56.4 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) hide show
  1. package/Makefile +2 -2
  2. package/app.js +33 -25
  3. package/lib/checker.js +1 -1
  4. package/lib/cli/curl.js +8 -8
  5. package/lib/cli/dirs.js +8 -6
  6. package/lib/cli/fetch.js +9 -9
  7. package/lib/cli/for-each-resort.js +3 -4
  8. package/lib/cli/generate.js +10 -10
  9. package/lib/cli/noaa.js +7 -12
  10. package/lib/client/about/index.js +2 -6
  11. package/lib/client/boot/height.js +2 -6
  12. package/lib/client/boot/index.js +8 -11
  13. package/lib/client/boot/service-worker.js +1 -5
  14. package/lib/client/minimax/index.js +1 -3
  15. package/lib/client/resort/dom.js +2 -7
  16. package/lib/client/resort/index.js +7 -10
  17. package/lib/client/resort/lifts.js +4 -5
  18. package/lib/client/resort/snow.js +3 -4
  19. package/lib/client/resort/weather.js +3 -4
  20. package/lib/client/resort/webcams.js +5 -8
  21. package/lib/client/state/index.js +4 -7
  22. package/lib/client/stats/index.js +1 -5
  23. package/lib/client/tag/index.js +1 -3
  24. package/lib/embed/index.js +0 -2
  25. package/lib/lifts/index.js +12 -12
  26. package/lib/lifts/parse.js +5 -5
  27. package/lib/lifts/parser.js +6 -10
  28. package/lib/lifts/pipe.js +3 -3
  29. package/lib/lifts/request.js +1 -3
  30. package/lib/lifts/rest.js +2 -4
  31. package/lib/lifts/stats.js +2 -5
  32. package/lib/loader.js +9 -12
  33. package/lib/loaders.js +7 -8
  34. package/lib/opening.js +6 -5
  35. package/lib/plugins.js +3 -8
  36. package/lib/resorts/3cime/index.js +1 -1
  37. package/lib/resorts/3cime/resort.json +1 -1
  38. package/lib/resorts/49-degrees-north/index.js +1 -1
  39. package/lib/resorts/abasin/index.js +13 -6
  40. package/lib/resorts/abasin/resort.json +1 -1
  41. package/lib/resorts/alpe-lusia-san-pellegrino/index.js +1 -1
  42. package/lib/resorts/alpe-lusia-san-pellegrino/resort.json +1 -1
  43. package/lib/resorts/alpine/index.js +1 -1
  44. package/lib/resorts/alta/index.js +6 -7
  45. package/lib/resorts/alta-badia/index.js +1 -1
  46. package/lib/resorts/alta-badia/resort.json +1 -1
  47. package/lib/resorts/alyeska/index.js +1 -1
  48. package/lib/resorts/angel-fire/index.js +1 -1
  49. package/lib/resorts/arabba/index.js +1 -1
  50. package/lib/resorts/arabba/resort.json +1 -1
  51. package/lib/resorts/aspen-highlands/index.js +1 -1
  52. package/lib/resorts/aspen-mountain/index.js +1 -1
  53. package/lib/resorts/attitash/index.js +1 -1
  54. package/lib/resorts/beavercreek/index.js +1 -1
  55. package/lib/resorts/berkshire-east/index.js +1 -1
  56. package/lib/resorts/big-sky/index.js +1 -1
  57. package/lib/resorts/big-white/index.js +1 -1
  58. package/lib/resorts/big-white/resort.json +1 -1
  59. package/lib/resorts/blue-mountain-pa/index.js +1 -1
  60. package/lib/resorts/bluemountain/index.js +1 -1
  61. package/lib/resorts/bogusbasin/index.js +5 -4
  62. package/lib/resorts/bolton-valley/index.js +2 -3
  63. package/lib/resorts/boreal/index.js +1 -1
  64. package/lib/resorts/breck/index.js +1 -1
  65. package/lib/resorts/brettonwoods/index.js +7 -5
  66. package/lib/resorts/brianhead/index.js +1 -1
  67. package/lib/resorts/bridger-bowl/index.js +4 -3
  68. package/lib/resorts/brighton/index.js +1 -1
  69. package/lib/resorts/bromley-mountain/index.js +1 -1
  70. package/lib/resorts/burke-mountain/index.js +1 -1
  71. package/lib/resorts/buttermilk/index.js +1 -1
  72. package/lib/resorts/caberfae-peaks/index.js +1 -1
  73. package/lib/resorts/camelback/index.js +1 -1
  74. package/lib/resorts/campo-felice/index.js +1 -1
  75. package/lib/resorts/campo-felice/resort.json +1 -1
  76. package/lib/resorts/canada-olympic-park/index.js +1 -1
  77. package/lib/resorts/cannon/index.js +1 -1
  78. package/lib/resorts/cataloochee/index.js +1 -1
  79. package/lib/resorts/catedral/index.js +1 -1
  80. package/lib/resorts/cervino/index.js +2 -2
  81. package/lib/resorts/chamonix/index.js +2 -2
  82. package/lib/resorts/chamonix/resort.json +1 -1
  83. package/lib/resorts/chinapeak/index.js +1 -1
  84. package/lib/resorts/civetta/index.js +1 -1
  85. package/lib/resorts/civetta/resort.json +1 -1
  86. package/lib/resorts/claviere/index.js +1 -1
  87. package/lib/resorts/copper/index.js +1 -1
  88. package/lib/resorts/coronetpeak/index.js +1 -1
  89. package/lib/resorts/coronetpeak/resort.json +1 -1
  90. package/lib/resorts/cortina-d-ampezzo/index.js +1 -1
  91. package/lib/resorts/cortina-d-ampezzo/resort.json +1 -1
  92. package/lib/resorts/courchevel/index.js +1 -1
  93. package/lib/resorts/courchevel/resort.json +2 -1
  94. package/lib/resorts/cranmore-mountain/index.js +1 -1
  95. package/lib/resorts/cransmontana/index.js +2 -2
  96. package/lib/resorts/crested-butte/index.js +1 -1
  97. package/lib/resorts/crystal-mountain/index.js +1 -1
  98. package/lib/resorts/cypress-mountain/index.js +1 -1
  99. package/lib/resorts/deer-valley/index.js +1 -1
  100. package/lib/resorts/devils-head/index.js +1 -1
  101. package/lib/resorts/diamondpeak/index.js +1 -1
  102. package/lib/resorts/falls-creek/index.js +5 -3
  103. package/lib/resorts/falls-creek/resort.json +1 -1
  104. package/lib/resorts/flims-laax-falera/index.js +1 -1
  105. package/lib/resorts/flims-laax-falera/resort.json +1 -1
  106. package/lib/resorts/folgaria/index.js +1 -1
  107. package/lib/resorts/folgaria/resort.json +1 -1
  108. package/lib/resorts/folgarida-marilleva/index.js +2 -1
  109. package/lib/resorts/forni/index.js +1 -1
  110. package/lib/resorts/forni/resort.json +1 -1
  111. package/lib/resorts/gore-mountain/index.js +1 -1
  112. package/lib/resorts/grand-targhee/index.js +1 -1
  113. package/lib/resorts/grouse/index.js +1 -1
  114. package/lib/resorts/gunstock/index.js +1 -1
  115. package/lib/resorts/heavenly/index.js +1 -1
  116. package/lib/resorts/hochfuegen/index.js +2 -2
  117. package/lib/resorts/homewood/index.js +1 -1
  118. package/lib/resorts/hoodoo/index.js +1 -1
  119. package/lib/resorts/hunter/index.js +1 -1
  120. package/lib/resorts/ischgl-silvretta-arena/index.js +1 -1
  121. package/lib/resorts/jackson-hole/index.js +5 -3
  122. package/lib/resorts/jay-peak/index.js +1 -1
  123. package/lib/resorts/jiminypeak/index.js +1 -1
  124. package/lib/resorts/june-mountain/index.js +1 -1
  125. package/lib/resorts/keystone/index.js +1 -1
  126. package/lib/resorts/killington/index.js +1 -1
  127. package/lib/resorts/king-pine/index.js +5 -3
  128. package/lib/resorts/kirkwood/index.js +1 -1
  129. package/lib/resorts/kitzbuehel/index.js +1 -1
  130. package/lib/resorts/lamolina/index.js +1 -1
  131. package/lib/resorts/lamolina/resort.json +1 -1
  132. package/lib/resorts/laplagne/index.js +1 -1
  133. package/lib/resorts/laplagne/resort.json +2 -1
  134. package/lib/resorts/larosiere/index.js +1 -1
  135. package/lib/resorts/lavarone/index.js +1 -1
  136. package/lib/resorts/lavarone/resort.json +1 -1
  137. package/lib/resorts/lesarcs/index.js +1 -1
  138. package/lib/resorts/lesmenuires/index.js +1 -1
  139. package/lib/resorts/lesmenuires/resort.json +2 -1
  140. package/lib/resorts/loon/index.js +1 -1
  141. package/lib/resorts/loveland/index.js +5 -5
  142. package/lib/resorts/mad-river-glen/index.js +2 -2
  143. package/lib/resorts/madonna-di-campiglio/index.js +2 -1
  144. package/lib/resorts/mammoth-lakes/index.js +1 -1
  145. package/lib/resorts/manning-park/index.js +1 -1
  146. package/lib/resorts/manning-park/resort.json +1 -1
  147. package/lib/resorts/megeve/index.js +1 -1
  148. package/lib/resorts/megeve/resort.json +2 -1
  149. package/lib/resorts/meribel/index.js +1 -1
  150. package/lib/resorts/meribel/resort.json +2 -1
  151. package/lib/resorts/monarch/index.js +17 -4
  152. package/lib/resorts/monarch/resort.json +1 -5
  153. package/lib/resorts/monte-amiata/index.js +1 -1
  154. package/lib/resorts/monte-amiata/resort.json +1 -1
  155. package/lib/resorts/monte-bondone/index.js +1 -1
  156. package/lib/resorts/montegenevre/index.js +1 -1
  157. package/lib/resorts/monterosa/index.js +1 -1
  158. package/lib/resorts/morzine/index.js +1 -1
  159. package/lib/resorts/morzine/resort.json +6 -2
  160. package/lib/resorts/mount-sunapee/index.js +1 -1
  161. package/lib/resorts/mountsnow/index.js +1 -1
  162. package/lib/resorts/mt-buller/index.js +1 -1
  163. package/lib/resorts/mt-hotham/index.js +5 -3
  164. package/lib/resorts/mt-seymour/index.js +1 -1
  165. package/lib/resorts/mt-spokane/index.js +1 -1
  166. package/lib/resorts/mtbachelor/index.js +1 -1
  167. package/lib/resorts/mtbrighton/index.js +1 -1
  168. package/lib/resorts/mthigh/index.js +1 -1
  169. package/lib/resorts/mthood/index.js +1 -1
  170. package/lib/resorts/mtpeter/index.js +1 -1
  171. package/lib/resorts/mtpeter/resort.json +1 -1
  172. package/lib/resorts/mtrose/index.js +1 -1
  173. package/lib/resorts/niseko/index.js +1 -1
  174. package/lib/resorts/niseko/resort.json +1 -1
  175. package/lib/resorts/northstar/index.js +1 -1
  176. package/lib/resorts/okemo/index.js +1 -1
  177. package/lib/resorts/ovindoli/index.js +1 -1
  178. package/lib/resorts/ovindoli/resort.json +1 -1
  179. package/lib/resorts/owlshead/index.js +1 -1
  180. package/lib/resorts/paganella/index.js +1 -1
  181. package/lib/resorts/paganella/resort.json +1 -1
  182. package/lib/resorts/palisades/index.js +1 -1
  183. package/lib/resorts/parkcity/index.js +1 -1
  184. package/lib/resorts/pats-peak/index.js +4 -2
  185. package/lib/resorts/peio/index.js +2 -2
  186. package/lib/resorts/perisher/index.js +1 -1
  187. package/lib/resorts/perisher/resort.json +1 -1
  188. package/lib/resorts/piancavallo/index.js +1 -1
  189. package/lib/resorts/piancavallo/resort.json +1 -1
  190. package/lib/resorts/pico/index.js +1 -1
  191. package/lib/resorts/pinzolo/index.js +2 -1
  192. package/lib/resorts/plan-de-corones/index.js +1 -1
  193. package/lib/resorts/plan-de-corones/resort.json +1 -1
  194. package/lib/resorts/pleasant-mountain/index.js +1 -1
  195. package/lib/resorts/pontedilegno-tonale/index.js +1 -1
  196. package/lib/resorts/ragged-mountain/index.js +1 -1
  197. package/lib/resorts/ravascletto-zoncolan/index.js +1 -1
  198. package/lib/resorts/ravascletto-zoncolan/resort.json +1 -1
  199. package/lib/resorts/red-lodge-mountain/index.js +1 -1
  200. package/lib/resorts/red-mountain/index.js +2 -3
  201. package/lib/resorts/rio-pusteria-bressanone/index.js +1 -1
  202. package/lib/resorts/rio-pusteria-bressanone/resort.json +1 -1
  203. package/lib/resorts/roccaraso/index.js +1 -1
  204. package/lib/resorts/roccaraso/resort.json +1 -1
  205. package/lib/resorts/saddleback/index.js +1 -1
  206. package/lib/resorts/san-martino-di-castrozza-passo-rolle/index.js +1 -1
  207. package/lib/resorts/san-martino-di-castrozza-passo-rolle/resort.json +1 -1
  208. package/lib/resorts/sansicario/index.js +1 -1
  209. package/lib/resorts/sappada/index.js +1 -1
  210. package/lib/resorts/sappada/resort.json +1 -1
  211. package/lib/resorts/sasquatch-mountain/index.js +1 -1
  212. package/lib/resorts/sauris/index.js +1 -1
  213. package/lib/resorts/sauris/resort.json +1 -1
  214. package/lib/resorts/sauze/index.js +1 -1
  215. package/lib/resorts/schweitzer/index.js +1 -1
  216. package/lib/resorts/sella/index.js +1 -1
  217. package/lib/resorts/sella/resort.json +1 -1
  218. package/lib/resorts/serfaus-fiss-ladis/index.js +1 -1
  219. package/lib/resorts/sestriere/index.js +1 -1
  220. package/lib/resorts/sestriere/resort.json +1 -1
  221. package/lib/resorts/shawnee-mountain/index.js +4 -2
  222. package/lib/resorts/sierra/index.js +1 -1
  223. package/lib/resorts/silver-star/index.js +2 -2
  224. package/lib/resorts/skiwelt/index.js +1 -1
  225. package/lib/resorts/smuggs/index.js +1 -1
  226. package/lib/resorts/snow-valley/index.js +2 -2
  227. package/lib/resorts/snowbasin/index.js +1 -1
  228. package/lib/resorts/snowbird/index.js +2 -3
  229. package/lib/resorts/snowmass/index.js +1 -1
  230. package/lib/resorts/snowshoe/index.js +1 -1
  231. package/lib/resorts/soelden/index.js +1 -1
  232. package/lib/resorts/solitude/index.js +1 -1
  233. package/lib/resorts/st-anton-am-arlberg/index.js +1 -1
  234. package/lib/resorts/steamboat/index.js +1 -1
  235. package/lib/resorts/stevens/index.js +1 -1
  236. package/lib/resorts/stowe/index.js +1 -1
  237. package/lib/resorts/stratton/index.js +1 -1
  238. package/lib/resorts/sugarbowl/index.js +1 -1
  239. package/lib/resorts/sugarbush/index.js +1 -1
  240. package/lib/resorts/sugarloaf/index.js +1 -1
  241. package/lib/resorts/sun-peaks/index.js +1 -1
  242. package/lib/resorts/sun-peaks/resort.json +1 -1
  243. package/lib/resorts/sunday-river/index.js +1 -1
  244. package/lib/resorts/sunshine-village/index.js +6 -3
  245. package/lib/resorts/sunvalley/index.js +1 -1
  246. package/lib/resorts/tahoe-donner/index.js +1 -1
  247. package/lib/resorts/taos/index.js +1 -1
  248. package/lib/resorts/tarvisio/index.js +1 -1
  249. package/lib/resorts/tarvisio/resort.json +1 -1
  250. package/lib/resorts/telluride/index.js +1 -1
  251. package/lib/resorts/thredbo/index.js +1 -1
  252. package/lib/resorts/tignes/index.js +1 -1
  253. package/lib/resorts/tignes/resort.json +1 -1
  254. package/lib/resorts/timberline-lodge/index.js +1 -1
  255. package/lib/resorts/tremblant/index.js +1 -1
  256. package/lib/resorts/vail/index.js +1 -1
  257. package/lib/resorts/val-di-fassa/index.js +1 -1
  258. package/lib/resorts/val-di-fassa/resort.json +1 -1
  259. package/lib/resorts/val-di-fiemme/index.js +1 -1
  260. package/lib/resorts/val-di-fiemme/resort.json +1 -1
  261. package/lib/resorts/val-gardena/index.js +1 -1
  262. package/lib/resorts/val-gardena/resort.json +1 -1
  263. package/lib/resorts/valdisere/index.js +1 -1
  264. package/lib/resorts/valdisere/resort.json +1 -1
  265. package/lib/resorts/verbier/index.js +1 -1
  266. package/lib/resorts/waterville/index.js +1 -1
  267. package/lib/resorts/whistler-blackcomb/index.js +2 -2
  268. package/lib/resorts/whistler-blackcomb/resort.json +1 -1
  269. package/lib/resorts/whiteface/index.js +1 -1
  270. package/lib/resorts/whitefish/index.js +1 -1
  271. package/lib/resorts/wildcat/index.js +1 -1
  272. package/lib/resorts/windham/index.js +1 -1
  273. package/lib/resorts/winter-park/index.js +1 -1
  274. package/lib/resorts/winterplace/index.js +1 -1
  275. package/lib/routes/cache.js +4 -4
  276. package/lib/routes/canonical.js +1 -3
  277. package/lib/routes/data.js +10 -12
  278. package/lib/routes/database.js +6 -7
  279. package/lib/routes/headers.js +2 -2
  280. package/lib/routes/index.js +9 -11
  281. package/lib/routes/plan.js +2 -4
  282. package/lib/routes/service-worker.js +6 -7
  283. package/lib/routes/sorter.js +2 -4
  284. package/lib/routes/tags.js +2 -4
  285. package/lib/select.js +3 -5
  286. package/lib/tools/aspen.js +4 -4
  287. package/lib/tools/boyne.js +4 -4
  288. package/lib/tools/campiglio-dolomiti.js +1 -1
  289. package/lib/tools/coerce.js +4 -4
  290. package/lib/tools/dolomitisuperski.js +1 -1
  291. package/lib/tools/domutil.js +11 -18
  292. package/lib/tools/infosnow.js +6 -6
  293. package/lib/tools/intrawest.js +3 -3
  294. package/lib/tools/limiter.js +2 -4
  295. package/lib/tools/lumiplan.js +2 -2
  296. package/lib/tools/millis.js +4 -11
  297. package/lib/tools/powdr.js +4 -4
  298. package/lib/tools/prism.js +5 -5
  299. package/lib/tools/skiplan.js +1 -1
  300. package/lib/tools/turismofvg.js +2 -2
  301. package/lib/tools/vail.js +8 -10
  302. package/lib/tools/vialattea.js +1 -1
  303. package/lib/weather/icons.js +3 -8
  304. package/lib/weather/index.js +5 -6
  305. package/lib/weather/noaa.js +5 -3
  306. package/lib/weather/openweather.js +6 -7
  307. package/lib/webcams.js +6 -6
  308. package/package.json +3 -2
  309. package/public/scripts/liftie-embed.js.map +2 -2
  310. package/public/scripts/liftie.js +615 -695
  311. package/public/scripts/liftie.js.map +4 -4
@@ -1,141 +1,29 @@
1
1
  (() => {
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
2
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
3
8
  var __commonJS = (cb, mod) => function __require() {
4
9
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
5
10
  };
6
-
7
- // lib/client/minimax/index.js
8
- var require_minimax = __commonJS({
9
- "lib/client/minimax/index.js"(exports, module) {
10
- module.exports = minimax2;
11
- function minimax2(node, selector) {
12
- const my = {
13
- trigger: node.querySelector(selector),
14
- state: "open",
15
- // by default trigger 'open' state
16
- fn() {
17
- }
18
- };
19
- const self2 = {
20
- state: state2,
21
- on
22
- };
23
- function onclick(e) {
24
- e.preventDefault();
25
- const state3 = node.classList.toggle(my.state);
26
- my.fn.call(null, state3);
27
- }
28
- function state2(s) {
29
- my.state = s;
30
- return self2;
31
- }
32
- function on(fn) {
33
- my.fn = fn;
34
- return self2;
35
- }
36
- if (my.trigger) {
37
- my.trigger.addEventListener("click", onclick);
38
- }
39
- return self2;
40
- }
41
- }
42
- });
43
-
44
- // lib/client/resort/dom.js
45
- var require_dom = __commonJS({
46
- "lib/client/resort/dom.js"(exports, module) {
47
- function removeAllChildren(node) {
48
- while (node.hasChildNodes()) {
49
- node.removeChild(node.lastChild);
50
- }
51
- }
52
- function next({ nextElementSibling, nextSibling }) {
53
- return nextElementSibling || nextSibling;
54
- }
55
- module.exports = {
56
- next,
57
- removeAllChildren
58
- };
59
- }
60
- });
61
-
62
- // lib/client/resort/lifts.js
63
- var require_lifts = __commonJS({
64
- "lib/client/resort/lifts.js"(exports, module) {
65
- var dom = require_dom();
66
- module.exports = render;
67
- module.exports.section = 0;
68
- module.exports.type = "lifts";
69
- var states = ["open", "hold", "scheduled", "closed"];
70
- function renderStatus(node, status) {
71
- dom.removeAllChildren(node);
72
- if (status) {
73
- node.innerHTML = Object.keys(status).map((name) => {
74
- const klass = `status ls-${status[name]}`;
75
- return `<li class="lift"><span class="name">${name}</span><span class="${klass}"></span></li>`;
76
- }).join("");
77
- }
78
- }
79
- function renderStats(node, stats2) {
80
- states.forEach((s) => node.querySelector(`.ls-${s}`).innerHTML = stats2 ? stats2[s] : 0);
81
- }
82
- function renderColorBar(node, percentage) {
83
- states.forEach((state2) => {
84
- const width = `width:${percentage ? percentage[state2] : 25}%;`;
85
- node.querySelector(`.${state2}`).setAttribute("style", width);
86
- });
87
- }
88
- function render(node, { status, stats: stats2 }) {
89
- renderStatus(node.querySelector(".lifts"), status);
90
- renderStats(node.querySelector(".summary"), stats2);
91
- renderColorBar(node.querySelector(".summary-color-bar"), stats2.percentage);
92
- }
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
93
16
  }
94
- });
95
-
96
- // lib/client/resort/weather.js
97
- var require_weather = __commonJS({
98
- "lib/client/resort/weather.js"(exports, module) {
99
- var day = 24 * 60 * 60 * 1e3;
100
- module.exports = render;
101
- module.exports.section = 1;
102
- module.exports.type = "weather";
103
- function renderIcon(li, icon) {
104
- if (Array.isArray(icon)) {
105
- icon.forEach((cl, i) => li.item(i).setAttribute("class", cl));
106
- }
107
- }
108
- function renderNotice(el, notice) {
109
- if (!notice) {
110
- return el.classList.add("hidden");
111
- }
112
- el.classList.remove("hidden");
113
- el = el.querySelector("a");
114
- el.setAttribute("href", notice.href);
115
- el.setAttribute("title", `Go to ${notice.site}`);
116
- el = el.querySelector("img");
117
- el.setAttribute("src", notice.img);
118
- el.setAttribute("style", `width:${notice.width}px;`);
119
- el.setAttribute("alt", notice.site);
120
- }
121
- function render(div, weather) {
122
- if (Date.now() - weather.timestamp > day) {
123
- return false;
124
- }
125
- renderIcon(div.querySelectorAll(".weather-icon > ul > li"), weather.icon);
126
- div.querySelector(".temperature").innerHTML = `${weather.temperature.max}&deg;F`;
127
- const snowforecast = div.querySelector(".snowforecast");
128
- snowforecast.classList.toggle("hidden", !weather.snow);
129
- if (weather.snow) {
130
- snowforecast.innerHTML = `${weather.snow}"`;
131
- }
132
- div.querySelector(".conditions").innerHTML = weather.conditions;
133
- div.querySelector(".text").innerHTML = weather.text;
134
- renderNotice(div.querySelector(".notice"), weather.notice);
135
- return true;
136
- }
137
- }
138
- });
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
139
27
 
140
28
  // node_modules/.pnpm/transform-property@0.0.1/node_modules/transform-property/index.js
141
29
  var require_transform_property = __commonJS({
@@ -483,7 +371,7 @@
483
371
  Swipe.prototype.show = function(i, ms, options) {
484
372
  options = options || {};
485
373
  if (null == ms) ms = this._duration;
486
- var self2 = this;
374
+ var self = this;
487
375
  var children = this.children();
488
376
  i = max(0, min(i, children.visible.length - 1));
489
377
  this.currentVisible = i;
@@ -495,8 +383,8 @@
495
383
  this.emit("showing", this.current, this.currentEl);
496
384
  if (!ms) return this;
497
385
  this.child.addEventListener("transitionend", function shown() {
498
- if (self2.current == i) self2.emit("show", self2.current, self2.currentEl);
499
- self2.child.removeEventListener("transitionend", shown);
386
+ if (self.current == i) self.emit("show", self.current, self.currentEl);
387
+ self.child.removeEventListener("transitionend", shown);
500
388
  });
501
389
  }
502
390
  return this;
@@ -691,7 +579,7 @@
691
579
  }
692
580
  return this;
693
581
  };
694
- Pager.prototype.render = function render() {
582
+ Pager.prototype.render = function render6() {
695
583
  var i, html = [];
696
584
  for (i = 0; i < this._total; i++) {
697
585
  html.push(i !== this._current ? "a.inactive" : "a.active");
@@ -704,351 +592,6 @@
704
592
  }
705
593
  });
706
594
 
707
- // lib/client/resort/webcams.js
708
- var require_webcams = __commonJS({
709
- "lib/client/resort/webcams.js"(exports, module) {
710
- var swipe = require_swipe();
711
- var pager = require_tiny_pager();
712
- module.exports = render;
713
- module.exports.section = 1;
714
- module.exports.type = "webcams";
715
- var DELAY = 15 * 60 * 1e3;
716
- function swiper(el) {
717
- const ui = {
718
- swipe: swipe(el.swipe),
719
- pager: pager(el.pager)
720
- };
721
- function refresh(count) {
722
- ui.swipe.refresh();
723
- ui.pager.total(count).render();
724
- el.pager.classList.toggle("hidden", count < 2);
725
- }
726
- function current() {
727
- return ui.swipe.currentVisible;
728
- }
729
- ui.pager.on("show", (n) => {
730
- ui.swipe.show(n, null, {
731
- silent: true
732
- });
733
- });
734
- ui.swipe.on("show", (n) => {
735
- ui.pager.select(n, {
736
- silent: true
737
- });
738
- });
739
- return {
740
- refresh,
741
- current
742
- };
743
- }
744
- function render(div, webcams) {
745
- let cams;
746
- let timer;
747
- let ui;
748
- function refresh() {
749
- cams.forEach((it) => {
750
- const imgs = it.node.querySelectorAll("img");
751
- const fn = swap.bind(null, imgs, it);
752
- for (let i = 0; i < imgs.length; i++) {
753
- imgs[i].onload = fn;
754
- }
755
- imgs[it.inactive].setAttribute("src", imgs[it.active].getAttribute("src"));
756
- });
757
- }
758
- function initCam(cam, { source, image, name, notice }) {
759
- cam.querySelector("a").setAttribute("href", source);
760
- cam.querySelector("img.active").setAttribute("src", image);
761
- cam.querySelector("img.inactive").setAttribute("src", "");
762
- cam.querySelector(".title").innerHTML = name;
763
- cam.querySelector(".notice").innerHTML = notice || "";
764
- cams.push({
765
- node: cam,
766
- active: 0,
767
- inactive: 1
768
- });
769
- }
770
- function init2() {
771
- if (timer) {
772
- clearInterval(timer);
773
- timer = void 0;
774
- }
775
- cams = [];
776
- const ul = div.querySelector("ul");
777
- const li = ul.querySelectorAll("li");
778
- webcams.forEach((webcam, i) => {
779
- let cam;
780
- if (i < li.length) {
781
- cam = li[i];
782
- } else {
783
- cam = ul.appendChild(li[0].cloneNode(true));
784
- }
785
- initCam(cam.querySelector(".webcam"), webcam);
786
- });
787
- for (let i = Math.max(1, webcams.length); i < li.length; i++) {
788
- ul.removeChild(li[i]);
789
- }
790
- if (!ui) {
791
- ui = swiper({
792
- swipe: div.querySelector(".swipe"),
793
- pager: div.querySelector(".pager")
794
- });
795
- }
796
- ui.refresh(webcams.length);
797
- if (!cams.length) {
798
- return false;
799
- }
800
- timer = setInterval(refresh, DELAY);
801
- return true;
802
- }
803
- function swap(imgs, it) {
804
- it.active = (it.active + 1) % 2;
805
- it.inactive = (it.inactive + 1) % 2;
806
- imgs[it.inactive].setAttribute("class", "inactive");
807
- imgs[it.active].setAttribute("class", "active");
808
- imgs[it.inactive].setAttribute("src", "");
809
- }
810
- init2();
811
- }
812
- }
813
- });
814
-
815
- // lib/client/resort/snow.js
816
- var require_snow = __commonJS({
817
- "lib/client/resort/snow.js"(exports, module) {
818
- var day = 24 * 60 * 60 * 1e3;
819
- module.exports = render;
820
- module.exports.section = 1;
821
- module.exports.type = "snow";
822
- function renderField(div, field, snow) {
823
- const el = div.querySelector(`.${field}`);
824
- const value = snow[field];
825
- el.querySelector(".value").innerHTML = value || "";
826
- el.classList.toggle("hidden", !value);
827
- }
828
- function render(div, snow) {
829
- if (Date.now() - snow.timestamp > day) {
830
- return false;
831
- }
832
- renderField(div, "snowfall", snow);
833
- renderField(div, "depth", snow);
834
- renderField(div, "condition", snow);
835
- div.querySelector(".notice").innerHTML = snow.notice || "";
836
- return true;
837
- }
838
- }
839
- });
840
-
841
- // lib/client/resort/index.js
842
- var require_resort = __commonJS({
843
- "lib/client/resort/index.js"(exports, module) {
844
- var dom = require_dom();
845
- module.exports = resort2;
846
- function renderOpening(node, opening) {
847
- if (opening) {
848
- opening = opening.split("-");
849
- if (new Date(opening[0], opening[1] - 1, opening[2]).getTime() <= Date.now()) {
850
- node.dataset.opening = "";
851
- node = node.querySelector(".opening-date");
852
- node.parentNode.removeChild(node);
853
- }
854
- }
855
- }
856
- var plugins = [
857
- require_lifts(),
858
- require_weather(),
859
- require_webcams(),
860
- require_snow()
861
- ];
862
- function renderPlugins(node, getData) {
863
- const sec = dom.next(node);
864
- plugins.forEach((plugin) => {
865
- const data = getData(plugin.type);
866
- if (!data) {
867
- return;
868
- }
869
- const el = plugin.section ? sec.querySelector(`.${plugin.type}`) : node;
870
- if (!el) {
871
- return;
872
- }
873
- const show = plugin(el, data);
874
- if (typeof show === "boolean") {
875
- el.classList.toggle("visible", show);
876
- el.classList.toggle("hiddent", !show);
877
- }
878
- });
879
- }
880
- function render(node, resort3) {
881
- const tsPrev = JSON.parse(node.dataset.timestamp);
882
- const tsCurr = resort3.timestamp;
883
- renderPlugins(node, (plugin) => {
884
- if (!resort3[plugin] || !tsCurr[plugin]) {
885
- return;
886
- }
887
- if (tsPrev[plugin] && tsCurr[plugin] <= tsPrev[plugin]) {
888
- return;
889
- }
890
- return resort3[plugin];
891
- });
892
- renderOpening(node, node.dataset.opening);
893
- node.dataset.timestamp = JSON.stringify(tsCurr);
894
- }
895
- var MAX = 12;
896
- function resort2(node) {
897
- let updateCounter = MAX;
898
- function updateTimeToRefresh(counter) {
899
- const ttr = node.querySelector(".time-to-refresh");
900
- ttr.innerHTML = counter * 5;
901
- }
902
- function refresh(now) {
903
- const id = node.dataset.resort;
904
- if (!node.classList.contains("open")) {
905
- return;
906
- }
907
- if (now) {
908
- updateCounter = 0;
909
- } else {
910
- updateCounter -= 1;
911
- }
912
- if (updateCounter > 0) {
913
- updateTimeToRefresh(updateCounter);
914
- return;
915
- }
916
- updateCounter = MAX;
917
- updateTimeToRefresh(updateCounter);
918
- fetch(`/api/resort/${id}`).then((res) => res.json()).then((resort3) => render(node, resort3));
919
- }
920
- function init2() {
921
- const ds = node.dataset;
922
- updateTimeToRefresh(MAX);
923
- renderPlugins(node, (plugin) => {
924
- const data = ds[plugin];
925
- return data && JSON.parse(data);
926
- });
927
- }
928
- return {
929
- init: init2,
930
- refresh,
931
- node
932
- };
933
- }
934
- }
935
- });
936
-
937
- // node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.js
938
- var require_js_cookie = __commonJS({
939
- "node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.js"(exports, module) {
940
- (function(global, factory) {
941
- typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, function() {
942
- var current = global.Cookies;
943
- var exports2 = global.Cookies = factory();
944
- exports2.noConflict = function() {
945
- global.Cookies = current;
946
- return exports2;
947
- };
948
- }());
949
- })(exports, function() {
950
- "use strict";
951
- function assign(target) {
952
- for (var i = 1; i < arguments.length; i++) {
953
- var source = arguments[i];
954
- for (var key in source) {
955
- target[key] = source[key];
956
- }
957
- }
958
- return target;
959
- }
960
- var defaultConverter = {
961
- read: function(value) {
962
- if (value[0] === '"') {
963
- value = value.slice(1, -1);
964
- }
965
- return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
966
- },
967
- write: function(value) {
968
- return encodeURIComponent(value).replace(
969
- /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
970
- decodeURIComponent
971
- );
972
- }
973
- };
974
- function init2(converter, defaultAttributes) {
975
- function set(name, value, attributes) {
976
- if (typeof document === "undefined") {
977
- return;
978
- }
979
- attributes = assign({}, defaultAttributes, attributes);
980
- if (typeof attributes.expires === "number") {
981
- attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
982
- }
983
- if (attributes.expires) {
984
- attributes.expires = attributes.expires.toUTCString();
985
- }
986
- name = encodeURIComponent(name).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
987
- var stringifiedAttributes = "";
988
- for (var attributeName in attributes) {
989
- if (!attributes[attributeName]) {
990
- continue;
991
- }
992
- stringifiedAttributes += "; " + attributeName;
993
- if (attributes[attributeName] === true) {
994
- continue;
995
- }
996
- stringifiedAttributes += "=" + attributes[attributeName].split(";")[0];
997
- }
998
- return document.cookie = name + "=" + converter.write(value, name) + stringifiedAttributes;
999
- }
1000
- function get(name) {
1001
- if (typeof document === "undefined" || arguments.length && !name) {
1002
- return;
1003
- }
1004
- var cookies = document.cookie ? document.cookie.split("; ") : [];
1005
- var jar = {};
1006
- for (var i = 0; i < cookies.length; i++) {
1007
- var parts = cookies[i].split("=");
1008
- var value = parts.slice(1).join("=");
1009
- try {
1010
- var found = decodeURIComponent(parts[0]);
1011
- jar[found] = converter.read(value, found);
1012
- if (name === found) {
1013
- break;
1014
- }
1015
- } catch (e) {
1016
- }
1017
- }
1018
- return name ? jar[name] : jar;
1019
- }
1020
- return Object.create(
1021
- {
1022
- set,
1023
- get,
1024
- remove: function(name, attributes) {
1025
- set(
1026
- name,
1027
- "",
1028
- assign({}, attributes, {
1029
- expires: -1
1030
- })
1031
- );
1032
- },
1033
- withAttributes: function(attributes) {
1034
- return init2(this.converter, assign({}, this.attributes, attributes));
1035
- },
1036
- withConverter: function(converter2) {
1037
- return init2(assign({}, this.converter, converter2), this.attributes);
1038
- }
1039
- },
1040
- {
1041
- attributes: { value: Object.freeze(defaultAttributes) },
1042
- converter: { value: Object.freeze(converter) }
1043
- }
1044
- );
1045
- }
1046
- var api = init2(defaultConverter, { path: "/" });
1047
- return api;
1048
- });
1049
- }
1050
- });
1051
-
1052
595
  // node_modules/.pnpm/yields-keycode@1.1.0/node_modules/yields-keycode/index.js
1053
596
  var require_yields_keycode = __commonJS({
1054
597
  "node_modules/.pnpm/yields-keycode@1.1.0/node_modules/yields-keycode/index.js"(exports, module) {
@@ -1301,172 +844,29 @@
1301
844
  "node_modules/.pnpm/@pirxpilot+k@1.0.1/node_modules/@pirxpilot/k/lib/index.js"(exports, module) {
1302
845
  var proto = require_proto();
1303
846
  module.exports = function(el) {
1304
- function k(e, fn) {
1305
- k.handle(e, fn);
1306
- }
1307
- k._handle = proto.handle.bind(k);
1308
- k._clear = proto.clear.bind(k);
1309
- k._reset = proto.reset.bind(k);
1310
- el.addEventListener("keydown", k._handle, false);
1311
- el.addEventListener("keyup", k._handle, false);
1312
- el.addEventListener("keyup", k._clear, false);
1313
- el.addEventListener("focus", k._reset, false);
1314
- for (var p in proto) k[p] = proto[p];
1315
- k.listeners = [];
1316
- k.active = 0;
1317
- k.el = el;
1318
- return k;
847
+ function k2(e, fn) {
848
+ k2.handle(e, fn);
849
+ }
850
+ k2._handle = proto.handle.bind(k2);
851
+ k2._clear = proto.clear.bind(k2);
852
+ k2._reset = proto.reset.bind(k2);
853
+ el.addEventListener("keydown", k2._handle, false);
854
+ el.addEventListener("keyup", k2._handle, false);
855
+ el.addEventListener("keyup", k2._clear, false);
856
+ el.addEventListener("focus", k2._reset, false);
857
+ for (var p in proto) k2[p] = proto[p];
858
+ k2.listeners = [];
859
+ k2.active = 0;
860
+ k2.el = el;
861
+ return k2;
1319
862
  };
1320
863
  }
1321
864
  });
1322
865
 
1323
- // lib/client/state/index.js
1324
- var require_state = __commonJS({
1325
- "lib/client/state/index.js"(exports, module) {
1326
- var cookie = require_js_cookie();
1327
- var k = require_lib()(window);
1328
- module.exports = state2;
1329
- function state2(nodes, st, keys) {
1330
- const cookieName = `resorts-${st}`;
1331
- const self2 = {
1332
- load,
1333
- save,
1334
- update,
1335
- read
1336
- };
1337
- function find(id) {
1338
- return nodes.find((n) => n.dataset.resort === id);
1339
- }
1340
- function read() {
1341
- const text = cookie.get(cookieName);
1342
- return (text == null ? void 0 : text.length) ? text.split(",") : [];
1343
- }
1344
- function write(arr) {
1345
- cookie.set(cookieName, arr.join(","), {
1346
- expires: 30,
1347
- path: "/",
1348
- secure: window.location.protocol === "https:",
1349
- sameSite: "strict"
1350
- });
1351
- }
1352
- function update() {
1353
- const state3 = read().reduce((memo, id) => {
1354
- memo[id] = true;
1355
- return memo;
1356
- }, {});
1357
- nodes.forEach(({ dataset, classList }) => {
1358
- const id = dataset.resort;
1359
- state3[id] = classList.contains(st);
1360
- });
1361
- const selected = Object.keys(state3).filter((id) => state3[id]);
1362
- write(selected);
1363
- return selected;
1364
- }
1365
- function save() {
1366
- const selected = nodes.filter((n) => n.classList.contains(st)).map((n) => n.dataset.resort);
1367
- write(selected);
1368
- return selected;
1369
- }
1370
- function load() {
1371
- const selected = read();
1372
- selected.forEach((id) => {
1373
- const node = find(id);
1374
- if (node) {
1375
- node.classList.add(st);
1376
- }
1377
- });
1378
- return selected;
1379
- }
1380
- function all(on) {
1381
- nodes.forEach((n) => n.classList.toggle(st, on));
1382
- update();
1383
- }
1384
- if (keys) {
1385
- k(keys.on, all.bind(null, true));
1386
- k(keys.off, all.bind(null, false));
1387
- }
1388
- return self2;
1389
- }
1390
- }
1391
- });
1392
-
1393
- // lib/client/tag/index.js
1394
- var require_tag = __commonJS({
1395
- "lib/client/tag/index.js"(exports, module) {
1396
- module.exports = tag2;
1397
- function tag2(node) {
1398
- let count;
1399
- function update(c) {
1400
- if (!count) {
1401
- return;
1402
- }
1403
- count.innerHTML = c;
1404
- node.classList.toggle("hidden", c <= 0);
1405
- }
1406
- if (node) {
1407
- count = node.querySelector(".count");
1408
- }
1409
- return {
1410
- update
1411
- };
1412
- }
1413
- }
1414
- });
1415
-
1416
- // lib/client/about/index.js
1417
- var require_about = __commonJS({
1418
- "lib/client/about/index.js"(exports, module) {
1419
- var cookie = require_js_cookie();
1420
- module.exports = about2;
1421
- function about2() {
1422
- const s = document.querySelector(".hidden .about");
1423
- if (!s) {
1424
- return;
1425
- }
1426
- if (!check()) {
1427
- return;
1428
- }
1429
- const section = s.parentNode;
1430
- const trigger = s.querySelector("a.close");
1431
- trigger.addEventListener("click", (e) => {
1432
- close();
1433
- e.preventDefault();
1434
- });
1435
- open();
1436
- function check() {
1437
- return window.parent === window && typeof cookie.get("resorts-open") === "undefined";
1438
- }
1439
- function close() {
1440
- section.classList.add("hidden");
1441
- }
1442
- function open() {
1443
- section.classList.remove("hidden");
1444
- }
1445
- }
1446
- }
1447
- });
1448
-
1449
- // lib/client/stats/index.js
1450
- var require_stats = __commonJS({
1451
- "lib/client/stats/index.js"(exports, module) {
1452
- module.exports = stats2;
1453
- function stats2() {
1454
- const pie = document.querySelector(".stats .pie");
1455
- if (!pie) {
1456
- return;
1457
- }
1458
- const data = JSON.parse(pie.dataset.stats);
1459
- let ac = 0;
1460
- const { style } = pie;
1461
- Object.entries(data.percentage).forEach(([key, value]) => style.setProperty(`--${key}`, `${ac += value}%`));
1462
- }
1463
- }
1464
- });
1465
-
1466
866
  // node_modules/.pnpm/debounce@2.2.0/node_modules/debounce/index.js
1467
867
  var require_debounce = __commonJS({
1468
868
  "node_modules/.pnpm/debounce@2.2.0/node_modules/debounce/index.js"(exports, module) {
1469
- function debounce(function_, wait = 100, options = {}) {
869
+ function debounce2(function_, wait = 100, options = {}) {
1470
870
  if (typeof function_ !== "function") {
1471
871
  throw new TypeError(`Expected the first parameter to be a function, got \`${typeof function_}\`.`);
1472
872
  }
@@ -1538,75 +938,595 @@
1538
938
  };
1539
939
  return debounced;
1540
940
  }
1541
- module.exports.debounce = debounce;
1542
- module.exports = debounce;
941
+ module.exports.debounce = debounce2;
942
+ module.exports = debounce2;
1543
943
  }
1544
944
  });
1545
945
 
1546
- // lib/client/boot/height.js
1547
- var require_height = __commonJS({
1548
- "lib/client/boot/height.js"(exports, module) {
1549
- var debounce = require_debounce();
1550
- module.exports = postHeight;
1551
- function notify() {
1552
- const widget = document.querySelector(".widget");
1553
- if (!widget) {
1554
- return;
946
+ // node_modules/.pnpm/js-cookie@3.0.5/node_modules/js-cookie/dist/js.cookie.mjs
947
+ function assign(target) {
948
+ for (var i = 1; i < arguments.length; i++) {
949
+ var source = arguments[i];
950
+ for (var key in source) {
951
+ target[key] = source[key];
952
+ }
953
+ }
954
+ return target;
955
+ }
956
+ var defaultConverter = {
957
+ read: function(value) {
958
+ if (value[0] === '"') {
959
+ value = value.slice(1, -1);
960
+ }
961
+ return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
962
+ },
963
+ write: function(value) {
964
+ return encodeURIComponent(value).replace(
965
+ /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
966
+ decodeURIComponent
967
+ );
968
+ }
969
+ };
970
+ function init(converter, defaultAttributes) {
971
+ function set(name, value, attributes) {
972
+ if (typeof document === "undefined") {
973
+ return;
974
+ }
975
+ attributes = assign({}, defaultAttributes, attributes);
976
+ if (typeof attributes.expires === "number") {
977
+ attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
978
+ }
979
+ if (attributes.expires) {
980
+ attributes.expires = attributes.expires.toUTCString();
981
+ }
982
+ name = encodeURIComponent(name).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
983
+ var stringifiedAttributes = "";
984
+ for (var attributeName in attributes) {
985
+ if (!attributes[attributeName]) {
986
+ continue;
1555
987
  }
1556
- window.parent.postMessage(
1557
- {
1558
- height: widget.scrollHeight,
1559
- resort: window.location.pathname.split("/").pop()
1560
- },
1561
- "*"
1562
- );
988
+ stringifiedAttributes += "; " + attributeName;
989
+ if (attributes[attributeName] === true) {
990
+ continue;
991
+ }
992
+ stringifiedAttributes += "=" + attributes[attributeName].split(";")[0];
1563
993
  }
1564
- function postHeight() {
1565
- if (window === window.parent) {
1566
- return;
994
+ return document.cookie = name + "=" + converter.write(value, name) + stringifiedAttributes;
995
+ }
996
+ function get(name) {
997
+ if (typeof document === "undefined" || arguments.length && !name) {
998
+ return;
999
+ }
1000
+ var cookies = document.cookie ? document.cookie.split("; ") : [];
1001
+ var jar = {};
1002
+ for (var i = 0; i < cookies.length; i++) {
1003
+ var parts = cookies[i].split("=");
1004
+ var value = parts.slice(1).join("=");
1005
+ try {
1006
+ var found = decodeURIComponent(parts[0]);
1007
+ jar[found] = converter.read(value, found);
1008
+ if (name === found) {
1009
+ break;
1010
+ }
1011
+ } catch (e) {
1567
1012
  }
1568
- notify();
1569
- window.addEventListener("resize", debounce(notify, 300), true);
1570
1013
  }
1014
+ return name ? jar[name] : jar;
1571
1015
  }
1572
- });
1016
+ return Object.create(
1017
+ {
1018
+ set,
1019
+ get,
1020
+ remove: function(name, attributes) {
1021
+ set(
1022
+ name,
1023
+ "",
1024
+ assign({}, attributes, {
1025
+ expires: -1
1026
+ })
1027
+ );
1028
+ },
1029
+ withAttributes: function(attributes) {
1030
+ return init(this.converter, assign({}, this.attributes, attributes));
1031
+ },
1032
+ withConverter: function(converter2) {
1033
+ return init(assign({}, this.converter, converter2), this.attributes);
1034
+ }
1035
+ },
1036
+ {
1037
+ attributes: { value: Object.freeze(defaultAttributes) },
1038
+ converter: { value: Object.freeze(converter) }
1039
+ }
1040
+ );
1041
+ }
1042
+ var api = init(defaultConverter, { path: "/" });
1573
1043
 
1574
- // lib/client/boot/service-worker.js
1575
- var require_service_worker = __commonJS({
1576
- "lib/client/boot/service-worker.js"(exports, module) {
1577
- module.exports = register;
1578
- function registrationHandler({ scope, installing, waiting, active }) {
1579
- console.log("SW", scope);
1580
- if (installing) {
1581
- console.log("installing", installing.state);
1582
- }
1583
- if (waiting) {
1584
- console.log("waiting", waiting.state);
1585
- }
1586
- if (active) {
1587
- console.log("active", active.state);
1044
+ // lib/client/about/index.js
1045
+ function about() {
1046
+ const s = document.querySelector(".hidden .about");
1047
+ if (!s) {
1048
+ return;
1049
+ }
1050
+ if (!check()) {
1051
+ return;
1052
+ }
1053
+ const section = s.parentNode;
1054
+ const trigger = s.querySelector("a.close");
1055
+ trigger.addEventListener("click", (e) => {
1056
+ close();
1057
+ e.preventDefault();
1058
+ });
1059
+ open();
1060
+ function check() {
1061
+ return window.parent === window && typeof api.get("resorts-open") === "undefined";
1062
+ }
1063
+ function close() {
1064
+ section.classList.add("hidden");
1065
+ }
1066
+ function open() {
1067
+ section.classList.remove("hidden");
1068
+ }
1069
+ }
1070
+
1071
+ // lib/client/minimax/index.js
1072
+ function minimax(node, selector) {
1073
+ const my = {
1074
+ trigger: node.querySelector(selector),
1075
+ state: "open",
1076
+ // by default trigger 'open' state
1077
+ fn() {
1078
+ }
1079
+ };
1080
+ const self = {
1081
+ state: state2,
1082
+ on
1083
+ };
1084
+ function onclick(e) {
1085
+ e.preventDefault();
1086
+ const state3 = node.classList.toggle(my.state);
1087
+ my.fn.call(null, state3);
1088
+ }
1089
+ function state2(s) {
1090
+ my.state = s;
1091
+ return self;
1092
+ }
1093
+ function on(fn) {
1094
+ my.fn = fn;
1095
+ return self;
1096
+ }
1097
+ if (my.trigger) {
1098
+ my.trigger.addEventListener("click", onclick);
1099
+ }
1100
+ return self;
1101
+ }
1102
+
1103
+ // lib/client/resort/dom.js
1104
+ function removeAllChildren(node) {
1105
+ while (node.hasChildNodes()) {
1106
+ node.removeChild(node.lastChild);
1107
+ }
1108
+ }
1109
+ function next({ nextElementSibling, nextSibling }) {
1110
+ return nextElementSibling || nextSibling;
1111
+ }
1112
+
1113
+ // lib/client/resort/lifts.js
1114
+ render.section = 0;
1115
+ render.type = "lifts";
1116
+ var states = ["open", "hold", "scheduled", "closed"];
1117
+ function renderStatus(node, status) {
1118
+ removeAllChildren(node);
1119
+ if (status) {
1120
+ node.innerHTML = Object.keys(status).map((name) => {
1121
+ const klass = `status ls-${status[name]}`;
1122
+ return `<li class="lift"><span class="name">${name}</span><span class="${klass}"></span></li>`;
1123
+ }).join("");
1124
+ }
1125
+ }
1126
+ function renderStats(node, stats2) {
1127
+ states.forEach((s) => node.querySelector(`.ls-${s}`).innerHTML = stats2 ? stats2[s] : 0);
1128
+ }
1129
+ function renderColorBar(node, percentage) {
1130
+ states.forEach((state2) => {
1131
+ const width = `width:${percentage ? percentage[state2] : 25}%;`;
1132
+ node.querySelector(`.${state2}`).setAttribute("style", width);
1133
+ });
1134
+ }
1135
+ function render(node, { status, stats: stats2 }) {
1136
+ renderStatus(node.querySelector(".lifts"), status);
1137
+ renderStats(node.querySelector(".summary"), stats2);
1138
+ renderColorBar(node.querySelector(".summary-color-bar"), stats2.percentage);
1139
+ }
1140
+
1141
+ // lib/client/resort/snow.js
1142
+ var day = 24 * 60 * 60 * 1e3;
1143
+ render2.section = 1;
1144
+ render2.type = "snow";
1145
+ function renderField(div, field, snow) {
1146
+ const el = div.querySelector(`.${field}`);
1147
+ const value = snow[field];
1148
+ el.querySelector(".value").innerHTML = value || "";
1149
+ el.classList.toggle("hidden", !value);
1150
+ }
1151
+ function render2(div, snow) {
1152
+ if (Date.now() - snow.timestamp > day) {
1153
+ return false;
1154
+ }
1155
+ renderField(div, "snowfall", snow);
1156
+ renderField(div, "depth", snow);
1157
+ renderField(div, "condition", snow);
1158
+ div.querySelector(".notice").innerHTML = snow.notice || "";
1159
+ return true;
1160
+ }
1161
+
1162
+ // lib/client/resort/weather.js
1163
+ var day2 = 24 * 60 * 60 * 1e3;
1164
+ render3.section = 1;
1165
+ render3.type = "weather";
1166
+ function renderIcon(li, icon) {
1167
+ if (Array.isArray(icon)) {
1168
+ icon.forEach((cl, i) => li.item(i).setAttribute("class", cl));
1169
+ }
1170
+ }
1171
+ function renderNotice(el, notice) {
1172
+ if (!notice) {
1173
+ return el.classList.add("hidden");
1174
+ }
1175
+ el.classList.remove("hidden");
1176
+ el = el.querySelector("a");
1177
+ el.setAttribute("href", notice.href);
1178
+ el.setAttribute("title", `Go to ${notice.site}`);
1179
+ el = el.querySelector("img");
1180
+ el.setAttribute("src", notice.img);
1181
+ el.setAttribute("style", `width:${notice.width}px;`);
1182
+ el.setAttribute("alt", notice.site);
1183
+ }
1184
+ function render3(div, weather) {
1185
+ if (Date.now() - weather.timestamp > day2) {
1186
+ return false;
1187
+ }
1188
+ renderIcon(div.querySelectorAll(".weather-icon > ul > li"), weather.icon);
1189
+ div.querySelector(".temperature").innerHTML = `${weather.temperature.max}&deg;F`;
1190
+ const snowforecast = div.querySelector(".snowforecast");
1191
+ snowforecast.classList.toggle("hidden", !weather.snow);
1192
+ if (weather.snow) {
1193
+ snowforecast.innerHTML = `${weather.snow}"`;
1194
+ }
1195
+ div.querySelector(".conditions").innerHTML = weather.conditions;
1196
+ div.querySelector(".text").innerHTML = weather.text;
1197
+ renderNotice(div.querySelector(".notice"), weather.notice);
1198
+ return true;
1199
+ }
1200
+
1201
+ // lib/client/resort/webcams.js
1202
+ var import_swipe = __toESM(require_swipe(), 1);
1203
+ var import_tiny_pager = __toESM(require_tiny_pager(), 1);
1204
+ render4.section = 1;
1205
+ render4.type = "webcams";
1206
+ var DELAY = 15 * 60 * 1e3;
1207
+ function swiper(el) {
1208
+ const ui = {
1209
+ swipe: (0, import_swipe.default)(el.swipe),
1210
+ pager: (0, import_tiny_pager.default)(el.pager)
1211
+ };
1212
+ function refresh(count) {
1213
+ ui.swipe.refresh();
1214
+ ui.pager.total(count).render();
1215
+ el.pager.classList.toggle("hidden", count < 2);
1216
+ }
1217
+ function current() {
1218
+ return ui.swipe.currentVisible;
1219
+ }
1220
+ ui.pager.on("show", (n) => {
1221
+ ui.swipe.show(n, null, {
1222
+ silent: true
1223
+ });
1224
+ });
1225
+ ui.swipe.on("show", (n) => {
1226
+ ui.pager.select(n, {
1227
+ silent: true
1228
+ });
1229
+ });
1230
+ return {
1231
+ refresh,
1232
+ current
1233
+ };
1234
+ }
1235
+ function render4(div, webcams) {
1236
+ let cams;
1237
+ let timer;
1238
+ let ui;
1239
+ function refresh() {
1240
+ cams.forEach((it) => {
1241
+ const imgs = it.node.querySelectorAll("img");
1242
+ const fn = swap.bind(null, imgs, it);
1243
+ for (let i = 0; i < imgs.length; i++) {
1244
+ imgs[i].onload = fn;
1245
+ }
1246
+ imgs[it.inactive].setAttribute("src", imgs[it.active].getAttribute("src"));
1247
+ });
1248
+ }
1249
+ function initCam(cam, { source, image, name, notice }) {
1250
+ cam.querySelector("a").setAttribute("href", source);
1251
+ cam.querySelector("img.active").setAttribute("src", image);
1252
+ cam.querySelector("img.inactive").setAttribute("src", "");
1253
+ cam.querySelector(".title").innerHTML = name;
1254
+ cam.querySelector(".notice").innerHTML = notice || "";
1255
+ cams.push({
1256
+ node: cam,
1257
+ active: 0,
1258
+ inactive: 1
1259
+ });
1260
+ }
1261
+ function init3() {
1262
+ if (timer) {
1263
+ clearInterval(timer);
1264
+ timer = void 0;
1265
+ }
1266
+ cams = [];
1267
+ const ul = div.querySelector("ul");
1268
+ const li = ul.querySelectorAll("li");
1269
+ webcams.forEach((webcam, i) => {
1270
+ let cam;
1271
+ if (i < li.length) {
1272
+ cam = li[i];
1273
+ } else {
1274
+ cam = ul.appendChild(li[0].cloneNode(true));
1588
1275
  }
1276
+ initCam(cam.querySelector(".webcam"), webcam);
1277
+ });
1278
+ for (let i = Math.max(1, webcams.length); i < li.length; i++) {
1279
+ ul.removeChild(li[i]);
1280
+ }
1281
+ if (!ui) {
1282
+ ui = swiper({
1283
+ swipe: div.querySelector(".swipe"),
1284
+ pager: div.querySelector(".pager")
1285
+ });
1286
+ }
1287
+ ui.refresh(webcams.length);
1288
+ if (!cams.length) {
1289
+ return false;
1290
+ }
1291
+ timer = setInterval(refresh, DELAY);
1292
+ return true;
1293
+ }
1294
+ function swap(imgs, it) {
1295
+ it.active = (it.active + 1) % 2;
1296
+ it.inactive = (it.inactive + 1) % 2;
1297
+ imgs[it.inactive].setAttribute("class", "inactive");
1298
+ imgs[it.active].setAttribute("class", "active");
1299
+ imgs[it.inactive].setAttribute("src", "");
1300
+ }
1301
+ init3();
1302
+ }
1303
+
1304
+ // lib/client/resort/index.js
1305
+ function renderOpening(node, opening) {
1306
+ if (opening) {
1307
+ opening = opening.split("-");
1308
+ if (new Date(opening[0], opening[1] - 1, opening[2]).getTime() <= Date.now()) {
1309
+ node.dataset.opening = "";
1310
+ node = node.querySelector(".opening-date");
1311
+ node.parentNode.removeChild(node);
1589
1312
  }
1590
- function register(url = "/sw.js") {
1591
- if (navigator.serviceWorker && document.documentElement.hasAttribute("data-service-worker")) {
1592
- return navigator.serviceWorker.register(url).then(registrationHandler).catch((reason) => console.log("SW registration failed!", reason));
1313
+ }
1314
+ }
1315
+ var plugins = [render, render3, render4, render2];
1316
+ function renderPlugins(node, getData) {
1317
+ const sec = next(node);
1318
+ plugins.forEach((plugin) => {
1319
+ const data = getData(plugin.type);
1320
+ if (!data) {
1321
+ return;
1322
+ }
1323
+ const el = plugin.section ? sec.querySelector(`.${plugin.type}`) : node;
1324
+ if (!el) {
1325
+ return;
1326
+ }
1327
+ const show = plugin(el, data);
1328
+ if (typeof show === "boolean") {
1329
+ el.classList.toggle("visible", show);
1330
+ el.classList.toggle("hiddent", !show);
1331
+ }
1332
+ });
1333
+ }
1334
+ function render5(node, resort2) {
1335
+ const tsPrev = JSON.parse(node.dataset.timestamp);
1336
+ const tsCurr = resort2.timestamp;
1337
+ renderPlugins(node, (plugin) => {
1338
+ if (!resort2[plugin] || !tsCurr[plugin]) {
1339
+ return;
1340
+ }
1341
+ if (tsPrev[plugin] && tsCurr[plugin] <= tsPrev[plugin]) {
1342
+ return;
1343
+ }
1344
+ return resort2[plugin];
1345
+ });
1346
+ renderOpening(node, node.dataset.opening);
1347
+ node.dataset.timestamp = JSON.stringify(tsCurr);
1348
+ }
1349
+ var MAX = 12;
1350
+ function resort(node) {
1351
+ let updateCounter = MAX;
1352
+ function updateTimeToRefresh(counter) {
1353
+ const ttr = node.querySelector(".time-to-refresh");
1354
+ ttr.innerHTML = counter * 5;
1355
+ }
1356
+ function refresh(now) {
1357
+ const id = node.dataset.resort;
1358
+ if (!node.classList.contains("open")) {
1359
+ return;
1360
+ }
1361
+ if (now) {
1362
+ updateCounter = 0;
1363
+ } else {
1364
+ updateCounter -= 1;
1365
+ }
1366
+ if (updateCounter > 0) {
1367
+ updateTimeToRefresh(updateCounter);
1368
+ return;
1369
+ }
1370
+ updateCounter = MAX;
1371
+ updateTimeToRefresh(updateCounter);
1372
+ fetch(`/api/resort/${id}`).then((res) => res.json()).then((resort2) => render5(node, resort2));
1373
+ }
1374
+ function init3() {
1375
+ const ds = node.dataset;
1376
+ updateTimeToRefresh(MAX);
1377
+ renderPlugins(node, (plugin) => {
1378
+ const data = ds[plugin];
1379
+ return data && JSON.parse(data);
1380
+ });
1381
+ }
1382
+ return {
1383
+ init: init3,
1384
+ refresh,
1385
+ node
1386
+ };
1387
+ }
1388
+
1389
+ // lib/client/state/index.js
1390
+ var import_k = __toESM(require_lib(), 1);
1391
+ var k = (0, import_k.default)(window);
1392
+ function state(nodes, st, keys) {
1393
+ const cookieName = `resorts-${st}`;
1394
+ const self = {
1395
+ load,
1396
+ save,
1397
+ update,
1398
+ read
1399
+ };
1400
+ function find(id) {
1401
+ return nodes.find((n) => n.dataset.resort === id);
1402
+ }
1403
+ function read() {
1404
+ const text = api.get(cookieName);
1405
+ return (text == null ? void 0 : text.length) ? text.split(",") : [];
1406
+ }
1407
+ function write(arr) {
1408
+ api.set(cookieName, arr.join(","), {
1409
+ expires: 30,
1410
+ path: "/",
1411
+ secure: window.location.protocol === "https:",
1412
+ sameSite: "strict"
1413
+ });
1414
+ }
1415
+ function update() {
1416
+ const state2 = read().reduce((memo, id) => {
1417
+ memo[id] = true;
1418
+ return memo;
1419
+ }, {});
1420
+ nodes.forEach(({ dataset, classList }) => {
1421
+ const id = dataset.resort;
1422
+ state2[id] = classList.contains(st);
1423
+ });
1424
+ const selected = Object.keys(state2).filter((id) => state2[id]);
1425
+ write(selected);
1426
+ return selected;
1427
+ }
1428
+ function save() {
1429
+ const selected = nodes.filter((n) => n.classList.contains(st)).map((n) => n.dataset.resort);
1430
+ write(selected);
1431
+ return selected;
1432
+ }
1433
+ function load() {
1434
+ const selected = read();
1435
+ selected.forEach((id) => {
1436
+ const node = find(id);
1437
+ if (node) {
1438
+ node.classList.add(st);
1593
1439
  }
1440
+ });
1441
+ return selected;
1442
+ }
1443
+ function all(on) {
1444
+ nodes.forEach((n) => n.classList.toggle(st, on));
1445
+ update();
1446
+ }
1447
+ if (keys) {
1448
+ k(keys.on, all.bind(null, true));
1449
+ k(keys.off, all.bind(null, false));
1450
+ }
1451
+ return self;
1452
+ }
1453
+
1454
+ // lib/client/stats/index.js
1455
+ function stats() {
1456
+ const pie = document.querySelector(".stats .pie");
1457
+ if (!pie) {
1458
+ return;
1459
+ }
1460
+ const data = JSON.parse(pie.dataset.stats);
1461
+ let ac = 0;
1462
+ const { style } = pie;
1463
+ Object.entries(data.percentage).forEach(([key, value]) => style.setProperty(`--${key}`, `${ac += value}%`));
1464
+ }
1465
+
1466
+ // lib/client/tag/index.js
1467
+ function tag(node) {
1468
+ let count;
1469
+ function update(c) {
1470
+ if (!count) {
1471
+ return;
1594
1472
  }
1473
+ count.innerHTML = c;
1474
+ node.classList.toggle("hidden", c <= 0);
1595
1475
  }
1596
- });
1476
+ if (node) {
1477
+ count = node.querySelector(".count");
1478
+ }
1479
+ return {
1480
+ update
1481
+ };
1482
+ }
1483
+
1484
+ // lib/client/boot/height.js
1485
+ var import_debounce = __toESM(require_debounce(), 1);
1486
+ function notify() {
1487
+ const widget = document.querySelector(".widget");
1488
+ if (!widget) {
1489
+ return;
1490
+ }
1491
+ window.parent.postMessage(
1492
+ {
1493
+ height: widget.scrollHeight,
1494
+ resort: window.location.pathname.split("/").pop()
1495
+ },
1496
+ "*"
1497
+ );
1498
+ }
1499
+ function postHeight() {
1500
+ if (window === window.parent) {
1501
+ return;
1502
+ }
1503
+ notify();
1504
+ window.addEventListener("resize", (0, import_debounce.default)(notify, 300), true);
1505
+ }
1506
+
1507
+ // lib/client/boot/service-worker.js
1508
+ function registrationHandler({ scope, installing, waiting, active }) {
1509
+ console.log("SW", scope);
1510
+ if (installing) {
1511
+ console.log("installing", installing.state);
1512
+ }
1513
+ if (waiting) {
1514
+ console.log("waiting", waiting.state);
1515
+ }
1516
+ if (active) {
1517
+ console.log("active", active.state);
1518
+ }
1519
+ }
1520
+ function register(url = "/sw.js") {
1521
+ if (navigator.serviceWorker && document.documentElement.hasAttribute("data-service-worker")) {
1522
+ return navigator.serviceWorker.register(url).then(registrationHandler).catch((reason) => console.log("SW registration failed!", reason));
1523
+ }
1524
+ }
1597
1525
 
1598
1526
  // lib/client/boot/index.js
1599
- var minimax = require_minimax();
1600
- var resort = require_resort();
1601
- var state = require_state();
1602
- var tag = require_tag();
1603
- var about = require_about();
1604
- var stats = require_stats();
1605
- var height = require_height();
1606
- var serviceWorker = require_service_worker();
1607
- serviceWorker();
1608
- init();
1609
- function init() {
1527
+ register();
1528
+ init2();
1529
+ function init2() {
1610
1530
  const rnodes = Array.from(document.querySelectorAll(".resort"));
1611
1531
  const opens = state(rnodes, "open", {
1612
1532
  on: "shift + o",
@@ -1630,12 +1550,12 @@
1630
1550
  opens.update();
1631
1551
  starredTag.update(starred.load().length);
1632
1552
  stats();
1633
- height();
1553
+ postHeight();
1634
1554
  }
1635
1555
  })();
1636
1556
  /*! Bundled license information:
1637
1557
 
1638
- js-cookie/dist/js.cookie.js:
1558
+ js-cookie/dist/js.cookie.mjs:
1639
1559
  (*! js-cookie v3.0.5 | MIT *)
1640
1560
  */
1641
1561
  //# sourceMappingURL=liftie.js.map