UNPKG

canvaskit-wasm

Version:

A WASM version of Skia's Canvas API

106 lines (105 loc) 121 kB
var CanvasKitInit = (() => { var _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined; if (typeof __filename != 'undefined') _scriptName = _scriptName || __filename; return ( async function(moduleArg = {}) { var moduleRtn; var u=moduleArg,da,ha,ka=new Promise((a,b)=>{da=a;ha=b}),na="object"==typeof window,oa="undefined"!=typeof WorkerGlobalScope,pa="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&"renderer"!=process.type; (function(a){a.Pd=a.Pd||[];a.Pd.push(function(){a.MakeSWCanvasSurface=function(b){var d=b,f="undefined"!==typeof OffscreenCanvas&&d instanceof OffscreenCanvas;if(!("undefined"!==typeof HTMLCanvasElement&&d instanceof HTMLCanvasElement||f||(d=document.getElementById(b),d)))throw"Canvas with id "+b+" was not found";if(b=a.MakeSurface(d.width,d.height))b.Hd=d;return b};a.MakeCanvasSurface||(a.MakeCanvasSurface=a.MakeSWCanvasSurface);a.MakeSurface=function(b,d){var f={width:b,height:d,colorType:a.ColorType.RGBA_8888, alphaType:a.AlphaType.Unpremul,colorSpace:a.ColorSpace.SRGB},h=b*d*4,n=a._malloc(h);if(f=a.Surface._makeRasterDirect(f,n,4*b))f.Hd=null,f.tf=b,f.pf=d,f.rf=h,f.Te=n,f.getCanvas().clear(a.TRANSPARENT);return f};a.MakeRasterDirectSurface=function(b,d,f){return a.Surface._makeRasterDirect(b,d.byteOffset,f)};a.Surface.prototype.flush=function(b){a.Id(this.Gd);this._flush();if(this.Hd){var d=new Uint8ClampedArray(a.HEAPU8.buffer,this.Te,this.rf);d=new ImageData(d,this.tf,this.pf);b?this.Hd.getContext("2d").putImageData(d, 0,0,b[0],b[1],b[2]-b[0],b[3]-b[1]):this.Hd.getContext("2d").putImageData(d,0,0)}};a.Surface.prototype.dispose=function(){this.Te&&a._free(this.Te);this.delete()};a.Id=a.Id||function(){};a.Ne=a.Ne||function(){return null}})})(u); (function(a){a.Pd=a.Pd||[];a.Pd.push(function(){function b(m,q,w){return m&&m.hasOwnProperty(q)?m[q]:w}function d(m){var q=qa(ra);ra[q]=m;return q}function f(m){return m.naturalHeight||m.videoHeight||m.displayHeight||m.height}function h(m){return m.naturalWidth||m.videoWidth||m.displayWidth||m.width}function n(m,q,w,D){m.bindTexture(m.TEXTURE_2D,q);D||w.alphaType!==a.AlphaType.Premul||m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);return q}function v(m,q,w){w||q.alphaType!==a.AlphaType.Premul|| m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1);m.bindTexture(m.TEXTURE_2D,null)}a.GetWebGLContext=function(m,q){if(!m)throw"null canvas passed into makeWebGLContext";var w={alpha:b(q,"alpha",1),depth:b(q,"depth",1),stencil:b(q,"stencil",8),antialias:b(q,"antialias",0),premultipliedAlpha:b(q,"premultipliedAlpha",1),preserveDrawingBuffer:b(q,"preserveDrawingBuffer",0),preferLowPowerToHighPerformance:b(q,"preferLowPowerToHighPerformance",0),failIfMajorPerformanceCaveat:b(q,"failIfMajorPerformanceCaveat", 0),enableExtensionsByDefault:b(q,"enableExtensionsByDefault",1),explicitSwapControl:b(q,"explicitSwapControl",0),renderViaOffscreenBackBuffer:b(q,"renderViaOffscreenBackBuffer",0)};w.majorVersion=q&&q.majorVersion?q.majorVersion:"undefined"!==typeof WebGL2RenderingContext?2:1;if(w.explicitSwapControl)throw"explicitSwapControl is not supported";m=sa(m,w);if(!m)return 0;ta(m);I.ce.getExtension("WEBGL_debug_renderer_info");return m};a.deleteContext=function(m){I===za[m]&&(I=null);"object"==typeof JSEvents&& JSEvents.bg(za[m].ce.canvas);za[m]?.ce.canvas&&(za[m].ce.canvas.mf=void 0);za[m]=null};a._setTextureCleanup({deleteTexture:function(m,q){var w=ra[q];w&&za[m].ce.deleteTexture(w);ra[q]=null}});a.MakeWebGLContext=function(m){if(!this.Id(m))return null;var q=this._MakeGrContext();if(!q)return null;q.Gd=m;var w=q.delete.bind(q);q["delete"]=function(){a.Id(this.Gd);w()}.bind(q);return I.Xe=q};a.MakeGrContext=a.MakeWebGLContext;a.GrDirectContext.prototype.getResourceCacheLimitBytes=function(){a.Id(this.Gd); this._getResourceCacheLimitBytes()};a.GrDirectContext.prototype.getResourceCacheUsageBytes=function(){a.Id(this.Gd);this._getResourceCacheUsageBytes()};a.GrDirectContext.prototype.releaseResourcesAndAbandonContext=function(){a.Id(this.Gd);this._releaseResourcesAndAbandonContext()};a.GrDirectContext.prototype.setResourceCacheLimitBytes=function(m){a.Id(this.Gd);this._setResourceCacheLimitBytes(m)};a.MakeOnScreenGLSurface=function(m,q,w,D,G,K){if(!this.Id(m.Gd))return null;q=void 0===G||void 0===K? this._MakeOnScreenGLSurface(m,q,w,D):this._MakeOnScreenGLSurface(m,q,w,D,G,K);if(!q)return null;q.Gd=m.Gd;return q};a.MakeRenderTarget=function(){var m=arguments[0];if(!this.Id(m.Gd))return null;if(3===arguments.length){var q=this._MakeRenderTargetWH(m,arguments[1],arguments[2]);if(!q)return null}else if(2===arguments.length){if(q=this._MakeRenderTargetII(m,arguments[1]),!q)return null}else return null;q.Gd=m.Gd;return q};a.MakeWebGLCanvasSurface=function(m,q,w){q=q||null;var D=m,G="undefined"!== typeof OffscreenCanvas&&D instanceof OffscreenCanvas;if(!("undefined"!==typeof HTMLCanvasElement&&D instanceof HTMLCanvasElement||G||(D=document.getElementById(m),D)))throw"Canvas with id "+m+" was not found";m=this.GetWebGLContext(D,w);if(!m||0>m)throw"failed to create webgl context: err "+m;m=this.MakeWebGLContext(m);q=this.MakeOnScreenGLSurface(m,D.width,D.height,q);return q?q:(q=D.cloneNode(!0),D.parentNode.replaceChild(q,D),q.classList.add("ck-replaced"),a.MakeSWCanvasSurface(q))};a.MakeCanvasSurface= a.MakeWebGLCanvasSurface;a.Surface.prototype.makeImageFromTexture=function(m,q){a.Id(this.Gd);m=d(m);if(q=this._makeImageFromTexture(this.Gd,m,q))q.Ee=m;return q};a.Surface.prototype.makeImageFromTextureSource=function(m,q,w){q||={height:f(m),width:h(m),colorType:a.ColorType.RGBA_8888,alphaType:w?a.AlphaType.Premul:a.AlphaType.Unpremul};q.colorSpace||(q.colorSpace=a.ColorSpace.SRGB);a.Id(this.Gd);var D=I.ce;w=n(D,D.createTexture(),q,w);2===I.version?D.texImage2D(D.TEXTURE_2D,0,D.RGBA,q.width,q.height, 0,D.RGBA,D.UNSIGNED_BYTE,m):D.texImage2D(D.TEXTURE_2D,0,D.RGBA,D.RGBA,D.UNSIGNED_BYTE,m);v(D,q);this._resetContext();return this.makeImageFromTexture(w,q)};a.Surface.prototype.updateTextureFromSource=function(m,q,w){if(m.Ee){a.Id(this.Gd);var D=m.getImageInfo(),G=I.ce,K=n(G,ra[m.Ee],D,w);2===I.version?G.texImage2D(G.TEXTURE_2D,0,G.RGBA,h(q),f(q),0,G.RGBA,G.UNSIGNED_BYTE,q):G.texImage2D(G.TEXTURE_2D,0,G.RGBA,G.RGBA,G.UNSIGNED_BYTE,q);v(G,D,w);this._resetContext();ra[m.Ee]=null;m.Ee=d(K);D.colorSpace= m.getColorSpace();q=this._makeImageFromTexture(this.Gd,m.Ee,D);w=m.Fd.Md;G=m.Fd.Rd;m.Fd.Md=q.Fd.Md;m.Fd.Rd=q.Fd.Rd;q.Fd.Md=w;q.Fd.Rd=G;q.delete();D.colorSpace.delete()}};a.MakeLazyImageFromTextureSource=function(m,q,w){q||={height:f(m),width:h(m),colorType:a.ColorType.RGBA_8888,alphaType:w?a.AlphaType.Premul:a.AlphaType.Unpremul};q.colorSpace||(q.colorSpace=a.ColorSpace.SRGB);var D={makeTexture:function(){var G=I,K=G.ce,Y=n(K,K.createTexture(),q,w);2===G.version?K.texImage2D(K.TEXTURE_2D,0,K.RGBA, q.width,q.height,0,K.RGBA,K.UNSIGNED_BYTE,m):K.texImage2D(K.TEXTURE_2D,0,K.RGBA,K.RGBA,K.UNSIGNED_BYTE,m);v(K,q,w);return d(Y)},freeSrc:function(){}};"VideoFrame"===m.constructor.name&&(D.freeSrc=function(){m.close()});return a.Image._makeFromGenerator(q,D)};a.Id=function(m){return m?ta(m):!1};a.Ne=function(){return I&&I.Xe&&!I.Xe.isDeleted()?I.Xe:null}})})(u); (function(a){function b(e,c,g,l,t){for(var x=0;x<e.length;x++)c[x*g+(x*t+l+g)%g]=e[x];return c}function d(e){for(var c=e*e,g=Array(c);c--;)g[c]=0===c%(e+1)?1:0;return g}function f(e){return e?e.constructor===Float32Array&&4===e.length:!1}function h(e){return(m(255*e[3])<<24|m(255*e[0])<<16|m(255*e[1])<<8|m(255*e[2])<<0)>>>0}function n(e){if(e&&e._ck)return e;if(e instanceof Float32Array){for(var c=Math.floor(e.length/4),g=new Uint32Array(c),l=0;l<c;l++)g[l]=h(e.slice(4*l,4*(l+1)));return g}if(e instanceof Uint32Array)return e;if(e instanceof Array&&e[0]instanceof Float32Array)return e.map(h)}function v(e){if(void 0===e)return 1;var c=parseFloat(e);return e&&-1!==e.indexOf("%")?c/100:c}function m(e){return Math.round(Math.max(0,Math.min(e||0,255)))}function q(e,c){c&&c._ck||a._free(e)}function w(e,c,g){if(!e||!e.length)return Q;if(e&&e._ck)return e.byteOffset;var l=a[c].BYTES_PER_ELEMENT;g||=a._malloc(e.length*l);a[c].set(e,g/l);return g}function D(e){var c={Zd:Q,count:e.length,colorType:a.ColorType.RGBA_F32}; if(e instanceof Float32Array)c.Zd=w(e,"HEAPF32"),c.count=e.length/4;else if(e instanceof Uint32Array)c.Zd=w(e,"HEAPU32"),c.colorType=a.ColorType.RGBA_8888;else if(e instanceof Array){if(e&&e.length){for(var g=a._malloc(16*e.length),l=0,t=g/4,x=0;x<e.length;x++)for(var A=0;4>A;A++)a.HEAPF32[t+l]=e[x][A],l++;e=g}else e=Q;c.Zd=e}else throw"Invalid argument to copyFlexibleColorArray, Not a color array "+typeof e;return c}function G(e){if(!e)return Q;var c=Mb.toTypedArray();if(e.length){if(6===e.length|| 9===e.length)return w(e,"HEAPF32",xa),6===e.length&&a.HEAPF32.set(jd,6+xa/4),xa;if(16===e.length)return c[0]=e[0],c[1]=e[1],c[2]=e[3],c[3]=e[4],c[4]=e[5],c[5]=e[7],c[6]=e[12],c[7]=e[13],c[8]=e[15],xa;throw"invalid matrix size";}if(void 0===e.m11)throw"invalid matrix argument";c[0]=e.m11;c[1]=e.m21;c[2]=e.m41;c[3]=e.m12;c[4]=e.m22;c[5]=e.m42;c[6]=e.m14;c[7]=e.m24;c[8]=e.m44;return xa}function K(e){if(!e)return Q;var c=Nb.toTypedArray();if(e.length){if(16!==e.length&&6!==e.length&&9!==e.length)throw"invalid matrix size"; if(16===e.length)return w(e,"HEAPF32",Za);c.fill(0);c[0]=e[0];c[1]=e[1];c[3]=e[2];c[4]=e[3];c[5]=e[4];c[7]=e[5];c[10]=1;c[12]=e[6];c[13]=e[7];c[15]=e[8];6===e.length&&(c[12]=0,c[13]=0,c[15]=1);return Za}if(void 0===e.m11)throw"invalid matrix argument";c[0]=e.m11;c[1]=e.m21;c[2]=e.m31;c[3]=e.m41;c[4]=e.m12;c[5]=e.m22;c[6]=e.m32;c[7]=e.m42;c[8]=e.m13;c[9]=e.m23;c[10]=e.m33;c[11]=e.m43;c[12]=e.m14;c[13]=e.m24;c[14]=e.m34;c[15]=e.m44;return Za}function Y(e,c){return w(e,"HEAPF32",c||Qa)}function ea(e, c,g,l){var t=Ob.toTypedArray();t[0]=e;t[1]=c;t[2]=g;t[3]=l;return Qa}function fa(e){for(var c=new Float32Array(4),g=0;4>g;g++)c[g]=a.HEAPF32[e/4+g];return c}function S(e,c){return w(e,"HEAPF32",c||ia)}function ya(e,c){return w(e,"HEAPF32",c||Pb)}function ma(){for(var e=0,c=0;c<arguments.length-1;c+=2)e+=arguments[c]*arguments[c+1];return e}function Ma(e,c,g){for(var l=Array(e.length),t=0;t<g;t++)for(var x=0;x<g;x++){for(var A=0,H=0;H<g;H++)A+=e[g*t+H]*c[g*H+x];l[t*g+x]=A}return l}function $a(e,c){for(var g= Ma(c[0],c[1],e),l=2;l<c.length;)g=Ma(g,c[l],e),l++;return g}a.Color=function(e,c,g,l){void 0===l&&(l=1);return a.Color4f(m(e)/255,m(c)/255,m(g)/255,l)};a.ColorAsInt=function(e,c,g,l){void 0===l&&(l=255);return(m(l)<<24|m(e)<<16|m(c)<<8|m(g)<<0&268435455)>>>0};a.Color4f=function(e,c,g,l){void 0===l&&(l=1);return Float32Array.of(e,c,g,l)};Object.defineProperty(a,"TRANSPARENT",{get:function(){return a.Color4f(0,0,0,0)}});Object.defineProperty(a,"BLACK",{get:function(){return a.Color4f(0,0,0,1)}});Object.defineProperty(a, "WHITE",{get:function(){return a.Color4f(1,1,1,1)}});Object.defineProperty(a,"RED",{get:function(){return a.Color4f(1,0,0,1)}});Object.defineProperty(a,"GREEN",{get:function(){return a.Color4f(0,1,0,1)}});Object.defineProperty(a,"BLUE",{get:function(){return a.Color4f(0,0,1,1)}});Object.defineProperty(a,"YELLOW",{get:function(){return a.Color4f(1,1,0,1)}});Object.defineProperty(a,"CYAN",{get:function(){return a.Color4f(0,1,1,1)}});Object.defineProperty(a,"MAGENTA",{get:function(){return a.Color4f(1, 0,1,1)}});a.getColorComponents=function(e){return[Math.floor(255*e[0]),Math.floor(255*e[1]),Math.floor(255*e[2]),e[3]]};a.parseColorString=function(e,c){e=e.toLowerCase();if(e.startsWith("#")){c=255;switch(e.length){case 9:c=parseInt(e.slice(7,9),16);case 7:var g=parseInt(e.slice(1,3),16);var l=parseInt(e.slice(3,5),16);var t=parseInt(e.slice(5,7),16);break;case 5:c=17*parseInt(e.slice(4,5),16);case 4:g=17*parseInt(e.slice(1,2),16),l=17*parseInt(e.slice(2,3),16),t=17*parseInt(e.slice(3,4),16)}return a.Color(g, l,t,c/255)}return e.startsWith("rgba")?(e=e.slice(5,-1),e=e.split(","),a.Color(+e[0],+e[1],+e[2],v(e[3]))):e.startsWith("rgb")?(e=e.slice(4,-1),e=e.split(","),a.Color(+e[0],+e[1],+e[2],v(e[3]))):e.startsWith("gray(")||e.startsWith("hsl")||!c||(e=c[e],void 0===e)?a.BLACK:e};a.multiplyByAlpha=function(e,c){e=e.slice();e[3]=Math.max(0,Math.min(e[3]*c,1));return e};a.Malloc=function(e,c){var g=a._malloc(c*e.BYTES_PER_ELEMENT);return{_ck:!0,length:c,byteOffset:g,me:null,subarray:function(l,t){l=this.toTypedArray().subarray(l, t);l._ck=!0;return l},toTypedArray:function(){if(this.me&&this.me.length)return this.me;this.me=new e(a.HEAPU8.buffer,g,c);this.me._ck=!0;return this.me}}};a.Free=function(e){a._free(e.byteOffset);e.byteOffset=Q;e.toTypedArray=null;e.me=null};var xa=Q,Mb,Za=Q,Nb,Qa=Q,Ob,ua,ia=Q,nc,Na=Q,oc,Qb=Q,pc,Rb=Q,ob,db=Q,qc,Pb=Q,rc,sc=Q,jd=Float32Array.of(0,0,1),Q=0;a.onRuntimeInitialized=function(){function e(c,g,l,t,x,A,H){A||(A=4*t.width,t.colorType===a.ColorType.RGBA_F16?A*=2:t.colorType===a.ColorType.RGBA_F32&& (A*=4));var L=A*t.height;var M=x?x.byteOffset:a._malloc(L);if(H?!c._readPixels(t,M,A,g,l,H):!c._readPixels(t,M,A,g,l))return x||a._free(M),null;if(x)return x.toTypedArray();switch(t.colorType){case a.ColorType.RGBA_8888:case a.ColorType.RGBA_F16:c=(new Uint8Array(a.HEAPU8.buffer,M,L)).slice();break;case a.ColorType.RGBA_F32:c=(new Float32Array(a.HEAPU8.buffer,M,L)).slice();break;default:return null}a._free(M);return c}Ob=a.Malloc(Float32Array,4);Qa=Ob.byteOffset;Nb=a.Malloc(Float32Array,16);Za=Nb.byteOffset; Mb=a.Malloc(Float32Array,9);xa=Mb.byteOffset;qc=a.Malloc(Float32Array,12);Pb=qc.byteOffset;rc=a.Malloc(Float32Array,12);sc=rc.byteOffset;ua=a.Malloc(Float32Array,4);ia=ua.byteOffset;nc=a.Malloc(Float32Array,4);Na=nc.byteOffset;oc=a.Malloc(Float32Array,3);Qb=oc.byteOffset;pc=a.Malloc(Float32Array,3);Rb=pc.byteOffset;ob=a.Malloc(Int32Array,4);db=ob.byteOffset;a.ColorSpace.SRGB=a.ColorSpace._MakeSRGB();a.ColorSpace.DISPLAY_P3=a.ColorSpace._MakeDisplayP3();a.ColorSpace.ADOBE_RGB=a.ColorSpace._MakeAdobeRGB(); a.GlyphRunFlags={IsWhiteSpace:a._GlyphRunFlags_isWhiteSpace};a.Path.MakeFromCmds=function(c){var g=w(c,"HEAPF32"),l=a.Path._MakeFromCmds(g,c.length);q(g,c);return l};a.Path.MakeFromVerbsPointsWeights=function(c,g,l){var t=w(c,"HEAPU8"),x=w(g,"HEAPF32"),A=w(l,"HEAPF32"),H=a.Path._MakeFromVerbsPointsWeights(t,c.length,x,g.length/2,A,l&&l.length||0);q(t,c);q(x,g);q(A,l);return H};a.PathBuilder.prototype.addArc=function(c,g,l){c=S(c);this._addArc(c,g,l);return this};a.PathBuilder.prototype.addCircle= function(c,g,l,t){this._addCircle(c,g,l,!!t);return this};a.PathBuilder.prototype.addOval=function(c,g,l){void 0===l&&(l=1);c=S(c);this._addOval(c,!!g,l);return this};a.PathBuilder.prototype.addPath=function(){var c=Array.prototype.slice.call(arguments),g=c[0],l=!1;"boolean"===typeof c[c.length-1]&&(l=c.pop());if(1===c.length)this._addPath(g,1,0,0,0,1,0,0,0,1,l);else if(2===c.length)c=c[1],this._addPath(g,c[0],c[1],c[2],c[3],c[4],c[5],c[6]||0,c[7]||0,c[8]||1,l);else if(7===c.length||10===c.length)this._addPath(g, c[1],c[2],c[3],c[4],c[5],c[6],c[7]||0,c[8]||0,c[9]||1,l);else return null;return this};a.PathBuilder.prototype.addPolygon=function(c,g){var l=w(c,"HEAPF32");this._addPolygon(l,c.length/2,g);q(l,c);return this};a.PathBuilder.prototype.addRect=function(c,g){c=S(c);this._addRect(c,!!g);return this};a.PathBuilder.prototype.addRRect=function(c,g){c=ya(c);this._addRRect(c,!!g);return this};a.PathBuilder.prototype.addVerbsPointsWeights=function(c,g,l){var t=w(c,"HEAPU8"),x=w(g,"HEAPF32"),A=w(l,"HEAPF32"); this._addVerbsPointsWeights(t,c.length,x,g.length/2,A,l&&l.length||0);q(t,c);q(x,g);q(A,l);return this};a.PathBuilder.prototype.arc=function(c,g,l,t,x,A){c=a.LTRBRect(c-l,g-l,c+l,g+l);x=(x-t)/Math.PI*180-360*!!A;t=(new a.PathBuilder).addArc(c,t/Math.PI*180,x).detachAndDelete();this.addPath(t,!0);t.delete();return this};a.PathBuilder.prototype.arcToOval=function(c,g,l,t){c=S(c);this._arcToOval(c,g,l,t);return this};a.PathBuilder.prototype.arcToRotated=function(c,g,l,t,x,A,H){this._arcToRotated(c,g, l,!!t,!!x,A,H);return this};a.PathBuilder.prototype.arcToTangent=function(c,g,l,t,x){this._arcToTangent(c,g,l,t,x);return this};a.PathBuilder.prototype.close=function(){this._close();return this};a.PathBuilder.prototype.conicTo=function(c,g,l,t,x){this._conicTo(c,g,l,t,x);return this};a.Path.prototype.computeTightBounds=function(c){this._computeTightBounds(ia);var g=ua.toTypedArray();return c?(c.set(g),c):g.slice()};a.PathBuilder.prototype.cubicTo=function(c,g,l,t,x,A){this._cubicTo(c,g,l,t,x,A); return this};a.PathBuilder.prototype.detachAndDelete=function(){var c=this.detach();this.delete();return c};a.Path.prototype.getBounds=function(c){this._getBounds(ia);var g=ua.toTypedArray();return c?(c.set(g),c):g.slice()};a.PathBuilder.prototype.getBounds=function(c){this._getBounds(ia);var g=ua.toTypedArray();return c?(c.set(g),c):g.slice()};a.PathBuilder.prototype.lineTo=function(c,g){this._lineTo(c,g);return this};a.PathBuilder.prototype.moveTo=function(c,g){this._moveTo(c,g);return this};a.PathBuilder.prototype.offset= function(c,g){this._transform(1,0,c,0,1,g,0,0,1);return this};a.PathBuilder.prototype.quadTo=function(c,g,l,t){this._quadTo(c,g,l,t);return this};a.PathBuilder.prototype.rArcTo=function(c,g,l,t,x,A,H){this._rArcTo(c,g,l,t,x,A,H);return this};a.PathBuilder.prototype.rConicTo=function(c,g,l,t,x){this._rConicTo(c,g,l,t,x);return this};a.PathBuilder.prototype.rCubicTo=function(c,g,l,t,x,A){this._rCubicTo(c,g,l,t,x,A);return this};a.PathBuilder.prototype.rLineTo=function(c,g){this._rLineTo(c,g);return this}; a.PathBuilder.prototype.rMoveTo=function(c,g){this._rMoveTo(c,g);return this};a.PathBuilder.prototype.rQuadTo=function(c,g,l,t){this._rQuadTo(c,g,l,t);return this};a.Path.prototype.makeStroked=function(c){c=c||{};c.width=c.width||1;c.miter_limit=c.miter_limit||4;c.cap=c.cap||a.StrokeCap.Butt;c.join=c.join||a.StrokeJoin.Miter;c.precision=c.precision||1;return this._makeStroked(c)};a.PathBuilder.prototype.transform=function(){if(1===arguments.length){var c=arguments[0];this._transform(c[0],c[1],c[2], c[3],c[4],c[5],c[6]||0,c[7]||0,c[8]||1)}else if(6===arguments.length||9===arguments.length)c=arguments,this._transform(c[0],c[1],c[2],c[3],c[4],c[5],c[6]||0,c[7]||0,c[8]||1);else throw"transform expected to take 1 or 9 arguments. Got "+arguments.length;return this};a.Path.prototype.makeTrimmed=function(c,g,l){return this._makeTrimmed(c,g,!!l)};a.Image.prototype.encodeToBytes=function(c,g){var l=a.Ne();c=c||a.ImageFormat.PNG;g=g||100;return l?this._encodeToBytes(c,g,l):this._encodeToBytes(c,g)};a.Image.prototype.makeShaderCubic= function(c,g,l,t,x){x=G(x);return this._makeShaderCubic(c,g,l,t,x)};a.Image.prototype.makeShaderOptions=function(c,g,l,t,x){x=G(x);return this._makeShaderOptions(c,g,l,t,x)};a.Image.prototype.readPixels=function(c,g,l,t,x){var A=a.Ne();return e(this,c,g,l,t,x,A)};a.Canvas.prototype.clear=function(c){a.Id(this.Gd);c=Y(c);this._clear(c)};a.Canvas.prototype.clipRRect=function(c,g,l){a.Id(this.Gd);c=ya(c);this._clipRRect(c,g,l)};a.Canvas.prototype.clipRect=function(c,g,l){a.Id(this.Gd);c=S(c);this._clipRect(c, g,l)};a.Canvas.prototype.concat=function(c){a.Id(this.Gd);c=K(c);this._concat(c)};a.Canvas.prototype.drawArc=function(c,g,l,t,x){a.Id(this.Gd);c=S(c);this._drawArc(c,g,l,t,x)};a.Canvas.prototype.drawAtlas=function(c,g,l,t,x,A,H){if(c&&t&&g&&l&&g.length===l.length){a.Id(this.Gd);x||(x=a.BlendMode.SrcOver);var L=w(g,"HEAPF32"),M=w(l,"HEAPF32"),V=l.length/4,X=w(n(A),"HEAPU32");if(H&&"B"in H&&"C"in H)this._drawAtlasCubic(c,M,L,X,V,x,H.B,H.C,t);else{let r=a.FilterMode.Linear,C=a.MipmapMode.None;H&&(r= H.filter,"mipmap"in H&&(C=H.mipmap));this._drawAtlasOptions(c,M,L,X,V,x,r,C,t)}q(L,g);q(M,l);q(X,A)}};a.Canvas.prototype.drawCircle=function(c,g,l,t){a.Id(this.Gd);this._drawCircle(c,g,l,t)};a.Canvas.prototype.drawColor=function(c,g){a.Id(this.Gd);c=Y(c);void 0!==g?this._drawColor(c,g):this._drawColor(c)};a.Canvas.prototype.drawColorInt=function(c,g){a.Id(this.Gd);this._drawColorInt(c,g||a.BlendMode.SrcOver)};a.Canvas.prototype.drawColorComponents=function(c,g,l,t,x){a.Id(this.Gd);c=ea(c,g,l,t);void 0!== x?this._drawColor(c,x):this._drawColor(c)};a.Canvas.prototype.drawDRRect=function(c,g,l){a.Id(this.Gd);c=ya(c,Pb);g=ya(g,sc);this._drawDRRect(c,g,l)};a.Canvas.prototype.drawImage=function(c,g,l,t){a.Id(this.Gd);this._drawImage(c,g,l,t||null)};a.Canvas.prototype.drawImageCubic=function(c,g,l,t,x,A){a.Id(this.Gd);this._drawImageCubic(c,g,l,t,x,A||null)};a.Canvas.prototype.drawImageOptions=function(c,g,l,t,x,A){a.Id(this.Gd);this._drawImageOptions(c,g,l,t,x,A||null)};a.Canvas.prototype.drawImageNine= function(c,g,l,t,x){a.Id(this.Gd);g=w(g,"HEAP32",db);l=S(l);this._drawImageNine(c,g,l,t,x||null)};a.Canvas.prototype.drawImageRect=function(c,g,l,t,x){a.Id(this.Gd);S(g,ia);S(l,Na);this._drawImageRect(c,ia,Na,t,!!x)};a.Canvas.prototype.drawImageRectCubic=function(c,g,l,t,x,A){a.Id(this.Gd);S(g,ia);S(l,Na);this._drawImageRectCubic(c,ia,Na,t,x,A||null)};a.Canvas.prototype.drawImageRectOptions=function(c,g,l,t,x,A){a.Id(this.Gd);S(g,ia);S(l,Na);this._drawImageRectOptions(c,ia,Na,t,x,A||null)};a.Canvas.prototype.drawLine= function(c,g,l,t,x){a.Id(this.Gd);this._drawLine(c,g,l,t,x)};a.Canvas.prototype.drawOval=function(c,g){a.Id(this.Gd);c=S(c);this._drawOval(c,g)};a.Canvas.prototype.drawPaint=function(c){a.Id(this.Gd);this._drawPaint(c)};a.Canvas.prototype.drawParagraph=function(c,g,l){a.Id(this.Gd);this._drawParagraph(c,g,l)};a.Canvas.prototype.drawPatch=function(c,g,l,t,x){if(24>c.length)throw"Need 12 cubic points";if(g&&4>g.length)throw"Need 4 colors";if(l&&8>l.length)throw"Need 4 shader coordinates";a.Id(this.Gd); const A=w(c,"HEAPF32"),H=g?w(n(g),"HEAPU32"):Q,L=l?w(l,"HEAPF32"):Q;t||(t=a.BlendMode.Modulate);this._drawPatch(A,H,L,t,x);q(L,l);q(H,g);q(A,c)};a.Canvas.prototype.drawPath=function(c,g){a.Id(this.Gd);this._drawPath(c,g)};a.Canvas.prototype.drawPicture=function(c){a.Id(this.Gd);this._drawPicture(c)};a.Canvas.prototype.drawPoints=function(c,g,l){a.Id(this.Gd);var t=w(g,"HEAPF32");this._drawPoints(c,t,g.length/2,l);q(t,g)};a.Canvas.prototype.drawRRect=function(c,g){a.Id(this.Gd);c=ya(c);this._drawRRect(c, g)};a.Canvas.prototype.drawRect=function(c,g){a.Id(this.Gd);c=S(c);this._drawRect(c,g)};a.Canvas.prototype.drawRect4f=function(c,g,l,t,x){a.Id(this.Gd);this._drawRect4f(c,g,l,t,x)};a.Canvas.prototype.drawShadow=function(c,g,l,t,x,A,H){a.Id(this.Gd);var L=w(x,"HEAPF32"),M=w(A,"HEAPF32");g=w(g,"HEAPF32",Qb);l=w(l,"HEAPF32",Rb);this._drawShadow(c,g,l,t,L,M,H);q(L,x);q(M,A)};a.getShadowLocalBounds=function(c,g,l,t,x,A,H){c=G(c);l=w(l,"HEAPF32",Qb);t=w(t,"HEAPF32",Rb);if(!this._getShadowLocalBounds(c, g,l,t,x,A,ia))return null;g=ua.toTypedArray();return H?(H.set(g),H):g.slice()};a.Canvas.prototype.drawTextBlob=function(c,g,l,t){a.Id(this.Gd);this._drawTextBlob(c,g,l,t)};a.Canvas.prototype.drawVertices=function(c,g,l){a.Id(this.Gd);this._drawVertices(c,g,l)};a.Canvas.prototype.getDeviceClipBounds=function(c){this._getDeviceClipBounds(db);var g=ob.toTypedArray();c?c.set(g):c=g.slice();return c};a.Canvas.prototype.quickReject=function(c){c=S(c);return this._quickReject(c)};a.Canvas.prototype.getLocalToDevice= function(){this._getLocalToDevice(Za);for(var c=Za,g=Array(16),l=0;16>l;l++)g[l]=a.HEAPF32[c/4+l];return g};a.Canvas.prototype.getTotalMatrix=function(){this._getTotalMatrix(xa);for(var c=Array(9),g=0;9>g;g++)c[g]=a.HEAPF32[xa/4+g];return c};a.Canvas.prototype.makeSurface=function(c){c=this._makeSurface(c);c.Gd=this.Gd;return c};a.Canvas.prototype.readPixels=function(c,g,l,t,x){a.Id(this.Gd);return e(this,c,g,l,t,x)};a.Canvas.prototype.saveLayer=function(c,g,l,t,x){g=S(g);return this._saveLayer(c|| null,g,l||null,t||0,x||a.TileMode.Clamp)};a.Canvas.prototype.writePixels=function(c,g,l,t,x,A,H,L){if(c.byteLength%(g*l))throw"pixels length must be a multiple of the srcWidth * srcHeight";a.Id(this.Gd);var M=c.byteLength/(g*l);A=A||a.AlphaType.Unpremul;H=H||a.ColorType.RGBA_8888;L=L||a.ColorSpace.SRGB;var V=M*g;M=w(c,"HEAPU8");g=this._writePixels({width:g,height:l,colorType:H,alphaType:A,colorSpace:L},M,V,t,x);q(M,c);return g};a.ColorFilter.MakeBlend=function(c,g,l){c=Y(c);l=l||a.ColorSpace.SRGB; return a.ColorFilter._MakeBlend(c,g,l)};a.ColorFilter.MakeMatrix=function(c){if(!c||20!==c.length)throw"invalid color matrix";var g=w(c,"HEAPF32"),l=a.ColorFilter._makeMatrix(g);q(g,c);return l};a.ContourMeasure.prototype.getPosTan=function(c,g){this._getPosTan(c,ia);c=ua.toTypedArray();return g?(g.set(c),g):c.slice()};a.ImageFilter.prototype.getOutputBounds=function(c,g,l){c=S(c,ia);g=G(g);this._getOutputBounds(c,g,db);g=ob.toTypedArray();return l?(l.set(g),l):g.slice()};a.ImageFilter.MakeDropShadow= function(c,g,l,t,x,A){x=Y(x,Qa);return a.ImageFilter._MakeDropShadow(c,g,l,t,x,A)};a.ImageFilter.MakeDropShadowOnly=function(c,g,l,t,x,A){x=Y(x,Qa);return a.ImageFilter._MakeDropShadowOnly(c,g,l,t,x,A)};a.ImageFilter.MakeImage=function(c,g,l,t){l=S(l,ia);t=S(t,Na);if("B"in g&&"C"in g)return a.ImageFilter._MakeImageCubic(c,g.B,g.C,l,t);const x=g.filter;let A=a.MipmapMode.None;"mipmap"in g&&(A=g.mipmap);return a.ImageFilter._MakeImageOptions(c,x,A,l,t)};a.ImageFilter.MakeMatrixTransform=function(c, g,l){c=G(c);if("B"in g&&"C"in g)return a.ImageFilter._MakeMatrixTransformCubic(c,g.B,g.C,l);const t=g.filter;let x=a.MipmapMode.None;"mipmap"in g&&(x=g.mipmap);return a.ImageFilter._MakeMatrixTransformOptions(c,t,x,l)};a.Paint.prototype.getColor=function(){this._getColor(Qa);return fa(Qa)};a.Paint.prototype.setColor=function(c,g){g=g||null;c=Y(c);this._setColor(c,g)};a.Paint.prototype.setColorComponents=function(c,g,l,t,x){x=x||null;c=ea(c,g,l,t);this._setColor(c,x)};a.Path.prototype.getPoint=function(c, g){this._getPoint(c,ia);c=ua.toTypedArray();return g?(g[0]=c[0],g[1]=c[1],g):c.slice(0,2)};a.Picture.prototype.makeShader=function(c,g,l,t,x){t=G(t);x=S(x);return this._makeShader(c,g,l,t,x)};a.Picture.prototype.cullRect=function(c){this._cullRect(ia);var g=ua.toTypedArray();return c?(c.set(g),c):g.slice()};a.PictureRecorder.prototype.beginRecording=function(c,g){c=S(c);return this._beginRecording(c,!!g)};a.Surface.prototype.getCanvas=function(){var c=this._getCanvas();c.Gd=this.Gd;return c};a.Surface.prototype.makeImageSnapshot= function(c){a.Id(this.Gd);c=w(c,"HEAP32",db);return this._makeImageSnapshot(c)};a.Surface.prototype.makeSurface=function(c){a.Id(this.Gd);c=this._makeSurface(c);c.Gd=this.Gd;return c};a.Surface.prototype.sf=function(c,g){this.Ae||(this.Ae=this.getCanvas());return requestAnimationFrame(function(){a.Id(this.Gd);c(this.Ae);this.flush(g)}.bind(this))};a.Surface.prototype.requestAnimationFrame||(a.Surface.prototype.requestAnimationFrame=a.Surface.prototype.sf);a.Surface.prototype.nf=function(c,g){this.Ae|| (this.Ae=this.getCanvas());requestAnimationFrame(function(){a.Id(this.Gd);c(this.Ae);this.flush(g);this.dispose()}.bind(this))};a.Surface.prototype.drawOnce||(a.Surface.prototype.drawOnce=a.Surface.prototype.nf);a.PathEffect.MakeDash=function(c,g){g||=0;if(!c.length||1===c.length%2)throw"Intervals array must have even length";var l=w(c,"HEAPF32");g=a.PathEffect._MakeDash(l,c.length,g);q(l,c);return g};a.PathEffect.MakeLine2D=function(c,g){g=G(g);return a.PathEffect._MakeLine2D(c,g)};a.PathEffect.MakePath2D= function(c,g){c=G(c);return a.PathEffect._MakePath2D(c,g)};a.Shader.MakeColor=function(c,g){g=g||null;c=Y(c);return a.Shader._MakeColor(c,g)};a.Shader.Blend=a.Shader.MakeBlend;a.Shader.Color=a.Shader.MakeColor;a.Shader.MakeLinearGradient=function(c,g,l,t,x,A,H,L){L=L||null;var M=D(l),V=w(t,"HEAPF32");H=H||0;A=G(A);var X=ua.toTypedArray();X.set(c);X.set(g,2);c=a.Shader._MakeLinearGradient(ia,M.Zd,M.colorType,V,M.count,x,H,A,L);q(M.Zd,l);t&&q(V,t);return c};a.Shader.MakeRadialGradient=function(c,g, l,t,x,A,H,L){L=L||null;var M=D(l),V=w(t,"HEAPF32");H=H||0;A=G(A);c=a.Shader._MakeRadialGradient(c[0],c[1],g,M.Zd,M.colorType,V,M.count,x,H,A,L);q(M.Zd,l);t&&q(V,t);return c};a.Shader.MakeSweepGradient=function(c,g,l,t,x,A,H,L,M,V){V=V||null;var X=D(l),r=w(t,"HEAPF32");H=H||0;L=L||0;M=M||360;A=G(A);c=a.Shader._MakeSweepGradient(c,g,X.Zd,X.colorType,r,X.count,x,L,M,H,A,V);q(X.Zd,l);t&&q(r,t);return c};a.Shader.MakeTwoPointConicalGradient=function(c,g,l,t,x,A,H,L,M,V){V=V||null;var X=D(x),r=w(A,"HEAPF32"); M=M||0;L=G(L);var C=ua.toTypedArray();C.set(c);C.set(l,2);c=a.Shader._MakeTwoPointConicalGradient(ia,g,t,X.Zd,X.colorType,r,X.count,H,M,L,V);q(X.Zd,x);A&&q(r,A);return c};a.Vertices.prototype.bounds=function(c){this._bounds(ia);var g=ua.toTypedArray();return c?(c.set(g),c):g.slice()};a.Pd&&a.Pd.forEach(function(c){c()})};a.computeTonalColors=function(e){var c=w(e.ambient,"HEAPF32"),g=w(e.spot,"HEAPF32");this._computeTonalColors(c,g);var l={ambient:fa(c),spot:fa(g)};q(c,e.ambient);q(g,e.spot);return l}; a.LTRBRect=function(e,c,g,l){return Float32Array.of(e,c,g,l)};a.XYWHRect=function(e,c,g,l){return Float32Array.of(e,c,e+g,c+l)};a.LTRBiRect=function(e,c,g,l){return Int32Array.of(e,c,g,l)};a.XYWHiRect=function(e,c,g,l){return Int32Array.of(e,c,e+g,c+l)};a.RRectXY=function(e,c,g){return Float32Array.of(e[0],e[1],e[2],e[3],c,g,c,g,c,g,c,g)};a.MakeAnimatedImageFromEncoded=function(e){e=new Uint8Array(e);var c=a._malloc(e.byteLength);a.HEAPU8.set(e,c);return(e=a._decodeAnimatedImage(c,e.byteLength))? e:null};a.MakeImageFromEncoded=function(e){e=new Uint8Array(e);var c=a._malloc(e.byteLength);a.HEAPU8.set(e,c);return(e=a._decodeImage(c,e.byteLength))?e:null};var pb=null;a.MakeImageFromCanvasImageSource=function(e){var c=e.width,g=e.height;pb||=document.createElement("canvas");pb.width=c;pb.height=g;var l=pb.getContext("2d",{willReadFrequently:!0});l.drawImage(e,0,0);e=l.getImageData(0,0,c,g);return a.MakeImage({width:c,height:g,alphaType:a.AlphaType.Unpremul,colorType:a.ColorType.RGBA_8888,colorSpace:a.ColorSpace.SRGB}, e.data,4*c)};a.MakeImage=function(e,c,g){var l=a._malloc(c.length);a.HEAPU8.set(c,l);return a._MakeImage(e,l,c.length,g)};a.MakeVertices=function(e,c,g,l,t,x){var A=t&&t.length||0,H=0;g&&g.length&&(H|=1);l&&l.length&&(H|=2);void 0===x||x||(H|=4);e=new a._VerticesBuilder(e,c.length/2,A,H);w(c,"HEAPF32",e.positions());e.texCoords()&&w(g,"HEAPF32",e.texCoords());e.colors()&&w(n(l),"HEAPU32",e.colors());e.indices()&&w(t,"HEAPU16",e.indices());return e.detach()};a.Matrix={};a.Matrix.identity=function(){return d(3)}; a.Matrix.invert=function(e){var c=e[0]*e[4]*e[8]+e[1]*e[5]*e[6]+e[2]*e[3]*e[7]-e[2]*e[4]*e[6]-e[1]*e[3]*e[8]-e[0]*e[5]*e[7];return c?[(e[4]*e[8]-e[5]*e[7])/c,(e[2]*e[7]-e[1]*e[8])/c,(e[1]*e[5]-e[2]*e[4])/c,(e[5]*e[6]-e[3]*e[8])/c,(e[0]*e[8]-e[2]*e[6])/c,(e[2]*e[3]-e[0]*e[5])/c,(e[3]*e[7]-e[4]*e[6])/c,(e[1]*e[6]-e[0]*e[7])/c,(e[0]*e[4]-e[1]*e[3])/c]:null};a.Matrix.mapPoints=function(e,c){for(var g=0;g<c.length;g+=2){var l=c[g],t=c[g+1],x=e[6]*l+e[7]*t+e[8],A=e[3]*l+e[4]*t+e[5];c[g]=(e[0]*l+e[1]*t+ e[2])/x;c[g+1]=A/x}return c};a.Matrix.multiply=function(){return $a(3,arguments)};a.Matrix.rotated=function(e,c,g){c=c||0;g=g||0;var l=Math.sin(e);e=Math.cos(e);return[e,-l,ma(l,g,1-e,c),l,e,ma(-l,c,1-e,g),0,0,1]};a.Matrix.scaled=function(e,c,g,l){g=g||0;l=l||0;var t=b([e,c],d(3),3,0,1);return b([g-e*g,l-c*l],t,3,2,0)};a.Matrix.skewed=function(e,c,g,l){g=g||0;l=l||0;var t=b([e,c],d(3),3,1,-1);return b([-e*g,-c*l],t,3,2,0)};a.Matrix.translated=function(e,c){return b(arguments,d(3),3,2,0)};a.Vector= {};a.Vector.dot=function(e,c){return e.map(function(g,l){return g*c[l]}).reduce(function(g,l){return g+l})};a.Vector.lengthSquared=function(e){return a.Vector.dot(e,e)};a.Vector.length=function(e){return Math.sqrt(a.Vector.lengthSquared(e))};a.Vector.mulScalar=function(e,c){return e.map(function(g){return g*c})};a.Vector.add=function(e,c){return e.map(function(g,l){return g+c[l]})};a.Vector.sub=function(e,c){return e.map(function(g,l){return g-c[l]})};a.Vector.dist=function(e,c){return a.Vector.length(a.Vector.sub(e, c))};a.Vector.normalize=function(e){return a.Vector.mulScalar(e,1/a.Vector.length(e))};a.Vector.cross=function(e,c){return[e[1]*c[2]-e[2]*c[1],e[2]*c[0]-e[0]*c[2],e[0]*c[1]-e[1]*c[0]]};a.M44={};a.M44.identity=function(){return d(4)};a.M44.translated=function(e){return b(e,d(4),4,3,0)};a.M44.scaled=function(e){return b(e,d(4),4,0,1)};a.M44.rotated=function(e,c){return a.M44.rotatedUnitSinCos(a.Vector.normalize(e),Math.sin(c),Math.cos(c))};a.M44.rotatedUnitSinCos=function(e,c,g){var l=e[0],t=e[1];e= e[2];var x=1-g;return[x*l*l+g,x*l*t-c*e,x*l*e+c*t,0,x*l*t+c*e,x*t*t+g,x*t*e-c*l,0,x*l*e-c*t,x*t*e+c*l,x*e*e+g,0,0,0,0,1]};a.M44.lookat=function(e,c,g){c=a.Vector.normalize(a.Vector.sub(c,e));g=a.Vector.normalize(g);g=a.Vector.normalize(a.Vector.cross(c,g));var l=a.M44.identity();b(g,l,4,0,0);b(a.Vector.cross(g,c),l,4,1,0);b(a.Vector.mulScalar(c,-1),l,4,2,0);b(e,l,4,3,0);e=a.M44.invert(l);return null===e?a.M44.identity():e};a.M44.perspective=function(e,c,g){var l=1/(c-e);g/=2;g=Math.cos(g)/Math.sin(g); return[g,0,0,0,0,g,0,0,0,0,(c+e)*l,2*c*e*l,0,0,-1,1]};a.M44.rc=function(e,c,g){return e[4*c+g]};a.M44.multiply=function(){return $a(4,arguments)};a.M44.invert=function(e){var c=e[0],g=e[4],l=e[8],t=e[12],x=e[1],A=e[5],H=e[9],L=e[13],M=e[2],V=e[6],X=e[10],r=e[14],C=e[3],P=e[7],aa=e[11];e=e[15];var ja=c*A-g*x,va=c*H-l*x,wa=c*L-t*x,la=g*H-l*A,E=g*L-t*A,k=l*L-t*H,p=M*P-V*C,y=M*aa-X*C,z=M*e-r*C,B=V*aa-X*P,F=V*e-r*P,J=X*e-r*aa,ba=ja*J-va*F+wa*B+la*z-E*y+k*p,ca=1/ba;if(0===ba||Infinity===ca)return null; ja*=ca;va*=ca;wa*=ca;la*=ca;E*=ca;k*=ca;p*=ca;y*=ca;z*=ca;B*=ca;F*=ca;J*=ca;c=[A*J-H*F+L*B,H*z-x*J-L*y,x*F-A*z+L*p,A*y-x*B-H*p,l*F-g*J-t*B,c*J-l*z+t*y,g*z-c*F-t*p,c*B-g*y+l*p,P*k-aa*E+e*la,aa*wa-C*k-e*va,C*E-P*wa+e*ja,P*va-C*la-aa*ja,X*E-V*k-r*la,M*k-X*wa+r*va,V*wa-M*E-r*ja,M*la-V*va+X*ja];return c.every(function(Ha){return!isNaN(Ha)&&Infinity!==Ha&&-Infinity!==Ha})?c:null};a.M44.transpose=function(e){return[e[0],e[4],e[8],e[12],e[1],e[5],e[9],e[13],e[2],e[6],e[10],e[14],e[3],e[7],e[11],e[15]]};a.M44.mustInvert= function(e){e=a.M44.invert(e);if(null===e)throw"Matrix not invertible";return e};a.M44.setupCamera=function(e,c,g){var l=a.M44.lookat(g.eye,g.coa,g.up);g=a.M44.perspective(g.near,g.far,g.angle);c=[(e[2]-e[0])/2,(e[3]-e[1])/2,c];e=a.M44.multiply(a.M44.translated([(e[0]+e[2])/2,(e[1]+e[3])/2,0]),a.M44.scaled(c));return a.M44.multiply(e,g,l,a.M44.mustInvert(e))};a.ColorMatrix={};a.ColorMatrix.identity=function(){var e=new Float32Array(20);e[0]=1;e[6]=1;e[12]=1;e[18]=1;return e};a.ColorMatrix.scaled= function(e,c,g,l){var t=new Float32Array(20);t[0]=e;t[6]=c;t[12]=g;t[18]=l;return t};var kd=[[6,7,11,12],[0,10,2,12],[0,1,5,6]];a.ColorMatrix.rotated=function(e,c,g){var l=a.ColorMatrix.identity();e=kd[e];l[e[0]]=g;l[e[1]]=c;l[e[2]]=-c;l[e[3]]=g;return l};a.ColorMatrix.postTranslate=function(e,c,g,l,t){e[4]+=c;e[9]+=g;e[14]+=l;e[19]+=t;return e};a.ColorMatrix.concat=function(e,c){for(var g=new Float32Array(20),l=0,t=0;20>t;t+=5){for(var x=0;4>x;x++)g[l++]=e[t]*c[x]+e[t+1]*c[x+5]+e[t+2]*c[x+10]+e[t+ 3]*c[x+15];g[l++]=e[t]*c[4]+e[t+1]*c[9]+e[t+2]*c[14]+e[t+3]*c[19]+e[t+4]}return g};(function(e){e.Pd=e.Pd||[];e.Pd.push(function(){function c(r){r&&(r.dir=0===r.dir?e.TextDirection.RTL:e.TextDirection.LTR);return r}function g(r){if(!r||!r.length)return[];for(var C=[],P=0;P<r.length;P+=5){var aa=e.LTRBRect(r[P],r[P+1],r[P+2],r[P+3]),ja=e.TextDirection.LTR;0===r[P+4]&&(ja=e.TextDirection.RTL);C.push({rect:aa,dir:ja})}e._free(r.byteOffset);return C}function l(r){r=r||{};void 0===r.weight&&(r.weight= e.FontWeight.Normal);r.width=r.width||e.FontWidth.Normal;r.slant=r.slant||e.FontSlant.Upright;return r}function t(r){if(!r||!r.length)return Q;for(var C=[],P=0;P<r.length;P++){var aa=x(r[P]);C.push(aa)}return w(C,"HEAPU32")}function x(r){if(L[r])return L[r];var C=Aa(r)+1,P=e._malloc(C);Ba(r,P,C);return L[r]=P}function A(r){r._colorPtr=Y(r.color);r._foregroundColorPtr=Q;r._backgroundColorPtr=Q;r._decorationColorPtr=Q;r.foregroundColor&&(r._foregroundColorPtr=Y(r.foregroundColor,M));r.backgroundColor&& (r._backgroundColorPtr=Y(r.backgroundColor,V));r.decorationColor&&(r._decorationColorPtr=Y(r.decorationColor,X));Array.isArray(r.fontFamilies)&&r.fontFamilies.length?(r._fontFamiliesPtr=t(r.fontFamilies),r._fontFamiliesLen=r.fontFamilies.length):(r._fontFamiliesPtr=Q,r._fontFamiliesLen=0);if(r.locale){var C=r.locale;r._localePtr=x(C);r._localeLen=Aa(C)}else r._localePtr=Q,r._localeLen=0;if(Array.isArray(r.shadows)&&r.shadows.length){C=r.shadows;var P=C.map(function(E){return E.color||e.BLACK}),aa= C.map(function(E){return E.blurRadius||0});r._shadowLen=C.length;for(var ja=e._malloc(8*C.length),va=ja/4,wa=0;wa<C.length;wa++){var la=C[wa].offset||[0,0];e.HEAPF32[va]=la[0];e.HEAPF32[va+1]=la[1];va+=2}r._shadowColorsPtr=D(P).Zd;r._shadowOffsetsPtr=ja;r._shadowBlurRadiiPtr=w(aa,"HEAPF32")}else r._shadowLen=0,r._shadowColorsPtr=Q,r._shadowOffsetsPtr=Q,r._shadowBlurRadiiPtr=Q;Array.isArray(r.fontFeatures)&&r.fontFeatures.length?(C=r.fontFeatures,P=C.map(function(E){return E.name}),aa=C.map(function(E){return E.value}), r._fontFeatureLen=C.length,r._fontFeatureNamesPtr=t(P),r._fontFeatureValuesPtr=w(aa,"HEAPU32")):(r._fontFeatureLen=0,r._fontFeatureNamesPtr=Q,r._fontFeatureValuesPtr=Q);Array.isArray(r.fontVariations)&&r.fontVariations.length?(C=r.fontVariations,P=C.map(function(E){return E.axis}),aa=C.map(function(E){return E.value}),r._fontVariationLen=C.length,r._fontVariationAxesPtr=t(P),r._fontVariationValuesPtr=w(aa,"HEAPF32")):(r._fontVariationLen=0,r._fontVariationAxesPtr=Q,r._fontVariationValuesPtr=Q)}function H(r){e._free(r._fontFamiliesPtr); e._free(r._shadowColorsPtr);e._free(r._shadowOffsetsPtr);e._free(r._shadowBlurRadiiPtr);e._free(r._fontFeatureNamesPtr);e._free(r._fontFeatureValuesPtr);e._free(r._fontVariationAxesPtr);e._free(r._fontVariationValuesPtr)}e.Paragraph.prototype.getRectsForRange=function(r,C,P,aa){r=this._getRectsForRange(r,C,P,aa);return g(r)};e.Paragraph.prototype.getRectsForPlaceholders=function(){var r=this._getRectsForPlaceholders();return g(r)};e.Paragraph.prototype.getGlyphInfoAt=function(r){return c(this._getGlyphInfoAt(r))}; e.Paragraph.prototype.getClosestGlyphInfoAtCoordinate=function(r,C){return c(this._getClosestGlyphInfoAtCoordinate(r,C))};e.TypefaceFontProvider.prototype.registerFont=function(r,C){r=e.Typeface.MakeTypefaceFromData(r);if(!r)return null;C=x(C);this._registerFont(r,C);r.delete()};e.ParagraphStyle=function(r){r.disableHinting=r.disableHinting||!1;if(r.ellipsis){var C=r.ellipsis;r._ellipsisPtr=x(C);r._ellipsisLen=Aa(C)}else r._ellipsisPtr=Q,r._ellipsisLen=0;null==r.heightMultiplier&&(r.heightMultiplier= -1);r.maxLines=r.maxLines||0;r.replaceTabCharacters=r.replaceTabCharacters||!1;C=(C=r.strutStyle)||{};C.strutEnabled=C.strutEnabled||!1;C.strutEnabled&&Array.isArray(C.fontFamilies)&&C.fontFamilies.length?(C._fontFamiliesPtr=t(C.fontFamilies),C._fontFamiliesLen=C.fontFamilies.length):(C._fontFamiliesPtr=Q,C._fontFamiliesLen=0);C.fontStyle=l(C.fontStyle);null==C.fontSize&&(C.fontSize=-1);null==C.heightMultiplier&&(C.heightMultiplier=-1);C.halfLeading=C.halfLeading||!1;C.leading=C.leading||0;C.forceStrutHeight= C.forceStrutHeight||!1;r.strutStyle=C;r.textAlign=r.textAlign||e.TextAlign.Start;r.textDirection=r.textDirection||e.TextDirection.LTR;r.textHeightBehavior=r.textHeightBehavior||e.TextHeightBehavior.All;r.textStyle=e.TextStyle(r.textStyle);r.applyRoundingHack=!1!==r.applyRoundingHack;return r};e.TextStyle=function(r){r.color||(r.color=e.BLACK);r.decoration=r.decoration||0;r.decorationThickness=r.decorationThickness||0;r.decorationStyle=r.decorationStyle||e.DecorationStyle.Solid;r.textBaseline=r.textBaseline|| e.TextBaseline.Alphabetic;null==r.fontSize&&(r.fontSize=-1);r.letterSpacing=r.letterSpacing||0;r.wordSpacing=r.wordSpacing||0;null==r.heightMultiplier&&(r.heightMultiplier=-1);r.halfLeading=r.halfLeading||!1;r.fontStyle=l(r.fontStyle);return r};var L={},M=e._malloc(16),V=e._malloc(16),X=e._malloc(16);e.ParagraphBuilder.Make=function(r,C){A(r.textStyle);C=e.ParagraphBuilder._Make(r,C);H(r.textStyle);return C};e.ParagraphBuilder.MakeFromFontProvider=function(r,C){A(r.textStyle);C=e.ParagraphBuilder._MakeFromFontProvider(r, C);H(r.textStyle);return C};e.ParagraphBuilder.MakeFromFontCollection=function(r,C){A(r.textStyle);C=e.ParagraphBuilder._MakeFromFontCollection(r,C);H(r.textStyle);return C};e.ParagraphBuilder.ShapeText=function(r,C,P){let aa=0;for(const ja of C)aa+=ja.length;if(aa!==r.length)throw"Accumulated block lengths must equal text.length";return e.ParagraphBuilder._ShapeText(r,C,P)};e.ParagraphBuilder.prototype.pushStyle=function(r){A(r);this._pushStyle(r);H(r)};e.ParagraphBuilder.prototype.pushPaintStyle= function(r,C,P){A(r);this._pushPaintStyle(r,C,P);H(r)};e.ParagraphBuilder.prototype.addPlaceholder=function(r,C,P,aa,ja){P=P||e.PlaceholderAlignment.Baseline;aa=aa||e.TextBaseline.Alphabetic;this._addPlaceholder(r||0,C||0,P,aa,ja||0)};e.ParagraphBuilder.prototype.setWordsUtf8=function(r){var C=w(r,"HEAPU32");this._setWordsUtf8(C,r&&r.length||0);q(C,r)};e.ParagraphBuilder.prototype.setWordsUtf16=function(r){var C=w(r,"HEAPU32");this._setWordsUtf16(C,r&&r.length||0);q(C,r)};e.ParagraphBuilder.prototype.setGraphemeBreaksUtf8= function(r){var C=w(r,"HEAPU32");this._setGraphemeBreaksUtf8(C,r&&r.length||0);q(C,r)};e.ParagraphBuilder.prototype.setGraphemeBreaksUtf16=function(r){var C=w(r,"HEAPU32");this._setGraphemeBreaksUtf16(C,r&&r.length||0);q(C,r)};e.ParagraphBuilder.prototype.setLineBreaksUtf8=function(r){var C=w(r,"HEAPU32");this._setLineBreaksUtf8(C,r&&r.length||0);q(C,r)};e.ParagraphBuilder.prototype.setLineBreaksUtf16=function(r){var C=w(r,"HEAPU32");this._setLineBreaksUtf16(C,r&&r.length||0);q(C,r)}})})(u);a.Pd= a.Pd||[];a.Pd.push(function(){});a.Pd=a.Pd||[];a.Pd.push(function(){a.Canvas.prototype.drawText=function(e,c,g,l,t){var x=Aa(e),A=a._malloc(x+1);Ba(e,A,x+1);this._drawSimpleText(A,x,c,g,t,l);a._free(A)};a.Canvas.prototype.drawGlyphs=function(e,c,g,l,t,x){if(!(2*e.length<=c.length))throw"Not enough positions for the array of gyphs";a.Id(this.Gd);const A=w(e,"HEAPU16"),H=w(c,"HEAPF32");this._drawGlyphs(e.length,A,H,g,l,t,x);q(H,c);q(A,e)};a.Font.prototype.getGlyphBounds=function(e,c,g){var l=w(e,"HEAPU16"), t=a._malloc(16*e.length);this._getGlyphWidthBounds(l,e.length,Q,t,c||null);c=new Float32Array(a.HEAPU8.buffer,t,4*e.length);q(l,e);if(g)return g.set(c),a._free(t),g;e=Float32Array.from(c);a._free(t);return e};a.Font.prototype.getGlyphIDs=function(e,c,g){c||(c=e.length);var l=Aa(e)+1,t=a._malloc(l);Ba(e,t,l);e=a._malloc(2*c);c=this._getGlyphIDs(t,l-1,c,e);a._free(t);if(0>c)return a._free(e),null;t=new Uint16Array(a.HEAPU8.buffer,e,c);if(g)return g.set(t),a._free(e),g;g=Uint16Array.from(t);a._free(e); return g};a.Font.prototype.getGlyphIntercepts=function(e,c,g,l){var t=w(e,"HEAPU16"),x=w(c,"HEAPF32");return this._getGlyphIntercepts(t,e.length,!(e&&e._ck),x,c.length,!(c&&c._ck),g,l)};a.Font.prototype.getGlyphWidths=function(e,c,g){var l=w(e,"HEAPU16"),t=a._malloc(4*e.length);this._getGlyphWidthBounds(l,e.length,t,Q,c||null);c=new Float32Array(a.HEAPU8.buffer,t,e.length);q(l,e);if(g)return g.set(c),a._free(t),g;e=Float32Array.from(c);a._free(t);return e};a.FontMgr.FromData=function(){if(!arguments.length)return null; var e=arguments;1===e.length&&Array.isArray(e[0])&&(e=arguments[0]);if(!e.length)return null;for(var c=[],g=[],l=0;l<e.length;l++){var t=new Uint8Array(e[l]),x=w(t,"HEAPU8");c.push(x);g.push(t.byteLength)}c=w(c,"HEAPU32");g=w(g,"HEAPU32");e=a.FontMgr._fromData(c,g,e.length);a._free(c);a._free(g);return e};a.Typeface.MakeTypefaceFromData=function(e){e=new Uint8Array(e);var c=w(e,"HEAPU8");return(e=a.Typeface._MakeTypefaceFromData(c,e.byteLength))?e:null};a.Typeface.MakeFreeTypeFaceFromData=a.Typeface.MakeTypefaceFromData; a.Typeface.prototype.getGlyphIDs=function(e,c,g){c||(c=e.length);var l=Aa(e)+1,t=a._malloc(l);Ba(e,t,l);e=a._malloc(2*c);c=this._getGlyphIDs(t,l-1,c,e);a._free(t);if(0>c)return a._free(e),null;t=new Uint16Array(a.HEAPU8.buffer,e,c);if(g)return g.set(t),a._free(e),g;g=Uint16Array.from(t);a._free(e);return g};a.TextBlob.MakeOnPath=function(e,c,g,l){if(e&&e.length&&c&&c.countPoints()){if(1===c.countPoints())return this.MakeFromText(e,g);l||=0;var t=g.getGlyphIDs(e);t=g.getGlyphWidths(t);var x=[];c=new a.ContourMeasureIter(c, !1,1);for(var A=c.next(),H=new Float32Array(4),L=0;L<e.length&&A;L++){var M=t[L];l+=M/2;if(l>A.length()){A.delete();A=c.next();if(!A){e=e.substring(0,L);break}l=M/2}A.getPosTan(l,H);var V=H[2],X=H[3];x.push(V,X,H[0]-M/2*V,H[1]-M/2*X);l+=M/2}e=this.MakeFromRSXform(e,x,g);A&&A.delete();c.delete();return e}};a.TextBlob.MakeFromRSXform=function(e,c,g){var l=Aa(e)+1,t=a._malloc(l);Ba(e,t,l);e=w(c,"HEAPF32");g=a.TextBlob._MakeFromRSXform(t,l-1,e,g);a._free(t);return g?g:null};a.TextBlob.MakeFromRSXformGlyphs= function(e,c,g){var l=w(e,"HEAPU16");c=w(c,"HEAPF32");g=a.TextBlob._MakeFromRSXformGlyphs(l,2*e.length,c,g);q(l,e);return g?g:null};a.TextBlob.MakeFromGlyphs=function(e,c){var g=w(e,"HEAPU16");c=a.TextBlob._MakeFromGlyphs(g,2*e.length,c);q(g,e);return c?c:null};a.TextBlob.MakeFromText=function(e,c){var g=Aa(e)+1,l=a._malloc(g);Ba(e,l,g);e=a.TextBlob._MakeFromText(l,g-1,c);a._free(l);return e?e:null};a.MallocGlyphIDs=function(e){return a.Malloc(Uint16Array,e)}});a.Pd=a.Pd||[];a.Pd.push(function(){a.MakePicture= function(e){e=new Uint8Array(e);var c=a._malloc(e.byteLength);a.HEAPU8.set(e,c);return(e=a._MakePicture(c,e.byteLength))?e:null}});a.Pd=a.Pd||[];a.Pd.push(function(){a.RuntimeEffect.Make=function(e,c){return a.RuntimeEffect._Make(e,{onError:c||function(g){console.log("RuntimeEffect error",g)}})};a.RuntimeEffect.MakeForBlender=function(e,c){return a.RuntimeEffect._MakeForBlender(e,{onError:c||function(g){console.log("RuntimeEffect error",g)}})};a.RuntimeEffect.prototype.makeShader=function(e,c){var g= !e._ck,l=w(e,"HEAPF32");c=G(c);return this._makeShader(l,4*e.length,g,c)};a.RuntimeEffect.prototype.makeShaderWithChildren=function(e,c,g){var l=!e._ck,t=w(e,"HEAPF32");g=G(g);for(var x=[],A=0;A<c.length;A++)x.push(c[A].Fd.Md);c=w(x,"HEAPU32");return this._makeShaderWithChildren(t,4*e.length,l,c,x.length,g)};a.RuntimeEffect.prototype.makeBlender=function(e){var c=!e._ck,g=w(e,"HEAPF32");return this._makeBlender(g,4*e.length,c)}});(function(){function e(E){for(var k=0;k<E.length;k++)if(void 0!==E[k]&& !Number.isFinite(E[k]))return!1;return!0}function c(E){var k=a.getColorComponents(E);E=k[0];var p=k[1],y=k[2];k=k[3];if(1===k)return E=E.toString(16).toLowerCase(),p=p.toString(16).toLowerCase(),y=y.toString(16).toLowerCase(),E=1===E.length?"0"+E:E,p=1===p.length?"0"+p:p,y=1===y.length?"0"+y:y,"#"+E+p+y;k=0===k||1===k?k:k.toFixed(8);return"rgba("+E+", "+p+", "+y+", "+k+")"}function g(E){return a.parseColorString(E,va)}function l(E){E=wa.exec(E);if(!E)return null;var k=parseFloat(E[4]),p=16;switch(E[5]){case "em":case "rem":p= 16*k;break;case "pt":p=4*k/3;break;case "px":p=k;break;case "pc":p=16*k;break;case "in":p=96*k;break;case "cm":p=96*k/2.54;break;case "mm":p=96/25.4*k;break;case "q":p=96/25.4/4*k;break;case "%":p=16/75*k}return{style:E[1],variant:E[2],weight:E[3],sizePx:p,family:E[6].trim()}}function t(){la||={"Noto Mono":{"*":a.Typeface.GetDefault()},monospace:{"*":a.Typeface.GetDefault()}}}function x(E){this.Hd=E;this.Kd=new a.Paint;this.Kd.setAntiAlias(!0);this.Kd.setStrokeMiter(10);this.Kd.setStrokeCap(a.StrokeCap.Butt); this.Kd.setStrokeJoin(a.StrokeJoin.Miter);this.Le="10px monospace";this.je=new a.Font(a.Typeface.GetDefault(),10);this.je.setSubpixel(!0);this.Xd=this.de=a.BLACK;this.re=0;this.Ce=a.TRANSPARENT;this.te=this.se=0;this.De=this.he=1;this.Be=0;this.qe=[];this.Jd=a.BlendMode.SrcOver;this.Kd.setStrokeWidth(this.De);this.Kd.setBlendMode(this.Jd);this.Nd=new a.PathBuilder;this.Od=a.Matrix.identity();this.bf=[];this.xe=[];this.ie=function(){this.Nd.delete();this.Kd.delete();this.je.delete();this.xe.forEach(function(k){k.ie()})}; Object.defineProperty(this,"currentTransform",{enumerable:!0,get:function(){return{a:this.Od[0],c:this.Od[1],e:this.Od[2],b:this.Od[3],d:this.Od[4],f:this.Od[5]}},set:function(k){k.a&&this.setTransform(k.a,k.b,k.c,k.d,k.e,k.f)}});Object.defineProperty(this,"fillStyle",{enumerable:!0,get:function(){return f(this.Xd)?c(this.Xd):this.Xd},set:function(k){"string"===typeof k?this.Xd=g(k):k.pe&&(this.Xd=k)}});Object.defineProperty(this,"font",{enumerable:!0,get:function(){return this.Le},set:function(k){var p= l(k);var y=(p.style||"normal")+"|"+(p.variant||"normal")+"|"+(p.weight||"normal");var z=p.family;t();y=la[z]?la[z][y]||la[z]["*"]:a.Typeface.GetDefault();p.typeface=y;p&&(this.je.setSize(p.sizePx),this.je.setTypeface(p.typeface),this.Le=k)}});Object.defineProperty(this,"globalAlpha",{enumerable:!0,get:function(){return this.he},set:function(k){!isFinite(k)||0>k||1<k||(this.he=k)}});Object.defineProperty(this,"globalCompositeOperation",{enumerable:!0,get:function(){switch(this.Jd){case a.BlendMode.SrcOver:return"source-over"; case a.BlendMode.DstOver:return"destination-over";case a.BlendMode.Src:return"copy";case a.BlendMode.Dst:return"destination";case a.BlendMode.Clear:return"clear";case a.BlendMode.SrcIn:return"source-in";case a.BlendMode.DstIn:return"destination-in";case a.BlendMode.SrcOut:return"source-out";case a.BlendMode.DstOut:return"destination-out";case a.BlendMode.SrcATop:return"source-atop";case a.BlendMode.DstATop:return"destination-atop";case a.BlendMode.Xor:return"xor";case a.BlendMode.Plus:return"lighter"; case a.BlendMode.Multiply:return"multiply";case a.BlendMode.Screen:return"screen";case a.BlendMode.Overlay:return"overlay";case a.BlendMode.Darken:return"darken";case a.BlendMode.Lighten:return"lighten";case a.BlendMode.ColorDodge:return"color-dodge";case a.BlendMode.ColorBurn:return"color-burn";case a.BlendMode.HardLight:return"hard-light";case a.BlendMode.SoftLight:return"soft-light";case a.BlendMode.Difference:return"difference";case a.BlendMode.Exclusion:return"exclusion";case a.BlendMode.Hue:return"hue"; case a.BlendMode.Saturation:return"saturation";case a.BlendMode.Color:return"color";case a.BlendMode.Luminosity:return"luminosity"}},set:function(k){switch(k){case "source-over":this.Jd=a.BlendMode.SrcOver;break;case "destination-over":t