File size: 2,673 Bytes
dcc640d
1
!function(){var e={9322:function(e){function r(e){return Promise.resolve().then(function(){var r=Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r})}r.keys=function(){return[]},r.resolve=r,r.id=9322,e.exports=r}},r={};function t(a){var s=r[a];if(void 0!==s)return s.exports;var o=r[a]={exports:{}},E=!0;try{e[a](o,o.exports,t),E=!1}finally{E&&delete r[a]}return o.exports}t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},function(){"use strict";var e,r;let a;let s="https://unpkg.com/@ffmpeg/core@".concat("0.12.1","/dist/umd/ffmpeg-core.js");(r=e||(e={})).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";let o=Error("unknown message type"),E=Error("ffmpeg is not loaded, call `await ffmpeg.load()` first");Error("called FFmpeg.terminate()");let n=Error("failed to import ffmpeg-core.js"),c=async r=>{let{coreURL:o=s,wasmURL:E,workerURL:c}=r,l=!a,i=E||o.replace(/.js$/g,".wasm"),f=c||o.replace(/.js$/g,".worker.js");try{importScripts(o)}catch(e){if(self.createFFmpegCore=(await t(9322)(o)).default,!self.createFFmpegCore)throw n}return(a=await self.createFFmpegCore({mainScriptUrlOrBlob:"".concat(o,"#").concat(btoa(JSON.stringify({wasmURL:i,workerURL:f})))})).setLogger(r=>self.postMessage({type:e.LOG,data:r})),a.setProgress(r=>self.postMessage({type:e.PROGRESS,data:r})),l},l=e=>{let{args:r,timeout:t=-1}=e;a.setTimeout(t),a.exec(...r);let s=a.ret;return a.reset(),s},i=e=>{let{path:r,data:t}=e;return a.FS.writeFile(r,t),!0},f=e=>{let{path:r,encoding:t}=e;return a.FS.readFile(r,{encoding:t})},R=e=>{let{path:r}=e;return a.FS.unlink(r),!0},p=e=>{let{oldPath:r,newPath:t}=e;return a.FS.rename(r,t),!0},u=e=>{let{path:r}=e;return a.FS.mkdir(r),!0},L=e=>{let{path:r}=e,t=a.FS.readdir(r),s=[];for(let e of t){let t=a.FS.stat("".concat(r,"/").concat(e)),o=a.FS.isDir(t.mode);s.push({name:e,isDir:o})}return s},D=e=>{let{path:r}=e;return a.FS.rmdir(r),!0};self.onmessage=async r=>{let t,{data:{id:s,type:n,data:F}}=r,m=[];try{if(n!==e.LOAD&&!a)throw E;switch(n){case e.LOAD:t=await c(F);break;case e.EXEC:t=l(F);break;case e.WRITE_FILE:t=i(F);break;case e.READ_FILE:t=f(F);break;case e.DELETE_FILE:t=R(F);break;case e.RENAME:t=p(F);break;case e.CREATE_DIR:t=u(F);break;case e.LIST_DIR:t=L(F);break;case e.DELETE_DIR:t=D(F);break;default:throw o}}catch(r){self.postMessage({id:s,type:e.ERROR,data:r.toString()});return}t instanceof Uint8Array&&m.push(t.buffer),self.postMessage({id:s,type:n,data:t},m)}}(),_N_E={}}();