UNPKG

canvaskit-wasm

Version:

A WASM version of Skia's Canvas API

109 lines (106 loc) 130 kB
var CanvasKitInit = (() => { var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename; return ( function(CanvasKitInit) { CanvasKitInit = CanvasKitInit || {}; null;var w;w||(w=typeof CanvasKitInit !== 'undefined' ? CanvasKitInit : {});var aa,ea;w.ready=new Promise(function(a,b){aa=a;ea=b}); (function(a){a.Sd=a.Sd||[];a.Sd.push(function(){a.MakeSWCanvasSurface=function(b){var e=b;if("CANVAS"!==e.tagName&&(e=document.getElementById(b),!e))throw"Canvas with id "+b+" was not found";if(b=a.MakeSurface(e.width,e.height))b.Od=e;return b};a.MakeCanvasSurface||(a.MakeCanvasSurface=a.MakeSWCanvasSurface);a.MakeSurface=function(b,e){var f={width:b,height:e,colorType:a.ColorType.RGBA_8888,alphaType:a.AlphaType.Unpremul,colorSpace:a.ColorSpace.SRGB},h=b*e*4,m=a._malloc(h);if(f=a.Surface._makeRasterDirect(f, m,4*b))f.Od=null,f.Ff=b,f.Bf=e,f.Df=h,f.af=m,f.getCanvas().clear(a.TRANSPARENT);return f};a.MakeRasterDirectSurface=function(b,e,f){return a.Surface._makeRasterDirect(b,e.byteOffset,f)};a.Surface.prototype.flush=function(b){a.Pd(this.Nd);this._flush();if(this.Od){var e=new Uint8ClampedArray(a.HEAPU8.buffer,this.af,this.Df);e=new ImageData(e,this.Ff,this.Bf);b?this.Od.getContext("2d").putImageData(e,0,0,b[0],b[1],b[2]-b[0],b[3]-b[1]):this.Od.getContext("2d").putImageData(e,0,0)}};a.Surface.prototype.dispose= function(){this.af&&a._free(this.af);this.delete()};a.Pd=a.Pd||function(){};a.ef=a.ef||function(){return null}})})(w); (function(a){a.Sd=a.Sd||[];a.Sd.push(function(){function b(n,q,v){return n&&n.hasOwnProperty(q)?n[q]:v}function e(n){var q=fa(ia);ia[q]=n;return q}function f(n){return n.naturalHeight||n.videoHeight||n.displayHeight||n.height}function h(n){return n.naturalWidth||n.videoWidth||n.displayWidth||n.width}function m(n,q,v,D){n.bindTexture(n.TEXTURE_2D,q);D||v.alphaType!==a.AlphaType.Premul||n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);return q}function u(n,q,v){v||q.alphaType!==a.AlphaType.Premul|| n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1);n.bindTexture(n.TEXTURE_2D,null)}a.GetWebGLContext=function(n,q){if(!n)throw"null canvas passed into makeWebGLContext";var v={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)};v.majorVersion=q&&q.majorVersion?q.majorVersion:"undefined"!==typeof WebGL2RenderingContext?2:1;if(v.explicitSwapControl)throw"explicitSwapControl is not supported";n=ka(n,v);if(!n)return 0;ma(n);x.he.getExtension("WEBGL_debug_renderer_info");return n};a.deleteContext=function(n){x===na[n]&&(x=null);"object"==typeof JSEvents&& JSEvents.vg(na[n].he.canvas);na[n]&&na[n].he.canvas&&(na[n].he.canvas.zf=void 0);na[n]=null};a._setTextureCleanup({deleteTexture:function(n,q){var v=ia[q];v&&na[n].he.deleteTexture(v);ia[q]=null}});a.MakeWebGLContext=function(n){if(!this.Pd(n))return null;var q=this._MakeGrContext();if(!q)return null;q.Nd=n;var v=q.delete.bind(q);q["delete"]=function(){a.Pd(this.Nd);v()}.bind(q);return x.ff=q};a.MakeGrContext=a.MakeWebGLContext;a.GrDirectContext.prototype.getResourceCacheLimitBytes=function(){a.Pd(this.Nd); this._getResourceCacheLimitBytes()};a.GrDirectContext.prototype.getResourceCacheUsageBytes=function(){a.Pd(this.Nd);this._getResourceCacheUsageBytes()};a.GrDirectContext.prototype.releaseResourcesAndAbandonContext=function(){a.Pd(this.Nd);this._releaseResourcesAndAbandonContext()};a.GrDirectContext.prototype.setResourceCacheLimitBytes=function(n){a.Pd(this.Nd);this._setResourceCacheLimitBytes(n)};a.MakeOnScreenGLSurface=function(n,q,v,D){if(!this.Pd(n.Nd))return null;q=this._MakeOnScreenGLSurface(n, q,v,D);if(!q)return null;q.Nd=n.Nd;return q};a.MakeRenderTarget=function(){var n=arguments[0];if(!this.Pd(n.Nd))return null;if(3===arguments.length){var q=this._MakeRenderTargetWH(n,arguments[1],arguments[2]);if(!q)return null}else if(2===arguments.length){if(q=this._MakeRenderTargetII(n,arguments[1]),!q)return null}else return null;q.Nd=n.Nd;return q};a.MakeWebGLCanvasSurface=function(n,q,v){q=q||null;var D=n,H="undefined"!==typeof OffscreenCanvas&&D instanceof OffscreenCanvas;if(!("undefined"!== typeof HTMLCanvasElement&&D instanceof HTMLCanvasElement||H||(D=document.getElementById(n),D)))throw"Canvas with id "+n+" was not found";n=this.GetWebGLContext(D,v);if(!n||0>n)throw"failed to create webgl context: err "+n;n=this.MakeWebGLContext(n);q=this.MakeOnScreenGLSurface(n,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(n,q){a.Pd(this.Nd);n=e(n);if(q=this._makeImageFromTexture(this.Nd,n,q))q.Me=n;return q};a.Surface.prototype.makeImageFromTextureSource=function(n,q,v){q||(q={height:f(n),width:h(n),colorType:a.ColorType.RGBA_8888,alphaType:v?a.AlphaType.Premul:a.AlphaType.Unpremul});q.colorSpace||(q.colorSpace=a.ColorSpace.SRGB);a.Pd(this.Nd);var D=x.he;v=m(D,D.createTexture(),q,v);2===x.version?D.texImage2D(D.TEXTURE_2D,0,D.RGBA,q.width,q.height,0,D.RGBA,D.UNSIGNED_BYTE,n):D.texImage2D(D.TEXTURE_2D,0,D.RGBA, D.RGBA,D.UNSIGNED_BYTE,n);u(D,q);return this.makeImageFromTexture(v,q)};a.Surface.prototype.updateTextureFromSource=function(n,q,v){if(n.Me){a.Pd(this.Nd);var D=n.getImageInfo(),H=x.he,O=m(H,ia[n.Me],D,v);2===x.version?H.texImage2D(H.TEXTURE_2D,0,H.RGBA,h(q),f(q),0,H.RGBA,H.UNSIGNED_BYTE,q):H.texImage2D(H.TEXTURE_2D,0,H.RGBA,H.RGBA,H.UNSIGNED_BYTE,q);u(H,D,v);this._resetContext();ia[n.Me]=null;n.Me=e(O);D.colorSpace=n.getColorSpace();q=this._makeImageFromTexture(this.Nd,n.Me,D);v=n.Md.Vd;H=n.Md.ae; n.Md.Vd=q.Md.Vd;n.Md.ae=q.Md.ae;q.Md.Vd=v;q.Md.ae=H;q.delete();D.colorSpace.delete()}};a.MakeLazyImageFromTextureSource=function(n,q,v){q||(q={height:f(n),width:h(n),colorType:a.ColorType.RGBA_8888,alphaType:v?a.AlphaType.Premul:a.AlphaType.Unpremul});q.colorSpace||(q.colorSpace=a.ColorSpace.SRGB);var D={makeTexture:function(){var H=x,O=H.he,z=m(O,O.createTexture(),q,v);2===H.version?O.texImage2D(O.TEXTURE_2D,0,O.RGBA,q.width,q.height,0,O.RGBA,O.UNSIGNED_BYTE,n):O.texImage2D(O.TEXTURE_2D,0,O.RGBA, O.RGBA,O.UNSIGNED_BYTE,n);u(O,q,v);return e(z)},freeSrc:function(){}};"VideoFrame"===n.constructor.name&&(D.freeSrc=function(){n.close()});return a.Image._makeFromGenerator(q,D)};a.Pd=function(n){return n?ma(n):!1};a.ef=function(){return x&&x.ff&&!x.ff.isDeleted()?x.ff:null}})})(w); (function(a){function b(d,c,g,l,r){for(var y=0;y<d.length;y++)c[y*g+(y*r+l+g)%g]=d[y];return c}function e(d){for(var c=d*d,g=Array(c);c--;)g[c]=0===c%(d+1)?1:0;return g}function f(d){return d?d.constructor===Float32Array&&4===d.length:!1}function h(d){return(n(255*d[3])<<24|n(255*d[0])<<16|n(255*d[1])<<8|n(255*d[2])<<0)>>>0}function m(d){if(d&&d._ck)return d;if(d instanceof Float32Array){for(var c=Math.floor(d.length/4),g=new Uint32Array(c),l=0;l<c;l++)g[l]=h(d.slice(4*l,4*(l+1)));return g}if(d instanceof Uint32Array)return d;if(d instanceof Array&&d[0]instanceof Float32Array)return d.map(h)}function u(d){if(void 0===d)return 1;var c=parseFloat(d);return d&&-1!==d.indexOf("%")?c/100:c}function n(d){return Math.round(Math.max(0,Math.min(d||0,255)))}function q(d,c){c&&c._ck||a._free(d)}function v(d,c,g){if(!d||!d.length)return U;if(d&&d._ck)return d.byteOffset;var l=a[c].BYTES_PER_ELEMENT;g||(g=a._malloc(d.length*l));a[c].set(d,g/l);return g}function D(d){var c={de:U,count:d.length,colorType:a.ColorType.RGBA_F32}; if(d instanceof Float32Array)c.de=v(d,"HEAPF32"),c.count=d.length/4;else if(d instanceof Uint32Array)c.de=v(d,"HEAPU32"),c.colorType=a.ColorType.RGBA_8888;else if(d instanceof Array){if(d&&d.length){for(var g=a._malloc(16*d.length),l=0,r=g/4,y=0;y<d.length;y++)for(var B=0;4>B;B++)a.HEAPF32[r+l]=d[y][B],l++;d=g}else d=U;c.de=d}else throw"Invalid argument to copyFlexibleColorArray, Not a color array "+typeof d;return c}function H(d){if(!d)return U;var c=Ub.toTypedArray();if(d.length){if(6===d.length|| 9===d.length)return v(d,"HEAPF32",Oa),6===d.length&&a.HEAPF32.set(yd,6+Oa/4),Oa;if(16===d.length)return c[0]=d[0],c[1]=d[1],c[2]=d[3],c[3]=d[4],c[4]=d[5],c[5]=d[7],c[6]=d[12],c[7]=d[13],c[8]=d[15],Oa;throw"invalid matrix size";}if(void 0===d.m11)throw"invalid matrix argument";c[0]=d.m11;c[1]=d.m21;c[2]=d.m41;c[3]=d.m12;c[4]=d.m22;c[5]=d.m42;c[6]=d.m14;c[7]=d.m24;c[8]=d.m44;return Oa}function O(d){if(!d)return U;var c=Vb.toTypedArray();if(d.length){if(16!==d.length&&6!==d.length&&9!==d.length)throw"invalid matrix size"; if(16===d.length)return v(d,"HEAPF32",ab);c.fill(0);c[0]=d[0];c[1]=d[1];c[3]=d[2];c[4]=d[3];c[5]=d[4];c[7]=d[5];c[10]=1;c[12]=d[6];c[13]=d[7];c[15]=d[8];6===d.length&&(c[12]=0,c[13]=0,c[15]=1);return ab}if(void 0===d.m11)throw"invalid matrix argument";c[0]=d.m11;c[1]=d.m21;c[2]=d.m31;c[3]=d.m41;c[4]=d.m12;c[5]=d.m22;c[6]=d.m32;c[7]=d.m42;c[8]=d.m13;c[9]=d.m23;c[10]=d.m33;c[11]=d.m43;c[12]=d.m14;c[13]=d.m24;c[14]=d.m34;c[15]=d.m44;return ab}function z(d,c){return v(d,"HEAPF32",c||Ua)}function P(d, c,g,l){var r=Wb.toTypedArray();r[0]=d;r[1]=c;r[2]=g;r[3]=l;return Ua}function V(d){for(var c=new Float32Array(4),g=0;4>g;g++)c[g]=a.HEAPF32[d/4+g];return c}function S(d,c){return v(d,"HEAPF32",c||ha)}function ra(d,c){return v(d,"HEAPF32",c||Xb)}function ya(){for(var d=0,c=0;c<arguments.length-1;c+=2)d+=arguments[c]*arguments[c+1];return d}function gb(d,c,g){for(var l=Array(d.length),r=0;r<g;r++)for(var y=0;y<g;y++){for(var B=0,J=0;J<g;J++)B+=d[g*r+J]*c[g*J+y];l[r*g+y]=B}return l}function hb(d,c){for(var g= gb(c[0],c[1],d),l=2;l<c.length;)g=gb(g,c[l],d),l++;return g}a.Color=function(d,c,g,l){void 0===l&&(l=1);return a.Color4f(n(d)/255,n(c)/255,n(g)/255,l)};a.ColorAsInt=function(d,c,g,l){void 0===l&&(l=255);return(n(l)<<24|n(d)<<16|n(c)<<8|n(g)<<0&268435455)>>>0};a.Color4f=function(d,c,g,l){void 0===l&&(l=1);return Float32Array.of(d,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(d){return[Math.floor(255*d[0]),Math.floor(255*d[1]),Math.floor(255*d[2]),d[3]]};a.parseColorString=function(d,c){d=d.toLowerCase();if(d.startsWith("#")){c=255;switch(d.length){case 9:c=parseInt(d.slice(7,9),16);case 7:var g=parseInt(d.slice(1,3),16);var l=parseInt(d.slice(3,5),16);var r=parseInt(d.slice(5,7),16);break;case 5:c=17*parseInt(d.slice(4,5),16);case 4:g=17*parseInt(d.slice(1,2),16),l=17*parseInt(d.slice(2,3),16),r=17*parseInt(d.slice(3,4),16)}return a.Color(g, l,r,c/255)}return d.startsWith("rgba")?(d=d.slice(5,-1),d=d.split(","),a.Color(+d[0],+d[1],+d[2],u(d[3]))):d.startsWith("rgb")?(d=d.slice(4,-1),d=d.split(","),a.Color(+d[0],+d[1],+d[2],u(d[3]))):d.startsWith("gray(")||d.startsWith("hsl")||!c||(d=c[d],void 0===d)?a.BLACK:d};a.multiplyByAlpha=function(d,c){d=d.slice();d[3]=Math.max(0,Math.min(d[3]*c,1));return d};a.Malloc=function(d,c){var g=a._malloc(c*d.BYTES_PER_ELEMENT);return{_ck:!0,length:c,byteOffset:g,se:null,subarray:function(l,r){l=this.toTypedArray().subarray(l, r);l._ck=!0;return l},toTypedArray:function(){if(this.se&&this.se.length)return this.se;this.se=new d(a.HEAPU8.buffer,g,c);this.se._ck=!0;return this.se}}};a.Free=function(d){a._free(d.byteOffset);d.byteOffset=U;d.toTypedArray=null;d.se=null};var Oa=U,Ub,ab=U,Vb,Ua=U,Wb,sa,ha=U,Cc,Pa=U,Dc,Yb=U,Ec,Zb=U,$b,xb=U,Fc,Xb=U,Gc,Hc=U,yd=Float32Array.of(0,0,1),U=0;a.onRuntimeInitialized=function(){function d(c,g,l,r,y,B,J){B||(B=4*r.width,r.colorType===a.ColorType.RGBA_F16?B*=2:r.colorType===a.ColorType.RGBA_F32&& (B*=4));var N=B*r.height;var L=y?y.byteOffset:a._malloc(N);if(J?!c._readPixels(r,L,B,g,l,J):!c._readPixels(r,L,B,g,l))return y||a._free(L),null;if(y)return y.toTypedArray();switch(r.colorType){case a.ColorType.RGBA_8888:case a.ColorType.RGBA_F16:c=(new Uint8Array(a.HEAPU8.buffer,L,N)).slice();break;case a.ColorType.RGBA_F32:c=(new Float32Array(a.HEAPU8.buffer,L,N)).slice();break;default:return null}a._free(L);return c}Wb=a.Malloc(Float32Array,4);Ua=Wb.byteOffset;Vb=a.Malloc(Float32Array,16);ab=Vb.byteOffset; Ub=a.Malloc(Float32Array,9);Oa=Ub.byteOffset;Fc=a.Malloc(Float32Array,12);Xb=Fc.byteOffset;Gc=a.Malloc(Float32Array,12);Hc=Gc.byteOffset;sa=a.Malloc(Float32Array,4);ha=sa.byteOffset;Cc=a.Malloc(Float32Array,4);Pa=Cc.byteOffset;Dc=a.Malloc(Float32Array,3);Yb=Dc.byteOffset;Ec=a.Malloc(Float32Array,3);Zb=Ec.byteOffset;$b=a.Malloc(Int32Array,4);xb=$b.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=v(c,"HEAPF32"),l=a.Path._MakeFromCmds(g,c.length);q(g,c);return l};a.Path.MakeFromVerbsPointsWeights=function(c,g,l){var r=v(c,"HEAPU8"),y=v(g,"HEAPF32"),B=v(l,"HEAPF32"),J=a.Path._MakeFromVerbsPointsWeights(r,c.length,y,g.length,B,l&&l.length||0);q(r,c);q(y,g);q(B,l);return J};a.Path.prototype.addArc=function(c,g,l){c=S(c);this._addArc(c,g,l);return this};a.Path.prototype.addCircle=function(c,g,l,r){this._addCircle(c, g,l,!!r);return this};a.Path.prototype.addOval=function(c,g,l){void 0===l&&(l=1);c=S(c);this._addOval(c,!!g,l);return this};a.Path.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.Path.prototype.addPoly=function(c,g){var l=v(c,"HEAPF32");this._addPoly(l,c.length/2,g);q(l,c);return this};a.Path.prototype.addRect=function(c,g){c=S(c);this._addRect(c,!!g);return this};a.Path.prototype.addRRect=function(c,g){c=ra(c);this._addRRect(c,!!g);return this};a.Path.prototype.addVerbsPointsWeights=function(c,g,l){var r=v(c,"HEAPU8"),y=v(g,"HEAPF32"),B=v(l,"HEAPF32");this._addVerbsPointsWeights(r,c.length,y,g.length,B,l&&l.length||0); q(r,c);q(y,g);q(B,l)};a.Path.prototype.arc=function(c,g,l,r,y,B){c=a.LTRBRect(c-l,g-l,c+l,g+l);y=(y-r)/Math.PI*180-360*!!B;B=new a.Path;B.addArc(c,r/Math.PI*180,y);this.addPath(B,!0);B.delete();return this};a.Path.prototype.arcToOval=function(c,g,l,r){c=S(c);this._arcToOval(c,g,l,r);return this};a.Path.prototype.arcToRotated=function(c,g,l,r,y,B,J){this._arcToRotated(c,g,l,!!r,!!y,B,J);return this};a.Path.prototype.arcToTangent=function(c,g,l,r,y){this._arcToTangent(c,g,l,r,y);return this};a.Path.prototype.close= function(){this._close();return this};a.Path.prototype.conicTo=function(c,g,l,r,y){this._conicTo(c,g,l,r,y);return this};a.Path.prototype.computeTightBounds=function(c){this._computeTightBounds(ha);var g=sa.toTypedArray();return c?(c.set(g),c):g.slice()};a.Path.prototype.cubicTo=function(c,g,l,r,y,B){this._cubicTo(c,g,l,r,y,B);return this};a.Path.prototype.dash=function(c,g,l){return this._dash(c,g,l)?this:null};a.Path.prototype.getBounds=function(c){this._getBounds(ha);var g=sa.toTypedArray();return c? (c.set(g),c):g.slice()};a.Path.prototype.lineTo=function(c,g){this._lineTo(c,g);return this};a.Path.prototype.moveTo=function(c,g){this._moveTo(c,g);return this};a.Path.prototype.offset=function(c,g){this._transform(1,0,c,0,1,g,0,0,1);return this};a.Path.prototype.quadTo=function(c,g,l,r){this._quadTo(c,g,l,r);return this};a.Path.prototype.rArcTo=function(c,g,l,r,y,B,J){this._rArcTo(c,g,l,r,y,B,J);return this};a.Path.prototype.rConicTo=function(c,g,l,r,y){this._rConicTo(c,g,l,r,y);return this};a.Path.prototype.rCubicTo= function(c,g,l,r,y,B){this._rCubicTo(c,g,l,r,y,B);return this};a.Path.prototype.rLineTo=function(c,g){this._rLineTo(c,g);return this};a.Path.prototype.rMoveTo=function(c,g){this._rMoveTo(c,g);return this};a.Path.prototype.rQuadTo=function(c,g,l,r){this._rQuadTo(c,g,l,r);return this};a.Path.prototype.stroke=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._stroke(c)?this:null}; a.Path.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.trim=function(c,g,l){return this._trim(c,g,!!l)?this:null};a.Image.prototype.makeShaderCubic=function(c,g, l,r,y){y=H(y);return this._makeShaderCubic(c,g,l,r,y)};a.Image.prototype.makeShaderOptions=function(c,g,l,r,y){y=H(y);return this._makeShaderOptions(c,g,l,r,y)};a.Image.prototype.readPixels=function(c,g,l,r,y){var B=a.ef();return d(this,c,g,l,r,y,B)};a.Canvas.prototype.clear=function(c){a.Pd(this.Nd);c=z(c);this._clear(c)};a.Canvas.prototype.clipRRect=function(c,g,l){a.Pd(this.Nd);c=ra(c);this._clipRRect(c,g,l)};a.Canvas.prototype.clipRect=function(c,g,l){a.Pd(this.Nd);c=S(c);this._clipRect(c,g,l)}; a.Canvas.prototype.concat=function(c){a.Pd(this.Nd);c=O(c);this._concat(c)};a.Canvas.prototype.drawArc=function(c,g,l,r,y){a.Pd(this.Nd);c=S(c);this._drawArc(c,g,l,r,y)};a.Canvas.prototype.drawAtlas=function(c,g,l,r,y,B,J){if(c&&r&&g&&l&&g.length===l.length){a.Pd(this.Nd);y||(y=a.BlendMode.SrcOver);var N=v(g,"HEAPF32"),L=v(l,"HEAPF32"),W=l.length/4,t=v(m(B),"HEAPU32");if(J&&"B"in J&&"C"in J)this._drawAtlasCubic(c,L,N,t,W,y,J.B,J.C,r);else{let F=a.FilterMode.Linear,Q=a.MipmapMode.None;J&&(F=J.filter, "mipmap"in J&&(Q=J.mipmap));this._drawAtlasOptions(c,L,N,t,W,y,F,Q,r)}q(N,g);q(L,l);q(t,B)}};a.Canvas.prototype.drawCircle=function(c,g,l,r){a.Pd(this.Nd);this._drawCircle(c,g,l,r)};a.Canvas.prototype.drawColor=function(c,g){a.Pd(this.Nd);c=z(c);void 0!==g?this._drawColor(c,g):this._drawColor(c)};a.Canvas.prototype.drawColorInt=function(c,g){a.Pd(this.Nd);this._drawColorInt(c,g||a.BlendMode.SrcOver)};a.Canvas.prototype.drawColorComponents=function(c,g,l,r,y){a.Pd(this.Nd);c=P(c,g,l,r);void 0!==y? this._drawColor(c,y):this._drawColor(c)};a.Canvas.prototype.drawDRRect=function(c,g,l){a.Pd(this.Nd);c=ra(c,Xb);g=ra(g,Hc);this._drawDRRect(c,g,l)};a.Canvas.prototype.drawImage=function(c,g,l,r){a.Pd(this.Nd);this._drawImage(c,g,l,r||null)};a.Canvas.prototype.drawImageCubic=function(c,g,l,r,y,B){a.Pd(this.Nd);this._drawImageCubic(c,g,l,r,y,B||null)};a.Canvas.prototype.drawImageOptions=function(c,g,l,r,y,B){a.Pd(this.Nd);this._drawImageOptions(c,g,l,r,y,B||null)};a.Canvas.prototype.drawImageNine=function(c, g,l,r,y){a.Pd(this.Nd);g=v(g,"HEAP32",xb);l=S(l);this._drawImageNine(c,g,l,r,y||null)};a.Canvas.prototype.drawImageRect=function(c,g,l,r,y){a.Pd(this.Nd);S(g,ha);S(l,Pa);this._drawImageRect(c,ha,Pa,r,!!y)};a.Canvas.prototype.drawImageRectCubic=function(c,g,l,r,y,B){a.Pd(this.Nd);S(g,ha);S(l,Pa);this._drawImageRectCubic(c,ha,Pa,r,y,B||null)};a.Canvas.prototype.drawImageRectOptions=function(c,g,l,r,y,B){a.Pd(this.Nd);S(g,ha);S(l,Pa);this._drawImageRectOptions(c,ha,Pa,r,y,B||null)};a.Canvas.prototype.drawLine= function(c,g,l,r,y){a.Pd(this.Nd);this._drawLine(c,g,l,r,y)};a.Canvas.prototype.drawOval=function(c,g){a.Pd(this.Nd);c=S(c);this._drawOval(c,g)};a.Canvas.prototype.drawPaint=function(c){a.Pd(this.Nd);this._drawPaint(c)};a.Canvas.prototype.drawParagraph=function(c,g,l){a.Pd(this.Nd);this._drawParagraph(c,g,l)};a.Canvas.prototype.drawPatch=function(c,g,l,r,y){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.Pd(this.Nd); const B=v(c,"HEAPF32"),J=g?v(m(g),"HEAPU32"):U,N=l?v(l,"HEAPF32"):U;r||(r=a.BlendMode.Modulate);this._drawPatch(B,J,N,r,y);q(N,l);q(J,g);q(B,c)};a.Canvas.prototype.drawPath=function(c,g){a.Pd(this.Nd);this._drawPath(c,g)};a.Canvas.prototype.drawPicture=function(c){a.Pd(this.Nd);this._drawPicture(c)};a.Canvas.prototype.drawPoints=function(c,g,l){a.Pd(this.Nd);var r=v(g,"HEAPF32");this._drawPoints(c,r,g.length/2,l);q(r,g)};a.Canvas.prototype.drawRRect=function(c,g){a.Pd(this.Nd);c=ra(c);this._drawRRect(c, g)};a.Canvas.prototype.drawRect=function(c,g){a.Pd(this.Nd);c=S(c);this._drawRect(c,g)};a.Canvas.prototype.drawRect4f=function(c,g,l,r,y){a.Pd(this.Nd);this._drawRect4f(c,g,l,r,y)};a.Canvas.prototype.drawShadow=function(c,g,l,r,y,B,J){a.Pd(this.Nd);var N=v(y,"HEAPF32"),L=v(B,"HEAPF32");g=v(g,"HEAPF32",Yb);l=v(l,"HEAPF32",Zb);this._drawShadow(c,g,l,r,N,L,J);q(N,y);q(L,B)};a.getShadowLocalBounds=function(c,g,l,r,y,B,J){c=H(c);l=v(l,"HEAPF32",Yb);r=v(r,"HEAPF32",Zb);if(!this._getShadowLocalBounds(c, g,l,r,y,B,ha))return null;g=sa.toTypedArray();return J?(J.set(g),J):g.slice()};a.Canvas.prototype.drawTextBlob=function(c,g,l,r){a.Pd(this.Nd);this._drawTextBlob(c,g,l,r)};a.Canvas.prototype.drawVertices=function(c,g,l){a.Pd(this.Nd);this._drawVertices(c,g,l)};a.Canvas.prototype.getDeviceClipBounds=function(c){this._getDeviceClipBounds(xb);var g=$b.toTypedArray();c?c.set(g):c=g.slice();return c};a.Canvas.prototype.getLocalToDevice=function(){this._getLocalToDevice(ab);for(var c=ab,g=Array(16),l=0;16> l;l++)g[l]=a.HEAPF32[c/4+l];return g};a.Canvas.prototype.getTotalMatrix=function(){this._getTotalMatrix(Oa);for(var c=Array(9),g=0;9>g;g++)c[g]=a.HEAPF32[Oa/4+g];return c};a.Canvas.prototype.makeSurface=function(c){c=this._makeSurface(c);c.Nd=this.Nd;return c};a.Canvas.prototype.readPixels=function(c,g,l,r,y){a.Pd(this.Nd);return d(this,c,g,l,r,y)};a.Canvas.prototype.saveLayer=function(c,g,l,r){g=S(g);return this._saveLayer(c||null,g,l||null,r||0)};a.Canvas.prototype.writePixels=function(c,g,l,r, y,B,J,N){if(c.byteLength%(g*l))throw"pixels length must be a multiple of the srcWidth * srcHeight";a.Pd(this.Nd);var L=c.byteLength/(g*l);B=B||a.AlphaType.Unpremul;J=J||a.ColorType.RGBA_8888;N=N||a.ColorSpace.SRGB;var W=L*g;L=v(c,"HEAPU8");g=this._writePixels({width:g,height:l,colorType:J,alphaType:B,colorSpace:N},L,W,r,y);q(L,c);return g};a.ColorFilter.MakeBlend=function(c,g,l){c=z(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=v(c,"HEAPF32"),l=a.ColorFilter._makeMatrix(g);q(g,c);return l};a.ContourMeasure.prototype.getPosTan=function(c,g){this._getPosTan(c,ha);c=sa.toTypedArray();return g?(g.set(c),g):c.slice()};a.ImageFilter.MakeDropShadow=function(c,g,l,r,y,B){y=z(y,Ua);return a.ImageFilter._MakeDropShadow(c,g,l,r,y,B)};a.ImageFilter.MakeDropShadowOnly=function(c,g,l,r,y,B){y=z(y,Ua);return a.ImageFilter._MakeDropShadowOnly(c,g,l,r,y,B)};a.ImageFilter.MakeImage=function(c,g, l,r){l=S(l,ha);r=S(r,Pa);if("B"in g&&"C"in g)return a.ImageFilter._MakeImageCubic(c,g.B,g.C,l,r);const y=g.filter;let B=a.MipmapMode.None;"mipmap"in g&&(B=g.mipmap);return a.ImageFilter._MakeImageOptions(c,y,B,l,r)};a.ImageFilter.MakeMatrixTransform=function(c,g,l){c=H(c);if("B"in g&&"C"in g)return a.ImageFilter._MakeMatrixTransformCubic(c,g.B,g.C,l);const r=g.filter;let y=a.MipmapMode.None;"mipmap"in g&&(y=g.mipmap);return a.ImageFilter._MakeMatrixTransformOptions(c,r,y,l)};a.Paint.prototype.getColor= function(){this._getColor(Ua);return V(Ua)};a.Paint.prototype.setColor=function(c,g){g=g||null;c=z(c);this._setColor(c,g)};a.Paint.prototype.setColorComponents=function(c,g,l,r,y){y=y||null;c=P(c,g,l,r);this._setColor(c,y)};a.Path.prototype.getPoint=function(c,g){this._getPoint(c,ha);c=sa.toTypedArray();return g?(g[0]=c[0],g[1]=c[1],g):c.slice(0,2)};a.Picture.prototype.makeShader=function(c,g,l,r,y){r=H(r);y=S(y);return this._makeShader(c,g,l,r,y)};a.PictureRecorder.prototype.beginRecording=function(c){c= S(c);return this._beginRecording(c)};a.Surface.prototype.getCanvas=function(){var c=this._getCanvas();c.Nd=this.Nd;return c};a.Surface.prototype.makeImageSnapshot=function(c){a.Pd(this.Nd);c=v(c,"HEAP32",xb);return this._makeImageSnapshot(c)};a.Surface.prototype.makeSurface=function(c){a.Pd(this.Nd);c=this._makeSurface(c);c.Nd=this.Nd;return c};a.Surface.prototype.Ef=function(c,g){this.Ie||(this.Ie=this.getCanvas());requestAnimationFrame(function(){a.Pd(this.Nd);c(this.Ie);this.flush(g)}.bind(this))}; a.Surface.prototype.requestAnimationFrame||(a.Surface.prototype.requestAnimationFrame=a.Surface.prototype.Ef);a.Surface.prototype.Af=function(c,g){this.Ie||(this.Ie=this.getCanvas());requestAnimationFrame(function(){a.Pd(this.Nd);c(this.Ie);this.flush(g);this.dispose()}.bind(this))};a.Surface.prototype.drawOnce||(a.Surface.prototype.drawOnce=a.Surface.prototype.Af);a.PathEffect.MakeDash=function(c,g){g||(g=0);if(!c.length||1===c.length%2)throw"Intervals array must have even length";var l=v(c,"HEAPF32"); g=a.PathEffect._MakeDash(l,c.length,g);q(l,c);return g};a.PathEffect.MakeLine2D=function(c,g){g=H(g);return a.PathEffect._MakeLine2D(c,g)};a.PathEffect.MakePath2D=function(c,g){c=H(c);return a.PathEffect._MakePath2D(c,g)};a.Shader.MakeColor=function(c,g){g=g||null;c=z(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,r,y,B,J,N){N=N||null;var L=D(l),W=v(r,"HEAPF32");J=J||0;B=H(B);var t=sa.toTypedArray(); t.set(c);t.set(g,2);c=a.Shader._MakeLinearGradient(ha,L.de,L.colorType,W,L.count,y,J,B,N);q(L.de,l);r&&q(W,r);return c};a.Shader.MakeRadialGradient=function(c,g,l,r,y,B,J,N){N=N||null;var L=D(l),W=v(r,"HEAPF32");J=J||0;B=H(B);c=a.Shader._MakeRadialGradient(c[0],c[1],g,L.de,L.colorType,W,L.count,y,J,B,N);q(L.de,l);r&&q(W,r);return c};a.Shader.MakeSweepGradient=function(c,g,l,r,y,B,J,N,L,W){W=W||null;var t=D(l),F=v(r,"HEAPF32");J=J||0;N=N||0;L=L||360;B=H(B);c=a.Shader._MakeSweepGradient(c,g,t.de,t.colorType, F,t.count,y,N,L,J,B,W);q(t.de,l);r&&q(F,r);return c};a.Shader.MakeTwoPointConicalGradient=function(c,g,l,r,y,B,J,N,L,W){W=W||null;var t=D(y),F=v(B,"HEAPF32");L=L||0;N=H(N);var Q=sa.toTypedArray();Q.set(c);Q.set(l,2);c=a.Shader._MakeTwoPointConicalGradient(ha,g,r,t.de,t.colorType,F,t.count,J,L,N,W);q(t.de,y);B&&q(F,B);return c};a.Vertices.prototype.bounds=function(c){this._bounds(ha);var g=sa.toTypedArray();return c?(c.set(g),c):g.slice()};a.Sd&&a.Sd.forEach(function(c){c()})};a.computeTonalColors= function(d){var c=v(d.ambient,"HEAPF32"),g=v(d.spot,"HEAPF32");this._computeTonalColors(c,g);var l={ambient:V(c),spot:V(g)};q(c,d.ambient);q(g,d.spot);return l};a.LTRBRect=function(d,c,g,l){return Float32Array.of(d,c,g,l)};a.XYWHRect=function(d,c,g,l){return Float32Array.of(d,c,d+g,c+l)};a.LTRBiRect=function(d,c,g,l){return Int32Array.of(d,c,g,l)};a.XYWHiRect=function(d,c,g,l){return Int32Array.of(d,c,d+g,c+l)};a.RRectXY=function(d,c,g){return Float32Array.of(d[0],d[1],d[2],d[3],c,g,c,g,c,g,c,g)}; a.MakeAnimatedImageFromEncoded=function(d){d=new Uint8Array(d);var c=a._malloc(d.byteLength);a.HEAPU8.set(d,c);return(d=a._decodeAnimatedImage(c,d.byteLength))?d:null};a.MakeImageFromEncoded=function(d){d=new Uint8Array(d);var c=a._malloc(d.byteLength);a.HEAPU8.set(d,c);return(d=a._decodeImage(c,d.byteLength))?d:null};var ib=null;a.MakeImageFromCanvasImageSource=function(d){var c=d.width,g=d.height;ib||(ib=document.createElement("canvas"));ib.width=c;ib.height=g;var l=ib.getContext("2d",{xg:!0}); l.drawImage(d,0,0);d=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},d.data,4*c)};a.MakeImage=function(d,c,g){var l=a._malloc(c.length);a.HEAPU8.set(c,l);return a._MakeImage(d,l,c.length,g)};a.MakeVertices=function(d,c,g,l,r,y){var B=r&&r.length||0,J=0;g&&g.length&&(J|=1);l&&l.length&&(J|=2);void 0===y||y||(J|=4);d=new a._VerticesBuilder(d,c.length/2,B,J);v(c,"HEAPF32",d.positions());d.texCoords()&& v(g,"HEAPF32",d.texCoords());d.colors()&&v(m(l),"HEAPU32",d.colors());d.indices()&&v(r,"HEAPU16",d.indices());return d.detach()};a.Matrix={};a.Matrix.identity=function(){return e(3)};a.Matrix.invert=function(d){var c=d[0]*d[4]*d[8]+d[1]*d[5]*d[6]+d[2]*d[3]*d[7]-d[2]*d[4]*d[6]-d[1]*d[3]*d[8]-d[0]*d[5]*d[7];return c?[(d[4]*d[8]-d[5]*d[7])/c,(d[2]*d[7]-d[1]*d[8])/c,(d[1]*d[5]-d[2]*d[4])/c,(d[5]*d[6]-d[3]*d[8])/c,(d[0]*d[8]-d[2]*d[6])/c,(d[2]*d[3]-d[0]*d[5])/c,(d[3]*d[7]-d[4]*d[6])/c,(d[1]*d[6]-d[0]* d[7])/c,(d[0]*d[4]-d[1]*d[3])/c]:null};a.Matrix.mapPoints=function(d,c){for(var g=0;g<c.length;g+=2){var l=c[g],r=c[g+1],y=d[6]*l+d[7]*r+d[8],B=d[3]*l+d[4]*r+d[5];c[g]=(d[0]*l+d[1]*r+d[2])/y;c[g+1]=B/y}return c};a.Matrix.multiply=function(){return hb(3,arguments)};a.Matrix.rotated=function(d,c,g){c=c||0;g=g||0;var l=Math.sin(d);d=Math.cos(d);return[d,-l,ya(l,g,1-d,c),l,d,ya(-l,c,1-d,g),0,0,1]};a.Matrix.scaled=function(d,c,g,l){g=g||0;l=l||0;var r=b([d,c],e(3),3,0,1);return b([g-d*g,l-c*l],r,3,2,0)}; a.Matrix.skewed=function(d,c,g,l){g=g||0;l=l||0;var r=b([d,c],e(3),3,1,-1);return b([-d*g,-c*l],r,3,2,0)};a.Matrix.translated=function(d,c){return b(arguments,e(3),3,2,0)};a.Vector={};a.Vector.dot=function(d,c){return d.map(function(g,l){return g*c[l]}).reduce(function(g,l){return g+l})};a.Vector.lengthSquared=function(d){return a.Vector.dot(d,d)};a.Vector.length=function(d){return Math.sqrt(a.Vector.lengthSquared(d))};a.Vector.mulScalar=function(d,c){return d.map(function(g){return g*c})};a.Vector.add= function(d,c){return d.map(function(g,l){return g+c[l]})};a.Vector.sub=function(d,c){return d.map(function(g,l){return g-c[l]})};a.Vector.dist=function(d,c){return a.Vector.length(a.Vector.sub(d,c))};a.Vector.normalize=function(d){return a.Vector.mulScalar(d,1/a.Vector.length(d))};a.Vector.cross=function(d,c){return[d[1]*c[2]-d[2]*c[1],d[2]*c[0]-d[0]*c[2],d[0]*c[1]-d[1]*c[0]]};a.M44={};a.M44.identity=function(){return e(4)};a.M44.translated=function(d){return b(d,e(4),4,3,0)};a.M44.scaled=function(d){return b(d, e(4),4,0,1)};a.M44.rotated=function(d,c){return a.M44.rotatedUnitSinCos(a.Vector.normalize(d),Math.sin(c),Math.cos(c))};a.M44.rotatedUnitSinCos=function(d,c,g){var l=d[0],r=d[1];d=d[2];var y=1-g;return[y*l*l+g,y*l*r-c*d,y*l*d+c*r,0,y*l*r+c*d,y*r*r+g,y*r*d-c*l,0,y*l*d-c*r,y*r*d+c*l,y*d*d+g,0,0,0,0,1]};a.M44.lookat=function(d,c,g){c=a.Vector.normalize(a.Vector.sub(c,d));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(d,l,4,3,0);d=a.M44.invert(l);return null===d?a.M44.identity():d};a.M44.perspective=function(d,c,g){var l=1/(c-d);g/=2;g=Math.cos(g)/Math.sin(g);return[g,0,0,0,0,g,0,0,0,0,(c+d)*l,2*c*d*l,0,0,-1,1]};a.M44.rc=function(d,c,g){return d[4*c+g]};a.M44.multiply=function(){return hb(4,arguments)};a.M44.invert=function(d){var c=d[0],g=d[4],l=d[8],r=d[12],y=d[1],B=d[5],J=d[9],N=d[13],L=d[2],W=d[6],t=d[10],F=d[14],Q=d[3],Y=d[7],ja=d[11];d=d[15];var la=c*B-g*y,qa=c*J- l*y,ta=c*N-r*y,ba=g*J-l*B,I=g*N-r*B,k=l*N-r*J,p=L*Y-W*Q,A=L*ja-t*Q,C=L*d-F*Q,E=W*ja-t*Y,G=W*d-F*Y,M=t*d-F*ja,ca=la*M-qa*G+ta*E+ba*C-I*A+k*p,da=1/ca;if(0===ca||Infinity===da)return null;la*=da;qa*=da;ta*=da;ba*=da;I*=da;k*=da;p*=da;A*=da;C*=da;E*=da;G*=da;M*=da;c=[B*M-J*G+N*E,J*C-y*M-N*A,y*G-B*C+N*p,B*A-y*E-J*p,l*G-g*M-r*E,c*M-l*C+r*A,g*C-c*G-r*p,c*E-g*A+l*p,Y*k-ja*I+d*ba,ja*ta-Q*k-d*qa,Q*I-Y*ta+d*la,Y*qa-Q*ba-ja*la,t*I-W*k-F*ba,L*k-t*ta+F*qa,W*ta-L*I-F*la,L*ba-W*qa+t*la];return c.every(function(Ia){return!isNaN(Ia)&& Infinity!==Ia&&-Infinity!==Ia})?c:null};a.M44.transpose=function(d){return[d[0],d[4],d[8],d[12],d[1],d[5],d[9],d[13],d[2],d[6],d[10],d[14],d[3],d[7],d[11],d[15]]};a.M44.mustInvert=function(d){d=a.M44.invert(d);if(null===d)throw"Matrix not invertible";return d};a.M44.setupCamera=function(d,c,g){var l=a.M44.lookat(g.eye,g.coa,g.up);g=a.M44.perspective(g.near,g.far,g.angle);c=[(d[2]-d[0])/2,(d[3]-d[1])/2,c];d=a.M44.multiply(a.M44.translated([(d[0]+d[2])/2,(d[1]+d[3])/2,0]),a.M44.scaled(c));return a.M44.multiply(d, g,l,a.M44.mustInvert(d))};a.ColorMatrix={};a.ColorMatrix.identity=function(){var d=new Float32Array(20);d[0]=1;d[6]=1;d[12]=1;d[18]=1;return d};a.ColorMatrix.scaled=function(d,c,g,l){var r=new Float32Array(20);r[0]=d;r[6]=c;r[12]=g;r[18]=l;return r};var zd=[[6,7,11,12],[0,10,2,12],[0,1,5,6]];a.ColorMatrix.rotated=function(d,c,g){var l=a.ColorMatrix.identity();d=zd[d];l[d[0]]=g;l[d[1]]=c;l[d[2]]=-c;l[d[3]]=g;return l};a.ColorMatrix.postTranslate=function(d,c,g,l,r){d[4]+=c;d[9]+=g;d[14]+=l;d[19]+= r;return d};a.ColorMatrix.concat=function(d,c){for(var g=new Float32Array(20),l=0,r=0;20>r;r+=5){for(var y=0;4>y;y++)g[l++]=d[r]*c[y]+d[r+1]*c[y+5]+d[r+2]*c[y+10]+d[r+3]*c[y+15];g[l++]=d[r]*c[4]+d[r+1]*c[9]+d[r+2]*c[14]+d[r+3]*c[19]+d[r+4]}return g};(function(d){d.Sd=d.Sd||[];d.Sd.push(function(){function c(t){if(!t||!t.length)return[];for(var F=[],Q=0;Q<t.length;Q+=5){var Y=d.LTRBRect(t[Q],t[Q+1],t[Q+2],t[Q+3]);Y.direction=0===t[Q+4]?d.TextDirection.RTL:d.TextDirection.LTR;F.push(Y)}d._free(t.byteOffset); return F}function g(t){t=t||{};void 0===t.weight&&(t.weight=d.FontWeight.Normal);t.width=t.width||d.FontWidth.Normal;t.slant=t.slant||d.FontSlant.Upright;return t}function l(t){if(!t||!t.length)return U;for(var F=[],Q=0;Q<t.length;Q++){var Y=r(t[Q]);F.push(Y)}return v(F,"HEAPU32")}function r(t){if(J[t])return J[t];var F=oa(t)+1,Q=d._malloc(F);pa(t,K,Q,F);return J[t]=Q}function y(t){t._colorPtr=z(t.color);t._foregroundColorPtr=U;t._backgroundColorPtr=U;t._decorationColorPtr=U;t.foregroundColor&&(t._foregroundColorPtr= z(t.foregroundColor,N));t.backgroundColor&&(t._backgroundColorPtr=z(t.backgroundColor,L));t.decorationColor&&(t._decorationColorPtr=z(t.decorationColor,W));Array.isArray(t.fontFamilies)&&t.fontFamilies.length?(t._fontFamiliesPtr=l(t.fontFamilies),t._fontFamiliesLen=t.fontFamilies.length):(t._fontFamiliesPtr=U,t._fontFamiliesLen=0);if(t.locale){var F=t.locale;t._localePtr=r(F);t._localeLen=oa(F)+1}else t._localePtr=U,t._localeLen=0;if(Array.isArray(t.shadows)&&t.shadows.length){F=t.shadows;var Q=F.map(function(ba){return ba.color|| d.BLACK}),Y=F.map(function(ba){return ba.blurRadius||0});t._shadowLen=F.length;for(var ja=d._malloc(8*F.length),la=ja/4,qa=0;qa<F.length;qa++){var ta=F[qa].offset||[0,0];d.HEAPF32[la]=ta[0];d.HEAPF32[la+1]=ta[1];la+=2}t._shadowColorsPtr=D(Q).de;t._shadowOffsetsPtr=ja;t._shadowBlurRadiiPtr=v(Y,"HEAPF32")}else t._shadowLen=0,t._shadowColorsPtr=U,t._shadowOffsetsPtr=U,t._shadowBlurRadiiPtr=U;Array.isArray(t.fontFeatures)&&t.fontFeatures.length?(F=t.fontFeatures,Q=F.map(function(ba){return ba.name}), Y=F.map(function(ba){return ba.value}),t._fontFeatureLen=F.length,t._fontFeatureNamesPtr=l(Q),t._fontFeatureValuesPtr=v(Y,"HEAPU32")):(t._fontFeatureLen=0,t._fontFeatureNamesPtr=U,t._fontFeatureValuesPtr=U);Array.isArray(t.fontVariations)&&t.fontVariations.length?(F=t.fontVariations,Q=F.map(function(ba){return ba.axis}),Y=F.map(function(ba){return ba.value}),t._fontVariationLen=F.length,t._fontVariationAxesPtr=l(Q),t._fontVariationValuesPtr=v(Y,"HEAPF32")):(t._fontVariationLen=0,t._fontVariationAxesPtr= U,t._fontVariationValuesPtr=U)}function B(t){d._free(t._fontFamiliesPtr);d._free(t._shadowColorsPtr);d._free(t._shadowOffsetsPtr);d._free(t._shadowBlurRadiiPtr);d._free(t._fontFeatureNamesPtr);d._free(t._fontFeatureValuesPtr)}d.Paragraph.prototype.getRectsForRange=function(t,F,Q,Y){t=this._getRectsForRange(t,F,Q,Y);return c(t)};d.Paragraph.prototype.getRectsForPlaceholders=function(){var t=this._getRectsForPlaceholders();return c(t)};d.TypefaceFontProvider.prototype.registerFont=function(t,F){t=d.Typeface.MakeFreeTypeFaceFromData(t); if(!t)return null;F=r(F);this._registerFont(t,F)};d.ParagraphStyle=function(t){t.disableHinting=t.disableHinting||!1;if(t.ellipsis){var F=t.ellipsis;t._ellipsisPtr=r(F);t._ellipsisLen=oa(F)+1}else t._ellipsisPtr=U,t._ellipsisLen=0;null==t.heightMultiplier&&(t.heightMultiplier=-1);t.maxLines=t.maxLines||0;t.replaceTabCharacters=t.replaceTabCharacters||!1;F=(F=t.strutStyle)||{};F.strutEnabled=F.strutEnabled||!1;F.strutEnabled&&Array.isArray(F.fontFamilies)&&F.fontFamilies.length?(F._fontFamiliesPtr= l(F.fontFamilies),F._fontFamiliesLen=F.fontFamilies.length):(F._fontFamiliesPtr=U,F._fontFamiliesLen=0);F.fontStyle=g(F.fontStyle);null==F.fontSize&&(F.fontSize=-1);null==F.heightMultiplier&&(F.heightMultiplier=-1);F.halfLeading=F.halfLeading||!1;F.leading=F.leading||0;F.forceStrutHeight=F.forceStrutHeight||!1;t.strutStyle=F;t.textAlign=t.textAlign||d.TextAlign.Start;t.textDirection=t.textDirection||d.TextDirection.LTR;t.textHeightBehavior=t.textHeightBehavior||d.TextHeightBehavior.All;t.textStyle= d.TextStyle(t.textStyle);return t};d.TextStyle=function(t){t.color||(t.color=d.BLACK);t.decoration=t.decoration||0;t.decorationThickness=t.decorationThickness||0;t.decorationStyle=t.decorationStyle||d.DecorationStyle.Solid;t.textBaseline=t.textBaseline||d.TextBaseline.Alphabetic;null==t.fontSize&&(t.fontSize=-1);t.letterSpacing=t.letterSpacing||0;t.wordSpacing=t.wordSpacing||0;null==t.heightMultiplier&&(t.heightMultiplier=-1);t.halfLeading=t.halfLeading||!1;t.fontStyle=g(t.fontStyle);return t};var J= {},N=d._malloc(16),L=d._malloc(16),W=d._malloc(16);d.ParagraphBuilder.Make=function(t,F){y(t.textStyle);F=d.ParagraphBuilder._Make(t,F);B(t.textStyle);return F};d.ParagraphBuilder.MakeFromFontProvider=function(t,F){y(t.textStyle);F=d.ParagraphBuilder._MakeFromFontProvider(t,F);B(t.textStyle);return F};d.ParagraphBuilder.ShapeText=function(t,F,Q){let Y=0;for(const ja of F)Y+=ja.length;if(Y!==t.length)throw"Accumulated block lengths must equal text.length";return d.ParagraphBuilder._ShapeText(t,F,Q)}; d.ParagraphBuilder.prototype.pushStyle=function(t){y(t);this._pushStyle(t);B(t)};d.ParagraphBuilder.prototype.pushPaintStyle=function(t,F,Q){y(t);this._pushPaintStyle(t,F,Q);B(t)};d.ParagraphBuilder.prototype.addPlaceholder=function(t,F,Q,Y,ja){Q=Q||d.PlaceholderAlignment.Baseline;Y=Y||d.TextBaseline.Alphabetic;this._addPlaceholder(t||0,F||0,Q,Y,ja||0)};d.ParagraphBuilder.prototype.buildWithClientInfo=function(t,F,Q,Y){var ja=v(t,"HEAPU32"),la=v(F,"HEAPU32"),qa=v(Q,"HEAPU32"),ta=v(Y,"HEAPU32"),ba= this._buildWithClientInfo(ja,t&&t.length||0,la,F&&F.length||0,qa,Q&&Q.length||0,ta,Y&&Y.length||0);q(ja,t);q(la,F);q(qa,Q);q(ta,Y);return ba}})})(w);a.MakeManagedAnimation=function(d,c,g,l,r){if(!a._MakeManagedAnimation)throw"Not compiled with MakeManagedAnimation";g||(g="");if(!c)return a._MakeManagedAnimation(d,0,U,U,U,g,l,r);for(var y=[],B=[],J=[],N=Object.keys(c||{}),L=0;L<N.length;L++){var W=N[L],t=new Uint8Array(c[W]),F=a._malloc(t.byteLength);a.HEAPU8.set(t,F);B.push(F);J.push(t.byteLength); t=oa(W)+1;F=a._malloc(t);pa(W,K,F,t);y.push(F)}c=v(y,"HEAPU32");B=v(B,"HEAPU32");J=v(J,"HEAPU32");d=a._MakeManagedAnimation(d,N.length,c,B,J,g,l,r);a._free(c);a._free(B);a._free(J);return d};(function(d){d.Sd=d.Sd||[];d.Sd.push(function(){d.Animation.prototype.render=function(c,g){S(g,ha);this._render(c,ha)};d.Animation.prototype.size=function(c){this._size(ha);var g=sa.toTypedArray();return c?(c[0]=g[0],c[1]=g[1],c):g.slice(0,2)};d.ManagedAnimation&&(d.ManagedAnimation.prototype.render=function(c, g){S(g,ha);this._render(c,ha)},d.ManagedAnimation.prototype.seek=function(c,g){this._seek(c,ha);c=sa.toTypedArray();return g?(g.set(c),g):c.slice()},d.ManagedAnimation.prototype.seekFrame=function(c,g){this._seekFrame(c,ha);c=sa.toTypedArray();return g?(g.set(c),g):c.slice()},d.ManagedAnimation.prototype.setColor=function(c,g){g=z(g);return this._setColor(c,g)},d.ManagedAnimation.prototype.size=function(c){this._size(ha);var g=sa.toTypedArray();return c?(c[0]=g[0],c[1]=g[1],c):g.slice(0,2)})})})(w); a.MakeParticles=function(d,c){if(!a._MakeParticles)throw"Not compiled with MakeParticles";if(!c)return a._MakeParticles(d,0,U,U,U);for(var g=[],l=[],r=[],y=Object.keys(c||{}),B=0;B<y.length;B++){var J=y[B],N=new Uint8Array(c[J]),L=a._malloc(N.byteLength);a.HEAPU8.set(N,L);l.push(L);r.push(N.byteLength);N=oa(J)+1;L=a._malloc(N);pa(J,K,L,N);g.push(L)}c=v(g,"HEAPU32");l=v(l,"HEAPU32");r=v(r,"HEAPU32");d=a._MakeParticles(d,y.length,c,l,r);a._free(c);a._free(l);a._free(r);return d};a.Sd=a.Sd||[];a.Sd.push(function(){a.ParticleEffect.prototype.uniforms= function(){var d=this._uniformPtr(),c=this.getUniformFloatCount();return!d||0>=c?new Float32Array:new Float32Array(a.HEAPU8.buffer,d,c)};a.ParticleEffect.prototype.setPosition=function(d){this._setPosition(d[0],d[1])}});a.Sd=a.Sd||[];a.Sd.push(function(){a.Path.prototype.op=function(d,c){return this._op(d,c)?this:null};a.Path.prototype.simplify=function(){return this._simplify()?this:null}});a.Sd=a.Sd||[];a.Sd.push(function(){a.Canvas.prototype.drawText=function(d,c,g,l,r){var y=oa(d),B=a._malloc(y+ 1);pa(d,K,B,y+1);this._drawSimpleText(B,y,c,g,r,l);a._free(B)};a.Canvas.prototype.drawGlyphs=function(d,c,g,l,r,y){if(!(2*d.length<=c.length))throw"Not enough positions for the array of gyphs";a.Pd(this.Nd);const B=v(d,"HEAPU16"),J=v(c,"HEAPF32");this._drawGlyphs(d.length,B,J,g,l,r,y);q(J,c);q(B,d)};a.Font.prototype.getGlyphBounds=function(d,c,g){var l=v(d,"HEAPU16"),r=a._malloc(16*d.length);this._getGlyphWidthBounds(l,d.length,U,r,c||null);c=new Float32Array(a.HEAPU8.buffer,r,4*d.length);q(l,d); if(g)return g.set(c),a._free(r),g;d=Float32Array.from(c);a._free(r);return d};a.Font.prototype.getGlyphIDs=function(d,c,g){c||(c=d.length);var l=oa(d)+1,r=a._malloc(l);pa(d,K,r,l);d=a._malloc(2*c);c=this._getGlyphIDs(r,l-1,c,d);a._free(r);if(0>c)return a._free(d),null;r=new Uint16Array(a.HEAPU8.buffer,d,c);if(g)return g.set(r),a._free(d),g;g=Uint16Array.from(r);a._free(d);return g};a.Font.prototype.getGlyphIntercepts=function(d,c,g,l){var r=v(d,"HEAPU16"),y=v(c,"HEAPF32");return this._getGlyphIntercepts(r, d.length,!(d&&d._ck),y,c.length,!(c&&c._ck),g,l)};a.Font.prototype.getGlyphWidths=function(d,c,g){var l=v(d,"HEAPU16"),r=a._malloc(4*d.length);this._getGlyphWidthBounds(l,d.length,r,U,c||null);c=new Float32Array(a.HEAPU8.buffer,r,d.length);q(l,d);if(g)return g.set(c),a._free(r),g;d=Float32Array.from(c);a._free(r);return d};a.FontMgr.FromData=function(){if(!arguments.length)return null;var d=arguments;1===d.length&&Array.isArray(d[0])&&(d=arguments[0]);if(!d.length)return null;for(var c=[],g=[],l= 0;l<d.length;l++){var r=new Uint8Array(d[l]),y=v(r,"HEAPU8");c.push(y);g.push(r.byteLength)}c=v(c,"HEAPU32");g=v(g,"HEAPU32");d=a.FontMgr._fromData(c,g,d.length);a._free(c);a._free(g);return d};a.Typeface.MakeFreeTypeFaceFromData=function(d){d=new Uint8Array(d);var c=v(d,"HEAPU8");return(d=a.Typeface._MakeFreeTypeFaceFromData(c,d.byteLength))?d:null};a.Typeface.prototype.getGlyphIDs=function(d,c,g){c||(c=d.length);var l=oa(d)+1,r=a._malloc(l);pa(d,K,r,l);d=a._malloc(2*c);c=this._getGlyphIDs(r,l-1, c,d);a._free(r);if(0>c)return a._free(d),null;r=new Uint16Array(a.HEAPU8.buffer,d,c);if(g)return g.set(r),a._free(d),g;g=Uint16Array.from(r);a._free(d);return g};a.TextBlob.MakeOnPath=function(d,c,g,l){if(d&&d.length&&c&&c.countPoints()){if(1===c.countPoints())return this.MakeFromText(d,g);l||(l=0);var r=g.getGlyphIDs(d);r=g.getGlyphWidths(r);var y=[];c=new a.ContourMeasureIter(c,!1,1);for(var B=c.next(),J=new Float32Array(4),N=0;N<d.length&&B;N++){var L=r[N];l+=L/2;if(l>B.length()){B.delete();B= c.next();if(!B){d=d.substring(0,N);break}l=L/2}B.getPosTan(l,J);var W=J[2],t=J[3];y.push(W,t,J[0]-L/2*W,J[1]-L/2*t);l+=L/2}d=this.MakeFromRSXform(d,y,g);B&&B.delete();c.delete();return d}};a.TextBlob.MakeFromRSXform=function(d,c,g){var l=oa(d)+1,r=a._malloc(l);pa(d,K,r,l);d=v(c,"HEAPF32");g=a.TextBlob._MakeFromRSXform(r,l-1,d,g);a._free(r);return g?g:null};a.TextBlob.MakeFromRSXformGlyphs=function(d,c,g){var l=v(d,"HEAPU16");c=v(c,"HEAPF32");g=a.TextBlob._MakeFromRSXformGlyphs(l,2*d.length,c,g);q(l, d);return g?g:null};a.TextBlob.MakeFromGlyphs=function(d,c){var g=v(d,"HEAPU16");c=a.TextBlob._MakeFromGlyphs(g,2*d.length,c);q(g,d);return c?c:null};a.TextBlob.MakeFromText=function(d,c){var g=oa(d)+1,l=a._malloc(g);pa(d,K,l,g);d=a.TextBlob._MakeFromText(l,g-1,c);a._free(l);return d?d:null};a.MallocGlyphIDs=function(d){return a.Malloc(Uint16Array,d)}});a.Sd=a.Sd||[];a.Sd.push(function(){a.MakePicture=function(d){d=new Uint8Array(d);var c=a._malloc(d.byteLength);a.HEAPU8.set(d,c);return(d=a._MakePicture(c, d.byteLength))?d:null}});a.Sd=a.Sd||[];a.Sd.push(function(){a.RuntimeEffect.Make=function(d,c){return a.RuntimeEffect._Make(d,{onError:c||function(g){console.log("RuntimeEffect error",g)}})};a.RuntimeEffect.prototype.makeShader=function(d,c){var g=!d._ck,l=v(d,"HEAPF32");c=H(c);return this._makeShader(l,4*d.length,g,c)};a.RuntimeEffect.prototype.makeShaderWithChildren=function(d,c,g){var l=!d._ck,r=v(d,"HEAPF32");g=H(g);for(var y=[],B=0;B<c.length;B++)y.push(c[B].Md.Vd);c=v(y,"HEAPU32");return this._makeShaderWithChildren(r, 4*d.length,l,c,y.length,g)}});(function(){function d(I){for(var k=0;k<I.length;k++)if(void 0!==I[k]&&!Number.isFinite(I[k]))return!1;return!0}function c(I){var k=a.getColorComponents(I);I=k[0];var p=k[1],A=k[2];k=k[3];if(1===k)return I=I.toString(16).toLowerCase(),p=p.toString(16).toLowerCase(),A=A.toString(16).toLowerCase(),I=1===I.length?"0"+I:I,p=1===p.length?"0"+p:p,A=1===A.length?"0"+A:A,"#"+I+p+A;k=0===k||1===k?k:k.toFixed(8);return"rgba("+I+", "+p+", "+A+", "+k+")"}function g(I){return a.parseColorString(I, qa)}function l(I){I=ta.exec(I);if(!I)return null;var k=parseFloat(I[4]),p=16;switch(I[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:I[1],variant:I[2],weight:I[3],sizePx:p,family:I[6].trim()}}function r(I){this.Od=I;this.Rd=new a.Paint;this.Rd.setAntiAlias(!0);this.Rd.setStrokeMiter(10);this.Rd.setStrokeCap(a.StrokeCap.Butt); this.Rd.setStrokeJoin(a.StrokeJoin.Miter);this.Re="10px monospace";this.oe=new a.Font(null,10);this.oe.setSubpixel(!0);this.ce=this.ie=a.BLACK;this.xe=0;this.Ke=a.TRANSPARENT;this.ze=this.ye=0;this.Le=this.le=1;this.Je=0;this.we=[];this.Qd=a.BlendMode.SrcOver;this.Rd.setStrokeWidth(this.Le);this.Rd.setBlendMode(this.Qd);this.Ud=new a.Path;this.Wd=a.Matrix.identity();this.nf=[];this.De=[];this.ne=function(){this.Ud.delete();this.Rd.delete();this.oe.delete();this.De.forEach(function(k){k.ne()})};Object.defineProperty(this, "currentTransform",{enumerable:!0,get:function(){return{a:this.Wd[0],c:this.Wd[1],e:this.Wd[2],b:this.Wd[3],d:this.Wd[4],f:this.Wd[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.ce)?c(this.ce):this.ce},set:function(k){"string"===typeof k?this.ce=g(k):k.ve&&(this.ce=k)}});Object.defineProperty(this,"font",{enumerable:!0,get:function(){return this.Re},set:function(k){var p=l(k),A=p.family;p.typeface= ba[A]?ba[A][(p.style||"normal")+"|"+(p.variant||"normal")+"|"+(p.weight||"normal")]||ba[A]["*"]:null;p&&(this.oe.setSize(p.sizePx),this.oe.setTypeface(p.typeface),this.Re=k)}});Object.defineProperty(this,"globalAlpha",{enumerable:!0,get:function(){return this.le},set:function(k){!isFinite(k)||0>k||1<k||(this.le=k)}});Object.defineProperty(this,"globalCompositeOperation",{enumerable:!0,get:function(){switch(this.Qd){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.Qd=a.BlendMode.SrcOver;break;case "destination-over":this.Qd=a.BlendMode.DstOver;break;case "copy":this.Qd=a.BlendMode.Src;break;case "destination":this.Qd=a.BlendMode.Dst;break;case "clear":this.Qd=a.BlendMode.Clear;break;case "source-in":this.Qd=a.BlendMode.SrcIn;break;case "destination-in":this.Qd=a.BlendMode.DstIn;break;case "source-out":this.Qd=a.BlendMode.SrcOut;break;case "destination-out":this.Qd= a.BlendMode.DstOut;break;case "source-atop":this.Qd=a.BlendMode.SrcATop;break;case "destination-atop":this.Qd=a.BlendMode.DstATop;break