1234567891011121314151617181920212223242526 |
- import"./index-122302b9.js";import{O as mi}from"./vue-18ee037d.js";import"./dayjs-4778c158.js";const Li=mi({id:"screen-store",persist:{paths:["customInfo"]},state:()=>({activeInfo:{ID:"",DeviceID:"",DeviceName:"",Name:"",LiveStatus:0},customInfo:{collapsed:!1,rowNum:1,screenNum:1,selectNum:0}}),getters:{getActiveInfo(){return this.activeInfo}},actions:{setActiveInfo(v){this.activeInfo=v},setCustomInfo(v){const a=Object.assign(this.customInfo,v);this.customInfo=a}}});var Ie={},gi={get exports(){return Ie},set exports(v){Ie=v}};(function(v){var a=Object.prototype.hasOwnProperty,o="~";function d(){}Object.create&&(d.prototype=Object.create(null),new d().__proto__||(o=!1));function p(A,m,y){this.fn=A,this.context=m,this.once=y||!1}function T(A,m,y,P,M){if(typeof y!="function")throw new TypeError("The listener must be a function");var L=new p(y,P||A,M),N=o?o+m:m;return A._events[N]?A._events[N].fn?A._events[N]=[A._events[N],L]:A._events[N].push(L):(A._events[N]=L,A._eventsCount++),A}function b(A,m){--A._eventsCount===0?A._events=new d:delete A._events[m]}function F(){this._events=new d,this._eventsCount=0}F.prototype.eventNames=function(){var m=[],y,P;if(this._eventsCount===0)return m;for(P in y=this._events)a.call(y,P)&&m.push(o?P.slice(1):P);return Object.getOwnPropertySymbols?m.concat(Object.getOwnPropertySymbols(y)):m},F.prototype.listeners=function(m){var y=o?o+m:m,P=this._events[y];if(!P)return[];if(P.fn)return[P.fn];for(var M=0,L=P.length,N=new Array(L);M<L;M++)N[M]=P[M].fn;return N},F.prototype.listenerCount=function(m){var y=o?o+m:m,P=this._events[y];return P?P.fn?1:P.length:0},F.prototype.emit=function(m,y,P,M,L,N){var $=o?o+m:m;if(!this._events[$])return!1;var C=this._events[$],ee=arguments.length,re,U;if(C.fn){switch(C.once&&this.removeListener(m,C.fn,void 0,!0),ee){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,y),!0;case 3:return C.fn.call(C.context,y,P),!0;case 4:return C.fn.call(C.context,y,P,M),!0;case 5:return C.fn.call(C.context,y,P,M,L),!0;case 6:return C.fn.call(C.context,y,P,M,L,N),!0}for(U=1,re=new Array(ee-1);U<ee;U++)re[U-1]=arguments[U];C.fn.apply(C.context,re)}else{var cr=C.length,te;for(U=0;U<cr;U++)switch(C[U].once&&this.removeListener(m,C[U].fn,void 0,!0),ee){case 1:C[U].fn.call(C[U].context);break;case 2:C[U].fn.call(C[U].context,y);break;case 3:C[U].fn.call(C[U].context,y,P);break;case 4:C[U].fn.call(C[U].context,y,P,M);break;default:if(!re)for(te=1,re=new Array(ee-1);te<ee;te++)re[te-1]=arguments[te];C[U].fn.apply(C[U].context,re)}}return!0},F.prototype.on=function(m,y,P){return T(this,m,y,P,!1)},F.prototype.once=function(m,y,P){return T(this,m,y,P,!0)},F.prototype.removeListener=function(m,y,P,M){var L=o?o+m:m;if(!this._events[L])return this;if(!y)return b(this,L),this;var N=this._events[L];if(N.fn)N.fn===y&&(!M||N.once)&&(!P||N.context===P)&&b(this,L);else{for(var $=0,C=[],ee=N.length;$<ee;$++)(N[$].fn!==y||M&&!N[$].once||P&&N[$].context!==P)&&C.push(N[$]);C.length?this._events[L]=C.length===1?C[0]:C:b(this,L)}return this},F.prototype.removeAllListeners=function(m){var y;return m?(y=o?o+m:m,this._events[y]&&b(this,y)):(this._events=new d,this._eventsCount=0),this},F.prototype.off=F.prototype.removeListener,F.prototype.addListener=F.prototype.on,F.prefixed=o,F.EventEmitter=F,v.exports=F})(gi);var yi=globalThis&&globalThis.__awaiter||function(v,a,o,d){function p(T){return T instanceof o?T:new o(function(b){b(T)})}return new(o||(o=Promise))(function(T,b){function F(y){try{m(d.next(y))}catch(P){b(P)}}function A(y){try{m(d.throw(y))}catch(P){b(P)}}function m(y){y.done?T(y.value):p(y.value).then(F,A)}m((d=d.apply(v,a||[])).next())})};const Or=Symbol(32),$r=Symbol(16),Rr=Symbol(8);class Ne{constructor(a){this.g=a,this.consumed=0,a&&(this.need=a.next().value)}setG(a){this.g=a,this.demand(a.next().value,!0)}consume(){this.buffer&&this.consumed&&(this.buffer.copyWithin(0,this.consumed),this.buffer=this.buffer.subarray(0,this.buffer.length-this.consumed),this.consumed=0)}demand(a,o){return o&&this.consume(),this.need=a,this.flush()}read(a){return yi(this,void 0,void 0,function*(){return this.lastReadPromise&&(yield this.lastReadPromise),this.lastReadPromise=new Promise((o,d)=>{var p;this.reject=d,this.resolve=b=>{delete this.lastReadPromise,delete this.resolve,delete this.need,o(b)},this.demand(a,!0)||(p=this.pull)===null||p===void 0||p.call(this,a)})})}readU32(){return this.read(Or)}readU16(){return this.read($r)}readU8(){return this.read(Rr)}close(){var a;this.g&&this.g.return(),this.buffer&&this.buffer.subarray(0,0),(a=this.reject)===null||a===void 0||a.call(this,new Error("EOF")),delete this.lastReadPromise}flush(){if(!this.buffer||!this.need)return;let a=null;const o=this.buffer.subarray(this.consumed);let d=0;const p=T=>o.length<(d=T);if(typeof this.need=="number"){if(p(this.need))return;a=o.subarray(0,d)}else if(this.need===Or){if(p(4))return;a=o[0]<<24|o[1]<<16|o[2]<<8|o[3]}else if(this.need===$r){if(p(2))return;a=o[0]<<8|o[1]}else if(this.need===Rr){if(p(1))return;a=o[0]}else if("buffer"in this.need){if("byteOffset"in this.need){if(p(this.need.byteLength-this.need.byteOffset))return;new Uint8Array(this.need.buffer,this.need.byteOffset).set(o.subarray(0,d)),a=this.need}else if(this.g){this.g.throw(new Error("Unsupported type"));return}}else{if(p(this.need.byteLength))return;new Uint8Array(this.need).set(o.subarray(0,d)),a=this.need}return this.consumed+=d,this.g?this.demand(this.g.next(a).value,!0):this.resolve&&this.resolve(a),a}write(a){if(a instanceof Uint8Array?this.malloc(a.length).set(a):"buffer"in a?this.malloc(a.byteLength).set(new Uint8Array(a.buffer,a.byteOffset,a.byteLength)):this.malloc(a.byteLength).set(new Uint8Array(a)),this.g||this.resolve)this.flush();else return new Promise(o=>this.pull=o)}writeU32(a){this.malloc(4).set([a>>24&255,a>>16&255,a>>8&255,a&255]),this.flush()}writeU16(a){this.malloc(2).set([a>>8&255,a&255]),this.flush()}writeU8(a){this.malloc(1)[0]=a,this.flush()}malloc(a){if(this.buffer){const o=this.buffer.length,d=o+a;if(d<=this.buffer.buffer.byteLength-this.buffer.byteOffset)this.buffer=new Uint8Array(this.buffer.buffer,this.buffer.byteOffset,d);else{const p=new Uint8Array(d);p.set(this.buffer),this.buffer=p}return this.buffer.subarray(o,d)}else return this.buffer=new Uint8Array(a),this.buffer}}Ne.U32=Or;Ne.U16=$r;Ne.U8=Rr;var sr=(v=>(v.AUDIO_ENCODER_CONFIG_CHANGED="audio-encoder-config-changed",v.VIDEO_ENCODER_CONFIG_CHANGED="video-encoder-config-changed",v))(sr||{}),ar=(v=>(v[v.PULL=0]="PULL",v[v.PUSH=1]="PUSH",v))(ar||{});class wi extends Ie.EventEmitter{constructor(a,o=0){super(),this.source=a,this.mode=o,Object.getPrototypeOf(this).constructor.name,a&&(o==0?this.startPull(a):a.oput=new Ne(this.demux()))}startPull(a){this.mode=0,this.source=a,this.audioReadable=new ReadableStream({pull:async o=>o.enqueue(await this.pullAudio())}),this.videoReadable=new ReadableStream({pull:async o=>o.enqueue(await this.pullVideo())})}pullAudio(){return new Promise((a,o)=>{this.gotAudio=a,this.gotVideo&&this.pull().catch(o)})}pullVideo(){return new Promise((a,o)=>{this.gotVideo=a,this.gotAudio&&this.pull().catch(o)})}}const _i=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350,-1,-1,-1];class xi extends wi{constructor(){super(...arguments),this.tmp8=new Uint8Array(4),this.dv=new DataView(this.tmp8.buffer)}async pullTag(){const a=new Uint8Array(15);return this.pullTag=async()=>{await this.source.read(a);const o=a[4],d=this.readLength(a.subarray(5,8)),p=this.readTimestamp(a.subarray(8,11)),T=await this.source.read(d);return{type:o,data:T.slice(),timestamp:p}},console.time("flv"),await this.source.read(9).then(o=>{if(this.header=o,o[0]!="F".charCodeAt(0)||o[1]!="L".charCodeAt(0)||o[2]!="V".charCodeAt(0))throw new Error("not flv");console.timeEnd("flv")}),this.pullTag()}readTag(a){const o=a[0],d=this.readLength(a.subarray(1,4)),p=this.readTimestamp(a.subarray(4,8));this.gotTag(o,a.subarray(11,11+d),p)}gotTag(a,o,d){var p,T;switch(a){case 8:return this.audioDecoderConfig||(this.audioDecoderConfig={codec:{10:"aac",7:"pcma",8:"pcmu"}[o[0]>>4]||"unknown",numberOfChannels:1,sampleRate:8e3},this.audioDecoderConfig.codec=="aac"?(this.audioDecoderConfig.numberOfChannels=o[3]>>3&15,this.audioDecoderConfig.sampleRate=_i[(o[2]&7)<<1|o[3]>>7]):this.emit(sr.AUDIO_ENCODER_CONFIG_CHANGED,this.audioDecoderConfig)),this.audioDecoderConfig.codec=="aac"&&o[1]==0?(this.audioDecoderConfig.description=o.subarray(2),this.emit(sr.AUDIO_ENCODER_CONFIG_CHANGED,this.audioDecoderConfig),this.mode==ar.PULL?this.pull():void 0):(p=this.gotAudio)==null?void 0:p.call(this,{type:"key",data:this.audioDecoderConfig.codec=="aac"?o.subarray(2):o.subarray(1),timestamp:d,duration:0});case 9:return this.videoDecoderConfig||(this.videoDecoderConfig={codec:{7:"avc",12:"hevc"}[o[0]&15]||"unknown",description:o.subarray(5)}),o[1]==0?(this.emit(sr.VIDEO_ENCODER_CONFIG_CHANGED,this.videoDecoderConfig),this.mode==ar.PULL?this.pull():void 0):(T=this.gotVideo)==null?void 0:T.call(this,{type:o[0]>>4==1?"key":"delta",data:o.subarray(5),timestamp:d,duration:0});default:if(this.mode==ar.PULL)return this.pull()}}async pull(){const a=await this.pullTag();if(a)return this.gotTag(a.type,a.data,a.timestamp)}readLength(a){return this.tmp8[0]=0,this.tmp8.set(a,1),this.dv.getUint32(0)}readTimestamp(a){this.tmp8.set(a.subarray(0,3),1);let o=this.dv.getUint32(0);return o===16777215&&(this.tmp8[0]=a[3],o=this.dv.getUint32(0)),o}readHead(a){if(console.time("flv"),this.header=a,a[0]!="F".charCodeAt(0)||a[1]!="L".charCodeAt(0)||a[2]!="V".charCodeAt(0))throw new Error("not flv");console.timeEnd("flv")}*demux(){for(this.readHead(yield 13);;){let a=yield 11;const o=a[0],d=this.readLength(a.subarray(1,4)),p=this.readTimestamp(a.subarray(4,8));a=yield d,this.gotTag(o,a.slice(),p),yield 4}}}const vt=Symbol("instance"),kr=Symbol("cacheResult");class Fr{constructor(a,o,d){this.oldState=a,this.newState=o,this.action=d,this.aborted=!1}abort(a){this.aborted=!0,Re.call(a,this.oldState,new Error(`action '${this.action}' aborted`))}toString(){return`${this.action}ing`}}class ur extends Error{constructor(a,o,d){super(o),this.state=a,this.message=o,this.cause=d}}function Ei(v){return typeof v=="object"&&v&&"then"in v}const $e=new Map;function B(v,a,o={}){return(d,p,T)=>{const b=o.action||p;if(!o.context){const A=$e.get(d)||[];$e.has(d)||$e.set(d,A),A.push({from:v,to:a,action:b})}const F=T.value;T.value=function(...A){let m=this;if(o.context&&(m=O.get(typeof o.context=="function"?o.context.call(this,...A):o.context)),m.state===a)return m[kr];m.state instanceof Fr&&m.state.action==o.abortAction&&m.state.abort(m);let y=null;if(Array.isArray(v)?v.length==0?m.state instanceof Fr&&m.state.abort(m):(typeof m.state!="string"||!v.includes(m.state))&&(y=new ur(m._state,`${m.name} ${b} to ${a} failed: current state ${m._state} not in from config`)):v!==m.state&&(y=new ur(m._state,`${m.name} ${b} to ${a} failed: current state ${m._state} not from ${v}`)),y)if(o.fail)o.fail.call(this,y);else{if(o.ignoreError)return y;throw y}const P=m.state,M=new Fr(P,a,b);Re.call(m,M);const L=$=>{var C;return m[kr]=$,M.aborted||(Re.call(m,a),(C=o.success)===null||C===void 0||C.call(this,m[kr])),$},N=$=>{const C=$ instanceof Error?$.message:String($);if(Re.call(m,P,$),o.fail)o.fail.call(this,new ur(m._state,`action '${b}' failed :${C}`,$ instanceof Error?$:new Error(C)));else{if(o.ignoreError)return $;throw $}};try{const $=F.apply(this,A);return Ei($)?$.then(L).catch(N):L($)}catch($){N($)}}}}function Ue(...v){return(a,o,d)=>{const p=d.value,T=o;d.value=function(...b){if(!v.includes(this.state.toString()))throw new ur(this.state,`${this.name} ${T} failed: current state ${this.state} not in ${v}`);return p.apply(this,b)}}}const bi=(()=>typeof window<"u"&&window.__AFSM__?(o,d)=>{window.dispatchEvent(new CustomEvent(o,{detail:d}))}:typeof importScripts<"u"?(o,d)=>{postMessage({type:o,payload:d})}:()=>{})();function Re(v,a){const o=this._state;this._state=v;const d=v.toString();v&&this.emit(d,o),this.emit(O.STATECHANGED,v,o,a),this.updateDevTools({value:v,old:o,err:a instanceof Error?a.message:String(a)})}class O extends Ie{constructor(a,o,d){super(),this.name=a,this.groupName=o,this._state=O.INIT,a||(a=Date.now().toString(36)),d?Object.setPrototypeOf(this,d):d=Object.getPrototypeOf(this),o||(this.groupName=this.constructor.name);const p=d[vt];p?this.name=p.name+"-"+p.count++:d[vt]={name:this.name,count:0},this.updateDevTools({diagram:this.stateDiagram})}get stateDiagram(){const a=Object.getPrototypeOf(this),o=$e.get(a)||[];let d=new Set,p=[],T=[];const b=new Set,F=Object.getPrototypeOf(a);$e.has(F)&&(F.stateDiagram.forEach(m=>d.add(m)),F.allStates.forEach(m=>b.add(m))),o.forEach(({from:m,to:y,action:P})=>{typeof m=="string"?p.push({from:m,to:y,action:P}):m.length?m.forEach(M=>{p.push({from:M,to:y,action:P})}):T.push({to:y,action:P})}),p.forEach(({from:m,to:y,action:P})=>{b.add(m),b.add(y),b.add(P+"ing"),d.add(`${m} --> ${P}ing : ${P}`),d.add(`${P}ing --> ${y} : ${P} 🟢`),d.add(`${P}ing --> ${m} : ${P} 🔴`)}),T.forEach(({to:m,action:y})=>{d.add(`${y}ing --> ${m} : ${y} 🟢`),b.forEach(P=>{P!==m&&d.add(`${P} --> ${y}ing : ${y}`)})});const A=[...d];return Object.defineProperties(a,{stateDiagram:{value:A},allStates:{value:b}}),A}static get(a){let o;return typeof a=="string"?(o=O.instances.get(a),o||O.instances.set(a,o=new O(a,void 0,Object.create(O.prototype)))):(o=O.instances2.get(a),o||O.instances2.set(a,o=new O(a.constructor.name,void 0,Object.create(O.prototype)))),o}static getState(a){var o;return(o=O.get(a))===null||o===void 0?void 0:o.state}updateDevTools(a={}){bi(O.UPDATEAFSM,Object.assign({name:this.name,group:this.groupName},a))}get state(){return this._state}set state(a){Re.call(this,a)}}O.STATECHANGED="stateChanged";O.UPDATEAFSM="updateAFSM";O.INIT="[*]";O.ON="on";O.OFF="off";O.instances=new Map;O.instances2=new WeakMap;var le=(v=>(v.CONNECTED="connected",v.DISCONNECTED="disconnected",v.RECONNECTED="reconnected",v))(le||{}),Pi=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,je=(v,a,o,d)=>{for(var p=d>1?void 0:d?Ti(a,o):a,T=v.length-1,b;T>=0;T--)(b=v[T])&&(p=(d?b(a,o,p):b(p))||p);return d&&p&&Pi(a,o,p),p};function gt(v,a=1,o=1){return v<=1?o:gt(v-1,o,a+o)}function Ci(v){const a=Math.round(v/2)+1;return a>6?13*1e3:gt(a)*1e3}class mt{constructor(){this.total=0,this._buffer=0,this.lastTime=0,this._bps=0}add(a){const o=Date.now();this._buffer+=a,this.lastTime===0?this.lastTime=o:o-this.lastTime>1e3&&(this._bps=this._buffer*1e3/(o-this.lastTime)>>0,this._buffer=0,this.lastTime=o),this.total+=a}get bps(){return Date.now()-this.lastTime>5e3?0:this._bps}}class ye extends O{constructor(a,o={}){super(a||"conn","Connection"),this.url=a,this.options=o,this.up=new mt,this.down=new mt,this.underlyingSink={write:async d=>{var p;return this.down.add(d.length||d.byteLength),(p=this.oput)==null?void 0:p.write(d)}},this.options.reconnectTimeout||(this.options.reconnectTimeout=Ci)}read(a){return Promise.reject("not connected")}async connect(){this.abortCtrl=new AbortController,`${this.url}`,console.time(this.url),this.onConnected(await this._connect())}_close(){}_send(a){}async reconnect(){`${this.url}`,console.time(this.url),this.abortCtrl=new AbortController,this.onConnected(await this._connect())}onConnected(a){if(console.timeEnd(this.url),!!a)return this.oput||(this.oput=new Ne),this.read=this.oput.read.bind(this.oput),a.pipeTo(new WritableStream(this.underlyingSink),this.abortCtrl).catch(o=>{this.abortCtrl.signal.aborted||this.disconnect(o)})}disconnect(a){console.warn(`disconnect: ${this.url}`,a),this.options.reconnectCount&&this.reconnectAfter()}reconnectAfter(a=1e3,o=0){setTimeout(()=>{this.reconnect().catch(d=>{`${this.url}`,o<this.options.reconnectCount&&this.reconnectAfter(this.options.reconnectTimeout(o),o+1)})},a)}close(){var a;(a=this.abortCtrl)==null||a.abort(),this._close()}send(a){this.up.add(a.byteLength-("byteOffset"in a?a.byteOffset:0)),this._send(a)}}je([Ue(le.CONNECTED)],ye.prototype,"read",1);je([B([le.DISCONNECTED,O.INIT],le.CONNECTED)],ye.prototype,"connect",1);je([B(le.DISCONNECTED,le.RECONNECTED)],ye.prototype,"reconnect",1);je([B(le.CONNECTED,le.DISCONNECTED)],ye.prototype,"disconnect",1);je([B([],O.INIT)],ye.prototype,"close",1);class zi extends ye{constructor(a){super(a.label),this.dc=a}async _connect(){return new ReadableStream({start:a=>{this.dc.onclose=()=>{a.close()},this.dc.onerror=o=>{a.error(o)},this.dc.onmessage=o=>{a.enqueue(o.data)}}})}_close(){this.dc.close()}_send(a){this.dc.send(a)}}class Hi extends Ie.EventEmitter{constructor(a,o="recvonly"){super(),this.id=a,this.direction=o}get mediaStream(){return this._mediaStream}set mediaStream(a){this._mediaStream=a,a&&this.emit("change",a)}set audioTrack(a){if(this._audioTrack=a,this._mediaStream){const o=this._mediaStream.getAudioTracks()[0];o&&this._mediaStream.removeTrack(o)}a&&(this._mediaStream?this._mediaStream.addTrack(a):this._mediaStream=new MediaStream([a])),this._mediaStream&&this.emit("change",this._mediaStream)}get audioTrack(){var a;return this._audioTrack||((a=this._mediaStream)==null?void 0:a.getAudioTracks()[0])}set videoTrack(a){if(this._videoTrack=a,this._mediaStream){const o=this._mediaStream.getVideoTracks()[0];o&&this._mediaStream.removeTrack(o)}a&&(this._mediaStream?this._mediaStream.addTrack(a):this._mediaStream=new MediaStream([a])),this._mediaStream&&this.emit("change",this._mediaStream)}get videoTrack(){var a;return this._videoTrack||((a=this._mediaStream)==null?void 0:a.getVideoTracks()[0])}close(){this.emit("close")}}class Bi extends ye{constructor(){super(...arguments),this.webrtc=new RTCPeerConnection(this.options.rtcConfig),this.streams=new Map,this.videoTransceiver=new Array,this.audioTransceiver=new Array}async _connect(){const a=await this.webrtc.createOffer();await this.webrtc.setLocalDescription(a);const d=await(await fetch(this.url,{method:"POST",body:a.sdp,...this.options.requestInit||{}})).text();return await this.webrtc.setRemoteDescription({type:"answer",sdp:d}),this.webrtc.ontrack=({track:p,streams:T,transceiver:b})=>{if(T.length){const F=this.streams.get(T[0].id);F&&F.direction==="recvonly"&&(F.mediaStream=T[0])}},new Promise((p,T)=>{this.webrtc.onconnectionstatechange=b=>{switch(this.webrtc.connectionState){case"disconnected":this.disconnect(b);break;case"connected":p();break;case"failed":T(b)}}})}addStream(a){return this.audioTransceiver.length?(a.audioTransceiver=this.audioTransceiver.pop(),a.audioTransceiver.direction=a.direction):a.audioTransceiver=this.webrtc.addTransceiver(a.audioTrack||"audio",{direction:a.direction}),this.videoTransceiver.length?(a.videoTransceiver=this.videoTransceiver.pop(),a.videoTransceiver.direction=a.direction):a.videoTransceiver=this.webrtc.addTransceiver(a.videoTrack||"video",{direction:a.direction}),this.streams.set(a.id,a),a}deleteStream(a){const o=this.streams.get(a);o&&(delete o.mediaStream,o.audioTransceiver.direction="inactive",o.videoTransceiver.direction="inactive",this.audioTransceiver.push(o.audioTransceiver),this.videoTransceiver.push(o.videoTransceiver),this.streams.delete(a))}_close(){var a;(a=this.webrtc)==null||a.close()}}var Pe=(v=>(v.VideoCodecInfo="videoCodecInfo",v.VideoFrame="videoFrame",v.Error="error",v))(Pe||{}),Te=(v=>(v.AudioCodecInfo="audioCodecInfo",v.AudioFrame="audioFrame",v.Error="error",v))(Te||{}),Di=Object.defineProperty,Ai=Object.getOwnPropertyDescriptor,Me=(v,a,o,d)=>{for(var p=d>1?void 0:d?Ai(a,o):a,T=v.length-1,b;T>=0;T--)(b=v[T])&&(p=(d?b(a,o,p):b(p))||p);return d&&p&&Di(a,o,p),p};class Le extends O{constructor(a){super(),this.module={},this.width=0,this.height=0,this.createModule=a}initialize(){return new Promise(a=>{const o=this.module;o.print=d=>console.log(d),o.printErr=d=>console.log(`[JS] ERROR: ${d}`),o.onAbort=()=>console.log("[JS] FATAL: WASM ABORTED"),o.postRun=d=>{this.decoder=new this.module.VideoDecoder(this),a()},this.createModule(o)})}configure(a){this.config=a,this.decoder.setCodec(this.config.codec,this.config.description?"avcc":"annexb",this.config.description??"")}decode(a){this.decoder.decode(a.data,a.type=="key",a.timestamp)}flush(){}reset(){this.config=void 0,this.decoder&&this.decoder.clear()}close(){this.removeAllListeners(),this.decoder&&(this.decoder.clear(),this.decoder.delete())}videoInfo(a,o){this.width=a,this.height=o;let d={width:a,height:o};this.emit(Pe.VideoCodecInfo,d)}yuvData(a,o){if(!this.module)return;const d=this.width*this.height,p=d>>2;let T=this.module.HEAPU32[a>>2],b=this.module.HEAPU32[(a>>2)+1],F=this.module.HEAPU32[(a>>2)+2],A=this.module.HEAPU8.subarray(T,T+d),m=this.module.HEAPU8.subarray(b,b+p),y=this.module.HEAPU8.subarray(F,F+p);const P=new Uint8Array(d+p+p);P.set(A),P.set(m,d),P.set(y,d+p),this.emit(Pe.VideoFrame,new VideoFrame(P,{codedWidth:this.width,codedHeight:this.height,format:"I420",timestamp:o}))}errorInfo(a){let o={errMsg:a};this.emit(Pe.Error,o)}}Me([B([O.INIT,"closed"],"initialized")],Le.prototype,"initialize",1);Me([B("initialized","configured")],Le.prototype,"configure",1);Me([Ue("configured")],Le.prototype,"decode",1);Me([B([],O.INIT)],Le.prototype,"reset",1);Me([B([],"closed")],Le.prototype,"close",1);var Si=Object.defineProperty,ki=Object.getOwnPropertyDescriptor,xe=(v,a,o,d)=>{for(var p=d>1?void 0:d?ki(a,o):a,T=v.length-1,b;T>=0;T--)(b=v[T])&&(p=(d?b(a,o,p):b(p))||p);return d&&p&&Si(a,o,p),p};class ze extends O{async initialize(){this.decoder=new VideoDecoder({output:a=>{this.emit(Pe.VideoFrame,a)},error:a=>{this.emit(Pe.Error,a),this.close()}})}configure(a){this.config=a,this.decoder.configure({...a,codec:a.codec=="hevc"?"hvc1.1.6.L0.12.34.56.78.9A.BC":"avc1.420028"})}decode(a){this.decoder.state==="configured"&&this.decoder.decode(new EncodedVideoChunk(a))}flush(){this.decoder.flush()}reset(){this.decoder.reset()}close(){this.decoder.close()}}xe([B([O.INIT,"closed"],"initialized")],ze.prototype,"initialize",1);xe([B("initialized","configured")],ze.prototype,"configure",1);xe([Ue("configured")],ze.prototype,"decode",1);xe([B([],O.INIT)],ze.prototype,"reset",1);xe([B([],"closed",{ignoreError:!0})],ze.prototype,"close",1);var Fi=(()=>{var v=import.meta.url;return function(o){o=o||{};var o=typeof o<"u"?o:{},d,p;o.ready=new Promise(function(e,r){d=e,p=r});var T=Object.assign({},o),b="./this.program",F=typeof window=="object",A=typeof importScripts=="function",m=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",y="";function P(e){return o.locateFile?o.locateFile(e,y):y+e}var M,L,N,$,C,ee;m?(A?y=require("path").dirname(y)+"/":y=__dirname+"/",ee=()=>{C||($=require("fs"),C=require("path"))},M=function(r,t){return ee(),r=C.normalize(r),$.readFileSync(r,t?void 0:"utf8")},N=e=>{var r=M(e,!0);return r.buffer||(r=new Uint8Array(r)),r},L=(e,r,t)=>{ee(),e=C.normalize(e),$.readFile(e,function(n,s){n?t(n):r(s.buffer)})},process.argv.length>1&&(b=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",function(e){if(!(e instanceof vi))throw e}),process.on("unhandledRejection",function(e){throw e}),o.inspect=function(){return"[Emscripten Module object]"}):(F||A)&&(A?y=self.location.href:typeof document<"u"&&document.currentScript&&(y=document.currentScript.src),v&&(y=v),y.indexOf("blob:")!==0?y=y.substr(0,y.replace(/[?#].*/,"").lastIndexOf("/")+1):y="",M=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.send(null),r.responseText},A&&(N=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),L=(e,r,t)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{if(n.status==200||n.status==0&&n.response){r(n.response);return}t()},n.onerror=t,n.send(null)});var re=o.print||console.log.bind(console),U=o.printErr||console.warn.bind(console);Object.assign(o,T),T=null,o.arguments&&o.arguments,o.thisProgram&&(b=o.thisProgram),o.quit&&o.quit;var cr=4,te;o.wasmBinary&&(te=o.wasmBinary),o.noExitRuntime,typeof WebAssembly!="object"&&pe("no native wasm support detected");var Ir,Nr=!1;function Ur(e,r){e||pe(r)}var jr=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function we(e,r,t){for(var n=r+t,s=r;e[s]&&!(s>=n);)++s;if(s-r>16&&e.buffer&&jr)return jr.decode(e.subarray(r,s));for(var u="";r<s;){var f=e[r++];if(!(f&128)){u+=String.fromCharCode(f);continue}var c=e[r++]&63;if((f&224)==192){u+=String.fromCharCode((f&31)<<6|c);continue}var l=e[r++]&63;if((f&240)==224?f=(f&15)<<12|c<<6|l:f=(f&7)<<18|c<<12|l<<6|e[r++]&63,f<65536)u+=String.fromCharCode(f);else{var h=f-65536;u+=String.fromCharCode(55296|h>>10,56320|h&1023)}}return u}function Mr(e,r){return e?we(G,e,r):""}function fr(e,r,t,n){if(!(n>0))return 0;for(var s=t,u=t+n-1,f=0;f<e.length;++f){var c=e.charCodeAt(f);if(c>=55296&&c<=57343){var l=e.charCodeAt(++f);c=65536+((c&1023)<<10)|l&1023}if(c<=127){if(t>=u)break;r[t++]=c}else if(c<=2047){if(t+1>=u)break;r[t++]=192|c>>6,r[t++]=128|c&63}else if(c<=65535){if(t+2>=u)break;r[t++]=224|c>>12,r[t++]=128|c>>6&63,r[t++]=128|c&63}else{if(t+3>=u)break;r[t++]=240|c>>18,r[t++]=128|c>>12&63,r[t++]=128|c>>6&63,r[t++]=128|c&63}}return r[t]=0,t-s}function yt(e,r,t){return fr(e,G,r,t)}function lr(e){for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n>=55296&&n<=57343&&(n=65536+((n&1023)<<10)|e.charCodeAt(++t)&1023),n<=127?++r:n<=2047?r+=2:n<=65535?r+=3:r+=4}return r}var Lr=typeof TextDecoder<"u"?new TextDecoder("utf-16le"):void 0;function wt(e,r){for(var t=e,n=t>>1,s=n+r/2;!(n>=s)&&qe[n];)++n;if(t=n<<1,t-e>32&&Lr)return Lr.decode(G.subarray(e,t));for(var u="",f=0;!(f>=r/2);++f){var c=de[e+f*2>>1];if(c==0)break;u+=String.fromCharCode(c)}return u}function _t(e,r,t){if(t===void 0&&(t=2147483647),t<2)return 0;t-=2;for(var n=r,s=t<e.length*2?t/2:e.length,u=0;u<s;++u){var f=e.charCodeAt(u);de[r>>1]=f,r+=2}return de[r>>1]=0,r-n}function Et(e){return e.length*2}function bt(e,r){for(var t=0,n="";!(t>=r/4);){var s=k[e+t*4>>2];if(s==0)break;if(++t,s>=65536){var u=s-65536;n+=String.fromCharCode(55296|u>>10,56320|u&1023)}else n+=String.fromCharCode(s)}return n}function Pt(e,r,t){if(t===void 0&&(t=2147483647),t<4)return 0;for(var n=r,s=n+t-4,u=0;u<e.length;++u){var f=e.charCodeAt(u);if(f>=55296&&f<=57343){var c=e.charCodeAt(++u);f=65536+((f&1023)<<10)|c&1023}if(k[r>>2]=f,r+=4,r+4>s)break}return k[r>>2]=0,r-n}function Tt(e){for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n>=55296&&n<=57343&&++t,r+=4}return r}function Ct(e,r,t){for(var n=0;n<e.length;++n)Y[r++>>0]=e.charCodeAt(n);t||(Y[r>>0]=0)}var dr,Y,G,de,qe,k,x,xr,zr;function Dt(e){dr=e,o.HEAP8=Y=new Int8Array(e),o.HEAP16=de=new Int16Array(e),o.HEAP32=k=new Int32Array(e),o.HEAPU8=G=new Uint8Array(e),o.HEAPU16=qe=new Uint16Array(e),o.HEAPU32=x=new Uint32Array(e),o.HEAPF32=xr=new Float32Array(e),o.HEAPF64=zr=new Float64Array(e)}o.INITIAL_MEMORY;var Hr,Br=[],Wr=[],Vr=[];function At(){if(o.preRun)for(typeof o.preRun=="function"&&(o.preRun=[o.preRun]);o.preRun.length;)Ft(o.preRun.shift());pr(Br)}function St(){!o.noFSInit&&!i.init.initialized&&i.init(),i.ignorePermissions=!1,pr(Wr)}function kt(){if(o.postRun)for(typeof o.postRun=="function"&&(o.postRun=[o.postRun]);o.postRun.length;)$t(o.postRun.shift());pr(Vr)}function Ft(e){Br.unshift(e)}function Ot(e){Wr.unshift(e)}function $t(e){Vr.unshift(e)}var he=0,Ce=null;function Ni(e){return e}function hr(e){he++,o.monitorRunDependencies&&o.monitorRunDependencies(he)}function Ge(e){if(he--,o.monitorRunDependencies&&o.monitorRunDependencies(he),he==0&&Ce){var r=Ce;Ce=null,r()}}function pe(e){o.onAbort&&o.onAbort(e),e="Aborted("+e+")",U(e),Nr=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw p(r),r}var Rt="data:application/octet-stream;base64,";function qr(e){return e.startsWith(Rt)}function Gr(e){return e.startsWith("file://")}var K;o.locateFile?(K="audiodec.wasm",qr(K)||(K=P(K))):K=new URL("/plugin/media/assets/audiodec-28b192dd.wasm",self.location).toString();function Xr(e){try{if(e==K&&te)return new Uint8Array(te);if(N)return N(e);throw"both async and sync fetching of the wasm failed"}catch(r){pe(r)}}function It(){if(!te&&(F||A)){if(typeof fetch=="function"&&!Gr(K))return fetch(K,{credentials:"same-origin"}).then(function(e){if(!e.ok)throw"failed to load wasm binary file at '"+K+"'";return e.arrayBuffer()}).catch(function(){return Xr(K)});if(L)return new Promise(function(e,r){L(K,function(t){e(new Uint8Array(t))},r)})}return Promise.resolve().then(function(){return Xr(K)})}function Nt(){var e={a:pi};function r(f,c){var l=f.exports;o.asm=l,Ir=o.asm.G,Dt(Ir.buffer),Hr=o.asm.J,Ot(o.asm.H),Ge()}hr();function t(f){r(f.instance)}function n(f){return It().then(function(c){return WebAssembly.instantiate(c,e)}).then(function(c){return c}).then(f,function(c){U("failed to asynchronously prepare wasm: "+c),pe(c)})}function s(){return!te&&typeof WebAssembly.instantiateStreaming=="function"&&!qr(K)&&!Gr(K)&&!m&&typeof fetch=="function"?fetch(K,{credentials:"same-origin"}).then(function(f){var c=WebAssembly.instantiateStreaming(f,e);return c.then(t,function(l){return U("wasm streaming compile failed: "+l),U("falling back to ArrayBuffer instantiation"),n(t)})}):n(t)}if(o.instantiateWasm)try{var u=o.instantiateWasm(e,r);return u}catch(f){return U("Module.instantiateWasm callback failed with error: "+f),!1}return s().catch(p),{}}var W,ie;function pr(e){for(;e.length>0;){var r=e.shift();if(typeof r=="function"){r(o);continue}var t=r.func;typeof t=="number"?r.arg===void 0?Ke(t)():Ke(t)(r.arg):t(r.arg===void 0?null:r.arg)}}var Xe=[];function Ke(e){var r=Xe[e];return r||(e>=Xe.length&&(Xe.length=e+1),Xe[e]=r=Hr.get(e)),r}function Ut(e){return ir(e+24)+24}function jt(e){this.excPtr=e,this.ptr=e-24,this.set_type=function(r){x[this.ptr+4>>2]=r},this.get_type=function(){return x[this.ptr+4>>2]},this.set_destructor=function(r){x[this.ptr+8>>2]=r},this.get_destructor=function(){return x[this.ptr+8>>2]},this.set_refcount=function(r){k[this.ptr>>2]=r},this.set_caught=function(r){r=r?1:0,Y[this.ptr+12>>0]=r},this.get_caught=function(){return Y[this.ptr+12>>0]!=0},this.set_rethrown=function(r){r=r?1:0,Y[this.ptr+13>>0]=r},this.get_rethrown=function(){return Y[this.ptr+13>>0]!=0},this.init=function(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t),this.set_refcount(0),this.set_caught(!1),this.set_rethrown(!1)},this.add_ref=function(){var r=k[this.ptr>>2];k[this.ptr>>2]=r+1},this.release_ref=function(){var r=k[this.ptr>>2];return k[this.ptr>>2]=r-1,r===1},this.set_adjusted_ptr=function(r){x[this.ptr+16>>2]=r},this.get_adjusted_ptr=function(){return x[this.ptr+16>>2]},this.get_exception_ptr=function(){var r=pt(this.get_type());if(r)return x[this.excPtr>>2];var t=this.get_adjusted_ptr();return t!==0?t:this.excPtr}}function Mt(e,r,t){var n=new jt(e);throw n.init(r,t),e}function Lt(e){return k[lt()>>2]=e,e}var R={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var r=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return r.exec(e).slice(1)},normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var s=e[n];s==="."?e.splice(n,1):s===".."?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=R.isAbs(e),t=e.substr(-1)==="/";return e=R.normalizeArray(e.split("/").filter(n=>!!n),!r).join("/"),!e&&!r&&(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=R.splitPath(e),t=r[0],n=r[1];return!t&&!n?".":(n&&(n=n.substr(0,n.length-1)),t+n)},basename:e=>{if(e==="/")return"/";e=R.normalize(e),e=e.replace(/\/$/,"");var r=e.lastIndexOf("/");return r===-1?e:e.substr(r+1)},join:function(){var e=Array.prototype.slice.call(arguments,0);return R.normalize(e.join("/"))},join2:(e,r)=>R.normalize(e+"/"+r)};function xt(){if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function"){var e=new Uint8Array(1);return function(){return crypto.getRandomValues(e),e[0]}}else if(m)try{var r=require("crypto");return function(){return r.randomBytes(1)[0]}}catch{}return function(){pe("randomDevice")}}var oe={resolve:function(){for(var e="",r=!1,t=arguments.length-1;t>=-1&&!r;t--){var n=t>=0?arguments[t]:i.cwd();if(typeof n!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!n)return"";e=n+"/"+e,r=R.isAbs(n)}return e=R.normalizeArray(e.split("/").filter(s=>!!s),!r).join("/"),(r?"/":"")+e||"."},relative:(e,r)=>{e=oe.resolve(e).substr(1),r=oe.resolve(r).substr(1);function t(h){for(var w=0;w<h.length&&h[w]==="";w++);for(var _=h.length-1;_>=0&&h[_]==="";_--);return w>_?[]:h.slice(w,_-w+1)}for(var n=t(e.split("/")),s=t(r.split("/")),u=Math.min(n.length,s.length),f=u,c=0;c<u;c++)if(n[c]!==s[c]){f=c;break}for(var l=[],c=f;c<n.length;c++)l.push("..");return l=l.concat(s.slice(f)),l.join("/")}},ve={ttys:[],init:function(){},shutdown:function(){},register:function(e,r){ve.ttys[e]={input:[],output:[],ops:r},i.registerDevice(e,ve.stream_ops)},stream_ops:{open:function(e){var r=ve.ttys[e.node.rdev];if(!r)throw new i.ErrnoError(43);e.tty=r,e.seekable=!1},close:function(e){e.tty.ops.flush(e.tty)},flush:function(e){e.tty.ops.flush(e.tty)},read:function(e,r,t,n,s){if(!e.tty||!e.tty.ops.get_char)throw new i.ErrnoError(60);for(var u=0,f=0;f<n;f++){var c;try{c=e.tty.ops.get_char(e.tty)}catch{throw new i.ErrnoError(29)}if(c===void 0&&u===0)throw new i.ErrnoError(6);if(c==null)break;u++,r[t+f]=c}return u&&(e.node.timestamp=Date.now()),u},write:function(e,r,t,n,s){if(!e.tty||!e.tty.ops.put_char)throw new i.ErrnoError(60);try{for(var u=0;u<n;u++)e.tty.ops.put_char(e.tty,r[t+u])}catch{throw new i.ErrnoError(29)}return n&&(e.node.timestamp=Date.now()),u}},default_tty_ops:{get_char:function(e){if(!e.input.length){var r=null;if(m){var t=256,n=Buffer.alloc(t),s=0;try{s=$.readSync(process.stdin.fd,n,0,t,-1)}catch(u){if(u.toString().includes("EOF"))s=0;else throw u}s>0?r=n.slice(0,s).toString("utf-8"):r=null}else typeof window<"u"&&typeof window.prompt=="function"?(r=window.prompt("Input: "),r!==null&&(r+=`
- `)):typeof readline=="function"&&(r=readline(),r!==null&&(r+=`
- `));if(!r)return null;e.input=Ar(r,!0)}return e.input.shift()},put_char:function(e,r){r===null||r===10?(re(we(e.output,0)),e.output=[]):r!=0&&e.output.push(r)},flush:function(e){e.output&&e.output.length>0&&(re(we(e.output,0)),e.output=[])}},default_tty1_ops:{put_char:function(e,r){r===null||r===10?(U(we(e.output,0)),e.output=[]):r!=0&&e.output.push(r)},flush:function(e){e.output&&e.output.length>0&&(U(we(e.output,0)),e.output=[])}}};function zt(e,r){G.fill(0,e,e+r)}function Ht(e,r){return Math.ceil(e/r)*r}function Kr(e){e=Ht(e,65536);var r=ht(65536,e);return r?(zt(r,e),r):0}var S={ops_table:null,mount:function(e){return S.createNode(null,"/",16895,0)},createNode:function(e,r,t,n){if(i.isBlkdev(t)||i.isFIFO(t))throw new i.ErrnoError(63);S.ops_table||(S.ops_table={dir:{node:{getattr:S.node_ops.getattr,setattr:S.node_ops.setattr,lookup:S.node_ops.lookup,mknod:S.node_ops.mknod,rename:S.node_ops.rename,unlink:S.node_ops.unlink,rmdir:S.node_ops.rmdir,readdir:S.node_ops.readdir,symlink:S.node_ops.symlink},stream:{llseek:S.stream_ops.llseek}},file:{node:{getattr:S.node_ops.getattr,setattr:S.node_ops.setattr},stream:{llseek:S.stream_ops.llseek,read:S.stream_ops.read,write:S.stream_ops.write,allocate:S.stream_ops.allocate,mmap:S.stream_ops.mmap,msync:S.stream_ops.msync}},link:{node:{getattr:S.node_ops.getattr,setattr:S.node_ops.setattr,readlink:S.node_ops.readlink},stream:{}},chrdev:{node:{getattr:S.node_ops.getattr,setattr:S.node_ops.setattr},stream:i.chrdev_stream_ops}});var s=i.createNode(e,r,t,n);return i.isDir(s.mode)?(s.node_ops=S.ops_table.dir.node,s.stream_ops=S.ops_table.dir.stream,s.contents={}):i.isFile(s.mode)?(s.node_ops=S.ops_table.file.node,s.stream_ops=S.ops_table.file.stream,s.usedBytes=0,s.contents=null):i.isLink(s.mode)?(s.node_ops=S.ops_table.link.node,s.stream_ops=S.ops_table.link.stream):i.isChrdev(s.mode)&&(s.node_ops=S.ops_table.chrdev.node,s.stream_ops=S.ops_table.chrdev.stream),s.timestamp=Date.now(),e&&(e.contents[r]=s,e.timestamp=s.timestamp),s},getFileDataAsTypedArray:function(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage:function(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){var n=1024*1024;r=Math.max(r,t*(t<n?2:1.125)>>>0),t!=0&&(r=Math.max(r,256));var s=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(s.subarray(0,e.usedBytes),0)}},resizeFileStorage:function(e,r){if(e.usedBytes!=r)if(r==0)e.contents=null,e.usedBytes=0;else{var t=e.contents;e.contents=new Uint8Array(r),t&&e.contents.set(t.subarray(0,Math.min(r,e.usedBytes))),e.usedBytes=r}},node_ops:{getattr:function(e){var r={};return r.dev=i.isChrdev(e.mode)?e.id:1,r.ino=e.id,r.mode=e.mode,r.nlink=1,r.uid=0,r.gid=0,r.rdev=e.rdev,i.isDir(e.mode)?r.size=4096:i.isFile(e.mode)?r.size=e.usedBytes:i.isLink(e.mode)?r.size=e.link.length:r.size=0,r.atime=new Date(e.timestamp),r.mtime=new Date(e.timestamp),r.ctime=new Date(e.timestamp),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr:function(e,r){r.mode!==void 0&&(e.mode=r.mode),r.timestamp!==void 0&&(e.timestamp=r.timestamp),r.size!==void 0&&S.resizeFileStorage(e,r.size)},lookup:function(e,r){throw i.genericErrors[44]},mknod:function(e,r,t,n){return S.createNode(e,r,t,n)},rename:function(e,r,t){if(i.isDir(e.mode)){var n;try{n=i.lookupNode(r,t)}catch{}if(n)for(var s in n.contents)throw new i.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=t,r.contents[t]=e,r.timestamp=e.parent.timestamp,e.parent=r},unlink:function(e,r){delete e.contents[r],e.timestamp=Date.now()},rmdir:function(e,r){var t=i.lookupNode(e,r);for(var n in t.contents)throw new i.ErrnoError(55);delete e.contents[r],e.timestamp=Date.now()},readdir:function(e){var r=[".",".."];for(var t in e.contents)e.contents.hasOwnProperty(t)&&r.push(t);return r},symlink:function(e,r,t){var n=S.createNode(e,r,41471,0);return n.link=t,n},readlink:function(e){if(!i.isLink(e.mode))throw new i.ErrnoError(28);return e.link}},stream_ops:{read:function(e,r,t,n,s){var u=e.node.contents;if(s>=e.node.usedBytes)return 0;var f=Math.min(e.node.usedBytes-s,n);if(f>8&&u.subarray)r.set(u.subarray(s,s+f),t);else for(var c=0;c<f;c++)r[t+c]=u[s+c];return f},write:function(e,r,t,n,s,u){if(!n)return 0;var f=e.node;if(f.timestamp=Date.now(),r.subarray&&(!f.contents||f.contents.subarray)){if(u)return f.contents=r.subarray(t,t+n),f.usedBytes=n,n;if(f.usedBytes===0&&s===0)return f.contents=r.slice(t,t+n),f.usedBytes=n,n;if(s+n<=f.usedBytes)return f.contents.set(r.subarray(t,t+n),s),n}if(S.expandFileStorage(f,s+n),f.contents.subarray&&r.subarray)f.contents.set(r.subarray(t,t+n),s);else for(var c=0;c<n;c++)f.contents[s+c]=r[t+c];return f.usedBytes=Math.max(f.usedBytes,s+n),n},llseek:function(e,r,t){var n=r;if(t===1?n+=e.position:t===2&&i.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new i.ErrnoError(28);return n},allocate:function(e,r,t){S.expandFileStorage(e.node,r+t),e.node.usedBytes=Math.max(e.node.usedBytes,r+t)},mmap:function(e,r,t,n,s){if(!i.isFile(e.node.mode))throw new i.ErrnoError(43);var u,f,c=e.node.contents;if(!(s&2)&&c.buffer===dr)f=!1,u=c.byteOffset;else{if((t>0||t+r<c.length)&&(c.subarray?c=c.subarray(t,t+r):c=Array.prototype.slice.call(c,t,t+r)),f=!0,u=Kr(r),!u)throw new i.ErrnoError(48);Y.set(c,u)}return{ptr:u,allocated:f}},msync:function(e,r,t,n,s){if(!i.isFile(e.node.mode))throw new i.ErrnoError(43);return s&2||S.stream_ops.write(e,r,0,n,t,!1),0}}};function Bt(e,r,t,n){var s=n?"":"al "+e;L(e,function(u){Ur(u,'Loading data file "'+e+'" failed (no arrayBuffer).'),r(new Uint8Array(u)),s&&Ge()},function(u){if(t)t();else throw'Loading data file "'+e+'" failed.'}),s&&hr()}var i={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,lookupPath:(e,r={})=>{if(e=oe.resolve(i.cwd(),e),!e)return{path:"",node:null};var t={follow_mount:!0,recurse_count:0};if(r=Object.assign(t,r),r.recurse_count>8)throw new i.ErrnoError(32);for(var n=R.normalizeArray(e.split("/").filter(_=>!!_),!1),s=i.root,u="/",f=0;f<n.length;f++){var c=f===n.length-1;if(c&&r.parent)break;if(s=i.lookupNode(s,n[f]),u=R.join2(u,n[f]),i.isMountpoint(s)&&(!c||c&&r.follow_mount)&&(s=s.mounted.root),!c||r.follow)for(var l=0;i.isLink(s.mode);){var h=i.readlink(u);u=oe.resolve(R.dirname(u),h);var w=i.lookupPath(u,{recurse_count:r.recurse_count+1});if(s=w.node,l++>40)throw new i.ErrnoError(32)}}return{path:u,node:s}},getPath:e=>{for(var r;;){if(i.isRoot(e)){var t=e.mount.mountpoint;return r?t[t.length-1]!=="/"?t+"/"+r:t+r:t}r=r?e.name+"/"+r:e.name,e=e.parent}},hashName:(e,r)=>{for(var t=0,n=0;n<r.length;n++)t=(t<<5)-t+r.charCodeAt(n)|0;return(e+t>>>0)%i.nameTable.length},hashAddNode:e=>{var r=i.hashName(e.parent.id,e.name);e.name_next=i.nameTable[r],i.nameTable[r]=e},hashRemoveNode:e=>{var r=i.hashName(e.parent.id,e.name);if(i.nameTable[r]===e)i.nameTable[r]=e.name_next;else for(var t=i.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode:(e,r)=>{var t=i.mayLookup(e);if(t)throw new i.ErrnoError(t,e);for(var n=i.hashName(e.id,r),s=i.nameTable[n];s;s=s.name_next){var u=s.name;if(s.parent.id===e.id&&u===r)return s}return i.lookup(e,r)},createNode:(e,r,t,n)=>{var s=new i.FSNode(e,r,t,n);return i.hashAddNode(s),s},destroyNode:e=>{i.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>(e&61440)===32768,isDir:e=>(e&61440)===16384,isLink:e=>(e&61440)===40960,isChrdev:e=>(e&61440)===8192,isBlkdev:e=>(e&61440)===24576,isFIFO:e=>(e&61440)===4096,isSocket:e=>(e&49152)===49152,flagModes:{r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},modeStringToFlags:e=>{var r=i.flagModes[e];if(typeof r>"u")throw new Error("Unknown file open mode: "+e);return r},flagsToPermissionString:e=>{var r=["r","w","rw"][e&3];return e&512&&(r+="w"),r},nodePermissions:(e,r)=>i.ignorePermissions?0:r.includes("r")&&!(e.mode&292)||r.includes("w")&&!(e.mode&146)||r.includes("x")&&!(e.mode&73)?2:0,mayLookup:e=>{var r=i.nodePermissions(e,"x");return r||(e.node_ops.lookup?0:2)},mayCreate:(e,r)=>{try{var t=i.lookupNode(e,r);return 20}catch{}return i.nodePermissions(e,"wx")},mayDelete:(e,r,t)=>{var n;try{n=i.lookupNode(e,r)}catch(u){return u.errno}var s=i.nodePermissions(e,"wx");if(s)return s;if(t){if(!i.isDir(n.mode))return 54;if(i.isRoot(n)||i.getPath(n)===i.cwd())return 10}else if(i.isDir(n.mode))return 31;return 0},mayOpen:(e,r)=>e?i.isLink(e.mode)?32:i.isDir(e.mode)&&(i.flagsToPermissionString(r)!=="r"||r&512)?31:i.nodePermissions(e,i.flagsToPermissionString(r)):44,MAX_OPEN_FDS:4096,nextfd:(e=0,r=i.MAX_OPEN_FDS)=>{for(var t=e;t<=r;t++)if(!i.streams[t])return t;throw new i.ErrnoError(33)},getStream:e=>i.streams[e],createStream:(e,r,t)=>{i.FSStream||(i.FSStream=function(){this.shared={}},i.FSStream.prototype={},Object.defineProperties(i.FSStream.prototype,{object:{get:function(){return this.node},set:function(s){this.node=s}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}},flags:{get:function(){return this.shared.flags},set:function(s){this.shared.flags=s}},position:{get:function(){return this.shared.position},set:function(s){this.shared.position=s}}})),e=Object.assign(new i.FSStream,e);var n=i.nextfd(r,t);return e.fd=n,i.streams[n]=e,e},closeStream:e=>{i.streams[e]=null},chrdev_stream_ops:{open:e=>{var r=i.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open&&e.stream_ops.open(e)},llseek:()=>{throw new i.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,r)=>e<<8|r,registerDevice:(e,r)=>{i.devices[e]={stream_ops:r}},getDevice:e=>i.devices[e],getMounts:e=>{for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push.apply(t,n.mounts)}return r},syncfs:(e,r)=>{typeof e=="function"&&(r=e,e=!1),i.syncFSRequests++,i.syncFSRequests>1&&U("warning: "+i.syncFSRequests+" FS.syncfs operations in flight at once, probably just doing extra work");var t=i.getMounts(i.root.mount),n=0;function s(f){return i.syncFSRequests--,r(f)}function u(f){if(f)return u.errored?void 0:(u.errored=!0,s(f));++n>=t.length&&s(null)}t.forEach(f=>{if(!f.type.syncfs)return u(null);f.type.syncfs(f,e,u)})},mount:(e,r,t)=>{var n=t==="/",s=!t,u;if(n&&i.root)throw new i.ErrnoError(10);if(!n&&!s){var f=i.lookupPath(t,{follow_mount:!1});if(t=f.path,u=f.node,i.isMountpoint(u))throw new i.ErrnoError(10);if(!i.isDir(u.mode))throw new i.ErrnoError(54)}var c={type:e,opts:r,mountpoint:t,mounts:[]},l=e.mount(c);return l.mount=c,c.root=l,n?i.root=l:u&&(u.mounted=c,u.mount&&u.mount.mounts.push(c)),l},unmount:e=>{var r=i.lookupPath(e,{follow_mount:!1});if(!i.isMountpoint(r.node))throw new i.ErrnoError(28);var t=r.node,n=t.mounted,s=i.getMounts(n);Object.keys(i.nameTable).forEach(f=>{for(var c=i.nameTable[f];c;){var l=c.name_next;s.includes(c.mount)&&i.destroyNode(c),c=l}}),t.mounted=null;var u=t.mount.mounts.indexOf(n);t.mount.mounts.splice(u,1)},lookup:(e,r)=>e.node_ops.lookup(e,r),mknod:(e,r,t)=>{var n=i.lookupPath(e,{parent:!0}),s=n.node,u=R.basename(e);if(!u||u==="."||u==="..")throw new i.ErrnoError(28);var f=i.mayCreate(s,u);if(f)throw new i.ErrnoError(f);if(!s.node_ops.mknod)throw new i.ErrnoError(63);return s.node_ops.mknod(s,u,r,t)},create:(e,r)=>(r=r!==void 0?r:438,r&=4095,r|=32768,i.mknod(e,r,0)),mkdir:(e,r)=>(r=r!==void 0?r:511,r&=1023,r|=16384,i.mknod(e,r,0)),mkdirTree:(e,r)=>{for(var t=e.split("/"),n="",s=0;s<t.length;++s)if(t[s]){n+="/"+t[s];try{i.mkdir(n,r)}catch(u){if(u.errno!=20)throw u}}},mkdev:(e,r,t)=>(typeof t>"u"&&(t=r,r=438),r|=8192,i.mknod(e,r,t)),symlink:(e,r)=>{if(!oe.resolve(e))throw new i.ErrnoError(44);var t=i.lookupPath(r,{parent:!0}),n=t.node;if(!n)throw new i.ErrnoError(44);var s=R.basename(r),u=i.mayCreate(n,s);if(u)throw new i.ErrnoError(u);if(!n.node_ops.symlink)throw new i.ErrnoError(63);return n.node_ops.symlink(n,s,e)},rename:(e,r)=>{var t=R.dirname(e),n=R.dirname(r),s=R.basename(e),u=R.basename(r),f,c,l;if(f=i.lookupPath(e,{parent:!0}),c=f.node,f=i.lookupPath(r,{parent:!0}),l=f.node,!c||!l)throw new i.ErrnoError(44);if(c.mount!==l.mount)throw new i.ErrnoError(75);var h=i.lookupNode(c,s),w=oe.relative(e,n);if(w.charAt(0)!==".")throw new i.ErrnoError(28);if(w=oe.relative(r,t),w.charAt(0)!==".")throw new i.ErrnoError(55);var _;try{_=i.lookupNode(l,u)}catch{}if(h!==_){var g=i.isDir(h.mode),E=i.mayDelete(c,s,g);if(E)throw new i.ErrnoError(E);if(E=_?i.mayDelete(l,u,g):i.mayCreate(l,u),E)throw new i.ErrnoError(E);if(!c.node_ops.rename)throw new i.ErrnoError(63);if(i.isMountpoint(h)||_&&i.isMountpoint(_))throw new i.ErrnoError(10);if(l!==c&&(E=i.nodePermissions(c,"w"),E))throw new i.ErrnoError(E);i.hashRemoveNode(h);try{c.node_ops.rename(h,l,u)}catch(D){throw D}finally{i.hashAddNode(h)}}},rmdir:e=>{var r=i.lookupPath(e,{parent:!0}),t=r.node,n=R.basename(e),s=i.lookupNode(t,n),u=i.mayDelete(t,n,!0);if(u)throw new i.ErrnoError(u);if(!t.node_ops.rmdir)throw new i.ErrnoError(63);if(i.isMountpoint(s))throw new i.ErrnoError(10);t.node_ops.rmdir(t,n),i.destroyNode(s)},readdir:e=>{var r=i.lookupPath(e,{follow:!0}),t=r.node;if(!t.node_ops.readdir)throw new i.ErrnoError(54);return t.node_ops.readdir(t)},unlink:e=>{var r=i.lookupPath(e,{parent:!0}),t=r.node;if(!t)throw new i.ErrnoError(44);var n=R.basename(e),s=i.lookupNode(t,n),u=i.mayDelete(t,n,!1);if(u)throw new i.ErrnoError(u);if(!t.node_ops.unlink)throw new i.ErrnoError(63);if(i.isMountpoint(s))throw new i.ErrnoError(10);t.node_ops.unlink(t,n),i.destroyNode(s)},readlink:e=>{var r=i.lookupPath(e),t=r.node;if(!t)throw new i.ErrnoError(44);if(!t.node_ops.readlink)throw new i.ErrnoError(28);return oe.resolve(i.getPath(t.parent),t.node_ops.readlink(t))},stat:(e,r)=>{var t=i.lookupPath(e,{follow:!r}),n=t.node;if(!n)throw new i.ErrnoError(44);if(!n.node_ops.getattr)throw new i.ErrnoError(63);return n.node_ops.getattr(n)},lstat:e=>i.stat(e,!0),chmod:(e,r,t)=>{var n;if(typeof e=="string"){var s=i.lookupPath(e,{follow:!t});n=s.node}else n=e;if(!n.node_ops.setattr)throw new i.ErrnoError(63);n.node_ops.setattr(n,{mode:r&4095|n.mode&-4096,timestamp:Date.now()})},lchmod:(e,r)=>{i.chmod(e,r,!0)},fchmod:(e,r)=>{var t=i.getStream(e);if(!t)throw new i.ErrnoError(8);i.chmod(t.node,r)},chown:(e,r,t,n)=>{var s;if(typeof e=="string"){var u=i.lookupPath(e,{follow:!n});s=u.node}else s=e;if(!s.node_ops.setattr)throw new i.ErrnoError(63);s.node_ops.setattr(s,{timestamp:Date.now()})},lchown:(e,r,t)=>{i.chown(e,r,t,!0)},fchown:(e,r,t)=>{var n=i.getStream(e);if(!n)throw new i.ErrnoError(8);i.chown(n.node,r,t)},truncate:(e,r)=>{if(r<0)throw new i.ErrnoError(28);var t;if(typeof e=="string"){var n=i.lookupPath(e,{follow:!0});t=n.node}else t=e;if(!t.node_ops.setattr)throw new i.ErrnoError(63);if(i.isDir(t.mode))throw new i.ErrnoError(31);if(!i.isFile(t.mode))throw new i.ErrnoError(28);var s=i.nodePermissions(t,"w");if(s)throw new i.ErrnoError(s);t.node_ops.setattr(t,{size:r,timestamp:Date.now()})},ftruncate:(e,r)=>{var t=i.getStream(e);if(!t)throw new i.ErrnoError(8);if(!(t.flags&2097155))throw new i.ErrnoError(28);i.truncate(t.node,r)},utime:(e,r,t)=>{var n=i.lookupPath(e,{follow:!0}),s=n.node;s.node_ops.setattr(s,{timestamp:Math.max(r,t)})},open:(e,r,t)=>{if(e==="")throw new i.ErrnoError(44);r=typeof r=="string"?i.modeStringToFlags(r):r,t=typeof t>"u"?438:t,r&64?t=t&4095|32768:t=0;var n;if(typeof e=="object")n=e;else{e=R.normalize(e);try{var s=i.lookupPath(e,{follow:!(r&131072)});n=s.node}catch{}}var u=!1;if(r&64)if(n){if(r&128)throw new i.ErrnoError(20)}else n=i.mknod(e,t,0),u=!0;if(!n)throw new i.ErrnoError(44);if(i.isChrdev(n.mode)&&(r&=-513),r&65536&&!i.isDir(n.mode))throw new i.ErrnoError(54);if(!u){var f=i.mayOpen(n,r);if(f)throw new i.ErrnoError(f)}r&512&&!u&&i.truncate(n,0),r&=-131713;var c=i.createStream({node:n,path:i.getPath(n),flags:r,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return c.stream_ops.open&&c.stream_ops.open(c),o.logReadFiles&&!(r&1)&&(i.readFiles||(i.readFiles={}),e in i.readFiles||(i.readFiles[e]=1)),c},close:e=>{if(i.isClosed(e))throw new i.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(r){throw r}finally{i.closeStream(e.fd)}e.fd=null},isClosed:e=>e.fd===null,llseek:(e,r,t)=>{if(i.isClosed(e))throw new i.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new i.ErrnoError(70);if(t!=0&&t!=1&&t!=2)throw new i.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read:(e,r,t,n,s)=>{if(n<0||s<0)throw new i.ErrnoError(28);if(i.isClosed(e))throw new i.ErrnoError(8);if((e.flags&2097155)===1)throw new i.ErrnoError(8);if(i.isDir(e.node.mode))throw new i.ErrnoError(31);if(!e.stream_ops.read)throw new i.ErrnoError(28);var u=typeof s<"u";if(!u)s=e.position;else if(!e.seekable)throw new i.ErrnoError(70);var f=e.stream_ops.read(e,r,t,n,s);return u||(e.position+=f),f},write:(e,r,t,n,s,u)=>{if(n<0||s<0)throw new i.ErrnoError(28);if(i.isClosed(e))throw new i.ErrnoError(8);if(!(e.flags&2097155))throw new i.ErrnoError(8);if(i.isDir(e.node.mode))throw new i.ErrnoError(31);if(!e.stream_ops.write)throw new i.ErrnoError(28);e.seekable&&e.flags&1024&&i.llseek(e,0,2);var f=typeof s<"u";if(!f)s=e.position;else if(!e.seekable)throw new i.ErrnoError(70);var c=e.stream_ops.write(e,r,t,n,s,u);return f||(e.position+=c),c},allocate:(e,r,t)=>{if(i.isClosed(e))throw new i.ErrnoError(8);if(r<0||t<=0)throw new i.ErrnoError(28);if(!(e.flags&2097155))throw new i.ErrnoError(8);if(!i.isFile(e.node.mode)&&!i.isDir(e.node.mode))throw new i.ErrnoError(43);if(!e.stream_ops.allocate)throw new i.ErrnoError(138);e.stream_ops.allocate(e,r,t)},mmap:(e,r,t,n,s)=>{if(n&2&&!(s&2)&&(e.flags&2097155)!==2)throw new i.ErrnoError(2);if((e.flags&2097155)===1)throw new i.ErrnoError(2);if(!e.stream_ops.mmap)throw new i.ErrnoError(43);return e.stream_ops.mmap(e,r,t,n,s)},msync:(e,r,t,n,s)=>!e||!e.stream_ops.msync?0:e.stream_ops.msync(e,r,t,n,s),munmap:e=>0,ioctl:(e,r,t)=>{if(!e.stream_ops.ioctl)throw new i.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile:(e,r={})=>{if(r.flags=r.flags||0,r.encoding=r.encoding||"binary",r.encoding!=="utf8"&&r.encoding!=="binary")throw new Error('Invalid encoding type "'+r.encoding+'"');var t,n=i.open(e,r.flags),s=i.stat(e),u=s.size,f=new Uint8Array(u);return i.read(n,f,0,u,0),r.encoding==="utf8"?t=we(f,0):r.encoding==="binary"&&(t=f),i.close(n),t},writeFile:(e,r,t={})=>{t.flags=t.flags||577;var n=i.open(e,t.flags,t.mode);if(typeof r=="string"){var s=new Uint8Array(lr(r)+1),u=fr(r,s,0,s.length);i.write(n,s,0,u,void 0,t.canOwn)}else if(ArrayBuffer.isView(r))i.write(n,r,0,r.byteLength,void 0,t.canOwn);else throw new Error("Unsupported data type");i.close(n)},cwd:()=>i.currentPath,chdir:e=>{var r=i.lookupPath(e,{follow:!0});if(r.node===null)throw new i.ErrnoError(44);if(!i.isDir(r.node.mode))throw new i.ErrnoError(54);var t=i.nodePermissions(r.node,"x");if(t)throw new i.ErrnoError(t);i.currentPath=r.path},createDefaultDirectories:()=>{i.mkdir("/tmp"),i.mkdir("/home"),i.mkdir("/home/web_user")},createDefaultDevices:()=>{i.mkdir("/dev"),i.registerDevice(i.makedev(1,3),{read:()=>0,write:(r,t,n,s,u)=>s}),i.mkdev("/dev/null",i.makedev(1,3)),ve.register(i.makedev(5,0),ve.default_tty_ops),ve.register(i.makedev(6,0),ve.default_tty1_ops),i.mkdev("/dev/tty",i.makedev(5,0)),i.mkdev("/dev/tty1",i.makedev(6,0));var e=xt();i.createDevice("/dev","random",e),i.createDevice("/dev","urandom",e),i.mkdir("/dev/shm"),i.mkdir("/dev/shm/tmp")},createSpecialDirectories:()=>{i.mkdir("/proc");var e=i.mkdir("/proc/self");i.mkdir("/proc/self/fd"),i.mount({mount:()=>{var r=i.createNode(e,"fd",16895,73);return r.node_ops={lookup:(t,n)=>{var s=+n,u=i.getStream(s);if(!u)throw new i.ErrnoError(8);var f={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>u.path}};return f.parent=f,f}},r}},{},"/proc/self/fd")},createStandardStreams:()=>{o.stdin?i.createDevice("/dev","stdin",o.stdin):i.symlink("/dev/tty","/dev/stdin"),o.stdout?i.createDevice("/dev","stdout",null,o.stdout):i.symlink("/dev/tty","/dev/stdout"),o.stderr?i.createDevice("/dev","stderr",null,o.stderr):i.symlink("/dev/tty1","/dev/stderr"),i.open("/dev/stdin",0),i.open("/dev/stdout",1),i.open("/dev/stderr",1)},ensureErrnoError:()=>{i.ErrnoError||(i.ErrnoError=function(r,t){this.node=t,this.setErrno=function(n){this.errno=n},this.setErrno(r),this.message="FS error"},i.ErrnoError.prototype=new Error,i.ErrnoError.prototype.constructor=i.ErrnoError,[44].forEach(e=>{i.genericErrors[e]=new i.ErrnoError(e),i.genericErrors[e].stack="<generic error, no stack>"}))},staticInit:()=>{i.ensureErrnoError(),i.nameTable=new Array(4096),i.mount(S,{},"/"),i.createDefaultDirectories(),i.createDefaultDevices(),i.createSpecialDirectories(),i.filesystems={MEMFS:S}},init:(e,r,t)=>{i.init.initialized=!0,i.ensureErrnoError(),o.stdin=e||o.stdin,o.stdout=r||o.stdout,o.stderr=t||o.stderr,i.createStandardStreams()},quit:()=>{i.init.initialized=!1;for(var e=0;e<i.streams.length;e++){var r=i.streams[e];r&&i.close(r)}},getMode:(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},findObject:(e,r)=>{var t=i.analyzePath(e,r);return t.exists?t.object:null},analyzePath:(e,r)=>{try{var t=i.lookupPath(e,{follow:!r});e=t.path}catch{}var n={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var t=i.lookupPath(e,{parent:!0});n.parentExists=!0,n.parentPath=t.path,n.parentObject=t.node,n.name=R.basename(e),t=i.lookupPath(e,{follow:!r}),n.exists=!0,n.path=t.path,n.object=t.node,n.name=t.node.name,n.isRoot=t.path==="/"}catch(s){n.error=s.errno}return n},createPath:(e,r,t,n)=>{e=typeof e=="string"?e:i.getPath(e);for(var s=r.split("/").reverse();s.length;){var u=s.pop();if(u){var f=R.join2(e,u);try{i.mkdir(f)}catch{}e=f}}return f},createFile:(e,r,t,n,s)=>{var u=R.join2(typeof e=="string"?e:i.getPath(e),r),f=i.getMode(n,s);return i.create(u,f)},createDataFile:(e,r,t,n,s,u)=>{var f=r;e&&(e=typeof e=="string"?e:i.getPath(e),f=r?R.join2(e,r):e);var c=i.getMode(n,s),l=i.create(f,c);if(t){if(typeof t=="string"){for(var h=new Array(t.length),w=0,_=t.length;w<_;++w)h[w]=t.charCodeAt(w);t=h}i.chmod(l,c|146);var g=i.open(l,577);i.write(g,t,0,t.length,0,u),i.close(g),i.chmod(l,c)}return l},createDevice:(e,r,t,n)=>{var s=R.join2(typeof e=="string"?e:i.getPath(e),r),u=i.getMode(!!t,!!n);i.createDevice.major||(i.createDevice.major=64);var f=i.makedev(i.createDevice.major++,0);return i.registerDevice(f,{open:c=>{c.seekable=!1},close:c=>{n&&n.buffer&&n.buffer.length&&n(10)},read:(c,l,h,w,_)=>{for(var g=0,E=0;E<w;E++){var D;try{D=t()}catch{throw new i.ErrnoError(29)}if(D===void 0&&g===0)throw new i.ErrnoError(6);if(D==null)break;g++,l[h+E]=D}return g&&(c.node.timestamp=Date.now()),g},write:(c,l,h,w,_)=>{for(var g=0;g<w;g++)try{n(l[h+g])}catch{throw new i.ErrnoError(29)}return w&&(c.node.timestamp=Date.now()),g}}),i.mkdev(s,u,f)},forceLoadFile:e=>{if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");if(M)try{e.contents=Ar(M(e.url),!0),e.usedBytes=e.contents.length}catch{throw new i.ErrnoError(29)}else throw new Error("Cannot load without read() or XMLHttpRequest.")},createLazyFile:(e,r,t,n,s)=>{function u(){this.lengthKnown=!1,this.chunks=[]}if(u.prototype.get=function(E){if(!(E>this.length-1||E<0)){var D=E%this.chunkSize,j=E/this.chunkSize|0;return this.getter(j)[D]}},u.prototype.setDataGetter=function(E){this.getter=E},u.prototype.cacheLength=function(){var E=new XMLHttpRequest;if(E.open("HEAD",t,!1),E.send(null),!(E.status>=200&&E.status<300||E.status===304))throw new Error("Couldn't load "+t+". Status: "+E.status);var D=Number(E.getResponseHeader("Content-length")),j,z=(j=E.getResponseHeader("Accept-Ranges"))&&j==="bytes",V=(j=E.getResponseHeader("Content-Encoding"))&&j==="gzip",J=1024*1024;z||(J=D);var q=(Z,ce)=>{if(Z>ce)throw new Error("invalid range ("+Z+", "+ce+") or no bytes requested!");if(ce>D-1)throw new Error("only "+D+" bytes available! programmer error!");var H=new XMLHttpRequest;if(H.open("GET",t,!1),D!==J&&H.setRequestHeader("Range","bytes="+Z+"-"+ce),H.responseType="arraybuffer",H.overrideMimeType&&H.overrideMimeType("text/plain; charset=x-user-defined"),H.send(null),!(H.status>=200&&H.status<300||H.status===304))throw new Error("Couldn't load "+t+". Status: "+H.status);return H.response!==void 0?new Uint8Array(H.response||[]):Ar(H.responseText||"",!0)},ge=this;ge.setDataGetter(Z=>{var ce=Z*J,H=(Z+1)*J-1;if(H=Math.min(H,D-1),typeof ge.chunks[Z]>"u"&&(ge.chunks[Z]=q(ce,H)),typeof ge.chunks[Z]>"u")throw new Error("doXHR failed!");return ge.chunks[Z]}),(V||!D)&&(J=D=1,D=this.getter(0).length,J=D,re("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=D,this._chunkSize=J,this.lengthKnown=!0},typeof XMLHttpRequest<"u"){if(!A)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var f=new u;Object.defineProperties(f,{length:{get:function(){return this.lengthKnown||this.cacheLength(),this._length}},chunkSize:{get:function(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}});var c={isDevice:!1,contents:f}}else var c={isDevice:!1,url:t};var l=i.createFile(e,r,c,n,s);c.contents?l.contents=c.contents:c.url&&(l.contents=null,l.url=c.url),Object.defineProperties(l,{usedBytes:{get:function(){return this.contents.length}}});var h={},w=Object.keys(l.stream_ops);w.forEach(g=>{var E=l.stream_ops[g];h[g]=function(){return i.forceLoadFile(l),E.apply(null,arguments)}});function _(g,E,D,j,z){var V=g.node.contents;if(z>=V.length)return 0;var J=Math.min(V.length-z,j);if(V.slice)for(var q=0;q<J;q++)E[D+q]=V[z+q];else for(var q=0;q<J;q++)E[D+q]=V.get(z+q);return J}return h.read=(g,E,D,j,z)=>(i.forceLoadFile(l),_(g,E,D,j,z)),h.mmap=(g,E,D,j,z)=>{i.forceLoadFile(l);var V=Kr(E);if(!V)throw new i.ErrnoError(48);return _(g,Y,V,E,D),{ptr:V,allocated:!0}},l.stream_ops=h,l},createPreloadedFile:(e,r,t,n,s,u,f,c,l,h)=>{var w=r?oe.resolve(R.join2(e,r)):e;function _(g){function E(D){h&&h(),c||i.createDataFile(e,r,D,n,s,l),u&&u(),Ge()}Browser.handledByPreloadPlugin(g,w,E,()=>{f&&f(),Ge()})||E(g)}hr(),typeof t=="string"?Bt(t,g=>_(g),f):_(t)},indexedDB:()=>window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,DB_NAME:()=>"EM_FS_"+window.location.pathname,DB_VERSION:20,DB_STORE_NAME:"FILE_DATA",saveFilesToDB:(e,r,t)=>{r=r||(()=>{}),t=t||(()=>{});var n=i.indexedDB();try{var s=n.open(i.DB_NAME(),i.DB_VERSION)}catch(u){return t(u)}s.onupgradeneeded=()=>{re("creating db");var u=s.result;u.createObjectStore(i.DB_STORE_NAME)},s.onsuccess=()=>{var u=s.result,f=u.transaction([i.DB_STORE_NAME],"readwrite"),c=f.objectStore(i.DB_STORE_NAME),l=0,h=0,w=e.length;function _(){h==0?r():t()}e.forEach(g=>{var E=c.put(i.analyzePath(g).object.contents,g);E.onsuccess=()=>{l++,l+h==w&&_()},E.onerror=()=>{h++,l+h==w&&_()}}),f.onerror=t},s.onerror=t},loadFilesFromDB:(e,r,t)=>{r=r||(()=>{}),t=t||(()=>{});var n=i.indexedDB();try{var s=n.open(i.DB_NAME(),i.DB_VERSION)}catch(u){return t(u)}s.onupgradeneeded=t,s.onsuccess=()=>{var u=s.result;try{var f=u.transaction([i.DB_STORE_NAME],"readonly")}catch(g){t(g);return}var c=f.objectStore(i.DB_STORE_NAME),l=0,h=0,w=e.length;function _(){h==0?r():t()}e.forEach(g=>{var E=c.get(g);E.onsuccess=()=>{i.analyzePath(g).exists&&i.unlink(g),i.createDataFile(R.dirname(g),R.basename(g),E.result,!0,!0,!0),l++,l+h==w&&_()},E.onerror=()=>{h++,l+h==w&&_()}}),f.onerror=t},s.onerror=t}},X={DEFAULT_POLLMASK:5,calculateAt:function(e,r,t){if(R.isAbs(r))return r;var n;if(e===-100)n=i.cwd();else{var s=i.getStream(e);if(!s)throw new i.ErrnoError(8);n=s.path}if(r.length==0){if(!t)throw new i.ErrnoError(44);return n}return R.join2(n,r)},doStat:function(e,r,t){try{var n=e(r)}catch(s){if(s&&s.node&&R.normalize(r)!==R.normalize(i.getPath(s.node)))return-54;throw s}return k[t>>2]=n.dev,k[t+4>>2]=0,k[t+8>>2]=n.ino,k[t+12>>2]=n.mode,k[t+16>>2]=n.nlink,k[t+20>>2]=n.uid,k[t+24>>2]=n.gid,k[t+28>>2]=n.rdev,k[t+32>>2]=0,ie=[n.size>>>0,(W=n.size,+Math.abs(W)>=1?W>0?(Math.min(+Math.floor(W/4294967296),4294967295)|0)>>>0:~~+Math.ceil((W-+(~~W>>>0))/4294967296)>>>0:0)],k[t+40>>2]=ie[0],k[t+44>>2]=ie[1],k[t+48>>2]=4096,k[t+52>>2]=n.blocks,k[t+56>>2]=n.atime.getTime()/1e3|0,k[t+60>>2]=0,k[t+64>>2]=n.mtime.getTime()/1e3|0,k[t+68>>2]=0,k[t+72>>2]=n.ctime.getTime()/1e3|0,k[t+76>>2]=0,ie=[n.ino>>>0,(W=n.ino,+Math.abs(W)>=1?W>0?(Math.min(+Math.floor(W/4294967296),4294967295)|0)>>>0:~~+Math.ceil((W-+(~~W>>>0))/4294967296)>>>0:0)],k[t+80>>2]=ie[0],k[t+84>>2]=ie[1],0},doMsync:function(e,r,t,n,s){var u=G.slice(e,e+t);i.msync(r,u,s,t,n)},varargs:void 0,get:function(){X.varargs+=4;var e=k[X.varargs-4>>2];return e},getStr:function(e){var r=Mr(e);return r},getStreamFromFD:function(e){var r=i.getStream(e);if(!r)throw new i.ErrnoError(8);return r}};function Wt(e,r,t){X.varargs=t;try{var n=X.getStreamFromFD(e);switch(r){case 0:{var s=X.get();if(s<0)return-28;var u;return u=i.createStream(n,s),u.fd}case 1:case 2:return 0;case 3:return n.flags;case 4:{var s=X.get();return n.flags|=s,0}case 5:{var s=X.get(),f=0;return de[s+f>>1]=2,0}case 6:case 7:return 0;case 16:case 8:return-28;case 9:return Lt(28),-1;default:return-28}}catch(c){if(typeof i>"u"||!(c instanceof i.ErrnoError))throw c;return-c.errno}}function Vt(e,r,t,n){X.varargs=n;try{r=X.getStr(r),r=X.calculateAt(e,r);var s=n?X.get():0;return i.open(r,t,s).fd}catch(u){if(typeof i>"u"||!(u instanceof i.ErrnoError))throw u;return-u.errno}}function qt(e,r,t,n,s){}function vr(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}function Gt(){for(var e=new Array(256),r=0;r<256;++r)e[r]=String.fromCharCode(r);Jr=e}var Jr=void 0;function Q(e){for(var r="",t=e;G[t];)r+=Jr[G[t++]];return r}var _e={},me={},Je={},Xt=48,Kt=57;function Ye(e){if(e===void 0)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var r=e.charCodeAt(0);return r>=Xt&&r<=Kt?"_"+e:e}function mr(e,r){return e=Ye(e),new Function("body","return function "+e+`() {
- "use strict"; return body.apply(this, arguments);
- };
- `)(r)}function gr(e,r){var t=mr(r,function(n){this.name=r,this.message=n;var s=new Error(n).stack;s!==void 0&&(this.stack=this.toString()+`
- `+s.replace(/^Error(:[^\n]*)?\n/,""))});return t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.prototype.toString=function(){return this.message===void 0?this.name:this.name+": "+this.message},t}var Ee=void 0;function I(e){throw new Ee(e)}var Yr=void 0;function Qe(e){throw new Yr(e)}function De(e,r,t){e.forEach(function(c){Je[c]=r});function n(c){var l=t(c);l.length!==e.length&&Qe("Mismatched type converter count");for(var h=0;h<e.length;++h)se(e[h],l[h])}var s=new Array(r.length),u=[],f=0;r.forEach((c,l)=>{me.hasOwnProperty(c)?s[l]=me[c]:(u.push(c),_e.hasOwnProperty(c)||(_e[c]=[]),_e[c].push(()=>{s[l]=me[c],++f,f===u.length&&n(s)}))}),u.length===0&&n(s)}function se(e,r,t={}){if(!("argPackAdvance"in r))throw new TypeError("registerType registeredInstance requires argPackAdvance");var n=r.name;if(e||I('type "'+n+'" must have a positive integer typeid pointer'),me.hasOwnProperty(e)){if(t.ignoreDuplicateRegistrations)return;I("Cannot register type '"+n+"' twice")}if(me[e]=r,delete Je[e],_e.hasOwnProperty(e)){var s=_e[e];delete _e[e],s.forEach(u=>u())}}function Jt(e,r,t,n,s){var u=vr(t);r=Q(r),se(e,{name:r,fromWireType:function(f){return!!f},toWireType:function(f,c){return c?n:s},argPackAdvance:8,readValueFromPointer:function(f){var c;if(t===1)c=Y;else if(t===2)c=de;else if(t===4)c=k;else throw new TypeError("Unknown boolean type size: "+r);return this.fromWireType(c[f>>u])},destructorFunction:null})}function Yt(e){if(!(this instanceof fe)||!(e instanceof fe))return!1;for(var r=this.$$.ptrType.registeredClass,t=this.$$.ptr,n=e.$$.ptrType.registeredClass,s=e.$$.ptr;r.baseClass;)t=r.upcast(t),r=r.baseClass;for(;n.baseClass;)s=n.upcast(s),n=n.baseClass;return r===n&&t===s}function Qt(e){return{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}}function yr(e){function r(t){return t.$$.ptrType.registeredClass.name}I(r(e)+" instance already deleted")}var wr=!1;function Qr(e){}function Zt(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}function Zr(e){e.count.value-=1;var r=e.count.value===0;r&&Zt(e)}function et(e,r,t){if(r===t)return e;if(t.baseClass===void 0)return null;var n=et(e,r,t.baseClass);return n===null?null:t.downcast(n)}var rt={};function en(){return Object.keys(ke).length}function rn(){var e=[];for(var r in ke)ke.hasOwnProperty(r)&&e.push(ke[r]);return e}var Ae=[];function _r(){for(;Ae.length;){var e=Ae.pop();e.$$.deleteScheduled=!1,e.delete()}}var Se=void 0;function tn(e){Se=e,Ae.length&&Se&&Se(_r)}function nn(){o.getInheritedInstanceCount=en,o.getLiveInheritedInstances=rn,o.flushPendingDeletes=_r,o.setDelayFunction=tn}var ke={};function on(e,r){for(r===void 0&&I("ptr should not be undefined");e.baseClass;)r=e.upcast(r),e=e.baseClass;return r}function sn(e,r){return r=on(e,r),ke[r]}function Ze(e,r){(!r.ptrType||!r.ptr)&&Qe("makeClassHandle requires ptr and ptrType");var t=!!r.smartPtrType,n=!!r.smartPtr;return t!==n&&Qe("Both smartPtrType and smartPtr must be specified"),r.count={value:1},Fe(Object.create(e,{$$:{value:r}}))}function an(e){var r=this.getPointee(e);if(!r)return this.destructor(e),null;var t=sn(this.registeredClass,r);if(t!==void 0){if(t.$$.count.value===0)return t.$$.ptr=r,t.$$.smartPtr=e,t.clone();var n=t.clone();return this.destructor(e),n}function s(){return this.isSmartPointer?Ze(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:r,smartPtrType:this,smartPtr:e}):Ze(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var u=this.registeredClass.getActualType(r),f=rt[u];if(!f)return s.call(this);var c;this.isConst?c=f.constPointerType:c=f.pointerType;var l=et(r,this.registeredClass,c.registeredClass);return l===null?s.call(this):this.isSmartPointer?Ze(c.registeredClass.instancePrototype,{ptrType:c,ptr:l,smartPtrType:this,smartPtr:e}):Ze(c.registeredClass.instancePrototype,{ptrType:c,ptr:l})}function Fe(e){return typeof FinalizationRegistry>"u"?(Fe=r=>r,e):(wr=new FinalizationRegistry(r=>{Zr(r.$$)}),Fe=r=>{var t=r.$$,n=!!t.smartPtr;if(n){var s={$$:t};wr.register(r,s,r)}return r},Qr=r=>wr.unregister(r),Fe(e))}function un(){if(this.$$.ptr||yr(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Fe(Object.create(Object.getPrototypeOf(this),{$$:{value:Qt(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function cn(){this.$$.ptr||yr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&I("Object already scheduled for deletion"),Qr(this),Zr(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function fn(){return!this.$$.ptr}function ln(){return this.$$.ptr||yr(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&I("Object already scheduled for deletion"),Ae.push(this),Ae.length===1&&Se&&Se(_r),this.$$.deleteScheduled=!0,this}function dn(){fe.prototype.isAliasOf=Yt,fe.prototype.clone=un,fe.prototype.delete=cn,fe.prototype.isDeleted=fn,fe.prototype.deleteLater=ln}function fe(){}function tt(e,r,t){if(e[r].overloadTable===void 0){var n=e[r];e[r]=function(){return e[r].overloadTable.hasOwnProperty(arguments.length)||I("Function '"+t+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[r].overloadTable+")!"),e[r].overloadTable[arguments.length].apply(this,arguments)},e[r].overloadTable=[],e[r].overloadTable[n.argCount]=n}}function hn(e,r,t){o.hasOwnProperty(e)?((t===void 0||o[e].overloadTable!==void 0&&o[e].overloadTable[t]!==void 0)&&I("Cannot register public name '"+e+"' twice"),tt(o,e,e),o.hasOwnProperty(t)&&I("Cannot register multiple overloads of a function with the same number of arguments ("+t+")!"),o[e].overloadTable[t]=r):(o[e]=r,t!==void 0&&(o[e].numArguments=t))}function pn(e,r,t,n,s,u,f,c){this.name=e,this.constructor=r,this.instancePrototype=t,this.rawDestructor=n,this.baseClass=s,this.getActualType=u,this.upcast=f,this.downcast=c,this.pureVirtualFunctions=[]}function Er(e,r,t){for(;r!==t;)r.upcast||I("Expected null or instance of "+t.name+", got an instance of "+r.name),e=r.upcast(e),r=r.baseClass;return e}function vn(e,r){if(r===null)return this.isReference&&I("null is not a valid "+this.name),0;r.$$||I('Cannot pass "'+Tr(r)+'" as a '+this.name),r.$$.ptr||I("Cannot pass deleted object as a pointer of type "+this.name);var t=r.$$.ptrType.registeredClass,n=Er(r.$$.ptr,t,this.registeredClass);return n}function mn(e,r){var t;if(r===null)return this.isReference&&I("null is not a valid "+this.name),this.isSmartPointer?(t=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,t),t):0;r.$$||I('Cannot pass "'+Tr(r)+'" as a '+this.name),r.$$.ptr||I("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&r.$$.ptrType.isConst&&I("Cannot convert argument of type "+(r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name)+" to parameter type "+this.name);var n=r.$$.ptrType.registeredClass;if(t=Er(r.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(r.$$.smartPtr===void 0&&I("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:r.$$.smartPtrType===this?t=r.$$.smartPtr:I("Cannot convert argument of type "+(r.$$.smartPtrType?r.$$.smartPtrType.name:r.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:t=r.$$.smartPtr;break;case 2:if(r.$$.smartPtrType===this)t=r.$$.smartPtr;else{var s=r.clone();t=this.rawShare(t,rr.toHandle(function(){s.delete()})),e!==null&&e.push(this.rawDestructor,t)}break;default:I("Unsupporting sharing policy")}return t}function gn(e,r){if(r===null)return this.isReference&&I("null is not a valid "+this.name),0;r.$$||I('Cannot pass "'+Tr(r)+'" as a '+this.name),r.$$.ptr||I("Cannot pass deleted object as a pointer of type "+this.name),r.$$.ptrType.isConst&&I("Cannot convert argument of type "+r.$$.ptrType.name+" to parameter type "+this.name);var t=r.$$.ptrType.registeredClass,n=Er(r.$$.ptr,t,this.registeredClass);return n}function er(e){return this.fromWireType(x[e>>2])}function yn(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function wn(e){this.rawDestructor&&this.rawDestructor(e)}function _n(e){e!==null&&e.delete()}function En(){ae.prototype.getPointee=yn,ae.prototype.destructor=wn,ae.prototype.argPackAdvance=8,ae.prototype.readValueFromPointer=er,ae.prototype.deleteObject=_n,ae.prototype.fromWireType=an}function ae(e,r,t,n,s,u,f,c,l,h,w){this.name=e,this.registeredClass=r,this.isReference=t,this.isConst=n,this.isSmartPointer=s,this.pointeeType=u,this.sharingPolicy=f,this.rawGetPointee=c,this.rawConstructor=l,this.rawShare=h,this.rawDestructor=w,!s&&r.baseClass===void 0?n?(this.toWireType=vn,this.destructorFunction=null):(this.toWireType=gn,this.destructorFunction=null):this.toWireType=mn}function bn(e,r,t){o.hasOwnProperty(e)||Qe("Replacing nonexistant public symbol"),o[e].overloadTable!==void 0&&t!==void 0?o[e].overloadTable[t]=r:(o[e]=r,o[e].argCount=t)}function Pn(e,r,t){var n=o["dynCall_"+e];return t&&t.length?n.apply(null,[r].concat(t)):n.call(null,r)}function Tn(e,r,t){return e.includes("j")?Pn(e,r,t):Ke(r).apply(null,t)}function Cn(e,r){var t=[];return function(){return t.length=0,Object.assign(t,arguments),Tn(e,r,t)}}function be(e,r){e=Q(e);function t(){return e.includes("j")?Cn(e,r):Ke(r)}var n=t();return typeof n!="function"&&I("unknown function pointer with signature "+e+": "+r),n}var nt=void 0;function it(e){var r=dt(e),t=Q(r);return ue(r),t}function br(e,r){var t=[],n={};function s(u){if(!n[u]&&!me[u]){if(Je[u]){Je[u].forEach(s);return}t.push(u),n[u]=!0}}throw r.forEach(s),new nt(e+": "+t.map(it).join([", "]))}function Dn(e,r,t,n,s,u,f,c,l,h,w,_,g){w=Q(w),u=be(s,u),c&&(c=be(f,c)),h&&(h=be(l,h)),g=be(_,g);var E=Ye(w);hn(E,function(){br("Cannot construct "+w+" due to unbound types",[n])}),De([e,r,t],n?[n]:[],function(D){D=D[0];var j,z;n?(j=D.registeredClass,z=j.instancePrototype):z=fe.prototype;var V=mr(E,function(){if(Object.getPrototypeOf(this)!==J)throw new Ee("Use 'new' to construct "+w);if(q.constructor_body===void 0)throw new Ee(w+" has no accessible constructor");var H=q.constructor_body[arguments.length];if(H===void 0)throw new Ee("Tried to invoke ctor of "+w+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(q.constructor_body).toString()+") parameters instead!");return H.apply(this,arguments)}),J=Object.create(z,{constructor:{value:V}});V.prototype=J;var q=new pn(w,V,J,g,j,u,c,h),ge=new ae(w,q,!0,!1,!1),Z=new ae(w+"*",q,!1,!1,!1),ce=new ae(w+" const*",q,!1,!0,!1);return rt[e]={pointerType:Z,constPointerType:ce},bn(E,V),[ge,Z,ce]})}function ot(e,r){for(var t=[],n=0;n<e;n++)t.push(k[(r>>2)+n]);return t}function An(e){for(;e.length;){var r=e.pop(),t=e.pop();t(r)}}function st(e,r){if(!(e instanceof Function))throw new TypeError("new_ called with constructor type "+typeof e+" which is not a function");var t=mr(e.name||"unknownFunctionName",function(){});t.prototype=e.prototype;var n=new t,s=e.apply(n,r);return s instanceof Object?s:n}function at(e,r,t,n,s){var u=r.length;u<2&&I("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var f=r[1]!==null&&t!==null,c=!1,l=1;l<r.length;++l)if(r[l]!==null&&r[l].destructorFunction===void 0){c=!0;break}for(var h=r[0].name!=="void",w="",_="",l=0;l<u-2;++l)w+=(l!==0?", ":"")+"arg"+l,_+=(l!==0?", ":"")+"arg"+l+"Wired";var g="return function "+Ye(e)+"("+w+`) {
- if (arguments.length !== `+(u-2)+`) {
- throwBindingError('function `+e+" called with ' + arguments.length + ' arguments, expected "+(u-2)+` args!');
- }
- `;c&&(g+=`var destructors = [];
- `);var E=c?"destructors":"null",D=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],j=[I,n,s,An,r[0],r[1]];f&&(g+="var thisWired = classParam.toWireType("+E+`, this);
- `);for(var l=0;l<u-2;++l)g+="var arg"+l+"Wired = argType"+l+".toWireType("+E+", arg"+l+"); // "+r[l+2].name+`
- `,D.push("argType"+l),j.push(r[l+2]);if(f&&(_="thisWired"+(_.length>0?", ":"")+_),g+=(h?"var rv = ":"")+"invoker(fn"+(_.length>0?", ":"")+_+`);
- `,c)g+=`runDestructors(destructors);
- `;else for(var l=f?1:2;l<r.length;++l){var z=l===1?"thisWired":"arg"+(l-2)+"Wired";r[l].destructorFunction!==null&&(g+=z+"_dtor("+z+"); // "+r[l].name+`
- `,D.push(z+"_dtor"),j.push(r[l].destructorFunction))}h&&(g+=`var ret = retType.fromWireType(rv);
- return ret;
- `),g+=`}
- `,D.push(g);var V=st(Function,D).apply(null,j);return V}function Sn(e,r,t,n,s,u){Ur(r>0);var f=ot(r,t);s=be(n,s),De([],[e],function(c){c=c[0];var l="constructor "+c.name;if(c.registeredClass.constructor_body===void 0&&(c.registeredClass.constructor_body=[]),c.registeredClass.constructor_body[r-1]!==void 0)throw new Ee("Cannot register multiple constructors with identical number of parameters ("+(r-1)+") for class '"+c.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return c.registeredClass.constructor_body[r-1]=()=>{br("Cannot construct "+c.name+" due to unbound types",f)},De([],f,function(h){return h.splice(1,0,null),c.registeredClass.constructor_body[r-1]=at(l,h,null,s,u),[]}),[]})}function kn(e,r,t,n,s,u,f,c){var l=ot(t,n);r=Q(r),u=be(s,u),De([],[e],function(h){h=h[0];var w=h.name+"."+r;r.startsWith("@@")&&(r=Symbol[r.substring(2)]),c&&h.registeredClass.pureVirtualFunctions.push(r);function _(){br("Cannot call "+w+" due to unbound types",l)}var g=h.registeredClass.instancePrototype,E=g[r];return E===void 0||E.overloadTable===void 0&&E.className!==h.name&&E.argCount===t-2?(_.argCount=t-2,_.className=h.name,g[r]=_):(tt(g,r,w),g[r].overloadTable[t-2]=_),De([],l,function(D){var j=at(w,D,h,u,f);return g[r].overloadTable===void 0?(j.argCount=t-2,g[r]=j):g[r].overloadTable[t-2]=j,[]}),[]})}var Pr=[],ne=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function ut(e){e>4&&--ne[e].refcount===0&&(ne[e]=void 0,Pr.push(e))}function Fn(){for(var e=0,r=5;r<ne.length;++r)ne[r]!==void 0&&++e;return e}function On(){for(var e=5;e<ne.length;++e)if(ne[e]!==void 0)return ne[e];return null}function $n(){o.count_emval_handles=Fn,o.get_first_emval=On}var rr={toValue:e=>(e||I("Cannot use deleted val. handle = "+e),ne[e].value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:{var r=Pr.length?Pr.pop():ne.length;return ne[r]={refcount:1,value:e},r}}}};function Rn(e,r){r=Q(r),se(e,{name:r,fromWireType:function(t){var n=rr.toValue(t);return ut(t),n},toWireType:function(t,n){return rr.toHandle(n)},argPackAdvance:8,readValueFromPointer:er,destructorFunction:null})}function Tr(e){if(e===null)return"null";var r=typeof e;return r==="object"||r==="array"||r==="function"?e.toString():""+e}function In(e,r){switch(r){case 2:return function(t){return this.fromWireType(xr[t>>2])};case 3:return function(t){return this.fromWireType(zr[t>>3])};default:throw new TypeError("Unknown float type: "+e)}}function Nn(e,r,t){var n=vr(t);r=Q(r),se(e,{name:r,fromWireType:function(s){return s},toWireType:function(s,u){return u},argPackAdvance:8,readValueFromPointer:In(r,n),destructorFunction:null})}function Un(e,r,t){switch(r){case 0:return t?function(s){return Y[s]}:function(s){return G[s]};case 1:return t?function(s){return de[s>>1]}:function(s){return qe[s>>1]};case 2:return t?function(s){return k[s>>2]}:function(s){return x[s>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function jn(e,r,t,n,s){r=Q(r);var u=vr(t),f=_=>_;if(n===0){var c=32-8*t;f=_=>_<<c>>>c}var l=r.includes("unsigned"),h=(_,g)=>{},w;l?w=function(_,g){return h(g,this.name),g>>>0}:w=function(_,g){return h(g,this.name),g},se(e,{name:r,fromWireType:f,toWireType:w,argPackAdvance:8,readValueFromPointer:Un(r,u,n!==0),destructorFunction:null})}function Mn(e,r,t){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],s=n[r];function u(f){f=f>>2;var c=x,l=c[f],h=c[f+1];return new s(dr,h,l)}t=Q(t),se(e,{name:t,fromWireType:u,argPackAdvance:8,readValueFromPointer:u},{ignoreDuplicateRegistrations:!0})}function Ln(e,r){r=Q(r);var t=r==="std::string";se(e,{name:r,fromWireType:function(n){var s=x[n>>2],u;if(t)for(var f=n+4,c=0;c<=s;++c){var l=n+4+c;if(c==s||G[l]==0){var h=l-f,w=Mr(f,h);u===void 0?u=w:(u+=String.fromCharCode(0),u+=w),f=l+1}}else{for(var _=new Array(s),c=0;c<s;++c)_[c]=String.fromCharCode(G[n+4+c]);u=_.join("")}return ue(n),u},toWireType:function(n,s){s instanceof ArrayBuffer&&(s=new Uint8Array(s));var u,f=typeof s=="string";f||s instanceof Uint8Array||s instanceof Uint8ClampedArray||s instanceof Int8Array||I("Cannot pass non-string to std::string"),t&&f?u=()=>lr(s):u=()=>s.length;var c=u(),l=ir(4+c+1);if(x[l>>2]=c,t&&f)yt(s,l+4,c+1);else if(f)for(var h=0;h<c;++h){var w=s.charCodeAt(h);w>255&&(ue(l),I("String has UTF-16 code units that do not fit in 8 bits")),G[l+4+h]=w}else for(var h=0;h<c;++h)G[l+4+h]=s[h];return n!==null&&n.push(ue,l),l},argPackAdvance:8,readValueFromPointer:er,destructorFunction:function(n){ue(n)}})}function xn(e,r,t){t=Q(t);var n,s,u,f,c;r===2?(n=wt,s=_t,f=Et,u=()=>qe,c=1):r===4&&(n=bt,s=Pt,f=Tt,u=()=>x,c=2),se(e,{name:t,fromWireType:function(l){for(var h=x[l>>2],w=u(),_,g=l+4,E=0;E<=h;++E){var D=l+4+E*r;if(E==h||w[D>>c]==0){var j=D-g,z=n(g,j);_===void 0?_=z:(_+=String.fromCharCode(0),_+=z),g=D+r}}return ue(l),_},toWireType:function(l,h){typeof h!="string"&&I("Cannot pass non-string to C++ string type "+t);var w=f(h),_=ir(4+w+r);return x[_>>2]=w>>c,s(h,_+4,w+r),l!==null&&l.push(ue,_),_},argPackAdvance:8,readValueFromPointer:er,destructorFunction:function(l){ue(l)}})}function zn(e,r){r=Q(r),se(e,{isVoid:!0,name:r,argPackAdvance:0,fromWireType:function(){},toWireType:function(t,n){}})}function Hn(){return Date.now()}var Bn={};function Wn(e){var r=Bn[e];return r===void 0?Q(e):r}var Cr=[];function Vn(e,r,t,n){e=Cr[e],r=rr.toValue(r),t=Wn(t),e(r,t,null,n)}function qn(e){var r=Cr.length;return Cr.push(e),r}function Gn(e,r){var t=me[e];return t===void 0&&I(r+" has unknown type "+it(e)),t}function Xn(e,r){for(var t=new Array(e),n=0;n<e;++n)t[n]=Gn(x[r+n*cr>>2],"parameter "+n);return t}var ct=[];function Kn(e,r){var t=Xn(e,r),n=t[0],s=n.name+"_$"+t.slice(1).map(function(D){return D.name}).join("_")+"$",u=ct[s];if(u!==void 0)return u;for(var f=["retType"],c=[n],l="",h=0;h<e-1;++h)l+=(h!==0?", ":"")+"arg"+h,f.push("argType"+h),c.push(t[1+h]);for(var w=Ye("methodCaller_"+s),_="return function "+w+`(handle, name, destructors, args) {
- `,g=0,h=0;h<e-1;++h)_+=" var arg"+h+" = argType"+h+".readValueFromPointer(args"+(g?"+"+g:"")+`);
- `,g+=t[h+1].argPackAdvance;_+=" var rv = handle[name]("+l+`);
- `;for(var h=0;h<e-1;++h)t[h+1].deleteObject&&(_+=" argType"+h+".deleteObject(arg"+h+`);
- `);n.isVoid||(_+=` return retType.toWireType(destructors, rv);
- `),_+=`};
- `,f.push(_);var E=st(Function,f).apply(null,c);return u=qn(E),ct[s]=u,u}function Jn(){pe("")}function Yn(){return G.length}function Qn(){return Yn()}function Zn(e,r,t){G.copyWithin(e,r,r+t)}function ei(e){pe("OOM")}function ri(e){G.length,ei()}var Dr={};function ti(){return b||"./this.program"}function Oe(){if(!Oe.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:ti()};for(var t in Dr)Dr[t]===void 0?delete r[t]:r[t]=Dr[t];var n=[];for(var t in r)n.push(t+"="+r[t]);Oe.strings=n}return Oe.strings}function ni(e,r){var t=0;return Oe().forEach(function(n,s){var u=r+t;x[e+s*4>>2]=u,Ct(n,u),t+=n.length+1}),0}function ii(e,r){var t=Oe();x[e>>2]=t.length;var n=0;return t.forEach(function(s){n+=s.length+1}),x[r>>2]=n,0}function oi(e){try{var r=X.getStreamFromFD(e);return i.close(r),0}catch(t){if(typeof i>"u"||!(t instanceof i.ErrnoError))throw t;return t.errno}}function si(e,r){try{var t=X.getStreamFromFD(e),n=t.tty?2:i.isDir(t.mode)?3:i.isLink(t.mode)?7:4;return Y[r>>0]=n,0}catch(s){if(typeof i>"u"||!(s instanceof i.ErrnoError))throw s;return s.errno}}function ai(e,r,t,n){for(var s=0,u=0;u<t;u++){var f=x[r>>2],c=x[r+4>>2];r+=8;var l=i.read(e,Y,f,c,n);if(l<0)return-1;if(s+=l,l<c)break}return s}function ui(e,r,t,n){try{var s=X.getStreamFromFD(e),u=ai(s,r,t);return k[n>>2]=u,0}catch(f){if(typeof i>"u"||!(f instanceof i.ErrnoError))throw f;return f.errno}}function ci(e,r){return r+2097152>>>0<4194305-!!e?(e>>>0)+r*4294967296:NaN}function fi(e,r,t,n,s){try{var u=ci(r,t);if(isNaN(u))return 61;var f=X.getStreamFromFD(e);return i.llseek(f,u,n),ie=[f.position>>>0,(W=f.position,+Math.abs(W)>=1?W>0?(Math.min(+Math.floor(W/4294967296),4294967295)|0)>>>0:~~+Math.ceil((W-+(~~W>>>0))/4294967296)>>>0:0)],k[s>>2]=ie[0],k[s+4>>2]=ie[1],f.getdents&&u===0&&n===0&&(f.getdents=null),0}catch(c){if(typeof i>"u"||!(c instanceof i.ErrnoError))throw c;return c.errno}}function li(e,r,t,n){for(var s=0,u=0;u<t;u++){var f=x[r>>2],c=x[r+4>>2];r+=8;var l=i.write(e,Y,f,c,n);if(l<0)return-1;s+=l}return s}function di(e,r,t,n){try{var s=X.getStreamFromFD(e),u=li(s,r,t);return x[n>>2]=u,0}catch(f){if(typeof i>"u"||!(f instanceof i.ErrnoError))throw f;return f.errno}}function hi(e){}var ft=function(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=i.nextInode++,this.name=r,this.mode=t,this.node_ops={},this.stream_ops={},this.rdev=n},tr=365,nr=146;Object.defineProperties(ft.prototype,{read:{get:function(){return(this.mode&tr)===tr},set:function(e){e?this.mode|=tr:this.mode&=~tr}},write:{get:function(){return(this.mode&nr)===nr},set:function(e){e?this.mode|=nr:this.mode&=~nr}},isFolder:{get:function(){return i.isDir(this.mode)}},isDevice:{get:function(){return i.isChrdev(this.mode)}}}),i.FSNode=ft,i.staticInit(),Gt(),Ee=o.BindingError=gr(Error,"BindingError"),Yr=o.InternalError=gr(Error,"InternalError"),dn(),nn(),En(),nt=o.UnboundTypeError=gr(Error,"UnboundTypeError"),$n();function Ar(e,r,t){var n=t>0?t:lr(e)+1,s=new Array(n),u=fr(e,s,0,s.length);return r&&(s.length=u),s}var pi={q:Ut,p:Mt,D:Wt,x:Vt,t:qt,F:Jt,u:Dn,r:Sn,d:kn,E:Rn,l:Nn,c:jn,b:Mn,k:Ln,g:xn,o:zn,f:Hn,i:Vn,n:ut,m:Kn,a:Jn,w:Qn,B:Zn,v:ri,z:ni,A:ii,j:oi,y:si,C:ui,s:fi,h:di,e:hi};Nt(),o.___wasm_call_ctors=function(){return(o.___wasm_call_ctors=o.asm.H).apply(null,arguments)};var ir=o._malloc=function(){return(ir=o._malloc=o.asm.I).apply(null,arguments)},ue=o._free=function(){return(ue=o._free=o.asm.K).apply(null,arguments)},lt=o.___errno_location=function(){return(lt=o.___errno_location=o.asm.L).apply(null,arguments)},dt=o.___getTypeName=function(){return(dt=o.___getTypeName=o.asm.M).apply(null,arguments)};o.___embind_register_native_and_builtin_types=function(){return(o.___embind_register_native_and_builtin_types=o.asm.N).apply(null,arguments)};var ht=o._emscripten_builtin_memalign=function(){return(ht=o._emscripten_builtin_memalign=o.asm.O).apply(null,arguments)},pt=o.___cxa_is_pointer_type=function(){return(pt=o.___cxa_is_pointer_type=o.asm.P).apply(null,arguments)};o.dynCall_viiijj=function(){return(o.dynCall_viiijj=o.asm.Q).apply(null,arguments)},o.dynCall_jij=function(){return(o.dynCall_jij=o.asm.R).apply(null,arguments)},o.dynCall_jii=function(){return(o.dynCall_jii=o.asm.S).apply(null,arguments)},o.dynCall_jiji=function(){return(o.dynCall_jiji=o.asm.T).apply(null,arguments)};var or;function vi(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}Ce=function e(){or||Sr(),or||(Ce=e)};function Sr(e){if(he>0||(At(),he>0))return;function r(){or||(or=!0,o.calledRun=!0,!Nr&&(St(),d(o),o.onRuntimeInitialized&&o.onRuntimeInitialized(),kt()))}o.setStatus?(o.setStatus("Running..."),setTimeout(function(){setTimeout(function(){o.setStatus("")},1),r()},1)):r()}if(o.run=Sr,o.preInit)for(typeof o.preInit=="function"&&(o.preInit=[o.preInit]);o.preInit.length>0;)o.preInit.pop()();return Sr(),o.ready}})(),Oi=Object.defineProperty,$i=Object.getOwnPropertyDescriptor,He=(v,a,o,d)=>{for(var p=d>1?void 0:d?$i(a,o):a,T=v.length-1,b;T>=0;T--)(b=v[T])&&(p=(d?b(a,o,p):b(p))||p);return d&&p&&Oi(a,o,p),p};class Be extends O{constructor(){super(...arguments),this.sampleRate=0,this.channels=0}initialize(){return new Promise(a=>{const o={};o.print=d=>console.log(d),o.printErr=d=>console.log(`[JS] ERROR: ${d}`),o.onAbort=()=>console.log("[JS] FATAL: WASM ABORTED"),o.postRun=d=>{this.module=d,this.decoder=new this.module.AudioDecoder(this),a()},Fi(o)})}configure(a){this.config=a,this.decoder.setCodec(this.config.codec,this.config.description)}decode(a){this.decoder.decode(a.data,a.timestamp)}flush(){}reset(){this.config=void 0,this.decoder&&this.decoder.clear()}close(){this.removeAllListeners(),this.decoder&&(this.decoder.clear(),this.decoder.delete())}audioInfo(a,o){this.sampleRate=a,this.channels=o;let d={sampleRate:a,channels:o,depth:16};this.emit(Te.AudioCodecInfo,d)}pcmData(a,o,d){if(!this.module)return;let p=[];for(let b=0;b<this.channels;b++){let F=this.module.HEAPU32[(a>>2)+b]>>2;p.push(Float32Array.of(...this.module.HEAPF32.subarray(F,F+o)))}let T={datas:p,sampleNum:o,channles:this.channels,pts:d};this.emit(Te.AudioFrame,T)}errorInfo(a){let o={errMsg:a};this.emit(Te.Error,o)}}He([B(O.INIT,"initialized")],Be.prototype,"initialize",1);He([B("initialized","configured")],Be.prototype,"configure",1);He([Ue("configured")],Be.prototype,"decode",1);He([B("configured","initialized")],Be.prototype,"reset",1);He([B([],"closed")],Be.prototype,"close",1);var Ri=Object.defineProperty,Ii=Object.getOwnPropertyDescriptor,We=(v,a,o,d)=>{for(var p=d>1?void 0:d?Ii(a,o):a,T=v.length-1,b;T>=0;T--)(b=v[T])&&(p=(d?b(a,o,p):b(p))||p);return d&&p&&Ri(a,o,p),p};class Ve extends O{async initialize(){this.decoder=new AudioDecoder({output:a=>{this.emit(Te.AudioFrame,a)},error:a=>{this.emit(Te.Error,a),this.close()}})}configure(a){this.config=a,this.decoder.configure({codec:{aac:"mp4a.40.2",pcma:"alaw",pcmu:"ulaw"}[a.codec],description:a.description,sampleRate:a.sampleRate,numberOfChannels:a.numberOfChannels})}decode(a){this.decoder.state==="configured"&&this.decoder.decode(new EncodedAudioChunk(a))}flush(){this.decoder.flush()}reset(){this.decoder.reset()}close(){this.decoder.close()}}We([B([O.INIT,"closed"],"initialized")],Ve.prototype,"initialize",1);We([B("initialized","configured")],Ve.prototype,"configure",1);We([Ue("configured")],Ve.prototype,"decode",1);We([B([],O.INIT)],Ve.prototype,"reset",1);We([B([],"closed",{ignoreError:!0})],Ve.prototype,"close",1);export{Ve as A,zi as D,xi as F,ze as V,Hi as W,Bi as a,ar as b,sr as c,Pe as d,Te as e,Li as u};
|