text: var t,e;t="undefined"!=typeof self?self:this,e=function(){return function(z){var G={};function i(V){if(G[V])return G[V].exports;var H=G[V]={i:V,l:!1,exports:{}};return z[V].call(H.exports,H,H.exports,i),H.l=!0,H.exports}return i.m=z,i.c=G,i.d=function(z,G,V){i.o(z,G)||Object.defineProperty(z,G,{configurable:!1,enumerable:!0,get:V})},i.r=function(z){Object.defineProperty(z,"__esModule",{value:!0})},i.n=function(z){var G=z&&z.__esModule?function(){return z.default}:function(){return z};return i.d(G,"a",G),G},i.o=function(z,G){return Object.prototype.hasOwnProperty.call(z,G)},i.p="",i(i.s=148)}([function(z,G,V){V.r(G),function(z){var H=V(93),n=function(){if(!(this instanceof n))throw new Error("constructor needs to be called with the 'new' keyword")};
  /**
             *  Tone.js
             *  @author Yotam Mann
             *  @license http://opensource.org/licenses/MIT MIT License
             *  @copyright 2014-2019 Yotam Mann
             */n.prototype.toString=function(){for(var z in n){var G=z[0].match(/^[A-Z]$/),V=n[z]===this.constructor;if(n.isFunction(n[z])&&G&&V)return z}return"Tone"},n.prototype.dispose=function(){return this},n.prototype.set=function(z,G){if(n.isString(z)){var V={};V[z]=G,z=V}t:for(var H in z){G=z[H];var W=this;if(-1!==H.indexOf(".")){for(var K=H.split("."),Z=0;Z<K.length-1;Z++)if((W=W[K[Z]])instanceof n){K.splice(0,Z+1);var it=K.join(".");W.set(it,G);continue t}H=K[K.length-1]}var ot=W[H];n.isUndef(ot)||(n.Signal&&ot instanceof n.Signal||n.Param&&ot instanceof n.Param||ot instanceof AudioParam?ot.value!==G&&(ot.value=G):n.TimeBase&&ot instanceof n.TimeBase?W[H]=G:ot instanceof n?ot.set(G):ot!==G&&(W[H]=G))}return this},n.prototype.get=function(z){n.isUndef(z)?z=this._collectDefaults(this.constructor):n.isString(z)&&(z=[z]);for(var G={},V=0;V<z.length;V++){var H=z[V],W=this,K=G;if(-1!==H.indexOf(".")){for(var Z=H.split("."),it=0;it<Z.length-1;it++){var ot=Z[it];K[ot]=K[ot]||{},K=K[ot],W=W[ot]}H=Z[Z.length-1]}var rt=W[H];n.isObject(z[H])?K[H]=rt.get():n.Signal&&rt instanceof n.Signal||n.Param&&rt instanceof n.Param||rt instanceof AudioParam?K[H]=rt.value:rt instanceof n?K[H]=rt.get():!n.isFunction(rt)&&n.isDefined(rt)&&(K[H]=rt)}return G},n.prototype._collectDefaults=function(z){var G=[];if(n.isDefined(z.defaults)&&(G=Object.keys(z.defaults)),n.isDefined(z._super))for(var V=this._collectDefaults(z._super),H=0;H<V.length;H++)-1===G.indexOf(V[H])&&G.push(V[H]);return G},n.defaults=function(z,G,V){var H={};if(1===z.length&&n.isObject(z[0]))H=z[0];else for(var W=0;W<G.length;W++)H[G[W]]=z[W];return n.isDefined(V.defaults)?n.defaultArg(H,V.defaults):n.isObject(V)?n.defaultArg(H,V):H},n.defaultArg=function(z,G){if(n.isObject(z)&&n.isObject(G)){var V={};for(var H in z)V[H]=n.defaultArg(G[H],z[H]);for(var W in G)V[W]=n.defaultArg(z[W],G[W]);return V}return n.isUndef(z)?G:z},n.prototype.log=function(){if(this.debug||this.toString()===n.global.TONE_DEBUG_CLASS){var z=Array.from(arguments);z.unshift(this.toString()+":"),console.log.apply(void 0,z)}},n.prototype.assert=function(z,G){if(!z)throw new Error(G)},n.connectSeries=function(){for(var z=arguments[0],G=1;G<arguments.length;G++){var V=arguments[G];n.connect(z,V),z=V}return n},n.connect=function(z,G,V,H){for(;n.isDefined(G.input);)n.isArray(G.input)?(H=n.defaultArg(H,0),G=G.input[H],H=0):G.input&&(G=G.input);return G instanceof AudioParam?z.connect(G,V):G instanceof AudioNode&&z.connect(G,V,H),n},n.disconnect=function(z,G,V,H){if(G){for(var W=!1;!W;)n.isArray(G.input)?(n.isDefined(H)?n.disconnect(z,G.input[H],V):G.input.forEach((function(G){try{n.disconnect(z,G,V)}catch(z){}})),W=!0):G.input?G=G.input:W=!0;G instanceof AudioParam?z.disconnect(G,V):G instanceof AudioNode&&z.disconnect(G,V,H)}else z.disconnect();return n},n.isUndef=function(z){return void 0===z},n.isDefined=function(z){return!n.isUndef(z)},n.isFunction=function(z){return"function"==typeof z},n.isNumber=function(z){return"number"==typeof z},n.isObject=function(z){return"[object Object]"===Object.prototype.toString.call(z)&&z.constructor===Object},n.isBoolean=function(z){return"boolean"==typeof z},n.isArray=function(z){return Array.isArray(z)},n.isString=function(z){return"string"==typeof z},n.isNote=function(z){return n.isString(z)&&/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i.test(z)},n.noOp=function(){},n.prototype._readOnly=function(z){if(Array.isArray(z))for(var G=0;G<z.length;G++)this._readOnly(z[G]);else Object.defineProperty(this,z,{writable:!1,enumerable:!0})},n.prototype._writable=function(z){if(Array.isArray(z))for(var G=0;G<z.length;G++)this._writable(z[G]);else Object.defineProperty(this,z,{writable:!0})},n.State={Started:"started",Stopped:"stopped",Paused:"paused"},n.global=n.isUndef(z)?window:z,n.equalPowerScale=function(z){var G=.5*Math.PI;return Math.sin(z*G)},n.dbToGain=function(z){return Math.pow(10,z/20)},n.gainToDb=function(z){return Math.log(z)/Math.LN10*20},n.intervalToFrequencyRatio=function(z){return Math.pow(2,z/12)},n.prototype.now=function(){return n.context.now()},n.now=function(){return n.context.now()},n.prototype.immediate=function(){return n.context.currentTime},n.immediate=function(){return n.context.currentTime},n.extend=function(z,G){function i(){}n.isUndef(G)&&(G=n),i.prototype=G.prototype,z.prototype=new i,z.prototype.constructor=z,z._super=G},n._audioContext=null,n.start=function(){return n.context.resume()},Object.defineProperty(n,"context",{get:function(){return n._audioContext},set:function(z){z.isContext?n._audioContext=z:n._audioContext=new n.Context(z),n.Context.emit("init",n._audioContext)}}),Object.defineProperty(n.prototype,"context",{get:function(){return n.context}}),n.setContext=function(z){n.context=z},Object.defineProperty(n.prototype,"blockTime",{get:function(){return 128/this.context.sampleRate}}),Object.defineProperty(n.prototype,"sampleTime",{get:function(){return 1/this.context.sampleRate}}),Object.defineProperty(n,"supported",{get:function(){var z=n.global.hasOwnProperty("AudioContext")||n.global.hasOwnProperty("webkitAudioContext"),G=n.global.hasOwnProperty("Promise");return z&&G}}),Object.defineProperty(n,"initialized",{get:function(){return Boolean(n.context)}}),n.getContext=function(z){if(n.initialized)z(n.context);else{var e=function(){z(n.context),n.Context.off("init",e)};n.Context.on("init",e)}return n},n.version=H.a,G.default=n}.call(this,V(147))},function(z,G,V){V.r(G);var H=V(0);if(V(20),H.default.supported){var W=new OfflineAudioContext(2,1,44100),K=W.createGain(),Z=W.createGain();if(K.connect(Z)!==Z){var it=AudioNode.prototype.connect;AudioNode.prototype.connect=function(){return it.apply(this,arguments),arguments[0]}}}H.default.AudioNode=function(){H.default.call(this);var z=H.default.defaults(arguments,["context"],{context:H.default.context});this._context=z.context},H.default.extend(H.default.AudioNode),Object.defineProperty(H.default.AudioNode.prototype,"context",{get:function(){return this._context}}),H.default.AudioNode.prototype.createInsOuts=function(z,G){1===z?this.input=this.context.createGain():z>1&&(this.input=new Array(z)),1===G?this.output=this.context.createGain():G>1&&(this.output=new Array(G))},Object.defineProperty(H.default.AudioNode.prototype,"channelCount",{get:function(){return this.output.channelCount},set:function(z){return this.output.channelCount=z}}),Object.defineProperty(H.default.AudioNode.prototype,"channelCountMode",{get:function(){return this.output.channelCountMode},set:function(z){return this.output.channelCountMode=z}}),Object.defineProperty(H.default.AudioNode.prototype,"channelInterpretation",{get:function(){return this.output.channelInterpretation},set:function(z){return this.output.channelInterpretation=z}}),Object.defineProperty(H.default.AudioNode.prototype,"numberOfInputs",{get:function(){return this.input?H.default.isArray(this.input)?this.input.length:1:0}}),Object.defineProperty(H.default.AudioNode.prototype,"numberOfOutputs",{get:function(){return this.output?H.default.isArray(this.output)?this.output.length:1:0}}),H.default.AudioNode.prototype.connect=function(z,G,V){return H.default.isArray(this.output)?(G=H.default.defaultArg(G,0),this.output[G].connect(z,0,V)):H.default.connect(this.output,z,G,V),this},H.default.AudioNode.prototype.disconnect=function(z,G,V){return H.default.isArray(this.output)?(G=H.default.defaultArg(G,0),this.output[G].disconnect(z,0,V)):H.default.disconnect(this.output,z,G,V),this},H.default.AudioNode.prototype.chain=function(){var z=Array.from(arguments);return z.unshift(this),H.default.connectSeries.apply(void 0,z),this},H.default.AudioNode.prototype.fan=function(){for(var z=0;z<arguments.length;z++)this.connect(arguments[z]);return this},H.default.AudioNode.prototype.dispose=function(){return H.default.isDefined(this.input)&&(this.input instanceof AudioNode&&this.input.disconnect(),this.input=null),H.default.isDefined(this.output)&&(this.output instanceof AudioNode&&this.output.disconnect(),this.output=null),this._context=null,this},G.default=H.default.AudioNode},function(z,G,V){V.r(G);var H=V(0);if(V(4),V(14),V(30),V(44),V(20),V(3),H.default.supported&&!H.default.global.AudioContext.prototype.createConstantSource){var n=function(z){this.context=z;for(var G=z.createBuffer(1,128,z.sampleRate),V=G.getChannelData(0),H=0;H<V.length;H++)V[H]=1;this._bufferSource=z.createBufferSource(),this._bufferSource.channelCount=1,this._bufferSource.channelCountMode="explicit",this._bufferSource.buffer=G,this._bufferSource.loop=!0;var W=this._output=z.createGain();this.offset=W.gain,this._bufferSource.connect(W)};n.prototype.start=function(z){return this._bufferSource.start(z),this},n.prototype.stop=function(z){return this._bufferSource.stop(z),this},n.prototype.connect=function(){return this._output.connect.apply(this._output,arguments),this},n.prototype.disconnect=function(){return this._output.disconnect.apply(this._output,arguments),this},AudioContext.prototype.createConstantSource=function(){return new n(this)},H.default.Context.prototype.createConstantSource=function(){return new n(this)}}H.default.Signal=function(){var z=H.default.defaults(arguments,["value","units"],H.default.Signal);H.default.Param.call(this,z),this._constantSource=this.context.createConstantSource(),this._constantSource.start(0),this._param=this._constantSource.offset,this.value=z.value,this.output=this._constantSource,this.input=this._param=this.output.offset},H.default.extend(H.default.Signal,H.default.Param),H.default.Signal.defaults={value:0,units:H.default.Type.Default,convert:!0},H.default.Signal.prototype.connect=H.default.SignalBase.prototype.connect,H.default.Signal.prototype.disconnect=H.default.SignalBase.prototype.disconnect,H.default.Signal.prototype.getValueAtTime=function(z){return this._param.getValueAtTime?this._param.getValueAtTime(z):H.default.Param.prototype.getValueAtTime.call(this,z)},H.default.Signal.prototype.dispose=function(){return H.default.Param.prototype.dispose.call(this),this._constantSource.stop(),this._constantSource.disconnect(),this._constantSource=null,this},G.default=H.default.Signal},function(z,G,V){V.r(G);var H=V(0);V(14),V(4),V(1),H.default.Gain=function(){var z=H.default.defaults(arguments,["gain","units"],H.default.Gain);H.default.AudioNode.call(this,z),this.input=this.output=this._gainNode=this.context.createGain(),this.gain=new H.default.Param({param:this._gainNode.gain,units:z.units,value:z.gain,convert:z.convert}),this._readOnly("gain")},H.default.extend(H.default.Gain,H.default.AudioNode),H.default.Gain.defaults={gain:1,convert:!0},H.default.Gain.prototype.dispose=function(){H.default.AudioNode.prototype.dispose.call(this),this._gainNode.disconnect(),this._gainNode=null,this._writable("gain"),this.gain.dispose(),this.gain=null},G.default=H.default.Gain},function(z,G,V){V.r(G);var H=V(0);V(63),V(46),V(45),V(20),H.default.Type={Default:"number",Time:"time",Frequency:"frequency",TransportTime:"transportTime",Ticks:"ticks",NormalRange:"normalRange",AudioRange:"audioRange",Decibels:"db",Interval:"interval",BPM:"bpm",Positive:"positive",Gain:"gain",Cents:"cents",Degrees:"degrees",MIDI:"midi",BarsBeatsSixteenths:"barsBeatsSixteenths",Samples:"samples",Hertz:"hertz",Note:"note",Milliseconds:"milliseconds",Seconds:"seconds",Notation:"notation"},H.default.prototype.toSeconds=function(z){return H.default.isNumber(z)?z:H.default.isUndef(z)?this.now():H.default.isString(z)||H.default.isObject(z)?new H.default.Time(z).toSeconds():z instanceof H.default.TimeBase?z.toSeconds():void 0},H.default.prototype.toFrequency=function(z){return H.default.isNumber(z)?z:H.default.isString(z)||H.default.isUndef(z)||H.default.isObject(z)?new H.default.Frequency(z).valueOf():z instanceof H.default.TimeBase?z.toFrequency():void 0},H.default.prototype.toTicks=function(z){return H.default.isNumber(z)||H.default.isString(z)||H.default.isObject(z)?new H.default.TransportTime(z).toTicks():H.default.isUndef(z)?H.default.Transport.ticks:z instanceof H.default.TimeBase?z.toTicks():void 0},G.default=H.default},function(z,G,V){V.r(G);var H=V(0);V(14),V(3),V(30),H.default.Multiply=function(z){H.default.Signal.call(this),this.createInsOuts(2,0),this._mult=this.input[0]=this.output=new H.default.Gain,this._param=this.input[1]=this.output.gain,this.value=H.default.defaultArg(z,0)},H.default.extend(H.default.Multiply,H.default.Signal),H.default.Multiply.prototype.dispose=function(){return H.default.Signal.prototype.dispose.call(this),this._mult.dispose(),this._mult=null,this._param=null,this},G.default=H.default.Multiply},function(z,G,V){V.r(G);var H=V(0);V(16),V(27),V(40),V(4),V(34),V(2),V(1),H.default.Source=function(z){z=H.default.defaultArg(z,H.default.Source.defaults),H.default.AudioNode.call(this),this._volume=this.output=new H.default.Volume(z.volume),this.volume=this._volume.volume,this._readOnly("volume"),this._state=new H.default.TimelineState(H.default.State.Stopped),this._state.memory=100,this._synced=!1,this._scheduled=[],this._volume.output.output.channelCount=2,this._volume.output.output.channelCountMode="explicit",this.mute=z.mute},H.default.extend(H.default.Source,H.default.AudioNode),H.default.Source.defaults={volume:0,mute:!1},Object.defineProperty(H.default.Source.prototype,"state",{get:function(){return this._synced?H.default.Transport.state===H.default.State.Started?this._state.getValueAtTime(H.default.Transport.seconds):H.default.State.Stopped:this._state.getValueAtTime(this.now())}}),Object.defineProperty(H.default.Source.prototype,"mute",{get:function(){return this._volume.mute},set:function(z){this._volume.mute=z}}),H.default.Source.prototype._start=H.default.noOp,H.default.Source.prototype.restart=H.default.noOp,H.default.Source.prototype._stop=H.default.noOp,H.default.Source.prototype.start=function(z,G,V){if(H.default.isUndef(z)&&this._synced?z=H.default.Transport.seconds:(z=this.toSeconds(z),this._synced||(z=Math.max(z,this.context.currentTime))),this._state.getValueAtTime(z)===H.default.State.Started)this._state.cancel(z),this._state.setStateAtTime(H.default.State.Started,z),this.restart(z,G,V);else if(this._state.setStateAtTime(H.default.State.Started,z),this._synced){var W=this._state.get(z);W.offset=H.default.defaultArg(G,0),W.duration=V;var K=H.default.Transport.schedule(function(z){this._start(z,G,V)}.bind(this),z);this._scheduled.push(K),H.default.Transport.state===H.default.State.Started&&this._syncedStart(this.now(),H.default.Transport.seconds)}else this._start.apply(this,arguments);return this},H.default.Source.prototype.stop=function(z){if(H.default.isUndef(z)&&this._synced?z=H.default.Transport.seconds:(z=this.toSeconds(z),z=Math.max(z,this.context.currentTime)),this._synced){var G=H.default.Transport.schedule(this._stop.bind(this),z);this._scheduled.push(G)}else this._stop.apply(this,arguments);return this._state.cancel(z),this._state.setStateAtTime(H.default.State.Stopped,z),this},H.default.Source.prototype.sync=function(){return this._synced=!0,this._syncedStart=function(z,G){if(G>0){var V=this._state.get(G);if(V&&V.state===H.default.State.Started&&V.time!==G){var W,K=G-this.toSeconds(V.time);V.duration&&(W=this.toSeconds(V.duration)-K),this._start(z,this.toSeconds(V.offset)+K,W)}}}.bind(this),this._syncedStop=function(z){var G=H.default.Transport.getSecondsAtTime(Math.max(z-this.sampleTime,0));this._state.getValueAtTime(G)===H.default.State.Started&&this._stop(z)}.bind(this),H.default.Transport.on("start loopStart",this._syncedStart),H.default.Transport.on("stop pause loopEnd",this._syncedStop),this},H.default.Source.prototype.unsync=function(){this._synced&&(H.default.Transport.off("stop pause loopEnd",this._syncedStop),H.default.Transport.off("start loopStart",this._syncedStart)),this._synced=!1;for(var z=0;z<this._scheduled.length;z++){var G=this._scheduled[z];H.default.Transport.clear(G)}return this._scheduled=[],this._state.cancel(0),this},H.default.Source.prototype.dispose=function(){H.default.AudioNode.prototype.dispose.call(this),this.unsync(),this._scheduled=null,this._writable("volume"),this._volume.dispose(),this._volume=null,this.volume=null,this._state.dispose(),this._state=null},G.default=H.default.Source},function(z,G,V){V.r(G);var H=V(0);if(V(30),V(44),H.default.supported&&!H.default.global.AudioContext.prototype._native_createWaveShaper){var W=navigator.userAgent.toLowerCase();if(W.includes("safari")&&!W.includes("chrome")){var o=function(z){for(var G in this._internalNode=this.input=this.output=z._native_createWaveShaper(),this._curve=null,this._internalNode)this._defineProperty(this._internalNode,G)};Object.defineProperty(o.prototype,"curve",{get:function(){return this._curve},set:function(z){this._curve=z;var G=new Float32Array(z.length+1);G.set(z,1),G[0]=z[0],this._internalNode.curve=G}}),o.prototype._defineProperty=function(z,G){H.default.isUndef(this[G])&&Object.defineProperty(this,G,{get:function(){return"function"==typeof z[G]?z[G].bind(z):z[G]},set:function(V){z[G]=V}})},H.default.global.AudioContext.prototype._native_createWaveShaper=H.default.global.AudioContext.prototype.createWaveShaper,H.default.global.AudioContext.prototype.createWaveShaper=function(){return new o(this)}}}H.default.WaveShaper=function(z,G){H.default.SignalBase.call(this),this._shaper=this.input=this.output=this.context.createWaveShaper(),this._curve=null,Array.isArray(z)?this.curve=z:isFinite(z)||H.default.isUndef(z)?this._curve=new Float32Array(H.default.defaultArg(z,1024)):H.default.isFunction(z)&&(this._curve=new Float32Array(H.default.defaultArg(G,1024)),this.setMap(z))},H.default.extend(H.default.WaveShaper,H.default.SignalBase),H.default.WaveShaper.prototype.setMap=function(z){for(var G=new Array(this._curve.length),V=0,H=this._curve.length;V<H;V++){var W=V/(H-1)*2-1;G[V]=z(W,V)}return this.curve=G,this},Object.defineProperty(H.default.WaveShaper.prototype,"curve",{get:function(){return this._shaper.curve},set:function(z){this._curve=new Float32Array(z),this._shaper.curve=this._curve}}),Object.defineProperty(H.default.WaveShaper.prototype,"oversample",{get:function(){return this._shaper.oversample},set:function(z){if(!["none","2x","4x"].includes(z))throw new RangeError("Tone.WaveShaper: oversampling must be either 'none', '2x', or '4x'");this._shaper.oversample=z}}),H.default.WaveShaper.prototype.dispose=function(){return H.default.SignalBase.prototype.dispose.call(this),this._shaper.disconnect(),this._shaper=null,this._curve=null,this},G.default=H.default.WaveShaper},function(z,G,V){V.r(G);var H=V(0);V(23),V(1),H.default.Effect=function(){var z=H.default.defaults(arguments,["wet"],H.default.Effect);H.default.AudioNode.call(this),this.createInsOuts(1,1),this._dryWet=new H.default.CrossFade(z.wet),this.wet=this._dryWet.fade,this.effectSend=new H.default.Gain,this.effectReturn=new H.default.Gain,H.default.connect(this.input,this._dryWet.a),H.default.connect(this.input,this.effectSend),this.effectReturn.connect(this._dryWet.b),this._dryWet.connect(this.output),this._readOnly(["wet"])},H.default.extend(H.default.Effect,H.default.AudioNode),H.default.Effect.defaults={wet:1},H.default.Effect.prototype.connectEffect=function(z){return this.effectSend.chain(z,this.effectReturn),this},H.default.Effect.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._dryWet.dispose(),this._dryWet=null,this.effectSend.dispose(),this.effectSend=null,this.effectReturn.dispose(),this.effectReturn=null,this._writable(["wet"]),this.wet=null,this},G.default=H.default.Effect},function(z,G,V){V.r(G);var H=V(0);V(2),V(1),H.default.Filter=function(){var z=H.default.defaults(arguments,["frequency","type","rolloff"],H.default.Filter);H.default.AudioNode.call(this),this.createInsOuts(1,1),this._filters=[],this.frequency=new H.default.Signal(z.frequency,H.default.Type.Frequency),this.detune=new H.default.Signal(0,H.default.Type.Cents),this.gain=new H.default.Signal({value:z.gain,convert:!0,type:H.default.Type.Decibels}),this.Q=new H.default.Signal(z.Q),this._type=z.type,this._rolloff=z.rolloff,this.rolloff=z.rolloff,this._readOnly(["detune","frequency","gain","Q"])},H.default.extend(H.default.Filter,H.default.AudioNode),H.default.Filter.defaults={type:"lowpass",frequency:350,rolloff:-12,Q:1,gain:0},Object.defineProperty(H.default.Filter.prototype,"type",{get:function(){return this._type},set:function(z){if(-1===["lowpass","highpass","bandpass","lowshelf","highshelf","notch","allpass","peaking"].indexOf(z))throw new TypeError("Tone.Filter: invalid type "+z);this._type=z;for(var G=0;G<this._filters.length;G++)this._filters[G].type=z}}),Object.defineProperty(H.default.Filter.prototype,"rolloff",{get:function(){return this._rolloff},set:function(z){z=parseInt(z,10);var G=[-12,-24,-48,-96].indexOf(z);if(-1===G)throw new RangeError("Tone.Filter: rolloff can only be -12, -24, -48 or -96");G+=1,this._rolloff=z,this.input.disconnect();for(var V=0;V<this._filters.length;V++)this._filters[V].disconnect(),this._filters[V]=null;this._filters=new Array(G);for(var W=0;W<G;W++){var K=this.context.createBiquadFilter();K.type=this._type,this.frequency.connect(K.frequency),this.detune.connect(K.detune),this.Q.connect(K.Q),this.gain.connect(K.gain),this._filters[W]=K}var Z=[this.input].concat(this._filters).concat([this.output]);H.default.connectSeries.apply(H.default,Z)}}),H.default.Filter.prototype.getFrequencyResponse=function(z){z=H.default.defaultArg(z,128);for(var G=new Float32Array(z).map((function(){return 1})),V=new Float32Array(z),W=0;W<z;W++){var K=19980*Math.pow(W/z,2)+20;V[W]=K}var Z=new Float32Array(z),it=new Float32Array(z);return this._filters.forEach(function(){var z=this.context.createBiquadFilter();z.type=this._type,z.Q.value=this.Q.value,z.frequency.value=this.frequency.value,z.gain.value=this.gain.value,z.getFrequencyResponse(V,Z,it),Z.forEach((function(z,V){G[V]*=z}))}.bind(this)),G},H.default.Filter.prototype.dispose=function(){H.default.AudioNode.prototype.dispose.call(this);for(var z=0;z<this._filters.length;z++)this._filters[z].disconnect(),this._filters[z]=null;return this._filters=null,this._writable(["detune","frequency","gain","Q"]),this.frequency.dispose(),this.Q.dispose(),this.frequency=null,this.Q=null,this.detune.dispose(),this.detune=null,this.gain.dispose(),this.gain=null,this},G.default=H.default.Filter},function(z,G,V){V.r(G);var H=V(0);V(1),H.default.Merge=function(z){z=H.default.defaultArg(z,2),H.default.AudioNode.call(this),this.createInsOuts(z,0),this._merger=this.output=this.context.createChannelMerger(z);for(var G=0;G<z;G++)this.input[G]=new H.default.Gain,this.input[G].connect(this._merger,0,G),this.input[G].channelCount=1,this.input[G].channelCountMode="explicit";this.left=this.input[0],this.right=this.input[1]},H.default.extend(H.default.Merge,H.default.AudioNode),H.default.Merge.prototype.dispose=function(){return this.input.forEach((function(z){z.dispose()})),H.default.AudioNode.prototype.dispose.call(this),this.left=null,this.right=null,this._merger.disconnect(),this._merger=null,this},G.default=H.default.Merge},function(z,G,V){V.r(G);var H=V(0);V(35),V(4),H.default.supported&&(AudioBuffer.prototype.copyToChannel||(AudioBuffer.prototype.copyToChannel=function(z,G,V){var H=this.getChannelData(G);V=V||0;for(var W=0;W<H.length;W++)H[W+V]=z[W]},AudioBuffer.prototype.copyFromChannel=function(z,G,V){var H=this.getChannelData(G);V=V||0;for(var W=0;W<z.length;W++)z[W]=H[W+V]})),H.default.Buffer=function(){var z=H.default.defaults(arguments,["url","onload","onerror"],H.default.Buffer);H.default.call(this),this._buffer=null,this._reversed=z.reverse,this._xhr=null,this.onload=H.default.noOp,z.url instanceof AudioBuffer||z.url instanceof H.default.Buffer?(this.set(z.url),this.loaded||(this.onload=z.onload)):H.default.isString(z.url)&&this.load(z.url).then(z.onload).catch(z.onerror)},H.default.extend(H.default.Buffer),H.default.Buffer.defaults={url:void 0,reverse:!1,onload:H.default.noOp,onerror:H.default.noOp},H.default.Buffer.prototype.set=function(z){return z instanceof H.default.Buffer?z.loaded?this._buffer=z.get():z.onload=function(){this.set(z),this.onload(this)}.bind(this):this._buffer=z,this._reversed&&this._reverse(),this},H.default.Buffer.prototype.get=function(){return this._buffer},H.default.Buffer.prototype.load=function(z,G,V){return new Promise(function(W,K){this._xhr=H.default.Buffer.load(z,function(z){this._xhr=null,this.set(z),W(this),this.onload(this),G&&G(this)}.bind(this),function(z){this._xhr=null,K(z),V&&V(z)}.bind(this))}.bind(this))},H.default.Buffer.prototype.dispose=function(){return H.default.prototype.dispose.call(this),this._buffer=null,this._xhr&&(H.default.Buffer._removeFromDownloadQueue(this._xhr),this._xhr.abort(),this._xhr=null),this},Object.defineProperty(H.default.Buffer.prototype,"loaded",{get:function(){return this.length>0}}),Object.defineProperty(H.default.Buffer.prototype,"duration",{get:function(){return this._buffer?this._buffer.duration:0}}),Object.defineProperty(H.default.Buffer.prototype,"length",{get:function(){return this._buffer?this._buffer.length:0}}),Object.defineProperty(H.default.Buffer.prototype,"numberOfChannels",{get:function(){return this._buffer?this._buffer.numberOfChannels:0}}),H.default.Buffer.prototype.fromArray=function(z){var G=z[0].length>0,V=G?z.length:1,H=G?z[0].length:z.length,W=this.context.createBuffer(V,H,this.context.sampleRate);G||1!==V||(z=[z]);for(var K=0;K<V;K++)W.copyToChannel(z[K],K);return this._buffer=W,this},H.default.Buffer.prototype.toMono=function(z){if(H.default.isNumber(z))this.fromArray(this.toArray(z));else{for(var G=new Float32Array(this.length),V=this.numberOfChannels,W=0;W<V;W++)for(var K=this.toArray(W),Z=0;Z<K.length;Z++)G[Z]+=K[Z];G=G.map((function(z){return z/V})),this.fromArray(G)}return this},H.default.Buffer.prototype.toArray=function(z){if(H.default.isNumber(z))return this.getChannelData(z);if(1===this.numberOfChannels)return this.toArray(0);for(var G=[],V=0;V<this.numberOfChannels;V++)G[V]=this.getChannelData(V);return G},H.default.Buffer.prototype.getChannelData=function(z){return this._buffer.getChannelData(z)},H.default.Buffer.prototype.slice=function(z,G){G=H.default.defaultArg(G,this.duration);for(var V=Math.floor(this.context.sampleRate*this.toSeconds(z)),W=Math.floor(this.context.sampleRate*this.toSeconds(G)),K=[],Z=0;Z<this.numberOfChannels;Z++)K[Z]=this.toArray(Z).slice(V,W);return(new H.default.Buffer).fromArray(K)},H.default.Buffer.prototype._reverse=function(){if(this.loaded)for(var z=0;z<this.numberOfChannels;z++)Array.prototype.reverse.call(this.getChannelData(z));return this},Object.defineProperty(H.default.Buffer.prototype,"reverse",{get:function(){return this._reversed},set:function(z){this._reversed!==z&&(this._reversed=z,this._reverse())}}),H.default.Emitter.mixin(H.default.Buffer),H.default.Buffer._downloadQueue=[],H.default.Buffer.baseUrl="",H.default.Buffer.fromArray=function(z){return(new H.default.Buffer).fromArray(z)},H.default.Buffer.fromUrl=function(z){var G=new H.default.Buffer;return G.load(z).then((function(){return G}))},H.default.Buffer._removeFromDownloadQueue=function(z){var G=H.default.Buffer._downloadQueue.indexOf(z);-1!==G&&H.default.Buffer._downloadQueue.splice(G,1)},H.default.Buffer.load=function(z,G,V){G=H.default.defaultArg(G,H.default.noOp);var W=z.match(/\[(.+\|?)+\]$/);if(W){for(var K=W[1].split("|"),Z=K[0],it=0;it<K.length;it++)if(H.default.Buffer.supportsType(K[it])){Z=K[it];break}z=z.replace(W[0],Z)}function l(z){if(H.default.Buffer._removeFromDownloadQueue(ot),H.default.Buffer.emit("error",z),!V)throw z;V(z)}function u(){for(var z=0,G=0;G<H.default.Buffer._downloadQueue.length;G++)z+=H.default.Buffer._downloadQueue[G].progress;H.default.Buffer.emit("progress",z/H.default.Buffer._downloadQueue.length)}var ot=new XMLHttpRequest;return ot.open("GET",H.default.Buffer.baseUrl+z,!0),ot.responseType="arraybuffer",ot.progress=0,H.default.Buffer._downloadQueue.push(ot),ot.addEventListener("load",(function(){200===ot.status?H.default.context.decodeAudioData(ot.response).then((function(z){ot.progress=1,u(),G(z),H.default.Buffer._removeFromDownloadQueue(ot),0===H.default.Buffer._downloadQueue.length&&H.default.Buffer.emit("load")})).catch((function(){H.default.Buffer._removeFromDownloadQueue(ot),l("Tone.Buffer: could not decode audio data: "+z)})):l("Tone.Buffer: could not locate file: "+z)})),ot.addEventListener("error",l),ot.addEventListener("progress",(function(z){z.lengthComputable&&(ot.progress=z.loaded/z.total*.95,u())})),ot.send(),ot},H.default.Buffer.cancelDownloads=function(){return H.default.Buffer._downloadQueue.slice().forEach((function(z){H.default.Buffer._removeFromDownloadQueue(z),z.abort()})),H.default.Buffer},H.default.Buffer.supportsType=function(z){var G=z.split(".");return G=G[G.length-1],""!==document.createElement("audio").canPlayType("audio/"+G)},H.default.loaded=function(){var z,G;function i(){H.default.Buffer.off("load",z),H.default.Buffer.off("error",G)}return new Promise((function(V,W){z=function(){V()},G=function(){W()},H.default.Buffer.on("load",z),H.default.Buffer.on("error",G)})).then(i).catch((function(z){throw i(),new Error(z)}))},G.default=H.default.Buffer},function(z,G,V){V.r(G);var H=V(0);V(17),V(26),V(1),V(2),V(22),V(4),V(28),H.default.LFO=function(){var z=H.default.defaults(arguments,["frequency","min","max"],H.default.LFO);H.default.AudioNode.call(this),this._oscillator=new H.default.Oscillator({frequency:z.frequency,type:z.type}),this.frequency=this._oscillator.frequency,this.amplitude=this._oscillator.volume,this.amplitude.units=H.default.Type.NormalRange,this.amplitude.value=z.amplitude,this._stoppedSignal=new H.default.Signal(0,H.default.Type.AudioRange),this._zeros=new H.default.Zero,this._stoppedValue=0,this._a2g=new H.default.AudioToGain,this._scaler=this.output=new H.default.Scale(z.min,z.max),this._units=H.default.Type.Default,this.units=z.units,this._oscillator.chain(this._a2g,this._scaler),this._zeros.connect(this._a2g),this._stoppedSignal.connect(this._a2g),this._readOnly(["amplitude","frequency"]),this.phase=z.phase},H.default.extend(H.default.LFO,H.default.AudioNode),H.default.LFO.defaults={type:"sine",min:0,max:1,phase:0,frequency:"4n",amplitude:1,units:H.default.Type.Default},H.default.LFO.prototype.start=function(z){return z=this.toSeconds(z),this._stoppedSignal.setValueAtTime(0,z),this._oscillator.start(z),this},H.default.LFO.prototype.stop=function(z){return z=this.toSeconds(z),this._stoppedSignal.setValueAtTime(this._stoppedValue,z),this._oscillator.stop(z),this},H.default.LFO.prototype.sync=function(){return this._oscillator.sync(),this._oscillator.syncFrequency(),this},H.default.LFO.prototype.unsync=function(){return this._oscillator.unsync(),this._oscillator.unsyncFrequency(),this},Object.defineProperty(H.default.LFO.prototype,"min",{get:function(){return this._toUnits(this._scaler.min)},set:function(z){z=this._fromUnits(z),this._scaler.min=z}}),Object.defineProperty(H.default.LFO.prototype,"max",{get:function(){return this._toUnits(this._scaler.max)},set:function(z){z=this._fromUnits(z),this._scaler.max=z}}),Object.defineProperty(H.default.LFO.prototype,"type",{get:function(){return this._oscillator.type},set:function(z){this._oscillator.type=z,this._stoppedValue=this._oscillator._getInitialValue(),this._stoppedSignal.value=this._stoppedValue}}),Object.defineProperty(H.default.LFO.prototype,"phase",{get:function(){return this._oscillator.phase},set:function(z){this._oscillator.phase=z,this._stoppedValue=this._oscillator._getInitialValue(),this._stoppedSignal.value=this._stoppedValue}}),Object.defineProperty(H.default.LFO.prototype,"units",{get:function(){return this._units},set:function(z){var G=this.min,V=this.max;this._units=z,this.min=G,this.max=V}}),Object.defineProperty(H.default.LFO.prototype,"state",{get:function(){return this._oscillator.state}}),H.default.LFO.prototype.connect=function(z){return z.constructor!==H.default.Signal&&z.constructor!==H.default.Param||(this.convert=z.convert,this.units=z.units),H.default.SignalBase.prototype.connect.apply(this,arguments),this},H.default.LFO.prototype._fromUnits=H.default.Param.prototype._fromUnits,H.default.LFO.prototype._toUnits=H.default.Param.prototype._toUnits,H.default.LFO.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._writable(["amplitude","frequency"]),this._oscillator.dispose(),this._oscillator=null,this._stoppedSignal.dispose(),this._stoppedSignal=null,this._zeros.dispose(),this._zeros=null,this._scaler.dispose(),this._scaler=null,this._a2g.dispose(),this._a2g=null,this.frequency=null,this.amplitude=null,this},G.default=H.default.LFO},function(z,G,V){V.r(G);var H=V(0);V(29),V(90),V(2),V(3),H.default.Subtract=function(z){H.default.Signal.call(this),this.createInsOuts(2,0),this._sum=this.input[0]=this.output=new H.default.Gain,this._neg=new H.default.Negate,this._param=this.input[1]=new H.default.Signal(z),this._param.chain(this._neg,this._sum)},H.default.extend(H.default.Subtract,H.default.Signal),H.default.Subtract.prototype.dispose=function(){return H.default.Signal.prototype.dispose.call(this),this._neg.dispose(),this._neg=null,this._sum.disconnect(),this._sum=null,this},G.default=H.default.Subtract},function(z,G,V){V.r(G);var H=V(0);V(4),V(1),V(24),H.default.Param=function(){var z=H.default.defaults(arguments,["param","units","convert"],H.default.Param);H.default.AudioNode.call(this,z),this._param=this.input=z.param,this.units=z.units,this.convert=z.convert,this.overridden=!1,this._events=new H.default.Timeline(1e3),H.default.isDefined(z.value)&&this._param&&this.setValueAtTime(z.value,0)},H.default.extend(H.default.Param,H.default.AudioNode),H.default.Param.defaults={units:H.default.Type.Default,convert:!0,param:void 0},Object.defineProperty(H.default.Param.prototype,"value",{get:function(){var z=this.now();return this._toUnits(this.getValueAtTime(z))},set:function(z){this._initialValue=this._fromUnits(z),this.cancelScheduledValues(this.now()),this.setValueAtTime(z,this.now())}}),Object.defineProperty(H.default.Param.prototype,"minValue",{get:function(){return this.units===H.default.Type.Time||this.units===H.default.Type.Frequency||this.units===H.default.Type.NormalRange||this.units===H.default.Type.Positive||this.units===H.default.Type.BPM?0:this.units===H.default.Type.AudioRange?-1:this.units===H.default.Type.Decibels?-1/0:this._param.minValue}}),Object.defineProperty(H.default.Param.prototype,"maxValue",{get:function(){return this.units===H.default.Type.NormalRange||this.units===H.default.Type.AudioRange?1:this._param.maxValue}}),H.default.Param.prototype._fromUnits=function(z){if(!this.convert&&!H.default.isUndef(this.convert)||this.overridden)return z;switch(this.units){case H.default.Type.Time:return this.toSeconds(z);case H.default.Type.Frequency:return this.toFrequency(z);case H.default.Type.Decibels:return H.default.dbToGain(z);case H.default.Type.NormalRange:return Math.min(Math.max(z,0),1);case H.default.Type.AudioRange:return Math.min(Math.max(z,-1),1);case H.default.Type.Positive:return Math.max(z,0);default:return z}},H.default.Param.prototype._toUnits=function(z){return(this.convert||H.default.isUndef(this.convert))&&this.units===H.default.Type.Decibels?H.default.gainToDb(z):z},H.default.Param.prototype._minOutput=1e-5,H.default.Param.AutomationType={Linear:"linearRampToValueAtTime",Exponential:"exponentialRampToValueAtTime",Target:"setTargetAtTime",SetValue:"setValueAtTime",Cancel:"cancelScheduledValues"},H.default.Param.prototype.setValueAtTime=function(z,G){return G=this.toSeconds(G),z=this._fromUnits(z),this._events.add({type:H.default.Param.AutomationType.SetValue,value:z,time:G}),this.log(H.default.Param.AutomationType.SetValue,z,G),this._param.setValueAtTime(z,G),this},H.default.Param.prototype.getValueAtTime=function(z){z=this.toSeconds(z);var G=this._events.getAfter(z),V=this._events.get(z),W=H.default.defaultArg(this._initialValue,this._param.defaultValue),K=W;if(null===V)K=W;else if(V.type===H.default.Param.AutomationType.Target){var Z,it=this._events.getBefore(V.time);Z=null===it?W:it.value,K=this._exponentialApproach(V.time,Z,V.value,V.constant,z)}else K=null===G?V.value:G.type===H.default.Param.AutomationType.Linear?this._linearInterpolate(V.time,V.value,G.time,G.value,z):G.type===H.default.Param.AutomationType.Exponential?this._exponentialInterpolate(V.time,V.value,G.time,G.value,z):V.value;return K},H.default.Param.prototype.setRampPoint=function(z){z=this.toSeconds(z);var G=this.getValueAtTime(z);return this.cancelAndHoldAtTime(z),0===G&&(G=this._minOutput),this.setValueAtTime(this._toUnits(G),z),this},H.default.Param.prototype.linearRampToValueAtTime=function(z,G){return z=this._fromUnits(z),G=this.toSeconds(G),this._events.add({type:H.default.Param.AutomationType.Linear,value:z,time:G}),this.log(H.default.Param.AutomationType.Linear,z,G),this._param.linearRampToValueAtTime(z,G),this},H.default.Param.prototype.exponentialRampToValueAtTime=function(z,G){return z=this._fromUnits(z),z=Math.max(this._minOutput,z),G=this.toSeconds(G),this._events.add({type:H.default.Param.AutomationType.Exponential,time:G,value:z}),this.log(H.default.Param.AutomationType.Exponential,z,G),this._param.exponentialRampToValueAtTime(z,G),this},H.default.Param.prototype.exponentialRampTo=function(z,G,V){return V=this.toSeconds(V),this.setRampPoint(V),this.exponentialRampToValueAtTime(z,V+this.toSeconds(G)),this},H.default.Param.prototype.linearRampTo=function(z,G,V){return V=this.toSeconds(V),this.setRampPoint(V),this.linearRampToValueAtTime(z,V+this.toSeconds(G)),this},H.default.Param.prototype.targetRampTo=function(z,G,V){return V=this.toSeconds(V),this.setRampPoint(V),this.exponentialApproachValueAtTime(z,V,G),this},H.default.Param.prototype.exponentialApproachValueAtTime=function(z,G,V){var H=Math.log(this.toSeconds(V)+1)/Math.log(200);return G=this.toSeconds(G),this.setTargetAtTime(z,G,H),this.cancelAndHoldAtTime(G+.9*V),this.linearRampToValueAtTime(z,G+V),this},H.default.Param.prototype.setTargetAtTime=function(z,G,V){if(z=this._fromUnits(z),V<=0)throw new Error("timeConstant must be greater than 0");return G=this.toSeconds(G),this._events.add({type:H.default.Param.AutomationType.Target,value:z,time:G,constant:V}),this.log(H.default.Param.AutomationType.Target,z,G,V),this._param.setTargetAtTime(z,G,V),this},H.default.Param.prototype.setValueCurveAtTime=function(z,G,V,W){W=H.default.defaultArg(W,1),V=this.toSeconds(V),G=this.toSeconds(G),this.setValueAtTime(z[0]*W,G);for(var K=V/(z.length-1),Z=1;Z<z.length;Z++)this.linearRampToValueAtTime(z[Z]*W,G+Z*K);return this},H.default.Param.prototype.cancelScheduledValues=function(z){return z=this.toSeconds(z),this._events.cancel(z),this._param.cancelScheduledValues(z),this.log(H.default.Param.AutomationType.Cancel,z),this},H.default.Param.prototype.cancelAndHoldAtTime=function(z){z=this.toSeconds(z);var G=this.getValueAtTime(z);this.log("cancelAndHoldAtTime",z,"value="+G),this._param.cancelScheduledValues(z);var V=this._events.get(z),W=this._events.getAfter(z);return V&&V.time===z?W?this._events.cancel(W.time):this._events.cancel(z+this.sampleTime):W&&(this._events.cancel(W.time),W.type===H.default.Param.AutomationType.Linear?this.linearRampToValueAtTime(G,z):W.type===H.default.Param.AutomationType.Exponential&&this.exponentialRampToValueAtTime(G,z)),this._events.add({type:H.default.Param.AutomationType.SetValue,value:G,time:z}),this._param.setValueAtTime(G,z),this},H.default.Param.prototype.rampTo=function(z,G,V){return G=H.default.defaultArg(G,.1),this.units===H.default.Type.Frequency||this.units===H.default.Type.BPM||this.units===H.default.Type.Decibels?this.exponentialRampTo(z,G,V):this.linearRampTo(z,G,V),this},H.default.Param.prototype._exponentialApproach=function(z,G,V,H,W){return V+(G-V)*Math.exp(-(W-z)/H)},H.default.Param.prototype._linearInterpolate=function(z,G,V,H,W){return G+(W-z)/(V-z)*(H-G)},H.default.Param.prototype._exponentialInterpolate=function(z,G,V,H,W){return G*Math.pow(H/G,(W-z)/(V-z))},H.default.Param.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._param=null,this._events=null,this},G.default=H.default.Param},function(z,G,V){V.r(G);var H=V(0);V(8),V(19),V(10),V(23),H.default.StereoEffect=function(){H.default.AudioNode.call(this);var z=H.default.defaults(arguments,["wet"],H.default.Effect);this.createInsOuts(1,1),this._dryWet=new H.default.CrossFade(z.wet),this.wet=this._dryWet.fade,this._split=new H.default.Split,this.effectSendL=this._split.left,this.effectSendR=this._split.right,this._merge=new H.default.Merge,this.effectReturnL=this._merge.left,this.effectReturnR=this._merge.right,H.default.connect(this.input,this._split),H.default.connect(this.input,this._dryWet,0,0),this._merge.connect(this._dryWet,0,1),this._dryWet.connect(this.output),this._readOnly(["wet"])},H.default.extend(H.default.StereoEffect,H.default.Effect),H.default.StereoEffect.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._dryWet.dispose(),this._dryWet=null,this._split.dispose(),this._split=null,this._merge.dispose(),this._merge=null,this.effectSendL=null,this.effectSendR=null,this.effectReturnL=null,this.effectReturnR=null,this._writable(["wet"]),this.wet=null,this},G.default=H.default.StereoEffect},function(z,G,V){V.r(G);var H=V(0);V(83),V(4),V(24),V(35),V(3),V(81),V(80),V(56),H.default.Transport=function(){H.default.Emitter.call(this),H.default.getContext(function(){this.loop=!1,this._loopStart=0,this._loopEnd=0,this._ppq=W.defaults.PPQ,this._clock=new H.default.Clock({callback:this._processTick.bind(this),frequency:0}),this._bindClockEvents(),this.bpm=this._clock.frequency,this.bpm._toUnits=this._toUnits.bind(this),this.bpm._fromUnits=this._fromUnits.bind(this),this.bpm.units=H.default.Type.BPM,this.bpm.value=W.defaults.bpm,this._readOnly("bpm"),this._timeSignature=W.defaults.timeSignature,this._scheduledEvents={},this._timeline=new H.default.Timeline,this._repeatedEvents=new H.default.IntervalTimeline,this._syncedSignals=[],this._swingTicks=W.defaults.PPQ/2,this._swingAmount=0,this.context.transport=this}.bind(this))},H.default.extend(H.default.Transport,H.default.Emitter),H.default.Transport.defaults={bpm:120,swing:0,swingSubdivision:"8n",timeSignature:4,loopStart:0,loopEnd:"4m",PPQ:192},H.default.Transport.prototype.isTransport=!0,H.default.Transport.prototype._processTick=function(z,G){if(this._swingAmount>0&&G%this._ppq!=0&&G%(2*this._swingTicks)!=0){var V=G%(2*this._swingTicks)/(2*this._swingTicks),W=Math.sin(V*Math.PI)*this._swingAmount;z+=H.default.Ticks(2*this._swingTicks/3).toSeconds()*W}this.loop&&G>=this._loopEnd&&(this.emit("loopEnd",z),this._clock.setTicksAtTime(this._loopStart,z),G=this._loopStart,this.emit("loopStart",z,this._clock.getSecondsAtTime(z)),this.emit("loop",z)),this._timeline.forEachAtTime(G,(function(G){G.invoke(z)}))},H.default.Transport.prototype.schedule=function(z,G){var V=new H.default.TransportEvent(this,{time:H.default.TransportTime(G),callback:z});return this._addEvent(V,this._timeline)},H.default.Transport.prototype.scheduleRepeat=function(z,G,V,W){var K=new H.default.TransportRepeatEvent(this,{callback:z,interval:H.default.Time(G),time:H.default.TransportTime(V),duration:H.default.Time(H.default.defaultArg(W,1/0))});return this._addEvent(K,this._repeatedEvents)},H.default.Transport.prototype.scheduleOnce=function(z,G){var V=new H.default.TransportEvent(this,{time:H.default.TransportTime(G),callback:z,once:!0});return this._addEvent(V,this._timeline)},H.default.Transport.prototype.clear=function(z){if(this._scheduledEvents.hasOwnProperty(z)){var G=this._scheduledEvents[z.toString()];G.timeline.remove(G.event),G.event.dispose(),delete this._scheduledEvents[z.toString()]}return this},H.default.Transport.prototype._addEvent=function(z,G){return this._scheduledEvents[z.id.toString()]={event:z,timeline:G},G.add(z),z.id},H.default.Transport.prototype.cancel=function(z){return z=H.default.defaultArg(z,0),z=this.toTicks(z),this._timeline.forEachFrom(z,function(z){this.clear(z.id)}.bind(this)),this._repeatedEvents.forEachFrom(z,function(z){this.clear(z.id)}.bind(this)),this},H.default.Transport.prototype._bindClockEvents=function(){this._clock.on("start",function(z,G){G=H.default.Ticks(G).toSeconds(),this.emit("start",z,G)}.bind(this)),this._clock.on("stop",function(z){this.emit("stop",z)}.bind(this)),this._clock.on("pause",function(z){this.emit("pause",z)}.bind(this))},Object.defineProperty(H.default.Transport.prototype,"state",{get:function(){return this._clock.getStateAtTime(this.now())}}),H.default.Transport.prototype.start=function(z,G){return H.default.isDefined(G)&&(G=this.toTicks(G)),this._clock.start(z,G),this},H.default.Transport.prototype.stop=function(z){return this._clock.stop(z),this},H.default.Transport.prototype.pause=function(z){return this._clock.pause(z),this},H.default.Transport.prototype.toggle=function(z){return z=this.toSeconds(z),this._clock.getStateAtTime(z)!==H.default.State.Started?this.start(z):this.stop(z),this},Object.defineProperty(H.default.Transport.prototype,"timeSignature",{get:function(){return this._timeSignature},set:function(z){H.default.isArray(z)&&(z=z[0]/z[1]*4),this._timeSignature=z}}),Object.defineProperty(H.default.Transport.prototype,"loopStart",{get:function(){return H.default.Ticks(this._loopStart).toSeconds()},set:function(z){this._loopStart=this.toTicks(z)}}),Object.defineProperty(H.default.Transport.prototype,"loopEnd",{get:function(){return H.default.Ticks(this._loopEnd).toSeconds()},set:function(z){this._loopEnd=this.toTicks(z)}}),H.default.Transport.prototype.setLoopPoints=function(z,G){return this.loopStart=z,this.loopEnd=G,this},Object.defineProperty(H.default.Transport.prototype,"swing",{get:function(){return this._swingAmount},set:function(z){this._swingAmount=z}}),Object.defineProperty(H.default.Transport.prototype,"swingSubdivision",{get:function(){return H.default.Ticks(this._swingTicks).toNotation()},set:function(z){this._swingTicks=this.toTicks(z)}}),Object.defineProperty(H.default.Transport.prototype,"position",{get:function(){var z=this.now(),G=this._clock.getTicksAtTime(z);return H.default.Ticks(G).toBarsBeatsSixteenths()},set:function(z){var G=this.toTicks(z);this.ticks=G}}),Object.defineProperty(H.default.Transport.prototype,"seconds",{get:function(){return this._clock.seconds},set:function(z){var G=this.now(),V=this.bpm.timeToTicks(z,G);this.ticks=V}}),Object.defineProperty(H.default.Transport.prototype,"progress",{get:function(){if(this.loop){var z=this.now();return(this._clock.getTicksAtTime(z)-this._loopStart)/(this._loopEnd-this._loopStart)}return 0}}),Object.defineProperty(H.default.Transport.prototype,"ticks",{get:function(){return this._clock.ticks},set:function(z){if(this._clock.ticks!==z){var G=this.now();this.state===H.default.State.Started?(this.emit("stop",G),this._clock.setTicksAtTime(z,G),this.emit("start",G,this.seconds)):this._clock.setTicksAtTime(z,G)}}}),H.default.Transport.prototype.getTicksAtTime=function(z){return Math.round(this._clock.getTicksAtTime(z))},H.default.Transport.prototype.getSecondsAtTime=function(z){return this._clock.getSecondsAtTime(z)},Object.defineProperty(H.default.Transport.prototype,"PPQ",{get:function(){return this._ppq},set:function(z){var G=this.bpm.value;this._ppq=z,this.bpm.value=G}}),H.default.Transport.prototype._fromUnits=function(z){return 1/(60/z/this.PPQ)},H.default.Transport.prototype._toUnits=function(z){return z/this.PPQ*60},H.default.Transport.prototype.nextSubdivision=function(z){if(z=this.toTicks(z),this.state!==H.default.State.Started)return 0;var G=this.now(),V=z-this.getTicksAtTime(G)%z;return this._clock.nextTickTime(V,G)},H.default.Transport.prototype.syncSignal=function(z,G){if(!G){var V=this.now();G=0!==z.getValueAtTime(V)?z.getValueAtTime(V)/this.bpm.getValueAtTime(V):0}var W=new H.default.Gain(G);return this.bpm.chain(W,z._param),this._syncedSignals.push({ratio:W,signal:z,initial:z.value}),z.value=0,this},H.default.Transport.prototype.unsyncSignal=function(z){for(var G=this._syncedSignals.length-1;G>=0;G--){var V=this._syncedSignals[G];V.signal===z&&(V.ratio.dispose(),V.signal.value=V.initial,this._syncedSignals.splice(G,1))}return this},H.default.Transport.prototype.dispose=function(){return H.default.Emitter.prototype.dispose.call(this),this._clock.dispose(),this._clock=null,this._writable("bpm"),this.bpm=null,this._timeline.dispose(),this._timeline=null,this._repeatedEvents.dispose(),this._repeatedEvents=null,this};var W=H.default.Transport;H.default.Transport=new W,H.default.Context.on("init",(function(z){z.transport&&z.transport.isTransport?H.default.Transport=z.transport:H.default.Transport=new W})),H.default.Context.on("close",(function(z){z.transport&&z.transport.isTransport&&z.transport.dispose()})),G.default=H.default.Transport},function(z,G,V){V.r(G);var H=V(0);V(2),V(6),V(16),V(64),H.default.Oscillator=function(){var z=H.default.defaults(arguments,["frequency","type"],H.default.Oscillator);H.default.Source.call(this,z),this._oscillator=null,this.frequency=new H.default.Signal(z.frequency,H.default.Type.Frequency),this.detune=new H.default.Signal(z.detune,H.default.Type.Cents),this._wave=null,this._partials=z.partials,this._partialCount=z.partialCount,this._phase=z.phase,this._type=z.type,z.partialCount&&z.type!==H.default.Oscillator.Type.Custom&&(this._type=this.baseType+z.partialCount.toString()),this.phase=this._phase,this._readOnly(["frequency","detune"])},H.default.extend(H.default.Oscillator,H.default.Source),H.default.Oscillator.defaults={type:"sine",frequency:440,detune:0,phase:0,partials:[],partialCount:0},H.default.Oscillator.Type={Sine:"sine",Triangle:"triangle",Sawtooth:"sawtooth",Square:"square",Custom:"custom"},H.default.Oscillator.prototype._start=function(z){this.log("start",z);var G=new H.default.OscillatorNode;this._oscillator=G,this._wave?this._oscillator.setPeriodicWave(this._wave):this._oscillator.type=this._type,this._oscillator.connect(this.output),this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),z=this.toSeconds(z),this._oscillator.start(z)},H.default.Oscillator.prototype._stop=function(z){return this.log("stop",z),this._oscillator&&(z=this.toSeconds(z),this._oscillator.stop(z)),this},H.default.Oscillator.prototype.restart=function(z){return this._oscillator&&this._oscillator.cancelStop(),this._state.cancel(this.toSeconds(z)),this},H.default.Oscillator.prototype.syncFrequency=function(){return H.default.Transport.syncSignal(this.frequency),this},H.default.Oscillator.prototype.unsyncFrequency=function(){return H.default.Transport.unsyncSignal(this.frequency),this},Object.defineProperty(H.default.Oscillator.prototype,"type",{get:function(){return this._type},set:function(z){var G=[H.default.Oscillator.Type.Sine,H.default.Oscillator.Type.Square,H.default.Oscillator.Type.Triangle,H.default.Oscillator.Type.Sawtooth].includes(z);if(0===this._phase&&G)this._wave=null,this._partialCount=0,null!==this._oscillator&&(this._oscillator.type=z);else{var V=this._getRealImaginary(z,this._phase),W=this.context.createPeriodicWave(V[0],V[1]);this._wave=W,null!==this._oscillator&&this._oscillator.setPeriodicWave(this._wave)}this._type=z}}),Object.defineProperty(H.default.Oscillator.prototype,"baseType",{get:function(){return this._type.replace(this.partialCount,"")},set:function(z){this.partialCount&&this._type!==H.default.Oscillator.Type.Custom&&z!==H.default.Oscillator.Type.Custom?this.type=z+this.partialCount:this.type=z}}),Object.defineProperty(H.default.Oscillator.prototype,"partialCount",{get:function(){return this._partialCount},set:function(z){var G=this._type,V=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(this._type);V&&(G=V[1]),this._type!==H.default.Oscillator.Type.Custom&&(this.type=0===z?G:G+z.toString())}}),H.default.Oscillator.prototype.get=function(){var z=H.default.prototype.get.apply(this,arguments);return z.type!==H.default.Oscillator.Type.Custom&&delete z.partials,z},H.default.Oscillator.prototype._getRealImaginary=function(z,G){var V=2048,W=new Float32Array(V),K=new Float32Array(V),Z=1;if(z===H.default.Oscillator.Type.Custom)Z=this._partials.length+1,this._partialCount=this._partials.length,V=Z;else{var it=/^(sine|triangle|square|sawtooth)(\d+)$/.exec(z);it?(Z=parseInt(it[2])+1,this._partialCount=parseInt(it[2]),z=it[1],V=Z=Math.max(Z,2)):this._partialCount=0,this._partials=[]}for(var ot=1;ot<V;++ot){var rt,at=2/(ot*Math.PI);switch(z){case H.default.Oscillator.Type.Sine:rt=ot<=Z?1:0,this._partials[ot-1]=rt;break;case H.default.Oscillator.Type.Square:rt=1&ot?2*at:0,this._partials[ot-1]=rt;break;case H.default.Oscillator.Type.Sawtooth:rt=at*(1&ot?1:-1),this._partials[ot-1]=rt;break;case H.default.Oscillator.Type.Triangle:rt=1&ot?at*at*2*(ot-1>>1&1?-1:1):0,this._partials[ot-1]=rt;break;case H.default.Oscillator.Type.Custom:rt=this._partials[ot-1];break;default:throw new TypeError("Tone.Oscillator: invalid type: "+z)}0!==rt?(W[ot]=-rt*Math.sin(G*ot),K[ot]=rt*Math.cos(G*ot)):(W[ot]=0,K[ot]=0)}return[W,K]},H.default.Oscillator.prototype._inverseFFT=function(z,G,V){for(var H=0,W=z.length,K=0;K<W;K++)H+=z[K]*Math.cos(K*V)+G[K]*Math.sin(K*V);return H},H.default.Oscillator.prototype._getInitialValue=function(){for(var z=this._getRealImaginary(this._type,0),G=z[0],V=z[1],H=0,W=2*Math.PI,K=0;K<8;K++)H=Math.max(this._inverseFFT(G,V,K/8*W),H);return-this._inverseFFT(G,V,this._phase)/H},Object.defineProperty(H.default.Oscillator.prototype,"partials",{get:function(){return this._partials},set:function(z){this._partials=z,this.type=H.default.Oscillator.Type.Custom}}),Object.defineProperty(H.default.Oscillator.prototype,"phase",{get:function(){return this._phase*(180/Math.PI)},set:function(z){this._phase=z*Math.PI/180,this.type=this._type}}),H.default.Oscillator.prototype.dispose=function(){return H.default.Source.prototype.dispose.call(this),null!==this._oscillator&&(this._oscillator.dispose(),this._oscillator=null),this._wave=null,this._writable(["frequency","detune"]),this.frequency.dispose(),this.frequency=null,this.detune.dispose(),this.detune=null,this._partials=null,this},G.default=H.default.Oscillator},function(z,G,V){V.r(G);var H=V(0);V(14),V(1),H.default.Delay=function(){var z=H.default.defaults(arguments,["delayTime","maxDelay"],H.default.Delay);H.default.AudioNode.call(this,z),this._maxDelay=Math.max(this.toSeconds(z.maxDelay),this.toSeconds(z.delayTime)),this._delayNode=this.input=this.output=this.context.createDelay(this._maxDelay),this.delayTime=new H.default.Param({param:this._delayNode.delayTime,units:H.default.Type.Time,value:z.delayTime}),this._readOnly("delayTime")},H.default.extend(H.default.Delay,H.default.AudioNode),H.default.Delay.defaults={maxDelay:1,delayTime:0},Object.defineProperty(H.default.Delay.prototype,"maxDelay",{get:function(){return this._maxDelay}}),H.default.Delay.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._delayNode.disconnect(),this._delayNode=null,this._writable("delayTime"),this.delayTime=null,this},G.default=H.default.Delay},function(z,G,V){V.r(G);var H=V(0);V(3),V(1),H.default.Split=function(z){z=H.default.defaultArg(z,2),H.default.AudioNode.call(this),this.createInsOuts(0,z),this._splitter=this.input=this.context.createChannelSplitter(z);for(var G=0;G<z;G++)this.output[G]=new H.default.Gain,H.default.connect(this._splitter,this.output[G],G,0),this.output[G].channelCount=1,this.output[G].channelCountMode="explicit";this.left=this.output[0],this.right=this.output[1]},H.default.extend(H.default.Split,H.default.AudioNode),H.default.Split.prototype.dispose=function(){return this.output.forEach((function(z){z.dispose()})),H.default.AudioNode.prototype.dispose.call(this),this._splitter.disconnect(),this.left=null,this.right=null,this._splitter=null,this},G.default=H.default.Split},function(z,G,V){V.r(G);var H=V(0),W=(V(35),V(24),V(44),["baseLatency","destination","currentTime","sampleRate","listener","state"]),K=["suspend","close","resume","getOutputTimestamp","createMediaElementSource","createMediaStreamSource","createMediaStreamDestination","createBuffer","decodeAudioData","createBufferSource","createConstantSource","createGain","createDelay","createBiquadFilter","createIIRFilter","createWaveShaper","createPanner","createConvolver","createDynamicsCompressor","createAnalyser","createScriptProcessor","createStereoPanner","createOscillator","createPeriodicWave","createChannelSplitter","createChannelMerger","audioWorklet"];H.default.Context=function(){H.default.Emitter.call(this);var z=H.default.defaults(arguments,["context"],H.default.Context);if(!z.context&&(z.context=new H.default.global.AudioContext,!z.context))throw new Error("could not create AudioContext. Possibly too many AudioContexts running already.");for(this._context=z.context;this._context.rawContext;)this._context=this._context.rawContext;W.forEach(function(z){this._defineProperty(this._context,z)}.bind(this)),K.forEach(function(z){this._defineMethod(this._context,z)}.bind(this)),this._latencyHint=z.latencyHint,this._constants={},this.lookAhead=z.lookAhead,this._computedUpdateInterval=0,this._ticker=new a(this.emit.bind(this,"tick"),z.clockSource,z.updateInterval),this._timeouts=new H.default.Timeline,this._timeoutIds=0,this.on("tick",this._timeoutLoop.bind(this)),this._context.onstatechange=function(z){this.emit("statechange",z)}.bind(this)},H.default.extend(H.default.Context,H.default.Emitter),H.default.Emitter.mixin(H.default.Context),H.default.Context.defaults={clockSource:"worker",latencyHint:"interactive",lookAhead:.1,updateInterval:.03},H.default.Context.prototype.isContext=!0,H.default.Context.prototype._defineProperty=function(z,G){H.default.isUndef(this[G])&&Object.defineProperty(this,G,{get:function(){return z[G]},set:function(V){z[G]=V}})},H.default.Context.prototype._defineMethod=function(z,G){H.default.isUndef(this[G])&&Object.defineProperty(this,G,{get:function(){return z[G].bind(z)}})},H.default.Context.prototype.now=function(){return this._context.currentTime+this.lookAhead},Object.defineProperty(H.default.Context.prototype,"destination",{get:function(){return this.master?this.master:this._context.destination}}),H.default.Context.prototype.resume=function(){return"suspended"===this._context.state&&this._context instanceof AudioContext?this._context.resume():Promise.resolve()},H.default.Context.prototype.close=function(){var z=Promise.resolve();return this!==H.default.global.TONE_AUDIO_CONTEXT&&(z=this.rawContext.close()),z.then(function(){H.default.Context.emit("close",this)}.bind(this))},H.default.Context.prototype.getConstant=function(z){if(this._constants[z])return this._constants[z];for(var G=this._context.createBuffer(1,128,this._context.sampleRate),V=G.getChannelData(0),H=0;H<V.length;H++)V[H]=z;var W=this._context.createBufferSource();return W.channelCount=1,W.channelCountMode="explicit",W.buffer=G,W.loop=!0,W.start(0),this._constants[z]=W,W},H.default.Context.prototype._timeoutLoop=function(){for(var z=this.now();this._timeouts&&this._timeouts.length&&this._timeouts.peek().time<=z;)this._timeouts.shift().callback()},H.default.Context.prototype.setTimeout=function(z,G){this._timeoutIds++;var V=this.now();return this._timeouts.add({callback:z,time:V+G,id:this._timeoutIds}),this._timeoutIds},H.default.Context.prototype.clearTimeout=function(z){return this._timeouts.forEach((function(G){G.id===z&&this.remove(G)})),this},Object.defineProperty(H.default.Context.prototype,"updateInterval",{get:function(){return this._ticker.updateInterval},set:function(z){this._ticker.updateInterval=z}}),Object.defineProperty(H.default.Context.prototype,"rawContext",{get:function(){return this._context}}),Object.defineProperty(H.default.Context.prototype,"clockSource",{get:function(){return this._ticker.type},set:function(z){this._ticker.type=z}}),Object.defineProperty(H.default.Context.prototype,"latencyHint",{get:function(){return this._latencyHint},set:function(z){var G=z;if(this._latencyHint=z,H.default.isString(z))switch(z){case"interactive":G=.1,this._context.latencyHint=z;break;case"playback":G=.8,this._context.latencyHint=z;break;case"balanced":G=.25,this._context.latencyHint=z;break;case"fastest":this._context.latencyHint="interactive",G=.01}this.lookAhead=G,this.updateInterval=G/3}}),H.default.Context.prototype.dispose=function(){return this.close().then(function(){for(var z in H.default.Emitter.prototype.dispose.call(this),this._ticker.dispose(),this._ticker=null,this._timeouts.dispose(),this._timeouts=null,this._constants)this._constants[z].disconnect();this._constants=null}.bind(this))};var a=function(z,G,V){this._type=G,this._updateInterval=V,this._callback=H.default.defaultArg(z,H.default.noOp),this._createClock()};if(a.Type={Worker:"worker",Timeout:"timeout",Offline:"offline"},a.prototype._createWorker=function(){H.default.global.URL=H.default.global.URL||H.default.global.webkitURL;var z=new Blob(["var timeoutTime = "+(1e3*this._updateInterval).toFixed(1)+";self.onmessage = function(msg){\ttimeoutTime = parseInt(msg.data);};function tick(){\tsetTimeout(tick, timeoutTime);\tself.postMessage('tick');}tick();"]),G=URL.createObjectURL(z),V=new Worker(G);V.onmessage=this._callback.bind(this),this._worker=V},a.prototype._createTimeout=function(){this._timeout=setTimeout(function(){this._createTimeout(),this._callback()}.bind(this),1e3*this._updateInterval)},a.prototype._createClock=function(){if(this._type===a.Type.Worker)try{this._createWorker()}catch(z){this._type=a.Type.Timeout,this._createClock()}else this._type===a.Type.Timeout&&this._createTimeout()},Object.defineProperty(a.prototype,"updateInterval",{get:function(){return this._updateInterval},set:function(z){this._updateInterval=Math.max(z,128/44100),this._type===a.Type.Worker&&this._worker.postMessage(Math.max(1e3*z,1))}}),Object.defineProperty(a.prototype,"type",{get:function(){return this._type},set:function(z){this._disposeClock(),this._type=z,this._createClock()}}),a.prototype._disposeClock=function(){this._timeout&&(clearTimeout(this._timeout),this._timeout=null),this._worker&&(this._worker.terminate(),this._worker.onmessage=null,this._worker=null)},a.prototype.dispose=function(){this._disposeClock(),this._callback=null},H.default.supported&&!H.default.initialized){if(H.default.global.TONE_AUDIO_CONTEXT||(H.default.global.TONE_AUDIO_CONTEXT=new H.default.Context),H.default.context=H.default.global.TONE_AUDIO_CONTEXT,!H.default.global.TONE_SILENCE_LOGGING){var Z="v";"dev"===H.default.version&&(Z="");var it=" * Tone.js "+Z+H.default.version+" * ";console.log("%c"+it,"background: #000; color: #fff")}}else H.default.supported||H.default.global.TONE_SILENCE_LOGGING||console.warn("This browser does not support Tone.js");G.default=H.default.Context},function(z,G,V){V.r(G);var H=V(0);V(4),V(40),H.default.Instrument=function(z){z=H.default.defaultArg(z,H.default.Instrument.defaults),H.default.AudioNode.call(this),this._volume=this.output=new H.default.Volume(z.volume),this.volume=this._volume.volume,this._readOnly("volume"),this._scheduledEvents=[]},H.default.extend(H.default.Instrument,H.default.AudioNode),H.default.Instrument.defaults={volume:0},H.default.Instrument.prototype.triggerAttack=H.default.noOp,H.default.Instrument.prototype.triggerRelease=H.default.noOp,H.default.Instrument.prototype.sync=function(){return this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",0),this},H.default.Instrument.prototype._syncMethod=function(z,G){var V=this["_original_"+z]=this[z];this[z]=function(){var z=Array.prototype.slice.call(arguments),W=z[G],K=H.default.Transport.schedule(function(H){z[G]=H,V.apply(this,z)}.bind(this),W);this._scheduledEvents.push(K)}.bind(this)},H.default.Instrument.prototype.unsync=function(){return this._scheduledEvents.forEach((function(z){H.default.Transport.clear(z)})),this._scheduledEvents=[],this._original_triggerAttack&&(this.triggerAttack=this._original_triggerAttack,this.triggerRelease=this._original_triggerRelease),this},H.default.Instrument.prototype.triggerAttackRelease=function(z,G,V,H){return V=this.toSeconds(V),G=this.toSeconds(G),this.triggerAttack(z,V,H),this.triggerRelease(V+G),this},H.default.Instrument.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._volume.dispose(),this._volume=null,this._writable(["volume"]),this.volume=null,this.unsync(),this._scheduledEvents=null,this},G.default=H.default.Instrument},function(z,G,V){V.r(G);var H=V(0);V(7),V(2),H.default.AudioToGain=function(){H.default.SignalBase.call(this),this._norm=this.input=this.output=new H.default.WaveShaper((function(z){return(z+1)/2}))},H.default.extend(H.default.AudioToGain,H.default.SignalBase),H.default.AudioToGain.prototype.dispose=function(){return H.default.SignalBase.prototype.dispose.call(this),this._norm.dispose(),this._norm=null,this},G.default=H.default.AudioToGain},function(z,G,V){V.r(G);var H=V(0);V(2),V(13),V(89),V(3),V(1),H.default.CrossFade=function(z){H.default.AudioNode.call(this),this.createInsOuts(2,1),this.a=this.input[0]=new H.default.Gain,this.b=this.input[1]=new H.default.Gain,this.fade=new H.default.Signal(H.default.defaultArg(z,.5),H.default.Type.NormalRange),this._equalPowerA=new H.default.EqualPowerGain,this._equalPowerB=new H.default.EqualPowerGain,this._one=this.context.getConstant(1),this._invert=new H.default.Subtract,this.a.connect(this.output),this.b.connect(this.output),this.fade.chain(this._equalPowerB,this.b.gain),H.default.connect(this._one,this._invert,0,0),this.fade.connect(this._invert,0,1),this._invert.chain(this._equalPowerA,this.a.gain),this._readOnly("fade")},H.default.extend(H.default.CrossFade,H.default.AudioNode),H.default.CrossFade.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._writable("fade"),this._equalPowerA.dispose(),this._equalPowerA=null,this._equalPowerB.dispose(),this._equalPowerB=null,this.fade.dispose(),this.fade=null,this._invert.dispose(),this._invert=null,this._one=null,this.a.dispose(),this.a=null,this.b.dispose(),this.b=null,this},G.default=H.default.CrossFade},function(z,G,V){V.r(G);var H=V(0);H.default.Timeline=function(){var z=H.default.defaults(arguments,["memory"],H.default.Timeline);H.default.call(this),this._timeline=[],this.memory=z.memory},H.default.extend(H.default.Timeline),H.default.Timeline.defaults={memory:1/0},Object.defineProperty(H.default.Timeline.prototype,"length",{get:function(){return this._timeline.length}}),H.default.Timeline.prototype.add=function(z){if(H.default.isUndef(z.time))throw new Error("Tone.Timeline: events must have a time attribute");z.time=z.time.valueOf();var G=this._search(z.time);if(this._timeline.splice(G+1,0,z),this.length>this.memory){var V=this.length-this.memory;this._timeline.splice(0,V)}return this},H.default.Timeline.prototype.remove=function(z){var G=this._timeline.indexOf(z);return-1!==G&&this._timeline.splice(G,1),this},H.default.Timeline.prototype.get=function(z,G){G=H.default.defaultArg(G,"time");var V=this._search(z,G);return-1!==V?this._timeline[V]:null},H.default.Timeline.prototype.peek=function(){return this._timeline[0]},H.default.Timeline.prototype.shift=function(){return this._timeline.shift()},H.default.Timeline.prototype.getAfter=function(z,G){G=H.default.defaultArg(G,"time");var V=this._search(z,G);return V+1<this._timeline.length?this._timeline[V+1]:null},H.default.Timeline.prototype.getBefore=function(z,G){G=H.default.defaultArg(G,"time");var V=this._timeline.length;if(V>0&&this._timeline[V-1][G]<z)return this._timeline[V-1];var W=this._search(z,G);return W-1>=0?this._timeline[W-1]:null},H.default.Timeline.prototype.cancel=function(z){if(this._timeline.length>1){var G=this._search(z);if(G>=0)if(this._timeline[G].time===z){for(var V=G;V>=0&&this._timeline[V].time===z;V--)G=V;this._timeline=this._timeline.slice(0,G)}else this._timeline=this._timeline.slice(0,G+1);else this._timeline=[]}else 1===this._timeline.length&&this._timeline[0].time>=z&&(this._timeline=[]);return this},H.default.Timeline.prototype.cancelBefore=function(z){var G=this._search(z);return G>=0&&(this._timeline=this._timeline.slice(G+1)),this},H.default.Timeline.prototype.previousEvent=function(z){var G=this._timeline.indexOf(z);return G>0?this._timeline[G-1]:null},H.default.Timeline.prototype._search=function(z,G){if(0===this._timeline.length)return-1;G=H.default.defaultArg(G,"time");var V=0,W=this._timeline.length,K=W;if(W>0&&this._timeline[W-1][G]<=z)return W-1;for(;V<K;){var Z=Math.floor(V+(K-V)/2),it=this._timeline[Z],ot=this._timeline[Z+1];if(it[G]===z){for(var rt=Z;rt<this._timeline.length;rt++)this._timeline[rt][G]===z&&(Z=rt);return Z}if(it[G]<z&&ot[G]>z)return Z;it[G]>z?K=Z:V=Z+1}return-1},H.default.Timeline.prototype._iterate=function(z,G,V){G=H.default.defaultArg(G,0),V=H.default.defaultArg(V,this._timeline.length-1),this._timeline.slice(G,V+1).forEach(function(G){z.call(this,G)}.bind(this))},H.default.Timeline.prototype.forEach=function(z){return this._iterate(z),this},H.default.Timeline.prototype.forEachBefore=function(z,G){var V=this._search(z);return-1!==V&&this._iterate(G,0,V),this},H.default.Timeline.prototype.forEachAfter=function(z,G){var V=this._search(z);return this._iterate(G,V+1),this},H.default.Timeline.prototype.forEachBetween=function(z,G,V){var H=this._search(z),W=this._search(G);return-1!==H&&-1!==W?(this._timeline[H].time!==z&&(H+=1),this._timeline[W].time===G&&(W-=1),this._iterate(V,H,W)):-1===H&&this._iterate(V,0,W),this},H.default.Timeline.prototype.forEachFrom=function(z,G){for(var V=this._search(z);V>=0&&this._timeline[V].time>=z;)V--;return this._iterate(G,V+1),this},H.default.Timeline.prototype.forEachAtTime=function(z,G){var V=this._search(z);return-1!==V&&this._iterate((function(V){V.time===z&&G.call(this,V)}),0,V),this},H.default.Timeline.prototype.dispose=function(){return H.default.prototype.dispose.call(this),this._timeline=null,this},G.default=H.default.Timeline},function(z,G,V){V.r(G);var H=V(0);V(21),V(2),H.default.Monophonic=function(z){z=H.default.defaultArg(z,H.default.Monophonic.defaults),H.default.Instrument.call(this,z),this.portamento=z.portamento},H.default.extend(H.default.Monophonic,H.default.Instrument),H.default.Monophonic.defaults={portamento:0},H.default.Monophonic.prototype.triggerAttack=function(z,G,V){return this.log("triggerAttack",z,G,V),G=this.toSeconds(G),this._triggerEnvelopeAttack(G,V),this.setNote(z,G),this},H.default.Monophonic.prototype.triggerRelease=function(z){return this.log("triggerRelease",z),z=this.toSeconds(z),this._triggerEnvelopeRelease(z),this},H.default.Monophonic.prototype._triggerEnvelopeAttack=function(){},H.default.Monophonic.prototype._triggerEnvelopeRelease=function(){},H.default.Monophonic.prototype.getLevelAtTime=function(z){return z=this.toSeconds(z),this.envelope.getValueAtTime(z)},H.default.Monophonic.prototype.setNote=function(z,G){if(G=this.toSeconds(G),this.portamento>0&&this.getLevelAtTime(G)>.05){var V=this.toSeconds(this.portamento);this.frequency.exponentialRampTo(z,V,G)}else this.frequency.setValueAtTime(z,G);return this},G.default=H.default.Monophonic},function(z,G,V){V.r(G);var H=V(0);V(29),V(5),V(2),H.default.Scale=function(z,G){H.default.SignalBase.call(this),this._outputMin=H.default.defaultArg(z,0),this._outputMax=H.default.defaultArg(G,1),this._scale=this.input=new H.default.Multiply(1),this._add=this.output=new H.default.Add(0),this._scale.connect(this._add),this._setRange()},H.default.extend(H.default.Scale,H.default.SignalBase),Object.defineProperty(H.default.Scale.prototype,"min",{get:function(){return this._outputMin},set:function(z){this._outputMin=z,this._setRange()}}),Object.defineProperty(H.default.Scale.prototype,"max",{get:function(){return this._outputMax},set:function(z){this._outputMax=z,this._setRange()}}),H.default.Scale.prototype._setRange=function(){this._add.value=this._outputMin,this._scale.value=this._outputMax-this._outputMin},H.default.Scale.prototype.dispose=function(){return H.default.SignalBase.prototype.dispose.call(this),this._add.dispose(),this._add=null,this._scale.dispose(),this._scale=null,this},G.default=H.default.Scale},function(z,G,V){V.r(G);var H=V(0);V(2),V(3),V(1),H.default.Volume=function(){var z=H.default.defaults(arguments,["volume"],H.default.Volume);H.default.AudioNode.call(this,z),this.output=this.input=new H.default.Gain(z.volume,H.default.Type.Decibels),this._unmutedVolume=z.volume,this.volume=this.output.gain,this._readOnly("volume"),this.mute=z.mute},H.default.extend(H.default.Volume,H.default.AudioNode),H.default.Volume.defaults={volume:0,mute:!1},Object.defineProperty(H.default.Volume.prototype,"mute",{get:function(){return this.volume.value===-1/0},set:function(z){!this.mute&&z?(this._unmutedVolume=this.volume.value,this.volume.value=-1/0):this.mute&&!z&&(this.volume.value=this._unmutedVolume)}}),H.default.Volume.prototype.dispose=function(){return this.input.dispose(),H.default.AudioNode.prototype.dispose.call(this),this._writable("volume"),this.volume.dispose(),this.volume=null,this},G.default=H.default.Volume},function(z,G,V){V.r(G);var H=V(0);V(3),V(30),H.default.Zero=function(){H.default.SignalBase.call(this),this._gain=this.input=this.output=new H.default.Gain,H.default.connect(this.context.getConstant(0),this._gain)},H.default.extend(H.default.Zero,H.default.SignalBase),H.default.Zero.prototype.dispose=function(){return H.default.SignalBase.prototype.dispose.call(this),this._gain.dispose(),this._gain=null,this},G.default=H.default.Zero},function(z,G,V){V.r(G);var H=V(0);V(2),V(3),H.default.Add=function(z){H.default.Signal.call(this),this.createInsOuts(2,0),this._sum=this.input[0]=this.input[1]=this.output=new H.default.Gain,this._param=this.input[1]=new H.default.Signal(z),this._param.connect(this._sum)},H.default.extend(H.default.Add,H.default.Signal),H.default.Add.prototype.dispose=function(){return H.default.Signal.prototype.dispose.call(this),this._sum.dispose(),this._sum=null,this},G.default=H.default.Add},function(z,G,V){V.r(G);var H=V(0);V(1),H.default.SignalBase=function(){H.default.AudioNode.call(this)},H.default.extend(H.default.SignalBase,H.default.AudioNode),H.default.SignalBase.prototype.connect=function(z,G,V){return H.default.Signal&&H.default.Signal===z.constructor||H.default.Param&&H.default.Param===z.constructor?(z._param.cancelScheduledValues(0),z._param.setValueAtTime(0,0),z.overridden=!0):z instanceof AudioParam&&(z.cancelScheduledValues(0),z.setValueAtTime(0,0)),H.default.AudioNode.prototype.connect.call(this,z,G,V),this},G.default=H.default.SignalBase},function(z,G,V){V.r(G);var H=V(0);V(47),V(3),H.default.AmplitudeEnvelope=function(){H.default.Envelope.apply(this,arguments),this.input=this.output=new H.default.Gain,this._sig.connect(this.output.gain)},H.default.extend(H.default.AmplitudeEnvelope,H.default.Envelope),H.default.AmplitudeEnvelope.prototype.dispose=function(){return H.default.Envelope.prototype.dispose.call(this),this},G.default=H.default.AmplitudeEnvelope},function(z,G,V){V.r(G);var H=V(0);V(11),V(6),V(3),V(1),H.default.BufferSource=function(){var z=H.default.defaults(arguments,["buffer","onload"],H.default.BufferSource);H.default.AudioNode.call(this,z),this.onended=z.onended,this._startTime=-1,this._sourceStarted=!1,this._sourceStopped=!1,this._stopTime=-1,this._gainNode=this.output=new H.default.Gain(0),this._source=this.context.createBufferSource(),H.default.connect(this._source,this._gainNode),this._source.onended=this._onended.bind(this),this._buffer=new H.default.Buffer(z.buffer,z.onload),this.playbackRate=new H.default.Param({param:this._source.playbackRate,units:H.default.Type.Positive,value:z.playbackRate}),this.fadeIn=z.fadeIn,this.fadeOut=z.fadeOut,this.curve=z.curve,this._onendedTimeout=-1,this.loop=z.loop,this.loopStart=z.loopStart,this.loopEnd=z.loopEnd},H.default.extend(H.default.BufferSource,H.default.AudioNode),H.default.BufferSource.defaults={onended:H.default.noOp,onload:H.default.noOp,loop:!1,loopStart:0,loopEnd:0,fadeIn:0,fadeOut:0,curve:"linear",playbackRate:1},Object.defineProperty(H.default.BufferSource.prototype,"state",{get:function(){return this.getStateAtTime(this.now())}}),H.default.BufferSource.prototype.getStateAtTime=function(z){return z=this.toSeconds(z),-1!==this._startTime&&this._startTime<=z&&(-1===this._stopTime||z<this._stopTime)&&!this._sourceStopped?H.default.State.Started:H.default.State.Stopped},H.default.BufferSource.prototype.start=function(z,G,V,W){this.log("start",z,G,V,W),this.assert(-1===this._startTime,"can only be started once"),this.assert(this.buffer.loaded,"buffer is either not set or not loaded"),this.assert(!this._sourceStopped,"source is already stopped"),z=this.toSeconds(z),G=this.loop?H.default.defaultArg(G,this.loopStart):H.default.defaultArg(G,0),G=this.toSeconds(G),G=Math.max(G,0),W=H.default.defaultArg(W,1);var K=this.toSeconds(this.fadeIn);if(K>0?(this._gainNode.gain.setValueAtTime(0,z),"linear"===this.curve?this._gainNode.gain.linearRampToValueAtTime(W,z+K):this._gainNode.gain.exponentialApproachValueAtTime(W,z,K)):this._gainNode.gain.setValueAtTime(W,z),this._startTime=z,H.default.isDefined(V)){var Z=this.toSeconds(V);Z=Math.max(Z,0),this.stop(z+Z)}if(this.loop){var it=this.loopEnd||this.buffer.duration,ot=this.loopStart;G>=it&&(G=(G-ot)%(it-ot)+ot)}return this._source.buffer=this.buffer.get(),this._source.loopEnd=this.loopEnd||this.buffer.duration,G<this.buffer.duration&&(this._sourceStarted=!0,this._source.start(z,G)),this},H.default.BufferSource.prototype.stop=function(z){this.log("stop",z),this.assert(this.buffer.loaded,"buffer is either not set or not loaded"),this.assert(!this._sourceStopped,"source is already stopped"),z=this.toSeconds(z),-1!==this._stopTime&&this.cancelStop();var G=this.toSeconds(this.fadeOut);return this._stopTime=z+G,G>0?"linear"===this.curve?this._gainNode.gain.linearRampTo(0,G,z):this._gainNode.gain.targetRampTo(0,G,z):(this._gainNode.gain.cancelAndHoldAtTime(z),this._gainNode.gain.setValueAtTime(0,z)),H.default.context.clearTimeout(this._onendedTimeout),this._onendedTimeout=H.default.context.setTimeout(this._onended.bind(this),this._stopTime-this.now()),this},H.default.BufferSource.prototype.cancelStop=function(){if(-1!==this._startTime&&!this._sourceStopped){var z=this.toSeconds(this.fadeIn);this._gainNode.gain.cancelScheduledValues(this._startTime+z+this.sampleTime),this.context.clearTimeout(this._onendedTimeout),this._stopTime=-1}return this},H.default.BufferSource.prototype._onended=function(){if(!this._sourceStopped){this._sourceStopped=!0;var z="exponential"===this.curve?2*this.fadeOut:0;this._sourceStarted&&-1!==this._stopTime&&this._source.stop(this._stopTime+z),this.onended(this),setTimeout(function(){this._source&&(this._source.disconnect(),this._gainNode.disconnect())}.bind(this),1e3*z+100)}},Object.defineProperty(H.default.BufferSource.prototype,"loopStart",{get:function(){return this._source.loopStart},set:function(z){this._source.loopStart=this.toSeconds(z)}}),Object.defineProperty(H.default.BufferSource.prototype,"loopEnd",{get:function(){return this._source.loopEnd},set:function(z){this._source.loopEnd=this.toSeconds(z)}}),Object.defineProperty(H.default.BufferSource.prototype,"buffer",{get:function(){return this._buffer},set:function(z){this._buffer.set(z)}}),Object.defineProperty(H.default.BufferSource.prototype,"loop",{get:function(){return this._source.loop},set:function(z){this._source.loop=z,this.cancelStop()}}),H.default.BufferSource.prototype.dispose=function(){return this._wasDisposed||(this._wasDisposed=!0,H.default.AudioNode.prototype.dispose.call(this),this.onended=null,this._source.onended=null,this._source.disconnect(),this._source=null,this._gainNode.dispose(),this._gainNode=null,this._buffer.dispose(),this._buffer=null,this._startTime=-1,this.playbackRate=null,H.default.context.clearTimeout(this._onendedTimeout)),this},G.default=H.default.BufferSource},function(z,G,V){V.r(G);var H=V(0);V(8),V(2),V(5),V(3),H.default.FeedbackEffect=function(){var z=H.default.defaults(arguments,["feedback"],H.default.FeedbackEffect);H.default.Effect.call(this,z),this._feedbackGain=new H.default.Gain(z.feedback,H.default.Type.NormalRange),this.feedback=this._feedbackGain.gain,this.effectReturn.chain(this._feedbackGain,this.effectSend),this._readOnly(["feedback"])},H.default.extend(H.default.FeedbackEffect,H.default.Effect),H.default.FeedbackEffect.defaults={feedback:.125},H.default.FeedbackEffect.prototype.dispose=function(){return H.default.Effect.prototype.dispose.call(this),this._writable(["feedback"]),this._feedbackGain.dispose(),this._feedbackGain=null,this.feedback=null,this},G.default=H.default.FeedbackEffect},function(z,G,V){V.r(G);var H=V(0);V(24),V(4),H.default.TimelineState=function(z){H.default.Timeline.call(this),this._initial=z},H.default.extend(H.default.TimelineState,H.default.Timeline),H.default.TimelineState.prototype.getValueAtTime=function(z){var G=this.get(z);return null!==G?G.state:this._initial},H.default.TimelineState.prototype.setStateAtTime=function(z,G){return this.add({state:z,time:G}),this},H.default.TimelineState.prototype.getLastState=function(z,G){G=this.toSeconds(G);for(var V=this._search(G);V>=0;V--){var H=this._timeline[V];if(H.state===z)return H}},H.default.TimelineState.prototype.getNextState=function(z,G){G=this.toSeconds(G);var V=this._search(G);if(-1!==V)for(var H=V;H<this._timeline.length;H++){var W=this._timeline[H];if(W.state===z)return W}},G.default=H.default.TimelineState},function(z,G,V){V.r(G);var H=V(0);H.default.Emitter=function(){H.default.call(this),this._events={}},H.default.extend(H.default.Emitter),H.default.Emitter.prototype.on=function(z,G){for(var V=z.split(/\W+/),H=0;H<V.length;H++){var W=V[H];this._events.hasOwnProperty(W)||(this._events[W]=[]),this._events[W].push(G)}return this},H.default.Emitter.prototype.once=function(z,G){var V=function(){G.apply(this,arguments),this.off(z,V)}.bind(this);return this.on(z,V),this},H.default.Emitter.prototype.off=function(z,G){for(var V=z.split(/\W+/),W=0;W<V.length;W++)if(z=V[W],this._events.hasOwnProperty(z))if(H.default.isUndef(G))this._events[z]=[];else for(var K=this._events[z],Z=0;Z<K.length;Z++)K[Z]===G&&K.splice(Z,1);return this},H.default.Emitter.prototype.emit=function(z){if(this._events){var G=Array.apply(null,arguments).slice(1);if(this._events.hasOwnProperty(z))for(var V=this._events[z].slice(0),H=0,W=V.length;H<W;H++)V[H].apply(this,G)}return this},H.default.Emitter.mixin=function(z){var G=["on","once","off","emit"];z._events={};for(var V=0;V<G.length;V++){var W=G[V],K=H.default.Emitter.prototype[W];z[W]=K}return H.default.Emitter},H.default.Emitter.prototype.dispose=function(){return H.default.prototype.dispose.call(this),this._events=null,this},G.default=H.default.Emitter},function(z,G,V){V.r(G);var H=V(0);V(1),V(44),H.default.supported&&(AnalyserNode.prototype.getFloatTimeDomainData||(AnalyserNode.prototype.getFloatTimeDomainData=function(z){var G=new Uint8Array(z.length);this.getByteTimeDomainData(G);for(var V=0;V<G.length;V++)z[V]=(G[V]-128)/128})),H.default.Analyser=function(){var z=H.default.defaults(arguments,["type","size"],H.default.Analyser);H.default.AudioNode.call(this),this._analyser=this.input=this.output=this.context.createAnalyser(),this._type=z.type,this._buffer=null,this.size=z.size,this.type=z.type},H.default.extend(H.default.Analyser,H.default.AudioNode),H.default.Analyser.defaults={size:1024,type:"fft",smoothing:.8},H.default.Analyser.Type={Waveform:"waveform",FFT:"fft"},H.default.Analyser.prototype.getValue=function(){return this._type===H.default.Analyser.Type.FFT?this._analyser.getFloatFrequencyData(this._buffer):this._type===H.default.Analyser.Type.Waveform&&this._analyser.getFloatTimeDomainData(this._buffer),this._buffer},Object.defineProperty(H.default.Analyser.prototype,"size",{get:function(){return this._analyser.frequencyBinCount},set:function(z){this._analyser.fftSize=2*z,this._buffer=new Float32Array(z)}}),Object.defineProperty(H.default.Analyser.prototype,"type",{get:function(){return this._type},set:function(z){if(z!==H.default.Analyser.Type.Waveform&&z!==H.default.Analyser.Type.FFT)throw new TypeError("Tone.Analyser: invalid type: "+z);this._type=z}}),Object.defineProperty(H.default.Analyser.prototype,"smoothing",{get:function(){return this._analyser.smoothingTimeConstant},set:function(z){this._analyser.smoothingTimeConstant=z}}),H.default.Analyser.prototype.dispose=function(){H.default.AudioNode.prototype.dispose.call(this),this._analyser.disconnect(),this._analyser=null,this._buffer=null},G.default=H.default.Analyser},function(z,G,V){V.r(G);var H=V(0);V(6),V(17),V(50),V(69),V(49),V(68),V(67),H.default.OmniOscillator=function(){var z=H.default.defaults(arguments,["frequency","type"],H.default.OmniOscillator);H.default.Source.call(this,z),this.frequency=new H.default.Signal(z.frequency,H.default.Type.Frequency),this.detune=new H.default.Signal(z.detune,H.default.Type.Cents),this._sourceType=void 0,this._oscillator=null,this.type=z.type,this._readOnly(["frequency","detune"]),this.set(z)},H.default.extend(H.default.OmniOscillator,H.default.Source),H.default.OmniOscillator.defaults={frequency:440,detune:0,type:"sine",phase:0};var W="PulseOscillator",K="PWMOscillator",Z="FMOscillator",it="AMOscillator",ot="FatOscillator";H.default.OmniOscillator.prototype._start=function(z){this._oscillator.start(z)},H.default.OmniOscillator.prototype._stop=function(z){this._oscillator.stop(z)},H.default.OmniOscillator.prototype.restart=function(z){this._oscillator.restart(z)},Object.defineProperty(H.default.OmniOscillator.prototype,"type",{get:function(){var z="";return this._sourceType===Z?z="fm":this._sourceType===it?z="am":this._sourceType===ot&&(z="fat"),z+this._oscillator.type},set:function(z){"fm"===z.substr(0,2)?(this._createNewOscillator(Z),this._oscillator.type=z.substr(2)):"am"===z.substr(0,2)?(this._createNewOscillator(it),this._oscillator.type=z.substr(2)):"fat"===z.substr(0,3)?(this._createNewOscillator(ot),this._oscillator.type=z.substr(3)):"pwm"===z?this._createNewOscillator(K):"pulse"===z?this._createNewOscillator(W):(this._createNewOscillator("Oscillator"),this._oscillator.type=z)}}),Object.defineProperty(H.default.OmniOscillator.prototype,"partials",{get:function(){return this._oscillator.partials},set:function(z){this._oscillator.partials=z}}),Object.defineProperty(H.default.OmniOscillator.prototype,"partialCount",{get:function(){return this._oscillator.partialCount},set:function(z){this._oscillator.partialCount=z}}),H.default.OmniOscillator.prototype.set=function(z,G){return"type"===z?this.type=G:H.default.isObject(z)&&z.hasOwnProperty("type")&&(this.type=z.type),H.default.prototype.set.apply(this,arguments),this},H.default.OmniOscillator.prototype.get=function(z){var G=this._oscillator.get(z);return G.type=this.type,G},H.default.OmniOscillator.prototype._createNewOscillator=function(z){if(z!==this._sourceType){this._sourceType=z;var G=H.default[z],V=this.now();if(null!==this._oscillator){var W=this._oscillator;W.stop(V),this.context.setTimeout((function(){W.dispose(),W=null}),this.blockTime)}this._oscillator=new G,this.frequency.connect(this._oscillator.frequency),this.detune.connect(this._oscillator.detune),this._oscillator.connect(this.output),this.state===H.default.State.Started&&this._oscillator.start(V)}},Object.defineProperty(H.default.OmniOscillator.prototype,"phase",{get:function(){return this._oscillator.phase},set:function(z){this._oscillator.phase=z}});var rt={PulseOscillator:"pulse",PWMOscillator:"pwm",Oscillator:"oscillator",FMOscillator:"fm",AMOscillator:"am",FatOscillator:"fat"};Object.defineProperty(H.default.OmniOscillator.prototype,"sourceType",{get:function(){return rt[this._sourceType]},set:function(z){var G="sine";"pwm"!==this._oscillator.type&&"pulse"!==this._oscillator.type&&(G=this._oscillator.type),z===rt.FMOscillator?this.type="fm"+G:z===rt.AMOscillator?this.type="am"+G:z===rt.FatOscillator?this.type="fat"+G:z===rt.Oscillator?this.type=G:z===rt.PulseOscillator?this.type="pulse":z===rt.PWMOscillator&&(this.type="pwm")}}),Object.defineProperty(H.default.OmniOscillator.prototype,"baseType",{get:function(){return this._oscillator.baseType},set:function(z){this.sourceType!==rt.PulseOscillator&&this.sourceType!==rt.PWMOscillator&&(this._oscillator.baseType=z)}}),Object.defineProperty(H.default.OmniOscillator.prototype,"width",{get:function(){return this._sourceType===W?this._oscillator.width:void 0}}),Object.defineProperty(H.default.OmniOscillator.prototype,"count",{get:function(){return this._sourceType===ot?this._oscillator.count:void 0},set:function(z){this._sourceType===ot&&(this._oscillator.count=z)}}),Object.defineProperty(H.default.OmniOscillator.prototype,"spread",{get:function(){return this._sourceType===ot?this._oscillator.spread:void 0},set:function(z){this._sourceType===ot&&(this._oscillator.spread=z)}}),Object.defineProperty(H.default.OmniOscillator.prototype,"modulationType",{get:function(){return this._sourceType===Z||this._sourceType===it?this._oscillator.modulationType:void 0},set:function(z){this._sourceType!==Z&&this._sourceType!==it||(this._oscillator.modulationType=z)}}),Object.defineProperty(H.default.OmniOscillator.prototype,"modulationIndex",{get:function(){return this._sourceType===Z?this._oscillator.modulationIndex:void 0}}),Object.defineProperty(H.default.OmniOscillator.prototype,"harmonicity",{get:function(){return this._sourceType===Z||this._sourceType===it?this._oscillator.harmonicity:void 0}}),Object.defineProperty(H.default.OmniOscillator.prototype,"modulationFrequency",{get:function(){return this._sourceType===K?this._oscillator.modulationFrequency:void 0}}),H.default.OmniOscillator.prototype.dispose=function(){return H.default.Source.prototype.dispose.call(this),this._writable(["frequency","detune"]),this.detune.dispose(),this.detune=null,this.frequency.dispose(),this.frequency=null,this._oscillator.dispose(),this._oscillator=null,this._sourceType=null,this},G.default=H.default.OmniOscillator},function(z,G,V){V.r(G);var H=V(0);V(31),V(37),V(25),H.default.Synth=function(z){z=H.default.defaultArg(z,H.default.Synth.defaults),H.default.Monophonic.call(this,z),this.oscillator=new H.default.OmniOscillator(z.oscillator),this.frequency=this.oscillator.frequency,this.detune=this.oscillator.detune,this.envelope=new H.default.AmplitudeEnvelope(z.envelope),this.oscillator.chain(this.envelope,this.output),this._readOnly(["oscillator","frequency","detune","envelope"])},H.default.extend(H.default.Synth,H.default.Monophonic),H.default.Synth.defaults={oscillator:{type:"triangle"},envelope:{attack:.005,decay:.1,sustain:.3,release:1}},H.default.Synth.prototype._triggerEnvelopeAttack=function(z,G){return this.envelope.triggerAttack(z,G),this.oscillator.start(z),0===this.envelope.sustain&&this.oscillator.stop(z+this.toSeconds(this.envelope.attack)+this.toSeconds(this.envelope.decay)),this},H.default.Synth.prototype._triggerEnvelopeRelease=function(z){return z=this.toSeconds(z),this.envelope.triggerRelease(z),this.oscillator.stop(z+this.toSeconds(this.envelope.release)),this},H.default.Synth.prototype.dispose=function(){return H.default.Monophonic.prototype.dispose.call(this),this._writable(["oscillator","frequency","detune","envelope"]),this.oscillator.dispose(),this.oscillator=null,this.envelope.dispose(),this.envelope=null,this.frequency=null,this.detune=null,this},G.default=H.default.Synth},function(z,G,V){V.r(G);var H=V(0);V(6),V(11),V(32),H.default.Noise=function(){var z=H.default.defaults(arguments,["type"],H.default.Noise);H.default.Source.call(this,z),this._source=null,this._type=z.type,this._playbackRate=z.playbackRate},H.default.extend(H.default.Noise,H.default.Source),H.default.Noise.defaults={type:"white",playbackRate:1},Object.defineProperty(H.default.Noise.prototype,"type",{get:function(){return this._type},set:function(z){if(this._type!==z){if(!(z in W))throw new TypeError("Tone.Noise: invalid type: "+z);if(this._type=z,this.state===H.default.State.Started){var G=this.now();this._stop(G),this._start(G)}}}}),Object.defineProperty(H.default.Noise.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(z){this._playbackRate=z,this._source&&(this._source.playbackRate.value=z)}}),H.default.Noise.prototype._start=function(z){var G=W[this._type];this._source=new H.default.BufferSource(G).connect(this.output),this._source.loop=!0,this._source.playbackRate.value=this._playbackRate,this._source.start(this.toSeconds(z),Math.random()*(G.duration-.001))},H.default.Noise.prototype._stop=function(z){this._source&&(this._source.stop(this.toSeconds(z)),this._source=null)},H.default.Noise.prototype.restart=function(z){return this._stop(z),this._start(z),this},H.default.Noise.prototype.dispose=function(){return H.default.Source.prototype.dispose.call(this),null!==this._source&&(this._source.disconnect(),this._source=null),this._buffer=null,this};var W={},K={};Object.defineProperty(W,"pink",{get:function(){if(!K.pink){for(var z=[],G=0;G<2;G++){var V,W,Z,it,ot,rt,at,ut=new Float32Array(220500);z[G]=ut,V=W=Z=it=ot=rt=at=0;for(var lt=0;lt<220500;lt++){var ct=2*Math.random()-1;V=.99886*V+.0555179*ct,W=.99332*W+.0750759*ct,Z=.969*Z+.153852*ct,it=.8665*it+.3104856*ct,ot=.55*ot+.5329522*ct,rt=-.7616*rt-.016898*ct,ut[lt]=V+W+Z+it+ot+rt+at+.5362*ct,ut[lt]*=.11,at=.115926*ct}}K.pink=(new H.default.Buffer).fromArray(z)}return K.pink}}),Object.defineProperty(W,"brown",{get:function(){if(!K.brown){for(var z=[],G=0;G<2;G++){var V=new Float32Array(220500);z[G]=V;for(var W=0,Z=0;Z<220500;Z++){var it=2*Math.random()-1;V[Z]=(W+.02*it)/1.02,W=V[Z],V[Z]*=3.5}}K.brown=(new H.default.Buffer).fromArray(z)}return K.brown}}),Object.defineProperty(W,"white",{get:function(){if(!K.white){for(var z=[],G=0;G<2;G++){var V=new Float32Array(220500);z[G]=V;for(var W=0;W<220500;W++)V[W]=2*Math.random()-1}K.white=(new H.default.Buffer).fromArray(z)}return K.white}}),G.default=H.default.Noise},function(z,G,V){V.r(G);var H=V(0);V(27),V(20),V(1),H.default.Master=function(){H.default.AudioNode.call(this),H.default.getContext(function(){this.createInsOuts(1,0),this._volume=this.output=new H.default.Volume,this.volume=this._volume.volume,this._readOnly("volume"),H.default.connectSeries(this.input,this.output,this.context.destination),this.context.master=this}.bind(this))},H.default.extend(H.default.Master,H.default.AudioNode),H.default.Master.defaults={volume:0,mute:!1},H.default.Master.prototype.isMaster=!0,Object.defineProperty(H.default.Master.prototype,"mute",{get:function(){return this._volume.mute},set:function(z){this._volume.mute=z}}),H.default.Master.prototype.chain=function(){this.input.disconnect();var z=Array.from(arguments);z.unshift(this.input),z.push(this.output),H.default.connectSeries.apply(void 0,z)},H.default.Master.prototype.dispose=function(){H.default.AudioNode.prototype.dispose.call(this),this._writable("volume"),this._volume.dispose(),this._volume=null,this.volume=null},H.default.AudioNode.prototype.toMaster=function(){return this.connect(this.context.master),this};var W=H.default.Master;H.default.Master=new W,H.default.Context.on("init",(function(z){z.master&&z.master.isMaster?H.default.Master=z.master:H.default.Master=new W})),H.default.Context.on("close",(function(z){z.master&&z.master.isMaster&&z.master.dispose()})),G.default=H.default.Master},function(z,G,V){V.r(G);var H=V(0);V(86),V(47),H.default.FrequencyEnvelope=function(){var z=H.default.defaults(arguments,["attack","decay","sustain","release"],H.default.Envelope);z=H.default.defaultArg(z,H.default.FrequencyEnvelope.defaults),H.default.ScaledEnvelope.call(this,z),this._octaves=z.octaves,this.baseFrequency=z.baseFrequency,this.octaves=z.octaves,this.exponent=z.exponent},H.default.extend(H.default.FrequencyEnvelope,H.default.Envelope),H.default.FrequencyEnvelope.defaults={baseFrequency:200,octaves:4,exponent:1},Object.defineProperty(H.default.FrequencyEnvelope.prototype,"baseFrequency",{get:function(){return this._scale.min},set:function(z){this._scale.min=this.toFrequency(z),this.octaves=this._octaves}}),Object.defineProperty(H.default.FrequencyEnvelope.prototype,"octaves",{get:function(){return this._octaves},set:function(z){this._octaves=z,this._scale.max=this.baseFrequency*Math.pow(2,z)}}),Object.defineProperty(H.default.FrequencyEnvelope.prototype,"exponent",{get:function(){return this._exp.value},set:function(z){this._exp.value=z}}),H.default.FrequencyEnvelope.prototype.dispose=function(){return H.default.ScaledEnvelope.prototype.dispose.call(this),this},G.default=H.default.FrequencyEnvelope},function(z,G,V){V.r(G);var H=V(0);V(26),V(61),H.default.ScaleExp=function(z,G,V){H.default.SignalBase.call(this),this._scale=this.output=new H.default.Scale(z,G),this._exp=this.input=new H.default.Pow(H.default.defaultArg(V,2)),this._exp.connect(this._scale)},H.default.extend(H.default.ScaleExp,H.default.SignalBase),Object.defineProperty(H.default.ScaleExp.prototype,"exponent",{get:function(){return this._exp.value},set:function(z){this._exp.value=z}}),Object.defineProperty(H.default.ScaleExp.prototype,"min",{get:function(){return this._scale.min},set:function(z){this._scale.min=z}}),Object.defineProperty(H.default.ScaleExp.prototype,"max",{get:function(){return this._scale.max},set:function(z){this._scale.max=z}}),H.default.ScaleExp.prototype.dispose=function(){return H.default.SignalBase.prototype.dispose.call(this),this._scale.dispose(),this._scale=null,this._exp.dispose(),this._exp=null,this},G.default=H.default.ScaleExp},function(z,G,V){V.r(G);var H=V(0);V(14),V(1),H.default.Compressor=function(){var z=H.default.defaults(arguments,["threshold","ratio"],H.default.Compressor);H.default.AudioNode.call(this),this._compressor=this.input=this.output=this.context.createDynamicsCompressor(),this.threshold=new H.default.Param({param:this._compressor.threshold,units:H.default.Type.Decibels,convert:!1}),this.attack=new H.default.Param(this._compressor.attack,H.default.Type.Time),this.release=new H.default.Param(this._compressor.release,H.default.Type.Time),this.knee=new H.default.Param({param:this._compressor.knee,units:H.default.Type.Decibels,convert:!1}),this.ratio=new H.default.Param({param:this._compressor.ratio,convert:!1}),this._readOnly(["knee","release","attack","ratio","threshold"]),this.set(z)},H.default.extend(H.default.Compressor,H.default.AudioNode),H.default.Compressor.defaults={ratio:12,threshold:-24,release:.25,attack:.003,knee:30},H.default.Compressor.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._writable(["knee","release","attack","ratio","threshold"]),this._compressor.disconnect(),this._compressor=null,this.attack.dispose(),this.attack=null,this.release.dispose(),this.release=null,this.threshold.dispose(),this.threshold=null,this.ratio.dispose(),this.ratio=null,this.knee.dispose(),this.knee=null,this},G.default=H.default.Compressor},function(z,G,V){var H=V(0);if(V(92),H.default.supported){!H.default.global.hasOwnProperty("AudioContext")&&H.default.global.hasOwnProperty("webkitAudioContext")&&(H.default.global.AudioContext=H.default.global.webkitAudioContext),AudioContext.prototype.close||(AudioContext.prototype.close=function(){return H.default.isFunction(this.suspend)&&this.suspend(),Promise.resolve()}),AudioContext.prototype.resume||(AudioContext.prototype.resume=function(){var z=this.createBuffer(1,1,this.sampleRate),G=this.createBufferSource();return G.buffer=z,G.connect(this.destination),G.start(0),Promise.resolve()}),!AudioContext.prototype.createGain&&AudioContext.prototype.createGainNode&&(AudioContext.prototype.createGain=AudioContext.prototype.createGainNode),!AudioContext.prototype.createDelay&&AudioContext.prototype.createDelayNode&&(AudioContext.prototype.createDelay=AudioContext.prototype.createDelayNode);var W=!1,K=new OfflineAudioContext(1,1,44100),Z=new Uint32Array([1179011410,48,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,8,0,0,0,0]).buffer;try{var it=K.decodeAudioData(Z);it&&H.default.isFunction(it.then)&&(W=!0)}catch(z){W=!1}W||(AudioContext.prototype._native_decodeAudioData=AudioContext.prototype.decodeAudioData,AudioContext.prototype.decodeAudioData=function(z){return new Promise(function(G,V){this._native_decodeAudioData(z,G,V)}.bind(this))})}},function(z,G,V){V.r(G);var H=V(0);V(63),H.default.TransportTime=function(z,G){if(!(this instanceof H.default.TransportTime))return new H.default.TransportTime(z,G);H.default.Time.call(this,z,G)},H.default.extend(H.default.TransportTime,H.default.Time),H.default.TransportTime.prototype._now=function(){return H.default.Transport.seconds},G.default=H.default.TransportTime},function(z,G,V){V.r(G);var H=V(0);V(62),H.default.Frequency=function(z,G){if(!(this instanceof H.default.Frequency))return new H.default.Frequency(z,G);H.default.TimeBase.call(this,z,G)},H.default.extend(H.default.Frequency,H.default.TimeBase),H.default.Frequency.prototype._expressions=Object.assign({},H.default.TimeBase.prototype._expressions,{midi:{regexp:/^(\d+(?:\.\d+)?midi)/,method:function(z){return"midi"===this._defaultUnits?z:H.default.Frequency.mtof(z)}},note:{regexp:/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i,method:function(z,G){var V=W[z.toLowerCase()]+12*(parseInt(G)+1);return"midi"===this._defaultUnits?V:H.default.Frequency.mtof(V)}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?/,method:function(z,G,V){var H=1;return z&&"0"!==z&&(H*=this._beatsToUnits(this._getTimeSignature()*parseFloat(z))),G&&"0"!==G&&(H*=this._beatsToUnits(parseFloat(G))),V&&"0"!==V&&(H*=this._beatsToUnits(parseFloat(V)/4)),H}}}),H.default.Frequency.prototype.transpose=function(z){return new this.constructor(this.valueOf()*H.default.intervalToFrequencyRatio(z))},H.default.Frequency.prototype.harmonize=function(z){return z.map(function(z){return this.transpose(z)}.bind(this))},H.default.Frequency.prototype.toMidi=function(){return H.default.Frequency.ftom(this.valueOf())},H.default.Frequency.prototype.toNote=function(){var z=this.toFrequency(),G=Math.log2(z/H.default.Frequency.A4),V=Math.round(12*G)+57,W=Math.floor(V/12);return W<0&&(V+=-12*W),K[V%12]+W.toString()},H.default.Frequency.prototype.toSeconds=function(){return 1/H.default.TimeBase.prototype.toSeconds.call(this)},H.default.Frequency.prototype.toFrequency=function(){return H.default.TimeBase.prototype.toFrequency.call(this)},H.default.Frequency.prototype.toTicks=function(){var z=this._beatsToUnits(1),G=this.valueOf()/z;return Math.floor(G*H.default.Transport.PPQ)},H.default.Frequency.prototype._noArg=function(){return 0},H.default.Frequency.prototype._frequencyToUnits=function(z){return z},H.default.Frequency.prototype._ticksToUnits=function(z){return 1/(60*z/(H.default.Transport.bpm.value*H.default.Transport.PPQ))},H.default.Frequency.prototype._beatsToUnits=function(z){return 1/H.default.TimeBase.prototype._beatsToUnits.call(this,z)},H.default.Frequency.prototype._secondsToUnits=function(z){return 1/z},H.default.Frequency.prototype._defaultUnits="hz";var W={cbb:-2,cb:-1,c:0,"c#":1,cx:2,dbb:0,db:1,d:2,"d#":3,dx:4,ebb:2,eb:3,e:4,"e#":5,ex:6,fbb:3,fb:4,f:5,"f#":6,fx:7,gbb:5,gb:6,g:7,"g#":8,gx:9,abb:7,ab:8,a:9,"a#":10,ax:11,bbb:9,bb:10,b:11,"b#":12,bx:13},K=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];H.default.Frequency.A4=440,H.default.Frequency.mtof=function(z){return H.default.Frequency.A4*Math.pow(2,(z-69)/12)},H.default.Frequency.ftom=function(z){return 69+Math.round(12*Math.log2(z/H.default.Frequency.A4))},G.default=H.default.Frequency},function(z,G,V){V.r(G);var H=V(0);V(2),V(61),V(4),V(1),H.default.Envelope=function(){var z=H.default.defaults(arguments,["attack","decay","sustain","release"],H.default.Envelope);H.default.AudioNode.call(this),this.attack=z.attack,this.decay=z.decay,this.sustain=z.sustain,this.release=z.release,this._attackCurve="linear",this._releaseCurve="exponential",this._sig=this.output=new H.default.Signal(0),this.attackCurve=z.attackCurve,this.releaseCurve=z.releaseCurve,this.decayCurve=z.decayCurve},H.default.extend(H.default.Envelope,H.default.AudioNode),H.default.Envelope.defaults={attack:.01,decay:.1,sustain:.5,release:1,attackCurve:"linear",decayCurve:"exponential",releaseCurve:"exponential"},Object.defineProperty(H.default.Envelope.prototype,"value",{get:function(){return this.getValueAtTime(this.now())}}),H.default.Envelope.prototype._getCurve=function(z,G){if(H.default.isString(z))return z;if(H.default.isArray(z))for(var V in H.default.Envelope.Type)if(H.default.Envelope.Type[V][G]===z)return V},H.default.Envelope.prototype._setCurve=function(z,G,V){if(H.default.Envelope.Type.hasOwnProperty(V)){var W=H.default.Envelope.Type[V];H.default.isObject(W)?this[z]=W[G]:this[z]=W}else{if(!H.default.isArray(V))throw new Error("Tone.Envelope: invalid curve: "+V);this[z]=V}},Object.defineProperty(H.default.Envelope.prototype,"attackCurve",{get:function(){return this._getCurve(this._attackCurve,"In")},set:function(z){this._setCurve("_attackCurve","In",z)}}),Object.defineProperty(H.default.Envelope.prototype,"releaseCurve",{get:function(){return this._getCurve(this._releaseCurve,"Out")},set:function(z){this._setCurve("_releaseCurve","Out",z)}}),Object.defineProperty(H.default.Envelope.prototype,"decayCurve",{get:function(){return this._decayCurve},set:function(z){if(!["linear","exponential"].includes(z))throw new Error("Tone.Envelope: invalid curve: "+z);this._decayCurve=z}}),H.default.Envelope.prototype.triggerAttack=function(z,G){this.log("triggerAttack",z,G),z=this.toSeconds(z);var V=this.toSeconds(this.attack),W=this.toSeconds(this.decay);G=H.default.defaultArg(G,1);var K=this.getValueAtTime(z);if(K>0&&(V=(1-K)/(1/V)),0===V)this._sig.setValueAtTime(G,z);else if("linear"===this._attackCurve)this._sig.linearRampTo(G,V,z);else if("exponential"===this._attackCurve)this._sig.targetRampTo(G,V,z);else if(V>0){this._sig.cancelAndHoldAtTime(z);for(var Z=this._attackCurve,it=1;it<Z.length;it++)if(Z[it-1]<=K&&K<=Z[it]){(Z=this._attackCurve.slice(it))[0]=K;break}this._sig.setValueCurveAtTime(Z,z,V,G)}if(W){var ot=G*this.sustain,rt=z+V;this.log("decay",rt),"linear"===this._decayCurve?this._sig.linearRampTo(ot,W,rt+this.sampleTime):"exponential"===this._decayCurve&&this._sig.exponentialApproachValueAtTime(ot,rt,W)}return this},H.default.Envelope.prototype.triggerRelease=function(z){this.log("triggerRelease",z),z=this.toSeconds(z);var G=this.getValueAtTime(z);if(G>0){var V=this.toSeconds(this.release);if("linear"===this._releaseCurve)this._sig.linearRampTo(0,V,z);else if("exponential"===this._releaseCurve)this._sig.targetRampTo(0,V,z);else{var W=this._releaseCurve;H.default.isArray(W)&&(this._sig.cancelAndHoldAtTime(z),this._sig.setValueCurveAtTime(W,z,V,G))}}return this},H.default.Envelope.prototype.getValueAtTime=function(z){return this._sig.getValueAtTime(z)},H.default.Envelope.prototype.triggerAttackRelease=function(z,G,V){return G=this.toSeconds(G),this.triggerAttack(G,V),this.triggerRelease(G+this.toSeconds(z)),this},H.default.Envelope.prototype.cancel=function(z){return this._sig.cancelScheduledValues(z),this},H.default.Envelope.prototype.connect=H.default.SignalBase.prototype.connect,function(){var z,G,V=[];for(z=0;z<128;z++)V[z]=Math.sin(z/127*(Math.PI/2));var W=[];for(z=0;z<127;z++){G=z/127;var K=Math.sin(G*(2*Math.PI)*6.4-Math.PI/2)+1;W[z]=K/10+.83*G}W[127]=1;var Z=[];for(z=0;z<128;z++)Z[z]=Math.ceil(z/127*5)/5;var it=[];for(z=0;z<128;z++)G=z/127,it[z]=.5*(1-Math.cos(Math.PI*G));var ot,rt=[];for(z=0;z<128;z++){G=z/127;var at=4*Math.pow(G,3)+.2,ut=Math.cos(at*Math.PI*2*G);rt[z]=Math.abs(ut*(1-G))}function h(z){for(var G=new Array(z.length),V=0;V<z.length;V++)G[V]=1-z[V];return G}H.default.Envelope.Type={linear:"linear",exponential:"exponential",bounce:{In:h(rt),Out:rt},cosine:{In:V,Out:(ot=V,ot.slice(0).reverse())},step:{In:Z,Out:h(Z)},ripple:{In:W,Out:h(W)},sine:{In:it,Out:h(it)}}}(),H.default.Envelope.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._sig.dispose(),this._sig=null,this._attackCurve=null,this._releaseCurve=null,this},G.default=H.default.Envelope},function(z,G,V){V.r(G);var H=V(0);if(V(23),V(10),V(19),V(7),V(28),V(3),V(2),V(20),H.default.supported&&!H.default.global.AudioContext.prototype.createStereoPanner){var n=function(z){this.context=z,this.pan=new H.default.Signal(0,H.default.Type.AudioRange);var G=new H.default.WaveShaper((function(z){return H.default.equalPowerScale((z+1)/2)}),4096),V=new H.default.WaveShaper((function(z){return H.default.equalPowerScale(1-(z+1)/2)}),4096),W=new H.default.Gain,K=new H.default.Gain,Z=this.input=new H.default.Split;Z._splitter.channelCountMode="explicit",(new H.default.Zero).fan(G,V);var it=this.output=new H.default.Merge;Z.left.chain(W,it.left),Z.right.chain(K,it.right),this.pan.chain(V,W.gain),this.pan.chain(G,K.gain)};n.prototype.disconnect=function(){this.output.disconnect.apply(this.output,arguments)},n.prototype.connect=function(){this.output.connect.apply(this.output,arguments)},AudioContext.prototype.createStereoPanner=function(){return new n(this)},H.default.Context.prototype.createStereoPanner=function(){return new n(this)}}V(22),V(1),H.default.Panner=function(){var z=H.default.defaults(arguments,["pan"],H.default.Panner);H.default.AudioNode.call(this),this._panner=this.input=this.output=this.context.createStereoPanner(),this.pan=this._panner.pan,this.pan.value=z.pan,this._readOnly("pan")},H.default.extend(H.default.Panner,H.default.AudioNode),H.default.Panner.defaults={pan:0},H.default.Panner.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._writable("pan"),this._panner.disconnect(),this._panner=null,this.pan=null,this},G.default=H.default.Panner},function(z,G,V){V.r(G);var H=V(0);V(6),V(17),V(5),V(3),H.default.FMOscillator=function(){var z=H.default.defaults(arguments,["frequency","type","modulationType"],H.default.FMOscillator);H.default.Source.call(this,z),this._carrier=new H.default.Oscillator(z.frequency,z.type),this.frequency=new H.default.Signal(z.frequency,H.default.Type.Frequency),this.detune=this._carrier.detune,this.detune.value=z.detune,this.modulationIndex=new H.default.Multiply(z.modulationIndex),this.modulationIndex.units=H.default.Type.Positive,this._modulator=new H.default.Oscillator(z.frequency,z.modulationType),this.harmonicity=new H.default.Multiply(z.harmonicity),this.harmonicity.units=H.default.Type.Positive,this._modulationNode=new H.default.Gain(0),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.frequency.chain(this.modulationIndex,this._modulationNode),this._modulator.connect(this._modulationNode.gain),this._modulationNode.connect(this._carrier.frequency),this._carrier.connect(this.output),this.detune.connect(this._modulator.detune),this.phase=z.phase,this._readOnly(["modulationIndex","frequency","detune","harmonicity"])},H.default.extend(H.default.FMOscillator,H.default.Source),H.default.FMOscillator.defaults={frequency:440,detune:0,phase:0,type:"sine",modulationIndex:2,modulationType:"square",harmonicity:1},H.default.FMOscillator.prototype._start=function(z){this._modulator.start(z),this._carrier.start(z)},H.default.FMOscillator.prototype._stop=function(z){this._modulator.stop(z),this._carrier.stop(z)},H.default.FMOscillator.prototype.restart=function(z){this._modulator.restart(z),this._carrier.restart(z)},Object.defineProperty(H.default.FMOscillator.prototype,"type",{get:function(){return this._carrier.type},set:function(z){this._carrier.type=z}}),Object.defineProperty(H.default.FMOscillator.prototype,"baseType",{get:function(){return this._carrier.baseType},set:function(z){this._carrier.baseType=z}}),Object.defineProperty(H.default.FMOscillator.prototype,"partialCount",{get:function(){return this._carrier.partialCount},set:function(z){this._carrier.partialCount=z}}),Object.defineProperty(H.default.FMOscillator.prototype,"modulationType",{get:function(){return this._modulator.type},set:function(z){this._modulator.type=z}}),Object.defineProperty(H.default.FMOscillator.prototype,"phase",{get:function(){return this._carrier.phase},set:function(z){this._carrier.phase=z,this._modulator.phase=z}}),Object.defineProperty(H.default.FMOscillator.prototype,"partials",{get:function(){return this._carrier.partials},set:function(z){this._carrier.partials=z}}),H.default.FMOscillator.prototype.dispose=function(){return H.default.Source.prototype.dispose.call(this),this._writable(["modulationIndex","frequency","detune","harmonicity"]),this.frequency.dispose(),this.frequency=null,this.detune=null,this.harmonicity.dispose(),this.harmonicity=null,this._carrier.dispose(),this._carrier=null,this._modulator.dispose(),this._modulator=null,this._modulationNode.dispose(),this._modulationNode=null,this.modulationIndex.dispose(),this.modulationIndex=null,this},G.default=H.default.FMOscillator},function(z,G,V){V.r(G);var H=V(0);V(6),V(17),V(2),V(7),V(3),H.default.PulseOscillator=function(){var z=H.default.defaults(arguments,["frequency","width"],H.default.Oscillator);H.default.Source.call(this,z),this.width=new H.default.Signal(z.width,H.default.Type.NormalRange),this._widthGate=new H.default.Gain(0),this._sawtooth=new H.default.Oscillator({frequency:z.frequency,detune:z.detune,type:"sawtooth",phase:z.phase}),this.frequency=this._sawtooth.frequency,this.detune=this._sawtooth.detune,this._thresh=new H.default.WaveShaper((function(z){return z<0?-1:1})),this._sawtooth.chain(this._thresh,this.output),this.width.chain(this._widthGate,this._thresh),this._readOnly(["width","frequency","detune"])},H.default.extend(H.default.PulseOscillator,H.default.Source),H.default.PulseOscillator.defaults={frequency:440,detune:0,phase:0,width:.2},H.default.PulseOscillator.prototype._start=function(z){z=this.toSeconds(z),this._sawtooth.start(z),this._widthGate.gain.setValueAtTime(1,z)},H.default.PulseOscillator.prototype._stop=function(z){z=this.toSeconds(z),this._sawtooth.stop(z),this._widthGate.gain.setValueAtTime(0,z)},H.default.PulseOscillator.prototype.restart=function(z){this._sawtooth.restart(z),this._widthGate.gain.cancelScheduledValues(z),this._widthGate.gain.setValueAtTime(1,z)},Object.defineProperty(H.default.PulseOscillator.prototype,"phase",{get:function(){return this._sawtooth.phase},set:function(z){this._sawtooth.phase=z}}),Object.defineProperty(H.default.PulseOscillator.prototype,"type",{get:function(){return"pulse"}}),Object.defineProperty(H.default.PulseOscillator.prototype,"baseType",{get:function(){return"pulse"}}),Object.defineProperty(H.default.PulseOscillator.prototype,"partials",{get:function(){return[]}}),H.default.PulseOscillator.prototype.dispose=function(){return H.default.Source.prototype.dispose.call(this),this._sawtooth.dispose(),this._sawtooth=null,this._writable(["width","frequency","detune"]),this.width.dispose(),this.width=null,this._widthGate.dispose(),this._widthGate=null,this._thresh.dispose(),this._thresh=null,this.frequency=null,this.detune=null,this},G.default=H.default.PulseOscillator},function(z,G,V){V.r(G);var H=V(0);V(16),V(4),V(34),H.default.Event=function(){var z=H.default.defaults(arguments,["callback","value"],H.default.Event);H.default.call(this),this._loop=z.loop,this.callback=z.callback,this.value=z.value,this._loopStart=this.toTicks(z.loopStart),this._loopEnd=this.toTicks(z.loopEnd),this._state=new H.default.TimelineState(H.default.State.Stopped),this._playbackRate=1,this._startOffset=0,this._probability=z.probability,this._humanize=z.humanize,this.mute=z.mute,this.playbackRate=z.playbackRate},H.default.extend(H.default.Event),H.default.Event.defaults={callback:H.default.noOp,loop:!1,loopEnd:"1m",loopStart:0,playbackRate:1,value:null,probability:1,mute:!1,humanize:!1},H.default.Event.prototype._rescheduleEvents=function(z){return z=H.default.defaultArg(z,-1),this._state.forEachFrom(z,function(z){var G;if(z.state===H.default.State.Started){H.default.isDefined(z.id)&&H.default.Transport.clear(z.id);var V=z.time+Math.round(this.startOffset/this._playbackRate);if(!0===this._loop||H.default.isNumber(this._loop)&&this._loop>1){G=1/0,H.default.isNumber(this._loop)&&(G=this._loop*this._getLoopDuration());var W=this._state.getAfter(V);null!==W&&(G=Math.min(G,W.time-V)),G!==1/0&&(this._state.setStateAtTime(H.default.State.Stopped,V+G+1),G=H.default.Ticks(G));var K=H.default.Ticks(this._getLoopDuration());z.id=H.default.Transport.scheduleRepeat(this._tick.bind(this),K,H.default.Ticks(V),G)}else z.id=H.default.Transport.schedule(this._tick.bind(this),H.default.Ticks(V))}}.bind(this)),this},Object.defineProperty(H.default.Event.prototype,"state",{get:function(){return this._state.getValueAtTime(H.default.Transport.ticks)}}),Object.defineProperty(H.default.Event.prototype,"startOffset",{get:function(){return this._startOffset},set:function(z){this._startOffset=z}}),Object.defineProperty(H.default.Event.prototype,"probability",{get:function(){return this._probability},set:function(z){this._probability=z}}),Object.defineProperty(H.default.Event.prototype,"humanize",{get:function(){return this._humanize},set:function(z){this._humanize=z}}),H.default.Event.prototype.start=function(z){return z=this.toTicks(z),this._state.getValueAtTime(z)===H.default.State.Stopped&&(this._state.add({state:H.default.State.Started,time:z,id:void 0}),this._rescheduleEvents(z)),this},H.default.Event.prototype.stop=function(z){if(this.cancel(z),z=this.toTicks(z),this._state.getValueAtTime(z)===H.default.State.Started){this._state.setStateAtTime(H.default.State.Stopped,z);var G=this._state.getBefore(z),V=z;null!==G&&(V=G.time),this._rescheduleEvents(V)}return this},H.default.Event.prototype.cancel=function(z){return z=H.default.defaultArg(z,-1/0),z=this.toTicks(z),this._state.forEachFrom(z,(function(z){H.default.Transport.clear(z.id)})),this._state.cancel(z),this},H.default.Event.prototype._tick=function(z){var G=H.default.Transport.getTicksAtTime(z);if(!this.mute&&this._state.getValueAtTime(G)===H.default.State.Started){if(this.probability<1&&Math.random()>this.probability)return;if(this.humanize){var V=.02;H.default.isBoolean(this.humanize)||(V=this.toSeconds(this.humanize)),z+=(2*Math.random()-1)*V}this.callback(z,this.value)}},H.default.Event.prototype._getLoopDuration=function(){return Math.round((this._loopEnd-this._loopStart)/this._playbackRate)},Object.defineProperty(H.default.Event.prototype,"loop",{get:function(){return this._loop},set:function(z){this._loop=z,this._rescheduleEvents()}}),Object.defineProperty(H.default.Event.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(z){this._playbackRate=z,this._rescheduleEvents()}}),Object.defineProperty(H.default.Event.prototype,"loopEnd",{get:function(){return H.default.Ticks(this._loopEnd).toSeconds()},set:function(z){this._loopEnd=this.toTicks(z),this._loop&&this._rescheduleEvents()}}),Object.defineProperty(H.default.Event.prototype,"loopStart",{get:function(){return H.default.Ticks(this._loopStart).toSeconds()},set:function(z){this._loopStart=this.toTicks(z),this._loop&&this._rescheduleEvents()}}),Object.defineProperty(H.default.Event.prototype,"progress",{get:function(){if(this._loop){var z=H.default.Transport.ticks,G=this._state.get(z);if(null!==G&&G.state===H.default.State.Started){var V=this._getLoopDuration();return(z-G.time)%V/V}return 0}return 0}}),H.default.Event.prototype.dispose=function(){this.cancel(),this._state.dispose(),this._state=null,this.callback=null,this.value=null},G.default=H.default.Event},function(z,G,V){V.r(G);var H=V(0);V(2),V(13),V(29),V(10),V(3),V(1),H.default.MidSideMerge=function(){H.default.AudioNode.call(this),this.createInsOuts(2,0),this.mid=this.input[0]=new H.default.Gain,this._left=new H.default.Add,this._timesTwoLeft=new H.default.Multiply(Math.SQRT1_2),this.side=this.input[1]=new H.default.Gain,this._right=new H.default.Subtract,this._timesTwoRight=new H.default.Multiply(Math.SQRT1_2),this._merge=this.output=new H.default.Merge,this.mid.connect(this._left,0,0),this.side.connect(this._left,0,1),this.mid.connect(this._right,0,0),this.side.connect(this._right,0,1),this._left.connect(this._timesTwoLeft),this._right.connect(this._timesTwoRight),this._timesTwoLeft.connect(this._merge,0,0),this._timesTwoRight.connect(this._merge,0,1)},H.default.extend(H.default.MidSideMerge,H.default.AudioNode),H.default.MidSideMerge.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this.mid.dispose(),this.mid=null,this.side.dispose(),this.side=null,this._left.dispose(),this._left=null,this._timesTwoLeft.dispose(),this._timesTwoLeft=null,this._right.dispose(),this._right=null,this._timesTwoRight.dispose(),this._timesTwoRight=null,this._merge.dispose(),this._merge=null,this},G.default=H.default.MidSideMerge},function(z,G,V){V.r(G);var H=V(0);V(29),V(13),V(2),V(19),V(1),H.default.MidSideSplit=function(){H.default.AudioNode.call(this),this.createInsOuts(0,2),this._split=this.input=new H.default.Split,this._midAdd=new H.default.Add,this.mid=this.output[0]=new H.default.Multiply(Math.SQRT1_2),this._sideSubtract=new H.default.Subtract,this.side=this.output[1]=new H.default.Multiply(Math.SQRT1_2),this._split.connect(this._midAdd,0,0),this._split.connect(this._midAdd,1,1),this._split.connect(this._sideSubtract,0,0),this._split.connect(this._sideSubtract,1,1),this._midAdd.connect(this.mid),this._sideSubtract.connect(this.side)},H.default.extend(H.default.MidSideSplit,H.default.AudioNode),H.default.MidSideSplit.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this.mid.dispose(),this.mid=null,this.side.dispose(),this.side=null,this._midAdd.dispose(),this._midAdd=null,this._sideSubtract.dispose(),this._sideSubtract=null,this._split.dispose(),this._split=null,this},G.default=H.default.MidSideSplit},function(z,G,V){V.r(G);var H=V(0);V(2),V(9),V(1),V(59),H.default.LowpassCombFilter=function(){var z=H.default.defaults(arguments,["delayTime","resonance","dampening"],H.default.LowpassCombFilter);H.default.AudioNode.call(this),this._combFilter=this.output=new H.default.FeedbackCombFilter(z.delayTime,z.resonance),this.delayTime=this._combFilter.delayTime,this._lowpass=this.input=new H.default.Filter({frequency:z.dampening,type:"lowpass",Q:0,rolloff:-12}),this.dampening=this._lowpass.frequency,this.resonance=this._combFilter.resonance,this._lowpass.connect(this._combFilter),this._readOnly(["dampening","resonance","delayTime"])},H.default.extend(H.default.LowpassCombFilter,H.default.AudioNode),H.default.LowpassCombFilter.defaults={delayTime:.1,resonance:.5,dampening:3e3},H.default.LowpassCombFilter.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._writable(["dampening","resonance","delayTime"]),this._combFilter.dispose(),this._combFilter=null,this.resonance=null,this.delayTime=null,this._lowpass.dispose(),this._lowpass=null,this.dampening=null,this},G.default=H.default.LowpassCombFilter},function(z,G,V){V.r(G);var H=V(0);V(45),H.default.Ticks=function(z,G){if(!(this instanceof H.default.Ticks))return new H.default.Ticks(z,G);H.default.TransportTime.call(this,z,G)},H.default.extend(H.default.Ticks,H.default.TransportTime),H.default.Ticks.prototype._defaultUnits="i",H.default.Ticks.prototype._now=function(){return H.default.Transport.ticks},H.default.Ticks.prototype._beatsToUnits=function(z){return this._getPPQ()*z},H.default.Ticks.prototype._secondsToUnits=function(z){return Math.floor(z/(60/this._getBpm())*this._getPPQ())},H.default.Ticks.prototype._ticksToUnits=function(z){return z},H.default.Ticks.prototype.toTicks=function(){return this.valueOf()},H.default.Ticks.prototype.toSeconds=function(){return this.valueOf()/this._getPPQ()*(60/this._getBpm())},G.default=H.default.Ticks},function(z,G,V){V.r(G);var H=V(0);V(55),H.default.TransportEvent=function(z,G){G=H.default.defaultArg(G,H.default.TransportEvent.defaults),H.default.call(this),this.Transport=z,this.id=H.default.TransportEvent._eventId++,this.time=H.default.Ticks(G.time),this.callback=G.callback,this._once=G.once},H.default.extend(H.default.TransportEvent),H.default.TransportEvent.defaults={once:!1,callback:H.default.noOp},H.default.TransportEvent._eventId=0,H.default.TransportEvent.prototype.invoke=function(z){this.callback&&(this.callback(z),this._once&&this.Transport&&this.Transport.clear(this.id))},H.default.TransportEvent.prototype.dispose=function(){return H.default.prototype.dispose.call(this),this.Transport=null,this.callback=null,this.time=null,this},G.default=H.default.TransportEvent},function(z,G,V){V.r(G);var H=V(0);V(82),V(34),V(24),V(14),H.default.TickSource=function(){var z=H.default.defaults(arguments,["frequency"],H.default.TickSource);this.frequency=new H.default.TickSignal(z.frequency),this._readOnly("frequency"),this._state=new H.default.TimelineState(H.default.State.Stopped),this._state.setStateAtTime(H.default.State.Stopped,0),this._tickOffset=new H.default.Timeline,this.setTicksAtTime(0,0)},H.default.extend(H.default.TickSource),H.default.TickSource.defaults={frequency:1},Object.defineProperty(H.default.TickSource.prototype,"state",{get:function(){return this._state.getValueAtTime(this.now())}}),H.default.TickSource.prototype.start=function(z,G){return z=this.toSeconds(z),this._state.getValueAtTime(z)!==H.default.State.Started&&(this._state.setStateAtTime(H.default.State.Started,z),H.default.isDefined(G)&&this.setTicksAtTime(G,z)),this},H.default.TickSource.prototype.stop=function(z){if(z=this.toSeconds(z),this._state.getValueAtTime(z)===H.default.State.Stopped){var G=this._state.get(z);G.time>0&&(this._tickOffset.cancel(G.time),this._state.cancel(G.time))}return this._state.cancel(z),this._state.setStateAtTime(H.default.State.Stopped,z),this.setTicksAtTime(0,z),this},H.default.TickSource.prototype.pause=function(z){return z=this.toSeconds(z),this._state.getValueAtTime(z)===H.default.State.Started&&this._state.setStateAtTime(H.default.State.Paused,z),this},H.default.TickSource.prototype.cancel=function(z){return z=this.toSeconds(z),this._state.cancel(z),this._tickOffset.cancel(z),this},H.default.TickSource.prototype.getTicksAtTime=function(z){z=this.toSeconds(z);var G=this._state.getLastState(H.default.State.Stopped,z),V={state:H.default.State.Paused,time:z};this._state.add(V);var W=G,K=0;return this._state.forEachBetween(G.time,z+this.sampleTime,function(z){var G=W.time,V=this._tickOffset.get(z.time);V.time>=W.time&&(K=V.ticks,G=V.time),W.state===H.default.State.Started&&z.state!==H.default.State.Started&&(K+=this.frequency.getTicksAtTime(z.time)-this.frequency.getTicksAtTime(G)),W=z}.bind(this)),this._state.remove(V),K},Object.defineProperty(H.default.TickSource.prototype,"ticks",{get:function(){return this.getTicksAtTime(this.now())},set:function(z){this.setTicksAtTime(z,this.now())}}),Object.defineProperty(H.default.TickSource.prototype,"seconds",{get:function(){return this.getSecondsAtTime(this.now())},set:function(z){var G=this.now(),V=this.frequency.timeToTicks(z,G);this.setTicksAtTime(V,G)}}),H.default.TickSource.prototype.getSecondsAtTime=function(z){z=this.toSeconds(z);var G=this._state.getLastState(H.default.State.Stopped,z),V={state:H.default.State.Paused,time:z};this._state.add(V);var W=G,K=0;return this._state.forEachBetween(G.time,z+this.sampleTime,function(z){var G=W.time,V=this._tickOffset.get(z.time);V.time>=W.time&&(K=V.seconds,G=V.time),W.state===H.default.State.Started&&z.state!==H.default.State.Started&&(K+=z.time-G),W=z}.bind(this)),this._state.remove(V),K},H.default.TickSource.prototype.setTicksAtTime=function(z,G){return G=this.toSeconds(G),this._tickOffset.cancel(G),this._tickOffset.add({time:G,ticks:z,seconds:this.frequency.getDurationOfTicks(z,G)}),this},H.default.TickSource.prototype.getStateAtTime=function(z){return z=this.toSeconds(z),this._state.getValueAtTime(z)},H.default.TickSource.prototype.getTimeOfTick=function(z,G){G=H.default.defaultArg(G,this.now());var V=this._tickOffset.get(G),W=this._state.get(G),K=Math.max(V.time,W.time),Z=this.frequency.getTicksAtTime(K)+z-V.ticks;return this.frequency.getTimeOfTick(Z)},H.default.TickSource.prototype.forEachTickBetween=function(z,G,V){var W=this._state.get(z);if(this._state.forEachBetween(z,G,function(G){W.state===H.default.State.Started&&G.state!==H.default.State.Started&&this.forEachTickBetween(Math.max(W.time,z),G.time-this.sampleTime,V),W=G}.bind(this)),z=Math.max(W.time,z),W.state===H.default.State.Started&&this._state){var K=this.frequency.getTicksAtTime(z),Z=(K-this.frequency.getTicksAtTime(W.time))%1;0!==Z&&(Z=1-Z);for(var it=this.frequency.getTimeOfTick(K+Z),ot=null;it<G&&this._state;){try{V(it,Math.round(this.getTicksAtTime(it)))}catch(z){ot=z;break}this._state&&(it+=this.frequency.getDurationOfTicks(1,it))}}if(ot)throw ot;return this},H.default.TickSource.prototype.dispose=function(){return H.default.Param.prototype.dispose.call(this),this._state.dispose(),this._state=null,this._tickOffset.dispose(),this._tickOffset=null,this._writable("frequency"),this.frequency.dispose(),this.frequency=null,this},G.default=H.default.TickSource},function(z,G,V){V.r(G);var H=V(0);V(87),V(13),V(2),V(4),V(18),V(1),H.default.Follower=function(){var z=H.default.defaults(arguments,["smoothing"],H.default.Follower);H.default.AudioNode.call(this),this.createInsOuts(1,1),this._abs=new H.default.Abs,this._filter=this.context.createBiquadFilter(),this._filter.type="lowpass",this._filter.frequency.value=0,this._filter.Q.value=0,this._sub=new H.default.Subtract,this._delay=new H.default.Delay(this.blockTime),this._smoothing=z.smoothing,H.default.connect(this.input,this._delay),H.default.connect(this.input,this._sub,0,1),this._sub.chain(this._abs,this._filter,this.output),this.smoothing=z.smoothing},H.default.extend(H.default.Follower,H.default.AudioNode),H.default.Follower.defaults={smoothing:.05},Object.defineProperty(H.default.Follower.prototype,"smoothing",{get:function(){return this._smoothing},set:function(z){this._smoothing=z,this._filter.frequency.value=.5*H.default.Time(z).toFrequency()}}),H.default.Follower.prototype.connect=H.default.SignalBase.prototype.connect,H.default.Follower.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._filter.disconnect(),this._filter=null,this._delay.dispose(),this._delay=null,this._sub.disconnect(),this._sub=null,this._abs.dispose(),this._abs=null,this},G.default=H.default.Follower},function(z,G,V){V.r(G);var H=V(0);V(42),V(2),V(14),V(18),V(3),V(1),H.default.FeedbackCombFilter=function(){var z=H.default.defaults(arguments,["delayTime","resonance"],H.default.FeedbackCombFilter);H.default.AudioNode.call(this),this._delay=this.input=this.output=new H.default.Delay(z.delayTime),this.delayTime=this._delay.delayTime,this._feedback=new H.default.Gain(z.resonance,H.default.Type.NormalRange),this.resonance=this._feedback.gain,this._delay.chain(this._feedback,this._delay),this._readOnly(["resonance","delayTime"])},H.default.extend(H.default.FeedbackCombFilter,H.default.AudioNode),H.default.FeedbackCombFilter.defaults={delayTime:.1,resonance:.5},H.default.FeedbackCombFilter.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._writable(["resonance","delayTime"]),this._delay.dispose(),this._delay=null,this.delayTime=null,this._feedback.dispose(),this._feedback=null,this.resonance=null,this},G.default=H.default.FeedbackCombFilter},function(z,G,V){V.r(G);var H=V(0);V(9),V(2),V(3),V(1),H.default.MultibandSplit=function(){var z=H.default.defaults(arguments,["lowFrequency","highFrequency"],H.default.MultibandSplit);H.default.AudioNode.call(this),this.input=new H.default.Gain,this.output=new Array(3),this.low=this.output[0]=new H.default.Filter(0,"lowpass"),this._lowMidFilter=new H.default.Filter(0,"highpass"),this.mid=this.output[1]=new H.default.Filter(0,"lowpass"),this.high=this.output[2]=new H.default.Filter(0,"highpass"),this.lowFrequency=new H.default.Signal(z.lowFrequency,H.default.Type.Frequency),this.highFrequency=new H.default.Signal(z.highFrequency,H.default.Type.Frequency),this.Q=new H.default.Signal(z.Q),this.input.fan(this.low,this.high),this.input.chain(this._lowMidFilter,this.mid),this.lowFrequency.connect(this.low.frequency),this.lowFrequency.connect(this._lowMidFilter.frequency),this.highFrequency.connect(this.mid.frequency),this.highFrequency.connect(this.high.frequency),this.Q.connect(this.low.Q),this.Q.connect(this._lowMidFilter.Q),this.Q.connect(this.mid.Q),this.Q.connect(this.high.Q),this._readOnly(["high","mid","low","highFrequency","lowFrequency"])},H.default.extend(H.default.MultibandSplit,H.default.AudioNode),H.default.MultibandSplit.defaults={lowFrequency:400,highFrequency:2500,Q:1},H.default.MultibandSplit.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._writable(["high","mid","low","highFrequency","lowFrequency"]),this.low.dispose(),this.low=null,this._lowMidFilter.dispose(),this._lowMidFilter=null,this.mid.dispose(),this.mid=null,this.high.dispose(),this.high=null,this.lowFrequency.dispose(),this.lowFrequency=null,this.highFrequency.dispose(),this.highFrequency=null,this.Q.dispose(),this.Q=null,this},G.default=H.default.MultibandSplit},function(z,G,V){V.r(G);var H=V(0);V(7),H.default.Pow=function(z){H.default.SignalBase.call(this),this._exp=H.default.defaultArg(z,1),this._expScaler=this.input=this.output=new H.default.WaveShaper(this._expFunc(this._exp),8192)},H.default.extend(H.default.Pow,H.default.SignalBase),Object.defineProperty(H.default.Pow.prototype,"value",{get:function(){return this._exp},set:function(z){this._exp=z,this._expScaler.setMap(this._expFunc(this._exp))}}),H.default.Pow.prototype._expFunc=function(z){return function(G){return Math.pow(Math.abs(G),z)}},H.default.Pow.prototype.dispose=function(){return H.default.SignalBase.prototype.dispose.call(this),this._expScaler.dispose(),this._expScaler=null,this},G.default=H.default.Pow},function(z,G,V){V.r(G);var H=V(0);H.default.TimeBase=function(z,G){if(!(this instanceof H.default.TimeBase))return new H.default.TimeBase(z,G);if(this._val=z,this._units=G,H.default.isUndef(this._units)&&H.default.isString(this._val)&&parseFloat(this._val)==this._val&&"+"!==this._val.charAt(0))this._val=parseFloat(this._val),this._units=this._defaultUnits;else if(z&&z.constructor===this.constructor)this._val=z._val,this._units=z._units;else if(z instanceof H.default.TimeBase)switch(this._defaultUnits){case"s":this._val=z.toSeconds();break;case"i":this._val=z.toTicks();break;case"hz":this._val=z.toFrequency();break;case"midi":this._val=z.toMidi();break;default:throw new Error("Unrecognized default units "+this._defaultUnits)}},H.default.extend(H.default.TimeBase),H.default.TimeBase.prototype._expressions={n:{regexp:/^(\d+)n(\.?)$/i,method:function(z,G){var V="."===G?1.5:1;return 1===(z=parseInt(z))?this._beatsToUnits(this._getTimeSignature())*V:this._beatsToUnits(4/z)*V}},t:{regexp:/^(\d+)t$/i,method:function(z){return z=parseInt(z),this._beatsToUnits(8/(3*parseInt(z)))}},m:{regexp:/^(\d+)m$/i,method:function(z){return this._beatsToUnits(parseInt(z)*this._getTimeSignature())}},i:{regexp:/^(\d+)i$/i,method:function(z){return this._ticksToUnits(parseInt(z))}},hz:{regexp:/^(\d+(?:\.\d+)?)hz$/i,method:function(z){return this._frequencyToUnits(parseFloat(z))}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?$/,method:function(z,G,V){var H=0;return z&&"0"!==z&&(H+=this._beatsToUnits(this._getTimeSignature()*parseFloat(z))),G&&"0"!==G&&(H+=this._beatsToUnits(parseFloat(G))),V&&"0"!==V&&(H+=this._beatsToUnits(parseFloat(V)/4)),H}},s:{regexp:/^(\d+(?:\.\d+)?)s$/,method:function(z){return this._secondsToUnits(parseFloat(z))}},samples:{regexp:/^(\d+)samples$/,method:function(z){return parseInt(z)/this.context.sampleRate}},default:{regexp:/^(\d+(?:\.\d+)?)$/,method:function(z){return this._expressions[this._defaultUnits].method.call(this,z)}}},H.default.TimeBase.prototype._defaultUnits="s",H.default.TimeBase.prototype._getBpm=function(){return H.default.Transport?H.default.Transport.bpm.value:120},H.default.TimeBase.prototype._getTimeSignature=function(){return H.default.Transport?H.default.Transport.timeSignature:4},H.default.TimeBase.prototype._getPPQ=function(){return H.default.Transport?H.default.Transport.PPQ:192},H.default.TimeBase.prototype._now=function(){return this.now()},H.default.TimeBase.prototype._frequencyToUnits=function(z){return 1/z},H.default.TimeBase.prototype._beatsToUnits=function(z){return 60/this._getBpm()*z},H.default.TimeBase.prototype._secondsToUnits=function(z){return z},H.default.TimeBase.prototype._ticksToUnits=function(z){return z*(this._beatsToUnits(1)/this._getPPQ())},H.default.TimeBase.prototype._noArg=function(){return this._now()},H.default.TimeBase.prototype.valueOf=function(){if(H.default.isUndef(this._val))return this._noArg();if(H.default.isString(this._val)&&H.default.isUndef(this._units)){for(var z in this._expressions)if(this._expressions[z].regexp.test(this._val.trim())){this._units=z;break}}else if(H.default.isObject(this._val)){var G=0;for(var V in this._val){var W=this._val[V];G+=new this.constructor(V).valueOf()*W}return G}if(H.default.isDefined(this._units)){var K=this._expressions[this._units],Z=this._val.toString().trim().match(K.regexp);return Z?K.method.apply(this,Z.slice(1)):K.method.call(this,parseFloat(this._val))}return this._val},H.default.TimeBase.prototype.toSeconds=function(){return this.valueOf()},H.default.TimeBase.prototype.toFrequency=function(){return 1/this.toSeconds()},H.default.TimeBase.prototype.toSamples=function(){return this.toSeconds()*this.context.sampleRate},H.default.TimeBase.prototype.toMilliseconds=function(){return 1e3*this.toSeconds()},H.default.TimeBase.prototype.dispose=function(){this._val=null,this._units=null},G.default=H.default.TimeBase},function(z,G,V){V.r(G);var H=V(0);V(62),V(46),H.default.Time=function(z,G){if(!(this instanceof H.default.Time))return new H.default.Time(z,G);H.default.TimeBase.call(this,z,G)},H.default.extend(H.default.Time,H.default.TimeBase),H.default.Time.prototype._expressions=Object.assign({},H.default.TimeBase.prototype._expressions,{quantize:{regexp:/^@(.+)/,method:function(z){if(H.default.Transport){var G=new this.constructor(z);return this._secondsToUnits(H.default.Transport.nextSubdivision(G))}return 0}},now:{regexp:/^\+(.+)/,method:function(z){return this._now()+new this.constructor(z)}}}),H.default.Time.prototype.quantize=function(z,G){G=H.default.defaultArg(G,1);var V=new this.constructor(z),W=this.valueOf();return W+(Math.round(W/V)*V-W)*G},H.default.Time.prototype.toNotation=function(){for(var z=this.toSeconds(),G=["1m"],V=1;V<8;V++){var W=Math.pow(2,V);G.push(W+"n."),G.push(W+"n"),G.push(W+"t")}G.push("0");var K=G[0],Z=H.default.Time(G[0]).toSeconds();return G.forEach((function(G){var V=H.default.Time(G).toSeconds();Math.abs(V-z)<Math.abs(Z-z)&&(K=G,Z=V)})),K},H.default.Time.prototype.toBarsBeatsSixteenths=function(){var z=this._beatsToUnits(1),G=this.valueOf()/z;G=parseFloat(G.toFixed(4));var V=Math.floor(G/this._getTimeSignature()),H=G%1*4;return G=Math.floor(G)%this._getTimeSignature(),(H=H.toString()).length>3&&(H=parseFloat(parseFloat(H).toFixed(3))),[V,G,H].join(":")},H.default.Time.prototype.toTicks=function(){var z=this._beatsToUnits(1),G=this.valueOf()/z;return Math.round(G*this._getPPQ())},H.default.Time.prototype.toSeconds=function(){return this.valueOf()},H.default.Time.prototype.toMidi=function(){return H.default.Frequency.ftom(this.toFrequency())},G.default=H.default.Time},function(z,G,V){V.r(G);var H=V(0);V(11),V(6),V(3),V(1),H.default.supported&&(OscillatorNode.prototype.setPeriodicWave||(OscillatorNode.prototype.setPeriodicWave=OscillatorNode.prototype.setWaveTable),AudioContext.prototype.createPeriodicWave||(AudioContext.prototype.createPeriodicWave=AudioContext.prototype.createWaveTable)),H.default.OscillatorNode=function(){var z=H.default.defaults(arguments,["frequency","type"],H.default.OscillatorNode);H.default.AudioNode.call(this,z),this.onended=z.onended,this._startTime=-1,this._stopTime=-1,this._gainNode=this.output=new H.default.Gain(0),this._oscillator=this.context.createOscillator(),H.default.connect(this._oscillator,this._gainNode),this.type=z.type,this.frequency=new H.default.Param({param:this._oscillator.frequency,units:H.default.Type.Frequency,value:z.frequency}),this.detune=new H.default.Param({param:this._oscillator.detune,units:H.default.Type.Cents,value:z.detune}),this._gain=1},H.default.extend(H.default.OscillatorNode,H.default.AudioNode),H.default.OscillatorNode.defaults={frequency:440,detune:0,type:"sine",onended:H.default.noOp},Object.defineProperty(H.default.OscillatorNode.prototype,"state",{get:function(){return this.getStateAtTime(this.now())}}),H.default.OscillatorNode.prototype.getStateAtTime=function(z){return z=this.toSeconds(z),-1!==this._startTime&&z>=this._startTime&&(-1===this._stopTime||z<=this._stopTime)?H.default.State.Started:H.default.State.Stopped},H.default.OscillatorNode.prototype.start=function(z){if(this.log("start",z),-1!==this._startTime)throw new Error("cannot call OscillatorNode.start more than once");return this._startTime=this.toSeconds(z),this._startTime=Math.max(this._startTime,this.context.currentTime),this._oscillator.start(this._startTime),this._gainNode.gain.setValueAtTime(1,this._startTime),this},H.default.OscillatorNode.prototype.setPeriodicWave=function(z){return this._oscillator.setPeriodicWave(z),this},H.default.OscillatorNode.prototype.stop=function(z){return this.log("stop",z),this.assert(-1!==this._startTime,"'start' must be called before 'stop'"),this.cancelStop(),this._stopTime=this.toSeconds(z),this._stopTime=Math.max(this._stopTime,this.context.currentTime),this._stopTime>this._startTime?(this._gainNode.gain.setValueAtTime(0,this._stopTime),this.context.clearTimeout(this._timeout),this._timeout=this.context.setTimeout(function(){this._oscillator.stop(this.now()),this.onended(),setTimeout(function(){this._oscillator&&(this._oscillator.disconnect(),this._gainNode.disconnect())}.bind(this),100)}.bind(this),this._stopTime-this.context.currentTime)):this._gainNode.gain.cancelScheduledValues(this._startTime),this},H.default.OscillatorNode.prototype.cancelStop=function(){return-1!==this._startTime&&(this._gainNode.gain.cancelScheduledValues(this._startTime+this.sampleTime),this.context.clearTimeout(this._timeout),this._stopTime=-1),this},Object.defineProperty(H.default.OscillatorNode.prototype,"type",{get:function(){return this._oscillator.type},set:function(z){this._oscillator.type=z}}),H.default.OscillatorNode.prototype.dispose=function(){return this._wasDisposed||(this._wasDisposed=!0,this.context.clearTimeout(this._timeout),H.default.AudioNode.prototype.dispose.call(this),this.onended=null,this._oscillator.disconnect(),this._oscillator=null,this._gainNode.dispose(),this._gainNode=null,this.frequency.dispose(),this.frequency=null,this.detune.dispose(),this.detune=null),this},G.default=H.default.OscillatorNode},function(z,G,V){V.r(G);var H=V(0);V(11),V(6),V(57),V(32),H.default.Player=function(z){var G;z instanceof H.default.Buffer&&z.loaded?(z=z.get(),G=H.default.Player.defaults):G=H.default.defaults(arguments,["url","onload"],H.default.Player),H.default.Source.call(this,G),this.autostart=G.autostart,this._buffer=new H.default.Buffer({url:G.url,onload:this._onload.bind(this,G.onload),reverse:G.reverse}),z instanceof AudioBuffer&&this._buffer.set(z),this._loop=G.loop,this._loopStart=G.loopStart,this._loopEnd=G.loopEnd,this._playbackRate=G.playbackRate,this._activeSources=[],this.fadeIn=G.fadeIn,this.fadeOut=G.fadeOut},H.default.extend(H.default.Player,H.default.Source),H.default.Player.defaults={onload:H.default.noOp,playbackRate:1,loop:!1,autostart:!1,loopStart:0,loopEnd:0,reverse:!1,fadeIn:0,fadeOut:0},H.default.Player.prototype.load=function(z,G){return this._buffer.load(z,this._onload.bind(this,G))},H.default.Player.prototype._onload=function(z){(z=H.default.defaultArg(z,H.default.noOp))(this),this.autostart&&this.start()},H.default.Player.prototype._onSourceEnd=function(z){var G=this._activeSources.indexOf(z);this._activeSources.splice(G,1),0!==this._activeSources.length||this._synced||this._state.setStateAtTime(H.default.State.Stopped,H.default.now())},H.default.Player.prototype._start=function(z,G,V){G=this._loop?H.default.defaultArg(G,this._loopStart):H.default.defaultArg(G,0),G=this.toSeconds(G),this._synced&&(G*=this._playbackRate);var W=H.default.defaultArg(V,Math.max(this._buffer.duration-G,0));W=this.toSeconds(W),W/=this._playbackRate,z=this.toSeconds(z);var K=new H.default.BufferSource({buffer:this._buffer,loop:this._loop,loopStart:this._loopStart,loopEnd:this._loopEnd,onended:this._onSourceEnd.bind(this),playbackRate:this._playbackRate,fadeIn:this.fadeIn,fadeOut:this.fadeOut}).connect(this.output);return this._loop||this._synced||this._state.setStateAtTime(H.default.State.Stopped,z+W),this._activeSources.push(K),this._loop&&H.default.isUndef(V)?K.start(z,G):K.start(z,G,W-this.toSeconds(this.fadeOut)),this},H.default.Player.prototype._stop=function(z){return z=this.toSeconds(z),this._activeSources.forEach((function(G){G.stop(z)})),this},H.default.Player.prototype.restart=function(z,G,V){return this._stop(z),this._start(z,G,V),this},H.default.Player.prototype.seek=function(z,G){return G=this.toSeconds(G),this._state.getValueAtTime(G)===H.default.State.Started&&(z=this.toSeconds(z),this._stop(G),this._start(G,z)),this},H.default.Player.prototype.setLoopPoints=function(z,G){return this.loopStart=z,this.loopEnd=G,this},Object.defineProperty(H.default.Player.prototype,"loopStart",{get:function(){return this._loopStart},set:function(z){this._loopStart=z,this._activeSources.forEach((function(G){G.loopStart=z}))}}),Object.defineProperty(H.default.Player.prototype,"loopEnd",{get:function(){return this._loopEnd},set:function(z){this._loopEnd=z,this._activeSources.forEach((function(G){G.loopEnd=z}))}}),Object.defineProperty(H.default.Player.prototype,"buffer",{get:function(){return this._buffer},set:function(z){this._buffer.set(z)}}),Object.defineProperty(H.default.Player.prototype,"loop",{get:function(){return this._loop},set:function(z){if(this._loop!==z&&(this._loop=z,this._activeSources.forEach((function(G){G.loop=z})),z)){var G=this._state.getNextState(H.default.State.Stopped,this.now());G&&this._state.cancel(G.time)}}}),Object.defineProperty(H.default.Player.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(z){this._playbackRate=z;var G=this.now(),V=this._state.getNextState(H.default.State.Stopped,G);V&&this._state.cancel(V.time),this._activeSources.forEach((function(V){V.cancelStop(),V.playbackRate.setValueAtTime(z,G)}))}}),Object.defineProperty(H.default.Player.prototype,"reverse",{get:function(){return this._buffer.reverse},set:function(z){this._buffer.reverse=z}}),Object.defineProperty(H.default.Player.prototype,"loaded",{get:function(){return this._buffer.loaded}}),H.default.Player.prototype.dispose=function(){return this._activeSources.forEach((function(z){z.dispose()})),this._activeSources=null,H.default.Source.prototype.dispose.call(this),this._buffer.dispose(),this._buffer=null,this},G.default=H.default.Player},function(z,G,V){V.r(G);var H=V(0);V(31),V(41),V(37),V(2),V(9),V(25),H.default.MonoSynth=function(z){z=H.default.defaultArg(z,H.default.MonoSynth.defaults),H.default.Monophonic.call(this,z),this.oscillator=new H.default.OmniOscillator(z.oscillator),this.frequency=this.oscillator.frequency,this.detune=this.oscillator.detune,this.filter=new H.default.Filter(z.filter),this.filter.frequency.value=5e3,this.filterEnvelope=new H.default.FrequencyEnvelope(z.filterEnvelope),this.envelope=new H.default.AmplitudeEnvelope(z.envelope),this.oscillator.chain(this.filter,this.envelope,this.output),this.filterEnvelope.connect(this.filter.frequency),this._readOnly(["oscillator","frequency","detune","filter","filterEnvelope","envelope"])},H.default.extend(H.default.MonoSynth,H.default.Monophonic),H.default.MonoSynth.defaults={frequency:"C4",detune:0,oscillator:{type:"square"},filter:{Q:6,type:"lowpass",rolloff:-24},envelope:{attack:.005,decay:.1,sustain:.9,release:1},filterEnvelope:{attack:.06,decay:.2,sustain:.5,release:2,baseFrequency:200,octaves:7,exponent:2}},H.default.MonoSynth.prototype._triggerEnvelopeAttack=function(z,G){return z=this.toSeconds(z),this.envelope.triggerAttack(z,G),this.filterEnvelope.triggerAttack(z),this.oscillator.start(z),0===this.envelope.sustain&&this.oscillator.stop(z+this.envelope.attack+this.envelope.decay),this},H.default.MonoSynth.prototype._triggerEnvelopeRelease=function(z){return this.envelope.triggerRelease(z),this.filterEnvelope.triggerRelease(z),this.oscillator.stop(z+this.envelope.release),this},H.default.MonoSynth.prototype.dispose=function(){return H.default.Monophonic.prototype.dispose.call(this),this._writable(["oscillator","frequency","detune","filter","filterEnvelope","envelope"]),this.oscillator.dispose(),this.oscillator=null,this.envelope.dispose(),this.envelope=null,this.filterEnvelope.dispose(),this.filterEnvelope=null,this.filter.dispose(),this.filter=null,this.frequency=null,this.detune=null,this},G.default=H.default.MonoSynth},function(z,G,V){V.r(G);var H=V(0);V(6),V(17),V(5),V(3),H.default.FatOscillator=function(){var z=H.default.defaults(arguments,["frequency","type","spread"],H.default.FatOscillator);H.default.Source.call(this,z),this.frequency=new H.default.Signal(z.frequency,H.default.Type.Frequency),this.detune=new H.default.Signal(z.detune,H.default.Type.Cents),this._oscillators=[],this._spread=z.spread,this._type=z.type,this._phase=z.phase,this._partials=z.partials,this._partialCount=z.partialCount,this.count=z.count,this._readOnly(["frequency","detune"])},H.default.extend(H.default.FatOscillator,H.default.Source),H.default.FatOscillator.defaults={frequency:440,detune:0,phase:0,spread:20,count:3,type:"sawtooth",partials:[],partialCount:0},H.default.FatOscillator.prototype._start=function(z){z=this.toSeconds(z),this._forEach((function(G){G.start(z)}))},H.default.FatOscillator.prototype._stop=function(z){z=this.toSeconds(z),this._forEach((function(G){G.stop(z)}))},H.default.FatOscillator.prototype.restart=function(z){z=this.toSeconds(z),this._forEach((function(G){G.restart(z)}))},H.default.FatOscillator.prototype._forEach=function(z){for(var G=0;G<this._oscillators.length;G++)z.call(this,this._oscillators[G],G)},Object.defineProperty(H.default.FatOscillator.prototype,"type",{get:function(){return this._type},set:function(z){this._type=z,this._forEach((function(G){G.type=z}))}}),Object.defineProperty(H.default.FatOscillator.prototype,"spread",{get:function(){return this._spread},set:function(z){if(this._spread=z,this._oscillators.length>1){var G=-z/2,V=z/(this._oscillators.length-1);this._forEach((function(z,H){z.detune.value=G+V*H}))}}}),Object.defineProperty(H.default.FatOscillator.prototype,"count",{get:function(){return this._oscillators.length},set:function(z){if(z=Math.max(z,1),this._oscillators.length!==z){this._forEach((function(z){z.dispose()})),this._oscillators=[];for(var G=0;G<z;G++){var V=new H.default.Oscillator;this.type===H.default.Oscillator.Type.Custom?V.partials=this._partials:V.type=this._type,V.partialCount=this._partialCount,V.phase=this._phase+G/z*360,V.volume.value=-6-1.1*z,this.frequency.connect(V.frequency),this.detune.connect(V.detune),V.connect(this.output),this._oscillators[G]=V}this.spread=this._spread,this.state===H.default.State.Started&&this._forEach((function(z){z.start()}))}}}),Object.defineProperty(H.default.FatOscillator.prototype,"phase",{get:function(){return this._phase},set:function(z){this._phase=z,this._forEach((function(G){G.phase=z}))}}),Object.defineProperty(H.default.FatOscillator.prototype,"baseType",{get:function(){return this._oscillators[0].baseType},set:function(z){this._forEach((function(G){G.baseType=z})),this._type=this._oscillators[0].type}}),Object.defineProperty(H.default.FatOscillator.prototype,"partials",{get:function(){return this._oscillators[0].partials},set:function(z){this._partials=z,this._type=H.default.Oscillator.Type.Custom,this._forEach((function(G){G.partials=z}))}}),Object.defineProperty(H.default.FatOscillator.prototype,"partialCount",{get:function(){return this._oscillators[0].partialCount},set:function(z){this._partialCount=z,this._forEach((function(G){G.partialCount=z})),this._type=this._oscillators[0].type}}),H.default.FatOscillator.prototype.dispose=function(){return H.default.Source.prototype.dispose.call(this),this._writable(["frequency","detune"]),this.frequency.dispose(),this.frequency=null,this.detune.dispose(),this.detune=null,this._forEach((function(z){z.dispose()})),this._oscillators=null,this._partials=null,this},G.default=H.default.FatOscillator},function(z,G,V){V.r(G);var H=V(0);V(6),V(17),V(5),V(3),V(22),H.default.AMOscillator=function(){var z=H.default.defaults(arguments,["frequency","type","modulationType"],H.default.AMOscillator);H.default.Source.call(this,z),this._carrier=new H.default.Oscillator(z.frequency,z.type),this.frequency=this._carrier.frequency,this.detune=this._carrier.detune,this.detune.value=z.detune,this._modulator=new H.default.Oscillator(z.frequency,z.modulationType),this._modulationScale=new H.default.AudioToGain,this.harmonicity=new H.default.Multiply(z.harmonicity),this.harmonicity.units=H.default.Type.Positive,this._modulationNode=new H.default.Gain(0),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.detune.connect(this._modulator.detune),this._modulator.chain(this._modulationScale,this._modulationNode.gain),this._carrier.chain(this._modulationNode,this.output),this.phase=z.phase,this._readOnly(["frequency","detune","harmonicity"])},H.default.extend(H.default.AMOscillator,H.default.Oscillator),H.default.AMOscillator.defaults={frequency:440,detune:0,phase:0,type:"sine",modulationType:"square",harmonicity:1},H.default.AMOscillator.prototype._start=function(z){this._modulator.start(z),this._carrier.start(z)},H.default.AMOscillator.prototype._stop=function(z){this._modulator.stop(z),this._carrier.stop(z)},H.default.AMOscillator.prototype.restart=function(z){this._modulator.restart(z),this._carrier.restart(z)},Object.defineProperty(H.default.AMOscillator.prototype,"type",{get:function(){return this._carrier.type},set:function(z){this._carrier.type=z}}),Object.defineProperty(H.default.AMOscillator.prototype,"baseType",{get:function(){return this._carrier.baseType},set:function(z){this._carrier.baseType=z}}),Object.defineProperty(H.default.AMOscillator.prototype,"partialCount",{get:function(){return this._carrier.partialCount},set:function(z){this._carrier.partialCount=z}}),Object.defineProperty(H.default.AMOscillator.prototype,"modulationType",{get:function(){return this._modulator.type},set:function(z){this._modulator.type=z}}),Object.defineProperty(H.default.AMOscillator.prototype,"phase",{get:function(){return this._carrier.phase},set:function(z){this._carrier.phase=z,this._modulator.phase=z}}),Object.defineProperty(H.default.AMOscillator.prototype,"partials",{get:function(){return this._carrier.partials},set:function(z){this._carrier.partials=z}}),H.default.AMOscillator.prototype.dispose=function(){return H.default.Source.prototype.dispose.call(this),this._writable(["frequency","detune","harmonicity"]),this.frequency=null,this.detune=null,this.harmonicity.dispose(),this.harmonicity=null,this._carrier.dispose(),this._carrier=null,this._modulator.dispose(),this._modulator=null,this._modulationNode.dispose(),this._modulationNode=null,this._modulationScale.dispose(),this._modulationScale=null,this},G.default=H.default.AMOscillator},function(z,G,V){V.r(G);var H=V(0);V(6),V(50),V(17),V(5),H.default.PWMOscillator=function(){var z=H.default.defaults(arguments,["frequency","modulationFrequency"],H.default.PWMOscillator);H.default.Source.call(this,z),this._pulse=new H.default.PulseOscillator(z.modulationFrequency),this._pulse._sawtooth.type="sine",this._modulator=new H.default.Oscillator({frequency:z.frequency,detune:z.detune,phase:z.phase}),this._scale=new H.default.Multiply(2),this.frequency=this._modulator.frequency,this.detune=this._modulator.detune,this.modulationFrequency=this._pulse.frequency,this._modulator.chain(this._scale,this._pulse.width),this._pulse.connect(this.output),this._readOnly(["modulationFrequency","frequency","detune"])},H.default.extend(H.default.PWMOscillator,H.default.Source),H.default.PWMOscillator.defaults={frequency:440,detune:0,phase:0,modulationFrequency:.4},H.default.PWMOscillator.prototype._start=function(z){z=this.toSeconds(z),this._modulator.start(z),this._pulse.start(z)},H.default.PWMOscillator.prototype._stop=function(z){z=this.toSeconds(z),this._modulator.stop(z),this._pulse.stop(z)},H.default.PWMOscillator.prototype.restart=function(z){this._modulator.restart(z),this._pulse.restart(z)},Object.defineProperty(H.default.PWMOscillator.prototype,"type",{get:function(){return"pwm"}}),Object.defineProperty(H.default.PWMOscillator.prototype,"baseType",{get:function(){return"pwm"}}),Object.defineProperty(H.default.PWMOscillator.prototype,"partials",{get:function(){return[]}}),Object.defineProperty(H.default.PWMOscillator.prototype,"phase",{get:function(){return this._modulator.phase},set:function(z){this._modulator.phase=z}}),H.default.PWMOscillator.prototype.dispose=function(){return H.default.Source.prototype.dispose.call(this),this._pulse.dispose(),this._pulse=null,this._scale.dispose(),this._scale=null,this._modulator.dispose(),this._modulator=null,this._writable(["modulationFrequency","frequency","detune"]),this.frequency=null,this.detune=null,this.modulationFrequency=null,this},G.default=H.default.PWMOscillator},function(z,G,V){V.r(G);var H=V(0);V(51),V(4),V(16),H.default.Part=function(){var z=H.default.defaults(arguments,["callback","events"],H.default.Part);H.default.Event.call(this,z),this._events=[];for(var G=0;G<z.events.length;G++)Array.isArray(z.events[G])?this.add(z.events[G][0],z.events[G][1]):this.add(z.events[G])},H.default.extend(H.default.Part,H.default.Event),H.default.Part.defaults={callback:H.default.noOp,loop:!1,loopEnd:"1m",loopStart:0,playbackRate:1,probability:1,humanize:!1,mute:!1,events:[]},H.default.Part.prototype.start=function(z,G){var V=this.toTicks(z);return this._state.getValueAtTime(V)!==H.default.State.Started&&(G=this._loop?H.default.defaultArg(G,this._loopStart):H.default.defaultArg(G,0),G=this.toTicks(G),this._state.add({state:H.default.State.Started,time:V,offset:G}),this._forEach((function(z){this._startNote(z,V,G)}))),this},H.default.Part.prototype._startNote=function(z,G,V){G-=V,this._loop?z.startOffset>=this._loopStart&&z.startOffset<this._loopEnd?(z.startOffset<V&&(G+=this._getLoopDuration()),z.start(H.default.Ticks(G))):z.startOffset<this._loopStart&&z.startOffset>=V&&(z.loop=!1,z.start(H.default.Ticks(G))):z.startOffset>=V&&z.start(H.default.Ticks(G))},Object.defineProperty(H.default.Part.prototype,"startOffset",{get:function(){return this._startOffset},set:function(z){this._startOffset=z,this._forEach((function(z){z.startOffset+=this._startOffset}))}}),H.default.Part.prototype.stop=function(z){var G=this.toTicks(z);return this._state.cancel(G),this._state.setStateAtTime(H.default.State.Stopped,G),this._forEach((function(G){G.stop(z)})),this},H.default.Part.prototype.at=function(z,G){z=H.default.TransportTime(z);for(var V=H.default.Ticks(1).toSeconds(),W=0;W<this._events.length;W++){var K=this._events[W];if(Math.abs(z.toTicks()-K.startOffset)<V)return H.default.isDefined(G)&&(K.value=G),K}return H.default.isDefined(G)?(this.add(z,G),this._events[this._events.length-1]):null},H.default.Part.prototype.add=function(z,G){var V;return z.hasOwnProperty("time")&&(z=(G=z).time),z=this.toTicks(z),G instanceof H.default.Event?(V=G).callback=this._tick.bind(this):V=new H.default.Event({callback:this._tick.bind(this),value:G}),V.startOffset=z,V.set({loopEnd:this.loopEnd,loopStart:this.loopStart,loop:this.loop,humanize:this.humanize,playbackRate:this.playbackRate,probability:this.probability}),this._events.push(V),this._restartEvent(V),this},H.default.Part.prototype._restartEvent=function(z){this._state.forEach(function(G){G.state===H.default.State.Started?this._startNote(z,G.time,G.offset):z.stop(H.default.Ticks(G.time))}.bind(this))},H.default.Part.prototype.remove=function(z,G){z.hasOwnProperty("time")&&(z=(G=z).time),z=this.toTicks(z);for(var V=this._events.length-1;V>=0;V--){var W=this._events[V];W.startOffset===z&&(H.default.isUndef(G)||H.default.isDefined(G)&&W.value===G)&&(this._events.splice(V,1),W.dispose())}return this},H.default.Part.prototype.removeAll=function(){return this._forEach((function(z){z.dispose()})),this._events=[],this},H.default.Part.prototype.cancel=function(z){return this._forEach((function(G){G.cancel(z)})),this._state.cancel(this.toTicks(z)),this},H.default.Part.prototype._forEach=function(z,G){if(this._events){G=H.default.defaultArg(G,this);for(var V=this._events.length-1;V>=0;V--){var W=this._events[V];W instanceof H.default.Part?W._forEach(z,G):z.call(G,W)}}return this},H.default.Part.prototype._setAll=function(z,G){this._forEach((function(V){V[z]=G}))},H.default.Part.prototype._tick=function(z,G){this.mute||this.callback(z,G)},H.default.Part.prototype._testLoopBoundries=function(z){this._loop&&(z.startOffset<this._loopStart||z.startOffset>=this._loopEnd)?z.cancel(0):z.state===H.default.State.Stopped&&this._restartEvent(z)},Object.defineProperty(H.default.Part.prototype,"probability",{get:function(){return this._probability},set:function(z){this._probability=z,this._setAll("probability",z)}}),Object.defineProperty(H.default.Part.prototype,"humanize",{get:function(){return this._humanize},set:function(z){this._humanize=z,this._setAll("humanize",z)}}),Object.defineProperty(H.default.Part.prototype,"loop",{get:function(){return this._loop},set:function(z){this._loop=z,this._forEach((function(G){G._loopStart=this._loopStart,G._loopEnd=this._loopEnd,G.loop=z,this._testLoopBoundries(G)}))}}),Object.defineProperty(H.default.Part.prototype,"loopEnd",{get:function(){return H.default.Ticks(this._loopEnd).toSeconds()},set:function(z){this._loopEnd=this.toTicks(z),this._loop&&this._forEach((function(G){G.loopEnd=z,this._testLoopBoundries(G)}))}}),Object.defineProperty(H.default.Part.prototype,"loopStart",{get:function(){return H.default.Ticks(this._loopStart).toSeconds()},set:function(z){this._loopStart=this.toTicks(z),this._loop&&this._forEach((function(z){z.loopStart=this.loopStart,this._testLoopBoundries(z)}))}}),Object.defineProperty(H.default.Part.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(z){this._playbackRate=z,this._setAll("playbackRate",z)}}),Object.defineProperty(H.default.Part.prototype,"length",{get:function(){return this._events.length}}),H.default.Part.prototype.dispose=function(){return H.default.Event.prototype.dispose.call(this),this.removeAll(),this.callback=null,this._events=null,this},G.default=H.default.Part},function(z,G,V){V.r(G);var H=V(0);V(51),H.default.Loop=function(){var z=H.default.defaults(arguments,["callback","interval"],H.default.Loop);H.default.call(this),this._event=new H.default.Event({callback:this._tick.bind(this),loop:!0,loopEnd:z.interval,playbackRate:z.playbackRate,probability:z.probability}),this.callback=z.callback,this.iterations=z.iterations},H.default.extend(H.default.Loop),H.default.Loop.defaults={interval:"4n",callback:H.default.noOp,playbackRate:1,iterations:1/0,probability:!0,mute:!1},H.default.Loop.prototype.start=function(z){return this._event.start(z),this},H.default.Loop.prototype.stop=function(z){return this._event.stop(z),this},H.default.Loop.prototype.cancel=function(z){return this._event.cancel(z),this},H.default.Loop.prototype._tick=function(z){this.callback(z)},Object.defineProperty(H.default.Loop.prototype,"state",{get:function(){return this._event.state}}),Object.defineProperty(H.default.Loop.prototype,"progress",{get:function(){return this._event.progress}}),Object.defineProperty(H.default.Loop.prototype,"interval",{get:function(){return this._event.loopEnd},set:function(z){this._event.loopEnd=z}}),Object.defineProperty(H.default.Loop.prototype,"playbackRate",{get:function(){return this._event.playbackRate},set:function(z){this._event.playbackRate=z}}),Object.defineProperty(H.default.Loop.prototype,"humanize",{get:function(){return this._event.humanize},set:function(z){this._event.humanize=z}}),Object.defineProperty(H.default.Loop.prototype,"probability",{get:function(){return this._event.probability},set:function(z){this._event.probability=z}}),Object.defineProperty(H.default.Loop.prototype,"mute",{get:function(){return this._event.mute},set:function(z){this._event.mute=z}}),Object.defineProperty(H.default.Loop.prototype,"iterations",{get:function(){return!0===this._event.loop?1/0:this._event.loop},set:function(z){this._event.loop=z===1/0||z}}),H.default.Loop.prototype.dispose=function(){this._event.dispose(),this._event=null,this.callback=null},G.default=H.default.Loop},function(z,G,V){V.r(G);var H=V(0);V(15),V(33),H.default.StereoXFeedbackEffect=function(){var z=H.default.defaults(arguments,["feedback"],H.default.FeedbackEffect);H.default.StereoEffect.call(this,z),this.feedback=new H.default.Signal(z.feedback,H.default.Type.NormalRange),this._feedbackLR=new H.default.Gain,this._feedbackRL=new H.default.Gain,this.effectReturnL.chain(this._feedbackLR,this.effectSendR),this.effectReturnR.chain(this._feedbackRL,this.effectSendL),this.feedback.fan(this._feedbackLR.gain,this._feedbackRL.gain),this._readOnly(["feedback"])},H.default.extend(H.default.StereoXFeedbackEffect,H.default.StereoEffect),H.default.StereoXFeedbackEffect.prototype.dispose=function(){return H.default.StereoEffect.prototype.dispose.call(this),this._writable(["feedback"]),this.feedback.dispose(),this.feedback=null,this._feedbackLR.dispose(),this._feedbackLR=null,this._feedbackRL.dispose(),this._feedbackRL=null,this},G.default=H.default.StereoXFeedbackEffect},function(z,G,V){V.r(G);var H=V(0);V(8),V(53),V(52),H.default.MidSideEffect=function(){H.default.Effect.apply(this,arguments),this._midSideSplit=new H.default.MidSideSplit,this._midSideMerge=new H.default.MidSideMerge,this.midSend=this._midSideSplit.mid,this.sideSend=this._midSideSplit.side,this.midReturn=this._midSideMerge.mid,this.sideReturn=this._midSideMerge.side,this.effectSend.connect(this._midSideSplit),this._midSideMerge.connect(this.effectReturn)},H.default.extend(H.default.MidSideEffect,H.default.Effect),H.default.MidSideEffect.prototype.dispose=function(){return H.default.Effect.prototype.dispose.call(this),this._midSideSplit.dispose(),this._midSideSplit=null,this._midSideMerge.dispose(),this._midSideMerge=null,this.midSend=null,this.sideSend=null,this.midReturn=null,this.sideReturn=null,this},G.default=H.default.MidSideEffect},function(z,G,V){V.r(G);var H=V(0);V(11),V(8),H.default.Convolver=function(){var z=H.default.defaults(arguments,["url","onload"],H.default.Convolver);H.default.Effect.call(this,z),this._convolver=this.context.createConvolver(),this._buffer=new H.default.Buffer(z.url,function(G){this.buffer=G.get(),z.onload()}.bind(this)),this._buffer.loaded&&(this.buffer=this._buffer),this.normalize=z.normalize,this.connectEffect(this._convolver)},H.default.extend(H.default.Convolver,H.default.Effect),H.default.Convolver.defaults={onload:H.default.noOp,normalize:!0},Object.defineProperty(H.default.Convolver.prototype,"buffer",{get:function(){return this._buffer.length?this._buffer:null},set:function(z){this._buffer.set(z),this._convolver.buffer&&(this.effectSend.disconnect(),this._convolver.disconnect(),this._convolver=this.context.createConvolver(),this.connectEffect(this._convolver)),this._convolver.buffer=this._buffer.get()}}),Object.defineProperty(H.default.Convolver.prototype,"normalize",{get:function(){return this._convolver.normalize},set:function(z){this._convolver.normalize=z}}),H.default.Convolver.prototype.load=function(z,G){return this._buffer.load(z,function(z){this.buffer=z,G&&G()}.bind(this))},H.default.Convolver.prototype.dispose=function(){return H.default.Effect.prototype.dispose.call(this),this._buffer.dispose(),this._buffer=null,this._convolver.disconnect(),this._convolver=null,this},G.default=H.default.Convolver},function(z,G,V){V.r(G);var H=V(0);V(7),V(5),V(13),H.default.Modulo=function(z){H.default.SignalBase.call(this),this.createInsOuts(1,0),this._shaper=new H.default.WaveShaper(Math.pow(2,16)),this._multiply=new H.default.Multiply,this._subtract=this.output=new H.default.Subtract,this._modSignal=new H.default.Signal(z),H.default.connect(this.input,this._shaper),H.default.connect(this.input,this._subtract),this._modSignal.connect(this._multiply,0,0),this._shaper.connect(this._multiply,0,1),this._multiply.connect(this._subtract,0,1),this._setWaveShaper(z)},H.default.extend(H.default.Modulo,H.default.SignalBase),H.default.Modulo.prototype._setWaveShaper=function(z){this._shaper.setMap((function(G){return Math.floor((G+1e-4)/z)}))},Object.defineProperty(H.default.Modulo.prototype,"value",{get:function(){return this._modSignal.value},set:function(z){this._modSignal.value=z,this._setWaveShaper(z)}}),H.default.Modulo.prototype.dispose=function(){return H.default.SignalBase.prototype.dispose.call(this),this._shaper.dispose(),this._shaper=null,this._multiply.dispose(),this._multiply=null,this._subtract.dispose(),this._subtract=null,this._modSignal.dispose(),this._modSignal=null,this},G.default=H.default.Modulo},function(z,G,V){V.r(G);var H=V(0);V(20),V(92),H.default.OfflineContext=function(z,G,V){var W=new OfflineAudioContext(z,G*V,V);H.default.Context.call(this,{context:W,clockSource:"offline",lookAhead:0,updateInterval:128/V}),this._duration=G,this._currentTime=0},H.default.extend(H.default.OfflineContext,H.default.Context),H.default.OfflineContext.prototype.now=function(){return this._currentTime},H.default.OfflineContext.prototype.resume=function(){return Promise.resolve()},H.default.OfflineContext.prototype.render=function(){for(;this._duration-this._currentTime>=0;)this.emit("tick"),this._currentTime+=.005;return this._context.startRendering()},H.default.OfflineContext.prototype.close=function(){return this._context=null,Promise.resolve()},G.default=H.default.OfflineContext},function(z,G,V){V.r(G);var H=V(0);V(16),V(11),V(76),V(40),H.default.Offline=function(z,G){var V=H.default.context.sampleRate,W=H.default.context,K=new H.default.OfflineContext(2,G,V);H.default.context=K;var Z=z(H.default.Transport),it=null;return it=Z&&H.default.isFunction(Z.then)?Z.then((function(){return K.render()})):K.render(),H.default.context=W,it.then((function(z){return new H.default.Buffer(z)}))},G.default=H.default.Offline},function(z,G,V){V.r(G);var H=V(0);V(11),H.default.Buffers=function(z){var G=Array.prototype.slice.call(arguments);G.shift();var V=H.default.defaults(G,["onload","baseUrl"],H.default.Buffers);for(var W in H.default.call(this),this._buffers={},this.baseUrl=V.baseUrl,this._loadingCount=0,z)this._loadingCount++,this.add(W,z[W],this._bufferLoaded.bind(this,V.onload))},H.default.extend(H.default.Buffers),H.default.Buffers.defaults={onload:H.default.noOp,baseUrl:""},H.default.Buffers.prototype.has=function(z){return this._buffers.hasOwnProperty(z)},H.default.Buffers.prototype.get=function(z){if(this.has(z))return this._buffers[z];throw new Error("Tone.Buffers: no buffer named "+z)},H.default.Buffers.prototype._bufferLoaded=function(z){this._loadingCount--,0===this._loadingCount&&z&&z(this)},Object.defineProperty(H.default.Buffers.prototype,"loaded",{get:function(){var z=!0;for(var G in this._buffers){var V=this.get(G);z=z&&V.loaded}return z}}),H.default.Buffers.prototype.add=function(z,G,V){return V=H.default.defaultArg(V,H.default.noOp),G instanceof H.default.Buffer?(this._buffers[z]=G,V(this)):G instanceof AudioBuffer?(this._buffers[z]=new H.default.Buffer(G),V(this)):H.default.isString(G)&&(this._buffers[z]=new H.default.Buffer(this.baseUrl+G,V)),this},H.default.Buffers.prototype.dispose=function(){for(var z in H.default.prototype.dispose.call(this),this._buffers)this._buffers[z].dispose();return this._buffers=null,this},G.default=H.default.Buffers},function(z,G,V){V.r(G);var H=V(0);H.default.CtrlPattern=function(){var z=H.default.defaults(arguments,["values","type"],H.default.CtrlPattern);H.default.call(this),this.values=z.values,this.index=0,this._type=null,this._shuffled=null,this._direction=null,this.type=z.type},H.default.extend(H.default.CtrlPattern),H.default.CtrlPattern.Type={Up:"up",Down:"down",UpDown:"upDown",DownUp:"downUp",AlternateUp:"alternateUp",AlternateDown:"alternateDown",Random:"random",RandomWalk:"randomWalk",RandomOnce:"randomOnce"},H.default.CtrlPattern.defaults={type:H.default.CtrlPattern.Type.Up,values:[]},Object.defineProperty(H.default.CtrlPattern.prototype,"value",{get:function(){if(0!==this.values.length){if(1===this.values.length)return this.values[0];this.index=Math.min(this.index,this.values.length-1);var z=this.values[this.index];return this.type===H.default.CtrlPattern.Type.RandomOnce&&(this.values.length!==this._shuffled.length&&this._shuffleValues(),z=this.values[this._shuffled[this.index]]),z}}}),Object.defineProperty(H.default.CtrlPattern.prototype,"type",{get:function(){return this._type},set:function(z){this._type=z,this._shuffled=null,this._type===H.default.CtrlPattern.Type.Up||this._type===H.default.CtrlPattern.Type.UpDown||this._type===H.default.CtrlPattern.Type.RandomOnce||this._type===H.default.CtrlPattern.Type.AlternateUp?this.index=0:this._type!==H.default.CtrlPattern.Type.Down&&this._type!==H.default.CtrlPattern.Type.DownUp&&this._type!==H.default.CtrlPattern.Type.AlternateDown||(this.index=this.values.length-1),this._type===H.default.CtrlPattern.Type.UpDown||this._type===H.default.CtrlPattern.Type.AlternateUp?this._direction=H.default.CtrlPattern.Type.Up:this._type!==H.default.CtrlPattern.Type.DownUp&&this._type!==H.default.CtrlPattern.Type.AlternateDown||(this._direction=H.default.CtrlPattern.Type.Down),this._type===H.default.CtrlPattern.Type.RandomOnce?this._shuffleValues():this._type===H.default.CtrlPattern.Type.Random&&(this.index=Math.floor(Math.random()*this.values.length))}}),H.default.CtrlPattern.prototype.next=function(){var z=this.type;return z===H.default.CtrlPattern.Type.Up?(this.index++,this.index>=this.values.length&&(this.index=0)):z===H.default.CtrlPattern.Type.Down?(this.index--,this.index<0&&(this.index=this.values.length-1)):z===H.default.CtrlPattern.Type.UpDown||z===H.default.CtrlPattern.Type.DownUp?(this._direction===H.default.CtrlPattern.Type.Up?this.index++:this.index--,this.index<0?(this.index=1,this._direction=H.default.CtrlPattern.Type.Up):this.index>=this.values.length&&(this.index=this.values.length-2,this._direction=H.default.CtrlPattern.Type.Down)):z===H.default.CtrlPattern.Type.Random?this.index=Math.floor(Math.random()*this.values.length):z===H.default.CtrlPattern.Type.RandomWalk?Math.random()<.5?(this.index--,this.index=Math.max(this.index,0)):(this.index++,this.index=Math.min(this.index,this.values.length-1)):z===H.default.CtrlPattern.Type.RandomOnce?(this.index++,this.index>=this.values.length&&(this.index=0,this._shuffleValues())):z===H.default.CtrlPattern.Type.AlternateUp?(this._direction===H.default.CtrlPattern.Type.Up?(this.index+=2,this._direction=H.default.CtrlPattern.Type.Down):(this.index-=1,this._direction=H.default.CtrlPattern.Type.Up),this.index>=this.values.length&&(this.index=0,this._direction=H.default.CtrlPattern.Type.Up)):z===H.default.CtrlPattern.Type.AlternateDown&&(this._direction===H.default.CtrlPattern.Type.Up?(this.index+=1,this._direction=H.default.CtrlPattern.Type.Down):(this.index-=2,this._direction=H.default.CtrlPattern.Type.Up),this.index<0&&(this.index=this.values.length-1,this._direction=H.default.CtrlPattern.Type.Down)),this.value},H.default.CtrlPattern.prototype._shuffleValues=function(){var z=[];this._shuffled=[];for(var G=0;G<this.values.length;G++)z[G]=G;for(;z.length>0;){var V=z.splice(Math.floor(z.length*Math.random()),1);this._shuffled.push(V[0])}},H.default.CtrlPattern.prototype.dispose=function(){this._shuffled=null,this.values=null},G.default=H.default.CtrlPattern},function(z,G,V){V.r(G);var H=V(0);V(56),V(55),H.default.TransportRepeatEvent=function(z,G){H.default.TransportEvent.call(this,z,G),G=H.default.defaultArg(G,H.default.TransportRepeatEvent.defaults),this.duration=H.default.Ticks(G.duration),this._interval=H.default.Ticks(G.interval),this._currentId=-1,this._nextId=-1,this._nextTick=this.time,this._boundRestart=this._restart.bind(this),this.Transport.on("start loopStart",this._boundRestart),this._restart()},H.default.extend(H.default.TransportRepeatEvent,H.default.TransportEvent),H.default.TransportRepeatEvent.defaults={duration:1/0,interval:1},H.default.TransportRepeatEvent.prototype.invoke=function(z){this._createEvents(z),H.default.TransportEvent.prototype.invoke.call(this,z)},H.default.TransportRepeatEvent.prototype._createEvents=function(z){var G=this.Transport.getTicksAtTime(z);G>=this.time&&G>=this._nextTick&&this._nextTick+this._interval<this.time+this.duration&&(this._nextTick+=this._interval,this._currentId=this._nextId,this._nextId=this.Transport.scheduleOnce(this.invoke.bind(this),H.default.Ticks(this._nextTick)))},H.default.TransportRepeatEvent.prototype._restart=function(z){this.Transport.clear(this._currentId),this.Transport.clear(this._nextId),this._nextTick=this.time;var G=this.Transport.getTicksAtTime(z);G>this.time&&(this._nextTick=this.time+Math.ceil((G-this.time)/this._interval)*this._interval),this._currentId=this.Transport.scheduleOnce(this.invoke.bind(this),H.default.Ticks(this._nextTick)),this._nextTick+=this._interval,this._nextId=this.Transport.scheduleOnce(this.invoke.bind(this),H.default.Ticks(this._nextTick))},H.default.TransportRepeatEvent.prototype.dispose=function(){return this.Transport.clear(this._currentId),this.Transport.clear(this._nextId),this.Transport.off("start loopStart",this._boundRestart),this._boundCreateEvents=null,H.default.TransportEvent.prototype.dispose.call(this),this.duration=null,this._interval=null,this},G.default=H.default.TransportRepeatEvent},function(z,G,V){V.r(G);var H=V(0);V(4),H.default.IntervalTimeline=function(){H.default.call(this),this._root=null,this._length=0},H.default.extend(H.default.IntervalTimeline),H.default.IntervalTimeline.prototype.add=function(z){if(H.default.isUndef(z.time)||H.default.isUndef(z.duration))throw new Error("Tone.IntervalTimeline: events must have time and duration parameters");z.time=z.time.valueOf();var G=new n(z.time,z.time+z.duration,z);for(null===this._root?this._root=G:this._root.insert(G),this._length++;null!==G;)G.updateHeight(),G.updateMax(),this._rebalance(G),G=G.parent;return this},H.default.IntervalTimeline.prototype.remove=function(z){if(null!==this._root){var G=[];this._root.search(z.time,G);for(var V=0;V<G.length;V++){var H=G[V];if(H.event===z){this._removeNode(H),this._length--;break}}}return this},Object.defineProperty(H.default.IntervalTimeline.prototype,"length",{get:function(){return this._length}}),H.default.IntervalTimeline.prototype.cancel=function(z){return this.forEachFrom(z,function(z){this.remove(z)}.bind(this)),this},H.default.IntervalTimeline.prototype._setRoot=function(z){this._root=z,null!==this._root&&(this._root.parent=null)},H.default.IntervalTimeline.prototype._replaceNodeInParent=function(z,G){null!==z.parent?(z.isLeftChild()?z.parent.left=G:z.parent.right=G,this._rebalance(z.parent)):this._setRoot(G)},H.default.IntervalTimeline.prototype._removeNode=function(z){if(null===z.left&&null===z.right)this._replaceNodeInParent(z,null);else if(null===z.right)this._replaceNodeInParent(z,z.left);else if(null===z.left)this._replaceNodeInParent(z,z.right);else{var G,V;if(z.getBalance()>0)if(null===z.left.right)(G=z.left).right=z.right,V=G;else{for(G=z.left.right;null!==G.right;)G=G.right;G.parent.right=G.left,V=G.parent,G.left=z.left,G.right=z.right}else if(null===z.right.left)(G=z.right).left=z.left,V=G;else{for(G=z.right.left;null!==G.left;)G=G.left;G.parent.left=G.right,V=G.parent,G.left=z.left,G.right=z.right}null!==z.parent?z.isLeftChild()?z.parent.left=G:z.parent.right=G:this._setRoot(G),this._rebalance(V)}z.dispose()},H.default.IntervalTimeline.prototype._rotateLeft=function(z){var G=z.parent,V=z.isLeftChild(),H=z.right;z.right=H.left,H.left=z,null!==G?V?G.left=H:G.right=H:this._setRoot(H)},H.default.IntervalTimeline.prototype._rotateRight=function(z){var G=z.parent,V=z.isLeftChild(),H=z.left;z.left=H.right,H.right=z,null!==G?V?G.left=H:G.right=H:this._setRoot(H)},H.default.IntervalTimeline.prototype._rebalance=function(z){var G=z.getBalance();G>1?z.left.getBalance()<0?this._rotateLeft(z.left):this._rotateRight(z):G<-1&&(z.right.getBalance()>0?this._rotateRight(z.right):this._rotateLeft(z))},H.default.IntervalTimeline.prototype.get=function(z){if(null!==this._root){var G=[];if(this._root.search(z,G),G.length>0){for(var V=G[0],H=1;H<G.length;H++)G[H].low>V.low&&(V=G[H]);return V.event}}return null},H.default.IntervalTimeline.prototype.forEach=function(z){if(null!==this._root){var G=[];this._root.traverse((function(z){G.push(z)}));for(var V=0;V<G.length;V++){var H=G[V].event;H&&z(H)}}return this},H.default.IntervalTimeline.prototype.forEachAtTime=function(z,G){if(null!==this._root){var V=[];this._root.search(z,V);for(var H=V.length-1;H>=0;H--){var W=V[H].event;W&&G(W)}}return this},H.default.IntervalTimeline.prototype.forEachFrom=function(z,G){if(null!==this._root){var V=[];this._root.searchAfter(z,V);for(var H=V.length-1;H>=0;H--)G(V[H].event)}return this},H.default.IntervalTimeline.prototype.dispose=function(){var z=[];null!==this._root&&this._root.traverse((function(G){z.push(G)}));for(var G=0;G<z.length;G++)z[G].dispose();return z=null,this._root=null,this};var n=function(z,G,V){this.event=V,this.low=z,this.high=G,this.max=this.high,this._left=null,this._right=null,this.parent=null,this.height=0};n.prototype.insert=function(z){z.low<=this.low?null===this.left?this.left=z:this.left.insert(z):null===this.right?this.right=z:this.right.insert(z)},n.prototype.search=function(z,G){z>this.max||(null!==this.left&&this.left.search(z,G),this.low<=z&&this.high>z&&G.push(this),this.low>z||null!==this.right&&this.right.search(z,G))},n.prototype.searchAfter=function(z,G){this.low>=z&&(G.push(this),null!==this.left&&this.left.searchAfter(z,G)),null!==this.right&&this.right.searchAfter(z,G)},n.prototype.traverse=function(z){z(this),null!==this.left&&this.left.traverse(z),null!==this.right&&this.right.traverse(z)},n.prototype.updateHeight=function(){null!==this.left&&null!==this.right?this.height=Math.max(this.left.height,this.right.height)+1:null!==this.right?this.height=this.right.height+1:null!==this.left?this.height=this.left.height+1:this.height=0},n.prototype.updateMax=function(){this.max=this.high,null!==this.left&&(this.max=Math.max(this.max,this.left.max)),null!==this.right&&(this.max=Math.max(this.max,this.right.max))},n.prototype.getBalance=function(){var z=0;return null!==this.left&&null!==this.right?z=this.left.height-this.right.height:null!==this.left?z=this.left.height+1:null!==this.right&&(z=-(this.right.height+1)),z},n.prototype.isLeftChild=function(){return null!==this.parent&&this.parent.left===this},Object.defineProperty(n.prototype,"left",{get:function(){return this._left},set:function(z){this._left=z,null!==z&&(z.parent=this),this.updateHeight(),this.updateMax()}}),Object.defineProperty(n.prototype,"right",{get:function(){return this._right},set:function(z){this._right=z,null!==z&&(z.parent=this),this.updateHeight(),this.updateMax()}}),n.prototype.dispose=function(){this.parent=null,this._left=null,this._right=null,this.event=null},G.default=H.default.IntervalTimeline},function(z,G,V){V.r(G);var H=V(0);function n(z){return function(G,V){V=this.toSeconds(V),z.apply(this,arguments);var H=this._events.get(V),W=this._events.previousEvent(H),K=this._getTicksUntilEvent(W,V);return H.ticks=Math.max(K,0),this}}V(2),H.default.TickSignal=function(z){z=H.default.defaultArg(z,1),H.default.Signal.call(this,{units:H.default.Type.Ticks,value:z}),this._events.memory=1/0,this.cancelScheduledValues(0),this._events.add({type:H.default.Param.AutomationType.SetValue,time:0,value:z})},H.default.extend(H.default.TickSignal,H.default.Signal),H.default.TickSignal.prototype.setValueAtTime=n(H.default.Signal.prototype.setValueAtTime),H.default.TickSignal.prototype.linearRampToValueAtTime=n(H.default.Signal.prototype.linearRampToValueAtTime),H.default.TickSignal.prototype.setTargetAtTime=function(z,G,V){G=this.toSeconds(G),this.setRampPoint(G),z=this._fromUnits(z);for(var H=this._events.get(G),W=Math.round(Math.max(1/V,1)),K=0;K<=W;K++){var Z=V*K+G,it=this._exponentialApproach(H.time,H.value,z,V,Z);this.linearRampToValueAtTime(this._toUnits(it),Z)}return this},H.default.TickSignal.prototype.exponentialRampToValueAtTime=function(z,G){G=this.toSeconds(G),z=this._fromUnits(z);for(var V=this._events.get(G),H=Math.round(Math.max(10*(G-V.time),1)),W=(G-V.time)/H,K=0;K<=H;K++){var Z=W*K+V.time,it=this._exponentialInterpolate(V.time,V.value,G,z,Z);this.linearRampToValueAtTime(this._toUnits(it),Z)}return this},H.default.TickSignal.prototype._getTicksUntilEvent=function(z,G){if(null===z)z={ticks:0,time:0};else if(H.default.isUndef(z.ticks)){var V=this._events.previousEvent(z);z.ticks=this._getTicksUntilEvent(V,z.time)}var W=this.getValueAtTime(z.time),K=this.getValueAtTime(G);return this._events.get(G).time===G&&this._events.get(G).type===H.default.Param.AutomationType.SetValue&&(K=this.getValueAtTime(G-this.sampleTime)),.5*(G-z.time)*(W+K)+z.ticks},H.default.TickSignal.prototype.getTicksAtTime=function(z){z=this.toSeconds(z);var G=this._events.get(z);return Math.max(this._getTicksUntilEvent(G,z),0)},H.default.TickSignal.prototype.getDurationOfTicks=function(z,G){G=this.toSeconds(G);var V=this.getTicksAtTime(G);return this.getTimeOfTick(V+z)-G},H.default.TickSignal.prototype.getTimeOfTick=function(z){var G=this._events.get(z,"ticks"),V=this._events.getAfter(z,"ticks");if(G&&G.ticks===z)return G.time;if(G&&V&&V.type===H.default.Param.AutomationType.Linear&&G.value!==V.value){var W=this.getValueAtTime(G.time),K=(this.getValueAtTime(V.time)-W)/(V.time-G.time),Z=Math.sqrt(Math.pow(W,2)-2*K*(G.ticks-z)),it=(-W+Z)/K;return(it>0?it:(-W-Z)/K)+G.time}return G?0===G.value?1/0:G.time+(z-G.ticks)/G.value:z/this._initialValue},H.default.TickSignal.prototype.ticksToTime=function(z,G){return G=this.toSeconds(G),new H.default.Time(this.getDurationOfTicks(z,G))},H.default.TickSignal.prototype.timeToTicks=function(z,G){G=this.toSeconds(G),z=this.toSeconds(z);var V=this.getTicksAtTime(G),W=this.getTicksAtTime(G+z);return new H.default.Ticks(W-V)},G.default=H.default.TickSignal},function(z,G,V){V.r(G);var H=V(0);V(57),V(34),V(35),V(20),H.default.Clock=function(){var z=H.default.defaults(arguments,["callback","frequency"],H.default.Clock);H.default.Emitter.call(this),this.callback=z.callback,this._nextTick=0,this._tickSource=new H.default.TickSource(z.frequency),this._lastUpdate=0,this.frequency=this._tickSource.frequency,this._readOnly("frequency"),this._state=new H.default.TimelineState(H.default.State.Stopped),this._state.setStateAtTime(H.default.State.Stopped,0),this._boundLoop=this._loop.bind(this),this.context.on("tick",this._boundLoop)},H.default.extend(H.default.Clock,H.default.Emitter),H.default.Clock.defaults={callback:H.default.noOp,frequency:1},Object.defineProperty(H.default.Clock.prototype,"state",{get:function(){return this._state.getValueAtTime(this.now())}}),H.default.Clock.prototype.start=function(z,G){return this.context.resume(),z=this.toSeconds(z),this._state.getValueAtTime(z)!==H.default.State.Started&&(this._state.setStateAtTime(H.default.State.Started,z),this._tickSource.start(z,G),z<this._lastUpdate&&this.emit("start",z,G)),this},H.default.Clock.prototype.stop=function(z){return z=this.toSeconds(z),this._state.cancel(z),this._state.setStateAtTime(H.default.State.Stopped,z),this._tickSource.stop(z),z<this._lastUpdate&&this.emit("stop",z),this},H.default.Clock.prototype.pause=function(z){return z=this.toSeconds(z),this._state.getValueAtTime(z)===H.default.State.Started&&(this._state.setStateAtTime(H.default.State.Paused,z),this._tickSource.pause(z),z<this._lastUpdate&&this.emit("pause",z)),this},Object.defineProperty(H.default.Clock.prototype,"ticks",{get:function(){return Math.ceil(this.getTicksAtTime(this.now()))},set:function(z){this._tickSource.ticks=z}}),Object.defineProperty(H.default.Clock.prototype,"seconds",{get:function(){return this._tickSource.seconds},set:function(z){this._tickSource.seconds=z}}),H.default.Clock.prototype.getSecondsAtTime=function(z){return this._tickSource.getSecondsAtTime(z)},H.default.Clock.prototype.setTicksAtTime=function(z,G){return this._tickSource.setTicksAtTime(z,G),this},H.default.Clock.prototype.getTicksAtTime=function(z){return this._tickSource.getTicksAtTime(z)},H.default.Clock.prototype.nextTickTime=function(z,G){G=this.toSeconds(G);var V=this.getTicksAtTime(G);return this._tickSource.getTimeOfTick(V+z,G)},H.default.Clock.prototype._loop=function(){var z=this._lastUpdate,G=this.now();this._lastUpdate=G,z!==G&&(this._state.forEachBetween(z,G,function(z){switch(z.state){case H.default.State.Started:var G=this._tickSource.getTicksAtTime(z.time);this.emit("start",z.time,G);break;case H.default.State.Stopped:0!==z.time&&this.emit("stop",z.time);break;case H.default.State.Paused:this.emit("pause",z.time)}}.bind(this)),this._tickSource.forEachTickBetween(z,G,function(z,G){this.callback(z,G)}.bind(this)))},H.default.Clock.prototype.getStateAtTime=function(z){return z=this.toSeconds(z),this._state.getValueAtTime(z)},H.default.Clock.prototype.dispose=function(){H.default.Emitter.prototype.dispose.call(this),this.context.off("tick",this._boundLoop),this._writable("frequency"),this._tickSource.dispose(),this._tickSource=null,this.frequency=null,this._boundLoop=null,this._nextTick=1/0,this.callback=null,this._state.dispose(),this._state=null},G.default=H.default.Clock},function(z,G,V){V.r(G);var H=V(0);V(2),V(5),V(7),H.default.GreaterThanZero=function(){H.default.SignalBase.call(this),this._thresh=this.output=new H.default.WaveShaper((function(z){return z<=0?0:1}),127),this._scale=this.input=new H.default.Multiply(1e4),this._scale.connect(this._thresh)},H.default.extend(H.default.GreaterThanZero,H.default.SignalBase),H.default.GreaterThanZero.prototype.dispose=function(){return H.default.SignalBase.prototype.dispose.call(this),this._scale.dispose(),this._scale=null,this._thresh.dispose(),this._thresh=null,this},G.default=H.default.GreaterThanZero},function(z,G,V){V.r(G);var H=V(0);V(84),V(13),V(2),H.default.GreaterThan=function(z){H.default.Signal.call(this),this.createInsOuts(2,0),this._param=this.input[0]=new H.default.Subtract(z),this.input[1]=this._param.input[1],this._gtz=this.output=new H.default.GreaterThanZero,this._param.connect(this._gtz)},H.default.extend(H.default.GreaterThan,H.default.Signal),H.default.GreaterThan.prototype.dispose=function(){return H.default.Signal.prototype.dispose.call(this),this._gtz.dispose(),this._gtz=null,this},G.default=H.default.GreaterThan},function(z,G,V){V.r(G);var H=V(0);V(47),V(26),H.default.ScaledEnvelope=function(){var z=H.default.defaults(arguments,["attack","decay","sustain","release"],H.default.Envelope);H.default.Envelope.call(this,z),z=H.default.defaultArg(z,H.default.ScaledEnvelope.defaults),this._exp=this.output=new H.default.Pow(z.exponent),this._scale=this.output=new H.default.Scale(z.min,z.max),this._sig.chain(this._exp,this._scale)},H.default.extend(H.default.ScaledEnvelope,H.default.Envelope),H.default.ScaledEnvelope.defaults={min:0,max:1,exponent:1},Object.defineProperty(H.default.ScaledEnvelope.prototype,"min",{get:function(){return this._scale.min},set:function(z){this._scale.min=z}}),Object.defineProperty(H.default.ScaledEnvelope.prototype,"max",{get:function(){return this._scale.max},set:function(z){this._scale.max=z}}),Object.defineProperty(H.default.ScaledEnvelope.prototype,"exponent",{get:function(){return this._exp.value},set:function(z){this._exp.value=z}}),H.default.ScaledEnvelope.prototype.dispose=function(){return H.default.Envelope.prototype.dispose.call(this),this._scale.dispose(),this._scale=null,this._exp.dispose(),this._exp=null,this},G.default=H.default.ScaledEnvelope},function(z,G,V){V.r(G);var H=V(0);V(7),V(30),H.default.Abs=function(){H.default.SignalBase.call(this),this._abs=this.input=this.output=new H.default.WaveShaper((function(z){return Math.abs(z)<.001?0:Math.abs(z)}),1024)},H.default.extend(H.default.Abs,H.default.SignalBase),H.default.Abs.prototype.dispose=function(){return H.default.SignalBase.prototype.dispose.call(this),this._abs.dispose(),this._abs=null,this},G.default=H.default.Abs},function(z,G,V){V.r(G);var H=V(0);V(3),V(1),H.default.Solo=function(){var z=H.default.defaults(arguments,["solo"],H.default.Solo);H.default.AudioNode.call(this),this.input=this.output=new H.default.Gain,this._soloBind=this._soloed.bind(this),this.context.on("solo",this._soloBind),this.solo=z.solo},H.default.extend(H.default.Solo,H.default.AudioNode),H.default.Solo.defaults={solo:!1},Object.defineProperty(H.default.Solo.prototype,"solo",{get:function(){return this._isSoloed()},set:function(z){z?this._addSolo():this._removeSolo(),this.context.emit("solo",this)}}),Object.defineProperty(H.default.Solo.prototype,"muted",{get:function(){return 0===this.input.gain.value}}),H.default.Solo.prototype._addSolo=function(){H.default.isArray(this.context._currentSolo)||(this.context._currentSolo=[]),this._isSoloed()||this.context._currentSolo.push(this)},H.default.Solo.prototype._removeSolo=function(){if(this._isSoloed()){var z=this.context._currentSolo.indexOf(this);this.context._currentSolo.splice(z,1)}},H.default.Solo.prototype._isSoloed=function(){return!!H.default.isArray(this.context._currentSolo)&&0!==this.context._currentSolo.length&&-1!==this.context._currentSolo.indexOf(this)},H.default.Solo.prototype._noSolos=function(){return!H.default.isArray(this.context._currentSolo)||0===this.context._currentSolo.length},H.default.Solo.prototype._soloed=function(){this._isSoloed()||this._noSolos()?this.input.gain.value=1:this.input.gain.value=0},H.default.Solo.prototype.dispose=function(){return this.context.off("solo",this._soloBind),this._removeSolo(),this._soloBind=null,H.default.AudioNode.prototype.dispose.call(this),this},G.default=H.default.Solo},function(z,G,V){V.r(G);var H=V(0);V(7),H.default.EqualPowerGain=function(){H.default.SignalBase.call(this),this._eqPower=this.input=this.output=new H.default.WaveShaper(function(z){return Math.abs(z)<.001?0:H.default.equalPowerScale(z)}.bind(this),4096)},H.default.extend(H.default.EqualPowerGain,H.default.SignalBase),H.default.EqualPowerGain.prototype.dispose=function(){return H.default.SignalBase.prototype.dispose.call(this),this._eqPower.dispose(),this._eqPower=null,this},G.default=H.default.EqualPowerGain},function(z,G,V){V.r(G);var H=V(0);V(5),V(2),H.default.Negate=function(){H.default.SignalBase.call(this),this._multiply=this.input=this.output=new H.default.Multiply(-1)},H.default.extend(H.default.Negate,H.default.SignalBase),H.default.Negate.prototype.dispose=function(){return H.default.SignalBase.prototype.dispose.call(this),this._multiply.dispose(),this._multiply=null,this},G.default=H.default.Negate},function(z,G,V){V.r(G);var H=V(0);V(48),V(27),V(1),H.default.PanVol=function(){var z=H.default.defaults(arguments,["pan","volume"],H.default.PanVol);H.default.AudioNode.call(this),this._panner=this.input=new H.default.Panner(z.pan),this.pan=this._panner.pan,this._volume=this.output=new H.default.Volume(z.volume),this.volume=this._volume.volume,this._panner.connect(this._volume),this.mute=z.mute,this._readOnly(["pan","volume"])},H.default.extend(H.default.PanVol,H.default.AudioNode),H.default.PanVol.defaults={pan:0,volume:0,mute:!1},Object.defineProperty(H.default.PanVol.prototype,"mute",{get:function(){return this._volume.mute},set:function(z){this._volume.mute=z}}),H.default.PanVol.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._writable(["pan","volume"]),this._panner.dispose(),this._panner=null,this.pan=null,this._volume.dispose(),this._volume=null,this.volume=null,this},G.default=H.default.PanVol},function(z,G,V){var H=V(0);if(H.default.supported){!H.default.global.hasOwnProperty("OfflineAudioContext")&&H.default.global.hasOwnProperty("webkitOfflineAudioContext")&&(H.default.global.OfflineAudioContext=H.default.global.webkitOfflineAudioContext);var W=new OfflineAudioContext(1,1,44100).startRendering();W&&H.default.isFunction(W.then)||(OfflineAudioContext.prototype._native_startRendering=OfflineAudioContext.prototype.startRendering,OfflineAudioContext.prototype.startRendering=function(){return new Promise(function(z){this.oncomplete=function(G){z(G.renderedBuffer)},this._native_startRendering()}.bind(this))})}},function(z,G,V){G.a="13.8.34"},function(z,G,V){V.r(G);var H=V(0);V(46),H.default.Midi=function(z,G){if(!(this instanceof H.default.Midi))return new H.default.Midi(z,G);H.default.Frequency.call(this,z,G)},H.default.extend(H.default.Midi,H.default.Frequency),H.default.Midi.prototype._defaultUnits="midi",H.default.Midi.prototype._frequencyToUnits=function(z){return H.default.Frequency.ftom(H.default.Frequency.prototype._frequencyToUnits.call(this,z))},H.default.Midi.prototype._ticksToUnits=function(z){return H.default.Frequency.ftom(H.default.Frequency.prototype._ticksToUnits.call(this,z))},H.default.Midi.prototype._beatsToUnits=function(z){return H.default.Frequency.ftom(H.default.Frequency.prototype._beatsToUnits.call(this,z))},H.default.Midi.prototype._secondsToUnits=function(z){return H.default.Frequency.ftom(H.default.Frequency.prototype._secondsToUnits.call(this,z))},H.default.Midi.prototype.toMidi=function(){return this.valueOf()},H.default.Midi.prototype.toFrequency=function(){return H.default.Frequency.mtof(this.toMidi())},H.default.Midi.prototype.transpose=function(z){return new this.constructor(this.toMidi()+z)},G.default=H.default.Midi},function(z,G,V){V.r(G);var H=V(0);V(27),V(1),H.default.UserMedia=function(){var z=H.default.defaults(arguments,["volume"],H.default.UserMedia);H.default.AudioNode.call(this),this._mediaStream=null,this._stream=null,this._device=null,this._volume=this.output=new H.default.Volume(z.volume),this.volume=this._volume.volume,this._readOnly("volume"),this.mute=z.mute},H.default.extend(H.default.UserMedia,H.default.AudioNode),H.default.UserMedia.defaults={volume:0,mute:!1},H.default.UserMedia.prototype.open=function(z){return this.state===H.default.State.Started&&this.close(),H.default.UserMedia.enumerateDevices().then(function(G){var V;if(H.default.isNumber(z))V=G[z];else if(!(V=G.find((function(G){return G.label===z||G.deviceId===z})))&&G.length>0)V=G[0];else if(!V&&H.default.isDefined(z))throw new Error("Tone.UserMedia: no matching device: "+z);this._device=V;var W={audio:{echoCancellation:!1,sampleRate:this.context.sampleRate,noiseSuppression:!1,mozNoiseSuppression:!1}};return V&&(W.audio.deviceId=V.deviceId),navigator.mediaDevices.getUserMedia(W).then(function(z){return this._stream||(this._stream=z,this._mediaStream=this.context.createMediaStreamSource(z),H.default.connect(this._mediaStream,this.output)),this}.bind(this))}.bind(this))},H.default.UserMedia.prototype.close=function(){return this._stream&&(this._stream.getAudioTracks().forEach((function(z){z.stop()})),this._stream=null,this._mediaStream.disconnect(),this._mediaStream=null),this._device=null,this},H.default.UserMedia.enumerateDevices=function(){return navigator.mediaDevices.enumerateDevices().then((function(z){return z.filter((function(z){return"audioinput"===z.kind}))}))},Object.defineProperty(H.default.UserMedia.prototype,"state",{get:function(){return this._stream&&this._stream.active?H.default.State.Started:H.default.State.Stopped}}),Object.defineProperty(H.default.UserMedia.prototype,"deviceId",{get:function(){return this._device?this._device.deviceId:null}}),Object.defineProperty(H.default.UserMedia.prototype,"groupId",{get:function(){return this._device?this._device.groupId:null}}),Object.defineProperty(H.default.UserMedia.prototype,"label",{get:function(){return this._device?this._device.label:null}}),Object.defineProperty(H.default.UserMedia.prototype,"mute",{get:function(){return this._volume.mute},set:function(z){this._volume.mute=z}}),H.default.UserMedia.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this.close(),this._writable("volume"),this._volume.dispose(),this._volume=null,this.volume=null,this},Object.defineProperty(H.default.UserMedia,"supported",{get:function(){return H.default.isDefined(navigator.mediaDevices)&&H.default.isFunction(navigator.mediaDevices.getUserMedia)}}),G.default=H.default.UserMedia},function(z,G,V){V.r(G);var H=V(0);V(65),V(27),V(1),H.default.Players=function(z){var G=Array.prototype.slice.call(arguments);G.shift();var V=H.default.defaults(G,["onload"],H.default.Players);for(var W in H.default.AudioNode.call(this,V),this._volume=this.output=new H.default.Volume(V.volume),this.volume=this._volume.volume,this._readOnly("volume"),this._volume.output.output.channelCount=2,this._volume.output.output.channelCountMode="explicit",this.mute=V.mute,this._players={},this._loadingCount=0,this._fadeIn=V.fadeIn,this._fadeOut=V.fadeOut,z)this._loadingCount++,this.add(W,z[W],this._bufferLoaded.bind(this,V.onload))},H.default.extend(H.default.Players,H.default.AudioNode),H.default.Players.defaults={volume:0,mute:!1,onload:H.default.noOp,fadeIn:0,fadeOut:0},H.default.Players.prototype._bufferLoaded=function(z){this._loadingCount--,0===this._loadingCount&&z&&z(this)},Object.defineProperty(H.default.Players.prototype,"mute",{get:function(){return this._volume.mute},set:function(z){this._volume.mute=z}}),Object.defineProperty(H.default.Players.prototype,"fadeIn",{get:function(){return this._fadeIn},set:function(z){this._fadeIn=z,this._forEach((function(G){G.fadeIn=z}))}}),Object.defineProperty(H.default.Players.prototype,"fadeOut",{get:function(){return this._fadeOut},set:function(z){this._fadeOut=z,this._forEach((function(G){G.fadeOut=z}))}}),Object.defineProperty(H.default.Players.prototype,"state",{get:function(){var z=!1;return this._forEach((function(G){z=z||G.state===H.default.State.Started})),z?H.default.State.Started:H.default.State.Stopped}}),H.default.Players.prototype.has=function(z){return this._players.hasOwnProperty(z)},H.default.Players.prototype.get=function(z){if(this.has(z))return this._players[z];throw new Error("Tone.Players: no player named "+z)},H.default.Players.prototype._forEach=function(z){for(var G in this._players)z(this._players[G],G);return this},Object.defineProperty(H.default.Players.prototype,"loaded",{get:function(){var z=!0;return this._forEach((function(G){z=z&&G.loaded})),z}}),H.default.Players.prototype.add=function(z,G,V){return this._players[z]=new H.default.Player(G,V).connect(this.output),this._players[z].fadeIn=this._fadeIn,this._players[z].fadeOut=this._fadeOut,this},H.default.Players.prototype.stopAll=function(z){this._forEach((function(G){G.stop(z)}))},H.default.Players.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._volume.dispose(),this._volume=null,this._writable("volume"),this.volume=null,this.output=null,this._forEach((function(z){z.dispose()})),this._players=null,this},G.default=H.default.Players},function(z,G,V){V.r(G);var H=V(0);V(6),V(11),V(32),H.default.GrainPlayer=function(){var z=H.default.defaults(arguments,["url","onload"],H.default.GrainPlayer);H.default.Source.call(this,z),this.buffer=new H.default.Buffer(z.url,z.onload.bind(void 0,this)),this._clock=new H.default.Clock(this._tick.bind(this),z.grainSize),this._loopStart=0,this._loopEnd=0,this._activeSources=[],this._playbackRate=z.playbackRate,this._grainSize=z.grainSize,this._overlap=z.overlap,this.detune=z.detune,this.overlap=z.overlap,this.loop=z.loop,this.playbackRate=z.playbackRate,this.grainSize=z.grainSize,this.loopStart=z.loopStart,this.loopEnd=z.loopEnd,this.reverse=z.reverse,this._clock.on("stop",this._onstop.bind(this))},H.default.extend(H.default.GrainPlayer,H.default.Source),H.default.GrainPlayer.defaults={onload:H.default.noOp,overlap:.1,grainSize:.2,playbackRate:1,detune:0,loop:!1,loopStart:0,loopEnd:0,reverse:!1},H.default.GrainPlayer.prototype._start=function(z,G,V){G=H.default.defaultArg(G,0),G=this.toSeconds(G),z=this.toSeconds(z),this._offset=G,this._clock.start(z),V&&this.stop(z+this.toSeconds(V))},H.default.GrainPlayer.prototype._stop=function(z){this._clock.stop(z)},H.default.GrainPlayer.prototype._onstop=function(z){this._activeSources.forEach((function(G){G.fadeOut=0,G.stop(z)}))},H.default.GrainPlayer.prototype._tick=function(z){if(!this.loop&&this._offset>this.buffer.duration)this.stop(z);else{var G=this._offset<this._overlap?0:this._overlap,V=new H.default.BufferSource({buffer:this.buffer,fadeIn:G,fadeOut:this._overlap,loop:this.loop,loopStart:this._loopStart,loopEnd:this._loopEnd,playbackRate:H.default.intervalToFrequencyRatio(this.detune/100)}).connect(this.output);V.start(z,this._offset),this._offset+=this.grainSize,V.stop(z+this.grainSize/this.playbackRate),this._activeSources.push(V),V.onended=function(){var z=this._activeSources.indexOf(V);-1!==z&&this._activeSources.splice(z,1)}.bind(this)}},Object.defineProperty(H.default.GrainPlayer.prototype,"playbackRate",{get:function(){return this._playbackRate},set:function(z){this._playbackRate=z,this.grainSize=this._grainSize}}),Object.defineProperty(H.default.GrainPlayer.prototype,"loopStart",{get:function(){return this._loopStart},set:function(z){this._loopStart=this.toSeconds(z)}}),Object.defineProperty(H.default.GrainPlayer.prototype,"loopEnd",{get:function(){return this._loopEnd},set:function(z){this._loopEnd=this.toSeconds(z)}}),Object.defineProperty(H.default.GrainPlayer.prototype,"reverse",{get:function(){return this.buffer.reverse},set:function(z){this.buffer.reverse=z}}),Object.defineProperty(H.default.GrainPlayer.prototype,"grainSize",{get:function(){return this._grainSize},set:function(z){this._grainSize=this.toSeconds(z),this._clock.frequency.value=this._playbackRate/this._grainSize}}),Object.defineProperty(H.default.GrainPlayer.prototype,"overlap",{get:function(){return this._overlap},set:function(z){this._overlap=this.toSeconds(z)}}),Object.defineProperty(H.default.GrainPlayer.prototype,"loaded",{get:function(){return this.buffer.loaded}}),H.default.GrainPlayer.prototype.dispose=function(){return H.default.Source.prototype.dispose.call(this),this.buffer.dispose(),this.buffer=null,this._clock.dispose(),this._clock=null,this._activeSources.forEach((function(z){z.dispose()})),this._activeSources=null,this},G.default=H.default.GrainPlayer},function(z,G,V){V.r(G);var H=V(0);V(16),V(2),V(45),H.default.TransportTimelineSignal=function(){H.default.Signal.apply(this,arguments),this.output=this._outputSig=new H.default.Signal(this._initialValue),this._lastVal=this.value,this._synced=H.default.Transport.scheduleRepeat(this._onTick.bind(this),"1i"),this._bindAnchorValue=this._anchorValue.bind(this),H.default.Transport.on("start stop pause",this._bindAnchorValue),this._events.memory=1/0},H.default.extend(H.default.TransportTimelineSignal,H.default.Signal),H.default.TransportTimelineSignal.prototype._onTick=function(z){var G=this.getValueAtTime(H.default.Transport.seconds);this._lastVal!==G&&(this._lastVal=G,this._outputSig.linearRampToValueAtTime(G,z))},H.default.TransportTimelineSignal.prototype._anchorValue=function(z){var G=this.getValueAtTime(H.default.Transport.seconds);return this._lastVal=G,this._outputSig.cancelScheduledValues(z),this._outputSig.setValueAtTime(G,z),this},H.default.TransportTimelineSignal.prototype.getValueAtTime=function(z){return z=H.default.TransportTime(z),H.default.Signal.prototype.getValueAtTime.call(this,z)},H.default.TransportTimelineSignal.prototype.setValueAtTime=function(z,G){return G=H.default.TransportTime(G),H.default.Signal.prototype.setValueAtTime.call(this,z,G),this},H.default.TransportTimelineSignal.prototype.linearRampToValueAtTime=function(z,G){return G=H.default.TransportTime(G),H.default.Signal.prototype.linearRampToValueAtTime.call(this,z,G),this},H.default.TransportTimelineSignal.prototype.exponentialRampToValueAtTime=function(z,G){return G=H.default.TransportTime(G),H.default.Signal.prototype.exponentialRampToValueAtTime.call(this,z,G),this},H.default.TransportTimelineSignal.prototype.setTargetAtTime=function(z,G,V){return G=H.default.TransportTime(G),H.default.Signal.prototype.setTargetAtTime.call(this,z,G,V),this},H.default.TransportTimelineSignal.prototype.cancelScheduledValues=function(z){return z=H.default.TransportTime(z),H.default.Signal.prototype.cancelScheduledValues.call(this,z),this},H.default.TransportTimelineSignal.prototype.setValueCurveAtTime=function(z,G,V,W){return G=H.default.TransportTime(G),V=H.default.TransportTime(V),H.default.Signal.prototype.setValueCurveAtTime.call(this,z,G,V,W),this},H.default.TransportTimelineSignal.prototype.cancelAndHoldAtTime=function(z){return H.default.Signal.prototype.cancelAndHoldAtTime.call(this,H.default.TransportTime(z))},H.default.TransportTimelineSignal.prototype.dispose=function(){H.default.Transport.clear(this._synced),H.default.Transport.off("start stop pause",this._syncedCallback),this._events.cancel(0),H.default.Signal.prototype.dispose.call(this),this._outputSig.dispose(),this._outputSig=null},G.default=H.default.TransportTimelineSignal},function(z,G,V){V.r(G);var H=V(0);V(29),V(5),H.default.Normalize=function(z,G){H.default.SignalBase.call(this),this._inputMin=H.default.defaultArg(z,0),this._inputMax=H.default.defaultArg(G,1),this._sub=this.input=new H.default.Add(0),this._div=this.output=new H.default.Multiply(1),this._sub.connect(this._div),this._setRange()},H.default.extend(H.default.Normalize,H.default.SignalBase),Object.defineProperty(H.default.Normalize.prototype,"min",{get:function(){return this._inputMin},set:function(z){this._inputMin=z,this._setRange()}}),Object.defineProperty(H.default.Normalize.prototype,"max",{get:function(){return this._inputMax},set:function(z){this._inputMax=z,this._setRange()}}),H.default.Normalize.prototype._setRange=function(){this._sub.value=-this._inputMin,this._div.value=1/(this._inputMax-this._inputMin)},H.default.Normalize.prototype.dispose=function(){return H.default.SignalBase.prototype.dispose.call(this),this._sub.dispose(),this._sub=null,this._div.dispose(),this._div=null,this},G.default=H.default.Normalize},function(z,G,V){V.r(G);var H=V(0);V(7),V(2),H.default.GainToAudio=function(){H.default.SignalBase.call(this),this._norm=this.input=this.output=new H.default.WaveShaper((function(z){return 2*Math.abs(z)-1}))},H.default.extend(H.default.GainToAudio,H.default.SignalBase),H.default.GainToAudio.prototype.dispose=function(){return H.default.SignalBase.prototype.dispose.call(this),this._norm.dispose(),this._norm=null,this},G.default=H.default.GainToAudio},function(z,G,V){V.r(G);var H=V(0);V(21),V(78),V(32),H.default.Sampler=function(z){var G=Array.prototype.slice.call(arguments);G.shift();var V=H.default.defaults(G,["onload","baseUrl"],H.default.Sampler);H.default.Instrument.call(this,V);var W={};for(var K in z)if(H.default.isNote(K))W[H.default.Frequency(K).toMidi()]=z[K];else{if(isNaN(parseFloat(K)))throw new Error("Tone.Sampler: url keys must be the note's pitch");W[K]=z[K]}this._buffers=new H.default.Buffers(W,V.onload,V.baseUrl),this._activeSources={},this.attack=V.attack,this.release=V.release,this.curve=V.curve},H.default.extend(H.default.Sampler,H.default.Instrument),H.default.Sampler.defaults={attack:0,release:.1,onload:H.default.noOp,baseUrl:"",curve:"exponential"},H.default.Sampler.prototype._findClosest=function(z){for(var G=0;G<96;){if(this._buffers.has(z+G))return-G;if(this._buffers.has(z-G))return G;G++}throw new Error("No available buffers for note: "+z)},H.default.Sampler.prototype.triggerAttack=function(z,G,V){this.log("triggerAttack",z,G,V),Array.isArray(z)||(z=[z]);for(var W=0;W<z.length;W++){var K=H.default.Frequency(z[W]).toMidi(),Z=this._findClosest(K),it=K-Z,ot=this._buffers.get(it),rt=H.default.intervalToFrequencyRatio(Z),at=new H.default.BufferSource({buffer:ot,playbackRate:rt,fadeIn:this.attack,fadeOut:this.release,curve:this.curve}).connect(this.output);at.start(G,0,ot.duration/rt,V),H.default.isArray(this._activeSources[K])||(this._activeSources[K]=[]),this._activeSources[K].push(at),at.onended=function(){if(this._activeSources&&this._activeSources[K]){var z=this._activeSources[K].indexOf(at);-1!==z&&this._activeSources[K].splice(z,1)}}.bind(this)}return this},H.default.Sampler.prototype.triggerRelease=function(z,G){this.log("triggerRelease",z,G),Array.isArray(z)||(z=[z]);for(var V=0;V<z.length;V++){var W=H.default.Frequency(z[V]).toMidi();this._activeSources[W]&&this._activeSources[W].length&&(G=this.toSeconds(G),this._activeSources[W].forEach((function(z){z.stop(G)})),this._activeSources[W]=[])}return this},H.default.Sampler.prototype.releaseAll=function(z){for(var G in z=this.toSeconds(z),this._activeSources)for(var V=this._activeSources[G];V.length;)V.shift().stop(z);return this},H.default.Sampler.prototype.sync=function(){return this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1),this},H.default.Sampler.prototype.triggerAttackRelease=function(z,G,V,W){if(V=this.toSeconds(V),this.triggerAttack(z,V,W),H.default.isArray(G)&&H.default.isArray(z))for(var K=0;K<z.length;K++){var Z=G[Math.min(K,G.length-1)];this.triggerRelease(z[K],V+this.toSeconds(Z))}else this.triggerRelease(z,V+this.toSeconds(G));return this},H.default.Sampler.prototype.add=function(z,G,V){if(H.default.isNote(z)){var W=H.default.Frequency(z).toMidi();this._buffers.add(W,G,V)}else{if(isNaN(parseFloat(z)))throw new Error("Tone.Sampler: note must be the note's pitch. Instead got "+z);this._buffers.add(z,G,V)}},Object.defineProperty(H.default.Sampler.prototype,"loaded",{get:function(){return this._buffers.loaded}}),H.default.Sampler.prototype.dispose=function(){for(var z in H.default.Instrument.prototype.dispose.call(this),this._buffers.dispose(),this._buffers=null,this._activeSources)this._activeSources[z].forEach((function(z){z.dispose()}));return this._activeSources=null,this},G.default=H.default.Sampler},function(z,G,V){V.r(G);var H=V(0);V(38),V(6),H.default.PolySynth=function(){var z=H.default.defaults(arguments,["polyphony","voice"],H.default.PolySynth);H.default.Instrument.call(this,z),(z=H.default.defaultArg(z,H.default.Instrument.defaults)).polyphony=Math.min(H.default.PolySynth.MAX_POLYPHONY,z.polyphony),this.voices=new Array(z.polyphony),this.assert(z.polyphony>0,"polyphony must be greater than 0"),this.detune=new H.default.Signal(z.detune,H.default.Type.Cents),this._readOnly("detune");for(var G=0;G<z.polyphony;G++){var V=new z.voice(arguments[2],arguments[3]);if(!(V instanceof H.default.Monophonic))throw new Error("Synth constructor must be instance of Tone.Monophonic");this.voices[G]=V,V.index=G,V.connect(this.output),V.hasOwnProperty("detune")&&this.detune.connect(V.detune)}},H.default.extend(H.default.PolySynth,H.default.Instrument),H.default.PolySynth.defaults={polyphony:4,volume:0,detune:0,voice:H.default.Synth},H.default.PolySynth.prototype._getClosestVoice=function(z,G){return this.voices.find((function(V){if(Math.abs(V.frequency.getValueAtTime(z)-H.default.Frequency(G))<1e-4&&V.getLevelAtTime(z)>1e-5)return V}))||this.voices.slice().sort(function(G,V){var H=G.getLevelAtTime(z+this.blockTime),W=V.getLevelAtTime(z+this.blockTime);return H<1e-5&&(H=0),W<1e-5&&(W=0),H-W}.bind(this))[0]},H.default.PolySynth.prototype.triggerAttack=function(z,G,V){return Array.isArray(z)||(z=[z]),G=this.toSeconds(G),z.forEach(function(z){var H=this._getClosestVoice(G,z);H.triggerAttack(z,G,V),this.log("triggerAttack",H.index,z)}.bind(this)),this},H.default.PolySynth.prototype.triggerRelease=function(z,G){return Array.isArray(z)||(z=[z]),G=this.toSeconds(G),z.forEach(function(z){var V=this._getClosestVoice(G,z);this.log("triggerRelease",V.index,z),V.triggerRelease(G)}.bind(this)),this},H.default.PolySynth.prototype.triggerAttackRelease=function(z,G,V,W){if(V=this.toSeconds(V),this.triggerAttack(z,V,W),H.default.isArray(G)&&H.default.isArray(z))for(var K=0;K<z.length;K++){var Z=G[Math.min(K,G.length-1)];this.triggerRelease(z[K],V+this.toSeconds(Z))}else this.triggerRelease(z,V+this.toSeconds(G));return this},H.default.PolySynth.prototype.sync=function(){return this._syncMethod("triggerAttack",1),this._syncMethod("triggerRelease",1),this},H.default.PolySynth.prototype.set=function(z,G,V){for(var H=0;H<this.voices.length;H++)this.voices[H].set(z,G,V);return this},H.default.PolySynth.prototype.get=function(z){return this.voices[0].get(z)},H.default.PolySynth.prototype.releaseAll=function(z){return z=this.toSeconds(z),this.voices.forEach((function(G){G.triggerRelease(z)})),this},H.default.PolySynth.prototype.dispose=function(){return H.default.Instrument.prototype.dispose.call(this),this.voices.forEach((function(z){z.dispose()})),this._writable("detune"),this.detune.dispose(),this.detune=null,this.voices=null,this},H.default.PolySynth.MAX_POLYPHONY=20,G.default=H.default.PolySynth},function(z,G,V){V.r(G);var H=V(0);V(21),V(39),V(54),H.default.PluckSynth=function(z){z=H.default.defaultArg(z,H.default.PluckSynth.defaults),H.default.Instrument.call(this,z),this._noise=new H.default.Noise("pink"),this.attackNoise=z.attackNoise,this._lfcf=new H.default.LowpassCombFilter({resonance:z.resonance,dampening:z.dampening}),this.resonance=this._lfcf.resonance,this.dampening=this._lfcf.dampening,this._noise.connect(this._lfcf),this._lfcf.connect(this.output),this._readOnly(["resonance","dampening"])},H.default.extend(H.default.PluckSynth,H.default.Instrument),H.default.PluckSynth.defaults={attackNoise:1,dampening:4e3,resonance:.7},H.default.PluckSynth.prototype.triggerAttack=function(z,G){z=this.toFrequency(z),G=this.toSeconds(G);var V=1/z;return this._lfcf.delayTime.setValueAtTime(V,G),this._noise.start(G),this._noise.stop(G+V*this.attackNoise),this},H.default.PluckSynth.prototype.dispose=function(){return H.default.Instrument.prototype.dispose.call(this),this._noise.dispose(),this._lfcf.dispose(),this._noise=null,this._lfcf=null,this._writable(["resonance","dampening"]),this.dampening=null,this.resonance=null,this},G.default=H.default.PluckSynth},function(z,G,V){V.r(G);var H=V(0);V(31),V(41),V(39),V(2),V(9),V(21),H.default.NoiseSynth=function(z){z=H.default.defaultArg(z,H.default.NoiseSynth.defaults),H.default.Instrument.call(this,z),this.noise=new H.default.Noise(z.noise),this.envelope=new H.default.AmplitudeEnvelope(z.envelope),this.noise.chain(this.envelope,this.output),this._readOnly(["noise","envelope"])},H.default.extend(H.default.NoiseSynth,H.default.Instrument),H.default.NoiseSynth.defaults={noise:{type:"white"},envelope:{attack:.005,decay:.1,sustain:0}},H.default.NoiseSynth.prototype.triggerAttack=function(z,G){return z=this.toSeconds(z),this.envelope.triggerAttack(z,G),this.noise.start(z),0===this.envelope.sustain&&this.noise.stop(z+this.envelope.attack+this.envelope.decay),this},H.default.NoiseSynth.prototype.triggerRelease=function(z){return z=this.toSeconds(z),this.envelope.triggerRelease(z),this.noise.stop(z+this.envelope.release),this},H.default.NoiseSynth.prototype.sync=function(){return this._syncMethod("triggerAttack",0),this._syncMethod("triggerRelease",0),this},H.default.NoiseSynth.prototype.triggerAttackRelease=function(z,G,V){return G=this.toSeconds(G),z=this.toSeconds(z),this.triggerAttack(G,V),this.triggerRelease(G+z),this},H.default.NoiseSynth.prototype.dispose=function(){return H.default.Instrument.prototype.dispose.call(this),this._writable(["noise","envelope"]),this.noise.dispose(),this.noise=null,this.envelope.dispose(),this.envelope=null,this},G.default=H.default.NoiseSynth},function(z,G,V){V.r(G);var H=V(0),W=(V(21),V(49),V(9),V(41),V(31),V(3),V(26),V(5),[1,1.483,1.932,2.546,2.63,3.897]);H.default.MetalSynth=function(z){z=H.default.defaultArg(z,H.default.MetalSynth.defaults),H.default.Instrument.call(this,z),this.frequency=new H.default.Signal(z.frequency,H.default.Type.Frequency),this._oscillators=[],this._freqMultipliers=[],this._amplitue=new H.default.Gain(0).connect(this.output),this._highpass=new H.default.Filter({type:"highpass",Q:-3.0102999566398125}).connect(this._amplitue),this._octaves=z.octaves,this._filterFreqScaler=new H.default.Scale(z.resonance,7e3),this.envelope=new H.default.Envelope({attack:z.envelope.attack,attackCurve:"linear",decay:z.envelope.decay,sustain:0,release:z.envelope.release}).chain(this._filterFreqScaler,this._highpass.frequency),this.envelope.connect(this._amplitue.gain);for(var G=0;G<W.length;G++){var V=new H.default.FMOscillator({type:"square",modulationType:"square",harmonicity:z.harmonicity,modulationIndex:z.modulationIndex});V.connect(this._highpass),this._oscillators[G]=V;var K=new H.default.Multiply(W[G]);this._freqMultipliers[G]=K,this.frequency.chain(K,V.frequency)}this.octaves=z.octaves},H.default.extend(H.default.MetalSynth,H.default.Instrument),H.default.MetalSynth.defaults={frequency:200,envelope:{attack:.001,decay:1.4,release:.2},harmonicity:5.1,modulationIndex:32,resonance:4e3,octaves:1.5},H.default.MetalSynth.prototype.triggerAttack=function(z,G){return z=this.toSeconds(z),G=H.default.defaultArg(G,1),this.envelope.triggerAttack(z,G),this._oscillators.forEach((function(G){G.start(z)})),0===this.envelope.sustain&&this._oscillators.forEach(function(G){G.stop(z+this.envelope.attack+this.envelope.decay)}.bind(this)),this},H.default.MetalSynth.prototype.triggerRelease=function(z){return z=this.toSeconds(z),this.envelope.triggerRelease(z),this._oscillators.forEach(function(G){G.stop(z+this.envelope.release)}.bind(this)),this},H.default.MetalSynth.prototype.sync=function(){return this._syncMethod("triggerAttack",0),this._syncMethod("triggerRelease",0),this},H.default.MetalSynth.prototype.triggerAttackRelease=function(z,G,V){return G=this.toSeconds(G),z=this.toSeconds(z),this.triggerAttack(G,V),this.triggerRelease(G+z),this},Object.defineProperty(H.default.MetalSynth.prototype,"modulationIndex",{get:function(){return this._oscillators[0].modulationIndex.value},set:function(z){for(var G=0;G<this._oscillators.length;G++)this._oscillators[G].modulationIndex.value=z}}),Object.defineProperty(H.default.MetalSynth.prototype,"harmonicity",{get:function(){return this._oscillators[0].harmonicity.value},set:function(z){for(var G=0;G<this._oscillators.length;G++)this._oscillators[G].harmonicity.value=z}}),Object.defineProperty(H.default.MetalSynth.prototype,"resonance",{get:function(){return this._filterFreqScaler.min},set:function(z){this._filterFreqScaler.min=z,this.octaves=this._octaves}}),Object.defineProperty(H.default.MetalSynth.prototype,"octaves",{get:function(){return this._octaves},set:function(z){this._octaves=z,this._filterFreqScaler.max=this._filterFreqScaler.min*Math.pow(2,z)}}),H.default.MetalSynth.prototype.dispose=function(){H.default.Instrument.prototype.dispose.call(this);for(var z=0;z<this._oscillators.length;z++)this._oscillators[z].dispose(),this._freqMultipliers[z].dispose();this._oscillators=null,this._freqMultipliers=null,this.frequency.dispose(),this.frequency=null,this._filterFreqScaler.dispose(),this._filterFreqScaler=null,this._amplitue.dispose(),this._amplitue=null,this.envelope.dispose(),this.envelope=null,this._highpass.dispose(),this._highpass=null},G.default=H.default.MetalSynth},function(z,G,V){V.r(G);var H=V(0);V(37),V(21),V(31),H.default.MembraneSynth=function(z){z=H.default.defaultArg(z,H.default.MembraneSynth.defaults),H.default.Instrument.call(this,z),this.oscillator=new H.default.OmniOscillator(z.oscillator),this.envelope=new H.default.AmplitudeEnvelope(z.envelope),this.octaves=z.octaves,this.pitchDecay=z.pitchDecay,this.oscillator.chain(this.envelope,this.output),this._readOnly(["oscillator","envelope"])},H.default.extend(H.default.MembraneSynth,H.default.Instrument),H.default.MembraneSynth.defaults={pitchDecay:.05,octaves:10,oscillator:{type:"sine"},envelope:{attack:.001,decay:.4,sustain:.01,release:1.4,attackCurve:"exponential"}},H.default.MembraneSynth.prototype.triggerAttack=function(z,G,V){G=this.toSeconds(G);var H=(z=this.toFrequency(z))*this.octaves;return this.oscillator.frequency.setValueAtTime(H,G),this.oscillator.frequency.exponentialRampToValueAtTime(z,G+this.toSeconds(this.pitchDecay)),this.envelope.triggerAttack(G,V),this.oscillator.start(G),0===this.envelope.sustain&&this.oscillator.stop(G+this.envelope.attack+this.envelope.decay),this},H.default.MembraneSynth.prototype.triggerRelease=function(z){return z=this.toSeconds(z),this.envelope.triggerRelease(z),this.oscillator.stop(z+this.envelope.release),this},H.default.MembraneSynth.prototype.dispose=function(){return H.default.Instrument.prototype.dispose.call(this),this._writable(["oscillator","envelope"]),this.oscillator.dispose(),this.oscillator=null,this.envelope.dispose(),this.envelope=null,this},G.default=H.default.MembraneSynth},function(z,G,V){V.r(G);var H=V(0);V(38),V(2),V(5),V(25),H.default.FMSynth=function(z){z=H.default.defaultArg(z,H.default.FMSynth.defaults),H.default.Monophonic.call(this,z),this._carrier=new H.default.Synth(z.carrier),this._carrier.volume.value=-10,this.oscillator=this._carrier.oscillator,this.envelope=this._carrier.envelope.set(z.envelope),this._modulator=new H.default.Synth(z.modulator),this._modulator.volume.value=-10,this.modulation=this._modulator.oscillator.set(z.modulation),this.modulationEnvelope=this._modulator.envelope.set(z.modulationEnvelope),this.frequency=new H.default.Signal(440,H.default.Type.Frequency),this.detune=new H.default.Signal(z.detune,H.default.Type.Cents),this.harmonicity=new H.default.Multiply(z.harmonicity),this.harmonicity.units=H.default.Type.Positive,this.modulationIndex=new H.default.Multiply(z.modulationIndex),this.modulationIndex.units=H.default.Type.Positive,this._modulationNode=new H.default.Gain(0),this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.frequency.chain(this.modulationIndex,this._modulationNode),this.detune.fan(this._carrier.detune,this._modulator.detune),this._modulator.connect(this._modulationNode.gain),this._modulationNode.connect(this._carrier.frequency),this._carrier.connect(this.output),this._readOnly(["frequency","harmonicity","modulationIndex","oscillator","envelope","modulation","modulationEnvelope","detune"])},H.default.extend(H.default.FMSynth,H.default.Monophonic),H.default.FMSynth.defaults={harmonicity:3,modulationIndex:10,detune:0,oscillator:{type:"sine"},envelope:{attack:.01,decay:.01,sustain:1,release:.5},modulation:{type:"square"},modulationEnvelope:{attack:.5,decay:0,sustain:1,release:.5}},H.default.FMSynth.prototype._triggerEnvelopeAttack=function(z,G){return z=this.toSeconds(z),this._carrier._triggerEnvelopeAttack(z,G),this._modulator._triggerEnvelopeAttack(z),this},H.default.FMSynth.prototype._triggerEnvelopeRelease=function(z){return z=this.toSeconds(z),this._carrier._triggerEnvelopeRelease(z),this._modulator._triggerEnvelopeRelease(z),this},H.default.FMSynth.prototype.dispose=function(){return H.default.Monophonic.prototype.dispose.call(this),this._writable(["frequency","harmonicity","modulationIndex","oscillator","envelope","modulation","modulationEnvelope","detune"]),this._carrier.dispose(),this._carrier=null,this._modulator.dispose(),this._modulator=null,this.frequency.dispose(),this.frequency=null,this.detune.dispose(),this.detune=null,this.modulationIndex.dispose(),this.modulationIndex=null,this.harmonicity.dispose(),this.harmonicity=null,this._modulationNode.dispose(),this._modulationNode=null,this.oscillator=null,this.envelope=null,this.modulationEnvelope=null,this.modulation=null,this},G.default=H.default.FMSynth},function(z,G,V){V.r(G);var H=V(0);V(66),V(12),V(2),V(5),V(25),V(14),H.default.DuoSynth=function(z){z=H.default.defaultArg(z,H.default.DuoSynth.defaults),H.default.Monophonic.call(this,z),this.voice0=new H.default.MonoSynth(z.voice0),this.voice0.volume.value=-10,this.voice1=new H.default.MonoSynth(z.voice1),this.voice1.volume.value=-10,this._vibrato=new H.default.LFO(z.vibratoRate,-50,50),this._vibrato.start(),this.vibratoRate=this._vibrato.frequency,this._vibratoGain=new H.default.Gain(z.vibratoAmount,H.default.Type.Positive),this.vibratoAmount=this._vibratoGain.gain,this.frequency=new H.default.Signal(440,H.default.Type.Frequency),this.harmonicity=new H.default.Multiply(z.harmonicity),this.harmonicity.units=H.default.Type.Positive,this.frequency.connect(this.voice0.frequency),this.frequency.chain(this.harmonicity,this.voice1.frequency),this._vibrato.connect(this._vibratoGain),this._vibratoGain.fan(this.voice0.detune,this.voice1.detune),this.voice0.connect(this.output),this.voice1.connect(this.output),this._readOnly(["voice0","voice1","frequency","vibratoAmount","vibratoRate"])},H.default.extend(H.default.DuoSynth,H.default.Monophonic),H.default.DuoSynth.defaults={vibratoAmount:.5,vibratoRate:5,harmonicity:1.5,voice0:{volume:-10,portamento:0,oscillator:{type:"sine"},filterEnvelope:{attack:.01,decay:0,sustain:1,release:.5},envelope:{attack:.01,decay:0,sustain:1,release:.5}},voice1:{volume:-10,portamento:0,oscillator:{type:"sine"},filterEnvelope:{attack:.01,decay:0,sustain:1,release:.5},envelope:{attack:.01,decay:0,sustain:1,release:.5}}},H.default.DuoSynth.prototype._triggerEnvelopeAttack=function(z,G){return z=this.toSeconds(z),this.voice0._triggerEnvelopeAttack(z,G),this.voice1._triggerEnvelopeAttack(z,G),this},H.default.DuoSynth.prototype._triggerEnvelopeRelease=function(z){return this.voice0._triggerEnvelopeRelease(z),this.voice1._triggerEnvelopeRelease(z),this},H.default.DuoSynth.prototype.getLevelAtTime=function(z){return(this.voice0.getLevelAtTime(z)+this.voice1.getLevelAtTime(z))/2},H.default.DuoSynth.prototype.dispose=function(){return H.default.Monophonic.prototype.dispose.call(this),this._writable(["voice0","voice1","frequency","vibratoAmount","vibratoRate"]),this.voice0.dispose(),this.voice0=null,this.voice1.dispose(),this.voice1=null,this.frequency.dispose(),this.frequency=null,this._vibratoGain.dispose(),this._vibratoGain=null,this._vibrato=null,this.harmonicity.dispose(),this.harmonicity=null,this.vibratoAmount.dispose(),this.vibratoAmount=null,this.vibratoRate=null,this},G.default=H.default.DuoSynth},function(z,G,V){V.r(G);var H=V(0);V(38),V(2),V(5),V(25),V(22),V(3),H.default.AMSynth=function(z){z=H.default.defaultArg(z,H.default.AMSynth.defaults),H.default.Monophonic.call(this,z),this._carrier=new H.default.Synth,this._carrier.volume.value=-10,this.oscillator=this._carrier.oscillator.set(z.oscillator),this.envelope=this._carrier.envelope.set(z.envelope),this._modulator=new H.default.Synth,this._modulator.volume.value=-10,this.modulation=this._modulator.oscillator.set(z.modulation),this.modulationEnvelope=this._modulator.envelope.set(z.modulationEnvelope),this.frequency=new H.default.Signal(440,H.default.Type.Frequency),this.detune=new H.default.Signal(z.detune,H.default.Type.Cents),this.harmonicity=new H.default.Multiply(z.harmonicity),this.harmonicity.units=H.default.Type.Positive,this._modulationScale=new H.default.AudioToGain,this._modulationNode=new H.default.Gain,this.frequency.connect(this._carrier.frequency),this.frequency.chain(this.harmonicity,this._modulator.frequency),this.detune.fan(this._carrier.detune,this._modulator.detune),this._modulator.chain(this._modulationScale,this._modulationNode.gain),this._carrier.chain(this._modulationNode,this.output),this._readOnly(["frequency","harmonicity","oscillator","envelope","modulation","modulationEnvelope","detune"])},H.default.extend(H.default.AMSynth,H.default.Monophonic),H.default.AMSynth.defaults={harmonicity:3,detune:0,oscillator:{type:"sine"},envelope:{attack:.01,decay:.01,sustain:1,release:.5},modulation:{type:"square"},modulationEnvelope:{attack:.5,decay:0,sustain:1,release:.5}},H.default.AMSynth.prototype._triggerEnvelopeAttack=function(z,G){return z=this.toSeconds(z),this._carrier._triggerEnvelopeAttack(z,G),this._modulator._triggerEnvelopeAttack(z),this},H.default.AMSynth.prototype._triggerEnvelopeRelease=function(z){return this._carrier._triggerEnvelopeRelease(z),this._modulator._triggerEnvelopeRelease(z),this},H.default.AMSynth.prototype.dispose=function(){return H.default.Monophonic.prototype.dispose.call(this),this._writable(["frequency","harmonicity","oscillator","envelope","modulation","modulationEnvelope","detune"]),this._carrier.dispose(),this._carrier=null,this._modulator.dispose(),this._modulator=null,this.frequency.dispose(),this.frequency=null,this.detune.dispose(),this.detune=null,this.harmonicity.dispose(),this.harmonicity=null,this._modulationScale.dispose(),this._modulationScale=null,this._modulationNode.dispose(),this._modulationNode=null,this.oscillator=null,this.envelope=null,this.modulationEnvelope=null,this.modulation=null,this},G.default=H.default.AMSynth},function(z,G,V){V.r(G);var H=V(0);V(70),V(16),H.default.Sequence=function(){var z=H.default.defaults(arguments,["callback","events","subdivision"],H.default.Sequence),G=z.events;if(delete z.events,H.default.Part.call(this,z),this._subdivision=this.toTicks(z.subdivision),H.default.isUndef(z.loopEnd)&&H.default.isDefined(G)&&(this._loopEnd=G.length*this._subdivision),this._loop=!0,H.default.isDefined(G))for(var V=0;V<G.length;V++)this.add(V,G[V])},H.default.extend(H.default.Sequence,H.default.Part),H.default.Sequence.defaults={subdivision:"4n"},Object.defineProperty(H.default.Sequence.prototype,"subdivision",{get:function(){return H.default.Ticks(this._subdivision).toSeconds()}}),H.default.Sequence.prototype.at=function(z,G){return H.default.isArray(G)&&this.remove(z),H.default.Part.prototype.at.call(this,this._indexTime(z),G)},H.default.Sequence.prototype.add=function(z,G){if(null===G)return this;if(H.default.isArray(G)){var V=Math.round(this._subdivision/G.length);G=new H.default.Sequence(this._tick.bind(this),G,H.default.Ticks(V))}return H.default.Part.prototype.add.call(this,this._indexTime(z),G),this},H.default.Sequence.prototype.remove=function(z,G){return H.default.Part.prototype.remove.call(this,this._indexTime(z),G),this},H.default.Sequence.prototype._indexTime=function(z){return z instanceof H.default.TransportTime?z:H.default.Ticks(z*this._subdivision+this.startOffset).toSeconds()},H.default.Sequence.prototype.dispose=function(){return H.default.Part.prototype.dispose.call(this),this},G.default=H.default.Sequence},function(z,G,V){V.r(G);var H=V(0);V(71),V(79),H.default.Pattern=function(){var z=H.default.defaults(arguments,["callback","values","pattern"],H.default.Pattern);H.default.Loop.call(this,z),this._pattern=new H.default.CtrlPattern({values:z.values,type:z.pattern,index:z.index})},H.default.extend(H.default.Pattern,H.default.Loop),H.default.Pattern.defaults={pattern:H.default.CtrlPattern.Type.Up,callback:H.default.noOp,values:[]},H.default.Pattern.prototype._tick=function(z){this.callback(z,this._pattern.value),this._pattern.next()},Object.defineProperty(H.default.Pattern.prototype,"index",{get:function(){return this._pattern.index},set:function(z){this._pattern.index=z}}),Object.defineProperty(H.default.Pattern.prototype,"values",{get:function(){return this._pattern.values},set:function(z){this._pattern.values=z}}),Object.defineProperty(H.default.Pattern.prototype,"value",{get:function(){return this._pattern.value}}),Object.defineProperty(H.default.Pattern.prototype,"pattern",{get:function(){return this._pattern.type},set:function(z){this._pattern.type=z}}),H.default.Pattern.prototype.dispose=function(){H.default.Loop.prototype.dispose.call(this),this._pattern.dispose(),this._pattern=null},G.default=H.default.Pattern},function(z,G,V){V.r(G);var H=V(0);V(8),V(18),V(12),H.default.Vibrato=function(){var z=H.default.defaults(arguments,["frequency","depth"],H.default.Vibrato);H.default.Effect.call(this,z),this._delayNode=new H.default.Delay(0,z.maxDelay),this._lfo=new H.default.LFO({type:z.type,min:0,max:z.maxDelay,frequency:z.frequency,phase:-90}).start().connect(this._delayNode.delayTime),this.frequency=this._lfo.frequency,this.depth=this._lfo.amplitude,this.depth.value=z.depth,this._readOnly(["frequency","depth"]),this.effectSend.chain(this._delayNode,this.effectReturn)},H.default.extend(H.default.Vibrato,H.default.Effect),H.default.Vibrato.defaults={maxDelay:.005,frequency:5,depth:.1,type:"sine"},Object.defineProperty(H.default.Vibrato.prototype,"type",{get:function(){return this._lfo.type},set:function(z){this._lfo.type=z}}),H.default.Vibrato.prototype.dispose=function(){H.default.Effect.prototype.dispose.call(this),this._delayNode.dispose(),this._delayNode=null,this._lfo.dispose(),this._lfo=null,this._writable(["frequency","depth"]),this.frequency=null,this.depth=null},G.default=H.default.Vibrato},function(z,G,V){V.r(G);var H=V(0);V(12),V(15),H.default.Tremolo=function(){var z=H.default.defaults(arguments,["frequency","depth"],H.default.Tremolo);H.default.StereoEffect.call(this,z),this._lfoL=new H.default.LFO({phase:z.spread,min:1,max:0}),this._lfoR=new H.default.LFO({phase:z.spread,min:1,max:0}),this._amplitudeL=new H.default.Gain,this._amplitudeR=new H.default.Gain,this.frequency=new H.default.Signal(z.frequency,H.default.Type.Frequency),this.depth=new H.default.Signal(z.depth,H.default.Type.NormalRange),this._readOnly(["frequency","depth"]),this.effectSendL.chain(this._amplitudeL,this.effectReturnL),this.effectSendR.chain(this._amplitudeR,this.effectReturnR),this._lfoL.connect(this._amplitudeL.gain),this._lfoR.connect(this._amplitudeR.gain),this.frequency.fan(this._lfoL.frequency,this._lfoR.frequency),this.depth.fan(this._lfoR.amplitude,this._lfoL.amplitude),this.type=z.type,this.spread=z.spread},H.default.extend(H.default.Tremolo,H.default.StereoEffect),H.default.Tremolo.defaults={frequency:10,type:"sine",depth:.5,spread:180},H.default.Tremolo.prototype.start=function(z){return this._lfoL.start(z),this._lfoR.start(z),this},H.default.Tremolo.prototype.stop=function(z){return this._lfoL.stop(z),this._lfoR.stop(z),this},H.default.Tremolo.prototype.sync=function(z){return this._lfoL.sync(z),this._lfoR.sync(z),H.default.Transport.syncSignal(this.frequency),this},H.default.Tremolo.prototype.unsync=function(){return this._lfoL.unsync(),this._lfoR.unsync(),H.default.Transport.unsyncSignal(this.frequency),this},Object.defineProperty(H.default.Tremolo.prototype,"type",{get:function(){return this._lfoL.type},set:function(z){this._lfoL.type=z,this._lfoR.type=z}}),Object.defineProperty(H.default.Tremolo.prototype,"spread",{get:function(){return this._lfoR.phase-this._lfoL.phase},set:function(z){this._lfoL.phase=90-z/2,this._lfoR.phase=z/2+90}}),H.default.Tremolo.prototype.dispose=function(){return H.default.StereoEffect.prototype.dispose.call(this),this._writable(["frequency","depth"]),this._lfoL.dispose(),this._lfoL=null,this._lfoR.dispose(),this._lfoR=null,this._amplitudeL.dispose(),this._amplitudeL=null,this._amplitudeR.dispose(),this._amplitudeR=null,this.frequency=null,this.depth=null,this},G.default=H.default.Tremolo},function(z,G,V){V.r(G);var H=V(0);V(73),V(2),V(5),V(13),H.default.StereoWidener=function(){var z=H.default.defaults(arguments,["width"],H.default.StereoWidener);H.default.MidSideEffect.call(this,z),this.width=new H.default.Signal(z.width,H.default.Type.NormalRange),this._readOnly(["width"]),this._twoTimesWidthMid=new H.default.Multiply(2),this._twoTimesWidthSide=new H.default.Multiply(2),this._midMult=new H.default.Multiply,this._twoTimesWidthMid.connect(this._midMult,0,1),this.midSend.chain(this._midMult,this.midReturn),this._oneMinusWidth=new H.default.Subtract,this._oneMinusWidth.connect(this._twoTimesWidthMid),H.default.connect(this.context.getConstant(1),this._oneMinusWidth,0,0),this.width.connect(this._oneMinusWidth,0,1),this._sideMult=new H.default.Multiply,this.width.connect(this._twoTimesWidthSide),this._twoTimesWidthSide.connect(this._sideMult,0,1),this.sideSend.chain(this._sideMult,this.sideReturn)},H.default.extend(H.default.StereoWidener,H.default.MidSideEffect),H.default.StereoWidener.defaults={width:.5},H.default.StereoWidener.prototype.dispose=function(){return H.default.MidSideEffect.prototype.dispose.call(this),this._writable(["width"]),this.width.dispose(),this.width=null,this._midMult.dispose(),this._midMult=null,this._sideMult.dispose(),this._sideMult=null,this._twoTimesWidthMid.dispose(),this._twoTimesWidthMid=null,this._twoTimesWidthSide.dispose(),this._twoTimesWidthSide=null,this._oneMinusWidth.dispose(),this._oneMinusWidth=null,this},G.default=H.default.StereoWidener},function(z,G,V){V.r(G);var H=V(0);V(15),V(33),V(3),H.default.StereoFeedbackEffect=function(){var z=H.default.defaults(arguments,["feedback"],H.default.FeedbackEffect);H.default.StereoEffect.call(this,z),this.feedback=new H.default.Signal(z.feedback,H.default.Type.NormalRange),this._feedbackL=new H.default.Gain,this._feedbackR=new H.default.Gain,this.effectReturnL.chain(this._feedbackL,this.effectSendL),this.effectReturnR.chain(this._feedbackR,this.effectSendR),this.feedback.fan(this._feedbackL.gain,this._feedbackR.gain),this._readOnly(["feedback"])},H.default.extend(H.default.StereoFeedbackEffect,H.default.StereoEffect),H.default.StereoFeedbackEffect.prototype.dispose=function(){return H.default.StereoEffect.prototype.dispose.call(this),this._writable(["feedback"]),this.feedback.dispose(),this.feedback=null,this._feedbackL.dispose(),this._feedbackL=null,this._feedbackR.dispose(),this._feedbackR=null,this},G.default=H.default.StereoFeedbackEffect},function(z,G,V){V.r(G);var H=V(0);V(77),V(9),V(10),V(39),V(3),V(74),H.default.Reverb=function(){var z=H.default.defaults(arguments,["decay"],H.default.Reverb);H.default.Effect.call(this,z),this._convolver=this.context.createConvolver(),this.decay=z.decay,this.preDelay=z.preDelay,this.connectEffect(this._convolver)},H.default.extend(H.default.Reverb,H.default.Effect),H.default.Reverb.defaults={decay:1.5,preDelay:.01},H.default.Reverb.prototype.generate=function(){return H.default.Offline(function(){var z=new H.default.Noise,G=new H.default.Noise,V=new H.default.Merge;z.connect(V.left),G.connect(V.right);var W=(new H.default.Gain).toMaster();V.connect(W),z.start(0),G.start(0),W.gain.setValueAtTime(0,0),W.gain.setValueAtTime(1,this.preDelay),W.gain.exponentialApproachValueAtTime(0,this.preDelay,this.decay+this.preDelay)}.bind(this),this.decay+this.preDelay).then(function(z){return this._convolver.buffer=z.get(),this}.bind(this))},H.default.Reverb.prototype.dispose=function(){return H.default.Effect.prototype.dispose.call(this),this._convolver.disconnect(),this._convolver=null,this},G.default=H.default.Reverb},function(z,G,V){V.r(G);var H=V(0);V(12),V(23),V(2),V(33),V(18),H.default.PitchShift=function(){var z=H.default.defaults(arguments,["pitch"],H.default.PitchShift);H.default.FeedbackEffect.call(this,z),this._frequency=new H.default.Signal(0),this._delayA=new H.default.Delay(0,1),this._lfoA=new H.default.LFO({min:0,max:.1,type:"sawtooth"}).connect(this._delayA.delayTime),this._delayB=new H.default.Delay(0,1),this._lfoB=new H.default.LFO({min:0,max:.1,type:"sawtooth",phase:180}).connect(this._delayB.delayTime),this._crossFade=new H.default.CrossFade,this._crossFadeLFO=new H.default.LFO({min:0,max:1,type:"triangle",phase:90}).connect(this._crossFade.fade),this._feedbackDelay=new H.default.Delay(z.delayTime),this.delayTime=this._feedbackDelay.delayTime,this._readOnly("delayTime"),this._pitch=z.pitch,this._windowSize=z.windowSize,this._delayA.connect(this._crossFade.a),this._delayB.connect(this._crossFade.b),this._frequency.fan(this._lfoA.frequency,this._lfoB.frequency,this._crossFadeLFO.frequency),this.effectSend.fan(this._delayA,this._delayB),this._crossFade.chain(this._feedbackDelay,this.effectReturn);var G=this.now();this._lfoA.start(G),this._lfoB.start(G),this._crossFadeLFO.start(G),this.windowSize=this._windowSize},H.default.extend(H.default.PitchShift,H.default.FeedbackEffect),H.default.PitchShift.defaults={pitch:0,windowSize:.1,delayTime:0,feedback:0},Object.defineProperty(H.default.PitchShift.prototype,"pitch",{get:function(){return this._pitch},set:function(z){this._pitch=z;var G=0;z<0?(this._lfoA.min=0,this._lfoA.max=this._windowSize,this._lfoB.min=0,this._lfoB.max=this._windowSize,G=H.default.intervalToFrequencyRatio(z-1)+1):(this._lfoA.min=this._windowSize,this._lfoA.max=0,this._lfoB.min=this._windowSize,this._lfoB.max=0,G=H.default.intervalToFrequencyRatio(z)-1),this._frequency.value=G*(1.2/this._windowSize)}}),Object.defineProperty(H.default.PitchShift.prototype,"windowSize",{get:function(){return this._windowSize},set:function(z){this._windowSize=this.toSeconds(z),this.pitch=this._pitch}}),H.default.PitchShift.prototype.dispose=function(){return H.default.FeedbackEffect.prototype.dispose.call(this),this._frequency.dispose(),this._frequency=null,this._delayA.disconnect(),this._delayA=null,this._delayB.disconnect(),this._delayB=null,this._lfoA.dispose(),this._lfoA=null,this._lfoB.dispose(),this._lfoB=null,this._crossFade.dispose(),this._crossFade=null,this._crossFadeLFO.dispose(),this._crossFadeLFO=null,this._writable("delayTime"),this._feedbackDelay.dispose(),this._feedbackDelay=null,this.delayTime=null,this},G.default=H.default.PitchShift},function(z,G,V){V.r(G);var H=V(0);V(72),V(2),V(18),H.default.PingPongDelay=function(){var z=H.default.defaults(arguments,["delayTime","feedback"],H.default.PingPongDelay);H.default.StereoXFeedbackEffect.call(this,z),this._leftDelay=new H.default.Delay(0,z.maxDelayTime),this._rightDelay=new H.default.Delay(0,z.maxDelayTime),this._rightPreDelay=new H.default.Delay(0,z.maxDelayTime),this.delayTime=new H.default.Signal(z.delayTime,H.default.Type.Time),this.effectSendL.chain(this._leftDelay,this.effectReturnL),this.effectSendR.chain(this._rightPreDelay,this._rightDelay,this.effectReturnR),this.delayTime.fan(this._leftDelay.delayTime,this._rightDelay.delayTime,this._rightPreDelay.delayTime),this._feedbackLR.disconnect(),this._feedbackLR.connect(this._rightDelay),this._readOnly(["delayTime"])},H.default.extend(H.default.PingPongDelay,H.default.StereoXFeedbackEffect),H.default.PingPongDelay.defaults={delayTime:.25,maxDelayTime:1},H.default.PingPongDelay.prototype.dispose=function(){return H.default.StereoXFeedbackEffect.prototype.dispose.call(this),this._leftDelay.dispose(),this._leftDelay=null,this._rightDelay.dispose(),this._rightDelay=null,this._rightPreDelay.dispose(),this._rightPreDelay=null,this._writable(["delayTime"]),this.delayTime.dispose(),this.delayTime=null,this},G.default=H.default.PingPongDelay},function(z,G,V){V.r(G);var H=V(0);V(12),V(9),V(15),H.default.Phaser=function(){var z=H.default.defaults(arguments,["frequency","octaves","baseFrequency"],H.default.Phaser);H.default.StereoEffect.call(this,z),this._lfoL=new H.default.LFO(z.frequency,0,1),this._lfoR=new H.default.LFO(z.frequency,0,1),this._lfoR.phase=180,this._baseFrequency=z.baseFrequency,this._octaves=z.octaves,this.Q=new H.default.Signal(z.Q,H.default.Type.Positive),this._filtersL=this._makeFilters(z.stages,this._lfoL,this.Q),this._filtersR=this._makeFilters(z.stages,this._lfoR,this.Q),this.frequency=this._lfoL.frequency,this.frequency.value=z.frequency,this.effectSendL.connect(this._filtersL[0]),this.effectSendR.connect(this._filtersR[0]),H.default.connect(this._filtersL[z.stages-1],this.effectReturnL),H.default.connect(this._filtersR[z.stages-1],this.effectReturnR),this._lfoL.frequency.connect(this._lfoR.frequency),this.baseFrequency=z.baseFrequency,this.octaves=z.octaves,this._lfoL.start(),this._lfoR.start(),this._readOnly(["frequency","Q"])},H.default.extend(H.default.Phaser,H.default.StereoEffect),H.default.Phaser.defaults={frequency:.5,octaves:3,stages:10,Q:10,baseFrequency:350},H.default.Phaser.prototype._makeFilters=function(z,G,V){for(var W=new Array(z),K=0;K<z;K++){var Z=this.context.createBiquadFilter();Z.type="allpass",V.connect(Z.Q),G.connect(Z.frequency),W[K]=Z}return H.default.connectSeries.apply(H.default,W),W},Object.defineProperty(H.default.Phaser.prototype,"octaves",{get:function(){return this._octaves},set:function(z){this._octaves=z;var G=this._baseFrequency*Math.pow(2,z);this._lfoL.max=G,this._lfoR.max=G}}),Object.defineProperty(H.default.Phaser.prototype,"baseFrequency",{get:function(){return this._baseFrequency},set:function(z){this._baseFrequency=z,this._lfoL.min=z,this._lfoR.min=z,this.octaves=this._octaves}}),H.default.Phaser.prototype.dispose=function(){H.default.StereoEffect.prototype.dispose.call(this),this._writable(["frequency","Q"]),this.Q.dispose(),this.Q=null,this._lfoL.dispose(),this._lfoL=null,this._lfoR.dispose(),this._lfoR=null;for(var z=0;z<this._filtersL.length;z++)this._filtersL[z].disconnect(),this._filtersL[z]=null;this._filtersL=null;for(var G=0;G<this._filtersR.length;G++)this._filtersR[G].disconnect(),this._filtersR[G]=null;return this._filtersR=null,this.frequency=null,this},G.default=H.default.Phaser},function(z,G,V){V.r(G);var H=V(0),W=(V(59),V(15),V(26),[.06748,.06404,.08212,.09004]),K=[.773,.802,.753,.733],Z=[347,113,37];H.default.JCReverb=function(){var z=H.default.defaults(arguments,["roomSize"],H.default.JCReverb);H.default.StereoEffect.call(this,z),this.roomSize=new H.default.Signal(z.roomSize,H.default.Type.NormalRange),this._scaleRoomSize=new H.default.Scale(-.733,.197),this._allpassFilters=[],this._feedbackCombFilters=[];for(var G=0;G<Z.length;G++){var V=this.context.createBiquadFilter();V.type="allpass",V.frequency.value=Z[G],this._allpassFilters.push(V)}for(var it=0;it<W.length;it++){var ot=new H.default.FeedbackCombFilter(W[it],.1);this._scaleRoomSize.connect(ot.resonance),ot.resonance.value=K[it],H.default.connect(this._allpassFilters[this._allpassFilters.length-1],ot),it<W.length/2?ot.connect(this.effectReturnL):ot.connect(this.effectReturnR),this._feedbackCombFilters.push(ot)}this.roomSize.connect(this._scaleRoomSize),H.default.connectSeries.apply(H.default,this._allpassFilters),this.effectSendL.connect(this._allpassFilters[0]),this.effectSendR.connect(this._allpassFilters[0]),this._readOnly(["roomSize"])},H.default.extend(H.default.JCReverb,H.default.StereoEffect),H.default.JCReverb.defaults={roomSize:.5},H.default.JCReverb.prototype.dispose=function(){H.default.StereoEffect.prototype.dispose.call(this);for(var z=0;z<this._allpassFilters.length;z++)this._allpassFilters[z].disconnect(),this._allpassFilters[z]=null;this._allpassFilters=null;for(var G=0;G<this._feedbackCombFilters.length;G++)this._feedbackCombFilters[G].dispose(),this._feedbackCombFilters[G]=null;return this._feedbackCombFilters=null,this._writable(["roomSize"]),this.roomSize.dispose(),this.roomSize=null,this._scaleRoomSize.dispose(),this._scaleRoomSize=null,this},G.default=H.default.JCReverb},function(z,G,V){V.r(G);var H=V(0),W=(V(54),V(15),V(2),V(19),V(10),V(42),[1557/44100,1617/44100,1491/44100,1422/44100,1277/44100,1356/44100,1188/44100,1116/44100]),K=[225,556,441,341];H.default.Freeverb=function(){var z=H.default.defaults(arguments,["roomSize","dampening"],H.default.Freeverb);H.default.StereoEffect.call(this,z),this.roomSize=new H.default.Signal(z.roomSize,H.default.Type.NormalRange),this.dampening=new H.default.Signal(z.dampening,H.default.Type.Frequency),this._combFilters=[],this._allpassFiltersL=[],this._allpassFiltersR=[];for(var G=0;G<K.length;G++){var V=this.context.createBiquadFilter();V.type="allpass",V.frequency.value=K[G],this._allpassFiltersL.push(V)}for(var Z=0;Z<K.length;Z++){var it=this.context.createBiquadFilter();it.type="allpass",it.frequency.value=K[Z],this._allpassFiltersR.push(it)}for(var ot=0;ot<W.length;ot++){var rt=new H.default.LowpassCombFilter(W[ot]);ot<W.length/2?this.effectSendL.chain(rt,this._allpassFiltersL[0]):this.effectSendR.chain(rt,this._allpassFiltersR[0]),this.roomSize.connect(rt.resonance),this.dampening.connect(rt.dampening),this._combFilters.push(rt)}H.default.connectSeries.apply(H.default,this._allpassFiltersL),H.default.connectSeries.apply(H.default,this._allpassFiltersR),H.default.connect(this._allpassFiltersL[this._allpassFiltersL.length-1],this.effectReturnL),H.default.connect(this._allpassFiltersR[this._allpassFiltersR.length-1],this.effectReturnR),this._readOnly(["roomSize","dampening"])},H.default.extend(H.default.Freeverb,H.default.StereoEffect),H.default.Freeverb.defaults={roomSize:.7,dampening:3e3},H.default.Freeverb.prototype.dispose=function(){H.default.StereoEffect.prototype.dispose.call(this);for(var z=0;z<this._allpassFiltersL.length;z++)this._allpassFiltersL[z].disconnect(),this._allpassFiltersL[z]=null;this._allpassFiltersL=null;for(var G=0;G<this._allpassFiltersR.length;G++)this._allpassFiltersR[G].disconnect(),this._allpassFiltersR[G]=null;this._allpassFiltersR=null;for(var V=0;V<this._combFilters.length;V++)this._combFilters[V].dispose(),this._combFilters[V]=null;return this._combFilters=null,this._writable(["roomSize","dampening"]),this.roomSize.dispose(),this.roomSize=null,this.dampening.dispose(),this.dampening=null,this},G.default=H.default.Freeverb},function(z,G,V){V.r(G);var H=V(0);V(33),V(2),V(18),H.default.FeedbackDelay=function(){var z=H.default.defaults(arguments,["delayTime","feedback"],H.default.FeedbackDelay);H.default.FeedbackEffect.call(this,z),this._delayNode=new H.default.Delay(z.delayTime,z.maxDelay),this.delayTime=this._delayNode.delayTime,this.connectEffect(this._delayNode),this._readOnly(["delayTime"])},H.default.extend(H.default.FeedbackDelay,H.default.FeedbackEffect),H.default.FeedbackDelay.defaults={delayTime:.25,maxDelay:1},H.default.FeedbackDelay.prototype.dispose=function(){return H.default.FeedbackEffect.prototype.dispose.call(this),this._delayNode.dispose(),this._delayNode=null,this._writable(["delayTime"]),this.delayTime=null,this},G.default=H.default.FeedbackDelay},function(z,G,V){V.r(G);var H=V(0);V(8),V(7),H.default.Distortion=function(){var z=H.default.defaults(arguments,["distortion"],H.default.Distortion);H.default.Effect.call(this,z),this._shaper=new H.default.WaveShaper(4096),this._distortion=z.distortion,this.connectEffect(this._shaper),this.distortion=z.distortion,this.oversample=z.oversample},H.default.extend(H.default.Distortion,H.default.Effect),H.default.Distortion.defaults={distortion:.4,oversample:"none"},Object.defineProperty(H.default.Distortion.prototype,"distortion",{get:function(){return this._distortion},set:function(z){this._distortion=z;var G=100*z,V=Math.PI/180;this._shaper.setMap((function(z){return Math.abs(z)<.001?0:(3+G)*z*20*V/(Math.PI+G*Math.abs(z))}))}}),Object.defineProperty(H.default.Distortion.prototype,"oversample",{get:function(){return this._shaper.oversample},set:function(z){this._shaper.oversample=z}}),H.default.Distortion.prototype.dispose=function(){return H.default.Effect.prototype.dispose.call(this),this._shaper.dispose(),this._shaper=null,this},G.default=H.default.Distortion},function(z,G,V){V.r(G);var H=V(0);V(12),V(15),V(18),H.default.Chorus=function(){var z=H.default.defaults(arguments,["frequency","delayTime","depth"],H.default.Chorus);H.default.StereoEffect.call(this,z),this._depth=z.depth,this._delayTime=z.delayTime/1e3,this._lfoL=new H.default.LFO({frequency:z.frequency,min:0,max:1}),this._lfoR=new H.default.LFO({frequency:z.frequency,min:0,max:1,phase:180}),this._delayNodeL=new H.default.Delay,this._delayNodeR=new H.default.Delay,this.frequency=this._lfoL.frequency,this.effectSendL.chain(this._delayNodeL,this.effectReturnL),this.effectSendR.chain(this._delayNodeR,this.effectReturnR),this.effectSendL.connect(this.effectReturnL),this.effectSendR.connect(this.effectReturnR),this._lfoL.connect(this._delayNodeL.delayTime),this._lfoR.connect(this._delayNodeR.delayTime),this._lfoL.start(),this._lfoR.start(),this._lfoL.frequency.connect(this._lfoR.frequency),this.depth=this._depth,this.frequency.value=z.frequency,this.type=z.type,this._readOnly(["frequency"]),this.spread=z.spread},H.default.extend(H.default.Chorus,H.default.StereoEffect),H.default.Chorus.defaults={frequency:1.5,delayTime:3.5,depth:.7,type:"sine",spread:180},Object.defineProperty(H.default.Chorus.prototype,"depth",{get:function(){return this._depth},set:function(z){this._depth=z;var G=this._delayTime*z;this._lfoL.min=Math.max(this._delayTime-G,0),this._lfoL.max=this._delayTime+G,this._lfoR.min=Math.max(this._delayTime-G,0),this._lfoR.max=this._delayTime+G}}),Object.defineProperty(H.default.Chorus.prototype,"delayTime",{get:function(){return 1e3*this._delayTime},set:function(z){this._delayTime=z/1e3,this.depth=this._depth}}),Object.defineProperty(H.default.Chorus.prototype,"type",{get:function(){return this._lfoL.type},set:function(z){this._lfoL.type=z,this._lfoR.type=z}}),Object.defineProperty(H.default.Chorus.prototype,"spread",{get:function(){return this._lfoR.phase-this._lfoL.phase},set:function(z){this._lfoL.phase=90-z/2,this._lfoR.phase=z/2+90}}),H.default.Chorus.prototype.dispose=function(){return H.default.StereoEffect.prototype.dispose.call(this),this._lfoL.dispose(),this._lfoL=null,this._lfoR.dispose(),this._lfoR=null,this._delayNodeL.dispose(),this._delayNodeL=null,this._delayNodeR.dispose(),this._delayNodeR=null,this._writable("frequency"),this.frequency=null,this},G.default=H.default.Chorus},function(z,G,V){V.r(G);var H=V(0);V(8),V(7),H.default.Chebyshev=function(){var z=H.default.defaults(arguments,["order"],H.default.Chebyshev);H.default.Effect.call(this,z),this._shaper=new H.default.WaveShaper(4096),this._order=z.order,this.connectEffect(this._shaper),this.order=z.order,this.oversample=z.oversample},H.default.extend(H.default.Chebyshev,H.default.Effect),H.default.Chebyshev.defaults={order:1,oversample:"none"},H.default.Chebyshev.prototype._getCoefficient=function(z,G,V){return V.hasOwnProperty(G)||(V[G]=0===G?0:1===G?z:2*z*this._getCoefficient(z,G-1,V)-this._getCoefficient(z,G-2,V)),V[G]},Object.defineProperty(H.default.Chebyshev.prototype,"order",{get:function(){return this._order},set:function(z){this._order=z;for(var G=new Array(4096),V=G.length,H=0;H<V;++H){var W=2*H/V-1;G[H]=0===W?0:this._getCoefficient(W,z,{})}this._shaper.curve=G}}),Object.defineProperty(H.default.Chebyshev.prototype,"oversample",{get:function(){return this._shaper.oversample},set:function(z){this._shaper.oversample=z}}),H.default.Chebyshev.prototype.dispose=function(){return H.default.Effect.prototype.dispose.call(this),this._shaper.dispose(),this._shaper=null,this},G.default=H.default.Chebyshev},function(z,G,V){V.r(G);var H=V(0);V(8),V(13),V(75),H.default.BitCrusher=function(){var z=H.default.defaults(arguments,["bits"],H.default.BitCrusher);H.default.Effect.call(this,z);var G=1/Math.pow(2,z.bits-1);this._subtract=new H.default.Subtract,this._modulo=new H.default.Modulo(G),this._bits=z.bits,this.effectSend.fan(this._subtract,this._modulo),this._modulo.connect(this._subtract,0,1),this._subtract.connect(this.effectReturn)},H.default.extend(H.default.BitCrusher,H.default.Effect),H.default.BitCrusher.defaults={bits:4},Object.defineProperty(H.default.BitCrusher.prototype,"bits",{get:function(){return this._bits},set:function(z){this._bits=z;var G=1/Math.pow(2,z-1);this._modulo.value=G}}),H.default.BitCrusher.prototype.dispose=function(){return H.default.Effect.prototype.dispose.call(this),this._subtract.dispose(),this._subtract=null,this._modulo.dispose(),this._modulo=null,this},G.default=H.default.BitCrusher},function(z,G,V){V.r(G);var H=V(0);V(58),V(42),V(8),V(9),H.default.AutoWah=function(){var z=H.default.defaults(arguments,["baseFrequency","octaves","sensitivity"],H.default.AutoWah);H.default.Effect.call(this,z),this.follower=new H.default.Follower(z.follower),this._sweepRange=new H.default.ScaleExp(0,1,.5),this._baseFrequency=z.baseFrequency,this._octaves=z.octaves,this._inputBoost=new H.default.Gain,this._bandpass=new H.default.Filter({rolloff:-48,frequency:0,Q:z.Q}),this._peaking=new H.default.Filter(0,"peaking"),this._peaking.gain.value=z.gain,this.gain=this._peaking.gain,this.Q=this._bandpass.Q,this.effectSend.chain(this._inputBoost,this.follower,this._sweepRange),this._sweepRange.connect(this._bandpass.frequency),this._sweepRange.connect(this._peaking.frequency),this.effectSend.chain(this._bandpass,this._peaking,this.effectReturn),this._setSweepRange(),this.sensitivity=z.sensitivity,this._readOnly(["gain","Q"])},H.default.extend(H.default.AutoWah,H.default.Effect),H.default.AutoWah.defaults={baseFrequency:100,octaves:6,sensitivity:0,Q:2,gain:2,follower:{attack:.3,release:.5}},Object.defineProperty(H.default.AutoWah.prototype,"octaves",{get:function(){return this._octaves},set:function(z){this._octaves=z,this._setSweepRange()}}),Object.defineProperty(H.default.AutoWah.prototype,"baseFrequency",{get:function(){return this._baseFrequency},set:function(z){this._baseFrequency=z,this._setSweepRange()}}),Object.defineProperty(H.default.AutoWah.prototype,"sensitivity",{get:function(){return H.default.gainToDb(1/this._inputBoost.gain.value)},set:function(z){this._inputBoost.gain.value=1/H.default.dbToGain(z)}}),H.default.AutoWah.prototype._setSweepRange=function(){this._sweepRange.min=this._baseFrequency,this._sweepRange.max=Math.min(this._baseFrequency*Math.pow(2,this._octaves),this.context.sampleRate/2)},H.default.AutoWah.prototype.dispose=function(){return H.default.Effect.prototype.dispose.call(this),this.follower.dispose(),this.follower=null,this._sweepRange.dispose(),this._sweepRange=null,this._bandpass.dispose(),this._bandpass=null,this._peaking.dispose(),this._peaking=null,this._inputBoost.dispose(),this._inputBoost=null,this._writable(["gain","Q"]),this.gain=null,this.Q=null,this},G.default=H.default.AutoWah},function(z,G,V){V.r(G);var H=V(0);V(8),V(12),V(48),H.default.AutoPanner=function(){var z=H.default.defaults(arguments,["frequency"],H.default.AutoPanner);H.default.Effect.call(this,z),this._lfo=new H.default.LFO({frequency:z.frequency,amplitude:z.depth,min:-1,max:1}),this.depth=this._lfo.amplitude,this._panner=new H.default.Panner,this.frequency=this._lfo.frequency,this.connectEffect(this._panner),this._lfo.connect(this._panner.pan),this.type=z.type,this._readOnly(["depth","frequency"])},H.default.extend(H.default.AutoPanner,H.default.Effect),H.default.AutoPanner.defaults={frequency:1,type:"sine",depth:1},H.default.AutoPanner.prototype.start=function(z){return this._lfo.start(z),this},H.default.AutoPanner.prototype.stop=function(z){return this._lfo.stop(z),this},H.default.AutoPanner.prototype.sync=function(z){return this._lfo.sync(z),this},H.default.AutoPanner.prototype.unsync=function(){return this._lfo.unsync(),this},Object.defineProperty(H.default.AutoPanner.prototype,"type",{get:function(){return this._lfo.type},set:function(z){this._lfo.type=z}}),H.default.AutoPanner.prototype.dispose=function(){return H.default.Effect.prototype.dispose.call(this),this._lfo.dispose(),this._lfo=null,this._panner.dispose(),this._panner=null,this._writable(["depth","frequency"]),this.frequency=null,this.depth=null,this},G.default=H.default.AutoPanner},function(z,G,V){V.r(G);var H=V(0);V(8),V(12),V(9),H.default.AutoFilter=function(){var z=H.default.defaults(arguments,["frequency","baseFrequency","octaves"],H.default.AutoFilter);H.default.Effect.call(this,z),this._lfo=new H.default.LFO({frequency:z.frequency,amplitude:z.depth}),this.depth=this._lfo.amplitude,this.frequency=this._lfo.frequency,this.filter=new H.default.Filter(z.filter),this._octaves=0,this.connectEffect(this.filter),this._lfo.connect(this.filter.frequency),this.type=z.type,this._readOnly(["frequency","depth"]),this.octaves=z.octaves,this.baseFrequency=z.baseFrequency},H.default.extend(H.default.AutoFilter,H.default.Effect),H.default.AutoFilter.defaults={frequency:1,type:"sine",depth:1,baseFrequency:200,octaves:2.6,filter:{type:"lowpass",rolloff:-12,Q:1}},H.default.AutoFilter.prototype.start=function(z){return this._lfo.start(z),this},H.default.AutoFilter.prototype.stop=function(z){return this._lfo.stop(z),this},H.default.AutoFilter.prototype.sync=function(z){return this._lfo.sync(z),this},H.default.AutoFilter.prototype.unsync=function(){return this._lfo.unsync(),this},Object.defineProperty(H.default.AutoFilter.prototype,"type",{get:function(){return this._lfo.type},set:function(z){this._lfo.type=z}}),Object.defineProperty(H.default.AutoFilter.prototype,"baseFrequency",{get:function(){return this._lfo.min},set:function(z){this._lfo.min=this.toFrequency(z),this.octaves=this._octaves}}),Object.defineProperty(H.default.AutoFilter.prototype,"octaves",{get:function(){return this._octaves},set:function(z){this._octaves=z,this._lfo.max=this.baseFrequency*Math.pow(2,z)}}),H.default.AutoFilter.prototype.dispose=function(){return H.default.Effect.prototype.dispose.call(this),this._lfo.dispose(),this._lfo=null,this.filter.dispose(),this.filter=null,this._writable(["frequency","depth"]),this.frequency=null,this.depth=null,this},G.default=H.default.AutoFilter},function(z,G,V){V.r(G);var H=V(0);V(23),V(10),V(19),V(2),V(22),V(28),H.default.Listener=function(){H.default.call(this),this._orientation=[0,0,0,0,0,0],this._position=[0,0,0],H.default.getContext(function(){this.set(W.defaults)}.bind(this))},H.default.extend(H.default.Listener),H.default.Listener.defaults={positionX:0,positionY:0,positionZ:0,forwardX:0,forwardY:0,forwardZ:1,upX:0,upY:1,upZ:0},H.default.Listener.prototype.isListener=!0,H.default.Listener.prototype._rampTimeConstant=.01,H.default.Listener.prototype.setPosition=function(z,G,V){if(this.context.rawContext.listener.positionX){var H=this.now();this.context.rawContext.listener.positionX.setTargetAtTime(z,H,this._rampTimeConstant),this.context.rawContext.listener.positionY.setTargetAtTime(G,H,this._rampTimeConstant),this.context.rawContext.listener.positionZ.setTargetAtTime(V,H,this._rampTimeConstant)}else this.context.rawContext.listener.setPosition(z,G,V);return this._position=Array.prototype.slice.call(arguments),this},H.default.Listener.prototype.setOrientation=function(z,G,V,H,W,K){if(this.context.rawContext.listener.forwardX){var Z=this.now();this.context.rawContext.listener.forwardX.setTargetAtTime(z,Z,this._rampTimeConstant),this.context.rawContext.listener.forwardY.setTargetAtTime(G,Z,this._rampTimeConstant),this.context.rawContext.listener.forwardZ.setTargetAtTime(V,Z,this._rampTimeConstant),this.context.rawContext.listener.upX.setTargetAtTime(H,Z,this._rampTimeConstant),this.context.rawContext.listener.upY.setTargetAtTime(W,Z,this._rampTimeConstant),this.context.rawContext.listener.upZ.setTargetAtTime(K,Z,this._rampTimeConstant)}else this.context.rawContext.listener.setOrientation(z,G,V,H,W,K);return this._orientation=Array.prototype.slice.call(arguments),this},Object.defineProperty(H.default.Listener.prototype,"positionX",{set:function(z){this._position[0]=z,this.setPosition.apply(this,this._position)},get:function(){return this._position[0]}}),Object.defineProperty(H.default.Listener.prototype,"positionY",{set:function(z){this._position[1]=z,this.setPosition.apply(this,this._position)},get:function(){return this._position[1]}}),Object.defineProperty(H.default.Listener.prototype,"positionZ",{set:function(z){this._position[2]=z,this.setPosition.apply(this,this._position)},get:function(){return this._position[2]}}),Object.defineProperty(H.default.Listener.prototype,"forwardX",{set:function(z){this._orientation[0]=z,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[0]}}),Object.defineProperty(H.default.Listener.prototype,"forwardY",{set:function(z){this._orientation[1]=z,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[1]}}),Object.defineProperty(H.default.Listener.prototype,"forwardZ",{set:function(z){this._orientation[2]=z,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[2]}}),Object.defineProperty(H.default.Listener.prototype,"upX",{set:function(z){this._orientation[3]=z,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[3]}}),Object.defineProperty(H.default.Listener.prototype,"upY",{set:function(z){this._orientation[4]=z,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[4]}}),Object.defineProperty(H.default.Listener.prototype,"upZ",{set:function(z){this._orientation[5]=z,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[5]}}),H.default.Listener.prototype.dispose=function(){return this._orientation=null,this._position=null,this};var W=H.default.Listener;H.default.Listener=new W,H.default.Context.on("init",(function(z){z.listener&&z.listener.isListener?H.default.Listener=z.listener:H.default.Listener=new W})),G.default=H.default.Listener},function(z,G,V){V.r(G);var H=V(0);V(24),H.default.Draw=function(){H.default.call(this),this._events=new H.default.Timeline,this.expiration=.25,this.anticipation=.008,this._boundDrawLoop=this._drawLoop.bind(this)},H.default.extend(H.default.Draw),H.default.Draw.prototype.schedule=function(z,G){return this._events.add({callback:z,time:this.toSeconds(G)}),1===this._events.length&&requestAnimationFrame(this._boundDrawLoop),this},H.default.Draw.prototype.cancel=function(z){return this._events.cancel(this.toSeconds(z)),this},H.default.Draw.prototype._drawLoop=function(){for(var z=H.default.context.currentTime;this._events.length&&this._events.peek().time-this.anticipation<=z;){var G=this._events.shift();z-G.time<=this.expiration&&G.callback()}this._events.length>0&&requestAnimationFrame(this._boundDrawLoop)},H.default.Draw=new H.default.Draw,G.default=H.default.Draw},function(z,G,V){V.r(G);var H=V(0),W=(V(3),{});H.default.prototype.send=function(z,G){W.hasOwnProperty(z)||(W[z]=this.context.createGain()),G=H.default.defaultArg(G,0);var V=new H.default.Gain(G,H.default.Type.Decibels);return this.connect(V),V.connect(W[z]),V},H.default.prototype.receive=function(z,G){return W.hasOwnProperty(z)||(W[z]=this.context.createGain()),H.default.connect(W[z],this,0,G),this},H.default.Context.on("init",(function(z){z.buses?W=z.buses:(W={},z.buses=W)})),G.default=H.default},function(z,G,V){V.r(G);var H=V(0);V(4),H.default.CtrlRandom=function(){var z=H.default.defaults(arguments,["min","max"],H.default.CtrlRandom);H.default.call(this),this.min=z.min,this.max=z.max,this.integer=z.integer},H.default.extend(H.default.CtrlRandom),H.default.CtrlRandom.defaults={min:0,max:1,integer:!1},Object.defineProperty(H.default.CtrlRandom.prototype,"value",{get:function(){var z=this.toSeconds(this.min),G=this.toSeconds(this.max),V=Math.random(),H=V*z+(1-V)*G;return this.integer&&(H=Math.floor(H)),H}}),G.default=H.default.CtrlRandom},function(z,G,V){V.r(G);var H=V(0);H.default.CtrlMarkov=function(z,G){H.default.call(this),this.values=H.default.defaultArg(z,{}),this.value=H.default.defaultArg(G,Object.keys(this.values)[0])},H.default.extend(H.default.CtrlMarkov),H.default.CtrlMarkov.prototype.next=function(){if(this.values.hasOwnProperty(this.value)){var z=this.values[this.value];if(H.default.isArray(z))for(var G=this._getProbDistribution(z),V=Math.random(),W=0,K=0;K<G.length;K++){var Z=G[K];if(V>W&&V<W+Z){var it=z[K];H.default.isObject(it)?this.value=it.value:this.value=it}W+=Z}else this.value=z}return this.value},H.default.CtrlMarkov.prototype._getProbDistribution=function(z){for(var G=[],V=0,W=!1,K=0;K<z.length;K++){var Z=z[K];H.default.isObject(Z)?(W=!0,G[K]=Z.probability):G[K]=1/z.length,V+=G[K]}if(W)for(var it=0;it<G.length;it++)G[it]=G[it]/V;return G},H.default.CtrlMarkov.prototype.dispose=function(){this.values=null},G.default=H.default.CtrlMarkov},function(z,G,V){V.r(G);var H=V(0);V(4),H.default.CtrlInterpolate=function(){var z=H.default.defaults(arguments,["values","index"],H.default.CtrlInterpolate);H.default.call(this),this.values=z.values,this.index=z.index},H.default.extend(H.default.CtrlInterpolate),H.default.CtrlInterpolate.defaults={index:0,values:[]},Object.defineProperty(H.default.CtrlInterpolate.prototype,"value",{get:function(){var z=this.index;z=Math.min(z,this.values.length-1);var G=Math.floor(z),V=this.values[G],H=this.values[Math.ceil(z)];return this._interpolate(z-G,V,H)}}),H.default.CtrlInterpolate.prototype._interpolate=function(z,G,V){if(H.default.isArray(G)){for(var W=[],K=0;K<G.length;K++)W[K]=this._interpolate(z,G[K],V[K]);return W}if(H.default.isObject(G)){var Z={};for(var it in G)Z[it]=this._interpolate(z,G[it],V[it]);return Z}return(1-z)*(G=this._toNumber(G))+z*this._toNumber(V)},H.default.CtrlInterpolate.prototype._toNumber=function(z){return H.default.isNumber(z)?z:this.toSeconds(z)},H.default.CtrlInterpolate.prototype.dispose=function(){this.values=null},G.default=H.default.CtrlInterpolate},function(z,G,V){V.r(G);var H=V(0);V(36),V(1),H.default.Waveform=function(){var z=H.default.defaults(arguments,["size"],H.default.Waveform);z.type=H.default.Analyser.Type.Waveform,H.default.AudioNode.call(this),this._analyser=this.input=this.output=new H.default.Analyser(z)},H.default.extend(H.default.Waveform,H.default.AudioNode),H.default.Waveform.defaults={size:1024},H.default.Waveform.prototype.getValue=function(){return this._analyser.getValue()},Object.defineProperty(H.default.Waveform.prototype,"size",{get:function(){return this._analyser.size},set:function(z){this._analyser.size=z}}),H.default.Waveform.prototype.dispose=function(){H.default.AudioNode.prototype.dispose.call(this),this._analyser.dispose(),this._analyser=null},G.default=H.default.Waveform},function(z,G,V){V.r(G);var H=V(0);V(23),V(10),V(19),V(2),V(22),V(28),V(1),H.default.Panner3D=function(){var z=H.default.defaults(arguments,["positionX","positionY","positionZ"],H.default.Panner3D);H.default.AudioNode.call(this),this._panner=this.input=this.output=this.context.createPanner(),this._panner.panningModel=z.panningModel,this._panner.maxDistance=z.maxDistance,this._panner.distanceModel=z.distanceModel,this._panner.coneOuterGain=z.coneOuterGain,this._panner.coneOuterAngle=z.coneOuterAngle,this._panner.coneInnerAngle=z.coneInnerAngle,this._panner.refDistance=z.refDistance,this._panner.rolloffFactor=z.rolloffFactor,this._orientation=[z.orientationX,z.orientationY,z.orientationZ],this._position=[z.positionX,z.positionY,z.positionZ],this.orientationX=z.orientationX,this.orientationY=z.orientationY,this.orientationZ=z.orientationZ,this.positionX=z.positionX,this.positionY=z.positionY,this.positionZ=z.positionZ},H.default.extend(H.default.Panner3D,H.default.AudioNode),H.default.Panner3D.defaults={positionX:0,positionY:0,positionZ:0,orientationX:0,orientationY:0,orientationZ:0,panningModel:"equalpower",maxDistance:1e4,distanceModel:"inverse",coneOuterGain:0,coneOuterAngle:360,coneInnerAngle:360,refDistance:1,rolloffFactor:1},H.default.Panner3D.prototype._rampTimeConstant=.01,H.default.Panner3D.prototype.setPosition=function(z,G,V){if(this._panner.positionX){var H=this.now();this._panner.positionX.setTargetAtTime(z,H,this._rampTimeConstant),this._panner.positionY.setTargetAtTime(G,H,this._rampTimeConstant),this._panner.positionZ.setTargetAtTime(V,H,this._rampTimeConstant)}else this._panner.setPosition(z,G,V);return this._position=Array.prototype.slice.call(arguments),this},H.default.Panner3D.prototype.setOrientation=function(z,G,V){if(this._panner.orientationX){var H=this.now();this._panner.orientationX.setTargetAtTime(z,H,this._rampTimeConstant),this._panner.orientationY.setTargetAtTime(G,H,this._rampTimeConstant),this._panner.orientationZ.setTargetAtTime(V,H,this._rampTimeConstant)}else this._panner.setOrientation(z,G,V);return this._orientation=Array.prototype.slice.call(arguments),this},Object.defineProperty(H.default.Panner3D.prototype,"positionX",{set:function(z){this._position[0]=z,this.setPosition.apply(this,this._position)},get:function(){return this._position[0]}}),Object.defineProperty(H.default.Panner3D.prototype,"positionY",{set:function(z){this._position[1]=z,this.setPosition.apply(this,this._position)},get:function(){return this._position[1]}}),Object.defineProperty(H.default.Panner3D.prototype,"positionZ",{set:function(z){this._position[2]=z,this.setPosition.apply(this,this._position)},get:function(){return this._position[2]}}),Object.defineProperty(H.default.Panner3D.prototype,"orientationX",{set:function(z){this._orientation[0]=z,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[0]}}),Object.defineProperty(H.default.Panner3D.prototype,"orientationY",{set:function(z){this._orientation[1]=z,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[1]}}),Object.defineProperty(H.default.Panner3D.prototype,"orientationZ",{set:function(z){this._orientation[2]=z,this.setOrientation.apply(this,this._orientation)},get:function(){return this._orientation[2]}}),H.default.Panner3D._aliasProperty=function(z){Object.defineProperty(H.default.Panner3D.prototype,z,{set:function(G){this._panner[z]=G},get:function(){return this._panner[z]}})},H.default.Panner3D._aliasProperty("panningModel"),H.default.Panner3D._aliasProperty("refDistance"),H.default.Panner3D._aliasProperty("rolloffFactor"),H.default.Panner3D._aliasProperty("distanceModel"),H.default.Panner3D._aliasProperty("coneInnerAngle"),H.default.Panner3D._aliasProperty("coneOuterAngle"),H.default.Panner3D._aliasProperty("coneOuterGain"),H.default.Panner3D._aliasProperty("maxDistance"),H.default.Panner3D.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._panner.disconnect(),this._panner=null,this._orientation=null,this._position=null,this},G.default=H.default.Panner3D},function(z,G,V){V.r(G);var H=V(0);V(60),V(43),V(1),H.default.MultibandCompressor=function(z){H.default.AudioNode.call(this),z=H.default.defaultArg(arguments,H.default.MultibandCompressor.defaults),this._splitter=this.input=new H.default.MultibandSplit({lowFrequency:z.lowFrequency,highFrequency:z.highFrequency}),this.lowFrequency=this._splitter.lowFrequency,this.highFrequency=this._splitter.highFrequency,this.output=new H.default.Gain,this.low=new H.default.Compressor(z.low),this.mid=new H.default.Compressor(z.mid),this.high=new H.default.Compressor(z.high),this._splitter.low.chain(this.low,this.output),this._splitter.mid.chain(this.mid,this.output),this._splitter.high.chain(this.high,this.output),this._readOnly(["high","mid","low","highFrequency","lowFrequency"])},H.default.extend(H.default.MultibandCompressor,H.default.AudioNode),H.default.MultibandCompressor.defaults={low:H.default.Compressor.defaults,mid:H.default.Compressor.defaults,high:H.default.Compressor.defaults,lowFrequency:250,highFrequency:2e3},H.default.MultibandCompressor.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._splitter.dispose(),this._writable(["high","mid","low","highFrequency","lowFrequency"]),this.low.dispose(),this.mid.dispose(),this.high.dispose(),this._splitter=null,this.low=null,this.mid=null,this.high=null,this.lowFrequency=null,this.highFrequency=null,this},G.default=H.default.MultibandCompressor},function(z,G,V){V.r(G);var H=V(0);V(10),V(1),H.default.Mono=function(){H.default.AudioNode.call(this),this.createInsOuts(1,0),this._merge=this.output=new H.default.Merge,H.default.connect(this.input,this._merge,0,0),H.default.connect(this.input,this._merge,0,1)},H.default.extend(H.default.Mono,H.default.AudioNode),H.default.Mono.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._merge.dispose(),this._merge=null,this},G.default=H.default.Mono},function(z,G,V){V.r(G);var H=V(0);V(53),V(52),V(43),V(1),H.default.MidSideCompressor=function(z){H.default.AudioNode.call(this),z=H.default.defaultArg(z,H.default.MidSideCompressor.defaults),this._midSideSplit=this.input=new H.default.MidSideSplit,this._midSideMerge=this.output=new H.default.MidSideMerge,this.mid=new H.default.Compressor(z.mid),this.side=new H.default.Compressor(z.side),this._midSideSplit.mid.chain(this.mid,this._midSideMerge.mid),this._midSideSplit.side.chain(this.side,this._midSideMerge.side),this._readOnly(["mid","side"])},H.default.extend(H.default.MidSideCompressor,H.default.AudioNode),H.default.MidSideCompressor.defaults={mid:{ratio:3,threshold:-24,release:.03,attack:.02,knee:16},side:{ratio:6,threshold:-30,release:.25,attack:.03,knee:10}},H.default.MidSideCompressor.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._writable(["mid","side"]),this.mid.dispose(),this.mid=null,this.side.dispose(),this.side=null,this._midSideSplit.dispose(),this._midSideSplit=null,this._midSideMerge.dispose(),this._midSideMerge=null,this},G.default=H.default.MidSideCompressor},function(z,G,V){V.r(G);var H=V(0);V(36),V(1),H.default.Meter=function(){var z=H.default.defaults(arguments,["smoothing"],H.default.Meter);H.default.AudioNode.call(this),this.smoothing=z.smoothing,this._rms=0,this.input=this.output=this._analyser=new H.default.Analyser("waveform",256)},H.default.extend(H.default.Meter,H.default.AudioNode),H.default.Meter.defaults={smoothing:.8},H.default.Meter.prototype.getLevel=function(){for(var z=this._analyser.getValue(),G=0,V=0;V<z.length;V++){var W=z[V];G+=W*W}var K=Math.sqrt(G/z.length);return this._rms=Math.max(K,this._rms*this.smoothing),H.default.gainToDb(this._rms)},H.default.Meter.prototype.getValue=function(){return this._analyser.getValue()[0]},H.default.Meter.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._analyser.dispose(),this._analyser=null,this},G.default=H.default.Meter},function(z,G,V){V.r(G);var H=V(0);V(43),V(1),H.default.Limiter=function(){var z=H.default.defaults(arguments,["threshold"],H.default.Limiter);H.default.AudioNode.call(this),this._compressor=this.input=this.output=new H.default.Compressor({attack:.001,decay:.001,threshold:z.threshold}),this.threshold=this._compressor.threshold,this._readOnly("threshold")},H.default.extend(H.default.Limiter,H.default.AudioNode),H.default.Limiter.defaults={threshold:-12},H.default.Limiter.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._compressor.dispose(),this._compressor=null,this._writable("threshold"),this.threshold=null,this},G.default=H.default.Limiter},function(z,G,V){V.r(G);var H=V(0);V(58),V(85),V(1),H.default.Gate=function(){var z=H.default.defaults(arguments,["threshold","smoothing"],H.default.Gate);H.default.AudioNode.call(this),this.createInsOuts(1,1),this._follower=new H.default.Follower(z.smoothing),this._gt=new H.default.GreaterThan(H.default.dbToGain(z.threshold)),H.default.connect(this.input,this.output),H.default.connectSeries(this.input,this._follower,this._gt,this.output.gain)},H.default.extend(H.default.Gate,H.default.AudioNode),H.default.Gate.defaults={smoothing:.1,threshold:-40},Object.defineProperty(H.default.Gate.prototype,"threshold",{get:function(){return H.default.gainToDb(this._gt.value)},set:function(z){this._gt.value=H.default.dbToGain(z)}}),Object.defineProperty(H.default.Gate.prototype,"smoothing",{get:function(){return this._follower.smoothing},set:function(z){this._follower.smoothing=z}}),H.default.Gate.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._follower.dispose(),this._gt.dispose(),this._follower=null,this._gt=null,this},G.default=H.default.Gate},function(z,G,V){V.r(G);var H=V(0);V(36),V(1),H.default.FFT=function(){var z=H.default.defaults(arguments,["size"],H.default.FFT);z.type=H.default.Analyser.Type.FFT,H.default.AudioNode.call(this),this._analyser=this.input=this.output=new H.default.Analyser(z)},H.default.extend(H.default.FFT,H.default.AudioNode),H.default.FFT.defaults={size:1024},H.default.FFT.prototype.getValue=function(){return this._analyser.getValue()},Object.defineProperty(H.default.FFT.prototype,"size",{get:function(){return this._analyser.size},set:function(z){this._analyser.size=z}}),H.default.FFT.prototype.dispose=function(){H.default.AudioNode.prototype.dispose.call(this),this._analyser.dispose(),this._analyser=null},G.default=H.default.FFT},function(z,G,V){V.r(G);var H=V(0);V(60),V(3),V(1),H.default.EQ3=function(){var z=H.default.defaults(arguments,["low","mid","high"],H.default.EQ3);H.default.AudioNode.call(this),this.output=new H.default.Gain,this._multibandSplit=this.input=new H.default.MultibandSplit({lowFrequency:z.lowFrequency,highFrequency:z.highFrequency}),this._lowGain=new H.default.Gain(z.low,H.default.Type.Decibels),this._midGain=new H.default.Gain(z.mid,H.default.Type.Decibels),this._highGain=new H.default.Gain(z.high,H.default.Type.Decibels),this.low=this._lowGain.gain,this.mid=this._midGain.gain,this.high=this._highGain.gain,this.Q=this._multibandSplit.Q,this.lowFrequency=this._multibandSplit.lowFrequency,this.highFrequency=this._multibandSplit.highFrequency,this._multibandSplit.low.chain(this._lowGain,this.output),this._multibandSplit.mid.chain(this._midGain,this.output),this._multibandSplit.high.chain(this._highGain,this.output),this._readOnly(["low","mid","high","lowFrequency","highFrequency"])},H.default.extend(H.default.EQ3,H.default.AudioNode),H.default.EQ3.defaults={low:0,mid:0,high:0,lowFrequency:400,highFrequency:2500},H.default.EQ3.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._writable(["low","mid","high","lowFrequency","highFrequency"]),this._multibandSplit.dispose(),this._multibandSplit=null,this.lowFrequency=null,this.highFrequency=null,this._lowGain.dispose(),this._lowGain=null,this._midGain.dispose(),this._midGain=null,this._highGain.dispose(),this._highGain=null,this.low=null,this.mid=null,this.high=null,this.Q=null,this},G.default=H.default.EQ3},function(z,G,V){V.r(G);var H=V(0);V(91),V(88),V(1),H.default.Channel=function(){var z=H.default.defaults(arguments,["volume","pan"],H.default.PanVol);H.default.AudioNode.call(this,z),this._solo=this.input=new H.default.Solo(z.solo),this._panVol=this.output=new H.default.PanVol({pan:z.pan,volume:z.volume,mute:z.mute}),this.pan=this._panVol.pan,this.volume=this._panVol.volume,this._solo.connect(this._panVol),this._readOnly(["pan","volume"])},H.default.extend(H.default.Channel,H.default.AudioNode),H.default.Channel.defaults={pan:0,volume:0,mute:!1,solo:!1},Object.defineProperty(H.default.Channel.prototype,"solo",{get:function(){return this._solo.solo},set:function(z){this._solo.solo=z}}),Object.defineProperty(H.default.Channel.prototype,"muted",{get:function(){return this._solo.muted||this.mute}}),Object.defineProperty(H.default.Channel.prototype,"mute",{get:function(){return this._panVol.mute},set:function(z){this._panVol.mute=z}}),H.default.Channel.prototype.dispose=function(){return H.default.AudioNode.prototype.dispose.call(this),this._writable(["pan","volume"]),this._panVol.dispose(),this._panVol=null,this.pan=null,this.volume=null,this._solo.dispose(),this._solo=null,this},G.default=H.default.Channel},function(z,G){var V;V=function(){return this}();try{V=V||Function("return this")()||(0,eval)("this")}catch(z){"object"==typeof window&&(V=window)}z.exports=V},function(z,G,V){V(31),V(36),V(146),V(43),V(23),V(47),V(145),V(59),V(144),V(9),V(58),V(41),V(143),V(12),V(142),V(54),V(10),V(141),V(140),V(52),V(53),V(139),V(138),V(60),V(48),V(137),V(91),V(86),V(88),V(19),V(27),V(136),V(135),V(134),V(79),V(133),V(1),V(11),V(78),V(132),V(83),V(20),V(18),V(131),V(35),V(3),V(81),V(130),V(40),V(77),V(76),V(14),V(24),V(34),V(16),V(56),V(80),V(129),V(128),V(127),V(126),V(125),V(124),V(74),V(123),V(8),V(122),V(33),V(121),V(120),V(73),V(119),V(118),V(117),V(116),V(15),V(115),V(114),V(72),V(113),V(112),V(51),V(71),V(70),V(111),V(110),V(109),V(108),V(107),V(21),V(106),V(105),V(25),V(66),V(104),V(103),V(102),V(101),V(38),V(87),V(29),V(22),V(89),V(100),V(85),V(84),V(75),V(5),V(90),V(99),V(61),V(26),V(42),V(2),V(30),V(13),V(82),V(98),V(7),V(28),V(68),V(32),V(67),V(49),V(97),V(39),V(37),V(17),V(64),V(65),V(96),V(50),V(69),V(6),V(57),V(95),V(46),V(94),V(55),V(63),V(62),V(45),V(4),z.exports=V(0).default}])},"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Tone=e():t.Tone=e(),function(z,G){"object"==typeof exports&&"object"==typeof module?module.exports=G(require("@tensorflow/tfjs"),require("tone")):"function"==typeof define&&define.amd?define(["tf","Tone"],G):"object"==typeof exports?exports.core=G(require("@tensorflow/tfjs"),require("tone")):z.core=G(z.tf,z.Tone)}(self,(function(__WEBPACK_EXTERNAL_MODULE__0__,__WEBPACK_EXTERNAL_MODULE__3__){return function(z){var G={};function n(V){if(G[V])return G[V].exports;var H=G[V]={i:V,l:!1,exports:{}};return z[V].call(H.exports,H,H.exports,n),H.l=!0,H.exports}return n.m=z,n.c=G,n.d=function(z,G,V){n.o(z,G)||Object.defineProperty(z,G,{enumerable:!0,get:V})},n.r=function(z){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(z,"__esModule",{value:!0})},n.t=function(z,G){if(1&G&&(z=n(z)),8&G)return z;if(4&G&&"object"==typeof z&&z&&z.__esModule)return z;var V=Object.create(null);if(n.r(V),Object.defineProperty(V,"default",{enumerable:!0,value:z}),2&G&&"string"!=typeof z)for(var H in z)n.d(V,H,function(G){return z[G]}.bind(null,H));return V},n.n=function(z){var G=z&&z.__esModule?function(){return z.default}:function(){return z};return n.d(G,"a",G),G},n.o=function(z,G){return Object.prototype.hasOwnProperty.call(z,G)},n.p="",n(n.s=68)}([function(z,G){z.exports=__WEBPACK_EXTERNAL_MODULE__0__},function(z,G,V){V.r(G),V.d(G,"DEFAULT_QUARTERS_PER_MINUTE",(function(){return H})),V.d(G,"DEFAULT_STEPS_PER_BAR",(function(){return W})),V.d(G,"DEFAULT_STEPS_PER_QUARTER",(function(){return K})),V.d(G,"DEFAULT_STEPS_PER_SECOND",(function(){return Z})),V.d(G,"DEFAULT_VELOCITY",(function(){return it})),V.d(G,"DEFAULT_PROGRAM",(function(){return ot})),V.d(G,"DEFAULT_TICKS_PER_QUARTER",(function(){return rt})),V.d(G,"DEFAULT_CHANNEL",(function(){return at})),V.d(G,"DRUM_CHANNEL",(function(){return ut})),V.d(G,"NON_DRUM_CHANNELS",(function(){return lt})),V.d(G,"MIN_MIDI_VELOCITY",(function(){return ct})),V.d(G,"MAX_MIDI_VELOCITY",(function(){return ht})),V.d(G,"MIDI_VELOCITIES",(function(){return pt})),V.d(G,"NO_CHORD",(function(){return yt})),V.d(G,"NUM_PITCH_CLASSES",(function(){return _t})),V.d(G,"MIN_MIDI_PITCH",(function(){return vt})),V.d(G,"MAX_MIDI_PITCH",(function(){return wt})),V.d(G,"MIDI_PITCHES",(function(){return Pt})),V.d(G,"MIN_PIANO_PITCH",(function(){return xt})),V.d(G,"MAX_PIANO_PITCH",(function(){return Et})),V.d(G,"MIN_DRUM_PITCH",(function(){return Ct})),V.d(G,"MAX_DRUM_PITCH",(function(){return Ft})),V.d(G,"MIN_MIDI_PROGRAM",(function(){return Rt})),V.d(G,"MAX_MIDI_PROGRAM",(function(){return Lt})),V.d(G,"LO_CLICK_PITCH",(function(){return zt})),V.d(G,"HI_CLICK_PITCH",(function(){return Dt})),V.d(G,"LO_CLICK_CLASS",(function(){return jt})),V.d(G,"HI_CLICK_CLASS",(function(){return Bt}));const H=120,W=16,K=4,Z=100,it=80,ot=0,rt=220,at=0,ut=9,lt=[0,1,2,3,4,5,6,7,8,10,11,12,13,14,15],ct=0,ht=127,pt=ht-ct+1,yt="N.C.",_t=12,vt=0,wt=127,Pt=wt-vt+1,xt=21,Et=108,Ct=35,Ft=81,Rt=0,Lt=127,zt=89,Dt=90,jt=9,Bt=10},function(z,G,V){V.d(G,"a",(function(){return H}));var H=V(16).tensorflow.magenta.NoteSequence},function(z,G){z.exports=__WEBPACK_EXTERNAL_MODULE__3__},function(z,G,V){V.r(G),V.d(G,"Level",(function(){return H})),V.d(G,"verbosity",(function(){return K})),V.d(G,"log",(function(){return s})),V.d(G,"logWithDuration",(function(){return a}));var H,W=V(6);!function(z){z[z.NONE=0]="NONE",z[z.WARN=5]="WARN",z[z.INFO=10]="INFO",z[z.DEBUG=20]="DEBUG"}(H||(H={}));let K=10;function s(z,G="Magenta.js",V=10){if(0===V)throw Error("Logging level cannot be NONE.");K>=V&&(5===V?console.warn:console.log)(`%c ${G} `,"background:magenta; color:white",z)}function a(z,G,V="Magenta.js",H=10){s(`${z} in ${((W.d.now()-G)/1e3).toPrecision(3)}s`,V,H)}},,function(z,G,V){(function(z){V.d(G,"a",(function(){return W})),V.d(G,"d",(function(){return K})),V.d(G,"c",(function(){return Z})),V.d(G,"b",(function(){return u}));const H=function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==z)return z;throw new Error("cannot find the global object")}(),W=H.fetch.bind(H),K=H.performance,Z=(H.navigator,!!H.webkitOfflineAudioContext),it=void 0!==H.WorkerGlobalScope;function u(z){if(z=Z?44100:z,it)throw new Error("Cannot use offline audio context in a web worker.");const G=H.webkitOfflineAudioContext;return Z?new G(1,z,z):new H.OfflineAudioContext(1,z,z)}}).call(this,V(9))},function(z,G,V){V.r(G),V.d(G,"MultipleTimeSignatureException",(function(){return o})),V.d(G,"BadTimeSignatureException",(function(){return s})),V.d(G,"NegativeTimeException",(function(){return a})),V.d(G,"MultipleTempoException",(function(){return u})),V.d(G,"QuantizationStatusException",(function(){return c})),V.d(G,"clone",(function(){return l})),V.d(G,"stepsPerQuarterToStepsPerSecond",(function(){return h})),V.d(G,"quantizeToStep",(function(){return p})),V.d(G,"quantizeNoteSequence",(function(){return d})),V.d(G,"isQuantizedSequence",(function(){return g})),V.d(G,"assertIsQuantizedSequence",(function(){return S})),V.d(G,"isRelativeQuantizedSequence",(function(){return y})),V.d(G,"assertIsRelativeQuantizedSequence",(function(){return b})),V.d(G,"isAbsoluteQuantizedSequence",(function(){return w})),V.d(G,"assertIsAbsoluteQuantizedSequence",(function(){return P})),V.d(G,"unquantizeSequence",(function(){return v})),V.d(G,"createQuantizedNoteSequence",(function(){return N})),V.d(G,"mergeInstruments",(function(){return T})),V.d(G,"replaceInstruments",(function(){return O})),V.d(G,"mergeConsecutiveNotes",(function(){return I})),V.d(G,"concatenate",(function(){return M})),V.d(G,"trim",(function(){return A})),V.d(G,"split",(function(){return E}));var H=V(2),W=V(1);class o extends Error{constructor(z){super(z),Object.setPrototypeOf(this,new.target.prototype)}}class s extends Error{constructor(z){super(z),Object.setPrototypeOf(this,new.target.prototype)}}class a extends Error{constructor(z){super(z),Object.setPrototypeOf(this,new.target.prototype)}}class u extends Error{constructor(z){super(z),Object.setPrototypeOf(this,new.target.prototype)}}class c extends Error{constructor(z){super(z),Object.setPrototypeOf(this,new.target.prototype)}}function l(z){return H.a.decode(H.a.encode(z).finish())}function h(z,G){return z*G/60}function p(z,G,V=.5){const H=z*G;return Math.floor(H+(1-V))}function f(z){return z.controlChanges.concat(z.textAnnotations)}function m(z){if(z.tempos&&0!==z.tempos.length){if(z.tempos.sort(((z,G)=>z.time-G.time)),0!==z.tempos[0].time&&z.tempos[0].qpm!==W.DEFAULT_QUARTERS_PER_MINUTE)throw new u("NoteSequence has an implicit tempo change from initial "+W.DEFAULT_QUARTERS_PER_MINUTE+" qpm to "+`${z.tempos[0].qpm} qpm at ${z.tempos[0].time} seconds.`);for(let G=1;G<z.tempos.length;G++)if(z.tempos[G].qpm!==z.tempos[0].qpm)throw new u(`NoteSequence has at least one tempo change from ${z.tempos[0].qpm} qpm to ${z.tempos[G].qpm}qpm at ${z.tempos[G].time} seconds.`)}}function d(z,G){const V=l(z);if(V.quantizationInfo=H.a.QuantizationInfo.create({stepsPerQuarter:G}),V.timeSignatures.length>0){if(V.timeSignatures.sort(((z,G)=>z.time-G.time)),0!==V.timeSignatures[0].time&&(4!==V.timeSignatures[0].numerator||4!==V.timeSignatures[0].denominator))throw new o(`NoteSequence has an implicit change from initial 4/4 time signature to ${V.timeSignatures[0].numerator}/`+V.timeSignatures[0].denominator+" at "+V.timeSignatures[0].time+" seconds.");for(let z=1;z<V.timeSignatures.length;z++){const G=V.timeSignatures[z];if(G.numerator!==V.timeSignatures[0].numerator||G.denominator!==V.timeSignatures[0].denominator)throw new o("NoteSequence has at least one time signature change from "+V.timeSignatures[0].numerator+"/"+V.timeSignatures[0].denominator+" to "+`${G.numerator}/${G.denominator} `+`at ${G.time} seconds`)}V.timeSignatures[0].time=0,V.timeSignatures=[V.timeSignatures[0]]}else{const z=H.a.TimeSignature.create({numerator:4,denominator:4,time:0});V.timeSignatures.push(z)}const K=V.timeSignatures[0];if(!(Z=K.denominator)||0!=(Z&Z-1))throw new s(`Denominator is not a power of 2. Time signature: ${K.numerator}/${K.denominator}`);var Z;if(0===K.numerator)throw new s(`Numerator is 0. Time signature: ${K.numerator}/${K.denominator}`);if(V.tempos.length>0)m(V),V.tempos[0].time=0,V.tempos=[V.tempos[0]];else{const z=H.a.Tempo.create({qpm:W.DEFAULT_QUARTERS_PER_MINUTE,time:0});V.tempos.push(z)}const it=h(G,V.tempos[0].qpm);return V.totalQuantizedSteps=p(z.totalTime,it),function(z,G){for(const V of z.notes){if(V.quantizedStartStep=p(V.startTime,G),V.quantizedEndStep=p(V.endTime,G),V.quantizedEndStep===V.quantizedStartStep&&(V.quantizedEndStep+=1),V.quantizedStartStep<0||V.quantizedEndStep<0)throw new a("Got negative note time: start_step = "+V.quantizedStartStep+", end_step = "+V.quantizedEndStep);V.quantizedEndStep>z.totalQuantizedSteps&&(z.totalQuantizedSteps=V.quantizedEndStep)}f(z).forEach((z=>{if(z.quantizedStep=p(z.time,G),z.quantizedStep<0)throw new a("Got negative event time: step = "+z.quantizedStep)}))}(V,it),V}function g(z){return z.quantizationInfo&&(z.quantizationInfo.stepsPerQuarter>0||z.quantizationInfo.stepsPerSecond>0)}function S(z){if(!g(z))throw new c(`NoteSequence ${z.id} is not quantized (missing quantizationInfo)`)}function y(z){return z.quantizationInfo&&z.quantizationInfo.stepsPerQuarter>0}function b(z){if(!y(z))throw new c(`NoteSequence ${z.id} is not quantized or is quantized based on absolute timing`)}function w(z){return z.quantizationInfo&&z.quantizationInfo.stepsPerSecond>0}function P(z){if(!w(z))throw new c(`NoteSequence ${z.id} is not quantized or is quantized based on relative timing`)}function v(z,G){b(z),m(z);const V=l(z);G?V.tempos&&V.tempos.length>0?V.tempos[0].qpm=G:V.tempos.push(H.a.Tempo.create({time:0,qpm:G})):G=z.tempos&&z.tempos.length>0?V.tempos[0].qpm:W.DEFAULT_QUARTERS_PER_MINUTE;const o=z=>z/V.quantizationInfo.stepsPerQuarter*(60/G);return V.totalTime=o(V.totalQuantizedSteps),V.notes.forEach((z=>{z.startTime=o(z.quantizedStartStep),z.endTime=o(z.quantizedEndStep),V.totalTime=Math.max(V.totalTime,z.endTime),delete z.quantizedStartStep,delete z.quantizedEndStep})),f(V).forEach((z=>{z.time=o(z.time)})),delete V.totalQuantizedSteps,delete V.quantizationInfo,V}function N(z=W.DEFAULT_STEPS_PER_QUARTER,G=W.DEFAULT_QUARTERS_PER_MINUTE){return H.a.create({quantizationInfo:{stepsPerQuarter:z},tempos:[{qpm:G}]})}function T(z){const G=l(z),V=G.notes.concat(G.pitchBends).concat(G.controlChanges),H=Array.from(new Set(V.filter((z=>!z.isDrum)).map((z=>z.program))));return V.forEach((z=>{z.isDrum?(z.program=0,z.instrument=H.length):z.instrument=H.indexOf(z.program)})),G}function O(z,G){const V=new Set(z.notes.map((z=>z.instrument))),W=new Set(G.notes.map((z=>z.instrument))),K=[];z.notes.forEach((z=>{W.has(z.instrument)||K.push(H.a.Note.create(z))})),G.notes.forEach((z=>{V.has(z.instrument)&&K.push(H.a.Note.create(z))}));const Z=l(z);return Z.notes=K.sort(((z,G)=>z.instrument-G.instrument||z.quantizedStartStep-G.quantizedStartStep)),Z}function I(z){S(z);const G=l(z);G.notes=[];const V=z.notes.sort(((z,G)=>z.instrument-G.instrument||z.quantizedStartStep-G.quantizedStartStep)),W=new H.a.Note;W.pitch=V[0].pitch,W.instrument=V[0].instrument,W.quantizedStartStep=V[0].quantizedStartStep,W.quantizedEndStep=V[0].quantizedEndStep,G.notes.push(W);let K=0;for(let z=1;z<V.length;z++){const W=V[z],Z=G.notes[K];if(Z.instrument===W.instrument&&Z.pitch===W.pitch&&W.quantizedStartStep===Z.quantizedEndStep&&W.quantizedStartStep%16!=0)G.notes[K].quantizedEndStep+=W.quantizedEndStep-W.quantizedStartStep;else{const W=new H.a.Note;W.pitch=V[z].pitch,W.instrument=V[z].instrument,W.quantizedStartStep=V[z].quantizedStartStep,W.quantizedEndStep=V[z].quantizedEndStep,G.notes.push(W),K++}}return G}function M(z,G){if(G&&G.length!==z.length)throw new Error("Number of sequences to concatenate and their individual\n durations does not match.");if(g(z[0])){for(let G=0;G<z.length;++G)if(S(z[G]),z[G].quantizationInfo.stepsPerQuarter!==z[0].quantizationInfo.stepsPerQuarter)throw new Error("Not all sequences have the same quantizationInfo");return k(z,"totalQuantizedSteps","quantizedStartStep","quantizedEndStep",G)}return k(z,"totalTime","startTime","endTime",G)}function A(z,G,V,H){return g(z)?q(z,G,V,"totalQuantizedSteps","quantizedStartStep","quantizedEndStep",H):q(z,G,V,"totalTime","startTime","endTime",H)}function k(z,G,V,W,K){let Z,it=0;for(let ot=0;ot<z.length;++ot){const rt=K?K[ot]:z[ot][G];if(0===rt)throw Error(`Sequence ${z[ot].id} has no ${G}, and no individual duration was provided.`);0===ot?Z=l(z[0]):Array.prototype.push.apply(Z.notes,z[ot].notes.map((z=>{const G=H.a.Note.create(z);return G[V]+=it,G[W]+=it,G}))),it+=rt}return Z[G]=it,Z}function q(z,G,V,H,W,K,Z){const it=l(z);it[H]=V,it.notes=it.notes.filter((z=>z[W]>=G&&z[W]<=V&&(Z||z[K]<=V))),it[H]-=G;for(let z=0;z<it.notes.length;z++)it.notes[z][W]-=G,it.notes[z][K]-=G,Z&&(it.notes[z][K]=Math.min(it.notes[z][K],it[H]));return it}function E(z,G){S(z);const V=l(z),W=V.notes.sort(((z,G)=>z.quantizedStartStep-G.quantizedStartStep)),K=[];let Z=0,it=[];for(let z=0;z<W.length;z++){const ot=W[z],rt=ot.quantizedStartStep,at=ot.quantizedEndStep;if(ot.quantizedStartStep-=Z,ot.quantizedEndStep-=Z,!(ot.quantizedStartStep<0))if(ot.quantizedEndStep<=G)it.push(ot);else{if(ot.quantizedStartStep<G){const z=H.a.Note.create(ot);z.quantizedEndStep=G,z.startTime=z.endTime=void 0,it.push(z),ot.quantizedStartStep=Z+G,ot.quantizedEndStep=at}else ot.quantizedStartStep=rt,ot.quantizedEndStep=at;if((ot.quantizedEndStep>G||ot.quantizedStartStep>G)&&(z-=1),0!==it.length){const z=l(V);z.notes=it,z.totalQuantizedSteps=G,K.push(z)}it=[],Z+=G}}if(0!==it.length){const z=l(V);z.notes=it,z.totalQuantizedSteps=G,K.push(z)}return K}},function(z,G,V){(function(z){var H=G;function i(z,G,V){for(var H=Object.keys(G),W=0;W<H.length;++W)void 0!==z[H[W]]&&V||(z[H[W]]=G[H[W]]);return z}function o(z){function e(z,G){if(!(this instanceof e))return new e(z,G);Object.defineProperty(this,"message",{get:function(){return z}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),G&&i(this,G)}return(e.prototype=Object.create(Error.prototype)).constructor=e,Object.defineProperty(e.prototype,"name",{get:function(){return z}}),e.prototype.toString=function(){return this.name+": "+this.message},e}H.asPromise=V(22),H.base64=V(23),H.EventEmitter=V(24),H.float=V(25),H.inquire=V(26),H.utf8=V(27),H.pool=V(28),H.LongBits=V(29),H.isNode=Boolean(void 0!==z&&z&&z.process&&z.process.versions&&z.process.versions.node),H.global=H.isNode&&z||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,H.emptyArray=Object.freeze?Object.freeze([]):[],H.emptyObject=Object.freeze?Object.freeze({}):{},H.isInteger=Number.isInteger||function(z){return"number"==typeof z&&isFinite(z)&&Math.floor(z)===z},H.isString=function(z){return"string"==typeof z||z instanceof String},H.isObject=function(z){return z&&"object"==typeof z},H.isset=H.isSet=function(z,G){var V=z[G];return!(null==V||!z.hasOwnProperty(G))&&("object"!=typeof V||(Array.isArray(V)?V.length:Object.keys(V).length)>0)},H.Buffer=function(){try{var z=H.inquire("buffer").Buffer;return z.prototype.utf8Write?z:null}catch(z){return null}}(),H._Buffer_from=null,H._Buffer_allocUnsafe=null,H.newBuffer=function(z){return"number"==typeof z?H.Buffer?H._Buffer_allocUnsafe(z):new H.Array(z):H.Buffer?H._Buffer_from(z):"undefined"==typeof Uint8Array?z:new Uint8Array(z)},H.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,H.Long=H.global.dcodeIO&&H.global.dcodeIO.Long||H.global.Long||H.inquire("long"),H.key2Re=/^true|false|0|1$/,H.key32Re=/^-?(?:0|[1-9][0-9]*)$/,H.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,H.longToHash=function(z){return z?H.LongBits.from(z).toHash():H.LongBits.zeroHash},H.longFromHash=function(z,G){var V=H.LongBits.fromHash(z);return H.Long?H.Long.fromBits(V.lo,V.hi,G):V.toNumber(Boolean(G))},H.merge=i,H.lcFirst=function(z){return z.charAt(0).toLowerCase()+z.substring(1)},H.newError=o,H.ProtocolError=o("ProtocolError"),H.oneOfGetter=function(z){for(var G={},V=0;V<z.length;++V)G[z[V]]=1;return function(){for(var z=Object.keys(this),V=z.length-1;V>-1;--V)if(1===G[z[V]]&&void 0!==this[z[V]]&&null!==this[z[V]])return z[V]}},H.oneOfSetter=function(z){return function(G){for(var V=0;V<z.length;++V)z[V]!==G&&delete this[z[V]]}},H.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},H._configure=function(){var z=H.Buffer;z?(H._Buffer_from=z.from!==Uint8Array.from&&z.from||function(G,V){return new z(G,V)},H._Buffer_allocUnsafe=z.allocUnsafe||function(G){return new z(G)}):H._Buffer_from=H._Buffer_allocUnsafe=null}}).call(this,V(9))},function(z,G){var V;V=function(){return this}();try{V=V||new Function("return this")()}catch(z){"object"==typeof window&&(V=window)}z.exports=V},function(z,G,V){V.r(G),V.d(G,"NO_EVENT",(function(){return Z})),V.d(G,"NOTE_OFF",(function(){return it})),V.d(G,"Melody",(function(){return u})),V.d(G,"MelodyRhythm",(function(){return c})),V.d(G,"MelodyShape",(function(){return l})),V.d(G,"MelodyRegister",(function(){return h}));var H=V(0),W=V(2),K=V(7);const Z=0,it=1;class u{constructor(z,G,V){this.events=z,this.minPitch=G,this.maxPitch=V}static fromNoteSequence(z,G,V,H=!0,W){K.assertIsQuantizedSequence(z);const Z=z.notes.sort(((z,G)=>z.quantizedStartStep===G.quantizedStartStep?G.pitch-z.pitch:z.quantizedStartStep-G.quantizedStartStep)),ot=new Int32Array(W||z.totalQuantizedSteps);let rt=-1;return Z.forEach((z=>{if(z.quantizedStartStep===rt){if(H)return;throw new Error("`NoteSequence` is not monophonic.")}if(z.pitch<G||z.pitch>V)throw Error("`NoteSequence` has a pitch outside of the valid range: "+z.pitch);ot[z.quantizedStartStep]=z.pitch-G+2,ot[z.quantizedEndStep]=it,rt=z.quantizedStartStep})),new u(ot,G,V)}toNoteSequence(z,G){const V=K.createQuantizedNoteSequence(z,G);let H=null;for(let z=0;z<this.events.length;++z){const G=this.events[z];switch(G){case Z:break;case it:H&&(H.quantizedEndStep=z,V.notes.push(H),H=null);break;default:H&&(H.quantizedEndStep=z,V.notes.push(H)),H=W.a.Note.create({pitch:G-2+this.minPitch,quantizedStartStep:z})}}return H&&(H.quantizedEndStep=this.events.length,V.notes.push(H)),V.totalQuantizedSteps=this.events.length,V}}class c{constructor(){this.depth=1}extract(z){const G=z.events.length,V=H.buffer([G,1]);for(let H=0;H<G;++H)V.set(z.events[H]>=2?1:0,H,0);return V.toTensor().as2D(G,1)}}class l{constructor(){this.depth=3}extract(z){const G=z.events.length,V=H.buffer([G,3]);let W=null,K=null;for(let H=0;H<G;++H)if(z.events[H]>=2){if(null!==W){let G;0===V.get(W,0)&&0===V.get(W,1)&&0===V.get(W,2)&&(W=-1),G=z.events[H]<K?0:z.events[H]>K?2:1;for(let z=H;z>W;--z)V.set(1,z,G)}W=H,K=z.events[H]}if(W!==G-1)if(null===W||0===V.get(W,0)&&0===V.get(W,1)&&0===V.get(W,2))for(let z=0;z<G;++z)V.set(1,z,1);else for(let z=G-1;z>W;--z)for(let G=0;G<3;G++)V.set(V.get(W,G),z,G);return V.toTensor().as2D(G,3)}}class h{constructor(z){this.boundaryPitches=z,this.depth=z.length+1}meanMelodyPitch(z){let G=0,V=0,H=null;for(let W=0;W<z.events.length;++W)z.events[W]===it?H=null:z.events[W]>=2&&(H=z.minPitch+z.events[W]-2),null!==H&&(G+=H,V+=1);return V?G/V:null}extract(z){const G=z.events.length,V=this.meanMelodyPitch(z);if(null===V)return H.zeros([G,this.depth]);let W=0;for(;W<this.boundaryPitches.length&&V>=this.boundaryPitches[W];)W++;const K=H.buffer([G,this.depth]);for(let z=0;z<G;++z)K.set(1,z,W);return K.toTensor().as2D(G,this.depth)}}},,function(z,G,V){V.r(G),V.d(G,"DEFAULT_DRUM_PITCH_CLASSES",(function(){return at})),V.d(G,"converterFromSpec",(function(){return h})),V.d(G,"DataConverter",(function(){return p})),V.d(G,"DrumsConverter",(function(){return f})),V.d(G,"DrumRollConverter",(function(){return m})),V.d(G,"DrumsOneHotConverter",(function(){return d})),V.d(G,"MelodyConverter",(function(){return g})),V.d(G,"MelodyRhythmConverter",(function(){return y})),V.d(G,"MelodyShapeConverter",(function(){return b})),V.d(G,"TrioConverter",(function(){return w})),V.d(G,"MultitrackConverter",(function(){return P})),V.d(G,"GrooveConverter",(function(){return v}));var H=V(0),W=V(2),K=V(1),Z=V(4),it=V(10),ot=V(13),rt=V(7);const at=[[36,35],[38,27,28,31,32,33,34,37,39,40,56,65,66,75,85],[42,44,54,68,69,70,71,73,78,80],[46,67,72,74,79,81],[45,29,41,61,64,84],[48,47,60,63,77,86,87],[50,30,43,62,76,83],[49,55,57,58],[51,52,53,59,82]];function h(z){switch(z.type){case"MelodyConverter":return new g(z.args);case"MelodyRhythmConverter":return new y(z.args);case"MelodyShapeConverter":return new b(z.args);case"DrumsConverter":return new f(z.args);case"DrumRollConverter":return new m(z.args);case"TrioConverter":return new w(z.args);case"DrumsOneHotConverter":return new d(z.args);case"MultitrackConverter":return new P(z.args);case"GrooveConverter":return new v(z.args);default:throw new Error("Unknown DataConverter type: "+z)}}class p{constructor(z){this.NUM_SPLITS=0,this.SEGMENTED_BY_TRACK=!1,this.numSteps=z.numSteps,this.numSegments=z.numSegments}tensorSteps(z){return H.scalar(z.shape[0],"int32")}}class f extends p{constructor(z){super(z),this.pitchClasses=z.pitchClasses||at,this.pitchToClass=new Map;for(let z=0;z<this.pitchClasses.length;++z)this.pitchClasses[z].forEach((G=>{this.pitchToClass.set(G,z)}));this.depth=this.pitchClasses.length+1}toTensor(z){rt.assertIsQuantizedSequence(z);const G=this.numSteps||z.totalQuantizedSteps,V=H.buffer([G,this.pitchClasses.length+1],"int32");for(let z=0;z<G;++z)V.set(1,z,-1);return z.notes.forEach((z=>{V.set(1,z.quantizedStartStep,this.pitchToClass.get(z.pitch)),V.set(0,z.quantizedStartStep,-1)})),V.toTensor()}async toNoteSequence(z,G,V){const H=rt.createQuantizedNoteSequence(G,V),K=z.argMax(1),Z=await K.data();K.dispose();for(let z=0;z<Z.length;++z)for(let G=0;G<this.pitchClasses.length;G++)Z[z]>>G&1&&H.notes.push(W.a.Note.create({pitch:this.pitchClasses[G][0],quantizedStartStep:z,quantizedEndStep:z+1,isDrum:!0}));return H.totalQuantizedSteps=Z.length,H}}class m extends f{async toNoteSequence(z,G,V){const H=rt.createQuantizedNoteSequence(G,V),K=await z.data();for(let G=0;G<z.shape[0];++G){const z=K.slice(G*this.pitchClasses.length,(G+1)*this.pitchClasses.length);for(let V=0;V<z.length;++V)z[V]&&H.notes.push(W.a.Note.create({pitch:this.pitchClasses[V][0],quantizedStartStep:G,quantizedEndStep:G+1,isDrum:!0}))}return H.totalQuantizedSteps=z.shape[0],H}}class d extends f{constructor(z){super(z),this.depth=Math.pow(2,this.pitchClasses.length)}toTensor(z){rt.assertIsRelativeQuantizedSequence(z);const G=this.numSteps||z.totalQuantizedSteps,V=Array(G).fill(0);for(const{pitch:G,quantizedStartStep:H}of z.notes)V[H]+=Math.pow(2,this.pitchToClass.get(G));return H.tidy((()=>H.oneHot(H.tensor1d(V,"int32"),this.depth)))}}class g extends p{constructor(z){super(z),this.NOTE_OFF=1,this.FIRST_PITCH=2,this.minPitch=z.minPitch,this.maxPitch=z.maxPitch,this.ignorePolyphony=z.ignorePolyphony,this.depth=z.maxPitch-z.minPitch+1+this.FIRST_PITCH}toTensor(z){const G=it.Melody.fromNoteSequence(z,this.minPitch,this.maxPitch,this.ignorePolyphony,this.numSteps);return H.tidy((()=>H.oneHot(H.tensor(G.events,[G.events.length],"int32"),this.depth)))}async toNoteSequence(z,G,V){const H=z.argMax(1),W=await H.data();return H.dispose(),new it.Melody(W,this.minPitch,this.maxPitch).toNoteSequence(G,V)}}class S extends p{constructor(z,G){super(z),this.minPitch=z.minPitch,this.maxPitch=z.maxPitch,this.ignorePolyphony=z.ignorePolyphony,this.melodyControl=G,this.depth=G.depth}toTensor(z){const G=it.Melody.fromNoteSequence(z,this.minPitch,this.maxPitch,this.ignorePolyphony,this.numSteps);return this.melodyControl.extract(G)}}class y extends S{constructor(z){super(z,new it.MelodyRhythm)}async toNoteSequence(z,G,V){const H=rt.createQuantizedNoteSequence(G,V),K=await z.data();for(let z=0;z<K.length;++z)K[z]&&H.notes.push(W.a.Note.create({pitch:at[1][0],quantizedStartStep:z,quantizedEndStep:z+1,isDrum:!0}));return H.totalQuantizedSteps=K.length,H}}class b extends S{constructor(z){super(z,new it.MelodyShape)}async toNoteSequence(z,G,V){const H=rt.createQuantizedNoteSequence(G,V),K=z.argMax(1),it=await K.data();K.dispose();let ot=Math.round((this.maxPitch+this.minPitch)/2);for(let z=0;z<it.length;++z){switch(it[z]){case 0:ot-=1,ot<this.minPitch&&(ot=this.minPitch,Z.log("Pitch range exceeded when creating NoteSequence from shape.","MelodyShapeConverter"));break;case 2:ot+=1,ot>this.maxPitch&&(ot=this.maxPitch,Z.log("Pitch range exceeded when creating NoteSequence from shape.","MelodyShapeConverter"))}H.notes.push(W.a.Note.create({pitch:ot,quantizedStartStep:z,quantizedEndStep:z+1}))}return H.totalQuantizedSteps=it.length,H}}class w extends p{constructor(z){super(z),this.NUM_SPLITS=3,this.MEL_PROG_RANGE=[0,31],this.BASS_PROG_RANGE=[32,39],z.melArgs.numSteps=z.numSteps,z.bassArgs.numSteps=z.numSteps,z.drumsArgs.numSteps=z.numSteps,this.melConverter=new g(z.melArgs),this.bassConverter=new g(z.bassArgs),this.drumsConverter=new d(z.drumsArgs),this.depth=this.melConverter.depth+this.bassConverter.depth+this.drumsConverter.depth}toTensor(z){rt.assertIsQuantizedSequence(z);const G=rt.clone(z),V=rt.clone(z),W=rt.clone(z);return G.notes=z.notes.filter((z=>!z.isDrum&&z.program>=this.MEL_PROG_RANGE[0]&&z.program<=this.MEL_PROG_RANGE[1])),V.notes=z.notes.filter((z=>!z.isDrum&&z.program>=this.BASS_PROG_RANGE[0]&&z.program<=this.BASS_PROG_RANGE[1])),W.notes=z.notes.filter((z=>z.isDrum)),H.tidy((()=>H.concat([this.melConverter.toTensor(G),this.bassConverter.toTensor(V),this.drumsConverter.toTensor(W)],-1)))}async toNoteSequence(z,G,V){const W=H.split(z,[this.melConverter.depth,this.bassConverter.depth,this.drumsConverter.depth],-1),K=await this.melConverter.toNoteSequence(W[0],G,V);K.notes.forEach((z=>{z.instrument=0,z.program=0}));const Z=await this.bassConverter.toNoteSequence(W[1],G,V);K.notes.push(...Z.notes.map((z=>(z.instrument=1,z.program=this.BASS_PROG_RANGE[0],z))));const it=await this.drumsConverter.toNoteSequence(W[2],G,V);return K.notes.push(...it.notes.map((z=>(z.instrument=2,z)))),W.forEach((z=>z.dispose())),K}}class P extends p{constructor(z){super(z),this.SEGMENTED_BY_TRACK=!0,this.stepsPerQuarter=z.stepsPerQuarter,this.totalSteps=z.totalSteps,this.numVelocityBins=z.numVelocityBins,this.minPitch=z.minPitch?z.minPitch:K.MIN_MIDI_PITCH,this.maxPitch=z.maxPitch?z.maxPitch:K.MAX_MIDI_PITCH,this.numPitches=this.maxPitch-this.minPitch+1,this.performanceEventDepth=2*this.numPitches+this.totalSteps+this.numVelocityBins,this.numPrograms=K.MAX_MIDI_PROGRAM-K.MIN_MIDI_PROGRAM+2,this.endToken=this.performanceEventDepth+this.numPrograms,this.depth=this.endToken+1,this.endTensor=H.tidy((()=>H.oneHot(H.tensor1d([this.endToken],"int32"),this.depth).as1D()))}trackToTensor(z){const G=this.numSteps/this.numSegments;let V;if(z){for(;z.events.length>G-2;)z.events.pop();V=H.buffer([z.events.length+2],"int32"),V.set(this.performanceEventDepth+(z.isDrum?this.numPrograms-1:z.program),0),z.events.forEach(((z,G)=>{switch(z.type){case"note-on":V.set(z.pitch-this.minPitch,G+1);break;case"note-off":V.set(this.numPitches+z.pitch-this.minPitch,G+1);break;case"time-shift":V.set(2*this.numPitches+z.steps-1,G+1);break;case"velocity-change":V.set(2*this.numPitches+this.totalSteps+z.velocityBin-1,G+1);break;default:throw new Error("Unrecognized performance event: "+z)}})),V.set(this.endToken,z.events.length+1)}else V=H.buffer([1],"int32",new Int32Array([this.endToken]));return H.tidy((()=>{const z=H.oneHot(V.toTensor(),this.depth);return z.pad([[0,G-z.shape[0]],[0,0]])}))}toTensor(z){if(rt.assertIsRelativeQuantizedSequence(z),z.quantizationInfo.stepsPerQuarter!==this.stepsPerQuarter)throw new Error(`Steps per quarter note mismatch: ${z.quantizationInfo.stepsPerQuarter} != ${this.stepsPerQuarter}`);const G=rt.clone(z);G.notes=z.notes.filter((z=>z.pitch>=this.minPitch&&z.pitch<=this.maxPitch));const V=new Set(G.notes.map((z=>z.instrument))),W=Array.from(V).map((z=>ot.Performance.fromNoteSequence(G,this.totalSteps,this.numVelocityBins,z))).sort(((z,G)=>G.isDrum?-1:z.isDrum?1:z.program-G.program));for(;W.length>this.numSegments;)W.pop();for(W.forEach((z=>z.setNumSteps(this.totalSteps)));W.length<this.numSegments;)W.push(void 0);return H.tidy((()=>H.concat(W.map((z=>this.trackToTensor(z))),0)))}tokensToTrack(z){const G=z.indexOf(this.endToken),V=G>=0?G:z.length,H=z.slice(0,V),W=H.filter((z=>z<this.performanceEventDepth)),K=H.filter((z=>z>=this.performanceEventDepth)),[Z,it]=K.length?K[0]-this.performanceEventDepth<this.numPrograms-1?[K[0]-this.performanceEventDepth,!1]:[0,!0]:[0,!1],rt=Array.from(W).map((z=>{if(z<this.numPitches)return{type:"note-on",pitch:this.minPitch+z};if(z<2*this.numPitches)return{type:"note-off",pitch:this.minPitch+z-this.numPitches};if(z<2*this.numPitches+this.totalSteps)return{type:"time-shift",steps:z-2*this.numPitches+1};if(z<2*this.numPitches+this.totalSteps+this.numVelocityBins)return{type:"velocity-change",velocityBin:z-2*this.numPitches-this.totalSteps+1};throw new Error("Invalid performance event token: "+z)}));return new ot.Performance(rt,this.totalSteps,this.numVelocityBins,Z,it)}async toNoteSequence(z,G=this.stepsPerQuarter,V){const W=rt.createQuantizedNoteSequence(G,V);W.totalQuantizedSteps=this.totalSteps;const K=H.tidy((()=>H.split(z.argMax(1),this.numSegments)));return(await Promise.all(K.map((async z=>{const G=await z.data(),V=this.tokensToTrack(G);return z.dispose(),V})))).forEach(((z,G)=>{z.setNumSteps(this.totalSteps),W.notes.push(...z.toNoteSequence(G).notes)})),W}}class v extends p{constructor(z){super(z),this.TAPIFY_CHANNEL=3,this.stepsPerQuarter=z.stepsPerQuarter||K.DEFAULT_STEPS_PER_QUARTER,this.pitchClasses=z.pitchClasses||at,this.pitchToClass=new Map;for(let z=0;z<this.pitchClasses.length;++z)this.pitchClasses[z].forEach((G=>{this.pitchToClass.set(G,z)}));this.humanize=z.humanize||!1,this.tapify=z.tapify||!1,this.splitInstruments=z.splitInstruments||!1,this.depth=3}toTensor(z){const G=rt.isRelativeQuantizedSequence(z)?z:rt.quantizeNoteSequence(z,this.stepsPerQuarter),V=this.numSteps,W=G.tempos&&G.tempos.length?G.tempos[0].qpm:K.DEFAULT_QUARTERS_PER_MINUTE,Z=60/W/this.stepsPerQuarter,it=[];for(let z=0;z<V;++z)it.push(new Map);G.notes.forEach((z=>{if(!this.tapify&&!this.pitchToClass.has(z.pitch))return;const G=z.quantizedStartStep;if(G>=it.length)throw Error(`Model does not support sequences with more than ${V} steps (${V*Z} seconds at qpm ${W}).`);const H=this.tapify?this.TAPIFY_CHANNEL:this.pitchToClass.get(z.pitch);(!it[G].has(H)||it[G].get(H).velocity<z.velocity)&&it[G].set(H,z)}));const ot=this.pitchClasses.length,at=H.buffer([V,ot]),ut=H.buffer([V,ot]),lt=H.buffer([V,ot]);function f(z){if(void 0===z.startTime)return 0;const G=z.startTime;return 2*(z.quantizedStartStep*Z-G)/Z}for(let z=0;z<V;++z)for(let G=0;G<ot;++G){const V=it[z].get(G);at.set(V?1:0,z,G),this.humanize||this.tapify||ut.set(V?V.velocity/K.MAX_MIDI_VELOCITY:0,z,G),this.humanize||lt.set(V?f(V):0,z,G)}return H.tidy((()=>{const z=at.toTensor(),G=ut.toTensor(),W=lt.toTensor(),K=this.splitInstruments?V*ot:V;return H.concat([z.as2D(K,-1),G.as2D(K,-1),W.as2D(K,-1)],1)}))}async toNoteSequence(z,G,V=K.DEFAULT_QUARTERS_PER_MINUTE){if(G&&G!==this.stepsPerQuarter)throw Error("`stepsPerQuarter` is set by the model.");G=this.stepsPerQuarter;const H=this.splitInstruments?z.shape[0]/this.pitchClasses.length:z.shape[0],Z=60/V/this.stepsPerQuarter,it=W.a.create({totalTime:H*Z,tempos:[{qpm:V}]}),ot=await z.data();function c(z,G,V){return Math.min(Math.max(z,G),V)}const rt=this.pitchClasses.length;for(let z=0;z<H;++z){const G=ot.slice(z*rt*this.depth,(z+1)*rt*this.depth);for(let V=0;V<rt;++V){const H=G[this.splitInstruments?V*this.depth:V],ot=G[this.splitInstruments?V*this.depth+1:rt+V],at=G[this.splitInstruments?V*this.depth+2:2*rt+V];if(H>.5){const G=c(Math.round(ot*K.MAX_MIDI_VELOCITY),K.MIN_MIDI_VELOCITY,K.MAX_MIDI_VELOCITY),H=c(at/2,-.5,.5);it.notes.push(W.a.Note.create({pitch:this.pitchClasses[V][0],startTime:(z-H)*Z,endTime:(z-H+1)*Z,velocity:G,isDrum:!0}))}}}return it}}},function(z,G,V){V.r(G),V.d(G,"Performance",(function(){return a}));var H=V(2),W=V(1),K=V(7),Z=V(4);class a{constructor(z,G,V,H,W){this.events=z,this.maxShiftSteps=G,this.numVelocityBins=V,this.program=H,this.isDrum=W}static fromNoteSequence(z,G,V,H){K.assertIsQuantizedSequence(z);const Z=z.notes.filter(((z,G)=>void 0===H||z.instrument===H)),it=Z.sort(((z,G)=>z.startTime===G.startTime?z.pitch-G.pitch:z.startTime-G.startTime)),ot=it.map(((z,G)=>({step:z.quantizedStartStep,index:G,isOffset:0}))),rt=it.map(((z,G)=>({step:z.quantizedEndStep,index:G,isOffset:1}))),at=ot.concat(rt).sort(((z,G)=>z.step===G.step?z.index===G.index?z.isOffset-G.isOffset:z.index-G.index:z.step-G.step)),ut=V?Math.ceil((W.MIDI_VELOCITIES-1)/V):void 0,lt=[];let ct=0,ht=V;for(const z of at){if(z.step>ct){for(;z.step>ct+G;)lt.push({type:"time-shift",steps:G}),ct+=G;lt.push({type:"time-shift",steps:z.step-ct}),ct=z.step}if(z.isOffset)lt.push({type:"note-off",pitch:it[z.index].pitch});else{if(ut){const G=Math.floor((it[z.index].velocity-W.MIN_MIDI_VELOCITY-1)/ut)+1;G!==ht&&(lt.push({type:"velocity-change",velocityBin:G}),ht=G)}lt.push({type:"note-on",pitch:it[z.index].pitch})}}const pt=!!Z.some((z=>z.isDrum))&&(!Z.some((z=>!z.isDrum))||void 0),yt=Array.from(new Set(Z.map((z=>z.program)))),_t=pt||1!==yt.length?void 0:yt[0],vt=new a(lt,G,V,_t,pt);return vt.setNumSteps(z.totalQuantizedSteps),vt}getNumSteps(){return this.events.filter((z=>"time-shift"===z.type)).map((z=>z.steps)).reduce(((z,G)=>z+G),0)}setNumSteps(z){let G=this.getNumSteps();if(G<z){if(this.events.length){const V=this.events[this.events.length-1];if("time-shift"===V.type){const H=Math.min(z-G,this.maxShiftSteps-V.steps);V.steps+=H,G+=H}}for(;G<z;)G+this.maxShiftSteps>z?(this.events.push({type:"time-shift",steps:z-G}),G=z):(this.events.push({type:"time-shift",steps:this.maxShiftSteps}),G+=this.maxShiftSteps)}else if(G>z)for(;this.events.length&&G>z;){const V=this.events[this.events.length-1];"time-shift"===V.type?G-V.steps<z?(V.steps-=G-z,G=z):(this.events.pop(),G-=V.steps):this.events.pop()}}toNoteSequence(z){const G=this.numVelocityBins?Math.ceil((W.MIDI_VELOCITIES-1)/this.numVelocityBins):void 0,V=H.a.create();let K,it=0;const ot=new Map;for(let z=W.MIN_MIDI_PITCH;z<=W.MAX_MIDI_PITCH;++z)ot.set(z,[]);for(const rt of this.events)switch(rt.type){case"note-on":ot.get(rt.pitch).push([it,K]);break;case"note-off":const at=ot.get(rt.pitch);if(at.length){const[G,W]=at.shift();it>G?V.notes.push(H.a.Note.create({pitch:rt.pitch,velocity:W,instrument:z,quantizedStartStep:G,quantizedEndStep:it,program:this.program,isDrum:this.isDrum})):Z.log(`Ignoring zero-length note: (pitch = ${rt.pitch}, step = ${it})`,"Performance")}else Z.log(`Ignoring note-off with no previous note-on:(pitch = ${rt.pitch}, step = ${it})`,"Performance");break;case"time-shift":it+=rt.steps;break;case"velocity-change":if(!G)throw new Error("Unexpected velocity change event: "+rt);K=W.MIN_MIDI_VELOCITY+(rt.velocityBin-1)*G+1;break;default:throw new Error("Unrecognized performance event: "+rt)}return ot.forEach(((G,W)=>{for(const[K,ot]of G)it>K?V.notes.push(H.a.Note.create({pitch:W,velocity:ot,instrument:z,quantizedStartStep:K,quantizedEndStep:it,program:this.program,isDrum:this.isDrum})):Z.log(`Ignoring zero-length note: (pitch = ${W}, step = ${it})`,"Performance")})),V.totalQuantizedSteps=it,V}}},function(z,G,V){z.exports=h;var H,W=V(8),K=W.LongBits,Z=W.base64,it=W.utf8;function u(z,G,V){this.fn=z,this.len=G,this.next=void 0,this.val=V}function c(){}function l(z){this.head=z.head,this.tail=z.tail,this.len=z.len,this.next=z.states}function h(){this.len=0,this.head=new u(c,0,0),this.tail=this.head,this.states=null}var p=function(){return W.Buffer?function(){return(h.create=function(){return new H})()}:function(){return new h}};function f(z,G,V){G[V]=255&z}function m(z,G){this.len=z,this.next=void 0,this.val=G}function d(z,G,V){for(;z.hi;)G[V++]=127&z.lo|128,z.lo=(z.lo>>>7|z.hi<<25)>>>0,z.hi>>>=7;for(;z.lo>127;)G[V++]=127&z.lo|128,z.lo=z.lo>>>7;G[V++]=z.lo}function g(z,G,V){G[V]=255&z,G[V+1]=z>>>8&255,G[V+2]=z>>>16&255,G[V+3]=z>>>24}h.create=p(),h.alloc=function(z){return new W.Array(z)},W.Array!==Array&&(h.alloc=W.pool(h.alloc,W.Array.prototype.subarray)),h.prototype._push=function(z,G,V){return this.tail=this.tail.next=new u(z,G,V),this.len+=G,this},m.prototype=Object.create(u.prototype),m.prototype.fn=function(z,G,V){for(;z>127;)G[V++]=127&z|128,z>>>=7;G[V]=z},h.prototype.uint32=function(z){return this.len+=(this.tail=this.tail.next=new m((z>>>=0)<128?1:z<16384?2:z<2097152?3:z<268435456?4:5,z)).len,this},h.prototype.int32=function(z){return z<0?this._push(d,10,K.fromNumber(z)):this.uint32(z)},h.prototype.sint32=function(z){return this.uint32((z<<1^z>>31)>>>0)},h.prototype.uint64=function(z){var G=K.from(z);return this._push(d,G.length(),G)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(z){var G=K.from(z).zzEncode();return this._push(d,G.length(),G)},h.prototype.bool=function(z){return this._push(f,1,z?1:0)},h.prototype.fixed32=function(z){return this._push(g,4,z>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(z){var G=K.from(z);return this._push(g,4,G.lo)._push(g,4,G.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(z){return this._push(W.float.writeFloatLE,4,z)},h.prototype.double=function(z){return this._push(W.float.writeDoubleLE,8,z)};var ot=W.Array.prototype.set?function(z,G,V){G.set(z,V)}:function(z,G,V){for(var H=0;H<z.length;++H)G[V+H]=z[H]};h.prototype.bytes=function(z){var G=z.length>>>0;if(!G)return this._push(f,1,0);if(W.isString(z)){var V=h.alloc(G=Z.length(z));Z.decode(z,V,0),z=V}return this.uint32(G)._push(ot,G,z)},h.prototype.string=function(z){var G=it.length(z);return G?this.uint32(G)._push(it.write,G,z):this._push(f,1,0)},h.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new u(c,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new u(c,0,0),this.len=0),this},h.prototype.ldelim=function(){var z=this.head,G=this.tail,V=this.len;return this.reset().uint32(V),V&&(this.tail.next=z.next,this.tail=G,this.len+=V),this},h.prototype.finish=function(){for(var z=this.head.next,G=this.constructor.alloc(this.len),V=0;z;)z.fn(z.val,G,V),V+=z.len,z=z.next;return G},h._configure=function(z){H=z,h.create=p(),H._configure()}},function(z,G,V){z.exports=u;var H,W=V(8),K=W.LongBits,Z=W.utf8;function a(z,G){return RangeError("index out of range: "+z.pos+" + "+(G||1)+" > "+z.len)}function u(z){this.buf=z,this.pos=0,this.len=z.length}var it,ot="undefined"!=typeof Uint8Array?function(z){if(z instanceof Uint8Array||Array.isArray(z))return new u(z);throw Error("illegal buffer")}:function(z){if(Array.isArray(z))return new u(z);throw Error("illegal buffer")},h=function(){return W.Buffer?function(z){return(u.create=function(z){return W.Buffer.isBuffer(z)?new H(z):ot(z)})(z)}:ot};function p(){var z=new K(0,0),G=0;if(!(this.len-this.pos>4)){for(;G<3;++G){if(this.pos>=this.len)throw a(this);if(z.lo=(z.lo|(127&this.buf[this.pos])<<7*G)>>>0,this.buf[this.pos++]<128)return z}return z.lo=(z.lo|(127&this.buf[this.pos++])<<7*G)>>>0,z}for(;G<4;++G)if(z.lo=(z.lo|(127&this.buf[this.pos])<<7*G)>>>0,this.buf[this.pos++]<128)return z;if(z.lo=(z.lo|(127&this.buf[this.pos])<<28)>>>0,z.hi=(z.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return z;if(G=0,this.len-this.pos>4){for(;G<5;++G)if(z.hi=(z.hi|(127&this.buf[this.pos])<<7*G+3)>>>0,this.buf[this.pos++]<128)return z}else for(;G<5;++G){if(this.pos>=this.len)throw a(this);if(z.hi=(z.hi|(127&this.buf[this.pos])<<7*G+3)>>>0,this.buf[this.pos++]<128)return z}throw Error("invalid varint encoding")}function f(z,G){return(z[G-4]|z[G-3]<<8|z[G-2]<<16|z[G-1]<<24)>>>0}function m(){if(this.pos+8>this.len)throw a(this,8);return new K(f(this.buf,this.pos+=4),f(this.buf,this.pos+=4))}u.create=h(),u.prototype._slice=W.Array.prototype.subarray||W.Array.prototype.slice,u.prototype.uint32=(it=4294967295,function(){if(it=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return it;if(it=(it|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return it;if(it=(it|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return it;if(it=(it|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return it;if(it=(it|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return it;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return it}),u.prototype.int32=function(){return 0|this.uint32()},u.prototype.sint32=function(){var z=this.uint32();return z>>>1^-(1&z)|0},u.prototype.bool=function(){return 0!==this.uint32()},u.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return f(this.buf,this.pos+=4)},u.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|f(this.buf,this.pos+=4)},u.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var z=W.float.readFloatLE(this.buf,this.pos);return this.pos+=4,z},u.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var z=W.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,z},u.prototype.bytes=function(){var z=this.uint32(),G=this.pos,V=this.pos+z;if(V>this.len)throw a(this,z);return this.pos+=z,Array.isArray(this.buf)?this.buf.slice(G,V):G===V?new this.buf.constructor(0):this._slice.call(this.buf,G,V)},u.prototype.string=function(){var z=this.bytes();return Z.read(z,0,z.length)},u.prototype.skip=function(z){if("number"==typeof z){if(this.pos+z>this.len)throw a(this,z);this.pos+=z}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},u.prototype.skipType=function(z){switch(z){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(z=7&this.uint32());)this.skipType(z);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+z+" at offset "+this.pos)}return this},u._configure=function(z){H=z,u.create=h(),H._configure();var G=W.Long?"toLong":"toNumber";W.merge(u.prototype,{int64:function(){return p.call(this)[G](!1)},uint64:function(){return p.call(this)[G](!0)},sint64:function(){return p.call(this).zzDecode()[G](!1)},fixed64:function(){return m.call(this)[G](!0)},sfixed64:function(){return m.call(this)[G](!1)}})}},function(z,G,V){var H,W,K=V(20),Z=K.Reader,it=K.Writer,ot=K.util,rt=K.roots.default||(K.roots.default={});rt.tensorflow=((W={}).magenta=((H={}).NoteSequence=function(){function t(z){if(this.timeSignatures=[],this.keySignatures=[],this.tempos=[],this.notes=[],this.pitchBends=[],this.controlChanges=[],this.partInfos=[],this.textAnnotations=[],this.sectionAnnotations=[],this.sectionGroups=[],z)for(var G=Object.keys(z),V=0;V<G.length;++V)null!=z[G[V]]&&(this[G[V]]=z[G[V]])}var z,G;return t.prototype.id="",t.prototype.filename="",t.prototype.referenceNumber=ot.Long?ot.Long.fromBits(0,0,!1):0,t.prototype.collectionName="",t.prototype.ticksPerQuarter=0,t.prototype.timeSignatures=ot.emptyArray,t.prototype.keySignatures=ot.emptyArray,t.prototype.tempos=ot.emptyArray,t.prototype.notes=ot.emptyArray,t.prototype.totalTime=0,t.prototype.totalQuantizedSteps=ot.Long?ot.Long.fromBits(0,0,!1):0,t.prototype.pitchBends=ot.emptyArray,t.prototype.controlChanges=ot.emptyArray,t.prototype.partInfos=ot.emptyArray,t.prototype.sourceInfo=null,t.prototype.textAnnotations=ot.emptyArray,t.prototype.sectionAnnotations=ot.emptyArray,t.prototype.sectionGroups=ot.emptyArray,t.prototype.quantizationInfo=null,t.prototype.subsequenceInfo=null,t.prototype.sequenceMetadata=null,t.create=function(z){return new t(z)},t.encode=function(z,G){if(G||(G=it.create()),null!=z.id&&z.hasOwnProperty("id")&&G.uint32(10).string(z.id),null!=z.filename&&z.hasOwnProperty("filename")&&G.uint32(18).string(z.filename),null!=z.collectionName&&z.hasOwnProperty("collectionName")&&G.uint32(26).string(z.collectionName),null!=z.ticksPerQuarter&&z.hasOwnProperty("ticksPerQuarter")&&G.uint32(32).int32(z.ticksPerQuarter),null!=z.timeSignatures&&z.timeSignatures.length)for(var V=0;V<z.timeSignatures.length;++V)rt.tensorflow.magenta.NoteSequence.TimeSignature.encode(z.timeSignatures[V],G.uint32(42).fork()).ldelim();if(null!=z.keySignatures&&z.keySignatures.length)for(V=0;V<z.keySignatures.length;++V)rt.tensorflow.magenta.NoteSequence.KeySignature.encode(z.keySignatures[V],G.uint32(50).fork()).ldelim();if(null!=z.tempos&&z.tempos.length)for(V=0;V<z.tempos.length;++V)rt.tensorflow.magenta.NoteSequence.Tempo.encode(z.tempos[V],G.uint32(58).fork()).ldelim();if(null!=z.notes&&z.notes.length)for(V=0;V<z.notes.length;++V)rt.tensorflow.magenta.NoteSequence.Note.encode(z.notes[V],G.uint32(66).fork()).ldelim();if(null!=z.totalTime&&z.hasOwnProperty("totalTime")&&G.uint32(73).double(z.totalTime),null!=z.pitchBends&&z.pitchBends.length)for(V=0;V<z.pitchBends.length;++V)rt.tensorflow.magenta.NoteSequence.PitchBend.encode(z.pitchBends[V],G.uint32(82).fork()).ldelim();if(null!=z.controlChanges&&z.controlChanges.length)for(V=0;V<z.controlChanges.length;++V)rt.tensorflow.magenta.NoteSequence.ControlChange.encode(z.controlChanges[V],G.uint32(90).fork()).ldelim();if(null!=z.partInfos&&z.partInfos.length)for(V=0;V<z.partInfos.length;++V)rt.tensorflow.magenta.NoteSequence.PartInfo.encode(z.partInfos[V],G.uint32(98).fork()).ldelim();if(null!=z.sourceInfo&&z.hasOwnProperty("sourceInfo")&&rt.tensorflow.magenta.NoteSequence.SourceInfo.encode(z.sourceInfo,G.uint32(106).fork()).ldelim(),null!=z.textAnnotations&&z.textAnnotations.length)for(V=0;V<z.textAnnotations.length;++V)rt.tensorflow.magenta.NoteSequence.TextAnnotation.encode(z.textAnnotations[V],G.uint32(114).fork()).ldelim();if(null!=z.quantizationInfo&&z.hasOwnProperty("quantizationInfo")&&rt.tensorflow.magenta.NoteSequence.QuantizationInfo.encode(z.quantizationInfo,G.uint32(122).fork()).ldelim(),null!=z.totalQuantizedSteps&&z.hasOwnProperty("totalQuantizedSteps")&&G.uint32(128).int64(z.totalQuantizedSteps),null!=z.subsequenceInfo&&z.hasOwnProperty("subsequenceInfo")&&rt.tensorflow.magenta.NoteSequence.SubsequenceInfo.encode(z.subsequenceInfo,G.uint32(138).fork()).ldelim(),null!=z.referenceNumber&&z.hasOwnProperty("referenceNumber")&&G.uint32(144).int64(z.referenceNumber),null!=z.sequenceMetadata&&z.hasOwnProperty("sequenceMetadata")&&rt.tensorflow.magenta.SequenceMetadata.encode(z.sequenceMetadata,G.uint32(154).fork()).ldelim(),null!=z.sectionAnnotations&&z.sectionAnnotations.length)for(V=0;V<z.sectionAnnotations.length;++V)rt.tensorflow.magenta.NoteSequence.SectionAnnotation.encode(z.sectionAnnotations[V],G.uint32(162).fork()).ldelim();if(null!=z.sectionGroups&&z.sectionGroups.length)for(V=0;V<z.sectionGroups.length;++V)rt.tensorflow.magenta.NoteSequence.SectionGroup.encode(z.sectionGroups[V],G.uint32(170).fork()).ldelim();return G},t.encodeDelimited=function(z,G){return this.encode(z,G).ldelim()},t.decode=function(z,G){z instanceof Z||(z=Z.create(z));for(var V=void 0===G?z.len:z.pos+G,H=new rt.tensorflow.magenta.NoteSequence;z.pos<V;){var W=z.uint32();switch(W>>>3){case 1:H.id=z.string();break;case 2:H.filename=z.string();break;case 18:H.referenceNumber=ot.Long?z.int64().toNumber():z.int64();break;case 3:H.collectionName=z.string();break;case 4:H.ticksPerQuarter=z.int32();break;case 5:H.timeSignatures&&H.timeSignatures.length||(H.timeSignatures=[]),H.timeSignatures.push(rt.tensorflow.magenta.NoteSequence.TimeSignature.decode(z,z.uint32()));break;case 6:H.keySignatures&&H.keySignatures.length||(H.keySignatures=[]),H.keySignatures.push(rt.tensorflow.magenta.NoteSequence.KeySignature.decode(z,z.uint32()));break;case 7:H.tempos&&H.tempos.length||(H.tempos=[]),H.tempos.push(rt.tensorflow.magenta.NoteSequence.Tempo.decode(z,z.uint32()));break;case 8:H.notes&&H.notes.length||(H.notes=[]),H.notes.push(rt.tensorflow.magenta.NoteSequence.Note.decode(z,z.uint32()));break;case 9:H.totalTime=z.double();break;case 16:H.totalQuantizedSteps=ot.Long?z.int64().toNumber():z.int64();break;case 10:H.pitchBends&&H.pitchBends.length||(H.pitchBends=[]),H.pitchBends.push(rt.tensorflow.magenta.NoteSequence.PitchBend.decode(z,z.uint32()));break;case 11:H.controlChanges&&H.controlChanges.length||(H.controlChanges=[]),H.controlChanges.push(rt.tensorflow.magenta.NoteSequence.ControlChange.decode(z,z.uint32()));break;case 12:H.partInfos&&H.partInfos.length||(H.partInfos=[]),H.partInfos.push(rt.tensorflow.magenta.NoteSequence.PartInfo.decode(z,z.uint32()));break;case 13:H.sourceInfo=rt.tensorflow.magenta.NoteSequence.SourceInfo.decode(z,z.uint32());break;case 14:H.textAnnotations&&H.textAnnotations.length||(H.textAnnotations=[]),H.textAnnotations.push(rt.tensorflow.magenta.NoteSequence.TextAnnotation.decode(z,z.uint32()));break;case 20:H.sectionAnnotations&&H.sectionAnnotations.length||(H.sectionAnnotations=[]),H.sectionAnnotations.push(rt.tensorflow.magenta.NoteSequence.SectionAnnotation.decode(z,z.uint32()));break;case 21:H.sectionGroups&&H.sectionGroups.length||(H.sectionGroups=[]),H.sectionGroups.push(rt.tensorflow.magenta.NoteSequence.SectionGroup.decode(z,z.uint32()));break;case 15:H.quantizationInfo=rt.tensorflow.magenta.NoteSequence.QuantizationInfo.decode(z,z.uint32());break;case 17:H.subsequenceInfo=rt.tensorflow.magenta.NoteSequence.SubsequenceInfo.decode(z,z.uint32());break;case 19:H.sequenceMetadata=rt.tensorflow.magenta.SequenceMetadata.decode(z,z.uint32());break;default:z.skipType(7&W)}}return H},t.decodeDelimited=function(z){return z instanceof Z||(z=new Z(z)),this.decode(z,z.uint32())},t.verify=function(z){if("object"!=typeof z||null===z)return"object expected";if(null!=z.id&&z.hasOwnProperty("id")&&!ot.isString(z.id))return"id: string expected";if(null!=z.filename&&z.hasOwnProperty("filename")&&!ot.isString(z.filename))return"filename: string expected";if(null!=z.referenceNumber&&z.hasOwnProperty("referenceNumber")&&!(ot.isInteger(z.referenceNumber)||z.referenceNumber&&ot.isInteger(z.referenceNumber.low)&&ot.isInteger(z.referenceNumber.high)))return"referenceNumber: integer|Long expected";if(null!=z.collectionName&&z.hasOwnProperty("collectionName")&&!ot.isString(z.collectionName))return"collectionName: string expected";if(null!=z.ticksPerQuarter&&z.hasOwnProperty("ticksPerQuarter")&&!ot.isInteger(z.ticksPerQuarter))return"ticksPerQuarter: integer expected";if(null!=z.timeSignatures&&z.hasOwnProperty("timeSignatures")){if(!Array.isArray(z.timeSignatures))return"timeSignatures: array expected";for(var G=0;G<z.timeSignatures.length;++G)if(V=rt.tensorflow.magenta.NoteSequence.TimeSignature.verify(z.timeSignatures[G]))return"timeSignatures."+V}if(null!=z.keySignatures&&z.hasOwnProperty("keySignatures")){if(!Array.isArray(z.keySignatures))return"keySignatures: array expected";for(G=0;G<z.keySignatures.length;++G)if(V=rt.tensorflow.magenta.NoteSequence.KeySignature.verify(z.keySignatures[G]))return"keySignatures."+V}if(null!=z.tempos&&z.hasOwnProperty("tempos")){if(!Array.isArray(z.tempos))return"tempos: array expected";for(G=0;G<z.tempos.length;++G)if(V=rt.tensorflow.magenta.NoteSequence.Tempo.verify(z.tempos[G]))return"tempos."+V}if(null!=z.notes&&z.hasOwnProperty("notes")){if(!Array.isArray(z.notes))return"notes: array expected";for(G=0;G<z.notes.length;++G)if(V=rt.tensorflow.magenta.NoteSequence.Note.verify(z.notes[G]))return"notes."+V}if(null!=z.totalTime&&z.hasOwnProperty("totalTime")&&"number"!=typeof z.totalTime)return"totalTime: number expected";if(null!=z.totalQuantizedSteps&&z.hasOwnProperty("totalQuantizedSteps")&&!(ot.isInteger(z.totalQuantizedSteps)||z.totalQuantizedSteps&&ot.isInteger(z.totalQuantizedSteps.low)&&ot.isInteger(z.totalQuantizedSteps.high)))return"totalQuantizedSteps: integer|Long expected";if(null!=z.pitchBends&&z.hasOwnProperty("pitchBends")){if(!Array.isArray(z.pitchBends))return"pitchBends: array expected";for(G=0;G<z.pitchBends.length;++G)if(V=rt.tensorflow.magenta.NoteSequence.PitchBend.verify(z.pitchBends[G]))return"pitchBends."+V}if(null!=z.controlChanges&&z.hasOwnProperty("controlChanges")){if(!Array.isArray(z.controlChanges))return"controlChanges: array expected";for(G=0;G<z.controlChanges.length;++G)if(V=rt.tensorflow.magenta.NoteSequence.ControlChange.verify(z.controlChanges[G]))return"controlChanges."+V}if(null!=z.partInfos&&z.hasOwnProperty("partInfos")){if(!Array.isArray(z.partInfos))return"partInfos: array expected";for(G=0;G<z.partInfos.length;++G)if(V=rt.tensorflow.magenta.NoteSequence.PartInfo.verify(z.partInfos[G]))return"partInfos."+V}if(null!=z.sourceInfo&&z.hasOwnProperty("sourceInfo")&&(V=rt.tensorflow.magenta.NoteSequence.SourceInfo.verify(z.sourceInfo)))return"sourceInfo."+V;if(null!=z.textAnnotations&&z.hasOwnProperty("textAnnotations")){if(!Array.isArray(z.textAnnotations))return"textAnnotations: array expected";for(G=0;G<z.textAnnotations.length;++G)if(V=rt.tensorflow.magenta.NoteSequence.TextAnnotation.verify(z.textAnnotations[G]))return"textAnnotations."+V}if(null!=z.sectionAnnotations&&z.hasOwnProperty("sectionAnnotations")){if(!Array.isArray(z.sectionAnnotations))return"sectionAnnotations: array expected";for(G=0;G<z.sectionAnnotations.length;++G)if(V=rt.tensorflow.magenta.NoteSequence.SectionAnnotation.verify(z.sectionAnnotations[G]))return"sectionAnnotations."+V}if(null!=z.sectionGroups&&z.hasOwnProperty("sectionGroups")){if(!Array.isArray(z.sectionGroups))return"sectionGroups: array expected";for(G=0;G<z.sectionGroups.length;++G){var V;if(V=rt.tensorflow.magenta.NoteSequence.SectionGroup.verify(z.sectionGroups[G]))return"sectionGroups."+V}}return null!=z.quantizationInfo&&z.hasOwnProperty("quantizationInfo")&&(V=rt.tensorflow.magenta.NoteSequence.QuantizationInfo.verify(z.quantizationInfo))?"quantizationInfo."+V:null!=z.subsequenceInfo&&z.hasOwnProperty("subsequenceInfo")&&(V=rt.tensorflow.magenta.NoteSequence.SubsequenceInfo.verify(z.subsequenceInfo))?"subsequenceInfo."+V:null!=z.sequenceMetadata&&z.hasOwnProperty("sequenceMetadata")&&(V=rt.tensorflow.magenta.SequenceMetadata.verify(z.sequenceMetadata))?"sequenceMetadata."+V:null},t.fromObject=function(z){if(z instanceof rt.tensorflow.magenta.NoteSequence)return z;var G=new rt.tensorflow.magenta.NoteSequence;if(null!=z.id&&(G.id=String(z.id)),null!=z.filename&&(G.filename=String(z.filename)),null!=z.referenceNumber&&(ot.Long?(G.referenceNumber=ot.Long.fromValue(z.referenceNumber)).unsigned=!1:"string"==typeof z.referenceNumber?G.referenceNumber=parseInt(z.referenceNumber,10):"number"==typeof z.referenceNumber?G.referenceNumber=z.referenceNumber:"object"==typeof z.referenceNumber&&(G.referenceNumber=new ot.LongBits(z.referenceNumber.low>>>0,z.referenceNumber.high>>>0).toNumber())),null!=z.collectionName&&(G.collectionName=String(z.collectionName)),null!=z.ticksPerQuarter&&(G.ticksPerQuarter=0|z.ticksPerQuarter),z.timeSignatures){if(!Array.isArray(z.timeSignatures))throw TypeError(".tensorflow.magenta.NoteSequence.timeSignatures: array expected");G.timeSignatures=[];for(var V=0;V<z.timeSignatures.length;++V){if("object"!=typeof z.timeSignatures[V])throw TypeError(".tensorflow.magenta.NoteSequence.timeSignatures: object expected");G.timeSignatures[V]=rt.tensorflow.magenta.NoteSequence.TimeSignature.fromObject(z.timeSignatures[V])}}if(z.keySignatures){if(!Array.isArray(z.keySignatures))throw TypeError(".tensorflow.magenta.NoteSequence.keySignatures: array expected");for(G.keySignatures=[],V=0;V<z.keySignatures.length;++V){if("object"!=typeof z.keySignatures[V])throw TypeError(".tensorflow.magenta.NoteSequence.keySignatures: object expected");G.keySignatures[V]=rt.tensorflow.magenta.NoteSequence.KeySignature.fromObject(z.keySignatures[V])}}if(z.tempos){if(!Array.isArray(z.tempos))throw TypeError(".tensorflow.magenta.NoteSequence.tempos: array expected");for(G.tempos=[],V=0;V<z.tempos.length;++V){if("object"!=typeof z.tempos[V])throw TypeError(".tensorflow.magenta.NoteSequence.tempos: object expected");G.tempos[V]=rt.tensorflow.magenta.NoteSequence.Tempo.fromObject(z.tempos[V])}}if(z.notes){if(!Array.isArray(z.notes))throw TypeError(".tensorflow.magenta.NoteSequence.notes: array expected");for(G.notes=[],V=0;V<z.notes.length;++V){if("object"!=typeof z.notes[V])throw TypeError(".tensorflow.magenta.NoteSequence.notes: object expected");G.notes[V]=rt.tensorflow.magenta.NoteSequence.Note.fromObject(z.notes[V])}}if(null!=z.totalTime&&(G.totalTime=Number(z.totalTime)),null!=z.totalQuantizedSteps&&(ot.Long?(G.totalQuantizedSteps=ot.Long.fromValue(z.totalQuantizedSteps)).unsigned=!1:"string"==typeof z.totalQuantizedSteps?G.totalQuantizedSteps=parseInt(z.totalQuantizedSteps,10):"number"==typeof z.totalQuantizedSteps?G.totalQuantizedSteps=z.totalQuantizedSteps:"object"==typeof z.totalQuantizedSteps&&(G.totalQuantizedSteps=new ot.LongBits(z.totalQuantizedSteps.low>>>0,z.totalQuantizedSteps.high>>>0).toNumber())),z.pitchBends){if(!Array.isArray(z.pitchBends))throw TypeError(".tensorflow.magenta.NoteSequence.pitchBends: array expected");for(G.pitchBends=[],V=0;V<z.pitchBends.length;++V){if("object"!=typeof z.pitchBends[V])throw TypeError(".tensorflow.magenta.NoteSequence.pitchBends: object expected");G.pitchBends[V]=rt.tensorflow.magenta.NoteSequence.PitchBend.fromObject(z.pitchBends[V])}}if(z.controlChanges){if(!Array.isArray(z.controlChanges))throw TypeError(".tensorflow.magenta.NoteSequence.controlChanges: array expected");for(G.controlChanges=[],V=0;V<z.controlChanges.length;++V){if("object"!=typeof z.controlChanges[V])throw TypeError(".tensorflow.magenta.NoteSequence.controlChanges: object expected");G.controlChanges[V]=rt.tensorflow.magenta.NoteSequence.ControlChange.fromObject(z.controlChanges[V])}}if(z.partInfos){if(!Array.isArray(z.partInfos))throw TypeError(".tensorflow.magenta.NoteSequence.partInfos: array expected");for(G.partInfos=[],V=0;V<z.partInfos.length;++V){if("object"!=typeof z.partInfos[V])throw TypeError(".tensorflow.magenta.NoteSequence.partInfos: object expected");G.partInfos[V]=rt.tensorflow.magenta.NoteSequence.PartInfo.fromObject(z.partInfos[V])}}if(null!=z.sourceInfo){if("object"!=typeof z.sourceInfo)throw TypeError(".tensorflow.magenta.NoteSequence.sourceInfo: object expected");G.sourceInfo=rt.tensorflow.magenta.NoteSequence.SourceInfo.fromObject(z.sourceInfo)}if(z.textAnnotations){if(!Array.isArray(z.textAnnotations))throw TypeError(".tensorflow.magenta.NoteSequence.textAnnotations: array expected");for(G.textAnnotations=[],V=0;V<z.textAnnotations.length;++V){if("object"!=typeof z.textAnnotations[V])throw TypeError(".tensorflow.magenta.NoteSequence.textAnnotations: object expected");G.textAnnotations[V]=rt.tensorflow.magenta.NoteSequence.TextAnnotation.fromObject(z.textAnnotations[V])}}if(z.sectionAnnotations){if(!Array.isArray(z.sectionAnnotations))throw TypeError(".tensorflow.magenta.NoteSequence.sectionAnnotations: array expected");for(G.sectionAnnotations=[],V=0;V<z.sectionAnnotations.length;++V){if("object"!=typeof z.sectionAnnotations[V])throw TypeError(".tensorflow.magenta.NoteSequence.sectionAnnotations: object expected");G.sectionAnnotations[V]=rt.tensorflow.magenta.NoteSequence.SectionAnnotation.fromObject(z.sectionAnnotations[V])}}if(z.sectionGroups){if(!Array.isArray(z.sectionGroups))throw TypeError(".tensorflow.magenta.NoteSequence.sectionGroups: array expected");for(G.sectionGroups=[],V=0;V<z.sectionGroups.length;++V){if("object"!=typeof z.sectionGroups[V])throw TypeError(".tensorflow.magenta.NoteSequence.sectionGroups: object expected");G.sectionGroups[V]=rt.tensorflow.magenta.NoteSequence.SectionGroup.fromObject(z.sectionGroups[V])}}if(null!=z.quantizationInfo){if("object"!=typeof z.quantizationInfo)throw TypeError(".tensorflow.magenta.NoteSequence.quantizationInfo: object expected");G.quantizationInfo=rt.tensorflow.magenta.NoteSequence.QuantizationInfo.fromObject(z.quantizationInfo)}if(null!=z.subsequenceInfo){if("object"!=typeof z.subsequenceInfo)throw TypeError(".tensorflow.magenta.NoteSequence.subsequenceInfo: object expected");G.subsequenceInfo=rt.tensorflow.magenta.NoteSequence.SubsequenceInfo.fromObject(z.subsequenceInfo)}if(null!=z.sequenceMetadata){if("object"!=typeof z.sequenceMetadata)throw TypeError(".tensorflow.magenta.NoteSequence.sequenceMetadata: object expected");G.sequenceMetadata=rt.tensorflow.magenta.SequenceMetadata.fromObject(z.sequenceMetadata)}return G},t.toObject=function(z,G){G||(G={});var V={};if((G.arrays||G.defaults)&&(V.timeSignatures=[],V.keySignatures=[],V.tempos=[],V.notes=[],V.pitchBends=[],V.controlChanges=[],V.partInfos=[],V.textAnnotations=[],V.sectionAnnotations=[],V.sectionGroups=[]),G.defaults){if(V.id="",V.filename="",V.collectionName="",V.ticksPerQuarter=0,V.totalTime=0,V.sourceInfo=null,V.quantizationInfo=null,ot.Long){var H=new ot.Long(0,0,!1);V.totalQuantizedSteps=G.longs===String?H.toString():G.longs===Number?H.toNumber():H}else V.totalQuantizedSteps=G.longs===String?"0":0;V.subsequenceInfo=null,ot.Long?(H=new ot.Long(0,0,!1),V.referenceNumber=G.longs===String?H.toString():G.longs===Number?H.toNumber():H):V.referenceNumber=G.longs===String?"0":0,V.sequenceMetadata=null}if(null!=z.id&&z.hasOwnProperty("id")&&(V.id=z.id),null!=z.filename&&z.hasOwnProperty("filename")&&(V.filename=z.filename),null!=z.collectionName&&z.hasOwnProperty("collectionName")&&(V.collectionName=z.collectionName),null!=z.ticksPerQuarter&&z.hasOwnProperty("ticksPerQuarter")&&(V.ticksPerQuarter=z.ticksPerQuarter),z.timeSignatures&&z.timeSignatures.length){V.timeSignatures=[];for(var W=0;W<z.timeSignatures.length;++W)V.timeSignatures[W]=rt.tensorflow.magenta.NoteSequence.TimeSignature.toObject(z.timeSignatures[W],G)}if(z.keySignatures&&z.keySignatures.length)for(V.keySignatures=[],W=0;W<z.keySignatures.length;++W)V.keySignatures[W]=rt.tensorflow.magenta.NoteSequence.KeySignature.toObject(z.keySignatures[W],G);if(z.tempos&&z.tempos.length)for(V.tempos=[],W=0;W<z.tempos.length;++W)V.tempos[W]=rt.tensorflow.magenta.NoteSequence.Tempo.toObject(z.tempos[W],G);if(z.notes&&z.notes.length)for(V.notes=[],W=0;W<z.notes.length;++W)V.notes[W]=rt.tensorflow.magenta.NoteSequence.Note.toObject(z.notes[W],G);if(null!=z.totalTime&&z.hasOwnProperty("totalTime")&&(V.totalTime=G.json&&!isFinite(z.totalTime)?String(z.totalTime):z.totalTime),z.pitchBends&&z.pitchBends.length)for(V.pitchBends=[],W=0;W<z.pitchBends.length;++W)V.pitchBends[W]=rt.tensorflow.magenta.NoteSequence.PitchBend.toObject(z.pitchBends[W],G);if(z.controlChanges&&z.controlChanges.length)for(V.controlChanges=[],W=0;W<z.controlChanges.length;++W)V.controlChanges[W]=rt.tensorflow.magenta.NoteSequence.ControlChange.toObject(z.controlChanges[W],G);if(z.partInfos&&z.partInfos.length)for(V.partInfos=[],W=0;W<z.partInfos.length;++W)V.partInfos[W]=rt.tensorflow.magenta.NoteSequence.PartInfo.toObject(z.partInfos[W],G);if(null!=z.sourceInfo&&z.hasOwnProperty("sourceInfo")&&(V.sourceInfo=rt.tensorflow.magenta.NoteSequence.SourceInfo.toObject(z.sourceInfo,G)),z.textAnnotations&&z.textAnnotations.length)for(V.textAnnotations=[],W=0;W<z.textAnnotations.length;++W)V.textAnnotations[W]=rt.tensorflow.magenta.NoteSequence.TextAnnotation.toObject(z.textAnnotations[W],G);if(null!=z.quantizationInfo&&z.hasOwnProperty("quantizationInfo")&&(V.quantizationInfo=rt.tensorflow.magenta.NoteSequence.QuantizationInfo.toObject(z.quantizationInfo,G)),null!=z.totalQuantizedSteps&&z.hasOwnProperty("totalQuantizedSteps")&&("number"==typeof z.totalQuantizedSteps?V.totalQuantizedSteps=G.longs===String?String(z.totalQuantizedSteps):z.totalQuantizedSteps:V.totalQuantizedSteps=G.longs===String?ot.Long.prototype.toString.call(z.totalQuantizedSteps):G.longs===Number?new ot.LongBits(z.totalQuantizedSteps.low>>>0,z.totalQuantizedSteps.high>>>0).toNumber():z.totalQuantizedSteps),null!=z.subsequenceInfo&&z.hasOwnProperty("subsequenceInfo")&&(V.subsequenceInfo=rt.tensorflow.magenta.NoteSequence.SubsequenceInfo.toObject(z.subsequenceInfo,G)),null!=z.referenceNumber&&z.hasOwnProperty("referenceNumber")&&("number"==typeof z.referenceNumber?V.referenceNumber=G.longs===String?String(z.referenceNumber):z.referenceNumber:V.referenceNumber=G.longs===String?ot.Long.prototype.toString.call(z.referenceNumber):G.longs===Number?new ot.LongBits(z.referenceNumber.low>>>0,z.referenceNumber.high>>>0).toNumber():z.referenceNumber),null!=z.sequenceMetadata&&z.hasOwnProperty("sequenceMetadata")&&(V.sequenceMetadata=rt.tensorflow.magenta.SequenceMetadata.toObject(z.sequenceMetadata,G)),z.sectionAnnotations&&z.sectionAnnotations.length)for(V.sectionAnnotations=[],W=0;W<z.sectionAnnotations.length;++W)V.sectionAnnotations[W]=rt.tensorflow.magenta.NoteSequence.SectionAnnotation.toObject(z.sectionAnnotations[W],G);if(z.sectionGroups&&z.sectionGroups.length)for(V.sectionGroups=[],W=0;W<z.sectionGroups.length;++W)V.sectionGroups[W]=rt.tensorflow.magenta.NoteSequence.SectionGroup.toObject(z.sectionGroups[W],G);return V},t.prototype.toJSON=function(){return this.constructor.toObject(this,K.util.toJSONOptions)},t.Note=function(){function t(z){if(z)for(var G=Object.keys(z),V=0;V<G.length;++V)null!=z[G[V]]&&(this[G[V]]=z[G[V]])}return t.prototype.pitch=0,t.prototype.pitchName=0,t.prototype.velocity=0,t.prototype.startTime=0,t.prototype.quantizedStartStep=ot.Long?ot.Long.fromBits(0,0,!1):0,t.prototype.endTime=0,t.prototype.quantizedEndStep=ot.Long?ot.Long.fromBits(0,0,!1):0,t.prototype.numerator=0,t.prototype.denominator=0,t.prototype.instrument=0,t.prototype.program=0,t.prototype.isDrum=!1,t.prototype.part=0,t.prototype.voice=0,t.create=function(z){return new t(z)},t.encode=function(z,G){return G||(G=it.create()),null!=z.pitch&&z.hasOwnProperty("pitch")&&G.uint32(8).int32(z.pitch),null!=z.velocity&&z.hasOwnProperty("velocity")&&G.uint32(16).int32(z.velocity),null!=z.startTime&&z.hasOwnProperty("startTime")&&G.uint32(25).double(z.startTime),null!=z.endTime&&z.hasOwnProperty("endTime")&&G.uint32(33).double(z.endTime),null!=z.numerator&&z.hasOwnProperty("numerator")&&G.uint32(40).int32(z.numerator),null!=z.denominator&&z.hasOwnProperty("denominator")&&G.uint32(48).int32(z.denominator),null!=z.instrument&&z.hasOwnProperty("instrument")&&G.uint32(56).int32(z.instrument),null!=z.program&&z.hasOwnProperty("program")&&G.uint32(64).int32(z.program),null!=z.isDrum&&z.hasOwnProperty("isDrum")&&G.uint32(72).bool(z.isDrum),null!=z.part&&z.hasOwnProperty("part")&&G.uint32(80).int32(z.part),null!=z.pitchName&&z.hasOwnProperty("pitchName")&&G.uint32(88).int32(z.pitchName),null!=z.voice&&z.hasOwnProperty("voice")&&G.uint32(96).int32(z.voice),null!=z.quantizedStartStep&&z.hasOwnProperty("quantizedStartStep")&&G.uint32(104).int64(z.quantizedStartStep),null!=z.quantizedEndStep&&z.hasOwnProperty("quantizedEndStep")&&G.uint32(112).int64(z.quantizedEndStep),G},t.encodeDelimited=function(z,G){return this.encode(z,G).ldelim()},t.decode=function(z,G){z instanceof Z||(z=Z.create(z));for(var V=void 0===G?z.len:z.pos+G,H=new rt.tensorflow.magenta.NoteSequence.Note;z.pos<V;){var W=z.uint32();switch(W>>>3){case 1:H.pitch=z.int32();break;case 11:H.pitchName=z.int32();break;case 2:H.velocity=z.int32();break;case 3:H.startTime=z.double();break;case 13:H.quantizedStartStep=ot.Long?z.int64().toNumber():z.int64();break;case 4:H.endTime=z.double();break;case 14:H.quantizedEndStep=ot.Long?z.int64().toNumber():z.int64();break;case 5:H.numerator=z.int32();break;case 6:H.denominator=z.int32();break;case 7:H.instrument=z.int32();break;case 8:H.program=z.int32();break;case 9:H.isDrum=z.bool();break;case 10:H.part=z.int32();break;case 12:H.voice=z.int32();break;default:z.skipType(7&W)}}return H},t.decodeDelimited=function(z){return z instanceof Z||(z=new Z(z)),this.decode(z,z.uint32())},t.verify=function(z){if("object"!=typeof z||null===z)return"object expected";if(null!=z.pitch&&z.hasOwnProperty("pitch")&&!ot.isInteger(z.pitch))return"pitch: integer expected";if(null!=z.pitchName&&z.hasOwnProperty("pitchName"))switch(z.pitchName){default:return"pitchName: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 23:case 24:case 25:case 26:case 27:case 28:case 29:case 30:case 31:case 32:case 33:case 34:case 35:}return null!=z.velocity&&z.hasOwnProperty("velocity")&&!ot.isInteger(z.velocity)?"velocity: integer expected":null!=z.startTime&&z.hasOwnProperty("startTime")&&"number"!=typeof z.startTime?"startTime: number expected":null!=z.quantizedStartStep&&z.hasOwnProperty("quantizedStartStep")&&!(ot.isInteger(z.quantizedStartStep)||z.quantizedStartStep&&ot.isInteger(z.quantizedStartStep.low)&&ot.isInteger(z.quantizedStartStep.high))?"quantizedStartStep: integer|Long expected":null!=z.endTime&&z.hasOwnProperty("endTime")&&"number"!=typeof z.endTime?"endTime: number expected":null!=z.quantizedEndStep&&z.hasOwnProperty("quantizedEndStep")&&!(ot.isInteger(z.quantizedEndStep)||z.quantizedEndStep&&ot.isInteger(z.quantizedEndStep.low)&&ot.isInteger(z.quantizedEndStep.high))?"quantizedEndStep: integer|Long expected":null!=z.numerator&&z.hasOwnProperty("numerator")&&!ot.isInteger(z.numerator)?"numerator: integer expected":null!=z.denominator&&z.hasOwnProperty("denominator")&&!ot.isInteger(z.denominator)?"denominator: integer expected":null!=z.instrument&&z.hasOwnProperty("instrument")&&!ot.isInteger(z.instrument)?"instrument: integer expected":null!=z.program&&z.hasOwnProperty("program")&&!ot.isInteger(z.program)?"program: integer expected":null!=z.isDrum&&z.hasOwnProperty("isDrum")&&"boolean"!=typeof z.isDrum?"isDrum: boolean expected":null!=z.part&&z.hasOwnProperty("part")&&!ot.isInteger(z.part)?"part: integer expected":null!=z.voice&&z.hasOwnProperty("voice")&&!ot.isInteger(z.voice)?"voice: integer expected":null},t.fromObject=function(z){if(z instanceof rt.tensorflow.magenta.NoteSequence.Note)return z;var G=new rt.tensorflow.magenta.NoteSequence.Note;switch(null!=z.pitch&&(G.pitch=0|z.pitch),z.pitchName){case"UNKNOWN_PITCH_NAME":case 0:G.pitchName=0;break;case"F_FLAT_FLAT":case 1:G.pitchName=1;break;case"C_FLAT_FLAT":case 2:G.pitchName=2;break;case"G_FLAT_FLAT":case 3:G.pitchName=3;break;case"D_FLAT_FLAT":case 4:G.pitchName=4;break;case"A_FLAT_FLAT":case 5:G.pitchName=5;break;case"E_FLAT_FLAT":case 6:G.pitchName=6;break;case"B_FLAT_FLAT":case 7:G.pitchName=7;break;case"F_FLAT":case 8:G.pitchName=8;break;case"C_FLAT":case 9:G.pitchName=9;break;case"G_FLAT":case 10:G.pitchName=10;break;case"D_FLAT":case 11:G.pitchName=11;break;case"A_FLAT":case 12:G.pitchName=12;break;case"E_FLAT":case 13:G.pitchName=13;break;case"B_FLAT":case 14:G.pitchName=14;break;case"F":case 15:G.pitchName=15;break;case"C":case 16:G.pitchName=16;break;case"G":case 17:G.pitchName=17;break;case"D":case 18:G.pitchName=18;break;case"A":case 19:G.pitchName=19;break;case"E":case 20:G.pitchName=20;break;case"B":case 21:G.pitchName=21;break;case"F_SHARP":case 22:G.pitchName=22;break;case"C_SHARP":case 23:G.pitchName=23;break;case"G_SHARP":case 24:G.pitchName=24;break;case"D_SHARP":case 25:G.pitchName=25;break;case"A_SHARP":case 26:G.pitchName=26;break;case"E_SHARP":case 27:G.pitchName=27;break;case"B_SHARP":case 28:G.pitchName=28;break;case"F_SHARP_SHARP":case 29:G.pitchName=29;break;case"C_SHARP_SHARP":case 30:G.pitchName=30;break;case"G_SHARP_SHARP":case 31:G.pitchName=31;break;case"D_SHARP_SHARP":case 32:G.pitchName=32;break;case"A_SHARP_SHARP":case 33:G.pitchName=33;break;case"E_SHARP_SHARP":case 34:G.pitchName=34;break;case"B_SHARP_SHARP":case 35:G.pitchName=35}return null!=z.velocity&&(G.velocity=0|z.velocity),null!=z.startTime&&(G.startTime=Number(z.startTime)),null!=z.quantizedStartStep&&(ot.Long?(G.quantizedStartStep=ot.Long.fromValue(z.quantizedStartStep)).unsigned=!1:"string"==typeof z.quantizedStartStep?G.quantizedStartStep=parseInt(z.quantizedStartStep,10):"number"==typeof z.quantizedStartStep?G.quantizedStartStep=z.quantizedStartStep:"object"==typeof z.quantizedStartStep&&(G.quantizedStartStep=new ot.LongBits(z.quantizedStartStep.low>>>0,z.quantizedStartStep.high>>>0).toNumber())),null!=z.endTime&&(G.endTime=Number(z.endTime)),null!=z.quantizedEndStep&&(ot.Long?(G.quantizedEndStep=ot.Long.fromValue(z.quantizedEndStep)).unsigned=!1:"string"==typeof z.quantizedEndStep?G.quantizedEndStep=parseInt(z.quantizedEndStep,10):"number"==typeof z.quantizedEndStep?G.quantizedEndStep=z.quantizedEndStep:"object"==typeof z.quantizedEndStep&&(G.quantizedEndStep=new ot.LongBits(z.quantizedEndStep.low>>>0,z.quantizedEndStep.high>>>0).toNumber())),null!=z.numerator&&(G.numerator=0|z.numerator),null!=z.denominator&&(G.denominator=0|z.denominator),null!=z.instrument&&(G.instrument=0|z.instrument),null!=z.program&&(G.program=0|z.program),null!=z.isDrum&&(G.isDrum=Boolean(z.isDrum)),null!=z.part&&(G.part=0|z.part),null!=z.voice&&(G.voice=0|z.voice),G},t.toObject=function(z,G){G||(G={});var V={};if(G.defaults){if(V.pitch=0,V.velocity=0,V.startTime=0,V.endTime=0,V.numerator=0,V.denominator=0,V.instrument=0,V.program=0,V.isDrum=!1,V.part=0,V.pitchName=G.enums===String?"UNKNOWN_PITCH_NAME":0,V.voice=0,ot.Long){var H=new ot.Long(0,0,!1);V.quantizedStartStep=G.longs===String?H.toString():G.longs===Number?H.toNumber():H}else V.quantizedStartStep=G.longs===String?"0":0;ot.Long?(H=new ot.Long(0,0,!1),V.quantizedEndStep=G.longs===String?H.toString():G.longs===Number?H.toNumber():H):V.quantizedEndStep=G.longs===String?"0":0}return null!=z.pitch&&z.hasOwnProperty("pitch")&&(V.pitch=z.pitch),null!=z.velocity&&z.hasOwnProperty("velocity")&&(V.velocity=z.velocity),null!=z.startTime&&z.hasOwnProperty("startTime")&&(V.startTime=G.json&&!isFinite(z.startTime)?String(z.startTime):z.startTime),null!=z.endTime&&z.hasOwnProperty("endTime")&&(V.endTime=G.json&&!isFinite(z.endTime)?String(z.endTime):z.endTime),null!=z.numerator&&z.hasOwnProperty("numerator")&&(V.numerator=z.numerator),null!=z.denominator&&z.hasOwnProperty("denominator")&&(V.denominator=z.denominator),null!=z.instrument&&z.hasOwnProperty("instrument")&&(V.instrument=z.instrument),null!=z.program&&z.hasOwnProperty("program")&&(V.program=z.program),null!=z.isDrum&&z.hasOwnProperty("isDrum")&&(V.isDrum=z.isDrum),null!=z.part&&z.hasOwnProperty("part")&&(V.part=z.part),null!=z.pitchName&&z.hasOwnProperty("pitchName")&&(V.pitchName=G.enums===String?rt.tensorflow.magenta.NoteSequence.PitchName[z.pitchName]:z.pitchName),null!=z.voice&&z.hasOwnProperty("voice")&&(V.voice=z.voice),null!=z.quantizedStartStep&&z.hasOwnProperty("quantizedStartStep")&&("number"==typeof z.quantizedStartStep?V.quantizedStartStep=G.longs===String?String(z.quantizedStartStep):z.quantizedStartStep:V.quantizedStartStep=G.longs===String?ot.Long.prototype.toString.call(z.quantizedStartStep):G.longs===Number?new ot.LongBits(z.quantizedStartStep.low>>>0,z.quantizedStartStep.high>>>0).toNumber():z.quantizedStartStep),null!=z.quantizedEndStep&&z.hasOwnProperty("quantizedEndStep")&&("number"==typeof z.quantizedEndStep?V.quantizedEndStep=G.longs===String?String(z.quantizedEndStep):z.quantizedEndStep:V.quantizedEndStep=G.longs===String?ot.Long.prototype.toString.call(z.quantizedEndStep):G.longs===Number?new ot.LongBits(z.quantizedEndStep.low>>>0,z.quantizedEndStep.high>>>0).toNumber():z.quantizedEndStep),V},t.prototype.toJSON=function(){return this.constructor.toObject(this,K.util.toJSONOptions)},t}(),t.PitchName=(z={},(G=Object.create(z))[z[0]="UNKNOWN_PITCH_NAME"]=0,G[z[1]="F_FLAT_FLAT"]=1,G[z[2]="C_FLAT_FLAT"]=2,G[z[3]="G_FLAT_FLAT"]=3,G[z[4]="D_FLAT_FLAT"]=4,G[z[5]="A_FLAT_FLAT"]=5,G[z[6]="E_FLAT_FLAT"]=6,G[z[7]="B_FLAT_FLAT"]=7,G[z[8]="F_FLAT"]=8,G[z[9]="C_FLAT"]=9,G[z[10]="G_FLAT"]=10,G[z[11]="D_FLAT"]=11,G[z[12]="A_FLAT"]=12,G[z[13]="E_FLAT"]=13,G[z[14]="B_FLAT"]=14,G[z[15]="F"]=15,G[z[16]="C"]=16,G[z[17]="G"]=17,G[z[18]="D"]=18,G[z[19]="A"]=19,G[z[20]="E"]=20,G[z[21]="B"]=21,G[z[22]="F_SHARP"]=22,G[z[23]="C_SHARP"]=23,G[z[24]="G_SHARP"]=24,G[z[25]="D_SHARP"]=25,G[z[26]="A_SHARP"]=26,G[z[27]="E_SHARP"]=27,G[z[28]="B_SHARP"]=28,G[z[29]="F_SHARP_SHARP"]=29,G[z[30]="C_SHARP_SHARP"]=30,G[z[31]="G_SHARP_SHARP"]=31,G[z[32]="D_SHARP_SHARP"]=32,G[z[33]="A_SHARP_SHARP"]=33,G[z[34]="E_SHARP_SHARP"]=34,G[z[35]="B_SHARP_SHARP"]=35,G),t.TimeSignature=function(){function t(z){if(z)for(var G=Object.keys(z),V=0;V<G.length;++V)null!=z[G[V]]&&(this[G[V]]=z[G[V]])}return t.prototype.time=0,t.prototype.numerator=0,t.prototype.denominator=0,t.create=function(z){return new t(z)},t.encode=function(z,G){return G||(G=it.create()),null!=z.time&&z.hasOwnProperty("time")&&G.uint32(9).double(z.time),null!=z.numerator&&z.hasOwnProperty("numerator")&&G.uint32(16).int32(z.numerator),null!=z.denominator&&z.hasOwnProperty("denominator")&&G.uint32(24).int32(z.denominator),G},t.encodeDelimited=function(z,G){return this.encode(z,G).ldelim()},t.decode=function(z,G){z instanceof Z||(z=Z.create(z));for(var V=void 0===G?z.len:z.pos+G,H=new rt.tensorflow.magenta.NoteSequence.TimeSignature;z.pos<V;){var W=z.uint32();switch(W>>>3){case 1:H.time=z.double();break;case 2:H.numerator=z.int32();break;case 3:H.denominator=z.int32();break;default:z.skipType(7&W)}}return H},t.decodeDelimited=function(z){return z instanceof Z||(z=new Z(z)),this.decode(z,z.uint32())},t.verify=function(z){return"object"!=typeof z||null===z?"object expected":null!=z.time&&z.hasOwnProperty("time")&&"number"!=typeof z.time?"time: number expected":null!=z.numerator&&z.hasOwnProperty("numerator")&&!ot.isInteger(z.numerator)?"numerator: integer expected":null!=z.denominator&&z.hasOwnProperty("denominator")&&!ot.isInteger(z.denominator)?"denominator: integer expected":null},t.fromObject=function(z){if(z instanceof rt.tensorflow.magenta.NoteSequence.TimeSignature)return z;var G=new rt.tensorflow.magenta.NoteSequence.TimeSignature;return null!=z.time&&(G.time=Number(z.time)),null!=z.numerator&&(G.numerator=0|z.numerator),null!=z.denominator&&(G.denominator=0|z.denominator),G},t.toObject=function(z,G){G||(G={});var V={};return G.defaults&&(V.time=0,V.numerator=0,V.denominator=0),null!=z.time&&z.hasOwnProperty("time")&&(V.time=G.json&&!isFinite(z.time)?String(z.time):z.time),null!=z.numerator&&z.hasOwnProperty("numerator")&&(V.numerator=z.numerator),null!=z.denominator&&z.hasOwnProperty("denominator")&&(V.denominator=z.denominator),V},t.prototype.toJSON=function(){return this.constructor.toObject(this,K.util.toJSONOptions)},t}(),t.KeySignature=function(){function t(z){if(z)for(var G=Object.keys(z),V=0;V<G.length;++V)null!=z[G[V]]&&(this[G[V]]=z[G[V]])}return t.prototype.time=0,t.prototype.key=0,t.prototype.mode=0,t.create=function(z){return new t(z)},t.encode=function(z,G){return G||(G=it.create()),null!=z.time&&z.hasOwnProperty("time")&&G.uint32(9).double(z.time),null!=z.key&&z.hasOwnProperty("key")&&G.uint32(16).int32(z.key),null!=z.mode&&z.hasOwnProperty("mode")&&G.uint32(24).int32(z.mode),G},t.encodeDelimited=function(z,G){return this.encode(z,G).ldelim()},t.decode=function(z,G){z instanceof Z||(z=Z.create(z));for(var V=void 0===G?z.len:z.pos+G,H=new rt.tensorflow.magenta.NoteSequence.KeySignature;z.pos<V;){var W=z.uint32();switch(W>>>3){case 1:H.time=z.double();break;case 2:H.key=z.int32();break;case 3:H.mode=z.int32();break;default:z.skipType(7&W)}}return H},t.decodeDelimited=function(z){return z instanceof Z||(z=new Z(z)),this.decode(z,z.uint32())},t.verify=function(z){if("object"!=typeof z||null===z)return"object expected";if(null!=z.time&&z.hasOwnProperty("time")&&"number"!=typeof z.time)return"time: number expected";if(null!=z.key&&z.hasOwnProperty("key"))switch(z.key){default:return"key: enum value expected";case 0:case 1:case 1:case 2:case 3:case 3:case 4:case 5:case 6:case 6:case 7:case 8:case 8:case 9:case 10:case 10:case 11:}if(null!=z.mode&&z.hasOwnProperty("mode"))switch(z.mode){default:return"mode: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:}return null},t.fromObject=function(z){if(z instanceof rt.tensorflow.magenta.NoteSequence.KeySignature)return z;var G=new rt.tensorflow.magenta.NoteSequence.KeySignature;switch(null!=z.time&&(G.time=Number(z.time)),z.key){case"C":case 0:G.key=0;break;case"C_SHARP":case 1:case"D_FLAT":case 1:G.key=1;break;case"D":case 2:G.key=2;break;case"D_SHARP":case 3:case"E_FLAT":case 3:G.key=3;break;case"E":case 4:G.key=4;break;case"F":case 5:G.key=5;break;case"F_SHARP":case 6:case"G_FLAT":case 6:G.key=6;break;case"G":case 7:G.key=7;break;case"G_SHARP":case 8:case"A_FLAT":case 8:G.key=8;break;case"A":case 9:G.key=9;break;case"A_SHARP":case 10:case"B_FLAT":case 10:G.key=10;break;case"B":case 11:G.key=11}switch(z.mode){case"MAJOR":case 0:G.mode=0;break;case"MINOR":case 1:G.mode=1;break;case"NOT_SPECIFIED":case 2:G.mode=2;break;case"MIXOLYDIAN":case 3:G.mode=3;break;case"DORIAN":case 4:G.mode=4;break;case"PHRYGIAN":case 5:G.mode=5;break;case"LYDIAN":case 6:G.mode=6;break;case"LOCRIAN":case 7:G.mode=7}return G},t.toObject=function(z,G){G||(G={});var V={};return G.defaults&&(V.time=0,V.key=G.enums===String?"C":0,V.mode=G.enums===String?"MAJOR":0),null!=z.time&&z.hasOwnProperty("time")&&(V.time=G.json&&!isFinite(z.time)?String(z.time):z.time),null!=z.key&&z.hasOwnProperty("key")&&(V.key=G.enums===String?rt.tensorflow.magenta.NoteSequence.KeySignature.Key[z.key]:z.key),null!=z.mode&&z.hasOwnProperty("mode")&&(V.mode=G.enums===String?rt.tensorflow.magenta.NoteSequence.KeySignature.Mode[z.mode]:z.mode),V},t.prototype.toJSON=function(){return this.constructor.toObject(this,K.util.toJSONOptions)},t.Key=function(){var z={},G=Object.create(z);return G[z[0]="C"]=0,G[z[1]="C_SHARP"]=1,G.D_FLAT=1,G[z[2]="D"]=2,G[z[3]="D_SHARP"]=3,G.E_FLAT=3,G[z[4]="E"]=4,G[z[5]="F"]=5,G[z[6]="F_SHARP"]=6,G.G_FLAT=6,G[z[7]="G"]=7,G[z[8]="G_SHARP"]=8,G.A_FLAT=8,G[z[9]="A"]=9,G[z[10]="A_SHARP"]=10,G.B_FLAT=10,G[z[11]="B"]=11,G}(),t.Mode=function(){var z={},G=Object.create(z);return G[z[0]="MAJOR"]=0,G[z[1]="MINOR"]=1,G[z[2]="NOT_SPECIFIED"]=2,G[z[3]="MIXOLYDIAN"]=3,G[z[4]="DORIAN"]=4,G[z[5]="PHRYGIAN"]=5,G[z[6]="LYDIAN"]=6,G[z[7]="LOCRIAN"]=7,G}(),t}(),t.Tempo=function(){function t(z){if(z)for(var G=Object.keys(z),V=0;V<G.length;++V)null!=z[G[V]]&&(this[G[V]]=z[G[V]])}return t.prototype.time=0,t.prototype.qpm=0,t.create=function(z){return new t(z)},t.encode=function(z,G){return G||(G=it.create()),null!=z.time&&z.hasOwnProperty("time")&&G.uint32(9).double(z.time),null!=z.qpm&&z.hasOwnProperty("qpm")&&G.uint32(17).double(z.qpm),G},t.encodeDelimited=function(z,G){return this.encode(z,G).ldelim()},t.decode=function(z,G){z instanceof Z||(z=Z.create(z));for(var V=void 0===G?z.len:z.pos+G,H=new rt.tensorflow.magenta.NoteSequence.Tempo;z.pos<V;){var W=z.uint32();switch(W>>>3){case 1:H.time=z.double();break;case 2:H.qpm=z.double();break;default:z.skipType(7&W)}}return H},t.decodeDelimited=function(z){return z instanceof Z||(z=new Z(z)),this.decode(z,z.uint32())},t.verify=function(z){return"object"!=typeof z||null===z?"object expected":null!=z.time&&z.hasOwnProperty("time")&&"number"!=typeof z.time?"time: number expected":null!=z.qpm&&z.hasOwnProperty("qpm")&&"number"!=typeof z.qpm?"qpm: number expected":null},t.fromObject=function(z){if(z instanceof rt.tensorflow.magenta.NoteSequence.Tempo)return z;var G=new rt.tensorflow.magenta.NoteSequence.Tempo;return null!=z.time&&(G.time=Number(z.time)),null!=z.qpm&&(G.qpm=Number(z.qpm)),G},t.toObject=function(z,G){G||(G={});var V={};return G.defaults&&(V.time=0,V.qpm=0),null!=z.time&&z.hasOwnProperty("time")&&(V.time=G.json&&!isFinite(z.time)?String(z.time):z.time),null!=z.qpm&&z.hasOwnProperty("qpm")&&(V.qpm=G.json&&!isFinite(z.qpm)?String(z.qpm):z.qpm),V},t.prototype.toJSON=function(){return this.constructor.toObject(this,K.util.toJSONOptions)},t}(),t.PitchBend=function(){function t(z){if(z)for(var G=Object.keys(z),V=0;V<G.length;++V)null!=z[G[V]]&&(this[G[V]]=z[G[V]])}return t.prototype.time=0,t.prototype.bend=0,t.prototype.instrument=0,t.prototype.program=0,t.prototype.isDrum=!1,t.create=function(z){return new t(z)},t.encode=function(z,G){return G||(G=it.create()),null!=z.time&&z.hasOwnProperty("time")&&G.uint32(9).double(z.time),null!=z.bend&&z.hasOwnProperty("bend")&&G.uint32(16).int32(z.bend),null!=z.instrument&&z.hasOwnProperty("instrument")&&G.uint32(24).int32(z.instrument),null!=z.program&&z.hasOwnProperty("program")&&G.uint32(32).int32(z.program),null!=z.isDrum&&z.hasOwnProperty("isDrum")&&G.uint32(40).bool(z.isDrum),G},t.encodeDelimited=function(z,G){return this.encode(z,G).ldelim()},t.decode=function(z,G){z instanceof Z||(z=Z.create(z));for(var V=void 0===G?z.len:z.pos+G,H=new rt.tensorflow.magenta.NoteSequence.PitchBend;z.pos<V;){var W=z.uint32();switch(W>>>3){case 1:H.time=z.double();break;case 2:H.bend=z.int32();break;case 3:H.instrument=z.int32();break;case 4:H.program=z.int32();break;case 5:H.isDrum=z.bool();break;default:z.skipType(7&W)}}return H},t.decodeDelimited=function(z){return z instanceof Z||(z=new Z(z)),this.decode(z,z.uint32())},t.verify=function(z){return"object"!=typeof z||null===z?"object expected":null!=z.time&&z.hasOwnProperty("time")&&"number"!=typeof z.time?"time: number expected":null!=z.bend&&z.hasOwnProperty("bend")&&!ot.isInteger(z.bend)?"bend: integer expected":null!=z.instrument&&z.hasOwnProperty("instrument")&&!ot.isInteger(z.instrument)?"instrument: integer expected":null!=z.program&&z.hasOwnProperty("program")&&!ot.isInteger(z.program)?"program: integer expected":null!=z.isDrum&&z.hasOwnProperty("isDrum")&&"boolean"!=typeof z.isDrum?"isDrum: boolean expected":null},t.fromObject=function(z){if(z instanceof rt.tensorflow.magenta.NoteSequence.PitchBend)return z;var G=new rt.tensorflow.magenta.NoteSequence.PitchBend;return null!=z.time&&(G.time=Number(z.time)),null!=z.bend&&(G.bend=0|z.bend),null!=z.instrument&&(G.instrument=0|z.instrument),null!=z.program&&(G.program=0|z.program),null!=z.isDrum&&(G.isDrum=Boolean(z.isDrum)),G},t.toObject=function(z,G){G||(G={});var V={};return G.defaults&&(V.time=0,V.bend=0,V.instrument=0,V.program=0,V.isDrum=!1),null!=z.time&&z.hasOwnProperty("time")&&(V.time=G.json&&!isFinite(z.time)?String(z.time):z.time),null!=z.bend&&z.hasOwnProperty("bend")&&(V.bend=z.bend),null!=z.instrument&&z.hasOwnProperty("instrument")&&(V.instrument=z.instrument),null!=z.program&&z.hasOwnProperty("program")&&(V.program=z.program),null!=z.isDrum&&z.hasOwnProperty("isDrum")&&(V.isDrum=z.isDrum),V},t.prototype.toJSON=function(){return this.constructor.toObject(this,K.util.toJSONOptions)},t}(),t.ControlChange=function(){function t(z){if(z)for(var G=Object.keys(z),V=0;V<G.length;++V)null!=z[G[V]]&&(this[G[V]]=z[G[V]])}return t.prototype.time=0,t.prototype.quantizedStep=ot.Long?ot.Long.fromBits(0,0,!1):0,t.prototype.controlNumber=0,t.prototype.controlValue=0,t.prototype.instrument=0,t.prototype.program=0,t.prototype.isDrum=!1,t.create=function(z){return new t(z)},t.encode=function(z,G){return G||(G=it.create()),null!=z.time&&z.hasOwnProperty("time")&&G.uint32(9).double(z.time),null!=z.controlNumber&&z.hasOwnProperty("controlNumber")&&G.uint32(16).int32(z.controlNumber),null!=z.controlValue&&z.hasOwnProperty("controlValue")&&G.uint32(24).int32(z.controlValue),null!=z.instrument&&z.hasOwnProperty("instrument")&&G.uint32(32).int32(z.instrument),null!=z.program&&z.hasOwnProperty("program")&&G.uint32(40).int32(z.program),null!=z.isDrum&&z.hasOwnProperty("isDrum")&&G.uint32(48).bool(z.isDrum),null!=z.quantizedStep&&z.hasOwnProperty("quantizedStep")&&G.uint32(56).int64(z.quantizedStep),G},t.encodeDelimited=function(z,G){return this.encode(z,G).ldelim()},t.decode=function(z,G){z instanceof Z||(z=Z.create(z));for(var V=void 0===G?z.len:z.pos+G,H=new rt.tensorflow.magenta.NoteSequence.ControlChange;z.pos<V;){var W=z.uint32();switch(W>>>3){case 1:H.time=z.double();break;case 7:H.quantizedStep=ot.Long?z.int64().toNumber():z.int64();break;case 2:H.controlNumber=z.int32();break;case 3:H.controlValue=z.int32();break;case 4:H.instrument=z.int32();break;case 5:H.program=z.int32();break;case 6:H.isDrum=z.bool();break;default:z.skipType(7&W)}}return H},t.decodeDelimited=function(z){return z instanceof Z||(z=new Z(z)),this.decode(z,z.uint32())},t.verify=function(z){return"object"!=typeof z||null===z?"object expected":null!=z.time&&z.hasOwnProperty("time")&&"number"!=typeof z.time?"time: number expected":null!=z.quantizedStep&&z.hasOwnProperty("quantizedStep")&&!(ot.isInteger(z.quantizedStep)||z.quantizedStep&&ot.isInteger(z.quantizedStep.low)&&ot.isInteger(z.quantizedStep.high))?"quantizedStep: integer|Long expected":null!=z.controlNumber&&z.hasOwnProperty("controlNumber")&&!ot.isInteger(z.controlNumber)?"controlNumber: integer expected":null!=z.controlValue&&z.hasOwnProperty("controlValue")&&!ot.isInteger(z.controlValue)?"controlValue: integer expected":null!=z.instrument&&z.hasOwnProperty("instrument")&&!ot.isInteger(z.instrument)?"instrument: integer expected":null!=z.program&&z.hasOwnProperty("program")&&!ot.isInteger(z.program)?"program: integer expected":null!=z.isDrum&&z.hasOwnProperty("isDrum")&&"boolean"!=typeof z.isDrum?"isDrum: boolean expected":null},t.fromObject=function(z){if(z instanceof rt.tensorflow.magenta.NoteSequence.ControlChange)return z;var G=new rt.tensorflow.magenta.NoteSequence.ControlChange;return null!=z.time&&(G.time=Number(z.time)),null!=z.quantizedStep&&(ot.Long?(G.quantizedStep=ot.Long.fromValue(z.quantizedStep)).unsigned=!1:"string"==typeof z.quantizedStep?G.quantizedStep=parseInt(z.quantizedStep,10):"number"==typeof z.quantizedStep?G.quantizedStep=z.quantizedStep:"object"==typeof z.quantizedStep&&(G.quantizedStep=new ot.LongBits(z.quantizedStep.low>>>0,z.quantizedStep.high>>>0).toNumber())),null!=z.controlNumber&&(G.controlNumber=0|z.controlNumber),null!=z.controlValue&&(G.controlValue=0|z.controlValue),null!=z.instrument&&(G.instrument=0|z.instrument),null!=z.program&&(G.program=0|z.program),null!=z.isDrum&&(G.isDrum=Boolean(z.isDrum)),G},t.toObject=function(z,G){G||(G={});var V={};if(G.defaults)if(V.time=0,V.controlNumber=0,V.controlValue=0,V.instrument=0,V.program=0,V.isDrum=!1,ot.Long){var H=new ot.Long(0,0,!1);V.quantizedStep=G.longs===String?H.toString():G.longs===Number?H.toNumber():H}else V.quantizedStep=G.longs===String?"0":0;return null!=z.time&&z.hasOwnProperty("time")&&(V.time=G.json&&!isFinite(z.time)?String(z.time):z.time),null!=z.controlNumber&&z.hasOwnProperty("controlNumber")&&(V.controlNumber=z.controlNumber),null!=z.controlValue&&z.hasOwnProperty("controlValue")&&(V.controlValue=z.controlValue),null!=z.instrument&&z.hasOwnProperty("instrument")&&(V.instrument=z.instrument),null!=z.program&&z.hasOwnProperty("program")&&(V.program=z.program),null!=z.isDrum&&z.hasOwnProperty("isDrum")&&(V.isDrum=z.isDrum),null!=z.quantizedStep&&z.hasOwnProperty("quantizedStep")&&("number"==typeof z.quantizedStep?V.quantizedStep=G.longs===String?String(z.quantizedStep):z.quantizedStep:V.quantizedStep=G.longs===String?ot.Long.prototype.toString.call(z.quantizedStep):G.longs===Number?new ot.LongBits(z.quantizedStep.low>>>0,z.quantizedStep.high>>>0).toNumber():z.quantizedStep),V},t.prototype.toJSON=function(){return this.constructor.toObject(this,K.util.toJSONOptions)},t}(),t.PartInfo=function(){function t(z){if(z)for(var G=Object.keys(z),V=0;V<G.length;++V)null!=z[G[V]]&&(this[G[V]]=z[G[V]])}return t.prototype.part=0,t.prototype.name="",t.create=function(z){return new t(z)},t.encode=function(z,G){return G||(G=it.create()),null!=z.part&&z.hasOwnProperty("part")&&G.uint32(8).int32(z.part),null!=z.name&&z.hasOwnProperty("name")&&G.uint32(18).string(z.name),G},t.encodeDelimited=function(z,G){return this.encode(z,G).ldelim()},t.decode=function(z,G){z instanceof Z||(z=Z.create(z));for(var V=void 0===G?z.len:z.pos+G,H=new rt.tensorflow.magenta.NoteSequence.PartInfo;z.pos<V;){var W=z.uint32();switch(W>>>3){case 1:H.part=z.int32();break;case 2:H.name=z.string();break;default:z.skipType(7&W)}}return H},t.decodeDelimited=function(z){return z instanceof Z||(z=new Z(z)),this.decode(z,z.uint32())},t.verify=function(z){return"object"!=typeof z||null===z?"object expected":null!=z.part&&z.hasOwnProperty("part")&&!ot.isInteger(z.part)?"part: integer expected":null!=z.name&&z.hasOwnProperty("name")&&!ot.isString(z.name)?"name: string expected":null},t.fromObject=function(z){if(z instanceof rt.tensorflow.magenta.NoteSequence.PartInfo)return z;var G=new rt.tensorflow.magenta.NoteSequence.PartInfo;return null!=z.part&&(G.part=0|z.part),null!=z.name&&(G.name=String(z.name)),G},t.toObject=function(z,G){G||(G={});var V={};return G.defaults&&(V.part=0,V.name=""),null!=z.part&&z.hasOwnProperty("part")&&(V.part=z.part),null!=z.name&&z.hasOwnProperty("name")&&(V.name=z.name),V},t.prototype.toJSON=function(){return this.constructor.toObject(this,K.util.toJSONOptions)},t}(),t.SourceInfo=function(){function t(z){if(z)for(var G=Object.keys(z),V=0;V<G.length;++V)null!=z[G[V]]&&(this[G[V]]=z[G[V]])}return t.prototype.sourceType=0,t.prototype.encodingType=0,t.prototype.parser=0,t.create=function(z){return new t(z)},t.encode=function(z,G){return G||(G=it.create()),null!=z.sourceType&&z.hasOwnProperty("sourceType")&&G.uint32(8).int32(z.sourceType),null!=z.encodingType&&z.hasOwnProperty("encodingType")&&G.uint32(16).int32(z.encodingType),null!=z.parser&&z.hasOwnProperty("parser")&&G.uint32(24).int32(z.parser),G},t.encodeDelimited=function(z,G){return this.encode(z,G).ldelim()},t.decode=function(z,G){z instanceof Z||(z=Z.create(z));for(var V=void 0===G?z.len:z.pos+G,H=new rt.tensorflow.magenta.NoteSequence.SourceInfo;z.pos<V;){var W=z.uint32();switch(W>>>3){case 1:H.sourceType=z.int32();break;case 2:H.encodingType=z.int32();break;case 3:H.parser=z.int32();break;default:z.skipType(7&W)}}return H},t.decodeDelimited=function(z){return z instanceof Z||(z=new Z(z)),this.decode(z,z.uint32())},t.verify=function(z){if("object"!=typeof z||null===z)return"object expected";if(null!=z.sourceType&&z.hasOwnProperty("sourceType"))switch(z.sourceType){default:return"sourceType: enum value expected";case 0:case 1:case 2:}if(null!=z.encodingType&&z.hasOwnProperty("encodingType"))switch(z.encodingType){default:return"encodingType: enum value expected";case 0:case 1:case 2:case 3:case 4:}if(null!=z.parser&&z.hasOwnProperty("parser"))switch(z.parser){default:return"parser: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:}return null},t.fromObject=function(z){if(z instanceof rt.tensorflow.magenta.NoteSequence.SourceInfo)return z;var G=new rt.tensorflow.magenta.NoteSequence.SourceInfo;switch(z.sourceType){case"UNKNOWN_SOURCE_TYPE":case 0:G.sourceType=0;break;case"SCORE_BASED":case 1:G.sourceType=1;break;case"PERFORMANCE_BASED":case 2:G.sourceType=2}switch(z.encodingType){case"UNKNOWN_ENCODING_TYPE":case 0:G.encodingType=0;break;case"MUSIC_XML":case 1:G.encodingType=1;break;case"ABC":case 2:G.encodingType=2;break;case"MIDI":case 3:G.encodingType=3;break;case"MUSICNET":case 4:G.encodingType=4}switch(z.parser){case"UNKNOWN_PARSER":case 0:G.parser=0;break;case"MUSIC21":case 1:G.parser=1;break;case"PRETTY_MIDI":case 2:G.parser=2;break;case"MAGENTA_MUSIC_XML":case 3:G.parser=3;break;case"MAGENTA_MUSICNET":case 4:G.parser=4;break;case"MAGENTA_ABC":case 5:G.parser=5;break;case"TONEJS_MIDI_CONVERT":case 6:G.parser=6}return G},t.toObject=function(z,G){G||(G={});var V={};return G.defaults&&(V.sourceType=G.enums===String?"UNKNOWN_SOURCE_TYPE":0,V.encodingType=G.enums===String?"UNKNOWN_ENCODING_TYPE":0,V.parser=G.enums===String?"UNKNOWN_PARSER":0),null!=z.sourceType&&z.hasOwnProperty("sourceType")&&(V.sourceType=G.enums===String?rt.tensorflow.magenta.NoteSequence.SourceInfo.SourceType[z.sourceType]:z.sourceType),null!=z.encodingType&&z.hasOwnProperty("encodingType")&&(V.encodingType=G.enums===String?rt.tensorflow.magenta.NoteSequence.SourceInfo.EncodingType[z.encodingType]:z.encodingType),null!=z.parser&&z.hasOwnProperty("parser")&&(V.parser=G.enums===String?rt.tensorflow.magenta.NoteSequence.SourceInfo.Parser[z.parser]:z.parser),V},t.prototype.toJSON=function(){return this.constructor.toObject(this,K.util.toJSONOptions)},t.SourceType=function(){var z={},G=Object.create(z);return G[z[0]="UNKNOWN_SOURCE_TYPE"]=0,G[z[1]="SCORE_BASED"]=1,G[z[2]="PERFORMANCE_BASED"]=2,G}(),t.EncodingType=function(){var z={},G=Object.create(z);return G[z[0]="UNKNOWN_ENCODING_TYPE"]=0,G[z[1]="MUSIC_XML"]=1,G[z[2]="ABC"]=2,G[z[3]="MIDI"]=3,G[z[4]="MUSICNET"]=4,G}(),t.Parser=function(){var z={},G=Object.create(z);return G[z[0]="UNKNOWN_PARSER"]=0,G[z[1]="MUSIC21"]=1,G[z[2]="PRETTY_MIDI"]=2,G[z[3]="MAGENTA_MUSIC_XML"]=3,G[z[4]="MAGENTA_MUSICNET"]=4,G[z[5]="MAGENTA_ABC"]=5,G[z[6]="TONEJS_MIDI_CONVERT"]=6,G}(),t}(),t.TextAnnotation=function(){function t(z){if(z)for(var G=Object.keys(z),V=0;V<G.length;++V)null!=z[G[V]]&&(this[G[V]]=z[G[V]])}return t.prototype.time=0,t.prototype.quantizedStep=ot.Long?ot.Long.fromBits(0,0,!1):0,t.prototype.text="",t.prototype.annotationType=0,t.create=function(z){return new t(z)},t.encode=function(z,G){return G||(G=it.create()),null!=z.time&&z.hasOwnProperty("time")&&G.uint32(9).double(z.time),null!=z.text&&z.hasOwnProperty("text")&&G.uint32(18).string(z.text),null!=z.annotationType&&z.hasOwnProperty("annotationType")&&G.uint32(24).int32(z.annotationType),null!=z.quantizedStep&&z.hasOwnProperty("quantizedStep")&&G.uint32(32).int64(z.quantizedStep),G},t.encodeDelimited=function(z,G){return this.encode(z,G).ldelim()},t.decode=function(z,G){z instanceof Z||(z=Z.create(z));for(var V=void 0===G?z.len:z.pos+G,H=new rt.tensorflow.magenta.NoteSequence.TextAnnotation;z.pos<V;){var W=z.uint32();switch(W>>>3){case 1:H.time=z.double();break;case 4:H.quantizedStep=ot.Long?z.int64().toNumber():z.int64();break;case 2:H.text=z.string();break;case 3:H.annotationType=z.int32();break;default:z.skipType(7&W)}}return H},t.decodeDelimited=function(z){return z instanceof Z||(z=new Z(z)),this.decode(z,z.uint32())},t.verify=function(z){if("object"!=typeof z||null===z)return"object expected";if(null!=z.time&&z.hasOwnProperty("time")&&"number"!=typeof z.time)return"time: number expected";if(null!=z.quantizedStep&&z.hasOwnProperty("quantizedStep")&&!(ot.isInteger(z.quantizedStep)||z.quantizedStep&&ot.isInteger(z.quantizedStep.low)&&ot.isInteger(z.quantizedStep.high)))return"quantizedStep: integer|Long expected";if(null!=z.text&&z.hasOwnProperty("text")&&!ot.isString(z.text))return"text: string expected";if(null!=z.annotationType&&z.hasOwnProperty("annotationType"))switch(z.annotationType){default:return"annotationType: enum value expected";case 0:case 1:case 2:}return null},t.fromObject=function(z){if(z instanceof rt.tensorflow.magenta.NoteSequence.TextAnnotation)return z;var G=new rt.tensorflow.magenta.NoteSequence.TextAnnotation;switch(null!=z.time&&(G.time=Number(z.time)),null!=z.quantizedStep&&(ot.Long?(G.quantizedStep=ot.Long.fromValue(z.quantizedStep)).unsigned=!1:"string"==typeof z.quantizedStep?G.quantizedStep=parseInt(z.quantizedStep,10):"number"==typeof z.quantizedStep?G.quantizedStep=z.quantizedStep:"object"==typeof z.quantizedStep&&(G.quantizedStep=new ot.LongBits(z.quantizedStep.low>>>0,z.quantizedStep.high>>>0).toNumber())),null!=z.text&&(G.text=String(z.text)),z.annotationType){case"UNKNOWN":case 0:G.annotationType=0;break;case"CHORD_SYMBOL":case 1:G.annotationType=1;break;case"BEAT":case 2:G.annotationType=2}return G},t.toObject=function(z,G){G||(G={});var V={};if(G.defaults)if(V.time=0,V.text="",V.annotationType=G.enums===String?"UNKNOWN":0,ot.Long){var H=new ot.Long(0,0,!1);V.quantizedStep=G.longs===String?H.toString():G.longs===Number?H.toNumber():H}else V.quantizedStep=G.longs===String?"0":0;return null!=z.time&&z.hasOwnProperty("time")&&(V.time=G.json&&!isFinite(z.time)?String(z.time):z.time),null!=z.text&&z.hasOwnProperty("text")&&(V.text=z.text),null!=z.annotationType&&z.hasOwnProperty("annotationType")&&(V.annotationType=G.enums===String?rt.tensorflow.magenta.NoteSequence.TextAnnotation.TextAnnotationType[z.annotationType]:z.annotationType),null!=z.quantizedStep&&z.hasOwnProperty("quantizedStep")&&("number"==typeof z.quantizedStep?V.quantizedStep=G.longs===String?String(z.quantizedStep):z.quantizedStep:V.quantizedStep=G.longs===String?ot.Long.prototype.toString.call(z.quantizedStep):G.longs===Number?new ot.LongBits(z.quantizedStep.low>>>0,z.quantizedStep.high>>>0).toNumber():z.quantizedStep),V},t.prototype.toJSON=function(){return this.constructor.toObject(this,K.util.toJSONOptions)},t.TextAnnotationType=function(){var z={},G=Object.create(z);return G[z[0]="UNKNOWN"]=0,G[z[1]="CHORD_SYMBOL"]=1,G[z[2]="BEAT"]=2,G}(),t}(),t.QuantizationInfo=function(){function t(z){if(z)for(var G=Object.keys(z),V=0;V<G.length;++V)null!=z[G[V]]&&(this[G[V]]=z[G[V]])}var z;return t.prototype.stepsPerQuarter=0,t.prototype.stepsPerSecond=0,Object.defineProperty(t.prototype,"resolution",{get:ot.oneOfGetter(z=["stepsPerQuarter","stepsPerSecond"]),set:ot.oneOfSetter(z)}),t.create=function(z){return new t(z)},t.encode=function(z,G){return G||(G=it.create()),null!=z.stepsPerQuarter&&z.hasOwnProperty("stepsPerQuarter")&&G.uint32(8).int32(z.stepsPerQuarter),null!=z.stepsPerSecond&&z.hasOwnProperty("stepsPerSecond")&&G.uint32(16).int32(z.stepsPerSecond),G},t.encodeDelimited=function(z,G){return this.encode(z,G).ldelim()},t.decode=function(z,G){z instanceof Z||(z=Z.create(z));for(var V=void 0===G?z.len:z.pos+G,H=new rt.tensorflow.magenta.NoteSequence.QuantizationInfo;z.pos<V;){var W=z.uint32();switch(W>>>3){case 1:H.stepsPerQuarter=z.int32();break;case 2:H.stepsPerSecond=z.int32();break;default:z.skipType(7&W)}}return H},t.decodeDelimited=function(z){return z instanceof Z||(z=new Z(z)),this.decode(z,z.uint32())},t.verify=function(z){if("object"!=typeof z||null===z)return"object expected";var G={};if(null!=z.stepsPerQuarter&&z.hasOwnProperty("stepsPerQuarter")&&(G.resolution=1,!ot.isInteger(z.stepsPerQuarter)))return"stepsPerQuarter: integer expected";if(null!=z.stepsPerSecond&&z.hasOwnProperty("stepsPerSecond")){if(1===G.resolution)return"resolution: multiple values";if(G.resolution=1,!ot.isInteger(z.stepsPerSecond))return"stepsPerSecond: integer expected"}return null},t.fromObject=function(z){if(z instanceof rt.tensorflow.magenta.NoteSequence.QuantizationInfo)return z;var G=new rt.tensorflow.magenta.NoteSequence.QuantizationInfo;return null!=z.stepsPerQuarter&&(G.stepsPerQuarter=0|z.stepsPerQuarter),null!=z.stepsPerSecond&&(G.stepsPerSecond=0|z.stepsPerSecond),G},t.toObject=function(z,G){G||(G={});var V={};return null!=z.stepsPerQuarter&&z.hasOwnProperty("stepsPerQuarter")&&(V.stepsPerQuarter=z.stepsPerQuarter,G.oneofs&&(V.resolution="stepsPerQuarter")),null!=z.stepsPerSecond&&z.hasOwnProperty("stepsPerSecond")&&(V.stepsPerSecond=z.stepsPerSecond,G.oneofs&&(V.resolution="stepsPerSecond")),V},t.prototype.toJSON=function(){return this.constructor.toObject(this,K.util.toJSONOptions)},t}(),t.SubsequenceInfo=function(){function t(z){if(z)for(var G=Object.keys(z),V=0;V<G.length;++V)null!=z[G[V]]&&(this[G[V]]=z[G[V]])}return t.prototype.startTimeOffset=0,t.prototype.endTimeOffset=0,t.create=function(z){return new t(z)},t.encode=function(z,G){return G||(G=it.create()),null!=z.startTimeOffset&&z.hasOwnProperty("startTimeOffset")&&G.uint32(9).double(z.startTimeOffset),null!=z.endTimeOffset&&z.hasOwnProperty("endTimeOffset")&&G.uint32(17).double(z.endTimeOffset),G},t.encodeDelimited=function(z,G){return this.encode(z,G).ldelim()},t.decode=function(z,G){z instanceof Z||(z=Z.create(z));for(var V=void 0===G?z.len:z.pos+G,H=new rt.tensorflow.magenta.NoteSequence.SubsequenceInfo;z.pos<V;){var W=z.uint32();switch(W>>>3){case 1:H.startTimeOffset=z.double();break;case 2:H.endTimeOffset=z.double();break;default:z.skipType(7&W)}}return H},t.decodeDelimited=function(z){return z instanceof Z||(z=new Z(z)),this.decode(z,z.uint32())},t.verify=function(z){return"object"!=typeof z||null===z?"object expected":null!=z.startTimeOffset&&z.hasOwnProperty("startTimeOffset")&&"number"!=typeof z.startTimeOffset?"startTimeOffset: number expected":null!=z.endTimeOffset&&z.hasOwnProperty("endTimeOffset")&&"number"!=typeof z.endTimeOffset?"endTimeOffset: number expected":null},t.fromObject=function(z){if(z instanceof rt.tensorflow.magenta.NoteSequence.SubsequenceInfo)return z;var G=new rt.tensorflow.magenta.NoteSequence.SubsequenceInfo;return null!=z.startTimeOffset&&(G.startTimeOffset=Number(z.startTimeOffset)),null!=z.endTimeOffset&&(G.endTimeOffset=Number(z.endTimeOffset)),G},t.toObject=function(z,G){G||(G={});var V={};return G.defaults&&(V.startTimeOffset=0,V.endTimeOffset=0),null!=z.startTimeOffset&&z.hasOwnProperty("startTimeOffset")&&(V.startTimeOffset=G.json&&!isFinite(z.startTimeOffset)?String(z.startTimeOffset):z.startTimeOffset),null!=z.endTimeOffset&&z.hasOwnProperty("endTimeOffset")&&(V.endTimeOffset=G.json&&!isFinite(z.endTimeOffset)?String(z.endTimeOffset):z.endTimeOffset),V},t.prototype.toJSON=function(){return this.constructor.toObject(this,K.util.toJSONOptions)},t}(),t.SectionAnnotation=function(){function t(z){if(z)for(var G=Object.keys(z),V=0;V<G.length;++V)null!=z[G[V]]&&(this[G[V]]=z[G[V]])}return t.prototype.time=0,t.prototype.sectionId=ot.Long?ot.Long.fromBits(0,0,!1):0,t.create=function(z){return new t(z)},t.encode=function(z,G){return G||(G=it.create()),null!=z.time&&z.hasOwnProperty("time")&&G.uint32(9).double(z.time),null!=z.sectionId&&z.hasOwnProperty("sectionId")&&G.uint32(32).int64(z.sectionId),G},t.encodeDelimited=function(z,G){return this.encode(z,G).ldelim()},t.decode=function(z,G){z instanceof Z||(z=Z.create(z));for(var V=void 0===G?z.len:z.pos+G,H=new rt.tensorflow.magenta.NoteSequence.SectionAnnotation;z.pos<V;){var W=z.uint32();switch(W>>>3){case 1:H.time=z.double();break;case 4:H.sectionId=ot.Long?z.int64().toNumber():z.int64();break;default:z.skipType(7&W)}}return H},t.decodeDelimited=function(z){return z instanceof Z||(z=new Z(z)),this.decode(z,z.uint32())},t.verify=function(z){return"object"!=typeof z||null===z?"object expected":null!=z.time&&z.hasOwnProperty("time")&&"number"!=typeof z.time?"time: number expected":null!=z.sectionId&&z.hasOwnProperty("sectionId")&&!(ot.isInteger(z.sectionId)||z.sectionId&&ot.isInteger(z.sectionId.low)&&ot.isInteger(z.sectionId.high))?"sectionId: integer|Long expected":null},t.fromObject=function(z){if(z instanceof rt.tensorflow.magenta.NoteSequence.SectionAnnotation)return z;var G=new rt.tensorflow.magenta.NoteSequence.SectionAnnotation;return null!=z.time&&(G.time=Number(z.time)),null!=z.sectionId&&(ot.Long?(G.sectionId=ot.Long.fromValue(z.sectionId)).unsigned=!1:"string"==typeof z.sectionId?G.sectionId=parseInt(z.sectionId,10):"number"==typeof z.sectionId?G.sectionId=z.sectionId:"object"==typeof z.sectionId&&(G.sectionId=new ot.LongBits(z.sectionId.low>>>0,z.sectionId.high>>>0).toNumber())),G},t.toObject=function(z,G){G||(G={});var V={};if(G.defaults)if(V.time=0,ot.Long){var H=new ot.Long(0,0,!1);V.sectionId=G.longs===String?H.toString():G.longs===Number?H.toNumber():H}else V.sectionId=G.longs===String?"0":0;return null!=z.time&&z.hasOwnProperty("time")&&(V.time=G.json&&!isFinite(z.time)?String(z.time):z.time),null!=z.sectionId&&z.hasOwnProperty("sectionId")&&("number"==typeof z.sectionId?V.sectionId=G.longs===String?String(z.sectionId):z.sectionId:V.sectionId=G.longs===String?ot.Long.prototype.toString.call(z.sectionId):G.longs===Number?new ot.LongBits(z.sectionId.low>>>0,z.sectionId.high>>>0).toNumber():z.sectionId),V},t.prototype.toJSON=function(){return this.constructor.toObject(this,K.util.toJSONOptions)},t}(),t.Section=function(){function t(z){if(z)for(var G=Object.keys(z),V=0;V<G.length;++V)null!=z[G[V]]&&(this[G[V]]=z[G[V]])}var z;return t.prototype.sectionId=ot.Long?ot.Long.fromBits(0,0,!1):0,t.prototype.sectionGroup=null,Object.defineProperty(t.prototype,"sectionType",{get:ot.oneOfGetter(z=["sectionId","sectionGroup"]),set:ot.oneOfSetter(z)}),t.create=function(z){return new t(z)},t.encode=function(z,G){return G||(G=it.create()),null!=z.sectionId&&z.hasOwnProperty("sectionId")&&G.uint32(8).int64(z.sectionId),null!=z.sectionGroup&&z.hasOwnProperty("sectionGroup")&&rt.tensorflow.magenta.NoteSequence.SectionGroup.encode(z.sectionGroup,G.uint32(18).fork()).ldelim(),G},t.encodeDelimited=function(z,G){return this.encode(z,G).ldelim()},t.decode=function(z,G){z instanceof Z||(z=Z.create(z));for(var V=void 0===G?z.len:z.pos+G,H=new rt.tensorflow.magenta.NoteSequence.Section;z.pos<V;){var W=z.uint32();switch(W>>>3){case 1:H.sectionId=ot.Long?z.int64().toNumber():z.int64();break;case 2:H.sectionGroup=rt.tensorflow.magenta.NoteSequence.SectionGroup.decode(z,z.uint32());break;default:z.skipType(7&W)}}return H},t.decodeDelimited=function(z){return z instanceof Z||(z=new Z(z)),this.decode(z,z.uint32())},t.verify=function(z){if("object"!=typeof z||null===z)return"object expected";var G={};if(null!=z.sectionId&&z.hasOwnProperty("sectionId")&&(G.sectionType=1,!(ot.isInteger(z.sectionId)||z.sectionId&&ot.isInteger(z.sectionId.low)&&ot.isInteger(z.sectionId.high))))return"sectionId: integer|Long expected";if(null!=z.sectionGroup&&z.hasOwnProperty("sectionGroup")){if(1===G.sectionType)return"sectionType: multiple values";G.sectionType=1;var V=rt.tensorflow.magenta.NoteSequence.SectionGroup.verify(z.sectionGroup);if(V)return"sectionGroup."+V}return null},t.fromObject=function(z){if(z instanceof rt.tensorflow.magenta.NoteSequence.Section)return z;var G=new rt.tensorflow.magenta.NoteSequence.Section;if(null!=z.sectionId&&(ot.Long?(G.sectionId=ot.Long.fromValue(z.sectionId)).unsigned=!1:"string"==typeof z.sectionId?G.sectionId=parseInt(z.sectionId,10):"number"==typeof z.sectionId?G.sectionId=z.sectionId:"object"==typeof z.sectionId&&(G.sectionId=new ot.LongBits(z.sectionId.low>>>0,z.sectionId.high>>>0).toNumber())),null!=z.sectionGroup){if("object"!=typeof z.sectionGroup)throw TypeError(".tensorflow.magenta.NoteSequence.Section.sectionGroup: object expected");G.sectionGroup=rt.tensorflow.magenta.NoteSequence.SectionGroup.fromObject(z.sectionGroup)}return G},t.toObject=function(z,G){G||(G={});var V={};return null!=z.sectionId&&z.hasOwnProperty("sectionId")&&("number"==typeof z.sectionId?V.sectionId=G.longs===String?String(z.sectionId):z.sectionId:V.sectionId=G.longs===String?ot.Long.prototype.toString.call(z.sectionId):G.longs===Number?new ot.LongBits(z.sectionId.low>>>0,z.sectionId.high>>>0).toNumber():z.sectionId,G.oneofs&&(V.sectionType="sectionId")),null!=z.sectionGroup&&z.hasOwnProperty("sectionGroup")&&(V.sectionGroup=rt.tensorflow.magenta.NoteSequence.SectionGroup.toObject(z.sectionGroup,G),G.oneofs&&(V.sectionType="sectionGroup")),V},t.prototype.toJSON=function(){return this.constructor.toObject(this,K.util.toJSONOptions)},t}(),t.SectionGroup=function(){function t(z){if(this.sections=[],z)for(var G=Object.keys(z),V=0;V<G.length;++V)null!=z[G[V]]&&(this[G[V]]=z[G[V]])}return t.prototype.sections=ot.emptyArray,t.prototype.numTimes=0,t.create=function(z){return new t(z)},t.encode=function(z,G){if(G||(G=it.create()),null!=z.sections&&z.sections.length)for(var V=0;V<z.sections.length;++V)rt.tensorflow.magenta.NoteSequence.Section.encode(z.sections[V],G.uint32(10).fork()).ldelim();return null!=z.numTimes&&z.hasOwnProperty("numTimes")&&G.uint32(16).int32(z.numTimes),G},t.encodeDelimited=function(z,G){return this.encode(z,G).ldelim()},t.decode=function(z,G){z instanceof Z||(z=Z.create(z));for(var V=void 0===G?z.len:z.pos+G,H=new rt.tensorflow.magenta.NoteSequence.SectionGroup;z.pos<V;){var W=z.uint32();switch(W>>>3){case 1:H.sections&&H.sections.length||(H.sections=[]),H.sections.push(rt.tensorflow.magenta.NoteSequence.Section.decode(z,z.uint32()));break;case 2:H.numTimes=z.int32();break;default:z.skipType(7&W)}}return H},t.decodeDelimited=function(z){return z instanceof Z||(z=new Z(z)),this.decode(z,z.uint32())},t.verify=function(z){if("object"!=typeof z||null===z)return"object expected";if(null!=z.sections&&z.hasOwnProperty("sections")){if(!Array.isArray(z.sections))return"sections: array expected";for(var G=0;G<z.sections.length;++G){var V=rt.tensorflow.magenta.NoteSequence.Section.verify(z.sections[G]);if(V)return"sections."+V}}return null!=z.numTimes&&z.hasOwnProperty("numTimes")&&!ot.isInteger(z.numTimes)?"numTimes: integer expected":null},t.fromObject=function(z){if(z instanceof rt.tensorflow.magenta.NoteSequence.SectionGroup)return z;var G=new rt.tensorflow.magenta.NoteSequence.SectionGroup;if(z.sections){if(!Array.isArray(z.sections))throw TypeError(".tensorflow.magenta.NoteSequence.SectionGroup.sections: array expected");G.sections=[];for(var V=0;V<z.sections.length;++V){if("object"!=typeof z.sections[V])throw TypeError(".tensorflow.magenta.NoteSequence.SectionGroup.sections: object expected");G.sections[V]=rt.tensorflow.magenta.NoteSequence.Section.fromObject(z.sections[V])}}return null!=z.numTimes&&(G.numTimes=0|z.numTimes),G},t.toObject=function(z,G){G||(G={});var V={};if((G.arrays||G.defaults)&&(V.sections=[]),G.defaults&&(V.numTimes=0),z.sections&&z.sections.length){V.sections=[];for(var H=0;H<z.sections.length;++H)V.sections[H]=rt.tensorflow.magenta.NoteSequence.Section.toObject(z.sections[H],G)}return null!=z.numTimes&&z.hasOwnProperty("numTimes")&&(V.numTimes=z.numTimes),V},t.prototype.toJSON=function(){return this.constructor.toObject(this,K.util.toJSONOptions)},t}(),t}(),H.SequenceMetadata=function(){function t(z){if(this.genre=[],this.composers=[],z)for(var G=Object.keys(z),V=0;V<G.length;++V)null!=z[G[V]]&&(this[G[V]]=z[G[V]])}return t.prototype.title="",t.prototype.artist="",t.prototype.genre=ot.emptyArray,t.prototype.composers=ot.emptyArray,t.create=function(z){return new t(z)},t.encode=function(z,G){if(G||(G=it.create()),null!=z.title&&z.hasOwnProperty("title")&&G.uint32(10).string(z.title),null!=z.artist&&z.hasOwnProperty("artist")&&G.uint32(18).string(z.artist),null!=z.genre&&z.genre.length)for(var V=0;V<z.genre.length;++V)G.uint32(26).string(z.genre[V]);if(null!=z.composers&&z.composers.length)for(V=0;V<z.composers.length;++V)G.uint32(34).string(z.composers[V]);return G},t.encodeDelimited=function(z,G){return this.encode(z,G).ldelim()},t.decode=function(z,G){z instanceof Z||(z=Z.create(z));for(var V=void 0===G?z.len:z.pos+G,H=new rt.tensorflow.magenta.SequenceMetadata;z.pos<V;){var W=z.uint32();switch(W>>>3){case 1:H.title=z.string();break;case 2:H.artist=z.string();break;case 3:H.genre&&H.genre.length||(H.genre=[]),H.genre.push(z.string());break;case 4:H.composers&&H.composers.length||(H.composers=[]),H.composers.push(z.string());break;default:z.skipType(7&W)}}return H},t.decodeDelimited=function(z){return z instanceof Z||(z=new Z(z)),this.decode(z,z.uint32())},t.verify=function(z){if("object"!=typeof z||null===z)return"object expected";if(null!=z.title&&z.hasOwnProperty("title")&&!ot.isString(z.title))return"title: string expected";if(null!=z.artist&&z.hasOwnProperty("artist")&&!ot.isString(z.artist))return"artist: string expected";if(null!=z.genre&&z.hasOwnProperty("genre")){if(!Array.isArray(z.genre))return"genre: array expected";for(var G=0;G<z.genre.length;++G)if(!ot.isString(z.genre[G]))return"genre: string[] expected"}if(null!=z.composers&&z.hasOwnProperty("composers")){if(!Array.isArray(z.composers))return"composers: array expected";for(G=0;G<z.composers.length;++G)if(!ot.isString(z.composers[G]))return"composers: string[] expected"}return null},t.fromObject=function(z){if(z instanceof rt.tensorflow.magenta.SequenceMetadata)return z;var G=new rt.tensorflow.magenta.SequenceMetadata;if(null!=z.title&&(G.title=String(z.title)),null!=z.artist&&(G.artist=String(z.artist)),z.genre){if(!Array.isArray(z.genre))throw TypeError(".tensorflow.magenta.SequenceMetadata.genre: array expected");G.genre=[];for(var V=0;V<z.genre.length;++V)G.genre[V]=String(z.genre[V])}if(z.composers){if(!Array.isArray(z.composers))throw TypeError(".tensorflow.magenta.SequenceMetadata.composers: array expected");for(G.composers=[],V=0;V<z.composers.length;++V)G.composers[V]=String(z.composers[V])}return G},t.toObject=function(z,G){G||(G={});var V={};if((G.arrays||G.defaults)&&(V.genre=[],V.composers=[]),G.defaults&&(V.title="",V.artist=""),null!=z.title&&z.hasOwnProperty("title")&&(V.title=z.title),null!=z.artist&&z.hasOwnProperty("artist")&&(V.artist=z.artist),z.genre&&z.genre.length){V.genre=[];for(var H=0;H<z.genre.length;++H)V.genre[H]=z.genre[H]}if(z.composers&&z.composers.length)for(V.composers=[],H=0;H<z.composers.length;++H)V.composers[H]=z.composers[H];return V},t.prototype.toJSON=function(){return this.constructor.toObject(this,K.util.toJSONOptions)},t}(),H.VelocityRange=function(){function t(z){if(z)for(var G=Object.keys(z),V=0;V<G.length;++V)null!=z[G[V]]&&(this[G[V]]=z[G[V]])}return t.prototype.min=0,t.prototype.max=0,t.create=function(z){return new t(z)},t.encode=function(z,G){return G||(G=it.create()),null!=z.min&&z.hasOwnProperty("min")&&G.uint32(8).int32(z.min),null!=z.max&&z.hasOwnProperty("max")&&G.uint32(16).int32(z.max),G},t.encodeDelimited=function(z,G){return this.encode(z,G).ldelim()},t.decode=function(z,G){z instanceof Z||(z=Z.create(z));for(var V=void 0===G?z.len:z.pos+G,H=new rt.tensorflow.magenta.VelocityRange;z.pos<V;){var W=z.uint32();switch(W>>>3){case 1:H.min=z.int32();break;case 2:H.max=z.int32();break;default:z.skipType(7&W)}}return H},t.decodeDelimited=function(z){return z instanceof Z||(z=new Z(z)),this.decode(z,z.uint32())},t.verify=function(z){return"object"!=typeof z||null===z?"object expected":null!=z.min&&z.hasOwnProperty("min")&&!ot.isInteger(z.min)?"min: integer expected":null!=z.max&&z.hasOwnProperty("max")&&!ot.isInteger(z.max)?"max: integer expected":null},t.fromObject=function(z){if(z instanceof rt.tensorflow.magenta.VelocityRange)return z;var G=new rt.tensorflow.magenta.VelocityRange;return null!=z.min&&(G.min=0|z.min),null!=z.max&&(G.max=0|z.max),G},t.toObject=function(z,G){G||(G={});var V={};return G.defaults&&(V.min=0,V.max=0),null!=z.min&&z.hasOwnProperty("min")&&(V.min=z.min),null!=z.max&&z.hasOwnProperty("max")&&(V.max=z.max),V},t.prototype.toJSON=function(){return this.constructor.toObject(this,K.util.toJSONOptions)},t}(),H),W),z.exports=rt},,function(z,G,V){V.r(G),V.d(G,"ChordQuality",(function(){return Kt})),V.d(G,"ChordSymbolException",(function(){return Nt})),V.d(G,"ChordEncodingException",(function(){return Tt})),V.d(G,"ChordSymbols",(function(){return Ot})),V.d(G,"ChordEncoder",(function(){return It})),V.d(G,"chordEncoderFromType",(function(){return Mt})),V.d(G,"MajorMinorChordEncoder",(function(){return At})),V.d(G,"TriadChordEncoder",(function(){return kt})),V.d(G,"PitchChordEncoder",(function(){return qt}));var H={};V.r(H),V.d(H,"names",(function(){return a})),V.d(H,"tokenize",(function(){return h})),V.d(H,"props",(function(){return lt})),V.d(H,"name",(function(){return d})),V.d(H,"pc",(function(){return g})),V.d(H,"midi",(function(){return S})),V.d(H,"midiToFreq",(function(){return y})),V.d(H,"freq",(function(){return b})),V.d(H,"freqToMidi",(function(){return v})),V.d(H,"chroma",(function(){return N})),V.d(H,"oct",(function(){return T})),V.d(H,"stepToLetter",(function(){return O})),V.d(H,"altToAcc",(function(){return M})),V.d(H,"from",(function(){return A})),V.d(H,"build",(function(){return pt})),V.d(H,"fromMidi",(function(){return q})),V.d(H,"simplify",(function(){return E})),V.d(H,"enharmonic",(function(){return _}));var W={};V.r(W),V.d(W,"names",(function(){return Gt})),V.d(W,"props",(function(){return Qt})),V.d(W,"intervals",(function(){return ft})),V.d(W,"notes",(function(){return mt})),V.d(W,"exists",(function(){return dt})),V.d(W,"supersets",(function(){return gt})),V.d(W,"subsets",(function(){return St})),V.d(W,"tokenize",(function(){return bt}));var K=V(0),Z="C C# Db D D# Eb E F F# Gb G G# Ab A A# Bb B".split(" "),a=function(z){return"string"!=typeof z?Z.slice():Z.filter((function(G){var V=G[1]||" ";return-1!==z.indexOf(V)}))},it=a(" #"),ot=a(" b"),rt=/^([a-gA-G]?)(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)$/;function h(z){"string"!=typeof z&&(z="");var G=rt.exec(z);return[G[1].toUpperCase(),G[2].replace(/x/g,"##"),G[3],G[4]]}var at=Object.freeze({pc:null,name:null,step:null,alt:null,oct:null,octStr:null,chroma:null,midi:null,freq:null}),ut=[0,2,4,5,7,9,11],lt=function(z,G){return void 0===G&&(G={}),function(z){return G[z]||(G[z]=function(z){var G=h(z);if(""===G[0]||""!==G[3])return at;var V=G[0],H=G[1],W=G[2],K={letter:V,acc:H,octStr:W,pc:V+H,name:V+H+W,step:(V.charCodeAt(0)+3)%7,alt:"b"===H[0]?-H.length:H.length,oct:W.length?+W:null,chroma:0,midi:null,freq:null};return K.chroma=(ut[K.step]+K.alt+120)%12,K.midi=null!==K.oct?ut[K.step]+K.alt+12*(K.oct+1):null,K.freq=y(K.midi),Object.freeze(K)}(z))}}(),d=function(z){return lt(z).name},g=function(z){return lt(z).pc},S=function(z){if("number"!=typeof z&&"string"!=typeof z)return null;var G,V=lt(z).midi,H=V||0===V?V:+z;return(G=H)>=0&&G<=127?H:null},y=function(z,G){return void 0===G&&(G=440),"number"==typeof z?Math.pow(2,(z-69)/12)*G:null},b=function(z){return lt(z).freq||y(z)},ct=Math.log(2),ht=Math.log(440),v=function(z){var G=12*(Math.log(z)-ht)/ct+69;return Math.round(100*G)/100},N=function(z){return lt(z).chroma},T=function(z){return lt(z).oct},O=function(z){return"CDEFGAB"[z]},I=function(z,G){return Array(G+1).join(z)},M=function(z){return function(z,G){return"number"!=typeof z?"":function(z){return z<0?I("b",-z):I("#",z)}(z)}(z)},A=function(z,G){void 0===z&&(z={}),void 0===G&&(G=null);var V=G?Object.assign({},lt(G),z):z,H=V.step,W=V.alt,K=V.oct;if("number"!=typeof H)return null;var Z=O(H);if(!Z)return null;var it=Z+M(W);return K||0===K?it+K:it},pt=A;function q(z,G){return void 0===G&&(G=!1),z=Math.round(z),(!0===G?it:ot)[z%12]+(Math.floor(z/12)-1)}var E=function(z,G){void 0===G&&(G=!0);var V=lt(z),H=V.alt,W=V.chroma,K=V.midi;if(null===W)return null;var Z=!1===G?H<0:H>0;return null===K?g(q(W,Z)):q(K,Z)},_=function(z){return E(z,!1)},yt=new RegExp("^([-+]?\\d+)(d{1,4}|m|M|P|A{1,4})|(AA|A|P|M|m|d|dd)([-+]?\\d+)$"),_t=[0,2,4,5,7,9,11],vt=("1P 2m 2M 3m 3M 4P 5P 6m 6M 7m 7M 8P".split(" "),Object.freeze({name:null,num:null,q:null,step:null,alt:null,dir:null,type:null,simple:null,semitones:null,chroma:null,oct:null})),j=function(z){var G=function(z){var G=yt.exec(""+z);return null===G?null:G[1]?[G[1],G[2]]:[G[4],G[3]]}(z);if(null===G)return vt;var V,H,W={num:0,q:"d",name:"",type:"M",step:0,dir:-1,simple:1,alt:0,oct:0,semitones:0,chroma:0,ic:0};return W.num=+G[0],W.q=G[1],W.step=function(z){return(Math.abs(z)-1)%7}(W.num),W.type="PMMPPMM"[W.step],"M"===W.type&&"P"===W.q?vt:(W.name=""+W.num+W.q,W.dir=W.num<0?-1:1,W.simple=8===W.num||-8===W.num?W.num:W.dir*(W.step+1),W.alt=(V=W.type,"M"===(H=W.q)&&"M"===V||"P"===H&&"P"===V?0:"m"===H&&"M"===V?-1:/^A+$/.test(H)?H.length:/^d+$/.test(H)?"P"===V?-H.length:-H.length-1:null),W.oct=Math.floor((Math.abs(W.num)-1)/7),W.semitones=W.dir*(_t[W.step]+W.alt+12*W.oct),W.chroma=(W.dir*(_t[W.step]+W.alt)%12+12)%12,Object.freeze(W))},wt={};function R(z){return"string"!=typeof z?vt:wt[z]||(wt[z]=j(z))}"P m M m M P d P m M m M".split(" ");var Pt=[0,2,4,-1,1,3,5],xt=Pt.map((function(z){return Math.floor(7*z/12)})),Et=[3,0,4,1,5,2,6],F=function(z,G,V){var H=Et[function(z){var G=(z+1)%7;return G<0?7+G:G}(z)],W=Math.floor((z+1)/7);return void 0===G?{step:H,alt:W,dir:V}:{step:H,alt:W,oct:G+4*W+xt[H],dir:V}},Q=function(z){return function(z,G){return void 0===G&&(G={}),function(V){return G[V]||(G[V]=z(V))}}((function(G){var V=z(G);return null===V.name?null:function(z){var G=z.step,V=z.alt,H=z.oct,W=z.dir;void 0===W&&(W=1);var K=Pt[G]+7*V;return null===H?[W*K]:[W*K,W*(H-xt[G]-4*V)]}(V)}))},Ct=Q(lt),Ft=Q(R);function $(z,G){if(1===arguments.length)return function(G){return $(z,G)};var V=Ct(z),H=Ft(G);if(null===V||null===H)return null;var W=1===V.length?[V[0]+H[0]]:[V[0]+H[0],V[1]+H[1]];return pt(F(W[0],W[1]))}var Rt=V(37),Lt=V(38),J=function(z){return N(z)||function(z){return R(z).chroma}(z)||0},Y=function(z){return parseInt(X(z),2)};function X(z){if(function tt(z){return zt.test(z)}(z))return z;if(!Array.isArray(z))return"";var G=[0,0,0,0,0,0,0,0,0,0,0,0];return z.map(J).forEach((function(z){G[z]=1})),G.join("")}var zt=/^[01]{12}$/;function et(z,G){return arguments.length>1?et(z)(G):(z=Y(z),function(G){return(G=Y(G))!==z&&(G&z)===G})}function nt(z,G){return arguments.length>1?nt(z)(G):(z=Y(z),function(G){return(G=Y(G))!==z&&(G|z)===G})}"1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M".split(" ");var Dt,jt,st=function(z){var G=Object.keys(z).sort(),V=[],H=[],i=function(z,G,W){V[z]=G,H[W]=H[W]||[],H[W].push(z)};G.forEach((function(G){var V=z[G][0].split(" "),H=z[G][1],W=X(V);i(G,V,W),H&&H.forEach((function(z){return i(z,V,W)}))}));var W=Object.keys(V).sort(),s=function(z){return V[z]};return s.names=function(z){return"string"==typeof z?(H[z]||[]).slice():(!0===z?W:G).slice()},s},Bt=st(Rt),Ut=st(Lt);Dt=Bt,jt=Ut,function(z){return Dt(z)||jt(z)}.names=function(z){return Dt.names(z).concat(jt.names(z))},Object.freeze({name:null,intervals:[],names:[],chroma:null,setnum:null});Bt.names;var Gt=Ut.names,Vt=Object.freeze({name:null,names:[],intervals:[],chroma:null,setnum:null}),Qt=function(z,G){return void 0===G&&(G={}),function(z){return G[z]||(G[z]=function(z){var G=Ut(z);if(!G)return Vt;var V={intervals:G,name:z};return V.chroma=X(G),V.setnum=parseInt(V.chroma,2),V.names=Ut.names(V.chroma),V}(z))}}(),ft=function(z){return Qt(bt(z)[1]).intervals};function mt(z,G){if(G)return Qt(G).intervals.map($(z));var V=bt(z),H=V[0],W=V[1];return Qt(W).intervals.map($(H))}var dt=function(z){return void 0!==Ut(bt(z)[1])},gt=function(z){if(!ft(z).length)return[];var G=nt(ft(z));return Ut.names().filter((function(z){return G(Ut(z))}))},St=function(z){var G=et(ft(z));return Ut.names().filter((function(z){return G(Ut(z))}))},Ht=/^(6|64|7|9|11|13)$/;function bt(z){var G=h(z);return""===G[0]?["",z]:"A"===G[0]&&"ug"===G[3]?["","aug"]:Ht.test(G[2])?[G[0]+G[1],G[2]+G[3]]:[G[0]+G[1]+G[2],G[3]]}var Wt=V(1);const $t=[["1P","3M","5P"],["1P","3m","5P"],["1P","3M","5A"],["1P","3m","5d"]];var Kt;!function(z){z[z.Major=0]="Major",z[z.Minor=1]="Minor",z[z.Augmented=2]="Augmented",z[z.Diminished=3]="Diminished",z[z.Other=4]="Other"}(Kt||(Kt={}));class Nt extends Error{constructor(z){super(z),Object.setPrototypeOf(this,new.target.prototype)}}class Tt extends Error{constructor(z){super(z),Object.setPrototypeOf(this,new.target.prototype)}}class Ot{static pitches(z){if(!W.tokenize(z)[0]||!W.exists(z))throw new Nt("Unrecognized chord symbol: "+z);return W.notes(z).map(H.chroma)}static root(z){const G=W.tokenize(z)[0];if(!G)throw new Nt("Chord symbol has unknown root: "+z);return H.chroma(G)}static quality(z){if(!W.exists(z))throw new Nt("Unrecognized chord symbol: "+z);const G=W.intervals(z),V=$t.map((z=>z.every((z=>G.includes(z))))),H=V.indexOf(!0),K=V.lastIndexOf(!0);return H>=0&&H===K?H:Kt.Other}}class It{encodeProgression(z,G){const V=z.map((z=>this.encode(z))),H=Array.from(Array(G).keys()).map((z=>Math.floor(z*V.length/G)));return K.stack(H.map((z=>V[z])))}}function Mt(z){switch(z){case"MajorMinorChordEncoder":return new At;case"TriadChordEncoder":return new kt;case"PitchChordEncoder":return new qt;default:throw new Error("Unknown chord encoder type: "+z)}}class At extends It{constructor(){super(...arguments),this.depth=1+2*Wt.NUM_PITCH_CLASSES}index(z){if(z===Wt.NO_CHORD)return 0;const G=Ot.root(z),V=1+Ot.quality(z)*Wt.NUM_PITCH_CLASSES+G;if(V>=this.depth)throw new Tt("Chord is neither major nor minor: "+z);return V}encode(z){return K.tidy((()=>K.oneHot(K.tensor1d([this.index(z)],"int32"),this.depth).as1D()))}}class kt extends It{constructor(){super(...arguments),this.depth=1+4*Wt.NUM_PITCH_CLASSES}index(z){if(z===Wt.NO_CHORD)return 0;const G=Ot.root(z),V=1+Ot.quality(z)*Wt.NUM_PITCH_CLASSES+G;if(V>=this.depth)throw new Tt("Chord is not a standard triad: "+z);return V}encode(z){return K.tidy((()=>K.oneHot(K.tensor1d([this.index(z)],"int32"),this.depth).as1D()))}}class qt extends It{constructor(){super(...arguments),this.depth=1+3*Wt.NUM_PITCH_CLASSES}encode(z){return K.tidy((()=>{if(z===Wt.NO_CHORD)return K.oneHot(K.tensor1d([0],"int32"),this.depth).as1D();const G=Ot.root(z),V=K.oneHot(K.tensor1d([G],"int32"),Wt.NUM_PITCH_CLASSES).as1D(),H=K.buffer([Wt.NUM_PITCH_CLASSES]);Ot.pitches(z).forEach((z=>H.set(1,z)));const W=H.toTensor().as1D(),Z=V;return K.concat1d([K.tensor1d([0]),V,W,Z])}))}}},,function(z,G,V){z.exports=V(21)},function(z,G,V){var H=G;function i(){H.util._configure(),H.Writer._configure(H.BufferWriter),H.Reader._configure(H.BufferReader)}H.build="minimal",H.Writer=V(14),H.BufferWriter=V(30),H.Reader=V(15),H.BufferReader=V(31),H.util=V(8),H.rpc=V(32),H.roots=V(34),H.configure=i,i()},function(z,G,V){z.exports=function(z,G){for(var V=new Array(arguments.length-1),H=0,W=2,K=!0;W<arguments.length;)V[H++]=arguments[W++];return new Promise((function(W,Z){V[H]=function(z){if(K)if(K=!1,z)Z(z);else{for(var G=new Array(arguments.length-1),V=0;V<G.length;)G[V++]=arguments[V];W.apply(null,G)}};try{z.apply(G||null,V)}catch(z){K&&(K=!1,Z(z))}}))}},function(z,G,V){var H=G;H.length=function(z){var G=z.length;if(!G)return 0;for(var V=0;--G%4>1&&"="===z.charAt(G);)++V;return Math.ceil(3*z.length)/4-V};for(var W=new Array(64),K=new Array(123),Z=0;Z<64;)K[W[Z]=Z<26?Z+65:Z<52?Z+71:Z<62?Z-4:Z-59|43]=Z++;H.encode=function(z,G,V){for(var H,K=null,Z=[],it=0,ot=0;G<V;){var rt=z[G++];switch(ot){case 0:Z[it++]=W[rt>>2],H=(3&rt)<<4,ot=1;break;case 1:Z[it++]=W[H|rt>>4],H=(15&rt)<<2,ot=2;break;case 2:Z[it++]=W[H|rt>>6],Z[it++]=W[63&rt],ot=0}it>8191&&((K||(K=[])).push(String.fromCharCode.apply(String,Z)),it=0)}return ot&&(Z[it++]=W[H],Z[it++]=61,1===ot&&(Z[it++]=61)),K?(it&&K.push(String.fromCharCode.apply(String,Z.slice(0,it))),K.join("")):String.fromCharCode.apply(String,Z.slice(0,it))},H.decode=function(z,G,V){for(var H,W=V,Z=0,it=0;it<z.length;){var ot=z.charCodeAt(it++);if(61===ot&&Z>1)break;if(void 0===(ot=K[ot]))throw Error("invalid encoding");switch(Z){case 0:H=ot,Z=1;break;case 1:G[V++]=H<<2|(48&ot)>>4,H=ot,Z=2;break;case 2:G[V++]=(15&H)<<4|(60&ot)>>2,H=ot,Z=3;break;case 3:G[V++]=(3&H)<<6|ot,Z=0}}if(1===Z)throw Error("invalid encoding");return V-W},H.test=function(z){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(z)}},function(z,G,V){function r(){this._listeners={}}z.exports=r,r.prototype.on=function(z,G,V){return(this._listeners[z]||(this._listeners[z]=[])).push({fn:G,ctx:V||this}),this},r.prototype.off=function(z,G){if(void 0===z)this._listeners={};else if(void 0===G)this._listeners[z]=[];else for(var V=this._listeners[z],H=0;H<V.length;)V[H].fn===G?V.splice(H,1):++H;return this},r.prototype.emit=function(z){var G=this._listeners[z];if(G){for(var V=[],H=1;H<arguments.length;)V.push(arguments[H++]);for(H=0;H<G.length;)G[H].fn.apply(G[H++].ctx,V)}return this}},function(z,G,V){function r(z){return"undefined"!=typeof Float32Array?function(){var G=new Float32Array([-0]),V=new Uint8Array(G.buffer),H=128===V[3];function i(z,H,W){G[0]=z,H[W]=V[0],H[W+1]=V[1],H[W+2]=V[2],H[W+3]=V[3]}function o(z,H,W){G[0]=z,H[W]=V[3],H[W+1]=V[2],H[W+2]=V[1],H[W+3]=V[0]}function s(z,H){return V[0]=z[H],V[1]=z[H+1],V[2]=z[H+2],V[3]=z[H+3],G[0]}function a(z,H){return V[3]=z[H],V[2]=z[H+1],V[1]=z[H+2],V[0]=z[H+3],G[0]}z.writeFloatLE=H?i:o,z.writeFloatBE=H?o:i,z.readFloatLE=H?s:a,z.readFloatBE=H?a:s}():function(){function e(z,G,V,H){var W=G<0?1:0;if(W&&(G=-G),0===G)z(1/G>0?0:2147483648,V,H);else if(isNaN(G))z(2143289344,V,H);else if(G>34028234663852886e22)z((W<<31|2139095040)>>>0,V,H);else if(G<11754943508222875e-54)z((W<<31|Math.round(G/1401298464324817e-60))>>>0,V,H);else{var K=Math.floor(Math.log(G)/Math.LN2);z((W<<31|K+127<<23|8388607&Math.round(G*Math.pow(2,-K)*8388608))>>>0,V,H)}}function n(z,G,V){var H=z(G,V),W=2*(H>>31)+1,K=H>>>23&255,Z=8388607&H;return 255===K?Z?NaN:W*(1/0):0===K?1401298464324817e-60*W*Z:W*Math.pow(2,K-150)*(Z+8388608)}z.writeFloatLE=e.bind(null,i),z.writeFloatBE=e.bind(null,o),z.readFloatLE=n.bind(null,s),z.readFloatBE=n.bind(null,a)}(),"undefined"!=typeof Float64Array?function(){var G=new Float64Array([-0]),V=new Uint8Array(G.buffer),H=128===V[7];function i(z,H,W){G[0]=z,H[W]=V[0],H[W+1]=V[1],H[W+2]=V[2],H[W+3]=V[3],H[W+4]=V[4],H[W+5]=V[5],H[W+6]=V[6],H[W+7]=V[7]}function o(z,H,W){G[0]=z,H[W]=V[7],H[W+1]=V[6],H[W+2]=V[5],H[W+3]=V[4],H[W+4]=V[3],H[W+5]=V[2],H[W+6]=V[1],H[W+7]=V[0]}function s(z,H){return V[0]=z[H],V[1]=z[H+1],V[2]=z[H+2],V[3]=z[H+3],V[4]=z[H+4],V[5]=z[H+5],V[6]=z[H+6],V[7]=z[H+7],G[0]}function a(z,H){return V[7]=z[H],V[6]=z[H+1],V[5]=z[H+2],V[4]=z[H+3],V[3]=z[H+4],V[2]=z[H+5],V[1]=z[H+6],V[0]=z[H+7],G[0]}z.writeDoubleLE=H?i:o,z.writeDoubleBE=H?o:i,z.readDoubleLE=H?s:a,z.readDoubleBE=H?a:s}():function(){function e(z,G,V,H,W,K){var Z=H<0?1:0;if(Z&&(H=-H),0===H)z(0,W,K+G),z(1/H>0?0:2147483648,W,K+V);else if(isNaN(H))z(0,W,K+G),z(2146959360,W,K+V);else if(H>17976931348623157e292)z(0,W,K+G),z((Z<<31|2146435072)>>>0,W,K+V);else{var it;if(H<22250738585072014e-324)z((it=H/5e-324)>>>0,W,K+G),z((Z<<31|it/4294967296)>>>0,W,K+V);else{var ot=Math.floor(Math.log(H)/Math.LN2);1024===ot&&(ot=1023),z(4503599627370496*(it=H*Math.pow(2,-ot))>>>0,W,K+G),z((Z<<31|ot+1023<<20|1048576*it&1048575)>>>0,W,K+V)}}}function n(z,G,V,H,W){var K=z(H,W+G),Z=z(H,W+V),it=2*(Z>>31)+1,ot=Z>>>20&2047,rt=4294967296*(1048575&Z)+K;return 2047===ot?rt?NaN:it*(1/0):0===ot?5e-324*it*rt:it*Math.pow(2,ot-1075)*(rt+4503599627370496)}z.writeDoubleLE=e.bind(null,i,0,4),z.writeDoubleBE=e.bind(null,o,4,0),z.readDoubleLE=n.bind(null,s,0,4),z.readDoubleBE=n.bind(null,a,4,0)}(),z}function i(z,G,V){G[V]=255&z,G[V+1]=z>>>8&255,G[V+2]=z>>>16&255,G[V+3]=z>>>24}function o(z,G,V){G[V]=z>>>24,G[V+1]=z>>>16&255,G[V+2]=z>>>8&255,G[V+3]=255&z}function s(z,G){return(z[G]|z[G+1]<<8|z[G+2]<<16|z[G+3]<<24)>>>0}function a(z,G){return(z[G]<<24|z[G+1]<<16|z[G+2]<<8|z[G+3])>>>0}z.exports=r(r)},function(module,exports,__webpack_require__){function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(z){}return null}module.exports=inquire},function(z,G,V){var H=G;H.length=function(z){for(var G=0,V=0,H=0;H<z.length;++H)(V=z.charCodeAt(H))<128?G+=1:V<2048?G+=2:55296==(64512&V)&&56320==(64512&z.charCodeAt(H+1))?(++H,G+=4):G+=3;return G},H.read=function(z,G,V){if(V-G<1)return"";for(var H,W=null,K=[],Z=0;G<V;)(H=z[G++])<128?K[Z++]=H:H>191&&H<224?K[Z++]=(31&H)<<6|63&z[G++]:H>239&&H<365?(H=((7&H)<<18|(63&z[G++])<<12|(63&z[G++])<<6|63&z[G++])-65536,K[Z++]=55296+(H>>10),K[Z++]=56320+(1023&H)):K[Z++]=(15&H)<<12|(63&z[G++])<<6|63&z[G++],Z>8191&&((W||(W=[])).push(String.fromCharCode.apply(String,K)),Z=0);return W?(Z&&W.push(String.fromCharCode.apply(String,K.slice(0,Z))),W.join("")):String.fromCharCode.apply(String,K.slice(0,Z))},H.write=function(z,G,V){for(var H,W,K=V,Z=0;Z<z.length;++Z)(H=z.charCodeAt(Z))<128?G[V++]=H:H<2048?(G[V++]=H>>6|192,G[V++]=63&H|128):55296==(64512&H)&&56320==(64512&(W=z.charCodeAt(Z+1)))?(H=65536+((1023&H)<<10)+(1023&W),++Z,G[V++]=H>>18|240,G[V++]=H>>12&63|128,G[V++]=H>>6&63|128,G[V++]=63&H|128):(G[V++]=H>>12|224,G[V++]=H>>6&63|128,G[V++]=63&H|128);return V-K}},function(z,G,V){z.exports=function(z,G,V){var H=V||8192,W=H>>>1,K=null,Z=H;return function(V){if(V<1||V>W)return z(V);Z+V>H&&(K=z(H),Z=0);var it=G.call(K,Z,Z+=V);return 7&Z&&(Z=1+(7|Z)),it}}},function(z,G,V){z.exports=i;var H=V(8);function i(z,G){this.lo=z>>>0,this.hi=G>>>0}var W=i.zero=new i(0,0);W.toNumber=function(){return 0},W.zzEncode=W.zzDecode=function(){return this},W.length=function(){return 1};var K=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(z){if(0===z)return W;var G=z<0;G&&(z=-z);var V=z>>>0,H=(z-V)/4294967296>>>0;return G&&(H=~H>>>0,V=~V>>>0,++V>4294967295&&(V=0,++H>4294967295&&(H=0))),new i(V,H)},i.from=function(z){if("number"==typeof z)return i.fromNumber(z);if(H.isString(z)){if(!H.Long)return i.fromNumber(parseInt(z,10));z=H.Long.fromString(z)}return z.low||z.high?new i(z.low>>>0,z.high>>>0):W},i.prototype.toNumber=function(z){if(!z&&this.hi>>>31){var G=1+~this.lo>>>0,V=~this.hi>>>0;return G||(V=V+1>>>0),-(G+4294967296*V)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(z){return H.Long?new H.Long(0|this.lo,0|this.hi,Boolean(z)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(z)}};var Z=String.prototype.charCodeAt;i.fromHash=function(z){return z===K?W:new i((Z.call(z,0)|Z.call(z,1)<<8|Z.call(z,2)<<16|Z.call(z,3)<<24)>>>0,(Z.call(z,4)|Z.call(z,5)<<8|Z.call(z,6)<<16|Z.call(z,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var z=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^z)>>>0,this.lo=(this.lo<<1^z)>>>0,this},i.prototype.zzDecode=function(){var z=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^z)>>>0,this.hi=(this.hi>>>1^z)>>>0,this},i.prototype.length=function(){var z=this.lo,G=(this.lo>>>28|this.hi<<4)>>>0,V=this.hi>>>24;return 0===V?0===G?z<16384?z<128?1:2:z<2097152?3:4:G<16384?G<128?5:6:G<2097152?7:8:V<128?9:10}},function(z,G,V){z.exports=o;var H=V(14);(o.prototype=Object.create(H.prototype)).constructor=o;var W=V(8);function o(){H.call(this)}function s(z,G,V){z.length<40?W.utf8.write(z,G,V):G.utf8Write?G.utf8Write(z,V):G.write(z,V)}o._configure=function(){o.alloc=W._Buffer_allocUnsafe,o.writeBytesBuffer=W.Buffer&&W.Buffer.prototype instanceof Uint8Array&&"set"===W.Buffer.prototype.set.name?function(z,G,V){G.set(z,V)}:function(z,G,V){if(z.copy)z.copy(G,V,0,z.length);else for(var H=0;H<z.length;)G[V++]=z[H++]}},o.prototype.bytes=function(z){W.isString(z)&&(z=W._Buffer_from(z,"base64"));var G=z.length>>>0;return this.uint32(G),G&&this._push(o.writeBytesBuffer,G,z),this},o.prototype.string=function(z){var G=W.Buffer.byteLength(z);return this.uint32(G),G&&this._push(s,G,z),this},o._configure()},function(z,G,V){z.exports=o;var H=V(15);(o.prototype=Object.create(H.prototype)).constructor=o;var W=V(8);function o(z){H.call(this,z)}o._configure=function(){W.Buffer&&(o.prototype._slice=W.Buffer.prototype.slice)},o.prototype.string=function(){var z=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+z,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+z,this.len))},o._configure()},function(z,G,V){G.Service=V(33)},function(z,G,V){z.exports=i;var H=V(8);function i(z,G,V){if("function"!=typeof z)throw TypeError("rpcImpl must be a function");H.EventEmitter.call(this),this.rpcImpl=z,this.requestDelimited=Boolean(G),this.responseDelimited=Boolean(V)}(i.prototype=Object.create(H.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function t(z,G,V,W,K){if(!W)throw TypeError("request must be specified");var Z=this;if(!K)return H.asPromise(t,Z,z,G,V,W);if(Z.rpcImpl)try{return Z.rpcImpl(z,G[Z.requestDelimited?"encodeDelimited":"encode"](W).finish(),(function(G,H){if(G)return Z.emit("error",G,z),K(G);if(null!==H){if(!(H instanceof V))try{H=V[Z.responseDelimited?"decodeDelimited":"decode"](H)}catch(G){return Z.emit("error",G,z),K(G)}return Z.emit("data",H,z),K(null,H)}Z.end(!0)}))}catch(t){return Z.emit("error",t,z),void setTimeout((function(){K(t)}),0)}else setTimeout((function(){K(Error("already ended"))}),0)},i.prototype.end=function(z){return this.rpcImpl&&(z||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},function(z,G,V){z.exports={}},,function(z,G,V){V.r(G),V.d(G,"auxiliaryInputFromSpec",(function(){return i})),V.d(G,"AuxiliaryInput",(function(){return o})),V.d(G,"BinaryCounter",(function(){return s}));var H=V(0);function i(z){if("BinaryCounter"===z.type)return new s(z.args);throw new Error("Unknown auxiliary input: "+z)}class o{constructor(z){this.depth=z}}class s extends o{constructor(z){super(z.numBits)}getTensors(z){const G=H.buffer([z,this.depth]);for(let V=0;V<z;++V)for(let z=0;z<this.depth;++z)G.set(Math.floor((V+1)/Math.pow(2,z))%2?1:-1,V,z);return G.toTensor().as2D(z,this.depth)}}},function(z){z.exports=JSON.parse('{"chromatic":["1P 2m 2M 3m 3M 4P 4A 5P 6m 6M 7m 7M"],"lydian":["1P 2M 3M 4A 5P 6M 7M"],"major":["1P 2M 3M 4P 5P 6M 7M",["ionian"]],"mixolydian":["1P 2M 3M 4P 5P 6M 7m",["dominant"]],"dorian":["1P 2M 3m 4P 5P 6M 7m"],"aeolian":["1P 2M 3m 4P 5P 6m 7m",["minor"]],"phrygian":["1P 2m 3m 4P 5P 6m 7m"],"locrian":["1P 2m 3m 4P 5d 6m 7m"],"melodic minor":["1P 2M 3m 4P 5P 6M 7M"],"melodic minor second mode":["1P 2m 3m 4P 5P 6M 7m"],"lydian augmented":["1P 2M 3M 4A 5A 6M 7M"],"lydian dominant":["1P 2M 3M 4A 5P 6M 7m",["lydian b7"]],"melodic minor fifth mode":["1P 2M 3M 4P 5P 6m 7m",["hindu","mixolydian b6M"]],"locrian #2":["1P 2M 3m 4P 5d 6m 7m",["half-diminished"]],"altered":["1P 2m 3m 3M 5d 6m 7m",["super locrian","diminished whole tone","pomeroy"]],"harmonic minor":["1P 2M 3m 4P 5P 6m 7M"],"phrygian dominant":["1P 2m 3M 4P 5P 6m 7m",["spanish","phrygian major"]],"half-whole diminished":["1P 2m 3m 3M 4A 5P 6M 7m",["dominant diminished"]],"diminished":["1P 2M 3m 4P 5d 6m 6M 7M",["whole-half diminished"]],"major pentatonic":["1P 2M 3M 5P 6M",["pentatonic"]],"lydian pentatonic":["1P 3M 4A 5P 7M",["chinese"]],"mixolydian pentatonic":["1P 3M 4P 5P 7m",["indian"]],"locrian pentatonic":["1P 3m 4P 5d 7m",["minor seven flat five pentatonic"]],"minor pentatonic":["1P 3m 4P 5P 7m"],"minor six pentatonic":["1P 3m 4P 5P 6M"],"minor hexatonic":["1P 2M 3m 4P 5P 7M"],"flat three pentatonic":["1P 2M 3m 5P 6M",["kumoi"]],"flat six pentatonic":["1P 2M 3M 5P 6m"],"major flat two pentatonic":["1P 2m 3M 5P 6M"],"whole tone pentatonic":["1P 3M 5d 6m 7m"],"ionian pentatonic":["1P 3M 4P 5P 7M"],"lydian #5P pentatonic":["1P 3M 4A 5A 7M"],"lydian dominant pentatonic":["1P 3M 4A 5P 7m"],"minor #7M pentatonic":["1P 3m 4P 5P 7M"],"super locrian pentatonic":["1P 3m 4d 5d 7m"],"in-sen":["1P 2m 4P 5P 7m"],"iwato":["1P 2m 4P 5d 7m"],"hirajoshi":["1P 2M 3m 5P 6m"],"kumoijoshi":["1P 2m 4P 5P 6m"],"pelog":["1P 2m 3m 5P 6m"],"vietnamese 1":["1P 3m 4P 5P 6m"],"vietnamese 2":["1P 3m 4P 5P 7m"],"prometheus":["1P 2M 3M 4A 6M 7m"],"prometheus neopolitan":["1P 2m 3M 4A 6M 7m"],"ritusen":["1P 2M 4P 5P 6M"],"scriabin":["1P 2m 3M 5P 6M"],"piongio":["1P 2M 4P 5P 6M 7m"],"major blues":["1P 2M 3m 3M 5P 6M"],"minor blues":["1P 3m 4P 5d 5P 7m",["blues"]],"composite blues":["1P 2M 3m 3M 4P 5d 5P 6M 7m"],"augmented":["1P 2A 3M 5P 5A 7M"],"augmented heptatonic":["1P 2A 3M 4P 5P 5A 7M"],"dorian #4":["1P 2M 3m 4A 5P 6M 7m"],"lydian diminished":["1P 2M 3m 4A 5P 6M 7M"],"whole tone":["1P 2M 3M 4A 5A 7m"],"leading whole tone":["1P 2M 3M 4A 5A 7m 7M"],"lydian minor":["1P 2M 3M 4A 5P 6m 7m"],"locrian major":["1P 2M 3M 4P 5d 6m 7m",["arabian"]],"neopolitan":["1P 2m 3m 4P 5P 6m 7M"],"neopolitan minor":["1P 2m 3m 4P 5P 6m 7M"],"neopolitan major":["1P 2m 3m 4P 5P 6M 7M",["dorian b2"]],"neopolitan major pentatonic":["1P 3M 4P 5d 7m"],"romanian minor":["1P 2M 3m 5d 5P 6M 7m"],"double harmonic lydian":["1P 2m 3M 4A 5P 6m 7M"],"harmonic major":["1P 2M 3M 4P 5P 6m 7M"],"double harmonic major":["1P 2m 3M 4P 5P 6m 7M",["gypsy"]],"egyptian":["1P 2M 4P 5P 7m"],"hungarian minor":["1P 2M 3m 4A 5P 6m 7M"],"hungarian major":["1P 2A 3M 4A 5P 6M 7m"],"oriental":["1P 2m 3M 4P 5d 6M 7m"],"spanish heptatonic":["1P 2m 3m 3M 4P 5P 6m 7m"],"flamenco":["1P 2m 3m 3M 4A 5P 7m"],"balinese":["1P 2m 3m 4P 5P 6m 7M"],"todi raga":["1P 2m 3m 4A 5P 6m 7M"],"malkos raga":["1P 3m 4P 6m 7m"],"kafi raga":["1P 3m 3M 4P 5P 6M 7m 7M"],"purvi raga":["1P 2m 3M 4P 4A 5P 6m 7M"],"persian":["1P 2m 3M 4P 5d 6m 7M"],"bebop":["1P 2M 3M 4P 5P 6M 7m 7M"],"bebop dominant":["1P 2M 3M 4P 5P 6M 7m 7M"],"bebop minor":["1P 2M 3m 3M 4P 5P 6M 7m"],"bebop major":["1P 2M 3M 4P 5P 5A 6M 7M"],"bebop locrian":["1P 2m 3m 4P 5d 5P 6m 7m"],"minor bebop":["1P 2M 3m 4P 5P 6m 7m 7M"],"mystery #1":["1P 2m 3M 5d 6m 7m"],"enigmatic":["1P 2m 3M 5d 6m 7m 7M"],"minor six diminished":["1P 2M 3m 4P 5P 6m 6M 7M"],"ionian augmented":["1P 2M 3M 4P 5A 6M 7M"],"lydian #9":["1P 2m 3M 4A 5P 6M 7M"],"ichikosucho":["1P 2M 3M 4P 5d 5P 6M 7M"],"six tone symmetric":["1P 2m 3M 4P 5A 6M"]}')},function(z){z.exports=JSON.parse('{"4":["1P 4P 7m 10m",["quartal"]],"5":["1P 5P"],"7":["1P 3M 5P 7m",["Dominant","Dom"]],"9":["1P 3M 5P 7m 9M",["79"]],"11":["1P 5P 7m 9M 11P"],"13":["1P 3M 5P 7m 9M 13M",["13_"]],"64":["5P 8P 10M"],"M":["1P 3M 5P",["Major",""]],"M#5":["1P 3M 5A",["augmented","maj#5","Maj#5","+","aug"]],"M#5add9":["1P 3M 5A 9M",["+add9"]],"M13":["1P 3M 5P 7M 9M 13M",["maj13","Maj13"]],"M13#11":["1P 3M 5P 7M 9M 11A 13M",["maj13#11","Maj13#11","M13+4","M13#4"]],"M6":["1P 3M 5P 13M",["6"]],"M6#11":["1P 3M 5P 6M 11A",["M6b5","6#11","6b5"]],"M69":["1P 3M 5P 6M 9M",["69"]],"M69#11":["1P 3M 5P 6M 9M 11A"],"M7#11":["1P 3M 5P 7M 11A",["maj7#11","Maj7#11","M7+4","M7#4"]],"M7#5":["1P 3M 5A 7M",["maj7#5","Maj7#5","maj9#5","M7+"]],"M7#5sus4":["1P 4P 5A 7M"],"M7#9#11":["1P 3M 5P 7M 9A 11A"],"M7add13":["1P 3M 5P 6M 7M 9M"],"M7b5":["1P 3M 5d 7M"],"M7b6":["1P 3M 6m 7M"],"M7b9":["1P 3M 5P 7M 9m"],"M7sus4":["1P 4P 5P 7M"],"M9":["1P 3M 5P 7M 9M",["maj9","Maj9"]],"M9#11":["1P 3M 5P 7M 9M 11A",["maj9#11","Maj9#11","M9+4","M9#4"]],"M9#5":["1P 3M 5A 7M 9M",["Maj9#5"]],"M9#5sus4":["1P 4P 5A 7M 9M"],"M9b5":["1P 3M 5d 7M 9M"],"M9sus4":["1P 4P 5P 7M 9M"],"Madd9":["1P 3M 5P 9M",["2","add9","add2"]],"Maj7":["1P 3M 5P 7M",["maj7","M7"]],"Mb5":["1P 3M 5d"],"Mb6":["1P 3M 13m"],"Msus2":["1P 2M 5P",["add9no3","sus2"]],"Msus4":["1P 4P 5P",["sus","sus4"]],"Maddb9":["1P 3M 5P 9m"],"11b9":["1P 5P 7m 9m 11P"],"13#11":["1P 3M 5P 7m 9M 11A 13M",["13+4","13#4"]],"13#9":["1P 3M 5P 7m 9A 13M",["13#9_"]],"13#9#11":["1P 3M 5P 7m 9A 11A 13M"],"13b5":["1P 3M 5d 6M 7m 9M"],"13b9":["1P 3M 5P 7m 9m 13M"],"13b9#11":["1P 3M 5P 7m 9m 11A 13M"],"13no5":["1P 3M 7m 9M 13M"],"13sus4":["1P 4P 5P 7m 9M 13M",["13sus"]],"69#11":["1P 3M 5P 6M 9M 11A"],"7#11":["1P 3M 5P 7m 11A",["7+4","7#4","7#11_","7#4_"]],"7#11b13":["1P 3M 5P 7m 11A 13m",["7b5b13"]],"7#5":["1P 3M 5A 7m",["+7","7aug","aug7"]],"7#5#9":["1P 3M 5A 7m 9A",["7alt","7#5#9_","7#9b13_"]],"7#5b9":["1P 3M 5A 7m 9m"],"7#5b9#11":["1P 3M 5A 7m 9m 11A"],"7#5sus4":["1P 4P 5A 7m"],"7#9":["1P 3M 5P 7m 9A",["7#9_"]],"7#9#11":["1P 3M 5P 7m 9A 11A",["7b5#9"]],"7#9#11b13":["1P 3M 5P 7m 9A 11A 13m"],"7#9b13":["1P 3M 5P 7m 9A 13m"],"7add6":["1P 3M 5P 7m 13M",["67","7add13"]],"7b13":["1P 3M 7m 13m"],"7b5":["1P 3M 5d 7m"],"7b6":["1P 3M 5P 6m 7m"],"7b9":["1P 3M 5P 7m 9m"],"7b9#11":["1P 3M 5P 7m 9m 11A",["7b5b9"]],"7b9#9":["1P 3M 5P 7m 9m 9A"],"7b9b13":["1P 3M 5P 7m 9m 13m"],"7b9b13#11":["1P 3M 5P 7m 9m 11A 13m",["7b9#11b13","7b5b9b13"]],"7no5":["1P 3M 7m"],"7sus4":["1P 4P 5P 7m",["7sus"]],"7sus4b9":["1P 4P 5P 7m 9m",["susb9","7susb9","7b9sus","7b9sus4","phryg"]],"7sus4b9b13":["1P 4P 5P 7m 9m 13m",["7b9b13sus4"]],"9#11":["1P 3M 5P 7m 9M 11A",["9+4","9#4","9#11_","9#4_"]],"9#11b13":["1P 3M 5P 7m 9M 11A 13m",["9b5b13"]],"9#5":["1P 3M 5A 7m 9M",["9+"]],"9#5#11":["1P 3M 5A 7m 9M 11A"],"9b13":["1P 3M 7m 9M 13m"],"9b5":["1P 3M 5d 7m 9M"],"9no5":["1P 3M 7m 9M"],"9sus4":["1P 4P 5P 7m 9M",["9sus"]],"m":["1P 3m 5P"],"m#5":["1P 3m 5A",["m+","mb6"]],"m11":["1P 3m 5P 7m 9M 11P",["_11"]],"m11A 5":["1P 3m 6m 7m 9M 11P"],"m11b5":["1P 3m 7m 12d 2M 4P",["h11","_11b5"]],"m13":["1P 3m 5P 7m 9M 11P 13M",["_13"]],"m6":["1P 3m 4P 5P 13M",["_6"]],"m69":["1P 3m 5P 6M 9M",["_69"]],"m7":["1P 3m 5P 7m",["minor7","_","_7"]],"m7#5":["1P 3m 6m 7m"],"m7add11":["1P 3m 5P 7m 11P",["m7add4"]],"m7b5":["1P 3m 5d 7m",["half-diminished","h7","_7b5"]],"m9":["1P 3m 5P 7m 9M",["_9"]],"m9#5":["1P 3m 6m 7m 9M"],"m9b5":["1P 3m 7m 12d 2M",["h9","-9b5"]],"mMaj7":["1P 3m 5P 7M",["mM7","_M7"]],"mMaj7b6":["1P 3m 5P 6m 7M",["mM7b6"]],"mM9":["1P 3m 5P 7M 9M",["mMaj9","-M9"]],"mM9b6":["1P 3m 5P 6m 7M 9M",["mMaj9b6"]],"mb6M7":["1P 3m 6m 7M"],"mb6b9":["1P 3m 6m 9m"],"o":["1P 3m 5d",["mb5","dim"]],"o7":["1P 3m 5d 13M",["diminished","m6b5","dim7"]],"o7M7":["1P 3m 5d 6M 7M"],"oM7":["1P 3m 5d 7M"],"sus24":["1P 2M 4P 5P",["sus4add9"]],"+add#9":["1P 3M 5A 9A"],"madd4":["1P 3m 4P 5P"],"madd9":["1P 3m 5P 9M"]}')},,function(z,G,V){Object.defineProperty(G,"__esModule",{value:!0});var H=V(52),W=new WeakMap;G.keySignatureKeys=["Cb","Gb","Db","Ab","Eb","Bb","F","C","G","D","A","E","B","F#","C#"];var K=function(){function t(z){var V=this;this.tempos=[],this.timeSignatures=[],this.keySignatures=[],this.meta=[],this.name="",W.set(this,480),z&&(W.set(this,z.header.ticksPerBeat),z.tracks[0].forEach((function(z){z.meta&&("timeSignature"===z.type?V.timeSignatures.push({ticks:z.absoluteTime,timeSignature:[z.numerator,z.denominator]}):"setTempo"===z.type?V.tempos.push({bpm:6e7/z.microsecondsPerBeat,ticks:z.absoluteTime}):"keySignature"===z.type?V.keySignatures.push({key:G.keySignatureKeys[z.key+7],scale:0===z.scale?"major":"minor",ticks:z.absoluteTime}):"trackName"===z.type?V.name=z.text:"endOfTrack"!==z.type&&V.meta.push({text:z.text,ticks:z.absoluteTime,type:z.type}))})),this.update())}return t.prototype.update=function(){var z=this,G=0,V=0;this.tempos.sort((function(z,G){return z.ticks-G.ticks})),this.tempos.forEach((function(H,W){var K=W>0?z.tempos[W-1].bpm:z.tempos[0].bpm,Z=H.ticks/z.ppq-V,it=60/K*Z;H.time=it+G,G=H.time,V+=Z})),this.timeSignatures.sort((function(z,G){return z.ticks-G.ticks})),this.timeSignatures.forEach((function(G,V){var H=V>0?z.timeSignatures[V-1]:z.timeSignatures[0],W=(G.ticks-H.ticks)/z.ppq/H.timeSignature[0]/(H.timeSignature[1]/4);H.measures=H.measures||0,G.measures=W+H.measures}))},t.prototype.ticksToSeconds=function(z){var G=H.search(this.tempos,z);if(-1!==G){var V=this.tempos[G],W=V.time,K=(z-V.ticks)/this.ppq;return W+60/V.bpm*K}return z/this.ppq*.5},t.prototype.ticksToMeasures=function(z){var G=H.search(this.timeSignatures,z);if(-1!==G){var V=this.timeSignatures[G],W=(z-V.ticks)/this.ppq;return V.measures+W/(V.timeSignature[0]/V.timeSignature[1])/4}return z/this.ppq/4},Object.defineProperty(t.prototype,"ppq",{get:function(){return W.get(this)},enumerable:!0,configurable:!0}),t.prototype.secondsToTicks=function(z){var G=H.search(this.tempos,z,"time");if(-1!==G){var V=this.tempos[G],W=(z-V.time)/(60/V.bpm);return Math.round(V.ticks+W*this.ppq)}var K=z/.5;return Math.round(K*this.ppq)},t.prototype.toJSON=function(){return{keySignatures:this.keySignatures,meta:this.meta,name:this.name,ppq:this.ppq,tempos:this.tempos.map((function(z){return{bpm:z.bpm,ticks:z.ticks}})),timeSignatures:this.timeSignatures}},t.prototype.fromJSON=function(z){this.name=z.name,this.tempos=z.tempos.map((function(z){return Object.assign({},z)})),this.timeSignatures=z.timeSignatures.map((function(z){return Object.assign({},z)})),this.keySignatures=z.keySignatures.map((function(z){return Object.assign({},z)})),this.meta=z.meta.map((function(z){return Object.assign({},z)})),W.set(this,z.ppq),this.update()},t.prototype.setTempo=function(z){this.tempos=[{bpm:z,ticks:0}],this.update()},t}();G.Header=K},,,,,,function(z,G,V){var H=this&&this.__awaiter||function(z,G,V,H){return new(V||(V=Promise))((function(W,K){function s(z){try{u(H.next(z))}catch(z){K(z)}}function a(z){try{u(H.throw(z))}catch(z){K(z)}}function u(z){var G;z.done?W(z.value):(G=z.value,G instanceof V?G:new V((function(z){z(G)}))).then(s,a)}u((H=H.apply(z,G||[])).next())}))},W=this&&this.__generator||function(z,G){var V,H,W,K,Z={label:0,sent:function(){if(1&W[0])throw W[1];return W[1]},trys:[],ops:[]};return K={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(K[Symbol.iterator]=function(){return this}),K;function a(K){return function(it){return function(K){if(V)throw new TypeError("Generator is already executing.");for(;Z;)try{if(V=1,H&&(W=2&K[0]?H.return:K[0]?H.throw||((W=H.return)&&W.call(H),0):H.next)&&!(W=W.call(H,K[1])).done)return W;switch(H=0,W&&(K=[2&K[0],W.value]),K[0]){case 0:case 1:W=K;break;case 4:return Z.label++,{value:K[1],done:!1};case 5:Z.label++,H=K[1],K=[0];continue;case 7:K=Z.ops.pop(),Z.trys.pop();continue;default:if(!((W=(W=Z.trys).length>0&&W[W.length-1])||6!==K[0]&&2!==K[0])){Z=0;continue}if(3===K[0]&&(!W||K[1]>W[0]&&K[1]<W[3])){Z.label=K[1];break}if(6===K[0]&&Z.label<W[1]){Z.label=W[1],W=K;break}if(W&&Z.label<W[2]){Z.label=W[2],Z.ops.push(K);break}W[2]&&Z.ops.pop(),Z.trys.pop();continue}K=G.call(z,Z)}catch(z){K=[6,z],H=0}finally{V=W=0}if(5&K[0])throw K[1];return{value:K[0]?K[1]:void 0,done:!0}}([K,it])}}};Object.defineProperty(G,"__esModule",{value:!0});var K=V(51),Z=V(82),it=V(40),ot=V(53),rt=function(){function t(z){var G=this,V=null;z&&(z instanceof ArrayBuffer&&(z=new Uint8Array(z)),(V=K.parseMidi(z)).tracks.forEach((function(z){var G=0;z.forEach((function(z){G+=z.deltaTime,z.absoluteTime=G}))})),V.tracks=function(z){for(var G=[],V=0;V<z.length;V++)for(var H=G.length,W=new Map,K=Array(16).fill(0),Z=0,it=z[V];Z<it.length;Z++){var ot=it[Z],rt=H,at=ot.channel;if(void 0!==at){"programChange"===ot.type&&(K[at]=ot.programNumber);var ut=K[at]+" "+at;W.has(ut)?rt=W.get(ut):(rt=H+W.size,W.set(ut,rt))}G[rt]||G.push([]),G[rt].push(ot)}return G}(V.tracks)),this.header=new it.Header(V),this.tracks=[],z&&(this.tracks=V.tracks.map((function(z){return new ot.Track(z,G.header)})),1===V.header.format&&0===this.tracks[0].duration&&this.tracks.shift())}return t.fromUrl=function(z){return H(this,void 0,void 0,(function(){var G;return W(this,(function(V){switch(V.label){case 0:return[4,fetch(z)];case 1:return(G=V.sent()).ok?[4,G.arrayBuffer()]:[3,3];case 2:return[2,new t(V.sent())];case 3:throw new Error("could not load "+z)}}))}))},Object.defineProperty(t.prototype,"name",{get:function(){return this.header.name},set:function(z){this.header.name=z},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"duration",{get:function(){var z=this.tracks.map((function(z){return z.duration}));return Math.max.apply(Math,z)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"durationTicks",{get:function(){var z=this.tracks.map((function(z){return z.durationTicks}));return Math.max.apply(Math,z)},enumerable:!0,configurable:!0}),t.prototype.addTrack=function(){var z=new ot.Track(void 0,this.header);return this.tracks.push(z),z},t.prototype.toArray=function(){return Z.encode(this)},t.prototype.toJSON=function(){return{header:this.header.toJSON(),tracks:this.tracks.map((function(z){return z.toJSON()}))}},t.prototype.fromJSON=function(z){var G=this;this.header=new it.Header,this.header.fromJSON(z.header),this.tracks=z.tracks.map((function(z){var V=new ot.Track(void 0,G.header);return V.fromJSON(z),V}))},t.prototype.clone=function(){var z=new t;return z.fromJSON(this.toJSON()),z},t}();G.Midi=rt;var at=V(53);G.Track=at.Track;var ut=V(40);G.Header=ut.Header},,,,,function(z,G,V){G.parseMidi=V(80),G.writeMidi=V(81)},function(z,G,V){function r(z,G,V){void 0===V&&(V="ticks");var H=0,W=z.length,K=W;if(W>0&&z[W-1][V]<=G)return W-1;for(;H<K;){var Z=Math.floor(H+(K-H)/2),it=z[Z],ot=z[Z+1];if(it[V]===G){for(var rt=Z;rt<z.length;rt++)z[rt][V]===G&&(Z=rt);return Z}if(it[V]<G&&ot[V]>G)return Z;it[V]>G?K=Z:it[V]<G&&(H=Z+1)}return-1}Object.defineProperty(G,"__esModule",{value:!0}),G.search=r,G.insert=function(z,G,V){if(void 0===V&&(V="ticks"),z.length){var H=r(z,G[V],V);z.splice(H+1,0,G)}else z.push(G)}},function(z,G,V){Object.defineProperty(G,"__esModule",{value:!0});var H=V(52),W=V(54),K=V(84),Z=V(85),it=V(86),ot=V(88),rt=new WeakMap,at=function(){function t(z,G){var V=this;if(this.name="",this.notes=[],this.controlChanges=K.createControlChanges(),this.pitchBends=[],rt.set(this,G),z){var H=z.find((function(z){return"trackName"===z.type}));this.name=H?H.text:""}if(this.instrument=new it.Instrument(z,this),this.channel=0,z){for(var W=z.filter((function(z){return"noteOn"===z.type})),Z=z.filter((function(z){return"noteOff"===z.type})),u=function(){var z=W.shift();ot.channel=z.channel;var G=Z.findIndex((function(G){return G.noteNumber===z.noteNumber&&G.absoluteTime>=z.absoluteTime}));if(-1!==G){var V=Z.splice(G,1)[0];ot.addNote({durationTicks:V.absoluteTime-z.absoluteTime,midi:z.noteNumber,noteOffVelocity:V.velocity/127,ticks:z.absoluteTime,velocity:z.velocity/127})}},ot=this;W.length;)u();z.filter((function(z){return"controller"===z.type})).forEach((function(z){V.addCC({number:z.controllerType,ticks:z.absoluteTime,value:z.value/127})})),z.filter((function(z){return"pitchBend"===z.type})).forEach((function(z){V.addPitchBend({ticks:z.absoluteTime,value:z.value/Math.pow(2,13)})}))}}return t.prototype.addNote=function(z){var G=rt.get(this),V=new ot.Note({midi:0,ticks:0,velocity:1},{ticks:0,velocity:0},G);return Object.assign(V,z),H.insert(this.notes,V,"ticks"),this},t.prototype.addCC=function(z){var G=rt.get(this),V=new W.ControlChange({controllerType:z.number},G);return delete z.number,Object.assign(V,z),Array.isArray(this.controlChanges[V.number])||(this.controlChanges[V.number]=[]),H.insert(this.controlChanges[V.number],V,"ticks"),this},t.prototype.addPitchBend=function(z){var G=rt.get(this),V=new Z.PitchBend({},G);return Object.assign(V,z),H.insert(this.pitchBends,V,"ticks"),this},Object.defineProperty(t.prototype,"duration",{get:function(){if(!this.notes.length)return 0;for(var z=this.notes[this.notes.length-1].time+this.notes[this.notes.length-1].duration,G=0;G<this.notes.length-1;G++){var V=this.notes[G].time+this.notes[G].duration;z<V&&(z=V)}return z},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"durationTicks",{get:function(){if(!this.notes.length)return 0;for(var z=this.notes[this.notes.length-1].ticks+this.notes[this.notes.length-1].durationTicks,G=0;G<this.notes.length-1;G++){var V=this.notes[G].ticks+this.notes[G].durationTicks;z<V&&(z=V)}return z},enumerable:!0,configurable:!0}),t.prototype.fromJSON=function(z){var G=this;for(var V in this.name=z.name,this.channel=z.channel,this.instrument=new it.Instrument(void 0,this),this.instrument.fromJSON(z.instrument),z.controlChanges)z.controlChanges[V]&&z.controlChanges[V].forEach((function(z){G.addCC({number:z.number,ticks:z.ticks,value:z.value})}));z.notes.forEach((function(z){G.addNote({durationTicks:z.durationTicks,midi:z.midi,ticks:z.ticks,velocity:z.velocity})}))},t.prototype.toJSON=function(){for(var z={},G=0;G<127;G++)this.controlChanges.hasOwnProperty(G)&&(z[G]=this.controlChanges[G].map((function(z){return z.toJSON()})));return{channel:this.channel,controlChanges:z,pitchBends:this.pitchBends.map((function(z){return z.toJSON()})),instrument:this.instrument.toJSON(),name:this.name,notes:this.notes.map((function(z){return z.toJSON()}))}},t}();G.Track=at},function(z,G,V){Object.defineProperty(G,"__esModule",{value:!0}),G.controlChangeNames={1:"modulationWheel",2:"breath",4:"footController",5:"portamentoTime",7:"volume",8:"balance",10:"pan",64:"sustain",65:"portamentoTime",66:"sostenuto",67:"softPedal",68:"legatoFootswitch",84:"portamentoControl"},G.controlChangeIds=Object.keys(G.controlChangeNames).reduce((function(z,V){return z[G.controlChangeNames[V]]=V,z}),{});var H=new WeakMap,W=new WeakMap,K=function(){function t(z,G){H.set(this,G),W.set(this,z.controllerType),this.ticks=z.absoluteTime,this.value=z.value}return Object.defineProperty(t.prototype,"number",{get:function(){return W.get(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return G.controlChangeNames[this.number]?G.controlChangeNames[this.number]:null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"time",{get:function(){return H.get(this).ticksToSeconds(this.ticks)},set:function(z){var G=H.get(this);this.ticks=G.secondsToTicks(z)},enumerable:!0,configurable:!0}),t.prototype.toJSON=function(){return{number:this.number,ticks:this.ticks,time:this.time,value:this.value}},t}();G.ControlChange=K},function(z,G,V){self,z.exports=function(z){var G={};function n(V){if(G[V])return G[V].exports;var H=G[V]={i:V,l:!1,exports:{}};return z[V].call(H.exports,H,H.exports,n),H.l=!0,H.exports}return n.m=z,n.c=G,n.d=function(z,G,V){n.o(z,G)||Object.defineProperty(z,G,{enumerable:!0,get:V})},n.r=function(z){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(z,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(z,"__esModule",{value:!0})},n.t=function(z,G){if(1&G&&(z=n(z)),8&G)return z;if(4&G&&"object"==typeof z&&z&&z.__esModule)return z;var V=Object.create(null);if(n.r(V),Object.defineProperty(V,"default",{enumerable:!0,value:z}),2&G&&"string"!=typeof z)for(var H in z)n.d(V,H,function(G){return z[G]}.bind(null,H));return V},n.n=function(z){var G=z&&z.__esModule?function(){return z.default}:function(){return z};return n.d(G,"a",G),G},n.o=function(z,G){return Object.prototype.hasOwnProperty.call(z,G)},n.p="",n(n.s=4)}([function(z,G,V){V.r(G),V.d(G,"SVGNS",(function(){return H})),V.d(G,"drawSVGPath",(function(){return i})),V.d(G,"drawSVGText",(function(){return o})),V.d(G,"createSVGGroupChild",(function(){return s})),V.d(G,"setFade",(function(){return a}));const H="http://www.w3.org/2000/svg";function i(z,G,V,W,K,Z,it=1){const ot=document.createElementNS(H,"path");return ot.setAttributeNS(null,"d",G),ot.setAttributeNS(null,"transform",`translate(${V}, ${W}) scale(${K}, ${Z})`),ot.setAttributeNS(null,"opacity",""+it),z.appendChild(ot),ot}function o(z,G,V,W,K,Z=!1,it=1,ot=1){const rt=document.createElementNS(H,"text");rt.setAttributeNS(null,"font-family","Times"),rt.setAttributeNS(null,"font-size",K),Z&&rt.setAttributeNS(null,"font-weight","bold"),rt.setAttributeNS(null,"transform",`translate(${V}, ${W}) scale(${it}, ${ot})`);const at=document.createTextNode(G);return rt.appendChild(at),z.appendChild(rt),rt}function s(z,G){const V=document.createElementNS(H,"g");return V.setAttribute("data-id",G),z.appendChild(V),V}function a(z,G=!1,V=1,W=0){let K=z.querySelector("animate");if(!K){(K=document.createElementNS(H,"animate")).setAttributeNS(null,"attributeName","opacity"),K.setAttributeNS(null,"dur","4s"),K.setAttributeNS(null,"fill","freeze"),K.setAttributeNS(null,"keyTimes","0; 0.25; 0.5; 0.75; 1");const z=(V+3*W)/4;K.setAttributeNS(null,"values",`${V}; ${z}; ${W}; ${z}; ${V}`)}return G?K.setAttributeNS(null,"repeatCount","indefinite"):K.setAttributeNS(null,"repeatCount","1"),z.appendChild(K),z}},function(z,G,V){V.r(G),V.d(G,"PATH_SCALE",(function(){return H})),V.d(G,"staffLinePath",(function(){return K})),V.d(G,"extraLinePath",(function(){return Z})),V.d(G,"barPath",(function(){return it})),V.d(G,"stemPath",(function(){return ot})),V.d(G,"singleFlagPath",(function(){return rt})),V.d(G,"multiFlagPath",(function(){return at})),V.d(G,"tiePath",(function(){return ut})),V.d(G,"dotPath",(function(){return lt})),V.d(G,"NOTE_PATHS",(function(){return ct})),V.d(G,"REST_PATHS",(function(){return ht})),V.d(G,"CLEF_PATHS",(function(){return pt})),V.d(G,"ACCIDENTAL_PATHS",(function(){return yt}));const H=100,W="M 0,10 C 0,-15 35,-50 80,-50 110,-50 125,-35 125,-10 \n125,15 90,50 45,50 15,50 0,35 0,10 Z",K="m 0,0 h 100",Z="m -25,0 h 175",it="m 0,-200 v 400",ot="m 0,0 v 100 h 15 v -100 z",rt="M0,0 h 12 c 7,100 175,156 62,314 79,-177 -49,\n-193 -61,-200 l -13,-5 z",at="m 0,0 h 10 c 6,72 173,64 84,227 44,-120 -44,\n-123 -94,-167 z",ut="M 0,25 C 10,46 30,67 50,67 69,67 90,47 100,25 94,\n65 73,89 50,89 26,89 5,63 0,25 Z",lt="M 5 -20 a 20 20 0 1 0 0.00001 0 z",ct={4:{path:"m 0,0 c 0,-37 49,-51 79,-51 31,0 83,13 83,51 0,39 \n-55,51 -84,51 C 49,51 0,37 0,0 Z m 111,31 c 13,-19 0,-58 -22,-68 -33,-15 \n-53,10 -39,49 9,27 48,39 61,19 z",width:150,stemVSteps:0,stemAnchor:0,flags:0},2:{path:"m 0,10 c 0,-25 35,-60 80,-60 15,0 45,4 45,40 C 125,16 \n89,50 45,50 17,50 0,36 0,10 Z m 71,7 c 17,-11 45,-34 38,-45 -7,-10 -39,1 \n-57,12 -19,11 -42,31 -36,42 6,10 37,2 55,-9 z",width:125,stemVSteps:7,stemAnchor:-10,flags:0},1:{path:W,width:125,stemVSteps:7,stemAnchor:-10,flags:0},.5:{path:W,width:125,stemVSteps:7,stemAnchor:-10,flags:1},.25:{path:W,width:125,stemVSteps:9,stemAnchor:-10,flags:2},.125:{path:W,width:125,stemVSteps:11,stemAnchor:-10,flags:3},.0625:{path:W,width:125,stemVSteps:13,stemAnchor:-10,flags:4}},ht={4:"m 0,-50 h 125 v -50 H 0 Z",2:"M 0,0 H 125 V -50 H 0 Z",1:"m 0,-25 c 39,-39 37,-75 8,-120 l 6,-5 61,103 C \n40,-13 31,4 73,71 l -5,5 C 14,52 16,125 67,144 l -4,6 C -37,102 -1,22 59,60 Z",.5:"m 52,-47 c 26,-2 42,-21 48,-42 l 12,4 L 64,83 52,79 \n88,-49 c 0,0 -17,22 -57,22 -16,0 -31,-13 -31,-27 0,-18 10,-31 27,-31 17,0 \n33,15 25,38 z",.25:"m 129,-191 c -6,21 -22,40 -48,42 8,-23 -8,-38 \n-25,-38 -17,0 -27,13 -27,31 0,14 15,27 31,27 40,0 57,-22 57,-22 l -20,69 \nc -7,18 -22,33 -45,35 8,-23 -8,-38 -25,-38 -17,0 -27,13 -27,31 0,14 15,27 \n31,27 40,0 57,-22 57,-22 l -36,128 12,4 77,-270 z",.125:"m 129,-191 c -6,21 -22,40 -48,42 8,-23 -8,-38 \n-25,-38 -17,0 -27,13 -27,31 0,14 15,27 31,27 40,0 57,-22 57,-22 l -20,69 \nc -7,18 -22,33 -45,35 8,-23 -8,-38 -25,-38 -17,0 -27,13 -27,31 0,14 15,27 \n31,27 40,0 57,-22 57,-22 L 68,20 C 61,37 46,51 24,52 32,29 16,14 -1,14 c \n-17,0 -27,13 -27,31 0,14 15,27 31,27 38,0 55,-20 57,-22 l -36,128 12,4 \n105,-369 z",.0625:"m 158,-292 c -6,21 -22,40 -48,42 8,-23 -8,-38 \n-25,-38 -17,0 -27,13 -27,31 0,14 15,27 31,27 40,0 57,-22 57,-22 l -17,61 \nv 0 c -6,21 -22,40 -48,42 8,-23 -8,-38 -25,-38 -17,0 -27,13 -27,31 0,14 \n15,27 31,27 40,0 57,-22 57,-22 l -20,69 c -7,18 -22,33 -45,35 8,-23 -8,-38 \n-25,-38 -17,0 -27,13 -27,31 0,14 15,27 31,27 40,0 57,-22 57,-22 L 68,20 C \n61,37 46,51 24,52 32,29 16,14 -1,14 c -17,0 -27,13 -27,31 0,14 15,27 31,27 \n38,0 55,-20 57,-22 l -36,128 12,4 134,-469 z"},pt={50:{path:"m 101,-199 c -49,0 -100,28 -100,83 0,39 58,57 82,26 15,-20 \n-4,-47 -32,-47 -23,1 -25,0 -25,-8 0,-22 40,-46 71,-41 91,16 67,208 -105,302 \n75,-27 198,-94 211,-201 6,-66 -42,-114 -102,-114 z m 143,33 c -13,0 -23,11 \n-23,24 0,14 10,24 23,24 13,0 23,-11 23,-24 0,-13 -10,-24 -23,-24 z m 2,83 c \n-13,0 -23,11 -23,24 0,14 10,24 23,24 13,0 23,-11 23,-24 0,-13 -10,-24 -23,-24 \nz",upper:-4,lower:3},71:{path:"M 139,48 C 102,57 76,120 131,151 41,128 64,24 129,2 L \n117,-57 C -32,47 26,217 166,182 Z m 12,-1 27,131 C 242,153 216,46 151,47 \nZ m -35,-177 c 34,-23 82,-117 50,-140 -23,-17 -71,33 -50,140 z m -10,10 c \n-23,-77 -20,-200 48,-213 19,-4 89,171 -26,266 l 13,66 c 120,-6 137,155 \n39,191 l 12,58 c 30,131 -137,145 -138,47 0,-29 37,-59 63,-37 21,18 25,71 \n-25,70 32,42 103,0 91,-65 L 167,193 C 56,232 -112,63 106,-120 Z",upper:-7,lower:8}},yt=[null,"m -49,-121 v 52 l -29,9 v -48 h -8 v 51 l -20,6 v 29 l \n20,-6 v 70 l -20,6 v 30 l 20,-6 v 51 h 8 V 69 l 30,-8 v 50 h 8 V 58 l 20,-6 \nV 23 l -20,6 v -71 l 20,-6 v -29 l -20,6 v -50 z m 1,82 v 71 l -29,9 v -71 z","M -106,-166 V 67 c 52,-42 85,-56 85,-94 0,-47 -46,-51 \n-73,-22 v -117 z m 31,120 c 20,0 42,46 -20,91 V -7 c 0,-28 10,-39 20,-39 z","m -81,-58 v -48 H -92 V 73 l 60,-13 v 50 h 11 V -72 Z m \n50,24 v 58 l -50,11 v -58 z"]},function(z,G,V){V.r(G),V.d(G,"MIN_RESOLUTION",(function(){return H})),V.d(G,"STEM_WIDTH",(function(){return W})),V.d(G,"LINE_STROKE",(function(){return K})),V.d(G,"COMPACT_SPACING",(function(){return Z}));const H=.0625,W=15,K=1,Z=150},function(z,G,V){V.r(G),V.d(G,"MAX_QUARTER_DIVISION",(function(){return ot})),V.d(G,"ScrollType",(function(){return rt})),V.d(G,"StaffSVGRender",(function(){return l}));var H=V(2),W=V(0),K=V(1);const Z=[{steps:[0,0,-1,-1,-2,-3,-3,-4,-4,-5,-5,-6],accidental:[0,1,0,1,0,0,1,0,1,0,1,0]},{steps:[0,-1,-1,-2,-2,-3,-4,-4,-5,-5,-6,-6],accidental:[0,0,3,0,3,0,0,3,0,3,0,3]},{steps:[0,0,-1,-1,-2,-3,-3,-4,-4,-5,-5,-6],accidental:[3,0,0,1,0,3,0,0,1,0,1,0]},{steps:[0,-1,-1,-2,-2,-3,-4,-4,-5,-5,-6,-6],accidental:[0,2,0,0,3,0,2,0,0,3,0,3]},{steps:[0,0,-1,-1,-2,-3,-3,-4,-4,-5,-5,-6],accidental:[3,0,3,0,0,3,0,3,0,0,1,0]},{steps:[0,-1,-1,-2,-2,-3,-4,-4,-5,-5,-6,-6],accidental:[0,2,0,2,0,0,2,0,2,0,0,3]},{steps:[0,-1,-1,-2,-2,-3,-4,-4,-5,-5,-6,-7],accidental:[3,0,3,0,3,0,0,3,0,3,0,0]},{steps:[0,0,-1,-1,-2,-3,-3,-4,-4,-5,-5,-6],accidental:[0,1,0,1,0,3,0,0,1,0,1,0]},{steps:[0,-1,-1,-2,-2,-3,-4,-4,-5,-5,-6,-6],accidental:[0,0,3,0,3,0,2,0,0,3,0,3]},{steps:[0,0,-1,-1,-2,-3,-3,-4,-4,-5,-5,-6],accidental:[3,0,0,1,0,3,0,3,0,0,1,0]},{steps:[0,-1,-1,-2,-2,-3,-4,-4,-5,-5,-6,-6],accidental:[0,2,0,0,3,0,2,0,2,0,0,3]},{steps:[0,0,-1,-1,-2,-3,-3,-4,-4,-5,-5,-6],accidental:[3,0,3,0,0,3,0,3,0,3,0,0]}],it=[{accidental:1,pitches:[]},{accidental:2,pitches:[70,75,68,73,66]},{accidental:1,pitches:[78,73]},{accidental:2,pitches:[70,75,68]},{accidental:1,pitches:[78,73,80,75]},{accidental:2,pitches:[70]},{accidental:2,pitches:[70,75,68,73,66,71]},{accidental:1,pitches:[78]},{accidental:2,pitches:[70,75,68,73]},{accidental:1,pitches:[78,73,80]},{accidental:2,pitches:[70,75]},{accidental:1,pitches:[78,73,80,75,70]}],ot=16;var rt;!function(z){z[z.PAGE=0]="PAGE",z[z.NOTE=1]="NOTE",z[z.BAR=2]="BAR"}(rt||(rt={}));class l{constructor(z,G,V){this.handleScrollEvent=z=>{this.lastKnownScrollLeft=this.parentElement.scrollLeft,this.ticking||window.requestAnimationFrame((()=>{this.changeAndDrawSignaturesIfNeeded(this.lastKnownScrollLeft),this.ticking=!1})),this.ticking=!0},this.scoreInfo=z,this.config={noteHeight:G.noteHeight||6,noteSpacing:G.noteSpacing||1,pixelsPerTimeStep:G.pixelsPerTimeStep||30,noteRGB:G.noteRGB||"8, 41, 64",activeNoteRGB:G.activeNoteRGB||"240, 84, 119"},this.div=V,this.timeSignatureNumerator=4,this.timeSignatureDenominator=4,this.key=G.defaultKey||0,this.scrollType=G.scrollType||rt.PAGE,this.scale=this.config.noteHeight/K.PATH_SCALE,(void 0===G.pixelsPerTimeStep||G.pixelsPerTimeStep<=0)&&(this.config.pixelsPerTimeStep=0,this.config.noteSpacing=H.COMPACT_SPACING*this.scale),this.clear(),this.redraw()}clear(){for(;this.div.lastChild;)this.div.removeChild(this.div.lastChild);this.div.style.overflow="visible",this.div.style.position="relative",this.overlaySVG=document.createElementNS(W.SVGNS,"svg"),this.overlaySVG.style.position="absolute",this.div.appendChild(this.overlaySVG),this.overlayG=Object(W.createSVGGroupChild)(this.overlaySVG,"overlay"),this.signaturesBlinking=!1,this.signaturesQuarters=0,this.parentElement=document.createElement("div"),this.parentElement.style.overflow="auto",this.div.appendChild(this.parentElement),this.ticking=!1,this.lastKnownScrollLeft=0,this.parentElement.addEventListener("scroll",this.handleScrollEvent),this.staffSVG=document.createElementNS(W.SVGNS,"svg"),this.parentElement.appendChild(this.staffSVG),this.staffG=Object(W.createSVGGroupChild)(this.staffSVG,"staff"),this.linesG=Object(W.createSVGGroupChild)(this.staffSVG,"lines"),this.setStroke(this.linesG),this.staffG.appendChild(this.linesG),this.musicG=Object(W.createSVGGroupChild)(this.staffSVG,"music"),this.setFill(this.musicG),this.setStroke(this.musicG,0),this.staffG.appendChild(this.musicG),this.signaturesG=Object(W.createSVGGroupChild)(this.staffSVG,"signatures"),this.staffG.appendChild(this.signaturesG);let z=0,G=0;this.scoreInfo.notes.forEach((V=>{z+=V.pitch,++G}));const V=z/G;this.clef=V<60?50:71,this.signaturesList=[{x:0,q:0}],this.signatureCurrent=0,this.signatureNext=0,this.changeKeySignatureIfNeeded(0),this.changeTimeSignatureIfNeeded(0),this.vStepSize=this.config.noteHeight/2,this.hStepSize=this.config.pixelsPerTimeStep,this.staffOffset=0,this.height=0,this.width=0,this.musicBlockMap=new Map,this.playingNotes=[],this.lastBar=0,this.barAccidentals={},this.lastQ=-1}isPaintingActiveNote(z,G){const V=z.start===G.start,H=z.start<=G.start&&z.start+z.length>=G.start+G.length;return V||H}redraw(z,G){let V=-1;const H=0===this.config.pixelsPerTimeStep;if(z){const K=[];this.playingNotes.forEach((G=>{this.isPaintingActiveNote(G,z)?K.push(G):this.highlightElement(this.getGroup(G),!1)})),this.playingNotes=K;const Z=this.getGroup(z);if(Z){this.playingNotes.push(z),this.highlightElement(Z,!0),V=Z.getBoundingClientRect().left-this.staffSVG.getBoundingClientRect().left;const K=z.start,it=Z.getAttribute("data-is-bar-beginning");(this.scrollType!==rt.BAR||it)&&this.scrollIntoViewIfNeeded(G,V),!H&&this.signaturesBlinking&&K>=this.signaturesQuarters&&(this.signaturesBlinking=!1,Object(W.setFade)(this.overlayG,this.signaturesBlinking))}}else{this.setDetails();const z=-1===this.lastQ;let G=0,V=0;z?(V=this.drawSignatures(this.overlayG,G,!0,!0,!0),H&&(this.width=0,V+=this.config.noteSpacing),V+=this.drawRests(this.initialRest,G+V)):G=this.width,this.musicBlockMap.forEach(((z,W)=>{H||(G=this.quartersToTime(W)*this.hStepSize),W>this.lastQ?(V+=this.drawMusicBlock(z,G+V),this.lastQ=W):W===this.lastQ&&(V+=this.drawRests(z,G+V))}));const W=this.staffSVG.getBoundingClientRect(),K=this.musicG.getBoundingClientRect();if(this.updateVerticalBoundaries(K.top-W.top,K.bottom-W.top),H)this.width+=V;else{const z=this.musicBlockMap.get(this.lastQ),G=this.quartersToTime(this.lastQ+z.notes[0].length);this.width=G*this.config.pixelsPerTimeStep}this.staffSVG.setAttributeNS(null,"width",""+this.width),this.redrawStaff(this.linesG,0,this.width)}return V}drawMusicBlock(z,G){const V=z.notes[0].start;let Z=this.drawBarIfNeeded(V,G);Z+=this.drawSignaturesIfNeeded(V,G+Z);let it=0;for(let G=4;G>=H.MIN_RESOLUTION&&!it;G/=2)G<=z.notes[0].length&&(it=G);if(0===it){const G=0===z.notes[0].length?"[infinite]":""+4/z.notes[0].length;console.warn(" StaffRender ","background:orange; color:white",`StaffRender does not handle notes shorther than 1/${4/H.MIN_RESOLUTION}th, and this score tries to draw a 1/${G}th. Shortest possible note will be drawn instead.`),it=H.MIN_RESOLUTION}const ot=K.NOTE_PATHS[it];let rt;if(ot.stemAnchor&&(rt=Object(W.createSVGGroupChild)(this.musicG,"stem")),z.notes.forEach((V=>{const H=V.vSteps*this.vStepSize,rt=2*(V.vSteps>0?Math.floor(V.vSteps/2):Math.ceil(V.vSteps/2)),at=V.vSteps>0?-2:2;for(let z=rt;Math.abs(z)>4;z+=at)Object(W.drawSVGPath)(this.linesG,K.extraLinePath,G+Z,z*this.vStepSize,this.scale,1);if(V.g=V.tiedFrom?V.tiedFrom.g:Object(W.createSVGGroupChild)(this.musicG,`${V.start}-${V.pitch}`),z.isBarBeginning&&V.g.setAttribute("data-is-bar-beginning","true"),V.tiedFrom){const z=G+Z-V.tiedFrom.xHeadRight;Object(W.drawSVGPath)(V.g,K.tiePath,V.tiedFrom.xHeadRight,H,z/K.PATH_SCALE,this.scale*(V.vSteps<0?-1:1),V.opacity)}Object(W.drawSVGPath)(V.g,ot.path,G+Z,H,this.scale,this.scale,V.opacity),V.xHeadRight=G+Z+ot.width*this.scale,1.5*it<=V.length&&Object(W.drawSVGPath)(V.g,K.dotPath,G+Z+ot.width*this.scale+this.vStepSize/2,H-this.vStepSize/2,this.scale,this.scale,V.opacity),0!==V.accidental&&Object(W.drawSVGPath)(V.g,K.ACCIDENTAL_PATHS[V.accidental],G+Z,H,this.scale,this.scale,V.opacity)})),ot.stemAnchor){let V,it,at=G+Z;const ut=ot.stemAnchor*this.scale,lt=z.minVStep+z.maxVStep<0,ct=ot.flags>2?2*(ot.flags-2):0;if(lt?(V=z.maxVStep*this.vStepSize-ut,it=(z.minVStep+7+ct)*this.vStepSize):(at+=(ot.width-H.STEM_WIDTH)*this.scale,V=z.minVStep*this.vStepSize+ut,it=(z.maxVStep-7-ct)*this.vStepSize),Object(W.drawSVGPath)(rt,K.stemPath,at,V,this.scale,(it-V)/K.PATH_SCALE),1===ot.flags)Object(W.drawSVGPath)(rt,K.singleFlagPath,at,it,this.scale,this.scale*(lt?-1:1),1);else if(ot.flags>1)for(let z=0;z<ot.flags;++z)Object(W.drawSVGPath)(rt,K.multiFlagPath,at,it,this.scale,this.scale*(lt?-1:1),1),it+=(lt?-2:2)*this.vStepSize}return 0===this.config.pixelsPerTimeStep&&(Z+=ot.width*this.scale,rt&&(Z+=rt.getBoundingClientRect().width),Z+=this.config.noteSpacing),Z+=this.drawRests(z,G+Z)}drawBarIfNeeded(z,G){let V=0;const H=this.lastBar+this.getBarLength();return 0!==z&&z>=H&&(this.config.pixelsPerTimeStep>0?G-=this.config.noteSpacing:V=this.config.noteSpacing,Object(W.drawSVGPath)(this.linesG,K.barPath,G,0,1,this.scale),this.lastBar=H),V}drawRests(z,G){let V=0,Z=z.restToNextLength;if(Z){this.config.pixelsPerTimeStep>0&&(G+=this.quartersToTime(z.notes[0].length)*this.hStepSize);let it=z.notes[0].start+z.notes[0].length,ot=0;const rt=this.lastBar+this.getBarLength()-it;let at;for(Z>rt&&(ot=Z-rt,Z=rt),at=4;at>this.getBarLength()&&at>=H.MIN_RESOLUTION;at/=2);let ut=at;for(;(Z||ot)&&ut>=H.MIN_RESOLUTION;){if(ut<=Z){V+=this.drawBarIfNeeded(it,G+V),V+=this.drawSignaturesIfNeeded(it,G+V);const z=Object(W.drawSVGPath)(this.musicG,K.REST_PATHS[ut],G+V,0,this.scale,this.scale);this.config.pixelsPerTimeStep>0?G+=this.quartersToTime(ut)*this.hStepSize:(V+=z.getBoundingClientRect().width,V+=this.config.noteSpacing),it+=ut,Z-=ut}if(ot&&Z<=0){const z=this.getBarLength();for(ot>z?(Z=z,ot-=z):(Z=ot,ot=0),at=4;at>this.getBarLength()&&at>=H.MIN_RESOLUTION;at/=2);ut=at}Z<ut&&(ut/=2)}}return V}redrawStaff(z,G,V){let H=z.querySelector('g[data-id="staff-five-lines"]');if(H)H.setAttributeNS(null,"transform",`scale(${V/K.PATH_SCALE}, 1)`);else{H=Object(W.createSVGGroupChild)(z,"staff-five-lines");const Z=0;for(let z=-4;z<=4;z+=2)Object(W.drawSVGPath)(H,K.staffLinePath,G,Z+z*this.vStepSize,V/K.PATH_SCALE,1)}return H}clearSignatureOverlay(){for(;this.overlayG.lastChild;)this.overlayG.removeChild(this.overlayG.lastChild)}drawSignaturesIfNeeded(z,G){let V=0;const K=this.changeKeySignatureIfNeeded(z),Z=this.changeTimeSignatureIfNeeded(z);if(K||Z){const it=H.COMPACT_SPACING*this.scale*(this.config.pixelsPerTimeStep>0?3:2);this.signaturesList.push({x:G-it,q:z}),null===this.signatureNext&&(this.signatureNext=G);const ot=z>0?Object(W.createSVGGroupChild)(this.signaturesG,"signatures"):this.overlayG;V+=this.drawSignatures(ot,G+V,!1,K,Z)}return 0===this.config.pixelsPerTimeStep?V:0}drawSignatures(z,G,V,Z,ot){const rt=H.COMPACT_SPACING*this.scale;let at,ut=rt;const lt=z===this.overlayG||this.config.pixelsPerTimeStep>0;if(lt){(at=document.createElementNS(W.SVGNS,"rect")).setAttributeNS(null,"x",""+G),at.setAttributeNS(null,"y","0"),at.setAttributeNS(null,"width","1"),at.setAttributeNS(null,"height","1"),at.setAttribute("data-id","background"),z.appendChild(at);const V=document.defaultView.getComputedStyle(this.div.parentElement);at.setAttributeNS(null,"fill",V.getPropertyValue("background-color"))}if(V){const V=Object(W.drawSVGPath)(z,K.CLEF_PATHS[this.clef].path,G+ut,0,this.scale,this.scale);this.setFill(V),ut+=3*rt}if(Z){const V=it[this.key].accidental,H=71===this.clef?0:14;it[this.key].pitches.forEach((Z=>{const it=this.getPitchDetails(Z).vSteps,ot=Object(W.drawSVGPath)(z,K.ACCIDENTAL_PATHS[V],G+ut,(H+it)*this.vStepSize,this.scale,this.scale);this.setFill(ot),ut+=ot.getBoundingClientRect().width}))}if(ot){const V=Object(W.createSVGGroupChild)(z,"time-key"),H=2.85*this.config.noteHeight+"px";Object(W.drawSVGText)(V,""+this.timeSignatureNumerator,G+ut,-.5,H,!0),Object(W.drawSVGText)(V,""+this.timeSignatureDenominator,G+ut,4*this.vStepSize-.5,H,!0),this.setFill(V),ut+=V.getBoundingClientRect().width+rt}const ct=this.redrawStaff(z,G,ut);this.setStroke(ct);const ht=this.div.getBoundingClientRect(),pt=z.getBoundingClientRect();if(this.updateVerticalBoundaries(pt.top-ht.top,pt.bottom-ht.top),lt&&(at.setAttributeNS(null,"y",""+-this.staffOffset),at.setAttributeNS(null,"height",""+this.height),at.setAttributeNS(null,"width",""+ut)),z===this.overlayG){this.overlaySVG.setAttributeNS(null,"width",""+(ut+5));for(let G=0;G<5;++G){const V=Object(W.drawSVGPath)(z,K.stemPath,ut+G,G*G-this.staffOffset,1/H.STEM_WIDTH,(this.height-2*G*G)/K.PATH_SCALE,(G-5)*(G-5)*2/K.PATH_SCALE);this.setFill(V)}}if(this.config.pixelsPerTimeStep>0){const V=0===this.signaturesQuarters;return V&&(this.signaturesQuarters=this.timeToQuarters(ut/this.hStepSize)),(V||G>0)&&(this.signaturesBlinking=!0,Object(W.setFade)(z,this.signaturesBlinking)),0}return ut}changeKeySignatureIfNeeded(z){if(this.scoreInfo.keySignatures){let G=this.key;for(let V=0;V<this.scoreInfo.keySignatures.length&&this.scoreInfo.keySignatures[V].start<=z;++V)G=this.scoreInfo.keySignatures[V].key;if(G!==this.key)return this.key=G,!0}return!1}changeTimeSignatureIfNeeded(z){if(this.scoreInfo.timeSignatures){let G=this.timeSignatureNumerator,V=this.timeSignatureDenominator;for(let H=0;H<this.scoreInfo.timeSignatures.length&&this.scoreInfo.timeSignatures[H].start<=z;++H)G=this.scoreInfo.timeSignatures[H].numerator,V=this.scoreInfo.timeSignatures[H].denominator;if(G!==this.timeSignatureNumerator||V!==this.timeSignatureDenominator)return this.timeSignatureNumerator=G,this.timeSignatureDenominator=V,!0}return!1}changeAndDrawSignaturesIfNeeded(z){let G;if(z<this.signatureCurrent||null!==this.signatureNext&&this.signatureNext<=z){G=this.signaturesList[0].q,this.signatureNext=null;for(let V=0;V<this.signaturesList.length;++V){if(z<this.signaturesList[V].x){this.signatureNext=this.signaturesList[V].x;break}this.signatureCurrent=this.signaturesList[V].x,G=this.signaturesList[V].q}}if(void 0!==G){const z=this.key,V=this.timeSignatureNumerator,H=this.timeSignatureDenominator;this.changeKeySignatureIfNeeded(G),this.changeTimeSignatureIfNeeded(G),this.clearSignatureOverlay(),this.drawSignatures(this.overlayG,0,!0,!0,!0),this.key=z,this.timeSignatureNumerator=V,this.timeSignatureDenominator=H}this.config.pixelsPerTimeStep>0&&0===z&&(this.signatureNext=0,this.signaturesBlinking=!0,Object(W.setFade)(this.overlayG,this.signaturesBlinking))}getBarLength(){return 4*this.timeSignatureNumerator/this.timeSignatureDenominator}scrollIntoViewIfNeeded(z,G){if(z)if(this.scrollType===rt.PAGE){const z=this.parentElement.getBoundingClientRect().width;G>this.parentElement.scrollLeft+z&&(this.parentElement.scrollLeft=G-20)}else{const z=this.parentElement.getBoundingClientRect().width;this.parentElement.scrollLeft=G-.5*z}}updateVerticalBoundaries(z,G){let V=0;if(z<0){this.staffOffset-=z;const G=`translate(0, ${this.staffOffset})`;this.overlayG.setAttributeNS(null,"transform",G),this.staffG.setAttributeNS(null,"transform",G),V=this.height-z}if((V=Math.max(V,G-z))>this.height){this.height=V,this.overlaySVG.setAttributeNS(null,"height",""+this.height),this.staffSVG.setAttributeNS(null,"height",""+this.height);const z=this.div.querySelectorAll('rect[data-id="background"]');for(let G=0;G<z.length;++G){const V=z[G];V.setAttributeNS(null,"y",""+-this.staffOffset),V.setAttributeNS(null,"height",""+this.height)}}}setFill(z,G=!1){z.setAttributeNS(null,"fill",this.getColor(G))}setStroke(z,G=H.LINE_STROKE,V=!1){z.setAttributeNS(null,"stroke",this.getColor(V)),z.setAttributeNS(null,"stroke-width",""+G)}getColor(z){return`rgb(${z?this.config.activeNoteRGB:this.config.noteRGB})`}getOpacity(z){return z?z/127*.8+.2:1}getGroup(z){const G=z.start,V=z.pitch;return this.staffSVG.querySelector(`g[data-id="${G}-${V}"]`)}highlightElement(z,G){z.setAttribute("fill",this.getColor(G)),z.setAttribute("stroke",this.getColor(G))}getBarBeginnings(){const z=new Set;let G=0;this.scoreInfo.notes.forEach((z=>{z.start+z.length>G&&(G=z.start+z.length)}));const V=this.scoreInfo.timeSignatures?this.scoreInfo.timeSignatures.slice(0):[{start:0,numerator:4,denominator:4}];V.sort(((z,G)=>z.start-G.start));let H=0;for(let W=0;W<V.length;++W){const K=W===V.length-1?G:V[W].start,Z=4*V[W].numerator/V[W].denominator;for(;H<K;H+=Z)z.add(H)}return z}quartersToTime(z){return z/this.scoreInfo.tempos[0].qpm*60}timeToQuarters(z){return z*this.scoreInfo.tempos[0].qpm/60}setDetails(){let z=new Map;const G=this.getBarBeginnings(),V=new Set(G);this.scoreInfo.notes.slice().sort(((z,G)=>z.start-G.start)).forEach((G=>{const H=this.getQNote(G);V.add(H.start),V.add(H.start+H.length),z.has(H.start)?z.get(H.start).push(H):z.set(H.start,[H])})),Array.from(V).sort(((z,G)=>z-G)).forEach((G=>{const V=[];z.forEach((z=>{z.forEach((z=>{const H=this.splitQNote(z,G);H&&V.push(H)}))})),V.forEach((G=>{z.has(G.start)?z.get(G.start).push(G):z.set(G.start,[G])}))})),z=new Map(Array.from(z).sort(((z,G)=>z[0]-G[0])));const H=this.key;let W=null,K=0;const Z=G[Symbol.iterator]();let it=Z.next();z.forEach(((z,G)=>{const V={maxVStep:Number.MAX_SAFE_INTEGER,minVStep:Number.MIN_SAFE_INTEGER,restToNextLength:0,isBarBeginning:!1,notes:[]};this.changeKeySignatureIfNeeded(G);const H=it.value+this.getBarLength();!it.done&&G>=H&&(it=Z.next(),this.barAccidentals={},V.isBarBeginning=!0),z.forEach((z=>{this.analyzePitch(z,G),V.minVStep=Math.max(z.vSteps,V.minVStep),V.maxVStep=Math.min(z.vSteps,V.maxVStep),V.notes.push(z)})),W&&(W.restToNextLength=G-K),this.musicBlockMap.set(G,V),W=V,K=G+V.notes[0].length})),this.initialRest={maxVStep:0,minVStep:0,restToNextLength:this.musicBlockMap.values().next().value.notes[0].start,isBarBeginning:!0,notes:[{start:0,length:0,vSteps:0,accidental:0,opacity:0,pitch:0,xHeadRight:0}]},this.key=H}getQNote(z){return{start:z.start,length:z.length,vSteps:0,accidental:0,opacity:this.getOpacity(z.intensity),pitch:z.pitch,xHeadRight:0}}splitQNote(z,G){const V=z.start+z.length-G;return G>z.start&&V>0?(z.length-=V,{start:G,length:V,vSteps:z.vSteps,accidental:z.accidental,opacity:z.opacity,pitch:z.pitch,xHeadRight:0,tiedFrom:z}):null}analyzePitch(z,G){const V=this.getPitchDetails(z.pitch);V.vSteps in this.barAccidentals?V.accidental===this.barAccidentals[V.vSteps]?V.accidental=0:(3===this.barAccidentals[V.vSteps]?V.accidental=V.keyAccidental:0===V.accidental&&(V.accidental=3),this.barAccidentals[V.vSteps]=V.accidental):(z.tiedFrom&&(V.accidental=0),this.barAccidentals[V.vSteps]=V.accidental),z.vSteps=V.vSteps,z.accidental=V.accidental}getPitchDetails(z){const G=z-60,V=Math.floor(G/12),H=G-12*V,W=Z[this.key].steps[H],K=71===this.clef?6:-6,ot=1===it[this.key].accidental?69+(H+3)%12:64+(H+8)%12;return{vSteps:K-7*V+W,accidental:Z[this.key].accidental[H],keyAccidental:it[this.key].pitches.indexOf(ot)>-1?it[this.key].accidental:0}}}},function(z,G,V){V.r(G);var H=V(3);V.d(G,"MAX_QUARTER_DIVISION",(function(){return H.MAX_QUARTER_DIVISION})),V.d(G,"ScrollType",(function(){return H.ScrollType})),V.d(G,"StaffSVGRender",(function(){return H.StaffSVGRender}))}])},,,,,,,,,,,,,function(z,G,V){V.r(G),V.d(G,"aux_inputs",(function(){return H})),V.d(G,"chords",(function(){return W})),V.d(G,"constants",(function(){return K})),V.d(G,"data",(function(){return Z})),V.d(G,"logging",(function(){return it})),V.d(G,"melodies",(function(){return ot})),V.d(G,"performance",(function(){return rt})),V.d(G,"sequences",(function(){return at})),V.d(G,"MetronomeCallbackObject",(function(){return p})),V.d(G,"Metronome",(function(){return f})),V.d(G,"MidiConversionError",(function(){return S})),V.d(G,"midiToSequenceProto",(function(){return y})),V.d(G,"sequenceProtoToMidi",(function(){return b})),V.d(G,"urlToBlob",(function(){return w})),V.d(G,"blobToNoteSequence",(function(){return P})),V.d(G,"urlToNoteSequence",(function(){return v})),V.d(G,"BasePlayerCallback",(function(){return I})),V.d(G,"BasePlayer",(function(){return M})),V.d(G,"Player",(function(){return k})),V.d(G,"SoundFontPlayer",(function(){return q})),V.d(G,"PlayerWithClick",(function(){return E})),V.d(G,"MIDIPlayer",(function(){return _})),V.d(G,"BaseRecorderCallback",(function(){return x})),V.d(G,"Recorder",(function(){return C})),V.d(G,"BaseVisualizer",(function(){return D})),V.d(G,"PianoRollCanvasVisualizer",(function(){return j})),V.d(G,"Visualizer",(function(){return L})),V.d(G,"BaseSVGVisualizer",(function(){return R})),V.d(G,"PianoRollSVGVisualizer",(function(){return B})),V.d(G,"WaterfallSVGVisualizer",(function(){return U})),V.d(G,"ScrollType",(function(){return pt})),V.d(G,"StaffSVGVisualizer",(function(){return F}));var H=V(36),W=V(18),K=V(1),Z=V(12),it=V(4),ot=V(10),rt=V(13),at=V(7),ut=V(3);class p{}class f{constructor(z,G=1){this.clicksPerQuarter=1,this.muted=!1,this.loClick=new ut.MembraneSynth({pitchDecay:.008,envelope:{attack:.001,decay:.3,sustain:0}}).toMaster(),this.hiClick=new ut.MembraneSynth({pitchDecay:.008,envelope:{attack:.001,decay:.3,sustain:0}}).toMaster(),this.loClickNote="c5",this.hiClickNote="g5",this.ticking=!1,this.startedAt=null,this.step=-1,this.reset(),this.callbackObject=z,this.clicksPerQuarter=G}isTicking(){return this.ticking}getStartedAt(){return this.startedAt}getOffsetTime(){return ut.immediate()-this.startedAt}start(z=120){this.reset(),this.ticking=!0,this.callbackObject.click||(this.callbackObject.click=()=>{}),this.callbackObject.quarter||(this.callbackObject.quarter=()=>{}),this.callbackObject.bar||(this.callbackObject.bar=()=>{});let G=0;const V=4*this.clicksPerQuarter;ut.Transport.scheduleRepeat((z=>{this.startedAt||(this.startedAt=z);const H=z-this.startedAt;this.step++;const W=this.step%V,K=Math.floor(W/this.clicksPerQuarter),Z=W%this.clicksPerQuarter;this.callbackObject.click(H,W),0===Z&&this.callbackObject.quarter(H,K),this.muted||(0===W?this.hiClick.triggerAttack(this.hiClickNote,z,.1):this.loClick.triggerAttack(this.loClickNote,z,.1)),0===W&&(this.callbackObject.bar(H,G),G++)}),V+"n"),ut.Transport.bpm.value=z,ut.Transport.start()}stop(){this.ticking=!1,ut.Transport.cancel(),ut.Transport.stop()}reset(){this.muted=!1,this.ticking=!1,this.step=-1,this.startedAt=null}}var lt=V(46),ct=V(6),ht=V(2);class S extends Error{constructor(z){super(z),Object.setPrototypeOf(this,new.target.prototype)}}function y(z){const G=new lt.Midi(z),V=ht.a.create();V.ticksPerQuarter=G.header.ppq,V.sourceInfo=ht.a.SourceInfo.create({parser:ht.a.SourceInfo.Parser.TONEJS_MIDI_CONVERT,encodingType:ht.a.SourceInfo.EncodingType.MIDI});for(const z of G.header.timeSignatures)V.timeSignatures.push(ht.a.TimeSignature.create({time:G.header.ticksToSeconds(z.ticks),numerator:z.timeSignature[0],denominator:z.timeSignature[1]}));V.timeSignatures.length||V.timeSignatures.push(ht.a.TimeSignature.create({time:0,numerator:4,denominator:4}));for(const z of G.header.tempos)V.tempos.push(ht.a.Tempo.create({time:z.time,qpm:z.bpm}));let H=-1;for(const z of G.tracks){z.notes.length>0&&(H+=1);for(const G of z.notes){const W=G.time,Z=W+G.duration;V.notes.push(ht.a.Note.create({instrument:H,program:z.instrument.number,startTime:W,endTime:Z,pitch:G.midi,velocity:Math.floor(G.velocity*K.MIDI_VELOCITIES),isDrum:z.instrument.percussion})),Z>V.totalTime&&(V.totalTime=Z)}}return V}function b(z){at.isQuantizedSequence(z)&&(z=at.unquantizeSequence(z));const G=new lt.Midi;G.fromJSON({header:{name:"",ppq:z.ticksPerQuarter||K.DEFAULT_TICKS_PER_QUARTER,tempos:[],timeSignatures:[],keySignatures:[],meta:[]},tracks:[]});const V=Array.from(z.tempos||[]);0===V.length&&V.push({time:0,qpm:K.DEFAULT_QUARTERS_PER_MINUTE}),V.sort(((z,G)=>z.time-G.time));for(const z of V)G.header.tempos.push({ticks:G.header.secondsToTicks(z.time),bpm:z.qpm}),G.header.update();if(z.timeSignatures&&0!==z.timeSignatures.length)for(const V of z.timeSignatures)G.header.timeSignatures.push({ticks:G.header.secondsToTicks(V.time),timeSignature:[V.numerator,V.denominator]});else G.header.timeSignatures.push({ticks:0,timeSignature:[4,4]});G.header.update();const H=new Map;for(const G of z.notes){const z=G.instrument?G.instrument:0,V=void 0===G.program?K.DEFAULT_PROGRAM:G.program,W=!!G.isDrum,Z=JSON.stringify([z,V,W]);H.has(Z)||H.set(Z,[]),H.get(Z).push(G)}return H.forEach(((z,V)=>{const[H,W]=JSON.parse(V).slice(1),Z=G.addTrack();Z.channel=W?K.DRUM_CHANNEL:K.NON_DRUM_CHANNELS[(G.tracks.length-1)%K.NON_DRUM_CHANNELS.length],Z.instrument.number=H;for(const G of z){const z=void 0===G.velocity?K.DEFAULT_VELOCITY:G.velocity;Z.addNote({midi:G.pitch,time:G.startTime,duration:G.endTime-G.startTime,velocity:(z+1)/K.MIDI_VELOCITIES})}})),G.toArray()}function w(z){return new Promise(((G,V)=>{Object(ct.a)(z).then((z=>z.blob())).then((z=>{G(z)})).catch((z=>V(z)))}))}function P(z){return new Promise(((G,V)=>{const H=new FileReader;H.onload=z=>{try{const z=y(H.result);G(z)}catch(z){V(z)}},H.onerror=z=>V(z),H.readAsArrayBuffer(z)}))}function v(z){return w(z).then(P)}class N{constructor(z){this.FADE_SECONDS=.1,this.baseURL=z,this.buffers=new ut.Buffers([]),this.sourceMap=new Map,this.initialized=!1}async initialize(){await Object(ct.a)(this.baseURL+"/instrument.json").then((z=>z.json())).then((z=>{this.name=z.name,this.minPitch=z.minPitch,this.maxPitch=z.maxPitch,this.durationSeconds=z.durationSeconds,this.releaseSeconds=z.releaseSeconds,this.percussive=z.percussive,this.velocities=z.velocities,this.initialized=!0}))}sampleInfoToName(z){return this.velocities?`p${z.pitch}_v${z.velocity}`:"p"+z.pitch}sampleNameToURL(z){return`${this.baseURL}/${z}.mp3`}nearestVelocity(z){if(!this.velocities)return z;z||(z=K.DEFAULT_VELOCITY);let G,V=K.MIDI_VELOCITIES;return this.velocities.forEach((H=>{const W=Math.abs(H-z);W<V&&(G=H,V=W)})),G}async loadSamples(z){this.initialized||await this.initialize();const G=z.filter((z=>!(z.pitch<this.minPitch||z.pitch>this.maxPitch)||(it.log(`Pitch ${z.pitch} is outside the valid range for ${this.name}, ignoring.`,"SoundFont"),!1))).map((z=>this.sampleInfoToName({pitch:z.pitch,velocity:this.nearestVelocity(z.velocity)}))),V=Array.from(new Set(G)).filter((z=>!this.buffers.has(z))).map((z=>({name:z,url:this.sampleNameToURL(z)})));V.length>0&&(V.forEach((z=>this.buffers.add(z.name,z.url))),await new Promise((z=>ut.Buffer.on("load",z))),it.log(`Loaded samples for ${this.name}.`,"SoundFont"))}playNote(z,G,V,H,W){const K=this.getBuffer(z,G);H>this.durationSeconds&&it.log(`Requested note duration longer than sample duration: ${H} > ${this.durationSeconds}`,"SoundFont");const Z=new ut.BufferSource({buffer:K,fadeOut:this.FADE_SECONDS}).connect(W);if(Z.start(V,0,void 0,1,0),!this.percussive&&H<this.durationSeconds){const z=new ut.BufferSource(K).connect(W);Z.stop(V+H+this.FADE_SECONDS),z.start(V+H,this.durationSeconds,void 0,1,this.FADE_SECONDS)}}playNoteDown(z,G,V){const H=this.getBuffer(z,G),W=new ut.BufferSource(H).connect(V);W.start(0,0,void 0,1,0),this.sourceMap.has(z)&&this.sourceMap.get(z).stop(ut.now()+this.FADE_SECONDS,this.FADE_SECONDS),this.sourceMap.set(z,W)}playNoteUp(z,G,V){if(!this.sourceMap.has(z))return;const H=this.getBuffer(z,G);new ut.BufferSource(H).connect(V).start(0,this.durationSeconds,void 0,1,this.FADE_SECONDS),this.sourceMap.get(z).stop(ut.now()+this.FADE_SECONDS,this.FADE_SECONDS),this.sourceMap.delete(z)}getBuffer(z,G){if(!this.initialized)throw new Error("Instrument is not initialized.");if(z<this.minPitch||z>this.maxPitch)return void it.log(`Pitch ${z} is outside the valid range for ${this.name} (${this.minPitch}-${this.maxPitch})`,"SoundFont");const V=this.sampleInfoToName({pitch:z,velocity:this.nearestVelocity(G)});if(!this.buffers.has(V))throw new Error(`Buffer not found for ${this.name}: ${V}`);const H=this.buffers.get(V);if(!H.loaded)throw new Error(`Buffer not loaded for ${this.name}: ${V}`);return H}}class T{constructor(z){this.baseURL=z,this.instruments=new Map,this.initialized=!1}async initialize(){await Object(ct.a)(this.baseURL+"/soundfont.json").then((z=>z.json())).then((z=>{this.name=z.name;for(const G in z.instruments){const V=`${this.baseURL}/${z.instruments[G]}`;this.instruments.set("drums"===G?"drums":+G,new N(V))}this.initialized=!0}))}async loadSamples(z){this.initialized||await this.initialize();const G=new Map;z.forEach((z=>{z.isDrum=z.isDrum||!1,z.program=z.program||0;const V=z.isDrum?"drums":z.program,H={pitch:z.pitch,velocity:z.velocity};G.has(V)?G.get(V).push(H):this.instruments.has(V)?G.set(V,[H]):it.log(`No instrument in ${this.name} for: program=${z.program}, isDrum=${z.isDrum}`,"SoundFont")})),await Promise.all(Array.from(G.keys()).map((z=>this.instruments.get(z).loadSamples(G.get(z)))))}playNote(z,G,V,H,W=0,K=!1,Z){const ot=K?"drums":W;if(!this.initialized)throw new Error("SoundFont is not initialized.");this.instruments.has(ot)?this.instruments.get(ot).playNote(z,G,V,H,Z):it.log(`No instrument in ${this.name} for: program=${W}, isDrum=${K}`,"SoundFont")}playNoteDown(z,G,V=0,H=!1,W){const K=H?"drums":V;if(!this.initialized)throw new Error("SoundFont is not initialized.");this.instruments.has(K)?this.instruments.get(K).playNoteDown(z,G,W):it.log(`No instrument in ${this.name} for: program=${V}, isDrum=${H}`,"SoundFont")}playNoteUp(z,G,V=0,H=!1,W){const K=H?"drums":V;if(!this.initialized)throw new Error("SoundFont is not initialized.");this.instruments.has(K)?this.instruments.get(K).playNoteUp(z,G,W):it.log(`No instrument in ${this.name} for: program=${V}, isDrum=${H}`,"SoundFont")}}function O(z,G){return z.quantizedStartStep<G.quantizedStartStep?-1:z.quantizedStartStep>G.quantizedStartStep?1:z.pitch<G.pitch?-1:1}class I{}class M{constructor(z=!1,G){this.playClick=z,this.callbackObject=G,this.desiredQPM=void 0}setTempo(z){this.desiredQPM=z,"started"===ut.Transport.state&&(ut.Transport.bpm.value=z)}makeClickSequence(z){const G=at.clone(z),V=G.notes.map((z=>z.quantizedEndStep)),H=Math.max(...V);for(let z=0;z<H;z+=4){const V={pitch:z%16==0?K.LO_CLICK_PITCH:K.HI_CLICK_PITCH,quantizedStartStep:z,isDrum:!0,quantizedEndStep:z+1};G.notes.push(V)}return G.notes.sort(O),G}resumeContext(){ut.context.resume()}start(z,G){if("started"===this.getPlayState())throw new Error("Cannot start playback; player is already playing.");if("paused"===this.getPlayState())throw new Error("Cannot `start()` a paused player; use `resume()`.");if("stopped"!==ut.Transport.state)throw new Error("Cannot start playback while `Tone.Transport` is in use.");this.resumeContext();const V=at.isQuantizedSequence(z);if(this.playClick&&V&&(z=this.makeClickSequence(z)),G?ut.Transport.bpm.value=G:z.tempos&&z.tempos.length>0&&z.tempos[0].qpm>0?ut.Transport.bpm.value=z.tempos[0].qpm:ut.Transport.bpm.value=K.DEFAULT_QUARTERS_PER_MINUTE,V)z=at.unquantizeSequence(z,G);else if(G)throw new Error("Cannot specify a `qpm` for a non-quantized sequence.");const H=new ut.Part(((z,G)=>{this.currentPart===H&&((this.playClick||G.pitch!==K.LO_CLICK_PITCH&&G.pitch!==K.HI_CLICK_PITCH)&&this.playNote(z,G),this.callbackObject&&ut.Draw.schedule((()=>{this.callbackObject.run(G,z)}),z))}),z.notes.map((z=>[z.startTime,z])));return this.currentPart=H,this.desiredQPM&&(ut.Transport.bpm.value=this.desiredQPM),this.currentPart.start(),"started"!==ut.Transport.state&&ut.Transport.start(),new Promise((G=>{this.scheduledStop=ut.Transport.schedule((()=>{this.stop(),G(),this.callbackObject&&this.callbackObject.stop()}),"+"+z.totalTime)}))}stop(){this.isPlaying()&&(this.currentPart.stop(),ut.Transport.stop(),this.currentPart=null),ut.Transport.clear(this.scheduledStop),this.scheduledStop=void 0,this.desiredQPM=void 0}pause(){if(!this.isPlaying())throw new Error("Cannot pause playback while the player is stopped.");ut.Transport.pause()}resume(){if("paused"!==this.getPlayState())throw new Error(`Cannot resume playback while "${this.getPlayState()}".`);ut.Transport.start()}seekTo(z){if(!this.isPlaying())throw new Error("Cannot seek while the player is stopped.");ut.Transport.seconds=z}isPlaying(){return!!this.currentPart}getPlayState(){return this.isPlaying()?ut.Transport.state:"stopped"}}class A{constructor(){this.DRUM_PITCH_TO_CLASS=new Map,this.kick=(new ut.MembraneSynth).toMaster(),this.tomLow=new ut.MembraneSynth({pitchDecay:.008,envelope:{attack:.01,decay:.5,sustain:0}}).toMaster(),this.tomMid=new ut.MembraneSynth({pitchDecay:.008,envelope:{attack:.01,decay:.5,sustain:0}}).toMaster(),this.tomHigh=new ut.MembraneSynth({pitchDecay:.008,envelope:{attack:.01,decay:.5,sustain:0}}).toMaster(),this.closedHihat=new ut.MetalSynth({frequency:400,envelope:{attack:.001,decay:.1,release:.8},harmonicity:5.1,modulationIndex:32,resonance:4e3,octaves:1}).toMaster(),this.openHihat=new ut.MetalSynth({frequency:400,envelope:{attack:.001,decay:.5,release:.8,sustain:1},harmonicity:5.1,modulationIndex:32,resonance:4e3,octaves:1}).toMaster(),this.ride=(new ut.MetalSynth).toMaster(),this.crash=new ut.MetalSynth({frequency:300,envelope:{attack:.001,decay:1,release:3},harmonicity:5.1,modulationIndex:64,resonance:4e3,octaves:1.5}).toMaster(),this.snare=new ut.NoiseSynth({noise:{type:"white"},envelope:{attack:.005,decay:.05,sustain:.1,release:.4}}).toMaster(),this.loClick=new ut.MembraneSynth({pitchDecay:.008,envelope:{attack:.001,decay:.3,sustain:0}}).toMaster(),this.hiClick=new ut.MembraneSynth({pitchDecay:.008,envelope:{attack:.001,decay:.3,sustain:0}}).toMaster(),this.pitchPlayers=[(z,G=1)=>this.kick.triggerAttackRelease("C2","8n",z,G),(z,G=1)=>this.snare.triggerAttackRelease("16n",z,G),(z,G=1)=>this.closedHihat.triggerAttack(z,.3,G),(z,G=1)=>this.openHihat.triggerAttack(z,.3,G),(z,G=.5)=>this.tomLow.triggerAttack("G3",z,G),(z,G=.5)=>this.tomMid.triggerAttack("C4",z,G),(z,G=.5)=>this.tomHigh.triggerAttack("F4",z,G),(z,G=1)=>this.crash.triggerAttack(z,1,G),(z,G=1)=>this.ride.triggerAttack(z,.5,G),(z,G=.5)=>this.loClick.triggerAttack("G5",z,G),(z,G=.5)=>this.hiClick.triggerAttack("C6",z,G)];for(let z=0;z<Z.DEFAULT_DRUM_PITCH_CLASSES.length;++z)Z.DEFAULT_DRUM_PITCH_CLASSES[z].forEach((G=>{this.DRUM_PITCH_TO_CLASS.set(G,z)}));this.DRUM_PITCH_TO_CLASS.set(K.LO_CLICK_PITCH,K.LO_CLICK_CLASS),this.DRUM_PITCH_TO_CLASS.set(K.HI_CLICK_PITCH,K.HI_CLICK_CLASS)}static getInstance(){return A.instance||(A.instance=new A),A.instance}playNote(z,G,V){this.pitchPlayers[this.DRUM_PITCH_TO_CLASS.get(z)](G,V)}}class k extends M{constructor(){super(...arguments),this.drumKit=A.getInstance(),this.bassSynth=new ut.Synth({volume:5,oscillator:{type:"triangle"}}).toMaster(),this.polySynth=new ut.PolySynth(10).toMaster()}playNote(z,G){const V=G.hasOwnProperty("velocity")?G.velocity/K.MAX_MIDI_VELOCITY:void 0;if(G.isDrum)this.drumKit.playNote(G.pitch,z,V);else{const H=new ut.Frequency(G.pitch,"midi"),W=G.endTime-G.startTime;this.getSynth(G.instrument,G.program).triggerAttackRelease(H,W,z,V)}}getSynth(z,G){return void 0!==G&&G>=32&&G<=39?this.bassSynth:this.polySynth}}k.tone=ut;class q extends M{constructor(z,G=ut.Master,V,H,W){super(!1,W),this.soundFont=new T(z),this.output=G,this.programOutputs=V,this.drumOutputs=H}async loadSamples(z){await this.soundFont.loadSamples(z.notes.map((z=>({pitch:z.pitch,velocity:z.velocity,program:z.program||0,isDrum:z.isDrum||!1}))))}async loadAllSamples(z=0,G=!1){const V=ht.a.create(),H=G?K.MIN_DRUM_PITCH:K.MIN_PIANO_PITCH,W=G?K.MAX_DRUM_PITCH:K.MAX_PIANO_PITCH;for(let Z=H;Z<=W;Z++)for(let H=K.MIN_MIDI_VELOCITY;H<K.MAX_MIDI_VELOCITY;H++)V.notes.push({pitch:Z,velocity:H,program:z,isDrum:G});return this.loadSamples(V)}resumeContext(){ut.context.resume()}start(z,G){return this.resumeContext(),this.loadSamples(z).then((()=>super.start(z,G)))}playNote(z,G){this.soundFont.playNote(G.pitch,G.velocity,z,G.endTime-G.startTime,G.program,G.isDrum,this.getAudioNodeOutput(G))}playNoteDown(z){this.soundFont.playNoteDown(z.pitch,z.velocity,z.program,z.isDrum,this.getAudioNodeOutput(z))}playNoteUp(z){this.soundFont.playNoteUp(z.pitch,z.velocity,z.program,z.isDrum,this.getAudioNodeOutput(z))}getAudioNodeOutput(z){let G=this.output;return this.programOutputs&&!z.isDrum?this.programOutputs.has(z.program)&&(G=this.programOutputs.get(z.program)):this.drumOutputs&&z.isDrum&&this.drumOutputs.has(z.pitch)&&(G=this.drumOutputs.get(z.pitch)),G}}class E extends k{constructor(z){super(!0,z)}}class _ extends M{constructor(z){super(!1,z),this.outputs=[],this.outputChannel=0,this.availableOutputs=[],this.NOTE_ON=144,this.NOTE_OFF=128}async requestMIDIAccess(){return navigator.requestMIDIAccess?new Promise(((z,G)=>{navigator.requestMIDIAccess().then((G=>{G.addEventListener("statechange",(z=>this.initOutputs(G))),z(this.initOutputs(G))}),(z=>console.log("Something went wrong",G(z))))})):null}initOutputs(z){const G=z.outputs.values();for(let z=G.next();z&&!z.done;z=G.next())this.availableOutputs.push(z.value);return this.availableOutputs}playNote(z,G){const V=G.velocity||100,H=1e3*(G.endTime-G.startTime),W=[this.NOTE_ON+this.outputChannel,G.pitch,V],K=[this.NOTE_OFF+this.outputChannel,G.pitch,V],Z=this.outputs?this.outputs:this.availableOutputs;for(let z=0;z<Z.length;z++)this.sendMessageToOutput(Z[z],W),this.sendMessageToOutput(Z[z],K,ct.d.now()+H)}sendMessageToOutput(z,G,V){z&&z.send(G,V)}playNoteDown(z){const G=[this.NOTE_ON,z.pitch,z.velocity],V=this.outputs?this.outputs:this.availableOutputs;for(let z=0;z<V.length;z++)this.sendMessageToOutput(V[z],G)}playNoteUp(z){const G=[this.NOTE_OFF,z.pitch,z.velocity],V=this.outputs?this.outputs:this.availableOutputs;for(let H=0;H<V.length;H++)this.sendMessageToOutput(V[H],G,z.endTime-z.startTime)}}class x{}class C{constructor(z={},G){this.notes=[],this.midiInputs=[],this.loClick=new ut.MembraneSynth({pitchDecay:.008,envelope:{attack:.001,decay:.3,sustain:0}}).toMaster(),this.hiClick=new ut.MembraneSynth({pitchDecay:.008,envelope:{attack:.001,decay:.3,sustain:0}}).toMaster(),this.config={playClick:z.playClick,qpm:z.qpm||K.DEFAULT_QUARTERS_PER_MINUTE,playCountIn:z.playCountIn,startRecordingAtFirstNote:z.startRecordingAtFirstNote||!1},this.callbackObject=G,this.recording=!1,this.onNotes=new Map}async initialize(){await navigator.requestMIDIAccess().then((z=>this.midiReady(z)),(z=>console.log("Something went wrong",z)))}midiReady(z){it.log("Initialized Recorder","Recorder");const G=z.inputs.values();for(let z=G.next();z&&!z.done;z=G.next())this.midiInputs.push(z.value)}isRecording(){return this.recording}setTempo(z){this.config.qpm=z,"started"===ut.Transport.state&&(ut.Transport.bpm.value=z)}enablePlayClick(z){this.config.playClick=z}enablePlayCountIn(z){this.config.playCountIn=z}initClickLoop(){let z=0;this.clickLoop=new ut.Loop((G=>{z%4==0?this.loClick.triggerAttack("G5",G):this.hiClick.triggerAttack("C6",G),z++,this.config.playCountIn&&4===z&&(ut.Transport.stop(),this.clickLoop.stop())}),"4n")}getMIDIInputs(){return this.midiInputs}start(z){const G=z||this.midiInputs;for(const z of G)z.onmidimessage=z=>{this.midiMessageReceived(z)};if(this.config.playClick||this.config.playCountIn?(this.initClickLoop(),ut.Transport.bpm.value=this.config.qpm,ut.Transport.start(),this.clickLoop.start()):this.clickLoop=null,this.recording=!0,this.firstNoteTimestamp=void 0,this.notes=[],this.onNotes=new Map,!this.startRecordingAtFirstNote){const z=Date.now();this.firstNoteTimestamp=z}}stop(){this.recording=!1;const z=Date.now();this.onNotes.forEach(((G,V)=>{this.noteOff(V,z)}));for(const z of this.midiInputs)z.onmidimessage=null;return this.clickLoop&&(ut.Transport.stop(),this.clickLoop.stop()),0===this.notes.length?null:this.getNoteSequence()}getNoteSequence(){return 0===this.notes.length?null:ht.a.create({notes:this.notes,totalTime:this.notes[this.notes.length-1].endTime})}reset(){const z=this.stop();return this.firstNoteTimestamp=void 0,this.notes=[],this.onNotes=new Map,z}midiMessageReceived(z){if(!this.recording)return;let G;G=void 0!==z.timeStamp&&0!==z.timeStamp?z.timeStamp:ct.d.now();const V=G+ct.d.timing.navigationStart;void 0===this.firstNoteTimestamp&&(this.firstNoteTimestamp=V);const H=z.data[0]>>4,W=z.data[1],K=z.data.length>2?z.data[2]:1,Z=z.srcElement;8===H||9===H&&0===K?(this.callbackObject&&this.callbackObject.noteOff&&this.callbackObject.noteOff(W,K,Z),this.noteOff(W,V),this.callbackObject&&this.callbackObject.run&&this.callbackObject.run(this.getNoteSequence())):9===H&&(this.callbackObject&&this.callbackObject.noteOn&&this.callbackObject.noteOn(W,K,Z),this.noteOn(W,K,V))}noteOn(z,G,V){const H=new ht.a.Note;H.pitch=z,H.startTime=(V-this.firstNoteTimestamp)/1e3,H.velocity=G,this.onNotes.set(z,H)}noteOff(z,G){const V=this.onNotes.get(z);V&&(V.endTime=(G-this.firstNoteTimestamp)/1e3,this.notes.push(V)),this.onNotes.delete(z)}}var pt,yt=V(55);class D{constructor(z,G={}){if(this.noteSequence=z,this.sequenceIsQuantized=at.isQuantizedSequence(this.noteSequence),this.config={noteHeight:G.noteHeight||6,noteSpacing:G.noteSpacing||1,pixelsPerTimeStep:G.pixelsPerTimeStep||30,noteRGB:G.noteRGB||"8, 41, 64",activeNoteRGB:G.activeNoteRGB||"240, 84, 119",minPitch:G.minPitch,maxPitch:G.maxPitch},this.sequenceIsQuantized){const G=z.quantizationInfo.stepsPerQuarter;this.config.pixelsPerTimeStep=G?this.config.pixelsPerTimeStep/G:7}const V=this.getSize();this.width=V.width,this.height=V.height}updateMinMaxPitches(z=!1){if(!this.config.minPitch||!this.config.maxPitch){void 0===this.config.minPitch&&(this.config.minPitch=K.MAX_MIDI_PITCH),void 0===this.config.maxPitch&&(this.config.maxPitch=K.MIN_MIDI_PITCH);for(const z of this.noteSequence.notes)this.config.minPitch=Math.min(z.pitch,this.config.minPitch),this.config.maxPitch=Math.max(z.pitch,this.config.maxPitch);z||(this.config.minPitch-=2,this.config.maxPitch+=2)}}getSize(){this.updateMinMaxPitches();const z=(this.config.maxPitch-this.config.minPitch)*this.config.noteHeight,G=this.sequenceIsQuantized?this.noteSequence.totalQuantizedSteps:this.noteSequence.totalTime;if(!G)throw new Error("The sequence you are using with the visualizer does not have a "+(this.sequenceIsQuantized?"totalQuantizedSteps":"totalTime")+" field set, so the visualizer can't be horizontally sized correctly.");return{width:G*this.config.pixelsPerTimeStep,height:z}}getNotePosition(z,G){const V=this.getNoteEndTime(z)-this.getNoteStartTime(z),H=this.getNoteStartTime(z)*this.config.pixelsPerTimeStep,W=Math.max(this.config.pixelsPerTimeStep*V-this.config.noteSpacing,1);return{x:H,y:this.height-(z.pitch-this.config.minPitch)*this.config.noteHeight,w:W,h:this.config.noteHeight}}scrollIntoViewIfNeeded(z,G){if(z&&this.parentElement){const z=this.parentElement.getBoundingClientRect().width;G>this.parentElement.scrollLeft+z&&(this.parentElement.scrollLeft=G-20)}}getNoteStartTime(z){return this.sequenceIsQuantized?z.quantizedStartStep:Math.round(1e8*z.startTime)/1e8}getNoteEndTime(z){return this.sequenceIsQuantized?z.quantizedEndStep:Math.round(1e8*z.endTime)/1e8}isPaintingActiveNote(z,G){const V=this.getNoteStartTime(z)===this.getNoteStartTime(G),H=this.getNoteStartTime(z)<=this.getNoteStartTime(G)&&this.getNoteEndTime(z)>=this.getNoteEndTime(G);return V||H}}class j extends D{constructor(z,G,V={}){super(z,V),this.ctx=G.getContext("2d"),this.parentElement=G.parentElement;const H=window.devicePixelRatio||1;this.ctx&&(this.ctx.canvas.width=H*this.width,this.ctx.canvas.height=H*this.height,G.style.width=this.width+"px",G.style.height=this.height+"px",this.ctx.scale(H,H)),this.redraw()}redraw(z,G){let V;this.clear();for(let G=0;G<this.noteSequence.notes.length;G++){const H=this.noteSequence.notes[G],W=this.getNotePosition(H,G),K=.2,Z=H.velocity?H.velocity/100+K:1,it=z&&this.isPaintingActiveNote(H,z),ot=`rgba(${it?this.config.activeNoteRGB:this.config.noteRGB},\n  ${Z})`;this.redrawNote(W.x,W.y,W.w,W.h,ot),it&&H===z&&(V=W.x)}return this.scrollIntoViewIfNeeded(G,V),V}clear(){this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height)}clearActiveNotes(){this.redraw()}redrawNote(z,G,V,H,W){this.ctx.fillStyle=W,this.ctx.fillRect(Math.round(z),Math.round(G),Math.round(V),Math.round(H))}}class L extends j{constructor(z,G,V={}){super(z,G,V),it.log("mm.Visualizer is deprecated, and will be removed in a future          version. Please use mm.PianoRollCanvasVisualizer instead","mm.Visualizer",5)}}class R extends D{constructor(z,G={}){super(z,G),this.drawn=!1}redraw(z,G){if(this.drawn||this.draw(),!z)return null;let V;this.unfillActiveRect(this.svg);for(let G=0;G<this.noteSequence.notes.length;G++){const H=this.noteSequence.notes[G];if(!z||!this.isPaintingActiveNote(H,z))continue;const W=this.svg.querySelector(`rect[data-index="${G}"]`);this.fillActiveRect(W,H),H===z&&(V=parseFloat(W.getAttribute("x")))}return this.scrollIntoViewIfNeeded(G,V),V}fillActiveRect(z,G){z.setAttribute("fill",this.getNoteFillColor(G,!0)),z.classList.add("active")}unfillActiveRect(z){const G=z.querySelectorAll("rect.active");for(let z=0;z<G.length;++z){const V=G[z],H=this.getNoteFillColor(this.noteSequence.notes[parseInt(V.getAttribute("data-index"),10)],!1);V.setAttribute("fill",H),V.classList.remove("active")}}draw(){for(let z=0;z<this.noteSequence.notes.length;z++){const G=this.noteSequence.notes[z],V=this.getNotePosition(G,z),H=this.getNoteFillColor(G,!1),W=[["index",z],["instrument",G.instrument],["program",G.program],["isDrum",!0===G.isDrum],["pitch",G.pitch]],K=[["--midi-velocity",String(void 0!==G.velocity?G.velocity:127)]];this.drawNote(V.x,V.y,V.w,V.h,H,W,K)}this.drawn=!0}getNoteFillColor(z,G){const V=z.velocity?z.velocity/100+.2:1;return`rgba(${G?this.config.activeNoteRGB:this.config.noteRGB},\n  ${V})`}drawNote(z,G,V,H,W,K,Z){if(!this.svg)return;const it=document.createElementNS("http://www.w3.org/2000/svg","rect");it.classList.add("note"),it.setAttribute("fill",W),it.setAttribute("x",""+Math.round(z)),it.setAttribute("y",""+Math.round(G)),it.setAttribute("width",""+Math.round(V)),it.setAttribute("height",""+Math.round(H)),K.forEach((([z,G])=>{void 0!==G&&(it.dataset[z]=""+G)})),Z.forEach((([z,G])=>{it.style.setProperty(z,G)})),this.svg.appendChild(it)}clear(){this.svg.innerHTML="",this.drawn=!1}clearActiveNotes(){this.unfillActiveRect(this.svg)}}class B extends R{constructor(z,G,V={}){if(super(z,V),!(G instanceof SVGSVGElement))throw new Error("This visualizer requires an <svg> element to display the visualization");this.svg=G,this.parentElement=G.parentElement;const H=this.getSize();this.width=H.width,this.height=H.height,this.svg.style.width=this.width+"px",this.svg.style.height=this.height+"px",this.clear(),this.draw()}}class U extends R{constructor(z,G,V={}){if(super(z,V),this.NOTES_PER_OCTAVE=12,this.WHITE_NOTES_PER_OCTAVE=7,this.LOW_C=24,this.firstDrawnOctave=0,this.lastDrawnOctave=6,!(G instanceof HTMLDivElement))throw new Error("This visualizer requires a <div> element to display the visualization");this.config.whiteNoteWidth=V.whiteNoteWidth||20,this.config.blackNoteWidth=V.blackNoteWidth||2*this.config.whiteNoteWidth/3,this.config.whiteNoteHeight=V.whiteNoteHeight||70,this.config.blackNoteHeight=V.blackNoteHeight||140/3,this.config.showOnlyOctavesUsed=V.showOnlyOctavesUsed,this.setupDOM(G);const H=this.getSize();this.width=H.width,this.height=H.height,this.svg.style.width=this.width+"px",this.svg.style.height=this.height+"px",this.svgPiano.style.width=this.width+"px",this.svgPiano.style.height=this.config.whiteNoteHeight+"px",this.parentElement.style.width=this.width+this.config.whiteNoteWidth+"px",this.parentElement.scrollTop=this.parentElement.scrollHeight,this.clear(),this.drawPiano(),this.draw()}setupDOM(z){this.parentElement=document.createElement("div"),this.parentElement.classList.add("waterfall-notes-container");const G=Math.max(z.getBoundingClientRect().height,200);this.parentElement.style.paddingTop=G-this.config.whiteNoteHeight+"px",this.parentElement.style.height=G-this.config.whiteNoteHeight+"px",this.parentElement.style.boxSizing="border-box",this.parentElement.style.overflowX="hidden",this.parentElement.style.overflowY="auto",this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svgPiano=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.classList.add("waterfall-notes"),this.svgPiano.classList.add("waterfall-piano"),this.parentElement.appendChild(this.svg),z.innerHTML="",z.appendChild(this.parentElement),z.appendChild(this.svgPiano)}redraw(z,G){if(this.drawn||this.draw(),!z)return null;this.clearActiveNotes(),this.parentElement.style.paddingTop=this.parentElement.style.height;for(let G=0;G<this.noteSequence.notes.length;G++){const V=this.noteSequence.notes[G];if(!z||!this.isPaintingActiveNote(V,z))continue;const H=this.svg.querySelector(`rect[data-index="${G}"]`);this.fillActiveRect(H,V);const W=this.svgPiano.querySelector(`rect[data-pitch="${V.pitch}"]`);if(this.fillActiveRect(W,V),V===z){const z=parseFloat(H.getAttribute("y")),G=parseFloat(H.getAttribute("height"));return z<this.parentElement.scrollTop-G&&(this.parentElement.scrollTop=z+G),z}}return null}getSize(){this.updateMinMaxPitches(!0);let z=52;if(this.config.showOnlyOctavesUsed){let G=!1,V=!1;for(let z=1;z<7;z++){const H=this.LOW_C+this.NOTES_PER_OCTAVE*z;!G&&H>this.config.minPitch&&(this.firstDrawnOctave=z-1,G=!0),!V&&H>this.config.maxPitch&&(this.lastDrawnOctave=z-1,V=!0)}z=(this.lastDrawnOctave-this.firstDrawnOctave+1)*this.WHITE_NOTES_PER_OCTAVE}const G=z*this.config.whiteNoteWidth,V=this.sequenceIsQuantized?this.noteSequence.totalQuantizedSteps:this.noteSequence.totalTime;if(!V)throw new Error("The sequence you are using with the visualizer does not have a "+(this.sequenceIsQuantized?"totalQuantizedSteps":"totalTime")+" field set, so the visualizer can't be horizontally sized correctly.");return{width:G,height:Math.max(V*this.config.pixelsPerTimeStep,1)}}getNotePosition(z,G){const V=this.svgPiano.querySelector(`rect[data-pitch="${z.pitch}"]`);if(!V)return null;const H=this.getNoteEndTime(z)-this.getNoteStartTime(z),W=Number(V.getAttribute("x")),K=Number(V.getAttribute("width")),Z=Math.max(this.config.pixelsPerTimeStep*H-this.config.noteSpacing,1);return{x:W,y:this.height-this.getNoteStartTime(z)*this.config.pixelsPerTimeStep-Z,w:K,h:Z}}drawPiano(){this.svgPiano.innerHTML="";const z=this.config.whiteNoteWidth-this.config.blackNoteWidth/2,G=[1,3,6,8,10];let V=0,H=0;this.config.showOnlyOctavesUsed?H=this.firstDrawnOctave*this.NOTES_PER_OCTAVE+this.LOW_C:(H=this.LOW_C-3,this.drawWhiteKey(H,V),this.drawWhiteKey(H+2,this.config.whiteNoteWidth),H+=3,V=2*this.config.whiteNoteWidth);for(let z=this.firstDrawnOctave;z<=this.lastDrawnOctave;z++)for(let z=0;z<this.NOTES_PER_OCTAVE;z++)-1===G.indexOf(z)&&(this.drawWhiteKey(H,V),V+=this.config.whiteNoteWidth),H++;this.config.showOnlyOctavesUsed?(H=this.firstDrawnOctave*this.NOTES_PER_OCTAVE+this.LOW_C,V=-this.config.whiteNoteWidth):(this.drawWhiteKey(H,V),H=this.LOW_C-3,this.drawBlackKey(H+1,z),H+=3,V=this.config.whiteNoteWidth);for(let W=this.firstDrawnOctave;W<=this.lastDrawnOctave;W++)for(let W=0;W<this.NOTES_PER_OCTAVE;W++)-1!==G.indexOf(W)?this.drawBlackKey(H,V+z):V+=this.config.whiteNoteWidth,H++}drawWhiteKey(z,G){const V=document.createElementNS("http://www.w3.org/2000/svg","rect");return V.dataset.pitch=String(z),V.setAttribute("x",String(G)),V.setAttribute("y","0"),V.setAttribute("width",String(this.config.whiteNoteWidth)),V.setAttribute("height",String(this.config.whiteNoteHeight)),V.setAttribute("fill","white"),V.setAttribute("original-fill","white"),V.setAttribute("stroke","black"),V.setAttribute("stroke-width","3px"),V.classList.add("white"),this.svgPiano.appendChild(V),V}drawBlackKey(z,G){const V=document.createElementNS("http://www.w3.org/2000/svg","rect");return V.dataset.pitch=String(z),V.setAttribute("x",String(G)),V.setAttribute("y","0"),V.setAttribute("width",String(this.config.blackNoteWidth)),V.setAttribute("height",String(this.config.blackNoteHeight)),V.setAttribute("fill","black"),V.setAttribute("original-fill","black"),V.setAttribute("stroke","black"),V.setAttribute("stroke-width","3px"),V.classList.add("black"),this.svgPiano.appendChild(V),V}clearActiveNotes(){super.unfillActiveRect(this.svg);const z=this.svgPiano.querySelectorAll("rect.active");for(let G=0;G<z.length;++G){const V=z[G];V.setAttribute("fill",V.getAttribute("original-fill")),V.classList.remove("active")}}}!function(z){z[z.PAGE=0]="PAGE",z[z.NOTE=1]="NOTE",z[z.BAR=2]="BAR"}(pt||(pt={}));class F extends D{constructor(z,G,V={}){super(z,V),(void 0===V.pixelsPerTimeStep||V.pixelsPerTimeStep<=0)&&(this.config.pixelsPerTimeStep=0),this.instruments=V.instruments||[],this.render=new yt.StaffSVGRender(this.getScoreInfo(z),{noteHeight:this.config.noteHeight,noteSpacing:this.config.noteSpacing,pixelsPerTimeStep:this.config.pixelsPerTimeStep,noteRGB:this.config.noteRGB,activeNoteRGB:this.config.activeNoteRGB,defaultKey:V.defaultKey||0,scrollType:V.scrollType||pt.PAGE},G),this.drawnNotes=z.notes.length,this.clear(),this.redraw()}clear(){this.render.clear()}redraw(z,G){this.drawnNotes!==this.noteSequence.notes.length&&(this.render.scoreInfo=this.getScoreInfo(this.noteSequence));const V=z?this.getNoteInfo(z):void 0;return this.render.redraw(V,G)}isNoteInInstruments(z){return void 0===z.instrument||0===this.instruments.length||this.instruments.indexOf(z.instrument)>=0}timeToQuarters(z){const G=z*this.noteSequence.tempos[0].qpm/60;return Math.round(16*G)/16}quantizedStepsToQuarters(z){const G=z/this.noteSequence.quantizationInfo.stepsPerQuarter;return Math.round(16*G)/16}getNoteInfo(z){const G=this.sequenceIsQuantized?this.quantizedStepsToQuarters(z.quantizedStartStep):this.timeToQuarters(z.startTime);return{start:G,length:(this.sequenceIsQuantized?this.quantizedStepsToQuarters(z.quantizedEndStep):this.timeToQuarters(z.endTime))-G,pitch:z.pitch,intensity:z.velocity}}getScoreInfo(z){const G=[];return z.notes.forEach((z=>{this.isNoteInInstruments(z)&&G.push(this.getNoteInfo(z))})),{notes:G,tempos:z.tempos?z.tempos.map((z=>({start:this.timeToQuarters(z.time),qpm:z.qpm}))):[],keySignatures:z.keySignatures?z.keySignatures.map((z=>({start:this.timeToQuarters(z.time),key:z.key}))):[],timeSignatures:z.timeSignatures?z.timeSignatures.map((z=>({start:this.timeToQuarters(z.time),numerator:z.numerator,denominator:z.denominator}))):[]}}clearActiveNotes(){this.redraw()}}},,,,,,,,,,,,function(z,G){function n(z){for(var G,V=new r(z),H=[];!V.eof();){var W=s();H.push(W)}return H;function s(){var z={};z.deltaTime=V.readVarInt();var H=V.readUInt8();if(240==(240&H)){if(255!==H){if(240==H)return z.type="sysEx",K=V.readVarInt(),z.data=V.readBytes(K),z;if(247==H)return z.type="endSysEx",K=V.readVarInt(),z.data=V.readBytes(K),z;throw"Unrecognised MIDI event type byte: "+H}z.meta=!0;var W=V.readUInt8(),K=V.readVarInt();switch(W){case 0:if(z.type="sequenceNumber",2!==K)throw"Expected length for sequenceNumber event is 2, got "+K;return z.number=V.readUInt16(),z;case 1:return z.type="text",z.text=V.readString(K),z;case 2:return z.type="copyrightNotice",z.text=V.readString(K),z;case 3:return z.type="trackName",z.text=V.readString(K),z;case 4:return z.type="instrumentName",z.text=V.readString(K),z;case 5:return z.type="lyrics",z.text=V.readString(K),z;case 6:return z.type="marker",z.text=V.readString(K),z;case 7:return z.type="cuePoint",z.text=V.readString(K),z;case 32:if(z.type="channelPrefix",1!=K)throw"Expected length for channelPrefix event is 1, got "+K;return z.channel=V.readUInt8(),z;case 33:if(z.type="portPrefix",1!=K)throw"Expected length for portPrefix event is 1, got "+K;return z.port=V.readUInt8(),z;case 47:if(z.type="endOfTrack",0!=K)throw"Expected length for endOfTrack event is 0, got "+K;return z;case 81:if(z.type="setTempo",3!=K)throw"Expected length for setTempo event is 3, got "+K;return z.microsecondsPerBeat=V.readUInt24(),z;case 84:if(z.type="smpteOffset",5!=K)throw"Expected length for smpteOffset event is 5, got "+K;var Z=V.readUInt8();return z.frameRate={0:24,32:25,64:29,96:30}[96&Z],z.hour=31&Z,z.min=V.readUInt8(),z.sec=V.readUInt8(),z.frame=V.readUInt8(),z.subFrame=V.readUInt8(),z;case 88:if(z.type="timeSignature",4!=K)throw"Expected length for timeSignature event is 4, got "+K;return z.numerator=V.readUInt8(),z.denominator=1<<V.readUInt8(),z.metronome=V.readUInt8(),z.thirtyseconds=V.readUInt8(),z;case 89:if(z.type="keySignature",2!=K)throw"Expected length for keySignature event is 2, got "+K;return z.key=V.readInt8(),z.scale=V.readUInt8(),z;case 127:return z.type="sequencerSpecific",z.data=V.readBytes(K),z;default:return z.type="unknownMeta",z.data=V.readBytes(K),z.metatypeByte=W,z}}else{var it;if(0==(128&H)){if(null===G)throw"Running status byte encountered before status byte";it=H,H=G,z.running=!0}else it=V.readUInt8(),G=H;var ot=H>>4;switch(z.channel=15&H,ot){case 8:return z.type="noteOff",z.noteNumber=it,z.velocity=V.readUInt8(),z;case 9:var rt=V.readUInt8();return z.type=0===rt?"noteOff":"noteOn",z.noteNumber=it,z.velocity=rt,0===rt&&(z.byte9=!0),z;case 10:return z.type="noteAftertouch",z.noteNumber=it,z.amount=V.readUInt8(),z;case 11:return z.type="controller",z.controllerType=it,z.value=V.readUInt8(),z;case 12:return z.type="programChange",z.programNumber=it,z;case 13:return z.type="channelAftertouch",z.amount=it,z;case 14:return z.type="pitchBend",z.value=it+(V.readUInt8()<<7)-8192,z;default:throw"Unrecognised MIDI event type: "+ot}}}}function r(z){this.buffer=z,this.bufferLen=this.buffer.length,this.pos=0}r.prototype.eof=function(){return this.pos>=this.bufferLen},r.prototype.readUInt8=function(){var z=this.buffer[this.pos];return this.pos+=1,z},r.prototype.readInt8=function(){var z=this.readUInt8();return 128&z?z-256:z},r.prototype.readUInt16=function(){return(this.readUInt8()<<8)+this.readUInt8()},r.prototype.readInt16=function(){var z=this.readUInt16();return 32768&z?z-65536:z},r.prototype.readUInt24=function(){return(this.readUInt8()<<16)+(this.readUInt8()<<8)+this.readUInt8()},r.prototype.readInt24=function(){var z=this.readUInt24();return 8388608&z?z-16777216:z},r.prototype.readUInt32=function(){return(this.readUInt8()<<24)+(this.readUInt8()<<16)+(this.readUInt8()<<8)+this.readUInt8()},r.prototype.readBytes=function(z){var G=this.buffer.slice(this.pos,this.pos+z);return this.pos+=z,G},r.prototype.readString=function(z){var G=this.readBytes(z);return String.fromCharCode.apply(null,G)},r.prototype.readVarInt=function(){for(var z=0;!this.eof();){var G=this.readUInt8();if(!(128&G))return z+G;z+=127&G,z<<=7}return z},r.prototype.readChunk=function(){var z=this.readString(4),G=this.readUInt32();return{id:z,length:G,data:this.readBytes(G)}},z.exports=function(z){var G=new r(z),V=G.readChunk();if("MThd"!=V.id)throw"Bad MIDI file.  Expected 'MHdr', got: '"+V.id+"'";for(var H=function(z){var G=new r(z),V={format:G.readUInt16(),numTracks:G.readUInt16()},H=G.readUInt16();return 32768&H?(V.framesPerSecond=256-(H>>8),V.ticksPerFrame=255&H):V.ticksPerBeat=H,V}(V.data),W=[],K=0;!G.eof()&&K<H.numTracks;K++){var Z=G.readChunk();if("MTrk"!=Z.id)throw"Bad MIDI file.  Expected 'MTrk', got: '"+Z.id+"'";var it=n(Z.data);W.push(it)}return{header:H,tracks:W}}},function(z,G){function n(z,G,V){var H,W=new i,K=G.length,Z=null;for(H=0;H<K;H++)!1!==V.running&&(V.running||G[H].running)||(Z=null),Z=r(W,G[H],Z,V.useByte9ForNoteOff);z.writeChunk("MTrk",W.buffer)}function r(z,G,V,H){var W=G.type,K=G.deltaTime,Z=G.text||"",it=G.data||[],ot=null;switch(z.writeVarInt(K),W){case"sequenceNumber":z.writeUInt8(255),z.writeUInt8(0),z.writeVarInt(2),z.writeUInt16(G.number);break;case"text":z.writeUInt8(255),z.writeUInt8(1),z.writeVarInt(Z.length),z.writeString(Z);break;case"copyrightNotice":z.writeUInt8(255),z.writeUInt8(2),z.writeVarInt(Z.length),z.writeString(Z);break;case"trackName":z.writeUInt8(255),z.writeUInt8(3),z.writeVarInt(Z.length),z.writeString(Z);break;case"instrumentName":z.writeUInt8(255),z.writeUInt8(4),z.writeVarInt(Z.length),z.writeString(Z);break;case"lyrics":z.writeUInt8(255),z.writeUInt8(5),z.writeVarInt(Z.length),z.writeString(Z);break;case"marker":z.writeUInt8(255),z.writeUInt8(6),z.writeVarInt(Z.length),z.writeString(Z);break;case"cuePoint":z.writeUInt8(255),z.writeUInt8(7),z.writeVarInt(Z.length),z.writeString(Z);break;case"channelPrefix":z.writeUInt8(255),z.writeUInt8(32),z.writeVarInt(1),z.writeUInt8(G.channel);break;case"portPrefix":z.writeUInt8(255),z.writeUInt8(33),z.writeVarInt(1),z.writeUInt8(G.port);break;case"endOfTrack":z.writeUInt8(255),z.writeUInt8(47),z.writeVarInt(0);break;case"setTempo":z.writeUInt8(255),z.writeUInt8(81),z.writeVarInt(3),z.writeUInt24(G.microsecondsPerBeat);break;case"smpteOffset":z.writeUInt8(255),z.writeUInt8(84),z.writeVarInt(5);var rt=31&G.hour|{24:0,25:32,29:64,30:96}[G.frameRate];z.writeUInt8(rt),z.writeUInt8(G.min),z.writeUInt8(G.sec),z.writeUInt8(G.frame),z.writeUInt8(G.subFrame);break;case"timeSignature":z.writeUInt8(255),z.writeUInt8(88),z.writeVarInt(4),z.writeUInt8(G.numerator);var at=255&Math.floor(Math.log(G.denominator)/Math.LN2);z.writeUInt8(at),z.writeUInt8(G.metronome),z.writeUInt8(G.thirtyseconds||8);break;case"keySignature":z.writeUInt8(255),z.writeUInt8(89),z.writeVarInt(2),z.writeInt8(G.key),z.writeUInt8(G.scale);break;case"sequencerSpecific":z.writeUInt8(255),z.writeUInt8(127),z.writeVarInt(it.length),z.writeBytes(it);break;case"unknownMeta":null!=G.metatypeByte&&(z.writeUInt8(255),z.writeUInt8(G.metatypeByte),z.writeVarInt(it.length),z.writeBytes(it));break;case"sysEx":z.writeUInt8(240),z.writeVarInt(it.length),z.writeBytes(it);break;case"endSysEx":z.writeUInt8(247),z.writeVarInt(it.length),z.writeBytes(it);break;case"noteOff":(ot=(!1!==H&&G.byte9||H&&0==G.velocity?144:128)|G.channel)!==V&&z.writeUInt8(ot),z.writeUInt8(G.noteNumber),z.writeUInt8(G.velocity);break;case"noteOn":(ot=144|G.channel)!==V&&z.writeUInt8(ot),z.writeUInt8(G.noteNumber),z.writeUInt8(G.velocity);break;case"noteAftertouch":(ot=160|G.channel)!==V&&z.writeUInt8(ot),z.writeUInt8(G.noteNumber),z.writeUInt8(G.amount);break;case"controller":(ot=176|G.channel)!==V&&z.writeUInt8(ot),z.writeUInt8(G.controllerType),z.writeUInt8(G.value);break;case"programChange":(ot=192|G.channel)!==V&&z.writeUInt8(ot),z.writeUInt8(G.programNumber);break;case"channelAftertouch":(ot=208|G.channel)!==V&&z.writeUInt8(ot),z.writeUInt8(G.amount);break;case"pitchBend":(ot=224|G.channel)!==V&&z.writeUInt8(ot);var ut=8192+G.value,lt=127&ut,ct=ut>>7&127;z.writeUInt8(lt),z.writeUInt8(ct);break;default:throw"Unrecognized event type: "+W}return ot}function i(){this.buffer=[]}i.prototype.writeUInt8=function(z){this.buffer.push(255&z)},i.prototype.writeInt8=i.prototype.writeUInt8,i.prototype.writeUInt16=function(z){var G=z>>8&255,V=255&z;this.writeUInt8(G),this.writeUInt8(V)},i.prototype.writeInt16=i.prototype.writeUInt16,i.prototype.writeUInt24=function(z){var G=z>>16&255,V=z>>8&255,H=255&z;this.writeUInt8(G),this.writeUInt8(V),this.writeUInt8(H)},i.prototype.writeInt24=i.prototype.writeUInt24,i.prototype.writeUInt32=function(z){var G=z>>24&255,V=z>>16&255,H=z>>8&255,W=255&z;this.writeUInt8(G),this.writeUInt8(V),this.writeUInt8(H),this.writeUInt8(W)},i.prototype.writeInt32=i.prototype.writeUInt32,i.prototype.writeBytes=function(z){this.buffer=this.buffer.concat(Array.prototype.slice.call(z,0))},i.prototype.writeString=function(z){var G,V=z.length,H=[];for(G=0;G<V;G++)H.push(z.codePointAt(G));this.writeBytes(H)},i.prototype.writeVarInt=function(z){if(z<0)throw"Cannot write negative variable-length integer";if(z<=127)this.writeUInt8(z);else{var G=z,V=[];for(V.push(127&G),G>>=7;G;){var H=127&G|128;V.push(H),G>>=7}this.writeBytes(V.reverse())}},i.prototype.writeChunk=function(z,G){this.writeString(z),this.writeUInt32(G.length),this.writeBytes(G)},z.exports=function(z,G){if("object"!=typeof z)throw"Invalid MIDI data";G=G||{};var V,H=z.header||{},W=z.tracks||[],K=W.length,Z=new i;for(function(z,G,V){var H=null==G.format?1:G.format,W=128;G.timeDivision?W=G.timeDivision:G.ticksPerFrame&&G.framesPerSecond?W=-(255&G.framesPerSecond)<<8|255&G.ticksPerFrame:G.ticksPerBeat&&(W=32767&G.ticksPerBeat);var K=new i;K.writeUInt16(H),K.writeUInt16(V),K.writeUInt16(W),z.writeChunk("MThd",K.buffer)}(Z,H,K),V=0;V<K;V++)n(Z,W[V],G);return Z.buffer}},function(z,G,V){var H=this&&this.__spreadArrays||function(){for(var z=0,G=0,V=arguments.length;G<V;G++)z+=arguments[G].length;var H=Array(z),W=0;for(G=0;G<V;G++)for(var K=arguments[G],Z=0,it=K.length;Z<it;Z++,W++)H[W]=K[Z];return H},W=this&&this.__importDefault||function(z){return z&&z.__esModule?z:{default:z}};Object.defineProperty(G,"__esModule",{value:!0});var K=V(51),Z=V(40),it=W(V(83));function c(z,G){return{absoluteTime:z.ticks,channel:G,controllerType:z.number,deltaTime:0,type:"controller",value:z.value}}function l(z){return{absoluteTime:0,channel:z.channel,deltaTime:0,programNumber:z.instrument.number,type:"programChange"}}G.encode=function(z){var G={header:{format:1,numTracks:z.tracks.length+1,ticksPerBeat:z.header.ppq},tracks:H([H([{absoluteTime:0,deltaTime:0,meta:!0,text:z.header.name,type:"trackName"}],z.header.keySignatures.map((function(z){return function(z){var G=Z.keySignatureKeys.indexOf(z.key);return{absoluteTime:z.ticks,deltaTime:0,key:G+7,meta:!0,scale:"major"===z.scale?0:1,type:"keySignature"}}(z)})),z.header.meta.map((function(z){return{absoluteTime:(G=z).ticks,deltaTime:0,meta:!0,text:G.text,type:G.type};var G})),z.header.tempos.map((function(z){return function(z){return{absoluteTime:z.ticks,deltaTime:0,meta:!0,microsecondsPerBeat:Math.floor(6e7/z.bpm),type:"setTempo"}}(z)})),z.header.timeSignatures.map((function(z){return function(z){return{absoluteTime:z.ticks,deltaTime:0,denominator:z.timeSignature[1],meta:!0,metronome:24,numerator:z.timeSignature[0],thirtyseconds:8,type:"timeSignature"}}(z)})))],z.tracks.map((function(z){return H([(G=z.name,{absoluteTime:0,deltaTime:0,meta:!0,text:G,type:"trackName"}),l(z)],function u(z){return it.default(z.notes.map((function(G){return function(z,G){return[{absoluteTime:z.ticks,channel:G,deltaTime:0,noteNumber:z.midi,type:"noteOn",velocity:Math.floor(127*z.velocity)},{absoluteTime:z.ticks+z.durationTicks,channel:G,deltaTime:0,noteNumber:z.midi,type:"noteOff",velocity:Math.floor(127*z.noteOffVelocity)}]}(G,z.channel)})))}(z),function(z){for(var G=[],V=0;V<127;V++)z.controlChanges.hasOwnProperty(V)&&z.controlChanges[V].forEach((function(V){G.push(c(V,z.channel))}));return G}(z),function(z){var G=[];return z.pitchBends.forEach((function(V){G.push(function(z,G){return{absoluteTime:z.ticks,channel:G,deltaTime:0,type:"pitchBend",value:z.value}}(V,z.channel))})),G}(z));var G})))};return G.tracks=G.tracks.map((function(z){z=z.sort((function(z,G){return z.absoluteTime-G.absoluteTime}));var G=0;return z.forEach((function(z){z.deltaTime=z.absoluteTime-G,G=z.absoluteTime,delete z.absoluteTime})),z.push({deltaTime:0,meta:!0,type:"endOfTrack"}),z})),new Uint8Array(K.writeMidi(G))}},function(z,G,V){function r(z){return function t(z,G){for(var V=0;V<z.length;V++){var H=z[V];Array.isArray(H)?t(H,G):G.push(H)}return G}(z,[])}function i(z,G){if("number"!=typeof G)throw new TypeError("Expected the depth to be a number");return function t(z,G,V){V--;for(var H=0;H<z.length;H++){var W=z[H];V>-1&&Array.isArray(W)?t(W,G,V):G.push(W)}return G}(z,[],G)}z.exports=function(z){if(!Array.isArray(z))throw new TypeError("Expected value to be an array");return r(z)},z.exports.from=r,z.exports.depth=function(z,G){if(!Array.isArray(z))throw new TypeError("Expected value to be an array");return i(z,G)},z.exports.fromDepth=i},function(z,G,V){Object.defineProperty(G,"__esModule",{value:!0});var H=V(54);G.createControlChanges=function(){return new Proxy({},{get:function(z,G){return z[G]?z[G]:H.controlChangeIds.hasOwnProperty(G)?z[H.controlChangeIds[G]]:void 0},set:function(z,G,V){return H.controlChangeIds.hasOwnProperty(G)?z[H.controlChangeIds[G]]=V:z[G]=V,!0}})}},function(z,G,V){Object.defineProperty(G,"__esModule",{value:!0});var H=new WeakMap,W=function(){function t(z,G){H.set(this,G),this.ticks=z.absoluteTime,this.value=z.value}return Object.defineProperty(t.prototype,"time",{get:function(){return H.get(this).ticksToSeconds(this.ticks)},set:function(z){var G=H.get(this);this.ticks=G.secondsToTicks(z)},enumerable:!0,configurable:!0}),t.prototype.toJSON=function(){return{ticks:this.ticks,time:this.time,value:this.value}},t}();G.PitchBend=W},function(z,G,V){Object.defineProperty(G,"__esModule",{value:!0});var H=V(87),W=new WeakMap,K=function(){function t(z,G){if(this.number=0,W.set(this,G),this.number=0,z){var V=z.find((function(z){return"programChange"===z.type}));V&&(this.number=V.programNumber)}}return Object.defineProperty(t.prototype,"name",{get:function(){return this.percussion?H.DrumKitByPatchID[this.number]:H.instrumentByPatchID[this.number]},set:function(z){var G=H.instrumentByPatchID.indexOf(z);-1!==G&&(this.number=G)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"family",{get:function(){return this.percussion?"drums":H.InstrumentFamilyByID[Math.floor(this.number/8)]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"percussion",{get:function(){return 9===W.get(this).channel},enumerable:!0,configurable:!0}),t.prototype.toJSON=function(){return{family:this.family,name:this.name,number:this.number}},t.prototype.fromJSON=function(z){this.number=z.number},t}();G.Instrument=K},function(z,G,V){Object.defineProperty(G,"__esModule",{value:!0}),G.instrumentByPatchID=["acoustic grand piano","bright acoustic piano","electric grand piano","honky-tonk piano","electric piano 1","electric piano 2","harpsichord","clavi","celesta","glockenspiel","music box","vibraphone","marimba","xylophone","tubular bells","dulcimer","drawbar organ","percussive organ","rock organ","church organ","reed organ","accordion","harmonica","tango accordion","acoustic guitar (nylon)","acoustic guitar (steel)","electric guitar (jazz)","electric guitar (clean)","electric guitar (muted)","overdriven guitar","distortion guitar","guitar harmonics","acoustic bass","electric bass (finger)","electric bass (pick)","fretless bass","slap bass 1","slap bass 2","synth bass 1","synth bass 2","violin","viola","cello","contrabass","tremolo strings","pizzicato strings","orchestral harp","timpani","string ensemble 1","string ensemble 2","synthstrings 1","synthstrings 2","choir aahs","voice oohs","synth voice","orchestra hit","trumpet","trombone","tuba","muted trumpet","french horn","brass section","synthbrass 1","synthbrass 2","soprano sax","alto sax","tenor sax","baritone sax","oboe","english horn","bassoon","clarinet","piccolo","flute","recorder","pan flute","blown bottle","shakuhachi","whistle","ocarina","lead 1 (square)","lead 2 (sawtooth)","lead 3 (calliope)","lead 4 (chiff)","lead 5 (charang)","lead 6 (voice)","lead 7 (fifths)","lead 8 (bass + lead)","pad 1 (new age)","pad 2 (warm)","pad 3 (polysynth)","pad 4 (choir)","pad 5 (bowed)","pad 6 (metallic)","pad 7 (halo)","pad 8 (sweep)","fx 1 (rain)","fx 2 (soundtrack)","fx 3 (crystal)","fx 4 (atmosphere)","fx 5 (brightness)","fx 6 (goblins)","fx 7 (echoes)","fx 8 (sci-fi)","sitar","banjo","shamisen","koto","kalimba","bag pipe","fiddle","shanai","tinkle bell","agogo","steel drums","woodblock","taiko drum","melodic tom","synth drum","reverse cymbal","guitar fret noise","breath noise","seashore","bird tweet","telephone ring","helicopter","applause","gunshot"],G.InstrumentFamilyByID=["piano","chromatic percussion","organ","guitar","bass","strings","ensemble","brass","reed","pipe","synth lead","synth pad","synth effects","world","percussive","sound effects"],G.DrumKitByPatchID={0:"standard kit",8:"room kit",16:"power kit",24:"electronic kit",25:"tr-808 kit",32:"jazz kit",40:"brush kit",48:"orchestra kit",56:"sound fx kit"}},function(z,G,V){function r(z){return["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"][z%12]}Object.defineProperty(G,"__esModule",{value:!0});var H,W,K=(H=/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i,W={cbb:-2,cb:-1,c:0,"c#":1,cx:2,dbb:0,db:1,d:2,"d#":3,dx:4,ebb:2,eb:3,e:4,"e#":5,ex:6,fbb:3,fb:4,f:5,"f#":6,fx:7,gbb:5,gb:6,g:7,"g#":8,gx:9,abb:7,ab:8,a:9,"a#":10,ax:11,bbb:9,bb:10,b:11,"b#":12,bx:13},function(z){var G=H.exec(z),V=G[1],K=G[2];return W[V.toLowerCase()]+12*(parseInt(K,10)+1)}),Z=new WeakMap,it=function(){function t(z,G,V){Z.set(this,V),this.midi=z.midi,this.velocity=z.velocity,this.noteOffVelocity=G.velocity,this.ticks=z.ticks,this.durationTicks=G.ticks-z.ticks}return Object.defineProperty(t.prototype,"name",{get:function(){return z=this.midi,G=Math.floor(z/12)-1,r(z)+G.toString();var z,G},set:function(z){this.midi=K(z)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"octave",{get:function(){return Math.floor(this.midi/12)-1},set:function(z){var G=z-this.octave;this.midi+=12*G},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pitch",{get:function(){return r(this.midi)},set:function(z){this.midi=12*(this.octave+1)+["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"].indexOf(z)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"duration",{get:function(){var z=Z.get(this);return z.ticksToSeconds(this.ticks+this.durationTicks)-z.ticksToSeconds(this.ticks)},set:function(z){var G=Z.get(this).secondsToTicks(this.time+z);this.durationTicks=G-this.ticks},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"time",{get:function(){return Z.get(this).ticksToSeconds(this.ticks)},set:function(z){var G=Z.get(this);this.ticks=G.secondsToTicks(z)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bars",{get:function(){return Z.get(this).ticksToMeasures(this.ticks)},enumerable:!0,configurable:!0}),t.prototype.toJSON=function(){return{duration:this.duration,durationTicks:this.durationTicks,midi:this.midi,name:this.name,ticks:this.ticks,time:this.time,velocity:this.velocity}},t}();G.Note=it}])})),function(z,G){"object"==typeof exports&&"undefined"!=typeof module?G():"function"==typeof define&&define.amd?define(G):G()}(0,(function(){function e(z){var G=!0,V=!1,H=null,W={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function i(z){return!!(z&&z!==document&&"HTML"!==z.nodeName&&"BODY"!==z.nodeName&&"classList"in z&&"contains"in z.classList)}function s(z){z.classList.contains("focus-visible")||(z.classList.add("focus-visible"),z.setAttribute("data-focus-visible-added",""))}function u(z){G=!1}function a(){document.addEventListener("mousemove",c),document.addEventListener("mousedown",c),document.addEventListener("mouseup",c),document.addEventListener("pointermove",c),document.addEventListener("pointerdown",c),document.addEventListener("pointerup",c),document.addEventListener("touchmove",c),document.addEventListener("touchstart",c),document.addEventListener("touchend",c)}function c(z){z.target.nodeName&&"html"===z.target.nodeName.toLowerCase()||(G=!1,document.removeEventListener("mousemove",c),document.removeEventListener("mousedown",c),document.removeEventListener("mouseup",c),document.removeEventListener("pointermove",c),document.removeEventListener("pointerdown",c),document.removeEventListener("pointerup",c),document.removeEventListener("touchmove",c),document.removeEventListener("touchstart",c),document.removeEventListener("touchend",c))}document.addEventListener("keydown",(function(V){V.metaKey||V.altKey||V.ctrlKey||(i(z.activeElement)&&s(z.activeElement),G=!0)}),!0),document.addEventListener("mousedown",u,!0),document.addEventListener("pointerdown",u,!0),document.addEventListener("touchstart",u,!0),document.addEventListener("visibilitychange",(function(z){"hidden"===document.visibilityState&&(V&&(G=!0),a())}),!0),a(),z.addEventListener("focus",(function(z){var V,H,K;i(z.target)&&(G||(H=(V=z.target).type,"INPUT"===(K=V.tagName)&&W[H]&&!V.readOnly||"TEXTAREA"===K&&!V.readOnly||V.isContentEditable))&&s(z.target)}),!0),z.addEventListener("blur",(function(z){var G;i(z.target)&&(z.target.classList.contains("focus-visible")||z.target.hasAttribute("data-focus-visible-added"))&&(V=!0,window.clearTimeout(H),H=window.setTimeout((function(){V=!1}),100),(G=z.target).hasAttribute("data-focus-visible-added")&&(G.classList.remove("focus-visible"),G.removeAttribute("data-focus-visible-added")))}),!0),z.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&z.host?z.host.setAttribute("data-js-focus-visible",""):z.nodeType===Node.DOCUMENT_NODE&&(document.documentElement.classList.add("js-focus-visible"),document.documentElement.setAttribute("data-js-focus-visible",""))}if("undefined"!=typeof window&&"undefined"!=typeof document){var z;window.applyFocusVisiblePolyfill=e;try{z=new CustomEvent("focus-visible-polyfill-ready")}catch(e){(z=document.createEvent("CustomEvent")).initCustomEvent("focus-visible-polyfill-ready",!1,!1,{})}window.dispatchEvent(z)}"undefined"!=typeof document&&e(document)})),function(z,G){"object"==typeof exports&&"undefined"!=typeof module?G(exports,require("@magenta/music/es6/core")):"function"==typeof define&&define.amd?define(["exports","@magenta/music/es6/core"],G):G((z="undefined"!=typeof globalThis?globalThis:z||self).midiPlayer={},z.core)}(this,(function(z,G){function i(z,G,V,H,W,K,Z){try{var it=z[K](Z),ot=it.value}catch(z){return void V(z)}it.done?G(ot):Promise.resolve(ot).then(H,W)}function n(z){return function(){var G=this,V=arguments;return new Promise((function(H,W){var K=z.apply(G,V);function o(z){i(K,H,W,o,l,"next",z)}function l(z){i(K,H,W,o,l,"throw",z)}o(void 0)}))}}var V=document.createElement("template");function r(z){var G=z<0,V=(z=Math.floor(Math.abs(z||0)))%60,H=(z-V)/60,W=(z-V-60*H)/3600,K=V>9?"".concat(V):"0".concat(V),Z=H>9||!W?"".concat(H,":"):"0".concat(H,":");return(G?"-":"")+(W?"".concat(W,":"):"")+Z+K}V.innerHTML="\n<style>\n".concat(":host {\n  display: inline-block;\n  width: 300px;\n  margin: 3px;\n  vertical-align: bottom;\n  font-family: sans-serif;\n  font-size: 14px;\n}\n\n:focus:not(.focus-visible) {\n  outline: none;\n}\n\n.controls {\n  width: inherit;\n  height: inherit;\n  display: flex;\n  flex-direction: row;\n  align-items: center;\n  border-radius: 100px;\n  background: #f2f5f6;\n  padding: 0 0.2rem;\n  user-select: none;\n}\n.controls > * {\n  margin: 0.7rem 0.4rem;\n}\n.controls input, .controls button {\n  cursor: pointer;\n}\n.controls input:disabled, .controls button:disabled {\n  cursor: inherit;\n}\n.controls button {\n  text-align: center;\n  background: rgba(204, 204, 204, 0);\n  border: none;\n  width: 32px;\n  height: 32px;\n  border-radius: 100%;\n  transition: background-color 0.25s ease 0s;\n  padding: 0;\n}\n.controls button:not(:disabled):hover {\n  background: rgba(204, 204, 204, 0.3);\n}\n.controls button:active {\n  background: rgba(204, 204, 204, 0.6);\n}\n.controls .seek-bar {\n  flex: 1;\n  min-width: 0;\n  margin-right: 1rem;\n  background: transparent;\n}\n.controls .seek-bar::-moz-range-track {\n  background-color: #555;\n}\n.controls.playing .play-icon, .controls.stopped .stop-icon {\n  display: none;\n}\n.controls.frozen > div, .controls > button:disabled .icon {\n  opacity: 0.5;\n}",'\n</style>\n<div class="controls stopped frozen" part="control-panel">\n  <button class="play" part="play-button" disabled>\n    <img src="').concat("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20version%3D%221.1%22%20viewBox%3D%220%200%206.35%206.35%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%20%3Cpath%20d%3D%22m4.4979%203.175-2.1167%201.5875v-3.175z%22%20stroke-width%3D%22.70201%22%2F%3E%3C%2Fsvg%3E",'" class="icon play-icon">\n    <img src="').concat("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20version%3D%221.1%22%20viewBox%3D%220%200%206.35%206.35%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%20%3Cpath%20d%3D%22m1.5875%201.5875h3.175v3.175h-3.175z%22%20stroke-width%3D%22.75001%22%2F%3E%3C%2Fsvg%3E",'" class="icon stop-icon">\n  </button>\n  <div part="time"><span class="current-time" part="current-time">0:00</span> / <span class="total-time" part="total-time">0:00</span></div>\n  <input type="range" min="0" max="0" value="0" step="any" class="seek-bar" part="seek-bar" disabled>\n</div>\n');var H=["piano-roll","waterfall","staff"];class o extends HTMLElement{constructor(){super(...arguments),this.domInitialized=!1,this.ns=null,this._config={}}static get observedAttributes(){return["src","type"]}connectedCallback(){this.domInitialized||(this.domInitialized=!0,this.wrapper=document.createElement("div"),this.appendChild(this.wrapper),this.initVisualizerNow())}attributeChangedCallback(z,G,V){"src"!==z&&"type"!==z||this.initVisualizer()}initVisualizer(){null==this.initTimeout&&(this.initTimeout=window.setTimeout((()=>this.initVisualizerNow())))}initVisualizerNow(){var z=this;return n((function*(){if(z.initTimeout=null,z.domInitialized&&(z.src&&(z.ns=null,z.ns=yield G.urlToNoteSequence(z.src)),z.wrapper.innerHTML="",z.ns))if("piano-roll"===z.type){z.wrapper.classList.add("piano-roll-visualizer");var V=document.createElementNS("http://www.w3.org/2000/svg","svg");z.wrapper.appendChild(V),z.visualizer=new G.PianoRollSVGVisualizer(z.ns,V,z._config)}else if("waterfall"===z.type)z.wrapper.classList.add("waterfall-visualizer"),z.visualizer=new G.WaterfallSVGVisualizer(z.ns,z.wrapper,z._config);else if("staff"===z.type){z.wrapper.classList.add("staff-visualizer");var H=document.createElement("div");z.wrapper.appendChild(H),z.visualizer=new G.StaffSVGVisualizer(z.ns,H,z._config)}}))()}redraw(z){this.visualizer&&this.visualizer.redraw(z,null!=z)}clearActiveNotes(){this.visualizer&&this.visualizer.clearActiveNotes()}get noteSequence(){return this.ns}set noteSequence(z){this.ns=z,this.removeAttribute("src"),this.initVisualizer()}get src(){return this.getAttribute("src")}set src(z){this.ns=null,this.setOrRemoveAttribute("src",z),this.initVisualizer()}get type(){var z=this.getAttribute("type");return H.indexOf(z)<0&&(z="piano-roll"),z}set type(z){if(null!=z&&H.indexOf(z)<0)throw new Error("Unknown visualizer type ".concat(z,". Allowed values: ").concat(H.join(", ")));this.setOrRemoveAttribute("type",z)}get config(){return this._config}set config(z){this._config=z,this.initVisualizer()}setOrRemoveAttribute(z,G){null==G?this.removeAttribute(z):this.setAttribute(z,G)}}var W=["start","stop","note"],K=null;class c extends HTMLElement{constructor(){super(),this.domInitialized=!1,this.needInitNs=!1,this.visualizerListeners=new Map,this.ns=null,this._playing=!1,this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(V.content.cloneNode(!0)),this.controlPanel=this.shadowRoot.querySelector(".controls"),this.playButton=this.controlPanel.querySelector(".play"),this.currentTimeLabel=this.controlPanel.querySelector(".current-time"),this.totalTimeLabel=this.controlPanel.querySelector(".total-time"),this.seekBar=this.controlPanel.querySelector(".seek-bar")}static get observedAttributes(){return["sound-font","src","visualizer"]}connectedCallback(){if(!this.domInitialized){this.domInitialized=!0;var z=window.applyFocusVisiblePolyfill;null!=z&&z(this.shadowRoot),this.playButton.addEventListener("click",(()=>{this.player.isPlaying()?this.stop():this.start()})),this.seekBar.addEventListener("input",(()=>{this.player&&"started"===this.player.getPlayState()&&this.player.pause()})),this.seekBar.addEventListener("change",(()=>{var z=this.currentTime;this.currentTimeLabel.textContent=r(z),this.player&&this.player.isPlaying()&&(this.player.seekTo(z),"paused"===this.player.getPlayState()&&this.player.resume())})),this.initPlayerNow()}}attributeChangedCallback(z,G,V){if(this.hasAttribute(z)||(V=null),"sound-font"===z||"src"===z)this.initPlayer();else if("visualizer"===z){var n=()=>{this.setVisualizerSelector(V)};"loading"===document.readyState?window.addEventListener("DOMContentLoaded",n):n()}}initPlayer(z=!0){this.needInitNs=this.needInitNs||z,null==this.initTimeout&&(this.stop(),this.freeze(),this.initTimeout=window.setTimeout((()=>this.initPlayerNow(this.needInitNs))))}initPlayerNow(z=!0){var V=this;return n((function*(){if(V.initTimeout=null,V.needInitNs=!1,V.domInitialized){var H;if(z&&(V.src&&(V.ns=null,V.ns=yield G.urlToNoteSequence(V.src)),V.currentTime=0),!(H=V.ns))return V.seekBar.max="0",void(V.totalTimeLabel.textContent=r(0));V.seekBar.max=String(H.totalTime),V.totalTimeLabel.textContent=r(H.totalTime);var W=V.soundFont,K={run:z=>V.ns===H&&V.noteCallback(z),stop:()=>{}};null===W?V.player=new G.Player(!1,K):(""===W&&(W="https://storage.googleapis.com/magentadata/js/soundfonts/sgm_plus"),V.player=new G.SoundFontPlayer(W,void 0,void 0,void 0,K),yield V.player.loadSamples(H)),V.ns===H&&(V.unfreeze(),V.dispatchEvent(new CustomEvent("load")))}}))()}start(){var z=this;n((function*(){if(z.player)if("stopped"==z.player.getPlayState()){K&&K.playing&&K.stop(),K=z,z._playing=!0,z.controlPanel.classList.remove("stopped"),z.controlPanel.classList.add("playing");try{var G=z.player.start(z.ns);z.dispatchEvent(new CustomEvent("start")),yield G,z.handleStop(!0)}catch(G){throw z.handleStop(),G}}else"paused"==z.player.getPlayState()&&z.player.resume()}))()}stop(){this.player&&this.player.isPlaying()&&this.player.stop(),this.handleStop(!1)}addVisualizer(z){var G={start:()=>{z.noteSequence=this.noteSequence},stop:()=>{z.clearActiveNotes()},note:G=>{z.redraw(G.detail.note)}};for(var V of W)this.addEventListener(V,G[V]);this.visualizerListeners.set(z,G)}removeVisualizer(z){var G=this.visualizerListeners.get(z);for(var V of W)this.removeEventListener(V,G[V]);this.visualizerListeners.delete(z)}noteCallback(z){this.playing&&(this.dispatchEvent(new CustomEvent("note",{detail:{note:z}})),this.seekBar.value=String(z.startTime),this.currentTimeLabel.textContent=r(z.startTime))}handleStop(z=!1){z&&(this.currentTime=this.duration),this.controlPanel.classList.remove("playing"),this.controlPanel.classList.add("stopped"),this._playing&&(this._playing=!1,this.dispatchEvent(new CustomEvent("stop",{detail:{finished:z}})))}setVisualizerSelector(z){for(var G of this.visualizerListeners.values())for(var V of W)this.removeEventListener(V,G[V]);if(this.visualizerListeners.clear(),null!=z)for(var H of document.querySelectorAll(z))H instanceof o?this.addVisualizer(H):console.warn("Selector ".concat(z," matched non-visualizer element"),H)}freeze(){this.playButton.disabled=!0,this.seekBar.disabled=!0,this.controlPanel.classList.add("frozen")}unfreeze(){this.controlPanel.classList.remove("frozen"),this.playButton.disabled=!1,this.seekBar.disabled=!1}get noteSequence(){return this.ns}set noteSequence(z){this.ns=z,this.removeAttribute("src"),this.initPlayer()}get src(){return this.getAttribute("src")}set src(z){this.ns=null,this.setOrRemoveAttribute("src",z),this.initPlayer()}get soundFont(){return this.getAttribute("sound-font")}set soundFont(z){this.setOrRemoveAttribute("sound-font",z)}get currentTime(){return parseFloat(this.seekBar.value)}set currentTime(z){this.seekBar.value=String(z),this.currentTimeLabel.textContent=r(this.currentTime),this.player&&this.player.isPlaying()&&this.player.seekTo(z)}get duration(){return parseFloat(this.seekBar.max)}get playing(){return this._playing}setOrRemoveAttribute(z,G){null==G?this.removeAttribute(z):this.setAttribute(z,G)}}window.customElements.define("midi-player",c),window.customElements.define("midi-visualizer",o),z.PlayerElement=c,z.VisualizerElement=o,Object.defineProperty(z,"__esModule",{value:!0})}));