@metoceanapi/wxtiles-leaflet 2.0.5 → 2.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +132 -305
  3. package/dist/es/controls/WxStyleEditorControl.d.ts +1 -1
  4. package/dist/es/controls/WxTimeControl .d.ts +2 -2
  5. package/dist/es/defaults/styles.d.ts +2 -2
  6. package/dist/es/defaults/uconv.d.ts +2 -2
  7. package/dist/es/index.d.ts +32 -5
  8. package/dist/es/index.js +6 -1
  9. package/dist/es/utils/RawCLUT.d.ts +32 -22
  10. package/dist/es/utils/qtree.d.ts +11 -5
  11. package/dist/es/utils/wxtools.d.ts +243 -33
  12. package/dist/es/wxAPI/WxDataSetManager.d.ts +70 -34
  13. package/dist/es/wxAPI/wxAPI.d.ts +115 -43
  14. package/dist/es/wxlayer/WxImplementation.d.ts +76 -34
  15. package/dist/es/wxlayer/loader.d.ts +27 -3
  16. package/dist/es/wxlayer/loadertools.d.ts +41 -3
  17. package/dist/es/wxlayer/painter.d.ts +39 -0
  18. package/dist/es/wxlayer/wxlayer.d.ts +77 -11
  19. package/dist/es/wxsource/wxsource.d.ts +60 -20
  20. package/dist/es/wxsource/wxsourcetypes.d.ts +16 -0
  21. package/dist/web/index.js +6 -1
  22. package/docs/docs/assets/highlight.css +92 -0
  23. package/docs/docs/assets/main.js +54 -0
  24. package/docs/docs/assets/search.js +1 -0
  25. package/docs/docs/assets/style.css +1257 -0
  26. package/docs/docs/classes/FrameworkParentClass.html +98 -0
  27. package/docs/docs/classes/Loader.html +165 -0
  28. package/docs/docs/classes/Painter.html +161 -0
  29. package/docs/docs/classes/QTree.html +129 -0
  30. package/docs/docs/classes/RawCLUT.html +143 -0
  31. package/docs/docs/classes/WxAPI.html +336 -0
  32. package/docs/docs/classes/WxDataSetManager.html +406 -0
  33. package/docs/docs/classes/WxLayer.html +363 -0
  34. package/docs/docs/classes/WxLayerBaseImplementation.html +371 -0
  35. package/docs/docs/classes/WxTileSource.html +453 -0
  36. package/docs/docs/enums/TileType.html +80 -0
  37. package/docs/docs/functions/WXLOG.html +119 -0
  38. package/docs/docs/functions/WxCreateLegend.html +127 -0
  39. package/docs/docs/functions/WxGetColorSchemes.html +114 -0
  40. package/docs/docs/functions/WxGetColorStyles.html +114 -0
  41. package/docs/docs/functions/WxTilesLogging.html +119 -0
  42. package/docs/docs/index.html +201 -0
  43. package/docs/docs/interfaces/ColorStylesIncomplete.html +117 -0
  44. package/docs/docs/interfaces/Converter.html +81 -0
  45. package/docs/docs/interfaces/DataIntegral.html +112 -0
  46. package/docs/docs/interfaces/DataPicture.html +93 -0
  47. package/docs/docs/interfaces/FrameworkOptions.html +75 -0
  48. package/docs/docs/interfaces/IntegralPare.html +81 -0
  49. package/docs/docs/interfaces/SLinePoint.html +77 -0
  50. package/docs/docs/interfaces/Tree.html +70 -0
  51. package/docs/docs/interfaces/WxAPIOptions.html +164 -0
  52. package/docs/docs/interfaces/WxAllBoundariesMeta.html +85 -0
  53. package/docs/docs/interfaces/WxBoundaryMeta.html +91 -0
  54. package/docs/docs/interfaces/WxColorSchemes.html +118 -0
  55. package/docs/docs/interfaces/WxColorStyleStrict.html +319 -0
  56. package/docs/docs/interfaces/WxColorStyleWeak.html +345 -0
  57. package/docs/docs/interfaces/WxColorStylesStrict.html +74 -0
  58. package/docs/docs/interfaces/WxColorStylesWeakMixed.html +117 -0
  59. package/docs/docs/interfaces/WxData.html +81 -0
  60. package/docs/docs/interfaces/WxDataSetManagerOptions.html +108 -0
  61. package/docs/docs/interfaces/WxDataSetsMetasJSON.html +75 -0
  62. package/docs/docs/interfaces/WxDatasetMeta.html +135 -0
  63. package/docs/docs/interfaces/WxDatasetShortMeta.html +90 -0
  64. package/docs/docs/interfaces/WxLayerAPI.html +313 -0
  65. package/docs/docs/interfaces/WxLayerBaseAPI.html +246 -0
  66. package/docs/docs/interfaces/WxLayerOptions.html +118 -0
  67. package/docs/docs/interfaces/WxLegend.html +117 -0
  68. package/docs/docs/interfaces/WxLngLat.html +81 -0
  69. package/docs/docs/interfaces/WxRasterData.html +99 -0
  70. package/docs/docs/interfaces/WxRequestInit.html +70 -0
  71. package/docs/docs/interfaces/WxSourceLayerOptions.html +109 -0
  72. package/docs/docs/interfaces/WxTick.html +99 -0
  73. package/docs/docs/interfaces/WxTileInfo.html +142 -0
  74. package/docs/docs/interfaces/WxTilesLibOptions.html +92 -0
  75. package/docs/docs/interfaces/WxUnits.html +117 -0
  76. package/docs/docs/interfaces/WxVariableMeta.html +108 -0
  77. package/docs/docs/interfaces/WxVariablesMetas.html +117 -0
  78. package/docs/docs/interfaces/XYZ.html +84 -0
  79. package/docs/docs/modules.html +210 -0
  80. package/docs/docs/types/DataIntegrals.html +110 -0
  81. package/docs/docs/types/DataPictures.html +110 -0
  82. package/docs/docs/types/SLine.html +110 -0
  83. package/docs/docs/types/SubTrees.html +110 -0
  84. package/docs/docs/types/SubTreesN.html +110 -0
  85. package/docs/docs/types/TreeN.html +110 -0
  86. package/docs/docs/types/UriLoaderPromiseFunc.html +130 -0
  87. package/docs/docs/types/WxDate.html +110 -0
  88. package/docs/docs/types/WxURIs.html +110 -0
  89. package/docs/docs/types/WxUnitTuple.html +110 -0
  90. package/docs/docs/types/WxVars.html +110 -0
  91. package/docs/script/script.css +1 -1
  92. package/docs/script/script.js +11 -6
  93. package/package.json +8 -8
  94. package/src_example/index.ts +111 -54
@@ -1,73 +1,137 @@
1
1
  import { RawCLUT } from '../utils/RawCLUT';
2
- import { type WxColorStyleStrict, type XYZ, type DataPictures, type WxColorStyleWeak } from '../utils/wxtools';
2
+ import type { WxColorStyleStrict, XYZ, DataPictures, WxColorStyleWeak } from '../utils/wxtools';
3
3
  import { type WxVariableMeta } from '../wxAPI/wxAPI';
4
4
  import { WxDataSetManager } from '../wxAPI/WxDataSetManager';
5
5
  import { Loader } from './loader';
6
6
  import { Painter, type WxRasterData } from './painter';
7
- export declare type WxDate = string | number | Date;
7
+ /** Type used to set a time step for the layer. */
8
+ export type WxDate = string | number | Date;
9
+ /** Used to make an abortable call to the layer update */
8
10
  export interface WxRequestInit {
9
11
  signal?: AbortSignal;
10
12
  }
13
+ /** Information about the current point on map returned by the {@link WxLayer} method. */
11
14
  export interface WxTileInfo {
15
+ /** values of all variables in datasets's units */
12
16
  data: number[];
17
+ /** RAW values of all variables in internal representation */
13
18
  raw: number[];
19
+ /** **uint32** colors defined by curent values {@link WxTileInfo.data} and the style */
14
20
  rgba: number[];
21
+ /** web colors defined by curent values {@link WxTileInfo.data} and the style */
15
22
  hexColor: string[];
23
+ /** values of all variables in Style's units */
16
24
  inStyleUnits: number[];
25
+ /** The current point on map. */
17
26
  tilePoint: {
18
27
  x: number;
19
28
  y: number;
20
29
  };
30
+ /** WxUnits defined style */
21
31
  styleUnits: string;
32
+ /** WxUnits defined dataset */
22
33
  dataUnits: string;
23
34
  }
24
- export declare type WxVars = [string] | [string, string];
25
- export declare type WxURIs = [string] | [string, string];
35
+ /** Array of variable names to be used in {@link WxLayer} */
36
+ export type WxVars = [string] | [string, string];
37
+ /** @internal Array of URIs to request tiles */
38
+ export type WxURIs = [string] | [string, string];
39
+ /** Lon/Lat coordinates */
26
40
  export interface WxLngLat {
41
+ /** Longitude */
27
42
  lng: number;
43
+ /** Latitude */
28
44
  lat: number;
29
45
  }
46
+ /**
47
+ * Options to construct {@link WxTileSource} object
48
+ * Do not use this type directly, use {@link WxLayerOptions} instead
49
+ * */
30
50
  export interface WxLayerOptions {
51
+ /** Variables of the layer */
31
52
  variables: WxVars;
53
+ /** Dataset Manager */
32
54
  wxdatasetManager: WxDataSetManager;
55
+ /** initial time step */
33
56
  time?: WxDate;
57
+ /** extension of data tiles at the backend */
34
58
  ext?: 'png';
59
+ /** initial style name */
35
60
  wxstyleName?: string;
61
+ /** initial style, applyed on top of style passed by name {@link wxstyleName} */
62
+ wxstyle?: WxColorStyleWeak;
36
63
  }
