UNPKG

@webarkit/ar-nft

Version:

WebAR Javscript library for markerless AR

1 lines 750 kB
!function(A,I){"object"==typeof exports&&"object"==typeof module?module.exports=I():"function"==typeof define&&define.amd?define([],I):"object"==typeof exports?exports.ARnft=I():A.ARnft=I()}("undefined"!=typeof self?self:this,(()=>(()=>{var A={512:A=>{"use strict";A.exports=function(A,I,g,B){var C=self||window;try{try{var Q;try{Q=new C.Blob([A])}catch(I){(Q=new(C.BlobBuilder||C.WebKitBlobBuilder||C.MozBlobBuilder||C.MSBlobBuilder)).append(A),Q=Q.getBlob()}var E=C.URL||C.webkitURL,i=E.createObjectURL(Q),o=new C[I](i,g);return E.revokeObjectURL(i),o}catch(B){return new C[I]("data:application/javascript,".concat(encodeURIComponent(A)),g)}}catch(A){if(!B)throw Error("Inline worker is not supported");return new C[I](B,g)}}},571:function(A){var I;A.exports=((I=function(){function A(A){return C.appendChild(A.dom),A}function g(A){for(var I=0;I<C.children.length;I++)C.children[I].style.display=I===A?"block":"none";B=A}var B=0,C=document.createElement("div");C.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",C.addEventListener("click",(function(A){A.preventDefault(),g(++B%C.children.length)}),!1);var Q=(performance||Date).now(),E=Q,i=0,o=A(new I.Panel("FPS","#0ff","#002")),D=A(new I.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var a=A(new I.Panel("MB","#f08","#201"));return g(0),{REVISION:16,dom:C,addPanel:A,showPanel:g,begin:function(){Q=(performance||Date).now()},end:function(){i++;var A=(performance||Date).now();if(D.update(A-Q,200),A>E+1e3&&(o.update(1e3*i/(A-E),100),E=A,i=0,a)){var I=performance.memory;a.update(I.usedJSHeapSize/1048576,I.jsHeapSizeLimit/1048576)}return A},update:function(){Q=this.end()},domElement:C,setMode:g}}).Panel=function(A,I,g){var B=1/0,C=0,Q=Math.round,E=Q(window.devicePixelRatio||1),i=80*E,o=48*E,D=3*E,a=2*E,t=3*E,s=15*E,w=74*E,G=30*E,h=document.createElement("canvas");h.width=i,h.height=o,h.style.cssText="width:80px;height:48px";var e=h.getContext("2d");return e.font="bold "+9*E+"px Helvetica,Arial,sans-serif",e.textBaseline="top",e.fillStyle=g,e.fillRect(0,0,i,o),e.fillStyle=I,e.fillText(A,D,a),e.fillRect(t,s,w,G),e.fillStyle=g,e.globalAlpha=.9,e.fillRect(t,s,w,G),{dom:h,update:function(o,r){B=Math.min(B,o),C=Math.max(C,o),e.fillStyle=g,e.globalAlpha=1,e.fillRect(0,0,i,s),e.fillStyle=I,e.fillText(Q(o)+" "+A+" ("+Q(B)+"-"+Q(C)+")",D,a),e.drawImage(h,t+E,s,w-E,G,t,s,w-E,G),e.fillRect(t+w-E,s,E,G),e.fillStyle=g,e.globalAlpha=.9,e.fillRect(t+w-E,s,E,Q((1-o/r)*G))}}},I)}},I={};function g(B){var C=I[B];if(void 0!==C)return C.exports;var Q=I[B]={exports:{}};return A[B].call(Q.exports,Q,Q.exports,g),Q.exports}g.n=A=>{var I=A&&A.__esModule?()=>A.default:()=>A;return g.d(I,{a:I}),I},g.d=(A,I)=>{for(var B in I)g.o(I,B)&&!g.o(A,B)&&Object.defineProperty(A,B,{enumerable:!0,get:I[B]})},g.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(A){if("object"==typeof window)return window}}(),g.o=(A,I)=>Object.prototype.hasOwnProperty.call(A,I);var B={};return(()=>{"use strict";g.d(B,{default:()=>y});class A{static createContainer(A){if(A.container.create){const A=document.createElement("div");A.id="app";const I=document.createElement("canvas");I.id="canvas";const g=document.createElement("video");g.id="video",g.setAttribute("autoplay",""),g.setAttribute("muted",""),g.setAttribute("playsinline",""),A.appendChild(g),A.appendChild(I);const B=document.getElementById("loading");return document.body.insertBefore(A,B),{container:A,canvas:I,video:g}}return{container:document.getElementById(A.container.containerName),canvas:document.getElementById(A.container.canvasName),video:document.getElementById("video")}}static createStats(A,I){if(A&&I.stats.createHtml){const A=document.createElement("div");A.id="stats",A.className="ui stats";const I=document.createElement("div");I.id="stats1",I.className="stats-item";const g=document.createElement("p");g.className="stats-item-title",g.innerText="Main",I.appendChild(g),A.appendChild(I);const B=document.createElement("div");B.id="stats2",B.className="stats-item";const C=document.createElement("p");C.className="stats-item-title",C.innerText="Worker",B.appendChild(C),A.appendChild(B);const Q=document.getElementById("loading");return document.body.insertBefore(A,Q),A}}static createLoading(A){if(A.loading.create){const I=document.createElement("div");I.id="loading";const g=document.createElement("img");g.src=A.loading.logo.src,g.alt=A.loading.logo.alt;const B=document.createElement("span");return B.setAttribute("class","loading-text"),B.innerText=A.loading.loadingMessage,I.appendChild(g),I.appendChild(B),document.body.insertBefore(I,document.body.firstChild),I}}}var I=g(571),C=g.n(I);class Q{canvas_process;context_process;_video;_facing;vw;vh;w;h;pw;ph;ox;oy;target;targetFrameRate=60;imageDataCache;_frame;lastCache=0;constructor(A){this.canvas_process=document.createElement("canvas"),this.context_process=this.canvas_process.getContext("2d",{alpha:!1,willReadFrequently:!0}),this._video=A,this.target=window||g.g,this._frame=0}get facing(){return this._facing}get height(){return this.vh}get width(){return this.vw}get video(){return this._video}get frame(){return this._frame}get canvasProcess(){return this.canvas_process}get contextProcess(){return this.context_process}getFrame(){return this._frame}getImage(){const A=Date.now();if(A-this.lastCache>1e3/this.targetFrameRate){this.context_process.drawImage(this.video,0,0,this.vw,this.vh,this.ox,this.oy,this.w,this.h);const I=this.context_process.getImageData(0,0,this.pw,this.ph);null==this.imageDataCache?this.imageDataCache=I.data:this.imageDataCache.set(I.data),this.lastCache=A,this._frame++}return new ImageData(this.imageDataCache.slice(),this.pw,this.ph)}get image(){const A=Date.now();if(A-this.lastCache>1e3/this.targetFrameRate){this.context_process.drawImage(this.video,0,0,this.vw,this.vh,this.ox,this.oy,this.w,this.h);const I=this.context_process.getImageData(0,0,this.pw,this.ph);null==this.imageDataCache?this.imageDataCache=I.data:this.imageDataCache.set(I.data),this.lastCache=A,this._frame++}return new ImageData(this.imageDataCache.slice(),this.pw,this.ph)}prepareImage(){this.vw=this._video.videoWidth,this.vh=this._video.videoHeight;const A=320/Math.max(this.vw,this.vh/3*4);this.w=Math.floor(this.vw*A),this.h=Math.floor(this.vh*A),this.pw=Math.floor(Math.max(this.w,this.h/3*4)),this.ph=Math.floor(Math.max(this.h,this.w/4*3)),this.ox=Math.floor((this.pw-this.w)/2),this.oy=Math.floor((this.ph-this.h)/2),this.canvas_process.width=this.pw,this.canvas_process.height=this.ph,this.context_process.fillStyle="black",this.context_process.fillRect(0,0,this.pw,this.ph)}async initialize(A){if(this._facing=A.facingMode||"environment",null!=A.targetFrameRate&&(this.targetFrameRate=A.targetFrameRate),!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)return Promise.reject("Sorry, Your device does not support this experience.");try{const I={audio:!1,video:{facingMode:this._facing,width:{min:A.width.min,max:A.width.max}}};if(navigator.mediaDevices.enumerateDevices){const A=await navigator.mediaDevices.enumerateDevices(),g=[];let B=0;A.forEach((function(A){"videoinput"==A.kind&&(g[B++]=A.deviceId)})),g.length>1&&(I.video.deviceId={exact:g[g.length-1]})}return this._video.srcObject=await navigator.mediaDevices.getUserMedia(I),this._video=await new Promise((A=>{this._video.onloadedmetadata=()=>A(this._video)})),this.prepareImage(),!0}catch(A){return Promise.reject(A)}}destroy(){const A=this._video;this.target.addEventListener("stopVideoStreaming",(function(){const I=A.srcObject;if(console.log("stop streaming"),null!=I){I.getTracks().forEach((function(A){A.stop()})),A.srcObject=null;let g=document.getElementById("app");null!=g&&g.remove()}}))}}function E(A,I){const g=320/Math.max(A,I/3*4),B=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?window.outerWidth/A:1;let C=A*g,Q=I*g;return[A*B,I*B,Math.max(C,Q/3*4),Math.max(Q,C/4*3),C,Q]}async function i(A){try{const I=await fetch(A);if(!I.ok)throw new Error("HTTP error, status = "+I.status);return await I.json()}catch(A){return Promise.reject(A)}}var o=g(512),D=g.n(o);function a(){return D()('(()=>{var A={564:function(A,I,g){var B;"undefined"!=typeof self&&self,B=()=>(()=>{var A={633:(A,I,g)=>{var B=g(738).default;function C(){"use strict";A.exports=C=function(){return g},A.exports.__esModule=!0,A.exports.default=A.exports;var I,g={},Q=Object.prototype,E=Q.hasOwnProperty,i=Object.defineProperty||function(A,I,g){A[I]=g.value},o="function"==typeof Symbol?Symbol:{},D=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",w=o.toStringTag||"@@toStringTag";function s(A,I,g){return Object.defineProperty(A,I,{value:g,enumerable:!0,configurable:!0,writable:!0}),A[I]}try{s({},"")}catch(I){s=function(A,I,g){return A[I]=g}}function G(A,I,g,B){var C=I&&I.prototype instanceof y?I:y,Q=Object.create(C.prototype),E=new d(B||[]);return i(Q,"_invoke",{value:J(A,g,E)}),Q}function t(A,I,g){try{return{type:"normal",arg:A.call(I,g)}}catch(A){return{type:"throw",arg:A}}}g.wrap=G;var F="suspendedStart",h="suspendedYield",R="executing",r="completed",e={};function y(){}function S(){}function N(){}var c={};s(c,D,(function(){return this}));var k=Object.getPrototypeOf,U=k&&k(k(H([])));U&&U!==Q&&E.call(U,D)&&(c=U);var M=N.prototype=y.prototype=Object.create(c);function n(A){["next","throw","return"].forEach((function(I){s(A,I,(function(A){return this._invoke(I,A)}))}))}function K(A,I){function g(C,Q,i,o){var D=t(A[C],A,Q);if("throw"!==D.type){var a=D.arg,w=a.value;return w&&"object"==B(w)&&E.call(w,"__await")?I.resolve(w.__await).then((function(A){g("next",A,i,o)}),(function(A){g("throw",A,i,o)})):I.resolve(w).then((function(A){a.value=A,i(a)}),(function(A){return g("throw",A,i,o)}))}o(D.arg)}var C;i(this,"_invoke",{value:function(A,B){function Q(){return new I((function(I,C){g(A,B,I,C)}))}return C=C?C.then(Q,Q):Q()}})}function J(A,g,B){var C=F;return function(Q,E){if(C===R)throw Error("Generator is already running");if(C===r){if("throw"===Q)throw E;return{value:I,done:!0}}for(B.method=Q,B.arg=E;;){var i=B.delegate;if(i){var o=Y(i,B);if(o){if(o===e)continue;return o}}if("next"===B.method)B.sent=B._sent=B.arg;else if("throw"===B.method){if(C===F)throw C=r,B.arg;B.dispatchException(B.arg)}else"return"===B.method&&B.abrupt("return",B.arg);C=R;var D=t(A,g,B);if("normal"===D.type){if(C=B.done?r:h,D.arg===e)continue;return{value:D.arg,done:B.done}}"throw"===D.type&&(C=r,B.method="throw",B.arg=D.arg)}}}function Y(A,g){var B=g.method,C=A.iterator[B];if(C===I)return g.delegate=null,"throw"===B&&A.iterator.return&&(g.method="return",g.arg=I,Y(A,g),"throw"===g.method)||"return"!==B&&(g.method="throw",g.arg=new TypeError("The iterator does not provide a \'"+B+"\' method")),e;var Q=t(C,A.iterator,g.arg);if("throw"===Q.type)return g.method="throw",g.arg=Q.arg,g.delegate=null,e;var E=Q.arg;return E?E.done?(g[A.resultName]=E.value,g.next=A.nextLoc,"return"!==g.method&&(g.method="next",g.arg=I),g.delegate=null,e):E:(g.method="throw",g.arg=new TypeError("iterator result is not an object"),g.delegate=null,e)}function L(A){var I={tryLoc:A[0]};1 in A&&(I.catchLoc=A[1]),2 in A&&(I.finallyLoc=A[2],I.afterLoc=A[3]),this.tryEntries.push(I)}function l(A){var I=A.completion||{};I.type="normal",delete I.arg,A.completion=I}function d(A){this.tryEntries=[{tryLoc:"root"}],A.forEach(L,this),this.reset(!0)}function H(A){if(A||""===A){var g=A[D];if(g)return g.call(A);if("function"==typeof A.next)return A;if(!isNaN(A.length)){var C=-1,Q=function g(){for(;++C<A.length;)if(E.call(A,C))return g.value=A[C],g.done=!1,g;return g.value=I,g.done=!0,g};return Q.next=Q}}throw new TypeError(B(A)+" is not iterable")}return S.prototype=N,i(M,"constructor",{value:N,configurable:!0}),i(N,"constructor",{value:S,configurable:!0}),S.displayName=s(N,w,"GeneratorFunction"),g.isGeneratorFunction=function(A){var I="function"==typeof A&&A.constructor;return!!I&&(I===S||"GeneratorFunction"===(I.displayName||I.name))},g.mark=function(A){return Object.setPrototypeOf?Object.setPrototypeOf(A,N):(A.__proto__=N,s(A,w,"GeneratorFunction")),A.prototype=Object.create(M),A},g.awrap=function(A){return{__await:A}},n(K.prototype),s(K.prototype,a,(function(){return this})),g.AsyncIterator=K,g.async=function(A,I,B,C,Q){void 0===Q&&(Q=Promise);var E=new K(G(A,I,B,C),Q);return g.isGeneratorFunction(I)?E:E.next().then((function(A){return A.done?A.value:E.next()}))},n(M),s(M,w,"Generator"),s(M,D,(function(){return this})),s(M,"toString",(function(){return"[object Generator]"})),g.keys=function(A){var I=Object(A),g=[];for(var B in I)g.push(B);return g.reverse(),function A(){for(;g.length;){var B=g.pop();if(B in I)return A.value=B,A.done=!1,A}return A.done=!0,A}},g.values=H,d.prototype={constructor:d,reset:function(A){if(this.prev=0,this.next=0,this.sent=this._sent=I,this.done=!1,this.delegate=null,this.method="next",this.arg=I,this.tryEntries.forEach(l),!A)for(var g in this)"t"===g.charAt(0)&&E.call(this,g)&&!isNaN(+g.slice(1))&&(this[g]=I)},stop:function(){this.done=!0;var A=this.tryEntries[0].completion;if("throw"===A.type)throw A.arg;return this.rval},dispatchException:function(A){if(this.done)throw A;var g=this;function B(B,C){return i.type="throw",i.arg=A,g.next=B,C&&(g.method="next",g.arg=I),!!C}for(var C=this.tryEntries.length-1;C>=0;--C){var Q=this.tryEntries[C],i=Q.completion;if("root"===Q.tryLoc)return B("end");if(Q.tryLoc<=this.prev){var o=E.call(Q,"catchLoc"),D=E.call(Q,"finallyLoc");if(o&&D){if(this.prev<Q.catchLoc)return B(Q.catchLoc,!0);if(this.prev<Q.finallyLoc)return B(Q.finallyLoc)}else if(o){if(this.prev<Q.catchLoc)return B(Q.catchLoc,!0)}else{if(!D)throw Error("try statement without catch or finally");if(this.prev<Q.finallyLoc)return B(Q.finallyLoc)}}}},abrupt:function(A,I){for(var g=this.tryEntries.length-1;g>=0;--g){var B=this.tryEntries[g];if(B.tryLoc<=this.prev&&E.call(B,"finallyLoc")&&this.prev<B.finallyLoc){var C=B;break}}C&&("break"===A||"continue"===A)&&C.tryLoc<=I&&I<=C.finallyLoc&&(C=null);var Q=C?C.completion:{};return Q.type=A,Q.arg=I,C?(this.method="next",this.next=C.finallyLoc,e):this.complete(Q)},complete:function(A,I){if("throw"===A.type)throw A.arg;return"break"===A.type||"continue"===A.type?this.next=A.arg:"return"===A.type?(this.rval=this.arg=A.arg,this.method="return",this.next="end"):"normal"===A.type&&I&&(this.next=I),e},finish:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var g=this.tryEntries[I];if(g.finallyLoc===A)return this.complete(g.completion,g.afterLoc),l(g),e}},catch:function(A){for(var I=this.tryEntries.length-1;I>=0;--I){var g=this.tryEntries[I];if(g.tryLoc===A){var B=g.completion;if("throw"===B.type){var C=B.arg;l(g)}return C}}throw Error("illegal catch attempt")},delegateYield:function(A,g,B){return this.delegate={iterator:H(A),resultName:g,nextLoc:B},"next"===this.method&&(this.arg=I),e}},g}A.exports=C,A.exports.__esModule=!0,A.exports.default=A.exports},738:A=>{function I(g){return A.exports=I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(A){return typeof A}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},A.exports.__esModule=!0,A.exports.default=A.exports,I(g)}A.exports=I,A.exports.__esModule=!0,A.exports.default=A.exports},756:(A,I,g)=>{var B=g(633)();A.exports=B;try{regeneratorRuntime=B}catch(A){"object"==typeof globalThis?globalThis.regeneratorRuntime=B:Function("r","regeneratorRuntime = r")(B)}}},I={};function B(g){var C=I[g];if(void 0!==C)return C.exports;var Q=I[g]={exports:{}};return A[g](Q,Q.exports,B),Q.exports}B.n=A=>{var I=A&&A.__esModule?()=>A.default:()=>A;return B.d(I,{a:I}),I},B.d=(A,I)=>{for(var g in I)B.o(I,g)&&!B.o(A,g)&&Object.defineProperty(A,g,{enumerable:!0,get:I[g]})},B.o=(A,I)=>Object.prototype.hasOwnProperty.call(A,I),B.r=A=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(A,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(A,"__esModule",{value:!0})};var C={};return(()=>{"use strict";B.r(C),B.d(C,{ARControllerNFT:()=>HI,ARToolkitNFT:()=>dI});var A={};function I(A,I,g,B,C,Q,E){try{var i=A[Q](E),o=i.value}catch(A){return void g(A)}i.done?I(o):Promise.resolve(o).then(B,C)}function Q(A){return function(){var g=this,B=arguments;return new Promise((function(C,Q){var E=A.apply(g,B);function i(A){I(E,C,Q,i,o,"next",A)}function o(A){I(E,C,Q,i,o,"throw",A)}i(void 0)}))}}function E(A,I){if(!(A instanceof I))throw new TypeError("Cannot call a class as a function")}function i(A){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(A){return typeof A}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},i(A)}function o(A){var I=function(A){if("object"!=i(A)||!A)return A;var I=A[Symbol.toPrimitive];if(void 0!==I){var g=I.call(A,"string");if("object"!=i(g))return g;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(A)}(A);return"symbol"==i(I)?I:I+""}function D(A,I){for(var g=0;g<I.length;g++){var B=I[g];B.enumerable=B.enumerable||!1,B.configurable=!0,"value"in B&&(B.writable=!0),Object.defineProperty(A,o(B.key),B)}}function a(A,I,g){return I&&D(A.prototype,I),g&&D(A,g),Object.defineProperty(A,"prototype",{writable:!1}),A}function w(A,I,g){return(I=o(I))in A?Object.defineProperty(A,I,{value:g,enumerable:!0,configurable:!0,writable:!0}):A[I]=g,A}B.r(A),B.d(A,{hasBrowserEnv:()=>UA,hasStandardBrowserEnv:()=>nA,hasStandardBrowserWebWorkerEnv:()=>KA,navigator:()=>MA,origin:()=>JA});var s,G=B(756),t=B.n(G),F=(s="undefined"!=typeof document?document.currentScript?.src:void 0,function(A={}){var I,g,B,C=A,Q=new Promise(((A,B)=>{I=A,g=B})),E=Object.assign({},C),i="./this.program",o="";"undefined"!=typeof document&&document.currentScript&&(o=document.currentScript.src),s&&(o=s),o=o.startsWith("blob:")?"":o.substr(0,o.replace(/[?#].*/,"").lastIndexOf("/")+1),B=A=>fetch(A,{credentials:"same-origin"}).then((A=>A.ok?A.arrayBuffer():Promise.reject(new Error(A.status+" : "+A.url))));var D=C.print||console.log.bind(console),a=C.printErr||console.error.bind(console);Object.assign(C,E),E=null,C.arguments&&C.arguments,C.thisProgram&&(i=C.thisProgram);var w,G,t,F,h,R,r,e,y,S=C.wasmBinary,N=!1;function c(){var A=w.buffer;C.HEAP8=G=new Int8Array(A),C.HEAP16=F=new Int16Array(A),C.HEAPU8=t=new Uint8Array(A),C.HEAPU16=h=new Uint16Array(A),C.HEAP32=R=new Int32Array(A),C.HEAPU32=r=new Uint32Array(A),C.HEAPF32=e=new Float32Array(A),C.HEAPF64=y=new Float64Array(A)}var k=[],U=[],M=[];function n(A){k.unshift(A)}function K(A){M.unshift(A)}var J=0,Y=null,L=null;function l(A){J++,C.monitorRunDependencies?.(J)}function d(A){if(J--,C.monitorRunDependencies?.(J),0==J&&(null!==Y&&(clearInterval(Y),Y=null),L)){var I=L;L=null,I()}}function H(A){C.onAbort?.(A),a(A="Aborted("+A+")"),N=!0,A+=". Build with -sASSERTIONS for more info.";var I=new WebAssembly.RuntimeError(A);throw g(I),I}var q,p,b,W="data:application/octet-stream;base64,";function f(A){return Promise.resolve().then((()=>function(A){if(A==q&&S)return new Uint8Array(S);var I=function(A){if((A=>A.startsWith(W))(A))return function(A){for(var I=atob(A),g=new Uint8Array(I.length),B=0;B<I.length;++B)g[B]=I.charCodeAt(B);return g}(A.slice(37))}(A);if(I)return I;throw"both async and sync fetching of the wasm failed"}(A)))}var u={73896:(A,I,g)=>{var B=DA(A),C=DA(I),Q=DA(g);console.log(C+B,Q)},74035:(A,I,g,B)=>{var C=DA(A),Q=DA(I),E=DA(g),i=DA(B);console.log(Q+C,E,i)},74213:(A,I,g,B)=>{var C=DA(A),Q=DA(I),E=DA(g),i=DA(B);console.log(Q+C,E,i)},74391:(A,I,g,B)=>{var C=DA(A),Q=DA(I),E=DA(g),i=DA(B);console.log(Q+C,E,i)},74569:(A,I,g,B)=>{var C=DA(A),Q=DA(I),E=DA(g),i=DA(B);console.log(Q+C,E,i)},74747:(A,I,g,B)=>{var C=DA(A),Q=DA(I),E=DA(g);console.log(Q+C,E,B)},74890:(A,I,g)=>{var B=DA(A),C=DA(I),Q=DA(g);console.error(C+B,Q)},75033:(A,I,g,B)=>{var C=DA(A),Q=DA(I),E=DA(g),i=DA(B);console.error(Q+C,E,i)},75215:(A,I,g,B)=>{var C=DA(A),Q=DA(I),E=DA(g),i=DA(B);console.error(Q+C,E,i)},75397:(A,I,g,B)=>{var C=DA(A),Q=DA(I),E=DA(g),i=DA(B);console.error(Q+C,E,i)},75579:(A,I,g,B)=>{var C=DA(A),Q=DA(I),E=DA(g),i=DA(B);console.error(Q+C,E,i)},75761:(A,I,g,B)=>{var C=DA(A),Q=DA(I),E=DA(g);console.error(Q+C,E,B)},75908:(A,I,g)=>{var B=DA(A),C=DA(I),Q=DA(g);console.warn(C+B,Q)},76048:(A,I,g,B)=>{var C=DA(A),Q=DA(I),E=DA(g),i=DA(B);console.warn(Q+C,E,i)},76229:(A,I,g,B)=>{var C=DA(A),Q=DA(I),E=DA(g),i=DA(B);console.warn(Q+C,E,i)},76410:(A,I,g,B)=>{var C=DA(A),Q=DA(I),E=DA(g),i=DA(B);console.warn(Q+C,E,i)},76591:(A,I,g,B)=>{var C=DA(A),Q=DA(I),E=DA(g),i=DA(B);console.warn(Q+C,E,i)},76772:(A,I,g,B)=>{var C=DA(A),Q=DA(I),E=DA(g);console.warn(Q+C,E,B)}};function m(A){this.name="ExitStatus",this.message=`Program terminated with exit(${A})`,this.status=A}var Z=A=>{A.forEach((A=>A(C)))},V=C.noExitRuntime||!0,T=A=>fI(A),x=()=>uI();class O{constructor(A){this.excPtr=A,this.ptr=A-24}set_type(A){r[this.ptr+4>>2]=A}get_type(){return r[this.ptr+4>>2]}set_destructor(A){r[this.ptr+8>>2]=A}get_destructor(){return r[this.ptr+8>>2]}set_caught(A){A=A?1:0,G[this.ptr+12]=A}get_caught(){return 0!=G[this.ptr+12]}set_rethrown(A){A=A?1:0,G[this.ptr+13]=A}get_rethrown(){return 0!=G[this.ptr+13]}init(A,I){this.set_adjusted_ptr(0),this.set_type(A),this.set_destructor(I)}set_adjusted_ptr(A){r[this.ptr+16>>2]=A}get_adjusted_ptr(){return r[this.ptr+16>>2]}}function X(){var A=R[+aA.varargs>>2];return aA.varargs+=4,A}var j=X,P={isAbs:A=>"/"===A.charAt(0),splitPath:A=>/^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/.exec(A).slice(1),normalizeArray:(A,I)=>{for(var g=0,B=A.length-1;B>=0;B--){var C=A[B];"."===C?A.splice(B,1):".."===C?(A.splice(B,1),g++):g&&(A.splice(B,1),g--)}if(I)for(;g;g--)A.unshift("..");return A},normalize:A=>{var I=P.isAbs(A),g="/"===A.substr(-1);return(A=P.normalizeArray(A.split("/").filter((A=>!!A)),!I).join("/"))||I||(A="."),A&&g&&(A+="/"),(I?"/":"")+A},dirname:A=>{var I=P.splitPath(A),g=I[0],B=I[1];return g||B?(B&&(B=B.substr(0,B.length-1)),g+B):"."},basename:A=>{if("/"===A)return"/";var I=(A=(A=P.normalize(A)).replace(/\\/$/,"")).lastIndexOf("/");return-1===I?A:A.substr(I+1)},join:(...A)=>P.normalize(A.join("/")),join2:(A,I)=>P.normalize(A+"/"+I)},v=A=>(v=(()=>{if("object"==typeof crypto&&"function"==typeof crypto.getRandomValues)return A=>crypto.getRandomValues(A);H("initRandomDevice")})())(A),z={resolve:(...A)=>{for(var I="",g=!1,B=A.length-1;B>=-1&&!g;B--){var C=B>=0?A[B]:oA.cwd();if("string"!=typeof C)throw new TypeError("Arguments to path.resolve must be strings");if(!C)return"";I=C+"/"+I,g=P.isAbs(C)}return(g?"/":"")+(I=P.normalizeArray(I.split("/").filter((A=>!!A)),!g).join("/"))||"."},relative:(A,I)=>{function g(A){for(var I=0;I<A.length&&""===A[I];I++);for(var g=A.length-1;g>=0&&""===A[g];g--);return I>g?[]:A.slice(I,g-I+1)}A=z.resolve(A).substr(1),I=z.resolve(I).substr(1);for(var B=g(A.split("/")),C=g(I.split("/")),Q=Math.min(B.length,C.length),E=Q,i=0;i<Q;i++)if(B[i]!==C[i]){E=i;break}var o=[];for(i=E;i<B.length;i++)o.push("..");return(o=o.concat(C.slice(E))).join("/")}},_="undefined"!=typeof TextDecoder?new TextDecoder:void 0,$=(A,I=0,g=NaN)=>{for(var B=I+g,C=I;A[C]&&!(C>=B);)++C;if(C-I>16&&A.buffer&&_)return _.decode(A.subarray(I,C));for(var Q="";I<C;){var E=A[I++];if(128&E){var i=63&A[I++];if(192!=(224&E)){var o=63&A[I++];if((E=224==(240&E)?(15&E)<<12|i<<6|o:(7&E)<<18|i<<12|o<<6|63&A[I++])<65536)Q+=String.fromCharCode(E);else{var D=E-65536;Q+=String.fromCharCode(55296|D>>10,56320|1023&D)}}else Q+=String.fromCharCode((31&E)<<6|i)}else Q+=String.fromCharCode(E)}return Q},AA=[],IA=A=>{for(var I=0,g=0;g<A.length;++g){var B=A.charCodeAt(g);B<=127?I++:B<=2047?I+=2:B>=55296&&B<=57343?(I+=4,++g):I+=3}return I},gA=(A,I,g,B)=>{if(!(B>0))return 0;for(var C=g,Q=g+B-1,E=0;E<A.length;++E){var i=A.charCodeAt(E);if(i>=55296&&i<=57343&&(i=65536+((1023&i)<<10)|1023&A.charCodeAt(++E)),i<=127){if(g>=Q)break;I[g++]=i}else if(i<=2047){if(g+1>=Q)break;I[g++]=192|i>>6,I[g++]=128|63&i}else if(i<=65535){if(g+2>=Q)break;I[g++]=224|i>>12,I[g++]=128|i>>6&63,I[g++]=128|63&i}else{if(g+3>=Q)break;I[g++]=240|i>>18,I[g++]=128|i>>12&63,I[g++]=128|i>>6&63,I[g++]=128|63&i}}return I[g]=0,g-C},BA={ttys:[],init(){},shutdown(){},register(A,I){BA.ttys[A]={input:[],output:[],ops:I},oA.registerDevice(A,BA.stream_ops)},stream_ops:{open(A){var I=BA.ttys[A.node.rdev];if(!I)throw new oA.ErrnoError(43);A.tty=I,A.seekable=!1},close(A){A.tty.ops.fsync(A.tty)},fsync(A){A.tty.ops.fsync(A.tty)},read(A,I,g,B,C){if(!A.tty||!A.tty.ops.get_char)throw new oA.ErrnoError(60);for(var Q=0,E=0;E<B;E++){var i;try{i=A.tty.ops.get_char(A.tty)}catch(A){throw new oA.ErrnoError(29)}if(void 0===i&&0===Q)throw new oA.ErrnoError(6);if(null==i)break;Q++,I[g+E]=i}return Q&&(A.node.timestamp=Date.now()),Q},write(A,I,g,B,C){if(!A.tty||!A.tty.ops.put_char)throw new oA.ErrnoError(60);try{for(var Q=0;Q<B;Q++)A.tty.ops.put_char(A.tty,I[g+Q])}catch(A){throw new oA.ErrnoError(29)}return B&&(A.node.timestamp=Date.now()),Q}},default_tty_ops:{get_char:A=>(()=>{if(!AA.length){var A=null;if("undefined"!=typeof window&&"function"==typeof window.prompt&&null!==(A=window.prompt("Input: "))&&(A+="\\n"),!A)return null;g=IA(I=A)+1,B=new Array(g),C=gA(I,B,0,B.length),B.length=C,AA=B}var I,g,B,C;return AA.shift()})(),put_char(A,I){null===I||10===I?(D($(A.output)),A.output=[]):0!=I&&A.output.push(I)},fsync(A){A.output&&A.output.length>0&&(D($(A.output)),A.output=[])},ioctl_tcgets:A=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(A,I,g)=>0,ioctl_tiocgwinsz:A=>[24,80]},default_tty1_ops:{put_char(A,I){null===I||10===I?(a($(A.output)),A.output=[]):0!=I&&A.output.push(I)},fsync(A){A.output&&A.output.length>0&&(a($(A.output)),A.output=[])}}},CA=A=>{H()},QA={ops_table:null,mount:A=>QA.createNode(null,"/",16895,0),createNode(A,I,g,B){if(oA.isBlkdev(g)||oA.isFIFO(g))throw new oA.ErrnoError(63);QA.ops_table||={dir:{node:{getattr:QA.node_ops.getattr,setattr:QA.node_ops.setattr,lookup:QA.node_ops.lookup,mknod:QA.node_ops.mknod,rename:QA.node_ops.rename,unlink:QA.node_ops.unlink,rmdir:QA.node_ops.rmdir,readdir:QA.node_ops.readdir,symlink:QA.node_ops.symlink},stream:{llseek:QA.stream_ops.llseek}},file:{node:{getattr:QA.node_ops.getattr,setattr:QA.node_ops.setattr},stream:{llseek:QA.stream_ops.llseek,read:QA.stream_ops.read,write:QA.stream_ops.write,allocate:QA.stream_ops.allocate,mmap:QA.stream_ops.mmap,msync:QA.stream_ops.msync}},link:{node:{getattr:QA.node_ops.getattr,setattr:QA.node_ops.setattr,readlink:QA.node_ops.readlink},stream:{}},chrdev:{node:{getattr:QA.node_ops.getattr,setattr:QA.node_ops.setattr},stream:oA.chrdev_stream_ops}};var C=oA.createNode(A,I,g,B);return oA.isDir(C.mode)?(C.node_ops=QA.ops_table.dir.node,C.stream_ops=QA.ops_table.dir.stream,C.contents={}):oA.isFile(C.mode)?(C.node_ops=QA.ops_table.file.node,C.stream_ops=QA.ops_table.file.stream,C.usedBytes=0,C.contents=null):oA.isLink(C.mode)?(C.node_ops=QA.ops_table.link.node,C.stream_ops=QA.ops_table.link.stream):oA.isChrdev(C.mode)&&(C.node_ops=QA.ops_table.chrdev.node,C.stream_ops=QA.ops_table.chrdev.stream),C.timestamp=Date.now(),A&&(A.contents[I]=C,A.timestamp=C.timestamp),C},getFileDataAsTypedArray:A=>A.contents?A.contents.subarray?A.contents.subarray(0,A.usedBytes):new Uint8Array(A.contents):new Uint8Array(0),expandFileStorage(A,I){var g=A.contents?A.contents.length:0;if(!(g>=I)){I=Math.max(I,g*(g<1048576?2:1.125)>>>0),0!=g&&(I=Math.max(I,256));var B=A.contents;A.contents=new Uint8Array(I),A.usedBytes>0&&A.contents.set(B.subarray(0,A.usedBytes),0)}},resizeFileStorage(A,I){if(A.usedBytes!=I)if(0==I)A.contents=null,A.usedBytes=0;else{var g=A.contents;A.contents=new Uint8Array(I),g&&A.contents.set(g.subarray(0,Math.min(I,A.usedBytes))),A.usedBytes=I}},node_ops:{getattr(A){var I={};return I.dev=oA.isChrdev(A.mode)?A.id:1,I.ino=A.id,I.mode=A.mode,I.nlink=1,I.uid=0,I.gid=0,I.rdev=A.rdev,oA.isDir(A.mode)?I.size=4096:oA.isFile(A.mode)?I.size=A.usedBytes:oA.isLink(A.mode)?I.size=A.link.length:I.size=0,I.atime=new Date(A.timestamp),I.mtime=new Date(A.timestamp),I.ctime=new Date(A.timestamp),I.blksize=4096,I.blocks=Math.ceil(I.size/I.blksize),I},setattr(A,I){void 0!==I.mode&&(A.mode=I.mode),void 0!==I.timestamp&&(A.timestamp=I.timestamp),void 0!==I.size&&QA.resizeFileStorage(A,I.size)},lookup(A,I){throw oA.genericErrors[44]},mknod:(A,I,g,B)=>QA.createNode(A,I,g,B),rename(A,I,g){if(oA.isDir(A.mode)){var B;try{B=oA.lookupNode(I,g)}catch(A){}if(B)for(var C in B.contents)throw new oA.ErrnoError(55)}delete A.parent.contents[A.name],A.parent.timestamp=Date.now(),A.name=g,I.contents[g]=A,I.timestamp=A.parent.timestamp},unlink(A,I){delete A.contents[I],A.timestamp=Date.now()},rmdir(A,I){var g=oA.lookupNode(A,I);for(var B in g.contents)throw new oA.ErrnoError(55);delete A.contents[I],A.timestamp=Date.now()},readdir(A){var I=[".",".."];for(var g of Object.keys(A.contents))I.push(g);return I},symlink(A,I,g){var B=QA.createNode(A,I,41471,0);return B.link=g,B},readlink(A){if(!oA.isLink(A.mode))throw new oA.ErrnoError(28);return A.link}},stream_ops:{read(A,I,g,B,C){var Q=A.node.contents;if(C>=A.node.usedBytes)return 0;var E=Math.min(A.node.usedBytes-C,B);if(E>8&&Q.subarray)I.set(Q.subarray(C,C+E),g);else for(var i=0;i<E;i++)I[g+i]=Q[C+i];return E},write(A,I,g,B,C,Q){if(I.buffer===G.buffer&&(Q=!1),!B)return 0;var E=A.node;if(E.timestamp=Date.now(),I.subarray&&(!E.contents||E.contents.subarray)){if(Q)return E.contents=I.subarray(g,g+B),E.usedBytes=B,B;if(0===E.usedBytes&&0===C)return E.contents=I.slice(g,g+B),E.usedBytes=B,B;if(C+B<=E.usedBytes)return E.contents.set(I.subarray(g,g+B),C),B}if(QA.expandFileStorage(E,C+B),E.contents.subarray&&I.subarray)E.contents.set(I.subarray(g,g+B),C);else for(var i=0;i<B;i++)E.contents[C+i]=I[g+i];return E.usedBytes=Math.max(E.usedBytes,C+B),B},llseek(A,I,g){var B=I;if(1===g?B+=A.position:2===g&&oA.isFile(A.node.mode)&&(B+=A.node.usedBytes),B<0)throw new oA.ErrnoError(28);return B},allocate(A,I,g){QA.expandFileStorage(A.node,I+g),A.node.usedBytes=Math.max(A.node.usedBytes,I+g)},mmap(A,I,g,B,C){if(!oA.isFile(A.node.mode))throw new oA.ErrnoError(43);var Q,E,i=A.node.contents;if(2&C||!i||i.buffer!==G.buffer){if(E=!0,!(Q=CA()))throw new oA.ErrnoError(48);i&&((g>0||g+I<i.length)&&(i=i.subarray?i.subarray(g,g+I):Array.prototype.slice.call(i,g,g+I)),G.set(i,Q))}else E=!1,Q=i.byteOffset;return{ptr:Q,allocated:E}},msync:(A,I,g,B,C)=>(QA.stream_ops.write(A,I,0,B,g,!1),0)}},EA=C.preloadPlugins||[],iA=(A,I)=>{var g=0;return A&&(g|=365),I&&(g|=146),g},oA={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{constructor(A){this.name="ErrnoError",this.errno=A}},genericErrors:{},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(A){this.node=A}get isRead(){return 1!=(2097155&this.flags)}get isWrite(){return!!(2097155&this.flags)}get isAppend(){return 1024&this.flags}get flags(){return this.shared.flags}set flags(A){this.shared.flags=A}get position(){return this.shared.position}set position(A){this.shared.position=A}},FSNode:class{constructor(A,I,g,B){A||(A=this),this.parent=A,this.mount=A.mount,this.mounted=null,this.id=oA.nextInode++,this.name=I,this.mode=g,this.node_ops={},this.stream_ops={},this.rdev=B,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(A){A?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(A){A?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return oA.isDir(this.mode)}get isDevice(){return oA.isChrdev(this.mode)}},lookupPath(A,I={}){if(!(A=z.resolve(A)))return{path:"",node:null};if((I=Object.assign({follow_mount:!0,recurse_count:0},I)).recurse_count>8)throw new oA.ErrnoError(32);for(var g=A.split("/").filter((A=>!!A)),B=oA.root,C="/",Q=0;Q<g.length;Q++){var E=Q===g.length-1;if(E&&I.parent)break;if(B=oA.lookupNode(B,g[Q]),C=P.join2(C,g[Q]),oA.isMountpoint(B)&&(!E||E&&I.follow_mount)&&(B=B.mounted.root),!E||I.follow)for(var i=0;oA.isLink(B.mode);){var o=oA.readlink(C);if(C=z.resolve(P.dirname(C),o),B=oA.lookupPath(C,{recurse_count:I.recurse_count+1}).node,i++>40)throw new oA.ErrnoError(32)}}return{path:C,node:B}},getPath(A){for(var I;;){if(oA.isRoot(A)){var g=A.mount.mountpoint;return I?"/"!==g[g.length-1]?`${g}/${I}`:g+I:g}I=I?`${A.name}/${I}`:A.name,A=A.parent}},hashName(A,I){for(var g=0,B=0;B<I.length;B++)g=(g<<5)-g+I.charCodeAt(B)|0;return(A+g>>>0)%oA.nameTable.length},hashAddNode(A){var I=oA.hashName(A.parent.id,A.name);A.name_next=oA.nameTable[I],oA.nameTable[I]=A},hashRemoveNode(A){var I=oA.hashName(A.parent.id,A.name);if(oA.nameTable[I]===A)oA.nameTable[I]=A.name_next;else for(var g=oA.nameTable[I];g;){if(g.name_next===A){g.name_next=A.name_next;break}g=g.name_next}},lookupNode(A,I){var g=oA.mayLookup(A);if(g)throw new oA.ErrnoError(g);for(var B=oA.hashName(A.id,I),C=oA.nameTable[B];C;C=C.name_next){var Q=C.name;if(C.parent.id===A.id&&Q===I)return C}return oA.lookup(A,I)},createNode(A,I,g,B){var C=new oA.FSNode(A,I,g,B);return oA.hashAddNode(C),C},destroyNode(A){oA.hashRemoveNode(A)},isRoot:A=>A===A.parent,isMountpoint:A=>!!A.mounted,isFile:A=>32768==(61440&A),isDir:A=>16384==(61440&A),isLink:A=>40960==(61440&A),isChrdev:A=>8192==(61440&A),isBlkdev:A=>24576==(61440&A),isFIFO:A=>4096==(61440&A),isSocket:A=>!(49152&~A),flagsToPermissionString(A){var I=["r","w","rw"][3&A];return 512&A&&(I+="w"),I},nodePermissions:(A,I)=>oA.ignorePermissions||(!I.includes("r")||292&A.mode)&&(!I.includes("w")||146&A.mode)&&(!I.includes("x")||73&A.mode)?0:2,mayLookup:A=>oA.isDir(A.mode)?oA.nodePermissions(A,"x")||(A.node_ops.lookup?0:2):54,mayCreate(A,I){try{return oA.lookupNode(A,I),20}catch(A){}return oA.nodePermissions(A,"wx")},mayDelete(A,I,g){var B;try{B=oA.lookupNode(A,I)}catch(A){return A.errno}var C=oA.nodePermissions(A,"wx");if(C)return C;if(g){if(!oA.isDir(B.mode))return 54;if(oA.isRoot(B)||oA.getPath(B)===oA.cwd())return 10}else if(oA.isDir(B.mode))return 31;return 0},mayOpen:(A,I)=>A?oA.isLink(A.mode)?32:oA.isDir(A.mode)&&("r"!==oA.flagsToPermissionString(I)||512&I)?31:oA.nodePermissions(A,oA.flagsToPermissionString(I)):44,MAX_OPEN_FDS:4096,nextfd(){for(var A=0;A<=oA.MAX_OPEN_FDS;A++)if(!oA.streams[A])return A;throw new oA.ErrnoError(33)},getStreamChecked(A){var I=oA.getStream(A);if(!I)throw new oA.ErrnoError(8);return I},getStream:A=>oA.streams[A],createStream:(A,I=-1)=>(A=Object.assign(new oA.FSStream,A),-1==I&&(I=oA.nextfd()),A.fd=I,oA.streams[I]=A,A),closeStream(A){oA.streams[A]=null},dupStream(A,I=-1){var g=oA.createStream(A,I);return g.stream_ops?.dup?.(g),g},chrdev_stream_ops:{open(A){var I=oA.getDevice(A.node.rdev);A.stream_ops=I.stream_ops,A.stream_ops.open?.(A)},llseek(){throw new oA.ErrnoError(70)}},major:A=>A>>8,minor:A=>255&A,makedev:(A,I)=>A<<8|I,registerDevice(A,I){oA.devices[A]={stream_ops:I}},getDevice:A=>oA.devices[A],getMounts(A){for(var I=[],g=[A];g.length;){var B=g.pop();I.push(B),g.push(...B.mounts)}return I},syncfs(A,I){"function"==typeof A&&(I=A,A=!1),oA.syncFSRequests++,oA.syncFSRequests>1&&a(`warning: ${oA.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var g=oA.getMounts(oA.root.mount),B=0;function C(A){return oA.syncFSRequests--,I(A)}function Q(A){if(A)return Q.errored?void 0:(Q.errored=!0,C(A));++B>=g.length&&C(null)}g.forEach((I=>{if(!I.type.syncfs)return Q(null);I.type.syncfs(I,A,Q)}))},mount(A,I,g){var B,C="/"===g,Q=!g;if(C&&oA.root)throw new oA.ErrnoError(10);if(!C&&!Q){var E=oA.lookupPath(g,{follow_mount:!1});if(g=E.path,B=E.node,oA.isMountpoint(B))throw new oA.ErrnoError(10);if(!oA.isDir(B.mode))throw new oA.ErrnoError(54)}var i={type:A,opts:I,mountpoint:g,mounts:[]},o=A.mount(i);return o.mount=i,i.root=o,C?oA.root=o:B&&(B.mounted=i,B.mount&&B.mount.mounts.push(i)),o},unmount(A){var I=oA.lookupPath(A,{follow_mount:!1});if(!oA.isMountpoint(I.node))throw new oA.ErrnoError(28);var g=I.node,B=g.mounted,C=oA.getMounts(B);Object.keys(oA.nameTable).forEach((A=>{for(var I=oA.nameTable[A];I;){var g=I.name_next;C.includes(I.mount)&&oA.destroyNode(I),I=g}})),g.mounted=null;var Q=g.mount.mounts.indexOf(B);g.mount.mounts.splice(Q,1)},lookup:(A,I)=>A.node_ops.lookup(A,I),mknod(A,I,g){var B=oA.lookupPath(A,{parent:!0}).node,C=P.basename(A);if(!C||"."===C||".."===C)throw new oA.ErrnoError(28);var Q=oA.mayCreate(B,C);if(Q)throw new oA.ErrnoError(Q);if(!B.node_ops.mknod)throw new oA.ErrnoError(63);return B.node_ops.mknod(B,C,I,g)},create:(A,I)=>(I=void 0!==I?I:438,I&=4095,I|=32768,oA.mknod(A,I,0)),mkdir:(A,I)=>(I=void 0!==I?I:511,I&=1023,I|=16384,oA.mknod(A,I,0)),mkdirTree(A,I){for(var g=A.split("/"),B="",C=0;C<g.length;++C)if(g[C]){B+="/"+g[C];try{oA.mkdir(B,I)}catch(A){if(20!=A.errno)throw A}}},mkdev:(A,I,g)=>(void 0===g&&(g=I,I=438),I|=8192,oA.mknod(A,I,g)),symlink(A,I){if(!z.resolve(A))throw new oA.ErrnoError(44);var g=oA.lookupPath(I,{parent:!0}).node;if(!g)throw new oA.ErrnoError(44);var B=P.basename(I),C=oA.mayCreate(g,B);if(C)throw new oA.ErrnoError(C);if(!g.node_ops.symlink)throw new oA.ErrnoError(63);return g.node_ops.symlink(g,B,A)},rename(A,I){var g,B,C=P.dirname(A),Q=P.dirname(I),E=P.basename(A),i=P.basename(I);if(g=oA.lookupPath(A,{parent:!0}).node,B=oA.lookupPath(I,{parent:!0}).node,!g||!B)throw new oA.ErrnoError(44);if(g.mount!==B.mount)throw new oA.ErrnoError(75);var o,D=oA.lookupNode(g,E),a=z.relative(A,Q);if("."!==a.charAt(0))throw new oA.ErrnoError(28);if("."!==(a=z.relative(I,C)).charAt(0))throw new oA.ErrnoError(55);try{o=oA.lookupNode(B,i)}catch(A){}if(D!==o){var w=oA.isDir(D.mode),s=oA.mayDelete(g,E,w);if(s)throw new oA.ErrnoError(s);if(s=o?oA.mayDelete(B,i,w):oA.mayCreate(B,i))throw new oA.ErrnoError(s);if(!g.node_ops.rename)throw new oA.ErrnoError(63);if(oA.isMountpoint(D)||o&&oA.isMountpoint(o))throw new oA.ErrnoError(10);if(B!==g&&(s=oA.nodePermissions(g,"w")))throw new oA.ErrnoError(s);oA.hashRemoveNode(D);try{g.node_ops.rename(D,B,i),D.parent=B}catch(A){throw A}finally{oA.hashAddNode(D)}}},rmdir(A){var I=oA.lookupPath(A,{parent:!0}).node,g=P.basename(A),B=oA.lookupNode(I,g),C=oA.mayDelete(I,g,!0);if(C)throw new oA.ErrnoError(C);if(!I.node_ops.rmdir)throw new oA.ErrnoError(63);if(oA.isMountpoint(B))throw new oA.ErrnoError(10);I.node_ops.rmdir(I,g),oA.destroyNode(B)},readdir(A){var I=oA.lookupPath(A,{follow:!0}).node;if(!I.node_ops.readdir)throw new oA.ErrnoError(54);return I.node_ops.readdir(I)},unlink(A){var I=oA.lookupPath(A,{parent:!0}).node;if(!I)throw new oA.ErrnoError(44);var g=P.basename(A),B=oA.lookupNode(I,g),C=oA.mayDelete(I,g,!1);if(C)throw new oA.ErrnoError(C);if(!I.node_ops.unlink)throw new oA.ErrnoError(63);if(oA.isMountpoint(B))throw new oA.ErrnoError(10);I.node_ops.unlink(I,g),oA.destroyNode(B)},readlink(A){var I=oA.lookupPath(A).node;if(!I)throw new oA.ErrnoError(44);if(!I.node_ops.readlink)throw new oA.ErrnoError(28);return z.resolve(oA.getPath(I.parent),I.node_ops.readlink(I))},stat(A,I){var g=oA.lookupPath(A,{follow:!I}).node;if(!g)throw new oA.ErrnoError(44);if(!g.node_ops.getattr)throw new oA.ErrnoError(63);return g.node_ops.getattr(g)},lstat:A=>oA.stat(A,!0),chmod(A,I,g){var B;if(!(B="string"==typeof A?oA.lookupPath(A,{follow:!g}).node:A).node_ops.setattr)throw new oA.ErrnoError(63);B.node_ops.setattr(B,{mode:4095&I|-4096&B.mode,timestamp:Date.now()})},lchmod(A,I){oA.chmod(A,I,!0)},fchmod(A,I){var g=oA.getStreamChecked(A);oA.chmod(g.node,I)},chown(A,I,g,B){var C;if(!(C="string"==typeof A?oA.lookupPath(A,{follow:!B}).node:A).node_ops.setattr)throw new oA.ErrnoError(63);C.node_ops.setattr(C,{timestamp:Date.now()})},lchown(A,I,g){oA.chown(A,I,g,!0)},fchown(A,I,g){var B=oA.getStreamChecked(A);oA.chown(B.node,I,g)},truncate(A,I){if(I<0)throw new oA.ErrnoError(28);var g;if(!(g="string"==typeof A?oA.lookupPath(A,{follow:!0}).node:A).node_ops.setattr)throw new oA.ErrnoError(63);if(oA.isDir(g.mode))throw new oA.ErrnoError(31);if(!oA.isFile(g.mode))throw new oA.ErrnoError(28);var B=oA.nodePermissions(g,"w");if(B)throw new oA.ErrnoError(B);g.node_ops.setattr(g,{size:I,timestamp:Date.now()})},ftruncate(A,I){var g=oA.getStreamChecked(A);if(!(2097155&g.flags))throw new oA.ErrnoError(28);oA.truncate(g.node,I)},utime(A,I,g){var B=oA.lookupPath(A,{follow:!0}).node;B.node_ops.setattr(B,{timestamp:Math.max(I,g)})},open(A,I,g){if(""===A)throw new oA.ErrnoError(44);var B;if(g=64&(I="string"==typeof I?(A=>{var I={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[A];if(void 0===I)throw new Error(`Unknown file open mode: ${A}`);return I})(I):I)?4095&(g=void 0===g?438:g)|32768:0,"object"==typeof A)B=A;else{A=P.normalize(A);try{B=oA.lookupPath(A,{follow:!(131072&I)}).node}catch(A){}}var Q=!1;if(64&I)if(B){if(128&I)throw new oA.ErrnoError(20)}else B=oA.mknod(A,g,0),Q=!0;if(!B)throw new oA.ErrnoError(44);if(oA.isChrdev(B.mode)&&(I&=-513),65536&I&&!oA.isDir(B.mode))throw new oA.ErrnoError(54);if(!Q){var E=oA.mayOpen(B,I);if(E)throw new oA.ErrnoError(E)}512&I&&!Q&&oA.truncate(B,0),I&=-131713;var i=oA.createStream({node:B,path:oA.getPath(B),flags:I,seekable:!0,position:0,stream_ops:B.stream_ops,ungotten:[],error:!1});return i.stream_ops.open&&i.stream_ops.open(i),!C.logReadFiles||1&I||A in oA.readFiles||(oA.readFiles[A]=1),i},close(A){if(oA.isClosed(A))throw new oA.ErrnoError(8);A.getdents&&(A.getdents=null);try{A.stream_ops.close&&A.stream_ops.close(A)}catch(A){throw A}finally{oA.closeStream(A.fd)}A.fd=null},isClosed:A=>null===A.fd,llseek(A,I,g){if(oA.isClosed(A))throw new oA.ErrnoError(8);if(!A.seekable||!A.stream_ops.llseek)throw new oA.ErrnoError(70);if(0!=g&&1!=g&&2!=g)throw new oA.ErrnoError(28);return A.position=A.stream_ops.llseek(A,I,g),A.ungotten=[],A.position},read(A,I,g,B,C){if(B<0||C<0)throw new oA.ErrnoError(28);if(oA.isClosed(A))throw new oA.ErrnoError(8);if(1==(2097155&A.flags))throw new oA.ErrnoError(8);if(oA.isDir(A.node.mode))throw new oA.ErrnoError(31);if(!A.stream_ops.read)throw new oA.ErrnoError(28);var Q=void 0!==C;if(Q){if(!A.seekable)throw new oA.ErrnoError(70)}else C=A.position;var E=A.stream_ops.read(A,I,g,B,C);return Q||(A.position+=E),E},write(A,I,g,B,C,Q){if(B<0||C<0)throw new oA.ErrnoError(28);if(oA.isClosed(A))throw new oA.ErrnoError(8);if(!(2097155&A.flags))throw new oA.ErrnoError(8);if(oA.isDir(A.node.mode))throw new oA.ErrnoError(31);if(!A.stream_ops.write)throw new oA.ErrnoError(28);A.seekable&&1024&A.flags&&oA.llseek(A,0,2);var E=void 0!==C;if(E){if(!A.seekable)throw new oA.ErrnoError(70)}else C=A.position;var i=A.stream_ops.write(A,I,g,B,C,Q);return E||(A.position+=i),i},allocate(A,I,g){if(oA.isClosed(A))throw new oA.ErrnoError(8);if(I<0||g<=0)throw new oA.ErrnoError(28);if(!(2097155&A.flags))throw new oA.ErrnoError(8);if(!oA.isFile(A.node.mode)&&!oA.isDir(A.node.mode))throw new oA.ErrnoError(43);if(!A.stream_ops.allocate)throw new oA.ErrnoError(138);A.stream_ops.allocate(A,I,g)},mmap(A,I,g,B,C){if(2&B&&!(2&C)&&2!=(2097155&A.flags))throw new oA.ErrnoError(2);if(1==(2097155&A.flags))throw new oA.ErrnoError(2);if(!A.stream_ops.mmap)throw new oA.ErrnoError(43);if(!I)throw new oA.ErrnoError(28);return A.stream_ops.mmap(A,I,g,B,C)},msync:(A,I,g,B,C)=>A.stream_ops.msync?A.stream_ops.msync(A,I,g,B,C):0,ioctl(A,I,g){if(!A.stream_ops.ioctl)throw new oA.ErrnoError(59);return A.stream_ops.ioctl(A,I,g)},readFile(A,I={}){if(I.flags=I.flags||0,I.encoding=I.encoding||"binary","utf8"!==I.encoding&&"binary"!==I.encoding)throw new Error(`Invalid encoding type "${I.encoding}"`);var g,B=oA.open(A,I.flags),C=oA.stat(A).size,Q=new Uint8Array(C);return oA.read(B,Q,0,C,0),"utf8"===I.encoding?g=$(Q):"binary"===I.encoding&&(g=Q),oA.close(B),g},writeFile(A,I,g={}){g.flags=g.flags||577;var B=oA.open(A,g.flags,g.mode);if("string"==typeof I){var C=new Uint8Array(IA(I)+1),Q=gA(I,C,0,C.length);oA.write(B,C,0,Q,void 0,g.canOwn)}else{if(!ArrayBuffer.isView(I))throw new Error("Unsupported data type");oA.write(B,I,0,I.byteLength,void 0,g.canOwn)}oA.close(B)},cwd:()=>oA.currentPath,chdir(A){var I=oA.lookupPath(A,{follow:!0});if(null===I.node)throw new oA.ErrnoError(44);if(!oA.isDir(I.node.mode))throw new oA.ErrnoError(54);var g=oA.nodePermissions(I.node,"x");if(g)throw new oA.ErrnoError(g);oA.currentPath=I.path},createDefaultDirectories(){oA.mkdir("/tmp"),oA.mkdir("/home"),oA.mkdir("/home/web_user")},createDefaultDevices(){oA.mkdir("/dev"),oA.registerDevice(oA.makedev(1,3),{read:()=>0,write:(A,I,g,B,C)=>B}),oA.mkdev("/dev/null",oA.makedev(1,3)),BA.register(oA.makedev(5,0),BA.default_tty_ops),BA.register(oA.makedev(6,0),BA.default_tty1_ops),oA.mkdev("/dev/tty",oA.makedev(5,0)),oA.mkdev("/dev/tty1",oA.makedev(6,0));var A=new Uint8Array(1024),I=0,g=()=>(0===I&&(I=v(A).byteLength),A[--I]);oA.createDevice("/dev","random",g),oA.createDevice("/dev","urandom",g),oA.mkdir("/dev/shm"),oA.mkdir("/dev/shm/tmp")},createSpecialDirectories(){oA.mkdir("/proc");var A=oA.mkdir("/proc/self");oA.mkdir("/proc/self/fd"),oA.mount({mount(){var I=oA.createNode(A,"fd",16895,73);return I.node_ops={lookup(A,I){var g=+I,B=oA.getStreamChecked(g),C={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>B.path}};return C.parent=C,C}},I}},{},"/proc/self/fd")},createStandardStreams(A,I,g){A?oA.createDevice("/dev","stdin",A):oA.symlink("/dev/tty","/dev/stdin"),I?oA.createDevice("/dev","stdout",null,I):oA.symlink("/dev/tty","/dev/stdout"),g?oA.createDevice("/dev","stderr",null,g):oA.symlink("/dev/tty1","/dev/stderr"),oA.open("/dev/stdin",0),oA.open("/dev/stdout",1),oA.open("/dev/stderr",1)},staticInit(){[44].forEach((A=>{oA.genericErrors[A]=new oA.ErrnoError(A),oA.genericErrors[A].stack="<generic error, no stack>"})),oA.nameTable=new Array(4096),oA.mount(QA,{},"/"),oA.createDefaultDirectories(),oA.createDefaultDevices(),oA.createSpecialDirectories(),oA.filesystems={MEMFS:QA}},init(A,I,g){oA.initialized=!0,A??=C.stdin,I??=C.stdout,g??=C.stderr,oA.createStandardStreams(A,I,g)},quit(){oA.initialized=!1;for(var A=0;A<oA.streams.length;A++){var I=oA.streams[A];I&&oA.close(I)}},findObject(A,I){var g=oA.analyzePath(A,I);return g.exists?g.object:null},analyzePath(A,I){try{A=(B=oA.lookupPath(A,{follow:!I})).path}catch(A){}var g={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var B=oA.lookupPath(A,{parent:!0});g.parentExists=!0,g.parentPath=B.path,g.parentObject=B.node,g.name=P.basename(A),B=oA.lookupPath(A,{follow:!I}),g.exists=!0,g.path=B.path,g.object=B.node,g.name=B.node.name,g.isRoot="/"===B.path}catch(A){g.error=A.errno}return g},createPath(A,I,g,B){A="string"==typeof A?A:oA.getPath(A);for(var C=I.split("/").reverse();C.length;){var Q=C.pop();if(Q){var E=P.join2(A,Q);try{oA.mkdir(E)}catch(A){}A=E}}return E},createFile(A,I,g,B,C){var Q=P.join2("string"==typeof A?A:oA.getPath(A),I),E=iA(B,C);return oA.create(Q,E)},createDataFile(A,I,g,B,C,Q){var E=I;A&&(A="string"==typeof A?A:oA.getPath(A),E=I?P.join2(A,I):A);var i=iA(B,C),o=oA.create(E,i);if(g){if("string"==typeof g){for(var D=new Array(g.length),a=0,w=g.length;a<w;++a)D[a]=g.charCodeAt(a);g=D}oA.chmod(o,146|i);var s=oA.open(o,577);oA.write(s,g,0,g.length,0,Q),oA.close(s),oA.chmod(o,i)}},createDevice(A,I,g,B){var C=P.join2("string"==typeof A?A:oA.getPath(A),I),Q=iA(!!g,!!B);oA.createDevice.major??=64;var E=oA.makedev(oA.createDevice.major++,0);return oA.registerDevice(E,{open(A){A.seekable=!1},close(A){B?.buffer?.length&&B(10)},read(A,I,B,C,Q){for(var E=0,i=0;i<C;i++){var o;try{o=g()}catch(A){throw new oA.ErrnoError(29)}if(void 0===o&&0===E)throw new oA.ErrnoError(6);if(null==o)break;E++,I[B+i]=o}return E&&(A.node.timestamp=Date.now()),E},write(A,I,g,C,Q){for(var E=0;E<C;E++)try{B(I[g+E])}catch(A){throw new oA.ErrnoError(29)}return C&&(A.node.timestamp=Date.now()),E}}),oA.mkdev(C,Q,E)},forceLoadFile(A){if(A.isDevice||A.isFolder||A.link||A.contents)return!0;if("undefined"!=typeof XMLHttpRequest)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.");try{A.contents=(void 0)(A.url),A.usedBytes=A.contents.length}catch(A){throw new oA.ErrnoError(29)}},createLazyFile(A,I,g,B,C){if("undefined"!=typeof XMLHttpRequest)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var Q={isDevice:!1,url:g},E=oA.createFile(A,I,Q,B,C);Q.contents?E.contents=Q.contents:Q.url&&(E.contents=null,E.url=Q.url),Object.defineProperties(E,{usedBytes:{get:function(){return this.contents.length}}});var i={};function o(A,I,g,B,C){var Q=A.node.contents;if(C>=Q.length)return 0;var E=Math.min(Q.length-C,B);if(Q.slice)for(var i=0;i<E;i++)I[g+i]=Q[C+i];else for(i=0;i<E;i++)I[g+i]=Q.get(C+i);return E}return Object.keys(E.stream_ops).forEach((A=>{var I=E.stream_ops[A];i[A]=(...A)=>(oA.forceLoadFile(E),I(...A))})),i.read=(A,I,g,B,C)=>(oA.forceLoadFile(E),o(A,I,g,B,C)),i.mmap=(A,I,g,B,C)=>{oA.forceLoadFile(E);var Q=CA();if(!Q)throw new oA.ErrnoError(48);return o(A,G,Q,I,g),{ptr:Q,allocated:!0}},E.stream_ops=i,E}},DA=(A,I)=>A?$(t,A,I):"",aA={DEFAULT_POLLMASK:5,calculateAt(A,I,g){if(P.isAbs(I))return I;var B;if(B=-100===A?oA.cwd():aA.getStreamFromFD(A).path,0==I.length){if(!g)throw new oA.ErrnoError(44);return B}return P.join2(B,I)},doStat(A,I,g){var B=A(I);R[g>>2]=B.dev,R[g+4>>2]=B.mode,r[g+8>>2]=B.nlink,R[g+12>>2]=B.uid,R[g+16>>2]=B.gid,R[g+20>>2]=B.rdev,b=[B.size>>>0,(p=B.size,+Math.abs(p)>=1?p>0?+Math.floor(p/4294967296)>>>0:~~+Math.ceil((p-+(~~p>>>0))/4294967296)>>>0:0)],R[g+24>>2]=b[0],R[g+28>>2]=b[1],R[g+32>>2]=4096,R[g+36>>2]=B.blocks;var C=B.atime.getTime(),Q=B.mtime.getTime(),E=B.ctime.getTime();return b=[Math.floor(C/1e3)>>>0,(p=Math.floor(C/1e3),+Math.abs(p)>=1?p>0?+Math.floor(p/4294967296)>>>0:~~+Math.ceil((p-+(~~p>>>0))/4294967296)>>>0:0)],R[g+40>>2]=b[0],R[g+44>>2]=b[1],r[g+48>>2]=C%1e3*1e3*1e