/**
 * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.
 * Original file: /npm/wav-decoder@1.3.0/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t={exports:{}};!function(t){var r={1:"lpcm",3:"lpcm"};function e(t,r){r=r||{},n.Buffer&&t instanceof n.Buffer&&(t=Uint8Array.from(t).buffer);var e=function(n){var t=0;return{remain:function(){return n.byteLength-t},skip:function(n){t+=n},uint8:function(){var r=n.getUint8(t,!0);return t+=1,r},int16:function(){var r=n.getInt16(t,!0);return t+=2,r},uint16:function(){var r=n.getUint16(t,!0);return t+=2,r},uint32:function(){var r=n.getUint32(t,!0);return t+=4,r},string:function(n){for(var t="",r=0;r<n;r++)t+=String.fromCharCode(this.uint8());return t},pcm8:function(){var r=n.getUint8(t)-128;return t+=1,r<0?r/128:r/127},pcm8s:function(){var r=n.getUint8(t)-127.5;return t+=1,r/127.5},pcm16:function(){var r=n.getInt16(t,!0);return t+=2,r<0?r/32768:r/32767},pcm16s:function(){var r=n.getInt16(t,!0);return t+=2,r/32768},pcm24:function(){var r=n.getUint8(t+0)+(n.getUint8(t+1)<<8)+(n.getUint8(t+2)<<16),e=r>8388608?r-16777216:r;return t+=3,e<0?e/8388608:e/8388607},pcm24s:function(){var r=n.getUint8(t+0)+(n.getUint8(t+1)<<8)+(n.getUint8(t+2)<<16);return t+=3,(r>8388608?r-16777216:r)/8388608},pcm32:function(){var r=n.getInt32(t,!0);return t+=4,r<0?r/2147483648:r/2147483647},pcm32s:function(){var r=n.getInt32(t,!0);return t+=4,r/2147483648},pcm32f:function(){var r=n.getFloat32(t,!0);return t+=4,r},pcm64f:function(){var r=n.getFloat64(t,!0);return t+=8,r}}}(new DataView(t));if("RIFF"!==e.string(4))throw new TypeError("Invalid WAV file");if(e.uint32(),"WAVE"!==e.string(4))throw new TypeError("Invalid WAV file");var a=null,u=null;do{var f=e.string(4),c=e.uint32();switch(f){case"fmt ":if((a=i(e,c))instanceof Error)throw a;break;case"data":if((u=o(e,c,a,r))instanceof Error)throw u;break;default:e.skip(c)}}while(null===u);return u}function i(n,t){var e=n.uint16();if(!r.hasOwnProperty(e))return new TypeError("Unsupported format in WAV file: 0x"+e.toString(16));var i={formatId:e,floatingPoint:3===e,numberOfChannels:n.uint16(),sampleRate:n.uint32(),byteRate:n.uint32(),blockSize:n.uint16(),bitDepth:n.uint16()};return n.skip(t-16),i}function o(n,t,r,e){t=Math.min(t,n.remain());for(var i=Math.floor(t/r.blockSize),o=r.numberOfChannels,a=r.sampleRate,u=new Array(o),f=0;f<o;f++)u[f]=new Float32Array(i);var c=function(n,t,r,e,i){var o=e.bitDepth,a=e.floatingPoint?"f":i.symmetric?"s":"",u="pcm"+o+a;if(!n[u])return new TypeError("Not supported bit depth: "+e.bitDepth);for(var f=n[u].bind(n),c=e.numberOfChannels,l=0;l<r;l++)for(var s=0;s<c;s++)t[s][l]=f();return null}(n,u,i,r,e);return c instanceof Error?c:{numberOfChannels:o,length:i,sampleRate:a,channelData:u}}t.exports.decode=function(n,t){return new Promise((function(r){r(e(n,t))}))},t.exports.decode.sync=e}(t);var r=t.exports,e=t.exports.decode;export{e as decode,r as default};
//# sourceMappingURL=/sm/fbea2696df56c6f4d12f9fbda87f17f1f841032310912954cb174af4406eea33.map