UNPKG

canvaskit-wasm

Version:

A WASM version of Skia's Canvas API

107 lines (105 loc) 132 kB
var CanvasKitInit = (() => { var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename; return ( function(moduleArg = {}) { var w=moduleArg,aa,ba;w.ready=new Promise((a,b)=>{aa=a;ba=b}); (function(a){a.ke=a.ke||[];a.ke.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.de=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,m=a._malloc(h);if(f=a.Surface._makeRasterDirect(f,m,4*b))f.de=null,f.Yf=b,f.Uf=d,f.Wf=h,f.xf=m,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.ee(this.ce);this._flush();if(this.de){var d=new Uint8ClampedArray(a.HEAPU8.buffer,this.xf,this.Wf);d=new ImageData(d,this.Yf,this.Uf);b?this.de.getContext("2d").putImageData(d, 0,0,b[0],b[1],b[2]-b[0],b[3]-b[1]):this.de.getContext("2d").putImageData(d,0,0)}};a.Surface.prototype.dispose=function(){this.xf&&a._free(this.xf);this.delete()};a.ee=a.ee||function(){};a.nf=a.nf||function(){return null}})})(w); (function(a){a.ke=a.ke||[];a.ke.push(function(){function b(n,p,v){return n&&n.hasOwnProperty(p)?n[p]:v}function d(n){var p=ca(da);da[p]=n;return p}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,p,v,E){n.bindTexture(n.TEXTURE_2D,p);E||v.alphaType!==a.AlphaType.Premul||n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);return p}function u(n,p,v){v||p.alphaType!==a.AlphaType.Premul|| n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1);n.bindTexture(n.TEXTURE_2D,null)}a.GetWebGLContext=function(n,p){if(!n)throw"null canvas passed into makeWebGLContext";var v={alpha:b(p,"alpha",1),depth:b(p,"depth",1),stencil:b(p,"stencil",8),antialias:b(p,"antialias",0),premultipliedAlpha:b(p,"premultipliedAlpha",1),preserveDrawingBuffer:b(p,"preserveDrawingBuffer",0),preferLowPowerToHighPerformance:b(p,"preferLowPowerToHighPerformance",0),failIfMajorPerformanceCaveat:b(p,"failIfMajorPerformanceCaveat", 0),enableExtensionsByDefault:b(p,"enableExtensionsByDefault",1),explicitSwapControl:b(p,"explicitSwapControl",0),renderViaOffscreenBackBuffer:b(p,"renderViaOffscreenBackBuffer",0)};v.majorVersion=p&&p.majorVersion?p.majorVersion:"undefined"!==typeof WebGL2RenderingContext?2:1;if(v.explicitSwapControl)throw"explicitSwapControl is not supported";n=ia(n,v);if(!n)return 0;ja(n);A.ye.getExtension("WEBGL_debug_renderer_info");return n};a.deleteContext=function(n){A===ka[n]&&(A=null);"object"==typeof JSEvents&& JSEvents.Qg(ka[n].ye.canvas);ka[n]&&ka[n].ye.canvas&&(ka[n].ye.canvas.Sf=void 0);ka[n]=null};a._setTextureCleanup({deleteTexture:function(n,p){var v=da[p];v&&ka[n].ye.deleteTexture(v);da[p]=null}});a.MakeWebGLContext=function(n){if(!this.ee(n))return null;var p=this._MakeGrContext();if(!p)return null;p.ce=n;var v=p.delete.bind(p);p["delete"]=function(){a.ee(this.ce);v()}.bind(p);return A.Bf=p};a.MakeGrContext=a.MakeWebGLContext;a.GrDirectContext.prototype.getResourceCacheLimitBytes=function(){a.ee(this.ce); this._getResourceCacheLimitBytes()};a.GrDirectContext.prototype.getResourceCacheUsageBytes=function(){a.ee(this.ce);this._getResourceCacheUsageBytes()};a.GrDirectContext.prototype.releaseResourcesAndAbandonContext=function(){a.ee(this.ce);this._releaseResourcesAndAbandonContext()};a.GrDirectContext.prototype.setResourceCacheLimitBytes=function(n){a.ee(this.ce);this._setResourceCacheLimitBytes(n)};a.MakeOnScreenGLSurface=function(n,p,v,E,G,L){if(!this.ee(n.ce))return null;p=void 0===G||void 0===L? this._MakeOnScreenGLSurface(n,p,v,E):this._MakeOnScreenGLSurface(n,p,v,E,G,L);if(!p)return null;p.ce=n.ce;return p};a.MakeRenderTarget=function(){var n=arguments[0];if(!this.ee(n.ce))return null;if(3===arguments.length){var p=this._MakeRenderTargetWH(n,arguments[1],arguments[2]);if(!p)return null}else if(2===arguments.length){if(p=this._MakeRenderTargetII(n,arguments[1]),!p)return null}else return null;p.ce=n.ce;return p};a.MakeWebGLCanvasSurface=function(n,p,v){p=p||null;var E=n,G="undefined"!== typeof OffscreenCanvas&&E instanceof OffscreenCanvas;if(!("undefined"!==typeof HTMLCanvasElement&&E instanceof HTMLCanvasElement||G||(E=document.getElementById(n),E)))throw"Canvas with id "+n+" was not found";n=this.GetWebGLContext(E,v);if(!n||0>n)throw"failed to create webgl context: err "+n;n=this.MakeWebGLContext(n);p=this.MakeOnScreenGLSurface(n,E.width,E.height,p);return p?p:(p=E.cloneNode(!0),E.parentNode.replaceChild(p,E),p.classList.add("ck-replaced"),a.MakeSWCanvasSurface(p))};a.MakeCanvasSurface= a.MakeWebGLCanvasSurface;a.Surface.prototype.makeImageFromTexture=function(n,p){a.ee(this.ce);n=d(n);if(p=this._makeImageFromTexture(this.ce,n,p))p.df=n;return p};a.Surface.prototype.makeImageFromTextureSource=function(n,p,v){p||(p={height:f(n),width:h(n),colorType:a.ColorType.RGBA_8888,alphaType:v?a.AlphaType.Premul:a.AlphaType.Unpremul});p.colorSpace||(p.colorSpace=a.ColorSpace.SRGB);a.ee(this.ce);var E=A.ye;v=m(E,E.createTexture(),p,v);2===A.version?E.texImage2D(E.TEXTURE_2D,0,E.RGBA,p.width,p.height, 0,E.RGBA,E.UNSIGNED_BYTE,n):E.texImage2D(E.TEXTURE_2D,0,E.RGBA,E.RGBA,E.UNSIGNED_BYTE,n);u(E,p);this._resetContext();return this.makeImageFromTexture(v,p)};a.Surface.prototype.updateTextureFromSource=function(n,p,v){if(n.df){a.ee(this.ce);var E=n.getImageInfo(),G=A.ye,L=m(G,da[n.df],E,v);2===A.version?G.texImage2D(G.TEXTURE_2D,0,G.RGBA,h(p),f(p),0,G.RGBA,G.UNSIGNED_BYTE,p):G.texImage2D(G.TEXTURE_2D,0,G.RGBA,G.RGBA,G.UNSIGNED_BYTE,p);u(G,E,v);this._resetContext();da[n.df]=null;n.df=d(L);E.colorSpace= n.getColorSpace();p=this._makeImageFromTexture(this.ce,n.df,E);v=n.be.je;G=n.be.qe;n.be.je=p.be.je;n.be.qe=p.be.qe;p.be.je=v;p.be.qe=G;p.delete();E.colorSpace.delete()}};a.MakeLazyImageFromTextureSource=function(n,p,v){p||(p={height:f(n),width:h(n),colorType:a.ColorType.RGBA_8888,alphaType:v?a.AlphaType.Premul:a.AlphaType.Unpremul});p.colorSpace||(p.colorSpace=a.ColorSpace.SRGB);var E={makeTexture:function(){var G=A,L=G.ye,y=m(L,L.createTexture(),p,v);2===G.version?L.texImage2D(L.TEXTURE_2D,0,L.RGBA, p.width,p.height,0,L.RGBA,L.UNSIGNED_BYTE,n):L.texImage2D(L.TEXTURE_2D,0,L.RGBA,L.RGBA,L.UNSIGNED_BYTE,n);u(L,p,v);return d(y)},freeSrc:function(){}};"VideoFrame"===n.constructor.name&&(E.freeSrc=function(){n.close()});return a.Image._makeFromGenerator(p,E)};a.ee=function(n){return n?ja(n):!1};a.nf=function(){return A&&A.Bf&&!A.Bf.isDeleted()?A.Bf:null}})})(w); (function(a){function b(e,c,g,l,r){for(var x=0;x<e.length;x++)c[x*g+(x*r+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(n(255*e[3])<<24|n(255*e[0])<<16|n(255*e[1])<<8|n(255*e[2])<<0)>>>0}function m(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 u(e){if(void 0===e)return 1;var c=parseFloat(e);return e&&-1!==e.indexOf("%")?c/100:c}function n(e){return Math.round(Math.max(0,Math.min(e||0,255)))}function p(e,c){c&&c._ck||a._free(e)}function v(e,c,g){if(!e||!e.length)return V;if(e&&e._ck)return e.byteOffset;var l=a[c].BYTES_PER_ELEMENT;g||(g=a._malloc(e.length*l));a[c].set(e,g/l);return g}function E(e){var c={ue:V,count:e.length,colorType:a.ColorType.RGBA_F32}; if(e instanceof Float32Array)c.ue=v(e,"HEAPF32"),c.count=e.length/4;else if(e instanceof Uint32Array)c.ue=v(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,r=g/4,x=0;x<e.length;x++)for(var C=0;4>C;C++)a.HEAPF32[r+l]=e[x][C],l++;e=g}else e=V;c.ue=e}else throw"Invalid argument to copyFlexibleColorArray, Not a color array "+typeof e;return c}function G(e){if(!e)return V;var c=Yb.toTypedArray();if(e.length){if(6===e.length|| 9===e.length)return v(e,"HEAPF32",Oa),6===e.length&&a.HEAPF32.set(Hd,6+Oa/4),Oa;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],Oa;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 Oa}function L(e){if(!e)return V;var c=Zb.toTypedArray();if(e.length){if(16!==e.length&&6!==e.length&&9!==e.length)throw"invalid matrix size"; if(16===e.length)return v(e,"HEAPF32",bb);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 bb}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 bb}function y(e,c){return v(e,"HEAPF32",c||Ka)}function M(e, c,g,l){var r=$b.toTypedArray();r[0]=e;r[1]=c;r[2]=g;r[3]=l;return Ka}function T(e){for(var c=new Float32Array(4),g=0;4>g;g++)c[g]=a.HEAPF32[e/4+g];return c}function R(e,c){return v(e,"HEAPF32",c||ea)}function ta(e,c){return v(e,"HEAPF32",c||ac)}function pa(){for(var e=0,c=0;c<arguments.length-1;c+=2)e+=arguments[c]*arguments[c+1];return e}function jb(e,c,g){for(var l=Array(e.length),r=0;r<g;r++)for(var x=0;x<g;x++){for(var C=0,J=0;J<g;J++)C+=e[g*r+J]*c[g*J+x];l[r*g+x]=C}return l}function kb(e,c){for(var g= jb(c[0],c[1],e),l=2;l<c.length;)g=jb(g,c[l],e),l++;return g}a.Color=function(e,c,g,l){void 0===l&&(l=1);return a.Color4f(n(e)/255,n(c)/255,n(g)/255,l)};a.ColorAsInt=function(e,c,g,l){void 0===l&&(l=255);return(n(l)<<24|n(e)<<16|n(c)<<8|n(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 r=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),r=17*parseInt(e.slice(3,4),16)}return a.Color(g, l,r,c/255)}return e.startsWith("rgba")?(e=e.slice(5,-1),e=e.split(","),a.Color(+e[0],+e[1],+e[2],u(e[3]))):e.startsWith("rgb")?(e=e.slice(4,-1),e=e.split(","),a.Color(+e[0],+e[1],+e[2],u(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,Ke:null,subarray:function(l,r){l=this.toTypedArray().subarray(l, r);l._ck=!0;return l},toTypedArray:function(){if(this.Ke&&this.Ke.length)return this.Ke;this.Ke=new e(a.HEAPU8.buffer,g,c);this.Ke._ck=!0;return this.Ke}}};a.Free=function(e){a._free(e.byteOffset);e.byteOffset=V;e.toTypedArray=null;e.Ke=null};var Oa=V,Yb,bb=V,Zb,Ka=V,$b,sa,ea=V,Ac,Pa=V,bc,cb=V,Bc,cc=V,Bb,lb=V,Cc,ac=V,Dc,Ec=V,Hd=Float32Array.of(0,0,1),V=0;a.onRuntimeInitialized=function(){function e(c,g,l,r,x,C,J){C||(C=4*r.width,r.colorType===a.ColorType.RGBA_F16?C*=2:r.colorType===a.ColorType.RGBA_F32&& (C*=4));var N=C*r.height;var P=x?x.byteOffset:a._malloc(N);if(J?!c._readPixels(r,P,C,g,l,J):!c._readPixels(r,P,C,g,l))return x||a._free(P),null;if(x)return x.toTypedArray();switch(r.colorType){case a.ColorType.RGBA_8888:case a.ColorType.RGBA_F16:c=(new Uint8Array(a.HEAPU8.buffer,P,N)).slice();break;case a.ColorType.RGBA_F32:c=(new Float32Array(a.HEAPU8.buffer,P,N)).slice();break;default:return null}a._free(P);return c}$b=a.Malloc(Float32Array,4);Ka=$b.byteOffset;Zb=a.Malloc(Float32Array,16);bb=Zb.byteOffset; Yb=a.Malloc(Float32Array,9);Oa=Yb.byteOffset;Cc=a.Malloc(Float32Array,12);ac=Cc.byteOffset;Dc=a.Malloc(Float32Array,12);Ec=Dc.byteOffset;sa=a.Malloc(Float32Array,4);ea=sa.byteOffset;Ac=a.Malloc(Float32Array,4);Pa=Ac.byteOffset;bc=a.Malloc(Float32Array,3);cb=bc.byteOffset;Bc=a.Malloc(Float32Array,3);cc=Bc.byteOffset;Bb=a.Malloc(Int32Array,4);lb=Bb.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);p(g,c);return l};a.Path.MakeFromVerbsPointsWeights=function(c,g,l){var r=v(c,"HEAPU8"),x=v(g,"HEAPF32"),C=v(l,"HEAPF32"),J=a.Path._MakeFromVerbsPointsWeights(r,c.length,x,g.length,C,l&&l.length||0);p(r,c);p(x,g);p(C,l);return J};a.Path.prototype.addArc=function(c,g,l){c=R(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=R(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);p(l,c);return this};a.Path.prototype.addRect=function(c,g){c=R(c);this._addRect(c,!!g);return this};a.Path.prototype.addRRect=function(c,g){c=ta(c);this._addRRect(c,!!g);return this};a.Path.prototype.addVerbsPointsWeights=function(c,g,l){var r=v(c,"HEAPU8"),x=v(g,"HEAPF32"),C=v(l,"HEAPF32");this._addVerbsPointsWeights(r,c.length,x,g.length,C,l&&l.length||0); p(r,c);p(x,g);p(C,l)};a.Path.prototype.arc=function(c,g,l,r,x,C){c=a.LTRBRect(c-l,g-l,c+l,g+l);x=(x-r)/Math.PI*180-360*!!C;C=new a.Path;C.addArc(c,r/Math.PI*180,x);this.addPath(C,!0);C.delete();return this};a.Path.prototype.arcToOval=function(c,g,l,r){c=R(c);this._arcToOval(c,g,l,r);return this};a.Path.prototype.arcToRotated=function(c,g,l,r,x,C,J){this._arcToRotated(c,g,l,!!r,!!x,C,J);return this};a.Path.prototype.arcToTangent=function(c,g,l,r,x){this._arcToTangent(c,g,l,r,x);return this};a.Path.prototype.close= function(){this._close();return this};a.Path.prototype.conicTo=function(c,g,l,r,x){this._conicTo(c,g,l,r,x);return this};a.Path.prototype.computeTightBounds=function(c){this._computeTightBounds(ea);var g=sa.toTypedArray();return c?(c.set(g),c):g.slice()};a.Path.prototype.cubicTo=function(c,g,l,r,x,C){this._cubicTo(c,g,l,r,x,C);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(ea);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,x,C,J){this._rArcTo(c,g,l,r,x,C,J);return this};a.Path.prototype.rConicTo=function(c,g,l,r,x){this._rConicTo(c,g,l,r,x);return this};a.Path.prototype.rCubicTo= function(c,g,l,r,x,C){this._rCubicTo(c,g,l,r,x,C);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.encodeToBytes=function(c,g){var l= a.nf();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,r,x){x=G(x);return this._makeShaderCubic(c,g,l,r,x)};a.Image.prototype.makeShaderOptions=function(c,g,l,r,x){x=G(x);return this._makeShaderOptions(c,g,l,r,x)};a.Image.prototype.readPixels=function(c,g,l,r,x){var C=a.nf();return e(this,c,g,l,r,x,C)};a.Canvas.prototype.clear=function(c){a.ee(this.ce);c=y(c);this._clear(c)};a.Canvas.prototype.clipRRect= function(c,g,l){a.ee(this.ce);c=ta(c);this._clipRRect(c,g,l)};a.Canvas.prototype.clipRect=function(c,g,l){a.ee(this.ce);c=R(c);this._clipRect(c,g,l)};a.Canvas.prototype.concat=function(c){a.ee(this.ce);c=L(c);this._concat(c)};a.Canvas.prototype.drawArc=function(c,g,l,r,x){a.ee(this.ce);c=R(c);this._drawArc(c,g,l,r,x)};a.Canvas.prototype.drawAtlas=function(c,g,l,r,x,C,J){if(c&&r&&g&&l&&g.length===l.length){a.ee(this.ce);x||(x=a.BlendMode.SrcOver);var N=v(g,"HEAPF32"),P=v(l,"HEAPF32"),Y=l.length/4, W=v(m(C),"HEAPU32");if(J&&"B"in J&&"C"in J)this._drawAtlasCubic(c,P,N,W,Y,x,J.B,J.C,r);else{let t=a.FilterMode.Linear,D=a.MipmapMode.None;J&&(t=J.filter,"mipmap"in J&&(D=J.mipmap));this._drawAtlasOptions(c,P,N,W,Y,x,t,D,r)}p(N,g);p(P,l);p(W,C)}};a.Canvas.prototype.drawCircle=function(c,g,l,r){a.ee(this.ce);this._drawCircle(c,g,l,r)};a.Canvas.prototype.drawColor=function(c,g){a.ee(this.ce);c=y(c);void 0!==g?this._drawColor(c,g):this._drawColor(c)};a.Canvas.prototype.drawColorInt=function(c,g){a.ee(this.ce); this._drawColorInt(c,g||a.BlendMode.SrcOver)};a.Canvas.prototype.drawColorComponents=function(c,g,l,r,x){a.ee(this.ce);c=M(c,g,l,r);void 0!==x?this._drawColor(c,x):this._drawColor(c)};a.Canvas.prototype.drawDRRect=function(c,g,l){a.ee(this.ce);c=ta(c,ac);g=ta(g,Ec);this._drawDRRect(c,g,l)};a.Canvas.prototype.drawImage=function(c,g,l,r){a.ee(this.ce);this._drawImage(c,g,l,r||null)};a.Canvas.prototype.drawImageCubic=function(c,g,l,r,x,C){a.ee(this.ce);this._drawImageCubic(c,g,l,r,x,C||null)};a.Canvas.prototype.drawImageOptions= function(c,g,l,r,x,C){a.ee(this.ce);this._drawImageOptions(c,g,l,r,x,C||null)};a.Canvas.prototype.drawImageNine=function(c,g,l,r,x){a.ee(this.ce);g=v(g,"HEAP32",lb);l=R(l);this._drawImageNine(c,g,l,r,x||null)};a.Canvas.prototype.drawImageRect=function(c,g,l,r,x){a.ee(this.ce);R(g,ea);R(l,Pa);this._drawImageRect(c,ea,Pa,r,!!x)};a.Canvas.prototype.drawImageRectCubic=function(c,g,l,r,x,C){a.ee(this.ce);R(g,ea);R(l,Pa);this._drawImageRectCubic(c,ea,Pa,r,x,C||null)};a.Canvas.prototype.drawImageRectOptions= function(c,g,l,r,x,C){a.ee(this.ce);R(g,ea);R(l,Pa);this._drawImageRectOptions(c,ea,Pa,r,x,C||null)};a.Canvas.prototype.drawLine=function(c,g,l,r,x){a.ee(this.ce);this._drawLine(c,g,l,r,x)};a.Canvas.prototype.drawOval=function(c,g){a.ee(this.ce);c=R(c);this._drawOval(c,g)};a.Canvas.prototype.drawPaint=function(c){a.ee(this.ce);this._drawPaint(c)};a.Canvas.prototype.drawParagraph=function(c,g,l){a.ee(this.ce);this._drawParagraph(c,g,l)};a.Canvas.prototype.drawPatch=function(c,g,l,r,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.ee(this.ce);const C=v(c,"HEAPF32"),J=g?v(m(g),"HEAPU32"):V,N=l?v(l,"HEAPF32"):V;r||(r=a.BlendMode.Modulate);this._drawPatch(C,J,N,r,x);p(N,l);p(J,g);p(C,c)};a.Canvas.prototype.drawPath=function(c,g){a.ee(this.ce);this._drawPath(c,g)};a.Canvas.prototype.drawPicture=function(c){a.ee(this.ce);this._drawPicture(c)};a.Canvas.prototype.drawPoints=function(c,g,l){a.ee(this.ce);var r=v(g,"HEAPF32");this._drawPoints(c, r,g.length/2,l);p(r,g)};a.Canvas.prototype.drawRRect=function(c,g){a.ee(this.ce);c=ta(c);this._drawRRect(c,g)};a.Canvas.prototype.drawRect=function(c,g){a.ee(this.ce);c=R(c);this._drawRect(c,g)};a.Canvas.prototype.drawRect4f=function(c,g,l,r,x){a.ee(this.ce);this._drawRect4f(c,g,l,r,x)};a.Canvas.prototype.drawShadow=function(c,g,l,r,x,C,J){a.ee(this.ce);var N=v(x,"HEAPF32"),P=v(C,"HEAPF32");g=v(g,"HEAPF32",cb);l=v(l,"HEAPF32",cc);this._drawShadow(c,g,l,r,N,P,J);p(N,x);p(P,C)};a.getShadowLocalBounds= function(c,g,l,r,x,C,J){c=G(c);l=v(l,"HEAPF32",cb);r=v(r,"HEAPF32",cc);if(!this._getShadowLocalBounds(c,g,l,r,x,C,ea))return null;g=sa.toTypedArray();return J?(J.set(g),J):g.slice()};a.Canvas.prototype.drawTextBlob=function(c,g,l,r){a.ee(this.ce);this._drawTextBlob(c,g,l,r)};a.Canvas.prototype.drawVertices=function(c,g,l){a.ee(this.ce);this._drawVertices(c,g,l)};a.Canvas.prototype.getDeviceClipBounds=function(c){this._getDeviceClipBounds(lb);var g=Bb.toTypedArray();c?c.set(g):c=g.slice();return c}; a.Canvas.prototype.quickReject=function(c){c=R(c);return this._quickReject(c)};a.Canvas.prototype.getLocalToDevice=function(){this._getLocalToDevice(bb);for(var c=bb,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.ce=this.ce;return c};a.Canvas.prototype.readPixels=function(c,g,l,r,x){a.ee(this.ce); return e(this,c,g,l,r,x)};a.Canvas.prototype.saveLayer=function(c,g,l,r,x){g=R(g);return this._saveLayer(c||null,g,l||null,r||0,x||a.TileMode.Clamp)};a.Canvas.prototype.writePixels=function(c,g,l,r,x,C,J,N){if(c.byteLength%(g*l))throw"pixels length must be a multiple of the srcWidth * srcHeight";a.ee(this.ce);var P=c.byteLength/(g*l);C=C||a.AlphaType.Unpremul;J=J||a.ColorType.RGBA_8888;N=N||a.ColorSpace.SRGB;var Y=P*g;P=v(c,"HEAPU8");g=this._writePixels({width:g,height:l,colorType:J,alphaType:C,colorSpace:N}, P,Y,r,x);p(P,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=v(c,"HEAPF32"),l=a.ColorFilter._makeMatrix(g);p(g,c);return l};a.ContourMeasure.prototype.getPosTan=function(c,g){this._getPosTan(c,ea);c=sa.toTypedArray();return g?(g.set(c),g):c.slice()};a.ImageFilter.prototype.getOutputBounds=function(c,g,l){c=R(c,ea);g=G(g);this._getOutputBounds(c, g,lb);g=Bb.toTypedArray();return l?(l.set(g),l):g.slice()};a.ImageFilter.MakeDropShadow=function(c,g,l,r,x,C){x=y(x,Ka);return a.ImageFilter._MakeDropShadow(c,g,l,r,x,C)};a.ImageFilter.MakeDropShadowOnly=function(c,g,l,r,x,C){x=y(x,Ka);return a.ImageFilter._MakeDropShadowOnly(c,g,l,r,x,C)};a.ImageFilter.MakeImage=function(c,g,l,r){l=R(l,ea);r=R(r,Pa);if("B"in g&&"C"in g)return a.ImageFilter._MakeImageCubic(c,g.B,g.C,l,r);const x=g.filter;let C=a.MipmapMode.None;"mipmap"in g&&(C=g.mipmap);return a.ImageFilter._MakeImageOptions(c, x,C,l,r)};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 r=g.filter;let x=a.MipmapMode.None;"mipmap"in g&&(x=g.mipmap);return a.ImageFilter._MakeMatrixTransformOptions(c,r,x,l)};a.Paint.prototype.getColor=function(){this._getColor(Ka);return T(Ka)};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,r,x){x=x||null;c=M(c,g,l, r);this._setColor(c,x)};a.Path.prototype.getPoint=function(c,g){this._getPoint(c,ea);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,x){r=G(r);x=R(x);return this._makeShader(c,g,l,r,x)};a.Picture.prototype.cullRect=function(c){this._cullRect(ea);var g=sa.toTypedArray();return c?(c.set(g),c):g.slice()};a.PictureRecorder.prototype.beginRecording=function(c,g){c=R(c);return this._beginRecording(c,!!g)};a.Surface.prototype.getCanvas=function(){var c= this._getCanvas();c.ce=this.ce;return c};a.Surface.prototype.makeImageSnapshot=function(c){a.ee(this.ce);c=v(c,"HEAP32",lb);return this._makeImageSnapshot(c)};a.Surface.prototype.makeSurface=function(c){a.ee(this.ce);c=this._makeSurface(c);c.ce=this.ce;return c};a.Surface.prototype.Xf=function(c,g){this.$e||(this.$e=this.getCanvas());return requestAnimationFrame(function(){a.ee(this.ce);c(this.$e);this.flush(g)}.bind(this))};a.Surface.prototype.requestAnimationFrame||(a.Surface.prototype.requestAnimationFrame= a.Surface.prototype.Xf);a.Surface.prototype.Tf=function(c,g){this.$e||(this.$e=this.getCanvas());requestAnimationFrame(function(){a.ee(this.ce);c(this.$e);this.flush(g);this.dispose()}.bind(this))};a.Surface.prototype.drawOnce||(a.Surface.prototype.drawOnce=a.Surface.prototype.Tf);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);p(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,r,x,C,J,N){N=N||null;var P=E(l),Y=v(r,"HEAPF32");J=J||0;C=G(C);var W=sa.toTypedArray();W.set(c);W.set(g,2);c=a.Shader._MakeLinearGradient(ea,P.ue,P.colorType,Y,P.count, x,J,C,N);p(P.ue,l);r&&p(Y,r);return c};a.Shader.MakeRadialGradient=function(c,g,l,r,x,C,J,N){N=N||null;var P=E(l),Y=v(r,"HEAPF32");J=J||0;C=G(C);c=a.Shader._MakeRadialGradient(c[0],c[1],g,P.ue,P.colorType,Y,P.count,x,J,C,N);p(P.ue,l);r&&p(Y,r);return c};a.Shader.MakeSweepGradient=function(c,g,l,r,x,C,J,N,P,Y){Y=Y||null;var W=E(l),t=v(r,"HEAPF32");J=J||0;N=N||0;P=P||360;C=G(C);c=a.Shader._MakeSweepGradient(c,g,W.ue,W.colorType,t,W.count,x,N,P,J,C,Y);p(W.ue,l);r&&p(t,r);return c};a.Shader.MakeTwoPointConicalGradient= function(c,g,l,r,x,C,J,N,P,Y){Y=Y||null;var W=E(x),t=v(C,"HEAPF32");P=P||0;N=G(N);var D=sa.toTypedArray();D.set(c);D.set(l,2);c=a.Shader._MakeTwoPointConicalGradient(ea,g,r,W.ue,W.colorType,t,W.count,J,P,N,Y);p(W.ue,x);C&&p(t,C);return c};a.Vertices.prototype.bounds=function(c){this._bounds(ea);var g=sa.toTypedArray();return c?(c.set(g),c):g.slice()};a.ke&&a.ke.forEach(function(c){c()})};a.computeTonalColors=function(e){var c=v(e.ambient,"HEAPF32"),g=v(e.spot,"HEAPF32");this._computeTonalColors(c, g);var l={ambient:T(c),spot:T(g)};p(c,e.ambient);p(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 mb=null;a.MakeImageFromCanvasImageSource=function(e){var c=e.width,g=e.height;mb||(mb=document.createElement("canvas"));mb.width=c;mb.height=g;var l=mb.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,r,x){var C=r&&r.length||0,J=0;g&&g.length&&(J|=1);l&&l.length&&(J|=2);void 0===x||x||(J|=4);e=new a._VerticesBuilder(e,c.length/2,C,J);v(c,"HEAPF32",e.positions());e.texCoords()&&v(g,"HEAPF32",e.texCoords());e.colors()&&v(m(l),"HEAPU32",e.colors());e.indices()&& v(r,"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],r=c[g+1],x=e[6]*l+e[7]*r+e[8],C=e[3]*l+e[4]*r+e[5];c[g]=(e[0]*l+e[1]*r+e[2])/x;c[g+1]=C/x}return c};a.Matrix.multiply=function(){return kb(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,pa(l,g,1-e,c),l,e,pa(-l,c,1-e,g),0,0,1]};a.Matrix.scaled=function(e,c,g,l){g=g||0;l=l||0;var r=b([e,c],d(3),3,0,1);return b([g-e*g,l-c*l],r,3,2,0)};a.Matrix.skewed=function(e,c,g,l){g=g||0;l=l||0;var r=b([e,c],d(3),3,1,-1);return b([-e* g,-c*l],r,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],r=e[1];e=e[2];var x=1-g;return[x*l*l+g,x*l*r-c*e,x*l*e+c*r,0,x*l*r+c*e,x*r*r+g,x*r*e-c*l,0,x*l*e-c*r,x*r*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 kb(4,arguments)};a.M44.invert=function(e){var c=e[0],g=e[4],l=e[8],r=e[12],x=e[1],C=e[5],J=e[9],N=e[13],P=e[2],Y=e[6],W=e[10],t=e[14],D=e[3],U=e[7],fa=e[11];e=e[15];var la=c*C-g*x,ua=c*J-l*x,ya=c*N-r*x,Fa=g*J-l*C,ha=g*N-r*C,I=l*N-r*J,k=P*U-Y*D,q=P*fa-W*D,z=P*e-t*D,B=Y*fa-W*U,F=Y*e-t*U,H=W* e-t*fa,O=la*H-ua*F+ya*B+Fa*z-ha*q+I*k,Z=1/O;if(0===O||Infinity===Z)return null;la*=Z;ua*=Z;ya*=Z;Fa*=Z;ha*=Z;I*=Z;k*=Z;q*=Z;z*=Z;B*=Z;F*=Z;H*=Z;c=[C*H-J*F+N*B,J*z-x*H-N*q,x*F-C*z+N*k,C*q-x*B-J*k,l*F-g*H-r*B,c*H-l*z+r*q,g*z-c*F-r*k,c*B-g*q+l*k,U*I-fa*ha+e*Fa,fa*ya-D*I-e*ua,D*ha-U*ya+e*la,U*ua-D*Fa-fa*la,W*ha-Y*I-t*Fa,P*I-W*ya+t*ua,Y*ya-P*ha-t*la,P*Fa-Y*ua+W*la];return c.every(function(qa){return!isNaN(qa)&&Infinity!==qa&&-Infinity!==qa})?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 r=new Float32Array(20);r[0]=e;r[6]=c;r[12]=g;r[18]=l;return r};var Id=[[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=Id[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,r){e[4]+=c;e[9]+=g;e[14]+=l;e[19]+=r;return e};a.ColorMatrix.concat=function(e,c){for(var g=new Float32Array(20),l=0,r= 0;20>r;r+=5){for(var x=0;4>x;x++)g[l++]=e[r]*c[x]+e[r+1]*c[x+5]+e[r+2]*c[x+10]+e[r+3]*c[x+15];g[l++]=e[r]*c[4]+e[r+1]*c[9]+e[r+2]*c[14]+e[r+3]*c[19]+e[r+4]}return g};(function(e){e.ke=e.ke||[];e.ke.push(function(){function c(t){t&&(t.dir=0===t.dir?e.TextDirection.RTL:e.TextDirection.LTR);return t}function g(t){if(!t||!t.length)return[];for(var D=[],U=0;U<t.length;U+=5){var fa=e.LTRBRect(t[U],t[U+1],t[U+2],t[U+3]),la=e.TextDirection.LTR;0===t[U+4]&&(la=e.TextDirection.RTL);D.push({rect:fa,dir:la})}e._free(t.byteOffset); return D}function l(t){t=t||{};void 0===t.weight&&(t.weight=e.FontWeight.Normal);t.width=t.width||e.FontWidth.Normal;t.slant=t.slant||e.FontSlant.Upright;return t}function r(t){if(!t||!t.length)return V;for(var D=[],U=0;U<t.length;U++){var fa=x(t[U]);D.push(fa)}return v(D,"HEAPU32")}function x(t){if(N[t])return N[t];var D=ma(t)+1,U=e._malloc(D);na(t,K,U,D);return N[t]=U}function C(t){t._colorPtr=y(t.color);t._foregroundColorPtr=V;t._backgroundColorPtr=V;t._decorationColorPtr=V;t.foregroundColor&& (t._foregroundColorPtr=y(t.foregroundColor,P));t.backgroundColor&&(t._backgroundColorPtr=y(t.backgroundColor,Y));t.decorationColor&&(t._decorationColorPtr=y(t.decorationColor,W));Array.isArray(t.fontFamilies)&&t.fontFamilies.length?(t._fontFamiliesPtr=r(t.fontFamilies),t._fontFamiliesLen=t.fontFamilies.length):(t._fontFamiliesPtr=V,t._fontFamiliesLen=0);if(t.locale){var D=t.locale;t._localePtr=x(D);t._localeLen=ma(D)}else t._localePtr=V,t._localeLen=0;if(Array.isArray(t.shadows)&&t.shadows.length){D= t.shadows;var U=D.map(function(ha){return ha.color||e.BLACK}),fa=D.map(function(ha){return ha.blurRadius||0});t._shadowLen=D.length;for(var la=e._malloc(8*D.length),ua=la/4,ya=0;ya<D.length;ya++){var Fa=D[ya].offset||[0,0];e.HEAPF32[ua]=Fa[0];e.HEAPF32[ua+1]=Fa[1];ua+=2}t._shadowColorsPtr=E(U).ue;t._shadowOffsetsPtr=la;t._shadowBlurRadiiPtr=v(fa,"HEAPF32")}else t._shadowLen=0,t._shadowColorsPtr=V,t._shadowOffsetsPtr=V,t._shadowBlurRadiiPtr=V;Array.isArray(t.fontFeatures)&&t.fontFeatures.length?(D= t.fontFeatures,U=D.map(function(ha){return ha.name}),fa=D.map(function(ha){return ha.value}),t._fontFeatureLen=D.length,t._fontFeatureNamesPtr=r(U),t._fontFeatureValuesPtr=v(fa,"HEAPU32")):(t._fontFeatureLen=0,t._fontFeatureNamesPtr=V,t._fontFeatureValuesPtr=V);Array.isArray(t.fontVariations)&&t.fontVariations.length?(D=t.fontVariations,U=D.map(function(ha){return ha.axis}),fa=D.map(function(ha){return ha.value}),t._fontVariationLen=D.length,t._fontVariationAxesPtr=r(U),t._fontVariationValuesPtr= v(fa,"HEAPF32")):(t._fontVariationLen=0,t._fontVariationAxesPtr=V,t._fontVariationValuesPtr=V)}function J(t){e._free(t._fontFamiliesPtr);e._free(t._shadowColorsPtr);e._free(t._shadowOffsetsPtr);e._free(t._shadowBlurRadiiPtr);e._free(t._fontFeatureNamesPtr);e._free(t._fontFeatureValuesPtr);e._free(t._fontVariationAxesPtr);e._free(t._fontVariationValuesPtr)}e.Paragraph.prototype.getRectsForRange=function(t,D,U,fa){t=this._getRectsForRange(t,D,U,fa);return g(t)};e.Paragraph.prototype.getRectsForPlaceholders= function(){var t=this._getRectsForPlaceholders();return g(t)};e.Paragraph.prototype.getGlyphInfoAt=function(t){return c(this._getGlyphInfoAt(t))};e.Paragraph.prototype.getClosestGlyphInfoAtCoordinate=function(t,D){return c(this._getClosestGlyphInfoAtCoordinate(t,D))};e.TypefaceFontProvider.prototype.registerFont=function(t,D){t=e.Typeface.MakeTypefaceFromData(t);if(!t)return null;D=x(D);this._registerFont(t,D);t.delete()};e.ParagraphStyle=function(t){t.disableHinting=t.disableHinting||!1;if(t.ellipsis){var D= t.ellipsis;t._ellipsisPtr=x(D);t._ellipsisLen=ma(D)}else t._ellipsisPtr=V,t._ellipsisLen=0;null==t.heightMultiplier&&(t.heightMultiplier=-1);t.maxLines=t.maxLines||0;t.replaceTabCharacters=t.replaceTabCharacters||!1;D=(D=t.strutStyle)||{};D.strutEnabled=D.strutEnabled||!1;D.strutEnabled&&Array.isArray(D.fontFamilies)&&D.fontFamilies.length?(D._fontFamiliesPtr=r(D.fontFamilies),D._fontFamiliesLen=D.fontFamilies.length):(D._fontFamiliesPtr=V,D._fontFamiliesLen=0);D.fontStyle=l(D.fontStyle);null==D.fontSize&& (D.fontSize=-1);null==D.heightMultiplier&&(D.heightMultiplier=-1);D.halfLeading=D.halfLeading||!1;D.leading=D.leading||0;D.forceStrutHeight=D.forceStrutHeight||!1;t.strutStyle=D;t.textAlign=t.textAlign||e.TextAlign.Start;t.textDirection=t.textDirection||e.TextDirection.LTR;t.textHeightBehavior=t.textHeightBehavior||e.TextHeightBehavior.All;t.textStyle=e.TextStyle(t.textStyle);t.applyRoundingHack=!1!==t.applyRoundingHack;return t};e.TextStyle=function(t){t.color||(t.color=e.BLACK);t.decoration=t.decoration|| 0;t.decorationThickness=t.decorationThickness||0;t.decorationStyle=t.decorationStyle||e.DecorationStyle.Solid;t.textBaseline=t.textBaseline||e.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=l(t.fontStyle);return t};var N={},P=e._malloc(16),Y=e._malloc(16),W=e._malloc(16);e.ParagraphBuilder.Make=function(t,D){C(t.textStyle);D=e.ParagraphBuilder._Make(t, D);J(t.textStyle);return D};e.ParagraphBuilder.MakeFromFontProvider=function(t,D){C(t.textStyle);D=e.ParagraphBuilder._MakeFromFontProvider(t,D);J(t.textStyle);return D};e.ParagraphBuilder.MakeFromFontCollection=function(t,D){C(t.textStyle);D=e.ParagraphBuilder._MakeFromFontCollection(t,D);J(t.textStyle);return D};e.ParagraphBuilder.ShapeText=function(t,D,U){let fa=0;for(const la of D)fa+=la.length;if(fa!==t.length)throw"Accumulated block lengths must equal text.length";return e.ParagraphBuilder._ShapeText(t, D,U)};e.ParagraphBuilder.prototype.pushStyle=function(t){C(t);this._pushStyle(t);J(t)};e.ParagraphBuilder.prototype.pushPaintStyle=function(t,D,U){C(t);this._pushPaintStyle(t,D,U);J(t)};e.ParagraphBuilder.prototype.addPlaceholder=function(t,D,U,fa,la){U=U||e.PlaceholderAlignment.Baseline;fa=fa||e.TextBaseline.Alphabetic;this._addPlaceholder(t||0,D||0,U,fa,la||0)};e.ParagraphBuilder.prototype.setWordsUtf8=function(t){var D=v(t,"HEAPU32");this._setWordsUtf8(D,t&&t.length||0);p(D,t)};e.ParagraphBuilder.prototype.setWordsUtf16= function(t){var D=v(t,"HEAPU32");this._setWordsUtf16(D,t&&t.length||0);p(D,t)};e.ParagraphBuilder.prototype.setGraphemeBreaksUtf8=function(t){var D=v(t,"HEAPU32");this._setGraphemeBreaksUtf8(D,t&&t.length||0);p(D,t)};e.ParagraphBuilder.prototype.setGraphemeBreaksUtf16=function(t){var D=v(t,"HEAPU32");this._setGraphemeBreaksUtf16(D,t&&t.length||0);p(D,t)};e.ParagraphBuilder.prototype.setLineBreaksUtf8=function(t){var D=v(t,"HEAPU32");this._setLineBreaksUtf8(D,t&&t.length||0);p(D,t)};e.ParagraphBuilder.prototype.setLineBreaksUtf16= function(t){var D=v(t,"HEAPU32");this._setLineBreaksUtf16(D,t&&t.length||0);p(D,t)}})})(w);a.MakeManagedAnimation=function(e,c,g,l,r){if(!a._MakeManagedAnimation)throw"Not compiled with MakeManagedAnimation";g||(g="");if(!c)return a._MakeManagedAnimation(e,0,V,V,V,g,l,r);for(var x=[],C=[],J=[],N=Object.keys(c||{}),P=0;P<N.length;P++){var Y=N[P],W=new Uint8Array(c[Y]),t=a._malloc(W.byteLength);a.HEAPU8.set(W,t);C.push(t);J.push(W.byteLength);W=ma(Y)+1;t=a._malloc(W);na(Y,K,t,W);x.push(t)}c=v(x,"HEAPU32"); C=v(C,"HEAPU32");J=v(J,"HEAPU32");e=a._MakeManagedAnimation(e,N.length,c,C,J,g,l,r);a._free(c);a._free(C);a._free(J);return e};a.Lg=function(e){e.text=e.text||"";e.textSize=e.textSize||0;e.minTextSize=e.minTextSize||0;e.maxTextSize=e.maxTextSize||Number.MAX_VALUE;e.strokeWidth=e.strokeWidth||0;e.lineHeight=e.lineHeight||0;e.lineShift=e.lineShift||0;e.ascent=e.ascent||0;e.maxLines=e.maxLines||0;e.horizAlign=e.horizAlign||a.TextAlign.Left;e.vertAlign=e.vertAlign||a.Mg.Top;e.strokeJoin=e.strokeJoin|| a.StrokeJoin.Miter;e.direction=e.direction||a.TextDirection.LTR;e.linebreak=e.linebreak||a.LineBreakType.HardLineBreak;e.resize=e.resize||a.Kg.None;e.fillColor||(e.fillColor=a.TRANSPARENT);e.strokeColor||(e.strokeColor=a.TRANSPARENT);e.boundingBox||(e.boundingBox=[0,0,0,0]);return e};(function(e){e.ke=e.ke||[];e.ke.push(function(){e.Animation.prototype.render=function(c,g){R(g,ea);this._render(c,ea)};e.Animation.prototype.size=function(c){this._size(ea);var g=sa.toTypedArray();return c?(c[0]=g[0], c[1]=g[1],c):g.slice(0,2)};e.ManagedAnimation&&(e.ManagedAnimation.prototype.render=function(c,g){R(g,ea);this._render(c,ea)},e.ManagedAnimation.prototype.seek=function(c,g){this._seek(c,ea);c=sa.toTypedArray();return g?(g.set(c),g):c.slice()},e.ManagedAnimation.prototype.seekFrame=function(c,g){this._seekFrame(c,ea);c=sa.toTypedArray();return g?(g.set(c),g):c.slice()},e.ManagedAnimation.prototype.setColor=function(c,g){g=y(g);return this._setColor(c,g)},e.ManagedAnimation.prototype.setColorSlot= function(c,g){g=y(g);return this._setColorSlot(c,g)},e.ManagedAnimation.prototype.getColorSlot=function(c){this._getColorSlot(c,Ka);c=T(Ka);return-1==c[0]?null:c},e.ManagedAnimation.prototype.setVec2Slot=function(c,g){v(g,"HEAPF32",cb);return this._setVec2Slot(c,cb)},e.ManagedAnimation.prototype.getVec2Slot=function(c){this._getVec2Slot(c,cb);c=bc.toTypedArray();return-1===c[2]?null:c.slice(0,2)},e.ManagedAnimation.prototype.setTextSlot=function(c,g){var l=y(g.fillColor,Ka),r=y(g.strokeColor,ea), x=R(g.boundingBox,Pa);g._fillColorPtr=l;g._strokeColorPtr=r;g._boundingBoxPtr=x;return this._setTextSlot(c,g)},e.ManagedAnimation.prototype.setTransform=function(c,g,l,r,x,C,J){g=v([g[0],g[1],l[0],l[1],r[0],r[1],x,C,J],"HEAPF32",Oa);return this._setTransform(c,g)},e.ManagedAnimation.prototype.size=function(c){this._size(ea);var g=sa.toTypedArray();return c?(c[0]=g[0],c[1]=g[1],c):g.slice(0,2)})})})(w);a.ke=a.ke||[];a.ke.push(function(){a.Path.prototype.op=function(e,c){return this._op(e,c)?this:null}; a.Path.prototype.simplify=function(){return this._simplify()?this:null}});a.ke=a.ke||[];a.ke.push(function(){a.Canvas.prototype.drawText=function(e,c,g,l,r){var x=ma(e),C=a._malloc(x+1);na(e,K,C,x+1);this._drawSimpleText(C,x,c,g,r,l);a._free(C)};a.Canvas.prototype.drawGlyphs=function(e,c,g,l,r,x){if(!(2*e.length<=c.length))throw"Not enough positions for the array of gyphs";a.ee(this.ce);const C=v(e,"HEAPU16"),J=v(c,"HEAPF32");this._drawGlyphs(e.length,C,J,g,l,r,x);p(J,c);p(C,e)};a.Font.prototype.getGlyphBounds= function(e,c,g){var l=v(e,"HEAPU16"),r=a._malloc(16*e.length);this._getGlyphWidthBounds(l,e.length,V,r,c||null);c=new Float32Array(a.HEAPU8.buffer,r,4*e.length);p(l,e);if(g)return g.set(c),a._free(r),g;e=Float32Array.from(c);a._free(r);return e};a.Font.prototype.getGlyphIDs=function(e,c,g){c||(c=e.length);var l=ma(e)+1,r=a._malloc(l);na(e,K,r,l);e=a._malloc(2*c);c=this._getGlyphIDs(r,l-1,c,e);a._free(r);if(0>c)return a._free(e),null;r=new Uint16Array(a.HEAPU8.buffer,e,c);if(g)return g.set(r),a._free(e), g;g=Uint16Array.from(r);a._free(e);return g};a.Font.prototype.getGlyphIntercepts=function(e,c,g,l){var r=v(e,"HEAPU16"),x=v(c,"HEAPF32");return this._getGlyphIntercepts(r,e.length,!(e&&e._ck),x,c.length,!(c&&c._ck),g,l)};a.Font.prototype.getGlyphWidths=function(e,c,g){var l=v(e,"HEAPU16"),r=a._malloc(4*e.length);this._getGlyphWidthBounds(l,e.length,r,V,c||null);c=new Float32Array(a.HEAPU8.buffer,r,e.length);p(l,e);if(g)return g.set(c),a._free(r),g;e=Float32Array.from(c);a._free(r);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 r=new Uint8Array(e[l]),x=v(r,"HEAPU8");c.push(x);g.push(r.byteLength)}c=v(c,"HEAPU32");g=v(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=v(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=ma(e)+1,r=a._malloc(l);na(e,K,r,l);e=a._malloc(2*c);c=this._getGlyphIDs(r,l-1,c,e);a._free(r);if(0>c)return a._free(e),null;r=new Uint16Array(a.HEAPU8.buffer,e,c);if(g)return g.set(r),a._free(e),g;g=Uint16Array.from(r);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||(l=0);var r=g.getGlyphIDs(e);r=g.getGlyphWidths(r);var x=[];c=new a.ContourMeasureIter(c,!1,1);for(var C=c.next(),J=new Float32Array(4),N=0;N<e.length&&C;N++){var P=r[N];l+=P/2;if(l>C.length()){C.delete();C=c.next();if(!C){e=e.substring(0,N);break}l=P/2}C.getPosTan(l,J);var Y=J[2],W=J[3];x.push(Y,W,J[0]-P/2*Y,J[1]-P/2*W);l+=P/2}e=this.MakeFromRSXform(e,x,g);C&&C.delete();c.delete();return e}};a.TextBlob.MakeFromRSXform=function(e,c,g){var l=ma(e)+1,r=a._malloc(l);na(e,K,r,l);e=v(c,"HEAPF32"); g=a.TextBlob._MakeFromRSXform(r,l-1,e,g);a._free(r);return g?g:null};a.TextBlob.MakeFromRSXformGlyphs=function(e,c,g){var l=v(e,"HEAPU16");c=v(c,"HEAPF32");g=a.TextBlob._MakeFromRSXformGlyphs(l,2*e.length,c,g);p(l,e);return g?g:null};a.TextBlob.MakeFromGlyphs=function(e,c){var g=v(e,"HEAPU16");c=a.TextBlob._MakeFromGlyphs(g,2*e.length,c);p(g,e);return c?c:null};a.TextBlob.MakeFromText=function(e,c){var g=ma(e)+1,l=a._malloc(g);na(e,K,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.ke=a.ke||[];a.ke.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.ke=a.ke||[];a.ke.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=v(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,r=v(e,"HEAPF32");g=G(g);for(var x=[],C=0;C<c.length;C++)x.push(c[C].be.je);c=v(x,"HEAPU32");return this._makeShaderWithChildren(r,4*e.length,l,c,x.length,g)};a.RuntimeEffect.prototype.makeBlender=function(e){var c=!e._ck,g=v(e, "HEAPF32");return this._makeBlender(g,4*e.length,c)}});(function(){function e(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 q=k[1],z=k[2];k=k[3];if(1===k)return I=I.toString(16).toLowerCase(),q=q.toString(16).toLowerCase(),z=z.toString(16).toLowerCase(),I=1===I.length?"0"+I:I,q=1===q.length?"0"+q:q,z=1===z.length?"0"+z:z,"#"+I+q+z;k=0===k||1===k?k:k.toFixed(8);return"rgba("+I+", "+q+", "+z+", "+k+")"} function g(I){return a.parseColorString(I,ya)}function l(I){I=Fa.exec(I);if(!I)return null;var k=parseFloat(I[4]),q=16;switch(I[5]){case "em":case "rem":q=16*k;break;case "pt":q=4*k/3;break;case "px":q=k;break;case "pc":q=16*k;break;case "in":q=96*k;break;case "cm":q=96*k/2.54;break;case "mm":q=96/25.4*k;break;case "q":q=96/25.4/4*k;break;case "%":q=16/75*k}return{style:I[1],variant:I[2],weight:I[3],sizePx:q,family:I[6].trim()}}function r(){ha||(ha={"Noto Mono":{"*":a.Typeface.GetDefault()},monospace:{"*":a.Typeface.GetDefault()}})} function x(I){this.de=I;this.ge=new a.Paint;this.ge.setAntiAlias(!0);this.ge.setStrokeMiter(10);this.ge.setStrokeCap(a.StrokeCap.Butt);this.ge.setStrokeJoin(a.StrokeJoin.Miter);this.lf="10px monospace";this.Ge=new a.Font(a.Typeface.GetDefault(),10);this.Ge.setSubpixel(!0);this.te=this.ze=a.BLACK;this.Pe=0;this.bf=a.TRANSPARENT;this.Re=this.Qe=0;this.cf=this.Ce=1;this.af=0;this.Oe=[];this.fe=a.BlendMode.SrcOver;this.ge.setStrokeWidth(this.cf);this.ge.setBlendMode(this.fe);this.ie=new a.Path;this.le= a.Matrix.identity