UNPKG

@splinetool/viewer

Version:

Spline is a collaborative design platform for creating production-ready interactive experiences in multiple dimensions. © 2025 Spline, Inc.

1 lines 2.29 MB
var v2=Object.defineProperty;var gR=Object.getOwnPropertyDescriptor;var h0=(e,t)=>()=>(e&&(t=e(e=0)),t);var y2=(e,t)=>{for(var i in t)v2(e,i,{get:t[i],enumerable:!0})};var _s=(e,t,i,r)=>{for(var a=r>1?void 0:r?gR(t,i):t,s=e.length-1,n;s>=0;s--)(n=e[s])&&(a=(r?n(t,i,a):n(a))||a);return r&&a&&v2(t,i,a),a};var vR={};var x2=h0(()=>{"use strict";(function(){"use strict";var e=function(){this.init()};e.prototype={init:function(){var c=this||t;return c._counter=1e3,c._html5AudioPool=[],c.html5PoolSize=10,c._codecs={},c._howls=[],c._muted=!1,c._volume=1,c._canPlayEvent="canplaythrough",c._navigator=typeof window<"u"&&window.navigator?window.navigator:null,c.masterGain=null,c.noAudio=!1,c.usingWebAudio=!0,c.autoSuspend=!0,c.ctx=null,c.autoUnlock=!0,c._setup(),c},volume:function(c){var d=this||t;if(c=parseFloat(c),d.ctx||h(),c!==void 0&&c>=0&&c<=1){if(d._volume=c,d._muted)return d;d.usingWebAudio&&d.masterGain.gain.setValueAtTime(c,t.ctx.currentTime);for(var u=0;u<d._howls.length;u++)if(!d._howls[u]._webAudio)for(var p=d._howls[u]._getSoundIds(),f=0;f<p.length;f++){var g=d._howls[u]._soundById(p[f]);g&&g._node&&(g._node.volume=g._volume*c)}return d}return d._volume},mute:function(c){var d=this||t;d.ctx||h(),d._muted=c,d.usingWebAudio&&d.masterGain.gain.setValueAtTime(c?0:d._volume,t.ctx.currentTime);for(var u=0;u<d._howls.length;u++)if(!d._howls[u]._webAudio)for(var p=d._howls[u]._getSoundIds(),f=0;f<p.length;f++){var g=d._howls[u]._soundById(p[f]);g&&g._node&&(g._node.muted=!!c||g._muted)}return d},stop:function(){for(var c=this||t,d=0;d<c._howls.length;d++)c._howls[d].stop();return c},unload:function(){for(var c=this||t,d=c._howls.length-1;d>=0;d--)c._howls[d].unload();return c.usingWebAudio&&c.ctx&&c.ctx.close!==void 0&&(c.ctx.close(),c.ctx=null,h()),c},codecs:function(c){return(this||t)._codecs[c.replace(/^x-/,"")]},_setup:function(){var c=this||t;if(c.state=c.ctx&&c.ctx.state||"suspended",c._autoSuspend(),!c.usingWebAudio)if(typeof Audio<"u")try{var d=new Audio;d.oncanplaythrough===void 0&&(c._canPlayEvent="canplay")}catch{c.noAudio=!0}else c.noAudio=!0;try{var d=new Audio;d.muted&&(c.noAudio=!0)}catch{}return c.noAudio||c._setupCodecs(),c},_setupCodecs:function(){var c=this||t,d=null;try{d=typeof Audio<"u"?new Audio:null}catch{return c}if(!d||typeof d.canPlayType!="function")return c;var u=d.canPlayType("audio/mpeg;").replace(/^no$/,""),p=c._navigator?c._navigator.userAgent:"",f=p.match(/OPR\/([0-6].)/g),g=f&&parseInt(f[0].split("/")[1],10)<33,m=p.indexOf("Safari")!==-1&&p.indexOf("Chrome")===-1,y=p.match(/Version\/(.*?) /),x=m&&y&&parseInt(y[1],10)<15;return c._codecs={mp3:!(g||!u&&!d.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!u,opus:!!d.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!d.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!d.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(d.canPlayType('audio/wav; codecs="1"')||d.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!d.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!d.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(d.canPlayType("audio/x-m4a;")||d.canPlayType("audio/m4a;")||d.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(d.canPlayType("audio/x-m4b;")||d.canPlayType("audio/m4b;")||d.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(d.canPlayType("audio/x-mp4;")||d.canPlayType("audio/mp4;")||d.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(x||!d.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(x||!d.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!d.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(d.canPlayType("audio/x-flac;")||d.canPlayType("audio/flac;")).replace(/^no$/,"")},c},_unlockAudio:function(){var c=this||t;if(!c._audioUnlocked&&c.ctx){c._audioUnlocked=!1,c.autoUnlock=!1,c._mobileUnloaded||c.ctx.sampleRate===44100||(c._mobileUnloaded=!0,c.unload()),c._scratchBuffer=c.ctx.createBuffer(1,1,22050);var d=function(u){for(;c._html5AudioPool.length<c.html5PoolSize;)try{var p=new Audio;p._unlocked=!0,c._releaseHtml5Audio(p)}catch{c.noAudio=!0;break}for(var f=0;f<c._howls.length;f++)if(!c._howls[f]._webAudio)for(var g=c._howls[f]._getSoundIds(),m=0;m<g.length;m++){var y=c._howls[f]._soundById(g[m]);y&&y._node&&!y._node._unlocked&&(y._node._unlocked=!0,y._node.load())}c._autoResume();var x=c.ctx.createBufferSource();x.buffer=c._scratchBuffer,x.connect(c.ctx.destination),x.start===void 0?x.noteOn(0):x.start(0),typeof c.ctx.resume=="function"&&c.ctx.resume(),x.onended=function(){x.disconnect(0),c._audioUnlocked=!0,document.removeEventListener("touchstart",d,!0),document.removeEventListener("touchend",d,!0),document.removeEventListener("click",d,!0),document.removeEventListener("keydown",d,!0);for(var b=0;b<c._howls.length;b++)c._howls[b]._emit("unlock")}};return document.addEventListener("touchstart",d,!0),document.addEventListener("touchend",d,!0),document.addEventListener("click",d,!0),document.addEventListener("keydown",d,!0),c}},_obtainHtml5Audio:function(){var c=this||t;if(c._html5AudioPool.length)return c._html5AudioPool.pop();var d=new Audio().play();return d&&typeof Promise<"u"&&(d instanceof Promise||typeof d.then=="function")&&d.catch(function(){console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")}),new Audio},_releaseHtml5Audio:function(c){var d=this||t;return c._unlocked&&d._html5AudioPool.push(c),d},_autoSuspend:function(){var c=this;if(c.autoSuspend&&c.ctx&&c.ctx.suspend!==void 0&&t.usingWebAudio){for(var d=0;d<c._howls.length;d++)if(c._howls[d]._webAudio){for(var u=0;u<c._howls[d]._sounds.length;u++)if(!c._howls[d]._sounds[u]._paused)return c}return c._suspendTimer&&clearTimeout(c._suspendTimer),c._suspendTimer=setTimeout(function(){if(c.autoSuspend){c._suspendTimer=null,c.state="suspending";var p=function(){c.state="suspended",c._resumeAfterSuspend&&(delete c._resumeAfterSuspend,c._autoResume())};c.ctx.suspend().then(p,p)}},3e4),c}},_autoResume:function(){var c=this;if(c.ctx&&c.ctx.resume!==void 0&&t.usingWebAudio)return c.state==="running"&&c.ctx.state!=="interrupted"&&c._suspendTimer?(clearTimeout(c._suspendTimer),c._suspendTimer=null):c.state==="suspended"||c.state==="running"&&c.ctx.state==="interrupted"?(c.ctx.resume().then(function(){c.state="running";for(var d=0;d<c._howls.length;d++)c._howls[d]._emit("resume")}),c._suspendTimer&&(clearTimeout(c._suspendTimer),c._suspendTimer=null)):c.state==="suspending"&&(c._resumeAfterSuspend=!0),c}};var t=new e,i=function(c){var d=this;if(!c.src||c.src.length===0)return void console.error("An array of source files must be passed with any new Howl.");d.init(c)};i.prototype={init:function(c){var d=this;return t.ctx||h(),d._autoplay=c.autoplay||!1,d._format=typeof c.format!="string"?c.format:[c.format],d._html5=c.html5||!1,d._muted=c.mute||!1,d._loop=c.loop||!1,d._pool=c.pool||5,d._preload=typeof c.preload!="boolean"&&c.preload!=="metadata"||c.preload,d._rate=c.rate||1,d._sprite=c.sprite||{},d._src=typeof c.src!="string"?c.src:[c.src],d._volume=c.volume!==void 0?c.volume:1,d._xhr={method:c.xhr&&c.xhr.method?c.xhr.method:"GET",headers:c.xhr&&c.xhr.headers?c.xhr.headers:null,withCredentials:!(!c.xhr||!c.xhr.withCredentials)&&c.xhr.withCredentials},d._duration=0,d._state="unloaded",d._sounds=[],d._endTimers={},d._queue=[],d._playLock=!1,d._onend=c.onend?[{fn:c.onend}]:[],d._onfade=c.onfade?[{fn:c.onfade}]:[],d._onload=c.onload?[{fn:c.onload}]:[],d._onloaderror=c.onloaderror?[{fn:c.onloaderror}]:[],d._onplayerror=c.onplayerror?[{fn:c.onplayerror}]:[],d._onpause=c.onpause?[{fn:c.onpause}]:[],d._onplay=c.onplay?[{fn:c.onplay}]:[],d._onstop=c.onstop?[{fn:c.onstop}]:[],d._onmute=c.onmute?[{fn:c.onmute}]:[],d._onvolume=c.onvolume?[{fn:c.onvolume}]:[],d._onrate=c.onrate?[{fn:c.onrate}]:[],d._onseek=c.onseek?[{fn:c.onseek}]:[],d._onunlock=c.onunlock?[{fn:c.onunlock}]:[],d._onresume=[],d._webAudio=t.usingWebAudio&&!d._html5,t.ctx!==void 0&&t.ctx&&t.autoUnlock&&t._unlockAudio(),t._howls.push(d),d._autoplay&&d._queue.push({event:"play",action:function(){d.play()}}),d._preload&&d._preload!=="none"&&d.load(),d},load:function(){var c=this,d=null;if(t.noAudio)return void c._emit("loaderror",null,"No audio support.");typeof c._src=="string"&&(c._src=[c._src]);for(var u=0;u<c._src.length;u++){var p,f;if(c._format&&c._format[u])p=c._format[u];else{if(typeof(f=c._src[u])!="string"){c._emit("loaderror",null,"Non-string found in selected audio sources - ignoring.");continue}p=/^data:audio\/([^;,]+);/i.exec(f),p||(p=/\.([^.]+)$/.exec(f.split("?",1)[0])),p&&(p=p[1].toLowerCase())}if(p||console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),p&&t.codecs(p)){d=c._src[u];break}}return d?(c._src=d,c._state="loading",window.location.protocol==="https:"&&d.slice(0,5)==="http:"&&(c._html5=!0,c._webAudio=!1),new r(c),c._webAudio&&s(c),c):void c._emit("loaderror",null,"No codec support for selected audio sources.")},play:function(c,d){var u=this,p=null;if(typeof c=="number")p=c,c=null;else{if(typeof c=="string"&&u._state==="loaded"&&!u._sprite[c])return null;if(c===void 0&&(c="__default",!u._playLock)){for(var f=0,g=0;g<u._sounds.length;g++)u._sounds[g]._paused&&!u._sounds[g]._ended&&(f++,p=u._sounds[g]._id);f===1?c=null:p=null}}var m=p?u._soundById(p):u._inactiveSound();if(!m)return null;if(p&&!c&&(c=m._sprite||"__default"),u._state!=="loaded"){m._sprite=c,m._ended=!1;var y=m._id;return u._queue.push({event:"play",action:function(){u.play(y)}}),y}if(p&&!m._paused)return d||u._loadQueue("play"),m._id;u._webAudio&&t._autoResume();var x=Math.max(0,m._seek>0?m._seek:u._sprite[c][0]/1e3),b=Math.max(0,(u._sprite[c][0]+u._sprite[c][1])/1e3-x),w=1e3*b/Math.abs(m._rate),M=u._sprite[c][0]/1e3,S=(u._sprite[c][0]+u._sprite[c][1])/1e3;m._sprite=c,m._ended=!1;var E=function(){m._paused=!1,m._seek=x,m._start=M,m._stop=S,m._loop=!(!m._loop&&!u._sprite[c][2])};if(x>=S)return void u._ended(m);var A=m._node;if(u._webAudio){var T=function(){u._playLock=!1,E(),u._refreshBuffer(m);var U=m._muted||u._muted?0:m._volume;A.gain.setValueAtTime(U,t.ctx.currentTime),m._playStart=t.ctx.currentTime,A.bufferSource.start===void 0?m._loop?A.bufferSource.noteGrainOn(0,x,86400):A.bufferSource.noteGrainOn(0,x,b):m._loop?A.bufferSource.start(0,x,86400):A.bufferSource.start(0,x,b),w!==1/0&&(u._endTimers[m._id]=setTimeout(u._ended.bind(u,m),w)),d||setTimeout(function(){u._emit("play",m._id),u._loadQueue()},0)};t.state==="running"&&t.ctx.state!=="interrupted"?T():(u._playLock=!0,u.once("resume",T),u._clearTimer(m._id))}else{var P=function(){A.currentTime=x,A.muted=m._muted||u._muted||t._muted||A.muted,A.volume=m._volume*t.volume(),A.playbackRate=m._rate;try{var U=A.play();if(U&&typeof Promise<"u"&&(U instanceof Promise||typeof U.then=="function")?(u._playLock=!0,E(),U.then(function(){u._playLock=!1,A._unlocked=!0,d?u._loadQueue():u._emit("play",m._id)}).catch(function(){u._playLock=!1,u._emit("playerror",m._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),m._ended=!0,m._paused=!0})):d||(u._playLock=!1,E(),u._emit("play",m._id)),A.playbackRate=m._rate,A.paused)return void u._emit("playerror",m._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");c!=="__default"||m._loop?u._endTimers[m._id]=setTimeout(u._ended.bind(u,m),w):(u._endTimers[m._id]=function(){u._ended(m),A.removeEventListener("ended",u._endTimers[m._id],!1)},A.addEventListener("ended",u._endTimers[m._id],!1))}catch(B){u._emit("playerror",m._id,B)}};A.src==="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"&&(A.src=u._src,A.load());var R=window&&window.ejecta||!A.readyState&&t._navigator.isCocoonJS;if(A.readyState>=3||R)P();else{u._playLock=!0,u._state="loading";var z=function(){u._state="loaded",P(),A.removeEventListener(t._canPlayEvent,z,!1)};A.addEventListener(t._canPlayEvent,z,!1),u._clearTimer(m._id)}}return m._id},pause:function(c){var d=this;if(d._state!=="loaded"||d._playLock)return d._queue.push({event:"pause",action:function(){d.pause(c)}}),d;for(var u=d._getSoundIds(c),p=0;p<u.length;p++){d._clearTimer(u[p]);var f=d._soundById(u[p]);if(f&&!f._paused&&(f._seek=d.seek(u[p]),f._rateSeek=0,f._paused=!0,d._stopFade(u[p]),f._node))if(d._webAudio){if(!f._node.bufferSource)continue;f._node.bufferSource.stop===void 0?f._node.bufferSource.noteOff(0):f._node.bufferSource.stop(0),d._cleanBuffer(f._node)}else isNaN(f._node.duration)&&f._node.duration!==1/0||f._node.pause();arguments[1]||d._emit("pause",f?f._id:null)}return d},stop:function(c,d){var u=this;if(u._state!=="loaded"||u._playLock)return u._queue.push({event:"stop",action:function(){u.stop(c)}}),u;for(var p=u._getSoundIds(c),f=0;f<p.length;f++){u._clearTimer(p[f]);var g=u._soundById(p[f]);g&&(g._seek=g._start||0,g._rateSeek=0,g._paused=!0,g._ended=!0,u._stopFade(p[f]),g._node&&(u._webAudio?g._node.bufferSource&&(g._node.bufferSource.stop===void 0?g._node.bufferSource.noteOff(0):g._node.bufferSource.stop(0),u._cleanBuffer(g._node)):isNaN(g._node.duration)&&g._node.duration!==1/0||(g._node.currentTime=g._start||0,g._node.pause(),g._node.duration===1/0&&u._clearSound(g._node))),d||u._emit("stop",g._id))}return u},mute:function(c,d){var u=this;if(u._state!=="loaded"||u._playLock)return u._queue.push({event:"mute",action:function(){u.mute(c,d)}}),u;if(d===void 0){if(typeof c!="boolean")return u._muted;u._muted=c}for(var p=u._getSoundIds(d),f=0;f<p.length;f++){var g=u._soundById(p[f]);g&&(g._muted=c,g._interval&&u._stopFade(g._id),u._webAudio&&g._node?g._node.gain.setValueAtTime(c?0:g._volume,t.ctx.currentTime):g._node&&(g._node.muted=!!t._muted||c),u._emit("mute",g._id))}return u},volume:function(){var c,d,u=this,p=arguments;if(p.length===0)return u._volume;p.length===1||p.length===2&&p[1]===void 0?u._getSoundIds().indexOf(p[0])>=0?d=parseInt(p[0],10):c=parseFloat(p[0]):p.length>=2&&(c=parseFloat(p[0]),d=parseInt(p[1],10));var f;if(!(c!==void 0&&c>=0&&c<=1))return f=d?u._soundById(d):u._sounds[0],f?f._volume:0;if(u._state!=="loaded"||u._playLock)return u._queue.push({event:"volume",action:function(){u.volume.apply(u,p)}}),u;d===void 0&&(u._volume=c),d=u._getSoundIds(d);for(var g=0;g<d.length;g++)(f=u._soundById(d[g]))&&(f._volume=c,p[2]||u._stopFade(d[g]),u._webAudio&&f._node&&!f._muted?f._node.gain.setValueAtTime(c,t.ctx.currentTime):f._node&&!f._muted&&(f._node.volume=c*t.volume()),u._emit("volume",f._id));return u},fade:function(c,d,u,p){var f=this;if(f._state!=="loaded"||f._playLock)return f._queue.push({event:"fade",action:function(){f.fade(c,d,u,p)}}),f;c=Math.min(Math.max(0,parseFloat(c)),1),d=Math.min(Math.max(0,parseFloat(d)),1),u=parseFloat(u),f.volume(c,p);for(var g=f._getSoundIds(p),m=0;m<g.length;m++){var y=f._soundById(g[m]);if(y){if(p||f._stopFade(g[m]),f._webAudio&&!y._muted){var x=t.ctx.currentTime,b=x+u/1e3;y._volume=c,y._node.gain.setValueAtTime(c,x),y._node.gain.linearRampToValueAtTime(d,b)}f._startFadeInterval(y,c,d,u,g[m],p===void 0)}}return f},_startFadeInterval:function(c,d,u,p,f,g){var m=this,y=d,x=u-d,b=Math.abs(x/.01),w=Math.max(4,b>0?p/b:p),M=Date.now();c._fadeTo=u,c._interval=setInterval(function(){var S=(Date.now()-M)/p;M=Date.now(),y+=x*S,y=Math.round(100*y)/100,y=x<0?Math.max(u,y):Math.min(u,y),m._webAudio?c._volume=y:m.volume(y,c._id,!0),g&&(m._volume=y),(u<d&&y<=u||u>d&&y>=u)&&(clearInterval(c._interval),c._interval=null,c._fadeTo=null,m.volume(u,c._id),m._emit("fade",c._id))},w)},_stopFade:function(c){var d=this,u=d._soundById(c);return u&&u._interval&&(d._webAudio&&u._node.gain.cancelScheduledValues(t.ctx.currentTime),clearInterval(u._interval),u._interval=null,d.volume(u._fadeTo,c),u._fadeTo=null,d._emit("fade",c)),d},loop:function(){var c,d,u,p=this,f=arguments;if(f.length===0)return p._loop;if(f.length===1){if(typeof f[0]!="boolean")return!!(u=p._soundById(parseInt(f[0],10)))&&u._loop;c=f[0],p._loop=c}else f.length===2&&(c=f[0],d=parseInt(f[1],10));for(var g=p._getSoundIds(d),m=0;m<g.length;m++)(u=p._soundById(g[m]))&&(u._loop=c,p._webAudio&&u._node&&u._node.bufferSource&&(u._node.bufferSource.loop=c,c&&(u._node.bufferSource.loopStart=u._start||0,u._node.bufferSource.loopEnd=u._stop,p.playing(g[m])&&(p.pause(g[m],!0),p.play(g[m],!0)))));return p},rate:function(){var c,d,u=this,p=arguments;if(p.length===0)d=u._sounds[0]._id;else if(p.length===1){var f=u._getSoundIds(),g=f.indexOf(p[0]);g>=0?d=parseInt(p[0],10):c=parseFloat(p[0])}else p.length===2&&(c=parseFloat(p[0]),d=parseInt(p[1],10));var m;if(typeof c!="number")return m=u._soundById(d),m?m._rate:u._rate;if(u._state!=="loaded"||u._playLock)return u._queue.push({event:"rate",action:function(){u.rate.apply(u,p)}}),u;d===void 0&&(u._rate=c),d=u._getSoundIds(d);for(var y=0;y<d.length;y++)if(m=u._soundById(d[y])){u.playing(d[y])&&(m._rateSeek=u.seek(d[y]),m._playStart=u._webAudio?t.ctx.currentTime:m._playStart),m._rate=c,u._webAudio&&m._node&&m._node.bufferSource?m._node.bufferSource.playbackRate.setValueAtTime(c,t.ctx.currentTime):m._node&&(m._node.playbackRate=c);var x=u.seek(d[y]),b=(u._sprite[m._sprite][0]+u._sprite[m._sprite][1])/1e3-x,w=1e3*b/Math.abs(m._rate);!u._endTimers[d[y]]&&m._paused||(u._clearTimer(d[y]),u._endTimers[d[y]]=setTimeout(u._ended.bind(u,m),w)),u._emit("rate",m._id)}return u},seek:function(){var c,d,u=this,p=arguments;if(p.length===0)u._sounds.length&&(d=u._sounds[0]._id);else if(p.length===1){var f=u._getSoundIds(),g=f.indexOf(p[0]);g>=0?d=parseInt(p[0],10):u._sounds.length&&(d=u._sounds[0]._id,c=parseFloat(p[0]))}else p.length===2&&(c=parseFloat(p[0]),d=parseInt(p[1],10));if(d===void 0)return 0;if(typeof c=="number"&&(u._state!=="loaded"||u._playLock))return u._queue.push({event:"seek",action:function(){u.seek.apply(u,p)}}),u;var m=u._soundById(d);if(m){if(!(typeof c=="number"&&c>=0)){if(u._webAudio){var y=u.playing(d)?t.ctx.currentTime-m._playStart:0,x=m._rateSeek?m._rateSeek-m._seek:0;return m._seek+(x+y*Math.abs(m._rate))}return m._node.currentTime}var b=u.playing(d);b&&u.pause(d,!0),m._seek=c,m._ended=!1,u._clearTimer(d),u._webAudio||!m._node||isNaN(m._node.duration)||(m._node.currentTime=c);var w=function(){b&&u.play(d,!0),u._emit("seek",d)};if(b&&!u._webAudio){var M=function(){u._playLock?setTimeout(M,0):w()};setTimeout(M,0)}else w()}return u},playing:function(c){var d=this;if(typeof c=="number"){var u=d._soundById(c);return!!u&&!u._paused}for(var p=0;p<d._sounds.length;p++)if(!d._sounds[p]._paused)return!0;return!1},duration:function(c){var d=this,u=d._duration,p=d._soundById(c);return p&&(u=d._sprite[p._sprite][1]/1e3),u},state:function(){return this._state},unload:function(){for(var c=this,d=c._sounds,u=0;u<d.length;u++)d[u]._paused||c.stop(d[u]._id),c._webAudio||(c._clearSound(d[u]._node),d[u]._node.removeEventListener("error",d[u]._errorFn,!1),d[u]._node.removeEventListener(t._canPlayEvent,d[u]._loadFn,!1),d[u]._node.removeEventListener("ended",d[u]._endFn,!1),t._releaseHtml5Audio(d[u]._node)),delete d[u]._node,c._clearTimer(d[u]._id);var p=t._howls.indexOf(c);p>=0&&t._howls.splice(p,1);var f=!0;for(u=0;u<t._howls.length;u++)if(t._howls[u]._src===c._src||c._src.indexOf(t._howls[u]._src)>=0){f=!1;break}return a&&f&&delete a[c._src],t.noAudio=!1,c._state="unloaded",c._sounds=[],c=null,null},on:function(c,d,u,p){var f=this,g=f["_on"+c];return typeof d=="function"&&g.push(p?{id:u,fn:d,once:p}:{id:u,fn:d}),f},off:function(c,d,u){var p=this,f=p["_on"+c],g=0;if(typeof d=="number"&&(u=d,d=null),d||u)for(g=0;g<f.length;g++){var m=u===f[g].id;if(d===f[g].fn&&m||!d&&m){f.splice(g,1);break}}else if(c)p["_on"+c]=[];else{var y=Object.keys(p);for(g=0;g<y.length;g++)y[g].indexOf("_on")===0&&Array.isArray(p[y[g]])&&(p[y[g]]=[])}return p},once:function(c,d,u){var p=this;return p.on(c,d,u,1),p},_emit:function(c,d,u){for(var p=this,f=p["_on"+c],g=f.length-1;g>=0;g--)f[g].id&&f[g].id!==d&&c!=="load"||(setTimeout(function(m){m.call(this,d,u)}.bind(p,f[g].fn),0),f[g].once&&p.off(c,f[g].fn,f[g].id));return p._loadQueue(c),p},_loadQueue:function(c){var d=this;if(d._queue.length>0){var u=d._queue[0];u.event===c&&(d._queue.shift(),d._loadQueue()),c||u.action()}return d},_ended:function(c){var d=this,u=c._sprite;if(!d._webAudio&&c._node&&!c._node.paused&&!c._node.ended&&c._node.currentTime<c._stop)return setTimeout(d._ended.bind(d,c),100),d;var p=!(!c._loop&&!d._sprite[u][2]);if(d._emit("end",c._id),!d._webAudio&&p&&d.stop(c._id,!0).play(c._id),d._webAudio&&p){d._emit("play",c._id),c._seek=c._start||0,c._rateSeek=0,c._playStart=t.ctx.currentTime;var f=1e3*(c._stop-c._start)/Math.abs(c._rate);d._endTimers[c._id]=setTimeout(d._ended.bind(d,c),f)}return d._webAudio&&!p&&(c._paused=!0,c._ended=!0,c._seek=c._start||0,c._rateSeek=0,d._clearTimer(c._id),d._cleanBuffer(c._node),t._autoSuspend()),d._webAudio||p||d.stop(c._id,!0),d},_clearTimer:function(c){var d=this;if(d._endTimers[c]){if(typeof d._endTimers[c]!="function")clearTimeout(d._endTimers[c]);else{var u=d._soundById(c);u&&u._node&&u._node.removeEventListener("ended",d._endTimers[c],!1)}delete d._endTimers[c]}return d},_soundById:function(c){for(var d=this,u=0;u<d._sounds.length;u++)if(c===d._sounds[u]._id)return d._sounds[u];return null},_inactiveSound:function(){var c=this;c._drain();for(var d=0;d<c._sounds.length;d++)if(c._sounds[d]._ended)return c._sounds[d].reset();return new r(c)},_drain:function(){var c=this,d=c._pool,u=0,p=0;if(!(c._sounds.length<d)){for(p=0;p<c._sounds.length;p++)c._sounds[p]._ended&&u++;for(p=c._sounds.length-1;p>=0;p--){if(u<=d)return;c._sounds[p]._ended&&(c._webAudio&&c._sounds[p]._node&&c._sounds[p]._node.disconnect(0),c._sounds.splice(p,1),u--)}}},_getSoundIds:function(c){var d=this;if(c===void 0){for(var u=[],p=0;p<d._sounds.length;p++)u.push(d._sounds[p]._id);return u}return[c]},_refreshBuffer:function(c){var d=this;return c._node.bufferSource=t.ctx.createBufferSource(),c._node.bufferSource.buffer=a[d._src],c._panner?c._node.bufferSource.connect(c._panner):c._node.bufferSource.connect(c._node),c._node.bufferSource.loop=c._loop,c._loop&&(c._node.bufferSource.loopStart=c._start||0,c._node.bufferSource.loopEnd=c._stop||0),c._node.bufferSource.playbackRate.setValueAtTime(c._rate,t.ctx.currentTime),d},_cleanBuffer:function(c){var d=this,u=t._navigator&&t._navigator.vendor.indexOf("Apple")>=0;if(t._scratchBuffer&&c.bufferSource&&(c.bufferSource.onended=null,c.bufferSource.disconnect(0),u))try{c.bufferSource.buffer=t._scratchBuffer}catch{}return c.bufferSource=null,d},_clearSound:function(c){/MSIE |Trident\//.test(t._navigator&&t._navigator.userAgent)||(c.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var r=function(c){this._parent=c,this.init()};r.prototype={init:function(){var c=this,d=c._parent;return c._muted=d._muted,c._loop=d._loop,c._volume=d._volume,c._rate=d._rate,c._seek=0,c._paused=!0,c._ended=!0,c._sprite="__default",c._id=++t._counter,d._sounds.push(c),c.create(),c},create:function(){var c=this,d=c._parent,u=t._muted||c._muted||c._parent._muted?0:c._volume;return d._webAudio?(c._node=t.ctx.createGain===void 0?t.ctx.createGainNode():t.ctx.createGain(),c._node.gain.setValueAtTime(u,t.ctx.currentTime),c._node.paused=!0,c._node.connect(t.masterGain)):t.noAudio||(c._node=t._obtainHtml5Audio(),c._errorFn=c._errorListener.bind(c),c._node.addEventListener("error",c._errorFn,!1),c._loadFn=c._loadListener.bind(c),c._node.addEventListener(t._canPlayEvent,c._loadFn,!1),c._endFn=c._endListener.bind(c),c._node.addEventListener("ended",c._endFn,!1),c._node.src=d._src,c._node.preload=d._preload===!0?"auto":d._preload,c._node.volume=u*t.volume(),c._node.load()),c},reset:function(){var c=this,d=c._parent;return c._muted=d._muted,c._loop=d._loop,c._volume=d._volume,c._rate=d._rate,c._seek=0,c._rateSeek=0,c._paused=!0,c._ended=!0,c._sprite="__default",c._id=++t._counter,c},_errorListener:function(){var c=this;c._parent._emit("loaderror",c._id,c._node.error?c._node.error.code:0),c._node.removeEventListener("error",c._errorFn,!1)},_loadListener:function(){var c=this,d=c._parent;d._duration=Math.ceil(10*c._node.duration)/10,Object.keys(d._sprite).length===0&&(d._sprite={__default:[0,1e3*d._duration]}),d._state!=="loaded"&&(d._state="loaded",d._emit("load"),d._loadQueue()),c._node.removeEventListener(t._canPlayEvent,c._loadFn,!1)},_endListener:function(){var c=this,d=c._parent;d._duration===1/0&&(d._duration=Math.ceil(10*c._node.duration)/10,d._sprite.__default[1]===1/0&&(d._sprite.__default[1]=1e3*d._duration),d._ended(c)),c._node.removeEventListener("ended",c._endFn,!1)}};var a={},s=function(c){var d=c._src;if(a[d])return c._duration=a[d].duration,void l(c);if(/^data:[^;]+;base64,/.test(d)){for(var u=atob(d.split(",")[1]),p=new Uint8Array(u.length),f=0;f<u.length;++f)p[f]=u.charCodeAt(f);o(p.buffer,c)}else{var g=new XMLHttpRequest;g.open(c._xhr.method,d,!0),g.withCredentials=c._xhr.withCredentials,g.responseType="arraybuffer",c._xhr.headers&&Object.keys(c._xhr.headers).forEach(function(m){g.setRequestHeader(m,c._xhr.headers[m])}),g.onload=function(){var m=(g.status+"")[0];if(m!=="0"&&m!=="2"&&m!=="3")return void c._emit("loaderror",null,"Failed loading audio file with status: "+g.status+".");o(g.response,c)},g.onerror=function(){c._webAudio&&(c._html5=!0,c._webAudio=!1,c._sounds=[],delete a[d],c.load())},n(g)}},n=function(c){try{c.send()}catch{c.onerror()}},o=function(c,d){var u=function(){d._emit("loaderror",null,"Decoding audio data failed.")},p=function(f){f&&d._sounds.length>0?(a[d._src]=f,l(d,f)):u()};typeof Promise<"u"&&t.ctx.decodeAudioData.length===1?t.ctx.decodeAudioData(c).then(p).catch(u):t.ctx.decodeAudioData(c,p,u)},l=function(c,d){d&&!c._duration&&(c._duration=d.duration),Object.keys(c._sprite).length===0&&(c._sprite={__default:[0,1e3*c._duration]}),c._state!=="loaded"&&(c._state="loaded",c._emit("load"),c._loadQueue())},h=function(){if(t.usingWebAudio){try{typeof AudioContext<"u"?t.ctx=new AudioContext:typeof webkitAudioContext<"u"?t.ctx=new webkitAudioContext:t.usingWebAudio=!1}catch{t.usingWebAudio=!1}t.ctx||(t.usingWebAudio=!1);var c=/iP(hone|od|ad)/.test(t._navigator&&t._navigator.platform),d=t._navigator&&t._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),u=d?parseInt(d[1],10):null;if(c&&u&&u<9){var p=/safari/.test(t._navigator&&t._navigator.userAgent.toLowerCase());t._navigator&&!p&&(t.usingWebAudio=!1)}t.usingWebAudio&&(t.masterGain=t.ctx.createGain===void 0?t.ctx.createGainNode():t.ctx.createGain(),t.masterGain.gain.setValueAtTime(t._muted?0:t._volume,t.ctx.currentTime),t.masterGain.connect(t.ctx.destination)),t._setup()}};typeof define=="function"&&define.amd&&define([],function(){return{Howler:t,Howl:i}}),typeof exports<"u"&&(exports.Howler=t,exports.Howl=i),typeof global<"u"?(global.HowlerGlobal=e,global.Howler=t,global.Howl=i,global.Sound=r):typeof window<"u"&&(window.HowlerGlobal=e,window.Howler=t,window.Howl=i,window.Sound=r)})()});var b2={};y2(b2,{default:()=>bR});var yR,xR,bR,w2=h0(()=>{"use strict";yR=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),xR=yR((e,t)=>{var i=(()=>{var r=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return function(a={}){var s=a,n,o;s.ready=new Promise((v,_)=>{n=v,o=_}),function(v){v.Id=v.Id||[],v.Id.push(function(){v.MakeSWCanvasSurface=function(_){var C=_,O=typeof OffscreenCanvas<"u"&&C instanceof OffscreenCanvas;if(!(typeof HTMLCanvasElement<"u"&&C instanceof HTMLCanvasElement||O||(C=document.getElementById(_),C)))throw"Canvas with id "+_+" was not found";return(_=v.MakeSurface(C.width,C.height))&&(_.ie=C),_},v.MakeCanvasSurface||(v.MakeCanvasSurface=v.MakeSWCanvasSurface),v.MakeSurface=function(_,C){var O={width:_,height:C,colorType:v.ColorType.RGBA_8888,alphaType:v.AlphaType.Unpremul,colorSpace:v.ColorSpace.SRGB},L=_*C*4,G=v._malloc(L);return(O=v.Surface._makeRasterDirect(O,G,4*_))&&(O.ie=null,O.Pe=_,O.Me=C,O.Ne=L,O.re=G,O.getCanvas().clear(v.TRANSPARENT)),O},v.MakeRasterDirectSurface=function(_,C,O){return v.Surface._makeRasterDirect(_,C.byteOffset,O)},v.Surface.prototype.flush=function(_){if(v.Fd(this.Ed),this._flush(),this.ie){var C=new Uint8ClampedArray(v.HEAPU8.buffer,this.re,this.Ne);C=new ImageData(C,this.Pe,this.Me),_?this.ie.getContext("2d").putImageData(C,0,0,_[0],_[1],_[2]-_[0],_[3]-_[1]):this.ie.getContext("2d").putImageData(C,0,0)}},v.Surface.prototype.dispose=function(){this.re&&v._free(this.re),this.delete()},v.Fd=v.Fd||function(){},v.je=v.je||function(){return null}})}(s),function(v){v.Id=v.Id||[],v.Id.push(function(){function _(Z,he,Oe){return Z&&Z.hasOwnProperty(he)?Z[he]:Oe}function C(Z){var he=ac(Br);return Br[he]=Z,he}function O(Z){return Z.naturalHeight||Z.videoHeight||Z.displayHeight||Z.height}function L(Z){return Z.naturalWidth||Z.videoWidth||Z.displayWidth||Z.width}function G(Z,he,Oe,Ne){return Z.bindTexture(Z.TEXTURE_2D,he),Ne||Oe.alphaType!==v.AlphaType.Premul||Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),he}function K(Z,he,Oe){Oe||he.alphaType!==v.AlphaType.Premul||Z.pixelStorei(Z.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),Z.bindTexture(Z.TEXTURE_2D,null)}v.GetWebGLContext=function(Z,he){if(!Z)throw"null canvas passed into makeWebGLContext";var Oe={alpha:_(he,"alpha",1),depth:_(he,"depth",1),stencil:_(he,"stencil",8),antialias:_(he,"antialias",0),premultipliedAlpha:_(he,"premultipliedAlpha",1),preserveDrawingBuffer:_(he,"preserveDrawingBuffer",0),preferLowPowerToHighPerformance:_(he,"preferLowPowerToHighPerformance",0),failIfMajorPerformanceCaveat:_(he,"failIfMajorPerformanceCaveat",0),enableExtensionsByDefault:_(he,"enableExtensionsByDefault",1),explicitSwapControl:_(he,"explicitSwapControl",0),renderViaOffscreenBackBuffer:_(he,"renderViaOffscreenBackBuffer",0)};if(Oe.majorVersion=he&&he.majorVersion?he.majorVersion:typeof WebGL2RenderingContext<"u"?2:1,Oe.explicitSwapControl)throw"explicitSwapControl is not supported";return Z=Q4(Z,Oe),Z?(Z_(Z),$t.Qd.getExtension("WEBGL_debug_renderer_info"),Z):0},v.deleteContext=function(Z){$t===Wa[Z]&&($t=null),typeof JSEvents=="object"&&JSEvents.tf(Wa[Z].Qd.canvas),Wa[Z]&&Wa[Z].Qd.canvas&&(Wa[Z].Qd.canvas.Ke=void 0),Wa[Z]=null},v._setTextureCleanup({deleteTexture:function(Z,he){var Oe=Br[he];Oe&&Wa[Z].Qd.deleteTexture(Oe),Br[he]=null}}),v.MakeWebGLContext=function(Z){if(!this.Fd(Z))return null;var he=this._MakeGrContext();if(!he)return null;he.Ed=Z;var Oe=he.delete.bind(he);return he.delete=function(){v.Fd(this.Ed),Oe()}.bind(he),$t.te=he},v.MakeGrContext=v.MakeWebGLContext,v.GrDirectContext.prototype.getResourceCacheLimitBytes=function(){v.Fd(this.Ed),this._getResourceCacheLimitBytes()},v.GrDirectContext.prototype.getResourceCacheUsageBytes=function(){v.Fd(this.Ed),this._getResourceCacheUsageBytes()},v.GrDirectContext.prototype.releaseResourcesAndAbandonContext=function(){v.Fd(this.Ed),this._releaseResourcesAndAbandonContext()},v.GrDirectContext.prototype.setResourceCacheLimitBytes=function(Z){v.Fd(this.Ed),this._setResourceCacheLimitBytes(Z)},v.MakeOnScreenGLSurface=function(Z,he,Oe,Ne,et,mt){return!this.Fd(Z.Ed)||(he=et===void 0||mt===void 0?this._MakeOnScreenGLSurface(Z,he,Oe,Ne):this._MakeOnScreenGLSurface(Z,he,Oe,Ne,et,mt),!he)?null:(he.Ed=Z.Ed,he)},v.MakeRenderTarget=function(){var Z=arguments[0];if(!this.Fd(Z.Ed))return null;if(arguments.length===3){var he=this._MakeRenderTargetWH(Z,arguments[1],arguments[2]);if(!he)return null}else if(arguments.length===2){if(he=this._MakeRenderTargetII(Z,arguments[1]),!he)return null}else return null;return he.Ed=Z.Ed,he},v.MakeWebGLCanvasSurface=function(Z,he,Oe){he=he||null;var Ne=Z,et=typeof OffscreenCanvas<"u"&&Ne instanceof OffscreenCanvas;if(!(typeof HTMLCanvasElement<"u"&&Ne instanceof HTMLCanvasElement||et||(Ne=document.getElementById(Z),Ne)))throw"Canvas with id "+Z+" was not found";if(Z=this.GetWebGLContext(Ne,Oe),!Z||0>Z)throw"failed to create webgl context: err "+Z;return Z=this.MakeWebGLContext(Z),he=this.MakeOnScreenGLSurface(Z,Ne.width,Ne.height,he),he||(he=Ne.cloneNode(!0),Ne.parentNode.replaceChild(he,Ne),he.classList.add("ck-replaced"),v.MakeSWCanvasSurface(he))},v.MakeCanvasSurface=v.MakeWebGLCanvasSurface,v.Surface.prototype.makeImageFromTexture=function(Z,he){return v.Fd(this.Ed),Z=C(Z),(he=this._makeImageFromTexture(this.Ed,Z,he))&&(he.de=Z),he},v.Surface.prototype.makeImageFromTextureSource=function(Z,he,Oe){he||(he={height:O(Z),width:L(Z),colorType:v.ColorType.RGBA_8888,alphaType:Oe?v.AlphaType.Premul:v.AlphaType.Unpremul}),he.colorSpace||(he.colorSpace=v.ColorSpace.SRGB),v.Fd(this.Ed);var Ne=$t.Qd;return Oe=G(Ne,Ne.createTexture(),he,Oe),$t.version===2?Ne.texImage2D(Ne.TEXTURE_2D,0,Ne.RGBA,he.width,he.height,0,Ne.RGBA,Ne.UNSIGNED_BYTE,Z):Ne.texImage2D(Ne.TEXTURE_2D,0,Ne.RGBA,Ne.RGBA,Ne.UNSIGNED_BYTE,Z),K(Ne,he),this._resetContext(),this.makeImageFromTexture(Oe,he)},v.Surface.prototype.updateTextureFromSource=function(Z,he,Oe){if(Z.de){v.Fd(this.Ed);var Ne=Z.getImageInfo(),et=$t.Qd,mt=G(et,Br[Z.de],Ne,Oe);$t.version===2?et.texImage2D(et.TEXTURE_2D,0,et.RGBA,L(he),O(he),0,et.RGBA,et.UNSIGNED_BYTE,he):et.texImage2D(et.TEXTURE_2D,0,et.RGBA,et.RGBA,et.UNSIGNED_BYTE,he),K(et,Ne,Oe),this._resetContext(),Br[Z.de]=null,Z.de=C(mt),Ne.colorSpace=Z.getColorSpace(),he=this._makeImageFromTexture(this.Ed,Z.de,Ne),Oe=Z.Dd.Hd,et=Z.Dd.Ld,Z.Dd.Hd=he.Dd.Hd,Z.Dd.Ld=he.Dd.Ld,he.Dd.Hd=Oe,he.Dd.Ld=et,he.delete(),Ne.colorSpace.delete()}},v.MakeLazyImageFromTextureSource=function(Z,he,Oe){he||(he={height:O(Z),width:L(Z),colorType:v.ColorType.RGBA_8888,alphaType:Oe?v.AlphaType.Premul:v.AlphaType.Unpremul}),he.colorSpace||(he.colorSpace=v.ColorSpace.SRGB);var Ne={makeTexture:function(){var et=$t,mt=et.Qd,xe=G(mt,mt.createTexture(),he,Oe);return et.version===2?mt.texImage2D(mt.TEXTURE_2D,0,mt.RGBA,he.width,he.height,0,mt.RGBA,mt.UNSIGNED_BYTE,Z):mt.texImage2D(mt.TEXTURE_2D,0,mt.RGBA,mt.RGBA,mt.UNSIGNED_BYTE,Z),K(mt,he,Oe),C(xe)},freeSrc:function(){}};return Z.constructor.name==="VideoFrame"&&(Ne.freeSrc=function(){Z.close()}),v.Image._makeFromGenerator(he,Ne)},v.Fd=function(Z){return Z?Z_(Z):!1},v.je=function(){return $t&&$t.te&&!$t.te.isDeleted()?$t.te:null}})}(s),function(v){function _(k){return(L(255*k[3])<<24|L(255*k[0])<<16|L(255*k[1])<<8|L(255*k[2])<<0)>>>0}function C(k){if(k&&k._ck)return k;if(k instanceof Float32Array){for(var D=Math.floor(k.length/4),N=new Uint32Array(D),J=0;J<D;J++)N[J]=_(k.slice(4*J,4*(J+1)));return N}if(k instanceof Uint32Array)return k;if(k instanceof Array&&k[0]instanceof Float32Array)return k.map(_)}function O(k){if(k===void 0)return 1;var D=parseFloat(k);return k&&k.indexOf("%")!==-1?D/100:D}function L(k){return Math.round(Math.max(0,Math.min(k||0,255)))}function G(k,D){D&&D._ck||v._free(k)}function K(k,D,N){if(!k||!k.length)return di;if(k&&k._ck)return k.byteOffset;var J=v[D].BYTES_PER_ELEMENT;return N||(N=v._malloc(k.length*J)),v[D].set(k,N/J),N}function Z(k){var D={Nd:di,count:k.length,colorType:v.ColorType.RGBA_F32};if(k instanceof Float32Array)D.Nd=K(k,"HEAPF32"),D.count=k.length/4;else if(k instanceof Uint32Array)D.Nd=K(k,"HEAPU32"),D.colorType=v.ColorType.RGBA_8888;else if(k instanceof Array){if(k&&k.length){for(var N=v._malloc(16*k.length),J=0,me=N/4,Ie=0;Ie<k.length;Ie++)for(var He=0;4>He;He++)v.HEAPF32[me+J]=k[Ie][He],J++;k=N}else k=di;D.Nd=k}else throw"Invalid argument to copyFlexibleColorArray, Not a color array "+typeof k;return D}function he(k){if(!k)return di;var D=er.toTypedArray();if(k.length){if(k.length===6||k.length===9)return K(k,"HEAPF32",jt),k.length===6&&v.HEAPF32.set(mR,6+jt/4),jt;if(k.length===16)return D[0]=k[0],D[1]=k[1],D[2]=k[3],D[3]=k[4],D[4]=k[5],D[5]=k[7],D[6]=k[12],D[7]=k[13],D[8]=k[15],jt;throw"invalid matrix size"}if(k.m11===void 0)throw"invalid matrix argument";return D[0]=k.m11,D[1]=k.m21,D[2]=k.m41,D[3]=k.m12,D[4]=k.m22,D[5]=k.m42,D[6]=k.m14,D[7]=k.m24,D[8]=k.m44,jt}function Oe(k){if(!k)return di;var D=Zr.toTypedArray();if(k.length){if(k.length!==16&&k.length!==6&&k.length!==9)throw"invalid matrix size";return k.length===16?K(k,"HEAPF32",Oa):(D.fill(0),D[0]=k[0],D[1]=k[1],D[3]=k[2],D[4]=k[3],D[5]=k[4],D[7]=k[5],D[10]=1,D[12]=k[6],D[13]=k[7],D[15]=k[8],k.length===6&&(D[12]=0,D[13]=0,D[15]=1),Oa)}if(k.m11===void 0)throw"invalid matrix argument";return D[0]=k.m11,D[1]=k.m21,D[2]=k.m31,D[3]=k.m41,D[4]=k.m12,D[5]=k.m22,D[6]=k.m32,D[7]=k.m42,D[8]=k.m13,D[9]=k.m23,D[10]=k.m33,D[11]=k.m43,D[12]=k.m14,D[13]=k.m24,D[14]=k.m34,D[15]=k.m44,Oa}function Ne(k,D){return K(k,"HEAPF32",D||gn)}function et(k,D,N,J){var me=nc.toTypedArray();return me[0]=k,me[1]=D,me[2]=N,me[3]=J,gn}function mt(k){for(var D=new Float32Array(4),N=0;4>N;N++)D[N]=v.HEAPF32[k/4+N];return D}function xe(k,D){return K(k,"HEAPF32",D||zr)}function xt(k,D){return K(k,"HEAPF32",D||n0)}v.Color=function(k,D,N,J){return J===void 0&&(J=1),v.Color4f(L(k)/255,L(D)/255,L(N)/255,J)},v.ColorAsInt=function(k,D,N,J){return J===void 0&&(J=255),(L(J)<<24|L(k)<<16|L(D)<<8|L(N)<<0&268435455)>>>0},v.Color4f=function(k,D,N,J){return J===void 0&&(J=1),Float32Array.of(k,D,N,J)},Object.defineProperty(v,"TRANSPARENT",{get:function(){return v.Color4f(0,0,0,0)}}),Object.defineProperty(v,"BLACK",{get:function(){return v.Color4f(0,0,0,1)}}),Object.defineProperty(v,"WHITE",{get:function(){return v.Color4f(1,1,1,1)}}),Object.defineProperty(v,"RED",{get:function(){return v.Color4f(1,0,0,1)}}),Object.defineProperty(v,"GREEN",{get:function(){return v.Color4f(0,1,0,1)}}),Object.defineProperty(v,"BLUE",{get:function(){return v.Color4f(0,0,1,1)}}),Object.defineProperty(v,"YELLOW",{get:function(){return v.Color4f(1,1,0,1)}}),Object.defineProperty(v,"CYAN",{get:function(){return v.Color4f(0,1,1,1)}}),Object.defineProperty(v,"MAGENTA",{get:function(){return v.Color4f(1,0,1,1)}}),v.getColorComponents=function(k){return[Math.floor(255*k[0]),Math.floor(255*k[1]),Math.floor(255*k[2]),k[3]]},v.parseColorString=function(k,D){if(k=k.toLowerCase(),k.startsWith("#")){switch(D=255,k.length){case 9:D=parseInt(k.slice(7,9),16);case 7:var N=parseInt(k.slice(1,3),16),J=parseInt(k.slice(3,5),16),me=parseInt(k.slice(5,7),16);break;case 5:D=17*parseInt(k.slice(4,5),16);case 4:N=17*parseInt(k.slice(1,2),16),J=17*parseInt(k.slice(2,3),16),me=17*parseInt(k.slice(3,4),16)}return v.Color(N,J,me,D/255)}return k.startsWith("rgba")?(k=k.slice(5,-1),k=k.split(","),v.Color(+k[0],+k[1],+k[2],O(k[3]))):k.startsWith("rgb")?(k=k.slice(4,-1),k=k.split(","),v.Color(+k[0],+k[1],+k[2],O(k[3]))):k.startsWith("gray(")||k.startsWith("hsl")||!D||(k=D[k],k===void 0)?v.BLACK:k},v.multiplyByAlpha=function(k,D){return k=k.slice(),k[3]=Math.max(0,Math.min(k[3]*D,1)),k},v.Malloc=function(k,D){var N=v._malloc(D*k.BYTES_PER_ELEMENT);return{_ck:!0,length:D,byteOffset:N,Xd:null,subarray:function(J,me){return J=this.toTypedArray().subarray(J,me),J._ck=!0,J},toTypedArray:function(){return this.Xd&&this.Xd.length?this.Xd:(this.Xd=new k(v.HEAPU8.buffer,N,D),this.Xd._ck=!0,this.Xd)}}},v.Free=function(k){v._free(k.byteOffset),k.byteOffset=di,k.toTypedArray=null,k.Xd=null};var jt=di,er,Oa=di,Zr,gn=di,nc,Hs,zr=di,c2,Jo=di,d2,a0=di,u2,s0=di,mf,au=di,p2,n0=di,f2,m2=di,mR=Float32Array.of(0,0,1),di=0;v.onRuntimeInitialized=function(){function k(D,N,J,me,Ie,He,gt){He||(He=4*me.width,me.colorType===v.ColorType.RGBA_F16?He*=2:me.colorType===v.ColorType.RGBA_F32&&(He*=4));var Zt=He*me.height,qt=Ie?Ie.byteOffset:v._malloc(Zt);if(gt?!D._readPixels(me,qt,He,N,J,gt):!D._readPixels(me,qt,He,N,J))return Ie||v._free(qt),null;if(Ie)return Ie.toTypedArray();switch(me.colorType){case v.ColorType.RGBA_8888:case v.ColorType.RGBA_F16:D=new Uint8Array(v.HEAPU8.buffer,qt,Zt).slice();break;case v.ColorType.RGBA_F32:D=new Float32Array(v.HEAPU8.buffer,qt,Zt).slice();break;default:return null}return v._free(qt),D}nc=v.Malloc(Float32Array,4),gn=nc.byteOffset,Zr=v.Malloc(Float32Array,16),Oa=Zr.byteOffset,er=v.Malloc(Float32Array,9),jt=er.byteOffset,p2=v.Malloc(Float32Array,12),n0=p2.byteOffset,f2=v.Malloc(Float32Array,12),m2=f2.byteOffset,Hs=v.Malloc(Float32Array,4),zr=Hs.byteOffset,c2=v.Malloc(Float32Array,4),Jo=c2.byteOffset,d2=v.Malloc(Float32Array,3),a0=d2.byteOffset,u2=v.Malloc(Float32Array,3),s0=u2.byteOffset,mf=v.Malloc(Int32Array,4),au=mf.byteOffset,v.ColorSpace.SRGB=v.ColorSpace._MakeSRGB(),v.ColorSpace.DISPLAY_P3=v.ColorSpace._MakeDisplayP3(),v.ColorSpace.ADOBE_RGB=v.ColorSpace._MakeAdobeRGB(),v.GlyphRunFlags={IsWhiteSpace:v._GlyphRunFlags_isWhiteSpace},v.Path.MakeFromCmds=function(D){var N=K(D,"HEAPF32"),J=v.Path._MakeFromCmds(N,D.length);return G(N,D),J},v.Path.MakeFromVerbsPointsWeights=function(D,N,J){var me=K(D,"HEAPU8"),Ie=K(N,"HEAPF32"),He=K(J,"HEAPF32"),gt=v.Path._MakeFromVerbsPointsWeights(me,D.length,Ie,N.length,He,J&&J.length||0);return G(me,D),G(Ie,N),G(He,J),gt},v.Path.prototype.addArc=function(D,N,J){return D=xe(D),this._addArc(D,N,J),this},v.Path.prototype.addCircle=function(D,N,J,me){return this._addCircle(D,N,J,!!me),this},v.Path.prototype.addOval=function(D,N,J){return J===void 0&&(J=1),D=xe(D),this._addOval(D,!!N,J),this},v.Path.prototype.addPath=function(){var D=Array.prototype.slice.call(arguments),N=D[0],J=!1;if(typeof D[D.length-1]=="boolean"&&(J=D.pop()),D.length===1)this._addPath(N,1,0,0,0,1,0,0,0,1,J);else if(D.length===2)D=D[1],this._addPath(N,D[0],D[1],D[2],D[3],D[4],D[5],D[6]||0,D[7]||0,D[8]||1,J);else if(D.length===7||D.length===10)this._addPath(N,D[1],D[2],D[3],D[4],D[5],D[6],D[7]||0,D[8]||0,D[9]||1,J);else return null;return this},v.Path.prototype.addPoly=function(D,N){var J=K(D,"HEAPF32");return this._addPoly(J,D.length/2,N),G(J,D),this},v.Path.prototype.addRect=function(D,N){return D=xe(D),this._addRect(D,!!N),this},v.Path.prototype.addRRect=function(D,N){return D=xt(D),this._addRRect(D,!!N),this},v.Path.prototype.addVerbsPointsWeights=function(D,N,J){var me=K(D,"HEAPU8"),Ie=K(N,"HEAPF32"),He=K(J,"HEAPF32");this._addVerbsPointsWeights(me,D.length,Ie,N.length,He,J&&J.length||0),G(me,D),G(Ie,N),G(He,J)},v.Path.prototype.arc=function(D,N,J,me,Ie,He){return D=v.LTRBRect(D-J,N-J,D+J,N+J),Ie=(Ie-me)/Math.PI*180-360*!!He,He=new v.Path,He.addArc(D,me/Math.PI*180,Ie),this.addPath(He,!0),He.delete(),this},v.Path.prototype.arcToOval=function(D,N,J,me){return D=xe(D),this._arcToOval(D,N,J,me),this},v.Path.prototype.arcToRotated=function(D,N,J,me,Ie,He,gt){return this._arcToRotated(D,N,J,!!me,!!Ie,He,gt),this},v.Path.prototype.arcToTangent=function(D,N,J,me,Ie){return this._arcToTangent(D,N,J,me,Ie),this},v.Path.prototype.close=function(){return this._close(),this},v.Path.prototype.conicTo=function(D,N,J,me,Ie){return this._conicTo(D,N,J,me,Ie),this},v.Path.prototype.computeTightBounds=function(D){this._computeTightBounds(zr);var N=Hs.toTypedArray();return D?(D.set(N),D):N.slice()},v.Path.prototype.cubicTo=function(D,N,J,me,Ie,He){return this._cubicTo(D,N,J,me,Ie,He),this},v.Path.prototype.dash=function(D,N,J){return this._dash(D,N,J)?this:null},v.Path.prototype.getBounds=function(D){this._getBounds(zr);var N=Hs.toTypedArray();return D?(D.set(N),D):N.slice()},v.Path.prototype.lineTo=function(D,N){return this._lineTo(D,N),this},v.Path.prototype.moveTo=function(D,N){return this._moveTo(D,N),this},v.Path.prototype.offset=function(D,N){return this._transform(1,0,D,0,1,N,0,0,1),this},v.Path.prototype.quadTo=function(D,N,J,me){return this._quadTo(D,N,J,me),this},v.Path.prototype.rArcTo=function(D,N,J,me,Ie,He,gt){return this._rArcTo(D,N,J,me,Ie,He,gt),this},v.Path.prototype.rConicTo=function(D,N,J,me,Ie){return this._rConicTo(D,N,J,me,Ie),this},v.Path.prototype.rCubicTo=function(D,N,J,me,Ie,He){return this._rCubicTo(D,N,J,me,Ie,He),this},v.Path.prototype.rLineTo=function(D,N){return this._rLineTo(D,N),this},v.Path.prototype.rMoveTo=function(D,N){return this._rMoveTo(D,N),this},v.Path.prototype.rQuadTo=function(D,N,J,me){return this._rQuadTo(D,N,J,me),this},v.Path.prototype.stroke=function(D){return D=D||{},D.width=D.width||1,D.miter_limit=D.miter_limit||4,D.cap=D.cap||v.StrokeCap.Butt,D.join=D.join||v.StrokeJoin.Miter,D.precision=D.precision||1,this._stroke(D)?this:null},v.Path.prototype.transform=function(){if(arguments.length===1){var D=arguments[0];this._transform(D[0],D[1],D[2],D[3],D[4],D[5],D[6]||0,D[7]||0,D[8]||1)}else if(arguments.length===6||arguments.length===9)D=arguments,this._transform(D[0],D[1],D[2],D[3],D[4],D[5],D[6]||0,D[7]||0,D[8]||1);else throw"transform expected to take 1 or 9 arguments. Got "+arguments.length;return this},v.Path.prototype.trim=function(D,N,J){return this._trim(D,N,!!J)?this:null},v.Image.prototype.encodeToBytes=function(D,N){var J=v.je();return D=D||v.ImageFormat.PNG,N=N||100,J?this._encodeToBytes(D,N,J):this._encodeToBytes(D,N)},v.Image.prototype.makeShaderCubic=function(D,N,J,me,Ie){return Ie=he(Ie),this._makeShaderCubic(D,N,J,me,Ie)},v.Image.prototype.makeShaderOptions=function(D,N,J,me,Ie){return Ie=he(Ie),this._makeShaderOptions(D,N,J,me,Ie)},v.Image.prototype.readPixels=function(D,N,J,me,Ie){var He=v.je();return k(this,D,N,J,me,Ie,He)},v.Canvas.prototype.clear=function(D){v.Fd(this.Ed),D=Ne(D),this._clear(D)},v.Canvas.prototype.clipRRect=function(D,N,J){v.Fd(this.Ed),D=xt(D),this._clipRRect(D,N,J)},v.Canvas.prototype.clipRect=function(D,N,J){v.Fd(this.Ed),D=xe(D),this._clipRect(D,N,J)},v.Canvas.prototype.concat=function(D){v.Fd(this.Ed),D=Oe(D),this._concat(D)},v.Canvas.prototype.drawArc=function(D,N,J,me,Ie){v.Fd(this.Ed),D=xe(D),this._drawArc(D,N,J,me,Ie)},v.Canvas.prototype.drawAtlas=function(D,N,J,me,Ie,He,gt){if(D&&me&&N&&J&&N.length===J.length){v.Fd(this.Ed),Ie||(Ie=v.BlendMode.SrcOver);var Zt=K(N,"HEAPF32"),qt=K(J,"HEAPF32"),tr=J.length/4,fr=K(C(He),"HEAPU32");if(gt&&"B"in gt&&"C"in gt)this._drawAtlasCubic(D,qt,Zt,fr,tr,Ie,gt.B,gt.C,me);else{let ne=v.FilterMode.Linear,Ge=v.MipmapMode.None;gt&&(ne=gt.filter,"mipmap"in gt&&(Ge=gt.mipmap)),this._drawAtlasOptions(D,qt,Zt,fr,tr,Ie,ne,Ge,me)}G(Zt,N),G(qt,J),G(fr,He)}},v.Canvas.prototype.drawCircle=function(D,N,J,me){v.Fd(this.Ed),this._drawCircle(D,N,J,me)},v.Canvas.prototype.drawColor=function(D,N){v.Fd(this.Ed),D=Ne(D),N!==void 0?this._drawColor(D,N):this._drawColor(D)},v.Canvas.prototype.drawColorInt=function(D,N){v.Fd(this.Ed),this._drawColorInt(D,N||v.BlendMode.SrcOver)},v.Canvas.prototype.drawColorComponents=function(D,N,J,me,Ie){v.Fd(this.Ed),D=et(D,N,J,me),Ie!==void 0?this._drawColor(D,Ie):this._drawColor(D)},v.Canvas.prototype.drawDRRect=function(D,N,J){v.Fd(this.Ed),D=xt(D,n0),N=xt(N,m2),this._drawDRRect(D,N,J)},v.Canvas.prototype.drawImage=function(D,N,J,me){v.Fd(this.Ed),this._drawImage(D,N,J,me||null)},v.Canvas.prototype.drawImageCubic=function(D,N,J,me,Ie,He){v.Fd(this.Ed),this._drawImageCubic(D,N,J,me,Ie,He||null)},v.Canvas.prototype.drawImageOptions=function(D,N,J,me,Ie,He){v.Fd(this.Ed),this._drawImageOptions(D,N,J,me,Ie,He||null)},v.Canvas.prototype.drawImageNine=function(D,N,J,me,Ie){v.Fd(this.Ed),N=K(N,"HEAP32",au),J=xe(J),this._drawImageNine(D,N,J,me,Ie||null)},v.Canvas.prototype.drawImageRect=function(D,N,J,me,Ie){v.Fd(this.Ed),xe(N,zr),xe(J,Jo),this._drawImageRect(D,zr,Jo,me,!!Ie)},v.Canvas.prototype.drawImageRectCubic=function(D,N,J,me,Ie,He){v.Fd(this.Ed),xe(N,zr),xe(J,Jo),this._drawImageRectCubic(D,zr,Jo,me,Ie,He||null)},v.Canvas.prototype.drawImageRectOptions=function(D,N,J,me,Ie,He){v.Fd(this.Ed),xe(N,zr),xe(J,Jo),this._drawImageRectOptions(D,zr,Jo,me,Ie,He||null)},v.Canvas.prototype.drawLine=function(D,N,J,me,Ie){v.Fd(this.Ed),this._drawLine(D,N,J,me,Ie)},v.Canvas.prototype.drawOval=function(D,N){v.Fd(this.Ed),D=xe(D),this._drawOval(D,N)},v.Canvas.prototype.drawPaint=function(D){v.Fd(this.Ed),this._drawPaint(D)},v.Canvas.prototype.drawParagraph=function(D,N,J){v.Fd(this.Ed),this._drawParagraph(D,N,J)},v.Canvas.prototype.drawPatch=function(D,N,J,me,Ie){if(24>D.length)throw"Need 12 cubic points";if(N&&4>N.length)throw"Need 4 colors";if(J&&8>J.length)throw"Need 4 shader coordinates";v.Fd(this.Ed);let He=K(D,"HEAPF32"),gt=N?K(C(N),"HEAPU32"):di,Zt=J?K(J,"HEAPF32"):di;me||(me=v.BlendMode.Modulate),this._drawPatch(He,gt,Zt,me,Ie),G(Zt,J),G(gt,N),G(He,D)},v.Canvas.prototype.drawPath=function(D,N){v.Fd(this.Ed),this._drawPath(D,N)},v.Canvas.prototype.drawPicture=function(D){v.Fd(this.Ed),this._drawPicture(D)},v.Canvas.prototype.drawPoints=function(D,N,J){v.Fd(this.Ed);var me=K(N,"HEAPF32");this._drawPoints(D,me,N.length/2,J),G(me,N)},v.Canvas.prototype.drawRRect=function(D,N){v.Fd(this.Ed),D=xt(D),this._drawRRect(D,N)},v.Canvas.prototype.drawRect=function(D,N){v.Fd(this.Ed),D=xe(D),this._drawRect(D,N)},v.Canvas.prototype.drawRect4f=function(D,N,J,me,Ie){v.Fd(this.Ed),this._drawRect4f(D,N,J,me,Ie)},v.Canvas.prototype.drawShadow=function(D,N,J,me,Ie,He,gt){v.Fd(this.Ed);var Zt=K(Ie,"HEAPF32"),qt=K(He,"HEAPF32");N=K(N,"HEAPF32",a0),J=K(J,"HEAPF32",s0),this._drawShadow(D,N,J,me,Zt,qt,gt),G(Zt,Ie),G(qt,He)},v.getShadowLocalBounds=function(D,N,J,me,Ie,He,gt){return D=he(D),J=K(J,"HEAPF32",a0),me=K(me,"HEAPF32",s0),this._getShadowLocalBounds(D,N,J,me,Ie,He,zr)?(N=Hs.toTypedArray(),gt?(gt.set(N),gt):N.slice()):null},v.Canvas.prototype.drawTextBlob=function(D,N,J,me){v.Fd(this.Ed),this._drawTextBlob(D,N,J,me)},v.Canvas.prototype.drawVertices=function(D,N,J){v.Fd(this.Ed),this._drawVertices(D,N,J)},v.Canvas.prototype.getDeviceClipBounds=function(D){this._getDeviceClipBounds(au);var N=mf.toTypedArray();return D?D.set(N):D=N.slice(),D},v.Canvas.prototype.getLocalToDevice=function(){this._getLocalToDevice(Oa);for(var D=Oa,N=Array(16),J=0;16>J;J++)N[J]=v.HEAPF32[D/4+J];return N},v.Canvas.prototype.getTotalMatrix=function(){this._getTotalMatrix(jt);for(var D=Array(9),N=0;9>N;N++)D[N]=v.HEAPF32[jt/4+N];return D},v.Canvas.prototype.makeSurface=function(D){return D=this._makeSurface(D),D.Ed=this.Ed,D},v.Canvas.prototype.readPixels=function(D,N,J,me,Ie){return v.Fd(this.Ed),k(this,D,N,J,me,Ie)},v.Canvas.prototype.saveLayer=function(D,N,J,me){return N=xe(N),this._saveLayer(D||null,N,J||null,me||0)},v.Canvas.prototype.writePixels=function(D,N,J,me,Ie,He,gt,Zt){if(D.byteLength%(N*J))throw"pixels length must be a multiple of the srcWidth * srcHeight";v.Fd(this.Ed);var qt=D.byteLength