@effect-uai/inworld 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/InworldRealtimeSynthesizer.d.mts +1 -1
  2. package/dist/InworldRealtimeSynthesizer.mjs +2 -2
  3. package/dist/InworldRealtimeSynthesizer.mjs.map +1 -1
  4. package/dist/InworldRealtimeTranscriber.d.mts +1 -1
  5. package/dist/InworldRealtimeTranscriber.mjs +2 -2
  6. package/dist/InworldRealtimeTranscriber.mjs.map +1 -1
  7. package/dist/InworldSynthesizer.d.mts +1 -1
  8. package/dist/InworldSynthesizer.mjs +2 -2
  9. package/dist/InworldSynthesizer.mjs.map +1 -1
  10. package/dist/InworldTranscriber.d.mts +1 -1
  11. package/dist/InworldTranscriber.d.mts.map +1 -1
  12. package/dist/InworldTranscriber.mjs +5 -4
  13. package/dist/InworldTranscriber.mjs.map +1 -1
  14. package/dist/codec-BU4azW_k.d.mts.map +1 -1
  15. package/dist/codec.mjs +4 -3
  16. package/dist/codec.mjs.map +1 -1
  17. package/dist/dist-Cu2gIMHV.mjs +17453 -0
  18. package/dist/dist-Cu2gIMHV.mjs.map +1 -0
  19. package/dist/dist-DHer1cql.mjs +1533 -0
  20. package/dist/dist-DHer1cql.mjs.map +1 -0
  21. package/dist/realtimeStt.d.mts +6 -0
  22. package/dist/realtimeStt.d.mts.map +1 -1
  23. package/dist/realtimeStt.mjs +18 -19
  24. package/dist/realtimeStt.mjs.map +1 -1
  25. package/dist/realtimeStt.test.d.mts +1 -0
  26. package/dist/realtimeStt.test.mjs +83 -0
  27. package/dist/realtimeStt.test.mjs.map +1 -0
  28. package/dist/realtimeTts.d.mts +6 -0
  29. package/dist/realtimeTts.d.mts.map +1 -1
  30. package/dist/realtimeTts.mjs +18 -17
  31. package/dist/realtimeTts.mjs.map +1 -1
  32. package/dist/realtimeTts.test.d.mts +1 -0
  33. package/dist/realtimeTts.test.mjs +70 -0
  34. package/dist/realtimeTts.test.mjs.map +1 -0
  35. package/dist/{rolldown-runtime-D7D4PA-g.mjs → rolldown-runtime-EAsCxrDo.mjs} +2 -1
  36. package/dist/wsAuth.d.mts +1 -1
  37. package/dist/wsAuth.mjs.map +1 -1
  38. package/package.json +4 -4
  39. package/src/InworldRealtimeSynthesizer.ts +1 -1
  40. package/src/InworldRealtimeTranscriber.ts +1 -1
  41. package/src/InworldSynthesizer.ts +1 -1
  42. package/src/InworldTranscriber.ts +4 -3
  43. package/src/codec.ts +3 -2
  44. package/src/realtimeStt.test.ts +82 -0
  45. package/src/realtimeStt.ts +46 -36
  46. package/src/realtimeTts.test.ts +74 -0
  47. package/src/realtimeTts.ts +52 -36
  48. package/src/wsAuth.ts +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dist-DHer1cql.mjs","names":["intToChar"],"sources":["../../../../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.6.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs","../../../../node_modules/.pnpm/magic-string@1.4.2/node_modules/magic-string/dist/index.mjs"],"sourcesContent":["// src/vlq.ts\nvar comma = \",\".charCodeAt(0);\nvar semicolon = \";\".charCodeAt(0);\nvar chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nvar intToChar = new Uint8Array(64);\nvar charToInt = new Uint8Array(128);\nfor (let i = 0; i < chars.length; i++) {\n const c = chars.charCodeAt(i);\n intToChar[i] = c;\n charToInt[c] = i;\n}\nfunction decodeInteger(reader) {\n let value = 0;\n let shift = 0;\n let integer = 0;\n do {\n const c = reader.next();\n integer = charToInt[c];\n value |= (integer & 31) << shift;\n shift += 5;\n } while (integer & 32);\n return value;\n}\nfunction decodeSign(num) {\n return num & 1 ? -2147483648 | -(num >>> 1) : num >>> 1;\n}\nfunction encodeInteger(builder, num) {\n do {\n let clamped = num & 31;\n num >>>= 5;\n if (num > 0) clamped |= 32;\n builder.write(intToChar[clamped]);\n } while (num > 0);\n}\nfunction encodeSign(num) {\n return num < 0 ? -num << 1 | 1 : num << 1;\n}\nfunction hasMoreVlq(reader, max) {\n if (reader.pos >= max) return false;\n return reader.peek() !== comma;\n}\n\n// src/strings.ts\nvar bufLength = 1024 * 16;\nvar td = typeof TextDecoder !== \"undefined\" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== \"undefined\" ? {\n decode(buf) {\n const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);\n return out.toString();\n }\n} : {\n decode(buf) {\n let out = \"\";\n for (let i = 0; i < buf.length; i++) {\n out += String.fromCharCode(buf[i]);\n }\n return out;\n }\n};\nvar StringWriter = class {\n constructor() {\n this.pos = 0;\n this.out = \"\";\n this.buffer = new Uint8Array(bufLength);\n }\n write(v) {\n const { buffer } = this;\n buffer[this.pos++] = v;\n if (this.pos === bufLength) {\n this.out += td.decode(buffer);\n this.pos = 0;\n }\n }\n flush() {\n const { buffer, out, pos } = this;\n return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;\n }\n};\nvar StringReader = class {\n constructor(buffer) {\n this.pos = 0;\n this.buffer = buffer;\n }\n next() {\n return this.buffer.charCodeAt(this.pos++);\n }\n peek() {\n return this.buffer.charCodeAt(this.pos);\n }\n indexOf(char) {\n const { buffer, pos } = this;\n const idx = buffer.indexOf(char, pos);\n return idx === -1 ? buffer.length : idx;\n }\n};\n\n// src/scopes.ts\nvar EMPTY = [];\nfunction decodeOriginalScopes(input) {\n const { length } = input;\n const reader = new StringReader(input);\n const scopes = [];\n const stack = [];\n let line = 0;\n for (; reader.pos < length; reader.pos++) {\n line += decodeSign(decodeInteger(reader));\n const column = decodeSign(decodeInteger(reader));\n if (!hasMoreVlq(reader, length)) {\n const last = stack.pop();\n last[2] = line;\n last[3] = column;\n continue;\n }\n const kind = decodeSign(decodeInteger(reader));\n const fields = decodeSign(decodeInteger(reader));\n const hasName = fields & 1;\n const scope = hasName ? [line, column, 0, 0, kind, decodeSign(decodeInteger(reader))] : [line, column, 0, 0, kind];\n let vars = EMPTY;\n if (hasMoreVlq(reader, length)) {\n vars = [];\n do {\n const varsIndex = decodeSign(decodeInteger(reader));\n vars.push(varsIndex);\n } while (hasMoreVlq(reader, length));\n }\n scope.vars = vars;\n scopes.push(scope);\n stack.push(scope);\n }\n return scopes;\n}\nfunction encodeOriginalScopes(scopes) {\n const writer = new StringWriter();\n for (let i = 0; i < scopes.length; ) {\n i = _encodeOriginalScopes(scopes, i, writer, [0]);\n }\n return writer.flush();\n}\nfunction _encodeOriginalScopes(scopes, index, writer, state) {\n const scope = scopes[index];\n const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;\n if (index > 0) writer.write(comma);\n encodeInteger(writer, encodeSign(startLine - state[0]));\n state[0] = startLine;\n encodeInteger(writer, encodeSign(startColumn));\n encodeInteger(writer, encodeSign(kind));\n const fields = scope.length === 6 ? 1 : 0;\n encodeInteger(writer, encodeSign(fields));\n if (scope.length === 6) encodeInteger(writer, encodeSign(scope[5]));\n for (const v of vars) {\n encodeInteger(writer, encodeSign(v));\n }\n for (index++; index < scopes.length; ) {\n const next = scopes[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || l === endLine && c >= endColumn) {\n break;\n }\n index = _encodeOriginalScopes(scopes, index, writer, state);\n }\n writer.write(comma);\n encodeInteger(writer, encodeSign(endLine - state[0]));\n state[0] = endLine;\n encodeInteger(writer, encodeSign(endColumn));\n return index;\n}\nfunction decodeGeneratedRanges(input) {\n const { length } = input;\n const reader = new StringReader(input);\n const ranges = [];\n const stack = [];\n let genLine = 0;\n let definitionSourcesIndex = 0;\n let definitionScopeIndex = 0;\n let callsiteSourcesIndex = 0;\n let callsiteLine = 0;\n let callsiteColumn = 0;\n let bindingLine = 0;\n let bindingColumn = 0;\n do {\n const semi = reader.indexOf(\";\");\n let genColumn = 0;\n for (; reader.pos < semi; reader.pos++) {\n genColumn += decodeSign(decodeInteger(reader));\n if (!hasMoreVlq(reader, semi)) {\n const last = stack.pop();\n last[2] = genLine;\n last[3] = genColumn;\n continue;\n }\n const fields = decodeSign(decodeInteger(reader));\n const hasDefinition = fields & 1;\n const hasCallsite = fields & 2;\n const hasScope = fields & 4;\n let callsite = null;\n let bindings = EMPTY;\n let range;\n if (hasDefinition) {\n const defSourcesIndex = definitionSourcesIndex + decodeSign(decodeInteger(reader));\n definitionScopeIndex = decodeSign(decodeInteger(reader)) + (definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0);\n definitionSourcesIndex = defSourcesIndex;\n range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex];\n } else {\n range = [genLine, genColumn, 0, 0];\n }\n range.isScope = !!hasScope;\n if (hasCallsite) {\n const prevCsi = callsiteSourcesIndex;\n const prevLine = callsiteLine;\n callsiteSourcesIndex += decodeSign(decodeInteger(reader));\n const sameSource = prevCsi === callsiteSourcesIndex;\n callsiteLine = (sameSource ? callsiteLine : 0) + decodeSign(decodeInteger(reader));\n callsiteColumn = (sameSource && prevLine === callsiteLine ? callsiteColumn : 0) + decodeSign(decodeInteger(reader));\n callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];\n }\n range.callsite = callsite;\n if (hasMoreVlq(reader, semi)) {\n bindings = [];\n do {\n bindingLine = genLine;\n bindingColumn = genColumn;\n const expressionsCount = decodeSign(decodeInteger(reader));\n let expressionRanges;\n if (expressionsCount < -1) {\n expressionRanges = [[decodeSign(decodeInteger(reader))]];\n for (let i = -1; i > expressionsCount; i--) {\n const prevBl = bindingLine;\n bindingLine += decodeSign(decodeInteger(reader));\n bindingColumn = (bindingLine === prevBl ? bindingColumn : 0) + decodeSign(decodeInteger(reader));\n const expression = decodeSign(decodeInteger(reader));\n expressionRanges.push([expression, bindingLine, bindingColumn]);\n }\n } else {\n expressionRanges = [[expressionsCount]];\n }\n bindings.push(expressionRanges);\n } while (hasMoreVlq(reader, semi));\n }\n range.bindings = bindings;\n ranges.push(range);\n stack.push(range);\n }\n genLine++;\n reader.pos = semi + 1;\n } while (reader.pos < length);\n return ranges;\n}\nfunction encodeGeneratedRanges(ranges) {\n if (ranges.length === 0) return \"\";\n const writer = new StringWriter();\n for (let i = 0; i < ranges.length; ) {\n i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);\n }\n return writer.flush();\n}\nfunction _encodeGeneratedRanges(ranges, index, writer, state) {\n const range = ranges[index];\n const {\n 0: startLine,\n 1: startColumn,\n 2: endLine,\n 3: endColumn,\n isScope,\n callsite,\n bindings\n } = range;\n if (state[0] < startLine) {\n catchupLine(writer, state[0], startLine);\n state[0] = startLine;\n state[1] = 0;\n } else if (index > 0) {\n writer.write(comma);\n }\n encodeInteger(writer, encodeSign(range[1] - state[1]));\n state[1] = range[1];\n const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0);\n encodeInteger(writer, encodeSign(fields));\n if (range.length === 6) {\n const { 4: sourcesIndex, 5: scopesIndex } = range;\n if (sourcesIndex !== state[2]) {\n state[3] = 0;\n }\n encodeInteger(writer, encodeSign(sourcesIndex - state[2]));\n state[2] = sourcesIndex;\n encodeInteger(writer, encodeSign(scopesIndex - state[3]));\n state[3] = scopesIndex;\n }\n if (callsite) {\n const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite;\n if (sourcesIndex !== state[4]) {\n state[5] = 0;\n state[6] = 0;\n } else if (callLine !== state[5]) {\n state[6] = 0;\n }\n encodeInteger(writer, encodeSign(sourcesIndex - state[4]));\n state[4] = sourcesIndex;\n encodeInteger(writer, encodeSign(callLine - state[5]));\n state[5] = callLine;\n encodeInteger(writer, encodeSign(callColumn - state[6]));\n state[6] = callColumn;\n }\n if (bindings) {\n for (const binding of bindings) {\n if (binding.length > 1) encodeInteger(writer, encodeSign(-binding.length));\n const expression = binding[0][0];\n encodeInteger(writer, encodeSign(expression));\n let bindingStartLine = startLine;\n let bindingStartColumn = startColumn;\n for (let i = 1; i < binding.length; i++) {\n const expRange = binding[i];\n encodeInteger(writer, encodeSign(expRange[1] - bindingStartLine));\n bindingStartLine = expRange[1];\n encodeInteger(writer, encodeSign(expRange[2] - bindingStartColumn));\n bindingStartColumn = expRange[2];\n encodeInteger(writer, encodeSign(expRange[0]));\n }\n }\n }\n for (index++; index < ranges.length; ) {\n const next = ranges[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || l === endLine && c >= endColumn) {\n break;\n }\n index = _encodeGeneratedRanges(ranges, index, writer, state);\n }\n if (state[0] < endLine) {\n catchupLine(writer, state[0], endLine);\n state[0] = endLine;\n state[1] = 0;\n } else {\n writer.write(comma);\n }\n encodeInteger(writer, encodeSign(endColumn - state[1]));\n state[1] = endColumn;\n return index;\n}\nfunction catchupLine(writer, lastLine, line) {\n do {\n writer.write(semicolon);\n } while (++lastLine < line);\n}\n\n// src/range-mappings.ts\nfunction decodeRangeMappings(input) {\n const { length } = input;\n const reader = new StringReader(input);\n const rangeMappings = [];\n do {\n const semi = reader.indexOf(\";\");\n const indices = [];\n let index = 0;\n while (reader.pos < semi) {\n index += decodeInteger(reader);\n indices.push(index);\n }\n rangeMappings.push(indices);\n reader.pos = semi + 1;\n } while (reader.pos <= length);\n return rangeMappings;\n}\nfunction encodeRangeMappings(decoded) {\n if (decoded.length === 0) return \"\";\n const writer = new StringWriter();\n for (let i = 0; i < decoded.length; i++) {\n const indices = decoded[i];\n if (i > 0) writer.write(semicolon);\n let index = 0;\n for (let j = 0; j < indices.length; j++) {\n const offset = indices[j];\n encodeInteger(writer, offset - index);\n index = offset;\n }\n }\n return writer.flush();\n}\n\n// src/sourcemap-codec.ts\nfunction decode(mappings) {\n const { length } = mappings;\n const reader = new StringReader(mappings);\n const decoded = [];\n let genColumn = 0;\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n do {\n const semi = reader.indexOf(\";\");\n const line = [];\n let sorted = true;\n let lastCol = 0;\n genColumn = 0;\n while (reader.pos < semi) {\n let seg;\n genColumn += decodeSign(decodeInteger(reader));\n if (genColumn < lastCol) sorted = false;\n lastCol = genColumn;\n if (hasMoreVlq(reader, semi)) {\n sourcesIndex += decodeSign(decodeInteger(reader));\n sourceLine += decodeSign(decodeInteger(reader));\n sourceColumn += decodeSign(decodeInteger(reader));\n if (hasMoreVlq(reader, semi)) {\n namesIndex += decodeSign(decodeInteger(reader));\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];\n } else {\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];\n }\n } else {\n seg = [genColumn];\n }\n line.push(seg);\n reader.pos++;\n }\n if (!sorted) sort(line);\n decoded.push(line);\n reader.pos = semi + 1;\n } while (reader.pos <= length);\n return decoded;\n}\nfunction sort(line) {\n line.sort(sortComparator);\n}\nfunction sortComparator(a, b) {\n return a[0] - b[0];\n}\nfunction encode(decoded) {\n const writer = new StringWriter();\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n if (i > 0) writer.write(semicolon);\n if (line.length === 0) continue;\n let genColumn = 0;\n for (let j = 0; j < line.length; j++) {\n const segment = line[j];\n if (j > 0) writer.write(comma);\n encodeInteger(writer, encodeSign(segment[0] - genColumn));\n genColumn = segment[0];\n if (segment.length === 1) continue;\n encodeInteger(writer, encodeSign(segment[1] - sourcesIndex));\n encodeInteger(writer, encodeSign(segment[2] - sourceLine));\n encodeInteger(writer, encodeSign(segment[3] - sourceColumn));\n sourcesIndex = segment[1];\n sourceLine = segment[2];\n sourceColumn = segment[3];\n if (segment.length === 4) continue;\n encodeInteger(writer, encodeSign(segment[4] - namesIndex));\n namesIndex = segment[4];\n }\n }\n return writer.flush();\n}\nexport {\n decode,\n decodeGeneratedRanges,\n decodeOriginalScopes,\n decodeRangeMappings,\n encode,\n encodeGeneratedRanges,\n encodeOriginalScopes,\n encodeRangeMappings\n};\n//# sourceMappingURL=sourcemap-codec.mjs.map\n","import { encode, encodeRangeMappings } from \"@jridgewell/sourcemap-codec\";\n//#region src/BitSet.ts\nvar BitSet = class BitSet {\n\tconstructor(arg) {\n\t\tthis.bits = arg instanceof BitSet ? arg.bits.slice() : [];\n\t}\n\tadd(n) {\n\t\tthis.bits[n >> 5] |= 1 << (n & 31);\n\t}\n\thas(n) {\n\t\treturn !!(this.bits[n >> 5] & 1 << (n & 31));\n\t}\n};\n//#endregion\n//#region src/Chunk.ts\nvar Chunk = class Chunk {\n\tconstructor(start, end, content) {\n\t\tthis.start = start;\n\t\tthis.end = end;\n\t\tthis.original = content;\n\t\tthis.intro = \"\";\n\t\tthis.outro = \"\";\n\t\tthis.content = content;\n\t\tthis.storeName = false;\n\t\tthis.edited = false;\n\t\tthis.previous = null;\n\t\tthis.next = null;\n\t}\n\tappendLeft(content) {\n\t\tthis.outro += content;\n\t}\n\tappendRight(content) {\n\t\tthis.intro = this.intro + content;\n\t}\n\tclone() {\n\t\tconst chunk = new Chunk(this.start, this.end, this.original);\n\t\tchunk.intro = this.intro;\n\t\tchunk.outro = this.outro;\n\t\tchunk.content = this.content;\n\t\tchunk.storeName = this.storeName;\n\t\tchunk.edited = this.edited;\n\t\treturn chunk;\n\t}\n\tcontains(index) {\n\t\treturn this.start < index && index < this.end;\n\t}\n\teachNext(fn) {\n\t\tfn(this);\n\t\tlet chunk = this.next;\n\t\twhile (chunk) {\n\t\t\tfn(chunk);\n\t\t\tchunk = chunk.next;\n\t\t}\n\t}\n\teachPrevious(fn) {\n\t\tfn(this);\n\t\tlet chunk = this.previous;\n\t\twhile (chunk) {\n\t\t\tfn(chunk);\n\t\t\tchunk = chunk.previous;\n\t\t}\n\t}\n\tedit(content, storeName, contentOnly) {\n\t\tthis.content = content;\n\t\tif (!contentOnly) {\n\t\t\tthis.intro = \"\";\n\t\t\tthis.outro = \"\";\n\t\t}\n\t\tthis.storeName = storeName;\n\t\tthis.edited = true;\n\t\treturn this;\n\t}\n\tprependLeft(content) {\n\t\tthis.outro = content + this.outro;\n\t}\n\tprependRight(content) {\n\t\tthis.intro = content + this.intro;\n\t}\n\treset() {\n\t\tthis.intro = \"\";\n\t\tthis.outro = \"\";\n\t\tif (this.edited) {\n\t\t\tthis.content = this.original;\n\t\t\tthis.storeName = false;\n\t\t\tthis.edited = false;\n\t\t}\n\t}\n\tsplit(index) {\n\t\tconst sliceIndex = index - this.start;\n\t\tconst originalBefore = this.original.slice(0, sliceIndex);\n\t\tconst originalAfter = this.original.slice(sliceIndex);\n\t\tthis.original = originalBefore;\n\t\tconst newChunk = new Chunk(index, this.end, originalAfter);\n\t\tnewChunk.outro = this.outro;\n\t\tthis.outro = \"\";\n\t\tthis.end = index;\n\t\tif (this.edited) {\n\t\t\tnewChunk.edit(\"\", false, true);\n\t\t\tthis.content = \"\";\n\t\t} else this.content = originalBefore;\n\t\tnewChunk.next = this.next;\n\t\tif (newChunk.next) newChunk.next.previous = newChunk;\n\t\tnewChunk.previous = this;\n\t\tthis.next = newChunk;\n\t\treturn newChunk;\n\t}\n\ttoString() {\n\t\treturn this.intro + this.content + this.outro;\n\t}\n\ttrimEnd(rx) {\n\t\tthis.outro = this.outro.replace(rx, \"\");\n\t\tif (this.outro.length) return true;\n\t\tconst trimmed = this.content.replace(rx, \"\");\n\t\tif (trimmed.length) {\n\t\t\tif (trimmed !== this.content) {\n\t\t\t\tif (this.edited) this.edit(trimmed, this.storeName, true);\n\t\t\t\telse this.split(this.start + trimmed.length).edit(\"\", void 0, true);\n\t\t\t}\n\t\t\treturn true;\n\t\t} else {\n\t\t\tthis.edit(\"\", void 0, true);\n\t\t\tthis.intro = this.intro.replace(rx, \"\");\n\t\t\tif (this.intro.length) return true;\n\t\t}\n\t}\n\ttrimStart(rx) {\n\t\tthis.intro = this.intro.replace(rx, \"\");\n\t\tif (this.intro.length) return true;\n\t\tconst trimmed = this.content.replace(rx, \"\");\n\t\tif (trimmed.length) {\n\t\t\tif (trimmed !== this.content) {\n\t\t\t\tif (this.edited) this.edit(trimmed, this.storeName, true);\n\t\t\t\telse {\n\t\t\t\t\tthis.split(this.end - trimmed.length);\n\t\t\t\t\tthis.edit(\"\", void 0, true);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t} else {\n\t\t\tthis.edit(\"\", void 0, true);\n\t\t\tthis.outro = this.outro.replace(rx, \"\");\n\t\t\tif (this.outro.length) return true;\n\t\t}\n\t}\n};\n//#endregion\n//#region src/MagicStringError.ts\n/**\n* The single error type thrown by MagicString.\n*\n* Every message is prefixed with `[MagicString]` so its source is obvious at a\n* glance, and is kept short and consistent in tone.\n*/\nvar MagicStringError = class extends Error {\n\tname = \"MagicStringError\";\n\tconstructor(message, options) {\n\t\tsuper(`[MagicString] ${message}`, options);\n\t}\n};\n//#endregion\n//#region src/SourceMap.ts\nfunction getBtoa() {\n\t/* v8 ignore next -- environment fallback, unreachable when `btoa` is present */\n\tif (typeof globalThis !== \"undefined\" && typeof globalThis.btoa === \"function\") return (str) => globalThis.btoa(unescape(encodeURIComponent(str)));\n\tconst buffer = globalThis[\"Buffer\"];\n\tif (buffer) return (str) => buffer.from(str, \"utf-8\").toString(\"base64\");\n\treturn () => {\n\t\tthrow new MagicStringError(\"unsupported environment: `btoa` or `Buffer` is required\");\n\t};\n\t/* v8 ignore stop */\n}\nconst btoa = /* #__PURE__ */ getBtoa();\nvar SourceMap = class {\n\tconstructor(properties) {\n\t\tthis.version = 3;\n\t\tthis.file = properties.file;\n\t\tthis.sources = properties.sources;\n\t\tthis.sourcesContent = properties.sourcesContent;\n\t\tthis.names = properties.names;\n\t\tthis.mappings = typeof properties.mappings === \"string\" ? properties.mappings : encode(properties.mappings);\n\t\tif (typeof properties.x_google_ignoreList !== \"undefined\") this.x_google_ignoreList = properties.x_google_ignoreList;\n\t\tif (typeof properties.debugId !== \"undefined\") this.debugId = properties.debugId;\n\t\tif (typeof properties.rangeMappings !== \"undefined\") {\n\t\t\tlet shouldOutputRangeMapping = false;\n\t\t\tfor (const line of properties.rangeMappings) if (line.length !== 0) {\n\t\t\t\tshouldOutputRangeMapping = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (shouldOutputRangeMapping) this.rangeMappings = encodeRangeMappings(properties.rangeMappings);\n\t\t}\n\t}\n\t/**\n\t* Returns the equivalent of `JSON.stringify(map)`\n\t*/\n\ttoString() {\n\t\treturn JSON.stringify(this);\n\t}\n\t/**\n\t* Returns a DataURI containing the sourcemap. Useful for doing this sort of thing:\n\t* `generateMap(options?: SourceMapOptions): SourceMap;`\n\t*/\n\ttoUrl() {\n\t\treturn `data:application/json;charset=utf-8;base64,${btoa(this.toString())}`;\n\t}\n};\n//#endregion\n//#region src/utils/getLocator.ts\nfunction getLocator(source) {\n\tconst lineOffsets = [0];\n\tfor (let i = source.indexOf(\"\\n\"); i !== -1; i = source.indexOf(\"\\n\", i + 1)) lineOffsets.push(i + 1);\n\treturn function locate(index) {\n\t\tlet i = 0;\n\t\tlet j = lineOffsets.length;\n\t\twhile (i < j) {\n\t\t\tconst m = i + j >> 1;\n\t\t\tif (index < lineOffsets[m]) j = m;\n\t\t\telse i = m + 1;\n\t\t}\n\t\tconst line = i - 1;\n\t\treturn {\n\t\t\tline,\n\t\t\tcolumn: index - lineOffsets[line]\n\t\t};\n\t};\n}\n//#endregion\n//#region src/utils/getRelativePath.ts\nfunction getRelativePath(from, to) {\n\tconst fromParts = from.split(/[/\\\\]/);\n\tconst toParts = to.split(/[/\\\\]/);\n\tfromParts.pop();\n\twhile (fromParts[0] === toParts[0]) {\n\t\tfromParts.shift();\n\t\ttoParts.shift();\n\t}\n\tif (fromParts.length) {\n\t\tlet i = fromParts.length;\n\t\twhile (i--) fromParts[i] = \"..\";\n\t}\n\treturn fromParts.concat(toParts).join(\"/\");\n}\n//#endregion\n//#region src/utils/guessIndent.ts\nfunction guessIndent(code) {\n\tconst lines = code.split(\"\\n\");\n\tconst tabbed = lines.filter((line) => /^\\t+/.test(line));\n\tconst spaced = lines.filter((line) => /^ {2,}/.test(line));\n\tif (tabbed.length === 0 && spaced.length === 0) return null;\n\tif (tabbed.length >= spaced.length) return \"\t\";\n\tconst min = spaced.reduce((previous, current) => {\n\t\tconst numSpaces = /^ +/.exec(current)[0].length;\n\t\treturn Math.min(numSpaces, previous);\n\t}, Infinity);\n\treturn \" \".repeat(min);\n}\n//#endregion\n//#region src/utils/isObject.ts\nconst toString = Object.prototype.toString;\nfunction isObject(thing) {\n\treturn toString.call(thing) === \"[object Object]\";\n}\nconst BASE64_CHARS = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nconst intToChar = /* #__PURE__ */ (() => {\n\tconst chars = /* @__PURE__ */ new Uint8Array(64);\n\tfor (let i = 0; i < 64; i++) chars[i] = BASE64_CHARS.charCodeAt(i);\n\treturn chars;\n})();\nconst COMMA = 44;\nconst SEMICOLON = 59;\nconst BUFFER_SIZE = 16384;\nconst FLUSH_THRESHOLD = 16348;\nconst scratch = /* #__PURE__ */ new Uint8Array(BUFFER_SIZE);\nfunction writeVlq(pos, num) {\n\tnum = num < 0 ? -num << 1 | 1 : num << 1;\n\tdo {\n\t\tlet clamped = num & 31;\n\t\tnum >>>= 5;\n\t\tif (num > 0) clamped |= 32;\n\t\tscratch[pos++] = intToChar[clamped];\n\t} while (num > 0);\n\treturn pos;\n}\nconst decoder = /* #__PURE__ */ new TextDecoder();\nvar MappingsEncoder = class {\n\tconstructor() {\n\t\tthis.out = \"\";\n\t\tthis.pos = 0;\n\t\tthis.lines = [];\n\t\tthis.buffered = 0;\n\t\tthis.needsComma = false;\n\t\tthis.prevGenColumn = 0;\n\t\tthis.prevSourceIndex = 0;\n\t\tthis.prevSourceLine = 0;\n\t\tthis.prevSourceColumn = 0;\n\t\tthis.prevNameIndex = 0;\n\t}\n\tendLine(segments) {\n\t\tthis.lines.push(segments);\n\t\tthis.buffered += segments.length + 1;\n\t\tif (this.buffered >= 4096) this.drain(null);\n\t}\n\tsegments(segments) {\n\t\tthis.drain(segments);\n\t}\n\tfinish(segments) {\n\t\tthis.drain(segments);\n\t\tthis.flush();\n\t\treturn this.out;\n\t}\n\tdrain(trailing) {\n\t\tconst lines = this.lines;\n\t\tconst lineCount = lines.length;\n\t\tfor (let l = 0; l <= lineCount; l++) {\n\t\t\tconst line = l < lineCount ? lines[l] : trailing;\n\t\t\tif (line === null) break;\n\t\t\tfor (let i = 0; i < line.length; i++) {\n\t\t\t\tif (this.pos > FLUSH_THRESHOLD) this.flush();\n\t\t\t\tconst segment = line[i];\n\t\t\t\tif (this.needsComma) scratch[this.pos++] = COMMA;\n\t\t\t\tthis.needsComma = true;\n\t\t\t\tthis.pos = writeVlq(this.pos, segment[0] - this.prevGenColumn);\n\t\t\t\tthis.prevGenColumn = segment[0];\n\t\t\t\tthis.pos = writeVlq(this.pos, segment[1] - this.prevSourceIndex);\n\t\t\t\tthis.prevSourceIndex = segment[1];\n\t\t\t\tthis.pos = writeVlq(this.pos, segment[2] - this.prevSourceLine);\n\t\t\t\tthis.prevSourceLine = segment[2];\n\t\t\t\tthis.pos = writeVlq(this.pos, segment[3] - this.prevSourceColumn);\n\t\t\t\tthis.prevSourceColumn = segment[3];\n\t\t\t\tif (segment.length === 5) {\n\t\t\t\t\tthis.pos = writeVlq(this.pos, segment[4] - this.prevNameIndex);\n\t\t\t\t\tthis.prevNameIndex = segment[4];\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (l < lineCount) {\n\t\t\t\tif (this.pos > FLUSH_THRESHOLD) this.flush();\n\t\t\t\tscratch[this.pos++] = SEMICOLON;\n\t\t\t\tthis.needsComma = false;\n\t\t\t\tthis.prevGenColumn = 0;\n\t\t\t}\n\t\t}\n\t\tlines.length = 0;\n\t\tthis.buffered = 0;\n\t\tthis.flush();\n\t}\n\tflush() {\n\t\tthis.out += decoder.decode(scratch.subarray(0, this.pos));\n\t\tthis.pos = 0;\n\t}\n};\n//#endregion\n//#region src/utils/Mappings.ts\nconst NEWLINE_CHAR$1 = 10;\nfunction isWordCode(code) {\n\treturn code >= 97 && code <= 122 || code >= 65 && code <= 90 || code >= 48 && code <= 57 || code === 95;\n}\nvar Mappings = class {\n\tconstructor(hires, encoder = null) {\n\t\tthis.hires = hires;\n\t\tthis.generatedCodeLine = 0;\n\t\tthis.generatedCodeColumn = 0;\n\t\tthis.raw = [];\n\t\tthis.rawSegments = this.raw[this.generatedCodeLine] = [];\n\t\tthis.rawRangeMappings = [];\n\t\tthis.rawRangeMappingsIndices = this.rawRangeMappings[this.generatedCodeLine] = [];\n\t\tthis.encoder = encoder;\n\t}\n\tnextLine() {\n\t\tif (this.encoder === null) {\n\t\t\tthis.generatedCodeLine += 1;\n\t\t\tthis.raw[this.generatedCodeLine] = this.rawSegments = [];\n\t\t} else {\n\t\t\tthis.encoder.endLine(this.rawSegments);\n\t\t\tthis.rawSegments = [];\n\t\t\tthis.generatedCodeLine += 1;\n\t\t}\n\t\tthis.generatedCodeColumn = 0;\n\t\tthis.rawRangeMappings[this.generatedCodeLine] = this.rawRangeMappingsIndices = [];\n\t}\n\taddEdit(sourceIndex, content, loc, nameIndex) {\n\t\tif (content.length) {\n\t\t\tconst contentLengthMinusOne = content.length - 1;\n\t\t\tlet contentLineEnd = content.indexOf(\"\\n\", 0);\n\t\t\tlet previousContentLineEnd = -1;\n\t\t\twhile (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {\n\t\t\t\tconst segment = [\n\t\t\t\t\tthis.generatedCodeColumn,\n\t\t\t\t\tsourceIndex,\n\t\t\t\t\tloc.line,\n\t\t\t\t\tloc.column\n\t\t\t\t];\n\t\t\t\tif (nameIndex >= 0) segment.push(nameIndex);\n\t\t\t\tthis.rawSegments.push(segment);\n\t\t\t\tthis.nextLine();\n\t\t\t\tpreviousContentLineEnd = contentLineEnd;\n\t\t\t\tcontentLineEnd = content.indexOf(\"\\n\", contentLineEnd + 1);\n\t\t\t}\n\t\t\tconst segment = [\n\t\t\t\tthis.generatedCodeColumn,\n\t\t\t\tsourceIndex,\n\t\t\t\tloc.line,\n\t\t\t\tloc.column\n\t\t\t];\n\t\t\tif (nameIndex >= 0) segment.push(nameIndex);\n\t\t\tthis.rawSegments.push(segment);\n\t\t\tthis.advance(content.slice(previousContentLineEnd + 1));\n\t\t}\n\t}\n\taddUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {\n\t\tconst end = chunk.end;\n\t\tlet i = chunk.start;\n\t\tif (this.hires) {\n\t\t\tconst boundary = this.hires === \"boundary\";\n\t\t\tconst experimentalRange = this.hires === \"experimental-range\";\n\t\t\tconst encoder = experimentalRange ? null : this.encoder;\n\t\t\tlet charInHiresBoundary = false;\n\t\t\twhile (i < end) {\n\t\t\t\tif (encoder !== null && this.rawSegments.length >= 4096) {\n\t\t\t\t\tencoder.segments(this.rawSegments);\n\t\t\t\t\tthis.rawSegments.length = 0;\n\t\t\t\t}\n\t\t\t\tif (experimentalRange && i + 1 >= end) this.rawSegments.push([\n\t\t\t\t\tthis.generatedCodeColumn,\n\t\t\t\t\tsourceIndex,\n\t\t\t\t\tloc.line,\n\t\t\t\t\tloc.column\n\t\t\t\t]);\n\t\t\t\tconst code = original.charCodeAt(i);\n\t\t\t\tif (code === NEWLINE_CHAR$1) {\n\t\t\t\t\tloc.line += 1;\n\t\t\t\t\tloc.column = 0;\n\t\t\t\t\tthis.nextLine();\n\t\t\t\t\tcharInHiresBoundary = false;\n\t\t\t\t} else {\n\t\t\t\t\tif (boundary) {\n\t\t\t\t\t\tif (isWordCode(code)) {\n\t\t\t\t\t\t\tif (!charInHiresBoundary) {\n\t\t\t\t\t\t\t\tthis.rawSegments.push([\n\t\t\t\t\t\t\t\t\tthis.generatedCodeColumn,\n\t\t\t\t\t\t\t\t\tsourceIndex,\n\t\t\t\t\t\t\t\t\tloc.line,\n\t\t\t\t\t\t\t\t\tloc.column\n\t\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\t\tcharInHiresBoundary = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.rawSegments.push([\n\t\t\t\t\t\t\t\tthis.generatedCodeColumn,\n\t\t\t\t\t\t\t\tsourceIndex,\n\t\t\t\t\t\t\t\tloc.line,\n\t\t\t\t\t\t\t\tloc.column\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\tcharInHiresBoundary = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (experimentalRange) {\n\t\t\t\t\t\tif (i === chunk.start) {\n\t\t\t\t\t\t\tthis.rawRangeMappingsIndices.push(this.rawSegments.length);\n\t\t\t\t\t\t\tthis.rawSegments.push([\n\t\t\t\t\t\t\t\tthis.generatedCodeColumn,\n\t\t\t\t\t\t\t\tsourceIndex,\n\t\t\t\t\t\t\t\tloc.line,\n\t\t\t\t\t\t\t\tloc.column\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else this.rawSegments.push([\n\t\t\t\t\t\tthis.generatedCodeColumn,\n\t\t\t\t\t\tsourceIndex,\n\t\t\t\t\t\tloc.line,\n\t\t\t\t\t\tloc.column\n\t\t\t\t\t]);\n\t\t\t\t\tloc.column += 1;\n\t\t\t\t\tthis.generatedCodeColumn += 1;\n\t\t\t\t}\n\t\t\t\ti += 1;\n\t\t\t}\n\t\t} else {\n\t\t\tconst bits = sourcemapLocations.bits;\n\t\t\twhile (i < end) {\n\t\t\t\tlet newline = original.indexOf(\"\\n\", i);\n\t\t\t\tif (newline === -1 || newline > end) newline = end;\n\t\t\t\tif (newline > i) {\n\t\t\t\t\tthis.rawSegments.push([\n\t\t\t\t\t\tthis.generatedCodeColumn,\n\t\t\t\t\t\tsourceIndex,\n\t\t\t\t\t\tloc.line,\n\t\t\t\t\t\tloc.column\n\t\t\t\t\t]);\n\t\t\t\t\tfor (let w = i + 1 >> 5, last = newline - 1 >> 5; w <= last; w++) {\n\t\t\t\t\t\tlet word = bits[w];\n\t\t\t\t\t\tif (!word) continue;\n\t\t\t\t\t\tconst base = w << 5;\n\t\t\t\t\t\twhile (word) {\n\t\t\t\t\t\t\tconst lowest = word & -word;\n\t\t\t\t\t\t\tconst index = base + 31 - Math.clz32(lowest);\n\t\t\t\t\t\t\tif (index > i && index < newline) {\n\t\t\t\t\t\t\t\tconst offset = index - i;\n\t\t\t\t\t\t\t\tthis.rawSegments.push([\n\t\t\t\t\t\t\t\t\tthis.generatedCodeColumn + offset,\n\t\t\t\t\t\t\t\t\tsourceIndex,\n\t\t\t\t\t\t\t\t\tloc.line,\n\t\t\t\t\t\t\t\t\tloc.column + offset\n\t\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tword ^= lowest;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tloc.column += newline - i;\n\t\t\t\t\tthis.generatedCodeColumn += newline - i;\n\t\t\t\t}\n\t\t\t\tif (newline === end) break;\n\t\t\t\tloc.line += 1;\n\t\t\t\tloc.column = 0;\n\t\t\t\tthis.nextLine();\n\t\t\t\ti = newline + 1;\n\t\t\t}\n\t\t}\n\t}\n\tadvance(str) {\n\t\tif (!str) return;\n\t\tconst lastNewline = str.lastIndexOf(\"\\n\");\n\t\tfor (let i = str.indexOf(\"\\n\"); i !== -1; i = str.indexOf(\"\\n\", i + 1)) this.nextLine();\n\t\tthis.generatedCodeColumn += str.length - lastNewline - 1;\n\t}\n};\n//#endregion\n//#region src/MagicString.ts\nconst n = \"\\n\";\nconst NEWLINE_CHAR = \"\\n\".charCodeAt(0);\nconst CR_CHAR = \"\\r\".charCodeAt(0);\nconst warned = {\n\tinsertLeft: false,\n\tinsertRight: false,\n\tstoreName: false\n};\n/**\n* Expands the `$` substitution patterns that `String.prototype.replace` accepts\n* in a string replacement.\n* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter\n*\n* `captures` holds the capture groups in order, so `captures[0]` is `$1`.\n* `namedCaptures` is `undefined` when the pattern has no named groups, and\n* `$<name>` is then literal text - which is also the case for a string search\n* value, where there are no groups of either kind.\n*/\nfunction expandReplacement(replacement, matched, position, str, captures, namedCaptures) {\n\tif (!replacement.includes(\"$\")) return replacement;\n\tlet result = \"\";\n\tlet index = 0;\n\twhile (index < replacement.length) {\n\t\tconst dollar = replacement.indexOf(\"$\", index);\n\t\tif (dollar === -1) {\n\t\t\tresult += replacement.slice(index);\n\t\t\tbreak;\n\t\t}\n\t\tresult += replacement.slice(index, dollar);\n\t\tconst char = replacement[dollar + 1];\n\t\tlet expansion = \"$\";\n\t\tlet consumed = 1;\n\t\tif (char === \"$\") consumed = 2;\n\t\telse if (char === \"&\") {\n\t\t\texpansion = matched;\n\t\t\tconsumed = 2;\n\t\t} else if (char === \"`\") {\n\t\t\texpansion = str.slice(0, position);\n\t\t\tconsumed = 2;\n\t\t} else if (char === \"'\") {\n\t\t\texpansion = str.slice(position + matched.length);\n\t\t\tconsumed = 2;\n\t\t} else if (char === \"<\" && namedCaptures !== void 0) {\n\t\t\tconst close = replacement.indexOf(\">\", dollar + 2);\n\t\t\tif (close !== -1) {\n\t\t\t\texpansion = namedCaptures[replacement.slice(dollar + 2, close)] ?? \"\";\n\t\t\t\tconsumed = close + 1 - dollar;\n\t\t\t}\n\t\t} else if (char >= \"0\" && char <= \"9\") {\n\t\t\tconst second = replacement[dollar + 2];\n\t\t\tconst double = second >= \"0\" && second <= \"9\" ? Number(char + second) : NaN;\n\t\t\tconst single = Number(char);\n\t\t\tif (double >= 1 && double <= captures.length) {\n\t\t\t\texpansion = captures[double - 1] ?? \"\";\n\t\t\t\tconsumed = 3;\n\t\t\t} else if (single >= 1 && single <= captures.length) {\n\t\t\t\texpansion = captures[single - 1] ?? \"\";\n\t\t\t\tconsumed = 2;\n\t\t\t}\n\t\t}\n\t\tresult += expansion;\n\t\tindex = dollar + consumed;\n\t}\n\treturn result;\n}\nvar MagicString = class MagicString {\n\tconstructor(string, options = {}) {\n\t\tconst chunk = new Chunk(0, string.length, string);\n\t\tObject.defineProperties(this, {\n\t\t\toriginal: {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: string\n\t\t\t},\n\t\t\toutro: {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: \"\"\n\t\t\t},\n\t\t\tintro: {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: \"\"\n\t\t\t},\n\t\t\tfirstChunk: {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: chunk\n\t\t\t},\n\t\t\tlastChunk: {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: chunk\n\t\t\t},\n\t\t\tlastSearchedChunk: {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: chunk\n\t\t\t},\n\t\t\tbyStart: {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: /* @__PURE__ */ new Map([[0, chunk]])\n\t\t\t},\n\t\t\tbyEnd: {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: /* @__PURE__ */ new Map([[string.length, chunk]])\n\t\t\t},\n\t\t\tfilename: {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: options.filename\n\t\t\t},\n\t\t\tindentExclusionRanges: {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: options.indentExclusionRanges\n\t\t\t},\n\t\t\tsourcemapLocations: {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: new BitSet()\n\t\t\t},\n\t\t\tstoredNames: {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: {}\n\t\t\t},\n\t\t\tindentStr: {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: void 0\n\t\t\t},\n\t\t\tignoreList: {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: options.ignoreList\n\t\t\t},\n\t\t\toffset: {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: options.offset || 0\n\t\t\t},\n\t\t\thasMovedChunks: {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: false\n\t\t\t}\n\t\t});\n\t}\n\t/**\n\t* Adds the specified character index (with respect to the original string) to sourcemap mappings, if `hires` is false.\n\t*/\n\taddSourcemapLocation(char) {\n\t\tthis.sourcemapLocations.add(char);\n\t}\n\t/**\n\t* Appends the specified content to the end of the string.\n\t*/\n\tappend(content) {\n\t\tif (typeof content !== \"string\") throw new MagicStringError(`content must be a string, got ${typeof content}`);\n\t\tthis.outro += content;\n\t\treturn this;\n\t}\n\t/**\n\t* Appends the specified content at the index in the original string.\n\t* If a range *ending* with index is subsequently moved, the insert will be moved with it.\n\t* See also `s.prependLeft(...)`.\n\t*/\n\tappendLeft(index, content) {\n\t\tindex = index + this.offset;\n\t\tif (typeof content !== \"string\") throw new MagicStringError(`content must be a string, got ${typeof content}`);\n\t\tthis._split(index);\n\t\tconst chunk = this.byEnd.get(index);\n\t\tif (chunk) chunk.appendLeft(content);\n\t\telse this.intro += content;\n\t\treturn this;\n\t}\n\t/**\n\t* Appends the specified content at the index in the original string.\n\t* If a range *starting* with index is subsequently moved, the insert will be moved with it.\n\t* See also `s.prependRight(...)`.\n\t*/\n\tappendRight(index, content) {\n\t\tindex = index + this.offset;\n\t\tif (typeof content !== \"string\") throw new MagicStringError(`content must be a string, got ${typeof content}`);\n\t\tthis._split(index);\n\t\tconst chunk = this.byStart.get(index);\n\t\tif (chunk) chunk.appendRight(content);\n\t\telse this.outro += content;\n\t\treturn this;\n\t}\n\t/**\n\t* Does what you'd expect.\n\t*/\n\tclone() {\n\t\tconst cloned = new MagicString(this.original, {\n\t\t\tfilename: this.filename,\n\t\t\tignoreList: this.ignoreList,\n\t\t\toffset: this.offset\n\t\t});\n\t\tlet originalChunk = this.firstChunk;\n\t\tlet clonedChunk = cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone();\n\t\twhile (originalChunk) {\n\t\t\tcloned.byStart.set(clonedChunk.start, clonedChunk);\n\t\t\tcloned.byEnd.set(clonedChunk.end, clonedChunk);\n\t\t\tconst nextOriginalChunk = originalChunk.next;\n\t\t\tconst nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();\n\t\t\tif (nextClonedChunk) {\n\t\t\t\tclonedChunk.next = nextClonedChunk;\n\t\t\t\tnextClonedChunk.previous = clonedChunk;\n\t\t\t\tclonedChunk = nextClonedChunk;\n\t\t\t}\n\t\t\toriginalChunk = nextOriginalChunk;\n\t\t}\n\t\tcloned.lastChunk = clonedChunk;\n\t\tif (this.indentExclusionRanges) cloned.indentExclusionRanges = this.indentExclusionRanges.slice();\n\t\tcloned.sourcemapLocations = new BitSet(this.sourcemapLocations);\n\t\tcloned.storedNames = { ...this.storedNames };\n\t\tcloned.intro = this.intro;\n\t\tcloned.outro = this.outro;\n\t\tcloned.hasMovedChunks = this.hasMovedChunks;\n\t\treturn cloned;\n\t}\n\t/**\n\t* Generates a sourcemap object with raw mappings in array form, rather than encoded as a string.\n\t* Useful if you need to manipulate the sourcemap further, but most of the time you will use `generateMap` instead.\n\t*/\n\tgenerateDecodedMap(options) {\n\t\toptions = options || {};\n\t\tconst mappings = new Mappings(options.hires);\n\t\tconst names = this._generateMappings(mappings);\n\t\treturn {\n\t\t\t...this._mapProperties(options, names),\n\t\t\tmappings: mappings.raw,\n\t\t\trangeMappings: mappings.rawRangeMappings\n\t\t};\n\t}\n\t/**\n\t* Generates a version 3 sourcemap.\n\t*/\n\tgenerateMap(options) {\n\t\toptions = options || {};\n\t\tconst encoder = new MappingsEncoder();\n\t\tconst mappings = new Mappings(options.hires, encoder);\n\t\tconst names = this._generateMappings(mappings);\n\t\treturn new SourceMap({\n\t\t\t...this._mapProperties(options, names),\n\t\t\tmappings: encoder.finish(mappings.rawSegments),\n\t\t\trangeMappings: mappings.rawRangeMappings\n\t\t});\n\t}\n\t/** @internal */\n\t_generateMappings(mappings) {\n\t\tconst sourceIndex = 0;\n\t\tconst names = Object.keys(this.storedNames);\n\t\tconst locate = getLocator(this.original);\n\t\tif (this.intro) mappings.advance(this.intro);\n\t\tthis.firstChunk.eachNext((chunk) => {\n\t\t\tconst loc = locate(chunk.start);\n\t\t\tif (chunk.intro.length) mappings.advance(chunk.intro);\n\t\t\tif (chunk.edited) mappings.addEdit(sourceIndex, chunk.content, loc, chunk.storeName ? names.indexOf(chunk.original) : -1);\n\t\t\telse mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);\n\t\t\tif (chunk.outro.length) mappings.advance(chunk.outro);\n\t\t});\n\t\tif (this.outro) mappings.advance(this.outro);\n\t\treturn names;\n\t}\n\t/** @internal */\n\t_mapProperties(options, names) {\n\t\treturn {\n\t\t\tfile: options.file ? options.file.split(/[/\\\\]/).pop() : void 0,\n\t\t\tsources: [options.source ? getRelativePath(options.file || \"\", options.source) : options.file || \"\"],\n\t\t\tsourcesContent: options.includeContent ? [this.original] : void 0,\n\t\t\tnames,\n\t\t\tx_google_ignoreList: this.ignoreList ? [0] : void 0\n\t\t};\n\t}\n\t/** @internal */\n\t_ensureindentStr() {\n\t\tif (this.indentStr === void 0) this.indentStr = guessIndent(this.original);\n\t}\n\t/** @internal */\n\t_getRawIndentString() {\n\t\tthis._ensureindentStr();\n\t\treturn this.indentStr;\n\t}\n\tgetIndentString() {\n\t\tthis._ensureindentStr();\n\t\treturn this.indentStr === null ? \"\t\" : this.indentStr;\n\t}\n\tindent(indentStr, options) {\n\t\tconst pattern = /^[^\\r\\n]/gm;\n\t\tif (isObject(indentStr)) {\n\t\t\toptions = indentStr;\n\t\t\tindentStr = void 0;\n\t\t}\n\t\tif (indentStr === void 0) {\n\t\t\tthis._ensureindentStr();\n\t\t\tindentStr = this.indentStr || \"\t\";\n\t\t}\n\t\tif (indentStr === \"\") return this;\n\t\tconst resolvedIndentStr = indentStr;\n\t\toptions = options || {};\n\t\tconst isExcluded = {};\n\t\tif (options.exclude) (typeof options.exclude[0] === \"number\" ? [options.exclude] : options.exclude).forEach((exclusion) => {\n\t\t\tfor (let i = exclusion[0]; i < exclusion[1]; i += 1) isExcluded[i] = true;\n\t\t});\n\t\tlet shouldIndentNextCharacter = options.indentStart !== false;\n\t\tconst indentPiece = (str) => {\n\t\t\tif (str === \"\") return str;\n\t\t\tconst indented = str.replace(pattern, (match, offset) => offset > 0 || shouldIndentNextCharacter ? `${resolvedIndentStr}${match}` : match);\n\t\t\tshouldIndentNextCharacter = str[str.length - 1] === \"\\n\";\n\t\t\treturn indented;\n\t\t};\n\t\tthis.intro = indentPiece(this.intro);\n\t\tlet charIndex = 0;\n\t\tlet chunk = this.firstChunk;\n\t\tconst indentAt = (index) => {\n\t\t\tshouldIndentNextCharacter = false;\n\t\t\tif (index === chunk.start) chunk.appendRight(resolvedIndentStr);\n\t\t\telse {\n\t\t\t\tthis._splitChunk(chunk, index);\n\t\t\t\tchunk = chunk.next;\n\t\t\t\tchunk.prependRight(resolvedIndentStr);\n\t\t\t}\n\t\t};\n\t\twhile (chunk) {\n\t\t\tconst end = chunk.end;\n\t\t\tif (!isExcluded[chunk.start]) chunk.intro = indentPiece(chunk.intro);\n\t\t\tif (chunk.edited) {\n\t\t\t\tif (!isExcluded[charIndex]) chunk.content = indentPiece(chunk.content);\n\t\t\t} else if (options.exclude) {\n\t\t\t\tcharIndex = chunk.start;\n\t\t\t\twhile (charIndex < end) {\n\t\t\t\t\tif (!isExcluded[charIndex]) {\n\t\t\t\t\t\tconst char = this.original.charCodeAt(charIndex);\n\t\t\t\t\t\tif (char === NEWLINE_CHAR) shouldIndentNextCharacter = true;\n\t\t\t\t\t\telse if (char !== CR_CHAR && shouldIndentNextCharacter) indentAt(charIndex);\n\t\t\t\t\t}\n\t\t\t\t\tcharIndex += 1;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcharIndex = chunk.start;\n\t\t\t\twhile (charIndex < end) {\n\t\t\t\t\tif (!shouldIndentNextCharacter) {\n\t\t\t\t\t\tconst nextLine = this.original.indexOf(n, charIndex);\n\t\t\t\t\t\tif (nextLine === -1 || nextLine >= end) break;\n\t\t\t\t\t\tshouldIndentNextCharacter = true;\n\t\t\t\t\t\tcharIndex = nextLine + 1;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst char = this.original.charCodeAt(charIndex);\n\t\t\t\t\tif (char === NEWLINE_CHAR || char === CR_CHAR) {\n\t\t\t\t\t\tcharIndex += 1;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tindentAt(charIndex);\n\t\t\t\t\tcharIndex += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!isExcluded[chunk.end - 1]) chunk.outro = indentPiece(chunk.outro);\n\t\t\tcharIndex = chunk.end;\n\t\t\tchunk = chunk.next;\n\t\t}\n\t\tthis.outro = indentPiece(this.outro);\n\t\treturn this;\n\t}\n\t/** @internal */\n\tinsert() {\n\t\tthrow new MagicStringError(\"insert() is deprecated, use appendLeft() or prependRight()\");\n\t}\n\t/** @internal */\n\tinsertLeft(index, content) {\n\t\tif (!warned.insertLeft) {\n\t\t\tconsole.warn(\"magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead\");\n\t\t\twarned.insertLeft = true;\n\t\t}\n\t\treturn this.appendLeft(index, content);\n\t}\n\t/** @internal */\n\tinsertRight(index, content) {\n\t\tif (!warned.insertRight) {\n\t\t\tconsole.warn(\"magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead\");\n\t\t\twarned.insertRight = true;\n\t\t}\n\t\treturn this.prependRight(index, content);\n\t}\n\t/**\n\t* Moves the characters from `start` and `end` to `index`.\n\t*\n\t* `affinity` controls where the range is anchored at `index`. With the\n\t* default `'right'`, it is inserted before the content that starts at `index`;\n\t* with `'left'`, it is inserted after the content that ends at `index`. The\n\t* two differ only when other content has already been moved to that boundary,\n\t* mirroring the `appendLeft`/`appendRight` distinction.\n\t*/\n\tmove(start, end, index, affinity = \"right\") {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\t\tindex = index + this.offset;\n\t\tif (start === end) return this;\n\t\tif (index >= start && index <= end) throw new MagicStringError(\"cannot move a selection inside itself\");\n\t\tthis._split(start);\n\t\tthis._split(end);\n\t\tthis._split(index);\n\t\tconst first = this.byStart.get(start);\n\t\tconst last = this.byEnd.get(end);\n\t\tif (this.hasMovedChunks) {\n\t\t\tlet cursor = first;\n\t\t\twhile (cursor !== last) {\n\t\t\t\tcursor = cursor.next;\n\t\t\t\tif (!cursor || cursor.start < start || cursor.end > end) throw new MagicStringError(`cannot move ${start} to ${end} because an earlier move split that range`);\n\t\t\t}\n\t\t}\n\t\tconst oldLeft = first.previous;\n\t\tconst oldRight = last.next;\n\t\tlet newLeft;\n\t\tlet newRight;\n\t\tif (affinity === \"left\") {\n\t\t\tnewLeft = this.byEnd.get(index) ?? null;\n\t\t\tif (!newLeft) {\n\t\t\t\tif (first === this.firstChunk) return this;\n\t\t\t\tnewRight = this.firstChunk;\n\t\t\t} else {\n\t\t\t\tif (newLeft.next === first) return this;\n\t\t\t\tnewRight = newLeft.next;\n\t\t\t}\n\t\t} else {\n\t\t\tnewRight = this.byStart.get(index) ?? null;\n\t\t\tif (!newRight) {\n\t\t\t\tif (last === this.lastChunk) return this;\n\t\t\t\tnewLeft = this.lastChunk;\n\t\t\t} else {\n\t\t\t\tif (newRight.previous === last) return this;\n\t\t\t\tnewLeft = newRight.previous;\n\t\t\t}\n\t\t}\n\t\tif (oldLeft) oldLeft.next = oldRight;\n\t\tif (oldRight) oldRight.previous = oldLeft;\n\t\tif (newLeft) newLeft.next = first;\n\t\tif (newRight) newRight.previous = last;\n\t\tif (!first.previous) this.firstChunk = last.next;\n\t\tif (!last.next) {\n\t\t\tthis.lastChunk = first.previous;\n\t\t\tthis.lastChunk.next = null;\n\t\t}\n\t\tfirst.previous = newLeft;\n\t\tlast.next = newRight || null;\n\t\tif (!newLeft) this.firstChunk = first;\n\t\tif (!newRight) this.lastChunk = last;\n\t\tthis.hasMovedChunks = true;\n\t\treturn this;\n\t}\n\t/**\n\t* Replaces the characters from `start` to `end` with `content`, along with the appended/prepended content in\n\t* that range. The same restrictions as `s.remove()` apply.\n\t*\n\t* The fourth argument is optional. It can have a storeName property - if true, the original name will be stored\n\t* for later inclusion in a sourcemap's names array - and a contentOnly property which determines whether only\n\t* the content is overwritten, or anything that was appended/prepended to the range as well.\n\t*\n\t* It may be preferred to use `s.update(...)` instead if you wish to avoid overwriting the appended/prepended content.\n\t*/\n\toverwrite(start, end, content, options) {\n\t\tconst optionObject = typeof options === \"object\" && options ? options : {};\n\t\treturn this.update(start, end, content, {\n\t\t\t...optionObject,\n\t\t\toverwrite: !optionObject.contentOnly\n\t\t});\n\t}\n\t/**\n\t* Replaces the characters from `start` to `end` with `content`. The same restrictions as `s.remove()` apply.\n\t*\n\t* The fourth argument is optional. It can have a storeName property - if true, the original name will be stored\n\t* for later inclusion in a sourcemap's names array - and an overwrite property which determines whether only\n\t* the content is overwritten, or anything that was appended/prepended to the range as well.\n\t*/\n\tupdate(start, end, content, options) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\t\tif (typeof content !== \"string\") throw new MagicStringError(`content must be a string, got ${typeof content}`);\n\t\tif (this.original.length !== 0) {\n\t\t\tif (start < 0) start = Math.max(0, start + this.original.length);\n\t\t\tif (end < 0) end = Math.max(0, end + this.original.length);\n\t\t}\n\t\tif (start < 0) throw new MagicStringError(`start ${start} is out of bounds`);\n\t\tif (end > this.original.length) throw new MagicStringError(`end ${end} is out of bounds`);\n\t\tif (start === end) throw new MagicStringError(`cannot overwrite a zero-length range at ${start}, use appendLeft() or prependRight()`);\n\t\tif (start > end) throw new MagicStringError(`end must be greater than start (start: ${start}, end: ${end})`);\n\t\tthis._split(start);\n\t\tthis._split(end);\n\t\tif (options === true) {\n\t\t\tif (!warned.storeName) {\n\t\t\t\tconsole.warn(\"The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string\");\n\t\t\t\twarned.storeName = true;\n\t\t\t}\n\t\t\toptions = { storeName: true };\n\t\t}\n\t\tconst optionObject = typeof options === \"object\" && options ? options : {};\n\t\tconst storeName = optionObject.storeName || false;\n\t\tconst overwrite = optionObject.overwrite || false;\n\t\tif (storeName) {\n\t\t\tconst original = this.original.slice(start, end);\n\t\t\tObject.defineProperty(this.storedNames, original, {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: true,\n\t\t\t\tenumerable: true\n\t\t\t});\n\t\t}\n\t\tconst first = this.byStart.get(start);\n\t\tconst last = this.byEnd.get(end);\n\t\t/* v8 ignore else -- unreachable: a valid start/end always yields a `first` chunk */\n\t\tif (first) {\n\t\t\tlet chunk = first;\n\t\t\twhile (chunk !== last) {\n\t\t\t\tif (chunk.next !== this.byStart.get(chunk.end)) throw new MagicStringError(\"cannot overwrite across a split point\");\n\t\t\t\tchunk = chunk.next;\n\t\t\t\tchunk.edit(\"\", false);\n\t\t\t}\n\t\t\tfirst.edit(content, storeName, !overwrite);\n\t\t} else {\n\t\t\tconst newChunk = new Chunk(start, end, \"\").edit(content, storeName);\n\t\t\tlast.next = newChunk;\n\t\t\tnewChunk.previous = last;\n\t\t}\n\t\treturn this;\n\t}\n\t/**\n\t* Prepends the string with the specified content.\n\t*/\n\tprepend(content) {\n\t\tif (typeof content !== \"string\") throw new MagicStringError(`content must be a string, got ${typeof content}`);\n\t\tthis.intro = content + this.intro;\n\t\treturn this;\n\t}\n\t/**\n\t* Same as `s.appendLeft(...)`, except that the inserted content will go *before* any previous appends or prepends at index\n\t*/\n\tprependLeft(index, content) {\n\t\tindex = index + this.offset;\n\t\tif (typeof content !== \"string\") throw new MagicStringError(`content must be a string, got ${typeof content}`);\n\t\tthis._split(index);\n\t\tconst chunk = this.byEnd.get(index);\n\t\tif (chunk) chunk.prependLeft(content);\n\t\telse this.intro = content + this.intro;\n\t\treturn this;\n\t}\n\t/**\n\t* Same as `s.appendRight(...)`, except that the inserted content will go *before* any previous appends or prepends at `index`\n\t*/\n\tprependRight(index, content) {\n\t\tindex = index + this.offset;\n\t\tif (typeof content !== \"string\") throw new MagicStringError(`content must be a string, got ${typeof content}`);\n\t\tthis._split(index);\n\t\tconst chunk = this.byStart.get(index);\n\t\tif (chunk) chunk.prependRight(content);\n\t\telse this.outro = content + this.outro;\n\t\treturn this;\n\t}\n\t/**\n\t* Removes the characters from `start` to `end` (of the original string, **not** the generated string).\n\t* Content appended or prepended at positions strictly inside the range is removed with it, while\n\t* content attached at `start` or `end` is preserved — use `s.overwrite(start, end, '')` to remove\n\t* the range including its edge inserts.\n\t* Repeated removals and removals with partially overlapping ranges are allowed.\n\t*/\n\tremove(start, end) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\t\tif (this.original.length !== 0) {\n\t\t\tif (start < 0) start = Math.max(0, start + this.original.length);\n\t\t\tif (end < 0) end = Math.max(0, end + this.original.length);\n\t\t}\n\t\tif (start === end) return this;\n\t\tif (start < 0 || end > this.original.length) throw new MagicStringError(`range ${start}–${end} is out of bounds`);\n\t\tif (start > end) throw new MagicStringError(`end must be greater than start (start: ${start}, end: ${end})`);\n\t\tthis._split(start);\n\t\tthis._split(end);\n\t\tlet chunk = this.byStart.get(start);\n\t\twhile (chunk) {\n\t\t\tif (chunk.start > start) chunk.intro = \"\";\n\t\t\tif (chunk.end < end) chunk.outro = \"\";\n\t\t\tchunk.edit(\"\", false, true);\n\t\t\tchunk = end > chunk.end ? this.byStart.get(chunk.end) : null;\n\t\t}\n\t\treturn this;\n\t}\n\t/**\n\t* Reset the modified characters from `start` to `end` (of the original string, **not** the generated string).\n\t*/\n\treset(start, end) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\t\tif (this.original.length !== 0) {\n\t\t\tif (start < 0) start = Math.max(0, start + this.original.length);\n\t\t\tif (end < 0) end = Math.max(0, end + this.original.length);\n\t\t}\n\t\tif (start === end) return this;\n\t\tif (start < 0 || end > this.original.length) throw new MagicStringError(`range ${start}–${end} is out of bounds`);\n\t\tif (start > end) throw new MagicStringError(`end must be greater than start (start: ${start}, end: ${end})`);\n\t\tthis._split(start);\n\t\tthis._split(end);\n\t\tlet chunk = this.byStart.get(start);\n\t\twhile (chunk) {\n\t\t\tchunk.reset();\n\t\t\tchunk = end > chunk.end ? this.byStart.get(chunk.end) : null;\n\t\t}\n\t\treturn this;\n\t}\n\tlastChar() {\n\t\tif (this.outro.length) return this.outro[this.outro.length - 1];\n\t\tlet chunk = this.lastChunk;\n\t\twhile (chunk) {\n\t\t\tif (chunk.outro.length) return chunk.outro[chunk.outro.length - 1];\n\t\t\tif (chunk.content.length) return chunk.content[chunk.content.length - 1];\n\t\t\tif (chunk.intro.length) return chunk.intro[chunk.intro.length - 1];\n\t\t\tchunk = chunk.previous;\n\t\t}\n\t\tif (this.intro.length) return this.intro[this.intro.length - 1];\n\t\treturn \"\";\n\t}\n\tlastLine() {\n\t\tlet lineIndex = this.outro.lastIndexOf(n);\n\t\tif (lineIndex !== -1) return this.outro.substr(lineIndex + 1);\n\t\tlet lineStr = this.outro;\n\t\tlet chunk = this.lastChunk;\n\t\twhile (chunk) {\n\t\t\tif (chunk.outro.length > 0) {\n\t\t\t\tlineIndex = chunk.outro.lastIndexOf(n);\n\t\t\t\tif (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr;\n\t\t\t\tlineStr = chunk.outro + lineStr;\n\t\t\t}\n\t\t\tif (chunk.content.length > 0) {\n\t\t\t\tlineIndex = chunk.content.lastIndexOf(n);\n\t\t\t\tif (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr;\n\t\t\t\tlineStr = chunk.content + lineStr;\n\t\t\t}\n\t\t\tif (chunk.intro.length > 0) {\n\t\t\t\tlineIndex = chunk.intro.lastIndexOf(n);\n\t\t\t\tif (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr;\n\t\t\t\tlineStr = chunk.intro + lineStr;\n\t\t\t}\n\t\t\tchunk = chunk.previous;\n\t\t}\n\t\tlineIndex = this.intro.lastIndexOf(n);\n\t\tif (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr;\n\t\treturn this.intro + lineStr;\n\t}\n\t/**\n\t* Returns the content of the generated string that corresponds to the slice between `start` and `end` of the original string.\n\t* Throws error if the indices are for characters that were already removed.\n\t*/\n\tslice(start = 0, end = this.original.length - this.offset) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\t\tif (this.original.length !== 0) {\n\t\t\tif (start < 0) start = Math.max(0, start + this.original.length);\n\t\t\tif (end < 0) end = Math.max(0, end + this.original.length);\n\t\t}\n\t\tlet result = \"\";\n\t\tlet chunk = this.firstChunk;\n\t\twhile (chunk && (chunk.start > start || chunk.end <= start)) {\n\t\t\tif (chunk.start < end && chunk.end >= end || end === 0 && chunk.start === 0) return result;\n\t\t\tchunk = chunk.next;\n\t\t}\n\t\tif (chunk && chunk.edited && chunk.start !== start) throw new MagicStringError(`cannot use edited character ${start} as slice start anchor`);\n\t\tconst startChunk = chunk;\n\t\twhile (chunk) {\n\t\t\tif (end === 0 && chunk.start === 0) break;\n\t\t\tif (chunk.intro && (startChunk !== chunk || chunk.start === start)) result += chunk.intro;\n\t\t\tconst containsEnd = chunk.start < end && chunk.end >= end;\n\t\t\tif (containsEnd && chunk.edited && chunk.end !== end) throw new MagicStringError(`cannot use edited character ${end} as slice end anchor`);\n\t\t\tconst sliceStart = startChunk === chunk ? start - chunk.start : 0;\n\t\t\tconst sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;\n\t\t\tresult += chunk.content.slice(sliceStart, sliceEnd);\n\t\t\tif (chunk.outro && (!containsEnd || chunk.end === end)) result += chunk.outro;\n\t\t\tif (containsEnd) break;\n\t\t\tchunk = chunk.next;\n\t\t}\n\t\treturn result;\n\t}\n\t/**\n\t* Returns a clone of `s`, with all content before the `start` and `end` characters of the original string removed.\n\t*/\n\tsnip(start, end) {\n\t\tconst clone = this.clone();\n\t\tclone.remove(0, start);\n\t\tclone.remove(end, clone.original.length);\n\t\treturn clone;\n\t}\n\t/** @internal */\n\t_split(index) {\n\t\tif (this.byStart.get(index) || this.byEnd.get(index)) return;\n\t\tlet chunk = this.lastSearchedChunk;\n\t\tlet previousChunk = chunk;\n\t\tconst searchForward = index > chunk.end;\n\t\twhile (chunk) {\n\t\t\tif (chunk.contains(index)) return this._splitChunk(chunk, index);\n\t\t\tchunk = searchForward ? this.byStart.get(chunk.end) : this.byEnd.get(chunk.start);\n\t\t\tif (chunk === previousChunk) return;\n\t\t\tpreviousChunk = chunk;\n\t\t}\n\t}\n\t/** @internal */\n\t_splitChunk(chunk, index) {\n\t\tif (chunk.edited && chunk.content.length) {\n\t\t\tconst loc = getLocator(this.original)(index);\n\t\t\tthrow new MagicStringError(`cannot split a chunk that has already been edited (${loc.line}:${loc.column} – \"${chunk.original}\")`);\n\t\t}\n\t\tconst newChunk = chunk.split(index);\n\t\tthis.byEnd.set(index, chunk);\n\t\tthis.byStart.set(index, newChunk);\n\t\tthis.byEnd.set(newChunk.end, newChunk);\n\t\tif (chunk === this.lastChunk) this.lastChunk = newChunk;\n\t\tthis.lastSearchedChunk = chunk;\n\t\treturn true;\n\t}\n\t/**\n\t* Returns the generated string.\n\t*/\n\ttoString() {\n\t\tlet str = this.intro;\n\t\tlet chunk = this.firstChunk;\n\t\twhile (chunk) {\n\t\t\tstr += chunk.toString();\n\t\t\tchunk = chunk.next;\n\t\t}\n\t\treturn str + this.outro;\n\t}\n\t/**\n\t* Returns true if the resulting source is empty (disregarding white space).\n\t*/\n\tisEmpty() {\n\t\tif (this.intro.length && this.intro.trim()) return false;\n\t\tlet chunk = this.firstChunk;\n\t\twhile (chunk) {\n\t\t\tif (chunk.intro.length && chunk.intro.trim() || chunk.content.length && chunk.content.trim() || chunk.outro.length && chunk.outro.trim()) return false;\n\t\t\tchunk = chunk.next;\n\t\t}\n\t\tif (this.outro.length && this.outro.trim()) return false;\n\t\treturn true;\n\t}\n\tlength() {\n\t\tlet chunk = this.firstChunk;\n\t\tlet length = 0;\n\t\twhile (chunk) {\n\t\t\tlength += chunk.intro.length + chunk.content.length + chunk.outro.length;\n\t\t\tchunk = chunk.next;\n\t\t}\n\t\treturn length;\n\t}\n\t/**\n\t* Removes empty lines from the start and end.\n\t*/\n\ttrimLines() {\n\t\treturn this.trim(\"[\\\\r\\\\n]\");\n\t}\n\t/**\n\t* Trims content matching `charType` (defaults to `\\s`, i.e. whitespace) from the start and end.\n\t*/\n\ttrim(charType) {\n\t\treturn this.trimStart(charType).trimEnd(charType);\n\t}\n\t/** @internal */\n\ttrimEndAborted(charType) {\n\t\tconst rx = new RegExp(`${charType || \"\\\\s\"}+$`);\n\t\tthis.outro = this.outro.replace(rx, \"\");\n\t\tif (this.outro.length) return true;\n\t\tlet chunk = this.lastChunk;\n\t\tdo {\n\t\t\tconst end = chunk.end;\n\t\t\tconst aborted = chunk.trimEnd(rx);\n\t\t\tif (chunk.end !== end) {\n\t\t\t\tif (this.lastChunk === chunk) this.lastChunk = chunk.next;\n\t\t\t\tthis.byEnd.set(chunk.end, chunk);\n\t\t\t\tthis.byStart.set(chunk.next.start, chunk.next);\n\t\t\t\tthis.byEnd.set(chunk.next.end, chunk.next);\n\t\t\t}\n\t\t\tif (aborted) return true;\n\t\t\tchunk = chunk.previous;\n\t\t} while (chunk);\n\t\tthis.intro = this.intro.replace(rx, \"\");\n\t\treturn this.intro.length > 0;\n\t}\n\t/**\n\t* Trims content matching `charType` (defaults to `\\s`, i.e. whitespace) from the end.\n\t*/\n\ttrimEnd(charType) {\n\t\tthis.trimEndAborted(charType);\n\t\treturn this;\n\t}\n\t/** @internal */\n\ttrimStartAborted(charType) {\n\t\tconst rx = new RegExp(`^${charType || \"\\\\s\"}+`);\n\t\tthis.intro = this.intro.replace(rx, \"\");\n\t\tif (this.intro.length) return true;\n\t\tlet chunk = this.firstChunk;\n\t\tdo {\n\t\t\tconst end = chunk.end;\n\t\t\tconst aborted = chunk.trimStart(rx);\n\t\t\tif (chunk.end !== end) {\n\t\t\t\tif (chunk === this.lastChunk) this.lastChunk = chunk.next;\n\t\t\t\tthis.byEnd.set(chunk.end, chunk);\n\t\t\t\tthis.byStart.set(chunk.next.start, chunk.next);\n\t\t\t\tthis.byEnd.set(chunk.next.end, chunk.next);\n\t\t\t}\n\t\t\tif (aborted) return true;\n\t\t\tchunk = chunk.next;\n\t\t} while (chunk);\n\t\tthis.outro = this.outro.replace(rx, \"\");\n\t\treturn this.outro.length > 0;\n\t}\n\t/**\n\t* Trims content matching `charType` (defaults to `\\s`, i.e. whitespace) from the start.\n\t*/\n\ttrimStart(charType) {\n\t\tthis.trimStartAborted(charType);\n\t\treturn this;\n\t}\n\t/**\n\t* Indicates if the string has been changed.\n\t*/\n\thasChanged() {\n\t\tif (this.intro || this.outro) return true;\n\t\tlet outputIndex = 0;\n\t\tlet chunk = this.firstChunk;\n\t\twhile (chunk) {\n\t\t\tif (chunk.intro || chunk.outro) return true;\n\t\t\tif (!chunk.edited && chunk.start === outputIndex) outputIndex = chunk.end;\n\t\t\telse {\n\t\t\t\tif (!this.original.startsWith(chunk.content, outputIndex)) return true;\n\t\t\t\toutputIndex += chunk.content.length;\n\t\t\t}\n\t\t\tchunk = chunk.next;\n\t\t}\n\t\treturn outputIndex !== this.original.length;\n\t}\n\t/**\n\t* Whether the original range [start, end) has had any of its characters\n\t* removed. `replace`/`replaceAll` search `original`, so a match can land on\n\t* text that is no longer in the output - overwriting it would resurrect the\n\t* removed characters, so such matches are skipped instead.\n\t*\n\t* @internal\n\t*/\n\t_hasRemovedContent(start, end) {\n\t\tlet chunk = this.byStart.get(start);\n\t\tif (!chunk) {\n\t\t\tchunk = this.lastSearchedChunk;\n\t\t\tconst searchForward = start >= chunk.end;\n\t\t\twhile (chunk && !chunk.contains(start)) chunk = searchForward ? this.byStart.get(chunk.end) : this.byEnd.get(chunk.start);\n\t\t\tif (chunk) this.lastSearchedChunk = chunk;\n\t\t}\n\t\twhile (chunk && chunk.start < end) {\n\t\t\tif (chunk.content === \"\") return true;\n\t\t\tchunk = this.byStart.get(chunk.end);\n\t\t}\n\t\treturn false;\n\t}\n\t/** @internal */\n\t_replaceRegexp(searchValue, replacement) {\n\t\tfunction getReplacement(match, str) {\n\t\t\tif (typeof replacement === \"string\") return expandReplacement(replacement, match[0], match.index, str, match.slice(1), match.groups);\n\t\t\telse return match.groups === void 0 ? replacement(match[0], ...match.slice(1), match.index, str) : replacement(match[0], ...match.slice(1), match.index, str, match.groups);\n\t\t}\n\t\tconst replaceMatch = (match) => {\n\t\t\t/* v8 ignore next 2 -- `match.index` is always defined for matches from `matchAll` */\n\t\t\tif (match.index == null) return false;\n\t\t\tif (this._hasRemovedContent(match.index, match.index + match[0].length)) return false;\n\t\t\tconst replacement = getReplacement(match, this.original);\n\t\t\tif (replacement === match[0]) return true;\n\t\t\tif (match[0].length === 0) this.appendRight(match.index, replacement);\n\t\t\telse this.overwrite(match.index, match.index + match[0].length, replacement);\n\t\t\treturn true;\n\t\t};\n\t\tif (searchValue.global) {\n\t\t\tsearchValue.lastIndex = 0;\n\t\t\tfor (const match of this.original.matchAll(searchValue)) replaceMatch(match);\n\t\t} else {\n\t\t\tconst match = this.original.match(searchValue);\n\t\t\tif (match && !replaceMatch(match)) {\n\t\t\t\tconst global = new RegExp(searchValue.source, `${searchValue.flags}g`);\n\t\t\t\tfor (const next of this.original.matchAll(global)) if (replaceMatch(next)) break;\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n\t/** @internal */\n\t_replaceString(string, replacement) {\n\t\tconst { original } = this;\n\t\tlet index = original.indexOf(string);\n\t\twhile (index !== -1) {\n\t\t\tif (this._hasRemovedContent(index, index + string.length)) {\n\t\t\t\tindex = original.indexOf(string, index + string.length);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (typeof replacement === \"function\") replacement = replacement(string, index, original);\n\t\t\telse replacement = expandReplacement(replacement, string, index, original, [], void 0);\n\t\t\tif (string !== replacement) {\n\t\t\t\tif (string.length === 0) this.appendRight(index, replacement);\n\t\t\t\telse this.overwrite(index, index + string.length, replacement);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\treturn this;\n\t}\n\t/**\n\t* String replacement with RegExp or string.\n\t*/\n\treplace(searchValue, replacement) {\n\t\tif (typeof searchValue === \"string\") return this._replaceString(searchValue, replacement);\n\t\treturn this._replaceRegexp(searchValue, replacement);\n\t}\n\t/** @internal */\n\t_replaceAllString(string, replacement) {\n\t\tconst { original } = this;\n\t\tconst stringLength = string.length;\n\t\tif (stringLength === 0) {\n\t\t\tfor (let index = 0; index <= original.length; index += 1) {\n\t\t\t\tif (this._hasRemovedContent(index, index)) continue;\n\t\t\t\tconst _replacement = typeof replacement === \"function\" ? replacement(\"\", index, original) : expandReplacement(replacement, \"\", index, original, [], void 0);\n\t\t\t\tif (_replacement !== \"\") this.appendRight(index, _replacement);\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\t\tfor (let index = original.indexOf(string); index !== -1; index = original.indexOf(string, index + stringLength)) {\n\t\t\tif (this._hasRemovedContent(index, index + stringLength)) continue;\n\t\t\tconst previous = original.slice(index, index + stringLength);\n\t\t\tconst _replacement = typeof replacement === \"function\" ? replacement(previous, index, original) : expandReplacement(replacement, previous, index, original, [], void 0);\n\t\t\tif (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);\n\t\t}\n\t\treturn this;\n\t}\n\t/**\n\t* Same as `s.replace`, but replace all matched strings instead of just one.\n\t*/\n\treplaceAll(searchValue, replacement) {\n\t\tif (typeof searchValue === \"string\") return this._replaceAllString(searchValue, replacement);\n\t\tif (!searchValue.global) throw new MagicStringError(\"replaceAll() requires a global RegExp\");\n\t\treturn this._replaceRegexp(searchValue, replacement);\n\t}\n};\n//#endregion\n//#region src/Bundle.ts\nconst hasOwnProp = Object.prototype.hasOwnProperty;\nvar Bundle = class Bundle {\n\tconstructor(options = {}) {\n\t\tthis.intro = options.intro || \"\";\n\t\tthis.separator = options.separator !== void 0 ? options.separator : \"\\n\";\n\t\tthis.sources = [];\n\t\tthis.uniqueSources = [];\n\t\tthis.uniqueSourceIndexByFilename = {};\n\t}\n\t/**\n\t* Adds the specified source to the bundle, which can either be a `MagicString` object directly,\n\t* or an options object that holds a magic string `content` property and optionally provides\n\t* a `filename` for the source within the bundle, as well as an optional `ignoreList` hint\n\t* (which defaults to `false`). The `filename` is used when constructing the source map for the\n\t* bundle, to identify this `source` in the source map's `sources` field. The `ignoreList` hint\n\t* is used to populate the `x_google_ignoreList` extension field in the source map, which is a\n\t* mechanism for tools to signal to debuggers that certain sources should be ignored by default\n\t* (depending on user preferences).\n\t*/\n\taddSource(source) {\n\t\tif (source instanceof MagicString) return this.addSource({\n\t\t\tcontent: source,\n\t\t\tfilename: source.filename,\n\t\t\tseparator: this.separator\n\t\t});\n\t\tif (!isObject(source) || !source.content) throw new MagicStringError(\"addSource() requires a `content` property that is a MagicString\");\n\t\t[\n\t\t\t\"filename\",\n\t\t\t\"ignoreList\",\n\t\t\t\"indentExclusionRanges\",\n\t\t\t\"separator\"\n\t\t].forEach((option) => {\n\t\t\tif (!hasOwnProp.call(source, option)) source[option] = source.content[option];\n\t\t});\n\t\tif (source.separator === void 0) source.separator = this.separator;\n\t\tif (source.filename) {\n\t\t\tif (!hasOwnProp.call(this.uniqueSourceIndexByFilename, source.filename)) {\n\t\t\t\tthis.uniqueSourceIndexByFilename[source.filename] = this.uniqueSources.length;\n\t\t\t\tthis.uniqueSources.push({\n\t\t\t\t\tfilename: source.filename,\n\t\t\t\t\tcontent: source.content.original\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tconst uniqueSource = this.uniqueSources[this.uniqueSourceIndexByFilename[source.filename]];\n\t\t\t\tif (source.content.original !== uniqueSource.content) throw new MagicStringError(`duplicate filename \"${source.filename}\" with different content, use unique filenames`);\n\t\t\t}\n\t\t}\n\t\tthis.sources.push(source);\n\t\treturn this;\n\t}\n\tappend(str, options) {\n\t\tthis.addSource({\n\t\t\tcontent: new MagicString(str),\n\t\t\tseparator: options && options.separator || \"\"\n\t\t});\n\t\treturn this;\n\t}\n\tclone() {\n\t\tconst bundle = new Bundle({\n\t\t\tintro: this.intro,\n\t\t\tseparator: this.separator\n\t\t});\n\t\tthis.sources.forEach((source) => {\n\t\t\tbundle.addSource({\n\t\t\t\tfilename: source.filename,\n\t\t\t\tcontent: source.content.clone(),\n\t\t\t\tignoreList: source.ignoreList,\n\t\t\t\tindentExclusionRanges: source.indentExclusionRanges,\n\t\t\t\tseparator: source.separator\n\t\t\t});\n\t\t});\n\t\treturn bundle;\n\t}\n\t/**\n\t* Flattens the bundle into a single `MagicString`, so the concatenated result can be\n\t* processed further with the full `MagicString` API. The returned string's `original`\n\t* is the concatenation of every source's `original`, and all existing edits, inserts,\n\t* intros, outros and separators are preserved as inserted content, so its `toString()`\n\t* equals the bundle's `toString()` and its sourcemap maps back to that combined original.\n\t*\n\t* Because a `MagicString` maps to a single source, per-source `filename`s are not carried\n\t* over; generate the bundle's map before flattening if you need the multi-source mapping.\n\t*/\n\ttoMagicString() {\n\t\tconst combined = new MagicString(this.sources.map((source) => source.content.original).join(\"\"));\n\t\tlet offset = 0;\n\t\tlet pending = this.intro;\n\t\tlet first = null;\n\t\tlet last = null;\n\t\tconst byStart = /* @__PURE__ */ new Map();\n\t\tconst byEnd = /* @__PURE__ */ new Map();\n\t\tlet hasMovedChunks = false;\n\t\tthis.sources.forEach((source, i) => {\n\t\t\tconst magicString = source.content;\n\t\t\tconst separator = i > 0 ? source.separator !== void 0 ? source.separator : this.separator : \"\";\n\t\t\tif (magicString.original.length === 0) {\n\t\t\t\tpending += separator + magicString.toString();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tpending += separator + magicString.intro;\n\t\t\tlet sourceFirst = null;\n\t\t\tlet previous = null;\n\t\t\tlet originalChunk = magicString.firstChunk;\n\t\t\twhile (originalChunk) {\n\t\t\t\tconst chunk = originalChunk.clone();\n\t\t\t\tchunk.start += offset;\n\t\t\t\tchunk.end += offset;\n\t\t\t\tchunk.previous = previous;\n\t\t\t\tchunk.next = null;\n\t\t\t\tif (previous) previous.next = chunk;\n\t\t\t\tbyStart.set(chunk.start, chunk);\n\t\t\t\tbyEnd.set(chunk.end, chunk);\n\t\t\t\tsourceFirst ??= chunk;\n\t\t\t\tprevious = chunk;\n\t\t\t\toriginalChunk = originalChunk.next;\n\t\t\t}\n\t\t\tconst sourceLast = previous;\n\t\t\tsourceFirst.intro = pending + sourceFirst.intro;\n\t\t\tpending = \"\";\n\t\t\tsourceLast.outro += magicString.outro;\n\t\t\tif (last) {\n\t\t\t\tlast.next = sourceFirst;\n\t\t\t\tsourceFirst.previous = last;\n\t\t\t} else first = sourceFirst;\n\t\t\tlast = sourceLast;\n\t\t\tfor (let index = 0; index < magicString.original.length; index += 1) if (magicString.sourcemapLocations.has(index)) combined.sourcemapLocations.add(index + offset);\n\t\t\tObject.keys(magicString.storedNames).forEach((name) => {\n\t\t\t\tObject.defineProperty(combined.storedNames, name, {\n\t\t\t\t\twritable: true,\n\t\t\t\t\tvalue: true,\n\t\t\t\t\tenumerable: true\n\t\t\t\t});\n\t\t\t});\n\t\t\tif (magicString.hasMovedChunks) hasMovedChunks = true;\n\t\t\toffset += magicString.original.length;\n\t\t});\n\t\tif (!first) {\n\t\t\tcombined.intro = pending;\n\t\t\treturn combined;\n\t\t}\n\t\tif (pending) last.outro += pending;\n\t\tcombined.firstChunk = first;\n\t\tcombined.lastChunk = last;\n\t\tcombined.lastSearchedChunk = first;\n\t\tcombined.byStart = byStart;\n\t\tcombined.byEnd = byEnd;\n\t\tcombined.hasMovedChunks = hasMovedChunks;\n\t\treturn combined;\n\t}\n\tgenerateDecodedMap(options = {}) {\n\t\tconst mappings = new Mappings(options.hires);\n\t\tconst { names, x_google_ignoreList } = this._generateMappings(mappings);\n\t\treturn {\n\t\t\t...this._mapProperties(options, names, x_google_ignoreList),\n\t\t\tmappings: mappings.raw,\n\t\t\trangeMappings: mappings.rawRangeMappings\n\t\t};\n\t}\n\tgenerateMap(options = {}) {\n\t\tconst encoder = new MappingsEncoder();\n\t\tconst mappings = new Mappings(options.hires, encoder);\n\t\tconst { names, x_google_ignoreList } = this._generateMappings(mappings);\n\t\treturn new SourceMap({\n\t\t\t...this._mapProperties(options, names, x_google_ignoreList),\n\t\t\tmappings: encoder.finish(mappings.rawSegments),\n\t\t\trangeMappings: mappings.rawRangeMappings\n\t\t});\n\t}\n\t/** @internal */\n\t_generateMappings(mappings) {\n\t\tconst names = [];\n\t\tlet x_google_ignoreList;\n\t\tthis.sources.forEach((source) => {\n\t\t\tObject.keys(source.content.storedNames).forEach((name) => {\n\t\t\t\tif (!names.includes(name)) names.push(name);\n\t\t\t});\n\t\t});\n\t\tif (this.intro) mappings.advance(this.intro);\n\t\tthis.sources.forEach((source, i) => {\n\t\t\tif (i > 0)\n /* v8 ignore next -- addSource always normalizes source.separator */\n\t\t\tmappings.advance(source.separator !== void 0 ? source.separator : this.separator);\n\t\t\tconst sourceIndex = source.filename ? this.uniqueSourceIndexByFilename[source.filename] : -1;\n\t\t\tconst magicString = source.content;\n\t\t\tconst locate = getLocator(magicString.original);\n\t\t\tif (magicString.intro) mappings.advance(magicString.intro);\n\t\t\tmagicString.firstChunk.eachNext((chunk) => {\n\t\t\t\tconst loc = locate(chunk.start);\n\t\t\t\tif (chunk.intro.length) mappings.advance(chunk.intro);\n\t\t\t\tif (source.filename) {\n\t\t\t\t\tif (chunk.edited) mappings.addEdit(sourceIndex, chunk.content, loc, chunk.storeName ? names.indexOf(chunk.original) : -1);\n\t\t\t\t\telse mappings.addUneditedChunk(sourceIndex, chunk, magicString.original, loc, magicString.sourcemapLocations);\n\t\t\t\t} else mappings.advance(chunk.content);\n\t\t\t\tif (chunk.outro.length) mappings.advance(chunk.outro);\n\t\t\t});\n\t\t\tif (magicString.outro) mappings.advance(magicString.outro);\n\t\t\tif (source.ignoreList && sourceIndex !== -1) {\n\t\t\t\tif (x_google_ignoreList === void 0) x_google_ignoreList = [];\n\t\t\t\tx_google_ignoreList.push(sourceIndex);\n\t\t\t}\n\t\t});\n\t\treturn {\n\t\t\tnames,\n\t\t\tx_google_ignoreList\n\t\t};\n\t}\n\t/** @internal */\n\t_mapProperties(options, names, x_google_ignoreList) {\n\t\treturn {\n\t\t\tfile: options.file ? options.file.split(/[/\\\\]/).pop() : void 0,\n\t\t\tsources: this.uniqueSources.map((source) => {\n\t\t\t\treturn options.file ? getRelativePath(options.file, source.filename) : source.filename;\n\t\t\t}),\n\t\t\tsourcesContent: this.uniqueSources.map((source) => {\n\t\t\t\treturn (typeof options.includeContent === \"function\" ? options.includeContent(source) : options.includeContent) ? source.content : null;\n\t\t\t}),\n\t\t\tnames,\n\t\t\tx_google_ignoreList\n\t\t};\n\t}\n\tgetIndentString() {\n\t\tconst indentStringCounts = {};\n\t\tthis.sources.forEach((source) => {\n\t\t\tconst indentStr = source.content._getRawIndentString();\n\t\t\tif (indentStr === null) return;\n\t\t\tif (!indentStringCounts[indentStr]) indentStringCounts[indentStr] = 0;\n\t\t\tindentStringCounts[indentStr] += 1;\n\t\t});\n\t\treturn Object.keys(indentStringCounts).sort((a, b) => {\n\t\t\treturn indentStringCounts[b] - indentStringCounts[a];\n\t\t})[0] || \"\t\";\n\t}\n\tindent(indentStr) {\n\t\tif (!arguments.length) indentStr = this.getIndentString();\n\t\tif (indentStr === \"\") return this;\n\t\tlet trailingNewline = !this.intro || this.intro.slice(-1) === \"\\n\";\n\t\tthis.sources.forEach((source, i) => {\n\t\t\t/* v8 ignore next -- addSource always normalizes source.separator */\n\t\t\tconst separator = source.separator !== void 0 ? source.separator : this.separator;\n\t\t\tconst indentStart = trailingNewline || i > 0 && /\\r?\\n$/.test(separator);\n\t\t\tsource.content.indent(indentStr, {\n\t\t\t\texclude: source.indentExclusionRanges,\n\t\t\t\tindentStart\n\t\t\t});\n\t\t\ttrailingNewline = source.content.lastChar() === \"\\n\";\n\t\t});\n\t\tif (this.intro) this.intro = indentStr + this.intro.replace(/^[^\\n]/gm, (match, index) => {\n\t\t\treturn index > 0 ? indentStr + match : match;\n\t\t});\n\t\treturn this;\n\t}\n\tprepend(str) {\n\t\tthis.intro = str + this.intro;\n\t\treturn this;\n\t}\n\ttoString() {\n\t\tconst body = this.sources.map((source, i) => {\n\t\t\t/* v8 ignore next -- addSource always normalizes source.separator */\n\t\t\tconst separator = source.separator !== void 0 ? source.separator : this.separator;\n\t\t\treturn (i > 0 ? separator : \"\") + source.content.toString();\n\t\t}).join(\"\");\n\t\treturn this.intro + body;\n\t}\n\tisEmpty() {\n\t\tif (this.intro.length && this.intro.trim()) return false;\n\t\tif (this.sources.some((source, i) => {\n\t\t\t/* v8 ignore next -- addSource always normalizes source.separator */\n\t\t\tconst separator = source.separator !== void 0 ? source.separator : this.separator;\n\t\t\treturn i > 0 && separator.trim() !== \"\" || !source.content.isEmpty();\n\t\t})) return false;\n\t\treturn true;\n\t}\n\tlength() {\n\t\treturn this.sources.reduce((length, source, i) => {\n\t\t\t/* v8 ignore next -- addSource always normalizes source.separator */\n\t\t\tconst separator = source.separator !== void 0 ? source.separator : this.separator;\n\t\t\treturn length + (i > 0 ? separator.length : 0) + source.content.toString().length;\n\t\t}, this.intro.length);\n\t}\n\ttrimLines() {\n\t\treturn this.trim(\"[\\\\r\\\\n]\");\n\t}\n\ttrim(charType) {\n\t\treturn this.trimStart(charType).trimEnd(charType);\n\t}\n\ttrimStart(charType) {\n\t\tconst rx = new RegExp(`^${charType || \"\\\\s\"}+`);\n\t\tthis.intro = this.intro.replace(rx, \"\");\n\t\tif (!this.intro) for (let i = 0; i < this.sources.length; i += 1) {\n\t\t\tconst source = this.sources[i];\n\t\t\tif (i > 0) {\n\t\t\t\tsource.separator = (source.separator !== void 0 ? source.separator : this.separator).replace(rx, \"\");\n\t\t\t\tif (source.separator) break;\n\t\t\t}\n\t\t\tif (source.content.trimStartAborted(charType)) break;\n\t\t}\n\t\treturn this;\n\t}\n\ttrimEnd(charType) {\n\t\tconst rx = new RegExp(`${charType || \"\\\\s\"}+$`);\n\t\tfor (let i = this.sources.length - 1; i >= 0; i -= 1) {\n\t\t\tconst source = this.sources[i];\n\t\t\tif (source.content.trimEndAborted(charType)) return this;\n\t\t\tif (i > 0) {\n\t\t\t\tsource.separator = (source.separator !== void 0 ? source.separator : this.separator).replace(rx, \"\");\n\t\t\t\tif (source.separator) return this;\n\t\t\t}\n\t\t}\n\t\tthis.intro = this.intro.replace(rx, \"\");\n\t\treturn this;\n\t}\n};\n//#endregion\nexport { Bundle, MagicString, MagicString as default, MagicStringError, SourceMap };\n"],"x_google_ignoreList":[0,1],"mappings":";AACA,IAAI,QAAQ,IAAI,WAAW,CAAC;AAC5B,IAAI,YAAY,IAAI,WAAW,CAAC;AAChC,IAAI,QAAQ;AACZ,IAAIA,8BAAY,IAAI,WAAW,EAAE;AACjC,IAAI,4BAAY,IAAI,WAAW,GAAG;AAClC,KAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;CACrC,MAAM,IAAI,MAAM,WAAW,CAAC;CAC5B,YAAU,KAAK;CACf,UAAU,KAAK;AACjB;AAgBA,SAAS,cAAc,SAAS,KAAK;CACnC,GAAG;EACD,IAAI,UAAU,MAAM;EACpB,SAAS;EACT,IAAI,MAAM,GAAG,WAAW;EACxB,QAAQ,MAAMA,YAAU,QAAQ;CAClC,SAAS,MAAM;AACjB;AACA,SAAS,WAAW,KAAK;CACvB,OAAO,MAAM,IAAI,CAAC,OAAO,IAAI,IAAI,OAAO;AAC1C;AAOA,IAAI,YAAY;AAChB,IAAI,KAAK,OAAO,gBAAgB,8BAA8B,IAAI,YAAY,IAAI,OAAO,WAAW,cAAc,EAChH,OAAO,KAAK;CAEV,OADY,OAAO,KAAK,IAAI,QAAQ,IAAI,YAAY,IAAI,UAC/C,CAAC,CAAC,SAAS;AACtB,EACF,IAAI,EACF,OAAO,KAAK;CACV,IAAI,MAAM;CACV,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,KAC9B,OAAO,OAAO,aAAa,IAAI,EAAE;CAEnC,OAAO;AACT,EACF;AACA,IAAI,eAAe,MAAM;CACvB,cAAc;EACZ,KAAK,MAAM;EACX,KAAK,MAAM;EACX,KAAK,SAAS,IAAI,WAAW,SAAS;CACxC;CACA,MAAM,GAAG;EACP,MAAM,EAAE,WAAW;EACnB,OAAO,KAAK,SAAS;EACrB,IAAI,KAAK,QAAQ,WAAW;GAC1B,KAAK,OAAO,GA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Aa,WAAW;EAC3F,IAAI,CAAC,YAAY,QAAQ,MAAM,IAAI,iBAAiB,uCAAuC;EAC3F,OAAO,KAAK,eAAe,aAAa,WAAW;CACpD;AACD"}
