canvaskit-wasm
Version:
A WASM version of Skia's Canvas API
109 lines (106 loc) • 127 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 da,fa;t.ready=new Promise(function(a,b){da=a;fa=b});
(function(a){a.Vd=a.Vd||[];a.Vd.push(function(){a.MakeSWCanvasSurface=function(b){var c=b;if("CANVAS"!==c.tagName&&(c=document.getElementById(b),!c))throw"Canvas with id "+b+" was not found";if(b=a.MakeSurface(c.width,c.height))b.Nd=c;return b};a.MakeCanvasSurface||(a.MakeCanvasSurface=a.MakeSWCanvasSurface);a.MakeSurface=function(b,c){var f={width:b,height:c,colorType:a.ColorType.RGBA_8888,alphaType:a.AlphaType.Unpremul,colorSpace:a.ColorSpace.SRGB},h=b*c*4,l=a._malloc(h);if(f=a.Surface._makeRasterDirect(f,
l,4*b))f.Nd=null,f.Af=b,f.xf=c,f.zf=h,f.af=l,f.getCanvas().clear(a.TRANSPARENT);return f};a.MakeRasterDirectSurface=function(b,c,f){return a.Surface._makeRasterDirect(b,c.byteOffset,f)};a.Surface.prototype.flush=function(b){a.Od(this.Md);this._flush();if(this.Nd){var c=new Uint8ClampedArray(a.HEAPU8.buffer,this.af,this.zf);c=new ImageData(c,this.Af,this.xf);b?this.Nd.getContext("2d").putImageData(c,0,0,b[0],b[1],b[2]-b[0],b[3]-b[1]):this.Nd.getContext("2d").putImageData(c,0,0)}};a.Surface.prototype.dispose=
function(){this.af&&a._free(this.af);this.delete()};a.Od=a.Od||function(){}})})(t);
(function(a){a.Vd=a.Vd||[];a.Vd.push(function(){function b(l,n,q){return l&&l.hasOwnProperty(n)?l[n]:q}function c(l){var n=ha.length;n||(ha.push(null),n=1);ha.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 q={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)};q.majorVersion=n&&n.majorVersion?n.majorVersion:"undefined"!==typeof WebGL2RenderingContext?
2:1;if(q.explicitSwapControl)throw"explicitSwapControl is not supported";l=ia(l,q);if(!l)return 0;la(l);return l};a.deleteContext=function(l){v===ma[l]&&(v=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 q=ha[n];q&&ma[l].le.deleteTexture(q);ha[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,q,x){n=this._MakeOnScreenGLSurface(l,n,q,x);if(!n)return null;n.Md=l.Md;return n};a.MakeRenderTarget=function(l,n,q){n=this._MakeRenderTargetWH(l,n,q);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,q){n=n||null;var x=l,w="undefined"!==typeof OffscreenCanvas&&x instanceof OffscreenCanvas;if(!("undefined"!==typeof HTMLCanvasElement&&
x instanceof HTMLCanvasElement||w||(x=document.getElementById(l),x)))throw"Canvas with id "+l+" was not found";l=this.GetWebGLContext(x,q);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=c(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 q=v.le,x=q.createTexture();q.bindTexture(q.TEXTURE_2D,x);2===v.version?q.texImage2D(q.TEXTURE_2D,0,q.RGBA,n.width,n.height,0,q.RGBA,q.UNSIGNED_BYTE,l):q.texImage2D(q.TEXTURE_2D,0,q.RGBA,q.RGBA,q.UNSIGNED_BYTE,l);q.bindTexture(q.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 q={makeTexture:function(){var x=v,w=x.le,F=w.createTexture();w.bindTexture(w.TEXTURE_2D,F);2===x.version?w.texImage2D(w.TEXTURE_2D,0,w.RGBA,n.width,n.height,0,w.RGBA,w.UNSIGNED_BYTE,l):w.texImage2D(w.TEXTURE_2D,0,w.RGBA,w.RGBA,w.UNSIGNED_BYTE,l);w.bindTexture(w.TEXTURE_2D,
null);return c(F)},freeSrc:function(){}};"VideoFrame"===l.constructor.name&&(q.freeSrc=function(){l.close()});return a.Image._makeFromGenerator(n,q)};a.Od=function(l){return l?la(l):!1}})})(t);
(function(a){function b(e,d,g,m,r){for(var y=0;y<e.length;y++)d[y*g+(y*r+m+g)%g]=e[y];return d}function c(e){for(var d=e*e,g=Array(d);d--;)g[d]=0===d%(e+1)?1:0;return g}function f(e){return e?e.constructor===Float32Array&&4===e.length:!1}function h(e){return(q(255*e[3])<<24|q(255*e[0])<<16|q(255*e[1])<<8|q(255*e[2])<<0)>>>0}function l(e){if(e&&e._ck)return e;if(e instanceof Float32Array){for(var d=Math.floor(e.length/4),g=new Uint32Array(d),m=0;m<d;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 d=parseFloat(e);return e&&-1!==e.indexOf("%")?d/100:d}function q(e){return Math.round(Math.max(0,Math.min(e||0,255)))}function x(e,d){d&&d._ck||a._free(e)}function w(e,d,g){if(!e||!e.length)return U;if(e&&e._ck)return e.byteOffset;var m=a[d].BYTES_PER_ELEMENT;g||(g=a._malloc(e.length*m));a[d].set(e,g/m);return g}function F(e){var d={ce:U,count:e.length,Ke:a.ColorType.RGBA_F32};
if(e instanceof Float32Array)d.ce=w(e,"HEAPF32"),d.count=e.length/4;else if(e instanceof Uint32Array)d.ce=w(e,"HEAPU32"),d.Ke=a.ColorType.RGBA_8888;else if(e instanceof Array){if(e&&e.length){for(var g=a._malloc(16*e.length),m=0,r=g/4,y=0;y<e.length;y++)for(var D=0;4>D;D++)a.HEAPF32[r+m]=e[y][D],m++;e=g}else e=U;d.ce=e}else throw"Invalid argument to copyFlexibleColorArray, Not a color array "+typeof e;return d}function K(e){if(!e)return U;if(e.length){if(6===e.length||9===e.length)return w(e,"HEAPF32",
Na),6===e.length&&a.HEAPF32.set(Fd,6+Na/4),Na;if(16===e.length){var d=Cb.toTypedArray();d[0]=e[0];d[1]=e[1];d[2]=e[3];d[3]=e[4];d[4]=e[5];d[5]=e[7];d[6]=e[12];d[7]=e[13];d[8]=e[15];return Na}throw"invalid matrix size";}d=Cb.toTypedArray();d[0]=e.m11;d[1]=e.m21;d[2]=e.m41;d[3]=e.m12;d[4]=e.m22;d[5]=e.m42;d[6]=e.m14;d[7]=e.m24;d[8]=e.m44;return Na}function O(e){if(!e)return U;var d=fc.toTypedArray();if(e.length){if(16!==e.length&&6!==e.length&&9!==e.length)throw"invalid matrix size";if(16===e.length)return w(e,
"HEAPF32",ab);d.fill(0);d[0]=e[0];d[1]=e[1];d[3]=e[2];d[4]=e[3];d[5]=e[4];d[7]=e[5];d[12]=e[6];d[13]=e[7];d[15]=e[8];6===e.length&&(d[12]=0,d[13]=0,d[15]=1);return ab}d[0]=e.m11;d[1]=e.m21;d[2]=e.m31;d[3]=e.m41;d[4]=e.m12;d[5]=e.m22;d[6]=e.m32;d[7]=e.m42;d[8]=e.m13;d[9]=e.m23;d[10]=e.m33;d[11]=e.m43;d[12]=e.m14;d[13]=e.m24;d[14]=e.m34;d[15]=e.m44;return ab}function A(e,d){return w(e,"HEAPF32",d||ib)}function N(e,d,g,m){var r=hc.toTypedArray();r[0]=e;r[1]=d;r[2]=g;r[3]=m;return ib}function Y(e){for(var d=
new Float32Array(4),g=0;4>g;g++)d[g]=a.HEAPF32[e/4+g];return d}function S(e,d){return w(e,"HEAPF32",d||ja)}function oa(e,d){return w(e,"HEAPF32",d||ic)}function ta(){for(var e=0,d=0;d<arguments.length-1;d+=2)e+=arguments[d]*arguments[d+1];return e}function jb(e,d,g){for(var m=Array(e.length),r=0;r<g;r++)for(var y=0;y<g;y++){for(var D=0,J=0;J<g;J++)D+=e[g*r+J]*d[g*J+y];m[r*g+y]=D}return m}function kb(e,d){for(var g=jb(d[0],d[1],e),m=2;m<d.length;)g=jb(g,d[m],e),m++;return g}a.Color=function(e,d,g,
m){void 0===m&&(m=1);return a.Color4f(q(e)/255,q(d)/255,q(g)/255,m)};a.ColorAsInt=function(e,d,g,m){void 0===m&&(m=255);return(q(m)<<24|q(e)<<16|q(d)<<8|q(g)<<0&268435455)>>>0};a.Color4f=function(e,d,g,m){void 0===m&&(m=1);return Float32Array.of(e,d,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,d){e=e.toLowerCase();if(e.startsWith("#")){d=255;switch(e.length){case 9:d=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 r=parseInt(e.slice(5,7),16);break;case 5:d=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),r=17*parseInt(e.slice(3,4),16)}return a.Color(g,m,r,d/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")||!d||(e=d[e],void 0===e)?a.BLACK:e};a.multiplyByAlpha=function(e,d){e=e.slice();e[3]=Math.max(0,Math.min(e[3]*d,1));return e};a.Malloc=function(e,d){var g=a._malloc(d*e.BYTES_PER_ELEMENT);return{_ck:!0,length:d,byteOffset:g,pe:null,subarray:function(m,r){m=this.toTypedArray().subarray(m,r);m._ck=!0;return m},toTypedArray:function(){if(this.pe&&this.pe.length)return this.pe;
this.pe=new e(a.HEAPU8.buffer,g,d);this.pe._ck=!0;return this.pe}}};a.Free=function(e){a._free(e.byteOffset);e.byteOffset=U;e.toTypedArray=null;e.pe=null};var Na=U,Cb,ab=U,fc,ib=U,hc,Ha,ja=U,Mc,Ua=U,Nc,jc=U,Oc,kc=U,Pc,lc=U,Qc,ic=U,Rc,Sc=U,Fd=Float32Array.of(0,0,1),U=0;a.onRuntimeInitialized=function(){function e(d,g,m,r,y,D){D||(D=4*r.width,r.colorType===a.ColorType.RGBA_F16?D*=2:r.colorType===a.ColorType.RGBA_F32&&(D*=4));var J=D*r.height;var M=y?y.byteOffset:a._malloc(J);if(!d._readPixels(r,M,D,
g,m))return y||a._free(M),null;if(y)return y.toTypedArray();switch(r.colorType){case a.ColorType.RGBA_8888:case a.ColorType.RGBA_F16:d=(new Uint8Array(a.HEAPU8.buffer,M,J)).slice();break;case a.ColorType.RGBA_F32:d=(new Float32Array(a.HEAPU8.buffer,M,J)).slice();break;default:return null}a._free(M);return d}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;Ha=a.Malloc(Float32Array,4);ja=Ha.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(d){var g=w(d,"HEAPF32"),
m=a.Path._MakeFromCmds(g,d.length);x(g,d);return m};a.Path.MakeFromVerbsPointsWeights=function(d,g,m){var r=w(d,"HEAPU8"),y=w(g,"HEAPF32"),D=w(m,"HEAPF32"),J=a.Path._MakeFromVerbsPointsWeights(r,d.length,y,g.length,D,m&&m.length||0);x(r,d);x(y,g);x(D,m);return J};a.Path.prototype.addArc=function(d,g,m){d=S(d);this._addArc(d,g,m);return this};a.Path.prototype.addOval=function(d,g,m){void 0===m&&(m=1);d=S(d);this._addOval(d,!!g,m);return this};a.Path.prototype.addPath=function(){var d=Array.prototype.slice.call(arguments),
g=d[0],m=!1;"boolean"===typeof d[d.length-1]&&(m=d.pop());if(1===d.length)this._addPath(g,1,0,0,0,1,0,0,0,1,m);else if(2===d.length)d=d[1],this._addPath(g,d[0],d[1],d[2],d[3],d[4],d[5],d[6]||0,d[7]||0,d[8]||1,m);else if(7===d.length||10===d.length)this._addPath(g,d[1],d[2],d[3],d[4],d[5],d[6],d[7]||0,d[8]||0,d[9]||1,m);else return null;return this};a.Path.prototype.addPoly=function(d,g){var m=w(d,"HEAPF32");this._addPoly(m,d.length/2,g);x(m,d);return this};a.Path.prototype.addRect=function(d,g){d=
S(d);this._addRect(d,!!g);return this};a.Path.prototype.addRRect=function(d,g){d=oa(d);this._addRRect(d,!!g);return this};a.Path.prototype.addVerbsPointsWeights=function(d,g,m){var r=w(d,"HEAPU8"),y=w(g,"HEAPF32"),D=w(m,"HEAPF32");this._addVerbsPointsWeights(r,d.length,y,g.length,D,m&&m.length||0);x(r,d);x(y,g);x(D,m)};a.Path.prototype.arc=function(d,g,m,r,y,D){d=a.LTRBRect(d-m,g-m,d+m,g+m);y=(y-r)/Math.PI*180-360*!!D;D=new a.Path;D.addArc(d,r/Math.PI*180,y);this.addPath(D,!0);D.delete();return this};
a.Path.prototype.arcToOval=function(d,g,m,r){d=S(d);this._arcToOval(d,g,m,r);return this};a.Path.prototype.arcToRotated=function(d,g,m,r,y,D,J){this._arcToRotated(d,g,m,!!r,!!y,D,J);return this};a.Path.prototype.arcToTangent=function(d,g,m,r,y){this._arcToTangent(d,g,m,r,y);return this};a.Path.prototype.close=function(){this._close();return this};a.Path.prototype.conicTo=function(d,g,m,r,y){this._conicTo(d,g,m,r,y);return this};a.Path.prototype.computeTightBounds=function(d){this._computeTightBounds(ja);
var g=Ha.toTypedArray();return d?(d.set(g),d):g.slice()};a.Path.prototype.cubicTo=function(d,g,m,r,y,D){this._cubicTo(d,g,m,r,y,D);return this};a.Path.prototype.dash=function(d,g,m){return this._dash(d,g,m)?this:null};a.Path.prototype.getBounds=function(d){this._getBounds(ja);var g=Ha.toTypedArray();return d?(d.set(g),d):g.slice()};a.Path.prototype.lineTo=function(d,g){this._lineTo(d,g);return this};a.Path.prototype.moveTo=function(d,g){this._moveTo(d,g);return this};a.Path.prototype.offset=function(d,
g){this._transform(1,0,d,0,1,g,0,0,1);return this};a.Path.prototype.quadTo=function(d,g,m,r){this._quadTo(d,g,m,r);return this};a.Path.prototype.rArcTo=function(d,g,m,r,y,D,J){this._rArcTo(d,g,m,r,y,D,J);return this};a.Path.prototype.rConicTo=function(d,g,m,r,y){this._rConicTo(d,g,m,r,y);return this};a.Path.prototype.rCubicTo=function(d,g,m,r,y,D){this._rCubicTo(d,g,m,r,y,D);return this};a.Path.prototype.rLineTo=function(d,g){this._rLineTo(d,g);return this};a.Path.prototype.rMoveTo=function(d,g){this._rMoveTo(d,
g);return this};a.Path.prototype.rQuadTo=function(d,g,m,r){this._rQuadTo(d,g,m,r);return this};a.Path.prototype.stroke=function(d){d=d||{};d.width=d.width||1;d.miter_limit=d.miter_limit||4;d.cap=d.cap||a.StrokeCap.Butt;d.join=d.join||a.StrokeJoin.Miter;d.precision=d.precision||1;return this._stroke(d)?this:null};a.Path.prototype.transform=function(){if(1===arguments.length){var d=arguments[0];this._transform(d[0],d[1],d[2],d[3],d[4],d[5],d[6]||0,d[7]||0,d[8]||1)}else if(6===arguments.length||9===
arguments.length)d=arguments,this._transform(d[0],d[1],d[2],d[3],d[4],d[5],d[6]||0,d[7]||0,d[8]||1);else throw"transform expected to take 1 or 9 arguments. Got "+arguments.length;return this};a.Path.prototype.trim=function(d,g,m){return this._trim(d,g,!!m)?this:null};a.Image.prototype.makeShaderCubic=function(d,g,m,r,y){y=K(y);return this._makeShaderCubic(d,g,m,r,y)};a.Image.prototype.makeShaderOptions=function(d,g,m,r,y){y=K(y);return this._makeShaderOptions(d,g,m,r,y)};a.Image.prototype.readPixels=
function(d,g,m,r,y){return e(this,d,g,m,r,y)};a.Canvas.prototype.clear=function(d){a.Od(this.Md);d=A(d);this._clear(d)};a.Canvas.prototype.clipRRect=function(d,g,m){a.Od(this.Md);d=oa(d);this._clipRRect(d,g,m)};a.Canvas.prototype.clipRect=function(d,g,m){a.Od(this.Md);d=S(d);this._clipRect(d,g,m)};a.Canvas.prototype.concat=function(d){a.Od(this.Md);d=O(d);this._concat(d)};a.Canvas.prototype.drawArc=function(d,g,m,r,y){a.Od(this.Md);d=S(d);this._drawArc(d,g,m,r,y)};a.Canvas.prototype.drawAtlas=function(d,
g,m,r,y,D,J){if(d&&r&&g&&m&&g.length===m.length){a.Od(this.Md);y||(y=a.BlendMode.SrcOver);var M=w(g,"HEAPF32"),Q=w(m,"HEAPF32"),V=m.length/4,u=w(l(D),"HEAPU32");if(J&&"B"in J&&"C"in J)this._drawAtlasCubic(d,Q,M,u,V,y,J.B,J.C,r);else{let I=a.FilterMode.Linear,R=a.MipmapMode.None;J&&(I=J.filter,"mipmap"in J&&(R=J.mipmap));this._drawAtlasOptions(d,Q,M,u,V,y,I,R,r)}x(M,g);x(Q,m);x(u,D)}};a.Canvas.prototype.drawCircle=function(d,g,m,r){a.Od(this.Md);this._drawCircle(d,g,m,r)};a.Canvas.prototype.drawColor=
function(d,g){a.Od(this.Md);d=A(d);void 0!==g?this._drawColor(d,g):this._drawColor(d)};a.Canvas.prototype.drawColorInt=function(d,g){a.Od(this.Md);this._drawColorInt(d,g||a.BlendMode.SrcOver)};a.Canvas.prototype.drawColorComponents=function(d,g,m,r,y){a.Od(this.Md);d=N(d,g,m,r);void 0!==y?this._drawColor(d,y):this._drawColor(d)};a.Canvas.prototype.drawDRRect=function(d,g,m){a.Od(this.Md);d=oa(d,ic);g=oa(g,Sc);this._drawDRRect(d,g,m)};a.Canvas.prototype.drawGlyphs=function(d,g,m,r,y,D){if(!(2*d.length<=
g.length))throw"Not enough positions for the array of gyphs";a.Od(this.Md);const J=w(d,"HEAPU16"),M=w(g,"HEAPF32");this._drawGlyphs(d.length,J,M,m,r,y,D);x(M,g);x(J,d)};a.Canvas.prototype.drawImage=function(d,g,m,r){a.Od(this.Md);this._drawImage(d,g,m,r||null)};a.Canvas.prototype.drawImageCubic=function(d,g,m,r,y,D){a.Od(this.Md);this._drawImageCubic(d,g,m,r,y,D||null)};a.Canvas.prototype.drawImageOptions=function(d,g,m,r,y,D){a.Od(this.Md);this._drawImageOptions(d,g,m,r,y,D||null)};a.Canvas.prototype.drawImageNine=
function(d,g,m,r,y){a.Od(this.Md);g=w(g,"HEAP32",lc);m=S(m);this._drawImageNine(d,g,m,r,y||null)};a.Canvas.prototype.drawImageRect=function(d,g,m,r,y){a.Od(this.Md);S(g,ja);S(m,Ua);this._drawImageRect(d,ja,Ua,r,!!y)};a.Canvas.prototype.drawImageRectCubic=function(d,g,m,r,y,D){a.Od(this.Md);S(g,ja);S(m,Ua);this._drawImageRectCubic(d,ja,Ua,r,y,D||null)};a.Canvas.prototype.drawImageRectOptions=function(d,g,m,r,y,D){a.Od(this.Md);S(g,ja);S(m,Ua);this._drawImageRectOptions(d,ja,Ua,r,y,D||null)};a.Canvas.prototype.drawLine=
function(d,g,m,r,y){a.Od(this.Md);this._drawLine(d,g,m,r,y)};a.Canvas.prototype.drawOval=function(d,g){a.Od(this.Md);d=S(d);this._drawOval(d,g)};a.Canvas.prototype.drawPaint=function(d){a.Od(this.Md);this._drawPaint(d)};a.Canvas.prototype.drawParagraph=function(d,g,m){a.Od(this.Md);this._drawParagraph(d,g,m)};a.Canvas.prototype.drawPatch=function(d,g,m,r,y){if(24>d.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 D=w(d,"HEAPF32"),J=g?w(l(g),"HEAPU32"):U,M=m?w(m,"HEAPF32"):U;r||(r=a.BlendMode.Modulate);this._drawPatch(D,J,M,r,y);x(M,m);x(J,g);x(D,d)};a.Canvas.prototype.drawPath=function(d,g){a.Od(this.Md);this._drawPath(d,g)};a.Canvas.prototype.drawPicture=function(d){a.Od(this.Md);this._drawPicture(d)};a.Canvas.prototype.drawPoints=function(d,g,m){a.Od(this.Md);var r=w(g,"HEAPF32");this._drawPoints(d,r,g.length/2,m);x(r,g)};a.Canvas.prototype.drawRRect=function(d,g){a.Od(this.Md);d=oa(d);this._drawRRect(d,
g)};a.Canvas.prototype.drawRect=function(d,g){a.Od(this.Md);d=S(d);this._drawRect(d,g)};a.Canvas.prototype.drawRect4f=function(d,g,m,r,y){a.Od(this.Md);this._drawRect4f(d,g,m,r,y)};a.Canvas.prototype.drawShadow=function(d,g,m,r,y,D,J){a.Od(this.Md);var M=w(y,"HEAPF32"),Q=w(D,"HEAPF32");g=w(g,"HEAPF32",jc);m=w(m,"HEAPF32",kc);this._drawShadow(d,g,m,r,M,Q,J);x(M,y);x(Q,D)};a.getShadowLocalBounds=function(d,g,m,r,y,D,J){d=K(d);m=w(m,"HEAPF32",jc);r=w(r,"HEAPF32",kc);if(!this._getShadowLocalBounds(d,
g,m,r,y,D,ja))return null;g=Ha.toTypedArray();return J?(J.set(g),J):g.slice()};a.Canvas.prototype.drawTextBlob=function(d,g,m,r){a.Od(this.Md);this._drawTextBlob(d,g,m,r)};a.Canvas.prototype.drawVertices=function(d,g,m){a.Od(this.Md);this._drawVertices(d,g,m)};a.Canvas.prototype.getLocalToDevice=function(){this._getLocalToDevice(ab);for(var d=ab,g=Array(16),m=0;16>m;m++)g[m]=a.HEAPF32[d/4+m];return g};a.Canvas.prototype.getTotalMatrix=function(){this._getTotalMatrix(Na);for(var d=Array(9),g=0;9>g;g++)d[g]=
a.HEAPF32[Na/4+g];return d};a.Canvas.prototype.makeSurface=function(d){d=this._makeSurface(d);d.Md=this.Md;return d};a.Canvas.prototype.readPixels=function(d,g,m,r,y){a.Od(this.Md);return e(this,d,g,m,r,y)};a.Canvas.prototype.saveLayer=function(d,g,m,r){g=S(g);return this._saveLayer(d||null,g,m||null,r||0)};a.Canvas.prototype.writePixels=function(d,g,m,r,y,D,J,M){if(d.byteLength%(g*m))throw"pixels length must be a multiple of the srcWidth * srcHeight";a.Od(this.Md);var Q=d.byteLength/(g*m);D=D||a.AlphaType.Unpremul;
J=J||a.ColorType.RGBA_8888;M=M||a.ColorSpace.SRGB;var V=Q*g;Q=w(d,"HEAPU8");g=this._writePixels({width:g,height:m,colorType:J,alphaType:D,colorSpace:M},Q,V,r,y);x(Q,d);return g};a.ColorFilter.MakeBlend=function(d,g){d=A(d);return a.ColorFilter._MakeBlend(d,g)};a.ColorFilter.MakeMatrix=function(d){if(!d||20!==d.length)throw"invalid color matrix";var g=w(d,"HEAPF32"),m=a.ColorFilter._makeMatrix(g);x(g,d);return m};a.ContourMeasure.prototype.getPosTan=function(d,g){this._getPosTan(d,ja);d=Ha.toTypedArray();
return g?(g.set(d),g):d.slice()};a.ImageFilter.MakeMatrixTransform=function(d,g,m){d=K(d);if("B"in g&&"C"in g)return a.ImageFilter._MakeMatrixTransformCubic(d,g.yg,g.zg,m);const r=g.filter;let y=a.MipmapMode.None;"mipmap"in g&&(y=g.mipmap);return a.ImageFilter._MakeMatrixTransformOptions(d,r,y,m)};a.Paint.prototype.getColor=function(){this._getColor(ib);return Y(ib)};a.Paint.prototype.setColor=function(d,g){g=g||null;d=A(d);this._setColor(d,g)};a.Paint.prototype.setColorComponents=function(d,g,m,
r,y){y=y||null;d=N(d,g,m,r);this._setColor(d,y)};a.Path.prototype.getPoint=function(d,g){this._getPoint(d,ja);d=Ha.toTypedArray();return g?(g[0]=d[0],g[1]=d[1],g):d.slice(0,2)};a.PictureRecorder.prototype.beginRecording=function(d){d=S(d);return this._beginRecording(d)};a.Surface.prototype.getCanvas=function(){var d=this._getCanvas();d.Md=this.Md;return d};a.Surface.prototype.makeImageSnapshot=function(d){a.Od(this.Md);d=w(d,"HEAP32",lc);return this._makeImageSnapshot(d)};a.Surface.prototype.makeSurface=
function(d){a.Od(this.Md);d=this._makeSurface(d);d.Md=this.Md;return d};a.Surface.prototype.requestAnimationFrame=function(d,g){this.Ge||(this.Ge=this.getCanvas());requestAnimationFrame(function(){a.Od(this.Md);d(this.Ge);this.flush(g)}.bind(this))};a.Surface.prototype.drawOnce=function(d,g){this.Ge||(this.Ge=this.getCanvas());requestAnimationFrame(function(){a.Od(this.Md);d(this.Ge);this.flush(g);this.dispose()}.bind(this))};a.PathEffect.MakeDash=function(d,g){g||(g=0);if(!d.length||1===d.length%
2)throw"Intervals array must have even length";var m=w(d,"HEAPF32");g=a.PathEffect._MakeDash(m,d.length,g);x(m,d);return g};a.Shader.MakeColor=function(d,g){g=g||null;d=A(d);return a.Shader._MakeColor(d,g)};a.Shader.Blend=a.Shader.MakeBlend;a.Shader.Color=a.Shader.MakeColor;a.Shader.MakeLinearGradient=function(d,g,m,r,y,D,J,M){M=M||null;var Q=F(m),V=w(r,"HEAPF32");J=J||0;D=K(D);var u=Ha.toTypedArray();u.set(d);u.set(g,2);d=a.Shader._MakeLinearGradient(ja,Q.ce,Q.Ke,V,Q.count,y,J,D,M);x(Q.ce,m);r&&
x(V,r);return d};a.Shader.MakeRadialGradient=function(d,g,m,r,y,D,J,M){M=M||null;var Q=F(m),V=w(r,"HEAPF32");J=J||0;D=K(D);d=a.Shader._MakeRadialGradient(d[0],d[1],g,Q.ce,Q.Ke,V,Q.count,y,J,D,M);x(Q.ce,m);r&&x(V,r);return d};a.Shader.MakeSweepGradient=function(d,g,m,r,y,D,J,M,Q,V){V=V||null;var u=F(m),I=w(r,"HEAPF32");J=J||0;M=M||0;Q=Q||360;D=K(D);d=a.Shader._MakeSweepGradient(d,g,u.ce,u.Ke,I,u.count,y,M,Q,J,D,V);x(u.ce,m);r&&x(I,r);return d};a.Shader.MakeTwoPointConicalGradient=function(d,g,m,r,
y,D,J,M,Q,V){V=V||null;var u=F(y),I=w(D,"HEAPF32");Q=Q||0;M=K(M);var R=Ha.toTypedArray();R.set(d);R.set(m,2);d=a.Shader._MakeTwoPointConicalGradient(ja,g,r,u.ce,u.Ke,I,u.count,J,Q,M,V);x(u.ce,y);D&&x(I,D);return d};a.Vertices.prototype.bounds=function(d){this._bounds(ja);var g=Ha.toTypedArray();return d?(d.set(g),d):g.slice()};a.Vd&&a.Vd.forEach(function(d){d()})};a.computeTonalColors=function(e){var d=w(e.ambient,"HEAPF32"),g=w(e.spot,"HEAPF32");this._computeTonalColors(d,g);var m={ambient:Y(d),
spot:Y(g)};x(d,e.ambient);x(g,e.spot);return m};a.LTRBRect=function(e,d,g,m){return Float32Array.of(e,d,g,m)};a.XYWHRect=function(e,d,g,m){return Float32Array.of(e,d,e+g,d+m)};a.LTRBiRect=function(e,d,g,m){return Int32Array.of(e,d,g,m)};a.XYWHiRect=function(e,d,g,m){return Int32Array.of(e,d,e+g,d+m)};a.RRectXY=function(e,d,g){return Float32Array.of(e[0],e[1],e[2],e[3],d,g,d,g,d,g,d,g)};a.MakeAnimatedImageFromEncoded=function(e){e=new Uint8Array(e);var d=a._malloc(e.byteLength);a.HEAPU8.set(e,d);return(e=
a._decodeAnimatedImage(d,e.byteLength))?e:null};a.MakeImageFromEncoded=function(e){e=new Uint8Array(e);var d=a._malloc(e.byteLength);a.HEAPU8.set(e,d);return(e=a._decodeImage(d,e.byteLength))?e:null};var lb=null;a.MakeImageFromCanvasImageSource=function(e){var d=e.width,g=e.height;lb||(lb=document.createElement("canvas"));lb.width=d;lb.height=g;var m=lb.getContext("2d");m.drawImage(e,0,0);e=m.getImageData(0,0,d,g);return a.MakeImage({width:d,height:g,alphaType:a.AlphaType.Unpremul,colorType:a.ColorType.RGBA_8888,
colorSpace:a.ColorSpace.SRGB},e.data,4*d)};a.MakeImage=function(e,d,g){var m=a._malloc(d.length);a.HEAPU8.set(d,m);return a._MakeImage(e,m,d.length,g)};a.MakeVertices=function(e,d,g,m,r,y){var D=r&&r.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,d.length/2,D,J);w(d,"HEAPF32",e.positions());e.texCoords()&&w(g,"HEAPF32",e.texCoords());e.colors()&&w(l(m),"HEAPU32",e.colors());e.indices()&&w(r,"HEAPU16",e.indices());return e.detach()};a.Matrix=
{};a.Matrix.identity=function(){return c(3)};a.Matrix.invert=function(e){var d=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 d?[(e[4]*e[8]-e[5]*e[7])/d,(e[2]*e[7]-e[1]*e[8])/d,(e[1]*e[5]-e[2]*e[4])/d,(e[5]*e[6]-e[3]*e[8])/d,(e[0]*e[8]-e[2]*e[6])/d,(e[2]*e[3]-e[0]*e[5])/d,(e[3]*e[7]-e[4]*e[6])/d,(e[1]*e[6]-e[0]*e[7])/d,(e[0]*e[4]-e[1]*e[3])/d]:null};a.Matrix.mapPoints=function(e,d){for(var g=0;g<d.length;g+=2){var m=d[g],r=d[g+1],y=e[6]*m+e[7]*r+e[8],
D=e[3]*m+e[4]*r+e[5];d[g]=(e[0]*m+e[1]*r+e[2])/y;d[g+1]=D/y}return d};a.Matrix.multiply=function(){return kb(3,arguments)};a.Matrix.rotated=function(e,d,g){d=d||0;g=g||0;var m=Math.sin(e);e=Math.cos(e);return[e,-m,ta(m,g,1-e,d),m,e,ta(-m,d,1-e,g),0,0,1]};a.Matrix.scaled=function(e,d,g,m){g=g||0;m=m||0;var r=b([e,d],c(3),3,0,1);return b([g-e*g,m-d*m],r,3,2,0)};a.Matrix.skewed=function(e,d,g,m){g=g||0;m=m||0;var r=b([e,d],c(3),3,1,-1);return b([-e*g,-d*m],r,3,2,0)};a.Matrix.translated=function(e,d){return b(arguments,
c(3),3,2,0)};a.Vector={};a.Vector.dot=function(e,d){return e.map(function(g,m){return g*d[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,d){return e.map(function(g){return g*d})};a.Vector.add=function(e,d){return e.map(function(g,m){return g+d[m]})};a.Vector.sub=function(e,d){return e.map(function(g,m){return g-d[m]})};a.Vector.dist=function(e,
d){return a.Vector.length(a.Vector.sub(e,d))};a.Vector.normalize=function(e){return a.Vector.mulScalar(e,1/a.Vector.length(e))};a.Vector.cross=function(e,d){return[e[1]*d[2]-e[2]*d[1],e[2]*d[0]-e[0]*d[2],e[0]*d[1]-e[1]*d[0]]};a.M44={};a.M44.identity=function(){return c(4)};a.M44.translated=function(e){return b(e,c(4),4,3,0)};a.M44.scaled=function(e){return b(e,c(4),4,0,1)};a.M44.rotated=function(e,d){return a.M44.rotatedUnitSinCos(a.Vector.normalize(e),Math.sin(d),Math.cos(d))};a.M44.rotatedUnitSinCos=
function(e,d,g){var m=e[0],r=e[1];e=e[2];var y=1-g;return[y*m*m+g,y*m*r-d*e,y*m*e+d*r,0,y*m*r+d*e,y*r*r+g,y*r*e-d*m,0,y*m*e-d*r,y*r*e+d*m,y*e*e+g,0,0,0,0,1]};a.M44.lookat=function(e,d,g){d=a.Vector.normalize(a.Vector.sub(d,e));g=a.Vector.normalize(g);g=a.Vector.normalize(a.Vector.cross(d,g));var m=a.M44.identity();b(g,m,4,0,0);b(a.Vector.cross(g,d),m,4,1,0);b(a.Vector.mulScalar(d,-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,d,g){var m=
1/(d-e);g/=2;g=Math.cos(g)/Math.sin(g);return[g,0,0,0,0,g,0,0,0,0,(d+e)*m,2*d*e*m,0,0,-1,1]};a.M44.rc=function(e,d,g){return e[4*d+g]};a.M44.multiply=function(){return kb(4,arguments)};a.M44.invert=function(e){var d=e[0],g=e[4],m=e[8],r=e[12],y=e[1],D=e[5],J=e[9],M=e[13],Q=e[2],V=e[6],u=e[10],I=e[14],R=e[3],aa=e[7],ka=e[11];e=e[15];var qa=d*D-g*y,ua=d*J-m*y,ya=d*M-r*y,ea=g*J-m*D,G=g*M-r*D,k=m*M-r*J,p=Q*aa-V*R,z=Q*ka-u*R,B=Q*e-I*R,C=V*ka-u*aa,E=V*e-I*aa,L=u*e-I*ka,ba=qa*L-ua*E+ya*C+ea*B-G*z+k*p,ca=
1/ba;if(0===ba||Infinity===ca)return null;qa*=ca;ua*=ca;ya*=ca;ea*=ca;G*=ca;k*=ca;p*=ca;z*=ca;B*=ca;C*=ca;E*=ca;L*=ca;d=[D*L-J*E+M*C,J*B-y*L-M*z,y*E-D*B+M*p,D*z-y*C-J*p,m*E-g*L-r*C,d*L-m*B+r*z,g*B-d*E-r*p,d*C-g*z+m*p,aa*k-ka*G+e*ea,ka*ya-R*k-e*ua,R*G-aa*ya+e*qa,aa*ua-R*ea-ka*qa,u*G-V*k-I*ea,Q*k-u*ya+I*ua,V*ya-Q*G-I*qa,Q*ea-V*ua+u*qa];return d.every(function(Ia){return!isNaN(Ia)&&Infinity!==Ia&&-Infinity!==Ia})?d: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,d,g){var m=a.M44.lookat(g.eye,g.coa,g.up);g=a.M44.perspective(g.near,g.far,g.angle);d=[(e[2]-e[0])/2,(e[3]-e[1])/2,d];e=a.M44.multiply(a.M44.translated([(e[0]+e[2])/2,(e[1]+e[3])/2,0]),a.M44.scaled(d));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,d,g,m){var r=new Float32Array(20);r[0]=e;r[6]=d;r[12]=g;r[18]=m;return r};var Gd=[[6,7,11,12],[0,10,2,12],[0,1,5,6]];a.ColorMatrix.rotated=function(e,d,g){var m=a.ColorMatrix.identity();e=Gd[e];m[e[0]]=g;m[e[1]]=d;m[e[2]]=-d;m[e[3]]=g;return m};a.ColorMatrix.postTranslate=function(e,d,g,m,r){e[4]+=d;e[9]+=g;e[14]+=m;e[19]+=r;return e};a.ColorMatrix.concat=function(e,d){for(var g=new Float32Array(20),m=0,r=0;20>r;r+=5){for(var y=0;4>
y;y++)g[m++]=e[r]*d[y]+e[r+1]*d[y+5]+e[r+2]*d[y+10]+e[r+3]*d[y+15];g[m++]=e[r]*d[4]+e[r+1]*d[9]+e[r+2]*d[14]+e[r+3]*d[19]+e[r+4]}return g};(function(e){e.Vd=e.Vd||[];e.Vd.push(function(){function d(u){if(!u||!u.length)return[];for(var I=[],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;I.push(aa)}e._free(u.byteOffset);return I}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 U;for(var I=[],R=0;R<u.length;R++){var aa=r(u[R]);I.push(aa)}return w(I,"HEAPU32")}function r(u){if(J[u])return J[u];var I=na(u)+1,R=e._malloc(I);pa(u,H,R,I);return J[u]=R}function y(u){u._colorPtr=A(u.color);u._foregroundColorPtr=U;u._backgroundColorPtr=U;u._decorationColorPtr=U;u.foregroundColor&&(u._foregroundColorPtr=A(u.foregroundColor,M));u.backgroundColor&&(u._backgroundColorPtr=A(u.backgroundColor,
Q));u.decorationColor&&(u._decorationColorPtr=A(u.decorationColor,V));Array.isArray(u.fontFamilies)&&u.fontFamilies.length?(u._fontFamiliesPtr=m(u.fontFamilies),u._fontFamiliesLen=u.fontFamilies.length):(u._fontFamiliesPtr=U,u._fontFamiliesLen=0);if(u.locale){var I=u.locale;u._localePtr=r(I);u._localeLen=na(I)+1}else u._localePtr=U,u._localeLen=0;if(Array.isArray(u.shadows)&&u.shadows.length){I=u.shadows;var R=I.map(function(ea){return ea.color||e.BLACK}),aa=I.map(function(ea){return ea.blurRadius||
0});u._shadowLen=I.length;for(var ka=e._malloc(8*I.length),qa=ka/4,ua=0;ua<I.length;ua++){var ya=I[ua].offset||[0,0];e.HEAPF32[qa]=ya[0];e.HEAPF32[qa+1]=ya[1];qa+=2}u._shadowColorsPtr=F(R).ce;u._shadowOffsetsPtr=ka;u._shadowBlurRadiiPtr=w(aa,"HEAPF32")}else u._shadowLen=0,u._shadowColorsPtr=U,u._shadowOffsetsPtr=U,u._shadowBlurRadiiPtr=U;Array.isArray(u.fontFeatures)&&u.fontFeatures.length?(I=u.fontFeatures,R=I.map(function(ea){return ea.name}),aa=I.map(function(ea){return ea.value}),u._fontFeatureLen=
I.length,u._fontFeatureNamesPtr=m(R),u._fontFeatureValuesPtr=w(aa,"HEAPU32")):(u._fontFeatureLen=0,u._fontFeatureNamesPtr=U,u._fontFeatureValuesPtr=U)}function D(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,I,R,aa){u=this._getRectsForRange(u,I,R,aa);return d(u)};e.Paragraph.prototype.getRectsForPlaceholders=function(){var u=
this._getRectsForPlaceholders();return d(u)};e.TypefaceFontProvider.prototype.registerFont=function(u,I){u=e.Typeface.MakeFreeTypeFaceFromData(u);if(!u)return null;I=r(I);this._registerFont(u,I)};e.ParagraphStyle=function(u){u.disableHinting=u.disableHinting||!1;if(u.ellipsis){var I=u.ellipsis;u._ellipsisPtr=r(I);u._ellipsisLen=na(I)+1}else u._ellipsisPtr=U,u._ellipsisLen=0;u.heightMultiplier=u.heightMultiplier||0;u.maxLines=u.maxLines||0;I=(I=u.strutStyle)||{};I.strutEnabled=I.strutEnabled||!1;I.strutEnabled&&
Array.isArray(I.fontFamilies)&&I.fontFamilies.length?(I._fontFamiliesPtr=m(I.fontFamilies),I._fontFamiliesLen=I.fontFamilies.length):(I._fontFamiliesPtr=U,I._fontFamiliesLen=0);I.fontStyle=g(I.fontStyle);I.fontSize=I.fontSize||0;I.heightMultiplier=I.heightMultiplier||0;I.halfLeading=I.halfLeading||!1;I.leading=I.leading||0;I.forceStrutHeight=I.forceStrutHeight||!1;u.strutStyle=I;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={},M=e._malloc(16),Q=e._malloc(16),V=e._malloc(16);e.ParagraphBuilder.Make=function(u,I){y(u.textStyle);I=e.ParagraphBuilder._Make(u,I);D(u.textStyle);return I};e.ParagraphBuilder.MakeFromFontProvider=function(u,I){y(u.textStyle);I=e.ParagraphBuilder._MakeFromFontProvider(u,I);D(u.textStyle);return I};e.ParagraphBuilder.ShapeText=function(u,I,R){let aa=0;for(const ka of I)aa+=ka.length;if(aa!==u.length)throw"Accumulated block lengths must equal text.length";return e.ParagraphBuilder._ShapeText(u,
I,R)};e.ParagraphBuilder.prototype.pushStyle=function(u){y(u);this._pushStyle(u);D(u)};e.ParagraphBuilder.prototype.pushPaintStyle=function(u,I,R){y(u);this._pushPaintStyle(u,I,R);D(u)};e.ParagraphBuilder.prototype.addPlaceholder=function(u,I,R,aa,ka){R=R||e.PlaceholderAlignment.Baseline;aa=aa||e.TextBaseline.Alphabetic;this._addPlaceholder(u||0,I||0,R,aa,ka||0)}})})(t);a.Vd=a.Vd||[];a.Vd.push(function(){a.Path.prototype.op=function(e,d){return this._op(e,d)?this:null};a.Path.prototype.simplify=function(){return this._simplify()?
this:null}});a.Vd=a.Vd||[];a.Vd.push(function(){a.Canvas.prototype.drawText=function(e,d,g,m,r){var y=na(e),D=a._malloc(y+1);pa(e,H,D,y+1);this._drawSimpleText(D,y,d,g,r,m);a._free(D)};a.Font.prototype.getGlyphBounds=function(e,d,g){var m=w(e,"HEAPU16"),r=a._malloc(16*e.length);this._getGlyphWidthBounds(m,e.length,U,r,d||null);d=new Float32Array(a.HEAPU8.buffer,r,4*e.length);x(m,e);if(g)return g.set(d),a._free(r),g;e=Float32Array.from(d);a._free(r);return e};a.Font.prototype.getGlyphIDs=function(e,
d,g){d||(d=e.length);var m=na(e)+1,r=a._malloc(m);pa(e,H,r,m);e=a._malloc(2*d);d=this._getGlyphIDs(r,m-1,d,e);a._free(r);if(0>d)return a._free(e),null;r=new Uint16Array(a.HEAPU8.buffer,e,d);if(g)return g.set(r),a._free(e),g;g=Uint16Array.from(r);a._free(e);return g};a.Font.prototype.getGlyphIntercepts=function(e,d,g,m){var r=w(e,"HEAPU16"),y=w(d,"HEAPF32");return this._getGlyphIntercepts(r,e.length,!(e&&e._ck),y,d.length,!(d&&d._ck),g,m)};a.Font.prototype.getGlyphWidths=function(e,d,g){var m=w(e,
"HEAPU16"),r=a._malloc(4*e.length);this._getGlyphWidthBounds(m,e.length,r,U,d||null);d=new Float32Array(a.HEAPU8.buffer,r,e.length);x(m,e);if(g)return g.set(d),a._free(r),g;e=Float32Array.from(d);a._free(r);return e};a.FontMgr.FromData=function(){if(!arguments.length)return null;var e=arguments;1===e.length&&Array.isArray(e[0])&&(e=arguments[0]);if(!e.length)return null;for(var d=[],g=[],m=0;m<e.length;m++){var r=new Uint8Array(e[m]),y=w(r,"HEAPU8");d.push(y);g.push(r.byteLength)}d=w(d,"HEAPU32");
g=w(g,"HEAPU32");e=a.FontMgr._fromData(d,g,e.length);a._free(d);a._free(g);return e};a.Typeface.MakeFreeTypeFaceFromData=function(e){e=new Uint8Array(e);var d=w(e,"HEAPU8");return(e=a.Typeface._MakeFreeTypeFaceFromData(d,e.byteLength))?e:null};a.Typeface.prototype.getGlyphIDs=function(e,d,g){d||(d=e.length);var m=na(e)+1,r=a._malloc(m);pa(e,H,r,m);e=a._malloc(2*d);d=this._getGlyphIDs(r,m-1,d,e);a._free(r);if(0>d)return a._free(e),null;r=new Uint16Array(a.HEAPU8.buffer,e,d);if(g)return g.set(r),a._free(e),
g;g=Uint16Array.from(r);a._free(e);return g};a.TextBlob.MakeOnPath=function(e,d,g,m){if(e&&e.length&&d&&d.countPoints()){if(1===d.countPoints())return this.MakeFromText(e,g);m||(m=0);var r=g.getGlyphIDs(e);r=g.getGlyphWidths(r);var y=[];d=new a.ContourMeasureIter(d,!1,1);for(var D=d.next(),J=new Float32Array(4),M=0;M<e.length&&D;M++){var Q=r[M];m+=Q/2;if(m>D.length()){D.delete();D=d.next();if(!D){e=e.substring(0,M);break}m=Q/2}D.getPosTan(m,J);var V=J[2],u=J[3];y.push(V,u,J[0]-Q/2*V,J[1]-Q/2*u);m+=
Q/2}e=this.MakeFromRSXform(e,y,g);D&&D.delete();d.delete();return e}};a.TextBlob.MakeFromRSXform=function(e,d,g){var m=na(e)+1,r=a._malloc(m);pa(e,H,r,m);e=w(d,"HEAPF32");g=a.TextBlob._MakeFromRSXform(r,m-1,e,g);a._free(r);return g?g:null};a.TextBlob.MakeFromRSXformGlyphs=function(e,d,g){var m=w(e,"HEAPU16");d=w(d,"HEAPF32");g=a.TextBlob._MakeFromRSXformGlyphs(m,2*e.length,d,g);x(m,e);return g?g:null};a.TextBlob.MakeFromGlyphs=function(e,d){var g=w(e,"HEAPU16");d=a.TextBlob._MakeFromGlyphs(g,2*e.length,
d);x(g,e);return d?d:null};a.TextBlob.MakeFromText=function(e,d){var g=na(e)+1,m=a._malloc(g);pa(e,H,m,g);e=a.TextBlob._MakeFromText(m,g-1,d);a._free(m);return e?e:null};a.MallocGlyphIDs=function(e){return a.Malloc(Uint16Array,e)}});a.Vd=a.Vd||[];a.Vd.push(function(){a.MakePicture=function(e){e=new Uint8Array(e);var d=a._malloc(e.byteLength);a.HEAPU8.set(e,d);return(e=a._MakePicture(d,e.byteLength))?e:null}});(function(){function e(G){for(var k=0;k<G.length;k++)if(void 0!==G[k]&&!Number.isFinite(G[k]))return!1;
return!0}function d(G){var k=a.getColorComponents(G);G=k[0];var p=k[1],z=k[2];k=k[3];if(1===k)return G=G.toString(16).toLowerCase(),p=p.toString(16).toLowerCase(),z=z.toString(16).toLowerCase(),G=1===G.length?"0"+G:G,p=1===p.length?"0"+p:p,z=1===z.length?"0"+z:z,"#"+G+p+z;k=0===k||1===k?k:k.toFixed(8);return"rgba("+G+", "+p+", "+z+", "+k+")"}function g(G){return a.parseColorString(G,ua)}function m(G){G=ya.exec(G);if(!G)return null;var k=parseFloat(G[4]),p=16;switch(G[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:G[1],variant:G[2],weight:G[3],sizePx:p,family:G[6].trim()}}function r(G){this.Nd=G;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.Td=new a.Path;this.Ud=a.Matrix.identity();this.kf=[];this.Ae=[];this.me=function(){this.Td.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.Ud[0],c:this.Ud[1],
e:this.Ud[2],b:this.Ud[3],d:this.Ud[4],f:this.Ud[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)?d(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=ea[z]?ea[z][(p.style||"normal")+"|"+(p.variant||"normal")+"|"+(p.weight||"normal")]||
ea[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 d(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 d(this.he)},set:function(k){"string"===typeof k?this.he=g(k):k.se&&(this.he=k)}});this.arc=function(k,p,z,B,C,E){I(this.Td,k,p,z,z,0,B,C,E)};this.arcTo=function(k,p,z,B,C){Q(this.Td,k,p,z,B,C)};this.beginPath=function(){this.Td.delete();this.Td=new a.Path};this.bezierCurveTo=function(k,p,z,B,C,E){var L=this.Td;e([k,p,z,B,C,E])&&(L.isEmpty()&&L.moveTo(k,p),L.cubicTo(k,p,z,B,C,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),this.Qd);this.Qd.setBlendMode(this.Pd)};this.clip=function(k,p){"string"===typeof k?(p=k,k=this.Td):k&&k.$e&&(k=k.Wd);k||(k=this.Td);k=k.copy();p&&"evenodd"===p.toLowerCase()?k.setFillType(a.FillType.EvenOdd):k.setFillType(a.FillType.Winding);this.Nd.clipPath(k,a.ClipOp.Intersect,!0);k.delete()};this.closePath=function(){V(this.Td)};this.createImageData=function(){if(1===arguments.length){var k=arguments[0];return new J(new Uint8ClampedArray(4*k.width*k.height),
k.width,k.height)}if(2===arguments.length){k=arguments[0];var p=arguments[1];return new J(new Uint8ClampedArray(4*k*p),k,p)}throw"createImageData expects 1 or 2 arguments, got "+arguments.length;};this.createLinearGradient=function(k,p,z,B){if(e(arguments)){var C=new M(k,p,z,B);this.Ae.push(C);return C}};this.createPattern=function(k,p){k=new ka(k,p);this.Ae.push(k);return k};this.createRadialGradient=function(k,p,z,B,C,E){if(e(arguments)){var L=new qa(k,p,z,B,C,E);this.Ae.push(L);return L}};this.drawImage=
function(k){k instanceof D&&(k=k.sf());var p=this.Oe();if(3===arguments.length||5===arguments.length)var z=a.XYWHRect(arguments[1],arguments[2],arguments[3]||k.width(),arguments[4]||k.height()),B=a.XYWHRect(0,0,k.width(),k.height());else if(9===arguments.length)z=a.XYWHRect(arguments[5],arguments[6],arguments[7],arguments[8]),B=a.XYWHRect(arguments[1],arguments[2],arguments[3],arguments[4]);else throw"invalid number of args for drawImage, need 3, 5, or 9; got "+arguments.length;this.Nd.drawImageRect(k,
B,z,p,!1);p.dispose()};this.ellipse=function(k,p,z,B,C,E,L,ba){I(this.Td,k,p,z,B,C,E,L,ba)};this.Oe=function(){var k=this.Qd.copy();k.setStyle(a.PaintStyle.Fill);if(f(this.be)){var p=a.multiplyByAlpha(this.be,this.je);k.setColor(p)}else p=this.be.se(this.Ud),k.setColor(a.Color(0,0,0,this.je)),k.setShader(p);k.dispose=function(){this.delete()};return k};this.fill=function(k,p){"string"===typeof k?(p=k,k=this.Td):k&&k.$e&&(k=k.Wd);if("evenodd"===p)this.Td.setFillType(a.FillType.EvenOdd);else{if("nonzero"!==
p&&p)throw"invalid fill rule";this.Td.setFillType(a.FillType.Winding)}k||(k=this.Td);p=this.Oe();var z=this.xe(p);z&&(this.Nd.save(),this.qe(),this.Nd.drawPath(k,z),this.Nd.restore(),z.dispose());this.Nd.drawPath(k,p);p.dispose()};this.fillRect=function(k,p,z,B){var C=this.Oe(),E=this.xe(C);E&&(this.Nd.save(),this.qe(),this.Nd.drawRect(a.XYWHRect(k,p,z,B),E),this.Nd.restore(),E.dispose());this.Nd.drawRect(a.XYWHRect(k,p,z,B),C);C.dispose()};this.fillText=function(k,p,z){var B=this.Oe();k=a.TextBlob.MakeFromText(k,
this.ne);var C=this.xe(B);C&&(this.Nd.save(),this.qe(),this.Nd.drawTextBlob(k,p,z,C),this.Nd.restore(),C.dispose());this.Nd.drawTextBlob(k,p,z,B);k