@m2c2kit/core 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var t,e,n;!function(t){t.sequence="Sequence",t.group="Group",t.wait="Wait",t.custom="Custom",t.move="Move",t.scale="Scale"}(t||(t={}));class
|
|
1
|
+
var t,e,n;!function(t){t.sequence="Sequence",t.group="Group",t.wait="Wait",t.custom="Custom",t.move="Move",t.scale="Scale"}(t||(t={}));class i{constructor(t=!1){this.startOffset=-1,this.endOffset=-1,this.started=!1,this.running=!1,this.completed=!1,this.runStartTime=-1,this.duration=0,this.isParent=!1,this.isChild=!1,this.runDuringTransition=t}static Move(t){var e;return new l(t.point,t.duration,null!==(e=t.runDuringTransition)&&void 0!==e&&e)}static Wait(t){var e;return new s(t.duration,null!==(e=t.runDuringTransition)&&void 0!==e&&e)}static Custom(t){var e;return new o(t.callback,null!==(e=t.runDuringTransition)&&void 0!==e&&e)}static Scale(t){return new c(t.scale,t.duration,t.runDuringTransition)}static Sequence(t){const e=new r(t);return e.children=t,e}static Group(t){const e=new a(t);return e.children=t,e}initialize(e,n){this.assignParents(this,this,n);const r=this.flattenActions(this);r.forEach((t=>t.duration=this.calculateDuration(t))),this.calculateStartEndOffsets(this);return r.filter((e=>e.type!==t.group&&e.type!==t.sequence)).map((t=>i.cloneAction(t,n)))}static cloneAction(e,n){let r;switch(e.type){case t.sequence:{const t=e.children.map((t=>i.cloneAction(t,n)));r=i.Sequence(t);break}case t.group:{const t=e.children.map((t=>i.cloneAction(t,n)));r=i.Sequence(t);break}case t.move:{const t=e;r=i.Move({point:t.point,duration:t.duration,runDuringTransition:t.runDuringTransition});break}case t.custom:{const t=e;r=i.Custom({callback:t.callback,runDuringTransition:t.runDuringTransition});break}case t.scale:{const t=e;r=i.Scale({scale:t.scale,duration:t.duration,runDuringTransition:t.runDuringTransition});break}case t.wait:{const t=e;r=i.Wait({duration:t.duration,runDuringTransition:t.runDuringTransition});break}default:throw new Error("unknown action")}return void 0!==n&&(r.key=n),r.startOffset=e.startOffset,r.endOffset=e.endOffset,r}static evaluateAction(e,n,i,r){if(i<e.runStartTime+e.startOffset)return;if(i>=e.runStartTime+e.startOffset&&i<=e.runStartTime+e.startOffset+e.duration?e.running=!0:e.running=!1,!1===e.running&&!0===e.completed)return;const a=i-(e.runStartTime+e.startOffset);if(e.type===t.custom){const t=e;t.callback(),t.running=!1,t.completed=!0}if(e.type===t.wait){const t=e;i>e.runStartTime+e.startOffset+e.duration&&(t.running=!1,t.completed=!0)}if(e.type===t.move){const t=e;t.started||(t.dx=t.point.x-n.position.x,t.dy=t.point.y-n.position.y,t.started=!0),a<t.duration?(n.position.x=n.position.x+t.dx*(r/t.duration),n.position.y=n.position.y+t.dy*(r/t.duration)):(n.position.x=t.point.x,n.position.y=t.point.y,t.running=!1,t.completed=!0)}if(e.type===t.scale){const t=e;t.started||(t.delta=t.scale-n.scale,t.started=!0),a<t.duration?n.scale=n.scale+t.delta*(r/t.duration):(n.scale=t.scale,t.running=!1,t.completed=!0)}}calculateDuration(e){if(e.type===t.group){return e.children.map((t=>this.calculateDuration(t))).reduce(((t,e)=>Math.max(t,e)),0)}if(e.type===t.sequence){return e.children.map((t=>this.calculateDuration(t))).reduce(((t,e)=>t+e),0)}return e.duration}calculateStartEndOffsets(e){var n,i,r;let a=0;if(void 0!==e.parent&&(a=e.parent.startOffset),(null===(n=e.parent)||void 0===n?void 0:n.type)===t.group)e.startOffset=a,e.endOffset=e.startOffset+e.duration;else if((null===(i=e.parent)||void 0===i?void 0:i.type)===t.sequence){const t=e.parent;let n=0;for(const i of t.children){if(i===e)break;n+=i.duration}e.startOffset=n,e.endOffset=e.startOffset+e.duration}else e.startOffset=a,e.endOffset=e.startOffset+e.duration;e.isParent&&(null===(r=e.children)||void 0===r||r.forEach((t=>this.calculateStartEndOffsets(t))))}flattenActions(t,e){if(e||(e=new Array).push(t),t.isParent){const n=t,i=n.children;e.push(...i),n.children.filter((t=>t.isParent)).forEach((t=>this.flattenActions(t,e)))}return e}assignParents(t,e,n){if(void 0!==n&&(t.key=n),e||((e=t).parent=void 0),t.isParent){const i=t;i.children.forEach((e=>{e.parent=t})),i.children.filter((t=>t.isParent)).forEach((t=>this.assignParents(t,e,n)))}}}class r extends i{constructor(e){super(),this.type=t.sequence,this.children=e,this.isParent=!0}}class a extends i{constructor(e){super(),this.type=t.group,this.children=new Array,this.children=e,this.isParent=!0}}class o extends i{constructor(e,n=!1){super(n),this.type=t.custom,this.callback=e,this.isParent=!1,this.duration=0}}class s extends i{constructor(e,n){super(n),this.type=t.wait,this.duration=e,this.isParent=!1}}class l extends i{constructor(e,n,i){super(i),this.type=t.move,this.dx=0,this.dy=0,this.duration=n,this.point=e,this.isParent=!1}}class c extends i{constructor(e,n,i=!1){super(i),this.type=t.scale,this.delta=0,this.duration=n,this.scale=e,this.isParent=!1}}
|
|
2
2
|
/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -13,5 +13,5 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
15
|
***************************************************************************** */
|
|
16
|
-
function u(t,e,n,r){return new(n||(n=Promise))((function(i,a){function o(t){try{l(r.next(t))}catch(t){a(t)}}function s(t){try{l(r.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}l((r=r.apply(t,e||[])).next())}))}!function(t){t.game="Game",t.survey="Survey"}(e||(e={})),function(t){t.activityData="ActivityData",t.activityLifecycle="ActivityLifecycle",t.sessionLifecycle="SessionLifecycle"}(n||(n={}));class h{constructor(){this.now=NaN,this.deltaTime=NaN,this.canvasScale=NaN,this.rootScale=1,this.canvasCssWidth=NaN,this.canvasCssHeight=NaN}}globalThis.Globals=new h;class d{constructor(t,e,n,r){this.name=t,this.image=e,this.width=n,this.height=r}}class f{constructor(t,e,n,r){this.name=t,this.dataUrlImage=e,this.width=n,this.height=r}}class p{}class g{}class m{constructor(){this.renderedImages=new p,this.loadedImages=new g}getLoadedImage(t,e){return this.loadedImages[t][e]}addLoadedImage(t,e){this.loadedImages[e]||(this.loadedImages[e]={}),this.loadedImages[e][t.name]=t}renderImages(t){const e=new Array;return t.forEach((t=>{if(t.images){const n=(t=>t.filter(((e,n)=>t.indexOf(e)!=n)))(t.images.map((t=>t.name)));if(n.length>0)throw new Error("image names must be unique. these image names are duplicated within a game: "+n.join(", "));t.images.map((n=>{e.push(this.renderBrowserImage(t.uuid,n))}))}})),Promise.all(e)}loadAllGamesRenderedImages(){Object.keys(this.renderedImages).forEach((t=>{Object.keys(this.renderedImages[t]).forEach((e=>{const n=this.convertRenderedDataUrlImageToCanvasKitImage(this.renderedImages[t][e]);this.loadedImages[t]||(this.loadedImages[t]={}),this.addLoadedImage(n,t)}))}))}renderBrowserImage(t,e){const n=document.createElement("img"),r=()=>{if(!this.scratchCanvas||!this.ctx||!this.scale)throw new Error("image manager not set up");this.scratchCanvas.width=e.width*this.scale,this.scratchCanvas.height=e.height*this.scale,this.ctx.scale(this.scale,this.scale),this.ctx.clearRect(0,0,e.width,e.height),this.ctx.drawImage(n,0,0,e.width,e.height);const r=this.scratchCanvas.toDataURL(),i=new f(e.name,r,e.width,e.height);n.remove(),this.renderedImages[t]||(this.renderedImages[t]={}),this.renderedImages[t][e.name]=i},i=()=>{let n="";e.svgString?n=" image source was svgString":e.url&&(n=` image source was url ${e.url}`),console.warn(`unable to render image named ${e.name}.${n}`);const r=new f(e.name,"",0,0);this.renderedImages[t]||(this.renderedImages[t]={}),this.renderedImages[t][e.name]=r};return new Promise((t=>{if(n.width=e.width,n.height=e.height,n.crossOrigin="Anonymous",n.onload=()=>{let i=!1;if((n.src.startsWith("data:image/svg+xml")||n.src.toLowerCase().endsWith("svg"))&&(i=!0),!i||0!==n.naturalHeight&&0!==n.naturalWidth)0!==n.naturalHeight&&0!==n.naturalWidth||console.warn(`image named ${e.name} has naturalHeight 0 and/or naturalWidth 0. This may cause inaccurate rendering. Please check the image.`),r(),t();else{let i;i=n.src.startsWith("data:image/svg+xml")?"svg string":n.src,console.warn(`svg image named ${e.name} loaded from ${i} has naturalHeight 0 and/or naturalWidth 0. This is probably because the svg is missing height and width attributes. This will cause the svg not to render on Firefox, due to issue described at https://bugzilla.mozilla.org/show_bug.cgi?id=700533. m2c2kit will attempt to infer the height and width from the svg viewBox, but it is strongly recommended that all svg images have height and width attributes.`);const a=i=>{const a=()=>{console.warn(`svg image named ${e.name} has missing or invalid viewBox; unable to render.`),r(),t()};if(i.hasAttribute("viewBox")){const e=i.getAttribute("viewBox");if(e){const o=e.split(" ");4===o.length?(i.setAttribute("width",o[2]),i.setAttribute("height",o[3]),n.onload=()=>{r(),t()},n.src="data:image/svg+xml,"+encodeURIComponent(i.outerHTML)):a()}else a()}else a()};if(e.svgString){const t=(new DOMParser).parseFromString(e.svgString,"text/xml").documentElement;a(t)}else e.url?fetch(e.url).then((t=>t.text())).then((t=>{const e=(new DOMParser).parseFromString(t,"text/xml").documentElement;a(e)})):(console.warn(`unable to render svg image named ${e.name}.`),r(),t())}},n.onerror=()=>{i(),t()},e.svgString&&e.url)throw new Error(`provide svgString or url. both were provided for image named ${e.name}`);if(e.svgString)n.src="data:image/svg+xml,"+encodeURIComponent(e.svgString);else{if(!e.url)throw new Error(`no svgString or url provided for image named ${e.name}`);n.src=e.url}}))}convertRenderedDataUrlImageToCanvasKitImage(t){if(!this.canvasKit)throw new Error("canvasKit undefined");let e=null;try{e=this.canvasKit.MakeImageFromEncoded(this.dataURLtoArrayBuffer(t.dataUrlImage))}catch(e){throw new Error(`could not create image with name "${t.name}."`)}if(null===e)throw new Error(`could not create image with name "${t.name}."`);const n=new d(t.name,e,t.width,t.height);return console.log(`image loaded. name: ${t.name}, w: ${t.width}, h: ${t.height}`),n}get scratchCanvas(){if(!this._scratchCanvas){this._scratchCanvas=document.createElement("canvas"),this._scratchCanvas.id="m2c2kitscratchcanvas",this._scratchCanvas.hidden=!0,document.body.appendChild(this._scratchCanvas);const t=this._scratchCanvas.getContext("2d");if(null===t)throw new Error("could not get 2d canvas context from scratch canvas");this.ctx=t,this.scale=window.devicePixelRatio}return this._scratchCanvas}dataURLtoArrayBuffer(t){const e=t.split(","),n=atob(e[1]);let r=n.length;const i=new Uint8Array(r);for(;r--;)i[r]=n.charCodeAt(r);return i.buffer}}function y(t,e){return function(t,e){for(var n=function(t){return S(t,4)}(t),r={tag:"",checksum:"",contents:"",length:""},i=0;i<n;++i){var a=12+16*i,o=C(t.buffer.slice(a,a+4));if(o===e)return r.tag=o,r.checksum=A(t,a+4),r.contents=A(t,a+8),r.length=A(t,a+24),r}return r}(t,e).contents}const v={meta:{property:[],description:[],license:[],reference:[]},tables:{name:{},post:{},os2:{version:"",weightClass:""}}};function w(t){return 2147483648&t&&(t=-(1+~t)),t/65536}function b(t,e){return t.getInt16(e)}function S(t,e){return t.getUint16(e)}function A(t,e){return t.getUint32(e)}function C(t){return new TextDecoder("utf-8").decode(new Uint8Array(t))}function T(t){return v.tables.name=function(t){for(var e=y(t,"name"),n=S(t,e+4),r=S(t,e+2),i=n+e,a={},o=0;o<r;o++){var s=e+6+12*o,l=S(t,s+6),c=S(t,s+8),u=S(t,s+10);a.hasOwnProperty(l)||(a[l]=C(t.buffer.slice(i+u,i+u+c)))}return a}(t),v.tables.post=function(t){var e=y(t,"post");return{format:w(A(t,e+0)),italicAngle:w(A(t,e+4)),underlinePosition:b(t,e+12),underlineThickness:b(t,e+14),isFixedPitch:A(t,e+16),minMemType42:A(t,e+7),maxMemType42:A(t,e+9),minMemType1:A(t,e+11),maxMemType1:A(t,e+13)}}(t),v.tables.os2=function(t){var e=y(t,"OS/2");return{version:S(t,e+0),weightClass:S(t,e+4)}}(t),v.meta=function(t){var e={property:[],description:[],license:[],reference:[]};for(const s in t)if(t.hasOwnProperty(s)){const l=parseInt(s);var n=l;const c=t[l].trim();if((o=c.replace("~\r\n?~","\n").split("\n").map((t=>t.trim())).filter((t=>t))).length>1){var r=10==l?"description":"license";e[r]=[];for(const t in o)if(o.hasOwnProperty(t)){var i=o[t].trim();e[r].push({name:x(i),text:i})}}else if(c){if(/^s?https?:\/\/[-_.!~*'()a-zA-Z0-9;\/?:\@&=+\$,%#]+$/.test(c))e.reference.findIndex((t=>t.text==c))<0&&e.reference.push({name:"url",text:c});else if(l>0&&l<6){var a=P[n].replace(" ","-").toLowerCase();e.property.push({name:a,text:c})}else if(P.hasOwnProperty(l))if(0==l||7==l){var o=c.replace(/---+/,"\n").split("\n").map((t=>t.trim())).filter((t=>t));for(const t in o)if(o.hasOwnProperty(t)){i=o[t].trim();e.description.push({name:x(i),text:i})}}else if(13==l)e.license.push({name:x(c),text:c});else{a=P[n].replace(" ","-").toLowerCase();e.property.push({name:a,text:c})}}}return e}(v.tables.name),v}function _(t){try{return T(t),v}catch(t){throw"error processing ttf"}}const P={0:"Copyright",1:"Font Family",2:"Font Subfamily",3:"Unique identifier",4:"Full name",5:"Version",6:"Postscript name",7:"Note",8:"Company",9:"Author",10:"Description",11:"URL",12:"URL",13:"License",14:"URL",16:"Name"},x=(t="")=>/^[^a-z]*$/.test(t)?t.split(" ").length>4?"paragraph":"title":"paragraph";class M{}class F{constructor(){this.gameTypefaces=new M}getTypeface(t,e){return this.gameTypefaces[t][e]}fetchFonts(t){const e=new Array;return t.forEach((t=>{const n=this.fetchGameFontsAsArrayBuffers(t.uuid,t.fontUrls);e.push(n)})),Promise.all(e).then((t=>{this.allGamesFontData=t.flat()}))}loadAllGamesFontData(){if(!this.allGamesFontData)throw new Error("allGamesFontData is undefined");Array.from(new Set(this.allGamesFontData.map((t=>t.gameUuid)))).forEach((t=>{if(!this.allGamesFontData)throw new Error("allGamesFontData is undefined");const e=this.allGamesFontData.filter((e=>e.gameUuid===t)).map((t=>t.fontArrayBuffer));this.loadGameFonts(t,e)}))}fetchGameFontsAsArrayBuffers(t,e){const n=e.map((e=>fetch(e).then((t=>t.arrayBuffer())).then((n=>({gameUuid:t,fontUrl:e,fontArrayBuffer:n})))));return Promise.all(n)}loadGameFonts(t,e){var n;if(!this.canvasKit)throw new Error("canvasKit undefined");if(this.fontMgr=null!==(n=this.canvasKit.FontMgr.FromData(...e))&&void 0!==n?n:void 0,!this.fontMgr)throw new Error("error creating FontMgr while loading fonts");e.forEach((e=>{var n;const r=null===(n=_(new DataView(e)).meta.property.filter((t=>"font-family"===t.name)).find(Boolean))||void 0===n?void 0:n.text;if(void 0===r)throw new Error("error loading fonts. could not get font-family from font array buffer");if(console.log("font loaded. font family: "+r),!this.canvasKit)throw new Error("canvasKit undefined");const i=this.canvasKit.Typeface.MakeFreeTypeFaceFromData(e);if(!i)throw new Error("cannot make typeface from font array buffer");this.gameTypefaces[t]||(this.gameTypefaces[t]={}),this.gameTypefaces[t][r]=i}))}}var E="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function k(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})})),e}var O={exports:{}};var R=k(Object.freeze({__proto__:null,path_empty_shim:function(){}}));var B=k(Object.freeze({__proto__:null,fs_empty_shim:function(){}}));!function(t,e){var n,r=(n="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,"undefined"!=typeof __filename&&(n=n||__filename),function(t){var e;t=t||{},e||(e=void 0!==t?t:{});var r,i,a,o=Object.assign;e.ready=new Promise((function(t,e){r=t,i=e})),(a=e).Vd=a.Vd||[],a.Vd.push((function(){a.MakeSWCanvasSurface=function(t){var e=t;if("CANVAS"!==e.tagName&&!(e=document.getElementById(t)))throw"Canvas with id "+t+" was not found";return(t=a.MakeSurface(e.width,e.height))&&(t.Nd=e),t},a.MakeCanvasSurface||(a.MakeCanvasSurface=a.MakeSWCanvasSurface),a.MakeSurface=function(t,e){var n={width:t,height:e,colorType:a.ColorType.RGBA_8888,alphaType:a.AlphaType.Unpremul,colorSpace:a.ColorSpace.SRGB},r=t*e*4,i=a._malloc(r);return(n=a.Surface._makeRasterDirect(n,i,4*t))&&(n.Nd=null,n.Cf=t,n.zf=e,n.Bf=r,n.bf=i,n.getCanvas().clear(a.TRANSPARENT)),n},a.MakeRasterDirectSurface=function(t,e,n){return a.Surface._makeRasterDirect(t,e.byteOffset,n)},a.Surface.prototype.flush=function(t){if(a.Od(this.Md),this._flush(),this.Nd){var e=new Uint8ClampedArray(a.HEAPU8.buffer,this.bf,this.Bf);e=new ImageData(e,this.Cf,this.zf),t?this.Nd.getContext("2d").putImageData(e,0,0,t[0],t[1],t[2]-t[0],t[3]-t[1]):this.Nd.getContext("2d").putImageData(e,0,0)}},a.Surface.prototype.dispose=function(){this.bf&&a._free(this.bf),this.delete()},a.Od=a.Od||function(){}})),function(t){t.Vd=t.Vd||[],t.Vd.push((function(){function e(t,e,n){return t&&t.hasOwnProperty(e)?t[e]:n}function n(t){var e=Ue(ke);return ke[e]=t,e}function r(t){return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}function i(t){return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}t.GetWebGLContext=function(t,n){if(!t)throw"null canvas passed into makeWebGLContext";var r={alpha:e(n,"alpha",1),depth:e(n,"depth",1),stencil:e(n,"stencil",8),antialias:e(n,"antialias",0),premultipliedAlpha:e(n,"premultipliedAlpha",1),preserveDrawingBuffer:e(n,"preserveDrawingBuffer",0),preferLowPowerToHighPerformance:e(n,"preferLowPowerToHighPerformance",0),failIfMajorPerformanceCaveat:e(n,"failIfMajorPerformanceCaveat",0),enableExtensionsByDefault:e(n,"enableExtensionsByDefault",1),explicitSwapControl:e(n,"explicitSwapControl",0),renderViaOffscreenBackBuffer:e(n,"renderViaOffscreenBackBuffer",0)};if(r.majorVersion=n&&n.majorVersion?n.majorVersion:"undefined"!=typeof WebGL2RenderingContext?2:1,r.explicitSwapControl)throw"explicitSwapControl is not supported";return t=function(t,e){t.sf||(t.sf=t.getContext,t.getContext=function(e,n){return"webgl"==e==(n=t.sf(e,n))instanceof WebGLRenderingContext?n:null});var n=1<e.majorVersion?t.getContext("webgl2",e):t.getContext("webgl",e);return n?function(t,e){var n=Ue(Be),r={Vf:n,attributes:e,version:e.majorVersion,je:t};return t.canvas&&(t.canvas.yf=r),Be[n]=r,(void 0===e.Kf||e.Kf)&&function(t){if(t||(t=ze),!t.Yf){t.Yf=!0;var e=t.je;!function(t){var e=t.getExtension("ANGLE_instanced_arrays");e&&(t.vertexAttribDivisor=function(t,n){e.vertexAttribDivisorANGLE(t,n)},t.drawArraysInstanced=function(t,n,r,i){e.drawArraysInstancedANGLE(t,n,r,i)},t.drawElementsInstanced=function(t,n,r,i,a){e.drawElementsInstancedANGLE(t,n,r,i,a)})}(e),function(t){var e=t.getExtension("OES_vertex_array_object");e&&(t.createVertexArray=function(){return e.createVertexArrayOES()},t.deleteVertexArray=function(t){e.deleteVertexArrayOES(t)},t.bindVertexArray=function(t){e.bindVertexArrayOES(t)},t.isVertexArray=function(t){return e.isVertexArrayOES(t)})}(e),function(t){var e=t.getExtension("WEBGL_draw_buffers");e&&(t.drawBuffers=function(t,n){e.drawBuffersWEBGL(t,n)})}(e),e.pf=e.getExtension("WEBGL_draw_instanced_base_vertex_base_instance"),e.uf=e.getExtension("WEBGL_multi_draw_instanced_base_vertex_base_instance"),2<=t.version&&(e.qf=e.getExtension("EXT_disjoint_timer_query_webgl2")),(2>t.version||!e.qf)&&(e.qf=e.getExtension("EXT_disjoint_timer_query")),e.Eg=e.getExtension("WEBGL_multi_draw"),(e.getSupportedExtensions()||[]).forEach((function(t){t.includes("lose_context")||t.includes("debug")||e.getExtension(t)}))}}(r),n}(n,e):0}(t,r),t?(Ne(t),t):0},t.deleteContext=function(t){ze===Be[t]&&(ze=null),"object"==typeof JSEvents&&JSEvents.Hg(Be[t].je.canvas),Be[t]&&Be[t].je.canvas&&(Be[t].je.canvas.yf=void 0),Be[t]=null},t._setTextureCleanup({deleteTexture:function(t,e){var n=ke[e];n&&Be[t].je.deleteTexture(n),ke[e]=null}}),t.MakeGrContext=function(t){if(!this.Od(t))return null;var e=this._MakeGrContext();return e?(e.Md=t,e):null},t.MakeOnScreenGLSurface=function(t,e,n,r){return this.Od(t.Md)&&(e=this._MakeOnScreenGLSurface(t,e,n,r))?(e.Md=t.Md,e):null},t.MakeRenderTarget=function(){var t=arguments[0];if(!this.Od(t.Md))return null;if(3===arguments.length){var e=this._MakeRenderTargetWH(t,arguments[1],arguments[2]);if(!e)return null}else{if(2!==arguments.length)return null;if(!(e=this._MakeRenderTargetII(t,arguments[1])))return null}return e.Md=t.Md,e},t.MakeWebGLCanvasSurface=function(e,n,r){n=n||null;var i=e,a="undefined"!=typeof OffscreenCanvas&&i instanceof OffscreenCanvas;if(!("undefined"!=typeof HTMLCanvasElement&&i instanceof HTMLCanvasElement||a||(i=document.getElementById(e),i)))throw"Canvas with id "+e+" was not found";if(!(e=this.GetWebGLContext(i,r))||0>e)throw"failed to create webgl context: err "+e;return e=this.MakeGrContext(e),(n=this.MakeOnScreenGLSurface(e,i.width,i.height,n))||(n=i.cloneNode(!0),i.parentNode.replaceChild(n,i),n.classList.add("ck-replaced"),t.MakeSWCanvasSurface(n))},t.MakeCanvasSurface=t.MakeWebGLCanvasSurface,t.Surface.prototype.makeImageFromTexture=function(e,r){return t.Od(this.Md),e=n(e),(r=this._makeImageFromTexture(this.Md,e,r))&&(r.Ke=e),r},t.Surface.prototype.makeImageFromTextureSource=function(e,n){n||(n={height:r(e),width:i(e),colorType:t.ColorType.RGBA_8888,alphaType:t.AlphaType.Unpremul}),n.colorSpace||(n.colorSpace=t.ColorSpace.SRGB),t.Od(this.Md);var a=ze.je,o=a.createTexture();return a.bindTexture(a.TEXTURE_2D,o),2===ze.version?a.texImage2D(a.TEXTURE_2D,0,a.RGBA,n.width,n.height,0,a.RGBA,a.UNSIGNED_BYTE,e):a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,e),a.bindTexture(a.TEXTURE_2D,null),this.makeImageFromTexture(o,n)},t.Surface.prototype.updateTextureFromSource=function(e,a){if(e.Ke){t.Od(this.Md);var o=ze.je,s=ke[e.Ke];o.bindTexture(o.TEXTURE_2D,s),2===ze.version?o.texImage2D(o.TEXTURE_2D,0,o.RGBA,i(a),r(a),0,o.RGBA,o.UNSIGNED_BYTE,a):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,a),o.bindTexture(o.TEXTURE_2D,null),this._resetContext(),ke[e.Ke]=null,e.Ke=n(s),(a=e.getImageInfo()).colorSpace=e.getColorSpace(),o=this._makeImageFromTexture(this.Md,e.Ke,a),s=e.Ld.Qd;var l=e.Ld.$d;e.Ld.Qd=o.Ld.Qd,e.Ld.$d=o.Ld.$d,o.Ld.Qd=s,o.Ld.$d=l,o.delete(),a.colorSpace.delete()}},t.MakeLazyImageFromTextureSource=function(e,a){a||(a={height:r(e),width:i(e),colorType:t.ColorType.RGBA_8888,alphaType:t.AlphaType.Unpremul}),a.colorSpace||(a.colorSpace=t.ColorSpace.SRGB);var o={makeTexture:function(){var t=ze,r=t.je,i=r.createTexture();return r.bindTexture(r.TEXTURE_2D,i),2===t.version?r.texImage2D(r.TEXTURE_2D,0,r.RGBA,a.width,a.height,0,r.RGBA,r.UNSIGNED_BYTE,e):r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,e),r.bindTexture(r.TEXTURE_2D,null),n(i)},freeSrc:function(){}};return"VideoFrame"===e.constructor.name&&(o.freeSrc=function(){e.close()}),t.Image._makeFromGenerator(a,o)},t.Od=function(t){return!!t&&Ne(t)}}))}(e),function(t){function n(t,e,n,r,i){for(var a=0;a<t.length;a++)e[a*n+(a*i+r+n)%n]=t[a];return e}function r(t){for(var e=t*t,n=Array(e);e--;)n[e]=0==e%(t+1)?1:0;return n}function i(t){return!!t&&t.constructor===Float32Array&&4===t.length}function a(t){return(l(255*t[3])<<24|l(255*t[0])<<16|l(255*t[1])<<8|l(255*t[2])<<0)>>>0}function o(t){if(t&&t._ck)return t;if(t instanceof Float32Array){for(var e=Math.floor(t.length/4),n=new Uint32Array(e),r=0;r<e;r++)n[r]=a(t.slice(4*r,4*(r+1)));return n}return t instanceof Uint32Array?t:t instanceof Array&&t[0]instanceof Float32Array?t.map(a):void 0}function s(t){if(void 0===t)return 1;var e=parseFloat(t);return t&&-1!==t.indexOf("%")?e/100:e}function l(t){return Math.round(Math.max(0,Math.min(t||0,255)))}function c(e,n){n&&n._ck||t._free(e)}function u(e,n,r){if(!e||!e.length)return $;if(e&&e._ck)return e.byteOffset;var i=t[n].BYTES_PER_ELEMENT;return r||(r=t._malloc(e.length*i)),t[n].set(e,r/i),r}function h(e){var n={de:$,count:e.length,Le:t.ColorType.RGBA_F32};if(e instanceof Float32Array)n.de=u(e,"HEAPF32"),n.count=e.length/4;else if(e instanceof Uint32Array)n.de=u(e,"HEAPU32"),n.Le=t.ColorType.RGBA_8888;else{if(!(e instanceof Array))throw"Invalid argument to copyFlexibleColorArray, Not a color array "+typeof e;if(e&&e.length){for(var r=t._malloc(16*e.length),i=0,a=r/4,o=0;o<e.length;o++)for(var s=0;4>s;s++)t.HEAPF32[a+i]=e[o][s],i++;e=r}else e=$;n.de=e}return n}function d(e){if(!e)return $;if(e.length){if(6===e.length||9===e.length)return u(e,"HEAPF32",R),6===e.length&&t.HEAPF32.set(H,6+R/4),R;if(16===e.length){var n=S.toTypedArray();return n[0]=e[0],n[1]=e[1],n[2]=e[3],n[3]=e[4],n[4]=e[5],n[5]=e[7],n[6]=e[12],n[7]=e[13],n[8]=e[15],R}throw"invalid matrix size"}return(n=S.toTypedArray())[0]=e.m11,n[1]=e.m21,n[2]=e.m41,n[3]=e.m12,n[4]=e.m22,n[5]=e.m42,n[6]=e.m14,n[7]=e.m24,n[8]=e.m44,R}function f(t,e){return u(t,"HEAPF32",e||I)}function p(t,e,n,r){var i=C.toTypedArray();return i[0]=t,i[1]=e,i[2]=n,i[3]=r,I}function g(e){for(var n=new Float32Array(4),r=0;4>r;r++)n[r]=t.HEAPF32[e/4+r];return n}function m(t,e){return u(t,"HEAPF32",e||L)}function y(t,e){return u(t,"HEAPF32",e||N)}function v(){for(var t=0,e=0;e<arguments.length-1;e+=2)t+=arguments[e]*arguments[e+1];return t}function w(t,e,n){for(var r=Array(t.length),i=0;i<n;i++)for(var a=0;a<n;a++){for(var o=0,s=0;s<n;s++)o+=t[n*i+s]*e[n*s+a];r[i*n+a]=o}return r}function b(t,e){for(var n=w(e[0],e[1],t),r=2;r<e.length;)n=w(n,e[r],t),r++;return n}t.Color=function(e,n,r,i){return void 0===i&&(i=1),t.Color4f(l(e)/255,l(n)/255,l(r)/255,i)},t.ColorAsInt=function(t,e,n,r){return void 0===r&&(r=255),(l(r)<<24|l(t)<<16|l(e)<<8|l(n)<<0&268435455)>>>0},t.Color4f=function(t,e,n,r){return void 0===r&&(r=1),Float32Array.of(t,e,n,r)},Object.defineProperty(t,"TRANSPARENT",{get:function(){return t.Color4f(0,0,0,0)}}),Object.defineProperty(t,"BLACK",{get:function(){return t.Color4f(0,0,0,1)}}),Object.defineProperty(t,"WHITE",{get:function(){return t.Color4f(1,1,1,1)}}),Object.defineProperty(t,"RED",{get:function(){return t.Color4f(1,0,0,1)}}),Object.defineProperty(t,"GREEN",{get:function(){return t.Color4f(0,1,0,1)}}),Object.defineProperty(t,"BLUE",{get:function(){return t.Color4f(0,0,1,1)}}),Object.defineProperty(t,"YELLOW",{get:function(){return t.Color4f(1,1,0,1)}}),Object.defineProperty(t,"CYAN",{get:function(){return t.Color4f(0,1,1,1)}}),Object.defineProperty(t,"MAGENTA",{get:function(){return t.Color4f(1,0,1,1)}}),t.getColorComponents=function(t){return[Math.floor(255*t[0]),Math.floor(255*t[1]),Math.floor(255*t[2]),t[3]]},t.parseColorString=function(e,n){if((e=e.toLowerCase()).startsWith("#")){switch(n=255,e.length){case 9:n=parseInt(e.slice(7,9),16);case 7:var r=parseInt(e.slice(1,3),16),i=parseInt(e.slice(3,5),16),a=parseInt(e.slice(5,7),16);break;case 5:n=17*parseInt(e.slice(4,5),16);case 4:r=17*parseInt(e.slice(1,2),16),i=17*parseInt(e.slice(2,3),16),a=17*parseInt(e.slice(3,4),16)}return t.Color(r,i,a,n/255)}return e.startsWith("rgba")?(e=(e=e.slice(5,-1)).split(","),t.Color(+e[0],+e[1],+e[2],s(e[3]))):e.startsWith("rgb")?(e=(e=e.slice(4,-1)).split(","),t.Color(+e[0],+e[1],+e[2],s(e[3]))):e.startsWith("gray(")||e.startsWith("hsl")||!n||void 0===(e=n[e])?t.BLACK:e},t.multiplyByAlpha=function(t,e){return(t=t.slice())[3]=Math.max(0,Math.min(t[3]*e,1)),t},t.Malloc=function(e,n){var r=t._malloc(n*e.BYTES_PER_ELEMENT);return{_ck:!0,length:n,byteOffset:r,pe:null,subarray:function(t,e){return(t=this.toTypedArray().subarray(t,e))._ck=!0,t},toTypedArray:function(){return this.pe&&this.pe.length||(this.pe=new e(t.HEAPU8.buffer,r,n),this.pe._ck=!0),this.pe}}},t.Free=function(e){t._free(e.byteOffset),e.byteOffset=$,e.toTypedArray=null,e.pe=null};var S,A,C,T,_,P,x,M,F,E,R=$,B=$,I=$,L=$,G=$,j=$,W=$,U=$,N=$,z=$,H=Float32Array.of(0,0,1),$=0;t.onRuntimeInitialized=function(){function e(e,n,r,i,a,o){o||(o=4*i.width,i.colorType===t.ColorType.RGBA_F16?o*=2:i.colorType===t.ColorType.RGBA_F32&&(o*=4));var s=o*i.height,l=a?a.byteOffset:t._malloc(s);if(!e._readPixels(i,l,o,n,r))return a||t._free(l),null;if(a)return a.toTypedArray();switch(i.colorType){case t.ColorType.RGBA_8888:case t.ColorType.RGBA_F16:e=new Uint8Array(t.HEAPU8.buffer,l,s).slice();break;case t.ColorType.RGBA_F32:e=new Float32Array(t.HEAPU8.buffer,l,s).slice();break;default:return null}return t._free(l),e}C=t.Malloc(Float32Array,4),I=C.byteOffset,A=t.Malloc(Float32Array,16),B=A.byteOffset,S=t.Malloc(Float32Array,9),R=S.byteOffset,F=t.Malloc(Float32Array,12),N=F.byteOffset,E=t.Malloc(Float32Array,12),z=E.byteOffset,T=t.Malloc(Float32Array,4),L=T.byteOffset,_=t.Malloc(Float32Array,4),G=_.byteOffset,P=t.Malloc(Float32Array,3),j=P.byteOffset,x=t.Malloc(Float32Array,3),W=x.byteOffset,M=t.Malloc(Int32Array,4),U=M.byteOffset,t.ColorSpace.SRGB=t.ColorSpace._MakeSRGB(),t.ColorSpace.DISPLAY_P3=t.ColorSpace._MakeDisplayP3(),t.ColorSpace.ADOBE_RGB=t.ColorSpace._MakeAdobeRGB(),t.GlyphRunFlags={IsWhiteSpace:t._GlyphRunFlags_isWhiteSpace},t.Path.MakeFromCmds=function(e){var n=u(e,"HEAPF32"),r=t.Path._MakeFromCmds(n,e.length);return c(n,e),r},t.Path.MakeFromVerbsPointsWeights=function(e,n,r){var i=u(e,"HEAPU8"),a=u(n,"HEAPF32"),o=u(r,"HEAPF32"),s=t.Path._MakeFromVerbsPointsWeights(i,e.length,a,n.length,o,r&&r.length||0);return c(i,e),c(a,n),c(o,r),s},t.Path.prototype.addArc=function(t,e,n){return t=m(t),this._addArc(t,e,n),this},t.Path.prototype.addOval=function(t,e,n){return void 0===n&&(n=1),t=m(t),this._addOval(t,!!e,n),this},t.Path.prototype.addPath=function(){var t=Array.prototype.slice.call(arguments),e=t[0],n=!1;if("boolean"==typeof t[t.length-1]&&(n=t.pop()),1===t.length)this._addPath(e,1,0,0,0,1,0,0,0,1,n);else if(2===t.length)t=t[1],this._addPath(e,t[0],t[1],t[2],t[3],t[4],t[5],t[6]||0,t[7]||0,t[8]||1,n);else{if(7!==t.length&&10!==t.length)return null;this._addPath(e,t[1],t[2],t[3],t[4],t[5],t[6],t[7]||0,t[8]||0,t[9]||1,n)}return this},t.Path.prototype.addPoly=function(t,e){var n=u(t,"HEAPF32");return this._addPoly(n,t.length/2,e),c(n,t),this},t.Path.prototype.addRect=function(t,e){return t=m(t),this._addRect(t,!!e),this},t.Path.prototype.addRRect=function(t,e){return t=y(t),this._addRRect(t,!!e),this},t.Path.prototype.addVerbsPointsWeights=function(t,e,n){var r=u(t,"HEAPU8"),i=u(e,"HEAPF32"),a=u(n,"HEAPF32");this._addVerbsPointsWeights(r,t.length,i,e.length,a,n&&n.length||0),c(r,t),c(i,e),c(a,n)},t.Path.prototype.arc=function(e,n,r,i,a,o){return e=t.LTRBRect(e-r,n-r,e+r,n+r),a=(a-i)/Math.PI*180-360*!!o,(o=new t.Path).addArc(e,i/Math.PI*180,a),this.addPath(o,!0),o.delete(),this},t.Path.prototype.arcToOval=function(t,e,n,r){return t=m(t),this._arcToOval(t,e,n,r),this},t.Path.prototype.arcToRotated=function(t,e,n,r,i,a,o){return this._arcToRotated(t,e,n,!!r,!!i,a,o),this},t.Path.prototype.arcToTangent=function(t,e,n,r,i){return this._arcToTangent(t,e,n,r,i),this},t.Path.prototype.close=function(){return this._close(),this},t.Path.prototype.conicTo=function(t,e,n,r,i){return this._conicTo(t,e,n,r,i),this},t.Path.prototype.computeTightBounds=function(t){this._computeTightBounds(L);var e=T.toTypedArray();return t?(t.set(e),t):e.slice()},t.Path.prototype.cubicTo=function(t,e,n,r,i,a){return this._cubicTo(t,e,n,r,i,a),this},t.Path.prototype.dash=function(t,e,n){return this._dash(t,e,n)?this:null},t.Path.prototype.getBounds=function(t){this._getBounds(L);var e=T.toTypedArray();return t?(t.set(e),t):e.slice()},t.Path.prototype.lineTo=function(t,e){return this._lineTo(t,e),this},t.Path.prototype.moveTo=function(t,e){return this._moveTo(t,e),this},t.Path.prototype.offset=function(t,e){return this._transform(1,0,t,0,1,e,0,0,1),this},t.Path.prototype.quadTo=function(t,e,n,r){return this._quadTo(t,e,n,r),this},t.Path.prototype.rArcTo=function(t,e,n,r,i,a,o){return this._rArcTo(t,e,n,r,i,a,o),this},t.Path.prototype.rConicTo=function(t,e,n,r,i){return this._rConicTo(t,e,n,r,i),this},t.Path.prototype.rCubicTo=function(t,e,n,r,i,a){return this._rCubicTo(t,e,n,r,i,a),this},t.Path.prototype.rLineTo=function(t,e){return this._rLineTo(t,e),this},t.Path.prototype.rMoveTo=function(t,e){return this._rMoveTo(t,e),this},t.Path.prototype.rQuadTo=function(t,e,n,r){return this._rQuadTo(t,e,n,r),this},t.Path.prototype.stroke=function(e){return(e=e||{}).width=e.width||1,e.miter_limit=e.miter_limit||4,e.cap=e.cap||t.StrokeCap.Butt,e.join=e.join||t.StrokeJoin.Miter,e.precision=e.precision||1,this._stroke(e)?this:null},t.Path.prototype.transform=function(){if(1===arguments.length){var t=arguments[0];this._transform(t[0],t[1],t[2],t[3],t[4],t[5],t[6]||0,t[7]||0,t[8]||1)}else{if(6!==arguments.length&&9!==arguments.length)throw"transform expected to take 1 or 9 arguments. Got "+arguments.length;t=arguments,this._transform(t[0],t[1],t[2],t[3],t[4],t[5],t[6]||0,t[7]||0,t[8]||1)}return this},t.Path.prototype.trim=function(t,e,n){return this._trim(t,e,!!n)?this:null},t.Image.prototype.makeShaderCubic=function(t,e,n,r,i){return i=d(i),this._makeShaderCubic(t,e,n,r,i)},t.Image.prototype.makeShaderOptions=function(t,e,n,r,i){return i=d(i),this._makeShaderOptions(t,e,n,r,i)},t.Image.prototype.readPixels=function(t,n,r,i,a){return e(this,t,n,r,i,a)},t.Canvas.prototype.clear=function(e){t.Od(this.Md),e=f(e),this._clear(e)},t.Canvas.prototype.clipRRect=function(e,n,r){t.Od(this.Md),e=y(e),this._clipRRect(e,n,r)},t.Canvas.prototype.clipRect=function(e,n,r){t.Od(this.Md),e=m(e),this._clipRect(e,n,r)},t.Canvas.prototype.concat=function(e){t.Od(this.Md),e=function(t){if(!t)return $;var e=A.toTypedArray();if(t.length){if(16!==t.length&&6!==t.length&&9!==t.length)throw"invalid matrix size";return 16===t.length?u(t,"HEAPF32",B):(e.fill(0),e[0]=t[0],e[1]=t[1],e[3]=t[2],e[4]=t[3],e[5]=t[4],e[7]=t[5],e[12]=t[6],e[13]=t[7],e[15]=t[8],6===t.length&&(e[12]=0,e[13]=0,e[15]=1),B)}return e[0]=t.m11,e[1]=t.m21,e[2]=t.m31,e[3]=t.m41,e[4]=t.m12,e[5]=t.m22,e[6]=t.m32,e[7]=t.m42,e[8]=t.m13,e[9]=t.m23,e[10]=t.m33,e[11]=t.m43,e[12]=t.m14,e[13]=t.m24,e[14]=t.m34,e[15]=t.m44,B}(e),this._concat(e)},t.Canvas.prototype.drawArc=function(e,n,r,i,a){t.Od(this.Md),e=m(e),this._drawArc(e,n,r,i,a)},t.Canvas.prototype.drawAtlas=function(e,n,r,i,a,s,l){if(e&&i&&n&&r&&n.length===r.length){t.Od(this.Md),a||(a=t.BlendMode.SrcOver);var h=u(n,"HEAPF32"),d=u(r,"HEAPF32"),f=r.length/4,p=u(o(s),"HEAPU32");if(l&&"B"in l&&"C"in l)this._drawAtlasCubic(e,d,h,p,f,a,l.B,l.C,i);else{let n=t.FilterMode.Linear,r=t.MipmapMode.None;l&&(n=l.filter,"mipmap"in l&&(r=l.mipmap)),this._drawAtlasOptions(e,d,h,p,f,a,n,r,i)}c(h,n),c(d,r),c(p,s)}},t.Canvas.prototype.drawCircle=function(e,n,r,i){t.Od(this.Md),this._drawCircle(e,n,r,i)},t.Canvas.prototype.drawColor=function(e,n){t.Od(this.Md),e=f(e),void 0!==n?this._drawColor(e,n):this._drawColor(e)},t.Canvas.prototype.drawColorInt=function(e,n){t.Od(this.Md),this._drawColorInt(e,n||t.BlendMode.SrcOver)},t.Canvas.prototype.drawColorComponents=function(e,n,r,i,a){t.Od(this.Md),e=p(e,n,r,i),void 0!==a?this._drawColor(e,a):this._drawColor(e)},t.Canvas.prototype.drawDRRect=function(e,n,r){t.Od(this.Md),e=y(e,N),n=y(n,z),this._drawDRRect(e,n,r)},t.Canvas.prototype.drawGlyphs=function(e,n,r,i,a,o){if(!(2*e.length<=n.length))throw"Not enough positions for the array of gyphs";t.Od(this.Md);const s=u(e,"HEAPU16"),l=u(n,"HEAPF32");this._drawGlyphs(e.length,s,l,r,i,a,o),c(l,n),c(s,e)},t.Canvas.prototype.drawImage=function(e,n,r,i){t.Od(this.Md),this._drawImage(e,n,r,i||null)},t.Canvas.prototype.drawImageCubic=function(e,n,r,i,a,o){t.Od(this.Md),this._drawImageCubic(e,n,r,i,a,o||null)},t.Canvas.prototype.drawImageOptions=function(e,n,r,i,a,o){t.Od(this.Md),this._drawImageOptions(e,n,r,i,a,o||null)},t.Canvas.prototype.drawImageNine=function(e,n,r,i,a){t.Od(this.Md),n=u(n,"HEAP32",U),r=m(r),this._drawImageNine(e,n,r,i,a||null)},t.Canvas.prototype.drawImageRect=function(e,n,r,i,a){t.Od(this.Md),m(n,L),m(r,G),this._drawImageRect(e,L,G,i,!!a)},t.Canvas.prototype.drawImageRectCubic=function(e,n,r,i,a,o){t.Od(this.Md),m(n,L),m(r,G),this._drawImageRectCubic(e,L,G,i,a,o||null)},t.Canvas.prototype.drawImageRectOptions=function(e,n,r,i,a,o){t.Od(this.Md),m(n,L),m(r,G),this._drawImageRectOptions(e,L,G,i,a,o||null)},t.Canvas.prototype.drawLine=function(e,n,r,i,a){t.Od(this.Md),this._drawLine(e,n,r,i,a)},t.Canvas.prototype.drawOval=function(e,n){t.Od(this.Md),e=m(e),this._drawOval(e,n)},t.Canvas.prototype.drawPaint=function(e){t.Od(this.Md),this._drawPaint(e)},t.Canvas.prototype.drawParagraph=function(e,n,r){t.Od(this.Md),this._drawParagraph(e,n,r)},t.Canvas.prototype.drawPatch=function(e,n,r,i,a){if(24>e.length)throw"Need 12 cubic points";if(n&&4>n.length)throw"Need 4 colors";if(r&&8>r.length)throw"Need 4 shader coordinates";t.Od(this.Md);const s=u(e,"HEAPF32"),l=n?u(o(n),"HEAPU32"):$,h=r?u(r,"HEAPF32"):$;i||(i=t.BlendMode.Modulate),this._drawPatch(s,l,h,i,a),c(h,r),c(l,n),c(s,e)},t.Canvas.prototype.drawPath=function(e,n){t.Od(this.Md),this._drawPath(e,n)},t.Canvas.prototype.drawPicture=function(e){t.Od(this.Md),this._drawPicture(e)},t.Canvas.prototype.drawPoints=function(e,n,r){t.Od(this.Md);var i=u(n,"HEAPF32");this._drawPoints(e,i,n.length/2,r),c(i,n)},t.Canvas.prototype.drawRRect=function(e,n){t.Od(this.Md),e=y(e),this._drawRRect(e,n)},t.Canvas.prototype.drawRect=function(e,n){t.Od(this.Md),e=m(e),this._drawRect(e,n)},t.Canvas.prototype.drawRect4f=function(e,n,r,i,a){t.Od(this.Md),this._drawRect4f(e,n,r,i,a)},t.Canvas.prototype.drawShadow=function(e,n,r,i,a,o,s){t.Od(this.Md);var l=u(a,"HEAPF32"),h=u(o,"HEAPF32");n=u(n,"HEAPF32",j),r=u(r,"HEAPF32",W),this._drawShadow(e,n,r,i,l,h,s),c(l,a),c(h,o)},t.getShadowLocalBounds=function(t,e,n,r,i,a,o){return t=d(t),n=u(n,"HEAPF32",j),r=u(r,"HEAPF32",W),this._getShadowLocalBounds(t,e,n,r,i,a,L)?(e=T.toTypedArray(),o?(o.set(e),o):e.slice()):null},t.Canvas.prototype.drawTextBlob=function(e,n,r,i){t.Od(this.Md),this._drawTextBlob(e,n,r,i)},t.Canvas.prototype.drawVertices=function(e,n,r){t.Od(this.Md),this._drawVertices(e,n,r)},t.Canvas.prototype.getLocalToDevice=function(){this._getLocalToDevice(B);for(var e=B,n=Array(16),r=0;16>r;r++)n[r]=t.HEAPF32[e/4+r];return n},t.Canvas.prototype.getTotalMatrix=function(){this._getTotalMatrix(R);for(var e=Array(9),n=0;9>n;n++)e[n]=t.HEAPF32[R/4+n];return e},t.Canvas.prototype.makeSurface=function(t){return(t=this._makeSurface(t)).Md=this.Md,t},t.Canvas.prototype.readPixels=function(n,r,i,a,o){return t.Od(this.Md),e(this,n,r,i,a,o)},t.Canvas.prototype.saveLayer=function(t,e,n,r){return e=m(e),this._saveLayer(t||null,e,n||null,r||0)},t.Canvas.prototype.writePixels=function(e,n,r,i,a,o,s,l){if(e.byteLength%(n*r))throw"pixels length must be a multiple of the srcWidth * srcHeight";t.Od(this.Md);var h=e.byteLength/(n*r);o=o||t.AlphaType.Unpremul,s=s||t.ColorType.RGBA_8888,l=l||t.ColorSpace.SRGB;var d=h*n;return h=u(e,"HEAPU8"),n=this._writePixels({width:n,height:r,colorType:s,alphaType:o,colorSpace:l},h,d,i,a),c(h,e),n},t.ColorFilter.MakeBlend=function(e,n){return e=f(e),t.ColorFilter._MakeBlend(e,n)},t.ColorFilter.MakeMatrix=function(e){if(!e||20!==e.length)throw"invalid color matrix";var n=u(e,"HEAPF32"),r=t.ColorFilter._makeMatrix(n);return c(n,e),r},t.ContourMeasure.prototype.getPosTan=function(t,e){return this._getPosTan(t,L),t=T.toTypedArray(),e?(e.set(t),e):t.slice()},t.ImageFilter.MakeMatrixTransform=function(e,n,r){if(e=d(e),"B"in n&&"C"in n)return t.ImageFilter._MakeMatrixTransformCubic(e,n.Ag,n.Bg,r);const i=n.filter;let a=t.MipmapMode.None;return"mipmap"in n&&(a=n.mipmap),t.ImageFilter._MakeMatrixTransformOptions(e,i,a,r)},t.Paint.prototype.getColor=function(){return this._getColor(I),g(I)},t.Paint.prototype.setColor=function(t,e){e=e||null,t=f(t),this._setColor(t,e)},t.Paint.prototype.setColorComponents=function(t,e,n,r,i){i=i||null,t=p(t,e,n,r),this._setColor(t,i)},t.Path.prototype.getPoint=function(t,e){return this._getPoint(t,L),t=T.toTypedArray(),e?(e[0]=t[0],e[1]=t[1],e):t.slice(0,2)},t.PictureRecorder.prototype.beginRecording=function(t){return t=m(t),this._beginRecording(t)},t.Surface.prototype.getCanvas=function(){var t=this._getCanvas();return t.Md=this.Md,t},t.Surface.prototype.makeImageSnapshot=function(e){return t.Od(this.Md),e=u(e,"HEAP32",U),this._makeImageSnapshot(e)},t.Surface.prototype.makeSurface=function(e){return t.Od(this.Md),(e=this._makeSurface(e)).Md=this.Md,e},t.Surface.prototype.requestAnimationFrame=function(e,n){this.Ge||(this.Ge=this.getCanvas()),requestAnimationFrame(function(){t.Od(this.Md),e(this.Ge),this.flush(n)}.bind(this))},t.Surface.prototype.drawOnce=function(e,n){this.Ge||(this.Ge=this.getCanvas()),requestAnimationFrame(function(){t.Od(this.Md),e(this.Ge),this.flush(n),this.dispose()}.bind(this))},t.PathEffect.MakeDash=function(e,n){if(n||(n=0),!e.length||1==e.length%2)throw"Intervals array must have even length";var r=u(e,"HEAPF32");return n=t.PathEffect._MakeDash(r,e.length,n),c(r,e),n},t.PathEffect.MakeLine2D=function(e,n){return n=d(n),t.PathEffect._MakeLine2D(e,n)},t.PathEffect.MakePath2D=function(e,n){return e=d(e),t.PathEffect._MakePath2D(e,n)},t.Shader.MakeColor=function(e,n){return n=n||null,e=f(e),t.Shader._MakeColor(e,n)},t.Shader.Blend=t.Shader.MakeBlend,t.Shader.Color=t.Shader.MakeColor,t.Shader.MakeLinearGradient=function(e,n,r,i,a,o,s,l){l=l||null;var f=h(r),p=u(i,"HEAPF32");s=s||0,o=d(o);var g=T.toTypedArray();return g.set(e),g.set(n,2),e=t.Shader._MakeLinearGradient(L,f.de,f.Le,p,f.count,a,s,o,l),c(f.de,r),i&&c(p,i),e},t.Shader.MakeRadialGradient=function(e,n,r,i,a,o,s,l){l=l||null;var f=h(r),p=u(i,"HEAPF32");return s=s||0,o=d(o),e=t.Shader._MakeRadialGradient(e[0],e[1],n,f.de,f.Le,p,f.count,a,s,o,l),c(f.de,r),i&&c(p,i),e},t.Shader.MakeSweepGradient=function(e,n,r,i,a,o,s,l,f,p){p=p||null;var g=h(r),m=u(i,"HEAPF32");return s=s||0,l=l||0,f=f||360,o=d(o),e=t.Shader._MakeSweepGradient(e,n,g.de,g.Le,m,g.count,a,l,f,s,o,p),c(g.de,r),i&&c(m,i),e},t.Shader.MakeTwoPointConicalGradient=function(e,n,r,i,a,o,s,l,f,p){p=p||null;var g=h(a),m=u(o,"HEAPF32");f=f||0,l=d(l);var y=T.toTypedArray();return y.set(e),y.set(r,2),e=t.Shader._MakeTwoPointConicalGradient(L,n,i,g.de,g.Le,m,g.count,s,f,l,p),c(g.de,a),o&&c(m,o),e},t.Vertices.prototype.bounds=function(t){this._bounds(L);var e=T.toTypedArray();return t?(t.set(e),t):e.slice()},t.Vd&&t.Vd.forEach((function(t){t()}))},t.computeTonalColors=function(t){var e=u(t.ambient,"HEAPF32"),n=u(t.spot,"HEAPF32");this._computeTonalColors(e,n);var r={ambient:g(e),spot:g(n)};return c(e,t.ambient),c(n,t.spot),r},t.LTRBRect=function(t,e,n,r){return Float32Array.of(t,e,n,r)},t.XYWHRect=function(t,e,n,r){return Float32Array.of(t,e,t+n,e+r)},t.LTRBiRect=function(t,e,n,r){return Int32Array.of(t,e,n,r)},t.XYWHiRect=function(t,e,n,r){return Int32Array.of(t,e,t+n,e+r)},t.RRectXY=function(t,e,n){return Float32Array.of(t[0],t[1],t[2],t[3],e,n,e,n,e,n,e,n)},t.MakeAnimatedImageFromEncoded=function(e){e=new Uint8Array(e);var n=t._malloc(e.byteLength);return t.HEAPU8.set(e,n),(e=t._decodeAnimatedImage(n,e.byteLength))?e:null},t.MakeImageFromEncoded=function(e){e=new Uint8Array(e);var n=t._malloc(e.byteLength);return t.HEAPU8.set(e,n),(e=t._decodeImage(n,e.byteLength))?e:null};var V=null;t.MakeImageFromCanvasImageSource=function(e){var n=e.width,r=e.height;V||(V=document.createElement("canvas")),V.width=n,V.height=r;var i=V.getContext("2d",{Jg:!0});return i.drawImage(e,0,0),e=i.getImageData(0,0,n,r),t.MakeImage({width:n,height:r,alphaType:t.AlphaType.Unpremul,colorType:t.ColorType.RGBA_8888,colorSpace:t.ColorSpace.SRGB},e.data,4*n)},t.MakeImage=function(e,n,r){var i=t._malloc(n.length);return t.HEAPU8.set(n,i),t._MakeImage(e,i,n.length,r)},t.MakeVertices=function(e,n,r,i,a,s){var l=a&&a.length||0,c=0;return r&&r.length&&(c|=1),i&&i.length&&(c|=2),void 0===s||s||(c|=4),u(n,"HEAPF32",(e=new t._VerticesBuilder(e,n.length/2,l,c)).positions()),e.texCoords()&&u(r,"HEAPF32",e.texCoords()),e.colors()&&u(o(i),"HEAPU32",e.colors()),e.indices()&&u(a,"HEAPU16",e.indices()),e.detach()},t.Matrix={},t.Matrix.identity=function(){return r(3)},t.Matrix.invert=function(t){var e=t[0]*t[4]*t[8]+t[1]*t[5]*t[6]+t[2]*t[3]*t[7]-t[2]*t[4]*t[6]-t[1]*t[3]*t[8]-t[0]*t[5]*t[7];return e?[(t[4]*t[8]-t[5]*t[7])/e,(t[2]*t[7]-t[1]*t[8])/e,(t[1]*t[5]-t[2]*t[4])/e,(t[5]*t[6]-t[3]*t[8])/e,(t[0]*t[8]-t[2]*t[6])/e,(t[2]*t[3]-t[0]*t[5])/e,(t[3]*t[7]-t[4]*t[6])/e,(t[1]*t[6]-t[0]*t[7])/e,(t[0]*t[4]-t[1]*t[3])/e]:null},t.Matrix.mapPoints=function(t,e){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1],a=t[6]*r+t[7]*i+t[8],o=t[3]*r+t[4]*i+t[5];e[n]=(t[0]*r+t[1]*i+t[2])/a,e[n+1]=o/a}return e},t.Matrix.multiply=function(){return b(3,arguments)},t.Matrix.rotated=function(t,e,n){e=e||0,n=n||0;var r=Math.sin(t);return[t=Math.cos(t),-r,v(r,n,1-t,e),r,t,v(-r,e,1-t,n),0,0,1]},t.Matrix.scaled=function(t,e,i,a){i=i||0,a=a||0;var o=n([t,e],r(3),3,0,1);return n([i-t*i,a-e*a],o,3,2,0)},t.Matrix.skewed=function(t,e,i,a){i=i||0,a=a||0;var o=n([t,e],r(3),3,1,-1);return n([-t*i,-e*a],o,3,2,0)},t.Matrix.translated=function(t,e){return n(arguments,r(3),3,2,0)},t.Vector={},t.Vector.dot=function(t,e){return t.map((function(t,n){return t*e[n]})).reduce((function(t,e){return t+e}))},t.Vector.lengthSquared=function(e){return t.Vector.dot(e,e)},t.Vector.length=function(e){return Math.sqrt(t.Vector.lengthSquared(e))},t.Vector.mulScalar=function(t,e){return t.map((function(t){return t*e}))},t.Vector.add=function(t,e){return t.map((function(t,n){return t+e[n]}))},t.Vector.sub=function(t,e){return t.map((function(t,n){return t-e[n]}))},t.Vector.dist=function(e,n){return t.Vector.length(t.Vector.sub(e,n))},t.Vector.normalize=function(e){return t.Vector.mulScalar(e,1/t.Vector.length(e))},t.Vector.cross=function(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]},t.M44={},t.M44.identity=function(){return r(4)},t.M44.translated=function(t){return n(t,r(4),4,3,0)},t.M44.scaled=function(t){return n(t,r(4),4,0,1)},t.M44.rotated=function(e,n){return t.M44.rotatedUnitSinCos(t.Vector.normalize(e),Math.sin(n),Math.cos(n))},t.M44.rotatedUnitSinCos=function(t,e,n){var r=t[0],i=t[1],a=1-n;return[a*r*r+n,a*r*i-e*(t=t[2]),a*r*t+e*i,0,a*r*i+e*t,a*i*i+n,a*i*t-e*r,0,a*r*t-e*i,a*i*t+e*r,a*t*t+n,0,0,0,0,1]},t.M44.lookat=function(e,r,i){r=t.Vector.normalize(t.Vector.sub(r,e)),i=t.Vector.normalize(i),i=t.Vector.normalize(t.Vector.cross(r,i));var a=t.M44.identity();return n(i,a,4,0,0),n(t.Vector.cross(i,r),a,4,1,0),n(t.Vector.mulScalar(r,-1),a,4,2,0),n(e,a,4,3,0),null===(e=t.M44.invert(a))?t.M44.identity():e},t.M44.perspective=function(t,e,n){var r=1/(e-t);return n/=2,[n=Math.cos(n)/Math.sin(n),0,0,0,0,n,0,0,0,0,(e+t)*r,2*e*t*r,0,0,-1,1]},t.M44.rc=function(t,e,n){return t[4*e+n]},t.M44.multiply=function(){return b(4,arguments)},t.M44.invert=function(t){var e=t[0],n=t[4],r=t[8],i=t[12],a=t[1],o=t[5],s=t[9],l=t[13],c=t[2],u=t[6],h=t[10],d=t[14],f=t[3],p=t[7],g=t[11],m=e*o-n*a,y=e*s-r*a,v=e*l-i*a,w=n*s-r*o,b=n*l-i*o,S=r*l-i*s,A=c*p-u*f,C=c*g-h*f,T=c*(t=t[15])-d*f,_=u*g-h*p,P=u*t-d*p,x=h*t-d*g,M=m*x-y*P+v*_+w*T-b*C+S*A,F=1/M;return 0===M||1/0===F?null:(e=[o*(x*=F)-s*(P*=F)+l*(_*=F),s*(T*=F)-a*x-l*(C*=F),a*P-o*T+l*(A*=F),o*C-a*_-s*A,r*P-n*x-i*_,e*x-r*T+i*C,n*T-e*P-i*A,e*_-n*C+r*A,p*(S*=F)-g*(b*=F)+t*(w*=F),g*(v*=F)-f*S-t*(y*=F),f*b-p*v+t*(m*=F),p*y-f*w-g*m,h*b-u*S-d*w,c*S-h*v+d*y,u*v-c*b-d*m,c*w-u*y+h*m]).every((function(t){return!isNaN(t)&&1/0!==t&&-1/0!==t}))?e:null},t.M44.transpose=function(t){return[t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]]},t.M44.mustInvert=function(e){if(null===(e=t.M44.invert(e)))throw"Matrix not invertible";return e},t.M44.setupCamera=function(e,n,r){var i=t.M44.lookat(r.eye,r.coa,r.up);return r=t.M44.perspective(r.near,r.far,r.angle),n=[(e[2]-e[0])/2,(e[3]-e[1])/2,n],e=t.M44.multiply(t.M44.translated([(e[0]+e[2])/2,(e[1]+e[3])/2,0]),t.M44.scaled(n)),t.M44.multiply(e,r,i,t.M44.mustInvert(e))},t.ColorMatrix={},t.ColorMatrix.identity=function(){var t=new Float32Array(20);return t[0]=1,t[6]=1,t[12]=1,t[18]=1,t},t.ColorMatrix.scaled=function(t,e,n,r){var i=new Float32Array(20);return i[0]=t,i[6]=e,i[12]=n,i[18]=r,i};var Y,q=[[6,7,11,12],[0,10,2,12],[0,1,5,6]];t.ColorMatrix.rotated=function(e,n,r){var i=t.ColorMatrix.identity();return i[(e=q[e])[0]]=r,i[e[1]]=n,i[e[2]]=-n,i[e[3]]=r,i},t.ColorMatrix.postTranslate=function(t,e,n,r,i){return t[4]+=e,t[9]+=n,t[14]+=r,t[19]+=i,t},t.ColorMatrix.concat=function(t,e){for(var n=new Float32Array(20),r=0,i=0;20>i;i+=5){for(var a=0;4>a;a++)n[r++]=t[i]*e[a]+t[i+1]*e[a+5]+t[i+2]*e[a+10]+t[i+3]*e[a+15];n[r++]=t[i]*e[4]+t[i+1]*e[9]+t[i+2]*e[14]+t[i+3]*e[19]+t[i+4]}return n},(Y=e).Vd=Y.Vd||[],Y.Vd.push((function(){function t(t){if(!t||!t.length)return[];for(var e=[],n=0;n<t.length;n+=5){var r=Y.LTRBRect(t[n],t[n+1],t[n+2],t[n+3]);r.direction=0===t[n+4]?Y.TextDirection.RTL:Y.TextDirection.LTR,e.push(r)}return Y._free(t.byteOffset),e}function e(t){return void 0===(t=t||{}).weight&&(t.weight=Y.FontWeight.Normal),t.width=t.width||Y.FontWidth.Normal,t.slant=t.slant||Y.FontSlant.Upright,t}function n(t){if(!t||!t.length)return $;for(var e=[],n=0;n<t.length;n++){var i=r(t[n]);e.push(i)}return u(e,"HEAPU32")}function r(t){if(o[t])return o[t];var e=O(t)+1,n=Y._malloc(e);return k(t,D,n,e),o[t]=n}function i(t){if(t._colorPtr=f(t.color),t._foregroundColorPtr=$,t._backgroundColorPtr=$,t._decorationColorPtr=$,t.foregroundColor&&(t._foregroundColorPtr=f(t.foregroundColor,s)),t.backgroundColor&&(t._backgroundColorPtr=f(t.backgroundColor,l)),t.decorationColor&&(t._decorationColorPtr=f(t.decorationColor,c)),Array.isArray(t.fontFamilies)&&t.fontFamilies.length?(t._fontFamiliesPtr=n(t.fontFamilies),t._fontFamiliesLen=t.fontFamilies.length):(t._fontFamiliesPtr=$,t._fontFamiliesLen=0),t.locale){var e=t.locale;t._localePtr=r(e),t._localeLen=O(e)+1}else t._localePtr=$,t._localeLen=0;if(Array.isArray(t.shadows)&&t.shadows.length){var i=(e=t.shadows).map((function(t){return t.color||Y.BLACK})),a=e.map((function(t){return t.blurRadius||0}));t._shadowLen=e.length;for(var o=Y._malloc(8*e.length),d=o/4,p=0;p<e.length;p++){var g=e[p].offset||[0,0];Y.HEAPF32[d]=g[0],Y.HEAPF32[d+1]=g[1],d+=2}t._shadowColorsPtr=h(i).de,t._shadowOffsetsPtr=o,t._shadowBlurRadiiPtr=u(a,"HEAPF32")}else t._shadowLen=0,t._shadowColorsPtr=$,t._shadowOffsetsPtr=$,t._shadowBlurRadiiPtr=$;Array.isArray(t.fontFeatures)&&t.fontFeatures.length?(i=(e=t.fontFeatures).map((function(t){return t.name})),a=e.map((function(t){return t.value})),t._fontFeatureLen=e.length,t._fontFeatureNamesPtr=n(i),t._fontFeatureValuesPtr=u(a,"HEAPU32")):(t._fontFeatureLen=0,t._fontFeatureNamesPtr=$,t._fontFeatureValuesPtr=$)}function a(t){Y._free(t._fontFamiliesPtr),Y._free(t._shadowColorsPtr),Y._free(t._shadowOffsetsPtr),Y._free(t._shadowBlurRadiiPtr),Y._free(t._fontFeatureNamesPtr),Y._free(t._fontFeatureValuesPtr)}Y.Paragraph.prototype.getRectsForRange=function(e,n,r,i){return t(e=this._getRectsForRange(e,n,r,i))},Y.Paragraph.prototype.getRectsForPlaceholders=function(){return t(this._getRectsForPlaceholders())},Y.TypefaceFontProvider.prototype.registerFont=function(t,e){if(!(t=Y.Typeface.MakeFreeTypeFaceFromData(t)))return null;e=r(e),this._registerFont(t,e)},Y.ParagraphStyle=function(t){if(t.disableHinting=t.disableHinting||!1,t.ellipsis){var i=t.ellipsis;t._ellipsisPtr=r(i),t._ellipsisLen=O(i)+1}else t._ellipsisPtr=$,t._ellipsisLen=0;return t.heightMultiplier=t.heightMultiplier||0,t.maxLines=t.maxLines||0,(i=(i=t.strutStyle)||{}).strutEnabled=i.strutEnabled||!1,i.strutEnabled&&Array.isArray(i.fontFamilies)&&i.fontFamilies.length?(i._fontFamiliesPtr=n(i.fontFamilies),i._fontFamiliesLen=i.fontFamilies.length):(i._fontFamiliesPtr=$,i._fontFamiliesLen=0),i.fontStyle=e(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,t.strutStyle=i,t.textAlign=t.textAlign||Y.TextAlign.Start,t.textDirection=t.textDirection||Y.TextDirection.LTR,t.textHeightBehavior=t.textHeightBehavior||Y.TextHeightBehavior.All,t.textStyle=Y.TextStyle(t.textStyle),t},Y.TextStyle=function(t){return t.color||(t.color=Y.BLACK),t.decoration=t.decoration||0,t.decorationThickness=t.decorationThickness||0,t.decorationStyle=t.decorationStyle||Y.DecorationStyle.Solid,t.textBaseline=t.textBaseline||Y.TextBaseline.Alphabetic,t.fontSize=t.fontSize||0,t.letterSpacing=t.letterSpacing||0,t.wordSpacing=t.wordSpacing||0,t.heightMultiplier=t.heightMultiplier||0,t.halfLeading=t.halfLeading||!1,t.fontStyle=e(t.fontStyle),t};var o={},s=Y._malloc(16),l=Y._malloc(16),c=Y._malloc(16);Y.ParagraphBuilder.Make=function(t,e){return i(t.textStyle),e=Y.ParagraphBuilder._Make(t,e),a(t.textStyle),e},Y.ParagraphBuilder.MakeFromFontProvider=function(t,e){return i(t.textStyle),e=Y.ParagraphBuilder._MakeFromFontProvider(t,e),a(t.textStyle),e},Y.ParagraphBuilder.ShapeText=function(t,e,n){let r=0;for(const t of e)r+=t.length;if(r!==t.length)throw"Accumulated block lengths must equal text.length";return Y.ParagraphBuilder._ShapeText(t,e,n)},Y.ParagraphBuilder.prototype.pushStyle=function(t){i(t),this._pushStyle(t),a(t)},Y.ParagraphBuilder.prototype.pushPaintStyle=function(t,e,n){i(t),this._pushPaintStyle(t,e,n),a(t)},Y.ParagraphBuilder.prototype.addPlaceholder=function(t,e,n,r,i){n=n||Y.PlaceholderAlignment.Baseline,r=r||Y.TextBaseline.Alphabetic,this._addPlaceholder(t||0,e||0,n,r,i||0)}})),t.Vd=t.Vd||[],t.Vd.push((function(){t.Path.prototype.op=function(t,e){return this._op(t,e)?this:null},t.Path.prototype.simplify=function(){return this._simplify()?this:null}})),t.Vd=t.Vd||[],t.Vd.push((function(){t.Canvas.prototype.drawText=function(e,n,r,i,a){var o=O(e),s=t._malloc(o+1);k(e,D,s,o+1),this._drawSimpleText(s,o,n,r,a,i),t._free(s)},t.Font.prototype.getGlyphBounds=function(e,n,r){var i=u(e,"HEAPU16"),a=t._malloc(16*e.length);return this._getGlyphWidthBounds(i,e.length,$,a,n||null),n=new Float32Array(t.HEAPU8.buffer,a,4*e.length),c(i,e),r?(r.set(n),t._free(a),r):(e=Float32Array.from(n),t._free(a),e)},t.Font.prototype.getGlyphIDs=function(e,n,r){n||(n=e.length);var i=O(e)+1,a=t._malloc(i);return k(e,D,a,i),e=t._malloc(2*n),n=this._getGlyphIDs(a,i-1,n,e),t._free(a),0>n?(t._free(e),null):(a=new Uint16Array(t.HEAPU8.buffer,e,n),r?(r.set(a),t._free(e),r):(r=Uint16Array.from(a),t._free(e),r))},t.Font.prototype.getGlyphIntercepts=function(t,e,n,r){var i=u(t,"HEAPU16"),a=u(e,"HEAPF32");return this._getGlyphIntercepts(i,t.length,!(t&&t._ck),a,e.length,!(e&&e._ck),n,r)},t.Font.prototype.getGlyphWidths=function(e,n,r){var i=u(e,"HEAPU16"),a=t._malloc(4*e.length);return this._getGlyphWidthBounds(i,e.length,a,$,n||null),n=new Float32Array(t.HEAPU8.buffer,a,e.length),c(i,e),r?(r.set(n),t._free(a),r):(e=Float32Array.from(n),t._free(a),e)},t.FontMgr.FromData=function(){if(!arguments.length)return null;var e=arguments;if(1===e.length&&Array.isArray(e[0])&&(e=arguments[0]),!e.length)return null;for(var n=[],r=[],i=0;i<e.length;i++){var a=new Uint8Array(e[i]),o=u(a,"HEAPU8");n.push(o),r.push(a.byteLength)}return n=u(n,"HEAPU32"),r=u(r,"HEAPU32"),e=t.FontMgr._fromData(n,r,e.length),t._free(n),t._free(r),e},t.Typeface.MakeFreeTypeFaceFromData=function(e){var n=u(e=new Uint8Array(e),"HEAPU8");return(e=t.Typeface._MakeFreeTypeFaceFromData(n,e.byteLength))?e:null},t.Typeface.prototype.getGlyphIDs=function(e,n,r){n||(n=e.length);var i=O(e)+1,a=t._malloc(i);return k(e,D,a,i),e=t._malloc(2*n),n=this._getGlyphIDs(a,i-1,n,e),t._free(a),0>n?(t._free(e),null):(a=new Uint16Array(t.HEAPU8.buffer,e,n),r?(r.set(a),t._free(e),r):(r=Uint16Array.from(a),t._free(e),r))},t.TextBlob.MakeOnPath=function(e,n,r,i){if(e&&e.length&&n&&n.countPoints()){if(1===n.countPoints())return this.MakeFromText(e,r);i||(i=0);var a=r.getGlyphIDs(e);a=r.getGlyphWidths(a);for(var o=[],s=(n=new t.ContourMeasureIter(n,!1,1)).next(),l=new Float32Array(4),c=0;c<e.length&&s;c++){var u=a[c];if((i+=u/2)>s.length()){if(s.delete(),!(s=n.next())){e=e.substring(0,c);break}i=u/2}s.getPosTan(i,l);var h=l[2],d=l[3];o.push(h,d,l[0]-u/2*h,l[1]-u/2*d),i+=u/2}return e=this.MakeFromRSXform(e,o,r),s&&s.delete(),n.delete(),e}},t.TextBlob.MakeFromRSXform=function(e,n,r){var i=O(e)+1,a=t._malloc(i);return k(e,D,a,i),e=u(n,"HEAPF32"),r=t.TextBlob._MakeFromRSXform(a,i-1,e,r),t._free(a),r||null},t.TextBlob.MakeFromRSXformGlyphs=function(e,n,r){var i=u(e,"HEAPU16");return n=u(n,"HEAPF32"),r=t.TextBlob._MakeFromRSXformGlyphs(i,2*e.length,n,r),c(i,e),r||null},t.TextBlob.MakeFromGlyphs=function(e,n){var r=u(e,"HEAPU16");return n=t.TextBlob._MakeFromGlyphs(r,2*e.length,n),c(r,e),n||null},t.TextBlob.MakeFromText=function(e,n){var r=O(e)+1,i=t._malloc(r);return k(e,D,i,r),e=t.TextBlob._MakeFromText(i,r-1,n),t._free(i),e||null},t.MallocGlyphIDs=function(e){return t.Malloc(Uint16Array,e)}})),t.Vd=t.Vd||[],t.Vd.push((function(){t.MakePicture=function(e){e=new Uint8Array(e);var n=t._malloc(e.byteLength);return t.HEAPU8.set(e,n),(e=t._MakePicture(n,e.byteLength))?e:null}})),function(){function e(t){for(var e=0;e<t.length;e++)if(void 0!==t[e]&&!Number.isFinite(t[e]))return!1;return!0}function n(e){var n=t.getColorComponents(e);e=n[0];var r=n[1],i=n[2];return 1===(n=n[3])?(e=e.toString(16).toLowerCase(),r=r.toString(16).toLowerCase(),i=i.toString(16).toLowerCase(),"#"+(e=1===e.length?"0"+e:e)+(r=1===r.length?"0"+r:r)+(i=1===i.length?"0"+i:i)):"rgba("+e+", "+r+", "+i+", "+(n=0===n||1===n?n:n.toFixed(8))+")"}function r(e){return t.parseColorString(e,w)}function a(t){if(!(t=b.exec(t)))return null;var e=parseFloat(t[4]),n=16;switch(t[5]){case"em":case"rem":case"pc":n=16*e;break;case"pt":n=4*e/3;break;case"px":n=e;break;case"in":n=96*e;break;case"cm":n=96*e/2.54;break;case"mm":n=96/25.4*e;break;case"q":n=96/25.4/4*e;break;case"%":n=16/75*e}return{style:t[1],variant:t[2],weight:t[3],sizePx:n,family:t[6].trim()}}function o(o){this.Nd=o,this.Rd=new t.Paint,this.Rd.setAntiAlias(!0),this.Rd.setStrokeMiter(10),this.Rd.setStrokeCap(t.StrokeCap.Butt),this.Rd.setStrokeJoin(t.StrokeJoin.Miter),this.Re="10px monospace",this.ne=new t.Font(null,10),this.ne.setSubpixel(!0),this.ce=this.he=t.BLACK,this.ue=0,this.Ie=t.TRANSPARENT,this.we=this.ve=0,this.Je=this.ke=1,this.He=0,this.te=[],this.Pd=t.BlendMode.SrcOver,this.Rd.setStrokeWidth(this.Je),this.Rd.setBlendMode(this.Pd),this.Td=new t.Path,this.Ud=t.Matrix.identity(),this.lf=[],this.Ae=[],this.me=function(){this.Td.delete(),this.Rd.delete(),this.ne.delete(),this.Ae.forEach((function(t){t.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(t){t.a&&this.setTransform(t.a,t.b,t.c,t.d,t.e,t.f)}}),Object.defineProperty(this,"fillStyle",{enumerable:!0,get:function(){return i(this.ce)?n(this.ce):this.ce},set:function(t){"string"==typeof t?this.ce=r(t):t.se&&(this.ce=t)}}),Object.defineProperty(this,"font",{enumerable:!0,get:function(){return this.Re},set:function(t){var e=a(t),n=e.family;e.typeface=S[n]?S[n][(e.style||"normal")+"|"+(e.variant||"normal")+"|"+(e.weight||"normal")]||S[n]["*"]:null,e&&(this.ne.setSize(e.sizePx),this.ne.setTypeface(e.typeface),this.Re=t)}}),Object.defineProperty(this,"globalAlpha",{enumerable:!0,get:function(){return this.ke},set:function(t){!isFinite(t)||0>t||1<t||(this.ke=t)}}),Object.defineProperty(this,"globalCompositeOperation",{enumerable:!0,get:function(){switch(this.Pd){case t.BlendMode.SrcOver:return"source-over";case t.BlendMode.DstOver:return"destination-over";case t.BlendMode.Src:return"copy";case t.BlendMode.Dst:return"destination";case t.BlendMode.Clear:return"clear";case t.BlendMode.SrcIn:return"source-in";case t.BlendMode.DstIn:return"destination-in";case t.BlendMode.SrcOut:return"source-out";case t.BlendMode.DstOut:return"destination-out";case t.BlendMode.SrcATop:return"source-atop";case t.BlendMode.DstATop:return"destination-atop";case t.BlendMode.Xor:return"xor";case t.BlendMode.Plus:return"lighter";case t.BlendMode.Multiply:return"multiply";case t.BlendMode.Screen:return"screen";case t.BlendMode.Overlay:return"overlay";case t.BlendMode.Darken:return"darken";case t.BlendMode.Lighten:return"lighten";case t.BlendMode.ColorDodge:return"color-dodge";case t.BlendMode.ColorBurn:return"color-burn";case t.BlendMode.HardLight:return"hard-light";case t.BlendMode.SoftLight:return"soft-light";case t.BlendMode.Difference:return"difference";case t.BlendMode.Exclusion:return"exclusion";case t.BlendMode.Hue:return"hue";case t.BlendMode.Saturation:return"saturation";case t.BlendMode.Color:return"color";case t.BlendMode.Luminosity:return"luminosity"}},set:function(e){switch(e){case"source-over":this.Pd=t.BlendMode.SrcOver;break;case"destination-over":this.Pd=t.BlendMode.DstOver;break;case"copy":this.Pd=t.BlendMode.Src;break;case"destination":this.Pd=t.BlendMode.Dst;break;case"clear":this.Pd=t.BlendMode.Clear;break;case"source-in":this.Pd=t.BlendMode.SrcIn;break;case"destination-in":this.Pd=t.BlendMode.DstIn;break;case"source-out":this.Pd=t.BlendMode.SrcOut;break;case"destination-out":this.Pd=t.BlendMode.DstOut;break;case"source-atop":this.Pd=t.BlendMode.SrcATop;break;case"destination-atop":this.Pd=t.BlendMode.DstATop;break;case"xor":this.Pd=t.BlendMode.Xor;break;case"lighter":case"plus-lighter":this.Pd=t.BlendMode.Plus;break;case"plus-darker":throw"plus-darker is not supported";case"multiply":this.Pd=t.BlendMode.Multiply;break;case"screen":this.Pd=t.BlendMode.Screen;break;case"overlay":this.Pd=t.BlendMode.Overlay;break;case"darken":this.Pd=t.BlendMode.Darken;break;case"lighten":this.Pd=t.BlendMode.Lighten;break;case"color-dodge":this.Pd=t.BlendMode.ColorDodge;break;case"color-burn":this.Pd=t.BlendMode.ColorBurn;break;case"hard-light":this.Pd=t.BlendMode.HardLight;break;case"soft-light":this.Pd=t.BlendMode.SoftLight;break;case"difference":this.Pd=t.BlendMode.Difference;break;case"exclusion":this.Pd=t.BlendMode.Exclusion;break;case"hue":this.Pd=t.BlendMode.Hue;break;case"saturation":this.Pd=t.BlendMode.Saturation;break;case"color":this.Pd=t.BlendMode.Color;break;case"luminosity":this.Pd=t.BlendMode.Luminosity;break;default:return}this.Rd.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.Rd.getStrokeCap()){case t.StrokeCap.Butt:return"butt";case t.StrokeCap.Round:return"round";case t.StrokeCap.Square:return"square"}},set:function(e){switch(e){case"butt":this.Rd.setStrokeCap(t.StrokeCap.Butt);break;case"round":this.Rd.setStrokeCap(t.StrokeCap.Round);break;case"square":this.Rd.setStrokeCap(t.StrokeCap.Square)}}}),Object.defineProperty(this,"lineDashOffset",{enumerable:!0,get:function(){return this.He},set:function(t){isFinite(t)&&(this.He=t)}}),Object.defineProperty(this,"lineJoin",{enumerable:!0,get:function(){switch(this.Rd.getStrokeJoin()){case t.StrokeJoin.Miter:return"miter";case t.StrokeJoin.Round:return"round";case t.StrokeJoin.Bevel:return"bevel"}},set:function(e){switch(e){case"miter":this.Rd.setStrokeJoin(t.StrokeJoin.Miter);break;case"round":this.Rd.setStrokeJoin(t.StrokeJoin.Round);break;case"bevel":this.Rd.setStrokeJoin(t.StrokeJoin.Bevel)}}}),Object.defineProperty(this,"lineWidth",{enumerable:!0,get:function(){return this.Rd.getStrokeWidth()},set:function(t){0>=t||!t||(this.Je=t,this.Rd.setStrokeWidth(t))}}),Object.defineProperty(this,"miterLimit",{enumerable:!0,get:function(){return this.Rd.getStrokeMiter()},set:function(t){0>=t||!t||this.Rd.setStrokeMiter(t)}}),Object.defineProperty(this,"shadowBlur",{enumerable:!0,get:function(){return this.ue},set:function(t){0>t||!isFinite(t)||(this.ue=t)}}),Object.defineProperty(this,"shadowColor",{enumerable:!0,get:function(){return n(this.Ie)},set:function(t){this.Ie=r(t)}}),Object.defineProperty(this,"shadowOffsetX",{enumerable:!0,get:function(){return this.ve},set:function(t){isFinite(t)&&(this.ve=t)}}),Object.defineProperty(this,"shadowOffsetY",{enumerable:!0,get:function(){return this.we},set:function(t){isFinite(t)&&(this.we=t)}}),Object.defineProperty(this,"strokeStyle",{enumerable:!0,get:function(){return n(this.he)},set:function(t){"string"==typeof t?this.he=r(t):t.se&&(this.he=t)}}),this.arc=function(t,e,n,r,i,a){p(this.Td,t,e,n,n,0,r,i,a)},this.arcTo=function(t,e,n,r,i){h(this.Td,t,e,n,r,i)},this.beginPath=function(){this.Td.delete(),this.Td=new t.Path},this.bezierCurveTo=function(t,n,r,i,a,o){var s=this.Td;e([t,n,r,i,a,o])&&(s.isEmpty()&&s.moveTo(t,n),s.cubicTo(t,n,r,i,a,o))},this.clearRect=function(e,n,r,i){this.Rd.setStyle(t.PaintStyle.Fill),this.Rd.setBlendMode(t.BlendMode.Clear),this.Nd.drawRect(t.XYWHRect(e,n,r,i),this.Rd),this.Rd.setBlendMode(this.Pd)},this.clip=function(e,n){"string"==typeof e?(n=e,e=this.Td):e&&e.af&&(e=e.Wd),e||(e=this.Td),e=e.copy(),n&&"evenodd"===n.toLowerCase()?e.setFillType(t.FillType.EvenOdd):e.setFillType(t.FillType.Winding),this.Nd.clipPath(e,t.ClipOp.Intersect,!0),e.delete()},this.closePath=function(){d(this.Td)},this.createImageData=function(){if(1===arguments.length){var t=arguments[0];return new c(new Uint8ClampedArray(4*t.width*t.height),t.width,t.height)}if(2===arguments.length){t=arguments[0];var e=arguments[1];return new c(new Uint8ClampedArray(4*t*e),t,e)}throw"createImageData expects 1 or 2 arguments, got "+arguments.length},this.createLinearGradient=function(t,n,r,i){if(e(arguments)){var a=new u(t,n,r,i);return this.Ae.push(a),a}},this.createPattern=function(t,e){return t=new y(t,e),this.Ae.push(t),t},this.createRadialGradient=function(t,n,r,i,a,o){if(e(arguments)){var s=new v(t,n,r,i,a,o);return this.Ae.push(s),s}},this.drawImage=function(e){e instanceof l&&(e=e.tf());var n=this.Qe();if(3===arguments.length||5===arguments.length)var r=t.XYWHRect(arguments[1],arguments[2],arguments[3]||e.width(),arguments[4]||e.height()),i=t.XYWHRect(0,0,e.width(),e.height());else{if(9!==arguments.length)throw"invalid number of args for drawImage, need 3, 5, or 9; got "+arguments.length;r=t.XYWHRect(arguments[5],arguments[6],arguments[7],arguments[8]),i=t.XYWHRect(arguments[1],arguments[2],arguments[3],arguments[4])}this.Nd.drawImageRect(e,i,r,n,!1),n.dispose()},this.ellipse=function(t,e,n,r,i,a,o,s){p(this.Td,t,e,n,r,i,a,o,s)},this.Qe=function(){var e=this.Rd.copy();if(e.setStyle(t.PaintStyle.Fill),i(this.ce)){var n=t.multiplyByAlpha(this.ce,this.ke);e.setColor(n)}else n=this.ce.se(this.Ud),e.setColor(t.Color(0,0,0,this.ke)),e.setShader(n);return e.dispose=function(){this.delete()},e},this.fill=function(e,n){if("string"==typeof e?(n=e,e=this.Td):e&&e.af&&(e=e.Wd),"evenodd"===n)this.Td.setFillType(t.FillType.EvenOdd);else{if("nonzero"!==n&&n)throw"invalid fill rule";this.Td.setFillType(t.FillType.Winding)}e||(e=this.Td),n=this.Qe();var r=this.xe(n);r&&(this.Nd.save(),this.qe(),this.Nd.drawPath(e,r),this.Nd.restore(),r.dispose()),this.Nd.drawPath(e,n),n.dispose()},this.fillRect=function(e,n,r,i){var a=this.Qe(),o=this.xe(a);o&&(this.Nd.save(),this.qe(),this.Nd.drawRect(t.XYWHRect(e,n,r,i),o),this.Nd.restore(),o.dispose()),this.Nd.drawRect(t.XYWHRect(e,n,r,i),a),a.dispose()},this.fillText=function(e,n,r){var i=this.Qe();e=t.TextBlob.MakeFromText(e,this.ne);var a=this.xe(i);a&&(this.Nd.save(),this.qe(),this.Nd.drawTextBlob(e,n,r,a),this.Nd.restore(),a.dispose()),this.Nd.drawTextBlob(e,n,r,i),e.delete(),i.dispose()},this.getImageData=function(e,n,r,i){return(e=this.Nd.readPixels(e,n,{width:r,height:i,colorType:t.ColorType.RGBA_8888,alphaType:t.AlphaType.Unpremul,colorSpace:t.ColorSpace.SRGB}))?new c(new Uint8ClampedArray(e.buffer),r,i):null},this.getLineDash=function(){return this.te.slice()},this.mf=function(e){var n=t.Matrix.invert(this.Ud);return t.Matrix.mapPoints(n,e),e},this.isPointInPath=function(e,n,r){var i=arguments;if(3===i.length)var a=this.Td;else{if(4!==i.length)throw"invalid arg count, need 3 or 4, got "+i.length;a=i[0],e=i[1],n=i[2],r=i[3]}return!(!isFinite(e)||!isFinite(n))&&("nonzero"===(r=r||"nonzero")||"evenodd"===r)&&(e=(i=this.mf([e,n]))[0],n=i[1],a.setFillType("nonzero"===r?t.FillType.Winding:t.FillType.EvenOdd),a.contains(e,n))},this.isPointInStroke=function(e,n){var r=arguments;if(2===r.length)var i=this.Td;else{if(3!==r.length)throw"invalid arg count, need 2 or 3, got "+r.length;i=r[0],e=r[1],n=r[2]}return!(!isFinite(e)||!isFinite(n))&&(e=(r=this.mf([e,n]))[0],n=r[1],(i=i.copy()).setFillType(t.FillType.Winding),i.stroke({width:this.lineWidth,miter_limit:this.miterLimit,cap:this.Rd.getStrokeCap(),join:this.Rd.getStrokeJoin(),precision:.3}),r=i.contains(e,n),i.delete(),r)},this.lineTo=function(t,e){g(this.Td,t,e)},this.measureText=function(t){t=this.ne.getGlyphIDs(t),t=this.ne.getGlyphWidths(t);let e=0;for(const n of t)e+=n;return{width:e}},this.moveTo=function(t,n){var r=this.Td;e([t,n])&&r.moveTo(t,n)},this.putImageData=function(n,r,i,a,o,s,l){if(e([r,i,a,o,s,l]))if(void 0===a)this.Nd.writePixels(n.data,n.width,n.height,r,i);else if(a=a||0,o=o||0,s=s||n.width,l=l||n.height,0>s&&(a+=s,s=Math.abs(s)),0>l&&(o+=l,l=Math.abs(l)),0>a&&(s+=a,a=0),0>o&&(l+=o,o=0),!(0>=s||0>=l)){n=t.MakeImage({width:n.width,height:n.height,alphaType:t.AlphaType.Unpremul,colorType:t.ColorType.RGBA_8888,colorSpace:t.ColorSpace.SRGB},n.data,4*n.width);var c=t.XYWHRect(a,o,s,l);r=t.XYWHRect(r+a,i+o,s,l),i=t.Matrix.invert(this.Ud),this.Nd.save(),this.Nd.concat(i),this.Nd.drawImageRect(n,c,r,null,!1),this.Nd.restore(),n.delete()}},this.quadraticCurveTo=function(t,n,r,i){var a=this.Td;e([t,n,r,i])&&(a.isEmpty()&&a.moveTo(t,n),a.quadTo(t,n,r,i))},this.rect=function(n,r,i,a){var o=this.Td;e(n=t.XYWHRect(n,r,i,a))&&o.addRect(n)},this.resetTransform=function(){this.Td.transform(this.Ud);var e=t.Matrix.invert(this.Ud);this.Nd.concat(e),this.Ud=this.Nd.getTotalMatrix()},this.restore=function(){var e=this.lf.pop();if(e){var n=t.Matrix.multiply(this.Ud,t.Matrix.invert(e.Ff));this.Td.transform(n),this.Rd.delete(),this.Rd=e.dg,this.te=e.$f,this.Je=e.vg,this.he=e.ug,this.ce=e.fs,this.ve=e.sg,this.we=e.tg,this.ue=e.hg,this.Ie=e.rg,this.ke=e.Nf,this.Pd=e.Of,this.He=e.ag,this.Re=e.Mf,this.Nd.restore(),this.Ud=this.Nd.getTotalMatrix()}},this.rotate=function(e){if(isFinite(e)){var n=t.Matrix.rotated(-e);this.Td.transform(n),this.Nd.rotate(e/Math.PI*180,0,0),this.Ud=this.Nd.getTotalMatrix()}},this.save=function(){if(this.ce.re){var t=this.ce.re();this.Ae.push(t)}else t=this.ce;if(this.he.re){var e=this.he.re();this.Ae.push(e)}else e=this.he;this.lf.push({Ff:this.Ud.slice(),$f:this.te.slice(),vg:this.Je,ug:e,fs:t,sg:this.ve,tg:this.we,hg:this.ue,rg:this.Ie,Nf:this.ke,ag:this.He,Of:this.Pd,dg:this.Rd.copy(),Mf:this.Re}),this.Nd.save()},this.scale=function(n,r){if(e(arguments)){var i=t.Matrix.scaled(1/n,1/r);this.Td.transform(i),this.Nd.scale(n,r),this.Ud=this.Nd.getTotalMatrix()}},this.setLineDash=function(t){for(var e=0;e<t.length;e++)if(!isFinite(t[e])||0>t[e])return;1==t.length%2&&Array.prototype.push.apply(t,t),this.te=t},this.setTransform=function(t,n,r,i,a,o){e(arguments)&&(this.resetTransform(),this.transform(t,n,r,i,a,o))},this.qe=function(){var e=t.Matrix.invert(this.Ud);this.Nd.concat(e),this.Nd.concat(t.Matrix.translated(this.ve,this.we)),this.Nd.concat(this.Ud)},this.xe=function(e){var n=t.multiplyByAlpha(this.Ie,this.ke);if(!t.getColorComponents(n)[3]||!(this.ue||this.we||this.ve))return null;(e=e.copy()).setColor(n);var r=t.MaskFilter.MakeBlur(t.BlurStyle.Normal,this.ue/2,!1);return e.setMaskFilter(r),e.dispose=function(){r.delete(),this.delete()},e},this.cf=function(){var e=this.Rd.copy();if(e.setStyle(t.PaintStyle.Stroke),i(this.he)){var n=t.multiplyByAlpha(this.he,this.ke);e.setColor(n)}else n=this.he.se(this.Ud),e.setColor(t.Color(0,0,0,this.ke)),e.setShader(n);if(e.setStrokeWidth(this.Je),this.te.length){var r=t.PathEffect.MakeDash(this.te,this.He);e.setPathEffect(r)}return e.dispose=function(){r&&r.delete(),this.delete()},e},this.stroke=function(t){t=t?t.Wd:this.Td;var e=this.cf(),n=this.xe(e);n&&(this.Nd.save(),this.qe(),this.Nd.drawPath(t,n),this.Nd.restore(),n.dispose()),this.Nd.drawPath(t,e),e.dispose()},this.strokeRect=function(e,n,r,i){var a=this.cf(),o=this.xe(a);o&&(this.Nd.save(),this.qe(),this.Nd.drawRect(t.XYWHRect(e,n,r,i),o),this.Nd.restore(),o.dispose()),this.Nd.drawRect(t.XYWHRect(e,n,r,i),a),a.dispose()},this.strokeText=function(e,n,r){var i=this.cf();e=t.TextBlob.MakeFromText(e,this.ne);var a=this.xe(i);a&&(this.Nd.save(),this.qe(),this.Nd.drawTextBlob(e,n,r,a),this.Nd.restore(),a.dispose()),this.Nd.drawTextBlob(e,n,r,i),e.delete(),i.dispose()},this.translate=function(n,r){if(e(arguments)){var i=t.Matrix.translated(-n,-r);this.Td.transform(i),this.Nd.translate(n,r),this.Ud=this.Nd.getTotalMatrix()}},this.transform=function(e,n,r,i,a,o){e=[e,r,a,n,i,o,0,0,1],n=t.Matrix.invert(e),this.Td.transform(n),this.Nd.concat(e),this.Ud=this.Nd.getTotalMatrix()},this.addHitRegion=function(){},this.clearHitRegions=function(){},this.drawFocusIfNeeded=function(){},this.removeHitRegion=function(){},this.scrollPathIntoView=function(){},Object.defineProperty(this,"canvas",{value:null,writable:!1})}function s(e){this.df=e,this.Md=new o(e.getCanvas()),this.Se=[],this.decodeImage=function(e){if(!(e=t.MakeImageFromEncoded(e)))throw"Invalid input";return this.Se.push(e),new l(e)},this.loadFont=function(e,n){if(!(e=t.Typeface.MakeFreeTypeFaceFromData(e)))return null;this.Se.push(e);var r=(n.style||"normal")+"|"+(n.variant||"normal")+"|"+(n.weight||"normal");n=n.family,S[n]||(S[n]={"*":e}),S[n][r]=e},this.makePath2D=function(t){return t=new m(t),this.Se.push(t.Wd),t},this.getContext=function(t){return"2d"===t?this.Md:null},this.toDataURL=function(e,n){this.df.flush();var r=this.df.makeImageSnapshot();if(r){e=e||"image/png";var i=t.ImageFormat.PNG;if("image/jpeg"===e&&(i=t.ImageFormat.JPEG),n=r.encodeToBytes(i,n||.92)){if(r.delete(),e="data:"+e+";base64,","undefined"!=typeof Buffer)n=Buffer.from(n).toString("base64");else{r=0,i=n.length;for(var a,o="";r<i;)a=n.slice(r,Math.min(r+32768,i)),o+=String.fromCharCode.apply(null,a),r+=32768;n=btoa(o)}return e+n}}},this.dispose=function(){this.Md.me(),this.Se.forEach((function(t){t.delete()})),this.df.dispose()}}function l(t){this.width=t.width(),this.height=t.height(),this.naturalWidth=this.width,this.naturalHeight=this.height,this.tf=function(){return t}}function c(t,e,n){if(!e||0===n)throw"invalid dimensions, width and height must be non-zero";if(t.length%4)throw"arr must be a multiple of 4";n=n||t.length/(4*e),Object.defineProperty(this,"data",{value:t,writable:!1}),Object.defineProperty(this,"height",{value:n,writable:!1}),Object.defineProperty(this,"width",{value:e,writable:!1})}function u(e,n,i,a){this.Yd=null,this.ee=[],this.ae=[],this.addColorStop=function(t,e){if(0>t||1<t||!isFinite(t))throw"offset must be between 0 and 1 inclusively";e=r(e);var n=this.ae.indexOf(t);if(-1!==n)this.ee[n]=e;else{for(n=0;n<this.ae.length&&!(this.ae[n]>t);n++);this.ae.splice(n,0,t),this.ee.splice(n,0,e)}},this.re=function(){var t=new u(e,n,i,a);return t.ee=this.ee.slice(),t.ae=this.ae.slice(),t},this.me=function(){this.Yd&&(this.Yd.delete(),this.Yd=null)},this.se=function(r){var o=[e,n,i,a];t.Matrix.mapPoints(r,o),r=o[0];var s=o[1],l=o[2];return o=o[3],this.me(),this.Yd=t.Shader.MakeLinearGradient([r,s],[l,o],this.ee,this.ae,t.TileMode.Clamp)}}function h(t,n,r,i,a,o){if(e([n,r,i,a,o])){if(0>o)throw"radii cannot be negative";t.isEmpty()&&t.moveTo(n,r),t.arcToTangent(n,r,i,a,o)}}function d(t){if(!t.isEmpty()){var e=t.getBounds();(e[3]-e[1]||e[2]-e[0])&&t.close()}}function f(e,n,r,i,a,o,s){s=(s-o)/Math.PI*180,o=o/Math.PI*180,n=t.LTRBRect(n-i,r-a,n+i,r+a),1e-5>Math.abs(Math.abs(s)-360)?(r=s/2,e.arcToOval(n,o,r,!1),e.arcToOval(n,o+r,r,!1)):e.arcToOval(n,o,s,!1)}function p(n,r,i,a,o,s,l,c,u){if(e([r,i,a,o,s,l,c])){if(0>a||0>o)throw"radii cannot be negative";var h=2*Math.PI,d=l%h;0>d&&(d+=h);var p=d-l;l=d,c+=p,!u&&c-l>=h?c=l+h:u&&l-c>=h?c=l-h:!u&&l>c?c=l+(h-(l-c)%h):u&&l<c&&(c=l-(h-(c-l)%h)),s?(u=t.Matrix.rotated(s,r,i),s=t.Matrix.rotated(-s,r,i),n.transform(s),f(n,r,i,a,o,l,c),n.transform(u)):f(n,r,i,a,o,l,c)}}function g(t,n,r){e([n,r])&&(t.isEmpty()&&t.moveTo(n,r),t.lineTo(n,r))}function m(n){this.Wd=null,this.Wd="string"==typeof n?t.Path.MakeFromSVGString(n):n&&n.af?n.Wd.copy():new t.Path,this.af=function(){return this.Wd},this.addPath=function(t,e){e||(e={a:1,c:0,e:0,b:0,d:1,f:0}),this.Wd.addPath(t.Wd,[e.a,e.c,e.e,e.b,e.d,e.f])},this.arc=function(t,e,n,r,i,a){p(this.Wd,t,e,n,n,0,r,i,a)},this.arcTo=function(t,e,n,r,i){h(this.Wd,t,e,n,r,i)},this.bezierCurveTo=function(t,n,r,i,a,o){var s=this.Wd;e([t,n,r,i,a,o])&&(s.isEmpty()&&s.moveTo(t,n),s.cubicTo(t,n,r,i,a,o))},this.closePath=function(){d(this.Wd)},this.ellipse=function(t,e,n,r,i,a,o,s){p(this.Wd,t,e,n,r,i,a,o,s)},this.lineTo=function(t,e){g(this.Wd,t,e)},this.moveTo=function(t,n){var r=this.Wd;e([t,n])&&r.moveTo(t,n)},this.quadraticCurveTo=function(t,n,r,i){var a=this.Wd;e([t,n,r,i])&&(a.isEmpty()&&a.moveTo(t,n),a.quadTo(t,n,r,i))},this.rect=function(n,r,i,a){var o=this.Wd;e(n=t.XYWHRect(n,r,i,a))&&o.addRect(n)}}function y(n,r){switch(this.Yd=null,n instanceof l&&(n=n.tf()),this.Af=n,this._transform=t.Matrix.identity(),""===r&&(r="repeat"),r){case"repeat-x":this.ye=t.TileMode.Repeat,this.ze=t.TileMode.Decal;break;case"repeat-y":this.ye=t.TileMode.Decal,this.ze=t.TileMode.Repeat;break;case"repeat":this.ze=this.ye=t.TileMode.Repeat;break;case"no-repeat":this.ze=this.ye=t.TileMode.Decal;break;default:throw"invalid repetition mode "+r}this.setTransform=function(t){e(t=[t.a,t.c,t.e,t.b,t.d,t.f,0,0,1])&&(this._transform=t)},this.re=function(){var t=new y;return t.ye=this.ye,t.ze=this.ze,t},this.me=function(){this.Yd&&(this.Yd.delete(),this.Yd=null)},this.se=function(){return this.me(),this.Yd=this.Af.makeShaderCubic(this.ye,this.ze,1/3,1/3,this._transform)}}function v(e,n,i,a,o,s){this.Yd=null,this.ee=[],this.ae=[],this.addColorStop=function(t,e){if(0>t||1<t||!isFinite(t))throw"offset must be between 0 and 1 inclusively";e=r(e);var n=this.ae.indexOf(t);if(-1!==n)this.ee[n]=e;else{for(n=0;n<this.ae.length&&!(this.ae[n]>t);n++);this.ae.splice(n,0,t),this.ee.splice(n,0,e)}},this.re=function(){var t=new v(e,n,i,a,o,s);return t.ee=this.ee.slice(),t.ae=this.ae.slice(),t},this.me=function(){this.Yd&&(this.Yd.delete(),this.Yd=null)},this.se=function(r){var l=[e,n,a,o];t.Matrix.mapPoints(r,l);var c=l[0],u=l[1],h=l[2];l=l[3];var d=(Math.abs(r[0])+Math.abs(r[4]))/2;return r=i*d,d*=s,this.me(),this.Yd=t.Shader.MakeTwoPointConicalGradient([c,u],r,[h,l],d,this.ee,this.ae,t.TileMode.Clamp)}}t._testing={};var w={aliceblue:Float32Array.of(.941,.973,1,1),antiquewhite:Float32Array.of(.98,.922,.843,1),aqua:Float32Array.of(0,1,1,1),aquamarine:Float32Array.of(.498,1,.831,1),azure:Float32Array.of(.941,1,1,1),beige:Float32Array.of(.961,.961,.863,1),bisque:Float32Array.of(1,.894,.769,1),black:Float32Array.of(0,0,0,1),blanchedalmond:Float32Array.of(1,.922,.804,1),blue:Float32Array.of(0,0,1,1),blueviolet:Float32Array.of(.541,.169,.886,1),brown:Float32Array.of(.647,.165,.165,1),burlywood:Float32Array.of(.871,.722,.529,1),cadetblue:Float32Array.of(.373,.62,.627,1),chartreuse:Float32Array.of(.498,1,0,1),chocolate:Float32Array.of(.824,.412,.118,1),coral:Float32Array.of(1,.498,.314,1),cornflowerblue:Float32Array.of(.392,.584,.929,1),cornsilk:Float32Array.of(1,.973,.863,1),crimson:Float32Array.of(.863,.078,.235,1),cyan:Float32Array.of(0,1,1,1),darkblue:Float32Array.of(0,0,.545,1),darkcyan:Float32Array.of(0,.545,.545,1),darkgoldenrod:Float32Array.of(.722,.525,.043,1),darkgray:Float32Array.of(.663,.663,.663,1),darkgreen:Float32Array.of(0,.392,0,1),darkgrey:Float32Array.of(.663,.663,.663,1),darkkhaki:Float32Array.of(.741,.718,.42,1),darkmagenta:Float32Array.of(.545,0,.545,1),darkolivegreen:Float32Array.of(.333,.42,.184,1),darkorange:Float32Array.of(1,.549,0,1),darkorchid:Float32Array.of(.6,.196,.8,1),darkred:Float32Array.of(.545,0,0,1),darksalmon:Float32Array.of(.914,.588,.478,1),darkseagreen:Float32Array.of(.561,.737,.561,1),darkslateblue:Float32Array.of(.282,.239,.545,1),darkslategray:Float32Array.of(.184,.31,.31,1),darkslategrey:Float32Array.of(.184,.31,.31,1),darkturquoise:Float32Array.of(0,.808,.82,1),darkviolet:Float32Array.of(.58,0,.827,1),deeppink:Float32Array.of(1,.078,.576,1),deepskyblue:Float32Array.of(0,.749,1,1),dimgray:Float32Array.of(.412,.412,.412,1),dimgrey:Float32Array.of(.412,.412,.412,1),dodgerblue:Float32Array.of(.118,.565,1,1),firebrick:Float32Array.of(.698,.133,.133,1),floralwhite:Float32Array.of(1,.98,.941,1),forestgreen:Float32Array.of(.133,.545,.133,1),fuchsia:Float32Array.of(1,0,1,1),gainsboro:Float32Array.of(.863,.863,.863,1),ghostwhite:Float32Array.of(.973,.973,1,1),gold:Float32Array.of(1,.843,0,1),goldenrod:Float32Array.of(.855,.647,.125,1),gray:Float32Array.of(.502,.502,.502,1),green:Float32Array.of(0,.502,0,1),greenyellow:Float32Array.of(.678,1,.184,1),grey:Float32Array.of(.502,.502,.502,1),honeydew:Float32Array.of(.941,1,.941,1),hotpink:Float32Array.of(1,.412,.706,1),indianred:Float32Array.of(.804,.361,.361,1),indigo:Float32Array.of(.294,0,.51,1),ivory:Float32Array.of(1,1,.941,1),khaki:Float32Array.of(.941,.902,.549,1),lavender:Float32Array.of(.902,.902,.98,1),lavenderblush:Float32Array.of(1,.941,.961,1),lawngreen:Float32Array.of(.486,.988,0,1),lemonchiffon:Float32Array.of(1,.98,.804,1),lightblue:Float32Array.of(.678,.847,.902,1),lightcoral:Float32Array.of(.941,.502,.502,1),lightcyan:Float32Array.of(.878,1,1,1),lightgoldenrodyellow:Float32Array.of(.98,.98,.824,1),lightgray:Float32Array.of(.827,.827,.827,1),lightgreen:Float32Array.of(.565,.933,.565,1),lightgrey:Float32Array.of(.827,.827,.827,1),lightpink:Float32Array.of(1,.714,.757,1),lightsalmon:Float32Array.of(1,.627,.478,1),lightseagreen:Float32Array.of(.125,.698,.667,1),lightskyblue:Float32Array.of(.529,.808,.98,1),lightslategray:Float32Array.of(.467,.533,.6,1),lightslategrey:Float32Array.of(.467,.533,.6,1),lightsteelblue:Float32Array.of(.69,.769,.871,1),lightyellow:Float32Array.of(1,1,.878,1),lime:Float32Array.of(0,1,0,1),limegreen:Float32Array.of(.196,.804,.196,1),linen:Float32Array.of(.98,.941,.902,1),magenta:Float32Array.of(1,0,1,1),maroon:Float32Array.of(.502,0,0,1),mediumaquamarine:Float32Array.of(.4,.804,.667,1),mediumblue:Float32Array.of(0,0,.804,1),mediumorchid:Float32Array.of(.729,.333,.827,1),mediumpurple:Float32Array.of(.576,.439,.859,1),mediumseagreen:Float32Array.of(.235,.702,.443,1),mediumslateblue:Float32Array.of(.482,.408,.933,1),mediumspringgreen:Float32Array.of(0,.98,.604,1),mediumturquoise:Float32Array.of(.282,.82,.8,1),mediumvioletred:Float32Array.of(.78,.082,.522,1),midnightblue:Float32Array.of(.098,.098,.439,1),mintcream:Float32Array.of(.961,1,.98,1),mistyrose:Float32Array.of(1,.894,.882,1),moccasin:Float32Array.of(1,.894,.71,1),navajowhite:Float32Array.of(1,.871,.678,1),navy:Float32Array.of(0,0,.502,1),oldlace:Float32Array.of(.992,.961,.902,1),olive:Float32Array.of(.502,.502,0,1),olivedrab:Float32Array.of(.42,.557,.137,1),orange:Float32Array.of(1,.647,0,1),orangered:Float32Array.of(1,.271,0,1),orchid:Float32Array.of(.855,.439,.839,1),palegoldenrod:Float32Array.of(.933,.91,.667,1),palegreen:Float32Array.of(.596,.984,.596,1),paleturquoise:Float32Array.of(.686,.933,.933,1),palevioletred:Float32Array.of(.859,.439,.576,1),papayawhip:Float32Array.of(1,.937,.835,1),peachpuff:Float32Array.of(1,.855,.725,1),peru:Float32Array.of(.804,.522,.247,1),pink:Float32Array.of(1,.753,.796,1),plum:Float32Array.of(.867,.627,.867,1),powderblue:Float32Array.of(.69,.878,.902,1),purple:Float32Array.of(.502,0,.502,1),rebeccapurple:Float32Array.of(.4,.2,.6,1),red:Float32Array.of(1,0,0,1),rosybrown:Float32Array.of(.737,.561,.561,1),royalblue:Float32Array.of(.255,.412,.882,1),saddlebrown:Float32Array.of(.545,.271,.075,1),salmon:Float32Array.of(.98,.502,.447,1),sandybrown:Float32Array.of(.957,.643,.376,1),seagreen:Float32Array.of(.18,.545,.341,1),seashell:Float32Array.of(1,.961,.933,1),sienna:Float32Array.of(.627,.322,.176,1),silver:Float32Array.of(.753,.753,.753,1),skyblue:Float32Array.of(.529,.808,.922,1),slateblue:Float32Array.of(.416,.353,.804,1),slategray:Float32Array.of(.439,.502,.565,1),slategrey:Float32Array.of(.439,.502,.565,1),snow:Float32Array.of(1,.98,.98,1),springgreen:Float32Array.of(0,1,.498,1),steelblue:Float32Array.of(.275,.51,.706,1),tan:Float32Array.of(.824,.706,.549,1),teal:Float32Array.of(0,.502,.502,1),thistle:Float32Array.of(.847,.749,.847,1),tomato:Float32Array.of(1,.388,.278,1),transparent:Float32Array.of(0,0,0,0),turquoise:Float32Array.of(.251,.878,.816,1),violet:Float32Array.of(.933,.51,.933,1),wheat:Float32Array.of(.961,.871,.702,1),white:Float32Array.of(1,1,1,1),whitesmoke:Float32Array.of(.961,.961,.961,1),yellow:Float32Array.of(1,1,0,1),yellowgreen:Float32Array.of(.604,.804,.196,1)};t._testing.parseColor=r,t._testing.colorToString=n;var b=RegExp("(italic|oblique|normal|)\\s*(small-caps|normal|)\\s*(bold|bolder|lighter|[1-9]00|normal|)\\s*([\\d\\.]+)(px|pt|pc|in|cm|mm|%|em|ex|ch|rem|q)(.+)"),S={"Noto Mono":{"*":null},monospace:{"*":null}};t._testing.parseFontString=a,t.MakeCanvas=function(e,n){return(e=t.MakeSurface(e,n))?new s(e):null},t.ImageData=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return new c(new Uint8ClampedArray(4*t*e),t,e)}if(3===arguments.length){var n=arguments[0];if(n.prototype.constructor!==Uint8ClampedArray)throw"bytes must be given as a Uint8ClampedArray";if(n%4)throw"bytes must be given in a multiple of 4";if(n%(t=arguments[1]))throw"bytes must divide evenly by width";if((e=arguments[2])&&e!==n/(4*t))throw"invalid height given";return new c(n,t,n/(4*t))}throw"invalid number of arguments - takes 2 or 3, saw "+arguments.length}}()}(e);var s,l,c,u,h,d,f=o({},e),p="./this.program",g=(t,e)=>{throw e},m="object"==typeof window,y="function"==typeof importScripts,v="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,w="";v?(w=y?R.dirname(w)+"/":__dirname+"/",d=()=>{h||(u=B,h=R)},s=function(t,e){return d(),t=h.normalize(t),u.readFileSync(t,e?null:"utf8")},c=t=>((t=s(t,!0)).buffer||(t=new Uint8Array(t)),t),l=(t,e,n)=>{d(),t=h.normalize(t),u.readFile(t,(function(t,r){t?n(t):e(r.buffer)}))},1<process.argv.length&&(p=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",(function(t){if(!(t instanceof Pn))throw t})),process.on("unhandledRejection",(function(t){throw t})),g=(t,e)=>{if(T||0<nt)throw process.exitCode=t,e;e instanceof Pn||S("exiting due to exception: "+e),process.exit(t)},e.inspect=function(){return"[Emscripten Module object]"}):(m||y)&&(y?w=self.location.href:"undefined"!=typeof document&&document.currentScript&&(w=document.currentScript.src),n&&(w=n),w=0!==w.indexOf("blob:")?w.substr(0,w.replace(/[?#].*/,"").lastIndexOf("/")+1):"",s=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},y&&(c=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),l=(t,e,n)=>{var r=new XMLHttpRequest;r.open("GET",t,!0),r.responseType="arraybuffer",r.onload=()=>{200==r.status||0==r.status&&r.response?e(r.response):n()},r.onerror=n,r.send(null)});var b=e.print||console.log.bind(console),S=e.printErr||console.warn.bind(console);o(e,f),f=null,e.thisProgram&&(p=e.thisProgram),e.quit&&(g=e.quit);var A,C=0;e.wasmBinary&&(A=e.wasmBinary);var T=e.noExitRuntime||!0;"object"!=typeof WebAssembly&&st("no native wasm support detected");var _,P=!1,x="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function M(t,e,n){var r=e+n;for(n=e;t[n]&&!(n>=r);)++n;if(16<n-e&&t.subarray&&x)return x.decode(t.subarray(e,n));for(r="";e<n;){var i=t[e++];if(128&i){var a=63&t[e++];if(192==(224&i))r+=String.fromCharCode((31&i)<<6|a);else{var o=63&t[e++];65536>(i=224==(240&i)?(15&i)<<12|a<<6|o:(7&i)<<18|a<<12|o<<6|63&t[e++])?r+=String.fromCharCode(i):(i-=65536,r+=String.fromCharCode(55296|i>>10,56320|1023&i))}}else r+=String.fromCharCode(i)}return r}function F(t,e){return t?M(D,t,e):""}function k(t,e,n,r){if(!(0<r))return 0;var i=n;r=n+r-1;for(var a=0;a<t.length;++a){var o=t.charCodeAt(a);if(55296<=o&&57343>=o&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++a)),127>=o){if(n>=r)break;e[n++]=o}else{if(2047>=o){if(n+1>=r)break;e[n++]=192|o>>6}else{if(65535>=o){if(n+2>=r)break;e[n++]=224|o>>12}else{if(n+3>=r)break;e[n++]=240|o>>18,e[n++]=128|o>>12&63}e[n++]=128|o>>6&63}e[n++]=128|63&o}}return e[n]=0,n-i}function O(t){for(var e=0,n=0;n<t.length;++n){var r=t.charCodeAt(n);55296<=r&&57343>=r&&(r=65536+((1023&r)<<10)|1023&t.charCodeAt(++n)),127>=r?++e:e=2047>=r?e+2:65535>=r?e+3:e+4}return e}var I,L,D,G,j,W,U,N,z,H="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function $(t,e){for(var n=t>>1,r=n+e/2;!(n>=r)&&j[n];)++n;if(32<(n<<=1)-t&&H)return H.decode(D.subarray(t,n));for(n="",r=0;!(r>=e/2);++r){var i=G[t+2*r>>1];if(0==i)break;n+=String.fromCharCode(i)}return n}function V(t,e,n){if(void 0===n&&(n=2147483647),2>n)return 0;var r=e;n=(n-=2)<2*t.length?n/2:t.length;for(var i=0;i<n;++i)G[e>>1]=t.charCodeAt(i),e+=2;return G[e>>1]=0,e-r}function Y(t){return 2*t.length}function q(t,e){for(var n=0,r="";!(n>=e/4);){var i=W[t+4*n>>2];if(0==i)break;++n,65536<=i?(i-=65536,r+=String.fromCharCode(55296|i>>10,56320|1023&i)):r+=String.fromCharCode(i)}return r}function X(t,e,n){if(void 0===n&&(n=2147483647),4>n)return 0;var r=e;n=r+n-4;for(var i=0;i<t.length;++i){var a=t.charCodeAt(i);if(55296<=a&&57343>=a&&(a=65536+((1023&a)<<10)|1023&t.charCodeAt(++i)),W[e>>2]=a,(e+=4)+4>n)break}return W[e>>2]=0,e-r}function K(t){for(var e=0,n=0;n<t.length;++n){var r=t.charCodeAt(n);55296<=r&&57343>=r&&++n,e+=4}return e}function Q(){var t=_.buffer;I=t,e.HEAP8=L=new Int8Array(t),e.HEAP16=G=new Int16Array(t),e.HEAP32=W=new Int32Array(t),e.HEAPU8=D=new Uint8Array(t),e.HEAPU16=j=new Uint16Array(t),e.HEAPU32=U=new Uint32Array(t),e.HEAPF32=N=new Float32Array(t),e.HEAPF64=z=new Float64Array(t)}var Z,J=[],tt=[],et=[],nt=0;function rt(){var t=e.preRun.shift();J.unshift(t)}var it,at=0,ot=null;function st(t){throw e.onAbort&&e.onAbort(t),S(t="Aborted("+t+")"),P=!0,t=new WebAssembly.RuntimeError(t+". Build with -s ASSERTIONS=1 for more info."),i(t),t}function lt(){return it.startsWith("data:application/octet-stream;base64,")}if(e.preloadedImages={},e.preloadedAudios={},it="canvaskit.wasm",!lt()){var ct=it;it=e.locateFile?e.locateFile(ct,w):w+ct}function ut(){var t=it;try{if(t==it&&A)return new Uint8Array(A);if(c)return c(t);throw"both async and sync fetching of the wasm failed"}catch(t){st(t)}}function ht(t){for(;0<t.length;){var n=t.shift();if("function"==typeof n)n(e);else{var r=n.Dg;"number"==typeof r?void 0===n.ef?dt(r)():dt(r)(n.ef):r(void 0===n.ef?null:n.ef)}}}function dt(t){return Z.get(t)}function ft(t){this.Qd=t-16,this.mg=function(t){W[this.Qd+4>>2]=t},this.jg=function(t){W[this.Qd+8>>2]=t},this.kg=function(){W[this.Qd>>2]=0},this.ig=function(){L[this.Qd+12>>0]=0},this.lg=function(){L[this.Qd+13>>0]=0},this.Xf=function(t,e){this.mg(t),this.jg(e),this.kg(),this.ig(),this.lg()}}var pt={},gt=[null,[],[]],mt={},yt={};function vt(t){for(;t.length;){var e=t.pop();t.pop()(e)}}function wt(t){return this.fromWireType(U[t>>2])}var bt={},St={},At={};function Ct(t){if(void 0===t)return"_unknown";var e=(t=t.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return 48<=e&&57>=e?"_"+t:t}function Tt(t,e){return t=Ct(t),function(){return e.apply(this,arguments)}}function _t(t){var e=Error,n=Tt(t,(function(e){this.name=t,this.message=e,void 0!==(e=Error(e).stack)&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))}));return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},n}var Pt=void 0;function xt(t){throw new Pt(t)}function Mt(t,e,n){function r(e){(e=n(e)).length!==t.length&&xt("Mismatched type converter count");for(var r=0;r<t.length;++r)Bt(t[r],e[r])}t.forEach((function(t){At[t]=e}));var i=Array(e.length),a=[],o=0;e.forEach((function(t,e){St.hasOwnProperty(t)?i[e]=St[t]:(a.push(t),bt.hasOwnProperty(t)||(bt[t]=[]),bt[t].push((function(){i[e]=St[t],++o===a.length&&r(i)})))})),0===a.length&&r(i)}function Ft(t){switch(t){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+t)}}var Et=void 0;function kt(t){for(var e="";D[t];)e+=Et[D[t++]];return e}var Ot=void 0;function Rt(t){throw new Ot(t)}function Bt(t,e,n={}){if(!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");var r=e.name;if(t||Rt('type "'+r+'" must have a positive integer typeid pointer'),St.hasOwnProperty(t)){if(n.Wf)return;Rt("Cannot register type '"+r+"' twice")}St[t]=e,delete At[t],bt.hasOwnProperty(t)&&(e=bt[t],delete bt[t],e.forEach((function(t){t()})))}function It(t){Rt(t.Ld.Xd.Sd.name+" instance already deleted")}var Lt=!1;function Dt(){}function Gt(t){--t.count.value,0===t.count.value&&(t.$d?t.ge.le(t.$d):t.Xd.Sd.le(t.Qd))}function jt(t){return"undefined"==typeof FinalizationGroup?(jt=t=>t,t):(Lt=new FinalizationGroup((function(t){for(var e=t.next();!e.done;e=t.next())(e=e.value).Qd?Gt(e):console.warn("object already deleted: "+e.Qd)})),Dt=t=>{Lt.unregister(t.Ld)},(jt=t=>(Lt.register(t,t.Ld,t.Ld),t))(t))}var Wt=void 0,Ut=[];function Nt(){for(;Ut.length;){var t=Ut.pop();t.Ld.De=!1,t.delete()}}function zt(){}var Ht={};function $t(t,e,n){if(void 0===t[e].Zd){var r=t[e];t[e]=function(){return t[e].Zd.hasOwnProperty(arguments.length)||Rt("Function '"+n+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+t[e].Zd+")!"),t[e].Zd[arguments.length].apply(this,arguments)},t[e].Zd=[],t[e].Zd[r.Be]=r}}function Vt(t,n,r){e.hasOwnProperty(t)?((void 0===r||void 0!==e[t].Zd&&void 0!==e[t].Zd[r])&&Rt("Cannot register public name '"+t+"' twice"),$t(e,t,t),e.hasOwnProperty(r)&&Rt("Cannot register multiple overloads of a function with the same number of arguments ("+r+")!"),e[t].Zd[r]=n):(e[t]=n,void 0!==r&&(e[t].Fg=r))}function Yt(t,e,n,r,i,a,o,s){this.name=t,this.constructor=e,this.Ee=n,this.le=r,this.ie=i,this.Pf=a,this.Pe=o,this.Jf=s,this.fg=[]}function qt(t,e,n){for(;e!==n;)e.Pe||Rt("Expected null or instance of "+n.name+", got an instance of "+e.name),t=e.Pe(t),e=e.ie;return t}function Xt(t,e){return null===e?(this.gf&&Rt("null is not a valid "+this.name),0):(e.Ld||Rt('Cannot pass "'+me(e)+'" as a '+this.name),e.Ld.Qd||Rt("Cannot pass deleted object as a pointer of type "+this.name),qt(e.Ld.Qd,e.Ld.Xd.Sd,this.Sd))}function Kt(t,e){if(null===e){if(this.gf&&Rt("null is not a valid "+this.name),this.Ue){var n=this.hf();return null!==t&&t.push(this.le,n),n}return 0}if(e.Ld||Rt('Cannot pass "'+me(e)+'" as a '+this.name),e.Ld.Qd||Rt("Cannot pass deleted object as a pointer of type "+this.name),!this.Te&&e.Ld.Xd.Te&&Rt("Cannot convert argument of type "+(e.Ld.ge?e.Ld.ge.name:e.Ld.Xd.name)+" to parameter type "+this.name),n=qt(e.Ld.Qd,e.Ld.Xd.Sd,this.Sd),this.Ue)switch(void 0===e.Ld.$d&&Rt("Passing raw pointer to smart pointer is illegal"),this.qg){case 0:e.Ld.ge===this?n=e.Ld.$d:Rt("Cannot convert argument of type "+(e.Ld.ge?e.Ld.ge.name:e.Ld.Xd.name)+" to parameter type "+this.name);break;case 1:n=e.Ld.$d;break;case 2:if(e.Ld.ge===this)n=e.Ld.$d;else{var r=e.clone();n=this.gg(n,fe((function(){r.delete()}))),null!==t&&t.push(this.le,n)}break;default:Rt("Unsupporting sharing policy")}return n}function Qt(t,e){return null===e?(this.gf&&Rt("null is not a valid "+this.name),0):(e.Ld||Rt('Cannot pass "'+me(e)+'" as a '+this.name),e.Ld.Qd||Rt("Cannot pass deleted object as a pointer of type "+this.name),e.Ld.Xd.Te&&Rt("Cannot convert argument of type "+e.Ld.Xd.name+" to parameter type "+this.name),qt(e.Ld.Qd,e.Ld.Xd.Sd,this.Sd))}function Zt(t,e,n){return e===n?t:void 0===n.ie||null===(t=Zt(t,e,n.ie))?null:n.Jf(t)}var Jt={};function te(t,e){return e.Xd&&e.Qd||xt("makeClassHandle requires ptr and ptrType"),!!e.ge!=!!e.$d&&xt("Both smartPtrType and smartPtr must be specified"),e.count={value:1},jt(Object.create(t,{Ld:{value:e}}))}function ee(t,e,n,r,i,a,o,s,l,c,u){this.name=t,this.Sd=e,this.gf=n,this.Te=r,this.Ue=i,this.eg=a,this.qg=o,this.vf=s,this.hf=l,this.gg=c,this.le=u,i||void 0!==e.ie?this.toWireType=Kt:(this.toWireType=r?Xt:Qt,this.fe=null)}function ne(t,n,r){e.hasOwnProperty(t)||xt("Replacing nonexistant public symbol"),void 0!==e[t].Zd&&void 0!==r?e[t].Zd[r]=n:(e[t]=n,e[t].Be=r)}function re(t,n){var r=(t=kt(t)).includes("j")?function(t,n){var r=[];return function(){r.length=arguments.length;for(var i=0;i<arguments.length;i++)r[i]=arguments[i];return t.includes("j")?(i=e["dynCall_"+t],i=r&&r.length?i.apply(null,[n].concat(r)):i.call(null,n)):i=dt(n).apply(null,r),i}}(t,n):dt(n);return"function"!=typeof r&&Rt("unknown function pointer with signature "+t+": "+n),r}var ie=void 0;function ae(t){var e=kt(t=bn(t));return vn(t),e}function oe(t,e){var n=[],r={};throw e.forEach((function t(e){r[e]||St[e]||(At[e]?At[e].forEach(t):(n.push(e),r[e]=!0))})),new ie(t+": "+n.map(ae).join([", "]))}function se(t,e,n,r,i){var a=e.length;2>a&&Rt("argTypes array size mismatch! Must at least get return value and 'this' types!");var o=null!==e[1]&&null!==n,s=!1;for(n=1;n<e.length;++n)if(null!==e[n]&&void 0===e[n].fe){s=!0;break}var l="void"!==e[0].name,c=a-2,u=Array(c),h=[],d=[];return function(){if(arguments.length!==c&&Rt("function "+t+" called with "+arguments.length+" arguments, expected "+c+" args!"),d.length=0,h.length=o?2:1,h[0]=i,o){var n=e[1].toWireType(d,this);h[1]=n}for(var a=0;a<c;++a)u[a]=e[a+2].toWireType(d,arguments[a]),h.push(u[a]);if(a=r.apply(null,h),s)vt(d);else for(var f=o?1:2;f<e.length;f++){var p=1===f?n:u[f-2];null!==e[f].fe&&e[f].fe(p)}return n=l?e[0].fromWireType(a):void 0}}function le(t,e){for(var n=[],r=0;r<t;r++)n.push(W[(e>>2)+r]);return n}var ce=[],ue=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function he(t){4<t&&0==--ue[t].jf&&(ue[t]=void 0,ce.push(t))}function de(t){return t||Rt("Cannot use deleted val. handle = "+t),ue[t].value}function fe(t){switch(t){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var e=ce.length?ce.pop():ue.length;return ue[e]={jf:1,value:t},e}}function pe(t,e,n){switch(e){case 0:return function(t){return this.fromWireType((n?L:D)[t])};case 1:return function(t){return this.fromWireType((n?G:j)[t>>1])};case 2:return function(t){return this.fromWireType((n?W:U)[t>>2])};default:throw new TypeError("Unknown integer type: "+t)}}function ge(t,e){var n=St[t];return void 0===n&&Rt(e+" has unknown type "+ae(t)),n}function me(t){if(null===t)return"null";var e=typeof t;return"object"===e||"array"===e||"function"===e?t.toString():""+t}function ye(t,e){switch(e){case 2:return function(t){return this.fromWireType(N[t>>2])};case 3:return function(t){return this.fromWireType(z[t>>3])};default:throw new TypeError("Unknown float type: "+t)}}function ve(t,e,n){switch(e){case 0:return n?function(t){return L[t]}:function(t){return D[t]};case 1:return n?function(t){return G[t>>1]}:function(t){return j[t>>1]};case 2:return n?function(t){return W[t>>2]}:function(t){return U[t>>2]};default:throw new TypeError("Unknown integer type: "+t)}}var we={};function be(t){var e=we[t];return void 0===e?kt(t):e}var Se=[];function Ae(){function t(t){t.$$$embind_global$$$=t;var e="object"==typeof $$$embind_global$$$&&t.$$$embind_global$$$===t;return e||delete t.$$$embind_global$$$,e}if("object"==typeof globalThis)return globalThis;if("object"==typeof $$$embind_global$$$)return $$$embind_global$$$;if("object"==typeof E&&t(E)?$$$embind_global$$$=E:"object"==typeof self&&t(self)&&($$$embind_global$$$=self),"object"==typeof $$$embind_global$$$)return $$$embind_global$$$;throw Error("unable to get global object.")}var Ce,Te=[],_e={};Ce=v?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:()=>performance.now();var Pe=1,xe=[],Me=[],Fe=[],Ee=[],ke=[],Oe=[],Re=[],Be=[],Ie=[],Le=[],De={},Ge={},je=4;function We(t){He||(He=t)}function Ue(t){for(var e=Pe++,n=t.length;n<e;n++)t[n]=null;return e}function Ne(t){return ze=Be[t],e.Cg=dn=ze&&ze.je,!(t&&!dn)}var ze,He,$e=[];function Ve(t,e,n,r){for(var i=0;i<t;i++){var a=dn[n](),o=a&&Ue(r);a?(a.name=o,r[o]=a):We(1282),W[e+4*i>>2]=o}}function Ye(t){var e=O(t)+1,n=yn(e);return k(t,D,n,e),n}function qe(t){return"]"==t.slice(-1)&&t.lastIndexOf("[")}function Xe(t){return 0==(t-=5120)?L:1==t?D:2==t?G:4==t?W:6==t?N:5==t||28922==t||28520==t||30779==t||30782==t?U:j}function Ke(t,e,n,r,i){t=Xe(t);var a=31-Math.clz32(t.BYTES_PER_ELEMENT),o=je;return t.subarray(i>>a,i+r*(n*({5:3,6:4,8:2,29502:3,29504:4,26917:2,26918:2,29846:3,29847:4}[e-6402]||1)*(1<<a)+o-1&-o)>>a)}function Qe(t){var e=dn.Gf;if(e){var n=e.Oe[t];return"number"==typeof n&&(e.Oe[t]=n=dn.getUniformLocation(e,e.wf[t]+(0<n?"["+n+"]":""))),n}We(1282)}var Ze,Je=[],tn=[],en={};function nn(){if(!Ze){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:p||"./this.program"};for(t in en)void 0===en[t]?delete e[t]:e[t]=en[t];var n=[];for(t in e)n.push(t+"="+e[t]);Ze=n}return Ze}function rn(t){return 0==t%4&&(0!=t%100||0==t%400)}function an(t,e){for(var n=0,r=0;r<=e;n+=t[r++]);return n}var on=[31,29,31,30,31,30,31,31,30,31,30,31],sn=[31,28,31,30,31,30,31,31,30,31,30,31];function ln(t,e){for(t=new Date(t.getTime());0<e;){var n=t.getMonth(),r=(rn(t.getFullYear())?on:sn)[n];if(!(e>r-t.getDate())){t.setDate(t.getDate()+e);break}e-=r-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return t}function cn(t,e,n,r){function i(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.length<e;)t=n[0]+t;return t}function a(t,e){return i(t,e,"0")}function o(t,e){function n(t){return 0>t?-1:0<t?1:0}var r;return 0===(r=n(t.getFullYear()-e.getFullYear()))&&0===(r=n(t.getMonth()-e.getMonth()))&&(r=n(t.getDate()-e.getDate())),r}function s(t){switch(t.getDay()){case 0:return new Date(t.getFullYear()-1,11,29);case 1:return t;case 2:return new Date(t.getFullYear(),0,3);case 3:return new Date(t.getFullYear(),0,2);case 4:return new Date(t.getFullYear(),0,1);case 5:return new Date(t.getFullYear()-1,11,31);case 6:return new Date(t.getFullYear()-1,11,30)}}function l(t){t=ln(new Date(t.be+1900,0,1),t.$e);var e=new Date(t.getFullYear()+1,0,4),n=s(new Date(t.getFullYear(),0,4));return e=s(e),0>=o(n,t)?0>=o(e,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var c=W[r+40>>2];for(var u in r={yg:W[r>>2],xg:W[r+4>>2],Ye:W[r+8>>2],Ne:W[r+12>>2],Fe:W[r+16>>2],be:W[r+20>>2],Ze:W[r+24>>2],$e:W[r+28>>2],Ig:W[r+32>>2],wg:W[r+36>>2],zg:c?F(c):""},n=F(n),c={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(new RegExp(u,"g"),c[u]);var h="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),d="January February March April May June July August September October November December".split(" ");for(u in c={"%a":function(t){return h[t.Ze].substring(0,3)},"%A":function(t){return h[t.Ze]},"%b":function(t){return d[t.Fe].substring(0,3)},"%B":function(t){return d[t.Fe]},"%C":function(t){return a((t.be+1900)/100|0,2)},"%d":function(t){return a(t.Ne,2)},"%e":function(t){return i(t.Ne,2," ")},"%g":function(t){return l(t).toString().substring(2)},"%G":function(t){return l(t)},"%H":function(t){return a(t.Ye,2)},"%I":function(t){return 0==(t=t.Ye)?t=12:12<t&&(t-=12),a(t,2)},"%j":function(t){return a(t.Ne+an(rn(t.be+1900)?on:sn,t.Fe-1),3)},"%m":function(t){return a(t.Fe+1,2)},"%M":function(t){return a(t.xg,2)},"%n":function(){return"\n"},"%p":function(t){return 0<=t.Ye&&12>t.Ye?"AM":"PM"},"%S":function(t){return a(t.yg,2)},"%t":function(){return"\t"},"%u":function(t){return t.Ze||7},"%U":function(t){var e=new Date(t.be+1900,0,1),n=0===e.getDay()?e:ln(e,7-e.getDay());return 0>o(n,t=new Date(t.be+1900,t.Fe,t.Ne))?a(Math.ceil((31-n.getDate()+(an(rn(t.getFullYear())?on:sn,t.getMonth()-1)-31)+t.getDate())/7),2):0===o(n,e)?"01":"00"},"%V":function(t){var e=new Date(t.be+1901,0,4),n=s(new Date(t.be+1900,0,4));e=s(e);var r=ln(new Date(t.be+1900,0,1),t.$e);return 0>o(r,n)?"53":0>=o(e,r)?"01":a(Math.ceil((n.getFullYear()<t.be+1900?t.$e+32-n.getDate():t.$e+1-n.getDate())/7),2)},"%w":function(t){return t.Ze},"%W":function(t){var e=new Date(t.be,0,1),n=1===e.getDay()?e:ln(e,0===e.getDay()?1:7-e.getDay()+1);return 0>o(n,t=new Date(t.be+1900,t.Fe,t.Ne))?a(Math.ceil((31-n.getDate()+(an(rn(t.getFullYear())?on:sn,t.getMonth()-1)-31)+t.getDate())/7),2):0===o(n,e)?"01":"00"},"%y":function(t){return(t.be+1900).toString().substring(2)},"%Y":function(t){return t.be+1900},"%z":function(t){var e=0<=(t=t.wg);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.zg},"%%":function(){return"%"}})n.includes(u)&&(n=n.replace(new RegExp(u,"g"),c[u](r)));return u=function(t){var e=Array(O(t)+1);return k(t,e,0,e.length),e}(n),u.length>e?0:(L.set(u,t),u.length-1)}Pt=e.InternalError=_t("InternalError");for(var un=Array(256),hn=0;256>hn;++hn)un[hn]=String.fromCharCode(hn);Et=un,Ot=e.BindingError=_t("BindingError"),zt.prototype.isAliasOf=function(t){if(!(this instanceof zt&&t instanceof zt))return!1;var e=this.Ld.Xd.Sd,n=this.Ld.Qd,r=t.Ld.Xd.Sd;for(t=t.Ld.Qd;e.ie;)n=e.Pe(n),e=e.ie;for(;r.ie;)t=r.Pe(t),r=r.ie;return e===r&&n===t},zt.prototype.clone=function(){if(this.Ld.Qd||It(this),this.Ld.Me)return this.Ld.count.value+=1,this;var t=jt,e=Object,n=e.create,r=Object.getPrototypeOf(this),i=this.Ld;return(t=t(n.call(e,r,{Ld:{value:{count:i.count,De:i.De,Me:i.Me,Qd:i.Qd,Xd:i.Xd,$d:i.$d,ge:i.ge}}}))).Ld.count.value+=1,t.Ld.De=!1,t},zt.prototype.delete=function(){this.Ld.Qd||It(this),this.Ld.De&&!this.Ld.Me&&Rt("Object already scheduled for deletion"),Dt(this),Gt(this.Ld),this.Ld.Me||(this.Ld.$d=void 0,this.Ld.Qd=void 0)},zt.prototype.isDeleted=function(){return!this.Ld.Qd},zt.prototype.deleteLater=function(){return this.Ld.Qd||It(this),this.Ld.De&&!this.Ld.Me&&Rt("Object already scheduled for deletion"),Ut.push(this),1===Ut.length&&Wt&&Wt(Nt),this.Ld.De=!0,this},ee.prototype.Qf=function(t){return this.vf&&(t=this.vf(t)),t},ee.prototype.nf=function(t){this.le&&this.le(t)},ee.prototype.argPackAdvance=8,ee.prototype.readValueFromPointer=wt,ee.prototype.deleteObject=function(t){null!==t&&t.delete()},ee.prototype.fromWireType=function(t){function e(){return this.Ue?te(this.Sd.Ee,{Xd:this.eg,Qd:n,ge:this,$d:t}):te(this.Sd.Ee,{Xd:this,Qd:t})}var n=this.Qf(t);if(!n)return this.nf(t),null;var r=function(t,e){for(void 0===e&&Rt("ptr should not be undefined");t.ie;)e=t.Pe(e),t=t.ie;return Jt[e]}(this.Sd,n);if(void 0!==r)return 0===r.Ld.count.value?(r.Ld.Qd=n,r.Ld.$d=t,r.clone()):(r=r.clone(),this.nf(t),r);if(r=this.Sd.Pf(n),!(r=Ht[r]))return e.call(this);r=this.Te?r.Ef:r.pointerType;var i=Zt(n,this.Sd,r.Sd);return null===i?e.call(this):this.Ue?te(r.Sd.Ee,{Xd:r,Qd:i,ge:this,$d:t}):te(r.Sd.Ee,{Xd:r,Qd:i})},e.getInheritedInstanceCount=function(){return Object.keys(Jt).length},e.getLiveInheritedInstances=function(){var t,e=[];for(t in Jt)Jt.hasOwnProperty(t)&&e.push(Jt[t]);return e},e.flushPendingDeletes=Nt,e.setDelayFunction=function(t){Wt=t,Ut.length&&Wt&&Wt(Nt)},ie=e.UnboundTypeError=_t("UnboundTypeError"),e.count_emval_handles=function(){for(var t=0,e=5;e<ue.length;++e)void 0!==ue[e]&&++t;return t},e.get_first_emval=function(){for(var t=5;t<ue.length;++t)if(void 0!==ue[t])return ue[t];return null};for(var dn,fn=0;32>fn;++fn)$e.push(Array(fn));var pn=new Float32Array(288);for(fn=0;288>fn;++fn)Je[fn]=pn.subarray(0,fn+1);var gn=new Int32Array(288);for(fn=0;288>fn;++fn)tn[fn]=gn.subarray(0,fn+1);var mn={Lb:function(t){return yn(t+16)+16},Eb:function(t,e,n){throw new ft(t).Xf(e,n),t},P:function(){return 0},zb:function(){},xb:function(){},Cb:function(){return 0},wb:function(){},tb:function(t,e,n,r,i,a){if(a<<=12,0!=(16&r)&&0!=t%65536)e=-28;else if(0!=(32&r)){t=65536*Math.ceil(e/65536);var o=An(65536,t);o?(D.fill(0,o,o+t),t=o):t=0,t?(pt[t]={cg:t,bg:e,Df:!0,fd:i,Gg:n,flags:r,offset:a},e=t):e=-48}else e=-52;return e},sb:function(t,e){var n=pt[t];return 0!==e&&n?(e===n.bg&&(pt[t]=null,n.Df&&vn(n.cg)),t=0):t=-28,t},Q:function(){},yb:function(){},x:function(t){var e=yt[t];delete yt[t];var n=e.hf,r=e.le,i=e.rf;Mt([t],i.map((function(t){return t.Uf})).concat(i.map((function(t){return t.og}))),(function(t){var a={};return i.forEach((function(e,n){var r=t[n],o=e.Sf,s=e.Tf,l=t[n+i.length],c=e.ng,u=e.pg;a[e.Lf]={read:function(t){return r.fromWireType(o(s,t))},write:function(t,e){var n=[];c(u,t,l.toWireType(n,e)),vt(n)}}})),[{name:e.name,fromWireType:function(t){var e,n={};for(e in a)n[e]=a[e].read(t);return r(t),n},toWireType:function(t,e){for(var i in a)if(!(i in e))throw new TypeError('Missing field: "'+i+'"');var o=n();for(i in a)a[i].write(o,e[i]);return null!==t&&t.push(r,o),o},argPackAdvance:8,readValueFromPointer:wt,fe:r}]}))},mb:function(){},Fb:function(t,e,n,r,i){var a=Ft(n);Bt(t,{name:e=kt(e),fromWireType:function(t){return!!t},toWireType:function(t,e){return e?r:i},argPackAdvance:8,readValueFromPointer:function(t){if(1===n)var r=L;else if(2===n)r=G;else{if(4!==n)throw new TypeError("Unknown boolean type size: "+e);r=W}return this.fromWireType(r[t>>a])},fe:null})},l:function(t,e,n,r,i,a,o,s,l,c,u,h,d){u=kt(u),a=re(i,a),s&&(s=re(o,s)),c&&(c=re(l,c)),d=re(h,d);var f=Ct(u);Vt(f,(function(){oe("Cannot construct "+u+" due to unbound types",[r])})),Mt([t,e,n],r?[r]:[],(function(e){if(e=e[0],r)var n=e.Sd,i=n.Ee;else i=zt.prototype;e=Tt(f,(function(){if(Object.getPrototypeOf(this)!==o)throw new Ot("Use 'new' to construct "+u);if(void 0===l.oe)throw new Ot(u+" has no accessible constructor");var t=l.oe[arguments.length];if(void 0===t)throw new Ot("Tried to invoke ctor of "+u+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(l.oe).toString()+") parameters instead!");return t.apply(this,arguments)}));var o=Object.create(i,{constructor:{value:e}});e.prototype=o;var l=new Yt(u,e,o,d,n,a,s,c);n=new ee(u,l,!0,!1,!1),i=new ee(u+"*",l,!1,!1,!1);var h=new ee(u+" const*",l,!1,!0,!1);return Ht[t]={pointerType:i,Ef:h},ne(f,e),[n,i,h]}))},e:function(t,e,n,r,i,a,o){var s=le(n,r);e=kt(e),a=re(i,a),Mt([],[t],(function(t){function r(){oe("Cannot call "+i+" due to unbound types",s)}var i=(t=t[0]).name+"."+e;e.startsWith("@@")&&(e=Symbol[e.substring(2)]);var l=t.Sd.constructor;return void 0===l[e]?(r.Be=n-1,l[e]=r):($t(l,e,i),l[e].Zd[n-1]=r),Mt([],s,(function(t){return t=[t[0],null].concat(t.slice(1)),t=se(i,t,null,a,o),void 0===l[e].Zd?(t.Be=n-1,l[e]=t):l[e].Zd[n-1]=t,[]})),[]}))},u:function(t,e,n,r,i,a){0<e||st(void 0);var o=le(e,n);i=re(r,i),Mt([],[t],(function(t){var n="constructor "+(t=t[0]).name;if(void 0===t.Sd.oe&&(t.Sd.oe=[]),void 0!==t.Sd.oe[e-1])throw new Ot("Cannot register multiple constructors with identical number of parameters ("+(e-1)+") for class '"+t.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return t.Sd.oe[e-1]=()=>{oe("Cannot construct "+t.name+" due to unbound types",o)},Mt([],o,(function(r){return r.splice(1,0,null),t.Sd.oe[e-1]=se(n,r,null,i,a),[]})),[]}))},d:function(t,e,n,r,i,a,o,s){var l=le(n,r);e=kt(e),a=re(i,a),Mt([],[t],(function(t){function r(){oe("Cannot call "+i+" due to unbound types",l)}var i=(t=t[0]).name+"."+e;e.startsWith("@@")&&(e=Symbol[e.substring(2)]),s&&t.Sd.fg.push(e);var c=t.Sd.Ee,u=c[e];return void 0===u||void 0===u.Zd&&u.className!==t.name&&u.Be===n-2?(r.Be=n-2,r.className=t.name,c[e]=r):($t(c,e,i),c[e].Zd[n-2]=r),Mt([],l,(function(r){return r=se(i,r,t,a,o),void 0===c[e].Zd?(r.Be=n-2,c[e]=r):c[e].Zd[n-2]=r,[]})),[]}))},V:function(t,n,r){t=kt(t),Mt([],[n],(function(n){return n=n[0],e[t]=n.fromWireType(r),[]}))},Db:function(t,e){Bt(t,{name:e=kt(e),fromWireType:function(t){var e=de(t);return he(t),e},toWireType:function(t,e){return fe(e)},argPackAdvance:8,readValueFromPointer:wt,fe:null})},k:function(t,e,n,r){function i(){}n=Ft(n),e=kt(e),i.values={},Bt(t,{name:e,constructor:i,fromWireType:function(t){return this.constructor.values[t]},toWireType:function(t,e){return e.value},argPackAdvance:8,readValueFromPointer:pe(e,n,r),fe:null}),Vt(e,i)},j:function(t,e,n){var r=ge(t,"enum");e=kt(e),t=r.constructor,r=Object.create(r.constructor.prototype,{value:{value:n},constructor:{value:Tt(r.name+"_"+e,(function(){}))}}),t.values[n]=r,t[e]=r},S:function(t,e,n){n=Ft(n),Bt(t,{name:e=kt(e),fromWireType:function(t){return t},toWireType:function(t,e){return e},argPackAdvance:8,readValueFromPointer:ye(e,n),fe:null})},t:function(t,e,n,r,i,a){var o=le(e,n);t=kt(t),i=re(r,i),Vt(t,(function(){oe("Cannot call "+t+" due to unbound types",o)}),e-1),Mt([],o,(function(n){return n=[n[0],null].concat(n.slice(1)),ne(t,se(t,n,null,i,a),e-1),[]}))},w:function(t,e,n,r,i){e=kt(e),-1===i&&(i=4294967295),i=Ft(n);var a=t=>t;if(0===r){var o=32-8*n;a=t=>t<<o>>>o}n=e.includes("unsigned")?function(t,e){return e>>>0}:function(t,e){return e},Bt(t,{name:e,fromWireType:a,toWireType:n,argPackAdvance:8,readValueFromPointer:ve(e,i,0!==r),fe:null})},p:function(t,e,n){function r(t){var e=U;return new i(I,e[1+(t>>=2)],e[t])}var i=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][e];Bt(t,{name:n=kt(n),fromWireType:r,argPackAdvance:8,readValueFromPointer:r},{Wf:!0})},o:function(t,e,n,r,i,a,o,s,l,c,u,h){n=kt(n),a=re(i,a),s=re(o,s),c=re(l,c),h=re(u,h),Mt([t],[e],(function(t){return t=t[0],[new ee(n,t.Sd,!1,!1,!0,t,r,a,s,c,h)]}))},R:function(t,e){var n="std::string"===(e=kt(e));Bt(t,{name:e,fromWireType:function(t){var e=U[t>>2];if(n)for(var r=t+4,i=0;i<=e;++i){var a=t+4+i;if(i==e||0==D[a]){if(r=F(r,a-r),void 0===o)var o=r;else o+=String.fromCharCode(0),o+=r;r=a+1}}else{for(o=Array(e),i=0;i<e;++i)o[i]=String.fromCharCode(D[t+4+i]);o=o.join("")}return vn(t),o},toWireType:function(t,e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));var r="string"==typeof e;r||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||Rt("Cannot pass non-string to std::string");var i=(n&&r?()=>O(e):()=>e.length)(),a=yn(4+i+1);if(U[a>>2]=i,n&&r)k(e,D,a+4,i+1);else if(r)for(r=0;r<i;++r){var o=e.charCodeAt(r);255<o&&(vn(a),Rt("String has UTF-16 code units that do not fit in 8 bits")),D[a+4+r]=o}else for(r=0;r<i;++r)D[a+4+r]=e[r];return null!==t&&t.push(vn,a),a},argPackAdvance:8,readValueFromPointer:wt,fe:function(t){vn(t)}})},H:function(t,e,n){if(n=kt(n),2===e)var r=$,i=V,a=Y,o=()=>j,s=1;else 4===e&&(r=q,i=X,a=K,o=()=>U,s=2);Bt(t,{name:n,fromWireType:function(t){for(var n,i=U[t>>2],a=o(),l=t+4,c=0;c<=i;++c){var u=t+4+c*e;c!=i&&0!=a[u>>s]||(l=r(l,u-l),void 0===n?n=l:(n+=String.fromCharCode(0),n+=l),l=u+e)}return vn(t),n},toWireType:function(t,r){"string"!=typeof r&&Rt("Cannot pass non-string to C++ string type "+n);var o=a(r),l=yn(4+o+e);return U[l>>2]=o>>s,i(r,l+4,o+e),null!==t&&t.push(vn,l),l},argPackAdvance:8,readValueFromPointer:wt,fe:function(t){vn(t)}})},y:function(t,e,n,r,i,a){yt[t]={name:kt(e),hf:re(n,r),le:re(i,a),rf:[]}},g:function(t,e,n,r,i,a,o,s,l,c){yt[t].rf.push({Lf:kt(e),Uf:n,Sf:re(r,i),Tf:a,og:o,ng:re(s,l),pg:c})},Gb:function(t,e){Bt(t,{Zf:!0,name:e=kt(e),argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},pb:function(){throw"longjmp"},A:function(t,e,n){t=de(t),e=ge(e,"emval::as");var r=[],i=fe(r);return W[n>>2]=i,e.toWireType(r,t)},M:function(t,e,n,r,i){t=Se[t],e=de(e),n=be(n);var a=[];return W[r>>2]=fe(a),t(e,n,a,i)},B:function(t,e,n,r){(t=Se[t])(e=de(e),n=be(n),null,r)},D:he,Bb:function(t){return 0===t?fe(Ae()):(t=be(t),fe(Ae()[t]))},z:function(t,e){var n=function(t,e){for(var n=Array(t),r=0;r<t;++r)n[r]=ge(W[(e>>2)+r],"parameter "+r);return n}(t,e),r=n[0];e=r.name+"_$"+n.slice(1).map((function(t){return t.name})).join("_")+"$";var i=Te[e];if(void 0!==i)return i;var a=Array(t-1);return i=function(t){var e=Se.length;return Se.push(t),e}(((e,i,o,s)=>{for(var l=0,c=0;c<t-1;++c)a[c]=n[c+1].readValueFromPointer(s+l),l+=n[c+1].argPackAdvance;for(e=e[i].apply(e,a),c=0;c<t-1;++c)n[c+1].Hf&&n[c+1].Hf(a[c]);if(!r.Zf)return r.toWireType(o,e)})),Te[e]=i},K:function(t,e){return fe((t=de(t))[e=de(e)])},F:function(t){4<t&&(ue[t].jf+=1)},rb:function(t,e,n,r){t=de(t);var i=_e[e];return i||(i=function(t){var e=Array(t+1);return function(n,r,i){e[0]=n;for(var a=0;a<t;++a){var o=ge(W[(r>>2)+a],"parameter "+a);e[a+1]=o.readValueFromPointer(i),i+=o.argPackAdvance}return fe(n=new(n.bind.apply(n,e)))}}(e),_e[e]=i),i(t,n,r)},gb:function(){return fe([])},Ka:function(t){return fe(be(t))},hb:function(){return fe({})},fb:function(t){return!(t=de(t))},jb:function(t){vt(de(t)),he(t)},v:function(t,e,n){t=de(t),e=de(e),n=de(n),t[e]=n},r:function(t,e){return fe(t=(t=ge(t,"_emval_take_value")).readValueFromPointer(e))},a:function(){st("")},ob:function(t,e){if(0===t)t=Date.now();else{if(1!==t&&4!==t)return W[wn()>>2]=28,-1;t=Ce()}return W[e>>2]=t/1e3|0,W[e+4>>2]=t%1e3*1e6|0,0},_c:function(t){dn.activeTexture(t)},$c:function(t,e){dn.attachShader(Me[t],Oe[e])},ad:function(t,e,n){dn.bindAttribLocation(Me[t],e,F(n))},Y:function(t,e){35051==t?dn.ff=e:35052==t&&(dn.Ce=e),dn.bindBuffer(t,xe[e])},X:function(t,e){dn.bindFramebuffer(t,Fe[e])},cc:function(t,e){dn.bindRenderbuffer(t,Ee[e])},Qb:function(t,e){dn.bindSampler(t,Ie[e])},Z:function(t,e){dn.bindTexture(t,ke[e])},wc:function(t){dn.bindVertexArray(Re[t])},zc:function(t){dn.bindVertexArray(Re[t])},_:function(t,e,n,r){dn.blendColor(t,e,n,r)},$:function(t){dn.blendEquation(t)},aa:function(t,e){dn.blendFunc(t,e)},Xb:function(t,e,n,r,i,a,o,s,l,c){dn.blitFramebuffer(t,e,n,r,i,a,o,s,l,c)},ba:function(t,e,n,r){2<=ze.version?n?dn.bufferData(t,D,r,n,e):dn.bufferData(t,e,r):dn.bufferData(t,n?D.subarray(n,n+e):e,r)},ca:function(t,e,n,r){2<=ze.version?dn.bufferSubData(t,e,D,r,n):dn.bufferSubData(t,e,D.subarray(r,r+n))},dc:function(t){return dn.checkFramebufferStatus(t)},L:function(t){dn.clear(t)},W:function(t,e,n,r){dn.clearColor(t,e,n,r)},O:function(t){dn.clearStencil(t)},db:function(t,e,n,r){return dn.clientWaitSync(Le[t],e,(n>>>0)+4294967296*r)},da:function(t,e,n,r){dn.colorMask(!!t,!!e,!!n,!!r)},ea:function(t){dn.compileShader(Oe[t])},fa:function(t,e,n,r,i,a,o,s){2<=ze.version?dn.Ce?dn.compressedTexImage2D(t,e,n,r,i,a,o,s):dn.compressedTexImage2D(t,e,n,r,i,a,D,s,o):dn.compressedTexImage2D(t,e,n,r,i,a,s?D.subarray(s,s+o):null)},ga:function(t,e,n,r,i,a,o,s,l){2<=ze.version?dn.Ce?dn.compressedTexSubImage2D(t,e,n,r,i,a,o,s,l):dn.compressedTexSubImage2D(t,e,n,r,i,a,o,D,l,s):dn.compressedTexSubImage2D(t,e,n,r,i,a,o,l?D.subarray(l,l+s):null)},ha:function(t,e,n,r,i,a,o,s){dn.copyTexSubImage2D(t,e,n,r,i,a,o,s)},ia:function(){var t=Ue(Me),e=dn.createProgram();return e.name=t,e.Xe=e.Ve=e.We=0,e.kf=1,Me[t]=e,t},ja:function(t){var e=Ue(Oe);return Oe[e]=dn.createShader(t),e},ka:function(t){dn.cullFace(t)},la:function(t,e){for(var n=0;n<t;n++){var r=W[e+4*n>>2],i=xe[r];i&&(dn.deleteBuffer(i),i.name=0,xe[r]=null,r==dn.ff&&(dn.ff=0),r==dn.Ce&&(dn.Ce=0))}},ec:function(t,e){for(var n=0;n<t;++n){var r=W[e+4*n>>2],i=Fe[r];i&&(dn.deleteFramebuffer(i),i.name=0,Fe[r]=null)}},ma:function(t){if(t){var e=Me[t];e?(dn.deleteProgram(e),e.name=0,Me[t]=null):We(1281)}},fc:function(t,e){for(var n=0;n<t;n++){var r=W[e+4*n>>2],i=Ee[r];i&&(dn.deleteRenderbuffer(i),i.name=0,Ee[r]=null)}},Rb:function(t,e){for(var n=0;n<t;n++){var r=W[e+4*n>>2],i=Ie[r];i&&(dn.deleteSampler(i),i.name=0,Ie[r]=null)}},na:function(t){if(t){var e=Oe[t];e?(dn.deleteShader(e),Oe[t]=null):We(1281)}},Zb:function(t){if(t){var e=Le[t];e?(dn.deleteSync(e),e.name=0,Le[t]=null):We(1281)}},oa:function(t,e){for(var n=0;n<t;n++){var r=W[e+4*n>>2],i=ke[r];i&&(dn.deleteTexture(i),i.name=0,ke[r]=null)}},xc:function(t,e){for(var n=0;n<t;n++){var r=W[e+4*n>>2];dn.deleteVertexArray(Re[r]),Re[r]=null}},Ac:function(t,e){for(var n=0;n<t;n++){var r=W[e+4*n>>2];dn.deleteVertexArray(Re[r]),Re[r]=null}},pa:function(t){dn.depthMask(!!t)},qa:function(t){dn.disable(t)},ra:function(t){dn.disableVertexAttribArray(t)},sa:function(t,e,n){dn.drawArrays(t,e,n)},uc:function(t,e,n,r){dn.drawArraysInstanced(t,e,n,r)},sc:function(t,e,n,r,i){dn.pf.drawArraysInstancedBaseInstanceWEBGL(t,e,n,r,i)},qc:function(t,e){for(var n=$e[t],r=0;r<t;r++)n[r]=W[e+4*r>>2];dn.drawBuffers(n)},ta:function(t,e,n,r){dn.drawElements(t,e,n,r)},vc:function(t,e,n,r,i){dn.drawElementsInstanced(t,e,n,r,i)},tc:function(t,e,n,r,i,a,o){dn.pf.drawElementsInstancedBaseVertexBaseInstanceWEBGL(t,e,n,r,i,a,o)},kc:function(t,e,n,r,i,a){dn.drawElements(t,r,i,a)},ua:function(t){dn.enable(t)},va:function(t){dn.enableVertexAttribArray(t)},Vb:function(t,e){return(t=dn.fenceSync(t,e))?(e=Ue(Le),t.name=e,Le[e]=t,e):0},wa:function(){dn.finish()},xa:function(){dn.flush()},gc:function(t,e,n,r){dn.framebufferRenderbuffer(t,e,n,Ee[r])},hc:function(t,e,n,r,i){dn.framebufferTexture2D(t,e,n,ke[r],i)},ya:function(t){dn.frontFace(t)},za:function(t,e){Ve(t,e,"createBuffer",xe)},ic:function(t,e){Ve(t,e,"createFramebuffer",Fe)},jc:function(t,e){Ve(t,e,"createRenderbuffer",Ee)},Sb:function(t,e){Ve(t,e,"createSampler",Ie)},Aa:function(t,e){Ve(t,e,"createTexture",ke)},yc:function(t,e){Ve(t,e,"createVertexArray",Re)},Bc:function(t,e){Ve(t,e,"createVertexArray",Re)},_b:function(t){dn.generateMipmap(t)},Ba:function(t,e,n){n?W[n>>2]=dn.getBufferParameter(t,e):We(1281)},Ca:function(){var t=dn.getError()||He;return He=0,t},$b:function(t,e,n,r){((t=dn.getFramebufferAttachmentParameter(t,e,n))instanceof WebGLRenderbuffer||t instanceof WebGLTexture)&&(t=0|t.name),W[r>>2]=t},E:function(t,e){!function(t,e){if(e){var n=void 0;switch(t){case 36346:n=1;break;case 36344:return;case 34814:case 36345:n=0;break;case 34466:var r=dn.getParameter(34467);n=r?r.length:0;break;case 33309:if(2>ze.version)return void We(1282);n=2*(dn.getSupportedExtensions()||[]).length;break;case 33307:case 33308:if(2>ze.version)return void We(1280);n=33307==t?3:0}if(void 0===n)switch(r=dn.getParameter(t),typeof r){case"number":n=r;break;case"boolean":n=r?1:0;break;case"string":return void We(1280);case"object":if(null===r)switch(t){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 36662:case 36663:case 35053:case 35055:case 36010:case 35097:case 35869:case 32874:case 36389:case 35983:case 35368:case 34068:n=0;break;default:return void We(1280)}else{if(r instanceof Float32Array||r instanceof Uint32Array||r instanceof Int32Array||r instanceof Array){for(t=0;t<r.length;++t)W[e+4*t>>2]=r[t];return}try{n=0|r.name}catch(e){return We(1280),void S("GL_INVALID_ENUM in glGet0v: Unknown object returned from WebGL getParameter("+t+")! (error: "+e+")")}}break;default:return We(1280),void S("GL_INVALID_ENUM in glGet0v: Native code calling glGet0v("+t+") and it returns "+r+" of type "+typeof r+"!")}W[e>>2]=n}else We(1281)}(t,e)},Da:function(t,e,n,r){null===(t=dn.getProgramInfoLog(Me[t]))&&(t="(unknown error)"),e=0<e&&r?k(t,D,r,e):0,n&&(W[n>>2]=e)},Ea:function(t,e,n){if(n)if(t>=Pe)We(1281);else if(t=Me[t],35716==e)null===(t=dn.getProgramInfoLog(t))&&(t="(unknown error)"),W[n>>2]=t.length+1;else if(35719==e){if(!t.Xe)for(e=0;e<dn.getProgramParameter(t,35718);++e)t.Xe=Math.max(t.Xe,dn.getActiveUniform(t,e).name.length+1);W[n>>2]=t.Xe}else if(35722==e){if(!t.Ve)for(e=0;e<dn.getProgramParameter(t,35721);++e)t.Ve=Math.max(t.Ve,dn.getActiveAttrib(t,e).name.length+1);W[n>>2]=t.Ve}else if(35381==e){if(!t.We)for(e=0;e<dn.getProgramParameter(t,35382);++e)t.We=Math.max(t.We,dn.getActiveUniformBlockName(t,e).length+1);W[n>>2]=t.We}else W[n>>2]=dn.getProgramParameter(t,e);else We(1281)},ac:function(t,e,n){n?W[n>>2]=dn.getRenderbufferParameter(t,e):We(1281)},Fa:function(t,e,n,r){null===(t=dn.getShaderInfoLog(Oe[t]))&&(t="(unknown error)"),e=0<e&&r?k(t,D,r,e):0,n&&(W[n>>2]=e)},Nb:function(t,e,n,r){t=dn.getShaderPrecisionFormat(t,e),W[n>>2]=t.rangeMin,W[n+4>>2]=t.rangeMax,W[r>>2]=t.precision},Ga:function(t,e,n){n?35716==e?(null===(t=dn.getShaderInfoLog(Oe[t]))&&(t="(unknown error)"),W[n>>2]=t?t.length+1:0):35720==e?(t=dn.getShaderSource(Oe[t]),W[n>>2]=t?t.length+1:0):W[n>>2]=dn.getShaderParameter(Oe[t],e):We(1281)},J:function(t){var e=De[t];if(!e){switch(t){case 7939:e=Ye((e=(e=dn.getSupportedExtensions()||[]).concat(e.map((function(t){return"GL_"+t})))).join(" "));break;case 7936:case 7937:case 37445:case 37446:(e=dn.getParameter(t))||We(1280),e=e&&Ye(e);break;case 7938:e=dn.getParameter(7938),e=Ye(e=2<=ze.version?"OpenGL ES 3.0 ("+e+")":"OpenGL ES 2.0 ("+e+")");break;case 35724:var n=(e=dn.getParameter(35724)).match(/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/);null!==n&&(3==n[1].length&&(n[1]+="0"),e="OpenGL ES GLSL ES "+n[1]+" ("+e+")"),e=Ye(e);break;default:We(1280)}De[t]=e}return e},cb:function(t,e){if(2>ze.version)return We(1282),0;var n=Ge[t];return n?0>e||e>=n.length?(We(1281),0):n[e]:7939===t?(n=(n=(n=dn.getSupportedExtensions()||[]).concat(n.map((function(t){return"GL_"+t})))).map((function(t){return Ye(t)})),n=Ge[t]=n,0>e||e>=n.length?(We(1281),0):n[e]):(We(1280),0)},Ha:function(t,e){if(e=F(e),t=Me[t]){var n,r=t,i=r.Oe,a=r.xf;if(!i)for(r.Oe=i={},r.wf={},n=0;n<dn.getProgramParameter(r,35718);++n){var o=dn.getActiveUniform(r,n),s=o.name;o=o.size;var l=qe(s);l=0<l?s.slice(0,l):s;var c=r.kf;for(r.kf+=o,a[l]=[o,c],s=0;s<o;++s)i[c]=s,r.wf[c++]=l}if(r=t.Oe,i=0,a=e,0<(n=qe(e))&&(i=parseInt(e.slice(n+1))>>>0,a=e.slice(0,n)),(a=t.xf[a])&&i<a[0]&&(r[i+=a[1]]=r[i]||dn.getUniformLocation(t,e)))return i}else We(1281);return-1},Ob:function(t,e,n){for(var r=$e[e],i=0;i<e;i++)r[i]=W[n+4*i>>2];dn.invalidateFramebuffer(t,r)},Pb:function(t,e,n,r,i,a,o){for(var s=$e[e],l=0;l<e;l++)s[l]=W[n+4*l>>2];dn.invalidateSubFramebuffer(t,s,r,i,a,o)},Wb:function(t){return dn.isSync(Le[t])},Ia:function(t){return(t=ke[t])?dn.isTexture(t):0},Ja:function(t){dn.lineWidth(t)},La:function(t){t=Me[t],dn.linkProgram(t),t.Oe=0,t.xf={}},oc:function(t,e,n,r,i,a){dn.uf.multiDrawArraysInstancedBaseInstanceWEBGL(t,W,e>>2,W,n>>2,W,r>>2,U,i>>2,a)},pc:function(t,e,n,r,i,a,o,s){dn.uf.multiDrawElementsInstancedBaseVertexBaseInstanceWEBGL(t,W,e>>2,n,W,r>>2,W,i>>2,W,a>>2,U,o>>2,s)},Ma:function(t,e){3317==t&&(je=e),dn.pixelStorei(t,e)},rc:function(t){dn.readBuffer(t)},Na:function(t,e,n,r,i,a,o){if(2<=ze.version)if(dn.ff)dn.readPixels(t,e,n,r,i,a,o);else{var s=Xe(a);dn.readPixels(t,e,n,r,i,a,s,o>>31-Math.clz32(s.BYTES_PER_ELEMENT))}else(o=Ke(a,i,n,r,o))?dn.readPixels(t,e,n,r,i,a,o):We(1280)},bc:function(t,e,n,r){dn.renderbufferStorage(t,e,n,r)},Yb:function(t,e,n,r,i){dn.renderbufferStorageMultisample(t,e,n,r,i)},Tb:function(t,e,n){dn.samplerParameteri(Ie[t],e,n)},Ub:function(t,e,n){dn.samplerParameteri(Ie[t],e,W[n>>2])},Oa:function(t,e,n,r){dn.scissor(t,e,n,r)},Pa:function(t,e,n,r){for(var i="",a=0;a<e;++a){var o=r?W[r+4*a>>2]:-1;i+=F(W[n+4*a>>2],0>o?void 0:o)}dn.shaderSource(Oe[t],i)},Qa:function(t,e,n){dn.stencilFunc(t,e,n)},Ra:function(t,e,n,r){dn.stencilFuncSeparate(t,e,n,r)},Sa:function(t){dn.stencilMask(t)},Ta:function(t,e){dn.stencilMaskSeparate(t,e)},Ua:function(t,e,n){dn.stencilOp(t,e,n)},Va:function(t,e,n,r){dn.stencilOpSeparate(t,e,n,r)},Wa:function(t,e,n,r,i,a,o,s,l){if(2<=ze.version)if(dn.Ce)dn.texImage2D(t,e,n,r,i,a,o,s,l);else if(l){var c=Xe(s);dn.texImage2D(t,e,n,r,i,a,o,s,c,l>>31-Math.clz32(c.BYTES_PER_ELEMENT))}else dn.texImage2D(t,e,n,r,i,a,o,s,null);else dn.texImage2D(t,e,n,r,i,a,o,s,l?Ke(s,o,r,i,l):null)},Xa:function(t,e,n){dn.texParameterf(t,e,n)},Ya:function(t,e,n){dn.texParameterf(t,e,N[n>>2])},Za:function(t,e,n){dn.texParameteri(t,e,n)},_a:function(t,e,n){dn.texParameteri(t,e,W[n>>2])},lc:function(t,e,n,r,i){dn.texStorage2D(t,e,n,r,i)},$a:function(t,e,n,r,i,a,o,s,l){if(2<=ze.version)if(dn.Ce)dn.texSubImage2D(t,e,n,r,i,a,o,s,l);else if(l){var c=Xe(s);dn.texSubImage2D(t,e,n,r,i,a,o,s,c,l>>31-Math.clz32(c.BYTES_PER_ELEMENT))}else dn.texSubImage2D(t,e,n,r,i,a,o,s,null);else c=null,l&&(c=Ke(s,o,i,a,l)),dn.texSubImage2D(t,e,n,r,i,a,o,s,c)},ab:function(t,e){dn.uniform1f(Qe(t),e)},bb:function(t,e,n){if(2<=ze.version)dn.uniform1fv(Qe(t),N,n>>2,e);else{if(288>=e)for(var r=Je[e-1],i=0;i<e;++i)r[i]=N[n+4*i>>2];else r=N.subarray(n>>2,n+4*e>>2);dn.uniform1fv(Qe(t),r)}},Wc:function(t,e){dn.uniform1i(Qe(t),e)},Xc:function(t,e,n){if(2<=ze.version)dn.uniform1iv(Qe(t),W,n>>2,e);else{if(288>=e)for(var r=tn[e-1],i=0;i<e;++i)r[i]=W[n+4*i>>2];else r=W.subarray(n>>2,n+4*e>>2);dn.uniform1iv(Qe(t),r)}},Yc:function(t,e,n){dn.uniform2f(Qe(t),e,n)},Zc:function(t,e,n){if(2<=ze.version)dn.uniform2fv(Qe(t),N,n>>2,2*e);else{if(144>=e)for(var r=Je[2*e-1],i=0;i<2*e;i+=2)r[i]=N[n+4*i>>2],r[i+1]=N[n+(4*i+4)>>2];else r=N.subarray(n>>2,n+8*e>>2);dn.uniform2fv(Qe(t),r)}},Vc:function(t,e,n){dn.uniform2i(Qe(t),e,n)},Uc:function(t,e,n){if(2<=ze.version)dn.uniform2iv(Qe(t),W,n>>2,2*e);else{if(144>=e)for(var r=tn[2*e-1],i=0;i<2*e;i+=2)r[i]=W[n+4*i>>2],r[i+1]=W[n+(4*i+4)>>2];else r=W.subarray(n>>2,n+8*e>>2);dn.uniform2iv(Qe(t),r)}},Tc:function(t,e,n,r){dn.uniform3f(Qe(t),e,n,r)},Sc:function(t,e,n){if(2<=ze.version)dn.uniform3fv(Qe(t),N,n>>2,3*e);else{if(96>=e)for(var r=Je[3*e-1],i=0;i<3*e;i+=3)r[i]=N[n+4*i>>2],r[i+1]=N[n+(4*i+4)>>2],r[i+2]=N[n+(4*i+8)>>2];else r=N.subarray(n>>2,n+12*e>>2);dn.uniform3fv(Qe(t),r)}},Rc:function(t,e,n,r){dn.uniform3i(Qe(t),e,n,r)},Qc:function(t,e,n){if(2<=ze.version)dn.uniform3iv(Qe(t),W,n>>2,3*e);else{if(96>=e)for(var r=tn[3*e-1],i=0;i<3*e;i+=3)r[i]=W[n+4*i>>2],r[i+1]=W[n+(4*i+4)>>2],r[i+2]=W[n+(4*i+8)>>2];else r=W.subarray(n>>2,n+12*e>>2);dn.uniform3iv(Qe(t),r)}},Pc:function(t,e,n,r,i){dn.uniform4f(Qe(t),e,n,r,i)},Oc:function(t,e,n){if(2<=ze.version)dn.uniform4fv(Qe(t),N,n>>2,4*e);else{if(72>=e){var r=Je[4*e-1],i=N;n>>=2;for(var a=0;a<4*e;a+=4){var o=n+a;r[a]=i[o],r[a+1]=i[o+1],r[a+2]=i[o+2],r[a+3]=i[o+3]}}else r=N.subarray(n>>2,n+16*e>>2);dn.uniform4fv(Qe(t),r)}},Cc:function(t,e,n,r,i){dn.uniform4i(Qe(t),e,n,r,i)},Dc:function(t,e,n){if(2<=ze.version)dn.uniform4iv(Qe(t),W,n>>2,4*e);else{if(72>=e)for(var r=tn[4*e-1],i=0;i<4*e;i+=4)r[i]=W[n+4*i>>2],r[i+1]=W[n+(4*i+4)>>2],r[i+2]=W[n+(4*i+8)>>2],r[i+3]=W[n+(4*i+12)>>2];else r=W.subarray(n>>2,n+16*e>>2);dn.uniform4iv(Qe(t),r)}},Ec:function(t,e,n,r){if(2<=ze.version)dn.uniformMatrix2fv(Qe(t),!!n,N,r>>2,4*e);else{if(72>=e)for(var i=Je[4*e-1],a=0;a<4*e;a+=4)i[a]=N[r+4*a>>2],i[a+1]=N[r+(4*a+4)>>2],i[a+2]=N[r+(4*a+8)>>2],i[a+3]=N[r+(4*a+12)>>2];else i=N.subarray(r>>2,r+16*e>>2);dn.uniformMatrix2fv(Qe(t),!!n,i)}},Fc:function(t,e,n,r){if(2<=ze.version)dn.uniformMatrix3fv(Qe(t),!!n,N,r>>2,9*e);else{if(32>=e)for(var i=Je[9*e-1],a=0;a<9*e;a+=9)i[a]=N[r+4*a>>2],i[a+1]=N[r+(4*a+4)>>2],i[a+2]=N[r+(4*a+8)>>2],i[a+3]=N[r+(4*a+12)>>2],i[a+4]=N[r+(4*a+16)>>2],i[a+5]=N[r+(4*a+20)>>2],i[a+6]=N[r+(4*a+24)>>2],i[a+7]=N[r+(4*a+28)>>2],i[a+8]=N[r+(4*a+32)>>2];else i=N.subarray(r>>2,r+36*e>>2);dn.uniformMatrix3fv(Qe(t),!!n,i)}},Gc:function(t,e,n,r){if(2<=ze.version)dn.uniformMatrix4fv(Qe(t),!!n,N,r>>2,16*e);else{if(18>=e){var i=Je[16*e-1],a=N;r>>=2;for(var o=0;o<16*e;o+=16){var s=r+o;i[o]=a[s],i[o+1]=a[s+1],i[o+2]=a[s+2],i[o+3]=a[s+3],i[o+4]=a[s+4],i[o+5]=a[s+5],i[o+6]=a[s+6],i[o+7]=a[s+7],i[o+8]=a[s+8],i[o+9]=a[s+9],i[o+10]=a[s+10],i[o+11]=a[s+11],i[o+12]=a[s+12],i[o+13]=a[s+13],i[o+14]=a[s+14],i[o+15]=a[s+15]}}else i=N.subarray(r>>2,r+64*e>>2);dn.uniformMatrix4fv(Qe(t),!!n,i)}},Hc:function(t){t=Me[t],dn.useProgram(t),dn.Gf=t},Ic:function(t,e){dn.vertexAttrib1f(t,e)},Jc:function(t,e){dn.vertexAttrib2f(t,N[e>>2],N[e+4>>2])},Kc:function(t,e){dn.vertexAttrib3f(t,N[e>>2],N[e+4>>2],N[e+8>>2])},Lc:function(t,e){dn.vertexAttrib4f(t,N[e>>2],N[e+4>>2],N[e+8>>2],N[e+12>>2])},mc:function(t,e){dn.vertexAttribDivisor(t,e)},nc:function(t,e,n,r,i){dn.vertexAttribIPointer(t,e,n,r,i)},Mc:function(t,e,n,r,i,a){dn.vertexAttribPointer(t,e,n,!!r,i,a)},Nc:function(t,e,n,r){dn.viewport(t,e,n,r)},eb:function(t,e,n,r){dn.waitSync(Le[t],e,(n>>>0)+4294967296*r)},qb:function(t){var e=D.length;if(2147483648<(t>>>=0))return!1;for(var n=1;4>=n;n*=2){var r=e*(1+.2/n);r=Math.min(r,t+100663296),0<(r=Math.max(t,r))%65536&&(r+=65536-r%65536);t:{try{_.grow(Math.min(2147483648,r)-I.byteLength+65535>>>16),Q();var i=1;break t}catch(t){}i=void 0}if(i)return!0}return!1},ib:function(){return ze?ze.Vf:0},ub:function(t,e){var n=0;return nn().forEach((function(r,i){var a=e+n;for(i=W[t+4*i>>2]=a,a=0;a<r.length;++a)L[i++>>0]=r.charCodeAt(a);L[i>>0]=0,n+=r.length+1})),0},vb:function(t,e){var n=nn();W[t>>2]=n.length;var r=0;return n.forEach((function(t){r+=t.length+1})),W[e>>2]=r,0},Hb:function(t){T||0<nt||(e.onExit&&e.onExit(t),P=!0),g(t,new Pn(t))},G:function(){return 0},kb:function(t,e,n,r,i,a){return t=mt.Rf(t),e=mt.If(t,e,n,r),W[a>>2]=e,0},Ab:function(t,e,n,r){return t=mt.Rf(t),e=mt.If(t,e,n),W[r>>2]=e,0},lb:function(){},N:function(t,e,n,r){for(var i=0,a=0;a<n;a++){var o=W[e>>2],s=W[e+4>>2];e+=8;for(var l=0;l<s;l++){var c=D[o+l],u=gt[t];0===c||10===c?((1===t?b:S)(M(u,0)),u.length=0):u.push(c)}i+=s}return W[r>>2]=i,0},b:function(){return C},i:function(t,e){var n=Tn();try{return dt(t)(e)}catch(t){if(_n(n),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},n:function(t,e,n){var r=Tn();try{return dt(t)(e,n)}catch(t){if(_n(r),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},f:function(t,e,n,r){var i=Tn();try{return dt(t)(e,n,r)}catch(t){if(_n(i),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},C:function(t,e,n,r,i){var a=Tn();try{return dt(t)(e,n,r,i)}catch(t){if(_n(a),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},Mb:function(t,e,n,r,i,a){var o=Tn();try{return dt(t)(e,n,r,i,a)}catch(t){if(_n(o),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},U:function(t,e,n,r,i,a,o){var s=Tn();try{return dt(t)(e,n,r,i,a,o)}catch(t){if(_n(s),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},T:function(t,e,n,r,i,a,o,s,l,c){var u=Tn();try{return dt(t)(e,n,r,i,a,o,s,l,c)}catch(t){if(_n(u),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},I:function(t){var e=Tn();try{dt(t)()}catch(t){if(_n(e),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},m:function(t,e){var n=Tn();try{dt(t)(e)}catch(t){if(_n(n),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},s:function(t,e,n){var r=Tn();try{dt(t)(e,n)}catch(t){if(_n(r),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},h:function(t,e,n,r){var i=Tn();try{dt(t)(e,n,r)}catch(t){if(_n(i),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},q:function(t,e,n,r,i){var a=Tn();try{dt(t)(e,n,r,i)}catch(t){if(_n(a),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},Kb:function(t,e,n,r,i,a){var o=Tn();try{dt(t)(e,n,r,i,a)}catch(t){if(_n(o),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},Ib:function(t,e,n,r,i,a,o){var s=Tn();try{dt(t)(e,n,r,i,a,o)}catch(t){if(_n(s),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},Jb:function(t,e,n,r,i,a,o,s,l,c){var u=Tn();try{dt(t)(e,n,r,i,a,o,s,l,c)}catch(t){if(_n(u),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},c:function(t){C=t},nb:function(t,e,n,r){return cn(t,e,n,r)}};!function(){function t(t){e.asm=t.exports,_=e.asm.bd,Q(),Z=e.asm.dd,tt.unshift(e.asm.cd),at--,e.monitorRunDependencies&&e.monitorRunDependencies(at),0==at&&ot&&(t=ot,ot=null,t())}function n(e){t(e.instance)}function r(t){return function(){if(!A&&(m||y)){if("function"==typeof fetch&&!it.startsWith("file://"))return fetch(it,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+it+"'";return t.arrayBuffer()})).catch((function(){return ut()}));if(l)return new Promise((function(t,e){l(it,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return ut()}))}().then((function(t){return WebAssembly.instantiate(t,a)})).then((function(t){return t})).then(t,(function(t){S("failed to asynchronously prepare wasm: "+t),st(t)}))}var a={a:mn};if(at++,e.monitorRunDependencies&&e.monitorRunDependencies(at),e.instantiateWasm)try{return e.instantiateWasm(a,t)}catch(t){return S("Module.instantiateWasm callback failed with error: "+t),!1}(A||"function"!=typeof WebAssembly.instantiateStreaming||lt()||it.startsWith("file://")||"function"!=typeof fetch?r(n):fetch(it,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,a).then(n,(function(t){return S("wasm streaming compile failed: "+t),S("falling back to ArrayBuffer instantiation"),r(n)}))}))).catch(i)}(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.cd).apply(null,arguments)};var yn=e._malloc=function(){return(yn=e._malloc=e.asm.ed).apply(null,arguments)},vn=e._free=function(){return(vn=e._free=e.asm.fd).apply(null,arguments)},wn=e.___errno_location=function(){return(wn=e.___errno_location=e.asm.gd).apply(null,arguments)},bn=e.___getTypeName=function(){return(bn=e.___getTypeName=e.asm.hd).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.id).apply(null,arguments)};var Sn,An=e._memalign=function(){return(An=e._memalign=e.asm.jd).apply(null,arguments)},Cn=e._setThrew=function(){return(Cn=e._setThrew=e.asm.kd).apply(null,arguments)},Tn=e.stackSave=function(){return(Tn=e.stackSave=e.asm.ld).apply(null,arguments)},_n=e.stackRestore=function(){return(_n=e.stackRestore=e.asm.md).apply(null,arguments)};function Pn(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function xn(){function t(){if(!Sn&&(Sn=!0,e.calledRun=!0,!P)){if(ht(tt),r(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var t=e.postRun.shift();et.unshift(t)}ht(et)}}if(!(0<at)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)rt();ht(J),0<at||(e.setStatus?(e.setStatus("Running..."),setTimeout((function(){setTimeout((function(){e.setStatus("")}),1),t()}),1)):t())}}if(e.dynCall_iiiji=function(){return(e.dynCall_iiiji=e.asm.nd).apply(null,arguments)},e.dynCall_ji=function(){return(e.dynCall_ji=e.asm.od).apply(null,arguments)},e.dynCall_iiji=function(){return(e.dynCall_iiji=e.asm.pd).apply(null,arguments)},e.dynCall_iijjiii=function(){return(e.dynCall_iijjiii=e.asm.qd).apply(null,arguments)},e.dynCall_iij=function(){return(e.dynCall_iij=e.asm.rd).apply(null,arguments)},e.dynCall_vijjjii=function(){return(e.dynCall_vijjjii=e.asm.sd).apply(null,arguments)},e.dynCall_viji=function(){return(e.dynCall_viji=e.asm.td).apply(null,arguments)},e.dynCall_vijiii=function(){return(e.dynCall_vijiii=e.asm.ud).apply(null,arguments)},e.dynCall_viiiiij=function(){return(e.dynCall_viiiiij=e.asm.vd).apply(null,arguments)},e.dynCall_jii=function(){return(e.dynCall_jii=e.asm.wd).apply(null,arguments)},e.dynCall_iiij=function(){return(e.dynCall_iiij=e.asm.xd).apply(null,arguments)},e.dynCall_iiiij=function(){return(e.dynCall_iiiij=e.asm.yd).apply(null,arguments)},e.dynCall_viij=function(){return(e.dynCall_viij=e.asm.zd).apply(null,arguments)},e.dynCall_viiij=function(){return(e.dynCall_viiij=e.asm.Ad).apply(null,arguments)},e.dynCall_vij=function(){return(e.dynCall_vij=e.asm.Bd).apply(null,arguments)},e.dynCall_jiiii=function(){return(e.dynCall_jiiii=e.asm.Cd).apply(null,arguments)},e.dynCall_jiiiiii=function(){return(e.dynCall_jiiiiii=e.asm.Dd).apply(null,arguments)},e.dynCall_jiiiiji=function(){return(e.dynCall_jiiiiji=e.asm.Ed).apply(null,arguments)},e.dynCall_iijj=function(){return(e.dynCall_iijj=e.asm.Fd).apply(null,arguments)},e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.Gd).apply(null,arguments)},e.dynCall_viijii=function(){return(e.dynCall_viijii=e.asm.Hd).apply(null,arguments)},e.dynCall_iiiiij=function(){return(e.dynCall_iiiiij=e.asm.Id).apply(null,arguments)},e.dynCall_iiiiijj=function(){return(e.dynCall_iiiiijj=e.asm.Jd).apply(null,arguments)},e.dynCall_iiiiiijj=function(){return(e.dynCall_iiiiiijj=e.asm.Kd).apply(null,arguments)},ot=function t(){Sn||xn(),Sn||(ot=t)},e.run=xn,e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();return xn(),t.ready});t.exports=r}(O);const I=O.exports;class L{constructor(t){this.startTime=NaN,this.stopTime=NaN,this.stopped=!0,this.cumulativeElapsed=NaN,this.name=t}static now(){return window.performance.now()}static start(t){let e=this._timers.filter((e=>e.name===t)).find(Boolean);if(void 0===e)e=new L(t),e.cumulativeElapsed=0,this._timers.push(e);else if(0==e.stopped)throw new Error(`can't start timer. timer with name ${t} is already started`);e.startTime=window.performance.now(),e.stopped=!1}static stop(t){const e=this._timers.filter((e=>e.name===t)).find(Boolean);if(void 0===e)throw new Error(`can't stop timer. timer with name ${t} does not exist`);if(!0===e.stopped)throw new Error(`can't stop timer. timer with name ${t} is already stopped`);e.stopTime=window.performance.now(),e.cumulativeElapsed=e.cumulativeElapsed+e.stopTime-e.startTime,e.stopped=!0}static restart(t){const e=this._timers.filter((e=>e.name===t)).find(Boolean);if(void 0===e)throw new Error(`can't restart timer. timer with name ${t} does not exist`);e.startTime=window.performance.now(),e.cumulativeElapsed=0,e.stopped=!1}static elapsed(t){const e=this._timers.filter((e=>e.name===t)).find(Boolean);if(void 0===e)throw new Error(`can't get elapsed time. timer with name ${t} does not exist`);return e.stopped?e.cumulativeElapsed:e.cumulativeElapsed+window.performance.now()-e.startTime}static remove(t){if(void 0===this._timers.filter((e=>e.name===t)).find(Boolean))throw new Error(`can't remove timer. timer with name ${t} does not exist`);this._timers=this._timers.filter((e=>e.name!=t))}static removeAll(){this._timers=new Array}static exists(t){return this._timers.some((e=>e.name===t))}}L._timers=new Array;class D{static generate(){let t=(new Date).getTime(),e=performance&&performance.now&&1e3*performance.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(n=>{let r=16*Math.random();return t>0?(r=(t+r)%16|0,t=Math.floor(t/16)):(r=(e+r)%16|0,e=Math.floor(e/16)),("x"==n?r:7&r|8).toString(16)}))}}class G{constructor(t){this.uuid=D.generate(),this.options=t,this.fontManager=new F,this.imageManager=new m,this.options.activities.forEach((t=>t.session=this))}init(){var t;return u(this,void 0,void 0,(function*(){L.start("sessionInit"),this.options.activities.forEach((t=>t.init()));const[e]=yield this.getAsynchronousAssets();this.loadAssets(e),console.log(`Session.init() took ${L.elapsed("sessionInit").toFixed(0)} ms`),L.remove("sessionInit");const r=null===(t=this.options.sessionCallbacks)||void 0===t?void 0:t.onSessionLifecycleChange;r&&r({eventType:n.sessionLifecycle,initialized:!0,ended:!1})}))}start(){var t;this.currentActivity=this.options.activities.find(Boolean),this.logStartingActivity(),null===(t=this.currentActivity)||void 0===t||t.start()}end(){var t;const e=null===(t=this.options.sessionCallbacks)||void 0===t?void 0:t.onSessionLifecycleChange;e&&e({eventType:n.sessionLifecycle,initialized:!1,ended:!0})}advanceToNextActivity(){if(!this.currentActivity)throw new Error("error in advanceToNextActivity(): no current activity");if(!this.nextActivity)throw new Error("error in advanceToNextActivity(): no next activity");this.currentActivity.stop(),this.currentActivity=this.nextActivity,this.logStartingActivity(),this.currentActivity.start()}get nextActivity(){if(!this.currentActivity)throw new Error("error in get nextActivity(): no current activity");if(this.options.activities.indexOf(this.currentActivity)===this.options.activities.length-1)return;const t=this.options.activities.indexOf(this.currentActivity);return this.options.activities[t+1]}logStartingActivity(){if(this.currentActivity&&this.currentActivity.type==e.game){const t=this.currentActivity,e=t.options.version?`, version ${t.options.version}`:"";console.log(`starting game: ${t.options.name+e}`)}}getAsynchronousAssets(){return u(this,void 0,void 0,(function*(){const t=this.loadCanvasKit(),e=this.fontManager.fetchFonts(this.getFontsConfigurationFromGames()),n=this.imageManager.renderImages(this.getImagesConfigurationFromGames());return yield Promise.all([t,e,n])}))}loadCanvasKit(){return I({locateFile:t=>t})}loadAssets(t){this.assignCanvasKit(t),this.fontManager.loadAllGamesFontData(),this.imageManager.loadAllGamesRenderedImages()}assignCanvasKit(t){this.canvasKit=t,this.fontManager.canvasKit=this.canvasKit,this.imageManager.canvasKit=this.canvasKit,this.options.activities.filter((t=>t.type==e.game)).forEach((e=>{e.canvasKit=t}))}getFontsConfigurationFromGames(){return this.options.activities.filter((t=>t.type==e.game)).map((t=>{var e;const n=t;return{uuid:n.uuid,fontUrls:null!==(e=n.options.fontUrls)&&void 0!==e?e:[]}}))}getImagesConfigurationFromGames(){return this.options.activities.filter((t=>t.type==e.game)).map((t=>{var e;const n=t;return{uuid:n.uuid,images:null!==(e=n.options.images)&&void 0!==e?e:[]}}))}}var j,W,U,N,z,H,$;!function(t){t.topToTopOf="topToTopOf",t.topToBottomOf="topToBottomOf",t.bottomToTopOf="bottomToTopOf",t.bottomToBottomOf="bottomToBottomOf",t.startToStartOf="startToStartOf",t.startToEndOf="startToEndOf",t.endToEndOf="endToEndOf",t.endToStartOf="endToStartOf"}(j||(j={}));class V{constructor(t,e){this.verticalConstraint=!1,this.focalEntityMinimum=!1,this.alterEntityMinimum=!1,this.verticalTypes=[j.topToTopOf,j.topToBottomOf,j.bottomToTopOf,j.bottomToBottomOf],this.focalEntityMinimumTypes=[j.topToTopOf,j.topToBottomOf,j.startToStartOf,j.startToEndOf],this.alterEntityMinimumTypes=[j.topToTopOf,j.bottomToTopOf,j.startToStartOf,j.endToStartOf],this.type=t,this.alterEntity=e,this.verticalTypes.includes(t)?(this.verticalConstraint=!0,this.focalEntityMinimumTypes.includes(t)?this.focalEntityMinimum=!0:this.focalEntityMinimum=!1,this.alterEntityMinimumTypes.includes(t)?this.alterEntityMinimum=!0:this.alterEntityMinimum=!1):(this.verticalConstraint=!1,this.focalEntityMinimumTypes.includes(t)?this.focalEntityMinimum=!0:this.focalEntityMinimum=!1,this.alterEntityMinimumTypes.includes(t)?this.alterEntityMinimum=!0:this.alterEntityMinimum=!1)}}function Y(t,e){t.isDrawable&&function(t,e){e.anchorPoint&&(t.anchorPoint=e.anchorPoint),e.zPosition&&(t.zPosition=e.zPosition)}(t,e),t.isText&&function(t,e){e.text&&(t.text=e.text),e.fontName&&(t.fontName=e.fontName),e.fontColor&&(t.fontColor=e.fontColor),e.fontSize&&(t.fontSize=e.fontSize)}(t,e)}!function(t){t.entity="Entity",t.scene="Scene",t.sprite="Sprite",t.label="Label",t.textline="TextLine",t.shape="Shape",t.composite="Composite"}(W||(W={}));class q{constructor(t={}){this.type=W.entity,this.isDrawable=!1,this.isShape=!1,this.isText=!1,this.position={x:0,y:0},this.scale=1,this.isUserInteractionEnabled=!1,this.hidden=!1,this.layout={},this.children=new Array,this.absolutePosition={x:0,y:0},this.size={width:0,height:0},this.absoluteScale=1,this.actions=new Array,this.originalActions=new Array,this.eventListeners=new Array,this.uuid=D.generate(),this.needsInitialization=!0,this.userData={},this.loopMessages=new Set,this.toString=()=>this.name!==this.uuid?`"${this.name}" (${this.type}, ${this.uuid})`:`"${this.type} (${this.uuid})`,void 0===t.name?this.name=this.uuid:this.name=t.name,t.position&&(this.position=t.position),t.scale&&(this.scale=t.scale),t.isUserInteractionEnabled&&(this.isUserInteractionEnabled=t.isUserInteractionEnabled),t.layout&&(this.layout=t.layout)}initialize(){throw new Error("initialize() called in abstract base class Entity.")}addChild(t){if(t.type==W.scene)throw new Error("A scene cannot be the child of an entity. A scene can only be added to a game object");if(t.parent=this,this.children.map((t=>t.name)).includes(t.name))throw new Error(`Cannot add child entity ${t.toString()} to parent entity ${this.toString()}. A child with name "${t.name}" already exists on parent.`);this.children.push(t)}removeAllChildren(){for(;this.children.length;)this.children.pop()}removeChild(t){if(!this.children.includes(t))throw new Error(`cannot remove entity ${t} from parent ${this} because the entity is not currently a child of the parent`);this.children=this.children.filter((t=>t!=t))}descendant(t){const e=this.descendants.filter((e=>e.name===t)).find(Boolean);if(void 0===e)throw new Error(`descendant with name ${t} not found on parent ${this.toString()}`);return e}get descendants(){function t(e,n){n.push(e),e.children.forEach((e=>t(e,n)))}const e=new Array;return this.children.forEach((n=>t(n,e))),e}onTapDown(t,e=!0){const n={eventType:"tapdown",entityName:this.name,callback:t};e&&(this.eventListeners=this.eventListeners.filter((t=>t.entityName!==n.entityName))),this.eventListeners.push(n)}parseLayoutConstraints(t,e){const n=new Array;return Object.values(j).forEach((r=>{if(void 0!==t[r]){let i,a="";if(t[r]instanceof q)i=t[r];else{const n=t[r];i=e.filter((t=>t.name===n)).find(Boolean),a=`. sibling entity named "${n}" has not been added to the game object`}if(void 0===i)throw new Error("could not find sibling entity for constraint"+a);const o=new V(r,i);n.push(o)}})),n}calculateYFromConstraint(t,e,n,r){let i=t.alterEntity.absolutePosition.y;return t.alterEntityMinimum?t.alterEntity.type!==W.scene&&(i-=.5*t.alterEntity.size.height*r):t.alterEntity.type!==W.scene?i+=.5*t.alterEntity.size.height*r:i+=t.alterEntity.size.height*r,t.focalEntityMinimum?(i+=.5*this.size.height*r,i+=e*r):(i-=.5*this.size.height*r,i-=n*r),i}calculateXFromConstraint(t,e,n,r){let i=t.alterEntity.absolutePosition.x;return t.alterEntityMinimum?t.alterEntity.type!==W.scene&&(i-=.5*t.alterEntity.size.width*r):t.alterEntity.type!==W.scene?i+=.5*t.alterEntity.size.width*r:i+=t.alterEntity.size.width*r,t.focalEntityMinimum?(i+=.5*this.size.width*r,i+=e*r):(i-=.5*this.size.width*r,i-=n*r),i}update(){var t,e,n,i,a,o,s,l,c,u,h,d,f,p,g,m;if(this.needsInitialization&&(this.initialize(),this.needsInitialization=!1),void 0===this.parent)this.absolutePosition.x=this.position.x*this.scale,this.absolutePosition.y=this.position.y*this.scale,this.absoluteScale=this.scale;else if(this.absoluteScale=this.parent.absoluteScale*this.scale,void 0===(null===(t=this.layout)||void 0===t?void 0:t.constraints))this.absolutePosition.x=this.parent.absolutePosition.x+this.position.x*this.parent.absoluteScale,this.absolutePosition.y=this.parent.absolutePosition.y+this.position.y*this.parent.absoluteScale;else{const t=null!==(i=null===(n=null===(e=this.layout)||void 0===e?void 0:e.constraints)||void 0===n?void 0:n.horizontalBias)&&void 0!==i?i:.5,r=null!==(s=null===(o=null===(a=this.layout)||void 0===a?void 0:a.constraints)||void 0===o?void 0:o.verticalBias)&&void 0!==s?s:.5,y=null!==(c=null===(l=this.layout)||void 0===l?void 0:l.marginTop)&&void 0!==c?c:0,v=null!==(h=null===(u=this.layout)||void 0===u?void 0:u.marginBottom)&&void 0!==h?h:0,w=null!==(f=null===(d=this.layout)||void 0===d?void 0:d.marginStart)&&void 0!==f?f:0,b=null!==(g=null===(p=this.layout)||void 0===p?void 0:p.marginEnd)&&void 0!==g?g:0,S=this.parseLayoutConstraints(null===(m=this.layout)||void 0===m?void 0:m.constraints,this.parentSceneAsEntity.descendants),A=this.parent.absoluteScale,C=S.filter((t=>t.verticalConstraint)).map((t=>this.calculateYFromConstraint(t,y,v,A)));0===C.length||(1===C.length?this.absolutePosition.y=C[0]:2===C.length&&(this.absolutePosition.y=Math.min(C[0],C[1])+r*Math.abs(C[0]-C[1])));const T=S.filter((t=>!t.verticalConstraint)).map((t=>this.calculateXFromConstraint(t,w,b,A)));0===T.length||(1===T.length?this.absolutePosition.x=T[0]:2===T.length&&(this.absolutePosition.x=Math.min(T[0],T[1])+t*Math.abs(T[0]-T[1])))}const y=this.actions.filter((t=>t.runDuringTransition&&!t.completed)),v=this.actions.filter((t=>!t.runDuringTransition&&!t.completed));y.length>0?(y.forEach((t=>{-1===t.runStartTime&&(t.runStartTime=Globals.now)})),y.forEach((t=>r.evaluateAction(t,this,Globals.now,Globals.deltaTime)))):v.length>0&&(v.forEach((t=>{-1===t.runStartTime&&(t.runStartTime=Globals.now)})),v.forEach((t=>r.evaluateAction(t,this,Globals.now,Globals.deltaTime))));const w=new Map;this.children.forEach((t=>{var e;w.set(t.uuid,function(t,e){const n=new Array;return void 0===e||Object.values(j).forEach((r=>{if(void 0!==e[r]){let i,a="";if(e[r]instanceof q)i=e[r];else{const n=e[r];let o;o=t.type===W.scene?t.descendants:t.parentSceneAsEntity.descendants,i=o.filter((t=>t.name===n)).find(Boolean),void 0===i&&(a=`. sibling entity named "${n}" has not been added to the game object`)}if(void 0===i)throw new Error("error getting uuid of sibling contraint"+a);i!==t&&n.push(i.uuid)}})),n}(this,null===(e=t.layout)||void 0===e?void 0:e.constraints))}));const b=this.findTopologicalSort(w);if(b.length>0){const t=b.reverse(),e=new Array;t.forEach((t=>{const n=this.children.filter((e=>e.uuid===t)).find(Boolean);if(void 0===n)throw new Error("error in dag topological sort");e.push(n)})),e.forEach((t=>t.update()))}else this.children.forEach((t=>t.update()))}drawChildren(t){this.children.filter((t=>!t.hidden&&t.isDrawable)).map((t=>t)).sort(((t,e)=>t.zPosition-e.zPosition)).forEach((e=>e.draw(t)))}run(t,e){this.actions.push(...t.initialize(this,e)),this.originalActions=this.actions.filter((t=>!1===t.runDuringTransition)).map((t=>r.cloneAction(t,e)))}removeAction(t){this.actions=this.actions.filter((e=>e.key!==t))}removeAllActions(){for(;this.actions.length;)this.actions.pop()}getEntityOptions(){return{name:this.name,position:this.position,scale:this.scale,isUserInteractionEnabled:this.isUserInteractionEnabled,hidden:this.hidden}}getDrawableOptions(){if(!this.isDrawable)throw new Error("getDrawableOptions() called object that is not IDrawable");return{anchorPoint:this.anchorPoint,zPosition:this.zPosition}}getTextOptions(){if(!this.isText)throw new Error("getTextOptions() called object that is not IText");return{text:this.text,fontName:this.fontName,fontColor:this.fontColor,fontSize:this.fontSize}}get canvasKit(){let t;return t=this.type===W.scene?this:this.parentSceneAsEntity,t.game.canvasKit}get parentSceneAsEntity(){if(this.type===W.scene)throw new Error(`Entity ${this} is a scene and cannot have a parent scene`);if(this.parent&&this.parent.type===W.scene)return this.parent;if(this.parent)return this.parent.parentSceneAsEntity;throw new Error(`Entity ${this} has not been added to a scene`)}findTopologicalSort(t){var e;const n=[],r=new Map;t.forEach(((t,e)=>{r.has(e)||r.set(e,0),t.forEach((t=>{r.has(t)?r.set(t,r.get(t)+1):r.set(t,1)}))}));const i=[];for(r.forEach(((t,e)=>{0==t&&i.push(e)}));i.length>0;){const a=i.shift();if(void 0===a)throw"bad";n.push(a),t.has(a)&&(null===(e=t.get(a))||void 0===e||e.forEach((t=>{if(r.has(t)&&r.get(t)>0){const e=r.get(t)-1;r.set(t,e),0==e&&i.push(t)}})))}return n}}class X extends q{constructor(t={}){super(t),this.type=W.composite,this.compositeType="<compositeType>",this.isDrawable=!0,this.anchorPoint={x:.5,y:.5},this.zPosition=0,Y(this,t)}initialize(){}update(){super.update()}draw(t){super.drawChildren(t)}}class K{}K.Transparent=[0,0,0,0],K.MediumVioletRed=[199,21,133,1],K.DeepPink=[255,20,147,1],K.PaleVioletRed=[219,112,147,1],K.HotPink=[255,105,180,1],K.LightPink=[255,182,193,1],K.Pink=[255,192,203,1],K.DarkRed=[139,0,0,1],K.Red=[255,0,0,1],K.Firebrick=[178,34,34,1],K.Crimson=[220,20,60,1],K.IndianRed=[205,92,92,1],K.LightCoral=[240,128,128,1],K.Salmon=[250,128,114,1],K.DarkSalmon=[233,150,122,1],K.LightSalmon=[255,160,122,1],K.OrangeRed=[255,69,0,1],K.Tomato=[255,99,71,1],K.DarkOrange=[255,140,0,1],K.Coral=[255,127,80,1],K.Orange=[255,165,0,1],K.DarkKhaki=[189,183,107,1],K.Gold=[255,215,0,1],K.Khaki=[240,230,140,1],K.PeachPuff=[255,218,185,1],K.Yellow=[255,255,0,1],K.PaleGoldenrod=[238,232,170,1],K.Moccasin=[255,228,181,1],K.PapayaWhip=[255,239,213,1],K.LightGoldenrodYellow=[250,250,210,1],K.LemonChiffon=[255,250,205,1],K.LightYellow=[255,255,224,1],K.Maroon=[128,0,0,1],K.Brown=[165,42,42,1],K.SaddleBrown=[139,69,19,1],K.Sienna=[160,82,45,1],K.Chocolate=[210,105,30,1],K.DarkGoldenrod=[184,134,11,1],K.Peru=[205,133,63,1],K.RosyBrown=[188,143,143,1],K.Goldenrod=[218,165,32,1],K.SandyBrown=[244,164,96,1],K.Tan=[210,180,140,1],K.Burlywood=[222,184,135,1],K.Wheat=[245,222,179,1],K.NavajoWhite=[255,222,173,1],K.Bisque=[255,228,196,1],K.BlanchedAlmond=[255,235,205,1],K.Cornsilk=[255,248,220,1],K.DarkGreen=[0,100,0,1],K.Green=[0,128,0,1],K.DarkOliveGreen=[85,107,47,1],K.ForestGreen=[34,139,34,1],K.SeaGreen=[46,139,87,1],K.Olive=[128,128,0,1],K.OliveDrab=[107,142,35,1],K.MediumSeaGreen=[60,179,113,1],K.LimeGreen=[50,205,50,1],K.Lime=[0,255,0,1],K.SpringGreen=[0,255,127,1],K.MediumSpringGreen=[0,250,154,1],K.DarkSeaGreen=[143,188,143,1],K.MediumAquamarine=[102,205,170,1],K.YellowGreen=[154,205,50,1],K.LawnGreen=[124,252,0,1],K.Chartreuse=[127,255,0,1],K.LightGreen=[144,238,144,1],K.GreenYellow=[173,255,47,1],K.PaleGreen=[152,251,152,1],K.Teal=[0,128,128,1],K.DarkCyan=[0,139,139,1],K.LightSeaGreen=[32,178,170,1],K.CadetBlue=[95,158,160,1],K.DarkTurquoise=[0,206,209,1],K.MediumTurquoise=[72,209,204,1],K.Turquoise=[64,224,208,1],K.Aqua=[0,255,255,1],K.Cyan=[0,255,255,1],K.Aquamarine=[127,255,212,1],K.PaleTurquoise=[175,238,238,1],K.LightCyan=[224,255,255,1],K.Navy=[0,0,128,1],K.DarkBlue=[0,0,139,1],K.MediumBlue=[0,0,205,1],K.Blue=[0,0,255,1],K.MidnightBlue=[25,25,112,1],K.RoyalBlue=[65,105,225,1],K.SteelBlue=[70,130,180,1],K.DodgerBlue=[30,144,255,1],K.DeepSkyBlue=[0,191,255,1],K.CornflowerBlue=[100,149,237,1],K.SkyBlue=[135,206,235,1],K.LightSkyBlue=[135,206,250,1],K.LightSteelBlue=[176,196,222,1],K.LightBlue=[173,216,230,1],K.PowderBlue=[176,224,230,1],K.Indigo=[75,0,130,1],K.Purple=[128,0,128,1],K.DarkMagenta=[139,0,139,1],K.DarkViolet=[148,0,211,1],K.DarkSlateBlue=[72,61,139,1],K.BlueViolet=[138,43,226,1],K.DarkOrchid=[153,50,204,1],K.Fuchsia=[255,0,255,1],K.Magenta=[255,0,255,1],K.SlateBlue=[106,90,205,1],K.MediumSlateBlue=[123,104,238,1],K.MediumOrchid=[186,85,211,1],K.MediumPurple=[147,112,219,1],K.Orchid=[218,112,214,1],K.Violet=[238,130,238,1],K.Plum=[221,160,221,1],K.Thistle=[216,191,216,1],K.Lavender=[230,230,250,1],K.MistyRose=[255,228,225,1],K.AntiqueWhite=[250,235,215,1],K.Linen=[250,240,230,1],K.Beige=[245,245,220,1],K.WhiteSmoke=[245,245,245,1],K.LavenderBlush=[255,240,245,1],K.OldLace=[253,245,230,1],K.AliceBlue=[240,248,255,1],K.Seashell=[255,245,238,1],K.GhostWhite=[248,248,255,1],K.Honeydew=[240,255,240,1],K.FloralWhite=[255,250,240,1],K.Azure=[240,255,255,1],K.MintCream=[245,255,250,1],K.Snow=[255,250,250,1],K.Ivory=[255,255,240,1],K.White=[255,255,255,1],K.Black=[0,0,0,1],K.DarkSlateGray=[47,79,79,1],K.DimGray=[105,105,105,1],K.SlateGray=[112,128,144,1],K.Gray=[128,128,128,1],K.LightSlateGray=[119,136,153,1],K.DarkGray=[169,169,169,1],K.Silver=[192,192,192,1],K.LightGray=[211,211,211,1],K.Gainsboro=[220,220,220,1],K.RebeccaPurple=[102,51,153,1];class Q{}Q.FPS_DISPLAY_TEXT_FONT_SIZE=12,Q.FPS_DISPLAY_TEXT_COLOR=[0,0,0,.5],Q.FPS_DISPLAY_UPDATE_INTERVAL=500,Q.DEFAULT_SCENE_BACKGROUND_COLOR=K.White,Q.DEFAULT_SHAPE_FILL_COLOR=K.Red,Q.DEFAULT_FONT_COLOR=K.Black,Q.DEFAULT_FONT_SIZE=16,Q.LIMITED_FPS_RATE=5,function(t){t[t.MATCH_CONSTRAINT=0]="MATCH_CONSTRAINT"}(U||(U={}));class Z extends q{constructor(t={}){super(t),this.type=W.sprite,this.isDrawable=!0,this.anchorPoint={x:.5,y:.5},this.zPosition=0,this._imageName="",Y(this,t),t.imageName&&(this.imageName=t.imageName)}initialize(){const t=this.parentSceneAsEntity.game.session;if(!t)throw new Error("activity is undefined");const e=t.imageManager,n=this.parentSceneAsEntity.game.uuid;if(this.loadedImage=e.getLoadedImage(n,this._imageName),!this.loadedImage)throw new Error(`could not create sprite. the image named ${this._imageName} has not been loaded`);this.size.width=this.loadedImage.width,this.size.height=this.loadedImage.height}set imageName(t){this._imageName=t,this.needsInitialization=!0}get imageName(){return this._imageName}duplicate(t){const e=new Z(Object.assign(Object.assign(Object.assign({},this.getEntityOptions()),this.getDrawableOptions()),{imageName:this.imageName,name:t}));return this.children.length>0&&(e.children=this.children.map((t=>{const n=t.duplicate();return n.parent=e,n}))),e}update(){super.update()}draw(t){if(!this.hidden){if(this.loadedImage){t.save();const e=Globals.canvasScale/this.absoluteScale;t.scale(1/e,1/e);const n=(this.absolutePosition.x-this.size.width*this.anchorPoint.x*this.absoluteScale)*e,r=(this.absolutePosition.y-this.size.height*this.anchorPoint.y*this.absoluteScale)*e;t.drawImage(this.loadedImage.image,n,r),t.restore()}super.drawChildren(t)}}}class J extends q{constructor(t={}){super(t),this.type=W.scene,this.isDrawable=!0,this.anchorPoint={x:0,y:0},this.zPosition=0,this._backgroundColor=Q.DEFAULT_SCENE_BACKGROUND_COLOR,this._active=!1,this._transitioning=!1,Y(this,t),t.backgroundColor&&(this.backgroundColor=t.backgroundColor)}initialize(){this.scale=Globals.rootScale,this.size.width=this.game.canvasCssWidth,this.size.height=this.game.canvasCssHeight,this.backgroundPaint=new this.canvasKit.Paint,this.backgroundPaint.setColor(this.canvasKit.Color(this.backgroundColor[0],this.backgroundColor[1],this.backgroundColor[2],this.backgroundColor[3])),this.backgroundPaint.setStyle(this.canvasKit.PaintStyle.Fill)}set game(t){this._game=t}get game(){if(void 0===this._game)throw new Error("no active game");return this._game}get backgroundColor(){return this._backgroundColor}set backgroundColor(t){this._backgroundColor=t,this.needsInitialization=!0}duplicate(t){const e=new J(Object.assign(Object.assign(Object.assign({},this.getEntityOptions()),this.getDrawableOptions()),{backgroundColor:this.backgroundColor,name:t}));return e.game=this.game,this.children.length>0&&(e.children=this.children.map((t=>{const n=t.duplicate();return n.parent=e,n}))),e}onSetup(t){this._setupCallback=t}onAppear(t){this._appearCallback=t}draw(t){t.save();const e=Globals.canvasScale/this.absoluteScale;t.scale(1/e,1/e);const n=this.canvasKit.RRectXY(this.canvasKit.LTRBRect(this.position.x*e*Globals.rootScale,this.position.y*e*Globals.rootScale,(this.position.x+this.size.width)*e*Globals.rootScale,(this.position.y+this.size.height)*e*Globals.rootScale),0,0);t.drawRRect(n,this.backgroundPaint),t.restore(),super.drawChildren(t)}}class tt{constructor(){this.duration=0}static push(t,e){return new et(t,e)}}class et extends tt{constructor(t,e){super(),this.type=N.push,this.direction=t,this.duration=e}}!function(t){t.push="Push"}(N||(N={})),function(t){t.up="Up",t.down="Down",t.right="Right",t.left="Left"}(z||(z={}));class nt{constructor(t,e){this.scene=t,this.transition=e}}class rt{constructor(t){this.type=e.game,this.uuid=D.generate(),this.data={trials:new Array,metadata:{}},this.trialIndex=0,this.drawnFrames=0,this.lastFpsUpdate=0,this.nextFpsUpdate=0,this.fps=0,this.animationFramesRequested=0,this.limitFps=!1,this.unitTesting=!1,this.gameStopRequested=!1,this.canvasCssWidth=0,this.canvasCssHeight=0,this.scenes=new Array,this.incomingSceneTransitions=new Array,this.options=t,this.name=t.name}init(){}setParameters(t){const{parameters:e}=this.options;Object.keys(t).forEach((n=>{e&&n in e?this.options.parameters&&this.options.parameters[n]&&(this.options.parameters[n].value=t[n]):console.warn(`game ${this.options.name} does not have a parameter named ${n}. attempt to set parameter ${n} to value ${t[n]} will be ignored`)}))}get canvasKit(){if(!this._canvasKit)throw new Error("canvaskit is undefined");return this._canvasKit}set canvasKit(t){this._canvasKit=t}get session(){if(!this._session)throw new Error("session is undefined");return this._session}set session(t){this._session=t}addScene(t){t.game=this,t.needsInitialization=!0,this.scenes.push(t)}addScenes(t){t.forEach((t=>{this.addScene(t)}))}presentScene(t,e){let n;if("string"==typeof t){if(n=this.scenes.filter((e=>e.name===t)).find(Boolean),void 0===n)throw new Error(`scene ${t} not found`)}else{if(!this.scenes.some((e=>e===t)))throw new Error(`scene ${t} exists, but it has not been added to the game object`);n=t}n.initialize(),n.needsInitialization=!1;const r=new nt(n,e);this.currentSceneSnapshot=void 0,this.incomingSceneTransitions.push(r),void 0!==n.game.bodyBackgroundColor?document.body.style.backgroundColor=`rgb(${n.game.bodyBackgroundColor[0]},${n.game.bodyBackgroundColor[1]},${n.game.bodyBackgroundColor[2]},${n.game.bodyBackgroundColor[3]})`:document.body.style.backgroundColor=`rgb(${n.backgroundColor[0]},${n.backgroundColor[1]},${n.backgroundColor[2]},${n.backgroundColor[3]})`}getParameter(t){if(void 0!==this.options.parameters&&Object.keys(this.options.parameters).includes(t))return this.options.parameters[t].value;throw new Error(`game parameter ${t} not found`)}start(t){var e,n;const r=this.options;let i;if(this.unitTesting=null!==(e=r._unitTesting)&&void 0!==e&&e,this.setupHtmlCanvases(r.canvasId,r.width,r.height,r.stretch),this.showFps=null!==(n=r.showFps)&&void 0!==n&&n,this.bodyBackgroundColor=r.bodyBackgroundColor,this.initData(),this.setupCanvasKitSurface(),this.setupFpsFont(),this.setupEventHandlers(),void 0!==t){if(t instanceof J)i=t;else if(i=i=this.scenes.filter((e=>e.name===t)).find(Boolean),void 0===i)throw new Error(`cannot start game. scene named "${t}" has not been added to the game object`)}else{if(void 0===this.entryScene)throw new Error("cannot start game. the game object's entryScene has not been assigned");if(this.entryScene instanceof J)i=this.entryScene;else if(i=i=this.scenes.filter((t=>t.name===this.entryScene)).find(Boolean),void 0===i)throw new Error(`cannot start game. scene named "${t}" has not been added to the game object`)}if(this.presentScene(i),void 0===this.surface)throw new Error("CanvasKit surface is undefined");this.surface.requestAnimationFrame(this.loop.bind(this))}stop(){this.currentScene&&(this.currentScene._active=!1),this.gameStopRequested=!0}initData(){var t;this.trialIndex=0,this.data={trials:new Array,metadata:{userAgent:navigator.userAgent,devicePixelRatio:window.devicePixelRatio,screen:this.getScreenMetadata()}};const e=null!==(t=this.options.trialSchema)&&void 0!==t?t:{},n=Object.entries(e),r=["number","string","boolean","object","array"];for(const[t,e]of n)if(!r.includes(e.type))throw new Error(`invalid schema. variable ${t} is type ${e.type}. type must be number, string, boolean, object, or array`)}getScreenMetadata(){const t=window.screen;return t.orientation?{availHeight:t.availHeight,availWidth:t.availWidth,colorDepth:t.colorDepth,height:t.height,orientation:{type:t.orientation.type,angle:t.orientation.angle},pixelDepth:t.pixelDepth,width:t.width}:{availHeight:t.availHeight,availWidth:t.availWidth,colorDepth:t.colorDepth,height:t.height,pixelDepth:t.pixelDepth,width:t.width}}addTrialData(t,e){if(!this.options.trialSchema)throw new Error("no trial schema were provided in GameOptions. cannot add trial data");if(this.data.trials.length<this.trialIndex+1){const t={},e=Object.entries(this.options.trialSchema);for(const[n]of e)t[n]=null;this.data.trials.push(t)}if(!(t in this.options.trialSchema))throw new Error(`trial variable ${t} not defined in schema`);const n=this.options.trialSchema[t].type;let r=typeof e;if("object"===r&&"[object Array]"===Object.prototype.toString.call(e)&&(r="array"),r!==n)throw new Error(`type for variable ${t} (value: ${e}) is "${r}". Based on schema for this variable, expected type was "${n}"`);this.data.trials[this.trialIndex][t]=e}trialComplete(){var t,e;if(this.trialIndex++,this.data.metadata.screen=this.getScreenMetadata(),this.data.metadata.devicePixelRatio=window.devicePixelRatio,null===(t=this.session.options.activityCallbacks)||void 0===t?void 0:t.onActivityDataCreate){const t={description:`a single completed trial from the assessment ${this.name}`,type:"object",properties:this.options.trialSchema},r={description:`all trial and metadata from the assessment ${this.name}`,type:"object",required:["trials","metadata"],properties:{trials:{type:"array",items:{$ref:"#/$defs/trial"}},metadata:{type:"object"}},$defs:{trial:{type:"object",properties:this.options.trialSchema}}};this.session.options.activityCallbacks.onActivityDataCreate({eventType:n.activityData,uuid:this.uuid,name:this.options.name,newData:this.data.trials[this.trialIndex-1],newDataSchema:t,data:this.data,dataSchema:r,activityConfiguration:null!==(e=this.options.parameters)&&void 0!==e?e:{}})}}end(){var t;(null===(t=this.session.options.activityCallbacks)||void 0===t?void 0:t.onActivityLifecycleChange)&&this.session.options.activityCallbacks.onActivityLifecycleChange({eventType:n.activityLifecycle,ended:!0,uuid:this.uuid,name:this.options.name})}setupHtmlCanvases(t,e,n,r){let i;if(Globals.canvasScale=Math.round(100*window.devicePixelRatio)/100,void 0===t){const t=document.getElementsByTagName("canvas");let e=new Array;for(let n=0;n<t.length;n++)e.push(t[n]);if(e=e.filter((t=>"m2c2kitscratchcanvas"!==t.id)),0===e.length)throw new Error("no html canvas tag was found in the html");e.length>1&&console.warn("warning: more than one html canvas was found. Using the first one"),i=t[0]}else if(i=document.getElementById(t),void 0===i)throw new Error(`could not find canvas HTML element with id "${t}"`);if(r||window.innerWidth<e||window.innerHeight<n){const t=n/e,r=window.innerHeight/window.innerWidth;Globals.rootScale=r<t?window.innerHeight/n:window.innerWidth/e}i.style.width=Globals.rootScale*e+"px",i.style.height=Globals.rootScale*n+"px",i.width=Globals.rootScale*e*Globals.canvasScale,i.height=Globals.rootScale*n*Globals.canvasScale,this.htmlCanvas=i,this.canvasCssWidth=e,this.canvasCssHeight=n,Globals.canvasCssWidth=e,Globals.canvasCssHeight=n}setupCanvasKitSurface(){if(void 0===this.htmlCanvas)throw new Error("main html canvas is undefined");const t=this.canvasKit.MakeCanvasSurface(this.htmlCanvas);if(null===t)throw new Error("could not make CanvasKit surface from canvas HTML element");this.surface=t,console.log("CanvasKit surface is backed by "+(this.surface.reportBackendTypeIsGPU()?"GPU":"CPU")),this.surface.getCanvas().scale(Globals.canvasScale,Globals.canvasScale)}setupFpsFont(){this.fpsTextFont=new this.canvasKit.Font(null,Q.FPS_DISPLAY_TEXT_FONT_SIZE*Globals.canvasScale),this.fpsTextPaint=new this.canvasKit.Paint,this.fpsTextPaint.setColor(this.canvasKit.Color(Q.FPS_DISPLAY_TEXT_COLOR[0],Q.FPS_DISPLAY_TEXT_COLOR[1],Q.FPS_DISPLAY_TEXT_COLOR[2],Q.FPS_DISPLAY_TEXT_COLOR[3])),this.fpsTextPaint.setAntiAlias(!0)}setupEventHandlers(){if(void 0===this.htmlCanvas)throw new Error("main html canvas is undefined");this.htmlCanvas.addEventListener("mousedown",this.htmlCanvasMouseDownHandler.bind(this)),this.htmlCanvas.addEventListener("touchstart",this.htmlCanvasTouchStartHandler.bind(this))}loop(t){if(!this.gameStopRequested){if(this.animationFramesRequested++,!this.limitFps||this.animationFramesRequested%Math.round(60/Q.LIMITED_FPS_RATE)==0){if(void 0===this.currentScene&&0===this.incomingSceneTransitions.length)throw new Error("Can not run game without a current or incoming scene");this.updateGameTime(),this.handleIncomingSceneTransitions(this.incomingSceneTransitions),this.update(),this.draw(t),this.incomingSceneTransitions.length>0&&(this.currentSceneSnapshot=this.takeCurrentSceneSnapshot()),this.pendingScreenshot&&(this.handlePendingScreenshot(this.pendingScreenshot),this.pendingScreenshot=void 0)}if(this.priorUpdateTime=Globals.now,void 0===this.surface)throw new Error("CanvasKit surface is undefined");this.surface.requestAnimationFrame(this.loop.bind(this))}}updateGameTime(){Globals.now=window.performance.now(),this.priorUpdateTime?Globals.deltaTime=Globals.now-this.priorUpdateTime:Globals.deltaTime=0}handleIncomingSceneTransitions(t){if(t.length>0&&this.currentSceneSnapshot){const e=t.shift();if(void 0===e)throw new Error("no incoming scene transition");const n=e.scene,r=e.transition,i=this.currentSceneSnapshot;if(!i)throw new Error("no outgoing scene image");const a=new J({name:"outgoingScene"});a.size.width=this.canvasCssWidth,a.size.height=this.canvasCssHeight,this.addScene(a),i||console.log("outgoingSceneImage is undefined/null");const o=new d("outgoingSceneSnapshot",i,this.canvasCssWidth,this.canvasCssHeight);this.session.imageManager.addLoadedImage(o,this.uuid);const s=new Z({name:"outgoingSceneSprite",imageName:"outgoingSceneSnapshot",position:{x:this.canvasCssWidth/Globals.rootScale/2,y:this.canvasCssHeight/Globals.rootScale/2}});s.scale=1/Globals.rootScale,a.addChild(s),a._active=!0,n!==this.currentScene&&this.currentScene&&(this.currentScene._active=!1),this.currentScene=n,this.currentScene._active=!0,n._setupCallback&&n._setupCallback(n),a&&n&&(r?this.animateSceneTransition(n,r,a):a._active=!1),a&&r||n._appearCallback&&n._appearCallback(n)}}update(){this.scenes.filter((t=>t._active)).forEach((t=>t.update()))}draw(t){this.scenes.filter((t=>t._active)).forEach((e=>e.draw(t))),this.drawnFrames++,this.showFps&&this.drawFps(t)}takeCurrentSceneSnapshot(){if(void 0===this.surface)throw new Error("CanvasKit surface is undefined");return this.surface.makeImageSnapshot()}handlePendingScreenshot(t){if(!this.surface)throw new Error("no surface");let e;if(4==t.rect.length){const n=t.rect[0]*Globals.canvasScale,r=t.rect[1]*Globals.canvasScale,i=[n,r,n+t.rect[2]*Globals.canvasScale,r+t.rect[3]*Globals.canvasScale];e=this.surface.makeImageSnapshot(i)}else e=this.surface.makeImageSnapshot();const n=e.encodeToBytes();t.promiseResolve(n)}takeScreenshot(t,e,n,r){if(!this.surface)throw new Error("no canvaskit surface. unable to take screenshot.");const i=[t,e,n,r].map((t=>t?0:1)).reduce(((t,e)=>t+e));return new Promise(((a,o)=>{switch(i){case 0:if(!(t&&e&&n&&r))return void o("missing values in arguments for takeScreenshot()");this.pendingScreenshot={rect:[t,e,n,r],promiseResolve:a};break;case 4:this.pendingScreenshot={rect:[],promiseResolve:a};break;default:o("Exactly 0 or 4 arguments must be supplied to takeScreenshot()")}}))}animateSceneTransition(t,e,n){const i=e.duration;switch(t._transitioning=!0,n._transitioning=!0,e.type){case N.push:switch(e.direction){case z.left:t.position.x=t.size.width,t.run(r.Sequence([r.Move({point:{x:0,y:0},duration:i,runDuringTransition:!0}),r.Custom({callback:()=>{t._transitioning=!1,t._appearCallback&&t._appearCallback(t)},runDuringTransition:!0})])),n.run(r.Sequence([r.Move({point:{x:-n.size.width,y:0},duration:i,runDuringTransition:!0}),r.Custom({callback:()=>{n._active=!1,n._transitioning=!1,n.game.currentSceneSnapshot&&n.game.currentSceneSnapshot.delete()},runDuringTransition:!0})]));break;case z.right:t.position.x=-t.size.width,t.run(r.Sequence([r.Move({point:{x:0,y:0},duration:i,runDuringTransition:!0}),r.Custom({callback:()=>{t._transitioning=!1,t._appearCallback&&t._appearCallback(t)},runDuringTransition:!0})])),n.run(r.Sequence([r.Move({point:{x:n.size.width,y:0},duration:i,runDuringTransition:!0}),r.Custom({callback:()=>{n._active=!1,n._transitioning=!1,n.game.currentSceneSnapshot&&n.game.currentSceneSnapshot.delete()},runDuringTransition:!0})]));break;case z.up:t.position.y=t.size.height,t.run(r.Sequence([r.Move({point:{x:0,y:0},duration:i,runDuringTransition:!0}),r.Custom({callback:()=>{t._transitioning=!1,t._appearCallback&&t._appearCallback(t)},runDuringTransition:!0})])),n.run(r.Sequence([r.Move({point:{x:0,y:-n.size.height},duration:i,runDuringTransition:!0}),r.Custom({callback:()=>{n._active=!1,n._transitioning=!1,n.game.currentSceneSnapshot&&n.game.currentSceneSnapshot.delete()},runDuringTransition:!0})]));break;case z.down:t.position.y=-t.size.height,t.run(r.Sequence([r.Move({point:{x:0,y:0},duration:i,runDuringTransition:!0}),r.Custom({callback:()=>{t._transitioning=!1,t._appearCallback&&t._appearCallback(t)},runDuringTransition:!0})])),n.run(r.Sequence([r.Move({point:{x:0,y:n.size.height},duration:i,runDuringTransition:!0}),r.Custom({callback:()=>{n._active=!1,n._transitioning=!1,n.game.currentSceneSnapshot&&n.game.currentSceneSnapshot.delete()},runDuringTransition:!0})]));break;default:throw new Error("unknown transition direction")}break;default:throw new Error("unknown transition type")}}drawFps(t){if(0===this.lastFpsUpdate)this.lastFpsUpdate=Globals.now,this.nextFpsUpdate=Globals.now+Q.FPS_DISPLAY_UPDATE_INTERVAL;else{Globals.now>=this.nextFpsUpdate&&(this.fps=this.drawnFrames/((Globals.now-this.lastFpsUpdate)/1e3),this.drawnFrames=0,this.lastFpsUpdate=Globals.now,this.nextFpsUpdate=Globals.now+Q.FPS_DISPLAY_UPDATE_INTERVAL),t.save();const e=Globals.canvasScale;if(t.scale(1/e,1/e),!this.fpsTextFont||!this.fpsTextPaint)throw new Error("fps font or paint is undefined");t.drawText("FPS: "+this.fps.toFixed(2),0,0+Q.FPS_DISPLAY_TEXT_FONT_SIZE*e,this.fpsTextPaint,this.fpsTextFont),t.restore()}}createEventListener(t,e,n,r=!0){const i=this.entities.filter((t=>t.name===e));i.length>1&&console.warn(`warning: createEventListener() found more than one entity with name ${e}. Event listener will be attached to first entity found. All entities that receive tap events should be uniquely named`);const a=i.filter((t=>t.name===e)).find(Boolean);if(void 0===a)throw new Error(`could not create event listener. entity with name ${e} could not be found in the game entity tree`);if("tapdown"!==t)throw new Error(`could not create event listener: event type ${t} is not known`);a.onTapDown(n,r)}get entities(){function t(e,n){n.push(e),e.children.forEach((e=>t(e,n)))}const e=new Array;return this.scenes.forEach((n=>t(n,e))),e}htmlCanvasMouseDownHandler(t){t.preventDefault();const e=this.currentScene;if(!e||!this.sceneCanReceiveUserInteraction(e))return;const n=t.offsetX,r=t.offsetY;this.processTaps(e,n,r)}htmlCanvasTouchStartHandler(t){t.preventDefault();const e=this.currentScene;if(!e||!this.sceneCanReceiveUserInteraction(e))return;const n=t.target.getBoundingClientRect(),r=t.touches.item(0);if(null===r)return void console.warn("warning: canvas received touchstart event, but TouchList was empty");const i=r.pageX-n.x,a=r.pageY-n.y;this.processTaps(e,i,a)}sceneCanReceiveUserInteraction(t){var e;return t.game===(null===(e=t.game.session)||void 0===e?void 0:e.currentActivity)&&!1===t._transitioning}processTaps(t,e,n){t.isUserInteractionEnabled&&this.tapIsWithinEntityBounds(t,e,n)&&this.handleEntityTapped(t,e,n),t.children&&t.children.filter((t=>!t.hidden)).forEach((t=>this.processTaps(t,e,n)))}handleEntityTapped(t,e,n){t.eventListeners.filter((t=>"tapdown"===t.eventType)).forEach((r=>{if(r.entityName===t.name){const i=this.calculateEntityAbsoluteBoundingBox(t),a=(e-i.xMin)/(i.xMax-i.xMin)*t.size.width,o=(n-i.yMin)/(i.yMax-i.yMin)*t.size.height,s={target:t,point:{x:a,y:o}};r.callback(s)}}))}tapIsWithinEntityBounds(t,e,n){if(!t.isDrawable)throw"only drawable entities can receive tap events";if(0===t.size.width||0===t.size.height)return console.warn(`warning: entity ${t.toString()} has isUserInteractionEnabled = true, but has no tappable area. Size is ${t.size.width}, ${t.size.height}`),!1;if(t.type===W.textline&&isNaN(t.size.width))return console.warn(`warning: entity ${t.toString()} is a textline with width = NaN. A textline must have its width manually set.`),!1;const r=this.calculateEntityAbsoluteBoundingBox(t);return!!(t.isUserInteractionEnabled&&e>=r.xMin&&e<=r.xMax&&n>=r.yMin&&n<=r.yMax)}calculateEntityAbsoluteBoundingBox(t){const e=t.anchorPoint,n=t.absoluteScale;return{xMin:t.absolutePosition.x-t.size.width*e.x*n,xMax:t.absolutePosition.x+t.size.width*(1-e.x)*n,yMin:t.absolutePosition.y-t.size.height*e.y*n,yMax:t.absolutePosition.y+t.size.height*(1-e.y)*n}}}!function(t){t[t.center=0]="center",t[t.left=1]="left",t[t.right=2]="right"}(H||(H={}));class it extends q{constructor(t={}){super(t),this.type=W.label,this.isDrawable=!0,this.isText=!0,this.anchorPoint={x:.5,y:.5},this.zPosition=0,this._text="",this._fontColor=Q.DEFAULT_FONT_COLOR,this._fontSize=Q.DEFAULT_FONT_SIZE,this._horizontalAlignmentMode=H.center,Y(this,t),t.horizontalAlignmentMode&&(this.horizontalAlignmentMode=t.horizontalAlignmentMode),void 0!==t.preferredMaxLayoutWidth&&(this.preferredMaxLayoutWidth=t.preferredMaxLayoutWidth),t.backgroundColor&&(this.backgroundColor=t.backgroundColor)}initialize(){var t,e,n;let r=this.canvasKit.TextAlign.Center;switch(this.horizontalAlignmentMode){case H.center:r=this.canvasKit.TextAlign.Center;break;case H.left:r=this.canvasKit.TextAlign.Left;break;case H.right:r=this.canvasKit.TextAlign.Right;break;default:throw new Error("unknown horizontalAlignmentMode")}this.paraStyle=new this.canvasKit.ParagraphStyle({textStyle:{color:this.canvasKit.Color(this.fontColor[0],this.fontColor[1],this.fontColor[2],this.fontColor[3]),fontSize:this.fontSize*Globals.canvasScale},textAlign:r}),this.fontName&&this.paraStyle.textStyle&&(this.paraStyle.textStyle.fontFamilies=[this.fontName]),this.backgroundColor&&this.paraStyle.textStyle&&(this.paraStyle.textStyle.backgroundColor=this.backgroundColor);const i=this.parentSceneAsEntity.game.session;if(!i)throw new Error("activity is undefined");const a=i.fontManager;if(void 0===a.fontMgr)throw new Error("no fonts loaded");const o=this.canvasKit.ParagraphBuilder.Make(this.paraStyle,a.fontMgr);this.text||(this.text=""),o.addText(this.text),""===this.text&&console.warn(`warning: empty text in label "${this.name}"`),this.paragraph=o.build();const s=null!==(t=this.preferredMaxLayoutWidth)&&void 0!==t?t:Globals.canvasCssWidth;let l=s;if(0===s||0===this.layout.width){if(void 0===this.parent)throw new Error("width is set to match parent, but entity has no parent");const t=null!==(e=this.layout.marginStart)&&void 0!==e?e:0,r=null!==(n=this.layout.marginEnd)&&void 0!==n?n:0;l=this.parent.size.width-(t+r)}this.paragraph.layout(l*Globals.canvasScale),this.size.width=l,this.size.height=this.paragraph.getHeight()/Globals.canvasScale}get text(){return this._text}set text(t){this._text=t,this.needsInitialization=!0}get fontName(){return this._fontName}set fontName(t){this._fontName=t,this.needsInitialization=!0}get fontColor(){return this._fontColor}set fontColor(t){this._fontColor=t,this.needsInitialization=!0}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize=t,this.needsInitialization=!0}get horizontalAlignmentMode(){return this._horizontalAlignmentMode}set horizontalAlignmentMode(t){this._horizontalAlignmentMode=t,this.needsInitialization=!0}get preferredMaxLayoutWidth(){return this._preferredMaxLayoutWidth}set preferredMaxLayoutWidth(t){this._preferredMaxLayoutWidth=t,this.needsInitialization=!0}get backgroundColor(){return this._backgroundColor}set backgroundColor(t){this._backgroundColor=t,this.needsInitialization=!0}duplicate(t){const e=new it(Object.assign(Object.assign(Object.assign(Object.assign({},this.getEntityOptions()),this.getDrawableOptions()),this.getTextOptions()),{horizontalAlignmentMode:this.horizontalAlignmentMode,preferredMaxLayoutWidth:this.preferredMaxLayoutWidth,backgroundColor:this.backgroundColor,name:t}));return this.children.length>0&&(e.children=this.children.map((t=>{const n=t.duplicate();return n.parent=e,n}))),e}update(){super.update()}draw(t){if(this.parent&&""!==this.text){t.save();const e=Globals.canvasScale/this.absoluteScale;t.scale(1/e,1/e);const n=(this.absolutePosition.x-this.size.width*this.anchorPoint.x*this.absoluteScale)*e,r=(this.absolutePosition.y-this.size.height*this.anchorPoint.y*this.absoluteScale)*e;if(void 0===this.paragraph)throw new Error("no paragraph");t.drawParagraph(this.paragraph,n,r),t.restore()}super.drawChildren(t)}}class at{static SingleFromRange(t,e){return Math.floor(Math.random()*(e-t))+t}static FromRangeWithoutReplacement(t,e,n){const r=new Array;for(let i=0;i<t;i++){const i=Math.floor(Math.random()*(n-e))+e;r.includes(i)?t++:r.push(i)}return r}static FromGridWithoutReplacement(t,e,n,r){const i=new Array,a=e*n-1,o=this.FromRangeWithoutReplacement(t,0,a);let s=0,l=NaN;for(;s<t;){const t=o[s]%n,e=(o[s]-t)/n;if(void 0===r||r(e,t))i.push({row:e,column:t}),s++;else{do{l=this.FromRangeWithoutReplacement(1,0,a)[0]}while(o.includes(l));o[s]=l}}return i}}!function(t){t[void 0]="Undefined",t.rectangle="Rectangle",t.circle="Circle"}($||($={}));class ot extends q{constructor(t={}){super(t),this.type=W.shape,this.isDrawable=!0,this.isShape=!0,this.anchorPoint={x:.5,y:.5},this.zPosition=0,this.shapeType=$.undefined,this.cornerRadius=0,this._fillColor=Q.DEFAULT_SHAPE_FILL_COLOR,Y(this,t),void 0!==t.circleOfRadius&&(this.circleOfRadius=t.circleOfRadius,this.shapeType=$.circle),t.rect&&(this.rect=t.rect,t.rect.size?(this.size.width=t.rect.size.width,this.size.height=t.rect.size.height):void 0!==t.rect.width&&void 0!==t.rect.height&&(this.size.width=t.rect.width,this.size.height=t.rect.height),t.rect.origin?this.position=t.rect.origin:void 0!==t.rect.x&&void 0!==t.rect.y&&(this.position={x:t.rect.x,y:t.rect.y}),this.shapeType=$.rectangle),t.cornerRadius&&(this.cornerRadius=t.cornerRadius),t.fillColor&&(this.fillColor=t.fillColor),t.strokeColor&&(this.strokeColor=t.strokeColor),t.lineWidth&&(this.lineWidth=t.lineWidth),t.strokeColor&&void 0===t.lineWidth&&console.warn(`warning: for entity ${this}, strokeColor = ${t.strokeColor} but lineWidth is undefined. In normal usage, both would be set or both would be undefined.`),void 0===t.strokeColor&&t.lineWidth&&console.warn(`warning: for entity ${this}, lineWidth = ${t.lineWidth} but strokeColor is undefined. In normal usage, both would be set or both would be undefined.`)}initialize(){if(this.fillColor){const t=this.canvasKit;this.fillColorPaint=new t.Paint,this.fillColorPaint.setColor(t.Color(this.fillColor[0],this.fillColor[1],this.fillColor[2],this.fillColor[3])),this.fillColorPaint.setStyle(t.PaintStyle.Fill),this.fillColorPaint.setAntiAlias(!0)}if(this.strokeColor){const t=this.canvasKit;this.strokeColorPaint=new t.Paint,this.strokeColorPaint.setColor(t.Color(this.strokeColor[0],this.strokeColor[1],this.strokeColor[2],this.strokeColor[3])),this.strokeColorPaint.setStyle(t.PaintStyle.Stroke),this.strokeColorPaint.setAntiAlias(!0)}}get fillColor(){return this._fillColor}set fillColor(t){this._fillColor=t,this.needsInitialization=!0}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.needsInitialization=!0}duplicate(t){const e=new ot(Object.assign(Object.assign(Object.assign({},this.getEntityOptions()),this.getDrawableOptions()),{shapeType:this.shapeType,circleOfRadius:this.circleOfRadius,rect:this.rect,cornerRadius:this.cornerRadius,fillColor:this.fillColor,strokeColor:this.strokeColor,lineWidth:this.lineWidth,name:t}));return this.children.length>0&&(e.children=this.children.map((t=>{const n=t.duplicate();return n.parent=e,n}))),e}update(){super.update()}draw(t){t.save();const e=Globals.canvasScale/this.absoluteScale;if(t.scale(1/e,1/e),this.shapeType===$.circle&&void 0!==this.circleOfRadius){const n=this.absolutePosition.x*e,r=this.absolutePosition.y*e,i=this.circleOfRadius*this.absoluteScale*e;this.fillColor&&this.fillColorPaint&&t.drawCircle(n,r,i,this.fillColorPaint),this.strokeColor&&this.strokeColorPaint&&this.lineWidth&&(this.strokeColorPaint.setStrokeWidth(this.lineWidth*e),t.drawCircle(n,r,i,this.strokeColorPaint))}if(this.shapeType===$.rectangle){const n=this.canvasKit.RRectXY(this.canvasKit.LTRBRect((this.absolutePosition.x-this.anchorPoint.x*this.size.width*this.absoluteScale)*e,(this.absolutePosition.y-this.anchorPoint.y*this.size.height*this.absoluteScale)*e,(this.absolutePosition.x+this.size.width*this.absoluteScale-this.anchorPoint.x*this.size.width*this.absoluteScale)*e,(this.absolutePosition.y+this.size.height*this.absoluteScale-this.anchorPoint.y*this.size.height*this.absoluteScale)*e),this.cornerRadius*e,this.cornerRadius*e);this.fillColor&&this.fillColorPaint&&t.drawRRect(n,this.fillColorPaint),this.strokeColor&&this.strokeColorPaint&&this.lineWidth&&(this.strokeColorPaint.setStrokeWidth(this.lineWidth*e),t.drawRRect(n,this.strokeColorPaint))}t.restore(),super.drawChildren(t)}}class st{static Create(t){return new Array}}class lt extends q{constructor(t={}){var e;super(t),this.type=W.textline,this.isDrawable=!0,this.isText=!0,this.zPosition=0,this.anchorPoint={x:0,y:.5},this._text="",this._fontColor=Q.DEFAULT_FONT_COLOR,this._fontSize=Q.DEFAULT_FONT_SIZE,Y(this,t),this.size.height=this.fontSize,this.size.width=null!==(e=t.width)&&void 0!==e?e:NaN}get text(){return this._text}set text(t){this._text=t,this.needsInitialization=!0}get fontName(){return this._fontName}set fontName(t){this._fontName=t,this.needsInitialization=!0}get fontColor(){return this._fontColor}set fontColor(t){this._fontColor=t,this.needsInitialization=!0}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize=t,this.needsInitialization=!0}update(){super.update()}initialize(){this.paint=new this.canvasKit.Paint,this.paint.setColor(this.canvasKit.Color(this.fontColor[0],this.fontColor[1],this.fontColor[2],this.fontColor[3])),this.paint.setStyle(this.canvasKit.PaintStyle.Fill),this.paint.setAntiAlias(!0);const t=this.parentSceneAsEntity.game.session;if(!t)throw new Error("activity is undefined");const e=t.fontManager,n=this.parentSceneAsEntity.game.uuid;this.fontName?this.font=new this.canvasKit.Font(e.getTypeface(n,this.fontName),this.fontSize*Globals.canvasScale):this.font=new this.canvasKit.Font(null,this.fontSize*Globals.canvasScale)}duplicate(t){const e=new lt(Object.assign(Object.assign(Object.assign(Object.assign({},this.getEntityOptions()),this.getDrawableOptions()),this.getTextOptions()),{width:this.size.width,name:t}));return this.children.length>0&&(e.children=this.children.map((t=>{const n=t.duplicate();return n.parent=e,n}))),e}draw(t){if(this.parent&&this.text){t.save();const e=Globals.canvasScale/this.absoluteScale;t.scale(1/e,1/e);const n=this.absolutePosition.x*e,r=(this.absolutePosition.y+this.size.height*this.anchorPoint.y*this.absoluteScale)*e;if(void 0===this.paint||void 0===this.font)throw new Error(`in TextLine entity ${this}, Paint or Font is undefined.`);t.drawText(this.text,n,r,this.paint,this.font),t.restore()}super.drawChildren(t)}}export{r as Action,e as ActivityType,X as Composite,Q as Constants,j as ConstraintType,o as CustomAction,U as Dimensions,q as Entity,W as EntityType,n as EventType,F as FontManager,rt as Game,h as GlobalVariables,a as GroupAction,m as ImageManager,it as Label,H as LabelHorizontalAlignmentMode,V as LayoutConstraint,d as LoadedImage,l as MoveAction,et as PushTransition,at as RandomDraws,c as ScaleAction,J as Scene,nt as SceneTransition,i as SequenceAction,G as Session,ot as Shape,$ as ShapeType,Z as Sprite,st as Story,lt as TextLine,L as Timer,tt as Transition,z as TransitionDirection,N as TransitionType,D as Uuid,s as WaitAction,K as WebColors,Y as handleInterfaceOptions};
|
|
16
|
+
function u(t,e,n,i){return new(n||(n=Promise))((function(r,a){function o(t){try{l(i.next(t))}catch(t){a(t)}}function s(t){try{l(i.throw(t))}catch(t){a(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}l((i=i.apply(t,e||[])).next())}))}!function(t){t.game="Game",t.survey="Survey"}(e||(e={})),function(t){t.activityData="ActivityData",t.activityLifecycle="ActivityLifecycle",t.sessionLifecycle="SessionLifecycle"}(n||(n={}));class h{constructor(){this.now=NaN,this.deltaTime=NaN,this.canvasScale=NaN,this.rootScale=1,this.canvasCssWidth=NaN,this.canvasCssHeight=NaN}}globalThis.Globals=new h;class d{constructor(t,e,n,i){this.name=t,this.image=e,this.width=n,this.height=i}}class f{constructor(t,e,n,i){this.name=t,this.dataUrlImage=e,this.width=n,this.height=i}}class p{}class g{}class m{constructor(){this.renderedImages=new p,this.loadedImages=new g}getLoadedImage(t,e){return this.loadedImages[t][e]}addLoadedImage(t,e){this.loadedImages[e]||(this.loadedImages[e]={}),this.loadedImages[e][t.name]=t}renderImages(t){const e=new Array;return t.forEach((t=>{if(t.images){const n=(t=>t.filter(((e,n)=>t.indexOf(e)!=n)))(t.images.map((t=>t.name)));if(n.length>0)throw new Error("image names must be unique. these image names are duplicated within a game: "+n.join(", "));t.images.map((n=>{e.push(this.renderBrowserImage(t.uuid,n))}))}})),Promise.all(e)}loadAllGamesRenderedImages(){Object.keys(this.renderedImages).forEach((t=>{Object.keys(this.renderedImages[t]).forEach((e=>{const n=this.convertRenderedDataUrlImageToCanvasKitImage(this.renderedImages[t][e]);this.loadedImages[t]||(this.loadedImages[t]={}),this.addLoadedImage(n,t)}))}))}renderBrowserImage(t,e){const n=document.createElement("img"),i=()=>{if(!this.scratchCanvas||!this.ctx||!this.scale)throw new Error("image manager not set up");this.scratchCanvas.width=e.width*this.scale,this.scratchCanvas.height=e.height*this.scale,this.ctx.scale(this.scale,this.scale),this.ctx.clearRect(0,0,e.width,e.height),this.ctx.drawImage(n,0,0,e.width,e.height);const i=this.scratchCanvas.toDataURL(),r=new f(e.name,i,e.width,e.height);n.remove(),this.renderedImages[t]||(this.renderedImages[t]={}),this.renderedImages[t][e.name]=r},r=()=>{let n="";e.svgString?n=" image source was svgString":e.url&&(n=` image source was url ${e.url}`),console.warn(`unable to render image named ${e.name}.${n}`);const i=new f(e.name,"",0,0);this.renderedImages[t]||(this.renderedImages[t]={}),this.renderedImages[t][e.name]=i};return new Promise((t=>{if(n.width=e.width,n.height=e.height,n.crossOrigin="Anonymous",n.onload=()=>{let r=!1;if((n.src.startsWith("data:image/svg+xml")||n.src.toLowerCase().endsWith("svg"))&&(r=!0),!r||0!==n.naturalHeight&&0!==n.naturalWidth)0!==n.naturalHeight&&0!==n.naturalWidth||console.warn(`image named ${e.name} has naturalHeight 0 and/or naturalWidth 0. This may cause inaccurate rendering. Please check the image.`),i(),t();else{let r;r=n.src.startsWith("data:image/svg+xml")?"svg string":n.src,console.warn(`svg image named ${e.name} loaded from ${r} has naturalHeight 0 and/or naturalWidth 0. This is probably because the svg is missing height and width attributes. This will cause the svg not to render on Firefox, due to issue described at https://bugzilla.mozilla.org/show_bug.cgi?id=700533. m2c2kit will attempt to infer the height and width from the svg viewBox, but it is strongly recommended that all svg images have height and width attributes.`);const a=r=>{const a=()=>{console.warn(`svg image named ${e.name} has missing or invalid viewBox; unable to render.`),i(),t()};if(r.hasAttribute("viewBox")){const e=r.getAttribute("viewBox");if(e){const o=e.split(" ");4===o.length?(r.setAttribute("width",o[2]),r.setAttribute("height",o[3]),n.onload=()=>{i(),t()},n.src="data:image/svg+xml,"+encodeURIComponent(r.outerHTML)):a()}else a()}else a()};if(e.svgString){const t=(new DOMParser).parseFromString(e.svgString,"text/xml").documentElement;a(t)}else e.url?fetch(e.url).then((t=>t.text())).then((t=>{const e=(new DOMParser).parseFromString(t,"text/xml").documentElement;a(e)})):(console.warn(`unable to render svg image named ${e.name}.`),i(),t())}},n.onerror=()=>{r(),t()},e.svgString&&e.url)throw new Error(`provide svgString or url. both were provided for image named ${e.name}`);if(e.svgString)n.src="data:image/svg+xml,"+encodeURIComponent(e.svgString);else{if(!e.url)throw new Error(`no svgString or url provided for image named ${e.name}`);n.src=e.url}}))}convertRenderedDataUrlImageToCanvasKitImage(t){if(!this.canvasKit)throw new Error("canvasKit undefined");let e=null;try{e=this.canvasKit.MakeImageFromEncoded(this.dataURLtoArrayBuffer(t.dataUrlImage))}catch(e){throw new Error(`could not create image with name "${t.name}."`)}if(null===e)throw new Error(`could not create image with name "${t.name}."`);const n=new d(t.name,e,t.width,t.height);return console.log(`image loaded. name: ${t.name}, w: ${t.width}, h: ${t.height}`),n}get scratchCanvas(){if(!this._scratchCanvas){this._scratchCanvas=document.createElement("canvas"),this._scratchCanvas.id="m2c2kitscratchcanvas",this._scratchCanvas.hidden=!0,document.body.appendChild(this._scratchCanvas);const t=this._scratchCanvas.getContext("2d");if(null===t)throw new Error("could not get 2d canvas context from scratch canvas");this.ctx=t,this.scale=window.devicePixelRatio}return this._scratchCanvas}dataURLtoArrayBuffer(t){const e=t.split(","),n=atob(e[1]);let i=n.length;const r=new Uint8Array(i);for(;i--;)r[i]=n.charCodeAt(i);return r.buffer}}function y(t,e){return function(t,e){for(var n=function(t){return S(t,4)}(t),i={tag:"",checksum:"",contents:"",length:""},r=0;r<n;++r){var a=12+16*r,o=C(t.buffer.slice(a,a+4));if(o===e)return i.tag=o,i.checksum=A(t,a+4),i.contents=A(t,a+8),i.length=A(t,a+24),i}return i}(t,e).contents}const v={meta:{property:[],description:[],license:[],reference:[]},tables:{name:{},post:{},os2:{version:"",weightClass:""}}};function w(t){return 2147483648&t&&(t=-(1+~t)),t/65536}function b(t,e){return t.getInt16(e)}function S(t,e){return t.getUint16(e)}function A(t,e){return t.getUint32(e)}function C(t){return new TextDecoder("utf-8").decode(new Uint8Array(t))}function T(t){return v.tables.name=function(t){for(var e=y(t,"name"),n=S(t,e+4),i=S(t,e+2),r=n+e,a={},o=0;o<i;o++){var s=e+6+12*o,l=S(t,s+6),c=S(t,s+8),u=S(t,s+10);a.hasOwnProperty(l)||(a[l]=C(t.buffer.slice(r+u,r+u+c)))}return a}(t),v.tables.post=function(t){var e=y(t,"post");return{format:w(A(t,e+0)),italicAngle:w(A(t,e+4)),underlinePosition:b(t,e+12),underlineThickness:b(t,e+14),isFixedPitch:A(t,e+16),minMemType42:A(t,e+7),maxMemType42:A(t,e+9),minMemType1:A(t,e+11),maxMemType1:A(t,e+13)}}(t),v.tables.os2=function(t){var e=y(t,"OS/2");return{version:S(t,e+0),weightClass:S(t,e+4)}}(t),v.meta=function(t){var e={property:[],description:[],license:[],reference:[]};for(const s in t)if(t.hasOwnProperty(s)){const l=parseInt(s);var n=l;const c=t[l].trim();if((o=c.replace("~\r\n?~","\n").split("\n").map((t=>t.trim())).filter((t=>t))).length>1){var i=10==l?"description":"license";e[i]=[];for(const t in o)if(o.hasOwnProperty(t)){var r=o[t].trim();e[i].push({name:x(r),text:r})}}else if(c){if(/^s?https?:\/\/[-_.!~*'()a-zA-Z0-9;\/?:\@&=+\$,%#]+$/.test(c))e.reference.findIndex((t=>t.text==c))<0&&e.reference.push({name:"url",text:c});else if(l>0&&l<6){var a=P[n].replace(" ","-").toLowerCase();e.property.push({name:a,text:c})}else if(P.hasOwnProperty(l))if(0==l||7==l){var o=c.replace(/---+/,"\n").split("\n").map((t=>t.trim())).filter((t=>t));for(const t in o)if(o.hasOwnProperty(t)){r=o[t].trim();e.description.push({name:x(r),text:r})}}else if(13==l)e.license.push({name:x(c),text:c});else{a=P[n].replace(" ","-").toLowerCase();e.property.push({name:a,text:c})}}}return e}(v.tables.name),v}function _(t){try{return T(t),v}catch(t){throw"error processing ttf"}}const P={0:"Copyright",1:"Font Family",2:"Font Subfamily",3:"Unique identifier",4:"Full name",5:"Version",6:"Postscript name",7:"Note",8:"Company",9:"Author",10:"Description",11:"URL",12:"URL",13:"License",14:"URL",16:"Name"},x=(t="")=>/^[^a-z]*$/.test(t)?t.split(" ").length>4?"paragraph":"title":"paragraph";class M{}class F{constructor(){this.gameTypefaces=new M}getTypeface(t,e){return this.gameTypefaces[t][e]}fetchFonts(t){const e=new Array;return t.forEach((t=>{const n=this.fetchGameFontsAsArrayBuffers(t.uuid,t.fontUrls);e.push(n)})),Promise.all(e).then((t=>{this.allGamesFontData=t.flat()}))}loadAllGamesFontData(){if(!this.allGamesFontData)throw new Error("allGamesFontData is undefined");Array.from(new Set(this.allGamesFontData.map((t=>t.gameUuid)))).forEach((t=>{if(!this.allGamesFontData)throw new Error("allGamesFontData is undefined");const e=this.allGamesFontData.filter((e=>e.gameUuid===t)).map((t=>t.fontArrayBuffer));this.loadGameFonts(t,e)}))}fetchGameFontsAsArrayBuffers(t,e){const n=e.map((e=>fetch(e).then((t=>t.arrayBuffer())).then((n=>({gameUuid:t,fontUrl:e,fontArrayBuffer:n})))));return Promise.all(n)}loadGameFonts(t,e){var n;if(!this.canvasKit)throw new Error("canvasKit undefined");if(this.fontMgr=null!==(n=this.canvasKit.FontMgr.FromData(...e))&&void 0!==n?n:void 0,!this.fontMgr)throw new Error("error creating FontMgr while loading fonts");e.forEach((e=>{var n;const i=null===(n=_(new DataView(e)).meta.property.filter((t=>"font-family"===t.name)).find(Boolean))||void 0===n?void 0:n.text;if(void 0===i)throw new Error("error loading fonts. could not get font-family from font array buffer");if(console.log("font loaded. font family: "+i),!this.canvasKit)throw new Error("canvasKit undefined");const r=this.canvasKit.Typeface.MakeFreeTypeFaceFromData(e);if(!r)throw new Error("cannot make typeface from font array buffer");this.gameTypefaces[t]||(this.gameTypefaces[t]={}),this.gameTypefaces[t][i]=r}))}}var E="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function k(t){if(t.__esModule)return t;var e=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(t).forEach((function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})})),e}var O={exports:{}};var R=k(Object.freeze({__proto__:null,path_empty_shim:function(){}}));var B=k(Object.freeze({__proto__:null,fs_empty_shim:function(){}}));!function(t,e){var n,i=(n="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,"undefined"!=typeof __filename&&(n=n||__filename),function(t){var e;t=t||{},e||(e=void 0!==t?t:{});var i,r,a,o=Object.assign;e.ready=new Promise((function(t,e){i=t,r=e})),(a=e).Vd=a.Vd||[],a.Vd.push((function(){a.MakeSWCanvasSurface=function(t){var e=t;if("CANVAS"!==e.tagName&&!(e=document.getElementById(t)))throw"Canvas with id "+t+" was not found";return(t=a.MakeSurface(e.width,e.height))&&(t.Nd=e),t},a.MakeCanvasSurface||(a.MakeCanvasSurface=a.MakeSWCanvasSurface),a.MakeSurface=function(t,e){var n={width:t,height:e,colorType:a.ColorType.RGBA_8888,alphaType:a.AlphaType.Unpremul,colorSpace:a.ColorSpace.SRGB},i=t*e*4,r=a._malloc(i);return(n=a.Surface._makeRasterDirect(n,r,4*t))&&(n.Nd=null,n.Cf=t,n.zf=e,n.Bf=i,n.bf=r,n.getCanvas().clear(a.TRANSPARENT)),n},a.MakeRasterDirectSurface=function(t,e,n){return a.Surface._makeRasterDirect(t,e.byteOffset,n)},a.Surface.prototype.flush=function(t){if(a.Od(this.Md),this._flush(),this.Nd){var e=new Uint8ClampedArray(a.HEAPU8.buffer,this.bf,this.Bf);e=new ImageData(e,this.Cf,this.zf),t?this.Nd.getContext("2d").putImageData(e,0,0,t[0],t[1],t[2]-t[0],t[3]-t[1]):this.Nd.getContext("2d").putImageData(e,0,0)}},a.Surface.prototype.dispose=function(){this.bf&&a._free(this.bf),this.delete()},a.Od=a.Od||function(){}})),function(t){t.Vd=t.Vd||[],t.Vd.push((function(){function e(t,e,n){return t&&t.hasOwnProperty(e)?t[e]:n}function n(t){var e=Ue(ke);return ke[e]=t,e}function i(t){return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}function r(t){return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}t.GetWebGLContext=function(t,n){if(!t)throw"null canvas passed into makeWebGLContext";var i={alpha:e(n,"alpha",1),depth:e(n,"depth",1),stencil:e(n,"stencil",8),antialias:e(n,"antialias",0),premultipliedAlpha:e(n,"premultipliedAlpha",1),preserveDrawingBuffer:e(n,"preserveDrawingBuffer",0),preferLowPowerToHighPerformance:e(n,"preferLowPowerToHighPerformance",0),failIfMajorPerformanceCaveat:e(n,"failIfMajorPerformanceCaveat",0),enableExtensionsByDefault:e(n,"enableExtensionsByDefault",1),explicitSwapControl:e(n,"explicitSwapControl",0),renderViaOffscreenBackBuffer:e(n,"renderViaOffscreenBackBuffer",0)};if(i.majorVersion=n&&n.majorVersion?n.majorVersion:"undefined"!=typeof WebGL2RenderingContext?2:1,i.explicitSwapControl)throw"explicitSwapControl is not supported";return t=function(t,e){t.sf||(t.sf=t.getContext,t.getContext=function(e,n){return"webgl"==e==(n=t.sf(e,n))instanceof WebGLRenderingContext?n:null});var n=1<e.majorVersion?t.getContext("webgl2",e):t.getContext("webgl",e);return n?function(t,e){var n=Ue(Be),i={Vf:n,attributes:e,version:e.majorVersion,je:t};return t.canvas&&(t.canvas.yf=i),Be[n]=i,(void 0===e.Kf||e.Kf)&&function(t){if(t||(t=ze),!t.Yf){t.Yf=!0;var e=t.je;!function(t){var e=t.getExtension("ANGLE_instanced_arrays");e&&(t.vertexAttribDivisor=function(t,n){e.vertexAttribDivisorANGLE(t,n)},t.drawArraysInstanced=function(t,n,i,r){e.drawArraysInstancedANGLE(t,n,i,r)},t.drawElementsInstanced=function(t,n,i,r,a){e.drawElementsInstancedANGLE(t,n,i,r,a)})}(e),function(t){var e=t.getExtension("OES_vertex_array_object");e&&(t.createVertexArray=function(){return e.createVertexArrayOES()},t.deleteVertexArray=function(t){e.deleteVertexArrayOES(t)},t.bindVertexArray=function(t){e.bindVertexArrayOES(t)},t.isVertexArray=function(t){return e.isVertexArrayOES(t)})}(e),function(t){var e=t.getExtension("WEBGL_draw_buffers");e&&(t.drawBuffers=function(t,n){e.drawBuffersWEBGL(t,n)})}(e),e.pf=e.getExtension("WEBGL_draw_instanced_base_vertex_base_instance"),e.uf=e.getExtension("WEBGL_multi_draw_instanced_base_vertex_base_instance"),2<=t.version&&(e.qf=e.getExtension("EXT_disjoint_timer_query_webgl2")),(2>t.version||!e.qf)&&(e.qf=e.getExtension("EXT_disjoint_timer_query")),e.Eg=e.getExtension("WEBGL_multi_draw"),(e.getSupportedExtensions()||[]).forEach((function(t){t.includes("lose_context")||t.includes("debug")||e.getExtension(t)}))}}(i),n}(n,e):0}(t,i),t?(Ne(t),t):0},t.deleteContext=function(t){ze===Be[t]&&(ze=null),"object"==typeof JSEvents&&JSEvents.Hg(Be[t].je.canvas),Be[t]&&Be[t].je.canvas&&(Be[t].je.canvas.yf=void 0),Be[t]=null},t._setTextureCleanup({deleteTexture:function(t,e){var n=ke[e];n&&Be[t].je.deleteTexture(n),ke[e]=null}}),t.MakeGrContext=function(t){if(!this.Od(t))return null;var e=this._MakeGrContext();return e?(e.Md=t,e):null},t.MakeOnScreenGLSurface=function(t,e,n,i){return this.Od(t.Md)&&(e=this._MakeOnScreenGLSurface(t,e,n,i))?(e.Md=t.Md,e):null},t.MakeRenderTarget=function(){var t=arguments[0];if(!this.Od(t.Md))return null;if(3===arguments.length){var e=this._MakeRenderTargetWH(t,arguments[1],arguments[2]);if(!e)return null}else{if(2!==arguments.length)return null;if(!(e=this._MakeRenderTargetII(t,arguments[1])))return null}return e.Md=t.Md,e},t.MakeWebGLCanvasSurface=function(e,n,i){n=n||null;var r=e,a="undefined"!=typeof OffscreenCanvas&&r instanceof OffscreenCanvas;if(!("undefined"!=typeof HTMLCanvasElement&&r instanceof HTMLCanvasElement||a||(r=document.getElementById(e),r)))throw"Canvas with id "+e+" was not found";if(!(e=this.GetWebGLContext(r,i))||0>e)throw"failed to create webgl context: err "+e;return e=this.MakeGrContext(e),(n=this.MakeOnScreenGLSurface(e,r.width,r.height,n))||(n=r.cloneNode(!0),r.parentNode.replaceChild(n,r),n.classList.add("ck-replaced"),t.MakeSWCanvasSurface(n))},t.MakeCanvasSurface=t.MakeWebGLCanvasSurface,t.Surface.prototype.makeImageFromTexture=function(e,i){return t.Od(this.Md),e=n(e),(i=this._makeImageFromTexture(this.Md,e,i))&&(i.Ke=e),i},t.Surface.prototype.makeImageFromTextureSource=function(e,n){n||(n={height:i(e),width:r(e),colorType:t.ColorType.RGBA_8888,alphaType:t.AlphaType.Unpremul}),n.colorSpace||(n.colorSpace=t.ColorSpace.SRGB),t.Od(this.Md);var a=ze.je,o=a.createTexture();return a.bindTexture(a.TEXTURE_2D,o),2===ze.version?a.texImage2D(a.TEXTURE_2D,0,a.RGBA,n.width,n.height,0,a.RGBA,a.UNSIGNED_BYTE,e):a.texImage2D(a.TEXTURE_2D,0,a.RGBA,a.RGBA,a.UNSIGNED_BYTE,e),a.bindTexture(a.TEXTURE_2D,null),this.makeImageFromTexture(o,n)},t.Surface.prototype.updateTextureFromSource=function(e,a){if(e.Ke){t.Od(this.Md);var o=ze.je,s=ke[e.Ke];o.bindTexture(o.TEXTURE_2D,s),2===ze.version?o.texImage2D(o.TEXTURE_2D,0,o.RGBA,r(a),i(a),0,o.RGBA,o.UNSIGNED_BYTE,a):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,a),o.bindTexture(o.TEXTURE_2D,null),this._resetContext(),ke[e.Ke]=null,e.Ke=n(s),(a=e.getImageInfo()).colorSpace=e.getColorSpace(),o=this._makeImageFromTexture(this.Md,e.Ke,a),s=e.Ld.Qd;var l=e.Ld.$d;e.Ld.Qd=o.Ld.Qd,e.Ld.$d=o.Ld.$d,o.Ld.Qd=s,o.Ld.$d=l,o.delete(),a.colorSpace.delete()}},t.MakeLazyImageFromTextureSource=function(e,a){a||(a={height:i(e),width:r(e),colorType:t.ColorType.RGBA_8888,alphaType:t.AlphaType.Unpremul}),a.colorSpace||(a.colorSpace=t.ColorSpace.SRGB);var o={makeTexture:function(){var t=ze,i=t.je,r=i.createTexture();return i.bindTexture(i.TEXTURE_2D,r),2===t.version?i.texImage2D(i.TEXTURE_2D,0,i.RGBA,a.width,a.height,0,i.RGBA,i.UNSIGNED_BYTE,e):i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e),i.bindTexture(i.TEXTURE_2D,null),n(r)},freeSrc:function(){}};return"VideoFrame"===e.constructor.name&&(o.freeSrc=function(){e.close()}),t.Image._makeFromGenerator(a,o)},t.Od=function(t){return!!t&&Ne(t)}}))}(e),function(t){function n(t,e,n,i,r){for(var a=0;a<t.length;a++)e[a*n+(a*r+i+n)%n]=t[a];return e}function i(t){for(var e=t*t,n=Array(e);e--;)n[e]=0==e%(t+1)?1:0;return n}function r(t){return!!t&&t.constructor===Float32Array&&4===t.length}function a(t){return(l(255*t[3])<<24|l(255*t[0])<<16|l(255*t[1])<<8|l(255*t[2])<<0)>>>0}function o(t){if(t&&t._ck)return t;if(t instanceof Float32Array){for(var e=Math.floor(t.length/4),n=new Uint32Array(e),i=0;i<e;i++)n[i]=a(t.slice(4*i,4*(i+1)));return n}return t instanceof Uint32Array?t:t instanceof Array&&t[0]instanceof Float32Array?t.map(a):void 0}function s(t){if(void 0===t)return 1;var e=parseFloat(t);return t&&-1!==t.indexOf("%")?e/100:e}function l(t){return Math.round(Math.max(0,Math.min(t||0,255)))}function c(e,n){n&&n._ck||t._free(e)}function u(e,n,i){if(!e||!e.length)return $;if(e&&e._ck)return e.byteOffset;var r=t[n].BYTES_PER_ELEMENT;return i||(i=t._malloc(e.length*r)),t[n].set(e,i/r),i}function h(e){var n={de:$,count:e.length,Le:t.ColorType.RGBA_F32};if(e instanceof Float32Array)n.de=u(e,"HEAPF32"),n.count=e.length/4;else if(e instanceof Uint32Array)n.de=u(e,"HEAPU32"),n.Le=t.ColorType.RGBA_8888;else{if(!(e instanceof Array))throw"Invalid argument to copyFlexibleColorArray, Not a color array "+typeof e;if(e&&e.length){for(var i=t._malloc(16*e.length),r=0,a=i/4,o=0;o<e.length;o++)for(var s=0;4>s;s++)t.HEAPF32[a+r]=e[o][s],r++;e=i}else e=$;n.de=e}return n}function d(e){if(!e)return $;if(e.length){if(6===e.length||9===e.length)return u(e,"HEAPF32",R),6===e.length&&t.HEAPF32.set(H,6+R/4),R;if(16===e.length){var n=S.toTypedArray();return n[0]=e[0],n[1]=e[1],n[2]=e[3],n[3]=e[4],n[4]=e[5],n[5]=e[7],n[6]=e[12],n[7]=e[13],n[8]=e[15],R}throw"invalid matrix size"}return(n=S.toTypedArray())[0]=e.m11,n[1]=e.m21,n[2]=e.m41,n[3]=e.m12,n[4]=e.m22,n[5]=e.m42,n[6]=e.m14,n[7]=e.m24,n[8]=e.m44,R}function f(t,e){return u(t,"HEAPF32",e||I)}function p(t,e,n,i){var r=C.toTypedArray();return r[0]=t,r[1]=e,r[2]=n,r[3]=i,I}function g(e){for(var n=new Float32Array(4),i=0;4>i;i++)n[i]=t.HEAPF32[e/4+i];return n}function m(t,e){return u(t,"HEAPF32",e||L)}function y(t,e){return u(t,"HEAPF32",e||N)}function v(){for(var t=0,e=0;e<arguments.length-1;e+=2)t+=arguments[e]*arguments[e+1];return t}function w(t,e,n){for(var i=Array(t.length),r=0;r<n;r++)for(var a=0;a<n;a++){for(var o=0,s=0;s<n;s++)o+=t[n*r+s]*e[n*s+a];i[r*n+a]=o}return i}function b(t,e){for(var n=w(e[0],e[1],t),i=2;i<e.length;)n=w(n,e[i],t),i++;return n}t.Color=function(e,n,i,r){return void 0===r&&(r=1),t.Color4f(l(e)/255,l(n)/255,l(i)/255,r)},t.ColorAsInt=function(t,e,n,i){return void 0===i&&(i=255),(l(i)<<24|l(t)<<16|l(e)<<8|l(n)<<0&268435455)>>>0},t.Color4f=function(t,e,n,i){return void 0===i&&(i=1),Float32Array.of(t,e,n,i)},Object.defineProperty(t,"TRANSPARENT",{get:function(){return t.Color4f(0,0,0,0)}}),Object.defineProperty(t,"BLACK",{get:function(){return t.Color4f(0,0,0,1)}}),Object.defineProperty(t,"WHITE",{get:function(){return t.Color4f(1,1,1,1)}}),Object.defineProperty(t,"RED",{get:function(){return t.Color4f(1,0,0,1)}}),Object.defineProperty(t,"GREEN",{get:function(){return t.Color4f(0,1,0,1)}}),Object.defineProperty(t,"BLUE",{get:function(){return t.Color4f(0,0,1,1)}}),Object.defineProperty(t,"YELLOW",{get:function(){return t.Color4f(1,1,0,1)}}),Object.defineProperty(t,"CYAN",{get:function(){return t.Color4f(0,1,1,1)}}),Object.defineProperty(t,"MAGENTA",{get:function(){return t.Color4f(1,0,1,1)}}),t.getColorComponents=function(t){return[Math.floor(255*t[0]),Math.floor(255*t[1]),Math.floor(255*t[2]),t[3]]},t.parseColorString=function(e,n){if((e=e.toLowerCase()).startsWith("#")){switch(n=255,e.length){case 9:n=parseInt(e.slice(7,9),16);case 7:var i=parseInt(e.slice(1,3),16),r=parseInt(e.slice(3,5),16),a=parseInt(e.slice(5,7),16);break;case 5:n=17*parseInt(e.slice(4,5),16);case 4:i=17*parseInt(e.slice(1,2),16),r=17*parseInt(e.slice(2,3),16),a=17*parseInt(e.slice(3,4),16)}return t.Color(i,r,a,n/255)}return e.startsWith("rgba")?(e=(e=e.slice(5,-1)).split(","),t.Color(+e[0],+e[1],+e[2],s(e[3]))):e.startsWith("rgb")?(e=(e=e.slice(4,-1)).split(","),t.Color(+e[0],+e[1],+e[2],s(e[3]))):e.startsWith("gray(")||e.startsWith("hsl")||!n||void 0===(e=n[e])?t.BLACK:e},t.multiplyByAlpha=function(t,e){return(t=t.slice())[3]=Math.max(0,Math.min(t[3]*e,1)),t},t.Malloc=function(e,n){var i=t._malloc(n*e.BYTES_PER_ELEMENT);return{_ck:!0,length:n,byteOffset:i,pe:null,subarray:function(t,e){return(t=this.toTypedArray().subarray(t,e))._ck=!0,t},toTypedArray:function(){return this.pe&&this.pe.length||(this.pe=new e(t.HEAPU8.buffer,i,n),this.pe._ck=!0),this.pe}}},t.Free=function(e){t._free(e.byteOffset),e.byteOffset=$,e.toTypedArray=null,e.pe=null};var S,A,C,T,_,P,x,M,F,E,R=$,B=$,I=$,L=$,G=$,j=$,W=$,U=$,N=$,z=$,H=Float32Array.of(0,0,1),$=0;t.onRuntimeInitialized=function(){function e(e,n,i,r,a,o){o||(o=4*r.width,r.colorType===t.ColorType.RGBA_F16?o*=2:r.colorType===t.ColorType.RGBA_F32&&(o*=4));var s=o*r.height,l=a?a.byteOffset:t._malloc(s);if(!e._readPixels(r,l,o,n,i))return a||t._free(l),null;if(a)return a.toTypedArray();switch(r.colorType){case t.ColorType.RGBA_8888:case t.ColorType.RGBA_F16:e=new Uint8Array(t.HEAPU8.buffer,l,s).slice();break;case t.ColorType.RGBA_F32:e=new Float32Array(t.HEAPU8.buffer,l,s).slice();break;default:return null}return t._free(l),e}C=t.Malloc(Float32Array,4),I=C.byteOffset,A=t.Malloc(Float32Array,16),B=A.byteOffset,S=t.Malloc(Float32Array,9),R=S.byteOffset,F=t.Malloc(Float32Array,12),N=F.byteOffset,E=t.Malloc(Float32Array,12),z=E.byteOffset,T=t.Malloc(Float32Array,4),L=T.byteOffset,_=t.Malloc(Float32Array,4),G=_.byteOffset,P=t.Malloc(Float32Array,3),j=P.byteOffset,x=t.Malloc(Float32Array,3),W=x.byteOffset,M=t.Malloc(Int32Array,4),U=M.byteOffset,t.ColorSpace.SRGB=t.ColorSpace._MakeSRGB(),t.ColorSpace.DISPLAY_P3=t.ColorSpace._MakeDisplayP3(),t.ColorSpace.ADOBE_RGB=t.ColorSpace._MakeAdobeRGB(),t.GlyphRunFlags={IsWhiteSpace:t._GlyphRunFlags_isWhiteSpace},t.Path.MakeFromCmds=function(e){var n=u(e,"HEAPF32"),i=t.Path._MakeFromCmds(n,e.length);return c(n,e),i},t.Path.MakeFromVerbsPointsWeights=function(e,n,i){var r=u(e,"HEAPU8"),a=u(n,"HEAPF32"),o=u(i,"HEAPF32"),s=t.Path._MakeFromVerbsPointsWeights(r,e.length,a,n.length,o,i&&i.length||0);return c(r,e),c(a,n),c(o,i),s},t.Path.prototype.addArc=function(t,e,n){return t=m(t),this._addArc(t,e,n),this},t.Path.prototype.addOval=function(t,e,n){return void 0===n&&(n=1),t=m(t),this._addOval(t,!!e,n),this},t.Path.prototype.addPath=function(){var t=Array.prototype.slice.call(arguments),e=t[0],n=!1;if("boolean"==typeof t[t.length-1]&&(n=t.pop()),1===t.length)this._addPath(e,1,0,0,0,1,0,0,0,1,n);else if(2===t.length)t=t[1],this._addPath(e,t[0],t[1],t[2],t[3],t[4],t[5],t[6]||0,t[7]||0,t[8]||1,n);else{if(7!==t.length&&10!==t.length)return null;this._addPath(e,t[1],t[2],t[3],t[4],t[5],t[6],t[7]||0,t[8]||0,t[9]||1,n)}return this},t.Path.prototype.addPoly=function(t,e){var n=u(t,"HEAPF32");return this._addPoly(n,t.length/2,e),c(n,t),this},t.Path.prototype.addRect=function(t,e){return t=m(t),this._addRect(t,!!e),this},t.Path.prototype.addRRect=function(t,e){return t=y(t),this._addRRect(t,!!e),this},t.Path.prototype.addVerbsPointsWeights=function(t,e,n){var i=u(t,"HEAPU8"),r=u(e,"HEAPF32"),a=u(n,"HEAPF32");this._addVerbsPointsWeights(i,t.length,r,e.length,a,n&&n.length||0),c(i,t),c(r,e),c(a,n)},t.Path.prototype.arc=function(e,n,i,r,a,o){return e=t.LTRBRect(e-i,n-i,e+i,n+i),a=(a-r)/Math.PI*180-360*!!o,(o=new t.Path).addArc(e,r/Math.PI*180,a),this.addPath(o,!0),o.delete(),this},t.Path.prototype.arcToOval=function(t,e,n,i){return t=m(t),this._arcToOval(t,e,n,i),this},t.Path.prototype.arcToRotated=function(t,e,n,i,r,a,o){return this._arcToRotated(t,e,n,!!i,!!r,a,o),this},t.Path.prototype.arcToTangent=function(t,e,n,i,r){return this._arcToTangent(t,e,n,i,r),this},t.Path.prototype.close=function(){return this._close(),this},t.Path.prototype.conicTo=function(t,e,n,i,r){return this._conicTo(t,e,n,i,r),this},t.Path.prototype.computeTightBounds=function(t){this._computeTightBounds(L);var e=T.toTypedArray();return t?(t.set(e),t):e.slice()},t.Path.prototype.cubicTo=function(t,e,n,i,r,a){return this._cubicTo(t,e,n,i,r,a),this},t.Path.prototype.dash=function(t,e,n){return this._dash(t,e,n)?this:null},t.Path.prototype.getBounds=function(t){this._getBounds(L);var e=T.toTypedArray();return t?(t.set(e),t):e.slice()},t.Path.prototype.lineTo=function(t,e){return this._lineTo(t,e),this},t.Path.prototype.moveTo=function(t,e){return this._moveTo(t,e),this},t.Path.prototype.offset=function(t,e){return this._transform(1,0,t,0,1,e,0,0,1),this},t.Path.prototype.quadTo=function(t,e,n,i){return this._quadTo(t,e,n,i),this},t.Path.prototype.rArcTo=function(t,e,n,i,r,a,o){return this._rArcTo(t,e,n,i,r,a,o),this},t.Path.prototype.rConicTo=function(t,e,n,i,r){return this._rConicTo(t,e,n,i,r),this},t.Path.prototype.rCubicTo=function(t,e,n,i,r,a){return this._rCubicTo(t,e,n,i,r,a),this},t.Path.prototype.rLineTo=function(t,e){return this._rLineTo(t,e),this},t.Path.prototype.rMoveTo=function(t,e){return this._rMoveTo(t,e),this},t.Path.prototype.rQuadTo=function(t,e,n,i){return this._rQuadTo(t,e,n,i),this},t.Path.prototype.stroke=function(e){return(e=e||{}).width=e.width||1,e.miter_limit=e.miter_limit||4,e.cap=e.cap||t.StrokeCap.Butt,e.join=e.join||t.StrokeJoin.Miter,e.precision=e.precision||1,this._stroke(e)?this:null},t.Path.prototype.transform=function(){if(1===arguments.length){var t=arguments[0];this._transform(t[0],t[1],t[2],t[3],t[4],t[5],t[6]||0,t[7]||0,t[8]||1)}else{if(6!==arguments.length&&9!==arguments.length)throw"transform expected to take 1 or 9 arguments. Got "+arguments.length;t=arguments,this._transform(t[0],t[1],t[2],t[3],t[4],t[5],t[6]||0,t[7]||0,t[8]||1)}return this},t.Path.prototype.trim=function(t,e,n){return this._trim(t,e,!!n)?this:null},t.Image.prototype.makeShaderCubic=function(t,e,n,i,r){return r=d(r),this._makeShaderCubic(t,e,n,i,r)},t.Image.prototype.makeShaderOptions=function(t,e,n,i,r){return r=d(r),this._makeShaderOptions(t,e,n,i,r)},t.Image.prototype.readPixels=function(t,n,i,r,a){return e(this,t,n,i,r,a)},t.Canvas.prototype.clear=function(e){t.Od(this.Md),e=f(e),this._clear(e)},t.Canvas.prototype.clipRRect=function(e,n,i){t.Od(this.Md),e=y(e),this._clipRRect(e,n,i)},t.Canvas.prototype.clipRect=function(e,n,i){t.Od(this.Md),e=m(e),this._clipRect(e,n,i)},t.Canvas.prototype.concat=function(e){t.Od(this.Md),e=function(t){if(!t)return $;var e=A.toTypedArray();if(t.length){if(16!==t.length&&6!==t.length&&9!==t.length)throw"invalid matrix size";return 16===t.length?u(t,"HEAPF32",B):(e.fill(0),e[0]=t[0],e[1]=t[1],e[3]=t[2],e[4]=t[3],e[5]=t[4],e[7]=t[5],e[12]=t[6],e[13]=t[7],e[15]=t[8],6===t.length&&(e[12]=0,e[13]=0,e[15]=1),B)}return e[0]=t.m11,e[1]=t.m21,e[2]=t.m31,e[3]=t.m41,e[4]=t.m12,e[5]=t.m22,e[6]=t.m32,e[7]=t.m42,e[8]=t.m13,e[9]=t.m23,e[10]=t.m33,e[11]=t.m43,e[12]=t.m14,e[13]=t.m24,e[14]=t.m34,e[15]=t.m44,B}(e),this._concat(e)},t.Canvas.prototype.drawArc=function(e,n,i,r,a){t.Od(this.Md),e=m(e),this._drawArc(e,n,i,r,a)},t.Canvas.prototype.drawAtlas=function(e,n,i,r,a,s,l){if(e&&r&&n&&i&&n.length===i.length){t.Od(this.Md),a||(a=t.BlendMode.SrcOver);var h=u(n,"HEAPF32"),d=u(i,"HEAPF32"),f=i.length/4,p=u(o(s),"HEAPU32");if(l&&"B"in l&&"C"in l)this._drawAtlasCubic(e,d,h,p,f,a,l.B,l.C,r);else{let n=t.FilterMode.Linear,i=t.MipmapMode.None;l&&(n=l.filter,"mipmap"in l&&(i=l.mipmap)),this._drawAtlasOptions(e,d,h,p,f,a,n,i,r)}c(h,n),c(d,i),c(p,s)}},t.Canvas.prototype.drawCircle=function(e,n,i,r){t.Od(this.Md),this._drawCircle(e,n,i,r)},t.Canvas.prototype.drawColor=function(e,n){t.Od(this.Md),e=f(e),void 0!==n?this._drawColor(e,n):this._drawColor(e)},t.Canvas.prototype.drawColorInt=function(e,n){t.Od(this.Md),this._drawColorInt(e,n||t.BlendMode.SrcOver)},t.Canvas.prototype.drawColorComponents=function(e,n,i,r,a){t.Od(this.Md),e=p(e,n,i,r),void 0!==a?this._drawColor(e,a):this._drawColor(e)},t.Canvas.prototype.drawDRRect=function(e,n,i){t.Od(this.Md),e=y(e,N),n=y(n,z),this._drawDRRect(e,n,i)},t.Canvas.prototype.drawGlyphs=function(e,n,i,r,a,o){if(!(2*e.length<=n.length))throw"Not enough positions for the array of gyphs";t.Od(this.Md);const s=u(e,"HEAPU16"),l=u(n,"HEAPF32");this._drawGlyphs(e.length,s,l,i,r,a,o),c(l,n),c(s,e)},t.Canvas.prototype.drawImage=function(e,n,i,r){t.Od(this.Md),this._drawImage(e,n,i,r||null)},t.Canvas.prototype.drawImageCubic=function(e,n,i,r,a,o){t.Od(this.Md),this._drawImageCubic(e,n,i,r,a,o||null)},t.Canvas.prototype.drawImageOptions=function(e,n,i,r,a,o){t.Od(this.Md),this._drawImageOptions(e,n,i,r,a,o||null)},t.Canvas.prototype.drawImageNine=function(e,n,i,r,a){t.Od(this.Md),n=u(n,"HEAP32",U),i=m(i),this._drawImageNine(e,n,i,r,a||null)},t.Canvas.prototype.drawImageRect=function(e,n,i,r,a){t.Od(this.Md),m(n,L),m(i,G),this._drawImageRect(e,L,G,r,!!a)},t.Canvas.prototype.drawImageRectCubic=function(e,n,i,r,a,o){t.Od(this.Md),m(n,L),m(i,G),this._drawImageRectCubic(e,L,G,r,a,o||null)},t.Canvas.prototype.drawImageRectOptions=function(e,n,i,r,a,o){t.Od(this.Md),m(n,L),m(i,G),this._drawImageRectOptions(e,L,G,r,a,o||null)},t.Canvas.prototype.drawLine=function(e,n,i,r,a){t.Od(this.Md),this._drawLine(e,n,i,r,a)},t.Canvas.prototype.drawOval=function(e,n){t.Od(this.Md),e=m(e),this._drawOval(e,n)},t.Canvas.prototype.drawPaint=function(e){t.Od(this.Md),this._drawPaint(e)},t.Canvas.prototype.drawParagraph=function(e,n,i){t.Od(this.Md),this._drawParagraph(e,n,i)},t.Canvas.prototype.drawPatch=function(e,n,i,r,a){if(24>e.length)throw"Need 12 cubic points";if(n&&4>n.length)throw"Need 4 colors";if(i&&8>i.length)throw"Need 4 shader coordinates";t.Od(this.Md);const s=u(e,"HEAPF32"),l=n?u(o(n),"HEAPU32"):$,h=i?u(i,"HEAPF32"):$;r||(r=t.BlendMode.Modulate),this._drawPatch(s,l,h,r,a),c(h,i),c(l,n),c(s,e)},t.Canvas.prototype.drawPath=function(e,n){t.Od(this.Md),this._drawPath(e,n)},t.Canvas.prototype.drawPicture=function(e){t.Od(this.Md),this._drawPicture(e)},t.Canvas.prototype.drawPoints=function(e,n,i){t.Od(this.Md);var r=u(n,"HEAPF32");this._drawPoints(e,r,n.length/2,i),c(r,n)},t.Canvas.prototype.drawRRect=function(e,n){t.Od(this.Md),e=y(e),this._drawRRect(e,n)},t.Canvas.prototype.drawRect=function(e,n){t.Od(this.Md),e=m(e),this._drawRect(e,n)},t.Canvas.prototype.drawRect4f=function(e,n,i,r,a){t.Od(this.Md),this._drawRect4f(e,n,i,r,a)},t.Canvas.prototype.drawShadow=function(e,n,i,r,a,o,s){t.Od(this.Md);var l=u(a,"HEAPF32"),h=u(o,"HEAPF32");n=u(n,"HEAPF32",j),i=u(i,"HEAPF32",W),this._drawShadow(e,n,i,r,l,h,s),c(l,a),c(h,o)},t.getShadowLocalBounds=function(t,e,n,i,r,a,o){return t=d(t),n=u(n,"HEAPF32",j),i=u(i,"HEAPF32",W),this._getShadowLocalBounds(t,e,n,i,r,a,L)?(e=T.toTypedArray(),o?(o.set(e),o):e.slice()):null},t.Canvas.prototype.drawTextBlob=function(e,n,i,r){t.Od(this.Md),this._drawTextBlob(e,n,i,r)},t.Canvas.prototype.drawVertices=function(e,n,i){t.Od(this.Md),this._drawVertices(e,n,i)},t.Canvas.prototype.getLocalToDevice=function(){this._getLocalToDevice(B);for(var e=B,n=Array(16),i=0;16>i;i++)n[i]=t.HEAPF32[e/4+i];return n},t.Canvas.prototype.getTotalMatrix=function(){this._getTotalMatrix(R);for(var e=Array(9),n=0;9>n;n++)e[n]=t.HEAPF32[R/4+n];return e},t.Canvas.prototype.makeSurface=function(t){return(t=this._makeSurface(t)).Md=this.Md,t},t.Canvas.prototype.readPixels=function(n,i,r,a,o){return t.Od(this.Md),e(this,n,i,r,a,o)},t.Canvas.prototype.saveLayer=function(t,e,n,i){return e=m(e),this._saveLayer(t||null,e,n||null,i||0)},t.Canvas.prototype.writePixels=function(e,n,i,r,a,o,s,l){if(e.byteLength%(n*i))throw"pixels length must be a multiple of the srcWidth * srcHeight";t.Od(this.Md);var h=e.byteLength/(n*i);o=o||t.AlphaType.Unpremul,s=s||t.ColorType.RGBA_8888,l=l||t.ColorSpace.SRGB;var d=h*n;return h=u(e,"HEAPU8"),n=this._writePixels({width:n,height:i,colorType:s,alphaType:o,colorSpace:l},h,d,r,a),c(h,e),n},t.ColorFilter.MakeBlend=function(e,n){return e=f(e),t.ColorFilter._MakeBlend(e,n)},t.ColorFilter.MakeMatrix=function(e){if(!e||20!==e.length)throw"invalid color matrix";var n=u(e,"HEAPF32"),i=t.ColorFilter._makeMatrix(n);return c(n,e),i},t.ContourMeasure.prototype.getPosTan=function(t,e){return this._getPosTan(t,L),t=T.toTypedArray(),e?(e.set(t),e):t.slice()},t.ImageFilter.MakeMatrixTransform=function(e,n,i){if(e=d(e),"B"in n&&"C"in n)return t.ImageFilter._MakeMatrixTransformCubic(e,n.Ag,n.Bg,i);const r=n.filter;let a=t.MipmapMode.None;return"mipmap"in n&&(a=n.mipmap),t.ImageFilter._MakeMatrixTransformOptions(e,r,a,i)},t.Paint.prototype.getColor=function(){return this._getColor(I),g(I)},t.Paint.prototype.setColor=function(t,e){e=e||null,t=f(t),this._setColor(t,e)},t.Paint.prototype.setColorComponents=function(t,e,n,i,r){r=r||null,t=p(t,e,n,i),this._setColor(t,r)},t.Path.prototype.getPoint=function(t,e){return this._getPoint(t,L),t=T.toTypedArray(),e?(e[0]=t[0],e[1]=t[1],e):t.slice(0,2)},t.PictureRecorder.prototype.beginRecording=function(t){return t=m(t),this._beginRecording(t)},t.Surface.prototype.getCanvas=function(){var t=this._getCanvas();return t.Md=this.Md,t},t.Surface.prototype.makeImageSnapshot=function(e){return t.Od(this.Md),e=u(e,"HEAP32",U),this._makeImageSnapshot(e)},t.Surface.prototype.makeSurface=function(e){return t.Od(this.Md),(e=this._makeSurface(e)).Md=this.Md,e},t.Surface.prototype.requestAnimationFrame=function(e,n){this.Ge||(this.Ge=this.getCanvas()),requestAnimationFrame(function(){t.Od(this.Md),e(this.Ge),this.flush(n)}.bind(this))},t.Surface.prototype.drawOnce=function(e,n){this.Ge||(this.Ge=this.getCanvas()),requestAnimationFrame(function(){t.Od(this.Md),e(this.Ge),this.flush(n),this.dispose()}.bind(this))},t.PathEffect.MakeDash=function(e,n){if(n||(n=0),!e.length||1==e.length%2)throw"Intervals array must have even length";var i=u(e,"HEAPF32");return n=t.PathEffect._MakeDash(i,e.length,n),c(i,e),n},t.PathEffect.MakeLine2D=function(e,n){return n=d(n),t.PathEffect._MakeLine2D(e,n)},t.PathEffect.MakePath2D=function(e,n){return e=d(e),t.PathEffect._MakePath2D(e,n)},t.Shader.MakeColor=function(e,n){return n=n||null,e=f(e),t.Shader._MakeColor(e,n)},t.Shader.Blend=t.Shader.MakeBlend,t.Shader.Color=t.Shader.MakeColor,t.Shader.MakeLinearGradient=function(e,n,i,r,a,o,s,l){l=l||null;var f=h(i),p=u(r,"HEAPF32");s=s||0,o=d(o);var g=T.toTypedArray();return g.set(e),g.set(n,2),e=t.Shader._MakeLinearGradient(L,f.de,f.Le,p,f.count,a,s,o,l),c(f.de,i),r&&c(p,r),e},t.Shader.MakeRadialGradient=function(e,n,i,r,a,o,s,l){l=l||null;var f=h(i),p=u(r,"HEAPF32");return s=s||0,o=d(o),e=t.Shader._MakeRadialGradient(e[0],e[1],n,f.de,f.Le,p,f.count,a,s,o,l),c(f.de,i),r&&c(p,r),e},t.Shader.MakeSweepGradient=function(e,n,i,r,a,o,s,l,f,p){p=p||null;var g=h(i),m=u(r,"HEAPF32");return s=s||0,l=l||0,f=f||360,o=d(o),e=t.Shader._MakeSweepGradient(e,n,g.de,g.Le,m,g.count,a,l,f,s,o,p),c(g.de,i),r&&c(m,r),e},t.Shader.MakeTwoPointConicalGradient=function(e,n,i,r,a,o,s,l,f,p){p=p||null;var g=h(a),m=u(o,"HEAPF32");f=f||0,l=d(l);var y=T.toTypedArray();return y.set(e),y.set(i,2),e=t.Shader._MakeTwoPointConicalGradient(L,n,r,g.de,g.Le,m,g.count,s,f,l,p),c(g.de,a),o&&c(m,o),e},t.Vertices.prototype.bounds=function(t){this._bounds(L);var e=T.toTypedArray();return t?(t.set(e),t):e.slice()},t.Vd&&t.Vd.forEach((function(t){t()}))},t.computeTonalColors=function(t){var e=u(t.ambient,"HEAPF32"),n=u(t.spot,"HEAPF32");this._computeTonalColors(e,n);var i={ambient:g(e),spot:g(n)};return c(e,t.ambient),c(n,t.spot),i},t.LTRBRect=function(t,e,n,i){return Float32Array.of(t,e,n,i)},t.XYWHRect=function(t,e,n,i){return Float32Array.of(t,e,t+n,e+i)},t.LTRBiRect=function(t,e,n,i){return Int32Array.of(t,e,n,i)},t.XYWHiRect=function(t,e,n,i){return Int32Array.of(t,e,t+n,e+i)},t.RRectXY=function(t,e,n){return Float32Array.of(t[0],t[1],t[2],t[3],e,n,e,n,e,n,e,n)},t.MakeAnimatedImageFromEncoded=function(e){e=new Uint8Array(e);var n=t._malloc(e.byteLength);return t.HEAPU8.set(e,n),(e=t._decodeAnimatedImage(n,e.byteLength))?e:null},t.MakeImageFromEncoded=function(e){e=new Uint8Array(e);var n=t._malloc(e.byteLength);return t.HEAPU8.set(e,n),(e=t._decodeImage(n,e.byteLength))?e:null};var V=null;t.MakeImageFromCanvasImageSource=function(e){var n=e.width,i=e.height;V||(V=document.createElement("canvas")),V.width=n,V.height=i;var r=V.getContext("2d",{Jg:!0});return r.drawImage(e,0,0),e=r.getImageData(0,0,n,i),t.MakeImage({width:n,height:i,alphaType:t.AlphaType.Unpremul,colorType:t.ColorType.RGBA_8888,colorSpace:t.ColorSpace.SRGB},e.data,4*n)},t.MakeImage=function(e,n,i){var r=t._malloc(n.length);return t.HEAPU8.set(n,r),t._MakeImage(e,r,n.length,i)},t.MakeVertices=function(e,n,i,r,a,s){var l=a&&a.length||0,c=0;return i&&i.length&&(c|=1),r&&r.length&&(c|=2),void 0===s||s||(c|=4),u(n,"HEAPF32",(e=new t._VerticesBuilder(e,n.length/2,l,c)).positions()),e.texCoords()&&u(i,"HEAPF32",e.texCoords()),e.colors()&&u(o(r),"HEAPU32",e.colors()),e.indices()&&u(a,"HEAPU16",e.indices()),e.detach()},t.Matrix={},t.Matrix.identity=function(){return i(3)},t.Matrix.invert=function(t){var e=t[0]*t[4]*t[8]+t[1]*t[5]*t[6]+t[2]*t[3]*t[7]-t[2]*t[4]*t[6]-t[1]*t[3]*t[8]-t[0]*t[5]*t[7];return e?[(t[4]*t[8]-t[5]*t[7])/e,(t[2]*t[7]-t[1]*t[8])/e,(t[1]*t[5]-t[2]*t[4])/e,(t[5]*t[6]-t[3]*t[8])/e,(t[0]*t[8]-t[2]*t[6])/e,(t[2]*t[3]-t[0]*t[5])/e,(t[3]*t[7]-t[4]*t[6])/e,(t[1]*t[6]-t[0]*t[7])/e,(t[0]*t[4]-t[1]*t[3])/e]:null},t.Matrix.mapPoints=function(t,e){for(var n=0;n<e.length;n+=2){var i=e[n],r=e[n+1],a=t[6]*i+t[7]*r+t[8],o=t[3]*i+t[4]*r+t[5];e[n]=(t[0]*i+t[1]*r+t[2])/a,e[n+1]=o/a}return e},t.Matrix.multiply=function(){return b(3,arguments)},t.Matrix.rotated=function(t,e,n){e=e||0,n=n||0;var i=Math.sin(t);return[t=Math.cos(t),-i,v(i,n,1-t,e),i,t,v(-i,e,1-t,n),0,0,1]},t.Matrix.scaled=function(t,e,r,a){r=r||0,a=a||0;var o=n([t,e],i(3),3,0,1);return n([r-t*r,a-e*a],o,3,2,0)},t.Matrix.skewed=function(t,e,r,a){r=r||0,a=a||0;var o=n([t,e],i(3),3,1,-1);return n([-t*r,-e*a],o,3,2,0)},t.Matrix.translated=function(t,e){return n(arguments,i(3),3,2,0)},t.Vector={},t.Vector.dot=function(t,e){return t.map((function(t,n){return t*e[n]})).reduce((function(t,e){return t+e}))},t.Vector.lengthSquared=function(e){return t.Vector.dot(e,e)},t.Vector.length=function(e){return Math.sqrt(t.Vector.lengthSquared(e))},t.Vector.mulScalar=function(t,e){return t.map((function(t){return t*e}))},t.Vector.add=function(t,e){return t.map((function(t,n){return t+e[n]}))},t.Vector.sub=function(t,e){return t.map((function(t,n){return t-e[n]}))},t.Vector.dist=function(e,n){return t.Vector.length(t.Vector.sub(e,n))},t.Vector.normalize=function(e){return t.Vector.mulScalar(e,1/t.Vector.length(e))},t.Vector.cross=function(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]},t.M44={},t.M44.identity=function(){return i(4)},t.M44.translated=function(t){return n(t,i(4),4,3,0)},t.M44.scaled=function(t){return n(t,i(4),4,0,1)},t.M44.rotated=function(e,n){return t.M44.rotatedUnitSinCos(t.Vector.normalize(e),Math.sin(n),Math.cos(n))},t.M44.rotatedUnitSinCos=function(t,e,n){var i=t[0],r=t[1],a=1-n;return[a*i*i+n,a*i*r-e*(t=t[2]),a*i*t+e*r,0,a*i*r+e*t,a*r*r+n,a*r*t-e*i,0,a*i*t-e*r,a*r*t+e*i,a*t*t+n,0,0,0,0,1]},t.M44.lookat=function(e,i,r){i=t.Vector.normalize(t.Vector.sub(i,e)),r=t.Vector.normalize(r),r=t.Vector.normalize(t.Vector.cross(i,r));var a=t.M44.identity();return n(r,a,4,0,0),n(t.Vector.cross(r,i),a,4,1,0),n(t.Vector.mulScalar(i,-1),a,4,2,0),n(e,a,4,3,0),null===(e=t.M44.invert(a))?t.M44.identity():e},t.M44.perspective=function(t,e,n){var i=1/(e-t);return n/=2,[n=Math.cos(n)/Math.sin(n),0,0,0,0,n,0,0,0,0,(e+t)*i,2*e*t*i,0,0,-1,1]},t.M44.rc=function(t,e,n){return t[4*e+n]},t.M44.multiply=function(){return b(4,arguments)},t.M44.invert=function(t){var e=t[0],n=t[4],i=t[8],r=t[12],a=t[1],o=t[5],s=t[9],l=t[13],c=t[2],u=t[6],h=t[10],d=t[14],f=t[3],p=t[7],g=t[11],m=e*o-n*a,y=e*s-i*a,v=e*l-r*a,w=n*s-i*o,b=n*l-r*o,S=i*l-r*s,A=c*p-u*f,C=c*g-h*f,T=c*(t=t[15])-d*f,_=u*g-h*p,P=u*t-d*p,x=h*t-d*g,M=m*x-y*P+v*_+w*T-b*C+S*A,F=1/M;return 0===M||1/0===F?null:(e=[o*(x*=F)-s*(P*=F)+l*(_*=F),s*(T*=F)-a*x-l*(C*=F),a*P-o*T+l*(A*=F),o*C-a*_-s*A,i*P-n*x-r*_,e*x-i*T+r*C,n*T-e*P-r*A,e*_-n*C+i*A,p*(S*=F)-g*(b*=F)+t*(w*=F),g*(v*=F)-f*S-t*(y*=F),f*b-p*v+t*(m*=F),p*y-f*w-g*m,h*b-u*S-d*w,c*S-h*v+d*y,u*v-c*b-d*m,c*w-u*y+h*m]).every((function(t){return!isNaN(t)&&1/0!==t&&-1/0!==t}))?e:null},t.M44.transpose=function(t){return[t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]]},t.M44.mustInvert=function(e){if(null===(e=t.M44.invert(e)))throw"Matrix not invertible";return e},t.M44.setupCamera=function(e,n,i){var r=t.M44.lookat(i.eye,i.coa,i.up);return i=t.M44.perspective(i.near,i.far,i.angle),n=[(e[2]-e[0])/2,(e[3]-e[1])/2,n],e=t.M44.multiply(t.M44.translated([(e[0]+e[2])/2,(e[1]+e[3])/2,0]),t.M44.scaled(n)),t.M44.multiply(e,i,r,t.M44.mustInvert(e))},t.ColorMatrix={},t.ColorMatrix.identity=function(){var t=new Float32Array(20);return t[0]=1,t[6]=1,t[12]=1,t[18]=1,t},t.ColorMatrix.scaled=function(t,e,n,i){var r=new Float32Array(20);return r[0]=t,r[6]=e,r[12]=n,r[18]=i,r};var Y,q=[[6,7,11,12],[0,10,2,12],[0,1,5,6]];t.ColorMatrix.rotated=function(e,n,i){var r=t.ColorMatrix.identity();return r[(e=q[e])[0]]=i,r[e[1]]=n,r[e[2]]=-n,r[e[3]]=i,r},t.ColorMatrix.postTranslate=function(t,e,n,i,r){return t[4]+=e,t[9]+=n,t[14]+=i,t[19]+=r,t},t.ColorMatrix.concat=function(t,e){for(var n=new Float32Array(20),i=0,r=0;20>r;r+=5){for(var a=0;4>a;a++)n[i++]=t[r]*e[a]+t[r+1]*e[a+5]+t[r+2]*e[a+10]+t[r+3]*e[a+15];n[i++]=t[r]*e[4]+t[r+1]*e[9]+t[r+2]*e[14]+t[r+3]*e[19]+t[r+4]}return n},(Y=e).Vd=Y.Vd||[],Y.Vd.push((function(){function t(t){if(!t||!t.length)return[];for(var e=[],n=0;n<t.length;n+=5){var i=Y.LTRBRect(t[n],t[n+1],t[n+2],t[n+3]);i.direction=0===t[n+4]?Y.TextDirection.RTL:Y.TextDirection.LTR,e.push(i)}return Y._free(t.byteOffset),e}function e(t){return void 0===(t=t||{}).weight&&(t.weight=Y.FontWeight.Normal),t.width=t.width||Y.FontWidth.Normal,t.slant=t.slant||Y.FontSlant.Upright,t}function n(t){if(!t||!t.length)return $;for(var e=[],n=0;n<t.length;n++){var r=i(t[n]);e.push(r)}return u(e,"HEAPU32")}function i(t){if(o[t])return o[t];var e=O(t)+1,n=Y._malloc(e);return k(t,D,n,e),o[t]=n}function r(t){if(t._colorPtr=f(t.color),t._foregroundColorPtr=$,t._backgroundColorPtr=$,t._decorationColorPtr=$,t.foregroundColor&&(t._foregroundColorPtr=f(t.foregroundColor,s)),t.backgroundColor&&(t._backgroundColorPtr=f(t.backgroundColor,l)),t.decorationColor&&(t._decorationColorPtr=f(t.decorationColor,c)),Array.isArray(t.fontFamilies)&&t.fontFamilies.length?(t._fontFamiliesPtr=n(t.fontFamilies),t._fontFamiliesLen=t.fontFamilies.length):(t._fontFamiliesPtr=$,t._fontFamiliesLen=0),t.locale){var e=t.locale;t._localePtr=i(e),t._localeLen=O(e)+1}else t._localePtr=$,t._localeLen=0;if(Array.isArray(t.shadows)&&t.shadows.length){var r=(e=t.shadows).map((function(t){return t.color||Y.BLACK})),a=e.map((function(t){return t.blurRadius||0}));t._shadowLen=e.length;for(var o=Y._malloc(8*e.length),d=o/4,p=0;p<e.length;p++){var g=e[p].offset||[0,0];Y.HEAPF32[d]=g[0],Y.HEAPF32[d+1]=g[1],d+=2}t._shadowColorsPtr=h(r).de,t._shadowOffsetsPtr=o,t._shadowBlurRadiiPtr=u(a,"HEAPF32")}else t._shadowLen=0,t._shadowColorsPtr=$,t._shadowOffsetsPtr=$,t._shadowBlurRadiiPtr=$;Array.isArray(t.fontFeatures)&&t.fontFeatures.length?(r=(e=t.fontFeatures).map((function(t){return t.name})),a=e.map((function(t){return t.value})),t._fontFeatureLen=e.length,t._fontFeatureNamesPtr=n(r),t._fontFeatureValuesPtr=u(a,"HEAPU32")):(t._fontFeatureLen=0,t._fontFeatureNamesPtr=$,t._fontFeatureValuesPtr=$)}function a(t){Y._free(t._fontFamiliesPtr),Y._free(t._shadowColorsPtr),Y._free(t._shadowOffsetsPtr),Y._free(t._shadowBlurRadiiPtr),Y._free(t._fontFeatureNamesPtr),Y._free(t._fontFeatureValuesPtr)}Y.Paragraph.prototype.getRectsForRange=function(e,n,i,r){return t(e=this._getRectsForRange(e,n,i,r))},Y.Paragraph.prototype.getRectsForPlaceholders=function(){return t(this._getRectsForPlaceholders())},Y.TypefaceFontProvider.prototype.registerFont=function(t,e){if(!(t=Y.Typeface.MakeFreeTypeFaceFromData(t)))return null;e=i(e),this._registerFont(t,e)},Y.ParagraphStyle=function(t){if(t.disableHinting=t.disableHinting||!1,t.ellipsis){var r=t.ellipsis;t._ellipsisPtr=i(r),t._ellipsisLen=O(r)+1}else t._ellipsisPtr=$,t._ellipsisLen=0;return t.heightMultiplier=t.heightMultiplier||0,t.maxLines=t.maxLines||0,(r=(r=t.strutStyle)||{}).strutEnabled=r.strutEnabled||!1,r.strutEnabled&&Array.isArray(r.fontFamilies)&&r.fontFamilies.length?(r._fontFamiliesPtr=n(r.fontFamilies),r._fontFamiliesLen=r.fontFamilies.length):(r._fontFamiliesPtr=$,r._fontFamiliesLen=0),r.fontStyle=e(r.fontStyle),r.fontSize=r.fontSize||0,r.heightMultiplier=r.heightMultiplier||0,r.halfLeading=r.halfLeading||!1,r.leading=r.leading||0,r.forceStrutHeight=r.forceStrutHeight||!1,t.strutStyle=r,t.textAlign=t.textAlign||Y.TextAlign.Start,t.textDirection=t.textDirection||Y.TextDirection.LTR,t.textHeightBehavior=t.textHeightBehavior||Y.TextHeightBehavior.All,t.textStyle=Y.TextStyle(t.textStyle),t},Y.TextStyle=function(t){return t.color||(t.color=Y.BLACK),t.decoration=t.decoration||0,t.decorationThickness=t.decorationThickness||0,t.decorationStyle=t.decorationStyle||Y.DecorationStyle.Solid,t.textBaseline=t.textBaseline||Y.TextBaseline.Alphabetic,t.fontSize=t.fontSize||0,t.letterSpacing=t.letterSpacing||0,t.wordSpacing=t.wordSpacing||0,t.heightMultiplier=t.heightMultiplier||0,t.halfLeading=t.halfLeading||!1,t.fontStyle=e(t.fontStyle),t};var o={},s=Y._malloc(16),l=Y._malloc(16),c=Y._malloc(16);Y.ParagraphBuilder.Make=function(t,e){return r(t.textStyle),e=Y.ParagraphBuilder._Make(t,e),a(t.textStyle),e},Y.ParagraphBuilder.MakeFromFontProvider=function(t,e){return r(t.textStyle),e=Y.ParagraphBuilder._MakeFromFontProvider(t,e),a(t.textStyle),e},Y.ParagraphBuilder.ShapeText=function(t,e,n){let i=0;for(const t of e)i+=t.length;if(i!==t.length)throw"Accumulated block lengths must equal text.length";return Y.ParagraphBuilder._ShapeText(t,e,n)},Y.ParagraphBuilder.prototype.pushStyle=function(t){r(t),this._pushStyle(t),a(t)},Y.ParagraphBuilder.prototype.pushPaintStyle=function(t,e,n){r(t),this._pushPaintStyle(t,e,n),a(t)},Y.ParagraphBuilder.prototype.addPlaceholder=function(t,e,n,i,r){n=n||Y.PlaceholderAlignment.Baseline,i=i||Y.TextBaseline.Alphabetic,this._addPlaceholder(t||0,e||0,n,i,r||0)}})),t.Vd=t.Vd||[],t.Vd.push((function(){t.Path.prototype.op=function(t,e){return this._op(t,e)?this:null},t.Path.prototype.simplify=function(){return this._simplify()?this:null}})),t.Vd=t.Vd||[],t.Vd.push((function(){t.Canvas.prototype.drawText=function(e,n,i,r,a){var o=O(e),s=t._malloc(o+1);k(e,D,s,o+1),this._drawSimpleText(s,o,n,i,a,r),t._free(s)},t.Font.prototype.getGlyphBounds=function(e,n,i){var r=u(e,"HEAPU16"),a=t._malloc(16*e.length);return this._getGlyphWidthBounds(r,e.length,$,a,n||null),n=new Float32Array(t.HEAPU8.buffer,a,4*e.length),c(r,e),i?(i.set(n),t._free(a),i):(e=Float32Array.from(n),t._free(a),e)},t.Font.prototype.getGlyphIDs=function(e,n,i){n||(n=e.length);var r=O(e)+1,a=t._malloc(r);return k(e,D,a,r),e=t._malloc(2*n),n=this._getGlyphIDs(a,r-1,n,e),t._free(a),0>n?(t._free(e),null):(a=new Uint16Array(t.HEAPU8.buffer,e,n),i?(i.set(a),t._free(e),i):(i=Uint16Array.from(a),t._free(e),i))},t.Font.prototype.getGlyphIntercepts=function(t,e,n,i){var r=u(t,"HEAPU16"),a=u(e,"HEAPF32");return this._getGlyphIntercepts(r,t.length,!(t&&t._ck),a,e.length,!(e&&e._ck),n,i)},t.Font.prototype.getGlyphWidths=function(e,n,i){var r=u(e,"HEAPU16"),a=t._malloc(4*e.length);return this._getGlyphWidthBounds(r,e.length,a,$,n||null),n=new Float32Array(t.HEAPU8.buffer,a,e.length),c(r,e),i?(i.set(n),t._free(a),i):(e=Float32Array.from(n),t._free(a),e)},t.FontMgr.FromData=function(){if(!arguments.length)return null;var e=arguments;if(1===e.length&&Array.isArray(e[0])&&(e=arguments[0]),!e.length)return null;for(var n=[],i=[],r=0;r<e.length;r++){var a=new Uint8Array(e[r]),o=u(a,"HEAPU8");n.push(o),i.push(a.byteLength)}return n=u(n,"HEAPU32"),i=u(i,"HEAPU32"),e=t.FontMgr._fromData(n,i,e.length),t._free(n),t._free(i),e},t.Typeface.MakeFreeTypeFaceFromData=function(e){var n=u(e=new Uint8Array(e),"HEAPU8");return(e=t.Typeface._MakeFreeTypeFaceFromData(n,e.byteLength))?e:null},t.Typeface.prototype.getGlyphIDs=function(e,n,i){n||(n=e.length);var r=O(e)+1,a=t._malloc(r);return k(e,D,a,r),e=t._malloc(2*n),n=this._getGlyphIDs(a,r-1,n,e),t._free(a),0>n?(t._free(e),null):(a=new Uint16Array(t.HEAPU8.buffer,e,n),i?(i.set(a),t._free(e),i):(i=Uint16Array.from(a),t._free(e),i))},t.TextBlob.MakeOnPath=function(e,n,i,r){if(e&&e.length&&n&&n.countPoints()){if(1===n.countPoints())return this.MakeFromText(e,i);r||(r=0);var a=i.getGlyphIDs(e);a=i.getGlyphWidths(a);for(var o=[],s=(n=new t.ContourMeasureIter(n,!1,1)).next(),l=new Float32Array(4),c=0;c<e.length&&s;c++){var u=a[c];if((r+=u/2)>s.length()){if(s.delete(),!(s=n.next())){e=e.substring(0,c);break}r=u/2}s.getPosTan(r,l);var h=l[2],d=l[3];o.push(h,d,l[0]-u/2*h,l[1]-u/2*d),r+=u/2}return e=this.MakeFromRSXform(e,o,i),s&&s.delete(),n.delete(),e}},t.TextBlob.MakeFromRSXform=function(e,n,i){var r=O(e)+1,a=t._malloc(r);return k(e,D,a,r),e=u(n,"HEAPF32"),i=t.TextBlob._MakeFromRSXform(a,r-1,e,i),t._free(a),i||null},t.TextBlob.MakeFromRSXformGlyphs=function(e,n,i){var r=u(e,"HEAPU16");return n=u(n,"HEAPF32"),i=t.TextBlob._MakeFromRSXformGlyphs(r,2*e.length,n,i),c(r,e),i||null},t.TextBlob.MakeFromGlyphs=function(e,n){var i=u(e,"HEAPU16");return n=t.TextBlob._MakeFromGlyphs(i,2*e.length,n),c(i,e),n||null},t.TextBlob.MakeFromText=function(e,n){var i=O(e)+1,r=t._malloc(i);return k(e,D,r,i),e=t.TextBlob._MakeFromText(r,i-1,n),t._free(r),e||null},t.MallocGlyphIDs=function(e){return t.Malloc(Uint16Array,e)}})),t.Vd=t.Vd||[],t.Vd.push((function(){t.MakePicture=function(e){e=new Uint8Array(e);var n=t._malloc(e.byteLength);return t.HEAPU8.set(e,n),(e=t._MakePicture(n,e.byteLength))?e:null}})),function(){function e(t){for(var e=0;e<t.length;e++)if(void 0!==t[e]&&!Number.isFinite(t[e]))return!1;return!0}function n(e){var n=t.getColorComponents(e);e=n[0];var i=n[1],r=n[2];return 1===(n=n[3])?(e=e.toString(16).toLowerCase(),i=i.toString(16).toLowerCase(),r=r.toString(16).toLowerCase(),"#"+(e=1===e.length?"0"+e:e)+(i=1===i.length?"0"+i:i)+(r=1===r.length?"0"+r:r)):"rgba("+e+", "+i+", "+r+", "+(n=0===n||1===n?n:n.toFixed(8))+")"}function i(e){return t.parseColorString(e,w)}function a(t){if(!(t=b.exec(t)))return null;var e=parseFloat(t[4]),n=16;switch(t[5]){case"em":case"rem":case"pc":n=16*e;break;case"pt":n=4*e/3;break;case"px":n=e;break;case"in":n=96*e;break;case"cm":n=96*e/2.54;break;case"mm":n=96/25.4*e;break;case"q":n=96/25.4/4*e;break;case"%":n=16/75*e}return{style:t[1],variant:t[2],weight:t[3],sizePx:n,family:t[6].trim()}}function o(o){this.Nd=o,this.Rd=new t.Paint,this.Rd.setAntiAlias(!0),this.Rd.setStrokeMiter(10),this.Rd.setStrokeCap(t.StrokeCap.Butt),this.Rd.setStrokeJoin(t.StrokeJoin.Miter),this.Re="10px monospace",this.ne=new t.Font(null,10),this.ne.setSubpixel(!0),this.ce=this.he=t.BLACK,this.ue=0,this.Ie=t.TRANSPARENT,this.we=this.ve=0,this.Je=this.ke=1,this.He=0,this.te=[],this.Pd=t.BlendMode.SrcOver,this.Rd.setStrokeWidth(this.Je),this.Rd.setBlendMode(this.Pd),this.Td=new t.Path,this.Ud=t.Matrix.identity(),this.lf=[],this.Ae=[],this.me=function(){this.Td.delete(),this.Rd.delete(),this.ne.delete(),this.Ae.forEach((function(t){t.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(t){t.a&&this.setTransform(t.a,t.b,t.c,t.d,t.e,t.f)}}),Object.defineProperty(this,"fillStyle",{enumerable:!0,get:function(){return r(this.ce)?n(this.ce):this.ce},set:function(t){"string"==typeof t?this.ce=i(t):t.se&&(this.ce=t)}}),Object.defineProperty(this,"font",{enumerable:!0,get:function(){return this.Re},set:function(t){var e=a(t),n=e.family;e.typeface=S[n]?S[n][(e.style||"normal")+"|"+(e.variant||"normal")+"|"+(e.weight||"normal")]||S[n]["*"]:null,e&&(this.ne.setSize(e.sizePx),this.ne.setTypeface(e.typeface),this.Re=t)}}),Object.defineProperty(this,"globalAlpha",{enumerable:!0,get:function(){return this.ke},set:function(t){!isFinite(t)||0>t||1<t||(this.ke=t)}}),Object.defineProperty(this,"globalCompositeOperation",{enumerable:!0,get:function(){switch(this.Pd){case t.BlendMode.SrcOver:return"source-over";case t.BlendMode.DstOver:return"destination-over";case t.BlendMode.Src:return"copy";case t.BlendMode.Dst:return"destination";case t.BlendMode.Clear:return"clear";case t.BlendMode.SrcIn:return"source-in";case t.BlendMode.DstIn:return"destination-in";case t.BlendMode.SrcOut:return"source-out";case t.BlendMode.DstOut:return"destination-out";case t.BlendMode.SrcATop:return"source-atop";case t.BlendMode.DstATop:return"destination-atop";case t.BlendMode.Xor:return"xor";case t.BlendMode.Plus:return"lighter";case t.BlendMode.Multiply:return"multiply";case t.BlendMode.Screen:return"screen";case t.BlendMode.Overlay:return"overlay";case t.BlendMode.Darken:return"darken";case t.BlendMode.Lighten:return"lighten";case t.BlendMode.ColorDodge:return"color-dodge";case t.BlendMode.ColorBurn:return"color-burn";case t.BlendMode.HardLight:return"hard-light";case t.BlendMode.SoftLight:return"soft-light";case t.BlendMode.Difference:return"difference";case t.BlendMode.Exclusion:return"exclusion";case t.BlendMode.Hue:return"hue";case t.BlendMode.Saturation:return"saturation";case t.BlendMode.Color:return"color";case t.BlendMode.Luminosity:return"luminosity"}},set:function(e){switch(e){case"source-over":this.Pd=t.BlendMode.SrcOver;break;case"destination-over":this.Pd=t.BlendMode.DstOver;break;case"copy":this.Pd=t.BlendMode.Src;break;case"destination":this.Pd=t.BlendMode.Dst;break;case"clear":this.Pd=t.BlendMode.Clear;break;case"source-in":this.Pd=t.BlendMode.SrcIn;break;case"destination-in":this.Pd=t.BlendMode.DstIn;break;case"source-out":this.Pd=t.BlendMode.SrcOut;break;case"destination-out":this.Pd=t.BlendMode.DstOut;break;case"source-atop":this.Pd=t.BlendMode.SrcATop;break;case"destination-atop":this.Pd=t.BlendMode.DstATop;break;case"xor":this.Pd=t.BlendMode.Xor;break;case"lighter":case"plus-lighter":this.Pd=t.BlendMode.Plus;break;case"plus-darker":throw"plus-darker is not supported";case"multiply":this.Pd=t.BlendMode.Multiply;break;case"screen":this.Pd=t.BlendMode.Screen;break;case"overlay":this.Pd=t.BlendMode.Overlay;break;case"darken":this.Pd=t.BlendMode.Darken;break;case"lighten":this.Pd=t.BlendMode.Lighten;break;case"color-dodge":this.Pd=t.BlendMode.ColorDodge;break;case"color-burn":this.Pd=t.BlendMode.ColorBurn;break;case"hard-light":this.Pd=t.BlendMode.HardLight;break;case"soft-light":this.Pd=t.BlendMode.SoftLight;break;case"difference":this.Pd=t.BlendMode.Difference;break;case"exclusion":this.Pd=t.BlendMode.Exclusion;break;case"hue":this.Pd=t.BlendMode.Hue;break;case"saturation":this.Pd=t.BlendMode.Saturation;break;case"color":this.Pd=t.BlendMode.Color;break;case"luminosity":this.Pd=t.BlendMode.Luminosity;break;default:return}this.Rd.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.Rd.getStrokeCap()){case t.StrokeCap.Butt:return"butt";case t.StrokeCap.Round:return"round";case t.StrokeCap.Square:return"square"}},set:function(e){switch(e){case"butt":this.Rd.setStrokeCap(t.StrokeCap.Butt);break;case"round":this.Rd.setStrokeCap(t.StrokeCap.Round);break;case"square":this.Rd.setStrokeCap(t.StrokeCap.Square)}}}),Object.defineProperty(this,"lineDashOffset",{enumerable:!0,get:function(){return this.He},set:function(t){isFinite(t)&&(this.He=t)}}),Object.defineProperty(this,"lineJoin",{enumerable:!0,get:function(){switch(this.Rd.getStrokeJoin()){case t.StrokeJoin.Miter:return"miter";case t.StrokeJoin.Round:return"round";case t.StrokeJoin.Bevel:return"bevel"}},set:function(e){switch(e){case"miter":this.Rd.setStrokeJoin(t.StrokeJoin.Miter);break;case"round":this.Rd.setStrokeJoin(t.StrokeJoin.Round);break;case"bevel":this.Rd.setStrokeJoin(t.StrokeJoin.Bevel)}}}),Object.defineProperty(this,"lineWidth",{enumerable:!0,get:function(){return this.Rd.getStrokeWidth()},set:function(t){0>=t||!t||(this.Je=t,this.Rd.setStrokeWidth(t))}}),Object.defineProperty(this,"miterLimit",{enumerable:!0,get:function(){return this.Rd.getStrokeMiter()},set:function(t){0>=t||!t||this.Rd.setStrokeMiter(t)}}),Object.defineProperty(this,"shadowBlur",{enumerable:!0,get:function(){return this.ue},set:function(t){0>t||!isFinite(t)||(this.ue=t)}}),Object.defineProperty(this,"shadowColor",{enumerable:!0,get:function(){return n(this.Ie)},set:function(t){this.Ie=i(t)}}),Object.defineProperty(this,"shadowOffsetX",{enumerable:!0,get:function(){return this.ve},set:function(t){isFinite(t)&&(this.ve=t)}}),Object.defineProperty(this,"shadowOffsetY",{enumerable:!0,get:function(){return this.we},set:function(t){isFinite(t)&&(this.we=t)}}),Object.defineProperty(this,"strokeStyle",{enumerable:!0,get:function(){return n(this.he)},set:function(t){"string"==typeof t?this.he=i(t):t.se&&(this.he=t)}}),this.arc=function(t,e,n,i,r,a){p(this.Td,t,e,n,n,0,i,r,a)},this.arcTo=function(t,e,n,i,r){h(this.Td,t,e,n,i,r)},this.beginPath=function(){this.Td.delete(),this.Td=new t.Path},this.bezierCurveTo=function(t,n,i,r,a,o){var s=this.Td;e([t,n,i,r,a,o])&&(s.isEmpty()&&s.moveTo(t,n),s.cubicTo(t,n,i,r,a,o))},this.clearRect=function(e,n,i,r){this.Rd.setStyle(t.PaintStyle.Fill),this.Rd.setBlendMode(t.BlendMode.Clear),this.Nd.drawRect(t.XYWHRect(e,n,i,r),this.Rd),this.Rd.setBlendMode(this.Pd)},this.clip=function(e,n){"string"==typeof e?(n=e,e=this.Td):e&&e.af&&(e=e.Wd),e||(e=this.Td),e=e.copy(),n&&"evenodd"===n.toLowerCase()?e.setFillType(t.FillType.EvenOdd):e.setFillType(t.FillType.Winding),this.Nd.clipPath(e,t.ClipOp.Intersect,!0),e.delete()},this.closePath=function(){d(this.Td)},this.createImageData=function(){if(1===arguments.length){var t=arguments[0];return new c(new Uint8ClampedArray(4*t.width*t.height),t.width,t.height)}if(2===arguments.length){t=arguments[0];var e=arguments[1];return new c(new Uint8ClampedArray(4*t*e),t,e)}throw"createImageData expects 1 or 2 arguments, got "+arguments.length},this.createLinearGradient=function(t,n,i,r){if(e(arguments)){var a=new u(t,n,i,r);return this.Ae.push(a),a}},this.createPattern=function(t,e){return t=new y(t,e),this.Ae.push(t),t},this.createRadialGradient=function(t,n,i,r,a,o){if(e(arguments)){var s=new v(t,n,i,r,a,o);return this.Ae.push(s),s}},this.drawImage=function(e){e instanceof l&&(e=e.tf());var n=this.Qe();if(3===arguments.length||5===arguments.length)var i=t.XYWHRect(arguments[1],arguments[2],arguments[3]||e.width(),arguments[4]||e.height()),r=t.XYWHRect(0,0,e.width(),e.height());else{if(9!==arguments.length)throw"invalid number of args for drawImage, need 3, 5, or 9; got "+arguments.length;i=t.XYWHRect(arguments[5],arguments[6],arguments[7],arguments[8]),r=t.XYWHRect(arguments[1],arguments[2],arguments[3],arguments[4])}this.Nd.drawImageRect(e,r,i,n,!1),n.dispose()},this.ellipse=function(t,e,n,i,r,a,o,s){p(this.Td,t,e,n,i,r,a,o,s)},this.Qe=function(){var e=this.Rd.copy();if(e.setStyle(t.PaintStyle.Fill),r(this.ce)){var n=t.multiplyByAlpha(this.ce,this.ke);e.setColor(n)}else n=this.ce.se(this.Ud),e.setColor(t.Color(0,0,0,this.ke)),e.setShader(n);return e.dispose=function(){this.delete()},e},this.fill=function(e,n){if("string"==typeof e?(n=e,e=this.Td):e&&e.af&&(e=e.Wd),"evenodd"===n)this.Td.setFillType(t.FillType.EvenOdd);else{if("nonzero"!==n&&n)throw"invalid fill rule";this.Td.setFillType(t.FillType.Winding)}e||(e=this.Td),n=this.Qe();var i=this.xe(n);i&&(this.Nd.save(),this.qe(),this.Nd.drawPath(e,i),this.Nd.restore(),i.dispose()),this.Nd.drawPath(e,n),n.dispose()},this.fillRect=function(e,n,i,r){var a=this.Qe(),o=this.xe(a);o&&(this.Nd.save(),this.qe(),this.Nd.drawRect(t.XYWHRect(e,n,i,r),o),this.Nd.restore(),o.dispose()),this.Nd.drawRect(t.XYWHRect(e,n,i,r),a),a.dispose()},this.fillText=function(e,n,i){var r=this.Qe();e=t.TextBlob.MakeFromText(e,this.ne);var a=this.xe(r);a&&(this.Nd.save(),this.qe(),this.Nd.drawTextBlob(e,n,i,a),this.Nd.restore(),a.dispose()),this.Nd.drawTextBlob(e,n,i,r),e.delete(),r.dispose()},this.getImageData=function(e,n,i,r){return(e=this.Nd.readPixels(e,n,{width:i,height:r,colorType:t.ColorType.RGBA_8888,alphaType:t.AlphaType.Unpremul,colorSpace:t.ColorSpace.SRGB}))?new c(new Uint8ClampedArray(e.buffer),i,r):null},this.getLineDash=function(){return this.te.slice()},this.mf=function(e){var n=t.Matrix.invert(this.Ud);return t.Matrix.mapPoints(n,e),e},this.isPointInPath=function(e,n,i){var r=arguments;if(3===r.length)var a=this.Td;else{if(4!==r.length)throw"invalid arg count, need 3 or 4, got "+r.length;a=r[0],e=r[1],n=r[2],i=r[3]}return!(!isFinite(e)||!isFinite(n))&&("nonzero"===(i=i||"nonzero")||"evenodd"===i)&&(e=(r=this.mf([e,n]))[0],n=r[1],a.setFillType("nonzero"===i?t.FillType.Winding:t.FillType.EvenOdd),a.contains(e,n))},this.isPointInStroke=function(e,n){var i=arguments;if(2===i.length)var r=this.Td;else{if(3!==i.length)throw"invalid arg count, need 2 or 3, got "+i.length;r=i[0],e=i[1],n=i[2]}return!(!isFinite(e)||!isFinite(n))&&(e=(i=this.mf([e,n]))[0],n=i[1],(r=r.copy()).setFillType(t.FillType.Winding),r.stroke({width:this.lineWidth,miter_limit:this.miterLimit,cap:this.Rd.getStrokeCap(),join:this.Rd.getStrokeJoin(),precision:.3}),i=r.contains(e,n),r.delete(),i)},this.lineTo=function(t,e){g(this.Td,t,e)},this.measureText=function(t){t=this.ne.getGlyphIDs(t),t=this.ne.getGlyphWidths(t);let e=0;for(const n of t)e+=n;return{width:e}},this.moveTo=function(t,n){var i=this.Td;e([t,n])&&i.moveTo(t,n)},this.putImageData=function(n,i,r,a,o,s,l){if(e([i,r,a,o,s,l]))if(void 0===a)this.Nd.writePixels(n.data,n.width,n.height,i,r);else if(a=a||0,o=o||0,s=s||n.width,l=l||n.height,0>s&&(a+=s,s=Math.abs(s)),0>l&&(o+=l,l=Math.abs(l)),0>a&&(s+=a,a=0),0>o&&(l+=o,o=0),!(0>=s||0>=l)){n=t.MakeImage({width:n.width,height:n.height,alphaType:t.AlphaType.Unpremul,colorType:t.ColorType.RGBA_8888,colorSpace:t.ColorSpace.SRGB},n.data,4*n.width);var c=t.XYWHRect(a,o,s,l);i=t.XYWHRect(i+a,r+o,s,l),r=t.Matrix.invert(this.Ud),this.Nd.save(),this.Nd.concat(r),this.Nd.drawImageRect(n,c,i,null,!1),this.Nd.restore(),n.delete()}},this.quadraticCurveTo=function(t,n,i,r){var a=this.Td;e([t,n,i,r])&&(a.isEmpty()&&a.moveTo(t,n),a.quadTo(t,n,i,r))},this.rect=function(n,i,r,a){var o=this.Td;e(n=t.XYWHRect(n,i,r,a))&&o.addRect(n)},this.resetTransform=function(){this.Td.transform(this.Ud);var e=t.Matrix.invert(this.Ud);this.Nd.concat(e),this.Ud=this.Nd.getTotalMatrix()},this.restore=function(){var e=this.lf.pop();if(e){var n=t.Matrix.multiply(this.Ud,t.Matrix.invert(e.Ff));this.Td.transform(n),this.Rd.delete(),this.Rd=e.dg,this.te=e.$f,this.Je=e.vg,this.he=e.ug,this.ce=e.fs,this.ve=e.sg,this.we=e.tg,this.ue=e.hg,this.Ie=e.rg,this.ke=e.Nf,this.Pd=e.Of,this.He=e.ag,this.Re=e.Mf,this.Nd.restore(),this.Ud=this.Nd.getTotalMatrix()}},this.rotate=function(e){if(isFinite(e)){var n=t.Matrix.rotated(-e);this.Td.transform(n),this.Nd.rotate(e/Math.PI*180,0,0),this.Ud=this.Nd.getTotalMatrix()}},this.save=function(){if(this.ce.re){var t=this.ce.re();this.Ae.push(t)}else t=this.ce;if(this.he.re){var e=this.he.re();this.Ae.push(e)}else e=this.he;this.lf.push({Ff:this.Ud.slice(),$f:this.te.slice(),vg:this.Je,ug:e,fs:t,sg:this.ve,tg:this.we,hg:this.ue,rg:this.Ie,Nf:this.ke,ag:this.He,Of:this.Pd,dg:this.Rd.copy(),Mf:this.Re}),this.Nd.save()},this.scale=function(n,i){if(e(arguments)){var r=t.Matrix.scaled(1/n,1/i);this.Td.transform(r),this.Nd.scale(n,i),this.Ud=this.Nd.getTotalMatrix()}},this.setLineDash=function(t){for(var e=0;e<t.length;e++)if(!isFinite(t[e])||0>t[e])return;1==t.length%2&&Array.prototype.push.apply(t,t),this.te=t},this.setTransform=function(t,n,i,r,a,o){e(arguments)&&(this.resetTransform(),this.transform(t,n,i,r,a,o))},this.qe=function(){var e=t.Matrix.invert(this.Ud);this.Nd.concat(e),this.Nd.concat(t.Matrix.translated(this.ve,this.we)),this.Nd.concat(this.Ud)},this.xe=function(e){var n=t.multiplyByAlpha(this.Ie,this.ke);if(!t.getColorComponents(n)[3]||!(this.ue||this.we||this.ve))return null;(e=e.copy()).setColor(n);var i=t.MaskFilter.MakeBlur(t.BlurStyle.Normal,this.ue/2,!1);return e.setMaskFilter(i),e.dispose=function(){i.delete(),this.delete()},e},this.cf=function(){var e=this.Rd.copy();if(e.setStyle(t.PaintStyle.Stroke),r(this.he)){var n=t.multiplyByAlpha(this.he,this.ke);e.setColor(n)}else n=this.he.se(this.Ud),e.setColor(t.Color(0,0,0,this.ke)),e.setShader(n);if(e.setStrokeWidth(this.Je),this.te.length){var i=t.PathEffect.MakeDash(this.te,this.He);e.setPathEffect(i)}return e.dispose=function(){i&&i.delete(),this.delete()},e},this.stroke=function(t){t=t?t.Wd:this.Td;var e=this.cf(),n=this.xe(e);n&&(this.Nd.save(),this.qe(),this.Nd.drawPath(t,n),this.Nd.restore(),n.dispose()),this.Nd.drawPath(t,e),e.dispose()},this.strokeRect=function(e,n,i,r){var a=this.cf(),o=this.xe(a);o&&(this.Nd.save(),this.qe(),this.Nd.drawRect(t.XYWHRect(e,n,i,r),o),this.Nd.restore(),o.dispose()),this.Nd.drawRect(t.XYWHRect(e,n,i,r),a),a.dispose()},this.strokeText=function(e,n,i){var r=this.cf();e=t.TextBlob.MakeFromText(e,this.ne);var a=this.xe(r);a&&(this.Nd.save(),this.qe(),this.Nd.drawTextBlob(e,n,i,a),this.Nd.restore(),a.dispose()),this.Nd.drawTextBlob(e,n,i,r),e.delete(),r.dispose()},this.translate=function(n,i){if(e(arguments)){var r=t.Matrix.translated(-n,-i);this.Td.transform(r),this.Nd.translate(n,i),this.Ud=this.Nd.getTotalMatrix()}},this.transform=function(e,n,i,r,a,o){e=[e,i,a,n,r,o,0,0,1],n=t.Matrix.invert(e),this.Td.transform(n),this.Nd.concat(e),this.Ud=this.Nd.getTotalMatrix()},this.addHitRegion=function(){},this.clearHitRegions=function(){},this.drawFocusIfNeeded=function(){},this.removeHitRegion=function(){},this.scrollPathIntoView=function(){},Object.defineProperty(this,"canvas",{value:null,writable:!1})}function s(e){this.df=e,this.Md=new o(e.getCanvas()),this.Se=[],this.decodeImage=function(e){if(!(e=t.MakeImageFromEncoded(e)))throw"Invalid input";return this.Se.push(e),new l(e)},this.loadFont=function(e,n){if(!(e=t.Typeface.MakeFreeTypeFaceFromData(e)))return null;this.Se.push(e);var i=(n.style||"normal")+"|"+(n.variant||"normal")+"|"+(n.weight||"normal");n=n.family,S[n]||(S[n]={"*":e}),S[n][i]=e},this.makePath2D=function(t){return t=new m(t),this.Se.push(t.Wd),t},this.getContext=function(t){return"2d"===t?this.Md:null},this.toDataURL=function(e,n){this.df.flush();var i=this.df.makeImageSnapshot();if(i){e=e||"image/png";var r=t.ImageFormat.PNG;if("image/jpeg"===e&&(r=t.ImageFormat.JPEG),n=i.encodeToBytes(r,n||.92)){if(i.delete(),e="data:"+e+";base64,","undefined"!=typeof Buffer)n=Buffer.from(n).toString("base64");else{i=0,r=n.length;for(var a,o="";i<r;)a=n.slice(i,Math.min(i+32768,r)),o+=String.fromCharCode.apply(null,a),i+=32768;n=btoa(o)}return e+n}}},this.dispose=function(){this.Md.me(),this.Se.forEach((function(t){t.delete()})),this.df.dispose()}}function l(t){this.width=t.width(),this.height=t.height(),this.naturalWidth=this.width,this.naturalHeight=this.height,this.tf=function(){return t}}function c(t,e,n){if(!e||0===n)throw"invalid dimensions, width and height must be non-zero";if(t.length%4)throw"arr must be a multiple of 4";n=n||t.length/(4*e),Object.defineProperty(this,"data",{value:t,writable:!1}),Object.defineProperty(this,"height",{value:n,writable:!1}),Object.defineProperty(this,"width",{value:e,writable:!1})}function u(e,n,r,a){this.Yd=null,this.ee=[],this.ae=[],this.addColorStop=function(t,e){if(0>t||1<t||!isFinite(t))throw"offset must be between 0 and 1 inclusively";e=i(e);var n=this.ae.indexOf(t);if(-1!==n)this.ee[n]=e;else{for(n=0;n<this.ae.length&&!(this.ae[n]>t);n++);this.ae.splice(n,0,t),this.ee.splice(n,0,e)}},this.re=function(){var t=new u(e,n,r,a);return t.ee=this.ee.slice(),t.ae=this.ae.slice(),t},this.me=function(){this.Yd&&(this.Yd.delete(),this.Yd=null)},this.se=function(i){var o=[e,n,r,a];t.Matrix.mapPoints(i,o),i=o[0];var s=o[1],l=o[2];return o=o[3],this.me(),this.Yd=t.Shader.MakeLinearGradient([i,s],[l,o],this.ee,this.ae,t.TileMode.Clamp)}}function h(t,n,i,r,a,o){if(e([n,i,r,a,o])){if(0>o)throw"radii cannot be negative";t.isEmpty()&&t.moveTo(n,i),t.arcToTangent(n,i,r,a,o)}}function d(t){if(!t.isEmpty()){var e=t.getBounds();(e[3]-e[1]||e[2]-e[0])&&t.close()}}function f(e,n,i,r,a,o,s){s=(s-o)/Math.PI*180,o=o/Math.PI*180,n=t.LTRBRect(n-r,i-a,n+r,i+a),1e-5>Math.abs(Math.abs(s)-360)?(i=s/2,e.arcToOval(n,o,i,!1),e.arcToOval(n,o+i,i,!1)):e.arcToOval(n,o,s,!1)}function p(n,i,r,a,o,s,l,c,u){if(e([i,r,a,o,s,l,c])){if(0>a||0>o)throw"radii cannot be negative";var h=2*Math.PI,d=l%h;0>d&&(d+=h);var p=d-l;l=d,c+=p,!u&&c-l>=h?c=l+h:u&&l-c>=h?c=l-h:!u&&l>c?c=l+(h-(l-c)%h):u&&l<c&&(c=l-(h-(c-l)%h)),s?(u=t.Matrix.rotated(s,i,r),s=t.Matrix.rotated(-s,i,r),n.transform(s),f(n,i,r,a,o,l,c),n.transform(u)):f(n,i,r,a,o,l,c)}}function g(t,n,i){e([n,i])&&(t.isEmpty()&&t.moveTo(n,i),t.lineTo(n,i))}function m(n){this.Wd=null,this.Wd="string"==typeof n?t.Path.MakeFromSVGString(n):n&&n.af?n.Wd.copy():new t.Path,this.af=function(){return this.Wd},this.addPath=function(t,e){e||(e={a:1,c:0,e:0,b:0,d:1,f:0}),this.Wd.addPath(t.Wd,[e.a,e.c,e.e,e.b,e.d,e.f])},this.arc=function(t,e,n,i,r,a){p(this.Wd,t,e,n,n,0,i,r,a)},this.arcTo=function(t,e,n,i,r){h(this.Wd,t,e,n,i,r)},this.bezierCurveTo=function(t,n,i,r,a,o){var s=this.Wd;e([t,n,i,r,a,o])&&(s.isEmpty()&&s.moveTo(t,n),s.cubicTo(t,n,i,r,a,o))},this.closePath=function(){d(this.Wd)},this.ellipse=function(t,e,n,i,r,a,o,s){p(this.Wd,t,e,n,i,r,a,o,s)},this.lineTo=function(t,e){g(this.Wd,t,e)},this.moveTo=function(t,n){var i=this.Wd;e([t,n])&&i.moveTo(t,n)},this.quadraticCurveTo=function(t,n,i,r){var a=this.Wd;e([t,n,i,r])&&(a.isEmpty()&&a.moveTo(t,n),a.quadTo(t,n,i,r))},this.rect=function(n,i,r,a){var o=this.Wd;e(n=t.XYWHRect(n,i,r,a))&&o.addRect(n)}}function y(n,i){switch(this.Yd=null,n instanceof l&&(n=n.tf()),this.Af=n,this._transform=t.Matrix.identity(),""===i&&(i="repeat"),i){case"repeat-x":this.ye=t.TileMode.Repeat,this.ze=t.TileMode.Decal;break;case"repeat-y":this.ye=t.TileMode.Decal,this.ze=t.TileMode.Repeat;break;case"repeat":this.ze=this.ye=t.TileMode.Repeat;break;case"no-repeat":this.ze=this.ye=t.TileMode.Decal;break;default:throw"invalid repetition mode "+i}this.setTransform=function(t){e(t=[t.a,t.c,t.e,t.b,t.d,t.f,0,0,1])&&(this._transform=t)},this.re=function(){var t=new y;return t.ye=this.ye,t.ze=this.ze,t},this.me=function(){this.Yd&&(this.Yd.delete(),this.Yd=null)},this.se=function(){return this.me(),this.Yd=this.Af.makeShaderCubic(this.ye,this.ze,1/3,1/3,this._transform)}}function v(e,n,r,a,o,s){this.Yd=null,this.ee=[],this.ae=[],this.addColorStop=function(t,e){if(0>t||1<t||!isFinite(t))throw"offset must be between 0 and 1 inclusively";e=i(e);var n=this.ae.indexOf(t);if(-1!==n)this.ee[n]=e;else{for(n=0;n<this.ae.length&&!(this.ae[n]>t);n++);this.ae.splice(n,0,t),this.ee.splice(n,0,e)}},this.re=function(){var t=new v(e,n,r,a,o,s);return t.ee=this.ee.slice(),t.ae=this.ae.slice(),t},this.me=function(){this.Yd&&(this.Yd.delete(),this.Yd=null)},this.se=function(i){var l=[e,n,a,o];t.Matrix.mapPoints(i,l);var c=l[0],u=l[1],h=l[2];l=l[3];var d=(Math.abs(i[0])+Math.abs(i[4]))/2;return i=r*d,d*=s,this.me(),this.Yd=t.Shader.MakeTwoPointConicalGradient([c,u],i,[h,l],d,this.ee,this.ae,t.TileMode.Clamp)}}t._testing={};var w={aliceblue:Float32Array.of(.941,.973,1,1),antiquewhite:Float32Array.of(.98,.922,.843,1),aqua:Float32Array.of(0,1,1,1),aquamarine:Float32Array.of(.498,1,.831,1),azure:Float32Array.of(.941,1,1,1),beige:Float32Array.of(.961,.961,.863,1),bisque:Float32Array.of(1,.894,.769,1),black:Float32Array.of(0,0,0,1),blanchedalmond:Float32Array.of(1,.922,.804,1),blue:Float32Array.of(0,0,1,1),blueviolet:Float32Array.of(.541,.169,.886,1),brown:Float32Array.of(.647,.165,.165,1),burlywood:Float32Array.of(.871,.722,.529,1),cadetblue:Float32Array.of(.373,.62,.627,1),chartreuse:Float32Array.of(.498,1,0,1),chocolate:Float32Array.of(.824,.412,.118,1),coral:Float32Array.of(1,.498,.314,1),cornflowerblue:Float32Array.of(.392,.584,.929,1),cornsilk:Float32Array.of(1,.973,.863,1),crimson:Float32Array.of(.863,.078,.235,1),cyan:Float32Array.of(0,1,1,1),darkblue:Float32Array.of(0,0,.545,1),darkcyan:Float32Array.of(0,.545,.545,1),darkgoldenrod:Float32Array.of(.722,.525,.043,1),darkgray:Float32Array.of(.663,.663,.663,1),darkgreen:Float32Array.of(0,.392,0,1),darkgrey:Float32Array.of(.663,.663,.663,1),darkkhaki:Float32Array.of(.741,.718,.42,1),darkmagenta:Float32Array.of(.545,0,.545,1),darkolivegreen:Float32Array.of(.333,.42,.184,1),darkorange:Float32Array.of(1,.549,0,1),darkorchid:Float32Array.of(.6,.196,.8,1),darkred:Float32Array.of(.545,0,0,1),darksalmon:Float32Array.of(.914,.588,.478,1),darkseagreen:Float32Array.of(.561,.737,.561,1),darkslateblue:Float32Array.of(.282,.239,.545,1),darkslategray:Float32Array.of(.184,.31,.31,1),darkslategrey:Float32Array.of(.184,.31,.31,1),darkturquoise:Float32Array.of(0,.808,.82,1),darkviolet:Float32Array.of(.58,0,.827,1),deeppink:Float32Array.of(1,.078,.576,1),deepskyblue:Float32Array.of(0,.749,1,1),dimgray:Float32Array.of(.412,.412,.412,1),dimgrey:Float32Array.of(.412,.412,.412,1),dodgerblue:Float32Array.of(.118,.565,1,1),firebrick:Float32Array.of(.698,.133,.133,1),floralwhite:Float32Array.of(1,.98,.941,1),forestgreen:Float32Array.of(.133,.545,.133,1),fuchsia:Float32Array.of(1,0,1,1),gainsboro:Float32Array.of(.863,.863,.863,1),ghostwhite:Float32Array.of(.973,.973,1,1),gold:Float32Array.of(1,.843,0,1),goldenrod:Float32Array.of(.855,.647,.125,1),gray:Float32Array.of(.502,.502,.502,1),green:Float32Array.of(0,.502,0,1),greenyellow:Float32Array.of(.678,1,.184,1),grey:Float32Array.of(.502,.502,.502,1),honeydew:Float32Array.of(.941,1,.941,1),hotpink:Float32Array.of(1,.412,.706,1),indianred:Float32Array.of(.804,.361,.361,1),indigo:Float32Array.of(.294,0,.51,1),ivory:Float32Array.of(1,1,.941,1),khaki:Float32Array.of(.941,.902,.549,1),lavender:Float32Array.of(.902,.902,.98,1),lavenderblush:Float32Array.of(1,.941,.961,1),lawngreen:Float32Array.of(.486,.988,0,1),lemonchiffon:Float32Array.of(1,.98,.804,1),lightblue:Float32Array.of(.678,.847,.902,1),lightcoral:Float32Array.of(.941,.502,.502,1),lightcyan:Float32Array.of(.878,1,1,1),lightgoldenrodyellow:Float32Array.of(.98,.98,.824,1),lightgray:Float32Array.of(.827,.827,.827,1),lightgreen:Float32Array.of(.565,.933,.565,1),lightgrey:Float32Array.of(.827,.827,.827,1),lightpink:Float32Array.of(1,.714,.757,1),lightsalmon:Float32Array.of(1,.627,.478,1),lightseagreen:Float32Array.of(.125,.698,.667,1),lightskyblue:Float32Array.of(.529,.808,.98,1),lightslategray:Float32Array.of(.467,.533,.6,1),lightslategrey:Float32Array.of(.467,.533,.6,1),lightsteelblue:Float32Array.of(.69,.769,.871,1),lightyellow:Float32Array.of(1,1,.878,1),lime:Float32Array.of(0,1,0,1),limegreen:Float32Array.of(.196,.804,.196,1),linen:Float32Array.of(.98,.941,.902,1),magenta:Float32Array.of(1,0,1,1),maroon:Float32Array.of(.502,0,0,1),mediumaquamarine:Float32Array.of(.4,.804,.667,1),mediumblue:Float32Array.of(0,0,.804,1),mediumorchid:Float32Array.of(.729,.333,.827,1),mediumpurple:Float32Array.of(.576,.439,.859,1),mediumseagreen:Float32Array.of(.235,.702,.443,1),mediumslateblue:Float32Array.of(.482,.408,.933,1),mediumspringgreen:Float32Array.of(0,.98,.604,1),mediumturquoise:Float32Array.of(.282,.82,.8,1),mediumvioletred:Float32Array.of(.78,.082,.522,1),midnightblue:Float32Array.of(.098,.098,.439,1),mintcream:Float32Array.of(.961,1,.98,1),mistyrose:Float32Array.of(1,.894,.882,1),moccasin:Float32Array.of(1,.894,.71,1),navajowhite:Float32Array.of(1,.871,.678,1),navy:Float32Array.of(0,0,.502,1),oldlace:Float32Array.of(.992,.961,.902,1),olive:Float32Array.of(.502,.502,0,1),olivedrab:Float32Array.of(.42,.557,.137,1),orange:Float32Array.of(1,.647,0,1),orangered:Float32Array.of(1,.271,0,1),orchid:Float32Array.of(.855,.439,.839,1),palegoldenrod:Float32Array.of(.933,.91,.667,1),palegreen:Float32Array.of(.596,.984,.596,1),paleturquoise:Float32Array.of(.686,.933,.933,1),palevioletred:Float32Array.of(.859,.439,.576,1),papayawhip:Float32Array.of(1,.937,.835,1),peachpuff:Float32Array.of(1,.855,.725,1),peru:Float32Array.of(.804,.522,.247,1),pink:Float32Array.of(1,.753,.796,1),plum:Float32Array.of(.867,.627,.867,1),powderblue:Float32Array.of(.69,.878,.902,1),purple:Float32Array.of(.502,0,.502,1),rebeccapurple:Float32Array.of(.4,.2,.6,1),red:Float32Array.of(1,0,0,1),rosybrown:Float32Array.of(.737,.561,.561,1),royalblue:Float32Array.of(.255,.412,.882,1),saddlebrown:Float32Array.of(.545,.271,.075,1),salmon:Float32Array.of(.98,.502,.447,1),sandybrown:Float32Array.of(.957,.643,.376,1),seagreen:Float32Array.of(.18,.545,.341,1),seashell:Float32Array.of(1,.961,.933,1),sienna:Float32Array.of(.627,.322,.176,1),silver:Float32Array.of(.753,.753,.753,1),skyblue:Float32Array.of(.529,.808,.922,1),slateblue:Float32Array.of(.416,.353,.804,1),slategray:Float32Array.of(.439,.502,.565,1),slategrey:Float32Array.of(.439,.502,.565,1),snow:Float32Array.of(1,.98,.98,1),springgreen:Float32Array.of(0,1,.498,1),steelblue:Float32Array.of(.275,.51,.706,1),tan:Float32Array.of(.824,.706,.549,1),teal:Float32Array.of(0,.502,.502,1),thistle:Float32Array.of(.847,.749,.847,1),tomato:Float32Array.of(1,.388,.278,1),transparent:Float32Array.of(0,0,0,0),turquoise:Float32Array.of(.251,.878,.816,1),violet:Float32Array.of(.933,.51,.933,1),wheat:Float32Array.of(.961,.871,.702,1),white:Float32Array.of(1,1,1,1),whitesmoke:Float32Array.of(.961,.961,.961,1),yellow:Float32Array.of(1,1,0,1),yellowgreen:Float32Array.of(.604,.804,.196,1)};t._testing.parseColor=i,t._testing.colorToString=n;var b=RegExp("(italic|oblique|normal|)\\s*(small-caps|normal|)\\s*(bold|bolder|lighter|[1-9]00|normal|)\\s*([\\d\\.]+)(px|pt|pc|in|cm|mm|%|em|ex|ch|rem|q)(.+)"),S={"Noto Mono":{"*":null},monospace:{"*":null}};t._testing.parseFontString=a,t.MakeCanvas=function(e,n){return(e=t.MakeSurface(e,n))?new s(e):null},t.ImageData=function(){if(2===arguments.length){var t=arguments[0],e=arguments[1];return new c(new Uint8ClampedArray(4*t*e),t,e)}if(3===arguments.length){var n=arguments[0];if(n.prototype.constructor!==Uint8ClampedArray)throw"bytes must be given as a Uint8ClampedArray";if(n%4)throw"bytes must be given in a multiple of 4";if(n%(t=arguments[1]))throw"bytes must divide evenly by width";if((e=arguments[2])&&e!==n/(4*t))throw"invalid height given";return new c(n,t,n/(4*t))}throw"invalid number of arguments - takes 2 or 3, saw "+arguments.length}}()}(e);var s,l,c,u,h,d,f=o({},e),p="./this.program",g=(t,e)=>{throw e},m="object"==typeof window,y="function"==typeof importScripts,v="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,w="";v?(w=y?R.dirname(w)+"/":__dirname+"/",d=()=>{h||(u=B,h=R)},s=function(t,e){return d(),t=h.normalize(t),u.readFileSync(t,e?null:"utf8")},c=t=>((t=s(t,!0)).buffer||(t=new Uint8Array(t)),t),l=(t,e,n)=>{d(),t=h.normalize(t),u.readFile(t,(function(t,i){t?n(t):e(i.buffer)}))},1<process.argv.length&&(p=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),process.on("uncaughtException",(function(t){if(!(t instanceof Pn))throw t})),process.on("unhandledRejection",(function(t){throw t})),g=(t,e)=>{if(T||0<nt)throw process.exitCode=t,e;e instanceof Pn||S("exiting due to exception: "+e),process.exit(t)},e.inspect=function(){return"[Emscripten Module object]"}):(m||y)&&(y?w=self.location.href:"undefined"!=typeof document&&document.currentScript&&(w=document.currentScript.src),n&&(w=n),w=0!==w.indexOf("blob:")?w.substr(0,w.replace(/[?#].*/,"").lastIndexOf("/")+1):"",s=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.send(null),e.responseText},y&&(c=t=>{var e=new XMLHttpRequest;return e.open("GET",t,!1),e.responseType="arraybuffer",e.send(null),new Uint8Array(e.response)}),l=(t,e,n)=>{var i=new XMLHttpRequest;i.open("GET",t,!0),i.responseType="arraybuffer",i.onload=()=>{200==i.status||0==i.status&&i.response?e(i.response):n()},i.onerror=n,i.send(null)});var b=e.print||console.log.bind(console),S=e.printErr||console.warn.bind(console);o(e,f),f=null,e.thisProgram&&(p=e.thisProgram),e.quit&&(g=e.quit);var A,C=0;e.wasmBinary&&(A=e.wasmBinary);var T=e.noExitRuntime||!0;"object"!=typeof WebAssembly&&st("no native wasm support detected");var _,P=!1,x="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function M(t,e,n){var i=e+n;for(n=e;t[n]&&!(n>=i);)++n;if(16<n-e&&t.subarray&&x)return x.decode(t.subarray(e,n));for(i="";e<n;){var r=t[e++];if(128&r){var a=63&t[e++];if(192==(224&r))i+=String.fromCharCode((31&r)<<6|a);else{var o=63&t[e++];65536>(r=224==(240&r)?(15&r)<<12|a<<6|o:(7&r)<<18|a<<12|o<<6|63&t[e++])?i+=String.fromCharCode(r):(r-=65536,i+=String.fromCharCode(55296|r>>10,56320|1023&r))}}else i+=String.fromCharCode(r)}return i}function F(t,e){return t?M(D,t,e):""}function k(t,e,n,i){if(!(0<i))return 0;var r=n;i=n+i-1;for(var a=0;a<t.length;++a){var o=t.charCodeAt(a);if(55296<=o&&57343>=o&&(o=65536+((1023&o)<<10)|1023&t.charCodeAt(++a)),127>=o){if(n>=i)break;e[n++]=o}else{if(2047>=o){if(n+1>=i)break;e[n++]=192|o>>6}else{if(65535>=o){if(n+2>=i)break;e[n++]=224|o>>12}else{if(n+3>=i)break;e[n++]=240|o>>18,e[n++]=128|o>>12&63}e[n++]=128|o>>6&63}e[n++]=128|63&o}}return e[n]=0,n-r}function O(t){for(var e=0,n=0;n<t.length;++n){var i=t.charCodeAt(n);55296<=i&&57343>=i&&(i=65536+((1023&i)<<10)|1023&t.charCodeAt(++n)),127>=i?++e:e=2047>=i?e+2:65535>=i?e+3:e+4}return e}var I,L,D,G,j,W,U,N,z,H="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function $(t,e){for(var n=t>>1,i=n+e/2;!(n>=i)&&j[n];)++n;if(32<(n<<=1)-t&&H)return H.decode(D.subarray(t,n));for(n="",i=0;!(i>=e/2);++i){var r=G[t+2*i>>1];if(0==r)break;n+=String.fromCharCode(r)}return n}function V(t,e,n){if(void 0===n&&(n=2147483647),2>n)return 0;var i=e;n=(n-=2)<2*t.length?n/2:t.length;for(var r=0;r<n;++r)G[e>>1]=t.charCodeAt(r),e+=2;return G[e>>1]=0,e-i}function Y(t){return 2*t.length}function q(t,e){for(var n=0,i="";!(n>=e/4);){var r=W[t+4*n>>2];if(0==r)break;++n,65536<=r?(r-=65536,i+=String.fromCharCode(55296|r>>10,56320|1023&r)):i+=String.fromCharCode(r)}return i}function X(t,e,n){if(void 0===n&&(n=2147483647),4>n)return 0;var i=e;n=i+n-4;for(var r=0;r<t.length;++r){var a=t.charCodeAt(r);if(55296<=a&&57343>=a&&(a=65536+((1023&a)<<10)|1023&t.charCodeAt(++r)),W[e>>2]=a,(e+=4)+4>n)break}return W[e>>2]=0,e-i}function K(t){for(var e=0,n=0;n<t.length;++n){var i=t.charCodeAt(n);55296<=i&&57343>=i&&++n,e+=4}return e}function Q(){var t=_.buffer;I=t,e.HEAP8=L=new Int8Array(t),e.HEAP16=G=new Int16Array(t),e.HEAP32=W=new Int32Array(t),e.HEAPU8=D=new Uint8Array(t),e.HEAPU16=j=new Uint16Array(t),e.HEAPU32=U=new Uint32Array(t),e.HEAPF32=N=new Float32Array(t),e.HEAPF64=z=new Float64Array(t)}var Z,J=[],tt=[],et=[],nt=0;function it(){var t=e.preRun.shift();J.unshift(t)}var rt,at=0,ot=null;function st(t){throw e.onAbort&&e.onAbort(t),S(t="Aborted("+t+")"),P=!0,t=new WebAssembly.RuntimeError(t+". Build with -s ASSERTIONS=1 for more info."),r(t),t}function lt(){return rt.startsWith("data:application/octet-stream;base64,")}if(e.preloadedImages={},e.preloadedAudios={},rt="canvaskit.wasm",!lt()){var ct=rt;rt=e.locateFile?e.locateFile(ct,w):w+ct}function ut(){var t=rt;try{if(t==rt&&A)return new Uint8Array(A);if(c)return c(t);throw"both async and sync fetching of the wasm failed"}catch(t){st(t)}}function ht(t){for(;0<t.length;){var n=t.shift();if("function"==typeof n)n(e);else{var i=n.Dg;"number"==typeof i?void 0===n.ef?dt(i)():dt(i)(n.ef):i(void 0===n.ef?null:n.ef)}}}function dt(t){return Z.get(t)}function ft(t){this.Qd=t-16,this.mg=function(t){W[this.Qd+4>>2]=t},this.jg=function(t){W[this.Qd+8>>2]=t},this.kg=function(){W[this.Qd>>2]=0},this.ig=function(){L[this.Qd+12>>0]=0},this.lg=function(){L[this.Qd+13>>0]=0},this.Xf=function(t,e){this.mg(t),this.jg(e),this.kg(),this.ig(),this.lg()}}var pt={},gt=[null,[],[]],mt={},yt={};function vt(t){for(;t.length;){var e=t.pop();t.pop()(e)}}function wt(t){return this.fromWireType(U[t>>2])}var bt={},St={},At={};function Ct(t){if(void 0===t)return"_unknown";var e=(t=t.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return 48<=e&&57>=e?"_"+t:t}function Tt(t,e){return t=Ct(t),function(){return e.apply(this,arguments)}}function _t(t){var e=Error,n=Tt(t,(function(e){this.name=t,this.message=e,void 0!==(e=Error(e).stack)&&(this.stack=this.toString()+"\n"+e.replace(/^Error(:[^\n]*)?\n/,""))}));return n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},n}var Pt=void 0;function xt(t){throw new Pt(t)}function Mt(t,e,n){function i(e){(e=n(e)).length!==t.length&&xt("Mismatched type converter count");for(var i=0;i<t.length;++i)Bt(t[i],e[i])}t.forEach((function(t){At[t]=e}));var r=Array(e.length),a=[],o=0;e.forEach((function(t,e){St.hasOwnProperty(t)?r[e]=St[t]:(a.push(t),bt.hasOwnProperty(t)||(bt[t]=[]),bt[t].push((function(){r[e]=St[t],++o===a.length&&i(r)})))})),0===a.length&&i(r)}function Ft(t){switch(t){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+t)}}var Et=void 0;function kt(t){for(var e="";D[t];)e+=Et[D[t++]];return e}var Ot=void 0;function Rt(t){throw new Ot(t)}function Bt(t,e,n={}){if(!("argPackAdvance"in e))throw new TypeError("registerType registeredInstance requires argPackAdvance");var i=e.name;if(t||Rt('type "'+i+'" must have a positive integer typeid pointer'),St.hasOwnProperty(t)){if(n.Wf)return;Rt("Cannot register type '"+i+"' twice")}St[t]=e,delete At[t],bt.hasOwnProperty(t)&&(e=bt[t],delete bt[t],e.forEach((function(t){t()})))}function It(t){Rt(t.Ld.Xd.Sd.name+" instance already deleted")}var Lt=!1;function Dt(){}function Gt(t){--t.count.value,0===t.count.value&&(t.$d?t.ge.le(t.$d):t.Xd.Sd.le(t.Qd))}function jt(t){return"undefined"==typeof FinalizationGroup?(jt=t=>t,t):(Lt=new FinalizationGroup((function(t){for(var e=t.next();!e.done;e=t.next())(e=e.value).Qd?Gt(e):console.warn("object already deleted: "+e.Qd)})),Dt=t=>{Lt.unregister(t.Ld)},(jt=t=>(Lt.register(t,t.Ld,t.Ld),t))(t))}var Wt=void 0,Ut=[];function Nt(){for(;Ut.length;){var t=Ut.pop();t.Ld.De=!1,t.delete()}}function zt(){}var Ht={};function $t(t,e,n){if(void 0===t[e].Zd){var i=t[e];t[e]=function(){return t[e].Zd.hasOwnProperty(arguments.length)||Rt("Function '"+n+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+t[e].Zd+")!"),t[e].Zd[arguments.length].apply(this,arguments)},t[e].Zd=[],t[e].Zd[i.Be]=i}}function Vt(t,n,i){e.hasOwnProperty(t)?((void 0===i||void 0!==e[t].Zd&&void 0!==e[t].Zd[i])&&Rt("Cannot register public name '"+t+"' twice"),$t(e,t,t),e.hasOwnProperty(i)&&Rt("Cannot register multiple overloads of a function with the same number of arguments ("+i+")!"),e[t].Zd[i]=n):(e[t]=n,void 0!==i&&(e[t].Fg=i))}function Yt(t,e,n,i,r,a,o,s){this.name=t,this.constructor=e,this.Ee=n,this.le=i,this.ie=r,this.Pf=a,this.Pe=o,this.Jf=s,this.fg=[]}function qt(t,e,n){for(;e!==n;)e.Pe||Rt("Expected null or instance of "+n.name+", got an instance of "+e.name),t=e.Pe(t),e=e.ie;return t}function Xt(t,e){return null===e?(this.gf&&Rt("null is not a valid "+this.name),0):(e.Ld||Rt('Cannot pass "'+me(e)+'" as a '+this.name),e.Ld.Qd||Rt("Cannot pass deleted object as a pointer of type "+this.name),qt(e.Ld.Qd,e.Ld.Xd.Sd,this.Sd))}function Kt(t,e){if(null===e){if(this.gf&&Rt("null is not a valid "+this.name),this.Ue){var n=this.hf();return null!==t&&t.push(this.le,n),n}return 0}if(e.Ld||Rt('Cannot pass "'+me(e)+'" as a '+this.name),e.Ld.Qd||Rt("Cannot pass deleted object as a pointer of type "+this.name),!this.Te&&e.Ld.Xd.Te&&Rt("Cannot convert argument of type "+(e.Ld.ge?e.Ld.ge.name:e.Ld.Xd.name)+" to parameter type "+this.name),n=qt(e.Ld.Qd,e.Ld.Xd.Sd,this.Sd),this.Ue)switch(void 0===e.Ld.$d&&Rt("Passing raw pointer to smart pointer is illegal"),this.qg){case 0:e.Ld.ge===this?n=e.Ld.$d:Rt("Cannot convert argument of type "+(e.Ld.ge?e.Ld.ge.name:e.Ld.Xd.name)+" to parameter type "+this.name);break;case 1:n=e.Ld.$d;break;case 2:if(e.Ld.ge===this)n=e.Ld.$d;else{var i=e.clone();n=this.gg(n,fe((function(){i.delete()}))),null!==t&&t.push(this.le,n)}break;default:Rt("Unsupporting sharing policy")}return n}function Qt(t,e){return null===e?(this.gf&&Rt("null is not a valid "+this.name),0):(e.Ld||Rt('Cannot pass "'+me(e)+'" as a '+this.name),e.Ld.Qd||Rt("Cannot pass deleted object as a pointer of type "+this.name),e.Ld.Xd.Te&&Rt("Cannot convert argument of type "+e.Ld.Xd.name+" to parameter type "+this.name),qt(e.Ld.Qd,e.Ld.Xd.Sd,this.Sd))}function Zt(t,e,n){return e===n?t:void 0===n.ie||null===(t=Zt(t,e,n.ie))?null:n.Jf(t)}var Jt={};function te(t,e){return e.Xd&&e.Qd||xt("makeClassHandle requires ptr and ptrType"),!!e.ge!=!!e.$d&&xt("Both smartPtrType and smartPtr must be specified"),e.count={value:1},jt(Object.create(t,{Ld:{value:e}}))}function ee(t,e,n,i,r,a,o,s,l,c,u){this.name=t,this.Sd=e,this.gf=n,this.Te=i,this.Ue=r,this.eg=a,this.qg=o,this.vf=s,this.hf=l,this.gg=c,this.le=u,r||void 0!==e.ie?this.toWireType=Kt:(this.toWireType=i?Xt:Qt,this.fe=null)}function ne(t,n,i){e.hasOwnProperty(t)||xt("Replacing nonexistant public symbol"),void 0!==e[t].Zd&&void 0!==i?e[t].Zd[i]=n:(e[t]=n,e[t].Be=i)}function ie(t,n){var i=(t=kt(t)).includes("j")?function(t,n){var i=[];return function(){i.length=arguments.length;for(var r=0;r<arguments.length;r++)i[r]=arguments[r];return t.includes("j")?(r=e["dynCall_"+t],r=i&&i.length?r.apply(null,[n].concat(i)):r.call(null,n)):r=dt(n).apply(null,i),r}}(t,n):dt(n);return"function"!=typeof i&&Rt("unknown function pointer with signature "+t+": "+n),i}var re=void 0;function ae(t){var e=kt(t=bn(t));return vn(t),e}function oe(t,e){var n=[],i={};throw e.forEach((function t(e){i[e]||St[e]||(At[e]?At[e].forEach(t):(n.push(e),i[e]=!0))})),new re(t+": "+n.map(ae).join([", "]))}function se(t,e,n,i,r){var a=e.length;2>a&&Rt("argTypes array size mismatch! Must at least get return value and 'this' types!");var o=null!==e[1]&&null!==n,s=!1;for(n=1;n<e.length;++n)if(null!==e[n]&&void 0===e[n].fe){s=!0;break}var l="void"!==e[0].name,c=a-2,u=Array(c),h=[],d=[];return function(){if(arguments.length!==c&&Rt("function "+t+" called with "+arguments.length+" arguments, expected "+c+" args!"),d.length=0,h.length=o?2:1,h[0]=r,o){var n=e[1].toWireType(d,this);h[1]=n}for(var a=0;a<c;++a)u[a]=e[a+2].toWireType(d,arguments[a]),h.push(u[a]);if(a=i.apply(null,h),s)vt(d);else for(var f=o?1:2;f<e.length;f++){var p=1===f?n:u[f-2];null!==e[f].fe&&e[f].fe(p)}return n=l?e[0].fromWireType(a):void 0}}function le(t,e){for(var n=[],i=0;i<t;i++)n.push(W[(e>>2)+i]);return n}var ce=[],ue=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function he(t){4<t&&0==--ue[t].jf&&(ue[t]=void 0,ce.push(t))}function de(t){return t||Rt("Cannot use deleted val. handle = "+t),ue[t].value}function fe(t){switch(t){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var e=ce.length?ce.pop():ue.length;return ue[e]={jf:1,value:t},e}}function pe(t,e,n){switch(e){case 0:return function(t){return this.fromWireType((n?L:D)[t])};case 1:return function(t){return this.fromWireType((n?G:j)[t>>1])};case 2:return function(t){return this.fromWireType((n?W:U)[t>>2])};default:throw new TypeError("Unknown integer type: "+t)}}function ge(t,e){var n=St[t];return void 0===n&&Rt(e+" has unknown type "+ae(t)),n}function me(t){if(null===t)return"null";var e=typeof t;return"object"===e||"array"===e||"function"===e?t.toString():""+t}function ye(t,e){switch(e){case 2:return function(t){return this.fromWireType(N[t>>2])};case 3:return function(t){return this.fromWireType(z[t>>3])};default:throw new TypeError("Unknown float type: "+t)}}function ve(t,e,n){switch(e){case 0:return n?function(t){return L[t]}:function(t){return D[t]};case 1:return n?function(t){return G[t>>1]}:function(t){return j[t>>1]};case 2:return n?function(t){return W[t>>2]}:function(t){return U[t>>2]};default:throw new TypeError("Unknown integer type: "+t)}}var we={};function be(t){var e=we[t];return void 0===e?kt(t):e}var Se=[];function Ae(){function t(t){t.$$$embind_global$$$=t;var e="object"==typeof $$$embind_global$$$&&t.$$$embind_global$$$===t;return e||delete t.$$$embind_global$$$,e}if("object"==typeof globalThis)return globalThis;if("object"==typeof $$$embind_global$$$)return $$$embind_global$$$;if("object"==typeof E&&t(E)?$$$embind_global$$$=E:"object"==typeof self&&t(self)&&($$$embind_global$$$=self),"object"==typeof $$$embind_global$$$)return $$$embind_global$$$;throw Error("unable to get global object.")}var Ce,Te=[],_e={};Ce=v?()=>{var t=process.hrtime();return 1e3*t[0]+t[1]/1e6}:()=>performance.now();var Pe=1,xe=[],Me=[],Fe=[],Ee=[],ke=[],Oe=[],Re=[],Be=[],Ie=[],Le=[],De={},Ge={},je=4;function We(t){He||(He=t)}function Ue(t){for(var e=Pe++,n=t.length;n<e;n++)t[n]=null;return e}function Ne(t){return ze=Be[t],e.Cg=dn=ze&&ze.je,!(t&&!dn)}var ze,He,$e=[];function Ve(t,e,n,i){for(var r=0;r<t;r++){var a=dn[n](),o=a&&Ue(i);a?(a.name=o,i[o]=a):We(1282),W[e+4*r>>2]=o}}function Ye(t){var e=O(t)+1,n=yn(e);return k(t,D,n,e),n}function qe(t){return"]"==t.slice(-1)&&t.lastIndexOf("[")}function Xe(t){return 0==(t-=5120)?L:1==t?D:2==t?G:4==t?W:6==t?N:5==t||28922==t||28520==t||30779==t||30782==t?U:j}function Ke(t,e,n,i,r){t=Xe(t);var a=31-Math.clz32(t.BYTES_PER_ELEMENT),o=je;return t.subarray(r>>a,r+i*(n*({5:3,6:4,8:2,29502:3,29504:4,26917:2,26918:2,29846:3,29847:4}[e-6402]||1)*(1<<a)+o-1&-o)>>a)}function Qe(t){var e=dn.Gf;if(e){var n=e.Oe[t];return"number"==typeof n&&(e.Oe[t]=n=dn.getUniformLocation(e,e.wf[t]+(0<n?"["+n+"]":""))),n}We(1282)}var Ze,Je=[],tn=[],en={};function nn(){if(!Ze){var t,e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:p||"./this.program"};for(t in en)void 0===en[t]?delete e[t]:e[t]=en[t];var n=[];for(t in e)n.push(t+"="+e[t]);Ze=n}return Ze}function rn(t){return 0==t%4&&(0!=t%100||0==t%400)}function an(t,e){for(var n=0,i=0;i<=e;n+=t[i++]);return n}var on=[31,29,31,30,31,30,31,31,30,31,30,31],sn=[31,28,31,30,31,30,31,31,30,31,30,31];function ln(t,e){for(t=new Date(t.getTime());0<e;){var n=t.getMonth(),i=(rn(t.getFullYear())?on:sn)[n];if(!(e>i-t.getDate())){t.setDate(t.getDate()+e);break}e-=i-t.getDate()+1,t.setDate(1),11>n?t.setMonth(n+1):(t.setMonth(0),t.setFullYear(t.getFullYear()+1))}return t}function cn(t,e,n,i){function r(t,e,n){for(t="number"==typeof t?t.toString():t||"";t.length<e;)t=n[0]+t;return t}function a(t,e){return r(t,e,"0")}function o(t,e){function n(t){return 0>t?-1:0<t?1:0}var i;return 0===(i=n(t.getFullYear()-e.getFullYear()))&&0===(i=n(t.getMonth()-e.getMonth()))&&(i=n(t.getDate()-e.getDate())),i}function s(t){switch(t.getDay()){case 0:return new Date(t.getFullYear()-1,11,29);case 1:return t;case 2:return new Date(t.getFullYear(),0,3);case 3:return new Date(t.getFullYear(),0,2);case 4:return new Date(t.getFullYear(),0,1);case 5:return new Date(t.getFullYear()-1,11,31);case 6:return new Date(t.getFullYear()-1,11,30)}}function l(t){t=ln(new Date(t.be+1900,0,1),t.$e);var e=new Date(t.getFullYear()+1,0,4),n=s(new Date(t.getFullYear(),0,4));return e=s(e),0>=o(n,t)?0>=o(e,t)?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var c=W[i+40>>2];for(var u in i={yg:W[i>>2],xg:W[i+4>>2],Ye:W[i+8>>2],Ne:W[i+12>>2],Fe:W[i+16>>2],be:W[i+20>>2],Ze:W[i+24>>2],$e:W[i+28>>2],Ig:W[i+32>>2],wg:W[i+36>>2],zg:c?F(c):""},n=F(n),c={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"})n=n.replace(new RegExp(u,"g"),c[u]);var h="Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),d="January February March April May June July August September October November December".split(" ");for(u in c={"%a":function(t){return h[t.Ze].substring(0,3)},"%A":function(t){return h[t.Ze]},"%b":function(t){return d[t.Fe].substring(0,3)},"%B":function(t){return d[t.Fe]},"%C":function(t){return a((t.be+1900)/100|0,2)},"%d":function(t){return a(t.Ne,2)},"%e":function(t){return r(t.Ne,2," ")},"%g":function(t){return l(t).toString().substring(2)},"%G":function(t){return l(t)},"%H":function(t){return a(t.Ye,2)},"%I":function(t){return 0==(t=t.Ye)?t=12:12<t&&(t-=12),a(t,2)},"%j":function(t){return a(t.Ne+an(rn(t.be+1900)?on:sn,t.Fe-1),3)},"%m":function(t){return a(t.Fe+1,2)},"%M":function(t){return a(t.xg,2)},"%n":function(){return"\n"},"%p":function(t){return 0<=t.Ye&&12>t.Ye?"AM":"PM"},"%S":function(t){return a(t.yg,2)},"%t":function(){return"\t"},"%u":function(t){return t.Ze||7},"%U":function(t){var e=new Date(t.be+1900,0,1),n=0===e.getDay()?e:ln(e,7-e.getDay());return 0>o(n,t=new Date(t.be+1900,t.Fe,t.Ne))?a(Math.ceil((31-n.getDate()+(an(rn(t.getFullYear())?on:sn,t.getMonth()-1)-31)+t.getDate())/7),2):0===o(n,e)?"01":"00"},"%V":function(t){var e=new Date(t.be+1901,0,4),n=s(new Date(t.be+1900,0,4));e=s(e);var i=ln(new Date(t.be+1900,0,1),t.$e);return 0>o(i,n)?"53":0>=o(e,i)?"01":a(Math.ceil((n.getFullYear()<t.be+1900?t.$e+32-n.getDate():t.$e+1-n.getDate())/7),2)},"%w":function(t){return t.Ze},"%W":function(t){var e=new Date(t.be,0,1),n=1===e.getDay()?e:ln(e,0===e.getDay()?1:7-e.getDay()+1);return 0>o(n,t=new Date(t.be+1900,t.Fe,t.Ne))?a(Math.ceil((31-n.getDate()+(an(rn(t.getFullYear())?on:sn,t.getMonth()-1)-31)+t.getDate())/7),2):0===o(n,e)?"01":"00"},"%y":function(t){return(t.be+1900).toString().substring(2)},"%Y":function(t){return t.be+1900},"%z":function(t){var e=0<=(t=t.wg);return t=Math.abs(t)/60,(e?"+":"-")+String("0000"+(t/60*100+t%60)).slice(-4)},"%Z":function(t){return t.zg},"%%":function(){return"%"}})n.includes(u)&&(n=n.replace(new RegExp(u,"g"),c[u](i)));return u=function(t){var e=Array(O(t)+1);return k(t,e,0,e.length),e}(n),u.length>e?0:(L.set(u,t),u.length-1)}Pt=e.InternalError=_t("InternalError");for(var un=Array(256),hn=0;256>hn;++hn)un[hn]=String.fromCharCode(hn);Et=un,Ot=e.BindingError=_t("BindingError"),zt.prototype.isAliasOf=function(t){if(!(this instanceof zt&&t instanceof zt))return!1;var e=this.Ld.Xd.Sd,n=this.Ld.Qd,i=t.Ld.Xd.Sd;for(t=t.Ld.Qd;e.ie;)n=e.Pe(n),e=e.ie;for(;i.ie;)t=i.Pe(t),i=i.ie;return e===i&&n===t},zt.prototype.clone=function(){if(this.Ld.Qd||It(this),this.Ld.Me)return this.Ld.count.value+=1,this;var t=jt,e=Object,n=e.create,i=Object.getPrototypeOf(this),r=this.Ld;return(t=t(n.call(e,i,{Ld:{value:{count:r.count,De:r.De,Me:r.Me,Qd:r.Qd,Xd:r.Xd,$d:r.$d,ge:r.ge}}}))).Ld.count.value+=1,t.Ld.De=!1,t},zt.prototype.delete=function(){this.Ld.Qd||It(this),this.Ld.De&&!this.Ld.Me&&Rt("Object already scheduled for deletion"),Dt(this),Gt(this.Ld),this.Ld.Me||(this.Ld.$d=void 0,this.Ld.Qd=void 0)},zt.prototype.isDeleted=function(){return!this.Ld.Qd},zt.prototype.deleteLater=function(){return this.Ld.Qd||It(this),this.Ld.De&&!this.Ld.Me&&Rt("Object already scheduled for deletion"),Ut.push(this),1===Ut.length&&Wt&&Wt(Nt),this.Ld.De=!0,this},ee.prototype.Qf=function(t){return this.vf&&(t=this.vf(t)),t},ee.prototype.nf=function(t){this.le&&this.le(t)},ee.prototype.argPackAdvance=8,ee.prototype.readValueFromPointer=wt,ee.prototype.deleteObject=function(t){null!==t&&t.delete()},ee.prototype.fromWireType=function(t){function e(){return this.Ue?te(this.Sd.Ee,{Xd:this.eg,Qd:n,ge:this,$d:t}):te(this.Sd.Ee,{Xd:this,Qd:t})}var n=this.Qf(t);if(!n)return this.nf(t),null;var i=function(t,e){for(void 0===e&&Rt("ptr should not be undefined");t.ie;)e=t.Pe(e),t=t.ie;return Jt[e]}(this.Sd,n);if(void 0!==i)return 0===i.Ld.count.value?(i.Ld.Qd=n,i.Ld.$d=t,i.clone()):(i=i.clone(),this.nf(t),i);if(i=this.Sd.Pf(n),!(i=Ht[i]))return e.call(this);i=this.Te?i.Ef:i.pointerType;var r=Zt(n,this.Sd,i.Sd);return null===r?e.call(this):this.Ue?te(i.Sd.Ee,{Xd:i,Qd:r,ge:this,$d:t}):te(i.Sd.Ee,{Xd:i,Qd:r})},e.getInheritedInstanceCount=function(){return Object.keys(Jt).length},e.getLiveInheritedInstances=function(){var t,e=[];for(t in Jt)Jt.hasOwnProperty(t)&&e.push(Jt[t]);return e},e.flushPendingDeletes=Nt,e.setDelayFunction=function(t){Wt=t,Ut.length&&Wt&&Wt(Nt)},re=e.UnboundTypeError=_t("UnboundTypeError"),e.count_emval_handles=function(){for(var t=0,e=5;e<ue.length;++e)void 0!==ue[e]&&++t;return t},e.get_first_emval=function(){for(var t=5;t<ue.length;++t)if(void 0!==ue[t])return ue[t];return null};for(var dn,fn=0;32>fn;++fn)$e.push(Array(fn));var pn=new Float32Array(288);for(fn=0;288>fn;++fn)Je[fn]=pn.subarray(0,fn+1);var gn=new Int32Array(288);for(fn=0;288>fn;++fn)tn[fn]=gn.subarray(0,fn+1);var mn={Lb:function(t){return yn(t+16)+16},Eb:function(t,e,n){throw new ft(t).Xf(e,n),t},P:function(){return 0},zb:function(){},xb:function(){},Cb:function(){return 0},wb:function(){},tb:function(t,e,n,i,r,a){if(a<<=12,0!=(16&i)&&0!=t%65536)e=-28;else if(0!=(32&i)){t=65536*Math.ceil(e/65536);var o=An(65536,t);o?(D.fill(0,o,o+t),t=o):t=0,t?(pt[t]={cg:t,bg:e,Df:!0,fd:r,Gg:n,flags:i,offset:a},e=t):e=-48}else e=-52;return e},sb:function(t,e){var n=pt[t];return 0!==e&&n?(e===n.bg&&(pt[t]=null,n.Df&&vn(n.cg)),t=0):t=-28,t},Q:function(){},yb:function(){},x:function(t){var e=yt[t];delete yt[t];var n=e.hf,i=e.le,r=e.rf;Mt([t],r.map((function(t){return t.Uf})).concat(r.map((function(t){return t.og}))),(function(t){var a={};return r.forEach((function(e,n){var i=t[n],o=e.Sf,s=e.Tf,l=t[n+r.length],c=e.ng,u=e.pg;a[e.Lf]={read:function(t){return i.fromWireType(o(s,t))},write:function(t,e){var n=[];c(u,t,l.toWireType(n,e)),vt(n)}}})),[{name:e.name,fromWireType:function(t){var e,n={};for(e in a)n[e]=a[e].read(t);return i(t),n},toWireType:function(t,e){for(var r in a)if(!(r in e))throw new TypeError('Missing field: "'+r+'"');var o=n();for(r in a)a[r].write(o,e[r]);return null!==t&&t.push(i,o),o},argPackAdvance:8,readValueFromPointer:wt,fe:i}]}))},mb:function(){},Fb:function(t,e,n,i,r){var a=Ft(n);Bt(t,{name:e=kt(e),fromWireType:function(t){return!!t},toWireType:function(t,e){return e?i:r},argPackAdvance:8,readValueFromPointer:function(t){if(1===n)var i=L;else if(2===n)i=G;else{if(4!==n)throw new TypeError("Unknown boolean type size: "+e);i=W}return this.fromWireType(i[t>>a])},fe:null})},l:function(t,e,n,i,r,a,o,s,l,c,u,h,d){u=kt(u),a=ie(r,a),s&&(s=ie(o,s)),c&&(c=ie(l,c)),d=ie(h,d);var f=Ct(u);Vt(f,(function(){oe("Cannot construct "+u+" due to unbound types",[i])})),Mt([t,e,n],i?[i]:[],(function(e){if(e=e[0],i)var n=e.Sd,r=n.Ee;else r=zt.prototype;e=Tt(f,(function(){if(Object.getPrototypeOf(this)!==o)throw new Ot("Use 'new' to construct "+u);if(void 0===l.oe)throw new Ot(u+" has no accessible constructor");var t=l.oe[arguments.length];if(void 0===t)throw new Ot("Tried to invoke ctor of "+u+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(l.oe).toString()+") parameters instead!");return t.apply(this,arguments)}));var o=Object.create(r,{constructor:{value:e}});e.prototype=o;var l=new Yt(u,e,o,d,n,a,s,c);n=new ee(u,l,!0,!1,!1),r=new ee(u+"*",l,!1,!1,!1);var h=new ee(u+" const*",l,!1,!0,!1);return Ht[t]={pointerType:r,Ef:h},ne(f,e),[n,r,h]}))},e:function(t,e,n,i,r,a,o){var s=le(n,i);e=kt(e),a=ie(r,a),Mt([],[t],(function(t){function i(){oe("Cannot call "+r+" due to unbound types",s)}var r=(t=t[0]).name+"."+e;e.startsWith("@@")&&(e=Symbol[e.substring(2)]);var l=t.Sd.constructor;return void 0===l[e]?(i.Be=n-1,l[e]=i):($t(l,e,r),l[e].Zd[n-1]=i),Mt([],s,(function(t){return t=[t[0],null].concat(t.slice(1)),t=se(r,t,null,a,o),void 0===l[e].Zd?(t.Be=n-1,l[e]=t):l[e].Zd[n-1]=t,[]})),[]}))},u:function(t,e,n,i,r,a){0<e||st(void 0);var o=le(e,n);r=ie(i,r),Mt([],[t],(function(t){var n="constructor "+(t=t[0]).name;if(void 0===t.Sd.oe&&(t.Sd.oe=[]),void 0!==t.Sd.oe[e-1])throw new Ot("Cannot register multiple constructors with identical number of parameters ("+(e-1)+") for class '"+t.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return t.Sd.oe[e-1]=()=>{oe("Cannot construct "+t.name+" due to unbound types",o)},Mt([],o,(function(i){return i.splice(1,0,null),t.Sd.oe[e-1]=se(n,i,null,r,a),[]})),[]}))},d:function(t,e,n,i,r,a,o,s){var l=le(n,i);e=kt(e),a=ie(r,a),Mt([],[t],(function(t){function i(){oe("Cannot call "+r+" due to unbound types",l)}var r=(t=t[0]).name+"."+e;e.startsWith("@@")&&(e=Symbol[e.substring(2)]),s&&t.Sd.fg.push(e);var c=t.Sd.Ee,u=c[e];return void 0===u||void 0===u.Zd&&u.className!==t.name&&u.Be===n-2?(i.Be=n-2,i.className=t.name,c[e]=i):($t(c,e,r),c[e].Zd[n-2]=i),Mt([],l,(function(i){return i=se(r,i,t,a,o),void 0===c[e].Zd?(i.Be=n-2,c[e]=i):c[e].Zd[n-2]=i,[]})),[]}))},V:function(t,n,i){t=kt(t),Mt([],[n],(function(n){return n=n[0],e[t]=n.fromWireType(i),[]}))},Db:function(t,e){Bt(t,{name:e=kt(e),fromWireType:function(t){var e=de(t);return he(t),e},toWireType:function(t,e){return fe(e)},argPackAdvance:8,readValueFromPointer:wt,fe:null})},k:function(t,e,n,i){function r(){}n=Ft(n),e=kt(e),r.values={},Bt(t,{name:e,constructor:r,fromWireType:function(t){return this.constructor.values[t]},toWireType:function(t,e){return e.value},argPackAdvance:8,readValueFromPointer:pe(e,n,i),fe:null}),Vt(e,r)},j:function(t,e,n){var i=ge(t,"enum");e=kt(e),t=i.constructor,i=Object.create(i.constructor.prototype,{value:{value:n},constructor:{value:Tt(i.name+"_"+e,(function(){}))}}),t.values[n]=i,t[e]=i},S:function(t,e,n){n=Ft(n),Bt(t,{name:e=kt(e),fromWireType:function(t){return t},toWireType:function(t,e){return e},argPackAdvance:8,readValueFromPointer:ye(e,n),fe:null})},t:function(t,e,n,i,r,a){var o=le(e,n);t=kt(t),r=ie(i,r),Vt(t,(function(){oe("Cannot call "+t+" due to unbound types",o)}),e-1),Mt([],o,(function(n){return n=[n[0],null].concat(n.slice(1)),ne(t,se(t,n,null,r,a),e-1),[]}))},w:function(t,e,n,i,r){e=kt(e),-1===r&&(r=4294967295),r=Ft(n);var a=t=>t;if(0===i){var o=32-8*n;a=t=>t<<o>>>o}n=e.includes("unsigned")?function(t,e){return e>>>0}:function(t,e){return e},Bt(t,{name:e,fromWireType:a,toWireType:n,argPackAdvance:8,readValueFromPointer:ve(e,r,0!==i),fe:null})},p:function(t,e,n){function i(t){var e=U;return new r(I,e[1+(t>>=2)],e[t])}var r=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array][e];Bt(t,{name:n=kt(n),fromWireType:i,argPackAdvance:8,readValueFromPointer:i},{Wf:!0})},o:function(t,e,n,i,r,a,o,s,l,c,u,h){n=kt(n),a=ie(r,a),s=ie(o,s),c=ie(l,c),h=ie(u,h),Mt([t],[e],(function(t){return t=t[0],[new ee(n,t.Sd,!1,!1,!0,t,i,a,s,c,h)]}))},R:function(t,e){var n="std::string"===(e=kt(e));Bt(t,{name:e,fromWireType:function(t){var e=U[t>>2];if(n)for(var i=t+4,r=0;r<=e;++r){var a=t+4+r;if(r==e||0==D[a]){if(i=F(i,a-i),void 0===o)var o=i;else o+=String.fromCharCode(0),o+=i;i=a+1}}else{for(o=Array(e),r=0;r<e;++r)o[r]=String.fromCharCode(D[t+4+r]);o=o.join("")}return vn(t),o},toWireType:function(t,e){e instanceof ArrayBuffer&&(e=new Uint8Array(e));var i="string"==typeof e;i||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int8Array||Rt("Cannot pass non-string to std::string");var r=(n&&i?()=>O(e):()=>e.length)(),a=yn(4+r+1);if(U[a>>2]=r,n&&i)k(e,D,a+4,r+1);else if(i)for(i=0;i<r;++i){var o=e.charCodeAt(i);255<o&&(vn(a),Rt("String has UTF-16 code units that do not fit in 8 bits")),D[a+4+i]=o}else for(i=0;i<r;++i)D[a+4+i]=e[i];return null!==t&&t.push(vn,a),a},argPackAdvance:8,readValueFromPointer:wt,fe:function(t){vn(t)}})},H:function(t,e,n){if(n=kt(n),2===e)var i=$,r=V,a=Y,o=()=>j,s=1;else 4===e&&(i=q,r=X,a=K,o=()=>U,s=2);Bt(t,{name:n,fromWireType:function(t){for(var n,r=U[t>>2],a=o(),l=t+4,c=0;c<=r;++c){var u=t+4+c*e;c!=r&&0!=a[u>>s]||(l=i(l,u-l),void 0===n?n=l:(n+=String.fromCharCode(0),n+=l),l=u+e)}return vn(t),n},toWireType:function(t,i){"string"!=typeof i&&Rt("Cannot pass non-string to C++ string type "+n);var o=a(i),l=yn(4+o+e);return U[l>>2]=o>>s,r(i,l+4,o+e),null!==t&&t.push(vn,l),l},argPackAdvance:8,readValueFromPointer:wt,fe:function(t){vn(t)}})},y:function(t,e,n,i,r,a){yt[t]={name:kt(e),hf:ie(n,i),le:ie(r,a),rf:[]}},g:function(t,e,n,i,r,a,o,s,l,c){yt[t].rf.push({Lf:kt(e),Uf:n,Sf:ie(i,r),Tf:a,og:o,ng:ie(s,l),pg:c})},Gb:function(t,e){Bt(t,{Zf:!0,name:e=kt(e),argPackAdvance:0,fromWireType:function(){},toWireType:function(){}})},pb:function(){throw"longjmp"},A:function(t,e,n){t=de(t),e=ge(e,"emval::as");var i=[],r=fe(i);return W[n>>2]=r,e.toWireType(i,t)},M:function(t,e,n,i,r){t=Se[t],e=de(e),n=be(n);var a=[];return W[i>>2]=fe(a),t(e,n,a,r)},B:function(t,e,n,i){(t=Se[t])(e=de(e),n=be(n),null,i)},D:he,Bb:function(t){return 0===t?fe(Ae()):(t=be(t),fe(Ae()[t]))},z:function(t,e){var n=function(t,e){for(var n=Array(t),i=0;i<t;++i)n[i]=ge(W[(e>>2)+i],"parameter "+i);return n}(t,e),i=n[0];e=i.name+"_$"+n.slice(1).map((function(t){return t.name})).join("_")+"$";var r=Te[e];if(void 0!==r)return r;var a=Array(t-1);return r=function(t){var e=Se.length;return Se.push(t),e}(((e,r,o,s)=>{for(var l=0,c=0;c<t-1;++c)a[c]=n[c+1].readValueFromPointer(s+l),l+=n[c+1].argPackAdvance;for(e=e[r].apply(e,a),c=0;c<t-1;++c)n[c+1].Hf&&n[c+1].Hf(a[c]);if(!i.Zf)return i.toWireType(o,e)})),Te[e]=r},K:function(t,e){return fe((t=de(t))[e=de(e)])},F:function(t){4<t&&(ue[t].jf+=1)},rb:function(t,e,n,i){t=de(t);var r=_e[e];return r||(r=function(t){var e=Array(t+1);return function(n,i,r){e[0]=n;for(var a=0;a<t;++a){var o=ge(W[(i>>2)+a],"parameter "+a);e[a+1]=o.readValueFromPointer(r),r+=o.argPackAdvance}return fe(n=new(n.bind.apply(n,e)))}}(e),_e[e]=r),r(t,n,i)},gb:function(){return fe([])},Ka:function(t){return fe(be(t))},hb:function(){return fe({})},fb:function(t){return!(t=de(t))},jb:function(t){vt(de(t)),he(t)},v:function(t,e,n){t=de(t),e=de(e),n=de(n),t[e]=n},r:function(t,e){return fe(t=(t=ge(t,"_emval_take_value")).readValueFromPointer(e))},a:function(){st("")},ob:function(t,e){if(0===t)t=Date.now();else{if(1!==t&&4!==t)return W[wn()>>2]=28,-1;t=Ce()}return W[e>>2]=t/1e3|0,W[e+4>>2]=t%1e3*1e6|0,0},_c:function(t){dn.activeTexture(t)},$c:function(t,e){dn.attachShader(Me[t],Oe[e])},ad:function(t,e,n){dn.bindAttribLocation(Me[t],e,F(n))},Y:function(t,e){35051==t?dn.ff=e:35052==t&&(dn.Ce=e),dn.bindBuffer(t,xe[e])},X:function(t,e){dn.bindFramebuffer(t,Fe[e])},cc:function(t,e){dn.bindRenderbuffer(t,Ee[e])},Qb:function(t,e){dn.bindSampler(t,Ie[e])},Z:function(t,e){dn.bindTexture(t,ke[e])},wc:function(t){dn.bindVertexArray(Re[t])},zc:function(t){dn.bindVertexArray(Re[t])},_:function(t,e,n,i){dn.blendColor(t,e,n,i)},$:function(t){dn.blendEquation(t)},aa:function(t,e){dn.blendFunc(t,e)},Xb:function(t,e,n,i,r,a,o,s,l,c){dn.blitFramebuffer(t,e,n,i,r,a,o,s,l,c)},ba:function(t,e,n,i){2<=ze.version?n?dn.bufferData(t,D,i,n,e):dn.bufferData(t,e,i):dn.bufferData(t,n?D.subarray(n,n+e):e,i)},ca:function(t,e,n,i){2<=ze.version?dn.bufferSubData(t,e,D,i,n):dn.bufferSubData(t,e,D.subarray(i,i+n))},dc:function(t){return dn.checkFramebufferStatus(t)},L:function(t){dn.clear(t)},W:function(t,e,n,i){dn.clearColor(t,e,n,i)},O:function(t){dn.clearStencil(t)},db:function(t,e,n,i){return dn.clientWaitSync(Le[t],e,(n>>>0)+4294967296*i)},da:function(t,e,n,i){dn.colorMask(!!t,!!e,!!n,!!i)},ea:function(t){dn.compileShader(Oe[t])},fa:function(t,e,n,i,r,a,o,s){2<=ze.version?dn.Ce?dn.compressedTexImage2D(t,e,n,i,r,a,o,s):dn.compressedTexImage2D(t,e,n,i,r,a,D,s,o):dn.compressedTexImage2D(t,e,n,i,r,a,s?D.subarray(s,s+o):null)},ga:function(t,e,n,i,r,a,o,s,l){2<=ze.version?dn.Ce?dn.compressedTexSubImage2D(t,e,n,i,r,a,o,s,l):dn.compressedTexSubImage2D(t,e,n,i,r,a,o,D,l,s):dn.compressedTexSubImage2D(t,e,n,i,r,a,o,l?D.subarray(l,l+s):null)},ha:function(t,e,n,i,r,a,o,s){dn.copyTexSubImage2D(t,e,n,i,r,a,o,s)},ia:function(){var t=Ue(Me),e=dn.createProgram();return e.name=t,e.Xe=e.Ve=e.We=0,e.kf=1,Me[t]=e,t},ja:function(t){var e=Ue(Oe);return Oe[e]=dn.createShader(t),e},ka:function(t){dn.cullFace(t)},la:function(t,e){for(var n=0;n<t;n++){var i=W[e+4*n>>2],r=xe[i];r&&(dn.deleteBuffer(r),r.name=0,xe[i]=null,i==dn.ff&&(dn.ff=0),i==dn.Ce&&(dn.Ce=0))}},ec:function(t,e){for(var n=0;n<t;++n){var i=W[e+4*n>>2],r=Fe[i];r&&(dn.deleteFramebuffer(r),r.name=0,Fe[i]=null)}},ma:function(t){if(t){var e=Me[t];e?(dn.deleteProgram(e),e.name=0,Me[t]=null):We(1281)}},fc:function(t,e){for(var n=0;n<t;n++){var i=W[e+4*n>>2],r=Ee[i];r&&(dn.deleteRenderbuffer(r),r.name=0,Ee[i]=null)}},Rb:function(t,e){for(var n=0;n<t;n++){var i=W[e+4*n>>2],r=Ie[i];r&&(dn.deleteSampler(r),r.name=0,Ie[i]=null)}},na:function(t){if(t){var e=Oe[t];e?(dn.deleteShader(e),Oe[t]=null):We(1281)}},Zb:function(t){if(t){var e=Le[t];e?(dn.deleteSync(e),e.name=0,Le[t]=null):We(1281)}},oa:function(t,e){for(var n=0;n<t;n++){var i=W[e+4*n>>2],r=ke[i];r&&(dn.deleteTexture(r),r.name=0,ke[i]=null)}},xc:function(t,e){for(var n=0;n<t;n++){var i=W[e+4*n>>2];dn.deleteVertexArray(Re[i]),Re[i]=null}},Ac:function(t,e){for(var n=0;n<t;n++){var i=W[e+4*n>>2];dn.deleteVertexArray(Re[i]),Re[i]=null}},pa:function(t){dn.depthMask(!!t)},qa:function(t){dn.disable(t)},ra:function(t){dn.disableVertexAttribArray(t)},sa:function(t,e,n){dn.drawArrays(t,e,n)},uc:function(t,e,n,i){dn.drawArraysInstanced(t,e,n,i)},sc:function(t,e,n,i,r){dn.pf.drawArraysInstancedBaseInstanceWEBGL(t,e,n,i,r)},qc:function(t,e){for(var n=$e[t],i=0;i<t;i++)n[i]=W[e+4*i>>2];dn.drawBuffers(n)},ta:function(t,e,n,i){dn.drawElements(t,e,n,i)},vc:function(t,e,n,i,r){dn.drawElementsInstanced(t,e,n,i,r)},tc:function(t,e,n,i,r,a,o){dn.pf.drawElementsInstancedBaseVertexBaseInstanceWEBGL(t,e,n,i,r,a,o)},kc:function(t,e,n,i,r,a){dn.drawElements(t,i,r,a)},ua:function(t){dn.enable(t)},va:function(t){dn.enableVertexAttribArray(t)},Vb:function(t,e){return(t=dn.fenceSync(t,e))?(e=Ue(Le),t.name=e,Le[e]=t,e):0},wa:function(){dn.finish()},xa:function(){dn.flush()},gc:function(t,e,n,i){dn.framebufferRenderbuffer(t,e,n,Ee[i])},hc:function(t,e,n,i,r){dn.framebufferTexture2D(t,e,n,ke[i],r)},ya:function(t){dn.frontFace(t)},za:function(t,e){Ve(t,e,"createBuffer",xe)},ic:function(t,e){Ve(t,e,"createFramebuffer",Fe)},jc:function(t,e){Ve(t,e,"createRenderbuffer",Ee)},Sb:function(t,e){Ve(t,e,"createSampler",Ie)},Aa:function(t,e){Ve(t,e,"createTexture",ke)},yc:function(t,e){Ve(t,e,"createVertexArray",Re)},Bc:function(t,e){Ve(t,e,"createVertexArray",Re)},_b:function(t){dn.generateMipmap(t)},Ba:function(t,e,n){n?W[n>>2]=dn.getBufferParameter(t,e):We(1281)},Ca:function(){var t=dn.getError()||He;return He=0,t},$b:function(t,e,n,i){((t=dn.getFramebufferAttachmentParameter(t,e,n))instanceof WebGLRenderbuffer||t instanceof WebGLTexture)&&(t=0|t.name),W[i>>2]=t},E:function(t,e){!function(t,e){if(e){var n=void 0;switch(t){case 36346:n=1;break;case 36344:return;case 34814:case 36345:n=0;break;case 34466:var i=dn.getParameter(34467);n=i?i.length:0;break;case 33309:if(2>ze.version)return void We(1282);n=2*(dn.getSupportedExtensions()||[]).length;break;case 33307:case 33308:if(2>ze.version)return void We(1280);n=33307==t?3:0}if(void 0===n)switch(i=dn.getParameter(t),typeof i){case"number":n=i;break;case"boolean":n=i?1:0;break;case"string":return void We(1280);case"object":if(null===i)switch(t){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 36662:case 36663:case 35053:case 35055:case 36010:case 35097:case 35869:case 32874:case 36389:case 35983:case 35368:case 34068:n=0;break;default:return void We(1280)}else{if(i instanceof Float32Array||i instanceof Uint32Array||i instanceof Int32Array||i instanceof Array){for(t=0;t<i.length;++t)W[e+4*t>>2]=i[t];return}try{n=0|i.name}catch(e){return We(1280),void S("GL_INVALID_ENUM in glGet0v: Unknown object returned from WebGL getParameter("+t+")! (error: "+e+")")}}break;default:return We(1280),void S("GL_INVALID_ENUM in glGet0v: Native code calling glGet0v("+t+") and it returns "+i+" of type "+typeof i+"!")}W[e>>2]=n}else We(1281)}(t,e)},Da:function(t,e,n,i){null===(t=dn.getProgramInfoLog(Me[t]))&&(t="(unknown error)"),e=0<e&&i?k(t,D,i,e):0,n&&(W[n>>2]=e)},Ea:function(t,e,n){if(n)if(t>=Pe)We(1281);else if(t=Me[t],35716==e)null===(t=dn.getProgramInfoLog(t))&&(t="(unknown error)"),W[n>>2]=t.length+1;else if(35719==e){if(!t.Xe)for(e=0;e<dn.getProgramParameter(t,35718);++e)t.Xe=Math.max(t.Xe,dn.getActiveUniform(t,e).name.length+1);W[n>>2]=t.Xe}else if(35722==e){if(!t.Ve)for(e=0;e<dn.getProgramParameter(t,35721);++e)t.Ve=Math.max(t.Ve,dn.getActiveAttrib(t,e).name.length+1);W[n>>2]=t.Ve}else if(35381==e){if(!t.We)for(e=0;e<dn.getProgramParameter(t,35382);++e)t.We=Math.max(t.We,dn.getActiveUniformBlockName(t,e).length+1);W[n>>2]=t.We}else W[n>>2]=dn.getProgramParameter(t,e);else We(1281)},ac:function(t,e,n){n?W[n>>2]=dn.getRenderbufferParameter(t,e):We(1281)},Fa:function(t,e,n,i){null===(t=dn.getShaderInfoLog(Oe[t]))&&(t="(unknown error)"),e=0<e&&i?k(t,D,i,e):0,n&&(W[n>>2]=e)},Nb:function(t,e,n,i){t=dn.getShaderPrecisionFormat(t,e),W[n>>2]=t.rangeMin,W[n+4>>2]=t.rangeMax,W[i>>2]=t.precision},Ga:function(t,e,n){n?35716==e?(null===(t=dn.getShaderInfoLog(Oe[t]))&&(t="(unknown error)"),W[n>>2]=t?t.length+1:0):35720==e?(t=dn.getShaderSource(Oe[t]),W[n>>2]=t?t.length+1:0):W[n>>2]=dn.getShaderParameter(Oe[t],e):We(1281)},J:function(t){var e=De[t];if(!e){switch(t){case 7939:e=Ye((e=(e=dn.getSupportedExtensions()||[]).concat(e.map((function(t){return"GL_"+t})))).join(" "));break;case 7936:case 7937:case 37445:case 37446:(e=dn.getParameter(t))||We(1280),e=e&&Ye(e);break;case 7938:e=dn.getParameter(7938),e=Ye(e=2<=ze.version?"OpenGL ES 3.0 ("+e+")":"OpenGL ES 2.0 ("+e+")");break;case 35724:var n=(e=dn.getParameter(35724)).match(/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/);null!==n&&(3==n[1].length&&(n[1]+="0"),e="OpenGL ES GLSL ES "+n[1]+" ("+e+")"),e=Ye(e);break;default:We(1280)}De[t]=e}return e},cb:function(t,e){if(2>ze.version)return We(1282),0;var n=Ge[t];return n?0>e||e>=n.length?(We(1281),0):n[e]:7939===t?(n=(n=(n=dn.getSupportedExtensions()||[]).concat(n.map((function(t){return"GL_"+t})))).map((function(t){return Ye(t)})),n=Ge[t]=n,0>e||e>=n.length?(We(1281),0):n[e]):(We(1280),0)},Ha:function(t,e){if(e=F(e),t=Me[t]){var n,i=t,r=i.Oe,a=i.xf;if(!r)for(i.Oe=r={},i.wf={},n=0;n<dn.getProgramParameter(i,35718);++n){var o=dn.getActiveUniform(i,n),s=o.name;o=o.size;var l=qe(s);l=0<l?s.slice(0,l):s;var c=i.kf;for(i.kf+=o,a[l]=[o,c],s=0;s<o;++s)r[c]=s,i.wf[c++]=l}if(i=t.Oe,r=0,a=e,0<(n=qe(e))&&(r=parseInt(e.slice(n+1))>>>0,a=e.slice(0,n)),(a=t.xf[a])&&r<a[0]&&(i[r+=a[1]]=i[r]||dn.getUniformLocation(t,e)))return r}else We(1281);return-1},Ob:function(t,e,n){for(var i=$e[e],r=0;r<e;r++)i[r]=W[n+4*r>>2];dn.invalidateFramebuffer(t,i)},Pb:function(t,e,n,i,r,a,o){for(var s=$e[e],l=0;l<e;l++)s[l]=W[n+4*l>>2];dn.invalidateSubFramebuffer(t,s,i,r,a,o)},Wb:function(t){return dn.isSync(Le[t])},Ia:function(t){return(t=ke[t])?dn.isTexture(t):0},Ja:function(t){dn.lineWidth(t)},La:function(t){t=Me[t],dn.linkProgram(t),t.Oe=0,t.xf={}},oc:function(t,e,n,i,r,a){dn.uf.multiDrawArraysInstancedBaseInstanceWEBGL(t,W,e>>2,W,n>>2,W,i>>2,U,r>>2,a)},pc:function(t,e,n,i,r,a,o,s){dn.uf.multiDrawElementsInstancedBaseVertexBaseInstanceWEBGL(t,W,e>>2,n,W,i>>2,W,r>>2,W,a>>2,U,o>>2,s)},Ma:function(t,e){3317==t&&(je=e),dn.pixelStorei(t,e)},rc:function(t){dn.readBuffer(t)},Na:function(t,e,n,i,r,a,o){if(2<=ze.version)if(dn.ff)dn.readPixels(t,e,n,i,r,a,o);else{var s=Xe(a);dn.readPixels(t,e,n,i,r,a,s,o>>31-Math.clz32(s.BYTES_PER_ELEMENT))}else(o=Ke(a,r,n,i,o))?dn.readPixels(t,e,n,i,r,a,o):We(1280)},bc:function(t,e,n,i){dn.renderbufferStorage(t,e,n,i)},Yb:function(t,e,n,i,r){dn.renderbufferStorageMultisample(t,e,n,i,r)},Tb:function(t,e,n){dn.samplerParameteri(Ie[t],e,n)},Ub:function(t,e,n){dn.samplerParameteri(Ie[t],e,W[n>>2])},Oa:function(t,e,n,i){dn.scissor(t,e,n,i)},Pa:function(t,e,n,i){for(var r="",a=0;a<e;++a){var o=i?W[i+4*a>>2]:-1;r+=F(W[n+4*a>>2],0>o?void 0:o)}dn.shaderSource(Oe[t],r)},Qa:function(t,e,n){dn.stencilFunc(t,e,n)},Ra:function(t,e,n,i){dn.stencilFuncSeparate(t,e,n,i)},Sa:function(t){dn.stencilMask(t)},Ta:function(t,e){dn.stencilMaskSeparate(t,e)},Ua:function(t,e,n){dn.stencilOp(t,e,n)},Va:function(t,e,n,i){dn.stencilOpSeparate(t,e,n,i)},Wa:function(t,e,n,i,r,a,o,s,l){if(2<=ze.version)if(dn.Ce)dn.texImage2D(t,e,n,i,r,a,o,s,l);else if(l){var c=Xe(s);dn.texImage2D(t,e,n,i,r,a,o,s,c,l>>31-Math.clz32(c.BYTES_PER_ELEMENT))}else dn.texImage2D(t,e,n,i,r,a,o,s,null);else dn.texImage2D(t,e,n,i,r,a,o,s,l?Ke(s,o,i,r,l):null)},Xa:function(t,e,n){dn.texParameterf(t,e,n)},Ya:function(t,e,n){dn.texParameterf(t,e,N[n>>2])},Za:function(t,e,n){dn.texParameteri(t,e,n)},_a:function(t,e,n){dn.texParameteri(t,e,W[n>>2])},lc:function(t,e,n,i,r){dn.texStorage2D(t,e,n,i,r)},$a:function(t,e,n,i,r,a,o,s,l){if(2<=ze.version)if(dn.Ce)dn.texSubImage2D(t,e,n,i,r,a,o,s,l);else if(l){var c=Xe(s);dn.texSubImage2D(t,e,n,i,r,a,o,s,c,l>>31-Math.clz32(c.BYTES_PER_ELEMENT))}else dn.texSubImage2D(t,e,n,i,r,a,o,s,null);else c=null,l&&(c=Ke(s,o,r,a,l)),dn.texSubImage2D(t,e,n,i,r,a,o,s,c)},ab:function(t,e){dn.uniform1f(Qe(t),e)},bb:function(t,e,n){if(2<=ze.version)dn.uniform1fv(Qe(t),N,n>>2,e);else{if(288>=e)for(var i=Je[e-1],r=0;r<e;++r)i[r]=N[n+4*r>>2];else i=N.subarray(n>>2,n+4*e>>2);dn.uniform1fv(Qe(t),i)}},Wc:function(t,e){dn.uniform1i(Qe(t),e)},Xc:function(t,e,n){if(2<=ze.version)dn.uniform1iv(Qe(t),W,n>>2,e);else{if(288>=e)for(var i=tn[e-1],r=0;r<e;++r)i[r]=W[n+4*r>>2];else i=W.subarray(n>>2,n+4*e>>2);dn.uniform1iv(Qe(t),i)}},Yc:function(t,e,n){dn.uniform2f(Qe(t),e,n)},Zc:function(t,e,n){if(2<=ze.version)dn.uniform2fv(Qe(t),N,n>>2,2*e);else{if(144>=e)for(var i=Je[2*e-1],r=0;r<2*e;r+=2)i[r]=N[n+4*r>>2],i[r+1]=N[n+(4*r+4)>>2];else i=N.subarray(n>>2,n+8*e>>2);dn.uniform2fv(Qe(t),i)}},Vc:function(t,e,n){dn.uniform2i(Qe(t),e,n)},Uc:function(t,e,n){if(2<=ze.version)dn.uniform2iv(Qe(t),W,n>>2,2*e);else{if(144>=e)for(var i=tn[2*e-1],r=0;r<2*e;r+=2)i[r]=W[n+4*r>>2],i[r+1]=W[n+(4*r+4)>>2];else i=W.subarray(n>>2,n+8*e>>2);dn.uniform2iv(Qe(t),i)}},Tc:function(t,e,n,i){dn.uniform3f(Qe(t),e,n,i)},Sc:function(t,e,n){if(2<=ze.version)dn.uniform3fv(Qe(t),N,n>>2,3*e);else{if(96>=e)for(var i=Je[3*e-1],r=0;r<3*e;r+=3)i[r]=N[n+4*r>>2],i[r+1]=N[n+(4*r+4)>>2],i[r+2]=N[n+(4*r+8)>>2];else i=N.subarray(n>>2,n+12*e>>2);dn.uniform3fv(Qe(t),i)}},Rc:function(t,e,n,i){dn.uniform3i(Qe(t),e,n,i)},Qc:function(t,e,n){if(2<=ze.version)dn.uniform3iv(Qe(t),W,n>>2,3*e);else{if(96>=e)for(var i=tn[3*e-1],r=0;r<3*e;r+=3)i[r]=W[n+4*r>>2],i[r+1]=W[n+(4*r+4)>>2],i[r+2]=W[n+(4*r+8)>>2];else i=W.subarray(n>>2,n+12*e>>2);dn.uniform3iv(Qe(t),i)}},Pc:function(t,e,n,i,r){dn.uniform4f(Qe(t),e,n,i,r)},Oc:function(t,e,n){if(2<=ze.version)dn.uniform4fv(Qe(t),N,n>>2,4*e);else{if(72>=e){var i=Je[4*e-1],r=N;n>>=2;for(var a=0;a<4*e;a+=4){var o=n+a;i[a]=r[o],i[a+1]=r[o+1],i[a+2]=r[o+2],i[a+3]=r[o+3]}}else i=N.subarray(n>>2,n+16*e>>2);dn.uniform4fv(Qe(t),i)}},Cc:function(t,e,n,i,r){dn.uniform4i(Qe(t),e,n,i,r)},Dc:function(t,e,n){if(2<=ze.version)dn.uniform4iv(Qe(t),W,n>>2,4*e);else{if(72>=e)for(var i=tn[4*e-1],r=0;r<4*e;r+=4)i[r]=W[n+4*r>>2],i[r+1]=W[n+(4*r+4)>>2],i[r+2]=W[n+(4*r+8)>>2],i[r+3]=W[n+(4*r+12)>>2];else i=W.subarray(n>>2,n+16*e>>2);dn.uniform4iv(Qe(t),i)}},Ec:function(t,e,n,i){if(2<=ze.version)dn.uniformMatrix2fv(Qe(t),!!n,N,i>>2,4*e);else{if(72>=e)for(var r=Je[4*e-1],a=0;a<4*e;a+=4)r[a]=N[i+4*a>>2],r[a+1]=N[i+(4*a+4)>>2],r[a+2]=N[i+(4*a+8)>>2],r[a+3]=N[i+(4*a+12)>>2];else r=N.subarray(i>>2,i+16*e>>2);dn.uniformMatrix2fv(Qe(t),!!n,r)}},Fc:function(t,e,n,i){if(2<=ze.version)dn.uniformMatrix3fv(Qe(t),!!n,N,i>>2,9*e);else{if(32>=e)for(var r=Je[9*e-1],a=0;a<9*e;a+=9)r[a]=N[i+4*a>>2],r[a+1]=N[i+(4*a+4)>>2],r[a+2]=N[i+(4*a+8)>>2],r[a+3]=N[i+(4*a+12)>>2],r[a+4]=N[i+(4*a+16)>>2],r[a+5]=N[i+(4*a+20)>>2],r[a+6]=N[i+(4*a+24)>>2],r[a+7]=N[i+(4*a+28)>>2],r[a+8]=N[i+(4*a+32)>>2];else r=N.subarray(i>>2,i+36*e>>2);dn.uniformMatrix3fv(Qe(t),!!n,r)}},Gc:function(t,e,n,i){if(2<=ze.version)dn.uniformMatrix4fv(Qe(t),!!n,N,i>>2,16*e);else{if(18>=e){var r=Je[16*e-1],a=N;i>>=2;for(var o=0;o<16*e;o+=16){var s=i+o;r[o]=a[s],r[o+1]=a[s+1],r[o+2]=a[s+2],r[o+3]=a[s+3],r[o+4]=a[s+4],r[o+5]=a[s+5],r[o+6]=a[s+6],r[o+7]=a[s+7],r[o+8]=a[s+8],r[o+9]=a[s+9],r[o+10]=a[s+10],r[o+11]=a[s+11],r[o+12]=a[s+12],r[o+13]=a[s+13],r[o+14]=a[s+14],r[o+15]=a[s+15]}}else r=N.subarray(i>>2,i+64*e>>2);dn.uniformMatrix4fv(Qe(t),!!n,r)}},Hc:function(t){t=Me[t],dn.useProgram(t),dn.Gf=t},Ic:function(t,e){dn.vertexAttrib1f(t,e)},Jc:function(t,e){dn.vertexAttrib2f(t,N[e>>2],N[e+4>>2])},Kc:function(t,e){dn.vertexAttrib3f(t,N[e>>2],N[e+4>>2],N[e+8>>2])},Lc:function(t,e){dn.vertexAttrib4f(t,N[e>>2],N[e+4>>2],N[e+8>>2],N[e+12>>2])},mc:function(t,e){dn.vertexAttribDivisor(t,e)},nc:function(t,e,n,i,r){dn.vertexAttribIPointer(t,e,n,i,r)},Mc:function(t,e,n,i,r,a){dn.vertexAttribPointer(t,e,n,!!i,r,a)},Nc:function(t,e,n,i){dn.viewport(t,e,n,i)},eb:function(t,e,n,i){dn.waitSync(Le[t],e,(n>>>0)+4294967296*i)},qb:function(t){var e=D.length;if(2147483648<(t>>>=0))return!1;for(var n=1;4>=n;n*=2){var i=e*(1+.2/n);i=Math.min(i,t+100663296),0<(i=Math.max(t,i))%65536&&(i+=65536-i%65536);t:{try{_.grow(Math.min(2147483648,i)-I.byteLength+65535>>>16),Q();var r=1;break t}catch(t){}r=void 0}if(r)return!0}return!1},ib:function(){return ze?ze.Vf:0},ub:function(t,e){var n=0;return nn().forEach((function(i,r){var a=e+n;for(r=W[t+4*r>>2]=a,a=0;a<i.length;++a)L[r++>>0]=i.charCodeAt(a);L[r>>0]=0,n+=i.length+1})),0},vb:function(t,e){var n=nn();W[t>>2]=n.length;var i=0;return n.forEach((function(t){i+=t.length+1})),W[e>>2]=i,0},Hb:function(t){T||0<nt||(e.onExit&&e.onExit(t),P=!0),g(t,new Pn(t))},G:function(){return 0},kb:function(t,e,n,i,r,a){return t=mt.Rf(t),e=mt.If(t,e,n,i),W[a>>2]=e,0},Ab:function(t,e,n,i){return t=mt.Rf(t),e=mt.If(t,e,n),W[i>>2]=e,0},lb:function(){},N:function(t,e,n,i){for(var r=0,a=0;a<n;a++){var o=W[e>>2],s=W[e+4>>2];e+=8;for(var l=0;l<s;l++){var c=D[o+l],u=gt[t];0===c||10===c?((1===t?b:S)(M(u,0)),u.length=0):u.push(c)}r+=s}return W[i>>2]=r,0},b:function(){return C},i:function(t,e){var n=Tn();try{return dt(t)(e)}catch(t){if(_n(n),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},n:function(t,e,n){var i=Tn();try{return dt(t)(e,n)}catch(t){if(_n(i),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},f:function(t,e,n,i){var r=Tn();try{return dt(t)(e,n,i)}catch(t){if(_n(r),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},C:function(t,e,n,i,r){var a=Tn();try{return dt(t)(e,n,i,r)}catch(t){if(_n(a),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},Mb:function(t,e,n,i,r,a){var o=Tn();try{return dt(t)(e,n,i,r,a)}catch(t){if(_n(o),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},U:function(t,e,n,i,r,a,o){var s=Tn();try{return dt(t)(e,n,i,r,a,o)}catch(t){if(_n(s),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},T:function(t,e,n,i,r,a,o,s,l,c){var u=Tn();try{return dt(t)(e,n,i,r,a,o,s,l,c)}catch(t){if(_n(u),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},I:function(t){var e=Tn();try{dt(t)()}catch(t){if(_n(e),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},m:function(t,e){var n=Tn();try{dt(t)(e)}catch(t){if(_n(n),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},s:function(t,e,n){var i=Tn();try{dt(t)(e,n)}catch(t){if(_n(i),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},h:function(t,e,n,i){var r=Tn();try{dt(t)(e,n,i)}catch(t){if(_n(r),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},q:function(t,e,n,i,r){var a=Tn();try{dt(t)(e,n,i,r)}catch(t){if(_n(a),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},Kb:function(t,e,n,i,r,a){var o=Tn();try{dt(t)(e,n,i,r,a)}catch(t){if(_n(o),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},Ib:function(t,e,n,i,r,a,o){var s=Tn();try{dt(t)(e,n,i,r,a,o)}catch(t){if(_n(s),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},Jb:function(t,e,n,i,r,a,o,s,l,c){var u=Tn();try{dt(t)(e,n,i,r,a,o,s,l,c)}catch(t){if(_n(u),t!==t+0&&"longjmp"!==t)throw t;Cn(1,0)}},c:function(t){C=t},nb:function(t,e,n,i){return cn(t,e,n,i)}};!function(){function t(t){e.asm=t.exports,_=e.asm.bd,Q(),Z=e.asm.dd,tt.unshift(e.asm.cd),at--,e.monitorRunDependencies&&e.monitorRunDependencies(at),0==at&&ot&&(t=ot,ot=null,t())}function n(e){t(e.instance)}function i(t){return function(){if(!A&&(m||y)){if("function"==typeof fetch&&!rt.startsWith("file://"))return fetch(rt,{credentials:"same-origin"}).then((function(t){if(!t.ok)throw"failed to load wasm binary file at '"+rt+"'";return t.arrayBuffer()})).catch((function(){return ut()}));if(l)return new Promise((function(t,e){l(rt,(function(e){t(new Uint8Array(e))}),e)}))}return Promise.resolve().then((function(){return ut()}))}().then((function(t){return WebAssembly.instantiate(t,a)})).then((function(t){return t})).then(t,(function(t){S("failed to asynchronously prepare wasm: "+t),st(t)}))}var a={a:mn};if(at++,e.monitorRunDependencies&&e.monitorRunDependencies(at),e.instantiateWasm)try{return e.instantiateWasm(a,t)}catch(t){return S("Module.instantiateWasm callback failed with error: "+t),!1}(A||"function"!=typeof WebAssembly.instantiateStreaming||lt()||rt.startsWith("file://")||"function"!=typeof fetch?i(n):fetch(rt,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,a).then(n,(function(t){return S("wasm streaming compile failed: "+t),S("falling back to ArrayBuffer instantiation"),i(n)}))}))).catch(r)}(),e.___wasm_call_ctors=function(){return(e.___wasm_call_ctors=e.asm.cd).apply(null,arguments)};var yn=e._malloc=function(){return(yn=e._malloc=e.asm.ed).apply(null,arguments)},vn=e._free=function(){return(vn=e._free=e.asm.fd).apply(null,arguments)},wn=e.___errno_location=function(){return(wn=e.___errno_location=e.asm.gd).apply(null,arguments)},bn=e.___getTypeName=function(){return(bn=e.___getTypeName=e.asm.hd).apply(null,arguments)};e.___embind_register_native_and_builtin_types=function(){return(e.___embind_register_native_and_builtin_types=e.asm.id).apply(null,arguments)};var Sn,An=e._memalign=function(){return(An=e._memalign=e.asm.jd).apply(null,arguments)},Cn=e._setThrew=function(){return(Cn=e._setThrew=e.asm.kd).apply(null,arguments)},Tn=e.stackSave=function(){return(Tn=e.stackSave=e.asm.ld).apply(null,arguments)},_n=e.stackRestore=function(){return(_n=e.stackRestore=e.asm.md).apply(null,arguments)};function Pn(t){this.name="ExitStatus",this.message="Program terminated with exit("+t+")",this.status=t}function xn(){function t(){if(!Sn&&(Sn=!0,e.calledRun=!0,!P)){if(ht(tt),i(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;){var t=e.postRun.shift();et.unshift(t)}ht(et)}}if(!(0<at)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)it();ht(J),0<at||(e.setStatus?(e.setStatus("Running..."),setTimeout((function(){setTimeout((function(){e.setStatus("")}),1),t()}),1)):t())}}if(e.dynCall_iiiji=function(){return(e.dynCall_iiiji=e.asm.nd).apply(null,arguments)},e.dynCall_ji=function(){return(e.dynCall_ji=e.asm.od).apply(null,arguments)},e.dynCall_iiji=function(){return(e.dynCall_iiji=e.asm.pd).apply(null,arguments)},e.dynCall_iijjiii=function(){return(e.dynCall_iijjiii=e.asm.qd).apply(null,arguments)},e.dynCall_iij=function(){return(e.dynCall_iij=e.asm.rd).apply(null,arguments)},e.dynCall_vijjjii=function(){return(e.dynCall_vijjjii=e.asm.sd).apply(null,arguments)},e.dynCall_viji=function(){return(e.dynCall_viji=e.asm.td).apply(null,arguments)},e.dynCall_vijiii=function(){return(e.dynCall_vijiii=e.asm.ud).apply(null,arguments)},e.dynCall_viiiiij=function(){return(e.dynCall_viiiiij=e.asm.vd).apply(null,arguments)},e.dynCall_jii=function(){return(e.dynCall_jii=e.asm.wd).apply(null,arguments)},e.dynCall_iiij=function(){return(e.dynCall_iiij=e.asm.xd).apply(null,arguments)},e.dynCall_iiiij=function(){return(e.dynCall_iiiij=e.asm.yd).apply(null,arguments)},e.dynCall_viij=function(){return(e.dynCall_viij=e.asm.zd).apply(null,arguments)},e.dynCall_viiij=function(){return(e.dynCall_viiij=e.asm.Ad).apply(null,arguments)},e.dynCall_vij=function(){return(e.dynCall_vij=e.asm.Bd).apply(null,arguments)},e.dynCall_jiiii=function(){return(e.dynCall_jiiii=e.asm.Cd).apply(null,arguments)},e.dynCall_jiiiiii=function(){return(e.dynCall_jiiiiii=e.asm.Dd).apply(null,arguments)},e.dynCall_jiiiiji=function(){return(e.dynCall_jiiiiji=e.asm.Ed).apply(null,arguments)},e.dynCall_iijj=function(){return(e.dynCall_iijj=e.asm.Fd).apply(null,arguments)},e.dynCall_jiji=function(){return(e.dynCall_jiji=e.asm.Gd).apply(null,arguments)},e.dynCall_viijii=function(){return(e.dynCall_viijii=e.asm.Hd).apply(null,arguments)},e.dynCall_iiiiij=function(){return(e.dynCall_iiiiij=e.asm.Id).apply(null,arguments)},e.dynCall_iiiiijj=function(){return(e.dynCall_iiiiijj=e.asm.Jd).apply(null,arguments)},e.dynCall_iiiiiijj=function(){return(e.dynCall_iiiiiijj=e.asm.Kd).apply(null,arguments)},ot=function t(){Sn||xn(),Sn||(ot=t)},e.run=xn,e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();return xn(),t.ready});t.exports=i}(O);const I=O.exports;class L{constructor(t){this.startTime=NaN,this.stopTime=NaN,this.stopped=!0,this.cumulativeElapsed=NaN,this.name=t}static now(){return window.performance.now()}static start(t){let e=this._timers.filter((e=>e.name===t)).find(Boolean);if(void 0===e)e=new L(t),e.cumulativeElapsed=0,this._timers.push(e);else if(0==e.stopped)throw new Error(`can't start timer. timer with name ${t} is already started`);e.startTime=window.performance.now(),e.stopped=!1}static stop(t){const e=this._timers.filter((e=>e.name===t)).find(Boolean);if(void 0===e)throw new Error(`can't stop timer. timer with name ${t} does not exist`);if(!0===e.stopped)throw new Error(`can't stop timer. timer with name ${t} is already stopped`);e.stopTime=window.performance.now(),e.cumulativeElapsed=e.cumulativeElapsed+e.stopTime-e.startTime,e.stopped=!0}static restart(t){const e=this._timers.filter((e=>e.name===t)).find(Boolean);if(void 0===e)throw new Error(`can't restart timer. timer with name ${t} does not exist`);e.startTime=window.performance.now(),e.cumulativeElapsed=0,e.stopped=!1}static elapsed(t){const e=this._timers.filter((e=>e.name===t)).find(Boolean);if(void 0===e)throw new Error(`can't get elapsed time. timer with name ${t} does not exist`);return e.stopped?e.cumulativeElapsed:e.cumulativeElapsed+window.performance.now()-e.startTime}static remove(t){if(void 0===this._timers.filter((e=>e.name===t)).find(Boolean))throw new Error(`can't remove timer. timer with name ${t} does not exist`);this._timers=this._timers.filter((e=>e.name!=t))}static removeAll(){this._timers=new Array}static exists(t){return this._timers.some((e=>e.name===t))}}L._timers=new Array;class D{static generate(){let t=(new Date).getTime(),e=performance&&performance.now&&1e3*performance.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(n=>{let i=16*Math.random();return t>0?(i=(t+i)%16|0,t=Math.floor(t/16)):(i=(e+i)%16|0,e=Math.floor(e/16)),("x"==n?i:7&i|8).toString(16)}))}}class G{constructor(t){this.uuid=D.generate(),this.options=t,this.fontManager=new F,this.imageManager=new m,this.options.activities.forEach((t=>t.session=this))}init(){var t;return u(this,void 0,void 0,(function*(){L.start("sessionInit"),this.options.activities.forEach((t=>t.init()));const[e]=yield this.getAsynchronousAssets();this.loadAssets(e),console.log(`Session.init() took ${L.elapsed("sessionInit").toFixed(0)} ms`),L.remove("sessionInit");const i=null===(t=this.options.sessionCallbacks)||void 0===t?void 0:t.onSessionLifecycleChange;i&&i({eventType:n.sessionLifecycle,initialized:!0,ended:!1})}))}start(){var t;this.currentActivity=this.options.activities.find(Boolean),this.logStartingActivity(),null===(t=this.currentActivity)||void 0===t||t.start()}end(){var t;const e=null===(t=this.options.sessionCallbacks)||void 0===t?void 0:t.onSessionLifecycleChange;e&&e({eventType:n.sessionLifecycle,initialized:!1,ended:!0})}advanceToNextActivity(){if(!this.currentActivity)throw new Error("error in advanceToNextActivity(): no current activity");if(!this.nextActivity)throw new Error("error in advanceToNextActivity(): no next activity");this.currentActivity.stop(),this.currentActivity=this.nextActivity,this.logStartingActivity(),this.currentActivity.start()}get nextActivity(){if(!this.currentActivity)throw new Error("error in get nextActivity(): no current activity");if(this.options.activities.indexOf(this.currentActivity)===this.options.activities.length-1)return;const t=this.options.activities.indexOf(this.currentActivity);return this.options.activities[t+1]}logStartingActivity(){if(this.currentActivity&&this.currentActivity.type==e.game){const t=this.currentActivity,e=t.options.version?`, version ${t.options.version}`:"";console.log(`starting game: ${t.options.name+e}`)}}getAsynchronousAssets(){return u(this,void 0,void 0,(function*(){const t=this.loadCanvasKit(),e=this.fontManager.fetchFonts(this.getFontsConfigurationFromGames()),n=this.imageManager.renderImages(this.getImagesConfigurationFromGames());return yield Promise.all([t,e,n])}))}loadCanvasKit(){return I({locateFile:t=>t})}loadAssets(t){this.assignCanvasKit(t),this.fontManager.loadAllGamesFontData(),this.imageManager.loadAllGamesRenderedImages()}assignCanvasKit(t){this.canvasKit=t,this.fontManager.canvasKit=this.canvasKit,this.imageManager.canvasKit=this.canvasKit,this.options.activities.filter((t=>t.type==e.game)).forEach((e=>{e.canvasKit=t}))}getFontsConfigurationFromGames(){return this.options.activities.filter((t=>t.type==e.game)).map((t=>{var e;const n=t;return{uuid:n.uuid,fontUrls:null!==(e=n.options.fontUrls)&&void 0!==e?e:[]}}))}getImagesConfigurationFromGames(){return this.options.activities.filter((t=>t.type==e.game)).map((t=>{var e;const n=t;return{uuid:n.uuid,images:null!==(e=n.options.images)&&void 0!==e?e:[]}}))}}var j,W,U,N,z,H,$;!function(t){t.topToTopOf="topToTopOf",t.topToBottomOf="topToBottomOf",t.bottomToTopOf="bottomToTopOf",t.bottomToBottomOf="bottomToBottomOf",t.startToStartOf="startToStartOf",t.startToEndOf="startToEndOf",t.endToEndOf="endToEndOf",t.endToStartOf="endToStartOf"}(j||(j={}));class V{constructor(t,e){this.verticalConstraint=!1,this.focalEntityMinimum=!1,this.alterEntityMinimum=!1,this.verticalTypes=[j.topToTopOf,j.topToBottomOf,j.bottomToTopOf,j.bottomToBottomOf],this.focalEntityMinimumTypes=[j.topToTopOf,j.topToBottomOf,j.startToStartOf,j.startToEndOf],this.alterEntityMinimumTypes=[j.topToTopOf,j.bottomToTopOf,j.startToStartOf,j.endToStartOf],this.type=t,this.alterEntity=e,this.verticalTypes.includes(t)?(this.verticalConstraint=!0,this.focalEntityMinimumTypes.includes(t)?this.focalEntityMinimum=!0:this.focalEntityMinimum=!1,this.alterEntityMinimumTypes.includes(t)?this.alterEntityMinimum=!0:this.alterEntityMinimum=!1):(this.verticalConstraint=!1,this.focalEntityMinimumTypes.includes(t)?this.focalEntityMinimum=!0:this.focalEntityMinimum=!1,this.alterEntityMinimumTypes.includes(t)?this.alterEntityMinimum=!0:this.alterEntityMinimum=!1)}}function Y(t,e){t.isDrawable&&function(t,e){e.anchorPoint&&(t.anchorPoint=e.anchorPoint),e.zPosition&&(t.zPosition=e.zPosition)}(t,e),t.isText&&function(t,e){e.text&&(t.text=e.text),e.fontName&&(t.fontName=e.fontName),e.fontColor&&(t.fontColor=e.fontColor),e.fontSize&&(t.fontSize=e.fontSize)}(t,e)}!function(t){t.entity="Entity",t.scene="Scene",t.sprite="Sprite",t.label="Label",t.textline="TextLine",t.shape="Shape",t.composite="Composite"}(W||(W={}));class q{constructor(t={}){this.type=W.entity,this.isDrawable=!1,this.isShape=!1,this.isText=!1,this.position={x:0,y:0},this.scale=1,this.isUserInteractionEnabled=!1,this.hidden=!1,this.layout={},this.children=new Array,this.absolutePosition={x:0,y:0},this.size={width:0,height:0},this.absoluteScale=1,this.actions=new Array,this.originalActions=new Array,this.eventListeners=new Array,this.uuid=D.generate(),this.needsInitialization=!0,this.userData={},this.loopMessages=new Set,this.toString=()=>this.name!==this.uuid?`"${this.name}" (${this.type}, ${this.uuid})`:`"${this.type} (${this.uuid})`,void 0===t.name?this.name=this.uuid:this.name=t.name,t.position&&(this.position=t.position),t.scale&&(this.scale=t.scale),t.isUserInteractionEnabled&&(this.isUserInteractionEnabled=t.isUserInteractionEnabled),t.hidden&&(this.hidden=t.hidden),t.layout&&(this.layout=t.layout)}initialize(){throw new Error("initialize() called in abstract base class Entity.")}addChild(t){if(t.type==W.scene)throw new Error("A scene cannot be the child of an entity. A scene can only be added to a game object");if(t.parent=this,this.children.map((t=>t.name)).includes(t.name))throw new Error(`Cannot add child entity ${t.toString()} to parent entity ${this.toString()}. A child with name "${t.name}" already exists on parent.`);this.children.push(t)}removeAllChildren(){for(;this.children.length;)this.children.pop()}removeChild(t){if(!this.children.includes(t))throw new Error(`cannot remove entity ${t} from parent ${this} because the entity is not currently a child of the parent`);this.children=this.children.filter((t=>t!=t))}descendant(t){const e=this.descendants.filter((e=>e.name===t)).find(Boolean);if(void 0===e)throw new Error(`descendant with name ${t} not found on parent ${this.toString()}`);return e}get descendants(){function t(e,n){n.push(e),e.children.forEach((e=>t(e,n)))}const e=new Array;return this.children.forEach((n=>t(n,e))),e}onTapDown(t,e=!0){const n={eventType:"tapdown",entityName:this.name,callback:t};e&&(this.eventListeners=this.eventListeners.filter((t=>t.entityName!==n.entityName))),this.eventListeners.push(n)}parseLayoutConstraints(t,e){const n=new Array;return Object.values(j).forEach((i=>{if(void 0!==t[i]){let r,a="";if(t[i]instanceof q)r=t[i];else{const n=t[i];r=e.filter((t=>t.name===n)).find(Boolean),a=`. sibling entity named "${n}" has not been added to the game object`}if(void 0===r)throw new Error("could not find sibling entity for constraint"+a);const o=new V(i,r);n.push(o)}})),n}calculateYFromConstraint(t,e,n,i){let r=t.alterEntity.absolutePosition.y;return t.alterEntityMinimum?t.alterEntity.type!==W.scene&&(r-=.5*t.alterEntity.size.height*i):t.alterEntity.type!==W.scene?r+=.5*t.alterEntity.size.height*i:r+=t.alterEntity.size.height*i,t.focalEntityMinimum?(r+=.5*this.size.height*i,r+=e*i):(r-=.5*this.size.height*i,r-=n*i),r}calculateXFromConstraint(t,e,n,i){let r=t.alterEntity.absolutePosition.x;return t.alterEntityMinimum?t.alterEntity.type!==W.scene&&(r-=.5*t.alterEntity.size.width*i):t.alterEntity.type!==W.scene?r+=.5*t.alterEntity.size.width*i:r+=t.alterEntity.size.width*i,t.focalEntityMinimum?(r+=.5*this.size.width*i,r+=e*i):(r-=.5*this.size.width*i,r-=n*i),r}update(){var t,e,n,r,a,o,s,l,c,u,h,d,f,p,g,m;if(this.needsInitialization&&(this.initialize(),this.needsInitialization=!1),void 0===this.parent)this.absolutePosition.x=this.position.x*this.scale,this.absolutePosition.y=this.position.y*this.scale,this.absoluteScale=this.scale;else if(this.absoluteScale=this.parent.absoluteScale*this.scale,void 0===(null===(t=this.layout)||void 0===t?void 0:t.constraints))this.absolutePosition.x=this.parent.absolutePosition.x+this.position.x*this.parent.absoluteScale,this.absolutePosition.y=this.parent.absolutePosition.y+this.position.y*this.parent.absoluteScale;else{const t=null!==(r=null===(n=null===(e=this.layout)||void 0===e?void 0:e.constraints)||void 0===n?void 0:n.horizontalBias)&&void 0!==r?r:.5,i=null!==(s=null===(o=null===(a=this.layout)||void 0===a?void 0:a.constraints)||void 0===o?void 0:o.verticalBias)&&void 0!==s?s:.5,y=null!==(c=null===(l=this.layout)||void 0===l?void 0:l.marginTop)&&void 0!==c?c:0,v=null!==(h=null===(u=this.layout)||void 0===u?void 0:u.marginBottom)&&void 0!==h?h:0,w=null!==(f=null===(d=this.layout)||void 0===d?void 0:d.marginStart)&&void 0!==f?f:0,b=null!==(g=null===(p=this.layout)||void 0===p?void 0:p.marginEnd)&&void 0!==g?g:0,S=this.parseLayoutConstraints(null===(m=this.layout)||void 0===m?void 0:m.constraints,this.parentSceneAsEntity.descendants),A=this.parent.absoluteScale,C=S.filter((t=>t.verticalConstraint)).map((t=>this.calculateYFromConstraint(t,y,v,A)));0===C.length||(1===C.length?this.absolutePosition.y=C[0]:2===C.length&&(this.absolutePosition.y=Math.min(C[0],C[1])+i*Math.abs(C[0]-C[1])));const T=S.filter((t=>!t.verticalConstraint)).map((t=>this.calculateXFromConstraint(t,w,b,A)));0===T.length||(1===T.length?this.absolutePosition.x=T[0]:2===T.length&&(this.absolutePosition.x=Math.min(T[0],T[1])+t*Math.abs(T[0]-T[1])))}const y=this.actions.filter((t=>t.runDuringTransition&&!t.completed)),v=this.actions.filter((t=>!t.runDuringTransition&&!t.completed));y.length>0?(y.forEach((t=>{-1===t.runStartTime&&(t.runStartTime=Globals.now)})),y.forEach((t=>i.evaluateAction(t,this,Globals.now,Globals.deltaTime)))):v.length>0&&(v.forEach((t=>{-1===t.runStartTime&&(t.runStartTime=Globals.now)})),v.forEach((t=>i.evaluateAction(t,this,Globals.now,Globals.deltaTime))));const w=new Map;this.children.forEach((t=>{var e;w.set(t.uuid,function(t,e){const n=new Array;return void 0===e||Object.values(j).forEach((i=>{if(void 0!==e[i]){let r,a="";if(e[i]instanceof q)r=e[i];else{const n=e[i];let o;o=t.type===W.scene?t.descendants:t.parentSceneAsEntity.descendants,r=o.filter((t=>t.name===n)).find(Boolean),void 0===r&&(a=`. sibling entity named "${n}" has not been added to the game object`)}if(void 0===r)throw new Error("error getting uuid of sibling contraint"+a);r!==t&&n.push(r.uuid)}})),n}(this,null===(e=t.layout)||void 0===e?void 0:e.constraints))}));const b=this.findTopologicalSort(w);if(b.length>0){const t=b.reverse(),e=new Array;t.forEach((t=>{const n=this.children.filter((e=>e.uuid===t)).find(Boolean);if(void 0===n)throw new Error("error in dag topological sort");e.push(n)})),e.forEach((t=>t.update()))}else this.children.forEach((t=>t.update()))}drawChildren(t){this.children.filter((t=>!t.hidden&&t.isDrawable)).map((t=>t)).sort(((t,e)=>t.zPosition-e.zPosition)).forEach((e=>e.draw(t)))}run(t,e){this.actions.push(...t.initialize(this,e)),this.originalActions=this.actions.filter((t=>!1===t.runDuringTransition)).map((t=>i.cloneAction(t,e)))}removeAction(t){this.actions=this.actions.filter((e=>e.key!==t))}removeAllActions(){for(;this.actions.length;)this.actions.pop()}getEntityOptions(){return{name:this.name,position:this.position,scale:this.scale,isUserInteractionEnabled:this.isUserInteractionEnabled,hidden:this.hidden}}getDrawableOptions(){if(!this.isDrawable)throw new Error("getDrawableOptions() called object that is not IDrawable");return{anchorPoint:this.anchorPoint,zPosition:this.zPosition}}getTextOptions(){if(!this.isText)throw new Error("getTextOptions() called object that is not IText");return{text:this.text,fontName:this.fontName,fontColor:this.fontColor,fontSize:this.fontSize}}get canvasKit(){let t;return t=this.type===W.scene?this:this.parentSceneAsEntity,t.game.canvasKit}get parentSceneAsEntity(){if(this.type===W.scene)throw new Error(`Entity ${this} is a scene and cannot have a parent scene`);if(this.parent&&this.parent.type===W.scene)return this.parent;if(this.parent)return this.parent.parentSceneAsEntity;throw new Error(`Entity ${this} has not been added to a scene`)}findTopologicalSort(t){var e;const n=[],i=new Map;t.forEach(((t,e)=>{i.has(e)||i.set(e,0),t.forEach((t=>{i.has(t)?i.set(t,i.get(t)+1):i.set(t,1)}))}));const r=[];for(i.forEach(((t,e)=>{0==t&&r.push(e)}));r.length>0;){const a=r.shift();if(void 0===a)throw"bad";n.push(a),t.has(a)&&(null===(e=t.get(a))||void 0===e||e.forEach((t=>{if(i.has(t)&&i.get(t)>0){const e=i.get(t)-1;i.set(t,e),0==e&&r.push(t)}})))}return n}}class X extends q{constructor(t={}){super(t),this.type=W.composite,this.compositeType="<compositeType>",this.isDrawable=!0,this.anchorPoint={x:.5,y:.5},this.zPosition=0,Y(this,t)}initialize(){}update(){super.update()}draw(t){super.drawChildren(t)}}class K{}K.Transparent=[0,0,0,0],K.MediumVioletRed=[199,21,133,1],K.DeepPink=[255,20,147,1],K.PaleVioletRed=[219,112,147,1],K.HotPink=[255,105,180,1],K.LightPink=[255,182,193,1],K.Pink=[255,192,203,1],K.DarkRed=[139,0,0,1],K.Red=[255,0,0,1],K.Firebrick=[178,34,34,1],K.Crimson=[220,20,60,1],K.IndianRed=[205,92,92,1],K.LightCoral=[240,128,128,1],K.Salmon=[250,128,114,1],K.DarkSalmon=[233,150,122,1],K.LightSalmon=[255,160,122,1],K.OrangeRed=[255,69,0,1],K.Tomato=[255,99,71,1],K.DarkOrange=[255,140,0,1],K.Coral=[255,127,80,1],K.Orange=[255,165,0,1],K.DarkKhaki=[189,183,107,1],K.Gold=[255,215,0,1],K.Khaki=[240,230,140,1],K.PeachPuff=[255,218,185,1],K.Yellow=[255,255,0,1],K.PaleGoldenrod=[238,232,170,1],K.Moccasin=[255,228,181,1],K.PapayaWhip=[255,239,213,1],K.LightGoldenrodYellow=[250,250,210,1],K.LemonChiffon=[255,250,205,1],K.LightYellow=[255,255,224,1],K.Maroon=[128,0,0,1],K.Brown=[165,42,42,1],K.SaddleBrown=[139,69,19,1],K.Sienna=[160,82,45,1],K.Chocolate=[210,105,30,1],K.DarkGoldenrod=[184,134,11,1],K.Peru=[205,133,63,1],K.RosyBrown=[188,143,143,1],K.Goldenrod=[218,165,32,1],K.SandyBrown=[244,164,96,1],K.Tan=[210,180,140,1],K.Burlywood=[222,184,135,1],K.Wheat=[245,222,179,1],K.NavajoWhite=[255,222,173,1],K.Bisque=[255,228,196,1],K.BlanchedAlmond=[255,235,205,1],K.Cornsilk=[255,248,220,1],K.DarkGreen=[0,100,0,1],K.Green=[0,128,0,1],K.DarkOliveGreen=[85,107,47,1],K.ForestGreen=[34,139,34,1],K.SeaGreen=[46,139,87,1],K.Olive=[128,128,0,1],K.OliveDrab=[107,142,35,1],K.MediumSeaGreen=[60,179,113,1],K.LimeGreen=[50,205,50,1],K.Lime=[0,255,0,1],K.SpringGreen=[0,255,127,1],K.MediumSpringGreen=[0,250,154,1],K.DarkSeaGreen=[143,188,143,1],K.MediumAquamarine=[102,205,170,1],K.YellowGreen=[154,205,50,1],K.LawnGreen=[124,252,0,1],K.Chartreuse=[127,255,0,1],K.LightGreen=[144,238,144,1],K.GreenYellow=[173,255,47,1],K.PaleGreen=[152,251,152,1],K.Teal=[0,128,128,1],K.DarkCyan=[0,139,139,1],K.LightSeaGreen=[32,178,170,1],K.CadetBlue=[95,158,160,1],K.DarkTurquoise=[0,206,209,1],K.MediumTurquoise=[72,209,204,1],K.Turquoise=[64,224,208,1],K.Aqua=[0,255,255,1],K.Cyan=[0,255,255,1],K.Aquamarine=[127,255,212,1],K.PaleTurquoise=[175,238,238,1],K.LightCyan=[224,255,255,1],K.Navy=[0,0,128,1],K.DarkBlue=[0,0,139,1],K.MediumBlue=[0,0,205,1],K.Blue=[0,0,255,1],K.MidnightBlue=[25,25,112,1],K.RoyalBlue=[65,105,225,1],K.SteelBlue=[70,130,180,1],K.DodgerBlue=[30,144,255,1],K.DeepSkyBlue=[0,191,255,1],K.CornflowerBlue=[100,149,237,1],K.SkyBlue=[135,206,235,1],K.LightSkyBlue=[135,206,250,1],K.LightSteelBlue=[176,196,222,1],K.LightBlue=[173,216,230,1],K.PowderBlue=[176,224,230,1],K.Indigo=[75,0,130,1],K.Purple=[128,0,128,1],K.DarkMagenta=[139,0,139,1],K.DarkViolet=[148,0,211,1],K.DarkSlateBlue=[72,61,139,1],K.BlueViolet=[138,43,226,1],K.DarkOrchid=[153,50,204,1],K.Fuchsia=[255,0,255,1],K.Magenta=[255,0,255,1],K.SlateBlue=[106,90,205,1],K.MediumSlateBlue=[123,104,238,1],K.MediumOrchid=[186,85,211,1],K.MediumPurple=[147,112,219,1],K.Orchid=[218,112,214,1],K.Violet=[238,130,238,1],K.Plum=[221,160,221,1],K.Thistle=[216,191,216,1],K.Lavender=[230,230,250,1],K.MistyRose=[255,228,225,1],K.AntiqueWhite=[250,235,215,1],K.Linen=[250,240,230,1],K.Beige=[245,245,220,1],K.WhiteSmoke=[245,245,245,1],K.LavenderBlush=[255,240,245,1],K.OldLace=[253,245,230,1],K.AliceBlue=[240,248,255,1],K.Seashell=[255,245,238,1],K.GhostWhite=[248,248,255,1],K.Honeydew=[240,255,240,1],K.FloralWhite=[255,250,240,1],K.Azure=[240,255,255,1],K.MintCream=[245,255,250,1],K.Snow=[255,250,250,1],K.Ivory=[255,255,240,1],K.White=[255,255,255,1],K.Black=[0,0,0,1],K.DarkSlateGray=[47,79,79,1],K.DimGray=[105,105,105,1],K.SlateGray=[112,128,144,1],K.Gray=[128,128,128,1],K.LightSlateGray=[119,136,153,1],K.DarkGray=[169,169,169,1],K.Silver=[192,192,192,1],K.LightGray=[211,211,211,1],K.Gainsboro=[220,220,220,1],K.RebeccaPurple=[102,51,153,1];class Q{}Q.FPS_DISPLAY_TEXT_FONT_SIZE=12,Q.FPS_DISPLAY_TEXT_COLOR=[0,0,0,.5],Q.FPS_DISPLAY_UPDATE_INTERVAL=500,Q.DEFAULT_SCENE_BACKGROUND_COLOR=K.White,Q.DEFAULT_SHAPE_FILL_COLOR=K.Red,Q.DEFAULT_FONT_COLOR=K.Black,Q.DEFAULT_FONT_SIZE=16,Q.LIMITED_FPS_RATE=5,function(t){t[t.MATCH_CONSTRAINT=0]="MATCH_CONSTRAINT"}(U||(U={}));class Z extends q{constructor(t={}){super(t),this.type=W.sprite,this.isDrawable=!0,this.anchorPoint={x:.5,y:.5},this.zPosition=0,this._imageName="",Y(this,t),t.imageName&&(this.imageName=t.imageName)}initialize(){const t=this.parentSceneAsEntity.game.session;if(!t)throw new Error("activity is undefined");const e=t.imageManager,n=this.parentSceneAsEntity.game.uuid;if(this.loadedImage=e.getLoadedImage(n,this._imageName),!this.loadedImage)throw new Error(`could not create sprite. the image named ${this._imageName} has not been loaded`);this.size.width=this.loadedImage.width,this.size.height=this.loadedImage.height}set imageName(t){this._imageName=t,this.needsInitialization=!0}get imageName(){return this._imageName}duplicate(t){const e=new Z(Object.assign(Object.assign(Object.assign({},this.getEntityOptions()),this.getDrawableOptions()),{imageName:this.imageName,name:t}));return this.children.length>0&&(e.children=this.children.map((t=>{const n=t.duplicate();return n.parent=e,n}))),e}update(){super.update()}draw(t){if(!this.hidden){if(this.loadedImage){t.save();const e=Globals.canvasScale/this.absoluteScale;t.scale(1/e,1/e);const n=(this.absolutePosition.x-this.size.width*this.anchorPoint.x*this.absoluteScale)*e,i=(this.absolutePosition.y-this.size.height*this.anchorPoint.y*this.absoluteScale)*e;t.drawImage(this.loadedImage.image,n,i),t.restore()}super.drawChildren(t)}}}class J extends q{constructor(t={}){super(t),this.type=W.scene,this.isDrawable=!0,this.anchorPoint={x:0,y:0},this.zPosition=0,this._backgroundColor=Q.DEFAULT_SCENE_BACKGROUND_COLOR,this._active=!1,this._transitioning=!1,Y(this,t),t.backgroundColor&&(this.backgroundColor=t.backgroundColor)}initialize(){this.scale=Globals.rootScale,this.size.width=this.game.canvasCssWidth,this.size.height=this.game.canvasCssHeight,this.backgroundPaint=new this.canvasKit.Paint,this.backgroundPaint.setColor(this.canvasKit.Color(this.backgroundColor[0],this.backgroundColor[1],this.backgroundColor[2],this.backgroundColor[3])),this.backgroundPaint.setStyle(this.canvasKit.PaintStyle.Fill)}set game(t){this._game=t}get game(){if(void 0===this._game)throw new Error("no active game");return this._game}get backgroundColor(){return this._backgroundColor}set backgroundColor(t){this._backgroundColor=t,this.needsInitialization=!0}duplicate(t){const e=new J(Object.assign(Object.assign(Object.assign({},this.getEntityOptions()),this.getDrawableOptions()),{backgroundColor:this.backgroundColor,name:t}));return e.game=this.game,this.children.length>0&&(e.children=this.children.map((t=>{const n=t.duplicate();return n.parent=e,n}))),e}onSetup(t){this._setupCallback=t}onAppear(t){this._appearCallback=t}draw(t){t.save();const e=Globals.canvasScale/this.absoluteScale;t.scale(1/e,1/e);const n=this.canvasKit.RRectXY(this.canvasKit.LTRBRect(this.position.x*e*Globals.rootScale,this.position.y*e*Globals.rootScale,(this.position.x+this.size.width)*e*Globals.rootScale,(this.position.y+this.size.height)*e*Globals.rootScale),0,0);t.drawRRect(n,this.backgroundPaint),t.restore(),super.drawChildren(t)}}class tt{constructor(){this.duration=0}static push(t,e){return new et(t,e)}}class et extends tt{constructor(t,e){super(),this.type=N.push,this.direction=t,this.duration=e}}!function(t){t.push="Push"}(N||(N={})),function(t){t.up="Up",t.down="Down",t.right="Right",t.left="Left"}(z||(z={}));class nt{constructor(t,e){this.scene=t,this.transition=e}}class it{constructor(t){this.type=e.game,this.uuid=D.generate(),this.data={trials:new Array,metadata:{}},this.trialIndex=0,this.drawnFrames=0,this.lastFpsUpdate=0,this.nextFpsUpdate=0,this.fps=0,this.animationFramesRequested=0,this.limitFps=!1,this.unitTesting=!1,this.gameStopRequested=!1,this.canvasCssWidth=0,this.canvasCssHeight=0,this.scenes=new Array,this.incomingSceneTransitions=new Array,this.options=t,this.name=t.name}init(){}setParameters(t){const{parameters:e}=this.options;Object.keys(t).forEach((n=>{e&&n in e?this.options.parameters&&this.options.parameters[n]&&(this.options.parameters[n].value=t[n]):console.warn(`game ${this.options.name} does not have a parameter named ${n}. attempt to set parameter ${n} to value ${t[n]} will be ignored`)}))}get canvasKit(){if(!this._canvasKit)throw new Error("canvaskit is undefined");return this._canvasKit}set canvasKit(t){this._canvasKit=t}get session(){if(!this._session)throw new Error("session is undefined");return this._session}set session(t){this._session=t}addScene(t){t.game=this,t.needsInitialization=!0,this.scenes.push(t)}addScenes(t){t.forEach((t=>{this.addScene(t)}))}presentScene(t,e){let n;if("string"==typeof t){if(n=this.scenes.filter((e=>e.name===t)).find(Boolean),void 0===n)throw new Error(`scene ${t} not found`)}else{if(!this.scenes.some((e=>e===t)))throw new Error(`scene ${t} exists, but it has not been added to the game object`);n=t}n.initialize(),n.needsInitialization=!1;const i=new nt(n,e);this.currentSceneSnapshot=void 0,this.incomingSceneTransitions.push(i),void 0!==n.game.bodyBackgroundColor?document.body.style.backgroundColor=`rgb(${n.game.bodyBackgroundColor[0]},${n.game.bodyBackgroundColor[1]},${n.game.bodyBackgroundColor[2]},${n.game.bodyBackgroundColor[3]})`:document.body.style.backgroundColor=`rgb(${n.backgroundColor[0]},${n.backgroundColor[1]},${n.backgroundColor[2]},${n.backgroundColor[3]})`}getParameter(t){if(void 0!==this.options.parameters&&Object.keys(this.options.parameters).includes(t))return this.options.parameters[t].value;throw new Error(`game parameter ${t} not found`)}start(t){var e,n;const i=this.options;let r;if(this.unitTesting=null!==(e=i._unitTesting)&&void 0!==e&&e,this.setupHtmlCanvases(i.canvasId,i.width,i.height,i.stretch),this.showFps=null!==(n=i.showFps)&&void 0!==n&&n,this.bodyBackgroundColor=i.bodyBackgroundColor,this.initData(),this.setupCanvasKitSurface(),this.setupFpsFont(),this.setupEventHandlers(),void 0!==t){if(t instanceof J)r=t;else if(r=r=this.scenes.filter((e=>e.name===t)).find(Boolean),void 0===r)throw new Error(`cannot start game. scene named "${t}" has not been added to the game object`)}else{if(void 0===this.entryScene)throw new Error("cannot start game. the game object's entryScene has not been assigned");if(this.entryScene instanceof J)r=this.entryScene;else if(r=r=this.scenes.filter((t=>t.name===this.entryScene)).find(Boolean),void 0===r)throw new Error(`cannot start game. scene named "${t}" has not been added to the game object`)}if(this.presentScene(r),void 0===this.surface)throw new Error("CanvasKit surface is undefined");this.surface.requestAnimationFrame(this.loop.bind(this))}stop(){this.currentScene&&(this.currentScene._active=!1),this.gameStopRequested=!0}initData(){var t;this.trialIndex=0,this.data={trials:new Array,metadata:{userAgent:navigator.userAgent,devicePixelRatio:window.devicePixelRatio,screen:this.getScreenMetadata()}};const e=null!==(t=this.options.trialSchema)&&void 0!==t?t:{},n=Object.entries(e),i=["number","string","boolean","object","array"];for(const[t,e]of n)if(!i.includes(e.type))throw new Error(`invalid schema. variable ${t} is type ${e.type}. type must be number, string, boolean, object, or array`)}getScreenMetadata(){const t=window.screen;return t.orientation?{availHeight:t.availHeight,availWidth:t.availWidth,colorDepth:t.colorDepth,height:t.height,orientation:{type:t.orientation.type,angle:t.orientation.angle},pixelDepth:t.pixelDepth,width:t.width}:{availHeight:t.availHeight,availWidth:t.availWidth,colorDepth:t.colorDepth,height:t.height,pixelDepth:t.pixelDepth,width:t.width}}addTrialData(t,e){if(!this.options.trialSchema)throw new Error("no trial schema were provided in GameOptions. cannot add trial data");if(this.data.trials.length<this.trialIndex+1){const t={},e=Object.entries(this.options.trialSchema);for(const[n]of e)t[n]=null;this.data.trials.push(t)}if(!(t in this.options.trialSchema))throw new Error(`trial variable ${t} not defined in schema`);const n=this.options.trialSchema[t].type;let i=typeof e;if("object"===i&&"[object Array]"===Object.prototype.toString.call(e)&&(i="array"),i!==n)throw new Error(`type for variable ${t} (value: ${e}) is "${i}". Based on schema for this variable, expected type was "${n}"`);this.data.trials[this.trialIndex][t]=e}trialComplete(){var t,e;if(this.trialIndex++,this.data.metadata.screen=this.getScreenMetadata(),this.data.metadata.devicePixelRatio=window.devicePixelRatio,null===(t=this.session.options.activityCallbacks)||void 0===t?void 0:t.onActivityDataCreate){const t={description:`a single completed trial from the assessment ${this.name}`,type:"object",properties:this.options.trialSchema},i={description:`all trial and metadata from the assessment ${this.name}`,type:"object",required:["trials","metadata"],properties:{trials:{type:"array",items:{$ref:"#/$defs/trial"}},metadata:{type:"object"}},$defs:{trial:{type:"object",properties:this.options.trialSchema}}};this.session.options.activityCallbacks.onActivityDataCreate({eventType:n.activityData,uuid:this.uuid,name:this.options.name,newData:this.data.trials[this.trialIndex-1],newDataSchema:t,data:this.data,dataSchema:i,activityConfiguration:null!==(e=this.options.parameters)&&void 0!==e?e:{}})}}end(){var t;(null===(t=this.session.options.activityCallbacks)||void 0===t?void 0:t.onActivityLifecycleChange)&&this.session.options.activityCallbacks.onActivityLifecycleChange({eventType:n.activityLifecycle,ended:!0,uuid:this.uuid,name:this.options.name})}setupHtmlCanvases(t,e,n,i){let r;if(Globals.canvasScale=Math.round(100*window.devicePixelRatio)/100,void 0===t){const t=document.getElementsByTagName("canvas");let e=new Array;for(let n=0;n<t.length;n++)e.push(t[n]);if(e=e.filter((t=>"m2c2kitscratchcanvas"!==t.id)),0===e.length)throw new Error("no html canvas tag was found in the html");e.length>1&&console.warn("warning: more than one html canvas was found. Using the first one"),r=t[0]}else if(r=document.getElementById(t),void 0===r)throw new Error(`could not find canvas HTML element with id "${t}"`);if(i||window.innerWidth<e||window.innerHeight<n){const t=n/e,i=window.innerHeight/window.innerWidth;Globals.rootScale=i<t?window.innerHeight/n:window.innerWidth/e}r.style.width=Globals.rootScale*e+"px",r.style.height=Globals.rootScale*n+"px",r.width=Globals.rootScale*e*Globals.canvasScale,r.height=Globals.rootScale*n*Globals.canvasScale,this.htmlCanvas=r,this.canvasCssWidth=e,this.canvasCssHeight=n,Globals.canvasCssWidth=e,Globals.canvasCssHeight=n}setupCanvasKitSurface(){if(void 0===this.htmlCanvas)throw new Error("main html canvas is undefined");const t=this.canvasKit.MakeCanvasSurface(this.htmlCanvas);if(null===t)throw new Error("could not make CanvasKit surface from canvas HTML element");this.surface=t,console.log("CanvasKit surface is backed by "+(this.surface.reportBackendTypeIsGPU()?"GPU":"CPU")),this.surface.getCanvas().scale(Globals.canvasScale,Globals.canvasScale)}setupFpsFont(){this.fpsTextFont=new this.canvasKit.Font(null,Q.FPS_DISPLAY_TEXT_FONT_SIZE*Globals.canvasScale),this.fpsTextPaint=new this.canvasKit.Paint,this.fpsTextPaint.setColor(this.canvasKit.Color(Q.FPS_DISPLAY_TEXT_COLOR[0],Q.FPS_DISPLAY_TEXT_COLOR[1],Q.FPS_DISPLAY_TEXT_COLOR[2],Q.FPS_DISPLAY_TEXT_COLOR[3])),this.fpsTextPaint.setAntiAlias(!0)}setupEventHandlers(){if(void 0===this.htmlCanvas)throw new Error("main html canvas is undefined");this.htmlCanvas.addEventListener("mousedown",this.htmlCanvasMouseDownHandler.bind(this)),this.htmlCanvas.addEventListener("touchstart",this.htmlCanvasTouchStartHandler.bind(this))}loop(t){if(!this.gameStopRequested){if(this.animationFramesRequested++,!this.limitFps||this.animationFramesRequested%Math.round(60/Q.LIMITED_FPS_RATE)==0){if(void 0===this.currentScene&&0===this.incomingSceneTransitions.length)throw new Error("Can not run game without a current or incoming scene");this.updateGameTime(),this.handleIncomingSceneTransitions(this.incomingSceneTransitions),this.update(),this.draw(t),this.incomingSceneTransitions.length>0&&(this.currentSceneSnapshot=this.takeCurrentSceneSnapshot()),this.pendingScreenshot&&(this.handlePendingScreenshot(this.pendingScreenshot),this.pendingScreenshot=void 0)}if(this.priorUpdateTime=Globals.now,void 0===this.surface)throw new Error("CanvasKit surface is undefined");this.surface.requestAnimationFrame(this.loop.bind(this))}}updateGameTime(){Globals.now=window.performance.now(),this.priorUpdateTime?Globals.deltaTime=Globals.now-this.priorUpdateTime:Globals.deltaTime=0}handleIncomingSceneTransitions(t){if(t.length>0&&this.currentSceneSnapshot){const e=t.shift();if(void 0===e)throw new Error("no incoming scene transition");const n=e.scene,i=e.transition,r=this.currentSceneSnapshot;if(!r)throw new Error("no outgoing scene image");const a=new J({name:"outgoingScene"});a.size.width=this.canvasCssWidth,a.size.height=this.canvasCssHeight,this.addScene(a),r||console.log("outgoingSceneImage is undefined/null");const o=new d("outgoingSceneSnapshot",r,this.canvasCssWidth,this.canvasCssHeight);this.session.imageManager.addLoadedImage(o,this.uuid);const s=new Z({name:"outgoingSceneSprite",imageName:"outgoingSceneSnapshot",position:{x:this.canvasCssWidth/Globals.rootScale/2,y:this.canvasCssHeight/Globals.rootScale/2}});s.scale=1/Globals.rootScale,a.addChild(s),a._active=!0,n!==this.currentScene&&this.currentScene&&(this.currentScene._active=!1),this.currentScene=n,this.currentScene._active=!0,n._setupCallback&&n._setupCallback(n),a&&n&&(i?this.animateSceneTransition(n,i,a):a._active=!1),a&&i||n._appearCallback&&n._appearCallback(n)}}update(){this.scenes.filter((t=>t._active)).forEach((t=>t.update()))}draw(t){this.scenes.filter((t=>t._active)).forEach((e=>e.draw(t))),this.drawnFrames++,this.showFps&&this.drawFps(t)}takeCurrentSceneSnapshot(){if(void 0===this.surface)throw new Error("CanvasKit surface is undefined");return this.surface.makeImageSnapshot()}handlePendingScreenshot(t){if(!this.surface)throw new Error("no surface");let e;if(4==t.rect.length){const n=t.rect[0]*Globals.canvasScale,i=t.rect[1]*Globals.canvasScale,r=[n,i,n+t.rect[2]*Globals.canvasScale,i+t.rect[3]*Globals.canvasScale];e=this.surface.makeImageSnapshot(r)}else e=this.surface.makeImageSnapshot();const n=e.encodeToBytes();t.promiseResolve(n)}takeScreenshot(t,e,n,i){if(!this.surface)throw new Error("no canvaskit surface. unable to take screenshot.");const r=[t,e,n,i].map((t=>t?0:1)).reduce(((t,e)=>t+e));return new Promise(((a,o)=>{switch(r){case 0:if(!(t&&e&&n&&i))return void o("missing values in arguments for takeScreenshot()");this.pendingScreenshot={rect:[t,e,n,i],promiseResolve:a};break;case 4:this.pendingScreenshot={rect:[],promiseResolve:a};break;default:o("Exactly 0 or 4 arguments must be supplied to takeScreenshot()")}}))}animateSceneTransition(t,e,n){const r=e.duration;switch(t._transitioning=!0,n._transitioning=!0,e.type){case N.push:switch(e.direction){case z.left:t.position.x=t.size.width,t.run(i.Sequence([i.Move({point:{x:0,y:0},duration:r,runDuringTransition:!0}),i.Custom({callback:()=>{t._transitioning=!1,t._appearCallback&&t._appearCallback(t)},runDuringTransition:!0})])),n.run(i.Sequence([i.Move({point:{x:-n.size.width,y:0},duration:r,runDuringTransition:!0}),i.Custom({callback:()=>{n._active=!1,n._transitioning=!1,n.game.currentSceneSnapshot&&n.game.currentSceneSnapshot.delete()},runDuringTransition:!0})]));break;case z.right:t.position.x=-t.size.width,t.run(i.Sequence([i.Move({point:{x:0,y:0},duration:r,runDuringTransition:!0}),i.Custom({callback:()=>{t._transitioning=!1,t._appearCallback&&t._appearCallback(t)},runDuringTransition:!0})])),n.run(i.Sequence([i.Move({point:{x:n.size.width,y:0},duration:r,runDuringTransition:!0}),i.Custom({callback:()=>{n._active=!1,n._transitioning=!1,n.game.currentSceneSnapshot&&n.game.currentSceneSnapshot.delete()},runDuringTransition:!0})]));break;case z.up:t.position.y=t.size.height,t.run(i.Sequence([i.Move({point:{x:0,y:0},duration:r,runDuringTransition:!0}),i.Custom({callback:()=>{t._transitioning=!1,t._appearCallback&&t._appearCallback(t)},runDuringTransition:!0})])),n.run(i.Sequence([i.Move({point:{x:0,y:-n.size.height},duration:r,runDuringTransition:!0}),i.Custom({callback:()=>{n._active=!1,n._transitioning=!1,n.game.currentSceneSnapshot&&n.game.currentSceneSnapshot.delete()},runDuringTransition:!0})]));break;case z.down:t.position.y=-t.size.height,t.run(i.Sequence([i.Move({point:{x:0,y:0},duration:r,runDuringTransition:!0}),i.Custom({callback:()=>{t._transitioning=!1,t._appearCallback&&t._appearCallback(t)},runDuringTransition:!0})])),n.run(i.Sequence([i.Move({point:{x:0,y:n.size.height},duration:r,runDuringTransition:!0}),i.Custom({callback:()=>{n._active=!1,n._transitioning=!1,n.game.currentSceneSnapshot&&n.game.currentSceneSnapshot.delete()},runDuringTransition:!0})]));break;default:throw new Error("unknown transition direction")}break;default:throw new Error("unknown transition type")}}drawFps(t){if(0===this.lastFpsUpdate)this.lastFpsUpdate=Globals.now,this.nextFpsUpdate=Globals.now+Q.FPS_DISPLAY_UPDATE_INTERVAL;else{Globals.now>=this.nextFpsUpdate&&(this.fps=this.drawnFrames/((Globals.now-this.lastFpsUpdate)/1e3),this.drawnFrames=0,this.lastFpsUpdate=Globals.now,this.nextFpsUpdate=Globals.now+Q.FPS_DISPLAY_UPDATE_INTERVAL),t.save();const e=Globals.canvasScale;if(t.scale(1/e,1/e),!this.fpsTextFont||!this.fpsTextPaint)throw new Error("fps font or paint is undefined");t.drawText("FPS: "+this.fps.toFixed(2),0,0+Q.FPS_DISPLAY_TEXT_FONT_SIZE*e,this.fpsTextPaint,this.fpsTextFont),t.restore()}}createEventListener(t,e,n,i=!0){const r=this.entities.filter((t=>t.name===e));r.length>1&&console.warn(`warning: createEventListener() found more than one entity with name ${e}. Event listener will be attached to first entity found. All entities that receive tap events should be uniquely named`);const a=r.filter((t=>t.name===e)).find(Boolean);if(void 0===a)throw new Error(`could not create event listener. entity with name ${e} could not be found in the game entity tree`);if("tapdown"!==t)throw new Error(`could not create event listener: event type ${t} is not known`);a.onTapDown(n,i)}get entities(){function t(e,n){n.push(e),e.children.forEach((e=>t(e,n)))}const e=new Array;return this.scenes.forEach((n=>t(n,e))),e}htmlCanvasMouseDownHandler(t){t.preventDefault();const e=this.currentScene;if(!e||!this.sceneCanReceiveUserInteraction(e))return;const n=t.offsetX,i=t.offsetY;this.processTaps(e,n,i)}htmlCanvasTouchStartHandler(t){t.preventDefault();const e=this.currentScene;if(!e||!this.sceneCanReceiveUserInteraction(e))return;const n=t.target.getBoundingClientRect(),i=t.touches.item(0);if(null===i)return void console.warn("warning: canvas received touchstart event, but TouchList was empty");const r=i.pageX-n.x,a=i.pageY-n.y;this.processTaps(e,r,a)}sceneCanReceiveUserInteraction(t){var e;return t.game===(null===(e=t.game.session)||void 0===e?void 0:e.currentActivity)&&!1===t._transitioning}processTaps(t,e,n){t.isUserInteractionEnabled&&this.tapIsWithinEntityBounds(t,e,n)&&this.handleEntityTapped(t,e,n),t.children&&t.children.filter((t=>!t.hidden)).forEach((t=>this.processTaps(t,e,n)))}handleEntityTapped(t,e,n){t.eventListeners.filter((t=>"tapdown"===t.eventType)).forEach((i=>{if(i.entityName===t.name){const r=this.calculateEntityAbsoluteBoundingBox(t),a=(e-r.xMin)/(r.xMax-r.xMin)*t.size.width,o=(n-r.yMin)/(r.yMax-r.yMin)*t.size.height,s={target:t,point:{x:a,y:o}};i.callback(s)}}))}tapIsWithinEntityBounds(t,e,n){if(!t.isDrawable)throw"only drawable entities can receive tap events";if(0===t.size.width||0===t.size.height)return console.warn(`warning: entity ${t.toString()} has isUserInteractionEnabled = true, but has no tappable area. Size is ${t.size.width}, ${t.size.height}`),!1;if(t.type===W.textline&&isNaN(t.size.width))return console.warn(`warning: entity ${t.toString()} is a textline with width = NaN. A textline must have its width manually set.`),!1;const i=this.calculateEntityAbsoluteBoundingBox(t);return!!(t.isUserInteractionEnabled&&e>=i.xMin&&e<=i.xMax&&n>=i.yMin&&n<=i.yMax)}calculateEntityAbsoluteBoundingBox(t){const e=t.anchorPoint,n=t.absoluteScale;return{xMin:t.absolutePosition.x-t.size.width*e.x*n,xMax:t.absolutePosition.x+t.size.width*(1-e.x)*n,yMin:t.absolutePosition.y-t.size.height*e.y*n,yMax:t.absolutePosition.y+t.size.height*(1-e.y)*n}}}!function(t){t[t.center=0]="center",t[t.left=1]="left",t[t.right=2]="right"}(H||(H={}));class rt extends q{constructor(t={}){super(t),this.type=W.label,this.isDrawable=!0,this.isText=!0,this.anchorPoint={x:.5,y:.5},this.zPosition=0,this._text="",this._fontColor=Q.DEFAULT_FONT_COLOR,this._fontSize=Q.DEFAULT_FONT_SIZE,this._horizontalAlignmentMode=H.center,Y(this,t),t.horizontalAlignmentMode&&(this.horizontalAlignmentMode=t.horizontalAlignmentMode),void 0!==t.preferredMaxLayoutWidth&&(this.preferredMaxLayoutWidth=t.preferredMaxLayoutWidth),t.backgroundColor&&(this.backgroundColor=t.backgroundColor)}initialize(){var t,e,n;let i=this.canvasKit.TextAlign.Center;switch(this.horizontalAlignmentMode){case H.center:i=this.canvasKit.TextAlign.Center;break;case H.left:i=this.canvasKit.TextAlign.Left;break;case H.right:i=this.canvasKit.TextAlign.Right;break;default:throw new Error("unknown horizontalAlignmentMode")}this.paraStyle=new this.canvasKit.ParagraphStyle({textStyle:{color:this.canvasKit.Color(this.fontColor[0],this.fontColor[1],this.fontColor[2],this.fontColor[3]),fontSize:this.fontSize*Globals.canvasScale},textAlign:i}),this.fontName&&this.paraStyle.textStyle&&(this.paraStyle.textStyle.fontFamilies=[this.fontName]),this.backgroundColor&&this.paraStyle.textStyle&&(this.paraStyle.textStyle.backgroundColor=this.backgroundColor);const r=this.parentSceneAsEntity.game.session;if(!r)throw new Error("activity is undefined");const a=r.fontManager;if(void 0===a.fontMgr)throw new Error("no fonts loaded");const o=this.canvasKit.ParagraphBuilder.Make(this.paraStyle,a.fontMgr);this.text||(this.text=""),o.addText(this.text),""===this.text&&console.warn(`warning: empty text in label "${this.name}"`),this.paragraph=o.build();const s=null!==(t=this.preferredMaxLayoutWidth)&&void 0!==t?t:Globals.canvasCssWidth;let l=s;if(0===s||0===this.layout.width){if(void 0===this.parent)throw new Error("width is set to match parent, but entity has no parent");const t=null!==(e=this.layout.marginStart)&&void 0!==e?e:0,i=null!==(n=this.layout.marginEnd)&&void 0!==n?n:0;l=this.parent.size.width-(t+i)}this.paragraph.layout(l*Globals.canvasScale),0===s||0===this.layout.width?this.size.width=l:(this.paragraph.layout(Math.ceil(this.paragraph.getMaxIntrinsicWidth())),this.size.width=this.paragraph.getMaxIntrinsicWidth()/Globals.canvasScale),this.size.height=this.paragraph.getHeight()/Globals.canvasScale}get text(){return this._text}set text(t){this._text=t,this.needsInitialization=!0}get fontName(){return this._fontName}set fontName(t){this._fontName=t,this.needsInitialization=!0}get fontColor(){return this._fontColor}set fontColor(t){this._fontColor=t,this.needsInitialization=!0}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize=t,this.needsInitialization=!0}get horizontalAlignmentMode(){return this._horizontalAlignmentMode}set horizontalAlignmentMode(t){this._horizontalAlignmentMode=t,this.needsInitialization=!0}get preferredMaxLayoutWidth(){return this._preferredMaxLayoutWidth}set preferredMaxLayoutWidth(t){this._preferredMaxLayoutWidth=t,this.needsInitialization=!0}get backgroundColor(){return this._backgroundColor}set backgroundColor(t){this._backgroundColor=t,this.needsInitialization=!0}duplicate(t){const e=new rt(Object.assign(Object.assign(Object.assign(Object.assign({},this.getEntityOptions()),this.getDrawableOptions()),this.getTextOptions()),{horizontalAlignmentMode:this.horizontalAlignmentMode,preferredMaxLayoutWidth:this.preferredMaxLayoutWidth,backgroundColor:this.backgroundColor,name:t}));return this.children.length>0&&(e.children=this.children.map((t=>{const n=t.duplicate();return n.parent=e,n}))),e}update(){super.update()}draw(t){if(this.parent&&""!==this.text){t.save();const e=Globals.canvasScale/this.absoluteScale;t.scale(1/e,1/e);const n=(this.absolutePosition.x-this.size.width*this.anchorPoint.x*this.absoluteScale)*e,i=(this.absolutePosition.y-this.size.height*this.anchorPoint.y*this.absoluteScale)*e;if(void 0===this.paragraph)throw new Error("no paragraph");t.drawParagraph(this.paragraph,n,i),t.restore()}super.drawChildren(t)}}class at{static SingleFromRange(t,e){return Math.floor(Math.random()*(e-t))+t}static FromRangeWithoutReplacement(t,e,n){const i=new Array;for(let r=0;r<t;r++){const r=Math.floor(Math.random()*(n-e))+e;i.includes(r)?t++:i.push(r)}return i}static FromGridWithoutReplacement(t,e,n,i){const r=new Array,a=e*n-1,o=this.FromRangeWithoutReplacement(t,0,a);let s=0,l=NaN;for(;s<t;){const t=o[s]%n,e=(o[s]-t)/n;if(void 0===i||i(e,t))r.push({row:e,column:t}),s++;else{do{l=this.FromRangeWithoutReplacement(1,0,a)[0]}while(o.includes(l));o[s]=l}}return r}}!function(t){t[void 0]="Undefined",t.rectangle="Rectangle",t.circle="Circle"}($||($={}));class ot extends q{constructor(t={}){super(t),this.type=W.shape,this.isDrawable=!0,this.isShape=!0,this.anchorPoint={x:.5,y:.5},this.zPosition=0,this.shapeType=$.undefined,this.cornerRadius=0,this._fillColor=Q.DEFAULT_SHAPE_FILL_COLOR,Y(this,t),void 0!==t.circleOfRadius&&(this.circleOfRadius=t.circleOfRadius,this.shapeType=$.circle),t.rect&&(this.rect=t.rect,t.rect.size?(this.size.width=t.rect.size.width,this.size.height=t.rect.size.height):void 0!==t.rect.width&&void 0!==t.rect.height&&(this.size.width=t.rect.width,this.size.height=t.rect.height),t.rect.origin?this.position=t.rect.origin:void 0!==t.rect.x&&void 0!==t.rect.y&&(this.position={x:t.rect.x,y:t.rect.y}),this.shapeType=$.rectangle),t.cornerRadius&&(this.cornerRadius=t.cornerRadius),t.fillColor&&(this.fillColor=t.fillColor),t.strokeColor&&(this.strokeColor=t.strokeColor),t.lineWidth&&(this.lineWidth=t.lineWidth),t.strokeColor&&void 0===t.lineWidth&&console.warn(`warning: for entity ${this}, strokeColor = ${t.strokeColor} but lineWidth is undefined. In normal usage, both would be set or both would be undefined.`),void 0===t.strokeColor&&t.lineWidth&&console.warn(`warning: for entity ${this}, lineWidth = ${t.lineWidth} but strokeColor is undefined. In normal usage, both would be set or both would be undefined.`)}initialize(){if(this.fillColor){const t=this.canvasKit;this.fillColorPaint=new t.Paint,this.fillColorPaint.setColor(t.Color(this.fillColor[0],this.fillColor[1],this.fillColor[2],this.fillColor[3])),this.fillColorPaint.setStyle(t.PaintStyle.Fill),this.fillColorPaint.setAntiAlias(!0)}if(this.strokeColor){const t=this.canvasKit;this.strokeColorPaint=new t.Paint,this.strokeColorPaint.setColor(t.Color(this.strokeColor[0],this.strokeColor[1],this.strokeColor[2],this.strokeColor[3])),this.strokeColorPaint.setStyle(t.PaintStyle.Stroke),this.strokeColorPaint.setAntiAlias(!0)}}get fillColor(){return this._fillColor}set fillColor(t){this._fillColor=t,this.needsInitialization=!0}get strokeColor(){return this._strokeColor}set strokeColor(t){this._strokeColor=t,this.needsInitialization=!0}duplicate(t){const e=new ot(Object.assign(Object.assign(Object.assign({},this.getEntityOptions()),this.getDrawableOptions()),{shapeType:this.shapeType,circleOfRadius:this.circleOfRadius,rect:this.rect,cornerRadius:this.cornerRadius,fillColor:this.fillColor,strokeColor:this.strokeColor,lineWidth:this.lineWidth,name:t}));return this.children.length>0&&(e.children=this.children.map((t=>{const n=t.duplicate();return n.parent=e,n}))),e}update(){super.update()}draw(t){t.save();const e=Globals.canvasScale/this.absoluteScale;if(t.scale(1/e,1/e),this.shapeType===$.circle&&void 0!==this.circleOfRadius){const n=this.absolutePosition.x*e,i=this.absolutePosition.y*e,r=this.circleOfRadius*this.absoluteScale*e;this.fillColor&&this.fillColorPaint&&t.drawCircle(n,i,r,this.fillColorPaint),this.strokeColor&&this.strokeColorPaint&&this.lineWidth&&(this.strokeColorPaint.setStrokeWidth(this.lineWidth*e),t.drawCircle(n,i,r,this.strokeColorPaint))}if(this.shapeType===$.rectangle){const n=this.canvasKit.RRectXY(this.canvasKit.LTRBRect((this.absolutePosition.x-this.anchorPoint.x*this.size.width*this.absoluteScale)*e,(this.absolutePosition.y-this.anchorPoint.y*this.size.height*this.absoluteScale)*e,(this.absolutePosition.x+this.size.width*this.absoluteScale-this.anchorPoint.x*this.size.width*this.absoluteScale)*e,(this.absolutePosition.y+this.size.height*this.absoluteScale-this.anchorPoint.y*this.size.height*this.absoluteScale)*e),this.cornerRadius*e,this.cornerRadius*e);this.fillColor&&this.fillColorPaint&&t.drawRRect(n,this.fillColorPaint),this.strokeColor&&this.strokeColorPaint&&this.lineWidth&&(this.strokeColorPaint.setStrokeWidth(this.lineWidth*e),t.drawRRect(n,this.strokeColorPaint))}t.restore(),super.drawChildren(t)}}class st{static Create(t){return new Array}}class lt extends q{constructor(t={}){var e;super(t),this.type=W.textline,this.isDrawable=!0,this.isText=!0,this.zPosition=0,this.anchorPoint={x:0,y:.5},this._text="",this._fontColor=Q.DEFAULT_FONT_COLOR,this._fontSize=Q.DEFAULT_FONT_SIZE,Y(this,t),this.size.height=this.fontSize,this.size.width=null!==(e=t.width)&&void 0!==e?e:NaN}get text(){return this._text}set text(t){this._text=t,this.needsInitialization=!0}get fontName(){return this._fontName}set fontName(t){this._fontName=t,this.needsInitialization=!0}get fontColor(){return this._fontColor}set fontColor(t){this._fontColor=t,this.needsInitialization=!0}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize=t,this.needsInitialization=!0}update(){super.update()}initialize(){this.paint=new this.canvasKit.Paint,this.paint.setColor(this.canvasKit.Color(this.fontColor[0],this.fontColor[1],this.fontColor[2],this.fontColor[3])),this.paint.setStyle(this.canvasKit.PaintStyle.Fill),this.paint.setAntiAlias(!0);const t=this.parentSceneAsEntity.game.session;if(!t)throw new Error("activity is undefined");const e=t.fontManager,n=this.parentSceneAsEntity.game.uuid;this.fontName?this.font=new this.canvasKit.Font(e.getTypeface(n,this.fontName),this.fontSize*Globals.canvasScale):this.font=new this.canvasKit.Font(null,this.fontSize*Globals.canvasScale)}duplicate(t){const e=new lt(Object.assign(Object.assign(Object.assign(Object.assign({},this.getEntityOptions()),this.getDrawableOptions()),this.getTextOptions()),{width:this.size.width,name:t}));return this.children.length>0&&(e.children=this.children.map((t=>{const n=t.duplicate();return n.parent=e,n}))),e}draw(t){if(this.parent&&this.text){t.save();const e=Globals.canvasScale/this.absoluteScale;t.scale(1/e,1/e);const n=this.absolutePosition.x*e,i=(this.absolutePosition.y+this.size.height*this.anchorPoint.y*this.absoluteScale)*e;if(void 0===this.paint||void 0===this.font)throw new Error(`in TextLine entity ${this}, Paint or Font is undefined.`);t.drawText(this.text,n,i,this.paint,this.font),t.restore()}super.drawChildren(t)}}export{i as Action,e as ActivityType,X as Composite,Q as Constants,j as ConstraintType,o as CustomAction,U as Dimensions,q as Entity,W as EntityType,n as EventType,F as FontManager,it as Game,h as GlobalVariables,a as GroupAction,m as ImageManager,rt as Label,H as LabelHorizontalAlignmentMode,V as LayoutConstraint,d as LoadedImage,l as MoveAction,et as PushTransition,at as RandomDraws,c as ScaleAction,J as Scene,nt as SceneTransition,r as SequenceAction,G as Session,ot as Shape,$ as ShapeType,Z as Sprite,st as Story,lt as TextLine,L as Timer,tt as Transition,z as TransitionDirection,N as TransitionType,D as Uuid,s as WaitAction,K as WebColors,Y as handleInterfaceOptions};
|
|
17
17
|
//# sourceMappingURL=index.js.map
|