(function(A,w){typeof exports=="object"&&typeof module<"u"?module.exports=w():typeof define=="function"&&define.amd?define(w):(A=typeof globalThis<"u"?globalThis:A||self,A.imageMime=w())})(this,function(){"use strict";var A=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var z={},P={},F={};Object.defineProperty(F,"__esModule",{value:!0}),F.fromHex=F.toHex=void 0;const I=e=>new Number(e).toString(16).toLowerCase(),D=e=>`0x${I(e).length===1?"0"+I(e):I(e)}`;F.toHex=D;const ee=e=>new Number(e);F.fromHex=ee;var j={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createComplexNode=e.createNode=e.merge=void 0;const t=r=>({typename:r.typename,mime:r.info.mime,extension:r.info.extension}),n=(r,l)=>r&&l.length===0,x=r=>r[0],i=r=>r.slice(1,r.length),o=(r,l)=>{if(r.bytes.length===0)return l;const f=x(r.bytes),d=i(r.bytes),p=l.bytes[f];if(n(p,d)){const c=l.bytes[f];return l.bytes[f]={...c,matches:[...c.matches?c.matches:[],t(r)]},l}return l.bytes[f]?(l.bytes[f]=e.merge(e.createNode(r.typename,d,r.info),l.bytes[f]),l):(l.bytes[f]||(l.bytes[f]={...l.bytes[f],...e.createComplexNode(r.typename,d,r.info)}),l)};e.merge=o;const u=(r,l,f)=>({typename:r,bytes:l,info:f||{}});e.createNode=u;const a=(r,l,f)=>{let d={bytes:{},matches:void 0};const p=x(l),c=i(l);return l.length===0?{matches:[t({typename:r,info:f?{extension:f.extension,mime:f.mime}:{}})],bytes:{}}:(d.bytes[p]=e.createComplexNode(r,c,f),d)};e.createComplexNode=a})(j),Object.defineProperty(P,"__esModule",{value:!0});const k=F,T=j;let E={noOffset:null,offset:{}};const s=(e,t,n,x)=>{if(x){const i=E.offset[k.toHex(x)];if(!i)E.offset[k.toHex(x)]=T.createComplexNode(e,t.map(o=>o.toLowerCase()),n);else{const o=T.merge(T.createNode(e,t.map(u=>u.toLowerCase()),n),{...i});E.offset[k.toHex(x)]=o}}else E.noOffset===null?E.noOffset=T.createComplexNode(e,t.map(i=>i.toLowerCase()),n):E.noOffset=T.merge(T.createNode(e,t.map(i=>i.toLowerCase()),n),E.noOffset)};s("gif",["0x47","0x49","0x46","0x38","0x37","0x61"],{mime:"image/gif",extension:"gif"}),s("gif",["0x47","0x49","0x46","0x38","0x39","0x61"],{mime:"image/gif",extension:"gif"}),s("jpg",["0xFF","0xD8","0xFF","0xDB"],{mime:"image/jpeg",extension:"jpeg"}),s("jpg",["0xFF","0xD8","0xFF","0xE0","?","?","0x4A","0x46","0x49","0x46","0x00","0x01"],{mime:"image/jpeg",extension:"jpeg"}),s("jpg",["0xFF","0xD8","0xFF","0xE1","?","?","0x45","0x78","0x69","0x66","0x00","0x00"],{mime:"image/jpeg",extension:"jpeg"}),s("webp",["0x52","0x49","0x46","0x46","?","?","?","?","0x57","0x45","0x42","0x50"],{mime:"image/webp",extension:"webp"}),s("heif",["0x66","0x74","0x79","0x70","0x6D","0x69","0x66","0x31"],{mime:"image/heif",extension:"heif"},4),s("heif",["0x66","0x74","0x79","0x70","0x68","0x65","0x69","0x63"],{mime:"image/heif",extension:"heic"},4),s("rpm",["0xed","0xab","0xee","0xdb"]),s("bin",["0x53","0x50","0x30","0x31"],{mime:"application/octet-stream",extension:"bin"}),s("pic",["0x00"]),s("pif",["0x00"]),s("sea",["0x00"]),s("ytr",["0x00"]),s("mp4",["0x66","0x74","0x79","0x70"],{mime:"video/mp4",extension:"mp4"},4),s("woff",["0x77","0x4F","0x46","0x46"],{mime:"font/woff",extension:"woff"}),s("woff2",["0x77","0x4F","0x46","0x32"],{mime:"font/woff2",extension:"woff2"}),s("pdb",["0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00"]),s("dba",["0xBE","0xBA","0xFE","0xCA"]),s("dba2",["0x00","0x01","0x42","0x44"]),s("tda",["0x00","0x01","0x44","0x54"]),s("tda2",["0x00","0x01","0x00","0x00"]),s("ico",["0x00","0x00","0x01","0x00"],{mime:"image/x-icon",extension:"ico"}),s("3gp",["0x66","0x74","0x79","0x70","0x33","0x67"]),s("z",["0x1F","0x9D"]),s("tar.z",["0x1F","0xA0"]),s("bac",["0x42","0x41","0x43","0x4B","0x4D","0x49","0x4B","0x45","0x44","0x49","0x53","0x4B"]),s("bz2",["0x42","0x5A","0x68"],{mime:"application/x-bzip2",extension:"bz2"}),s("tif",["0x49","0x49","0x2A","0x00"],{mime:"image/tiff",extension:"tif"}),s("tiff",["0x4D","0x4D","0x00","0x2A"],{mime:"image/tiff",extension:"tiff"}),s("cr2",["0x49","0x49","0x2A","0x00","0x10","0x00","0x00","0x00","0x43","0x52"]),s("cin",["0x80","0x2A","0x5F","0xD7"]),s("cin1",["0x52","0x4E","0x43","0x01"]),s("cin2",["0x52","0x4E","0x43","0x02"]),s("dpx",["0x53","0x44","0x50","0x58"]),s("dpx2",["0x58","0x50","0x44","0x53"]),s("exr",["0x76","0x2F","0x31","0x01"]),s("bpg",["0x42","0x50","0x47","0xFB"]),s("ilbm",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x49","0x4C","0x42","0x4D"]),s("8svx",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x38","0x53","0x56","0x58"]),s("acbm",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x41","0x43","0x42","0x4D"]),s("anbm",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x41","0x4E","0x42","0x4D"]),s("anim",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x41","0x4E","0x49","0x4D"]),s("faxx",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x46","0x41","0x58","0x58"]),s("ftxt",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x46","0x54","0x58","0x54"]),s("smus",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x53","0x4D","0x55","0x53"]),s("cmus",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x43","0x4D","0x55","0x53"]),s("yuvn",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x59","0x55","0x56","0x4E"]),s("iff",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x46","0x41","0x4E","0x54"]),s("aiff",["0x46","0x4F","0x52","0x4D","?","?","?","?","0x41","0x49","0x46","0x46"],{mime:"audio/x-aiff",extension:"aiff"}),s("idx",["0x49","0x4E","0x44","0x58"]),s("lz",["0x4C","0x5A","0x49","0x50"]),s("exe",["0x4D","0x5A"]),s("zip",["0x50","0x4B","0x03","0x04"],{mime:"application/zip",extension:"zip"}),s("zip",["0x50","0x4B","0x05","0x06"],{mime:"application/zip",extension:"zip"}),s("zip",["0x50","0x4B","0x07","0x08"],{mime:"application/zip",extension:"zip"}),s("jar",["0x50","0x4B","0x03","0x04"],{mime:"application/java-archive",extension:"jar"}),s("jar",["0x50","0x4B","0x05","0x06"],{mime:"application/java-archive",extension:"jar"}),s("jar",["0x50","0x4B","0x07","0x08"],{mime:"application/java-archive",extension:"jar"}),s("odt",["0x50","0x4B","0x03","0x04"],{mime:"application/vnd.oasis.opendocument.text",extension:"odt"}),s("odt",["0x50","0x4B","0x05","0x06"],{mime:"application/vnd.oasis.opendocument.text",extension:"odt"}),s("odt",["0x50","0x4B","0x07","0x08"],{mime:"application/vnd.oasis.opendocument.text",extension:"odt"}),s("ods",["0x50","0x4B","0x03","0x04"],{mime:"application/vnd.oasis.opendocument.spreadsheet",extension:"ods"}),s("ods",["0x50","0x4B","0x05","0x06"],{mime:"application/vnd.oasis.opendocument.spreadsheet",extension:"ods"}),s("ods",["0x50","0x4B","0x07","0x08"],{mime:"application/vnd.oasis.opendocument.spreadsheet",extension:"ods"}),s("odp",["0x50","0x4B","0x03","0x04"],{mime:"application/vnd.oasis.opendocument.presentation",extension:"odp"}),s("odp",["0x50","0x4B","0x05","0x06"],{mime:"application/vnd.oasis.opendocument.presentation",extension:"odp"}),s("odp",["0x50","0x4B","0x07","0x08"],{mime:"application/vnd.oasis.opendocument.presentation",extension:"odp"}),s("docx",["0x50","0x4B","0x03","0x04"],{mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",extension:"docx"}),s("docx",["0x50","0x4B","0x05","0x06"],{mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",extension:"docx"}),s("docx",["0x50","0x4B","0x07","0x08"],{mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",extension:"docx"}),s("xlsx",["0x50","0x4B","0x03","0x04"],{mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",extension:"xlsx"}),s("xlsx",["0x50","0x4B","0x05","0x06"],{mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",extension:"xlsx"}),s("xlsx",["0x50","0x4B","0x07","0x08"],{mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",extension:"xlsx"}),s("pptx",["0x50","0x4B","0x03","0x04"],{mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation",extension:"pptx"}),s("pptx",["0x50","0x4B","0x05","0x06"],{mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation",extension:"pptx"}),s("pptx",["0x50","0x4B","0x07","0x08"],{mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation",extension:"pptx"}),s("vsdx",["0x50","0x4B","0x03","0x04"],{mime:"application/vnd.ms-visio.drawing",extension:"vsdx"}),s("vsdx",["0x50","0x4B","0x05","0x06"],{mime:"application/vnd.ms-visio.drawing",extension:"vsdx"}),s("vsdx",["0x50","0x4B","0x07","0x08"],{mime:"application/vnd.ms-visio.drawing",extension:"vsdx"}),s("apk",["0x50","0x4B","0x03","0x04"],{mime:"application/vnd.android.package-archive",extension:"apk"}),s("apk",["0x50","0x4B","0x05","0x06"],{mime:"application/vnd.android.package-archive",extension:"apk"}),s("apk",["0x50","0x4B","0x07","0x08"],{mime:"application/vnd.android.package-archive",extension:"apk"}),s("aar",["0x50","0x4B","0x03","0x04"],{mime:"application/vnd.android.package-archive",extension:"aar"}),s("aar",["0x50","0x4B","0x05","0x06"],{mime:"application/vnd.android.package-archive",extension:"aar"}),s("aar",["0x50","0x4B","0x07","0x08"],{mime:"application/vnd.android.package-archive",extension:"aar"}),s("rar",["0x52","0x61","0x72","0x21","0x1A","0x07","0x00"],{mime:"application/vnd.rar",extension:"rar"}),s("rar",["0x52","0x61","0x72","0x21","0x1A","0x07","0x01","0x00"],{mime:"application/vnd.rar",extension:"rar"}),s("rar",["0x7F","0x45","0x4C","0x46"],{mime:"application/vnd.rar",extension:"rar"}),s("png",["0x89","0x50","0x4E","0x47","0x0D","0x0A","0x1A","0x0A"],{mime:"image/png",extension:"png"}),s("apng",["0x89","0x50","0x4E","0x47","0x0D","0x0A","0x1A","0x0A"],{mime:"image/apng",extension:"apng"}),s("class",["0xCA","0xFE","0xBA","0xBE"]),s("class",["0xEF","0xBB","0xBF"]),s("class",["0xFE","0xed","0xFA","0xCE"],void 0,4096),s("class",["0xFE","0xed","0xFA","0xCF"],void 0,4096),s("class",["0xCE","0xFA","0xed","0xFE"]),s("class",["0xCF","0xFA","0xed","0xFE"]),s("class",["0xFF","0xFE"]),s("class",["0xFF","0xFE"]),s("class",["0xFF","0xFE","0x00","0x00"]),s("ps",["0x25","0x21","0x50","0x53"]),s("pdf",["0x25","0x50","0x44","0x46"],{mime:"application/pdf",extension:"pdf"}),s("asf",["0x30","0x26","0xB2","0x75","0x8E","0x66","0xCF","0x11","0xA6","0xD9","0x00","0xAA","0x00","0x62","0xCE","0x6C"]),s("wma",["0x30","0x26","0xB2","0x75","0x8E","0x66","0xCF","0x11","0xA6","0xD9","0x00","0xAA","0x00","0x62","0xCE","0x6C"]),s("wmv",["0x30","0x26","0xB2","0x75","0x8E","0x66","0xCF","0x11","0xA6","0xD9","0x00","0xAA","0x00","0x62","0xCE","0x6C"]),s("deploymentimage",["0x24","0x53","0x44","0x49","0x30","0x30","0x30","0x31"]),s("ogv",["0x4F","0x67","0x67","0x53","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","0x80","0x74","0x68","0x65","0x6F","0x72","0x61"],{mime:"video/ogg",extension:"ogv"}),s("ogm",["0x4F","0x67","0x67","0x53","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","0x01","0x76","0x69","0x64","0x65","0x6F","0x00"],{mime:"video/ogg",extension:"ogm"}),s("oga",["0x4F","0x67","0x67","0x53","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","0x7F","0x46","0x4C","0x41","0x43"],{mime:"audio/ogg",extension:"oga"}),s("spx",["0x4F","0x67","0x67","0x53","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","0x53","0x70","0x65","0x65","0x78","0x20","0x20"],{mime:"audio/ogg",extension:"spx"}),s("ogg",["0x4F","0x67","0x67","0x53","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","?","0x01","0x76","0x6F","0x72","0x62","0x69","0x73"],{mime:"audio/ogg",extension:"ogg"}),s("ogx",["0x4F","0x67","0x67","0x53"],{mime:"application/ogg",extension:"ogx"}),s("psd",["0x38","0x42","0x50","0x53"],{mime:"application/x-photoshop",extension:"psd"}),s("clip",["0x43","0x53","0x46","0x43","0x48","0x55","0x4e","0x4b"]),s("wav",["0x52","0x49","0x46","0x46","?","?","?","?","0x57","0x41","0x56","0x45"],{mime:"audio/x-wav",extension:"wav"}),s("avi",["0x52","0x49","0x46","0x46","?","?","?","?","0x41","0x56","0x49","0x20"],{mime:"video/x-msvideo",extension:"avi"}),s("mp3",["0xFF","0xFB"],{mime:"audio/mpeg",extension:"mp3"}),s("mp3",["0xFF","0xF3"],{mime:"audio/mpeg",extension:"mp3"}),s("mp3",["0xFF","0xF2"],{mime:"audio/mpeg",extension:"mp3"}),s("mp3",["0x49","0x44","0x33"],{mime:"audio/mpeg",extension:"mp3"}),s("bmp",["0x42","0x4D"],{mime:"image/bmp",extension:"bmp"}),s("iso",["0x43","0x44","0x30","0x30","0x31"]),s("flac",["0x66","0x4C","0x61","0x43"]),s("mid",["0x4D","0x54","0x68","0x64"],{mime:"audio/midi",extension:"mid"}),s("midi",["0x4D","0x54","0x68","0x64"],{mime:"audio/midi",extension:"midi"}),s("doc",["0xD0","0xCF","0x11","0xE0","0xA1","0xB1","0x1A","0xE1"],{mime:"application/msword",extension:"doc"}),s("xls",["0xD0","0xCF","0x11","0xE0","0xA1","0xB1","0x1A","0xE1"],{mime:"application/vnd.ms-excel",extension:"xls"}),s("ppt",["0xD0","0xCF","0x11","0xE0","0xA1","0xB1","0x1A","0xE1"],{mime:"application/vnd.ms-powerpoint",extension:"ppt"}),s("msg",["0xD0","0xCF","0x11","0xE0","0xA1","0xB1","0x1A","0xE1"]),s("dex",["0x64","0x65","0x78","0x0A","0x30","0x33","0x35","0x00"]),s("vmdk",["0x4B","0x44","0x4D"]),s("crx",["0x43","0x72","0x32","0x34"]),s("fh8",["0x41","0x47","0x44","0x33"]),s("cwk",["0x05","0x07","0x00","0x00","0x42","0x4F","0x42","0x4F","0x05","0x07","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x01"]),s("cwk",["0x06","0x07","0xE1","0x00","0x42","0x4F","0x42","0x4F","0x06","0x07","0xE1","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x01"]),s("toast",["0x45","0x52","0x02","0x00","0x00","0x00"]),s("toast",["0x8B","0x45","0x52","0x02","0x00","0x00","0x00"]),s("dmg",["0x78","0x01","0x73","0x0D","0x62","0x62","0x60"]),s("xar",["0x78","0x61","0x72","0x21"]),s("dat",["0x50","0x4D","0x4F","0x43","0x43","0x4D","0x4F","0x43"]),s("nes",["0x4E","0x45","0x53","0x1A"]),s("tar",["0x75","0x73","0x74","0x61","0x72","0x00","0x30","0x30"],void 0,257),s("tar",["0x75","0x73","0x74","0x61","0x72","0x20","0x20","0x00"],void 0,257),s("tox",["0x74","0x6F","0x78","0x33"]),s("mlv",["0x4D","0x4C","0x56","0x49"]),s("windowsupdate",["0x44","0x43","0x4D","0x01","0x50","0x41","0x33","0x30"]),s("7z",["0x37","0x7A","0xBC","0xAF","0x27","0x1C"],{mime:"application/x-7z-compressed",extension:"7z"}),s("gz",["0x1F","0x8B"],{mime:"application/gzip",extension:"gz"}),s("tar.gz",["0x1F","0x8B"],{mime:"application/gzip",extension:"tar.gz"}),s("xz",["0xFD","0x37","0x7A","0x58","0x5A","0x00","0x00"],{mime:"application/gzip",extension:"xz"}),s("tar.xz",["0xFD","0x37","0x7A","0x58","0x5A","0x00","0x00"],{mime:"application/gzip",extension:"tar.xz"}),s("lz2",["0x04","0x22","0x4D","0x18"]),s("cab",["0x4D","0x53","0x43","0x46"]),s("mkv",["0x1A","0x45","0xDF","0xA3"],{mime:"video/x-matroska",extension:"mkv"}),s("mka",["0x1A","0x45","0xDF","0xA3"],{mime:"audio/x-matroska",extension:"mka"}),s("mks",["0x1A","0x45","0xDF","0xA3"],{mime:"video/x-matroska",extension:"mks"}),s("mk3d",["0x1A","0x45","0xDF","0xA3"]),s("webm",["0x1A","0x45","0xDF","0xA3"],{mime:"audio/webm",extension:"webm"}),s("dcm",["0x44","0x49","0x43","0x4D"],void 0,128),s("xml",["0x3C","0x3f","0x78","0x6d","0x6C","0x20"],{mime:"application/xml",extension:"xml"}),s("wasm",["0x00","0x61","0x73","0x6d"],{mime:"application/wasm",extension:"wasm"}),s("lep",["0xCF","0x84","0x01"]),s("swf",["0x43","0x57","0x53"],{mime:"application/x-shockwave-flash",extension:"swf"}),s("swf",["0x46","0x57","0x53"],{mime:"application/x-shockwave-flash",extension:"swf"}),s("deb",["0x21","0x3C","0x61","0x72","0x63","0x68","0x3E"]),s("rtf",["0x7B","0x5C","0x72","0x74","0x66","0x31"],{mime:"application/rtf",extension:"rtf"}),s("m2p",["0x00","0x00","0x01","0xBA"]),s("vob",["0x00","0x00","0x01","0xBA"]),s("mpg",["0x00","0x00","0x01","0xBA"],{mime:"video/mpeg",extension:"mpg"}),s("mpeg",["0x00","0x00","0x01","0xBA"],{mime:"video/mpeg",extension:"mpeg"}),s("mpeg",["0x47"],{mime:"video/mpeg",extension:"mpeg"}),s("mpeg",["0x00","0x00","0x01","0xB3"],{mime:"video/mpeg",extension:"mpeg"}),s("mov",["0x66","0x72","0x65","0x65"],{mime:"video/quicktime",extension:"mov"},4),s("mov",["0x6D","0x64","0x61","0x74"],{mime:"video/quicktime",extension:"mov"},4),s("mov",["0x6D","0x6F","0x6F","0x76"],{mime:"video/quicktime",extension:"mov"},4),s("mov",["0x77","0x69","0x64","0x65"],{mime:"video/quicktime",extension:"mov"},4),s("mov",["0x66","0x74","0x79","0x70","0x71","0x74"],{mime:"video/quicktime",extension:"mov"},4),s("hl2demo",["0x48","0x4C","0x32","0x44","0x45","0x4D","0x4F"]),s("txt",["0xEF","0xBB","0xBF"],{mime:"text/plain; charset=UTF-8",extension:"txt"}),s("txt",["0xFF","0xFE"],{mime:"text/plain; charset=UTF-16LE",extension:"txt"}),s("txt",["0xFE","0xFF"],{mime:"text/plain; charset=UTF-16BE",extension:"txt"}),s("txt",["0xFF","0xFE","0x00","0x00"],{mime:"text/plain; charset=UTF-32LE",extension:"txt"}),s("txt",["0x00","0x00","0xFE","0xFF"],{mime:"text/plain; charset=UTF-32BE",extension:"txt"}),s("SubRip",["0x31","0x0D","0x0A","0x30","0x30","0x3A"],{mime:"application/x-subrip",extension:"srt"}),s("WebVTT",["0xEF","0xBB","0xBF","0x57","0x45","0x42","0x56","0x54","0x54","0x0A"],{mime:"text/vtt",extension:"vtt"}),s("WebVTT",["0xEF","0xBB","0xBF","0x57","0x45","0x42","0x56","0x54","0x54","0x0D"],{mime:"text/vtt",extension:"vtt"}),s("WebVTT",["0xEF","0xBB","0xBF","0x57","0x45","0x42","0x56","0x54","0x54","0x20"],{mime:"text/vtt",extension:"vtt"}),s("WebVTT",["0xEF","0xBB","0xBF","0x57","0x45","0x42","0x56","0x54","0x54","0x09"],{mime:"text/vtt",extension:"vtt"}),s("WebVTT",["0x57","0x45","0x42","0x56","0x54","0x54","0x0A"],{mime:"text/vtt",extension:"vtt"}),s("WebVTT",["0x57","0x45","0x42","0x56","0x54","0x54","0x0D"],{mime:"text/vtt",extension:"vtt"}),s("WebVTT",["0x57","0x45","0x42","0x56","0x54","0x54","0x20"],{mime:"text/vtt",extension:"vtt"}),s("WebVTT",["0x57","0x45","0x42","0x56","0x54","0x54","0x09"],{mime:"text/vtt",extension:"vtt"}),s("Json",["0x7B"],{mime:"application/json",extension:".json"}),s("Json",["0x5B"],{mime:"application/json",extension:".json"}),P.default=()=>E,function(e){var t=A&&A.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(e,"__esModule",{value:!0}),e.filetypeextension=e.filetypemime=e.filetypename=e.filetypeinfo=void 0;const n=t(P),x=F,i=n.default(),o=f=>{let d=i;for(const p of Object.keys(d.offset)){const c=x.fromHex(p);if(c>=f.length)continue;const b=i.offset[p],N=u(c,f,b);if(N.length>0)return N}return d.noOffset===null?[]:u(0,f,d.noOffset)};e.filetypeinfo=o;const u=(f,d,p)=>{let c=p,m=[];for(;;){const b=x.toHex(d[f]);if(c.bytes["?"]&&!c.bytes[b]?c=c.bytes["?"]:c=c.bytes[b],!c)return m;c&&c.matches&&(m=c.matches.slice(0)),f+=1}};e.default=e.filetypeinfo;const a=f=>e.filetypeinfo(f).map(d=>d.typename);e.filetypename=a;const r=f=>e.filetypeinfo(f).map(d=>d.mime?d.mime:null).filter(d=>d!==null);e.filetypemime=r;const l=f=>e.filetypeinfo(f).map(d=>d.extension?d.extension:null).filter(d=>d!==null);e.filetypeextension=l}(z);const te=w(z);var $={},O={};(function(e){const t=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",n=t+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",x="["+t+"]["+n+"]*",i=new RegExp("^"+x+"$"),o=function(a,r){const l=[];let f=r.exec(a);for(;f;){const d=[];d.startIndex=r.lastIndex-f[0].length;const p=f.length;for(let c=0;c"u")};e.isExist=function(a){return typeof a<"u"},e.isEmptyObject=function(a){return Object.keys(a).length===0},e.merge=function(a,r,l){if(r){const f=Object.keys(r),d=f.length;for(let p=0;p"&&e[o]!==" "&&e[o]!==" "&&e[o]!==` `&&e[o]!=="\r";o++)r+=e[o];if(r=r.trim(),r[r.length-1]==="/"&&(r=r.substring(0,r.length-1),o--),!le(r)){let d;return r.trim().length===0?d="Invalid space after '<'.":d="Tag '"+r+"' is an invalid name.",g("InvalidTag",d,h(e,o))}const l=oe(e,o);if(l===!1)return g("InvalidAttr","Attributes for '"+r+"' have open quote.",h(e,o));let f=l.value;if(o=l.index,f[f.length-1]==="/"){const d=o-f.length;f=f.substring(0,f.length-1);const p=U(f,t);if(p===!0)x=!0;else return g(p.err.code,p.err.msg,h(e,d+p.err.line))}else if(a)if(l.tagClosed){if(f.trim().length>0)return g("InvalidTag","Closing tag '"+r+"' can't have attributes or invalid starting.",h(e,u));{const d=n.pop();if(r!==d.tagName){let p=h(e,d.tagStartPos);return g("InvalidTag","Expected closing tag '"+d.tagName+"' (opened in line "+p.line+", col "+p.col+") instead of closing tag '"+r+"'.",h(e,u))}n.length==0&&(i=!0)}}else return g("InvalidTag","Closing tag '"+r+"' doesn't have proper closing.",h(e,o));else{const d=U(f,t);if(d!==!0)return g(d.err.code,d.err.msg,h(e,o-f.length+d.err.line));if(i===!0)return g("InvalidXml","Multiple possible root nodes found.",h(e,o));t.unpairedTags.indexOf(r)!==-1||n.push({tagName:r,tagStartPos:u}),x=!0}for(o++;o0)return g("InvalidXml","Invalid '"+JSON.stringify(n.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return g("InvalidXml","Start tag expected.",1);return!0};function X(e){return e===" "||e===" "||e===` `||e==="\r"}function R(e,t){const n=t;for(;t5&&x==="xml")return g("InvalidXml","XML declaration allowed only at the start of the document.",h(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function H(e,t){if(e.length>t+5&&e[t+1]==="-"&&e[t+2]==="-"){for(t+=3;t"){t+=2;break}}else if(e.length>t+8&&e[t+1]==="D"&&e[t+2]==="O"&&e[t+3]==="C"&&e[t+4]==="T"&&e[t+5]==="Y"&&e[t+6]==="P"&&e[t+7]==="E"){let n=1;for(t+=8;t"&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]==="["&&e[t+2]==="C"&&e[t+3]==="D"&&e[t+4]==="A"&&e[t+5]==="T"&&e[t+6]==="A"&&e[t+7]==="["){for(t+=8;t"){t+=2;break}}return t}const ie='"',se="'";function oe(e,t){let n="",x="",i=!1;for(;t"&&x===""){i=!0;break}n+=e[t]}return x!==""?!1:{value:n,index:t,tagClosed:i}}const xe=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function U(e,t){const n=_.getAllMatches(e,xe),x={};for(let i=0;i!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e}},ue=function(e){return Object.assign({},W,e)};V.buildOptions=ue,V.defaultOptions=W;class de{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,n){t==="__proto__"&&(t="#__proto__"),this.child.push({[t]:n})}addChild(t){t.tagname==="__proto__"&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}var ce=de;const pe=O;function me(e,t){const n={};if(e[t+3]==="O"&&e[t+4]==="C"&&e[t+5]==="T"&&e[t+6]==="Y"&&e[t+7]==="P"&&e[t+8]==="E"){t=t+9;let x=1,i=!1,o=!1,u="";for(;t"){if(o?e[t-1]==="-"&&e[t-2]==="-"&&(o=!1,x--):x--,x===0)break}else e[t]==="["?i=!0:u+=e[t];if(x!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:t}}function ge(e,t){let n="";for(;t0&&i&&n[2]!==".")return e;if(!t.leadingZeros&&o.length>0&&!i&&n[1]!==".")return e;{const r=Number(n),l=""+r;return l.search(/[eE]/)!==-1||a?t.eNotation?r:e:n.indexOf(".")!==-1?l==="0"&&u===""||l===u||i&&l==="-"+u?r:e:o?u===l||i+u===l?r:e:n===l||n===i+l?r:e}}else return e}}function Be(e){return e&&e.indexOf(".")!==-1&&(e=e.replace(/0+$/,""),e==="."?e="0":e[0]==="."?e="0"+e:e[e.length-1]==="."&&(e=e.substr(0,e.length-1))),e}var Oe=Ce;const L=O,B=ce,Pe=ye,Ie=Oe;"<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)".replace(/NAME/g,L.nameRegexp);let ke=class{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"}},this.addExternalEntities=$e,this.parseXml=Me,this.parseTextData=_e,this.resolveNameSpace=Ve,this.buildAttributesMap=Se,this.isItStopNode=Re,this.replaceEntitiesValue=je,this.readStopNodeData=Ue,this.saveTextToParentTag=Xe,this.addChild=ze}};function $e(e){const t=Object.keys(e);for(let n=0;n0)){u||(e=this.replaceEntitiesValue(e));const a=this.options.tagValueProcessor(t,e,n,i,o);return a==null?e:typeof a!=typeof e||a!==e?a:this.options.trimValues?M(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?M(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function Ve(e){if(this.options.removeNSPrefix){const t=e.split(":"),n=e.charAt(0)==="/"?"/":"";if(t[0]==="xmlns")return"";t.length===2&&(e=n+t[1])}return e}const Le=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Se(e,t,n){if(!this.options.ignoreAttributes&&typeof e=="string"){const x=L.getAllMatches(e,Le),i=x.length,o={};for(let u=0;u",o,"Closing Tag is not closed.");let r=e.substring(o+2,a).trim();if(this.options.removeNSPrefix){const d=r.indexOf(":");d!==-1&&(r=r.substr(d+1))}this.options.transformTagName&&(r=this.options.transformTagName(r)),n&&(x=this.saveTextToParentTag(x,n,i));const l=i.substring(i.lastIndexOf(".")+1);if(r&&this.options.unpairedTags.indexOf(r)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: `);let f=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(f=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):f=i.lastIndexOf("."),i=i.substring(0,f),n=this.tagsNodeStack.pop(),x="",o=a}else if(e[o+1]==="?"){let a=S(e,o,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(x=this.saveTextToParentTag(x,n,i),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){const r=new B(a.tagName);r.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(r[":@"]=this.buildAttributesMap(a.tagExp,i,a.tagName)),this.addChild(n,r,i)}o=a.closeIndex+1}else if(e.substr(o+1,3)==="!--"){const a=y(e,"-->",o+4,"Comment is not closed.");if(this.options.commentPropName){const r=e.substring(o+4,a-2);x=this.saveTextToParentTag(x,n,i),n.add(this.options.commentPropName,[{[this.options.textNodeName]:r}])}o=a}else if(e.substr(o+1,2)==="!D"){const a=Pe(e,o);this.docTypeEntities=a.entities,o=a.i}else if(e.substr(o+1,2)==="!["){const a=y(e,"]]>",o,"CDATA is not closed.")-2,r=e.substring(o+9,a);if(x=this.saveTextToParentTag(x,n,i),this.options.cdataPropName)n.add(this.options.cdataPropName,[{[this.options.textNodeName]:r}]);else{let l=this.parseTextData(r,n.tagname,i,!0,!1,!0);l==null&&(l=""),n.add(this.options.textNodeName,l)}o=a+2}else{let a=S(e,o,this.options.removeNSPrefix),r=a.tagName;const l=a.rawTagName;let f=a.tagExp,d=a.attrExpPresent,p=a.closeIndex;this.options.transformTagName&&(r=this.options.transformTagName(r)),n&&x&&n.tagname!=="!xml"&&(x=this.saveTextToParentTag(x,n,i,!1));const c=n;if(c&&this.options.unpairedTags.indexOf(c.tagname)!==-1&&(n=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),r!==t.tagname&&(i+=i?"."+r:r),this.isItStopNode(this.options.stopNodes,i,r)){let m="";if(f.length>0&&f.lastIndexOf("/")===f.length-1)o=a.closeIndex;else if(this.options.unpairedTags.indexOf(r)!==-1)o=a.closeIndex;else{const N=this.readStopNodeData(e,l,p+1);if(!N)throw new Error(`Unexpected end of ${l}`);o=N.i,m=N.tagContent}const b=new B(r);r!==f&&d&&(b[":@"]=this.buildAttributesMap(f,i,r)),m&&(m=this.parseTextData(m,r,i,!0,d,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),b.add(this.options.textNodeName,m),this.addChild(n,b,i)}else{if(f.length>0&&f.lastIndexOf("/")===f.length-1){r[r.length-1]==="/"?(r=r.substr(0,r.length-1),i=i.substr(0,i.length-1),f=r):f=f.substr(0,f.length-1),this.options.transformTagName&&(r=this.options.transformTagName(r));const m=new B(r);r!==f&&d&&(m[":@"]=this.buildAttributesMap(f,i,r)),this.addChild(n,m,i),i=i.substr(0,i.lastIndexOf("."))}else{const m=new B(r);this.tagsNodeStack.push(n),r!==f&&d&&(m[":@"]=this.buildAttributesMap(f,i,r)),this.addChild(n,m,i),n=m}x="",o=p}}else x+=e[o];return t.child};function ze(e,t,n){const x=this.options.updateTag(t.tagname,n,t[":@"]);x===!1||(typeof x=="string"&&(t.tagname=x),e.addChild(t))}const je=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function Xe(e,t,n,x){return e&&(x===void 0&&(x=Object.keys(t.child).length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,x),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function Re(e,t,n){const x="*."+n;for(const i in e){const o=e[i];if(x===o||t===o)return!0}return!1}function He(e,t,n=">"){let x,i="";for(let o=t;o",n,`${t} is not closed`);if(e.substring(n+2,o).trim()===t&&(i--,i===0))return{tagContent:e.substring(x,n),i:o};n=o}else if(e[n+1]==="?")n=y(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=y(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=y(e,"]]>",n,"StopNode is not closed.")-2;else{const o=S(e,n,">");o&&((o&&o.tagName)===t&&o.tagExp[o.tagExp.length-1]!=="/"&&i++,n=o.closeIndex)}}function M(e,t,n){if(t&&typeof e=="string"){const x=e.trim();return x==="true"?!0:x==="false"?!1:Ie(e,n)}else return L.isExist(e)?e:""}var We=ke,G={};function Ge(e,t){return q(e,t)}function q(e,t,n){let x;const i={};for(let o=0;o0&&(i[t.textNodeName]=x):x!==void 0&&(i[t.textNodeName]=x),i}function qe(e){const t=Object.keys(e);for(let n=0;n0&&(n=tt),Z(e,t,"",n)}function Z(e,t,n,x){let i="",o=!1;for(let u=0;u`,o=!1;continue}else if(r===t.commentPropName){i+=x+``,o=!0;continue}else if(r[0]==="?"){const m=J(a[":@"],t),b=r==="?xml"?"":x;let N=a[r][0][t.textNodeName];N=N.length!==0?" "+N:"",i+=b+`<${r}${N}${m}?>`,o=!0;continue}let f=x;f!==""&&(f+=t.indentBy);const d=J(a[":@"],t),p=x+`<${r}${d}`,c=Z(a[r],t,l,f);t.unpairedTags.indexOf(r)!==-1?t.suppressUnpairedNode?i+=p+">":i+=p+"/>":(!c||c.length===0)&&t.suppressEmptyNode?i+=p+"/>":c&&c.endsWith(">")?i+=p+`>${c}${x}`:(i+=p+">",c&&x!==""&&(c.includes("/>")||c.includes("`),o=!0}return i}function it(e){const t=Object.keys(e);for(let n=0;n0&&t.processEntities)for(let n=0;n","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function v(e){this.options=Object.assign({},rt,e),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=lt),this.processTextOrObjNode=at,this.options.format?(this.indentate=ft,this.tagEndChar=`> `,this.newLine=` `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}v.prototype.build=function(e){return this.options.preserveOrder?xt(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0).val)},v.prototype.j2x=function(e,t){let n="",x="";for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i))if(typeof e[i]>"u")this.isAttribute(i)&&(x+="");else if(e[i]===null)this.isAttribute(i)?x+="":i[0]==="?"?x+=this.indentate(t)+"<"+i+"?"+this.tagEndChar:x+=this.indentate(t)+"<"+i+"/"+this.tagEndChar;else if(e[i]instanceof Date)x+=this.buildTextValNode(e[i],i,"",t);else if(typeof e[i]!="object"){const o=this.isAttribute(i);if(o)n+=this.buildAttrPairStr(o,""+e[i]);else if(i===this.options.textNodeName){let u=this.options.tagValueProcessor(i,""+e[i]);x+=this.replaceEntitiesValue(u)}else x+=this.buildTextValNode(e[i],i,"",t)}else if(Array.isArray(e[i])){const o=e[i].length;let u="";for(let a=0;a"u"||(r===null?i[0]==="?"?x+=this.indentate(t)+"<"+i+"?"+this.tagEndChar:x+=this.indentate(t)+"<"+i+"/"+this.tagEndChar:typeof r=="object"?this.options.oneListGroup?u+=this.j2x(r,t+1).val:u+=this.processTextOrObjNode(r,i,t):u+=this.buildTextValNode(r,i,"",t))}this.options.oneListGroup&&(u=this.buildObjectNode(u,i,"",t)),x+=u}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){const o=Object.keys(e[i]),u=o.length;for(let a=0;a"+e+i:this.options.commentPropName!==!1&&t===this.options.commentPropName&&o.length===0?this.indentate(x)+``+this.newLine:this.indentate(x)+"<"+t+n+o+this.tagEndChar+e+this.indentate(x)+i}},v.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(x)+``+this.newLine;if(t[0]==="?")return this.indentate(x)+"<"+t+n+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(t,e);return i=this.replaceEntitiesValue(i),i===""?this.indentate(x)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(x)+"<"+t+n+">"+i+"0&&this.options.processEntities)for(let t=0;tx.mime.includes("image")||x.mime.includes("xml"))[0];return(t==null?void 0:t.typename)=="xml"?Q(e)||t:t||Q(e)||{extensions:"png",typename:"png",mime:"image/png"}}return ct});