{
  "version": 3,
  "sources": ["../src/local.ts", "../src/lib/local-file-storage.ts", "../../lazy-file/src/fs.ts", "../../../node_modules/.pnpm/mrmime@2.0.0/node_modules/mrmime/index.mjs", "../../lazy-file/src/lib/byte-range.ts", "../../lazy-file/src/lib/lazy-file.ts"],
  "sourcesContent": ["export { LocalFileStorage } from './lib/local-file-storage.ts';\n", "import * as fs from 'node:fs';\nimport * as fsp from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { openFile, writeFile } from '@mjackson/lazy-file/fs';\n\nimport type { FileStorage, FileMetadata, ListOptions, ListResult } from './file-storage.ts';\n\ntype MetadataJson = Omit<FileMetadata, 'size'>;\n\n/**\n * A `FileStorage` that is backed by a directory on the local filesystem.\n *\n * Important: No attempt is made to avoid overwriting existing files, so the directory used should\n * be a new directory solely dedicated to this storage object.\n *\n * Note: Keys have no correlation to file names on disk, so they may be any string including\n * characters that are not valid in file names. Additionally, individual `File` names have no\n * correlation to names of files on disk, so multiple files with the same name may be stored in the\n * same storage object.\n */\nexport class LocalFileStorage implements FileStorage {\n  #dirname: string;\n\n  /**\n   * @param directory The directory where files are stored\n   */\n  constructor(directory: string) {\n    this.#dirname = path.resolve(directory);\n\n    try {\n      let stats = fs.statSync(this.#dirname);\n\n      if (!stats.isDirectory()) {\n        throw new Error(`Path \"${this.#dirname}\" is not a directory`);\n      }\n    } catch (error) {\n      if (!isNoEntityError(error)) {\n        throw error;\n      }\n\n      fs.mkdirSync(this.#dirname, { recursive: true });\n    }\n  }\n\n  async get(key: string): Promise<File | null> {\n    let { filePath, metaPath } = await this.#getPaths(key);\n\n    try {\n      let meta = await readMetadata(metaPath);\n\n      return openFile(filePath, {\n        lastModified: meta.lastModified,\n        name: meta.name,\n        type: meta.type,\n      });\n    } catch (error) {\n      if (!isNoEntityError(error)) {\n        throw error;\n      }\n\n      return null;\n    }\n  }\n\n  async has(key: string): Promise<boolean> {\n    let { metaPath } = await this.#getPaths(key);\n\n    try {\n      await fsp.access(metaPath);\n      return true;\n    } catch {\n      return false;\n    }\n  }\n\n  async list<T extends ListOptions>(options?: T): Promise<ListResult<T>> {\n    let { cursor, includeMetadata = false, limit = 32, prefix } = options ?? {};\n\n    let files: any[] = [];\n    let foundCursor = cursor === undefined;\n    let nextCursor: string | undefined;\n    let lastHash: string | undefined;\n\n    outerLoop: for await (let subdir of await fsp.opendir(this.#dirname)) {\n      if (!subdir.isDirectory()) continue;\n\n      for await (let file of await fsp.opendir(path.join(this.#dirname, subdir.name))) {\n        if (!file.isFile() || !file.name.endsWith('.meta.json')) continue;\n\n        let hash = file.name.slice(0, -10); // Remove \".meta.json\"\n\n        if (foundCursor) {\n          let meta = await readMetadata(path.join(this.#dirname, subdir.name, file.name));\n\n          if (prefix != null && !meta.key.startsWith(prefix)) {\n            continue;\n          }\n\n          if (files.length >= limit) {\n            nextCursor = lastHash;\n            break outerLoop;\n          }\n\n          if (includeMetadata) {\n            let size = (await fsp.stat(path.join(this.#dirname, subdir.name, `${hash}.dat`))).size;\n            files.push({ ...meta, size });\n          } else {\n            files.push({ key: meta.key });\n          }\n        } else if (hash === cursor) {\n          foundCursor = true;\n        }\n\n        lastHash = hash;\n      }\n    }\n\n    return {\n      cursor: nextCursor,\n      files,\n    };\n  }\n\n  async put(key: string, file: File): Promise<File> {\n    await this.set(key, file);\n    return (await this.get(key))!;\n  }\n\n  async remove(key: string): Promise<void> {\n    let { filePath, metaPath } = await this.#getPaths(key);\n\n    try {\n      await Promise.all([fsp.unlink(filePath), fsp.unlink(metaPath)]);\n    } catch (error) {\n      if (!isNoEntityError(error)) {\n        throw error;\n      }\n    }\n  }\n\n  async set(key: string, file: File): Promise<void> {\n    let { directory, filePath, metaPath } = await this.#getPaths(key);\n\n    // Ensure directory exists\n    await fsp.mkdir(directory, { recursive: true });\n\n    await writeFile(filePath, file);\n\n    let meta: MetadataJson = {\n      key,\n      lastModified: file.lastModified,\n      name: file.name,\n      type: file.type,\n    };\n    await fsp.writeFile(metaPath, JSON.stringify(meta));\n  }\n\n  async #getPaths(key: string): Promise<{ directory: string; filePath: string; metaPath: string }> {\n    let hash = await computeHash(key);\n    let directory = path.join(this.#dirname, hash.slice(0, 2));\n\n    return {\n      directory,\n      filePath: path.join(directory, `${hash}.dat`),\n      metaPath: path.join(directory, `${hash}.meta.json`),\n    };\n  }\n}\n\nasync function readMetadata(metaPath: string): Promise<MetadataJson> {\n  return JSON.parse(await fsp.readFile(metaPath, 'utf-8'));\n}\n\nasync function computeHash(key: string, algorithm = 'SHA-256'): Promise<string> {\n  let digest = await crypto.subtle.digest(algorithm, new TextEncoder().encode(key));\n  return Array.from(new Uint8Array(digest))\n    .map((b) => b.toString(16).padStart(2, '0'))\n    .join('');\n}\n\nfunction isNoEntityError(obj: unknown): obj is NodeJS.ErrnoException & { code: 'ENOENT' } {\n  return obj instanceof Error && 'code' in obj && (obj as NodeJS.ErrnoException).code === 'ENOENT';\n}\n", "import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { lookup } from 'mrmime';\n\nimport { type LazyContent, LazyFile } from './lib/lazy-file.ts';\n\nexport interface OpenFileOptions {\n  /**\n   * Overrides the name of the file. Default is the name of the file on disk.\n   */\n  name?: string;\n  /**\n   * Overrides the MIME type of the file. Default is determined by the file extension.\n   */\n  type?: string;\n  /**\n   * Overrides the last modified timestamp of the file. Default is the file's last modified time.\n   */\n  lastModified?: number;\n}\n\n/**\n * Returns a `File` from the local filesytem.\n *\n * [MDN `File` Reference](https://developer.mozilla.org/en-US/docs/Web/API/File)\n *\n * @param filename The path to the file\n * @param options Options to override the file's metadata\n * @returns A `File` object\n */\nexport function openFile(filename: string, options?: OpenFileOptions): File {\n  let stats = fs.statSync(filename);\n\n  if (!stats.isFile()) {\n    throw new Error(`Path \"${filename}\" is not a file`);\n  }\n\n  let content: LazyContent = {\n    byteLength: stats.size,\n    stream(start, end) {\n      return streamFile(filename, start, end);\n    },\n  };\n\n  return new LazyFile(content, options?.name ?? path.basename(filename), {\n    type: options?.type ?? lookup(filename),\n    lastModified: options?.lastModified ?? stats.mtimeMs,\n  });\n}\n\nfunction streamFile(filename: string, start = 0, end = Infinity): ReadableStream<Uint8Array> {\n  let read = fs.createReadStream(filename, { start, end: end - 1 }).iterator();\n\n  return new ReadableStream({\n    async pull(controller) {\n      let { done, value } = await read.next();\n\n      if (done) {\n        controller.close();\n      } else {\n        controller.enqueue(new Uint8Array(value.buffer, value.byteOffset, value.byteLength));\n      }\n    },\n  });\n}\n\n// Preserve backwards compat with v3.0\nexport { type OpenFileOptions as GetFileOptions, openFile as getFile };\n\n/**\n * Writes a `File` to the local filesytem and resolves when the stream is finished.\n *\n * [MDN `File` Reference](https://developer.mozilla.org/en-US/docs/Web/API/File)\n *\n * @param to The path to write the file to, or an open file descriptor\n * @param file The file to write\n * @returns A promise that resolves when the file is written\n */\nexport function writeFile(to: string | number | fs.promises.FileHandle, file: File): Promise<void> {\n  return new Promise(async (resolve, reject) => {\n    let writeStream =\n      typeof to === 'string'\n        ? fs.createWriteStream(to)\n        : fs.createWriteStream('ignored', { fd: to });\n\n    try {\n      for await (let chunk of file.stream()) {\n        writeStream.write(chunk);\n      }\n\n      writeStream.end(() => {\n        resolve();\n      });\n    } catch (error) {\n      writeStream.end(() => {\n        reject(error);\n      });\n    }\n  });\n}\n", "const mimes = {\n  \"3g2\": \"video/3gpp2\",\n  \"3gp\": \"video/3gpp\",\n  \"3gpp\": \"video/3gpp\",\n  \"3mf\": \"model/3mf\",\n  \"aac\": \"audio/aac\",\n  \"ac\": \"application/pkix-attr-cert\",\n  \"adp\": \"audio/adpcm\",\n  \"adts\": \"audio/aac\",\n  \"ai\": \"application/postscript\",\n  \"aml\": \"application/automationml-aml+xml\",\n  \"amlx\": \"application/automationml-amlx+zip\",\n  \"amr\": \"audio/amr\",\n  \"apng\": \"image/apng\",\n  \"appcache\": \"text/cache-manifest\",\n  \"appinstaller\": \"application/appinstaller\",\n  \"appx\": \"application/appx\",\n  \"appxbundle\": \"application/appxbundle\",\n  \"asc\": \"application/pgp-keys\",\n  \"atom\": \"application/atom+xml\",\n  \"atomcat\": \"application/atomcat+xml\",\n  \"atomdeleted\": \"application/atomdeleted+xml\",\n  \"atomsvc\": \"application/atomsvc+xml\",\n  \"au\": \"audio/basic\",\n  \"avci\": \"image/avci\",\n  \"avcs\": \"image/avcs\",\n  \"avif\": \"image/avif\",\n  \"aw\": \"application/applixware\",\n  \"bdoc\": \"application/bdoc\",\n  \"bin\": \"application/octet-stream\",\n  \"bmp\": \"image/bmp\",\n  \"bpk\": \"application/octet-stream\",\n  \"btf\": \"image/prs.btif\",\n  \"btif\": \"image/prs.btif\",\n  \"buffer\": \"application/octet-stream\",\n  \"ccxml\": \"application/ccxml+xml\",\n  \"cdfx\": \"application/cdfx+xml\",\n  \"cdmia\": \"application/cdmi-capability\",\n  \"cdmic\": \"application/cdmi-container\",\n  \"cdmid\": \"application/cdmi-domain\",\n  \"cdmio\": \"application/cdmi-object\",\n  \"cdmiq\": \"application/cdmi-queue\",\n  \"cer\": \"application/pkix-cert\",\n  \"cgm\": \"image/cgm\",\n  \"cjs\": \"application/node\",\n  \"class\": \"application/java-vm\",\n  \"coffee\": \"text/coffeescript\",\n  \"conf\": \"text/plain\",\n  \"cpl\": \"application/cpl+xml\",\n  \"cpt\": \"application/mac-compactpro\",\n  \"crl\": \"application/pkix-crl\",\n  \"css\": \"text/css\",\n  \"csv\": \"text/csv\",\n  \"cu\": \"application/cu-seeme\",\n  \"cwl\": \"application/cwl\",\n  \"cww\": \"application/prs.cww\",\n  \"davmount\": \"application/davmount+xml\",\n  \"dbk\": \"application/docbook+xml\",\n  \"deb\": \"application/octet-stream\",\n  \"def\": \"text/plain\",\n  \"deploy\": \"application/octet-stream\",\n  \"dib\": \"image/bmp\",\n  \"disposition-notification\": \"message/disposition-notification\",\n  \"dist\": \"application/octet-stream\",\n  \"distz\": \"application/octet-stream\",\n  \"dll\": \"application/octet-stream\",\n  \"dmg\": \"application/octet-stream\",\n  \"dms\": \"application/octet-stream\",\n  \"doc\": \"application/msword\",\n  \"dot\": \"application/msword\",\n  \"dpx\": \"image/dpx\",\n  \"drle\": \"image/dicom-rle\",\n  \"dsc\": \"text/prs.lines.tag\",\n  \"dssc\": \"application/dssc+der\",\n  \"dtd\": \"application/xml-dtd\",\n  \"dump\": \"application/octet-stream\",\n  \"dwd\": \"application/atsc-dwd+xml\",\n  \"ear\": \"application/java-archive\",\n  \"ecma\": \"application/ecmascript\",\n  \"elc\": \"application/octet-stream\",\n  \"emf\": \"image/emf\",\n  \"eml\": \"message/rfc822\",\n  \"emma\": \"application/emma+xml\",\n  \"emotionml\": \"application/emotionml+xml\",\n  \"eps\": \"application/postscript\",\n  \"epub\": \"application/epub+zip\",\n  \"exe\": \"application/octet-stream\",\n  \"exi\": \"application/exi\",\n  \"exp\": \"application/express\",\n  \"exr\": \"image/aces\",\n  \"ez\": \"application/andrew-inset\",\n  \"fdf\": \"application/fdf\",\n  \"fdt\": \"application/fdt+xml\",\n  \"fits\": \"image/fits\",\n  \"g3\": \"image/g3fax\",\n  \"gbr\": \"application/rpki-ghostbusters\",\n  \"geojson\": \"application/geo+json\",\n  \"gif\": \"image/gif\",\n  \"glb\": \"model/gltf-binary\",\n  \"gltf\": \"model/gltf+json\",\n  \"gml\": \"application/gml+xml\",\n  \"gpx\": \"application/gpx+xml\",\n  \"gram\": \"application/srgs\",\n  \"grxml\": \"application/srgs+xml\",\n  \"gxf\": \"application/gxf\",\n  \"gz\": \"application/gzip\",\n  \"h261\": \"video/h261\",\n  \"h263\": \"video/h263\",\n  \"h264\": \"video/h264\",\n  \"heic\": \"image/heic\",\n  \"heics\": \"image/heic-sequence\",\n  \"heif\": \"image/heif\",\n  \"heifs\": \"image/heif-sequence\",\n  \"hej2\": \"image/hej2k\",\n  \"held\": \"application/atsc-held+xml\",\n  \"hjson\": \"application/hjson\",\n  \"hlp\": \"application/winhlp\",\n  \"hqx\": \"application/mac-binhex40\",\n  \"hsj2\": \"image/hsj2\",\n  \"htm\": \"text/html\",\n  \"html\": \"text/html\",\n  \"ics\": \"text/calendar\",\n  \"ief\": \"image/ief\",\n  \"ifb\": \"text/calendar\",\n  \"iges\": \"model/iges\",\n  \"igs\": \"model/iges\",\n  \"img\": \"application/octet-stream\",\n  \"in\": \"text/plain\",\n  \"ini\": \"text/plain\",\n  \"ink\": \"application/inkml+xml\",\n  \"inkml\": \"application/inkml+xml\",\n  \"ipfix\": \"application/ipfix\",\n  \"iso\": \"application/octet-stream\",\n  \"its\": \"application/its+xml\",\n  \"jade\": \"text/jade\",\n  \"jar\": \"application/java-archive\",\n  \"jhc\": \"image/jphc\",\n  \"jls\": \"image/jls\",\n  \"jp2\": \"image/jp2\",\n  \"jpe\": \"image/jpeg\",\n  \"jpeg\": \"image/jpeg\",\n  \"jpf\": \"image/jpx\",\n  \"jpg\": \"image/jpeg\",\n  \"jpg2\": \"image/jp2\",\n  \"jpgm\": \"image/jpm\",\n  \"jpgv\": \"video/jpeg\",\n  \"jph\": \"image/jph\",\n  \"jpm\": \"image/jpm\",\n  \"jpx\": \"image/jpx\",\n  \"js\": \"text/javascript\",\n  \"json\": \"application/json\",\n  \"json5\": \"application/json5\",\n  \"jsonld\": \"application/ld+json\",\n  \"jsonml\": \"application/jsonml+json\",\n  \"jsx\": \"text/jsx\",\n  \"jt\": \"model/jt\",\n  \"jxr\": \"image/jxr\",\n  \"jxra\": \"image/jxra\",\n  \"jxrs\": \"image/jxrs\",\n  \"jxs\": \"image/jxs\",\n  \"jxsc\": \"image/jxsc\",\n  \"jxsi\": \"image/jxsi\",\n  \"jxss\": \"image/jxss\",\n  \"kar\": \"audio/midi\",\n  \"ktx\": \"image/ktx\",\n  \"ktx2\": \"image/ktx2\",\n  \"less\": \"text/less\",\n  \"lgr\": \"application/lgr+xml\",\n  \"list\": \"text/plain\",\n  \"litcoffee\": \"text/coffeescript\",\n  \"log\": \"text/plain\",\n  \"lostxml\": \"application/lost+xml\",\n  \"lrf\": \"application/octet-stream\",\n  \"m1v\": \"video/mpeg\",\n  \"m21\": \"application/mp21\",\n  \"m2a\": \"audio/mpeg\",\n  \"m2v\": \"video/mpeg\",\n  \"m3a\": \"audio/mpeg\",\n  \"m4a\": \"audio/mp4\",\n  \"m4p\": \"application/mp4\",\n  \"m4s\": \"video/iso.segment\",\n  \"ma\": \"application/mathematica\",\n  \"mads\": \"application/mads+xml\",\n  \"maei\": \"application/mmt-aei+xml\",\n  \"man\": \"text/troff\",\n  \"manifest\": \"text/cache-manifest\",\n  \"map\": \"application/json\",\n  \"mar\": \"application/octet-stream\",\n  \"markdown\": \"text/markdown\",\n  \"mathml\": \"application/mathml+xml\",\n  \"mb\": \"application/mathematica\",\n  \"mbox\": \"application/mbox\",\n  \"md\": \"text/markdown\",\n  \"mdx\": \"text/mdx\",\n  \"me\": \"text/troff\",\n  \"mesh\": \"model/mesh\",\n  \"meta4\": \"application/metalink4+xml\",\n  \"metalink\": \"application/metalink+xml\",\n  \"mets\": \"application/mets+xml\",\n  \"mft\": \"application/rpki-manifest\",\n  \"mid\": \"audio/midi\",\n  \"midi\": \"audio/midi\",\n  \"mime\": \"message/rfc822\",\n  \"mj2\": \"video/mj2\",\n  \"mjp2\": \"video/mj2\",\n  \"mjs\": \"text/javascript\",\n  \"mml\": \"text/mathml\",\n  \"mods\": \"application/mods+xml\",\n  \"mov\": \"video/quicktime\",\n  \"mp2\": \"audio/mpeg\",\n  \"mp21\": \"application/mp21\",\n  \"mp2a\": \"audio/mpeg\",\n  \"mp3\": \"audio/mpeg\",\n  \"mp4\": \"video/mp4\",\n  \"mp4a\": \"audio/mp4\",\n  \"mp4s\": \"application/mp4\",\n  \"mp4v\": \"video/mp4\",\n  \"mpd\": \"application/dash+xml\",\n  \"mpe\": \"video/mpeg\",\n  \"mpeg\": \"video/mpeg\",\n  \"mpf\": \"application/media-policy-dataset+xml\",\n  \"mpg\": \"video/mpeg\",\n  \"mpg4\": \"video/mp4\",\n  \"mpga\": \"audio/mpeg\",\n  \"mpp\": \"application/dash-patch+xml\",\n  \"mrc\": \"application/marc\",\n  \"mrcx\": \"application/marcxml+xml\",\n  \"ms\": \"text/troff\",\n  \"mscml\": \"application/mediaservercontrol+xml\",\n  \"msh\": \"model/mesh\",\n  \"msi\": \"application/octet-stream\",\n  \"msix\": \"application/msix\",\n  \"msixbundle\": \"application/msixbundle\",\n  \"msm\": \"application/octet-stream\",\n  \"msp\": \"application/octet-stream\",\n  \"mtl\": \"model/mtl\",\n  \"musd\": \"application/mmt-usd+xml\",\n  \"mxf\": \"application/mxf\",\n  \"mxmf\": \"audio/mobile-xmf\",\n  \"mxml\": \"application/xv+xml\",\n  \"n3\": \"text/n3\",\n  \"nb\": \"application/mathematica\",\n  \"nq\": \"application/n-quads\",\n  \"nt\": \"application/n-triples\",\n  \"obj\": \"model/obj\",\n  \"oda\": \"application/oda\",\n  \"oga\": \"audio/ogg\",\n  \"ogg\": \"audio/ogg\",\n  \"ogv\": \"video/ogg\",\n  \"ogx\": \"application/ogg\",\n  \"omdoc\": \"application/omdoc+xml\",\n  \"onepkg\": \"application/onenote\",\n  \"onetmp\": \"application/onenote\",\n  \"onetoc\": \"application/onenote\",\n  \"onetoc2\": \"application/onenote\",\n  \"opf\": \"application/oebps-package+xml\",\n  \"opus\": \"audio/ogg\",\n  \"otf\": \"font/otf\",\n  \"owl\": \"application/rdf+xml\",\n  \"oxps\": \"application/oxps\",\n  \"p10\": \"application/pkcs10\",\n  \"p7c\": \"application/pkcs7-mime\",\n  \"p7m\": \"application/pkcs7-mime\",\n  \"p7s\": \"application/pkcs7-signature\",\n  \"p8\": \"application/pkcs8\",\n  \"pdf\": \"application/pdf\",\n  \"pfr\": \"application/font-tdpfr\",\n  \"pgp\": \"application/pgp-encrypted\",\n  \"pkg\": \"application/octet-stream\",\n  \"pki\": \"application/pkixcmp\",\n  \"pkipath\": \"application/pkix-pkipath\",\n  \"pls\": \"application/pls+xml\",\n  \"png\": \"image/png\",\n  \"prc\": \"model/prc\",\n  \"prf\": \"application/pics-rules\",\n  \"provx\": \"application/provenance+xml\",\n  \"ps\": \"application/postscript\",\n  \"pskcxml\": \"application/pskc+xml\",\n  \"pti\": \"image/prs.pti\",\n  \"qt\": \"video/quicktime\",\n  \"raml\": \"application/raml+yaml\",\n  \"rapd\": \"application/route-apd+xml\",\n  \"rdf\": \"application/rdf+xml\",\n  \"relo\": \"application/p2p-overlay+xml\",\n  \"rif\": \"application/reginfo+xml\",\n  \"rl\": \"application/resource-lists+xml\",\n  \"rld\": \"application/resource-lists-diff+xml\",\n  \"rmi\": \"audio/midi\",\n  \"rnc\": \"application/relax-ng-compact-syntax\",\n  \"rng\": \"application/xml\",\n  \"roa\": \"application/rpki-roa\",\n  \"roff\": \"text/troff\",\n  \"rq\": \"application/sparql-query\",\n  \"rs\": \"application/rls-services+xml\",\n  \"rsat\": \"application/atsc-rsat+xml\",\n  \"rsd\": \"application/rsd+xml\",\n  \"rsheet\": \"application/urc-ressheet+xml\",\n  \"rss\": \"application/rss+xml\",\n  \"rtf\": \"text/rtf\",\n  \"rtx\": \"text/richtext\",\n  \"rusd\": \"application/route-usd+xml\",\n  \"s3m\": \"audio/s3m\",\n  \"sbml\": \"application/sbml+xml\",\n  \"scq\": \"application/scvp-cv-request\",\n  \"scs\": \"application/scvp-cv-response\",\n  \"sdp\": \"application/sdp\",\n  \"senmlx\": \"application/senml+xml\",\n  \"sensmlx\": \"application/sensml+xml\",\n  \"ser\": \"application/java-serialized-object\",\n  \"setpay\": \"application/set-payment-initiation\",\n  \"setreg\": \"application/set-registration-initiation\",\n  \"sgi\": \"image/sgi\",\n  \"sgm\": \"text/sgml\",\n  \"sgml\": \"text/sgml\",\n  \"shex\": \"text/shex\",\n  \"shf\": \"application/shf+xml\",\n  \"shtml\": \"text/html\",\n  \"sieve\": \"application/sieve\",\n  \"sig\": \"application/pgp-signature\",\n  \"sil\": \"audio/silk\",\n  \"silo\": \"model/mesh\",\n  \"siv\": \"application/sieve\",\n  \"slim\": \"text/slim\",\n  \"slm\": \"text/slim\",\n  \"sls\": \"application/route-s-tsid+xml\",\n  \"smi\": \"application/smil+xml\",\n  \"smil\": \"application/smil+xml\",\n  \"snd\": \"audio/basic\",\n  \"so\": \"application/octet-stream\",\n  \"spdx\": \"text/spdx\",\n  \"spp\": \"application/scvp-vp-response\",\n  \"spq\": \"application/scvp-vp-request\",\n  \"spx\": \"audio/ogg\",\n  \"sql\": \"application/sql\",\n  \"sru\": \"application/sru+xml\",\n  \"srx\": \"application/sparql-results+xml\",\n  \"ssdl\": \"application/ssdl+xml\",\n  \"ssml\": \"application/ssml+xml\",\n  \"stk\": \"application/hyperstudio\",\n  \"stl\": \"model/stl\",\n  \"stpx\": \"model/step+xml\",\n  \"stpxz\": \"model/step-xml+zip\",\n  \"stpz\": \"model/step+zip\",\n  \"styl\": \"text/stylus\",\n  \"stylus\": \"text/stylus\",\n  \"svg\": \"image/svg+xml\",\n  \"svgz\": \"image/svg+xml\",\n  \"swidtag\": \"application/swid+xml\",\n  \"t\": \"text/troff\",\n  \"t38\": \"image/t38\",\n  \"td\": \"application/urc-targetdesc+xml\",\n  \"tei\": \"application/tei+xml\",\n  \"teicorpus\": \"application/tei+xml\",\n  \"text\": \"text/plain\",\n  \"tfi\": \"application/thraud+xml\",\n  \"tfx\": \"image/tiff-fx\",\n  \"tif\": \"image/tiff\",\n  \"tiff\": \"image/tiff\",\n  \"toml\": \"application/toml\",\n  \"tr\": \"text/troff\",\n  \"trig\": \"application/trig\",\n  \"ts\": \"video/mp2t\",\n  \"tsd\": \"application/timestamped-data\",\n  \"tsv\": \"text/tab-separated-values\",\n  \"ttc\": \"font/collection\",\n  \"ttf\": \"font/ttf\",\n  \"ttl\": \"text/turtle\",\n  \"ttml\": \"application/ttml+xml\",\n  \"txt\": \"text/plain\",\n  \"u3d\": \"model/u3d\",\n  \"u8dsn\": \"message/global-delivery-status\",\n  \"u8hdr\": \"message/global-headers\",\n  \"u8mdn\": \"message/global-disposition-notification\",\n  \"u8msg\": \"message/global\",\n  \"ubj\": \"application/ubjson\",\n  \"uri\": \"text/uri-list\",\n  \"uris\": \"text/uri-list\",\n  \"urls\": \"text/uri-list\",\n  \"vcard\": \"text/vcard\",\n  \"vrml\": \"model/vrml\",\n  \"vtt\": \"text/vtt\",\n  \"vxml\": \"application/voicexml+xml\",\n  \"war\": \"application/java-archive\",\n  \"wasm\": \"application/wasm\",\n  \"wav\": \"audio/wav\",\n  \"weba\": \"audio/webm\",\n  \"webm\": \"video/webm\",\n  \"webmanifest\": \"application/manifest+json\",\n  \"webp\": \"image/webp\",\n  \"wgsl\": \"text/wgsl\",\n  \"wgt\": \"application/widget\",\n  \"wif\": \"application/watcherinfo+xml\",\n  \"wmf\": \"image/wmf\",\n  \"woff\": \"font/woff\",\n  \"woff2\": \"font/woff2\",\n  \"wrl\": \"model/vrml\",\n  \"wsdl\": \"application/wsdl+xml\",\n  \"wspolicy\": \"application/wspolicy+xml\",\n  \"x3d\": \"model/x3d+xml\",\n  \"x3db\": \"model/x3d+fastinfoset\",\n  \"x3dbz\": \"model/x3d+binary\",\n  \"x3dv\": \"model/x3d-vrml\",\n  \"x3dvz\": \"model/x3d+vrml\",\n  \"x3dz\": \"model/x3d+xml\",\n  \"xaml\": \"application/xaml+xml\",\n  \"xav\": \"application/xcap-att+xml\",\n  \"xca\": \"application/xcap-caps+xml\",\n  \"xcs\": \"application/calendar+xml\",\n  \"xdf\": \"application/xcap-diff+xml\",\n  \"xdssc\": \"application/dssc+xml\",\n  \"xel\": \"application/xcap-el+xml\",\n  \"xenc\": \"application/xenc+xml\",\n  \"xer\": \"application/patch-ops-error+xml\",\n  \"xfdf\": \"application/xfdf\",\n  \"xht\": \"application/xhtml+xml\",\n  \"xhtml\": \"application/xhtml+xml\",\n  \"xhvml\": \"application/xv+xml\",\n  \"xlf\": \"application/xliff+xml\",\n  \"xm\": \"audio/xm\",\n  \"xml\": \"text/xml\",\n  \"xns\": \"application/xcap-ns+xml\",\n  \"xop\": \"application/xop+xml\",\n  \"xpl\": \"application/xproc+xml\",\n  \"xsd\": \"application/xml\",\n  \"xsf\": \"application/prs.xsf+xml\",\n  \"xsl\": \"application/xml\",\n  \"xslt\": \"application/xml\",\n  \"xspf\": \"application/xspf+xml\",\n  \"xvm\": \"application/xv+xml\",\n  \"xvml\": \"application/xv+xml\",\n  \"yaml\": \"text/yaml\",\n  \"yang\": \"application/yang\",\n  \"yin\": \"application/yin+xml\",\n  \"yml\": \"text/yaml\",\n  \"zip\": \"application/zip\"\n};\n\nfunction lookup(extn) {\n\tlet tmp = ('' + extn).trim().toLowerCase();\n\tlet idx = tmp.lastIndexOf('.');\n\treturn mimes[!~idx ? tmp : tmp.substring(++idx)];\n}\n\nexport { mimes, lookup };\n", "export interface ByteRange {\n  /**\n   * The start index of the range (inclusive). If this number is negative, it represents an offset\n   * from the end of the content.\n   */\n  start: number;\n  /**\n   * The end index of the range (exclusive). If this number is negative, it represents an offset\n   * from the end of the content. `Infinity` represents the end of the content.\n   */\n  end: number;\n}\n\n/**\n * Returns the length of the byte range in a buffer of the given `size`.\n */\nexport function getByteLength(range: ByteRange, size: number): number {\n  let [start, end] = getIndexes(range, size);\n  return end - start;\n}\n\n/**\n * Resolves a byte range to absolute indexes in a buffer of the given `size`.\n */\nexport function getIndexes(range: ByteRange, size: number): [number, number] {\n  let start = Math.min(Math.max(0, range.start < 0 ? size + range.start : range.start), size);\n  let end = Math.min(Math.max(start, range.end < 0 ? size + range.end : range.end), size);\n  return [start, end];\n}\n", "import { type ByteRange, getByteLength, getIndexes } from './byte-range.ts';\n\n/**\n * A streaming interface for blob/file content.\n */\nexport interface LazyContent {\n  /**\n   * The total length of the content.\n   */\n  byteLength: number;\n  /**\n   * Returns a stream that can be used to read the content. When given, the `start` index is\n   * inclusive indicating the index of the first byte to read. The `end` index is exclusive\n   * indicating the index of the first byte not to read.\n   */\n  stream(start?: number, end?: number): ReadableStream<Uint8Array>;\n}\n\nexport interface LazyBlobOptions {\n  /**\n   * The range of bytes to include from the content. If not specified, all content is included.\n   */\n  range?: ByteRange;\n  /**\n   * The MIME type of the content. The default is an empty string.\n   *\n   * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob#type)\n   */\n  type?: string;\n}\n\n/**\n * A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) that may be backed by a stream\n * of data. This is useful for working with large blobs that would be impractical to load into\n * memory all at once.\n *\n * This class is an extension of JavaScript's built-in `Blob` class with the following additions:\n *\n * - The constructor may accept a `LazyContent` object instead of a `BlobPart[]` array\n * - The constructor may accept a `range` in the options to specify a subset of the content\n *\n * In normal usage you shouldn't have to specify the `range` yourself. The `slice()` method\n * automatically takes care of creating new `LazyBlob` instances with the correct range.\n *\n * [MDN `Blob` Reference](https://developer.mozilla.org/en-US/docs/Web/API/Blob)\n */\nexport class LazyBlob extends Blob {\n  readonly #content: BlobContent;\n\n  constructor(parts: BlobPart[] | LazyContent, options?: LazyBlobOptions) {\n    super([], options);\n    this.#content = new BlobContent(parts, options);\n  }\n\n  /**\n   * Returns the blob's contents as an [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer).\n   *\n   * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Blob/arrayBuffer)\n   */\n  async arrayBuffer(): Promise<ArrayBuffer> {\n    return this.#content.arrayBuffer();\n  }\n\n  /**\n   * Returns the blob's contents as a byte array.\n   *\n   * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Blob/bytes)\n   */\n  async bytes(): Promise<Uint8Array> {\n    return this.#content.bytes();\n  }\n\n  /**\n   * The size of the blob in bytes.\n   *\n   * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Blob/size)\n   */\n  get size(): number {\n    return this.#content.size;\n  }\n\n  /**\n   * Returns a new [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) that contains the data in the specified range.\n   *\n   * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Blob/slice)\n   */\n  slice(start?: number, end?: number, contentType?: string): Blob {\n    return this.#content.slice(start, end, contentType);\n  }\n\n  /**\n   * Returns a stream that can be used to read the blob's contents.\n   *\n   * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Blob/stream)\n   */\n  stream(): ReadableStream<Uint8Array> {\n    return this.#content.stream();\n  }\n\n  /**\n   * Returns the blob's contents as a string.\n   *\n   * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Blob/text)\n   */\n  async text(): Promise<string> {\n    return this.#content.text();\n  }\n}\n\nexport interface LazyFileOptions extends LazyBlobOptions {\n  /**\n   * The last modified timestamp of the file in milliseconds. Defaults to `Date.now()`.\n   *\n   * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/File/File#lastmodified)\n   */\n  lastModified?: number;\n}\n\n/**\n * A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) that may be backed by a stream\n * of data. This is useful for working with large files that would be impractical to load into\n * memory all at once.\n *\n * This class is an extension of JavaScript's built-in `File` class with the following additions:\n *\n * - The constructor may accept a `LazyContent` object instead of a `BlobPart[]` array\n * - The constructor may accept a `range` in the options to specify a subset of the content\n *\n * In normal usage you shouldn't have to specify the `range` yourself. The `slice()` method\n * automatically takes care of creating new `LazyBlob` instances with the correct range.\n *\n * [MDN `File` Reference](https://developer.mozilla.org/en-US/docs/Web/API/File)\n */\nexport class LazyFile extends File {\n  readonly #content: BlobContent;\n\n  constructor(parts: BlobPart[] | LazyContent, name: string, options?: LazyFileOptions) {\n    super([], name, options);\n    this.#content = new BlobContent(parts, options);\n  }\n\n  /**\n   * Returns the file's content as an [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer).\n   *\n   * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Blob/arrayBuffer)\n   */\n  async arrayBuffer(): Promise<ArrayBuffer> {\n    return this.#content.arrayBuffer();\n  }\n\n  /**\n   * Returns the file's contents as a byte array.\n   *\n   * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Blob/bytes)\n   */\n  async bytes(): Promise<Uint8Array> {\n    return this.#content.bytes();\n  }\n\n  /**\n   * The size of the file in bytes.\n   *\n   * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Blob/size)\n   */\n  get size(): number {\n    return this.#content.size;\n  }\n\n  /**\n   * Returns a new [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) that contains the data in the specified range.\n   *\n   * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Blob/slice)\n   */\n  slice(start?: number, end?: number, contentType?: string): Blob {\n    return this.#content.slice(start, end, contentType);\n  }\n\n  /**\n   * Returns a stream that can be used to read the file's contents.\n   *\n   * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Blob/stream)\n   */\n  stream(): ReadableStream<Uint8Array> {\n    return this.#content.stream();\n  }\n\n  /**\n   * Returns the file's contents as a string.\n   *\n   * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Blob/text)\n   */\n  async text(): Promise<string> {\n    return this.#content.text();\n  }\n}\n\nclass BlobContent {\n  readonly source: (Blob | Uint8Array)[] | LazyContent;\n  readonly totalSize: number;\n  readonly range?: ByteRange;\n  readonly type: string;\n\n  constructor(parts: BlobPart[] | LazyContent, options?: LazyBlobOptions) {\n    if (Array.isArray(parts)) {\n      this.source = [];\n      this.totalSize = 0;\n\n      for (let part of parts) {\n        if (part instanceof Blob) {\n          this.source.push(part);\n          this.totalSize += part.size;\n        } else {\n          let array: Uint8Array;\n          if (typeof part === 'string') {\n            array = new TextEncoder().encode(part);\n          } else if (ArrayBuffer.isView(part)) {\n            array = new Uint8Array(part.buffer, part.byteOffset, part.byteLength);\n          } else {\n            array = new Uint8Array(part);\n          }\n\n          this.source.push(array);\n          this.totalSize += array.byteLength;\n        }\n      }\n    } else {\n      this.source = parts;\n      this.totalSize = parts.byteLength;\n    }\n\n    this.range = options?.range;\n    this.type = options?.type ?? '';\n  }\n\n  async arrayBuffer(): Promise<ArrayBuffer> {\n    return (await this.bytes()).buffer;\n  }\n\n  async bytes(): Promise<Uint8Array> {\n    let result = new Uint8Array(this.size);\n\n    let offset = 0;\n    for await (let chunk of this.stream()) {\n      result.set(chunk, offset);\n      offset += chunk.length;\n    }\n\n    return result;\n  }\n\n  get size(): number {\n    return this.range != null ? getByteLength(this.range, this.totalSize) : this.totalSize;\n  }\n\n  slice(start = 0, end?: number, contentType = ''): LazyBlob {\n    let range: ByteRange =\n      this.range != null\n        ? // file.slice().slice() is additive\n          { start: this.range.start + start, end: this.range.end + (end ?? 0) }\n        : { start, end: end ?? this.size };\n\n    return new LazyBlob(this.source, { range, type: contentType });\n  }\n\n  stream(): ReadableStream<Uint8Array> {\n    if (this.range != null) {\n      let [start, end] = getIndexes(this.range, this.totalSize);\n      return Array.isArray(this.source)\n        ? streamContentArray(this.source, start, end)\n        : this.source.stream(start, end);\n    }\n\n    return Array.isArray(this.source) ? streamContentArray(this.source) : this.source.stream();\n  }\n\n  async text(): Promise<string> {\n    return new TextDecoder('utf-8').decode(await this.bytes());\n  }\n}\n\nfunction streamContentArray(\n  content: (Blob | Uint8Array)[],\n  start = 0,\n  end = Infinity,\n): ReadableStream<Uint8Array> {\n  let index = 0;\n  let bytesRead = 0;\n\n  return new ReadableStream({\n    async pull(controller) {\n      if (index >= content.length) {\n        controller.close();\n        return;\n      }\n\n      let hasPushed = false;\n\n      function pushChunk(chunk: Uint8Array) {\n        let chunkLength = chunk.byteLength;\n\n        if (!(bytesRead + chunkLength < start || bytesRead >= end)) {\n          let startIndex = Math.max(start - bytesRead, 0);\n          let endIndex = Math.min(end - bytesRead, chunkLength);\n          controller.enqueue(chunk.subarray(startIndex, endIndex));\n          hasPushed = true;\n        }\n\n        bytesRead += chunkLength;\n      }\n\n      async function pushPart(part: Blob | Uint8Array) {\n        if (part instanceof Blob) {\n          if (bytesRead + part.size <= start) {\n            // We can skip this part entirely.\n            bytesRead += part.size;\n            return;\n          }\n\n          for await (let chunk of part.stream()) {\n            pushChunk(chunk);\n\n            if (bytesRead >= end) {\n              // We can stop reading now.\n              break;\n            }\n          }\n        } else {\n          pushChunk(part);\n        }\n      }\n\n      while (!hasPushed && index < content.length) {\n        await pushPart(content[index++]);\n\n        if (bytesRead >= end) {\n          controller.close();\n          break;\n        }\n      }\n    },\n  });\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,MAAoB;AACpB,UAAqB;AACrB,IAAAC,QAAsB;;;ACFtB,SAAoB;AACpB,WAAsB;ACDtB,IAAM,QAAQ;EACZ,OAAO;EACP,OAAO;EACP,QAAQ;EACR,OAAO;EACP,OAAO;EACP,MAAM;EACN,OAAO;EACP,QAAQ;EACR,MAAM;EACN,OAAO;EACP,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,YAAY;EACZ,gBAAgB;EAChB,QAAQ;EACR,cAAc;EACd,OAAO;EACP,QAAQ;EACR,WAAW;EACX,eAAe;EACf,WAAW;EACX,MAAM;EACN,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,MAAM;EACN,QAAQ;EACR,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,QAAQ;EACR,UAAU;EACV,SAAS;EACT,QAAQ;EACR,SAAS;EACT,SAAS;EACT,SAAS;EACT,SAAS;EACT,SAAS;EACT,OAAO;EACP,OAAO;EACP,OAAO;EACP,SAAS;EACT,UAAU;EACV,QAAQ;EACR,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,MAAM;EACN,OAAO;EACP,OAAO;EACP,YAAY;EACZ,OAAO;EACP,OAAO;EACP,OAAO;EACP,UAAU;EACV,OAAO;EACP,4BAA4B;EAC5B,QAAQ;EACR,SAAS;EACT,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,OAAO;EACP,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,OAAO;E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