@thorvg/lottie-player
Version:
A web lottie player using ThorVG as a renderer
1 lines • 66.4 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 i=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 a=(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"),i=t.litNonce;void 0!==i&&n.setAttribute("nonce",i),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 i("string"==typeof t?t:t+"",void 0,r))(e)})(t):t,{is:s,defineProperty:h,getOwnPropertyDescriptor:l,getOwnPropertyNames:u,getOwnPropertySymbols:c,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:i}=l(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return n?.call(this)},set(e){const a=n?.call(this);i.call(this,e),this.requestUpdate(t,a,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=[...u(t),...c(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 a(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 i=(void 0!==r.converter?.toAttribute?r.converter:y).toAttribute(e,r.type);this._$Em=t,null==i?this.removeAttribute(n):this.setAttribute(n,i),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),i="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:y;this._$Em=n,this[n]=i.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 _={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:g},A=(t=_,e,r)=>{const{kind:n,metadata:i}=r;let a=globalThis.litPropertyMetadata.get(i);if(void 0===a&&globalThis.litPropertyMetadata.set(i,a=new Map),a.set(r.name,t),"accessor"===n){const{name:n}=r;return{set(r){const i=e.get.call(this);e.set.call(this,r),this.requestUpdate(n,i,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 i=this[n];e.call(this,r),this.requestUpdate(n,i,t)}}throw Error("Unsupported decorator location: "+n)};function S(t){return(e,r)=>"object"==typeof r?A(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 E=globalThis,k=E.trustedTypes,L=k?k.createPolicy("lit-html",{createHTML:t=>t}):void 0,P="$lit$",T=`lit$${Math.random().toFixed(9).slice(2)}$`,O="?"+T,R=`<${O}>`,M=document,N=()=>M.createComment(""),C=t=>null===t||"object"!=typeof t&&"function"!=typeof t,U=Array.isArray,x="[ \t\n\f\r]",F=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,j=/-->/g,V=/>/g,z=RegExp(`>|${x}(?:([^\\s"'>=/]+)(${x}*=${x}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),D=/'/g,H=/"/g,I=/^(?:script|style|textarea|title)$/i,W=(t,...e)=>({_$litType$:1,strings:t,values:e}),B=Symbol.for("lit-noChange"),G=Symbol.for("lit-nothing"),q=new WeakMap,X=M.createTreeWalker(M,129);function Z(t,e){if(!U(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==L?L.createHTML(e):e}class Y{constructor({strings:t,_$litType$:e},r){let n;this.parts=[];let i=0,a=0;const o=t.length-1,s=this.parts,[h,l]=((t,e)=>{const r=t.length-1,n=[];let i,a=2===e?"<svg>":3===e?"<math>":"",o=F;for(let e=0;e<r;e++){const r=t[e];let s,h,l=-1,u=0;for(;u<r.length&&(o.lastIndex=u,h=o.exec(r),null!==h);)u=o.lastIndex,o===F?"!--"===h[1]?o=j:void 0!==h[1]?o=V:void 0!==h[2]?(I.test(h[2])&&(i=RegExp("</"+h[2],"g")),o=z):void 0!==h[3]&&(o=z):o===z?">"===h[0]?(o=i??F,l=-1):void 0===h[1]?l=-2:(l=o.lastIndex-h[2].length,s=h[1],o=void 0===h[3]?z:'"'===h[3]?H:D):o===H||o===D?o=z:o===j||o===V?o=F:(o=z,i=void 0);const c=o===z&&t[e+1].startsWith("/>")?" ":"";a+=o===F?r+R:l>=0?(n.push(s),r.slice(0,l)+P+r.slice(l)+T+c):r+T+(-2===l?e:c)}return[Z(t,a+(t[r]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),n]})(t,e);if(this.el=Y.createElement(h,r),X.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(n=X.nextNode())&&s.length<o;){if(1===n.nodeType){if(n.hasAttributes())for(const t of n.getAttributeNames())if(t.endsWith(P)){const e=l[a++],r=n.getAttribute(t).split(T),o=/([.?@])?(.*)/.exec(e);s.push({type:1,index:i,name:o[2],strings:r,ctor:"."===o[1]?et:"?"===o[1]?rt:"@"===o[1]?nt:tt}),n.removeAttribute(t)}else t.startsWith(T)&&(s.push({type:6,index:i}),n.removeAttribute(t));if(I.test(n.tagName)){const t=n.textContent.split(T),e=t.length-1;if(e>0){n.textContent=k?k.emptyScript:"";for(let r=0;r<e;r++)n.append(t[r],N()),X.nextNode(),s.push({type:2,index:++i});n.append(t[e],N())}}}else if(8===n.nodeType)if(n.data===O)s.push({type:2,index:i});else{let t=-1;for(;-1!==(t=n.data.indexOf(T,t+1));)s.push({type:7,index:i}),t+=T.length-1}i++}}static createElement(t,e){const r=M.createElement("template");return r.innerHTML=t,r}}function J(t,e,r=t,n){if(e===B)return e;let i=void 0!==n?r.o?.[n]:r.l;const a=C(e)?void 0:e._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),void 0===a?i=void 0:(i=new a(t),i._$AT(t,r,n)),void 0!==n?(r.o??=[])[n]=i:r.l=i),void 0!==i&&(e=J(t,i._$AS(t,e.values),i,n)),e}class K{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??M).importNode(e,!0);X.currentNode=n;let i=X.nextNode(),a=0,o=0,s=r[0];for(;void 0!==s;){if(a===s.index){let e;2===s.type?e=new Q(i,i.nextSibling,this,t):1===s.type?e=new s.ctor(i,s.name,s.strings,this,t):6===s.type&&(e=new it(i,this,t)),this._$AV.push(e),s=r[++o]}a!==s?.index&&(i=X.nextNode(),a++)}return X.currentNode=M,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 Q{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=J(this,t,e),C(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=>U(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&&C(this._$AH)?this._$AA.nextSibling.data=t:this.T(M.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=Y.createElement(Z(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new K(n,this),r=t.u(this.options);t.p(e),this.T(r),this._$AH=t}}_$AC(t){let e=q.get(t.strings);return void 0===e&&q.set(t.strings,e=new Y(t)),e}k(t){U(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,n=0;for(const i of t)n===e.length?e.push(r=new Q(this.O(N()),this.O(N()),this,this.options)):r=e[n],r._$AI(i),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,i){this.type=1,this._$AH=G,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=i,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 i=this.strings;let a=!1;if(void 0===i)t=J(this,t,e,0),a=!C(t)||t!==this._$AH&&t!==B,a&&(this._$AH=t);else{const n=t;let o,s;for(t=i[0],o=0;o<i.length-1;o++)s=J(this,n[r+o],e,o),s===B&&(s=this._$AH[o]),a||=!C(s)||s!==this._$AH[o],s===G?t=G:t!==G&&(t+=(s??"")+i[o+1]),this._$AH[o]=s}a&&!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,i){super(t,e,r,n,i),this.type=5}_$AI(t,e=this){if((t=J(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,i=t!==G&&(r===G||n);n&&this.element.removeEventListener(this.name,this,r),i&&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 it{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){J(this,t)}}const at=E.litHtmlPolyfillSupport;at?.(Y,Q),(E.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 i=n._$litPart$;if(void 0===i){const t=r?.renderBefore??null;n._$litPart$=i=new Q(e.insertBefore(N(),t),t,void 0,r??{})}return i._$AI(t),i})(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 i,a=arguments.length,o=a<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--)(i=t[s])&&(o=(a<3?i(o):a>3?i(e,r,o):i(e,r))||o);return a>3&&o&&Object.defineProperty(e,r,o),o}st?.({LitElement:ot}),(globalThis.litElementVersions??=[]).push("4.1.0");let lt=null,ut=!1;var ct,dt,ft,pt,wt,mt;!function(t){t.SW="sw",t.WG="wg",t.GL="gl"}(ct||(ct={})),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(ut)for(;!lt;)await vt(100);if(lt||(ut=!0,lt=await async function(t={}){var e,r=t,n=!!globalThis.window,i=!!globalThis.WorkerGlobalScope,a=globalThis.process?.versions?.node&&"renderer"!=globalThis.process?.type;if(a){const{createRequire:t}=await Promise.resolve().then((function(){return _t}));var o=t(import.meta.url)}var s,h,l=(t,e)=>{throw e},u=import.meta.url,c="";if(a){var d=o("fs");u.startsWith("file:")&&(c=o("path").dirname(o("url").fileURLToPath(u))+"/"),h=t=>(t=R(t)?new URL(t):t,d.readFileSync(t)),s=async t=>(t=R(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||i){try{c=new URL(".",u).href}catch{}i&&(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(R(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,S,E,k,L,P=void 0,T=void 0,O=!1,R=t=>t.startsWith("file://"),M=!1;function N(){var t=Je.buffer;v=new Int8Array(t),g=new Int16Array(t),y=new Uint8Array(t),b=new Uint16Array(t),$=new Int32Array(t),_=new Uint32Array(t),A=new Float32Array(t),S=new Float64Array(t),E=new BigInt64Array(t),k=new BigUint64Array(t)}function C(t){throw r.onAbort?.(t),T(t="Aborted("+t+")"),O=!0,t=new WebAssembly.RuntimeError(t+". Build with -sASSERTIONS for more info."),m?.(t),t}class U{name="ExitStatus";constructor(t){this.message=`Program terminated with exit(${t})`,this.status=t}}var x=t=>{for(;0<t.length;)t.shift()(r)},F=[],j=[],V=()=>{var t=r.preRun.shift();j.push(t)},z=!0,D=t=>{for(var e="";;){var r=y[t++];if(!r)return e;e+=String.fromCharCode(r)}},H={},I={},W={},B=class extends Error{constructor(t){super(t),this.name="BindingError"}},G=t=>{throw new B(t)};function q(t,e,r={}){return function(t,e,r={}){var n=e.name;if(!t)throw new B(`type "${n}" must have a positive integer typeid pointer`);if(I.hasOwnProperty(t)){if(r.vb)return;throw new B(`Cannot register type '${n}' twice`)}I[t]=e,delete W[t],H.hasOwnProperty(t)&&(e=H[t],delete H[t],e.forEach((t=>t())))}(t,e,r)}var X=(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=>_[t>>2];case 8:return r?t=>E[t>>3]:t=>k[t>>3];default:throw new TypeError(`invalid integer width (${e}): ${t}`)}},Z=t=>{throw new B(t.M.U.R.name+" instance already deleted")},Y=!1,J=()=>{},K=t=>globalThis.FinalizationRegistry?(Y=new FinalizationRegistry((t=>{--(t=t.M).count.value,0===t.count.value&&(t.X?t.aa.oa(t.X):t.U.R.oa(t.S))})),K=t=>{var e=t.M;return e.X&&Y.register(t,{M:e},t),t},J=t=>{Y.unregister(t)},K(t)):(K=t=>t,t);function Q(){}var tt=(t,e)=>Object.defineProperty(e,"name",{value:t}),et={},rt=(t,e,r)=>{if(void 0===t[e].W){var n=t[e];t[e]=function(...n){if(!t[e].W.hasOwnProperty(n.length))throw new B(`Function '${r}' called with an invalid number of arguments (${n.length}) - expects one of (${t[e].W})!`);return t[e].W[n.length].apply(this,n)},t[e].W=[],t[e].W[n.wa]=n}},nt=(t,e,n)=>{if(r.hasOwnProperty(t)){if(void 0===n||void 0!==r[t].W&&void 0!==r[t].W[n])throw new B(`Cannot register public name '${t}' twice`);if(rt(r,t,t),r[t].W.hasOwnProperty(n))throw new B(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`);r[t].W[n]=e}else r[t]=e,r[t].wa=n};function it(t,e,r,n,i,a,o,s){this.name=t,this.constructor=e,this.ta=r,this.oa=n,this.Z=i,this.rb=a,this.Ba=o,this.ob=s,this.Bb=[]}var at=(t,e,r)=>{for(;e!==r;){if(!e.Ba)throw new B(`Expected null or instance of ${r.name}, got an instance of ${e.name}`);t=e.Ba(t),e=e.Z}return t},ot=t=>{if(null===t)return"null";var e=typeof t;return"object"===e||"array"===e||"function"===e?t.toString():""+t};function st(t,e){if(null===e){if(this.La)throw new B(`null is not a valid ${this.name}`);return 0}if(!e.M)throw new B(`Cannot pass "${ot(e)}" as a ${this.name}`);if(!e.M.S)throw new B(`Cannot pass deleted object as a pointer of type ${this.name}`);return at(e.M.S,e.M.U.R,this.R)}function ht(t,e){if(null===e){if(this.La)throw new B(`null is not a valid ${this.name}`);if(this.Ea){var r=this.Cb();return null!==t&&t.push(this.oa,r),r}return 0}if(!e||!e.M)throw new B(`Cannot pass "${ot(e)}" as a ${this.name}`);if(!e.M.S)throw new B(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.Da&&e.M.U.Da)throw new B(`Cannot convert argument of type ${e.M.aa?e.M.aa.name:e.M.U.name} to parameter type ${this.name}`);if(r=at(e.M.S,e.M.U.R,this.R),this.Ea){if(void 0===e.M.X)throw new B("Passing raw pointer to smart pointer is illegal");switch(this.Eb){case 0:if(e.M.aa!==this)throw new B(`Cannot convert argument of type ${e.M.aa?e.M.aa.name:e.M.U.name} to parameter type ${this.name}`);r=e.M.X;break;case 1:r=e.M.X;break;case 2:if(e.M.aa===this)r=e.M.X;else{var n=e.clone();r=this.Db(r,Mt((()=>n.delete()))),null!==t&&t.push(this.oa,r)}break;default:throw new B("Unsupporting sharing policy")}}return r}function lt(t,e){if(null===e){if(this.La)throw new B(`null is not a valid ${this.name}`);return 0}if(!e.M)throw new B(`Cannot pass "${ot(e)}" as a ${this.name}`);if(!e.M.S)throw new B(`Cannot pass deleted object as a pointer of type ${this.name}`);if(e.M.U.Da)throw new B(`Cannot convert argument of type ${e.M.U.name} to parameter type ${this.name}`);return at(e.M.S,e.M.U.R,this.R)}function ut(t){return this.Y(_[t>>2])}var ct=(t,e,r)=>e===r?t:void 0===r.Z||null===(t=ct(t,e,r.Z))?null:r.ob(t),dt={},ft=class extends Error{constructor(t){super(t),this.name="InternalError"}},pt=(t,e)=>{if(!e.U||!e.S)throw new ft("makeClassHandle requires ptr and ptrType");if(!!e.aa!=!!e.X)throw new ft("Both smartPtrType and smartPtr must be specified");return e.count={value:1},K(Object.create(t,{M:{value:e,writable:!0}}))};function wt(t,e,r,n,i,a,o,s,h,l,u){this.name=t,this.R=e,this.La=r,this.Da=n,this.Ea=i,this.Ab=a,this.Eb=o,this.eb=s,this.Cb=h,this.Db=l,this.oa=u,i||void 0!==e.Z?this.ba=ht:(this.ba=n?st:lt,this.da=null)}var mt=(t,e,n)=>{if(!r.hasOwnProperty(t))throw new ft("Replacing nonexistent public symbol");void 0!==r[t].W&&void 0!==n?r[t].W[n]=e:(r[t]=e,r[t].wa=n)},vt=(t,e)=>{t=D(t);var r=Ke.get(e);if("function"!=typeof r)throw new B(`unknown function pointer with signature ${t}: ${e}`);return r};class yt extends Error{}var gt=t=>{t=Ze(t);var e=D(t);return qe(t),e},bt=(t,e)=>{var r=[],n={};throw e.forEach((function t(e){n[e]||I[e]||(W[e]?W[e].forEach(t):(r.push(e),n[e]=!0))})),new yt(`${t}: `+r.map(gt).join([", "]))},$t=(t,e,r)=>{function n(e){if((e=r(e)).length!==t.length)throw new ft("Mismatched type converter count");for(var n=0;n<t.length;++n)q(t[n],e[n])}t.forEach((t=>W[t]=e));var i=Array(e.length),a=[],o=0;e.forEach(((t,e)=>{I.hasOwnProperty(t)?i[e]=I[t]:(a.push(t),H.hasOwnProperty(t)||(H[t]=[]),H[t].push((()=>{i[e]=I[t],++o===a.length&&n(i)})))})),0===a.length&&n(i)},At=(t,e)=>{for(var r=[],n=0;n<t;n++)r.push(_[e+4*n>>2]);return r},St=t=>{for(;t.length;){var e=t.pop();t.pop()(e)}};function Et(t){for(var e=1;e<t.length;++e)if(null!==t[e]&&void 0===t[e].da)return!0;return!1}function kt(t,e,r,n,i,a){var o=e.length;if(2>o)throw new B("argTypes array size mismatch! Must at least get return value and 'this' types!");var s=null!==e[1]&&null!==r,h=Et(e);r=!e[0].bb;var l=e[0],u=e[1];for(n=[t,G,n,i,St,l.Y.bind(l),u?.ba.bind(u)],i=2;i<o;++i)n.push((l=e[i]).ba.bind(l));if(!h)for(i=s?1:2;i<e.length;++i)null!==e[i].da&&n.push(e[i].da);for(h=Et(e),i=e.length-2,u=[],l=["fn"],s&&l.push("thisWired"),o=0;o<i;++o)u.push(`arg${o}`),l.push(`arg${o}Wired`);u=u.join(","),l=l.join(","),u=`return function (${u}) {\n`,h&&(u+="var destructors = [];\n");var c=h?"destructors":"null",d="humanName throwBindingError invoker fn runDestructors fromRetWire toClassParamWire".split(" ");for(s&&(u+=`var thisWired = toClassParamWire(${c}, this);\n`),o=0;o<i;++o){var f=`toArg${o}Wire`;u+=`var arg${o}Wired = ${f}(${c}, arg${o});\n`,d.push(f)}if(u+=(r||a?"var rv = ":"")+`invoker(${l});\n`,h)u+="runDestructors(destructors);\n";else for(o=s?1:2;o<e.length;++o)a=1===o?"thisWired":"arg"+(o-2)+"Wired",null!==e[o].da&&(u+=`${a}_dtor(${a});\n`,d.push(`${a}_dtor`));return r&&(u+="var ret = fromRetWire(rv);\nreturn ret;\n"),e=new Function(d,u+"}\n")(...n),tt(t,e)}var Lt=t=>{const e=(t=t.trim()).indexOf("(");return-1===e?t:t.slice(0,e)},Pt=[],Tt=[0,1,,1,null,1,!0,1,!1,1],Ot=t=>{9<t&&0==--Tt[t+1]&&(Tt[t]=void 0,Pt.push(t))},Rt=t=>{if(!t)throw new B(`Cannot use deleted val. handle = ${t}`);return Tt[t]},Mt=t=>{switch(t){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:const e=Pt.pop()||Tt.length;return Tt[e]=t,Tt[e+1]=1,e}},Nt={name:"emscripten::val",Y:t=>{var e=Rt(t);return Ot(t),e},ba:(t,e)=>Mt(e),ma:ut,da:null},Ct=(t,e)=>{switch(e){case 4:return function(t){return this.Y(A[t>>2])};case 8:return function(t){return this.Y(S[t>>3])};default:throw new TypeError(`invalid float width (${e}): ${t}`)}},Ut=(t,e,r,n)=>{if(!(0<n))return 0;var i=r;n=r+n-1;for(var a=0;a<t.length;++a){var o=t.codePointAt(a);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,a++}}return e[r]=0,r-i},xt=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},Ft=new TextDecoder,jt=(t,e,r,n)=>{if(r=e+r,n)return r;for(;t[e]&&!(e>=r);)++e;return e},Vt=new TextDecoder("utf-16le"),zt=(t,e,r)=>Vt.decode(b.subarray(t>>=1,jt(b,t,e/2,r))),Dt=(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 i=0;i<r;++i)g[e>>1]=t.charCodeAt(i),e+=2;return g[e>>1]=0,e-n},Ht=t=>2*t.length,It=(t,e,r)=>{var n="";t>>=2;for(var i=0;!(i>=e/4);i++){var a=_[t+i];if(!a&&!r)break;n+=String.fromCodePoint(a)}return n},Wt=(t,e,r)=>{if(r??=2147483647,4>r)return 0;var n=e;r=n+r-4;for(var i=0;i<t.length;++i){var a=t.codePointAt(i);if(65535<a&&i++,$[e>>2]=a,(e+=4)+4>r)break}return $[e>>2]=0,e-n},Bt=t=>{for(var e=0,r=0;r<t.length;++r)65535<t.codePointAt(r)&&r++,e+=4;return e},Gt=0,qt=[],Xt=(t,e,r)=>{var n=[];return t=t(n,r),n.length&&(_[e>>2]=Mt(n)),t},Zt={},Yt=t=>{var e=Zt[t];return void 0===e?D(t):e},Jt={},Kt=t=>{p=t,z||0<Gt||(r.onExit?.(t),O=!0),l(t,new U(t))},Qt=(t,e)=>{for(var r=0,n=t.length-1;0<=n;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(t.splice(n,1),r++):r&&(t.splice(n,1),r--)}if(e)for(;r;r--)t.unshift("..");return t},te=t=>{var e="/"===t.charAt(0),r="/"===t.slice(-1);return(t=Qt(t.split("/").filter((t=>!!t)),!e).join("/"))||e||(t="."),t&&r&&(t+="/"),(e?"/":"")+t},ee=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):"."},re=t=>t&&t.match(/([^\/]+|\/)\/*$/)[1],ne=t=>{(ne=(()=>{if(a){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]:Ge.cwd()))throw new TypeError("Arguments to path.resolve must be strings");if(!r)return"";e=r+"/"+e,r="/"===r.charAt(0)}return e=Qt(e.split("/").filter((t=>!!t)),!r).join("/"),(r?"/":"")+e||"."},ae=(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),i=n,a=0;a<n;a++)if(t[a]!==e[a]){i=a;break}for(n=[],a=i;a<t.length;a++)n.push("..");return(n=n.concat(e.slice(i))).join("/")},oe=t=>{var e=jt(t,0);return Ft.decode(t.buffer?t.subarray(0,e):new Uint8Array(t.slice(0,e)))},se=[],he=t=>{var e=Array(xt(t)+1);return t=Ut(t,e,0,e.length),e.length=t,e},le=[];function ue(t,e){le[t]={input:[],output:[],va:e},Ae(t,ce)}var ce={open(t){var e=le[t.node.rdev];if(!e)throw new Ge.L(43);t.tty=e,t.seekable=!1},close(t){t.tty.va.fsync(t.tty)},fsync(t){t.tty.va.fsync(t.tty)},read(t,e,r,n){if(!t.tty||!t.tty.va.Za)throw new Ge.L(60);for(var i=0,a=0;a<n;a++){try{var o=t.tty.va.Za(t.tty)}catch(t){throw new Ge.L(29)}if(void 0===o&&0===i)throw new Ge.L(6);if(null==o)break;i++,e[r+a]=o}return i&&(t.node.atime=Date.now()),i},write(t,e,r,n){if(!t.tty||!t.tty.va.Pa)throw new Ge.L(60);try{for(var i=0;i<n;i++)t.tty.va.Pa(t.tty,e[r+i])}catch(t){throw new Ge.L(29)}return n&&(t.node.mtime=t.node.ctime=Date.now()),i}},de={Za(){t:{if(!se.length){var t=null;if(a){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}se=he(t)}t=se.shift()}return t},Pa(t,e){null===e||10===e?(P(oe(t.output)),t.output=[]):0!=e&&t.output.push(e)},fsync(t){0<t.output?.length&&(P(oe(t.output)),t.output=[])},Zb:()=>({Mb:25856,Ob:5,Lb:191,Nb:35387,Kb:[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]}),$b:()=>0,ac:()=>[24,80]},fe={Pa(t,e){null===e||10===e?(T(oe(t.output)),t.output=[]):0!=e&&t.output.push(e)},fsync(t){0<t.output?.length&&(T(oe(t.output)),t.output=[])}},pe={ja:null,T:()=>pe.createNode(null,"/",16895,0),createNode(t,e,r,n){if(24576==(61440&r)||Ge.isFIFO(r))throw new Ge.L(63);return pe.ja||(pe.ja={dir:{node:{fa:pe.N.fa,ha:pe.N.ha,lookup:pe.N.lookup,la:pe.N.la,rename:pe.N.rename,unlink:pe.N.unlink,rmdir:pe.N.rmdir,readdir:pe.N.readdir,symlink:pe.N.symlink},stream:{$:pe.O.$}},file:{node:{fa:pe.N.fa,ha:pe.N.ha},stream:{$:pe.O.$,read:pe.O.read,write:pe.O.write,ua:pe.O.ua,za:pe.O.za}},link:{node:{fa:pe.N.fa,ha:pe.N.ha,readlink:pe.N.readlink},stream:{}},Ua:{node:{fa:pe.N.fa,ha:pe.N.ha},stream:Ge.mb}}),Se((r=Ge.createNode(t,e,r,n)).mode)?(r.N=pe.ja.dir.node,r.O=pe.ja.dir.stream,r.P={}):Ge.isFile(r.mode)?(r.N=pe.ja.file.node,r.O=pe.ja.file.stream,r.V=0,r.P=null):40960==(61440&r.mode)?(r.N=pe.ja.link.node,r.O=pe.ja.link.stream):8192==(61440&r.mode)&&(r.N=pe.ja.Ua.node,r.O=pe.ja.Ua.stream),r.atime=r.mtime=r.ctime=Date.now(),t&&(t.P[e]=r,t.atime=t.mtime=t.ctime=r.atime),r},Yb:t=>t.P?t.P.subarray?t.P.subarray(0,t.V):new Uint8Array(t.P):new Uint8Array(0),N:{fa(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=Se(t.mode)?4096:Ge.isFile(t.mode)?t.V: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},ha(t,e){for(var r of["mode","atime","mtime","ctime"])null!=e[r]&&(t[r]=e[r]);void 0!==e.size&&t.V!=(e=e.size)&&(0==e?(t.P=null,t.V=0):(r=t.P,t.P=new Uint8Array(e),r&&t.P.set(r.subarray(0,Math.min(e,t.V))),t.V=e))},lookup(){throw pe.Ia||(pe.Ia=new Ge.L(44),pe.Ia.stack="<generic error, no stack>"),pe.Ia},la:(t,e,r,n)=>pe.createNode(t,e,r,n),rename(t,e,r){try{var n=Ee(e,r)}catch(t){}if(n){if(Se(t.mode))for(var i in n.P)throw new Ge.L(55);ke(n)}delete t.parent.P[t.name],e.P[r]=t,t.name=r,e.ctime=e.mtime=t.parent.ctime=t.parent.mtime=Date.now()},unlink(t,e){delete t.P[e],t.ctime=t.mtime=Date.now()},rmdir(t,e){var r,n=Ee(t,e);for(r in n.P)throw new Ge.L(55);delete t.P[e],t.ctime=t.mtime=Date.now()},readdir:t=>[".","..",...Object.keys(t.P)],symlink:(t,e,r)=>((t=pe.createNode(t,e,41471,0)).link=r,t),readlink(t){if(40960!=(61440&t.mode))throw new Ge.L(28);return t.link}},O:{read(t,e,r,n,i){var a=t.node.P;if(i>=t.node.V)return 0;if(8<(t=Math.min(t.node.V-i,n))&&a.subarray)e.set(a.subarray(i,i+t),r);else for(n=0;n<t;n++)e[r+n]=a[i+n];return t},write(t,e,r,n,i,a){if(e.buffer===v.buffer&&(a=!1),!n)return 0;if((t=t.node).mtime=t.ctime=Date.now(),e.subarray&&(!t.P||t.P.subarray)){if(a)return t.P=e.subarray(r,r+n),t.V=n;if(0===t.V&&0===i)return t.P=e.slice(r,r+n),t.V=n;if(i+n<=t.V)return t.P.set(e.subarray(r,r+n),i),n}var o=t.P?t.P.length:0;if(o>=(a=i+n)||(a=Math.max(a,o*(1048576>o?2:1.125)>>>0),0!=o&&(a=Math.max(a,256)),o=t.P,t.P=new Uint8Array(a),0<t.V&&t.P.set(o.subarray(0,t.V),0)),t.P.subarray&&e.subarray)t.P.set(e.subarray(r,r+n),i);else for(a=0;a<n;a++)t.P[i+a]=e[r+a];return t.V=Math.max(t.V,i+n),n},$(t,e,r){if(1===r?e+=t.position:2===r&&Ge.isFile(t.node.mode)&&(e+=t.node.V),0>e)throw new Ge.L(28);return e},ua(t,e,r,n,i){if(!Ge.isFile(t.node.mode))throw new Ge.L(43);if(t=t.node.P,2&i||!t||t.buffer!==v.buffer){if(n=!0,C(),!(i=void 0))throw new Ge.L(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,i))}else n=!1,i=t.byteOffset;return{S:i,Gb:n}},za:(t,e,r,n)=>(pe.O.write(t,e,0,n,r,!1),0)}},we=(t,e)=>{var r=0;return t&&(r|=365),e&&(r|=146),r},me=0,ve=null,ye=()=>{if(me--,r.monitorRunDependencies?.(me),0==me&&ve){var t=ve;ve=null,t()}},ge=()=>{me++,r.monitorRunDependencies?.(me)},be=[],$e=async(t,e,r,n,i,a,o,h)=>{var l=e?ie(te(t+"/"+e)):t;ge();try{var u=r;"string"==typeof r&&(u=await(async t=>(t=await s(t),new Uint8Array(t)))(r)),u=await(async(t,e)=>{for(var r of("undefined"!=typeof Browser&&_e(),be))if(r.canHandle(e))return r.handle(t,e);return t})(u,l),h?.(),a||Le(t,e,u,n,i,o)}finally{ye()}};function _e(){var t,e,n;Ge.Ka=!0,t??=r.stdin,e??=r.stdout,n??=r.stderr,t?Ge.na("/dev","stdin",t):Ge.symlink("/dev/tty","/dev/stdin"),e?Ge.na("/dev","stdout",null,e):Ge.symlink("/dev/tty","/dev/stdout"),n?Ge.na("/dev","stderr",null,n):Ge.symlink("/dev/tty1","/dev/stderr"),Ge.open("/dev/stdin",0),Ge.open("/dev/stdout",1),Ge.open("/dev/stderr",1)}function Ae(t,e){Ge.Xa[t]={O:e}}function Se(t){return 16384==(61440&t)}function Ee(t,e){var r=Se(t.mode)?(r=Ne(t,"x"))?r:t.N.lookup?0:2:54;if(r)throw new Ge.L(r);for(r=Ge.ia[Oe(t.id,e)];r;r=r.sa)if(r.parent.id===t.id&&r.name===e)return r;return Ge.lookup(t,e)}function ke(t){var e=Oe(t.parent.id,t.name);if(Ge.ia[e]===t)Ge.ia[e]=t.sa;else for(e=Ge.ia[e];e;){if(e.sa===t){e.sa=t.sa;break}e=e.sa}}function Le(t,e,r,n,i,a){var o=e;if(t&&(t="string"==typeof t?t:Te(t),o=e?te(t+"/"+e):t),t=we(n,i),o=Ge.create(o,t),r){if("string"==typeof r){for(e=Array(r.length),n=0,i=r.length;n<i;++n)e[n]=r.charCodeAt(n);r=e}Ge.chmod(o,146|t),e=Ge.open(o,577),Ge.write(e,r,0,r.length,0,a),Ge.close(e),Ge.chmod(o,t)}}function Pe(t,e={}){if(!t)throw new Ge.L(44);e.Ca??(e.Ca=!0),"/"===t.charAt(0)||(t=Ge.cwd()+"/"+t);var r=0;t:for(;40>r;r++){t=t.split("/").filter((t=>!!t));for(var n=Ge.root,i="/",a=0;a<t.length;a++){var o=a===t.length-1;if(o&&e.parent)break;if("."!==t[a])if(".."===t[a]){if(i=ee(i),Ge.Ma(n)){t=i+"/"+t.slice(a+1).join("/"),r--;continue t}n=n.parent}else{i=te(i+"/"+t[a]);try{n=Ee(n,t[a])}catch(t){if(44===t?.qa&&o&&e.yb)return{path:i};throw t}if(!n.ga||o&&!e.Ca||(n=n.ga.root),40960==(61440&n.mode)&&(!o||e.ea)){if(!n.N.readlink)throw new Ge.L(52);"/"===(n=n.N.readlink(n)).charAt(0)||(n=ee(i)+"/"+n),t=n+"/"+t.slice(a+1).join("/");continue t}}}return{path:i,node:n}}throw new Ge.L(32)}function Te(t){for(var e;;){if(Ge.Ma(t))return t=t.T.cb,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)%Ge.ia.length}function Re(t){var e=Oe(t.parent.id,t.name);t.sa=Ge.ia[e],Ge.ia[e]=t}function Me(t){var e=["r","w","rw"][3&t];return 512&t&&(e+="w"),e}function Ne(t,e){return Ge.$a?0:!e.includes("r")||292&t.mode?e.includes("w")&&!(146&t.mode)||e.includes("x")&&!(73&t.mode)?2:0:2}function Ce(t,e){if(!Se(t.mode))return 54;try{return Ee(t,e),20}catch(t){}return Ne(t,"wx")}function Ue(t,e,r){try{var n=Ee(t,e)}catch(t){return t.qa}if(t=Ne(t,"wx"))return t;if(r){if(!Se(n.mode))return 54;if(Ge.Ma(n)||Te(n)===Ge.cwd())return 10}else if(Se(n.mode))return 31;return 0}function xe(t,e){if(!t)throw new Ge.L(e);return t}function Fe(t){if(!(t=Ge.ub(t)))throw new Ge.L(8);return t}function je(t,e=-1){if(t=Object.assign(new Ge.jb,t),-1==e)t:{for(e=0;e<=Ge.kb;e++)if(!Ge.streams[e])break t;throw new Ge.L(33)}return t.fd=e,Ge.streams[e]=t}function Ve(t,e,r){var n=t?.O.ha;t=n?t:e,n??=e.N.ha,xe(n,63),n(t,r)}function ze(t){var e=[];for(t=[t];t.length;){var r=t.pop();e.push(r),t.push(...r.ya)}return e}function De(t){var e={Jb:4096,Vb:4096,blocks:1e6,Ib:5e5,Hb:5e5,files:Ge.Oa,Tb:Ge.Oa-1,Wb:42,flags:2,dc:255};return t.N.gb&&Object.assign(e,t.N.gb(t.T.zb.root)),e}function He(t,e,r){return void 0===r&&(r=e,e=438),Ge.la(t,8192|e,r)}function Ie(t,e,r,n){Ve(t,e,{mode:4095&r|-4096&e.mode,ctime:Date.now(),Ya:n})}function We(t,e,r){if(Se(e.mode))throw new Ge.L(31);if(!Ge.isFile(e.mode))throw new Ge.L(28);var n=Ne(e,"w");if(n)throw new Ge.L(n);Ve(t,e,{size:r,timestamp:Date.now()})}function Be(t){if(!(t.wb||t.xb||t.link||t.P))if(globalThis.XMLHttpRequest)C("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.P=h(t.url)}catch(t){throw new Ge.L(29)}}var Ge={root:null,ya:[],Xa:{},streams:[],Oa:1,ia:null,Va:"/",Ka:!1,$a:!0,qb:null,Fa:0,fb:{},L:class{name="ErrnoError";constructor(t){this.qa=t}},jb:class{ka={};node=null;get object(){return this.node}set object(t){this.node=t}get flags(){return this.ka.flags}set flags(t){this.ka.flags=t}get position(){return this.ka.position}set position(t){this.ka.position=t}},ib:class{N={};O={};ga=null;constructor(t,e,r,n){t||=this,this.parent=t,this.T=t.T,this.id=Ge.Oa++,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 xb(){return Se(this.mode)}get wb(){return 8192==(61440&this.mode)}},createNode:(t,e,r,n)=>(Re(t=new Ge.ib(t,e,r,n)),t),Ma:t=>t===t.parent,isFile:t=>32768==(61440&t),isFIFO:t=>4096==(61440&t),isSocket:t=>!(49152&~t),kb:4096,ub:t=>Ge.streams[t],Sb:(t,e=-1)=>(t=je(t,e),t.O?.Rb?.(t),t),mb:{open(t){t.O=Ge.sb(t.node.rdev).O,t.O.open?.(t)},$(){throw new Ge.L(70)}},Na:t=>t>>8,bc:t=>255&t,ra:(t,e)=>t<<8|e,sb:t=>Ge.Xa[t],hb(t,e){function r(t){return Ge.Fa--,e(t)}function n(t){if(t){if(!n.pb)return n.pb=!0,r(t)}else++a>=i.length&&r(null)}"function"==typeof t&&(e=t,t=!1),Ge.Fa++,1<Ge.Fa&&T(`warning: ${Ge.Fa} FS.syncfs operations in flight at once, probably just doing extra work`);var i=ze(Ge.root.T),a=0;i.forEach((e=>{if(!e.type.hb)return n(null);e.type.hb(e,t,n)}))},T(t,e,r){var n="/"===r;if(n&&Ge.root)throw new Ge.L(10);if(!n&&r){var i=Pe(r,{Ca:!1});if(r=i.path,(i=i.node).ga)throw new Ge.L(10);if(!Se(i.mode))throw new Ge.L(54)}return(t=t.T(e={type:t,zb:e,cb:r,ya:[]})).T=e,e.root=t,n?Ge.root=t:i&&(i.ga=e,i.T&&i.T.ya.push(e)),t},jc(t){if(!(t=Pe(t,{Ca:!1})).node.ga)throw new Ge.L(28);var e=(t=t.node).ga,r=ze(e);Object.keys(Ge.ia).forEach((t=>{for(t=Ge.ia[t];t;){var e=t.sa;r.includes(t.T)&&ke(t),t=e}})),t.ga=null,t.T.ya.splice(t.T.ya.indexOf(e),1)},lookup:(t,e)=>t.N.lookup(t,e),la(t,e,r){var n=Pe(t,{parent:!0}).node;if(!(t=re(t)))throw new Ge.L(28);if("."===t||".."===t)throw new Ge.L(20);var i=Ce(n,t);if(i)throw new Ge.L(i);if(!n.N.la)throw new Ge.L(63);return n.N.la(n,t,e,r)},gb:t=>De(Pe(t,{ea:!0}).node),hc:t=>De(t.node),create:(t,e=438)=>Ge.la(t,4095&e|32768,0),mkdir:(t,e=511)=>Ge.la(t,1023&e|16384,0),cc(t,e){var r,n=t.split("/"),i="";for(r of n)if(r){(i||"/"===t.charAt(0))&&(i+="/"),i+=r;try{Ge.mkdir(i,e)}catch(t){if(20!=t.qa)throw t}}},symlink(t,e){if(!ie(t))throw new Ge.L(44);var r=Pe(e,{parent:!0}).node;if(!r)throw new Ge.L(44);var n=Ce(r,e=re(e));if(n)throw new Ge.L(n);if(!r.N.symlink)throw new Ge.L(63);return r.N.symlink(r,e,t)},rename(t,e){var r=ee(t),n=ee(e),i=re(t),a=re(e),o=Pe(t,{parent:!0}),s=o.node;if(o=(o=Pe(e,{parent:!0})).node,!s||!o)throw new Ge.L(44);if(s.T!==o.T)throw new Ge.L(75);var h=Ee(s,i);if("."!==(t=ae(t,n)).charAt(0))throw new Ge.L(28);if("."!==(t=ae(e,r)).charAt(0))throw new Ge.L(55);try{var l=Ee(o,a)}catch(t){}if(h!==l){if(i=Ue(s,i,e=Se(h.mode)))throw new Ge.L(i);if(i=l?Ue(o,a,e):Ce(o,a))throw new Ge.L(i);if(!s.N.rename)throw new Ge.L(63);if(h.ga||l&&l.ga)throw new Ge.L(10);if(o!==s&&(i=Ne(s,"w")))throw new Ge.L(i);ke(h);try{s.N.rename(h,o,a),h.parent=o}catch(t){throw t}finally{Re(h)}}},rmdir(t){var e=Pe(t,{parent:!0}).node,r=Ee(e,t=re(t)),n=Ue(e,t,!0);if(n)throw new Ge.L(n);if(!e.N.rmdir)throw new Ge.L(63);if(r.ga)throw new Ge.L(10);e.N.rmdir(e,t),ke(r)},readdir:t=>xe((t=Pe(t,{ea:!0}).node).N.readdir,54)(t),unlink(t){var e=Pe(t,{parent:!0}).node;if(!e)throw new Ge.L(44);var r=Ee(e,t=re(t)),n=Ue(e,t,!1);if(n)throw new Ge.L(n);if(!e.N.unlink)throw new Ge.L(63);if(r.ga)throw new Ge.L(10);e.N.unlink(e,t),ke(r)},readlink(t){if(!(t=Pe(t).node))throw new Ge.L(44);if(!t.N.readlink)throw new Ge.L(28);return t.N.readlink(t)},stat:(t,e)=>xe((t=Pe(t,{ea:!e}).node).N.fa,63)(t),fstat(t){var e=Fe(t);t=e.node;var r=e.O.fa;return e=r?e:t,r??=t.N.fa,xe(r,63),r(e)},lstat:t=>Ge.stat(t,!0),chmod(t,e,r){Ie(null,t="string"==typeof t?Pe(t,{ea:!r}).node:t,e,r)},lchmod(t,e){Ge.chmod(t,e,!0)},fchmod(t,e){Ie(t=Fe(t),t.node,e,!1)},chown(t,e,r,n){Ve(null,t="string"==typeof t?Pe(t,{ea:!n}).node:t,{timestamp:Date.now(),Ya:n})},lchown(t,e,r){Ge.chown(t,e,r,!0)},fchown(t){Ve(t=Fe(t),t.node,{timestamp:Date.now(),Ya:!1})},truncate(t,e){if(0>e)throw new Ge.L(28);We(null,t="string"==typeof t?Pe(t,{ea:!0}).node:t,e)},Xb(t,e){if(t=Fe(t),0>e||!(2097155&t.flags))throw new Ge.L(28);We(t,t.node,e)},kc(t,e,r){xe((t=Pe(t,{ea:!0}).node).N.ha,63)(t,{atime:e,mtime:r})},open(t,e,n=438){if(""===t)throw new Ge.L(44);if("string"==typeof e){var i={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===i)throw Error(`Unknown file open mode: ${e}`);e=i}if(n=64&e?4095&n|32768:0,"object"==typeof t)i=t;else{var a=t.endsWith("/");i=(t=Pe(t,{ea:!(131072&e),yb:!0})).node,t=t.path}var o=!1;if(64&e)if(i){if(128&e)throw new Ge.L(20)}else{if(a)throw new Ge.L(31);i=Ge.la(t,511|n,0),o=!0}if(!i)throw new Ge.L(44);if(8192==(61440&i.mode)&&(e&=-513),65536&e&&!Se(i.mode))throw new Ge.L(54);if(!o&&(a=i?40960==(61440&i.mode)?32:Se(i.mode)&&("r"!==Me(e)||576&e)?31:Ne(i,Me(e)):44))throw new Ge.L(a);return 512&e&&!o&&Ge.truncate(i,0),e&=-131713,(a=je({node:i,path:Te(i),flags:e,seekable:!0,position:0,O:i.O,Fb:[],error:!1})).O.open&&a.O.open(a),o&&Ge.chmod(i,511&n),!r.logReadFiles||1&e||t in Ge.fb||(Ge.fb[t]=1),a},close(t){if(null===t.fd)throw new Ge.L(8);t.Ja&&(t.Ja=null);try{t.O.close&&t.O.close(t)}catch(t){throw t}finally{Ge.streams[t.fd]=null}t.fd=null},$(t,e,r){if(null===t.fd)throw new Ge.L(8);if(!t.seekable||!t.O.$)throw new Ge.L(70);if(0!=r&&1!=r&&2!=r)throw new Ge.L(28);return t.position=t.O.$(t,e,r),t.Fb=[],t.position},read(t,e,r,n,i){if(0>n||0>i)throw new Ge.L(28);if(null===t.fd)throw new Ge.L(8);if(1==(2097155&t.flags))throw new Ge.L(8);if(Se(t.node.mode))throw new Ge.L(31);if(!t.O.read)throw new Ge.L(28);var a=void 0!==i;if(a){if(!t.seekable)throw new Ge.L(70)}else i=t.position;return e=t.O.read(t,e,r,n,i),a||(t.position+=e),e},write(t,e,r,n,i,a){if(0>n||0>i)throw new Ge.L(28);if(null===t.fd)throw new Ge.L(8);if(!(2097155&t.flags))throw new Ge.L(8);if(Se(t.node.mode))throw new Ge.L(31);if(!t.O.write)throw new Ge.L(28);t.seekable&&1024&t.flags&&Ge.$(t,0,2);var o=void 0!==i;if(o){if(!t.seekable)throw new Ge.L(70)}else i=t.position;return e=t.O.write(t,e,r,n,i,a),o||(t.position+=e),e},ua(t,e,r,n,i){if(2&n&&!(2&i)&&2!=(2097155&t.flags))throw new Ge.L(2);if(1==(2097155&t.flags))throw new Ge.L(2);if(!t.O.ua)throw new Ge.L(43);if(!e)throw new Ge.L(28);return t.O.ua(t,e,r,n,i)},za:(t,e,r,n,i)=>t.O.za?t.O.za(t,e,r,n,i):0,ab(t,e,r){if(!t.O.ab)throw new Ge.L(59);return t.O.ab(t,e,r)},readFile(t,e={}){e.flags=e.flags||0,e.encoding=e.encoding||"binary","utf8"!==e.encoding&&"binary"!==e.encoding&&C(`Invalid encoding type "${e.encoding}"`);var r=Ge.open(t,e.flags);t=Ge.stat(t).size;var n=new Uint8Array(t);return Ge.read(r,n,0,t,0),"utf8"===e.encoding&&(n=oe(n)),Ge.close(r),n},writeFile(t,e,r={}){r.flags=r.flags||577,t=Ge.open(t,r.flags,r.mode),"string"==typeof e&&(e=new Uint8Array(he(e))),ArrayBuffer.isView(e)?Ge.write(t,e,0,e.byteLength,void 0,r.Pb):C("Unsupported data type"),Ge.close(t)},cwd:()=>Ge.Va,chdir(t){if(null===(t=Pe(t,{ea:!0})).node)throw new Ge.L(44);if(!Se(t.node.mode))throw new Ge.L(54);var e=Ne(t.node,"x");if(e)throw new Ge.L(e);Ge.Va=t.path},fc(){for(var t of(Ge.Ka=!1,Ge.streams))t&&Ge.close(t)},Ub(t,e){try{var r=Pe(t,{ea:!e});t=r.path}catch(t){}var n=!1,i=null;try{r=Pe(t,{parent:!0}),re(t),r=Pe(t,{ea:!e}),n=!0,i=r.node}catch(t){}return n?i:null},na(t,e,r,n){var i;return t=((t,e)=>te(t+"/"+e))("string"==typeof t?t:Te(t),e),e=we(!!r,!!n),(i=Ge.na).Na??(i.Na=64),Ae(i=Ge.ra(Ge.na.Na++,0),{open(t){t.seekable=!1},close(){n?.buffer?.length&&n(10)},read(t,e,n,i){for(var a=0,o=0;o<i;o++){try{var s=r()}catch(t){throw new Ge.L(29)}if(void 0===s&&0===a)throw new Ge.L(6);if(null==s)break;a++,e[n+o]=s}return a&&(t.node.atime=Date.now()),a},write(t,e,r,i){for(var a=0;a<i;a++)try{n(e[r+a])}catch(t){throw new Ge.L(29)}return i&&(t.node.mtime=t.node.ctime=Date.now()),a}}),He(t,e,i)}};if((()=>{let t=Q.prototype;Object.assign(t,{isAliasOf:function(t){if(!(this instanceof Q&&t instanceof Q))return!1;var e=this.M.U.R,r=this.M.S;t.M=t.M;var n=t.M.U.R;for(t=t.M.S;e.Z;)r=e.Ba(r),e=e.Z;for(;n.Z;)t=n.Ba(t),n=n.Z;return e===n&&r===t},clone:function(){if(this.M.S||Z(this),this.M.Aa)return this.M.count.value+=1,this;var t=K,e=Object,r=e.create,n=Object.getPrototypeOf(this),i=this.M;return(t=t(r.call(e,n,{M:{value:{count:i.count,xa:i.xa,Aa:i.Aa,S:i.S,U:i.U,X:i.X,aa:i.aa}}}))).M.count.value+=1,t.M.xa=!1,t},delete(){if(this.M.S||Z(this),this.M.xa&&!this.M.Aa)throw new B("Object already scheduled for deletion");J(this);var t=this.M;--t.count.value,0===t.count.value&&(t.X?t.aa.oa(t.X):t.U.R.oa(t.S)),this.M.Aa||(this.M.X=void 0,this.M.S=void 0)},isDeleted:function(){return!this.M.S},deleteLater:function(){if(this.M.S||Z(this),this.M.xa&&!this.M.Aa)throw new B("Object already scheduled for deletion");return this.M.xa=!0,this}});const e=Symbol.dispose;e&&(t[e]=t.delete)})(),Object.assign(wt.prototype,{tb(t){return this.eb&&(t=this.eb(t)),t},Wa(t){this.oa?.(t)},ma:ut,Y:function(t){function e(){return pt(this.R.ta,this.Ea?{U:this.Ab,S:r,aa:this,X:t}:{U:this,S:t})}var r=this.tb(t);if(!r)return this.Wa(t),null;var n=((t,e)=>{if(void 0===e)throw new B("ptr should not be undefined");for(;t.Z;)e=t.Ba(e),t=t.Z;return dt[e]})(this.R,r);if(void 0!==n)return 0===n.M.count.value?(n.M.S=r,n.M.X=t,n.clone()):(n=n.clone(),this.Wa(t),n);if(n=this.R.rb(r),!(n=et[n]))return e.call(this);var i=ct(r,this.R,(n=this.Da?n.nb:n.pointerType).R);return null===i?e.call(this):pt(n.R.ta,this.Ea?{U:n,S:i,aa:this,X:t}:{U:n,S:i})}}),Ge.Qb=(t,e,r,n,i,a,o,s,h,l)=>{$e(t,e,r,n,i,s,h,l).then(a).catch(o)},Ge.ec=$e,Ge.ia=Array(4096),Ge.T(pe,{},"/"),Ge.mkdir("/tmp"),Ge.mkdir("/home"),Ge.mkdir("/home/web_user"),function(){Ge.mkdir("/dev"),Ae(Ge.ra(1,3),{read:()=>0,write:(t,e,r,n)=>n,$:()=>0}),He("/dev/null",Ge.ra(1,3)),ue(Ge.ra(5,0),de),ue(Ge.ra(6,0),fe),He("/dev/tty",Ge.ra(5,0)),He("/dev/tty1",Ge.ra(6,0));var t=new Uint8Array(1024),e=0,r=()=>(0===e&&(ne(t),e=t.byteLength),t[--e]);Ge.na("/dev","random",r),Ge.na("/dev","urandom",r),Ge.mkdir("/dev/shm"),Ge.mkdir("/dev/shm/tmp")}(),function(){Ge.mkdir("/proc");var t=Ge.mkdir("/proc/self");Ge.mkdir("/proc/self/fd"),Ge.T({T(){var e=Ge.createNode(t,"fd",16895,73);return e.O={$:pe.O.$},e.N={lookup(t,e){var r=Fe(t=+e);return(t={parent:null,T:{cb:"fake"},N:{readlink:()=>r.path},id:t+1}).parent=t},readdir:()=>Array.from(Ge.streams.entries()).filter((([,t])=>t)).map((([t])=>t.toString()))},e}},{},"/proc/self/fd")}(),Ge.qb={MEMFS:pe},r.noExitRuntime&&(z=r.noExitRuntime),r.preloadPlugins&&(be=r.preloadPlugins),r.print&&(P=r.print),r.printErr&&(T=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=ge,r.removeRunDependency=ye,r.FS_preloadFile=$e,r.FS_unlink=(...t)=>Ge.unlink(...t),r.FS_createPath=(...t)=>function(t,e){for(t="string"==typeof t?t:Te(t),e=e.split("/").reverse();e.length;){var r=e.pop();if(r){var n=te(t+"/"+r);try{Ge.mkdir(n)}catch(t){if(20!=t.qa)throw t}t=n}}return n}(...t),r.FS_createDevice=(...t)=>Ge.na(...t),r.FS=Ge,r.FS_createDataFile=(...t)=>Le(...t),r.FS_createLazyFile=(...t)=>function(t,e,r,n,a){class o{Ha=!1;ka=[];Ga=void 0;Ra=0;Qa=0;get(t){if(!(t>this.length-1||0>t)){var e=t%this.chunkSize;return this.Ga(t/this.chunkSize|0)[e]}}lb(t){this.Ga=t}Sa(){var t=new XMLHttpRequest;t.open("HEAD",r,!1),t.send(null),200<=t.status&&300>t.status||304===t.status||C("Couldn't load "+r+". Status: "+t.status);var e,n=Number(t.getResponseHeader("Content-length")),i=(e=t.getResponseHeader("Accept-Ranges"))&&"bytes"===e;t=(e=t.getResponseHeader("Content-Encoding"))&&"gzip"===e;var a=1048576;i||(a=n);var o=this;o.lb((t=>{var e=t*a,i=(t+1)*a-1;if(i=Math.min(i,n-1),void 0===o.ka[t]){var s=o.ka;e>i&&C("invalid range ("+e+", "+i+") or no bytes requested!"),i>n-1&&C("only "+n+" bytes available! programmer error!");var h=new XMLHttpRequest;h.open("GET",r,!1),n!==a&&h.setRequestHeader("Range","bytes="+e+"-"+i),h.responseType="arraybuffer",h.overrideMimeType&&h.overrideMimeType("text/plain; charset=x-user-defined"),h.send(null),200<=h.status&&300>h.status||304===h.status||C("Couldn't load "+r+". Status: