@oceanum/datamesh 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/dist/lib/connector.d.ts.map +1 -1
- package/dist/lib/datamodel.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
Use "options.replacer" or "options.ignoreUnknown"
|
|
7
7
|
`)},_domwindow:function(){return S("domwindow")},_bigint:function(w){return S("bigint:"+w.toString())},_process:function(){return S("process")},_timer:function(){return S("timer")},_pipe:function(){return S("pipe")},_tcp:function(){return S("tcp")},_udp:function(){return S("udp")},_tty:function(){return S("tty")},_statwatcher:function(){return S("statwatcher")},_securecontext:function(){return S("securecontext")},_connection:function(){return S("connection")},_zlib:function(){return S("zlib")},_context:function(){return S("context")},_nodescript:function(){return S("nodescript")},_httpparser:function(){return S("httpparser")},_dataview:function(){return S("dataview")},_signal:function(){return S("signal")},_fsevent:function(){return S("fsevent")},_tlswrap:function(){return S("tlswrap")}}}function G(){return{buf:"",write:function(A){this.buf+=A},end:function(A){this.buf+=A},read:function(){return this.buf}}}s.writeToStream=function(A,N,m){return m===void 0&&(m=N,N={}),V(N=C(A,N),m).dispatch(A)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_9a5aa49d.js","/")},{buffer:3,crypto:5,lYpoI2:11}],2:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){(function(M){var U=typeof Uint8Array<"u"?Uint8Array:Array,F=43,O=47,C=48,P=97,V=65,G=45,A=95;function N(m){return m=m.charCodeAt(0),m===F||m===G?62:m===O||m===A?63:m<C?-1:m<C+10?m-C+26+26:m<V+26?m-V:m<P+26?m-P+26:void 0}M.toByteArray=function(m){var S,w;if(0<m.length%4)throw new Error("Invalid string. Length must be a multiple of 4");var v=m.length,v=m.charAt(v-2)==="="?2:m.charAt(v-1)==="="?1:0,k=new U(3*m.length/4-v),Q=0<v?m.length-4:m.length,z=0;function R(D){k[z++]=D}for(S=0;S<Q;S+=4,0)R((16711680&(w=N(m.charAt(S))<<18|N(m.charAt(S+1))<<12|N(m.charAt(S+2))<<6|N(m.charAt(S+3))))>>16),R((65280&w)>>8),R(255&w);return v==2?R(255&(w=N(m.charAt(S))<<2|N(m.charAt(S+1))>>4)):v==1&&(R((w=N(m.charAt(S))<<10|N(m.charAt(S+1))<<4|N(m.charAt(S+2))>>2)>>8&255),R(255&w)),k},M.fromByteArray=function(m){var S,w,v,k,Q=m.length%3,z="";function R(D){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(D)}for(S=0,v=m.length-Q;S<v;S+=3)w=(m[S]<<16)+(m[S+1]<<8)+m[S+2],z+=R((k=w)>>18&63)+R(k>>12&63)+R(k>>6&63)+R(63&k);switch(Q){case 1:z=(z+=R((w=m[m.length-1])>>2))+R(w<<4&63)+"==";break;case 2:z=(z=(z+=R((w=(m[m.length-2]<<8)+m[m.length-1])>>10))+R(w>>4&63))+R(w<<2&63)+"="}return z}})(s===void 0?this.base64js={}:s)}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(e,n,s){(function(i,c,F,d,f,y,B,L,x){var M=e("base64-js"),U=e("ieee754");function F(g,_,T){if(!(this instanceof F))return new F(g,_,T);var j,$,J,bt,Ot=typeof g;if(_==="base64"&&Ot=="string")for(g=(bt=g).trim?bt.trim():bt.replace(/^\s+|\s+$/g,"");g.length%4!=0;)g+="=";if(Ot=="number")j=Z(g);else if(Ot=="string")j=F.byteLength(g,_);else{if(Ot!="object")throw new Error("First argument needs to be a number, array or string.");j=Z(g.length)}if(F._useTypedArrays?$=F._augment(new Uint8Array(j)):(($=this).length=j,$._isBuffer=!0),F._useTypedArrays&&typeof g.byteLength=="number")$._set(g);else if(X(bt=g)||F.isBuffer(bt)||bt&&typeof bt=="object"&&typeof bt.length=="number")for(J=0;J<j;J++)F.isBuffer(g)?$[J]=g.readUInt8(J):$[J]=g[J];else if(Ot=="string")$.write(g,0,_);else if(Ot=="number"&&!F._useTypedArrays&&!T)for(J=0;J<j;J++)$[J]=0;return $}function O(g,_,T,j){return F._charsWritten=At(function($){for(var J=[],bt=0;bt<$.length;bt++)J.push(255&$.charCodeAt(bt));return J}(_),g,T,j)}function C(g,_,T,j){return F._charsWritten=At(function($){for(var J,bt,Ot=[],kt=0;kt<$.length;kt++)bt=$.charCodeAt(kt),J=bt>>8,bt=bt%256,Ot.push(bt),Ot.push(J);return Ot}(_),g,T,j)}function P(g,_,T){var j="";T=Math.min(g.length,T);for(var $=_;$<T;$++)j+=String.fromCharCode(g[$]);return j}function V(g,_,T,J){J||(W(typeof T=="boolean","missing or invalid endian"),W(_!=null,"missing offset"),W(_+1<g.length,"Trying to read beyond buffer length"));var $,J=g.length;if(!(J<=_))return T?($=g[_],_+1<J&&($|=g[_+1]<<8)):($=g[_]<<8,_+1<J&&($|=g[_+1])),$}function G(g,_,T,J){J||(W(typeof T=="boolean","missing or invalid endian"),W(_!=null,"missing offset"),W(_+3<g.length,"Trying to read beyond buffer length"));var $,J=g.length;if(!(J<=_))return T?(_+2<J&&($=g[_+2]<<16),_+1<J&&($|=g[_+1]<<8),$|=g[_],_+3<J&&($+=g[_+3]<<24>>>0)):(_+1<J&&($=g[_+1]<<16),_+2<J&&($|=g[_+2]<<8),_+3<J&&($|=g[_+3]),$+=g[_]<<24>>>0),$}function A(g,_,T,j){if(j||(W(typeof T=="boolean","missing or invalid endian"),W(_!=null,"missing offset"),W(_+1<g.length,"Trying to read beyond buffer length")),!(g.length<=_))return j=V(g,_,T,!0),32768&j?-1*(65535-j+1):j}function N(g,_,T,j){if(j||(W(typeof T=="boolean","missing or invalid endian"),W(_!=null,"missing offset"),W(_+3<g.length,"Trying to read beyond buffer length")),!(g.length<=_))return j=G(g,_,T,!0),2147483648&j?-1*(4294967295-j+1):j}function m(g,_,T,j){return j||(W(typeof T=="boolean","missing or invalid endian"),W(_+3<g.length,"Trying to read beyond buffer length")),U.read(g,_,T,23,4)}function S(g,_,T,j){return j||(W(typeof T=="boolean","missing or invalid endian"),W(_+7<g.length,"Trying to read beyond buffer length")),U.read(g,_,T,52,8)}function w(g,_,T,j,$){if($||(W(_!=null,"missing value"),W(typeof j=="boolean","missing or invalid endian"),W(T!=null,"missing offset"),W(T+1<g.length,"trying to write beyond buffer length"),Pt(_,65535)),$=g.length,!($<=T))for(var J=0,bt=Math.min($-T,2);J<bt;J++)g[T+J]=(_&255<<8*(j?J:1-J))>>>8*(j?J:1-J)}function v(g,_,T,j,$){if($||(W(_!=null,"missing value"),W(typeof j=="boolean","missing or invalid endian"),W(T!=null,"missing offset"),W(T+3<g.length,"trying to write beyond buffer length"),Pt(_,4294967295)),$=g.length,!($<=T))for(var J=0,bt=Math.min($-T,4);J<bt;J++)g[T+J]=_>>>8*(j?J:3-J)&255}function k(g,_,T,j,$){$||(W(_!=null,"missing value"),W(typeof j=="boolean","missing or invalid endian"),W(T!=null,"missing offset"),W(T+1<g.length,"Trying to write beyond buffer length"),Zt(_,32767,-32768)),g.length<=T||w(g,0<=_?_:65535+_+1,T,j,$)}function Q(g,_,T,j,$){$||(W(_!=null,"missing value"),W(typeof j=="boolean","missing or invalid endian"),W(T!=null,"missing offset"),W(T+3<g.length,"Trying to write beyond buffer length"),Zt(_,2147483647,-2147483648)),g.length<=T||v(g,0<=_?_:4294967295+_+1,T,j,$)}function z(g,_,T,j,$){$||(W(_!=null,"missing value"),W(typeof j=="boolean","missing or invalid endian"),W(T!=null,"missing offset"),W(T+3<g.length,"Trying to write beyond buffer length"),Gt(_,34028234663852886e22,-34028234663852886e22)),g.length<=T||U.write(g,_,T,j,23,4)}function R(g,_,T,j,$){$||(W(_!=null,"missing value"),W(typeof j=="boolean","missing or invalid endian"),W(T!=null,"missing offset"),W(T+7<g.length,"Trying to write beyond buffer length"),Gt(_,17976931348623157e292,-17976931348623157e292)),g.length<=T||U.write(g,_,T,j,52,8)}s.Buffer=F,s.SlowBuffer=F,s.INSPECT_MAX_BYTES=50,F.poolSize=8192,F._useTypedArrays=function(){try{var g=new ArrayBuffer(0),_=new Uint8Array(g);return _.foo=function(){return 42},_.foo()===42&&typeof _.subarray=="function"}catch{return!1}}(),F.isEncoding=function(g){switch(String(g).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},F.isBuffer=function(g){return!(g==null||!g._isBuffer)},F.byteLength=function(g,_){var T;switch(g+="",_||"utf8"){case"hex":T=g.length/2;break;case"utf8":case"utf-8":T=q(g).length;break;case"ascii":case"binary":case"raw":T=g.length;break;case"base64":T=rt(g).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":T=2*g.length;break;default:throw new Error("Unknown encoding")}return T},F.concat=function(g,_){if(W(X(g),`Usage: Buffer.concat(list, [totalLength])
|
|
8
8
|
list should be an Array.`),g.length===0)return new F(0);if(g.length===1)return g[0];if(typeof _!="number")for($=_=0;$<g.length;$++)_+=g[$].length;for(var T=new F(_),j=0,$=0;$<g.length;$++){var J=g[$];J.copy(T,j),j+=J.length}return T},F.prototype.write=function(g,_,T,j){isFinite(_)?isFinite(T)||(j=T,T=void 0):(kt=j,j=_,_=T,T=kt),_=Number(_)||0;var $,J,bt,Ot,kt=this.length-_;switch((!T||kt<(T=Number(T)))&&(T=kt),j=String(j||"utf8").toLowerCase()){case"hex":$=function(Ht,Vt,$t,Nt){$t=Number($t)||0;var mt=Ht.length-$t;(!Nt||mt<(Nt=Number(Nt)))&&(Nt=mt),W((mt=Vt.length)%2==0,"Invalid hex string"),mt/2<Nt&&(Nt=mt/2);for(var Qt=0;Qt<Nt;Qt++){var sr=parseInt(Vt.substr(2*Qt,2),16);W(!isNaN(sr),"Invalid hex string"),Ht[$t+Qt]=sr}return F._charsWritten=2*Qt,Qt}(this,g,_,T);break;case"utf8":case"utf-8":J=this,bt=_,Ot=T,$=F._charsWritten=At(q(g),J,bt,Ot);break;case"ascii":case"binary":$=O(this,g,_,T);break;case"base64":J=this,bt=_,Ot=T,$=F._charsWritten=At(rt(g),J,bt,Ot);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":$=C(this,g,_,T);break;default:throw new Error("Unknown encoding")}return $},F.prototype.toString=function(g,_,T){var j,$,J,bt,Ot=this;if(g=String(g||"utf8").toLowerCase(),_=Number(_)||0,(T=T!==void 0?Number(T):Ot.length)===_)return"";switch(g){case"hex":j=function(kt,Ht,Vt){var $t=kt.length;(!Ht||Ht<0)&&(Ht=0),(!Vt||Vt<0||$t<Vt)&&(Vt=$t);for(var Nt="",mt=Ht;mt<Vt;mt++)Nt+=K(kt[mt]);return Nt}(Ot,_,T);break;case"utf8":case"utf-8":j=function(kt,Ht,Vt){var $t="",Nt="";Vt=Math.min(kt.length,Vt);for(var mt=Ht;mt<Vt;mt++)kt[mt]<=127?($t+=Ut(Nt)+String.fromCharCode(kt[mt]),Nt=""):Nt+="%"+kt[mt].toString(16);return $t+Ut(Nt)}(Ot,_,T);break;case"ascii":case"binary":j=P(Ot,_,T);break;case"base64":$=Ot,bt=T,j=(J=_)===0&&bt===$.length?M.fromByteArray($):M.fromByteArray($.slice(J,bt));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":j=function(kt,Ht,Vt){for(var $t=kt.slice(Ht,Vt),Nt="",mt=0;mt<$t.length;mt+=2)Nt+=String.fromCharCode($t[mt]+256*$t[mt+1]);return Nt}(Ot,_,T);break;default:throw new Error("Unknown encoding")}return j},F.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},F.prototype.copy=function(g,_,T,j){if(_=_||0,(j=j||j===0?j:this.length)!==(T=T||0)&&g.length!==0&&this.length!==0){W(T<=j,"sourceEnd < sourceStart"),W(0<=_&&_<g.length,"targetStart out of bounds"),W(0<=T&&T<this.length,"sourceStart out of bounds"),W(0<=j&&j<=this.length,"sourceEnd out of bounds"),j>this.length&&(j=this.length);var $=(j=g.length-_<j-T?g.length-_+T:j)-T;if($<100||!F._useTypedArrays)for(var J=0;J<$;J++)g[J+_]=this[J+T];else g._set(this.subarray(T,T+$),_)}},F.prototype.slice=function(g,_){var T=this.length;if(g=Y(g,T,0),_=Y(_,T,T),F._useTypedArrays)return F._augment(this.subarray(g,_));for(var j=_-g,$=new F(j,void 0,!0),J=0;J<j;J++)$[J]=this[J+g];return $},F.prototype.get=function(g){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(g)},F.prototype.set=function(g,_){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(g,_)},F.prototype.readUInt8=function(g,_){if(_||(W(g!=null,"missing offset"),W(g<this.length,"Trying to read beyond buffer length")),!(g>=this.length))return this[g]},F.prototype.readUInt16LE=function(g,_){return V(this,g,!0,_)},F.prototype.readUInt16BE=function(g,_){return V(this,g,!1,_)},F.prototype.readUInt32LE=function(g,_){return G(this,g,!0,_)},F.prototype.readUInt32BE=function(g,_){return G(this,g,!1,_)},F.prototype.readInt8=function(g,_){if(_||(W(g!=null,"missing offset"),W(g<this.length,"Trying to read beyond buffer length")),!(g>=this.length))return 128&this[g]?-1*(255-this[g]+1):this[g]},F.prototype.readInt16LE=function(g,_){return A(this,g,!0,_)},F.prototype.readInt16BE=function(g,_){return A(this,g,!1,_)},F.prototype.readInt32LE=function(g,_){return N(this,g,!0,_)},F.prototype.readInt32BE=function(g,_){return N(this,g,!1,_)},F.prototype.readFloatLE=function(g,_){return m(this,g,!0,_)},F.prototype.readFloatBE=function(g,_){return m(this,g,!1,_)},F.prototype.readDoubleLE=function(g,_){return S(this,g,!0,_)},F.prototype.readDoubleBE=function(g,_){return S(this,g,!1,_)},F.prototype.writeUInt8=function(g,_,T){T||(W(g!=null,"missing value"),W(_!=null,"missing offset"),W(_<this.length,"trying to write beyond buffer length"),Pt(g,255)),_>=this.length||(this[_]=g)},F.prototype.writeUInt16LE=function(g,_,T){w(this,g,_,!0,T)},F.prototype.writeUInt16BE=function(g,_,T){w(this,g,_,!1,T)},F.prototype.writeUInt32LE=function(g,_,T){v(this,g,_,!0,T)},F.prototype.writeUInt32BE=function(g,_,T){v(this,g,_,!1,T)},F.prototype.writeInt8=function(g,_,T){T||(W(g!=null,"missing value"),W(_!=null,"missing offset"),W(_<this.length,"Trying to write beyond buffer length"),Zt(g,127,-128)),_>=this.length||(0<=g?this.writeUInt8(g,_,T):this.writeUInt8(255+g+1,_,T))},F.prototype.writeInt16LE=function(g,_,T){k(this,g,_,!0,T)},F.prototype.writeInt16BE=function(g,_,T){k(this,g,_,!1,T)},F.prototype.writeInt32LE=function(g,_,T){Q(this,g,_,!0,T)},F.prototype.writeInt32BE=function(g,_,T){Q(this,g,_,!1,T)},F.prototype.writeFloatLE=function(g,_,T){z(this,g,_,!0,T)},F.prototype.writeFloatBE=function(g,_,T){z(this,g,_,!1,T)},F.prototype.writeDoubleLE=function(g,_,T){R(this,g,_,!0,T)},F.prototype.writeDoubleBE=function(g,_,T){R(this,g,_,!1,T)},F.prototype.fill=function(g,_,T){if(_=_||0,T=T||this.length,W(typeof(g=typeof(g=g||0)=="string"?g.charCodeAt(0):g)=="number"&&!isNaN(g),"value is not a number"),W(_<=T,"end < start"),T!==_&&this.length!==0){W(0<=_&&_<this.length,"start out of bounds"),W(0<=T&&T<=this.length,"end out of bounds");for(var j=_;j<T;j++)this[j]=g}},F.prototype.inspect=function(){for(var g=[],_=this.length,T=0;T<_;T++)if(g[T]=K(this[T]),T===s.INSPECT_MAX_BYTES){g[T+1]="...";break}return"<Buffer "+g.join(" ")+">"},F.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(F._useTypedArrays)return new F(this).buffer;for(var g=new Uint8Array(this.length),_=0,T=g.length;_<T;_+=1)g[_]=this[_];return g.buffer};var D=F.prototype;function Y(g,_,T){return typeof g!="number"?T:_<=(g=~~g)?_:0<=g||0<=(g+=_)?g:0}function Z(g){return(g=~~Math.ceil(+g))<0?0:g}function X(g){return(Array.isArray||function(_){return Object.prototype.toString.call(_)==="[object Array]"})(g)}function K(g){return g<16?"0"+g.toString(16):g.toString(16)}function q(g){for(var _=[],T=0;T<g.length;T++){var j=g.charCodeAt(T);if(j<=127)_.push(g.charCodeAt(T));else for(var $=T,J=(55296<=j&&j<=57343&&T++,encodeURIComponent(g.slice($,T+1)).substr(1).split("%")),bt=0;bt<J.length;bt++)_.push(parseInt(J[bt],16))}return _}function rt(g){return M.toByteArray(g)}function At(g,_,T,j){for(var $=0;$<j&&!($+T>=_.length||$>=g.length);$++)_[$+T]=g[$];return $}function Ut(g){try{return decodeURIComponent(g)}catch{return"�"}}function Pt(g,_){W(typeof g=="number","cannot write a non-number as a number"),W(0<=g,"specified a negative value for writing an unsigned value"),W(g<=_,"value is larger than maximum value for type"),W(Math.floor(g)===g,"value has a fractional component")}function Zt(g,_,T){W(typeof g=="number","cannot write a non-number as a number"),W(g<=_,"value larger than maximum allowed value"),W(T<=g,"value smaller than minimum allowed value"),W(Math.floor(g)===g,"value has a fractional component")}function Gt(g,_,T){W(typeof g=="number","cannot write a non-number as a number"),W(g<=_,"value larger than maximum allowed value"),W(T<=g,"value smaller than minimum allowed value")}function W(g,_){if(!g)throw new Error(_||"Failed assertion")}F._augment=function(g){return g._isBuffer=!0,g._get=g.get,g._set=g.set,g.get=D.get,g.set=D.set,g.write=D.write,g.toString=D.toString,g.toLocaleString=D.toString,g.toJSON=D.toJSON,g.copy=D.copy,g.slice=D.slice,g.readUInt8=D.readUInt8,g.readUInt16LE=D.readUInt16LE,g.readUInt16BE=D.readUInt16BE,g.readUInt32LE=D.readUInt32LE,g.readUInt32BE=D.readUInt32BE,g.readInt8=D.readInt8,g.readInt16LE=D.readInt16LE,g.readInt16BE=D.readInt16BE,g.readInt32LE=D.readInt32LE,g.readInt32BE=D.readInt32BE,g.readFloatLE=D.readFloatLE,g.readFloatBE=D.readFloatBE,g.readDoubleLE=D.readDoubleLE,g.readDoubleBE=D.readDoubleBE,g.writeUInt8=D.writeUInt8,g.writeUInt16LE=D.writeUInt16LE,g.writeUInt16BE=D.writeUInt16BE,g.writeUInt32LE=D.writeUInt32LE,g.writeUInt32BE=D.writeUInt32BE,g.writeInt8=D.writeInt8,g.writeInt16LE=D.writeInt16LE,g.writeInt16BE=D.writeInt16BE,g.writeInt32LE=D.writeInt32LE,g.writeInt32BE=D.writeInt32BE,g.writeFloatLE=D.writeFloatLE,g.writeFloatBE=D.writeFloatBE,g.writeDoubleLE=D.writeDoubleLE,g.writeDoubleBE=D.writeDoubleBE,g.fill=D.fill,g.inspect=D.inspect,g.toArrayBuffer=D.toArrayBuffer,g}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(e,n,s){(function(i,c,M,d,f,y,B,L,x){var M=e("buffer").Buffer,U=4,F=new M(U);F.fill(0),n.exports={hash:function(O,C,P,V){for(var G=C(function(w,v){w.length%U!=0&&(k=w.length+(U-w.length%U),w=M.concat([w,F],k));for(var k,Q=[],z=v?w.readInt32BE:w.readInt32LE,R=0;R<w.length;R+=U)Q.push(z.call(w,R));return Q}(O=M.isBuffer(O)?O:new M(O),V),8*O.length),C=V,A=new M(P),N=C?A.writeInt32BE:A.writeInt32LE,m=0;m<G.length;m++)N.call(A,G[m],4*m,!0);return A}}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],5:[function(e,n,s){(function(i,c,M,d,f,y,B,L,x){var M=e("buffer").Buffer,U=e("./sha"),F=e("./sha256"),O=e("./rng"),C={sha1:U,sha256:F,md5:e("./md5")},P=64,V=new M(P);function G(w,v){var k=C[w=w||"sha1"],Q=[];return k||A("algorithm:",w,"is not yet supported"),{update:function(z){return M.isBuffer(z)||(z=new M(z)),Q.push(z),z.length,this},digest:function(z){var R=M.concat(Q),R=v?function(D,Y,Z){M.isBuffer(Y)||(Y=new M(Y)),M.isBuffer(Z)||(Z=new M(Z)),Y.length>P?Y=D(Y):Y.length<P&&(Y=M.concat([Y,V],P));for(var X=new M(P),K=new M(P),q=0;q<P;q++)X[q]=54^Y[q],K[q]=92^Y[q];return Z=D(M.concat([X,Z])),D(M.concat([K,Z]))}(k,v,R):k(R);return Q=null,z?R.toString(z):R}}}function A(){var w=[].slice.call(arguments).join(" ");throw new Error([w,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join(`
|
|
9
|
-
`))}V.fill(0),s.createHash=function(w){return G(w)},s.createHmac=G,s.randomBytes=function(w,v){if(!v||!v.call)return new M(O(w));try{v.call(this,void 0,new M(O(w)))}catch(k){v(k)}};var N,m=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],S=function(w){s[w]=function(){A("sorry,",w,"is not implemented yet")}};for(N in m)S(m[N])}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){var M=e("./helpers");function U(A,N){A[N>>5]|=128<<N%32,A[14+(N+64>>>9<<4)]=N;for(var m=1732584193,S=-271733879,w=-1732584194,v=271733878,k=0;k<A.length;k+=16){var Q=m,z=S,R=w,D=v,m=O(m,S,w,v,A[k+0],7,-680876936),v=O(v,m,S,w,A[k+1],12,-389564586),w=O(w,v,m,S,A[k+2],17,606105819),S=O(S,w,v,m,A[k+3],22,-1044525330);m=O(m,S,w,v,A[k+4],7,-176418897),v=O(v,m,S,w,A[k+5],12,1200080426),w=O(w,v,m,S,A[k+6],17,-1473231341),S=O(S,w,v,m,A[k+7],22,-45705983),m=O(m,S,w,v,A[k+8],7,1770035416),v=O(v,m,S,w,A[k+9],12,-1958414417),w=O(w,v,m,S,A[k+10],17,-42063),S=O(S,w,v,m,A[k+11],22,-1990404162),m=O(m,S,w,v,A[k+12],7,1804603682),v=O(v,m,S,w,A[k+13],12,-40341101),w=O(w,v,m,S,A[k+14],17,-1502002290),m=C(m,S=O(S,w,v,m,A[k+15],22,1236535329),w,v,A[k+1],5,-165796510),v=C(v,m,S,w,A[k+6],9,-1069501632),w=C(w,v,m,S,A[k+11],14,643717713),S=C(S,w,v,m,A[k+0],20,-373897302),m=C(m,S,w,v,A[k+5],5,-701558691),v=C(v,m,S,w,A[k+10],9,38016083),w=C(w,v,m,S,A[k+15],14,-660478335),S=C(S,w,v,m,A[k+4],20,-405537848),m=C(m,S,w,v,A[k+9],5,568446438),v=C(v,m,S,w,A[k+14],9,-1019803690),w=C(w,v,m,S,A[k+3],14,-187363961),S=C(S,w,v,m,A[k+8],20,1163531501),m=C(m,S,w,v,A[k+13],5,-1444681467),v=C(v,m,S,w,A[k+2],9,-51403784),w=C(w,v,m,S,A[k+7],14,1735328473),m=P(m,S=C(S,w,v,m,A[k+12],20,-1926607734),w,v,A[k+5],4,-378558),v=P(v,m,S,w,A[k+8],11,-2022574463),w=P(w,v,m,S,A[k+11],16,1839030562),S=P(S,w,v,m,A[k+14],23,-35309556),m=P(m,S,w,v,A[k+1],4,-1530992060),v=P(v,m,S,w,A[k+4],11,1272893353),w=P(w,v,m,S,A[k+7],16,-155497632),S=P(S,w,v,m,A[k+10],23,-1094730640),m=P(m,S,w,v,A[k+13],4,681279174),v=P(v,m,S,w,A[k+0],11,-358537222),w=P(w,v,m,S,A[k+3],16,-722521979),S=P(S,w,v,m,A[k+6],23,76029189),m=P(m,S,w,v,A[k+9],4,-640364487),v=P(v,m,S,w,A[k+12],11,-421815835),w=P(w,v,m,S,A[k+15],16,530742520),m=V(m,S=P(S,w,v,m,A[k+2],23,-995338651),w,v,A[k+0],6,-198630844),v=V(v,m,S,w,A[k+7],10,1126891415),w=V(w,v,m,S,A[k+14],15,-1416354905),S=V(S,w,v,m,A[k+5],21,-57434055),m=V(m,S,w,v,A[k+12],6,1700485571),v=V(v,m,S,w,A[k+3],10,-1894986606),w=V(w,v,m,S,A[k+10],15,-1051523),S=V(S,w,v,m,A[k+1],21,-2054922799),m=V(m,S,w,v,A[k+8],6,1873313359),v=V(v,m,S,w,A[k+15],10,-30611744),w=V(w,v,m,S,A[k+6],15,-1560198380),S=V(S,w,v,m,A[k+13],21,1309151649),m=V(m,S,w,v,A[k+4],6,-145523070),v=V(v,m,S,w,A[k+11],10,-1120210379),w=V(w,v,m,S,A[k+2],15,718787259),S=V(S,w,v,m,A[k+9],21,-343485551),m=G(m,Q),S=G(S,z),w=G(w,R),v=G(v,D)}return Array(m,S,w,v)}function F(A,N,m,S,w,v){return G((N=G(G(N,A),G(S,v)))<<w|N>>>32-w,m)}function O(A,N,m,S,w,v,k){return F(N&m|~N&S,A,N,w,v,k)}function C(A,N,m,S,w,v,k){return F(N&S|m&~S,A,N,w,v,k)}function P(A,N,m,S,w,v,k){return F(N^m^S,A,N,w,v,k)}function V(A,N,m,S,w,v,k){return F(m^(N|~S),A,N,w,v,k)}function G(A,N){var m=(65535&A)+(65535&N);return(A>>16)+(N>>16)+(m>>16)<<16|65535&m}n.exports=function(A){return M.hash(A,U,16)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){n.exports=function(M){for(var U,F=new Array(M),O=0;O<M;O++)(3&O)==0&&(U=4294967296*Math.random()),F[O]=U>>>((3&O)<<3)&255;return F}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){var M=e("./helpers");function U(C,P){C[P>>5]|=128<<24-P%32,C[15+(P+64>>9<<4)]=P;for(var V,G,A,N=Array(80),m=1732584193,S=-271733879,w=-1732584194,v=271733878,k=-1009589776,Q=0;Q<C.length;Q+=16){for(var z=m,R=S,D=w,Y=v,Z=k,X=0;X<80;X++){N[X]=X<16?C[Q+X]:O(N[X-3]^N[X-8]^N[X-14]^N[X-16],1);var K=F(F(O(m,5),(K=S,G=w,A=v,(V=X)<20?K&G|~K&A:!(V<40)&&V<60?K&G|K&A|G&A:K^G^A)),F(F(k,N[X]),(V=X)<20?1518500249:V<40?1859775393:V<60?-1894007588:-899497514)),k=v,v=w,w=O(S,30),S=m,m=K}m=F(m,z),S=F(S,R),w=F(w,D),v=F(v,Y),k=F(k,Z)}return Array(m,S,w,v,k)}function F(C,P){var V=(65535&C)+(65535&P);return(C>>16)+(P>>16)+(V>>16)<<16|65535&V}function O(C,P){return C<<P|C>>>32-P}n.exports=function(C){return M.hash(C,U,20,!0)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){function M(P,V){var G=(65535&P)+(65535&V);return(P>>16)+(V>>16)+(G>>16)<<16|65535&G}function U(P,V){var G,A=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),N=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),m=new Array(64);P[V>>5]|=128<<24-V%32,P[15+(V+64>>9<<4)]=V;for(var S,w,v=0;v<P.length;v+=16){for(var k=N[0],Q=N[1],z=N[2],R=N[3],D=N[4],Y=N[5],Z=N[6],X=N[7],K=0;K<64;K++)m[K]=K<16?P[K+v]:M(M(M((w=m[K-2],O(w,17)^O(w,19)^C(w,10)),m[K-7]),(w=m[K-15],O(w,7)^O(w,18)^C(w,3))),m[K-16]),G=M(M(M(M(X,O(w=D,6)^O(w,11)^O(w,25)),D&Y^~D&Z),A[K]),m[K]),S=M(O(S=k,2)^O(S,13)^O(S,22),k&Q^k&z^Q&z),X=Z,Z=Y,Y=D,D=M(R,G),R=z,z=Q,Q=k,k=M(G,S);N[0]=M(k,N[0]),N[1]=M(Q,N[1]),N[2]=M(z,N[2]),N[3]=M(R,N[3]),N[4]=M(D,N[4]),N[5]=M(Y,N[5]),N[6]=M(Z,N[6]),N[7]=M(X,N[7])}return N}var F=e("./helpers"),O=function(P,V){return P>>>V|P<<32-V},C=function(P,V){return P>>>V};n.exports=function(P){return F.hash(P,U,32,!0)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){s.read=function(M,U,F,O,v){var P,V,G=8*v-O-1,A=(1<<G)-1,N=A>>1,m=-7,S=F?v-1:0,w=F?-1:1,v=M[U+S];for(S+=w,P=v&(1<<-m)-1,v>>=-m,m+=G;0<m;P=256*P+M[U+S],S+=w,m-=8);for(V=P&(1<<-m)-1,P>>=-m,m+=O;0<m;V=256*V+M[U+S],S+=w,m-=8);if(P===0)P=1-N;else{if(P===A)return V?NaN:1/0*(v?-1:1);V+=Math.pow(2,O),P-=N}return(v?-1:1)*V*Math.pow(2,P-O)},s.write=function(M,U,F,O,C,k){var V,G,A=8*k-C-1,N=(1<<A)-1,m=N>>1,S=C===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=O?0:k-1,v=O?1:-1,k=U<0||U===0&&1/U<0?1:0;for(U=Math.abs(U),isNaN(U)||U===1/0?(G=isNaN(U)?1:0,V=N):(V=Math.floor(Math.log(U)/Math.LN2),U*(O=Math.pow(2,-V))<1&&(V--,O*=2),2<=(U+=1<=V+m?S/O:S*Math.pow(2,1-m))*O&&(V++,O/=2),N<=V+m?(G=0,V=N):1<=V+m?(G=(U*O-1)*Math.pow(2,C),V+=m):(G=U*Math.pow(2,m-1)*Math.pow(2,C),V=0));8<=C;M[F+w]=255&G,w+=v,G/=256,C-=8);for(V=V<<C|G,A+=C;0<A;M[F+w]=255&V,w+=v,V/=256,A-=8);M[F+w-v]|=128*k}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754")},{buffer:3,lYpoI2:11}],11:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){var M,U,F;function O(){}(i=n.exports={}).nextTick=(U=typeof window<"u"&&window.setImmediate,F=typeof window<"u"&&window.postMessage&&window.addEventListener,U?function(C){return window.setImmediate(C)}:F?(M=[],window.addEventListener("message",function(C){var P=C.source;P!==window&&P!==null||C.data!=="process-tick"||(C.stopPropagation(),0<M.length&&M.shift()())},!0),function(C){M.push(C),window.postMessage("process-tick","*")}):function(C){setTimeout(C,0)}),i.title="browser",i.browser=!0,i.env={},i.argv=[],i.on=O,i.addListener=O,i.once=O,i.off=O,i.removeListener=O,i.removeAllListeners=O,i.emit=O,i.binding=function(C){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(C){throw new Error("process.chdir is not supported")}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:11}]},{},[1])(1)})}(Wi)),Wi.exports}var If=Sf();const Bf=Vs(If);new TextEncoder;const vf=4096;function Nu(r,t,e){let n=t;const s=n+e,i=[];let c="";for(;n<s;){const a=r[n++];if((a&128)===0)i.push(a);else if((a&224)===192){const d=r[n++]&63;i.push((a&31)<<6|d)}else if((a&240)===224){const d=r[n++]&63,f=r[n++]&63;i.push((a&31)<<12|d<<6|f)}else if((a&248)===240){const d=r[n++]&63,f=r[n++]&63,y=r[n++]&63;let B=(a&7)<<18|d<<12|f<<6|y;B>65535&&(B-=65536,i.push(B>>>10&1023|55296),B=56320|B&1023),i.push(B)}else i.push(a);i.length>=vf&&(c+=String.fromCharCode(...i),i.length=0)}return i.length>0&&(c+=String.fromCharCode(...i)),c}const xf=new TextDecoder,Af=200;function Ef(r,t,e){const n=r.subarray(t,t+e);return xf.decode(n)}function Tf(r,t,e){return e>Af?Ef(r,t,e):Nu(r,t,e)}class En{constructor(t,e){this.type=t,this.data=e}}class se extends Error{constructor(t){super(t);const e=Object.create(se.prototype);Object.setPrototypeOf(this,e),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:se.name})}}const Hr=4294967295;function Mf(r,t,e){const n=Math.floor(e/4294967296),s=e;r.setUint32(t,n),r.setUint32(t+4,s)}function Fu(r,t){const e=r.getInt32(t),n=r.getUint32(t+4);return e*4294967296+n}function Nf(r,t){const e=r.getUint32(t),n=r.getUint32(t+4);return e*4294967296+n}const Ff=-1,Of=4294967296-1,kf=17179869184-1;function Df({sec:r,nsec:t}){if(r>=0&&t>=0&&r<=kf)if(t===0&&r<=Of){const e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,r),e}else{const e=r/4294967296,n=r&4294967295,s=new Uint8Array(8),i=new DataView(s.buffer);return i.setUint32(0,t<<2|e&3),i.setUint32(4,n),s}else{const e=new Uint8Array(12),n=new DataView(e.buffer);return n.setUint32(0,t),Mf(n,4,r),e}}function Uf(r){const t=r.getTime(),e=Math.floor(t/1e3),n=(t-e*1e3)*1e6,s=Math.floor(n/1e9);return{sec:e+s,nsec:n-s*1e9}}function Lf(r){if(r instanceof Date){const t=Uf(r);return Df(t)}else return null}function Cf(r){const t=new DataView(r.buffer,r.byteOffset,r.byteLength);switch(r.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{const e=t.getUint32(0),n=t.getUint32(4),s=(e&3)*4294967296+n,i=e>>>2;return{sec:s,nsec:i}}case 12:{const e=Fu(t,4),n=t.getUint32(0);return{sec:e,nsec:n}}default:throw new se(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${r.length}`)}}function Rf(r){const t=Cf(r);return new Date(t.sec*1e3+t.nsec/1e6)}const Pf={type:Ff,encode:Lf,decode:Rf};class us{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Pf)}register({type:t,encode:e,decode:n}){if(t>=0)this.encoders[t]=e,this.decoders[t]=n;else{const s=-1-t;this.builtInEncoders[s]=e,this.builtInDecoders[s]=n}}tryToEncode(t,e){for(let n=0;n<this.builtInEncoders.length;n++){const s=this.builtInEncoders[n];if(s!=null){const i=s(t,e);if(i!=null){const c=-1-n;return new En(c,i)}}}for(let n=0;n<this.encoders.length;n++){const s=this.encoders[n];if(s!=null){const i=s(t,e);if(i!=null){const c=n;return new En(c,i)}}}return t instanceof En?t:null}decode(t,e,n){const s=e<0?this.builtInDecoders[-1-e]:this.decoders[e];return s?s(t,e,n):new En(e,t)}}us.defaultCodec=new us;function $f(r){return r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer}function na(r){return r instanceof Uint8Array?r:ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):$f(r)?new Uint8Array(r):Uint8Array.from(r)}function Zi(r){return`${r<0?"-":""}0x${Math.abs(r).toString(16).padStart(2,"0")}`}const zf=16,jf=16;class Vf{constructor(t=zf,e=jf){this.hit=0,this.miss=0,this.maxKeyLength=t,this.maxLengthPerKey=e,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}find(t,e,n){const s=this.caches[n-1];t:for(const i of s){const c=i.bytes;for(let a=0;a<n;a++)if(c[a]!==t[e+a])continue t;return i.str}return null}store(t,e){const n=this.caches[t.length-1],s={bytes:t,str:e};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=s:n.push(s)}decode(t,e,n){const s=this.find(t,e,n);if(s!=null)return this.hit++,s;this.miss++;const i=Nu(t,e,n),c=Uint8Array.prototype.slice.call(t,e,e+n);return this.store(c,i),i}}const hs="array",cn="map_key",Ou="map_value",Wf=r=>{if(typeof r=="string"||typeof r=="number")return r;throw new se("The type of key must be string or number but "+typeof r)};class Zf{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(t){const e=this.getUninitializedStateFromPool();e.type=hs,e.position=0,e.size=t,e.array=new Array(t)}pushMapState(t){const e=this.getUninitializedStateFromPool();e.type=cn,e.readCount=0,e.size=t,e.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const t={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(t)}return this.stack[this.stackHeadPosition]}release(t){if(this.stack[this.stackHeadPosition]!==t)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(t.type===hs){const n=t;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(t.type===cn||t.type===Ou){const n=t;n.size=0,n.map=void 0,n.readCount=0,n.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const qr=-1,Gs=new DataView(new ArrayBuffer(0)),Gf=new Uint8Array(Gs.buffer);try{Gs.getInt8(0)}catch(r){if(!(r instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const ia=new RangeError("Insufficient data"),Yf=new Vf;class Ys{constructor(t){this.totalPos=0,this.pos=0,this.view=Gs,this.bytes=Gf,this.headByte=qr,this.stack=new Zf,this.entered=!1,this.extensionCodec=t?.extensionCodec??us.defaultCodec,this.context=t?.context,this.useBigInt64=t?.useBigInt64??!1,this.rawStrings=t?.rawStrings??!1,this.maxStrLength=t?.maxStrLength??Hr,this.maxBinLength=t?.maxBinLength??Hr,this.maxArrayLength=t?.maxArrayLength??Hr,this.maxMapLength=t?.maxMapLength??Hr,this.maxExtLength=t?.maxExtLength??Hr,this.keyDecoder=t?.keyDecoder!==void 0?t.keyDecoder:Yf,this.mapKeyConverter=t?.mapKeyConverter??Wf}clone(){return new Ys({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=qr,this.stack.reset()}setBuffer(t){const e=na(t);this.bytes=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.pos=0}appendBuffer(t){if(this.headByte===qr&&!this.hasRemaining(1))this.setBuffer(t);else{const e=this.bytes.subarray(this.pos),n=na(t),s=new Uint8Array(e.length+n.length);s.set(e),s.set(n,e.length),this.setBuffer(s)}}hasRemaining(t){return this.view.byteLength-this.pos>=t}createExtraByteError(t){const{view:e,pos:n}=this;return new RangeError(`Extra ${e.byteLength-n} of ${e.byteLength} byte(s) found at buffer[${t}]`)}decode(t){if(this.entered)return this.clone().decode(t);try{this.entered=!0,this.reinitializeState(),this.setBuffer(t);const e=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return e}finally{this.entered=!1}}*decodeMulti(t){if(this.entered){yield*this.clone().decodeMulti(t);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(t);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(t){if(this.entered)return this.clone().decodeAsync(t);try{this.entered=!0;let e=!1,n;for await(const a of t){if(e)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{n=this.doDecodeSync(),e=!0}catch(d){if(!(d instanceof RangeError))throw d}this.totalPos+=this.pos}if(e){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}const{headByte:s,pos:i,totalPos:c}=this;throw new RangeError(`Insufficient data in parsing ${Zi(s)} at ${c} (${i} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(t){return this.decodeMultiAsync(t,!0)}decodeStream(t){return this.decodeMultiAsync(t,!1)}async*decodeMultiAsync(t,e){if(this.entered){yield*this.clone().decodeMultiAsync(t,e);return}try{this.entered=!0;let n=e,s=-1;for await(const i of t){if(e&&s===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(i),n&&(s=this.readArraySize(),n=!1,this.complete());try{for(;yield this.doDecodeSync(),--s!==0;);}catch(c){if(!(c instanceof RangeError))throw c}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){t:for(;;){const t=this.readHeadByte();let e;if(t>=224)e=t-256;else if(t<192)if(t<128)e=t;else if(t<144){const s=t-128;if(s!==0){this.pushMapState(s),this.complete();continue t}else e={}}else if(t<160){const s=t-144;if(s!==0){this.pushArrayState(s),this.complete();continue t}else e=[]}else{const s=t-160;e=this.decodeString(s,0)}else if(t===192)e=null;else if(t===194)e=!1;else if(t===195)e=!0;else if(t===202)e=this.readF32();else if(t===203)e=this.readF64();else if(t===204)e=this.readU8();else if(t===205)e=this.readU16();else if(t===206)e=this.readU32();else if(t===207)this.useBigInt64?e=this.readU64AsBigInt():e=this.readU64();else if(t===208)e=this.readI8();else if(t===209)e=this.readI16();else if(t===210)e=this.readI32();else if(t===211)this.useBigInt64?e=this.readI64AsBigInt():e=this.readI64();else if(t===217){const s=this.lookU8();e=this.decodeString(s,1)}else if(t===218){const s=this.lookU16();e=this.decodeString(s,2)}else if(t===219){const s=this.lookU32();e=this.decodeString(s,4)}else if(t===220){const s=this.readU16();if(s!==0){this.pushArrayState(s),this.complete();continue t}else e=[]}else if(t===221){const s=this.readU32();if(s!==0){this.pushArrayState(s),this.complete();continue t}else e=[]}else if(t===222){const s=this.readU16();if(s!==0){this.pushMapState(s),this.complete();continue t}else e={}}else if(t===223){const s=this.readU32();if(s!==0){this.pushMapState(s),this.complete();continue t}else e={}}else if(t===196){const s=this.lookU8();e=this.decodeBinary(s,1)}else if(t===197){const s=this.lookU16();e=this.decodeBinary(s,2)}else if(t===198){const s=this.lookU32();e=this.decodeBinary(s,4)}else if(t===212)e=this.decodeExtension(1,0);else if(t===213)e=this.decodeExtension(2,0);else if(t===214)e=this.decodeExtension(4,0);else if(t===215)e=this.decodeExtension(8,0);else if(t===216)e=this.decodeExtension(16,0);else if(t===199){const s=this.lookU8();e=this.decodeExtension(s,1)}else if(t===200){const s=this.lookU16();e=this.decodeExtension(s,2)}else if(t===201){const s=this.lookU32();e=this.decodeExtension(s,4)}else throw new se(`Unrecognized type byte: ${Zi(t)}`);this.complete();const n=this.stack;for(;n.length>0;){const s=n.top();if(s.type===hs)if(s.array[s.position]=e,s.position++,s.position===s.size)e=s.array,n.release(s);else continue t;else if(s.type===cn){if(e==="__proto__")throw new se("The key __proto__ is not allowed");s.key=this.mapKeyConverter(e),s.type=Ou;continue t}else if(s.map[s.key]=e,s.readCount++,s.readCount===s.size)e=s.map,n.release(s);else{s.key=null,s.type=cn;continue t}}return e}}readHeadByte(){return this.headByte===qr&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=qr}readArraySize(){const t=this.readHeadByte();switch(t){case 220:return this.readU16();case 221:return this.readU32();default:{if(t<160)return t-144;throw new se(`Unrecognized array type byte: ${Zi(t)}`)}}}pushMapState(t){if(t>this.maxMapLength)throw new se(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(t)}pushArrayState(t){if(t>this.maxArrayLength)throw new se(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(t)}decodeString(t,e){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(t,e):this.decodeBinary(t,e)}decodeUtf8String(t,e){if(t>this.maxStrLength)throw new se(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+e+t)throw ia;const n=this.pos+e;let s;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(t)?s=this.keyDecoder.decode(this.bytes,n,t):s=Tf(this.bytes,n,t),this.pos+=e+t,s}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===cn:!1}decodeBinary(t,e){if(t>this.maxBinLength)throw new se(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+e))throw ia;const n=this.pos+e,s=this.bytes.subarray(n,n+t);return this.pos+=e+t,s}decodeExtension(t,e){if(t>this.maxExtLength)throw new se(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);const n=this.view.getInt8(this.pos+e),s=this.decodeBinary(t,e+1);return this.extensionCodec.decode(s,n,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){const t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){const t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){const t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){const t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){const t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){const t=Nf(this.view,this.pos);return this.pos+=8,t}readI64(){const t=Fu(this.view,this.pos);return this.pos+=8,t}readU64AsBigInt(){const t=this.view.getBigUint64(this.pos);return this.pos+=8,t}readI64AsBigInt(){const t=this.view.getBigInt64(this.pos);return this.pos+=8,t}readF32(){const t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){const t=this.view.getFloat64(this.pos);return this.pos+=8,t}}function Jf(r,t){return new Ys(t).decode(r)}ya.set("msgpack2",async()=>({kind:"array_to_bytes",fromConfig:(r,t)=>({kind:"array_to_bytes",async encode(e){throw new Error("msgpack2 encode not implemented")},async decode(e){const n=Jf(e),{shape:s}=t,i=new Array(s.length);let c=1;for(let a=s.length-1;a>=0;a--)i[a]=c,c*=s[a];return{data:n,shape:s,stride:i}}})}));function Hf(r){return new Promise(t=>setTimeout(t,r))}const Gi="__cache_created_at";class qf{cache;url;params;cache_prefix;fetchOptions;timeout;ttl;_pending={};_cacheValid;constructor(t,e,n={}){const s={...e};n.parameters&&(s["x-parameters"]=JSON.stringify(n.parameters)),n.chunks&&(s["x-chunks"]=n.chunks),n.downsample&&(s["x-downsample"]=JSON.stringify(n.downsample)),s["x-filtered"]="True",this.params={},e["x-datamesh-auth"]&&(this.params.auth=e["x-datamesh-auth"]),e["x-datamesh-sig"]&&(this.params.sig=e["x-datamesh-sig"]),this.fetchOptions={headers:s},this.url=t,n.nocache&&console.warn("CachedHTTPStore: 'nocache' option is deprecated, use 'ttl: 0' instead"),n.ttl===0||n.nocache||typeof window>"u"?this.cache=void 0:this.cache=Mu("zarr","cache"),this.cache_prefix=Bf({root:t,...n.parameters,chunks:n.chunks,downsample:n.downsample}),this.timeout=n.timeout||6e4,this.ttl=n.ttl}async checkCacheTTL(){if(!this.ttl||!this.cache)return!0;if(this._cacheValid!==void 0)return this._cacheValid;const t=`${this.cache_prefix}${Gi}`,e=await Vi(t,this.cache);return e?(Date.now()-e)/1e3>this.ttl?(this._cacheValid=!1,!1):(this._cacheValid=!0,!0):(this._cacheValid=!0,!0)}async setCacheTimestamp(){if(!this.cache||!this.ttl)return;const t=`${this.cache_prefix}${Gi}`;await Vi(t,this.cache)||await ea(t,Date.now(),this.cache)}async invalidateCache(){if(!this.cache)return;const t=`${this.cache_prefix}${Gi}`;await xn(t,this.cache),this._cacheValid=void 0}async get(t,e,n=0){const s=`${this.cache_prefix}${t}`;let i=null;if(this.cache&&(await this.checkCacheTTL()?i=await Vi(s,this.cache):await this.invalidateCache(),i&&delete this._pending[s],this._pending[s]))if(await Hf(200),n>this.timeout){await xn(s,this.cache),delete this._pending[s],console.error("Zarr timeout");return}else return await this.get(t,e,n+200);if(!i){this._pending[s]=!0;try{const c={...this.fetchOptions,...e,headers:{...this.fetchOptions.headers||{},...e?.headers||{}},signal:AbortSignal.timeout(this.timeout)},a=new URLSearchParams(this.params).toString(),d=await fetch(`${this.url}${t}?${a}`,c);if(d.status===404){this.cache&&await xn(s,this.cache);return}if(d.status>=400)throw new Error(`HTTP error: ${d.status}`);i=new Uint8Array(await d.arrayBuffer()),this.cache&&(await ea(s,i,this.cache),await this.setCacheTimestamp())}catch(c){if(console.debug("Zarr retry:"+s),n<this.timeout/200)return delete this._pending[s],await this.get(t,e,n+200);this.cache&&await xn(s,this.cache),console.error(c);return}finally{delete this._pending[s]}}return i}}const sa=async(r,t=".zarray")=>{const{path:e}=r.resolve(t),n=await r.store.get(e);return n?JSON.parse(new TextDecoder().decode(n)):{}};async function Kf(r){const t=await sa(r,".zattrs"),e=await sa(r);e.dtype.startsWith("<M8")&&(t._dtype=e.dtype),e.fill_value!==void 0&&(t._fill_value=e.fill_value);const n=[];e.order==="F"&&n.push({name:"transpose",configuration:{order:"F"}}),typeof e.dtype=="string"&&e.dtype.startsWith(">")&&n.push({name:"bytes",configuration:{endian:"big"}});for(const{id:i,...c}of e.filters??[])n.push({name:i,configuration:c});if(e.compressor){const{id:i,...c}=e.compressor;n.push({name:i,configuration:c})}const s={zarr_format:3,node_type:"array",shape:e.shape,data_type:"int64",chunk_grid:{name:"regular",configuration:{chunk_shape:e.chunks}},chunk_key_encoding:{name:"v2",configuration:{separator:e.dimension_separator??"."}},codecs:n,fill_value:e.fill_value,attributes:t};return new vr(r.store,r.path,s)}let ku=typeof process<"u"&&!!process.env&&process.env.DATAMESH_DEBUG==="true";function oa(){return ku}function Ti(r,t,e){if(!ku)return e;const n=e.value;return e.value=function(...s){const i=s.map(a=>{if(!a||typeof a!="object")return a;try{return JSON.parse(JSON.stringify(a,(d,f)=>{if(typeof d=="string"){const y=d.toLowerCase();if(y.includes("token")||y.includes("authorization")||y.includes("jwt"))return"[redacted]"}return f}))}catch{return"[unserializable]"}}),c=Date.now();try{const a=n.apply(this,s);if(a&&typeof a.then=="function")return a.finally(()=>{const f=Date.now()-c;console.debug(`@oceanum/datamesh debug: ${t} took ${f}ms`,i)});const d=Date.now()-c;return console.debug(`@oceanum/datamesh debug: ${t} took ${d}ms`,i),a}catch(a){const d=Date.now()-c;throw console.debug(`@oceanum/datamesh debug: ${t} threw after ${d}ms`,i),a}},e}const Js={microseconds:.001,milliseconds:1,seconds:1e3,minutes:60*1e3,hours:60*60*1e3,days:24*60*60*1e3},Xf={day:"days",days:"days",d:"days",hour:"hours",hours:"hours",hr:"hours",hrs:"hours",h:"hours",minute:"minutes",minutes:"minutes",min:"minutes",mins:"minutes",second:"seconds",seconds:"seconds",sec:"seconds",secs:"seconds",s:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds",msec:"milliseconds",msecs:"milliseconds",ms:"milliseconds",microsecond:"microseconds",microseconds:"microseconds",usec:"microseconds",usecs:"microseconds",us:"microseconds"},Mi=new Set(["standard","gregorian","proleptic_gregorian"]);function Ni(r){const t=/^\s*(\w+)\s+since\s+(.+?)\s*$/i,e=r.match(t);if(!e)throw new Error(`Invalid CF time units: "${r}". Expected format: "<unit> since <reference_time>"`);const[,n,s]=e,i=n.toLowerCase(),c=Xf[i];if(!c)throw new Error(`Unsupported time unit: "${n}". Supported units: days, hours, minutes, seconds, milliseconds, microseconds`);const a=Qf(s),d=a.getTime();return{unit:c,referenceDate:a,referenceMs:d,original:r}}function Qf(r){const t=r.trim().replace("T"," ").replace(/Z$/i,""),e=/^(-?\d+)-(\d{1,2})-(\d{1,2})(?:\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d+))?)?)?$/,n=t.match(e);if(!n){const C=new Date(r);if(isNaN(C.getTime()))throw new Error(`Cannot parse reference time: "${r}"`);return C}const[,s,i,c,a,d,f,y]=n,B=parseInt(s,10),L=parseInt(i,10)-1,x=parseInt(c,10),M=a?parseInt(a,10):0,U=d?parseInt(d,10):0,F=f?parseInt(f,10):0;let O=0;if(y){const C=y.padEnd(3,"0").slice(0,3);O=parseInt(C,10)}return new Date(Date.UTC(B,L,x,M,U,F,O))}function tp(r,t,e="standard"){if(!Mi.has(e))throw new Error(`Unsupported calendar: "${e}". Currently only Gregorian calendars are supported: standard, gregorian, proleptic_gregorian`);const n=Ni(t),s=Js[n.unit];if(typeof r=="number")return new Date(n.referenceMs+r*s);const i=[];for(let c=0;c<r.length;c++){const a=r[c];a==null||Number.isNaN(a)?i.push(new Date(NaN)):i.push(new Date(n.referenceMs+a*s))}return i}function ep(r,t,e="standard"){if(!Mi.has(e))throw new Error(`Unsupported calendar: "${e}". Currently only Gregorian calendars are supported: standard, gregorian, proleptic_gregorian`);const n=Ni(t),s=Js[n.unit];return r instanceof Date?(r.getTime()-n.referenceMs)/s:r.map(i=>!i||isNaN(i.getTime())?NaN:(i.getTime()-n.referenceMs)/s)}function Du(r){return Mi.has(r.toLowerCase())}function rp(){return Array.from(Mi)}function Uu(r){const t=r.units;return typeof t=="string"&&/^\s*\w+\s+since\s+.+$/i.test(t)}function Lu(r,t,e="standard"){if(!Du(e))return null;const n=Ni(t),s=Js[n.unit],i=n.referenceMs,c=new Float64Array(r.length);for(let a=0;a<r.length;a++){const d=Number(r[a]);Number.isNaN(d)?c[a]=NaN:c[a]=(i+d*s)/1e3}return c}var np=Object.defineProperty,ip=Object.getOwnPropertyDescriptor,sp=(r,t,e,n)=>{for(var s=ip(t,e),i=r.length-1,c;i>=0;i--)(c=r[i])&&(s=c(t,e,s)||s);return s&&np(t,e,s),s};const aa=(r,t,e,n,s)=>n?.variables?.[r]?n.variables[r]:s||(n?.dimensions?t.map((i,c)=>n.dimensions?.[i]??e[c]):e),Cu=r=>{const t=new Tu.Buffer(r,"base64");return bf.Geometry.parse(t).toGeoJSON()},mi=r=>r&&(Array.isArray(r)||ArrayBuffer.isView(r)),Yi=r=>{const t=[];if(!mi(r))return t;for(;t.push(r.length),mi(r[0]);)r=r[0];return t},op=r=>{for(;Array.isArray(r);)r=r[0];if(r==null)return"uint8";switch(r.constructor.name){case"Boolean":return"bool";case"Number":return"float32";case"Int8Array":return"int8";case"Int16Array":return"int16";case"Int32Array":return"int32";case"BigInt64Array":return"int64";case"Uint8Array":return"uint8";case"Uint16Array":return"uint16";case"Uint32Array":return"uint32";case"Float32Array":return"float32";case"Float64Array":return"float64";case"String":return"v2:object";case"Object":return"v2:object"}throw new Error("Unsupported data type: "+r.constructor.name)},ap=r=>{let t=r.toString().toLowerCase();return r.typeId==5?t="v2:object":r.typeId==1&&(t="uint8"),t},ca=r=>{if(!Array.isArray(r))return r;const t=r.flat(1/0);if(mi(t[0])){const e=t[0].length,n=new t[0].constructor(t.length*e);for(let s=0;s<t.length;s++)n.set(t[s],s*e);return n}else return t},ua=r=>{const t=r.length,e=Array(t);for(let n=t-1,s=1;n>=0;n--)e[n]=s,s*=r[n];return e},pn=(r,t,e,n=0)=>{if(t.length===0)return r[0];if(t.length===1){const i=new r.constructor(t[0]);return i.set(r.slice(n,n+t[0])),i}const s=new Array(t[0]);for(let i=0;i<t[0];i++)s[i]=pn(r,t.slice(1),e.slice(1),n+i*e[0]);return s},cp=(r,t)=>{const[e,n]=t.split("<M8"),s=new Float64Array(r.data.length);let i=1n;switch(n){case"[ms]":i=1000n;break;case"[us]":i=1000000n;break;case"[ns]":i=1000000000n;break;default:i=1n;break}for(let c=0;c<r.data.length;c++){const a=r.data[c];s[c]=Number(a/i)}return pn(s,r.shape,r.stride)},up=(r,t,e="standard")=>{const n=Lu(r.data,t,e);return n===null?(console.warn(`Unsupported calendar "${e}" for cftime conversion. Returning raw values. Supported: standard, gregorian, proleptic_gregorian`),pn(r.data,r.shape,r.stride)):pn(n,r.shape,r.stride)},hp=r=>{if(r==null)return!0;if(typeof r=="string"){const t=r.toLowerCase();return t==="nan"||t==="-nan"||t==="+nan"}return typeof r=="number"?Number.isNaN(r):!1},lp=(r,t,e)=>{if(!e.startsWith("float")||hp(t))return r;if(typeof t=="number"&&!Number.isNaN(t)){const n=e==="float64"?new Float64Array(r.length):new Float32Array(r.length);for(let s=0;s<r.length;s++){const i=r[s];n[s]=Math.abs(i-t)<Math.abs(t*1e-6)?NaN:i}return n}return r},Ru=(r,t,e)=>{const n=Object.keys(t),s={};for(const i in r)mi(r[i].data)&&(s[i]=!0);if(n.length==1)for(let i=0;i<t[n[0]];i++){const c={};for(const a in r)s[a]?r[a].data.length>1&&(c[a]=r[a].data[i]):c[a]=r[a].data;e.push(c)}else for(let i=0;i<t[n[0]];i++){const c={};for(const d in r)r[d].dimensions.includes(n[0])?c[d]={attributes:r[d].attributes,data:r[d].data[i],dimensions:r[d].dimensions.slice(1)}:c[d]=r[d];const a={...t};delete a[n[0]],Ru(c,a,e)}return e};class wi{id;dimensions;attributes;arr;constructor(t,e,n,s){this.id=t,this.dimensions=e,this.attributes=n,this.arr=s}async get(t){if(this.arr.shape.length==0||this.arr.shape[0]==0)return[];const e=t&&t.map(s=>{if(typeof s=="string"){const[i,c,a]=s.split(":");return Hi(parseInt(i),parseInt(c),parseInt(a))}else return s}),n=await Uh(this.arr,e);if(this.arr.dtype=="v2:object"||!n.shape)return n.data;if(this.arr.dtype=="bool")return[...n.data];{const s=this.arr.attrs,i=this.arr.dtype,c=s._dtype;if(c?.startsWith("<M8"))return cp(n,c);if(Uu(s)){const f=s.units,y=s.calendar||"standard";return up(n,f,y)}const a=this.attributes._fill_value,d=a?lp(n.data,a,i):n.data;return pn(d,n.shape,n.stride)}}}sp([Ti],wi.prototype,"get");class Ye{dimensions;variables;attributes;coordkeys;root;constructor(t,e,n,s,i){this.dimensions=t,this.variables=e,this.attributes=n,this.coordkeys=s,this.root=i}static async zarr(t,e,n={}){const s=new qf(t,e,{chunks:n.chunks,downsample:n.downsample,parameters:n.parameters,timeout:n.timeout,nocache:n.nocache,ttl:n.ttl}),i=await mh(s),c=await Ge(i,{kind:"group"}),a={},d={};for(const y of i.contents())if(y.kind=="array"){let B;try{B=await Ge(c.resolve(y.path),{kind:"array"})}catch(U){const F=typeof U=="object"&&U&&"message"in U?String(U.message):void 0;if(F&&F.includes("<M8"))B=await Kf(c.resolve(y.path));else throw U}const L={...B.attrs};if(L._fill_value===void 0){const U=`${y.path}/.zarray`.replace(/^\//,""),F=await i.get(`/${U}`);if(F){const O=JSON.parse(new TextDecoder().decode(F));O.fill_value!==void 0&&(L._fill_value=O.fill_value)}}const x=L._ARRAY_DIMENSIONS,M=y.path.split("/").pop();a[M]=new wi(M,x||[],L,B),x&&x.map((U,F)=>{const O=B.shape[F];if(d[U]&&d[U]!=O)throw new Error(`Inconsistent dimension size for ${U}: ${d[U]} != ${O}`);d[U]=O})}const f=JSON.parse(c.attrs._coordinates||"{}")||{};return new Ye(d,a,c.attrs,n.coordkeys||f,c)}static async fromArrow(t,e){const n={},s={record:t.numRows},i={};return t.schema.fields.forEach(c=>{const a=t.getChild(c.name);let d={},f=a?.toArray(),y=ap(c.type);if(tt.isTimestamp(c.type)){const B=new Float64Array(f.length),L=BigInt(1e3**(c.type.unit-0));for(let x=0;x<f.length;x++)B[x]=Number(f[x]/L);f=B,y="float64",d={unit:"Unix timestamp (s)"}}else if(tt.isBinary(c.type)){const B=[];for(let L=0;L<f.length;L++)B.push(new Tu.Buffer(f[L]).toString("base64"));f=B,y="v2:object"}i[c.name]={dimensions:["record"],attributes:d,data:f,dtype:y}}),await Ye.init({dimensions:s,variables:i,attributes:n},e)}static async fromGeojson(t,e){if(!("features"in t&&Array.isArray(t.features))&&!("geometry"in t))throw new Error("Invalid GeoJSON");const n="features"in t&&t.features?t.features:[t];if(n.length===0)throw new Error("FeatureCollection contains no features");const s=new Set;n.forEach(d=>{d.properties&&Object.keys(d.properties).forEach(f=>s.add(f))});const i=n.map(d=>{const f={geometry:d.geometry};return d.properties&&Object.assign(f,d.properties),f}),c={dimensions:{index:i.length},variables:{},attributes:{}},a=await Ye.init(c,{...e,g:"geometry"});await a.assign("geometry",["index"],i.map(d=>d.geometry),{description:"GeoJSON geometry"});for(const d of s){const f=i.map(y=>y[d]);await a.assign(d,["index"],f,{description:`Property: ${d}`})}return a}static async init(t,e,n){const s=await _n(new Map,{attributes:{created:new Date}}),i=new Ye(t.dimensions,{},t.attributes||{},e||{},s);for(const c in t.variables){const{dimensions:a,attributes:d,data:f,dtype:y,chunks:B}=t.variables[c],L=Yi(f),x=aa(c,a,L,n,B);await i.assign(c,a,f,d,y&&y==="string"?"v2:object":y,x)}return i}async asDataframe(){const t={},e=[];for(const s in this.variables)t[s]={attributes:this.variables[s].attributes,dimensions:this.variables[s].dimensions},t[s].data=await this.variables[s].get(),this.variables[s].arr.dtype=="int64"&&s!=this.coordkeys.t&&e.push(s);const n=Ru(t,{...this.dimensions},[]);if(this.coordkeys.t)for(let s=0;s<n.length;s++)n[s][this.coordkeys.t]=new Date(1e3*n[s][this.coordkeys.t]).toISOString();if(e.length>0)for(const s of e)for(let i=0;i<n.length;i++)n[i][s]=Number(n[i][s]);return n}async asGeojson(t){if(!this.coordkeys.g&&!t)throw new Error("No geometry found");const e=[],n=await this.asDataframe();for(let s=0;s<n.length;s++){const{...i}=n[s];let c=t;if(!c&&this.coordkeys.g){delete i[this.coordkeys.g];const a=n[s][this.coordkeys.g];a.slice(0,7)=='{"type:'?c=JSON.parse(a):c=Cu(a)}e.push({type:"Feature",geometry:c,properties:i})}return{type:"FeatureCollection",features:e}}async assign(t,e,n,s,i,c){const a=Yi(n);if(a.length!=e.length)throw new Error("Data shape does not match dimensions");e.map((B,L)=>{if(this.dimensions[B]){if(this.dimensions[B]!=a[L])throw new Error(`Existing size of dimension ${B} does not match new data`)}else this.dimensions[B]=a[L]});const d=i||op(n),f=await _n(this.root.resolve(t),{shape:a,data_type:d,chunk_shape:c||a,codecs:d=="v2:object"?[{name:"json2"}]:[]});let y=ca(n);y.length==0?y=null:d=="bool"?y=new $n(y):Array.isArray(y)&&d=="float32"?y=Float32Array.from(y,B=>B??NaN):Array.isArray(y)&&d=="float64"?y=Float64Array.from(y,B=>B??NaN):Array.isArray(y)&&d=="int8"?y=Int8Array.from(y):Array.isArray(y)&&d=="int16"?y=Int16Array.from(y):Array.isArray(y)&&d=="int32"?y=Int32Array.from(y):Array.isArray(y)&&d=="int64"?y=BigInt64Array.from(y.map(B=>BigInt(B))):Array.isArray(y)&&d=="uint8"?y=Uint8Array.from(y):Array.isArray(y)&&d=="uint16"?y=Uint16Array.from(y):Array.isArray(y)&&d=="uint32"?y=Uint32Array.from(y):Array.isArray(y)&&d=="uint64"&&(y=BigUint64Array.from(y.map(B=>BigInt(B)))),y&&await oo(f,a.map(()=>null),{data:y,shape:a,stride:ua(a)}),this.variables[t]=new wi(t,e,s||{},f)}async toZarr(t){const e=t?.chunks,n=new Map,s=await _n(n,{attributes:{...this.attributes,_coordinates:JSON.stringify(this.coordkeys)}});for(const i in this.variables){const c=this.variables[i],a=await c.get(),d=Yi(a),f=c.dimensions,y=aa(i,f,d,e,e?void 0:c.arr.chunks),B=c.arr.dtype,L=await _n(s.resolve(i),{shape:d,data_type:B,chunk_shape:y,codecs:B==="v2:object"?[{name:"json2"}]:void 0,attributes:{...c.attributes,_ARRAY_DIMENSIONS:f}});let x=ca(a);x&&x.length>0&&(B==="bool"?x=new $n(x):Array.isArray(x)&&B==="float32"?x=Float32Array.from(x,M=>M??NaN):Array.isArray(x)&&B==="float64"?x=Float64Array.from(x,M=>M??NaN):Array.isArray(x)&&B==="int8"?x=Int8Array.from(x):Array.isArray(x)&&B==="int16"?x=Int16Array.from(x):Array.isArray(x)&&B==="int32"?x=Int32Array.from(x):Array.isArray(x)&&B==="int64"?x=BigInt64Array.from(x.map(M=>BigInt(M))):Array.isArray(x)&&B==="uint8"?x=Uint8Array.from(x):Array.isArray(x)&&B==="uint16"?x=Uint16Array.from(x):Array.isArray(x)&&B==="uint32"?x=Uint32Array.from(x):Array.isArray(x)&&B==="uint64"&&(x=BigUint64Array.from(x.map(M=>BigInt(M)))),await oo(L,d.map(()=>null),{data:x,shape:d,stride:ua(d)}))}return n}}var dp=Object.defineProperty,fp=Object.getOwnPropertyDescriptor,pp=(r,t,e,n)=>{for(var s=fp(t,e),i=r.length-1,c;i>=0;i--)(c=r[i])&&(s=c(t,e,s)||s);return s&&dp(t,e,s),s};const Pu=class ls{id;user;creationTime;endTime;write;verified=!1;_connection;_closePromise=null;_closed=!1;_beforeExitHandler=null;static async acquire(t,e={}){if(!t._isV1){const n=new ls;return n.id="dummy_session",n.user="dummy_user",n.creationTime=new Date,n.endTime=new Date(Date.now()+(e.duration||3600)*1e3),n.write=!1,n.verified=!1,n._connection=t,typeof process<"u"&&process.on&&(n._beforeExitHandler=()=>{n.close()},process.once("beforeExit",n._beforeExitHandler)),n}try{const n={...t._authHeaders};n["Cache-Control"]="no-store";const s=new URLSearchParams({duration:String(e.duration??3600)}),i=await fetch(`${t._gateway}/session/?${s.toString()}`,{headers:n});if(i.status!==200)throw new Error(`Failed to create session: ${await i.text()}`);const c=await i.json(),a=new ls;return a.id=c.id,a.user=c.user,a.creationTime=new Date(c.creation_time),a.endTime=new Date(c.end_time),a.write=c.write,a.verified=c.verified||!1,a._connection=t,typeof process<"u"&&process.on&&(a._beforeExitHandler=()=>{a.close()},process.once("beforeExit",a._beforeExitHandler)),a}catch(n){throw new Error(`Error when acquiring datamesh session: ${n}`)}}get header(){return{"X-DATAMESH-SESSIONID":this.id}}addHeader(t){return{...t,...this.header}}async close(t=!1){if(this._connection._isV1&&!this._closed)return this._closePromise?this._closePromise:(this._closePromise=(async()=>{try{this._beforeExitHandler&&typeof process<"u"&&process.off&&(process.off("beforeExit",this._beforeExitHandler),this._beforeExitHandler=null);const e=await fetch(`${this._connection._gateway}/session/${this.id}`,{method:"DELETE",headers:this.header,body:JSON.stringify({finalise_write:t})});if(e.status===204){this._closed=!0;return}const n=await e.text();if(e.status===404&&n.includes("Session not found")){this._closed=!0;return}if(t)throw new Error(`Failed to finalise write: ${n}`);console.warn(`Failed to close session: ${n}`)}catch(e){if(t)throw new Error(`Error when closing datamesh session: ${e}`);console.warn(`Error when closing datamesh session: ${e}`)}finally{this._closePromise=null}})(),this._closePromise)}async enter(){return this}async exit(t){await this.close(t===void 0)}};pp([Ti],Pu,"acquire");let yp=Pu;var gp=Object.defineProperty,mp=Object.getOwnPropertyDescriptor,$u=(r,t,e,n)=>{for(var s=mp(t,e),i=r.length-1,c;i>=0;i--)(c=r[i])&&(s=c(t,e,s)||s);return s&&gp(t,e,s),s};const wp=typeof process<"u"&&process.env?.DATAMESH_SERVICE?process.env.DATAMESH_SERVICE:"https://datamesh.oceanum.io",Hs=class zu{static LAZY_LOAD_SIZE=1e8;_token;_host;_authHeaders;_gateway;_nocache=!1;_isV1=!1;_sessionParams={};_currentSession=null;service;gateway;constructor(t=typeof process<"u"&&process.env?.DATAMESH_TOKEN?process.env.DATAMESH_TOKEN:"$DATAMESH_TOKEN",e){if(!t&&!e?.jwtAuth)throw new Error("A valid datamesh token must be supplied as a connector constructor argument or defined in environment variables as DATAMESH_TOKEN");this._token=t,this._nocache=e?.nocache??!1;const n=new URL(e?.service||wp);this._host=`${n.protocol}//${n.hostname}`,this._authHeaders=e?.jwtAuth?{Authorization:`Bearer ${e.jwtAuth}`}:{Authorization:`Token ${this._token}`,"X-DATAMESH-TOKEN":this._token},this._gateway=e?.gateway||this._host,this._host.split(".").slice(-1)[0]!==this._gateway.split(".").slice(-1)[0]&&console.warn("Datamesh gateway and service domains do not match"),e?.sessionDuration&&typeof e.sessionDuration=="number"&&(this._sessionParams={duration:e.sessionDuration}),this._checkApiVersion()}async _checkApiVersion(){try{(await fetch(`${this._gateway}/session`,{headers:this._authHeaders})).status===200?(this._isV1=!0,console.info("Using datamesh API version 1")):(this._isV1=!1,console.info("Using datamesh API version 0"))}catch{this._isV1=!1,console.info("Using datamesh API version 0")}}get host(){return this._host}async status(){return(await fetch(this._host,{headers:this._authHeaders})).status===200}async validateResponse(t){if(t.status>=400){let e;try{e=(await t.json()).detail}catch{e=`Datamesh server error: ${await t.text()}`}throw new Error(e)}}async createSession(t={}){const e={duration:t.duration||this._sessionParams.duration||3600};return this._currentSession=await yp.acquire(this,e),this._currentSession}async getSession(){return this._currentSession?this._currentSession:this.createSession()}async getSessionHeaders(t={}){return this._isV1&&!this._currentSession&&await this.createSession(),this._currentSession?this._currentSession.addHeader({...this._authHeaders,...t}):{...this._authHeaders,...t}}async metadataRequest(t="",e={}){const n=new URL(`${this._host}/datasource/${t}`);Object.keys(e).forEach(c=>n.searchParams.append(c,e[c]));const s=await this.getSessionHeaders(),i=await fetch(n.toString(),{headers:s});if(i.status===403)throw new Error(`Datasource ${t} not authorized`);return await this.validateResponse(i),i}async dataRequest(t,e="application/vnd.apache.arrow.file"){const n=await this.getSessionHeaders({Accept:e}),s=await fetch(`${this._gateway}/oceanql/${t}?f=arrow`,{headers:n});return await this.validateResponse(s),Bu(await s.arrayBuffer())}async stageRequest(t){oa()&&console.debug("@oceanum/datamesh debug: stageRequest query",t);const e=JSON.stringify(t),n=await this.getSessionHeaders({"Content-Type":"application/json"}),s=await fetch(`${this._gateway}/oceanql/stage/`,{method:"POST",headers:n,body:e});if(s.status>=400){const i=await s.json();throw new Error(i.detail)}else return s.status===204?null:s.json()}async query(t,e={}){oa()&&console.debug("@oceanum/datamesh debug: query called",t);const n=await this.stageRequest(t);if(!n)return console.warn("No data found for query"),null;if(n.size<zu.LAZY_LOAD_SIZE&&n.container!="dataset"){const d=await this.dataRequest(n.qhash);return await Ye.fromArrow(d,n.coordkeys)}const s=`${this._gateway}/zarr/${this._isV1?"query/":""}${n.qhash}`,i=t.parameters,c=await this.getSessionHeaders(),a=await Ye.zarr(s,c,{parameters:i,timeout:e.timeout||6e4,nocache:this._nocache});if(t.variables)for(const d of Object.keys(a.variables))!t.variables.includes(d)&&!Object.values(a.coordkeys).includes(d)&&delete a.variables[d];return a}async getDatasource(t){const n=await(await this.metadataRequest(t)).json();return{id:t,geom:n.geometry,...n.properties}}async loadDatasource(t,e={}){const n={datasource:t,parameters:e};return await this.query(n)}async closeSession(t=!1){this._currentSession&&(await this._currentSession.close(t),this._currentSession=null)}};$u([Ti],Hs.prototype,"stageRequest");$u([Ti],Hs.prototype,"query");let bp=Hs;var Rn={exports:{}},_p=Rn.exports,ha;function Sp(){return ha||(ha=1,function(r,t){(function(e,n){r.exports=n()})(_p,function(){var e=1e3,n=6e4,s=36e5,i="millisecond",c="second",a="minute",d="hour",f="day",y="week",B="month",L="quarter",x="year",M="date",U="Invalid Date",F=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,O=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(z){var R=["th","st","nd","rd"],D=z%100;return"["+z+(R[(D-20)%10]||R[D]||R[0])+"]"}},P=function(z,R,D){var Y=String(z);return!Y||Y.length>=R?z:""+Array(R+1-Y.length).join(D)+z},V={s:P,z:function(z){var R=-z.utcOffset(),D=Math.abs(R),Y=Math.floor(D/60),Z=D%60;return(R<=0?"+":"-")+P(Y,2,"0")+":"+P(Z,2,"0")},m:function z(R,D){if(R.date()<D.date())return-z(D,R);var Y=12*(D.year()-R.year())+(D.month()-R.month()),Z=R.clone().add(Y,B),X=D-Z<0,K=R.clone().add(Y+(X?-1:1),B);return+(-(Y+(D-Z)/(X?Z-K:K-Z))||0)},a:function(z){return z<0?Math.ceil(z)||0:Math.floor(z)},p:function(z){return{M:B,y:x,w:y,d:f,D:M,h:d,m:a,s:c,ms:i,Q:L}[z]||String(z||"").toLowerCase().replace(/s$/,"")},u:function(z){return z===void 0}},G="en",A={};A[G]=C;var N="$isDayjsObject",m=function(z){return z instanceof k||!(!z||!z[N])},S=function z(R,D,Y){var Z;if(!R)return G;if(typeof R=="string"){var X=R.toLowerCase();A[X]&&(Z=X),D&&(A[X]=D,Z=X);var K=R.split("-");if(!Z&&K.length>1)return z(K[0])}else{var q=R.name;A[q]=R,Z=q}return!Y&&Z&&(G=Z),Z||!Y&&G},w=function(z,R){if(m(z))return z.clone();var D=typeof R=="object"?R:{};return D.date=z,D.args=arguments,new k(D)},v=V;v.l=S,v.i=m,v.w=function(z,R){return w(z,{locale:R.$L,utc:R.$u,x:R.$x,$offset:R.$offset})};var k=function(){function z(D){this.$L=S(D.locale,null,!0),this.parse(D),this.$x=this.$x||D.x||{},this[N]=!0}var R=z.prototype;return R.parse=function(D){this.$d=function(Y){var Z=Y.date,X=Y.utc;if(Z===null)return new Date(NaN);if(v.u(Z))return new Date;if(Z instanceof Date)return new Date(Z);if(typeof Z=="string"&&!/Z$/i.test(Z)){var K=Z.match(F);if(K){var q=K[2]-1||0,rt=(K[7]||"0").substring(0,3);return X?new Date(Date.UTC(K[1],q,K[3]||1,K[4]||0,K[5]||0,K[6]||0,rt)):new Date(K[1],q,K[3]||1,K[4]||0,K[5]||0,K[6]||0,rt)}}return new Date(Z)}(D),this.init()},R.init=function(){var D=this.$d;this.$y=D.getFullYear(),this.$M=D.getMonth(),this.$D=D.getDate(),this.$W=D.getDay(),this.$H=D.getHours(),this.$m=D.getMinutes(),this.$s=D.getSeconds(),this.$ms=D.getMilliseconds()},R.$utils=function(){return v},R.isValid=function(){return this.$d.toString()!==U},R.isSame=function(D,Y){var Z=w(D);return this.startOf(Y)<=Z&&Z<=this.endOf(Y)},R.isAfter=function(D,Y){return w(D)<this.startOf(Y)},R.isBefore=function(D,Y){return this.endOf(Y)<w(D)},R.$g=function(D,Y,Z){return v.u(D)?this[Y]:this.set(Z,D)},R.unix=function(){return Math.floor(this.valueOf()/1e3)},R.valueOf=function(){return this.$d.getTime()},R.startOf=function(D,Y){var Z=this,X=!!v.u(Y)||Y,K=v.p(D),q=function(g,_){var T=v.w(Z.$u?Date.UTC(Z.$y,_,g):new Date(Z.$y,_,g),Z);return X?T:T.endOf(f)},rt=function(g,_){return v.w(Z.toDate()[g].apply(Z.toDate("s"),(X?[0,0,0,0]:[23,59,59,999]).slice(_)),Z)},At=this.$W,Ut=this.$M,Pt=this.$D,Zt="set"+(this.$u?"UTC":"");switch(K){case x:return X?q(1,0):q(31,11);case B:return X?q(1,Ut):q(0,Ut+1);case y:var Gt=this.$locale().weekStart||0,W=(At<Gt?At+7:At)-Gt;return q(X?Pt-W:Pt+(6-W),Ut);case f:case M:return rt(Zt+"Hours",0);case d:return rt(Zt+"Minutes",1);case a:return rt(Zt+"Seconds",2);case c:return rt(Zt+"Milliseconds",3);default:return this.clone()}},R.endOf=function(D){return this.startOf(D,!1)},R.$set=function(D,Y){var Z,X=v.p(D),K="set"+(this.$u?"UTC":""),q=(Z={},Z[f]=K+"Date",Z[M]=K+"Date",Z[B]=K+"Month",Z[x]=K+"FullYear",Z[d]=K+"Hours",Z[a]=K+"Minutes",Z[c]=K+"Seconds",Z[i]=K+"Milliseconds",Z)[X],rt=X===f?this.$D+(Y-this.$W):Y;if(X===B||X===x){var At=this.clone().set(M,1);At.$d[q](rt),At.init(),this.$d=At.set(M,Math.min(this.$D,At.daysInMonth())).$d}else q&&this.$d[q](rt);return this.init(),this},R.set=function(D,Y){return this.clone().$set(D,Y)},R.get=function(D){return this[v.p(D)]()},R.add=function(D,Y){var Z,X=this;D=Number(D);var K=v.p(Y),q=function(Ut){var Pt=w(X);return v.w(Pt.date(Pt.date()+Math.round(Ut*D)),X)};if(K===B)return this.set(B,this.$M+D);if(K===x)return this.set(x,this.$y+D);if(K===f)return q(1);if(K===y)return q(7);var rt=(Z={},Z[a]=n,Z[d]=s,Z[c]=e,Z)[K]||1,At=this.$d.getTime()+D*rt;return v.w(At,this)},R.subtract=function(D,Y){return this.add(-1*D,Y)},R.format=function(D){var Y=this,Z=this.$locale();if(!this.isValid())return Z.invalidDate||U;var X=D||"YYYY-MM-DDTHH:mm:ssZ",K=v.z(this),q=this.$H,rt=this.$m,At=this.$M,Ut=Z.weekdays,Pt=Z.months,Zt=Z.meridiem,Gt=function(_,T,j,$){return _&&(_[T]||_(Y,X))||j[T].slice(0,$)},W=function(_){return v.s(q%12||12,_,"0")},g=Zt||function(_,T,j){var $=_<12?"AM":"PM";return j?$.toLowerCase():$};return X.replace(O,function(_,T){return T||function(j){switch(j){case"YY":return String(Y.$y).slice(-2);case"YYYY":return v.s(Y.$y,4,"0");case"M":return At+1;case"MM":return v.s(At+1,2,"0");case"MMM":return Gt(Z.monthsShort,At,Pt,3);case"MMMM":return Gt(Pt,At);case"D":return Y.$D;case"DD":return v.s(Y.$D,2,"0");case"d":return String(Y.$W);case"dd":return Gt(Z.weekdaysMin,Y.$W,Ut,2);case"ddd":return Gt(Z.weekdaysShort,Y.$W,Ut,3);case"dddd":return Ut[Y.$W];case"H":return String(q);case"HH":return v.s(q,2,"0");case"h":return W(1);case"hh":return W(2);case"a":return g(q,rt,!0);case"A":return g(q,rt,!1);case"m":return String(rt);case"mm":return v.s(rt,2,"0");case"s":return String(Y.$s);case"ss":return v.s(Y.$s,2,"0");case"SSS":return v.s(Y.$ms,3,"0");case"Z":return K}return null}(_)||K.replace(":","")})},R.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},R.diff=function(D,Y,Z){var X,K=this,q=v.p(Y),rt=w(D),At=(rt.utcOffset()-this.utcOffset())*n,Ut=this-rt,Pt=function(){return v.m(K,rt)};switch(q){case x:X=Pt()/12;break;case B:X=Pt();break;case L:X=Pt()/3;break;case y:X=(Ut-At)/6048e5;break;case f:X=(Ut-At)/864e5;break;case d:X=Ut/s;break;case a:X=Ut/n;break;case c:X=Ut/e;break;default:X=Ut}return Z?X:v.a(X)},R.daysInMonth=function(){return this.endOf(B).$D},R.$locale=function(){return A[this.$L]},R.locale=function(D,Y){if(!D)return this.$L;var Z=this.clone(),X=S(D,Y,!0);return X&&(Z.$L=X),Z},R.clone=function(){return v.w(this.$d,this)},R.toDate=function(){return new Date(this.valueOf())},R.toJSON=function(){return this.isValid()?this.toISOString():null},R.toISOString=function(){return this.$d.toISOString()},R.toString=function(){return this.$d.toUTCString()},z}(),Q=k.prototype;return w.prototype=Q,[["$ms",i],["$s",c],["$m",a],["$H",d],["$W",f],["$M",B],["$y",x],["$D",M]].forEach(function(z){Q[z[1]]=function(R){return this.$g(R,z[0],z[1])}}),w.extend=function(z,R){return z.$i||(z(R,k,w),z.$i=!0),w},w.locale=S,w.isDayjs=m,w.unix=function(z){return w(1e3*z)},w.en=A[G],w.Ls=A,w.p={},w})}(Rn)),Rn.exports}var Ip=Sp();const mr=Vs(Ip);var Pn={exports:{}},Bp=Pn.exports,la;function vp(){return la||(la=1,function(r,t){(function(e,n){r.exports=n()})(Bp,function(){var e,n,s=1e3,i=6e4,c=36e5,a=864e5,d=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,f=31536e6,y=2628e6,B=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,L={years:f,months:y,days:a,hours:c,minutes:i,seconds:s,milliseconds:1,weeks:6048e5},x=function(A){return A instanceof V},M=function(A,N,m){return new V(A,m,N.$l)},U=function(A){return n.p(A)+"s"},F=function(A){return A<0},O=function(A){return F(A)?Math.ceil(A):Math.floor(A)},C=function(A){return Math.abs(A)},P=function(A,N){return A?F(A)?{negative:!0,format:""+C(A)+N}:{negative:!1,format:""+A+N}:{negative:!1,format:""}},V=function(){function A(m,S,w){var v=this;if(this.$d={},this.$l=w,m===void 0&&(this.$ms=0,this.parseFromMilliseconds()),S)return M(m*L[U(S)],this);if(typeof m=="number")return this.$ms=m,this.parseFromMilliseconds(),this;if(typeof m=="object")return Object.keys(m).forEach(function(z){v.$d[U(z)]=m[z]}),this.calMilliseconds(),this;if(typeof m=="string"){var k=m.match(B);if(k){var Q=k.slice(2).map(function(z){return z!=null?Number(z):0});return this.$d.years=Q[0],this.$d.months=Q[1],this.$d.weeks=Q[2],this.$d.days=Q[3],this.$d.hours=Q[4],this.$d.minutes=Q[5],this.$d.seconds=Q[6],this.calMilliseconds(),this}}return this}var N=A.prototype;return N.calMilliseconds=function(){var m=this;this.$ms=Object.keys(this.$d).reduce(function(S,w){return S+(m.$d[w]||0)*L[w]},0)},N.parseFromMilliseconds=function(){var m=this.$ms;this.$d.years=O(m/f),m%=f,this.$d.months=O(m/y),m%=y,this.$d.days=O(m/a),m%=a,this.$d.hours=O(m/c),m%=c,this.$d.minutes=O(m/i),m%=i,this.$d.seconds=O(m/s),m%=s,this.$d.milliseconds=m},N.toISOString=function(){var m=P(this.$d.years,"Y"),S=P(this.$d.months,"M"),w=+this.$d.days||0;this.$d.weeks&&(w+=7*this.$d.weeks);var v=P(w,"D"),k=P(this.$d.hours,"H"),Q=P(this.$d.minutes,"M"),z=this.$d.seconds||0;this.$d.milliseconds&&(z+=this.$d.milliseconds/1e3,z=Math.round(1e3*z)/1e3);var R=P(z,"S"),D=m.negative||S.negative||v.negative||k.negative||Q.negative||R.negative,Y=k.format||Q.format||R.format?"T":"",Z=(D?"-":"")+"P"+m.format+S.format+v.format+Y+k.format+Q.format+R.format;return Z==="P"||Z==="-P"?"P0D":Z},N.toJSON=function(){return this.toISOString()},N.format=function(m){var S=m||"YYYY-MM-DDTHH:mm:ss",w={Y:this.$d.years,YY:n.s(this.$d.years,2,"0"),YYYY:n.s(this.$d.years,4,"0"),M:this.$d.months,MM:n.s(this.$d.months,2,"0"),D:this.$d.days,DD:n.s(this.$d.days,2,"0"),H:this.$d.hours,HH:n.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:n.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:n.s(this.$d.seconds,2,"0"),SSS:n.s(this.$d.milliseconds,3,"0")};return S.replace(d,function(v,k){return k||String(w[v])})},N.as=function(m){return this.$ms/L[U(m)]},N.get=function(m){var S=this.$ms,w=U(m);return w==="milliseconds"?S%=1e3:S=w==="weeks"?O(S/L[w]):this.$d[w],S||0},N.add=function(m,S,w){var v;return v=S?m*L[U(S)]:x(m)?m.$ms:M(m,this).$ms,M(this.$ms+v*(w?-1:1),this)},N.subtract=function(m,S){return this.add(m,S,!0)},N.locale=function(m){var S=this.clone();return S.$l=m,S},N.clone=function(){return M(this.$ms,this)},N.humanize=function(m){return e().add(this.$ms,"ms").locale(this.$l).fromNow(!m)},N.valueOf=function(){return this.asMilliseconds()},N.milliseconds=function(){return this.get("milliseconds")},N.asMilliseconds=function(){return this.as("milliseconds")},N.seconds=function(){return this.get("seconds")},N.asSeconds=function(){return this.as("seconds")},N.minutes=function(){return this.get("minutes")},N.asMinutes=function(){return this.as("minutes")},N.hours=function(){return this.get("hours")},N.asHours=function(){return this.as("hours")},N.days=function(){return this.get("days")},N.asDays=function(){return this.as("days")},N.weeks=function(){return this.get("weeks")},N.asWeeks=function(){return this.as("weeks")},N.months=function(){return this.get("months")},N.asMonths=function(){return this.as("months")},N.years=function(){return this.get("years")},N.asYears=function(){return this.as("years")},A}(),G=function(A,N,m){return A.add(N.years()*m,"y").add(N.months()*m,"M").add(N.days()*m,"d").add(N.hours()*m,"h").add(N.minutes()*m,"m").add(N.seconds()*m,"s").add(N.milliseconds()*m,"ms")};return function(A,N,m){e=m,n=m().$utils(),m.duration=function(v,k){var Q=m.locale();return M(v,{$l:Q},k)},m.isDuration=x;var S=N.prototype.add,w=N.prototype.subtract;N.prototype.add=function(v,k){return x(v)?G(this,v,1):S.bind(this)(v,k)},N.prototype.subtract=function(v,k){return x(v)?G(this,v,-1):w.bind(this)(v,k)}}})}(Pn)),Pn.exports}var xp=vp();const Ap=Vs(xp);mr.extend(Ap);const Ep=r=>{if(r instanceof Date)return mr(r).toISOString();if(r instanceof mr)return r.toISOString();if(r instanceof mr.duration)return r.toISOString();try{return mr.duration(r).toISOString()}catch{return mr(r).toISOString()}},Tp=r=>{const t=r.times.map(e=>Ep(e));return{type:r.type||"range",times:t,resolution:r.resolution,resample:r.resample}};class Mp{datasource;parameters;description;variables;timefilter;geofilter;levelfilter;coordfilter;crs;aggregate;limit;id;constructor(t){this.datasource=t.datasource,this.parameters=t.parameters,this.description=t.description,this.variables=t.variables,this.timefilter=t.timefilter&&Tp(t.timefilter),this.geofilter=t.geofilter,this.levelfilter=t.levelfilter,this.coordfilter=t.coordfilter,this.crs=t.crs,this.aggregate=t.aggregate,this.limit=t.limit,this.id=t.id}toJSON(){return{datasource:this.datasource,parameters:this.parameters,description:this.description,variables:this.variables,timefilter:this.timefilter,geofilter:this.geofilter,levelfilter:this.levelfilter,coordfilter:this.coordfilter,crs:this.crs,aggregate:this.aggregate,limit:this.limit,id:this.id}}}exports.Connector=bp;exports.DataVar=wi;exports.Dataset=Ye;exports.Query=Mp;exports.cftimeToUnixSeconds=Lu;exports.date2num=ep;exports.getSupportedCalendars=rp;exports.hasCFTimeUnits=Uu;exports.isCalendarSupported=Du;exports.num2date=tp;exports.parseCFUnits=Ni;exports.wkb_to_geojson=Cu;
|
|
9
|
+
`))}V.fill(0),s.createHash=function(w){return G(w)},s.createHmac=G,s.randomBytes=function(w,v){if(!v||!v.call)return new M(O(w));try{v.call(this,void 0,new M(O(w)))}catch(k){v(k)}};var N,m=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],S=function(w){s[w]=function(){A("sorry,",w,"is not implemented yet")}};for(N in m)S(m[N])}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){var M=e("./helpers");function U(A,N){A[N>>5]|=128<<N%32,A[14+(N+64>>>9<<4)]=N;for(var m=1732584193,S=-271733879,w=-1732584194,v=271733878,k=0;k<A.length;k+=16){var Q=m,z=S,R=w,D=v,m=O(m,S,w,v,A[k+0],7,-680876936),v=O(v,m,S,w,A[k+1],12,-389564586),w=O(w,v,m,S,A[k+2],17,606105819),S=O(S,w,v,m,A[k+3],22,-1044525330);m=O(m,S,w,v,A[k+4],7,-176418897),v=O(v,m,S,w,A[k+5],12,1200080426),w=O(w,v,m,S,A[k+6],17,-1473231341),S=O(S,w,v,m,A[k+7],22,-45705983),m=O(m,S,w,v,A[k+8],7,1770035416),v=O(v,m,S,w,A[k+9],12,-1958414417),w=O(w,v,m,S,A[k+10],17,-42063),S=O(S,w,v,m,A[k+11],22,-1990404162),m=O(m,S,w,v,A[k+12],7,1804603682),v=O(v,m,S,w,A[k+13],12,-40341101),w=O(w,v,m,S,A[k+14],17,-1502002290),m=C(m,S=O(S,w,v,m,A[k+15],22,1236535329),w,v,A[k+1],5,-165796510),v=C(v,m,S,w,A[k+6],9,-1069501632),w=C(w,v,m,S,A[k+11],14,643717713),S=C(S,w,v,m,A[k+0],20,-373897302),m=C(m,S,w,v,A[k+5],5,-701558691),v=C(v,m,S,w,A[k+10],9,38016083),w=C(w,v,m,S,A[k+15],14,-660478335),S=C(S,w,v,m,A[k+4],20,-405537848),m=C(m,S,w,v,A[k+9],5,568446438),v=C(v,m,S,w,A[k+14],9,-1019803690),w=C(w,v,m,S,A[k+3],14,-187363961),S=C(S,w,v,m,A[k+8],20,1163531501),m=C(m,S,w,v,A[k+13],5,-1444681467),v=C(v,m,S,w,A[k+2],9,-51403784),w=C(w,v,m,S,A[k+7],14,1735328473),m=P(m,S=C(S,w,v,m,A[k+12],20,-1926607734),w,v,A[k+5],4,-378558),v=P(v,m,S,w,A[k+8],11,-2022574463),w=P(w,v,m,S,A[k+11],16,1839030562),S=P(S,w,v,m,A[k+14],23,-35309556),m=P(m,S,w,v,A[k+1],4,-1530992060),v=P(v,m,S,w,A[k+4],11,1272893353),w=P(w,v,m,S,A[k+7],16,-155497632),S=P(S,w,v,m,A[k+10],23,-1094730640),m=P(m,S,w,v,A[k+13],4,681279174),v=P(v,m,S,w,A[k+0],11,-358537222),w=P(w,v,m,S,A[k+3],16,-722521979),S=P(S,w,v,m,A[k+6],23,76029189),m=P(m,S,w,v,A[k+9],4,-640364487),v=P(v,m,S,w,A[k+12],11,-421815835),w=P(w,v,m,S,A[k+15],16,530742520),m=V(m,S=P(S,w,v,m,A[k+2],23,-995338651),w,v,A[k+0],6,-198630844),v=V(v,m,S,w,A[k+7],10,1126891415),w=V(w,v,m,S,A[k+14],15,-1416354905),S=V(S,w,v,m,A[k+5],21,-57434055),m=V(m,S,w,v,A[k+12],6,1700485571),v=V(v,m,S,w,A[k+3],10,-1894986606),w=V(w,v,m,S,A[k+10],15,-1051523),S=V(S,w,v,m,A[k+1],21,-2054922799),m=V(m,S,w,v,A[k+8],6,1873313359),v=V(v,m,S,w,A[k+15],10,-30611744),w=V(w,v,m,S,A[k+6],15,-1560198380),S=V(S,w,v,m,A[k+13],21,1309151649),m=V(m,S,w,v,A[k+4],6,-145523070),v=V(v,m,S,w,A[k+11],10,-1120210379),w=V(w,v,m,S,A[k+2],15,718787259),S=V(S,w,v,m,A[k+9],21,-343485551),m=G(m,Q),S=G(S,z),w=G(w,R),v=G(v,D)}return Array(m,S,w,v)}function F(A,N,m,S,w,v){return G((N=G(G(N,A),G(S,v)))<<w|N>>>32-w,m)}function O(A,N,m,S,w,v,k){return F(N&m|~N&S,A,N,w,v,k)}function C(A,N,m,S,w,v,k){return F(N&S|m&~S,A,N,w,v,k)}function P(A,N,m,S,w,v,k){return F(N^m^S,A,N,w,v,k)}function V(A,N,m,S,w,v,k){return F(m^(N|~S),A,N,w,v,k)}function G(A,N){var m=(65535&A)+(65535&N);return(A>>16)+(N>>16)+(m>>16)<<16|65535&m}n.exports=function(A){return M.hash(A,U,16)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){n.exports=function(M){for(var U,F=new Array(M),O=0;O<M;O++)(3&O)==0&&(U=4294967296*Math.random()),F[O]=U>>>((3&O)<<3)&255;return F}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){var M=e("./helpers");function U(C,P){C[P>>5]|=128<<24-P%32,C[15+(P+64>>9<<4)]=P;for(var V,G,A,N=Array(80),m=1732584193,S=-271733879,w=-1732584194,v=271733878,k=-1009589776,Q=0;Q<C.length;Q+=16){for(var z=m,R=S,D=w,Y=v,Z=k,X=0;X<80;X++){N[X]=X<16?C[Q+X]:O(N[X-3]^N[X-8]^N[X-14]^N[X-16],1);var K=F(F(O(m,5),(K=S,G=w,A=v,(V=X)<20?K&G|~K&A:!(V<40)&&V<60?K&G|K&A|G&A:K^G^A)),F(F(k,N[X]),(V=X)<20?1518500249:V<40?1859775393:V<60?-1894007588:-899497514)),k=v,v=w,w=O(S,30),S=m,m=K}m=F(m,z),S=F(S,R),w=F(w,D),v=F(v,Y),k=F(k,Z)}return Array(m,S,w,v,k)}function F(C,P){var V=(65535&C)+(65535&P);return(C>>16)+(P>>16)+(V>>16)<<16|65535&V}function O(C,P){return C<<P|C>>>32-P}n.exports=function(C){return M.hash(C,U,20,!0)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){function M(P,V){var G=(65535&P)+(65535&V);return(P>>16)+(V>>16)+(G>>16)<<16|65535&G}function U(P,V){var G,A=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),N=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),m=new Array(64);P[V>>5]|=128<<24-V%32,P[15+(V+64>>9<<4)]=V;for(var S,w,v=0;v<P.length;v+=16){for(var k=N[0],Q=N[1],z=N[2],R=N[3],D=N[4],Y=N[5],Z=N[6],X=N[7],K=0;K<64;K++)m[K]=K<16?P[K+v]:M(M(M((w=m[K-2],O(w,17)^O(w,19)^C(w,10)),m[K-7]),(w=m[K-15],O(w,7)^O(w,18)^C(w,3))),m[K-16]),G=M(M(M(M(X,O(w=D,6)^O(w,11)^O(w,25)),D&Y^~D&Z),A[K]),m[K]),S=M(O(S=k,2)^O(S,13)^O(S,22),k&Q^k&z^Q&z),X=Z,Z=Y,Y=D,D=M(R,G),R=z,z=Q,Q=k,k=M(G,S);N[0]=M(k,N[0]),N[1]=M(Q,N[1]),N[2]=M(z,N[2]),N[3]=M(R,N[3]),N[4]=M(D,N[4]),N[5]=M(Y,N[5]),N[6]=M(Z,N[6]),N[7]=M(X,N[7])}return N}var F=e("./helpers"),O=function(P,V){return P>>>V|P<<32-V},C=function(P,V){return P>>>V};n.exports=function(P){return F.hash(P,U,32,!0)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){s.read=function(M,U,F,O,v){var P,V,G=8*v-O-1,A=(1<<G)-1,N=A>>1,m=-7,S=F?v-1:0,w=F?-1:1,v=M[U+S];for(S+=w,P=v&(1<<-m)-1,v>>=-m,m+=G;0<m;P=256*P+M[U+S],S+=w,m-=8);for(V=P&(1<<-m)-1,P>>=-m,m+=O;0<m;V=256*V+M[U+S],S+=w,m-=8);if(P===0)P=1-N;else{if(P===A)return V?NaN:1/0*(v?-1:1);V+=Math.pow(2,O),P-=N}return(v?-1:1)*V*Math.pow(2,P-O)},s.write=function(M,U,F,O,C,k){var V,G,A=8*k-C-1,N=(1<<A)-1,m=N>>1,S=C===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=O?0:k-1,v=O?1:-1,k=U<0||U===0&&1/U<0?1:0;for(U=Math.abs(U),isNaN(U)||U===1/0?(G=isNaN(U)?1:0,V=N):(V=Math.floor(Math.log(U)/Math.LN2),U*(O=Math.pow(2,-V))<1&&(V--,O*=2),2<=(U+=1<=V+m?S/O:S*Math.pow(2,1-m))*O&&(V++,O/=2),N<=V+m?(G=0,V=N):1<=V+m?(G=(U*O-1)*Math.pow(2,C),V+=m):(G=U*Math.pow(2,m-1)*Math.pow(2,C),V=0));8<=C;M[F+w]=255&G,w+=v,G/=256,C-=8);for(V=V<<C|G,A+=C;0<A;M[F+w]=255&V,w+=v,V/=256,A-=8);M[F+w-v]|=128*k}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754")},{buffer:3,lYpoI2:11}],11:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){var M,U,F;function O(){}(i=n.exports={}).nextTick=(U=typeof window<"u"&&window.setImmediate,F=typeof window<"u"&&window.postMessage&&window.addEventListener,U?function(C){return window.setImmediate(C)}:F?(M=[],window.addEventListener("message",function(C){var P=C.source;P!==window&&P!==null||C.data!=="process-tick"||(C.stopPropagation(),0<M.length&&M.shift()())},!0),function(C){M.push(C),window.postMessage("process-tick","*")}):function(C){setTimeout(C,0)}),i.title="browser",i.browser=!0,i.env={},i.argv=[],i.on=O,i.addListener=O,i.once=O,i.off=O,i.removeListener=O,i.removeAllListeners=O,i.emit=O,i.binding=function(C){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(C){throw new Error("process.chdir is not supported")}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:11}]},{},[1])(1)})}(Wi)),Wi.exports}var If=Sf();const Bf=Vs(If);new TextEncoder;const vf=4096;function Nu(r,t,e){let n=t;const s=n+e,i=[];let c="";for(;n<s;){const a=r[n++];if((a&128)===0)i.push(a);else if((a&224)===192){const d=r[n++]&63;i.push((a&31)<<6|d)}else if((a&240)===224){const d=r[n++]&63,f=r[n++]&63;i.push((a&31)<<12|d<<6|f)}else if((a&248)===240){const d=r[n++]&63,f=r[n++]&63,y=r[n++]&63;let B=(a&7)<<18|d<<12|f<<6|y;B>65535&&(B-=65536,i.push(B>>>10&1023|55296),B=56320|B&1023),i.push(B)}else i.push(a);i.length>=vf&&(c+=String.fromCharCode(...i),i.length=0)}return i.length>0&&(c+=String.fromCharCode(...i)),c}const xf=new TextDecoder,Af=200;function Ef(r,t,e){const n=r.subarray(t,t+e);return xf.decode(n)}function Tf(r,t,e){return e>Af?Ef(r,t,e):Nu(r,t,e)}class En{constructor(t,e){this.type=t,this.data=e}}class se extends Error{constructor(t){super(t);const e=Object.create(se.prototype);Object.setPrototypeOf(this,e),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:se.name})}}const Hr=4294967295;function Mf(r,t,e){const n=Math.floor(e/4294967296),s=e;r.setUint32(t,n),r.setUint32(t+4,s)}function Fu(r,t){const e=r.getInt32(t),n=r.getUint32(t+4);return e*4294967296+n}function Nf(r,t){const e=r.getUint32(t),n=r.getUint32(t+4);return e*4294967296+n}const Ff=-1,Of=4294967296-1,kf=17179869184-1;function Df({sec:r,nsec:t}){if(r>=0&&t>=0&&r<=kf)if(t===0&&r<=Of){const e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,r),e}else{const e=r/4294967296,n=r&4294967295,s=new Uint8Array(8),i=new DataView(s.buffer);return i.setUint32(0,t<<2|e&3),i.setUint32(4,n),s}else{const e=new Uint8Array(12),n=new DataView(e.buffer);return n.setUint32(0,t),Mf(n,4,r),e}}function Uf(r){const t=r.getTime(),e=Math.floor(t/1e3),n=(t-e*1e3)*1e6,s=Math.floor(n/1e9);return{sec:e+s,nsec:n-s*1e9}}function Lf(r){if(r instanceof Date){const t=Uf(r);return Df(t)}else return null}function Cf(r){const t=new DataView(r.buffer,r.byteOffset,r.byteLength);switch(r.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{const e=t.getUint32(0),n=t.getUint32(4),s=(e&3)*4294967296+n,i=e>>>2;return{sec:s,nsec:i}}case 12:{const e=Fu(t,4),n=t.getUint32(0);return{sec:e,nsec:n}}default:throw new se(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${r.length}`)}}function Rf(r){const t=Cf(r);return new Date(t.sec*1e3+t.nsec/1e6)}const Pf={type:Ff,encode:Lf,decode:Rf};class us{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Pf)}register({type:t,encode:e,decode:n}){if(t>=0)this.encoders[t]=e,this.decoders[t]=n;else{const s=-1-t;this.builtInEncoders[s]=e,this.builtInDecoders[s]=n}}tryToEncode(t,e){for(let n=0;n<this.builtInEncoders.length;n++){const s=this.builtInEncoders[n];if(s!=null){const i=s(t,e);if(i!=null){const c=-1-n;return new En(c,i)}}}for(let n=0;n<this.encoders.length;n++){const s=this.encoders[n];if(s!=null){const i=s(t,e);if(i!=null){const c=n;return new En(c,i)}}}return t instanceof En?t:null}decode(t,e,n){const s=e<0?this.builtInDecoders[-1-e]:this.decoders[e];return s?s(t,e,n):new En(e,t)}}us.defaultCodec=new us;function $f(r){return r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer}function na(r){return r instanceof Uint8Array?r:ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):$f(r)?new Uint8Array(r):Uint8Array.from(r)}function Zi(r){return`${r<0?"-":""}0x${Math.abs(r).toString(16).padStart(2,"0")}`}const zf=16,jf=16;class Vf{constructor(t=zf,e=jf){this.hit=0,this.miss=0,this.maxKeyLength=t,this.maxLengthPerKey=e,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}find(t,e,n){const s=this.caches[n-1];t:for(const i of s){const c=i.bytes;for(let a=0;a<n;a++)if(c[a]!==t[e+a])continue t;return i.str}return null}store(t,e){const n=this.caches[t.length-1],s={bytes:t,str:e};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=s:n.push(s)}decode(t,e,n){const s=this.find(t,e,n);if(s!=null)return this.hit++,s;this.miss++;const i=Nu(t,e,n),c=Uint8Array.prototype.slice.call(t,e,e+n);return this.store(c,i),i}}const hs="array",cn="map_key",Ou="map_value",Wf=r=>{if(typeof r=="string"||typeof r=="number")return r;throw new se("The type of key must be string or number but "+typeof r)};class Zf{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(t){const e=this.getUninitializedStateFromPool();e.type=hs,e.position=0,e.size=t,e.array=new Array(t)}pushMapState(t){const e=this.getUninitializedStateFromPool();e.type=cn,e.readCount=0,e.size=t,e.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const t={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(t)}return this.stack[this.stackHeadPosition]}release(t){if(this.stack[this.stackHeadPosition]!==t)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(t.type===hs){const n=t;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(t.type===cn||t.type===Ou){const n=t;n.size=0,n.map=void 0,n.readCount=0,n.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const qr=-1,Gs=new DataView(new ArrayBuffer(0)),Gf=new Uint8Array(Gs.buffer);try{Gs.getInt8(0)}catch(r){if(!(r instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const ia=new RangeError("Insufficient data"),Yf=new Vf;class Ys{constructor(t){this.totalPos=0,this.pos=0,this.view=Gs,this.bytes=Gf,this.headByte=qr,this.stack=new Zf,this.entered=!1,this.extensionCodec=t?.extensionCodec??us.defaultCodec,this.context=t?.context,this.useBigInt64=t?.useBigInt64??!1,this.rawStrings=t?.rawStrings??!1,this.maxStrLength=t?.maxStrLength??Hr,this.maxBinLength=t?.maxBinLength??Hr,this.maxArrayLength=t?.maxArrayLength??Hr,this.maxMapLength=t?.maxMapLength??Hr,this.maxExtLength=t?.maxExtLength??Hr,this.keyDecoder=t?.keyDecoder!==void 0?t.keyDecoder:Yf,this.mapKeyConverter=t?.mapKeyConverter??Wf}clone(){return new Ys({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=qr,this.stack.reset()}setBuffer(t){const e=na(t);this.bytes=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.pos=0}appendBuffer(t){if(this.headByte===qr&&!this.hasRemaining(1))this.setBuffer(t);else{const e=this.bytes.subarray(this.pos),n=na(t),s=new Uint8Array(e.length+n.length);s.set(e),s.set(n,e.length),this.setBuffer(s)}}hasRemaining(t){return this.view.byteLength-this.pos>=t}createExtraByteError(t){const{view:e,pos:n}=this;return new RangeError(`Extra ${e.byteLength-n} of ${e.byteLength} byte(s) found at buffer[${t}]`)}decode(t){if(this.entered)return this.clone().decode(t);try{this.entered=!0,this.reinitializeState(),this.setBuffer(t);const e=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return e}finally{this.entered=!1}}*decodeMulti(t){if(this.entered){yield*this.clone().decodeMulti(t);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(t);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(t){if(this.entered)return this.clone().decodeAsync(t);try{this.entered=!0;let e=!1,n;for await(const a of t){if(e)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{n=this.doDecodeSync(),e=!0}catch(d){if(!(d instanceof RangeError))throw d}this.totalPos+=this.pos}if(e){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}const{headByte:s,pos:i,totalPos:c}=this;throw new RangeError(`Insufficient data in parsing ${Zi(s)} at ${c} (${i} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(t){return this.decodeMultiAsync(t,!0)}decodeStream(t){return this.decodeMultiAsync(t,!1)}async*decodeMultiAsync(t,e){if(this.entered){yield*this.clone().decodeMultiAsync(t,e);return}try{this.entered=!0;let n=e,s=-1;for await(const i of t){if(e&&s===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(i),n&&(s=this.readArraySize(),n=!1,this.complete());try{for(;yield this.doDecodeSync(),--s!==0;);}catch(c){if(!(c instanceof RangeError))throw c}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){t:for(;;){const t=this.readHeadByte();let e;if(t>=224)e=t-256;else if(t<192)if(t<128)e=t;else if(t<144){const s=t-128;if(s!==0){this.pushMapState(s),this.complete();continue t}else e={}}else if(t<160){const s=t-144;if(s!==0){this.pushArrayState(s),this.complete();continue t}else e=[]}else{const s=t-160;e=this.decodeString(s,0)}else if(t===192)e=null;else if(t===194)e=!1;else if(t===195)e=!0;else if(t===202)e=this.readF32();else if(t===203)e=this.readF64();else if(t===204)e=this.readU8();else if(t===205)e=this.readU16();else if(t===206)e=this.readU32();else if(t===207)this.useBigInt64?e=this.readU64AsBigInt():e=this.readU64();else if(t===208)e=this.readI8();else if(t===209)e=this.readI16();else if(t===210)e=this.readI32();else if(t===211)this.useBigInt64?e=this.readI64AsBigInt():e=this.readI64();else if(t===217){const s=this.lookU8();e=this.decodeString(s,1)}else if(t===218){const s=this.lookU16();e=this.decodeString(s,2)}else if(t===219){const s=this.lookU32();e=this.decodeString(s,4)}else if(t===220){const s=this.readU16();if(s!==0){this.pushArrayState(s),this.complete();continue t}else e=[]}else if(t===221){const s=this.readU32();if(s!==0){this.pushArrayState(s),this.complete();continue t}else e=[]}else if(t===222){const s=this.readU16();if(s!==0){this.pushMapState(s),this.complete();continue t}else e={}}else if(t===223){const s=this.readU32();if(s!==0){this.pushMapState(s),this.complete();continue t}else e={}}else if(t===196){const s=this.lookU8();e=this.decodeBinary(s,1)}else if(t===197){const s=this.lookU16();e=this.decodeBinary(s,2)}else if(t===198){const s=this.lookU32();e=this.decodeBinary(s,4)}else if(t===212)e=this.decodeExtension(1,0);else if(t===213)e=this.decodeExtension(2,0);else if(t===214)e=this.decodeExtension(4,0);else if(t===215)e=this.decodeExtension(8,0);else if(t===216)e=this.decodeExtension(16,0);else if(t===199){const s=this.lookU8();e=this.decodeExtension(s,1)}else if(t===200){const s=this.lookU16();e=this.decodeExtension(s,2)}else if(t===201){const s=this.lookU32();e=this.decodeExtension(s,4)}else throw new se(`Unrecognized type byte: ${Zi(t)}`);this.complete();const n=this.stack;for(;n.length>0;){const s=n.top();if(s.type===hs)if(s.array[s.position]=e,s.position++,s.position===s.size)e=s.array,n.release(s);else continue t;else if(s.type===cn){if(e==="__proto__")throw new se("The key __proto__ is not allowed");s.key=this.mapKeyConverter(e),s.type=Ou;continue t}else if(s.map[s.key]=e,s.readCount++,s.readCount===s.size)e=s.map,n.release(s);else{s.key=null,s.type=cn;continue t}}return e}}readHeadByte(){return this.headByte===qr&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=qr}readArraySize(){const t=this.readHeadByte();switch(t){case 220:return this.readU16();case 221:return this.readU32();default:{if(t<160)return t-144;throw new se(`Unrecognized array type byte: ${Zi(t)}`)}}}pushMapState(t){if(t>this.maxMapLength)throw new se(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(t)}pushArrayState(t){if(t>this.maxArrayLength)throw new se(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(t)}decodeString(t,e){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(t,e):this.decodeBinary(t,e)}decodeUtf8String(t,e){if(t>this.maxStrLength)throw new se(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+e+t)throw ia;const n=this.pos+e;let s;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(t)?s=this.keyDecoder.decode(this.bytes,n,t):s=Tf(this.bytes,n,t),this.pos+=e+t,s}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===cn:!1}decodeBinary(t,e){if(t>this.maxBinLength)throw new se(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+e))throw ia;const n=this.pos+e,s=this.bytes.subarray(n,n+t);return this.pos+=e+t,s}decodeExtension(t,e){if(t>this.maxExtLength)throw new se(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);const n=this.view.getInt8(this.pos+e),s=this.decodeBinary(t,e+1);return this.extensionCodec.decode(s,n,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){const t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){const t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){const t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){const t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){const t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){const t=Nf(this.view,this.pos);return this.pos+=8,t}readI64(){const t=Fu(this.view,this.pos);return this.pos+=8,t}readU64AsBigInt(){const t=this.view.getBigUint64(this.pos);return this.pos+=8,t}readI64AsBigInt(){const t=this.view.getBigInt64(this.pos);return this.pos+=8,t}readF32(){const t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){const t=this.view.getFloat64(this.pos);return this.pos+=8,t}}function Jf(r,t){return new Ys(t).decode(r)}ya.set("msgpack2",async()=>({kind:"array_to_bytes",fromConfig:(r,t)=>({kind:"array_to_bytes",async encode(e){throw new Error("msgpack2 encode not implemented")},async decode(e){const n=Jf(e),{shape:s}=t,i=new Array(s.length);let c=1;for(let a=s.length-1;a>=0;a--)i[a]=c,c*=s[a];return{data:n,shape:s,stride:i}}})}));function Hf(r){return new Promise(t=>setTimeout(t,r))}const Gi="__cache_created_at";class qf{cache;url;params;cache_prefix;fetchOptions;timeout;ttl;_pending={};_cacheValid;constructor(t,e,n={}){const s={...e};n.parameters&&(s["x-parameters"]=JSON.stringify(n.parameters)),n.chunks&&(s["x-chunks"]=n.chunks),n.downsample&&(s["x-downsample"]=JSON.stringify(n.downsample)),s["x-filtered"]="True",this.params={},e["x-datamesh-auth"]&&(this.params.auth=e["x-datamesh-auth"]),e["x-datamesh-sig"]&&(this.params.sig=e["x-datamesh-sig"]),this.fetchOptions={headers:s},this.url=t,n.nocache&&console.warn("CachedHTTPStore: 'nocache' option is deprecated, use 'ttl: 0' instead"),n.ttl===0||n.nocache||typeof window>"u"?this.cache=void 0:this.cache=Mu("zarr","cache"),this.cache_prefix=Bf({root:t,...n.parameters,chunks:n.chunks,downsample:n.downsample}),this.timeout=n.timeout||6e4,this.ttl=n.ttl}async checkCacheTTL(){if(!this.ttl||!this.cache)return!1;if(this._cacheValid!==void 0)return this._cacheValid;const t=`${this.cache_prefix}${Gi}`,e=await Vi(t,this.cache);return e?(Date.now()-e)/1e3>this.ttl?(this._cacheValid=!1,!1):(this._cacheValid=!0,!0):(this._cacheValid=!1,!1)}async setCacheTimestamp(){if(!this.cache||!this.ttl)return;const t=`${this.cache_prefix}${Gi}`;await Vi(t,this.cache)||await ea(t,Date.now(),this.cache)}async invalidateCache(){if(!this.cache)return;const t=`${this.cache_prefix}${Gi}`;await xn(t,this.cache),this._cacheValid=!1}async get(t,e,n=0){const s=`${this.cache_prefix}${t}`;let i=null;if(this.cache&&(await this.checkCacheTTL()?i=await Vi(s,this.cache):await this.invalidateCache(),i&&delete this._pending[s],this._pending[s]))if(await Hf(200),n>this.timeout){await xn(s,this.cache),delete this._pending[s],console.error("Zarr timeout");return}else return await this.get(t,e,n+200);if(!i){this._pending[s]=!0;try{const c={...this.fetchOptions,...e,headers:{...this.fetchOptions.headers||{},...e?.headers||{}},signal:AbortSignal.timeout(this.timeout)},a=new URLSearchParams(this.params).toString(),d=await fetch(`${this.url}${t}?${a}`,c);if(d.status===404){this.cache&&await xn(s,this.cache);return}if(d.status>=400)throw new Error(`HTTP error: ${d.status}`);i=new Uint8Array(await d.arrayBuffer()),this.cache&&(await ea(s,i,this.cache),await this.setCacheTimestamp())}catch(c){if(console.debug("Zarr retry:"+s),n<this.timeout/200)return delete this._pending[s],await this.get(t,e,n+200);this.cache&&await xn(s,this.cache),console.error(c);return}finally{delete this._pending[s]}}return i}}const sa=async(r,t=".zarray")=>{const{path:e}=r.resolve(t),n=await r.store.get(e);return n?JSON.parse(new TextDecoder().decode(n)):{}};async function Kf(r){const t=await sa(r,".zattrs"),e=await sa(r);e.dtype.startsWith("<M8")&&(t._dtype=e.dtype),e.fill_value!==void 0&&(t._fill_value=e.fill_value);const n=[];e.order==="F"&&n.push({name:"transpose",configuration:{order:"F"}}),typeof e.dtype=="string"&&e.dtype.startsWith(">")&&n.push({name:"bytes",configuration:{endian:"big"}});for(const{id:i,...c}of e.filters??[])n.push({name:i,configuration:c});if(e.compressor){const{id:i,...c}=e.compressor;n.push({name:i,configuration:c})}const s={zarr_format:3,node_type:"array",shape:e.shape,data_type:"int64",chunk_grid:{name:"regular",configuration:{chunk_shape:e.chunks}},chunk_key_encoding:{name:"v2",configuration:{separator:e.dimension_separator??"."}},codecs:n,fill_value:e.fill_value,attributes:t};return new vr(r.store,r.path,s)}let ku=typeof process<"u"&&!!process.env&&process.env.DATAMESH_DEBUG==="true";function oa(){return ku}function Ti(r,t,e){if(!ku)return e;const n=e.value;return e.value=function(...s){const i=s.map(a=>{if(!a||typeof a!="object")return a;try{return JSON.parse(JSON.stringify(a,(d,f)=>{if(typeof d=="string"){const y=d.toLowerCase();if(y.includes("token")||y.includes("authorization")||y.includes("jwt"))return"[redacted]"}return f}))}catch{return"[unserializable]"}}),c=Date.now();try{const a=n.apply(this,s);if(a&&typeof a.then=="function")return a.finally(()=>{const f=Date.now()-c;console.debug(`@oceanum/datamesh debug: ${t} took ${f}ms`,i)});const d=Date.now()-c;return console.debug(`@oceanum/datamesh debug: ${t} took ${d}ms`,i),a}catch(a){const d=Date.now()-c;throw console.debug(`@oceanum/datamesh debug: ${t} threw after ${d}ms`,i),a}},e}const Js={microseconds:.001,milliseconds:1,seconds:1e3,minutes:60*1e3,hours:60*60*1e3,days:24*60*60*1e3},Xf={day:"days",days:"days",d:"days",hour:"hours",hours:"hours",hr:"hours",hrs:"hours",h:"hours",minute:"minutes",minutes:"minutes",min:"minutes",mins:"minutes",second:"seconds",seconds:"seconds",sec:"seconds",secs:"seconds",s:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds",msec:"milliseconds",msecs:"milliseconds",ms:"milliseconds",microsecond:"microseconds",microseconds:"microseconds",usec:"microseconds",usecs:"microseconds",us:"microseconds"},Mi=new Set(["standard","gregorian","proleptic_gregorian"]);function Ni(r){const t=/^\s*(\w+)\s+since\s+(.+?)\s*$/i,e=r.match(t);if(!e)throw new Error(`Invalid CF time units: "${r}". Expected format: "<unit> since <reference_time>"`);const[,n,s]=e,i=n.toLowerCase(),c=Xf[i];if(!c)throw new Error(`Unsupported time unit: "${n}". Supported units: days, hours, minutes, seconds, milliseconds, microseconds`);const a=Qf(s),d=a.getTime();return{unit:c,referenceDate:a,referenceMs:d,original:r}}function Qf(r){const t=r.trim().replace("T"," ").replace(/Z$/i,""),e=/^(-?\d+)-(\d{1,2})-(\d{1,2})(?:\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d+))?)?)?$/,n=t.match(e);if(!n){const C=new Date(r);if(isNaN(C.getTime()))throw new Error(`Cannot parse reference time: "${r}"`);return C}const[,s,i,c,a,d,f,y]=n,B=parseInt(s,10),L=parseInt(i,10)-1,x=parseInt(c,10),M=a?parseInt(a,10):0,U=d?parseInt(d,10):0,F=f?parseInt(f,10):0;let O=0;if(y){const C=y.padEnd(3,"0").slice(0,3);O=parseInt(C,10)}return new Date(Date.UTC(B,L,x,M,U,F,O))}function tp(r,t,e="standard"){if(!Mi.has(e))throw new Error(`Unsupported calendar: "${e}". Currently only Gregorian calendars are supported: standard, gregorian, proleptic_gregorian`);const n=Ni(t),s=Js[n.unit];if(typeof r=="number")return new Date(n.referenceMs+r*s);const i=[];for(let c=0;c<r.length;c++){const a=r[c];a==null||Number.isNaN(a)?i.push(new Date(NaN)):i.push(new Date(n.referenceMs+a*s))}return i}function ep(r,t,e="standard"){if(!Mi.has(e))throw new Error(`Unsupported calendar: "${e}". Currently only Gregorian calendars are supported: standard, gregorian, proleptic_gregorian`);const n=Ni(t),s=Js[n.unit];return r instanceof Date?(r.getTime()-n.referenceMs)/s:r.map(i=>!i||isNaN(i.getTime())?NaN:(i.getTime()-n.referenceMs)/s)}function Du(r){return Mi.has(r.toLowerCase())}function rp(){return Array.from(Mi)}function Uu(r){const t=r.units;return typeof t=="string"&&/^\s*\w+\s+since\s+.+$/i.test(t)}function Lu(r,t,e="standard"){if(!Du(e))return null;const n=Ni(t),s=Js[n.unit],i=n.referenceMs,c=new Float64Array(r.length);for(let a=0;a<r.length;a++){const d=Number(r[a]);Number.isNaN(d)?c[a]=NaN:c[a]=(i+d*s)/1e3}return c}var np=Object.defineProperty,ip=Object.getOwnPropertyDescriptor,sp=(r,t,e,n)=>{for(var s=ip(t,e),i=r.length-1,c;i>=0;i--)(c=r[i])&&(s=c(t,e,s)||s);return s&&np(t,e,s),s};const aa=(r,t,e,n,s)=>n?.variables?.[r]?n.variables[r]:s||(n?.dimensions?t.map((i,c)=>n.dimensions?.[i]??e[c]):e),Cu=r=>{const t=new Tu.Buffer(r,"base64");return bf.Geometry.parse(t).toGeoJSON()},mi=r=>r&&(Array.isArray(r)||ArrayBuffer.isView(r)),Yi=r=>{const t=[];if(!mi(r))return t;for(;t.push(r.length),mi(r[0]);)r=r[0];return t},op=r=>{for(;Array.isArray(r);)r=r[0];if(r==null)return"uint8";switch(r.constructor.name){case"Boolean":return"bool";case"Number":return"float32";case"Int8Array":return"int8";case"Int16Array":return"int16";case"Int32Array":return"int32";case"BigInt64Array":return"int64";case"Uint8Array":return"uint8";case"Uint16Array":return"uint16";case"Uint32Array":return"uint32";case"Float32Array":return"float32";case"Float64Array":return"float64";case"String":return"v2:object";case"Object":return"v2:object"}throw new Error("Unsupported data type: "+r.constructor.name)},ap=r=>{let t=r.toString().toLowerCase();return r.typeId==5?t="v2:object":r.typeId==1&&(t="uint8"),t},ca=r=>{if(!Array.isArray(r))return r;const t=r.flat(1/0);if(mi(t[0])){const e=t[0].length,n=new t[0].constructor(t.length*e);for(let s=0;s<t.length;s++)n.set(t[s],s*e);return n}else return t},ua=r=>{const t=r.length,e=Array(t);for(let n=t-1,s=1;n>=0;n--)e[n]=s,s*=r[n];return e},pn=(r,t,e,n=0)=>{if(t.length===0)return r[0];if(t.length===1){const i=new r.constructor(t[0]);return i.set(r.slice(n,n+t[0])),i}const s=new Array(t[0]);for(let i=0;i<t[0];i++)s[i]=pn(r,t.slice(1),e.slice(1),n+i*e[0]);return s},cp=(r,t)=>{const[e,n]=t.split("<M8"),s=new Float64Array(r.data.length);let i=1n;switch(n){case"[ms]":i=1000n;break;case"[us]":i=1000000n;break;case"[ns]":i=1000000000n;break;default:i=1n;break}for(let c=0;c<r.data.length;c++){const a=r.data[c];s[c]=Number(a/i)}return pn(s,r.shape,r.stride)},up=(r,t,e="standard")=>{const n=Lu(r.data,t,e);return n===null?(console.warn(`Unsupported calendar "${e}" for cftime conversion. Returning raw values. Supported: standard, gregorian, proleptic_gregorian`),pn(r.data,r.shape,r.stride)):pn(n,r.shape,r.stride)},hp=r=>{if(r==null)return!0;if(typeof r=="string"){const t=r.toLowerCase();return t==="nan"||t==="-nan"||t==="+nan"}return typeof r=="number"?Number.isNaN(r):!1},lp=(r,t,e)=>{if(!e.startsWith("float")||hp(t))return r;if(typeof t=="number"&&!Number.isNaN(t)){const n=e==="float64"?new Float64Array(r.length):new Float32Array(r.length);for(let s=0;s<r.length;s++){const i=r[s];n[s]=Math.abs(i-t)<Math.abs(t*1e-6)?NaN:i}return n}return r},Ru=(r,t,e)=>{const n=Object.keys(t),s={};for(const i in r)mi(r[i].data)&&(s[i]=!0);if(n.length==1)for(let i=0;i<t[n[0]];i++){const c={};for(const a in r)s[a]?r[a].data.length>1&&(c[a]=r[a].data[i]):c[a]=r[a].data;e.push(c)}else for(let i=0;i<t[n[0]];i++){const c={};for(const d in r)r[d].dimensions.includes(n[0])?c[d]={attributes:r[d].attributes,data:r[d].data[i],dimensions:r[d].dimensions.slice(1)}:c[d]=r[d];const a={...t};delete a[n[0]],Ru(c,a,e)}return e};class wi{id;dimensions;attributes;arr;constructor(t,e,n,s){this.id=t,this.dimensions=e,this.attributes=n,this.arr=s}async get(t){if(this.arr.shape.length==0||this.arr.shape[0]==0)return[];const e=t&&t.map(s=>{if(typeof s=="string"){const[i,c,a]=s.split(":");return Hi(parseInt(i),parseInt(c),parseInt(a))}else return s}),n=await Uh(this.arr,e);if(this.arr.dtype=="v2:object"||!n.shape)return n.data;if(this.arr.dtype=="bool")return[...n.data];{const s=this.arr.attrs,i=this.arr.dtype,c=s._dtype;if(c?.startsWith("<M8"))return cp(n,c);if(Uu(s)){const f=s.units,y=s.calendar||"standard";return up(n,f,y)}const a=this.attributes._fill_value,d=a?lp(n.data,a,i):n.data;return pn(d,n.shape,n.stride)}}}sp([Ti],wi.prototype,"get");class Ye{dimensions;variables;attributes;coordkeys;root;constructor(t,e,n,s,i){this.dimensions=t,this.variables=e,this.attributes=n,this.coordkeys=s,this.root=i}static async zarr(t,e,n={}){const s=new qf(t,e,{chunks:n.chunks,downsample:n.downsample,parameters:n.parameters,timeout:n.timeout,nocache:n.nocache,ttl:n.ttl}),i=await mh(s),c=await Ge(i,{kind:"group"}),a={},d={};for(const y of i.contents())if(y.kind=="array"){let B;try{B=await Ge(c.resolve(y.path),{kind:"array"})}catch(U){const F=typeof U=="object"&&U&&"message"in U?String(U.message):void 0;if(F&&F.includes("<M8"))B=await Kf(c.resolve(y.path));else throw U}const L={...B.attrs};if(L._fill_value===void 0){const U=`${y.path}/.zarray`.replace(/^\//,""),F=await i.get(`/${U}`);if(F){const O=JSON.parse(new TextDecoder().decode(F));O.fill_value!==void 0&&(L._fill_value=O.fill_value)}}const x=L._ARRAY_DIMENSIONS,M=y.path.split("/").pop();a[M]=new wi(M,x||[],L,B),x&&x.map((U,F)=>{const O=B.shape[F];if(d[U]&&d[U]!=O)throw new Error(`Inconsistent dimension size for ${U}: ${d[U]} != ${O}`);d[U]=O})}const f=JSON.parse(c.attrs._coordinates||"{}")||{};return new Ye(d,a,c.attrs,n.coordkeys||f,c)}static async fromArrow(t,e){const n={},s={record:t.numRows},i={};return t.schema.fields.forEach(c=>{const a=t.getChild(c.name);let d={},f=a?.toArray(),y=ap(c.type);if(tt.isTimestamp(c.type)){const B=new Float64Array(f.length),L=BigInt(1e3**(c.type.unit-0));for(let x=0;x<f.length;x++)B[x]=Number(f[x]/L);f=B,y="float64",d={unit:"Unix timestamp (s)"}}else if(tt.isBinary(c.type)){const B=[];for(let L=0;L<f.length;L++)B.push(new Tu.Buffer(f[L]).toString("base64"));f=B,y="v2:object"}i[c.name]={dimensions:["record"],attributes:d,data:f,dtype:y}}),await Ye.init({dimensions:s,variables:i,attributes:n},e)}static async fromGeojson(t,e){if(!("features"in t&&Array.isArray(t.features))&&!("geometry"in t))throw new Error("Invalid GeoJSON");const n="features"in t&&t.features?t.features:[t];if(n.length===0)throw new Error("FeatureCollection contains no features");const s=new Set;n.forEach(d=>{d.properties&&Object.keys(d.properties).forEach(f=>s.add(f))});const i=n.map(d=>{const f={geometry:d.geometry};return d.properties&&Object.assign(f,d.properties),f}),c={dimensions:{index:i.length},variables:{},attributes:{}},a=await Ye.init(c,{...e,g:"geometry"});await a.assign("geometry",["index"],i.map(d=>d.geometry),{description:"GeoJSON geometry"});for(const d of s){const f=i.map(y=>y[d]);await a.assign(d,["index"],f,{description:`Property: ${d}`})}return a}static async init(t,e,n){const s=await _n(new Map,{attributes:{created:new Date}}),i=new Ye(t.dimensions,{},t.attributes||{},e||{},s);for(const c in t.variables){const{dimensions:a,attributes:d,data:f,dtype:y,chunks:B}=t.variables[c],L=Yi(f),x=aa(c,a,L,n,B);await i.assign(c,a,f,d,y&&y==="string"?"v2:object":y,x)}return i}async asDataframe(){const t={},e=[];for(const s in this.variables)t[s]={attributes:this.variables[s].attributes,dimensions:this.variables[s].dimensions},t[s].data=await this.variables[s].get(),this.variables[s].arr.dtype=="int64"&&s!=this.coordkeys.t&&e.push(s);const n=Ru(t,{...this.dimensions},[]);if(this.coordkeys.t)for(let s=0;s<n.length;s++)n[s][this.coordkeys.t]=new Date(1e3*n[s][this.coordkeys.t]).toISOString();if(e.length>0)for(const s of e)for(let i=0;i<n.length;i++)n[i][s]=Number(n[i][s]);return n}async asGeojson(t){if(!this.coordkeys.g&&!t)throw new Error("No geometry found");const e=[],n=await this.asDataframe();for(let s=0;s<n.length;s++){const{...i}=n[s];let c=t;if(!c&&this.coordkeys.g){delete i[this.coordkeys.g];const a=n[s][this.coordkeys.g];a.slice(0,7)=='{"type:'?c=JSON.parse(a):c=Cu(a)}e.push({type:"Feature",geometry:c,properties:i})}return{type:"FeatureCollection",features:e}}async assign(t,e,n,s,i,c){const a=Yi(n);if(a.length!=e.length)throw new Error("Data shape does not match dimensions");e.map((B,L)=>{if(this.dimensions[B]){if(this.dimensions[B]!=a[L])throw new Error(`Existing size of dimension ${B} does not match new data`)}else this.dimensions[B]=a[L]});const d=i||op(n),f=await _n(this.root.resolve(t),{shape:a,data_type:d,chunk_shape:c||a,codecs:d=="v2:object"?[{name:"json2"}]:[]});let y=ca(n);y.length==0?y=null:d=="bool"?y=new $n(y):Array.isArray(y)&&d=="float32"?y=Float32Array.from(y,B=>B??NaN):Array.isArray(y)&&d=="float64"?y=Float64Array.from(y,B=>B??NaN):Array.isArray(y)&&d=="int8"?y=Int8Array.from(y):Array.isArray(y)&&d=="int16"?y=Int16Array.from(y):Array.isArray(y)&&d=="int32"?y=Int32Array.from(y):Array.isArray(y)&&d=="int64"?y=BigInt64Array.from(y.map(B=>BigInt(B))):Array.isArray(y)&&d=="uint8"?y=Uint8Array.from(y):Array.isArray(y)&&d=="uint16"?y=Uint16Array.from(y):Array.isArray(y)&&d=="uint32"?y=Uint32Array.from(y):Array.isArray(y)&&d=="uint64"&&(y=BigUint64Array.from(y.map(B=>BigInt(B)))),y&&await oo(f,a.map(()=>null),{data:y,shape:a,stride:ua(a)}),this.variables[t]=new wi(t,e,s||{},f)}async toZarr(t){const e=t?.chunks,n=new Map,s=await _n(n,{attributes:{...this.attributes,_coordinates:JSON.stringify(this.coordkeys)}});for(const i in this.variables){const c=this.variables[i],a=await c.get(),d=Yi(a),f=c.dimensions,y=aa(i,f,d,e,e?void 0:c.arr.chunks),B=c.arr.dtype,L=await _n(s.resolve(i),{shape:d,data_type:B,chunk_shape:y,codecs:B==="v2:object"?[{name:"json2"}]:void 0,attributes:{...c.attributes,_ARRAY_DIMENSIONS:f}});let x=ca(a);x&&x.length>0&&(B==="bool"?x=new $n(x):Array.isArray(x)&&B==="float32"?x=Float32Array.from(x,M=>M??NaN):Array.isArray(x)&&B==="float64"?x=Float64Array.from(x,M=>M??NaN):Array.isArray(x)&&B==="int8"?x=Int8Array.from(x):Array.isArray(x)&&B==="int16"?x=Int16Array.from(x):Array.isArray(x)&&B==="int32"?x=Int32Array.from(x):Array.isArray(x)&&B==="int64"?x=BigInt64Array.from(x.map(M=>BigInt(M))):Array.isArray(x)&&B==="uint8"?x=Uint8Array.from(x):Array.isArray(x)&&B==="uint16"?x=Uint16Array.from(x):Array.isArray(x)&&B==="uint32"?x=Uint32Array.from(x):Array.isArray(x)&&B==="uint64"&&(x=BigUint64Array.from(x.map(M=>BigInt(M)))),await oo(L,d.map(()=>null),{data:x,shape:d,stride:ua(d)}))}return n}}var dp=Object.defineProperty,fp=Object.getOwnPropertyDescriptor,pp=(r,t,e,n)=>{for(var s=fp(t,e),i=r.length-1,c;i>=0;i--)(c=r[i])&&(s=c(t,e,s)||s);return s&&dp(t,e,s),s};const Pu=class ls{id;user;creationTime;endTime;write;verified=!1;_connection;_closePromise=null;_closed=!1;_beforeExitHandler=null;static async acquire(t,e={}){if(!t._isV1){const n=new ls;return n.id="dummy_session",n.user="dummy_user",n.creationTime=new Date,n.endTime=new Date(Date.now()+(e.duration||3600)*1e3),n.write=!1,n.verified=!1,n._connection=t,typeof process<"u"&&process.on&&(n._beforeExitHandler=()=>{n.close()},process.once("beforeExit",n._beforeExitHandler)),n}try{const n={...t._authHeaders};n["Cache-Control"]="no-store";const s=new URLSearchParams({duration:String(e.duration??3600)}),i=await fetch(`${t._gateway}/session/?${s.toString()}`,{headers:n});if(i.status!==200)throw new Error(`Failed to create session: ${await i.text()}`);const c=await i.json(),a=new ls;return a.id=c.id,a.user=c.user,a.creationTime=new Date(c.creation_time),a.endTime=new Date(c.end_time),a.write=c.write,a.verified=c.verified||!1,a._connection=t,typeof process<"u"&&process.on&&(a._beforeExitHandler=()=>{a.close()},process.once("beforeExit",a._beforeExitHandler)),a}catch(n){throw new Error(`Error when acquiring datamesh session: ${n}`)}}get header(){return{"X-DATAMESH-SESSIONID":this.id}}addHeader(t){return{...t,...this.header}}async close(t=!1){if(this._connection._isV1&&!this._closed)return this._closePromise?this._closePromise:(this._closePromise=(async()=>{try{this._beforeExitHandler&&typeof process<"u"&&process.off&&(process.off("beforeExit",this._beforeExitHandler),this._beforeExitHandler=null);const e=await fetch(`${this._connection._gateway}/session/${this.id}`,{method:"DELETE",headers:this.header,body:JSON.stringify({finalise_write:t})});if(e.status===204){this._closed=!0;return}const n=await e.text();if(e.status===404&&n.includes("Session not found")){this._closed=!0;return}if(t)throw new Error(`Failed to finalise write: ${n}`);console.warn(`Failed to close session: ${n}`)}catch(e){if(t)throw new Error(`Error when closing datamesh session: ${e}`);console.warn(`Error when closing datamesh session: ${e}`)}finally{this._closePromise=null}})(),this._closePromise)}async enter(){return this}async exit(t){await this.close(t===void 0)}};pp([Ti],Pu,"acquire");let yp=Pu;var gp=Object.defineProperty,mp=Object.getOwnPropertyDescriptor,$u=(r,t,e,n)=>{for(var s=mp(t,e),i=r.length-1,c;i>=0;i--)(c=r[i])&&(s=c(t,e,s)||s);return s&&gp(t,e,s),s};const wp=typeof process<"u"&&process.env?.DATAMESH_SERVICE?process.env.DATAMESH_SERVICE:"https://datamesh.oceanum.io",Hs=class zu{static LAZY_LOAD_SIZE=1e8;_token;_host;_authHeaders;_gateway;_nocache=!1;_isV1=!0;_sessionParams={};_currentSession=null;service;gateway;constructor(t=typeof process<"u"&&process.env?.DATAMESH_TOKEN?process.env.DATAMESH_TOKEN:"$DATAMESH_TOKEN",e){if(!t&&!e?.jwtAuth)throw new Error("A valid datamesh token must be supplied as a connector constructor argument or defined in environment variables as DATAMESH_TOKEN");this._token=t,this._nocache=e?.nocache??!1;const n=new URL(e?.service||wp);this._host=`${n.protocol}//${n.hostname}`,this._authHeaders=e?.jwtAuth?{Authorization:`Bearer ${e.jwtAuth}`}:{Authorization:`Token ${this._token}`,"X-DATAMESH-TOKEN":this._token},this._gateway=e?.gateway||this._host,this._host.split(".").slice(-1)[0]!==this._gateway.split(".").slice(-1)[0]&&console.warn("Datamesh gateway and service domains do not match"),e?.sessionDuration&&typeof e.sessionDuration=="number"&&(this._sessionParams={duration:e.sessionDuration}),this._checkApiVersion()}async _checkApiVersion(){try{(await fetch(`${this._gateway}/session`,{headers:this._authHeaders})).status===200?(this._isV1=!0,console.info("Using datamesh API version 1")):(this._isV1=!1,console.info("Using datamesh API version 0"))}catch{this._isV1=!1,console.info("Using datamesh API version 0")}}get host(){return this._host}async status(){return(await fetch(this._host,{headers:this._authHeaders})).status===200}async validateResponse(t){if(t.status>=400){let e;try{e=(await t.json()).detail}catch{e=`Datamesh server error: ${await t.text()}`}throw new Error(e)}}async createSession(t={}){const e={duration:t.duration||this._sessionParams.duration||3600};return this._currentSession=await yp.acquire(this,e),this._currentSession}async getSession(){return this._currentSession?this._currentSession:this.createSession()}async getSessionHeaders(t={}){return this._isV1&&!this._currentSession&&await this.createSession(),this._currentSession?this._currentSession.addHeader({...this._authHeaders,...t}):{...this._authHeaders,...t}}async metadataRequest(t="",e={}){const n=new URL(`${this._host}/datasource/${t}`);Object.keys(e).forEach(c=>n.searchParams.append(c,e[c]));const s=await this.getSessionHeaders(),i=await fetch(n.toString(),{headers:s});if(i.status===403)throw new Error(`Datasource ${t} not authorized`);return await this.validateResponse(i),i}async dataRequest(t,e="application/vnd.apache.arrow.file"){const n=await this.getSessionHeaders({Accept:e}),s=await fetch(`${this._gateway}/oceanql/${t}?f=arrow`,{headers:n});return await this.validateResponse(s),Bu(await s.arrayBuffer())}async stageRequest(t){oa()&&console.debug("@oceanum/datamesh debug: stageRequest query",t);const e=JSON.stringify(t),n=await this.getSessionHeaders({"Content-Type":"application/json"}),s=await fetch(`${this._gateway}/oceanql/stage/`,{method:"POST",headers:n,body:e});if(s.status>=400){const i=await s.json();throw new Error(i.detail)}else return s.status===204?null:s.json()}async query(t,e={}){oa()&&console.debug("@oceanum/datamesh debug: query called",t);const n=await this.stageRequest(t);if(!n)return console.warn("No data found for query"),null;if(n.size<zu.LAZY_LOAD_SIZE&&n.container!="dataset"){const d=await this.dataRequest(n.qhash);return await Ye.fromArrow(d,n.coordkeys)}const s=`${this._gateway}/zarr/${this._isV1?"query/":""}${n.qhash}`,i=t.parameters,c=await this.getSessionHeaders(),a=await Ye.zarr(s,c,{parameters:i,timeout:e.timeout||6e4,nocache:this._nocache});if(t.variables)for(const d of Object.keys(a.variables))!t.variables.includes(d)&&!Object.values(a.coordkeys).includes(d)&&delete a.variables[d];return a}async getDatasource(t){const n=await(await this.metadataRequest(t)).json();return{id:t,geom:n.geometry,...n.properties}}async loadDatasource(t,e={}){const n={datasource:t,parameters:e};return await this.query(n)}async closeSession(t=!1){this._currentSession&&(await this._currentSession.close(t),this._currentSession=null)}};$u([Ti],Hs.prototype,"stageRequest");$u([Ti],Hs.prototype,"query");let bp=Hs;var Rn={exports:{}},_p=Rn.exports,ha;function Sp(){return ha||(ha=1,function(r,t){(function(e,n){r.exports=n()})(_p,function(){var e=1e3,n=6e4,s=36e5,i="millisecond",c="second",a="minute",d="hour",f="day",y="week",B="month",L="quarter",x="year",M="date",U="Invalid Date",F=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,O=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(z){var R=["th","st","nd","rd"],D=z%100;return"["+z+(R[(D-20)%10]||R[D]||R[0])+"]"}},P=function(z,R,D){var Y=String(z);return!Y||Y.length>=R?z:""+Array(R+1-Y.length).join(D)+z},V={s:P,z:function(z){var R=-z.utcOffset(),D=Math.abs(R),Y=Math.floor(D/60),Z=D%60;return(R<=0?"+":"-")+P(Y,2,"0")+":"+P(Z,2,"0")},m:function z(R,D){if(R.date()<D.date())return-z(D,R);var Y=12*(D.year()-R.year())+(D.month()-R.month()),Z=R.clone().add(Y,B),X=D-Z<0,K=R.clone().add(Y+(X?-1:1),B);return+(-(Y+(D-Z)/(X?Z-K:K-Z))||0)},a:function(z){return z<0?Math.ceil(z)||0:Math.floor(z)},p:function(z){return{M:B,y:x,w:y,d:f,D:M,h:d,m:a,s:c,ms:i,Q:L}[z]||String(z||"").toLowerCase().replace(/s$/,"")},u:function(z){return z===void 0}},G="en",A={};A[G]=C;var N="$isDayjsObject",m=function(z){return z instanceof k||!(!z||!z[N])},S=function z(R,D,Y){var Z;if(!R)return G;if(typeof R=="string"){var X=R.toLowerCase();A[X]&&(Z=X),D&&(A[X]=D,Z=X);var K=R.split("-");if(!Z&&K.length>1)return z(K[0])}else{var q=R.name;A[q]=R,Z=q}return!Y&&Z&&(G=Z),Z||!Y&&G},w=function(z,R){if(m(z))return z.clone();var D=typeof R=="object"?R:{};return D.date=z,D.args=arguments,new k(D)},v=V;v.l=S,v.i=m,v.w=function(z,R){return w(z,{locale:R.$L,utc:R.$u,x:R.$x,$offset:R.$offset})};var k=function(){function z(D){this.$L=S(D.locale,null,!0),this.parse(D),this.$x=this.$x||D.x||{},this[N]=!0}var R=z.prototype;return R.parse=function(D){this.$d=function(Y){var Z=Y.date,X=Y.utc;if(Z===null)return new Date(NaN);if(v.u(Z))return new Date;if(Z instanceof Date)return new Date(Z);if(typeof Z=="string"&&!/Z$/i.test(Z)){var K=Z.match(F);if(K){var q=K[2]-1||0,rt=(K[7]||"0").substring(0,3);return X?new Date(Date.UTC(K[1],q,K[3]||1,K[4]||0,K[5]||0,K[6]||0,rt)):new Date(K[1],q,K[3]||1,K[4]||0,K[5]||0,K[6]||0,rt)}}return new Date(Z)}(D),this.init()},R.init=function(){var D=this.$d;this.$y=D.getFullYear(),this.$M=D.getMonth(),this.$D=D.getDate(),this.$W=D.getDay(),this.$H=D.getHours(),this.$m=D.getMinutes(),this.$s=D.getSeconds(),this.$ms=D.getMilliseconds()},R.$utils=function(){return v},R.isValid=function(){return this.$d.toString()!==U},R.isSame=function(D,Y){var Z=w(D);return this.startOf(Y)<=Z&&Z<=this.endOf(Y)},R.isAfter=function(D,Y){return w(D)<this.startOf(Y)},R.isBefore=function(D,Y){return this.endOf(Y)<w(D)},R.$g=function(D,Y,Z){return v.u(D)?this[Y]:this.set(Z,D)},R.unix=function(){return Math.floor(this.valueOf()/1e3)},R.valueOf=function(){return this.$d.getTime()},R.startOf=function(D,Y){var Z=this,X=!!v.u(Y)||Y,K=v.p(D),q=function(g,_){var T=v.w(Z.$u?Date.UTC(Z.$y,_,g):new Date(Z.$y,_,g),Z);return X?T:T.endOf(f)},rt=function(g,_){return v.w(Z.toDate()[g].apply(Z.toDate("s"),(X?[0,0,0,0]:[23,59,59,999]).slice(_)),Z)},At=this.$W,Ut=this.$M,Pt=this.$D,Zt="set"+(this.$u?"UTC":"");switch(K){case x:return X?q(1,0):q(31,11);case B:return X?q(1,Ut):q(0,Ut+1);case y:var Gt=this.$locale().weekStart||0,W=(At<Gt?At+7:At)-Gt;return q(X?Pt-W:Pt+(6-W),Ut);case f:case M:return rt(Zt+"Hours",0);case d:return rt(Zt+"Minutes",1);case a:return rt(Zt+"Seconds",2);case c:return rt(Zt+"Milliseconds",3);default:return this.clone()}},R.endOf=function(D){return this.startOf(D,!1)},R.$set=function(D,Y){var Z,X=v.p(D),K="set"+(this.$u?"UTC":""),q=(Z={},Z[f]=K+"Date",Z[M]=K+"Date",Z[B]=K+"Month",Z[x]=K+"FullYear",Z[d]=K+"Hours",Z[a]=K+"Minutes",Z[c]=K+"Seconds",Z[i]=K+"Milliseconds",Z)[X],rt=X===f?this.$D+(Y-this.$W):Y;if(X===B||X===x){var At=this.clone().set(M,1);At.$d[q](rt),At.init(),this.$d=At.set(M,Math.min(this.$D,At.daysInMonth())).$d}else q&&this.$d[q](rt);return this.init(),this},R.set=function(D,Y){return this.clone().$set(D,Y)},R.get=function(D){return this[v.p(D)]()},R.add=function(D,Y){var Z,X=this;D=Number(D);var K=v.p(Y),q=function(Ut){var Pt=w(X);return v.w(Pt.date(Pt.date()+Math.round(Ut*D)),X)};if(K===B)return this.set(B,this.$M+D);if(K===x)return this.set(x,this.$y+D);if(K===f)return q(1);if(K===y)return q(7);var rt=(Z={},Z[a]=n,Z[d]=s,Z[c]=e,Z)[K]||1,At=this.$d.getTime()+D*rt;return v.w(At,this)},R.subtract=function(D,Y){return this.add(-1*D,Y)},R.format=function(D){var Y=this,Z=this.$locale();if(!this.isValid())return Z.invalidDate||U;var X=D||"YYYY-MM-DDTHH:mm:ssZ",K=v.z(this),q=this.$H,rt=this.$m,At=this.$M,Ut=Z.weekdays,Pt=Z.months,Zt=Z.meridiem,Gt=function(_,T,j,$){return _&&(_[T]||_(Y,X))||j[T].slice(0,$)},W=function(_){return v.s(q%12||12,_,"0")},g=Zt||function(_,T,j){var $=_<12?"AM":"PM";return j?$.toLowerCase():$};return X.replace(O,function(_,T){return T||function(j){switch(j){case"YY":return String(Y.$y).slice(-2);case"YYYY":return v.s(Y.$y,4,"0");case"M":return At+1;case"MM":return v.s(At+1,2,"0");case"MMM":return Gt(Z.monthsShort,At,Pt,3);case"MMMM":return Gt(Pt,At);case"D":return Y.$D;case"DD":return v.s(Y.$D,2,"0");case"d":return String(Y.$W);case"dd":return Gt(Z.weekdaysMin,Y.$W,Ut,2);case"ddd":return Gt(Z.weekdaysShort,Y.$W,Ut,3);case"dddd":return Ut[Y.$W];case"H":return String(q);case"HH":return v.s(q,2,"0");case"h":return W(1);case"hh":return W(2);case"a":return g(q,rt,!0);case"A":return g(q,rt,!1);case"m":return String(rt);case"mm":return v.s(rt,2,"0");case"s":return String(Y.$s);case"ss":return v.s(Y.$s,2,"0");case"SSS":return v.s(Y.$ms,3,"0");case"Z":return K}return null}(_)||K.replace(":","")})},R.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},R.diff=function(D,Y,Z){var X,K=this,q=v.p(Y),rt=w(D),At=(rt.utcOffset()-this.utcOffset())*n,Ut=this-rt,Pt=function(){return v.m(K,rt)};switch(q){case x:X=Pt()/12;break;case B:X=Pt();break;case L:X=Pt()/3;break;case y:X=(Ut-At)/6048e5;break;case f:X=(Ut-At)/864e5;break;case d:X=Ut/s;break;case a:X=Ut/n;break;case c:X=Ut/e;break;default:X=Ut}return Z?X:v.a(X)},R.daysInMonth=function(){return this.endOf(B).$D},R.$locale=function(){return A[this.$L]},R.locale=function(D,Y){if(!D)return this.$L;var Z=this.clone(),X=S(D,Y,!0);return X&&(Z.$L=X),Z},R.clone=function(){return v.w(this.$d,this)},R.toDate=function(){return new Date(this.valueOf())},R.toJSON=function(){return this.isValid()?this.toISOString():null},R.toISOString=function(){return this.$d.toISOString()},R.toString=function(){return this.$d.toUTCString()},z}(),Q=k.prototype;return w.prototype=Q,[["$ms",i],["$s",c],["$m",a],["$H",d],["$W",f],["$M",B],["$y",x],["$D",M]].forEach(function(z){Q[z[1]]=function(R){return this.$g(R,z[0],z[1])}}),w.extend=function(z,R){return z.$i||(z(R,k,w),z.$i=!0),w},w.locale=S,w.isDayjs=m,w.unix=function(z){return w(1e3*z)},w.en=A[G],w.Ls=A,w.p={},w})}(Rn)),Rn.exports}var Ip=Sp();const mr=Vs(Ip);var Pn={exports:{}},Bp=Pn.exports,la;function vp(){return la||(la=1,function(r,t){(function(e,n){r.exports=n()})(Bp,function(){var e,n,s=1e3,i=6e4,c=36e5,a=864e5,d=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,f=31536e6,y=2628e6,B=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,L={years:f,months:y,days:a,hours:c,minutes:i,seconds:s,milliseconds:1,weeks:6048e5},x=function(A){return A instanceof V},M=function(A,N,m){return new V(A,m,N.$l)},U=function(A){return n.p(A)+"s"},F=function(A){return A<0},O=function(A){return F(A)?Math.ceil(A):Math.floor(A)},C=function(A){return Math.abs(A)},P=function(A,N){return A?F(A)?{negative:!0,format:""+C(A)+N}:{negative:!1,format:""+A+N}:{negative:!1,format:""}},V=function(){function A(m,S,w){var v=this;if(this.$d={},this.$l=w,m===void 0&&(this.$ms=0,this.parseFromMilliseconds()),S)return M(m*L[U(S)],this);if(typeof m=="number")return this.$ms=m,this.parseFromMilliseconds(),this;if(typeof m=="object")return Object.keys(m).forEach(function(z){v.$d[U(z)]=m[z]}),this.calMilliseconds(),this;if(typeof m=="string"){var k=m.match(B);if(k){var Q=k.slice(2).map(function(z){return z!=null?Number(z):0});return this.$d.years=Q[0],this.$d.months=Q[1],this.$d.weeks=Q[2],this.$d.days=Q[3],this.$d.hours=Q[4],this.$d.minutes=Q[5],this.$d.seconds=Q[6],this.calMilliseconds(),this}}return this}var N=A.prototype;return N.calMilliseconds=function(){var m=this;this.$ms=Object.keys(this.$d).reduce(function(S,w){return S+(m.$d[w]||0)*L[w]},0)},N.parseFromMilliseconds=function(){var m=this.$ms;this.$d.years=O(m/f),m%=f,this.$d.months=O(m/y),m%=y,this.$d.days=O(m/a),m%=a,this.$d.hours=O(m/c),m%=c,this.$d.minutes=O(m/i),m%=i,this.$d.seconds=O(m/s),m%=s,this.$d.milliseconds=m},N.toISOString=function(){var m=P(this.$d.years,"Y"),S=P(this.$d.months,"M"),w=+this.$d.days||0;this.$d.weeks&&(w+=7*this.$d.weeks);var v=P(w,"D"),k=P(this.$d.hours,"H"),Q=P(this.$d.minutes,"M"),z=this.$d.seconds||0;this.$d.milliseconds&&(z+=this.$d.milliseconds/1e3,z=Math.round(1e3*z)/1e3);var R=P(z,"S"),D=m.negative||S.negative||v.negative||k.negative||Q.negative||R.negative,Y=k.format||Q.format||R.format?"T":"",Z=(D?"-":"")+"P"+m.format+S.format+v.format+Y+k.format+Q.format+R.format;return Z==="P"||Z==="-P"?"P0D":Z},N.toJSON=function(){return this.toISOString()},N.format=function(m){var S=m||"YYYY-MM-DDTHH:mm:ss",w={Y:this.$d.years,YY:n.s(this.$d.years,2,"0"),YYYY:n.s(this.$d.years,4,"0"),M:this.$d.months,MM:n.s(this.$d.months,2,"0"),D:this.$d.days,DD:n.s(this.$d.days,2,"0"),H:this.$d.hours,HH:n.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:n.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:n.s(this.$d.seconds,2,"0"),SSS:n.s(this.$d.milliseconds,3,"0")};return S.replace(d,function(v,k){return k||String(w[v])})},N.as=function(m){return this.$ms/L[U(m)]},N.get=function(m){var S=this.$ms,w=U(m);return w==="milliseconds"?S%=1e3:S=w==="weeks"?O(S/L[w]):this.$d[w],S||0},N.add=function(m,S,w){var v;return v=S?m*L[U(S)]:x(m)?m.$ms:M(m,this).$ms,M(this.$ms+v*(w?-1:1),this)},N.subtract=function(m,S){return this.add(m,S,!0)},N.locale=function(m){var S=this.clone();return S.$l=m,S},N.clone=function(){return M(this.$ms,this)},N.humanize=function(m){return e().add(this.$ms,"ms").locale(this.$l).fromNow(!m)},N.valueOf=function(){return this.asMilliseconds()},N.milliseconds=function(){return this.get("milliseconds")},N.asMilliseconds=function(){return this.as("milliseconds")},N.seconds=function(){return this.get("seconds")},N.asSeconds=function(){return this.as("seconds")},N.minutes=function(){return this.get("minutes")},N.asMinutes=function(){return this.as("minutes")},N.hours=function(){return this.get("hours")},N.asHours=function(){return this.as("hours")},N.days=function(){return this.get("days")},N.asDays=function(){return this.as("days")},N.weeks=function(){return this.get("weeks")},N.asWeeks=function(){return this.as("weeks")},N.months=function(){return this.get("months")},N.asMonths=function(){return this.as("months")},N.years=function(){return this.get("years")},N.asYears=function(){return this.as("years")},A}(),G=function(A,N,m){return A.add(N.years()*m,"y").add(N.months()*m,"M").add(N.days()*m,"d").add(N.hours()*m,"h").add(N.minutes()*m,"m").add(N.seconds()*m,"s").add(N.milliseconds()*m,"ms")};return function(A,N,m){e=m,n=m().$utils(),m.duration=function(v,k){var Q=m.locale();return M(v,{$l:Q},k)},m.isDuration=x;var S=N.prototype.add,w=N.prototype.subtract;N.prototype.add=function(v,k){return x(v)?G(this,v,1):S.bind(this)(v,k)},N.prototype.subtract=function(v,k){return x(v)?G(this,v,-1):w.bind(this)(v,k)}}})}(Pn)),Pn.exports}var xp=vp();const Ap=Vs(xp);mr.extend(Ap);const Ep=r=>{if(r instanceof Date)return mr(r).toISOString();if(r instanceof mr)return r.toISOString();if(r instanceof mr.duration)return r.toISOString();try{return mr.duration(r).toISOString()}catch{return mr(r).toISOString()}},Tp=r=>{const t=r.times.map(e=>Ep(e));return{type:r.type||"range",times:t,resolution:r.resolution,resample:r.resample}};class Mp{datasource;parameters;description;variables;timefilter;geofilter;levelfilter;coordfilter;crs;aggregate;limit;id;constructor(t){this.datasource=t.datasource,this.parameters=t.parameters,this.description=t.description,this.variables=t.variables,this.timefilter=t.timefilter&&Tp(t.timefilter),this.geofilter=t.geofilter,this.levelfilter=t.levelfilter,this.coordfilter=t.coordfilter,this.crs=t.crs,this.aggregate=t.aggregate,this.limit=t.limit,this.id=t.id}toJSON(){return{datasource:this.datasource,parameters:this.parameters,description:this.description,variables:this.variables,timefilter:this.timefilter,geofilter:this.geofilter,levelfilter:this.levelfilter,coordfilter:this.coordfilter,crs:this.crs,aggregate:this.aggregate,limit:this.limit,id:this.id}}}exports.Connector=bp;exports.DataVar=wi;exports.Dataset=Ye;exports.Query=Mp;exports.cftimeToUnixSeconds=Lu;exports.date2num=ep;exports.getSupportedCalendars=rp;exports.hasCFTimeUnits=Uu;exports.isCalendarSupported=Du;exports.num2date=tp;exports.parseCFUnits=Ni;exports.wkb_to_geojson=Cu;
|
package/dist/index.js
CHANGED
|
@@ -13244,10 +13244,10 @@ class Gf {
|
|
|
13244
13244
|
* Returns true if cache is valid, false if expired.
|
|
13245
13245
|
*/
|
|
13246
13246
|
async checkCacheTTL() {
|
|
13247
|
-
if (!this.ttl || !this.cache) return !
|
|
13247
|
+
if (!this.ttl || !this.cache) return !1;
|
|
13248
13248
|
if (this._cacheValid !== void 0) return this._cacheValid;
|
|
13249
13249
|
const t = `${this.cache_prefix}${Wi}`, e = await zi(t, this.cache);
|
|
13250
|
-
return e ? (Date.now() - e) / 1e3 > this.ttl ? (this._cacheValid = !1, !1) : (this._cacheValid = !0, !0) : (this._cacheValid = !
|
|
13250
|
+
return e ? (Date.now() - e) / 1e3 > this.ttl ? (this._cacheValid = !1, !1) : (this._cacheValid = !0, !0) : (this._cacheValid = !1, !1);
|
|
13251
13251
|
}
|
|
13252
13252
|
/**
|
|
13253
13253
|
* Set the cache creation timestamp if not already set.
|
|
@@ -13264,7 +13264,7 @@ class Gf {
|
|
|
13264
13264
|
async invalidateCache() {
|
|
13265
13265
|
if (!this.cache) return;
|
|
13266
13266
|
const t = `${this.cache_prefix}${Wi}`;
|
|
13267
|
-
await xn(t, this.cache), this._cacheValid =
|
|
13267
|
+
await xn(t, this.cache), this._cacheValid = !1;
|
|
13268
13268
|
}
|
|
13269
13269
|
async get(t, e, n = 0) {
|
|
13270
13270
|
const s = `${this.cache_prefix}${t}`;
|
|
@@ -13751,7 +13751,7 @@ class Qe {
|
|
|
13751
13751
|
* @param options.parameters - Optional parameters for the request.
|
|
13752
13752
|
* @param options.coordkeys - Optional coordinates for the request.
|
|
13753
13753
|
* @param options.timeout - Optional timeout for the request.
|
|
13754
|
-
* @param options.
|
|
13754
|
+
* @param options.ttl - Time to live for cache entries in seconds.
|
|
13755
13755
|
* @returns A promise that resolves to a Dataset instance.
|
|
13756
13756
|
*/
|
|
13757
13757
|
//@measureTime
|
|
@@ -14220,7 +14220,7 @@ const yp = typeof process < "u" && process.env?.DATAMESH_SERVICE ? process.env.D
|
|
|
14220
14220
|
_authHeaders;
|
|
14221
14221
|
_gateway;
|
|
14222
14222
|
_nocache = !1;
|
|
14223
|
-
_isV1 = !
|
|
14223
|
+
_isV1 = !0;
|
|
14224
14224
|
_sessionParams = {};
|
|
14225
14225
|
_currentSession = null;
|
|
14226
14226
|
service;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../../src/lib/connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,qBAAa,SAAS;IACpB,MAAM,CAAC,cAAc,SAAO;IAC5B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,YAAY,CAAyB;IAC7C,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../../src/lib/connector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG1D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,qBAAa,SAAS;IACpB,MAAM,CAAC,cAAc,SAAO;IAC5B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,YAAY,CAAyB;IAC7C,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,cAAc,CAA8B;IACpD,OAAO,CAAC,eAAe,CAAwB;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;;;;;;;;OAYG;gBAED,KAAK,SAEgB,EACrB,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B;IA2CH;;;;OAIG;YACW,gBAAgB;IAqB9B;;;;OAIG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;;OAIG;IACG,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC;IAOhC;;;;;OAKG;YACW,gBAAgB;IAa9B;;;;;;OAMG;IACG,aAAa,CAAC,OAAO,GAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAQ1E;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAOpC;;;;;OAKG;YACW,iBAAiB;IAiB/B;;;;;;OAMG;YACW,eAAe;IAsB7B;;;;;;OAMG;YACW,WAAW;IAYzB;;;;;OAKG;IAEG,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAyBxD;;;;;;OAMG;IAEG,KAAK,CACT,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAO,GACjC,OAAO,CAAC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,GAAG,IAAI,CAAC;IA4C/C;;;;;;OAMG;IAEG,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAU9D;;;;;;OAMG;IAEG,cAAc,CAClB,YAAY,EAAE,MAAM,EACpB,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAM,GAC/C,OAAO,CAAC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,GAAG,IAAI,CAAC;IAM/C;;;;;OAKG;IACG,YAAY,CAAC,aAAa,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAMzD"}
|
package/dist/lib/datamodel.d.ts
CHANGED
|
@@ -141,7 +141,7 @@ export declare class Dataset<S extends HttpZarr | TempZarr> {
|
|
|
141
141
|
* @param options.parameters - Optional parameters for the request.
|
|
142
142
|
* @param options.coordkeys - Optional coordinates for the request.
|
|
143
143
|
* @param options.timeout - Optional timeout for the request.
|
|
144
|
-
* @param options.
|
|
144
|
+
* @param options.ttl - Time to live for cache entries in seconds.
|
|
145
145
|
* @returns A promise that resolves to a Dataset instance.
|
|
146
146
|
*/
|
|
147
147
|
static zarr(url: string, authHeaders: Record<string, string>, options?: ZarrOptions): Promise<Dataset<HttpZarr>>;
|