@loaders.gl/scientific 5.0.0-alpha.14 → 5.0.0-beta.2

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 (87) hide show
  1. package/LICENSE +2 -30
  2. package/README.md +10 -2
  3. package/THIRD-PARTY-NOTICES.md +21 -0
  4. package/dist/index.cjs +78 -4106
  5. package/dist/index.cjs.map +4 -3
  6. package/dist/index.d.ts +4 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +2 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/lib/parsers/parse-npy.d.ts +15 -0
  11. package/dist/lib/parsers/parse-npy.d.ts.map +1 -0
  12. package/dist/lib/parsers/parse-npy.js +81 -0
  13. package/dist/lib/parsers/parse-npy.js.map +1 -0
  14. package/dist/netcdf/bundled.cjs +1 -2
  15. package/dist/netcdf/index.cjs +1 -2
  16. package/dist/netcdf/index.cjs.map +2 -2
  17. package/dist/netcdf/netcdf-loader-with-parser.cjs +1 -2
  18. package/dist/netcdf/netcdf-loader-with-parser.js +1 -1
  19. package/dist/netcdf/netcdf-loader-with-parser.js.map +1 -1
  20. package/dist/netcdf/netcdf-loader.cjs +5 -4
  21. package/dist/netcdf/netcdf-loader.cjs.map +7 -0
  22. package/dist/netcdf/netcdf-loader.js +1 -1
  23. package/dist/netcdf/netcdf-loader.js.map +1 -1
  24. package/dist/netcdf/netcdf-source-loader-types.js +1 -1
  25. package/dist/netcdf/netcdf-source-loader-types.js.map +1 -1
  26. package/dist/netcdf/netcdf-source-loader.js +1 -1
  27. package/dist/netcdf/netcdf-source-loader.js.map +1 -1
  28. package/dist/netcdf/unbundled.cjs +1 -2
  29. package/dist/netcdf.min.js +3 -3
  30. package/dist/npy-format.d.ts +12 -0
  31. package/dist/npy-format.d.ts.map +1 -0
  32. package/dist/npy-format.js +15 -0
  33. package/dist/npy-format.js.map +1 -0
  34. package/dist/npy-loader-types.cjs +80 -0
  35. package/dist/npy-loader-types.cjs.map +7 -0
  36. package/dist/npy-loader-types.d.ts +73 -0
  37. package/dist/npy-loader-types.d.ts.map +1 -0
  38. package/dist/npy-loader-types.js +34 -0
  39. package/dist/npy-loader-types.js.map +1 -0
  40. package/dist/npy-loader.cjs +273 -0
  41. package/dist/npy-loader.cjs.map +6 -0
  42. package/dist/npy-loader.d.ts +27 -0
  43. package/dist/npy-loader.d.ts.map +1 -0
  44. package/dist/npy-loader.js +15 -0
  45. package/dist/npy-loader.js.map +1 -0
  46. package/dist/npy-worker.d.ts +2 -0
  47. package/dist/npy-worker.d.ts.map +1 -0
  48. package/dist/npy-worker.js +750 -0
  49. package/dist/npy-worker.js.map +1 -0
  50. package/dist/vtk/index.cjs +4 -4118
  51. package/dist/vtk/index.cjs.map +2 -2
  52. package/dist/vtk/vtk-xml.js +4 -4
  53. package/dist/vtk/vtk-xml.js.map +1 -1
  54. package/dist/workers/npy-worker.d.ts +2 -0
  55. package/dist/workers/npy-worker.d.ts.map +1 -0
  56. package/dist/workers/npy-worker.js +7 -0
  57. package/dist/workers/npy-worker.js.map +1 -0
  58. package/dist/zarr/geo-zarr-source-loader.d.ts.map +1 -1
  59. package/dist/zarr/geo-zarr-source-loader.js +162 -43
  60. package/dist/zarr/geo-zarr-source-loader.js.map +1 -1
  61. package/dist/zarr/index.cjs +194 -43
  62. package/dist/zarr/index.cjs.map +2 -2
  63. package/dist/zarr/lib/spatial-multiscales.d.ts +13 -2
  64. package/dist/zarr/lib/spatial-multiscales.d.ts.map +1 -1
  65. package/dist/zarr/lib/spatial-multiscales.js +94 -8
  66. package/dist/zarr/lib/spatial-multiscales.js.map +1 -1
  67. package/dist/zarr/ome-zarr-source-loader.js +1 -1
  68. package/dist/zarr/ome-zarr-source-loader.js.map +1 -1
  69. package/dist/zarr/zarr-loader-types.cjs +161 -0
  70. package/dist/zarr/zarr-loader-types.cjs.map +7 -0
  71. package/dist/zarr/zarr-loader-types.js +1 -1
  72. package/dist/zarr/zarr-loader-types.js.map +1 -1
  73. package/dist/zarr.dev.js +205 -47
  74. package/dist/zarr.min.js +50 -50
  75. package/package.json +46 -8
  76. package/src/index.ts +5 -0
  77. package/src/lib/parsers/parse-npy.ts +123 -0
  78. package/src/netcdf/netcdf-loader-with-parser.ts +1 -1
  79. package/src/npy-format.ts +17 -0
  80. package/src/npy-loader-types.ts +50 -0
  81. package/src/npy-loader.ts +21 -0
  82. package/src/npy-worker.ts +6 -0
  83. package/src/vtk/vtk-xml.ts +4 -4
  84. package/src/workers/npy-worker.ts +8 -0
  85. package/src/zarr/geo-zarr-source-loader.ts +195 -44
  86. package/src/zarr/lib/spatial-multiscales.ts +104 -8
  87. package/third-party-licenses/iobuffer-LICENSE +21 -0
