var i="0.12.1",f=`https://unpkg.com/@ffmpeg/core@${i}/dist/umd/ffmpeg-core.js`,R;(function(r){r.LOAD="LOAD",r.EXEC="EXEC",r.WRITE_FILE="WRITE_FILE",r.READ_FILE="READ_FILE",r.DELETE_FILE="DELETE_FILE",r.RENAME="RENAME",r.CREATE_DIR="CREATE_DIR",r.LIST_DIR="LIST_DIR",r.DELETE_DIR="DELETE_DIR",r.ERROR="ERROR",r.DOWNLOAD="DOWNLOAD",r.PROGRESS="PROGRESS",r.LOG="LOG"})(R||(R={}));var D=new Error("unknown message type"),L=new Error("ffmpeg is not loaded, call `await ffmpeg.load()` first"),d=new Error("called FFmpeg.terminate()"),l=new Error("failed to import ffmpeg-core.js"),t,O=async({coreURL:r=f,wasmURL:a,workerURL:E})=>{let s=!t,e=r,o=a||r.replace(/.js$/g,".wasm"),c=E||r.replace(/.js$/g,".worker.js");try{importScripts(e)}catch{if(self.createFFmpegCore=(await import(e)).default,!self.createFFmpegCore)throw l}return t=await self.createFFmpegCore({mainScriptUrlOrBlob:`${e}#${btoa(JSON.stringify({wasmURL:o,workerURL:c}))}`}),t.setLogger(n=>self.postMessage({type:R.LOG,data:n})),t.setProgress(n=>self.postMessage({type:R.PROGRESS,data:n})),s},m=({args:r,timeout:a=-1})=>{t.setTimeout(a),t.exec(...r);let E=t.ret;return t.reset(),E},I=({path:r,data:a})=>(t.FS.writeFile(r,a),!0),u=({path:r,encoding:a})=>t.FS.readFile(r,{encoding:a}),S=({path:r})=>(t.FS.unlink(r),!0),A=({oldPath:r,newPath:a})=>(t.FS.rename(r,a),!0),w=({path:r})=>(t.FS.mkdir(r),!0),v=({path:r})=>{let a=t.FS.readdir(r),E=[];for(let s of a){let e=t.FS.stat(`${r}/${s}`),o=t.FS.isDir(e.mode);E.push({name:s,isDir:o})}return E},_=({path:r})=>(t.FS.rmdir(r),!0);self.onmessage=async({data:{id:r,type:a,data:E}})=>{let s=[],e;try{if(a!==R.LOAD&&!t)throw L;switch(a){case R.LOAD:e=await O(E);break;case R.EXEC:e=m(E);break;case R.WRITE_FILE:e=I(E);break;case R.READ_FILE:e=u(E);break;case R.DELETE_FILE:e=S(E);break;case R.RENAME:e=A(E);break;case R.CREATE_DIR:e=w(E);break;case R.LIST_DIR:e=v(E);break;case R.DELETE_DIR:e=_(E);break;default:throw D}}catch(o){self.postMessage({id:r,type:R.ERROR,data:o.toString()});return}e instanceof Uint8Array&&s.push(e.buffer),self.postMessage({id:r,type:a,data:e},s)};
