canvaskit-wasm
Version:
A WASM version of Skia's Canvas API
109 lines (106 loc) • 130 kB
JavaScript
var CanvasKitInit = (function() {
var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined;
if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename;
return (
function(CanvasKitInit) {
CanvasKitInit = CanvasKitInit || {};
null;var t;t||(t=typeof CanvasKitInit !== 'undefined' ? CanvasKitInit : {});var ea,ha;t.ready=new Promise(function(a,b){ea=a;ha=b});
(function(a){a.Sd=a.Sd||[];a.Sd.push(function(){a.MakeSWCanvasSurface=function(b){var d=b;if("CANVAS"!==d.tagName&&(d=document.getElementById(b),!d))throw"Canvas with id "+b+" was not found";if(b=a.MakeSurface(d.width,d.height))b.Nd=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,l=a._malloc(h);if(f=a.Surface._makeRasterDirect(f,
l,4*b))f.Nd=null,f.Af=b,f.xf=d,f.zf=h,f.af=l,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.Od(this.Md);this._flush();if(this.Nd){var d=new Uint8ClampedArray(a.HEAPU8.buffer,this.af,this.zf);d=new ImageData(d,this.Af,this.xf);b?this.Nd.getContext("2d").putImageData(d,0,0,b[0],b[1],b[2]-b[0],b[3]-b[1]):this.Nd.getContext("2d").putImageData(d,0,0)}};a.Surface.prototype.dispose=
function(){this.af&&a._free(this.af);this.delete()};a.Od=a.Od||function(){}})})(t);
(function(a){a.Sd=a.Sd||[];a.Sd.push(function(){function b(l,n,r){return l&&l.hasOwnProperty(n)?l[n]:r}function d(l){var n=ia.length;n||(ia.push(null),n=1);ia.push(l);return n}function f(l){return l.naturalHeight||l.videoHeight||l.displayHeight||l.height}function h(l){return l.naturalWidth||l.videoWidth||l.displayWidth||l.width}a.GetWebGLContext=function(l,n){if(!l)throw"null canvas passed into makeWebGLContext";var r={alpha:b(n,"alpha",1),depth:b(n,"depth",1),stencil:b(n,"stencil",8),antialias:b(n,
"antialias",0),premultipliedAlpha:b(n,"premultipliedAlpha",1),preserveDrawingBuffer:b(n,"preserveDrawingBuffer",0),preferLowPowerToHighPerformance:b(n,"preferLowPowerToHighPerformance",0),failIfMajorPerformanceCaveat:b(n,"failIfMajorPerformanceCaveat",0),enableExtensionsByDefault:b(n,"enableExtensionsByDefault",1),explicitSwapControl:b(n,"explicitSwapControl",0),renderViaOffscreenBackBuffer:b(n,"renderViaOffscreenBackBuffer",0)};r.majorVersion=n&&n.majorVersion?n.majorVersion:"undefined"!==typeof WebGL2RenderingContext?
2:1;if(r.explicitSwapControl)throw"explicitSwapControl is not supported";l=ja(l,r);if(!l)return 0;la(l);return l};a.deleteContext=function(l){w===ma[l]&&(w=null);"object"===typeof JSEvents&&JSEvents.Fg(ma[l].le.canvas);ma[l]&&ma[l].le.canvas&&(ma[l].le.canvas.wf=void 0);ma[l]=null};a._setTextureCleanup({deleteTexture:function(l,n){var r=ia[n];r&&ma[l].le.deleteTexture(r);ia[n]=null}});a.MakeGrContext=function(l){if(!this.Od(l))return null;var n=this._MakeGrContext();if(!n)return null;n.Md=l;return n};
a.MakeOnScreenGLSurface=function(l,n,r,x){n=this._MakeOnScreenGLSurface(l,n,r,x);if(!n)return null;n.Md=l.Md;return n};a.MakeRenderTarget=function(l,n,r){n=this._MakeRenderTargetWH(l,n,r);if(!n)return null;n.Md=l.Md;return n};a.MakeRenderTarget=function(l,n){n=this._MakeRenderTargetII(l,n);if(!n)return null;n.Md=l.Md;return n};a.MakeWebGLCanvasSurface=function(l,n,r){n=n||null;var x=l,v="undefined"!==typeof OffscreenCanvas&&x instanceof OffscreenCanvas;if(!("undefined"!==typeof HTMLCanvasElement&&
x instanceof HTMLCanvasElement||v||(x=document.getElementById(l),x)))throw"Canvas with id "+l+" was not found";l=this.GetWebGLContext(x,r);if(!l||0>l)throw"failed to create webgl context: err "+l;l=this.MakeGrContext(l);n=this.MakeOnScreenGLSurface(l,x.width,x.height,n);return n?n:(n=x.cloneNode(!0),x.parentNode.replaceChild(n,x),n.classList.add("ck-replaced"),a.MakeSWCanvasSurface(n))};a.MakeCanvasSurface=a.MakeWebGLCanvasSurface;a.Surface.prototype.makeImageFromTexture=function(l,n){a.Od(this.Md);
l=d(l);return this._makeImageFromTexture(this.Md,l,n)};a.Surface.prototype.makeImageFromTextureSource=function(l,n){n||(n={height:f(l),width:h(l),colorType:a.ColorType.RGBA_8888,alphaType:a.AlphaType.Unpremul});n.colorSpace||(n.colorSpace=a.ColorSpace.SRGB);a.Od(this.Md);var r=w.le,x=r.createTexture();r.bindTexture(r.TEXTURE_2D,x);2===w.version?r.texImage2D(r.TEXTURE_2D,0,r.RGBA,n.width,n.height,0,r.RGBA,r.UNSIGNED_BYTE,l):r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,l);r.bindTexture(r.TEXTURE_2D,
null);return this.makeImageFromTexture(x,n)};a.MakeLazyImageFromTextureSource=function(l,n){n||(n={height:f(l),width:h(l),colorType:a.ColorType.RGBA_8888,alphaType:a.AlphaType.Unpremul});n.colorSpace||(n.colorSpace=a.ColorSpace.SRGB);var r={makeTexture:function(){var x=w,v=x.le,G=v.createTexture();v.bindTexture(v.TEXTURE_2D,G);2===x.version?v.texImage2D(v.TEXTURE_2D,0,v.RGBA,n.width,n.height,0,v.RGBA,v.UNSIGNED_BYTE,l):v.texImage2D(v.TEXTURE_2D,0,v.RGBA,v.RGBA,v.UNSIGNED_BYTE,l);v.bindTexture(v.TEXTURE_2D,
null);return d(G)},freeSrc:function(){}};"VideoFrame"===l.constructor.name&&(r.freeSrc=function(){l.close()});return a.Image._makeFromGenerator(n,r)};a.Od=function(l){return l?la(l):!1}})})(t);
(function(a){function b(e,c,g,m,q){for(var y=0;y<e.length;y++)c[y*g+(y*q+m+g)%g]=e[y];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(r(255*e[3])<<24|r(255*e[0])<<16|r(255*e[1])<<8|r(255*e[2])<<0)>>>0}function l(e){if(e&&e._ck)return e;if(e instanceof Float32Array){for(var c=Math.floor(e.length/4),g=new Uint32Array(c),m=0;m<c;m++)g[m]=h(e.slice(4*m,4*(m+1)));return g}if(e instanceof
Uint32Array)return e;if(e instanceof Array&&e[0]instanceof Float32Array)return e.map(h)}function n(e){if(void 0===e)return 1;var c=parseFloat(e);return e&&-1!==e.indexOf("%")?c/100:c}function r(e){return Math.round(Math.max(0,Math.min(e||0,255)))}function x(e,c){c&&c._ck||a._free(e)}function v(e,c,g){if(!e||!e.length)return S;if(e&&e._ck)return e.byteOffset;var m=a[c].BYTES_PER_ELEMENT;g||(g=a._malloc(e.length*m));a[c].set(e,g/m);return g}function G(e){var c={ce:S,count:e.length,Ke:a.ColorType.RGBA_F32};
if(e instanceof Float32Array)c.ce=v(e,"HEAPF32"),c.count=e.length/4;else if(e instanceof Uint32Array)c.ce=v(e,"HEAPU32"),c.Ke=a.ColorType.RGBA_8888;else if(e instanceof Array){if(e&&e.length){for(var g=a._malloc(16*e.length),m=0,q=g/4,y=0;y<e.length;y++)for(var C=0;4>C;C++)a.HEAPF32[q+m]=e[y][C],m++;e=g}else e=S;c.ce=e}else throw"Invalid argument to copyFlexibleColorArray, Not a color array "+typeof e;return c}function K(e){if(!e)return S;if(e.length){if(6===e.length||9===e.length)return v(e,"HEAPF32",
Na),6===e.length&&a.HEAPF32.set(Fd,6+Na/4),Na;if(16===e.length){var c=Cb.toTypedArray();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];return Na}throw"invalid matrix size";}c=Cb.toTypedArray();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 Na}function P(e){if(!e)return S;var c=fc.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",ab);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[12]=e[6];c[13]=e[7];c[15]=e[8];6===e.length&&(c[12]=0,c[13]=0,c[15]=1);return ab}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 ab}function A(e,c){return v(e,"HEAPF32",c||ib)}function O(e,c,g,m){var q=hc.toTypedArray();q[0]=e;q[1]=c;q[2]=g;q[3]=m;return ib}function Y(e){for(var c=
new Float32Array(4),g=0;4>g;g++)c[g]=a.HEAPF32[e/4+g];return c}function T(e,c){return v(e,"HEAPF32",c||da)}function oa(e,c){return v(e,"HEAPF32",c||ic)}function wa(){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 m=Array(e.length),q=0;q<g;q++)for(var y=0;y<g;y++){for(var C=0,J=0;J<g;J++)C+=e[g*q+J]*c[g*J+y];m[q*g+y]=C}return m}function kb(e,c){for(var g=jb(c[0],c[1],e),m=2;m<c.length;)g=jb(g,c[m],e),m++;return g}a.Color=function(e,c,g,
m){void 0===m&&(m=1);return a.Color4f(r(e)/255,r(c)/255,r(g)/255,m)};a.ColorAsInt=function(e,c,g,m){void 0===m&&(m=255);return(r(m)<<24|r(e)<<16|r(c)<<8|r(g)<<0&268435455)>>>0};a.Color4f=function(e,c,g,m){void 0===m&&(m=1);return Float32Array.of(e,c,g,m)};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 m=parseInt(e.slice(3,5),16);var q=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),m=17*parseInt(e.slice(2,3),16),q=17*parseInt(e.slice(3,4),16)}return a.Color(g,m,q,c/255)}return e.startsWith("rgba")?(e=e.slice(5,-1),e=e.split(","),a.Color(+e[0],
+e[1],+e[2],n(e[3]))):e.startsWith("rgb")?(e=e.slice(4,-1),e=e.split(","),a.Color(+e[0],+e[1],+e[2],n(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,pe:null,subarray:function(m,q){m=this.toTypedArray().subarray(m,q);m._ck=!0;return m},toTypedArray:function(){if(this.pe&&this.pe.length)return this.pe;
this.pe=new e(a.HEAPU8.buffer,g,c);this.pe._ck=!0;return this.pe}}};a.Free=function(e){a._free(e.byteOffset);e.byteOffset=S;e.toTypedArray=null;e.pe=null};var Na=S,Cb,ab=S,fc,ib=S,hc,pa,da=S,Mc,Ua=S,Nc,jc=S,Oc,kc=S,Pc,lc=S,Qc,ic=S,Rc,Sc=S,Fd=Float32Array.of(0,0,1),S=0;a.onRuntimeInitialized=function(){function e(c,g,m,q,y,C){C||(C=4*q.width,q.colorType===a.ColorType.RGBA_F16?C*=2:q.colorType===a.ColorType.RGBA_F32&&(C*=4));var J=C*q.height;var L=y?y.byteOffset:a._malloc(J);if(!c._readPixels(q,L,C,
g,m))return y||a._free(L),null;if(y)return y.toTypedArray();switch(q.colorType){case a.ColorType.RGBA_8888:case a.ColorType.RGBA_F16:c=(new Uint8Array(a.HEAPU8.buffer,L,J)).slice();break;case a.ColorType.RGBA_F32:c=(new Float32Array(a.HEAPU8.buffer,L,J)).slice();break;default:return null}a._free(L);return c}hc=a.Malloc(Float32Array,4);ib=hc.byteOffset;fc=a.Malloc(Float32Array,16);ab=fc.byteOffset;Cb=a.Malloc(Float32Array,9);Na=Cb.byteOffset;Qc=a.Malloc(Float32Array,12);ic=Qc.byteOffset;Rc=a.Malloc(Float32Array,
12);Sc=Rc.byteOffset;pa=a.Malloc(Float32Array,4);da=pa.byteOffset;Mc=a.Malloc(Float32Array,4);Ua=Mc.byteOffset;Nc=a.Malloc(Float32Array,3);jc=Nc.byteOffset;Oc=a.Malloc(Float32Array,3);kc=Oc.byteOffset;Pc=a.Malloc(Int32Array,4);lc=Pc.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"),
m=a.Path._MakeFromCmds(g,c.length);x(g,c);return m};a.Path.MakeFromVerbsPointsWeights=function(c,g,m){var q=v(c,"HEAPU8"),y=v(g,"HEAPF32"),C=v(m,"HEAPF32"),J=a.Path._MakeFromVerbsPointsWeights(q,c.length,y,g.length,C,m&&m.length||0);x(q,c);x(y,g);x(C,m);return J};a.Path.prototype.addArc=function(c,g,m){c=T(c);this._addArc(c,g,m);return this};a.Path.prototype.addOval=function(c,g,m){void 0===m&&(m=1);c=T(c);this._addOval(c,!!g,m);return this};a.Path.prototype.addPath=function(){var c=Array.prototype.slice.call(arguments),
g=c[0],m=!1;"boolean"===typeof c[c.length-1]&&(m=c.pop());if(1===c.length)this._addPath(g,1,0,0,0,1,0,0,0,1,m);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,m);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,m);else return null;return this};a.Path.prototype.addPoly=function(c,g){var m=v(c,"HEAPF32");this._addPoly(m,c.length/2,g);x(m,c);return this};a.Path.prototype.addRect=function(c,g){c=
T(c);this._addRect(c,!!g);return this};a.Path.prototype.addRRect=function(c,g){c=oa(c);this._addRRect(c,!!g);return this};a.Path.prototype.addVerbsPointsWeights=function(c,g,m){var q=v(c,"HEAPU8"),y=v(g,"HEAPF32"),C=v(m,"HEAPF32");this._addVerbsPointsWeights(q,c.length,y,g.length,C,m&&m.length||0);x(q,c);x(y,g);x(C,m)};a.Path.prototype.arc=function(c,g,m,q,y,C){c=a.LTRBRect(c-m,g-m,c+m,g+m);y=(y-q)/Math.PI*180-360*!!C;C=new a.Path;C.addArc(c,q/Math.PI*180,y);this.addPath(C,!0);C.delete();return this};
a.Path.prototype.arcToOval=function(c,g,m,q){c=T(c);this._arcToOval(c,g,m,q);return this};a.Path.prototype.arcToRotated=function(c,g,m,q,y,C,J){this._arcToRotated(c,g,m,!!q,!!y,C,J);return this};a.Path.prototype.arcToTangent=function(c,g,m,q,y){this._arcToTangent(c,g,m,q,y);return this};a.Path.prototype.close=function(){this._close();return this};a.Path.prototype.conicTo=function(c,g,m,q,y){this._conicTo(c,g,m,q,y);return this};a.Path.prototype.computeTightBounds=function(c){this._computeTightBounds(da);
var g=pa.toTypedArray();return c?(c.set(g),c):g.slice()};a.Path.prototype.cubicTo=function(c,g,m,q,y,C){this._cubicTo(c,g,m,q,y,C);return this};a.Path.prototype.dash=function(c,g,m){return this._dash(c,g,m)?this:null};a.Path.prototype.getBounds=function(c){this._getBounds(da);var g=pa.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,m,q){this._quadTo(c,g,m,q);return this};a.Path.prototype.rArcTo=function(c,g,m,q,y,C,J){this._rArcTo(c,g,m,q,y,C,J);return this};a.Path.prototype.rConicTo=function(c,g,m,q,y){this._rConicTo(c,g,m,q,y);return this};a.Path.prototype.rCubicTo=function(c,g,m,q,y,C){this._rCubicTo(c,g,m,q,y,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,m,q){this._rQuadTo(c,g,m,q);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,m){return this._trim(c,g,!!m)?this:null};a.Image.prototype.makeShaderCubic=function(c,g,m,q,y){y=K(y);return this._makeShaderCubic(c,g,m,q,y)};a.Image.prototype.makeShaderOptions=function(c,g,m,q,y){y=K(y);return this._makeShaderOptions(c,g,m,q,y)};a.Image.prototype.readPixels=
function(c,g,m,q,y){return e(this,c,g,m,q,y)};a.Canvas.prototype.clear=function(c){a.Od(this.Md);c=A(c);this._clear(c)};a.Canvas.prototype.clipRRect=function(c,g,m){a.Od(this.Md);c=oa(c);this._clipRRect(c,g,m)};a.Canvas.prototype.clipRect=function(c,g,m){a.Od(this.Md);c=T(c);this._clipRect(c,g,m)};a.Canvas.prototype.concat=function(c){a.Od(this.Md);c=P(c);this._concat(c)};a.Canvas.prototype.drawArc=function(c,g,m,q,y){a.Od(this.Md);c=T(c);this._drawArc(c,g,m,q,y)};a.Canvas.prototype.drawAtlas=function(c,
g,m,q,y,C,J){if(c&&q&&g&&m&&g.length===m.length){a.Od(this.Md);y||(y=a.BlendMode.SrcOver);var L=v(g,"HEAPF32"),N=v(m,"HEAPF32"),U=m.length/4,u=v(l(C),"HEAPU32");if(J&&"B"in J&&"C"in J)this._drawAtlasCubic(c,N,L,u,U,y,J.B,J.C,q);else{let F=a.FilterMode.Linear,R=a.MipmapMode.None;J&&(F=J.filter,"mipmap"in J&&(R=J.mipmap));this._drawAtlasOptions(c,N,L,u,U,y,F,R,q)}x(L,g);x(N,m);x(u,C)}};a.Canvas.prototype.drawCircle=function(c,g,m,q){a.Od(this.Md);this._drawCircle(c,g,m,q)};a.Canvas.prototype.drawColor=
function(c,g){a.Od(this.Md);c=A(c);void 0!==g?this._drawColor(c,g):this._drawColor(c)};a.Canvas.prototype.drawColorInt=function(c,g){a.Od(this.Md);this._drawColorInt(c,g||a.BlendMode.SrcOver)};a.Canvas.prototype.drawColorComponents=function(c,g,m,q,y){a.Od(this.Md);c=O(c,g,m,q);void 0!==y?this._drawColor(c,y):this._drawColor(c)};a.Canvas.prototype.drawDRRect=function(c,g,m){a.Od(this.Md);c=oa(c,ic);g=oa(g,Sc);this._drawDRRect(c,g,m)};a.Canvas.prototype.drawGlyphs=function(c,g,m,q,y,C){if(!(2*c.length<=
g.length))throw"Not enough positions for the array of gyphs";a.Od(this.Md);const J=v(c,"HEAPU16"),L=v(g,"HEAPF32");this._drawGlyphs(c.length,J,L,m,q,y,C);x(L,g);x(J,c)};a.Canvas.prototype.drawImage=function(c,g,m,q){a.Od(this.Md);this._drawImage(c,g,m,q||null)};a.Canvas.prototype.drawImageCubic=function(c,g,m,q,y,C){a.Od(this.Md);this._drawImageCubic(c,g,m,q,y,C||null)};a.Canvas.prototype.drawImageOptions=function(c,g,m,q,y,C){a.Od(this.Md);this._drawImageOptions(c,g,m,q,y,C||null)};a.Canvas.prototype.drawImageNine=
function(c,g,m,q,y){a.Od(this.Md);g=v(g,"HEAP32",lc);m=T(m);this._drawImageNine(c,g,m,q,y||null)};a.Canvas.prototype.drawImageRect=function(c,g,m,q,y){a.Od(this.Md);T(g,da);T(m,Ua);this._drawImageRect(c,da,Ua,q,!!y)};a.Canvas.prototype.drawImageRectCubic=function(c,g,m,q,y,C){a.Od(this.Md);T(g,da);T(m,Ua);this._drawImageRectCubic(c,da,Ua,q,y,C||null)};a.Canvas.prototype.drawImageRectOptions=function(c,g,m,q,y,C){a.Od(this.Md);T(g,da);T(m,Ua);this._drawImageRectOptions(c,da,Ua,q,y,C||null)};a.Canvas.prototype.drawLine=
function(c,g,m,q,y){a.Od(this.Md);this._drawLine(c,g,m,q,y)};a.Canvas.prototype.drawOval=function(c,g){a.Od(this.Md);c=T(c);this._drawOval(c,g)};a.Canvas.prototype.drawPaint=function(c){a.Od(this.Md);this._drawPaint(c)};a.Canvas.prototype.drawParagraph=function(c,g,m){a.Od(this.Md);this._drawParagraph(c,g,m)};a.Canvas.prototype.drawPatch=function(c,g,m,q,y){if(24>c.length)throw"Need 12 cubic points";if(g&&4>g.length)throw"Need 4 colors";if(m&&8>m.length)throw"Need 4 shader coordinates";a.Od(this.Md);
const C=v(c,"HEAPF32"),J=g?v(l(g),"HEAPU32"):S,L=m?v(m,"HEAPF32"):S;q||(q=a.BlendMode.Modulate);this._drawPatch(C,J,L,q,y);x(L,m);x(J,g);x(C,c)};a.Canvas.prototype.drawPath=function(c,g){a.Od(this.Md);this._drawPath(c,g)};a.Canvas.prototype.drawPicture=function(c){a.Od(this.Md);this._drawPicture(c)};a.Canvas.prototype.drawPoints=function(c,g,m){a.Od(this.Md);var q=v(g,"HEAPF32");this._drawPoints(c,q,g.length/2,m);x(q,g)};a.Canvas.prototype.drawRRect=function(c,g){a.Od(this.Md);c=oa(c);this._drawRRect(c,
g)};a.Canvas.prototype.drawRect=function(c,g){a.Od(this.Md);c=T(c);this._drawRect(c,g)};a.Canvas.prototype.drawRect4f=function(c,g,m,q,y){a.Od(this.Md);this._drawRect4f(c,g,m,q,y)};a.Canvas.prototype.drawShadow=function(c,g,m,q,y,C,J){a.Od(this.Md);var L=v(y,"HEAPF32"),N=v(C,"HEAPF32");g=v(g,"HEAPF32",jc);m=v(m,"HEAPF32",kc);this._drawShadow(c,g,m,q,L,N,J);x(L,y);x(N,C)};a.getShadowLocalBounds=function(c,g,m,q,y,C,J){c=K(c);m=v(m,"HEAPF32",jc);q=v(q,"HEAPF32",kc);if(!this._getShadowLocalBounds(c,
g,m,q,y,C,da))return null;g=pa.toTypedArray();return J?(J.set(g),J):g.slice()};a.Canvas.prototype.drawTextBlob=function(c,g,m,q){a.Od(this.Md);this._drawTextBlob(c,g,m,q)};a.Canvas.prototype.drawVertices=function(c,g,m){a.Od(this.Md);this._drawVertices(c,g,m)};a.Canvas.prototype.getLocalToDevice=function(){this._getLocalToDevice(ab);for(var c=ab,g=Array(16),m=0;16>m;m++)g[m]=a.HEAPF32[c/4+m];return g};a.Canvas.prototype.getTotalMatrix=function(){this._getTotalMatrix(Na);for(var c=Array(9),g=0;9>g;g++)c[g]=
a.HEAPF32[Na/4+g];return c};a.Canvas.prototype.makeSurface=function(c){c=this._makeSurface(c);c.Md=this.Md;return c};a.Canvas.prototype.readPixels=function(c,g,m,q,y){a.Od(this.Md);return e(this,c,g,m,q,y)};a.Canvas.prototype.saveLayer=function(c,g,m,q){g=T(g);return this._saveLayer(c||null,g,m||null,q||0)};a.Canvas.prototype.writePixels=function(c,g,m,q,y,C,J,L){if(c.byteLength%(g*m))throw"pixels length must be a multiple of the srcWidth * srcHeight";a.Od(this.Md);var N=c.byteLength/(g*m);C=C||a.AlphaType.Unpremul;
J=J||a.ColorType.RGBA_8888;L=L||a.ColorSpace.SRGB;var U=N*g;N=v(c,"HEAPU8");g=this._writePixels({width:g,height:m,colorType:J,alphaType:C,colorSpace:L},N,U,q,y);x(N,c);return g};a.ColorFilter.MakeBlend=function(c,g){c=A(c);return a.ColorFilter._MakeBlend(c,g)};a.ColorFilter.MakeMatrix=function(c){if(!c||20!==c.length)throw"invalid color matrix";var g=v(c,"HEAPF32"),m=a.ColorFilter._makeMatrix(g);x(g,c);return m};a.ContourMeasure.prototype.getPosTan=function(c,g){this._getPosTan(c,da);c=pa.toTypedArray();
return g?(g.set(c),g):c.slice()};a.ImageFilter.MakeMatrixTransform=function(c,g,m){c=K(c);if("B"in g&&"C"in g)return a.ImageFilter._MakeMatrixTransformCubic(c,g.yg,g.zg,m);const q=g.filter;let y=a.MipmapMode.None;"mipmap"in g&&(y=g.mipmap);return a.ImageFilter._MakeMatrixTransformOptions(c,q,y,m)};a.Paint.prototype.getColor=function(){this._getColor(ib);return Y(ib)};a.Paint.prototype.setColor=function(c,g){g=g||null;c=A(c);this._setColor(c,g)};a.Paint.prototype.setColorComponents=function(c,g,m,
q,y){y=y||null;c=O(c,g,m,q);this._setColor(c,y)};a.Path.prototype.getPoint=function(c,g){this._getPoint(c,da);c=pa.toTypedArray();return g?(g[0]=c[0],g[1]=c[1],g):c.slice(0,2)};a.PictureRecorder.prototype.beginRecording=function(c){c=T(c);return this._beginRecording(c)};a.Surface.prototype.getCanvas=function(){var c=this._getCanvas();c.Md=this.Md;return c};a.Surface.prototype.makeImageSnapshot=function(c){a.Od(this.Md);c=v(c,"HEAP32",lc);return this._makeImageSnapshot(c)};a.Surface.prototype.makeSurface=
function(c){a.Od(this.Md);c=this._makeSurface(c);c.Md=this.Md;return c};a.Surface.prototype.requestAnimationFrame=function(c,g){this.Ge||(this.Ge=this.getCanvas());requestAnimationFrame(function(){a.Od(this.Md);c(this.Ge);this.flush(g)}.bind(this))};a.Surface.prototype.drawOnce=function(c,g){this.Ge||(this.Ge=this.getCanvas());requestAnimationFrame(function(){a.Od(this.Md);c(this.Ge);this.flush(g);this.dispose()}.bind(this))};a.PathEffect.MakeDash=function(c,g){g||(g=0);if(!c.length||1===c.length%
2)throw"Intervals array must have even length";var m=v(c,"HEAPF32");g=a.PathEffect._MakeDash(m,c.length,g);x(m,c);return g};a.Shader.MakeColor=function(c,g){g=g||null;c=A(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,m,q,y,C,J,L){L=L||null;var N=G(m),U=v(q,"HEAPF32");J=J||0;C=K(C);var u=pa.toTypedArray();u.set(c);u.set(g,2);c=a.Shader._MakeLinearGradient(da,N.ce,N.Ke,U,N.count,y,J,C,L);x(N.ce,m);q&&
x(U,q);return c};a.Shader.MakeRadialGradient=function(c,g,m,q,y,C,J,L){L=L||null;var N=G(m),U=v(q,"HEAPF32");J=J||0;C=K(C);c=a.Shader._MakeRadialGradient(c[0],c[1],g,N.ce,N.Ke,U,N.count,y,J,C,L);x(N.ce,m);q&&x(U,q);return c};a.Shader.MakeSweepGradient=function(c,g,m,q,y,C,J,L,N,U){U=U||null;var u=G(m),F=v(q,"HEAPF32");J=J||0;L=L||0;N=N||360;C=K(C);c=a.Shader._MakeSweepGradient(c,g,u.ce,u.Ke,F,u.count,y,L,N,J,C,U);x(u.ce,m);q&&x(F,q);return c};a.Shader.MakeTwoPointConicalGradient=function(c,g,m,q,
y,C,J,L,N,U){U=U||null;var u=G(y),F=v(C,"HEAPF32");N=N||0;L=K(L);var R=pa.toTypedArray();R.set(c);R.set(m,2);c=a.Shader._MakeTwoPointConicalGradient(da,g,q,u.ce,u.Ke,F,u.count,J,N,L,U);x(u.ce,y);C&&x(F,C);return c};a.Vertices.prototype.bounds=function(c){this._bounds(da);var g=pa.toTypedArray();return c?(c.set(g),c):g.slice()};a.Sd&&a.Sd.forEach(function(c){c()})};a.computeTonalColors=function(e){var c=v(e.ambient,"HEAPF32"),g=v(e.spot,"HEAPF32");this._computeTonalColors(c,g);var m={ambient:Y(c),
spot:Y(g)};x(c,e.ambient);x(g,e.spot);return m};a.LTRBRect=function(e,c,g,m){return Float32Array.of(e,c,g,m)};a.XYWHRect=function(e,c,g,m){return Float32Array.of(e,c,e+g,c+m)};a.LTRBiRect=function(e,c,g,m){return Int32Array.of(e,c,g,m)};a.XYWHiRect=function(e,c,g,m){return Int32Array.of(e,c,e+g,c+m)};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 lb=null;a.MakeImageFromCanvasImageSource=function(e){var c=e.width,g=e.height;lb||(lb=document.createElement("canvas"));lb.width=c;lb.height=g;var m=lb.getContext("2d");m.drawImage(e,0,0);e=m.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 m=a._malloc(c.length);a.HEAPU8.set(c,m);return a._MakeImage(e,m,c.length,g)};a.MakeVertices=function(e,c,g,m,q,y){var C=q&&q.length||0,J=0;g&&g.length&&(J|=1);m&&m.length&&(J|=2);void 0===y||y||(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(l(m),"HEAPU32",e.colors());e.indices()&&v(q,"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 m=c[g],q=c[g+1],y=e[6]*m+e[7]*q+e[8],
C=e[3]*m+e[4]*q+e[5];c[g]=(e[0]*m+e[1]*q+e[2])/y;c[g+1]=C/y}return c};a.Matrix.multiply=function(){return kb(3,arguments)};a.Matrix.rotated=function(e,c,g){c=c||0;g=g||0;var m=Math.sin(e);e=Math.cos(e);return[e,-m,wa(m,g,1-e,c),m,e,wa(-m,c,1-e,g),0,0,1]};a.Matrix.scaled=function(e,c,g,m){g=g||0;m=m||0;var q=b([e,c],d(3),3,0,1);return b([g-e*g,m-c*m],q,3,2,0)};a.Matrix.skewed=function(e,c,g,m){g=g||0;m=m||0;var q=b([e,c],d(3),3,1,-1);return b([-e*g,-c*m],q,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,m){return g*c[m]}).reduce(function(g,m){return g+m})};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,m){return g+c[m]})};a.Vector.sub=function(e,c){return e.map(function(g,m){return g-c[m]})};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 m=e[0],q=e[1];e=e[2];var y=1-g;return[y*m*m+g,y*m*q-c*e,y*m*e+c*q,0,y*m*q+c*e,y*q*q+g,y*q*e-c*m,0,y*m*e-c*q,y*q*e+c*m,y*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 m=a.M44.identity();b(g,m,4,0,0);b(a.Vector.cross(g,c),m,4,1,0);b(a.Vector.mulScalar(c,-1),m,4,2,0);b(e,m,4,3,0);e=a.M44.invert(m);return null===e?a.M44.identity():e};a.M44.perspective=function(e,c,g){var m=
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)*m,2*c*e*m,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],m=e[8],q=e[12],y=e[1],C=e[5],J=e[9],L=e[13],N=e[2],U=e[6],u=e[10],F=e[14],R=e[3],aa=e[7],ka=e[11];e=e[15];var ra=c*C-g*y,xa=c*J-m*y,Ba=c*L-q*y,fa=g*J-m*C,H=g*L-q*C,k=m*L-q*J,p=N*aa-U*R,z=N*ka-u*R,B=N*e-F*R,D=U*ka-u*aa,E=U*e-F*aa,M=u*e-F*ka,ba=ra*M-xa*E+Ba*D+fa*B-H*z+k*p,ca=
1/ba;if(0===ba||Infinity===ca)return null;ra*=ca;xa*=ca;Ba*=ca;fa*=ca;H*=ca;k*=ca;p*=ca;z*=ca;B*=ca;D*=ca;E*=ca;M*=ca;c=[C*M-J*E+L*D,J*B-y*M-L*z,y*E-C*B+L*p,C*z-y*D-J*p,m*E-g*M-q*D,c*M-m*B+q*z,g*B-c*E-q*p,c*D-g*z+m*p,aa*k-ka*H+e*fa,ka*Ba-R*k-e*xa,R*H-aa*Ba+e*ra,aa*xa-R*fa-ka*ra,u*H-U*k-F*fa,N*k-u*Ba+F*xa,U*Ba-N*H-F*ra,N*fa-U*xa+u*ra];return c.every(function(Ia){return!isNaN(Ia)&&Infinity!==Ia&&-Infinity!==Ia})?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 m=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,m,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,m){var q=new Float32Array(20);q[0]=e;q[6]=c;q[12]=g;q[18]=m;return q};var Gd=[[6,7,11,12],[0,10,2,12],[0,1,5,6]];a.ColorMatrix.rotated=function(e,c,g){var m=a.ColorMatrix.identity();e=Gd[e];m[e[0]]=g;m[e[1]]=c;m[e[2]]=-c;m[e[3]]=g;return m};a.ColorMatrix.postTranslate=function(e,c,g,m,q){e[4]+=c;e[9]+=g;e[14]+=m;e[19]+=q;return e};a.ColorMatrix.concat=function(e,c){for(var g=new Float32Array(20),m=0,q=0;20>q;q+=5){for(var y=0;4>
y;y++)g[m++]=e[q]*c[y]+e[q+1]*c[y+5]+e[q+2]*c[y+10]+e[q+3]*c[y+15];g[m++]=e[q]*c[4]+e[q+1]*c[9]+e[q+2]*c[14]+e[q+3]*c[19]+e[q+4]}return g};(function(e){e.Sd=e.Sd||[];e.Sd.push(function(){function c(u){if(!u||!u.length)return[];for(var F=[],R=0;R<u.length;R+=5){var aa=e.LTRBRect(u[R],u[R+1],u[R+2],u[R+3]);aa.direction=0===u[R+4]?e.TextDirection.RTL:e.TextDirection.LTR;F.push(aa)}e._free(u.byteOffset);return F}function g(u){u=u||{};void 0===u.weight&&(u.weight=e.FontWeight.Normal);u.width=u.width||
e.FontWidth.Normal;u.slant=u.slant||e.FontSlant.Upright;return u}function m(u){if(!u||!u.length)return S;for(var F=[],R=0;R<u.length;R++){var aa=q(u[R]);F.push(aa)}return v(F,"HEAPU32")}function q(u){if(J[u])return J[u];var F=na(u)+1,R=e._malloc(F);qa(u,I,R,F);return J[u]=R}function y(u){u._colorPtr=A(u.color);u._foregroundColorPtr=S;u._backgroundColorPtr=S;u._decorationColorPtr=S;u.foregroundColor&&(u._foregroundColorPtr=A(u.foregroundColor,L));u.backgroundColor&&(u._backgroundColorPtr=A(u.backgroundColor,
N));u.decorationColor&&(u._decorationColorPtr=A(u.decorationColor,U));Array.isArray(u.fontFamilies)&&u.fontFamilies.length?(u._fontFamiliesPtr=m(u.fontFamilies),u._fontFamiliesLen=u.fontFamilies.length):(u._fontFamiliesPtr=S,u._fontFamiliesLen=0);if(u.locale){var F=u.locale;u._localePtr=q(F);u._localeLen=na(F)+1}else u._localePtr=S,u._localeLen=0;if(Array.isArray(u.shadows)&&u.shadows.length){F=u.shadows;var R=F.map(function(fa){return fa.color||e.BLACK}),aa=F.map(function(fa){return fa.blurRadius||
0});u._shadowLen=F.length;for(var ka=e._malloc(8*F.length),ra=ka/4,xa=0;xa<F.length;xa++){var Ba=F[xa].offset||[0,0];e.HEAPF32[ra]=Ba[0];e.HEAPF32[ra+1]=Ba[1];ra+=2}u._shadowColorsPtr=G(R).ce;u._shadowOffsetsPtr=ka;u._shadowBlurRadiiPtr=v(aa,"HEAPF32")}else u._shadowLen=0,u._shadowColorsPtr=S,u._shadowOffsetsPtr=S,u._shadowBlurRadiiPtr=S;Array.isArray(u.fontFeatures)&&u.fontFeatures.length?(F=u.fontFeatures,R=F.map(function(fa){return fa.name}),aa=F.map(function(fa){return fa.value}),u._fontFeatureLen=
F.length,u._fontFeatureNamesPtr=m(R),u._fontFeatureValuesPtr=v(aa,"HEAPU32")):(u._fontFeatureLen=0,u._fontFeatureNamesPtr=S,u._fontFeatureValuesPtr=S)}function C(u){e._free(u._fontFamiliesPtr);e._free(u._shadowColorsPtr);e._free(u._shadowOffsetsPtr);e._free(u._shadowBlurRadiiPtr);e._free(u._fontFeatureNamesPtr);e._free(u._fontFeatureValuesPtr)}e.Paragraph.prototype.getRectsForRange=function(u,F,R,aa){u=this._getRectsForRange(u,F,R,aa);return c(u)};e.Paragraph.prototype.getRectsForPlaceholders=function(){var u=
this._getRectsForPlaceholders();return c(u)};e.TypefaceFontProvider.prototype.registerFont=function(u,F){u=e.Typeface.MakeFreeTypeFaceFromData(u);if(!u)return null;F=q(F);this._registerFont(u,F)};e.ParagraphStyle=function(u){u.disableHinting=u.disableHinting||!1;if(u.ellipsis){var F=u.ellipsis;u._ellipsisPtr=q(F);u._ellipsisLen=na(F)+1}else u._ellipsisPtr=S,u._ellipsisLen=0;u.heightMultiplier=u.heightMultiplier||0;u.maxLines=u.maxLines||0;F=(F=u.strutStyle)||{};F.strutEnabled=F.strutEnabled||!1;F.strutEnabled&&
Array.isArray(F.fontFamilies)&&F.fontFamilies.length?(F._fontFamiliesPtr=m(F.fontFamilies),F._fontFamiliesLen=F.fontFamilies.length):(F._fontFamiliesPtr=S,F._fontFamiliesLen=0);F.fontStyle=g(F.fontStyle);F.fontSize=F.fontSize||0;F.heightMultiplier=F.heightMultiplier||0;F.halfLeading=F.halfLeading||!1;F.leading=F.leading||0;F.forceStrutHeight=F.forceStrutHeight||!1;u.strutStyle=F;u.textAlign=u.textAlign||e.TextAlign.Start;u.textDirection=u.textDirection||e.TextDirection.LTR;u.textHeightBehavior=u.textHeightBehavior||
e.TextHeightBehavior.All;u.textStyle=e.TextStyle(u.textStyle);return u};e.TextStyle=function(u){u.color||(u.color=e.BLACK);u.decoration=u.decoration||0;u.decorationThickness=u.decorationThickness||0;u.decorationStyle=u.decorationStyle||e.DecorationStyle.Solid;u.textBaseline=u.textBaseline||e.TextBaseline.Alphabetic;u.fontSize=u.fontSize||0;u.letterSpacing=u.letterSpacing||0;u.wordSpacing=u.wordSpacing||0;u.heightMultiplier=u.heightMultiplier||0;u.halfLeading=u.halfLeading||!1;u.fontStyle=g(u.fontStyle);
return u};var J={},L=e._malloc(16),N=e._malloc(16),U=e._malloc(16);e.ParagraphBuilder.Make=function(u,F){y(u.textStyle);F=e.ParagraphBuilder._Make(u,F);C(u.textStyle);return F};e.ParagraphBuilder.MakeFromFontProvider=function(u,F){y(u.textStyle);F=e.ParagraphBuilder._MakeFromFontProvider(u,F);C(u.textStyle);return F};e.ParagraphBuilder.ShapeText=function(u,F,R){let aa=0;for(const ka of F)aa+=ka.length;if(aa!==u.length)throw"Accumulated block lengths must equal text.length";return e.ParagraphBuilder._ShapeText(u,
F,R)};e.ParagraphBuilder.prototype.pushStyle=function(u){y(u);this._pushStyle(u);C(u)};e.ParagraphBuilder.prototype.pushPaintStyle=function(u,F,R){y(u);this._pushPaintStyle(u,F,R);C(u)};e.ParagraphBuilder.prototype.addPlaceholder=function(u,F,R,aa,ka){R=R||e.PlaceholderAlignment.Baseline;aa=aa||e.TextBaseline.Alphabetic;this._addPlaceholder(u||0,F||0,R,aa,ka||0)}})})(t);a.MakeManagedAnimation=function(e,c,g,m,q){if(!a._MakeManagedAnimation)throw"Not compiled with MakeManagedAnimation";g||(g="");if(!c)return a._MakeManagedAnimation(e,
0,S,S,S,g,m,q);for(var y=[],C=[],J=[],L=Object.keys(c||{}),N=0;N<L.length;N++){var U=L[N],u=new Uint8Array(c[U]),F=a._malloc(u.byteLength);a.HEAPU8.set(u,F);C.push(F);J.push(u.byteLength);u=na(U)+1;F=a._malloc(u);qa(U,I,F,u);y.push(F)}c=v(y,"HEAPU32");C=v(C,"HEAPU32");J=v(J,"HEAPU32");e=a._MakeManagedAnimation(e,L.length,c,C,J,g,m,q);a._free(c);a._free(C);a._free(J);return e};(function(e){e.Sd=e.Sd||[];e.Sd.push(function(){e.Animation.prototype.render=function(c,g){T(g,da);this._render(c,da)};e.Animation.prototype.size=
function(c){this._size(da);var g=pa.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){T(g,da);this._render(c,da)},e.ManagedAnimation.prototype.seek=function(c,g){this._seek(c,da);c=pa.toTypedArray();return g?(g.set(c),g):c.slice()},e.ManagedAnimation.prototype.seekFrame=function(c,g){this._seekFrame(c,da);c=pa.toTypedArray();return g?(g.set(c),g):c.slice()},e.ManagedAnimation.prototype.setColor=function(c,g){g=A(g);
return this._setColor(c,g)},e.ManagedAnimation.prototype.size=function(c){this._size(da);var g=pa.toTypedArray();return c?(c[0]=g[0],c[1]=g[1],c):g.slice(0,2)})})})(t);a.MakeParticles=function(e,c){if(!a._MakeParticles)throw"Not compiled with MakeParticles";if(!c)return a._MakeParticles(e,0,S,S,S);for(var g=[],m=[],q=[],y=Object.keys(c||{}),C=0;C<y.length;C++){var J=y[C],L=new Uint8Array(c[J]),N=a._malloc(L.byteLength);a.HEAPU8.set(L,N);m.push(N);q.push(L.byteLength);L=na(J)+1;N=a._malloc(L);qa(J,
I,N,L);g.push(N)}c=v(g,"HEAPU32");m=v(m,"HEAPU32");q=v(q,"HEAPU32");e=a._MakeParticles(e,y.length,c,m,q);a._free(c);a._free(m);a._free(q);return e};a.Sd=a.Sd||[];a.Sd.push(function(){a.ParticleEffect.prototype.uniforms=function(){var e=this._uniformPtr(),c=this.getUniformFloatCount();return!e||0>=c?new Float32Array:new Float32Array(a.HEAPU8.buffer,e,c)};a.ParticleEffect.prototype.setPosition=function(e){this._setPosition(e[0],e[1])}});a.Sd=a.Sd||[];a.Sd.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.Sd=a.Sd||[];a.Sd.push(function(){a.Canvas.prototype.drawText=function(e,c,g,m,q){var y=na(e),C=a._malloc(y+1);qa(e,I,C,y+1);this._drawSimpleText(C,y,c,g,q,m);a._free(C)};a.Font.prototype.getGlyphBounds=function(e,c,g){var m=v(e,"HEAPU16"),q=a._malloc(16*e.length);this._getGlyphWidthBounds(m,e.length,S,q,c||null);c=new Float32Array(a.HEAPU8.buffer,q,4*e.length);x(m,e);if(g)return g.set(c),
a._free(q),g;e=Float32Array.from(c);a._free(q);return e};a.Font.prototype.getGlyphIDs=function(e,c,g){c||(c=e.length);var m=na(e)+1,q=a._malloc(m);qa(e,I,q,m);e=a._malloc(2*c);c=this._getGlyphIDs(q,m-1,c,e);a._free(q);if(0>c)return a._free(e),null;q=new Uint16Array(a.HEAPU8.buffer,e,c);if(g)return g.set(q),a._free(e),g;g=Uint16Array.from(q);a._free(e);return g};a.Font.prototype.getGlyphIntercepts=function(e,c,g,m){var q=v(e,"HEAPU16"),y=v(c,"HEAPF32");return this._getGlyphIntercepts(q,e.length,!(e&&
e._ck),y,c.length,!(c&&c._ck),g,m)};a.Font.prototype.getGlyphWidths=function(e,c,g){var m=v(e,"HEAPU16"),q=a._malloc(4*e.length);this._getGlyphWidthBounds(m,e.length,q,S,c||null);c=new Float32Array(a.HEAPU8.buffer,q,e.length);x(m,e);if(g)return g.set(c),a._free(q),g;e=Float32Array.from(c);a._free(q);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=[],m=0;m<e.length;m++){var q=
new Uint8Array(e[m]),y=v(q,"HEAPU8");c.push(y);g.push(q.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.MakeFreeTypeFaceFromData=function(e){e=new Uint8Array(e);var c=v(e,"HEAPU8");return(e=a.Typeface._MakeFreeTypeFaceFromData(c,e.byteLength))?e:null};a.Typeface.prototype.getGlyphIDs=function(e,c,g){c||(c=e.length);var m=na(e)+1,q=a._malloc(m);qa(e,I,q,m);e=a._malloc(2*c);c=this._getGlyphIDs(q,m-1,c,e);a._free(q);if(0>c)return a._free(e),
null;q=new Uint16Array(a.HEAPU8.buffer,e,c);if(g)return g.set(q),a._free(e),g;g=Uint16Array.from(q);a._free(e);return g};a.TextBlob.MakeOnPath=function(e,c,g,m){if(e&&e.length&&c&&c.countPoints()){if(1===c.countPoints())return this.MakeFromText(e,g);m||(m=0);var q=g.getGlyphIDs(e);q=g.getGlyphWidths(q);var y=[];c=new a.ContourMeasureIter(c,!1,1);for(var C=c.next(),J=new Float32Array(4),L=0;L<e.length&&C;L++){var N=q[L];m+=N/2;if(m>C.length()){C.delete();C=c.next();if(!C){e=e.substring(0,L);break}m=
N/2}C.getPosTan(m,J);var U=J[2],u=J[3];y.push(U,u,J[0]-N/2*U,J[1]-N/2*u);m+=N/2}e=this.MakeFromRSXform(e,y,g);C&&C.delete();c.delete();return e}};a.TextBlob.MakeFromRSXform=function(e,c,g){var m=na(e)+1,q=a._malloc(m);qa(e,I,q,m);e=v(c,"HEAPF32");g=a.TextBlob._MakeFromRSXform(q,m-1,e,g);a._free(q);return g?g:null};a.TextBlob.MakeFromRSXformGlyphs=function(e,c,g){var m=v(e,"HEAPU16");c=v(c,"HEAPF32");g=a.TextBlob._MakeFromRSXformGlyphs(m,2*e.length,c,g);x(m,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);x(g,e);return c?c:null};a.TextBlob.MakeFromText=function(e,c){var g=na(e)+1,m=a._malloc(g);qa(e,I,m,g);e=a.TextBlob._MakeFromText(m,g-1,c);a._free(m);return e?e:null};a.MallocGlyphIDs=function(e){return a.Malloc(Uint16Array,e)}});a.Sd=a.Sd||[];a.Sd.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.Sd=a.Sd||
[];a.Sd.push(function(){a.RuntimeEffect.Make=function(e,c){return a.RuntimeEffect._Make(e,{onError:c||function(g){console.log("RuntimeEffect error",g)}})};a.RuntimeEffect.prototype.makeShader=function(e,c,g){var m=v(e,"HEAPF32");g=K(g);return this._makeShader(m,4*e.length,!!c,g)};a.RuntimeEffect.prototype.makeShaderWithChildren=function(e,c,g,m){var q=v(e,"HEAPF32");m=K(m);for(var y=[],C=0;C<g.length;C++)y.push(g[C].Ld.Rd);g=v(y,"HEAPU32");return this._makeShaderWithChildren(q,4*e.length,!!c,g,y.length,
m)}});(function(){function e(H){for(var k=0;k<H.length;k++)if(void 0!==H[k]&&!Number.isFinite(H[k]))return!1;return!0}function c(H){var k=a.getColorComponents(H);H=k[0];var p=k[1],z=k[2];k=k[3];if(1===k)return H=H.toString(16).toLowerCase(),p=p.toString(16).toLowerCase(),z=z.toString(16).toLowerCase(),H=1===H.length?"0"+H:H,p=1===p.length?"0"+p:p,z=1===z.length?"0"+z:z,"#"+H+p+z;k=0===k||1===k?k:k.toFixed(8);return"rgba("+H+", "+p+", "+z+", "+k+")"}function g(H){return a.parseColorString(H,xa)}function m(H){H=
Ba.exec(H);if(!H)return null;var k=parseFloat(H[4]),p=16;switch(H[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:H[1],variant:H[2],weight:H[3],sizePx:p,family:H[6].trim()}}function q(H){this.Nd=H;this.Qd=new a.Paint;this.Qd.setAntiAlias(!0);this.Qd.setStrokeMiter(10);this.Qd.setStrokeCap(a.StrokeCap.Butt);
this.Qd.setStrokeJoin(a.StrokeJoin.Miter);this.Pe="10px monospace";this.ne=new a.Font(null,10);this.ne.setSubpixel(!0);this.be=this.he=a.BLACK;this.ue=0;this.Ie=a.TRANSPARENT;this.we=this.ve=0;this.Je=this.je=1;this.He=0;this.te=[];this.Pd=a.BlendMode.SrcOver;this.Qd.setStrokeWidth(this.Je);this.Qd.setBlendMode(this.Pd);this.Ud=new a.Path;this.Vd=a.Matrix.identity();this.kf=[];this.Ae=[];this.me=function(){this.Ud.delete();this.Qd.delete();this.ne.delete();this.Ae.forEach(function(k){k.me()})};Object.defineProperty(this,
"currentTransform",{enumerable:!0,get:function(){return{a:this.Vd[0],c:this.Vd[1],e:this.Vd[2],b:this.Vd[3],d:this.Vd[4],f:this.Vd[5]}},set:function(k){k.a&&this.setTransform(k.a,k.b,k.c,k.d,k.e,k.f)}});Object.defineProperty(this,"fillStyle",{enumerable:!0,get:function(){return f(this.be)?c(this.be):this.be},set:function(k){"string"===typeof k?this.be=g(k):k.se&&(this.be=k)}});Object.defineProperty(this,"font",{enumerable:!0,get:function(){return this.Pe},set:function(k){var p=m(k),z=p.family;p.typeface=
fa[z]?fa[z][(p.style||"normal")+"|"+(p.variant||"normal")+"|"+(p.weight||"normal")]||fa[z]["*"]:null;p&&(this.ne.setSize(p.sizePx),this.ne.setTypeface(p.typeface),this.Pe=k)}});Object.defineProperty(this,"globalAlpha",{enumerable:!0,get:function(){return this.je},set:function(k){!isFinite(k)||0>k||1<k||(this.je=k)}});Object.defineProperty(this,"globalCompositeOperation",{enumerable:!0,get:function(){switch(this.Pd){case a.BlendMode.SrcOver:return"source-over";case a.BlendMode.DstOver:return"destination-over";
case a.BlendMode.Src:return"copy";case a.BlendMode.Dst:return"destination";case a.BlendMode.Clear:return"clear";case a.BlendMode.SrcIn:return"source-in";case a.BlendMode.DstIn:return"destination-in";case a.BlendMode.SrcOut:return"source-out";case a.BlendMode.DstOut:return"destination-out";case a.BlendMode.SrcATop:return"source-atop";case a.BlendMode.DstATop:return"destination-atop";case a.BlendMode.Xor:return"xor";case a.BlendMode.Plus:return"lighter";case a.BlendMode.Multiply:return"multiply";case a.BlendMode.Screen:return"screen";
case a.BlendMode.Overlay:return"overlay";case a.BlendMode.Darken:return"darken";case a.BlendMode.Lighten:return"lighten";case a.BlendMode.ColorDodge:return"color-dodge";case a.BlendMode.ColorBurn:return"color-burn";case a.BlendMode.HardLight:return"hard-light";case a.BlendMode.SoftLight:return"soft-light";case a.BlendMode.Difference:return"difference";case a.BlendMode.Exclusion:return"exclusion";case a.BlendMode.Hue:return"hue";case a.BlendMode.Saturation:return"saturation";case a.BlendMode.Color:return"color";
case a.BlendMode.Luminosity:return"luminosity"}},set:function(k){switch(k){case "source-over":this.Pd=a.BlendMode.SrcOver;break;case "destination-over":this.Pd=a.BlendMode.DstOver;break;case "copy":this.Pd=a.BlendMode.Src;break;case "destination":this.Pd=a.BlendMode.Dst;break;case "clear":this.Pd=a.BlendMode.Clear;break;case "source-in":this.Pd=a.BlendMode.SrcIn;break;case "destination-in":this.Pd=a.BlendMode.DstIn;break;case "source-out":this.Pd=a.BlendMode.SrcOut;break;case "destination-out":this.Pd=
a.BlendMode.DstOut;break;case "source-atop":this.Pd=a.BlendMode.SrcATop;break;case "destination-atop":this.Pd=a.BlendMode.DstATop;break;case "xor":this.Pd=a.BlendMode.Xor;break;case "lighter":this.Pd=a.BlendMode.Plus;break;case "plus-lighter":this.Pd=a.BlendMode.Plus;break;case "plus-darker":throw"plus-darker is not supported";case "multiply":this.Pd=a.BlendMode.Multiply;break;case "screen":this.Pd=a.BlendMode.Screen;break;case "overlay":this.Pd=a.BlendMode.Overlay;break;case "darken":this.Pd=a.BlendMode.Darken;
break;case "lighten":this.Pd=a.BlendMode.Lighten;break;case "color-dodge":this.Pd=a.BlendMode.ColorDodge;break;case "color-burn":this.Pd=a.BlendMode.ColorBurn;break;case "hard-light":this.Pd=a.BlendMode.HardLight;break;case "soft-light":this.Pd=a.BlendMode.SoftLight;break;case "difference":this.Pd=a.BlendMode.Difference;break;case "exclusion":this.Pd=a.BlendMode.Exclusion;break;case "hue":this.Pd=a.BlendMode.Hue;break;case "saturation":this.Pd=a.BlendMode.Saturation;break;case "color":this.Pd=a.BlendMode.Color;
break;case "luminosity":this.Pd=a.BlendMode.Luminosity;break;default:return}this.Qd.setBlendMode(this.Pd)}});Object.defineProperty(this,"imageSmoothingEnabled",{enumerable:!0,get:function(){return!0},set:function(){}});Object.defineProperty(this,"imageSmoothingQuality",{enumerable:!0,get:function(){return"high"},set:function(){}});Object.defineProperty(this,"lineCap",{enumerable:!0,get:function(){switch(this.Qd.getStrokeCap()){case a.StrokeCap.Butt:return"butt";case a.StrokeCap.Round:return"round";
case a.StrokeCap.Square:return"square"}},set:function(k){switch(k){case "butt":this.Qd.setStrokeCap(a.StrokeCap.Butt);break;case "round":this.Qd.setStrokeCap(a.StrokeCap.Round);break;case "square":this.Qd.setStrokeCap(a.StrokeCap.Square)}}});Object.defineProperty(this,"lineDashOffset",{enumerable:!0,get:function(){return this.He},set:function(k){isFinite(k)&&(this.He=k)}});Object.defineProperty(this,"lineJoin",{enumerable:!0,get:function(){switch(this.Qd.getStrokeJoin()){case a.StrokeJoin.Miter:return"miter";
case a.StrokeJoin.Round:return"round";case a.StrokeJoin.Bevel:return"bevel"}},set:function(k){switch(k){case "miter":this.Qd.setStrokeJoin(a.StrokeJoin.Miter);break;case "round":this.Qd.setStrokeJoin(a.StrokeJoin.Round);break;case "bevel":this.Qd.setStrokeJoin(a.StrokeJoin.Bevel)}}});Object.defineProperty(this,"lineWidth",{enumerable:!0,get:function(){return this.Qd.getStrokeWidth()},set:function(k){0>=k||!k||(this.Je=k,this.Qd.setStrokeWidth(k))}});Object.defineProperty(this,"miterLimit",{enumerable:!0,
get:function(){return this.Qd.getStrokeMiter()},set:function(k){0>=k||!k||this.Qd.setStrokeMiter(k)}});Object.defineProperty(this,"shadowBlur",{enumerable:!0,get:function(){return this.ue},set:function(k){0>k||!isFinite(k)||(this.ue=k)}});Object.defineProperty(this,"shadowColor",{enumerable:!0,get:function(){return c(this.Ie)},set:function(k){this.Ie=g(k)}});Object.defineProperty(this,"shadowOffsetX",{enumerable:!0,get:function(){return this.ve},set:function(k){isFinite(k)&&(this.ve=k)}});Object.defineProperty(this,
"shadowOffsetY",{enumerable:!0,get:function(){return this.we},set:function(k){isFinite(k)&&(this.we=k)}});Object.defineProperty(this,"strokeStyle",{enumerable:!0,get:function(){return c(this.he)},set:function(k){"string"===typeof k?this.he=g(k):k.se&&(this.he=k)}});this.arc=function(k,p,z,B,D,E){F(this.Ud,k,p,z,z,0,B,D,E)};this.arcTo=function(k,p,z,B,D){N(this.Ud,k,p,z,B,D)};this.beginPath=function(){this.Ud.delete();this.Ud=new a.Path};this.bezierCurveTo=function(k,p,z,B,D,E){var M=this.Ud;e([k,
p,z,B,D,E])&&(M.isEmpty()&&M.moveTo(k,p),M.cubicTo(k,p,z,B,D,E))};this.clearRect=function(k,p,z,B){this.Qd.setStyle(a.PaintStyle.Fill);this.Qd.setBlendMode(a.BlendMode.Clear);this.Nd.drawRect(a.XYWHRect(k,p,z,B),th