@loaders.gl/scientific 5.0.0-beta.6 → 5.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +6 -6
- package/dist/netcdf/netcdf-loader.cjs +1 -1
- package/dist/netcdf/netcdf-loader.js +1 -1
- package/dist/netcdf/netcdf-source-loader-types.js +1 -1
- package/dist/netcdf/netcdf-source-loader.js +1 -1
- package/dist/netcdf.min.js +2 -2
- package/dist/npy-loader-types.cjs +1 -1
- package/dist/npy-loader-types.js +1 -1
- package/dist/npy-loader.cjs +1 -1
- package/dist/npy-worker.js +1 -1
- package/dist/nrrd-loader-types.cjs +1 -1
- package/dist/nrrd-loader-types.js +1 -1
- package/dist/vtk-loader-types.cjs +1 -1
- package/dist/vtk-loader-types.js +1 -1
- package/dist/zarr/geo-zarr-source-loader.js +1 -1
- package/dist/zarr/ome-zarr-source-loader.js +1 -1
- package/dist/zarr/zarr-loader-types.cjs +1 -1
- package/dist/zarr/zarr-loader-types.js +1 -1
- package/dist/zarr.min.js +3 -3
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -59,7 +59,7 @@ var NetCDFFormat = {
|
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
// dist/netcdf/netcdf-loader.js
|
|
62
|
-
var VERSION = true ? "5.0.0-beta.
|
|
62
|
+
var VERSION = true ? "5.0.0-beta.7" : "latest";
|
|
63
63
|
async function preload() {
|
|
64
64
|
const { NetCDFLoaderWithParser } = await import("@loaders.gl/scientific/netcdf/netcdf-loader-with-parser");
|
|
65
65
|
return NetCDFLoaderWithParser;
|
|
@@ -90,7 +90,7 @@ var NetCDFLoader = {
|
|
|
90
90
|
var NetCDFWorkerLoader = NetCDFLoader;
|
|
91
91
|
|
|
92
92
|
// dist/netcdf/netcdf-source-loader-types.js
|
|
93
|
-
var VERSION2 = true ? "5.0.0-beta.
|
|
93
|
+
var VERSION2 = true ? "5.0.0-beta.7" : "latest";
|
|
94
94
|
async function preloadNetCDFSourceLoader() {
|
|
95
95
|
const { NetCDFSourceLoaderWithParser } = await import("@loaders.gl/scientific/netcdf/netcdf-source-loader");
|
|
96
96
|
return NetCDFSourceLoaderWithParser;
|
|
@@ -115,7 +115,7 @@ var NetCDFSourceLoader = {
|
|
|
115
115
|
};
|
|
116
116
|
|
|
117
117
|
// dist/zarr/zarr-loader-types.js
|
|
118
|
-
var VERSION3 = true ? "5.0.0-beta.
|
|
118
|
+
var VERSION3 = true ? "5.0.0-beta.7" : "latest";
|
|
119
119
|
var OMEZarrSourceLoader = {
|
|
120
120
|
dataType: null,
|
|
121
121
|
batchType: null,
|
|
@@ -244,7 +244,7 @@ var NPYFormat = {
|
|
|
244
244
|
};
|
|
245
245
|
|
|
246
246
|
// dist/npy-loader-types.js
|
|
247
|
-
var VERSION4 = true ? "5.0.0-beta.
|
|
247
|
+
var VERSION4 = true ? "5.0.0-beta.7" : "latest";
|
|
248
248
|
var NPY_MAGIC_NUMBER = new Uint8Array([147, 78, 85, 77, 80, 89]);
|
|
249
249
|
async function preload2() {
|
|
250
250
|
const { NPYLoaderWithParser } = await import("@loaders.gl/scientific/npy-loader");
|
|
@@ -270,7 +270,7 @@ var NPYLoader = {
|
|
|
270
270
|
var NPYWorkerLoader = NPYLoader;
|
|
271
271
|
|
|
272
272
|
// dist/nrrd-loader-types.js
|
|
273
|
-
var VERSION5 = true ? "5.0.0-beta.
|
|
273
|
+
var VERSION5 = true ? "5.0.0-beta.7" : "latest";
|
|
274
274
|
async function preload3() {
|
|
275
275
|
const { NRRDLoaderWithParser } = await import("@loaders.gl/scientific/nrrd-loader");
|
|
276
276
|
return NRRDLoaderWithParser;
|
|
@@ -290,7 +290,7 @@ var NRRDLoader = {
|
|
|
290
290
|
};
|
|
291
291
|
|
|
292
292
|
// dist/vtk-loader-types.js
|
|
293
|
-
var VERSION6 = true ? "5.0.0-beta.
|
|
293
|
+
var VERSION6 = true ? "5.0.0-beta.7" : "latest";
|
|
294
294
|
async function preload4() {
|
|
295
295
|
const { VTKLoaderWithParser } = await import("@loaders.gl/scientific/vtk-loader");
|
|
296
296
|
return VTKLoaderWithParser;
|
|
@@ -48,7 +48,7 @@ var NetCDFFormat = {
|
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
// dist/netcdf/netcdf-loader.js
|
|
51
|
-
var VERSION = true ? "5.0.0-beta.
|
|
51
|
+
var VERSION = true ? "5.0.0-beta.7" : "latest";
|
|
52
52
|
async function preload() {
|
|
53
53
|
const { NetCDFLoaderWithParser } = await import("@loaders.gl/scientific/netcdf/netcdf-loader-with-parser");
|
|
54
54
|
return NetCDFLoaderWithParser;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { NetCDFFormat } from "./netcdf-format.js";
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof "5.0.0-beta.
|
|
7
|
+
const VERSION = typeof "5.0.0-beta.7" !== 'undefined' ? "5.0.0-beta.7" : 'latest';
|
|
8
8
|
/** Preloads the parser-bearing NetCDF loader implementation. */
|
|
9
9
|
async function preload() {
|
|
10
10
|
const { NetCDFLoaderWithParser } = await import('@loaders.gl/scientific/netcdf/netcdf-loader-with-parser');
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { NetCDFFormat } from "./netcdf-format.js";
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof "5.0.0-beta.
|
|
7
|
+
const VERSION = typeof "5.0.0-beta.7" !== 'undefined' ? "5.0.0-beta.7" : 'latest';
|
|
8
8
|
/** Loads the parser-bearing NetCDF source through its explicit implementation subpath. */
|
|
9
9
|
async function preloadNetCDFSourceLoader() {
|
|
10
10
|
const { NetCDFSourceLoaderWithParser } = await import('@loaders.gl/scientific/netcdf/netcdf-source-loader');
|
|
@@ -6,7 +6,7 @@ import { NetCDFFormat } from "./netcdf-format.js";
|
|
|
6
6
|
import { NetCDFReader } from "./netcdfjs/netcdf-reader.js";
|
|
7
7
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
8
8
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
9
|
-
const VERSION = typeof "5.0.0-beta.
|
|
9
|
+
const VERSION = typeof "5.0.0-beta.7" !== 'undefined' ? "5.0.0-beta.7" : 'latest';
|
|
10
10
|
/**
|
|
11
11
|
* NetCDF classic source with header-only discovery and typed variable/slice execution.
|
|
12
12
|
*/
|
package/dist/netcdf.min.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
else if (typeof exports === 'object') exports['loaders'] = factory();
|
|
6
6
|
else root['loaders'] = factory();})(globalThis, function () {
|
|
7
7
|
"use strict";var __exports__=(()=>{var Wt=Object.create;var Q=Object.defineProperty;var Vt=Object.getOwnPropertyDescriptor;var Gt=Object.getOwnPropertyNames;var Qt=Object.getPrototypeOf,Jt=Object.prototype.hasOwnProperty;var F=(t,e,r)=>()=>{if(r)throw r[0];try{return t&&(e=t(t=0)),e}catch(n){throw r=[n],n}};var Zt=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},Yt=(t,e)=>{for(var r in e)Q(t,r,{get:e[r],enumerable:!0})},rt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Gt(e))!Jt.call(t,s)&&s!==r&&Q(t,s,{get:()=>e[s],enumerable:!(n=Vt(e,s))||n.enumerable});return t};var Kt=(t,e,r)=>(r=t!=null?Wt(Qt(t)):{},rt(e||!t||!t.__esModule?Q(r,"default",{value:t,enumerable:!0}):r,t)),Xt=t=>rt(Q({},"__esModule",{value:!0}),t);var st=Zt((Kr,nt)=>{nt.exports=globalThis.loaders});var te,It=F(()=>{"use strict";te=class t{buffer;byteLength;byteOffset;length;offset;lastWrittenByte;littleEndian;_data;_mark;_marks;textDecoder=new TextDecoder;textEncoder=new TextEncoder;constructor(e=8192,r={}){let n=!1;typeof e=="number"?e=new ArrayBuffer(e):(n=!0,this.lastWrittenByte=e.byteLength);let s=r.offset?r.offset>>>0:0,o=e.byteLength-s,c=s;(ArrayBuffer.isView(e)||e instanceof t)&&(e.byteLength!==e.buffer.byteLength&&(c=e.byteOffset+s),e=e.buffer),n?this.lastWrittenByte=o:this.lastWrittenByte=0,this.buffer=e,this.length=o,this.byteLength=o,this.byteOffset=c,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,c,o),this._mark=0,this._marks=[]}available(e=1){return this.offset+e<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(e=1){return this.offset+=e,this}seek(e){return this.offset=e,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){let e=this._marks.pop();if(e===void 0)throw new Error("Mark stack empty");return this.seek(e),this}rewind(){return this.offset=0,this}ensureAvailable(e=1){if(!this.available(e)){let n=(this.offset+e)*2,s=new Uint8Array(n);s.set(new Uint8Array(this.buffer)),this.buffer=s.buffer,this.length=this.byteLength=n,this._data=new DataView(this.buffer)}return this}readBoolean(){return this.readUint8()!==0}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(e=1){let r=new Uint8Array(e);for(let n=0;n<e;n++)r[n]=this.readByte();return r}readInt16(){let e=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,e}readUint16(){let e=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,e}readInt32(){let e=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,e}readUint32(){let e=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat32(){let e=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,e}readFloat64(){let e=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,e}readChar(){return String.fromCharCode(this.readInt8())}readChars(e=1){let r="";for(let n=0;n<e;n++)r+=this.readChar();return r}readUtf8(e=1){return this.textDecoder.decode(this.readBytes(e))}writeBoolean(e){return this.writeUint8(e?255:0),this}writeInt8(e){return this.ensureAvailable(1),this._data.setInt8(this.offset++,e),this._updateLastWrittenByte(),this}writeUint8(e){return this.ensureAvailable(1),this._data.setUint8(this.offset++,e),this._updateLastWrittenByte(),this}writeByte(e){return this.writeUint8(e)}writeBytes(e){this.ensureAvailable(e.length);for(let r=0;r<e.length;r++)this._data.setUint8(this.offset++,e[r]);return this._updateLastWrittenByte(),this}writeInt16(e){return this.ensureAvailable(2),this._data.setInt16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(e){return this.ensureAvailable(2),this._data.setUint16(this.offset,e,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(e){return this.ensureAvailable(4),this._data.setInt32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(e){return this.ensureAvailable(4),this._data.setUint32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(e){return this.ensureAvailable(4),this._data.setFloat32(this.offset,e,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(e){return this.ensureAvailable(8),this._data.setFloat64(this.offset,e,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(e){return this.writeUint8(e.charCodeAt(0))}writeChars(e){for(let r=0;r<e.length;r++)this.writeUint8(e.charCodeAt(r));return this}writeUtf8(e){let r=this.textEncoder.encode(e);return this.writeBytes(r)}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}});function V(t,e,r){switch(e){case m.BYTE:return t.readBytes(r);case m.CHAR:return vr(t.readChars(r));case m.SHORT:return re(r,t.readInt16.bind(t));case m.INT:return re(r,t.readInt32.bind(t));case m.FLOAT:return re(r,t.readFloat32.bind(t));case m.DOUBLE:return re(r,t.readFloat64.bind(t));default:throw new Error(`NetCDF: non valid type ${e}`)}}function Ve(t){switch(Number(t)){case m.BYTE:return"byte";case m.CHAR:return"char";case m.SHORT:return"short";case m.INT:return"int";case m.FLOAT:return"float";case m.DOUBLE:return"double";default:return"undefined"}}function Ut(t){switch(Number(t)){case m.BYTE:return 1;case m.CHAR:return 1;case m.SHORT:return 2;case m.INT:return 4;case m.FLOAT:return 4;case m.DOUBLE:return 8;default:return-1}}function Ge(t){switch(String(t)){case"byte":return m.BYTE;case"char":return m.CHAR;case"short":return m.SHORT;case"int":return m.INT;case"float":return m.FLOAT;case"double":return m.DOUBLE;default:return-1}}function re(t,e){if(t!==1){let r=new Array(t);for(let n=0;n<t;n++)r[n]=e();return r}return e()}function vr(t){return t.charCodeAt(t.length-1)===0?t.substring(0,t.length-1):t}var m,Qe=F(()=>{"use strict";m={BYTE:1,CHAR:2,SHORT:3,INT:4,FLOAT:5,DOUBLE:6}});function Pt(t,e){let r=t.readUint32(),n=Ur(t),s=Ot(t),o=Pr(t,n.recordId,e);return{version:e,recordDimension:{length:r,id:n.recordId,name:n.recordName,recordStep:o.recordStep},dimensions:n.dimensions,variables:o.variables,attributes:s}}function Ur(t){let e=t.readUint32();if(e===k){if(t.readUint32()!==k)throw new Error("NetCDF: wrong empty tag for list of dimensions");return{recordId:0,recordName:"",dimensions:[]}}if(e!==Lr)throw new Error("NetCDF: wrong tag for list of dimensions");let r=t.readUint32(),n=new Array(r),s,o;for(let c=0;c<r;c++){let l=Je(t),h=t.readUint32();h===Ir&&(s=c,o=l),n[c]={name:l,size:h}}return{dimensions:n,recordId:s,recordName:o}}function Ot(t){let e=t.readUint32();if(e===k){if(t.readUint32()!==k)throw new Error("NetCDF: wrong empty tag for list of attributes");return[]}if(e!==Fr)throw new Error("NetCDF: wrong tag for list of attributes");let r=t.readUint32(),n=new Array(r);for(let s=0;s<r;s++){let o=Je(t),c=t.readUint32();if(c<1||c>6)throw new Error(`NetCDF: non valid type ${c}`);let l=t.readUint32(),h=V(t,c,l);kt(t),n[s]={name:o,type:Ve(c),value:h}}return n}function Pr(t,e,r){let n=t.readUint32(),s=0;if(n===k){if(t.readUint32()!==k)throw new Error("NetCDF: wrong empty tag for list of variables");return{recordStep:s,variables:[]}}if(n!==Dr)throw new Error("NetCDF: wrong tag for list of variables");let o=t.readUint32(),c=new Array(o);for(let l=0;l<o;l++){let h=Je(t),a=t.readUint32(),d=new Array(a);for(let w=0;w<a;w++)d[w]=t.readUint32();let f=Ot(t),u=t.readUint32();if(u<1&&u>6)throw new Error(`NetCDF: non valid type ${u}`);let g=t.readUint32(),p=t.readUint32();if(r===2){if(p>0)throw new Error("NetCDF: offsets larger than 4GB not supported");p=t.readUint32()}let b=!1;typeof e<"u"&&d[0]===e&&(s+=g,b=!0),c[l]={name:h,dimensions:d,attributes:f,type:Ve(u),size:g,offset:p,record:b}}return{variables:c,recordStep:s}}function Je(t){let e=t.readUint32(),r=t.readChars(e);return kt(t),r}function kt(t){t.offset%4!==0&&t.skip(4-t.offset%4)}var k,Lr,Dr,Fr,Ir,jt=F(()=>{"use strict";Qe();k=0,Lr=10,Dr=11,Fr=12,Ir=0});function $t(t,e){let r=Ge(e.type),n=e.size/Ut(r),s=new Array(n);for(let o=0;o<n;o++)s[o]=V(t,r,1);return s}function Ht(t,e,r,n){let s=Ge(e.type),o=e.dimensions.filter(a=>a!==r.id).reduce((a,d)=>a*n[d].size,1),c=r.length,l=new Array(c),h=r.recordStep;for(let a=0;a<c;a++){let d=t.offset;l[a]=V(t,s,o),t.seek(d+h)}return l}var Mt=F(()=>{"use strict";Qe()});var A,Ze=F(()=>{"use strict";It();jt();Mt();A=class{header;buffer;constructor(e){let r=new te(e);r.setBigEndian();let n=r.readChars(3);if(n!=="CDF")throw new Error(`NetCDF: file should start with 'CDF', found ${n}`);let s=r.readByte();if(s>2)throw new Error(`NetCDF: unsupported version ${s}`);this.header=Pt(r,s),this.buffer=r}get version(){return this.header.version===1?"classic format":"64-bit offset format"}get recordDimension(){return this.header.recordDimension}get dimensions(){return this.header.dimensions}get attributes(){return this.header.attributes}get variables(){return this.header.variables}attributeExists(e){return this.attributes.find(n=>n.name===e)!==void 0}getAttribute(e){let r=this.attributes.find(n=>n.name===e);return r?r.value:null}dataVariableExists(e){return this.header.variables.find(function(n){return n.name===e})!==void 0}getDataVariableAsString(e){let r=this.getDataVariable(e);return r?r.join(""):null}getDataVariable(e){let r;if(typeof e=="string"?r=this.header.variables.find(function(n){return n.name===e}):r=e,r===void 0){let n;throw typeof e=="string"?n=e:typeof e=="object"&&(n=JSON.stringify(e)),new Error(`NetCDF: variable not found: ${n}`)}return this.buffer.seek(r.offset),r.record?Ht(this.buffer,r,this.header.recordDimension,this.header.dimensions):$t(this.buffer,r)}toString(){let e=[];e.push("DIMENSIONS");for(let n of this.dimensions)e.push(` ${n.name.padEnd(30)} = size: ${n.size}`);e.push(""),e.push("GLOBAL ATTRIBUTES");for(let n of this.attributes)e.push(` ${n.name.padEnd(30)} = ${n.value}`);let r=JSON.parse(JSON.stringify(this.variables));e.push(""),e.push("VARIABLES:");for(let n of r){n.value=this.getDataVariable(n);let s=JSON.stringify(n.value);s.length>50&&(s=s.substring(0,50)),Number.isNaN(n.value.length)||(s+=` (length: ${n.value.length})`),e.push(` ${n.name.padEnd(30)} = ${s}`)}return e.join(`
|
|
8
|
-
`)}}});var G,Ye=F(()=>{"use strict";G={name:"NetCDF",id:"netcdf",module:"netcdf",encoding:"binary",format:"netcdf",extensions:["cdf","nc"],mimeTypes:["application/x-netcdf"],binary:!0}});var Zr={};Yt(Zr,{FetchError:()=>i.FetchError,JSONLoader:()=>He,NetCDFFormat:()=>G,NetCDFReader:()=>A,NetCDFSourceLoader:()=>se,NullLoader:()=>i.NullLoader,NullWorkerLoader:()=>i.NullWorkerLoader,RequestScheduler:()=>O,_BrowserFileSystem:()=>i._BrowserFileSystem,_fetchProgress:()=>i._fetchProgress,_selectSource:()=>i._selectSource,_unregisterLoaders:()=>i._unregisterLoaders,assert:()=>ae,concatenateArrayBuffersAsync:()=>Fe,coreApi:()=>i.coreApi,createDataSource:()=>i.createDataSource,document:()=>le,encode:()=>i.encode,encodeInBatches:()=>i.encodeInBatches,encodeSync:()=>i.encodeSync,encodeTable:()=>i.encodeTable,encodeTableAsText:()=>i.encodeTableAsText,encodeTableInBatches:()=>i.encodeTableInBatches,encodeText:()=>i.encodeText,encodeTextSync:()=>i.encodeTextSync,encodeURLtoURL:()=>i.encodeURLtoURL,fetchFile:()=>i.fetchFile,forEach:()=>De,getLoaderOptions:()=>i.getLoaderOptions,getPathPrefix:()=>$e,global:()=>fe,isAsyncIterable:()=>Ae,isBrowser:()=>de,isIterable:()=>Ee,isIterator:()=>Se,isPromise:()=>Te,isPureObject:()=>M,isReadableStream:()=>_e,isResponse:()=>Re,isWorker:()=>he,isWritableStream:()=>Ce,load:()=>i.load,loadInBatches:()=>i.loadInBatches,makeIterator:()=>i.makeIterator,makeLineIterator:()=>ve,makeNumberedLineIterator:()=>Le,makeStream:()=>i.makeStream,makeTextDecoderIterator:()=>Ne,makeTextEncoderIterator:()=>Be,parse:()=>i.parse,parseFile:()=>i.parseFile,parseInBatches:()=>i.parseInBatches,parseSync:()=>i.parseSync,preload:()=>i.preload,preloadSync:()=>i.preloadSync,readArrayBuffer:()=>i.readArrayBuffer,registerLoaders:()=>i.registerLoaders,resolvePath:()=>z,selectLoader:()=>i.selectLoader,selectLoaderSync:()=>i.selectLoaderSync,self:()=>ce,setLoaderOptions:()=>i.setLoaderOptions,setPathPrefix:()=>je,window:()=>ue});var i=Kt(st(),1);function ae(t,e){if(!t)throw new Error(e||"loader assertion failed.")}var T={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},ce=T.self||T.window||T.global||{},ue=T.window||T.self||T.global||{},fe=T.global||T.self||T.window||{},le=T.document||{};var de=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),he=typeof importScripts=="function",ot=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),er=ot&&parseFloat(ot[1])||0;var j=globalThis,tr=globalThis.document||{},J=globalThis.process||{},rr=globalThis.console,nr=globalThis.navigator||{};function Z(t){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;let e=typeof navigator<"u"&&navigator.userAgent,r=t||e;return!!(r&&r.indexOf("Electron")>=0)}function _(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Z()}var me="5.0.0";function I(t,e){if(!t)throw new Error(e||"Assertion failed")}function Y(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return I(Number.isFinite(e)&&e>=0),e}function pe(t){let{logLevel:e,message:r}=t;t.logLevel=Y(e);let n=t.args?Array.from(t.args):[];for(;n.length&&n.shift()!==r;);switch(typeof e){case"string":case"function":r!==void 0&&n.unshift(r),t.message=e;break;case"object":Object.assign(t,e);break;default:}typeof t.message=="function"&&(t.message=t.message());let s=typeof t.message;return I(s==="string"||s==="object"),Object.assign(t,{args:n},t.opts)}var C=()=>{},v=class{constructor({level:e=0}={}){this.userData={},this._onceCache=new Set,this._level=e}set level(e){this.setLevel(e)}get level(){return this.getLevel()}setLevel(e){return this._level=e,this}getLevel(){return this._level}warn(e,...r){return this._log("warn",0,e,r,{once:!0})}error(e,...r){return this._log("error",0,e,r)}log(e,r,...n){return this._log("log",e,r,n)}info(e,r,...n){return this._log("info",e,r,n)}once(e,r,...n){return this._log("once",e,r,n,{once:!0})}_log(e,r,n,s,o={}){let c=pe({logLevel:r,message:n,args:this._buildArgs(r,n,s),opts:o});return this._createLogFunction(e,c,o)}_buildArgs(e,r,n){return[e,r,...n]}_createLogFunction(e,r,n){if(!this._shouldLog(r.logLevel))return C;let s=this._getOnceTag(n.tag??r.tag??r.message);if((n.once||r.once)&&s!==void 0){if(this._onceCache.has(s))return C;this._onceCache.add(s)}return this._emit(e,r)}_shouldLog(e){return this.getLevel()>=Y(e)}_getOnceTag(e){if(e!==void 0)try{return typeof e=="string"?e:String(e)}catch{return}}};function or(t){try{let e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch{return null}}var $=class{constructor(e,r,n="sessionStorage"){this.storage=or(n),this.id=e,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let e={};if(this.storage){let r=this.storage.getItem(this.id);e=r?JSON.parse(r):{}}return Object.assign(this.config,e),this}};function it(t){let e;return t<10?e=`${t.toFixed(2)}ms`:t<100?e=`${t.toFixed(1)}ms`:t<1e3?e=`${t.toFixed(0)}ms`:e=`${(t/1e3).toFixed(2)}s`,e}function ge(t,e=8){let r=Math.max(e-t.length,0);return`${" ".repeat(r)}${t}`}var H;(function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(H||(H={}));var ir=10;function at(t){return typeof t!="string"?t:(t=t.toUpperCase(),H[t]||H.WHITE)}function ye(t,e,r){return!_&&typeof t=="string"&&(e&&(t=`\x1B[${at(e)}m${t}\x1B[39m`),r&&(t=`\x1B[${at(r)+ir}m${t}\x1B[49m`)),t}function be(t,e=["constructor"]){let r=Object.getPrototypeOf(t),n=Object.getOwnPropertyNames(r),s=t;for(let o of n){let c=s[o];typeof c=="function"&&(e.find(l=>o===l)||(s[o]=c.bind(t)))}}var K=class{getHighResolutionTimer(){let e;if(_()&&j.performance)e=j?.performance?.now?.();else if("hrtime"in J){let r=J?.hrtime?.();e=r[0]*1e3+r[1]/1e6}else e=Date.now();return e}getMemoryUsageMB(){let r=j?.performance?.memory?.usedJSHeapSize;return r==null?null:Math.trunc(r/1024/1024)}},x=new K;globalThis.Probe=K;globalThis.probe=x;var U={debug:_()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},we={enabled:!0,level:0},E=class extends v{constructor({id:e}={id:""}){super({level:0}),this.VERSION=me,this._startTs=x.getHighResolutionTimer(),this._deltaTs=x.getHighResolutionTimer(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new $(`__probe-${this.id}__`,{[this.id]:we}),this.timeStamp(`${this.id} started`),be(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((x.getHighResolutionTimer()-this._startTs).toPrecision(10))}getDelta(){return Number((x.getHighResolutionTimer()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._updateConfiguration({enabled:e}),this}setLevel(e){return this._updateConfiguration({level:e}),this}get(e){return this._getConfiguration()[e]}set(e,r){this._updateConfiguration({[e]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,r){if(!e)throw new Error(r||"Assertion failed")}warn(e,...r){return this._log("warn",0,e,r,{method:U.warn,once:!0})}error(e,...r){return this._log("error",0,e,r,{method:U.error})}deprecated(e,r){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(e,r){return this.error(`\`${e}\` has been removed. Use \`${r}\` instead`)}probe(e,r,...n){let s=x.getMemoryUsageMB();if(s!==null){let o=`${s}MB `;typeof r=="function"?r=()=>`${o}${r()}`:typeof r=="string"&&(r=`${o}${r}`)}return this._log("log",e,r,n,{method:U.log,time:!0,once:!0})}log(e,r,...n){return this._log("log",e,r,n,{method:U.debug})}info(e,r,...n){return this._log("info",e,r,n,{method:console.info})}once(e,r,...n){return this._log("once",e,r,n,{method:U.debug||U.info,once:!0})}table(e,r,n){return r?this._log("table",e,r,n&&[n]||[],{method:console.table||C,tag:cr(r)}):C}time(e,r){return this._log("time",e,r,[],{method:console.time?console.time:console.info})}timeEnd(e,r){return this._log("time",e,r,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(e,r){return this._log("time",e,r,[],{method:console.timeStamp||C})}group(e,r,n={collapsed:!1}){let s=(n.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",e,r,[],{method:s})}groupCollapsed(e,r,n={}){return this.group(e,r,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._log("groupEnd",e,"",[],{method:console.groupEnd||C})}withGroup(e,r,n){this.group(e,r)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&super._shouldLog(e)}_emit(e,r){let n=r.method;I(n),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=x.getHighResolutionTimer();let s=ar(this.id,r.message,r);return n.bind(console,s,...r.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(we),this._storage.config[this.id]}_updateConfiguration(e){let r=this._storage.config[this.id]||{...we};this._storage.setConfiguration({[this.id]:{...r,...e}})}};E.VERSION=me;function ar(t,e,r){if(typeof e=="string"){let n=r.time?ge(it(r.total)):"";e=r.time?`${t}: ${n} ${e}`:`${t}: ${e}`,e=ye(e,r.color,r.background)}return e}function cr(t){for(let e in t)for(let r in t[e])return r||"untitled";return"empty"}globalThis.probe||(globalThis.probe=x);var ts=new E({id:"@probe.gl/log"});var xe="5.0.0-beta.6",ur=xe[0]>="0"&&xe[0]<="9"?`v${xe}`:"";function fr(){let t=new E({id:"loaders.gl"});return globalThis.loaders||={},globalThis.loaders.log=t,globalThis.loaders.version=ur,globalThis.probe||={},globalThis.probe.loaders=t,t}var ct=fr();var ut=t=>typeof t=="boolean",y=t=>typeof t=="function",N=t=>t!==null&&typeof t=="object",M=t=>N(t)&&t.constructor==={}.constructor;var Te=t=>N(t)&&"then"in t&&y(t.then),Ee=t=>!!t&&y(t[Symbol.iterator]),Ae=t=>!!t&&y(t[Symbol.asyncIterator]),Se=t=>!!t&&y(t.next),Re=t=>typeof Response<"u"&&t instanceof Response||N(t)&&y(t.arrayBuffer)&&y(t.text)&&y(t.json);var ft=t=>N(t)&&y(t.abort)&&y(t.getWriter),lt=t=>typeof ReadableStream<"u"&&t instanceof ReadableStream||N(t)&&y(t.tee)&&y(t.cancel)&&y(t.getReader),dt=t=>N(t)&&y(t.end)&&y(t.write)&&ut(t.writable),ht=t=>N(t)&&y(t.read)&&y(t.pipe)&&ut(t.readable),_e=t=>lt(t)||ht(t),Ce=t=>ft(t)||dt(t);function X(t,e){return mt(t||{},e)}function mt(t,e,r=0){if(r>3)return e;let n={...t};for(let[s,o]of Object.entries(e))M(o)?n[s]=mt(n[s]||{},e[s],r+1):n[s]=e[s];return n}function pt(...t){return lr(t)}function lr(t){let e=t.map(o=>o instanceof ArrayBuffer?new Uint8Array(o):o),r=e.reduce((o,c)=>o+c.byteLength,0),n=new Uint8Array(r),s=0;for(let o of e)n.set(o,s),s+=o.byteLength;return n.buffer}async function*Ne(t,e={}){let r=new TextDecoder(void 0,e);for await(let n of t)yield typeof n=="string"?n:r.decode(n,{stream:!0})}async function*Be(t){let e=new TextEncoder;for await(let r of t)yield typeof r=="string"?e.encode(r).buffer:r}async function*ve(t){let e="";for await(let r of t){e+=r;let n;for(n=e.indexOf(`
|
|
8
|
+
`)}}});var G,Ye=F(()=>{"use strict";G={name:"NetCDF",id:"netcdf",module:"netcdf",encoding:"binary",format:"netcdf",extensions:["cdf","nc"],mimeTypes:["application/x-netcdf"],binary:!0}});var Zr={};Yt(Zr,{FetchError:()=>i.FetchError,JSONLoader:()=>He,NetCDFFormat:()=>G,NetCDFReader:()=>A,NetCDFSourceLoader:()=>se,NullLoader:()=>i.NullLoader,NullWorkerLoader:()=>i.NullWorkerLoader,RequestScheduler:()=>O,_BrowserFileSystem:()=>i._BrowserFileSystem,_fetchProgress:()=>i._fetchProgress,_selectSource:()=>i._selectSource,_unregisterLoaders:()=>i._unregisterLoaders,assert:()=>ae,concatenateArrayBuffersAsync:()=>Fe,coreApi:()=>i.coreApi,createDataSource:()=>i.createDataSource,document:()=>le,encode:()=>i.encode,encodeInBatches:()=>i.encodeInBatches,encodeSync:()=>i.encodeSync,encodeTable:()=>i.encodeTable,encodeTableAsText:()=>i.encodeTableAsText,encodeTableInBatches:()=>i.encodeTableInBatches,encodeText:()=>i.encodeText,encodeTextSync:()=>i.encodeTextSync,encodeURLtoURL:()=>i.encodeURLtoURL,fetchFile:()=>i.fetchFile,forEach:()=>De,getLoaderOptions:()=>i.getLoaderOptions,getPathPrefix:()=>$e,global:()=>fe,isAsyncIterable:()=>Ae,isBrowser:()=>de,isIterable:()=>Ee,isIterator:()=>Se,isPromise:()=>Te,isPureObject:()=>M,isReadableStream:()=>_e,isResponse:()=>Re,isWorker:()=>he,isWritableStream:()=>Ce,load:()=>i.load,loadInBatches:()=>i.loadInBatches,makeIterator:()=>i.makeIterator,makeLineIterator:()=>ve,makeNumberedLineIterator:()=>Le,makeStream:()=>i.makeStream,makeTextDecoderIterator:()=>Ne,makeTextEncoderIterator:()=>Be,parse:()=>i.parse,parseFile:()=>i.parseFile,parseInBatches:()=>i.parseInBatches,parseSync:()=>i.parseSync,preload:()=>i.preload,preloadSync:()=>i.preloadSync,readArrayBuffer:()=>i.readArrayBuffer,registerLoaders:()=>i.registerLoaders,resolvePath:()=>z,selectLoader:()=>i.selectLoader,selectLoaderSync:()=>i.selectLoaderSync,self:()=>ce,setLoaderOptions:()=>i.setLoaderOptions,setPathPrefix:()=>je,window:()=>ue});var i=Kt(st(),1);function ae(t,e){if(!t)throw new Error(e||"loader assertion failed.")}var T={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},ce=T.self||T.window||T.global||{},ue=T.window||T.self||T.global||{},fe=T.global||T.self||T.window||{},le=T.document||{};var de=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),he=typeof importScripts=="function",ot=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),er=ot&&parseFloat(ot[1])||0;var j=globalThis,tr=globalThis.document||{},J=globalThis.process||{},rr=globalThis.console,nr=globalThis.navigator||{};function Z(t){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;let e=typeof navigator<"u"&&navigator.userAgent,r=t||e;return!!(r&&r.indexOf("Electron")>=0)}function _(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||Z()}var me="5.0.0";function I(t,e){if(!t)throw new Error(e||"Assertion failed")}function Y(t){if(!t)return 0;let e;switch(typeof t){case"number":e=t;break;case"object":e=t.logLevel||t.priority||0;break;default:return 0}return I(Number.isFinite(e)&&e>=0),e}function pe(t){let{logLevel:e,message:r}=t;t.logLevel=Y(e);let n=t.args?Array.from(t.args):[];for(;n.length&&n.shift()!==r;);switch(typeof e){case"string":case"function":r!==void 0&&n.unshift(r),t.message=e;break;case"object":Object.assign(t,e);break;default:}typeof t.message=="function"&&(t.message=t.message());let s=typeof t.message;return I(s==="string"||s==="object"),Object.assign(t,{args:n},t.opts)}var C=()=>{},v=class{constructor({level:e=0}={}){this.userData={},this._onceCache=new Set,this._level=e}set level(e){this.setLevel(e)}get level(){return this.getLevel()}setLevel(e){return this._level=e,this}getLevel(){return this._level}warn(e,...r){return this._log("warn",0,e,r,{once:!0})}error(e,...r){return this._log("error",0,e,r)}log(e,r,...n){return this._log("log",e,r,n)}info(e,r,...n){return this._log("info",e,r,n)}once(e,r,...n){return this._log("once",e,r,n,{once:!0})}_log(e,r,n,s,o={}){let c=pe({logLevel:r,message:n,args:this._buildArgs(r,n,s),opts:o});return this._createLogFunction(e,c,o)}_buildArgs(e,r,n){return[e,r,...n]}_createLogFunction(e,r,n){if(!this._shouldLog(r.logLevel))return C;let s=this._getOnceTag(n.tag??r.tag??r.message);if((n.once||r.once)&&s!==void 0){if(this._onceCache.has(s))return C;this._onceCache.add(s)}return this._emit(e,r)}_shouldLog(e){return this.getLevel()>=Y(e)}_getOnceTag(e){if(e!==void 0)try{return typeof e=="string"?e:String(e)}catch{return}}};function or(t){try{let e=window[t],r="__storage_test__";return e.setItem(r,r),e.removeItem(r),e}catch{return null}}var $=class{constructor(e,r,n="sessionStorage"){this.storage=or(n),this.id=e,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(e){if(Object.assign(this.config,e),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let e={};if(this.storage){let r=this.storage.getItem(this.id);e=r?JSON.parse(r):{}}return Object.assign(this.config,e),this}};function it(t){let e;return t<10?e=`${t.toFixed(2)}ms`:t<100?e=`${t.toFixed(1)}ms`:t<1e3?e=`${t.toFixed(0)}ms`:e=`${(t/1e3).toFixed(2)}s`,e}function ge(t,e=8){let r=Math.max(e-t.length,0);return`${" ".repeat(r)}${t}`}var H;(function(t){t[t.BLACK=30]="BLACK",t[t.RED=31]="RED",t[t.GREEN=32]="GREEN",t[t.YELLOW=33]="YELLOW",t[t.BLUE=34]="BLUE",t[t.MAGENTA=35]="MAGENTA",t[t.CYAN=36]="CYAN",t[t.WHITE=37]="WHITE",t[t.BRIGHT_BLACK=90]="BRIGHT_BLACK",t[t.BRIGHT_RED=91]="BRIGHT_RED",t[t.BRIGHT_GREEN=92]="BRIGHT_GREEN",t[t.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",t[t.BRIGHT_BLUE=94]="BRIGHT_BLUE",t[t.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",t[t.BRIGHT_CYAN=96]="BRIGHT_CYAN",t[t.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(H||(H={}));var ir=10;function at(t){return typeof t!="string"?t:(t=t.toUpperCase(),H[t]||H.WHITE)}function ye(t,e,r){return!_&&typeof t=="string"&&(e&&(t=`\x1B[${at(e)}m${t}\x1B[39m`),r&&(t=`\x1B[${at(r)+ir}m${t}\x1B[49m`)),t}function be(t,e=["constructor"]){let r=Object.getPrototypeOf(t),n=Object.getOwnPropertyNames(r),s=t;for(let o of n){let c=s[o];typeof c=="function"&&(e.find(l=>o===l)||(s[o]=c.bind(t)))}}var K=class{getHighResolutionTimer(){let e;if(_()&&j.performance)e=j?.performance?.now?.();else if("hrtime"in J){let r=J?.hrtime?.();e=r[0]*1e3+r[1]/1e6}else e=Date.now();return e}getMemoryUsageMB(){let r=j?.performance?.memory?.usedJSHeapSize;return r==null?null:Math.trunc(r/1024/1024)}},x=new K;globalThis.Probe=K;globalThis.probe=x;var U={debug:_()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},we={enabled:!0,level:0},E=class extends v{constructor({id:e}={id:""}){super({level:0}),this.VERSION=me,this._startTs=x.getHighResolutionTimer(),this._deltaTs=x.getHighResolutionTimer(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=e,this.userData={},this._storage=new $(`__probe-${this.id}__`,{[this.id]:we}),this.timeStamp(`${this.id} started`),be(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((x.getHighResolutionTimer()-this._startTs).toPrecision(10))}getDelta(){return Number((x.getHighResolutionTimer()-this._deltaTs).toPrecision(10))}set priority(e){this.level=e}get priority(){return this.level}getPriority(){return this.level}enable(e=!0){return this._updateConfiguration({enabled:e}),this}setLevel(e){return this._updateConfiguration({level:e}),this}get(e){return this._getConfiguration()[e]}set(e,r){this._updateConfiguration({[e]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(e,r){if(!e)throw new Error(r||"Assertion failed")}warn(e,...r){return this._log("warn",0,e,r,{method:U.warn,once:!0})}error(e,...r){return this._log("error",0,e,r,{method:U.error})}deprecated(e,r){return this.warn(`\`${e}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(e,r){return this.error(`\`${e}\` has been removed. Use \`${r}\` instead`)}probe(e,r,...n){let s=x.getMemoryUsageMB();if(s!==null){let o=`${s}MB `;typeof r=="function"?r=()=>`${o}${r()}`:typeof r=="string"&&(r=`${o}${r}`)}return this._log("log",e,r,n,{method:U.log,time:!0,once:!0})}log(e,r,...n){return this._log("log",e,r,n,{method:U.debug})}info(e,r,...n){return this._log("info",e,r,n,{method:console.info})}once(e,r,...n){return this._log("once",e,r,n,{method:U.debug||U.info,once:!0})}table(e,r,n){return r?this._log("table",e,r,n&&[n]||[],{method:console.table||C,tag:cr(r)}):C}time(e,r){return this._log("time",e,r,[],{method:console.time?console.time:console.info})}timeEnd(e,r){return this._log("time",e,r,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(e,r){return this._log("time",e,r,[],{method:console.timeStamp||C})}group(e,r,n={collapsed:!1}){let s=(n.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",e,r,[],{method:s})}groupCollapsed(e,r,n={}){return this.group(e,r,Object.assign({},n,{collapsed:!0}))}groupEnd(e){return this._log("groupEnd",e,"",[],{method:console.groupEnd||C})}withGroup(e,r,n){this.group(e,r)();try{n()}finally{this.groupEnd(e)()}}trace(){console.trace&&console.trace()}_shouldLog(e){return this.isEnabled()&&super._shouldLog(e)}_emit(e,r){let n=r.method;I(n),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=x.getHighResolutionTimer();let s=ar(this.id,r.message,r);return n.bind(console,s,...r.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(we),this._storage.config[this.id]}_updateConfiguration(e){let r=this._storage.config[this.id]||{...we};this._storage.setConfiguration({[this.id]:{...r,...e}})}};E.VERSION=me;function ar(t,e,r){if(typeof e=="string"){let n=r.time?ge(it(r.total)):"";e=r.time?`${t}: ${n} ${e}`:`${t}: ${e}`,e=ye(e,r.color,r.background)}return e}function cr(t){for(let e in t)for(let r in t[e])return r||"untitled";return"empty"}globalThis.probe||(globalThis.probe=x);var ts=new E({id:"@probe.gl/log"});var xe="5.0.0-beta.7",ur=xe[0]>="0"&&xe[0]<="9"?`v${xe}`:"";function fr(){let t=new E({id:"loaders.gl"});return globalThis.loaders||={},globalThis.loaders.log=t,globalThis.loaders.version=ur,globalThis.probe||={},globalThis.probe.loaders=t,t}var ct=fr();var ut=t=>typeof t=="boolean",y=t=>typeof t=="function",N=t=>t!==null&&typeof t=="object",M=t=>N(t)&&t.constructor==={}.constructor;var Te=t=>N(t)&&"then"in t&&y(t.then),Ee=t=>!!t&&y(t[Symbol.iterator]),Ae=t=>!!t&&y(t[Symbol.asyncIterator]),Se=t=>!!t&&y(t.next),Re=t=>typeof Response<"u"&&t instanceof Response||N(t)&&y(t.arrayBuffer)&&y(t.text)&&y(t.json);var ft=t=>N(t)&&y(t.abort)&&y(t.getWriter),lt=t=>typeof ReadableStream<"u"&&t instanceof ReadableStream||N(t)&&y(t.tee)&&y(t.cancel)&&y(t.getReader),dt=t=>N(t)&&y(t.end)&&y(t.write)&&ut(t.writable),ht=t=>N(t)&&y(t.read)&&y(t.pipe)&&ut(t.readable),_e=t=>lt(t)||ht(t),Ce=t=>ft(t)||dt(t);function X(t,e){return mt(t||{},e)}function mt(t,e,r=0){if(r>3)return e;let n={...t};for(let[s,o]of Object.entries(e))M(o)?n[s]=mt(n[s]||{},e[s],r+1):n[s]=e[s];return n}function pt(...t){return lr(t)}function lr(t){let e=t.map(o=>o instanceof ArrayBuffer?new Uint8Array(o):o),r=e.reduce((o,c)=>o+c.byteLength,0),n=new Uint8Array(r),s=0;for(let o of e)n.set(o,s),s+=o.byteLength;return n.buffer}async function*Ne(t,e={}){let r=new TextDecoder(void 0,e);for await(let n of t)yield typeof n=="string"?n:r.decode(n,{stream:!0})}async function*Be(t){let e=new TextEncoder;for await(let r of t)yield typeof r=="string"?e.encode(r).buffer:r}async function*ve(t){let e="";for await(let r of t){e+=r;let n;for(n=e.indexOf(`
|
|
9
9
|
`);n>=0;){let s=e.slice(0,n+1);e=e.slice(n+1),yield s,n=e.indexOf(`
|
|
10
|
-
`)}}e.length>0&&(yield e)}async function*Le(t){let e=1;for await(let r of t)yield{counter:e,line:r},e++}async function De(t,e){let r=hr(t);for(;;){let{done:n,value:s}=await r.next();if(n){r.return&&r.return();return}if(e(s))return}}async function Fe(t){let e=[];for await(let r of t)e.push(dr(r));return pt(...e)}function dr(t){if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t)){let{buffer:e,byteOffset:r,byteLength:n}=t;return gt(e,r,n)}return gt(t)}function gt(t,e=0,r=t.byteLength-e){let n=new Uint8Array(t,e,r),s=new Uint8Array(n.length);return s.set(n),s.buffer}function hr(t){if(typeof t[Symbol.asyncIterator]=="function")return t[Symbol.asyncIterator]();if(typeof t[Symbol.iterator]=="function"){let e=t[Symbol.iterator]();return mr(e)}return t}function mr(t){return{next(e){return Promise.resolve(t.next(e))},return(e){return typeof t.return=="function"?Promise.resolve(t.return(e)):Promise.resolve({done:!0,value:e})},throw(e){return typeof t.throw=="function"?Promise.resolve(t.throw(e)):Promise.reject(e)}}}function q(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var L=class{constructor(e,r){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=q(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(q()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var P=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,r="count"){return this._getOrCreate({name:e,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let r of Object.values(this.stats))e(r)}getTable(){let e={};return this.forEach(r=>{e[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(r=>this._getOrCreate(r))}_getOrCreate(e){let{name:r,type:n}=e,s=this.stats[r];return s||(e instanceof L?s=e:s=new L(r,n),this.stats[r]=s),s}};var pr="Queued Requests",gr="Active Requests",yr="Cancelled Requests",br="Queued Requests Ever",wr="Active Requests Ever",xr={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},O=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(e={}){this.props={...xr,...e},this.stats=new P({id:this.props.id}),this.stats.get(pr),this.stats.get(gr),this.stats.get(yr),this.stats.get(br),this.stats.get(wr)}setProps(e){e.throttleRequests!==void 0&&(this.props.throttleRequests=e.throttleRequests),e.maxRequests!==void 0&&(this.props.maxRequests=e.maxRequests),e.debounceTime!==void 0&&(this.props.debounceTime=e.debounceTime)}scheduleRequest(e,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);let n={handle:e,priority:0,getPriority:r},s=new Promise(o=>(n.resolve=o,n));return this.requestQueue.push(n),this.requestMap.set(e,s),this._issueNewRequests(),s}_issueRequest(e){let{handle:r,resolve:n}=e,s=!1,o=()=>{s||(s=!0,this.requestMap.delete(r),this.activeRequestCount--,this.scheduleRefill())};return this.activeRequestCount++,n?n({done:o}):Promise.resolve({done:o})}scheduleRefill(){this.updateTimer===null&&(this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(e!==0){this._updateAllRequests();for(let r=0;r<e;++r){let n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){let e=this.requestQueue;for(let r=0;r<e.length;++r){let n=e[r];this._updateRequest(n)||(e.splice(r,1),this.requestMap.delete(n.handle),r--)}e.sort((r,n)=>r.priority-n.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),e.priority<0?(e.resolve(null),!1):!0}};function Ue(t,e=[]){return t.every(Ie)?t:t.map((r,n)=>{if(Ie(r))return r;let s=e.find(c=>c.type===r?.type);if(!s)throw new Error(`No authentication class registered for credential at index ${n}.`);let o;try{o=new s(r)}catch{throw new Error(`Invalid authentication configuration at index ${n}.`)}if(!Ie(o))throw new Error(`Authentication class returned an invalid credential at index ${n}.`);return o})}function Pe(t){if(!t.core?.credentials?.length)return t;let e=Ue(t.core.credentials,t.core.authentications);return e===t.core.credentials?t:{...t,core:{...t.core,credentials:e}}}function Ie(t){return!t||typeof t!="object"||typeof t.id!="string"||!Array.isArray(t.origins)?!1:t.type==="request"?typeof t.authenticate=="function":(t.type==="header"||t.type==="query-parameter")&&typeof t.name=="string"&&(typeof t.token=="string"||typeof t.token=="function")&&Array.isArray(t.refreshStatusCodes)}var yt=Symbol("loaders.gl.authenticated-fetch"),Oe=new WeakMap;function Tr(t){let e=t.fetch||((f,u)=>fetch(f,u)),r=e[yt],n=new Map(r?.credentialResolutions),s=Ue(t.credentials.map(f=>n.get(f)||f),t.authentications);if(t.credentials.forEach((f,u)=>{n.set(f,s[u])}),!t.fetchOptions&&(!s.length||r?.credentials.length===s.length&&s.every((f,u)=>f===r.credentials[u])))return e;let o=r?.fetch||e,c=r?[...new Set([...s,...r.credentials])]:s,l=bt(r?.fetchOptions||{},t.fetchOptions),h=c.filter(f=>f.type!=="request"),a=c.filter(f=>f.type==="request");for(let f of a)At(f.origins);let d=async(f,u={})=>{if(u=bt(l,u),u.signal?.throwIfAborted(),!c.length)return o(f,u);let g=Sr(f),p=g?await xt(g,u,h):{url:f,options:u,credentials:[]},b=await wt(p,a,"request"),w=await o(b.url,b.options),oe=[];for(let B of p.credentials){let{credential:R}=B;typeof R.token=="function"&&(ee(u)||R.canReplayRequest?.(f,u))&&(ee(b.options)||R.canReplayRequest?.(b.url,b.options))&&(R.refreshStatusCodes.includes(w.status)||await R.shouldRefresh?.(w))&&oe.push(B)}let et=ee(u)&&ee(b.options)&&b.credentials.some(B=>B.refreshStatusCodes?.includes(w.status));if(!oe.length&&!et)return w;u.signal?.throwIfAborted();let ie=new Map;if(await Promise.all(oe.map(async({credential:B})=>{let R=await Er(B,f,w);R&&ie.set(B,R)})),!ie.size&&!et)return w;await w.body?.cancel().catch(()=>{}),u.signal?.throwIfAborted();let zt=g?await xt(g,u,h,ie,p.credentials):{url:f,options:u},tt=await wt(zt,a,"retry",w);return o(tt.url,tt.options)};return Object.defineProperty(d,yt,{value:{fetch:o,credentials:c,credentialResolutions:n,fetchOptions:l}}),d}function Tt(t={}){let e=t.fetch??t.core?.fetch,r;typeof e=="function"?r=e:r=(s,o)=>fetch(s,o);let n=typeof e=="object"&&e?e:void 0;return Tr({fetch:r,fetchOptions:t.signal?{...n,signal:t.signal}:n,credentials:t.core?.credentials||[],authentications:t.core?.authentications})}function bt(t,e){let r={...t,...e};if(t.headers||e?.headers){let n=new Headers(t.headers);new Headers(e?.headers).forEach((s,o)=>n.set(o,s)),r.headers=n}return r}async function wt(t,e,r,n){let s=[],o=t.options.signal;for(let c of e){let l=Et(t.url);if(!l||!At(c.origins).includes(l))continue;o?.throwIfAborted();let h=await c.authenticate({url:t.url,options:{...t.options,headers:new Headers(t.options.headers)},reason:r,response:n?{status:n.status,headers:new Headers(n.headers)}:void 0});if(!h||typeof h.url!="string"||!h.options||typeof h.options!="object")throw new Error("Authentication callback returned an invalid request.");t={url:h.url,options:{...h.options,...o?{signal:o}:{}}},s.push(c)}return o?.throwIfAborted(),{...t,credentials:s}}function Et(t){try{let e=new URL(t);return!e.host||e.username||e.password?null:e.origin!=="null"?e.origin:`${e.protocol}//${e.host}`}catch{return null}}function At(t){if(!t.length)throw new Error("Request authentication requires at least one exact origin.");return t.map(e=>{let r=Et(e),n;try{n=new URL(e)}catch{throw new Error("Invalid request authentication origin.")}if(!r||n.pathname&&n.pathname!=="/"||n.search||n.hash)throw new Error("Invalid request authentication origin.");return r})}async function xt(t,e,r,n=new Map,s=[]){let o=new URL(t),c=new Headers(e.headers),l=[],h=new Map(s.map(({credential:a,token:d})=>[a,d]));for(let a of r){if(!a.origins.includes(o.origin))continue;let d=n.get(a),f=h.get(a),u=a.type==="query-parameter"&&f!==void 0,g=a.type==="header"&&f!==void 0;if(a.type==="query-parameter"&&o.searchParams.has(a.name)&&!u||a.type==="header"&&c.has(a.name)&&!g)continue;let p=d??f??await Ar(a.token,{url:t.toString(),reason:"request"});p&&(a.type==="query-parameter"?o.searchParams.set(a.name,p):c.set(a.name,`${a.prefix||""}${p}`),l.push({credential:a,token:p}))}return{url:o.toString(),options:{...e,headers:c},credentials:l}}async function Er(t,e,r){let n=Oe.get(t);if(n)return n;let s=t.token,o=Promise.resolve(s({url:e,reason:"refresh",response:{status:r.status,headers:r.headers}})).finally(()=>Oe.delete(t));return Oe.set(t,o),o}async function Ar(t,e){return typeof t=="function"?t(e):t}function Sr(t){try{let e=new URL(t);return["http:","https:"].includes(e.protocol)?e:null}catch{return null}}function ee(t){let e=(t.method||"GET").toUpperCase();return["GET","HEAD","OPTIONS","PUT","DELETE"].includes(e)?!(t.body&&typeof ReadableStream<"u"&&t.body instanceof ReadableStream):!1}var ke="",St={};function je(t){ke=t}function $e(){return ke}function z(t){for(let e in St)if(t.startsWith(e)){let r=St[e];t=t.replace(e,r)}return!t.startsWith("http://")&&!t.startsWith("https://")&&(t=`${ke}${t}`),t}var Rr="5.0.0-beta.6",He={dataType:null,batchType:null,name:"JSON",id:"json",module:"json",version:Rr,encoding:"json",format:"json",extensions:["json","geojson"],mimeTypes:["application/json"],category:"json",text:!0,parseTextSync:Rt,parse:async t=>Rt(new TextDecoder().decode(t)),options:{}};function Rt(t){return JSON.parse(t)}var _r={fetchFile:D("fetchFile"),parse:D("parse"),parseFile:D("parseFile"),parseSync:D("parseSync"),parseInBatches:D("parseInBatches"),load:D("load"),loadInBatches:D("loadInBatches")},W=class t{static defaultOptions={core:{type:"auto",attributions:[],loaders:[],onError:void 0}};optionsType;options;data;url;name;loadOptions;fetch;coreApi;hasCoreApi;_needsRefresh=!0;constructor(e,r,n,s){this.options=X(X(t.defaultOptions,n||{}),r),this.data=e,this.url=typeof e=="string"?z(e):"",this.name=Nr(e,this.options);let o=Pe(Ct(this.options));this.loadOptions=o;let c=_t(o);this.coreApi=s||_r,this.hasCoreApi=!!s,this.fetch=c}setProps(e){if(e.core?.name!==void 0&&e.core.name!==this.name)throw new Error("Data source names are fixed at creation.");let r=X(this.options,e),n=Pe(Ct(r));this.options=r,this.loadOptions=n,this.fetch=_t(n),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(e=!0){let r=this._needsRefresh;return e&&(this._needsRefresh=!1),r}reportError(e,r){let n=Cr(e,r),s=this.options.core?.onError;return s?s(n,this):ct.warn(`${this.constructor.name}: ${n.message}`)(),n}};function _t(t){return Tt(t)}function Ct(t){if(t.loadOptions!==void 0||t.core?.loadOptions!==void 0)throw new Error("Source loadOptions and core.loadOptions were removed. Use core and root loader namespaces directly.");let e={...t};if(t?.core){e.core={...t.core};let s=e.core;for(let o of["type","name","attributions","loaders","onError","loadOptions"])delete s[o];Object.keys(s).length===0&&delete e.core}let r=typeof e.baseUri=="string"?e.baseUri:void 0,n=typeof e.baseUrl=="string"?e.baseUrl:void 0;return(r!==void 0||n!==void 0)&&(e.core||={},e.core.baseUrl===void 0&&(e.core.baseUrl=n??r),delete e.baseUri,delete e.baseUrl),e}function Cr(t,e){return t instanceof Error?t:typeof t=="string"?new Error(t):new Error(e)}function D(t){return()=>{throw new Error(`CoreAPI.${t} is unavailable. Use @loaders.gl/core.createDataSource().`)}}function Nr(t,e){let r=e.core?.name;if(r!==void 0){if(typeof r!="string"||!r.trim())throw new Error("Data source name must be a non-empty string.");return r}if(t&&typeof t=="object"){let n=t;if(typeof n.name=="string"&&n.name.trim())return t instanceof Blob?Nt(n.name):n.name;let s=n.schema?.metadata,o=s instanceof Map?s.get("name"):s?.name;if(typeof o=="string"&&o.trim())return o}if(typeof t=="string")try{let n=new URL(t.replace(/\\/g,"/"),"https://source.invalid/");if(!["data:","blob:"].includes(n.protocol)){let s=n.pathname.split("/").filter(Boolean).pop();if(s){try{s=decodeURIComponent(s)}catch{}return Nt(s)}}}catch{}return e.core?.type&&e.core.type!=="auto"?e.core.type:"source"}function Nt(t){let e=t.lastIndexOf(".");return e>0?t.slice(0,e):t}function qe(t={}){if(t.coordinateEpoch!==void 0&&!Number.isFinite(t.coordinateEpoch))throw new Error("Spatial reference coordinate epoch must be a finite decimal year");return Object.freeze({crs:Bt(t.crs||{state:"absent",provenance:"unknown"}),vertical:t.vertical?Bt(t.vertical):void 0,coordinateEpoch:t.coordinateEpoch,coordinateFrame:t.coordinateFrame||"unknown",coordinateOrder:Object.freeze([...t.coordinateOrder||[]]),units:t.units?Object.freeze([...t.units]):void 0})}function Bt(t){return t.state==="explicit"||t.state==="default"?Object.freeze({...t,definition:vt(t.definition),alternatives:t.alternatives?Object.freeze(t.alternatives.map(e=>Object.freeze({...e,definition:vt(e.definition)}))):void 0}):Object.freeze({...t})}function vt(t){return typeof t=="string"?t:Me(t)}function Me(t){return Array.isArray(t)?Object.freeze(t.map(e=>Me(e))):t&&typeof t=="object"?Object.freeze(Object.fromEntries(Object.entries(t).map(([e,r])=>[e,Me(r)]))):t}function ze(t){Br(t.queryType,t.execution);let e=Object.freeze({fields:Object.freeze(t.schema.fields.map(n=>Object.freeze({...n,metadata:Object.freeze({...n.metadata})}))),metadata:Object.freeze({...t.schema.metadata})}),r=e.fields.map(n=>Object.freeze({name:n.name,type:n.type,nullable:n.nullable!==!1,role:t.columnRoles?.[n.name]||"attribute",title:Lt(n.metadata,"title"),description:Lt(n.metadata,"description"),metadata:n.metadata||Object.freeze({})}));return Object.freeze({sourceType:t.sourceType,queryType:t.queryType,execution:Object.freeze({...t.execution}),name:t.name,description:t.description,schema:e,columns:Object.freeze(r),capabilities:Object.freeze({...t.capabilities}),spatial:t.spatial?Object.freeze({...t.spatial,bounds:t.spatial.bounds?Object.freeze({minimum:Object.freeze([...t.spatial.bounds.minimum]),maximum:Object.freeze([...t.spatial.bounds.maximum])}):void 0,coordinateReferenceSystems:t.spatial.coordinateReferenceSystems?Object.freeze([...t.spatial.coordinateReferenceSystems]):void 0,spatialReference:t.spatial.spatialReference?qe(t.spatial.spatialReference):void 0}):void 0,statistics:t.statistics?Object.freeze({...t.statistics}):void 0,levels:t.levels?Object.freeze(t.levels.map(n=>Object.freeze({...n,scale:n.scale?Object.freeze([...n.scale]):void 0}))):void 0})}function Br(t,e){if(e.status==="metadata-only"){if(!e.reason.trim())throw new Error("Metadata-only scan support requires a concrete reason");return}if(!{table:["read","query"],raster:["getRaster"],"point-cloud":["scan"]}[t].includes(e.method))throw new Error(`Scan execution method "${e.method}" is not valid for ${t} queries`)}function Lt(t,e){return t?.[e]||void 0}function We(t){if(t.width!==void 0&&Dt(t.width,"width"),t.height!==void 0&&Dt(t.height,"height"),t.level!==void 0&&Ft(t.level,"level"),t.bounds)for(let e=0;e<2;e++){let r=t.bounds[0][e],n=t.bounds[1][e];if(!Number.isFinite(r)||!Number.isFinite(n)||r>n)throw new Error("Raster query bounds must contain finite, ordered coordinates.")}for(let e of t.channels||[])Ft(e,"channel");for(let[e,r]of Object.entries(t.slices||{})){if(!e)throw new Error("Raster query slice names must be non-empty.");if(Array.isArray(r)){if(r.length!==2||!r.every(Number.isFinite)||r[0]>r[1])throw new Error(`Raster query slice ${e} must be an ordered finite range.`)}else if(!Number.isFinite(r))throw new Error(`Raster query slice ${e} must be finite.`)}}function Dt(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`Raster query ${e} must be a positive safe integer.`)}function Ft(t,e){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Raster query ${e} must be a non-negative safe integer.`)}Ze();Ye();Ye();Ze();var Or="5.0.0-beta.6",ne=class t extends W{static HEADER_RANGE_SIZE=64*1024;static MAX_HEADER_RANGE_SIZE=4*1024*1024;headerPromise=null;rasterQueryCapabilities=Object.freeze({bounds:"unsupported",level:"unsupported",variables:"pushdown",slices:"residual",streaming:!1,cancellation:!0});constructor(e,r={}){super(e,r)}async getQueryMetadata(e={}){S(e.signal);let{header:r,byteLength:n}=await this.getHeader(e.signal);S(e.signal);let o={fields:r.variables.map(c=>Gr(c,r)),metadata:Qr(r)};return ze({sourceType:"netcdf",queryType:"raster",execution:{status:"supported",method:"getRaster"},name:typeof this.data=="string"?this.data.split("/").pop():void 0,schema:o,capabilities:{bounds:"unsupported",levelOfDetail:"unsupported",raster:this.rasterQueryCapabilities},statistics:{byteLength:n,rowCount:r.recordDimension.length||void 0}})}async getRaster(e={}){We(e),jr(e),S(e.signal);let r=await this.loadReader(e.signal);S(e.signal),Hr(r.header,e.slices);let s=$r(r.header,e.variables).map(a=>{S(e.signal);let d=a.dimensions.map(b=>r.header.dimensions[b]?.name||`dimension_${b}`),f=a.dimensions.map(b=>Xe(r.header,b)),u=qt(r.getDataVariable(a)),g=Mr(u,d,f,e.slices||{},e.signal),p=Ke(a.type);return{variable:a,dimensionNames:g.dimensionNames,shape:g.shape,data:zr(g.values,p),dtype:p}}),o=s[0];for(let a of s.slice(1))if(a.dtype!==o.dtype||!Vr(a.shape,o.shape))throw new Error("NetCDF raster variables must retain the same shape and numeric type after slicing.");let c=o.shape.at(-1)??1,l=o.shape.length<2?1:o.shape.slice(0,-1).reduce((a,d)=>a*d,1),h=Wr(o.variable);return{data:s.length===1?o.data:s.map(a=>a.data),width:c,height:l,bandCount:s.length,dtype:o.dtype,interleaved:!1,noData:h,metadata:{variables:s.map(a=>a.variable.name),dimensions:o.dimensionNames,shape:o.shape,slices:{...e.slices}}}}async loadReader(e){let r;if(typeof this.data=="string"){let n=await this.fetch(this.url,{signal:e});if(!n.ok)throw new Error(`NetCDF request failed with status ${n.status}.`);r=await n.arrayBuffer()}else r=await this.data.arrayBuffer();return S(e),new A(r)}async getHeader(e){S(e),this.headerPromise||(this.headerPromise=this.loadHeader().catch(n=>{throw this.headerPromise=null,n}));let r=await this.headerPromise;return S(e),r}async loadHeader(){if(typeof this.data!="string"){let o=await this.data.arrayBuffer();return{header:new A(o).header,byteLength:o.byteLength}}let e=t.HEADER_RANGE_SIZE,r=null,n=null,s;for(;e<=t.MAX_HEADER_RANGE_SIZE;){if(r=await this.fetch(this.url,{headers:{Range:`bytes=0-${e-1}`}}),!r.ok)throw new Error(`NetCDF request failed with status ${r.status}.`);n=await r.arrayBuffer();let o=Jr(r,n.byteLength);if(r.status===206&&!r.headers.has("Content-Range")&&n.byteLength===e){let c=await this.fetch(this.url,{method:"HEAD"}),l=c.headers.get("Content-Length");if(await c.body?.cancel(),c.status!==200||!l||!/^\d+$/.test(l)||!Number.isSafeInteger(Number(l))||Number(l)<n.byteLength)throw new Error("NetCDF file size unavailable: expose Content-Range or provide HEAD Content-Length");o=Number(l)}try{return{header:new A(n).header,byteLength:o}}catch(c){if(s=c,r.status!==206||n.byteLength<e)throw c;e*=2}}throw s||new Error("NetCDF header exceeds the maximum metadata range.")}},se={dataType:null,batchType:null,...G,module:"scientific",name:"NetCDFSourceLoader",version:Or,type:"netcdf-source",fromUrl:!0,fromBlob:!0,options:{},defaultOptions:{},testURL:t=>/\.(?:cdf|nc)(?:$|[?#])/i.test(t),createDataSource:(t,e)=>new ne(t,e)};function kr(t){switch(t.toLowerCase()){case"byte":return"int8";case"ubyte":return"uint8";case"short":return"int16";case"ushort":return"uint16";case"int":return"int32";case"uint":return"uint32";case"int64":return"int64";case"uint64":return"uint64";case"float":return"float32";case"double":return"float64";case"char":case"string":return"utf8";default:return"binary"}}function jr(t){if(t.bounds)throw new Error("NetCDF raster bounds are not supported.");if(t.level!==void 0)throw new Error("NetCDF raster levels are not supported.");if(t.width!==void 0||t.height!==void 0)throw new Error("NetCDF raster resampling is not supported.");if(t.channels?.length)throw new Error("NetCDF uses named variables instead of numeric channels.")}function $r(t,e){let r=t.variables.find(s=>s.dimensions.length>0&&qr(s.type)),n=e?.length?[...e]:r?[r.name]:[];if(n.length===0)throw new Error("NetCDF contains no numeric variables that can be read as raster data.");if(new Set(n).size!==n.length)throw new Error("NetCDF raster variables must not contain duplicates.");return n.map(s=>{let o=t.variables.find(c=>c.name===s);if(!o)throw new Error(`NetCDF variable not found: ${s}`);return Ke(o.type),o})}function Hr(t,e){let r=new Set(t.dimensions.map(n=>n.name));for(let n of Object.keys(e||{}))if(!r.has(n))throw new Error(`NetCDF dimension not found: ${n}`)}function Mr(t,e,r,n,s){let o=e.map((a,d)=>{let f=r[d],u=n[a];if(u===void 0)return{start:0,stop:f,remove:!1};if(typeof u!="number"){let[g,p]=u;if(!Number.isSafeInteger(g)||!Number.isSafeInteger(p)||g<0||p<g||p>f)throw new Error(`NetCDF slice ${a} must be a valid half-open range within 0..${f}.`);return{start:g,stop:p,remove:!1}}if(!Number.isSafeInteger(u)||u<0||u>=f)throw new Error(`NetCDF slice ${a} must be an index within 0..${f-1}.`);return{start:u,stop:u+1,remove:!0}}),c=r.map((a,d)=>r.slice(d+1).reduce((f,u)=>f*u,1)),l=[],h=(a,d)=>{if(S(s),a===o.length){let u=t[d];if(typeof u!="number")throw new Error("NetCDF raster variables must contain numeric values.");l.push(u);return}let f=o[a];for(let u=f.start;u<f.stop;u++)h(a+1,d+u*c[a])};return h(0,0),{values:l,dimensionNames:e.filter((a,d)=>!o[d].remove),shape:o.map(a=>a.stop-a.start).filter((a,d)=>!o[d].remove)}}function qt(t){return Array.isArray(t)?t.flatMap(qt):ArrayBuffer.isView(t)?Array.from(t):[t]}function qr(t){try{return Ke(t),!0}catch{return!1}}function Ke(t){switch(t.toLowerCase()){case"byte":return"int8";case"ubyte":return"uint8";case"short":return"int16";case"ushort":return"uint16";case"int":return"int32";case"uint":return"uint32";case"float":return"float32";case"double":return"float64";default:throw new Error(`NetCDF variable type is not supported as raster data: ${t}`)}}function zr(t,e){switch(e){case"int8":return Int8Array.from(t);case"uint8":return Uint8Array.from(t);case"int16":return Int16Array.from(t);case"uint16":return Uint16Array.from(t);case"int32":return Int32Array.from(t);case"uint32":return Uint32Array.from(t);case"float32":return Float32Array.from(t);case"float64":return Float64Array.from(t)}}function Wr(t){let e=t.attributes.find(n=>n.name==="_FillValue"||n.name==="missing_value"),r=Number(e?.value);return e&&Number.isFinite(r)?r:null}function Vr(t,e){return t.length===e.length&&t.every((r,n)=>r===e[n])}function Gr(t,e){let n={dimensions:t.dimensions.map(s=>e.dimensions[s]).filter(Boolean).map((s,o)=>`${s.name}[${Xe(e,t.dimensions[o])}]`).join(",")};for(let s of t.attributes)n[s.name]=String(s.value);return{name:t.name,type:kr(t.type),nullable:!0,metadata:n}}function Qr(t){let e={};for(let[r,n]of t.dimensions.entries())e[`dimension:${n.name}`]=String(Xe(t,r));return e}function Xe(t,e){let r=t.dimensions[e];return e===t.recordDimension.id?t.recordDimension.length:r?.size||0}function Jr(t,e){let n=t.headers.get("content-range")?.match(/\/([0-9]+)$/)?.[1];return Number(n||t.headers.get("content-length")||e)}function S(t){if(t?.aborted)throw new DOMException("The operation was aborted","AbortError")}return Xt(Zr);})();
|
|
10
|
+
`)}}e.length>0&&(yield e)}async function*Le(t){let e=1;for await(let r of t)yield{counter:e,line:r},e++}async function De(t,e){let r=hr(t);for(;;){let{done:n,value:s}=await r.next();if(n){r.return&&r.return();return}if(e(s))return}}async function Fe(t){let e=[];for await(let r of t)e.push(dr(r));return pt(...e)}function dr(t){if(t instanceof ArrayBuffer)return t;if(ArrayBuffer.isView(t)){let{buffer:e,byteOffset:r,byteLength:n}=t;return gt(e,r,n)}return gt(t)}function gt(t,e=0,r=t.byteLength-e){let n=new Uint8Array(t,e,r),s=new Uint8Array(n.length);return s.set(n),s.buffer}function hr(t){if(typeof t[Symbol.asyncIterator]=="function")return t[Symbol.asyncIterator]();if(typeof t[Symbol.iterator]=="function"){let e=t[Symbol.iterator]();return mr(e)}return t}function mr(t){return{next(e){return Promise.resolve(t.next(e))},return(e){return typeof t.return=="function"?Promise.resolve(t.return(e)):Promise.resolve({done:!0,value:e})},throw(e){return typeof t.throw=="function"?Promise.resolve(t.throw(e)):Promise.reject(e)}}}function q(){let t;if(typeof window<"u"&&window.performance)t=window.performance.now();else if(typeof process<"u"&&process.hrtime){let e=process.hrtime();t=e[0]*1e3+e[1]/1e6}else t=Date.now();return t}var L=class{constructor(e,r){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=e,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(e){return this.sampleSize=e,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(e){return this._count+=e,this._samples++,this._checkSampling(),this}subtractCount(e){return this._count-=e,this._samples++,this._checkSampling(),this}addTime(e){return this._time+=e,this.lastTiming=e,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=q(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(q()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}};var P=class{constructor(e){this.stats={},this.id=e.id,this.stats={},this._initializeStats(e.stats),Object.seal(this)}get(e,r="count"){return this._getOrCreate({name:e,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let e of Object.values(this.stats))e.reset();return this}forEach(e){for(let r of Object.values(this.stats))e(r)}getTable(){let e={};return this.forEach(r=>{e[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),e}_initializeStats(e=[]){e.forEach(r=>this._getOrCreate(r))}_getOrCreate(e){let{name:r,type:n}=e,s=this.stats[r];return s||(e instanceof L?s=e:s=new L(r,n),this.stats[r]=s),s}};var pr="Queued Requests",gr="Active Requests",yr="Cancelled Requests",br="Queued Requests Ever",wr="Active Requests Ever",xr={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},O=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(e={}){this.props={...xr,...e},this.stats=new P({id:this.props.id}),this.stats.get(pr),this.stats.get(gr),this.stats.get(yr),this.stats.get(br),this.stats.get(wr)}setProps(e){e.throttleRequests!==void 0&&(this.props.throttleRequests=e.throttleRequests),e.maxRequests!==void 0&&(this.props.maxRequests=e.maxRequests),e.debounceTime!==void 0&&(this.props.debounceTime=e.debounceTime)}scheduleRequest(e,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(e))return this.requestMap.get(e);let n={handle:e,priority:0,getPriority:r},s=new Promise(o=>(n.resolve=o,n));return this.requestQueue.push(n),this.requestMap.set(e,s),this._issueNewRequests(),s}_issueRequest(e){let{handle:r,resolve:n}=e,s=!1,o=()=>{s||(s=!0,this.requestMap.delete(r),this.activeRequestCount--,this.scheduleRefill())};return this.activeRequestCount++,n?n({done:o}):Promise.resolve({done:o})}scheduleRefill(){this.updateTimer===null&&(this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let e=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(e!==0){this._updateAllRequests();for(let r=0;r<e;++r){let n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){let e=this.requestQueue;for(let r=0;r<e.length;++r){let n=e[r];this._updateRequest(n)||(e.splice(r,1),this.requestMap.delete(n.handle),r--)}e.sort((r,n)=>r.priority-n.priority)}_updateRequest(e){return e.priority=e.getPriority(e.handle),e.priority<0?(e.resolve(null),!1):!0}};function Ue(t,e=[]){return t.every(Ie)?t:t.map((r,n)=>{if(Ie(r))return r;let s=e.find(c=>c.type===r?.type);if(!s)throw new Error(`No authentication class registered for credential at index ${n}.`);let o;try{o=new s(r)}catch{throw new Error(`Invalid authentication configuration at index ${n}.`)}if(!Ie(o))throw new Error(`Authentication class returned an invalid credential at index ${n}.`);return o})}function Pe(t){if(!t.core?.credentials?.length)return t;let e=Ue(t.core.credentials,t.core.authentications);return e===t.core.credentials?t:{...t,core:{...t.core,credentials:e}}}function Ie(t){return!t||typeof t!="object"||typeof t.id!="string"||!Array.isArray(t.origins)?!1:t.type==="request"?typeof t.authenticate=="function":(t.type==="header"||t.type==="query-parameter")&&typeof t.name=="string"&&(typeof t.token=="string"||typeof t.token=="function")&&Array.isArray(t.refreshStatusCodes)}var yt=Symbol("loaders.gl.authenticated-fetch"),Oe=new WeakMap;function Tr(t){let e=t.fetch||((f,u)=>fetch(f,u)),r=e[yt],n=new Map(r?.credentialResolutions),s=Ue(t.credentials.map(f=>n.get(f)||f),t.authentications);if(t.credentials.forEach((f,u)=>{n.set(f,s[u])}),!t.fetchOptions&&(!s.length||r?.credentials.length===s.length&&s.every((f,u)=>f===r.credentials[u])))return e;let o=r?.fetch||e,c=r?[...new Set([...s,...r.credentials])]:s,l=bt(r?.fetchOptions||{},t.fetchOptions),h=c.filter(f=>f.type!=="request"),a=c.filter(f=>f.type==="request");for(let f of a)At(f.origins);let d=async(f,u={})=>{if(u=bt(l,u),u.signal?.throwIfAborted(),!c.length)return o(f,u);let g=Sr(f),p=g?await xt(g,u,h):{url:f,options:u,credentials:[]},b=await wt(p,a,"request"),w=await o(b.url,b.options),oe=[];for(let B of p.credentials){let{credential:R}=B;typeof R.token=="function"&&(ee(u)||R.canReplayRequest?.(f,u))&&(ee(b.options)||R.canReplayRequest?.(b.url,b.options))&&(R.refreshStatusCodes.includes(w.status)||await R.shouldRefresh?.(w))&&oe.push(B)}let et=ee(u)&&ee(b.options)&&b.credentials.some(B=>B.refreshStatusCodes?.includes(w.status));if(!oe.length&&!et)return w;u.signal?.throwIfAborted();let ie=new Map;if(await Promise.all(oe.map(async({credential:B})=>{let R=await Er(B,f,w);R&&ie.set(B,R)})),!ie.size&&!et)return w;await w.body?.cancel().catch(()=>{}),u.signal?.throwIfAborted();let zt=g?await xt(g,u,h,ie,p.credentials):{url:f,options:u},tt=await wt(zt,a,"retry",w);return o(tt.url,tt.options)};return Object.defineProperty(d,yt,{value:{fetch:o,credentials:c,credentialResolutions:n,fetchOptions:l}}),d}function Tt(t={}){let e=t.fetch??t.core?.fetch,r;typeof e=="function"?r=e:r=(s,o)=>fetch(s,o);let n=typeof e=="object"&&e?e:void 0;return Tr({fetch:r,fetchOptions:t.signal?{...n,signal:t.signal}:n,credentials:t.core?.credentials||[],authentications:t.core?.authentications})}function bt(t,e){let r={...t,...e};if(t.headers||e?.headers){let n=new Headers(t.headers);new Headers(e?.headers).forEach((s,o)=>n.set(o,s)),r.headers=n}return r}async function wt(t,e,r,n){let s=[],o=t.options.signal;for(let c of e){let l=Et(t.url);if(!l||!At(c.origins).includes(l))continue;o?.throwIfAborted();let h=await c.authenticate({url:t.url,options:{...t.options,headers:new Headers(t.options.headers)},reason:r,response:n?{status:n.status,headers:new Headers(n.headers)}:void 0});if(!h||typeof h.url!="string"||!h.options||typeof h.options!="object")throw new Error("Authentication callback returned an invalid request.");t={url:h.url,options:{...h.options,...o?{signal:o}:{}}},s.push(c)}return o?.throwIfAborted(),{...t,credentials:s}}function Et(t){try{let e=new URL(t);return!e.host||e.username||e.password?null:e.origin!=="null"?e.origin:`${e.protocol}//${e.host}`}catch{return null}}function At(t){if(!t.length)throw new Error("Request authentication requires at least one exact origin.");return t.map(e=>{let r=Et(e),n;try{n=new URL(e)}catch{throw new Error("Invalid request authentication origin.")}if(!r||n.pathname&&n.pathname!=="/"||n.search||n.hash)throw new Error("Invalid request authentication origin.");return r})}async function xt(t,e,r,n=new Map,s=[]){let o=new URL(t),c=new Headers(e.headers),l=[],h=new Map(s.map(({credential:a,token:d})=>[a,d]));for(let a of r){if(!a.origins.includes(o.origin))continue;let d=n.get(a),f=h.get(a),u=a.type==="query-parameter"&&f!==void 0,g=a.type==="header"&&f!==void 0;if(a.type==="query-parameter"&&o.searchParams.has(a.name)&&!u||a.type==="header"&&c.has(a.name)&&!g)continue;let p=d??f??await Ar(a.token,{url:t.toString(),reason:"request"});p&&(a.type==="query-parameter"?o.searchParams.set(a.name,p):c.set(a.name,`${a.prefix||""}${p}`),l.push({credential:a,token:p}))}return{url:o.toString(),options:{...e,headers:c},credentials:l}}async function Er(t,e,r){let n=Oe.get(t);if(n)return n;let s=t.token,o=Promise.resolve(s({url:e,reason:"refresh",response:{status:r.status,headers:r.headers}})).finally(()=>Oe.delete(t));return Oe.set(t,o),o}async function Ar(t,e){return typeof t=="function"?t(e):t}function Sr(t){try{let e=new URL(t);return["http:","https:"].includes(e.protocol)?e:null}catch{return null}}function ee(t){let e=(t.method||"GET").toUpperCase();return["GET","HEAD","OPTIONS","PUT","DELETE"].includes(e)?!(t.body&&typeof ReadableStream<"u"&&t.body instanceof ReadableStream):!1}var ke="",St={};function je(t){ke=t}function $e(){return ke}function z(t){for(let e in St)if(t.startsWith(e)){let r=St[e];t=t.replace(e,r)}return!t.startsWith("http://")&&!t.startsWith("https://")&&(t=`${ke}${t}`),t}var Rr="5.0.0-beta.7",He={dataType:null,batchType:null,name:"JSON",id:"json",module:"json",version:Rr,encoding:"json",format:"json",extensions:["json","geojson"],mimeTypes:["application/json"],category:"json",text:!0,parseTextSync:Rt,parse:async t=>Rt(new TextDecoder().decode(t)),options:{}};function Rt(t){return JSON.parse(t)}var _r={fetchFile:D("fetchFile"),parse:D("parse"),parseFile:D("parseFile"),parseSync:D("parseSync"),parseInBatches:D("parseInBatches"),load:D("load"),loadInBatches:D("loadInBatches")},W=class t{static defaultOptions={core:{type:"auto",attributions:[],loaders:[],onError:void 0}};optionsType;options;data;url;name;loadOptions;fetch;coreApi;hasCoreApi;_needsRefresh=!0;constructor(e,r,n,s){this.options=X(X(t.defaultOptions,n||{}),r),this.data=e,this.url=typeof e=="string"?z(e):"",this.name=Nr(e,this.options);let o=Pe(Ct(this.options));this.loadOptions=o;let c=_t(o);this.coreApi=s||_r,this.hasCoreApi=!!s,this.fetch=c}setProps(e){if(e.core?.name!==void 0&&e.core.name!==this.name)throw new Error("Data source names are fixed at creation.");let r=X(this.options,e),n=Pe(Ct(r));this.options=r,this.loadOptions=n,this.fetch=_t(n),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(e=!0){let r=this._needsRefresh;return e&&(this._needsRefresh=!1),r}reportError(e,r){let n=Cr(e,r),s=this.options.core?.onError;return s?s(n,this):ct.warn(`${this.constructor.name}: ${n.message}`)(),n}};function _t(t){return Tt(t)}function Ct(t){if(t.loadOptions!==void 0||t.core?.loadOptions!==void 0)throw new Error("Source loadOptions and core.loadOptions were removed. Use core and root loader namespaces directly.");let e={...t};if(t?.core){e.core={...t.core};let s=e.core;for(let o of["type","name","attributions","loaders","onError","loadOptions"])delete s[o];Object.keys(s).length===0&&delete e.core}let r=typeof e.baseUri=="string"?e.baseUri:void 0,n=typeof e.baseUrl=="string"?e.baseUrl:void 0;return(r!==void 0||n!==void 0)&&(e.core||={},e.core.baseUrl===void 0&&(e.core.baseUrl=n??r),delete e.baseUri,delete e.baseUrl),e}function Cr(t,e){return t instanceof Error?t:typeof t=="string"?new Error(t):new Error(e)}function D(t){return()=>{throw new Error(`CoreAPI.${t} is unavailable. Use @loaders.gl/core.createDataSource().`)}}function Nr(t,e){let r=e.core?.name;if(r!==void 0){if(typeof r!="string"||!r.trim())throw new Error("Data source name must be a non-empty string.");return r}if(t&&typeof t=="object"){let n=t;if(typeof n.name=="string"&&n.name.trim())return t instanceof Blob?Nt(n.name):n.name;let s=n.schema?.metadata,o=s instanceof Map?s.get("name"):s?.name;if(typeof o=="string"&&o.trim())return o}if(typeof t=="string")try{let n=new URL(t.replace(/\\/g,"/"),"https://source.invalid/");if(!["data:","blob:"].includes(n.protocol)){let s=n.pathname.split("/").filter(Boolean).pop();if(s){try{s=decodeURIComponent(s)}catch{}return Nt(s)}}}catch{}return e.core?.type&&e.core.type!=="auto"?e.core.type:"source"}function Nt(t){let e=t.lastIndexOf(".");return e>0?t.slice(0,e):t}function qe(t={}){if(t.coordinateEpoch!==void 0&&!Number.isFinite(t.coordinateEpoch))throw new Error("Spatial reference coordinate epoch must be a finite decimal year");return Object.freeze({crs:Bt(t.crs||{state:"absent",provenance:"unknown"}),vertical:t.vertical?Bt(t.vertical):void 0,coordinateEpoch:t.coordinateEpoch,coordinateFrame:t.coordinateFrame||"unknown",coordinateOrder:Object.freeze([...t.coordinateOrder||[]]),units:t.units?Object.freeze([...t.units]):void 0})}function Bt(t){return t.state==="explicit"||t.state==="default"?Object.freeze({...t,definition:vt(t.definition),alternatives:t.alternatives?Object.freeze(t.alternatives.map(e=>Object.freeze({...e,definition:vt(e.definition)}))):void 0}):Object.freeze({...t})}function vt(t){return typeof t=="string"?t:Me(t)}function Me(t){return Array.isArray(t)?Object.freeze(t.map(e=>Me(e))):t&&typeof t=="object"?Object.freeze(Object.fromEntries(Object.entries(t).map(([e,r])=>[e,Me(r)]))):t}function ze(t){Br(t.queryType,t.execution);let e=Object.freeze({fields:Object.freeze(t.schema.fields.map(n=>Object.freeze({...n,metadata:Object.freeze({...n.metadata})}))),metadata:Object.freeze({...t.schema.metadata})}),r=e.fields.map(n=>Object.freeze({name:n.name,type:n.type,nullable:n.nullable!==!1,role:t.columnRoles?.[n.name]||"attribute",title:Lt(n.metadata,"title"),description:Lt(n.metadata,"description"),metadata:n.metadata||Object.freeze({})}));return Object.freeze({sourceType:t.sourceType,queryType:t.queryType,execution:Object.freeze({...t.execution}),name:t.name,description:t.description,schema:e,columns:Object.freeze(r),capabilities:Object.freeze({...t.capabilities}),spatial:t.spatial?Object.freeze({...t.spatial,bounds:t.spatial.bounds?Object.freeze({minimum:Object.freeze([...t.spatial.bounds.minimum]),maximum:Object.freeze([...t.spatial.bounds.maximum])}):void 0,coordinateReferenceSystems:t.spatial.coordinateReferenceSystems?Object.freeze([...t.spatial.coordinateReferenceSystems]):void 0,spatialReference:t.spatial.spatialReference?qe(t.spatial.spatialReference):void 0}):void 0,statistics:t.statistics?Object.freeze({...t.statistics}):void 0,levels:t.levels?Object.freeze(t.levels.map(n=>Object.freeze({...n,scale:n.scale?Object.freeze([...n.scale]):void 0}))):void 0})}function Br(t,e){if(e.status==="metadata-only"){if(!e.reason.trim())throw new Error("Metadata-only scan support requires a concrete reason");return}if(!{table:["read","query"],raster:["getRaster"],"point-cloud":["scan"]}[t].includes(e.method))throw new Error(`Scan execution method "${e.method}" is not valid for ${t} queries`)}function Lt(t,e){return t?.[e]||void 0}function We(t){if(t.width!==void 0&&Dt(t.width,"width"),t.height!==void 0&&Dt(t.height,"height"),t.level!==void 0&&Ft(t.level,"level"),t.bounds)for(let e=0;e<2;e++){let r=t.bounds[0][e],n=t.bounds[1][e];if(!Number.isFinite(r)||!Number.isFinite(n)||r>n)throw new Error("Raster query bounds must contain finite, ordered coordinates.")}for(let e of t.channels||[])Ft(e,"channel");for(let[e,r]of Object.entries(t.slices||{})){if(!e)throw new Error("Raster query slice names must be non-empty.");if(Array.isArray(r)){if(r.length!==2||!r.every(Number.isFinite)||r[0]>r[1])throw new Error(`Raster query slice ${e} must be an ordered finite range.`)}else if(!Number.isFinite(r))throw new Error(`Raster query slice ${e} must be finite.`)}}function Dt(t,e){if(!Number.isSafeInteger(t)||t<1)throw new Error(`Raster query ${e} must be a positive safe integer.`)}function Ft(t,e){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Raster query ${e} must be a non-negative safe integer.`)}Ze();Ye();Ye();Ze();var Or="5.0.0-beta.7",ne=class t extends W{static HEADER_RANGE_SIZE=64*1024;static MAX_HEADER_RANGE_SIZE=4*1024*1024;headerPromise=null;rasterQueryCapabilities=Object.freeze({bounds:"unsupported",level:"unsupported",variables:"pushdown",slices:"residual",streaming:!1,cancellation:!0});constructor(e,r={}){super(e,r)}async getQueryMetadata(e={}){S(e.signal);let{header:r,byteLength:n}=await this.getHeader(e.signal);S(e.signal);let o={fields:r.variables.map(c=>Gr(c,r)),metadata:Qr(r)};return ze({sourceType:"netcdf",queryType:"raster",execution:{status:"supported",method:"getRaster"},name:typeof this.data=="string"?this.data.split("/").pop():void 0,schema:o,capabilities:{bounds:"unsupported",levelOfDetail:"unsupported",raster:this.rasterQueryCapabilities},statistics:{byteLength:n,rowCount:r.recordDimension.length||void 0}})}async getRaster(e={}){We(e),jr(e),S(e.signal);let r=await this.loadReader(e.signal);S(e.signal),Hr(r.header,e.slices);let s=$r(r.header,e.variables).map(a=>{S(e.signal);let d=a.dimensions.map(b=>r.header.dimensions[b]?.name||`dimension_${b}`),f=a.dimensions.map(b=>Xe(r.header,b)),u=qt(r.getDataVariable(a)),g=Mr(u,d,f,e.slices||{},e.signal),p=Ke(a.type);return{variable:a,dimensionNames:g.dimensionNames,shape:g.shape,data:zr(g.values,p),dtype:p}}),o=s[0];for(let a of s.slice(1))if(a.dtype!==o.dtype||!Vr(a.shape,o.shape))throw new Error("NetCDF raster variables must retain the same shape and numeric type after slicing.");let c=o.shape.at(-1)??1,l=o.shape.length<2?1:o.shape.slice(0,-1).reduce((a,d)=>a*d,1),h=Wr(o.variable);return{data:s.length===1?o.data:s.map(a=>a.data),width:c,height:l,bandCount:s.length,dtype:o.dtype,interleaved:!1,noData:h,metadata:{variables:s.map(a=>a.variable.name),dimensions:o.dimensionNames,shape:o.shape,slices:{...e.slices}}}}async loadReader(e){let r;if(typeof this.data=="string"){let n=await this.fetch(this.url,{signal:e});if(!n.ok)throw new Error(`NetCDF request failed with status ${n.status}.`);r=await n.arrayBuffer()}else r=await this.data.arrayBuffer();return S(e),new A(r)}async getHeader(e){S(e),this.headerPromise||(this.headerPromise=this.loadHeader().catch(n=>{throw this.headerPromise=null,n}));let r=await this.headerPromise;return S(e),r}async loadHeader(){if(typeof this.data!="string"){let o=await this.data.arrayBuffer();return{header:new A(o).header,byteLength:o.byteLength}}let e=t.HEADER_RANGE_SIZE,r=null,n=null,s;for(;e<=t.MAX_HEADER_RANGE_SIZE;){if(r=await this.fetch(this.url,{headers:{Range:`bytes=0-${e-1}`}}),!r.ok)throw new Error(`NetCDF request failed with status ${r.status}.`);n=await r.arrayBuffer();let o=Jr(r,n.byteLength);if(r.status===206&&!r.headers.has("Content-Range")&&n.byteLength===e){let c=await this.fetch(this.url,{method:"HEAD"}),l=c.headers.get("Content-Length");if(await c.body?.cancel(),c.status!==200||!l||!/^\d+$/.test(l)||!Number.isSafeInteger(Number(l))||Number(l)<n.byteLength)throw new Error("NetCDF file size unavailable: expose Content-Range or provide HEAD Content-Length");o=Number(l)}try{return{header:new A(n).header,byteLength:o}}catch(c){if(s=c,r.status!==206||n.byteLength<e)throw c;e*=2}}throw s||new Error("NetCDF header exceeds the maximum metadata range.")}},se={dataType:null,batchType:null,...G,module:"scientific",name:"NetCDFSourceLoader",version:Or,type:"netcdf-source",fromUrl:!0,fromBlob:!0,options:{},defaultOptions:{},testURL:t=>/\.(?:cdf|nc)(?:$|[?#])/i.test(t),createDataSource:(t,e)=>new ne(t,e)};function kr(t){switch(t.toLowerCase()){case"byte":return"int8";case"ubyte":return"uint8";case"short":return"int16";case"ushort":return"uint16";case"int":return"int32";case"uint":return"uint32";case"int64":return"int64";case"uint64":return"uint64";case"float":return"float32";case"double":return"float64";case"char":case"string":return"utf8";default:return"binary"}}function jr(t){if(t.bounds)throw new Error("NetCDF raster bounds are not supported.");if(t.level!==void 0)throw new Error("NetCDF raster levels are not supported.");if(t.width!==void 0||t.height!==void 0)throw new Error("NetCDF raster resampling is not supported.");if(t.channels?.length)throw new Error("NetCDF uses named variables instead of numeric channels.")}function $r(t,e){let r=t.variables.find(s=>s.dimensions.length>0&&qr(s.type)),n=e?.length?[...e]:r?[r.name]:[];if(n.length===0)throw new Error("NetCDF contains no numeric variables that can be read as raster data.");if(new Set(n).size!==n.length)throw new Error("NetCDF raster variables must not contain duplicates.");return n.map(s=>{let o=t.variables.find(c=>c.name===s);if(!o)throw new Error(`NetCDF variable not found: ${s}`);return Ke(o.type),o})}function Hr(t,e){let r=new Set(t.dimensions.map(n=>n.name));for(let n of Object.keys(e||{}))if(!r.has(n))throw new Error(`NetCDF dimension not found: ${n}`)}function Mr(t,e,r,n,s){let o=e.map((a,d)=>{let f=r[d],u=n[a];if(u===void 0)return{start:0,stop:f,remove:!1};if(typeof u!="number"){let[g,p]=u;if(!Number.isSafeInteger(g)||!Number.isSafeInteger(p)||g<0||p<g||p>f)throw new Error(`NetCDF slice ${a} must be a valid half-open range within 0..${f}.`);return{start:g,stop:p,remove:!1}}if(!Number.isSafeInteger(u)||u<0||u>=f)throw new Error(`NetCDF slice ${a} must be an index within 0..${f-1}.`);return{start:u,stop:u+1,remove:!0}}),c=r.map((a,d)=>r.slice(d+1).reduce((f,u)=>f*u,1)),l=[],h=(a,d)=>{if(S(s),a===o.length){let u=t[d];if(typeof u!="number")throw new Error("NetCDF raster variables must contain numeric values.");l.push(u);return}let f=o[a];for(let u=f.start;u<f.stop;u++)h(a+1,d+u*c[a])};return h(0,0),{values:l,dimensionNames:e.filter((a,d)=>!o[d].remove),shape:o.map(a=>a.stop-a.start).filter((a,d)=>!o[d].remove)}}function qt(t){return Array.isArray(t)?t.flatMap(qt):ArrayBuffer.isView(t)?Array.from(t):[t]}function qr(t){try{return Ke(t),!0}catch{return!1}}function Ke(t){switch(t.toLowerCase()){case"byte":return"int8";case"ubyte":return"uint8";case"short":return"int16";case"ushort":return"uint16";case"int":return"int32";case"uint":return"uint32";case"float":return"float32";case"double":return"float64";default:throw new Error(`NetCDF variable type is not supported as raster data: ${t}`)}}function zr(t,e){switch(e){case"int8":return Int8Array.from(t);case"uint8":return Uint8Array.from(t);case"int16":return Int16Array.from(t);case"uint16":return Uint16Array.from(t);case"int32":return Int32Array.from(t);case"uint32":return Uint32Array.from(t);case"float32":return Float32Array.from(t);case"float64":return Float64Array.from(t)}}function Wr(t){let e=t.attributes.find(n=>n.name==="_FillValue"||n.name==="missing_value"),r=Number(e?.value);return e&&Number.isFinite(r)?r:null}function Vr(t,e){return t.length===e.length&&t.every((r,n)=>r===e[n])}function Gr(t,e){let n={dimensions:t.dimensions.map(s=>e.dimensions[s]).filter(Boolean).map((s,o)=>`${s.name}[${Xe(e,t.dimensions[o])}]`).join(",")};for(let s of t.attributes)n[s.name]=String(s.value);return{name:t.name,type:kr(t.type),nullable:!0,metadata:n}}function Qr(t){let e={};for(let[r,n]of t.dimensions.entries())e[`dimension:${n.name}`]=String(Xe(t,r));return e}function Xe(t,e){let r=t.dimensions[e];return e===t.recordDimension.id?t.recordDimension.length:r?.size||0}function Jr(t,e){let n=t.headers.get("content-range")?.match(/\/([0-9]+)$/)?.[1];return Number(n||t.headers.get("content-length")||e)}function S(t){if(t?.aborted)throw new DOMException("The operation was aborted","AbortError")}return Xt(Zr);})();
|
|
11
11
|
return __exports__;
|
|
12
12
|
});
|
|
@@ -48,7 +48,7 @@ var NPYFormat = {
|
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
// dist/npy-loader-types.js
|
|
51
|
-
var VERSION = true ? "5.0.0-beta.
|
|
51
|
+
var VERSION = true ? "5.0.0-beta.7" : "latest";
|
|
52
52
|
var NPY_MAGIC_NUMBER = new Uint8Array([147, 78, 85, 77, 80, 89]);
|
|
53
53
|
async function preload() {
|
|
54
54
|
const { NPYLoaderWithParser } = await import("@loaders.gl/scientific/npy-loader");
|
package/dist/npy-loader-types.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
import { NPYFormat } from "./npy-format.js";
|
|
5
5
|
// @ts-ignore __VERSION__ is injected by the package build.
|
|
6
|
-
const VERSION = typeof "5.0.0-beta.
|
|
6
|
+
const VERSION = typeof "5.0.0-beta.7" !== 'undefined' ? "5.0.0-beta.7" : 'latest';
|
|
7
7
|
// \x93NUMPY
|
|
8
8
|
const NPY_MAGIC_NUMBER = new Uint8Array([147, 78, 85, 77, 80, 89]);
|
|
9
9
|
/** Preloads the parser-bearing NPY loader implementation. */
|
package/dist/npy-loader.cjs
CHANGED
|
@@ -239,7 +239,7 @@ var NPYFormat = {
|
|
|
239
239
|
};
|
|
240
240
|
|
|
241
241
|
// dist/npy-loader-types.js
|
|
242
|
-
var VERSION2 = true ? "5.0.0-beta.
|
|
242
|
+
var VERSION2 = true ? "5.0.0-beta.7" : "latest";
|
|
243
243
|
var NPY_MAGIC_NUMBER2 = new Uint8Array([147, 78, 85, 77, 80, 89]);
|
|
244
244
|
async function preload2() {
|
|
245
245
|
const { NPYLoaderWithParser: NPYLoaderWithParser3 } = await Promise.resolve().then(() => (init_npy_loader(), npy_loader_exports));
|
package/dist/npy-worker.js
CHANGED
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"src/npy-loader-types.ts"() {
|
|
109
109
|
"use strict";
|
|
110
110
|
init_npy_format();
|
|
111
|
-
VERSION = true ? "5.0.0-beta.
|
|
111
|
+
VERSION = true ? "5.0.0-beta.7" : "latest";
|
|
112
112
|
NPY_MAGIC_NUMBER = new Uint8Array([147, 78, 85, 77, 80, 89]);
|
|
113
113
|
NPYLoader = {
|
|
114
114
|
...NPYFormat,
|
|
@@ -33,7 +33,7 @@ __export(nrrd_loader_types_exports, {
|
|
|
33
33
|
NRRDLoader: () => NRRDLoader
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(nrrd_loader_types_exports);
|
|
36
|
-
var VERSION = true ? "5.0.0-beta.
|
|
36
|
+
var VERSION = true ? "5.0.0-beta.7" : "latest";
|
|
37
37
|
async function preload() {
|
|
38
38
|
const { NRRDLoaderWithParser } = await import("@loaders.gl/scientific/nrrd-loader");
|
|
39
39
|
return NRRDLoaderWithParser;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) vis.gl contributors
|
|
3
3
|
/** Package version injected by the build. */
|
|
4
4
|
// @ts-ignore __VERSION__ is injected during compilation.
|
|
5
|
-
const VERSION = typeof "5.0.0-beta.
|
|
5
|
+
const VERSION = typeof "5.0.0-beta.7" !== 'undefined' ? "5.0.0-beta.7" : 'latest';
|
|
6
6
|
/** Loads the attached NRRD parser on demand. */
|
|
7
7
|
async function preload() {
|
|
8
8
|
const { NRRDLoaderWithParser } = await import('@loaders.gl/scientific/nrrd-loader');
|
|
@@ -33,7 +33,7 @@ __export(vtk_loader_types_exports, {
|
|
|
33
33
|
VTKLoader: () => VTKLoader
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(vtk_loader_types_exports);
|
|
36
|
-
var VERSION = true ? "5.0.0-beta.
|
|
36
|
+
var VERSION = true ? "5.0.0-beta.7" : "latest";
|
|
37
37
|
async function preload() {
|
|
38
38
|
const { VTKLoaderWithParser } = await import("@loaders.gl/scientific/vtk-loader");
|
|
39
39
|
return VTKLoaderWithParser;
|
package/dist/vtk-loader-types.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright (c) vis.gl contributors
|
|
3
3
|
/** Package version injected by the build. */
|
|
4
4
|
// @ts-ignore __VERSION__ is injected during compilation.
|
|
5
|
-
const VERSION = typeof "5.0.0-beta.
|
|
5
|
+
const VERSION = typeof "5.0.0-beta.7" !== 'undefined' ? "5.0.0-beta.7" : 'latest';
|
|
6
6
|
/** Loads the existing VTK readers on demand. */
|
|
7
7
|
async function preload() {
|
|
8
8
|
const { VTKLoaderWithParser } = await import('@loaders.gl/scientific/vtk-loader');
|
|
@@ -8,7 +8,7 @@ import { ZarrSource } from "./ome-zarr-source-loader.js";
|
|
|
8
8
|
import { cloneZarrSelection, getCachedZarrSelection, getZarrSelectionKey } from "./lib/zarr-data-cache.js";
|
|
9
9
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
10
10
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
11
|
-
const VERSION = typeof "5.0.0-beta.
|
|
11
|
+
const VERSION = typeof "5.0.0-beta.7" !== 'undefined' ? "5.0.0-beta.7" : 'latest';
|
|
12
12
|
/** Source factory for GeoZarr and regular CF/xarray Zarr raster arrays. */
|
|
13
13
|
export const GeoZarrSourceLoaderWithParser = {
|
|
14
14
|
dataType: null,
|
|
@@ -8,7 +8,7 @@ import ZarritaPixelSource from "./lib/zarrita-pixel-source.js";
|
|
|
8
8
|
import { loadConsolidatedMetadata } from "./lib/consolidated-zarr.js";
|
|
9
9
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
10
10
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
11
|
-
const VERSION = typeof "5.0.0-beta.
|
|
11
|
+
const VERSION = typeof "5.0.0-beta.7" !== 'undefined' ? "5.0.0-beta.7" : 'latest';
|
|
12
12
|
/**
|
|
13
13
|
* Loads consolidated metadata for a Zarr store root and extracts top-level arrays and groups.
|
|
14
14
|
*/
|
|
@@ -36,7 +36,7 @@ __export(zarr_loader_types_exports, {
|
|
|
36
36
|
ZarrArraySourceLoader: () => ZarrArraySourceLoader
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(zarr_loader_types_exports);
|
|
39
|
-
var VERSION = true ? "5.0.0-beta.
|
|
39
|
+
var VERSION = true ? "5.0.0-beta.7" : "latest";
|
|
40
40
|
var OMEZarrSourceLoader = {
|
|
41
41
|
dataType: null,
|
|
42
42
|
batchType: null,
|
|
@@ -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-beta.
|
|
6
|
+
const VERSION = typeof "5.0.0-beta.7" !== 'undefined' ? "5.0.0-beta.7" : 'latest';
|
|
7
7
|
/** Metadata-only OME-Zarr loader. */
|
|
8
8
|
export const OMEZarrSourceLoader = {
|
|
9
9
|
dataType: null,
|