From 8d1b7bfd4d4f3b58d65c1b6dbd52154f03686e43 Mon Sep 17 00:00:00 2001 From: Lani Aung Date: Thu, 5 Jun 2025 07:31:05 -0700 Subject: [PATCH] It works --- src/crack.ts | 49 +++++++----- src/launch.ts | 10 ++- src/sand-painter.ts | 8 +- src/state.ts | 49 +++++++++--- src/styles.less | 7 -- src/substrate.ts | 33 ++++---- www/index.html | 1 - www/main.js | 178 ++++---------------------------------------- www/styles.css | 4 - 9 files changed, 113 insertions(+), 226 deletions(-) diff --git a/src/crack.ts b/src/crack.ts index 8a07422..bc9beb1 100644 --- a/src/crack.ts +++ b/src/crack.ts @@ -2,7 +2,6 @@ import SandPainter from "./sand-painter" import State from "./state" export default class Crack { - private static padding = .66 private x: number = 0 private y: number = 0 private angle: number = 0 @@ -10,29 +9,17 @@ export default class Crack { private state: State constructor(state: State) { - this.painter = new SandPainter(state) + this.painter = new SandPainter(state.getRandomColor()) this.state = state this.init() } init() { - let x = 0, y = 0, found = false, tries = 0 - while (!found && tries++ < 1000) { - x = Math.random() * this.state.width - y = Math.random() * this.state.height - found = this.state.crackGrid[y * this.state.height + x] < 10000 - } - - if (!found) { - console.warn("Unable to start crack due to timeout") - return - } - - const negative = Math.random() < 0.5 - let value = this.state.crackGrid[y * this.state.height + x] - - if (negative) value -= 90 + Math.floor(Math.random() * 4.1 - 2) - else value += 90 + Math.floor(Math.random() * 4.1 - 2) + const index = Math.floor(Math.random() * this.state.seeds.length) + const {x, y} = this.state.seeds.splice(index, 1)[0] + const flip = Math.random() < 0.5 + let angle = this.state.grid[x][y] + this.start(x, y, angle + (90 + Math.floor(Math.random() * 4.1 - 2)) * (flip ? -1 : 1)) } start(x: number, y: number, angle: number) { @@ -41,8 +28,30 @@ export default class Crack { this.angle = angle } - continue() { + draw() { this.x += .42 * Math.cos(this.angle * Math.PI / 180) this.y += .42 * Math.sin(this.angle * Math.PI / 180) + + const context = this.state.canvas.getContext("2d") + context.fillStyle = "#000" + context.fillRect(this.x, this.y, 1, 1) + + const x = Math.floor(this.x) + const y = Math.floor(this.y) + const height = this.state.canvas.height + const width = this.state.canvas.width + if (x >= 0 && x < width && y >= 0 && y < height) { + const seed = this.state.grid[x][y] + if (seed > 10000 || Math.abs(seed - this.angle) < 5) { + this.state.grid[x][y] = Math.floor(this.angle) + this.state.seeds.push({x, y}) + } else if (Math.abs(seed - this.angle) > 2) { + this.init() + this.state.addCrack() + } + } else { + this.init() + this.state.addCrack() + } } } \ No newline at end of file diff --git a/src/launch.ts b/src/launch.ts index b730bfc..88be0f0 100644 --- a/src/launch.ts +++ b/src/launch.ts @@ -1,10 +1,16 @@ import Substrate from "./substrate" import Weather from "./weather" -const background = new Substrate("substrate-canvas", 20) +const ready = (func: () => void) => document.readyState !== "loading" ? func() : document.addEventListener("DOMContentLoaded", func) +ready(() => { + new Substrate(20) +}) + +/* let weather: Weather navigator.geolocation.getCurrentPosition(position => { weather = new Weather(position.coords.latitude, position.coords.longitude) }, () => { weather = new Weather() -}) \ No newline at end of file +}) + */ \ No newline at end of file diff --git a/src/sand-painter.ts b/src/sand-painter.ts index 4d814f4..583450a 100644 --- a/src/sand-painter.ts +++ b/src/sand-painter.ts @@ -4,8 +4,12 @@ export default class SandPainter { private color: number private gain: number - constructor(state: State) { - this.color = state.getRandomColor() + constructor(color: number) { + this.color = color this.gain = Math.random() / 10 } + + render() { + + } } \ No newline at end of file diff --git a/src/state.ts b/src/state.ts index ed9e67d..cbf83aa 100644 --- a/src/state.ts +++ b/src/state.ts @@ -1,26 +1,51 @@ -export default class State { - colors: number[] - maxCracks: number - crackGrid: number[] - height: number - width: number +import Crack from "./crack" - constructor(colors: number[], maxCracks: number, height: number, width: number) { +export default class State { + readonly canvas: HTMLCanvasElement + readonly colors: number[] + readonly maxCracks: number + readonly grid: number[][] + seeds: {x: number, y: number}[] + cracks: Crack[] + + constructor(colors: number[], maxCracks: number, canvas: HTMLCanvasElement) { + this.canvas = canvas this.colors = colors this.maxCracks = maxCracks - this.height = height - this.width = width - this.crackGrid = [] + this.grid = [] + this.cracks = [] + + this.init() + } + + init() { + this.seeds = [] + const height = this.canvas.height + const width = this.canvas.width + const context = this.canvas.getContext("2d") + context.fillStyle = "rgb(255 255 255 / 95%)" + context.fillRect(0, 0, width, height) for (let x = 0; x < width; x++) { + if (!this.grid[x]) this.grid[x] = [] + for (let y = 0; y < height; y++) { - this.crackGrid[y * width + x] = 10000 + this.grid[x][y] = 10001 } } for (let i = 0; i < 16; i++) { - this.crackGrid[Math.floor(Math.random() * (height * width))] = Math.ceil(Math.random() * 360) + const x = Math.floor(Math.random() * width) + const y = Math.floor(Math.random() * height) + this.grid[x][y] = Math.floor(Math.random() * 360) + this.seeds.push({x, y}) } + + this.cracks = [new Crack(this), new Crack(this), new Crack(this)] + } + + addCrack() { + if (this.cracks.length < this.maxCracks) this.cracks.push(new Crack(this)) } getRandomColor(): number { diff --git a/src/styles.less b/src/styles.less index b1bd28c..64b9114 100644 --- a/src/styles.less +++ b/src/styles.less @@ -4,11 +4,4 @@ body { margin: 0; overflow: hidden; padding: 0; -} - -body { - canvas { - height: 100%; - width: 100%; - } } \ No newline at end of file diff --git a/src/substrate.ts b/src/substrate.ts index 8ae06df..49bb54e 100644 --- a/src/substrate.ts +++ b/src/substrate.ts @@ -2,27 +2,34 @@ import State from "./state" export default class Substrate { - private readonly canvas: HTMLCanvasElement private readonly state: State - constructor(id: string, maxCracks: number, colors?: number[]) { + constructor(maxCracks: number, colors?: number[]) { if (!colors?.length) colors = [ 0x3a1e3e, 0x7c2d3b, 0xb94f3c, 0xf4a462, 0xf9c54e ] // https://colormagic.app/palette/671eeb6c42273fc4c1bb1ac7 - let canvas = document.getElementById(id) as HTMLCanvasElement - if (!canvas) { - canvas = document.createElement("canvas") - document.body.appendChild(canvas) - } - - this.canvas = canvas - this.state = new State(colors, maxCracks, canvas.clientHeight, canvas.clientWidth) + const canvas = document.createElement("canvas") + canvas.width = document.body.clientWidth + canvas.height = document.body.clientHeight + document.body.appendChild(canvas) + this.state = new State(colors, maxCracks, canvas) this.init() } init() { - const context = this.canvas.getContext("2d") - context.fillStyle = "#fff" - context.fillRect(0, 0, this.canvas.width, this.canvas.height) + const me = this + let request: number + const draw = () => { + for (const crack of me.state.cracks) crack.draw() + request = requestAnimationFrame(draw) + } + + setInterval(() => { + cancelAnimationFrame(request) + me.state.init() + request = requestAnimationFrame(draw) + }, 60 * 1000) + + request = requestAnimationFrame(draw) } } \ No newline at end of file diff --git a/www/index.html b/www/index.html index 0b3ae12..36c31e6 100644 --- a/www/index.html +++ b/www/index.html @@ -6,7 +6,6 @@ -
diff --git a/www/main.js b/www/main.js index 90dec4a..ba7a541 100644 --- a/www/main.js +++ b/www/main.js @@ -10,143 +10,13 @@ /******/ "use strict"; /******/ var __webpack_modules__ = ({ -/***/ "./node_modules/@openmeteo/sdk/aggregation.js": -/*!****************************************************!*\ - !*** ./node_modules/@openmeteo/sdk/aggregation.js ***! - \****************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -eval("\n// automatically generated by the FlatBuffers compiler, do not modify\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Aggregation = void 0;\n/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */\nvar Aggregation;\n(function (Aggregation) {\n Aggregation[Aggregation[\"none\"] = 0] = \"none\";\n Aggregation[Aggregation[\"minimum\"] = 1] = \"minimum\";\n Aggregation[Aggregation[\"maximum\"] = 2] = \"maximum\";\n Aggregation[Aggregation[\"mean\"] = 3] = \"mean\";\n Aggregation[Aggregation[\"p10\"] = 4] = \"p10\";\n Aggregation[Aggregation[\"p25\"] = 5] = \"p25\";\n Aggregation[Aggregation[\"median\"] = 6] = \"median\";\n Aggregation[Aggregation[\"p75\"] = 7] = \"p75\";\n Aggregation[Aggregation[\"p90\"] = 8] = \"p90\";\n Aggregation[Aggregation[\"dominant\"] = 9] = \"dominant\";\n Aggregation[Aggregation[\"sum\"] = 10] = \"sum\";\n Aggregation[Aggregation[\"spread\"] = 11] = \"spread\";\n})(Aggregation || (exports.Aggregation = Aggregation = {}));\n\n\n//# sourceURL=webpack:///./node_modules/@openmeteo/sdk/aggregation.js?"); - -/***/ }), - -/***/ "./node_modules/@openmeteo/sdk/model.js": -/*!**********************************************!*\ - !*** ./node_modules/@openmeteo/sdk/model.js ***! - \**********************************************/ -/***/ ((__unused_webpack_module, exports) => { - -eval("\n// automatically generated by the FlatBuffers compiler, do not modify\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Model = void 0;\n/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */\nvar Model;\n(function (Model) {\n Model[Model[\"undefined\"] = 0] = \"undefined\";\n Model[Model[\"best_match\"] = 1] = \"best_match\";\n Model[Model[\"gfs_seamless\"] = 2] = \"gfs_seamless\";\n Model[Model[\"gfs_global\"] = 3] = \"gfs_global\";\n Model[Model[\"gfs_hrrr\"] = 4] = \"gfs_hrrr\";\n Model[Model[\"meteofrance_seamless\"] = 5] = \"meteofrance_seamless\";\n Model[Model[\"meteofrance_arpege_seamless\"] = 6] = \"meteofrance_arpege_seamless\";\n Model[Model[\"meteofrance_arpege_world\"] = 7] = \"meteofrance_arpege_world\";\n Model[Model[\"meteofrance_arpege_europe\"] = 8] = \"meteofrance_arpege_europe\";\n Model[Model[\"meteofrance_arome_seamless\"] = 9] = \"meteofrance_arome_seamless\";\n Model[Model[\"meteofrance_arome_france\"] = 10] = \"meteofrance_arome_france\";\n Model[Model[\"meteofrance_arome_france_hd\"] = 11] = \"meteofrance_arome_france_hd\";\n Model[Model[\"jma_seamless\"] = 12] = \"jma_seamless\";\n Model[Model[\"jma_msm\"] = 13] = \"jma_msm\";\n Model[Model[\"jms_gsm\"] = 14] = \"jms_gsm\";\n Model[Model[\"jma_gsm\"] = 15] = \"jma_gsm\";\n Model[Model[\"gem_seamless\"] = 16] = \"gem_seamless\";\n Model[Model[\"gem_global\"] = 17] = \"gem_global\";\n Model[Model[\"gem_regional\"] = 18] = \"gem_regional\";\n Model[Model[\"gem_hrdps_continental\"] = 19] = \"gem_hrdps_continental\";\n Model[Model[\"icon_seamless\"] = 20] = \"icon_seamless\";\n Model[Model[\"icon_global\"] = 21] = \"icon_global\";\n Model[Model[\"icon_eu\"] = 22] = \"icon_eu\";\n Model[Model[\"icon_d2\"] = 23] = \"icon_d2\";\n Model[Model[\"ecmwf_ifs04\"] = 24] = \"ecmwf_ifs04\";\n Model[Model[\"metno_nordic\"] = 25] = \"metno_nordic\";\n Model[Model[\"era5_seamless\"] = 26] = \"era5_seamless\";\n Model[Model[\"era5\"] = 27] = \"era5\";\n Model[Model[\"cerra\"] = 28] = \"cerra\";\n Model[Model[\"era5_land\"] = 29] = \"era5_land\";\n Model[Model[\"ecmwf_ifs\"] = 30] = \"ecmwf_ifs\";\n Model[Model[\"gwam\"] = 31] = \"gwam\";\n Model[Model[\"ewam\"] = 32] = \"ewam\";\n Model[Model[\"glofas_seamless_v3\"] = 33] = \"glofas_seamless_v3\";\n Model[Model[\"glofas_forecast_v3\"] = 34] = \"glofas_forecast_v3\";\n Model[Model[\"glofas_consolidated_v3\"] = 35] = \"glofas_consolidated_v3\";\n Model[Model[\"glofas_seamless_v4\"] = 36] = \"glofas_seamless_v4\";\n Model[Model[\"glofas_forecast_v4\"] = 37] = \"glofas_forecast_v4\";\n Model[Model[\"glofas_consolidated_v4\"] = 38] = \"glofas_consolidated_v4\";\n Model[Model[\"gfs025\"] = 39] = \"gfs025\";\n Model[Model[\"gfs05\"] = 40] = \"gfs05\";\n Model[Model[\"CMCC_CM2_VHR4\"] = 41] = \"CMCC_CM2_VHR4\";\n Model[Model[\"FGOALS_f3_H_highresSST\"] = 42] = \"FGOALS_f3_H_highresSST\";\n Model[Model[\"FGOALS_f3_H\"] = 43] = \"FGOALS_f3_H\";\n Model[Model[\"HiRAM_SIT_HR\"] = 44] = \"HiRAM_SIT_HR\";\n Model[Model[\"MRI_AGCM3_2_S\"] = 45] = \"MRI_AGCM3_2_S\";\n Model[Model[\"EC_Earth3P_HR\"] = 46] = \"EC_Earth3P_HR\";\n Model[Model[\"MPI_ESM1_2_XR\"] = 47] = \"MPI_ESM1_2_XR\";\n Model[Model[\"NICAM16_8S\"] = 48] = \"NICAM16_8S\";\n Model[Model[\"cams_europe\"] = 49] = \"cams_europe\";\n Model[Model[\"cams_global\"] = 50] = \"cams_global\";\n Model[Model[\"cfsv2\"] = 51] = \"cfsv2\";\n Model[Model[\"era5_ocean\"] = 52] = \"era5_ocean\";\n Model[Model[\"cma_grapes_global\"] = 53] = \"cma_grapes_global\";\n Model[Model[\"bom_access_global\"] = 54] = \"bom_access_global\";\n Model[Model[\"bom_access_global_ensemble\"] = 55] = \"bom_access_global_ensemble\";\n Model[Model[\"arpae_cosmo_seamless\"] = 56] = \"arpae_cosmo_seamless\";\n Model[Model[\"arpae_cosmo_2i\"] = 57] = \"arpae_cosmo_2i\";\n Model[Model[\"arpae_cosmo_2i_ruc\"] = 58] = \"arpae_cosmo_2i_ruc\";\n Model[Model[\"arpae_cosmo_5m\"] = 59] = \"arpae_cosmo_5m\";\n Model[Model[\"ecmwf_ifs025\"] = 60] = \"ecmwf_ifs025\";\n Model[Model[\"ecmwf_aifs025\"] = 61] = \"ecmwf_aifs025\";\n Model[Model[\"gfs013\"] = 62] = \"gfs013\";\n Model[Model[\"gfs_graphcast025\"] = 63] = \"gfs_graphcast025\";\n Model[Model[\"ecmwf_wam025\"] = 64] = \"ecmwf_wam025\";\n Model[Model[\"meteofrance_wave\"] = 65] = \"meteofrance_wave\";\n Model[Model[\"meteofrance_currents\"] = 66] = \"meteofrance_currents\";\n Model[Model[\"ecmwf_wam025_ensemble\"] = 67] = \"ecmwf_wam025_ensemble\";\n Model[Model[\"ncep_gfswave025\"] = 68] = \"ncep_gfswave025\";\n Model[Model[\"ncep_gefswave025\"] = 69] = \"ncep_gefswave025\";\n Model[Model[\"knmi_seamless\"] = 70] = \"knmi_seamless\";\n Model[Model[\"knmi_harmonie_arome_europe\"] = 71] = \"knmi_harmonie_arome_europe\";\n Model[Model[\"knmi_harmonie_arome_netherlands\"] = 72] = \"knmi_harmonie_arome_netherlands\";\n Model[Model[\"dmi_seamless\"] = 73] = \"dmi_seamless\";\n Model[Model[\"dmi_harmonie_arome_europe\"] = 74] = \"dmi_harmonie_arome_europe\";\n Model[Model[\"metno_seamless\"] = 75] = \"metno_seamless\";\n Model[Model[\"era5_ensemble\"] = 76] = \"era5_ensemble\";\n Model[Model[\"ecmwf_ifs_analysis\"] = 77] = \"ecmwf_ifs_analysis\";\n Model[Model[\"ecmwf_ifs_long_window\"] = 78] = \"ecmwf_ifs_long_window\";\n Model[Model[\"ecmwf_ifs_analysis_long_window\"] = 79] = \"ecmwf_ifs_analysis_long_window\";\n Model[Model[\"ukmo_global_deterministic_10km\"] = 80] = \"ukmo_global_deterministic_10km\";\n Model[Model[\"ukmo_uk_deterministic_2km\"] = 81] = \"ukmo_uk_deterministic_2km\";\n Model[Model[\"ukmo_seamless\"] = 82] = \"ukmo_seamless\";\n Model[Model[\"ncep_gfswave016\"] = 83] = \"ncep_gfswave016\";\n Model[Model[\"ncep_nbm_conus\"] = 84] = \"ncep_nbm_conus\";\n Model[Model[\"ukmo_global_ensemble_20km\"] = 85] = \"ukmo_global_ensemble_20km\";\n Model[Model[\"ecmwf_aifs025_single\"] = 86] = \"ecmwf_aifs025_single\";\n Model[Model[\"jma_jaxa_himawari\"] = 87] = \"jma_jaxa_himawari\";\n Model[Model[\"eumetsat_sarah3\"] = 88] = \"eumetsat_sarah3\";\n Model[Model[\"eumetsat_lsa_saf_msg\"] = 89] = \"eumetsat_lsa_saf_msg\";\n Model[Model[\"eumetsat_lsa_saf_iodc\"] = 90] = \"eumetsat_lsa_saf_iodc\";\n Model[Model[\"satellite_radiation_seamless\"] = 91] = \"satellite_radiation_seamless\";\n Model[Model[\"kma_gdps\"] = 92] = \"kma_gdps\";\n Model[Model[\"kma_ldps\"] = 93] = \"kma_ldps\";\n Model[Model[\"kma_seamless\"] = 94] = \"kma_seamless\";\n Model[Model[\"italia_meteo_arpae_icon_2i\"] = 95] = \"italia_meteo_arpae_icon_2i\";\n})(Model || (exports.Model = Model = {}));\n\n\n//# sourceURL=webpack:///./node_modules/@openmeteo/sdk/model.js?"); - -/***/ }), - -/***/ "./node_modules/@openmeteo/sdk/unit.js": -/*!*********************************************!*\ - !*** ./node_modules/@openmeteo/sdk/unit.js ***! - \*********************************************/ -/***/ ((__unused_webpack_module, exports) => { - -eval("\n// automatically generated by the FlatBuffers compiler, do not modify\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Unit = void 0;\n/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */\nvar Unit;\n(function (Unit) {\n Unit[Unit[\"undefined\"] = 0] = \"undefined\";\n Unit[Unit[\"celsius\"] = 1] = \"celsius\";\n Unit[Unit[\"centimetre\"] = 2] = \"centimetre\";\n Unit[Unit[\"cubic_metre_per_cubic_metre\"] = 3] = \"cubic_metre_per_cubic_metre\";\n Unit[Unit[\"cubic_metre_per_second\"] = 4] = \"cubic_metre_per_second\";\n Unit[Unit[\"degree_direction\"] = 5] = \"degree_direction\";\n Unit[Unit[\"dimensionless_integer\"] = 6] = \"dimensionless_integer\";\n Unit[Unit[\"dimensionless\"] = 7] = \"dimensionless\";\n Unit[Unit[\"european_air_quality_index\"] = 8] = \"european_air_quality_index\";\n Unit[Unit[\"fahrenheit\"] = 9] = \"fahrenheit\";\n Unit[Unit[\"feet\"] = 10] = \"feet\";\n Unit[Unit[\"fraction\"] = 11] = \"fraction\";\n Unit[Unit[\"gdd_celsius\"] = 12] = \"gdd_celsius\";\n Unit[Unit[\"geopotential_metre\"] = 13] = \"geopotential_metre\";\n Unit[Unit[\"grains_per_cubic_metre\"] = 14] = \"grains_per_cubic_metre\";\n Unit[Unit[\"gram_per_kilogram\"] = 15] = \"gram_per_kilogram\";\n Unit[Unit[\"hectopascal\"] = 16] = \"hectopascal\";\n Unit[Unit[\"hours\"] = 17] = \"hours\";\n Unit[Unit[\"inch\"] = 18] = \"inch\";\n Unit[Unit[\"iso8601\"] = 19] = \"iso8601\";\n Unit[Unit[\"joule_per_kilogram\"] = 20] = \"joule_per_kilogram\";\n Unit[Unit[\"kelvin\"] = 21] = \"kelvin\";\n Unit[Unit[\"kilopascal\"] = 22] = \"kilopascal\";\n Unit[Unit[\"kilogram_per_square_metre\"] = 23] = \"kilogram_per_square_metre\";\n Unit[Unit[\"kilometres_per_hour\"] = 24] = \"kilometres_per_hour\";\n Unit[Unit[\"knots\"] = 25] = \"knots\";\n Unit[Unit[\"megajoule_per_square_metre\"] = 26] = \"megajoule_per_square_metre\";\n Unit[Unit[\"metre_per_second_not_unit_converted\"] = 27] = \"metre_per_second_not_unit_converted\";\n Unit[Unit[\"metre_per_second\"] = 28] = \"metre_per_second\";\n Unit[Unit[\"metre\"] = 29] = \"metre\";\n Unit[Unit[\"micrograms_per_cubic_metre\"] = 30] = \"micrograms_per_cubic_metre\";\n Unit[Unit[\"miles_per_hour\"] = 31] = \"miles_per_hour\";\n Unit[Unit[\"millimetre\"] = 32] = \"millimetre\";\n Unit[Unit[\"pascal\"] = 33] = \"pascal\";\n Unit[Unit[\"per_second\"] = 34] = \"per_second\";\n Unit[Unit[\"percentage\"] = 35] = \"percentage\";\n Unit[Unit[\"seconds\"] = 36] = \"seconds\";\n Unit[Unit[\"unix_time\"] = 37] = \"unix_time\";\n Unit[Unit[\"us_air_quality_index\"] = 38] = \"us_air_quality_index\";\n Unit[Unit[\"watt_per_square_metre\"] = 39] = \"watt_per_square_metre\";\n Unit[Unit[\"wmo_code\"] = 40] = \"wmo_code\";\n Unit[Unit[\"parts_per_million\"] = 41] = \"parts_per_million\";\n})(Unit || (exports.Unit = Unit = {}));\n\n\n//# sourceURL=webpack:///./node_modules/@openmeteo/sdk/unit.js?"); - -/***/ }), - -/***/ "./node_modules/@openmeteo/sdk/variable-with-values.js": -/*!*************************************************************!*\ - !*** ./node_modules/@openmeteo/sdk/variable-with-values.js ***! - \*************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -eval("\n// automatically generated by the FlatBuffers compiler, do not modify\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || (function () {\n var ownKeys = function(o) {\n ownKeys = Object.getOwnPropertyNames || function (o) {\n var ar = [];\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n };\n return function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n __setModuleDefault(result, mod);\n return result;\n };\n})();\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.VariableWithValues = void 0;\n/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */\nconst flatbuffers = __importStar(__webpack_require__(/*! flatbuffers */ \"./node_modules/flatbuffers/mjs/flatbuffers.js\"));\nconst aggregation_js_1 = __webpack_require__(/*! ./aggregation.js */ \"./node_modules/@openmeteo/sdk/aggregation.js\");\nconst unit_js_1 = __webpack_require__(/*! ./unit.js */ \"./node_modules/@openmeteo/sdk/unit.js\");\nconst variable_js_1 = __webpack_require__(/*! ./variable.js */ \"./node_modules/@openmeteo/sdk/variable.js\");\nclass VariableWithValues {\n constructor() {\n this.bb = null;\n this.bb_pos = 0;\n }\n __init(i, bb) {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n static getRootAsVariableWithValues(bb, obj) {\n return (obj || new VariableWithValues()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n static getSizePrefixedRootAsVariableWithValues(bb, obj) {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new VariableWithValues()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n variable() {\n const offset = this.bb.__offset(this.bb_pos, 4);\n return offset ? this.bb.readUint8(this.bb_pos + offset) : variable_js_1.Variable.undefined;\n }\n unit() {\n const offset = this.bb.__offset(this.bb_pos, 6);\n return offset ? this.bb.readUint8(this.bb_pos + offset) : unit_js_1.Unit.undefined;\n }\n value() {\n const offset = this.bb.__offset(this.bb_pos, 8);\n return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0;\n }\n values(index) {\n const offset = this.bb.__offset(this.bb_pos, 10);\n return offset ? this.bb.readFloat32(this.bb.__vector(this.bb_pos + offset) + index * 4) : 0;\n }\n valuesLength() {\n const offset = this.bb.__offset(this.bb_pos, 10);\n return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;\n }\n valuesArray() {\n const offset = this.bb.__offset(this.bb_pos, 10);\n return offset ? new Float32Array(this.bb.bytes().buffer, this.bb.bytes().byteOffset + this.bb.__vector(this.bb_pos + offset), this.bb.__vector_len(this.bb_pos + offset)) : null;\n }\n valuesInt64(index) {\n const offset = this.bb.__offset(this.bb_pos, 12);\n return offset ? this.bb.readInt64(this.bb.__vector(this.bb_pos + offset) + index * 8) : BigInt(0);\n }\n valuesInt64Length() {\n const offset = this.bb.__offset(this.bb_pos, 12);\n return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;\n }\n altitude() {\n const offset = this.bb.__offset(this.bb_pos, 14);\n return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;\n }\n aggregation() {\n const offset = this.bb.__offset(this.bb_pos, 16);\n return offset ? this.bb.readUint8(this.bb_pos + offset) : aggregation_js_1.Aggregation.none;\n }\n pressureLevel() {\n const offset = this.bb.__offset(this.bb_pos, 18);\n return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;\n }\n depth() {\n const offset = this.bb.__offset(this.bb_pos, 20);\n return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;\n }\n depthTo() {\n const offset = this.bb.__offset(this.bb_pos, 22);\n return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;\n }\n ensembleMember() {\n const offset = this.bb.__offset(this.bb_pos, 24);\n return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;\n }\n previousDay() {\n const offset = this.bb.__offset(this.bb_pos, 26);\n return offset ? this.bb.readInt16(this.bb_pos + offset) : 0;\n }\n}\nexports.VariableWithValues = VariableWithValues;\n\n\n//# sourceURL=webpack:///./node_modules/@openmeteo/sdk/variable-with-values.js?"); - -/***/ }), - -/***/ "./node_modules/@openmeteo/sdk/variable.js": -/*!*************************************************!*\ - !*** ./node_modules/@openmeteo/sdk/variable.js ***! - \*************************************************/ -/***/ ((__unused_webpack_module, exports) => { - -eval("\n// automatically generated by the FlatBuffers compiler, do not modify\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.Variable = void 0;\n/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */\nvar Variable;\n(function (Variable) {\n Variable[Variable[\"undefined\"] = 0] = \"undefined\";\n Variable[Variable[\"apparent_temperature\"] = 1] = \"apparent_temperature\";\n Variable[Variable[\"cape\"] = 2] = \"cape\";\n Variable[Variable[\"cloud_cover\"] = 3] = \"cloud_cover\";\n Variable[Variable[\"cloud_cover_high\"] = 4] = \"cloud_cover_high\";\n Variable[Variable[\"cloud_cover_low\"] = 5] = \"cloud_cover_low\";\n Variable[Variable[\"cloud_cover_mid\"] = 6] = \"cloud_cover_mid\";\n Variable[Variable[\"daylight_duration\"] = 7] = \"daylight_duration\";\n Variable[Variable[\"dew_point\"] = 8] = \"dew_point\";\n Variable[Variable[\"diffuse_radiation\"] = 9] = \"diffuse_radiation\";\n Variable[Variable[\"diffuse_radiation_instant\"] = 10] = \"diffuse_radiation_instant\";\n Variable[Variable[\"direct_normal_irradiance\"] = 11] = \"direct_normal_irradiance\";\n Variable[Variable[\"direct_normal_irradiance_instant\"] = 12] = \"direct_normal_irradiance_instant\";\n Variable[Variable[\"direct_radiation\"] = 13] = \"direct_radiation\";\n Variable[Variable[\"direct_radiation_instant\"] = 14] = \"direct_radiation_instant\";\n Variable[Variable[\"et0_fao_evapotranspiration\"] = 15] = \"et0_fao_evapotranspiration\";\n Variable[Variable[\"evapotranspiration\"] = 16] = \"evapotranspiration\";\n Variable[Variable[\"freezing_level_height\"] = 17] = \"freezing_level_height\";\n Variable[Variable[\"growing_degree_days\"] = 18] = \"growing_degree_days\";\n Variable[Variable[\"is_day\"] = 19] = \"is_day\";\n Variable[Variable[\"latent_heat_flux\"] = 20] = \"latent_heat_flux\";\n Variable[Variable[\"leaf_wetness_probability\"] = 21] = \"leaf_wetness_probability\";\n Variable[Variable[\"lifted_index\"] = 22] = \"lifted_index\";\n Variable[Variable[\"lightning_potential\"] = 23] = \"lightning_potential\";\n Variable[Variable[\"precipitation\"] = 24] = \"precipitation\";\n Variable[Variable[\"precipitation_hours\"] = 25] = \"precipitation_hours\";\n Variable[Variable[\"precipitation_probability\"] = 26] = \"precipitation_probability\";\n Variable[Variable[\"pressure_msl\"] = 27] = \"pressure_msl\";\n Variable[Variable[\"rain\"] = 28] = \"rain\";\n Variable[Variable[\"relative_humidity\"] = 29] = \"relative_humidity\";\n Variable[Variable[\"runoff\"] = 30] = \"runoff\";\n Variable[Variable[\"sensible_heat_flux\"] = 31] = \"sensible_heat_flux\";\n Variable[Variable[\"shortwave_radiation\"] = 32] = \"shortwave_radiation\";\n Variable[Variable[\"shortwave_radiation_instant\"] = 33] = \"shortwave_radiation_instant\";\n Variable[Variable[\"showers\"] = 34] = \"showers\";\n Variable[Variable[\"snow_depth\"] = 35] = \"snow_depth\";\n Variable[Variable[\"snow_height\"] = 36] = \"snow_height\";\n Variable[Variable[\"snowfall\"] = 37] = \"snowfall\";\n Variable[Variable[\"snowfall_height\"] = 38] = \"snowfall_height\";\n Variable[Variable[\"snowfall_water_equivalent\"] = 39] = \"snowfall_water_equivalent\";\n Variable[Variable[\"sunrise\"] = 40] = \"sunrise\";\n Variable[Variable[\"sunset\"] = 41] = \"sunset\";\n Variable[Variable[\"soil_moisture\"] = 42] = \"soil_moisture\";\n Variable[Variable[\"soil_moisture_index\"] = 43] = \"soil_moisture_index\";\n Variable[Variable[\"soil_temperature\"] = 44] = \"soil_temperature\";\n Variable[Variable[\"surface_pressure\"] = 45] = \"surface_pressure\";\n Variable[Variable[\"surface_temperature\"] = 46] = \"surface_temperature\";\n Variable[Variable[\"temperature\"] = 47] = \"temperature\";\n Variable[Variable[\"terrestrial_radiation\"] = 48] = \"terrestrial_radiation\";\n Variable[Variable[\"terrestrial_radiation_instant\"] = 49] = \"terrestrial_radiation_instant\";\n Variable[Variable[\"total_column_integrated_water_vapour\"] = 50] = \"total_column_integrated_water_vapour\";\n Variable[Variable[\"updraft\"] = 51] = \"updraft\";\n Variable[Variable[\"uv_index\"] = 52] = \"uv_index\";\n Variable[Variable[\"uv_index_clear_sky\"] = 53] = \"uv_index_clear_sky\";\n Variable[Variable[\"vapour_pressure_deficit\"] = 54] = \"vapour_pressure_deficit\";\n Variable[Variable[\"visibility\"] = 55] = \"visibility\";\n Variable[Variable[\"weather_code\"] = 56] = \"weather_code\";\n Variable[Variable[\"wind_direction\"] = 57] = \"wind_direction\";\n Variable[Variable[\"wind_gusts\"] = 58] = \"wind_gusts\";\n Variable[Variable[\"wind_speed\"] = 59] = \"wind_speed\";\n Variable[Variable[\"vertical_velocity\"] = 60] = \"vertical_velocity\";\n Variable[Variable[\"geopotential_height\"] = 61] = \"geopotential_height\";\n Variable[Variable[\"wet_bulb_temperature\"] = 62] = \"wet_bulb_temperature\";\n Variable[Variable[\"river_discharge\"] = 63] = \"river_discharge\";\n Variable[Variable[\"wave_height\"] = 64] = \"wave_height\";\n Variable[Variable[\"wave_period\"] = 65] = \"wave_period\";\n Variable[Variable[\"wave_direction\"] = 66] = \"wave_direction\";\n Variable[Variable[\"wind_wave_height\"] = 67] = \"wind_wave_height\";\n Variable[Variable[\"wind_wave_period\"] = 68] = \"wind_wave_period\";\n Variable[Variable[\"wind_wave_peak_period\"] = 69] = \"wind_wave_peak_period\";\n Variable[Variable[\"wind_wave_direction\"] = 70] = \"wind_wave_direction\";\n Variable[Variable[\"swell_wave_height\"] = 71] = \"swell_wave_height\";\n Variable[Variable[\"swell_wave_period\"] = 72] = \"swell_wave_period\";\n Variable[Variable[\"swell_wave_peak_period\"] = 73] = \"swell_wave_peak_period\";\n Variable[Variable[\"swell_wave_direction\"] = 74] = \"swell_wave_direction\";\n Variable[Variable[\"pm10\"] = 75] = \"pm10\";\n Variable[Variable[\"pm2p5\"] = 76] = \"pm2p5\";\n Variable[Variable[\"dust\"] = 77] = \"dust\";\n Variable[Variable[\"aerosol_optical_depth\"] = 78] = \"aerosol_optical_depth\";\n Variable[Variable[\"carbon_monoxide\"] = 79] = \"carbon_monoxide\";\n Variable[Variable[\"nitrogen_dioxide\"] = 80] = \"nitrogen_dioxide\";\n Variable[Variable[\"ammonia\"] = 81] = \"ammonia\";\n Variable[Variable[\"ozone\"] = 82] = \"ozone\";\n Variable[Variable[\"sulphur_dioxide\"] = 83] = \"sulphur_dioxide\";\n Variable[Variable[\"alder_pollen\"] = 84] = \"alder_pollen\";\n Variable[Variable[\"birch_pollen\"] = 85] = \"birch_pollen\";\n Variable[Variable[\"grass_pollen\"] = 86] = \"grass_pollen\";\n Variable[Variable[\"mugwort_pollen\"] = 87] = \"mugwort_pollen\";\n Variable[Variable[\"olive_pollen\"] = 88] = \"olive_pollen\";\n Variable[Variable[\"ragweed_pollen\"] = 89] = \"ragweed_pollen\";\n Variable[Variable[\"european_aqi\"] = 90] = \"european_aqi\";\n Variable[Variable[\"european_aqi_pm2p5\"] = 91] = \"european_aqi_pm2p5\";\n Variable[Variable[\"european_aqi_pm10\"] = 92] = \"european_aqi_pm10\";\n Variable[Variable[\"european_aqi_nitrogen_dioxide\"] = 93] = \"european_aqi_nitrogen_dioxide\";\n Variable[Variable[\"european_aqi_ozone\"] = 94] = \"european_aqi_ozone\";\n Variable[Variable[\"european_aqi_sulphur_dioxide\"] = 95] = \"european_aqi_sulphur_dioxide\";\n Variable[Variable[\"us_aqi\"] = 96] = \"us_aqi\";\n Variable[Variable[\"us_aqi_pm2p5\"] = 97] = \"us_aqi_pm2p5\";\n Variable[Variable[\"us_aqi_pm10\"] = 98] = \"us_aqi_pm10\";\n Variable[Variable[\"us_aqi_nitrogen_dioxide\"] = 99] = \"us_aqi_nitrogen_dioxide\";\n Variable[Variable[\"us_aqi_ozone\"] = 100] = \"us_aqi_ozone\";\n Variable[Variable[\"us_aqi_sulphur_dioxide\"] = 101] = \"us_aqi_sulphur_dioxide\";\n Variable[Variable[\"us_aqi_carbon_monoxide\"] = 102] = \"us_aqi_carbon_monoxide\";\n Variable[Variable[\"sunshine_duration\"] = 103] = \"sunshine_duration\";\n Variable[Variable[\"convective_inhibition\"] = 104] = \"convective_inhibition\";\n Variable[Variable[\"shortwave_radiation_clear_sky\"] = 105] = \"shortwave_radiation_clear_sky\";\n Variable[Variable[\"global_tilted_irradiance\"] = 106] = \"global_tilted_irradiance\";\n Variable[Variable[\"global_tilted_irradiance_instant\"] = 107] = \"global_tilted_irradiance_instant\";\n Variable[Variable[\"ocean_current_velocity\"] = 108] = \"ocean_current_velocity\";\n Variable[Variable[\"ocean_current_direction\"] = 109] = \"ocean_current_direction\";\n Variable[Variable[\"cloud_base\"] = 110] = \"cloud_base\";\n Variable[Variable[\"cloud_top\"] = 111] = \"cloud_top\";\n Variable[Variable[\"mass_density\"] = 112] = \"mass_density\";\n Variable[Variable[\"boundary_layer_height\"] = 113] = \"boundary_layer_height\";\n Variable[Variable[\"formaldehyde\"] = 114] = \"formaldehyde\";\n Variable[Variable[\"glyoxal\"] = 115] = \"glyoxal\";\n Variable[Variable[\"non_methane_volatile_organic_compounds\"] = 116] = \"non_methane_volatile_organic_compounds\";\n Variable[Variable[\"pm10_wildfires\"] = 117] = \"pm10_wildfires\";\n Variable[Variable[\"peroxyacyl_nitrates\"] = 118] = \"peroxyacyl_nitrates\";\n Variable[Variable[\"secondary_inorganic_aerosol\"] = 119] = \"secondary_inorganic_aerosol\";\n Variable[Variable[\"residential_elementary_carbon\"] = 120] = \"residential_elementary_carbon\";\n Variable[Variable[\"total_elementary_carbon\"] = 121] = \"total_elementary_carbon\";\n Variable[Variable[\"pm2_5_total_organic_matter\"] = 122] = \"pm2_5_total_organic_matter\";\n Variable[Variable[\"sea_salt_aerosol\"] = 123] = \"sea_salt_aerosol\";\n Variable[Variable[\"nitrogen_monoxide\"] = 124] = \"nitrogen_monoxide\";\n Variable[Variable[\"thunderstorm_probability\"] = 125] = \"thunderstorm_probability\";\n Variable[Variable[\"rain_probability\"] = 126] = \"rain_probability\";\n Variable[Variable[\"freezing_rain_probability\"] = 127] = \"freezing_rain_probability\";\n Variable[Variable[\"ice_pellets_probability\"] = 128] = \"ice_pellets_probability\";\n Variable[Variable[\"snowfall_probability\"] = 129] = \"snowfall_probability\";\n Variable[Variable[\"carbon_dioxide\"] = 130] = \"carbon_dioxide\";\n Variable[Variable[\"methane\"] = 131] = \"methane\";\n Variable[Variable[\"sea_level_height_msl\"] = 132] = \"sea_level_height_msl\";\n Variable[Variable[\"sea_surface_temperature\"] = 133] = \"sea_surface_temperature\";\n Variable[Variable[\"invert_barometer_height\"] = 134] = \"invert_barometer_height\";\n Variable[Variable[\"hail\"] = 135] = \"hail\";\n Variable[Variable[\"albedo\"] = 136] = \"albedo\";\n Variable[Variable[\"precipitation_type\"] = 137] = \"precipitation_type\";\n Variable[Variable[\"convective_cloud_base\"] = 138] = \"convective_cloud_base\";\n Variable[Variable[\"convective_cloud_top\"] = 139] = \"convective_cloud_top\";\n Variable[Variable[\"snow_depth_water_equivalent\"] = 140] = \"snow_depth_water_equivalent\";\n Variable[Variable[\"secondary_swell_wave_height\"] = 141] = \"secondary_swell_wave_height\";\n Variable[Variable[\"secondary_swell_wave_period\"] = 142] = \"secondary_swell_wave_period\";\n Variable[Variable[\"secondary_swell_wave_peak_period\"] = 143] = \"secondary_swell_wave_peak_period\";\n Variable[Variable[\"secondary_swell_wave_direction\"] = 144] = \"secondary_swell_wave_direction\";\n Variable[Variable[\"tertiary_swell_wave_height\"] = 145] = \"tertiary_swell_wave_height\";\n Variable[Variable[\"tertiary_swell_wave_period\"] = 146] = \"tertiary_swell_wave_period\";\n Variable[Variable[\"tertiary_swell_wave_peak_period\"] = 147] = \"tertiary_swell_wave_peak_period\";\n Variable[Variable[\"tertiary_swell_wave_direction\"] = 148] = \"tertiary_swell_wave_direction\";\n})(Variable || (exports.Variable = Variable = {}));\n\n\n//# sourceURL=webpack:///./node_modules/@openmeteo/sdk/variable.js?"); - -/***/ }), - -/***/ "./node_modules/@openmeteo/sdk/variables-with-time.js": -/*!************************************************************!*\ - !*** ./node_modules/@openmeteo/sdk/variables-with-time.js ***! - \************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -eval("\n// automatically generated by the FlatBuffers compiler, do not modify\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || (function () {\n var ownKeys = function(o) {\n ownKeys = Object.getOwnPropertyNames || function (o) {\n var ar = [];\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n };\n return function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n __setModuleDefault(result, mod);\n return result;\n };\n})();\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.VariablesWithTime = void 0;\n/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */\nconst flatbuffers = __importStar(__webpack_require__(/*! flatbuffers */ \"./node_modules/flatbuffers/mjs/flatbuffers.js\"));\nconst variable_with_values_js_1 = __webpack_require__(/*! ./variable-with-values.js */ \"./node_modules/@openmeteo/sdk/variable-with-values.js\");\nclass VariablesWithTime {\n constructor() {\n this.bb = null;\n this.bb_pos = 0;\n }\n __init(i, bb) {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n static getRootAsVariablesWithTime(bb, obj) {\n return (obj || new VariablesWithTime()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n static getSizePrefixedRootAsVariablesWithTime(bb, obj) {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new VariablesWithTime()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n time() {\n const offset = this.bb.__offset(this.bb_pos, 4);\n return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');\n }\n timeEnd() {\n const offset = this.bb.__offset(this.bb_pos, 6);\n return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');\n }\n interval() {\n const offset = this.bb.__offset(this.bb_pos, 8);\n return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;\n }\n variables(index, obj) {\n const offset = this.bb.__offset(this.bb_pos, 10);\n return offset ? (obj || new variable_with_values_js_1.VariableWithValues()).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos + offset) + index * 4), this.bb) : null;\n }\n variablesLength() {\n const offset = this.bb.__offset(this.bb_pos, 10);\n return offset ? this.bb.__vector_len(this.bb_pos + offset) : 0;\n }\n}\nexports.VariablesWithTime = VariablesWithTime;\n\n\n//# sourceURL=webpack:///./node_modules/@openmeteo/sdk/variables-with-time.js?"); - -/***/ }), - -/***/ "./node_modules/@openmeteo/sdk/weather-api-response.js": -/*!*************************************************************!*\ - !*** ./node_modules/@openmeteo/sdk/weather-api-response.js ***! - \*************************************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -eval("\n// automatically generated by the FlatBuffers compiler, do not modify\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || (function () {\n var ownKeys = function(o) {\n ownKeys = Object.getOwnPropertyNames || function (o) {\n var ar = [];\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n };\n return function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n __setModuleDefault(result, mod);\n return result;\n };\n})();\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.WeatherApiResponse = void 0;\n/* eslint-disable @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any, @typescript-eslint/no-non-null-assertion */\nconst flatbuffers = __importStar(__webpack_require__(/*! flatbuffers */ \"./node_modules/flatbuffers/mjs/flatbuffers.js\"));\nconst model_js_1 = __webpack_require__(/*! ./model.js */ \"./node_modules/@openmeteo/sdk/model.js\");\nconst variables_with_time_js_1 = __webpack_require__(/*! ./variables-with-time.js */ \"./node_modules/@openmeteo/sdk/variables-with-time.js\");\nclass WeatherApiResponse {\n constructor() {\n this.bb = null;\n this.bb_pos = 0;\n }\n __init(i, bb) {\n this.bb_pos = i;\n this.bb = bb;\n return this;\n }\n static getRootAsWeatherApiResponse(bb, obj) {\n return (obj || new WeatherApiResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n static getSizePrefixedRootAsWeatherApiResponse(bb, obj) {\n bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);\n return (obj || new WeatherApiResponse()).__init(bb.readInt32(bb.position()) + bb.position(), bb);\n }\n latitude() {\n const offset = this.bb.__offset(this.bb_pos, 4);\n return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0;\n }\n longitude() {\n const offset = this.bb.__offset(this.bb_pos, 6);\n return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0;\n }\n elevation() {\n const offset = this.bb.__offset(this.bb_pos, 8);\n return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0;\n }\n generationTimeMilliseconds() {\n const offset = this.bb.__offset(this.bb_pos, 10);\n return offset ? this.bb.readFloat32(this.bb_pos + offset) : 0.0;\n }\n locationId() {\n const offset = this.bb.__offset(this.bb_pos, 12);\n return offset ? this.bb.readInt64(this.bb_pos + offset) : BigInt('0');\n }\n model() {\n const offset = this.bb.__offset(this.bb_pos, 14);\n return offset ? this.bb.readUint8(this.bb_pos + offset) : model_js_1.Model.undefined;\n }\n utcOffsetSeconds() {\n const offset = this.bb.__offset(this.bb_pos, 16);\n return offset ? this.bb.readInt32(this.bb_pos + offset) : 0;\n }\n timezone(optionalEncoding) {\n const offset = this.bb.__offset(this.bb_pos, 18);\n return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n timezoneAbbreviation(optionalEncoding) {\n const offset = this.bb.__offset(this.bb_pos, 20);\n return offset ? this.bb.__string(this.bb_pos + offset, optionalEncoding) : null;\n }\n current(obj) {\n const offset = this.bb.__offset(this.bb_pos, 22);\n return offset ? (obj || new variables_with_time_js_1.VariablesWithTime()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;\n }\n daily(obj) {\n const offset = this.bb.__offset(this.bb_pos, 24);\n return offset ? (obj || new variables_with_time_js_1.VariablesWithTime()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;\n }\n hourly(obj) {\n const offset = this.bb.__offset(this.bb_pos, 26);\n return offset ? (obj || new variables_with_time_js_1.VariablesWithTime()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;\n }\n minutely15(obj) {\n const offset = this.bb.__offset(this.bb_pos, 28);\n return offset ? (obj || new variables_with_time_js_1.VariablesWithTime()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;\n }\n sixHourly(obj) {\n const offset = this.bb.__offset(this.bb_pos, 30);\n return offset ? (obj || new variables_with_time_js_1.VariablesWithTime()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;\n }\n}\nexports.WeatherApiResponse = WeatherApiResponse;\n\n\n//# sourceURL=webpack:///./node_modules/@openmeteo/sdk/weather-api-response.js?"); - -/***/ }), - -/***/ "./node_modules/flatbuffers/mjs/builder.js": -/*!*************************************************!*\ - !*** ./node_modules/flatbuffers/mjs/builder.js ***! - \*************************************************/ +/***/ "./src/crack.ts": +/*!**********************!*\ + !*** ./src/crack.ts ***! + \**********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Builder: () => (/* binding */ Builder)\n/* harmony export */ });\n/* harmony import */ var _byte_buffer_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./byte-buffer.js */ \"./node_modules/flatbuffers/mjs/byte-buffer.js\");\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/flatbuffers/mjs/constants.js\");\n\n\nclass Builder {\n /**\n * Create a FlatBufferBuilder.\n */\n constructor(opt_initial_size) {\n /** Minimum alignment encountered so far. */\n this.minalign = 1;\n /** The vtable for the current table. */\n this.vtable = null;\n /** The amount of fields we're actually using. */\n this.vtable_in_use = 0;\n /** Whether we are currently serializing a table. */\n this.isNested = false;\n /** Starting offset of the current struct/table. */\n this.object_start = 0;\n /** List of offsets of all vtables. */\n this.vtables = [];\n /** For the current vector being built. */\n this.vector_num_elems = 0;\n /** False omits default values from the serialized data */\n this.force_defaults = false;\n this.string_maps = null;\n this.text_encoder = new TextEncoder();\n let initial_size;\n if (!opt_initial_size) {\n initial_size = 1024;\n }\n else {\n initial_size = opt_initial_size;\n }\n /**\n * @type {ByteBuffer}\n * @private\n */\n this.bb = _byte_buffer_js__WEBPACK_IMPORTED_MODULE_0__.ByteBuffer.allocate(initial_size);\n this.space = initial_size;\n }\n clear() {\n this.bb.clear();\n this.space = this.bb.capacity();\n this.minalign = 1;\n this.vtable = null;\n this.vtable_in_use = 0;\n this.isNested = false;\n this.object_start = 0;\n this.vtables = [];\n this.vector_num_elems = 0;\n this.force_defaults = false;\n this.string_maps = null;\n }\n /**\n * In order to save space, fields that are set to their default value\n * don't get serialized into the buffer. Forcing defaults provides a\n * way to manually disable this optimization.\n *\n * @param forceDefaults true always serializes default values\n */\n forceDefaults(forceDefaults) {\n this.force_defaults = forceDefaults;\n }\n /**\n * Get the ByteBuffer representing the FlatBuffer. Only call this after you've\n * called finish(). The actual data starts at the ByteBuffer's current position,\n * not necessarily at 0.\n */\n dataBuffer() {\n return this.bb;\n }\n /**\n * Get the bytes representing the FlatBuffer. Only call this after you've\n * called finish().\n */\n asUint8Array() {\n return this.bb.bytes().subarray(this.bb.position(), this.bb.position() + this.offset());\n }\n /**\n * Prepare to write an element of `size` after `additional_bytes` have been\n * written, e.g. if you write a string, you need to align such the int length\n * field is aligned to 4 bytes, and the string data follows it directly. If all\n * you need to do is alignment, `additional_bytes` will be 0.\n *\n * @param size This is the of the new element to write\n * @param additional_bytes The padding size\n */\n prep(size, additional_bytes) {\n // Track the biggest thing we've ever aligned to.\n if (size > this.minalign) {\n this.minalign = size;\n }\n // Find the amount of alignment needed such that `size` is properly\n // aligned after `additional_bytes`\n const align_size = ((~(this.bb.capacity() - this.space + additional_bytes)) + 1) & (size - 1);\n // Reallocate the buffer if needed.\n while (this.space < align_size + size + additional_bytes) {\n const old_buf_size = this.bb.capacity();\n this.bb = Builder.growByteBuffer(this.bb);\n this.space += this.bb.capacity() - old_buf_size;\n }\n this.pad(align_size);\n }\n pad(byte_size) {\n for (let i = 0; i < byte_size; i++) {\n this.bb.writeInt8(--this.space, 0);\n }\n }\n writeInt8(value) {\n this.bb.writeInt8(this.space -= 1, value);\n }\n writeInt16(value) {\n this.bb.writeInt16(this.space -= 2, value);\n }\n writeInt32(value) {\n this.bb.writeInt32(this.space -= 4, value);\n }\n writeInt64(value) {\n this.bb.writeInt64(this.space -= 8, value);\n }\n writeFloat32(value) {\n this.bb.writeFloat32(this.space -= 4, value);\n }\n writeFloat64(value) {\n this.bb.writeFloat64(this.space -= 8, value);\n }\n /**\n * Add an `int8` to the buffer, properly aligned, and grows the buffer (if necessary).\n * @param value The `int8` to add the buffer.\n */\n addInt8(value) {\n this.prep(1, 0);\n this.writeInt8(value);\n }\n /**\n * Add an `int16` to the buffer, properly aligned, and grows the buffer (if necessary).\n * @param value The `int16` to add the buffer.\n */\n addInt16(value) {\n this.prep(2, 0);\n this.writeInt16(value);\n }\n /**\n * Add an `int32` to the buffer, properly aligned, and grows the buffer (if necessary).\n * @param value The `int32` to add the buffer.\n */\n addInt32(value) {\n this.prep(4, 0);\n this.writeInt32(value);\n }\n /**\n * Add an `int64` to the buffer, properly aligned, and grows the buffer (if necessary).\n * @param value The `int64` to add the buffer.\n */\n addInt64(value) {\n this.prep(8, 0);\n this.writeInt64(value);\n }\n /**\n * Add a `float32` to the buffer, properly aligned, and grows the buffer (if necessary).\n * @param value The `float32` to add the buffer.\n */\n addFloat32(value) {\n this.prep(4, 0);\n this.writeFloat32(value);\n }\n /**\n * Add a `float64` to the buffer, properly aligned, and grows the buffer (if necessary).\n * @param value The `float64` to add the buffer.\n */\n addFloat64(value) {\n this.prep(8, 0);\n this.writeFloat64(value);\n }\n addFieldInt8(voffset, value, defaultValue) {\n if (this.force_defaults || value != defaultValue) {\n this.addInt8(value);\n this.slot(voffset);\n }\n }\n addFieldInt16(voffset, value, defaultValue) {\n if (this.force_defaults || value != defaultValue) {\n this.addInt16(value);\n this.slot(voffset);\n }\n }\n addFieldInt32(voffset, value, defaultValue) {\n if (this.force_defaults || value != defaultValue) {\n this.addInt32(value);\n this.slot(voffset);\n }\n }\n addFieldInt64(voffset, value, defaultValue) {\n if (this.force_defaults || value !== defaultValue) {\n this.addInt64(value);\n this.slot(voffset);\n }\n }\n addFieldFloat32(voffset, value, defaultValue) {\n if (this.force_defaults || value != defaultValue) {\n this.addFloat32(value);\n this.slot(voffset);\n }\n }\n addFieldFloat64(voffset, value, defaultValue) {\n if (this.force_defaults || value != defaultValue) {\n this.addFloat64(value);\n this.slot(voffset);\n }\n }\n addFieldOffset(voffset, value, defaultValue) {\n if (this.force_defaults || value != defaultValue) {\n this.addOffset(value);\n this.slot(voffset);\n }\n }\n /**\n * Structs are stored inline, so nothing additional is being added. `d` is always 0.\n */\n addFieldStruct(voffset, value, defaultValue) {\n if (value != defaultValue) {\n this.nested(value);\n this.slot(voffset);\n }\n }\n /**\n * Structures are always stored inline, they need to be created right\n * where they're used. You'll get this assertion failure if you\n * created it elsewhere.\n */\n nested(obj) {\n if (obj != this.offset()) {\n throw new TypeError('FlatBuffers: struct must be serialized inline.');\n }\n }\n /**\n * Should not be creating any other object, string or vector\n * while an object is being constructed\n */\n notNested() {\n if (this.isNested) {\n throw new TypeError('FlatBuffers: object serialization must not be nested.');\n }\n }\n /**\n * Set the current vtable at `voffset` to the current location in the buffer.\n */\n slot(voffset) {\n if (this.vtable !== null)\n this.vtable[voffset] = this.offset();\n }\n /**\n * @returns Offset relative to the end of the buffer.\n */\n offset() {\n return this.bb.capacity() - this.space;\n }\n /**\n * Doubles the size of the backing ByteBuffer and copies the old data towards\n * the end of the new buffer (since we build the buffer backwards).\n *\n * @param bb The current buffer with the existing data\n * @returns A new byte buffer with the old data copied\n * to it. The data is located at the end of the buffer.\n *\n * uint8Array.set() formally takes {Array|ArrayBufferView}, so to pass\n * it a uint8Array we need to suppress the type check:\n * @suppress {checkTypes}\n */\n static growByteBuffer(bb) {\n const old_buf_size = bb.capacity();\n // Ensure we don't grow beyond what fits in an int.\n if (old_buf_size & 0xC0000000) {\n throw new Error('FlatBuffers: cannot grow buffer beyond 2 gigabytes.');\n }\n const new_buf_size = old_buf_size << 1;\n const nbb = _byte_buffer_js__WEBPACK_IMPORTED_MODULE_0__.ByteBuffer.allocate(new_buf_size);\n nbb.setPosition(new_buf_size - old_buf_size);\n nbb.bytes().set(bb.bytes(), new_buf_size - old_buf_size);\n return nbb;\n }\n /**\n * Adds on offset, relative to where it will be written.\n *\n * @param offset The offset to add.\n */\n addOffset(offset) {\n this.prep(_constants_js__WEBPACK_IMPORTED_MODULE_1__.SIZEOF_INT, 0); // Ensure alignment is already done.\n this.writeInt32(this.offset() - offset + _constants_js__WEBPACK_IMPORTED_MODULE_1__.SIZEOF_INT);\n }\n /**\n * Start encoding a new object in the buffer. Users will not usually need to\n * call this directly. The FlatBuffers compiler will generate helper methods\n * that call this method internally.\n */\n startObject(numfields) {\n this.notNested();\n if (this.vtable == null) {\n this.vtable = [];\n }\n this.vtable_in_use = numfields;\n for (let i = 0; i < numfields; i++) {\n this.vtable[i] = 0; // This will push additional elements as needed\n }\n this.isNested = true;\n this.object_start = this.offset();\n }\n /**\n * Finish off writing the object that is under construction.\n *\n * @returns The offset to the object inside `dataBuffer`\n */\n endObject() {\n if (this.vtable == null || !this.isNested) {\n throw new Error('FlatBuffers: endObject called without startObject');\n }\n this.addInt32(0);\n const vtableloc = this.offset();\n // Trim trailing zeroes.\n let i = this.vtable_in_use - 1;\n // eslint-disable-next-line no-empty\n for (; i >= 0 && this.vtable[i] == 0; i--) { }\n const trimmed_size = i + 1;\n // Write out the current vtable.\n for (; i >= 0; i--) {\n // Offset relative to the start of the table.\n this.addInt16(this.vtable[i] != 0 ? vtableloc - this.vtable[i] : 0);\n }\n const standard_fields = 2; // The fields below:\n this.addInt16(vtableloc - this.object_start);\n const len = (trimmed_size + standard_fields) * _constants_js__WEBPACK_IMPORTED_MODULE_1__.SIZEOF_SHORT;\n this.addInt16(len);\n // Search for an existing vtable that matches the current one.\n let existing_vtable = 0;\n const vt1 = this.space;\n outer_loop: for (i = 0; i < this.vtables.length; i++) {\n const vt2 = this.bb.capacity() - this.vtables[i];\n if (len == this.bb.readInt16(vt2)) {\n for (let j = _constants_js__WEBPACK_IMPORTED_MODULE_1__.SIZEOF_SHORT; j < len; j += _constants_js__WEBPACK_IMPORTED_MODULE_1__.SIZEOF_SHORT) {\n if (this.bb.readInt16(vt1 + j) != this.bb.readInt16(vt2 + j)) {\n continue outer_loop;\n }\n }\n existing_vtable = this.vtables[i];\n break;\n }\n }\n if (existing_vtable) {\n // Found a match:\n // Remove the current vtable.\n this.space = this.bb.capacity() - vtableloc;\n // Point table to existing vtable.\n this.bb.writeInt32(this.space, existing_vtable - vtableloc);\n }\n else {\n // No match:\n // Add the location of the current vtable to the list of vtables.\n this.vtables.push(this.offset());\n // Point table to current vtable.\n this.bb.writeInt32(this.bb.capacity() - vtableloc, this.offset() - vtableloc);\n }\n this.isNested = false;\n return vtableloc;\n }\n /**\n * Finalize a buffer, poiting to the given `root_table`.\n */\n finish(root_table, opt_file_identifier, opt_size_prefix) {\n const size_prefix = opt_size_prefix ? _constants_js__WEBPACK_IMPORTED_MODULE_1__.SIZE_PREFIX_LENGTH : 0;\n if (opt_file_identifier) {\n const file_identifier = opt_file_identifier;\n this.prep(this.minalign, _constants_js__WEBPACK_IMPORTED_MODULE_1__.SIZEOF_INT +\n _constants_js__WEBPACK_IMPORTED_MODULE_1__.FILE_IDENTIFIER_LENGTH + size_prefix);\n if (file_identifier.length != _constants_js__WEBPACK_IMPORTED_MODULE_1__.FILE_IDENTIFIER_LENGTH) {\n throw new TypeError('FlatBuffers: file identifier must be length ' +\n _constants_js__WEBPACK_IMPORTED_MODULE_1__.FILE_IDENTIFIER_LENGTH);\n }\n for (let i = _constants_js__WEBPACK_IMPORTED_MODULE_1__.FILE_IDENTIFIER_LENGTH - 1; i >= 0; i--) {\n this.writeInt8(file_identifier.charCodeAt(i));\n }\n }\n this.prep(this.minalign, _constants_js__WEBPACK_IMPORTED_MODULE_1__.SIZEOF_INT + size_prefix);\n this.addOffset(root_table);\n if (size_prefix) {\n this.addInt32(this.bb.capacity() - this.space);\n }\n this.bb.setPosition(this.space);\n }\n /**\n * Finalize a size prefixed buffer, pointing to the given `root_table`.\n */\n finishSizePrefixed(root_table, opt_file_identifier) {\n this.finish(root_table, opt_file_identifier, true);\n }\n /**\n * This checks a required field has been set in a given table that has\n * just been constructed.\n */\n requiredField(table, field) {\n const table_start = this.bb.capacity() - table;\n const vtable_start = table_start - this.bb.readInt32(table_start);\n const ok = field < this.bb.readInt16(vtable_start) &&\n this.bb.readInt16(vtable_start + field) != 0;\n // If this fails, the caller will show what field needs to be set.\n if (!ok) {\n throw new TypeError('FlatBuffers: field ' + field + ' must be set');\n }\n }\n /**\n * Start a new array/vector of objects. Users usually will not call\n * this directly. The FlatBuffers compiler will create a start/end\n * method for vector types in generated code.\n *\n * @param elem_size The size of each element in the array\n * @param num_elems The number of elements in the array\n * @param alignment The alignment of the array\n */\n startVector(elem_size, num_elems, alignment) {\n this.notNested();\n this.vector_num_elems = num_elems;\n this.prep(_constants_js__WEBPACK_IMPORTED_MODULE_1__.SIZEOF_INT, elem_size * num_elems);\n this.prep(alignment, elem_size * num_elems); // Just in case alignment > int.\n }\n /**\n * Finish off the creation of an array and all its elements. The array must be\n * created with `startVector`.\n *\n * @returns The offset at which the newly created array\n * starts.\n */\n endVector() {\n this.writeInt32(this.vector_num_elems);\n return this.offset();\n }\n /**\n * Encode the string `s` in the buffer using UTF-8. If the string passed has\n * already been seen, we return the offset of the already written string\n *\n * @param s The string to encode\n * @return The offset in the buffer where the encoded string starts\n */\n createSharedString(s) {\n if (!s) {\n return 0;\n }\n if (!this.string_maps) {\n this.string_maps = new Map();\n }\n if (this.string_maps.has(s)) {\n return this.string_maps.get(s);\n }\n const offset = this.createString(s);\n this.string_maps.set(s, offset);\n return offset;\n }\n /**\n * Encode the string `s` in the buffer using UTF-8. If a Uint8Array is passed\n * instead of a string, it is assumed to contain valid UTF-8 encoded data.\n *\n * @param s The string to encode\n * @return The offset in the buffer where the encoded string starts\n */\n createString(s) {\n if (s === null || s === undefined) {\n return 0;\n }\n let utf8;\n if (s instanceof Uint8Array) {\n utf8 = s;\n }\n else {\n utf8 = this.text_encoder.encode(s);\n }\n this.addInt8(0);\n this.startVector(1, utf8.length, 1);\n this.bb.setPosition(this.space -= utf8.length);\n this.bb.bytes().set(utf8, this.space);\n return this.endVector();\n }\n /**\n * Create a byte vector.\n *\n * @param v The bytes to add\n * @returns The offset in the buffer where the byte vector starts\n */\n createByteVector(v) {\n if (v === null || v === undefined) {\n return 0;\n }\n this.startVector(1, v.length, 1);\n this.bb.setPosition(this.space -= v.length);\n this.bb.bytes().set(v, this.space);\n return this.endVector();\n }\n /**\n * A helper function to pack an object\n *\n * @returns offset of obj\n */\n createObjectOffset(obj) {\n if (obj === null) {\n return 0;\n }\n if (typeof obj === 'string') {\n return this.createString(obj);\n }\n else {\n return obj.pack(this);\n }\n }\n /**\n * A helper function to pack a list of object\n *\n * @returns list of offsets of each non null object\n */\n createObjectOffsetList(list) {\n const ret = [];\n for (let i = 0; i < list.length; ++i) {\n const val = list[i];\n if (val !== null) {\n ret.push(this.createObjectOffset(val));\n }\n else {\n throw new TypeError('FlatBuffers: Argument for createObjectOffsetList cannot contain null.');\n }\n }\n return ret;\n }\n createStructOffsetList(list, startFunc) {\n startFunc(this, list.length);\n this.createObjectOffsetList(list.slice().reverse());\n return this.endVector();\n }\n}\n\n\n//# sourceURL=webpack:///./node_modules/flatbuffers/mjs/builder.js?"); - -/***/ }), - -/***/ "./node_modules/flatbuffers/mjs/byte-buffer.js": -/*!*****************************************************!*\ - !*** ./node_modules/flatbuffers/mjs/byte-buffer.js ***! - \*****************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ByteBuffer: () => (/* binding */ ByteBuffer)\n/* harmony export */ });\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/flatbuffers/mjs/constants.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/flatbuffers/mjs/utils.js\");\n/* harmony import */ var _encoding_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./encoding.js */ \"./node_modules/flatbuffers/mjs/encoding.js\");\n\n\n\nclass ByteBuffer {\n /**\n * Create a new ByteBuffer with a given array of bytes (`Uint8Array`)\n */\n constructor(bytes_) {\n this.bytes_ = bytes_;\n this.position_ = 0;\n this.text_decoder_ = new TextDecoder();\n }\n /**\n * Create and allocate a new ByteBuffer with a given size.\n */\n static allocate(byte_size) {\n return new ByteBuffer(new Uint8Array(byte_size));\n }\n clear() {\n this.position_ = 0;\n }\n /**\n * Get the underlying `Uint8Array`.\n */\n bytes() {\n return this.bytes_;\n }\n /**\n * Get the buffer's position.\n */\n position() {\n return this.position_;\n }\n /**\n * Set the buffer's position.\n */\n setPosition(position) {\n this.position_ = position;\n }\n /**\n * Get the buffer's capacity.\n */\n capacity() {\n return this.bytes_.length;\n }\n readInt8(offset) {\n return this.readUint8(offset) << 24 >> 24;\n }\n readUint8(offset) {\n return this.bytes_[offset];\n }\n readInt16(offset) {\n return this.readUint16(offset) << 16 >> 16;\n }\n readUint16(offset) {\n return this.bytes_[offset] | this.bytes_[offset + 1] << 8;\n }\n readInt32(offset) {\n return this.bytes_[offset] | this.bytes_[offset + 1] << 8 | this.bytes_[offset + 2] << 16 | this.bytes_[offset + 3] << 24;\n }\n readUint32(offset) {\n return this.readInt32(offset) >>> 0;\n }\n readInt64(offset) {\n return BigInt.asIntN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));\n }\n readUint64(offset) {\n return BigInt.asUintN(64, BigInt(this.readUint32(offset)) + (BigInt(this.readUint32(offset + 4)) << BigInt(32)));\n }\n readFloat32(offset) {\n _utils_js__WEBPACK_IMPORTED_MODULE_1__.int32[0] = this.readInt32(offset);\n return _utils_js__WEBPACK_IMPORTED_MODULE_1__.float32[0];\n }\n readFloat64(offset) {\n _utils_js__WEBPACK_IMPORTED_MODULE_1__.int32[_utils_js__WEBPACK_IMPORTED_MODULE_1__.isLittleEndian ? 0 : 1] = this.readInt32(offset);\n _utils_js__WEBPACK_IMPORTED_MODULE_1__.int32[_utils_js__WEBPACK_IMPORTED_MODULE_1__.isLittleEndian ? 1 : 0] = this.readInt32(offset + 4);\n return _utils_js__WEBPACK_IMPORTED_MODULE_1__.float64[0];\n }\n writeInt8(offset, value) {\n this.bytes_[offset] = value;\n }\n writeUint8(offset, value) {\n this.bytes_[offset] = value;\n }\n writeInt16(offset, value) {\n this.bytes_[offset] = value;\n this.bytes_[offset + 1] = value >> 8;\n }\n writeUint16(offset, value) {\n this.bytes_[offset] = value;\n this.bytes_[offset + 1] = value >> 8;\n }\n writeInt32(offset, value) {\n this.bytes_[offset] = value;\n this.bytes_[offset + 1] = value >> 8;\n this.bytes_[offset + 2] = value >> 16;\n this.bytes_[offset + 3] = value >> 24;\n }\n writeUint32(offset, value) {\n this.bytes_[offset] = value;\n this.bytes_[offset + 1] = value >> 8;\n this.bytes_[offset + 2] = value >> 16;\n this.bytes_[offset + 3] = value >> 24;\n }\n writeInt64(offset, value) {\n this.writeInt32(offset, Number(BigInt.asIntN(32, value)));\n this.writeInt32(offset + 4, Number(BigInt.asIntN(32, value >> BigInt(32))));\n }\n writeUint64(offset, value) {\n this.writeUint32(offset, Number(BigInt.asUintN(32, value)));\n this.writeUint32(offset + 4, Number(BigInt.asUintN(32, value >> BigInt(32))));\n }\n writeFloat32(offset, value) {\n _utils_js__WEBPACK_IMPORTED_MODULE_1__.float32[0] = value;\n this.writeInt32(offset, _utils_js__WEBPACK_IMPORTED_MODULE_1__.int32[0]);\n }\n writeFloat64(offset, value) {\n _utils_js__WEBPACK_IMPORTED_MODULE_1__.float64[0] = value;\n this.writeInt32(offset, _utils_js__WEBPACK_IMPORTED_MODULE_1__.int32[_utils_js__WEBPACK_IMPORTED_MODULE_1__.isLittleEndian ? 0 : 1]);\n this.writeInt32(offset + 4, _utils_js__WEBPACK_IMPORTED_MODULE_1__.int32[_utils_js__WEBPACK_IMPORTED_MODULE_1__.isLittleEndian ? 1 : 0]);\n }\n /**\n * Return the file identifier. Behavior is undefined for FlatBuffers whose\n * schema does not include a file_identifier (likely points at padding or the\n * start of a the root vtable).\n */\n getBufferIdentifier() {\n if (this.bytes_.length < this.position_ + _constants_js__WEBPACK_IMPORTED_MODULE_0__.SIZEOF_INT +\n _constants_js__WEBPACK_IMPORTED_MODULE_0__.FILE_IDENTIFIER_LENGTH) {\n throw new Error('FlatBuffers: ByteBuffer is too short to contain an identifier.');\n }\n let result = \"\";\n for (let i = 0; i < _constants_js__WEBPACK_IMPORTED_MODULE_0__.FILE_IDENTIFIER_LENGTH; i++) {\n result += String.fromCharCode(this.readInt8(this.position_ + _constants_js__WEBPACK_IMPORTED_MODULE_0__.SIZEOF_INT + i));\n }\n return result;\n }\n /**\n * Look up a field in the vtable, return an offset into the object, or 0 if the\n * field is not present.\n */\n __offset(bb_pos, vtable_offset) {\n const vtable = bb_pos - this.readInt32(bb_pos);\n return vtable_offset < this.readInt16(vtable) ? this.readInt16(vtable + vtable_offset) : 0;\n }\n /**\n * Initialize any Table-derived type to point to the union at the given offset.\n */\n __union(t, offset) {\n t.bb_pos = offset + this.readInt32(offset);\n t.bb = this;\n return t;\n }\n /**\n * Create a JavaScript string from UTF-8 data stored inside the FlatBuffer.\n * This allocates a new string and converts to wide chars upon each access.\n *\n * To avoid the conversion to string, pass Encoding.UTF8_BYTES as the\n * \"optionalEncoding\" argument. This is useful for avoiding conversion when\n * the data will just be packaged back up in another FlatBuffer later on.\n *\n * @param offset\n * @param opt_encoding Defaults to UTF16_STRING\n */\n __string(offset, opt_encoding) {\n offset += this.readInt32(offset);\n const length = this.readInt32(offset);\n offset += _constants_js__WEBPACK_IMPORTED_MODULE_0__.SIZEOF_INT;\n const utf8bytes = this.bytes_.subarray(offset, offset + length);\n if (opt_encoding === _encoding_js__WEBPACK_IMPORTED_MODULE_2__.Encoding.UTF8_BYTES)\n return utf8bytes;\n else\n return this.text_decoder_.decode(utf8bytes);\n }\n /**\n * Handle unions that can contain string as its member, if a Table-derived type then initialize it,\n * if a string then return a new one\n *\n * WARNING: strings are immutable in JS so we can't change the string that the user gave us, this\n * makes the behaviour of __union_with_string different compared to __union\n */\n __union_with_string(o, offset) {\n if (typeof o === 'string') {\n return this.__string(offset);\n }\n return this.__union(o, offset);\n }\n /**\n * Retrieve the relative offset stored at \"offset\"\n */\n __indirect(offset) {\n return offset + this.readInt32(offset);\n }\n /**\n * Get the start of data of a vector whose offset is stored at \"offset\" in this object.\n */\n __vector(offset) {\n return offset + this.readInt32(offset) + _constants_js__WEBPACK_IMPORTED_MODULE_0__.SIZEOF_INT; // data starts after the length\n }\n /**\n * Get the length of a vector whose offset is stored at \"offset\" in this object.\n */\n __vector_len(offset) {\n return this.readInt32(offset + this.readInt32(offset));\n }\n __has_identifier(ident) {\n if (ident.length != _constants_js__WEBPACK_IMPORTED_MODULE_0__.FILE_IDENTIFIER_LENGTH) {\n throw new Error('FlatBuffers: file identifier must be length ' +\n _constants_js__WEBPACK_IMPORTED_MODULE_0__.FILE_IDENTIFIER_LENGTH);\n }\n for (let i = 0; i < _constants_js__WEBPACK_IMPORTED_MODULE_0__.FILE_IDENTIFIER_LENGTH; i++) {\n if (ident.charCodeAt(i) != this.readInt8(this.position() + _constants_js__WEBPACK_IMPORTED_MODULE_0__.SIZEOF_INT + i)) {\n return false;\n }\n }\n return true;\n }\n /**\n * A helper function for generating list for obj api\n */\n createScalarList(listAccessor, listLength) {\n const ret = [];\n for (let i = 0; i < listLength; ++i) {\n const val = listAccessor(i);\n if (val !== null) {\n ret.push(val);\n }\n }\n return ret;\n }\n /**\n * A helper function for generating list for obj api\n * @param listAccessor function that accepts an index and return data at that index\n * @param listLength listLength\n * @param res result list\n */\n createObjList(listAccessor, listLength) {\n const ret = [];\n for (let i = 0; i < listLength; ++i) {\n const val = listAccessor(i);\n if (val !== null) {\n ret.push(val.unpack());\n }\n }\n return ret;\n }\n}\n\n\n//# sourceURL=webpack:///./node_modules/flatbuffers/mjs/byte-buffer.js?"); - -/***/ }), - -/***/ "./node_modules/flatbuffers/mjs/constants.js": -/*!***************************************************!*\ - !*** ./node_modules/flatbuffers/mjs/constants.js ***! - \***************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FILE_IDENTIFIER_LENGTH: () => (/* binding */ FILE_IDENTIFIER_LENGTH),\n/* harmony export */ SIZEOF_INT: () => (/* binding */ SIZEOF_INT),\n/* harmony export */ SIZEOF_SHORT: () => (/* binding */ SIZEOF_SHORT),\n/* harmony export */ SIZE_PREFIX_LENGTH: () => (/* binding */ SIZE_PREFIX_LENGTH)\n/* harmony export */ });\nconst SIZEOF_SHORT = 2;\nconst SIZEOF_INT = 4;\nconst FILE_IDENTIFIER_LENGTH = 4;\nconst SIZE_PREFIX_LENGTH = 4;\n\n\n//# sourceURL=webpack:///./node_modules/flatbuffers/mjs/constants.js?"); - -/***/ }), - -/***/ "./node_modules/flatbuffers/mjs/encoding.js": -/*!**************************************************!*\ - !*** ./node_modules/flatbuffers/mjs/encoding.js ***! - \**************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Encoding: () => (/* binding */ Encoding)\n/* harmony export */ });\nvar Encoding;\n(function (Encoding) {\n Encoding[Encoding[\"UTF8_BYTES\"] = 1] = \"UTF8_BYTES\";\n Encoding[Encoding[\"UTF16_STRING\"] = 2] = \"UTF16_STRING\";\n})(Encoding || (Encoding = {}));\n\n\n//# sourceURL=webpack:///./node_modules/flatbuffers/mjs/encoding.js?"); - -/***/ }), - -/***/ "./node_modules/flatbuffers/mjs/flatbuffers.js": -/*!*****************************************************!*\ - !*** ./node_modules/flatbuffers/mjs/flatbuffers.js ***! - \*****************************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ Builder: () => (/* reexport safe */ _builder_js__WEBPACK_IMPORTED_MODULE_3__.Builder),\n/* harmony export */ ByteBuffer: () => (/* reexport safe */ _byte_buffer_js__WEBPACK_IMPORTED_MODULE_4__.ByteBuffer),\n/* harmony export */ Encoding: () => (/* reexport safe */ _encoding_js__WEBPACK_IMPORTED_MODULE_2__.Encoding),\n/* harmony export */ FILE_IDENTIFIER_LENGTH: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_0__.FILE_IDENTIFIER_LENGTH),\n/* harmony export */ SIZEOF_INT: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_0__.SIZEOF_INT),\n/* harmony export */ SIZEOF_SHORT: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_0__.SIZEOF_SHORT),\n/* harmony export */ SIZE_PREFIX_LENGTH: () => (/* reexport safe */ _constants_js__WEBPACK_IMPORTED_MODULE_0__.SIZE_PREFIX_LENGTH),\n/* harmony export */ float32: () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_1__.float32),\n/* harmony export */ float64: () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_1__.float64),\n/* harmony export */ int32: () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_1__.int32),\n/* harmony export */ isLittleEndian: () => (/* reexport safe */ _utils_js__WEBPACK_IMPORTED_MODULE_1__.isLittleEndian)\n/* harmony export */ });\n/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants.js */ \"./node_modules/flatbuffers/mjs/constants.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ \"./node_modules/flatbuffers/mjs/utils.js\");\n/* harmony import */ var _encoding_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./encoding.js */ \"./node_modules/flatbuffers/mjs/encoding.js\");\n/* harmony import */ var _builder_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./builder.js */ \"./node_modules/flatbuffers/mjs/builder.js\");\n/* harmony import */ var _byte_buffer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./byte-buffer.js */ \"./node_modules/flatbuffers/mjs/byte-buffer.js\");\n\n\n\n\n\n\n\n\n\n\n//# sourceURL=webpack:///./node_modules/flatbuffers/mjs/flatbuffers.js?"); - -/***/ }), - -/***/ "./node_modules/flatbuffers/mjs/utils.js": -/*!***********************************************!*\ - !*** ./node_modules/flatbuffers/mjs/utils.js ***! - \***********************************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ float32: () => (/* binding */ float32),\n/* harmony export */ float64: () => (/* binding */ float64),\n/* harmony export */ int32: () => (/* binding */ int32),\n/* harmony export */ isLittleEndian: () => (/* binding */ isLittleEndian)\n/* harmony export */ });\nconst int32 = new Int32Array(2);\nconst float32 = new Float32Array(int32.buffer);\nconst float64 = new Float64Array(int32.buffer);\nconst isLittleEndian = new Uint16Array(new Uint8Array([1, 0]).buffer)[0] === 1;\n\n\n//# sourceURL=webpack:///./node_modules/flatbuffers/mjs/utils.js?"); - -/***/ }), - -/***/ "./node_modules/openmeteo/lib/index.js": -/*!*********************************************!*\ - !*** ./node_modules/openmeteo/lib/index.js ***! - \*********************************************/ -/***/ (function(__unused_webpack_module, exports, __webpack_require__) { - -eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", ({ value: true }));\nexports.fetchWeatherApi = fetchWeatherApi;\nconst flatbuffers_1 = __webpack_require__(/*! flatbuffers */ \"./node_modules/flatbuffers/mjs/flatbuffers.js\");\nconst weather_api_response_1 = __webpack_require__(/*! @openmeteo/sdk/weather-api-response */ \"./node_modules/@openmeteo/sdk/weather-api-response.js\");\nconst sleep = (ms) => new Promise(r => setTimeout(r, ms));\nfunction fetchRetried(url_1) {\n return __awaiter(this, arguments, void 0, function* (url, retries = 3, backoffFactor = 0.5, backoffMax = 2, fetchOptions = {}) {\n const statusToRetry = [500, 502, 504];\n const statusWithJsonError = [400, 429];\n let currentTry = 0;\n let response = yield fetch(url, fetchOptions);\n while (statusToRetry.includes(response.status)) {\n currentTry++;\n if (currentTry >= retries) {\n throw new Error(response.statusText);\n }\n const sleepMs = Math.min(backoffFactor * Math.pow(2, currentTry), backoffMax) * 1000;\n yield sleep(sleepMs);\n response = yield fetch(url, fetchOptions);\n }\n if (statusWithJsonError.includes(response.status)) {\n const json = yield response.json();\n if ('reason' in json) {\n throw new Error(json.reason);\n }\n throw new Error(response.statusText);\n }\n return response;\n });\n}\n/**\n * Retrieve data from the Open-Meteo weather API\n *\n * @param {string} url Server and endpoint. E.g. \"https://api.open-meteo.com/v1/forecast\"\n * @param {any} params URL parameter as an object\n * @param {number} [retries=3] Number of retries in case of an server error\n * @param {number} [backoffFactor=0.2] Exponential backoff factor to increase wait time after each retry\n * @param {number} [backoffMax=2] Maximum wait time between retries\n * @param {RequestInit} [fetchOptions={}] Additional fetch options such as headers, signal, etc.\n * @returns {Promise}\n */\nfunction fetchWeatherApi(url_1, params_1) {\n return __awaiter(this, arguments, void 0, function* (url, params, retries = 3, backoffFactor = 0.2, backoffMax = 2, fetchOptions = {}) {\n const urlParams = new URLSearchParams(params);\n urlParams.set('format', 'flatbuffers');\n const response = yield fetchRetried(`${url}?${urlParams.toString()}`, retries, backoffFactor, backoffMax, fetchOptions);\n const fb = new flatbuffers_1.ByteBuffer(new Uint8Array(yield response.arrayBuffer()));\n const results = [];\n let pos = 0;\n while (pos < fb.capacity()) {\n fb.setPosition(pos);\n const len = fb.readInt32(fb.position());\n results.push(weather_api_response_1.WeatherApiResponse.getSizePrefixedRootAsWeatherApiResponse(fb));\n pos += len + 4;\n }\n return results;\n });\n}\n\n\n//# sourceURL=webpack:///./node_modules/openmeteo/lib/index.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _sand_painter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sand-painter */ \"./src/sand-painter.ts\");\n\nvar Crack = /** @class */ (function () {\n function Crack(state) {\n this.x = 0;\n this.y = 0;\n this.angle = 0;\n this.painter = new _sand_painter__WEBPACK_IMPORTED_MODULE_0__[\"default\"](state.getRandomColor());\n this.state = state;\n this.init();\n }\n Crack.prototype.init = function () {\n var index = Math.floor(Math.random() * this.state.seeds.length);\n var _a = this.state.seeds.splice(index, 1)[0], x = _a.x, y = _a.y;\n var flip = Math.random() < 0.5;\n var angle = this.state.grid[x][y];\n this.start(x, y, angle + (90 + Math.floor(Math.random() * 4.1 - 2)) * (flip ? -1 : 1));\n };\n Crack.prototype.start = function (x, y, angle) {\n this.x = x + .61 * Math.cos(angle * Math.PI / 180);\n this.y = y + .61 * Math.sin(angle * Math.PI / 180);\n this.angle = angle;\n };\n Crack.prototype.draw = function () {\n this.x += .42 * Math.cos(this.angle * Math.PI / 180);\n this.y += .42 * Math.sin(this.angle * Math.PI / 180);\n var context = this.state.canvas.getContext(\"2d\");\n context.fillStyle = \"#000\";\n context.fillRect(this.x, this.y, 1, 1);\n var x = Math.floor(this.x);\n var y = Math.floor(this.y);\n var height = this.state.canvas.height;\n var width = this.state.canvas.width;\n if (x >= 0 && x < width && y >= 0 && y < height) {\n var seed = this.state.grid[x][y];\n if (seed > 10000 || Math.abs(seed - this.angle) < 5) {\n this.state.grid[x][y] = Math.floor(this.angle);\n this.state.seeds.push({ x: x, y: y });\n }\n else if (Math.abs(seed - this.angle) > 2) {\n this.init();\n this.state.addCrack();\n }\n }\n else {\n this.init();\n this.state.addCrack();\n }\n };\n return Crack;\n}());\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Crack);\n\n\n//# sourceURL=webpack:///./src/crack.ts?"); /***/ }), @@ -156,17 +26,17 @@ eval("\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _argument \***********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _substrate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./substrate */ \"./src/substrate.ts\");\n/* harmony import */ var _weather__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./weather */ \"./src/weather.ts\");\n\n\nvar background = new _substrate__WEBPACK_IMPORTED_MODULE_0__[\"default\"](\"substrate-canvas\", 20);\nvar weather;\nnavigator.geolocation.getCurrentPosition(function (position) {\n weather = new _weather__WEBPACK_IMPORTED_MODULE_1__[\"default\"](position.coords.latitude, position.coords.longitude);\n}, function () {\n weather = new _weather__WEBPACK_IMPORTED_MODULE_1__[\"default\"]();\n});\n\n\n//# sourceURL=webpack:///./src/launch.ts?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _substrate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./substrate */ \"./src/substrate.ts\");\n\nvar ready = function (func) { return document.readyState !== \"loading\" ? func() : document.addEventListener(\"DOMContentLoaded\", func); };\nready(function () {\n new _substrate__WEBPACK_IMPORTED_MODULE_0__[\"default\"](20);\n});\n/*\nlet weather: Weather\nnavigator.geolocation.getCurrentPosition(position => {\n weather = new Weather(position.coords.latitude, position.coords.longitude)\n}, () => {\n weather = new Weather()\n})\n */ \n\n\n//# sourceURL=webpack:///./src/launch.ts?"); /***/ }), -/***/ "./src/sandPainter.ts": -/*!****************************!*\ +/***/ "./src/sand-painter.ts": +/*!*****************************!*\ !*** ./src/sand-painter.ts ***! - \****************************/ + \*****************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nvar SandPainter = /** @class */ (function () {\n function SandPainter(state) {\n this.color = state.getRandomColor();\n this.gain = Math.random() / 10;\n }\n return SandPainter;\n}());\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SandPainter);\n\n\n//# sourceURL=webpack:///./src/sand-painter.ts?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nvar SandPainter = /** @class */ (function () {\n function SandPainter(color) {\n this.color = color;\n this.gain = Math.random() / 10;\n }\n SandPainter.prototype.render = function () {\n };\n return SandPainter;\n}());\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SandPainter);\n\n\n//# sourceURL=webpack:///./src/sand-painter.ts?"); /***/ }), @@ -176,7 +46,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \**********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nvar State = /** @class */ (function () {\n function State(colors, maxCracks, height, width) {\n this.colors = colors;\n this.maxCracks = maxCracks;\n this.height = height;\n this.width = width;\n this.crackGrid = [];\n for (var x = 0; x < width; x++) {\n for (var y = 0; y < height; y++) {\n this.crackGrid[y * width + x] = 10000;\n }\n }\n for (var i = 0; i < 16; i++) {\n this.crackGrid[Math.floor(Math.random() * (height * width))] = Math.ceil(Math.random() * 360);\n }\n }\n State.prototype.getRandomColor = function () {\n return this.colors[Math.floor(Math.random() * this.colors.length)];\n };\n return State;\n}());\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (State);\n\n\n//# sourceURL=webpack:///./src/state.ts?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _crack__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./crack */ \"./src/crack.ts\");\n\nvar State = /** @class */ (function () {\n function State(colors, maxCracks, canvas) {\n this.canvas = canvas;\n this.colors = colors;\n this.maxCracks = maxCracks;\n this.grid = [];\n this.cracks = [];\n this.init();\n }\n State.prototype.init = function () {\n this.seeds = [];\n var height = this.canvas.height;\n var width = this.canvas.width;\n var context = this.canvas.getContext(\"2d\");\n context.fillStyle = \"rgb(255 255 255 / 95%)\";\n context.fillRect(0, 0, width, height);\n for (var x = 0; x < width; x++) {\n if (!this.grid[x])\n this.grid[x] = [];\n for (var y = 0; y < height; y++) {\n this.grid[x][y] = 10001;\n }\n }\n for (var i = 0; i < 16; i++) {\n var x = Math.floor(Math.random() * width);\n var y = Math.floor(Math.random() * height);\n this.grid[x][y] = Math.floor(Math.random() * 360);\n this.seeds.push({ x: x, y: y });\n }\n this.cracks = [new _crack__WEBPACK_IMPORTED_MODULE_0__[\"default\"](this), new _crack__WEBPACK_IMPORTED_MODULE_0__[\"default\"](this), new _crack__WEBPACK_IMPORTED_MODULE_0__[\"default\"](this)];\n };\n State.prototype.addCrack = function () {\n if (this.cracks.length < this.maxCracks)\n this.cracks.push(new _crack__WEBPACK_IMPORTED_MODULE_0__[\"default\"](this));\n };\n State.prototype.getRandomColor = function () {\n return this.colors[Math.floor(Math.random() * this.colors.length)];\n };\n return State;\n}());\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (State);\n\n\n//# sourceURL=webpack:///./src/state.ts?"); /***/ }), @@ -186,17 +56,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac \**************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./state */ \"./src/state.ts\");\n/* harmony import */ var _sandPainter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sandPainter */ \"./src/sand-painter.ts\");\n// TS attempt of http://www.complexification.net/gallery/machines/substrate/index.php by laniaung.me 2025-06-02\n\n\nvar Substrate = /** @class */ (function () {\n function Substrate(id, maxCracks, colors) {\n if (!(colors === null || colors === void 0 ? void 0 : colors.length))\n colors = [0x3a1e3e, 0x7c2d3b, 0xb94f3c, 0xf4a462, 0xf9c54e]; // https://colormagic.app/palette/671eeb6c42273fc4c1bb1ac7\n var canvas = document.getElementById(id);\n if (!canvas) {\n canvas = document.createElement(\"canvas\");\n document.body.appendChild(canvas);\n }\n this.canvas = canvas;\n this.state = new _state__WEBPACK_IMPORTED_MODULE_0__[\"default\"](colors, maxCracks, canvas.clientHeight, canvas.clientWidth);\n this.init();\n }\n Substrate.prototype.init = function () {\n var context = this.canvas.getContext(\"2d\");\n context.fillStyle = \"#fff\";\n context.fillRect(0, 0, this.canvas.width, this.canvas.height);\n };\n return Substrate;\n}());\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Substrate);\nvar Crack = /** @class */ (function () {\n function Crack(state) {\n this.x = 0;\n this.y = 0;\n this.angle = 0;\n this.painter = new _sandPainter__WEBPACK_IMPORTED_MODULE_1__[\"default\"](state);\n this.state = state;\n this.init();\n }\n Crack.prototype.init = function () {\n var x = 0, y = 0, found = false, tries = 0;\n while (!found && tries++ < 1000) {\n x = Math.random() * this.state.width;\n y = Math.random() * this.state.height;\n found = this.state.crackGrid[y * this.state.height + x] < 10000;\n }\n if (!found) {\n console.warn(\"Unable to start crack due to timeout\");\n return;\n }\n var negative = Math.random() < 0.5;\n var value = this.state.crackGrid[y * this.state.height + x];\n if (negative)\n value -= 90 + Math.floor(Math.random() * 4.1 - 2);\n else\n value += 90 + Math.floor(Math.random() * 4.1 - 2);\n };\n Crack.prototype.start = function (x, y, angle) {\n this.x = x + .61 * Math.cos(angle * Math.PI / 180);\n this.y = y + .61 * Math.sin(angle * Math.PI / 180);\n this.angle = angle;\n };\n Crack.prototype.continue = function () {\n this.x += .42 * Math.cos(this.angle * Math.PI / 180);\n this.y += .42 * Math.sin(this.angle * Math.PI / 180);\n };\n return Crack;\n}());\nwindow.main = new Substrate(\"substrate-canvas\", 20);\n\n\n//# sourceURL=webpack:///./src/substrate.ts?"); - -/***/ }), - -/***/ "./src/weather.ts": -/*!************************!*\ - !*** ./src/weather.ts ***! - \************************/ -/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { - -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var openmeteo__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! openmeteo */ \"./node_modules/openmeteo/lib/index.js\");\n/* harmony import */ var openmeteo__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(openmeteo__WEBPACK_IMPORTED_MODULE_0__);\nvar __assign = (undefined && undefined.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (undefined && undefined.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nvar __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\n\nvar Weather = /** @class */ (function () {\n function Weather(latitude, longitude) {\n latitude !== null && latitude !== void 0 ? latitude : (latitude = 47.61002138071677);\n longitude !== null && longitude !== void 0 ? longitude : (longitude = -122.17906310779568);\n this.options = new WeatherOptions();\n this.options = __assign(__assign({}, this.options), { latitude: latitude, longitude: longitude });\n this.getWeather(this.options);\n }\n Weather.prototype.getWeather = function (options) {\n return __awaiter(this, void 0, void 0, function () {\n var url, responses, _loop_1, _i, responses_1, response;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n url = \"https://api.open-meteo.com/v1/forecast\";\n return [4 /*yield*/, (0,openmeteo__WEBPACK_IMPORTED_MODULE_0__.fetchWeatherApi)(url, this.options)];\n case 1:\n responses = _a.sent();\n _loop_1 = function (response) {\n // Attributes for timezone and location\n var utcOffsetSeconds = response.utcOffsetSeconds();\n var timezone = response.timezone();\n var timezoneAbbreviation = response.timezoneAbbreviation();\n var latitude = response.latitude();\n var longitude = response.longitude();\n var current = response.current();\n var hourly = response.hourly();\n var daily = response.daily();\n var sunrise = daily.variables(2);\n var sunset = daily.variables(3);\n // Note: The order of weather variables in the URL query and the indices below need to match!\n var weatherData = {\n current: {\n time: new Date((Number(current.time()) + utcOffsetSeconds) * 1000),\n temperature2m: current.variables(0).value(),\n relativeHumidity2m: current.variables(1).value(),\n apparentTemperature: current.variables(2).value(),\n precipitation: current.variables(3).value(),\n windSpeed10m: current.variables(4).value(),\n windGusts10m: current.variables(5).value(),\n windDirection10m: current.variables(6).value(),\n },\n hourly: {\n time: __spreadArray([], Array((Number(hourly.timeEnd()) - Number(hourly.time())) / hourly.interval()), true).map(function (_, i) { return new Date((Number(hourly.time()) + i * hourly.interval() + utcOffsetSeconds) * 1000); }),\n temperature2m: hourly.variables(0).valuesArray(),\n precipitation: hourly.variables(1).valuesArray(),\n precipitationProbability: hourly.variables(2).valuesArray(),\n },\n daily: {\n time: __spreadArray([], Array((Number(daily.timeEnd()) - Number(daily.time())) / daily.interval()), true).map(function (_, i) { return new Date((Number(daily.time()) + i * daily.interval() + utcOffsetSeconds) * 1000); }),\n temperature2mMax: daily.variables(0).valuesArray(),\n temperature2mMin: daily.variables(1).valuesArray(),\n sunrise: __spreadArray([], Array(sunrise.valuesInt64Length()), true).map(function (_, i) { return new Date((Number(sunrise.valuesInt64(i)) + utcOffsetSeconds) * 1000); }),\n sunset: __spreadArray([], Array(sunset.valuesInt64Length()), true).map(function (_, i) { return new Date((Number(sunset.valuesInt64(i)) + utcOffsetSeconds) * 1000); }),\n uvIndexMax: daily.variables(4).valuesArray(),\n precipitationSum: daily.variables(5).valuesArray(),\n precipitationHours: daily.variables(6).valuesArray(),\n windSpeed10mMax: daily.variables(7).valuesArray(),\n windGusts10mMax: daily.variables(8).valuesArray(),\n windDirection10mDominant: daily.variables(9).valuesArray(),\n },\n };\n // `weatherData` now contains a simple structure with arrays for datetime and weather data\n for (var i = 0; i < weatherData.hourly.time.length; i++) {\n console.log(weatherData.hourly.time[i].toISOString(), weatherData.hourly.temperature2m[i], weatherData.hourly.precipitation[i], weatherData.hourly.precipitationProbability[i]);\n }\n for (var i = 0; i < weatherData.daily.time.length; i++) {\n console.log(weatherData.daily.time[i].toISOString(), weatherData.daily.temperature2mMax[i], weatherData.daily.temperature2mMin[i], weatherData.daily.sunrise[i].toISOString(), weatherData.daily.sunset[i].toISOString(), weatherData.daily.uvIndexMax[i], weatherData.daily.precipitationSum[i], weatherData.daily.precipitationHours[i], weatherData.daily.windSpeed10mMax[i], weatherData.daily.windGusts10mMax[i], weatherData.daily.windDirection10mDominant[i]);\n }\n };\n for (_i = 0, responses_1 = responses; _i < responses_1.length; _i++) {\n response = responses_1[_i];\n _loop_1(response);\n }\n return [2 /*return*/];\n }\n });\n });\n };\n return Weather;\n}());\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Weather);\nvar WeatherOptions = /** @class */ (function () {\n function WeatherOptions() {\n this.daily = [\"temperature_2m_max\", \"temperature_2m_min\", \"sunrise\", \"sunset\", \"uv_index_max\", \"precipitation_sum\", \"precipitation_hours\", \"wind_speed_10m_max\", \"wind_gusts_10m_max\", \"wind_direction_10m_dominant\"];\n this.hourly = [\"temperature_2m\", \"precipitation\", \"precipitation_probability\"];\n this.current = [\"temperature_2m\", \"relative_humidity_2m\", \"apparent_temperature\", \"precipitation\", \"wind_speed_10m\", \"wind_gusts_10m\", \"wind_direction_10m\"];\n this.timezone = \"America/Los_Angeles\";\n this[\"wind_speed_unit\"] = \"mph\";\n this[\"temperature_unit\"] = \"fahrenheit\";\n this[\"precipitation_unit\"] = \"inch\";\n }\n return WeatherOptions;\n}());\n\n\n//# sourceURL=webpack:///./src/weather.ts?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./state */ \"./src/state.ts\");\n// TS attempt of http://www.complexification.net/gallery/machines/substrate/index.php by laniaung.me\n\nvar Substrate = /** @class */ (function () {\n function Substrate(maxCracks, colors) {\n if (!(colors === null || colors === void 0 ? void 0 : colors.length))\n colors = [0x3a1e3e, 0x7c2d3b, 0xb94f3c, 0xf4a462, 0xf9c54e]; // https://colormagic.app/palette/671eeb6c42273fc4c1bb1ac7\n var canvas = document.createElement(\"canvas\");\n canvas.width = document.body.clientWidth;\n canvas.height = document.body.clientHeight;\n document.body.appendChild(canvas);\n this.state = new _state__WEBPACK_IMPORTED_MODULE_0__[\"default\"](colors, maxCracks, canvas);\n this.init();\n }\n Substrate.prototype.init = function () {\n var me = this;\n var request;\n var draw = function () {\n for (var _i = 0, _a = me.state.cracks; _i < _a.length; _i++) {\n var crack = _a[_i];\n crack.draw();\n }\n request = requestAnimationFrame(draw);\n };\n setInterval(function () {\n cancelAnimationFrame(request);\n me.state.init();\n request = requestAnimationFrame(draw);\n }, 60 * 1000);\n request = requestAnimationFrame(draw);\n };\n return Substrate;\n}());\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Substrate);\n\n\n//# sourceURL=webpack:///./src/substrate.ts?"); /***/ }) @@ -220,25 +80,13 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /******/ }; /******/ /******/ // Execute the module function -/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ -/******/ /* webpack/runtime/compat get default export */ -/******/ (() => { -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = (module) => { -/******/ var getter = module && module.__esModule ? -/******/ () => (module['default']) : -/******/ () => (module); -/******/ __webpack_require__.d(getter, { a: getter }); -/******/ return getter; -/******/ }; -/******/ })(); -/******/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports diff --git a/www/styles.css b/www/styles.css index 00caea7..cb44723 100644 --- a/www/styles.css +++ b/www/styles.css @@ -5,7 +5,3 @@ body { overflow: hidden; padding: 0; } -body canvas { - height: 100%; - width: 100%; -}