@mostlyrightmd/core 0.1.0-rc.7
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.
- package/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/discovery/index.cjs +1646 -0
- package/dist/discovery/index.cjs.map +1 -0
- package/dist/discovery/index.d.cts +313 -0
- package/dist/discovery/index.d.ts +313 -0
- package/dist/discovery/index.mjs +1609 -0
- package/dist/discovery/index.mjs.map +1 -0
- package/dist/formats/index.cjs +498 -0
- package/dist/formats/index.cjs.map +1 -0
- package/dist/formats/index.d.cts +97 -0
- package/dist/formats/index.d.ts +97 -0
- package/dist/formats/index.mjs +465 -0
- package/dist/formats/index.mjs.map +1 -0
- package/dist/index.cjs +1624 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +559 -0
- package/dist/index.d.ts +559 -0
- package/dist/index.global.js +1582 -0
- package/dist/index.global.js.map +1 -0
- package/dist/index.mjs +1557 -0
- package/dist/index.mjs.map +1 -0
- package/dist/internal/bounds.cjs +125 -0
- package/dist/internal/bounds.cjs.map +1 -0
- package/dist/internal/bounds.d.cts +36 -0
- package/dist/internal/bounds.d.ts +36 -0
- package/dist/internal/bounds.mjs +81 -0
- package/dist/internal/bounds.mjs.map +1 -0
- package/dist/internal/cache/fs.cjs +217 -0
- package/dist/internal/cache/fs.cjs.map +1 -0
- package/dist/internal/cache/fs.d.cts +57 -0
- package/dist/internal/cache/fs.d.ts +57 -0
- package/dist/internal/cache/fs.mjs +179 -0
- package/dist/internal/cache/fs.mjs.map +1 -0
- package/dist/internal/cache/index.browser.cjs +1184 -0
- package/dist/internal/cache/index.browser.cjs.map +1 -0
- package/dist/internal/cache/index.browser.d.cts +20 -0
- package/dist/internal/cache/index.browser.d.ts +20 -0
- package/dist/internal/cache/index.browser.mjs +36 -0
- package/dist/internal/cache/index.browser.mjs.map +1 -0
- package/dist/internal/cache/index.cjs +1389 -0
- package/dist/internal/cache/index.cjs.map +1 -0
- package/dist/internal/cache/index.d.cts +16 -0
- package/dist/internal/cache/index.d.ts +16 -0
- package/dist/internal/cache/index.mjs +40 -0
- package/dist/internal/cache/index.mjs.map +1 -0
- package/dist/internal/chunk-PKJXHY27.mjs +1137 -0
- package/dist/internal/chunk-PKJXHY27.mjs.map +1 -0
- package/dist/internal/convert.cjs +161 -0
- package/dist/internal/convert.cjs.map +1 -0
- package/dist/internal/convert.d.cts +44 -0
- package/dist/internal/convert.d.ts +44 -0
- package/dist/internal/convert.mjs +117 -0
- package/dist/internal/convert.mjs.map +1 -0
- package/dist/internal/fs-O6XR4WWW.mjs +183 -0
- package/dist/internal/fs-O6XR4WWW.mjs.map +1 -0
- package/dist/internal/keys-B7C8C88N.d.cts +191 -0
- package/dist/internal/keys-B7C8C88N.d.ts +191 -0
- package/dist/internal/merge/index.cjs +75 -0
- package/dist/internal/merge/index.cjs.map +1 -0
- package/dist/internal/merge/index.d.cts +74 -0
- package/dist/internal/merge/index.d.ts +74 -0
- package/dist/internal/merge/index.mjs +46 -0
- package/dist/internal/merge/index.mjs.map +1 -0
- package/dist/internal/pairs.cjs +328 -0
- package/dist/internal/pairs.cjs.map +1 -0
- package/dist/internal/pairs.d.cts +105 -0
- package/dist/internal/pairs.d.ts +105 -0
- package/dist/internal/pairs.mjs +298 -0
- package/dist/internal/pairs.mjs.map +1 -0
- package/dist/qc/index.cjs +247 -0
- package/dist/qc/index.cjs.map +1 -0
- package/dist/qc/index.d.cts +140 -0
- package/dist/qc/index.d.ts +140 -0
- package/dist/qc/index.mjs +212 -0
- package/dist/qc/index.mjs.map +1 -0
- package/dist/temporal/index.cjs +504 -0
- package/dist/temporal/index.cjs.map +1 -0
- package/dist/temporal/index.d.cts +121 -0
- package/dist/temporal/index.d.ts +121 -0
- package/dist/temporal/index.mjs +474 -0
- package/dist/temporal/index.mjs.map +1 -0
- package/dist/transforms/index.cjs +399 -0
- package/dist/transforms/index.cjs.map +1 -0
- package/dist/transforms/index.d.cts +193 -0
- package/dist/transforms/index.d.ts +193 -0
- package/dist/transforms/index.mjs +362 -0
- package/dist/transforms/index.mjs.map +1 -0
- package/dist/validator.cjs +1870 -0
- package/dist/validator.cjs.map +1 -0
- package/dist/validator.d.cts +30 -0
- package/dist/validator.d.ts +30 -0
- package/dist/validator.mjs +1843 -0
- package/dist/validator.mjs.map +1 -0
- package/package.json +115 -0
|
@@ -0,0 +1,1184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/internal/cache/index.browser.ts
|
|
21
|
+
var index_browser_exports = {};
|
|
22
|
+
__export(index_browser_exports, {
|
|
23
|
+
INDEXEDDB_DB_NAME: () => DB_NAME,
|
|
24
|
+
IndexedDBStore: () => IndexedDBStore,
|
|
25
|
+
MemoryStore: () => MemoryStore,
|
|
26
|
+
cacheKeyForClimate: () => cacheKeyForClimate,
|
|
27
|
+
cacheKeyForObservations: () => cacheKeyForObservations,
|
|
28
|
+
defaultCacheStore: () => defaultCacheStore,
|
|
29
|
+
isLiveSource: () => isLiveSource,
|
|
30
|
+
isWithinVolatileWindow: () => isWithinVolatileWindow,
|
|
31
|
+
isWritableMonth: () => isWritableMonth,
|
|
32
|
+
isWritableYear: () => isWritableYear,
|
|
33
|
+
lockKeyFor: () => lockKeyFor,
|
|
34
|
+
shouldSkipCacheForCurrentLstMonth: () => shouldSkipCacheForCurrentLstMonth,
|
|
35
|
+
shouldSkipCacheForCurrentLstYear: () => shouldSkipCacheForCurrentLstYear
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(index_browser_exports);
|
|
38
|
+
|
|
39
|
+
// src/internal/cache/indexeddb.ts
|
|
40
|
+
var import_idb = require("idb");
|
|
41
|
+
|
|
42
|
+
// src/internal/cache/types.ts
|
|
43
|
+
function lockKeyFor(key) {
|
|
44
|
+
return `mostlyright:cache:lock:${key}`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// src/internal/cache/indexeddb.ts
|
|
48
|
+
var DB_NAME = "mostlyright-cache-v1";
|
|
49
|
+
var STORE_NAME = "entries";
|
|
50
|
+
var SCHEMA_VERSION = 1;
|
|
51
|
+
function getWebLocks() {
|
|
52
|
+
if (typeof navigator === "undefined") return null;
|
|
53
|
+
const nav = navigator;
|
|
54
|
+
return nav.locks ?? null;
|
|
55
|
+
}
|
|
56
|
+
var IndexedDBStore = class {
|
|
57
|
+
#dbName;
|
|
58
|
+
#dbPromise;
|
|
59
|
+
#chain = /* @__PURE__ */ new Map();
|
|
60
|
+
constructor(opts = {}) {
|
|
61
|
+
this.#dbName = opts.dbName ?? DB_NAME;
|
|
62
|
+
this.#dbPromise = (0, import_idb.openDB)(this.#dbName, SCHEMA_VERSION, {
|
|
63
|
+
upgrade(db) {
|
|
64
|
+
if (!db.objectStoreNames.contains(STORE_NAME)) {
|
|
65
|
+
db.createObjectStore(STORE_NAME);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
async get(key) {
|
|
71
|
+
const db = await this.#dbPromise;
|
|
72
|
+
const entry = await db.get(STORE_NAME, key);
|
|
73
|
+
if (entry === void 0) return null;
|
|
74
|
+
if (entry.expiresAt !== void 0 && Date.now() >= entry.expiresAt) {
|
|
75
|
+
try {
|
|
76
|
+
await db.delete(STORE_NAME, key);
|
|
77
|
+
} catch {
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
return entry.value;
|
|
82
|
+
}
|
|
83
|
+
async set(key, value, opts) {
|
|
84
|
+
const db = await this.#dbPromise;
|
|
85
|
+
const entry = opts?.ttlMs !== void 0 ? { value, expiresAt: Date.now() + opts.ttlMs } : { value };
|
|
86
|
+
await db.put(STORE_NAME, entry, key);
|
|
87
|
+
}
|
|
88
|
+
async delete(key) {
|
|
89
|
+
const db = await this.#dbPromise;
|
|
90
|
+
await db.delete(STORE_NAME, key);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Enumerate keys with the given prefix using IndexedDB's bounded range
|
|
94
|
+
* query. Live keys only — expired entries are lazy-evicted on read by
|
|
95
|
+
* `get()`, so a stale-but-not-yet-evicted entry can appear here; callers
|
|
96
|
+
* who care about expiration should `get()` to confirm.
|
|
97
|
+
*
|
|
98
|
+
* TS-W6 Wave 1: `availability()` uses this to count observation months and
|
|
99
|
+
* climate years for a station.
|
|
100
|
+
*/
|
|
101
|
+
async listKeys(prefix) {
|
|
102
|
+
const db = await this.#dbPromise;
|
|
103
|
+
const range = IDBKeyRange.bound(prefix, `${prefix}\uFFFF`, false, false);
|
|
104
|
+
const keys = await db.getAllKeys(STORE_NAME, range);
|
|
105
|
+
const out = [];
|
|
106
|
+
for (const k of keys) {
|
|
107
|
+
if (typeof k === "string" && k.startsWith(prefix)) {
|
|
108
|
+
out.push(k);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return Object.freeze(out);
|
|
112
|
+
}
|
|
113
|
+
async withLock(key, fn) {
|
|
114
|
+
const locks = getWebLocks();
|
|
115
|
+
if (locks !== null) {
|
|
116
|
+
return locks.request(lockKeyFor(key), { mode: "exclusive" }, () => fn());
|
|
117
|
+
}
|
|
118
|
+
const prev = this.#chain.get(key) ?? Promise.resolve();
|
|
119
|
+
const next = prev.then(
|
|
120
|
+
() => fn(),
|
|
121
|
+
() => fn()
|
|
122
|
+
);
|
|
123
|
+
const absorbed = next.then(
|
|
124
|
+
() => void 0,
|
|
125
|
+
() => void 0
|
|
126
|
+
);
|
|
127
|
+
this.#chain.set(key, absorbed);
|
|
128
|
+
absorbed.finally(() => {
|
|
129
|
+
if (this.#chain.get(key) === absorbed) this.#chain.delete(key);
|
|
130
|
+
});
|
|
131
|
+
return next;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// src/internal/cache/memory.ts
|
|
136
|
+
var MemoryStore = class {
|
|
137
|
+
#entries = /* @__PURE__ */ new Map();
|
|
138
|
+
#chain = /* @__PURE__ */ new Map();
|
|
139
|
+
async get(key) {
|
|
140
|
+
const e = this.#entries.get(key);
|
|
141
|
+
if (e === void 0) return null;
|
|
142
|
+
if (e.expiresAt !== void 0 && Date.now() >= e.expiresAt) {
|
|
143
|
+
this.#entries.delete(key);
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
return structuredClone(e.value);
|
|
147
|
+
}
|
|
148
|
+
async set(key, value, opts) {
|
|
149
|
+
const cloned = structuredClone(value);
|
|
150
|
+
const entry = opts?.ttlMs !== void 0 ? { value: cloned, expiresAt: Date.now() + opts.ttlMs } : { value: cloned };
|
|
151
|
+
this.#entries.set(key, entry);
|
|
152
|
+
}
|
|
153
|
+
async delete(key) {
|
|
154
|
+
this.#entries.delete(key);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Enumerate live (non-expired) keys with the given prefix.
|
|
158
|
+
*
|
|
159
|
+
* TS-W6 Wave 1: `availability()` uses this to count cached observation
|
|
160
|
+
* months and climate years per station. Expired entries are evicted as a
|
|
161
|
+
* side effect (same lazy-eviction policy as `.get`).
|
|
162
|
+
*/
|
|
163
|
+
async listKeys(prefix) {
|
|
164
|
+
const now = Date.now();
|
|
165
|
+
const out = [];
|
|
166
|
+
for (const [key, entry] of this.#entries) {
|
|
167
|
+
if (entry.expiresAt !== void 0 && now >= entry.expiresAt) {
|
|
168
|
+
this.#entries.delete(key);
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
if (key.startsWith(prefix)) {
|
|
172
|
+
out.push(key);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return Object.freeze(out);
|
|
176
|
+
}
|
|
177
|
+
async withLock(key, fn) {
|
|
178
|
+
const prev = this.#chain.get(key) ?? Promise.resolve();
|
|
179
|
+
const next = prev.then(
|
|
180
|
+
() => fn(),
|
|
181
|
+
() => fn()
|
|
182
|
+
);
|
|
183
|
+
const absorbed = next.then(
|
|
184
|
+
() => void 0,
|
|
185
|
+
() => void 0
|
|
186
|
+
);
|
|
187
|
+
this.#chain.set(key, absorbed);
|
|
188
|
+
absorbed.finally(() => {
|
|
189
|
+
if (this.#chain.get(key) === absorbed) {
|
|
190
|
+
this.#chain.delete(key);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
return next;
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
// src/data/generated/stations.ts
|
|
198
|
+
var STATIONS = [
|
|
199
|
+
{
|
|
200
|
+
code: "EDDB",
|
|
201
|
+
country: "DE",
|
|
202
|
+
ghcnh_id: null,
|
|
203
|
+
icao: "EDDB",
|
|
204
|
+
latitude: 52.3667,
|
|
205
|
+
longitude: 13.5033,
|
|
206
|
+
name: "Berlin Brandenburg",
|
|
207
|
+
tz: "Europe/Berlin"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
code: "EDDF",
|
|
211
|
+
country: "DE",
|
|
212
|
+
ghcnh_id: null,
|
|
213
|
+
icao: "EDDF",
|
|
214
|
+
latitude: 50.0379,
|
|
215
|
+
longitude: 8.5622,
|
|
216
|
+
name: "Frankfurt am Main",
|
|
217
|
+
tz: "Europe/Berlin"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
code: "EDDM",
|
|
221
|
+
country: "DE",
|
|
222
|
+
ghcnh_id: null,
|
|
223
|
+
icao: "EDDM",
|
|
224
|
+
latitude: 48.3538,
|
|
225
|
+
longitude: 11.7861,
|
|
226
|
+
name: "Munich Franz Josef Strauss",
|
|
227
|
+
tz: "Europe/Berlin"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
code: "EFHK",
|
|
231
|
+
country: "FI",
|
|
232
|
+
ghcnh_id: null,
|
|
233
|
+
icao: "EFHK",
|
|
234
|
+
latitude: 60.3172,
|
|
235
|
+
longitude: 24.9633,
|
|
236
|
+
name: "Helsinki-Vantaa",
|
|
237
|
+
tz: "Europe/Helsinki"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
code: "EGKK",
|
|
241
|
+
country: "GB",
|
|
242
|
+
ghcnh_id: null,
|
|
243
|
+
icao: "EGKK",
|
|
244
|
+
latitude: 51.1481,
|
|
245
|
+
longitude: -0.1903,
|
|
246
|
+
name: "London Gatwick",
|
|
247
|
+
tz: "Europe/London"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
code: "EGLL",
|
|
251
|
+
country: "GB",
|
|
252
|
+
ghcnh_id: null,
|
|
253
|
+
icao: "EGLL",
|
|
254
|
+
latitude: 51.4706,
|
|
255
|
+
longitude: -0.4619,
|
|
256
|
+
name: "London Heathrow",
|
|
257
|
+
tz: "Europe/London"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
code: "EHAM",
|
|
261
|
+
country: "NL",
|
|
262
|
+
ghcnh_id: null,
|
|
263
|
+
icao: "EHAM",
|
|
264
|
+
latitude: 52.3086,
|
|
265
|
+
longitude: 4.7639,
|
|
266
|
+
name: "Amsterdam Schiphol",
|
|
267
|
+
tz: "Europe/Amsterdam"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
code: "EKCH",
|
|
271
|
+
country: "DK",
|
|
272
|
+
ghcnh_id: null,
|
|
273
|
+
icao: "EKCH",
|
|
274
|
+
latitude: 55.6181,
|
|
275
|
+
longitude: 12.6561,
|
|
276
|
+
name: "Copenhagen Kastrup",
|
|
277
|
+
tz: "Europe/Copenhagen"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
code: "EPWA",
|
|
281
|
+
country: "PL",
|
|
282
|
+
ghcnh_id: null,
|
|
283
|
+
icao: "EPWA",
|
|
284
|
+
latitude: 52.1657,
|
|
285
|
+
longitude: 20.9671,
|
|
286
|
+
name: "Warsaw Chopin",
|
|
287
|
+
tz: "Europe/Warsaw"
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
code: "ESSA",
|
|
291
|
+
country: "SE",
|
|
292
|
+
ghcnh_id: null,
|
|
293
|
+
icao: "ESSA",
|
|
294
|
+
latitude: 59.6519,
|
|
295
|
+
longitude: 17.9186,
|
|
296
|
+
name: "Stockholm Arlanda",
|
|
297
|
+
tz: "Europe/Stockholm"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
code: "ATL",
|
|
301
|
+
country: "US",
|
|
302
|
+
ghcnh_id: "USW00013874",
|
|
303
|
+
icao: "KATL",
|
|
304
|
+
latitude: 33.6407,
|
|
305
|
+
longitude: -84.4277,
|
|
306
|
+
name: "Hartsfield-Jackson Atlanta International",
|
|
307
|
+
tz: "America/New_York"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
code: "AUS",
|
|
311
|
+
country: "US",
|
|
312
|
+
ghcnh_id: "USW00013904",
|
|
313
|
+
icao: "KAUS",
|
|
314
|
+
latitude: 30.1975,
|
|
315
|
+
longitude: -97.6664,
|
|
316
|
+
name: "Austin-Bergstrom International",
|
|
317
|
+
tz: "America/Chicago"
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
code: "BOS",
|
|
321
|
+
country: "US",
|
|
322
|
+
ghcnh_id: "USW00014739",
|
|
323
|
+
icao: "KBOS",
|
|
324
|
+
latitude: 42.3656,
|
|
325
|
+
longitude: -71.0096,
|
|
326
|
+
name: "Boston Logan International",
|
|
327
|
+
tz: "America/New_York"
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
code: "DCA",
|
|
331
|
+
country: "US",
|
|
332
|
+
ghcnh_id: "USW00013743",
|
|
333
|
+
icao: "KDCA",
|
|
334
|
+
latitude: 38.8512,
|
|
335
|
+
longitude: -77.0402,
|
|
336
|
+
name: "Washington Reagan National",
|
|
337
|
+
tz: "America/New_York"
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
code: "DEN",
|
|
341
|
+
country: "US",
|
|
342
|
+
ghcnh_id: "USW00003017",
|
|
343
|
+
icao: "KDEN",
|
|
344
|
+
latitude: 39.8561,
|
|
345
|
+
longitude: -104.6737,
|
|
346
|
+
name: "Denver International",
|
|
347
|
+
tz: "America/Denver"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
code: "DFW",
|
|
351
|
+
country: "US",
|
|
352
|
+
ghcnh_id: "USW00003927",
|
|
353
|
+
icao: "KDFW",
|
|
354
|
+
latitude: 32.8998,
|
|
355
|
+
longitude: -97.0403,
|
|
356
|
+
name: "Dallas-Fort Worth International",
|
|
357
|
+
tz: "America/Chicago"
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
code: "HOU",
|
|
361
|
+
country: "US",
|
|
362
|
+
ghcnh_id: "USW00012918",
|
|
363
|
+
icao: "KHOU",
|
|
364
|
+
latitude: 29.6454,
|
|
365
|
+
longitude: -95.2789,
|
|
366
|
+
name: "Houston Hobby",
|
|
367
|
+
tz: "America/Chicago"
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
code: "LAS",
|
|
371
|
+
country: "US",
|
|
372
|
+
ghcnh_id: "USW00023169",
|
|
373
|
+
icao: "KLAS",
|
|
374
|
+
latitude: 36.084,
|
|
375
|
+
longitude: -115.1537,
|
|
376
|
+
name: "Harry Reid (McCarran) International",
|
|
377
|
+
tz: "America/Los_Angeles"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
code: "LAX",
|
|
381
|
+
country: "US",
|
|
382
|
+
ghcnh_id: "USW00023174",
|
|
383
|
+
icao: "KLAX",
|
|
384
|
+
latitude: 33.9425,
|
|
385
|
+
longitude: -118.4081,
|
|
386
|
+
name: "Los Angeles International",
|
|
387
|
+
tz: "America/Los_Angeles"
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
code: "MDW",
|
|
391
|
+
country: "US",
|
|
392
|
+
ghcnh_id: "USW00014819",
|
|
393
|
+
icao: "KMDW",
|
|
394
|
+
latitude: 41.7868,
|
|
395
|
+
longitude: -87.7522,
|
|
396
|
+
name: "Chicago Midway International",
|
|
397
|
+
tz: "America/Chicago"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
code: "MIA",
|
|
401
|
+
country: "US",
|
|
402
|
+
ghcnh_id: "USW00012839",
|
|
403
|
+
icao: "KMIA",
|
|
404
|
+
latitude: 25.7959,
|
|
405
|
+
longitude: -80.287,
|
|
406
|
+
name: "Miami International",
|
|
407
|
+
tz: "America/New_York"
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
code: "MSP",
|
|
411
|
+
country: "US",
|
|
412
|
+
ghcnh_id: "USW00014922",
|
|
413
|
+
icao: "KMSP",
|
|
414
|
+
latitude: 44.8848,
|
|
415
|
+
longitude: -93.2223,
|
|
416
|
+
name: "Minneapolis-St Paul International",
|
|
417
|
+
tz: "America/Chicago"
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
code: "MSY",
|
|
421
|
+
country: "US",
|
|
422
|
+
ghcnh_id: "USW00012916",
|
|
423
|
+
icao: "KMSY",
|
|
424
|
+
latitude: 29.9934,
|
|
425
|
+
longitude: -90.258,
|
|
426
|
+
name: "New Orleans Louis Armstrong International",
|
|
427
|
+
tz: "America/Chicago"
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
code: "NYC",
|
|
431
|
+
country: "US",
|
|
432
|
+
ghcnh_id: "USW00094728",
|
|
433
|
+
icao: "KNYC",
|
|
434
|
+
latitude: 40.7789,
|
|
435
|
+
longitude: -73.9692,
|
|
436
|
+
name: "Central Park, New York",
|
|
437
|
+
tz: "America/New_York"
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
code: "OKC",
|
|
441
|
+
country: "US",
|
|
442
|
+
ghcnh_id: "USW00013967",
|
|
443
|
+
icao: "KOKC",
|
|
444
|
+
latitude: 35.3931,
|
|
445
|
+
longitude: -97.6007,
|
|
446
|
+
name: "Oklahoma City Will Rogers World",
|
|
447
|
+
tz: "America/Chicago"
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
code: "PHL",
|
|
451
|
+
country: "US",
|
|
452
|
+
ghcnh_id: "USW00013739",
|
|
453
|
+
icao: "KPHL",
|
|
454
|
+
latitude: 39.8721,
|
|
455
|
+
longitude: -75.2411,
|
|
456
|
+
name: "Philadelphia International",
|
|
457
|
+
tz: "America/New_York"
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
code: "PHX",
|
|
461
|
+
country: "US",
|
|
462
|
+
ghcnh_id: "USW00023183",
|
|
463
|
+
icao: "KPHX",
|
|
464
|
+
latitude: 33.4373,
|
|
465
|
+
longitude: -112.0078,
|
|
466
|
+
name: "Phoenix Sky Harbor International",
|
|
467
|
+
tz: "America/Phoenix"
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
code: "SAT",
|
|
471
|
+
country: "US",
|
|
472
|
+
ghcnh_id: "USW00012921",
|
|
473
|
+
icao: "KSAT",
|
|
474
|
+
latitude: 29.5337,
|
|
475
|
+
longitude: -98.4698,
|
|
476
|
+
name: "San Antonio International",
|
|
477
|
+
tz: "America/Chicago"
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
code: "SEA",
|
|
481
|
+
country: "US",
|
|
482
|
+
ghcnh_id: "USW00024233",
|
|
483
|
+
icao: "KSEA",
|
|
484
|
+
latitude: 47.4502,
|
|
485
|
+
longitude: -122.3088,
|
|
486
|
+
name: "Seattle-Tacoma International",
|
|
487
|
+
tz: "America/Los_Angeles"
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
code: "SFO",
|
|
491
|
+
country: "US",
|
|
492
|
+
ghcnh_id: "USW00023234",
|
|
493
|
+
icao: "KSFO",
|
|
494
|
+
latitude: 37.6213,
|
|
495
|
+
longitude: -122.379,
|
|
496
|
+
name: "San Francisco International",
|
|
497
|
+
tz: "America/Los_Angeles"
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
code: "LEBL",
|
|
501
|
+
country: "ES",
|
|
502
|
+
ghcnh_id: null,
|
|
503
|
+
icao: "LEBL",
|
|
504
|
+
latitude: 41.2974,
|
|
505
|
+
longitude: 2.0833,
|
|
506
|
+
name: "Barcelona El Prat",
|
|
507
|
+
tz: "Europe/Madrid"
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
code: "LEMD",
|
|
511
|
+
country: "ES",
|
|
512
|
+
ghcnh_id: null,
|
|
513
|
+
icao: "LEMD",
|
|
514
|
+
latitude: 40.4719,
|
|
515
|
+
longitude: -3.5626,
|
|
516
|
+
name: "Madrid Barajas",
|
|
517
|
+
tz: "Europe/Madrid"
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
code: "LFPB",
|
|
521
|
+
country: "FR",
|
|
522
|
+
ghcnh_id: null,
|
|
523
|
+
icao: "LFPB",
|
|
524
|
+
latitude: 48.9694,
|
|
525
|
+
longitude: 2.4414,
|
|
526
|
+
name: "Paris Le Bourget",
|
|
527
|
+
tz: "Europe/Paris"
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
code: "LFPG",
|
|
531
|
+
country: "FR",
|
|
532
|
+
ghcnh_id: null,
|
|
533
|
+
icao: "LFPG",
|
|
534
|
+
latitude: 49.0097,
|
|
535
|
+
longitude: 2.5479,
|
|
536
|
+
name: "Paris Charles de Gaulle",
|
|
537
|
+
tz: "Europe/Paris"
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
code: "LFPO",
|
|
541
|
+
country: "FR",
|
|
542
|
+
ghcnh_id: null,
|
|
543
|
+
icao: "LFPO",
|
|
544
|
+
latitude: 48.7233,
|
|
545
|
+
longitude: 2.3794,
|
|
546
|
+
name: "Paris Orly",
|
|
547
|
+
tz: "Europe/Paris"
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
code: "LIMC",
|
|
551
|
+
country: "IT",
|
|
552
|
+
ghcnh_id: null,
|
|
553
|
+
icao: "LIMC",
|
|
554
|
+
latitude: 45.6306,
|
|
555
|
+
longitude: 8.7281,
|
|
556
|
+
name: "Milan Malpensa",
|
|
557
|
+
tz: "Europe/Rome"
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
code: "LIRF",
|
|
561
|
+
country: "IT",
|
|
562
|
+
ghcnh_id: null,
|
|
563
|
+
icao: "LIRF",
|
|
564
|
+
latitude: 41.8003,
|
|
565
|
+
longitude: 12.2389,
|
|
566
|
+
name: "Rome Fiumicino",
|
|
567
|
+
tz: "Europe/Rome"
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
code: "LOWW",
|
|
571
|
+
country: "AT",
|
|
572
|
+
ghcnh_id: null,
|
|
573
|
+
icao: "LOWW",
|
|
574
|
+
latitude: 48.1103,
|
|
575
|
+
longitude: 16.5697,
|
|
576
|
+
name: "Vienna International",
|
|
577
|
+
tz: "Europe/Vienna"
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
code: "LSZH",
|
|
581
|
+
country: "CH",
|
|
582
|
+
ghcnh_id: null,
|
|
583
|
+
icao: "LSZH",
|
|
584
|
+
latitude: 47.4647,
|
|
585
|
+
longitude: 8.5492,
|
|
586
|
+
name: "Zurich",
|
|
587
|
+
tz: "Europe/Zurich"
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
code: "NZAA",
|
|
591
|
+
country: "NZ",
|
|
592
|
+
ghcnh_id: null,
|
|
593
|
+
icao: "NZAA",
|
|
594
|
+
latitude: -37.0081,
|
|
595
|
+
longitude: 174.7917,
|
|
596
|
+
name: "Auckland",
|
|
597
|
+
tz: "Pacific/Auckland"
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
code: "NZWN",
|
|
601
|
+
country: "NZ",
|
|
602
|
+
ghcnh_id: null,
|
|
603
|
+
icao: "NZWN",
|
|
604
|
+
latitude: -41.3272,
|
|
605
|
+
longitude: 174.8053,
|
|
606
|
+
name: "Wellington",
|
|
607
|
+
tz: "Pacific/Auckland"
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
code: "OERK",
|
|
611
|
+
country: "SA",
|
|
612
|
+
ghcnh_id: null,
|
|
613
|
+
icao: "OERK",
|
|
614
|
+
latitude: 24.9576,
|
|
615
|
+
longitude: 46.6988,
|
|
616
|
+
name: "Riyadh King Khalid International",
|
|
617
|
+
tz: "Asia/Riyadh"
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
code: "OMDB",
|
|
621
|
+
country: "AE",
|
|
622
|
+
ghcnh_id: null,
|
|
623
|
+
icao: "OMDB",
|
|
624
|
+
latitude: 25.2532,
|
|
625
|
+
longitude: 55.3657,
|
|
626
|
+
name: "Dubai International",
|
|
627
|
+
tz: "Asia/Dubai"
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
code: "OTHH",
|
|
631
|
+
country: "QA",
|
|
632
|
+
ghcnh_id: null,
|
|
633
|
+
icao: "OTHH",
|
|
634
|
+
latitude: 25.2731,
|
|
635
|
+
longitude: 51.608,
|
|
636
|
+
name: "Doha Hamad International",
|
|
637
|
+
tz: "Asia/Qatar"
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
code: "RCTP",
|
|
641
|
+
country: "TW",
|
|
642
|
+
ghcnh_id: null,
|
|
643
|
+
icao: "RCTP",
|
|
644
|
+
latitude: 25.0777,
|
|
645
|
+
longitude: 121.2328,
|
|
646
|
+
name: "Taipei Taoyuan",
|
|
647
|
+
tz: "Asia/Taipei"
|
|
648
|
+
},
|
|
649
|
+
{
|
|
650
|
+
code: "RJAA",
|
|
651
|
+
country: "JP",
|
|
652
|
+
ghcnh_id: null,
|
|
653
|
+
icao: "RJAA",
|
|
654
|
+
latitude: 35.7647,
|
|
655
|
+
longitude: 140.3864,
|
|
656
|
+
name: "Tokyo Narita",
|
|
657
|
+
tz: "Asia/Tokyo"
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
code: "RJTT",
|
|
661
|
+
country: "JP",
|
|
662
|
+
ghcnh_id: null,
|
|
663
|
+
icao: "RJTT",
|
|
664
|
+
latitude: 35.5522,
|
|
665
|
+
longitude: 139.78,
|
|
666
|
+
name: "Tokyo Haneda",
|
|
667
|
+
tz: "Asia/Tokyo"
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
code: "RKSI",
|
|
671
|
+
country: "KR",
|
|
672
|
+
ghcnh_id: null,
|
|
673
|
+
icao: "RKSI",
|
|
674
|
+
latitude: 37.4691,
|
|
675
|
+
longitude: 126.4505,
|
|
676
|
+
name: "Seoul Incheon",
|
|
677
|
+
tz: "Asia/Seoul"
|
|
678
|
+
},
|
|
679
|
+
{
|
|
680
|
+
code: "SAEZ",
|
|
681
|
+
country: "AR",
|
|
682
|
+
ghcnh_id: null,
|
|
683
|
+
icao: "SAEZ",
|
|
684
|
+
latitude: -34.8222,
|
|
685
|
+
longitude: -58.5358,
|
|
686
|
+
name: "Buenos Aires Ezeiza",
|
|
687
|
+
tz: "America/Argentina/Buenos_Aires"
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
code: "SBGR",
|
|
691
|
+
country: "BR",
|
|
692
|
+
ghcnh_id: null,
|
|
693
|
+
icao: "SBGR",
|
|
694
|
+
latitude: -23.4356,
|
|
695
|
+
longitude: -46.4731,
|
|
696
|
+
name: "S\xE3o Paulo Guarulhos",
|
|
697
|
+
tz: "America/Sao_Paulo"
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
code: "UUEE",
|
|
701
|
+
country: "RU",
|
|
702
|
+
ghcnh_id: null,
|
|
703
|
+
icao: "UUEE",
|
|
704
|
+
latitude: 55.9728,
|
|
705
|
+
longitude: 37.4147,
|
|
706
|
+
name: "Moscow Sheremetyevo",
|
|
707
|
+
tz: "Europe/Moscow"
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
code: "VABB",
|
|
711
|
+
country: "IN",
|
|
712
|
+
ghcnh_id: null,
|
|
713
|
+
icao: "VABB",
|
|
714
|
+
latitude: 19.0887,
|
|
715
|
+
longitude: 72.8679,
|
|
716
|
+
name: "Mumbai Chhatrapati Shivaji",
|
|
717
|
+
tz: "Asia/Kolkata"
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
code: "VHHH",
|
|
721
|
+
country: "HK",
|
|
722
|
+
ghcnh_id: null,
|
|
723
|
+
icao: "VHHH",
|
|
724
|
+
latitude: 22.308,
|
|
725
|
+
longitude: 113.9185,
|
|
726
|
+
name: "Hong Kong International",
|
|
727
|
+
tz: "Asia/Hong_Kong"
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
code: "VIDP",
|
|
731
|
+
country: "IN",
|
|
732
|
+
ghcnh_id: null,
|
|
733
|
+
icao: "VIDP",
|
|
734
|
+
latitude: 28.5562,
|
|
735
|
+
longitude: 77.1,
|
|
736
|
+
name: "Delhi Indira Gandhi",
|
|
737
|
+
tz: "Asia/Kolkata"
|
|
738
|
+
},
|
|
739
|
+
{
|
|
740
|
+
code: "VTBS",
|
|
741
|
+
country: "TH",
|
|
742
|
+
ghcnh_id: null,
|
|
743
|
+
icao: "VTBS",
|
|
744
|
+
latitude: 13.69,
|
|
745
|
+
longitude: 100.7501,
|
|
746
|
+
name: "Bangkok Suvarnabhumi",
|
|
747
|
+
tz: "Asia/Bangkok"
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
code: "WSSS",
|
|
751
|
+
country: "SG",
|
|
752
|
+
ghcnh_id: null,
|
|
753
|
+
icao: "WSSS",
|
|
754
|
+
latitude: 1.3644,
|
|
755
|
+
longitude: 103.9915,
|
|
756
|
+
name: "Singapore Changi",
|
|
757
|
+
tz: "Asia/Singapore"
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
code: "YBBN",
|
|
761
|
+
country: "AU",
|
|
762
|
+
ghcnh_id: null,
|
|
763
|
+
icao: "YBBN",
|
|
764
|
+
latitude: -27.3842,
|
|
765
|
+
longitude: 153.1175,
|
|
766
|
+
name: "Brisbane",
|
|
767
|
+
tz: "Australia/Brisbane"
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
code: "YMML",
|
|
771
|
+
country: "AU",
|
|
772
|
+
ghcnh_id: null,
|
|
773
|
+
icao: "YMML",
|
|
774
|
+
latitude: -37.6733,
|
|
775
|
+
longitude: 144.8433,
|
|
776
|
+
name: "Melbourne Tullamarine",
|
|
777
|
+
tz: "Australia/Melbourne"
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
code: "YSSY",
|
|
781
|
+
country: "AU",
|
|
782
|
+
ghcnh_id: null,
|
|
783
|
+
icao: "YSSY",
|
|
784
|
+
latitude: -33.9461,
|
|
785
|
+
longitude: 151.1772,
|
|
786
|
+
name: "Sydney Kingsford Smith",
|
|
787
|
+
tz: "Australia/Sydney"
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
code: "ZBAA",
|
|
791
|
+
country: "CN",
|
|
792
|
+
ghcnh_id: null,
|
|
793
|
+
icao: "ZBAA",
|
|
794
|
+
latitude: 40.0801,
|
|
795
|
+
longitude: 116.5846,
|
|
796
|
+
name: "Beijing Capital",
|
|
797
|
+
tz: "Asia/Shanghai"
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
code: "ZSPD",
|
|
801
|
+
country: "CN",
|
|
802
|
+
ghcnh_id: null,
|
|
803
|
+
icao: "ZSPD",
|
|
804
|
+
latitude: 31.1443,
|
|
805
|
+
longitude: 121.8083,
|
|
806
|
+
name: "Shanghai Pudong",
|
|
807
|
+
tz: "Asia/Shanghai"
|
|
808
|
+
}
|
|
809
|
+
];
|
|
810
|
+
var STATION_BY_CODE = /* @__PURE__ */ new Map([
|
|
811
|
+
["ATL", STATIONS[10]],
|
|
812
|
+
["AUS", STATIONS[11]],
|
|
813
|
+
["BOS", STATIONS[12]],
|
|
814
|
+
["DCA", STATIONS[13]],
|
|
815
|
+
["DEN", STATIONS[14]],
|
|
816
|
+
["DFW", STATIONS[15]],
|
|
817
|
+
["EDDB", STATIONS[0]],
|
|
818
|
+
["EDDF", STATIONS[1]],
|
|
819
|
+
["EDDM", STATIONS[2]],
|
|
820
|
+
["EFHK", STATIONS[3]],
|
|
821
|
+
["EGKK", STATIONS[4]],
|
|
822
|
+
["EGLL", STATIONS[5]],
|
|
823
|
+
["EHAM", STATIONS[6]],
|
|
824
|
+
["EKCH", STATIONS[7]],
|
|
825
|
+
["EPWA", STATIONS[8]],
|
|
826
|
+
["ESSA", STATIONS[9]],
|
|
827
|
+
["HOU", STATIONS[16]],
|
|
828
|
+
["LAS", STATIONS[17]],
|
|
829
|
+
["LAX", STATIONS[18]],
|
|
830
|
+
["LEBL", STATIONS[30]],
|
|
831
|
+
["LEMD", STATIONS[31]],
|
|
832
|
+
["LFPB", STATIONS[32]],
|
|
833
|
+
["LFPG", STATIONS[33]],
|
|
834
|
+
["LFPO", STATIONS[34]],
|
|
835
|
+
["LIMC", STATIONS[35]],
|
|
836
|
+
["LIRF", STATIONS[36]],
|
|
837
|
+
["LOWW", STATIONS[37]],
|
|
838
|
+
["LSZH", STATIONS[38]],
|
|
839
|
+
["MDW", STATIONS[19]],
|
|
840
|
+
["MIA", STATIONS[20]],
|
|
841
|
+
["MSP", STATIONS[21]],
|
|
842
|
+
["MSY", STATIONS[22]],
|
|
843
|
+
["NYC", STATIONS[23]],
|
|
844
|
+
["NZAA", STATIONS[39]],
|
|
845
|
+
["NZWN", STATIONS[40]],
|
|
846
|
+
["OERK", STATIONS[41]],
|
|
847
|
+
["OKC", STATIONS[24]],
|
|
848
|
+
["OMDB", STATIONS[42]],
|
|
849
|
+
["OTHH", STATIONS[43]],
|
|
850
|
+
["PHL", STATIONS[25]],
|
|
851
|
+
["PHX", STATIONS[26]],
|
|
852
|
+
["RCTP", STATIONS[44]],
|
|
853
|
+
["RJAA", STATIONS[45]],
|
|
854
|
+
["RJTT", STATIONS[46]],
|
|
855
|
+
["RKSI", STATIONS[47]],
|
|
856
|
+
["SAEZ", STATIONS[48]],
|
|
857
|
+
["SAT", STATIONS[27]],
|
|
858
|
+
["SBGR", STATIONS[49]],
|
|
859
|
+
["SEA", STATIONS[28]],
|
|
860
|
+
["SFO", STATIONS[29]],
|
|
861
|
+
["UUEE", STATIONS[50]],
|
|
862
|
+
["VABB", STATIONS[51]],
|
|
863
|
+
["VHHH", STATIONS[52]],
|
|
864
|
+
["VIDP", STATIONS[53]],
|
|
865
|
+
["VTBS", STATIONS[54]],
|
|
866
|
+
["WSSS", STATIONS[55]],
|
|
867
|
+
["YBBN", STATIONS[56]],
|
|
868
|
+
["YMML", STATIONS[57]],
|
|
869
|
+
["YSSY", STATIONS[58]],
|
|
870
|
+
["ZBAA", STATIONS[59]],
|
|
871
|
+
["ZSPD", STATIONS[60]]
|
|
872
|
+
]);
|
|
873
|
+
var STATION_BY_ICAO = /* @__PURE__ */ new Map([
|
|
874
|
+
["EDDB", STATIONS[0]],
|
|
875
|
+
["EDDF", STATIONS[1]],
|
|
876
|
+
["EDDM", STATIONS[2]],
|
|
877
|
+
["EFHK", STATIONS[3]],
|
|
878
|
+
["EGKK", STATIONS[4]],
|
|
879
|
+
["EGLL", STATIONS[5]],
|
|
880
|
+
["EHAM", STATIONS[6]],
|
|
881
|
+
["EKCH", STATIONS[7]],
|
|
882
|
+
["EPWA", STATIONS[8]],
|
|
883
|
+
["ESSA", STATIONS[9]],
|
|
884
|
+
["KATL", STATIONS[10]],
|
|
885
|
+
["KAUS", STATIONS[11]],
|
|
886
|
+
["KBOS", STATIONS[12]],
|
|
887
|
+
["KDCA", STATIONS[13]],
|
|
888
|
+
["KDEN", STATIONS[14]],
|
|
889
|
+
["KDFW", STATIONS[15]],
|
|
890
|
+
["KHOU", STATIONS[16]],
|
|
891
|
+
["KLAS", STATIONS[17]],
|
|
892
|
+
["KLAX", STATIONS[18]],
|
|
893
|
+
["KMDW", STATIONS[19]],
|
|
894
|
+
["KMIA", STATIONS[20]],
|
|
895
|
+
["KMSP", STATIONS[21]],
|
|
896
|
+
["KMSY", STATIONS[22]],
|
|
897
|
+
["KNYC", STATIONS[23]],
|
|
898
|
+
["KOKC", STATIONS[24]],
|
|
899
|
+
["KPHL", STATIONS[25]],
|
|
900
|
+
["KPHX", STATIONS[26]],
|
|
901
|
+
["KSAT", STATIONS[27]],
|
|
902
|
+
["KSEA", STATIONS[28]],
|
|
903
|
+
["KSFO", STATIONS[29]],
|
|
904
|
+
["LEBL", STATIONS[30]],
|
|
905
|
+
["LEMD", STATIONS[31]],
|
|
906
|
+
["LFPB", STATIONS[32]],
|
|
907
|
+
["LFPG", STATIONS[33]],
|
|
908
|
+
["LFPO", STATIONS[34]],
|
|
909
|
+
["LIMC", STATIONS[35]],
|
|
910
|
+
["LIRF", STATIONS[36]],
|
|
911
|
+
["LOWW", STATIONS[37]],
|
|
912
|
+
["LSZH", STATIONS[38]],
|
|
913
|
+
["NZAA", STATIONS[39]],
|
|
914
|
+
["NZWN", STATIONS[40]],
|
|
915
|
+
["OERK", STATIONS[41]],
|
|
916
|
+
["OMDB", STATIONS[42]],
|
|
917
|
+
["OTHH", STATIONS[43]],
|
|
918
|
+
["RCTP", STATIONS[44]],
|
|
919
|
+
["RJAA", STATIONS[45]],
|
|
920
|
+
["RJTT", STATIONS[46]],
|
|
921
|
+
["RKSI", STATIONS[47]],
|
|
922
|
+
["SAEZ", STATIONS[48]],
|
|
923
|
+
["SBGR", STATIONS[49]],
|
|
924
|
+
["UUEE", STATIONS[50]],
|
|
925
|
+
["VABB", STATIONS[51]],
|
|
926
|
+
["VHHH", STATIONS[52]],
|
|
927
|
+
["VIDP", STATIONS[53]],
|
|
928
|
+
["VTBS", STATIONS[54]],
|
|
929
|
+
["WSSS", STATIONS[55]],
|
|
930
|
+
["YBBN", STATIONS[56]],
|
|
931
|
+
["YMML", STATIONS[57]],
|
|
932
|
+
["YSSY", STATIONS[58]],
|
|
933
|
+
["ZBAA", STATIONS[59]],
|
|
934
|
+
["ZSPD", STATIONS[60]]
|
|
935
|
+
]);
|
|
936
|
+
|
|
937
|
+
// src/snapshot.ts
|
|
938
|
+
var _STATION_TZ = Object.freeze({
|
|
939
|
+
// Eastern (UTC-5 standard / UTC-4 DST)
|
|
940
|
+
NYC: "America/New_York",
|
|
941
|
+
JFK: "America/New_York",
|
|
942
|
+
LGA: "America/New_York",
|
|
943
|
+
EWR: "America/New_York",
|
|
944
|
+
ATL: "America/New_York",
|
|
945
|
+
BOS: "America/New_York",
|
|
946
|
+
PHL: "America/New_York",
|
|
947
|
+
DCA: "America/New_York",
|
|
948
|
+
IAD: "America/New_York",
|
|
949
|
+
BWI: "America/New_York",
|
|
950
|
+
MIA: "America/New_York",
|
|
951
|
+
MCO: "America/New_York",
|
|
952
|
+
TPA: "America/New_York",
|
|
953
|
+
CLT: "America/New_York",
|
|
954
|
+
RDU: "America/New_York",
|
|
955
|
+
CLE: "America/New_York",
|
|
956
|
+
PIT: "America/New_York",
|
|
957
|
+
BUF: "America/New_York",
|
|
958
|
+
DTW: "America/Detroit",
|
|
959
|
+
IND: "America/Indiana/Indianapolis",
|
|
960
|
+
CVG: "America/New_York",
|
|
961
|
+
CMH: "America/New_York",
|
|
962
|
+
SYR: "America/New_York",
|
|
963
|
+
ALB: "America/New_York",
|
|
964
|
+
BTV: "America/New_York",
|
|
965
|
+
ORF: "America/New_York",
|
|
966
|
+
RIC: "America/New_York",
|
|
967
|
+
GSO: "America/New_York",
|
|
968
|
+
CHS: "America/New_York",
|
|
969
|
+
SAV: "America/New_York",
|
|
970
|
+
JAX: "America/New_York",
|
|
971
|
+
RSW: "America/New_York",
|
|
972
|
+
PBI: "America/New_York",
|
|
973
|
+
FLL: "America/New_York",
|
|
974
|
+
// Central (UTC-6 standard / UTC-5 DST)
|
|
975
|
+
ORD: "America/Chicago",
|
|
976
|
+
MDW: "America/Chicago",
|
|
977
|
+
DFW: "America/Chicago",
|
|
978
|
+
DAL: "America/Chicago",
|
|
979
|
+
IAH: "America/Chicago",
|
|
980
|
+
HOU: "America/Chicago",
|
|
981
|
+
MSP: "America/Chicago",
|
|
982
|
+
STL: "America/Chicago",
|
|
983
|
+
MCI: "America/Chicago",
|
|
984
|
+
OMA: "America/Chicago",
|
|
985
|
+
MKE: "America/Chicago",
|
|
986
|
+
MSY: "America/Chicago",
|
|
987
|
+
MEM: "America/Chicago",
|
|
988
|
+
BNA: "America/Chicago",
|
|
989
|
+
OKC: "America/Chicago",
|
|
990
|
+
SAT: "America/Chicago",
|
|
991
|
+
AUS: "America/Chicago",
|
|
992
|
+
DSM: "America/Chicago",
|
|
993
|
+
TUL: "America/Chicago",
|
|
994
|
+
LIT: "America/Chicago",
|
|
995
|
+
BIR: "America/Chicago",
|
|
996
|
+
SDF: "America/Chicago",
|
|
997
|
+
HSV: "America/Chicago",
|
|
998
|
+
BHM: "America/Chicago",
|
|
999
|
+
MOB: "America/Chicago",
|
|
1000
|
+
BTR: "America/Chicago",
|
|
1001
|
+
SHV: "America/Chicago",
|
|
1002
|
+
// Mountain (UTC-7 standard / UTC-6 DST)
|
|
1003
|
+
DEN: "America/Denver",
|
|
1004
|
+
SLC: "America/Denver",
|
|
1005
|
+
ABQ: "America/Denver",
|
|
1006
|
+
BOI: "America/Boise",
|
|
1007
|
+
BZN: "America/Denver",
|
|
1008
|
+
GJT: "America/Denver",
|
|
1009
|
+
// Arizona: no DST (UTC-7 always)
|
|
1010
|
+
PHX: "America/Phoenix",
|
|
1011
|
+
TUS: "America/Phoenix",
|
|
1012
|
+
// Pacific (UTC-8 standard / UTC-7 DST)
|
|
1013
|
+
LAX: "America/Los_Angeles",
|
|
1014
|
+
SFO: "America/Los_Angeles",
|
|
1015
|
+
SEA: "America/Los_Angeles",
|
|
1016
|
+
PDX: "America/Los_Angeles",
|
|
1017
|
+
LAS: "America/Los_Angeles",
|
|
1018
|
+
SAN: "America/Los_Angeles",
|
|
1019
|
+
OAK: "America/Los_Angeles",
|
|
1020
|
+
SJC: "America/Los_Angeles",
|
|
1021
|
+
SMF: "America/Los_Angeles",
|
|
1022
|
+
RNO: "America/Los_Angeles",
|
|
1023
|
+
FAT: "America/Los_Angeles",
|
|
1024
|
+
SNA: "America/Los_Angeles",
|
|
1025
|
+
ONT: "America/Los_Angeles",
|
|
1026
|
+
BUR: "America/Los_Angeles",
|
|
1027
|
+
// Alaska (UTC-9 standard / UTC-8 DST)
|
|
1028
|
+
ANC: "America/Anchorage",
|
|
1029
|
+
FAI: "America/Anchorage",
|
|
1030
|
+
JNU: "America/Juneau",
|
|
1031
|
+
// Hawaii (UTC-10, no DST)
|
|
1032
|
+
HNL: "Pacific/Honolulu",
|
|
1033
|
+
OGG: "Pacific/Honolulu",
|
|
1034
|
+
KOA: "Pacific/Honolulu",
|
|
1035
|
+
// International (iter-6 H12): minimal set required to un-skip the
|
|
1036
|
+
// case-5 RJTT year-wrap cache behavior test. Python's
|
|
1037
|
+
// `mostlyright.snapshot._resolve_tz` falls back to the broader STATIONS
|
|
1038
|
+
// registry for intl ICAOs; the TS port hasn't ported that fallback
|
|
1039
|
+
// yet (tracked as TS-W6 — exhaustive intl-station tz coverage). This
|
|
1040
|
+
// entry closes H12 cleanly without pulling the whole STATIONS map in.
|
|
1041
|
+
// ICAO key (RJTT) — international stations have no 3-letter NWS code.
|
|
1042
|
+
// Tokyo Haneda — UTC+9 LST, no DST.
|
|
1043
|
+
RJTT: "Asia/Tokyo"
|
|
1044
|
+
});
|
|
1045
|
+
var _JAN_REF = new Date(Date.UTC(2024, 0, 15, 12, 0, 0));
|
|
1046
|
+
var _OFFSET_CACHE = /* @__PURE__ */ new Map();
|
|
1047
|
+
function _lstOffsetHours(stationTz) {
|
|
1048
|
+
const cached = _OFFSET_CACHE.get(stationTz);
|
|
1049
|
+
if (cached !== void 0) return cached;
|
|
1050
|
+
const fmt = new Intl.DateTimeFormat("en-US", {
|
|
1051
|
+
timeZone: stationTz,
|
|
1052
|
+
hour12: false,
|
|
1053
|
+
year: "numeric",
|
|
1054
|
+
month: "2-digit",
|
|
1055
|
+
day: "2-digit",
|
|
1056
|
+
hour: "2-digit",
|
|
1057
|
+
minute: "2-digit",
|
|
1058
|
+
second: "2-digit"
|
|
1059
|
+
});
|
|
1060
|
+
const parts = fmt.formatToParts(_JAN_REF);
|
|
1061
|
+
const get = (type) => {
|
|
1062
|
+
const part = parts.find((p) => p.type === type);
|
|
1063
|
+
if (!part) {
|
|
1064
|
+
throw new Error(`Intl.DateTimeFormat missing ${type} for tz=${stationTz}`);
|
|
1065
|
+
}
|
|
1066
|
+
return Number(part.value);
|
|
1067
|
+
};
|
|
1068
|
+
const year = get("year");
|
|
1069
|
+
const month = get("month");
|
|
1070
|
+
const day = get("day");
|
|
1071
|
+
let hour = get("hour");
|
|
1072
|
+
const minute = get("minute");
|
|
1073
|
+
const second = get("second");
|
|
1074
|
+
if (hour === 24) hour = 0;
|
|
1075
|
+
const localAsUtc = Date.UTC(year, month - 1, day, hour, minute, second);
|
|
1076
|
+
const offsetMs = localAsUtc - _JAN_REF.getTime();
|
|
1077
|
+
const offsetHours = offsetMs / 36e5;
|
|
1078
|
+
_OFFSET_CACHE.set(stationTz, offsetHours);
|
|
1079
|
+
return offsetHours;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
// src/internal/cache/skip-rules.ts
|
|
1083
|
+
function _lstOffsetHoursFor(station) {
|
|
1084
|
+
const upper = station.trim().toUpperCase();
|
|
1085
|
+
const byCode = STATION_BY_CODE.get(upper);
|
|
1086
|
+
if (byCode !== void 0) return _lstOffsetHours(byCode.tz);
|
|
1087
|
+
const byIcao = STATION_BY_ICAO.get(upper);
|
|
1088
|
+
if (byIcao !== void 0) return _lstOffsetHours(byIcao.tz);
|
|
1089
|
+
if (upper.length === 4 && upper.startsWith("K")) {
|
|
1090
|
+
const stripped = upper.slice(1);
|
|
1091
|
+
const retry = STATION_BY_CODE.get(stripped);
|
|
1092
|
+
if (retry !== void 0) return _lstOffsetHours(retry.tz);
|
|
1093
|
+
}
|
|
1094
|
+
throw new RangeError(`unknown station: ${JSON.stringify(station)}`);
|
|
1095
|
+
}
|
|
1096
|
+
function _nowLst(station, now = /* @__PURE__ */ new Date()) {
|
|
1097
|
+
const offsetHours = _lstOffsetHoursFor(station);
|
|
1098
|
+
return new Date(now.getTime() + offsetHours * 36e5);
|
|
1099
|
+
}
|
|
1100
|
+
function shouldSkipCacheForCurrentLstMonth(station, year, month, now) {
|
|
1101
|
+
const lst = _nowLst(station, now);
|
|
1102
|
+
return lst.getUTCFullYear() === year && lst.getUTCMonth() + 1 === month;
|
|
1103
|
+
}
|
|
1104
|
+
function shouldSkipCacheForCurrentLstYear(station, year, now) {
|
|
1105
|
+
const lst = _nowLst(station, now);
|
|
1106
|
+
return lst.getUTCFullYear() === year;
|
|
1107
|
+
}
|
|
1108
|
+
function isWritableMonth(year, month, now) {
|
|
1109
|
+
const nowYear = now.getUTCFullYear();
|
|
1110
|
+
const nowMonth = now.getUTCMonth() + 1;
|
|
1111
|
+
if (year < nowYear) return true;
|
|
1112
|
+
if (year > nowYear) return false;
|
|
1113
|
+
return month < nowMonth;
|
|
1114
|
+
}
|
|
1115
|
+
function isWritableYear(year, now) {
|
|
1116
|
+
return year < now.getUTCFullYear();
|
|
1117
|
+
}
|
|
1118
|
+
function isLiveSource(source) {
|
|
1119
|
+
return typeof source === "string" && source.length > 0 && source.endsWith(".live");
|
|
1120
|
+
}
|
|
1121
|
+
function isWithinVolatileWindow(eventDate, archiveAsOf, days = 30) {
|
|
1122
|
+
const e = Date.parse(`${eventDate}T00:00:00Z`);
|
|
1123
|
+
const a = Date.parse(`${archiveAsOf}T00:00:00Z`);
|
|
1124
|
+
if (!Number.isFinite(e) || !Number.isFinite(a)) {
|
|
1125
|
+
throw new RangeError(
|
|
1126
|
+
`invalid YYYY-MM-DD: eventDate=${JSON.stringify(eventDate)} archiveAsOf=${JSON.stringify(archiveAsOf)}`
|
|
1127
|
+
);
|
|
1128
|
+
}
|
|
1129
|
+
const deltaDays = (a - e) / 864e5;
|
|
1130
|
+
return deltaDays >= 0 && deltaDays <= days;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
// src/internal/cache/keys.ts
|
|
1134
|
+
var MIN_YEAR = 1900;
|
|
1135
|
+
var MAX_YEAR = 2100;
|
|
1136
|
+
var SOURCE_RE = /^[a-z0-9_-]+$/;
|
|
1137
|
+
function cacheKeyForObservations(station, year, month, source) {
|
|
1138
|
+
if (!Number.isInteger(year) || year < MIN_YEAR || year > MAX_YEAR) {
|
|
1139
|
+
throw new RangeError(`year out of range: ${year}`);
|
|
1140
|
+
}
|
|
1141
|
+
if (!Number.isInteger(month) || month < 1 || month > 12) {
|
|
1142
|
+
throw new RangeError(`month out of range: ${month}`);
|
|
1143
|
+
}
|
|
1144
|
+
const yyyy = String(year).padStart(4, "0");
|
|
1145
|
+
const mm = String(month).padStart(2, "0");
|
|
1146
|
+
const base = `mostlyright:v1:observations:${station.toUpperCase()}:${yyyy}:${mm}`;
|
|
1147
|
+
if (source === void 0) return base;
|
|
1148
|
+
if (typeof source !== "string" || !SOURCE_RE.test(source)) {
|
|
1149
|
+
throw new RangeError(
|
|
1150
|
+
`source must match ${SOURCE_RE.source} (lowercase alnum / hyphen / underscore); got ${JSON.stringify(source)}`
|
|
1151
|
+
);
|
|
1152
|
+
}
|
|
1153
|
+
return `${base}:${source}`;
|
|
1154
|
+
}
|
|
1155
|
+
function cacheKeyForClimate(station, year) {
|
|
1156
|
+
if (!Number.isInteger(year) || year < MIN_YEAR || year > MAX_YEAR) {
|
|
1157
|
+
throw new RangeError(`year out of range: ${year}`);
|
|
1158
|
+
}
|
|
1159
|
+
const yyyy = String(year).padStart(4, "0");
|
|
1160
|
+
return `mostlyright:v1:climate:${station.toUpperCase()}:${yyyy}`;
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
// src/internal/cache/index.browser.ts
|
|
1164
|
+
async function defaultCacheStore() {
|
|
1165
|
+
if (typeof indexedDB !== "undefined") return new IndexedDBStore();
|
|
1166
|
+
return new MemoryStore();
|
|
1167
|
+
}
|
|
1168
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1169
|
+
0 && (module.exports = {
|
|
1170
|
+
INDEXEDDB_DB_NAME,
|
|
1171
|
+
IndexedDBStore,
|
|
1172
|
+
MemoryStore,
|
|
1173
|
+
cacheKeyForClimate,
|
|
1174
|
+
cacheKeyForObservations,
|
|
1175
|
+
defaultCacheStore,
|
|
1176
|
+
isLiveSource,
|
|
1177
|
+
isWithinVolatileWindow,
|
|
1178
|
+
isWritableMonth,
|
|
1179
|
+
isWritableYear,
|
|
1180
|
+
lockKeyFor,
|
|
1181
|
+
shouldSkipCacheForCurrentLstMonth,
|
|
1182
|
+
shouldSkipCacheForCurrentLstYear
|
|
1183
|
+
});
|
|
1184
|
+
//# sourceMappingURL=index.browser.cjs.map
|