{"version":3,"file":"index.mjs","sources":["../../../lib/encoding/index.js"],"sourcesContent":["'use strict'\n\nconst textDecoder = new TextDecoder()\n\n/**\n * @see https://encoding.spec.whatwg.org/#utf-8-decode\n * @param {Uint8Array} buffer\n */\nfunction utf8DecodeBytes (buffer) {\n  if (buffer.length === 0) {\n    return ''\n  }\n\n  // 1. Let buffer be the result of peeking three bytes from\n  //    ioQueue, converted to a byte sequence.\n\n  // 2. If buffer is 0xEF 0xBB 0xBF, then read three\n  //    bytes from ioQueue. (Do nothing with those bytes.)\n  if (buffer[0] === 0xEF && buffer[1] === 0xBB && buffer[2] === 0xBF) {\n    buffer = buffer.subarray(3)\n  }\n\n  // 3. Process a queue with an instance of UTF-8’s\n  //    decoder, ioQueue, output, and \"replacement\".\n  const output = textDecoder.decode(buffer)\n\n  // 4. Return output.\n  return output\n}\n\nmodule.exports = {\n  utf8DecodeBytes\n}\n"],"names":["textDecoder","TextDecoder","encoding","utf8DecodeBytes","buffer","length","subarray","decode"],"mappings":"yHAEA,MAAMA,YAAc,IAAIC;;;;WA4BxBC,SAAiB,CACfC,gBAvBF,SAA0BC,QACxB,OAAsB,IAAlBA,OAAOC,OACF;;;;;AAQS,MAAdD,OAAO,IAA6B,MAAdA,OAAO,IAA6B,MAAdA,OAAO,KACrDA,OAASA,OAAOE,SAAS,IAKZN,YAAYO,OAAOH,QAIpC"}