@thorvg/lottie-player
Version:
A web lottie player using ThorVG as a renderer
1 lines • 83.4 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["lottie-player"]={})}(this,function(e){"use strict";var t="undefined"!=typeof document?document.currentScript:null;const r=globalThis,n=r.ShadowRoot&&(void 0===r.ShadyCSS||r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),a=new WeakMap;let o=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(n&&void 0===e){const r=void 0!==t&&1===t.length;r&&(e=a.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&a.set(t,e))}return e}toString(){return this.cssText}};const s=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return(e=>new o("string"==typeof e?e:e+"",void 0,i))(t)})(e):e,{is:l,defineProperty:u,getOwnPropertyDescriptor:c,getOwnPropertyNames:h,getOwnPropertySymbols:d,getPrototypeOf:f}=Object,p=globalThis,m=p.trustedTypes,b=m?m.emptyScript:"",y=p.reactiveElementPolyfillSupport,v=(e,t)=>e,w={toAttribute(e,t){switch(t){case Boolean:e=e?b:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch(e){r=null}}return r}},g=(e,t)=>!l(e,t),$={attribute:!0,type:String,converter:w,reflect:!1,useDefault:!1,hasChanged:g};Symbol.metadata??=Symbol("metadata"),p.litPropertyMetadata??=new WeakMap;let _=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=$){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const r=Symbol(),n=this.getPropertyDescriptor(e,r,t);void 0!==n&&u(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){const{get:n,set:i}=c(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:n,set(t){const a=n?.call(this);i?.call(this,t),this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??$}static _$Ei(){if(this.hasOwnProperty(v("elementProperties")))return;const e=f(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(v("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(v("properties"))){const e=this.properties,t=[...h(e),...d(e)];for(const r of t)this.createProperty(r,e[r])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const e of r)t.unshift(s(e))}else void 0!==e&&t.push(s(e));return t}static _$Eu(e,t){const r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(n)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const n of t){const t=document.createElement("style"),i=r.litNonce;void 0!==i&&t.setAttribute("nonce",i),t.textContent=n.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){const r=this.constructor.elementProperties.get(e),n=this.constructor._$Eu(e,r);if(void 0!==n&&!0===r.reflect){const i=(void 0!==r.converter?.toAttribute?r.converter:w).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(n):this.setAttribute(n,i),this._$Em=null}}_$AK(e,t){const r=this.constructor,n=r._$Eh.get(e);if(void 0!==n&&this._$Em!==n){const e=r.getPropertyOptions(n),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:w;this._$Em=n;const a=i.fromAttribute(t,e.type);this[n]=a??this._$Ej?.get(n)??a,this._$Em=null}}requestUpdate(e,t,r,n=!1,i){if(void 0!==e){const a=this.constructor;if(!1===n&&(i=this[e]),r??=a.getPropertyOptions(e),!((r.hasChanged??g)(i,t)||r.useDefault&&r.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,r))))return;this.C(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:n,wrapped:i},a){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||void 0!==a)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),!0===n&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,r]of e){const{wrapped:e}=r,n=this[t];!0!==e||this._$AL.has(t)||void 0===n||this.C(t,void 0,r,n)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};_.elementStyles=[],_.shadowRootOptions={mode:"open"},_[v("elementProperties")]=new Map,_[v("finalized")]=new Map,y?.({ReactiveElement:_}),(p.reactiveElementVersions??=[]).push("2.1.2");const A={attribute:!0,type:String,converter:w,reflect:!1,hasChanged:g},x=(e=A,t,r)=>{const{kind:n,metadata:i}=r;let a=globalThis.litPropertyMetadata.get(i);if(void 0===a&&globalThis.litPropertyMetadata.set(i,a=new Map),"setter"===n&&((e=Object.create(e)).wrapped=!0),a.set(r.name,e),"accessor"===n){const{name:n}=r;return{set(r){const i=t.get.call(this);t.set.call(this,r),this.requestUpdate(n,i,e,!0,r)},init(t){return void 0!==t&&this.C(n,void 0,e,t),t}}}if("setter"===n){const{name:n}=r;return function(r){const i=this[n];t.call(this,r),this.requestUpdate(n,i,e,!0,r)}}throw Error("Unsupported decorator location: "+n)};function S(e){return(t,r)=>"object"==typeof r?x(e,t,r):((e,t,r)=>{const n=t.hasOwnProperty(r);return t.constructor.createProperty(r,e),n?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)}const C=globalThis,E=e=>e,k=C.trustedTypes,T=k?k.createPolicy("lit-html",{createHTML:e=>e}):void 0,P="$lit$",O=`lit$${Math.random().toFixed(9).slice(2)}$`,R="?"+O,z=`<${R}>`,B=document,D=()=>B.createComment(""),U=e=>null===e||"object"!=typeof e&&"function"!=typeof e,M=Array.isArray,L="[ \t\n\f\r]",F=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,N=/-->/g,j=/>/g,I=RegExp(`>|${L}(?:([^\\s"'>=/]+)(${L}*=${L}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),V=/'/g,G=/"/g,H=/^(?:script|style|textarea|title)$/i,q=(e,...t)=>({_$litType$:1,strings:e,values:t}),W=Symbol.for("lit-noChange"),K=Symbol.for("lit-nothing"),Z=new WeakMap,Y=B.createTreeWalker(B,129);function X(e,t){if(!M(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==T?T.createHTML(t):t}const J=(e,t)=>{const r=e.length-1,n=[];let i,a=2===t?"<svg>":3===t?"<math>":"",o=F;for(let t=0;t<r;t++){const r=e[t];let s,l,u=-1,c=0;for(;c<r.length&&(o.lastIndex=c,l=o.exec(r),null!==l);)c=o.lastIndex,o===F?"!--"===l[1]?o=N:void 0!==l[1]?o=j:void 0!==l[2]?(H.test(l[2])&&(i=RegExp("</"+l[2],"g")),o=I):void 0!==l[3]&&(o=I):o===I?">"===l[0]?(o=i??F,u=-1):void 0===l[1]?u=-2:(u=o.lastIndex-l[2].length,s=l[1],o=void 0===l[3]?I:'"'===l[3]?G:V):o===G||o===V?o=I:o===N||o===j?o=F:(o=I,i=void 0);const h=o===I&&e[t+1].startsWith("/>")?" ":"";a+=o===F?r+z:u>=0?(n.push(s),r.slice(0,u)+P+r.slice(u)+O+h):r+O+(-2===u?t:h)}return[X(e,a+(e[r]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),n]};class Q{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let i=0,a=0;const o=e.length-1,s=this.parts,[l,u]=J(e,t);if(this.el=Q.createElement(l,r),Y.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(n=Y.nextNode())&&s.length<o;){if(1===n.nodeType){if(n.hasAttributes())for(const e of n.getAttributeNames())if(e.endsWith(P)){const t=u[a++],r=n.getAttribute(e).split(O),o=/([.?@])?(.*)/.exec(t);s.push({type:1,index:i,name:o[2],strings:r,ctor:"."===o[1]?ie:"?"===o[1]?ae:"@"===o[1]?oe:ne}),n.removeAttribute(e)}else e.startsWith(O)&&(s.push({type:6,index:i}),n.removeAttribute(e));if(H.test(n.tagName)){const e=n.textContent.split(O),t=e.length-1;if(t>0){n.textContent=k?k.emptyScript:"";for(let r=0;r<t;r++)n.append(e[r],D()),Y.nextNode(),s.push({type:2,index:++i});n.append(e[t],D())}}}else if(8===n.nodeType)if(n.data===R)s.push({type:2,index:i});else{let e=-1;for(;-1!==(e=n.data.indexOf(O,e+1));)s.push({type:7,index:i}),e+=O.length-1}i++}}static createElement(e,t){const r=B.createElement("template");return r.innerHTML=e,r}}function ee(e,t,r=e,n){if(t===W)return t;let i=void 0!==n?r._$Co?.[n]:r._$Cl;const a=U(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),void 0===a?i=void 0:(i=new a(e),i._$AT(e,r,n)),void 0!==n?(r._$Co??=[])[n]=i:r._$Cl=i),void 0!==i&&(t=ee(e,i._$AS(e,t.values),i,n)),t}class te{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:r}=this._$AD,n=(e?.creationScope??B).importNode(t,!0);Y.currentNode=n;let i=Y.nextNode(),a=0,o=0,s=r[0];for(;void 0!==s;){if(a===s.index){let t;2===s.type?t=new re(i,i.nextSibling,this,e):1===s.type?t=new s.ctor(i,s.name,s.strings,this,e):6===s.type&&(t=new se(i,this,e)),this._$AV.push(t),s=r[++o]}a!==s?.index&&(i=Y.nextNode(),a++)}return Y.currentNode=B,n}p(e){let t=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}class re{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,n){this.type=2,this._$AH=K,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=ee(this,e,t),U(e)?e===K||null==e||""===e?(this._$AH!==K&&this._$AR(),this._$AH=K):e!==this._$AH&&e!==W&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>M(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==K&&U(this._$AH)?this._$AA.nextSibling.data=e:this.T(B.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:r}=e,n="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=Q.createElement(X(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===n)this._$AH.p(t);else{const e=new te(n,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=Z.get(e.strings);return void 0===t&&Z.set(e.strings,t=new Q(e)),t}k(e){M(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,n=0;for(const i of e)n===t.length?t.push(r=new re(this.O(D()),this.O(D()),this,this.options)):r=t[n],r._$AI(i),n++;n<t.length&&(this._$AR(r&&r._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=E(e).nextSibling;E(e).remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class ne{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,n,i){this.type=1,this._$AH=K,this._$AN=void 0,this.element=e,this.name=t,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=K}_$AI(e,t=this,r,n){const i=this.strings;let a=!1;if(void 0===i)e=ee(this,e,t,0),a=!U(e)||e!==this._$AH&&e!==W,a&&(this._$AH=e);else{const n=e;let o,s;for(e=i[0],o=0;o<i.length-1;o++)s=ee(this,n[r+o],t,o),s===W&&(s=this._$AH[o]),a||=!U(s)||s!==this._$AH[o],s===K?e=K:e!==K&&(e+=(s??"")+i[o+1]),this._$AH[o]=s}a&&!n&&this.j(e)}j(e){e===K?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class ie extends ne{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===K?void 0:e}}class ae extends ne{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==K)}}class oe extends ne{constructor(e,t,r,n,i){super(e,t,r,n,i),this.type=5}_$AI(e,t=this){if((e=ee(this,e,t,0)??K)===W)return;const r=this._$AH,n=e===K&&r!==K||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,i=e!==K&&(r===K||n);n&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class se{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){ee(this,e)}}const le=C.litHtmlPolyfillSupport;le?.(Q,re),(C.litHtmlVersions??=[]).push("3.3.2");const ue=globalThis;class ce extends _{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,r)=>{const n=r?.renderBefore??t;let i=n._$litPart$;if(void 0===i){const e=r?.renderBefore??null;n._$litPart$=i=new re(t.insertBefore(D(),e),e,void 0,r??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return W}}ce._$litElement$=!0,ce.finalized=!0,ue.litElementHydrateSupport?.({LitElement:ce});const he=ue.litElementPolyfillSupport;function de(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}he?.({LitElement:ce}),(ue.litElementVersions??=[]).push("4.2.2");let fe=null,pe=!1;var me=function(e){return e.JSON="json",e.LOT="lot",e.JPG="jpg",e.PNG="png",e.SVG="svg",e}({});const be=e=>new Promise(t=>setTimeout(t,e));let ye="idle";class ve extends ce{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])}get dpr(){return!1===this.config?.enableDevicePixelRatio?1:1+.75*(window.devicePixelRatio-1)}TVG=null;canvas;config;_imageData;_beginTime=Date.now();_counter=1;_timer;_observer;_observable=!1;_assetResolverCallback;_assetResolverData;async _init(){if(pe)for(;!fe;)await be(100);if(fe||(pe=!0,fe=await async function(e={}){var r,n=e,i=!!globalThis.window,a=!!globalThis.WorkerGlobalScope,o=globalThis.process?.versions?.node&&"renderer"!=globalThis.process?.type;if(o){const{createRequire:e}=await Promise.resolve().then(function(){return $e});var s=e("undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:t&&"SCRIPT"===t.tagName.toUpperCase()&&t.src||new URL("lottie-player.js",document.baseURI).href)}var l,u,c=(e,t)=>{throw t},h="undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:t&&"SCRIPT"===t.tagName.toUpperCase()&&t.src||new URL("lottie-player.js",document.baseURI).href,d="";if(o){var f=s("fs");h.startsWith("file:")&&(d=s("path").dirname(s("url").fileURLToPath(h))+"/"),u=e=>(e=R(e)?new URL(e):e,f.readFileSync(e)),l=async e=>(e=R(e)?new URL(e):e,f.readFileSync(e,void 0)),process.argv.slice(2),c=(e,t)=>{throw process.exitCode=e,t}}else if(i||a){try{d=new URL(".",h).href}catch{}a&&(u=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),l=async e=>{if(R(e))return new Promise((t,r)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{200==n.status||0==n.status&&n.response?t(n.response):r(n.status)},n.onerror=r,n.send(null)});var t=await fetch(e,{credentials:"same-origin"});if(t.ok)return t.arrayBuffer();throw Error(t.status+" : "+t.url)}}var p,m,b,y,v,w,g,$,_,A,x,S,C,E,k,T=function(){}.bind(),P=function(){}.bind(),O=!1,R=e=>e.startsWith("file://"),z=!1;function B(){var e=sn.buffer;v=new Int8Array(e),g=new Int16Array(e),w=new Uint8Array(e),$=new Uint16Array(e),_=new Int32Array(e),A=new Uint32Array(e),x=new Float32Array(e),S=new Float64Array(e),C=new BigInt64Array(e),E=new BigUint64Array(e)}function D(e){throw n.onAbort?.(e),P(e="Aborted("+e+")"),O=!0,e=new WebAssembly.RuntimeError(e+". Build with -sASSERTIONS for more info."),y?.(e),e}class U{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var M=e=>{for(;0<e.length;)e.shift()(n)},L=[],F=[],N=()=>{var e=n.preRun.shift();F.push(e)},j=!0,I=new TextDecoder,V=(e,t,r,n)=>{if(r=t+r,n)return r;for(;e[t]&&!(t>=r);)++t;return t},G=(e,t,r)=>e?I.decode(w.subarray(e,V(w,e,t,r))):"",H=e=>{for(var t="";;){var r=w[e++];if(!r)return t;t+=String.fromCharCode(r)}},q={},W={},K={},Z=class extends Error{constructor(e){super(e),this.name="BindingError"}},Y=e=>{throw new Z(e)};function X(e,t,r={}){return function(e,t,r={}){var n=t.name;if(!e)throw new Z(`type "${n}" must have a positive integer typeid pointer`);if(W.hasOwnProperty(e)){if(r.xc)return;throw new Z(`Cannot register type '${n}' twice`)}W[e]=t,delete K[e],q.hasOwnProperty(e)&&(t=q[e],delete q[e],t.forEach(e=>e()))}(e,t,r)}var J=(e,t,r)=>{switch(t){case 1:return r?e=>v[e]:e=>w[e];case 2:return r?e=>g[e>>1]:e=>$[e>>1];case 4:return r?e=>_[e>>2]:e=>A[e>>2];case 8:return r?e=>C[e>>3]:e=>E[e>>3];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},Q=e=>{throw new Z(e.za.Na.Ka.name+" instance already deleted")},ee=!1,te=()=>{},re=e=>globalThis.FinalizationRegistry?(ee=new FinalizationRegistry(e=>{--(e=e.za).count.value,0===e.count.value&&(e.Za?e.cb.qb(e.Za):e.Na.Ka.qb(e.La))}),re=e=>{var t=e.za;return t.Za&&ee.register(e,{za:t},e),e},te=e=>{ee.unregister(e)},re(e)):(re=e=>e,e);function ne(){}var ie=(e,t)=>Object.defineProperty(t,"name",{value:e}),ae={},oe=(e,t,r)=>{if(void 0===e[t].Ya){var n=e[t];e[t]=function(...n){if(!e[t].Ya.hasOwnProperty(n.length))throw new Z(`Function '${r}' called with an invalid number of arguments (${n.length}) - expects one of (${e[t].Ya})!`);return e[t].Ya[n.length].apply(this,n)},e[t].Ya=[],e[t].Ya[n.yb]=n}},se=(e,t,r)=>{if(n.hasOwnProperty(e)){if(void 0===r||void 0!==n[e].Ya&&void 0!==n[e].Ya[r])throw new Z(`Cannot register public name '${e}' twice`);if(oe(n,e,e),n[e].Ya.hasOwnProperty(r))throw new Z(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`);n[e].Ya[r]=t}else n[e]=t,n[e].yb=r};function le(e,t,r,n,i,a,o,s){this.name=e,this.constructor=t,this.vb=r,this.qb=n,this.ab=i,this.tc=a,this.Db=o,this.qc=s,this.Dc=[]}var ue=(e,t,r)=>{for(;t!==r;){if(!t.Db)throw new Z(`Expected null or instance of ${r.name}, got an instance of ${t.name}`);e=t.Db(e),t=t.ab}return e},ce=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e};function he(e,t){if(null===t){if(this.Mb)throw new Z(`null is not a valid ${this.name}`);return 0}if(!t.za)throw new Z(`Cannot pass "${ce(t)}" as a ${this.name}`);if(!t.za.La)throw new Z(`Cannot pass deleted object as a pointer of type ${this.name}`);return ue(t.za.La,t.za.Na.Ka,this.Ka)}function de(e,t){if(null===t){if(this.Mb)throw new Z(`null is not a valid ${this.name}`);if(this.Gb){var r=this.Ec();return null!==e&&e.push(this.qb,r),r}return 0}if(!t||!t.za)throw new Z(`Cannot pass "${ce(t)}" as a ${this.name}`);if(!t.za.La)throw new Z(`Cannot pass deleted object as a pointer of type ${this.name}`);if(!this.Fb&&t.za.Na.Fb)throw new Z(`Cannot convert argument of type ${t.za.cb?t.za.cb.name:t.za.Na.name} to parameter type ${this.name}`);if(r=ue(t.za.La,t.za.Na.Ka,this.Ka),this.Gb){if(void 0===t.za.Za)throw new Z("Passing raw pointer to smart pointer is illegal");switch(this.Gc){case 0:if(t.za.cb!==this)throw new Z(`Cannot convert argument of type ${t.za.cb?t.za.cb.name:t.za.Na.name} to parameter type ${this.name}`);r=t.za.Za;break;case 1:r=t.za.Za;break;case 2:if(t.za.cb===this)r=t.za.Za;else{var n=t.clone();r=this.Fc(r,Ue(()=>n.delete())),null!==e&&e.push(this.qb,r)}break;default:throw new Z("Unsupporting sharing policy")}}return r}function fe(e,t){if(null===t){if(this.Mb)throw new Z(`null is not a valid ${this.name}`);return 0}if(!t.za)throw new Z(`Cannot pass "${ce(t)}" as a ${this.name}`);if(!t.za.La)throw new Z(`Cannot pass deleted object as a pointer of type ${this.name}`);if(t.za.Na.Fb)throw new Z(`Cannot convert argument of type ${t.za.Na.name} to parameter type ${this.name}`);return ue(t.za.La,t.za.Na.Ka,this.Ka)}function pe(e){return this.$a(A[e>>2])}var me=(e,t,r)=>t===r?e:void 0===r.ab||null===(e=me(e,t,r.ab))?null:r.qc(e),be={},ye=class extends Error{constructor(e){super(e),this.name="InternalError"}},ve=(e,t)=>{if(!t.Na||!t.La)throw new ye("makeClassHandle requires ptr and ptrType");if(!!t.cb!=!!t.Za)throw new ye("Both smartPtrType and smartPtr must be specified");return t.count={value:1},re(Object.create(e,{za:{value:t,writable:!0}}))};function we(e,t,r,n,i,a,o,s,l,u,c){this.name=e,this.Ka=t,this.Mb=r,this.Fb=n,this.Gb=i,this.Cc=a,this.Gc=o,this.fc=s,this.Ec=l,this.Fc=u,this.qb=c,i||void 0!==t.ab?this.eb=de:(this.eb=n?he:fe,this.fb=null)}var ge=(e,t,r)=>{if(!n.hasOwnProperty(e))throw new ye("Replacing nonexistent public symbol");void 0!==n[e].Ya&&void 0!==r?n[e].Ya[r]=t:(n[e]=t,n[e].yb=r)},_e=(e,t)=>{e=H(e);var r=ln.get(t);if("function"!=typeof r)throw new Z(`unknown function pointer with signature ${e}: ${t}`);return r};class Ae extends Error{}var xe=e=>{e=Fr(e);var t=H(e);return Nr(e),t},Se=(e,t)=>{var r=[],n={};throw t.forEach(function e(t){n[t]||W[t]||(K[t]?K[t].forEach(e):(r.push(t),n[t]=!0))}),new Ae(`${e}: `+r.map(xe).join([", "]))},Ce=(e,t,r)=>{function n(t){if((t=r(t)).length!==e.length)throw new ye("Mismatched type converter count");for(var n=0;n<e.length;++n)X(e[n],t[n])}e.forEach(e=>K[e]=t);var i=Array(t.length),a=[],o=0;for(let[e,r]of t.entries())W.hasOwnProperty(r)?i[e]=W[r]:(a.push(r),q.hasOwnProperty(r)||(q[r]=[]),q[r].push(()=>{i[e]=W[r],++o===a.length&&n(i)}));0===a.length&&n(i)},Ee=(e,t)=>{for(var r=[],n=0;n<e;n++)r.push(A[t+4*n>>2]);return r},ke=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Te(e){for(var t=1;t<e.length;++t)if(null!==e[t]&&void 0===e[t].fb)return!0;return!1}function Pe(e,t,r,n,i,a){var o=t.length;if(2>o)throw new Z("argTypes array size mismatch! Must at least get return value and 'this' types!");var s=null!==t[1]&&null!==r,l=Te(t);r=!t[0].dc;var u=t[0],c=t[1];for(n=[e,Y,n,i,ke,u.$a.bind(u),c?.eb.bind(c)],i=2;i<o;++i)n.push((u=t[i]).eb.bind(u));if(!l)for(i=s?1:2;i<t.length;++i)null!==t[i].fb&&n.push(t[i].fb);for(l=Te(t),i=t.length-2,c=[],u=["fn"],s&&u.push("thisWired"),o=0;o<i;++o)c.push(`arg${o}`),u.push(`arg${o}Wired`);c=c.join(","),u=u.join(","),c=`return function (${c}) {\n`,l&&(c+="var destructors = [];\n");var h=l?"destructors":"null",d="humanName throwBindingError invoker fn runDestructors fromRetWire toClassParamWire".split(" ");for(s&&(c+=`var thisWired = toClassParamWire(${h}, this);\n`),o=0;o<i;++o){var f=`toArg${o}Wire`;c+=`var arg${o}Wired = ${f}(${h}, arg${o});\n`,d.push(f)}if(c+=(r||a?"var rv = ":"")+`invoker(${u});\n`,l)c+="runDestructors(destructors);\n";else for(o=s?1:2;o<t.length;++o)a=1===o?"thisWired":"arg"+(o-2)+"Wired",null!==t[o].fb&&(c+=`${a}_dtor(${a});\n`,d.push(`${a}_dtor`));return r&&(c+="var ret = fromRetWire(rv);\nreturn ret;\n"),t=new Function(d,c+"}\n")(...n),ie(e,t)}var Oe=e=>{const t=(e=e.trim()).indexOf("(");return-1===t?e:e.slice(0,t)},Re=[],ze=[0,1,,1,null,1,!0,1,!1,1],Be=e=>{9<e&&0===--ze[e+1]&&(ze[e]=void 0,Re.push(e))},De=e=>{if(!e)throw new Z(`Cannot use deleted val. handle = ${e}`);return ze[e]},Ue=e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:const t=Re.pop()||ze.length;return ze[t]=e,ze[t+1]=1,t}},Me={name:"emscripten::val",$a:e=>{var t=De(e);return Be(e),t},eb:(e,t)=>Ue(t),nb:pe,fb:null},Le=(e,t)=>{switch(t){case 4:return function(e){return this.$a(x[e>>2])};case 8:return function(e){return this.$a(S[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Fe=(e,t,r,n)=>{if(!(0<n))return 0;var i=r;n=r+n-1;for(var a=0;a<e.length;++a){var o=e.codePointAt(a);if(127>=o){if(r>=n)break;t[r++]=o}else if(2047>=o){if(r+1>=n)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(65535>=o){if(r+2>=n)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=n)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o,a++}}return t[r]=0,r-i},Ne=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);127>=n?t++:2047>=n?t+=2:55296<=n&&57343>=n?(t+=4,++r):t+=3}return t},je=new TextDecoder("utf-16le"),Ie=(e,t,r)=>je.decode($.subarray(e>>=1,V($,e,t/2,r))),Ve=(e,t,r)=>{if(r??=2147483647,2>r)return 0;var n=t;r=(r-=2)<2*e.length?r/2:e.length;for(var i=0;i<r;++i)g[t>>1]=e.charCodeAt(i),t+=2;return g[t>>1]=0,t-n},Ge=e=>2*e.length,He=(e,t,r)=>{var n="";e>>=2;for(var i=0;!(i>=t/4);i++){var a=A[e+i];if(!a&&!r)break;n+=String.fromCodePoint(a)}return n},qe=(e,t,r)=>{if(r??=2147483647,4>r)return 0;var n=t;r=n+r-4;for(var i=0;i<e.length;++i){var a=e.codePointAt(i);if(65535<a&&i++,_[t>>2]=a,(t+=4)+4>r)break}return _[t>>2]=0,t-n},We=e=>{for(var t=0,r=0;r<e.length;++r)65535<e.codePointAt(r)&&r++,t+=4;return t},Ke=0,Ze=[],Ye=(e,t,r)=>{var n=[];return e=e(n,r),n.length&&(A[t>>2]=Ue(n)),e},Xe={},Je=e=>{var t=Xe[e];return void 0===t?H(e):t},Qe={},et=e=>{m=e,j||0<Ke||(n.onExit?.(e),O=!0),c(e,new U(e))},tt=e=>{if(!O)try{if(e(),!(j||0<Ke))try{m=e=m,et(e)}catch(e){e instanceof U||"unwind"==e||c(1,e)}}catch(e){e instanceof U||"unwind"==e||c(1,e)}},rt=e=>{var t=Ne(e)+1,r=an(t);return Fe(e,w,r,t),r},nt=[],it=[],at=e=>{if(e)return nt[e>>>0]},ot=e=>G(A[e>>2],A[e+4>>2]),st=e=>{var t=A[e>>2];return e=A[e+4>>2],t?G(t,e):0===e?"":void 0},lt=e=>({width:A[e>>2],height:A[e+4>>2],depthOrArrayLayers:A[e+8>>2]}),ut=e=>{var t=e+8;return{texture:at(A[e>>2]),mipLevel:A[e+4>>2],origin:{x:A[t>>2],y:A[t+4>>2],z:A[t+8>>2]},aspect:zt[A[e+20>>2]]}},ct=(e,t)=>{if(e){for(var r={},n=0;n<e;++n){var i=t+24*n;r[ot(i+4)]=S[i+16>>3]}return r}},ht=e=>e?at(e):"auto",dt=[,"clamp-to-edge","repeat","mirror-repeat"],ft=[,"zero","one","src","one-minus-src","src-alpha","one-minus-src-alpha","dst","one-minus-dst","dst-alpha","one-minus-dst-alpha","src-alpha-saturated","constant","one-minus-constant","src1","one-minus-src1","src1alpha","one-minus-src1alpha"],pt=[,"add","subtract","reverse-subtract","min","max"],mt=["binding-not-used",,"uniform","storage","read-only-storage"],bt=[,"never","less","equal","less-equal","greater","not-equal","greater-equal","always"],yt=[,"opaque","premultiplied","unpremultiplied","inherit"],vt=[,"none","front","back"],wt=[,"compatibility","core"],gt={1:"core-features-and-limits",2:"depth-clip-control",3:"depth32float-stencil8",4:"texture-compression-bc",5:"texture-compression-bc-sliced-3d",6:"texture-compression-etc2",7:"texture-compression-astc",8:"texture-compression-astc-sliced-3d",9:"timestamp-query",10:"indirect-first-instance",11:"shader-f16",12:"rg11b10ufloat-renderable",13:"bgra8unorm-storage",14:"float32-filterable",15:"float32-blendable",16:"clip-distances",17:"dual-source-blending",18:"subgroups",19:"texture-formats-tier1",20:"texture-formats-tier2",21:"primitive-index",327692:"chromium-experimental-unorm16-texture-formats",327693:"chromium-experimental-snorm16-texture-formats",327732:"chromium-experimental-multi-draw-indirect"},$t=[,"nearest","linear"],_t=[,"ccw","cw"],At=[,"uint16","uint32"],xt=[,"load","clear"],St=[,"nearest","linear"],Ct=[,"low-power","high-performance"],Et=[,"srgb","display-p3"],kt=[,"point-list","line-list","line-strip","triangle-list","triangle-strip"],Tt=["binding-not-used",,"filtering","non-filtering","comparison"],Pt=[,"keep","zero","replace","invert","increment-clamp","decrement-clamp","increment-wrap","decrement-wrap"],Ot=["binding-not-used",,"write-only","read-only","read-write"],Rt=[,"store","discard"],zt=[,"all","stencil-only","depth-only"],Bt=[,"1d","2d","3d"],Dt=[,"r8unorm","r8snorm","r8uint","r8sint","r16unorm","r16snorm","r16uint","r16sint","r16float","rg8unorm","rg8snorm","rg8uint","rg8sint","r32float","r32uint","r32sint","rg16unorm","rg16snorm","rg16uint","rg16sint","rg16float","rgba8unorm","rgba8unorm-srgb","rgba8snorm","rgba8uint","rgba8sint","bgra8unorm","bgra8unorm-srgb","rgb10a2uint","rgb10a2unorm","rg11b10ufloat","rgb9e5ufloat","rg32float","rg32uint","rg32sint","rgba16unorm","rgba16snorm","rgba16uint","rgba16sint","rgba16float","rgba32float","rgba32uint","rgba32sint","stencil8","depth16unorm","depth24plus","depth24plus-stencil8","depth32float","depth32float-stencil8","bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc2-rgba-unorm","bc2-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb","bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm","bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb","etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm","astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"],Ut=["binding-not-used",,"float","unfilterable-float","depth","sint","uint"],Mt=[,"1d","2d","2d-array","cube","cube-array","3d"],Lt=[,"standard","extended"],Ft=[,"uint8","uint8x2","uint8x4","sint8","sint8x2","sint8x4","unorm8","unorm8x2","unorm8x4","snorm8","snorm8x2","snorm8x4","uint16","uint16x2","uint16x4","sint16","sint16x2","sint16x4","unorm16","unorm16x2","unorm16x4","snorm16","snorm16x2","snorm16x4","float16","float16x2","float16x4","float32","float32x2","float32x3","float32x4","uint32","uint32x2","uint32x3","uint32x4","sint32","sint32x2","sint32x3","sint32x4","unorm10-10-10-2","unorm8x4-bgra"],Nt=[,"vertex","instance"],jt={undefined:1,unknown:1,destroyed:2},It=e=>-9007199254740992>e||9007199254740992<e?NaN:Number(e),Vt=(e,t)=>{for(var r=0,n=e.length-1;0<=n;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},Gt=e=>{var t="/"===e.charAt(0),r="/"===e.slice(-1);return(e=Vt(e.split("/").filter(e=>!!e),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},Ht=e=>{var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1);return e=t[0],t=t[1],e||t?(t&&=t.slice(0,-1),e+t):"."},qt=e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],Wt=e=>{(Wt=(()=>{if(o){var e=s("crypto");return t=>e.randomFillSync(t)}return e=>crypto.getRandomValues(e)})())(e)},Kt=(...e)=>{for(var t="",r=!1,n=e.length-1;-1<=n&&!r;n--){if("string"!=typeof(r=0<=n?e[n]:Ur.cwd()))throw new TypeError("Arguments to path.resolve must be strings");if(!r)return"";t=r+"/"+t,r="/"===r.charAt(0)}return t=Vt(t.split("/").filter(e=>!!e),!r).join("/"),(r?"/":"")+t||"."},Zt=(e,t)=>{function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;0<=r&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=Kt(e).slice(1),t=Kt(t).slice(1),e=r(e.split("/")),t=r(t.split("/"));for(var n=Math.min(e.length,t.length),i=n,a=0;a<n;a++)if(e[a]!==t[a]){i=a;break}for(n=[],a=i;a<e.length;a++)n.push("..");return(n=n.concat(t.slice(i))).join("/")},Yt=e=>{var t=V(e,0);return I.decode(e.buffer?e.subarray(0,t):new Uint8Array(e.slice(0,t)))},Xt=[],Jt=e=>{var t=Array(Ne(e)+1);return e=Fe(e,t,0,t.length),t.length=e,t},Qt=[];function er(e,t){Qt[e]={input:[],output:[],xb:t},fr(e,tr)}var tr={open(e){var t=Qt[e.node.rdev];if(!t)throw new Ur.ya(43);e.tty=t,e.seekable=!1},close(e){e.tty.xb.fsync(e.tty)},fsync(e){e.tty.xb.fsync(e.tty)},read(e,t,r,n){if(!e.tty||!e.tty.xb.ac)throw new Ur.ya(60);for(var i=0,a=0;a<n;a++){try{var o=e.tty.xb.ac(e.tty)}catch(e){throw new Ur.ya(29)}if(void 0===o&&0===i)throw new Ur.ya(6);if(null==o)break;i++,t[r+a]=o}return i&&(e.node.atime=Date.now()),i},write(e,t,r,n){if(!e.tty||!e.tty.xb.Qb)throw new Ur.ya(60);try{for(var i=0;i<n;i++)e.tty.xb.Qb(e.tty,t[r+i])}catch(e){throw new Ur.ya(29)}return n&&(e.node.mtime=e.node.ctime=Date.now()),i}},rr={ac(){e:{if(!Xt.length){var e=null;if(o){var t=Buffer.alloc(256),r=0,n=process.stdin.fd;try{r=f.readSync(n,t,0,256)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}0<r&&(e=t.slice(0,r).toString("utf-8"))}else globalThis.window?.prompt&&null!==(e=window.prompt("Input: "))&&(e+="\n");if(!e){e=null;break e}Xt=Jt(e)}e=Xt.shift()}return e},Qb(e,t){null===t||10===t?(T(Yt(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){0<e.output?.length&&(T(Yt(e.output)),e.output=[])},ad:()=>({Oc:25856,Qc:5,Nc:191,Pc:35387,Mc:[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]}),bd:()=>0,cd:()=>[24,80]},nr={Qb(e,t){null===t||10===t?(P(Yt(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){0<e.output?.length&&(P(Yt(e.output)),e.output=[])}},ir={kb:null,Ma:()=>ir.createNode(null,"/",16895,0),createNode(e,t,r,n){if(24576==(61440&r)||Ur.isFIFO(r))throw new Ur.ya(63);return ir.kb||(ir.kb={dir:{node:{hb:ir.Ba.hb,jb:ir.Ba.jb,lookup:ir.Ba.lookup,lb:ir.Ba.lb,rename:ir.Ba.rename,unlink:ir.Ba.unlink,rmdir:ir.Ba.rmdir,readdir:ir.Ba.readdir,symlink:ir.Ba.symlink},stream:{bb:ir.Ca.bb}},file:{node:{hb:ir.Ba.hb,jb:ir.Ba.jb},stream:{bb:ir.Ca.bb,read:ir.Ca.read,write:ir.Ca.write,wb:ir.Ca.wb,Bb:ir.Ca.Bb}},link:{node:{hb:ir.Ba.hb,jb:ir.Ba.jb,readlink:ir.Ba.readlink},stream:{}},Wb:{node:{hb:ir.Ba.hb,jb:ir.Ba.jb},stream:Ur.oc}}),pr((r=Ur.createNode(e,t,r,n)).mode)?(r.Ba=ir.kb.dir.node,r.Ca=ir.kb.dir.stream,r.Da={}):Ur.isFile(r.mode)?(r.Ba=ir.kb.file.node,r.Ca=ir.kb.file.stream,r.Oa=0,r.Da=null):40960==(61440&r.mode)?(r.Ba=ir.kb.link.node,r.Ca=ir.kb.link.stream):8192==(61440&r.mode)&&(r.Ba=ir.kb.Wb.node,r.Ca=ir.kb.Wb.stream),r.atime=r.mtime=r.ctime=Date.now(),e&&(e.Da[t]=r,e.atime=e.mtime=e.ctime=r.atime),r},$c:e=>e.Da?e.Da.subarray?e.Da.subarray(0,e.Oa):new Uint8Array(e.Da):new Uint8Array(0),Ba:{hb(e){var t={};return t.dev=8192==(61440&e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,t.size=pr(e.mode)?4096:Ur.isFile(e.mode)?e.Oa:40960==(61440&e.mode)?e.link.length:0,t.atime=new Date(e.atime),t.mtime=new Date(e.mtime),t.ctime=new Date(e.ctime),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},jb(e,t){for(var r of["mode","atime","mtime","ctime"])null!=t[r]&&(e[r]=t[r]);void 0!==t.size&&e.Oa!=(t=t.size)&&(0==t?(e.Da=null,e.Oa=0):(r=e.Da,e.Da=new Uint8Array(t),r&&e.Da.set(r.subarray(0,Math.min(t,e.Oa))),e.Oa=t))},lookup(){throw ir.Jb||(ir.Jb=new Ur.ya(44),ir.Jb.stack="<generic error, no stack>"),ir.Jb},lb:(e,t,r,n)=>ir.createNode(e,t,r,n),rename(e,t,r){try{var n=mr(t,r)}catch(e){}if(n){if(pr(e.mode))for(var i in n.Da)throw new Ur.ya(55);br(n)}delete e.parent.Da[e.name],t.Da[r]=e,e.name=r,t.ctime=t.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,t){delete e.Da[t],e.ctime=e.mtime=Date.now()},rmdir(e,t){var r,n=mr(e,t);for(r in n.Da)throw new Ur.ya(55);delete e.Da[t],e.ctime=e.mtime=Date.now()},readdir:e=>[".","..",...Object.keys(e.Da)],symlink:(e,t,r)=>((e=ir.createNode(e,t,41471,0)).link=r,e),readlink(e){if(40960!=(61440&e.mode))throw new Ur.ya(28);return e.link}},Ca:{read(e,t,r,n,i){var a=e.node.Da;if(i>=e.node.Oa)return 0;if(8<(e=Math.min(e.node.Oa-i,n))&&a.subarray)t.set(a.subarray(i,i+e),r);else for(n=0;n<e;n++)t[r+n]=a[i+n];return e},write(e,t,r,n,i,a){if(t.buffer===v.buffer&&(a=!1),!n)return 0;if((e=e.node).mtime=e.ctime=Date.now(),t.subarray&&(!e.Da||e.Da.subarray)){if(a)return e.Da=t.subarray(r,r+n),e.Oa=n;if(0===e.Oa&&0===i)return e.Da=t.slice(r,r+n),e.Oa=n;if(i+n<=e.Oa)return e.Da.set(t.subarray(r,r+n),i),n}var o=e.Da?e.Da.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=e.Da,e.Da=new Uint8Array(a),0<e.Oa&&e.Da.set(o.subarray(0,e.Oa),0)),e.Da.subarray&&t.subarray)e.Da.set(t.subarray(r,r+n),i);else for(a=0;a<n;a++)e.Da[i+a]=t[r+a];return e.Oa=Math.max(e.Oa,i+n),n},bb(e,t,r){if(1===r?t+=e.position:2===r&&Ur.isFile(e.node.mode)&&(t+=e.node.Oa),0>t)throw new Ur.ya(28);return t},wb(e,t,r,n,i){if(!Ur.isFile(e.node.mode))throw new Ur.ya(43);if(e=e.node.Da,2&i||!e||e.buffer!==v.buffer){if(n=!0,D(),!(i=void 0))throw new Ur.ya(48);e&&((0<r||r+t<e.length)&&(e=e.subarray?e.subarray(r,r+t):Array.prototype.slice.call(e,r,r+t)),v.set(e,i))}else n=!1,i=e.byteOffset;return{La:i,Ic:n}},Bb:(e,t,r,n)=>(ir.Ca.write(e,t,0,n,r,!1),0)}},ar=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},or=0,sr=null,lr=()=>{if(or--,n.monitorRunDependencies?.(or),0==or&&sr){var e=sr;sr=null,e()}},ur=()=>{or++,n.monitorRunDependencies?.(or)},cr=[],hr=async(e,t,r,n,i,a,o,s)=>{var u=t?Kt(Gt(e+"/"+t)):e;ur();try{var c=r;"string"==typeof r&&(c=await(async e=>(e=await l(e),new Uint8Array(e)))(r)),c=await(async(e,t)=>{for(var r of("undefined"!=typeof Browser&&dr(),cr))if(r.canHandle(t))return r.handle(e,t);return e})(c,u),s?.(),a||yr(e,t,c,n,i,o)}finally{lr()}};function dr(){var e,t,r;Ur.Lb=!0,e??=n.stdin,t??=n.stdout,r??=n.stderr,e?Ur.pb("/dev","stdin",e):Ur.symlink("/dev/tty","/dev/stdin"),t?Ur.pb("/dev","stdout",null,t):Ur.symlink("/dev/tty","/dev/stdout"),r?Ur.pb("/dev","stderr",null,r):Ur.symlink("/dev/tty1","/dev/stderr"),Ur.open("/dev/stdin",0),Ur.open("/dev/stdout",1),Ur.open("/dev/stderr",1)}function fr(e,t){Ur.Zb[e]={Ca:t}}function pr(e){return 16384==(61440&e)}function mr(e,t){var r=pr(e.mode)?(r=Ar(e,"x"))?r:e.Ba.lookup?0:2:54;if(r)throw new Ur.ya(r);for(r=Ur.mb[gr(e.id,t)];r;r=r.ub)if(r.parent.id===e.id&&r.name===t)return r;return Ur.lookup(e,t)}function br(e){var t=gr(e.parent.id,e.name);if(Ur.mb[t]===e)Ur.mb[t]=e.ub;else for(t=Ur.mb[t];t;){if(t.ub===e){t.ub=e.ub;break}t=t.ub}}function yr(e,t,r,n,i,a){var o=t;if(e&&(e="string"==typeof e?e:wr(e),o=t?Gt(e+"/"+t):e),e=ar(n,i),o=Ur.create(o,e),r){if("string"==typeof r){for(t=Array(r.length),n=0,i=r.length;n<i;++n)t[n]=r.charCodeAt(n);r=t}Ur.chmod(o,146|e),t=Ur.open(o,577),Ur.write(t,r,0,r.length,0,a),Ur.close(t),Ur.chmod(o,e)}}function vr(e,t={}){if(!e)throw new Ur.ya(44);t.Eb??(t.Eb=!0),"/"===e.charAt(0)||(e=Ur.cwd()+"/"+e);var r=0;e:for(;40>r;r++){e=e.split("/").filter(e=>!!e);for(var n=Ur.root,i="/",a=0;a<e.length;a++){var o=a===e.length-1;if(o&&t.parent)break;if("."!==e[a])if(".."===e[a]){if(i=Ht(i),Ur.Nb(n)){e=i+"/"+e.slice(a+1).join("/"),r--;continue e}n=n.parent}else{i=Gt(i+"/"+e[a]);try{n=mr(n,e[a])}catch(e){if(44===e?.sb&&o&&t.Ac)return{path:i};throw e}if(!n.ib||o&&!t.Eb||(n=n.ib.root),40960==(61440&n.mode)&&(!o||t.gb)){if(!n.Ba.readlink)throw new Ur.ya(52);"/"===(n=n.Ba.readlink(n)).charAt(0)||(n=Ht(i)+"/"+n),e=n+"/"+e.slice(a+1).join("/");continue e}}}return{path:i,node:n}}throw new Ur.ya(32)}function wr(e){for(var t;;){if(Ur.Nb(e))return e=e.Ma.ec,t?"/"!==e[e.length-1]?`${e}/${t}`:e+t:e;t=t?`${e.name}/${t}`:e.name,e=e.parent}}function gr(e,t){for(var r=0,n=0;n<t.length;n++)r=(r<<5)-r+t.charCodeAt(n)|0;return(e+r>>>0)%Ur.mb.length}function $r(e){var t=gr(e.parent.id,e.name);e.ub=Ur.mb[t],Ur.mb[t]=e}function _r(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t}function Ar(e,t){return Ur.bc?0:!t.includes("r")||292&e.mode?t.includes("w")&&!(146&e.mode)||t.includes("x")&&!(73&e.mode)?2:0:2}function xr(e,t){if(!pr(e.mode))return 54;try{return mr(e,t),20}catch(e){}return Ar(e,"wx")}function Sr(e,t,r){try{var n=mr(e,t)}catch(e){return e.sb}if(e=Ar(e,"wx"))return e;if(r){if(!pr(n.mode))return 54;if(Ur.Nb(n)||wr(n)===Ur.cwd())return 10}else if(pr(n.mode))return 31;return 0}function Cr(e,t){if(!e)throw new Ur.ya(t);return e}function Er(e){if(!(e=Ur.wc(e)))throw new Ur.ya(8);return e}function kr(e,t=-1){if(e=Object.assign(new Ur.lc,e),-1==t)e:{for(t=0;t<=Ur.nc;t++)if(!Ur.streams[t])break e;throw new Ur.ya(33)}return e.fd=t,Ur.streams[t]=e}function Tr(e,t,r){var n=e?.Ca.jb;e=n?e:t,n??=t.Ba.jb,Cr(n,63),n(e,r)}function Pr(e){var t=[];for(e=[e];e.length;){var r=e.pop();t.push(r),e.push(...r.Ab)}return t}function Or(e){var t={Lc:4096,Xc:4096,blocks:1e6,Kc:5e5,Jc:5e5,files:Ur.Pb,Vc:Ur.Pb-1,Yc:42,flags:2,gd:255};return e.Ba.ic&&Object.assign(t,e.Ba.ic(e.Ma.Bc.root)),t}function Rr(e,t,r){return void 0===r&&(r=t,t=438),Ur.lb(e,8192|t,r)}function zr(e,t,r,n){Tr(e,t,{mode:4095&r|-4096&t.mode,ctime:Date.now(),$b:n})}function Br(e,t,r){if(pr(t.mode))throw new Ur.ya(31);if(!Ur.isFile(t.mode))throw new Ur.ya(28);var n=Ar(t,"w");if(n)throw new Ur.ya(n);Tr(e,t,{size:r,timestamp:Date.now()})}function Dr(e){if(!(e.yc||e.zc||e.link||e.Da))if(globalThis.XMLHttpRequest)D("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{e.Da=u(e.url)}catch(e){throw new Ur.ya(29)}}var Ur={root:null,Ab:[],Zb:{},streams:[],Pb:1,mb:null,Xb:"/",Lb:!1,bc:!0,sc:null,Hb:0,hc:{},ya:class{name="ErrnoError";constructor(e){this.sb=e}},lc:class{ob={};node=null;get object(){return this.node}set object(e){this.node=e}get flags(){return this.ob.flags}set flags(e){this.ob.flags=e}get position(){return this.ob.position}set position(e){this.ob.position=e}},kc:class{Ba={};Ca={};ib=null;constructor(e,t,r,n){e||=this,this.parent=e,this.Ma=e.Ma,this.id=Ur.Pb++,this.name=t,this.mode=r,this.rdev=n,this.atime=this.mtime=this.ctime=Date.now()}get read(){return!(365&~this.mode)}set read(e){e?this.mode|=365:this.mode&=-366}get write(){return!(146&~this.mode)}set write(e){e?this.mode|=146:this.mode&=-147}get zc(){return pr(this.mode)}get yc(){return 8192==(61440&this.mode)}},createNode:(e,t,r,n)=>($r(e=new Ur.kc(e,t,r,n)),e),Nb:e=>e===e.parent,isFile:e=>32768==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>!(49152&~e),nc:4096,wc:e=>Ur.streams[e],Uc:(e,t=-1)=>(e=kr(e,t),e.Ca?.Tc?.(e),e),oc:{open(e){e.Ca=Ur.uc(e.node.rdev).Ca,e.Ca.open?.(e)},bb(){throw new Ur.ya(70)}},Ob:e=>e>>8,dd:e=>255&e,tb:(e,t)=>e<<8|t,uc:e=>Ur.Zb[e],jc(e,t){function r(e){return Ur.Hb--,t(e)}function n(e){if(e){if(!n.rc)return n.rc=!0,r(e)}else++o>=a.length&&r(null)}"function"==typeof e&&(t=e,e=!1),Ur.Hb++,1<Ur.Hb&&P(`warning: ${Ur.Hb} FS.syncfs operations in flight at once, probably just doing extra work`);var i,a=Pr(Ur.root.Ma),o=0;for(i of a)i.type.jc?i.type.jc(i,e,n):n(null)},Ma(e,t,r){var n="/"===r;if(n&&Ur.root)throw new Ur.ya(10);if(!n&&r){var i=vr(r,{Eb:!1});if(r=i.path,(i=i.node).ib)throw new Ur.ya(10);if(!pr(i.mode))throw new Ur.ya(54)}return(e=e.Ma(t={type:e,Bc:t,ec:r,Ab:[]})).Ma=t,t.root=e,n?Ur.root=e:i&&(i.ib=t,i.Ma&&i.Ma.Ab.push(t)),e},od(e){if(!(e=vr(e,{Eb:!1})).node.ib)throw new Ur.ya(28);var t=(e=e.node).ib,r=Pr(t);for([,i]of Object.entries(Ur.mb))for(;i;){var n=i.ub;r.includes(i.Ma)&&br(i);var i=n}e.ib=null,e.Ma.Ab.splice(e.Ma.Ab.indexOf(t),1)},lookup:(e,t)=>e.Ba.lookup(e,t),lb(e,t,r){var n=vr(e,{parent:!0}).node;if(!(e=qt(e)))throw new Ur.ya(28);if("."===e||".."===e)throw new Ur.ya(20);var i=xr(n,e);if(i)throw new Ur.ya(i);if(!n.Ba.lb)throw new Ur.ya(63);return n.Ba.lb(n,e,t,r)},ic:e=>Or(vr(e,{gb:!0}).node),kd:e=>Or(e.node),create:(e,t=438)=>Ur.lb(e,4095&t|32768,0),mkdir:(e,t=511)=>Ur.lb(e,1023&t|16384,0),ed(e,t){var r,n=e.split("/"),i="";for(r of n)if(r){(i||"/"===e.charAt(0))&&(i+="/"),i+=r;try{Ur.mkdir(i,t)}catch(e){if(20!=e.sb)throw e}}},symlink(e,t){if(!Kt(e))throw new Ur.ya(44);var r=vr(t,{parent:!0}).node;if(!r)throw new Ur.ya(44);var n=xr(r,t=qt(t));if(n)throw new Ur.ya(n);if(!r.Ba.symlink)throw new Ur.ya(63);return r.Ba.symlink(r,t,e)},rename(e,t){var r=Ht(e),n=Ht(t),i=qt(e),a=qt(t),o=vr(e,{parent:!0}),s=o.node;if(o=(o=vr(t,{parent:!0})).node,!s||!o)throw new Ur.ya(44);if(s.Ma!==o.Ma)throw new Ur.ya(75);var l=mr(s,i);if("."!==(e=Zt(e,n)).charAt(0))throw new Ur.ya(28);if("."!==(e=Zt(t,r)).charAt(0))throw new Ur.ya(55);try{var u=mr(o,a)}catch(e){}if(l!==u){if(i=Sr(s,i,t=pr(l.mode)))throw new Ur.ya(i);if(i=u?Sr(o,a,t):xr(o,a))throw new Ur.ya(i);if(!s.Ba.rename)throw new Ur.ya(63);if(l.ib||u&&u.ib)throw new Ur.ya(10);if(o!==s&&(i=Ar(s,"w")))throw new Ur.ya(i);br(l);try{s.Ba.rename(l,o,a),l.parent=o}catch(e){throw e}finally{$r(l)}}},rmdir(e){var t=vr(e,{parent:!0}).node,r=mr(t,e=qt(e)),n=Sr(t,e,!0);if(n)throw new Ur.ya(n);if(!t.Ba.rmdir)throw new Ur.ya(63);if(r.ib)throw new Ur.ya(10);t.Ba.rmdir(t,e),br(r)},readdir:e=>Cr((e=vr(e,{gb:!0}).node).Ba.readdir,54)(e),unlink(e){var t=vr(e,{parent:!0}).node;if(!t)throw new Ur.ya(44);var r=mr(t,e=qt(e)),n=Sr(t,e,!1);if(n)throw new Ur.ya(n);if(!t.Ba.unlink)throw new Ur.ya(63);if(r.ib)throw new Ur.ya(10);t.Ba.unlink(t,e),br(r)},readlink(e){if(!(e=vr(e).node))throw new Ur.ya(44);if(!e.Ba.readlink)throw new Ur.ya(28);return e.Ba.readlink(e)},stat:(e,t)=>Cr((e=vr(e,{gb:!t}).node).Ba.hb,63)(e),fstat(e){var t=Er(e);e=t.node;var r=t.Ca.hb;return t=r?t:e,r??=e.Ba.hb,Cr(r,63),r(t)},lstat:e=>Ur.stat(e,!0),chmod(e,t,r){zr(null,e="string"==typeof e?vr(e,{gb:!r}).node:e,t,r)},lchmod(e,t){Ur.chmod(e,t,!0)},fchmod(e,t){zr(e=Er(e),e.node,t,!1)},chown(e,t,r,n){Tr(null,e="string"==typeof e?vr(e,{gb:!n}).node:e,{timestamp:Date.now(),$b:n})},lchown(e,t,r){Ur.chown(e,t,r,!0)},fchown(e){Tr(e=Er(e),e.node,{timestamp:Date.now(),$b:!1})},truncate(e,t){if(0>t)throw new Ur.ya(28);Br(null,e="string"==typeof e?vr(e,{gb:!0}).node:e,t)},Zc(e,t){if(e=Er(e),0>t||!(2097155&e.flags))throw new Ur.ya(28);Br(e,e.node,t)},pd(e,t,r){Cr((e=vr(e,{gb:!0}).node).Ba.jb,63)(e,{atime:t,mtime:r})},open(e,t,r=438){if(""===e)throw new Ur.ya(44);if("string"==typeof t){var i={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[t];if(void 0===i)throw Error(`Unknown file open mode: ${t}`);t=i}if(r=64&t?4095&r|32768:0,"object"==typeof e)i=e;else{var a=e.endsWith("/");i=(e=vr(e,{gb:!(131072&t),Ac:!0})).node,e=e.path}var o=!1;if(64&t)if(i){if(128&t)throw new Ur.ya(20)}else{if(a)throw new Ur.ya(31);i=Ur.lb(e,511|r,0),o=!0}if(!i)throw new Ur.ya(44);if(8192==(61440&i.mode)&&(t&=-513),65536&t&&!pr(i.mode))throw new Ur.ya(54);if(!o&&(a=i?40960==(61440&i.mode)?32:pr(i.mode)&&("r"!==_r(t)||576&t)?31:Ar(i,_r(t)):44))throw new Ur.ya(a);return 512&t&&!o&&Ur.truncate(i,0),t&=-131713,(a=kr({node:i,path:wr(i),flags:t,seekable:!0,position:0,Ca:i.Ca,Hc:[],error:!1})).Ca.open&&a.Ca.open(a),o&&Ur.chmod(i,511&r),!n.logReadFiles||1&t||e in Ur.hc||(Ur.hc[e]=1),a},close(e){if(null===e.fd)throw new Ur.ya(8);e.Kb&&(e.Kb=null);try{e.Ca.close&&e.Ca.close(e)}catch(e){throw e}finally{Ur.streams[e.fd]=null}e.fd=null},bb(e,t,r){if(null===e.fd)throw new Ur.ya(8);if(!e.seekable||!e.Ca.bb)throw new Ur.ya(70);if(0!=r&&1!=r&&2!=r)throw new Ur.ya(28);return e.position=e.Ca.bb(e,t,r),e.Hc=[],e.position},read(e,t,r,n,i){if(0>n||0>i)throw new Ur.ya(28);if(null===e.fd)throw new Ur.ya(8);if(1==(2097155&e.flags))throw new Ur.ya(8);if(pr(e.node.mode))throw new Ur.ya(31);if(!e.Ca.read)throw new Ur.ya(28);var a=void 0!==i;if(a){if(!e.seekable)throw new Ur.ya(70)}else i=e.position;return t=e.Ca.read(e,t,r,n,i),a||(e.position+=t),t},write(e,t,r,n,i,a){if(0>n||0>i)throw new Ur.ya(28);if(null===e.fd)throw new Ur.ya(8);if(!(2097155&e.flags))throw new Ur.ya(8);if(pr(e.node.mode))throw new Ur.ya(31);if(!e.Ca.write)throw new Ur.ya(28);e.seekable&&1024&e.flags&&Ur.bb(e,0,2);var o=void 0!==i;if(o){if(!e.seekable)throw new Ur.ya(70)}else i=e.position;return t=e.Ca.write(e,t,r,n,i,a),o||(e.position+=t)