(function(o,f){typeof exports=="object"&&typeof module<"u"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):(o=typeof globalThis<"u"?globalThis:o||self,f(o.AutoMediaType={}))})(this,function(o){"use strict";const f={apng:["image/apng"],avif:["image/avif"],avifs:["image/avif"],bmp:["image/bmp"],dib:["image/bmp"],djv:["image/vnd.djvu"],djvu:["image/vnd.djvu"],docx:["application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/zip"],dng:["image/tiff"],dtd:["application/xml-dtd"],gif:["image/gif"],gz:["application/gzip"],heic:["image/heic"],heics:["image/heic-sequence"],heif:["image/heif"],heifs:["image/heif-sequence"],hif:["image/heic","image/heif"],htm:["text/html"],html:["text/html"],ico:["image/vnd.microsoft.icon"],jar:["application/java-archive","application/zip"],j2c:["image/j2c"],j2k:["image/j2c"],jfi:["image/jpeg"],jfif:["image/jpeg"],jif:["image/jpeg"],jp2:["image/jp2"],jpe:["image/jpeg"],jpeg:["image/jpeg"],jpf:["image/jpx"],jpg:["image/jpeg"],jpg2:["image/jp2"],jpgm:["image/jpm"],jpm:["image/jpm"],jpx:["image/jpx"],m1a:["audio/mpeg"],m1v:["video/mpeg"],m2a:["audio/mpeg"],m2v:["video/mpeg"],mj2:["video/mj2"],mjp2:["video/mj2"],mp1:["audio/mpeg"],mp1a:["audio/mpeg"],mp2:["audio/mpeg"],mp2a:["audio/mpeg"],mp3:["audio/mpeg"],mp4:["video/mp4"],mp4v:["video/mp4"],mpeg:["video/mpeg"],mpg4:["video/mp4"],mpg:["video/mpeg"],mpga:["audio/mpeg"],odp:["application/zip"],ods:["application/zip"],odt:["application/zip"],otf:["font/otf"],pdf:["application/pdf"],png:["image/png","image/apng"],pptx:["application/vnd.openxmlformats-officedocument.presentationml.presentation","application/zip"],svg:["image/svg+xml"],tgz:["application/gzip"],tif:["image/tiff"],tiff:["image/tiff"],ttf:["font/ttf"],war:["application/zip"],wbmp:["image/vnd.wap.wbmp"],webp:["image/webp"],woff:["font/woff"],woff2:["font/woff2"],xlsx:["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/zip"],xml:["application/xml"],z00:["application/zip"],z01:["application/zip"],z02:["application/zip"],z03:["application/zip"],z04:["application/zip"],z05:["application/zip"],z06:["application/zip"],z07:["application/zip"],z08:["application/zip"],z09:["application/zip"],zip:["application/zip"],zipx:["application/zip"]},M=[["application/gzip",[0,2,31,139]],["application/java-archive",[0,4,80,75,3,4]],["application/pdf",[0,5,37,80,68,70,45]],["application/vnd.openxmlformats-officedocument.presentationml.presentation",[0,4,80,75,3,4]],["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",[0,4,80,75,3,4]],["application/vnd.openxmlformats-officedocument.wordprocessingml.document",[0,4,80,75,3,4]],["application/xml-dtd",[0,2,60,33]],["application/xml",[0,5,60,63,120,109,108]],["application/zip",[0,4,80,75,3,4]],["application/zip",[0,8,80,75,7,8,80,75,3,4]],["application/zip",[0,4,80,75,5,6]],["audio/mpeg",[0,3,73,68,51]],["font/otf",[0,4,79,84,84,79]],["font/otf",[0,4,0,1,0,0]],["font/ttf",[0,4,0,1,0,0]],["font/woff",[0,4,119,79,70,70]],["font/woff2",[0,4,119,79,70,50]],["image/apng",[0,8,137,80,78,71,13,10,26,10]],["image/avif",[4,7,102,116,121,112,97,118,105]],["image/bmp",[0,2,66,77]],["image/gif",[0,3,71,73,70]],["image/heic",[4,7,102,116,121,112,104,101,105]],["image/heic-sequence",[4,7,102,116,121,112,104,101,118]],["image/heif",[4,7,102,116,121,112,109,105,102]],["image/heif-sequence",[4,7,102,116,121,112,109,115,102]],["image/j2c",[0,4,255,79,255,81]],["image/jp2",[0,5,0,0,0,12,106,20,3,106,112,50]],["image/jpm",[0,5,0,0,0,12,106,20,3,106,112,109]],["image/jpx",[0,5,0,0,0,12,106,20,3,106,112,120]],["image/jpeg",[0,3,255,216,255]],["image/png",[0,8,137,80,78,71,13,10,26,10]],["image/svg+xml",[0,4,60,115,118,103]],["image/svg+xml",[0,5,60,63,120,109,108]],["image/tiff",[0,4,73,73,42,0]],["image/tiff",[0,4,77,77,0,42]],["image/vnd.djvu",[0,8,65,84,38,84,70,79,82,77]],["image/vnd.microsoft.icon",[0,4,0,0,1,0]],["image/vnd.wap.wbmp",[0,2,0,0]],["image/webp",[0,4,82,73,70,70,8,4,87,69,66,80]],["text/html",[0,8,60,33,68,79,67,84,89,80]],["text/html",[0,8,60,33,100,111,99,116,121,112]],["video/mj2",[0,5,0,0,0,12,106,20,2,109,106]],["video/mp4",[4,7,102,116,121,112,105,115,111]],["video/mp4",[4,8,102,116,121,112,109,112,52,50]],["video/mp4",[4,8,102,116,121,112,109,112,52,49]],["video/mp4",[4,8,102,116,121,112,97,118,99,49]],["video/mpeg",[0,4,0,0,1,186]],["video/mpeg",[0,4,0,0,1,179]]],T=23,A=[["audio/mpeg",[0,2,255,224]]],u=2,S=[0,2,255,224],y=Math.max(T,u),F=new Set(["application/gzip","application/java-archive","application/pdf","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/xml-dtd","application/xml","application/zip","audio/mpeg","font/otf","font/ttf","font/woff","font/woff2","image/apng","image/avif","image/bmp","image/gif","image/heic-sequence","image/heic","image/heif-sequence","image/heif","image/j2c","image/jp2","image/jpeg","image/jpm","image/jpx","image/png","image/svg+xml","image/tiff","image/vnd.djvu","image/vnd.microsoft.icon","image/vnd.wap.wbmp","image/webp","text/html","video/mj2","video/mp4","video/mpeg"]);function k(e){var n,a;const i=(a=(n=/\.([^\.]+)$/.exec(e))==null?void 0:n[1])==null?void 0:a.toLowerCase();return new Set(i?f[i]??[]:void 0)}async function q(e,i,n=0){const a=n+i;let p=new ArrayBuffer(a),t=0,m=e.getReader({mode:"byob"});try{for(;t{e.byFileExtension=k,e.byMagicBits=E,e.byMagicBytes=R})(c||(c={}));async function s(e){return new Set([...await c.byMagicBytes(e),...await c.byMagicBits(e)])}async function j(e){return s(new Uint8Array(e))}async function w(e){return s(e instanceof Uint8Array?e:new Uint8Array(e.buffer))}async function b(e){const i=e.tee();try{return s(await q(i[0],y))}finally{await Promise.all(i)}}async function r(e){return s(new Uint8Array(await e.slice(0,y).arrayBuffer()))}async function x(e){return new Set([...c.byFileExtension(e.name),...await r(e)])}async function z(e){if(!e.body)throw new TypeError("The request does not have a body");return r(await e.clone().blob())}async function B(e){if(!e.body)throw new TypeError("The response does not have a body");return r(await e.clone().blob())}async function l(e){if(e&&typeof e=="object"){if("byteLength"in e){if(ArrayBuffer.isView(e))return w(e);if(e instanceof ArrayBuffer||e instanceof SharedArrayBuffer)return j(e)}if(e instanceof Blob)return e instanceof File?x(e):r(e);if("body"in e){if(e instanceof Request)return z(e);if(e instanceof Response)return B(e)}if(e instanceof ReadableStream)return b(e)}throw new TypeError("The data type is not valid")}(e=>{e.forArrayBuffer=j,e.forArrayBufferView=w,e.forBlob=r,e.forFile=x,e.forRequest=z,e.forResponse=B,e.forByteStream=b})(l||(l={})),o.MediaType=void 0,(e=>{e.suggest=l,e.supported=F})(o.MediaType||(o.MediaType={})),Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});