var OGVDemuxerOggW = (() => { var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename; return ( function(OGVDemuxerOggW) { OGVDemuxerOggW = OGVDemuxerOggW || {}; var a;a||(a=typeof OGVDemuxerOggW !== 'undefined' ? OGVDemuxerOggW : {});var h=Object.assign,k,l;a.ready=new Promise(function(b,c){k=b;l=c});var m=h({},a),n="object"===typeof window,p="function"===typeof importScripts,q="",r,t,u,fs,v,w; if("object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node)q=p?require("path").dirname(q)+"/":__dirname+"/",w=function(){v||(fs=require("fs"),v=require("path"))},r=function(b,c){w();b=v.normalize(b);return fs.readFileSync(b,c?null:"utf8")},u=function(b){b=r(b,!0);b.buffer||(b=new Uint8Array(b));return b},t=function(b,c,d){w();b=v.normalize(b);fs.readFile(b,function(e,f){e?d(e):c(f.buffer)})},1=T.length&&(T.length=b+1),T[b]=c=G.get(b));return c} var ca={},da={d:function(b,c,d){D.copyWithin(b,c,c+d)},e:function(b){var c=D.length;b>>>=0;if(2147483648=d;d*=2){var e=c*(1+.2/d);e=Math.min(e,b+100663296);e=Math.max(b,e);0>>16);F();var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},f:function(b,c,d,e){b=ca.C(b);c=ca.A(b,c,d);E[e>>2]=c;return 0},a:function(b,c,d,e){var f=A.buffer;a.audioPackets.push({data:f.slice?f.slice(b,b+c): (new Uint8Array(new Uint8Array(f,b,c))).buffer,timestamp:d,discardPadding:e})},c:function(b,c){function d(e){for(var f="",g=new Uint8Array(A.buffer);0!=g[e];e++)f+=String.fromCharCode(g[e]);return f}b&&(a.videoCodec=d(b));c&&(a.audioCodec=d(c));b=a._ogv_demuxer_media_duration();a.duration=0<=b?b:NaN;a.loadedMetadata=!0},b:function(b,c,d,e,f){var g=A.buffer;a.videoPackets.push({data:g.slice?g.slice(b,b+c):(new Uint8Array(new Uint8Array(g,b,c))).buffer,timestamp:d,keyframeTimestamp:e,isKeyframe:!!f})}}; (function(){function b(f){a.asm=f.exports;A=a.asm.g;F();G=a.asm.s;I.unshift(a.asm.h);K--;a.monitorRunDependencies&&a.monitorRunDependencies(K);0==K&&(null!==L&&(clearInterval(L),L=null),M&&(f=M,M=null,f()))}function c(f){b(f.instance)}function d(f){return ba().then(function(g){return WebAssembly.instantiate(g,e)}).then(function(g){return g}).then(f,function(g){x("failed to asynchronously prepare wasm: "+g);z(g)})}var e={a:da};K++;a.monitorRunDependencies&&a.monitorRunDependencies(K);if(a.instantiateWasm)try{return a.instantiateWasm(e, b)}catch(f){return x("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return y||"function"!==typeof WebAssembly.instantiateStreaming||N()||O.startsWith("file://")||"function"!==typeof fetch?d(c):fetch(O,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(c,function(g){x("wasm streaming compile failed: "+g);x("falling back to ArrayBuffer instantiation");return d(c)})})})().catch(l);return{}})(); a.___wasm_call_ctors=function(){return(a.___wasm_call_ctors=a.asm.h).apply(null,arguments)};a._ogv_demuxer_init=function(){return(a._ogv_demuxer_init=a.asm.i).apply(null,arguments)};a._ogv_demuxer_receive_input=function(){return(a._ogv_demuxer_receive_input=a.asm.j).apply(null,arguments)};a._ogv_demuxer_process=function(){return(a._ogv_demuxer_process=a.asm.k).apply(null,arguments)};a._ogv_demuxer_destroy=function(){return(a._ogv_demuxer_destroy=a.asm.l).apply(null,arguments)}; a._ogv_demuxer_media_length=function(){return(a._ogv_demuxer_media_length=a.asm.m).apply(null,arguments)};a._ogv_demuxer_media_duration=function(){return(a._ogv_demuxer_media_duration=a.asm.n).apply(null,arguments)};a._ogv_demuxer_seekable=function(){return(a._ogv_demuxer_seekable=a.asm.o).apply(null,arguments)};a._ogv_demuxer_keypoint_offset=function(){return(a._ogv_demuxer_keypoint_offset=a.asm.p).apply(null,arguments)}; a._ogv_demuxer_seek_to_keypoint=function(){return(a._ogv_demuxer_seek_to_keypoint=a.asm.q).apply(null,arguments)};a._ogv_demuxer_flush=function(){return(a._ogv_demuxer_flush=a.asm.r).apply(null,arguments)};a._malloc=function(){return(a._malloc=a.asm.t).apply(null,arguments)};a._free=function(){return(a._free=a.asm.u).apply(null,arguments)};var U;M=function ea(){U||V();U||(M=ea)}; function V(){function b(){if(!U&&(U=!0,a.calledRun=!0,!B)){R(I);k(a);if(a.onRuntimeInitialized)a.onRuntimeInitialized();if(a.postRun)for("function"==typeof a.postRun&&(a.postRun=[a.postRun]);a.postRun.length;){var c=a.postRun.shift();J.unshift(c)}R(J)}}if(!(0=d||(W&&a._free(W),X=d,W=a._malloc(X));var e=W;(new Uint8Array(A.buffer,e,d)).set(new Uint8Array(b));a._ogv_demuxer_receive_input(e,d)});c()};a.process=function(b){var c=Z(function(){return a._ogv_demuxer_process()});b(!!c)}; a.dequeueVideoPacket=function(b){if(a.videoPackets.length){var c=a.videoPackets.shift().data;b(c)}else b(null)};a.dequeueAudioPacket=function(b){if(a.audioPackets.length){var c=a.audioPackets.shift();b(c.data,c.discardPadding)}else b(null)};a.getKeypointOffset=function(b,c){var d=Z(function(){return a._ogv_demuxer_keypoint_offset(1E3*b)});c(d)}; a.seekToKeypoint=function(b,c){var d=Z(function(){return a._ogv_demuxer_seek_to_keypoint(1E3*b)});d&&(a.audioPackets.splice(0,a.audioPackets.length),a.videoPackets.splice(0,a.videoPackets.length));c(!!d)};a.flush=function(b){Z(function(){a.audioPackets.splice(0,a.audioPackets.length);a.videoPackets.splice(0,a.videoPackets.length);a._ogv_demuxer_flush()});b()};a.close=function(){}; return OGVDemuxerOggW.ready } ); })(); if (typeof exports === 'object' && typeof module === 'object') module.exports = OGVDemuxerOggW; else if (typeof define === 'function' && define['amd']) define([], function() { return OGVDemuxerOggW; }); else if (typeof exports === 'object') exports["OGVDemuxerOggW"] = OGVDemuxerOggW;