generated from allen-cell-animated/github-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path961.bundle.js
2 lines (2 loc) · 46.8 KB
/
961.bundle.js
1
2
(self.webpackChunk_aics_vole_app=self.webpackChunk_aics_vole_app||[]).push([[961],{6675:e=>{function t(e,t){const i=new RegExp(t,"g"),r=e.match(i);return r?r.length:0}e.exports=t,e.exports.default=t},8556:(e,t,i)=>{const r=i(3614),s=i(8694),n=i(6675);function o(e,t,i){const o=i&&i.debug||!1,a=!(i&&!1===typeof i.nested),l=i&&i.startIndex||0;o&&console.log("[xml-utils] starting findTagByName with",t," and ",i);const h=r(e,`<${t}[ \n>/]`,l);if(o&&console.log("[xml-utils] start:",h),-1===h)return;const c=e.slice(h+t.length);let f=s(c,"^[^<]*[ /]>",0);const u=-1!==f&&"/"===c[f-1];if(o&&console.log("[xml-utils] selfClosing:",u),!1===u)if(a){let e=0,i=1,r=0;for(;-1!==(f=s(c,"[ /]"+t+">",e));){const s=c.substring(e,f+1);if(i+=n(s,"<"+t+"[ \n\t>]"),r+=n(s,"</"+t+">"),r>=i)break;e=f}}else f=s(c,"[ /]"+t+">",0);const d=h+t.length+f+1;if(o&&console.log("[xml-utils] end:",d),-1===d)return;const g=e.slice(h,d);let p;return p=u?null:g.slice(g.indexOf(">")+1,g.lastIndexOf("<")),{inner:p,outer:g,start:h,end:d}}e.exports=o,e.exports.default=o},563:(e,t,i)=>{const r=i(8556);function s(e,t,i){const s=[],n=i&&i.debug||!1,o=!i||"boolean"!=typeof i.nested||i.nested;let a,l=i&&i.startIndex||0;for(;a=r(e,t,{debug:n,startIndex:l});)l=o?a.start+1+t.length:a.end,s.push(a);return n&&console.log("findTagsByName found",s.length,"tags"),s}e.exports=s,e.exports.default=s},7379:e=>{function t(e,t,i){const r=i&&i.debug||!1;r&&console.log("[xml-utils] getting "+t+" in "+e);const s="object"==typeof e?e.outer:e,n=s.slice(0,s.indexOf(">")+1),o=['"',"'"];for(let e=0;e<o.length;e++){const i=o[e],s=t+"\\="+i+"([^"+i+"]*)"+i;r&&console.log("[xml-utils] pattern:",s);const a=new RegExp(s).exec(n);if(r&&console.log("[xml-utils] match:",a),a)return a[1]}}e.exports=t,e.exports.default=t},8694:e=>{function t(e,t,i){const r=new RegExp(t).exec(e.slice(i));return r?i+r.index+r[0].length-1:-1}e.exports=t,e.exports.default=t},3614:e=>{function t(e,t,i){const r=new RegExp(t).exec(e.slice(i));return r?i+r.index:-1}e.exports=t,e.exports.default=t},8872:(e,t,i)=>{"use strict";i.d(t,{O:()=>o});var r=i(2958),s=i(4935),n=i(8375);function o(e,t,...i){return(0,s.IZ)((0,n.pQ)(e,t,...(0,r.M)(i)))}},2958:(e,t,i)=>{"use strict";i.d(t,{M:()=>o});var r=i(8375);const s=new r.IF,n=(0,r.ME)(null,{next:{value:function(){const e=(0,r.pd)(s,this);return(0,r.zo)(e)}},[r.Ft]:{value:function(){return this}}});function o(e){if(e[r.Ft]===r.$Z&&r.qH.next===r.zo)return e;const t=(0,r.ME)(n);return(0,r.dp)(s,t,(0,r.oO)(e)),t}const a=new r.IF,l=(0,r.ME)(r.H8,{next:{value:function(){const e=(0,r.pd)(a,this);return(0,r.pM)(e)},writable:!0,configurable:!0}});for(const e of(0,r.go)(r.qH))"next"!==e&&(0,r.Eh)(l,e,(0,r.yj)(r.qH,e))},4935:(e,t,i)=>{"use strict";i.d(t,{IZ:()=>u});var r=i(8375);r.p8;const s=new r.f9(4),n=new r.gy(s),o=new r.U9(s),a=new r.ES(512),l=new r.hN(512);for(let e=0;e<256;++e){const t=e-127;t<-24?(a[e]=0,a[256|e]=32768,l[e]=24,l[256|e]=24):t<-14?(a[e]=1024>>-t-14,a[256|e]=1024>>-t-14|32768,l[e]=-t-1,l[256|e]=-t-1):t<=15?(a[e]=t+15<<10,a[256|e]=t+15<<10|32768,l[e]=13,l[256|e]=13):t<128?(a[e]=31744,a[256|e]=64512,l[e]=24,l[256|e]=24):(a[e]=31744,a[256|e]=64512,l[e]=13,l[256|e]=13)}const h=new r.U9(2048);for(let e=1;e<1024;++e){let t=e<<13,i=0;for(;!(8388608&t);)t<<=1,i-=8388608;t&=-8388609,i+=947912704,h[e]=t|i}for(let e=1024;e<2048;++e)h[e]=939524096+(e-1024<<13);const c=new r.U9(64);for(let e=1;e<31;++e)c[e]=e<<23;c[31]=1199570944,c[32]=2147483648;for(let e=33;e<63;++e)c[e]=2147483648+(e-32<<23);c[63]=3347054592;const f=new r.ES(64);for(let e=1;e<64;++e)32!==e&&(f[e]=1024);function u(e){const t=e>>10;return o[0]=h[f[t]+(1023&e)]+c[t],n[0]}},4005:(e,t,i)=>{"use strict";i.d(t,{fK:()=>r});const r="Cannot convert undefined or null to object"},8375:(e,t,i)=>{"use strict";i.d(t,{$Z:()=>k,ES:()=>z,Eh:()=>x,Ft:()=>b,H8:()=>j,IF:()=>X,ME:()=>T,U9:()=>V,dp:()=>ee,f9:()=>R,go:()=>u,gy:()=>$,hN:()=>N,oO:()=>O,p8:()=>p,pM:()=>q,pQ:()=>Y,pd:()=>J,qH:()=>K,yj:()=>h,zo:()=>H});i(4005);function r(e){return(t,...i)=>n(e,t,i)}function s(e,t){return r(h(e,t).get)}const{apply:n,construct:o,defineProperty:a,get:l,getOwnPropertyDescriptor:h,getPrototypeOf:c,has:f,ownKeys:u,set:d,setPrototypeOf:g}=Reflect,{EPSILON:p,MAX_SAFE_INTEGER:y,isFinite:w,isNaN:m}=Number,{iterator:b,species:S,toStringTag:E,for:I}=Symbol,A=Object,{create:T,defineProperty:x,freeze:D,is:M}=A,_=A.prototype,P=(_.__lookupGetter__&&r(_.__lookupGetter__),A.hasOwn||r(_.hasOwnProperty),Array),C=(P.isArray,P.prototype),k=(r(C.join),r(C.push),r(C.toLocaleString),C[b]),O=r(k),{abs:U,trunc:G}=Math,R=ArrayBuffer,F=(R.isView,R.prototype),v=(r(F.slice),s(F,"byteLength"),"undefined"!=typeof SharedArrayBuffer?SharedArrayBuffer:null),L=(v&&s(v.prototype,"byteLength"),c(Uint8Array)),B=(L.from,L.prototype),N=(B[b],r(B.keys),r(B.values),r(B.entries),r(B.set),r(B.reverse),r(B.fill),r(B.copyWithin),r(B.sort),r(B.slice),r(B.subarray),s(B,"buffer"),s(B,"byteOffset"),s(B,"length"),s(B,E),Uint8Array),z=Uint16Array,V=Uint32Array,$=Float32Array,K=c([][b]()),H=r(K.next),q=r(function*(){}().next),j=c(K),W=DataView.prototype,Y=r(W.getUint16),Z=(r(W.setUint16),TypeError,WeakSet.prototype),X=(r(Z.add),r(Z.has),WeakMap),Q=X.prototype,J=r(Q.get),ee=(r(Q.has),r(Q.set))},9698:(e,t,i)=>{"use strict";i.d(t,{_:()=>r,e:()=>s});class r extends Error{constructor(e){super(e),this.name="NodeNotFoundError"}}class s extends Error{constructor(e){super(e),this.name="KeyError"}}},851:(e,t,i)=>{"use strict";i.d(t,{f:()=>n});const r=new Map;function s(e,t){Array.isArray(e)||(e=[e]),e.forEach((e=>r.set(e,t)))}async function n(e){const t=r.get(e.Compression);if(!t)throw new Error(`Unknown compression method identifier: ${e.Compression}`);return new(await t())(e)}s([void 0,1],(()=>i.e(121).then(i.bind(i,5121)).then((e=>e.default)))),s(5,(()=>i.e(764).then(i.bind(i,2764)).then((e=>e.default)))),s(6,(()=>{throw new Error("old style JPEG compression is not supported.")})),s(7,(()=>i.e(457).then(i.bind(i,6457)).then((e=>e.default)))),s([8,32946],(()=>Promise.all([i.e(148),i.e(424)]).then(i.bind(i,424)).then((e=>e.default)))),s(32773,(()=>i.e(30).then(i.bind(i,1030)).then((e=>e.default)))),s(34887,(()=>Promise.all([i.e(148),i.e(414)]).then(i.bind(i,1414)).then((async e=>(await e.zstd.init(),e))).then((e=>e.default)))),s(50001,(()=>i.e(568).then(i.bind(i,6568)).then((e=>e.default))))},5532:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});class r{constructor(e,t,i,r){this._dataView=new DataView(e),this._sliceOffset=t,this._littleEndian=i,this._bigTiff=r}get sliceOffset(){return this._sliceOffset}get sliceTop(){return this._sliceOffset+this.buffer.byteLength}get littleEndian(){return this._littleEndian}get bigTiff(){return this._bigTiff}get buffer(){return this._dataView.buffer}covers(e,t){return this.sliceOffset<=e&&this.sliceTop>=e+t}readUint8(e){return this._dataView.getUint8(e-this._sliceOffset,this._littleEndian)}readInt8(e){return this._dataView.getInt8(e-this._sliceOffset,this._littleEndian)}readUint16(e){return this._dataView.getUint16(e-this._sliceOffset,this._littleEndian)}readInt16(e){return this._dataView.getInt16(e-this._sliceOffset,this._littleEndian)}readUint32(e){return this._dataView.getUint32(e-this._sliceOffset,this._littleEndian)}readInt32(e){return this._dataView.getInt32(e-this._sliceOffset,this._littleEndian)}readFloat32(e){return this._dataView.getFloat32(e-this._sliceOffset,this._littleEndian)}readFloat64(e){return this._dataView.getFloat64(e-this._sliceOffset,this._littleEndian)}readUint64(e){const t=this.readUint32(e),i=this.readUint32(e+4);let r;if(this._littleEndian){if(r=t+2**32*i,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}if(r=2**32*t+i,!Number.isSafeInteger(r))throw new Error(`${r} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return r}readInt64(e){let t=0;const i=(128&this._dataView.getUint8(e+(this._littleEndian?7:0)))>0;let r=!0;for(let s=0;s<8;s++){let n=this._dataView.getUint8(e+(this._littleEndian?s:7-s));i&&(r?0!==n&&(n=255&~(n-1),r=!1):n=255&~n),t+=n*256**s}return i&&(t=-t),t}readOffset(e){return this._bigTiff?this.readUint64(e):this.readUint32(e)}}},6431:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});var r=i(8872);class s{constructor(e){this._dataView=new DataView(e)}get buffer(){return this._dataView.buffer}getUint64(e,t){const i=this.getUint32(e,t),r=this.getUint32(e+4,t);let s;if(t){if(s=i+2**32*r,!Number.isSafeInteger(s))throw new Error(`${s} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return s}if(s=2**32*i+r,!Number.isSafeInteger(s))throw new Error(`${s} exceeds MAX_SAFE_INTEGER. Precision may be lost. Please report if you get this message to https://github.com/geotiffjs/geotiff.js/issues`);return s}getInt64(e,t){let i=0;const r=(128&this._dataView.getUint8(e+(t?7:0)))>0;let s=!0;for(let n=0;n<8;n++){let o=this._dataView.getUint8(e+(t?n:7-n));r&&(s?0!==o&&(o=255&~(o-1),s=!1):o=255&~o),i+=o*256**n}return r&&(i=-i),i}getUint8(e,t){return this._dataView.getUint8(e,t)}getInt8(e,t){return this._dataView.getInt8(e,t)}getUint16(e,t){return this._dataView.getUint16(e,t)}getInt16(e,t){return this._dataView.getInt16(e,t)}getUint32(e,t){return this._dataView.getUint32(e,t)}getInt32(e,t){return this._dataView.getInt32(e,t)}getFloat16(e,t){return(0,r.O)(this._dataView,e,t)}getFloat32(e,t){return this._dataView.getFloat32(e,t)}getFloat64(e,t){return this._dataView.getFloat64(e,t)}}},4276:(e,t,i)=>{"use strict";i.d(t,{uz:()=>g});var r=i(5635),s=i(6431),n=i(5532),o=i(6398),a=i(8622);function l(e){switch(e){case a.s$.BYTE:case a.s$.ASCII:case a.s$.SBYTE:case a.s$.UNDEFINED:return 1;case a.s$.SHORT:case a.s$.SSHORT:return 2;case a.s$.LONG:case a.s$.SLONG:case a.s$.FLOAT:case a.s$.IFD:return 4;case a.s$.RATIONAL:case a.s$.SRATIONAL:case a.s$.DOUBLE:case a.s$.LONG8:case a.s$.SLONG8:case a.s$.IFD8:return 8;default:throw new RangeError(`Invalid field type: ${e}`)}}function h(e,t,i,r){let s=null,n=null;const o=l(t);switch(t){case a.s$.BYTE:case a.s$.ASCII:case a.s$.UNDEFINED:s=new Uint8Array(i),n=e.readUint8;break;case a.s$.SBYTE:s=new Int8Array(i),n=e.readInt8;break;case a.s$.SHORT:s=new Uint16Array(i),n=e.readUint16;break;case a.s$.SSHORT:s=new Int16Array(i),n=e.readInt16;break;case a.s$.LONG:case a.s$.IFD:s=new Uint32Array(i),n=e.readUint32;break;case a.s$.SLONG:s=new Int32Array(i),n=e.readInt32;break;case a.s$.LONG8:case a.s$.IFD8:s=new Array(i),n=e.readUint64;break;case a.s$.SLONG8:s=new Array(i),n=e.readInt64;break;case a.s$.RATIONAL:s=new Uint32Array(2*i),n=e.readUint32;break;case a.s$.SRATIONAL:s=new Int32Array(2*i),n=e.readInt32;break;case a.s$.FLOAT:s=new Float32Array(i),n=e.readFloat32;break;case a.s$.DOUBLE:s=new Float64Array(i),n=e.readFloat64;break;default:throw new RangeError(`Invalid field type: ${t}`)}if(t!==a.s$.RATIONAL&&t!==a.s$.SRATIONAL)for(let t=0;t<i;++t)s[t]=n.call(e,r+t*o);else for(let t=0;t<i;t+=2)s[t]=n.call(e,r+t*o),s[t+1]=n.call(e,r+(t*o+4));return t===a.s$.ASCII?new TextDecoder("utf-8").decode(s):s}class c{constructor(e,t,i){this.fileDirectory=e,this.geoKeyDirectory=t,this.nextIFDByteOffset=i}}class f extends Error{constructor(e){super(`No image at index ${e}`),this.index=e}}class u{async readRasters(e={}){const{window:t,width:i,height:r}=e;let{resX:s,resY:n,bbox:o}=e;const a=await this.getImage();let l=a;const h=await this.getImageCount(),c=a.getBoundingBox();if(t&&o)throw new Error('Both "bbox" and "window" passed.');if(i||r){if(t){const[e,i]=a.getOrigin(),[r,s]=a.getResolution();o=[e+t[0]*r,i+t[1]*s,e+t[2]*r,i+t[3]*s]}const e=o||c;if(i){if(s)throw new Error("Both width and resX passed");s=(e[2]-e[0])/i}if(r){if(n)throw new Error("Both width and resY passed");n=(e[3]-e[1])/r}}if(s||n){const e=[];for(let t=0;t<h;++t){const i=await this.getImage(t),{SubfileType:r,NewSubfileType:s}=i.fileDirectory;(0===t||2===r||1&s)&&e.push(i)}e.sort(((e,t)=>e.getWidth()-t.getWidth()));for(let t=0;t<e.length;++t){const i=e[t],r=(c[2]-c[0])/i.getWidth(),o=(c[3]-c[1])/i.getHeight();if(l=i,s&&s>r||n&&n>o)break}}let f=t;if(o){const[e,t]=a.getOrigin(),[i,r]=l.getResolution(a);f=[Math.round((o[0]-e)/i),Math.round((o[1]-t)/r),Math.round((o[2]-e)/i),Math.round((o[3]-t)/r)],f=[Math.min(f[0],f[2]),Math.min(f[1],f[3]),Math.max(f[0],f[2]),Math.max(f[1],f[3])]}return l.readRasters({...e,window:f})}}class d extends u{constructor(e,t,i,r,s={}){super(),this.source=e,this.littleEndian=t,this.bigTiff=i,this.firstIFDOffset=r,this.cache=s.cache||!1,this.ifdRequests=[],this.ghostValues=null}async getSlice(e,t){const i=this.bigTiff?4048:1024;return new n.A((await this.source.fetch([{offset:e,length:void 0!==t?t:i}]))[0],e,this.littleEndian,this.bigTiff)}async parseFileDirectoryAt(e){const t=this.bigTiff?20:12,i=this.bigTiff?8:2;let r=await this.getSlice(e);const s=this.bigTiff?r.readUint64(e):r.readUint16(e),n=s*t+(this.bigTiff?16:6);r.covers(e,n)||(r=await this.getSlice(e,n));const o={};let f=e+(this.bigTiff?8:2);for(let e=0;e<s;f+=t,++e){const e=r.readUint16(f),t=r.readUint16(f+2),i=this.bigTiff?r.readUint64(f+4):r.readUint32(f+4);let s,n;const c=l(t),u=f+(this.bigTiff?12:8);if(c*i<=(this.bigTiff?8:4))s=h(r,t,i,u);else{const e=r.readOffset(u),n=l(t)*i;s=r.covers(e,n)?h(r,t,i,e):h(await this.getSlice(e,n),t,i,e)}n=1===i&&-1===a.NZ.indexOf(e)&&t!==a.s$.RATIONAL&&t!==a.s$.SRATIONAL?s[0]:s,o[a.$[e]]=n}const u=function(e){const t=e.GeoKeyDirectory;if(!t)return null;const i={};for(let r=4;r<=4*t[3];r+=4){const s=a.Hm[t[r]],n=t[r+1]?a.$[t[r+1]]:null,o=t[r+2],l=t[r+3];let h=null;if(n){if(h=e[n],null==h)throw new Error(`Could not get value of geoKey '${s}'.`);"string"==typeof h?h=h.substring(l,l+o-1):h.subarray&&(h=h.subarray(l,l+o),1===o&&(h=h[0]))}else h=l;i[s]=h}return i}(o),d=r.readOffset(e+i+t*s);return new c(o,u,d)}async requestIFD(e){if(this.ifdRequests[e])return this.ifdRequests[e];if(0===e)return this.ifdRequests[e]=this.parseFileDirectoryAt(this.firstIFDOffset),this.ifdRequests[e];if(!this.ifdRequests[e-1])try{this.ifdRequests[e-1]=this.requestIFD(e-1)}catch(t){if(t instanceof f)throw new f(e);throw t}return this.ifdRequests[e]=(async()=>{const t=await this.ifdRequests[e-1];if(0===t.nextIFDByteOffset)throw new f(e);return this.parseFileDirectoryAt(t.nextIFDByteOffset)})(),this.ifdRequests[e]}async getImage(e=0){const t=await this.requestIFD(e);return new r.A(t.fileDirectory,t.geoKeyDirectory,this.dataView,this.littleEndian,this.cache,this.source)}async getImageCount(){let e=0,t=!0;for(;t;)try{await this.requestIFD(e),++e}catch(e){if(!(e instanceof f))throw e;t=!1}return e}async getGhostValues(){const e=this.bigTiff?16:8;if(this.ghostValues)return this.ghostValues;let t=await this.getSlice(e,130);if("GDAL_STRUCTURAL_METADATA_SIZE="===h(t,a.s$.ASCII,30,e)){const i=h(t,a.s$.ASCII,130,e).split("\n")[0],r=Number(i.split("=")[1].split(" ")[0])+i.length;r>130&&(t=await this.getSlice(e,r));const s=h(t,a.s$.ASCII,r,e);this.ghostValues={},s.split("\n").filter((e=>e.length>0)).map((e=>e.split("="))).forEach((([e,t])=>{this.ghostValues[e]=t}))}return this.ghostValues}static async fromSource(e,t,i){const r=(await e.fetch([{offset:0,length:1024}],i))[0],n=new s.A(r),o=n.getUint16(0,0);let a;if(18761===o)a=!0;else{if(19789!==o)throw new TypeError("Invalid byte order value.");a=!1}const l=n.getUint16(2,a);let h;if(42===l)h=!1;else{if(43!==l)throw new TypeError("Invalid magic number.");if(h=!0,8!==n.getUint16(4,a))throw new Error("Unsupported offset byte-size.")}const c=h?n.getUint64(8,a):n.getUint32(4,a);return new d(e,a,h,c,t)}close(){return"function"==typeof this.source.close&&this.source.close()}}async function g(e,t={},i){return d.fromSource((0,o.sn)(e,t),i)}},5635:(e,t,i)=>{"use strict";i.d(t,{A:()=>u});var r=i(8872),s=i(7379),n=i(563),o=i(8622),a=i(545),l=i(851),h=i(2219);function c(e,t,i){let r=0;for(let s=t;s<i;++s)r+=e[s];return r}function f(e,t,i){switch(e){case 1:if(t<=8)return new Uint8Array(i);if(t<=16)return new Uint16Array(i);if(t<=32)return new Uint32Array(i);break;case 2:if(8===t)return new Int8Array(i);if(16===t)return new Int16Array(i);if(32===t)return new Int32Array(i);break;case 3:switch(t){case 16:case 32:return new Float32Array(i);case 64:return new Float64Array(i)}}throw Error("Unsupported data format/bitsPerSample")}const u=class{constructor(e,t,i,r,s,n){this.fileDirectory=e,this.geoKeys=t,this.dataView=i,this.littleEndian=r,this.tiles=s?{}:null,this.isTiled=!e.StripOffsets;const o=e.PlanarConfiguration;if(this.planarConfiguration=void 0===o?1:o,1!==this.planarConfiguration&&2!==this.planarConfiguration)throw new Error("Invalid planar configuration.");this.source=n}getFileDirectory(){return this.fileDirectory}getGeoKeys(){return this.geoKeys}getWidth(){return this.fileDirectory.ImageWidth}getHeight(){return this.fileDirectory.ImageLength}getSamplesPerPixel(){return void 0!==this.fileDirectory.SamplesPerPixel?this.fileDirectory.SamplesPerPixel:1}getTileWidth(){return this.isTiled?this.fileDirectory.TileWidth:this.getWidth()}getTileHeight(){return this.isTiled?this.fileDirectory.TileLength:void 0!==this.fileDirectory.RowsPerStrip?Math.min(this.fileDirectory.RowsPerStrip,this.getHeight()):this.getHeight()}getBlockWidth(){return this.getTileWidth()}getBlockHeight(e){return this.isTiled||(e+1)*this.getTileHeight()<=this.getHeight()?this.getTileHeight():this.getHeight()-e*this.getTileHeight()}getBytesPerPixel(){let e=0;for(let t=0;t<this.fileDirectory.BitsPerSample.length;++t)e+=this.getSampleByteSize(t);return e}getSampleByteSize(e){if(e>=this.fileDirectory.BitsPerSample.length)throw new RangeError(`Sample index ${e} is out of range.`);return Math.ceil(this.fileDirectory.BitsPerSample[e]/8)}getReaderForSample(e){const t=this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1,i=this.fileDirectory.BitsPerSample[e];switch(t){case 1:if(i<=8)return DataView.prototype.getUint8;if(i<=16)return DataView.prototype.getUint16;if(i<=32)return DataView.prototype.getUint32;break;case 2:if(i<=8)return DataView.prototype.getInt8;if(i<=16)return DataView.prototype.getInt16;if(i<=32)return DataView.prototype.getInt32;break;case 3:switch(i){case 16:return function(e,t){return(0,r.O)(this,e,t)};case 32:return DataView.prototype.getFloat32;case 64:return DataView.prototype.getFloat64}}throw Error("Unsupported data format/bitsPerSample")}getSampleFormat(e=0){return this.fileDirectory.SampleFormat?this.fileDirectory.SampleFormat[e]:1}getBitsPerSample(e=0){return this.fileDirectory.BitsPerSample[e]}getArrayForSample(e,t){return f(this.getSampleFormat(e),this.getBitsPerSample(e),t)}async getTileOrStrip(e,t,i,r,s){const n=Math.ceil(this.getWidth()/this.getTileWidth()),o=Math.ceil(this.getHeight()/this.getTileHeight());let a;const{tiles:l}=this;let h,c;1===this.planarConfiguration?a=t*n+e:2===this.planarConfiguration&&(a=i*n*o+t*n+e),this.isTiled?(h=this.fileDirectory.TileOffsets[a],c=this.fileDirectory.TileByteCounts[a]):(h=this.fileDirectory.StripOffsets[a],c=this.fileDirectory.StripByteCounts[a]);const u=(await this.source.fetch([{offset:h,length:c}],s))[0];let d;return null!==l&&l[a]?d=l[a]:(d=(async()=>{let e=await r.decode(this.fileDirectory,u);const i=this.getSampleFormat(),s=this.getBitsPerSample();return function(e,t){return(1!==e&&2!==e||!(t<=32)||t%8!=0)&&(3!==e||16!==t&&32!==t&&64!==t)}(i,s)&&(e=function(e,t,i,r,s,n,o){const a=new DataView(e),l=2===i?1:r,h=f(t,s,2===i?o*n:o*n*r),c=parseInt("1".repeat(s),2);if(1===t){let e;e=1===i?r*s:s;let t=n*e;7&t&&(t=t+7&-8);for(let e=0;e<o;++e){const i=e*t;for(let t=0;t<n;++t){const r=i+t*l*s;for(let i=0;i<l;++i){const o=r+i*s,f=(e*n+t)*l+i,u=Math.floor(o/8),d=o%8;if(d+s<=8)h[f]=a.getUint8(u)>>8-s-d&c;else if(d+s<=16)h[f]=a.getUint16(u)>>16-s-d&c;else if(d+s<=24){const e=a.getUint16(u)<<8|a.getUint8(u+2);h[f]=e>>24-s-d&c}else h[f]=a.getUint32(u)>>32-s-d&c}}}}return h.buffer}(e,i,this.planarConfiguration,this.getSamplesPerPixel(),s,this.getTileWidth(),this.getBlockHeight(t))),e})(),null!==l&&(l[a]=d)),{x:e,y:t,sample:i,data:await d}}async _readRaster(e,t,i,r,s,n,o,a,l){const f=this.getTileWidth(),u=this.getTileHeight(),d=this.getWidth(),g=this.getHeight(),p=Math.max(Math.floor(e[0]/f),0),y=Math.min(Math.ceil(e[2]/f),Math.ceil(d/f)),w=Math.max(Math.floor(e[1]/u),0),m=Math.min(Math.ceil(e[3]/u),Math.ceil(g/u)),b=e[2]-e[0];let S=this.getBytesPerPixel();const E=[],I=[];for(let e=0;e<t.length;++e)1===this.planarConfiguration?E.push(c(this.fileDirectory.BitsPerSample,0,t[e])/8):E.push(0),I.push(this.getReaderForSample(t[e]));const A=[],{littleEndian:T}=this;for(let n=w;n<m;++n)for(let o=p;o<y;++o){let a;1===this.planarConfiguration&&(a=this.getTileOrStrip(o,n,0,s,l));for(let h=0;h<t.length;++h){const c=h,p=t[h];2===this.planarConfiguration&&(S=this.getSampleByteSize(p),a=this.getTileOrStrip(o,n,p,s,l));const y=a.then((s=>{const n=s.data,o=new DataView(n),a=this.getBlockHeight(s.y),l=s.y*u,h=s.x*f,p=l+a,y=(s.x+1)*f,w=I[c],m=Math.min(a,a-(p-e[3]),g-l),A=Math.min(f,f-(y-e[2]),d-h);for(let s=Math.max(0,e[1]-l);s<m;++s)for(let n=Math.max(0,e[0]-h);n<A;++n){const a=(s*f+n)*S,u=w.call(o,a+E[c],T);let d;r?(d=(s+l-e[1])*b*t.length+(n+h-e[0])*t.length+c,i[d]=u):(d=(s+l-e[1])*b+n+h-e[0],i[c][d]=u)}}));A.push(y)}}if(await Promise.all(A),n&&e[2]-e[0]!==n||o&&e[3]-e[1]!==o){let s;return s=r?(0,h.bV)(i,e[2]-e[0],e[3]-e[1],n,o,t.length,a):(0,h.cg)(i,e[2]-e[0],e[3]-e[1],n,o,a),s.width=n,s.height=o,s}return i.width=n||e[2]-e[0],i.height=o||e[3]-e[1],i}async readRasters({window:e,samples:t=[],interleave:i,pool:r=null,width:s,height:n,resampleMethod:o,fillValue:a,signal:h}={}){const c=e||[0,0,this.getWidth(),this.getHeight()];if(c[0]>c[2]||c[1]>c[3])throw new Error("Invalid subsets");const u=(c[2]-c[0])*(c[3]-c[1]),d=this.getSamplesPerPixel();if(t&&t.length){for(let e=0;e<t.length;++e)if(t[e]>=d)return Promise.reject(new RangeError(`Invalid sample index '${t[e]}'.`))}else for(let e=0;e<d;++e)t.push(e);let g;if(i)g=f(this.fileDirectory.SampleFormat?Math.max.apply(null,this.fileDirectory.SampleFormat):1,Math.max.apply(null,this.fileDirectory.BitsPerSample),u*t.length),a&&g.fill(a);else{g=[];for(let e=0;e<t.length;++e){const i=this.getArrayForSample(t[e],u);Array.isArray(a)&&e<a.length?i.fill(a[e]):a&&!Array.isArray(a)&&i.fill(a),g.push(i)}}const p=r||await(0,l.f)(this.fileDirectory);return await this._readRaster(c,t,g,i,p,s,n,o,h)}async readRGB({window:e,interleave:t=!0,pool:i=null,width:r,height:s,resampleMethod:n,enableAlpha:l=!1,signal:h}={}){const c=e||[0,0,this.getWidth(),this.getHeight()];if(c[0]>c[2]||c[1]>c[3])throw new Error("Invalid subsets");const f=this.fileDirectory.PhotometricInterpretation;if(f===o.ub.RGB){let a=[0,1,2];if(this.fileDirectory.ExtraSamples!==o.AC.Unspecified&&l){a=[];for(let e=0;e<this.fileDirectory.BitsPerSample.length;e+=1)a.push(e)}return this.readRasters({window:e,interleave:t,samples:a,pool:i,width:r,height:s,resampleMethod:n,signal:h})}let u;switch(f){case o.ub.WhiteIsZero:case o.ub.BlackIsZero:case o.ub.Palette:u=[0];break;case o.ub.CMYK:u=[0,1,2,3];break;case o.ub.YCbCr:case o.ub.CIELab:u=[0,1,2];break;default:throw new Error("Invalid or unsupported photometric interpretation.")}const d={window:c,interleave:!0,samples:u,pool:i,width:r,height:s,resampleMethod:n,signal:h},{fileDirectory:g}=this,p=await this.readRasters(d),y=2**this.fileDirectory.BitsPerSample[0];let w;switch(f){case o.ub.WhiteIsZero:w=(0,a.sr)(p,y);break;case o.ub.BlackIsZero:w=(0,a.C1)(p,y);break;case o.ub.Palette:w=(0,a.mo)(p,g.ColorMap);break;case o.ub.CMYK:w=(0,a.Dl)(p);break;case o.ub.YCbCr:w=(0,a.Gy)(p);break;case o.ub.CIELab:w=(0,a.fE)(p);break;default:throw new Error("Unsupported photometric interpretation.")}if(!t){const e=new Uint8Array(w.length/3),t=new Uint8Array(w.length/3),i=new Uint8Array(w.length/3);for(let r=0,s=0;r<w.length;r+=3,++s)e[s]=w[r],t[s]=w[r+1],i[s]=w[r+2];w=[e,t,i]}return w.width=p.width,w.height=p.height,w}getTiePoints(){if(!this.fileDirectory.ModelTiepoint)return[];const e=[];for(let t=0;t<this.fileDirectory.ModelTiepoint.length;t+=6)e.push({i:this.fileDirectory.ModelTiepoint[t],j:this.fileDirectory.ModelTiepoint[t+1],k:this.fileDirectory.ModelTiepoint[t+2],x:this.fileDirectory.ModelTiepoint[t+3],y:this.fileDirectory.ModelTiepoint[t+4],z:this.fileDirectory.ModelTiepoint[t+5]});return e}getGDALMetadata(e=null){const t={};if(!this.fileDirectory.GDAL_METADATA)return null;const i=this.fileDirectory.GDAL_METADATA;let r=n(i,"Item");r=null===e?r.filter((e=>void 0===s(e,"sample"))):r.filter((t=>Number(s(t,"sample"))===e));for(let e=0;e<r.length;++e){const i=r[e];t[s(i,"name")]=i.inner}return t}getGDALNoData(){if(!this.fileDirectory.GDAL_NODATA)return null;const e=this.fileDirectory.GDAL_NODATA;return Number(e.substring(0,e.length-1))}getOrigin(){const e=this.fileDirectory.ModelTiepoint,t=this.fileDirectory.ModelTransformation;if(e&&6===e.length)return[e[3],e[4],e[5]];if(t)return[t[3],t[7],t[11]];throw new Error("The image does not have an affine transformation.")}getResolution(e=null){const t=this.fileDirectory.ModelPixelScale,i=this.fileDirectory.ModelTransformation;if(t)return[t[0],-t[1],t[2]];if(i)return 0===i[1]&&0===i[4]?[i[0],-i[5],i[10]]:[Math.sqrt(i[0]*i[0]+i[4]*i[4]),-Math.sqrt(i[1]*i[1]+i[5]*i[5]),i[10]];if(e){const[t,i,r]=e.getResolution();return[t*e.getWidth()/this.getWidth(),i*e.getHeight()/this.getHeight(),r*e.getWidth()/this.getWidth()]}throw new Error("The image does not have an affine transformation.")}pixelIsArea(){return 1===this.geoKeys.GTRasterTypeGeoKey}getBoundingBox(e=!1){const t=this.getHeight(),i=this.getWidth();if(this.fileDirectory.ModelTransformation&&!e){const[e,r,s,n,o,a,l,h]=this.fileDirectory.ModelTransformation,c=[[0,0],[0,t],[i,0],[i,t]].map((([t,i])=>[n+e*t+r*i,h+o*t+a*i])),f=c.map((e=>e[0])),u=c.map((e=>e[1]));return[Math.min(...f),Math.min(...u),Math.max(...f),Math.max(...u)]}{const e=this.getOrigin(),r=this.getResolution(),s=e[0],n=e[1],o=s+r[0]*i,a=n+r[1]*t;return[Math.min(s,o),Math.min(n,a),Math.max(s,o),Math.max(n,a)]}}}},8622:(e,t,i)=>{"use strict";i.d(t,{$:()=>r,AC:()=>h,Hm:()=>u,NZ:()=>n,S3:()=>f,TZ:()=>c,s$:()=>a,ub:()=>l});const r={315:"Artist",258:"BitsPerSample",265:"CellLength",264:"CellWidth",320:"ColorMap",259:"Compression",33432:"Copyright",306:"DateTime",338:"ExtraSamples",266:"FillOrder",289:"FreeByteCounts",288:"FreeOffsets",291:"GrayResponseCurve",290:"GrayResponseUnit",316:"HostComputer",270:"ImageDescription",257:"ImageLength",256:"ImageWidth",271:"Make",281:"MaxSampleValue",280:"MinSampleValue",272:"Model",254:"NewSubfileType",274:"Orientation",262:"PhotometricInterpretation",284:"PlanarConfiguration",296:"ResolutionUnit",278:"RowsPerStrip",277:"SamplesPerPixel",305:"Software",279:"StripByteCounts",273:"StripOffsets",255:"SubfileType",263:"Threshholding",282:"XResolution",283:"YResolution",326:"BadFaxLines",327:"CleanFaxData",343:"ClipPath",328:"ConsecutiveBadFaxLines",433:"Decode",434:"DefaultImageColor",269:"DocumentName",336:"DotRange",321:"HalftoneHints",346:"Indexed",347:"JPEGTables",285:"PageName",297:"PageNumber",317:"Predictor",319:"PrimaryChromaticities",532:"ReferenceBlackWhite",339:"SampleFormat",340:"SMinSampleValue",341:"SMaxSampleValue",559:"StripRowCounts",330:"SubIFDs",292:"T4Options",293:"T6Options",325:"TileByteCounts",323:"TileLength",324:"TileOffsets",322:"TileWidth",301:"TransferFunction",318:"WhitePoint",344:"XClipPathUnits",286:"XPosition",529:"YCbCrCoefficients",531:"YCbCrPositioning",530:"YCbCrSubSampling",345:"YClipPathUnits",287:"YPosition",37378:"ApertureValue",40961:"ColorSpace",36868:"DateTimeDigitized",36867:"DateTimeOriginal",34665:"Exif IFD",36864:"ExifVersion",33434:"ExposureTime",41728:"FileSource",37385:"Flash",40960:"FlashpixVersion",33437:"FNumber",42016:"ImageUniqueID",37384:"LightSource",37500:"MakerNote",37377:"ShutterSpeedValue",37510:"UserComment",33723:"IPTC",34675:"ICC Profile",700:"XMP",42112:"GDAL_METADATA",42113:"GDAL_NODATA",34377:"Photoshop",33550:"ModelPixelScale",33922:"ModelTiepoint",34264:"ModelTransformation",34735:"GeoKeyDirectory",34736:"GeoDoubleParams",34737:"GeoAsciiParams",50674:"LercParameters"},s={};for(const e in r)r.hasOwnProperty(e)&&(s[r[e]]=parseInt(e,10));const n=[s.BitsPerSample,s.ExtraSamples,s.SampleFormat,s.StripByteCounts,s.StripOffsets,s.StripRowCounts,s.TileByteCounts,s.TileOffsets,s.SubIFDs],o={1:"BYTE",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",6:"SBYTE",7:"UNDEFINED",8:"SSHORT",9:"SLONG",10:"SRATIONAL",11:"FLOAT",12:"DOUBLE",13:"IFD",16:"LONG8",17:"SLONG8",18:"IFD8"},a={};for(const e in o)o.hasOwnProperty(e)&&(a[o[e]]=parseInt(e,10));const l={WhiteIsZero:0,BlackIsZero:1,RGB:2,Palette:3,TransparencyMask:4,CMYK:5,YCbCr:6,CIELab:8,ICCLab:9},h={Unspecified:0,Assocalpha:1,Unassalpha:2},c={Version:0,AddCompression:1},f={None:0,Deflate:1,Zstandard:2},u={1024:"GTModelTypeGeoKey",1025:"GTRasterTypeGeoKey",1026:"GTCitationGeoKey",2048:"GeographicTypeGeoKey",2049:"GeogCitationGeoKey",2050:"GeogGeodeticDatumGeoKey",2051:"GeogPrimeMeridianGeoKey",2052:"GeogLinearUnitsGeoKey",2053:"GeogLinearUnitSizeGeoKey",2054:"GeogAngularUnitsGeoKey",2055:"GeogAngularUnitSizeGeoKey",2056:"GeogEllipsoidGeoKey",2057:"GeogSemiMajorAxisGeoKey",2058:"GeogSemiMinorAxisGeoKey",2059:"GeogInvFlatteningGeoKey",2060:"GeogAzimuthUnitsGeoKey",2061:"GeogPrimeMeridianLongGeoKey",2062:"GeogTOWGS84GeoKey",3072:"ProjectedCSTypeGeoKey",3073:"PCSCitationGeoKey",3074:"ProjectionGeoKey",3075:"ProjCoordTransGeoKey",3076:"ProjLinearUnitsGeoKey",3077:"ProjLinearUnitSizeGeoKey",3078:"ProjStdParallel1GeoKey",3079:"ProjStdParallel2GeoKey",3080:"ProjNatOriginLongGeoKey",3081:"ProjNatOriginLatGeoKey",3082:"ProjFalseEastingGeoKey",3083:"ProjFalseNorthingGeoKey",3084:"ProjFalseOriginLongGeoKey",3085:"ProjFalseOriginLatGeoKey",3086:"ProjFalseOriginEastingGeoKey",3087:"ProjFalseOriginNorthingGeoKey",3088:"ProjCenterLongGeoKey",3089:"ProjCenterLatGeoKey",3090:"ProjCenterEastingGeoKey",3091:"ProjCenterNorthingGeoKey",3092:"ProjScaleAtNatOriginGeoKey",3093:"ProjScaleAtCenterGeoKey",3094:"ProjAzimuthAngleGeoKey",3095:"ProjStraightVertPoleLongGeoKey",3096:"ProjRectifiedGridAngleGeoKey",4096:"VerticalCSTypeGeoKey",4097:"VerticalCitationGeoKey",4098:"VerticalDatumGeoKey",4099:"VerticalUnitsGeoKey"},d={};for(const e in u)u.hasOwnProperty(e)&&(d[u[e]]=parseInt(e,10))},2219:(e,t,i)=>{"use strict";function r(e,t,i,r=1){return new(Object.getPrototypeOf(e).constructor)(t*i*r)}function s(e,t,i){return(1-i)*e+i*t}function n(e,t,i,n,o,a="nearest"){switch(a.toLowerCase()){case"nearest":return function(e,t,i,s,n){const o=t/s,a=i/n;return e.map((e=>{const l=r(e,s,n);for(let r=0;r<n;++r){const n=Math.min(Math.round(a*r),i-1);for(let i=0;i<s;++i){const a=Math.min(Math.round(o*i),t-1),h=e[n*t+a];l[r*s+i]=h}}return l}))}(e,t,i,n,o);case"bilinear":case"linear":return function(e,t,i,n,o){const a=t/n,l=i/o;return e.map((e=>{const h=r(e,n,o);for(let r=0;r<o;++r){const o=l*r,c=Math.floor(o),f=Math.min(Math.ceil(o),i-1);for(let i=0;i<n;++i){const l=a*i,u=l%1,d=Math.floor(l),g=Math.min(Math.ceil(l),t-1),p=e[c*t+d],y=e[c*t+g],w=e[f*t+d],m=e[f*t+g],b=s(s(p,y,u),s(w,m,u),o%1);h[r*n+i]=b}}return h}))}(e,t,i,n,o);default:throw new Error(`Unsupported resampling method: '${a}'`)}}function o(e,t,i,n,o,a,l="nearest"){switch(l.toLowerCase()){case"nearest":return function(e,t,i,s,n,o){const a=t/s,l=i/n,h=r(e,s,n,o);for(let r=0;r<n;++r){const n=Math.min(Math.round(l*r),i-1);for(let i=0;i<s;++i){const l=Math.min(Math.round(a*i),t-1);for(let a=0;a<o;++a){const c=e[n*t*o+l*o+a];h[r*s*o+i*o+a]=c}}}return h}(e,t,i,n,o,a);case"bilinear":case"linear":return function(e,t,i,n,o,a){const l=t/n,h=i/o,c=r(e,n,o,a);for(let r=0;r<o;++r){const o=h*r,f=Math.floor(o),u=Math.min(Math.ceil(o),i-1);for(let i=0;i<n;++i){const h=l*i,d=h%1,g=Math.floor(h),p=Math.min(Math.ceil(h),t-1);for(let l=0;l<a;++l){const h=e[f*t*a+g*a+l],y=e[f*t*a+p*a+l],w=e[u*t*a+g*a+l],m=e[u*t*a+p*a+l],b=s(s(h,y,d),s(w,m,d),o%1);c[r*n*a+i*a+l]=b}}}return c}(e,t,i,n,o,a);default:throw new Error(`Unsupported resampling method: '${l}'`)}}i.d(t,{bV:()=>o,cg:()=>n})},545:(e,t,i)=>{"use strict";function r(e,t){const{width:i,height:r}=e,s=new Uint8Array(i*r*3);let n;for(let i=0,r=0;i<e.length;++i,r+=3)n=256-e[i]/t*256,s[r]=n,s[r+1]=n,s[r+2]=n;return s}function s(e,t){const{width:i,height:r}=e,s=new Uint8Array(i*r*3);let n;for(let i=0,r=0;i<e.length;++i,r+=3)n=e[i]/t*256,s[r]=n,s[r+1]=n,s[r+2]=n;return s}function n(e,t){const{width:i,height:r}=e,s=new Uint8Array(i*r*3),n=t.length/3,o=t.length/3*2;for(let i=0,r=0;i<e.length;++i,r+=3){const a=e[i];s[r]=t[a]/65536*256,s[r+1]=t[a+n]/65536*256,s[r+2]=t[a+o]/65536*256}return s}function o(e){const{width:t,height:i}=e,r=new Uint8Array(t*i*3);for(let t=0,i=0;t<e.length;t+=4,i+=3){const s=e[t],n=e[t+1],o=e[t+2],a=e[t+3];r[i]=(255-s)/256*255*((255-a)/256),r[i+1]=(255-n)/256*255*((255-a)/256),r[i+2]=(255-o)/256*255*((255-a)/256)}return r}function a(e){const{width:t,height:i}=e,r=new Uint8ClampedArray(t*i*3);for(let t=0,i=0;t<e.length;t+=3,i+=3){const s=e[t],n=e[t+1],o=e[t+2];r[i]=s+1.402*(o-128),r[i+1]=s-.34414*(n-128)-.71414*(o-128),r[i+2]=s+1.772*(n-128)}return r}i.d(t,{C1:()=>s,Dl:()=>o,Gy:()=>a,fE:()=>f,mo:()=>n,sr:()=>r});const l=.95047,h=1,c=1.08883;function f(e){const{width:t,height:i}=e,r=new Uint8Array(t*i*3);for(let t=0,i=0;t<e.length;t+=3,i+=3){let s,n,o,a=(e[t+0]+16)/116,f=(e[t+1]<<24>>24)/500+a,u=a-(e[t+2]<<24>>24)/200;f=l*(f*f*f>.008856?f*f*f:(f-16/116)/7.787),a=h*(a*a*a>.008856?a*a*a:(a-16/116)/7.787),u=c*(u*u*u>.008856?u*u*u:(u-16/116)/7.787),s=3.2406*f+-1.5372*a+-.4986*u,n=-.9689*f+1.8758*a+.0415*u,o=.0557*f+-.204*a+1.057*u,s=s>.0031308?1.055*s**(1/2.4)-.055:12.92*s,n=n>.0031308?1.055*n**(1/2.4)-.055:12.92*n,o=o>.0031308?1.055*o**(1/2.4)-.055:12.92*o,r[i]=255*Math.max(0,Math.min(1,s)),r[i+1]=255*Math.max(0,Math.min(1,n)),r[i+2]=255*Math.max(0,Math.min(1,o))}return r}},6932:(e,t,i)=>{"use strict";i.d(t,{R:()=>r});class r{async fetch(e,t=void 0){return Promise.all(e.map((e=>this.fetchSlice(e,t))))}async fetchSlice(e){throw new Error(`fetching of slice ${e} not possible, not implemented`)}get fileSize(){return null}async close(){}}},7371:(e,t,i)=>{"use strict";i.d(t,{k:()=>l});var r=i(2807),s=i(6932),n=i(4119);class o{constructor(e,t,i=null){this.offset=e,this.length=t,this.data=i}get top(){return this.offset+this.length}}class a{constructor(e,t,i){this.offset=e,this.length=t,this.blockIds=i}}class l extends s.R{constructor(e,{blockSize:t=65536,cacheSize:i=100}={}){super(),this.source=e,this.blockSize=t,this.blockCache=new r.A({maxSize:i,onEviction:(e,t)=>{this.evictedBlocks.set(e,t)}}),this.evictedBlocks=new Map,this.blockRequests=new Map,this.blockIdsToFetch=new Set,this.abortedBlockIds=new Set}get fileSize(){return this.source.fileSize}async fetch(e,t){const i=[],r=[],s=[];this.evictedBlocks.clear();for(const{offset:t,length:n}of e){let e=t+n;const{fileSize:o}=this;null!==o&&(e=Math.min(e,o));for(let n=Math.floor(t/this.blockSize)*this.blockSize;n<e;n+=this.blockSize){const e=Math.floor(n/this.blockSize);this.blockCache.has(e)||this.blockRequests.has(e)||(this.blockIdsToFetch.add(e),r.push(e)),this.blockRequests.has(e)&&i.push(this.blockRequests.get(e)),s.push(e)}}await(0,n.uk)(),this.fetchBlocks(t);const o=[];for(const e of r)this.blockRequests.has(e)&&o.push(this.blockRequests.get(e));await Promise.allSettled(i),await Promise.allSettled(o);const a=[],l=s.filter((e=>this.abortedBlockIds.has(e)||!this.blockCache.has(e)));if(l.forEach((e=>this.blockIdsToFetch.add(e))),l.length>0&&t&&!t.aborted){this.fetchBlocks(null);for(const e of l){const t=this.blockRequests.get(e);if(!t)throw new Error(`Block ${e} is not in the block requests`);a.push(t)}await Promise.allSettled(a)}if(t&&t.aborted)throw new n.lc("Request was aborted");const h=s.map((e=>this.blockCache.get(e)||this.evictedBlocks.get(e))),c=h.filter((e=>!e));if(c.length)throw new n.Ym(c,"Request failed");const f=new Map((0,n.yU)(s,h));return this.readSliceData(e,f)}fetchBlocks(e){if(this.blockIdsToFetch.size>0){const t=this.groupBlocks(this.blockIdsToFetch),i=this.source.fetch(t,e);for(let r=0;r<t.length;++r){const s=t[r];for(const t of s.blockIds)this.blockRequests.set(t,(async()=>{try{const e=(await i)[r],s=t*this.blockSize,n=s-e.offset,a=Math.min(n+this.blockSize,e.data.byteLength),l=e.data.slice(n,a),h=new o(s,l.byteLength,l,t);this.blockCache.set(t,h),this.abortedBlockIds.delete(t)}catch(i){if("AbortError"!==i.name)throw i;i.signal=e,this.blockCache.delete(t),this.abortedBlockIds.add(t)}finally{this.blockRequests.delete(t)}})())}this.blockIdsToFetch.clear()}}groupBlocks(e){const t=Array.from(e).sort(((e,t)=>e-t));if(0===t.length)return[];let i=[],r=null;const s=[];for(const e of t)null===r||r+1===e?(i.push(e),r=e):(s.push(new a(i[0]*this.blockSize,i.length*this.blockSize,i)),i=[e],r=e);return s.push(new a(i[0]*this.blockSize,i.length*this.blockSize,i)),s}readSliceData(e,t){return e.map((e=>{let i=e.offset+e.length;null!==this.fileSize&&(i=Math.min(this.fileSize,i));const r=Math.floor(e.offset/this.blockSize),s=Math.floor(i/this.blockSize),n=new ArrayBuffer(e.length),o=new Uint8Array(n);for(let n=r;n<=s;++n){const r=t.get(n),s=r.offset-e.offset;let a,l=0,h=0;s<0?l=-s:s>0&&(h=s),a=r.top-i<0?r.length-l:i-r.offset-l;const c=new Uint8Array(r.data,l,a);o.set(c,h)}return n}))}}},1391:(e,t,i)=>{"use strict";i.d(t,{V:()=>s,r:()=>r});class r{get ok(){return this.status>=200&&this.status<=299}get status(){throw new Error("not implemented")}getHeader(e){throw new Error("not implemented")}async getData(){throw new Error("not implemented")}}class s{constructor(e){this.url=e}async request({headers:e,signal:t}={}){throw new Error("request is not implemented")}}},3368:(e,t,i)=>{"use strict";i.d(t,{i:()=>n});var r=i(1391);class s extends r.r{constructor(e){super(),this.response=e}get status(){return this.response.status}getHeader(e){return this.response.headers.get(e)}async getData(){return this.response.arrayBuffer?await this.response.arrayBuffer():(await this.response.buffer()).buffer}}class n extends r.V{constructor(e,t){super(e),this.credentials=t}async request({headers:e,signal:t}={}){const i=await fetch(this.url,{headers:e,credentials:this.credentials,signal:t});return new s(i)}}},7110:(e,t,i)=>{"use strict";i.d(t,{Q:()=>h});var r=i(8625),s=i(6504),n=i(6580),o=i(1391),a=i(4119);class l extends o.r{constructor(e,t){super(),this.response=e,this.dataPromise=t}get status(){return this.response.statusCode}getHeader(e){return this.response.headers[e]}async getData(){return await this.dataPromise}}class h extends o.V{constructor(e){super(e),this.parsedUrl=n.parse(this.url),this.httpApi="http:"===this.parsedUrl.protocol?r:s}constructRequest(e,t){return new Promise(((i,r)=>{const s=this.httpApi.get({...this.parsedUrl,headers:e},(e=>{const t=new Promise((t=>{const i=[];e.on("data",(e=>{i.push(e)})),e.on("end",(()=>{const e=Buffer.concat(i).buffer;t(e)})),e.on("error",r)}));i(new l(e,t))}));s.on("error",r),t&&(t.aborted&&s.destroy(new a.lc("Request aborted")),t.addEventListener("abort",(()=>s.destroy(new a.lc("Request aborted")))))}))}async request({headers:e,signal:t}={}){return await this.constructRequest(e,t)}}},8582:(e,t,i)=>{"use strict";i.d(t,{g:()=>o});var r=i(1391),s=i(4119);class n extends r.r{constructor(e,t){super(),this.xhr=e,this.data=t}get status(){return this.xhr.status}getHeader(e){return this.xhr.getResponseHeader(e)}async getData(){return this.data}}class o extends r.V{constructRequest(e,t){return new Promise(((i,r)=>{const o=new XMLHttpRequest;o.open("GET",this.url),o.responseType="arraybuffer";for(const[t,i]of Object.entries(e))o.setRequestHeader(t,i);o.onload=()=>{const e=o.response;i(new n(o,e))},o.onerror=r,o.onabort=()=>r(new s.lc("Request aborted")),o.send(),t&&(t.aborted&&o.abort(),t.addEventListener("abort",(()=>o.abort())))}))}async request({headers:e,signal:t}={}){return await this.constructRequest(e,t)}}},7615:(e,t,i)=>{"use strict";i.d(t,{C5:()=>a,sT:()=>l,xk:()=>o});const r="\r\n\r\n";function s(e){if(void 0!==Object.fromEntries)return Object.fromEntries(e);const t={};for(const[i,r]of e)t[i.toLowerCase()]=r;return t}function n(e){return s(e.split("\r\n").map((e=>{const t=e.split(":").map((e=>e.trim()));return t[0]=t[0].toLowerCase(),t})))}function o(e){const[t,...i]=e.split(";").map((e=>e.trim()));return{type:t,params:s(i.map((e=>e.split("="))))}}function a(e){let t,i,r;return e&&([,t,i,r]=e.match(/bytes (\d+)-(\d+)\/(\d+)/),t=parseInt(t,10),i=parseInt(i,10),r=parseInt(r,10)),{start:t,end:i,total:r}}function l(e,t){let i=null;const s=new TextDecoder("ascii"),o=[],l=`--${t}`,h=`${l}--`;for(let t=0;t<10;++t)s.decode(new Uint8Array(e,t,l.length))===l&&(i=t);if(null===i)throw new Error("Could not find initial boundary");for(;i<e.byteLength;){const t=s.decode(new Uint8Array(e,i,Math.min(l.length+1024,e.byteLength-i)));if(0===t.length||t.startsWith(h))break;if(!t.startsWith(l))throw new Error("Part does not start with boundary");const c=t.substr(l.length+2);if(0===c.length)break;const f=c.indexOf(r),u=n(c.substr(0,f)),{start:d,end:g,total:p}=a(u["content-range"]),y=i+l.length+f+r.length,w=parseInt(g,10)+1-parseInt(d,10);o.push({headers:u,data:e.slice(y,y+w),offset:d,length:w,fileSize:p}),i=y+w+4}return o}},6398:(e,t,i)=>{"use strict";i.d(t,{sn:()=>f});var r=i(7615),s=i(6932),n=i(7371),o=i(3368),a=i(8582),l=i(7110);class h extends s.R{constructor(e,t,i,r){super(),this.client=e,this.headers=t,this.maxRanges=i,this.allowFullFile=r,this._fileSize=null}async fetch(e,t){return this.maxRanges>=e.length?this.fetchSlices(e,t):(this.maxRanges>0&&e.length,Promise.all(e.map((e=>this.fetchSlice(e,t)))))}async fetchSlices(e,t){const i=await this.client.request({headers:{...this.headers,Range:`bytes=${e.map((({offset:e,length:t})=>`${e}-${e+t}`)).join(",")}`},signal:t});if(i.ok){if(206===i.status){const{type:s,params:n}=(0,r.xk)(i.getHeader("content-type"));if("multipart/byteranges"===s){const e=(0,r.sT)(await i.getData(),n.boundary);return this._fileSize=e[0].fileSize||null,e}const o=await i.getData(),{start:a,end:l,total:h}=(0,r.C5)(i.getHeader("content-range"));this._fileSize=h||null;const c=[{data:o,offset:a,length:l-a}];if(e.length>1){const i=await Promise.all(e.slice(1).map((e=>this.fetchSlice(e,t))));return c.concat(i)}return c}{if(!this.allowFullFile)throw new Error("Server responded with full file");const e=await i.getData();return this._fileSize=e.byteLength,[{data:e,offset:0,length:e.byteLength}]}}throw new Error("Error fetching data.")}async fetchSlice(e,t){const{offset:i,length:s}=e,n=await this.client.request({headers:{...this.headers,Range:`bytes=${i}-${i+s}`},signal:t});if(n.ok){if(206===n.status){const e=await n.getData(),{total:t}=(0,r.C5)(n.getHeader("content-range"));return this._fileSize=t||null,{data:e,offset:i,length:s}}{if(!this.allowFullFile)throw new Error("Server responded with full file");const e=await n.getData();return this._fileSize=e.byteLength,{data:e,offset:0,length:e.byteLength}}}throw new Error("Error fetching data.")}get fileSize(){return this._fileSize}}function c(e,{blockSize:t,cacheSize:i}){return null===t?e:new n.k(e,{blockSize:t,cacheSize:i})}function f(e,{forceXHR:t=!1,...i}={}){return"function"!=typeof fetch||t?"undefined"!=typeof XMLHttpRequest?function(e,{headers:t={},maxRanges:i=0,allowFullFile:r=!1,...s}={}){const n=new a.g(e);return c(new h(n,t,i,r),s)}(e,i):function(e,{headers:t={},maxRanges:i=0,allowFullFile:r=!1,...s}={}){const n=new l.Q(e);return c(new h(n,t,i,r),s)}(e,i):function(e,{headers:t={},credentials:i,maxRanges:r=0,allowFullFile:s=!1,...n}={}){const a=new o.i(e,i);return c(new h(a,t,r,s),n)}(e,i)}},4119:(e,t,i)=>{"use strict";async function r(e){return new Promise((t=>setTimeout(t,e)))}function s(e,t){const i=Array.isArray(e)?e:Array.from(e),r=Array.isArray(t)?t:Array.from(t);return i.map(((e,t)=>[e,r[t]]))}i.d(t,{Ym:()=>a,lc:()=>n,uk:()=>r,yU:()=>s});class n extends Error{constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,n),this.name="AbortError"}}class o extends Error{constructor(e,t){super(t),this.errors=e,this.message=t,this.name="AggregateError"}}const a=o},2807:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});class r extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw new TypeError("`maxSize` must be a number greater than 0");if("number"==typeof e.maxAge&&0===e.maxAge)throw new TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||Number.POSITIVE_INFINITY,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if("function"==typeof this.onEviction)for(const[t,i]of e)this.onEviction(t,i.value)}_deleteIfExpired(e,t){return"number"==typeof t.expiry&&t.expiry<=Date.now()&&("function"==typeof this.onEviction&&this.onEviction(e,t.value),this.delete(e))}_getOrDeleteIfExpired(e,t){if(!1===this._deleteIfExpired(e,t))return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){const i=t.get(e);return this._getItemValue(e,i)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(const e of this.oldCache){const[t,i]=e;this.cache.has(t)||!1===this._deleteIfExpired(t,i)&&(yield e)}for(const e of this.cache){const[t,i]=e;!1===this._deleteIfExpired(t,i)&&(yield e)}}get(e){if(this.cache.has(e)){const t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){const t=this.oldCache.get(e);if(!1===this._deleteIfExpired(e,t))return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:i=this.maxAge}={}){const r="number"==typeof i&&i!==Number.POSITIVE_INFINITY?Date.now()+i:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:r}):this._set(e,{value:t,expiry:r}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):!!this.oldCache.has(e)&&!this._deleteIfExpired(e,this.oldCache.get(e))}peek(e){return this.cache.has(e)?this._peek(e,this.cache):this.oldCache.has(e)?this._peek(e,this.oldCache):void 0}delete(e){const t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw new TypeError("`maxSize` must be a number greater than 0");const t=[...this._entriesAscending()],i=t.length-e;i<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(i>0&&this._emitEvictions(t.slice(0,i)),this.oldCache=new Map(t.slice(i)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(const[e]of this)yield e}*values(){for(const[,e]of this)yield e}*[Symbol.iterator](){for(const e of this.cache){const[t,i]=e;!1===this._deleteIfExpired(t,i)&&(yield[t,i.value])}for(const e of this.oldCache){const[t,i]=e;this.cache.has(t)||!1===this._deleteIfExpired(t,i)&&(yield[t,i.value])}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){const i=e[t],[r,s]=i;!1===this._deleteIfExpired(r,s)&&(yield[r,s.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){const i=e[t],[r,s]=i;this.cache.has(r)||!1===this._deleteIfExpired(r,s)&&(yield[r,s.value])}}*entriesAscending(){for(const[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(const t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(const[i,r]of this.entriesAscending())e.call(t,r,i,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}}},205:(e,t,i)=>{"use strict";i.d(t,{A:()=>s});const r=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map((e=>[e.name,e])),s=new Map(r)}}]);
//# sourceMappingURL=961.bundle.js.map