canvaskit-wasm
Version:
A WASM version of Skia's Canvas API
106 lines (105 loc) • 124 kB
JavaScript
var CanvasKitInit = (() => {
var _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined;
if (typeof __filename != 'undefined') _scriptName = _scriptName || __filename;
return (
async function(moduleArg = {}) {
var moduleRtn;
var u=moduleArg,fa,ia,ka=new Promise((a,b)=>{fa=a;ia=b}),oa="object"==typeof window,pa="undefined"!=typeof WorkerGlobalScope,qa="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&"renderer"!=process.type;
(function(a){a.Od=a.Od||[];a.Od.push(function(){a.MakeSWCanvasSurface=function(b){var e=b,f="undefined"!==typeof OffscreenCanvas&&e instanceof OffscreenCanvas;if(!("undefined"!==typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||f||(e=document.getElementById(b),e)))throw"Canvas with id "+b+" was not found";if(b=a.MakeSurface(e.width,e.height))b.Hd=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,n=a._malloc(h);if(f=a.Surface._makeRasterDirect(f,n,4*b))f.Hd=null,f.tf=b,f.pf=e,f.rf=h,f.Te=n,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.Id(this.Gd);this._flush();if(this.Hd){var e=new Uint8ClampedArray(a.HEAPU8.buffer,this.Te,this.rf);e=new ImageData(e,this.tf,this.pf);b?this.Hd.getContext("2d").putImageData(e,
0,0,b[0],b[1],b[2]-b[0],b[3]-b[1]):this.Hd.getContext("2d").putImageData(e,0,0)}};a.Surface.prototype.dispose=function(){this.Te&&a._free(this.Te);this.delete()};a.Id=a.Id||function(){};a.Ne=a.Ne||function(){return null}})})(u);
(function(a){a.Od=a.Od||[];a.Od.push(function(){function b(m,t,w){return m&&m.hasOwnProperty(t)?m[t]:w}function e(m){var t=ra(sa);sa[t]=m;return t}function f(m){return m.naturalHeight||m.videoHeight||m.displayHeight||m.height}function h(m){return m.naturalWidth||m.videoWidth||m.displayWidth||m.width}function n(m,t,w,D){m.bindTexture(m.TEXTURE_2D,t);D||w.alphaType!==a.AlphaType.Premul||m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);return t}function v(m,t,w){w||t.alphaType!==a.AlphaType.Premul||
m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1);m.bindTexture(m.TEXTURE_2D,null)}a.GetWebGLContext=function(m,t){if(!m)throw"null canvas passed into makeWebGLContext";var w={alpha:b(t,"alpha",1),depth:b(t,"depth",1),stencil:b(t,"stencil",8),antialias:b(t,"antialias",0),premultipliedAlpha:b(t,"premultipliedAlpha",1),preserveDrawingBuffer:b(t,"preserveDrawingBuffer",0),preferLowPowerToHighPerformance:b(t,"preferLowPowerToHighPerformance",0),failIfMajorPerformanceCaveat:b(t,"failIfMajorPerformanceCaveat",
0),enableExtensionsByDefault:b(t,"enableExtensionsByDefault",1),explicitSwapControl:b(t,"explicitSwapControl",0),renderViaOffscreenBackBuffer:b(t,"renderViaOffscreenBackBuffer",0)};w.majorVersion=t&&t.majorVersion?t.majorVersion:"undefined"!==typeof WebGL2RenderingContext?2:1;if(w.explicitSwapControl)throw"explicitSwapControl is not supported";m=ta(m,w);if(!m)return 0;ua(m);I.ce.getExtension("WEBGL_debug_renderer_info");return m};a.deleteContext=function(m){I===ya[m]&&(I=null);"object"==typeof JSEvents&&
JSEvents.eg(ya[m].ce.canvas);ya[m]?.ce.canvas&&(ya[m].ce.canvas.mf=void 0);ya[m]=null};a._setTextureCleanup({deleteTexture:function(m,t){var w=sa[t];w&&ya[m].ce.deleteTexture(w);sa[t]=null}});a.MakeWebGLContext=function(m){if(!this.Id(m))return null;var t=this._MakeGrContext();if(!t)return null;t.Gd=m;var w=t.delete.bind(t);t["delete"]=function(){a.Id(this.Gd);w()}.bind(t);return I.Xe=t};a.MakeGrContext=a.MakeWebGLContext;a.GrDirectContext.prototype.getResourceCacheLimitBytes=function(){a.Id(this.Gd);
this._getResourceCacheLimitBytes()};a.GrDirectContext.prototype.getResourceCacheUsageBytes=function(){a.Id(this.Gd);this._getResourceCacheUsageBytes()};a.GrDirectContext.prototype.releaseResourcesAndAbandonContext=function(){a.Id(this.Gd);this._releaseResourcesAndAbandonContext()};a.GrDirectContext.prototype.setResourceCacheLimitBytes=function(m){a.Id(this.Gd);this._setResourceCacheLimitBytes(m)};a.MakeOnScreenGLSurface=function(m,t,w,D,G,L){if(!this.Id(m.Gd))return null;t=void 0===G||void 0===L?
this._MakeOnScreenGLSurface(m,t,w,D):this._MakeOnScreenGLSurface(m,t,w,D,G,L);if(!t)return null;t.Gd=m.Gd;return t};a.MakeRenderTarget=function(){var m=arguments[0];if(!this.Id(m.Gd))return null;if(3===arguments.length){var t=this._MakeRenderTargetWH(m,arguments[1],arguments[2]);if(!t)return null}else if(2===arguments.length){if(t=this._MakeRenderTargetII(m,arguments[1]),!t)return null}else return null;t.Gd=m.Gd;return t};a.MakeWebGLCanvasSurface=function(m,t,w){t=t||null;var D=m,G="undefined"!==
typeof OffscreenCanvas&&D instanceof OffscreenCanvas;if(!("undefined"!==typeof HTMLCanvasElement&&D instanceof HTMLCanvasElement||G||(D=document.getElementById(m),D)))throw"Canvas with id "+m+" was not found";m=this.GetWebGLContext(D,w);if(!m||0>m)throw"failed to create webgl context: err "+m;m=this.MakeWebGLContext(m);t=this.MakeOnScreenGLSurface(m,D.width,D.height,t);return t?t:(t=D.cloneNode(!0),D.parentNode.replaceChild(t,D),t.classList.add("ck-replaced"),a.MakeSWCanvasSurface(t))};a.MakeCanvasSurface=
a.MakeWebGLCanvasSurface;a.Surface.prototype.makeImageFromTexture=function(m,t){a.Id(this.Gd);m=e(m);if(t=this._makeImageFromTexture(this.Gd,m,t))t.Ee=m;return t};a.Surface.prototype.makeImageFromTextureSource=function(m,t,w){t||={height:f(m),width:h(m),colorType:a.ColorType.RGBA_8888,alphaType:w?a.AlphaType.Premul:a.AlphaType.Unpremul};t.colorSpace||(t.colorSpace=a.ColorSpace.SRGB);a.Id(this.Gd);var D=I.ce;w=n(D,D.createTexture(),t,w);2===I.version?D.texImage2D(D.TEXTURE_2D,0,D.RGBA,t.width,t.height,
0,D.RGBA,D.UNSIGNED_BYTE,m):D.texImage2D(D.TEXTURE_2D,0,D.RGBA,D.RGBA,D.UNSIGNED_BYTE,m);v(D,t);this._resetContext();return this.makeImageFromTexture(w,t)};a.Surface.prototype.updateTextureFromSource=function(m,t,w){if(m.Ee){a.Id(this.Gd);var D=m.getImageInfo(),G=I.ce,L=n(G,sa[m.Ee],D,w);2===I.version?G.texImage2D(G.TEXTURE_2D,0,G.RGBA,h(t),f(t),0,G.RGBA,G.UNSIGNED_BYTE,t):G.texImage2D(G.TEXTURE_2D,0,G.RGBA,G.RGBA,G.UNSIGNED_BYTE,t);v(G,D,w);this._resetContext();sa[m.Ee]=null;m.Ee=e(L);D.colorSpace=
m.getColorSpace();t=this._makeImageFromTexture(this.Gd,m.Ee,D);w=m.Fd.Md;G=m.Fd.Rd;m.Fd.Md=t.Fd.Md;m.Fd.Rd=t.Fd.Rd;t.Fd.Md=w;t.Fd.Rd=G;t.delete();D.colorSpace.delete()}};a.MakeLazyImageFromTextureSource=function(m,t,w){t||={height:f(m),width:h(m),colorType:a.ColorType.RGBA_8888,alphaType:w?a.AlphaType.Premul:a.AlphaType.Unpremul};t.colorSpace||(t.colorSpace=a.ColorSpace.SRGB);var D={makeTexture:function(){var G=I,L=G.ce,V=n(L,L.createTexture(),t,w);2===G.version?L.texImage2D(L.TEXTURE_2D,0,L.RGBA,
t.width,t.height,0,L.RGBA,L.UNSIGNED_BYTE,m):L.texImage2D(L.TEXTURE_2D,0,L.RGBA,L.RGBA,L.UNSIGNED_BYTE,m);v(L,t,w);return e(V)},freeSrc:function(){}};"VideoFrame"===m.constructor.name&&(D.freeSrc=function(){m.close()});return a.Image._makeFromGenerator(t,D)};a.Id=function(m){return m?ua(m):!1};a.Ne=function(){return I&&I.Xe&&!I.Xe.isDeleted()?I.Xe:null}})})(u);
(function(a){function b(d,c,g,l,q){for(var x=0;x<d.length;x++)c[x*g+(x*q+l+g)%g]=d[x];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(m(255*d[3])<<24|m(255*d[0])<<16|m(255*d[1])<<8|m(255*d[2])<<0)>>>0}function n(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 v(d){if(void 0===d)return 1;var c=parseFloat(d);return d&&-1!==d.indexOf("%")?c/100:c}function m(d){return Math.round(Math.max(0,Math.min(d||0,255)))}function t(d,c){c&&c._ck||a._free(d)}function w(d,c,g){if(!d||!d.length)return Q;if(d&&d._ck)return d.byteOffset;var l=a[c].BYTES_PER_ELEMENT;g||=a._malloc(d.length*l);a[c].set(d,g/l);return g}function D(d){var c={Zd:Q,count:d.length,colorType:a.ColorType.RGBA_F32};
if(d instanceof Float32Array)c.Zd=w(d,"HEAPF32"),c.count=d.length/4;else if(d instanceof Uint32Array)c.Zd=w(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,q=g/4,x=0;x<d.length;x++)for(var A=0;4>A;A++)a.HEAPF32[q+l]=d[x][A],l++;d=g}else d=Q;c.Zd=d}else throw"Invalid argument to copyFlexibleColorArray, Not a color array "+typeof d;return c}function G(d){if(!d)return Q;var c=Nb.toTypedArray();if(d.length){if(6===d.length||
9===d.length)return w(d,"HEAPF32",va),6===d.length&&a.HEAPF32.set(jd,6+va/4),va;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],va;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 va}function L(d){if(!d)return Q;var c=Ob.toTypedArray();if(d.length){if(16!==d.length&&6!==d.length&&9!==d.length)throw"invalid matrix size";
if(16===d.length)return w(d,"HEAPF32",Za);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 Za}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 Za}function V(d,c){return w(d,"HEAPF32",c||Ha)}function ha(d,
c,g,l){var q=Pb.toTypedArray();q[0]=d;q[1]=c;q[2]=g;q[3]=l;return Ha}function ea(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 w(d,"HEAPF32",c||aa)}function za(d,c){return w(d,"HEAPF32",c||Qb)}function ma(){for(var d=0,c=0;c<arguments.length-1;c+=2)d+=arguments[c]*arguments[c+1];return d}function Oa(d,c,g){for(var l=Array(d.length),q=0;q<g;q++)for(var x=0;x<g;x++){for(var A=0,H=0;H<g;H++)A+=d[g*q+H]*c[g*H+x];l[q*g+x]=A}return l}function $a(d,c){for(var g=
Oa(c[0],c[1],d),l=2;l<c.length;)g=Oa(g,c[l],d),l++;return g}a.Color=function(d,c,g,l){void 0===l&&(l=1);return a.Color4f(m(d)/255,m(c)/255,m(g)/255,l)};a.ColorAsInt=function(d,c,g,l){void 0===l&&(l=255);return(m(l)<<24|m(d)<<16|m(c)<<8|m(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 q=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),q=17*parseInt(d.slice(3,4),16)}return a.Color(g,
l,q,c/255)}return d.startsWith("rgba")?(d=d.slice(5,-1),d=d.split(","),a.Color(+d[0],+d[1],+d[2],v(d[3]))):d.startsWith("rgb")?(d=d.slice(4,-1),d=d.split(","),a.Color(+d[0],+d[1],+d[2],v(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,me:null,subarray:function(l,q){l=this.toTypedArray().subarray(l,
q);l._ck=!0;return l},toTypedArray:function(){if(this.me&&this.me.length)return this.me;this.me=new d(a.HEAPU8.buffer,g,c);this.me._ck=!0;return this.me}}};a.Free=function(d){a._free(d.byteOffset);d.byteOffset=Q;d.toTypedArray=null;d.me=null};var va=Q,Nb,Za=Q,Ob,Ha=Q,Pb,na,aa=Q,oc,Ma=Q,Rb,ab=Q,pc,Sb=Q,pb,eb=Q,qc,Qb=Q,rc,sc=Q,jd=Float32Array.of(0,0,1),Q=0;a.onRuntimeInitialized=function(){function d(c,g,l,q,x,A,H){A||(A=4*q.width,q.colorType===a.ColorType.RGBA_F16?A*=2:q.colorType===a.ColorType.RGBA_F32&&
(A*=4));var K=A*q.height;var M=x?x.byteOffset:a._malloc(K);if(H?!c._readPixels(q,M,A,g,l,H):!c._readPixels(q,M,A,g,l))return x||a._free(M),null;if(x)return x.toTypedArray();switch(q.colorType){case a.ColorType.RGBA_8888:case a.ColorType.RGBA_F16:c=(new Uint8Array(a.HEAPU8.buffer,M,K)).slice();break;case a.ColorType.RGBA_F32:c=(new Float32Array(a.HEAPU8.buffer,M,K)).slice();break;default:return null}a._free(M);return c}Pb=a.Malloc(Float32Array,4);Ha=Pb.byteOffset;Ob=a.Malloc(Float32Array,16);Za=Ob.byteOffset;
Nb=a.Malloc(Float32Array,9);va=Nb.byteOffset;qc=a.Malloc(Float32Array,12);Qb=qc.byteOffset;rc=a.Malloc(Float32Array,12);sc=rc.byteOffset;na=a.Malloc(Float32Array,4);aa=na.byteOffset;oc=a.Malloc(Float32Array,4);Ma=oc.byteOffset;Rb=a.Malloc(Float32Array,3);ab=Rb.byteOffset;pc=a.Malloc(Float32Array,3);Sb=pc.byteOffset;pb=a.Malloc(Int32Array,4);eb=pb.byteOffset;a.ColorSpace.SRGB=a.ColorSpace._MakeSRGB();a.ColorSpace.DISPLAY_P3=a.ColorSpace._MakeDisplayP3();a.ColorSpace.ADOBE_RGB=a.ColorSpace._MakeAdobeRGB();
a.GlyphRunFlags={IsWhiteSpace:a._GlyphRunFlags_isWhiteSpace};a.Path.MakeFromCmds=function(c){var g=w(c,"HEAPF32"),l=a.Path._MakeFromCmds(g,c.length);t(g,c);return l};a.Path.MakeFromVerbsPointsWeights=function(c,g,l){var q=w(c,"HEAPU8"),x=w(g,"HEAPF32"),A=w(l,"HEAPF32"),H=a.Path._MakeFromVerbsPointsWeights(q,c.length,x,g.length/2,A,l&&l.length||0);t(q,c);t(x,g);t(A,l);return H};a.PathBuilder.prototype.addArc=function(c,g,l){c=S(c);this._addArc(c,g,l);return this};a.PathBuilder.prototype.addCircle=
function(c,g,l,q){this._addCircle(c,g,l,!!q);return this};a.PathBuilder.prototype.addOval=function(c,g,l){void 0===l&&(l=1);c=S(c);this._addOval(c,!!g,l);return this};a.PathBuilder.prototype.addPath=function(){var c=Array.prototype.slice.call(arguments),g=c[0],l=!1;"boolean"===typeof c[c.length-1]&&(l=c.pop());if(1===c.length)this._addPath(g,1,0,0,0,1,0,0,0,1,l);else if(2===c.length)c=c[1],this._addPath(g,c[0],c[1],c[2],c[3],c[4],c[5],c[6]||0,c[7]||0,c[8]||1,l);else if(7===c.length||10===c.length)this._addPath(g,
c[1],c[2],c[3],c[4],c[5],c[6],c[7]||0,c[8]||0,c[9]||1,l);else return null;return this};a.PathBuilder.prototype.addPolygon=function(c,g){var l=w(c,"HEAPF32");this._addPolygon(l,c.length/2,g);t(l,c);return this};a.PathBuilder.prototype.addRect=function(c,g){c=S(c);this._addRect(c,!!g);return this};a.PathBuilder.prototype.addRRect=function(c,g){c=za(c);this._addRRect(c,!!g);return this};a.PathBuilder.prototype.addVerbsPointsWeights=function(c,g,l){var q=w(c,"HEAPU8"),x=w(g,"HEAPF32"),A=w(l,"HEAPF32");
this._addVerbsPointsWeights(q,c.length,x,g.length/2,A,l&&l.length||0);t(q,c);t(x,g);t(A,l);return this};a.PathBuilder.prototype.arc=function(c,g,l,q,x,A){c=a.LTRBRect(c-l,g-l,c+l,g+l);x=(x-q)/Math.PI*180-360*!!A;q=(new a.PathBuilder).addArc(c,q/Math.PI*180,x).detachAndDelete();this.addPath(q,!0);q.delete();return this};a.PathBuilder.prototype.arcToOval=function(c,g,l,q){c=S(c);this._arcToOval(c,g,l,q);return this};a.PathBuilder.prototype.arcToRotated=function(c,g,l,q,x,A,H){this._arcToRotated(c,g,
l,!!q,!!x,A,H);return this};a.PathBuilder.prototype.arcToTangent=function(c,g,l,q,x){this._arcToTangent(c,g,l,q,x);return this};a.PathBuilder.prototype.close=function(){this._close();return this};a.PathBuilder.prototype.conicTo=function(c,g,l,q,x){this._conicTo(c,g,l,q,x);return this};a.Path.prototype.computeTightBounds=function(c){this._computeTightBounds(aa);var g=na.toTypedArray();return c?(c.set(g),c):g.slice()};a.PathBuilder.prototype.cubicTo=function(c,g,l,q,x,A){this._cubicTo(c,g,l,q,x,A);
return this};a.PathBuilder.prototype.detachAndDelete=function(){var c=this.detach();this.delete();return c};a.Path.prototype.getBounds=function(c){this._getBounds(aa);var g=na.toTypedArray();return c?(c.set(g),c):g.slice()};a.PathBuilder.prototype.getBounds=function(c){this._getBounds(aa);var g=na.toTypedArray();return c?(c.set(g),c):g.slice()};a.PathBuilder.prototype.lineTo=function(c,g){this._lineTo(c,g);return this};a.PathBuilder.prototype.moveTo=function(c,g){this._moveTo(c,g);return this};a.PathBuilder.prototype.offset=
function(c,g){this._transform(1,0,c,0,1,g,0,0,1);return this};a.PathBuilder.prototype.quadTo=function(c,g,l,q){this._quadTo(c,g,l,q);return this};a.PathBuilder.prototype.rArcTo=function(c,g,l,q,x,A,H){this._rArcTo(c,g,l,q,x,A,H);return this};a.PathBuilder.prototype.rConicTo=function(c,g,l,q,x){this._rConicTo(c,g,l,q,x);return this};a.PathBuilder.prototype.rCubicTo=function(c,g,l,q,x,A){this._rCubicTo(c,g,l,q,x,A);return this};a.PathBuilder.prototype.rLineTo=function(c,g){this._rLineTo(c,g);return this};
a.PathBuilder.prototype.rMoveTo=function(c,g){this._rMoveTo(c,g);return this};a.PathBuilder.prototype.rQuadTo=function(c,g,l,q){this._rQuadTo(c,g,l,q);return this};a.Path.prototype.makeStroked=function(c){c=c||{};c.width=c.width||1;c.miter_limit=c.miter_limit||4;c.cap=c.cap||a.StrokeCap.Butt;c.join=c.join||a.StrokeJoin.Miter;c.precision=c.precision||1;return this._makeStroked(c)};a.PathBuilder.prototype.transform=function(){if(1===arguments.length){var c=arguments[0];this._transform(c[0],c[1],c[2],
c[3],c[4],c[5],c[6]||0,c[7]||0,c[8]||1)}else if(6===arguments.length||9===arguments.length)c=arguments,this._transform(c[0],c[1],c[2],c[3],c[4],c[5],c[6]||0,c[7]||0,c[8]||1);else throw"transform expected to take 1 or 9 arguments. Got "+arguments.length;return this};a.Path.prototype.makeTrimmed=function(c,g,l){return this._makeTrimmed(c,g,!!l)};a.Image.prototype.encodeToBytes=function(c,g){var l=a.Ne();c=c||a.ImageFormat.PNG;g=g||100;return l?this._encodeToBytes(c,g,l):this._encodeToBytes(c,g)};a.Image.prototype.makeShaderCubic=
function(c,g,l,q,x){x=G(x);return this._makeShaderCubic(c,g,l,q,x)};a.Image.prototype.makeShaderOptions=function(c,g,l,q,x){x=G(x);return this._makeShaderOptions(c,g,l,q,x)};a.Image.prototype.readPixels=function(c,g,l,q,x){var A=a.Ne();return d(this,c,g,l,q,x,A)};a.Canvas.prototype.clear=function(c){a.Id(this.Gd);c=V(c);this._clear(c)};a.Canvas.prototype.clipRRect=function(c,g,l){a.Id(this.Gd);c=za(c);this._clipRRect(c,g,l)};a.Canvas.prototype.clipRect=function(c,g,l){a.Id(this.Gd);c=S(c);this._clipRect(c,
g,l)};a.Canvas.prototype.concat=function(c){a.Id(this.Gd);c=L(c);this._concat(c)};a.Canvas.prototype.drawArc=function(c,g,l,q,x){a.Id(this.Gd);c=S(c);this._drawArc(c,g,l,q,x)};a.Canvas.prototype.drawAtlas=function(c,g,l,q,x,A,H){if(c&&q&&g&&l&&g.length===l.length){a.Id(this.Gd);x||(x=a.BlendMode.SrcOver);var K=w(g,"HEAPF32"),M=w(l,"HEAPF32"),T=l.length/4,R=w(n(A),"HEAPU32");if(H&&"B"in H&&"C"in H)this._drawAtlasCubic(c,M,K,R,T,x,H.B,H.C,q);else{let r=a.FilterMode.Linear,C=a.MipmapMode.None;H&&(r=
H.filter,"mipmap"in H&&(C=H.mipmap));this._drawAtlasOptions(c,M,K,R,T,x,r,C,q)}t(K,g);t(M,l);t(R,A)}};a.Canvas.prototype.drawCircle=function(c,g,l,q){a.Id(this.Gd);this._drawCircle(c,g,l,q)};a.Canvas.prototype.drawColor=function(c,g){a.Id(this.Gd);c=V(c);void 0!==g?this._drawColor(c,g):this._drawColor(c)};a.Canvas.prototype.drawColorInt=function(c,g){a.Id(this.Gd);this._drawColorInt(c,g||a.BlendMode.SrcOver)};a.Canvas.prototype.drawColorComponents=function(c,g,l,q,x){a.Id(this.Gd);c=ha(c,g,l,q);void 0!==
x?this._drawColor(c,x):this._drawColor(c)};a.Canvas.prototype.drawDRRect=function(c,g,l){a.Id(this.Gd);c=za(c,Qb);g=za(g,sc);this._drawDRRect(c,g,l)};a.Canvas.prototype.drawImage=function(c,g,l,q){a.Id(this.Gd);this._drawImage(c,g,l,q||null)};a.Canvas.prototype.drawImageCubic=function(c,g,l,q,x,A){a.Id(this.Gd);this._drawImageCubic(c,g,l,q,x,A||null)};a.Canvas.prototype.drawImageOptions=function(c,g,l,q,x,A){a.Id(this.Gd);this._drawImageOptions(c,g,l,q,x,A||null)};a.Canvas.prototype.drawImageNine=
function(c,g,l,q,x){a.Id(this.Gd);g=w(g,"HEAP32",eb);l=S(l);this._drawImageNine(c,g,l,q,x||null)};a.Canvas.prototype.drawImageRect=function(c,g,l,q,x){a.Id(this.Gd);S(g,aa);S(l,Ma);this._drawImageRect(c,aa,Ma,q,!!x)};a.Canvas.prototype.drawImageRectCubic=function(c,g,l,q,x,A){a.Id(this.Gd);S(g,aa);S(l,Ma);this._drawImageRectCubic(c,aa,Ma,q,x,A||null)};a.Canvas.prototype.drawImageRectOptions=function(c,g,l,q,x,A){a.Id(this.Gd);S(g,aa);S(l,Ma);this._drawImageRectOptions(c,aa,Ma,q,x,A||null)};a.Canvas.prototype.drawLine=
function(c,g,l,q,x){a.Id(this.Gd);this._drawLine(c,g,l,q,x)};a.Canvas.prototype.drawOval=function(c,g){a.Id(this.Gd);c=S(c);this._drawOval(c,g)};a.Canvas.prototype.drawPaint=function(c){a.Id(this.Gd);this._drawPaint(c)};a.Canvas.prototype.drawParagraph=function(c,g,l){a.Id(this.Gd);this._drawParagraph(c,g,l)};a.Canvas.prototype.drawPatch=function(c,g,l,q,x){if(24>c.length)throw"Need 12 cubic points";if(g&&4>g.length)throw"Need 4 colors";if(l&&8>l.length)throw"Need 4 shader coordinates";a.Id(this.Gd);
const A=w(c,"HEAPF32"),H=g?w(n(g),"HEAPU32"):Q,K=l?w(l,"HEAPF32"):Q;q||(q=a.BlendMode.Modulate);this._drawPatch(A,H,K,q,x);t(K,l);t(H,g);t(A,c)};a.Canvas.prototype.drawPath=function(c,g){a.Id(this.Gd);this._drawPath(c,g)};a.Canvas.prototype.drawPicture=function(c){a.Id(this.Gd);this._drawPicture(c)};a.Canvas.prototype.drawPoints=function(c,g,l){a.Id(this.Gd);var q=w(g,"HEAPF32");this._drawPoints(c,q,g.length/2,l);t(q,g)};a.Canvas.prototype.drawRRect=function(c,g){a.Id(this.Gd);c=za(c);this._drawRRect(c,
g)};a.Canvas.prototype.drawRect=function(c,g){a.Id(this.Gd);c=S(c);this._drawRect(c,g)};a.Canvas.prototype.drawRect4f=function(c,g,l,q,x){a.Id(this.Gd);this._drawRect4f(c,g,l,q,x)};a.Canvas.prototype.drawShadow=function(c,g,l,q,x,A,H){a.Id(this.Gd);var K=w(x,"HEAPF32"),M=w(A,"HEAPF32");g=w(g,"HEAPF32",ab);l=w(l,"HEAPF32",Sb);this._drawShadow(c,g,l,q,K,M,H);t(K,x);t(M,A)};a.getShadowLocalBounds=function(c,g,l,q,x,A,H){c=G(c);l=w(l,"HEAPF32",ab);q=w(q,"HEAPF32",Sb);if(!this._getShadowLocalBounds(c,
g,l,q,x,A,aa))return null;g=na.toTypedArray();return H?(H.set(g),H):g.slice()};a.Canvas.prototype.drawTextBlob=function(c,g,l,q){a.Id(this.Gd);this._drawTextBlob(c,g,l,q)};a.Canvas.prototype.drawVertices=function(c,g,l){a.Id(this.Gd);this._drawVertices(c,g,l)};a.Canvas.prototype.getDeviceClipBounds=function(c){this._getDeviceClipBounds(eb);var g=pb.toTypedArray();c?c.set(g):c=g.slice();return c};a.Canvas.prototype.quickReject=function(c){c=S(c);return this._quickReject(c)};a.Canvas.prototype.getLocalToDevice=
function(){this._getLocalToDevice(Za);for(var c=Za,g=Array(16),l=0;16>l;l++)g[l]=a.HEAPF32[c/4+l];return g};a.Canvas.prototype.getTotalMatrix=function(){this._getTotalMatrix(va);for(var c=Array(9),g=0;9>g;g++)c[g]=a.HEAPF32[va/4+g];return c};a.Canvas.prototype.makeSurface=function(c){c=this._makeSurface(c);c.Gd=this.Gd;return c};a.Canvas.prototype.readPixels=function(c,g,l,q,x){a.Id(this.Gd);return d(this,c,g,l,q,x)};a.Canvas.prototype.saveLayer=function(c,g,l,q,x){g=S(g);return this._saveLayer(c||
null,g,l||null,q||0,x||a.TileMode.Clamp)};a.Canvas.prototype.writePixels=function(c,g,l,q,x,A,H,K){if(c.byteLength%(g*l))throw"pixels length must be a multiple of the srcWidth * srcHeight";a.Id(this.Gd);var M=c.byteLength/(g*l);A=A||a.AlphaType.Unpremul;H=H||a.ColorType.RGBA_8888;K=K||a.ColorSpace.SRGB;var T=M*g;M=w(c,"HEAPU8");g=this._writePixels({width:g,height:l,colorType:H,alphaType:A,colorSpace:K},M,T,q,x);t(M,c);return g};a.ColorFilter.MakeBlend=function(c,g,l){c=V(c);l=l||a.ColorSpace.SRGB;
return a.ColorFilter._MakeBlend(c,g,l)};a.ColorFilter.MakeMatrix=function(c){if(!c||20!==c.length)throw"invalid color matrix";var g=w(c,"HEAPF32"),l=a.ColorFilter._makeMatrix(g);t(g,c);return l};a.ContourMeasure.prototype.getPosTan=function(c,g){this._getPosTan(c,aa);c=na.toTypedArray();return g?(g.set(c),g):c.slice()};a.ImageFilter.prototype.getOutputBounds=function(c,g,l){c=S(c,aa);g=G(g);this._getOutputBounds(c,g,eb);g=pb.toTypedArray();return l?(l.set(g),l):g.slice()};a.ImageFilter.MakeDropShadow=
function(c,g,l,q,x,A){x=V(x,Ha);return a.ImageFilter._MakeDropShadow(c,g,l,q,x,A)};a.ImageFilter.MakeDropShadowOnly=function(c,g,l,q,x,A){x=V(x,Ha);return a.ImageFilter._MakeDropShadowOnly(c,g,l,q,x,A)};a.ImageFilter.MakeImage=function(c,g,l,q){l=S(l,aa);q=S(q,Ma);if("B"in g&&"C"in g)return a.ImageFilter._MakeImageCubic(c,g.B,g.C,l,q);const x=g.filter;let A=a.MipmapMode.None;"mipmap"in g&&(A=g.mipmap);return a.ImageFilter._MakeImageOptions(c,x,A,l,q)};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 q=g.filter;let x=a.MipmapMode.None;"mipmap"in g&&(x=g.mipmap);return a.ImageFilter._MakeMatrixTransformOptions(c,q,x,l)};a.Paint.prototype.getColor=function(){this._getColor(Ha);return ea(Ha)};a.Paint.prototype.setColor=function(c,g){g=g||null;c=V(c);this._setColor(c,g)};a.Paint.prototype.setColorComponents=function(c,g,l,q,x){x=x||null;c=ha(c,g,l,q);this._setColor(c,x)};a.Path.prototype.getPoint=function(c,
g){this._getPoint(c,aa);c=na.toTypedArray();return g?(g[0]=c[0],g[1]=c[1],g):c.slice(0,2)};a.Picture.prototype.makeShader=function(c,g,l,q,x){q=G(q);x=S(x);return this._makeShader(c,g,l,q,x)};a.Picture.prototype.cullRect=function(c){this._cullRect(aa);var g=na.toTypedArray();return c?(c.set(g),c):g.slice()};a.PictureRecorder.prototype.beginRecording=function(c,g){c=S(c);return this._beginRecording(c,!!g)};a.Surface.prototype.getCanvas=function(){var c=this._getCanvas();c.Gd=this.Gd;return c};a.Surface.prototype.makeImageSnapshot=
function(c){a.Id(this.Gd);c=w(c,"HEAP32",eb);return this._makeImageSnapshot(c)};a.Surface.prototype.makeSurface=function(c){a.Id(this.Gd);c=this._makeSurface(c);c.Gd=this.Gd;return c};a.Surface.prototype.sf=function(c,g){this.Ae||(this.Ae=this.getCanvas());return requestAnimationFrame(function(){a.Id(this.Gd);c(this.Ae);this.flush(g)}.bind(this))};a.Surface.prototype.requestAnimationFrame||(a.Surface.prototype.requestAnimationFrame=a.Surface.prototype.sf);a.Surface.prototype.nf=function(c,g){this.Ae||
(this.Ae=this.getCanvas());requestAnimationFrame(function(){a.Id(this.Gd);c(this.Ae);this.flush(g);this.dispose()}.bind(this))};a.Surface.prototype.drawOnce||(a.Surface.prototype.drawOnce=a.Surface.prototype.nf);a.PathEffect.MakeDash=function(c,g){g||=0;if(!c.length||1===c.length%2)throw"Intervals array must have even length";var l=w(c,"HEAPF32");g=a.PathEffect._MakeDash(l,c.length,g);t(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=V(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,q,x,A,H,K){K=K||null;var M=D(l),T=w(q,"HEAPF32");H=H||0;A=G(A);var R=na.toTypedArray();R.set(c);R.set(g,2);c=a.Shader._MakeLinearGradient(aa,M.Zd,M.colorType,T,M.count,x,H,A,K);t(M.Zd,l);q&&t(T,q);return c};a.Shader.MakeRadialGradient=function(c,g,
l,q,x,A,H,K){K=K||null;var M=D(l),T=w(q,"HEAPF32");H=H||0;A=G(A);c=a.Shader._MakeRadialGradient(c[0],c[1],g,M.Zd,M.colorType,T,M.count,x,H,A,K);t(M.Zd,l);q&&t(T,q);return c};a.Shader.MakeSweepGradient=function(c,g,l,q,x,A,H,K,M,T){T=T||null;var R=D(l),r=w(q,"HEAPF32");H=H||0;K=K||0;M=M||360;A=G(A);c=a.Shader._MakeSweepGradient(c,g,R.Zd,R.colorType,r,R.count,x,K,M,H,A,T);t(R.Zd,l);q&&t(r,q);return c};a.Shader.MakeTwoPointConicalGradient=function(c,g,l,q,x,A,H,K,M,T){T=T||null;var R=D(x),r=w(A,"HEAPF32");
M=M||0;K=G(K);var C=na.toTypedArray();C.set(c);C.set(l,2);c=a.Shader._MakeTwoPointConicalGradient(aa,g,q,R.Zd,R.colorType,r,R.count,H,M,K,T);t(R.Zd,x);A&&t(r,A);return c};a.Vertices.prototype.bounds=function(c){this._bounds(aa);var g=na.toTypedArray();return c?(c.set(g),c):g.slice()};a.Od&&a.Od.forEach(function(c){c()})};a.computeTonalColors=function(d){var c=w(d.ambient,"HEAPF32"),g=w(d.spot,"HEAPF32");this._computeTonalColors(c,g);var l={ambient:ea(c),spot:ea(g)};t(c,d.ambient);t(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 qb=null;a.MakeImageFromCanvasImageSource=function(d){var c=d.width,g=d.height;qb||=document.createElement("canvas");qb.width=c;qb.height=g;var l=qb.getContext("2d",{willReadFrequently:!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,q,x){var A=q&&q.length||0,H=0;g&&g.length&&(H|=1);l&&l.length&&(H|=2);void 0===x||x||(H|=4);d=new a._VerticesBuilder(d,c.length/2,A,H);w(c,"HEAPF32",d.positions());d.texCoords()&&w(g,"HEAPF32",d.texCoords());d.colors()&&w(n(l),"HEAPU32",d.colors());d.indices()&&w(q,"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],q=c[g+1],x=d[6]*l+d[7]*q+d[8],A=d[3]*l+d[4]*q+d[5];c[g]=(d[0]*l+d[1]*q+
d[2])/x;c[g+1]=A/x}return c};a.Matrix.multiply=function(){return $a(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,ma(l,g,1-d,c),l,d,ma(-l,c,1-d,g),0,0,1]};a.Matrix.scaled=function(d,c,g,l){g=g||0;l=l||0;var q=b([d,c],e(3),3,0,1);return b([g-d*g,l-c*l],q,3,2,0)};a.Matrix.skewed=function(d,c,g,l){g=g||0;l=l||0;var q=b([d,c],e(3),3,1,-1);return b([-d*g,-c*l],q,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],q=d[1];d=
d[2];var x=1-g;return[x*l*l+g,x*l*q-c*d,x*l*d+c*q,0,x*l*q+c*d,x*q*q+g,x*q*d-c*l,0,x*l*d-c*q,x*q*d+c*l,x*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 $a(4,arguments)};a.M44.invert=function(d){var c=d[0],g=d[4],l=d[8],q=d[12],x=d[1],A=d[5],H=d[9],K=d[13],M=d[2],T=d[6],R=d[10],r=d[14],C=d[3],P=d[7],ba=d[11];d=d[15];var ja=c*A-g*x,wa=c*H-l*x,xa=c*K-q*x,la=g*H-l*A,E=g*K-q*A,k=l*K-q*H,p=M*P-T*C,y=M*ba-R*C,z=M*d-r*C,B=T*ba-R*P,F=T*d-r*P,J=R*d-r*ba,ca=ja*J-wa*F+xa*B+la*z-E*y+k*p,da=1/ca;if(0===ca||Infinity===da)return null;
ja*=da;wa*=da;xa*=da;la*=da;E*=da;k*=da;p*=da;y*=da;z*=da;B*=da;F*=da;J*=da;c=[A*J-H*F+K*B,H*z-x*J-K*y,x*F-A*z+K*p,A*y-x*B-H*p,l*F-g*J-q*B,c*J-l*z+q*y,g*z-c*F-q*p,c*B-g*y+l*p,P*k-ba*E+d*la,ba*xa-C*k-d*wa,C*E-P*xa+d*ja,P*wa-C*la-ba*ja,R*E-T*k-r*la,M*k-R*xa+r*wa,T*xa-M*E-r*ja,M*la-T*wa+R*ja];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 q=new Float32Array(20);q[0]=d;q[6]=c;q[12]=g;q[18]=l;return q};var kd=[[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=kd[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,q){d[4]+=c;d[9]+=g;d[14]+=l;d[19]+=q;return d};a.ColorMatrix.concat=function(d,c){for(var g=new Float32Array(20),l=0,q=0;20>q;q+=5){for(var x=0;4>x;x++)g[l++]=d[q]*c[x]+d[q+1]*c[x+5]+d[q+2]*c[x+10]+d[q+
3]*c[x+15];g[l++]=d[q]*c[4]+d[q+1]*c[9]+d[q+2]*c[14]+d[q+3]*c[19]+d[q+4]}return g};(function(d){d.Od=d.Od||[];d.Od.push(function(){function c(r){r&&(r.dir=0===r.dir?d.TextDirection.RTL:d.TextDirection.LTR);return r}function g(r){if(!r||!r.length)return[];for(var C=[],P=0;P<r.length;P+=5){var ba=d.LTRBRect(r[P],r[P+1],r[P+2],r[P+3]),ja=d.TextDirection.LTR;0===r[P+4]&&(ja=d.TextDirection.RTL);C.push({rect:ba,dir:ja})}d._free(r.byteOffset);return C}function l(r){r=r||{};void 0===r.weight&&(r.weight=
d.FontWeight.Normal);r.width=r.width||d.FontWidth.Normal;r.slant=r.slant||d.FontSlant.Upright;return r}function q(r){if(!r||!r.length)return Q;for(var C=[],P=0;P<r.length;P++){var ba=x(r[P]);C.push(ba)}return w(C,"HEAPU32")}function x(r){if(K[r])return K[r];var C=Aa(r)+1,P=d._malloc(C);Ba(r,P,C);return K[r]=P}function A(r){r._colorPtr=V(r.color);r._foregroundColorPtr=Q;r._backgroundColorPtr=Q;r._decorationColorPtr=Q;r.foregroundColor&&(r._foregroundColorPtr=V(r.foregroundColor,M));r.backgroundColor&&
(r._backgroundColorPtr=V(r.backgroundColor,T));r.decorationColor&&(r._decorationColorPtr=V(r.decorationColor,R));Array.isArray(r.fontFamilies)&&r.fontFamilies.length?(r._fontFamiliesPtr=q(r.fontFamilies),r._fontFamiliesLen=r.fontFamilies.length):(r._fontFamiliesPtr=Q,r._fontFamiliesLen=0);if(r.locale){var C=r.locale;r._localePtr=x(C);r._localeLen=Aa(C)}else r._localePtr=Q,r._localeLen=0;if(Array.isArray(r.shadows)&&r.shadows.length){C=r.shadows;var P=C.map(function(E){return E.color||d.BLACK}),ba=
C.map(function(E){return E.blurRadius||0});r._shadowLen=C.length;for(var ja=d._malloc(8*C.length),wa=ja/4,xa=0;xa<C.length;xa++){var la=C[xa].offset||[0,0];d.HEAPF32[wa]=la[0];d.HEAPF32[wa+1]=la[1];wa+=2}r._shadowColorsPtr=D(P).Zd;r._shadowOffsetsPtr=ja;r._shadowBlurRadiiPtr=w(ba,"HEAPF32")}else r._shadowLen=0,r._shadowColorsPtr=Q,r._shadowOffsetsPtr=Q,r._shadowBlurRadiiPtr=Q;Array.isArray(r.fontFeatures)&&r.fontFeatures.length?(C=r.fontFeatures,P=C.map(function(E){return E.name}),ba=C.map(function(E){return E.value}),
r._fontFeatureLen=C.length,r._fontFeatureNamesPtr=q(P),r._fontFeatureValuesPtr=w(ba,"HEAPU32")):(r._fontFeatureLen=0,r._fontFeatureNamesPtr=Q,r._fontFeatureValuesPtr=Q);Array.isArray(r.fontVariations)&&r.fontVariations.length?(C=r.fontVariations,P=C.map(function(E){return E.axis}),ba=C.map(function(E){return E.value}),r._fontVariationLen=C.length,r._fontVariationAxesPtr=q(P),r._fontVariationValuesPtr=w(ba,"HEAPF32")):(r._fontVariationLen=0,r._fontVariationAxesPtr=Q,r._fontVariationValuesPtr=Q)}function H(r){d._free(r._fontFamiliesPtr);
d._free(r._shadowColorsPtr);d._free(r._shadowOffsetsPtr);d._free(r._shadowBlurRadiiPtr);d._free(r._fontFeatureNamesPtr);d._free(r._fontFeatureValuesPtr);d._free(r._fontVariationAxesPtr);d._free(r._fontVariationValuesPtr)}d.Paragraph.prototype.getRectsForRange=function(r,C,P,ba){r=this._getRectsForRange(r,C,P,ba);return g(r)};d.Paragraph.prototype.getRectsForPlaceholders=function(){var r=this._getRectsForPlaceholders();return g(r)};d.Paragraph.prototype.getGlyphInfoAt=function(r){return c(this._getGlyphInfoAt(r))};
d.Paragraph.prototype.getClosestGlyphInfoAtCoordinate=function(r,C){return c(this._getClosestGlyphInfoAtCoordinate(r,C))};d.TypefaceFontProvider.prototype.registerFont=function(r,C){r=d.Typeface.MakeTypefaceFromData(r);if(!r)return null;C=x(C);this._registerFont(r,C);r.delete()};d.ParagraphStyle=function(r){r.disableHinting=r.disableHinting||!1;if(r.ellipsis){var C=r.ellipsis;r._ellipsisPtr=x(C);r._ellipsisLen=Aa(C)}else r._ellipsisPtr=Q,r._ellipsisLen=0;null==r.heightMultiplier&&(r.heightMultiplier=
-1);r.maxLines=r.maxLines||0;r.replaceTabCharacters=r.replaceTabCharacters||!1;C=(C=r.strutStyle)||{};C.strutEnabled=C.strutEnabled||!1;C.strutEnabled&&Array.isArray(C.fontFamilies)&&C.fontFamilies.length?(C._fontFamiliesPtr=q(C.fontFamilies),C._fontFamiliesLen=C.fontFamilies.length):(C._fontFamiliesPtr=Q,C._fontFamiliesLen=0);C.fontStyle=l(C.fontStyle);null==C.fontSize&&(C.fontSize=-1);null==C.heightMultiplier&&(C.heightMultiplier=-1);C.halfLeading=C.halfLeading||!1;C.leading=C.leading||0;C.forceStrutHeight=
C.forceStrutHeight||!1;r.strutStyle=C;r.textAlign=r.textAlign||d.TextAlign.Start;r.textDirection=r.textDirection||d.TextDirection.LTR;r.textHeightBehavior=r.textHeightBehavior||d.TextHeightBehavior.All;r.textStyle=d.TextStyle(r.textStyle);r.applyRoundingHack=!1!==r.applyRoundingHack;return r};d.TextStyle=function(r){r.color||(r.color=d.BLACK);r.decoration=r.decoration||0;r.decorationThickness=r.decorationThickness||0;r.decorationStyle=r.decorationStyle||d.DecorationStyle.Solid;r.textBaseline=r.textBaseline||
d.TextBaseline.Alphabetic;null==r.fontSize&&(r.fontSize=-1);r.letterSpacing=r.letterSpacing||0;r.wordSpacing=r.wordSpacing||0;null==r.heightMultiplier&&(r.heightMultiplier=-1);r.halfLeading=r.halfLeading||!1;r.fontStyle=l(r.fontStyle);return r};var K={},M=d._malloc(16),T=d._malloc(16),R=d._malloc(16);d.ParagraphBuilder.Make=function(r,C){A(r.textStyle);C=d.ParagraphBuilder._Make(r,C);H(r.textStyle);return C};d.ParagraphBuilder.MakeFromFontProvider=function(r,C){A(r.textStyle);C=d.ParagraphBuilder._MakeFromFontProvider(r,
C);H(r.textStyle);return C};d.ParagraphBuilder.MakeFromFontCollection=function(r,C){A(r.textStyle);C=d.ParagraphBuilder._MakeFromFontCollection(r,C);H(r.textStyle);return C};d.ParagraphBuilder.ShapeText=function(r,C,P){let ba=0;for(const ja of C)ba+=ja.length;if(ba!==r.length)throw"Accumulated block lengths must equal text.length";return d.ParagraphBuilder._ShapeText(r,C,P)};d.ParagraphBuilder.prototype.pushStyle=function(r){A(r);this._pushStyle(r);H(r)};d.ParagraphBuilder.prototype.pushPaintStyle=
function(r,C,P){A(r);this._pushPaintStyle(r,C,P);H(r)};d.ParagraphBuilder.prototype.addPlaceholder=function(r,C,P,ba,ja){P=P||d.PlaceholderAlignment.Baseline;ba=ba||d.TextBaseline.Alphabetic;this._addPlaceholder(r||0,C||0,P,ba,ja||0)};d.ParagraphBuilder.prototype.setWordsUtf8=function(r){var C=w(r,"HEAPU32");this._setWordsUtf8(C,r&&r.length||0);t(C,r)};d.ParagraphBuilder.prototype.setWordsUtf16=function(r){var C=w(r,"HEAPU32");this._setWordsUtf16(C,r&&r.length||0);t(C,r)};d.ParagraphBuilder.prototype.setGraphemeBreaksUtf8=
function(r){var C=w(r,"HEAPU32");this._setGraphemeBreaksUtf8(C,r&&r.length||0);t(C,r)};d.ParagraphBuilder.prototype.setGraphemeBreaksUtf16=function(r){var C=w(r,"HEAPU32");this._setGraphemeBreaksUtf16(C,r&&r.length||0);t(C,r)};d.ParagraphBuilder.prototype.setLineBreaksUtf8=function(r){var C=w(r,"HEAPU32");this._setLineBreaksUtf8(C,r&&r.length||0);t(C,r)};d.ParagraphBuilder.prototype.setLineBreaksUtf16=function(r){var C=w(r,"HEAPU32");this._setLineBreaksUtf16(C,r&&r.length||0);t(C,r)}})})(u);a.MakeManagedAnimation=
function(d,c,g,l,q){if(!a._MakeManagedAnimation)throw"Not compiled with MakeManagedAnimation";g||="";if(!c)return a._MakeManagedAnimation(d,0,Q,Q,Q,g,l,q);for(var x=[],A=[],H=[],K=Object.keys(c||{}),M=0;M<K.length;M++){var T=K[M],R=new Uint8Array(c[T]),r=a._malloc(R.byteLength);a.HEAPU8.set(R,r);A.push(r);H.push(R.byteLength);R=Aa(T)+1;r=a._malloc(R);Ba(T,r,R);x.push(r)}c=w(x,"HEAPU32");A=w(A,"HEAPU32");H=w(H,"HEAPU32");d=a._MakeManagedAnimation(d,K.length,c,A,H,g,l,q);a._free(c);a._free(A);a._free(H);
return d};a.Zf=function(d){d.text=d.text||"";d.textSize=d.textSize||0;d.minTextSize=d.minTextSize||0;d.maxTextSize=d.maxTextSize||Number.MAX_VALUE;d.strokeWidth=d.strokeWidth||0;d.lineHeight=d.lineHeight||0;d.lineShift=d.lineShift||0;d.ascent=d.ascent||0;d.maxLines=d.maxLines||0;d.horizAlign=d.horizAlign||a.TextAlign.Left;d.vertAlign=d.vertAlign||a.$f.Top;d.strokeJoin=d.strokeJoin||a.StrokeJoin.Miter;d.direction=d.direction||a.TextDirection.LTR;d.linebreak=d.linebreak||a.LineBreakType.HardLineBreak;
d.resize=d.resize||a.Yf.None;d.fillColor||(d.fillColor=a.TRANSPARENT);d.strokeColor||(d.strokeColor=a.TRANSPARENT);d.boundingBox||(d.boundingBox=[0,0,0,0]);return d};(function(d){d.Od=d.Od||[];d.Od.push(function(){d.Animation.prototype.render=function(c,g){S(g,aa);this._render(c,aa)};d.Animation.prototype.size=function(c){this._size(aa);var g=na.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,aa);this._render(c,
aa)},d.ManagedAnimation.prototype.seek=function(c,g){this._seek(c,aa);c=na.toTypedArray();return g?(g.set(c),g):c.slice()},d.ManagedAnimation.prototype.seekFrame=function(c,g){this._seekFrame(c,aa);c=na.toTypedArray();return g?(g.set(c),g):c.slice()},d.ManagedAnimation.prototype.setColor=function(c,g){g=V(g);return this._setColor(c,g)},d.ManagedAnimation.prototype.setColorSlot=function(c,g){g=V(g);return this._setColorSlot(c,g)},d.ManagedAnimation.prototype.getColorSlot=function(c){this._getColorSlot(c,
Ha);c=ea(Ha);return-1==c[0]?null:c},d.ManagedAnimation.prototype.setVec2Slot=function(c,g){w(g,"HEAPF32",ab);return this._setVec2Slot(c,ab)},d.ManagedAnimation.prototype.getVec2Slot=function(c){this._getVec2Slot(c,ab);c=Rb.toTypedArray();return-1===c[2]?null:c.slice(0,2)},d.ManagedAnimation.prototype.setTextSlot=function(c,g){var l=V(g.fillColor,Ha),q=V(g.strokeColor,aa),x=S(g.boundingBox,Ma);g._fillColorPtr=l;g._strokeColorPtr=q;g._boundingBoxPtr=x;return this._setTextSlot(c,g)},d.ManagedAnimation.prototype.setTransform=
function(c,g,l,q,x,A,H){g=w([g[0],g[1],l[0],l[1],q[0],q[1],x,A,H],"HEAPF32",va);return this._setTransform(c,g)},d.ManagedAnimation.prototype.size=function(c){this._size(aa);var g=na.toTypedArray();return c?(c[0]=g[0],c[1]=g[1],c):g.slice(0,2)})})})(u);a.Od=a.Od||[];a.Od.push(function(){});a.Od=a.Od||[];a.Od.push(function(){a.Canvas.prototype.drawText=function(d,c,g,l,q){var x=Aa(d),A=a._malloc(x+1);Ba(d,A,x+1);this._drawSimpleText(A,x,c,g,q,l);a._free(A)};a.Canvas.prototype.drawGlyphs=function(d,
c,g,l,q,x){if(!(2*d.length<=c.length))throw"Not enough positions for the array of gyphs";a.Id(this.Gd);const A=w(d,"HEAPU16"),H=w(c,"HEAPF32");this._drawGlyphs(d.length,A,H,g,l,q,x);t(H,c);t(A,d)};a.Font.prototype.getGlyphBounds=function(d,c,g){var l=w(d,"HEAPU16"),q=a._malloc(16*d.length);this._getGlyphWidthBounds(l,d.length,Q,q,c||null);c=new Float32Array(a.HEAPU8.buffer,q,4*d.length);t(l,d);if(g)return g.set(c),a._free(q),g;d=Float32Array.from(c);a._free(q);return d};a.Font.prototype.getGlyphIDs=
function(d,c,g){c||(c=d.length);var l=Aa(d)+1,q=a._malloc(l);Ba(d,q,l);d=a._malloc(2*c);c=this._getGlyphIDs(q,l-1,c,d);a._free(q);if(0>c)return a._free(d),null;q=new Uint16Array(a.HEAPU8.buffer,d,c);if(g)return g.set(q),a._free(d),g;g=Uint16Array.from(q);a._free(d);return g};a.Font.prototype.getGlyphIntercepts=function(d,c,g,l){var q=w(d,"HEAPU16"),x=w(c,"HEAPF32");return this._getGlyphIntercepts(q,d.length,!(d&&d._ck),x,c.length,!(c&&c._ck),g,l)};a.Font.prototype.getGlyphWidths=function(d,c,g){var l=
w(d,"HEAPU16"),q=a._malloc(4*d.length);this._getGlyphWidthBounds(l,d.length,q,Q,c||null);c=new Float32Array(a.HEAPU8.buffer,q,d.length);t(l,d);if(g)return g.set(c),a._free(q),g;d=Float32Array.from(c);a._free(q);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 q=new Uint8Array(d[l]),x=w(q,"HEAPU8");c.push(x);g.push(q.byteLength)}c=w(c,"HEAPU32");
g=w(g,"HEAPU32");d=a.FontMgr._fromData(c,g,d.length);a._free(c);a._free(g);return d};a.Typeface.MakeTypefaceFromData=function(d){d=new Uint8Array(d);var c=w(d,"HEAPU8");return(d=a.Typeface._MakeTypefaceFromData(c,d.byteLength))?d:null};a.Typeface.MakeFreeTypeFaceFromData=a.Typeface.MakeTypefaceFromData;a.Typeface.prototype.getGlyphIDs=function(d,c,g){c||(c=d.length);var l=Aa(d)+1,q=a._malloc(l);Ba(d,q,l);d=a._malloc(2*c);c=this._getGlyphIDs(q,l-1,c,d);a._free(q);if(0>c)return a._free(d),null;q=new Uint16Array(a.HEAPU8.buffer,
d,c);if(g)return g.set(q),a._free(d),g;g=Uint16Array.from(q);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||=0;var q=g.getGlyphIDs(d);q=g.getGlyphWidths(q);var x=[];c=new a.ContourMeasureIter(c,!1,1);for(var A=c.next(),H=new Float32Array(4),K=0;K<d.length&&A;K++){var M=q[K];l+=M/2;if(l>A.length()){A.delete();A=c.next();if(!A){d=d.substring(0,K);break}l=M/2}A.getPosTan(l,H);var T=H[2],R=H[3];x.push(T,
R,H[0]-M/2*T,H[1]-M/2*R);l+=M/2}d=this.MakeFromRSXform(d,x,g);A&&A.delete();c.delete();return d}};a.TextBlob.MakeFromRSXform=function(d,c,g){var l=Aa(d)+1,q=a._malloc(l);Ba(d,q,l);d=w(c,"HEAPF32");g=a.TextBlob._MakeFromRSXform(q,l-1,d,g);a._free(q);return g?g:null};a.TextBlob.MakeFromRSXformGlyphs=function(d,c,g){var l=w(d,"HEAPU16");c=w(c,"HEAPF32");g=a.TextBlob._MakeFromRSXformGlyphs(l,2*d.length,c,g);t(l,d);return g?g:null};a.TextBlob.MakeFromGlyphs=function(d,c){var g=w(d,"HEAPU16");c=a.TextBlob._MakeFromGlyphs(g,
2*d.length,c);t(g,d);return c?c:null};a.TextBlob.MakeFromText=function(d,c){var g=Aa(d)+1,l=a._malloc(g);Ba(d,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.Od=a.Od||[];a.Od.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.Od=a.Od||[];a.Od.push(function(){a.RuntimeEffect.Make=function(d,c){return a.RuntimeEffect._Make(d,
{onError:c||function(g){console.log("RuntimeEffect error",g)}})};a.RuntimeEffect.MakeForBlender=function(d,c){return a.RuntimeEffect._MakeForBlender(d,{onError:c||function(g){console.log("RuntimeEffect error",g)}})};a.RuntimeEffect.prototype.makeShader=function(d,c){var g=!d._ck,l=w(d,"HEAPF32");c=G(c);return this._makeShader(l,4*d.length,g,c)};a.RuntimeEffect.prototype.makeShaderWithChildren=function(d,c,g){var l=!d._ck,q=w(d,"HEAPF32");g=G(g);for(var x=[],A=0;A<c.length;A++)x.push(c[A].Fd.Md);c=
w(x,"HEAPU32");return this._makeShaderWithChildren(q,4*d.length,l,c,x.length,g)};a.RuntimeEffect.prototype.makeBlender=function(d){var c=!d._ck,g=w(d,"HEAPF32");return this._makeBlender(g,4*d.length,c)}});(function(){function d(E){for(var k=0;k<E.length;k++)if(void 0!==E[k]&&!Number.isFinite(E[k]))return!1;return!0}function c(E){var k=a.getColorComponents(E);E=k[0];var p=k[1],y=k[2];k=k[3];if(1===k)return E=E.toString(16).toLowerCase(),p=p.toString(16).toLowerCase(),y=y.toString(16).toLowerCase(),
E=1===E.length?"0"+E:E,p=1===p.length?"0"+p:p,y=1===y.length?"0"+y:y,"#"+E+p+y;k=0===k||1===k?k:k.toFixed(8);return"rgba("+E+", "+p+", "+y+", "+k+")"}function g(E){return a.parseColorString(E,wa)}function l(E){E=xa.exec(E);if(!E)return null;var k=parseFloat(E[4]),p=16;switch(E[5]){case "em":case "rem":p=16*k;break;case "pt":p=4*k/3;break;case "px":p=k;break;case "pc":p=16*k;break;case "in":p=96*k;break;case "cm":p=96*k/2.54;break;case "mm":p=96/25.4*k;break;case "q":p=96/25.4/4*k;break;case "%":p=
16/75*k}return{style:E[1],variant:E[2],weight:E[3],sizePx:p,family:E[6].trim()}}function q(){la||={"Noto Mono":{"*":a.Typeface.GetDefault()},monospace:{"*":a.Typeface.GetDefault()}}}function x(E){this.Hd=E;this.Kd=new a.Paint;this.Kd.setAntiAlias(!0);this.Kd.setStrokeMiter(10);this.Kd.setStrokeCap(a.StrokeCap.Bu