64
+ /**
65
+ * @internal
66
+ * Used in {@link WxLayerBaseImplementation} to manipulate the the layer's style, data and time
67
+ * */
37
68
  export declare class WxLayer {
38
- protected readonly ext: string;
69
+ /** @internal PNG only!*/
70
+ protected readonly ext: 'png';
71
+ /** @internal Variables to be displayed by the layer */
39
72
  readonly variables: WxVars;
73
+ /** @internal Data manager created this layer */
40
74
  readonly wxdatasetManager: WxDataSetManager;
75
+ /** @internal Current Meta data for the layer*/
41
76
  readonly currentMeta: WxVariableMeta;
77
+ /** @internal Current time*/
42
78
  protected time: string;
79
+ /** @internal current URIs to fetch tiles */
43
80
  tilesURIs: WxURIs;
81
+ /** @internal current Style Object */
44
82
  style: WxColorStyleStrict;
83
+ /** @internal Current "Color lookup table" object */
45
84
  CLUT: RawCLUT;
85
+ /** @internal cahced URI->data */
46
86
  protected tilesCache: Map<string, WxRasterData>;
87
+ /** @internal Painter object to render tiles */
47
88
  readonly painter: Painter;
89
+ /** @internal Loader object to load and preprocess tiles */
48
90
  protected readonly loader: Loader;
49
- constructor({ time, variables, wxdatasetManager, ext, wxstyleName }: WxLayerOptions);
91
+ constructor(wxLayerOptions: WxLayerOptions);
92
+ /** Check if the layer is vector and may be animated according to style */
50
93
  get nonanimatable(): boolean;
94
+ /**
95
+ * @internal
96
+ * Get the current time step of the layer
97
+ * @returns {string} time step in the dataset meta's format */
51
98
  getTime(): string;
99
+ /**
100
+ * @internal
101
+ * Clear the cache of tiles
102
+ * Not to use when loading is in progress. */
52
103
  clearCache(): void;
104
+ /** @internal */
53
105
  getCurrentStyleObjectCopy(): WxColorStyleStrict;
106
+ /** @internal */
54
107
  updateCurrentStyleObject(style?: WxColorStyleWeak): void;
108
+ /** @internal Used by {@link WxTileSource.getLayerInfoAtLatLon} */
55
109
  getTileData(tileCoord: XYZ, tilePixel: {
56
110
  x: number;
57
111
  y: number;
58
112
  }): WxTileInfo | undefined;
113
+ /** @internal reassign URIs and a time step with a new given time step */
59
114
  setURLsAndTime(time_?: WxDate): void;
60
- loadTile(tile: XYZ, requestInit?: WxRequestInit): Promise<WxRasterData>;
115
+ /** @internal load, cache, draw the tile. Abortable */
116
+ loadTile(tile: XYZ, requestInit?: WxRequestInit): Promise<WxRasterData | null>;
117
+ /** @internal cache given time step for faster access when needed. Resolved when done.
118
+ * @param time_ time step to cache
119
+ * @param requestInit request options
120
+ * @returns {Promise<void>} */
61
121
  preloadTime(time_: WxDate, tiles: XYZ[], requestInit?: WxRequestInit): Promise<void>;
62
122
  /**
63
- * @description Load all tiles, draw it on canvas, save to cache and return
123
+ * @description Load all tiles, draw it on canvas, save to cache and return. Resolved when done.
64
124
  * @param tiles
65
125
  * @param requestInit
66
- */
126
+ * @returns {Promise<viod>} */
67
127
  reloadTiles(tiles: XYZ[], requestInit?: WxRequestInit): Promise<void>;
68
- protected _loadCacheDrawTile(tile: XYZ, tilesCache: Map<string, WxRasterData>, requestInit?: WxRequestInit): Promise<WxRasterData>;
69
- protected _createCurrentStyleObject(style_?: WxColorStyleWeak): [WxColorStyleStrict, RawCLUT];
128
+ /** @ignore */
129
+ protected _loadCacheDrawTile(tile: XYZ, tilesCache: Map<string, WxRasterData>, requestInit?: WxRequestInit): Promise<WxRasterData | null>;
130
+ /** @ignore */
131
+ protected _createStyleAndCLUT(style_?: WxColorStyleWeak): [WxColorStyleStrict, RawCLUT];
132
+ /** @ignore creates/calculates meta data for vector layers */
70
133
  protected _getCurrentMeta(): WxVariableMeta;
134
+ /** @ignore x, y - pixel on tile, data - data tile */
71
135
  protected _getPixelInfo({ x, y }: {
72
136
  x: number;
73
137
  y: number;
@@ -75,6 +139,8 @@ export declare class WxLayer {
75
139
  raw: number[];
76
140
  data: number[];
77
141
  } | undefined;
142
+ /** @ignore Create a new CLUT for the given style */
78
143
  protected _prepareCLUT(style: WxColorStyleStrict): RawCLUT;
144
+ /** @ignore calculate valid timestep and URIs */
79
145
  protected _createURLsAndTime(time_?: WxDate): [WxURIs, string];
80
146
  }
@@ -2,40 +2,80 @@ import L from 'leaflet';
2
2
  import { type XYZ } from '../utils/wxtools';
3
3
  import { type WxRequestInit, type WxTileInfo, type WxLngLat, WxLayerOptions } from '../wxlayer/wxlayer';
4
4
  import { type WxRasterData } from '../wxlayer/painter';
5
- import { WxImplementation, type WxLayerAPI } from '../wxlayer/WxImplementation';
5
+ import { WxLayerBaseImplementation, type WxLayerAPI } from '../wxlayer/WxImplementation';
6
6
  import { FrameworkOptions } from './wxsourcetypes';
7
7
  declare class WxTile {
8
8
  coords: XYZ;
9
9
  ctx: CanvasRenderingContext2D;
10
- raster_data: WxRasterData;
11
- constructor(coords: XYZ, ctx: CanvasRenderingContext2D, raster_data: WxRasterData);
12
- draw(canvas: HTMLCanvasElement): void;
10
+ raster_data: WxRasterData | null;
11
+ constructor(coords: XYZ, ctx: CanvasRenderingContext2D, raster_data: WxRasterData | null);
12
+ draw(canvas?: HTMLCanvasElement | null): void;
13
13
  }
14
14
  /**
15
- * @class WxTileSource
16
- * @description WxTileSource is a custom source for mapbox-gl-js.
15
+ * A custom layer source implementation
17
16
  * It is used to load and display weather data from the WxTiles server.
18
- * @param {WxDate} time - Initial Time of the data to load.
19
- * @param {WxVars} vars - Initial variables to load.
20
- * @param {WxDataSetManager} datasetManager - WxDataSetManager instance.
21
- * @param {string} wxstyleName - Initial style of the source.
22
- * @param {'png' | undefined} ext - Tiles extension. png by default
23
- * @param {L.GridLayerOptions} options - Leaflet's options of the layer. *
17
+ * @example
18
+ * ```ts
19
+ const wxapi = new WxAPI({ 'http://dataserver.com' });
20
+
21
+ const datasetName = 'gfs.global';
22
+ const variable = 'air.temperature.at-2m'; // Scalar example
23
+
24
+ // Create a dataset manager (may be used for many layers from this dataset)
25
+ const wxdatasetManager = await wxapi.createDatasetManager(datasetName);
26
+
27
+ // get proper representation of the variable
28
+ const variables = wxdatasetManager.checkCombineVariableIfVector(variable);
29
+
30
+ // create a layer source
31
+ const wxsource = new WxTileSource({ wxdatasetManager, variables }, { id: 'wxsource', attribution: 'WxTiles' });
32
+ * ```
24
33
  */
25
- export declare class WxTileSource extends WxImplementation implements WxLayerAPI {
26
- constructor(wxlayeroptions: WxLayerOptions, options?: FrameworkOptions);
34
+ export declare class WxTileSource extends WxLayerBaseImplementation implements WxLayerAPI {
27
35
  /**
28
- * @description Get comprehencive information about the current point on map.
29
- * @memberof WxTileSource
30
- * @param {WxLngLat} lnglat - Coordinates of the point.
31
- * @param {any} anymap - map instance.
32
- * @returns {WxTileInfo | undefined } Information about the current point on map. Undefined if NODATA
36
+ *
37
+ * @param {WxLayerOptions} wxlayeroptions - The options for the {@link WxLayerBaseImplementation}.
38
+ * @param {FrameworkOptions} frameworkOptions - The options for the framework.
33
39
  */
40
+ constructor(wxlayeroptions: WxLayerOptions, frameworkOptions: FrameworkOptions);
41
+ /**
42
+ * Get comprehensive information about the current point on map.
43
+ * @param {WxLngLat} lnglat - Coordinates of the point.
44
+ * @param map - map instance.
45
+ * @returns {WxTileInfo | undefined }
46
+ * */
34
47
  getLayerInfoAtLatLon(lnglat: WxLngLat, anymap: any): WxTileInfo | undefined;
48
+ /**
49
+ * @ignore
50
+ * Reloads the tiles that are currently visible on the map. Used for time/particles animation.
51
+ **/
35
52
  _reloadVisible(requestInit?: WxRequestInit): Promise<void>;
36
- update(): void;
53
+ /**
54
+ * @ignore
55
+ * Get the tiles that are currently visible on the map.
56
+ * <MBOX API> get assigned by map.addSource *
57
+ * */
37
58
  coveringTiles(): XYZ[];
59
+ /**
60
+ * @ignore
61
+ * @description reload tiles that are currently visible on the map.
62
+ * <MBOX API> get assigned by map.addSource
63
+ */
64
+ update(): void;
65
+ /** @ignore */
38
66
  protected _ForEachWxTile<T>(func: (wxtile: WxTile) => T, name: string): T[];
67
+ /**
68
+ * @internal
69
+ * Used by framework. Creates a representation of a tile for the framework.
70
+ * @param tile - The tile coordinates to be loaded.
71
+ * @param requestInit - The request options.
72
+ * @returns {Promise<Picture>} - A picture of the tile.
73
+ */
39
74
  protected createTile(coords: L.Coords, done: L.DoneCallback): HTMLElement;
75
+ /**
76
+ * @internal
77
+ * @description Used by framework. Cleans up resources used by the source.
78
+ */
79
+ onRemove(map: L.Map): this;
40
80
  }
41
81
  export {};
@@ -1,5 +1,21 @@
1
1
  import L from 'leaflet';
2
+ /**
3
+ * Framework dependent source type to be inherited by the framework dependent custom source type.
4
+ * Mapbox does not provide a parent type for the custom source.
5
+ * Leaflet provides a parent type for the custom layer to inherit from L.GridLayer.
6
+ * Used as universal type for the custom source parent class. see {@link WxTileSource}
7
+ */
2
8
  export declare class FrameworkParentClass extends L.GridLayer {
9
+ id: string;
10
+ constructor(options: FrameworkOptions);
3
11
  }
12
+ /**
13
+ * Framework's basic options to construct the layer.
14
+ * @example
15
+ * ```ts
16
+ * const leafletOptions: FrameworkOptions = { opacity: 1, attribution: 'WxTiles' };
17
+ * ```
18
+ */
4
19
  export interface FrameworkOptions extends L.GridLayerOptions {
20
+ id: string;
5
21
  }
package/dist/web/index.js CHANGED
@@ -1 +1,6 @@
1
- var wxtilesleaflet=(()=>{var Ue=Object.create;var U=Object.defineProperty;var Fe=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames,se=Object.getOwnPropertySymbols,Ze=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable;var ie=(a,e,t)=>e in a?U(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,O=(a,e)=>{for(var t in e||(e={}))le.call(e,t)&&ie(a,t,e[t]);if(se)for(var t of se(e))Ve.call(e,t)&&ie(a,t,e[t]);return a};var Xe=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),Ee=(a,e)=>{for(var t in e)U(a,t,{get:e[t],enumerable:!0})},ce=(a,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Oe(e))!le.call(a,n)&&n!==t&&U(a,n,{get:()=>e[n],enumerable:!(r=Fe(e,n))||r.enumerable});return a};var Ne=(a,e,t)=>(t=a!=null?Ue(Ze(a)):{},ce(e||!a||!a.__esModule?U(t,"default",{value:a,enumerable:!0}):t,a)),$e=a=>ce(U({},"__esModule",{value:!0}),a);var h=(a,e,t)=>new Promise((r,n)=>{var o=c=>{try{i(t.next(c))}catch(l){n(l)}},s=c=>{try{i(t.throw(c))}catch(l){n(l)}},i=c=>c.done?r(c.value):Promise.resolve(c.value).then(o,s);i((t=t.apply(a,e)).next())});var Ae=Xe((Jt,Re)=>{Re.exports=window.L});var ut={};Ee(ut,{WXLOG:()=>g,WxAPI:()=>B,WxCreateLegend:()=>re,WxDataSetManager:()=>k,WxGetColorSchemes:()=>V,WxGetColorStyles:()=>v,WxTileSource:()=>J,WxTilesLogging:()=>ye});var ue={comment1:["'degC': ['K', 1, 273.15] -> degC = K * 1 + 273.15",0],comment2:["'hPa': ['Pa', 1000]' -> hPa = Pa * 1000 + 0 (0 - could be ommited)",0],K:["K",1],kelvin:["K",1],F:["K",.5555555555,255.372222222],C:["K",1,273.15],degC:["K",1,273.15],"kg/m^2/s":["kg/m^2/s",1],"Kg/m^2/s":["kg/m^2/s",1],"Kg m**-2 s**-1":["kg/m^2/s",1],"Kg m^-2 s^-1":["kg/m^2/s",1],"Kg m^{-2} s^-1":["kg/m^2/s",1],"mm/h":["kg/m^2/s",.00027777777],"mm/hr":["kg/m^2/s",.00027777777],"W/m^2":["W/m^2",1],"W m^-2":["W/m^2",1],"W m^{-2}":["W/m^2",1],"W/m**2":["W/m^2",1],"W m**-2":["W/m^2",1],"m/s":["m/s",1],"m s**-1":["m/s",1],"m s^-1":["m/s",1],"m.s^{-1}":["m/s",1],knot:["m/s",.514444],knots:["m/s",.514444],"km/h":["m/s",.27777777777],"km h^-1":["m/s",.27777777777],"km h**-1":["m/s",.27777777777],mph:["m/s",.44704],"miles/h":["m/s",.44704],s:["s",1],sec:["s",1],h:["s",3600],min:["s",60],m:["m",1],cm:["m",.01],km:["m",1e3],mile:["m",1609.344],miles:["m",1609.344],inch:["m",.0254],Pa:["Pa",1],hPa:["Pa",100],degree:["degree",1],radian:["degree",57.3],"mg/m^3":["mg/m^3",1],"mg m^-3":["mg/m^3",1],"mg.m^-3":["mg/m^3",1],"%":["%",1],"(0 - 1)":["%",100]};var me={none:["#00000000","#00000000"],divergingbluered:["#2166acff","#92c5deff","#f7f7f7ff","#f4a582ff","#b2182bff"],rainbow:["#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff"],rainbowzerro:["#ff000000","#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff"],rainbow2:["#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff","#ff0000ff"],bluebird:["#0000ffff","#ff00ffff","#00ffffff","#9000ffff","#9090ffff"],bluebirdzerro:["#0000ff00","#0000ffff","#ff00ffff","#00ffffff","#9000ffff","#9090ffff"],bw:["#000000ff","#ffffffff"],wb:["#ffffffff","#000000ff"],redish:["#ff00ffff","#ff0000ff","#ffff00ff"],greenish:["#ffff00ff","#00ff00ff","#00ffffff"],blueish:["#ff00ffff","#0000ffff","#00ffffff"],hspastel:["#AC6EA4FF","#8E92BDFF","#ACD4DEFF","#E9DC8EFF","#E7A97DFF","#E59074FF","#BE7E68FF","#A88F86FF"]};var Z={base:{parent:void 0,name:"base",fill:"gradient",isolineColor:"inverted",isolineText:!0,vectorType:"arrows",vectorColor:"inverted",vectorFactor:1,streamLineColor:"#777",streamLineSpeedFactor:1,streamLineStatic:!1,showBelowMin:!0,showAboveMax:!0,colorScheme:"divergingbluered",colors:void 0,colorMap:void 0,levels:void 0,blurRadius:0,addDegrees:0,units:"",extraUnits:void 0,mask:"none"},custom:{parent:void 0,name:"custom",fill:"gradient",isolineColor:"inverted",isolineText:!0,vectorType:"arrows",vectorColor:"inverted",vectorFactor:1,streamLineColor:"#777",streamLineSpeedFactor:1,streamLineStatic:!1,showBelowMin:!0,showAboveMax:!0,colorScheme:"rainbow",colors:void 0,colorMap:void 0,levels:void 0,blurRadius:0,addDegrees:0,units:"",extraUnits:void 0,mask:"none"}};var fe,de,xe;function ge({colorStyles:a={},units:e={},colorSchemes:t={}}={}){g("WxTile lib setup: start"),fe=Object.assign({},ue,e),de=Object.assign({},t,me);let r=Object.assign({},a,Z);xe=Be(r),g("WxTile lib setup: styles unrolled");try{h(this,null,function*(){yield document.fonts.load("32px barbs"),yield document.fonts.load("32px arrows")})}catch(n){g("WxTile lib setup: fonts not loaded")}g("WxTile lib setup is done.")}function v(){return xe}function V(){return de}function X(a,e,t){g("makeConverter: From=",a," To=",e);let r=m=>m;if(r.trivial=!0,a===e)return g("Trivial converter"),r;let n=Object.assign({},fe,t),o=n[a],s=n[e];if(!o||!s)return g("Inconvertible units. Trivial converter"),r;let[i,c,l]=o,[u,f,d]=s;if(i!==u||!c||!f)return g("Inconvertible units. Trivial converter"),r;let b=c/f,x=((l||0)-(d||0))/f;return x?m=>b*m+x:m=>b*m}function Be(a){let e=Object.assign({},Z);for(let o in a){let s=a[o];if(Array.isArray(s))for(let i=0;i<s.length;++i)e[o+"["+i+"]"]=Object.assign({},s[i]);else e[o]=Object.assign({},s)}let t=Object.assign({},Z.base),r=(o,s)=>{if(s==="base")return t;let i=o[s];if(!i)return t;(!i.parent||!(i.parent in o))&&(i.parent="base");let c=r(o,i.parent);return Object.assign(i,Object.assign({},c,i,{parent:"base"}))},n={base:t};for(let o in e)n[o]=r(e,o);return n}function F(a){let e=new Map;return(t,...r)=>{let n=e.get(t);if(n)return n;let o=a(t,...r);return e.set(t,o),o.catch(s=>{s.name==="AbortError"&&e.delete(t)}),o}}function qe(a,e){return h(this,null,function*(){return createImageBitmap(yield(yield fetch(a,e)).blob())})}function P(a,e,t=!0){let r=Object.assign(document.createElement("canvas"),{width:a,height:e,imageSmoothingEnabled:!1}).getContext("2d",{willReadFrequently:t});if(!r)throw new Error("Cannot get canvas context");return r}function Ye(a){let{width:e,height:t}=a,r=P(e,t);return r.drawImage(a,0,0),r.getImageData(0,0,e,t)}function Q(a,e){return h(this,null,function*(){return Ye(yield qe(a,e))})}function je(a){a.data[34]<1&&g("Warning: image is in too old format. Check the version of the Splitter.");let e=new Uint16Array(a.data.buffer),t=new Uint16Array(e.length/2);for(let l=0;l<t.length;l++)t[l]=e[l*2];let r=new Uint8Array(8);for(let l=0;l<8;++l)r[l]=a.data[l*4+2];let n=new DataView(r.buffer),o=n.getFloat32(0,!0),s=n.getFloat32(4,!0),i=(s-o)/65535,c=Ge(t);return{raw:t,dmin:o,dmax:s,dmul:i,integral:c,radius:0}}function ee(a,e){return h(this,null,function*(){return je(yield Q(a,e))})}function Ge(a){let e=new Uint32Array(66564),t=new Uint32Array(258*258);e[0]=a[0],t[0]=a[0]===0?0:1;for(let r=1;r<258;++r)e[r]=a[r]+e[r-1],e[258*r]=a[258*r]+e[258*r-258],t[r]=(a[r]===0?0:1)+t[r-1],t[258*r]=(a[258*r]===0?0:1)+t[258*r-258];for(let r=1,n=259;r<258;++r,++n)for(let o=1;o<258;++o,++n)e[n]=a[n]+e[n-258]+e[n-1]-e[n-258-1],t[n]=(a[n]===0?0:1)+t[n-258]+t[n-1]-t[n-258-1];return{integral:e,integralNZ:t}}function he(a,e){if(e<0||e===a.radius)return a;a.radius=e;let t=258,{integral:r,integralNZ:n}=a.integral;for(let o=1;o<t;o++)for(let s=1;s<t;s++){if(!a.raw[t*o+s])continue;let i=Math.min(e,s-1,t-1-s),c=Math.min(e,o-1,t-1-o),l=t*(o-c-1)+s,u=t*(o+c)+s,f;if(n){let y=n[l-i-1],W=n[l+i],w=n[u-i-1],C=n[u+i];f=y+C-W-w}else f=(2*i+1)*(2*c+1);let d=r[l-i-1],b=r[l+i],x=r[u-i-1],m=r[u+i],p=d+m-b-x;a.raw[o*t+s]=p/f}return a}function T(a){let e=a>>0&255,t=a>>8&255,r=a>>16&255,n=e.toString(16),o=t.toString(16),s=r.toString(16);return n=n.length===2?n:"0"+n,o=o.length===2?o:"0"+o,s=s.length===2?s:"0"+s,"#"+n+o+s}function M(a){if(a[0]==="#"){if(a.length===4)return+("0xff"+a[3]+a[3]+a[2]+a[2]+a[1]+a[1]);if(a.length===7)return+("0xff"+a[5]+a[6]+a[3]+a[4]+a[1]+a[2]);if(a.length===9)return+("0x"+a[7]+a[8]+a[5]+a[6]+a[3]+a[4]+a[1]+a[2])}return g("wrong color format",a),0}function L(a,e){return h(this,null,function*(){let t=yield fetch(a,e);if(!t.ok)throw new Error("error:"+a+" - "+t.statusText);return t.json()})}function te(a,e,t){let r=a>>0&255,n=a>>8&255,o=a>>16&255,s=a>>>24,i=e>>0&255,c=e>>8&255,l=e>>16&255,u=e>>>24,f=r+t*(i-r),d=n+t*(c-n),b=o+t*(l-o),x=s+t*(u-s);return f|d<<8|b<<16|x<<24}function pe(a,e,t){let r=[];for(let n=0;n<t;++n)r.push(n*(e-a)/(t-1)+a);return r}var be=!1;function ye(a){console.log(a?"Logging on":"Logging off"),be=a}function g(...a){be&&console.log(...a)}function We(a){return a[0]==="#"&&a.length===4?"#"+a[1]+a[1]+a[2]+a[2]+a[3]+a[3]:a}function E(a,{x:e,y:t,z:r}){return a.replace("{x}",`${e}`).replace("{y}",`${t}`).replace("{z}",`${r}`)}function N({x:a,y:e,z:t}){return`${t}-${a}-${e}`}var He="A".charCodeAt(0);var $=class{constructor(){this.qtree={nodes:null};this.qtreedepth=0}load(e,t){return h(this,null,function*(){try{let r=yield L(e,t);this.qtree=we(r,{pos:0})}catch(r){throw new Error(`Failed to load QTree: ${r.message}`)}this.qtreedepth=Se(this.qtree)})}check(e){let t=e.z-this.qtreedepth,r=t>=0,n=r?{x:e.x>>t,y:e.y>>t,z:this.qtreedepth}:O({},e);return De(this.qtree,n,r)}};function we(a,e){let t=a.charCodeAt(e.pos)-He;e.pos++;let r=[1,2,4,8].map(n=>t&n?we(a,e):null);return{nodes:r.some(n=>n)?r:null}}function Se(a){return a!=null&&a.nodes?1+Math.max(...a.nodes.map(Se)):0}function De(a,e,t){return a===null?"land":t&&!e.z?"mixed":a.nodes===null?"sea":e.z?(e.z--,De(a.nodes[(e.y>>e.z&1)<<1|e.x>>e.z&1],e,t)):"mixed"}var k=class{constructor({datasetName:e,instance:t,instanced:r,meta:n,wxapi:o}){if(!o.datasetsMetas.allDatasetsList.includes(e))throw new Error(`Dataset ${e} not found`);this.datasetName=e,this.instanced=r,this.instance=t,this.meta=n,this.wxapi=o}getValidTime(e=Date()){let t=this.getTimes();if(typeof e=="number"){if(e<=0)return t[0];if(e<t.length)return t[e]}let r=new Date(e).getTime(),n=t.find(o=>new Date(o).getTime()>=r);if(isNaN(r)||!n){let o=t.indexOf(e);return o===-1?t[t.length-1]:t[o]}return n}getTimes(){return this.instanced||this.meta.times}getVariables(){return this.meta.variables}getVariableMeta(e){return this.meta.variablesMeta[e]}getMaxZoom(){return this.meta.maxZoom}getBoundaries180(){var r;let e=(r=this.meta.boundaries)==null?void 0:r.boundaries180;if((e==null?void 0:e.length)!==1)return;let t=e[0];return[t.west,t.south,t.east,t.north]}getBoundaries(){return this.meta.boundaries}createURI(e,t,r="png"){if(!this.checkVariableValid(e))throw new Error(`in dataset ${this.datasetName} variable ${e} not found`);let n=this.getValidTime(t),o=this.instanced?n:this.instance;return`${this.wxapi.dataServerURL+this.datasetName}/${o}/${e}/${n}/{z}/{x}/{y}.${r}`}checkVariableValid(e){return this.getVariableMeta(e)!==void 0}checkCombineVariableIfVector(e){let t=this.getVariableMeta(e);if(!t)throw new Error(`in dataset ${this.datasetName} variable ${e} not found`);return t.vector||[e]}checkDatasetOutdated(){return h(this,null,function*(){return yield this.wxapi.initDone,(yield this.getDatasetInstance())===this.instance})}getDatasetInstance(){return h(this,null,function*(){let e=yield this.getDatasetInstances();return e[e.length-1]})}getDatasetInstances(){return h(this,null,function*(){try{let e=yield L(this.wxapi.dataServerURL+this.datasetName+"/instances.json",this.wxapi.requestInit);if(e.length===0)throw new Error(`No instances found for dataset ${this.datasetName}`);return e}catch(e){throw new Error(`getting dataset instances failure message: ${e.message} datasetName: ${this.datasetName}`)}})}};var B=class{constructor({dataServerURL:e,maskURL:t="auto",qtreeURL:r="auto",requestInit:n,colorStyles:o,units:s,colorSchemes:i}){this.datasetsMetas={allDatasetsList:[]};this.qtree=new $;this.loadMaskFunc=()=>Promise.reject(new Error("maskURL not defined"));if(ge({colorStyles:o,units:s,colorSchemes:i}),this.dataServerURL=e,this.requestInit=n,r=r==="auto"?e+"seamask.qtree":r,t!=="none"){let c=F(Q);this.maskURL=t=t==="auto"?e+"mask/":t,this.loadMaskFunc=l=>c(E(t,l),n)}this.initDone=Promise.all([L(e+"datasetsmeta.json",n),r!=="none"?this.qtree.load(r,n):Promise.resolve()]).then(([c,l])=>{c.allDatasetsList||(c.allDatasetsList=Object.keys(c)),this.datasetsMetas=c})}getDatasetShortMeta(e){if(e!=="allDatasetsList")return this.datasetsMetas[e]}getDatasetInatance(e){var t;return(t=this.getDatasetShortMeta(e))==null?void 0:t.instance}getDatasetVariables(e){return h(this,null,function*(){var t;return yield this.initDone,(t=this.datasetsMetas[e])==null?void 0:t.variables})}createDatasetManager(e){return h(this,null,function*(){yield this.initDone;let t=this.getDatasetShortMeta(e),r=t==null?void 0:t.instance;if(!r)throw new Error("Dataset/instance not found:"+e);let n=t.instanced,o=yield L(this.dataServerURL+e+"/"+r+"/meta.json",this.requestInit);return new k({datasetName:e,instanced:n,instance:r,meta:o,wxapi:this})})}createAllDatasetsManagers(){return h(this,null,function*(){return yield this.initDone,Promise.allSettled(this.datasetsMetas.allDatasetsList.map(t=>this.createDatasetManager(t)))})}filterDatasetsByVariableName(e){return h(this,null,function*(){return yield this.initDone,this.datasetsMetas.allDatasetsList.filter(t=>{var r,n,o;return(o=(n=(r=this.datasetsMetas[t])==null?void 0:r.variables)==null?void 0:n.includes)==null?void 0:o.call(n,e)})})}getAllDatasetsNames(){return h(this,null,function*(){return yield this.initDone,this.datasetsMetas.allDatasetsList})}};function ze(a,e,t){return a>t?t:a<e?e:a}var q=class{constructor(e,t,[r,n],o){let s=n-r;this.levelIndex=new Uint32Array(65536),this.colorsI=new Uint32Array(65536);let i=[];this.DataToStyle=X(t,e.units,e.extraUnits),this.DataToStyle.trivial&&(e.units=t),o&&(this.DataToKnots=X(t,"knot"));let c=X(e.units,t,e.extraUnits),l=m=>~~(65535*ze((c(m)-r)/(n-r),0,1));if(Array.isArray(e.colorMap)){e.colorMap.sort((m,p)=>m[0]<p[0]?-1:m[0]>p[0]?1:0);for(let[m]of e.colorMap)i.push(l(m))}else{if(e.levels||(e.levels=pe(this.DataToStyle(r),this.DataToStyle(n),10)),e.levels.sort((m,p)=>m<p?-1:m>p?1:0),!e.colors){let m=V();e.colorScheme&&e.colorScheme in m?e.colors=m[e.colorScheme]:e.colors=m.wb}for(let m of e.levels)i.push(l(m))}let u=65536,f=re(u,e);this.ticks=f.ticks;let d=f.ticks[0].data,x=f.ticks[f.ticks.length-1].data-d;for(let m=0;m<65536;++m){let p=s*m/65535+r,y=this.DataToStyle(p),W=Math.round((u-1)*(y-d)/x);W<=0?this.colorsI[m]=e.showBelowMin?f.colors[0]:0:W>=u?this.colorsI[m]=e.showAboveMax?f.colors[u-1]:0:this.colorsI[m]=f.colors[W]}this.colorsI[0]=0;for(let m=0;m<i[0];++m)this.levelIndex[m]=0;for(let m=0;m<i.length-1;m++)for(let p=i[m];p<i[m+1]+1;++p)this.levelIndex[p]=m;for(let m=i[i.length-1];m<65536;++m)this.levelIndex[m]=i.length-1}};function Te(a){var t;if(a!==0&&-.1<a&&a<.1)return a.toExponential(2);let e=a.toString();return((t=e.split(".")[1])==null?void 0:t.length)>2?a.toFixed(2):e}function re(a,e){let t={size:a,showBelowMin:e.showBelowMin,showAboveMax:e.showAboveMax,units:e.units,colors:new Uint32Array(a),ticks:[]},{colorMap:r,levels:n,colors:o}=e,s=e.fill!=="solid";if(r){let d=r[0][0],b=r[r.length-1][0]-d;for(let[x,m]of r){let p=~~((x-d)/b*(a-1)),y={data:x,dataString:Te(x),color:m,pos:p};t.ticks.push(y)}for(let x=0;x<r.length-1;x++){let m=t.ticks[x].pos,p=t.ticks[x+1].pos,y=M(r[x][1]),W=s?M(r[x+1][1]):0;for(let w=m;w<p;++w)t.colors[w]=s?te(y,W,(w-m)/(p-m)):y}return t.colors[a-1]=M(r[r.length-1][1]),t}if(!o||!n)return t;let i=0,c=0,l=-1;for(let d=0;d<a;++d){let b=d*(o.length-1)/a;l!==~~b&&(l=~~b,i=M(o[l]),c=o.length>l+1?M(o[l+1]):i),t.colors[d]=s?te(i,c,b-l):i}t.colors[a-1]=M(o[o.length-1]);let u=n[0],f=(a-1)/(n[n.length-1]-u);for(let d of n){let b=~~((d-u)*f),x={data:d,dataString:Te(d),color:T(t.colors[b]),pos:b};t.ticks.push(x)}return t}var Ke=2*Math.PI*6378137/256,Y=2*Math.PI*6378137/2;function Je(a,e){let t=a/Y*180,r=e/Y*180;return r=180/Math.PI*(2*Math.atan(Math.exp(r*Math.PI/180))-Math.PI/2),[r,t]}function Qe(a,e,t){let r=et(t),n=a*r-Y,o=e*r-Y;return[n,o]}function et(a){return Ke/Math.pow(2,a)}function ae(a,e,t){let[r,n]=Je(...Qe(a,e,t));return[n,-r]}function Ce(a,e){return[a*256,e*256]}function ne(a,e,t){let r=((e-a)%360+540)%360-180;return(a+r*t+360)%360}function tt(a,e,t,r,n,o,s,i){switch((a?1:0)|(e?2:0)|(t?4:0)|(r?8:0)){case 0:return 0;case 1:return a;case 2:return e;case 3:t=a,r=e;break;case 4:return t;case 5:e=a,r=t;break;case 6:r=e+t>>1,a=r;break;case 7:r=e+t>>1;break;case 8:return r;case 9:e=a+r>>1,t=e;break;case 10:a=e,t=r;break;case 11:t=a+r>>1;break;case 12:a=t,e=r;break;case 13:e=a+r>>1;break;case 14:a=e+t>>1;break}a=s+i*a,e=s+i*e,t=s+i*t,r=s+i*r;let l=ne(a,e,n),u=ne(t,r,n);return(ne(l,u,o)-s)/i||1}function rt(a,e,t,r,n,o,s,i){switch((a?1:0)|(e?2:0)|(t?4:0)|(r?8:0)){case 7:return n+o<1?n*(e-a)+o*(t-a)+a:0;case 14:return n+o<1?0:n*(r-t)+o*(r-e)+e+t-r;case 11:return o<n?(1-n)*(a-e)+o*(r-e)+e:0;case 13:return o<n?0:(1-n)*(t-r)+o*(t-a)+a+r-t;case 15:return n+o<1?n*(e-a)+o*(t-a)+a:n*(r-t)+o*(r-e)+e+t-r;default:return 0}}function Me(a,e,t){if(!t)return e;let r=.9999999/Math.pow(2,t.z),n=t.x*256*r,o=t.y*256*r,{raw:s,dmin:i,dmax:c,dmul:l}=e,u={raw:new Uint16Array(258*258),dmin:i,dmax:c,dmul:l},{raw:f}=u;for(let d=-1,b=0;d<=256;d++){let x=o+d*r,m=Math.floor(x),p=x-m;for(let y=-1;y<=256;y++,b++){let W=n+y*r,w=Math.floor(W),C=W-w,S=w+1+(m+1)*258,D=s[S],I=s[S+1],R=s[S+258],A=s[S+258+1];f[b]=a(D,I,R,A,C,p,i,l)}}return u}function Ie(a,e){return Me(rt,a,e)}function Le(a,e){return Me(tt,a,e)}function ve(a,e,t){let r=t==="sea";for(let n=0,o=0;o<256;o++)for(let s=0,i=(o+1)*258+1;s<256;s++,i++,n+=4)r===!e.data[n]&&(a.raw[i]=0);return a}function Pe(a){let[e,t]=Ce(a.x,a.y),[r,n]=ae(e,t,a.z),[o,s]=ae(e+256,t+256,a.z);return{west:r,north:n,east:o,south:s}}function ke(a,e){let t=a.z-e;if(t<=0)return{upCoords:a};let r={x:a.x>>>t,y:a.y>>>t,z:e},n={x:a.x&(1<<t)-1,y:a.y&(1<<t)-1,z:t};return{upCoords:r,subCoords:n}}var j=class{constructor(e){this.loadDataFunc=F(ee);this.layer=e}load(e,t){return h(this,null,function*(){let r=yield this.cacheLoad(e,this.layer.tilesURIs,t);if(!r)return null;let{rawdata:n,subCoords:o,tileType:s}=r,{units:i}=this.layer.currentMeta,c=i==="degree"?Le:Ie,l=f=>c(he(f,this.layer.style.blurRadius),o),u=n.map(l);return this._vectorMagnitudesPrepare(u),yield this._applyMask(u,e,s,!o&&n.length===1),{data:u,slines:this._createStreamLines(u)}})}cacheLoad(e,t,r){return h(this,null,function*(){if(!this._checkInsideBoundaries(e))return null;let n=this._checkTypeAndMask(e);if(!n)return null;let{upCoords:o,subCoords:s}=ke(e,this.layer.wxdatasetManager.getMaxZoom()),i=t.map(u=>E(u,o)),c=Object.assign({},this.layer.wxdatasetManager.wxapi.requestInit,{signal:r==null?void 0:r.signal});return{rawdata:yield Promise.all(i.map(u=>this.loadDataFunc(u,c))),subCoords:s,tileType:n}})}clearCache(){this.loadDataFunc=F(ee)}_applyMask(e,t,r,n){return h(this,null,function*(){let{style:o}=this.layer;if((o.mask==="land"||o.mask==="sea")&&r==="mixed"){if(n){let{raw:i,dmin:c,dmax:l,dmul:u}=e[0];e[0]={raw:new Uint16Array(i),dmin:c,dmax:l,dmul:u}}let s;try{s=yield this.layer.wxdatasetManager.wxapi.loadMaskFunc(t)}catch(i){g("Can't load Mask. Masking is Turned OFF");return}ve(e[0],s,o.mask)}})}_vectorMagnitudesPrepare(e){if(e.length===1)return;e.unshift({raw:new Uint16Array(258*258),dmin:0,dmax:0,dmul:0});let[t,r,n]=e;t.dmax=1.42*Math.max(-r.dmin,r.dmax,-n.dmin,n.dmax),t.dmul=(t.dmax-t.dmin)/65535;for(let o=0;o<258*258;++o){if(!r.raw[o]||!n.raw[o])continue;let s=r.dmin+r.dmul*r.raw[o],i=n.dmin+n.dmul*n.raw[o];t.raw[o]=Math.sqrt(i*i+s*s)/t.dmul}}_checkTypeAndMask(e){let{mask:t}=this.layer.style;var r="mixed";if(!((t==="land"||t==="sea")&&(r=this.layer.wxdatasetManager.wxapi.qtree.check(e),t===r)))return r}_checkInsideBoundaries(e){let t=this.layer.wxdatasetManager.getBoundaries();if(t!=null&&t.boundaries180){let r=Pe(e),n=o=>!(r.west>o.east||o.west>r.east||r.south>o.north||o.south>r.north);if(!t.boundaries180.some(n))return!1}return!0}_createStreamLines(e){if(e.length!==3)return[];let{style:t}=this.layer;if(t.streamLineColor==="none")return[];let r=[],[n,o,s]=e,i=(t.streamLineSpeedFactor||1)/n.dmax,c=t.addDegrees?.017453292519943*t.addDegrees:0,l=t.streamLineGridStep||64,u=t.streamLineSteps||300;for(let f=0;f<=256;f+=l)for(let d=0;d<=256;d+=l){if(!n.raw[1+d+(1+f)*258])continue;let b=[],x=d,m=f,p=-1,y=0,W=0;for(let S=0;S<=u&&x>=0&&x<=256&&m>=0&&m<=256;S++){S%(u/10)||b.push({x:~~x,y:~~m});let D=~~x+1+(~~m+1)*258;if(D!==p){if(!n.raw[D])break;p=D;let I=n.dmin+n.raw[D]*n.dmul,R=o.dmin+o.raw[D]*o.dmul,A=s.dmin+s.raw[D]*s.dmul,_=Math.atan2(R,A)+c;y=i*I*Math.sin(_),W=i*I*Math.cos(_)}x+=y,m-=W}let w=d,C=f;p=-1;for(let S=1;S<=u&&w>=0&&w<=256&&C>=0&&C<=256;S++){S%(u/10)||b.unshift({x:~~w,y:~~C});let D=~~w+1+(~~C+1)*258;if(D!==p){if(!n.raw[D])break;p=D;let I=n.dmin+n.raw[D]*n.dmul,R=o.dmin+o.raw[D]*o.dmul,A=s.dmin+s.raw[D]*s.dmul,_=Math.atan2(R,A)+c;y=i*I*Math.sin(_),W=i*I*Math.cos(_)}w-=y,C+=W}b.length>2&&r.push(b)}return r}};var G=class{constructor(e){this.layer=e}paint({data:e,ctxFill:t,ctxText:r,ctxStreamLines:n}){let{layer:o}=this,{units:s}=o.currentMeta,i=new ImageData(256,256),c=new Uint32Array(i.data.buffer);t.clearRect(0,0,256,256),r.clearRect(0,0,256,256),n.clearRect(0,0,256,256),at(e.data[0],c,o);let l=nt(c,e.data[0],o);t.putImageData(i,0,0),ot(l,r,o),st(e.data,r,o),it(e.data[0],r,s,o),lt(e,r,o)}imprintVectorAnimationLinesStep({data:e,ctxFill:t,ctxStreamLines:r},n){let{layer:o}=this;r.clearRect(0,0,256,256),r.drawImage(t.canvas,0,0),!(e.slines.length===0||o.style.streamLineStatic||o.style.streamLineColor==="none")&&ct(e,r,o,n)}};function at(a,e,{CLUT:t,style:r}){let{raw:n}=a,{colorsI:o}=t;if(r.fill!=="none")for(let s=0,i=0,c=259;s<256;++s,c+=2)for(let l=0;l<256;++l,++i,++c)e[i]=o[n[c]];else e.fill(0)}function nt(a,e,{CLUT:t,style:r}){let{raw:n}=e,{levelIndex:o,colorsI:s}=t,i=[];if(r.isolineColor!=="none"){let c=r.isolineColor[0]==="#"?M(r.isolineColor):0;for(let l=0,u=0;l<256;l+=1)for(let f=0;f<256;f+=1){let d=(l+1)*258+(f+1),b=n[d],x=n[d+1],m=n[d+258];if(!b||!x||!m)continue;let p=o[b],y=o[x],W=o[m];if(p!==y||p!==W){let w=Math.max(p,y,W),C=Math.max(b,x,m),S=l*256+f;switch(r.isolineColor){case"inverted":a[S]=~s[C]|4278190080;break;case"fill":a[S]=s[C]|4278190080;break;default:a[S]=c;break}r.isolineText&&!(++u%255)&&f>20&&f<235&&l>20&&l<235&&i.push({x:f,y:l,d:b,dr:x,db:m,mli:w})}}}return i}function ot(a,e,{CLUT:t}){if(a.length){e.font="1.1em Sans-serif",e.lineWidth=2,e.strokeStyle="white",e.fillStyle="black",e.textAlign="center",e.textBaseline="middle";for(let{x:r,y:n,d:o,dr:s,db:i,mli:c}of a){let l=t.ticks[c].dataString,u=Math.atan2(o-s,i-o);e.save(),e.translate(r,n),e.rotate(u<-1.57||u>1.57?u+3.14:u),e.strokeText(l,0,0),e.fillText(l,0,0),e.restore()}}}function st(a,e,{CLUT:t,style:r}){if(!t.DataToKnots||r.vectorColor==="none"||r.vectorType==="none")return;if(a.length!==3)throw new Error("data.length !== 3");let[n,o,s]=a;switch(r.vectorType){case"barbs":e.font="40px barbs";break;case"arrows":e.font="50px arrows";break;default:e.font=r.vectorType}e.textAlign="center",e.textBaseline="middle",e.fillStyle=r.vectorColor;let i=r.addDegrees?.017453292519943*r.addDegrees:0,c=32;for(let l=c/2;l<256;l+=c)for(let u=c/2;u<256;u+=c){let f=u+1+(l+1)*258;if(!n.raw[f])continue;let d=Math.atan2(o.dmin+o.raw[f]*o.dmul,s.dmin+s.raw[f]*s.dmul),b=n.dmin+n.raw[f]*n.dmul,x=r.vectorType!=="barbs"?r.vectorFactor*.2:.2,m=Math.min(t.DataToKnots(b)*x,25)+65,p=String.fromCharCode(m);switch(r.vectorColor){case"inverted":e.fillStyle=T(~t.colorsI[n.raw[f]]);break;case"fill":e.fillStyle=T(t.colorsI[n.raw[f]]);break}e.save(),e.translate(u,l),e.rotate(d+i),e.fillText(p,0,0),e.restore()}}function it(a,e,t,{CLUT:r,style:n}){if(t!=="degree")return;let o=.017453292519943*n.addDegrees;e.font="50px arrows",e.textAlign="center",e.textBaseline="middle",e.fillStyle=n.vectorColor;let s="L",i=32;for(let c=i/2;c<256;c+=i)for(let l=i/2;l<256;l+=i){let u=l+1+(c+1)*258;if(!a.raw[u])continue;let d=(a.dmin+a.raw[u]*a.dmul+180)*.01745329251;switch(n.vectorColor){case"inverted":e.fillStyle=T(~r.colorsI[a.raw[u]]);break;case"fill":e.fillStyle=T(r.colorsI[a.raw[u]]);break}e.save(),e.translate(l,c),e.rotate(d+o),e.fillText(s,0,0),e.restore()}}function lt(a,e,{CLUT:t,style:r}){let{data:n,slines:o}=a;if(!o.length||!r.streamLineStatic||r.streamLineColor==="none")return;let s=n[0];e.lineWidth=1,e.strokeStyle=r.streamLineColor;for(let i=o.length;i--;){let c=o[i];for(let l=0;l<c.length-1;++l){let u=c[l],f=c[l+1],d=u.x+1+(u.y+1)*258;switch(r.streamLineColor){case"inverted":e.strokeStyle=T(~t.colorsI[s.raw[d]]);break;case"fill":e.strokeStyle=T(t.colorsI[s.raw[d]]);break}e.beginPath(),e.moveTo(u.x,u.y),e.lineTo(f.x,f.y),e.stroke()}}}function ct(a,e,{CLUT:t,style:r},n){let{data:o,slines:s}=a,i=o[0],c=r.streamLineColor.substring(0,7);n=n>>5;for(let l=0;l<s.length;++l){let u=s[l],f=u.length-1,d=(n+(1+u[0].x)*(1+u[0].y))%30;for(let b=0;b<f;++b){let x=u[b],m=u[b+1],p=1-(d-b)/f;(p<0||p>1)&&(p=0);let y=(~~(p*255)).toString(16).padStart(2,"0"),W=1+~~((1.2-p)*5);e.lineWidth=W;let w=x.x+1+(x.y+1)*258;switch(r.streamLineColor){case"inverted":c=T(~t.colorsI[i.raw[w]]);break;case"fill":c=T(t.colorsI[i.raw[w]]);break}e.strokeStyle=c+y,e.beginPath(),e.moveTo(x.x,x.y),e.lineTo(m.x,m.y),e.stroke()}}}var H=class{constructor({time:e,variables:t,wxdatasetManager:r,ext:n="png",wxstyleName:o="base"}){this.tilesCache=new Map;this.painter=new G(this);this.loader=new j(this);if(!(t!=null&&t.length)||t.length>2)throw new Error(`WxTileSource ${r.datasetName}: only 1 or 2 variables are supported but ${t.length} were given`);t.forEach(s=>{if(!r.checkVariableValid(s))throw new Error(`WxTileSource ${r.datasetName}: variable ${s} is not valid`)}),this.variables=t,this.wxdatasetManager=r,this.ext=n,this.currentMeta=this._getCurrentMeta(),[this.tilesURIs,this.time]=this._createURLsAndTime(e),[this.style,this.CLUT]=this._createCurrentStyleObject(v()[o]),g(`WxTileSource created ${r.datasetName}, ${t.join(", ")}, ${o}`)}get nonanimatable(){return this.variables.length<2||this.style.streamLineStatic||this.style.streamLineColor==="none"}getTime(){return this.time}clearCache(){this.tilesCache.clear(),this.loader.clearCache()}getCurrentStyleObjectCopy(){return Object.assign({},this.style)}updateCurrentStyleObject(e){[this.style,this.CLUT]=this._createCurrentStyleObject(e)}getTileData(e,t){let r=this.tilesCache.get(N(e));if(!r)return;let n=this._getPixelInfo(t,r.data.data);if(!n)return;let{raw:o,data:s}=n,i=o.map(u=>this.CLUT.colorsI[u]),c=i.map(T),l=s.map(u=>this.CLUT.DataToStyle(u));return{data:s,raw:o,rgba:i,hexColor:c,inStyleUnits:l,tilePoint:t,styleUnits:this.style.units,dataUnits:this.currentMeta.units}}setURLsAndTime(e){[this.tilesURIs,this.time]=this._createURLsAndTime(e)}loadTile(e,t){return h(this,null,function*(){return this._loadCacheDrawTile(e,this.tilesCache,t)})}preloadTime(e,t,r){return h(this,null,function*(){let[n]=this._createURLsAndTime(e);yield Promise.allSettled(t.map(o=>this.loader.cacheLoad(o,n,r)))})}reloadTiles(e,t){return h(this,null,function*(){var n;let r=new Map;yield Promise.allSettled(e.map(o=>this._loadCacheDrawTile(o,r,t))),(n=t==null?void 0:t.signal)!=null&&n.aborted||(this.tilesCache=r)})}_loadCacheDrawTile(e,t,r){return h(this,null,function*(){let n=t.get(N(e));if(n)return n;let o=null;try{o=yield this.loader.load(e,r)}catch(u){throw{status:404}}if(!o)throw{status:404};let s=P(256,256),i=s,c=this.variables.length===2?P(256,256):s,l={ctxFill:s,ctxText:i,ctxStreamLines:c,data:o};return this.painter.paint(l),t.set(N(e),l),l})}_createCurrentStyleObject(e){let t=Object.assign(this.getCurrentStyleObjectCopy(),e);t.streamLineColor=We(t.streamLineColor);let r=this._prepareCLUT(t);return[t,r]}_getCurrentMeta(){let e=this.variables.map(s=>{let i=this.wxdatasetManager.getVariableMeta(s);if(!i)throw new Error(`WxTileSource ${this.wxdatasetManager.datasetName}: variable ${s} is not valid`);return i}),{min:t,max:r,units:n,vector:o}=e[0];return this.variables.length>1&&(t=0,r=1.42*Math.max(-e[0].min,e[0].max,-e[1].min,e[1].max)),{min:t,max:r,units:n,vector:o}}_getPixelInfo({x:e,y:t},r){var o,s;let n=(t+1)*258+(e+1);if(!!((s=(o=r==null?void 0:r[0])==null?void 0:o.raw)!=null&&s[n]))return{raw:r.map(i=>i.raw[n]),data:r.map(i=>i.raw[n]*i.dmul+i.dmin)}}_prepareCLUT(e){let{min:t,max:r,units:n}=this.currentMeta;return new q(e,n,[t,r],this.variables.length===2)}_createURLsAndTime(e){let t=this.wxdatasetManager.getValidTime(e);return[this.variables.map(n=>this.wxdatasetManager.createURI(n,t,this.ext)),t]}};var _e=Ne(Ae()),z=class extends _e.default.GridLayer{};var K=class extends z{constructor(t,r){super(r);this.animation=!1;this.animationSeed=0;this.layer=new H(t)}get wxdatasetManager(){return this.layer.wxdatasetManager}getMetadata(){return g(`WxTileSource getMetadata (${this.layer.wxdatasetManager.datasetName})`),O({},this.layer.currentMeta)}getVariables(){return g(`WxTileSource getVariables (${this.layer.wxdatasetManager.datasetName})`),[...this.layer.variables]}clearCache(){g(`WxTileSource clearCache (${this.layer.wxdatasetManager.datasetName})`),this.layer.clearCache()}getCurrentStyleObjectCopy(){return g(`WxTileSource getCurrentStyleObjectCopy (${this.layer.wxdatasetManager.datasetName})`),this.layer.getCurrentStyleObjectCopy()}getTime(){return g(`WxTileSource getTime (${this.layer.wxdatasetManager.datasetName})`),this.layer.getTime()}setTime(t,r){return h(this,null,function*(){var o;g(`WxTileSource setTime (${this.layer.wxdatasetManager.datasetName}) `,{time:t});let n=this.getTime();return this.layer.setURLsAndTime(t),yield this._reloadVisible(r),(o=r==null?void 0:r.signal)!=null&&o.aborted&&this.layer.setURLsAndTime(n),this.getTime()})}preloadTime(t,r){return h(this,null,function*(){return g(`WxTileSource preloadTime (${this.layer.wxdatasetManager.datasetName}) `,{time:t}),this.layer.preloadTime(t,this.coveringTiles(),r)})}startAnimation(){if(this.animation){g(`WxTileSource startAnimation (${this.layer.wxdatasetManager.datasetName}) already started`);return}if(this.layer.nonanimatable){g(`WxTileSource startAnimation (${this.layer.wxdatasetManager.datasetName}) nonanimatable`);return}g(`WxTileSource startAnimation (${this.layer.wxdatasetManager.datasetName})`),this.animation=!0;let t=r=>h(this,null,function*(){if(g(`WxTileSource animationStep (${this.layer.wxdatasetManager.datasetName})`),!this.animation||this.layer.nonanimatable){this.animation=!1;return}this.animationSeed=r,yield this._redrawTiles(),requestAnimationFrame(t)});requestAnimationFrame(t)}stopAnimation(){return h(this,null,function*(){return g(`WxTileSource stopAnimation (${this.layer.wxdatasetManager.datasetName})`),this.animation=!1,this._redrawTiles()})}setCoarseLevel(t=2){return h(this,null,function*(){return g(`WxTileSource setCoarseLevel (${this.layer.wxdatasetManager.datasetName})`,{level:t}),this.oldMaxZoom=this.layer.wxdatasetManager.getMaxZoom(),this.layer.wxdatasetManager.meta.maxZoom=Math.max(this.oldMaxZoom-t,1),this._reloadVisible()})}unsetCoarseLevel(){return h(this,null,function*(){if(g(`WxTileSource unsetCoarseLevel (${this.layer.wxdatasetManager.datasetName})`),this.oldMaxZoom)return this.layer.wxdatasetManager.meta.maxZoom=this.oldMaxZoom,this._reloadVisible()})}setStyleByName(t,r=!0){return h(this,null,function*(){return g(`WxTileSource setStyleByName (${this.layer.wxdatasetManager.datasetName})`),this.updateCurrentStyleObject(v()[t],r)})}updateCurrentStyleObject(t,r=!0,n){return h(this,null,function*(){if(g(`WxTileSource updateCurrentStyleObject (${this.layer.wxdatasetManager.datasetName})`,{style:t}),this.layer.updateCurrentStyleObject(t),this.startAnimation(),r)return this._reloadVisible(n)})}_redrawTiles(){return this.redrawRequested?this.redrawRequested:(this.redrawRequested=new Promise(t=>{requestAnimationFrame(()=>{g(`WxTileSource _redrawTiles (${this.layer.wxdatasetManager.datasetName})`),this.update(),t(),this.redrawRequested=void 0})}),this.redrawRequested)}_reloadVisible(t){return h(this,null,function*(){})}coveringTiles(){return[]}update(){}};var oe=class{constructor(e,t,r){this.coords=e;this.ctx=t;this.raster_data=r;this.draw(r.ctxFill.canvas)}draw(e){this.ctx.clearRect(0,0,256,256),this.ctx.drawImage(e,0,0)}},J=class extends K{constructor(e,t){super(e,t),g("WxTileSource constructor: ",e)}getLayerInfoAtLatLon(e,t){if(g(`WxTileSource getLayerInfoAtLatLon (${this.layer.wxdatasetManager.datasetName})`,e),!this._map)return;let r=this._map.getZoom(),n=this._map.project(e,r),o=n.divideBy(256).floor(),s=n.subtract(o.multiplyBy(256)).floor();return this.layer.getTileData({x:o.x,y:o.y,z:r},s)}_reloadVisible(e){return h(this,null,function*(){var t;if(g(`WxTileSource _reloadVisible (${this.layer.wxdatasetManager.datasetName})`),yield this.layer.reloadTiles(this.coveringTiles(),e),(t=e==null?void 0:e.signal)!=null&&t.aborted){g(`WxTileSource _reloadVisible (${this.layer.wxdatasetManager.datasetName}) aborted`);return}return yield Promise.allSettled(this._ForEachWxTile(r=>h(this,null,function*(){r.raster_data=yield this.layer.loadTile(r.coords)}),"_reloadVisible")),this._redrawTiles()})}update(){this._ForEachWxTile(e=>{this.animation?(this.layer.painter.imprintVectorAnimationLinesStep(e.raster_data,this.animationSeed),e.draw(e.raster_data.ctxStreamLines.canvas)):e.draw(e.raster_data.ctxFill.canvas)},"_redrawTiles")}coveringTiles(){var t;g(`WxTileSource coveringTiles (${this.layer.wxdatasetManager.datasetName})`);let e=[];for(let r in this._tiles){let n=(t=this._tiles[r].el)==null?void 0:t.wxtile;n&&e.push(n.coords)}return e}_ForEachWxTile(e,t){var n;g(`WxTileSource _ForEachWxTile (${this.layer.wxdatasetManager.datasetName}) func=${t}`);let r=[];for(let o in this._tiles){let s=(n=this._tiles[o].el)==null?void 0:n.wxtile;s&&r.push(e(s))}return r}createTile(e,t){let r=P(256,256),n=r.canvas;return this.layer.loadTile(e).then(o=>{n.wxtile=new oe({x:e.x,y:e.y,z:e.z},r,o),t()}).catch(o=>{t(o)}),n}};return $e(ut);})();
1
+ var wxtilesleaflet=(()=>{var Be=Object.create;var Z=Object.defineProperty,Ve=Object.defineProperties,Xe=Object.getOwnPropertyDescriptor,Oe=Object.getOwnPropertyDescriptors,Fe=Object.getOwnPropertyNames,ce=Object.getOwnPropertySymbols,Ne=Object.getPrototypeOf,ue=Object.prototype.hasOwnProperty,Ze=Object.prototype.propertyIsEnumerable;var me=(a,e,t)=>e in a?Z(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t,L=(a,e)=>{for(var t in e||(e={}))ue.call(e,t)&&me(a,t,e[t]);if(ce)for(var t of ce(e))Ze.call(e,t)&&me(a,t,e[t]);return a},fe=(a,e)=>Ve(a,Oe(e));var Ee=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports),Ye=(a,e)=>{for(var t in e)Z(a,t,{get:e[t],enumerable:!0})},de=(a,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Fe(e))!ue.call(a,n)&&n!==t&&Z(a,n,{get:()=>e[n],enumerable:!(r=Xe(e,n))||r.enumerable});return a};var qe=(a,e,t)=>(t=a!=null?Be(Ne(a)):{},de(e||!a||!a.__esModule?Z(t,"default",{value:a,enumerable:!0}):t,a)),je=a=>de(Z({},"__esModule",{value:!0}),a);var b=(a,e,t)=>new Promise((r,n)=>{var s=u=>{try{i(t.next(u))}catch(l){n(l)}},o=u=>{try{i(t.throw(u))}catch(l){n(l)}},i=u=>u.done?r(u.value):Promise.resolve(u.value).then(s,o);i((t=t.apply(a,e)).next())});var Ue=Ee((Kt,_e)=>{_e.exports=window.L});var xt={};Ye(xt,{FrameworkParentClass:()=>O,Loader:()=>B,Painter:()=>V,QTree:()=>U,RawCLUT:()=>$,WXLOG:()=>m,WxAPI:()=>Q,WxCreateLegend:()=>se,WxDataSetManager:()=>N,WxGetColorSchemes:()=>q,WxGetColorStyles:()=>R,WxLayer:()=>X,WxTileSource:()=>F,WxTilesLogging:()=>we});var xe={comment1:["'degC': ['K', 1, 273.15] -> degC = K * 1 + 273.15",0],comment2:["'hPa': ['Pa', 1000]' -> hPa = Pa * 1000 + 0 (0 - could be ommited)",0],K:["K",1],kelvin:["K",1],F:["K",.5555555555,255.372222222],C:["K",1,273.15],degC:["K",1,273.15],"kg/m^2/s":["kg/m^2/s",1],"Kg/m^2/s":["kg/m^2/s",1],"Kg m**-2 s**-1":["kg/m^2/s",1],"Kg m^-2 s^-1":["kg/m^2/s",1],"Kg m^{-2} s^-1":["kg/m^2/s",1],"mm/h":["kg/m^2/s",.00027777777],"mm/hr":["kg/m^2/s",.00027777777],"W/m^2":["W/m^2",1],"W m^-2":["W/m^2",1],"W m^{-2}":["W/m^2",1],"W/m**2":["W/m^2",1],"W m**-2":["W/m^2",1],"m/s":["m/s",1],"m s**-1":["m/s",1],"m s^-1":["m/s",1],"m.s^{-1}":["m/s",1],knot:["m/s",.514444],knots:["m/s",.514444],"km/h":["m/s",.27777777777],"km h^-1":["m/s",.27777777777],"km h**-1":["m/s",.27777777777],mph:["m/s",.44704],"miles/h":["m/s",.44704],s:["s",1],sec:["s",1],h:["s",3600],min:["s",60],m:["m",1],cm:["m",.01],km:["m",1e3],mile:["m",1609.344],miles:["m",1609.344],inch:["m",.0254],Pa:["Pa",1],hPa:["Pa",100],degree:["degree",1],radian:["degree",57.3],"mg/m^3":["mg/m^3",1],"mg m^-3":["mg/m^3",1],"mg.m^-3":["mg/m^3",1],"%":["%",1],"(0 - 1)":["%",100]};var pe={none:["#00000000","#00000000"],divergingbluered:["#2166acff","#92c5deff","#f7f7f7ff","#f4a582ff","#b2182bff"],rainbow:["#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff"],rainbowzerro:["#ff000000","#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff"],rainbow2:["#ff0000ff","#ffff00ff","#00ff00ff","#00ffffff","#0000ffff","#ff00ffff","#ff0000ff"],bluebird:["#0000ffff","#ff00ffff","#00ffffff","#9000ffff","#9090ffff"],bluebirdzerro:["#0000ff00","#0000ffff","#ff00ffff","#00ffffff","#9000ffff","#9090ffff"],bw:["#000000ff","#ffffffff"],wb:["#ffffffff","#000000ff"],redish:["#ff00ffff","#ff0000ff","#ffff00ff"],greenish:["#ffff00ff","#00ff00ff","#00ffffff"],blueish:["#ff00ffff","#0000ffff","#00ffffff"],hspastel:["#AC6EA4FF","#8E92BDFF","#ACD4DEFF","#E9DC8EFF","#E7A97DFF","#E59074FF","#BE7E68FF","#A88F86FF"]};var Y={base:{parent:void 0,name:"base",fill:"gradient",isolineColor:"inverted",isolineText:!0,vectorType:"arrows",vectorColor:"inverted",vectorFactor:1,streamLineColor:"#777777",streamLineSpeedFactor:1,streamLineStatic:!1,showBelowMin:!0,showAboveMax:!0,colorScheme:"divergingbluered",colors:void 0,colorMap:void 0,levels:void 0,blurRadius:0,addDegrees:0,units:"",extraUnits:void 0,mask:"none"},custom:{parent:void 0,name:"custom",fill:"gradient",isolineColor:"inverted",isolineText:!0,vectorType:"arrows",vectorColor:"inverted",vectorFactor:1,streamLineColor:"#777",streamLineSpeedFactor:1,streamLineStatic:!1,showBelowMin:!0,showAboveMax:!0,colorScheme:"rainbow",colors:void 0,colorMap:void 0,levels:void 0,blurRadius:0,addDegrees:0,units:"",extraUnits:void 0,mask:"none"}};var ge,he,be;function ye({colorStyles:a={},units:e={},colorSchemes:t={}}={}){m("WxTile lib setup: start"),ge=Object.assign({},xe,e),he=Object.assign({},t,pe);let r=Object.assign({},a,Y);be=Ge(r),m("WxTile lib setup: styles unrolled");try{b(this,null,function*(){yield document.fonts.load("32px barbs"),yield document.fonts.load("32px arrows")})}catch(n){m("WxTile lib setup: fonts not loaded")}m("WxTile lib setup is done.")}function R(){return be}function q(){return he}function j(a,e,t){m("makeConverter: From=",a," To=",e);let r=f=>f;if(r.trivial=!0,a===e)return m("Trivial converter"),r;let n=Object.assign({},ge,t),s=n[a],o=n[e];if(!s||!o)return m("Inconvertible units. Trivial converter"),r;let[i,u,l]=s,[c,d,p]=o;if(i!==c||!u||!d)return m("Inconvertible units. Trivial converter"),r;let h=u/d,x=((l||0)-(p||0))/d;return x?f=>h*f+x:f=>h*f}function Ge(a){let e=Object.assign({},Y);for(let s in a){let o=a[s];if(Array.isArray(o))for(let i=0;i<o.length;++i)e[s+"["+i+"]"]=Object.assign({},o[i]);else e[s]=Object.assign({},o)}let t=Object.assign({},Y.base),r=(s,o)=>{if(o==="base")return t;let i=s[o];if(!i)return t;(!i.parent||!(i.parent in s))&&(i.parent="base");let u=r(s,i.parent);return Object.assign(i,Object.assign({},u,i,{parent:"base"}))},n={base:t};for(let s in e)n[s]=r(e,s);return n}function E(a){let e=new Map;return(t,...r)=>{let n=e.get(t);if(n)return n;let s=a(t,...r);return e.set(t,s),s.catch(o=>{o.name==="AbortError"&&e.delete(t)}),s}}function ze(a,e){return b(this,null,function*(){return createImageBitmap(yield(yield fetch(a,e)).blob())})}function _(a,e,t=!0){let r=Object.assign(document.createElement("canvas"),{width:a,height:e,imageSmoothingEnabled:!1}).getContext("2d",{willReadFrequently:t});if(!r)throw new Error("Cannot get canvas context");return r}function Ke(a){let{width:e,height:t}=a,r=_(e,t);return r.drawImage(a,0,0),r.getImageData(0,0,e,t)}function te(a,e){return b(this,null,function*(){return Ke(yield ze(a,e))})}function He(a){a.data[34]<1&&m("Warning: image is in too old format. Check the version of the Splitter.");let e=new Uint16Array(a.data.buffer),t=new Uint16Array(e.length/2);for(let l=0;l<t.length;l++)t[l]=e[l*2];let r=new Uint8Array(8);for(let l=0;l<8;++l)r[l]=a.data[l*4+2];let n=new DataView(r.buffer),s=n.getFloat32(0,!0),o=n.getFloat32(4,!0),i=(o-s)/65535,u=Je(t);return{raw:t,dmin:s,dmax:o,dmul:i,integral:u,radius:0}}function re(a,e){return b(this,null,function*(){return He(yield te(a,e))})}function Je(a){let e=new Uint32Array(66564),t=new Uint32Array(258*258);e[0]=a[0],t[0]=a[0]===0?0:1;for(let r=1;r<258;++r)e[r]=a[r]+e[r-1],e[258*r]=a[258*r]+e[258*r-258],t[r]=(a[r]===0?0:1)+t[r-1],t[258*r]=(a[258*r]===0?0:1)+t[258*r-258];for(let r=1,n=259;r<258;++r,++n)for(let s=1;s<258;++s,++n)e[n]=a[n]+e[n-258]+e[n-1]-e[n-258-1],t[n]=(a[n]===0?0:1)+t[n-258]+t[n-1]-t[n-258-1];return{integral:e,integralNZ:t}}function We(a,e){if(e<0||e===a.radius)return a;a.radius=e;let t=258,{integral:r,integralNZ:n}=a.integral;for(let s=1;s<t;s++)for(let o=1;o<t;o++){if(!a.raw[t*s+o])continue;let i=Math.min(e,o-1,t-1-o),u=Math.min(e,s-1,t-1-s),l=t*(s-u-1)+o,c=t*(s+u)+o,d;if(n){let W=n[l-i-1],S=n[l+i],y=n[c-i-1],D=n[c+i];d=W+D-S-y}else d=(2*i+1)*(2*u+1);let p=r[l-i-1],h=r[l+i],x=r[c-i-1],f=r[c+i],g=p+f-h-x;a.raw[s*t+o]=g/d}return a}function M(a){let e=a>>0&255,t=a>>8&255,r=a>>16&255,n=e.toString(16),s=t.toString(16),o=r.toString(16);return n=n.length===2?n:"0"+n,s=s.length===2?s:"0"+s,o=o.length===2?o:"0"+o,"#"+n+s+o}function I(a){if(a[0]==="#"){if(a.length===4)return+("0xff"+a[3]+a[3]+a[2]+a[2]+a[1]+a[1]);if(a.length===7)return+("0xff"+a[5]+a[6]+a[3]+a[4]+a[1]+a[2]);if(a.length===9)return+("0x"+a[7]+a[8]+a[5]+a[6]+a[3]+a[4]+a[1]+a[2])}return m("wrong color format",a),0}function A(a,e){return b(this,null,function*(){let t=yield fetch(a,e);if(!t.ok)throw new Error("error:"+a+" - "+t.statusText);return t.json()})}function ae(a,e,t){let r=a>>0&255,n=a>>8&255,s=a>>16&255,o=a>>>24,i=e>>0&255,u=e>>8&255,l=e>>16&255,c=e>>>24,d=r+t*(i-r),p=n+t*(u-n),h=s+t*(l-s),x=o+t*(c-o);return d|p<<8|h<<16|x<<24}function Se(a,e,t){let r=[];for(let n=0;n<t;++n)r.push(n*(e-a)/(t-1)+a);return r}var ee=!1,m=(...a)=>{};function we(a){ee=!!a,console.log("WXLOGing",ee),m=typeof a=="function"?a:ee?console.log:()=>{}}function ne(a){return a[0]==="#"&&a.length===4?"#"+a[1]+a[1]+a[2]+a[2]+a[3]+a[3]:a}function G(a,{x:e,y:t,z:r}){return a.replace("{x}",`${e}`).replace("{y}",`${t}`).replace("{z}",`${r}`)}function z({x:a,y:e,z:t}){return`${t}-${a}-${e}`}var Qe="A".charCodeAt(0);var U=class{constructor(){this.qtree={nodes:null};this.qtreedepth=0;m("QTree.constructor")}load(e,t){return b(this,null,function*(){try{let r=yield A(e,t);this.qtree=De(r,{pos:0})}catch(r){throw new Error(`Failed to load QTree: ${r.message}`)}this.qtreedepth=Te(this.qtree),m(`QTree.load: qtreedepth=${this.qtreedepth}`)})}check(e){let t=e.z-this.qtreedepth,r=t>=0,n=r?{x:e.x>>t,y:e.y>>t,z:this.qtreedepth}:L({},e);return Me(this.qtree,n,r)}};function De(a,e){let t=a.charCodeAt(e.pos)-Qe;e.pos++;let r=[1,2,4,8].map(n=>t&n?De(a,e):null);return{nodes:r.some(n=>n)?r:null}}function Te(a){return a!=null&&a.nodes?1+Math.max(...a.nodes.map(Te)):0}function Me(a,e,t){return a===null?"land":t&&!e.z?"mixed":a.nodes===null?"sea":e.z?(e.z--,Me(a.nodes[(e.y>>e.z&1)<<1|e.x>>e.z&1],e,t)):"mixed"}function et(a,e,t){return a>t?t:a<e?e:a}var $=class{constructor(e,t,[r,n],s){m("RawCLUT.constructor");let o=n-r;this.levelIndex=new Uint32Array(65536),this.colorsI=new Uint32Array(65536);let i=[];this.DataToStyle=j(t,e.units,e.extraUnits),this.DataToStyle.trivial&&(e.units=t),s&&(this.DataToKnots=j(t,"knot"));let u=j(e.units,t,e.extraUnits),l=f=>~~(65535*et((u(f)-r)/(n-r),0,1));if(Array.isArray(e.colorMap)){e.colorMap.sort((f,g)=>f[0]<g[0]?-1:f[0]>g[0]?1:0);for(let[f]of e.colorMap)i.push(l(f))}else{if(e.levels||(e.levels=Se(this.DataToStyle(r),this.DataToStyle(n),10)),e.levels.sort((f,g)=>f<g?-1:f>g?1:0),!e.colors){let f=q();e.colorScheme&&e.colorScheme in f?e.colors=f[e.colorScheme]:e.colors=f.wb}for(let f of e.levels)i.push(l(f))}let c=65536,d=se(c,e);this.ticks=d.ticks;let p=d.ticks[0].data,x=d.ticks[d.ticks.length-1].data-p;for(let f=0;f<65536;++f){let g=o*f/65535+r,W=this.DataToStyle(g),S=Math.round((c-1)*(W-p)/x);S<=0?this.colorsI[f]=e.showBelowMin?d.colors[0]:0:S>=c?this.colorsI[f]=e.showAboveMax?d.colors[c-1]:0:this.colorsI[f]=d.colors[S]}this.colorsI[0]=0;for(let f=0;f<i[0];++f)this.levelIndex[f]=0;for(let f=0;f<i.length-1;f++)for(let g=i[f];g<i[f+1]+1;++g)this.levelIndex[g]=f;for(let f=i[i.length-1];f<65536;++f)this.levelIndex[f]=i.length-1}};function Ce(a){var t;if(a!==0&&-.1<a&&a<.1)return a.toExponential(2);let e=a.toString();return((t=e.split(".")[1])==null?void 0:t.length)>2?a.toFixed(2):e}function se(a,e){let t={size:a,showBelowMin:e.showBelowMin,showAboveMax:e.showAboveMax,units:e.units,colors:new Uint32Array(a),ticks:[]},{colorMap:r,levels:n,colors:s}=e,o=e.fill!=="solid";if(r){let p=r[0][0],h=r[r.length-1][0]-p;for(let[x,f]of r){let g=~~((x-p)/h*(a-1)),W={data:x,dataString:Ce(x),color:f,pos:g};t.ticks.push(W)}for(let x=0;x<r.length-1;x++){let f=t.ticks[x].pos,g=t.ticks[x+1].pos,W=I(r[x][1]),S=o?I(r[x+1][1]):0;for(let y=f;y<g;++y)t.colors[y]=o?ae(W,S,(y-f)/(g-f)):W}return t.colors[a-1]=I(r[r.length-1][1]),t}if(!s||!n)return t;let i=0,u=0,l=-1;for(let p=0;p<a;++p){let h=p*(s.length-1)/a;l!==~~h&&(l=~~h,i=I(s[l]),u=s.length>l+1?I(s[l+1]):i),t.colors[p]=o?ae(i,u,h-l):i}t.colors[a-1]=I(s[s.length-1]);let c=n[0],d=(a-1)/(n[n.length-1]-c);for(let p of n){let h=~~((p-c)*d),x={data:p,dataString:Ce(p),color:M(t.colors[h]),pos:h};t.ticks.push(x)}return t}var tt=2*Math.PI*6378137/256,K=2*Math.PI*6378137/2;function rt(a,e){let t=a/K*180,r=e/K*180;return r=180/Math.PI*(2*Math.atan(Math.exp(r*Math.PI/180))-Math.PI/2),[r,t]}function at(a,e,t){let r=nt(t),n=a*r-K,s=e*r-K;return[n,s]}function nt(a){return tt/Math.pow(2,a)}function oe(a,e,t){let[r,n]=rt(...at(a,e,t));return[n,-r]}function Le(a,e){return[a*256,e*256]}function ie(a,e,t){let r=((e-a)%360+540)%360-180;return(a+r*t+360)%360}function st(a,e,t,r,n,s,o,i){switch((a?1:0)|(e?2:0)|(t?4:0)|(r?8:0)){case 0:return 0;case 1:return a;case 2:return e;case 3:t=a,r=e;break;case 4:return t;case 5:e=a,r=t;break;case 6:r=e+t>>1,a=r;break;case 7:r=e+t>>1;break;case 8:return r;case 9:e=a+r>>1,t=e;break;case 10:a=e,t=r;break;case 11:t=a+r>>1;break;case 12:a=t,e=r;break;case 13:e=a+r>>1;break;case 14:a=e+t>>1;break}a=o+i*a,e=o+i*e,t=o+i*t,r=o+i*r;let l=ie(a,e,n),c=ie(t,r,n);return(ie(l,c,s)-o)/i||1}function ot(a,e,t,r,n,s,o,i){switch((a?1:0)|(e?2:0)|(t?4:0)|(r?8:0)){case 7:return n+s<1?n*(e-a)+s*(t-a)+a:0;case 14:return n+s<1?0:n*(r-t)+s*(r-e)+e+t-r;case 11:return s<n?(1-n)*(a-e)+s*(r-e)+e:0;case 13:return s<n?0:(1-n)*(t-r)+s*(t-a)+a+r-t;case 15:return n+s<1?n*(e-a)+s*(t-a)+a:n*(r-t)+s*(r-e)+e+t-r;default:return 0}}function ve(a,e,t){let r=1/Math.pow(2,t.z),n=t.x*256*r-.5,s=t.y*256*r-.5,{raw:o,dmin:i,dmax:u,dmul:l}=e,c={raw:new Uint16Array(258*258),dmin:i,dmax:u,dmul:l},{raw:d}=c;for(let p=-1,h=0,x=s-r+1;p<=256;p++,x+=r){let f=Math.floor(x),g=x-f,W=f*258;for(let S=-1,y=n-r+1;S<=256;S++,h++,y+=r){let D=Math.floor(y),T=y-D,w=D+W,C=o[w],v=o[w+1],P=o[w+258],k=o[w+258+1];d[h]=a(C,v,P,k,T,g,i,l)}}return c}function Ie(a,e,t){if(!e)return a;let r=c=>c<0?0:c>254?254:c,n=1/Math.pow(2,e.z),s=e.x*256*n-.5,o=e.y*256*n-.5,{data:i}=a,u=new ImageData(256,256),{data:l}=u;for(let c=0,d=t,p=o;c<256;c++,p+=n){let h=~~r(p),x=p-h,f=h*256;for(let g=0,W=s;g<256;g++,d+=4,W+=n){let S=~~r(W),y=W-S,D=(S+f)*4+t,T=i[D],w=i[D+4],C=i[D+4*256],v=i[D+4*256+4],P=y+x<1?y*(w-T)+x*(C-T)+T:y*(v-C)+x*(v-w)+w+C-v;l[d]=P>127?255:0}}return u}function Pe(a,e){return e?ve(ot,a,e):a}function ke(a,e){return e?ve(st,a,e):a}function Ae(a,{data:e},t,r){let n=r==="sea",{raw:s}=a;for(let o=t,i=259,u=0;u<256;i+=2,u++)for(let l=0;l<256;l++,i++,o+=4)n===!e[o]&&(s[i]=0);return a}function Re(a){let[e,t]=Le(a.x,a.y),[r,n]=oe(e,t,a.z),[s,o]=oe(e+256,t+256,a.z);return{west:r,north:n,east:s,south:o}}function le(a,e){let t=a.z-e;if(t<=0)return{upCoords:a};let r={x:a.x>>>t,y:a.y>>>t,z:e},n={x:a.x&(1<<t)-1,y:a.y&(1<<t)-1,z:t};return{upCoords:r,subCoords:n}}var B=class{constructor(e){this.loadDataFunc=E(re);this.layer=e}load(e,t){return b(this,null,function*(){let r=yield this.cacheLoad(e,this.layer.tilesURIs,t);if(!r)return null;let{rawdata:n,subCoords:s,tileType:o}=r,{units:i}=this.layer.currentMeta,u=i==="degree"?ke:Pe,l=d=>u(We(d,this.layer.style.blurRadius),s),c=n.map(l);return this._vectorMagnitudesPrepare(c),yield this._applyMask(c,e,o,!s&&n.length===1),{data:c,slines:this._createStreamLines(c)}})}cacheLoad(e,t,r){return b(this,null,function*(){if(!this._checkInsideBoundaries(e))return null;let n=this._checkTypeAndMask(e);if(!n)return null;let{upCoords:s,subCoords:o}=le(e,this.layer.wxdatasetManager.getMaxZoom()),i=t.map(c=>G(c,s)),u=Object.assign({},this.layer.wxdatasetManager.wxapi.requestInit,{signal:r==null?void 0:r.signal});return{rawdata:yield Promise.all(i.map(c=>this.loadDataFunc(c,u))),subCoords:o,tileType:n}})}clearCache(){this.loadDataFunc=E(re)}_applyMask(e,t,r,n){return b(this,null,function*(){let{style:s}=this.layer;if((s.mask==="land"||s.mask==="sea")&&r==="mixed"){if(n){let{raw:i,dmin:u,dmax:l,dmul:c}=e[0];e[0]={raw:new Uint16Array(i),dmin:u,dmax:l,dmul:c}}let o;try{let{upCoords:i,subCoords:u}=le(t,this.layer.wxdatasetManager.wxapi.maskDepth);o=yield this.layer.wxdatasetManager.wxapi.loadMaskFunc(i),o=Ie(o,u,this.layer.wxdatasetManager.wxapi.maskChannel)}catch(i){s.mask=void 0,m("Can't load Mask. Masking is disabled");return}Ae(e[0],o,this.layer.wxdatasetManager.wxapi.maskChannel,s.mask)}})}_vectorMagnitudesPrepare(e){if(e.length===1)return;e.unshift({raw:new Uint16Array(258*258),dmin:0,dmax:0,dmul:0});let[t,r,n]=e;t.dmax=1.42*Math.max(-r.dmin,r.dmax,-n.dmin,n.dmax),t.dmul=(t.dmax-t.dmin)/65535;for(let s=0;s<258*258;++s){if(!r.raw[s]||!n.raw[s])continue;let o=r.dmin+r.dmul*r.raw[s],i=n.dmin+n.dmul*n.raw[s];t.raw[s]=Math.sqrt(i*i+o*o)/t.dmul}}_checkTypeAndMask(e){let{mask:t}=this.layer.style;var r="mixed";if(!((t==="land"||t==="sea")&&(r=this.layer.wxdatasetManager.wxapi.qtree.check(e),t===r)))return r}_checkInsideBoundaries(e){let t=this.layer.wxdatasetManager.getBoundaries();if(t!=null&&t.boundaries180){let r=Re(e),n=s=>!(r.west>s.east||s.west>r.east||r.south>s.north||s.south>r.north);if(!t.boundaries180.some(n))return!1}return!0}_createStreamLines(e){if(e.length!==3)return[];let{style:t}=this.layer;if(t.streamLineColor==="none")return[];let r=[],[n,s,o]=e,i=(t.streamLineSpeedFactor||1)/n.dmax,u=t.addDegrees?.017453292519943*t.addDegrees:0,l=t.streamLineGridStep||64,c=t.streamLineSteps||300;for(let d=0;d<=256;d+=l)for(let p=0;p<=256;p+=l){if(!n.raw[1+p+(1+d)*258])continue;let h=[],x=p,f=d,g=-1,W=0,S=0;for(let T=0;T<=c&&x>=0&&x<=256&&f>=0&&f<=256;T++){T%(c/10)||h.push({x:~~x,y:~~f});let w=~~x+1+(~~f+1)*258;if(w!==g){if(!n.raw[w])break;g=w;let C=n.dmin+n.raw[w]*n.dmul,v=s.dmin+s.raw[w]*s.dmul,P=o.dmin+o.raw[w]*o.dmul,k=Math.atan2(v,P)+u;W=i*C*Math.sin(k),S=i*C*Math.cos(k)}x+=W,f-=S}let y=p,D=d;g=-1;for(let T=1;T<=c&&y>=0&&y<=256&&D>=0&&D<=256;T++){T%(c/10)||h.unshift({x:~~y,y:~~D});let w=~~y+1+(~~D+1)*258;if(w!==g){if(!n.raw[w])break;g=w;let C=n.dmin+n.raw[w]*n.dmul,v=s.dmin+s.raw[w]*s.dmul,P=o.dmin+o.raw[w]*o.dmul,k=Math.atan2(v,P)+u;W=i*C*Math.sin(k),S=i*C*Math.cos(k)}y-=W,D+=S}h.length>2&&r.push(h)}return r}};var V=class{constructor(e){this.layer=e}paint({data:e,ctxFill:t,ctxText:r,ctxStreamLines:n}){let{layer:s}=this,{units:o}=s.currentMeta,i=new ImageData(256,256),u=new Uint32Array(i.data.buffer);t.clearRect(0,0,256,256),r.clearRect(0,0,256,256),n.clearRect(0,0,256,256),it(e.data[0],u,s);let l=lt(u,e.data[0],s);t.putImageData(i,0,0),ct(l,r,s),mt(e.data,r,s),ut(e.data[0],r,o,s),ft(e,r,s)}getPaintedCanvas(e,t,r){return t?(this.imprintVectorAnimationLinesStep(e,r),e.ctxStreamLines.canvas):e.ctxFill.canvas}imprintVectorAnimationLinesStep({data:e,ctxFill:t,ctxStreamLines:r},n){let{layer:s}=this;r.clearRect(0,0,256,256),r.drawImage(t.canvas,0,0),!(e.slines.length===0||s.style.streamLineStatic||s.style.streamLineColor==="none")&&dt(e,r,s,n)}};function it(a,e,{CLUT:t,style:r}){let{raw:n}=a,{colorsI:s}=t;if(r.fill!=="none")for(let o=0,i=0,u=259;o<256;++o,u+=2)for(let l=0;l<256;++l,++i,++u)e[i]=s[n[u]];else e.fill(0)}function lt(a,e,{CLUT:t,style:r}){let{raw:n}=e,{levelIndex:s,colorsI:o}=t,i=[];if(r.isolineColor!=="none"){let u=r.isolineColor[0]==="#"?I(r.isolineColor):0;for(let l=0,c=0;l<256;l+=1)for(let d=0;d<256;d+=1){let p=(l+1)*258+(d+1),h=n[p],x=n[p+1],f=n[p+258];if(!h||!x||!f)continue;let g=s[h],W=s[x],S=s[f];if(g!==W||g!==S){let y=Math.max(g,W,S),D=Math.max(h,x,f),T=l*256+d;switch(r.isolineColor){case"inverted":a[T]=~o[D]|4278190080;break;case"fill":a[T]=o[D]|4278190080;break;default:a[T]=u;break}r.isolineText&&!(++c%255)&&d>20&&d<235&&l>20&&l<235&&i.push({x:d,y:l,d:h,dr:x,db:f,mli:y})}}}return i}function ct(a,e,{CLUT:t}){if(a.length){e.font="1.1em Sans-serif",e.lineWidth=2,e.strokeStyle="white",e.fillStyle="black",e.textAlign="center",e.textBaseline="middle";for(let{x:r,y:n,d:s,dr:o,db:i,mli:u}of a){let l=t.ticks[u].dataString,c=Math.atan2(s-o,i-s);e.save(),e.translate(r,n),e.rotate(c<-1.57||c>1.57?c+3.14:c),e.strokeText(l,0,0),e.fillText(l,0,0),e.restore()}}}function mt(a,e,{CLUT:t,style:r}){if(!t.DataToKnots||r.vectorColor==="none"||r.vectorType==="none")return;if(a.length!==3)throw new Error("data.length !== 3");let[n,s,o]=a;switch(r.vectorType){case"barbs":e.font="40px barbs";break;case"arrows":e.font="50px arrows";break;default:e.font=r.vectorType}e.textAlign="center",e.textBaseline="middle",e.fillStyle=r.vectorColor;let i=r.addDegrees?.017453292519943*r.addDegrees:0,u=32;for(let l=u/2;l<256;l+=u)for(let c=u/2;c<256;c+=u){let d=c+1+(l+1)*258;if(!n.raw[d])continue;let p=Math.atan2(s.dmin+s.raw[d]*s.dmul,o.dmin+o.raw[d]*o.dmul),h=n.dmin+n.raw[d]*n.dmul,x=r.vectorType!=="barbs"?r.vectorFactor*.2:.2,f=Math.min(t.DataToKnots(h)*x,25)+65,g=String.fromCharCode(f);switch(r.vectorColor){case"inverted":e.fillStyle=M(~t.colorsI[n.raw[d]]);break;case"fill":e.fillStyle=M(t.colorsI[n.raw[d]]);break}e.save(),e.translate(c,l),e.rotate(p+i),e.fillText(g,0,0),e.restore()}}function ut(a,e,t,{CLUT:r,style:n}){if(t!=="degree")return;let s=.017453292519943*n.addDegrees;e.font="50px arrows",e.textAlign="center",e.textBaseline="middle",e.fillStyle=n.vectorColor;let o="L",i=32;for(let u=i/2;u<256;u+=i)for(let l=i/2;l<256;l+=i){let c=l+1+(u+1)*258;if(!a.raw[c])continue;let p=(a.dmin+a.raw[c]*a.dmul+180)*.01745329251;switch(n.vectorColor){case"inverted":e.fillStyle=M(~r.colorsI[a.raw[c]]);break;case"fill":e.fillStyle=M(r.colorsI[a.raw[c]]);break}e.save(),e.translate(l,u),e.rotate(p+s),e.fillText(o,0,0),e.restore()}}function ft(a,e,{CLUT:t,style:r}){let{data:n,slines:s}=a;if(!s.length||!r.streamLineStatic||r.streamLineColor==="none")return;let o=n[0];e.lineWidth=1,r.streamLineColor[0]==="#"&&(e.strokeStyle=ne(r.streamLineColor));for(let i=s.length;i--;){let u=s[i];for(let l=0;l<u.length-1;++l){let c=u[l],d=u[l+1],p=c.x+1+(c.y+1)*258;switch(r.streamLineColor){case"inverted":e.strokeStyle=M(~t.colorsI[o.raw[p]]);break;case"fill":e.strokeStyle=M(t.colorsI[o.raw[p]]);break}e.beginPath(),e.moveTo(c.x,c.y),e.lineTo(d.x,d.y),e.stroke()}}}function dt(a,e,{CLUT:t,style:r},n){let{data:s,slines:o}=a,i=s[0],u=r.streamLineColor[0]==="#"?ne(r.streamLineColor).substring(0,7):"#000000";n=n>>5;for(let l=0;l<o.length;++l){let c=o[l],d=c.length-1,p=(n+(1+c[0].x)*(1+c[0].y))%30;for(let h=0;h<d;++h){let x=c[h],f=c[h+1],g=1-(p-h)/d;(g<0||g>1)&&(g=0);let W=(~~(g*255)).toString(16).padStart(2,"0"),S=1+~~((1.2-g)*5);e.lineWidth=S;let y=x.x+1+(x.y+1)*258;switch(r.streamLineColor){case"inverted":u=M(~t.colorsI[i.raw[y]]);break;case"fill":u=M(t.colorsI[i.raw[y]]);break}e.strokeStyle=u+W,e.beginPath(),e.moveTo(x.x,x.y),e.lineTo(f.x,f.y),e.stroke()}}}var X=class{constructor(e){this.tilesCache=new Map;this.painter=new V(this);this.loader=new B(this);var s;if(m(`WxLayer.constructor:
2
+ datasetName: ${e.wxdatasetManager.datasetName},
3
+ variables: ${e.variables.join(", ")},
4
+ wxstyleName: ${e.wxstyleName},
5
+ wxstyle: ${JSON.stringify(e.wxstyle)},
6
+ time: ${e.time}`),!((s=e.variables)!=null&&s.length)||e.variables.length>2)throw new Error(`datasetName: ${e.wxdatasetManager.datasetName}: only 1 or 2 variables are supported but ${e.variables} was given`);e.variables.forEach(o=>{if(!e.wxdatasetManager.checkVariableValid(o))throw new Error(`datasetName: ${e.wxdatasetManager.datasetName}: variable ${o} is not valid`)}),this.variables=e.variables,this.wxdatasetManager=e.wxdatasetManager,this.ext=e.ext||"png",this.currentMeta=this._getCurrentMeta(),[this.tilesURIs,this.time]=this._createURLsAndTime(e.time);let t=R(),r=t.base,n=e.wxstyleName&&t[e.wxstyleName];[this.style,this.CLUT]=this._createStyleAndCLUT(L(L(L({},r),n),e.wxstyle))}get nonanimatable(){return m("WxLayer.nonanimatabl()"),this.variables.length<2||this.style.streamLineStatic||this.style.streamLineColor==="none"}getTime(){return m("WxLayer.getTime"),this.time}clearCache(){m("WxLayer.clearCache"),this.tilesCache.clear(),this.loader.clearCache()}getCurrentStyleObjectCopy(){return m("WxLayer.getCurrentStyleObjectCopy"),Object.assign({},this.style)}updateCurrentStyleObject(e){m(`WxLayer.updateCurrentStyleObject ${JSON.stringify(e)}`),[this.style,this.CLUT]=this._createStyleAndCLUT(e)}getTileData(e,t){let r=this.tilesCache.get(z(e));if(!r)return;let n=this._getPixelInfo(t,r.data.data);if(!n)return;let{raw:s,data:o}=n,i=s.map(c=>this.CLUT.colorsI[c]),u=i.map(M),l=o.map(c=>this.CLUT.DataToStyle(c));return{data:o,raw:s,rgba:i,hexColor:u,inStyleUnits:l,tilePoint:t,styleUnits:this.style.units,dataUnits:this.currentMeta.units}}setURLsAndTime(e){m(`WxLayer.setURLsAndTime time=${e}`),[this.tilesURIs,this.time]=this._createURLsAndTime(e)}loadTile(e,t){return b(this,null,function*(){return this._loadCacheDrawTile(e,this.tilesCache,t)})}preloadTime(e,t,r){return b(this,null,function*(){m(`WxLayer.preloadTime time=${e}`);let[n]=this._createURLsAndTime(e);yield Promise.allSettled(t.map(s=>this.loader.cacheLoad(s,n,r)))})}reloadTiles(e,t){return b(this,null,function*(){var n;m("WxLayer.reloadTiles");let r=new Map;yield Promise.allSettled(e.map(s=>this._loadCacheDrawTile(s,r,t))),(n=t==null?void 0:t.signal)!=null&&n.aborted||(this.tilesCache=r)})}_loadCacheDrawTile(e,t,r){return b(this,null,function*(){let n=t.get(z(e));if(n)return n;let s=yield this.loader.load(e,r);if(!s)return null;let o=_(256,256),i=o,u=this.variables.length===2?_(256,256):o,l={ctxFill:o,ctxText:i,ctxStreamLines:u,data:s};return this.painter.paint(l),t.set(z(e),l),l})}_createStyleAndCLUT(e){let t=Object.assign(this.getCurrentStyleObjectCopy(),e),r=this._prepareCLUT(t);return[t,r]}_getCurrentMeta(){let e=this.variables.map(o=>{let i=this.wxdatasetManager.getVariableMeta(o);if(!i)throw new Error(`WxLayer ${this.wxdatasetManager.datasetName}: variable ${o} is not valid`);return i}),{min:t,max:r,units:n,vector:s}=e[0];return this.variables.length>1&&(t=0,r=1.42*Math.max(-e[0].min,e[0].max,-e[1].min,e[1].max)),{min:t,max:r,units:n,vector:s}}_getPixelInfo({x:e,y:t},r){var s,o;m(`WxLayer._getPixelInfo x=${e} y=${t}`);let n=(t+1)*258+(e+1);if(!!((o=(s=r==null?void 0:r[0])==null?void 0:s.raw)!=null&&o[n]))return{raw:r.map(i=>i.raw[n]),data:r.map(i=>i.raw[n]*i.dmul+i.dmin)}}_prepareCLUT(e){let{min:t,max:r,units:n}=this.currentMeta;return new $(e,n,[t,r],this.variables.length===2)}_createURLsAndTime(e){let t=this.wxdatasetManager.getValidTime(e);return[this.variables.map(n=>this.wxdatasetManager.createURI(n,t,this.ext)),t]}};var $e=qe(Ue()),O=class extends $e.default.GridLayer{constructor(t){super(t);this.id=t.id}};var H=class extends O{constructor(t,r){m(`WxLayerBaseImplementation.constructor (${r.id})`);super(r);this.animation=!1;this.animationSeed=0;this.layer=new X(t),this.oldMaxZoom=this.layer.wxdatasetManager.meta.maxZoom}get wxdatasetManager(){return m(`WxLayerBaseImplementation.wxdatasetManager (${this.id})`),this.layer.wxdatasetManager}getMetadata(){return m(`WxLayerBaseImplementation.getMetadata (${this.id})`),L({},this.layer.currentMeta)}getVariables(){return m(`WxLayerBaseImplementation.getVariables (${this.id})`),[...this.layer.variables]}clearCache(){m(`WxLayerBaseImplementation.clearCache (${this.id})`),this.layer.clearCache()}getCurrentStyleObjectCopy(){return m(`WxLayerBaseImplementation.getCurrentStyleObjectCopy (${this.id})`),this.layer.getCurrentStyleObjectCopy()}getTime(){return m(`WxLayerBaseImplementation.getTime (${this.id})`),this.layer.getTime()}setTime(t,r){return b(this,null,function*(){var s;m(`WxLayerBaseImplementation.setTime (${this.id}) time=${t}`);let n=this.getTime();return this.layer.setURLsAndTime(t),yield this._reloadVisible(r),(s=r==null?void 0:r.signal)!=null&&s.aborted&&this.layer.setURLsAndTime(n),this.getTime()})}preloadTime(t,r){return b(this,null,function*(){return m(`WxLayerBaseImplementation.preloadTime (${this.id}) time=${t}`),this.layer.preloadTime(t,this.coveringTiles(),r)})}startAnimation(){if(this.animation){m(`WxLayerBaseImplementation.startAnimation (${this.id}) already started`);return}if(this.layer.nonanimatable){m(`WxLayerBaseImplementation.startAnimation (${this.id}) nonanimatable`);return}m(`WxLayerBaseImplementation.startAnimation (${this.id})`),this.animation=!0;let t=r=>b(this,null,function*(){if(m(`WxLayerBaseImplementation.startAnimation (${this.id}) animationStep`),!this.animation||this.layer.nonanimatable){this.animation=!1;return}this.animationSeed=r,yield this._redrawTiles(),requestAnimationFrame(t)});requestAnimationFrame(t)}stopAnimation(){return b(this,null,function*(){return m(`WxLayerBaseImplementation.stopAnimation (${this.id})`),this.animation=!1,this._redrawTiles()})}setCoarseLevel(t=2){return b(this,null,function*(){m(`WxLayerBaseImplementation.setCoarseLevel (${this.id}) level=${t}`);let r=Math.max(this.oldMaxZoom-t,0);if(this.layer.wxdatasetManager.meta.maxZoom!==r)return this.layer.wxdatasetManager.meta.maxZoom=r,this._reloadVisible()})}unsetCoarseLevel(){return b(this,null,function*(){if(m(`WxLayerBaseImplementation.unsetCoarseLevel (${this.id})`),this.layer.wxdatasetManager.meta.maxZoom!==this.oldMaxZoom)return this.layer.wxdatasetManager.meta.maxZoom=this.oldMaxZoom,this._reloadVisible()})}setStyleByName(t,r=!0){return b(this,null,function*(){return m(`WxLayerBaseImplementation.setStyleByName (${this.id}) wxstyleName=${t} reload=${r}`),this.updateCurrentStyleObject(R()[t],r)})}updateCurrentStyleObject(t,r=!0,n){return b(this,null,function*(){if(m(`WxLayerBaseImplementation.updateCurrentStyleObject (${this.id}) style=${t} reload=${r}`),this.layer.updateCurrentStyleObject(t),this.startAnimation(),r)return this._reloadVisible(n)})}_redrawTiles(){return this.redrawRequested?this.redrawRequested:(this.redrawRequested=new Promise(t=>{requestAnimationFrame(()=>{m(`WxTileSource _redrawTiles (${this.id})`),this.update(),t(),this.redrawRequested=void 0})}),this.redrawRequested)}_reloadVisible(t){return b(this,null,function*(){})}coveringTiles(){return[]}update(){}};var J=class{constructor(e,t,r){this.coords=e;this.ctx=t;this.raster_data=r;this.draw(r==null?void 0:r.ctxFill.canvas)}draw(e){this.ctx.clearRect(0,0,256,256),e&&this.ctx.drawImage(e,0,0)}},F=class extends H{constructor(e,t){super(e,t),m("WxTileSource constructor: ",e)}getLayerInfoAtLatLon(e,t){if(m(`WxTileSource getLayerInfoAtLatLon (${this.layer.wxdatasetManager.datasetName})`,e),!this._map)return;let r=this._map.getZoom(),n=this._map.project(e,r),s=n.divideBy(256).floor(),o=n.subtract(s.multiplyBy(256)).floor();return this.layer.getTileData({x:s.x,y:s.y,z:r},o)}_reloadVisible(e){return b(this,null,function*(){var t;if(m(`WxTileSource _reloadVisible (${this.layer.wxdatasetManager.datasetName})`),yield this.layer.reloadTiles(this.coveringTiles(),e),(t=e==null?void 0:e.signal)!=null&&t.aborted){m(`WxTileSource _reloadVisible (${this.layer.wxdatasetManager.datasetName}) aborted`);return}return yield Promise.allSettled(this._ForEachWxTile(r=>b(this,null,function*(){r.raster_data=yield this.layer.loadTile(r.coords)}),"_reloadVisible")),this._redrawTiles()})}coveringTiles(){var t;m(`WxTileSource coveringTiles (${this.layer.wxdatasetManager.datasetName})`);let e=[];for(let r in this._tiles){let n=(t=this._tiles[r].el)==null?void 0:t.wxtile;n&&e.push(n.coords)}return e}update(){this._ForEachWxTile(e=>{e.draw(e.raster_data&&this.layer.painter.getPaintedCanvas(e.raster_data,this.animation,this.animationSeed))},"_redrawTiles")}_ForEachWxTile(e,t){var n;m(`WxTileSource _ForEachWxTile (${this.layer.wxdatasetManager.datasetName}) func=${t}`);let r=[];for(let s in this._tiles){let o=(n=this._tiles[s].el)==null?void 0:n.wxtile;o&&r.push(e(o))}return r}createTile(e,t){let r=_(256,256),n=r.canvas;return this.layer.loadTile(e).then(s=>{n.wxtile=new J(e,r,s)}).catch(()=>{n.wxtile=new J(e,r,null)}).finally(t),n}onRemove(e){return super.onRemove(e),m(`WxTileSource onRemove (${this.layer.wxdatasetManager.datasetName})`),this.animation=!1,this}};var N=class{constructor({datasetName:e,instance:t,instanced:r,meta:n,wxapi:s}){if(!s.datasetsMetas.allDatasetsList.includes(e))throw new Error(`Dataset ${e} not found`);this.datasetName=e,this.instanced=r,this.instance=t,this.meta=n,this.wxapi=s,m(`WxDataSetManager.constructor: ${this.datasetName}`)}getValidTime(e=Date()){m(`WxDataSetManager.getValidTime: ${this.datasetName}, ${e}`);let t=this.getTimes();if(typeof e=="number"){if(e<=0)return t[0];if(e<t.length)return t[e]}let r=new Date(e).getTime(),n=t.find(s=>new Date(s).getTime()>=r);if(isNaN(r)||!n){let s=t.indexOf(e);return s===-1?t[t.length-1]:t[s]}return n}getTimes(){return m(`WxDataSetManager.getTimes: ${this.datasetName}`),this.instanced||this.meta.times}getVariables(){return m(`WxDataSetManager.getVariables: ${this.datasetName}`),this.meta.variables}getVariableMeta(e){return m(`WxDataSetManager.getVariableMeta: ${this.datasetName}, ${e}`),this.meta.variablesMeta[e]}getMaxZoom(){return this.meta.maxZoom}getBoundaries180(){var r;let e=(r=this.meta.boundaries)==null?void 0:r.boundaries180;if((e==null?void 0:e.length)!==1)return;let t=e[0];return[t.west,t.south,t.east,t.north]}getBoundaries(){return this.meta.boundaries}createURI(e,t,r="png"){if(m(`WxDataSetManager.createURI: ${this.datasetName}, ${e}, ${t}`),!this.checkVariableValid(e))throw new Error(`in dataset ${this.datasetName} variable ${e} not found`);let n=this.getValidTime(t),s=this.instanced?n:this.instance;return`${this.wxapi.dataServerURL+this.datasetName}/${s}/${e}/${n}/{z}/{x}/{y}.${r}`}checkVariableValid(e){return m(`WxDataSetManager.checkVariableValid: ${this.datasetName}, ${e}`),this.getVariableMeta(e)!==void 0}checkCombineVariableIfVector(e){m(`WxDataSetManager.checkCombineVariableIfVector: ${this.datasetName}, ${e}`);let t=this.getVariableMeta(e);if(!t)throw new Error(`in dataset ${this.datasetName} variable ${e} not found`);return t.vector||[e]}createSourceLayer(e,t){m(`WxDataSetManager.createSourceLayer: ${this.datasetName}`);let r=fe(L({},e),{variables:this.checkCombineVariableIfVector(e.variable),wxdatasetManager:this});return new F(r,t)}checkDatasetOutdated(){return b(this,null,function*(){return m(`WxDataSetManager.checkDatasetOutdated: ${this.datasetName}`),yield this.wxapi.initDone,(yield this.getDatasetInstance())===this.instance})}getDatasetInstance(){return b(this,null,function*(){m(`WxDataSetManager.getDatasetInstance: ${this.datasetName}`);let e=yield this.getDatasetInstances();return e[e.length-1]})}getDatasetInstances(){return b(this,null,function*(){m(`WxDataSetManager.getDatasetInstances: ${this.datasetName}`);try{let e=yield A(this.wxapi.dataServerURL+this.datasetName+"/instances.json",this.wxapi.requestInit);if(e.length===0)throw new Error(`No instances found for dataset ${this.datasetName}`);return e}catch(e){throw new Error(`getting dataset instances failure message: ${e.message} datasetName: ${this.datasetName}`)}})}};var Q=class{constructor({dataServerURL:e,maskURL:t="auto",maskChannel:r="R",maskDepth:n=9,qtreeURL:s="auto",requestInit:o,colorStyles:i,units:u,colorSchemes:l}){this.maskURL="auto";this.datasetsMetas={allDatasetsList:[]};this.qtree=new U;this.loadMaskFunc=()=>Promise.reject(new Error("maskURL not defined"));if(m("WxAPI.constructor",e),ye({colorStyles:i,units:u,colorSchemes:l}),this.dataServerURL=e,this.requestInit=o,s=s==="auto"?e+"masks/9+1.seamask.qtree":s,t!=="none"){let c=E(te);this.maskURL=t=t==="auto"?e+"masks/{z}/{x}/{y}.png":t,this.loadMaskFunc=d=>c(G(t,d),o)}this.maskChannel=r==="R"?0:r==="G"?1:r==="B"?2:r==="A"?3:0,this.maskDepth=n,this.initDone=Promise.all([A(e+"datasetsmeta.json",o),s!=="none"?this.qtree.load(s,o):Promise.resolve()]).then(([c,d])=>{c.allDatasetsList||(c.allDatasetsList=Object.keys(c)),this.datasetsMetas=c,m("WxAPI.constructor initDone")})}getDatasetShortMeta(e){if(m("WxAPI.getDatasetShortMeta",e),e!=="allDatasetsList")return this.datasetsMetas[e]}getDatasetInatance(e){var t;return m("WxAPI.getDatasetInatance",e),(t=this.getDatasetShortMeta(e))==null?void 0:t.instance}getDatasetVariables(e){return b(this,null,function*(){var t;return yield this.initDone,m("WxAPI.getDatasetVariables",e),(t=this.datasetsMetas[e])==null?void 0:t.variables})}createDatasetManager(e){return b(this,null,function*(){yield this.initDone,m("WxAPI.createDatasetManager",e);let t=this.getDatasetShortMeta(e),r=t==null?void 0:t.instance;if(!r)throw new Error("Dataset/instance not found:"+e);let n=t.instanced,s=yield A(this.dataServerURL+e+"/"+r+"/meta.json",this.requestInit);return new N({datasetName:e,instanced:n,instance:r,meta:s,wxapi:this})})}createAllDatasetsManagers(){return b(this,null,function*(){return yield this.initDone,m("WxAPI.createAllDatasetsManagers"),Promise.allSettled(this.datasetsMetas.allDatasetsList.map(t=>this.createDatasetManager(t)))})}filterDatasetsByVariableName(e){return b(this,null,function*(){return yield this.initDone,m("WxAPI.filterDatasetsByVariableName",e),this.datasetsMetas.allDatasetsList.filter(t=>{var r,n,s;return(s=(n=(r=this.datasetsMetas[t])==null?void 0:r.variables)==null?void 0:n.includes)==null?void 0:s.call(n,e)})})}getAllDatasetsNames(){return b(this,null,function*(){return yield this.initDone,m("WxAPI.getAllDatasetsNames"),this.datasetsMetas.allDatasetsList})}};return je(xt);})();
@@ -0,0 +1,92 @@
1
+ :root {
2
+ --light-hl-0: #AF00DB;
3
+ --dark-hl-0: #C586C0;
4
+ --light-hl-1: #000000;
5
+ --dark-hl-1: #D4D4D4;
6
+ --light-hl-2: #A31515;
7
+ --dark-hl-2: #CE9178;
8
+ --light-hl-3: #001080;
9
+ --dark-hl-3: #9CDCFE;
10
+ --light-hl-4: #795E26;
11
+ --dark-hl-4: #DCDCAA;
12
+ --light-hl-5: #008000;
13
+ --dark-hl-5: #6A9955;
14
+ --light-hl-6: #0000FF;
15
+ --dark-hl-6: #569CD6;
16
+ --light-hl-7: #0070C1;
17
+ --dark-hl-7: #4FC1FF;
18
+ --light-hl-8: #098658;
19
+ --dark-hl-8: #B5CEA8;
20
+ --light-hl-9: #267F99;
21
+ --dark-hl-9: #4EC9B0;
22
+ --light-code-background: #FFFFFF;
23
+ --dark-code-background: #1E1E1E;
24
+ }
25
+
26
+ @media (prefers-color-scheme: light) { :root {
27
+ --hl-0: var(--light-hl-0);
28
+ --hl-1: var(--light-hl-1);
29
+ --hl-2: var(--light-hl-2);
30
+ --hl-3: var(--light-hl-3);
31
+ --hl-4: var(--light-hl-4);
32
+ --hl-5: var(--light-hl-5);
33
+ --hl-6: var(--light-hl-6);
34
+ --hl-7: var(--light-hl-7);
35
+ --hl-8: var(--light-hl-8);
36
+ --hl-9: var(--light-hl-9);
37
+ --code-background: var(--light-code-background);
38
+ } }
39
+
40
+ @media (prefers-color-scheme: dark) { :root {
41
+ --hl-0: var(--dark-hl-0);
42
+ --hl-1: var(--dark-hl-1);
43
+ --hl-2: var(--dark-hl-2);
44
+ --hl-3: var(--dark-hl-3);
45
+ --hl-4: var(--dark-hl-4);
46
+ --hl-5: var(--dark-hl-5);
47
+ --hl-6: var(--dark-hl-6);
48
+ --hl-7: var(--dark-hl-7);
49
+ --hl-8: var(--dark-hl-8);
50
+ --hl-9: var(--dark-hl-9);
51
+ --code-background: var(--dark-code-background);
52
+ } }
53
+
54
+ :root[data-theme='light'] {
55
+ --hl-0: var(--light-hl-0);
56
+ --hl-1: var(--light-hl-1);
57
+ --hl-2: var(--light-hl-2);
58
+ --hl-3: var(--light-hl-3);
59
+ --hl-4: var(--light-hl-4);
60
+ --hl-5: var(--light-hl-5);
61
+ --hl-6: var(--light-hl-6);
62
+ --hl-7: var(--light-hl-7);
63
+ --hl-8: var(--light-hl-8);
64
+ --hl-9: var(--light-hl-9);
65
+ --code-background: var(--light-code-background);
66
+ }
67
+
68
+ :root[data-theme='dark'] {
69
+ --hl-0: var(--dark-hl-0);
70
+ --hl-1: var(--dark-hl-1);
71
+ --hl-2: var(--dark-hl-2);
72
+ --hl-3: var(--dark-hl-3);
73
+ --hl-4: var(--dark-hl-4);
74
+ --hl-5: var(--dark-hl-5);
75
+ --hl-6: var(--dark-hl-6);
76
+ --hl-7: var(--dark-hl-7);
77
+ --hl-8: var(--dark-hl-8);
78
+ --hl-9: var(--dark-hl-9);
79
+ --code-background: var(--dark-code-background);
80
+ }
81
+
82
+ .hl-0 { color: var(--hl-0); }
83
+ .hl-1 { color: var(--hl-1); }
84
+ .hl-2 { color: var(--hl-2); }
85
+ .hl-3 { color: var(--hl-3); }
86
+ .hl-4 { color: var(--hl-4); }
87
+ .hl-5 { color: var(--hl-5); }
88
+ .hl-6 { color: var(--hl-6); }
89
+ .hl-7 { color: var(--hl-7); }
90
+ .hl-8 { color: var(--hl-8); }
91
+ .hl-9 { color: var(--hl-9); }
92
+ pre, code { background: var(--code-background); }