@thorvg/webcanvas 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ function e(){const e=globalThis.__ThorVGModule;if(!e)throw new Error("ThorVG module not initialized. Call ThorVG.init() first.");return e}function t(){return!!globalThis.__ThorVGModule}function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var n=function(e){return e[e.Success=0]="Success",e[e.InvalidArguments=1]="InvalidArguments",e[e.InsufficientCondition=2]="InsufficientCondition",e[e.FailedAllocation=3]="FailedAllocation",e[e.MemoryCorruption=4]="MemoryCorruption",e[e.NotSupported=5]="NotSupported",e[e.Unknown=6]="Unknown",e}({});class a extends Error{static fromCode(e,t){return new a(`TVGERR - ${t} failed: ${{0:"Success",1:"Invalid arguments",2:"Insufficient condition",3:"Failed allocation",4:"Memory corruption",5:"Not supported",6:"Unknown error"}[e]??"Unknown error"}`,e,t)}constructor(e,t,n){super(e),r(this,"code",void 0),r(this,"operation",void 0),this.name="ThorVGError",this.code=t,this.operation=n,Error.captureStackTrace&&Error.captureStackTrace(this,a)}}let o;function i(e,t){if(0===e)return;const r=a.fromCode(e,t);if(!o)throw r;o(r,{operation:t})}function s(e,t){const r=new Error(`ERROR - ${t}: ${e}`);if(!o)throw r;o(r,{operation:t})}function u(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function l(e,t){return function(e,t){return t.get?t.get.call(e):t.value}(e,u(e,t,"get"))}function c(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}function d(e,t,r){return function(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}(e,u(e,t,"set"),r),r}var f=new WeakMap,p=new WeakMap;class m{get ptr(){return l(this,p)?(s("Object has been disposed","ptr getter"),0):l(this,f)}set ptr(e){d(this,f,e)}dispose(){l(this,p)||(this._cleanup(l(this,f)),d(this,p,!0))}get isDisposed(){return l(this,p)}constructor(e,t){c(this,f,{writable:!0,value:0}),c(this,p,{writable:!0,value:!1}),d(this,f,e),t&&t.register(this,{ptr:e,cleanup:this._cleanup.bind(this)})}}class h extends m{_cleanup(t){e()._tvg_paint_unref(t,1)}translate(t,r){return e()._tvg_paint_translate(this.ptr,t,r),this}rotate(t){return e()._tvg_paint_rotate(this.ptr,t),this}scale(t,r=t){return e()._tvg_paint_scale(this.ptr,t,r),this}origin(t,r){return i(e()._tvg_picture_set_origin(this.ptr,t,r),"origin"),this}blend(t){return i(e()._tvg_paint_set_blend_method(this.ptr,t),"blend"),this}opacity(t){const r=e();return void 0!==t?(r._tvg_paint_set_opacity(this.ptr,t),this):r._tvg_paint_get_opacity(this.ptr)}visible(t){const r=e();return void 0!==t?(r._tvg_paint_set_visible(this.ptr,t?1:0),this):Boolean(r._tvg_paint_get_visible(this.ptr))}bounds(t){const r=e();if(t?.oriented){const e=r._malloc(32);try{if(0!==r._tvg_paint_get_obb(this.ptr,e))return[];const t=new Float32Array(r.HEAPF32.buffer,e,8);return[{x:t[0],y:t[1]},{x:t[2],y:t[3]},{x:t[4],y:t[5]},{x:t[6],y:t[7]}]}finally{r._free(e)}}else{const e=r._malloc(16);try{r._tvg_paint_get_aabb(this.ptr,e,e+4,e+8,e+12);const t=new Float32Array(r.HEAPF32.buffer,e,4);return{x:t[0],y:t[1],width:t[2],height:t[3]}}finally{r._free(e)}}}duplicate(){const t=e()._tvg_paint_duplicate(this.ptr);return this._createInstance(t)}transform(t){const r=e(),n=r._malloc(36);try{const e=new Float32Array(r.HEAPF32.buffer,n,9);e[0]=t.e11,e[1]=t.e12,e[2]=t.e13,e[3]=t.e21,e[4]=t.e22,e[5]=t.e23,e[6]=t.e31,e[7]=t.e32,e[8]=t.e33,i(r._tvg_paint_set_transform(this.ptr,n),"transform")}finally{r._free(n)}return this}clip(t){return i(e()._tvg_paint_set_clip(this.ptr,t.ptr),"clip"),this}mask(t,r){return i(e()._tvg_paint_set_mask_method(this.ptr,t.ptr,r),"mask"),this}intersects(t,r,n,a){const o=e();return Boolean(o._tvg_paint_intersects(this.ptr,t,r,n,a))}}const g=new FinalizationRegistry(e=>{e.ptr&&t()&&e.cleanup(e.ptr)}),_=new FinalizationRegistry(e=>{e.ptr&&t()&&e.cleanup(e.ptr)}),v=new FinalizationRegistry(e=>{e.ptr&&t()&&e.cleanup(e.ptr)}),b=new FinalizationRegistry(e=>{e.ptr&&t()&&e.cleanup(e.ptr)}),w=new FinalizationRegistry(e=>{e.ptr&&t()&&e.cleanup(e.ptr)});"undefined"!=typeof window&&window.addEventListener("beforeunload",()=>{t()&&e().term()}),"undefined"!=typeof process&&process.on&&process.on("exit",()=>{t()&&e().term()});class y extends h{_createInstance(e){return new y(e)}add(t){return i(e()._tvg_scene_add(this.ptr,t.ptr),"add"),this}remove(t){const r=e();return t?i(r._tvg_scene_remove(this.ptr,t.ptr),"remove"):i(r._tvg_scene_remove(this.ptr,0),"remove (all)"),this}clear(){return this.remove()}resetEffects(){return i(e()._tvg_scene_clear_effects(this.ptr),"resetEffects"),this}gaussianBlur(t,r=0,n=0,a=75){return i(e()._tvg_scene_add_effect_gaussian_blur(this.ptr,t,r,n,a),"gaussianBlur"),this}dropShadow(t,r,n,a,o,s,u,l=60){return i(e()._tvg_scene_add_effect_drop_shadow(this.ptr,t,r,n,a,o,s,u,l),"dropShadow"),this}fillEffect(t,r,n,a){return i(e()._tvg_scene_add_effect_fill(this.ptr,t,r,n,a),"fillEffect"),this}tint(t,r,n,a,o,s,u){return i(e()._tvg_scene_add_effect_tint(this.ptr,t,r,n,a,o,s,u),"tint"),this}tritone(t,r,n,a,o,s,u,l,c,d){return i(e()._tvg_scene_add_effect_tritone(this.ptr,t,r,n,a,o,s,u,l,c,d),"tritone"),this}constructor(t){const r=e();t||(t=r._tvg_scene_new()),super(t,_)}}function x(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function E(e,t){return function(e,t){return t.get?t.get.call(e):t.value}(e,x(e,t,"get"))}function k(e,t,r){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,r)}function S(e,t,r){return function(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}(e,x(e,t,"set"),r),r}var B=new WeakMap,T=new WeakMap,C=new WeakMap,P=new WeakMap,A=new WeakMap,F=new WeakMap,O=new WeakMap,j=new WeakMap,$=new WeakMap,I=new WeakMap;class L{add(e){return E(this,F)?(E(this,F).add(e),S(this,I,!0),this):(s("Main scene not initialized","add"),this)}remove(e){return E(this,F)?(e?E(this,F).remove(e):E(this,F).remove(),S(this,I,!0),this):(s("Main scene not initialized","remove"),this)}clear(){if(!E(this,T)||!E(this,F))return this;const t=e();return E(this,F).clear(),t._tvg_canvas_draw(E(this,B),1),t._tvg_canvas_sync(E(this,B)),"sw"===E(this,C)&&E(this,P)&&E(this,P).getContext("2d").clearRect(0,0,E(this,P).width,E(this,P).height),this}update(){return i(e()._tvg_canvas_update(E(this,B)),"update"),this}render(){if(!E(this,T)||!E(this,P)||!E(this,F))return this;const t=e();if(E(this,I)&&(t._tvg_canvas_update(E(this,B)),S(this,I,!1)),E(this,A)){const e=this._calculateDPR();if(e!==E(this,$)){S(this,$,e);const t={e11:e,e12:0,e13:0,e21:0,e22:e,e23:0,e31:0,e32:0,e33:1};E(this,F).transform(t)}const t=E(this,O)*e,r=E(this,j)*e;E(this,P).width===t&&E(this,P).height===r||(E(this,P).width=t,E(this,P).height=r,E(this,T).resize(t,r))}return t._tvg_canvas_draw(E(this,B),1),t._tvg_canvas_sync(E(this,B)),"sw"===E(this,C)&&this._updateHTMLCanvas(),this}_calculateDPR(){return 1+.75*(window.devicePixelRatio-1)}_updateHTMLCanvas(){if(!E(this,T)||!E(this,P))return;const e=E(this,T).render(),t=E(this,T).size(),r=E(this,P).getContext("2d"),n=new ImageData(new Uint8ClampedArray(e),t.width,t.height);r.putImageData(n,0,0)}resize(e,t){if(S(this,O,e),S(this,j,t),E(this,P)){E(this,P).style.width=`${e}px`,E(this,P).style.height=`${t}px`;const r=E(this,A)?E(this,$):1,n=e*r,a=t*r;E(this,P).width=n,E(this,P).height=a,E(this,T)&&E(this,T).resize(n,a)}return this}viewport(t,r,n,a){return i(e()._tvg_canvas_set_viewport(E(this,B),t,r,n,a),"viewport"),this}destroy(){if(E(this,F)&&(E(this,F).clear(),E(this,F).dispose(),S(this,F,null)),this.clear(),E(this,B)&&S(this,B,0),E(this,T)&&(E(this,T).delete(),S(this,T,null)),E(this,P)&&"sw"===E(this,C)){const e=E(this,P).getContext("2d");e&&e.clearRect(0,0,E(this,P).width,E(this,P).height)}}get renderer(){return E(this,C)}get dpr(){return E(this,$)}constructor(t,r={}){k(this,B,{writable:!0,value:0}),k(this,T,{writable:!0,value:null}),k(this,C,{writable:!0,value:void 0}),k(this,P,{writable:!0,value:null}),k(this,A,{writable:!0,value:void 0}),k(this,F,{writable:!0,value:null}),k(this,O,{writable:!0,value:0}),k(this,j,{writable:!0,value:0}),k(this,$,{writable:!0,value:1}),k(this,I,{writable:!0,value:!1});const{width:n=800,height:a=600,enableDevicePixelRatio:o=!0}=r;S(this,O,n),S(this,j,a),S(this,A,o);const u=ke();S(this,C,u);const l=e(),c=o?this._calculateDPR():1;S(this,$,c);const d=n*c,f=a*c;S(this,T,new l.TvgCanvas(u,t,d,f));const p=E(this,T).error();"None"===p?(S(this,B,E(this,T).ptr()),0!==E(this,B)?(S(this,P,document.querySelector(t)),E(this,P)?(E(this,P).style.width=`${n}px`,E(this,P).style.height=`${a}px`,E(this,P).width=d,E(this,P).height=f,S(this,F,new y),o&&E(this,F).scale(c,c),i(l._tvg_canvas_add(E(this,B),E(this,F).ptr),"add main scene")):s(`Failed to create canvas with ${u} renderer: HTML canvas element not found`,"Canvas constructor")):s(`Failed to create canvas with ${u} renderer: engine pointer is 0`,"Canvas constructor")):s(`Failed to create canvas with ${u} renderer: ${p}`,"Canvas constructor")}}class D extends m{_cleanup(t){e()._tvg_gradient_del(t)}addStop(e,t){return this._stops.push({offset:e,color:t}),this}clearStops(){return this._stops=[],this}setStops(...e){this._stops=[];for(const[t,r]of e)this._stops.push({offset:t,color:r});return this}_applyStops(){if(0===this._stops.length)return;const t=e(),r=this._stops.length,n=t._malloc(8*r);try{const e=new DataView(t.HEAPU8.buffer,n,8*r);for(let t=0;t<r;t++){const r=this._stops[t],n=8*t;e.setFloat32(n,r.offset,!0),e.setUint8(n+4,r.color[0]),e.setUint8(n+5,r.color[1]),e.setUint8(n+6,r.color[2]),e.setUint8(n+7,r.color[3])}t._tvg_gradient_set_color_stops(this.ptr,n,r)}finally{t._free(n),this._stops=[]}}spread(t){return e()._tvg_gradient_set_spread(this.ptr,t),this}constructor(...e){var t,r;super(...e),r=[],(t="_stops")in this?Object.defineProperty(this,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):this[t]=r}}class M extends h{_createInstance(e){return new M(e)}moveTo(t,r){return i(e()._tvg_shape_move_to(this.ptr,t,r),"moveTo"),this}lineTo(t,r){return i(e()._tvg_shape_line_to(this.ptr,t,r),"lineTo"),this}cubicTo(t,r,n,a,o,s){return i(e()._tvg_shape_cubic_to(this.ptr,t,r,n,a,o,s),"cubicTo"),this}close(){return i(e()._tvg_shape_close(this.ptr),"close"),this}appendRect(t,r,n,a,o={}){const s=e(),{rx:u=0,ry:l=0,clockwise:c=!0}=o;return i(s._tvg_shape_append_rect(this.ptr,t,r,n,a,u,l,c?1:0),"appendRect"),this}appendCircle(t,r,n,a=n,o=!0){return i(e()._tvg_shape_append_circle(this.ptr,t,r,n,a,o?1:0),"appendCircle"),this}fillRule(t){return i(e()._tvg_shape_set_fill_rule(this.ptr,t),"fillRule"),this}trimPath(t,r,n=!0){return i(e()._tvg_shape_set_trimpath(this.ptr,t,r,n?1:0),"trimPath"),this}fill(t,r,n,a=255){const o=e();if(t instanceof D)t._applyStops(),i(o._tvg_shape_set_gradient(this.ptr,t.ptr),"fill (gradient)");else{if("number"!=typeof t||void 0===r||void 0===n)throw new TypeError("Invalid fill arguments");i(o._tvg_shape_set_fill_color(this.ptr,t,r,n,a),"fill (color)")}return this}stroke(t){const r=e();if("number"==typeof t)i(r._tvg_shape_set_stroke_width(this.ptr,t),"stroke (width)");else{const{width:e,color:n,cap:a,join:o,gradient:s,miterLimit:u,dash:l,dashOffset:c}=t;if(void 0!==e&&i(r._tvg_shape_set_stroke_width(this.ptr,e),"stroke (width)"),n){const[e,t,a,o=255]=n;i(r._tvg_shape_set_stroke_color(this.ptr,e,t,a,o),"stroke (color)")}if(s&&(s._applyStops(),i(r._tvg_shape_set_stroke_gradient(this.ptr,s.ptr),"stroke (gradient)")),void 0!==a&&i(r._tvg_shape_set_stroke_cap(this.ptr,a),"stroke (cap)"),void 0!==o&&i(r._tvg_shape_set_stroke_join(this.ptr,o),"stroke (join)"),void 0!==u&&i(r._tvg_shape_set_stroke_miterlimit(this.ptr,u),"stroke (miterLimit)"),void 0!==l||void 0!==c){let e=l,t=c??0;if(void 0===e&&void 0!==c){const t=r._malloc(4),n=r._malloc(4),a=r._malloc(4);try{if(0===r._tvg_shape_get_stroke_dash(this.ptr,a,t,n)){const n=r.HEAPU32[t/4];if(n>0){const t=r.HEAPU32[a/4];e=[];for(let a=0;a<n;a++)e.push(r.HEAPF32[t/4+a])}}}finally{r._free(t),r._free(n),r._free(a)}}if(void 0!==e)if(0===e.length)i(r._tvg_shape_set_stroke_dash(this.ptr,0,0,0),"stroke (dash reset)");else{const n=r._malloc(4*e.length);try{for(let t=0;t<e.length;t++)r.HEAPF32[n/4+t]=e[t];i(r._tvg_shape_set_stroke_dash(this.ptr,n,e.length,t),"stroke (dash)")}finally{r._free(n)}}}}return this}reset(){return i(e()._tvg_shape_reset(this.ptr),"reset"),this}constructor(t){const r=e();t||(t=r._tvg_shape_new()),super(t,g)}}var V=function(e){return e[e.Normal=0]="Normal",e[e.Multiply=1]="Multiply",e[e.Screen=2]="Screen",e[e.Overlay=3]="Overlay",e[e.Darken=4]="Darken",e[e.Lighten=5]="Lighten",e[e.ColorDodge=6]="ColorDodge",e[e.ColorBurn=7]="ColorBurn",e[e.HardLight=8]="HardLight",e[e.SoftLight=9]="SoftLight",e[e.Difference=10]="Difference",e[e.Exclusion=11]="Exclusion",e[e.Hue=12]="Hue",e[e.Saturation=13]="Saturation",e[e.Color=14]="Color",e[e.Luminosity=15]="Luminosity",e[e.Add=16]="Add",e[e.Composition=255]="Composition",e}({}),R=function(e){return e[e.Butt=0]="Butt",e[e.Round=1]="Round",e[e.Square=2]="Square",e}({}),W=function(e){return e[e.Miter=0]="Miter",e[e.Round=1]="Round",e[e.Bevel=2]="Bevel",e}({}),z=function(e){return e[e.Winding=0]="Winding",e[e.EvenOdd=1]="EvenOdd",e}({}),U=function(e){return e[e.Pad=0]="Pad",e[e.Reflect=1]="Reflect",e[e.Repeat=2]="Repeat",e}({}),G=function(e){return e[e.None=0]="None",e[e.ClipPath=1]="ClipPath",e[e.AlphaMask=2]="AlphaMask",e[e.InvAlphaMask=3]="InvAlphaMask",e[e.LumaMask=4]="LumaMask",e[e.InvLumaMask=5]="InvLumaMask",e}({}),N=function(e){return e[e.None=0]="None",e[e.Alpha=1]="Alpha",e[e.InvAlpha=2]="InvAlpha",e[e.Luma=3]="Luma",e[e.InvLuma=4]="InvLuma",e[e.Add=5]="Add",e[e.Subtract=6]="Subtract",e[e.Intersect=7]="Intersect",e[e.Difference=8]="Difference",e[e.Lighten=9]="Lighten",e[e.Darken=10]="Darken",e}({}),J=function(e){return e[e.ClearAll=0]="ClearAll",e[e.GaussianBlur=1]="GaussianBlur",e[e.DropShadow=2]="DropShadow",e[e.Fill=3]="Fill",e[e.Tint=4]="Tint",e[e.Tritone=5]="Tritone",e}({}),H=function(e){return e[e.None=0]="None",e[e.Character=1]="Character",e[e.Word=2]="Word",e[e.Smart=3]="Smart",e[e.Ellipsis=4]="Ellipsis",e}({}),q=function(e){return e[e.ABGR8888=0]="ABGR8888",e[e.ARGB8888=1]="ARGB8888",e[e.ABGR8888S=2]="ABGR8888S",e[e.ARGB8888S=3]="ARGB8888S",e[e.Grayscale8=4]="Grayscale8",e[e.Unknown=255]="Unknown",e}({}),X=Object.freeze({__proto__:null,BlendMethod:V,ColorSpace:q,CompositeMethod:G,FillRule:z,GradientSpread:U,MaskMethod:N,SceneEffect:J,StrokeCap:R,StrokeJoin:W,TextWrapMode:H});class Q extends h{_createInstance(e){return new Q(e)}load(t,r={}){const n=e(),{type:a="svg",width:o,height:u,colorSpace:l=q.ARGB8888}=r,c="string"==typeof t?(new TextEncoder).encode(t):t;if("raw"===a){if(!o||!u)return s("Width and height are required for raw image format","load"),this;const e=n._malloc(c.length);n.HEAPU8.set(c,e);try{i(n._tvg_picture_load_raw(this.ptr,e,o,u,l,1),"load")}finally{n._free(e)}return this}const d=n._malloc(c.length);n.HEAPU8.set(c,d);try{i(n._tvg_picture_load_data(this.ptr,d,c.length,a,"",1),"load")}finally{n._free(d)}return this}size(t,r){const n=e();if(void 0!==t&&void 0!==r)return i(n._tvg_picture_set_size(this.ptr,t,r),"size (set)"),this;const a=n._malloc(8);try{n._tvg_picture_get_size(this.ptr,a,a+4);const e=new Float32Array(n.HEAPF32.buffer,a,2);return{width:e[0],height:e[1]}}finally{n._free(a)}}constructor(t,r=!1){const n=e();t||(t=n._tvg_picture_new()),super(t,r?void 0:v)}}class K extends h{_createInstance(e){return new K(e)}font(t){const r=e(),n=r._malloc(t.length+1);r.HEAPU8.set((new TextEncoder).encode(t),n),r.HEAPU8[n+t.length]=0;try{i(r._tvg_text_set_font(this.ptr,n),"font")}finally{r._free(n)}return this}text(t){const r=e(),n=(new TextEncoder).encode(t),a=r._malloc(n.length+1);r.HEAPU8.set(n,a),r.HEAPU8[a+n.length]=0;try{i(r._tvg_text_set_text(this.ptr,a),"text")}finally{r._free(a)}return this}fontSize(t){return i(e()._tvg_text_set_size(this.ptr,t),"fontSize"),this}fill(t,r,n){const a=e();if(t instanceof D)t._applyStops(),i(a._tvg_text_set_gradient(this.ptr,t.ptr),"fill (gradient)");else{if("number"!=typeof t||void 0===r||void 0===n)throw new TypeError("Invalid fill arguments");i(a._tvg_text_set_color(this.ptr,t,r,n),"fill (color)")}return this}align(t,r){return i(e()._tvg_text_align(this.ptr,t,r),"align"),this}layout(t,r=0){return i(e()._tvg_text_layout(this.ptr,t,r),"layout"),this}wrap(t){return i(e()._tvg_text_wrap_mode(this.ptr,t),"wrap"),this}spacing(t,r){return i(e()._tvg_text_spacing(this.ptr,t,r),"spacing"),this}italic(t=.18){return i(e()._tvg_text_set_italic(this.ptr,t),"italic"),this}outline(t,r,n,a){return i(e()._tvg_text_set_outline(this.ptr,t,r,n,a),"outline"),this}constructor(t){const r=e();t||(t=r._tvg_text_new()),super(t,b)}}function Z(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Y(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}function ee(e,t){return function(e,t){return t.get?t.get.call(e):t.value}(e,Y(e,t,"get"))}function te(e,t,r){Z(e,t),t.set(e,r)}function re(e,t,r){return function(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}(e,Y(e,t,"set"),r),r}var ne=new WeakMap,ae=new WeakMap,oe=new WeakMap,ie=new WeakMap,se=new WeakMap,ue=new WeakMap,le=new WeakMap,ce=new WeakMap,de=new WeakMap,fe=new WeakMap,pe=new WeakSet;class me{get ptr(){return ee(this,ne)}get picture(){if(!ee(this,ae)&&ee(this,ne)){const t=e()._tvg_animation_get_picture(ee(this,ne));t&&re(this,ae,new Q(t,!0))}return ee(this,ae)}load(e){const t=this.picture;return t?(t.load(e,{type:"lot"}),function(e,t,r){if(!pe.has(e))throw new TypeError("attempted to get private field on non-instance");return r}(this,0,he).call(this),this):(s("Failed to get picture from animation","load"),this)}info(){return ee(this,oe)}frame(t){const r=e();return void 0!==t?(re(this,se,t),i(r._tvg_animation_set_frame(ee(this,ne),t),"frame (set)"),this):ee(this,se)}segment(t){return i(e()._tvg_animation_set_segment(ee(this,ne),t),"segment"),this}play(e){return ee(this,ie)?this:ee(this,oe)?(re(this,ie,!0),re(this,ce,e),re(this,le,0),ee(this,fe).call(this,performance.now()),this):(s("No animation loaded","play"),this)}pause(){return re(this,ie,!1),null!==ee(this,ue)&&(cancelAnimationFrame(ee(this,ue)),re(this,ue,null)),this}stop(){return this.pause(),this.frame(0),this}isPlaying(){return ee(this,ie)}setLoop(e){return re(this,de,e),this}getLoop(){return ee(this,de)}seek(e){if(!ee(this,oe))return s("No animation loaded","seek"),this;const t=e/ee(this,oe).duration*ee(this,oe).totalFrames;return this.frame(Math.max(0,Math.min(ee(this,oe).totalFrames-1,t))),this}getCurrentTime(){return ee(this,oe)?ee(this,se)/ee(this,oe).totalFrames*ee(this,oe).duration:0}dispose(){this.pause(),ee(this,ne)&&(e()._tvg_animation_del(ee(this,ne)),re(this,ne,0),re(this,ae,null),re(this,oe,null))}constructor(){var t;Z(this,t=pe),t.add(this),te(this,ne,{writable:!0,value:void 0}),te(this,ae,{writable:!0,value:null}),te(this,oe,{writable:!0,value:null}),te(this,ie,{writable:!0,value:!1}),te(this,se,{writable:!0,value:0}),te(this,ue,{writable:!0,value:null}),te(this,le,{writable:!0,value:0}),te(this,ce,{writable:!0,value:void 0}),te(this,de,{writable:!0,value:!0}),te(this,fe,{writable:!0,value:t=>{if(!ee(this,ie)||!ee(this,oe))return;0===ee(this,le)&&re(this,le,t);const r=(t-ee(this,le))/1e3;re(this,le,t);const n=ee(this,oe).fps*r;if(re(this,se,ee(this,se)+n),ee(this,se)>=ee(this,oe).totalFrames){if(!ee(this,de))return re(this,se,ee(this,oe).totalFrames-1),void this.pause();re(this,se,ee(this,se)%ee(this,oe).totalFrames)}e()._tvg_animation_set_frame(ee(this,ne),ee(this,se)),ee(this,ce)&&ee(this,ce).call(this,ee(this,se)),re(this,ue,requestAnimationFrame(ee(this,fe)))}});const r=e();re(this,ne,r._tvg_animation_new()),ee(this,ne)||(s("Failed to create animation","Animation constructor"),re(this,ne,0))}}function he(){const t=e(),r=t._malloc(4),n=t._malloc(4);try{t._tvg_animation_get_total_frame(ee(this,ne),r),t._tvg_animation_get_duration(ee(this,ne),n);const e=new Float32Array(t.HEAPF32.buffer,r,1)[0],a=new Float32Array(t.HEAPF32.buffer,n,1)[0];re(this,oe,{totalFrames:e,duration:a,fps:e/a})}finally{t._free(r),t._free(n)}}class ge extends D{build(){return this._applyStops(),this}constructor(t,r,n,a){const o=e(),i=o._tvg_linear_gradient_new();super(i,w),o._tvg_linear_gradient_set(i,t,r,n,a)}}class _e extends D{build(){return this._applyStops(),this}constructor(t,r,n,a=t,o=r,i=0){const s=e(),u=s._tvg_radial_gradient_new();super(u,w),s._tvg_radial_gradient_set(u,t,r,n,a,o,i)}}class ve{static load(t,r,n={}){const a=e(),{type:o="ttf"}=n,s=a._malloc(t.length+1);a.HEAPU8.set((new TextEncoder).encode(t),s),a.HEAPU8[s+t.length]=0;const u=a._malloc(r.length);a.HEAPU8.set(r,u);const l=a._malloc(o.length+1);a.HEAPU8.set((new TextEncoder).encode(o),l),a.HEAPU8[l+o.length]=0;try{i(a._tvg_font_load_data(s,u,r.length,l,1),`Font.load("${t}")`)}finally{a._free(s),a._free(u),a._free(l)}}static unload(t){const r=e(),n=r._malloc(t.length+1);r.HEAPU8.set((new TextEncoder).encode(t),n),r.HEAPU8[n+t.length]=0;try{i(r._tvg_font_unload(n),`Font.unload("${t}")`)}finally{r._free(n)}}}function be(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}async function we(e={}){var t=e,r=!!globalThis.window,n=!!globalThis.WorkerGlobalScope,a=globalThis.process?.versions?.node&&"renderer"!=globalThis.process?.type;if(a){const{createRequire:e}=await import("module");var o=e(import.meta.url)}var i,s,u=(e,t)=>{throw t},l=import.meta.url,c="";if(a){var d=o("fs");l.startsWith("file:")&&(c=o("path").dirname(o("url").fileURLToPath(l))+"/"),s=e=>(e=A(e)?new URL(e):e,d.readFileSync(e)),i=async(e,t=!0)=>(e=A(e)?new URL(e):e,d.readFileSync(e,t?void 0:"utf8")),process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),u=(e,t)=>{throw process.exitCode=e,t}}else if(r||n){try{c=new URL(".",l).href}catch{}n&&(s=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),i=async e=>{if(A(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 new Error(t.status+" : "+t.url)}}var f,p,m,h,g,_,v,b,w,y,x,E,k,S,B,T=function(){}.bind(),C=function(){}.bind(),P=!1,A=e=>e.startsWith("file://"),F=!1;function O(){var e=Rr.buffer;g=new Int8Array(e),v=new Int16Array(e),t.HEAPU8=_=new Uint8Array(e),b=new Uint16Array(e),w=new Int32Array(e),y=new Uint32Array(e),t.HEAPF32=x=new Float32Array(e),E=new Float64Array(e),k=new BigInt64Array(e),S=new BigUint64Array(e)}function j(e){t.onAbort?.(e),C(e="Aborted("+e+")"),P=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw h?.(r),r}class ${constructor(e){be(this,"name","ExitStatus"),this.message=`Program terminated with exit(${e})`,this.status=e}}var I=e=>{for(;e.length>0;)e.shift()(t)},L=[],D=e=>L.push(e),M=[],V=e=>M.push(e),R=!0,W=e=>$r(e),z=()=>Lr(),U=new TextDecoder,G=(e,t,r,n)=>{var a=t+r;if(n)return a;for(;e[t]&&!(t>=a);)++t;return t},N=(e,t,r)=>{if(!e)return"";var n=G(_,e,t,r);return U.decode(_.subarray(e,n))},J=0;class H{set_type(e){y[this.ptr+4>>2]=e}get_type(){return y[this.ptr+4>>2]}set_destructor(e){y[this.ptr+8>>2]=e}get_destructor(){return y[this.ptr+8>>2]}set_caught(e){g[this.ptr+12]=e=e?1:0}get_caught(){return 0!=g[this.ptr+12]}set_rethrown(e){g[this.ptr+13]=e=e?1:0}get_rethrown(){return 0!=g[this.ptr+13]}init(e,t){this.set_adjusted_ptr(0),this.set_type(e),this.set_destructor(t)}set_adjusted_ptr(e){y[this.ptr+16>>2]=e}get_adjusted_ptr(){return y[this.ptr+16>>2]}constructor(e){this.excPtr=e,this.ptr=e-24}}var q=e=>jr(e),X=e=>{var t=J;if(!t)return q(0),0;var r=new H(t);r.set_adjusted_ptr(t);var n=r.get_type();if(!n)return q(0),t;for(var a of e){if(0===a||a===n)break;if(Mr(a,n,r.ptr+16))return q(a),t}return q(n),t},Q=e=>{for(var t="";;){var r=_[e++];if(!r)return t;t+=String.fromCharCode(r)}},K={},Z={},Y={},ee=class extends Error{constructor(e){super(e),this.name="BindingError"}},te=e=>{throw new ee(e)};function re(e,t,r={}){return function(e,t,r={}){var n=t.name;if(e||te(`type "${n}" must have a positive integer typeid pointer`),Z.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;te(`Cannot register type '${n}' twice`)}if(Z[e]=t,delete Y[e],K.hasOwnProperty(e)){var a=K[e];delete K[e],a.forEach(e=>e())}}(e,t,r)}var ne=(e,t,r)=>{switch(t){case 1:return r?e=>g[e]:e=>_[e];case 2:return r?e=>v[e>>1]:e=>b[e>>1];case 4:return r?e=>w[e>>2]:e=>y[e>>2];case 8:return r?e=>k[e>>3]:e=>S[e>>3];default:throw new TypeError(`invalid integer width (${t}): ${e}`)}},ae=e=>{te(e.$$.ptrType.registeredClass.name+" instance already deleted")},oe=!1,ie=e=>{},se=e=>{e.count.value-=1,0===e.count.value&&(e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)})(e)},ue=e=>globalThis.FinalizationRegistry?(oe=new FinalizationRegistry(e=>{se(e.$$)}),ue=e=>{var t=e.$$;return!t.smartPtr||oe.register(e,{$$:t},e),e},ie=e=>oe.unregister(e),ue(e)):(ue=e=>e,e);function le(){}var ce=(e,t)=>Object.defineProperty(t,"name",{value:e}),de={},fe=(e,t,r)=>{if(void 0===e[t].overloadTable){var n=e[t];e[t]=function(...n){return e[t].overloadTable.hasOwnProperty(n.length)||te(`Function '${r}' called with an invalid number of arguments (${n.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[n.length].apply(this,n)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}},pe=(e,r,n)=>{t.hasOwnProperty(e)?((void 0===n||void 0!==t[e].overloadTable&&void 0!==t[e].overloadTable[n])&&te(`Cannot register public name '${e}' twice`),fe(t,e,e),t[e].overloadTable.hasOwnProperty(n)&&te(`Cannot register multiple overloads of a function with the same number of arguments (${n})!`),t[e].overloadTable[n]=r):(t[e]=r,t[e].argCount=n)};function me(e,t,r,n,a,o,i,s){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=a,this.getActualType=o,this.upcast=i,this.downcast=s,this.pureVirtualFunctions=[]}var he=(e,t,r)=>{for(;t!==r;)t.upcast||te(`Expected null or instance of ${r.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e},ge=e=>{if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e};function _e(e,t){return null===t?(this.isReference&&te(`null is not a valid ${this.name}`),0):(t.$$||te(`Cannot pass "${ge(t)}" as a ${this.name}`),t.$$.ptr||te(`Cannot pass deleted object as a pointer of type ${this.name}`),he(t.$$.ptr,t.$$.ptrType.registeredClass,this.registeredClass))}function ve(e,t){var r;if(null===t)return this.isReference&&te(`null is not a valid ${this.name}`),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;if(t&&t.$$||te(`Cannot pass "${ge(t)}" as a ${this.name}`),t.$$.ptr||te(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&te(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`),r=he(t.$$.ptr,t.$$.ptrType.registeredClass,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&te("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:te(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var n=t.clone();r=this.rawShare(r,Ne.toHandle(()=>n.delete())),null!==e&&e.push(this.rawDestructor,r)}break;default:te("Unsupporting sharing policy")}return r}function we(e,t){return null===t?(this.isReference&&te(`null is not a valid ${this.name}`),0):(t.$$||te(`Cannot pass "${ge(t)}" as a ${this.name}`),t.$$.ptr||te(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&te(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`),he(t.$$.ptr,t.$$.ptrType.registeredClass,this.registeredClass))}function ye(e){return this.fromWireType(y[e>>2])}var xe=(e,t,r)=>{if(t===r)return e;if(void 0===r.baseClass)return null;var n=xe(e,t,r.baseClass);return null===n?null:r.downcast(n)},Ee={},ke=class extends Error{constructor(e){super(e),this.name="InternalError"}},Se=e=>{throw new ke(e)},Be=(e,t)=>(t.ptrType&&t.ptr||Se("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&Se("Both smartPtrType and smartPtr must be specified"),t.count={value:1},ue(Object.create(e,{$$:{value:t,writable:!0}})));function Te(e,t,r,n,a,o,i,s,u,l,c){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=a,this.pointeeType=o,this.sharingPolicy=i,this.rawGetPointee=s,this.rawConstructor=u,this.rawShare=l,this.rawDestructor=c,a||void 0!==t.baseClass?this.toWireType=ve:n?(this.toWireType=_e,this.destructorFunction=null):(this.toWireType=we,this.destructorFunction=null)}var Ce=(e,r,n)=>{t.hasOwnProperty(e)||Se("Replacing nonexistent public symbol"),void 0!==t[e].overloadTable&&void 0!==n?t[e].overloadTable[n]=r:(t[e]=r,t[e].argCount=n)},Pe=e=>Wr.get(e),Ae=(e,t,r=!1)=>{e=Q(e);var n=Pe(t);return"function"!=typeof n&&te(`unknown function pointer with signature ${e}: ${t}`),n};class Fe extends Error{}var Oe=e=>{var t=or(e),r=Q(t);return nr(t),r},je=(e,t)=>{var r=[],n={};throw t.forEach(function e(t){n[t]||Z[t]||(Y[t]?Y[t].forEach(e):(r.push(t),n[t]=!0))}),new Fe(`${e}: `+r.map(Oe).join([", "]))},$e=(e,t,r)=>{function n(t){var n=r(t);n.length!==e.length&&Se("Mismatched type converter count");for(var a=0;a<e.length;++a)re(e[a],n[a])}e.forEach(e=>Y[e]=t);var a=new Array(t.length),o=[],i=0;for(let[e,r]of t.entries())Z.hasOwnProperty(r)?a[e]=Z[r]:(o.push(r),K.hasOwnProperty(r)||(K[r]=[]),K[r].push(()=>{a[e]=Z[r],++i===o.length&&n(a)}));0===o.length&&n(a)},Ie=(e,t)=>{for(var r=[],n=0;n<e;n++)r.push(y[t+4*n>>2]);return r},Le=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function De(e){for(var t=1;t<e.length;++t)if(null!==e[t]&&void 0===e[t].destructorFunction)return!0;return!1}function Me(e,t,r,n,a,o){var i=t.length;i<2&&te("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var s=null!==t[1]&&null!==r,u=De(t),l=!t[0].isVoid,c=t[0],d=t[1],f=[e,te,n,a,Le,c.fromWireType.bind(c),d?.toWireType.bind(d)],p=2;p<i;++p){var m=t[p];f.push(m.toWireType.bind(m))}if(!u)for(p=s?1:2;p<t.length;++p)null!==t[p].destructorFunction&&f.push(t[p].destructorFunction);let h=function(e,t,r,n){var a=De(e),o=e.length-2,i=[],s=["fn"];t&&s.push("thisWired");for(var u=0;u<o;++u)i.push(`arg${u}`),s.push(`arg${u}Wired`);i=i.join(","),s=s.join(",");var l=`return function (${i}) {\n`;a&&(l+="var destructors = [];\n");var c=a?"destructors":"null",d=["humanName","throwBindingError","invoker","fn","runDestructors","fromRetWire","toClassParamWire"];for(t&&(l+=`var thisWired = toClassParamWire(${c}, this);\n`),u=0;u<o;++u){var f=`toArg${u}Wire`;l+=`var arg${u}Wired = ${f}(${c}, arg${u});\n`,d.push(f)}if(l+=(r||n?"var rv = ":"")+`invoker(${s});\n`,a)l+="runDestructors(destructors);\n";else for(u=t?1:2;u<e.length;++u){var p=1===u?"thisWired":"arg"+(u-2)+"Wired";null!==e[u].destructorFunction&&(l+=`${p}_dtor(${p});\n`,d.push(`${p}_dtor`))}return r&&(l+="var ret = fromRetWire(rv);\nreturn ret;\n"),l+="}\n",new Function(d,l)}(t,s,l,o);var g=h(...f);return ce(e,g)}var Ve,Re,We=e=>{const t=(e=e.trim()).indexOf("(");return-1===t?e:e.slice(0,t)},ze=[],Ue=[0,1,,1,null,1,!0,1,!1,1],Ge=e=>{e>9&&0===--Ue[e+1]&&(Ue[e]=void 0,ze.push(e))},Ne={toValue:e=>(e||te(`Cannot use deleted val. handle = ${e}`),Ue[e]),toHandle:e=>{switch(e){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const t=ze.pop()||Ue.length;return Ue[t]=e,Ue[t+1]=1,t}}}},Je={name:"emscripten::val",fromWireType:e=>{var t=Ne.toValue(e);return Ge(e),t},toWireType:(e,t)=>Ne.toHandle(t),readValueFromPointer:ye,destructorFunction:null},He=e=>re(e,Je),qe=(e,t)=>{switch(t){case 4:return function(e){return this.fromWireType(x[e>>2])};case 8:return function(e){return this.fromWireType(E[e>>3])};default:throw new TypeError(`invalid float width (${t}): ${e}`)}},Xe=(e,t,r,n)=>{if(!(n>0))return 0;for(var a=r,o=r+n-1,i=0;i<e.length;++i){var s=e.codePointAt(i);if(s<=127){if(r>=o)break;t[r++]=s}else if(s<=2047){if(r+1>=o)break;t[r++]=192|s>>6,t[r++]=128|63&s}else if(s<=65535){if(r+2>=o)break;t[r++]=224|s>>12,t[r++]=128|s>>6&63,t[r++]=128|63&s}else{if(r+3>=o)break;t[r++]=240|s>>18,t[r++]=128|s>>12&63,t[r++]=128|s>>6&63,t[r++]=128|63&s,i++}}return t[r]=0,r-a},Qe=(e,t,r)=>Xe(e,_,t,r),Ke=e=>{for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n<=127?t++:n<=2047?t+=2:n>=55296&&n<=57343?(t+=4,++r):t+=3}return t},Ze=new TextDecoder("utf-16le"),Ye=(e,t,r)=>{var n=e>>1,a=G(b,n,t/2,r);return Ze.decode(b.subarray(n,a))},et=(e,t,r)=>{if(r??(r=2147483647),r<2)return 0;for(var n=t,a=(r-=2)<2*e.length?r/2:e.length,o=0;o<a;++o){var i=e.charCodeAt(o);v[t>>1]=i,t+=2}return v[t>>1]=0,t-n},tt=e=>2*e.length,rt=(e,t,r)=>{for(var n="",a=e>>2,o=0;!(o>=t/4);o++){var i=y[a+o];if(!i&&!r)break;n+=String.fromCodePoint(i)}return n},nt=(e,t,r)=>{if(r??(r=2147483647),r<4)return 0;for(var n=t,a=n+r-4,o=0;o<e.length;++o){var i=e.codePointAt(o);if(i>65535&&o++,w[t>>2]=i,(t+=4)+4>a)break}return w[t>>2]=0,t-n},at=e=>{for(var t=0,r=0;r<e.length;++r)e.codePointAt(r)>65535&&r++,t+=4;return t},ot=0,it=[],st=(e,t)=>{var r=Z[e];return void 0===r&&te(`${t} has unknown type ${Oe(e)}`),r},ut=(e,t,r)=>{var n=[],a=e(n,r);return n.length&&(y[t>>2]=Ne.toHandle(n)),a},lt={},ct=e=>{var t=lt[e];return void 0===t?Q(e):t},dt={},ft=e=>{if(e instanceof $||"unwind"==e)return p;u(1,e)},pt=()=>R||ot>0,mt=e=>{p=e,pt()||(t.onExit?.(e),P=!0),u(e,new $(e))},ht=e=>{if(!P)try{e(),(()=>{if(!pt())try{p=e=p,mt(e)}catch(e){ft(e)}var e})()}catch(e){ft(e)}},gt=(e,t)=>Math.ceil(e/t)*t,_t=e=>{var t=(e-Rr.buffer.byteLength+65535)/65536|0;try{return Rr.grow(t),O(),1}catch(e){}},vt=e=>{var t=["ANGLE_instanced_arrays","EXT_blend_minmax","EXT_disjoint_timer_query","EXT_frag_depth","EXT_shader_texture_lod","EXT_sRGB","OES_element_index_uint","OES_fbo_render_mipmap","OES_standard_derivatives","OES_texture_float","OES_texture_half_float","OES_texture_half_float_linear","OES_vertex_array_object","WEBGL_color_buffer_float","WEBGL_depth_texture","WEBGL_draw_buffers","EXT_color_buffer_float","EXT_conservative_depth","EXT_disjoint_timer_query_webgl2","EXT_texture_norm16","NV_shader_noperspective_interpolation","WEBGL_clip_cull_distance","EXT_clip_control","EXT_color_buffer_half_float","EXT_depth_clamp","EXT_float_blend","EXT_polygon_offset_clamp","EXT_texture_compression_bptc","EXT_texture_compression_rgtc","EXT_texture_filter_anisotropic","KHR_parallel_shader_compile","OES_texture_float_linear","WEBGL_blend_func_extended","WEBGL_compressed_texture_astc","WEBGL_compressed_texture_etc","WEBGL_compressed_texture_etc1","WEBGL_compressed_texture_s3tc","WEBGL_compressed_texture_s3tc_srgb","WEBGL_debug_renderer_info","WEBGL_debug_shaders","WEBGL_lose_context","WEBGL_multi_draw","WEBGL_polygon_mode"];return(e.getSupportedExtensions()||[]).filter(e=>t.includes(e))},bt={counter:1,buffers:[],mappedBuffers:{},programs:[],framebuffers:[],renderbuffers:[],textures:[],shaders:[],vaos:[],contexts:[],offscreenCanvases:{},queries:[],samplers:[],transformFeedbacks:[],syncs:[],byteSizeByTypeRoot:5120,byteSizeByType:[1,1,2,2,4,4,4,2,3,4,8],stringCache:{},stringiCache:{},unpackAlignment:4,unpackRowLength:0,recordError:e=>{bt.lastError||(bt.lastError=e)},getNewId:e=>{for(var t=bt.counter++,r=e.length;r<t;r++)e[r]=null;for(;e[t];)t=bt.counter++;return t},genObject:(e,t,r,n)=>{for(var a=0;a<e;a++){var o=Ve[r](),i=o&&bt.getNewId(n);o?(o.name=i,n[i]=o):bt.recordError(1282),w[t+4*a>>2]=i}},MAX_TEMP_BUFFER_SIZE:2097152,numTempVertexBuffersPerSize:64,log2ceilLookup:e=>32-Math.clz32(0===e?0:e-1),generateTempBuffers:(e,t)=>{var r=bt.log2ceilLookup(bt.MAX_TEMP_BUFFER_SIZE);t.tempVertexBufferCounters1=[],t.tempVertexBufferCounters2=[],t.tempVertexBufferCounters1.length=t.tempVertexBufferCounters2.length=r+1,t.tempVertexBuffers1=[],t.tempVertexBuffers2=[],t.tempVertexBuffers1.length=t.tempVertexBuffers2.length=r+1,t.tempIndexBuffers=[],t.tempIndexBuffers.length=r+1;for(var n=0;n<=r;++n){t.tempIndexBuffers[n]=null,t.tempVertexBufferCounters1[n]=t.tempVertexBufferCounters2[n]=0;var a=bt.numTempVertexBuffersPerSize;t.tempVertexBuffers1[n]=[],t.tempVertexBuffers2[n]=[];var o=t.tempVertexBuffers1[n],i=t.tempVertexBuffers2[n];o.length=i.length=a;for(var s=0;s<a;++s)o[s]=i[s]=null}if(e){t.tempQuadIndexBuffer=Ve.createBuffer(),t.GLctx.bindBuffer(34963,t.tempQuadIndexBuffer);for(var u=bt.MAX_TEMP_BUFFER_SIZE>>1,l=new Uint16Array(u),c=(n=0,0);l[n++]=c,!(n>=u||(l[n++]=c+1,n>=u)||(l[n++]=c+2,n>=u)||(l[n++]=c,n>=u)||(l[n++]=c+2,n>=u)||(l[n++]=c+3,n>=u));)c+=4;t.GLctx.bufferData(34963,l,35044),t.GLctx.bindBuffer(34963,null)}},getTempVertexBuffer:e=>{var t=bt.log2ceilLookup(e),r=bt.currentContext.tempVertexBuffers1[t],n=bt.currentContext.tempVertexBufferCounters1[t];bt.currentContext.tempVertexBufferCounters1[t]=bt.currentContext.tempVertexBufferCounters1[t]+1&bt.numTempVertexBuffersPerSize-1;var a=r[n];if(a)return a;var o=Ve.getParameter(34964);return r[n]=Ve.createBuffer(),Ve.bindBuffer(34962,r[n]),Ve.bufferData(34962,1<<t,35048),Ve.bindBuffer(34962,o),r[n]},getTempIndexBuffer:e=>{var t=bt.log2ceilLookup(e),r=bt.currentContext.tempIndexBuffers[t];if(r)return r;var n=Ve.getParameter(34965);return bt.currentContext.tempIndexBuffers[t]=Ve.createBuffer(),Ve.bindBuffer(34963,bt.currentContext.tempIndexBuffers[t]),Ve.bufferData(34963,1<<t,35048),Ve.bindBuffer(34963,n),bt.currentContext.tempIndexBuffers[t]},newRenderingFrameStarted:()=>{if(bt.currentContext){var e=bt.currentContext.tempVertexBuffers1;bt.currentContext.tempVertexBuffers1=bt.currentContext.tempVertexBuffers2,bt.currentContext.tempVertexBuffers2=e,e=bt.currentContext.tempVertexBufferCounters1,bt.currentContext.tempVertexBufferCounters1=bt.currentContext.tempVertexBufferCounters2,bt.currentContext.tempVertexBufferCounters2=e;for(var t=bt.log2ceilLookup(bt.MAX_TEMP_BUFFER_SIZE),r=0;r<=t;++r)bt.currentContext.tempVertexBufferCounters1[r]=0}},getSource:(e,t,r,n)=>{for(var a="",o=0;o<t;++o)a+=N(y[r+4*o>>2],n?y[n+4*o>>2]:void 0);return a},calcBufLength:(e,t,r,n)=>r>0?n*r:e*bt.byteSizeByType[t-bt.byteSizeByTypeRoot]*n,usedTempBuffers:[],preDrawHandleClientVertexAttribBindings:e=>{bt.resetBufferBinding=!1;for(var t=0;t<bt.currentContext.maxVertexAttribs;++t){var r=bt.currentContext.clientBuffers[t];if(r.clientside&&r.enabled){bt.resetBufferBinding=!0;var n=bt.calcBufLength(r.size,r.type,r.stride,e),a=bt.getTempVertexBuffer(n);Ve.bindBuffer(34962,a),Ve.bufferSubData(34962,0,_.subarray(r.ptr,r.ptr+n)),r.vertexAttribPointerAdaptor.call(Ve,t,r.size,r.type,r.normalized,r.stride,0)}}},postDrawHandleClientVertexAttribBindings:()=>{bt.resetBufferBinding&&Ve.bindBuffer(34962,bt.buffers[Ve.currentArrayBufferBinding])},createContext:(e,t)=>{if(!e.getContextSafariWebGL2Fixed){function n(t,r){var n=e.getContextSafariWebGL2Fixed(t,r);return"webgl"==t==n instanceof WebGLRenderingContext?n:null}e.getContextSafariWebGL2Fixed=e.getContext,e.getContext=n}var r=e.getContext(t.majorVersion>1?"webgl2":"webgl",t);return r?bt.registerContext(r,t):0},registerContext:(e,t)=>{var r=bt.getNewId(bt.contexts),n={handle:r,attributes:t,version:t.majorVersion,GLctx:e};e.canvas&&(e.canvas.GLctxObject=n),bt.contexts[r]=n,(void 0===t.enableExtensionsByDefault||t.enableExtensionsByDefault)&&bt.initExtensions(n),n.maxVertexAttribs=n.GLctx.getParameter(34921),n.clientBuffers=[];for(var a=0;a<n.maxVertexAttribs;a++)n.clientBuffers[a]={enabled:!1,clientside:!1,size:0,type:0,normalized:0,stride:0,ptr:0,vertexAttribPointerAdaptor:null};return bt.generateTempBuffers(!1,n),r},makeContextCurrent:e=>(bt.currentContext=bt.contexts[e],t.ctx=Ve=bt.currentContext?.GLctx,!(e&&!Ve)),getContext:e=>bt.contexts[e],deleteContext:e=>{bt.currentContext===bt.contexts[e]&&(bt.currentContext=null),"object"==typeof JSEvents&&JSEvents.removeAllHandlersOnTarget(bt.contexts[e].GLctx.canvas),bt.contexts[e]?.GLctx.canvas&&(bt.contexts[e].GLctx.canvas.GLctxObject=void 0),bt.contexts[e]=null},initExtensions:e=>{if(e||(e=bt.currentContext),!e.initExtensionsDone){e.initExtensionsDone=!0;var t,r=e.GLctx;for(var n of((t=r).multiDrawWebgl=t.getExtension("WEBGL_multi_draw"),(e=>{e.extPolygonOffsetClamp=e.getExtension("EXT_polygon_offset_clamp")})(r),(e=>{e.extClipControl=e.getExtension("EXT_clip_control")})(r),(e=>{e.webglPolygonMode=e.getExtension("WEBGL_polygon_mode")})(r),(e=>{var t=e.getExtension("ANGLE_instanced_arrays");t&&(e.vertexAttribDivisor=(e,r)=>t.vertexAttribDivisorANGLE(e,r),e.drawArraysInstanced=(e,r,n,a)=>t.drawArraysInstancedANGLE(e,r,n,a),e.drawElementsInstanced=(e,r,n,a,o)=>t.drawElementsInstancedANGLE(e,r,n,a,o))})(r),(e=>{var t=e.getExtension("OES_vertex_array_object");t&&(e.createVertexArray=()=>t.createVertexArrayOES(),e.deleteVertexArray=e=>t.deleteVertexArrayOES(e),e.bindVertexArray=e=>t.bindVertexArrayOES(e),e.isVertexArray=e=>t.isVertexArrayOES(e))})(r),(e=>{var t=e.getExtension("WEBGL_draw_buffers");t&&(e.drawBuffers=(e,r)=>t.drawBuffersWEBGL(e,r))})(r),(e=>{e.dibvbi=e.getExtension("WEBGL_draw_instanced_base_vertex_base_instance")})(r),(e=>{e.mdibvbi=e.getExtension("WEBGL_multi_draw_instanced_base_vertex_base_instance")})(r),e.version>=2&&(r.disjointTimerQueryExt=r.getExtension("EXT_disjoint_timer_query_webgl2")),(e.version<2||!r.disjointTimerQueryExt)&&(r.disjointTimerQueryExt=r.getExtension("EXT_disjoint_timer_query")),vt(r)))n.includes("lose_context")||n.includes("debug")||r.getExtension(n)}}},wt=["default","low-power","high-performance"],yt=[0,"undefined"!=typeof document?document:0,"undefined"!=typeof window?window:0],xt=e=>{var t;return e=(t=e)>2?N(t):t,yt[e]||("undefined"!=typeof document?document.querySelector(e):null)},Et=e=>{var t=Ke(e)+1,r=Ir(t);return Qe(e,r,t),r},kt={Internals:{jsObjects:[],jsObjectInsert:(e,t)=>{kt.Internals.jsObjects[e>>>=0]=t},bufferOnUnmaps:[],futures:[],futureInsert:(e,t)=>{}},getJsObject:e=>{if(e)return kt.Internals.jsObjects[e>>>=0]},importJsAdapter:(e,t=0)=>{var r=xr(t);return kt.Internals.jsObjects[r]=e,r},importJsBindGroup:(e,t=0)=>{var r=ir(t);return kt.Internals.jsObjects[r]=e,r},importJsBindGroupLayout:(e,t=0)=>{var r=sr(t);return kt.Internals.jsObjects[r]=e,r},importJsBuffer:(e,t=0)=>{"pending"!=e.mapState||j(void 0);var r=Er(t,"mapped"==e.mapState?3:1);return kt.Internals.jsObjectInsert(r,e),"mapped"==e.mapState&&(kt.Internals.bufferOnUnmaps[r]=[]),r},importJsCommandBuffer:(e,t=0)=>{var r=ur(t);return kt.Internals.jsObjects[r]=e,r},importJsCommandEncoder:(e,t=0)=>{var r=lr(t);return kt.Internals.jsObjects[r]=e,r},importJsComputePassEncoder:(e,t=0)=>{var r=cr(t);return kt.Internals.jsObjects[r]=e,r},importJsComputePipeline:(e,t=0)=>{var r=dr(t);return kt.Internals.jsObjects[r]=e,r},importJsDevice:(e,t=0)=>{var r=Sr(t),n=kr(t,r);return kt.Internals.jsObjectInsert(r,e.queue),kt.Internals.jsObjectInsert(n,e),n},importJsPipelineLayout:(e,t=0)=>{var r=fr(t);return kt.Internals.jsObjects[r]=e,r},importJsQuerySet:(e,t=0)=>{var r=pr(t);return kt.Internals.jsObjects[r]=e,r},importJsQueue:(e,t=0)=>{var r=Sr(t);return kt.Internals.jsObjects[r]=e,r},importJsRenderBundle:(e,t=0)=>{var r=mr(t);return kt.Internals.jsObjects[r]=e,r},importJsRenderBundleEncoder:(e,t=0)=>{var r=hr(t);return kt.Internals.jsObjects[r]=e,r},importJsRenderPassEncoder:(e,t=0)=>{var r=gr(t);return kt.Internals.jsObjects[r]=e,r},importJsRenderPipeline:(e,t=0)=>{var r=_r(t);return kt.Internals.jsObjects[r]=e,r},importJsSampler:(e,t=0)=>{var r=vr(t);return kt.Internals.jsObjects[r]=e,r},importJsShaderModule:(e,t=0)=>{var r=Br(t);return kt.Internals.jsObjects[r]=e,r},importJsSurface:(e,t=0)=>{var r=br(t);return kt.Internals.jsObjects[r]=e,r},importJsTexture:(e,t=0)=>{var r=wr(t);return kt.Internals.jsObjects[r]=e,r},importJsTextureView:(e,t=0)=>{var r=yr(t);return kt.Internals.jsObjects[r]=e,r},errorCallback:(e,t,r,n)=>{var a=z(),o=Et(r);Pe(e)(t,o,n),W(a)},setStringView:(e,t,r)=>{y[e>>2]=t,y[e+4>>2]=r},makeStringFromStringView:e=>N(y[e>>2],y[e+4>>2]),makeStringFromOptionalStringView:e=>{var t=y[e>>2],r=y[e+4>>2];return t?N(t,r):0===r?"":void 0},makeColor:e=>({r:E[e>>3],g:E[e+8>>3],b:E[e+16>>3],a:E[e+24>>3]}),makeExtent3D:e=>({width:y[e>>2],height:y[e+4>>2],depthOrArrayLayers:y[e+8>>2]}),makeOrigin3D:e=>({x:y[e>>2],y:y[e+4>>2],z:y[e+8>>2]}),makeTexelCopyTextureInfo:e=>({texture:kt.getJsObject(y[e>>2]),mipLevel:y[e+4>>2],origin:kt.makeOrigin3D(e+8),aspect:kt.TextureAspect[y[e+20>>2]]}),makeTexelCopyBufferLayout:e=>{var t=y[e+8>>2],r=y[e+12>>2];return{offset:4294967296*y[e+4>>2]+y[e>>2],bytesPerRow:4294967295===t?void 0:t,rowsPerImage:4294967295===r?void 0:r}},makeTexelCopyBufferInfo:e=>{var t=kt.makeTexelCopyBufferLayout(e+0);return t.buffer=kt.getJsObject(y[e+16>>2]),t},makePassTimestampWrites:e=>{if(0!==e)return{querySet:kt.getJsObject(y[e+4>>2]),beginningOfPassWriteIndex:y[e+8>>2],endOfPassWriteIndex:y[e+12>>2]}},makePipelineConstants:(e,t)=>{if(e){for(var r={},n=0;n<e;++n){var a=t+24*n;r[kt.makeStringFromStringView(a+4)]=E[a+16>>3]}return r}},makePipelineLayout:e=>e?kt.getJsObject(e):"auto",makeComputeState:e=>{if(e)return{module:kt.getJsObject(y[e+4>>2]),constants:kt.makePipelineConstants(y[e+16>>2],y[e+20>>2]),entryPoint:kt.makeStringFromOptionalStringView(e+8)}},makeComputePipelineDesc:e=>({label:kt.makeStringFromOptionalStringView(e+4),layout:kt.makePipelineLayout(y[e+12>>2]),compute:kt.makeComputeState(e+16)}),makeRenderPipelineDesc:e=>{function t(e){if(e)return{operation:kt.BlendOperation[y[e>>2]],srcFactor:kt.BlendFactor[y[e+4>>2]],dstFactor:kt.BlendFactor[y[e+8>>2]]}}function r(e){if(e)return{alpha:t(e+12),color:t(e+0)}}function n(e){var t=y[e+4>>2];return 0===t?void 0:{format:kt.TextureFormat[t],blend:r(y[e+8>>2]),writeMask:y[e+16>>2]}}function a(e,t){for(var r=[],a=0;a<e;++a)r.push(n(t+24*a));return r}function o(e){return{compare:kt.CompareFunction[y[e>>2]],failOp:kt.StencilOperation[y[e+4>>2]],depthFailOp:kt.StencilOperation[y[e+8>>2]],passOp:kt.StencilOperation[y[e+12>>2]]}}function i(e){return{format:kt.VertexFormat[y[e+4>>2]],offset:4294967296*y[e+4+8>>2]+y[e+8>>2],shaderLocation:y[e+16>>2]}}function s(e,t){for(var r=[],n=0;n<e;++n)r.push(i(t+24*n));return r}function u(e){if(e){var t=y[e+4>>2],r=y[e+16>>2];return 0===t&&0===r?null:{arrayStride:4294967296*y[e+4+8>>2]+y[e+8>>2],stepMode:kt.VertexStepMode[t],attributes:s(r,y[e+20>>2])}}}function l(e,t){if(e){for(var r=[],n=0;n<e;++n)r.push(u(t+24*n));return r}}return{label:kt.makeStringFromOptionalStringView(e+4),layout:kt.makePipelineLayout(y[e+12>>2]),vertex:function(e){if(e)return{module:kt.getJsObject(y[e+4>>2]),constants:kt.makePipelineConstants(y[e+16>>2],y[e+20>>2]),buffers:l(y[e+24>>2],y[e+28>>2]),entryPoint:kt.makeStringFromOptionalStringView(e+8)}}(e+16),primitive:function(e){if(e)return{topology:kt.PrimitiveTopology[y[e+4>>2]],stripIndexFormat:kt.IndexFormat[y[e+8>>2]],frontFace:kt.FrontFace[y[e+12>>2]],cullMode:kt.CullMode[y[e+16>>2]],unclippedDepth:!!y[e+20>>2]}}(e+48),depthStencil:function(e){if(e)return{format:kt.TextureFormat[y[e+4>>2]],depthWriteEnabled:!!y[e+8>>2],depthCompare:kt.CompareFunction[y[e+12>>2]],stencilFront:o(e+16),stencilBack:o(e+32),stencilReadMask:y[e+48>>2],stencilWriteMask:y[e+52>>2],depthBias:w[e+56>>2],depthBiasSlopeScale:x[e+60>>2],depthBiasClamp:x[e+64>>2]}}(y[e+72>>2]),multisample:function(e){if(e)return{count:y[e+4>>2],mask:y[e+8>>2],alphaToCoverageEnabled:!!y[e+12>>2]}}(e+76),fragment:function(e){if(e)return{module:kt.getJsObject(y[e+4>>2]),constants:kt.makePipelineConstants(y[e+16>>2],y[e+20>>2]),targets:a(y[e+24>>2],y[e+28>>2]),entryPoint:kt.makeStringFromOptionalStringView(e+8)}}(y[e+92>>2])}},fillLimitStruct:(e,t)=>{function r(r,n){w[t+n>>2]=e[r]}function n(r,n){k[t+n>>3]=BigInt(e[r])}r("maxTextureDimension1D",4),r("maxTextureDimension2D",8),r("maxTextureDimension3D",12),r("maxTextureArrayLayers",16),r("maxBindGroups",20),r("maxBindGroupsPlusVertexBuffers",24),r("maxBindingsPerBindGroup",28),r("maxDynamicUniformBuffersPerPipelineLayout",32),r("maxDynamicStorageBuffersPerPipelineLayout",36),r("maxSampledTexturesPerShaderStage",40),r("maxSamplersPerShaderStage",44),r("maxStorageBuffersPerShaderStage",48),r("maxStorageTexturesPerShaderStage",52),r("maxUniformBuffersPerShaderStage",56),r("minUniformBufferOffsetAlignment",80),r("minStorageBufferOffsetAlignment",84),n("maxUniformBufferBindingSize",64),n("maxStorageBufferBindingSize",72),r("maxVertexBuffers",88),n("maxBufferSize",96),r("maxVertexAttributes",104),r("maxVertexBufferArrayStride",108),r("maxInterStageShaderVariables",112),r("maxColorAttachments",116),r("maxColorAttachmentBytesPerSample",120),r("maxComputeWorkgroupStorageSize",124),r("maxComputeInvocationsPerWorkgroup",128),r("maxComputeWorkgroupSizeX",132),r("maxComputeWorkgroupSizeY",136),r("maxComputeWorkgroupSizeZ",140),r("maxComputeWorkgroupsPerDimension",144),void 0!==e.maxImmediateSize&&r("maxImmediateSize",148)},fillAdapterInfoStruct:(e,t)=>{w[t+52>>2]=e.subgroupMinSize,w[t+56>>2]=e.subgroupMaxSize;var r,n,a,o=(n=Ke(r=e.vendor+e.architecture+e.device+e.description)+1,(a=ar(n))&&Qe(r,a,n),a),i=Ke(e.vendor);kt.setStringView(t+4,o,i),o+=i;var s=Ke(e.architecture);kt.setStringView(t+12,o,s),o+=s;var u=Ke(e.device);kt.setStringView(t+20,o,u),o+=u;var l=Ke(e.description);kt.setStringView(t+28,o,l),o+=l,w[t+36>>2]=2,w[t+40>>2]=e.isFallbackAdapter?3:4,w[t+44>>2]=0,w[t+48>>2]=0},AddressMode:[,"clamp-to-edge","repeat","mirror-repeat"],BlendFactor:[,"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"],BlendOperation:[,"add","subtract","reverse-subtract","min","max"],BufferBindingType:["binding-not-used",,"uniform","storage","read-only-storage"],BufferMapState:[,"unmapped","pending","mapped"],CompareFunction:[,"never","less","equal","less-equal","greater","not-equal","greater-equal","always"],CompilationInfoRequestStatus:[,"success","callback-cancelled"],CompositeAlphaMode:[,"opaque","premultiplied","unpremultiplied","inherit"],CullMode:[,"none","front","back"],ErrorFilter:[,"validation","out-of-memory","internal"],FeatureLevel:[,"compatibility","core"],FeatureName:{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"},FilterMode:[,"nearest","linear"],FrontFace:[,"ccw","cw"],IndexFormat:[,"uint16","uint32"],InstanceFeatureName:[,"timed-wait-any","shader-source-spirv","multiple-devices-per-adapter"],LoadOp:[,"load","clear"],MipmapFilterMode:[,"nearest","linear"],OptionalBool:["false","true"],PowerPreference:[,"low-power","high-performance"],PredefinedColorSpace:[,"srgb","display-p3"],PrimitiveTopology:[,"point-list","line-list","line-strip","triangle-list","triangle-strip"],QueryType:[,"occlusion","timestamp"],SamplerBindingType:["binding-not-used",,"filtering","non-filtering","comparison"],Status:[,"success","error"],StencilOperation:[,"keep","zero","replace","invert","increment-clamp","decrement-clamp","increment-wrap","decrement-wrap"],StorageTextureAccess:["binding-not-used",,"write-only","read-only","read-write"],StoreOp:[,"store","discard"],SurfaceGetCurrentTextureStatus:[,"success-optimal","success-suboptimal","timeout","outdated","lost","error"],TextureAspect:[,"all","stencil-only","depth-only"],TextureDimension:[,"1d","2d","3d"],TextureFormat:[,"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"],TextureSampleType:["binding-not-used",,"float","unfilterable-float","depth","sint","uint"],TextureViewDimension:[,"1d","2d","2d-array","cube","cube-array","3d"],ToneMappingMode:[,"standard","extended"],VertexFormat:[,"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"],VertexStepMode:[,"vertex","instance"],WGSLLanguageFeatureName:[,"readonly_and_readwrite_storage_textures","packed_4x8_integer_dot_product","unrestricted_pointer_parameters","pointer_composite_access"]},St={undefined:1,unknown:1,destroyed:2},Bt=e=>e<-9007199254740992||e>9007199254740992?NaN:Number(e),Tt={isAbs:e=>"/"===e.charAt(0),splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var r=0,n=e.length-1;n>=0;n--){var a=e[n];"."===a?e.splice(n,1):".."===a?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r;r--)e.unshift("..");return e},normalize:e=>{var t=Tt.isAbs(e),r="/"===e.slice(-1);return(e=Tt.normalizeArray(e.split("/").filter(e=>!!e),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=Tt.splitPath(e),r=t[0],n=t[1];return r||n?(n&&(n=n.slice(0,-1)),r+n):"."},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>Tt.normalize(e.join("/")),join2:(e,t)=>Tt.normalize(e+"/"+t)},Ct=e=>{(Ct=(()=>{if(a){var e=o("crypto");return t=>e.randomFillSync(t)}return e=>crypto.getRandomValues(e)})())(e)},Pt={resolve:(...e)=>{for(var t="",r=!1,n=e.length-1;n>=-1&&!r;n--){var a=n>=0?e[n]:Gt.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");if(!a)return"";t=a+"/"+t,r=Tt.isAbs(a)}return(r?"/":"")+(t=Tt.normalizeArray(t.split("/").filter(e=>!!e),!r).join("/"))||"."},relative:(e,t)=>{function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=Pt.resolve(e).slice(1),t=Pt.resolve(t).slice(1);for(var n=r(e.split("/")),a=r(t.split("/")),o=Math.min(n.length,a.length),i=o,s=0;s<o;s++)if(n[s]!==a[s]){i=s;break}var u=[];for(s=i;s<n.length;s++)u.push("..");return(u=u.concat(a.slice(i))).join("/")}},At=(e,t=0,r,n)=>{var a=G(e,t,r,n);return U.decode(e.buffer?e.subarray(t,a):new Uint8Array(e.slice(t,a)))},Ft=[],Ot=(e,t,r)=>{var n=Ke(e)+1,a=new Array(n),o=Xe(e,a,0,a.length);return a.length=o,a},jt={ttys:[],init(){},shutdown(){},register(e,t){jt.ttys[e]={input:[],output:[],ops:t},Gt.registerDevice(e,jt.stream_ops)},stream_ops:{open(e){var t=jt.ttys[e.node.rdev];if(!t)throw new Gt.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,r,n,a){if(!e.tty||!e.tty.ops.get_char)throw new Gt.ErrnoError(60);for(var o=0,i=0;i<n;i++){var s;try{s=e.tty.ops.get_char(e.tty)}catch(e){throw new Gt.ErrnoError(29)}if(void 0===s&&0===o)throw new Gt.ErrnoError(6);if(null==s)break;o++,t[r+i]=s}return o&&(e.node.atime=Date.now()),o},write(e,t,r,n,a){if(!e.tty||!e.tty.ops.put_char)throw new Gt.ErrnoError(60);try{for(var o=0;o<n;o++)e.tty.ops.put_char(e.tty,t[r+o])}catch(e){throw new Gt.ErrnoError(29)}return n&&(e.node.mtime=e.node.ctime=Date.now()),o}},default_tty_ops:{get_char:e=>(()=>{if(!Ft.length){var e=null;if(a){var t=Buffer.alloc(256),r=0,n=process.stdin.fd;try{r=d.readSync(n,t,0,256)}catch(e){if(!e.toString().includes("EOF"))throw e;r=0}r>0&&(e=t.slice(0,r).toString("utf-8"))}else globalThis.window?.prompt&&null!==(e=window.prompt("Input: "))&&(e+="\n");if(!e)return null;Ft=Ot(e)}return Ft.shift()})(),put_char(e,t){null===t||10===t?(T(At(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output?.length>0&&(T(At(e.output)),e.output=[])},ioctl_tcgets:e=>({c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}),ioctl_tcsets:(e,t,r)=>0,ioctl_tiocgwinsz:e=>[24,80]},default_tty1_ops:{put_char(e,t){null===t||10===t?(C(At(e.output)),e.output=[]):0!=t&&e.output.push(t)},fsync(e){e.output?.length>0&&(C(At(e.output)),e.output=[])}}},$t=e=>{j()},It={ops_table:null,mount:e=>It.createNode(null,"/",16895,0),createNode(e,t,r,n){var a;if(Gt.isBlkdev(r)||Gt.isFIFO(r))throw new Gt.ErrnoError(63);(a=It).ops_table||(a.ops_table={dir:{node:{getattr:It.node_ops.getattr,setattr:It.node_ops.setattr,lookup:It.node_ops.lookup,mknod:It.node_ops.mknod,rename:It.node_ops.rename,unlink:It.node_ops.unlink,rmdir:It.node_ops.rmdir,readdir:It.node_ops.readdir,symlink:It.node_ops.symlink},stream:{llseek:It.stream_ops.llseek}},file:{node:{getattr:It.node_ops.getattr,setattr:It.node_ops.setattr},stream:{llseek:It.stream_ops.llseek,read:It.stream_ops.read,write:It.stream_ops.write,mmap:It.stream_ops.mmap,msync:It.stream_ops.msync}},link:{node:{getattr:It.node_ops.getattr,setattr:It.node_ops.setattr,readlink:It.node_ops.readlink},stream:{}},chrdev:{node:{getattr:It.node_ops.getattr,setattr:It.node_ops.setattr},stream:Gt.chrdev_stream_ops}});var o=Gt.createNode(e,t,r,n);return Gt.isDir(o.mode)?(o.node_ops=It.ops_table.dir.node,o.stream_ops=It.ops_table.dir.stream,o.contents={}):Gt.isFile(o.mode)?(o.node_ops=It.ops_table.file.node,o.stream_ops=It.ops_table.file.stream,o.usedBytes=0,o.contents=null):Gt.isLink(o.mode)?(o.node_ops=It.ops_table.link.node,o.stream_ops=It.ops_table.link.stream):Gt.isChrdev(o.mode)&&(o.node_ops=It.ops_table.chrdev.node,o.stream_ops=It.ops_table.chrdev.stream),o.atime=o.mtime=o.ctime=Date.now(),e&&(e.contents[t]=o,e.atime=e.mtime=e.ctime=o.atime),o},getFileDataAsTypedArray:e=>e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0),expandFileStorage(e,t){var r=e.contents?e.contents.length:0;if(!(r>=t)){t=Math.max(t,r*(r<1048576?2:1.125)>>>0),0!=r&&(t=Math.max(t,256));var n=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(n.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(0==t)e.contents=null,e.usedBytes=0;else{var r=e.contents;e.contents=new Uint8Array(t),r&&e.contents.set(r.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=Gt.isChrdev(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=Gt.isDir(e.mode)?4096:Gt.isFile(e.mode)?e.usedBytes:Gt.isLink(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},setattr(e,t){for(const r of["mode","atime","mtime","ctime"])null!=t[r]&&(e[r]=t[r]);void 0!==t.size&&It.resizeFileStorage(e,t.size)},lookup(e,t){throw It.doesNotExistError||(It.doesNotExistError=new Gt.ErrnoError(44),It.doesNotExistError.stack="<generic error, no stack>"),It.doesNotExistError},mknod:(e,t,r,n)=>It.createNode(e,t,r,n),rename(e,t,r){var n;try{n=Gt.lookupNode(t,r)}catch(e){}if(n){if(Gt.isDir(e.mode))for(var a in n.contents)throw new Gt.ErrnoError(55);Gt.hashRemoveNode(n)}delete e.parent.contents[e.name],t.contents[r]=e,e.name=r,t.ctime=t.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,t){delete e.contents[t],e.ctime=e.mtime=Date.now()},rmdir(e,t){var r=Gt.lookupNode(e,t);for(var n in r.contents)throw new Gt.ErrnoError(55);delete e.contents[t],e.ctime=e.mtime=Date.now()},readdir:e=>[".","..",...Object.keys(e.contents)],symlink(e,t,r){var n=It.createNode(e,t,41471,0);return n.link=r,n},readlink(e){if(!Gt.isLink(e.mode))throw new Gt.ErrnoError(28);return e.link}},stream_ops:{read(e,t,r,n,a){var o=e.node.contents;if(a>=e.node.usedBytes)return 0;var i=Math.min(e.node.usedBytes-a,n);if(i>8&&o.subarray)t.set(o.subarray(a,a+i),r);else for(var s=0;s<i;s++)t[r+s]=o[a+s];return i},write(e,t,r,n,a,o){if(t.buffer===g.buffer&&(o=!1),!n)return 0;var i=e.node;if(i.mtime=i.ctime=Date.now(),t.subarray&&(!i.contents||i.contents.subarray)){if(o)return i.contents=t.subarray(r,r+n),i.usedBytes=n,n;if(0===i.usedBytes&&0===a)return i.contents=t.slice(r,r+n),i.usedBytes=n,n;if(a+n<=i.usedBytes)return i.contents.set(t.subarray(r,r+n),a),n}if(It.expandFileStorage(i,a+n),i.contents.subarray&&t.subarray)i.contents.set(t.subarray(r,r+n),a);else for(var s=0;s<n;s++)i.contents[a+s]=t[r+s];return i.usedBytes=Math.max(i.usedBytes,a+n),n},llseek(e,t,r){var n=t;if(1===r?n+=e.position:2===r&&Gt.isFile(e.node.mode)&&(n+=e.node.usedBytes),n<0)throw new Gt.ErrnoError(28);return n},mmap(e,t,r,n,a){if(!Gt.isFile(e.node.mode))throw new Gt.ErrnoError(43);var o,i,s=e.node.contents;if(2&a||!s||s.buffer!==g.buffer){if(i=!0,!(o=$t()))throw new Gt.ErrnoError(48);s&&((r>0||r+t<s.length)&&(s=s.subarray?s.subarray(r,r+t):Array.prototype.slice.call(s,r,r+t)),g.set(s,o))}else i=!1,o=s.byteOffset;return{ptr:o,allocated:i}},msync:(e,t,r,n,a)=>(It.stream_ops.write(e,t,0,n,r,!1),0)}},Lt=(e,t)=>{var r=0;return e&&(r|=365),t&&(r|=146),r},Dt=(...e)=>Gt.createDataFile(...e),Mt=0,Vt=null,Rt=e=>{if(Mt--,t.monitorRunDependencies?.(Mt),0==Mt&&Vt){var r=Vt;Vt=null,r()}},Wt=e=>{Mt++,t.monitorRunDependencies?.(Mt)},zt=[],Ut=async(e,t,r,n,a,o,s,u)=>{var l=t?Pt.resolve(Tt.join2(e,t)):e;Wt();try{var c=r;"string"==typeof r&&(c=await(async e=>{var t=await i(e);return new Uint8Array(t)})(r)),c=await(async(e,t)=>{for(var r of("undefined"!=typeof Browser&&Browser.init(),zt))if(r.canHandle(t))return r.handle(e,t);return e})(c,l),u?.(),o||Dt(e,t,c,n,a,s)}finally{Rt()}},Gt={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,readFiles:{},ErrnoError:class{constructor(e){be(this,"name","ErrnoError"),this.errno=e}},FSStream:class{get object(){return this.node}set object(e){this.node=e}get isRead(){return 1!=(2097155&this.flags)}get isWrite(){return!!(2097155&this.flags)}get isAppend(){return 1024&this.flags}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}constructor(){be(this,"shared",{})}},FSNode:class{get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return Gt.isDir(this.mode)}get isDevice(){return Gt.isChrdev(this.mode)}constructor(e,t,r,n){be(this,"node_ops",{}),be(this,"stream_ops",{}),be(this,"readMode",365),be(this,"writeMode",146),be(this,"mounted",null),e||(e=this),this.parent=e,this.mount=e.mount,this.id=Gt.nextInode++,this.name=t,this.mode=r,this.rdev=n,this.atime=this.mtime=this.ctime=Date.now()}},lookupPath(e,t={}){var r;if(!e)throw new Gt.ErrnoError(44);(r=t).follow_mount??(r.follow_mount=!0),Tt.isAbs(e)||(e=Gt.cwd()+"/"+e);e:for(var n=0;n<40;n++){for(var a=e.split("/").filter(e=>!!e),o=Gt.root,i="/",s=0;s<a.length;s++){var u=s===a.length-1;if(u&&t.parent)break;if("."!==a[s])if(".."!==a[s]){i=Tt.join2(i,a[s]);try{o=Gt.lookupNode(o,a[s])}catch(e){if(44===e?.errno&&u&&t.noent_okay)return{path:i};throw e}if(!Gt.isMountpoint(o)||u&&!t.follow_mount||(o=o.mounted.root),Gt.isLink(o.mode)&&(!u||t.follow)){if(!o.node_ops.readlink)throw new Gt.ErrnoError(52);var l=o.node_ops.readlink(o);Tt.isAbs(l)||(l=Tt.dirname(i)+"/"+l),e=l+"/"+a.slice(s+1).join("/");continue e}}else{if(i=Tt.dirname(i),Gt.isRoot(o)){e=i+"/"+a.slice(s+1).join("/"),n--;continue e}o=o.parent}}return{path:i,node:o}}throw new Gt.ErrnoError(32)},getPath(e){for(var t;;){if(Gt.isRoot(e)){var r=e.mount.mountpoint;return t?"/"!==r[r.length-1]?`${r}/${t}`:r+t:r}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var r=0,n=0;n<t.length;n++)r=(r<<5)-r+t.charCodeAt(n)|0;return(e+r>>>0)%Gt.nameTable.length},hashAddNode(e){var t=Gt.hashName(e.parent.id,e.name);e.name_next=Gt.nameTable[t],Gt.nameTable[t]=e},hashRemoveNode(e){var t=Gt.hashName(e.parent.id,e.name);if(Gt.nameTable[t]===e)Gt.nameTable[t]=e.name_next;else for(var r=Gt.nameTable[t];r;){if(r.name_next===e){r.name_next=e.name_next;break}r=r.name_next}},lookupNode(e,t){var r=Gt.mayLookup(e);if(r)throw new Gt.ErrnoError(r);for(var n=Gt.hashName(e.id,t),a=Gt.nameTable[n];a;a=a.name_next)if(a.parent.id===e.id&&a.name===t)return a;return Gt.lookup(e,t)},createNode(e,t,r,n){var a=new Gt.FSNode(e,t,r,n);return Gt.hashAddNode(a),a},destroyNode(e){Gt.hashRemoveNode(e)},isRoot:e=>e===e.parent,isMountpoint:e=>!!e.mounted,isFile:e=>32768==(61440&e),isDir:e=>16384==(61440&e),isLink:e=>40960==(61440&e),isChrdev:e=>8192==(61440&e),isBlkdev:e=>24576==(61440&e),isFIFO:e=>4096==(61440&e),isSocket:e=>!(49152&~e),flagsToPermissionString(e){var t=["r","w","rw"][3&e];return 512&e&&(t+="w"),t},nodePermissions:(e,t)=>Gt.ignorePermissions||(!t.includes("r")||292&e.mode)&&(!t.includes("w")||146&e.mode)&&(!t.includes("x")||73&e.mode)?0:2,mayLookup:e=>Gt.isDir(e.mode)?Gt.nodePermissions(e,"x")||(e.node_ops.lookup?0:2):54,mayCreate(e,t){if(!Gt.isDir(e.mode))return 54;try{return Gt.lookupNode(e,t),20}catch(e){}return Gt.nodePermissions(e,"wx")},mayDelete(e,t,r){var n;try{n=Gt.lookupNode(e,t)}catch(e){return e.errno}var a=Gt.nodePermissions(e,"wx");if(a)return a;if(r){if(!Gt.isDir(n.mode))return 54;if(Gt.isRoot(n)||Gt.getPath(n)===Gt.cwd())return 10}else if(Gt.isDir(n.mode))return 31;return 0},mayOpen:(e,t)=>e?Gt.isLink(e.mode)?32:Gt.isDir(e.mode)&&("r"!==Gt.flagsToPermissionString(t)||576&t)?31:Gt.nodePermissions(e,Gt.flagsToPermissionString(t)):44,checkOpExists(e,t){if(!e)throw new Gt.ErrnoError(t);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Gt.MAX_OPEN_FDS;e++)if(!Gt.streams[e])return e;throw new Gt.ErrnoError(33)},getStreamChecked(e){var t=Gt.getStream(e);if(!t)throw new Gt.ErrnoError(8);return t},getStream:e=>Gt.streams[e],createStream:(e,t=-1)=>(e=Object.assign(new Gt.FSStream,e),-1==t&&(t=Gt.nextfd()),e.fd=t,Gt.streams[t]=e,e),closeStream(e){Gt.streams[e]=null},dupStream(e,t=-1){var r=Gt.createStream(e,t);return r.stream_ops?.dup?.(r),r},doSetAttr(e,t,r){var n=e?.stream_ops.setattr,a=n?e:t;n??(n=t.node_ops.setattr),Gt.checkOpExists(n,63),n(a,r)},chrdev_stream_ops:{open(e){var t=Gt.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new Gt.ErrnoError(70)}},major:e=>e>>8,minor:e=>255&e,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Gt.devices[e]={stream_ops:t}},getDevice:e=>Gt.devices[e],getMounts(e){for(var t=[],r=[e];r.length;){var n=r.pop();t.push(n),r.push(...n.mounts)}return t},syncfs(e,t){"function"==typeof e&&(t=e,e=!1),Gt.syncFSRequests++,Gt.syncFSRequests>1&&C(`warning: ${Gt.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var r=Gt.getMounts(Gt.root.mount),n=0;function a(e){return Gt.syncFSRequests--,t(e)}function o(e){if(e)return o.errored?void 0:(o.errored=!0,a(e));++n>=r.length&&a(null)}for(var i of r)i.type.syncfs?i.type.syncfs(i,e,o):o(null)},mount(e,t,r){var n,a="/"===r,o=!r;if(a&&Gt.root)throw new Gt.ErrnoError(10);if(!a&&!o){var i=Gt.lookupPath(r,{follow_mount:!1});if(r=i.path,Gt.isMountpoint(n=i.node))throw new Gt.ErrnoError(10);if(!Gt.isDir(n.mode))throw new Gt.ErrnoError(54)}var s={type:e,opts:t,mountpoint:r,mounts:[]},u=e.mount(s);return u.mount=s,s.root=u,a?Gt.root=u:n&&(n.mounted=s,n.mount&&n.mount.mounts.push(s)),u},unmount(e){var t=Gt.lookupPath(e,{follow_mount:!1});if(!Gt.isMountpoint(t.node))throw new Gt.ErrnoError(28);var r=t.node,n=r.mounted,a=Gt.getMounts(n);for(var[o,i]of Object.entries(Gt.nameTable))for(;i;){var s=i.name_next;a.includes(i.mount)&&Gt.destroyNode(i),i=s}r.mounted=null;var u=r.mount.mounts.indexOf(n);r.mount.mounts.splice(u,1)},lookup:(e,t)=>e.node_ops.lookup(e,t),mknod(e,t,r){var n=Gt.lookupPath(e,{parent:!0}).node,a=Tt.basename(e);if(!a)throw new Gt.ErrnoError(28);if("."===a||".."===a)throw new Gt.ErrnoError(20);var o=Gt.mayCreate(n,a);if(o)throw new Gt.ErrnoError(o);if(!n.node_ops.mknod)throw new Gt.ErrnoError(63);return n.node_ops.mknod(n,a,t,r)},statfs:e=>Gt.statfsNode(Gt.lookupPath(e,{follow:!0}).node),statfsStream:e=>Gt.statfsNode(e.node),statfsNode(e){var t={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:Gt.nextInode,ffree:Gt.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(t,e.node_ops.statfs(e.mount.opts.root)),t},create:(e,t=438)=>(t&=4095,Gt.mknod(e,t|=32768,0)),mkdir:(e,t=511)=>(t&=1023,Gt.mknod(e,t|=16384,0)),mkdirTree(e,t){var r=e.split("/"),n="";for(var a of r)if(a){(n||Tt.isAbs(e))&&(n+="/"),n+=a;try{Gt.mkdir(n,t)}catch(e){if(20!=e.errno)throw e}}},mkdev:(e,t,r)=>(void 0===r&&(r=t,t=438),Gt.mknod(e,t|=8192,r)),symlink(e,t){if(!Pt.resolve(e))throw new Gt.ErrnoError(44);var r=Gt.lookupPath(t,{parent:!0}).node;if(!r)throw new Gt.ErrnoError(44);var n=Tt.basename(t),a=Gt.mayCreate(r,n);if(a)throw new Gt.ErrnoError(a);if(!r.node_ops.symlink)throw new Gt.ErrnoError(63);return r.node_ops.symlink(r,n,e)},rename(e,t){var r,n,a=Tt.dirname(e),o=Tt.dirname(t),i=Tt.basename(e),s=Tt.basename(t);if(r=Gt.lookupPath(e,{parent:!0}).node,n=Gt.lookupPath(t,{parent:!0}).node,!r||!n)throw new Gt.ErrnoError(44);if(r.mount!==n.mount)throw new Gt.ErrnoError(75);var u,l=Gt.lookupNode(r,i),c=Pt.relative(e,o);if("."!==c.charAt(0))throw new Gt.ErrnoError(28);if("."!==(c=Pt.relative(t,a)).charAt(0))throw new Gt.ErrnoError(55);try{u=Gt.lookupNode(n,s)}catch(e){}if(l!==u){var d=Gt.isDir(l.mode),f=Gt.mayDelete(r,i,d);if(f)throw new Gt.ErrnoError(f);if(f=u?Gt.mayDelete(n,s,d):Gt.mayCreate(n,s))throw new Gt.ErrnoError(f);if(!r.node_ops.rename)throw new Gt.ErrnoError(63);if(Gt.isMountpoint(l)||u&&Gt.isMountpoint(u))throw new Gt.ErrnoError(10);if(n!==r&&(f=Gt.nodePermissions(r,"w")))throw new Gt.ErrnoError(f);Gt.hashRemoveNode(l);try{r.node_ops.rename(l,n,s),l.parent=n}catch(e){throw e}finally{Gt.hashAddNode(l)}}},rmdir(e){var t=Gt.lookupPath(e,{parent:!0}).node,r=Tt.basename(e),n=Gt.lookupNode(t,r),a=Gt.mayDelete(t,r,!0);if(a)throw new Gt.ErrnoError(a);if(!t.node_ops.rmdir)throw new Gt.ErrnoError(63);if(Gt.isMountpoint(n))throw new Gt.ErrnoError(10);t.node_ops.rmdir(t,r),Gt.destroyNode(n)},readdir(e){var t=Gt.lookupPath(e,{follow:!0}).node;return Gt.checkOpExists(t.node_ops.readdir,54)(t)},unlink(e){var t=Gt.lookupPath(e,{parent:!0}).node;if(!t)throw new Gt.ErrnoError(44);var r=Tt.basename(e),n=Gt.lookupNode(t,r),a=Gt.mayDelete(t,r,!1);if(a)throw new Gt.ErrnoError(a);if(!t.node_ops.unlink)throw new Gt.ErrnoError(63);if(Gt.isMountpoint(n))throw new Gt.ErrnoError(10);t.node_ops.unlink(t,r),Gt.destroyNode(n)},readlink(e){var t=Gt.lookupPath(e).node;if(!t)throw new Gt.ErrnoError(44);if(!t.node_ops.readlink)throw new Gt.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,t){var r=Gt.lookupPath(e,{follow:!t}).node;return Gt.checkOpExists(r.node_ops.getattr,63)(r)},fstat(e){var t=Gt.getStreamChecked(e),r=t.node,n=t.stream_ops.getattr,a=n?t:r;return n??(n=r.node_ops.getattr),Gt.checkOpExists(n,63),n(a)},lstat:e=>Gt.stat(e,!0),doChmod(e,t,r,n){Gt.doSetAttr(e,t,{mode:4095&r|-4096&t.mode,ctime:Date.now(),dontFollow:n})},chmod(e,t,r){var n;n="string"==typeof e?Gt.lookupPath(e,{follow:!r}).node:e,Gt.doChmod(null,n,t,r)},lchmod(e,t){Gt.chmod(e,t,!0)},fchmod(e,t){var r=Gt.getStreamChecked(e);Gt.doChmod(r,r.node,t,!1)},doChown(e,t,r){Gt.doSetAttr(e,t,{timestamp:Date.now(),dontFollow:r})},chown(e,t,r,n){var a;a="string"==typeof e?Gt.lookupPath(e,{follow:!n}).node:e,Gt.doChown(null,a,n)},lchown(e,t,r){Gt.chown(e,t,r,!0)},fchown(e,t,r){var n=Gt.getStreamChecked(e);Gt.doChown(n,n.node,!1)},doTruncate(e,t,r){if(Gt.isDir(t.mode))throw new Gt.ErrnoError(31);if(!Gt.isFile(t.mode))throw new Gt.ErrnoError(28);var n=Gt.nodePermissions(t,"w");if(n)throw new Gt.ErrnoError(n);Gt.doSetAttr(e,t,{size:r,timestamp:Date.now()})},truncate(e,t){if(t<0)throw new Gt.ErrnoError(28);var r;r="string"==typeof e?Gt.lookupPath(e,{follow:!0}).node:e,Gt.doTruncate(null,r,t)},ftruncate(e,t){var r=Gt.getStreamChecked(e);if(t<0||!(2097155&r.flags))throw new Gt.ErrnoError(28);Gt.doTruncate(r,r.node,t)},utime(e,t,r){var n=Gt.lookupPath(e,{follow:!0}).node;Gt.checkOpExists(n.node_ops.setattr,63)(n,{atime:t,mtime:r})},open(e,r,n=438){if(""===e)throw new Gt.ErrnoError(44);var a,o;if(n=64&(r="string"==typeof r?(e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(void 0===t)throw new Error(`Unknown file open mode: ${e}`);return t})(r):r)?4095&n|32768:0,"object"==typeof e)a=e;else{o=e.endsWith("/");var i=Gt.lookupPath(e,{follow:!(131072&r),noent_okay:!0});a=i.node,e=i.path}var s=!1;if(64&r)if(a){if(128&r)throw new Gt.ErrnoError(20)}else{if(o)throw new Gt.ErrnoError(31);a=Gt.mknod(e,511|n,0),s=!0}if(!a)throw new Gt.ErrnoError(44);if(Gt.isChrdev(a.mode)&&(r&=-513),65536&r&&!Gt.isDir(a.mode))throw new Gt.ErrnoError(54);if(!s){var u=Gt.mayOpen(a,r);if(u)throw new Gt.ErrnoError(u)}512&r&&!s&&Gt.truncate(a,0),r&=-131713;var l=Gt.createStream({node:a,path:Gt.getPath(a),flags:r,seekable:!0,position:0,stream_ops:a.stream_ops,ungotten:[],error:!1});return l.stream_ops.open&&l.stream_ops.open(l),s&&Gt.chmod(a,511&n),!t.logReadFiles||1&r||e in Gt.readFiles||(Gt.readFiles[e]=1),l},close(e){if(Gt.isClosed(e))throw new Gt.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Gt.closeStream(e.fd)}e.fd=null},isClosed:e=>null===e.fd,llseek(e,t,r){if(Gt.isClosed(e))throw new Gt.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Gt.ErrnoError(70);if(0!=r&&1!=r&&2!=r)throw new Gt.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,r),e.ungotten=[],e.position},read(e,t,r,n,a){if(n<0||a<0)throw new Gt.ErrnoError(28);if(Gt.isClosed(e))throw new Gt.ErrnoError(8);if(1==(2097155&e.flags))throw new Gt.ErrnoError(8);if(Gt.isDir(e.node.mode))throw new Gt.ErrnoError(31);if(!e.stream_ops.read)throw new Gt.ErrnoError(28);var o=void 0!==a;if(o){if(!e.seekable)throw new Gt.ErrnoError(70)}else a=e.position;var i=e.stream_ops.read(e,t,r,n,a);return o||(e.position+=i),i},write(e,t,r,n,a,o){if(n<0||a<0)throw new Gt.ErrnoError(28);if(Gt.isClosed(e))throw new Gt.ErrnoError(8);if(!(2097155&e.flags))throw new Gt.ErrnoError(8);if(Gt.isDir(e.node.mode))throw new Gt.ErrnoError(31);if(!e.stream_ops.write)throw new Gt.ErrnoError(28);e.seekable&&1024&e.flags&&Gt.llseek(e,0,2);var i=void 0!==a;if(i){if(!e.seekable)throw new Gt.ErrnoError(70)}else a=e.position;var s=e.stream_ops.write(e,t,r,n,a,o);return i||(e.position+=s),s},mmap(e,t,r,n,a){if(2&n&&!(2&a)&&2!=(2097155&e.flags))throw new Gt.ErrnoError(2);if(1==(2097155&e.flags))throw new Gt.ErrnoError(2);if(!e.stream_ops.mmap)throw new Gt.ErrnoError(43);if(!t)throw new Gt.ErrnoError(28);return e.stream_ops.mmap(e,t,r,n,a)},msync:(e,t,r,n,a)=>e.stream_ops.msync?e.stream_ops.msync(e,t,r,n,a):0,ioctl(e,t,r){if(!e.stream_ops.ioctl)throw new Gt.ErrnoError(59);return e.stream_ops.ioctl(e,t,r)},readFile(e,t={}){t.flags=t.flags||0,t.encoding=t.encoding||"binary","utf8"!==t.encoding&&"binary"!==t.encoding&&j(`Invalid encoding type "${t.encoding}"`);var r=Gt.open(e,t.flags),n=Gt.stat(e).size,a=new Uint8Array(n);return Gt.read(r,a,0,n,0),"utf8"===t.encoding&&(a=At(a)),Gt.close(r),a},writeFile(e,t,r={}){r.flags=r.flags||577;var n=Gt.open(e,r.flags,r.mode);"string"==typeof t&&(t=new Uint8Array(Ot(t))),ArrayBuffer.isView(t)?Gt.write(n,t,0,t.byteLength,void 0,r.canOwn):j("Unsupported data type"),Gt.close(n)},cwd:()=>Gt.currentPath,chdir(e){var t=Gt.lookupPath(e,{follow:!0});if(null===t.node)throw new Gt.ErrnoError(44);if(!Gt.isDir(t.node.mode))throw new Gt.ErrnoError(54);var r=Gt.nodePermissions(t.node,"x");if(r)throw new Gt.ErrnoError(r);Gt.currentPath=t.path},createDefaultDirectories(){Gt.mkdir("/tmp"),Gt.mkdir("/home"),Gt.mkdir("/home/web_user")},createDefaultDevices(){Gt.mkdir("/dev"),Gt.registerDevice(Gt.makedev(1,3),{read:()=>0,write:(e,t,r,n,a)=>n,llseek:()=>0}),Gt.mkdev("/dev/null",Gt.makedev(1,3)),jt.register(Gt.makedev(5,0),jt.default_tty_ops),jt.register(Gt.makedev(6,0),jt.default_tty1_ops),Gt.mkdev("/dev/tty",Gt.makedev(5,0)),Gt.mkdev("/dev/tty1",Gt.makedev(6,0));var e=new Uint8Array(1024),t=0,r=()=>(0===t&&(Ct(e),t=e.byteLength),e[--t]);Gt.createDevice("/dev","random",r),Gt.createDevice("/dev","urandom",r),Gt.mkdir("/dev/shm"),Gt.mkdir("/dev/shm/tmp")},createSpecialDirectories(){Gt.mkdir("/proc");var e=Gt.mkdir("/proc/self");Gt.mkdir("/proc/self/fd"),Gt.mount({mount(){var t=Gt.createNode(e,"fd",16895,73);return t.stream_ops={llseek:It.stream_ops.llseek},t.node_ops={lookup(e,t){var r=+t,n=Gt.getStreamChecked(r),a={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>n.path},id:r+1};return a.parent=a,a},readdir:()=>Array.from(Gt.streams.entries()).filter(([e,t])=>t).map(([e,t])=>e.toString())},t}},{},"/proc/self/fd")},createStandardStreams(e,t,r){e?Gt.createDevice("/dev","stdin",e):Gt.symlink("/dev/tty","/dev/stdin"),t?Gt.createDevice("/dev","stdout",null,t):Gt.symlink("/dev/tty","/dev/stdout"),r?Gt.createDevice("/dev","stderr",null,r):Gt.symlink("/dev/tty1","/dev/stderr"),Gt.open("/dev/stdin",0),Gt.open("/dev/stdout",1),Gt.open("/dev/stderr",1)},staticInit(){Gt.nameTable=new Array(4096),Gt.mount(It,{},"/"),Gt.createDefaultDirectories(),Gt.createDefaultDevices(),Gt.createSpecialDirectories(),Gt.filesystems={MEMFS:It}},init(e,r,n){Gt.initialized=!0,e??(e=t.stdin),r??(r=t.stdout),n??(n=t.stderr),Gt.createStandardStreams(e,r,n)},quit(){for(var e of(Gt.initialized=!1,Gt.streams))e&&Gt.close(e)},findObject(e,t){var r=Gt.analyzePath(e,t);return r.exists?r.object:null},analyzePath(e,t){try{e=(n=Gt.lookupPath(e,{follow:!t})).path}catch(e){}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=Gt.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=Tt.basename(e),n=Gt.lookupPath(e,{follow:!t}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot="/"===n.path}catch(e){r.error=e.errno}return r},createPath(e,t,r,n){e="string"==typeof e?e:Gt.getPath(e);for(var a=t.split("/").reverse();a.length;){var o=a.pop();if(o){var i=Tt.join2(e,o);try{Gt.mkdir(i)}catch(e){if(20!=e.errno)throw e}e=i}}return i},createFile(e,t,r,n,a){var o=Tt.join2("string"==typeof e?e:Gt.getPath(e),t),i=Lt(n,a);return Gt.create(o,i)},createDataFile(e,t,r,n,a,o){var i=t;e&&(e="string"==typeof e?e:Gt.getPath(e),i=t?Tt.join2(e,t):e);var s=Lt(n,a),u=Gt.create(i,s);if(r){if("string"==typeof r){for(var l=new Array(r.length),c=0,d=r.length;c<d;++c)l[c]=r.charCodeAt(c);r=l}Gt.chmod(u,146|s);var f=Gt.open(u,577);Gt.write(f,r,0,r.length,0,o),Gt.close(f),Gt.chmod(u,s)}},createDevice(e,t,r,n){var a,o=Tt.join2("string"==typeof e?e:Gt.getPath(e),t),i=Lt(!!r,!!n);(a=Gt.createDevice).major??(a.major=64);var s=Gt.makedev(Gt.createDevice.major++,0);return Gt.registerDevice(s,{open(e){e.seekable=!1},close(e){n?.buffer?.length&&n(10)},read(e,t,n,a,o){for(var i=0,s=0;s<a;s++){var u;try{u=r()}catch(e){throw new Gt.ErrnoError(29)}if(void 0===u&&0===i)throw new Gt.ErrnoError(6);if(null==u)break;i++,t[n+s]=u}return i&&(e.node.atime=Date.now()),i},write(e,t,r,a,o){for(var i=0;i<a;i++)try{n(t[r+i])}catch(e){throw new Gt.ErrnoError(29)}return a&&(e.node.mtime=e.node.ctime=Date.now()),i}}),Gt.mkdev(o,i,s)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(globalThis.XMLHttpRequest)j("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.contents=s(e.url)}catch(e){throw new Gt.ErrnoError(29)}},createLazyFile(e,t,r,a,o){class i{get(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize;return this.getter(e/this.chunkSize|0)[t]}}setDataGetter(e){this.getter=e}cacheLength(){var e=new XMLHttpRequest;e.open("HEAD",r,!1),e.send(null),e.status>=200&&e.status<300||304===e.status||j("Couldn't load "+r+". Status: "+e.status);var t,n=Number(e.getResponseHeader("Content-length")),a=(t=e.getResponseHeader("Accept-Ranges"))&&"bytes"===t,o=(t=e.getResponseHeader("Content-Encoding"))&&"gzip"===t,i=1048576;a||(i=n);var s=this;s.setDataGetter(e=>{var t=e*i,a=(e+1)*i-1;return a=Math.min(a,n-1),void 0===s.chunks[e]&&(s.chunks[e]=((e,t)=>{e>t&&j("invalid range ("+e+", "+t+") or no bytes requested!"),t>n-1&&j("only "+n+" bytes available! programmer error!");var a=new XMLHttpRequest;return a.open("GET",r,!1),n!==i&&a.setRequestHeader("Range","bytes="+e+"-"+t),a.responseType="arraybuffer",a.overrideMimeType&&a.overrideMimeType("text/plain; charset=x-user-defined"),a.send(null),a.status>=200&&a.status<300||304===a.status||j("Couldn't load "+r+". Status: "+a.status),void 0!==a.response?new Uint8Array(a.response||[]):Ot(a.responseText||"")})(t,a)),void 0===s.chunks[e]&&j("doXHR failed!"),s.chunks[e]}),!o&&n||(i=n=1,n=this.getter(0).length,i=n,T("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=n,this._chunkSize=i,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}constructor(){be(this,"lengthKnown",!1),be(this,"chunks",[])}}if(globalThis.XMLHttpRequest){n||j("Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc");var s={isDevice:!1,contents:new i}}else s={isDevice:!1,url:r};var u=Gt.createFile(e,t,s,a,o);s.contents?u.contents=s.contents:s.url&&(u.contents=null,u.url=s.url),Object.defineProperties(u,{usedBytes:{get:function(){return this.contents.length}}});var l={};for(const[e,t]of Object.entries(u.stream_ops))l[e]=(...e)=>(Gt.forceLoadFile(u),t(...e));function c(e,t,r,n,a){var o=e.node.contents;if(a>=o.length)return 0;var i=Math.min(o.length-a,n);if(o.slice)for(var s=0;s<i;s++)t[r+s]=o[a+s];else for(s=0;s<i;s++)t[r+s]=o.get(a+s);return i}return l.read=(e,t,r,n,a)=>(Gt.forceLoadFile(u),c(e,t,r,n,a)),l.mmap=(e,t,r,n,a)=>{Gt.forceLoadFile(u);var o=$t();if(!o)throw new Gt.ErrnoError(48);return c(e,g,o,t,r),{ptr:o,allocated:!0}},u.stream_ops=l,u}},Nt={DEFAULT_POLLMASK:5,calculateAt(e,t,r){if(Tt.isAbs(t))return t;var n;if(n=-100===e?Gt.cwd():Nt.getStreamFromFD(e).path,0==t.length){if(!r)throw new Gt.ErrnoError(44);return n}return n+"/"+t},writeStat(e,t){y[e>>2]=t.dev,y[e+4>>2]=t.mode,y[e+8>>2]=t.nlink,y[e+12>>2]=t.uid,y[e+16>>2]=t.gid,y[e+20>>2]=t.rdev,k[e+24>>3]=BigInt(t.size),w[e+32>>2]=4096,w[e+36>>2]=t.blocks;var r=t.atime.getTime(),n=t.mtime.getTime(),a=t.ctime.getTime();return k[e+40>>3]=BigInt(Math.floor(r/1e3)),y[e+48>>2]=r%1e3*1e3*1e3,k[e+56>>3]=BigInt(Math.floor(n/1e3)),y[e+64>>2]=n%1e3*1e3*1e3,k[e+72>>3]=BigInt(Math.floor(a/1e3)),y[e+80>>2]=a%1e3*1e3*1e3,k[e+88>>3]=BigInt(t.ino),0},writeStatFs(e,t){y[e+4>>2]=t.bsize,y[e+60>>2]=t.bsize,k[e+8>>3]=BigInt(t.blocks),k[e+16>>3]=BigInt(t.bfree),k[e+24>>3]=BigInt(t.bavail),k[e+32>>3]=BigInt(t.files),k[e+40>>3]=BigInt(t.ffree),y[e+48>>2]=t.fsid,y[e+64>>2]=t.flags,y[e+56>>2]=t.namelen},doMsync(e,t,r,n,a){if(!Gt.isFile(t.node.mode))throw new Gt.ErrnoError(43);if(2&n)return 0;var o=_.slice(e,e+r);Gt.msync(t,o,a,r,n)},getStreamFromFD:e=>Gt.getStreamChecked(e),varargs:void 0,getStr:e=>N(e)},Jt=e=>"]"==e.slice(-1)&&e.lastIndexOf("["),Ht=[],qt=e=>0==(e-=5120)?g:1==e?_:2==e?v:4==e?w:6==e?x:5==e||28922==e||28520==e||30779==e||30782==e?y:b,Xt=(e,t)=>e>>>31-Math.clz32(t.BYTES_PER_ELEMENT),Qt=e=>{var t=Ve.currentProgram;if(t){var r=t.uniformLocsById[e];return"number"==typeof r&&(t.uniformLocsById[e]=r=Ve.getUniformLocation(t,t.uniformArrayNamesById[e]+(r>0?`[${r}]`:""))),r}bt.recordError(1282)},Kt=[],Zt=[],Yt=(e,t)=>Wr.set(e,t),er=e=>{const t=e.length;return[t%128|128,t>>7,...e]},tr={i:127,p:127,j:126,f:125,d:124,e:111},rr=e=>er(Array.from(e,e=>tr[e]));(()=>{let e=le.prototype;Object.assign(e,{isAliasOf(e){if(!(this instanceof le))return!1;if(!(e instanceof le))return!1;var t=this.$$.ptrType.registeredClass,r=this.$$.ptr;e.$$=e.$$;for(var n=e.$$.ptrType.registeredClass,a=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;n.baseClass;)a=n.upcast(a),n=n.baseClass;return t===n&&r===a},clone(){if(this.$$.ptr||ae(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=ue(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t},delete(){this.$$.ptr||ae(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&te("Object already scheduled for deletion"),ie(this),se(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||ae(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&te("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}});const t=Symbol.dispose;t&&(e[t]=e.delete)})(),Object.assign(Te.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},readValueFromPointer:ye,fromWireType:function(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=((e,t)=>(t=((e,t)=>{for(void 0===t&&te("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t})(this.registeredClass,t),Ee[t]))(0,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var n=r.clone();return this.destructor(e),n}function a(){return Be(this.registeredClass.instancePrototype,this.isSmartPointer?{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}:{ptrType:this,ptr:e})}var o,i=this.registeredClass.getActualType(t),s=de[i];if(!s)return a.call(this);var u=xe(t,this.registeredClass,(o=this.isConst?s.constPointerType:s.pointerType).registeredClass);return null===u?a.call(this):Be(o.registeredClass.instancePrototype,this.isSmartPointer?{ptrType:o,ptr:u,smartPtrType:this,smartPtr:e}:{ptrType:o,ptr:u})}}),"undefined"!=typeof MainLoop&&MainLoop.preMainLoop.push(()=>bt.newRenderingFrameStarted()),Gt.createPreloadedFile=(e,t,r,n,a,o,i,s,u,l)=>{Ut(e,t,r,n,a,s,u,l).then(o).catch(i)},Gt.preloadFile=Ut,Gt.staticInit();for(let e=0;e<32;++e)Ht.push(new Array(e));for(var nr,ar,or,ir,sr,ur,lr,cr,dr,fr,pr,mr,hr,gr,_r,vr,br,wr,yr,xr,Er,kr,Sr,Br,Tr,Cr,Pr,Ar,Fr,Or,jr,$r,Ir,Lr,Dr,Mr,Vr,Rr,Wr,zr=new Int32Array(288),Ur=0;Ur<=288;++Ur)Kt[Ur]=zr.subarray(0,Ur);if(t.noExitRuntime&&(R=t.noExitRuntime),t.preloadPlugins&&(zt=t.preloadPlugins),t.print&&(T=t.print),t.printErr&&(C=t.printErr),t.wasmBinary&&(f=t.wasmBinary),t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.shift()();t.addRunDependency=Wt,t.removeRunDependency=Rt,t.addFunction=(e,t)=>{var r=(e=>(Re||(Re=new WeakMap,((e,t)=>{if(Re)for(var r=0;r<0+t;r++){var n=Pe(r);n&&Re.set(n,r)}})(0,Wr.length)),Re.get(e)||0))(e);if(r)return r;var n=Zt.length?Zt.pop():Wr.grow(1);try{Yt(n,e)}catch(r){if(!(r instanceof TypeError))throw r;var a=((e,t)=>{var r=Uint8Array.of(0,97,115,109,1,0,0,0,1,...er([1,96,...rr(t.slice(1)),...rr("v"===t[0]?"":t[0])]),2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),n=new WebAssembly.Module(r);return new WebAssembly.Instance(n,{e:{f:e}}).exports.f})(e,t);Yt(n,a)}return Re.set(e,n),n},t.removeFunction=e=>{Re.delete(Pe(e)),Yt(e,null),Zt.push(e)},t.FS_preloadFile=Ut,t.FS_unlink=(...e)=>Gt.unlink(...e),t.FS_createPath=(...e)=>Gt.createPath(...e),t.FS_createDevice=(...e)=>Gt.createDevice(...e),t.FS_createDataFile=Dt,t.FS_createLazyFile=(...e)=>Gt.createLazyFile(...e);var Gr,Nr={a:(e,t,r,n)=>j(`Assertion failed: ${N(e)}, at: `+[t?N(t):"unknown filename",r,n?N(n):"unknown function"]),ub:e=>{var t=new H(e);return t.get_caught()||t.set_caught(!0),t.set_rethrown(!1),Dr(e),Vr(e)},ra:()=>X([]),ob:e=>X([e]),P:(e,t,r)=>{throw new H(e).init(t,r),J=e},qa:e=>{throw J||(J=e),J},zb:()=>j(""),oa:(e,t,r,n,a)=>{t=Q(t);const o=0n===n;let i=e=>e;if(o){const e=8*r;i=t=>BigInt.asUintN(e,t),a=i(a)}re(e,{name:t,fromWireType:i,toWireType:(e,t)=>("number"==typeof t&&(t=BigInt(t)),t),readValueFromPointer:ne(t,r,!o),destructorFunction:null})},lb:(e,t,r,n)=>{re(e,{name:t=Q(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:n},readValueFromPointer:function(e){return this.fromWireType(_[e])},destructorFunction:null})},kb:(e,t,r,n,a,o,i,s,u,l,c,d,f)=>{c=Q(c),o=Ae(a,o),s&&(s=Ae(i,s)),l&&(l=Ae(u,l)),f=Ae(d,f);var p=(e=>{var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?`_${e}`:e})(c);pe(p,function(){je(`Cannot construct ${c} due to unbound types`,[n])}),$e([e,t,r],n?[n]:[],t=>{var r,a;t=t[0],a=n?(r=t.registeredClass).instancePrototype:le.prototype;var i=ce(c,function(...e){if(Object.getPrototypeOf(this)!==u)throw new ee(`Use 'new' to construct ${c}`);if(void 0===m.constructor_body)throw new ee(`${c} has no accessible constructor`);var t=m.constructor_body[e.length];if(void 0===t)throw new ee(`Tried to invoke ctor of ${c} with invalid number of parameters (${e.length}) - expected (${Object.keys(m.constructor_body).toString()}) parameters instead!`);return t.apply(this,e)}),u=Object.create(a,{constructor:{value:i}});i.prototype=u;var d,m=new me(c,i,u,f,r,o,s,l);m.baseClass&&((d=m.baseClass).__derivedClasses??(d.__derivedClasses=[]),m.baseClass.__derivedClasses.push(m));var h=new Te(c,m,!0,!1,!1),g=new Te(c+"*",m,!1,!1,!1),_=new Te(c+" const*",m,!1,!0,!1);return de[e]={pointerType:g,constPointerType:_},Ce(p,i),[h,g,_]})},gb:(e,t,r,n,a,o)=>{var i=Ie(t,r);a=Ae(n,a),$e([],[e],e=>{var r=`constructor ${(e=e[0]).name}`;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new ee(`Cannot register multiple constructors with identical number of parameters (${t-1}) for class '${e.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return e.registeredClass.constructor_body[t-1]=()=>{je(`Cannot construct ${e.name} due to unbound types`,i)},$e([],i,n=>(n.splice(1,0,null),e.registeredClass.constructor_body[t-1]=Me(r,n,null,a,o),[])),[]})},F:(e,t,r,n,a,o,i,s,u,l)=>{var c=Ie(r,n);t=Q(t),t=We(t),o=Ae(a,o,u),$e([],[e],e=>{var n=`${(e=e[0]).name}.${t}`;function a(){je(`Cannot call ${n} due to unbound types`,c)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),s&&e.registeredClass.pureVirtualFunctions.push(t);var l=e.registeredClass.instancePrototype,d=l[t];return void 0===d||void 0===d.overloadTable&&d.className!==e.name&&d.argCount===r-2?(a.argCount=r-2,a.className=e.name,l[t]=a):(fe(l,t,n),l[t].overloadTable[r-2]=a),$e([],c,a=>{var s=Me(n,a,e,o,i,u);return void 0===l[t].overloadTable?(s.argCount=r-2,l[t]=s):l[t].overloadTable[r-2]=s,[]}),[]})},ib:He,na:(e,t,r)=>{re(e,{name:t=Q(t),fromWireType:e=>e,toWireType:(e,t)=>t,readValueFromPointer:qe(t,r),destructorFunction:null})},Aa:(e,t,r,n,a,o,i,s)=>{var u=Ie(t,r);e=Q(e),e=We(e),a=Ae(n,a,i),pe(e,function(){je(`Cannot call ${e} due to unbound types`,u)},t-1),$e([],u,r=>{var n=[r[0],null].concat(r.slice(1));return Ce(e,Me(e,n,null,a,o,i),t-1),[]})},y:(e,t,r,n,a)=>{t=Q(t);let o=e=>e;if(0===n){var i=32-8*r;o=e=>e<<i>>>i,a=o(a)}re(e,{name:t,fromWireType:o,toWireType:(e,t)=>t,readValueFromPointer:ne(t,r,0!==n),destructorFunction:null})},p:(e,t,r)=>{var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][t];function a(e){return new n(g.buffer,y[e+4>>2],y[e>>2])}re(e,{name:r=Q(r),fromWireType:a,readValueFromPointer:a},{ignoreDuplicateRegistrations:!0})},jb:(e,t)=>{re(e,{name:t=Q(t),fromWireType(e){var t;return t=N(e+4,y[e>>2],!0),nr(e),t},toWireType(e,t){var r;t instanceof ArrayBuffer&&(t=new Uint8Array(t));var n="string"==typeof t;n||ArrayBuffer.isView(t)&&1==t.BYTES_PER_ELEMENT||te("Cannot pass non-string to std::string"),r=n?Ke(t):t.length;var a=ar(4+r+1),o=a+4;return y[a>>2]=r,n?Qe(t,o,r+1):_.set(t,o),null!==e&&e.push(nr,a),a},readValueFromPointer:ye,destructorFunction(e){nr(e)}})},Q:(e,t,r)=>{var n,a,o;r=Q(r),2===t?(n=Ye,a=et,o=tt):(n=rt,a=nt,o=at),re(e,{name:r,fromWireType:e=>{var r=n(e+4,y[e>>2]*t,!0);return nr(e),r},toWireType:(e,n)=>{"string"!=typeof n&&te(`Cannot pass non-string to C++ string type ${r}`);var i=o(n),s=ar(4+i+t);return y[s>>2]=i/t,a(n,s+4,i+t),null!==e&&e.push(nr,s),s},readValueFromPointer:ye,destructorFunction(e){nr(e)}})},Tb:(e,t)=>{He(e)},mb:(e,t)=>{re(e,{isVoid:!0,name:t=Q(t),fromWireType:()=>{},toWireType:(e,t)=>{}})},sb:()=>{R=!1,ot=0},qb:()=>{throw 1/0},ga:(e,t,r)=>{var[n,...a]=((e,t)=>{for(var r=new Array(e),n=0;n<e;++n)r[n]=st(y[t+4*n>>2],`parameter ${n}`);return r})(e,t),o=n.toWireType.bind(n),i=a.map(e=>e.readValueFromPointer.bind(e));e--;var s,u={toValue:Ne.toValue},l=i.map((e,t)=>{var r=`argFromPtr${t}`;return u[r]=e,`${r}(args${t?"+"+8*t:""})`});switch(r){case 0:s="toValue(handle)";break;case 2:s="new (toValue(handle))";break;case 3:s="";break;case 1:u.getStringOrSymbol=ct,s="toValue(handle)[getStringOrSymbol(methodName)]"}s+=`(${l})`,n.isVoid||(u.toReturnWire=o,u.emval_returnValue=ut,s=`return emval_returnValue(toReturnWire, destructorsRef, ${s})`),s=`return function (handle, methodName, destructorsRef, args) {\n ${s}\n }`;var c,d,f=new Function(Object.keys(u),s)(...Object.values(u)),p=`methodCaller<(${a.map(e=>e.name)}) => ${n.name}>`;return c=ce(p,f),d=it.length,it.push(c),d},Fa:Ge,Ka:e=>{e>9&&(Ue[e+1]+=1)},ca:(e,t,r,n,a)=>it[e](t,r,n,a),nb:e=>Ne.toHandle(ct(e)),pb:()=>Ne.toHandle({}),Ra:e=>{var t=Ne.toValue(e);Le(t),Ge(e)},pa:(e,t,r)=>{e=Ne.toValue(e),t=Ne.toValue(t),r=Ne.toValue(r),e[t]=r},tb:(e,t)=>{if(dt[e]&&(clearTimeout(dt[e].id),delete dt[e]),!t)return 0;var r=setTimeout(()=>{delete dt[e],ht(()=>Fr(e,performance.now()))},t);return dt[e]={id:r,timeout_ms:t},0},vb:e=>{var t=_.length,r=2147483648;if((e>>>=0)>r)return!1;for(var n=1;n<=4;n*=2){var a=t*(1+.2/n);a=Math.min(a,e+100663296);var o=Math.min(r,gt(Math.max(e,a),65536));if(_t(o))return!0}return!1},Mb:(e,t)=>{var r=t>>2,n={alpha:!!g[t+0],depth:!!g[t+1],stencil:!!g[t+2],antialias:!!g[t+3],premultipliedAlpha:!!g[t+4],preserveDrawingBuffer:!!g[t+5],powerPreference:wt[w[r+2]],failIfMajorPerformanceCaveat:!!g[t+12],majorVersion:w[r+4],minorVersion:w[r+5],enableExtensionsByDefault:g[t+24],explicitSwapControl:g[t+25],proxyContextToMainThread:w[r+7],renderViaOffscreenBackBuffer:g[t+32]},a=xt(e);return a?n.explicitSwapControl?0:bt.createContext(a,n):0},Sb:e=>{bt.currentContext==e&&(bt.currentContext=0),bt.deleteContext(e)},hb:()=>bt.currentContext?bt.currentContext.handle:0,va:e=>bt.makeContextCurrent(e)?0:-5,Eb:function(e,t,r,n,a,o){t=Bt(t),r=Bt(r);var i=kt.getJsObject(e),s={};if(o){var u=y[o+12>>2];if(u){var l=y[o+16>>2];s.requiredFeatures=Array.from(y.subarray(l>>2,l+4*u>>2),e=>kt.FeatureName[e])}var c=y[o+20>>2];if(c){var d={};function m(e,t,r=!1){var n=y[c+t>>2];4294967295==n||r&&0==n||(d[e]=n)}function h(e,t){var r=c+t;4294967295==y[r>>2]&&4294967295==y[r+4>>2]||(d[e]=4294967296*y[r+4>>2]+y[r>>2])}m("maxTextureDimension1D",4),m("maxTextureDimension2D",8),m("maxTextureDimension3D",12),m("maxTextureArrayLayers",16),m("maxBindGroups",20),m("maxBindGroupsPlusVertexBuffers",24),m("maxDynamicUniformBuffersPerPipelineLayout",32),m("maxDynamicStorageBuffersPerPipelineLayout",36),m("maxSampledTexturesPerShaderStage",40),m("maxSamplersPerShaderStage",44),m("maxStorageBuffersPerShaderStage",48),m("maxStorageTexturesPerShaderStage",52),m("maxUniformBuffersPerShaderStage",56),m("minUniformBufferOffsetAlignment",80),m("minStorageBufferOffsetAlignment",84),h("maxUniformBufferBindingSize",64),h("maxStorageBufferBindingSize",72),m("maxVertexBuffers",88),h("maxBufferSize",96),m("maxVertexAttributes",104),m("maxVertexBufferArrayStride",108),m("maxInterStageShaderVariables",112),m("maxColorAttachments",116),m("maxColorAttachmentBytesPerSample",120),m("maxComputeWorkgroupStorageSize",124),m("maxComputeInvocationsPerWorkgroup",128),m("maxComputeWorkgroupSizeX",132),m("maxComputeWorkgroupSizeY",136),m("maxComputeWorkgroupSizeZ",140),m("maxComputeWorkgroupsPerDimension",144),m("maxImmediateSize",148,!0),s.requiredLimits=d}var f=y[o+24>>2];if(f){var p={label:kt.makeStringFromOptionalStringView(f+4)};s.defaultQueue=p}s.label=kt.makeStringFromOptionalStringView(o+4)}kt.Internals.futureInsert(t,i.requestDevice(s).then(e=>{ht(()=>{kt.Internals.jsObjectInsert(a,e.queue),kt.Internals.jsObjectInsert(n,e),kt.Internals.futureInsert(r,e.lost.then(t=>{ht(()=>{e.onuncapturederror=e=>{};var n=z(),a=Et(t.message);Tr(r,St[t.reason],a),W(n)})})),e.onuncapturederror=e=>{var t=5;e.error instanceof GPUValidationError?t=2:e.error instanceof GPUOutOfMemoryError?t=3:e.error instanceof GPUInternalError&&(t=4);var r=z(),a=Et(e.error.message);Ar(n,t,a),W(r)},Pr(t,1,n,0)})},e=>{ht(()=>{var a=z(),o=Et(e.message);Pr(t,3,n,o),r&&Tr(r,4,o),W(a)})}))},Gb:e=>{var t=kt.getJsObject(e),r=kt.Internals.bufferOnUnmaps[e];if(r){for(var n=0;n<r.length;++n)r[n]();delete kt.Internals.bufferOnUnmaps[e]}t.destroy()},h:e=>{delete kt.Internals.jsObjects[e]},Db:(e,t,r)=>{var n,a=!!y[t+32>>2],o={label:kt.makeStringFromOptionalStringView(t+4),usage:y[t+16>>2],size:4294967296*y[t+4+24>>2]+y[t+24>>2],mappedAtCreation:a},i=kt.getJsObject(e);try{n=i.createBuffer(o)}catch(e){return!1}return kt.Internals.jsObjectInsert(r,n),a&&(kt.Internals.bufferOnUnmaps[r]=[]),!0},Bb:(e,t,r)=>{var n=y[t>>2],a=y[n+4>>2],o={label:kt.makeStringFromOptionalStringView(t+4),code:""};2===a&&(o.code=kt.makeStringFromStringView(n+8));var i=kt.getJsObject(e);kt.Internals.jsObjectInsert(r,i.createShaderModule(o))},Fb:e=>{const t=kt.getJsObject(e);t.onuncapturederror=null,t.destroy()},Ab:function(e,t,r,n){var a;if(t=Bt(t),r){a={featureLevel:kt.FeatureLevel[y[r+4>>2]],powerPreference:kt.PowerPreference[y[r+8>>2]],forceFallbackAdapter:!!y[r+12>>2]};var o=y[r>>2];0!==o&&(a.xrCompatible=!!y[o+8>>2])}if(!("gpu"in navigator)){var i=z(),s=Et("WebGPU not available on this browser (navigator.gpu is not available)");return Cr(t,3,n,s),void W(i)}kt.Internals.futureInsert(t,navigator.gpu.requestAdapter(a).then(e=>{ht(()=>{if(e)kt.Internals.jsObjectInsert(n,e),Cr(t,1,n,0);else{var r=z(),a=Et("WebGPU not available on this browser (requestAdapter returned null)");Cr(t,3,n,a),W(r)}})},e=>{ht(()=>{var r=z(),a=Et(e.message);Cr(t,4,n,a),W(r)})}))},xb:function(e){try{var t=Nt.getStreamFromFD(e);return Gt.close(t),0}catch(e){if(void 0===Gt||"ErrnoError"!==e.name)throw e;return e.errno}},wb:function(e,t,r,n){t=Bt(t);try{if(isNaN(t))return 61;var a=Nt.getStreamFromFD(e);return Gt.llseek(a,t,r),k[n>>3]=BigInt(a.position),a.getdents&&0===t&&0===r&&(a.getdents=null),0}catch(e){if(void 0===Gt||"ErrnoError"!==e.name)throw e;return e.errno}},yb:function(e,t,r,n){try{var a=((e,t,r)=>{for(var n=0,a=0;a<r;a++){var o=y[t>>2],i=y[t+4>>2];t+=8;var s=Gt.write(e,g,o,i,void 0);if(s<0)return-1;if(n+=s,s<i)break}return n})(Nt.getStreamFromFD(e),t,r);return y[n>>2]=a,0}catch(e){if(void 0===Gt||"ErrnoError"!==e.name)throw e;return e.errno}},Pa:e=>Ve.activeTexture(e),ja:(e,t)=>{Ve.attachShader(bt.programs[e],bt.shaders[t])},w:(e,t)=>{if(t&&!bt.buffers[t]){var r=Ve.createBuffer();r.name=t,bt.buffers[t]=r}34962==e?Ve.currentArrayBufferBinding=t:34963==e&&(Ve.currentElementArrayBufferBinding=t),35051==e?Ve.currentPixelPackBufferBinding=t:35052==e&&(Ve.currentPixelUnpackBufferBinding=t),Ve.bindBuffer(e,bt.buffers[t])},Na:(e,t,r,n,a)=>{Ve.bindBufferRange(e,t,bt.buffers[r],n,a)},f:(e,t)=>{Ve.bindFramebuffer(e,bt.framebuffers[t])},O:(e,t)=>{Ve.bindRenderbuffer(e,bt.renderbuffers[t])},I:(e,t)=>{Ve.bindTexture(e,bt.textures[t])},ka:e=>{Ve.bindVertexArray(bt.vaos[e]);var t=Ve.getParameter(34965);Ve.currentElementArrayBufferBinding=t?0|t.name:0},A:(e,t)=>Ve.blendFunc(e,t),v:(e,t,r,n,a,o,i,s,u,l)=>Ve.blitFramebuffer(e,t,r,n,a,o,i,s,u,l),la:(e,t,r,n)=>{bt.currentContext.version>=2?r&&t?Ve.bufferData(e,_,n,r,t):Ve.bufferData(e,t,n):Ve.bufferData(e,r?_.subarray(r,r+t):t,n)},X:e=>Ve.clear(e),Y:(e,t,r,n)=>Ve.clearColor(e,t,r,n),Ia:e=>Ve.clearDepth(e),Ja:e=>Ve.clearStencil(e),C:(e,t,r,n)=>{Ve.colorMask(!!e,!!t,!!r,!!n)},Da:e=>{Ve.compileShader(bt.shaders[e])},ab:()=>{var e=bt.getNewId(bt.programs),t=Ve.createProgram();return t.name=e,t.maxUniformLength=t.maxAttributeLength=t.maxUniformBlockNameLength=0,t.uniformIdCounter=1,bt.programs[e]=t,e},Ga:e=>{var t=bt.getNewId(bt.shaders);return bt.shaders[t]=Ve.createShader(e),t},Xa:e=>Ve.cullFace(e),eb:(e,t)=>{for(var r=0;r<e;r++){var n=w[t+4*r>>2],a=bt.buffers[n];a&&(Ve.deleteBuffer(a),a.name=0,bt.buffers[n]=null,n==Ve.currentArrayBufferBinding&&(Ve.currentArrayBufferBinding=0),n==Ve.currentElementArrayBufferBinding&&(Ve.currentElementArrayBufferBinding=0),n==Ve.currentPixelPackBufferBinding&&(Ve.currentPixelPackBufferBinding=0),n==Ve.currentPixelUnpackBufferBinding&&(Ve.currentPixelUnpackBufferBinding=0))}},_:(e,t)=>{for(var r=0;r<e;++r){var n=w[t+4*r>>2],a=bt.framebuffers[n];a&&(Ve.deleteFramebuffer(a),a.name=0,bt.framebuffers[n]=null)}},ha:e=>{if(e){var t=bt.programs[e];t?(Ve.deleteProgram(t),t.name=0,bt.programs[e]=null):bt.recordError(1281)}},Z:(e,t)=>{for(var r=0;r<e;r++){var n=w[t+4*r>>2],a=bt.renderbuffers[n];a&&(Ve.deleteRenderbuffer(a),a.name=0,bt.renderbuffers[n]=null)}},N:e=>{if(e){var t=bt.shaders[e];t?(Ve.deleteShader(t),bt.shaders[e]=null):bt.recordError(1281)}},ma:(e,t)=>{for(var r=0;r<e;r++){var n=w[t+4*r>>2],a=bt.textures[n];a&&(Ve.deleteTexture(a),a.name=0,bt.textures[n]=null)}},cb:(e,t)=>{for(var r=0;r<e;r++){var n=w[t+4*r>>2];Ve.deleteVertexArray(bt.vaos[n]),bt.vaos[n]=null}},Va:e=>Ve.depthFunc(e),K:e=>{Ve.depthMask(!!e)},x:e=>Ve.disable(e),La:e=>{bt.currentContext.clientBuffers[e].enabled=!1,Ve.disableVertexAttribArray(e)},Ma:(e,t,r,n)=>{var a,o=0;if(!Ve.currentElementArrayBufferBinding){var i=bt.calcBufLength(1,r,0,t);if(a=bt.getTempIndexBuffer(i),Ve.bindBuffer(34963,a),Ve.bufferSubData(34963,0,_.subarray(n,n+i)),t>0)for(var s=0;s<bt.currentContext.maxVertexAttribs;++s){var u=bt.currentContext.clientBuffers[s];if(u.clientside&&u.enabled){let e;switch(r){case 5121:e=Uint8Array;break;case 5123:e=Uint16Array;break;case 5125:e=Uint32Array;break;default:return void bt.recordError(1282)}o=new e(_.buffer,n,t).reduce((e,t)=>Math.max(e,t))+1;break}}n=0}bt.preDrawHandleClientVertexAttribBindings(o),Ve.drawElements(e,t,r,n),bt.postDrawHandleClientVertexAttribBindings(t),Ve.currentElementArrayBufferBinding||Ve.bindBuffer(34963,null)},s:e=>Ve.enable(e),Sa:e=>{bt.currentContext.clientBuffers[e].enabled=!0,Ve.enableVertexAttribArray(e)},$:(e,t,r,n)=>{Ve.framebufferRenderbuffer(e,t,r,bt.renderbuffers[n])},Ua:(e,t,r,n,a)=>{Ve.framebufferTexture2D(e,t,r,bt.textures[n],a)},Wa:e=>Ve.frontFace(e),fb:(e,t)=>{bt.genObject(e,t,"createBuffer",bt.buffers)},da:(e,t)=>{bt.genObject(e,t,"createFramebuffer",bt.framebuffers)},ba:(e,t)=>{bt.genObject(e,t,"createRenderbuffer",bt.renderbuffers)},fa:(e,t)=>{bt.genObject(e,t,"createTexture",bt.textures)},db:(e,t)=>{bt.genObject(e,t,"createVertexArray",bt.vaos)},bb:(e,t)=>((e,t)=>{if(t){var r,n=void 0;switch(e){case 36346:n=1;break;case 36344:return;case 34814:case 36345:n=0;break;case 34466:var a=Ve.getParameter(34467);n=a?a.length:0;break;case 33309:if(bt.currentContext.version<2)return void bt.recordError(1282);n=(r=vt(Ve),r.concat(r.map(e=>"GL_"+e))).length;break;case 33307:case 33308:if(bt.currentContext.version<2)return void bt.recordError(1280);n=33307==e?3:0}if(void 0===n){var o=Ve.getParameter(e);switch(typeof o){case"number":n=o;break;case"boolean":n=o?1:0;break;case"string":return void bt.recordError(1280);case"object":if(null===o)switch(e){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 36662:case 36663:case 35053:case 35055:case 36010:case 35097:case 35869:case 32874:case 36389:case 35983:case 35368:case 34068:n=0;break;default:return void bt.recordError(1280)}else{if(o instanceof Float32Array||o instanceof Uint32Array||o instanceof Int32Array||o instanceof Array){for(var i=0;i<o.length;++i)w[t+4*i>>2]=o[i];return}try{n=0|o.name}catch(t){return bt.recordError(1280),void C(`GL_INVALID_ENUM in glGet0v: Unknown object returned from WebGL getParameter(${e})! (error: ${t})`)}}break;default:return bt.recordError(1280),void C(`GL_INVALID_ENUM in glGet0v: Native code calling glGet0v(${e}) and it returns ${o} of type ${typeof o}!`)}}w[t>>2]=n}else bt.recordError(1281)})(e,t),_a:(e,t,r,n)=>{var a=Ve.getProgramInfoLog(bt.programs[e]);null===a&&(a="(unknown error)");var o=t>0&&n?Qe(a,n,t):0;r&&(w[r>>2]=o)},ia:(e,t,r)=>{if(r)if(e>=bt.counter)bt.recordError(1281);else if(e=bt.programs[e],35716==t){var n=Ve.getProgramInfoLog(e);null===n&&(n="(unknown error)"),w[r>>2]=n.length+1}else if(35719==t){if(!e.maxUniformLength)for(var a=Ve.getProgramParameter(e,35718),o=0;o<a;++o)e.maxUniformLength=Math.max(e.maxUniformLength,Ve.getActiveUniform(e,o).name.length+1);w[r>>2]=e.maxUniformLength}else if(35722==t){if(!e.maxAttributeLength){var i=Ve.getProgramParameter(e,35721);for(o=0;o<i;++o)e.maxAttributeLength=Math.max(e.maxAttributeLength,Ve.getActiveAttrib(e,o).name.length+1)}w[r>>2]=e.maxAttributeLength}else if(35381==t){if(!e.maxUniformBlockNameLength){var s=Ve.getProgramParameter(e,35382);for(o=0;o<s;++o)e.maxUniformBlockNameLength=Math.max(e.maxUniformBlockNameLength,Ve.getActiveUniformBlockName(e,o).length+1)}w[r>>2]=e.maxUniformBlockNameLength}else w[r>>2]=Ve.getProgramParameter(e,t);else bt.recordError(1281)},Ca:(e,t,r,n)=>{var a=Ve.getShaderInfoLog(bt.shaders[e]);null===a&&(a="(unknown error)");var o=t>0&&n?Qe(a,n,t):0;r&&(w[r>>2]=o)},W:(e,t,r)=>{if(r)if(35716==t){var n=Ve.getShaderInfoLog(bt.shaders[e]);null===n&&(n="(unknown error)"),w[r>>2]=n?n.length+1:0}else if(35720==t){var a=Ve.getShaderSource(bt.shaders[e]);w[r>>2]=a?a.length+1:0}else w[r>>2]=Ve.getShaderParameter(bt.shaders[e],t);else bt.recordError(1281)},l:(e,t)=>Ve.getUniformBlockIndex(bt.programs[e],N(t)),o:(e,t)=>{if(t=N(t),e=bt.programs[e]){(e=>{var t,r,n=e.uniformLocsById,a=e.uniformSizeAndIdsByName;if(!n){e.uniformLocsById=n={},e.uniformArrayNamesById={};var o=Ve.getProgramParameter(e,35718);for(t=0;t<o;++t){var i=Ve.getActiveUniform(e,t),s=i.name,u=i.size,l=Jt(s),c=l>0?s.slice(0,l):s,d=e.uniformIdCounter;for(e.uniformIdCounter+=u,a[c]=[u,d],r=0;r<u;++r)n[d]=r,e.uniformArrayNamesById[d++]=c}}})(e);var r=e.uniformLocsById,n=0,a=t,o=Jt(t);o>0&&(s=t.slice(o+1),n=parseInt(s)>>>0,a=t.slice(0,o));var i=e.uniformSizeAndIdsByName[a];if(i&&n<i[0]&&(r[n+=i[1]]=r[n]||Ve.getUniformLocation(e,t)))return n}else bt.recordError(1281);var s;return-1},Ha:(e,t,r)=>{for(var n=Ht[t],a=0;a<t;a++)n[a]=w[r+4*a>>2];Ve.invalidateFramebuffer(e,n)},$a:e=>{Ve.linkProgram(e=bt.programs[e]),e.uniformLocsById=0,e.uniformSizeAndIdsByName={}},aa:(e,t,r,n,a)=>Ve.renderbufferStorageMultisample(e,t,r,n,a),r:(e,t,r,n)=>Ve.scissor(e,t,r,n),Ea:(e,t,r,n)=>{var a=bt.getSource(e,t,r,n);Ve.shaderSource(bt.shaders[e],a)},M:(e,t,r)=>Ve.stencilFunc(e,t,r),E:(e,t,r,n)=>Ve.stencilFuncSeparate(e,t,r,n),L:(e,t,r)=>Ve.stencilOp(e,t,r),D:(e,t,r,n)=>Ve.stencilOpSeparate(e,t,r,n),ea:(e,t,r,n,a,o,i,s,u)=>{if(bt.currentContext.version>=2){if(Ve.currentPixelUnpackBufferBinding)return void Ve.texImage2D(e,t,r,n,a,o,i,s,u);if(u){var l=qt(s),c=Xt(u,l);return void Ve.texImage2D(e,t,r,n,a,o,i,s,l,c)}}var d=u?((e,t,r,n,a)=>{var o=qt(e),i=(e=>({5:3,6:4,8:2,29502:3,29504:4,26917:2,26918:2,29846:3,29847:4}[e-6402]||1))(t)*o.BYTES_PER_ELEMENT,s=((e,t,r)=>{var n;return t*(e*r+(n=bt.unpackAlignment)-1&-n)})(r,n,i);return o.subarray(Xt(a,o),Xt(a+s,o))})(s,i,n,a,u):null;Ve.texImage2D(e,t,r,n,a,o,i,s,d)},z:(e,t,r)=>Ve.texParameteri(e,t,r),Ta:(e,t)=>{Ve.uniform1f(Qt(e),t)},Ya:(e,t,r)=>{if(bt.currentContext.version>=2)t&&Ve.uniform1iv(Qt(e),w,r>>2,t);else{if(t<=288)for(var n=Kt[t],a=0;a<t;++a)n[a]=w[r+4*a>>2];else n=w.subarray(r>>2,r+4*t>>2);Ve.uniform1iv(Qt(e),n)}},Oa:(e,t,r)=>{Ve.uniformBlockBinding(e=bt.programs[e],t,r)},Za:e=>{Ve.useProgram(e=bt.programs[e]),Ve.currentProgram=e},Qa:(e,t,r,n,a,o)=>{var i=bt.currentContext.clientBuffers[e];if(!Ve.currentArrayBufferBinding)return i.size=t,i.type=r,i.normalized=n,i.stride=a,i.ptr=o,i.clientside=!0,void(i.vertexAttribPointerAdaptor=function(e,t,r,n,a,o){this.vertexAttribPointer(e,t,r,n,a,o)});i.clientside=!1,Ve.vertexAttribPointer(e,t,r,!!n,a,o)},q:(e,t,r,n)=>Ve.viewport(e,t,r,n),t:function(e,t){var r=z();try{return Pe(e)(t)}catch(e){if(W(r),e!==e+0)throw e;Or(1,0)}},j:function(e,t,r){var n=z();try{return Pe(e)(t,r)}catch(e){if(W(n),e!==e+0)throw e;Or(1,0)}},g:function(e,t,r,n){var a=z();try{return Pe(e)(t,r,n)}catch(e){if(W(a),e!==e+0)throw e;Or(1,0)}},sa:function(e,t,r,n,a,o){var i=z();try{return Pe(e)(t,r,n,a,o)}catch(e){if(W(i),e!==e+0)throw e;Or(1,0)}},R:function(e){var t=z();try{Pe(e)()}catch(e){if(W(t),e!==e+0)throw e;Or(1,0)}},b:function(e,t){var r=z();try{Pe(e)(t)}catch(e){if(W(r),e!==e+0)throw e;Or(1,0)}},c:function(e,t,r){var n=z();try{Pe(e)(t,r)}catch(e){if(W(n),e!==e+0)throw e;Or(1,0)}},n:function(e,t,r,n){var a=z();try{Pe(e)(t,r,n)}catch(e){if(W(a),e!==e+0)throw e;Or(1,0)}},B:function(e,t,r,n,a){var o=z();try{Pe(e)(t,r,n,a)}catch(e){if(W(o),e!==e+0)throw e;Or(1,0)}},rb:mt,J:function(e){var t=kt.getJsObject(e).size;return BigInt(t)},T:(e,t)=>{function r(e){var t=y[e+4>>2];if(0!==t){var r=w[e+8>>2];-1==r&&(r=void 0);var n=y[e+16>>2],a=y[e+20>>2],o=kt.makeColor(e+24);return{view:kt.getJsObject(t),depthSlice:r,resolveTarget:kt.getJsObject(y[e+12>>2]),clearValue:o,loadOp:kt.LoadOp[n],storeOp:kt.StoreOp[a]}}}function n(e,t){for(var n=[],a=0;a<e;++a)n.push(r(t+56*a));return n}function a(e){if(0!==e)return{view:kt.getJsObject(y[e+4>>2]),depthClearValue:x[e+16>>2],depthLoadOp:kt.LoadOp[y[e+8>>2]],depthStoreOp:kt.StoreOp[y[e+12>>2]],depthReadOnly:!!y[e+20>>2],stencilClearValue:y[e+32>>2],stencilLoadOp:kt.LoadOp[y[e+24>>2]],stencilStoreOp:kt.StoreOp[y[e+28>>2]],stencilReadOnly:!!y[e+36>>2]}}var o=function(e){var t=y[e>>2],r=void 0;return 0!==t&&(r=4294967296*y[t+4+8>>2]+y[t+8>>2]),{label:kt.makeStringFromOptionalStringView(e+4),colorAttachments:n(y[e+12>>2],y[e+16>>2]),depthStencilAttachment:a(y[e+20>>2]),occlusionQuerySet:kt.getJsObject(y[e+24>>2]),timestampWrites:kt.makePassTimestampWrites(y[e+28>>2]),maxDrawCount:r}}(t),i=kt.getJsObject(e),s=gr(0);return kt.Internals.jsObjectInsert(s,i.beginRenderPass(o)),s},Kb:(e,t,r,n)=>{var a=kt.getJsObject(e),o=kt.makeExtent3D(n);a.copyTextureToTexture(kt.makeTexelCopyTextureInfo(t),kt.makeTexelCopyTextureInfo(r),o)},Nb:(e,t)=>{var r=kt.getJsObject(e),n=ur(0);return kt.Internals.jsObjectInsert(n,r.finish()),n},H:(e,t)=>{function r(e){var t=y[e+8>>2],r=y[e+32>>2],n=y[e+36>>2],a=y[e+4>>2];if(t){var o=(e=>y[e>>2]+4294967296*w[e+4>>2])(e+24);return-1==o&&(o=void 0),{binding:a,resource:{buffer:kt.getJsObject(t),offset:4294967296*y[e+4+16>>2]+y[e+16>>2],size:o}}}return r?{binding:a,resource:kt.getJsObject(r)}:{binding:a,resource:kt.getJsObject(n)}}var n={label:kt.makeStringFromOptionalStringView(t+4),layout:kt.getJsObject(y[t+12>>2]),entries:function(e,t){for(var n=[],a=0;a<e;++a)n.push(r(t+40*a));return n}(y[t+16>>2],y[t+20>>2])},a=kt.getJsObject(e),o=ir(0);return kt.Internals.jsObjectInsert(o,a.createBindGroup(n)),o},u:(e,t)=>{function r(e){var t=y[e+4>>2];if(t)return{type:kt.BufferBindingType[t],hasDynamicOffset:!!y[e+8>>2],minBindingSize:4294967296*y[e+4+16>>2]+y[e+16>>2]}}function n(e){var t=y[e+4>>2];if(t)return{type:kt.SamplerBindingType[t]}}function a(e){var t=y[e+4>>2];if(t)return{sampleType:kt.TextureSampleType[t],viewDimension:kt.TextureViewDimension[y[e+8>>2]],multisampled:!!y[e+12>>2]}}function o(e){var t=y[e+4>>2];if(t)return{access:kt.StorageTextureAccess[t],format:kt.TextureFormat[y[e+8>>2]],viewDimension:kt.TextureViewDimension[y[e+12>>2]]}}function i(e){return{binding:y[e+4>>2],visibility:y[e+8>>2],buffer:r(e+24),sampler:n(e+48),texture:a(e+56),storageTexture:o(e+72)}}var s={label:kt.makeStringFromOptionalStringView(t+4),entries:function(e,t){for(var r=[],n=0;n<e;++n)r.push(i(t+88*n));return r}(y[t+12>>2],y[t+16>>2])},u=kt.getJsObject(e),l=sr(0);return kt.Internals.jsObjectInsert(l,u.createBindGroupLayout(s)),l},Ob:(e,t)=>{var r;t&&(r={label:kt.makeStringFromOptionalStringView(t+4)});var n=kt.getJsObject(e),a=lr(0);return kt.Internals.jsObjectInsert(a,n.createCommandEncoder(r)),a},Lb:(e,t)=>{for(var r=y[t+12>>2],n=y[t+16>>2],a=[],o=0;o<r;++o)a.push(kt.getJsObject(y[n+4*o>>2]));var i={label:kt.makeStringFromOptionalStringView(t+4),bindGroupLayouts:a},s=kt.getJsObject(e),u=fr(0);return kt.Internals.jsObjectInsert(u,s.createPipelineLayout(i)),u},k:(e,t)=>{var r=kt.makeRenderPipelineDesc(t),n=kt.getJsObject(e),a=_r(0);return kt.Internals.jsObjectInsert(a,n.createRenderPipeline(r)),a},Ba:(e,t)=>{var r;t&&(r={label:kt.makeStringFromOptionalStringView(t+4),addressModeU:kt.AddressMode[y[t+12>>2]],addressModeV:kt.AddressMode[y[t+16>>2]],addressModeW:kt.AddressMode[y[t+20>>2]],magFilter:kt.FilterMode[y[t+24>>2]],minFilter:kt.FilterMode[y[t+28>>2]],mipmapFilter:kt.MipmapFilterMode[y[t+32>>2]],lodMinClamp:x[t+36>>2],lodMaxClamp:x[t+40>>2],compare:kt.CompareFunction[y[t+44>>2]],maxAnisotropy:b[t+48>>1]});var n=kt.getJsObject(e),a=vr(0);return kt.Internals.jsObjectInsert(a,n.createSampler(r)),a},U:(e,t)=>{var r={label:kt.makeStringFromOptionalStringView(t+4),size:kt.makeExtent3D(t+28),mipLevelCount:y[t+44>>2],sampleCount:y[t+48>>2],dimension:kt.TextureDimension[y[t+24>>2]],format:kt.TextureFormat[y[t+40>>2]],usage:y[t+16>>2]},n=y[t+52>>2];if(n){var a=y[t+56>>2];r.viewFormats=Array.from(w.subarray(a>>2,a+4*n>>2),e=>kt.TextureFormat[e])}var o=kt.getJsObject(e),i=wr(0);return kt.Internals.jsObjectInsert(i,o.createTexture(r)),i},Cb:(e,t)=>{var r=xt(y[y[t>>2]+8>>2]).getContext("webgpu");if(!r)return 0;r.surfaceLabelWebGPU=kt.makeStringFromOptionalStringView(t+4);var n=br(0);return kt.Internals.jsObjectInsert(n,r),n},xa:(e,t,r)=>{var n=kt.getJsObject(e),a=Array.from(w.subarray(r>>2,r+4*t>>2),e=>kt.getJsObject(e));n.submit(a)},G:function(e,t,r,n,a){r=Bt(r);var o=kt.getJsObject(e),i=kt.getJsObject(t),s=_.subarray(n,n+a);o.writeBuffer(i,r,s,0,a)},ya:(e,t,r,n,a,o)=>{var i=kt.getJsObject(e),s=kt.makeTexelCopyTextureInfo(t),u=kt.makeTexelCopyBufferLayout(a),l=kt.makeExtent3D(o),c=_.subarray(r,r+n);i.writeTexture(s,c,u,l)},ta:(e,t,r,n,a,o)=>{n>>>=0,o>>>=0,kt.getJsObject(e).drawIndexed(t,r,n,a,o)},wa:e=>{kt.getJsObject(e).end()},d:(e,t,r,n,a)=>{var o=kt.getJsObject(e),i=kt.getJsObject(r);0==n?o.setBindGroup(t,i):o.setBindGroup(t,i,y,a>>2,n)},ua:function(e,t,r,n,a){n=Bt(n),a=Bt(a);var o=kt.getJsObject(e),i=kt.getJsObject(t);-1==a&&(a=void 0),o.setIndexBuffer(i,kt.IndexFormat[r],n,a)},e:(e,t)=>{var r=kt.getJsObject(e),n=kt.getJsObject(t);r.setPipeline(n)},m:(e,t,r,n,a)=>{kt.getJsObject(e).setScissorRect(t,r,n,a)},i:(e,t)=>{t>>>=0,kt.getJsObject(e).setStencilReference(t)},S:function(e,t,r,n,a){n=Bt(n),a=Bt(a);var o=kt.getJsObject(e),i=kt.getJsObject(r);-1==a&&(a=void 0),o.setVertexBuffer(t,i,n,a)},Ib:(e,t)=>{var r=y[t+4>>2],n=kt.getJsObject(e),a=[y[t+24>>2],y[t+28>>2]];0!==a[0]&&(n.canvas.width=a[0]),0!==a[1]&&(n.canvas.height=a[1]);var o={device:kt.getJsObject(r),format:kt.TextureFormat[y[t+8>>2]],usage:y[t+16>>2],alphaMode:kt.CompositeAlphaMode[y[t+40>>2]]},i=y[t+32>>2];if(i){var s=y[t+36>>2];o.viewFormats=Array.from(w.subarray(s>>2,s+4*i>>2),e=>kt.TextureFormat[e])}var u=y[t>>2];if(0!==u){var l=u;o.colorSpace=kt.PredefinedColorSpace[y[l+8>>2]],o.toneMapping={mode:kt.ToneMappingMode[y[l+12>>2]]}}n.configure(o)},Hb:(e,t)=>{var r=kt.getJsObject(e);try{var n=wr(0);kt.Internals.jsObjectInsert(n,r.getCurrentTexture()),y[t+4>>2]=n,w[t+8>>2]=1}catch(e){y[t+4>>2]=0,w[t+8>>2]=6}},Jb:e=>{kt.getJsObject(e).unconfigure()},Qb:(e,t)=>{var r;if(t){var n=y[t+24>>2],a=y[t+32>>2];r={label:kt.makeStringFromOptionalStringView(t+4),format:kt.TextureFormat[y[t+12>>2]],dimension:kt.TextureViewDimension[y[t+16>>2]],baseMipLevel:y[t+20>>2],mipLevelCount:4294967295===n?void 0:n,baseArrayLayer:y[t+28>>2],arrayLayerCount:4294967295===a?void 0:a,aspect:kt.TextureAspect[y[t+36>>2]]}}var o=kt.getJsObject(e),i=yr(0);return kt.Internals.jsObjectInsert(i,o.createView(r)),i},Pb:e=>{kt.getJsObject(e).destroy()},Rb:e=>{var t=kt.getJsObject(e);return kt.TextureFormat.indexOf(t.format)},za:e=>kt.getJsObject(e).height,V:e=>kt.getJsObject(e).width};return Gr=await async function(){function e(e,r){return function(e){nr=t._free=e.Wb,ar=t._malloc=e.Xb,or=e.Yb,t._tvg_engine_init=e.Zb,t._tvg_engine_term=e._b,t._tvg_swcanvas_create=e.$b,t._tvg_glcanvas_create=e.ac,t._tvg_wgcanvas_create=e.bc,t._tvg_canvas_destroy=e.cc,t._tvg_swcanvas_set_target=e.dc,t._tvg_canvas_add=e.ec,t._tvg_canvas_insert=e.fc,t._tvg_canvas_remove=e.gc,t._tvg_canvas_update=e.hc,t._tvg_canvas_draw=e.ic,t._tvg_canvas_sync=e.jc,t._tvg_canvas_set_viewport=e.kc,t._tvg_paint_rel=e.lc,t._tvg_paint_set_visible=e.mc,t._tvg_paint_get_visible=e.nc,t._tvg_paint_ref=e.oc,t._tvg_paint_unref=e.pc,t._tvg_paint_get_ref=e.qc,t._tvg_paint_scale=e.rc,t._tvg_paint_rotate=e.sc,t._tvg_paint_translate=e.tc,t._tvg_paint_set_transform=e.uc,t._tvg_paint_get_transform=e.vc,t._tvg_paint_duplicate=e.wc,t._tvg_paint_intersects=e.xc,t._tvg_paint_set_opacity=e.yc,t._tvg_paint_get_opacity=e.zc,t._tvg_paint_get_aabb=e.Ac,t._tvg_paint_get_obb=e.Bc,t._tvg_paint_set_mask_method=e.Cc,t._tvg_paint_set_blend_method=e.Dc,t._tvg_paint_get_type=e.Ec,t._tvg_paint_set_clip=e.Fc,t._tvg_paint_get_clip=e.Gc,t._tvg_shape_new=e.Hc,t._tvg_shape_reset=e.Ic,t._tvg_shape_move_to=e.Jc,t._tvg_shape_line_to=e.Kc,t._tvg_shape_cubic_to=e.Lc,t._tvg_shape_close=e.Mc,t._tvg_shape_append_rect=e.Nc,t._tvg_shape_append_circle=e.Oc,t._tvg_shape_append_path=e.Pc,t._tvg_shape_get_path=e.Qc,t._tvg_shape_set_stroke_width=e.Rc,t._tvg_shape_get_stroke_width=e.Sc,t._tvg_shape_set_stroke_color=e.Tc,t._tvg_shape_get_stroke_color=e.Uc,t._tvg_shape_set_stroke_gradient=e.Vc,t._tvg_shape_get_stroke_gradient=e.Wc,t._tvg_shape_set_stroke_dash=e.Xc,t._tvg_shape_get_stroke_dash=e.Yc,t._tvg_shape_set_stroke_cap=e.Zc,t._tvg_shape_get_stroke_cap=e._c,t._tvg_shape_set_stroke_join=e.$c,t._tvg_shape_get_stroke_join=e.ad,t._tvg_shape_set_stroke_miterlimit=e.bd,t._tvg_shape_set_trimpath=e.cd,t._tvg_shape_set_fill_color=e.dd,t._tvg_shape_get_fill_color=e.ed,t._tvg_shape_set_fill_rule=e.fd,t._tvg_shape_get_fill_rule=e.gd,t._tvg_shape_set_gradient=e.hd,t._tvg_shape_get_gradient=e.id,t._tvg_picture_new=e.jd,t._tvg_picture_load=e.kd,t._tvg_picture_load_raw=e.ld,t._tvg_picture_load_data=e.md,t._tvg_picture_set_size=e.nd,t._tvg_picture_get_size=e.od,t._tvg_picture_set_origin=e.pd,t._tvg_picture_get_origin=e.qd,t._tvg_linear_gradient_new=e.rd,t._tvg_radial_gradient_new=e.sd,t._tvg_gradient_del=e.td,t._tvg_linear_gradient_set=e.ud,t._tvg_linear_gradient_get=e.vd,t._tvg_radial_gradient_set=e.wd,t._tvg_radial_gradient_get=e.xd,t._tvg_gradient_set_color_stops=e.yd,t._tvg_gradient_get_color_stops=e.zd,t._tvg_gradient_set_spread=e.Ad,t._tvg_gradient_get_spread=e.Bd,t._tvg_scene_new=e.Cd,t._tvg_scene_add=e.Dd,t._tvg_scene_insert=e.Ed,t._tvg_scene_remove=e.Fd,t._tvg_scene_clear_effects=e.Gd,t._tvg_scene_add_effect_drop_shadow=e.Hd,t._tvg_scene_add_effect_gaussian_blur=e.Id,t._tvg_scene_add_effect_fill=e.Jd,t._tvg_scene_add_effect_tint=e.Kd,t._tvg_scene_add_effect_tritone=e.Ld,t._tvg_text_new=e.Md,t._tvg_text_set_font=e.Nd,t._tvg_text_set_size=e.Od,t._tvg_text_set_text=e.Pd,t._tvg_text_align=e.Qd,t._tvg_text_layout=e.Rd,t._tvg_text_set_outline=e.Sd,t._tvg_text_set_color=e.Td,t._tvg_text_set_italic=e.Ud,t._tvg_text_set_gradient=e.Vd,t._tvg_text_wrap_mode=e.Wd,t._tvg_text_spacing=e.Xd,t._tvg_font_load=e.Yd,t._tvg_font_load_data=e.Zd,t._tvg_font_unload=e._d,t._tvg_animation_new=e.$d,t._tvg_animation_set_frame=e.ae,t._tvg_animation_get_frame=e.be,t._tvg_animation_get_total_frame=e.ce,t._tvg_animation_get_picture=e.de,t._tvg_animation_get_duration=e.ee,t._tvg_animation_set_segment=e.fe,t._tvg_animation_get_segment=e.ge,t._tvg_animation_del=e.he,t._tvg_accessor_new=e.ie,t._tvg_accessor_del=e.je,t._tvg_accessor_set=e.ke,ir=e.le,sr=e.me,ur=e.ne,lr=e.oe,cr=e.pe,dr=e.qe,fr=e.re,pr=e.se,mr=e.te,hr=e.ue,gr=e.ve,_r=e.we,vr=e.xe,br=e.ye,wr=e.ze,yr=e.Ae,xr=e.Be,Er=e.Ce,kr=e.De,Sr=e.Ee,Br=e.Fe,Tr=e.Ge,Cr=e.He,Pr=e.Ie,Ar=e.Je,Fr=e.Le,Or=e.Me,jr=e.Ne,$r=e.Oe,Ir=e.Pe,Lr=e.Qe,Dr=e.Re,Mr=e.Se,Vr=e.Te,Rr=e.Ub,Wr=e.Ke}(Gr=e.exports),O(),Gr}var r,n={a:Nr};return t.instantiateWasm?new Promise((r,a)=>{t.instantiateWasm(n,(t,n)=>{r(e(t))})}):(B??(B=t.locateFile?(r="thorvg.wasm",t.locateFile?t.locateFile(r,c):c+r):new URL("thorvg.wasm",import.meta.url).href),e((await async function(e,t,r){if(!e&&!A(t)&&!a)try{var n=fetch(t,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(n,r)}catch(e){C(`wasm streaming compile failed: ${e}`),C("falling back to ArrayBuffer instantiation")}return async function(e,t){try{var r=await async function(e){if(!f)try{var t=await i(e);return new Uint8Array(t)}catch{}return function(e){if(e==B&&f)return new Uint8Array(f);if(s)return s(e);throw"both async and sync fetching of the wasm failed"}(e)}(e);return await WebAssembly.instantiate(r,t)}catch(e){C(`failed to asynchronously prepare wasm: ${e}`),j(e)}}(t,r)}(f,B,n)).instance))}(),function e(){function r(){t.calledRun=!0,P||(F=!0,t.noFSInit||Gt.initialized||Gt.init(),Gr.Vb(),Gt.ignorePermissions=!1,m?.(t),t.onRuntimeInitialized?.(),function(){if(t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;)D(t.postRun.shift());I(L)}())}Mt>0?Vt=e:(function(){if(t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)V(t.preRun.shift());I(M)}(),Mt>0?Vt=e:t.setStatus?(t.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>t.setStatus(""),1),r()},1)):r())}(),F?t:new Promise((e,t)=>{m=e,h=t})}let ye=null,xe=!1,Ee="gl";function ke(){return Ee}async function Se(e={}){if(xe)return Te();const{locateFile:t,renderer:r="gl",onError:n}=e;return Ee=r,o=n,ye=await we({locateFile:t??(e=>e)}),globalThis.__ThorVGModule=ye,xe=!0,await async function(e="gl"){if(!ye)return void s("ThorVG module not loaded. Call init() first.","initEngine");if("wg"!==e)return;let t,r=0;do{t=ye.init(),2===t&&(await new Promise(e=>setTimeout(e,100)),r++)}while(2===t&&r<50);1!==t||s("ThorVG WebGPU initialization failed","initEngine")}(r),Te()}function Be(){xe&&ye&&(ye.term(),globalThis.__ThorVGModule&&delete globalThis.__ThorVGModule,ye=null,xe=!1)}function Te(){return{Canvas:L,Shape:M,Scene:y,Picture:Q,Text:K,Animation:me,LinearGradient:ge,RadialGradient:_e,Font:ve,BlendMethod:V,StrokeCap:R,StrokeJoin:W,FillRule:z,GradientSpread:U,CompositeMethod:G,MaskMethod:N,SceneEffect:J,TextWrapMode:H,ColorSpace:q,term:Be}}const Ce={init:Se};export{me as Animation,L as Canvas,ve as Font,ge as LinearGradient,Q as Picture,_e as RadialGradient,y as Scene,M as Shape,K as Text,a as ThorVGError,n as ThorVGResultCode,X as constants,Ce as default,ke as getGlobalRenderer,Se as init};
2
+ //# sourceMappingURL=webcanvas.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webcanvas.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}