@@ -1,11 +1,17 @@
1
1
  import { Redacted, Schema, Stream } from "effect";
2
2
  import * as AiError from "@effect-uai/core/AiError";
3
+ import * as Socket from "effect/socket/Socket";
3
4
  import { CommonStreamTranscribeRequest } from "@effect-uai/core/Transcriber";
4
5
  import { TranscriptEvent } from "@effect-uai/core/Transcript";
5
6
  //#region src/realtimeStt.d.ts
6
7
  type Config = {
7
8
  readonly apiKey: Redacted.Redacted;
8
9
  readonly baseUrl?: string;
10
+ /**
11
+ * Build the socket yourself, for a proxy or an in-memory transport. The
12
+ * default attaches the Basic auth header through the `ws` package.
13
+ */
14
+ readonly webSocket?: Socket.WebSocketConstructor["Service"];
9
15
  };
10
16
  declare const ServerFrame: Schema.Struct<{
11
17
  readonly result: Schema.optional<Schema.Struct<{
@@ -1 +1 @@
1
- {"version":3,"file":"realtimeStt.d.mts","names":[],"sources":["../src/realtimeStt.ts"],"mappings":";;;;;KA8BY;WAAoB,QAAQ,SAAS;WAAmB;;cA+F9D,aAAW,OAAA;;;;;;;;;;;;;;;;;;;;;;;cAgBJ,cAAW,cAAkB,YAAY,SAAO;cAoDhD,sBAAmB,KACxB,YACL,GAAG,GAAC,SACM,OAAO,OAAO,YAAY,GAAG,IAAE,SAC/B,kCACR,OAAO,OAAO,iBAAiB,QAAQ,UAAU,GAAG"}
1
+ {"version":3,"file":"realtimeStt.d.mts","names":[],"sources":["../src/realtimeStt.ts"],"mappings":";;;;;;KAgCY;WACD,QAAQ,SAAS;WACjB;;;;;WAKA,YAAY,OAAO;;cAgGxB,aAAW,OAAA;;;;;;;;;;;;;;;;;;;;;;;cAgBJ,cAAW,cAAkB,YAAY,SAAO;cAmDhD,sBAAmB,KACxB,YACL,GAAG,GAAC,SACM,OAAO,OAAO,YAAY,GAAG,IAAE,SAC/B,kCACR,OAAO,OAAO,iBAAiB,QAAQ,UAAU,GAAG"}
@@ -1,8 +1,10 @@
1
1
  import { authedWsConstructor } from "./wsAuth.mjs";
2
- import { Effect, Encoding, Match, Queue, Schema, Stream } from "effect";
2
+ import { Effect, Match, Option, Predicate, Schema, Stream } from "effect";
3
3
  import * as AiError from "@effect-uai/core/AiError";
4
4
  import * as JSONL from "@effect-uai/core/JSONL";
5
- import * as Socket from "effect/unstable/socket/Socket";
5
+ import { Base64 } from "effect/encoding";
6
+ import * as Socket from "effect/socket/Socket";
7
+ import * as WebSocketSession from "@effect-uai/core/WebSocketSession";
6
8
  import * as Capabilities from "@effect-uai/core/Capabilities";
7
9
  //#region src/realtimeStt.ts
8
10
  /**
@@ -52,7 +54,7 @@ const configFrame = (encoding, request) => JSON.stringify({ transcribeConfig: {
52
54
  ...request.biasingTerms !== void 0 && { prompts: request.biasingTerms },
53
55
  ...request.wordTimestamps === true && { includeWordTimestamps: true }
54
56
  } });
55
- const audioChunkFrame = (bytes) => JSON.stringify({ audioChunk: { content: Encoding.encodeBase64(bytes) } });
57
+ const audioChunkFrame = (bytes) => JSON.stringify({ audioChunk: { content: Base64.encode(bytes) } });
56
58
  const endTurnFrame = JSON.stringify({ endTurn: {} });
57
59
  const closeStreamFrame = JSON.stringify({ closeStream: {} });
58
60
  const WireWord = Schema.Struct({
@@ -114,13 +116,15 @@ const wireToEvent = (frame) => {
114
116
  atSeconds: 0
115
117
  };
116
118
  };
117
- const handleServerMessage = (queue) => (raw) => Effect.gen(function* () {
119
+ /** One raw text frame to at most one event; unknown or malformed frames yield `undefined`. */
120
+ const frameToEvent = (raw) => Effect.gen(function* () {
118
121
  const json = yield* JSONL.parseSafe(raw);
119
- if (json === void 0) return;
122
+ if (json === void 0) return void 0;
120
123
  const decoded = yield* decodeServerFrame(json).pipe(Effect.option);
121
- if (decoded._tag === "None") return;
122
- const event = wireToEvent(decoded.value);
123
- if (event !== void 0) yield* Queue.offer(queue, event);
124
+ return Option.match(decoded, {
125
+ onNone: () => void 0,
126
+ onSome: wireToEvent
127
+ });
124
128
  });
125
129
  const streamTranscription = (cfg) => (audioIn, request) => Stream.unwrap(Effect.gen(function* () {
126
130
  yield* Capabilities.warnDroppedWhen(request.prompt, {
@@ -130,17 +134,12 @@ const streamTranscription = (cfg) => (audioIn, request) => Stream.unwrap(Effect.
130
134
  reason: "Inworld STT has no free-form prompt field; bias via `biasingTerms`."
131
135
  });
132
136
  const encoding = yield* inputFormatToWire(request.inputFormat);
133
- const socket = yield* Socket.makeWebSocket(buildWsUrl(cfg), { closeCodeIsError: (code) => code !== 1e3 && code !== 1001 && code !== 1005 }).pipe(Effect.provideService(Socket.WebSocketConstructor, authedWsConstructor(cfg.apiKey)));
134
- const queue = yield* Queue.bounded(64);
135
- const write = yield* socket.writer;
136
- yield* Effect.gen(function* () {
137
- yield* write(configFrame(encoding, request));
138
- yield* Stream.runForEach(audioIn, (bytes) => write(audioChunkFrame(bytes)));
139
- yield* write(endTurnFrame);
140
- yield* write(closeStreamFrame);
141
- }).pipe(Effect.ignore, Effect.forkScoped);
142
- yield* socket.runString(handleServerMessage(queue)).pipe(Effect.ensuring(Queue.end(queue)), Effect.forkScoped);
143
- return Stream.fromQueue(queue);
137
+ const socket = yield* Socket.makeWebSocket(buildWsUrl(cfg)).pipe(Effect.provideService(Socket.WebSocketConstructor, cfg.webSocket ?? authedWsConstructor(cfg.apiKey)));
138
+ const { write } = yield* socket.writer;
139
+ const asAiError = WebSocketSession.toAiError("inworld");
140
+ const events = Stream.fromPull(Socket.readerString(socket)).pipe(Stream.scoped, Stream.catchIf(WebSocketSession.isCleanClose, () => Stream.empty), Stream.mapError(asAiError), Stream.mapEffect(frameToEvent), Stream.filter(Predicate.isNotUndefined));
141
+ const outgoing = Stream.concat(Stream.make(configFrame(encoding, request)), Stream.concat(Stream.map(audioIn, audioChunkFrame), Stream.make(endTurnFrame, closeStreamFrame))).pipe(Stream.mapEffect((frame) => Effect.mapError(write(frame), asAiError)));
142
+ return Stream.merge(events, Stream.drain(outgoing), { haltStrategy: "left" });
144
143
  }));
145
144
  //#endregion
146
145
  export { streamTranscription, wireToEvent };
@@ -1 +1 @@
1
- {"version":3,"file":"realtimeStt.mjs","names":[],"sources":["../src/realtimeStt.ts"],"sourcesContent":["/**\n * Inworld Realtime STT — `wss://api.inworld.ai/stt/v1/transcribe:streamBidirectional`.\n *\n * Auth: `Authorization: Basic <API_KEY>` on the WS upgrade header (matches\n * Inworld's own JS sample). Setting headers needs the `ws` peer dep\n * (Node/Bun); see `./wsAuth.ts`.\n *\n * Wire shape (per [inworld-ai/inworld-api-examples](https://github.com/inworld-ai/inworld-api-examples)):\n * client → server:\n * `{ \"transcribeConfig\": { modelId, audioEncoding, sampleRateHertz, language, ... } }` (first frame)\n * `{ \"audioChunk\": { \"content\": \"<base64 audio>\" } }` (×N)\n * `{ \"closeStream\": {} }` (end-of-input)\n * server → client:\n * `{ \"result\": { \"transcription\": { \"transcript\": \"...\", \"isFinal\": true|false } } }`\n * `{ \"result\": { \"speechStarted\": { \"startTimeMs\": ... } } }`\n * `{ \"result\": { \"speechStopped\": { \"silenceDurationMs\": ... } } }`\n *\n * Inworld's STT WS sends audio as base64 inside JSON (NOT binary frames),\n * matching the rest of the Inworld API style.\n */\nimport { Cause, Effect, Encoding, Match, Queue, Redacted, Schema, Stream } from \"effect\"\nimport * as Socket from \"effect/unstable/socket/Socket\"\nimport * as AiError from \"@effect-uai/core/AiError\"\nimport type { AudioFormat } from \"@effect-uai/core/Audio\"\nimport * as Capabilities from \"@effect-uai/core/Capabilities\"\nimport * as JSONL from \"@effect-uai/core/JSONL\"\nimport type { TranscriptEvent, WordTimestamp } from \"@effect-uai/core/Transcript\"\nimport type { CommonStreamTranscribeRequest } from \"@effect-uai/core/Transcriber\"\nimport { authedWsConstructor } from \"./wsAuth.js\"\n\nexport type Config = { readonly apiKey: Redacted.Redacted; readonly baseUrl?: string }\n\n// ---------------------------------------------------------------------------\n// AudioFormat → `audioEncoding` slug for Inworld STT\n// ---------------------------------------------------------------------------\n\ntype WireEncoding = \"LINEAR16\" | \"MP3\" | \"OGG_OPUS\" | \"FLAC\"\n\nconst unsupportedFormat = (format: AudioFormat) =>\n new AiError.Unsupported({\n provider: \"inworld\",\n capability: \"inputFormat\",\n reason: `Inworld realtime STT accepts pcm_s16le (LINEAR16), mp3, ogg/opus, or flac. Got ${JSON.stringify(format)}.`,\n })\n\nconst inputFormatToWire: (format: AudioFormat) => Effect.Effect<WireEncoding, AiError.AiError> =\n Match.type<AudioFormat>().pipe(\n Match.when({ container: \"raw\", encoding: \"pcm_s16le\" }, () =>\n Effect.succeed<WireEncoding>(\"LINEAR16\"),\n ),\n Match.when({ container: \"wav\", encoding: \"pcm_s16le\" }, () =>\n Effect.succeed<WireEncoding>(\"LINEAR16\"),\n ),\n Match.when({ container: \"mp3\" }, () => Effect.succeed<WireEncoding>(\"MP3\")),\n Match.when({ container: \"ogg\", encoding: \"opus\" }, () =>\n Effect.succeed<WireEncoding>(\"OGG_OPUS\"),\n ),\n Match.when({ container: \"flac\" }, () => Effect.succeed<WireEncoding>(\"FLAC\")),\n Match.orElse((f) => Effect.fail(unsupportedFormat(f))),\n )\n\n// ---------------------------------------------------------------------------\n// URL + frame builders\n// ---------------------------------------------------------------------------\n\nconst buildWsUrl = (cfg: Config) => {\n const wsBase = (cfg.baseUrl ?? \"https://api.inworld.ai\").replace(/^http/, \"ws\")\n return `${wsBase}/stt/v1/transcribe:streamBidirectional`\n}\n\nconst configFrame = (encoding: WireEncoding, request: CommonStreamTranscribeRequest) =>\n JSON.stringify({\n transcribeConfig: {\n modelId: request.model,\n audioEncoding: encoding,\n sampleRateHertz: request.inputFormat.sampleRate,\n numberOfChannels: request.inputFormat.channels ?? 1,\n // Inworld's sample includes `language` even though docs mark it optional.\n // Default to en-US to match the sample's behavior; caller can override.\n language: request.language ?? \"en-US\",\n // `prompts` is a vocab-biasing term list — maps from `biasingTerms`.\n ...(request.biasingTerms !== undefined && { prompts: request.biasingTerms }),\n ...(request.wordTimestamps === true && { includeWordTimestamps: true }),\n },\n })\n\nconst audioChunkFrame = (bytes: Uint8Array) =>\n JSON.stringify({ audioChunk: { content: Encoding.encodeBase64(bytes) } })\n\nconst endTurnFrame = JSON.stringify({ endTurn: {} })\nconst closeStreamFrame = JSON.stringify({ closeStream: {} })\n\n// ---------------------------------------------------------------------------\n// Wire schemas (server → client)\n// ---------------------------------------------------------------------------\n\nconst WireWord = Schema.Struct({\n word: Schema.String,\n startTimeMs: Schema.optional(Schema.Number),\n endTimeMs: Schema.optional(Schema.Number),\n confidence: Schema.optional(Schema.Number),\n})\n\nconst ResultBody = Schema.Struct({\n transcription: Schema.optional(\n Schema.Struct({\n transcript: Schema.String,\n isFinal: Schema.optional(Schema.Boolean),\n wordTimestamps: Schema.optional(Schema.NullOr(Schema.Array(WireWord))),\n }),\n ),\n speechStarted: Schema.optional(\n Schema.Struct({\n startTimeMs: Schema.optional(Schema.Number),\n confidence: Schema.optional(Schema.Number),\n }),\n ),\n speechStopped: Schema.optional(\n Schema.Struct({\n silenceDurationMs: Schema.optional(Schema.Number),\n }),\n ),\n status: Schema.optional(Schema.Unknown),\n})\n\nconst ServerFrame = Schema.Struct({\n result: Schema.optional(ResultBody),\n error: Schema.optional(Schema.Unknown),\n})\nconst decodeServerFrame = Schema.decodeUnknownEffect(ServerFrame)\n\nconst wireWordToCommon = (w: typeof WireWord.Type): WordTimestamp | undefined =>\n w.startTimeMs === undefined || w.endTimeMs === undefined\n ? undefined\n : {\n text: w.word,\n startSeconds: w.startTimeMs / 1000,\n endSeconds: w.endTimeMs / 1000,\n ...(w.confidence !== undefined && { confidence: w.confidence }),\n }\n\nexport const wireToEvent = (frame: typeof ServerFrame.Type): TranscriptEvent | undefined => {\n if (frame.error !== undefined) {\n return {\n _tag: \"error\",\n message: typeof frame.error === \"string\" ? frame.error : JSON.stringify(frame.error),\n }\n }\n const result = frame.result\n if (result === undefined) return undefined\n if (result.transcription !== undefined) {\n const t = result.transcription\n const words = t.wordTimestamps\n ?.map(wireWordToCommon)\n .filter((w): w is WordTimestamp => w !== undefined)\n return t.isFinal === true\n ? {\n _tag: \"final\",\n text: t.transcript,\n ...(words !== undefined && words.length > 0 && { words }),\n }\n : {\n _tag: \"partial\",\n text: t.transcript,\n ...(words !== undefined && words.length > 0 && { words }),\n }\n }\n if (result.speechStarted !== undefined) {\n return {\n _tag: \"speech-started\",\n atSeconds: (result.speechStarted.startTimeMs ?? 0) / 1000,\n }\n }\n if (result.speechStopped !== undefined) {\n return { _tag: \"utterance-ended\", atSeconds: 0 }\n }\n return undefined\n}\n\nconst handleServerMessage = (queue: Queue.Queue<TranscriptEvent, Cause.Done>) => (raw: string) =>\n Effect.gen(function* () {\n const json = yield* JSONL.parseSafe(raw)\n if (json === undefined) return\n const decoded = yield* decodeServerFrame(json).pipe(Effect.option)\n if (decoded._tag === \"None\") return\n const event = wireToEvent(decoded.value)\n if (event !== undefined) yield* Queue.offer(queue, event)\n })\n\n// ---------------------------------------------------------------------------\n// Stream<Uint8Array> → Stream<TranscriptEvent>\n// ---------------------------------------------------------------------------\n\nexport const streamTranscription =\n (cfg: Config) =>\n <E, R>(\n audioIn: Stream.Stream<Uint8Array, E, R>,\n request: CommonStreamTranscribeRequest,\n ): Stream.Stream<TranscriptEvent, AiError.AiError | E, R> =>\n Stream.unwrap(\n Effect.gen(function* () {\n yield* Capabilities.warnDroppedWhen(request.prompt, {\n provider: \"inworld\",\n capability: \"prompt\",\n field: \"prompt\",\n reason: \"Inworld STT has no free-form prompt field; bias via `biasingTerms`.\",\n })\n const encoding = yield* inputFormatToWire(request.inputFormat)\n const socket = yield* Socket.makeWebSocket(buildWsUrl(cfg), {\n // Effect's Socket treats all close codes as errors by default —\n // whitelist standard clean-close codes (1000 / 1001 / 1005).\n closeCodeIsError: (code) => code !== 1000 && code !== 1001 && code !== 1005,\n }).pipe(Effect.provideService(Socket.WebSocketConstructor, authedWsConstructor(cfg.apiKey)))\n const queue = yield* Queue.bounded<TranscriptEvent, Cause.Done>(64)\n const write = yield* socket.writer\n\n // Writer: config → drain audio → endTurn → closeStream. Inworld\n // emits `result.transcription` partials in real-time via VAD;\n // `endTurn` is sent on input-stream end to flush any tail audio\n // into a final transcript, then `closeStream` for graceful close.\n yield* Effect.gen(function* () {\n yield* write(configFrame(encoding, request))\n yield* Stream.runForEach(audioIn, (bytes) => write(audioChunkFrame(bytes)))\n yield* write(endTurnFrame)\n yield* write(closeStreamFrame)\n }).pipe(Effect.ignore, Effect.forkScoped)\n\n // `Queue.end` flushes pending events then fails the next take with\n // `Done` — clean stream end. `Queue.shutdown` would CLEAR queued\n // items and interrupt pending takes (wrong for graceful teardown).\n yield* socket\n .runString(handleServerMessage(queue))\n .pipe(Effect.ensuring(Queue.end(queue)), Effect.forkScoped)\n\n return Stream.fromQueue(queue)\n }),\n )\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAM,qBAAqB,WACzB,IAAI,QAAQ,YAAY;CACtB,UAAU;CACV,YAAY;CACZ,QAAQ,kFAAkF,KAAK,UAAU,MAAM,EAAE;AACnH,CAAC;AAEH,MAAM,oBACJ,MAAM,KAAkB,CAAC,CAAC,KACxB,MAAM,KAAK;CAAE,WAAW;CAAO,UAAU;AAAY,SACnD,OAAO,QAAsB,UAAU,CACzC,GACA,MAAM,KAAK;CAAE,WAAW;CAAO,UAAU;AAAY,SACnD,OAAO,QAAsB,UAAU,CACzC,GACA,MAAM,KAAK,EAAE,WAAW,MAAM,SAAS,OAAO,QAAsB,KAAK,CAAC,GAC1E,MAAM,KAAK;CAAE,WAAW;CAAO,UAAU;AAAO,SAC9C,OAAO,QAAsB,UAAU,CACzC,GACA,MAAM,KAAK,EAAE,WAAW,OAAO,SAAS,OAAO,QAAsB,MAAM,CAAC,GAC5E,MAAM,QAAQ,MAAM,OAAO,KAAK,kBAAkB,CAAC,CAAC,CAAC,CACvD;AAMF,MAAM,cAAc,QAAgB;CAElC,OAAO,IADS,IAAI,WAAW,yBA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* Inworld Realtime STT — `wss://api.inworld.ai/stt/v1/transcribe:streamBidirectional`.\n *\n * Auth: `Authorization: Basic <API_KEY>` on the WS upgrade header (matches\n * Inworld's own JS sample). Setting headers needs the `ws` peer dep\n * (Node/Bun); see `./wsAuth.ts`.\n *\n * Wire shape (per [inworld-ai/inworld-api-examples](https://github.com/inworld-ai/inworld-api-examples)):\n * client → server:\n * `{ \"transcribeConfig\": { modelId, audioEncoding, sampleRateHertz, language, ... } }` (first frame)\n * `{ \"audioChunk\": { \"content\": \"<base64 audio>\" } }` (×N)\n * `{ \"closeStream\": {} }` (end-of-input)\n * server → client:\n * `{ \"result\": { \"transcription\": { \"transcript\": \"...\", \"isFinal\": true|false } } }`\n * `{ \"result\": { \"speechStarted\": { \"startTimeMs\": ... } } }`\n * `{ \"result\": { \"speechStopped\": { \"silenceDurationMs\": ... } } }`\n *\n * Inworld's STT WS sends audio as base64 inside JSON (NOT binary frames),\n * matching the rest of the Inworld API style.\n */\nimport { Effect, Match, Option, Predicate, Redacted, Schema, Stream } from \"effect\"\nimport { Base64 } from \"effect/encoding\"\nimport * as Socket from \"effect/socket/Socket\"\nimport * as AiError from \"@effect-uai/core/AiError\"\nimport type { AudioFormat } from \"@effect-uai/core/Audio\"\nimport * as Capabilities from \"@effect-uai/core/Capabilities\"\nimport * as JSONL from \"@effect-uai/core/JSONL\"\nimport type { TranscriptEvent, WordTimestamp } from \"@effect-uai/core/Transcript\"\nimport type { CommonStreamTranscribeRequest } from \"@effect-uai/core/Transcriber\"\nimport * as WebSocketSession from \"@effect-uai/core/WebSocketSession\"\nimport { authedWsConstructor } from \"./wsAuth.js\"\n\nexport type Config = {\n readonly apiKey: Redacted.Redacted\n readonly baseUrl?: string\n /**\n * Build the socket yourself, for a proxy or an in-memory transport. The\n * default attaches the Basic auth header through the `ws` package.\n */\n readonly webSocket?: Socket.WebSocketConstructor[\"Service\"]\n}\n\n// ---------------------------------------------------------------------------\n// AudioFormat → `audioEncoding` slug for Inworld STT\n// ---------------------------------------------------------------------------\n\ntype WireEncoding = \"LINEAR16\" | \"MP3\" | \"OGG_OPUS\" | \"FLAC\"\n\nconst unsupportedFormat = (format: AudioFormat) =>\n new AiError.Unsupported({\n provider: \"inworld\",\n capability: \"inputFormat\",\n reason: `Inworld realtime STT accepts pcm_s16le (LINEAR16), mp3, ogg/opus, or flac. Got ${JSON.stringify(format)}.`,\n })\n\nconst inputFormatToWire: (format: AudioFormat) => Effect.Effect<WireEncoding, AiError.AiError> =\n Match.type<AudioFormat>().pipe(\n Match.when({ container: \"raw\", encoding: \"pcm_s16le\" }, () =>\n Effect.succeed<WireEncoding>(\"LINEAR16\"),\n ),\n Match.when({ container: \"wav\", encoding: \"pcm_s16le\" }, () =>\n Effect.succeed<WireEncoding>(\"LINEAR16\"),\n ),\n Match.when({ container: \"mp3\" }, () => Effect.succeed<WireEncoding>(\"MP3\")),\n Match.when({ container: \"ogg\", encoding: \"opus\" }, () =>\n Effect.succeed<WireEncoding>(\"OGG_OPUS\"),\n ),\n Match.when({ container: \"flac\" }, () => Effect.succeed<WireEncoding>(\"FLAC\")),\n Match.orElse((f) => Effect.fail(unsupportedFormat(f))),\n )\n\n// ---------------------------------------------------------------------------\n// URL + frame builders\n// ---------------------------------------------------------------------------\n\nconst buildWsUrl = (cfg: Config) => {\n const wsBase = (cfg.baseUrl ?? \"https://api.inworld.ai\").replace(/^http/, \"ws\")\n return `${wsBase}/stt/v1/transcribe:streamBidirectional`\n}\n\nconst configFrame = (encoding: WireEncoding, request: CommonStreamTranscribeRequest) =>\n JSON.stringify({\n transcribeConfig: {\n modelId: request.model,\n audioEncoding: encoding,\n sampleRateHertz: request.inputFormat.sampleRate,\n numberOfChannels: request.inputFormat.channels ?? 1,\n // Inworld's sample includes `language` even though docs mark it optional.\n // Default to en-US to match the sample's behavior; caller can override.\n language: request.language ?? \"en-US\",\n // `prompts` is a vocab-biasing term list — maps from `biasingTerms`.\n ...(request.biasingTerms !== undefined && { prompts: request.biasingTerms }),\n ...(request.wordTimestamps === true && { includeWordTimestamps: true }),\n },\n })\n\nconst audioChunkFrame = (bytes: Uint8Array) =>\n JSON.stringify({ audioChunk: { content: Base64.encode(bytes) } })\n\nconst endTurnFrame = JSON.stringify({ endTurn: {} })\nconst closeStreamFrame = JSON.stringify({ closeStream: {} })\n\n// ---------------------------------------------------------------------------\n// Wire schemas (server → client)\n// ---------------------------------------------------------------------------\n\nconst WireWord = Schema.Struct({\n word: Schema.String,\n startTimeMs: Schema.optional(Schema.Number),\n endTimeMs: Schema.optional(Schema.Number),\n confidence: Schema.optional(Schema.Number),\n})\n\nconst ResultBody = Schema.Struct({\n transcription: Schema.optional(\n Schema.Struct({\n transcript: Schema.String,\n isFinal: Schema.optional(Schema.Boolean),\n wordTimestamps: Schema.optional(Schema.NullOr(Schema.Array(WireWord))),\n }),\n ),\n speechStarted: Schema.optional(\n Schema.Struct({\n startTimeMs: Schema.optional(Schema.Number),\n confidence: Schema.optional(Schema.Number),\n }),\n ),\n speechStopped: Schema.optional(\n Schema.Struct({\n silenceDurationMs: Schema.optional(Schema.Number),\n }),\n ),\n status: Schema.optional(Schema.Unknown),\n})\n\nconst ServerFrame = Schema.Struct({\n result: Schema.optional(ResultBody),\n error: Schema.optional(Schema.Unknown),\n})\nconst decodeServerFrame = Schema.decodeUnknownEffect(ServerFrame)\n\nconst wireWordToCommon = (w: typeof WireWord.Type): WordTimestamp | undefined =>\n w.startTimeMs === undefined || w.endTimeMs === undefined\n ? undefined\n : {\n text: w.word,\n startSeconds: w.startTimeMs / 1000,\n endSeconds: w.endTimeMs / 1000,\n ...(w.confidence !== undefined && { confidence: w.confidence }),\n }\n\nexport const wireToEvent = (frame: typeof ServerFrame.Type): TranscriptEvent | undefined => {\n if (frame.error !== undefined) {\n return {\n _tag: \"error\",\n message: typeof frame.error === \"string\" ? frame.error : JSON.stringify(frame.error),\n }\n }\n const result = frame.result\n if (result === undefined) return undefined\n if (result.transcription !== undefined) {\n const t = result.transcription\n const words = t.wordTimestamps\n ?.map(wireWordToCommon)\n .filter((w): w is WordTimestamp => w !== undefined)\n return t.isFinal === true\n ? {\n _tag: \"final\",\n text: t.transcript,\n ...(words !== undefined && words.length > 0 && { words }),\n }\n : {\n _tag: \"partial\",\n text: t.transcript,\n ...(words !== undefined && words.length > 0 && { words }),\n }\n }\n if (result.speechStarted !== undefined) {\n return {\n _tag: \"speech-started\",\n atSeconds: (result.speechStarted.startTimeMs ?? 0) / 1000,\n }\n }\n if (result.speechStopped !== undefined) {\n return { _tag: \"utterance-ended\", atSeconds: 0 }\n }\n return undefined\n}\n\n/** One raw text frame to at most one event; unknown or malformed frames yield `undefined`. */\nconst frameToEvent = (raw: string): Effect.Effect<TranscriptEvent | undefined> =>\n Effect.gen(function* () {\n const json = yield* JSONL.parseSafe(raw)\n if (json === undefined) return undefined\n const decoded = yield* decodeServerFrame(json).pipe(Effect.option)\n return Option.match(decoded, { onNone: () => undefined, onSome: wireToEvent })\n })\n\n// ---------------------------------------------------------------------------\n// Stream<Uint8Array> → Stream<TranscriptEvent>\n// ---------------------------------------------------------------------------\n\nexport const streamTranscription =\n (cfg: Config) =>\n <E, R>(\n audioIn: Stream.Stream<Uint8Array, E, R>,\n request: CommonStreamTranscribeRequest,\n ): Stream.Stream<TranscriptEvent, AiError.AiError | E, R> =>\n Stream.unwrap(\n Effect.gen(function* () {\n yield* Capabilities.warnDroppedWhen(request.prompt, {\n provider: \"inworld\",\n capability: \"prompt\",\n field: \"prompt\",\n reason: \"Inworld STT has no free-form prompt field; bias via `biasingTerms`.\",\n })\n const encoding = yield* inputFormatToWire(request.inputFormat)\n const socket = yield* Socket.makeWebSocket(buildWsUrl(cfg)).pipe(\n Effect.provideService(\n Socket.WebSocketConstructor,\n cfg.webSocket ?? authedWsConstructor(cfg.apiKey),\n ),\n )\n const { write } = yield* socket.writer\n const asAiError = WebSocketSession.toAiError(\"inworld\")\n\n const events = Stream.fromPull(Socket.readerString(socket)).pipe(\n Stream.scoped,\n Stream.catchIf(WebSocketSession.isCleanClose, () => Stream.empty),\n Stream.mapError(asAiError),\n Stream.mapEffect(frameToEvent),\n Stream.filter(Predicate.isNotUndefined),\n )\n\n // `endTurn` flushes tail audio into a final transcript before `closeStream`.\n const outgoing = Stream.concat(\n Stream.make(configFrame(encoding, request)),\n Stream.concat(\n Stream.map(audioIn, audioChunkFrame),\n Stream.make(endTurnFrame, closeStreamFrame),\n ),\n ).pipe(Stream.mapEffect((frame) => Effect.mapError(write(frame), asAiError)))\n\n // The server's close ends the transcript; the audio running out does not.\n return Stream.merge(events, Stream.drain(outgoing), { haltStrategy: \"left\" })\n }),\n )\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,MAAM,qBAAqB,WACzB,IAAI,QAAQ,YAAY;CACtB,UAAU;CACV,YAAY;CACZ,QAAQ,kFAAkF,KAAK,UAAU,MAAM,EAAE;AACnH,CAAC;AAEH,MAAM,oBACJ,MAAM,KAAkB,CAAC,CAAC,KACxB,MAAM,KAAK;CAAE,WAAW;CAAO,UAAU;AAAY,SACnD,OAAO,QAAsB,UAAU,CACzC,GACA,MAAM,KAAK;CAAE,WAAW;CAAO,UAAU;AAAY,SACnD,OAAO,QAAsB,UAAU,CACzC,GACA,MAAM,KAAK,EAAE,WAAW,MAAM,SAAS,OAAO,QAAsB,KAAK,CAAC,GAC1E,MAAM,KAAK;CAAE,WAAW;CAAO,UAAU;AAAO,SAC9C,OAAO,QAAsB,UAAU,CACzC,GACA,MAAM,KAAK,EAAE,WAAW,OAAO,SAAS,OAAO,QAAsB,MAAM,CAAC,GAC5E,MAAM,QAAQ,MAAM,OAAO,KAAK,kBAAkB,CAAC,CAAC,CAAC,CACvD;AAMF,MAAM,cAAc,QAAgB;CAElC,OAAO,IADS,IAAI,WAAW,yBAAA,CAA0B,QAAQ,SAAS,IAC3D,EAAE;AACnB;AAEA,MAAM,eAAe,UAAwB,YAC3C,KAAK,UAAU,EACb,kBAAkB;CAChB,SAAS,QAAQ;CACjB,eAAe;C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AAM,SAAS;EAAE,cAAc,KAAA;EAAW,QAAQ;CAAY,CAAC;AAC/E,CAAC;AAMH,MAAa,uBACV,SAEC,SACA,YAEA,OAAO,OACL,OAAO,IAAI,aAAa;CACtB,OAAO,aAAa,gBAAgB,QAAQ,QAAQ;EAClD,UAAU;EACV,YAAY;EACZ,OAAO;EACP,QAAQ;CACV,CAAC;CACD,MAAM,WAAW,OAAO,kBAAkB,QAAQ,WAAW;CAC7D,MAAM,SAAS,OAAO,OAAO,cAAc,WAAW,GAAG,CAAC,CAAC,CAAC,KAC1D,OAAO,eACL,OAAO,sBACP,IAAI,aAAa,oBAAoB,IAAI,MAAM,CACjD,CACF;CACA,MAAM,EAAE,UAAU,OAAO,OAAO;CAChC,MAAM,YAAY,iBAAiB,UAAU,SAAS;CAEtD,MAAM,SAAS,OAAO,SAAS,OAAO,aAAa,MAAM,CAAC,CAAC,CAAC,KAC1D,OAAO,QACP,OAAO,QAAQ,iBAAiB,oBAAoB,OAAO,KAAK,GAChE,OAAO,SAAS,SAAS,GACzB,OAAO,UAAU,YAAY,GAC7B,OAAO,OAAO,UAAU,cAAc,CACxC;CAGA,MAAM,WAAW,OAAO,OACtB,OAAO,KAAK,YAAY,UAAU,OAAO,CAAC,GAC1C,OAAO,OACL,OAAO,IAAI,SAAS,eAAe,GACnC,OAAO,KAAK,cAAc,gBAAgB,CAC5C,CACF,CAAC,CAAC,KAAK,OAAO,WAAW,UAAU,OAAO,SAAS,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC;CAG5E,OAAO,OAAO,MAAM,QAAQ,OAAO,MAAM,QAAQ,GAAG,EAAE,cAAc,OAAO,CAAC;AAC9E,CAAC,CACH"}
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1,83 @@
1
+ import { streamTranscription } from "./realtimeStt.mjs";
2
+ import { n as globalExpect, r as describe, t as it } from "./dist-Cu2gIMHV.mjs";
3
+ import { Effect, Exit, Fiber, Redacted, Stream } from "effect";
4
+ import * as FakeWebSocket from "@effect-uai/core/testing/FakeWebSocket";
5
+ //#region src/realtimeStt.test.ts
6
+ const request = {
7
+ model: "inworld/inworld-stt-1",
8
+ inputFormat: {
9
+ container: "raw",
10
+ encoding: "pcm_s16le",
11
+ sampleRate: 16e3,
12
+ channels: 1
13
+ }
14
+ };
15
+ const transcribing = FakeWebSocket.make({ greeting: [
16
+ { result: { speechStarted: { startTimeMs: 1500 } } },
17
+ { result: { transcription: {
18
+ transcript: "hel",
19
+ isFinal: false
20
+ } } },
21
+ { result: { transcription: {
22
+ transcript: "hello",
23
+ isFinal: true
24
+ } } }
25
+ ] });
26
+ /** Run a transcription against `server`, closing it, if asked, once the frames are in. */
27
+ const transcribe = (server, audioIn, close) => Effect.gen(function* () {
28
+ const run = streamTranscription({
29
+ apiKey: Redacted.make("test-key"),
30
+ webSocket: server.connect
31
+ });
32
+ const collector = yield* Effect.forkChild(Effect.exit(Stream.runCollect(run(audioIn, request))));
33
+ if (close !== void 0) {
34
+ yield* server.greeted;
35
+ yield* server.awaitSent(close.afterSent ?? 0);
36
+ yield* server.close(close.code);
37
+ }
38
+ return yield* Fiber.join(collector);
39
+ });
40
+ describe("Inworld Realtime STT socket", () => {
41
+ it.live("sends the config before any audio, and ends on a clean close", () => Effect.gen(function* () {
42
+ const server = yield* transcribing;
43
+ const exit = yield* transcribe(server, Stream.make(new Uint8Array([1, 2])), {
44
+ code: 1e3,
45
+ afterSent: 4
46
+ });
47
+ globalExpect(exit).toEqual(Exit.succeed([
48
+ {
49
+ _tag: "speech-started",
50
+ atSeconds: 1.5
51
+ },
52
+ {
53
+ _tag: "partial",
54
+ text: "hel"
55
+ },
56
+ {
57
+ _tag: "final",
58
+ text: "hello"
59
+ }
60
+ ]));
61
+ const sent = yield* server.sent;
62
+ globalExpect(sent.map((f) => Object.keys(f)[0])).toEqual([
63
+ "transcribeConfig",
64
+ "audioChunk",
65
+ "endTurn",
66
+ "closeStream"
67
+ ]);
68
+ }).pipe(Effect.scoped));
69
+ it.live("fails rather than ending when the connection drops", () => Effect.gen(function* () {
70
+ const server = yield* transcribing;
71
+ const exit = yield* transcribe(server, Stream.never, { code: 1011 });
72
+ globalExpect(Exit.isFailure(exit) && JSON.stringify(exit.cause)).toContain("Unavailable");
73
+ }).pipe(Effect.scoped));
74
+ it.live("fails with the audio input's own error", () => Effect.gen(function* () {
75
+ const server = yield* transcribing;
76
+ const exit = yield* transcribe(server, Stream.fail("microphone unplugged"));
77
+ globalExpect(Exit.isFailure(exit) && JSON.stringify(exit.cause)).toContain("microphone unplugged");
78
+ }).pipe(Effect.scoped));
79
+ });
80
+ //#endregion
81
+ export {};
82
+
83
+ //# sourceMappingURL=realtimeStt.test.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realtimeStt.test.mjs","names":[],"sources":["../src/realtimeStt.test.ts"],"sourcesContent":["import { describe, it } from \"@effect/vitest\"\nimport { Effect, Exit, Fiber, Redacted, Stream } from \"effect\"\nimport { expect } from \"vitest\"\nimport * as FakeWebSocket from \"@effect-uai/core/testing/FakeWebSocket\"\nimport { streamTranscription } from \"./realtimeStt.js\"\n\nconst pcm = { container: \"raw\", encoding: \"pcm_s16le\", sampleRate: 16000, channels: 1 } as const\n\nconst request = { model: \"inworld/inworld-stt-1\", inputFormat: pcm }\n\nconst transcribing = FakeWebSocket.make({\n greeting: [\n { result: { speechStarted: { startTimeMs: 1500 } } },\n { result: { transcription: { transcript: \"hel\", isFinal: false } } },\n { result: { transcription: { transcript: \"hello\", isFinal: true } } },\n ],\n})\n\n/** Run a transcription against `server`, closing it, if asked, once the frames are in. */\nconst transcribe = <E>(\n server: FakeWebSocket.FakeWebSocketServer,\n audioIn: Stream.Stream<Uint8Array, E>,\n close?: { readonly code: number; readonly afterSent?: number },\n) =>\n Effect.gen(function* () {\n const run = streamTranscription({\n apiKey: Redacted.make(\"test-key\"),\n webSocket: server.connect,\n })\n const collector = yield* Effect.forkChild(Effect.exit(Stream.runCollect(run(audioIn, request))))\n if (close !== undefined) {\n yield* server.greeted\n yield* server.awaitSent(close.afterSent ?? 0)\n yield* server.close(close.code)\n }\n return yield* Fiber.join(collector)\n })\n\ndescribe(\"Inworld Realtime STT socket\", () => {\n it.live(\"sends the config before any audio, and ends on a clean close\", () =>\n Effect.gen(function* () {\n const server = yield* transcribing\n const exit = yield* transcribe(server, Stream.make(new Uint8Array([1, 2])), {\n code: 1000,\n afterSent: 4,\n })\n\n expect(exit).toEqual(\n Exit.succeed([\n { _tag: \"speech-started\", atSeconds: 1.5 },\n { _tag: \"partial\", text: \"hel\" },\n { _tag: \"final\", text: \"hello\" },\n ]),\n )\n const sent = (yield* server.sent) as ReadonlyArray<Record<string, unknown>>\n expect(sent.map((f) => Object.keys(f)[0])).toEqual([\n \"transcribeConfig\",\n \"audioChunk\",\n \"endTurn\",\n \"closeStream\",\n ])\n }).pipe(Effect.scoped),\n )\n\n it.live(\"fails rather than ending when the connection drops\", () =>\n Effect.gen(function* () {\n const server = yield* transcribing\n const exit = yield* transcribe(server, Stream.never, { code: 1011 })\n\n expect(Exit.isFailure(exit) && JSON.stringify(exit.cause)).toContain(\"Unavailable\")\n }).pipe(Effect.scoped),\n )\n\n it.live(\"fails with the audio input's own error\", () =>\n Effect.gen(function* () {\n const server = yield* transcribing\n const exit = yield* transcribe(server, Stream.fail(\"microphone unplugged\"))\n\n expect(Exit.isFailure(exit) && JSON.stringify(exit.cause)).toContain(\"microphone unplugged\")\n }).pipe(Effect.scoped),\n )\n})\n"],"mappings":";;;;;AAQA,MAAM,UAAU;CAAE,OAAO;CAAyB,aAAa;EAFjD,WAAW;EAAO,UAAU;EAAa,YAAY;EAAO,UAAU;CAEnB;AAAE;AAEnE,MAAM,eAAe,cAAc,KAAK,EACtC,UAAU;CACR,EAAE,QAAQ,EAAE,eAAe,EAAE,aAAa,KAAK,EAAE,EAAE;CACnD,EAAE,QAAQ,EAAE,eAAe;EAAE,YAAY;EAAO,SAAS;CAAM,EAAE,EAAE;CACnE,EAAE,QAAQ,EAAE,eAAe;EA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U,IAAI,KAAK,KAAK,UAAU,KAAK,KAAK,CAAC,CAAC,CAAC,UAAU,aAAa;CACpF,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM,CACvB;CAEA,GAAG,KAAK,gDACN,OAAO,IAAI,aAAa;EACtB,MAAM,SAAS,OAAO;EACtB,MAAM,OAAO,OAAO,WAAW,QAAQ,OAAO,KAAK,sBAAsB,CAAC;EAE1E,aAAO,KAAK,UAAU,IAAI,KAAK,KAAK,UAAU,KAAK,KAAK,CAAC,CAAC,CAAC,UAAU,sBAAsB;CAC7F,CAAC,CAAC,CAAC,KAAK,OAAO,MAAM,CACvB;AACF,CAAC"}
@@ -2,11 +2,17 @@ import { a as InworldVoiceId, i as InworldTtsModel, n as InworldDeliveryMode } f
2
2
  import { Redacted, Stream } from "effect";
3
3
  import { CustomPronunciation } from "@effect-uai/core/SpeechSynthesizer";
4
4
  import * as AiError from "@effect-uai/core/AiError";
5
+ import * as Socket from "effect/socket/Socket";
5
6
  import { AudioChunk, AudioFormat } from "@effect-uai/core/Audio";
6
7
  //#region src/realtimeTts.d.ts
7
8
  type Config = {
8
9
  readonly apiKey: Redacted.Redacted;
9
10
  readonly baseUrl?: string;
11
+ /**
12
+ * Build the socket yourself, for a proxy or an in-memory transport. The
13
+ * default attaches the Basic auth header through the `ws` package.
14
+ */
15
+ readonly webSocket?: Socket.WebSocketConstructor["Service"];
10
16
  };
11
17
  /**
12
18
  * Incremental-text-in request. Mirrors the sync request minus `text` (which
@@ -1 +1 @@
1
- {"version":3,"file":"realtimeTts.d.mts","names":[],"sources":["../src/realtimeTts.ts"],"mappings":";;;;;;KA+BY;WAAoB,QAAQ,SAAS;WAAmB;;;;;;KAMxD;WACD,OAAO;WACP,SAAS;WACT,eAAe;WACf;WACA;WACA,eAAe;WACf;WACA;;;WAGA,iBAAiB,cAAc;;cAO7B,aAAU,KAAS;cA8EnB,kBAAe,KACpB,YACL,GAAG,GAAC,QACK,OAAO,eAAe,GAAG,IAAE,SAC1B,4BACR,OAAO,OAAO,YAAY,QAAQ,UAAU,GAAG"}
1
+ {"version":3,"file":"realtimeTts.d.mts","names":[],"sources":["../src/realtimeTts.ts"],"mappings":";;;;;;;KAgCY;WACD,QAAQ,SAAS;WACjB;;;;;WAKA,YAAY,OAAO;;;;;;KAOlB;WACD,OAAO;WACP,SAAS;WACT,eAAe;WACf;WACA;WACA,eAAe;WACf;WACA;;;WAGA,iBAAiB,cAAc;;cAO7B,aAAU,KAAS;cAkFnB,kBAAe,KACpB,YACL,GAAG,GAAC,QACK,OAAO,eAAe,GAAG,IAAE,SAC1B,4BACR,OAAO,OAAO,YAAY,QAAQ,UAAU,GAAG"}