@queuedash/api
Version:
A stunning, sleek dashboard for Bull, BullMQ, and Bee-Queue
4 lines • 50.3 kB
JavaScript
"use strict";var X=Object.defineProperty;var K=(i,e,t)=>e in i?X(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var I=(i,e,t)=>K(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("./main-Db6OUSVz.js"),M={128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};for(const[i,e]of Object.entries(M));function ee(i,e="utf-8"){switch(e.toLowerCase()){case"utf-8":case"utf8":return typeof globalThis.TextDecoder<"u"?new globalThis.TextDecoder("utf-8").decode(i):te(i);case"utf-16le":return ie(i);case"ascii":return ne(i);case"latin1":case"iso-8859-1":return re(i);case"windows-1252":return ae(i);default:throw new RangeError(`Encoding '${e}' not supported`)}}function te(i){let e="",t=0;for(;t<i.length;){const n=i[t++];if(n<128)e+=String.fromCharCode(n);else if(n<224){const r=i[t++]&63;e+=String.fromCharCode((n&31)<<6|r)}else if(n<240){const r=i[t++]&63,a=i[t++]&63;e+=String.fromCharCode((n&15)<<12|r<<6|a)}else{const r=i[t++]&63,a=i[t++]&63,f=i[t++]&63;let p=(n&7)<<18|r<<12|a<<6|f;p-=65536,e+=String.fromCharCode(55296+(p>>10&1023),56320+(p&1023))}}return e}function ie(i){let e="";for(let t=0;t<i.length;t+=2)e+=String.fromCharCode(i[t]|i[t+1]<<8);return e}function ne(i){return String.fromCharCode(...i.map(e=>e&127))}function re(i){return String.fromCharCode(...i)}function ae(i){let e="";for(const t of i)t>=128&&t<=159&&M[t]?e+=M[t]:e+=String.fromCharCode(t);return e}function w(i){return new DataView(i.buffer,i.byteOffset)}const se={len:1,get(i,e){return w(i).getUint8(e)},put(i,e,t){return w(i).setUint8(e,t),e+1}},l={len:2,get(i,e){return w(i).getUint16(e,!0)},put(i,e,t){return w(i).setUint16(e,t,!0),e+2}},B={len:2,get(i,e){return w(i).getUint16(e)},put(i,e,t){return w(i).setUint16(e,t),e+2}},h={len:4,get(i,e){return w(i).getUint32(e,!0)},put(i,e,t){return w(i).setUint32(e,t,!0),e+4}},oe={len:4,get(i,e){return w(i).getUint32(e)},put(i,e,t){return w(i).setUint32(e,t),e+4}},ce={len:4,get(i,e){return w(i).getInt32(e)},put(i,e,t){return w(i).setInt32(e,t),e+4}},fe={len:8,get(i,e){return w(i).getBigUint64(e,!0)},put(i,e,t){return w(i).setBigUint64(e,t,!0),e+8}};class v{constructor(e,t){this.len=e,this.encoding=t}get(e,t=0){const n=e.subarray(t,t+this.len);return ee(n,this.encoding)}}const me="End-Of-Stream";class g extends Error{constructor(){super(me),this.name="EndOfStreamError"}}class xe extends Error{constructor(e="The operation was aborted"){super(e),this.name="AbortError"}}class W{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(e,t=!1){const n=await this.read(e,t);return this.peekQueue.push(e.subarray(0,n)),n}async read(e,t=!1){if(e.length===0)return 0;let n=this.readFromPeekBuffer(e);if(this.endOfStream||(n+=await this.readRemainderFromStream(e.subarray(n),t)),n===0&&!t)throw new g;return n}readFromPeekBuffer(e){let t=e.length,n=0;for(;this.peekQueue.length>0&&t>0;){const r=this.peekQueue.pop();if(!r)throw new Error("peekData should be defined");const a=Math.min(r.length,t);e.set(r.subarray(0,a),n),n+=a,t-=a,a<r.length&&this.peekQueue.push(r.subarray(a))}return n}async readRemainderFromStream(e,t){let n=0;for(;n<e.length&&!this.endOfStream;){if(this.interrupted)throw new xe;const r=await this.readFromStream(e.subarray(n),t);if(r===0)break;n+=r}if(!t&&n<e.length)throw new g;return n}}class pe extends W{constructor(e){super(),this.reader=e}async abort(){return this.close()}async close(){this.reader.releaseLock()}}class le extends pe{async readFromStream(e,t){if(e.length===0)return 0;const n=await this.reader.read(new Uint8Array(e.length),{min:t?void 0:e.length});return n.done&&(this.endOfStream=n.done),n.value?(e.set(n.value),n.value.length):0}}class q extends W{constructor(e){super(),this.reader=e,this.buffer=null}writeChunk(e,t){const n=Math.min(t.length,e.length);return e.set(t.subarray(0,n)),n<t.length?this.buffer=t.subarray(n):this.buffer=null,n}async readFromStream(e,t){if(e.length===0)return 0;let n=0;for(this.buffer&&(n+=this.writeChunk(e,this.buffer));n<e.length&&!this.endOfStream;){const r=await this.reader.read();if(r.done){this.endOfStream=!0;break}r.value&&(n+=this.writeChunk(e.subarray(n),r.value))}if(!t&&n===0&&this.endOfStream)throw new g;return n}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}function ue(i){try{const e=i.getReader({mode:"byob"});return e instanceof ReadableStreamDefaultReader?new q(e):new le(e)}catch(e){if(e instanceof TypeError)return new q(i.getReader());throw e}}class R{constructor(e){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=e==null?void 0:e.onClose,e!=null&&e.abortSignal&&e.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(e,t=this.position){const n=new Uint8Array(e.len);if(await this.readBuffer(n,{position:t})<e.len)throw new g;return e.get(n,0)}async peekToken(e,t=this.position){const n=new Uint8Array(e.len);if(await this.peekBuffer(n,{position:t})<e.len)throw new g;return e.get(n,0)}async readNumber(e){if(await this.readBuffer(this.numBuffer,{length:e.len})<e.len)throw new g;return e.get(this.numBuffer,0)}async peekNumber(e){if(await this.peekBuffer(this.numBuffer,{length:e.len})<e.len)throw new g;return e.get(this.numBuffer,0)}async ignore(e){if(this.fileInfo.size!==void 0){const t=this.fileInfo.size-this.position;if(e>t)return this.position+=t,t}return this.position+=e,e}async close(){var e;await this.abort(),await((e=this.onClose)==null?void 0:e.call(this))}normalizeOptions(e,t){if(!this.supportsRandomAccess()&&t&&t.position!==void 0&&t.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:e.length,position:this.position,...t}}abort(){return Promise.resolve()}}const he=256e3;class de extends R{constructor(e,t){super(t),this.streamReader=e,this.fileInfo=(t==null?void 0:t.fileInfo)??{}}async readBuffer(e,t){const n=this.normalizeOptions(e,t),r=n.position-this.position;if(r>0)return await this.ignore(r),this.readBuffer(e,t);if(r<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(n.length===0)return 0;const a=await this.streamReader.read(e.subarray(0,n.length),n.mayBeLess);if(this.position+=a,(!t||!t.mayBeLess)&&a<n.length)throw new g;return a}async peekBuffer(e,t){const n=this.normalizeOptions(e,t);let r=0;if(n.position){const a=n.position-this.position;if(a>0){const f=new Uint8Array(n.length+a);return r=await this.peekBuffer(f,{mayBeLess:n.mayBeLess}),e.set(f.subarray(a)),r-a}if(a<0)throw new Error("Cannot peek from a negative offset in a stream")}if(n.length>0){try{r=await this.streamReader.peek(e.subarray(0,n.length),n.mayBeLess)}catch(a){if(t!=null&&t.mayBeLess&&a instanceof g)return 0;throw a}if(!n.mayBeLess&&r<n.length)throw new g}return r}async ignore(e){const t=Math.min(he,e),n=new Uint8Array(t);let r=0;for(;r<e;){const a=e-r,f=await this.readBuffer(n,{length:Math.min(t,a)});if(f<0)return f;r+=f}return r}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}class ge extends R{constructor(e,t){super(t),this.uint8Array=e,this.fileInfo={...(t==null?void 0:t.fileInfo)??{},size:e.length}}async readBuffer(e,t){t!=null&&t.position&&(this.position=t.position);const n=await this.peekBuffer(e,t);return this.position+=n,n}async peekBuffer(e,t){const n=this.normalizeOptions(e,t),r=Math.min(this.uint8Array.length-n.position,n.length);if(!n.mayBeLess&&r<n.length)throw new g;return e.set(this.uint8Array.subarray(n.position,n.position+r)),r}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}}class we extends R{constructor(e,t){super(t),this.blob=e,this.fileInfo={...(t==null?void 0:t.fileInfo)??{},size:e.size,mimeType:e.type}}async readBuffer(e,t){t!=null&&t.position&&(this.position=t.position);const n=await this.peekBuffer(e,t);return this.position+=n,n}async peekBuffer(e,t){const n=this.normalizeOptions(e,t),r=Math.min(this.blob.size-n.position,n.length);if(!n.mayBeLess&&r<n.length)throw new g;const a=await this.blob.slice(n.position,n.position+r).arrayBuffer();return e.set(new Uint8Array(a)),r}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(e){this.position=e}}function ke(i,e){const t=ue(i),n=e??{},r=n.onClose;return n.onClose=async()=>{if(await t.close(),r)return r()},new de(t,n)}function be(i,e){return new ge(i,e)}function Ce(i,e){return new we(i,e)}var U={exports:{}},O,H;function ve(){if(H)return O;H=1;var i=1e3,e=i*60,t=e*60,n=t*24,r=n*7,a=n*365.25;O=function(s,o){o=o||{};var m=typeof s;if(m==="string"&&s.length>0)return f(s);if(m==="number"&&isFinite(s))return o.long?c(s):p(s);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(s))};function f(s){if(s=String(s),!(s.length>100)){var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(s);if(o){var m=parseFloat(o[1]),u=(o[2]||"ms").toLowerCase();switch(u){case"years":case"year":case"yrs":case"yr":case"y":return m*a;case"weeks":case"week":case"w":return m*r;case"days":case"day":case"d":return m*n;case"hours":case"hour":case"hrs":case"hr":case"h":return m*t;case"minutes":case"minute":case"mins":case"min":case"m":return m*e;case"seconds":case"second":case"secs":case"sec":case"s":return m*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return m;default:return}}}}function p(s){var o=Math.abs(s);return o>=n?Math.round(s/n)+"d":o>=t?Math.round(s/t)+"h":o>=e?Math.round(s/e)+"m":o>=i?Math.round(s/i)+"s":s+"ms"}function c(s){var o=Math.abs(s);return o>=n?x(s,o,n,"day"):o>=t?x(s,o,t,"hour"):o>=e?x(s,o,e,"minute"):o>=i?x(s,o,i,"second"):s+" ms"}function x(s,o,m,u){var y=o>=m*1.5;return Math.round(s/m)+" "+u+(y?"s":"")}return O}function ye(i){t.debug=t,t.default=t,t.coerce=c,t.disable=f,t.enable=r,t.enabled=p,t.humanize=ve(),t.destroy=x,Object.keys(i).forEach(s=>{t[s]=i[s]}),t.names=[],t.skips=[],t.formatters={};function e(s){let o=0;for(let m=0;m<s.length;m++)o=(o<<5)-o+s.charCodeAt(m),o|=0;return t.colors[Math.abs(o)%t.colors.length]}t.selectColor=e;function t(s){let o,m=null,u,y;function d(...k){if(!d.enabled)return;const F=d,A=Number(new Date),Q=A-(o||A);F.diff=Q,F.prev=o,F.curr=A,o=A,k[0]=t.coerce(k[0]),typeof k[0]!="string"&&k.unshift("%O");let z=0;k[0]=k[0].replace(/%([a-zA-Z%])/g,(T,$)=>{if(T==="%%")return"%";z++;const N=t.formatters[$];if(typeof N=="function"){const J=k[z];T=N.call(F,J),k.splice(z,1),z--}return T}),t.formatArgs.call(F,k),(F.log||t.log).apply(F,k)}return d.namespace=s,d.useColors=t.useColors(),d.color=t.selectColor(s),d.extend=n,d.destroy=t.destroy,Object.defineProperty(d,"enabled",{enumerable:!0,configurable:!1,get:()=>m!==null?m:(u!==t.namespaces&&(u=t.namespaces,y=t.enabled(s)),y),set:k=>{m=k}}),typeof t.init=="function"&&t.init(d),d}function n(s,o){const m=t(this.namespace+(typeof o>"u"?":":o)+s);return m.log=this.log,m}function r(s){t.save(s),t.namespaces=s,t.names=[],t.skips=[];const o=(typeof s=="string"?s:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const m of o)m[0]==="-"?t.skips.push(m.slice(1)):t.names.push(m)}function a(s,o){let m=0,u=0,y=-1,d=0;for(;m<s.length;)if(u<o.length&&(o[u]===s[m]||o[u]==="*"))o[u]==="*"?(y=u,d=m,u++):(m++,u++);else if(y!==-1)u=y+1,d++,m=d;else return!1;for(;u<o.length&&o[u]==="*";)u++;return u===o.length}function f(){const s=[...t.names,...t.skips.map(o=>"-"+o)].join(",");return t.enable(""),s}function p(s){for(const o of t.skips)if(a(s,o))return!1;for(const o of t.names)if(a(s,o))return!0;return!1}function c(s){return s instanceof Error?s.stack||s.message:s}function x(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return t.enable(t.load()),t}var Fe=ye;(function(i,e){e.formatArgs=n,e.save=r,e.load=a,e.useColors=t,e.storage=f(),e.destroy=(()=>{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function t(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let c;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(c=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(c[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+i.exports.humanize(this.diff),!this.useColors)return;const x="color: "+this.color;c.splice(1,0,x,"color: inherit");let s=0,o=0;c[0].replace(/%[a-zA-Z%]/g,m=>{m!=="%%"&&(s++,m==="%c"&&(o=s))}),c.splice(o,0,x)}e.log=console.debug||console.log||(()=>{});function r(c){try{c?e.storage.setItem("debug",c):e.storage.removeItem("debug")}catch{}}function a(){let c;try{c=e.storage.getItem("debug")||e.storage.getItem("DEBUG")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function f(){try{return localStorage}catch{}}i.exports=Fe(e);const{formatters:p}=i.exports;p.j=function(c){try{return JSON.stringify(c)}catch(x){return"[UnexpectedJSONParseError]: "+x.message}}})(U,U.exports);var Se=U.exports;const Be=Y.getDefaultExportFromCjs(Se),S={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},V={get(i){return{signature:h.get(i,0),compressedSize:h.get(i,8),uncompressedSize:h.get(i,12)}},len:16},Ae={get(i){const e=l.get(i,6);return{signature:h.get(i,0),minVersion:l.get(i,4),dataDescriptor:!!(e&8),compressedMethod:l.get(i,8),compressedSize:h.get(i,18),uncompressedSize:h.get(i,22),filenameLength:l.get(i,26),extraFieldLength:l.get(i,28),filename:null}},len:30},ze={get(i){return{signature:h.get(i,0),nrOfThisDisk:l.get(i,4),nrOfThisDiskWithTheStart:l.get(i,6),nrOfEntriesOnThisDisk:l.get(i,8),nrOfEntriesOfSize:l.get(i,10),sizeOfCd:h.get(i,12),offsetOfStartOfCd:h.get(i,16),zipFileCommentLength:l.get(i,20)}},len:22},De={get(i){const e=l.get(i,8);return{signature:h.get(i,0),minVersion:l.get(i,6),dataDescriptor:!!(e&8),compressedMethod:l.get(i,10),compressedSize:h.get(i,20),uncompressedSize:h.get(i,24),filenameLength:l.get(i,28),extraFieldLength:l.get(i,30),fileCommentLength:l.get(i,32),relativeOffsetOfLocalHeader:h.get(i,42),filename:null}},len:46};function Z(i){const e=new Uint8Array(h.len);return h.put(e,0,i),e}const b=Be("tokenizer:inflate"),L=256*1024,Ee=Z(S.DataDescriptor),D=Z(S.EndOfCentralDirectory);class P{constructor(e){this.tokenizer=e,this.syncBuffer=new Uint8Array(L)}async isZip(){return await this.peekSignature()===S.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(h)}async findEndOfCentralDirectoryLocator(){const e=this.tokenizer,t=Math.min(16*1024,e.fileInfo.size),n=this.syncBuffer.subarray(0,t);await this.tokenizer.readBuffer(n,{position:e.fileInfo.size-t});for(let r=n.length-4;r>=0;r--)if(n[r]===D[0]&&n[r+1]===D[1]&&n[r+2]===D[2]&&n[r+3]===D[3])return e.fileInfo.size-t+r;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){b("Cannot reading central-directory without random-read support");return}b("Reading central-directory...");const e=this.tokenizer.position,t=await this.findEndOfCentralDirectoryLocator();if(t>0){b("Central-directory 32-bit signature found");const n=await this.tokenizer.readToken(ze,t),r=[];this.tokenizer.setPosition(n.offsetOfStartOfCd);for(let a=0;a<n.nrOfEntriesOfSize;++a){const f=await this.tokenizer.readToken(De);if(f.signature!==S.CentralFileHeader)throw new Error("Expected Central-File-Header signature");f.filename=await this.tokenizer.readToken(new v(f.filenameLength,"utf-8")),await this.tokenizer.ignore(f.extraFieldLength),await this.tokenizer.ignore(f.fileCommentLength),r.push(f),b(`Add central-directory file-entry: n=${a+1}/${r.length}: filename=${r[a].filename}`)}return this.tokenizer.setPosition(e),r}this.tokenizer.setPosition(e)}async unzip(e){const t=await this.readCentralDirectory();if(t)return this.iterateOverCentralDirectory(t,e);let n=!1;do{const r=await this.readLocalFileHeader();if(!r)break;const a=e(r);n=!!a.stop;let f;if(await this.tokenizer.ignore(r.extraFieldLength),r.dataDescriptor&&r.compressedSize===0){const p=[];let c=L;b("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let x=-1;for(;x<0&&c===L;){c=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),x=Te(this.syncBuffer.subarray(0,c),Ee);const s=x>=0?x:c;if(a.handler){const o=new Uint8Array(s);await this.tokenizer.readBuffer(o),p.push(o)}else await this.tokenizer.ignore(s)}b(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),a.handler&&await this.inflate(r,Ie(p),a.handler)}else a.handler?(b(`Reading compressed-file-data: ${r.compressedSize} bytes`),f=new Uint8Array(r.compressedSize),await this.tokenizer.readBuffer(f),await this.inflate(r,f,a.handler)):(b(`Ignoring compressed-file-data: ${r.compressedSize} bytes`),await this.tokenizer.ignore(r.compressedSize));if(b(`Reading data-descriptor at pos=${this.tokenizer.position}`),r.dataDescriptor&&(await this.tokenizer.readToken(V)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-V.len}`)}while(!n)}async iterateOverCentralDirectory(e,t){for(const n of e){const r=t(n);if(r.handler){this.tokenizer.setPosition(n.relativeOffsetOfLocalHeader);const a=await this.readLocalFileHeader();if(a){await this.tokenizer.ignore(a.extraFieldLength);const f=new Uint8Array(n.compressedSize);await this.tokenizer.readBuffer(f),await this.inflate(a,f,r.handler)}}if(r.stop)break}}async inflate(e,t,n){if(e.compressedMethod===0)return n(t);if(e.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${e.compressedMethod}`);b(`Decompress filename=${e.filename}, compressed-size=${t.length}`);const r=await P.decompressDeflateRaw(t);return n(r)}static async decompressDeflateRaw(e){const t=new ReadableStream({start(a){a.enqueue(e),a.close()}}),n=new DecompressionStream("deflate-raw"),r=t.pipeThrough(n);try{const f=await new Response(r).arrayBuffer();return new Uint8Array(f)}catch(a){const f=a instanceof Error?`Failed to deflate ZIP entry: ${a.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(f)}}async readLocalFileHeader(){const e=await this.tokenizer.peekToken(h);if(e===S.LocalFileHeader){const t=await this.tokenizer.readToken(Ae);return t.filename=await this.tokenizer.readToken(new v(t.filenameLength,"utf-8")),t}if(e===S.CentralFileHeader)return!1;throw e===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}function Te(i,e){const t=i.length,n=e.length;if(n>t)return-1;for(let r=0;r<=t-n;r++){let a=!0;for(let f=0;f<n;f++)if(i[r+f]!==e[f]){a=!1;break}if(a)return r}return-1}function Ie(i){const e=i.reduce((r,a)=>r+a.length,0),t=new Uint8Array(e);let n=0;for(const r of i)t.set(r,n),n+=r.length;return t}class Oe{constructor(e){this.tokenizer=e}inflate(){const e=this.tokenizer;return new ReadableStream({async pull(t){const n=new Uint8Array(1024),r=await e.readBuffer(n,{mayBeLess:!0});if(r===0){t.close();return}t.enqueue(n.subarray(0,r))}}).pipeThrough(new DecompressionStream("gzip"))}}new globalThis.TextDecoder("utf8");new globalThis.TextEncoder;Array.from({length:256},(i,e)=>e.toString(16).padStart(2,"0"));function _(i){const{byteLength:e}=i;if(e===6)return i.getUint16(0)*2**32+i.getUint32(2);if(e===5)return i.getUint8(0)*2**32+i.getUint32(1);if(e===4)return i.getUint32(0);if(e===3)return i.getUint8(0)*2**16+i.getUint16(1);if(e===2)return i.getUint16(0);if(e===1)return i.getUint8(0)}function Le(i,e){if(e==="utf-16le"){const t=[];for(let n=0;n<i.length;n++){const r=i.charCodeAt(n);t.push(r&255,r>>8&255)}return t}if(e==="utf-16be"){const t=[];for(let n=0;n<i.length;n++){const r=i.charCodeAt(n);t.push(r>>8&255,r&255)}return t}return[...i].map(t=>t.charCodeAt(0))}function je(i,e=0){const t=Number.parseInt(new v(6).get(i,148).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(t))return!1;let n=8*32;for(let r=e;r<e+148;r++)n+=i[r];for(let r=e+156;r<e+512;r++)n+=i[r];return t===n}const Me={get:(i,e)=>i[e+3]&127|i[e+2]<<7|i[e+1]<<14|i[e]<<21,len:4},Ue=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","rm","ppsm","ppsx","tar.gz","reg","dat"],Re=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx","application/vnd.visio","application/vnd.android.package-archive","application/vnd.google.draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-ms-regedit","application/x-ft-windows-registry-hive"],E=4100;async function Pe(i,e){return new G(e).fromBlob(i)}function j(i){switch(i=i.toLowerCase(),i){case"application/epub+zip":return{ext:"epub",mime:i};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:i};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:i};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:i};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:i};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:i};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:i};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:i};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:i};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:i};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:i};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:i};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:i};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:i};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:i};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:i};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"}}}function C(i,e,t){t={offset:0,...t};for(const[n,r]of e.entries())if(t.mask){if(r!==(t.mask[n]&i[n+t.offset]))return!1}else if(r!==i[n+t.offset])return!1;return!0}class G{constructor(e){I(this,"detectConfident",async e=>{if(this.buffer=new Uint8Array(E),e.fileInfo.size===void 0&&(e.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=e,await e.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await e.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.tokenizer.ignore(3),this.detectConfident(e);if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8])){const n=new Oe(e).inflate();let r=!0;try{let a;try{a=await this.fromStream(n)}catch{r=!1}if(a&&a.ext==="tar")return{ext:"tar.gz",mime:"application/gzip"}}finally{r&&await n.cancel()}return{ext:"gz",mime:"application/gzip"}}if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await e.ignore(6);const t=await e.readToken(Me);return e.position+t>e.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await e.ignore(t),this.fromTokenizer(e))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){let t;return await new P(e).unzip(n=>{switch(n.filename){case"META-INF/mozilla.rsa":return t={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return t={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return{async handler(r){const a=new TextDecoder("utf-8").decode(r).trim();t=j(a)},stop:!0};case"[Content_Types].xml":return{async handler(r){let a=new TextDecoder("utf-8").decode(r);const f=a.indexOf('.main+xml"');if(f===-1){const p="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";a.includes(`ContentType="${p}"`)&&(t=j(p))}else{a=a.slice(0,Math.max(0,f));const p=a.lastIndexOf('"'),c=a.slice(Math.max(0,p+1));t=j(c)}},stop:!0};default:return/classes\d*\.dex/.test(n.filename)?(t={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}}).catch(n=>{if(!(n instanceof g))throw n}),t??{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await e.ignore(28);const t=new Uint8Array(8);return await e.readBuffer(t),C(t,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:C(t,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:C(t,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:C(t,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:C(t,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:C(t,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){const t=await this.readTiffHeader(!1);if(t)return t}if(this.check([77,77])){const t=await this.readTiffHeader(!0);if(t)return t}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function t(){const p=await e.peekNumber(se);let c=128,x=0;for(;!(p&c)&&c!==0;)++x,c>>=1;const s=new Uint8Array(x+1);return await e.readBuffer(s),s}async function n(){const p=await t(),c=await t();c[0]^=128>>c.length-1;const x=Math.min(6,c.length),s=new DataView(p.buffer),o=new DataView(c.buffer,c.length-x,x);return{id:_(s),len:_(o)}}async function r(p){for(;p>0;){const c=await n();if(c.id===17026)return(await e.readToken(new v(c.len))).replaceAll(/\00.*$/g,"");await e.ignore(c.len),--p}}const a=await n();switch(await r(a.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:return}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190]))return{ext:"class",mime:"application/java-vm"};if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/vnd.google.draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){const t=new v(4,"latin1").get(this.buffer,2);if(t.match("^d*")&&t>=1e3&&t<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await e.ignore(8),await e.readToken(new v(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
`,"\r"," "," ","\0"].some(t=>this.checkString(t,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10])){await e.ignore(8);async function t(){return{length:await e.readToken(ce),type:await e.readToken(new v(4,"latin1"))}}do{const n=await t();if(n.length<0)return;switch(n.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await e.ignore(n.length+4)}}while(e.position+8<e.fileInfo.size);return{ext:"png",mime:"image/png"}}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&this.buffer[8]&96){const t=new v(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(t){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return t.startsWith("3g")?t.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString(`REGEDIT4\r
`))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){async function t(){const n=new Uint8Array(16);return await e.readBuffer(n),{id:n,size:Number(await e.readToken(fe))}}for(await e.ignore(30);e.position+24<e.fileInfo.size;){const n=await t();let r=n.size-24;if(C(n.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){const a=new Uint8Array(16);if(r-=await e.readBuffer(a),C(a,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(C(a,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}await e.ignore(r)}return{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await e.ignore(20),await e.readToken(new v(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.checkString("<?xml ",{offset:2,encoding:"utf-16be"})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await e.peekBuffer(this.buffer,{length:Math.min(256,e.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){const t=new DataView(this.buffer.buffer).getUint32(12,!0);if(t>12&&this.buffer.length>=t+16)try{const n=new TextDecoder().decode(this.buffer.subarray(16,t+16));if(JSON.parse(n).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(await e.peekBuffer(this.buffer,{length:Math.min(512,e.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&je(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){const t="utf-16le";return this.checkString("<?xml ",{offset:2,encoding:t})?{ext:"xml",mime:"application/xml"}:this.check([255,14],{offset:2})&&this.checkString("SketchUp Model",{offset:4,encoding:t})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:this.checkString(`Windows Registry Editor Version 5.00\r
`,{offset:2,encoding:t})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}});I(this,"detectImprecise",async e=>{if(this.buffer=new Uint8Array(E),await e.peekBuffer(this.buffer,{length:Math.min(8,e.fileInfo.size),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await e.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,e.fileInfo.size),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let t=0;t<=this.options.mpegOffsetTolerance;++t){const n=this.scanMpeg(t);if(n)return n}});this.options={mpegOffsetTolerance:0,...e},this.detectors=[...(e==null?void 0:e.customDetectors)??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:e==null?void 0:e.signal}}async fromTokenizer(e){const t=e.position;for(const n of this.detectors){const r=await n.detect(e);if(r)return r;if(t!==e.position)return}}async fromBuffer(e){if(!(e instanceof Uint8Array||e instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``);const t=e instanceof Uint8Array?e:new Uint8Array(e);if((t==null?void 0:t.length)>1)return this.fromTokenizer(be(t,this.tokenizerOptions))}async fromBlob(e){const t=Ce(e,this.tokenizerOptions);try{return await this.fromTokenizer(t)}finally{await t.close()}}async fromStream(e){const t=ke(e,this.tokenizerOptions);try{return await this.fromTokenizer(t)}finally{await t.close()}}async toDetectionStream(e,t){const{sampleSize:n=E}=t;let r,a;const f=e.getReader({mode:"byob"});try{const{value:x,done:s}=await f.read(new Uint8Array(n));if(a=x,!s&&x)try{r=await this.fromBuffer(x.subarray(0,n))}catch(o){if(!(o instanceof g))throw o;r=void 0}a=x}finally{f.releaseLock()}const p=new TransformStream({async start(x){x.enqueue(a)},transform(x,s){s.enqueue(x)}}),c=e.pipeThrough(p);return c.fileType=r,c}check(e,t){return C(this.buffer,e,t)}checkString(e,t){return this.check(Le(e,t==null?void 0:t.encoding),t)}async readTiffTag(e){const t=await this.tokenizer.readToken(e?B:l);switch(this.tokenizer.ignore(10),t){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"}}}async readTiffIFD(e){const t=await this.tokenizer.readToken(e?B:l);for(let n=0;n<t;++n){const r=await this.readTiffTag(e);if(r)return r}}async readTiffHeader(e){const t=(e?B:l).get(this.buffer,2),n=(e?oe:h).get(this.buffer,4);if(t===42){if(n>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(n>=8){const a=(e?B:l).get(this.buffer,8),f=(e?B:l).get(this.buffer,10);if(a===28&&f===254||a===31&&f===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}return await this.tokenizer.ignore(n),await this.readTiffIFD(e)??{ext:"tif",mime:"image/tiff"}}if(t===43)return{ext:"tif",mime:"image/tiff"}}scanMpeg(e){if(this.check([255,224],{offset:e,mask:[255,224]})){if(this.check([16],{offset:e+1,mask:[22]}))return this.check([8],{offset:e+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:e+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:e+1,mas