autumnplot-gl 4.0.0-beta → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -207
- package/dist/812.autumnplot-gl.js +2 -0
- package/dist/812.autumnplot-gl.js.map +1 -0
- package/dist/983.autumnplot-gl.js +2 -0
- package/dist/983.autumnplot-gl.js.map +1 -0
- package/dist/autumnplot-gl.js +1 -1
- package/dist/autumnplot-gl.js.map +1 -1
- package/dist/marchingsquares.wasm +0 -0
- package/lib/AutumnTypes.d.ts +38 -5
- package/lib/AutumnTypes.js +7 -1
- package/lib/Barbs.d.ts +12 -2
- package/lib/Barbs.js +9 -0
- package/lib/BillboardCollection.d.ts +2 -2
- package/lib/BillboardCollection.js +14 -14
- package/lib/Color.d.ts +1 -0
- package/lib/Color.js +1 -0
- package/lib/ColorBar.d.ts +14 -0
- package/lib/ColorBar.js +15 -8
- package/lib/Colormap.d.ts +9 -1
- package/lib/Colormap.js +24 -1
- package/lib/Contour.d.ts +26 -1
- package/lib/Contour.js +24 -2
- package/lib/ContourCreator.worker.d.ts +25 -0
- package/lib/{ContourCreator.js → ContourCreator.worker.js} +15 -14
- package/lib/Fill.d.ts +31 -11
- package/lib/Fill.js +38 -18
- package/lib/Hodographs.d.ts +19 -3
- package/lib/Hodographs.js +45 -20
- package/lib/Map.d.ts +13 -1
- package/lib/Map.js +62 -8
- package/lib/Paintball.d.ts +14 -5
- package/lib/Paintball.js +96 -46
- package/lib/PlotComponent.d.ts +9 -3
- package/lib/PlotComponent.js +36 -1
- package/lib/PlotLayer.d.ts +2 -2
- package/lib/PlotLayer.js +2 -2
- package/lib/PlotLayer.worker.js +9 -3
- package/lib/RawField.d.ts +223 -27
- package/lib/RawField.js +413 -59
- package/lib/StationPlot.d.ts +78 -11
- package/lib/StationPlot.js +113 -30
- package/lib/TextCollection.d.ts +5 -0
- package/lib/TextCollection.js +82 -9
- package/lib/WasmInterface.d.ts +7 -0
- package/lib/WasmInterface.js +11 -0
- package/lib/WorkerPool.d.ts +8 -0
- package/lib/WorkerPool.js +77 -0
- package/lib/cpp/marchingsquares.js +127 -13
- package/lib/cpp/marchingsquares.wasm +0 -0
- package/lib/cpp/marchingsquares_embind.d.ts +16 -3
- package/lib/grids/AutoZoom.d.ts +21 -0
- package/lib/grids/AutoZoom.js +63 -0
- package/lib/grids/DomainBuffer.d.ts +14 -0
- package/lib/grids/DomainBuffer.js +16 -0
- package/lib/grids/Geostationary.d.ts +35 -0
- package/lib/grids/Geostationary.js +47 -0
- package/lib/grids/Grid.d.ts +36 -0
- package/lib/grids/Grid.js +12 -0
- package/lib/grids/GridCoordinates.d.ts +10 -0
- package/lib/grids/GridCoordinates.js +64 -0
- package/lib/grids/LambertGrid.d.ts +73 -0
- package/lib/grids/LambertGrid.js +92 -0
- package/lib/grids/PlateCarreeGrid.d.ts +46 -0
- package/lib/grids/PlateCarreeGrid.js +55 -0
- package/lib/grids/PlateCarreeRotatedGrid.d.ts +53 -0
- package/lib/grids/PlateCarreeRotatedGrid.js +65 -0
- package/lib/grids/RadarSweepGrid.d.ts +46 -0
- package/lib/grids/RadarSweepGrid.js +74 -0
- package/lib/grids/StructuredGrid.d.ts +49 -0
- package/lib/grids/StructuredGrid.js +103 -0
- package/lib/grids/UnstructuredGrid.d.ts +56 -0
- package/lib/grids/UnstructuredGrid.js +102 -0
- package/lib/index.d.ts +23 -6
- package/lib/index.js +18 -8
- package/lib/utils.d.ts +11 -2
- package/lib/utils.js +63 -1
- package/package.json +4 -3
- package/dist/110.autumnplot-gl.js +0 -2
- package/dist/110.autumnplot-gl.js.map +0 -1
- package/lib/ContourCreator.d.ts +0 -22
- package/lib/Grid.d.ts +0 -263
- package/lib/Grid.js +0 -547
- package/lib/ParticleTracer.d.ts +0 -19
- package/lib/ParticleTracer.js +0 -37
package/README.md
CHANGED
|
@@ -1,221 +1,27 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
1
3
|
# autumnplot-gl
|
|
2
4
|
Hardware-accelerated geospatial data plotting in the browser
|
|
3
5
|
|
|
4
6
|
## Links
|
|
5
|
-
[Github](https://github.com/tsupinie/autumnplot-gl) | [API docs](https://tsupinie.github.io/autumnplot-gl/) | [NPM](https://www.npmjs.com/package/autumnplot-gl)
|
|
7
|
+
[Github](https://github.com/tsupinie/autumnplot-gl) | [Tutorial](https://tsupinie.github.io/autumnplot-gl) | [API docs](https://tsupinie.github.io/autumnplot-gl/docs/api) | [NPM](https://www.npmjs.com/package/autumnplot-gl)
|
|
6
8
|
|
|
7
9
|
## What is this?
|
|
8
10
|
Lots of meteorological data web sites have a model where the data live on a central server, get plotted on the server, and then the server serves static images to the client. This creates a bottleneck where adding fields and view sectors takes exponentially more processing power for the server. One way around this is to offload the plotting to the client and to have the browser plot the data on a pan-and-zoomable map. Unfortunately, in the past, this has required developing low-level plotting code, and depending on the mapping library, the performance may be poor.
|
|
9
11
|
|
|
10
12
|
autumnplot-gl provides a solution to this problem by making hardware-accelerated data plotting in the browser easy. This was designed with meteorological data in mind, but anyone wanting to contour geospatial data on a map can use autumnplot-gl.
|
|
11
13
|
|
|
12
|
-
##
|
|
13
|
-
autumnplot-gl is designed to be used with either [Mapbox GL JS](https://docs.mapbox.com/mapbox-gl-js/guides/) or [MapLibre GL JS](https://maplibre.org/maplibre-gl-js-docs/) mapping libraries. If you're using webpack or another node-based build tool, you can install by running
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm i autumnplot-gl
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Unfortunately, you may have to modify your build tool configuration to include the WebAssembly binary. For webpack, I've found adding this to webpack.config.js works:
|
|
20
|
-
|
|
21
|
-
```javascript
|
|
22
|
-
{
|
|
23
|
-
"module": {
|
|
24
|
-
"rules": [
|
|
25
|
-
{
|
|
26
|
-
test: /\.wasm$/,
|
|
27
|
-
type: "asset/resource",
|
|
28
|
-
generator: {
|
|
29
|
-
filename: "[name].wasm"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
In addition to the Typescript library, pre-built autumnplot-gl javascript files area available [here](https://tsupinie.github.io/autumnplot-gl/dist/). Adding them to your page exposes the API via the `apgl` global variable (e.g., instead of `new PlateCarreeGrid(...)` in the examples, you'd call `new apgl.PlateCarreeGrid(...)`).
|
|
38
|
-
|
|
39
|
-
### A basic contour plot
|
|
40
|
-
The first step in plotting data is to create a grid. Currently, the only supported grids are PlateCarreeGrid (a.k.a. Lat/Lon), RotatedPlateCarreeGrid, and LambertGrid (a.k.a. Lambert Conformal Conic).
|
|
41
|
-
|
|
42
|
-
```javascript
|
|
43
|
-
// Create a grid object that covers the continental United States
|
|
44
|
-
const nx = 121, ny = 61;
|
|
45
|
-
const grid = new PlateCarreeGrid(nx, ny, -130, 20, -65, 55);
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
Next, create a RawScalarField with the data. autumnplot-gl doesn't care about how data get to the browser, but it should end up in a `Float32Array` or `Float16Array` in row-major order with the first element being at the southwest corner of the grid. If you're using [zarr.js](https://github.com/gzuidhof/zarr.js/), you can use the `getRaw()` function on a `ZarrArray` to get data in the correct format. Also, `Float16Array`s are not in the Javascript standard library (for now), so for the time being, you'll need to use [this library](https://github.com/petamoriken/float16). However, the nice part about using a `Float16Array` is that your data will be stored as float16s in VRAM, so they'll take up half the space as the same data as float32s. Once you have your data in that format, to create the raw data field:
|
|
49
|
-
|
|
50
|
-
```javascript
|
|
51
|
-
// Create the raw data field
|
|
52
|
-
const height_field = new RawScalarField(grid, height_data);
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Next, to contour the field, create a Contour object and pass it some options. See [here](https://tsupinie.github.io/autumnplot-gl/interfaces/ContourOptions.html) for a full list of options.
|
|
56
|
-
|
|
57
|
-
```javascript
|
|
58
|
-
// Contour the data
|
|
59
|
-
const height_contour = new Contour(height_field, {color: '#000000', interval: 30});
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Next, create the actual layer that gets added to the map. The first argument (`'height-contour'` here) is an id. It doesn't mean much, but it does need to be unique between the different `PlotLayer`s you add to the map.
|
|
63
|
-
|
|
64
|
-
```javascript
|
|
65
|
-
// Create the map layer
|
|
66
|
-
const height_layer = new PlotLayer('height-contour', height_contour);
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Finally, add it to the map. The interface for Mapbox and MapLibre are the same, at least currently, though there's nothing that says they'll stay that way in the future. Assuming you're using MapLibre:
|
|
70
|
-
|
|
71
|
-
```javascript
|
|
72
|
-
const map = new maplibregl.Map({
|
|
73
|
-
container: 'map',
|
|
74
|
-
style: 'https://api.maptiler.com/maps/basic-v2/style.json?key=' + maptiler_api_key,
|
|
75
|
-
center: [-97.5, 38.5],
|
|
76
|
-
zoom: 4
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
map.on('load', () => {
|
|
80
|
-
map.addLayer(height_layer, 'railway_transit_tunnel');
|
|
81
|
-
});
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
The `'railway_transit_tunnel'` argument is a layer in the map style, and this means to add your layer just below that layer on the map. This usually produces better results than just blindly slapping all your layers on top of all the map (though the map style itself may require some tweaking to produce the best results).
|
|
85
|
-
|
|
86
|
-
### Contour Labeling
|
|
87
|
-
|
|
88
|
-
Typically, when plotting meteorological data, contours are labeled with their values, which you can do with `ContourLabels`:
|
|
89
|
-
|
|
90
|
-
```javascript
|
|
91
|
-
const labels = new ContourLabels(height_contour, {text_color: '#ffffff', halo: true});
|
|
92
|
-
const label_layer = new PlotLayer('label', labels);
|
|
93
|
-
|
|
94
|
-
map.on('load', () => {
|
|
95
|
-
map.addLayer(label_layer, 'railway_transit_tunnel');
|
|
96
|
-
});
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Barbs
|
|
100
|
-
|
|
101
|
-
Wind barb plotting is similar to the contours, but it requires using a `RawVectorField` with u and v data.
|
|
102
|
-
|
|
103
|
-
```javascript
|
|
104
|
-
const vector_field = new RawVectorField(grid, u_data, v_data);
|
|
105
|
-
const barbs = new Barbs(vector_field, {color: '#000000', thin_fac: 16});
|
|
106
|
-
const barb_layer = new PlotLayer('barbs', barbs);
|
|
107
|
-
|
|
108
|
-
map.on('load', () => {
|
|
109
|
-
map.addLayer(barb_layer, 'railway_transit_tunnel');
|
|
110
|
-
});
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
The wind barbs are automatically rotated based on the grid projection. Also, the density of the wind barbs is automatically varied based on the map zoom level. The `'thin_fac': 16` option means to plot every 16th wind barb in the i and j directions, and this is defined at zoom level 1. So at zoom level 2, it will plot every 8th wind barb, and at zoom level 3 every 4th wind barb, and so on. Because it divides in 2 for every deeper zoom level, `'thin_fac'` should be a power of 2.
|
|
114
|
-
|
|
115
|
-
### Filled contours or raster plots
|
|
116
|
-
|
|
117
|
-
Plotting filled contours is also similar to plotting regular contours, but there's some additional steps for the color map. A couple color maps are available by default (see [here](#built-in-color-maps) for more details), but if you have the colors you want, creating your own is (relatively) painless (hopefully). First, set up the colormap. Here, we'll just use the bluered colormap included by default.
|
|
118
|
-
|
|
119
|
-
```javascript
|
|
120
|
-
// colormaps is imported via `import {colormaps} from 'autumnplot-gl'`
|
|
121
|
-
const colormap = colormaps.bluered(-10, 10, 20);
|
|
122
|
-
const fills = new ContourFilled(height, {cmap: colormap, opacity: 0.6});
|
|
123
|
-
const height_fill_layer = new PlotLayer('height-fill', fills);
|
|
124
|
-
|
|
125
|
-
map.on('load', () => {
|
|
126
|
-
map.addLayer(height_fill_layer, 'railway_transit_tunnel');
|
|
127
|
-
});
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
Making a raster plot is very similar (the two classes support the same options):
|
|
131
|
-
|
|
132
|
-
```javascript
|
|
133
|
-
const raster = new Raster(height, {cmap: colormap, opacity: 0.6});
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
Normally, when you have a color fill, you have a color bar on the plot. To create an SVG color bar:
|
|
137
|
-
|
|
138
|
-
```javascript
|
|
139
|
-
const colorbar_svg = makeColorBar(colormap, {label: "Height Perturbation (m)",
|
|
140
|
-
ticks: [-10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10],
|
|
141
|
-
orientation: 'horizontal',
|
|
142
|
-
tick_direction: 'bottom'});
|
|
143
|
-
|
|
144
|
-
document.getElementById('colorbar-container').appendChild(colorbar_svg);
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### Varying the data plots
|
|
148
|
-
The previous steps have gone through plotting a static dataset on a map, but in many instances, you want to view a dataset that changes, say over time. In order to switch the data currently plotted, you can call `updateField()` on the plot component (e.g, `ContourFilled`, `Barbs`, etc.) to switch what field is plotted.
|
|
149
|
-
|
|
150
|
-
```javascript
|
|
151
|
-
// Create the initial field
|
|
152
|
-
const height_field_f00 = new RawScalarField(grid, height_data_f00);
|
|
153
|
-
const fills = new Contour(height_data_f00, {interval: 30});
|
|
154
|
-
|
|
155
|
-
// Update the field plotted
|
|
156
|
-
const height_field_f01 = new RawScalarField(grid, height_data_f01);
|
|
157
|
-
fills.updateField(height_field_f01);
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
Another way to vary the data is to use `MultiPlotLayer`. The main difference between this and using `updateField()` is that `MultiPlotLayer` will put all data for all times onto VRAM at once. In contrast, with `PlotLayer` and `updateField()`, only the data currently plotted are stored on VRAM. For large grids, this may take up a large amount of VRAM, so you may not want to use this, and it may be removed in later versions.
|
|
161
|
-
|
|
162
|
-
```javascript
|
|
163
|
-
// Contour some data
|
|
164
|
-
const height_contour_f00 = new Contour(height_f00);
|
|
165
|
-
const height_contour_f01 = new Contour(height_f01);
|
|
166
|
-
const height_contour_f02 = new Contour(height_f02);
|
|
167
|
-
|
|
168
|
-
// Create a varying map layer
|
|
169
|
-
const height_layer_time = new MultiPlotLayer('height-contour-time');
|
|
170
|
-
|
|
171
|
-
// Add the contoured data to it
|
|
172
|
-
height_layer_time.addField(height_contour_f00, '20230112_1200');
|
|
173
|
-
height_layer_time.addField(height_contour_f01, '20230112_1300');
|
|
174
|
-
height_layer_time.addField(height_contour_f02, '20230112_1400');
|
|
175
|
-
|
|
176
|
-
// Add to the map like normal
|
|
177
|
-
map.on('load', () => {
|
|
178
|
-
map.addLayer(height_layer_time, 'railway_transit_tunnel');
|
|
179
|
-
});
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
The second argument to `addField()` is the key to associate with this field. This example uses the absolute time, but you could just as easily use `'f00'`, `'f01'`, ... or anything else that's relevant as long as it's unique. Now to set the active time (i.e., the time that gets plotted):
|
|
183
|
-
|
|
184
|
-
```javascript
|
|
185
|
-
// Set the active field in the map layer (the map updates automatically)
|
|
186
|
-
height_layer.setActiveKey('20230112_1200');
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### Typescript Considerations
|
|
190
|
-
|
|
191
|
-
autumnplot-gl is written in Typescript to facilitate type info in large projects. Typescript isn't necessary to use autumnplot-gl, but if you want to use it, there are some considerations.
|
|
192
|
-
|
|
193
|
-
Many of the plot component classes have generic types. The Typescript compiler can generally figure out the generic type parameters, but if you're declaring a variable to be a plot component, you'll probably need to specify those ahead of time. The first type parameter is the array type (either Float32Array or Float16Array), and the second is the type of the Map you're using.
|
|
194
|
-
|
|
195
|
-
```typescript
|
|
196
|
-
// Import the map from maplibre-gl, if that's what you're using. Mapbox should be similar.
|
|
197
|
-
import { Map } from 'maplibre-gl';
|
|
198
|
-
|
|
199
|
-
// Declare a contour field which contours an array of float float32s with the MapLibre map.
|
|
200
|
-
const cntr: Contour<Float32Array, Map>;
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
## Built-in color maps
|
|
204
|
-
autumnplot-gl comes with several built-in color maps, accessible via `import {colormaps} from 'autumnplot-gl'`. These are basic blue/red and red/blue diverging color maps plus a selection from [PivotalWeather](https://www.pivotalweather.com). The blue/red and red/blue are functions that take a minimum contour level, a maximum contour level, and a number of colors. For example, this creates a blue/red colormap starting at -10, ending at 10, and with 20 colors:
|
|
205
|
-
|
|
206
|
-
```javascript
|
|
207
|
-
const colormap = colormaps.bluered(-10, 10, 20);
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
Here are all the colormaps available:
|
|
211
|
-
|
|
212
|
-

|
|
14
|
+
## How do I use this?
|
|
213
15
|
|
|
16
|
+
Check out the [tutorial](https://tsupinie.github.io/autumnplot-gl) for installation and usage information.
|
|
214
17
|
|
|
215
|
-
##
|
|
216
|
-
The above exmple uses map tiles from [Maptiler](https://www.maptiler.com/). Map tiles from Maptiler or Mapbox or others are free up to a (reasonably generous) limit, but the pricing can be a tad steep after reaching the limit. The tiles from these services are extremely detailed, and really what you're paying for there is the hardware to store, process, and serve that data. While these tiles are very nice, the detail is way overkill for a lot of uses in meteorology.
|
|
18
|
+
## Development
|
|
217
19
|
|
|
218
|
-
|
|
20
|
+
To work on autumnplot-gl itself, it takes a few steps to set up
|
|
219
21
|
|
|
220
|
-
|
|
221
|
-
|
|
22
|
+
1. Install [node.js](https://nodejs.org/en/download/) if you don't have it already
|
|
23
|
+
2. Install [emscripten](https://emscripten.org/docs/getting_started/downloads.html) and source the relevant SDK environment for your shell
|
|
24
|
+
3. Clone the autumnplot-gl git repo (`git clone https://github.com/tsupinie/autumnplot-gl ; cd autumnplot-gl`)
|
|
25
|
+
4. Install the dependencies (`npm install`)
|
|
26
|
+
5. Build the WASM module (`cd src/cpp ; make js ; cd -`)
|
|
27
|
+
6. Start the dev server (`npm run start`)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.apgl=t():e.apgl=t()}(this,()=>(()=>{var e={533:e=>{var t,r=(t="undefined"!=typeof document?document.currentScript?.src:void 0,function(e={}){var r,n,a,o=e,i=new Promise((e,t)=>{n=e,a=t});if(["getExceptionMessage","incrementExceptionRefcount","decrementExceptionRefcount","_memory","___indirect_function_table","onRuntimeInitialized"].forEach(e=>{Object.getOwnPropertyDescriptor(i,e)||Object.defineProperty(i,e,{get:()=>D("You are getting "+e+" on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"),set:()=>D("You are setting "+e+" on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")})}),o.ENVIRONMENT)throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");var s,l=Object.assign({},o),c="";if("undefined"!=typeof document&&document.currentScript&&(c=document.currentScript.src),t&&(c=t),c=c.startsWith("blob:")?"":c.substr(0,c.replace(/[?#].*/,"").lastIndexOf("/")+1),"object"!=typeof window&&"function"!=typeof importScripts)throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");s=e=>(S(!j(e),"readAsync does not work with file:// URLs"),fetch(e,{credentials:"same-origin"}).then(e=>e.ok?e.arrayBuffer():Promise.reject(new Error(e.status+" : "+e.url))));var u,d,p,f=o.print||console.log.bind(console),m=o.printErr||console.error.bind(console);Object.assign(o,l),l=null,u="fetchSettings",Object.getOwnPropertyDescriptor(o,u)&&D(`\`Module.${u}\` was supplied but \`${u}\` not included in INCOMING_MODULE_JS_API`),o.arguments&&o.arguments,Y("arguments","arguments_"),o.thisProgram&&o.thisProgram,Y("thisProgram","thisProgram"),o.quit&&o.quit,Y("quit","quit_"),S(void 0===o.memoryInitializerPrefixURL,"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),S(void 0===o.pthreadMainPrefixURL,"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),S(void 0===o.cdInitializerPrefixURL,"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),S(void 0===o.filePackagePrefixURL,"Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),S(void 0===o.read,"Module.read option was removed"),S(void 0===o.readAsync,"Module.readAsync option was removed (modify readAsync in JS)"),S(void 0===o.readBinary,"Module.readBinary option was removed (modify readBinary in JS)"),S(void 0===o.setWindowTitle,"Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)"),S(void 0===o.TOTAL_MEMORY,"Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),Y("asm","wasmExports"),Y("readAsync","readAsync"),Y("readBinary","readBinary"),Y("setWindowTitle","setWindowTitle"),S(!0,"worker environment detected but not enabled at build time. Add `worker` to `-sENVIRONMENT` to enable."),S(!0,"node environment detected but not enabled at build time. Add `node` to `-sENVIRONMENT` to enable."),S(!0,"shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable."),o.wasmBinary&&(d=o.wasmBinary),Y("wasmBinary","wasmBinary"),"object"!=typeof WebAssembly&&m("no native wasm support detected");var g,h,v,y,_,b,w,T,E=!1;function S(e,t){e||D("Assertion failed"+(t?": "+t:""))}function F(){var e=p.buffer;o.HEAP8=g=new Int8Array(e),o.HEAP16=v=new Int16Array(e),o.HEAPU8=h=new Uint8Array(e),o.HEAPU16=y=new Uint16Array(e),o.HEAP32=_=new Int32Array(e),o.HEAPU32=b=new Uint32Array(e),o.HEAPF32=w=new Float32Array(e),o.HEAPF64=T=new Float64Array(e)}function A(){if(!E){var e=ht();0==e&&(e+=4);var t=b[e>>2],r=b[e+4>>2];34821223==t&&2310721022==r||D(`Stack overflow! Stack cookie has been overwritten at ${Q(e)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${Q(r)} ${Q(t)}`),1668509029!=b[0]&&D("Runtime error: The application has corrupted its heap memory area (address zero)!")}}S(!o.STACK_SIZE,"STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time"),S("undefined"!=typeof Int32Array&&"undefined"!=typeof Float64Array&&null!=Int32Array.prototype.subarray&&null!=Int32Array.prototype.set,"JS engine does not provide full typed array support"),S(!o.wasmMemory,"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"),S(!o.INITIAL_MEMORY,"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically"),function(){var e=new Int16Array(1),t=new Int8Array(e.buffer);if(e[0]=25459,115!==t[0]||99!==t[1])throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"}();var P=[],C=[],I=[],k=!1;function M(e){P.unshift(e)}function R(e){I.unshift(e)}S(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),S(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),S(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),S(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var O=0,L=null,x=null,U={};function D(e){o.onAbort?.(e),m(e="Aborted("+e+")"),E=!0;var t=new WebAssembly.RuntimeError(e);throw a(t),t}var N={error(){D("Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM")},init(){N.error()},createDataFile(){N.error()},createPreloadedFile(){N.error()},createLazyFile(){N.error()},open(){N.error()},mkdev(){N.error()},registerDevice(){N.error()},analyzePath(){N.error()},ErrnoError(){N.error()}};o.FS_createDataFile=N.createDataFile,o.FS_createPreloadedFile=N.createPreloadedFile;var $,W=e=>e.startsWith("data:application/octet-stream;base64,"),j=e=>e.startsWith("file://");function B(e,t){return(...r)=>{S(k,`native function \`${e}\` called before runtime initialization`);var n=ct[e];return S(n,`exported native function \`${e}\` not found`),S(r.length<=t,`native function \`${e}\` called with ${r.length} args but expects ${t}`),n(...r)}}class V extends Error{}class G extends V{constructor(e){super(e),this.excPtr=e;const t=it(e);this.name=t[0],this.message=t[1]}}function z(e){if(e==$&&d)return new Uint8Array(d);throw"both async and sync fetching of the wasm failed"}function H(e,t,r){return function(e){return d?Promise.resolve().then(()=>z(e)):s(e).then(e=>new Uint8Array(e),()=>z(e))}(e).then(e=>WebAssembly.instantiate(e,t)).then(r,e=>{m(`failed to asynchronously prepare wasm: ${e}`),j($)&&m(`warning: Loading from a file URI (${$}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`),D(e)})}function Y(e,t,r=!0){Object.getOwnPropertyDescriptor(o,e)||Object.defineProperty(o,e,{configurable:!0,get(){D(`\`Module.${e}\` has been replaced by \`${t}\``+(r?" (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)":""))}})}function J(e){return"FS_createPath"===e||"FS_createDataFile"===e||"FS_createPreloadedFile"===e||"FS_unlink"===e||"addRunDependency"===e||"FS_createLazyFile"===e||"FS_createDevice"===e||"removeRunDependency"===e}function q(e,t){"undefined"!=typeof globalThis&&Object.defineProperty(globalThis,e,{configurable:!0,get(){te(`\`${e}\` is not longer defined by emscripten. ${t}`)}})}function K(e){Object.getOwnPropertyDescriptor(o,e)||Object.defineProperty(o,e,{configurable:!0,get(){var t=`'${e}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;J(e)&&(t+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),D(t)}})}q("buffer","Please use HEAP8.buffer or wasmMemory.buffer"),q("asm","Please use wasmExports instead");var Z=e=>{for(;e.length>0;)e.shift()(o)};o.noExitRuntime;var Q=e=>(S("number"==typeof e),"0x"+(e>>>=0).toString(16).padStart(8,"0")),X=e=>vt(e),ee=()=>_t(),te=e=>{te.shown||={},te.shown[e]||(te.shown[e]=1,m(e))},re="undefined"!=typeof TextDecoder?new TextDecoder:void 0,ne=(e,t,r)=>{for(var n=t+r,a=t;e[a]&&!(a>=n);)++a;if(a-t>16&&e.buffer&&re)return re.decode(e.subarray(t,a));for(var o="";t<a;){var i=e[t++];if(128&i){var s=63&e[t++];if(192!=(224&i)){var l=63&e[t++];if(224==(240&i)?i=(15&i)<<12|s<<6|l:(240!=(248&i)&&te("Invalid UTF-8 leading byte "+Q(i)+" encountered when deserializing a UTF-8 string in wasm memory to a JS string!"),i=(7&i)<<18|s<<12|l<<6|63&e[t++]),i<65536)o+=String.fromCharCode(i);else{var c=i-65536;o+=String.fromCharCode(55296|c>>10,56320|1023&c)}}else o+=String.fromCharCode((31&i)<<6|s)}else o+=String.fromCharCode(i)}return o},ae=(e,t)=>(S("number"==typeof e,`UTF8ToString expects a number (got ${typeof e})`),e?ne(h,e,t):""),oe=[],ie=0;class se{constructor(e){this.excPtr=e,this.ptr=e-24}set_type(e){b[this.ptr+4>>2]=e}get_type(){return b[this.ptr+4>>2]}set_destructor(e){b[this.ptr+8>>2]=e}get_destructor(){return b[this.ptr+8>>2]}set_caught(e){e=e?1:0,g[this.ptr+12]=e}get_caught(){return 0!=g[this.ptr+12]}set_rethrown(e){e=e?1:0,g[this.ptr+13]=e}get_rethrown(){return 0!=g[this.ptr+13]}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){b[this.ptr+16>>2]=e}get_adjusted_ptr(){return b[this.ptr+16>>2]}get_exception_ptr(){if(St(this.get_type()))return b[this.excPtr>>2];var e=this.get_adjusted_ptr();return 0!==e?e:this.excPtr}}var le,ce,ue,de=e=>mt(e),pe=e=>{var t=ie?.excPtr;if(!t)return de(0),0;var r=new se(t);r.set_adjusted_ptr(t);var n=r.get_type();if(!n)return de(0),t;for(var a of e){if(0===a||a===n)break;var o=r.ptr+16;if(Et(a,n,o))return de(a),t}return de(n),t},fe=e=>{for(var t="",r=e;h[r];)t+=le[h[r++]];return t},me={},ge={},he={},ve=e=>{throw new ce(e)},ye=e=>{throw new ue(e)};function _e(e,t,r={}){if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");return function(e,t,r={}){var n=t.name;if(e||ve(`type "${n}" must have a positive integer typeid pointer`),ge.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;ve(`Cannot register type '${n}' twice`)}if(ge[e]=t,delete he[e],me.hasOwnProperty(e)){var a=me[e];delete me[e],a.forEach(e=>e())}}(e,t,r)}var be=[],we=[],Te=e=>{e>9&&0===--we[e+1]&&(S(void 0!==we[e],"Decref for unallocated handle."),we[e]=void 0,be.push(e))},Ee=e=>(e||ve("Cannot use deleted val. handle = "+e),S(2===e||void 0!==we[e]&&e%2==0,`invalid handle: ${e}`),we[e]),Se=e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const t=be.pop()||we.length;return we[t]=e,we[t+1]=1,t}}};function Fe(e){return this.fromWireType(b[e>>2])}var Ae={name:"emscripten::val",fromWireType:e=>{var t=Ee(e);return Te(e),t},toWireType:(e,t)=>Se(t),argPackAdvance:8,readValueFromPointer:Fe,destructorFunction:null},Pe=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e},Ce=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(w[e>>2])};case 8:return function(e){return this.fromWireType(T[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Ie=(e,t)=>Object.defineProperty(t,"name",{value:e}),ke=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Me(e){for(var t=1;t<e.length;++t)if(null!==e[t]&&void 0===e[t].destructorFunction)return!0;return!1}function Re(e,t){if(!(e instanceof Function))throw new TypeError(`new_ called with constructor type ${typeof e} which is not a function`);var r=Ie(e.name||"unknownFunctionName",function(){});r.prototype=e.prototype;var n=new r,a=e.apply(n,t);return a instanceof Object?a:n}var Oe,Le,xe,Ue=(e,t,r)=>{if(void 0===e[t].overloadTable){var n=e[t];e[t]=function(...n){return e[t].overloadTable.hasOwnProperty(n.length)||ve(`Function '${r}' called with an invalid number of arguments (${n.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[n.length].apply(this,n)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}},De=[],Ne=e=>{var t=De[e];return t||(e>=De.length&&(De.length=e+1),De[e]=t=Oe.get(e)),S(Oe.get(e)==t,"JavaScript-side Wasm function table mirror is out of date!"),t},$e=(e,t)=>{var r,n,a=(e=fe(e)).includes("j")?(n=t,S((r=e).includes("j")||r.includes("p"),"getDynCaller should only be called with i64 sigs"),(...e)=>((e,t,r=[])=>e.includes("j")?((e,t,r)=>(S("dynCall_"+(e=e.replace(/p/g,"i"))in o,`bad function pointer type - dynCall function not found for sig '${e}'`),S(r?.length?r.length===e.substring(1).replace(/j/g,"--").length:1==e.length),(0,o["dynCall_"+e])(t,...r)))(e,t,r):(S(Ne(t),`missing table entry in dynCall: ${t}`),Ne(t)(...r)))(r,n,e)):Ne(t);return"function"!=typeof a&&ve(`unknown function pointer with signature ${e}: ${t}`),a},We=e=>{var t=ut(e),r=fe(t);return pt(t),r},je=(e,t,r)=>{switch(t){case 1:return r?e=>g[e]:e=>h[e];case 2:return r?e=>v[e>>1]:e=>y[e>>1];case 4:return r?e=>_[e>>2]:e=>b[e>>2];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Be="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0,Ve=(e,t)=>{S(e%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");for(var r=e,n=r>>1,a=n+t/2;!(n>=a)&&y[n];)++n;if((r=n<<1)-e>32&&Be)return Be.decode(h.subarray(e,r));for(var o="",i=0;!(i>=t/2);++i){var s=v[e+2*i>>1];if(0==s)break;o+=String.fromCharCode(s)}return o},Ge=(e,t,r)=>{if(S(t%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),S("number"==typeof r,"stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),r??=2147483647,r<2)return 0;for(var n=t,a=(r-=2)<2*e.length?r/2:e.length,o=0;o<a;++o){var i=e.charCodeAt(o);v[t>>1]=i,t+=2}return v[t>>1]=0,t-n},ze=e=>2*e.length,He=(e,t)=>{S(e%4==0,"Pointer passed to UTF32ToString must be aligned to four bytes!");for(var r=0,n="";!(r>=t/4);){var a=_[e+4*r>>2];if(0==a)break;if(++r,a>=65536){var o=a-65536;n+=String.fromCharCode(55296|o>>10,56320|1023&o)}else n+=String.fromCharCode(a)}return n},Ye=(e,t,r)=>{if(S(t%4==0,"Pointer passed to stringToUTF32 must be aligned to four bytes!"),S("number"==typeof r,"stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),r??=2147483647,r<4)return 0;for(var n=t,a=n+r-4,o=0;o<e.length;++o){var i=e.charCodeAt(o);if(i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++o)),_[t>>2]=i,(t+=4)+4>a)break}return _[t>>2]=0,t-n},Je=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&++r,t+=4}return t},qe=(e,t)=>{var r=ge[e];return void 0===r&&ve(`${t} has unknown type ${We(e)}`),r},Ke=(e,t,r)=>{var n=[],a=e.toWireType(n,r);return n.length&&(b[t>>2]=Se(n)),a},Ze=[],Qe={},Xe=e=>{var t=Qe[e];return void 0===t?fe(e):t};Reflect.construct,xe=()=>performance.now();var et=e=>{var t=p.buffer,r=(e-t.byteLength+65535)/65536;try{return p.grow(r),F(),1}catch(r){m(`growMemory: Attempted to grow heap from ${t.byteLength} bytes to ${e} bytes, but got error: ${r}`)}},tt=[null,[],[]],rt=(e,t)=>{var r=tt[e];S(r),0===t||10===t?((1===e?f:m)(ne(r,0)),r.length=0):r.push(t)};o.incrementExceptionRefcount=e=>bt(e),o.decrementExceptionRefcount=e=>wt(e);var nt,at,ot=e=>yt(e),it=e=>(e=>{var t=ee(),r=ot(4),n=ot(4);Tt(e,r,n);var a,o=b[r>>2],i=b[n>>2],s=ae(o);return pt(o),i&&(a=ae(i),pt(i)),X(t),[s,a]})(e);o.getExceptionMessage=it,(()=>{for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);le=e})(),ce=o.BindingError=class extends Error{constructor(e){super(e),this.name="BindingError"}},ue=o.InternalError=class extends Error{constructor(e){super(e),this.name="InternalError"}},we.push(0,1,void 0,1,null,1,!0,1,!1,1),S(10===we.length),o.count_emval_handles=()=>we.length/2-5-be.length,Le=o.UnboundTypeError=(nt=Error,(at=Ie("UnboundTypeError",function(e){this.name="UnboundTypeError",this.message=e;var t=new Error(e).stack;void 0!==t&&(this.stack=this.toString()+"\n"+t.replace(/^Error(:[^\n]*)?\n/,""))})).prototype=Object.create(nt.prototype),at.prototype.constructor=at,at.prototype.toString=function(){return void 0===this.message?this.name:`${this.name}: ${this.message}`},at);var st,lt={__assert_fail:(e,t,r,n)=>{D(`Assertion failed: ${ae(e)}, at: `+[t?ae(t):"unknown filename",r,n?ae(n):"unknown function"])},__cxa_begin_catch:e=>{var t=new se(e);return t.get_caught()||t.set_caught(!0),t.set_rethrown(!1),oe.push(t),bt(t.excPtr),t.get_exception_ptr()},__cxa_find_matching_catch_2:()=>pe([]),__cxa_find_matching_catch_3:e=>pe([e]),__cxa_throw:(e,t,r)=>{throw new se(e).init(t,r),ie=new G(e)},__resumeException:e=>{throw ie||(ie=new G(e)),ie},_abort_js:()=>{D("native code called abort()")},_embind_register_bigint:(e,t,r,n,a)=>{},_embind_register_bool:(e,t,r,n)=>{_e(e,{name:t=fe(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:n},argPackAdvance:8,readValueFromPointer:function(e){return this.fromWireType(h[e])},destructorFunction:null})},_embind_register_emval:e=>_e(e,Ae),_embind_register_float:(e,t,r)=>{_e(e,{name:t=fe(t),fromWireType:e=>e,toWireType:(e,t)=>{if("number"!=typeof t&&"boolean"!=typeof t)throw new TypeError(`Cannot convert ${Pe(t)} to ${this.name}`);return t},argPackAdvance:8,readValueFromPointer:Ce(t,r),destructorFunction:null})},_embind_register_function:(e,t,r,n,a,i,s)=>{var l=((e,t)=>{for(var r=[],n=0;n<e;n++)r.push(b[t+4*n>>2]);return r})(t,r);e=(e=>{const t=(e=e.trim()).indexOf("(");return-1!==t?(S(")"==e[e.length-1],"Parentheses for argument names should match."),e.substr(0,t)):e})(e=fe(e)),a=$e(n,a),((e,t,r)=>{o.hasOwnProperty(e)?((void 0===r||void 0!==o[e].overloadTable&&void 0!==o[e].overloadTable[r])&&ve(`Cannot register public name '${e}' twice`),Ue(o,e,e),o.hasOwnProperty(r)&&ve(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),o[e].overloadTable[r]=t):(o[e]=t,void 0!==r&&(o[e].numArguments=r))})(e,function(){((e,t)=>{var r=[],n={};throw t.forEach(function e(t){n[t]||ge[t]||(he[t]?he[t].forEach(e):(r.push(t),n[t]=!0))}),new Le(`${e}: `+r.map(We).join([", "]))})(`Cannot call ${e} due to unbound types`,l)},t-1),((r,n)=>{function l(n){var l=(r=>{var n=[r[0],null].concat(r.slice(1));return((e,t,r)=>{o.hasOwnProperty(e)||ye("Replacing nonexistent public symbol"),void 0!==o[e].overloadTable&&void 0!==r?o[e].overloadTable[r]=t:(o[e]=t,o[e].argCount=r)})(e,function(e,t,r,n,a,o){var i=t.length;i<2&&ve("argTypes array size mismatch! Must at least get return value and 'this' types!"),S(!o,"Async bindings are only supported with JSPI.");for(var s=null!==t[1]&&null!==r,l=Me(t),c="void"!==t[0].name,u=[e,ve,n,a,ke,t[0],t[1]],d=0;d<i-2;++d)u.push(t[d+2]);if(!l)for(d=s?1:2;d<t.length;++d)null!==t[d].destructorFunction&&u.push(t[d].destructorFunction);let[p,f]=function(e,t,r,n){for(var a=Me(e),o=e.length,i="",s="",l=0;l<o-2;++l)i+=(0!==l?", ":"")+"arg"+l,s+=(0!==l?", ":"")+"arg"+l+"Wired";var c=`\n return function (${i}) {\n if (arguments.length !== ${o-2}) {\n throwBindingError('function ' + humanName + ' called with ' + arguments.length + ' arguments, expected ${o-2}');\n }`;a&&(c+="var destructors = [];\n");var u=a?"destructors":"null",d=["humanName","throwBindingError","invoker","fn","runDestructors","retType","classParam"];for(t&&(c+="var thisWired = classParam['toWireType']("+u+", this);\n"),l=0;l<o-2;++l)c+="var arg"+l+"Wired = argType"+l+"['toWireType']("+u+", arg"+l+");\n",d.push("argType"+l);if(t&&(s="thisWired"+(s.length>0?", ":"")+s),c+=(r||n?"var rv = ":"")+"invoker(fn"+(s.length>0?", ":"")+s+");\n",a)c+="runDestructors(destructors);\n";else for(l=t?1:2;l<e.length;++l){var p=1===l?"thisWired":"arg"+(l-2)+"Wired";null!==e[l].destructorFunction&&(c+=`${p}_dtor(${p});\n`,d.push(`${p}_dtor`))}return r&&(c+="var ret = retType['fromWireType'](rv);\nreturn ret;\n"),c+="}\n",[d,c=`if (arguments.length !== ${d.length}){ throw new Error(humanName + "Expected ${d.length} closure arguments " + arguments.length + " given."); }\n${c}`]}(t,s,c,o);p.push(f);var m=Re(Function,p)(...u);return Ie(e,m)}(e,n,null,a,i,s),t-1),[]})(n);l.length!==r.length&&ye("Mismatched type converter count");for(var c=0;c<r.length;++c)_e(r[c],l[c])}r.forEach(function(e){he[e]=n});var c=new Array(n.length),u=[],d=0;n.forEach((e,t)=>{ge.hasOwnProperty(e)?c[t]=ge[e]:(u.push(e),me.hasOwnProperty(e)||(me[e]=[]),me[e].push(()=>{c[t]=ge[e],++d===u.length&&l(c)}))}),0===u.length&&l(c)})([],l)},_embind_register_integer:(e,t,r,n,a)=>{t=fe(t),-1===a&&(a=4294967295);var o=e=>e;if(0===n){var i=32-8*r;o=e=>e<<i>>>i}var s=t.includes("unsigned"),l=(e,r)=>{if("number"!=typeof e&&"boolean"!=typeof e)throw new TypeError(`Cannot convert "${Pe(e)}" to ${r}`);if(e<n||e>a)throw new TypeError(`Passing a number "${Pe(e)}" from JS side to C/C++ side to an argument of type "${t}", which is outside the valid range [${n}, ${a}]!`)};_e(e,{name:t,fromWireType:o,toWireType:s?function(e,t){return l(t,this.name),t>>>0}:function(e,t){return l(t,this.name),t},argPackAdvance:8,readValueFromPointer:je(t,r,0!==n),destructorFunction:null})},_embind_register_memory_view:(e,t,r)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][t];function a(e){var t=b[e>>2],r=b[e+4>>2];return new n(g.buffer,r,t)}_e(e,{name:r=fe(r),fromWireType:a,argPackAdvance:8,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},_embind_register_std_string:(e,t)=>{var r="std::string"===(t=fe(t));_e(e,{name:t,fromWireType(e){var t,n=b[e>>2],a=e+4;if(r)for(var o=a,i=0;i<=n;++i){var s=a+i;if(i==n||0==h[s]){var l=ae(o,s-o);void 0===t?t=l:(t+=String.fromCharCode(0),t+=l),o=s+1}}else{var c=new Array(n);for(i=0;i<n;++i)c[i]=String.fromCharCode(h[a+i]);t=c.join("")}return pt(e),t},toWireType(e,t){var n;t instanceof ArrayBuffer&&(t=new Uint8Array(t));var a="string"==typeof t;a||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array||ve("Cannot pass non-string to std::string"),n=r&&a?(e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++r):t+=3}return t})(t):t.length;var o,i,s,l=dt(4+n+1),c=l+4;if(b[l>>2]=n,r&&a)o=t,i=c,S("number"==typeof(s=n+1),"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),((e,t,r,n)=>{if(S("string"==typeof e,`stringToUTF8Array expects a string (got ${typeof e})`),!(n>0))return 0;for(var a=r,o=r+n-1,i=0;i<e.length;++i){var s=e.charCodeAt(i);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++i)),s<=127){if(r>=o)break;t[r++]=s}else if(s<=2047){if(r+1>=o)break;t[r++]=192|s>>6,t[r++]=128|63&s}else if(s<=65535){if(r+2>=o)break;t[r++]=224|s>>12,t[r++]=128|s>>6&63,t[r++]=128|63&s}else{if(r+3>=o)break;s>1114111&&te("Invalid Unicode code point "+Q(s)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."),t[r++]=240|s>>18,t[r++]=128|s>>12&63,t[r++]=128|s>>6&63,t[r++]=128|63&s}}t[r]=0})(o,h,i,s);else if(a)for(var u=0;u<n;++u){var d=t.charCodeAt(u);d>255&&(pt(c),ve("String has UTF-16 code units that do not fit in 8 bits")),h[c+u]=d}else for(u=0;u<n;++u)h[c+u]=t[u];return null!==e&&e.push(pt,l),l},argPackAdvance:8,readValueFromPointer:Fe,destructorFunction(e){pt(e)}})},_embind_register_std_wstring:(e,t,r)=>{var n,a,o,i;r=fe(r),2===t?(n=Ve,a=Ge,i=ze,o=e=>y[e>>1]):4===t&&(n=He,a=Ye,i=Je,o=e=>b[e>>2]),_e(e,{name:r,fromWireType:e=>{for(var r,a=b[e>>2],i=e+4,s=0;s<=a;++s){var l=e+4+s*t;if(s==a||0==o(l)){var c=n(i,l-i);void 0===r?r=c:(r+=String.fromCharCode(0),r+=c),i=l+t}}return pt(e),r},toWireType:(e,n)=>{"string"!=typeof n&&ve(`Cannot pass non-string to C++ string type ${r}`);var o=i(n),s=dt(4+o+t);return b[s>>2]=o/t,a(n,s+4,o+t),null!==e&&e.push(pt,s),s},argPackAdvance:8,readValueFromPointer:Fe,destructorFunction(e){pt(e)}})},_embind_register_void:(e,t)=>{_e(e,{isVoid:!0,name:t=fe(t),argPackAdvance:0,fromWireType:()=>{},toWireType:(e,t)=>{}})},_emscripten_get_now_is_monotonic:()=>1,_emscripten_memcpy_js:(e,t,r)=>h.copyWithin(e,t,t+r),_emval_as:(e,t,r)=>(e=Ee(e),t=qe(t,"emval::as"),Ke(t,r,e)),_emval_call:(e,t,r,n)=>(e=Ze[e])(null,t=Ee(t),r,n),_emval_call_method:(e,t,r,n,a)=>(e=Ze[e])(t=Ee(t),t[r=Xe(r)],n,a),_emval_decref:Te,_emval_get_method_caller:(e,t,r)=>{var n=((e,t)=>{for(var r=new Array(e),n=0;n<e;++n)r[n]=qe(b[t+4*n>>2],"parameter "+n);return r})(e,t),a=n.shift();e--;var o="return function (obj, func, destructorsRef, args) {\n",i=0,s=[];0===r&&s.push("obj");for(var l=["retType"],c=[a],u=0;u<e;++u)s.push("arg"+u),l.push("argType"+u),c.push(n[u]),o+=` var arg${u} = argType${u}.readValueFromPointer(args${i?"+"+i:""});\n`,i+=n[u].argPackAdvance;o+=` var rv = ${1===r?"new func":"func.call"}(${s.join(", ")});\n`,a.isVoid||(l.push("emval_returnValue"),c.push(Ke),o+=" return emval_returnValue(retType, destructorsRef, rv);\n"),o+="};\n",l.push(o);var d,p,f=Re(Function,l)(...c),m=`methodCaller<(${n.map(e=>e.name).join(", ")}) => ${a.name}>`;return d=Ie(m,f),p=Ze.length,Ze.push(d),p},_emval_get_module_property:e=>(e=Xe(e),Se(o[e])),_emval_get_property:(e,t)=>(e=Ee(e),t=Ee(t),Se(e[t])),_emval_incref:e=>{e>9&&(we[e+1]+=1)},_emval_new_array:()=>Se([]),_emval_new_array_from_memory_view:e=>{e=Ee(e);for(var t=new Array(e.length),r=0;r<e.length;r++)t[r]=e[r];return Se(t)},_emval_new_cstring:e=>Se(Xe(e)),_emval_new_object:()=>Se({}),_emval_run_destructors:e=>{var t=Ee(e);ke(t),Te(e)},_emval_set_property:(e,t,r)=>{e=Ee(e),t=Ee(t),r=Ee(r),e[t]=r},_emval_take_value:(e,t)=>{var r=(e=qe(e,"_emval_take_value")).readValueFromPointer(t);return Se(r)},emscripten_date_now:()=>Date.now(),emscripten_get_now:xe,emscripten_resize_heap:e=>{var t=h.length;S((e>>>=0)>t);var r=2147483648;if(e>r)return m(`Cannot enlarge memory, requested ${e} bytes, but the limit is 2147483648 bytes!`),!1;for(var n=(e,t)=>e+(t-e%t)%t,a=1;a<=4;a*=2){var o=t*(1+.2/a);o=Math.min(o,e+100663296);var i=Math.min(r,n(Math.max(e,o),65536));if(et(i))return!0}return m(`Failed to grow the heap from ${t} bytes to ${i} bytes, not enough memory!`),!1},fd_close:e=>{D("fd_close called without SYSCALLS_REQUIRE_FILESYSTEM")},fd_seek:function(e,t,r,n,a){var o,i;return i=r,S((o=t)==o>>>0||o==(0|o)),S(i===(0|i)),70},fd_write:(e,t,r,n)=>{for(var a=0,o=0;o<r;o++){var i=b[t>>2],s=b[t+4>>2];t+=8;for(var l=0;l<s;l++)rt(e,h[i+l]);a+=s}return b[n>>2]=a,0},invoke_ii:function(e,t){var r=ee();try{return Ne(e)(t)}catch(e){if(X(r),!(e instanceof V))throw e;ft(1,0)}},invoke_iii:function(e,t,r){var n=ee();try{return Ne(e)(t,r)}catch(e){if(X(n),!(e instanceof V))throw e;ft(1,0)}},invoke_iiii:function(e,t,r,n){var a=ee();try{return Ne(e)(t,r,n)}catch(e){if(X(a),!(e instanceof V))throw e;ft(1,0)}},invoke_j:function(e){var t=ee();try{return Ft(e)}catch(e){if(X(t),!(e instanceof V))throw e;ft(1,0)}},invoke_v:function(e){var t=ee();try{Ne(e)()}catch(e){if(X(t),!(e instanceof V))throw e;ft(1,0)}},invoke_vi:function(e,t){var r=ee();try{Ne(e)(t)}catch(e){if(X(r),!(e instanceof V))throw e;ft(1,0)}},invoke_vii:function(e,t,r){var n=ee();try{Ne(e)(t,r)}catch(e){if(X(n),!(e instanceof V))throw e;ft(1,0)}},invoke_viii:function(e,t,r,n){var a=ee();try{Ne(e)(t,r,n)}catch(e){if(X(a),!(e instanceof V))throw e;ft(1,0)}},invoke_viiii:function(e,t,r,n,a){var o=ee();try{Ne(e)(t,r,n,a)}catch(e){if(X(o),!(e instanceof V))throw e;ft(1,0)}}},ct=function(){var e,t={env:lt,wasi_snapshot_preview1:lt};function r(e,t){var r;return ct=e.exports,S(p=ct.memory,"memory not found in wasm exports"),F(),S(Oe=ct.__indirect_function_table,"table not found in wasm exports"),r=ct.__wasm_call_ctors,C.unshift(r),function(e){if(O--,o.monitorRunDependencies?.(O),e?(S(U[e]),delete U[e]):m("warning: run dependency removed without ID"),0==O&&(null!==L&&(clearInterval(L),L=null),x)){var t=x;x=null,t()}}("wasm-instantiate"),ct}e="wasm-instantiate",O++,o.monitorRunDependencies?.(O),e?(S(!U[e]),U[e]=1,null===L&&"undefined"!=typeof setInterval&&(L=setInterval(()=>{if(E)return clearInterval(L),void(L=null);var e=!1;for(var t in U)e||(e=!0,m("still waiting on run dependencies:")),m(`dependency: ${t}`);e&&m("(end of list)")},1e4))):m("warning: run dependency added without ID");var n,i,s,l,u,f,g=o;if(o.instantiateWasm)try{return o.instantiateWasm(t,r)}catch(e){m(`Module.instantiateWasm callback failed with error: ${e}`),a(e)}return $||($=W(f="marchingsquares.wasm")?f:(u=f,o.locateFile?o.locateFile(u,c):c+u)),(n=d,i=$,s=t,l=function(e){S(o===g,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),g=null,r(e.instance)},n||"function"!=typeof WebAssembly.instantiateStreaming||W(i)||"function"!=typeof fetch?H(i,s,l):fetch(i,{credentials:"same-origin"}).then(e=>WebAssembly.instantiateStreaming(e,s).then(l,function(e){return m(`wasm streaming compile failed: ${e}`),m("falling back to ArrayBuffer instantiation"),H(i,s,l)}))).catch(a),{}}(),ut=(B("__wasm_call_ctors",0),B("__getTypeName",1)),dt=(B("fflush",1),B("malloc",1)),pt=(B("strerror",1),B("free",1)),ft=B("setThrew",2),mt=B("_emscripten_tempret_set",1),gt=()=>(gt=ct.emscripten_stack_init)(),ht=()=>(ht=ct.emscripten_stack_get_end)(),vt=e=>(vt=ct._emscripten_stack_restore)(e),yt=e=>(yt=ct._emscripten_stack_alloc)(e),_t=()=>(_t=ct.emscripten_stack_get_current)(),bt=(B("__cxa_free_exception",1),B("__cxa_increment_exception_refcount",1)),wt=B("__cxa_decrement_exception_refcount",1),Tt=B("__get_exception_message",3),Et=B("__cxa_can_catch",3),St=B("__cxa_is_pointer_type",1),Ft=o.dynCall_j=B("dynCall_j",1);function At(){function e(){st||(st=!0,o.calledRun=!0,E||(S(!k),k=!0,A(),Z(C),n(o),o.onRuntimeInitialized?.(),S(!o._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),function(){if(A(),o.postRun)for("function"==typeof o.postRun&&(o.postRun=[o.postRun]);o.postRun.length;)R(o.postRun.shift());Z(I)}()))}var t;O>0||(gt(),S(!(3&(t=ht()))),0==t&&(t+=4),b[t>>2]=34821223,b[t+4>>2]=2310721022,b[0]=1668509029,function(){if(o.preRun)for("function"==typeof o.preRun&&(o.preRun=[o.preRun]);o.preRun.length;)M(o.preRun.shift());Z(P)}(),O>0||(o.setStatus?(o.setStatus("Running..."),setTimeout(function(){setTimeout(function(){o.setStatus("")},1),e()},1)):e(),A()))}if(o.dynCall_jiji=B("dynCall_jiji",5),["writeI53ToI64","writeI53ToI64Clamped","writeI53ToI64Signaling","writeI53ToU64Clamped","writeI53ToU64Signaling","readI53FromI64","readI53FromU64","convertI32PairToI53","convertU32PairToI53","getTempRet0","zeroMemory","exitJS","isLeapYear","ydayFromDate","arraySum","addDays","strError","inetPton4","inetNtop4","inetPton6","inetNtop6","readSockaddr","writeSockaddr","initRandomFill","randomFill","emscriptenLog","readEmAsmArgs","jstoi_q","getExecutableName","listenOnce","autoResumeAudioContext","handleException","keepRuntimeAlive","runtimeKeepalivePush","runtimeKeepalivePop","callUserCallback","maybeExit","asmjsMangle","asyncLoad","alignMemory","mmapAlloc","HandleAllocator","getNativeTypeSize","STACK_SIZE","STACK_ALIGN","POINTER_SIZE","ASSERTIONS","getCFunc","ccall","cwrap","uleb128Encode","sigToWasmTypes","generateFuncType","convertJsFunctionToWasm","getEmptyTableSlot","updateTableMap","getFunctionAddress","addFunction","removeFunction","reallyNegative","unSign","strLen","reSign","formatString","intArrayFromString","intArrayToString","AsciiToString","stringToAscii","stringToNewUTF8","stringToUTF8OnStack","writeArrayToMemory","registerKeyEventCallback","maybeCStringToJsString","findEventTarget","getBoundingClientRect","fillMouseEventData","registerMouseEventCallback","registerWheelEventCallback","registerUiEventCallback","registerFocusEventCallback","fillDeviceOrientationEventData","registerDeviceOrientationEventCallback","fillDeviceMotionEventData","registerDeviceMotionEventCallback","screenOrientation","fillOrientationChangeEventData","registerOrientationChangeEventCallback","fillFullscreenChangeEventData","registerFullscreenChangeEventCallback","JSEvents_requestFullscreen","JSEvents_resizeCanvasForFullscreen","registerRestoreOldStyle","hideEverythingExceptGivenElement","restoreHiddenElements","setLetterbox","softFullscreenResizeWebGLRenderTarget","doRequestFullscreen","fillPointerlockChangeEventData","registerPointerlockChangeEventCallback","registerPointerlockErrorEventCallback","requestPointerLock","fillVisibilityChangeEventData","registerVisibilityChangeEventCallback","registerTouchEventCallback","fillGamepadEventData","registerGamepadEventCallback","registerBeforeUnloadEventCallback","fillBatteryEventData","battery","registerBatteryEventCallback","setCanvasElementSize","getCanvasElementSize","jsStackTrace","getCallstack","convertPCtoSourceLocation","getEnvStrings","checkWasiClock","wasiRightsToMuslOFlags","wasiOFlagsToMuslOFlags","createDyncallWrapper","safeSetTimeout","setImmediateWrapped","clearImmediateWrapped","polyfillSetImmediate","getPromise","makePromise","idsToPromises","makePromiseCallback","Browser_asyncPrepareDataCounter","setMainLoop","getSocketFromFD","getSocketAddress","FS_createPreloadedFile","FS_modeStringToFlags","FS_getMode","FS_stdin_getChar","FS_unlink","FS_createDataFile","FS_mkdirTree","_setNetworkCallback","heapObjectForWebGLType","toTypedArrayIndex","webgl_enable_ANGLE_instanced_arrays","webgl_enable_OES_vertex_array_object","webgl_enable_WEBGL_draw_buffers","webgl_enable_WEBGL_multi_draw","emscriptenWebGLGet","computeUnpackAlignedImageSize","colorChannelsInGlTextureFormat","emscriptenWebGLGetTexPixelData","emscriptenWebGLGetUniform","webglGetUniformLocation","webglPrepareUniformLocationsBeforeFirstUse","webglGetLeftBracePos","emscriptenWebGLGetVertexAttrib","__glGetActiveAttribOrUniform","writeGLArray","registerWebGlEventCallback","runAndAbortIfError","ALLOC_NORMAL","ALLOC_STACK","allocate","writeStringToMemory","writeAsciiToMemory","setErrNo","demangle","stackTrace","getFunctionArgsName","createJsInvokerSignature","init_embind","getBasestPointer","registerInheritedInstance","unregisterInheritedInstance","getInheritedInstance","getInheritedInstanceCount","getLiveInheritedInstances","enumReadValueFromPointer","genericPointerToWireType","constNoSmartPtrRawPointerToWireType","nonConstNoSmartPtrRawPointerToWireType","init_RegisteredPointer","RegisteredPointer","RegisteredPointer_fromWireType","runDestructor","releaseClassHandle","detachFinalizer","attachFinalizer","makeClassHandle","init_ClassHandle","ClassHandle","throwInstanceAlreadyDeleted","flushPendingDeletes","setDelayFunction","RegisteredClass","shallowCopyInternalPointer","downcastPointer","upcastPointer","validateThis","char_0","char_9","makeLegalFunctionName","emval_get_global"].forEach(function(e){"undefined"==typeof globalThis||Object.getOwnPropertyDescriptor(globalThis,e)||Object.defineProperty(globalThis,e,{configurable:!0,get(){var t=`\`${e}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`,r=e;r.startsWith("_")||(r="$"+e),t+=` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${r}')`,J(e)&&(t+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),te(t)}}),K(e)}),["run","addOnPreRun","addOnInit","addOnPreMain","addOnExit","addOnPostRun","addRunDependency","removeRunDependency","out","err","callMain","abort","wasmMemory","wasmExports","writeStackCookie","checkStackCookie","convertI32PairToI53Checked","stackSave","stackRestore","stackAlloc","setTempRet0","ptrToString","getHeapMax","growMemory","ENV","MONTH_DAYS_REGULAR","MONTH_DAYS_LEAP","MONTH_DAYS_REGULAR_CUMULATIVE","MONTH_DAYS_LEAP_CUMULATIVE","ERRNO_CODES","DNS","Protocols","Sockets","timers","warnOnce","readEmAsmArgsArray","jstoi_s","dynCallLegacy","getDynCaller","dynCall","wasmTable","noExitRuntime","freeTableIndexes","functionsInTableMap","setValue","getValue","PATH","PATH_FS","UTF8Decoder","UTF8ArrayToString","UTF8ToString","stringToUTF8Array","stringToUTF8","lengthBytesUTF8","UTF16Decoder","UTF16ToString","stringToUTF16","lengthBytesUTF16","UTF32ToString","stringToUTF32","lengthBytesUTF32","JSEvents","specialHTMLTargets","findCanvasEventTarget","currentFullscreenStrategy","restoreOldWindowedStyle","UNWIND_CACHE","ExitStatus","flush_NO_FILESYSTEM","promiseMap","uncaughtExceptionCount","exceptionLast","exceptionCaught","ExceptionInfo","findMatchingCatch","getExceptionMessageCommon","incrementExceptionRefcount","decrementExceptionRefcount","getExceptionMessage","Browser","getPreloadedImageData__data","wget","SYSCALLS","preloadPlugins","FS_stdin_getChar_buffer","FS_createPath","FS_createDevice","FS_readFile","FS","FS_createLazyFile","MEMFS","TTY","PIPEFS","SOCKFS","tempFixedLengthArray","miniTempWebGLFloatBuffers","miniTempWebGLIntBuffers","GL","AL","GLUT","EGL","GLEW","IDBStore","SDL","SDL_gfx","allocateUTF8","allocateUTF8OnStack","print","printErr","InternalError","BindingError","throwInternalError","throwBindingError","registeredTypes","awaitingDependencies","typeDependencies","tupleRegistrations","structRegistrations","sharedRegisterType","whenDependentTypesAreResolved","embind_charCodes","embind_init_charCodes","readLatin1String","getTypeName","getFunctionName","heap32VectorToArray","requireRegisteredType","usesDestructorStack","createJsInvoker","UnboundTypeError","PureVirtualError","GenericWireTypeSize","EmValType","throwUnboundTypeError","ensureOverloadTable","exposePublicSymbol","replacePublicSymbol","extendError","createNamedFunction","embindRepr","registeredInstances","registeredPointers","registerType","integerReadValueFromPointer","floatReadValueFromPointer","readPointer","runDestructors","newFunc","craftInvokerFunction","embind__requireFunction","finalizationRegistry","detachFinalizer_deps","deletionQueue","delayFunction","emval_freelist","emval_handles","emval_symbols","init_emval","count_emval_handles","getStringOrSymbol","Emval","emval_returnValue","emval_lookupTypes","emval_methodCallers","emval_addMethodCaller","reflectConstruct"].forEach(K),x=function e(){st||At(),st||(x=e)},o.preInit)for("function"==typeof o.preInit&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.pop()();At(),r=i;for(const t of Object.keys(o))t in e||Object.defineProperty(e,t,{configurable:!0,get(){D(`Access to module property ('${t}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`)}});return r});e.exports=r}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}return r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e;r.g.importScripts&&(e=r.g.location+"");var t=r.g.document;if(!e&&t&&(t.currentScript&&"SCRIPT"===t.currentScript.tagName.toUpperCase()&&(e=t.currentScript.src),!e)){var n=t.getElementsByTagName("script");if(n.length)for(var a=n.length-1;a>-1&&(!e||!/^http(s?):/.test(e));)e=n[a--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r.p=e})(),(()=>{"use strict";const e=Symbol("Comlink.proxy"),t=Symbol("Comlink.endpoint"),n=Symbol("Comlink.releaseProxy"),a=Symbol("Comlink.thrown"),o=e=>"object"==typeof e&&null!==e||"function"==typeof e,i=new Map([["proxy",{canHandle:t=>o(t)&&t[e],serialize(e){const{port1:t,port2:r}=new MessageChannel;return s(e,t),[r,[r]]},deserialize:e=>(e.start(),u(e,[],undefined))}],["throw",{canHandle:e=>o(e)&&a in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function s(t,r=self){r.addEventListener("message",function n(o){if(!o||!o.data)return;const{id:i,type:c,path:u}=Object.assign({path:[]},o.data),d=(o.data.argumentList||[]).map(m);let g;try{const r=u.slice(0,-1).reduce((e,t)=>e[t],t),n=u.reduce((e,t)=>e[t],t);switch(c){case"GET":g=n;break;case"SET":r[u.slice(-1)[0]]=m(o.data.value),g=!0;break;case"APPLY":g=n.apply(r,d);break;case"CONSTRUCT":g=function(t){return Object.assign(t,{[e]:!0})}(new n(...d));break;case"ENDPOINT":{const{port1:e,port2:r}=new MessageChannel;s(t,r),g=function(e,t){return p.set(e,t),e}(e,[e])}break;case"RELEASE":g=void 0;break;default:return}}catch(e){g={value:e,[a]:0}}Promise.resolve(g).catch(e=>({value:e,[a]:0})).then(e=>{const[t,a]=f(e);r.postMessage(Object.assign(Object.assign({},t),{id:i}),a),"RELEASE"===c&&(r.removeEventListener("message",n),l(r))})}),r.start&&r.start()}function l(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function c(e){if(e)throw new Error("Proxy has been released and is not useable")}function u(e,r=[],a=function(){}){let o=!1;const i=new Proxy(a,{get(t,a){if(c(o),a===n)return()=>g(e,{type:"RELEASE",path:r.map(e=>e.toString())}).then(()=>{l(e),o=!0});if("then"===a){if(0===r.length)return{then:()=>i};const t=g(e,{type:"GET",path:r.map(e=>e.toString())}).then(m);return t.then.bind(t)}return u(e,[...r,a])},set(t,n,a){c(o);const[i,s]=f(a);return g(e,{type:"SET",path:[...r,n].map(e=>e.toString()),value:i},s).then(m)},apply(n,a,i){c(o);const s=r[r.length-1];if(s===t)return g(e,{type:"ENDPOINT"}).then(m);if("bind"===s)return u(e,r.slice(0,-1));const[l,p]=d(i);return g(e,{type:"APPLY",path:r.map(e=>e.toString()),argumentList:l},p).then(m)},construct(t,n){c(o);const[a,i]=d(n);return g(e,{type:"CONSTRUCT",path:r.map(e=>e.toString()),argumentList:a},i).then(m)}});return i}function d(e){const t=e.map(f);return[t.map(e=>e[0]),(r=t.map(e=>e[1]),Array.prototype.concat.apply([],r))];var r}const p=new WeakMap;function f(e){for(const[t,r]of i)if(r.canHandle(e)){const[n,a]=r.serialize(e);return[{type:"HANDLER",name:t,value:n},a]}return[{type:"RAW",value:e},p.get(e)||[]]}function m(e){switch(e.type){case"HANDLER":return i.get(e.name).deserialize(e.value);case"RAW":return e.value}}function g(e,t,r){return new Promise(n=>{const a=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.addEventListener("message",function t(r){r.data&&r.data.id&&r.data.id===a&&(e.removeEventListener("message",t),n(r.data))}),e.start&&e.start(),e.postMessage(Object.assign({id:a},t),r)})}var h=r(533),v=r.n(h);r.p;let y=null;function _(e){return null===y&&(y=v()({locateFile:(t,r)=>(void 0===e.document_script?r:e.document_script)+t})),y}let b=null;s({contourCreator:async function(e,t,r){if(void 0===r.interval&&void 0===r.levels)throw"Must supply either an interval or levels to contourCreator()";const n=void 0===r.interval?0:r.interval,a=void 0!==r.quad_as_tri&&r.quad_as_tri,o=null===b?await _({}):b;b=o;const i=e instanceof Float32Array?o.getContourLevelsFloat32:o.getContourLevelsFloat16,s=e instanceof Float32Array?o.makeContoursFloat32:o.makeContoursFloat16,l=void 0===r.levels?i(e,t.x.length,t.y.length,n):r.levels;return s(e,t.x,t.y,l,a)},init:async function(e){b=await _({document_script:e})}})})(),{}})());
|
|
2
|
+
//# sourceMappingURL=812.autumnplot-gl.js.map
|