@@ -0,0 +1,161 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // dist/zarr/zarr-loader-types.js
31
+ var zarr_loader_types_exports = {};
32
+ __export(zarr_loader_types_exports, {
33
+ GeoZarrSourceLoader: () => GeoZarrSourceLoader,
34
+ OMEZarrSourceLoader: () => OMEZarrSourceLoader,
35
+ SpatialDataSourceLoader: () => SpatialDataSourceLoader,
36
+ ZarrArraySourceLoader: () => ZarrArraySourceLoader
37
+ });
38
+ module.exports = __toCommonJS(zarr_loader_types_exports);
39
+ var VERSION = true ? "5.0.0-beta.2" : "latest";
40
+ var OMEZarrSourceLoader = {
41
+ dataType: null,
42
+ batchType: null,
43
+ name: "OMEZarrSourceLoader",
44
+ id: "omezarr",
45
+ module: "scientific",
46
+ version: VERSION,
47
+ extensions: ["zarr"],
48
+ mimeTypes: [],
49
+ type: "omezarr",
50
+ fromUrl: true,
51
+ fromBlob: false,
52
+ options: {
53
+ zarr: { metadataPath: "auto", path: null, labels: void 0, requireConsolidatedMetadata: true },
54
+ omezarr: { interleaved: false, defaultChannels: void 0 }
55
+ },
56
+ defaultOptions: {
57
+ zarr: { metadataPath: "auto", path: null, labels: void 0, requireConsolidatedMetadata: true },
58
+ omezarr: { interleaved: false, defaultChannels: void 0 }
59
+ },
60
+ testURL: (url) => /\.zarr(?:$|[/?#])/i.test(url),
61
+ preload: async () => (await import("@loaders.gl/scientific/zarr/ome-zarr-source-loader")).OMEZarrSourceLoaderWithParser,
62
+ createDataSource(_data, _options, _coreApi) {
63
+ throw new Error("OMEZarrSourceLoader requires async load() or an explicit @loaders.gl/scientific/zarr/ome-zarr-source-loader import");
64
+ }
65
+ };
66
+ var GeoZarrSourceLoader = {
67
+ dataType: null,
68
+ batchType: null,
69
+ name: "GeoZarrSourceLoader",
70
+ id: "geozarr",
71
+ module: "scientific",
72
+ version: VERSION,
73
+ extensions: ["zarr"],
74
+ mimeTypes: [],
75
+ type: "geozarr",
76
+ fromUrl: true,
77
+ fromBlob: false,
78
+ options: {
79
+ zarr: { metadataPath: "auto", path: null, labels: void 0, requireConsolidatedMetadata: true },
80
+ geozarr: {
81
+ array: void 0,
82
+ spatialDimensions: void 0,
83
+ transform: void 0,
84
+ coordinateReferenceSystem: void 0,
85
+ defaultSelection: void 0
86
+ }
87
+ },
88
+ defaultOptions: {
89
+ zarr: { metadataPath: "auto", path: null, labels: void 0, requireConsolidatedMetadata: true },
90
+ geozarr: {
91
+ array: void 0,
92
+ spatialDimensions: void 0,
93
+ transform: void 0,
94
+ coordinateReferenceSystem: void 0,
95
+ defaultSelection: void 0
96
+ }
97
+ },
98
+ testURL: (url) => /\.zarr(?:$|[/?#])/i.test(url),
99
+ preload: async () => (await import("@loaders.gl/scientific/zarr/geo-zarr-source-loader")).GeoZarrSourceLoaderWithParser,
100
+ createDataSource(_data, _options, _coreApi) {
101
+ throw new Error("GeoZarrSourceLoader requires async load() or an explicit @loaders.gl/scientific/zarr/geo-zarr-source-loader import");
102
+ }
103
+ };
104
+ var ZarrArraySourceLoader = {
105
+ dataType: null,
106
+ batchType: null,
107
+ name: "ZarrArraySourceLoader",
108
+ id: "zarr-array",
109
+ module: "scientific",
110
+ version: VERSION,
111
+ extensions: ["zarr"],
112
+ mimeTypes: [],
113
+ type: "zarr-array",
114
+ fromUrl: true,
115
+ fromBlob: false,
116
+ options: {
117
+ zarr: { metadataPath: "auto", path: null, labels: void 0, requireConsolidatedMetadata: true },
118
+ zarrArray: { path: void 0, dimensions: void 0 }
119
+ },
120
+ defaultOptions: {
121
+ zarr: { metadataPath: "auto", path: null, labels: void 0, requireConsolidatedMetadata: true },
122
+ zarrArray: { path: void 0, dimensions: void 0 }
123
+ },
124
+ testURL: (url) => /\.zarr(?:$|[/?#])/i.test(url),
125
+ preload: async () => (await import("@loaders.gl/scientific/zarr/zarr-array-source")).ZarrArraySourceLoaderWithParser,
126
+ createDataSource(_data, _options, _coreApi) {
127
+ throw new Error("ZarrArraySourceLoader requires async load() or an explicit @loaders.gl/scientific/zarr/zarr-array-source import");
128
+ }
129
+ };
130
+ var SpatialDataSourceLoader = {
131
+ dataType: null,
132
+ batchType: null,
133
+ name: "SpatialDataSourceLoader",
134
+ id: "spatial-data",
135
+ module: "scientific",
136
+ version: VERSION,
137
+ extensions: ["zarr"],
138
+ mimeTypes: [],
139
+ type: "spatial-data",
140
+ fromUrl: true,
141
+ fromBlob: false,
142
+ options: {
143
+ zarr: { metadataPath: "auto", path: null, labels: void 0, requireConsolidatedMetadata: true }
144
+ },
145
+ defaultOptions: {
146
+ zarr: { metadataPath: "auto", path: null, labels: void 0, requireConsolidatedMetadata: true }
147
+ },
148
+ testURL: (url) => /\.zarr(?:$|[/?#])/i.test(url),
149
+ preload: async () => (await import("@loaders.gl/scientific/zarr/spatial-data-source")).SpatialDataSourceLoaderWithParser,
150
+ createDataSource(_data, _options, _coreApi) {
151
+ throw new Error("SpatialDataSourceLoader requires async load() or an explicit @loaders.gl/scientific/zarr/spatial-data-source import");
152
+ }
153
+ };
154
+ // Annotate the CommonJS export names for ESM import in node:
155
+ 0 && (module.exports = {
156
+ GeoZarrSourceLoader,
157
+ OMEZarrSourceLoader,
158
+ SpatialDataSourceLoader,
159
+ ZarrArraySourceLoader
160
+ });
161
+ //# sourceMappingURL=zarr-loader-types.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/zarr/zarr-loader-types.ts"],
4
+ "sourcesContent": ["// loaders.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport type {CoreAPI, SourceLoader} from '@loaders.gl/core/loader-utils';\nimport type {GeoZarrRasterSource, GeoZarrSourceLoaderOptions} from './geo-zarr-source-loader';\nimport type {OMEZarrImageSource, ZarrSourceLoaderOptions} from './ome-zarr-source-loader';\nimport type {SpatialDataSource, SpatialDataSourceLoaderOptions} from './spatial-data-source';\nimport type {ZarrArraySource, ZarrArraySourceLoaderOptions} from './zarr-array-source';\n\n// __VERSION__ is injected by babel-plugin-version-inline\n// @ts-ignore TS2304: Cannot find name '__VERSION__'.\nconst VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';\n\n/** Metadata-only OME-Zarr loader. */\nexport const OMEZarrSourceLoader = {\n dataType: null as unknown as OMEZarrImageSource,\n batchType: null as never,\n name: 'OMEZarrSourceLoader',\n id: 'omezarr',\n module: 'scientific',\n version: VERSION,\n extensions: ['zarr'],\n mimeTypes: [],\n type: 'omezarr',\n fromUrl: true,\n fromBlob: false,\n options: {\n zarr: {metadataPath: 'auto', path: null, labels: undefined!, requireConsolidatedMetadata: true},\n omezarr: {interleaved: false, defaultChannels: undefined!}\n } as ZarrSourceLoaderOptions,\n defaultOptions: {\n zarr: {metadataPath: 'auto', path: null, labels: undefined!, requireConsolidatedMetadata: true},\n omezarr: {interleaved: false, defaultChannels: undefined!}\n },\n testURL: (url: string): boolean => /\\.zarr(?:$|[/?#])/i.test(url),\n preload: async () =>\n (await import('@loaders.gl/scientific/zarr/ome-zarr-source-loader'))\n .OMEZarrSourceLoaderWithParser,\n createDataSource(\n _data: string,\n _options: ZarrSourceLoaderOptions,\n _coreApi?: CoreAPI\n ): OMEZarrImageSource {\n throw new Error(\n 'OMEZarrSourceLoader requires async load() or an explicit @loaders.gl/scientific/zarr/ome-zarr-source-loader import'\n );\n }\n} as const satisfies SourceLoader<OMEZarrImageSource>;\n\n/** Metadata-only GeoZarr loader. */\nexport const GeoZarrSourceLoader = {\n dataType: null as unknown as GeoZarrRasterSource,\n batchType: null as never,\n name: 'GeoZarrSourceLoader',\n id: 'geozarr',\n module: 'scientific',\n version: VERSION,\n extensions: ['zarr'],\n mimeTypes: [],\n type: 'geozarr',\n fromUrl: true,\n fromBlob: false,\n options: {\n zarr: {metadataPath: 'auto', path: null, labels: undefined!, requireConsolidatedMetadata: true},\n geozarr: {\n array: undefined!,\n spatialDimensions: undefined!,\n transform: undefined!,\n coordinateReferenceSystem: undefined!,\n defaultSelection: undefined!\n }\n } as GeoZarrSourceLoaderOptions,\n defaultOptions: {\n zarr: {metadataPath: 'auto', path: null, labels: undefined!, requireConsolidatedMetadata: true},\n geozarr: {\n array: undefined!,\n spatialDimensions: undefined!,\n transform: undefined!,\n coordinateReferenceSystem: undefined!,\n defaultSelection: undefined!\n }\n },\n testURL: (url: string): boolean => /\\.zarr(?:$|[/?#])/i.test(url),\n preload: async () =>\n (await import('@loaders.gl/scientific/zarr/geo-zarr-source-loader'))\n .GeoZarrSourceLoaderWithParser,\n createDataSource(\n _data: string,\n _options: GeoZarrSourceLoaderOptions,\n _coreApi?: CoreAPI\n ): GeoZarrRasterSource {\n throw new Error(\n 'GeoZarrSourceLoader requires async load() or an explicit @loaders.gl/scientific/zarr/geo-zarr-source-loader import'\n );\n }\n} as const satisfies SourceLoader<GeoZarrRasterSource>;\n\n/** Metadata-only direct Zarr array loader. */\nexport const ZarrArraySourceLoader = {\n dataType: null as unknown as ZarrArraySource,\n batchType: null as never,\n name: 'ZarrArraySourceLoader',\n id: 'zarr-array',\n module: 'scientific',\n version: VERSION,\n extensions: ['zarr'],\n mimeTypes: [],\n type: 'zarr-array',\n fromUrl: true,\n fromBlob: false,\n options: {\n zarr: {metadataPath: 'auto', path: null, labels: undefined!, requireConsolidatedMetadata: true},\n zarrArray: {path: undefined!, dimensions: undefined!}\n } as ZarrArraySourceLoaderOptions,\n defaultOptions: {\n zarr: {metadataPath: 'auto', path: null, labels: undefined!, requireConsolidatedMetadata: true},\n zarrArray: {path: undefined!, dimensions: undefined!}\n },\n testURL: (url: string): boolean => /\\.zarr(?:$|[/?#])/i.test(url),\n preload: async () =>\n (await import('@loaders.gl/scientific/zarr/zarr-array-source')).ZarrArraySourceLoaderWithParser,\n createDataSource(\n _data: string,\n _options: ZarrArraySourceLoaderOptions,\n _coreApi?: CoreAPI\n ): ZarrArraySource {\n throw new Error(\n 'ZarrArraySourceLoader requires async load() or an explicit @loaders.gl/scientific/zarr/zarr-array-source import'\n );\n }\n} as const satisfies SourceLoader<ZarrArraySource>;\n\n/** Metadata-only SpatialData loader. */\nexport const SpatialDataSourceLoader = {\n dataType: null as unknown as SpatialDataSource,\n batchType: null as never,\n name: 'SpatialDataSourceLoader',\n id: 'spatial-data',\n module: 'scientific',\n version: VERSION,\n extensions: ['zarr'],\n mimeTypes: [],\n type: 'spatial-data',\n fromUrl: true,\n fromBlob: false,\n options: {\n zarr: {metadataPath: 'auto', path: null, labels: undefined!, requireConsolidatedMetadata: true}\n } as SpatialDataSourceLoaderOptions,\n defaultOptions: {\n zarr: {metadataPath: 'auto', path: null, labels: undefined!, requireConsolidatedMetadata: true}\n },\n testURL: (url: string): boolean => /\\.zarr(?:$|[/?#])/i.test(url),\n preload: async () =>\n (await import('@loaders.gl/scientific/zarr/spatial-data-source'))\n .SpatialDataSourceLoaderWithParser,\n createDataSource(\n _data: string,\n _options: SpatialDataSourceLoaderOptions,\n _coreApi?: CoreAPI\n ): SpatialDataSource {\n throw new Error(\n 'SpatialDataSourceLoader requires async load() or an explicit @loaders.gl/scientific/zarr/spatial-data-source import'\n );\n }\n} as const satisfies SourceLoader<SpatialDataSource>;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;AAYA,IAAM,UAAU,OAAoC,iBAAe;AAG5D,IAAM,sBAAsB;EACjC,UAAU;EACV,WAAW;EACX,MAAM;EACN,IAAI;EACJ,QAAQ;EACR,SAAS;EACT,YAAY,CAAC,MAAM;EACnB,WAAW,CAAA;EACX,MAAM;EACN,SAAS;EACT,UAAU;EACV,SAAS;IACP,MAAM,EAAC,cAAc,QAAQ,MAAM,MAAM,QAAQ,QAAY,6BAA6B,KAAI;IAC9F,SAAS,EAAC,aAAa,OAAO,iBAAiB,OAAU;;EAE3D,gBAAgB;IACd,MAAM,EAAC,cAAc,QAAQ,MAAM,MAAM,QAAQ,QAAY,6BAA6B,KAAI;IAC9F,SAAS,EAAC,aAAa,OAAO,iBAAiB,OAAU;;EAE3D,SAAS,CAAC,QAAyB,qBAA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GAAG;EAChE,SAAS,aACN,MAAM,OAAO,+CAA+C,GAAG;EAClE,iBACE,OACA,UACA,UAAkB;AAElB,UAAM,IAAI,MACR,iHAAiH;EAErH;;AAIK,IAAM,0BAA0B;EACrC,UAAU;EACV,WAAW;EACX,MAAM;EACN,IAAI;EACJ,QAAQ;EACR,SAAS;EACT,YAAY,CAAC,MAAM;EACnB,WAAW,CAAA;EACX,MAAM;EACN,SAAS;EACT,UAAU;EACV,SAAS;IACP,MAAM,EAAC,cAAc,QAAQ,MAAM,MAAM,QAAQ,QAAY,6BAA6B,KAAI;;EAEhG,gBAAgB;IACd,MAAM,EAAC,cAAc,QAAQ,MAAM,MAAM,QAAQ,QAAY,6BAA6B,KAAI;;EAEhG,SAAS,CAAC,QAAyB,qBAAqB,KAAK,GAAG;EAChE,SAAS,aACN,MAAM,OAAO,iDAAiD,GAC5D;EACL,iBACE,OACA,UACA,UAAkB;AAElB,UAAM,IAAI,MACR,qHAAqH;EAEzH;;",
6
+ "names": []
7
+ }
@@ -3,7 +3,7 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
  // __VERSION__ is injected by babel-plugin-version-inline
5
5
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
6
- const VERSION = typeof "5.0.0-alpha.14" !== 'undefined' ? "5.0.0-alpha.14" : 'latest';
6
+ const VERSION = typeof "5.0.0-beta.2" !== 'undefined' ? "5.0.0-beta.2" : 'latest';
7
7
  /** Metadata-only OME-Zarr loader. */
8
8
  export const OMEZarrSourceLoader = {
9
9
  dataType: null,
@@ -1 +1 @@
1
- {"version":3,"file":"zarr-loader-types.js","sourceRoot":"","sources":["../../src/zarr/zarr-loader-types.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAQpC,yDAAyD;AACzD,qDAAqD;AACrD,MAAM,OAAO,GAAG,uBAAkB,KAAK,WAAW,CAAC,CAAC,kBAAa,CAAC,CAAC,QAAQ,CAAC;AAE5E,qCAAqC;AACrC,MA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AO,EAAE,CAAC,GAAW,EAAW,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC;IACjE,OAAO,EAAE,KAAK,IAAI,EAAE,CAClB,CAAC,MAAM,MAAM,CAAC,iDAAiD,CAAC,CAAC;SAC9D,iCAAiC;IACtC,gBAAgB,CACd,KAAa,EACb,QAAwC,EACxC,QAAkB;QAElB,MAAM,IAAI,KAAK,CACb,qHAAqH,CACtH,CAAC;IACJ,CAAC;CACiD,CAAC"}
package/dist/zarr.dev.js CHANGED
@@ -4290,10 +4290,13 @@ var __exports__ = (() => {
4290
4290
  validateTileMatrixGeometry(matrix);
4291
4291
  }
4292
4292
  function validateTileMatrixGeometry(matrix) {
4293
- if (typeof matrix.id !== "string" || !matrix.id || matrix.origin.length !== 2 || matrix.tileSize.length !== 2 || matrix.matrixSize.length !== 2 || !Number.isFinite(matrix.resolution) || matrix.resolution <= 0 || matrix.resolutionY !== void 0 && (!Number.isFinite(matrix.resolutionY) || matrix.resolutionY <= 0) || !matrix.origin.every(Number.isFinite) || ![...matrix.tileSize, ...matrix.matrixSize].every((value) => Number.isSafeInteger(value) && value > 0) || !["topLeft", "bottomLeft"].includes(matrix.cornerOfOrigin)) {
4293
+ if (!matrix || typeof matrix.id !== "string" || !Array.isArray(matrix.origin) || !Array.isArray(matrix.tileSize) || !Array.isArray(matrix.matrixSize) || matrix.variableMatrixWidths !== void 0 && !Array.isArray(matrix.variableMatrixWidths) || !matrix.id || matrix.origin.length !== 2 || matrix.tileSize.length !== 2 || matrix.matrixSize.length !== 2 || !Number.isFinite(matrix.resolution) || matrix.resolution <= 0 || matrix.resolutionY !== void 0 && (!Number.isFinite(matrix.resolutionY) || matrix.resolutionY <= 0) || !matrix.origin.every(Number.isFinite) || ![...matrix.tileSize, ...matrix.matrixSize].every((value) => Number.isSafeInteger(value) && value > 0) || !["topLeft", "bottomLeft"].includes(matrix.cornerOfOrigin)) {
4294
4294
  throw new RangeError("Invalid tile matrix geometry");
4295
4295
  }
4296
- const bands = [...matrix.variableMatrixWidths ?? []].sort((first, second) => first.minTileRow - second.minTileRow);
4296
+ const bands = [...matrix.variableMatrixWidths ?? []];
4297
+ if (bands.some((band) => !band))
4298
+ throw new RangeError("Invalid variable matrix width");
4299
+ bands.sort((first, second) => first.minTileRow - second.minTileRow);
4297
4300
  let previousRow = -1;
4298
4301
  for (const band of bands) {
4299
4302
  if (!Number.isSafeInteger(band.coalesce) || band.coalesce <= 1 || matrix.matrixSize[0] % band.coalesce !== 0 || !Number.isSafeInteger(band.minTileRow) || !Number.isSafeInteger(band.maxTileRow) || band.minTileRow <= previousRow || band.maxTileRow < band.minTileRow || band.maxTileRow >= matrix.matrixSize[1])
@@ -4343,6 +4346,7 @@ var __exports__ = (() => {
4343
4346
  }
4344
4347
  function getTileMatrixSet(crs, matrices) {
4345
4348
  if (!crs || !matrices.length) return void 0;
4349
+ if (new Set(matrices.map((matrix) => matrix.id)).size !== matrices.length) return void 0;
4346
4350
  const tileMatrices = [];
4347
4351
  for (const matrix of matrices) {
4348
4352
  const tileMatrix = toTileMatrix(matrix);
@@ -4353,15 +4357,18 @@ var __exports__ = (() => {
4353
4357
  }
4354
4358
  function toTileMatrix(matrix) {
4355
4359
  const { id, resolution, resolutionY, origin, tileSize, matrixSize } = matrix;
4360
+ if (matrix.variableMatrixWidths !== void 0 && !Array.isArray(matrix.variableMatrixWidths))
4361
+ return null;
4356
4362
  if (resolution === void 0 || !origin || !tileSize || !matrixSize) return null;
4357
4363
  const tileMatrix = {
4358
4364
  id,
4359
4365
  resolution,
4360
4366
  ...resolutionY !== void 0 ? { resolutionY } : {},
4361
4367
  origin: [origin[0], origin[1]],
4362
- cornerOfOrigin: matrix.cornerOfOrigin ?? "topLeft",
4368
+ cornerOfOrigin: matrix.cornerOfOrigin === void 0 ? "topLeft" : matrix.cornerOfOrigin,
4363
4369
  tileSize: [tileSize[0], tileSize[1]],
4364
- matrixSize: [matrixSize[0], matrixSize[1]]
4370
+ matrixSize: [matrixSize[0], matrixSize[1]],
4371
+ ...matrix.variableMatrixWidths !== void 0 ? { variableMatrixWidths: matrix.variableMatrixWidths } : {}
4365
4372
  };
4366
4373
  try {
4367
4374
  validateTileMatrix(tileMatrix);
@@ -12678,6 +12685,11 @@ var __exports__ = (() => {
12678
12685
  this.feature = feature;
12679
12686
  }
12680
12687
  };
12688
+ function isZarritaError(err2, ...tags) {
12689
+ if (!(err2 instanceof ZarritaError))
12690
+ return false;
12691
+ return tags.length === 0 || tags.includes(err2._tag);
12692
+ }
12681
12693
 
12682
12694
  // ../../node_modules/zarrita/dist/src/codecs/_shared.js
12683
12695
  function unimplementedEncode(codecName) {
@@ -15575,7 +15587,9 @@ var __exports__ = (() => {
15575
15587
  }
15576
15588
 
15577
15589
  // src/zarr/lib/spatial-multiscales.ts
15578
- function getSpatialMultiscaleLevels(attributes, array2) {
15590
+ function getSpatialMultiscaleLevels(attributes, array2, { spatialOME = false } = {}) {
15591
+ const omeMultiscales = spatialOME ? getOMEMultiscales(attributes) : null;
15592
+ if (omeMultiscales) return getOMEMultiscaleLevels(omeMultiscales, array2);
15579
15593
  const multiscales = attributes?.multiscales;
15580
15594
  const layout = multiscales?.layout;
15581
15595
  if (!Array.isArray(layout) || !layout.length) return [];
@@ -15585,18 +15599,78 @@ var __exports__ = (() => {
15585
15599
  }
15586
15600
  const assets = entries.map((entry) => entry.asset);
15587
15601
  if (new Set(assets).size !== assets.length) throw new Error("Duplicate spatial multiscales asset.");
15602
+ return resolveLevels(assets, array2, entries);
15603
+ }
15604
+ function getOMEMultiscales(attributes) {
15605
+ if (Array.isArray(attributes?.multiscales)) return attributes.multiscales;
15606
+ const ome = attributes?.ome;
15607
+ return Array.isArray(ome?.multiscales) ? ome.multiscales : null;
15608
+ }
15609
+ function getOMEMultiscaleLevels(multiscales, array2) {
15610
+ const candidates = multiscales.filter((multiscale2) => {
15611
+ const datasets2 = multiscale2?.datasets;
15612
+ return Array.isArray(datasets2) && datasets2.some((dataset) => isChildPath(dataset?.path) && (array2 === dataset.path || array2.startsWith(`${dataset.path}/`)));
15613
+ });
15614
+ if (!candidates.length) return [];
15615
+ if (candidates.length > 1) throw new Error("Array belongs to more than one OME-NGFF multiscale.");
15616
+ const multiscale = candidates[0];
15617
+ const datasets = multiscale.datasets;
15618
+ if (datasets.some((dataset) => !dataset || !isChildPath(dataset.path))) {
15619
+ throw new Error("OME-NGFF dataset paths must be relative child paths.");
15620
+ }
15621
+ const paths = datasets.map((dataset) => dataset.path);
15622
+ if (new Set(paths).size !== paths.length) throw new Error("Duplicate OME-NGFF dataset path.");
15623
+ const axes = getOMEAxisNames(multiscale.axes);
15624
+ return resolveLevels(paths, array2, datasets.map(() => ({}))).map((level, index) => ({
15625
+ ...level,
15626
+ scale: getOMEScale(axes, [
15627
+ datasets[index].coordinateTransformations,
15628
+ multiscale.coordinateTransformations
15629
+ ])
15630
+ }));
15631
+ }
15632
+ function resolveLevels(assets, array2, attributes) {
15588
15633
  const matches2 = assets.filter((asset) => array2 === asset || array2.startsWith(`${asset}/`));
15589
15634
  if (matches2.length !== 1) return [];
15590
15635
  const suffix = array2.slice(matches2[0].length);
15591
- return entries.map((entry, index) => ({
15592
- id: assets[index],
15593
- array: `${assets[index]}${suffix}`,
15594
- ...suffix ? { group: assets[index] } : {},
15595
- attributes: entry
15636
+ return assets.map((asset, index) => ({
15637
+ id: asset,
15638
+ array: `${asset}${suffix}`,
15639
+ ...suffix ? { group: asset } : {},
15640
+ attributes: attributes[index]
15596
15641
  }));
15597
15642
  }
15643
+ function getOMEAxisNames(axes) {
15644
+ const names = Array.isArray(axes) ? axes.map((axis) => typeof axis === "string" ? axis : axis?.name) : [];
15645
+ if (!names.length || names.some((name) => typeof name !== "string" || !name)) {
15646
+ throw new Error("OME-NGFF multiscales require named axes.");
15647
+ }
15648
+ if (new Set(names).size !== names.length) throw new Error("Duplicate OME-NGFF axis name.");
15649
+ return names;
15650
+ }
15651
+ function getOMEScale(axes, transformLists) {
15652
+ const scale = axes.map(() => 1);
15653
+ for (const transforms of transformLists) {
15654
+ if (transforms === void 0) continue;
15655
+ if (!Array.isArray(transforms)) {
15656
+ throw new Error("OME-NGFF coordinateTransformations must be a list.");
15657
+ }
15658
+ for (const transform of transforms) {
15659
+ if (transform?.type === "translation") continue;
15660
+ if (transform?.type !== "scale") {
15661
+ throw new Error(`Unsupported OME-NGFF coordinate transformation ${String(transform?.type)}.`);
15662
+ }
15663
+ const values = transform.scale;
15664
+ if (!Array.isArray(values) || values.length !== axes.length || values.some((value) => typeof value !== "number" || !Number.isFinite(value) || value === 0)) {
15665
+ throw new Error("OME-NGFF scale must give one finite non-zero value per axis.");
15666
+ }
15667
+ values.forEach((value, index) => scale[index] *= value);
15668
+ }
15669
+ }
15670
+ return Object.fromEntries(axes.map((axis, index) => [axis, scale[index]]));
15671
+ }
15598
15672
  function isChildPath(value) {
15599
- return typeof value === "string" && value.length > 0 && !/[\\%:?#\u0000-\u0020]/.test(value) && value.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
15673
+ return typeof value === "string" && value.length > 0 && !/[\\%:?#\u0000- ]/.test(value) && value.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
15600
15674
  }
15601
15675
 
15602
15676
  // src/zarr/geo-zarr-source-loader.ts
@@ -15669,9 +15743,7 @@ var __exports__ = (() => {
15669
15743
  }
15670
15744
  /** Opens sibling array metadata without selecting or decoding their samples. */
15671
15745
  async loadGridMetadata() {
15672
- const { metadata, group: group2 } = await this.getInitializationPromise();
15673
- const groupAttributes = metadata.metadata?.groupAttributes;
15674
- const layout = getSpatialMultiscaleLevels(groupAttributes, metadata.array);
15746
+ const { metadata, group: group2, layout } = await this.getInitializationPromise();
15675
15747
  const levels = [];
15676
15748
  for (const level of layout) {
15677
15749
  if (level.array === metadata.array) {
@@ -15694,6 +15766,15 @@ var __exports__ = (() => {
15694
15766
  levels.push({ id: level.id, array: level.array });
15695
15767
  }
15696
15768
  }
15769
+ const selectedScale = layout.find((level) => level.array === metadata.array)?.scale;
15770
+ if (selectedScale) {
15771
+ for (const [index, level] of levels.entries()) {
15772
+ const scale = layout[index].scale;
15773
+ if (level.metadata && !isConsistentOMELevel(scale, selectedScale, level.metadata, metadata)) {
15774
+ delete level.metadata;
15775
+ }
15776
+ }
15777
+ }
15697
15778
  const normalizedLevels = levels.length ? levels : [{ id: metadata.array, array: metadata.array, metadata }];
15698
15779
  const matrices = normalizedLevels.map((level) => getSpatialChunkMatrix(level.id, level.metadata));
15699
15780
  const commonCoordinateReferenceSystem = typeof metadata.crs === "string" && normalizedLevels.every((level) => level.metadata?.crs === metadata.crs) ? metadata.crs : void 0;
@@ -15818,11 +15899,25 @@ var __exports__ = (() => {
15818
15899
  const array2 = await open(group2.resolve(arrayPath), { kind: "array", signal });
15819
15900
  const groupAttributes = normalizeAttributes(group2.attrs);
15820
15901
  const arrayAttributes = normalizeAttributes(array2.attrs);
15821
- const layout = getSpatialMultiscaleLevels(groupAttributes, arrayPath);
15822
- const level = layout.find((candidate) => candidate.array === arrayPath);
15823
- const levelGroupAttributes = level?.group ? normalizeAttributes(
15824
- (await open(group2.resolve(level.group), { kind: "group", signal })).attrs
15825
- ) : {};
15902
+ const openGroupAttributes = async (path) => normalizeAttributes((await open(group2.resolve(path), { kind: "group", signal })).attrs);
15903
+ let layout = getSpatialMultiscaleLevels(groupAttributes, arrayPath, {
15904
+ spatialOME: declaresCoordinateReferenceSystem({ ...groupAttributes, ...arrayAttributes })
15905
+ });
15906
+ let level = layout.find((candidate) => candidate.array === arrayPath);
15907
+ let levelGroupAttributes = level?.group ? await openGroupAttributes(level.group) : {};
15908
+ if (!layout.length) {
15909
+ const omeLayout = getOMELevelsOrEmpty(groupAttributes, arrayPath);
15910
+ const omeLevel = omeLayout.find((candidate) => candidate.array === arrayPath);
15911
+ const omeLevelGroupAttributes = omeLevel?.group ? await openGroupAttributes(omeLevel.group).catch((error) => {
15912
+ rethrowUnlessAbsent(error);
15913
+ return {};
15914
+ }) : {};
15915
+ if (declaresCoordinateReferenceSystem(omeLevelGroupAttributes)) {
15916
+ layout = omeLayout;
15917
+ level = omeLevel;
15918
+ levelGroupAttributes = omeLevelGroupAttributes;
15919
+ }
15920
+ }
15826
15921
  const attributes = {
15827
15922
  ...groupAttributes,
15828
15923
  ...levelGroupAttributes,
@@ -15856,17 +15951,25 @@ var __exports__ = (() => {
15856
15951
  const xDimensionIndex = dimensions.indexOf(spatialDimensions[1]);
15857
15952
  const width = array2.shape[xDimensionIndex];
15858
15953
  const height = array2.shape[yDimensionIndex];
15859
- const coordinateTransform = options?.transform || normalizeAffineTransform(attributes["spatial:transform"]) || (!metadataOnly ? await loadCFCoordinateTransform(group2, spatialDimensions, signal) : null);
15954
+ let gridMappingPromise;
15955
+ const getGridMapping = () => gridMappingPromise ||= loadCFGridMapping(group2, arrayPath, attributes, signal);
15956
+ const coordinateTransform = options?.transform || normalizeAffineTransform(attributes["spatial:transform"]) || // An ancestor grid mapping can be shared by several multiscale levels: it gives the CRS only.
15957
+ normalizeGDALGeoTransform(
15958
+ await getGridMapping().then((mapping) => mapping?.local ? mapping.attributes.GeoTransform : null)
15959
+ ) || (!metadataOnly ? await loadCFCoordinateTransform(group2, arrayPath, spatialDimensions, signal) : null);
15860
15960
  if (!coordinateTransform) {
15861
15961
  throw new Error(
15862
- "GeoZarrRasterSource requires spatial:transform metadata, explicit geozarr.transform, or regular 1D CF coordinate arrays."
15962
+ "GeoZarrRasterSource requires spatial:transform metadata, explicit geozarr.transform, a CF grid-mapping GeoTransform, or regular 1D CF coordinate arrays."
15863
15963
  );
15864
15964
  }
15865
15965
  const declaredRegistration = normalizeRegistration(attributes["spatial:registration"]);
15866
15966
  const transform = declaredRegistration === "node" ? convertNodeTransformToPixelTransform(coordinateTransform) : coordinateTransform;
15867
15967
  const declaredBoundingBox = normalizeBoundingBox(attributes["spatial:bbox"]);
15868
15968
  const boundingBox = declaredRegistration === "pixel" && declaredBoundingBox ? toRasterBoundingBox(declaredBoundingBox) : getTransformBoundingBox(transform, width, height);
15869
- const coordinateReferenceSystem = options?.coordinateReferenceSystem || normalizeDeclaredCoordinateReferenceSystem(attributes) || await loadCFCoordinateReferenceSystem(group2, attributes, spatialDimensions, signal);
15969
+ const coordinateReferenceSystem = options?.coordinateReferenceSystem || normalizeDeclaredCoordinateReferenceSystem(attributes) || getCFCoordinateReferenceSystem(
15970
+ (await getGridMapping())?.attributes || null,
15971
+ spatialDimensions
15972
+ );
15870
15973
  const defaultSelection = options?.defaultSelection || {};
15871
15974
  const selectionDimensions = dimensions.map((dimensionName, dimensionIndex) => ({
15872
15975
  name: dimensionName,
@@ -15906,7 +16009,7 @@ var __exports__ = (() => {
15906
16009
  transform,
15907
16010
  registration: declaredRegistration
15908
16011
  };
15909
- return { group: group2, array: array2, metadata, xDimensionIndex, yDimensionIndex };
16012
+ return { group: group2, array: array2, metadata, xDimensionIndex, yDimensionIndex, layout };
15910
16013
  }
15911
16014
  };
15912
16015
  function normalizeAttributes(attributes) {
@@ -15966,12 +16069,19 @@ var __exports__ = (() => {
15966
16069
  translateY - (rotationY + scaleY) / 2
15967
16070
  ];
15968
16071
  }
15969
- async function loadCFCoordinateTransform(group2, spatialDimensions, signal) {
16072
+ async function loadCFCoordinateTransform(group2, arrayPath, spatialDimensions, signal) {
16073
+ let coordinates;
15970
16074
  try {
15971
- const [yCoordinates, xCoordinates] = await Promise.all([
15972
- loadCoordinateValues(group2, spatialDimensions[0], signal),
15973
- loadCoordinateValues(group2, spatialDimensions[1], signal)
16075
+ coordinates = await Promise.all([
16076
+ loadCoordinateValues(group2, arrayPath, spatialDimensions[0], signal),
16077
+ loadCoordinateValues(group2, arrayPath, spatialDimensions[1], signal)
15974
16078
  ]);
16079
+ } catch (error) {
16080
+ rethrowUnlessAbsent(error);
16081
+ return null;
16082
+ }
16083
+ const [yCoordinates, xCoordinates] = coordinates;
16084
+ try {
15975
16085
  const scaleX = getRegularCoordinateSpacing(xCoordinates, spatialDimensions[1]);
15976
16086
  const scaleY = getRegularCoordinateSpacing(yCoordinates, spatialDimensions[0]);
15977
16087
  return [scaleX, 0, xCoordinates[0] - scaleX / 2, 0, scaleY, yCoordinates[0] - scaleY / 2];
@@ -15979,11 +16089,8 @@ var __exports__ = (() => {
15979
16089
  return null;
15980
16090
  }
15981
16091
  }
15982
- async function loadCoordinateValues(group2, coordinateName, signal) {
15983
- const coordinateArray = await open(group2.resolve(coordinateName), {
15984
- kind: "array",
15985
- signal
15986
- });
16092
+ async function loadCoordinateValues(group2, arrayPath, coordinateName, signal) {
16093
+ const { array: coordinateArray } = await openNearestArray(group2, arrayPath, coordinateName, signal);
15987
16094
  if (coordinateArray.shape.length !== 1 || coordinateArray.shape[0] < 2) {
15988
16095
  throw new Error(
15989
16096
  `Coordinate ${coordinateName} must be a one-dimensional array with at least two values.`
@@ -15995,6 +16102,23 @@ var __exports__ = (() => {
15995
16102
  }
15996
16103
  return Array.from(coordinateChunk.data);
15997
16104
  }
16105
+ async function openNearestArray(group2, arrayPath, name, signal) {
16106
+ const segments = arrayPath.split("/").slice(0, -1);
16107
+ let lastError;
16108
+ for (let depth = segments.length; depth >= 0; depth--) {
16109
+ const path = [...segments.slice(0, depth), name].join("/");
16110
+ try {
16111
+ const array2 = await open(group2.resolve(path), { kind: "array", signal });
16112
+ return { array: array2, local: depth === segments.length };
16113
+ } catch (error) {
16114
+ if (!isZarritaError(error, "NotFoundError")) {
16115
+ throw error;
16116
+ }
16117
+ lastError = error;
16118
+ }
16119
+ }
16120
+ throw lastError;
16121
+ }
15998
16122
  function getRegularCoordinateSpacing(coordinates, coordinateName) {
15999
16123
  const spacing = (coordinates.at(-1) - coordinates[0]) / (coordinates.length - 1);
16000
16124
  if (!Number.isFinite(spacing) || spacing === 0) {
@@ -16009,22 +16133,27 @@ var __exports__ = (() => {
16009
16133
  }
16010
16134
  return spacing;
16011
16135
  }
16012
- async function loadCFCoordinateReferenceSystem(group2, attributes, spatialDimensions, signal) {
16136
+ async function loadCFGridMapping(group2, arrayPath, attributes, signal) {
16013
16137
  const gridMapping = normalizeString(attributes.grid_mapping);
16014
- if (gridMapping) {
16015
- const gridMappingName = gridMapping.trim().split(/[\s:]/, 1)[0];
16016
- try {
16017
- const gridMappingArray = await open(group2.resolve(gridMappingName), {
16018
- kind: "array",
16019
- signal
16020
- });
16021
- const gridMappingAttributes = normalizeAttributes(gridMappingArray.attrs);
16022
- const coordinateReferenceSystem = normalizeString(gridMappingAttributes.crs_wkt) || normalizeString(gridMappingAttributes.spatial_ref) || normalizeString(gridMappingAttributes["proj:wkt2"]) || normalizeString(gridMappingAttributes["proj:code"]);
16023
- if (coordinateReferenceSystem) {
16024
- return coordinateReferenceSystem;
16025
- }
16026
- } catch {
16027
- }
16138
+ if (!gridMapping) return null;
16139
+ const gridMappingName = gridMapping.trim().split(/[\s:]/, 1)[0];
16140
+ try {
16141
+ const { array: array2, local } = await openNearestArray(group2, arrayPath, gridMappingName, signal);
16142
+ return { attributes: normalizeAttributes(array2.attrs), local };
16143
+ } catch (error) {
16144
+ rethrowUnlessAbsent(error);
16145
+ return null;
16146
+ }
16147
+ }
16148
+ function rethrowUnlessAbsent(error) {
16149
+ if (!isZarritaError(error, "NotFoundError")) {
16150
+ throw error;
16151
+ }
16152
+ }
16153
+ function getCFCoordinateReferenceSystem(gridMappingAttributes, spatialDimensions) {
16154
+ const coordinateReferenceSystem = gridMappingAttributes && (normalizeString(gridMappingAttributes.crs_wkt) || normalizeString(gridMappingAttributes.spatial_ref) || normalizeString(gridMappingAttributes["proj:wkt2"]) || normalizeString(gridMappingAttributes["proj:code"]));
16155
+ if (coordinateReferenceSystem) {
16156
+ return coordinateReferenceSystem;
16028
16157
  }
16029
16158
  const normalizedDimensions = spatialDimensions.map((dimension) => dimension.toLowerCase());
16030
16159
  if (["lat", "latitude"].includes(normalizedDimensions[0]) && ["lon", "longitude"].includes(normalizedDimensions[1])) {
@@ -16032,6 +16161,35 @@ var __exports__ = (() => {
16032
16161
  }
16033
16162
  return void 0;
16034
16163
  }
16164
+ function normalizeGDALGeoTransform(value) {
16165
+ const coefficients = typeof value === "string" ? value.trim().split(/\s+/).map(Number) : value;
16166
+ if (!Array.isArray(coefficients) || coefficients.length !== 6 || coefficients.some((coefficient) => typeof coefficient !== "number" || !Number.isFinite(coefficient))) {
16167
+ return null;
16168
+ }
16169
+ const [originX, pixelWidth, rotationX, originY, rotationY, pixelHeight] = coefficients;
16170
+ if (pixelWidth === 0 || pixelHeight === 0) return null;
16171
+ return [pixelWidth, rotationX, originX, rotationY, pixelHeight, originY];
16172
+ }
16173
+ function getOMELevelsOrEmpty(attributes, arrayPath) {
16174
+ try {
16175
+ return getSpatialMultiscaleLevels(attributes, arrayPath, { spatialOME: true });
16176
+ } catch {
16177
+ return [];
16178
+ }
16179
+ }
16180
+ function declaresCoordinateReferenceSystem(attributes) {
16181
+ return Boolean(
16182
+ normalizeDeclaredCoordinateReferenceSystem(attributes) || normalizeString(attributes.grid_mapping)
16183
+ );
16184
+ }
16185
+ function isConsistentOMELevel(scale, selectedScale, level, selected) {
16186
+ return selected.spatialDimensions.every((dimension, index) => {
16187
+ const coefficient = index === 0 ? 4 : 0;
16188
+ const expected = Math.abs(scale[dimension] / selectedScale[dimension]);
16189
+ const actual = Math.abs(level.transform[coefficient] / selected.transform[coefficient]);
16190
+ return Number.isFinite(expected) && Math.abs(actual - expected) <= expected * 1e-6;
16191
+ });
16192
+ }
16035
16193
  function getTransformBoundingBox(transform, width, height) {
16036
16194
  const corners = [
16037
16195
  transformPosition(transform, 0, 0),