UNPKG

@thorvg/lottie-player

Version:

A web lottie player using ThorVG as a renderer

1 lines 126 kB
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self)["lottie-player"]={})}(this,(function(e){"use strict";var r="undefined"!=typeof document?document.currentScript:null;const t=globalThis,n=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),a=new WeakMap;let i=class{constructor(e,r,t){if(this._$cssResult$=!0,t!==o)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=r}get styleSheet(){let e=this.o;const r=this.t;if(n&&void 0===e){const t=void 0!==r&&1===r.length;t&&(e=a.get(r)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&a.set(r,e))}return e}toString(){return this.cssText}};const s=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let r="";for(const t of e.cssRules)r+=t.cssText;return(e=>new i("string"==typeof e?e:e+"",void 0,o))(r)})(e):e,{is:u,defineProperty:l,getOwnPropertyDescriptor:c,getOwnPropertyNames:d,getOwnPropertySymbols:f,getPrototypeOf:m}=Object,p=globalThis,h=p.trustedTypes,g=h?h.emptyScript:"",v=p.reactiveElementPolyfillSupport,y=(e,r)=>e,b={toAttribute(e,r){switch(r){case Boolean:e=e?g:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,r){let t=e;switch(r){case Boolean:t=null!==e;break;case Number:t=null===e?null:Number(e);break;case Object:case Array:try{t=JSON.parse(e)}catch(e){t=null}}return t}},w=(e,r)=>!u(e,r),_={attribute:!0,type:String,converter:b,reflect:!1,hasChanged:w};Symbol.metadata??=Symbol("metadata"),p.litPropertyMetadata??=new WeakMap;class x extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,r=_){if(r.state&&(r.attribute=!1),this._$Ei(),this.elementProperties.set(e,r),!r.noAccessor){const t=Symbol(),n=this.getPropertyDescriptor(e,t,r);void 0!==n&&l(this.prototype,e,n)}}static getPropertyDescriptor(e,r,t){const{get:n,set:o}=c(this.prototype,e)??{get(){return this[r]},set(e){this[r]=e}};return{get(){return n?.call(this)},set(r){const a=n?.call(this);o.call(this,r),this.requestUpdate(e,a,t)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??_}static _$Ei(){if(this.hasOwnProperty(y("elementProperties")))return;const e=m(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(y("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(y("properties"))){const e=this.properties,r=[...d(e),...f(e)];for(const t of r)this.createProperty(t,e[t])}const e=this[Symbol.metadata];if(null!==e){const r=litPropertyMetadata.get(e);if(void 0!==r)for(const[e,t]of r)this.elementProperties.set(e,t)}this._$Eh=new Map;for(const[e,r]of this.elementProperties){const t=this._$Eu(e,r);void 0!==t&&this._$Eh.set(t,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const r=[];if(Array.isArray(e)){const t=new Set(e.flat(1/0).reverse());for(const e of t)r.unshift(s(e))}else void 0!==e&&r.push(s(e));return r}static _$Eu(e,r){const t=r.attribute;return!1===t?void 0:"string"==typeof t?t:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((e=>e(this)))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,r=this.constructor.elementProperties;for(const t of r.keys())this.hasOwnProperty(t)&&(e.set(t,this[t]),delete this[t]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,r)=>{if(n)e.adoptedStyleSheets=r.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet));else for(const n of r){const r=document.createElement("style"),o=t.litNonce;void 0!==o&&r.setAttribute("nonce",o),r.textContent=n.cssText,e.appendChild(r)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((e=>e.hostConnected?.()))}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach((e=>e.hostDisconnected?.()))}attributeChangedCallback(e,r,t){this._$AK(e,t)}_$EC(e,r){const t=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,t);if(void 0!==n&&!0===t.reflect){const o=(void 0!==t.converter?.toAttribute?t.converter:b).toAttribute(r,t.type);this._$Em=e,null==o?this.removeAttribute(n):this.setAttribute(n,o),this._$Em=null}}_$AK(e,r){const t=this.constructor,n=t._$Eh.get(e);if(void 0!==n&&this._$Em!==n){const e=t.getPropertyOptions(n),o="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:b;this._$Em=n,this[n]=o.fromAttribute(r,e.type),this._$Em=null}}requestUpdate(e,r,t){if(void 0!==e){if(t??=this.constructor.getPropertyOptions(e),!(t.hasChanged??w)(this[e],r))return;this.P(e,r,t)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(e,r,t){this._$AL.has(e)||this._$AL.set(e,r),!0===t.reflect&&this._$Em!==e&&(this._$Ej??=new Set).add(e)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,r]of this._$Ep)this[e]=r;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[r,t]of e)!0!==t.wrapped||this._$AL.has(r)||void 0===this[r]||this.P(r,this[r],t)}let e=!1;const r=this._$AL;try{e=this.shouldUpdate(r),e?(this.willUpdate(r),this._$EO?.forEach((e=>e.hostUpdate?.())),this.update(r)):this._$EU()}catch(r){throw e=!1,this._$EU(),r}e&&this._$AE(r)}willUpdate(e){}_$AE(e){this._$EO?.forEach((e=>e.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Ej&&=this._$Ej.forEach((e=>this._$EC(e,this[e]))),this._$EU()}updated(e){}firstUpdated(e){}}x.elementStyles=[],x.shadowRootOptions={mode:"open"},x[y("elementProperties")]=new Map,x[y("finalized")]=new Map,v?.({ReactiveElement:x}),(p.reactiveElementVersions??=[]).push("2.0.4");const E=globalThis,S=E.trustedTypes,P=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,A="$lit$",$=`lit$${Math.random().toFixed(9).slice(2)}$`,C="?"+$,T=`<${C}>`,k=document,B=()=>k.createComment(""),F=e=>null===e||"object"!=typeof e&&"function"!=typeof e,D=Array.isArray,L="[ \t\n\f\r]",O=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,R=/-->/g,U=/>/g,I=RegExp(`>|${L}(?:([^\\s"'>=/]+)(${L}*=${L}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),M=/'/g,V=/"/g,N=/^(?:script|style|textarea|title)$/i,z=(e,...r)=>({_$litType$:1,strings:e,values:r}),j=Symbol.for("lit-noChange"),G=Symbol.for("lit-nothing"),W=new WeakMap,H=k.createTreeWalker(k,129);function q(e,r){if(!D(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==P?P.createHTML(r):r}class X{constructor({strings:e,_$litType$:r},t){let n;this.parts=[];let o=0,a=0;const i=e.length-1,s=this.parts,[u,l]=((e,r)=>{const t=e.length-1,n=[];let o,a=2===r?"<svg>":3===r?"<math>":"",i=O;for(let r=0;r<t;r++){const t=e[r];let s,u,l=-1,c=0;for(;c<t.length&&(i.lastIndex=c,u=i.exec(t),null!==u);)c=i.lastIndex,i===O?"!--"===u[1]?i=R:void 0!==u[1]?i=U:void 0!==u[2]?(N.test(u[2])&&(o=RegExp("</"+u[2],"g")),i=I):void 0!==u[3]&&(i=I):i===I?">"===u[0]?(i=o??O,l=-1):void 0===u[1]?l=-2:(l=i.lastIndex-u[2].length,s=u[1],i=void 0===u[3]?I:'"'===u[3]?V:M):i===V||i===M?i=I:i===R||i===U?i=O:(i=I,o=void 0);const d=i===I&&e[r+1].startsWith("/>")?" ":"";a+=i===O?t+T:l>=0?(n.push(s),t.slice(0,l)+A+t.slice(l)+$+d):t+$+(-2===l?r:d)}return[q(e,a+(e[t]||"<?>")+(2===r?"</svg>":3===r?"</math>":"")),n]})(e,r);if(this.el=X.createElement(u,t),H.currentNode=this.el.content,2===r||3===r){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(n=H.nextNode())&&s.length<i;){if(1===n.nodeType){if(n.hasAttributes())for(const e of n.getAttributeNames())if(e.endsWith(A)){const r=l[a++],t=n.getAttribute(e).split($),i=/([.?@])?(.*)/.exec(r);s.push({type:1,index:o,name:i[2],strings:t,ctor:"."===i[1]?Y:"?"===i[1]?ee:"@"===i[1]?re:K}),n.removeAttribute(e)}else e.startsWith($)&&(s.push({type:6,index:o}),n.removeAttribute(e));if(N.test(n.tagName)){const e=n.textContent.split($),r=e.length-1;if(r>0){n.textContent=S?S.emptyScript:"";for(let t=0;t<r;t++)n.append(e[t],B()),H.nextNode(),s.push({type:2,index:++o});n.append(e[r],B())}}}else if(8===n.nodeType)if(n.data===C)s.push({type:2,index:o});else{let e=-1;for(;-1!==(e=n.data.indexOf($,e+1));)s.push({type:7,index:o}),e+=$.length-1}o++}}static createElement(e,r){const t=k.createElement("template");return t.innerHTML=e,t}}function Q(e,r,t=e,n){if(r===j)return r;let o=void 0!==n?t.o?.[n]:t.l;const a=F(r)?void 0:r._$litDirective$;return o?.constructor!==a&&(o?._$AO?.(!1),void 0===a?o=void 0:(o=new a(e),o._$AT(e,t,n)),void 0!==n?(t.o??=[])[n]=o:t.l=o),void 0!==o&&(r=Q(e,o._$AS(e,r.values),o,n)),r}class Z{constructor(e,r){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:r},parts:t}=this._$AD,n=(e?.creationScope??k).importNode(r,!0);H.currentNode=n;let o=H.nextNode(),a=0,i=0,s=t[0];for(;void 0!==s;){if(a===s.index){let r;2===s.type?r=new J(o,o.nextSibling,this,e):1===s.type?r=new s.ctor(o,s.name,s.strings,this,e):6===s.type&&(r=new te(o,this,e)),this._$AV.push(r),s=t[++i]}a!==s?.index&&(o=H.nextNode(),a++)}return H.currentNode=k,n}p(e){let r=0;for(const t of this._$AV)void 0!==t&&(void 0!==t.strings?(t._$AI(e,t,r),r+=t.strings.length-2):t._$AI(e[r])),r++}}class J{get _$AU(){return this._$AM?._$AU??this.v}constructor(e,r,t,n){this.type=2,this._$AH=G,this._$AN=void 0,this._$AA=e,this._$AB=r,this._$AM=t,this.options=n,this.v=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const r=this._$AM;return void 0!==r&&11===e?.nodeType&&(e=r.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,r=this){e=Q(this,e,r),F(e)?e===G||null==e||""===e?(this._$AH!==G&&this._$AR(),this._$AH=G):e!==this._$AH&&e!==j&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>D(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==G&&F(this._$AH)?this._$AA.nextSibling.data=e:this.T(k.createTextNode(e)),this._$AH=e}$(e){const{values:r,_$litType$:t}=e,n="number"==typeof t?this._$AC(e):(void 0===t.el&&(t.el=X.createElement(q(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===n)this._$AH.p(r);else{const e=new Z(n,this),t=e.u(this.options);e.p(r),this.T(t),this._$AH=e}}_$AC(e){let r=W.get(e.strings);return void 0===r&&W.set(e.strings,r=new X(e)),r}k(e){D(this._$AH)||(this._$AH=[],this._$AR());const r=this._$AH;let t,n=0;for(const o of e)n===r.length?r.push(t=new J(this.O(B()),this.O(B()),this,this.options)):t=r[n],t._$AI(o),n++;n<r.length&&(this._$AR(t&&t._$AB.nextSibling,n),r.length=n)}_$AR(e=this._$AA.nextSibling,r){for(this._$AP?.(!1,!0,r);e&&e!==this._$AB;){const r=e.nextSibling;e.remove(),e=r}}setConnected(e){void 0===this._$AM&&(this.v=e,this._$AP?.(e))}}class K{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,r,t,n,o){this.type=1,this._$AH=G,this._$AN=void 0,this.element=e,this.name=r,this._$AM=n,this.options=o,t.length>2||""!==t[0]||""!==t[1]?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=G}_$AI(e,r=this,t,n){const o=this.strings;let a=!1;if(void 0===o)e=Q(this,e,r,0),a=!F(e)||e!==this._$AH&&e!==j,a&&(this._$AH=e);else{const n=e;let i,s;for(e=o[0],i=0;i<o.length-1;i++)s=Q(this,n[t+i],r,i),s===j&&(s=this._$AH[i]),a||=!F(s)||s!==this._$AH[i],s===G?e=G:e!==G&&(e+=(s??"")+o[i+1]),this._$AH[i]=s}a&&!n&&this.j(e)}j(e){e===G?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class Y extends K{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===G?void 0:e}}class ee extends K{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==G)}}class re extends K{constructor(e,r,t,n,o){super(e,r,t,n,o),this.type=5}_$AI(e,r=this){if((e=Q(this,e,r,0)??G)===j)return;const t=this._$AH,n=e===G&&t!==G||e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive,o=e!==G&&(t===G||n);n&&this.element.removeEventListener(this.name,this,t),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class te{constructor(e,r,t){this.element=e,this.type=6,this._$AN=void 0,this._$AM=r,this.options=t}get _$AU(){return this._$AM._$AU}_$AI(e){Q(this,e)}}const ne=E.litHtmlPolyfillSupport;ne?.(X,J),(E.litHtmlVersions??=[]).push("3.2.0");class oe extends x{constructor(){super(...arguments),this.renderOptions={host:this},this.o=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this.o=((e,r,t)=>{const n=t?.renderBefore??r;let o=n._$litPart$;if(void 0===o){const e=t?.renderBefore??null;n._$litPart$=o=new J(r.insertBefore(B(),e),e,void 0,t??{})}return o._$AI(e),o})(r,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this.o?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this.o?.setConnected(!1)}render(){return j}}oe._$litElement$=!0,oe.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:oe});const ae=globalThis.litElementPolyfillSupport;ae?.({LitElement:oe}),(globalThis.litElementVersions??=[]).push("4.1.0");const ie={attribute:!0,type:String,converter:b,reflect:!1,hasChanged:w},se=(e=ie,r,t)=>{const{kind:n,metadata:o}=t;let a=globalThis.litPropertyMetadata.get(o);if(void 0===a&&globalThis.litPropertyMetadata.set(o,a=new Map),a.set(t.name,e),"accessor"===n){const{name:n}=t;return{set(t){const o=r.get.call(this);r.set.call(this,t),this.requestUpdate(n,o,e)},init(r){return void 0!==r&&this.P(n,void 0,e),r}}}if("setter"===n){const{name:n}=t;return function(t){const o=this[n];r.call(this,t),this.requestUpdate(n,o,e)}}throw Error("Unsupported decorator location: "+n)};function ue(e){return(r,t)=>"object"==typeof t?se(e,r,t):((e,r,t)=>{const n=r.hasOwnProperty(t);return r.constructor.createProperty(t,n?{...e,wrapped:!0}:e),n?Object.getOwnPropertyDescriptor(r,t):void 0})(e,r,t)}for(var le,ce=[],de=0;de<256;++de)ce.push((de+256).toString(16).slice(1));var fe=new Uint8Array(16);function me(){if(!le&&!(le="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return le(fe)}var pe={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function he(e,r,t){if(pe.randomUUID&&!r&&!e)return pe.randomUUID();var n=(e=e||{}).random||(e.rng||me)();return n[6]=15&n[6]|64,n[8]=63&n[8]|128,function(e,r=0){return(ce[e[r+0]]+ce[e[r+1]]+ce[e[r+2]]+ce[e[r+3]]+"-"+ce[e[r+4]]+ce[e[r+5]]+"-"+ce[e[r+6]]+ce[e[r+7]]+"-"+ce[e[r+8]]+ce[e[r+9]]+"-"+ce[e[r+10]]+ce[e[r+11]]+ce[e[r+12]]+ce[e[r+13]]+ce[e[r+14]]+ce[e[r+15]]).toLowerCase()}(n)}var ge,ve=(ge="undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:r&&r.src||new URL("lottie-player.js",document.baseURI).href,async function(e={}){var t,n,o=e,a=new Promise(((e,r)=>{t=e,n=r})),i="object"==typeof window,s="undefined"!=typeof WorkerGlobalScope,u="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&"renderer"!=process.type;if(u){const{createRequire:e}=await Promise.resolve().then((function(){return De}));var l=e("undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:r&&r.src||new URL("lottie-player.js",document.baseURI).href)}var c,d,f={...o},m="./this.program",p=(e,r)=>{throw r},h="";if(u){var g=l("fs"),v=l("path");("undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:r&&r.src||new URL("lottie-player.js",document.baseURI).href).startsWith("data:")||(h=v.dirname(l("url").fileURLToPath("undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:r&&r.src||new URL("lottie-player.js",document.baseURI).href))+"/"),d=e=>(e=L(e)?new URL(e):e,g.readFileSync(e)),c=async(e,r=!0)=>(e=L(e)?new URL(e):e,g.readFileSync(e,r?void 0:"utf8")),!o.thisProgram&&process.argv.length>1&&(m=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),p=(e,r)=>{throw process.exitCode=e,r}}else(i||s)&&(s?h=self.location.href:"undefined"!=typeof document&&document.currentScript&&(h=document.currentScript.src),ge&&(h=ge),h=h.startsWith("blob:")?"":h.slice(0,h.replace(/[?#].*/,"").lastIndexOf("/")+1),s&&(d=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),c=async e=>{if(L(e))return new Promise(((r,t)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?r(n.response):t(n.status)},n.onerror=t,n.send(null)}));var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)});var y=o.print||void 0,b=o.printErr||void 0;Object.assign(o,f),f=null,o.thisProgram&&(m=o.thisProgram);var w,_,x,E,S,P,A,$,C,T,k,B,F=o.wasmBinary,D=!1,L=e=>e.startsWith("file://");function O(){var e=w.buffer;o.HEAP8=x=new Int8Array(e),o.HEAP16=S=new Int16Array(e),o.HEAPU8=E=new Uint8Array(e),o.HEAPU16=P=new Uint16Array(e),o.HEAP32=A=new Int32Array(e),o.HEAPU32=$=new Uint32Array(e),o.HEAPF32=C=new Float32Array(e),o.HEAPF64=B=new Float64Array(e),o.HEAP64=T=new BigInt64Array(e),o.HEAPU64=k=new BigUint64Array(e)}var R,U=0,I=null;function M(e){U++,o.monitorRunDependencies?.(U)}function V(e){if(U--,o.monitorRunDependencies?.(U),0==U&&I){var r=I;I=null,r()}}function N(e){o.onAbort?.(e),b(e="Aborted("+e+")"),D=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw n(r),r}class z{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var j,G=e=>{for(;e.length>0;)e.shift()(o)},W=[],H=[],q=o.noExitRuntime||!0,X=e=>it(e),Q=()=>ut(),Z="undefined"!=typeof TextDecoder?new TextDecoder:void 0,J=(e,r=0,t=NaN)=>{for(var n=r+t,o=r;e[o]&&!(o>=n);)++o;if(o-r>16&&e.buffer&&Z)return Z.decode(e.subarray(r,o));for(var a="";r<o;){var i=e[r++];if(128&i){var s=63&e[r++];if(192!=(224&i)){var u=63&e[r++];if((i=224==(240&i)?(15&i)<<12|s<<6|u:(7&i)<<18|s<<12|u<<6|63&e[r++])<65536)a+=String.fromCharCode(i);else{var l=i-65536;a+=String.fromCharCode(55296|l>>10,56320|1023&l)}}else a+=String.fromCharCode((31&i)<<6|s)}else a+=String.fromCharCode(i)}return a},K=(e,r)=>e?J(E,e,r):"",Y=()=>{var e=A[+ve.varargs>>2];return ve.varargs+=4,e},ee=Y,re={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,r)=>{for(var t=0,n=e.length-1;n>=0;n--){var o=e[n];"."===o?e.splice(n,1):".."===o?(e.splice(n,1),t++):t&&(e.splice(n,1),t--)}if(r)for(;t;t--)e.unshift("..");return e},normalize:e=>{var r=re.isAbs(e),t="/"===e.slice(-1);return e=re.normalizeArray(e.split("/").filter((e=>!!e)),!r).join("/"),e||r||(e="."),e&&t&&(e+="/"),(r?"/":"")+e},dirname:e=>{var r=re.splitPath(e),t=r[0],n=r[1];return t||n?(n&&(n=n.slice(0,-1)),t+n):"."},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>re.normalize(e.join("/")),join2:(e,r)=>re.normalize(e+"/"+r)},te=e=>{(te=(()=>{if(u){var e=l("crypto");return r=>e.randomFillSync(r)}return e=>crypto.getRandomValues(e)})())(e)},ne={resolve:(...e)=>{for(var r="",t=!1,n=e.length-1;n>=-1&&!t;n--){var o=n>=0?e[n]:he.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");if(!o)return"";r=o+"/"+r,t=re.isAbs(o)}return r=re.normalizeArray(r.split("/").filter((e=>!!e)),!t).join("/"),(t?"/":"")+r||"."},relative:(e,r)=>{function t(e){for(var r=0;r<e.length&&""===e[r];r++);for(var t=e.length-1;t>=0&&""===e[t];t--);return r>t?[]:e.slice(r,t-r+1)}e=ne.resolve(e).slice(1),r=ne.resolve(r).slice(1);for(var n=t(e.split("/")),o=t(r.split("/")),a=Math.min(n.length,o.length),i=a,s=0;s<a;s++)if(n[s]!==o[s]){i=s;break}var u=[];for(s=i;s<n.length;s++)u.push("..");return(u=u.concat(o.slice(i))).join("/")}},oe=[],ae=e=>{for(var r=0,t=0;t<e.length;++t){var n=e.charCodeAt(t);n<=127?r++:n<=2047?r+=2:n>=55296&&n<=57343?(r+=4,++t):r+=3}return r},ie=(e,r,t,n)=>{if(!(n>0))return 0;for(var o=t,a=t+n-1,i=0;i<e.length;++i){var s=e.charCodeAt(i);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++i)),s<=127){if(t>=a)break;r[t++]=s}else if(s<=2047){if(t+1>=a)break;r[t++]=192|s>>6,r[t++]=128|63&s}else if(s<=65535){if(t+2>=a)break;r[t++]=224|s>>12,r[t++]=128|s>>6&63,r[t++]=128|63&s}else{if(t+3>=a)break;r[t++]=240|s>>18,r[t++]=128|s>>12&63,r[t++]=128|s>>6&63,r[t++]=128|63&s}}return r[t]=0,t-o},se=(e,r,t)=>{var n=ae(e)+1,o=new Array(n),a=ie(e,o,0,o.length);return o.length=a,o},ue={ttys:[],init(){},shutdown(){},register(e,r){ue.ttys[e]={input:[],output:[],ops:r},he.registerDevice(e,ue.stream_ops)},stream_ops:{open(e){var r=ue.ttys[e.node.rdev];if(!r)throw new he.ErrnoError(43);e.tty=r,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,r,t,n,o){if(!e.tty||!e.tty.ops.get_char)throw new he.ErrnoError(60);for(var a=0,i=0;i<n;i++){var s;try{s=e.tty.ops.get_char(e.tty)}catch(e){throw new he.ErrnoError(29)}if(void 0===s&&0===a)throw new he.ErrnoError(6);if(null==s)break;a++,r[t+i]=s}return a&&(e.node.atime=Date.now()),a},write(e,r,t,n,o){if(!e.tty||!e.tty.ops.put_char)throw new he.ErrnoError(60);try{for(var a=0;a<n;a++)e.tty.ops.put_char(e.tty,r[t+a])}catch(e){throw new he.ErrnoError(29)}return n&&(e.node.mtime=e.node.ctime=Date.now()),a}},default_tty_ops:{get_char:e=>(()=>{if(!oe.length){var e=null;if(u){var r=Buffer.alloc(256),t=0,n=process.stdin.fd;try{t=g.readSync(n,r,0,256)}catch(e){if(!e.toString().includes("EOF"))throw e;t=0}t>0&&(e=r.slice(0,t).toString("utf-8"))}else"undefined"!=typeof window&&"function"==typeof window.prompt&&null!==(e=window.prompt("Input: "))&&(e+="\n");if(!e)return null;oe=se(e)}return oe.shift()})(),put_char(e,r){null===r||10===r?(y(J(e.output)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output?.length>0&&(y(J(e.output)),e.output=[])},ioctl_tcgets:e=>({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:(e,r,t)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,r){null===r||10===r?(b(J(e.output)),e.output=[]):0!=r&&e.output.push(r)},fsync(e){e.output?.length>0&&(b(J(e.output)),e.output=[])}}},le=e=>{N()},ce={ops_table:null,mount:e=>ce.createNode(null,"/",16895,0),createNode(e,r,t,n){if(he.isBlkdev(t)||he.isFIFO(t))throw new he.ErrnoError(63);ce.ops_table||={dir:{node:{getattr:ce.node_ops.getattr,setattr:ce.node_ops.setattr,lookup:ce.node_ops.lookup,mknod:ce.node_ops.mknod,rename:ce.node_ops.rename,unlink:ce.node_ops.unlink,rmdir:ce.node_ops.rmdir,readdir:ce.node_ops.readdir,symlink:ce.node_ops.symlink},stream:{llseek:ce.stream_ops.llseek}},file:{node:{getattr:ce.node_ops.getattr,setattr:ce.node_ops.setattr},stream:{llseek:ce.stream_ops.llseek,read:ce.stream_ops.read,write:ce.stream_ops.write,mmap:ce.stream_ops.mmap,msync:ce.stream_ops.msync}},link:{node:{getattr:ce.node_ops.getattr,setattr:ce.node_ops.setattr,readlink:ce.node_ops.readlink},stream:{}},chrdev:{node:{getattr:ce.node_ops.getattr,setattr:ce.node_ops.setattr},stream:he.chrdev_stream_ops}};var o=he.createNode(e,r,t,n);return he.isDir(o.mode)?(o.node_ops=ce.ops_table.dir.node,o.stream_ops=ce.ops_table.dir.stream,o.contents={}):he.isFile(o.mode)?(o.node_ops=ce.ops_table.file.node,o.stream_ops=ce.ops_table.file.stream,o.usedBytes=0,o.contents=null):he.isLink(o.mode)?(o.node_ops=ce.ops_table.link.node,o.stream_ops=ce.ops_table.link.stream):he.isChrdev(o.mode)&&(o.node_ops=ce.ops_table.chrdev.node,o.stream_ops=ce.ops_table.chrdev.stream),o.atime=o.mtime=o.ctime=Date.now(),e&&(e.contents[r]=o,e.atime=e.mtime=e.ctime=o.atime),o},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,r){var t=e.contents?e.contents.length:0;if(!(t>=r)){r=Math.max(r,t*(t<1048576?2:1.125)>>>0),0!=t&&(r=Math.max(r,256));var n=e.contents;e.contents=new Uint8Array(r),e.usedBytes>0&&e.contents.set(n.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,r){if(e.usedBytes!=r)if(0==r)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(e){var r={};return r.dev=he.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,r.size=he.isDir(e.mode)?4096:he.isFile(e.mode)?e.usedBytes:he.isLink(e.mode)?e.link.length:0,r.atime=new Date(e.atime),r.mtime=new Date(e.mtime),r.ctime=new Date(e.ctime),r.blksize=4096,r.blocks=Math.ceil(r.size/r.blksize),r},setattr(e,r){for(const t of["mode","atime","mtime","ctime"])null!=r[t]&&(e[t]=r[t]);void 0!==r.size&&ce.resizeFileStorage(e,r.size)},lookup(e,r){throw ce.doesNotExistError},mknod:(e,r,t,n)=>ce.createNode(e,r,t,n),rename(e,r,t){var n;try{n=he.lookupNode(r,t)}catch(e){}if(n){if(he.isDir(e.mode))for(var o in n.contents)throw new he.ErrnoError(55);he.hashRemoveNode(n)}delete e.parent.contents[e.name],r.contents[t]=e,e.name=t,r.ctime=r.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,r){delete e.contents[r],e.ctime=e.mtime=Date.now()},rmdir(e,r){var t=he.lookupNode(e,r);for(var n in t.contents)throw new he.ErrnoError(55);delete e.contents[r],e.ctime=e.mtime=Date.now()},readdir:e=>[".","..",...Object.keys(e.contents)],symlink(e,r,t){var n=ce.createNode(e,r,41471,0);return n.link=t,n},readlink(e){if(!he.isLink(e.mode))throw new he.ErrnoError(28);return e.link}},stream_ops:{read(e,r,t,n,o){var a=e.node.contents;if(o>=e.node.usedBytes)return 0;var i=Math.min(e.node.usedBytes-o,n);if(i>8&&a.subarray)r.set(a.subarray(o,o+i),t);else for(var s=0;s<i;s++)r[t+s]=a[o+s];return i},write(e,r,t,n,o,a){if(r.buffer===x.buffer&&(a=!1),!n)return 0;var i=e.node;if(i.mtime=i.ctime=Date.now(),r.subarray&&(!i.contents||i.contents.subarray)){if(a)return i.contents=r.subarray(t,t+n),i.usedBytes=n,n;if(0===i.usedBytes&&0===o)return i.contents=r.slice(t,t+n),i.usedBytes=n,n;if(o+n<=i.usedBytes)return i.contents.set(r.subarray(t,t+n),o),n}if(ce.expandFileStorage(i,o+n),i.contents.subarray&&r.subarray)i.contents.set(r.subarray(t,t+n),o);else for(var s=0;s<n;s++)i.contents[o+s]=r[t+s];return i.usedBytes=Math.max(i.usedBytes,o+n),n},llseek(e,r,t){var n=r;if(1===t?n+=e.position:2===t&&he.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new he.ErrnoError(28);return n},mmap(e,r,t,n,o){if(!he.isFile(e.node.mode))throw new he.ErrnoError(43);var a,i,s=e.node.contents;if(2&o||!s||s.buffer!==x.buffer){if(i=!0,!(a=le()))throw new he.ErrnoError(48);s&&((t>0||t+r<s.length)&&(s=s.subarray?s.subarray(t,t+r):Array.prototype.slice.call(s,t,t+r)),x.set(s,a))}else i=!1,a=s.byteOffset;return{ptr:a,allocated:i}},msync:(e,r,t,n,o)=>(ce.stream_ops.write(e,r,0,n,t,!1),0)}},de=(e,r,t,n,o,a)=>{he.createDataFile(e,r,t,n,o,a)},fe=o.preloadPlugins||[],me=(e,r,t,n,o,a,i,s,u,l)=>{var d=r?ne.resolve(re.join2(e,r)):e;function f(t){function c(t){l?.(),s||de(e,r,t,n,o,u),a?.(),V()}((e,r,t,n)=>{"undefined"!=typeof Browser&&Browser.init();var o=!1;return fe.forEach((a=>{o||a.canHandle(r)&&(a.handle(e,r,t,n),o=!0)})),o})(t,d,c,(()=>{i?.(),V()}))||c(t)}M(),"string"==typeof t?(async e=>{var r=await c(e);return new Uint8Array(r)})(t).then(f,i):f(t)},pe=(e,r)=>{var t=0;return e&&(t|=365),r&&(t|=146),t},he={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,readFiles:{},ErrnoError:class{name="ErrnoError";constructor(e){this.errno=e}},FSStream:class{shared={};get object(){return this.node}set object(e){this.node=e}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(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(e,r,t,n){e||(e=this),this.parent=e,this.mount=e.mount,this.id=he.nextInode++,this.name=r,this.mode=t,this.rdev=n,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return he.isDir(this.mode)}get isDevice(){return he.isChrdev(this.mode)}},lookupPath(e,r={}){if(!e)throw new he.ErrnoError(44);r.follow_mount??=!0,re.isAbs(e)||(e=he.cwd()+"/"+e);e:for(var t=0;t<40;t++){for(var n=e.split("/").filter((e=>!!e)),o=he.root,a="/",i=0;i<n.length;i++){var s=i===n.length-1;if(s&&r.parent)break;if("."!==n[i])if(".."!==n[i]){a=re.join2(a,n[i]);try{o=he.lookupNode(o,n[i])}catch(e){if(44===e?.errno&&s&&r.noent_okay)return{path:a};throw e}if(!he.isMountpoint(o)||s&&!r.follow_mount||(o=o.mounted.root),he.isLink(o.mode)&&(!s||r.follow)){if(!o.node_ops.readlink)throw new he.ErrnoError(52);var u=o.node_ops.readlink(o);re.isAbs(u)||(u=re.dirname(a)+"/"+u),e=u+"/"+n.slice(i+1).join("/");continue e}}else a=re.dirname(a),o=o.parent}return{path:a,node:o}}throw new he.ErrnoError(32)},getPath(e){for(var r;;){if(he.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)%he.nameTable.length},hashAddNode(e){var r=he.hashName(e.parent.id,e.name);e.name_next=he.nameTable[r],he.nameTable[r]=e},hashRemoveNode(e){var r=he.hashName(e.parent.id,e.name);if(he.nameTable[r]===e)he.nameTable[r]=e.name_next;else for(var t=he.nameTable[r];t;){if(t.name_next===e){t.name_next=e.name_next;break}t=t.name_next}},lookupNode(e,r){var t=he.mayLookup(e);if(t)throw new he.ErrnoError(t);for(var n=he.hashName(e.id,r),o=he.nameTable[n];o;o=o.name_next)if(o.parent.id===e.id&&o.name===r)return o;return he.lookup(e,r)},createNode(e,r,t,n){var o=new he.FSNode(e,r,t,n);return he.hashAddNode(o),o},destroyNode(e){he.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>!(49152&~e),flagsToPermissionString(e){var r=["r","w","rw"][3&e];return 512&e&&(r+="w"),r},nodePermissions:(e,r)=>he.ignorePermissions||(!r.includes("r")||292&e.mode)&&(!r.includes("w")||146&e.mode)&&(!r.includes("x")||73&e.mode)?0:2,mayLookup:e=>he.isDir(e.mode)?he.nodePermissions(e,"x")||(e.node_ops.lookup?0:2):54,mayCreate(e,r){if(!he.isDir(e.mode))return 54;try{return he.lookupNode(e,r),20}catch(e){}return he.nodePermissions(e,"wx")},mayDelete(e,r,t){var n;try{n=he.lookupNode(e,r)}catch(e){return e.errno}var o=he.nodePermissions(e,"wx");if(o)return o;if(t){if(!he.isDir(n.mode))return 54;if(he.isRoot(n)||he.getPath(n)===he.cwd())return 10}else if(he.isDir(n.mode))return 31;return 0},mayOpen:(e,r)=>e?he.isLink(e.mode)?32:he.isDir(e.mode)&&("r"!==he.flagsToPermissionString(r)||576&r)?31:he.nodePermissions(e,he.flagsToPermissionString(r)):44,checkOpExists(e,r){if(!e)throw new he.ErrnoError(r);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=he.MAX_OPEN_FDS;e++)if(!he.streams[e])return e;throw new he.ErrnoError(33)},getStreamChecked(e){var r=he.getStream(e);if(!r)throw new he.ErrnoError(8);return r},getStream:e=>he.streams[e],createStream:(e,r=-1)=>(e=Object.assign(new he.FSStream,e),-1==r&&(r=he.nextfd()),e.fd=r,he.streams[r]=e,e),closeStream(e){he.streams[e]=null},dupStream(e,r=-1){var t=he.createStream(e,r);return t.stream_ops?.dup?.(t),t},doSetAttr(e,r,t){var n=e?.stream_ops.setattr,o=n?e:r;n??=r.node_ops.setattr,he.checkOpExists(n,63),n(o,t)},chrdev_stream_ops:{open(e){var r=he.getDevice(e.node.rdev);e.stream_ops=r.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new he.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,r)=>e<<8|r,registerDevice(e,r){he.devices[e]={stream_ops:r}},getDevice:e=>he.devices[e],getMounts(e){for(var r=[],t=[e];t.length;){var n=t.pop();r.push(n),t.push(...n.mounts)}return r},syncfs(e,r){"function"==typeof e&&(r=e,e=!1),he.syncFSRequests++,he.syncFSRequests>1&&b(`warning: ${he.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var t=he.getMounts(he.root.mount),n=0;function o(e){return he.syncFSRequests--,r(e)}function a(e){if(e)return a.errored?void 0:(a.errored=!0,o(e));++n>=t.length&&o(null)}t.forEach((r=>{if(!r.type.syncfs)return a(null);r.type.syncfs(r,e,a)}))},mount(e,r,t){var n,o="/"===t,a=!t;if(o&&he.root)throw new he.ErrnoError(10);if(!o&&!a){var i=he.lookupPath(t,{follow_mount:!1});if(t=i.path,he.isMountpoint(n=i.node))throw new he.ErrnoError(10);if(!he.isDir(n.mode))throw new he.ErrnoError(54)}var s={type:e,opts:r,mountpoint:t,mounts:[]},u=e.mount(s);return u.mount=s,s.root=u,o?he.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount(e){var r=he.lookupPath(e,{follow_mount:!1});if(!he.isMountpoint(r.node))throw new he.ErrnoError(28);var t=r.node,n=t.mounted,o=he.getMounts(n);Object.keys(he.nameTable).forEach((e=>{for(var r=he.nameTable[e];r;){var t=r.name_next;o.includes(r.mount)&&he.destroyNode(r),r=t}})),t.mounted=null;var a=t.mount.mounts.indexOf(n);t.mount.mounts.splice(a,1)},lookup:(e,r)=>e.node_ops.lookup(e,r),mknod(e,r,t){var n=he.lookupPath(e,{parent:!0}).node,o=re.basename(e);if(!o)throw new he.ErrnoError(28);if("."===o||".."===o)throw new he.ErrnoError(20);var a=he.mayCreate(n,o);if(a)throw new he.ErrnoError(a);if(!n.node_ops.mknod)throw new he.ErrnoError(63);return n.node_ops.mknod(n,o,r,t)},statfs:e=>he.statfsNode(he.lookupPath(e,{follow:!0}).node),statfsStream:e=>he.statfsNode(e.node),statfsNode(e){var r={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:he.nextInode,ffree:he.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(r,e.node_ops.statfs(e.mount.opts.root)),r},create:(e,r=438)=>(r&=4095,he.mknod(e,r|=32768,0)),mkdir:(e,r=511)=>(r&=1023,he.mknod(e,r|=16384,0)),mkdirTree(e,r){var t=e.split("/"),n="";for(var o of t)if(o){(n||re.isAbs(e))&&(n+="/"),n+=o;try{he.mkdir(n,r)}catch(e){if(20!=e.errno)throw e}}},mkdev:(e,r,t)=>(void 0===t&&(t=r,r=438),he.mknod(e,r|=8192,t)),symlink(e,r){if(!ne.resolve(e))throw new he.ErrnoError(44);var t=he.lookupPath(r,{parent:!0}).node;if(!t)throw new he.ErrnoError(44);var n=re.basename(r),o=he.mayCreate(t,n);if(o)throw new he.ErrnoError(o);if(!t.node_ops.symlink)throw new he.ErrnoError(63);return t.node_ops.symlink(t,n,e)},rename(e,r){var t,n,o=re.dirname(e),a=re.dirname(r),i=re.basename(e),s=re.basename(r);if(t=he.lookupPath(e,{parent:!0}).node,n=he.lookupPath(r,{parent:!0}).node,!t||!n)throw new he.ErrnoError(44);if(t.mount!==n.mount)throw new he.ErrnoError(75);var u,l=he.lookupNode(t,i),c=ne.relative(e,a);if("."!==c.charAt(0))throw new he.ErrnoError(28);if("."!==(c=ne.relative(r,o)).charAt(0))throw new he.ErrnoError(55);try{u=he.lookupNode(n,s)}catch(e){}if(l!==u){var d=he.isDir(l.mode),f=he.mayDelete(t,i,d);if(f)throw new he.ErrnoError(f);if(f=u?he.mayDelete(n,s,d):he.mayCreate(n,s))throw new he.ErrnoError(f);if(!t.node_ops.rename)throw new he.ErrnoError(63);if(he.isMountpoint(l)||u&&he.isMountpoint(u))throw new he.ErrnoError(10);if(n!==t&&(f=he.nodePermissions(t,"w")))throw new he.ErrnoError(f);he.hashRemoveNode(l);try{t.node_ops.rename(l,n,s),l.parent=n}catch(e){throw e}finally{he.hashAddNode(l)}}},rmdir(e){var r=he.lookupPath(e,{parent:!0}).node,t=re.basename(e),n=he.lookupNode(r,t),o=he.mayDelete(r,t,!0);if(o)throw new he.ErrnoError(o);if(!r.node_ops.rmdir)throw new he.ErrnoError(63);if(he.isMountpoint(n))throw new he.ErrnoError(10);r.node_ops.rmdir(r,t),he.destroyNode(n)},readdir(e){var r=he.lookupPath(e,{follow:!0}).node;return he.checkOpExists(r.node_ops.readdir,54)(r)},unlink(e){var r=he.lookupPath(e,{parent:!0}).node;if(!r)throw new he.ErrnoError(44);var t=re.basename(e),n=he.lookupNode(r,t),o=he.mayDelete(r,t,!1);if(o)throw new he.ErrnoError(o);if(!r.node_ops.unlink)throw new he.ErrnoError(63);if(he.isMountpoint(n))throw new he.ErrnoError(10);r.node_ops.unlink(r,t),he.destroyNode(n)},readlink(e){var r=he.lookupPath(e).node;if(!r)throw new he.ErrnoError(44);if(!r.node_ops.readlink)throw new he.ErrnoError(28);return r.node_ops.readlink(r)},stat(e,r){var t=he.lookupPath(e,{follow:!r}).node;return he.checkOpExists(t.node_ops.getattr,63)(t)},fstat(e){var r=he.getStreamChecked(e),t=r.node,n=r.stream_ops.getattr,o=n?r:t;return n??=t.node_ops.getattr,he.checkOpExists(n,63),n(o)},lstat:e=>he.stat(e,!0),doChmod(e,r,t,n){he.doSetAttr(e,r,{mode:4095&t|-4096&r.mode,ctime:Date.now(),dontFollow:n})},chmod(e,r,t){var n;n="string"==typeof e?he.lookupPath(e,{follow:!t}).node:e,he.doChmod(null,n,r,t)},lchmod(e,r){he.chmod(e,r,!0)},fchmod(e,r){var t=he.getStreamChecked(e);he.doChmod(t,t.node,r,!1)},doChown(e,r,t){he.doSetAttr(e,r,{timestamp:Date.now(),dontFollow:t})},chown(e,r,t,n){var o;o="string"==typeof e?he.lookupPath(e,{follow:!n}).node:e,he.doChown(null,o,n)},lchown(e,r,t){he.chown(e,r,t,!0)},fchown(e,r,t){var n=he.getStreamChecked(e);he.doChown(n,n.node,!1)},doTruncate(e,r,t){if(he.isDir(r.mode))throw new he.ErrnoError(31);if(!he.isFile(r.mode))throw new he.ErrnoError(28);var n=he.nodePermissions(r,"w");if(n)throw new he.ErrnoError(n);he.doSetAttr(e,r,{size:t,timestamp:Date.now()})},truncate(e,r){if(r<0)throw new he.ErrnoError(28);var t;t="string"==typeof e?he.lookupPath(e,{follow:!0}).node:e,he.doTruncate(null,t,r)},ftruncate(e,r){var t=he.getStreamChecked(e);if(r<0||!(2097155&t.flags))throw new he.ErrnoError(28);he.doTruncate(t,t.node,r)},utime(e,r,t){var n=he.lookupPath(e,{follow:!0}).node;he.checkOpExists(n.node_ops.setattr,63)(n,{atime:r,mtime:t})},open(e,r,t=438){if(""===e)throw new he.ErrnoError(44);var n,a;if(t=64&(r="string"==typeof r?(e=>{var r={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===r)throw new Error(`Unknown file open mode: ${e}`);return r})(r):r)?4095&t|32768:0,"object"==typeof e)n=e;else{a=e.endsWith("/");var i=he.lookupPath(e,{follow:!(131072&r),noent_okay:!0});n=i.node,e=i.path}var s=!1;if(64&r)if(n){if(128&r)throw new he.ErrnoError(20)}else{if(a)throw new he.ErrnoError(31);n=he.mknod(e,511|t,0),s=!0}if(!n)throw new he.ErrnoError(44);if(he.isChrdev(n.mode)&&(r&=-513),65536&r&&!he.isDir(n.mode))throw new he.ErrnoError(54);if(!s){var u=he.mayOpen(n,r);if(u)throw new he.ErrnoError(u)}512&r&&!s&&he.truncate(n,0),r&=-131713;var l=he.createStream({node:n,path:he.getPath(n),flags:r,seekable:!0,position:0,stream_ops:n.stream_ops,ungotten:[],error:!1});return l.stream_ops.open&&l.stream_ops.open(l),s&&he.chmod(n,511&t),!o.logReadFiles||1&r||e in he.readFiles||(he.readFiles[e]=1),l},close(e){if(he.isClosed(e))throw new he.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{he.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,r,t){if(he.isClosed(e))throw new he.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new he.ErrnoError(70);if(0!=t&&1!=t&&2!=t)throw new he.ErrnoError(28);return e.position=e.stream_ops.llseek(e,r,t),e.ungotten=[],e.position},read(e,r,t,n,o){if(n<0||o<0)throw new he.ErrnoError(28);if(he.isClosed(e))throw new he.ErrnoError(8);if(1==(2097155&e.flags))throw new he.ErrnoError(8);if(he.isDir(e.node.mode))throw new he.ErrnoError(31);if(!e.stream_ops.read)throw new he.ErrnoError(28);var a=void 0!==o;if(a){if(!e.seekable)throw new he.ErrnoError(70)}else o=e.position;var i=e.stream_ops.read(e,r,t,n,o);return a||(e.position+=i),i},write(e,r,t,n,o,a){if(n<0||o<0)throw new he.ErrnoError(28);if(he.isClosed(e))throw new he.ErrnoError(8);if(!(2097155&e.flags))throw new he.ErrnoError(8);if(he.isDir(e.node.mode))throw new he.ErrnoError(31);if(!e.stream_ops.write)throw new he.ErrnoError(28);e.seekable&&1024&e.flags&&he.llseek(e,0,2);var i=void 0!==o;if(i){if(!e.seekable)throw new he.ErrnoError(70)}else o=e.position;var s=e.stream_ops.write(e,r,t,n,o,a);return i||(e.position+=s),s},mmap(e,r,t,n,o){if(2&n&&!(2&o)&&2!=(2097155&e.flags))throw new he.ErrnoError(2);if(1==(2097155&e.flags))throw new he.ErrnoError(2);if(!e.stream_ops.mmap)throw new he.ErrnoError(43);if(!r)throw new he.ErrnoError(28);return e.stream_ops.mmap(e,r,t,n,o)},msync:(e,r,t,n,o)=>e.stream_ops.msync?e.stream_ops.msync(e,r,t,n,o):0,ioctl(e,r,t){if(!e.stream_ops.ioctl)throw new he.ErrnoError(59);return e.stream_ops.ioctl(e,r,t)},readFile(e,r={}){if(r.flags=r.flags||0,r.encoding=r.encoding||"binary","utf8"!==r.encoding&&"binary"!==r.encoding)throw new Error(`Invalid encoding type "${r.encoding}"`);var t,n=he.open(e,r.flags),o=he.stat(e).size,a=new Uint8Array(o);return he.read(n,a,0,o,0),"utf8"===r.encoding?t=J(a):"binary"===r.encoding&&(t=a),he.close(n),t},writeFile(e,r,t={}){t.flags=t.flags||577;var n=he.open(e,t.flags,t.mode);if("string"==typeof r){var o=new Uint8Array(ae(r)+1),a=ie(r,o,0,o.length);he.write(n,o,0,a,void 0,t.canOwn)}else{if(!ArrayBuffer.isView(r))throw new Error("Unsupported data type");he.write(n,r,0,r.byteLength,void 0,t.canOwn)}he.close(n)},cwd:()=>he.currentPath,chdir(e){var r=he.lookupPath(e,{follow:!0});if(null===r.node)throw new he.ErrnoError(44);if(!he.isDir(r.node.mode))throw new he.ErrnoError(54);var t=he.nodePermissions(r.node,"x");if(t)throw new he.ErrnoError(t);he.currentPath=r.path},createDefaultDirectories(){he.mkdir("/tmp"),he.mkdir("/home"),he.mkdir("/home/web_user")},createDefaultDevices(){he.mkdir("/dev"),he.registerDevice(he.makedev(1,3),{read:()=>0,write:(e,r,t,n,o)=>n,llseek:()=>0}),he.mkdev("/dev/null",he.makedev(1,3)),ue.register(he.makedev(5,0),ue.default_tty_ops),ue.register(he.makedev(6,0),ue.default_tty1_ops),he.mkdev("/dev/tty",he.makedev(5,0)),he.mkdev("/dev/tty1",he.makedev(6,0));var e=new Uint8Array(1024),r=0,t=()=>(0===r&&(te(e),r=e.byteLength),e[--r]);he.createDevice("/dev","random",t),he.createDevice("/dev","urandom",t),he.mkdir("/dev/shm"),he.mkdir("/dev/shm/tmp")},createSpecialDirectories(){he.mkdir("/proc");var e=he.mkdir("/proc/self");he.mkdir("/proc/self/fd"),he.mount({mount(){var r=he.createNode(e,"fd",16895,73);return r.stream_ops={llseek:ce.stream_ops.llseek},r.node_ops={lookup(e,r){var t=+r,n=he.getStreamChecked(t),o={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path},id:t+1};return o.parent=o,o},readdir:()=>Array.from(he.streams.entries()).filter((([e,r])=>r)).map((([e,r])=>e.toString()))},r}},{},"/proc/self/fd")},createStandardStreams(e,r,t){e?he.createDevice("/dev","stdin",e):he.symlink("/dev/tty","/dev/stdin"),r?he.createDevice("/dev","stdout",null,r):he.symlink("/dev/tty","/dev/stdout"),t?he.createDevice("/dev","stderr",null,t):he.symlink("/dev/tty1","/dev/stderr"),he.open("/dev/stdin",0),he.open("/dev/stdout",1),he.open("/dev/stderr",1)},staticInit(){he.nameTable=new Array(4096),he.mount(ce,{},"/"),he.createDefaultDirectories(),he.createDefaultDevices(),he.createSpecialDirectories(),he.filesystems={MEMFS:ce}},init(e,r,t){he.initialized=!0,e??=o.stdin,r??=o.stdout,t??=o.stderr,he.createStandardStreams(e,r,t)},quit(){for(var e of(he.initialized=!1,he.streams))e&&he.close(e)},findObject(e,r){var t=he.analyzePath(e,r);return t.exists?t.object:null},analyzePath(e,r){try{e=(n=he.lookupPath(e,{follow:!r})).path}catch(e){}var t={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=he.lookupPath(e,{parent:!0});t.parentExists=!0,t.parentPath=n.path,t.parentObject=n.node,t.name=re.basename(e),n=he.lookupPath(e,{follow:!r}),t.exists=!0,t.path=n.path,t.object=n.node,t.name=n.node.name,t.isRoot="/"===n.path}catch(e){t.error=e.errno}return t},createPath(e,r,t,n){e="string"==typeof e?e:he.getPath(e);for(var o=r.split("/").reverse();o.length;){var a=o.pop();if(a){var i=re.join2(e,a);try{he.mkdir(i)}catch(e){if(20!=e.errno)throw e}e=i}}return i},createFile(e,r,t,n,o){var a=re.join2("string"==typeof e?e:he.getPath(e),r),i=pe(n,o);return he.create(a,i)},createDataFile(e,r,t,n,o,a){var i=r;e&&(e="string"==typeof e?e:he.getPath(e),i=r?re.join2(e,r):e);var s=pe(n,o),u=he.create(i,s);if(t){if("string"==typeof t){for(var l=new Array(t.length),c=0,d=t.length;c<d;++c)l[c]=t.charCodeAt(c);t=l}he.chmod(u,146|s);var f=he.open(u,577);he.write(f,t,0,t.length,0,a),he.close(f),he.chmod(u,s)}},createDevice(e,r,t,n){var o=re.join2("string"==typeof e?e:he.getPath(e),r),a=pe(!!t,!!n);he.createDevice.major??=64;var i=he.makedev(he.createDevice.major++,0);return he.registerDevice(i,{open(e){e.seekable=!1},close(e){n?.buffer?.length&&n(10)},read(e,r,n,o,a){for(var i=0,s=0;s<o;s++){var u;try{u=t()}catch(e){throw new he.ErrnoError(29)}if(void 0===u&&0===i)throw new he.ErrnoError(6);if(null==u)break;i++,r[n+s]=u}return i&&(e.node.atime=Date.now()),i},write(e,r,t,o,a){for(var i=0;i<o;i++)try{n(r[t+i])}catch(e){throw new he.ErrnoError(29)}return o&&(e.node.mtime=e.node.ctime=Date.now()),i}}),he.mkdev(o,a,i)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.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{e.contents=d(e.url),e.usedBytes=e.contents.length}catch(e){throw new he.ErrnoError(29)}},createLazyFile(e,r,t,n,o){class a{lengthKnown=!1;chunks=[];get(e){if(!(e>this.length-1||e<0)){var r=e%this.chunkSize;return this.getter(e/this.chunkSize|0)[r]}}setDataGetter(e){this.getter=e}cacheLength(){var e=new XMLHttpRequest;if(e.open("HEAD",t,!1),e.send(null),!(e.status>=200&&e.status<300||304===e.status))throw new Error("Couldn't load "+t+". Status: "+e.status);var r,n=Number(e.getResponseHeader("Content-length")),o=(r=e.getResponseHeader("Accept-Ranges"))&&"bytes"===r,a=(r=e.getResponseHeader("Content-Encoding"))&&"gzip"===r,i=1048576;o||(i=n);var s=this;s.setDataGetter((e=>{var r=e*i,o=(e+1)*i-1;if(o=Math.min(o,n-1),void 0===s.chunks[e]&&(s.chunks[e]=((e,r)=>{if(e>r)throw new Error("invalid range ("+e+", "+r+") or no bytes requested!");if(r>n-1)throw new Error("only "+n+" bytes available! programmer error!");var o=new XMLHttpRequest;if(o.open("GET",t,!1),n!==i&&o.setRequestHeader("Range","bytes="+e+"-"+r),o.responseType="arraybuffer",o.overrideMimeType&&o.overrideMimeType("text/plain; charset=x-user-defined"),o.send(null),!(o.status>=200&&o.status<300||304===o.status))throw new Error("Couldn't load "+t+". Status: "+o.status);return void 0!==o.response?new Uint8Array(o.response||[]):se(o.responseText||"")})(r,o)),void 0===s.chunks[e])throw new Error("doXHR failed!");return s.chunks[e]})),!a&&n||(i=n=1,n=this.getter(0).length,i=n,y("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=i,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if("undefined"!=typeof XMLHttpRequest){if(!s)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var i={isDevice:!1,contents:new a}}else i={isDevice:!1,url:t};var u=he.createFile(e,r,i,n,o);i.contents?u.contents=i.contents:i.url&&(u.contents=null,u.url=i.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var l={};function c(e,r,t,n,o){var a=e.node.contents;if(o>=a.length)return 0;var i=Math.min(a.length-o,n);if(a.slice)for(var s=0;s<i;s++)r[t+s]=a[o+s];else for(s=0;s<i;s++)r[t+s]=a.get(o+s);return i}return Object.keys(u.stream_ops).forEach((e=>{var r=u.stream_ops[e];l[e]=(...e)=>(he.forceLoadFile(u),r(...e))})),l.read=(e,r,t,n,o)=>(he.forceLoadFile(u),c(e,r,t,n,o)),l.mmap=(e,r,t,n,o)=>{he.forceLoadFile(u);var a=le();if(!a)throw new he.ErrnoError(48);return c(e,x,a,r,t),{ptr:a,allocated:!0}},u.stream_ops=l,u}},ve={DEFAULT_POLLMASK:5,calculateAt(e,r,t){if(re.isAbs(r))return r;var n;if(n=-100===e?he.cwd():ve.getStreamFromFD(e).path,0==r.length){if(!t)throw new he.ErrnoError(44);return n}return n+"/"+r},writeStat(e,r){A[e>>2]=r.dev,A[e+4>>2]=r.mode,$[e+8>>2]=r.nlink,A