@jswork/audio-recorder-kit 1.0.1 → 1.0.3

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/afei/github/audio-recorder-kit/dist/index.esm.js","../node_modules/.pnpm/js-audio-recorder@1.0.7/node_modules/js-audio-recorder/dist/recorder.js","../node_modules/.pnpm/js-audio-recorder@1.0.7/node_modules/js-audio-recorder/index.js","../src/index.ts","../node_modules/.pnpm/media-devices@0.5.0/node_modules/media-devices/dist/media-devices.js","../src/errors.ts"],"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__commonJS","cb","mod","__require","exports","__copyProps","to","from","except","desc","key","call","get","enumerable","__toESM","isNodeMode","target","__esModule","value","require_recorder","module","t","e","define","amd","Recorder","n","i","o","l","m","c","d","r","Symbol","toStringTag","bind","default","p","s","length","setUint8","charCodeAt","compress","Math","max","left","a","right","floor","u","Float32Array","f","encodePCM","ArrayBuffer","DataView","min","setInt8","setInt16","encodeWAV","byteLength","setUint32","setUint16","getUint8","__extends","setPrototypeOf","__proto__","Array","isrecording","ispause","isplaying","setOption","setNewOption","start","Promise","reject","startRecord","pause","pauseRecord","resume","resumeRecord","stop","stopRecord","play","onplay","addPlayEnd","onplayend","getWAV","buffer","getPlayTime","pausePlay","onpauseplay","resumePlay","onresumeplay","stopPlay","onstopplay","destroy","destroyPlay","destroyRecord","getRecordAnalyseData","getAnalyseData","getPlayAnalyseData","getPCM","getData","inputSampleRate","outputSampleRate","oututSampleBits","littleEdian","getPCMBlob","Blob","downloadPCM","config","numChannels","getWAVBlob","type","downloadWAV","download","getChannelData","sampleBits","getInt16","getInt8","document","createElement","href","window","URL","createObjectURL","click","decodeAudioData","slice","createBufferSource","onended","currentTime","connect","destination","throwError","h","y","AudioContext","webkitAudioContext","createAnalyser","fftSize","Uint8Array","frequencyBinCount","getByteTimeDomainData","Error","size","lBuffer","rBuffer","tempPCM","inputSampleBits","fileSize","duration","needRecord","sampleRate","Int16Array","initUserMedia","indexOf","context","initRecorder","navigator","mediaDevices","getUserMedia","audio","then","audioInput","createMediaStreamSource","stream","analyser","recorder","disconnect","source","clearRecordStatus","stopStream","closeAudioContext","flat","PCM","set","createScriptProcessor","createJavaScriptNode","apply","onaudioprocess","inputBuffer","push","onprocess","onprogress","vol","getTracks","forEach","close","state","webkitGetUserMedia","mozGetUserMedia","transformIntoPCM","getPermission","require_js_audio_recorder","import_js_audio_recorder","configurable","writable","g","enumerateDevices","filter","map","deviceId","label","kind","groupId","I","getDisplayMedia","_gainedScreenAccessOnce","_checkForDeviceChanges","getSupportedConstraints","addEventListener","ondevicechange","resolve","_knownDevices","_calculateDeviceDiff","changes","devices","findIndex","_","splice","v","newInfo","oldInfo","device","M","AudioRecorderError","_AudioRecorderError","code","message","rawError","name","mapDOMExceptionToErrorCode","err","AudioRecorder","_AudioRecorder","options","_state","_duration","_isAutoStopping","_recorder","maxDuration","Number","isFinite","_createRecorder","_supportsMediaDevices","publicOptions","_options","cfg","isSupported","wrapped","_attachRecorderHooks","onError","blob","filename","file","url","Date","now","File","payload","round","onTimeUpdate","waveData","fill","onWaveDataUpdate","onMaxReach","catch","hasAudioContext","checkPermission","status","permissions","query","track"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AA;;gCAC5C;;oCAAO;;;gCACAyJ;gCACDL,OAAOI,2BAA2BC;gCACxC,IAAIL,SAAS,qBAAqB;;oCAAO;;gCACzC,MAAM,IAAIF,mBAAmBE,MAAM,2BAA2BK;;;;;;;gBAElE;;;;;;AHqjBF,SACEP,kBAAkB,EAClBQ,iBAAiBtM,OAAO,EACxBoM,0BAA0B,GAC1B,CACF;;;;;;;;;;;;;AAaA","sourcesContent":["/*!\n * name: @jswork/audio-recorder-kit\n * description: Browser audio recorder with realtime waveform callback.\n * homepage: https://js.work\n * version: 1.0.1\n * date: 2026-10-25 11:44:23\n * license: MIT\n */\n\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\n\n// node_modules/.pnpm/js-audio-recorder@1.0.7/node_modules/js-audio-recorder/dist/recorder.js\nvar require_recorder = __commonJS({\n \"node_modules/.pnpm/js-audio-recorder@1.0.7/node_modules/js-audio-recorder/dist/recorder.js\"(exports, module) {\n \"use strict\";\n !(function(t, e) {\n \"object\" == typeof exports && \"object\" == typeof module ? module.exports = e() : \"function\" == typeof define && define.amd ? define([], e) : \"object\" == typeof exports ? exports.Recorder = e() : t.Recorder = e();\n })(exports, function() {\n return (function(t) {\n var e = {};\n function n(i) {\n if (e[i]) return e[i].exports;\n var o2 = e[i] = { i, l: false, exports: {} };\n return t[i].call(o2.exports, o2, o2.exports, n), o2.l = true, o2.exports;\n }\n return n.m = t, n.c = e, n.d = function(t2, e2, i) {\n n.o(t2, e2) || Object.defineProperty(t2, e2, { enumerable: true, get: i });\n }, n.r = function(t2) {\n \"undefined\" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t2, Symbol.toStringTag, { value: \"Module\" }), Object.defineProperty(t2, \"__esModule\", { value: true });\n }, n.t = function(t2, e2) {\n if (1 & e2 && (t2 = n(t2)), 8 & e2) return t2;\n if (4 & e2 && \"object\" == typeof t2 && t2 && t2.__esModule) return t2;\n var i = /* @__PURE__ */ Object.create(null);\n if (n.r(i), Object.defineProperty(i, \"default\", { enumerable: true, value: t2 }), 2 & e2 && \"string\" != typeof t2) for (var o2 in t2) n.d(i, o2, function(e3) {\n return t2[e3];\n }.bind(null, o2));\n return i;\n }, n.n = function(t2) {\n var e2 = t2 && t2.__esModule ? function() {\n return t2.default;\n } : function() {\n return t2;\n };\n return n.d(e2, \"a\", e2), e2;\n }, n.o = function(t2, e2) {\n return Object.prototype.hasOwnProperty.call(t2, e2);\n }, n.p = \"\", n(n.s = 1);\n })([function(t, e, n) {\n \"use strict\";\n function i(t2, e2, n2) {\n for (var i2 = 0; i2 < n2.length; i2++) t2.setUint8(e2 + i2, n2.charCodeAt(i2));\n }\n Object.defineProperty(e, \"__esModule\", { value: true }), e.compress = function(t2, e2, n2) {\n for (var i2 = e2 / n2, o2 = Math.max(i2, 1), r2 = t2.left, a = t2.right, s = Math.floor((r2.length + a.length) / i2), u = new Float32Array(s), c2 = 0, l = 0; c2 < s; ) {\n var f2 = Math.floor(l);\n u[c2] = r2[f2], c2++, a.length && (u[c2] = a[f2], c2++), l += o2;\n }\n return u;\n }, e.encodePCM = function(t2, e2, n2) {\n void 0 === n2 && (n2 = true);\n var i2 = 0, o2 = t2.length * (e2 / 8), r2 = new ArrayBuffer(o2), a = new DataView(r2);\n if (8 === e2) for (var s = 0; s < t2.length; s++, i2++) {\n var u = (c2 = Math.max(-1, Math.min(1, t2[s]))) < 0 ? 128 * c2 : 127 * c2;\n u = +u + 128, a.setInt8(i2, u);\n }\n else for (s = 0; s < t2.length; s++, i2 += 2) {\n var c2 = Math.max(-1, Math.min(1, t2[s]));\n a.setInt16(i2, c2 < 0 ? 32768 * c2 : 32767 * c2, n2);\n }\n return a;\n }, e.encodeWAV = function(t2, e2, n2, o2, r2, a) {\n void 0 === a && (a = true);\n var s = n2 > e2 ? e2 : n2, u = r2, c2 = new ArrayBuffer(44 + t2.byteLength), l = new DataView(c2), f2 = o2, p2 = 0;\n i(l, p2, \"RIFF\"), p2 += 4, l.setUint32(p2, 36 + t2.byteLength, a), i(l, p2 += 4, \"WAVE\"), i(l, p2 += 4, \"fmt \"), p2 += 4, l.setUint32(p2, 16, a), p2 += 4, l.setUint16(p2, 1, a), p2 += 2, l.setUint16(p2, f2, a), p2 += 2, l.setUint32(p2, s, a), p2 += 4, l.setUint32(p2, f2 * s * (u / 8), a), p2 += 4, l.setUint16(p2, f2 * (u / 8), a), p2 += 2, l.setUint16(p2, u, a), i(l, p2 += 2, \"data\"), p2 += 4, l.setUint32(p2, t2.byteLength, a), p2 += 4;\n for (var d = 0; d < t2.byteLength; ) l.setUint8(p2, t2.getUint8(d)), p2++, d++;\n return l;\n };\n }, function(t, e, n) {\n \"use strict\";\n var i, o2 = this && this.__extends || (i = function(t2, e2) {\n return (i = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t3, e3) {\n t3.__proto__ = e3;\n } || function(t3, e3) {\n for (var n2 in e3) e3.hasOwnProperty(n2) && (t3[n2] = e3[n2]);\n })(t2, e2);\n }, function(t2, e2) {\n function n2() {\n this.constructor = t2;\n }\n i(t2, e2), t2.prototype = null === e2 ? Object.create(e2) : (n2.prototype = e2.prototype, new n2());\n });\n Object.defineProperty(e, \"__esModule\", { value: true });\n var r2 = n(2), a = n(0), s = n(3), u = (function(t2) {\n function e2(e3) {\n void 0 === e3 && (e3 = {});\n var n2 = t2.call(this, e3) || this;\n return n2.isrecording = false, n2.ispause = false, n2.isplaying = false, n2;\n }\n return o2(e2, t2), e2.prototype.setOption = function(t3) {\n void 0 === t3 && (t3 = {}), this.setNewOption(t3);\n }, e2.prototype.start = function() {\n return this.isrecording ? Promise.reject() : (this.isrecording = true, this.startRecord());\n }, e2.prototype.pause = function() {\n this.isrecording && !this.ispause && (this.ispause = true, this.pauseRecord());\n }, e2.prototype.resume = function() {\n this.isrecording && this.ispause && (this.ispause = false, this.resumeRecord());\n }, e2.prototype.stop = function() {\n this.isrecording && (this.isrecording = false, this.ispause = false, this.stopRecord());\n }, e2.prototype.play = function() {\n this.stop(), this.isplaying = true, this.onplay && this.onplay(), s.default.addPlayEnd(this.onplayend);\n var t3 = this.getWAV();\n t3.byteLength > 44 && s.default.play(t3.buffer);\n }, e2.prototype.getPlayTime = function() {\n return s.default.getPlayTime();\n }, e2.prototype.pausePlay = function() {\n !this.isrecording && this.isplaying && (this.isplaying = false, this.onpauseplay && this.onpauseplay(), s.default.pausePlay());\n }, e2.prototype.resumePlay = function() {\n this.isrecording || this.isplaying || (this.isplaying = true, this.onresumeplay && this.onresumeplay(), s.default.resumePlay());\n }, e2.prototype.stopPlay = function() {\n this.isrecording || (this.isplaying = false, this.onstopplay && this.onstopplay(), s.default.stopPlay());\n }, e2.prototype.destroy = function() {\n return s.default.destroyPlay(), this.destroyRecord();\n }, e2.prototype.getRecordAnalyseData = function() {\n return this.getAnalyseData();\n }, e2.prototype.getPlayAnalyseData = function() {\n return s.default.getAnalyseData();\n }, e2.prototype.getPCM = function() {\n this.stop();\n var t3 = this.getData();\n return t3 = a.compress(t3, this.inputSampleRate, this.outputSampleRate), a.encodePCM(t3, this.oututSampleBits, this.littleEdian);\n }, e2.prototype.getPCMBlob = function() {\n return new Blob([this.getPCM()]);\n }, e2.prototype.downloadPCM = function(t3) {\n void 0 === t3 && (t3 = \"recorder\");\n var e3 = this.getPCMBlob();\n r2.downloadPCM(e3, t3);\n }, e2.prototype.getWAV = function() {\n var t3 = this.getPCM();\n return a.encodeWAV(t3, this.inputSampleRate, this.outputSampleRate, this.config.numChannels, this.oututSampleBits, this.littleEdian);\n }, e2.prototype.getWAVBlob = function() {\n return new Blob([this.getWAV()], { type: \"audio/wav\" });\n }, e2.prototype.downloadWAV = function(t3) {\n void 0 === t3 && (t3 = \"recorder\");\n var e3 = this.getWAVBlob();\n r2.downloadWAV(e3, t3);\n }, e2.prototype.download = function(t3, e3, n2) {\n r2.download(t3, e3, n2);\n }, e2.prototype.getChannelData = function() {\n var t3 = this.getPCM(), e3 = t3.byteLength, n2 = this.littleEdian, i2 = { left: null, right: null };\n if (2 === this.config.numChannels) {\n var o3 = new DataView(new ArrayBuffer(e3 / 2)), r3 = new DataView(new ArrayBuffer(e3 / 2));\n if (16 === this.config.sampleBits) for (var a2 = 0; a2 < e3 / 2; a2 += 2) o3.setInt16(a2, t3.getInt16(2 * a2, n2), n2), r3.setInt16(a2, t3.getInt16(2 * a2 + 2, n2), n2);\n else for (a2 = 0; a2 < e3 / 2; a2 += 2) o3.setInt8(a2, t3.getInt8(2 * a2)), r3.setInt8(a2, t3.getInt8(2 * a2 + 1));\n i2.left = o3, i2.right = r3;\n } else i2.left = t3;\n return i2;\n }, e2;\n })(n(5).default);\n e.default = u;\n }, function(t, e, n) {\n \"use strict\";\n function i(t2, e2, n2) {\n var i2 = document.createElement(\"a\");\n i2.href = window.URL.createObjectURL(t2), i2.download = e2 + \".\" + n2, i2.click();\n }\n Object.defineProperty(e, \"__esModule\", { value: true }), e.downloadWAV = function(t2, e2) {\n void 0 === e2 && (e2 = \"recorder\"), i(t2, e2, \"wav\");\n }, e.downloadPCM = function(t2, e2) {\n void 0 === e2 && (e2 = \"recorder\"), i(t2, e2, \"pcm\");\n }, e.download = function(t2, e2, n2) {\n return i(t2, e2, n2);\n };\n }, function(t, e, n) {\n \"use strict\";\n Object.defineProperty(e, \"__esModule\", { value: true });\n var i = n(4), o2 = null, r2 = 0, a = 0, s = null, u = null, c2 = null, l = false, f2 = 0, p2 = function() {\n };\n function d() {\n return l = false, s.decodeAudioData(c2.slice(0), function(t2) {\n (o2 = s.createBufferSource()).onended = function() {\n l || (f2 = s.currentTime - a + r2, p2());\n }, o2.buffer = t2, o2.connect(u), u.connect(s.destination), o2.start(0, r2), a = s.currentTime;\n }, function(t2) {\n i.throwError(t2);\n });\n }\n function h2() {\n o2 && (o2.stop(), o2 = null);\n }\n var y2 = (function() {\n function t2() {\n }\n return t2.play = function(t3) {\n return s || (s = new (window.AudioContext || window.webkitAudioContext)(), (u = s.createAnalyser()).fftSize = 2048), this.stopPlay(), c2 = t3, f2 = 0, d();\n }, t2.pausePlay = function() {\n h2(), r2 += s.currentTime - a, l = true;\n }, t2.resumePlay = function() {\n return d();\n }, t2.stopPlay = function() {\n r2 = 0, c2 = null, h2();\n }, t2.destroyPlay = function() {\n this.stopPlay();\n }, t2.getAnalyseData = function() {\n var t3 = new Uint8Array(u.frequencyBinCount);\n return u.getByteTimeDomainData(t3), t3;\n }, t2.addPlayEnd = function(t3) {\n void 0 === t3 && (t3 = function() {\n }), p2 = t3;\n }, t2.getPlayTime = function() {\n var t3 = l ? r2 : s.currentTime - a + r2;\n return f2 || t3;\n }, t2;\n })();\n e.default = y2;\n }, function(t, e, n) {\n \"use strict\";\n Object.defineProperty(e, \"__esModule\", { value: true }), e.throwError = function(t2) {\n throw new Error(t2);\n };\n }, function(t, e, n) {\n \"use strict\";\n Object.defineProperty(e, \"__esModule\", { value: true });\n var i = n(0), o2 = (function() {\n function t2(e2) {\n void 0 === e2 && (e2 = {}), this.size = 0, this.lBuffer = [], this.rBuffer = [], this.tempPCM = [], this.inputSampleBits = 16, this.fileSize = 0, this.duration = 0, this.needRecord = true;\n var n2, i2 = new (window.AudioContext || window.webkitAudioContext)();\n this.inputSampleRate = i2.sampleRate, this.setNewOption(e2), this.littleEdian = (n2 = new ArrayBuffer(2), new DataView(n2).setInt16(0, 256, true), 256 === new Int16Array(n2)[0]), t2.initUserMedia();\n }\n return t2.prototype.setNewOption = function(t3) {\n void 0 === t3 && (t3 = {}), this.config = { sampleBits: ~[8, 16].indexOf(t3.sampleBits) ? t3.sampleBits : 16, sampleRate: ~[8e3, 11025, 16e3, 22050, 24e3, 44100, 48e3].indexOf(t3.sampleRate) ? t3.sampleRate : this.inputSampleRate, numChannels: ~[1, 2].indexOf(t3.numChannels) ? t3.numChannels : 1 }, this.outputSampleRate = this.config.sampleRate, this.oututSampleBits = this.config.sampleBits;\n }, t2.prototype.startRecord = function() {\n var t3 = this;\n return this.context && this.destroyRecord(), this.initRecorder(), navigator.mediaDevices.getUserMedia({ audio: true }).then(function(e2) {\n t3.audioInput = t3.context.createMediaStreamSource(e2), t3.stream = e2;\n }).then(function() {\n t3.audioInput.connect(t3.analyser), t3.analyser.connect(t3.recorder), t3.recorder.connect(t3.context.destination);\n });\n }, t2.prototype.pauseRecord = function() {\n this.needRecord = false;\n }, t2.prototype.resumeRecord = function() {\n this.needRecord = true;\n }, t2.prototype.stopRecord = function() {\n this.audioInput && this.audioInput.disconnect(), this.source && this.source.stop(), this.recorder.disconnect(), this.analyser.disconnect(), this.needRecord = true;\n }, t2.prototype.destroyRecord = function() {\n return this.clearRecordStatus(), this.stopStream(), this.closeAudioContext();\n }, t2.prototype.getAnalyseData = function() {\n var t3 = new Uint8Array(this.analyser.frequencyBinCount);\n return this.analyser.getByteTimeDomainData(t3), t3;\n }, t2.prototype.getData = function() {\n return this.flat();\n }, t2.prototype.clearRecordStatus = function() {\n this.lBuffer.length = 0, this.rBuffer.length = 0, this.size = 0, this.fileSize = 0, this.PCM = null, this.audioInput = null, this.duration = 0;\n }, t2.prototype.flat = function() {\n var t3 = null, e2 = new Float32Array(0);\n 1 === this.config.numChannels ? t3 = new Float32Array(this.size) : (t3 = new Float32Array(this.size / 2), e2 = new Float32Array(this.size / 2));\n for (var n2 = 0, i2 = 0; i2 < this.lBuffer.length; i2++) t3.set(this.lBuffer[i2], n2), n2 += this.lBuffer[i2].length;\n n2 = 0;\n for (i2 = 0; i2 < this.rBuffer.length; i2++) e2.set(this.rBuffer[i2], n2), n2 += this.rBuffer[i2].length;\n return { left: t3, right: e2 };\n }, t2.prototype.initRecorder = function() {\n var t3 = this;\n this.clearRecordStatus(), this.context = new (window.AudioContext || window.webkitAudioContext)(), this.analyser = this.context.createAnalyser(), this.analyser.fftSize = 2048;\n var e2 = this.context.createScriptProcessor || this.context.createJavaScriptNode;\n this.recorder = e2.apply(this.context, [4096, this.config.numChannels, this.config.numChannels]), this.recorder.onaudioprocess = function(e3) {\n if (t3.needRecord) {\n var n2, i2 = e3.inputBuffer.getChannelData(0), o3 = null;\n t3.lBuffer.push(new Float32Array(i2)), t3.size += i2.length, 2 === t3.config.numChannels && (o3 = e3.inputBuffer.getChannelData(1), t3.rBuffer.push(new Float32Array(o3)), t3.size += o3.length), t3.fileSize = Math.floor(t3.size / Math.max(t3.inputSampleRate / t3.outputSampleRate, 1)) * (t3.oututSampleBits / 8), n2 = 100 * Math.max.apply(Math, i2), t3.duration += 4096 / t3.inputSampleRate, t3.onprocess && t3.onprocess(t3.duration), t3.onprogress && t3.onprogress({ duration: t3.duration, fileSize: t3.fileSize, vol: n2 });\n }\n };\n }, t2.prototype.stopStream = function() {\n this.stream && this.stream.getTracks && (this.stream.getTracks().forEach(function(t3) {\n return t3.stop();\n }), this.stream = null);\n }, t2.prototype.closeAudioContext = function() {\n return this.context && this.context.close && \"closed\" !== this.context.state ? this.context.close() : new Promise(function(t3) {\n t3();\n });\n }, t2.initUserMedia = function() {\n void 0 === navigator.mediaDevices && (navigator.mediaDevices = {}), void 0 === navigator.mediaDevices.getUserMedia && (navigator.mediaDevices.getUserMedia = function(t3) {\n var e2 = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;\n return e2 ? new Promise(function(n2, i2) {\n e2.call(navigator, t3, n2, i2);\n }) : Promise.reject(new Error(\"\\u6D4F\\u89C8\\u5668\\u4E0D\\u652F\\u6301 getUserMedia !\"));\n });\n }, t2.prototype.transformIntoPCM = function(t3, e2) {\n var n2 = new Float32Array(t3), o3 = new Float32Array(e2), r2 = i.compress({ left: n2, right: o3 }, this.inputSampleRate, this.outputSampleRate);\n return i.encodePCM(r2, this.oututSampleBits, this.littleEdian);\n }, t2.getPermission = function() {\n return this.initUserMedia(), navigator.mediaDevices.getUserMedia({ audio: true }).then(function(t3) {\n t3 && t3.getTracks().forEach(function(t4) {\n return t4.stop();\n });\n });\n }, t2;\n })();\n e.default = o2;\n }]).default;\n });\n }\n});\n\n// node_modules/.pnpm/js-audio-recorder@1.0.7/node_modules/js-audio-recorder/index.js\nvar require_js_audio_recorder = __commonJS({\n \"node_modules/.pnpm/js-audio-recorder@1.0.7/node_modules/js-audio-recorder/index.js\"(exports, module) {\n \"use strict\";\n module.exports = require_recorder();\n }\n});\n\n// src/index.ts\nvar import_js_audio_recorder = __toESM(require_js_audio_recorder());\n\n// node_modules/.pnpm/media-devices@0.5.0/node_modules/media-devices/dist/media-devices.js\nvar f = Object.defineProperty;\nvar p = (e, t, n) => t in e ? f(e, t, { enumerable: true, configurable: true, writable: true, value: n }) : e[t] = n;\nvar r = (e, t, n) => (p(e, typeof t != \"symbol\" ? t + \"\" : t, n), n);\nfunction o() {\n return typeof navigator < \"u\" && !!navigator.mediaDevices;\n}\nfunction c() {\n if (!o())\n throw new Error(\"The media devices API isn't supported here.\");\n return navigator.mediaDevices;\n}\nasync function g() {\n return (await c().enumerateDevices()).filter(h).map(m);\n}\nfunction h(e) {\n return e.deviceId !== \"default\";\n}\nfunction m(e) {\n return {\n label: e.label || null,\n kind: e.kind,\n deviceId: e.deviceId || null,\n groupId: e.groupId || null\n };\n}\nasync function I(e) {\n return c().getUserMedia(e);\n}\nvar y = class {\n constructor() {\n r(this, \"_knownDevices\", []);\n r(this, \"_gainedScreenAccessOnce\", false);\n r(this, \"ondevicechange\", null);\n r(this, \"getUserMedia\", async (t) => {\n const n = await I(t);\n return this.enumerateDevices(), n;\n });\n r(this, \"getDisplayMedia\", async (t) => {\n const n = await c().getDisplayMedia(t);\n return this._gainedScreenAccessOnce || (this._gainedScreenAccessOnce = true, this.enumerateDevices()), n;\n });\n r(this, \"enumerateDevices\", async () => {\n const t = await g();\n return this._checkForDeviceChanges(t), t;\n });\n r(this, \"getSupportedConstraints\", () => c().getSupportedConstraints());\n o() && c().addEventListener(\"devicechange\", () => this.ondevicechange ? this.enumerateDevices() : Promise.resolve());\n }\n _checkForDeviceChanges(t) {\n var a;\n const n = this._knownDevices;\n this._knownDevices = t;\n const i = this._calculateDeviceDiff(\n t,\n n\n );\n i.length && ((a = this.ondevicechange) == null || a.call(this, { changes: i, devices: t }));\n }\n /**\n * Note: The device enumeration API may return null values for device IDs\n * and labels. To avoid creating erroneous \"Device Added\" notifications,\n * a best effort should be made to detect when devices are identical.\n *\n * Order is significant. Preferred devices are listed first, which helps\n * correlate devices from permissioned requests with unpermissioned\n * requests.\n */\n _calculateDeviceDiff(t, n) {\n const i = n.slice(), a = [], l = t.filter((s) => {\n const d = i.findIndex((u) => _(s, u));\n if (d > -1) {\n const [u] = i.splice(d, 1);\n if (s.label !== u.label) {\n const v = {\n type: \"update\",\n newInfo: s,\n oldInfo: u\n };\n a.push(v);\n }\n }\n return d === -1;\n });\n return [\n ...a,\n // A device was just removed.\n ...i.map((s) => ({ type: \"remove\", device: s })),\n // A device was just plugged in.\n ...l.map((s) => ({ type: \"add\", device: s }))\n ];\n }\n};\nfunction _(e, t) {\n if (t.deviceId)\n return e.deviceId === t.deviceId;\n function n(i) {\n return `${i.kind}:${i.groupId}`;\n }\n return n(e) === n(t);\n}\nvar M = new y();\n\n// src/errors.ts\nvar AudioRecorderError = class _AudioRecorderError extends Error {\n constructor(code, message, rawError) {\n super(message);\n this.name = \"AudioRecorderError\";\n this.code = code;\n this.rawError = rawError;\n if (typeof Object.setPrototypeOf === \"function\") {\n Object.setPrototypeOf(this, _AudioRecorderError.prototype);\n }\n }\n};\nfunction mapDOMExceptionToErrorCode(err) {\n if (err && typeof err === \"object\" && \"name\" in err) {\n const name = err.name;\n if (name === \"NotAllowedError\" || name === \"SecurityError\") {\n return \"PERMISSION_DENIED\";\n }\n if (name === \"NotFoundError\" || name === \"OverconstrainedError\") {\n return \"NO_DEVICE\";\n }\n }\n return \"UNKNOWN\";\n}\n\n// src/index.ts\nvar AudioRecorder = class _AudioRecorder {\n constructor(options = {}) {\n this._state = \"idle\";\n this._duration = 0;\n this._isAutoStopping = false;\n this._recorder = null;\n if (options.maxDuration !== void 0) {\n if (!Number.isFinite(options.maxDuration) || options.maxDuration <= 0) {\n throw new AudioRecorderError(\n \"MAX_DURATION_INVALID\",\n `maxDuration must be a positive finite number, got: ${options.maxDuration}`\n );\n }\n }\n const { _createRecorder, _supportsMediaDevices, ...publicOptions } = options;\n this._options = publicOptions;\n this._createRecorder = _createRecorder || ((cfg) => new import_js_audio_recorder.default(cfg));\n this._supportsMediaDevices = _supportsMediaDevices || (() => _AudioRecorder.isSupported());\n }\n static isSupported() {\n if (typeof window === \"undefined\") return false;\n const hasAudioContext = !!(window.AudioContext || window.webkitAudioContext);\n return o() && hasAudioContext;\n }\n static async checkPermission() {\n if (typeof navigator === \"undefined\" || !navigator.mediaDevices) {\n throw new AudioRecorderError(\"NOT_SUPPORTED\", \"MediaDevices API not supported\");\n }\n if (navigator.permissions && navigator.permissions.query) {\n try {\n const status = await navigator.permissions.query({ name: \"microphone\" });\n return status.state;\n } catch {\n }\n }\n try {\n const stream = await navigator.mediaDevices.getUserMedia({ audio: true });\n stream.getTracks().forEach((track) => track.stop());\n return \"granted\";\n } catch (err) {\n const code = mapDOMExceptionToErrorCode(err);\n if (code === \"PERMISSION_DENIED\") return \"denied\";\n throw new AudioRecorderError(code, \"Permission check failed\", err);\n }\n }\n get state() {\n return this._state;\n }\n get duration() {\n return this._duration;\n }\n async start() {\n if (this._state !== \"idle\" && this._state !== \"stopped\") {\n throw new AudioRecorderError(\"INVALID_STATE\", `Cannot start when state is ${this._state}`);\n }\n if (!this._supportsMediaDevices()) {\n throw new AudioRecorderError(\"NOT_SUPPORTED\", \"Recording is not supported in this browser\");\n }\n this._duration = 0;\n this._isAutoStopping = false;\n if (this._recorder) {\n try {\n await this._recorder.destroy();\n } catch {\n }\n this._recorder = null;\n }\n this._recorder = this._createRecorder({\n sampleRate: this._options.sampleRate ?? 16e3,\n sampleBits: this._options.sampleBits ?? 16,\n numChannels: this._options.numChannels ?? 1\n });\n this._attachRecorderHooks(this._recorder);\n try {\n await this._recorder.start();\n this._state = \"recording\";\n } catch (err) {\n try {\n await this._recorder?.destroy();\n } catch {\n }\n this._recorder = null;\n const code = mapDOMExceptionToErrorCode(err);\n const wrapped = new AudioRecorderError(code, `Failed to start recording: ${code}`, err);\n this._options.onError?.(wrapped);\n throw wrapped;\n }\n }\n pause() {\n if (this._state !== \"recording\") {\n throw new AudioRecorderError(\"INVALID_STATE\", `Cannot pause when state is ${this._state}`);\n }\n this._recorder?.pause();\n this._state = \"paused\";\n }\n resume() {\n if (this._state !== \"paused\") {\n throw new AudioRecorderError(\"INVALID_STATE\", `Cannot resume when state is ${this._state}`);\n }\n this._recorder?.resume();\n this._state = \"recording\";\n }\n async stop(options) {\n if (this._state !== \"recording\" && this._state !== \"paused\") {\n throw new AudioRecorderError(\"INVALID_STATE\", `Cannot stop when state is ${this._state}`);\n }\n if (!this._recorder) {\n throw new AudioRecorderError(\"NOT_INITIALIZED\", \"Recorder instance not initialized\");\n }\n this._recorder.stop();\n this._state = \"stopped\";\n const blob = this._recorder.getWAVBlob();\n const filename = options?.filename || `record_${Date.now()}.wav`;\n const file = new File([blob], filename, { type: \"audio/wav\" });\n const url = typeof URL !== \"undefined\" && typeof URL.createObjectURL === \"function\" ? URL.createObjectURL(blob) : \"\";\n return { blob, file, url, duration: this._duration };\n }\n async destroy() {\n if (this._state === \"destroyed\") return;\n if (this._recorder) {\n if (this._state === \"recording\" || this._state === \"paused\") {\n try {\n this._recorder.stop();\n } catch {\n }\n }\n try {\n await this._recorder.destroy();\n } catch {\n }\n this._recorder = null;\n }\n this._options = {};\n this._state = \"destroyed\";\n }\n _attachRecorderHooks(recorder) {\n recorder.onprogress = (payload) => {\n if (this._state !== \"recording\" || this._isAutoStopping) return;\n this._duration = Math.round(payload.duration * 1e3);\n this._options.onTimeUpdate?.(this._duration);\n const waveData = recorder.getRecordAnalyseData?.() ?? new Uint8Array(1024).fill(128);\n this._options.onWaveDataUpdate?.({\n vol: Math.min(100, Math.max(0, Math.round(payload.vol || 0))),\n waveData,\n duration: this._duration\n });\n if (this._options.maxDuration && this._duration >= this._options.maxDuration) {\n this._isAutoStopping = true;\n this._options.onMaxReach?.();\n this.stop().catch((err) => {\n this._options.onError?.(err);\n });\n }\n };\n }\n};\nexport {\n AudioRecorderError,\n AudioRecorder as default,\n mapDOMExceptionToErrorCode\n};\n/*! Bundled license information:\n\njs-audio-recorder/dist/recorder.js:\n (*!\n * \n * js-audio-recorder - js audio recorder plugin\n * \n * @version v1.0.7\n * @homepage https://github.com/2fps/recorder\n * @author 2fps <echoweb@126.com> (https://www.zhuyuntao.cn)\n * @license MIT\n * \n *)\n*/\n","/*!\r\n * \r\n * js-audio-recorder - js audio recorder plugin\r\n * \r\n * @version v1.0.7\r\n * @homepage https://github.com/2fps/recorder\r\n * @author 2fps <echoweb@126.com> (https://www.zhuyuntao.cn)\r\n * @license MIT\r\n * \r\n */\r\n!function(t,e){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=e():\"function\"==typeof define&&define.amd?define([],e):\"object\"==typeof exports?exports.Recorder=e():t.Recorder=e()}(this,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(t,\"__esModule\",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&\"object\"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,\"default\",{enumerable:!0,value:t}),2&e&&\"string\"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,\"a\",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p=\"\",n(n.s=1)}([function(t,e,n){\"use strict\";function i(t,e,n){for(var i=0;i<n.length;i++)t.setUint8(e+i,n.charCodeAt(i))}Object.defineProperty(e,\"__esModule\",{value:!0}),e.compress=function(t,e,n){for(var i=e/n,o=Math.max(i,1),r=t.left,a=t.right,s=Math.floor((r.length+a.length)/i),u=new Float32Array(s),c=0,l=0;c<s;){var f=Math.floor(l);u[c]=r[f],c++,a.length&&(u[c]=a[f],c++),l+=o}return u},e.encodePCM=function(t,e,n){void 0===n&&(n=!0);var i=0,o=t.length*(e/8),r=new ArrayBuffer(o),a=new DataView(r);if(8===e)for(var s=0;s<t.length;s++,i++){var u=(c=Math.max(-1,Math.min(1,t[s])))<0?128*c:127*c;u=+u+128,a.setInt8(i,u)}else for(s=0;s<t.length;s++,i+=2){var c=Math.max(-1,Math.min(1,t[s]));a.setInt16(i,c<0?32768*c:32767*c,n)}return a},e.encodeWAV=function(t,e,n,o,r,a){void 0===a&&(a=!0);var s=n>e?e:n,u=r,c=new ArrayBuffer(44+t.byteLength),l=new DataView(c),f=o,p=0;i(l,p,\"RIFF\"),p+=4,l.setUint32(p,36+t.byteLength,a),i(l,p+=4,\"WAVE\"),i(l,p+=4,\"fmt \"),p+=4,l.setUint32(p,16,a),p+=4,l.setUint16(p,1,a),p+=2,l.setUint16(p,f,a),p+=2,l.setUint32(p,s,a),p+=4,l.setUint32(p,f*s*(u/8),a),p+=4,l.setUint16(p,f*(u/8),a),p+=2,l.setUint16(p,u,a),i(l,p+=2,\"data\"),p+=4,l.setUint32(p,t.byteLength,a),p+=4;for(var d=0;d<t.byteLength;)l.setUint8(p,t.getUint8(d)),p++,d++;return l}},function(t,e,n){\"use strict\";var i,o=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,\"__esModule\",{value:!0});var r=n(2),a=n(0),s=n(3),u=function(t){function e(e){void 0===e&&(e={});var n=t.call(this,e)||this;return n.isrecording=!1,n.ispause=!1,n.isplaying=!1,n}return o(e,t),e.prototype.setOption=function(t){void 0===t&&(t={}),this.setNewOption(t)},e.prototype.start=function(){return this.isrecording?Promise.reject():(this.isrecording=!0,this.startRecord())},e.prototype.pause=function(){this.isrecording&&!this.ispause&&(this.ispause=!0,this.pauseRecord())},e.prototype.resume=function(){this.isrecording&&this.ispause&&(this.ispause=!1,this.resumeRecord())},e.prototype.stop=function(){this.isrecording&&(this.isrecording=!1,this.ispause=!1,this.stopRecord())},e.prototype.play=function(){this.stop(),this.isplaying=!0,this.onplay&&this.onplay(),s.default.addPlayEnd(this.onplayend);var t=this.getWAV();t.byteLength>44&&s.default.play(t.buffer)},e.prototype.getPlayTime=function(){return s.default.getPlayTime()},e.prototype.pausePlay=function(){!this.isrecording&&this.isplaying&&(this.isplaying=!1,this.onpauseplay&&this.onpauseplay(),s.default.pausePlay())},e.prototype.resumePlay=function(){this.isrecording||this.isplaying||(this.isplaying=!0,this.onresumeplay&&this.onresumeplay(),s.default.resumePlay())},e.prototype.stopPlay=function(){this.isrecording||(this.isplaying=!1,this.onstopplay&&this.onstopplay(),s.default.stopPlay())},e.prototype.destroy=function(){return s.default.destroyPlay(),this.destroyRecord()},e.prototype.getRecordAnalyseData=function(){return this.getAnalyseData()},e.prototype.getPlayAnalyseData=function(){return s.default.getAnalyseData()},e.prototype.getPCM=function(){this.stop();var t=this.getData();return t=a.compress(t,this.inputSampleRate,this.outputSampleRate),a.encodePCM(t,this.oututSampleBits,this.littleEdian)},e.prototype.getPCMBlob=function(){return new Blob([this.getPCM()])},e.prototype.downloadPCM=function(t){void 0===t&&(t=\"recorder\");var e=this.getPCMBlob();r.downloadPCM(e,t)},e.prototype.getWAV=function(){var t=this.getPCM();return a.encodeWAV(t,this.inputSampleRate,this.outputSampleRate,this.config.numChannels,this.oututSampleBits,this.littleEdian)},e.prototype.getWAVBlob=function(){return new Blob([this.getWAV()],{type:\"audio/wav\"})},e.prototype.downloadWAV=function(t){void 0===t&&(t=\"recorder\");var e=this.getWAVBlob();r.downloadWAV(e,t)},e.prototype.download=function(t,e,n){r.download(t,e,n)},e.prototype.getChannelData=function(){var t=this.getPCM(),e=t.byteLength,n=this.littleEdian,i={left:null,right:null};if(2===this.config.numChannels){var o=new DataView(new ArrayBuffer(e/2)),r=new DataView(new ArrayBuffer(e/2));if(16===this.config.sampleBits)for(var a=0;a<e/2;a+=2)o.setInt16(a,t.getInt16(2*a,n),n),r.setInt16(a,t.getInt16(2*a+2,n),n);else for(a=0;a<e/2;a+=2)o.setInt8(a,t.getInt8(2*a)),r.setInt8(a,t.getInt8(2*a+1));i.left=o,i.right=r}else i.left=t;return i},e}(n(5).default);e.default=u},function(t,e,n){\"use strict\";function i(t,e,n){var i=document.createElement(\"a\");i.href=window.URL.createObjectURL(t),i.download=e+\".\"+n,i.click()}Object.defineProperty(e,\"__esModule\",{value:!0}),e.downloadWAV=function(t,e){void 0===e&&(e=\"recorder\"),i(t,e,\"wav\")},e.downloadPCM=function(t,e){void 0===e&&(e=\"recorder\"),i(t,e,\"pcm\")},e.download=function(t,e,n){return i(t,e,n)}},function(t,e,n){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0});var i=n(4),o=null,r=0,a=0,s=null,u=null,c=null,l=!1,f=0,p=function(){};function d(){return l=!1,s.decodeAudioData(c.slice(0),function(t){(o=s.createBufferSource()).onended=function(){l||(f=s.currentTime-a+r,p())},o.buffer=t,o.connect(u),u.connect(s.destination),o.start(0,r),a=s.currentTime},function(t){i.throwError(t)})}function h(){o&&(o.stop(),o=null)}var y=function(){function t(){}return t.play=function(t){return s||(s=new(window.AudioContext||window.webkitAudioContext),(u=s.createAnalyser()).fftSize=2048),this.stopPlay(),c=t,f=0,d()},t.pausePlay=function(){h(),r+=s.currentTime-a,l=!0},t.resumePlay=function(){return d()},t.stopPlay=function(){r=0,c=null,h()},t.destroyPlay=function(){this.stopPlay()},t.getAnalyseData=function(){var t=new Uint8Array(u.frequencyBinCount);return u.getByteTimeDomainData(t),t},t.addPlayEnd=function(t){void 0===t&&(t=function(){}),p=t},t.getPlayTime=function(){var t=l?r:s.currentTime-a+r;return f||t},t}();e.default=y},function(t,e,n){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.throwError=function(t){throw new Error(t)}},function(t,e,n){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0});var i=n(0),o=function(){function t(e){void 0===e&&(e={}),this.size=0,this.lBuffer=[],this.rBuffer=[],this.tempPCM=[],this.inputSampleBits=16,this.fileSize=0,this.duration=0,this.needRecord=!0;var n,i=new(window.AudioContext||window.webkitAudioContext);this.inputSampleRate=i.sampleRate,this.setNewOption(e),this.littleEdian=(n=new ArrayBuffer(2),new DataView(n).setInt16(0,256,!0),256===new Int16Array(n)[0]),t.initUserMedia()}return t.prototype.setNewOption=function(t){void 0===t&&(t={}),this.config={sampleBits:~[8,16].indexOf(t.sampleBits)?t.sampleBits:16,sampleRate:~[8e3,11025,16e3,22050,24e3,44100,48e3].indexOf(t.sampleRate)?t.sampleRate:this.inputSampleRate,numChannels:~[1,2].indexOf(t.numChannels)?t.numChannels:1},this.outputSampleRate=this.config.sampleRate,this.oututSampleBits=this.config.sampleBits},t.prototype.startRecord=function(){var t=this;return this.context&&this.destroyRecord(),this.initRecorder(),navigator.mediaDevices.getUserMedia({audio:!0}).then(function(e){t.audioInput=t.context.createMediaStreamSource(e),t.stream=e}).then(function(){t.audioInput.connect(t.analyser),t.analyser.connect(t.recorder),t.recorder.connect(t.context.destination)})},t.prototype.pauseRecord=function(){this.needRecord=!1},t.prototype.resumeRecord=function(){this.needRecord=!0},t.prototype.stopRecord=function(){this.audioInput&&this.audioInput.disconnect(),this.source&&this.source.stop(),this.recorder.disconnect(),this.analyser.disconnect(),this.needRecord=!0},t.prototype.destroyRecord=function(){return this.clearRecordStatus(),this.stopStream(),this.closeAudioContext()},t.prototype.getAnalyseData=function(){var t=new Uint8Array(this.analyser.frequencyBinCount);return this.analyser.getByteTimeDomainData(t),t},t.prototype.getData=function(){return this.flat()},t.prototype.clearRecordStatus=function(){this.lBuffer.length=0,this.rBuffer.length=0,this.size=0,this.fileSize=0,this.PCM=null,this.audioInput=null,this.duration=0},t.prototype.flat=function(){var t=null,e=new Float32Array(0);1===this.config.numChannels?t=new Float32Array(this.size):(t=new Float32Array(this.size/2),e=new Float32Array(this.size/2));for(var n=0,i=0;i<this.lBuffer.length;i++)t.set(this.lBuffer[i],n),n+=this.lBuffer[i].length;n=0;for(i=0;i<this.rBuffer.length;i++)e.set(this.rBuffer[i],n),n+=this.rBuffer[i].length;return{left:t,right:e}},t.prototype.initRecorder=function(){var t=this;this.clearRecordStatus(),this.context=new(window.AudioContext||window.webkitAudioContext),this.analyser=this.context.createAnalyser(),this.analyser.fftSize=2048;var e=this.context.createScriptProcessor||this.context.createJavaScriptNode;this.recorder=e.apply(this.context,[4096,this.config.numChannels,this.config.numChannels]),this.recorder.onaudioprocess=function(e){if(t.needRecord){var n,i=e.inputBuffer.getChannelData(0),o=null;t.lBuffer.push(new Float32Array(i)),t.size+=i.length,2===t.config.numChannels&&(o=e.inputBuffer.getChannelData(1),t.rBuffer.push(new Float32Array(o)),t.size+=o.length),t.fileSize=Math.floor(t.size/Math.max(t.inputSampleRate/t.outputSampleRate,1))*(t.oututSampleBits/8),n=100*Math.max.apply(Math,i),t.duration+=4096/t.inputSampleRate,t.onprocess&&t.onprocess(t.duration),t.onprogress&&t.onprogress({duration:t.duration,fileSize:t.fileSize,vol:n})}}},t.prototype.stopStream=function(){this.stream&&this.stream.getTracks&&(this.stream.getTracks().forEach(function(t){return t.stop()}),this.stream=null)},t.prototype.closeAudioContext=function(){return this.context&&this.context.close&&\"closed\"!==this.context.state?this.context.close():new Promise(function(t){t()})},t.initUserMedia=function(){void 0===navigator.mediaDevices&&(navigator.mediaDevices={}),void 0===navigator.mediaDevices.getUserMedia&&(navigator.mediaDevices.getUserMedia=function(t){var e=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia;return e?new Promise(function(n,i){e.call(navigator,t,n,i)}):Promise.reject(new Error(\"浏览器不支持 getUserMedia !\"))})},t.prototype.transformIntoPCM=function(t,e){var n=new Float32Array(t),o=new Float32Array(e),r=i.compress({left:n,right:o},this.inputSampleRate,this.outputSampleRate);return i.encodePCM(r,this.oututSampleBits,this.littleEdian)},t.getPermission=function(){return this.initUserMedia(),navigator.mediaDevices.getUserMedia({audio:!0}).then(function(t){t&&t.getTracks().forEach(function(t){return t.stop()})})},t}();e.default=o}]).default});\r","module.exports = require(\"./dist/recorder.js\");\r\n","import Recorder from 'js-audio-recorder';\nimport { supportsMediaDevices } from 'media-devices';\nimport { AudioRecorderError, mapDOMExceptionToErrorCode } from './errors';\nimport type {\n AudioRecorderOptions,\n RecorderState,\n StopOptions,\n StopResult,\n} from './types';\n\nexport * from './types';\nexport * from './errors';\n\nexport interface AudioRecorderInternalOptions extends AudioRecorderOptions {\n _createRecorder?: (config: any) => Recorder;\n _supportsMediaDevices?: () => boolean;\n}\n\nexport default class AudioRecorder {\n private _state: RecorderState = 'idle';\n private _duration: number = 0;\n private _isAutoStopping = false;\n private _recorder: Recorder | null = null;\n private _options: AudioRecorderOptions;\n private _createRecorder: (config: any) => Recorder;\n private _supportsMediaDevices: () => boolean;\n\n static isSupported(): boolean {\n if (typeof window === 'undefined') return false;\n const hasAudioContext = !!(window.AudioContext || (window as any).webkitAudioContext);\n return supportsMediaDevices() && hasAudioContext;\n }\n\n static async checkPermission(): Promise<'granted' | 'denied' | 'prompt'> {\n if (typeof navigator === 'undefined' || !navigator.mediaDevices) {\n throw new AudioRecorderError('NOT_SUPPORTED', 'MediaDevices API not supported');\n }\n\n if (navigator.permissions && navigator.permissions.query) {\n try {\n const status = await navigator.permissions.query({ name: 'microphone' as PermissionName });\n return status.state as 'granted' | 'denied' | 'prompt';\n } catch {\n // Some browsers cannot query microphone permission; fall through to getUserMedia probe\n }\n }\n\n try {\n const stream = await navigator.mediaDevices.getUserMedia({ audio: true });\n stream.getTracks().forEach((track) => track.stop());\n return 'granted';\n } catch (err) {\n const code = mapDOMExceptionToErrorCode(err);\n if (code === 'PERMISSION_DENIED') return 'denied';\n throw new AudioRecorderError(code, 'Permission check failed', err);\n }\n }\n\n constructor(options: AudioRecorderInternalOptions = {}) {\n if (options.maxDuration !== undefined) {\n if (!Number.isFinite(options.maxDuration) || options.maxDuration <= 0) {\n throw new AudioRecorderError(\n 'MAX_DURATION_INVALID',\n `maxDuration must be a positive finite number, got: ${options.maxDuration}`\n );\n }\n }\n\n const { _createRecorder, _supportsMediaDevices, ...publicOptions } = options;\n this._options = publicOptions;\n this._createRecorder = _createRecorder || ((cfg) => new Recorder(cfg));\n this._supportsMediaDevices =\n _supportsMediaDevices || (() => AudioRecorder.isSupported());\n }\n\n get state(): RecorderState {\n return this._state;\n }\n\n get duration(): number {\n return this._duration;\n }\n\n async start(): Promise<void> {\n if (this._state !== 'idle' && this._state !== 'stopped') {\n throw new AudioRecorderError('INVALID_STATE', `Cannot start when state is ${this._state}`);\n }\n if (!this._supportsMediaDevices()) {\n throw new AudioRecorderError('NOT_SUPPORTED', 'Recording is not supported in this browser');\n }\n\n this._duration = 0;\n this._isAutoStopping = false;\n\n // Free the previous session's AudioContext + MediaStream (upstream stop() alone keeps them alive)\n if (this._recorder) {\n try {\n await this._recorder.destroy();\n } catch {\n // ignore cleanup errors from previous session\n }\n this._recorder = null;\n }\n\n this._recorder = this._createRecorder({\n sampleRate: this._options.sampleRate ?? 16000,\n sampleBits: this._options.sampleBits ?? 16,\n numChannels: this._options.numChannels ?? 1,\n });\n this._attachRecorderHooks(this._recorder);\n\n try {\n await this._recorder.start();\n this._state = 'recording';\n } catch (err) {\n // Upstream may have created an AudioContext before failing; release it\n try {\n await this._recorder?.destroy();\n } catch {\n // ignore cleanup errors on the failed instance\n }\n this._recorder = null;\n const code = mapDOMExceptionToErrorCode(err);\n const wrapped = new AudioRecorderError(code, `Failed to start recording: ${code}`, err);\n this._options.onError?.(wrapped);\n throw wrapped;\n }\n }\n\n pause(): void {\n if (this._state !== 'recording') {\n throw new AudioRecorderError('INVALID_STATE', `Cannot pause when state is ${this._state}`);\n }\n this._recorder?.pause();\n this._state = 'paused';\n }\n\n resume(): void {\n if (this._state !== 'paused') {\n throw new AudioRecorderError('INVALID_STATE', `Cannot resume when state is ${this._state}`);\n }\n this._recorder?.resume();\n this._state = 'recording';\n }\n\n async stop(options?: StopOptions): Promise<StopResult> {\n if (this._state !== 'recording' && this._state !== 'paused') {\n throw new AudioRecorderError('INVALID_STATE', `Cannot stop when state is ${this._state}`);\n }\n if (!this._recorder) {\n throw new AudioRecorderError('NOT_INITIALIZED', 'Recorder instance not initialized');\n }\n\n this._recorder.stop();\n this._state = 'stopped';\n\n const blob = this._recorder.getWAVBlob();\n const filename = options?.filename || `record_${Date.now()}.wav`;\n const file = new File([blob], filename, { type: 'audio/wav' });\n const url =\n typeof URL !== 'undefined' && typeof URL.createObjectURL === 'function'\n ? URL.createObjectURL(blob)\n : '';\n\n return { blob, file, url, duration: this._duration };\n }\n\n async destroy(): Promise<void> {\n if (this._state === 'destroyed') return;\n if (this._recorder) {\n if (this._state === 'recording' || this._state === 'paused') {\n try {\n this._recorder.stop();\n } catch {\n // ignore stop errors during destroy\n }\n }\n try {\n await this._recorder.destroy();\n } catch {\n // ignore cleanup errors\n }\n this._recorder = null;\n }\n this._options = {};\n this._state = 'destroyed';\n }\n\n private _attachRecorderHooks(recorder: Recorder): void {\n recorder.onprogress = (payload) => {\n if (this._state !== 'recording' || this._isAutoStopping) return;\n\n // upstream duration is in SECONDS; public contract is milliseconds\n this._duration = Math.round(payload.duration * 1000);\n this._options.onTimeUpdate?.(this._duration);\n\n const waveData = recorder.getRecordAnalyseData?.() ?? new Uint8Array(1024).fill(128);\n this._options.onWaveDataUpdate?.({\n vol: Math.min(100, Math.max(0, Math.round(payload.vol || 0))),\n waveData,\n duration: this._duration,\n });\n\n if (this._options.maxDuration && this._duration >= this._options.maxDuration) {\n this._isAutoStopping = true;\n this._options.onMaxReach?.();\n this.stop().catch((err) => {\n this._options.onError?.(err as AudioRecorderError);\n });\n }\n };\n }\n}\n","var f = Object.defineProperty;\nvar p = (e, t, n) => t in e ? f(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;\nvar r = (e, t, n) => (p(e, typeof t != \"symbol\" ? t + \"\" : t, n), n);\nfunction o() {\n return typeof navigator < \"u\" && !!navigator.mediaDevices;\n}\nfunction c() {\n if (!o())\n throw new Error(\"The media devices API isn't supported here.\");\n return navigator.mediaDevices;\n}\nasync function g() {\n return (await c().enumerateDevices()).filter(h).map(m);\n}\nfunction h(e) {\n return e.deviceId !== \"default\";\n}\nfunction m(e) {\n return {\n label: e.label || null,\n kind: e.kind,\n deviceId: e.deviceId || null,\n groupId: e.groupId || null\n };\n}\nvar D = /* @__PURE__ */ ((e) => (e.VideoInput = \"videoinput\", e.AudioInput = \"audioinput\", e.AudioOutput = \"audiooutput\", e))(D || {});\nasync function I(e) {\n return c().getUserMedia(e);\n}\nclass y {\n constructor() {\n r(this, \"_knownDevices\", []);\n r(this, \"_gainedScreenAccessOnce\", !1);\n /**\n * Specifies a function to be called whenever the list of available devices\n * changes.\n *\n * Note: this is different from the native event. It passes the changeset\n * and full list of devices as a parameter.\n */\n r(this, \"ondevicechange\", null);\n /**\n * Request a live media stream from audio and/or video devices. Streams are\n * configurable through constraints.\n * See: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia\n */\n r(this, \"getUserMedia\", async (t) => {\n const n = await I(t);\n return this.enumerateDevices(), n;\n });\n /**\n * Ask the user to share their screen. Resolves with a media stream carrying\n * video, and potentially audio from the application window.\n * See: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia\n */\n r(this, \"getDisplayMedia\", async (t) => {\n const n = await c().getDisplayMedia(t);\n return this._gainedScreenAccessOnce || (this._gainedScreenAccessOnce = !0, this.enumerateDevices()), n;\n });\n /**\n * Lists every available hardware device, including microphones, cameras,\n * and speakers (depending on browser support). May contain redacted\n * information depending on application permissions.\n */\n r(this, \"enumerateDevices\", async () => {\n const t = await g();\n return this._checkForDeviceChanges(t), t;\n });\n /**\n * Returns an object containing every media constraint supported by the\n * browser.\n * See: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getSupportedConstraints\n */\n r(this, \"getSupportedConstraints\", () => c().getSupportedConstraints());\n o() && c().addEventListener(\"devicechange\", () => this.ondevicechange ? this.enumerateDevices() : Promise.resolve());\n }\n _checkForDeviceChanges(t) {\n var a;\n const n = this._knownDevices;\n this._knownDevices = t;\n const i = this._calculateDeviceDiff(\n t,\n n\n );\n i.length && ((a = this.ondevicechange) == null || a.call(this, { changes: i, devices: t }));\n }\n /**\n * Note: The device enumeration API may return null values for device IDs\n * and labels. To avoid creating erroneous \"Device Added\" notifications,\n * a best effort should be made to detect when devices are identical.\n *\n * Order is significant. Preferred devices are listed first, which helps\n * correlate devices from permissioned requests with unpermissioned\n * requests.\n */\n _calculateDeviceDiff(t, n) {\n const i = n.slice(), a = [], l = t.filter((s) => {\n const d = i.findIndex((u) => _(s, u));\n if (d > -1) {\n const [u] = i.splice(d, 1);\n if (s.label !== u.label) {\n const v = {\n type: \"update\",\n newInfo: s,\n oldInfo: u\n };\n a.push(v);\n }\n }\n return d === -1;\n });\n return [\n ...a,\n // A device was just removed.\n ...i.map((s) => ({ type: \"remove\", device: s })),\n // A device was just plugged in.\n ...l.map((s) => ({ type: \"add\", device: s }))\n ];\n }\n}\nfunction _(e, t) {\n if (t.deviceId)\n return e.deviceId === t.deviceId;\n function n(i) {\n return `${i.kind}:${i.groupId}`;\n }\n return n(e) === n(t);\n}\nvar k = /* @__PURE__ */ ((e) => (e.Add = \"add\", e.Remove = \"remove\", e.Update = \"update\", e))(k || {});\nconst M = new y();\nexport {\n D as DeviceKind,\n k as OperationType,\n M as default,\n o as supportsMediaDevices\n};\n","import { ErrorCode } from './types';\n\nexport class AudioRecorderError extends Error {\n readonly code: ErrorCode;\n readonly rawError?: unknown;\n\n constructor(code: ErrorCode, message: string, rawError?: unknown) {\n super(message);\n this.name = 'AudioRecorderError';\n this.code = code;\n this.rawError = rawError;\n if (typeof Object.setPrototypeOf === 'function') {\n Object.setPrototypeOf(this, AudioRecorderError.prototype);\n }\n }\n}\n\nexport function mapDOMExceptionToErrorCode(err: unknown): ErrorCode {\n if (err && typeof err === 'object' && 'name' in err) {\n const name = (err as { name: string }).name;\n if (name === 'NotAllowedError' || name === 'SecurityError') {\n return 'PERMISSION_DENIED';\n }\n if (name === 'NotFoundError' || name === 'OverconstrainedError') {\n return 'NO_DEVICE';\n }\n }\n return 'UNKNOWN';\n}\n"]}
1
+ {"version":3,"sources":["/Users/afei/github/audio-recorder-kit/dist/index.esm.js","../node_modules/.pnpm/js-audio-recorder@1.0.7/node_modules/js-audio-recorder/dist/recorder.js","../node_modules/.pnpm/js-audio-recorder@1.0.7/node_modules/js-audio-recorder/index.js","../src/index.ts","../node_modules/.pnpm/media-devices@0.5.0/node_modules/media-devices/dist/media-devices.js","../src/errors.ts"],"names":["__create","Object","create","__defProp","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__getProtoOf","getPrototypeOf","__hasOwnProp","prototype","hasOwnProperty","__commonJS","cb","mod","__require","exports","__copyProps","to","from","except","desc","key","call","get","enumerable","__toESM","isNodeMode","target","__esModule","value","require_recorder","module","t","e","define","amd","Recorder","n","i","o","l","m","c","d","r","Symbol","toStringTag","bind","default","p","s","length","setUint8","charCodeAt","compress","Math","max","left","a","right","floor","u","Float32Array","f","encodePCM","ArrayBuffer","DataView","min","setInt8","setInt16","encodeWAV","byteLength","setUint32","setUint16","getUint8","__extends","setPrototypeOf","__proto__","Array","isrecording","ispause","isplaying","setOption","setNewOption","start","Promise","reject","startRecord","pause","pauseRecord","resume","resumeRecord","stop","stopRecord","play","onplay","addPlayEnd","onplayend","getWAV","buffer","getPlayTime","pausePlay","onpauseplay","resumePlay","onresumeplay","stopPlay","onstopplay","destroy","destroyPlay","destroyRecord","getRecordAnalyseData","getAnalyseData","getPlayAnalyseData","getPCM","getData","inputSampleRate","outputSampleRate","oututSampleBits","littleEdian","getPCMBlob","Blob","downloadPCM","config","numChannels","getWAVBlob","type","downloadWAV","download","getChannelData","sampleBits","getInt16","getInt8","document","createElement","href","window","URL","createObjectURL","click","decodeAudioData","slice","createBufferSource","onended","currentTime","connect","destination","throwError","h","y","AudioContext","webkitAudioContext","createAnalyser","fftSize","Uint8Array","frequencyBinCount","getByteTimeDomainData","Error","size","lBuffer","rBuffer","tempPCM","inputSampleBits","fileSize","duration","needRecord","sampleRate","Int16Array","initUserMedia","indexOf","context","initRecorder","navigator","mediaDevices","getUserMedia","audio","then","audioInput","createMediaStreamSource","stream","analyser","recorder","disconnect","source","clearRecordStatus","stopStream","closeAudioContext","flat","PCM","set","createScriptProcessor","createJavaScriptNode","apply","onaudioprocess","inputBuffer","push","onprocess","onprogress","vol","getTracks","forEach","close","state","webkitGetUserMedia","mozGetUserMedia","transformIntoPCM","getPermission","require_js_audio_recorder","import_js_audio_recorder","configurable","writable","g","enumerateDevices","filter","map","deviceId","label","kind","groupId","I","getDisplayMedia","_gainedScreenAccessOnce","_checkForDeviceChanges","getSupportedConstraints","addEventListener","ondevicechange","resolve","_knownDevices","_calculateDeviceDiff","changes","devices","findIndex","_","splice","v","newInfo","oldInfo","device","M","AudioRecorderError","_AudioRecorderError","code","message","rawError","name","mapDOMExceptionToErrorCode","err","isRecordingSupported","hasAudioContext","checkRecordingPermission","status","permissions","query","track","AudioRecorder","_AudioRecorder","options","_state","_duration","_isAutoStopping","_recorder","maxDuration","Number","isFinite","_createRecorder","_supportsMediaDevices","publicOptions","_options","cfg","isSupported","wrapped","_attachRecorderHooks","onError","blob","filename","file","url","Date","now","File","payload","round","onTimeUpdate","waveData","fill","onWaveDataUpdate","onMaxReach","catch","checkPermission","index_default"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;CAMC,GAED,IAAIA,WAAWC,OAAOC,MAAM;AAC5B,IAAIC,YAAYF,OAAOG,cAAc;AACrC,IAAIC,mBAAmBJ,OAAOK,wBAAwB;AACtD,IAAIC,oBAAoBN,OAAOO,mBAA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QnC;AH8Yf,SACEA,aAAa,EACbf,kBAAkB,EAClBkD,iBAAiBhP,OAAO,EACxBoM,0BAA0B,GAC1B,CACF;;;;;;;;;;;;;AAaA","sourcesContent":["/*!\n * name: @jswork/audio-recorder-kit\n * description: Browser audio recorder with realtime waveform callback.\n * version: 1.0.3\n * date: 2026-11-24 14:10:56\n * license: MIT\n */\n\nvar __create = Object.create;\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __getProtoOf = Object.getPrototypeOf;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. \"__esModule\" has not been set), then set\n // \"default\" to the CommonJS \"module.exports\" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, \"default\", { value: mod, enumerable: true }) : target,\n mod\n));\n\n// node_modules/.pnpm/js-audio-recorder@1.0.7/node_modules/js-audio-recorder/dist/recorder.js\nvar require_recorder = __commonJS({\n \"node_modules/.pnpm/js-audio-recorder@1.0.7/node_modules/js-audio-recorder/dist/recorder.js\"(exports, module) {\n \"use strict\";\n !(function(t, e) {\n \"object\" == typeof exports && \"object\" == typeof module ? module.exports = e() : \"function\" == typeof define && define.amd ? define([], e) : \"object\" == typeof exports ? exports.Recorder = e() : t.Recorder = e();\n })(exports, function() {\n return (function(t) {\n var e = {};\n function n(i) {\n if (e[i]) return e[i].exports;\n var o2 = e[i] = { i, l: false, exports: {} };\n return t[i].call(o2.exports, o2, o2.exports, n), o2.l = true, o2.exports;\n }\n return n.m = t, n.c = e, n.d = function(t2, e2, i) {\n n.o(t2, e2) || Object.defineProperty(t2, e2, { enumerable: true, get: i });\n }, n.r = function(t2) {\n \"undefined\" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(t2, Symbol.toStringTag, { value: \"Module\" }), Object.defineProperty(t2, \"__esModule\", { value: true });\n }, n.t = function(t2, e2) {\n if (1 & e2 && (t2 = n(t2)), 8 & e2) return t2;\n if (4 & e2 && \"object\" == typeof t2 && t2 && t2.__esModule) return t2;\n var i = /* @__PURE__ */ Object.create(null);\n if (n.r(i), Object.defineProperty(i, \"default\", { enumerable: true, value: t2 }), 2 & e2 && \"string\" != typeof t2) for (var o2 in t2) n.d(i, o2, function(e3) {\n return t2[e3];\n }.bind(null, o2));\n return i;\n }, n.n = function(t2) {\n var e2 = t2 && t2.__esModule ? function() {\n return t2.default;\n } : function() {\n return t2;\n };\n return n.d(e2, \"a\", e2), e2;\n }, n.o = function(t2, e2) {\n return Object.prototype.hasOwnProperty.call(t2, e2);\n }, n.p = \"\", n(n.s = 1);\n })([function(t, e, n) {\n \"use strict\";\n function i(t2, e2, n2) {\n for (var i2 = 0; i2 < n2.length; i2++) t2.setUint8(e2 + i2, n2.charCodeAt(i2));\n }\n Object.defineProperty(e, \"__esModule\", { value: true }), e.compress = function(t2, e2, n2) {\n for (var i2 = e2 / n2, o2 = Math.max(i2, 1), r2 = t2.left, a = t2.right, s = Math.floor((r2.length + a.length) / i2), u = new Float32Array(s), c2 = 0, l = 0; c2 < s; ) {\n var f2 = Math.floor(l);\n u[c2] = r2[f2], c2++, a.length && (u[c2] = a[f2], c2++), l += o2;\n }\n return u;\n }, e.encodePCM = function(t2, e2, n2) {\n void 0 === n2 && (n2 = true);\n var i2 = 0, o2 = t2.length * (e2 / 8), r2 = new ArrayBuffer(o2), a = new DataView(r2);\n if (8 === e2) for (var s = 0; s < t2.length; s++, i2++) {\n var u = (c2 = Math.max(-1, Math.min(1, t2[s]))) < 0 ? 128 * c2 : 127 * c2;\n u = +u + 128, a.setInt8(i2, u);\n }\n else for (s = 0; s < t2.length; s++, i2 += 2) {\n var c2 = Math.max(-1, Math.min(1, t2[s]));\n a.setInt16(i2, c2 < 0 ? 32768 * c2 : 32767 * c2, n2);\n }\n return a;\n }, e.encodeWAV = function(t2, e2, n2, o2, r2, a) {\n void 0 === a && (a = true);\n var s = n2 > e2 ? e2 : n2, u = r2, c2 = new ArrayBuffer(44 + t2.byteLength), l = new DataView(c2), f2 = o2, p2 = 0;\n i(l, p2, \"RIFF\"), p2 += 4, l.setUint32(p2, 36 + t2.byteLength, a), i(l, p2 += 4, \"WAVE\"), i(l, p2 += 4, \"fmt \"), p2 += 4, l.setUint32(p2, 16, a), p2 += 4, l.setUint16(p2, 1, a), p2 += 2, l.setUint16(p2, f2, a), p2 += 2, l.setUint32(p2, s, a), p2 += 4, l.setUint32(p2, f2 * s * (u / 8), a), p2 += 4, l.setUint16(p2, f2 * (u / 8), a), p2 += 2, l.setUint16(p2, u, a), i(l, p2 += 2, \"data\"), p2 += 4, l.setUint32(p2, t2.byteLength, a), p2 += 4;\n for (var d = 0; d < t2.byteLength; ) l.setUint8(p2, t2.getUint8(d)), p2++, d++;\n return l;\n };\n }, function(t, e, n) {\n \"use strict\";\n var i, o2 = this && this.__extends || (i = function(t2, e2) {\n return (i = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t3, e3) {\n t3.__proto__ = e3;\n } || function(t3, e3) {\n for (var n2 in e3) e3.hasOwnProperty(n2) && (t3[n2] = e3[n2]);\n })(t2, e2);\n }, function(t2, e2) {\n function n2() {\n this.constructor = t2;\n }\n i(t2, e2), t2.prototype = null === e2 ? Object.create(e2) : (n2.prototype = e2.prototype, new n2());\n });\n Object.defineProperty(e, \"__esModule\", { value: true });\n var r2 = n(2), a = n(0), s = n(3), u = (function(t2) {\n function e2(e3) {\n void 0 === e3 && (e3 = {});\n var n2 = t2.call(this, e3) || this;\n return n2.isrecording = false, n2.ispause = false, n2.isplaying = false, n2;\n }\n return o2(e2, t2), e2.prototype.setOption = function(t3) {\n void 0 === t3 && (t3 = {}), this.setNewOption(t3);\n }, e2.prototype.start = function() {\n return this.isrecording ? Promise.reject() : (this.isrecording = true, this.startRecord());\n }, e2.prototype.pause = function() {\n this.isrecording && !this.ispause && (this.ispause = true, this.pauseRecord());\n }, e2.prototype.resume = function() {\n this.isrecording && this.ispause && (this.ispause = false, this.resumeRecord());\n }, e2.prototype.stop = function() {\n this.isrecording && (this.isrecording = false, this.ispause = false, this.stopRecord());\n }, e2.prototype.play = function() {\n this.stop(), this.isplaying = true, this.onplay && this.onplay(), s.default.addPlayEnd(this.onplayend);\n var t3 = this.getWAV();\n t3.byteLength > 44 && s.default.play(t3.buffer);\n }, e2.prototype.getPlayTime = function() {\n return s.default.getPlayTime();\n }, e2.prototype.pausePlay = function() {\n !this.isrecording && this.isplaying && (this.isplaying = false, this.onpauseplay && this.onpauseplay(), s.default.pausePlay());\n }, e2.prototype.resumePlay = function() {\n this.isrecording || this.isplaying || (this.isplaying = true, this.onresumeplay && this.onresumeplay(), s.default.resumePlay());\n }, e2.prototype.stopPlay = function() {\n this.isrecording || (this.isplaying = false, this.onstopplay && this.onstopplay(), s.default.stopPlay());\n }, e2.prototype.destroy = function() {\n return s.default.destroyPlay(), this.destroyRecord();\n }, e2.prototype.getRecordAnalyseData = function() {\n return this.getAnalyseData();\n }, e2.prototype.getPlayAnalyseData = function() {\n return s.default.getAnalyseData();\n }, e2.prototype.getPCM = function() {\n this.stop();\n var t3 = this.getData();\n return t3 = a.compress(t3, this.inputSampleRate, this.outputSampleRate), a.encodePCM(t3, this.oututSampleBits, this.littleEdian);\n }, e2.prototype.getPCMBlob = function() {\n return new Blob([this.getPCM()]);\n }, e2.prototype.downloadPCM = function(t3) {\n void 0 === t3 && (t3 = \"recorder\");\n var e3 = this.getPCMBlob();\n r2.downloadPCM(e3, t3);\n }, e2.prototype.getWAV = function() {\n var t3 = this.getPCM();\n return a.encodeWAV(t3, this.inputSampleRate, this.outputSampleRate, this.config.numChannels, this.oututSampleBits, this.littleEdian);\n }, e2.prototype.getWAVBlob = function() {\n return new Blob([this.getWAV()], { type: \"audio/wav\" });\n }, e2.prototype.downloadWAV = function(t3) {\n void 0 === t3 && (t3 = \"recorder\");\n var e3 = this.getWAVBlob();\n r2.downloadWAV(e3, t3);\n }, e2.prototype.download = function(t3, e3, n2) {\n r2.download(t3, e3, n2);\n }, e2.prototype.getChannelData = function() {\n var t3 = this.getPCM(), e3 = t3.byteLength, n2 = this.littleEdian, i2 = { left: null, right: null };\n if (2 === this.config.numChannels) {\n var o3 = new DataView(new ArrayBuffer(e3 / 2)), r3 = new DataView(new ArrayBuffer(e3 / 2));\n if (16 === this.config.sampleBits) for (var a2 = 0; a2 < e3 / 2; a2 += 2) o3.setInt16(a2, t3.getInt16(2 * a2, n2), n2), r3.setInt16(a2, t3.getInt16(2 * a2 + 2, n2), n2);\n else for (a2 = 0; a2 < e3 / 2; a2 += 2) o3.setInt8(a2, t3.getInt8(2 * a2)), r3.setInt8(a2, t3.getInt8(2 * a2 + 1));\n i2.left = o3, i2.right = r3;\n } else i2.left = t3;\n return i2;\n }, e2;\n })(n(5).default);\n e.default = u;\n }, function(t, e, n) {\n \"use strict\";\n function i(t2, e2, n2) {\n var i2 = document.createElement(\"a\");\n i2.href = window.URL.createObjectURL(t2), i2.download = e2 + \".\" + n2, i2.click();\n }\n Object.defineProperty(e, \"__esModule\", { value: true }), e.downloadWAV = function(t2, e2) {\n void 0 === e2 && (e2 = \"recorder\"), i(t2, e2, \"wav\");\n }, e.downloadPCM = function(t2, e2) {\n void 0 === e2 && (e2 = \"recorder\"), i(t2, e2, \"pcm\");\n }, e.download = function(t2, e2, n2) {\n return i(t2, e2, n2);\n };\n }, function(t, e, n) {\n \"use strict\";\n Object.defineProperty(e, \"__esModule\", { value: true });\n var i = n(4), o2 = null, r2 = 0, a = 0, s = null, u = null, c2 = null, l = false, f2 = 0, p2 = function() {\n };\n function d() {\n return l = false, s.decodeAudioData(c2.slice(0), function(t2) {\n (o2 = s.createBufferSource()).onended = function() {\n l || (f2 = s.currentTime - a + r2, p2());\n }, o2.buffer = t2, o2.connect(u), u.connect(s.destination), o2.start(0, r2), a = s.currentTime;\n }, function(t2) {\n i.throwError(t2);\n });\n }\n function h2() {\n o2 && (o2.stop(), o2 = null);\n }\n var y2 = (function() {\n function t2() {\n }\n return t2.play = function(t3) {\n return s || (s = new (window.AudioContext || window.webkitAudioContext)(), (u = s.createAnalyser()).fftSize = 2048), this.stopPlay(), c2 = t3, f2 = 0, d();\n }, t2.pausePlay = function() {\n h2(), r2 += s.currentTime - a, l = true;\n }, t2.resumePlay = function() {\n return d();\n }, t2.stopPlay = function() {\n r2 = 0, c2 = null, h2();\n }, t2.destroyPlay = function() {\n this.stopPlay();\n }, t2.getAnalyseData = function() {\n var t3 = new Uint8Array(u.frequencyBinCount);\n return u.getByteTimeDomainData(t3), t3;\n }, t2.addPlayEnd = function(t3) {\n void 0 === t3 && (t3 = function() {\n }), p2 = t3;\n }, t2.getPlayTime = function() {\n var t3 = l ? r2 : s.currentTime - a + r2;\n return f2 || t3;\n }, t2;\n })();\n e.default = y2;\n }, function(t, e, n) {\n \"use strict\";\n Object.defineProperty(e, \"__esModule\", { value: true }), e.throwError = function(t2) {\n throw new Error(t2);\n };\n }, function(t, e, n) {\n \"use strict\";\n Object.defineProperty(e, \"__esModule\", { value: true });\n var i = n(0), o2 = (function() {\n function t2(e2) {\n void 0 === e2 && (e2 = {}), this.size = 0, this.lBuffer = [], this.rBuffer = [], this.tempPCM = [], this.inputSampleBits = 16, this.fileSize = 0, this.duration = 0, this.needRecord = true;\n var n2, i2 = new (window.AudioContext || window.webkitAudioContext)();\n this.inputSampleRate = i2.sampleRate, this.setNewOption(e2), this.littleEdian = (n2 = new ArrayBuffer(2), new DataView(n2).setInt16(0, 256, true), 256 === new Int16Array(n2)[0]), t2.initUserMedia();\n }\n return t2.prototype.setNewOption = function(t3) {\n void 0 === t3 && (t3 = {}), this.config = { sampleBits: ~[8, 16].indexOf(t3.sampleBits) ? t3.sampleBits : 16, sampleRate: ~[8e3, 11025, 16e3, 22050, 24e3, 44100, 48e3].indexOf(t3.sampleRate) ? t3.sampleRate : this.inputSampleRate, numChannels: ~[1, 2].indexOf(t3.numChannels) ? t3.numChannels : 1 }, this.outputSampleRate = this.config.sampleRate, this.oututSampleBits = this.config.sampleBits;\n }, t2.prototype.startRecord = function() {\n var t3 = this;\n return this.context && this.destroyRecord(), this.initRecorder(), navigator.mediaDevices.getUserMedia({ audio: true }).then(function(e2) {\n t3.audioInput = t3.context.createMediaStreamSource(e2), t3.stream = e2;\n }).then(function() {\n t3.audioInput.connect(t3.analyser), t3.analyser.connect(t3.recorder), t3.recorder.connect(t3.context.destination);\n });\n }, t2.prototype.pauseRecord = function() {\n this.needRecord = false;\n }, t2.prototype.resumeRecord = function() {\n this.needRecord = true;\n }, t2.prototype.stopRecord = function() {\n this.audioInput && this.audioInput.disconnect(), this.source && this.source.stop(), this.recorder.disconnect(), this.analyser.disconnect(), this.needRecord = true;\n }, t2.prototype.destroyRecord = function() {\n return this.clearRecordStatus(), this.stopStream(), this.closeAudioContext();\n }, t2.prototype.getAnalyseData = function() {\n var t3 = new Uint8Array(this.analyser.frequencyBinCount);\n return this.analyser.getByteTimeDomainData(t3), t3;\n }, t2.prototype.getData = function() {\n return this.flat();\n }, t2.prototype.clearRecordStatus = function() {\n this.lBuffer.length = 0, this.rBuffer.length = 0, this.size = 0, this.fileSize = 0, this.PCM = null, this.audioInput = null, this.duration = 0;\n }, t2.prototype.flat = function() {\n var t3 = null, e2 = new Float32Array(0);\n 1 === this.config.numChannels ? t3 = new Float32Array(this.size) : (t3 = new Float32Array(this.size / 2), e2 = new Float32Array(this.size / 2));\n for (var n2 = 0, i2 = 0; i2 < this.lBuffer.length; i2++) t3.set(this.lBuffer[i2], n2), n2 += this.lBuffer[i2].length;\n n2 = 0;\n for (i2 = 0; i2 < this.rBuffer.length; i2++) e2.set(this.rBuffer[i2], n2), n2 += this.rBuffer[i2].length;\n return { left: t3, right: e2 };\n }, t2.prototype.initRecorder = function() {\n var t3 = this;\n this.clearRecordStatus(), this.context = new (window.AudioContext || window.webkitAudioContext)(), this.analyser = this.context.createAnalyser(), this.analyser.fftSize = 2048;\n var e2 = this.context.createScriptProcessor || this.context.createJavaScriptNode;\n this.recorder = e2.apply(this.context, [4096, this.config.numChannels, this.config.numChannels]), this.recorder.onaudioprocess = function(e3) {\n if (t3.needRecord) {\n var n2, i2 = e3.inputBuffer.getChannelData(0), o3 = null;\n t3.lBuffer.push(new Float32Array(i2)), t3.size += i2.length, 2 === t3.config.numChannels && (o3 = e3.inputBuffer.getChannelData(1), t3.rBuffer.push(new Float32Array(o3)), t3.size += o3.length), t3.fileSize = Math.floor(t3.size / Math.max(t3.inputSampleRate / t3.outputSampleRate, 1)) * (t3.oututSampleBits / 8), n2 = 100 * Math.max.apply(Math, i2), t3.duration += 4096 / t3.inputSampleRate, t3.onprocess && t3.onprocess(t3.duration), t3.onprogress && t3.onprogress({ duration: t3.duration, fileSize: t3.fileSize, vol: n2 });\n }\n };\n }, t2.prototype.stopStream = function() {\n this.stream && this.stream.getTracks && (this.stream.getTracks().forEach(function(t3) {\n return t3.stop();\n }), this.stream = null);\n }, t2.prototype.closeAudioContext = function() {\n return this.context && this.context.close && \"closed\" !== this.context.state ? this.context.close() : new Promise(function(t3) {\n t3();\n });\n }, t2.initUserMedia = function() {\n void 0 === navigator.mediaDevices && (navigator.mediaDevices = {}), void 0 === navigator.mediaDevices.getUserMedia && (navigator.mediaDevices.getUserMedia = function(t3) {\n var e2 = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;\n return e2 ? new Promise(function(n2, i2) {\n e2.call(navigator, t3, n2, i2);\n }) : Promise.reject(new Error(\"\\u6D4F\\u89C8\\u5668\\u4E0D\\u652F\\u6301 getUserMedia !\"));\n });\n }, t2.prototype.transformIntoPCM = function(t3, e2) {\n var n2 = new Float32Array(t3), o3 = new Float32Array(e2), r2 = i.compress({ left: n2, right: o3 }, this.inputSampleRate, this.outputSampleRate);\n return i.encodePCM(r2, this.oututSampleBits, this.littleEdian);\n }, t2.getPermission = function() {\n return this.initUserMedia(), navigator.mediaDevices.getUserMedia({ audio: true }).then(function(t3) {\n t3 && t3.getTracks().forEach(function(t4) {\n return t4.stop();\n });\n });\n }, t2;\n })();\n e.default = o2;\n }]).default;\n });\n }\n});\n\n// node_modules/.pnpm/js-audio-recorder@1.0.7/node_modules/js-audio-recorder/index.js\nvar require_js_audio_recorder = __commonJS({\n \"node_modules/.pnpm/js-audio-recorder@1.0.7/node_modules/js-audio-recorder/index.js\"(exports, module) {\n \"use strict\";\n module.exports = require_recorder();\n }\n});\n\n// src/index.ts\nvar import_js_audio_recorder = __toESM(require_js_audio_recorder());\n\n// node_modules/.pnpm/media-devices@0.5.0/node_modules/media-devices/dist/media-devices.js\nvar f = Object.defineProperty;\nvar p = (e, t, n) => t in e ? f(e, t, { enumerable: true, configurable: true, writable: true, value: n }) : e[t] = n;\nvar r = (e, t, n) => (p(e, typeof t != \"symbol\" ? t + \"\" : t, n), n);\nfunction o() {\n return typeof navigator < \"u\" && !!navigator.mediaDevices;\n}\nfunction c() {\n if (!o())\n throw new Error(\"The media devices API isn't supported here.\");\n return navigator.mediaDevices;\n}\nasync function g() {\n return (await c().enumerateDevices()).filter(h).map(m);\n}\nfunction h(e) {\n return e.deviceId !== \"default\";\n}\nfunction m(e) {\n return {\n label: e.label || null,\n kind: e.kind,\n deviceId: e.deviceId || null,\n groupId: e.groupId || null\n };\n}\nasync function I(e) {\n return c().getUserMedia(e);\n}\nvar y = class {\n constructor() {\n r(this, \"_knownDevices\", []);\n r(this, \"_gainedScreenAccessOnce\", false);\n r(this, \"ondevicechange\", null);\n r(this, \"getUserMedia\", async (t) => {\n const n = await I(t);\n return this.enumerateDevices(), n;\n });\n r(this, \"getDisplayMedia\", async (t) => {\n const n = await c().getDisplayMedia(t);\n return this._gainedScreenAccessOnce || (this._gainedScreenAccessOnce = true, this.enumerateDevices()), n;\n });\n r(this, \"enumerateDevices\", async () => {\n const t = await g();\n return this._checkForDeviceChanges(t), t;\n });\n r(this, \"getSupportedConstraints\", () => c().getSupportedConstraints());\n o() && c().addEventListener(\"devicechange\", () => this.ondevicechange ? this.enumerateDevices() : Promise.resolve());\n }\n _checkForDeviceChanges(t) {\n var a;\n const n = this._knownDevices;\n this._knownDevices = t;\n const i = this._calculateDeviceDiff(\n t,\n n\n );\n i.length && ((a = this.ondevicechange) == null || a.call(this, { changes: i, devices: t }));\n }\n /**\n * Note: The device enumeration API may return null values for device IDs\n * and labels. To avoid creating erroneous \"Device Added\" notifications,\n * a best effort should be made to detect when devices are identical.\n *\n * Order is significant. Preferred devices are listed first, which helps\n * correlate devices from permissioned requests with unpermissioned\n * requests.\n */\n _calculateDeviceDiff(t, n) {\n const i = n.slice(), a = [], l = t.filter((s) => {\n const d = i.findIndex((u) => _(s, u));\n if (d > -1) {\n const [u] = i.splice(d, 1);\n if (s.label !== u.label) {\n const v = {\n type: \"update\",\n newInfo: s,\n oldInfo: u\n };\n a.push(v);\n }\n }\n return d === -1;\n });\n return [\n ...a,\n // A device was just removed.\n ...i.map((s) => ({ type: \"remove\", device: s })),\n // A device was just plugged in.\n ...l.map((s) => ({ type: \"add\", device: s }))\n ];\n }\n};\nfunction _(e, t) {\n if (t.deviceId)\n return e.deviceId === t.deviceId;\n function n(i) {\n return `${i.kind}:${i.groupId}`;\n }\n return n(e) === n(t);\n}\nvar M = new y();\n\n// src/errors.ts\nvar AudioRecorderError = class _AudioRecorderError extends Error {\n constructor(code, message, rawError) {\n super(message);\n this.name = \"AudioRecorderError\";\n this.code = code;\n this.rawError = rawError;\n if (typeof Object.setPrototypeOf === \"function\") {\n Object.setPrototypeOf(this, _AudioRecorderError.prototype);\n }\n }\n};\nfunction mapDOMExceptionToErrorCode(err) {\n if (err && typeof err === \"object\" && \"name\" in err) {\n const name = err.name;\n if (name === \"NotAllowedError\" || name === \"SecurityError\") {\n return \"PERMISSION_DENIED\";\n }\n if (name === \"NotFoundError\" || name === \"OverconstrainedError\") {\n return \"NO_DEVICE\";\n }\n }\n return \"UNKNOWN\";\n}\n\n// src/index.ts\nfunction isRecordingSupported() {\n if (typeof window === \"undefined\") return false;\n const hasAudioContext = !!(window.AudioContext || window.webkitAudioContext);\n return o() && hasAudioContext;\n}\nasync function checkRecordingPermission() {\n if (typeof navigator === \"undefined\" || !navigator.mediaDevices) {\n throw new AudioRecorderError(\"NOT_SUPPORTED\", \"MediaDevices API not supported\");\n }\n if (navigator.permissions && navigator.permissions.query) {\n try {\n const status = await navigator.permissions.query({ name: \"microphone\" });\n return status.state;\n } catch {\n }\n }\n try {\n const stream = await navigator.mediaDevices.getUserMedia({ audio: true });\n stream.getTracks().forEach((track) => track.stop());\n return \"granted\";\n } catch (err) {\n const code = mapDOMExceptionToErrorCode(err);\n if (code === \"PERMISSION_DENIED\") return \"denied\";\n throw new AudioRecorderError(code, \"Permission check failed\", err);\n }\n}\nvar AudioRecorder = class _AudioRecorder {\n constructor(options = {}) {\n this._state = \"idle\";\n this._duration = 0;\n this._isAutoStopping = false;\n this._recorder = null;\n if (options.maxDuration !== void 0) {\n if (!Number.isFinite(options.maxDuration) || options.maxDuration <= 0) {\n throw new AudioRecorderError(\n \"MAX_DURATION_INVALID\",\n `maxDuration must be a positive finite number, got: ${options.maxDuration}`\n );\n }\n }\n const { _createRecorder, _supportsMediaDevices, ...publicOptions } = options;\n this._options = publicOptions;\n this._createRecorder = _createRecorder || ((cfg) => new import_js_audio_recorder.default(cfg));\n this._supportsMediaDevices = _supportsMediaDevices || (() => _AudioRecorder.isSupported());\n }\n get state() {\n return this._state;\n }\n get duration() {\n return this._duration;\n }\n async start() {\n if (this._state !== \"idle\" && this._state !== \"stopped\") {\n throw new AudioRecorderError(\"INVALID_STATE\", `Cannot start when state is ${this._state}`);\n }\n if (!this._supportsMediaDevices()) {\n throw new AudioRecorderError(\"NOT_SUPPORTED\", \"Recording is not supported in this browser\");\n }\n this._duration = 0;\n this._isAutoStopping = false;\n if (this._recorder) {\n try {\n await this._recorder.destroy();\n } catch {\n }\n this._recorder = null;\n }\n this._recorder = this._createRecorder({\n sampleRate: this._options.sampleRate ?? 16e3,\n sampleBits: this._options.sampleBits ?? 16,\n numChannels: this._options.numChannels ?? 1\n });\n this._attachRecorderHooks(this._recorder);\n try {\n await this._recorder.start();\n this._state = \"recording\";\n } catch (err) {\n try {\n await this._recorder?.destroy();\n } catch {\n }\n this._recorder = null;\n const code = mapDOMExceptionToErrorCode(err);\n const wrapped = new AudioRecorderError(code, `Failed to start recording: ${code}`, err);\n this._options.onError?.(wrapped);\n throw wrapped;\n }\n }\n pause() {\n if (this._state !== \"recording\") {\n throw new AudioRecorderError(\"INVALID_STATE\", `Cannot pause when state is ${this._state}`);\n }\n this._recorder?.pause();\n this._state = \"paused\";\n }\n resume() {\n if (this._state !== \"paused\") {\n throw new AudioRecorderError(\"INVALID_STATE\", `Cannot resume when state is ${this._state}`);\n }\n this._recorder?.resume();\n this._state = \"recording\";\n }\n async stop(options) {\n if (this._state !== \"recording\" && this._state !== \"paused\") {\n throw new AudioRecorderError(\"INVALID_STATE\", `Cannot stop when state is ${this._state}`);\n }\n if (!this._recorder) {\n throw new AudioRecorderError(\"NOT_INITIALIZED\", \"Recorder instance not initialized\");\n }\n this._recorder.stop();\n this._state = \"stopped\";\n const blob = this._recorder.getWAVBlob();\n const filename = options?.filename || `record_${Date.now()}.wav`;\n const file = new File([blob], filename, { type: \"audio/wav\" });\n const url = typeof URL !== \"undefined\" && typeof URL.createObjectURL === \"function\" ? URL.createObjectURL(blob) : \"\";\n return { blob, file, url, duration: this._duration };\n }\n async destroy() {\n if (this._state === \"destroyed\") return;\n if (this._recorder) {\n if (this._state === \"recording\" || this._state === \"paused\") {\n try {\n this._recorder.stop();\n } catch {\n }\n }\n try {\n await this._recorder.destroy();\n } catch {\n }\n this._recorder = null;\n }\n this._options = {};\n this._state = \"destroyed\";\n }\n _attachRecorderHooks(recorder) {\n recorder.onprogress = (payload) => {\n if (this._state !== \"recording\" || this._isAutoStopping) return;\n this._duration = Math.round(payload.duration * 1e3);\n this._options.onTimeUpdate?.(this._duration);\n const waveData = recorder.getRecordAnalyseData?.() ?? new Uint8Array(1024).fill(128);\n this._options.onWaveDataUpdate?.({\n vol: Math.min(100, Math.max(0, Math.round(payload.vol || 0))),\n waveData,\n duration: this._duration\n });\n if (this._options.maxDuration && this._duration >= this._options.maxDuration) {\n this._isAutoStopping = true;\n this._options.onMaxReach?.();\n this.stop().catch((err) => {\n this._options.onError?.(err);\n });\n }\n };\n }\n};\nAudioRecorder.isSupported = isRecordingSupported;\nAudioRecorder.checkPermission = checkRecordingPermission;\nvar index_default = AudioRecorder;\nexport {\n AudioRecorder,\n AudioRecorderError,\n index_default as default,\n mapDOMExceptionToErrorCode\n};\n/*! Bundled license information:\n\njs-audio-recorder/dist/recorder.js:\n (*!\n * \n * js-audio-recorder - js audio recorder plugin\n * \n * @version v1.0.7\n * @homepage https://github.com/2fps/recorder\n * @author 2fps <echoweb@126.com> (https://www.zhuyuntao.cn)\n * @license MIT\n * \n *)\n*/\n","/*!\r\n * \r\n * js-audio-recorder - js audio recorder plugin\r\n * \r\n * @version v1.0.7\r\n * @homepage https://github.com/2fps/recorder\r\n * @author 2fps <echoweb@126.com> (https://www.zhuyuntao.cn)\r\n * @license MIT\r\n * \r\n */\r\n!function(t,e){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=e():\"function\"==typeof define&&define.amd?define([],e):\"object\"==typeof exports?exports.Recorder=e():t.Recorder=e()}(this,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){\"undefined\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:\"Module\"}),Object.defineProperty(t,\"__esModule\",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&\"object\"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,\"default\",{enumerable:!0,value:t}),2&e&&\"string\"!=typeof t)for(var o in t)n.d(i,o,function(e){return t[e]}.bind(null,o));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,\"a\",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p=\"\",n(n.s=1)}([function(t,e,n){\"use strict\";function i(t,e,n){for(var i=0;i<n.length;i++)t.setUint8(e+i,n.charCodeAt(i))}Object.defineProperty(e,\"__esModule\",{value:!0}),e.compress=function(t,e,n){for(var i=e/n,o=Math.max(i,1),r=t.left,a=t.right,s=Math.floor((r.length+a.length)/i),u=new Float32Array(s),c=0,l=0;c<s;){var f=Math.floor(l);u[c]=r[f],c++,a.length&&(u[c]=a[f],c++),l+=o}return u},e.encodePCM=function(t,e,n){void 0===n&&(n=!0);var i=0,o=t.length*(e/8),r=new ArrayBuffer(o),a=new DataView(r);if(8===e)for(var s=0;s<t.length;s++,i++){var u=(c=Math.max(-1,Math.min(1,t[s])))<0?128*c:127*c;u=+u+128,a.setInt8(i,u)}else for(s=0;s<t.length;s++,i+=2){var c=Math.max(-1,Math.min(1,t[s]));a.setInt16(i,c<0?32768*c:32767*c,n)}return a},e.encodeWAV=function(t,e,n,o,r,a){void 0===a&&(a=!0);var s=n>e?e:n,u=r,c=new ArrayBuffer(44+t.byteLength),l=new DataView(c),f=o,p=0;i(l,p,\"RIFF\"),p+=4,l.setUint32(p,36+t.byteLength,a),i(l,p+=4,\"WAVE\"),i(l,p+=4,\"fmt \"),p+=4,l.setUint32(p,16,a),p+=4,l.setUint16(p,1,a),p+=2,l.setUint16(p,f,a),p+=2,l.setUint32(p,s,a),p+=4,l.setUint32(p,f*s*(u/8),a),p+=4,l.setUint16(p,f*(u/8),a),p+=2,l.setUint16(p,u,a),i(l,p+=2,\"data\"),p+=4,l.setUint32(p,t.byteLength,a),p+=4;for(var d=0;d<t.byteLength;)l.setUint8(p,t.getUint8(d)),p++,d++;return l}},function(t,e,n){\"use strict\";var i,o=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,\"__esModule\",{value:!0});var r=n(2),a=n(0),s=n(3),u=function(t){function e(e){void 0===e&&(e={});var n=t.call(this,e)||this;return n.isrecording=!1,n.ispause=!1,n.isplaying=!1,n}return o(e,t),e.prototype.setOption=function(t){void 0===t&&(t={}),this.setNewOption(t)},e.prototype.start=function(){return this.isrecording?Promise.reject():(this.isrecording=!0,this.startRecord())},e.prototype.pause=function(){this.isrecording&&!this.ispause&&(this.ispause=!0,this.pauseRecord())},e.prototype.resume=function(){this.isrecording&&this.ispause&&(this.ispause=!1,this.resumeRecord())},e.prototype.stop=function(){this.isrecording&&(this.isrecording=!1,this.ispause=!1,this.stopRecord())},e.prototype.play=function(){this.stop(),this.isplaying=!0,this.onplay&&this.onplay(),s.default.addPlayEnd(this.onplayend);var t=this.getWAV();t.byteLength>44&&s.default.play(t.buffer)},e.prototype.getPlayTime=function(){return s.default.getPlayTime()},e.prototype.pausePlay=function(){!this.isrecording&&this.isplaying&&(this.isplaying=!1,this.onpauseplay&&this.onpauseplay(),s.default.pausePlay())},e.prototype.resumePlay=function(){this.isrecording||this.isplaying||(this.isplaying=!0,this.onresumeplay&&this.onresumeplay(),s.default.resumePlay())},e.prototype.stopPlay=function(){this.isrecording||(this.isplaying=!1,this.onstopplay&&this.onstopplay(),s.default.stopPlay())},e.prototype.destroy=function(){return s.default.destroyPlay(),this.destroyRecord()},e.prototype.getRecordAnalyseData=function(){return this.getAnalyseData()},e.prototype.getPlayAnalyseData=function(){return s.default.getAnalyseData()},e.prototype.getPCM=function(){this.stop();var t=this.getData();return t=a.compress(t,this.inputSampleRate,this.outputSampleRate),a.encodePCM(t,this.oututSampleBits,this.littleEdian)},e.prototype.getPCMBlob=function(){return new Blob([this.getPCM()])},e.prototype.downloadPCM=function(t){void 0===t&&(t=\"recorder\");var e=this.getPCMBlob();r.downloadPCM(e,t)},e.prototype.getWAV=function(){var t=this.getPCM();return a.encodeWAV(t,this.inputSampleRate,this.outputSampleRate,this.config.numChannels,this.oututSampleBits,this.littleEdian)},e.prototype.getWAVBlob=function(){return new Blob([this.getWAV()],{type:\"audio/wav\"})},e.prototype.downloadWAV=function(t){void 0===t&&(t=\"recorder\");var e=this.getWAVBlob();r.downloadWAV(e,t)},e.prototype.download=function(t,e,n){r.download(t,e,n)},e.prototype.getChannelData=function(){var t=this.getPCM(),e=t.byteLength,n=this.littleEdian,i={left:null,right:null};if(2===this.config.numChannels){var o=new DataView(new ArrayBuffer(e/2)),r=new DataView(new ArrayBuffer(e/2));if(16===this.config.sampleBits)for(var a=0;a<e/2;a+=2)o.setInt16(a,t.getInt16(2*a,n),n),r.setInt16(a,t.getInt16(2*a+2,n),n);else for(a=0;a<e/2;a+=2)o.setInt8(a,t.getInt8(2*a)),r.setInt8(a,t.getInt8(2*a+1));i.left=o,i.right=r}else i.left=t;return i},e}(n(5).default);e.default=u},function(t,e,n){\"use strict\";function i(t,e,n){var i=document.createElement(\"a\");i.href=window.URL.createObjectURL(t),i.download=e+\".\"+n,i.click()}Object.defineProperty(e,\"__esModule\",{value:!0}),e.downloadWAV=function(t,e){void 0===e&&(e=\"recorder\"),i(t,e,\"wav\")},e.downloadPCM=function(t,e){void 0===e&&(e=\"recorder\"),i(t,e,\"pcm\")},e.download=function(t,e,n){return i(t,e,n)}},function(t,e,n){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0});var i=n(4),o=null,r=0,a=0,s=null,u=null,c=null,l=!1,f=0,p=function(){};function d(){return l=!1,s.decodeAudioData(c.slice(0),function(t){(o=s.createBufferSource()).onended=function(){l||(f=s.currentTime-a+r,p())},o.buffer=t,o.connect(u),u.connect(s.destination),o.start(0,r),a=s.currentTime},function(t){i.throwError(t)})}function h(){o&&(o.stop(),o=null)}var y=function(){function t(){}return t.play=function(t){return s||(s=new(window.AudioContext||window.webkitAudioContext),(u=s.createAnalyser()).fftSize=2048),this.stopPlay(),c=t,f=0,d()},t.pausePlay=function(){h(),r+=s.currentTime-a,l=!0},t.resumePlay=function(){return d()},t.stopPlay=function(){r=0,c=null,h()},t.destroyPlay=function(){this.stopPlay()},t.getAnalyseData=function(){var t=new Uint8Array(u.frequencyBinCount);return u.getByteTimeDomainData(t),t},t.addPlayEnd=function(t){void 0===t&&(t=function(){}),p=t},t.getPlayTime=function(){var t=l?r:s.currentTime-a+r;return f||t},t}();e.default=y},function(t,e,n){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.throwError=function(t){throw new Error(t)}},function(t,e,n){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0});var i=n(0),o=function(){function t(e){void 0===e&&(e={}),this.size=0,this.lBuffer=[],this.rBuffer=[],this.tempPCM=[],this.inputSampleBits=16,this.fileSize=0,this.duration=0,this.needRecord=!0;var n,i=new(window.AudioContext||window.webkitAudioContext);this.inputSampleRate=i.sampleRate,this.setNewOption(e),this.littleEdian=(n=new ArrayBuffer(2),new DataView(n).setInt16(0,256,!0),256===new Int16Array(n)[0]),t.initUserMedia()}return t.prototype.setNewOption=function(t){void 0===t&&(t={}),this.config={sampleBits:~[8,16].indexOf(t.sampleBits)?t.sampleBits:16,sampleRate:~[8e3,11025,16e3,22050,24e3,44100,48e3].indexOf(t.sampleRate)?t.sampleRate:this.inputSampleRate,numChannels:~[1,2].indexOf(t.numChannels)?t.numChannels:1},this.outputSampleRate=this.config.sampleRate,this.oututSampleBits=this.config.sampleBits},t.prototype.startRecord=function(){var t=this;return this.context&&this.destroyRecord(),this.initRecorder(),navigator.mediaDevices.getUserMedia({audio:!0}).then(function(e){t.audioInput=t.context.createMediaStreamSource(e),t.stream=e}).then(function(){t.audioInput.connect(t.analyser),t.analyser.connect(t.recorder),t.recorder.connect(t.context.destination)})},t.prototype.pauseRecord=function(){this.needRecord=!1},t.prototype.resumeRecord=function(){this.needRecord=!0},t.prototype.stopRecord=function(){this.audioInput&&this.audioInput.disconnect(),this.source&&this.source.stop(),this.recorder.disconnect(),this.analyser.disconnect(),this.needRecord=!0},t.prototype.destroyRecord=function(){return this.clearRecordStatus(),this.stopStream(),this.closeAudioContext()},t.prototype.getAnalyseData=function(){var t=new Uint8Array(this.analyser.frequencyBinCount);return this.analyser.getByteTimeDomainData(t),t},t.prototype.getData=function(){return this.flat()},t.prototype.clearRecordStatus=function(){this.lBuffer.length=0,this.rBuffer.length=0,this.size=0,this.fileSize=0,this.PCM=null,this.audioInput=null,this.duration=0},t.prototype.flat=function(){var t=null,e=new Float32Array(0);1===this.config.numChannels?t=new Float32Array(this.size):(t=new Float32Array(this.size/2),e=new Float32Array(this.size/2));for(var n=0,i=0;i<this.lBuffer.length;i++)t.set(this.lBuffer[i],n),n+=this.lBuffer[i].length;n=0;for(i=0;i<this.rBuffer.length;i++)e.set(this.rBuffer[i],n),n+=this.rBuffer[i].length;return{left:t,right:e}},t.prototype.initRecorder=function(){var t=this;this.clearRecordStatus(),this.context=new(window.AudioContext||window.webkitAudioContext),this.analyser=this.context.createAnalyser(),this.analyser.fftSize=2048;var e=this.context.createScriptProcessor||this.context.createJavaScriptNode;this.recorder=e.apply(this.context,[4096,this.config.numChannels,this.config.numChannels]),this.recorder.onaudioprocess=function(e){if(t.needRecord){var n,i=e.inputBuffer.getChannelData(0),o=null;t.lBuffer.push(new Float32Array(i)),t.size+=i.length,2===t.config.numChannels&&(o=e.inputBuffer.getChannelData(1),t.rBuffer.push(new Float32Array(o)),t.size+=o.length),t.fileSize=Math.floor(t.size/Math.max(t.inputSampleRate/t.outputSampleRate,1))*(t.oututSampleBits/8),n=100*Math.max.apply(Math,i),t.duration+=4096/t.inputSampleRate,t.onprocess&&t.onprocess(t.duration),t.onprogress&&t.onprogress({duration:t.duration,fileSize:t.fileSize,vol:n})}}},t.prototype.stopStream=function(){this.stream&&this.stream.getTracks&&(this.stream.getTracks().forEach(function(t){return t.stop()}),this.stream=null)},t.prototype.closeAudioContext=function(){return this.context&&this.context.close&&\"closed\"!==this.context.state?this.context.close():new Promise(function(t){t()})},t.initUserMedia=function(){void 0===navigator.mediaDevices&&(navigator.mediaDevices={}),void 0===navigator.mediaDevices.getUserMedia&&(navigator.mediaDevices.getUserMedia=function(t){var e=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia;return e?new Promise(function(n,i){e.call(navigator,t,n,i)}):Promise.reject(new Error(\"浏览器不支持 getUserMedia !\"))})},t.prototype.transformIntoPCM=function(t,e){var n=new Float32Array(t),o=new Float32Array(e),r=i.compress({left:n,right:o},this.inputSampleRate,this.outputSampleRate);return i.encodePCM(r,this.oututSampleBits,this.littleEdian)},t.getPermission=function(){return this.initUserMedia(),navigator.mediaDevices.getUserMedia({audio:!0}).then(function(t){t&&t.getTracks().forEach(function(t){return t.stop()})})},t}();e.default=o}]).default});\r","module.exports = require(\"./dist/recorder.js\");\r\n","import Recorder from 'js-audio-recorder';\nimport { supportsMediaDevices } from 'media-devices';\nimport { AudioRecorderError, mapDOMExceptionToErrorCode } from './errors';\nimport type {\n AudioRecorderOptions,\n RecorderState,\n StopOptions,\n StopResult,\n} from './types';\n\nexport * from './types';\nexport * from './errors';\n\nexport interface AudioRecorderInternalOptions extends AudioRecorderOptions {\n _createRecorder?: (config: any) => Recorder;\n _supportsMediaDevices?: () => boolean;\n}\n\nfunction isRecordingSupported(): boolean {\n if (typeof window === 'undefined') return false;\n const hasAudioContext = !!(window.AudioContext || (window as any).webkitAudioContext);\n return supportsMediaDevices() && hasAudioContext;\n}\n\nasync function checkRecordingPermission(): Promise<'granted' | 'denied' | 'prompt'> {\n if (typeof navigator === 'undefined' || !navigator.mediaDevices) {\n throw new AudioRecorderError('NOT_SUPPORTED', 'MediaDevices API not supported');\n }\n\n if (navigator.permissions && navigator.permissions.query) {\n try {\n const status = await navigator.permissions.query({ name: 'microphone' as PermissionName });\n return status.state as 'granted' | 'denied' | 'prompt';\n } catch {\n // Some browsers cannot query microphone permission; fall through to getUserMedia probe\n }\n }\n\n try {\n const stream = await navigator.mediaDevices.getUserMedia({ audio: true });\n stream.getTracks().forEach((track) => track.stop());\n return 'granted';\n } catch (err) {\n const code = mapDOMExceptionToErrorCode(err);\n if (code === 'PERMISSION_DENIED') return 'denied';\n throw new AudioRecorderError(code, 'Permission check failed', err);\n }\n}\n\nclass AudioRecorder {\n static isSupported: typeof isRecordingSupported;\n static checkPermission: typeof checkRecordingPermission;\n\n private _state: RecorderState = 'idle';\n private _duration: number = 0;\n private _isAutoStopping = false;\n private _recorder: Recorder | null = null;\n private _options: AudioRecorderOptions;\n private _createRecorder: (config: any) => Recorder;\n private _supportsMediaDevices: () => boolean;\n\n constructor(options: AudioRecorderInternalOptions = {}) {\n if (options.maxDuration !== undefined) {\n if (!Number.isFinite(options.maxDuration) || options.maxDuration <= 0) {\n throw new AudioRecorderError(\n 'MAX_DURATION_INVALID',\n `maxDuration must be a positive finite number, got: ${options.maxDuration}`\n );\n }\n }\n\n const { _createRecorder, _supportsMediaDevices, ...publicOptions } = options;\n this._options = publicOptions;\n this._createRecorder = _createRecorder || ((cfg) => new Recorder(cfg));\n this._supportsMediaDevices =\n _supportsMediaDevices || (() => AudioRecorder.isSupported());\n }\n\n get state(): RecorderState {\n return this._state;\n }\n\n get duration(): number {\n return this._duration;\n }\n\n async start(): Promise<void> {\n if (this._state !== 'idle' && this._state !== 'stopped') {\n throw new AudioRecorderError('INVALID_STATE', `Cannot start when state is ${this._state}`);\n }\n if (!this._supportsMediaDevices()) {\n throw new AudioRecorderError('NOT_SUPPORTED', 'Recording is not supported in this browser');\n }\n\n this._duration = 0;\n this._isAutoStopping = false;\n\n // Free the previous session's AudioContext + MediaStream (upstream stop() alone keeps them alive)\n if (this._recorder) {\n try {\n await this._recorder.destroy();\n } catch {\n // ignore cleanup errors from previous session\n }\n this._recorder = null;\n }\n\n this._recorder = this._createRecorder({\n sampleRate: this._options.sampleRate ?? 16000,\n sampleBits: this._options.sampleBits ?? 16,\n numChannels: this._options.numChannels ?? 1,\n });\n this._attachRecorderHooks(this._recorder);\n\n try {\n await this._recorder.start();\n this._state = 'recording';\n } catch (err) {\n // Upstream may have created an AudioContext before failing; release it\n try {\n await this._recorder?.destroy();\n } catch {\n // ignore cleanup errors on the failed instance\n }\n this._recorder = null;\n const code = mapDOMExceptionToErrorCode(err);\n const wrapped = new AudioRecorderError(code, `Failed to start recording: ${code}`, err);\n this._options.onError?.(wrapped);\n throw wrapped;\n }\n }\n\n pause(): void {\n if (this._state !== 'recording') {\n throw new AudioRecorderError('INVALID_STATE', `Cannot pause when state is ${this._state}`);\n }\n this._recorder?.pause();\n this._state = 'paused';\n }\n\n resume(): void {\n if (this._state !== 'paused') {\n throw new AudioRecorderError('INVALID_STATE', `Cannot resume when state is ${this._state}`);\n }\n this._recorder?.resume();\n this._state = 'recording';\n }\n\n async stop(options?: StopOptions): Promise<StopResult> {\n if (this._state !== 'recording' && this._state !== 'paused') {\n throw new AudioRecorderError('INVALID_STATE', `Cannot stop when state is ${this._state}`);\n }\n if (!this._recorder) {\n throw new AudioRecorderError('NOT_INITIALIZED', 'Recorder instance not initialized');\n }\n\n this._recorder.stop();\n this._state = 'stopped';\n\n const blob = this._recorder.getWAVBlob();\n const filename = options?.filename || `record_${Date.now()}.wav`;\n const file = new File([blob], filename, { type: 'audio/wav' });\n const url =\n typeof URL !== 'undefined' && typeof URL.createObjectURL === 'function'\n ? URL.createObjectURL(blob)\n : '';\n\n return { blob, file, url, duration: this._duration };\n }\n\n async destroy(): Promise<void> {\n if (this._state === 'destroyed') return;\n if (this._recorder) {\n if (this._state === 'recording' || this._state === 'paused') {\n try {\n this._recorder.stop();\n } catch {\n // ignore stop errors during destroy\n }\n }\n try {\n await this._recorder.destroy();\n } catch {\n // ignore cleanup errors\n }\n this._recorder = null;\n }\n this._options = {};\n this._state = 'destroyed';\n }\n\n private _attachRecorderHooks(recorder: Recorder): void {\n recorder.onprogress = (payload) => {\n if (this._state !== 'recording' || this._isAutoStopping) return;\n\n // upstream duration is in SECONDS; public contract is milliseconds\n this._duration = Math.round(payload.duration * 1000);\n this._options.onTimeUpdate?.(this._duration);\n\n const waveData = recorder.getRecordAnalyseData?.() ?? new Uint8Array(1024).fill(128);\n this._options.onWaveDataUpdate?.({\n vol: Math.min(100, Math.max(0, Math.round(payload.vol || 0))),\n waveData,\n duration: this._duration,\n });\n\n if (this._options.maxDuration && this._duration >= this._options.maxDuration) {\n this._isAutoStopping = true;\n this._options.onMaxReach?.();\n this.stop().catch((err) => {\n this._options.onError?.(err as AudioRecorderError);\n });\n }\n };\n }\n}\n\n// Attach statics explicitly so transpilers that misclassify `static` members\n// still expose them on the constructor rather than the prototype.\nAudioRecorder.isSupported = isRecordingSupported;\nAudioRecorder.checkPermission = checkRecordingPermission;\n\n// Named + default export: the named binding survives CommonJS namespace\n// wrapping, while the default stays compatible with default imports.\nexport { AudioRecorder };\nexport default AudioRecorder;\n","var f = Object.defineProperty;\nvar p = (e, t, n) => t in e ? f(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;\nvar r = (e, t, n) => (p(e, typeof t != \"symbol\" ? t + \"\" : t, n), n);\nfunction o() {\n return typeof navigator < \"u\" && !!navigator.mediaDevices;\n}\nfunction c() {\n if (!o())\n throw new Error(\"The media devices API isn't supported here.\");\n return navigator.mediaDevices;\n}\nasync function g() {\n return (await c().enumerateDevices()).filter(h).map(m);\n}\nfunction h(e) {\n return e.deviceId !== \"default\";\n}\nfunction m(e) {\n return {\n label: e.label || null,\n kind: e.kind,\n deviceId: e.deviceId || null,\n groupId: e.groupId || null\n };\n}\nvar D = /* @__PURE__ */ ((e) => (e.VideoInput = \"videoinput\", e.AudioInput = \"audioinput\", e.AudioOutput = \"audiooutput\", e))(D || {});\nasync function I(e) {\n return c().getUserMedia(e);\n}\nclass y {\n constructor() {\n r(this, \"_knownDevices\", []);\n r(this, \"_gainedScreenAccessOnce\", !1);\n /**\n * Specifies a function to be called whenever the list of available devices\n * changes.\n *\n * Note: this is different from the native event. It passes the changeset\n * and full list of devices as a parameter.\n */\n r(this, \"ondevicechange\", null);\n /**\n * Request a live media stream from audio and/or video devices. Streams are\n * configurable through constraints.\n * See: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia\n */\n r(this, \"getUserMedia\", async (t) => {\n const n = await I(t);\n return this.enumerateDevices(), n;\n });\n /**\n * Ask the user to share their screen. Resolves with a media stream carrying\n * video, and potentially audio from the application window.\n * See: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getDisplayMedia\n */\n r(this, \"getDisplayMedia\", async (t) => {\n const n = await c().getDisplayMedia(t);\n return this._gainedScreenAccessOnce || (this._gainedScreenAccessOnce = !0, this.enumerateDevices()), n;\n });\n /**\n * Lists every available hardware device, including microphones, cameras,\n * and speakers (depending on browser support). May contain redacted\n * information depending on application permissions.\n */\n r(this, \"enumerateDevices\", async () => {\n const t = await g();\n return this._checkForDeviceChanges(t), t;\n });\n /**\n * Returns an object containing every media constraint supported by the\n * browser.\n * See: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getSupportedConstraints\n */\n r(this, \"getSupportedConstraints\", () => c().getSupportedConstraints());\n o() && c().addEventListener(\"devicechange\", () => this.ondevicechange ? this.enumerateDevices() : Promise.resolve());\n }\n _checkForDeviceChanges(t) {\n var a;\n const n = this._knownDevices;\n this._knownDevices = t;\n const i = this._calculateDeviceDiff(\n t,\n n\n );\n i.length && ((a = this.ondevicechange) == null || a.call(this, { changes: i, devices: t }));\n }\n /**\n * Note: The device enumeration API may return null values for device IDs\n * and labels. To avoid creating erroneous \"Device Added\" notifications,\n * a best effort should be made to detect when devices are identical.\n *\n * Order is significant. Preferred devices are listed first, which helps\n * correlate devices from permissioned requests with unpermissioned\n * requests.\n */\n _calculateDeviceDiff(t, n) {\n const i = n.slice(), a = [], l = t.filter((s) => {\n const d = i.findIndex((u) => _(s, u));\n if (d > -1) {\n const [u] = i.splice(d, 1);\n if (s.label !== u.label) {\n const v = {\n type: \"update\",\n newInfo: s,\n oldInfo: u\n };\n a.push(v);\n }\n }\n return d === -1;\n });\n return [\n ...a,\n // A device was just removed.\n ...i.map((s) => ({ type: \"remove\", device: s })),\n // A device was just plugged in.\n ...l.map((s) => ({ type: \"add\", device: s }))\n ];\n }\n}\nfunction _(e, t) {\n if (t.deviceId)\n return e.deviceId === t.deviceId;\n function n(i) {\n return `${i.kind}:${i.groupId}`;\n }\n return n(e) === n(t);\n}\nvar k = /* @__PURE__ */ ((e) => (e.Add = \"add\", e.Remove = \"remove\", e.Update = \"update\", e))(k || {});\nconst M = new y();\nexport {\n D as DeviceKind,\n k as OperationType,\n M as default,\n o as supportsMediaDevices\n};\n","import { ErrorCode } from './types';\n\nexport class AudioRecorderError extends Error {\n readonly code: ErrorCode;\n readonly rawError?: unknown;\n\n constructor(code: ErrorCode, message: string, rawError?: unknown) {\n super(message);\n this.name = 'AudioRecorderError';\n this.code = code;\n this.rawError = rawError;\n if (typeof Object.setPrototypeOf === 'function') {\n Object.setPrototypeOf(this, AudioRecorderError.prototype);\n }\n }\n}\n\nexport function mapDOMExceptionToErrorCode(err: unknown): ErrorCode {\n if (err && typeof err === 'object' && 'name' in err) {\n const name = (err as { name: string }).name;\n if (name === 'NotAllowedError' || name === 'SecurityError') {\n return 'PERMISSION_DENIED';\n }\n if (name === 'NotFoundError' || name === 'OverconstrainedError') {\n return 'NO_DEVICE';\n }\n }\n return 'UNKNOWN';\n}\n"]}