@thorvg/lottie-player
Version:
A web lottie player using ThorVG as a renderer
1 lines • 67.7 kB
JavaScript
const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,r=Symbol(),n=new WeakMap;let a=class{constructor(t,e,n){if(this._$cssResult$=!0,n!==r)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const r=this.t;if(e&&void 0===t){const e=void 0!==r&&1===r.length;e&&(t=n.get(r)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&n.set(r,t))}return t}toString(){return this.cssText}};const i=(r,n)=>{if(e)r.adoptedStyleSheets=n.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of n){const n=document.createElement("style"),a=t.litNonce;void 0!==a&&n.setAttribute("nonce",a),n.textContent=e.cssText,r.appendChild(n)}},o=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return(t=>new a("string"==typeof t?t:t+"",void 0,r))(e)})(t):t,{is:s,defineProperty:h,getOwnPropertyDescriptor:l,getOwnPropertyNames:c,getOwnPropertySymbols:u,getPrototypeOf:d}=Object,f=globalThis,p=f.trustedTypes,w=p?p.emptyScript:"",m=f.reactiveElementPolyfillSupport,v=(t,e)=>t,y={toAttribute(t,e){switch(e){case Boolean:t=t?w:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=null!==t;break;case Number:r=null===t?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch(t){r=null}}return r}},g=(t,e)=>!s(t,e),b={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:g};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class $ extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=b){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const r=Symbol(),n=this.getPropertyDescriptor(t,r,e);void 0!==n&&h(this.prototype,t,n)}}static getPropertyDescriptor(t,e,r){const{get:n,set:a}=l(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return n?.call(this)},set(e){const i=n?.call(this);a.call(this,e),this.requestUpdate(t,i,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??b}static _$Ei(){if(this.hasOwnProperty(v("elementProperties")))return;const t=d(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(v("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(v("properties"))){const t=this.properties,e=[...c(t),...u(t)];for(const r of e)this.createProperty(r,t[r])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,r]of e)this.elementProperties.set(t,r)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const r=this._$Eu(t,e);void 0!==r&&this._$Eh.set(r,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const t of r)e.unshift(o(t))}else void 0!==t&&e.push(o(t));return e}static _$Eu(t,e){const r=e.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof t?t.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((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return i(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){const r=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,r);if(void 0!==n&&!0===r.reflect){const a=(void 0!==r.converter?.toAttribute?r.converter:y).toAttribute(e,r.type);this._$Em=t,null==a?this.removeAttribute(n):this.setAttribute(n,a),this._$Em=null}}_$AK(t,e){const r=this.constructor,n=r._$Eh.get(t);if(void 0!==n&&this._$Em!==n){const t=r.getPropertyOptions(n),a="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:y;this._$Em=n,this[n]=a.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,r){if(void 0!==t){if(r??=this.constructor.getPropertyOptions(t),!(r.hasChanged??g)(this[t],e))return;this.P(t,e,r)}!1===this.isUpdatePending&&(this._$ES=this._$ET())}P(t,e,r){this._$AL.has(t)||this._$AL.set(t,e),!0===r.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,r]of t)!0!==r.wrapped||this._$AL.has(e)||void 0===this[e]||this.P(e,this[e],r)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EU()}catch(e){throw t=!1,this._$EU(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EC(t,this[t]))),this._$EU()}updated(t){}firstUpdated(t){}}$.elementStyles=[],$.shadowRootOptions={mode:"open"},$[v("elementProperties")]=new Map,$[v("finalized")]=new Map,m?.({ReactiveElement:$}),(f.reactiveElementVersions??=[]).push("2.0.4");const A={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:g},_=(t=A,e,r)=>{const{kind:n,metadata:a}=r;let i=globalThis.litPropertyMetadata.get(a);if(void 0===i&&globalThis.litPropertyMetadata.set(a,i=new Map),i.set(r.name,t),"accessor"===n){const{name:n}=r;return{set(r){const a=e.get.call(this);e.set.call(this,r),this.requestUpdate(n,a,t)},init(e){return void 0!==e&&this.P(n,void 0,t),e}}}if("setter"===n){const{name:n}=r;return function(r){const a=this[n];e.call(this,r),this.requestUpdate(n,a,t)}}throw Error("Unsupported decorator location: "+n)};function E(t){return(e,r)=>"object"==typeof r?_(t,e,r):((t,e,r)=>{const n=e.hasOwnProperty(r);return e.constructor.createProperty(r,n?{...t,wrapped:!0}:t),n?Object.getOwnPropertyDescriptor(e,r):void 0})(t,e,r)}const k=globalThis,S=k.trustedTypes,T=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,C="$lit$",P=`lit$${Math.random().toFixed(9).slice(2)}$`,R="?"+P,O=`<${R}>`,Z=document,U=()=>Z.createComment(""),x=t=>null===t||"object"!=typeof t&&"function"!=typeof t,F=Array.isArray,j="[ \t\n\f\r]",N=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,z=/-->/g,D=/>/g,M=RegExp(`>|${j}(?:([^\\s"'>=/]+)(${j}*=${j}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),H=/'/g,I=/"/g,L=/^(?:script|style|textarea|title)$/i,V=(t,...e)=>({_$litType$:1,strings:t,values:e}),B=Symbol.for("lit-noChange"),G=Symbol.for("lit-nothing"),W=new WeakMap,q=Z.createTreeWalker(Z,129);function J(t,e){if(!F(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==T?T.createHTML(e):e}class X{constructor({strings:t,_$litType$:e},r){let n;this.parts=[];let a=0,i=0;const o=t.length-1,s=this.parts,[h,l]=((t,e)=>{const r=t.length-1,n=[];let a,i=2===e?"<svg>":3===e?"<math>":"",o=N;for(let e=0;e<r;e++){const r=t[e];let s,h,l=-1,c=0;for(;c<r.length&&(o.lastIndex=c,h=o.exec(r),null!==h);)c=o.lastIndex,o===N?"!--"===h[1]?o=z:void 0!==h[1]?o=D:void 0!==h[2]?(L.test(h[2])&&(a=RegExp("</"+h[2],"g")),o=M):void 0!==h[3]&&(o=M):o===M?">"===h[0]?(o=a??N,l=-1):void 0===h[1]?l=-2:(l=o.lastIndex-h[2].length,s=h[1],o=void 0===h[3]?M:'"'===h[3]?I:H):o===I||o===H?o=M:o===z||o===D?o=N:(o=M,a=void 0);const u=o===M&&t[e+1].startsWith("/>")?" ":"";i+=o===N?r+O:l>=0?(n.push(s),r.slice(0,l)+C+r.slice(l)+P+u):r+P+(-2===l?e:u)}return[J(t,i+(t[r]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),n]})(t,e);if(this.el=X.createElement(h,r),q.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(n=q.nextNode())&&s.length<o;){if(1===n.nodeType){if(n.hasAttributes())for(const t of n.getAttributeNames())if(t.endsWith(C)){const e=l[i++],r=n.getAttribute(t).split(P),o=/([.?@])?(.*)/.exec(e);s.push({type:1,index:a,name:o[2],strings:r,ctor:"."===o[1]?et:"?"===o[1]?rt:"@"===o[1]?nt:tt}),n.removeAttribute(t)}else t.startsWith(P)&&(s.push({type:6,index:a}),n.removeAttribute(t));if(L.test(n.tagName)){const t=n.textContent.split(P),e=t.length-1;if(e>0){n.textContent=S?S.emptyScript:"";for(let r=0;r<e;r++)n.append(t[r],U()),q.nextNode(),s.push({type:2,index:++a});n.append(t[e],U())}}}else if(8===n.nodeType)if(n.data===R)s.push({type:2,index:a});else{let t=-1;for(;-1!==(t=n.data.indexOf(P,t+1));)s.push({type:7,index:a}),t+=P.length-1}a++}}static createElement(t,e){const r=Z.createElement("template");return r.innerHTML=t,r}}function K(t,e,r=t,n){if(e===B)return e;let a=void 0!==n?r.o?.[n]:r.l;const i=x(e)?void 0:e._$litDirective$;return a?.constructor!==i&&(a?._$AO?.(!1),void 0===i?a=void 0:(a=new i(t),a._$AT(t,r,n)),void 0!==n?(r.o??=[])[n]=a:r.l=a),void 0!==a&&(e=K(t,a._$AS(t,e.values),a,n)),e}class Q{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:r}=this._$AD,n=(t?.creationScope??Z).importNode(e,!0);q.currentNode=n;let a=q.nextNode(),i=0,o=0,s=r[0];for(;void 0!==s;){if(i===s.index){let e;2===s.type?e=new Y(a,a.nextSibling,this,t):1===s.type?e=new s.ctor(a,s.name,s.strings,this,t):6===s.type&&(e=new at(a,this,t)),this._$AV.push(e),s=r[++o]}i!==s?.index&&(a=q.nextNode(),i++)}return q.currentNode=Z,n}p(t){let e=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}class Y{get _$AU(){return this._$AM?._$AU??this.v}constructor(t,e,r,n){this.type=2,this._$AH=G,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=n,this.v=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=K(this,t,e),x(t)?t===G||null==t||""===t?(this._$AH!==G&&this._$AR(),this._$AH=G):t!==this._$AH&&t!==B&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>F(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==G&&x(this._$AH)?this._$AA.nextSibling.data=t:this.T(Z.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:r}=t,n="number"==typeof r?this._$AC(t):(void 0===r.el&&(r.el=X.createElement(J(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new Q(n,this),r=t.u(this.options);t.p(e),this.T(r),this._$AH=t}}_$AC(t){let e=W.get(t.strings);return void 0===e&&W.set(t.strings,e=new X(t)),e}k(t){F(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,n=0;for(const a of t)n===e.length?e.push(r=new Y(this.O(U()),this.O(U()),this,this.options)):r=e[n],r._$AI(a),n++;n<e.length&&(this._$AR(r&&r._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this.v=t,this._$AP?.(t))}}class tt{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,n,a){this.type=1,this._$AH=G,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=a,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=G}_$AI(t,e=this,r,n){const a=this.strings;let i=!1;if(void 0===a)t=K(this,t,e,0),i=!x(t)||t!==this._$AH&&t!==B,i&&(this._$AH=t);else{const n=t;let o,s;for(t=a[0],o=0;o<a.length-1;o++)s=K(this,n[r+o],e,o),s===B&&(s=this._$AH[o]),i||=!x(s)||s!==this._$AH[o],s===G?t=G:t!==G&&(t+=(s??"")+a[o+1]),this._$AH[o]=s}i&&!n&&this.j(t)}j(t){t===G?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class et extends tt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===G?void 0:t}}class rt extends tt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==G)}}class nt extends tt{constructor(t,e,r,n,a){super(t,e,r,n,a),this.type=5}_$AI(t,e=this){if((t=K(this,t,e,0)??G)===B)return;const r=this._$AH,n=t===G&&r!==G||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,a=t!==G&&(r===G||n);n&&this.element.removeEventListener(this.name,this,r),a&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class at{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){K(this,t)}}const it=k.litHtmlPolyfillSupport;it?.(X,Y),(k.litHtmlVersions??=[]).push("3.2.0");class ot extends ${constructor(){super(...arguments),this.renderOptions={host:this},this.o=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this.o=((t,e,r)=>{const n=r?.renderBefore??e;let a=n._$litPart$;if(void 0===a){const t=r?.renderBefore??null;n._$litPart$=a=new Y(e.insertBefore(U(),t),t,void 0,r??{})}return a._$AI(t),a})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this.o?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this.o?.setConnected(!1)}render(){return B}}ot._$litElement$=!0,ot.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:ot});const st=globalThis.litElementPolyfillSupport;function ht(t,e,r,n){var a,i=arguments.length,o=i<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(a=t[s])&&(o=(i<3?a(o):i>3?a(e,r,o):a(e,r))||o);return i>3&&o&&Object.defineProperty(e,r,o),o}st?.({LitElement:ot}),(globalThis.litElementVersions??=[]).push("4.1.0");let lt=null,ct=!1;var ut,dt,ft,pt,wt,mt;!function(t){t.SW="sw",t.WG="wg",t.GL="gl"}(ut||(ut={})),function(t){t.IDLE="idle",t.FAILED="failed",t.REQUESTED="requested",t.INITIALIZED="initialized"}(dt||(dt={})),function(t){t.JSON="json",t.LOT="lot",t.JPG="jpg",t.PNG="png",t.SVG="svg"}(ft||(ft={})),function(t){t.Destroyed="destroyed",t.Error="error",t.Loading="loading",t.Paused="paused",t.Playing="playing",t.Stopped="stopped",t.Frozen="frozen"}(pt||(pt={})),function(t){t.Bounce="bounce",t.Normal="normal"}(wt||(wt={})),function(t){t.Complete="complete",t.Destroyed="destroyed",t.Error="error",t.Frame="frame",t.Freeze="freeze",t.Load="load",t.Loop="loop",t.Pause="pause",t.Play="play",t.Ready="ready",t.Stop="stop"}(mt||(mt={}));const vt=t=>new Promise((e=>setTimeout(e,t)));let yt="idle";class gt extends ot{src;wasmUrl;fileType="json";speed=1;autoPlay=!1;count;loop=!1;direction=1;mode="normal";intermission=1;totalFrame=0;currentFrame=0;currentState="loading";get size(){return Float32Array.from(this.TVG?.size()||[0,0])}TVG=null;canvas;config;_imageData;_beginTime=Date.now();_counter=1;_timer;_observer;_observable=!1;async _init(){if(ct)for(;!lt;)await vt(100);if(lt||(ct=!0,lt=await async function(t={}){var e,r=t,n=!!globalThis.window,a=!!globalThis.WorkerGlobalScope,i=globalThis.process?.versions?.node&&"renderer"!=globalThis.process?.type;if(i){const{createRequire:t}=await Promise.resolve().then((function(){return At}));var o=t(import.meta.url)}var s,h,l=(t,e)=>{throw e},c=import.meta.url,u="";if(i){var d=o("fs");c.startsWith("file:")&&(u=o("path").dirname(o("url").fileURLToPath(c))+"/"),h=t=>(t=O(t)?new URL(t):t,d.readFileSync(t)),s=async t=>(t=O(t)?new URL(t):t,d.readFileSync(t,void 0)),process.argv.slice(2),l=(t,e)=>{throw process.exitCode=t,e}}else if(n||a){try{u=new URL(".",c).href}catch{}a&&(h=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),s=async t=>{if(O(t))return new Promise(((e,r)=>{var n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?e(n.response):r(n.status)},n.onerror=r,n.send(null)}));var e=await fetch(t,{credentials:"same-origin"});if(e.ok)return e.arrayBuffer();throw Error(e.status+" : "+e.url)}}var f,p,w,m,v,y,g,b,$,A,_,E,k,S,T,C=void 0,P=void 0,R=!1,O=t=>t.startsWith("file://"),Z=!1;function U(){var t=er.buffer;v=new Int8Array(t),g=new Int16Array(t),y=new Uint8Array(t),b=new Uint16Array(t),$=new Int32Array(t),A=new Uint32Array(t),_=new Float32Array(t),E=new Float64Array(t),k=new BigInt64Array(t),S=new BigUint64Array(t)}function x(t){throw r.onAbort?.(t),P(t="Aborted("+t+")"),R=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),m?.(t),t}class F{name="ExitStatus";constructor(t){this.message=`Program terminated with exit(${t})`,this.status=t}}var j=t=>{for(;0<t.length;)t.shift()(r)},N=[],z=[],D=()=>{var t=r.preRun.shift();z.push(t)},M=!0,H=new TextDecoder,I=(t,e,r,n)=>{if(r=e+r,n)return r;for(;t[e]&&!(e>=r);)++e;return e},L=(t,e,r)=>t?H.decode(y.subarray(t,I(y,t,e,r))):"",V=t=>{for(var e="";;){var r=y[t++];if(!r)return e;e+=String.fromCharCode(r)}},B={},G={},W={},q=class extends Error{constructor(t){super(t),this.name="BindingError"}},J=t=>{throw new q(t)};function X(t,e,r={}){return function(t,e,r={}){var n=e.name;if(!t)throw new q(`type "${n}" must have a positive integer typeid pointer`);if(G.hasOwnProperty(t)){if(r.Ib)return;throw new q(`Cannot register type '${n}' twice`)}G[t]=e,delete W[t],B.hasOwnProperty(t)&&(e=B[t],delete B[t],e.forEach((t=>t())))}(t,e,r)}var K=(t,e,r)=>{switch(e){case 1:return r?t=>v[t]:t=>y[t];case 2:return r?t=>g[t>>1]:t=>b[t>>1];case 4:return r?t=>$[t>>2]:t=>A[t>>2];case 8:return r?t=>k[t>>3]:t=>S[t>>3];default:throw new TypeError(`invalid integer width (${e}): ${t}`)}},Q=t=>{throw new q(t.$.ha.ea.name+" instance already deleted")},Y=!1,tt=()=>{},et=t=>globalThis.FinalizationRegistry?(Y=new FinalizationRegistry((t=>{--(t=t.$).count.value,0===t.count.value&&(t.ka?t.oa.Ba(t.ka):t.ha.ea.Ba(t.fa))})),et=t=>{var e=t.$;return e.ka&&Y.register(t,{$:e},t),t},tt=t=>{Y.unregister(t)},et(t)):(et=t=>t,t);function rt(){}var nt=(t,e)=>Object.defineProperty(e,"name",{value:t}),at={},it=(t,e,r)=>{if(void 0===t[e].ja){var n=t[e];t[e]=function(...n){if(!t[e].ja.hasOwnProperty(n.length))throw new q(`Function '${r}' called with an invalid number of arguments (${n.length}) - expects one of (${t[e].ja})!`);return t[e].ja[n.length].apply(this,n)},t[e].ja=[],t[e].ja[n.Ja]=n}},ot=(t,e,n)=>{if(r.hasOwnProperty(t)){if(void 0===n||void 0!==r[t].ja&&void 0!==r[t].ja[n])throw new q(`Cannot register public name '${t}' twice`);if(it(r,t,t),r[t].ja.hasOwnProperty(n))throw new q(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`);r[t].ja[n]=e}else r[t]=e,r[t].Ja=n};function st(t,e,r,n,a,i,o,s){this.name=t,this.constructor=e,this.Ga=r,this.Ba=n,this.ma=a,this.Eb=i,this.Oa=o,this.Ab=s,this.Ob=[]}var ht=(t,e,r)=>{for(;e!==r;){if(!e.Oa)throw new q(`Expected null or instance of ${r.name}, got an instance of ${e.name}`);t=e.Oa(t),e=e.ma}return t},lt=t=>{if(null===t)return"null";var e=typeof t;return"object"===e||"array"===e||"function"===e?t.toString():""+t};function ct(t,e){if(null===e){if(this.Ya)throw new q(`null is not a valid ${this.name}`);return 0}if(!e.$)throw new q(`Cannot pass "${lt(e)}" as a ${this.name}`);if(!e.$.fa)throw new q(`Cannot pass deleted object as a pointer of type ${this.name}`);return ht(e.$.fa,e.$.ha.ea,this.ea)}function ut(t,e){if(null===e){if(this.Ya)throw new q(`null is not a valid ${this.name}`);if(this.Ra){var r=this.Pb();return null!==t&&t.push(this.Ba,r),r}return 0}if(!e||!e.$)throw new q(`Cannot pass "${lt(e)}" as a ${this.name}`);if(!e.$.fa)throw new q(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.Qa&&e.$.ha.Qa)throw new q(`Cannot convert argument of type ${e.$.oa?e.$.oa.name:e.$.ha.name} to parameter type ${this.name}`);if(r=ht(e.$.fa,e.$.ha.ea,this.ea),this.Ra){if(void 0===e.$.ka)throw new q("Passing raw pointer to smart pointer is illegal");switch(this.Rb){case 0:if(e.$.oa!==this)throw new q(`Cannot convert argument of type ${e.$.oa?e.$.oa.name:e.$.ha.name} to parameter type ${this.name}`);r=e.$.ka;break;case 1:r=e.$.ka;break;case 2:if(e.$.oa===this)r=e.$.ka;else{var n=e.clone();r=this.Qb(r,Ft((()=>n.delete()))),null!==t&&t.push(this.Ba,r)}break;default:throw new q("Unsupporting sharing policy")}}return r}function dt(t,e){if(null===e){if(this.Ya)throw new q(`null is not a valid ${this.name}`);return 0}if(!e.$)throw new q(`Cannot pass "${lt(e)}" as a ${this.name}`);if(!e.$.fa)throw new q(`Cannot pass deleted object as a pointer of type ${this.name}`);if(e.$.ha.Qa)throw new q(`Cannot convert argument of type ${e.$.ha.name} to parameter type ${this.name}`);return ht(e.$.fa,e.$.ha.ea,this.ea)}function ft(t){return this.la(A[t>>2])}var pt=(t,e,r)=>e===r?t:void 0===r.ma||null===(t=pt(t,e,r.ma))?null:r.Ab(t),wt={},mt=class extends Error{constructor(t){super(t),this.name="InternalError"}},vt=(t,e)=>{if(!e.ha||!e.fa)throw new mt("makeClassHandle requires ptr and ptrType");if(!!e.oa!=!!e.ka)throw new mt("Both smartPtrType and smartPtr must be specified");return e.count={value:1},et(Object.create(t,{$:{value:e,writable:!0}}))};function yt(t,e,r,n,a,i,o,s,h,l,c){this.name=t,this.ea=e,this.Ya=r,this.Qa=n,this.Ra=a,this.Nb=i,this.Rb=o,this.rb=s,this.Pb=h,this.Qb=l,this.Ba=c,a||void 0!==e.ma?this.pa=ut:(this.pa=n?ct:dt,this.qa=null)}var gt=(t,e,n)=>{if(!r.hasOwnProperty(t))throw new mt("Replacing nonexistent public symbol");void 0!==r[t].ja&&void 0!==n?r[t].ja[n]=e:(r[t]=e,r[t].Ja=n)},bt=(t,e)=>{t=V(t);var r=rr.get(e);if("function"!=typeof r)throw new q(`unknown function pointer with signature ${t}: ${e}`);return r};class $t extends Error{}var _t=t=>{t=Xe(t);var e=V(t);return qe(t),e},Et=(t,e)=>{var r=[],n={};throw e.forEach((function t(e){n[e]||G[e]||(W[e]?W[e].forEach(t):(r.push(e),n[e]=!0))})),new $t(`${t}: `+r.map(_t).join([", "]))},kt=(t,e,r)=>{function n(e){if((e=r(e)).length!==t.length)throw new mt("Mismatched type converter count");for(var n=0;n<t.length;++n)X(t[n],e[n])}t.forEach((t=>W[t]=e));var a=Array(e.length),i=[],o=0;e.forEach(((t,e)=>{G.hasOwnProperty(t)?a[e]=G[t]:(i.push(t),B.hasOwnProperty(t)||(B[t]=[]),B[t].push((()=>{a[e]=G[t],++o===i.length&&n(a)})))})),0===i.length&&n(a)},St=(t,e)=>{for(var r=[],n=0;n<t;n++)r.push(A[e+4*n>>2]);return r},Tt=t=>{for(;t.length;){var e=t.pop();t.pop()(e)}};function Ct(t){for(var e=1;e<t.length;++e)if(null!==t[e]&&void 0===t[e].qa)return!0;return!1}function Pt(t,e,r,n,a,i){var o=e.length;if(2>o)throw new q("argTypes array size mismatch! Must at least get return value and 'this' types!");var s=null!==e[1]&&null!==r,h=Ct(e);r=!e[0].pb;var l=e[0],c=e[1];for(n=[t,J,n,a,Tt,l.la.bind(l),c?.pa.bind(c)],a=2;a<o;++a)n.push((l=e[a]).pa.bind(l));if(!h)for(a=s?1:2;a<e.length;++a)null!==e[a].qa&&n.push(e[a].qa);for(h=Ct(e),a=e.length-2,c=[],l=["fn"],s&&l.push("thisWired"),o=0;o<a;++o)c.push(`arg${o}`),l.push(`arg${o}Wired`);c=c.join(","),l=l.join(","),c=`return function (${c}) {\n`,h&&(c+="var destructors = [];\n");var u=h?"destructors":"null",d="humanName throwBindingError invoker fn runDestructors fromRetWire toClassParamWire".split(" ");for(s&&(c+=`var thisWired = toClassParamWire(${u}, this);\n`),o=0;o<a;++o){var f=`toArg${o}Wire`;c+=`var arg${o}Wired = ${f}(${u}, arg${o});\n`,d.push(f)}if(c+=(r||i?"var rv = ":"")+`invoker(${l});\n`,h)c+="runDestructors(destructors);\n";else for(o=s?1:2;o<e.length;++o)i=1===o?"thisWired":"arg"+(o-2)+"Wired",null!==e[o].qa&&(c+=`${i}_dtor(${i});\n`,d.push(`${i}_dtor`));return r&&(c+="var ret = fromRetWire(rv);\nreturn ret;\n"),e=new Function(d,c+"}\n")(...n),nt(t,e)}var Rt=t=>{const e=(t=t.trim()).indexOf("(");return-1===e?t:t.slice(0,e)},Ot=[],Zt=[0,1,,1,null,1,!0,1,!1,1],Ut=t=>{9<t&&0==--Zt[t+1]&&(Zt[t]=void 0,Ot.push(t))},xt=t=>{if(!t)throw new q(`Cannot use deleted val. handle = ${t}`);return Zt[t]},Ft=t=>{switch(t){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:const e=Ot.pop()||Zt.length;return Zt[e]=t,Zt[e+1]=1,e}},jt={name:"emscripten::val",la:t=>{var e=xt(t);return Ut(t),e},pa:(t,e)=>Ft(e),za:ft,qa:null},Nt=(t,e)=>{switch(e){case 4:return function(t){return this.la(_[t>>2])};case 8:return function(t){return this.la(E[t>>3])};default:throw new TypeError(`invalid float width (${e}): ${t}`)}},zt=(t,e,r,n)=>{if(!(0<n))return 0;var a=r;n=r+n-1;for(var i=0;i<t.length;++i){var o=t.codePointAt(i);if(127>=o){if(r>=n)break;e[r++]=o}else if(2047>=o){if(r+1>=n)break;e[r++]=192|o>>6,e[r++]=128|63&o}else if(65535>=o){if(r+2>=n)break;e[r++]=224|o>>12,e[r++]=128|o>>6&63,e[r++]=128|63&o}else{if(r+3>=n)break;e[r++]=240|o>>18,e[r++]=128|o>>12&63,e[r++]=128|o>>6&63,e[r++]=128|63&o,i++}}return e[r]=0,r-a},Dt=t=>{for(var e=0,r=0;r<t.length;++r){var n=t.charCodeAt(r);127>=n?e++:2047>=n?e+=2:55296<=n&&57343>=n?(e+=4,++r):e+=3}return e},Mt=new TextDecoder("utf-16le"),Ht=(t,e,r)=>Mt.decode(b.subarray(t>>=1,I(b,t,e/2,r))),It=(t,e,r)=>{if(r??=2147483647,2>r)return 0;var n=e;r=(r-=2)<2*t.length?r/2:t.length;for(var a=0;a<r;++a)g[e>>1]=t.charCodeAt(a),e+=2;return g[e>>1]=0,e-n},Lt=t=>2*t.length,Vt=(t,e,r)=>{var n="";t>>=2;for(var a=0;!(a>=e/4);a++){var i=A[t+a];if(!i&&!r)break;n+=String.fromCodePoint(i)}return n},Bt=(t,e,r)=>{if(r??=2147483647,4>r)return 0;var n=e;r=n+r-4;for(var a=0;a<t.length;++a){var i=t.codePointAt(a);if(65535<i&&a++,$[e>>2]=i,(e+=4)+4>r)break}return $[e>>2]=0,e-n},Gt=t=>{for(var e=0,r=0;r<t.length;++r)65535<t.codePointAt(r)&&r++,e+=4;return e},Wt=0,qt=[],Jt=(t,e,r)=>{var n=[];return t=t(n,r),n.length&&(A[e>>2]=Ft(n)),t},Xt={},Kt=t=>{var e=Xt[t];return void 0===e?V(t):e},Qt={},Yt=t=>{p=t,M||0<Wt||(r.onExit?.(t),R=!0),l(t,new F(t))},te=(t,e)=>{for(var r=0,n=t.length-1;0<=n;n--){var a=t[n];"."===a?t.splice(n,1):".."===a?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r;r--)t.unshift("..");return t},ee=t=>{var e="/"===t.charAt(0),r="/"===t.slice(-1);return(t=te(t.split("/").filter((t=>!!t)),!e).join("/"))||e||(t="."),t&&r&&(t+="/"),(e?"/":"")+t},re=t=>{var e=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(t).slice(1);return t=e[0],e=e[1],t||e?(e&&=e.slice(0,-1),t+e):"."},ne=t=>t&&t.match(/([^\/]+|\/)\/*$/)[1],ae=t=>{(ae=(()=>{if(i){var t=o("crypto");return e=>t.randomFillSync(e)}return t=>crypto.getRandomValues(t)})())(t)},ie=(...t)=>{for(var e="",r=!1,n=t.length-1;-1<=n&&!r;n--){if("string"!=typeof(r=0<=n?t[n]:We.cwd()))throw new TypeError("Arguments to path.resolve must be strings");if(!r)return"";e=r+"/"+e,r="/"===r.charAt(0)}return e=te(e.split("/").filter((t=>!!t)),!r).join("/"),(r?"/":"")+e||"."},oe=(t,e)=>{function r(t){for(var e=0;e<t.length&&""===t[e];e++);for(var r=t.length-1;0<=r&&""===t[r];r--);return e>r?[]:t.slice(e,r-e+1)}t=ie(t).slice(1),e=ie(e).slice(1),t=r(t.split("/")),e=r(e.split("/"));for(var n=Math.min(t.length,e.length),a=n,i=0;i<n;i++)if(t[i]!==e[i]){a=i;break}for(n=[],i=a;i<t.length;i++)n.push("..");return(n=n.concat(e.slice(a))).join("/")},se=t=>{var e=I(t,0);return H.decode(t.buffer?t.subarray(0,e):new Uint8Array(t.slice(0,e)))},he=[],le=t=>{var e=Array(Dt(t)+1);return t=zt(t,e,0,e.length),e.length=t,e},ce=[];function ue(t,e){ce[t]={input:[],output:[],Ia:e},Ee(t,de)}var de={open(t){var e=ce[t.node.rdev];if(!e)throw new We.Z(43);t.tty=e,t.seekable=!1},close(t){t.tty.Ia.fsync(t.tty)},fsync(t){t.tty.Ia.fsync(t.tty)},read(t,e,r,n){if(!t.tty||!t.tty.Ia.mb)throw new We.Z(60);for(var a=0,i=0;i<n;i++){try{var o=t.tty.Ia.mb(t.tty)}catch(t){throw new We.Z(29)}if(void 0===o&&0===a)throw new We.Z(6);if(null==o)break;a++,e[r+i]=o}return a&&(t.node.atime=Date.now()),a},write(t,e,r,n){if(!t.tty||!t.tty.Ia.bb)throw new We.Z(60);try{for(var a=0;a<n;a++)t.tty.Ia.bb(t.tty,e[r+a])}catch(t){throw new We.Z(29)}return n&&(t.node.mtime=t.node.ctime=Date.now()),a}},fe={mb(){t:{if(!he.length){var t=null;if(i){var e=Buffer.alloc(256),r=0,n=process.stdin.fd;try{r=d.readSync(n,e,0,256)}catch(t){if(!t.toString().includes("EOF"))throw t;r=0}0<r&&(t=e.slice(0,r).toString("utf-8"))}else globalThis.window?.prompt&&null!==(t=window.prompt("Input: "))&&(t+="\n");if(!t){t=null;break t}he=le(t)}t=he.shift()}return t},bb(t,e){null===e||10===e?(C(se(t.output)),t.output=[]):0!=e&&t.output.push(e)},fsync(t){0<t.output?.length&&(C(se(t.output)),t.output=[])},mc:()=>({Zb:25856,ac:5,Yb:191,$b:35387,Xb:[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]}),nc:()=>0,oc:()=>[24,80]},pe={bb(t,e){null===e||10===e?(P(se(t.output)),t.output=[]):0!=e&&t.output.push(e)},fsync(t){0<t.output?.length&&(P(se(t.output)),t.output=[])}},we={wa:null,ga:()=>we.createNode(null,"/",16895,0),createNode(t,e,r,n){if(24576==(61440&r)||We.isFIFO(r))throw new We.Z(63);return we.wa||(we.wa={dir:{node:{sa:we.aa.sa,ua:we.aa.ua,lookup:we.aa.lookup,ya:we.aa.ya,rename:we.aa.rename,unlink:we.aa.unlink,rmdir:we.aa.rmdir,readdir:we.aa.readdir,symlink:we.aa.symlink},stream:{na:we.ba.na}},file:{node:{sa:we.aa.sa,ua:we.aa.ua},stream:{na:we.ba.na,read:we.ba.read,write:we.ba.write,Ha:we.ba.Ha,Ma:we.ba.Ma}},link:{node:{sa:we.aa.sa,ua:we.aa.ua,readlink:we.aa.readlink},stream:{}},fb:{node:{sa:we.aa.sa,ua:we.aa.ua},stream:We.yb}}),ke((r=We.createNode(t,e,r,n)).mode)?(r.aa=we.wa.dir.node,r.ba=we.wa.dir.stream,r.da={}):We.isFile(r.mode)?(r.aa=we.wa.file.node,r.ba=we.wa.file.stream,r.ia=0,r.da=null):40960==(61440&r.mode)?(r.aa=we.wa.link.node,r.ba=we.wa.link.stream):8192==(61440&r.mode)&&(r.aa=we.wa.fb.node,r.ba=we.wa.fb.stream),r.atime=r.mtime=r.ctime=Date.now(),t&&(t.da[e]=r,t.atime=t.mtime=t.ctime=r.atime),r},lc:t=>t.da?t.da.subarray?t.da.subarray(0,t.ia):new Uint8Array(t.da):new Uint8Array(0),aa:{sa(t){var e={};return e.dev=8192==(61440&t.mode)?t.id:1,e.ino=t.id,e.mode=t.mode,e.nlink=1,e.uid=0,e.gid=0,e.rdev=t.rdev,e.size=ke(t.mode)?4096:We.isFile(t.mode)?t.ia:40960==(61440&t.mode)?t.link.length:0,e.atime=new Date(t.atime),e.mtime=new Date(t.mtime),e.ctime=new Date(t.ctime),e.blksize=4096,e.blocks=Math.ceil(e.size/e.blksize),e},ua(t,e){for(var r of["mode","atime","mtime","ctime"])null!=e[r]&&(t[r]=e[r]);void 0!==e.size&&t.ia!=(e=e.size)&&(0==e?(t.da=null,t.ia=0):(r=t.da,t.da=new Uint8Array(e),r&&t.da.set(r.subarray(0,Math.min(e,t.ia))),t.ia=e))},lookup(){throw we.Va||(we.Va=new We.Z(44),we.Va.stack="<generic error, no stack>"),we.Va},ya:(t,e,r,n)=>we.createNode(t,e,r,n),rename(t,e,r){try{var n=Se(e,r)}catch(t){}if(n){if(ke(t.mode))for(var a in n.da)throw new We.Z(55);Te(n)}delete t.parent.da[t.name],e.da[r]=t,t.name=r,e.ctime=e.mtime=t.parent.ctime=t.parent.mtime=Date.now()},unlink(t,e){delete t.da[e],t.ctime=t.mtime=Date.now()},rmdir(t,e){var r,n=Se(t,e);for(r in n.da)throw new We.Z(55);delete t.da[e],t.ctime=t.mtime=Date.now()},readdir:t=>[".","..",...Object.keys(t.da)],symlink:(t,e,r)=>((t=we.createNode(t,e,41471,0)).link=r,t),readlink(t){if(40960!=(61440&t.mode))throw new We.Z(28);return t.link}},ba:{read(t,e,r,n,a){var i=t.node.da;if(a>=t.node.ia)return 0;if(8<(t=Math.min(t.node.ia-a,n))&&i.subarray)e.set(i.subarray(a,a+t),r);else for(n=0;n<t;n++)e[r+n]=i[a+n];return t},write(t,e,r,n,a,i){if(e.buffer===v.buffer&&(i=!1),!n)return 0;if((t=t.node).mtime=t.ctime=Date.now(),e.subarray&&(!t.da||t.da.subarray)){if(i)return t.da=e.subarray(r,r+n),t.ia=n;if(0===t.ia&&0===a)return t.da=e.slice(r,r+n),t.ia=n;if(a+n<=t.ia)return t.da.set(e.subarray(r,r+n),a),n}var o=t.da?t.da.length:0;if(o>=(i=a+n)||(i=Math.max(i,o*(1048576>o?2:1.125)>>>0),0!=o&&(i=Math.max(i,256)),o=t.da,t.da=new Uint8Array(i),0<t.ia&&t.da.set(o.subarray(0,t.ia),0)),t.da.subarray&&e.subarray)t.da.set(e.subarray(r,r+n),a);else for(i=0;i<n;i++)t.da[a+i]=e[r+i];return t.ia=Math.max(t.ia,a+n),n},na(t,e,r){if(1===r?e+=t.position:2===r&&We.isFile(t.node.mode)&&(e+=t.node.ia),0>e)throw new We.Z(28);return e},Ha(t,e,r,n,a){if(!We.isFile(t.node.mode))throw new We.Z(43);if(t=t.node.da,2&a||!t||t.buffer!==v.buffer){if(n=!0,x(),!(a=void 0))throw new We.Z(48);t&&((0<r||r+e<t.length)&&(t=t.subarray?t.subarray(r,r+e):Array.prototype.slice.call(t,r,r+e)),v.set(t,a))}else n=!1,a=t.byteOffset;return{fa:a,Tb:n}},Ma:(t,e,r,n)=>(we.ba.write(t,e,0,n,r,!1),0)}},me=(t,e)=>{var r=0;return t&&(r|=365),e&&(r|=146),r},ve=0,ye=null,ge=()=>{if(ve--,r.monitorRunDependencies?.(ve),0==ve&&ye){var t=ye;ye=null,t()}},be=()=>{ve++,r.monitorRunDependencies?.(ve)},$e=[],Ae=async(t,e,r,n,a,i,o,h)=>{var l=e?ie(ee(t+"/"+e)):t;be();try{var c=r;"string"==typeof r&&(c=await(async t=>(t=await s(t),new Uint8Array(t)))(r)),c=await(async(t,e)=>{for(var r of("undefined"!=typeof Browser&&_e(),$e))if(r.canHandle(e))return r.handle(t,e);return t})(c,l),h?.(),i||Ce(t,e,c,n,a,o)}finally{ge()}};function _e(){var t,e,n;We.Xa=!0,t??=r.stdin,e??=r.stdout,n??=r.stderr,t?We.Aa("/dev","stdin",t):We.symlink("/dev/tty","/dev/stdin"),e?We.Aa("/dev","stdout",null,e):We.symlink("/dev/tty","/dev/stdout"),n?We.Aa("/dev","stderr",null,n):We.symlink("/dev/tty1","/dev/stderr"),We.open("/dev/stdin",0),We.open("/dev/stdout",1),We.open("/dev/stderr",1)}function Ee(t,e){We.jb[t]={ba:e}}function ke(t){return 16384==(61440&t)}function Se(t,e){var r=ke(t.mode)?(r=xe(t,"x"))?r:t.aa.lookup?0:2:54;if(r)throw new We.Z(r);for(r=We.va[Oe(t.id,e)];r;r=r.Fa)if(r.parent.id===t.id&&r.name===e)return r;return We.lookup(t,e)}function Te(t){var e=Oe(t.parent.id,t.name);if(We.va[e]===t)We.va[e]=t.Fa;else for(e=We.va[e];e;){if(e.Fa===t){e.Fa=t.Fa;break}e=e.Fa}}function Ce(t,e,r,n,a,i){var o=e;if(t&&(t="string"==typeof t?t:Re(t),o=e?ee(t+"/"+e):t),t=me(n,a),o=We.create(o,t),r){if("string"==typeof r){for(e=Array(r.length),n=0,a=r.length;n<a;++n)e[n]=r.charCodeAt(n);r=e}We.chmod(o,146|t),e=We.open(o,577),We.write(e,r,0,r.length,0,i),We.close(e),We.chmod(o,t)}}function Pe(t,e={}){if(!t)throw new We.Z(44);e.Pa??(e.Pa=!0),"/"===t.charAt(0)||(t=We.cwd()+"/"+t);var r=0;t:for(;40>r;r++){t=t.split("/").filter((t=>!!t));for(var n=We.root,a="/",i=0;i<t.length;i++){var o=i===t.length-1;if(o&&e.parent)break;if("."!==t[i])if(".."===t[i]){if(a=re(a),We.Za(n)){t=a+"/"+t.slice(i+1).join("/"),r--;continue t}n=n.parent}else{a=ee(a+"/"+t[i]);try{n=Se(n,t[i])}catch(t){if(44===t?.Da&&o&&e.Lb)return{path:a};throw t}if(!n.ta||o&&!e.Pa||(n=n.ta.root),40960==(61440&n.mode)&&(!o||e.ra)){if(!n.aa.readlink)throw new We.Z(52);"/"===(n=n.aa.readlink(n)).charAt(0)||(n=re(a)+"/"+n),t=n+"/"+t.slice(i+1).join("/");continue t}}}return{path:a,node:n}}throw new We.Z(32)}function Re(t){for(var e;;){if(We.Za(t))return t=t.ga.qb,e?"/"!==t[t.length-1]?`${t}/${e}`:t+e:t;e=e?`${t.name}/${e}`:t.name,t=t.parent}}function Oe(t,e){for(var r=0,n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n)|0;return(t+r>>>0)%We.va.length}function Ze(t){var e=Oe(t.parent.id,t.name);t.Fa=We.va[e],We.va[e]=t}function Ue(t){var e=["r","w","rw"][3&t];return 512&t&&(e+="w"),e}function xe(t,e){return We.nb?0:!e.includes("r")||292&t.mode?e.includes("w")&&!(146&t.mode)||e.includes("x")&&!(73&t.mode)?2:0:2}function Fe(t,e){if(!ke(t.mode))return 54;try{return Se(t,e),20}catch(t){}return xe(t,"wx")}function je(t,e,r){try{var n=Se(t,e)}catch(t){return t.Da}if(t=xe(t,"wx"))return t;if(r){if(!ke(n.mode))return 54;if(We.Za(n)||Re(n)===We.cwd())return 10}else if(ke(n.mode))return 31;return 0}function Ne(t,e){if(!t)throw new We.Z(e);return t}function ze(t){if(!(t=We.Hb(t)))throw new We.Z(8);return t}function De(t,e=-1){if(t=Object.assign(new We.wb,t),-1==e)t:{for(e=0;e<=We.xb;e++)if(!We.streams[e])break t;throw new We.Z(33)}return t.fd=e,We.streams[e]=t}function Me(t,e,r){var n=t?.ba.ua;t=n?t:e,n??=e.aa.ua,Ne(n,63),n(t,r)}function He(t){var e=[];for(t=[t];t.length;){var r=t.pop();e.push(r),t.push(...r.La)}return e}function Ie(t){var e={Wb:4096,ic:4096,blocks:1e6,Vb:5e5,Ub:5e5,files:We.ab,fc:We.ab-1,jc:42,flags:2,rc:255};return t.aa.tb&&Object.assign(e,t.aa.tb(t.ga.Mb.root)),e}function Le(t,e,r){return void 0===r&&(r=e,e=438),We.ya(t,8192|e,r)}function Ve(t,e,r,n){Me(t,e,{mode:4095&r|-4096&e.mode,ctime:Date.now(),kb:n})}function Be(t,e,r){if(ke(e.mode))throw new We.Z(31);if(!We.isFile(e.mode))throw new We.Z(28);var n=xe(e,"w");if(n)throw new We.Z(n);Me(t,e,{size:r,timestamp:Date.now()})}function Ge(t){if(!(t.Jb||t.Kb||t.link||t.da))if(globalThis.XMLHttpRequest)x("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.");else try{t.da=h(t.url)}catch(t){throw new We.Z(29)}}var We={root:null,La:[],jb:{},streams:[],ab:1,va:null,gb:"/",Xa:!1,nb:!0,Db:null,Sa:0,sb:{},Z:class{name="ErrnoError";constructor(t){this.Da=t}},wb:class{xa={};node=null;get object(){return this.node}set object(t){this.node=t}get flags(){return this.xa.flags}set flags(t){this.xa.flags=t}get position(){return this.xa.position}set position(t){this.xa.position=t}},vb:class{aa={};ba={};ta=null;constructor(t,e,r,n){t||=this,this.parent=t,this.ga=t.ga,this.id=We.ab++,this.name=e,this.mode=r,this.rdev=n,this.atime=this.mtime=this.ctime=Date.now()}get read(){return!(365&~this.mode)}set read(t){t?this.mode|=365:this.mode&=-366}get write(){return!(146&~this.mode)}set write(t){t?this.mode|=146:this.mode&=-147}get Kb(){return ke(this.mode)}get Jb(){return 8192==(61440&this.mode)}},createNode:(t,e,r,n)=>(Ze(t=new We.vb(t,e,r,n)),t),Za:t=>t===t.parent,isFile:t=>32768==(61440&t),isFIFO:t=>4096==(61440&t),isSocket:t=>!(49152&~t),xb:4096,Hb:t=>We.streams[t],ec:(t,e=-1)=>(t=De(t,e),t.ba?.dc?.(t),t),yb:{open(t){t.ba=We.Fb(t.node.rdev).ba,t.ba.open?.(t)},na(){throw new We.Z(70)}},$a:t=>t>>8,pc:t=>255&t,Ea:(t,e)=>t<<8|e,Fb:t=>We.jb[t],ub(t,e){function r(t){return We.Sa--,e(t)}function n(t){if(t){if(!n.Bb)return n.Bb=!0,r(t)}else++i>=a.length&&r(null)}"function"==typeof t&&(e=t,t=!1),We.Sa++,1<We.Sa&&P(`warning: ${We.Sa} FS.syncfs operations in flight at once, probably just doing extra work`);var a=He(We.root.ga),i=0;a.forEach((e=>{if(!e.type.ub)return n(null);e.type.ub(e,t,n)}))},ga(t,e,r){var n="/"===r;if(n&&We.root)throw new We.Z(10);if(!n&&r){var a=Pe(r,{Pa:!1});if(r=a.path,(a=a.node).ta)throw new We.Z(10);if(!ke(a.mode))throw new We.Z(54)}return(t=t.ga(e={type:t,Mb:e,qb:r,La:[]})).ga=e,e.root=t,n?We.root=t:a&&(a.ta=e,a.ga&&a.ga.La.push(e)),t},wc(t){if(!(t=Pe(t,{Pa:!1})).node.ta)throw new We.Z(28);var e=(t=t.node).ta,r=He(e);Object.keys(We.va).forEach((t=>{for(t=We.va[t];t;){var e=t.Fa;r.includes(t.ga)&&Te(t),t=e}})),t.ta=null,t.ga.La.splice(t.ga.La.indexOf(e),1)},lookup:(t,e)=>t.aa.lookup(t,e),ya(t,e,r){var n=Pe(t,{parent:!0}).node;if(!(t=ne(t)))throw new We.Z(28);if("."===t||".."===t)throw new We.Z(20);var a=Fe(n,t);if(a)throw new We.Z(a);if(!n.aa.ya)throw new We.Z(63);return n.aa.ya(n,t,e,r)},tb:t=>Ie(Pe(t,{ra:!0}).node),uc:t=>Ie(t.node),create:(t,e=438)=>We.ya(t,4095&e|32768,0),mkdir:(t,e=511)=>We.ya(t,1023&e|16384,0),qc(t,e){var r,n=t.split("/"),a="";for(r of n)if(r){(a||"/"===t.charAt(0))&&(a+="/"),a+=r;try{We.mkdir(a,e)}catch(t){if(20!=t.Da)throw t}}},symlink(t,e){if(!ie(t))throw new We.Z(44);var r=Pe(e,{parent:!0}).node;if(!r)throw new We.Z(44);var n=Fe(r,e=ne(e));if(n)throw new We.Z(n);if(!r.aa.symlink)throw new We.Z(63);return r.aa.symlink(r,e,t)},rename(t,e){var r=re(t),n=re(e),a=ne(t),i=ne(e),o=Pe(t,{parent:!0}),s=o.node;if(o=(o=Pe(e,{parent:!0})).node,!s||!o)throw new We.Z(44);if(s.ga!==o.ga)throw new We.Z(75);var h=Se(s,a);if("."!==(t=oe(t,n)).charAt(0))throw new We.Z(28);if("."!==(t=oe(e,r)).charAt(0))throw new We.Z(55);try{var l=Se(o,i)}catch(t){}if(h!==l){if(a=je(s,a,e=ke(h.mode)))throw new We.Z(a);if(a=l?je(o,i,e):Fe(o,i))throw new We.Z(a);if(!s.aa.rename)throw new We.Z(63);if(h.ta||l&&l.ta)throw new We.Z(10);if(o!==s&&(a=xe(s,"w")))throw new We.Z(a);Te(h);try{s.aa.rename(h,o,i),h.parent=o}catch(t){throw t}finally{Ze(h)}}},rmdir(t){var e=Pe(t,{parent:!0}).node,r=Se(e,t=ne(t)),n=je(e,t,!0);if(n)throw new We.Z(n);if(!e.aa.rmdir)throw new We.Z(63);if(r.ta)throw new We.Z(10);e.aa.rmdir(e,t),Te(r)},readdir:t=>Ne((t=Pe(t,{ra:!0}).node).aa.readdir,54)(t),unlink(t){var e=Pe(t,{parent:!0}).node;if(!e)throw new We.Z(44);var r=Se(e,t=ne(t)),n=je(e,t,!1);if(n)throw new We.Z(n);if(!e.aa.unlink)throw new We.Z(63);if(r.ta)throw new We.Z(10);e.aa.unlink(e,t),Te(r)},readlink(t){if(!(t=Pe(t).node))throw new We.Z(44);if(!t.aa.readlink)throw new We.Z(28);return t.aa.readlink(t)},stat:(t,e)=>Ne((t=Pe(t,{ra:!e}).node).aa.sa,63)(t),fstat(t){var e=ze(t);t=e.node;var r=e.ba.sa;return e=r?e:t,r??=t.aa.sa,Ne(r,63),r(e)},lstat:t=>We.stat(t,!0),chmod(t,e,r){Ve(null,t="string"==typeof t?Pe(t,{ra:!r}).node:t,e,r)},lchmod(t,e){We.chmod(t,e,!0)},fchmod(t,e){Ve(t=ze(t),t.node,e,!1)},chown(t,e,r,n){Me(null,t="string"==typeof t?Pe(t,{ra:!n}).node:t,{timestamp:Date.now(),kb:n})},lchown(t,e,r){We.chown(t,e,r,!0)},fchown(t){Me(t=ze(t),t.node,{timestamp:Date.now(),kb:!1})},truncate(t,e){if(0>e)throw new We.Z(28);Be(null,t="string"==typeof t?Pe(t,{ra:!0}).node:t,e)},kc(t,e){if(t=ze(t),0>e||!(2097155&t.flags))throw new We.Z(28);Be(t,t.node,e)},xc(t,e,r){Ne((t=Pe(t,{ra:!0}).node).aa.ua,63)(t,{atime:e,mtime:r})},open(t,e,n=438){if(""===t)throw new We.Z(44);if("string"==typeof e){var a={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===a)throw Error(`Unknown file open mode: ${e}`);e=a}if(n=64&e?4095&n|32768:0,"object"==typeof t)a=t;else{var i=t.endsWith("/");a=(t=Pe(t,{ra:!(131072&e),Lb:!0})).node,t=t.path}var o=!1;if(64&e)if(a){if(128&e)throw new We.Z(20)}else{if(i)throw new We.Z(31);a=We.ya(t,511|n,0),o=!0}if(!a)throw new We.Z(44);if(8192==(61440&a.mode)&&(e&=-513),65536&e&&!ke(a.mode))throw new We.Z(54);if(!o&&(i=a?40960==(61440&a.mode)?32:ke(a.mode)&&("r"!==Ue(e)||576&e)?31:xe(a,Ue(e)):44))throw new We.Z(i);return 512&e&&!o&&We.truncate(a,0),e&=-131713,(i=De({node:a,path:Re(a),flags:e,seekable:!0,position:0,ba:a.ba,Sb:[],error:!1})).ba.open&&i.ba.open(i),o&&We.chmod(a,511&n),!r.logReadFiles||1&e||t in We.sb||(We.sb[t]=1),i},close(t){if(null===t.fd)throw new We.Z(8);t.Wa&&(t.Wa=null);try{t.ba.close&&t.ba.close(t)}catch(t){throw t}finally{We.streams[t.fd]=null}t.fd=null},na(t,e,r){if(null===t.fd)throw new We.Z(8);if(!t.seekable||!t.ba.na)throw new We.Z(70);if(0!=r&&1!=r&&2!=r)throw new We.Z(28);return t.position=t.ba.na(t,e,r),t.Sb=[],t.position},read(t,e,r,n,a){if(0>n||0>a)throw new We.Z(28);if(null===t.fd)throw new We.Z(8);if(1==(2097155&t.flags))throw new We.Z(8);if(ke(t.node.mode))throw new We.Z(31);if(!t.ba.read)throw new We.Z(28);var i=void 0!==a;if(i){if(!t.seekable)throw new We.Z(70)}else a=t.position;return e=t.ba.read(t,e,r,n,a),i||(t.position+=e),e},write(t,e,r,n,a,i){if(0>n||0>a)throw new We.Z(28);if(null===t.fd)throw new We.Z(8);if(!(2097155&t.flags))throw new We.Z(8);if(ke(t.node.mode))throw new We.Z(31);if(!t.ba.write)throw new We.Z(28);t.seekable&&1024&t.flags&&We.na(t,0,2);var o=void 0!==a;if(o){if(!t.seekable)throw new We.Z(70)}else a=t.position;return e=t.ba.write(t,e,r,n,a,i),o||(t.position+=e),e},Ha(t,e,r,n,a){if(2&n&&!(2&a)&&2!=(2097155&t.flags))throw new We.Z(2);if(1==(2097155&t.flags))throw new We.Z(2);if(!t.ba.Ha)throw new We.Z(43);if(!e)throw new We.Z(28);return t.ba.Ha(t,e,r,n,a)},Ma:(t,e,r,n,a)=>t.ba.Ma?t.ba.Ma(t,e,r,n,a):0,ob(t,e,r){if(!t.ba.ob)throw new We.Z(59);return t.ba.ob(t,e,r)},readFile(t,e={}){e.flags=e.flags||0,e.encoding=e.encoding||"binary","utf8"!==e.encoding&&"binary"!==e.encoding&&x(`Invalid encoding type "${e.encoding}"`);var r=We.open(t,e.flags);t=We.stat(t).size;var n=new Uint8Array(t);return We.read(r,n,0,t,0),"utf8"===e.encoding&&(n=se(n)),We.close(r),n},writeFile(t,e,r={}){r.flags=r.flags||577,t=We.open(t,r.flags,r.mode),"string"==typeof e&&(e=new Uint8Array(le(e))),ArrayBuffer.isView(e)?We.write(t,e,0,e.byteLength,void 0,r.bc):x("Unsupported data type"),We.close(t)},cwd:()=>We.gb,chdir(t){if(null===(t=Pe(t,{ra:!0})).node)throw new We.Z(44);if(!ke(t.node.mode))throw new We.Z(54);var e=xe(t.node,"x");if(e)throw new We.Z(e);We.gb=t.path},tc(){for(var t of(We.Xa=!1,We.streams))t&&We.close(t)},hc(t,e){try{var r=Pe(t,{ra:!e});t=r.path}catch(t){}var n=!1,a=null;try{r=Pe(t,{parent:!0}),ne(t),r=Pe(t,{ra:!e}),n=!0,a=r.node}catch(t){}return n?a:null},Aa(t,e,r,n){var a;return t=((t,e)=>ee(t+"/"+e))("string"==typeof t?t:Re(t),e),e=me(!!r,!!n),(a=We.Aa).$a??(a.$a=64),Ee(a=We.Ea(We.Aa.$a++,0),{open(t){t.seekable=!1},close(){n?.buffer?.length&&n(10)},read(t,e,n,a){for(var i=0,o=0;o<a;o++){try{var s=r()}catch(t){throw new We.Z(29)}if(void 0===s&&0===i)throw new We.Z(6);if(null==s)break;i++,e[n+o]=s}return i&&(t.node.atime=Date.now()),i},write(t,e,r,a){for(var i=0;i<a;i++)try{n(e[r+i])}catch(t){throw new We.Z(29)}return a&&(t.node.mtime=t.node.ctime=Date.now()),i}}),Le(t,e,a)}};if((()=>{let t=rt.prototype;Object.assign(t,{isAliasOf:function(t){if(!(this instanceof rt&&t instanceof rt))return!1;var e=this.$.ha.ea,r=this.$.fa;t.$=t.$;var n=t.$.ha.ea;for(t=t.$.fa;e.ma;)r=e.Oa(r),e=e.ma;for(;n.ma;)t=n.Oa(t),n=n.ma;return e===n&&r===t},clone:function(){if(this.$.fa||Q(this),this.$.Na)return this.$.count.value+=1,this;var t=et,e=Object,r=e.create,n=Object.getPrototypeOf(this),a=this.$;return(t=t(r.call(e,n,{$:{value:{count:a.count,Ka:a.Ka,Na:a.Na,fa:a.fa,ha:a.ha,ka:a.ka,oa:a.oa}}}))).$.count.value+=1,t.$.Ka=!1,t},delete(){if(this.$.fa||Q(this),this.$.Ka&&!this.$.Na)throw new q("Object already scheduled for deletion");tt(this);var t=this.$;--t.count.value,0===t.count.value&&(t.ka?t.oa.Ba(t.ka):t.ha.ea.Ba(t.fa)),this.$.Na||(this.$.ka=void 0,this.$.fa=void 0)},isDeleted:function(){return!this.$.fa},deleteLater:function(){if(this.$.fa||Q(this),this.$.Ka&&!this.$.Na)throw new q("Object already scheduled for deletion");return this.$.Ka=!0,this}});const e=Symbol.dispose;e&&(t[e]=t.delete)})(),Object.assign(yt.prototype,{Gb(t){return this.rb&&(t=this.rb(t)),t},ib(t){this.Ba?.(t)},za:ft,la:function(t){function e(){return vt(this.ea.Ga,this.Ra?{ha:this.Nb,fa:r,oa:this,ka:t}:{ha:this,fa:t})}var r=this.Gb(t);if(!r)return this.ib(t),null;var n=((t,e)=>{if(void 0===e)throw new q("ptr should not be undefined");for(;t.ma;)e=t.Oa(e),t=t.ma;return wt[e]})(this.ea,r);if(void 0!==n)return 0===n.$.count.value?(n.$.fa=r,n.$.ka=t,n.clone()):(n=n.clone(),this.ib(t),n);if(n=this.ea.Eb(r),!(n=at[n]))return e.call(this);var a=pt(r,this.ea,(n=this.Qa?n.zb:n.pointerType).ea);return null===a?e.call(this):vt(n.ea.Ga,this.Ra?{ha:n,fa:a,oa:this,ka:t}:{ha:n,fa:a})}}),We.cc=(t,e,r,n,a,i,o,s,h,l)=>{Ae(t,e,r,n,a,s,h,l).then(i).catch(o)},We.sc=Ae,We.va=Array(4096),We.ga(we,{},"/"),We.mkdir("/tmp"),We.mkdir("/home"),We.mkdir("/home/web_user"),function(){We.mkdir("/dev"),Ee(We.Ea(1,3),{read:()=>0,write:(t,e,r,n)=>n,na:()=>0}),Le("/dev/null",We.Ea(1,3)),ue(We.Ea(5,0),fe),ue(We.Ea(6,0),pe),Le("/dev/tty",We.Ea(5,0)),Le("/dev/tty1",We.Ea(6,0));var t=new Uint8Array(1024),e=0,r=()=>(0===e&&(ae(t),e=t.byteLength),t[--e]);We.Aa("/dev","random",r),We.Aa("/dev","urandom",r),We.mkdir("/dev/shm"),We.mkdir("/dev/shm/tmp")}(),function(){We.mkdir("/proc");var t=We.mkdir("/proc/self");We.mkdir("/proc/self/fd"),We.ga({ga(){var e=We.createNode(t,"fd",16895,73);return e.ba={na:we.ba.na},e.aa={lookup(t,e){var r=ze(t=+e);return(t={parent:null,ga:{qb:"fake"},aa:{readlink:()=>r.path},id:t+1}).parent=t},readdir:()=>Array.from(We.streams.entries()).filter((([,t])=>t)).map((([t])=>t.toString()))},e}},{},"/proc/self/fd")}(),We.Db={MEMFS:we},r.noExitRuntime&&(M=r.noExitRuntime),r.preloadPlugins&&($e=r.preloadPlugins),r.print&&(C=r.print),r.printErr&&(P=r.printErr),r.wasmBinary&&(f=r.wasmBinary),r.preInit)for("function"==typeof r.preInit&&(r.preInit=[r.preInit]);0<r.preInit.length;)r.preInit.shift()();r.addRunDependency=be,r.removeRunDependency=ge,r.FS_preloadFile=Ae,r.FS_unlink=(...t)=>We.unlink(...t),r.FS_createPath=(...t)=>function(t,e){for(t="string"==typeof t?t:Re(t),e=e.split("/").reverse();e.length;){var r=e.pop();if(r){var n=ee(t+"/"+r);try{We.mkdir(n)}catch(t){if(20!=t.Da)throw t}t=n}}return n}(...t),r.FS_createDevice=(...t)=>We.Aa(...t),r.FS=We,r.FS_createDataFile=(...t)=>Ce(...t),r.FS_createLazyFile=(...t)=>function(t,e,r,n,i){class o{Ua=!1;xa=[];Ta=void 0;hb=0;eb=0;get(t){if(!(t>this.length-1||0>t)){var e=t%this.chunkSize;return this.Ta(t/this.chunkSize|0)[e]}}Cb(t){this.Ta=t}lb(){var t=new XMLHttpRequest;t.open("HEAD",r,!1),t.send(null),200<=t.status&&300>t.status||304===t.status||x("Couldn't load "+r+". Status: "+t.status);var e,n=Number(t.getResponseHeader("Content-length")),a=(e=t.getResponseHeader("Accept-Ranges"))&&"bytes"===e;t=(e=t.getResponseHeader("Content-Encoding"))&&"gzip"===e;var i=1048576;a||(i=n);var o=this;o.Cb((t=>{var e=t*i,a=(t+1)*i-1;if(a=Math.min(a,n-1),void 0===o.xa[t]){var s=o.xa;e>a&&x("invalid range ("+e+", "+a+") or no bytes requested!"),a>n-1&&x("