diff --git a/assets/index-e94ee3e0.js b/assets/index-3e0c94d7.js similarity index 93% rename from assets/index-e94ee3e0.js rename to assets/index-3e0c94d7.js index a9985e8..305034c 100644 --- a/assets/index-e94ee3e0.js +++ b/assets/index-3e0c94d7.js @@ -185,7 +185,7 @@ mod(.5) :: snd('arpy').note( constructor(\${params}) { \${} } -}`,{label:"class",detail:"definition",type:"keyword"}),Sn('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Sn('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],DS=new sC,GC=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ls(n){return(e,t)=>{let r=e.node.getChild("VariableDefinition");return r&&t(r,n),!0}}const Hw=["FunctionDeclaration"],zw={FunctionDeclaration:Ls("function"),ClassDeclaration:Ls("class"),ClassExpression:()=>!0,EnumDeclaration:Ls("constant"),TypeAliasDeclaration:Ls("type"),NamespaceDeclaration:Ls("namespace"),VariableDefinition(n,e){n.matchContext(Hw)||e(n,"variable")},TypeDefinition(n,e){e(n,"type")},__proto__:null};function $C(n,e){let t=DS.get(e);if(t)return t;let r=[],i=!0;function a(s,o){let l=n.sliceString(s.from,s.to);r.push({label:l,type:o})}return e.cursor(Rt.IncludeAnonymous).iterate(s=>{if(i)i=!1;else if(s.name){let o=zw[s.name];if(o&&o(s,a)||GC.has(s.name))return!1}else if(s.to-s.from>8192){for(let o of $C(n,s.node))r.push(o);return!1}}),DS.set(e,r),r}const xS=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,QC=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function Ww(n){let e=Mt(n.state).resolveInner(n.pos,-1);if(QC.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&xS.test(n.state.sliceDoc(e.from,e.to));if(!t&&!n.explicit)return null;let r=[];for(let i=e;i;i=i.parent)GC.has(i.name)&&(r=r.concat($C(n.state.doc,i)));return{options:r,from:t?e.from:n.pos,validFor:xS}}const ai=is.define({name:"javascript",parser:c0.configure({props:[Yo.add({IfStatement:xl({except:/^\s*({|else\b)/}),TryStatement:xl({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:E0,SwitchBody:n=>{let e=n.textAfter,t=/^\s*\}/.test(e),r=/^\s*(case|default)\b/.test(e);return n.baseIndent+(t?0:r?1:2)*n.unit},Block:O0({closing:"}"}),ArrowFunction:n=>n.baseIndent+n.unit,"TemplateString BlockComment":()=>null,"Statement Property":xl({except:/^{/}),JSXElement(n){let e=/^\s*<\//.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},JSXEscape(n){let e=/\s*\}/.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},"JSXOpenTag JSXSelfClosingTag"(n){return n.column(n.node.from)+n.unit}}),Go.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":SC,BlockComment(n){return{from:n.from+2,to:n.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),qC={test:n=>/^JSX/.test(n.name),facet:Wm({commentTokens:{block:{open:"{/*",close:"*/}"}}})},VC=ai.configure({dialect:"ts"},"typescript"),HC=ai.configure({dialect:"jsx",props:[Xm.add(n=>n.isTop?[qC]:void 0)]}),zC=ai.configure({dialect:"jsx ts",props:[Xm.add(n=>n.isTop?[qC]:void 0)]},"typescript"),Xw="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(n=>({label:n,type:"keyword"}));function em(n={}){let e=n.jsx?n.typescript?zC:HC:n.typescript?VC:ai;return new _o(e,[ai.data.of({autocomplete:J0(QC,NC(Vw.concat(Xw)))}),ai.data.of({autocomplete:Ww}),n.jsx?Jw:[]])}function Zw(n){for(;;){if(n.name=="JSXOpenTag"||n.name=="JSXSelfClosingTag"||n.name=="JSXFragmentTag")return n;if(n.name=="JSXEscape"||!n.parent)return null;n=n.parent}}function kS(n,e,t=n.length){for(let r=e==null?void 0:e.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return n.sliceString(r.from,Math.min(r.to,t));return""}function Kw(n){return n&&(n.name=="JSXEndTag"||n.name=="JSXSelfCloseEndTag")}const jw=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Jw=Pe.inputHandler.of((n,e,t,r)=>{if((jw?n.composing:n.compositionStarted)||n.state.readOnly||e!=t||r!=">"&&r!="/"||!ai.isActiveAt(n.state,e,-1))return!1;let{state:i}=n,a=i.changeByRange(s=>{var o;let{head:l}=s,c=Mt(i).resolveInner(l,-1),d;if(c.name=="JSXStartTag"&&(c=c.parent),!(c.name=="JSXAttributeValue"&&c.to>l)){if(r==">"&&c.name=="JSXFragmentTag")return{range:fe.cursor(l+1),changes:{from:l,insert:">"}};if(r=="/"&&c.name=="JSXFragmentTag"){let p=c.parent,m=p==null?void 0:p.parent;if(p.from==l-1&&((o=m.lastChild)===null||o===void 0?void 0:o.name)!="JSXEndTag"&&(d=kS(i.doc,m==null?void 0:m.firstChild,l))){let _=`/${d}>`;return{range:fe.cursor(l+_.length),changes:{from:l,insert:_}}}}else if(r==">"){let p=Zw(c);if(p&&!Kw(p.lastChild)&&i.sliceDoc(l,l+2)!="`}}}}return{range:s}});return a.changes.empty?!1:(n.dispatch(a,{userEvent:"input.type",scrollIntoView:!0}),!0)}),LS={odds:{name:"odds",category:"patterns",description:"returns true for every n (odds) in given seconds (sec)",example:"odds(1, 2) // true every 2 seconds"},seed:{name:"seed",category:"randomness",description:"Seed the random generator",example:"seed(1234)"},delayr:{name:"delayr",category:"time",description:"Delay a function n times by t ms",example:"delayr(50, 3, () => mod(1) :: log('delayed'))"},toss:{name:"toss",category:"randomness",description:"Toss a coin, true or false",example:"toss() : log('heads')"},attack:{name:"attack",category:"synthesis",description:"ADSR envelope attack time (in seconds)",example:"sound('sawtooth').attack(.5).out()"},decay:{name:"decay",category:"synthesis",description:"ADSR envelope decay time (in seconds)",example:"sound('sawtooth').decay(.5).out()"},sustain:{name:"sustain",category:"synthesis",description:"ADSR envelope sustain level (0-1)",example:"sound('sawtooth').sustain(.5).out()"},release:{name:"release",category:"synthesis",description:"ADSR envelope release time (in seconds)",example:"sound('sawtooth').release(.5).out()"},fmwave:{name:"fmwave",category:"synthesis",description:"FM synth modulator waveform",example:"sound('fm').fmwave('sine').out()"},fmi:{name:"fmi",category:"audio",description:"FM synth modulator index",example:"sound('fm').fmi([1,2].beat()).out()"},fmh:{name:"fmh",category:"audio",description:"FM synth modulator ratio",example:"sound('fm').fmi(2).fmh(2).out()"},fmattack:{name:"fmattack",category:"synthesis",description:"FM synth modulator ADSR envelope attack time (in seconds)",example:"sound('sine').fmi(2).fmattack(.5).out()"},fmdecay:{name:"fmdecay",category:"synthesis",description:"FM synth modulator ADSR envelope decay time (in seconds)",example:"sound('sine').fmi(2).fmdecay(.5).out()"},fmsustain:{name:"fmsustain",category:"synthesis",description:"FM synth modulator ADSR envelope sustain level (0-1)",example:"sound('sine').fmi(2).fmsustain(.5).out()"},fmrelease:{name:"fmrelease",category:"synthesis",description:"FM synth modulator ADSR envelope release time (in seconds)",example:"sound('sine').fmi(2).fmrelease(.5).out()"},repeatAll:{name:"repeatAll",category:"patterns",description:"Repeat every array elements n times",example:"[0,1,2,3].repeatAll(2)"},quant:{name:"quant",category:"functions",description:"Quantize a value in the given array",example:"quant(30, [0,1,2,3])"},log:{name:"log",category:"javascript",description:"Log a value in the console",example:"log('Hello, world')"},div:{name:"div",category:"patterns",description:"Returns next value every n beats or true and false alternatively",example:"div(4, 50) // 2 beats of true, 2 beats of false, 50/50."},n:{name:"n",category:"audio",description:"Sample number or synth oscillator partials count",example:"sound('dr').n([1,2].beat()).out()"},note:{name:"note",category:"patterns",description:"MIDI note number (0-127)",example:"sound('jvbass').note(50).out()"},vel:{name:"vel",category:"audio",description:"Velocity or sound volume (0-1)",example:"sound('cp').vel(.5).out()"},palindrome:{name:"palindrome",category:"patterns",description:"Returns palindrome of the current array",example:"[0,1,2,3].palindrome()"},cutoff:{name:"cutoff",category:"filter",description:"Lowpass filter cutoff frequency",example:"sound('cp').cutoff(1000).out()"},resonance:{name:"resonance",category:"filter",description:"Lowpass filter resonance",example:"sound('cp').resonance(1).out()"},hcutoff:{name:"hcutoff",category:"filter",description:"Highpass filter cutoff frequency",example:"sound('cp').hcutoff(1000).out()"},hresonance:{name:"hresonance",category:"filter",description:"Highpass filter resonance",example:"sound('cp').hresonance(1).out()"},bandf:{name:"bandf",category:"filter",description:"Bandpass filter cutoff frequency",example:"sound('cp').bandf(1000).out()"},bandq:{name:"bandq",category:"filter",description:"Bandpass filter resonance",example:"sound('cp').bandq(1).out()"},vowel:{name:"vowel",category:"filter",description:"Vowel filter type",example:"sound('cp').vowel('a').out()"},coarse:{name:"coarse",category:"synthesis",description:"Artificial sample-rate lowering",example:"mod(.5)::snd('pad').coarse($(1) % 16).clip(.5).out();"},crush:{name:"crush",category:"synthesis",description:"Bitcrushing effect. 1 is extreme, superior values are more subtle.",example:""},speed:{name:"speed",category:"sampling",description:"Sample playback speed",example:"sound('cp').speed(.5).out()"},shape:{name:"shape",category:"synthesis",description:"Waveshaping distorsion",example:"sound('cp').shape(.5).out()"},delay:{name:"delay",category:"effect",description:"Delay effect dry/wet",example:"sound('cp').delay(.5).out()"},delayfb:{name:"delayfb",category:"effect",description:"Delay effect feedback amount (0-1)",example:"sound('cp').delay(0.2).delayfb(.5).out()"},delaytime:{name:"delaytime",category:"effect",description:"Delay effect delay time (in seconds)",example:"sound('cp').delay(0.2).delaytime(.5).out()"},gain:{name:"gain",category:"audio",description:"Playback volume",example:"sound('cp').gain(.5).out()"},bar:{name:"bar",category:"patterns",description:"Returns list index for the current bar (with wrapping)",example:"[0,1,2,3].bar()"},beat:{name:"beat",category:"patterns",description:"Returns list index for the current beat (with wrapping)",example:"[0,1,2,3].beat()"},room:{name:"room",category:"effect",description:"Reverb effect room amount",example:"sound('cp').room(.5).out()"},size:{name:"size",category:"effect",description:"Reverb effect room size",example:"sound('cp').size(.5).out()"},usine:{name:"usine",category:"modulation",description:"Unipolar sinusoïdal low-frequency oscillator",example:"usine(5) // 5 hz oscillation"},sine:{name:"usine",category:"modulation",description:"Sinusoïdal low-frequency oscillator",example:"usine(5) // 5 hz oscillation"},utriangle:{name:"utriangle",category:"modulation",description:"Unipolar triangular low-frequency oscillator",example:"utriangle(5) // 5 hz oscillation"},triangle:{name:"triangle",category:"modulation",description:"Triangular low-frequency oscillator",example:"triangle(5) // 5 hz oscillation"},usaw:{name:"usaw",category:"modulation",description:"Unipolar sawtooth low-frequency oscillator",example:"usaw(5) // 5 hz oscillation"},saw:{name:"saw",category:"modulation",description:"Sawtooth low-frequency oscillator",example:"saw(5) // 5 hz oscillation"},square:{name:"square",category:"modulation",description:"Square low-frequency oscillator",example:"square(5) // 5 hz oscillation"},usquare:{name:"usquare",category:"modulation",description:"Unipolar square low-frequency oscillator",example:"usquare(5) // 5 hz oscillation"},rhythm:{name:"rhythm",category:"rhythm",description:"Variant of the euclidian algorithm function",example:"rhythm(.5, 3, 8) // time, pulses, steps"},let:{name:"let",category:"javascript",description:"Variable assignation",example:"let baba = 10"},onbeat:{name:"onbeat",category:"rhythm",description:"Return true when targetted beat(s) is/are reached",example:"onbeat([1,2,3]) // true on beats 1, 2 and 3"},oncount:{name:"oncount",category:"rhythm",description:"Return true when targetted beat(s) is/are reached in the given period",example:"oncount([1,2,3], 4) // true on beats 1, 2 and 3 in a 4 beats period"},mod:{name:"mod",category:"rhythm",description:"return true every n pulsations.",example:"mod(1) :: log(rand(1,5))"},modp:{name:"modp",category:"rhythm",description:"return true every n ticks.",example:"modp(8) :: log(rand(1,5))"},euclid:{name:"euclid",category:"rhythm",description:"Iterator-based euclidian rhythm generator",example:"euclid($(1), 3, 8) // iterator, pulses"},oneuclid:{name:"oneuclid",category:"rhythm",description:"Variant of the euclidian rhythm generator",example:"oneuclid(3, 8) // iterator, pulses"},bin:{name:"bin",category:"rhythm",description:"Convert a decimal number to binary rhythm generator",example:"bin($(1), 9223) // iterator, number to convert"},binrhythm:{name:"binrhythm",category:"rhythm",description:"Binary rhythm generator",example:"binrhythm(.5, 9223) :: sound('cp').out()"},prob:{name:"prob",category:"randomness",description:"Return true with a probability of n %",example:"prob(50) // 50% probability"},rand:{name:"rand",category:"randomness",description:"random floating point number between x and y",example:"rand(1, 10) // between 1 and 10"},irand:{name:"irand",category:"randomness",description:"random integer number between x and y",example:"irand(1, 10) // between 1 and 10"},pick:{name:"pick",category:"randomness",description:"Pick a value in the given array",example:"[1,4,10].pick()"},sound:{name:"sound",category:"audio",description:"Base function to play audio (samples / synths)",example:"sound('bd').out()"},snd:{name:"snd",category:"audio",description:"Base function to play audio (samples / synths). Alias for sound.",example:"sound('bd').out()"},bpm:{name:"bpm",category:"time",description:"Get or set the current beats per minute.",example:"bpm(135) // set the bpm to 135"},out:{name:"out",category:"audio",description:"Connect the sound() chain to the output",example:"sound('clap').out()"},script:{name:"script",category:"core",description:"Execute one or more local scripts",example:"mod(1) :: script(1)"},clear_script:{name:"clear_script",category:"core",description:"Deletes the given script",example:"clear_script(2)"},copy_script:{name:"copy_script",category:"core",description:"Copy the script from to the script to",example:"copy_script(1, 2)"},warp:{name:"warp",category:"core",description:"jumps to the n tick of the clock.",example:"warp(1) :: log('back to the big bang!')"},beat_warp:{name:"beat_warp",category:"core",description:"jumps to the n beat of the clock.",example:"beat_warp(1) :: log('back to the first beat!')"},divbar:{name:"divbar",category:"time",description:"works just like div but at the level of bars instead of beats",example:"divbar(2)::mod(1)::snd('kick').out()"},onbar:{name:"onbar",category:"time",description:"return true when targetted bar(s) is/are reached in period",example:"onbar(4, 4)::mod(.5)::snd('hh').out();"},begin:{name:"begin",category:"sampling",description:"Audio playback start time (0-1)",example:"sound('cp').begin(.5).out()"},end:{name:"end",category:"sampling",description:"Audio playback end time (0-1)",example:"sound('cp').end(.5).out()"},mouseX:{name:"mouseX",category:"mouse",description:"Mouse X position (big float)",example:"log(mouseX())"},mouseY:{name:"mouseY",category:"mouse",description:"Mouse Y position (big float)",example:"log(mouseY())"},noteX:{name:"noteX",category:"mouse",description:"Mouse X position (as MIDI note)",example:"log(noteX())"},noteY:{name:"noteY",category:"mouse",description:"Mouse Y position (as MIDI note)",example:"log(noteY())"},cut:{name:"cut",category:"sampling",description:"Cutting sample when other sample met on same orbit (0 or 1)",example:"sound('cp').cut(1).out()"},pan:{name:"pan",category:"audio",description:"Stereo panning (-1 to 1)",example:"sound('cp').pan(-1).out()"},zrand:{name:"zrand",category:"synthesis",description:"ZzFX randomisation factor",example:"sound('zzfx').zrand(.5).out()"},curve:{name:"curve",category:"synthesis",description:"ZzFX waveshaping (0-3)",example:"sound('zzfx').curve(1).out()"},slide:{name:"slide",category:"synthesis",description:"ZzFX pitch slide",example:"sound('zzfx').slide(1).out()"},deltaSlide:{name:"deltaSlide",category:"synthesis",description:"ZzFX pitch delta slide",example:"sound('zzfx').deltaSlide(1).out()"},pitchJump:{name:"pitchJump",category:"synthesis",description:"ZzFX pitch jump",example:"sound('zzfx').pitchJump(1).out()"},pitchJumpTime:{name:"pitchJumpTime",category:"synthesis",description:"ZzFX pitch jump time (time before jump)",example:"sound('zzfx').pitchJumpTime(1).out()"},zcrush:{name:"zcrush",category:"synthesis",description:"ZzFX bitcrushing",example:"sound('zzfx').zcrush(1).out()"},zdelay:{name:"zdelay",category:"synthesis",description:"ZzFX delay",example:"sound('zzfx').zdelay(1).out()"},tremolo:{name:"tremolo",category:"synthesis",description:"ZzFX weird tremolo effect",example:"sound('zzfx').tremolo(1).out()"},speak:{name:"speak",category:"synthesis",description:"Text to speech synthesizer",example:"mod(2) :: speak('Topos!','fr',irand(0,5))"},midi_outputs:{name:"midi_outputs",category:"midi",description:"List of available MIDI outputs",example:"midi_outputs()"},midi_output:{name:"midi_output",category:"midi",description:"Set the current MIDI output",example:"midi_output('IAC Driver Bus 1')"},midi:{name:"midi",category:"midi",description:"Send a MIDI message",example:"midi(144, 60, 100)"},control_change:{name:"control_change",category:"midi",description:"Send a MIDI control change message",example:"control_change({control: 1, value: 60, channel: 10})"},program_change:{name:"program_change",category:"midi",description:"Send a MIDI program change message",example:"program_change(1, 10)"},sysex:{name:"sysex",category:"midi",description:"Send a MIDI sysex message",example:"sysex(0xF0, 0x7D, 0x00, 0x06, 0x01, 0xF7)"},midi_clock:{name:"midi_clock",category:"midi",description:"Send a MIDI clock message",example:"midi_clock()"},degrade:{name:"degrade",category:"patterns",description:"Removes n% of the given array randomly",example:"[0,1,2,3].degrade(20)"},loop:{name:"loop",category:"patterns",description:"Loop over the given array using an iterator",example:"[0,1,2,3].loop($(1))"},$:{name:"$",category:"patterns",description:"Iterator",example:"[0,1,2,3].loop($(1))"},counter:{name:"counter",category:"patterns",description:"Counter/iterator",example:"counter('my_counter_, 20, 1)"},drunk:{name:"drunk",category:"patterns",description:"Returns the next value in a drunk walk",example:"drunk()"},drunk_max:{name:"drunk_max",category:"patterns",description:"Sets the maximum value of the drunk walk",example:"drunk_max(10)"},drunk_min:{name:"drunk_min",category:"patterns",description:"Sets the minimum value of the drunk walk",example:"drunk_min(0)"},drunk_wrap:{name:"drunk_wrap",category:"patterns",description:"Wraps (or not) of the drunk walk (boolean)",example:"drunk_wrap(true)"},v:{name:"v",category:"variable",description:"Global Variable setter or getter",example:"v('my_var', 10) // Sets global variable 'my_var' to 10"},delete_variable:{name:"delete_variable",category:"variable",description:"Deletes the given global variable",example:"delete_variable('my_var')"},clear_variables:{name:"clear_variables",category:"variable",description:"Clears all global variables",example:"clear_variables()"},shuffle:{name:"shuffle",category:"patterns",description:"Shuffle the given array",example:"[0,1,2,3].shuffle()"},rotate:{name:"rotate",category:"patterns",description:"Rotate the given array to the right for n indexes",example:"[0,1,2,3].rotate(2)"},unique:{name:"unique",category:"patterns",description:"Remove duplicates from the given array",example:"[0,1,2,3,3,3].unique()"},add:{name:"add",category:"patterns",description:"Add a value to each element of the given array",example:"[0,1,2,3].add(1)"},sub:{name:"sub",category:"patterns",description:"Substract a value to each element of the given array",example:"[0,1,2,3].sub(1)"},mul:{name:"mul",category:"patterns",description:"Multiply each element of the given array by a value",example:"[0,1,2,3].mul(2)"},division:{name:"div",category:"patterns",description:"Divide each element of the given array by a value",example:"[0,1,2,3].division(2)"},scale:{name:"scale",category:"patterns",description:"Scale setter used by Ziffers",example:"z0('0 1 2 3').scale('major').out()"},zzfx:{name:"zzfx",category:"synthesis",description:"ZzFX sound generator",example:"sound('zzfx').zzfx(...).out()"}},MS=Jv((n,e,t)=>{let{from:r,to:i,text:a}=n.state.doc.lineAt(e),s=e,o=e;for(;s>r&&/\w/.test(a[s-r-1]);)s--;for(;o0?null:{pos:s,end:o,above:!0,create(l){if(!(a.slice(s-r,o-r)in LS))return{dom:document.createElement("div")};let c=LS[a.slice(s-r,o-r)]||{},d=` +}`,{label:"class",detail:"definition",type:"keyword"}),Sn('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Sn('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],DS=new sC,GC=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Ls(n){return(e,t)=>{let r=e.node.getChild("VariableDefinition");return r&&t(r,n),!0}}const Hw=["FunctionDeclaration"],zw={FunctionDeclaration:Ls("function"),ClassDeclaration:Ls("class"),ClassExpression:()=>!0,EnumDeclaration:Ls("constant"),TypeAliasDeclaration:Ls("type"),NamespaceDeclaration:Ls("namespace"),VariableDefinition(n,e){n.matchContext(Hw)||e(n,"variable")},TypeDefinition(n,e){e(n,"type")},__proto__:null};function $C(n,e){let t=DS.get(e);if(t)return t;let r=[],i=!0;function a(s,o){let l=n.sliceString(s.from,s.to);r.push({label:l,type:o})}return e.cursor(Rt.IncludeAnonymous).iterate(s=>{if(i)i=!1;else if(s.name){let o=zw[s.name];if(o&&o(s,a)||GC.has(s.name))return!1}else if(s.to-s.from>8192){for(let o of $C(n,s.node))r.push(o);return!1}}),DS.set(e,r),r}const xS=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,QC=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function Ww(n){let e=Mt(n.state).resolveInner(n.pos,-1);if(QC.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&xS.test(n.state.sliceDoc(e.from,e.to));if(!t&&!n.explicit)return null;let r=[];for(let i=e;i;i=i.parent)GC.has(i.name)&&(r=r.concat($C(n.state.doc,i)));return{options:r,from:t?e.from:n.pos,validFor:xS}}const ai=is.define({name:"javascript",parser:c0.configure({props:[Yo.add({IfStatement:xl({except:/^\s*({|else\b)/}),TryStatement:xl({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:E0,SwitchBody:n=>{let e=n.textAfter,t=/^\s*\}/.test(e),r=/^\s*(case|default)\b/.test(e);return n.baseIndent+(t?0:r?1:2)*n.unit},Block:O0({closing:"}"}),ArrowFunction:n=>n.baseIndent+n.unit,"TemplateString BlockComment":()=>null,"Statement Property":xl({except:/^{/}),JSXElement(n){let e=/^\s*<\//.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},JSXEscape(n){let e=/\s*\}/.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},"JSXOpenTag JSXSelfClosingTag"(n){return n.column(n.node.from)+n.unit}}),Go.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":SC,BlockComment(n){return{from:n.from+2,to:n.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),qC={test:n=>/^JSX/.test(n.name),facet:Wm({commentTokens:{block:{open:"{/*",close:"*/}"}}})},VC=ai.configure({dialect:"ts"},"typescript"),HC=ai.configure({dialect:"jsx",props:[Xm.add(n=>n.isTop?[qC]:void 0)]}),zC=ai.configure({dialect:"jsx ts",props:[Xm.add(n=>n.isTop?[qC]:void 0)]},"typescript"),Xw="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(n=>({label:n,type:"keyword"}));function em(n={}){let e=n.jsx?n.typescript?zC:HC:n.typescript?VC:ai;return new _o(e,[ai.data.of({autocomplete:J0(QC,NC(Vw.concat(Xw)))}),ai.data.of({autocomplete:Ww}),n.jsx?Jw:[]])}function Zw(n){for(;;){if(n.name=="JSXOpenTag"||n.name=="JSXSelfClosingTag"||n.name=="JSXFragmentTag")return n;if(n.name=="JSXEscape"||!n.parent)return null;n=n.parent}}function kS(n,e,t=n.length){for(let r=e==null?void 0:e.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return n.sliceString(r.from,Math.min(r.to,t));return""}function Kw(n){return n&&(n.name=="JSXEndTag"||n.name=="JSXSelfCloseEndTag")}const jw=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Jw=Pe.inputHandler.of((n,e,t,r)=>{if((jw?n.composing:n.compositionStarted)||n.state.readOnly||e!=t||r!=">"&&r!="/"||!ai.isActiveAt(n.state,e,-1))return!1;let{state:i}=n,a=i.changeByRange(s=>{var o;let{head:l}=s,c=Mt(i).resolveInner(l,-1),d;if(c.name=="JSXStartTag"&&(c=c.parent),!(c.name=="JSXAttributeValue"&&c.to>l)){if(r==">"&&c.name=="JSXFragmentTag")return{range:fe.cursor(l+1),changes:{from:l,insert:">"}};if(r=="/"&&c.name=="JSXFragmentTag"){let p=c.parent,m=p==null?void 0:p.parent;if(p.from==l-1&&((o=m.lastChild)===null||o===void 0?void 0:o.name)!="JSXEndTag"&&(d=kS(i.doc,m==null?void 0:m.firstChild,l))){let _=`/${d}>`;return{range:fe.cursor(l+_.length),changes:{from:l,insert:_}}}}else if(r==">"){let p=Zw(c);if(p&&!Kw(p.lastChild)&&i.sliceDoc(l,l+2)!="`}}}}return{range:s}});return a.changes.empty?!1:(n.dispatch(a,{userEvent:"input.type",scrollIntoView:!0}),!0)}),LS={seed:{name:"seed",category:"randomness",description:"Seed the random generator",example:"seed(1234)"},delayr:{name:"delayr",category:"time",description:"Delay a function n times by t ms",example:"delayr(50, 3, () => mod(1) :: log('delayed'))"},toss:{name:"toss",category:"randomness",description:"Toss a coin, true or false",example:"toss() : log('heads')"},attack:{name:"attack",category:"synthesis",description:"ADSR envelope attack time (in seconds)",example:"sound('sawtooth').attack(.5).out()"},decay:{name:"decay",category:"synthesis",description:"ADSR envelope decay time (in seconds)",example:"sound('sawtooth').decay(.5).out()"},sustain:{name:"sustain",category:"synthesis",description:"ADSR envelope sustain level (0-1)",example:"sound('sawtooth').sustain(.5).out()"},release:{name:"release",category:"synthesis",description:"ADSR envelope release time (in seconds)",example:"sound('sawtooth').release(.5).out()"},fmwave:{name:"fmwave",category:"synthesis",description:"FM synth modulator waveform",example:"sound('fm').fmwave('sine').out()"},fmi:{name:"fmi",category:"audio",description:"FM synth modulator index",example:"sound('fm').fmi([1,2].beat()).out()"},fmh:{name:"fmh",category:"audio",description:"FM synth modulator ratio",example:"sound('fm').fmi(2).fmh(2).out()"},fmattack:{name:"fmattack",category:"synthesis",description:"FM synth modulator ADSR envelope attack time (in seconds)",example:"sound('sine').fmi(2).fmattack(.5).out()"},fmdecay:{name:"fmdecay",category:"synthesis",description:"FM synth modulator ADSR envelope decay time (in seconds)",example:"sound('sine').fmi(2).fmdecay(.5).out()"},fmsustain:{name:"fmsustain",category:"synthesis",description:"FM synth modulator ADSR envelope sustain level (0-1)",example:"sound('sine').fmi(2).fmsustain(.5).out()"},fmrelease:{name:"fmrelease",category:"synthesis",description:"FM synth modulator ADSR envelope release time (in seconds)",example:"sound('sine').fmi(2).fmrelease(.5).out()"},repeatAll:{name:"repeatAll",category:"patterns",description:"Repeat every array elements n times",example:"[0,1,2,3].repeatAll(2)"},quant:{name:"quant",category:"functions",description:"Quantize a value in the given array",example:"quant(30, [0,1,2,3])"},log:{name:"log",category:"javascript",description:"Log a value in the console",example:"log('Hello, world')"},div:{name:"div",category:"patterns",description:"Returns next value every n beats or true and false alternatively",example:"div(4, 50) // 2 beats of true, 2 beats of false, 50/50."},n:{name:"n",category:"audio",description:"Sample number or synth oscillator partials count",example:"sound('dr').n([1,2].beat()).out()"},note:{name:"note",category:"patterns",description:"MIDI note number (0-127)",example:"sound('jvbass').note(50).out()"},vel:{name:"vel",category:"audio",description:"Velocity or sound volume (0-1)",example:"sound('cp').vel(.5).out()"},palindrome:{name:"palindrome",category:"patterns",description:"Returns palindrome of the current array",example:"[0,1,2,3].palindrome()"},cutoff:{name:"cutoff",category:"filter",description:"Lowpass filter cutoff frequency",example:"sound('cp').cutoff(1000).out()"},resonance:{name:"resonance",category:"filter",description:"Lowpass filter resonance",example:"sound('cp').resonance(1).out()"},hcutoff:{name:"hcutoff",category:"filter",description:"Highpass filter cutoff frequency",example:"sound('cp').hcutoff(1000).out()"},hresonance:{name:"hresonance",category:"filter",description:"Highpass filter resonance",example:"sound('cp').hresonance(1).out()"},bandf:{name:"bandf",category:"filter",description:"Bandpass filter cutoff frequency",example:"sound('cp').bandf(1000).out()"},bandq:{name:"bandq",category:"filter",description:"Bandpass filter resonance",example:"sound('cp').bandq(1).out()"},vowel:{name:"vowel",category:"filter",description:"Vowel filter type",example:"sound('cp').vowel('a').out()"},coarse:{name:"coarse",category:"synthesis",description:"Artificial sample-rate lowering",example:"mod(.5)::snd('pad').coarse($(1) % 16).clip(.5).out();"},crush:{name:"crush",category:"synthesis",description:"Bitcrushing effect. 1 is extreme, superior values are more subtle.",example:""},speed:{name:"speed",category:"sampling",description:"Sample playback speed",example:"sound('cp').speed(.5).out()"},shape:{name:"shape",category:"synthesis",description:"Waveshaping distorsion",example:"sound('cp').shape(.5).out()"},delay:{name:"delay",category:"effect",description:"Delay effect dry/wet",example:"sound('cp').delay(.5).out()"},delayfb:{name:"delayfb",category:"effect",description:"Delay effect feedback amount (0-1)",example:"sound('cp').delay(0.2).delayfb(.5).out()"},delaytime:{name:"delaytime",category:"effect",description:"Delay effect delay time (in seconds)",example:"sound('cp').delay(0.2).delaytime(.5).out()"},gain:{name:"gain",category:"audio",description:"Playback volume",example:"sound('cp').gain(.5).out()"},bar:{name:"bar",category:"patterns",description:"Returns list index for the current bar (with wrapping)",example:"[0,1,2,3].bar()"},beat:{name:"beat",category:"patterns",description:"Returns list index for the current beat (with wrapping)",example:"[0,1,2,3].beat()"},room:{name:"room",category:"effect",description:"Reverb effect room amount",example:"sound('cp').room(.5).out()"},size:{name:"size",category:"effect",description:"Reverb effect room size",example:"sound('cp').size(.5).out()"},usine:{name:"usine",category:"modulation",description:"Unipolar sinusoïdal low-frequency oscillator",example:"usine(5) // 5 hz oscillation"},sine:{name:"usine",category:"modulation",description:"Sinusoïdal low-frequency oscillator",example:"usine(5) // 5 hz oscillation"},utriangle:{name:"utriangle",category:"modulation",description:"Unipolar triangular low-frequency oscillator",example:"utriangle(5) // 5 hz oscillation"},triangle:{name:"triangle",category:"modulation",description:"Triangular low-frequency oscillator",example:"triangle(5) // 5 hz oscillation"},usaw:{name:"usaw",category:"modulation",description:"Unipolar sawtooth low-frequency oscillator",example:"usaw(5) // 5 hz oscillation"},saw:{name:"saw",category:"modulation",description:"Sawtooth low-frequency oscillator",example:"saw(5) // 5 hz oscillation"},square:{name:"square",category:"modulation",description:"Square low-frequency oscillator",example:"square(5) // 5 hz oscillation"},usquare:{name:"usquare",category:"modulation",description:"Unipolar square low-frequency oscillator",example:"usquare(5) // 5 hz oscillation"},rhythm:{name:"rhythm",category:"rhythm",description:"Variant of the euclidian algorithm function",example:"rhythm(.5, 3, 8) // time, pulses, steps"},let:{name:"let",category:"javascript",description:"Variable assignation",example:"let baba = 10"},onbeat:{name:"onbeat",category:"rhythm",description:"Return true when targetted beat(s) is/are reached",example:"onbeat([1,2,3]) // true on beats 1, 2 and 3"},oncount:{name:"oncount",category:"rhythm",description:"Return true when targetted beat(s) is/are reached in the given period",example:"oncount([1,2,3], 4) // true on beats 1, 2 and 3 in a 4 beats period"},mod:{name:"mod",category:"rhythm",description:"return true every n pulsations.",example:"mod(1) :: log(rand(1,5))"},modp:{name:"modp",category:"rhythm",description:"return true every n ticks.",example:"modp(8) :: log(rand(1,5))"},euclid:{name:"euclid",category:"rhythm",description:"Iterator-based euclidian rhythm generator",example:"euclid($(1), 3, 8) // iterator, pulses"},oneuclid:{name:"oneuclid",category:"rhythm",description:"Variant of the euclidian rhythm generator",example:"oneuclid(3, 8) // iterator, pulses"},bin:{name:"bin",category:"rhythm",description:"Convert a decimal number to binary rhythm generator",example:"bin($(1), 9223) // iterator, number to convert"},binrhythm:{name:"binrhythm",category:"rhythm",description:"Binary rhythm generator",example:"binrhythm(.5, 9223) :: sound('cp').out()"},prob:{name:"prob",category:"randomness",description:"Return true with a probability of n %",example:"prob(50) // 50% probability"},rand:{name:"rand",category:"randomness",description:"random floating point number between x and y",example:"rand(1, 10) // between 1 and 10"},irand:{name:"irand",category:"randomness",description:"random integer number between x and y",example:"irand(1, 10) // between 1 and 10"},pick:{name:"pick",category:"randomness",description:"Pick a value in the given array",example:"[1,4,10].pick()"},odds:{name:"odds",category:"randomness",description:"Return true with a probability of n %",example:"odds(1/2) // 50% probability"},never:{name:"never",category:"randomness",description:"Return false",example:"never() // false"},almostNever:{name:"almostNever",category:"randomness",description:"Return true with a probability of 2.5%",example:"almostNever() // 2.5% chance"},rarely:{name:"rarely",category:"randomness",description:"Return true with a probability of 10%",example:"rarely() // 10% chance"},scarcely:{name:"scarcely",category:"randomness",description:"Return true with a probability of 25%",example:"scarcely() // 25% chance"},sometimes:{name:"sometimes",category:"randomness",description:"Return true with a probability of 50%",example:"sometimes() // 50% chance"},often:{name:"often",category:"randomness",description:"Return true with a probability of 75%",example:"often() // 75% chance"},frequently:{name:"frequently",category:"randomness",description:"Return true with a probability of 90%",example:"frequently() // chance"},almostAlways:{name:"almostAlways",category:"randomness",description:"Return true with a probability of 98.5%",example:"almostAlways() // 98.5% chance"},always:{name:"always",category:"randomness",description:"Return true",example:"always() // true"},sound:{name:"sound",category:"audio",description:"Base function to play audio (samples / synths)",example:"sound('bd').out()"},snd:{name:"snd",category:"audio",description:"Base function to play audio (samples / synths). Alias for sound.",example:"sound('bd').out()"},bpm:{name:"bpm",category:"time",description:"Get or set the current beats per minute.",example:"bpm(135) // set the bpm to 135"},out:{name:"out",category:"audio",description:"Connect the sound() chain to the output",example:"sound('clap').out()"},script:{name:"script",category:"core",description:"Execute one or more local scripts",example:"mod(1) :: script(1)"},clear_script:{name:"clear_script",category:"core",description:"Deletes the given script",example:"clear_script(2)"},copy_script:{name:"copy_script",category:"core",description:"Copy the script from to the script to",example:"copy_script(1, 2)"},warp:{name:"warp",category:"core",description:"jumps to the n tick of the clock.",example:"warp(1) :: log('back to the big bang!')"},beat_warp:{name:"beat_warp",category:"core",description:"jumps to the n beat of the clock.",example:"beat_warp(1) :: log('back to the first beat!')"},divbar:{name:"divbar",category:"time",description:"works just like div but at the level of bars instead of beats",example:"divbar(2)::mod(1)::snd('kick').out()"},onbar:{name:"onbar",category:"time",description:"return true when targetted bar(s) is/are reached in period",example:"onbar(4, 4)::mod(.5)::snd('hh').out();"},begin:{name:"begin",category:"sampling",description:"Audio playback start time (0-1)",example:"sound('cp').begin(.5).out()"},end:{name:"end",category:"sampling",description:"Audio playback end time (0-1)",example:"sound('cp').end(.5).out()"},mouseX:{name:"mouseX",category:"mouse",description:"Mouse X position (big float)",example:"log(mouseX())"},mouseY:{name:"mouseY",category:"mouse",description:"Mouse Y position (big float)",example:"log(mouseY())"},noteX:{name:"noteX",category:"mouse",description:"Mouse X position (as MIDI note)",example:"log(noteX())"},noteY:{name:"noteY",category:"mouse",description:"Mouse Y position (as MIDI note)",example:"log(noteY())"},cut:{name:"cut",category:"sampling",description:"Cutting sample when other sample met on same orbit (0 or 1)",example:"sound('cp').cut(1).out()"},pan:{name:"pan",category:"audio",description:"Stereo panning (-1 to 1)",example:"sound('cp').pan(-1).out()"},zrand:{name:"zrand",category:"synthesis",description:"ZzFX randomisation factor",example:"sound('zzfx').zrand(.5).out()"},curve:{name:"curve",category:"synthesis",description:"ZzFX waveshaping (0-3)",example:"sound('zzfx').curve(1).out()"},slide:{name:"slide",category:"synthesis",description:"ZzFX pitch slide",example:"sound('zzfx').slide(1).out()"},deltaSlide:{name:"deltaSlide",category:"synthesis",description:"ZzFX pitch delta slide",example:"sound('zzfx').deltaSlide(1).out()"},pitchJump:{name:"pitchJump",category:"synthesis",description:"ZzFX pitch jump",example:"sound('zzfx').pitchJump(1).out()"},pitchJumpTime:{name:"pitchJumpTime",category:"synthesis",description:"ZzFX pitch jump time (time before jump)",example:"sound('zzfx').pitchJumpTime(1).out()"},zcrush:{name:"zcrush",category:"synthesis",description:"ZzFX bitcrushing",example:"sound('zzfx').zcrush(1).out()"},zdelay:{name:"zdelay",category:"synthesis",description:"ZzFX delay",example:"sound('zzfx').zdelay(1).out()"},tremolo:{name:"tremolo",category:"synthesis",description:"ZzFX weird tremolo effect",example:"sound('zzfx').tremolo(1).out()"},speak:{name:"speak",category:"synthesis",description:"Text to speech synthesizer",example:"mod(2) :: speak('Topos!','fr',irand(0,5))"},midi_outputs:{name:"midi_outputs",category:"midi",description:"List of available MIDI outputs",example:"midi_outputs()"},midi_output:{name:"midi_output",category:"midi",description:"Set the current MIDI output",example:"midi_output('IAC Driver Bus 1')"},midi:{name:"midi",category:"midi",description:"Send a MIDI message",example:"midi(144, 60, 100)"},control_change:{name:"control_change",category:"midi",description:"Send a MIDI control change message",example:"control_change({control: 1, value: 60, channel: 10})"},program_change:{name:"program_change",category:"midi",description:"Send a MIDI program change message",example:"program_change(1, 10)"},sysex:{name:"sysex",category:"midi",description:"Send a MIDI sysex message",example:"sysex(0xF0, 0x7D, 0x00, 0x06, 0x01, 0xF7)"},midi_clock:{name:"midi_clock",category:"midi",description:"Send a MIDI clock message",example:"midi_clock()"},degrade:{name:"degrade",category:"patterns",description:"Removes n% of the given array randomly",example:"[0,1,2,3].degrade(20)"},loop:{name:"loop",category:"patterns",description:"Loop over the given array using an iterator",example:"[0,1,2,3].loop($(1))"},$:{name:"$",category:"patterns",description:"Iterator",example:"[0,1,2,3].loop($(1))"},counter:{name:"counter",category:"patterns",description:"Counter/iterator",example:"counter('my_counter_, 20, 1)"},drunk:{name:"drunk",category:"patterns",description:"Returns the next value in a drunk walk",example:"drunk()"},drunk_max:{name:"drunk_max",category:"patterns",description:"Sets the maximum value of the drunk walk",example:"drunk_max(10)"},drunk_min:{name:"drunk_min",category:"patterns",description:"Sets the minimum value of the drunk walk",example:"drunk_min(0)"},drunk_wrap:{name:"drunk_wrap",category:"patterns",description:"Wraps (or not) of the drunk walk (boolean)",example:"drunk_wrap(true)"},v:{name:"v",category:"variable",description:"Global Variable setter or getter",example:"v('my_var', 10) // Sets global variable 'my_var' to 10"},delete_variable:{name:"delete_variable",category:"variable",description:"Deletes the given global variable",example:"delete_variable('my_var')"},clear_variables:{name:"clear_variables",category:"variable",description:"Clears all global variables",example:"clear_variables()"},shuffle:{name:"shuffle",category:"patterns",description:"Shuffle the given array",example:"[0,1,2,3].shuffle()"},rotate:{name:"rotate",category:"patterns",description:"Rotate the given array to the right for n indexes",example:"[0,1,2,3].rotate(2)"},unique:{name:"unique",category:"patterns",description:"Remove duplicates from the given array",example:"[0,1,2,3,3,3].unique()"},add:{name:"add",category:"patterns",description:"Add a value to each element of the given array",example:"[0,1,2,3].add(1)"},sub:{name:"sub",category:"patterns",description:"Substract a value to each element of the given array",example:"[0,1,2,3].sub(1)"},mul:{name:"mul",category:"patterns",description:"Multiply each element of the given array by a value",example:"[0,1,2,3].mul(2)"},division:{name:"div",category:"patterns",description:"Divide each element of the given array by a value",example:"[0,1,2,3].division(2)"},scale:{name:"scale",category:"patterns",description:"Scale setter used by Ziffers",example:"z0('0 1 2 3').scale('major').out()"},zzfx:{name:"zzfx",category:"synthesis",description:"ZzFX sound generator",example:"sound('zzfx').zzfx(...).out()"}},MS=Jv((n,e,t)=>{let{from:r,to:i,text:a}=n.state.doc.lineAt(e),s=e,o=e;for(;s>r&&/\w/.test(a[s-r-1]);)s--;for(;o0?null:{pos:s,end:o,above:!0,create(l){if(!(a.slice(s-r,o-r)in LS))return{dom:document.createElement("div")};let c=LS[a.slice(s-r,o-r)]||{},d=`

${c.name} [${c.category}]

${c.description}

${c.example}
@@ -1453,16 +1453,47 @@ prob(80) :: script(toss() ? script(3) : script(4)) ## Chance operators Chance operators returning a boolean value are also available. They are super important because they also exist for another mechanism called **chaining**. Checkout the **Chaining** page to learn how to use them in different contexts! + +By default chance operators will be evaluated 48 times within a beat. You can change this value by providing a number of beats as an argument. Default value is 1. Change operators can also be used to randomly apply other operators. + +- odds(n: number, beats?: number): returns true for every n (odds) (eg. 1/4 = 0.25) in given number of beats +- never(beats?: number): returns false. Can be handy when switching between different probabilities +- almostNever(beats?: number): returns true 0.1% of the time in given number of beats +- rarely(beats?: number): returns true 1% of the time in given number of beats +- scarcely(beats?: number): returns true 10% of the time in given number of beats +- sometimes(beats?: number): returns true 50% of the time in given number of beats +- often(beats?: number): returns true 75% of the time in given number of beats +- frequently(beats?: number): returns true 90% of the time in given number of beats +- almostAlways(beats?: number): returns true 99% of the time in given number of beats +- always(beats?: number): returns true. Can be handy when switching between different probabilities -- odds(n: number, sec?: number): returns true for every n (odds) (eg. 1/4 = 0.25) in given seconds (sec) -- almostNever(sec?: number): returns true 0.1% in given seconds (sec) -- rarely(sec?: number): returns true 1% in given seconds (sec) -- scaresly(sec?: number): returns true 10% in given seconds (sec) -- sometimes(sec?: number): returns true 50% in given seconds (sec) -- often(sec?: number): returns true 75% in given seconds (sec) -- frequently(sec?: number): returns true 90% in given seconds (sec) -- almostAlways(sec?: number): returns true 99% in given seconds (sec) - +Examples: + +${e("Using chance operators",` + rarely() :: sound('hh').out(); // Rarely 48 times is still a lot + rarely(4) :: sound('bd').out(); // Rarely in 4 beats is bit less + rarely(8) :: sound('east').out(); // Rarely in 8 beats is even less + `,!0)} + +${e("Using chance with other operators",` + frequently() :: mod(1) :: sound('kick').out(); + often() :: mod(0.5) :: sound('hh').out(); + sometimes() :: onbeat(1,3) :: sound('snare').out(); + `,!0)} + +${e("Using chance with chaining",` + mod(0.5) && sound("bd") + .freq(100) + .sometimes(s=>s.crush(2.5)) + .out() + + mod(0.5) && sound('arp').freq(100) + .sometimes(n=>n.freq(200).delay(0.5)) + .rarely(n=>n.freq(300).delay(2.5)) + .almostNever(n=>n.freq(400)) + .out() + `,!0)} + ## Math functions - max(...values: number[]): number: returns the maximum value of a list of numbers. @@ -2031,7 +2062,7 @@ I won't teach you how to play with Hydra. You can find some great resources on t `+c.line+" | "+_+` `+m+" | "+t("",l.column-1," ")+t("",A,"^")}else a+=` at `+d}return a},e.buildMessage=function(i,a){var s={literal:function(_){return'"'+l(_.text)+'"'},class:function(_){var b=_.parts.map(function(A){return Array.isArray(A)?c(A[0])+"-"+c(A[1]):c(A)});return"["+(_.inverted?"^":"")+b.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(_){return _.description}};function o(_){return _.charCodeAt(0).toString(16).toUpperCase()}function l(_){return _.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(b){return"\\x0"+o(b)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(b){return"\\x"+o(b)})}function c(_){return _.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(b){return"\\x0"+o(b)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(b){return"\\x"+o(b)})}function d(_){return s[_.type](_)}function p(_){var b=_.map(d),A,R;if(b.sort(),b.length>0){for(A=1,R=1;A>",ne="<<",re="<",te=">",M="_",Q="?",j="r",X="#",le="b",se="iii",Oe="ii",ke="iv",Le="i",Ee="vii",Ne="vi",ue="v",we=/^[0-9]/,Xe=/^[ \n\r\t]/,Ve=/^[mklpdcwyhnqaefsxtgujzo]/,je=/^[a-zA-Z0-9\-*+]/,ot=/^[A-G]/,St=/^[bs]/,vt=at("-",!1),rt=_n([["0","9"]],!1,!1),yt=at(".",!1),Pt=Si("whitespace"),Pr=_n([" ",` -`,"\r"," "],!1,!1),qe=at(",",!1),Sr=at("|",!1),ut=_n(["m","k","l","p","d","c","w","y","h","n","q","a","e","f","s","x","t","g","u","j","z","o"],!1,!1),He=at("(",!1),dr=at(":",!1),Gt=at(")",!1),pr=at("[:",!1),W=at("]",!1),_e=at("[",!1),xe=at("{",!1),De=at("}",!1),Je=at("+",!1),Re=at("*",!1),Ft=at("/",!1),pt=at("%",!1),mt=at("^",!1),Jr=at("&",!1),ht=at(">>",!1),zt=at("<<",!1),bt=at("<",!1),Fe=at(">",!1),Or=at("_",!1),Zn=at("?",!1),dt=at("r",!1),wr=at("#",!1),hr=at("b",!1),hi=_n([["a","z"],["A","Z"],["0","9"],"-","*","+"],!1,!1),wn=_n([["A","G"]],!1,!1),Yt=_n(["b","s"],!1,!1),mn=at("iii",!1),qi=at("ii",!1),fi=at("iv",!1),Vi=at("i",!1),en=at("vii",!1),Kn=at("vi",!1),gn=at("v",!1),Qt=function(y){return y.filter(P=>P)},mi=function(){return parseFloat(Fr())},gi=function(){return parseInt(Fr())},q=function(){},ie=function(){return XM[Fr()]},ce=function(y){return y.filter(P=>P)},ge=function(y,P){return P?me(FO,{item:y,times:P}):me(YO,{items:y})},Ce=function(y){return y},Ge=function(y,P,B){return me(cP,{left:y,operation:P,right:B})},Me=function(y,P){return me(lP,{items:y,times:P})},Tt=function(y){return me(zA,{items:y})},Er=function(){return parseInt(Fr())},Br=function(y){return y.map(P=>typeof P=="number"?P:void 0)},ba=function(){return Math.ceil(VA(Fr()))},Hi=function(y){var P=y.filter(B=>B).map(B=>me(si,{pitch:B[0]},B.toString()));return me(YO,{items:P})},_s=function(y){return y},Ur=function(){},Ss=function(y){return me(Ig,{items:y})},Ta=function(y){return me(sP,{octave:y})},va=function(){return Fr().split("").reduce((y,P)=>y+(P==="^"?1:-1),0)},Os=function(){return me(UO,{seededRandom:a.seededRandom})},Ca=function(y,P){return me(UO,{min:y,max:P,seededRandom:a.seededRandom})},Es=function(y,P){return me(FO,{item:y,times:P})},ya=function(y){return me(oP,{duration:y})},Dr=function(y){return me(gm,{duration:y})},bs=function(y,P,B,K){const pe=y?a.nodeOptions.octave+y:a.nodeOptions.octave;return me(si,{duration:P,pitch:K,octave:pe,add:B})},Ts=function(y){return y.reduce((P,B)=>P+(B==="#"?1:-1),0)},Aa=function(y,P){return me(Ao,{pitches:[y].concat(P)})},Ra=function(){return Fr()},vs=function(){return Fr()},Ia=function(y,P,B,K){const pe=a.nodeOptions.scaleName?a.nodeOptions.scaleName:"MAJOR",Se=SP(K,B,pe,y,P);return me(Ao,{duration:P,pitches:Se,chordName:K})},Cs=function(y,P,B,K){const pe=y?a.nodeOptions.octave+y:a.nodeOptions.octave,Se=P||a.nodeOptions.duration;return me(aP,{duration:Se,roman:B,octave:pe,chordName:K})},Na=function(y,P,B){const K=y?a.nodeOptions.octave+y:a.nodeOptions.octave,pe=a.nodeOptions.key?a.nodeOptions.key:"C",Se=a.nodeOptions.scaleName?a.nodeOptions.scaleName:"MAJOR",$e=yP(B,pe,Se);return me(si,{duration:P,pitch:$e.pc,octave:$e.octave+K,add:$e.add,key:pe,scale:Se})},w=0,it=0,br=[{line:1,column:1}],nt=0,zi=[],Te=0,Ie={},tn;if("startRule"in a){if(!(a.startRule in l))throw new Error(`Can't start parsing from rule "`+a.startRule+'".');c=l[a.startRule]}function Fr(){return i.substring(it,w)}function _i(){return Dn(it,w)}function at(y,P){return{type:"literal",text:y,ignoreCase:P}}function _n(y,P,B){return{type:"class",parts:y,inverted:P,ignoreCase:B}}function ys(){return{type:"end"}}function Si(y){return{type:"other",description:y}}function Wi(y){var P=br[y],B;if(P)return P;for(B=y-1;!br[B];)B--;for(P=br[B],P={line:P.line,column:P.column};Bnt&&(nt=w,zi=[]),zi.push(y))}function wa(y,P,B){return new e(e.buildMessage(y,P),y,P,B)}function Oi(){var y,P,B=w*39+0,K=Ie[B];return K?(w=K.nextPos,K.result):(y=w,P=bi(),P!==s&&(it=y,P=Qt(P)),y=P,Ie[B]={nextPos:w,result:y},y)}function jn(){var y,P,B,K,pe,Se,$e,Ke=w*39+1,lt=Ie[Ke];if(lt)return w=lt.nextPos,lt.result;for(y=w,P=w,i.charCodeAt(w)===45?(B=d,w++):(B=s,Te===0&&ye(vt)),B===s&&(B=null),K=[],we.test(i.charAt(w))?(pe=i.charAt(w),w++):(pe=s,Te===0&&ye(rt));pe!==s;)K.push(pe),we.test(i.charAt(w))?(pe=i.charAt(w),w++):(pe=s,Te===0&&ye(rt));if(i.charCodeAt(w)===46?(pe=p,w++):(pe=s,Te===0&&ye(yt)),pe!==s){if(Se=[],we.test(i.charAt(w))?($e=i.charAt(w),w++):($e=s,Te===0&&ye(rt)),$e!==s)for(;$e!==s;)Se.push($e),we.test(i.charAt(w))?($e=i.charAt(w),w++):($e=s,Te===0&&ye(rt));else Se=s;Se!==s?(B=[B,K,pe,Se],P=B):(w=P,P=s)}else w=P,P=s;if(P===s)if(P=w,i.charCodeAt(w)===46?(B=p,w++):(B=s,Te===0&&ye(yt)),B!==s){if(K=[],we.test(i.charAt(w))?(pe=i.charAt(w),w++):(pe=s,Te===0&&ye(rt)),pe!==s)for(;pe!==s;)K.push(pe),we.test(i.charAt(w))?(pe=i.charAt(w),w++):(pe=s,Te===0&&ye(rt));else K=s;K!==s?(B=[B,K],P=B):(w=P,P=s)}else w=P,P=s;return P!==s&&(it=y,P=mi()),y=P,Ie[Ke]={nextPos:w,result:y},y}function qt(){var y,P,B=w*39+2,K=Ie[B];return K?(w=K.nextPos,K.result):(y=w,i.charCodeAt(w)===45?w++:Te===0&&ye(vt),we.test(i.charAt(w))?(P=i.charAt(w),w++):(P=s,Te===0&&ye(rt)),P!==s?(it=y,y=gi()):(w=y,y=s),Ie[B]={nextPos:w,result:y},y)}function Ei(){var y,P,B=w*39+3,K=Ie[B];return K?(w=K.nextPos,K.result):(Te++,y=w,Xe.test(i.charAt(w))?(P=i.charAt(w),w++):(P=s,Te===0&&ye(Pr)),P!==s&&(it=y,P=q()),y=P,Te--,y===s&&(P=s,Te===0&&ye(Pt)),Ie[B]={nextPos:w,result:y},y)}function Yr(){var y,P,B=w*39+7,K=Ie[B];return K?(w=K.nextPos,K.result):(y=w,Ve.test(i.charAt(w))?(P=i.charAt(w),w++):(P=s,Te===0&&ye(ut)),P!==s&&(it=y,P=ie()),y=P,Ie[B]={nextPos:w,result:y},y)}function rn(){var y,P=w*39+8,B=Ie[P];return B?(w=B.nextPos,B.result):(y=Yr(),y===s&&(y=jn()),Ie[P]={nextPos:w,result:y},y)}function bi(){var y,P,B,K=w*39+9,pe=Ie[K];if(pe)return w=pe.nextPos,pe.result;if(y=w,P=[],B=T(),B===s&&(B=Ho(),B===s&&(B=As(),B===s&&(B=Ti(),B===s&&(B=zo(),B===s&&(B=ka(),B===s&&(B=Xo())))))),B!==s)for(;B!==s;)P.push(B),B=T(),B===s&&(B=Ho(),B===s&&(B=As(),B===s&&(B=Ti(),B===s&&(B=zo(),B===s&&(B=ka(),B===s&&(B=Xo()))))));else P=s;return P!==s&&(it=y,P=ce(P)),y=P,Ie[K]={nextPos:w,result:y},y}function Ti(){var y,P,B,K,pe,Se=w*39+10,$e=Ie[Se];return $e?(w=$e.nextPos,$e.result):(y=w,i.charCodeAt(w)===40?(P=b,w++):(P=s,Te===0&&ye(He)),P!==s?(i.charCodeAt(w)===58?w++:Te===0&&ye(dr),B=bi(),B!==s?(K=Vo(),K===s&&(K=null),i.charCodeAt(w)===41?(pe=R,w++):(pe=s,Te===0&&ye(Gt)),pe!==s?(it=y,y=ge(B,K)):(w=y,y=s)):(w=y,y=s)):(w=y,y=s),Ie[Se]={nextPos:w,result:y},y)}function Vo(){var y,P,B,K=w*39+11,pe=Ie[K];return pe?(w=pe.nextPos,pe.result):(y=w,i.charCodeAt(w)===58?(P=A,w++):(P=s,Te===0&&ye(dr)),P!==s?(B=Da(),B!==s?(it=y,y=Ce(B)):(w=y,y=s)):(w=y,y=s),Ie[K]={nextPos:w,result:y},y)}function Ho(){var y,P,B,K,pe=w*39+12,Se=Ie[pe];return Se?(w=Se.nextPos,Se.result):(y=w,P=Ti(),P!==s?(B=Is(),B!==s?(K=Ti(),K!==s?(it=y,y=Ge(P,B,K)):(w=y,y=s)):(w=y,y=s)):(w=y,y=s),Ie[pe]={nextPos:w,result:y},y)}function zo(){var y,P,B,K,pe,Se=w*39+13,$e=Ie[Se];return $e?(w=$e.nextPos,$e.result):(y=w,i.substr(w,2)===x?(P=x,w+=2):(P=s,Te===0&&ye(pr)),P!==s?(B=bi(),B!==s?(K=Vo(),K===s&&(K=null),i.charCodeAt(w)===93?(pe=Y,w++):(pe=s,Te===0&&ye(W)),pe!==s?(it=y,y=Me(B,K)):(w=y,y=s)):(w=y,y=s)):(w=y,y=s),Ie[Se]={nextPos:w,result:y},y)}function As(){var y,P,B,K,pe=w*39+14,Se=Ie[pe];return Se?(w=Se.nextPos,Se.result):(y=w,i.charCodeAt(w)===91?(P=Z,w++):(P=s,Te===0&&ye(_e)),P!==s?(B=bi(),B!==s?(i.charCodeAt(w)===93?(K=Y,w++):(K=s,Te===0&&ye(W)),K!==s?(it=y,y=Tt(B)):(w=y,y=s)):(w=y,y=s)):(w=y,y=s),Ie[pe]={nextPos:w,result:y},y)}function Da(){var y,P,B,K=w*39+15,pe=Ie[K];if(pe)return w=pe.nextPos,pe.result;if(y=w,i.charCodeAt(w)===45?w++:Te===0&&ye(vt),P=[],we.test(i.charAt(w))?(B=i.charAt(w),w++):(B=s,Te===0&&ye(rt)),B!==s)for(;B!==s;)P.push(B),we.test(i.charAt(w))?(B=i.charAt(w),w++):(B=s,Te===0&&ye(rt));else P=s;return P!==s?(it=y,y=Er()):(w=y,y=s),Ie[K]={nextPos:w,result:y},y}function xa(){var y,P=w*39+16,B=Ie[P];return B?(w=B.nextPos,B.result):(y=Da(),y===s&&(y=qt()),Ie[P]={nextPos:w,result:y},y)}function Xi(){var y,P,B,K=w*39+17,pe=Ie[K];if(pe)return w=pe.nextPos,pe.result;if(y=w,P=[],B=Rs(),B===s&&(B=xa()),B!==s)for(;B!==s;)P.push(B),B=Rs(),B===s&&(B=xa());else P=s;return P!==s&&(it=y,P=Br(P)),y=P,Ie[K]={nextPos:w,result:y},y}function Rs(){var y,P,B,K,pe=w*39+18,Se=Ie[pe];return Se?(w=Se.nextPos,Se.result):(y=w,i.charCodeAt(w)===40?w++:Te===0&&ye(He),P=xa(),P!==s?(B=Is(),B!==s?(K=Xi(),K!==s?(i.charCodeAt(w)===41?w++:Te===0&&ye(Gt),it=y,y=ba()):(w=y,y=s)):(w=y,y=s)):(w=y,y=s),Ie[pe]={nextPos:w,result:y},y)}function Wo(){var y,P,B,K,pe=w*39+19,Se=Ie[pe];if(Se)return w=Se.nextPos,Se.result;if(y=w,i.charCodeAt(w)===123?(P=h,w++):(P=s,Te===0&&ye(xe)),P!==s){if(B=[],K=Xi(),K===s&&(K=Ei()),K!==s)for(;K!==s;)B.push(K),K=Xi(),K===s&&(K=Ei());else B=s;B!==s?(i.charCodeAt(w)===125?(K=E,w++):(K=s,Te===0&&ye(De)),K!==s?(it=y,y=Hi(B)):(w=y,y=s)):(w=y,y=s)}else w=y,y=s;return Ie[pe]={nextPos:w,result:y},y}function Is(){var y,P=w*39+20,B=Ie[P];return B?(w=B.nextPos,B.result):(i.charCodeAt(w)===43?(y=S,w++):(y=s,Te===0&&ye(Je)),y===s&&(i.charCodeAt(w)===45?(y=d,w++):(y=s,Te===0&&ye(vt)),y===s&&(i.charCodeAt(w)===42?(y=I,w++):(y=s,Te===0&&ye(Re)),y===s&&(i.charCodeAt(w)===47?(y=D,w++):(y=s,Te===0&&ye(Ft)),y===s&&(i.charCodeAt(w)===37?(y=L,w++):(y=s,Te===0&&ye(pt)),y===s&&(i.charCodeAt(w)===94?(y=k,w++):(y=s,Te===0&&ye(mt)),y===s&&(i.charCodeAt(w)===124?(y=_,w++):(y=s,Te===0&&ye(Sr)),y===s&&(i.charCodeAt(w)===38?(y=$,w++):(y=s,Te===0&&ye(Jr)),y===s&&(i.substr(w,2)===ee?(y=ee,w+=2):(y=s,Te===0&&ye(ht)),y===s&&(i.substr(w,2)===ne?(y=ne,w+=2):(y=s,Te===0&&ye(zt))))))))))),Ie[P]={nextPos:w,result:y},y)}function ka(){var y,P,B=w*39+21,K=Ie[B];return K?(w=K.nextPos,K.result):(y=w,P=N(),P===s&&(P=he(),P===s&&(P=ae(),P===s&&(P=oe(),P===s&&(P=z(),P===s&&(P=F(),P===s&&(P=u(),P===s&&(P=Ei(),P===s&&(P=v(),P===s&&(P=g(),P===s&&(P=O(),P===s&&(P=Ti(),P===s&&(P=Wo(),P===s&&(P=Ns()))))))))))))),P!==s&&(it=y,P=_s(P)),y=P,Ie[B]={nextPos:w,result:y},y)}function Ns(){var y,P,B=w*39+22,K=Ie[B];return K?(w=K.nextPos,K.result):(y=w,i.charCodeAt(w)===124?(P=_,w++):(P=s,Te===0&&ye(Sr)),P!==s&&(it=y,P=Ur()),y=P,Ie[B]={nextPos:w,result:y},y)}function Xo(){var y,P,B,K,pe=w*39+23,Se=Ie[pe];return Se?(w=Se.nextPos,Se.result):(y=w,i.charCodeAt(w)===60?(P=re,w++):(P=s,Te===0&&ye(bt)),P!==s?(B=bi(),B!==s?(i.charCodeAt(w)===62?(K=te,w++):(K=s,Te===0&&ye(Fe)),K!==s?(it=y,y=Ss(B)):(w=y,y=s)):(w=y,y=s)):(w=y,y=s),Ie[pe]={nextPos:w,result:y},y)}function u(){var y,P,B=w*39+24,K=Ie[B];return K?(w=K.nextPos,K.result):(y=w,P=f(),P!==s&&(it=y,P=Ta(P)),y=P,Ie[B]={nextPos:w,result:y},y)}function f(){var y,P,B,K=w*39+25,pe=Ie[K];if(pe)return w=pe.nextPos,pe.result;if(y=w,P=[],i.charCodeAt(w)===94?(B=k,w++):(B=s,Te===0&&ye(mt)),B===s&&(i.charCodeAt(w)===95?(B=M,w++):(B=s,Te===0&&ye(Or))),B!==s)for(;B!==s;)P.push(B),i.charCodeAt(w)===94?(B=k,w++):(B=s,Te===0&&ye(mt)),B===s&&(i.charCodeAt(w)===95?(B=M,w++):(B=s,Te===0&&ye(Or)));else P=s;return P!==s&&(it=y,P=va()),y=P,Ie[K]={nextPos:w,result:y},y}function g(){var y,P,B=w*39+26,K=Ie[B];return K?(w=K.nextPos,K.result):(y=w,i.charCodeAt(w)===63?(P=Q,w++):(P=s,Te===0&&ye(Zn)),P!==s&&(it=y,P=Os()),y=P,Ie[B]={nextPos:w,result:y},y)}function O(){var y,P,B,K,pe,Se,$e=w*39+27,Ke=Ie[$e];return Ke?(w=Ke.nextPos,Ke.result):(y=w,i.charCodeAt(w)===40?(P=b,w++):(P=s,Te===0&&ye(He)),P!==s?(B=qt(),B!==s?(i.charCodeAt(w)===44?(K=m,w++):(K=s,Te===0&&ye(qe)),K!==s?(pe=qt(),pe!==s?(i.charCodeAt(w)===41?(Se=R,w++):(Se=s,Te===0&&ye(Gt)),Se!==s?(it=y,y=Ca(B,pe)):(w=y,y=s)):(w=y,y=s)):(w=y,y=s)):(w=y,y=s)):(w=y,y=s),Ie[$e]={nextPos:w,result:y},y)}function T(){var y,P,B,K,pe,Se,$e=w*39+28,Ke=Ie[$e];return Ke?(w=Ke.nextPos,Ke.result):(y=w,P=ka(),P!==s?(i.charCodeAt(w)===58?(B=A,w++):(B=s,Te===0&&ye(dr)),B!==s?(K=Da(),K!==s?(pe=w,Te++,i.charCodeAt(w)===41?(Se=R,w++):(Se=s,Te===0&&ye(Gt)),Se===s&&(i.charCodeAt(w)===93?(Se=Y,w++):(Se=s,Te===0&&ye(W))),Te--,Se===s?pe=void 0:(w=pe,pe=s),pe!==s?(it=y,y=Es(P,K)):(w=y,y=s)):(w=y,y=s)):(w=y,y=s)):(w=y,y=s),Ie[$e]={nextPos:w,result:y},y)}function v(){var y,P,B=w*39+29,K=Ie[B];return K?(w=K.nextPos,K.result):(y=w,P=rn(),P!==s&&(it=y,P=ya(P)),y=P,Ie[B]={nextPos:w,result:y},y)}function N(){var y,P,B,K=w*39+30,pe=Ie[K];return pe?(w=pe.nextPos,pe.result):(y=w,P=rn(),P===s&&(P=null),i.charCodeAt(w)===114?(B=j,w++):(B=s,Te===0&&ye(dt)),B!==s?(it=y,y=Dr(P)):(w=y,y=s),Ie[K]={nextPos:w,result:y},y)}function F(){var y,P,B,K,pe,Se=w*39+31,$e=Ie[Se];return $e?(w=$e.nextPos,$e.result):(y=w,P=f(),P===s&&(P=null),B=rn(),B===s&&(B=null),K=U(),K===s&&(K=null),pe=qt(),pe!==s?(it=y,y=bs(P,B,K,pe)):(w=y,y=s),Ie[Se]={nextPos:w,result:y},y)}function U(){var y,P,B,K=w*39+32,pe=Ie[K];if(pe)return w=pe.nextPos,pe.result;if(y=w,P=[],i.charCodeAt(w)===35?(B=X,w++):(B=s,Te===0&&ye(wr)),B===s&&(i.charCodeAt(w)===98?(B=le,w++):(B=s,Te===0&&ye(hr))),B!==s)for(;B!==s;)P.push(B),i.charCodeAt(w)===35?(B=X,w++):(B=s,Te===0&&ye(wr)),B===s&&(i.charCodeAt(w)===98?(B=le,w++):(B=s,Te===0&&ye(hr)));else P=s;return P!==s&&(it=y,P=Ts(P)),y=P,Ie[K]={nextPos:w,result:y},y}function z(){var y,P,B,K,pe=w*39+33,Se=Ie[pe];if(Se)return w=Se.nextPos,Se.result;if(y=w,P=F(),P!==s){if(B=[],K=F(),K!==s)for(;K!==s;)B.push(K),K=F();else B=s;B!==s?(it=y,y=Aa(P,B)):(w=y,y=s)}else w=y,y=s;return Ie[pe]={nextPos:w,result:y},y}function H(){var y,P,B,K=w*39+34,pe=Ie[K];if(pe)return w=pe.nextPos,pe.result;if(y=w,P=[],je.test(i.charAt(w))?(B=i.charAt(w),w++):(B=s,Te===0&&ye(hi)),B!==s)for(;B!==s;)P.push(B),je.test(i.charAt(w))?(B=i.charAt(w),w++):(B=s,Te===0&&ye(hi));else P=s;return P!==s&&(it=y,P=Ra()),y=P,Ie[K]={nextPos:w,result:y},y}function de(){var y,P,B=w*39+35,K=Ie[B];return K?(w=K.nextPos,K.result):(y=w,ot.test(i.charAt(w))?(P=i.charAt(w),w++):(P=s,Te===0&&ye(wn)),P!==s?(St.test(i.charAt(w))?(i.charAt(w),w++):Te===0&&ye(Yt),it=y,y=vs()):(w=y,y=s),Ie[B]={nextPos:w,result:y},y)}function he(){var y,P,B,K,pe,Se=w*39+36,$e=Ie[Se];return $e?(w=$e.nextPos,$e.result):(y=w,P=f(),P===s&&(P=null),B=rn(),B===s&&(B=null),K=de(),K!==s?(i.charCodeAt(w)===94?w++:Te===0&&ye(mt),pe=H(),pe!==s?(it=y,y=Ia(P,B,K,pe)):(w=y,y=s)):(w=y,y=s),Ie[Se]={nextPos:w,result:y},y)}function oe(){var y,P,B,K,pe,Se=w*39+37,$e=Ie[Se];return $e?(w=$e.nextPos,$e.result):(y=w,P=f(),P===s&&(P=null),B=rn(),B===s&&(B=null),i.substr(w,3)===se?(K=se,w+=3):(K=s,Te===0&&ye(mn)),K===s&&(i.substr(w,2)===Oe?(K=Oe,w+=2):(K=s,Te===0&&ye(qi)),K===s&&(i.substr(w,2)===ke?(K=ke,w+=2):(K=s,Te===0&&ye(fi)),K===s&&(i.charCodeAt(w)===105?(K=Le,w++):(K=s,Te===0&&ye(Vi)),K===s&&(i.substr(w,3)===Ee?(K=Ee,w+=3):(K=s,Te===0&&ye(en)),K===s&&(i.substr(w,2)===Ne?(K=Ne,w+=2):(K=s,Te===0&&ye(Kn)),K===s&&(i.charCodeAt(w)===118?(K=ue,w++):(K=s,Te===0&&ye(gn)))))))),K!==s?(i.charCodeAt(w)===94?w++:Te===0&&ye(mt),pe=H(),pe===s&&(pe=null),it=y,y=Cs(P,B,K,pe)):(w=y,y=s),Ie[Se]={nextPos:w,result:y},y)}function ae(){var y,P,B,K,pe=w*39+38,Se=Ie[pe];return Se?(w=Se.nextPos,Se.result):(y=w,P=f(),P===s&&(P=null),B=rn(),B===s&&(B=null),K=de(),K!==s?(it=y,y=Na(P,B,K)):(w=y,y=s),Ie[pe]={nextPos:w,result:y},y)}var ve=a.nodeOptions||{};function me(y,P,B=void 0){P.text=B||Fr(),P.location=_i();for(var K in ve)(P[K]===void 0||P[K]===null)&&(P[K]=ve[K]);return new y(P)}if(tn=c(),tn!==s&&w===i.length)return tn;throw tn!==s&&we.collect("pitch"))}notes(){return this.evaluated.map(e=>e.collect("note"))}freqs(){return this.evaluated.map(e=>e.collect("freq"))}durations(){return this.evaluated.map(e=>e.collect("duration"))}retrograde(){return this.evaluated=this.evaluated.reverse(),this}scale(e){return this.applyOptions({scale:e}),this}key(e){return this.applyOptions({key:e}),this}octave(e){return this.applyOptions({octave:e}),this}isInOptions(e,t){return this.options.nodeOptions&&this.options.nodeOptions[e]===t}atLast(){return this.index+1>=this.evaluated.length*this.redo}clone(){return yo(this)}notStarted(){return this.index<0}peek(){return this.evaluated[this.index-1||0]}hasStarted(){return this.index>=0}next(){this.index<0&&(this.index=0);const e=this.evaluated[this.index%this.evaluated.length];return this.index++,this.counter++,this.redo>0&&this.index>=this.evaluated.length*this.redo&&(this.index=0,this.evaluated=this.evaluate(this.values)),e}applyOptions(e={}){this.evaluated=this.evaluate(this.evaluated,e),this.applyTransformations()}applyTransformations(){var e;(e=this.globalOptions)!=null&&e.retrograde&&(this.evaluated=this.evaluated.reverse())}update(){return this.evaluated=this.evaluate(this.values),this.applyTransformations(),this}evaluate(e,t={}){let r=e.map(i=>i.evaluate(t)).flat(1/0).filter(i=>i!==void 0);if(t.subdivisions){const i=t.duration?t.duration:qA;r=tR(r,i)}return r}totalDuration(){return this.evaluated.reduce((t,r)=>t+r.collect("duration"),0)}}const tR=(n,e)=>{const t=n.length,r=e/t;return n.map(a=>a instanceof zA?tR(a.items,r):(a.duration=r,a)).flat(1/0)},IP=n=>{let e={};return iP.forEach(t=>{if(n[t]!==void 0){const r=n[t];e[t]=r,delete n[t]}}),e};class NP{constructor(){C(this,"midiAccess",null);C(this,"midiOutputs",[]);C(this,"currentOutputIndex",0);C(this,"scheduledNotes",{});this.initializeMidiAccess()}async initializeMidiAccess(){try{this.midiAccess=await navigator.requestMIDIAccess(),this.midiOutputs=Array.from(this.midiAccess.outputs.values()),this.midiOutputs.length===0&&(console.warn("No MIDI outputs available."),this.currentOutputIndex=-1)}catch(e){console.error("Failed to initialize MIDI:",e)}}getCurrentMidiPort(){return this.midiOutputs.length>0&&this.currentOutputIndex>=0&&this.currentOutputIndex0&&this.currentOutputIndex>=0&&this.currentOutputIndex=this.midiOutputs.length?(console.error(`Invalid MIDI output index. Index must be in the range 0-${this.midiOutputs.length-1}.`),this.currentOutputIndex):e;{const t=this.midiOutputs.findIndex(r=>r.name===e);return t!==-1?t:(console.error(`MIDI output "${e}" not found.`),this.currentOutputIndex)}}listMidiOutputs(){let e="Available MIDI Outputs: ";return this.midiOutputs.forEach((t,r)=>{e+=`(${r+1}) ${t.name} `}),e}sendMidiNote(e,t,r,i,a=this.currentOutputIndex,s=void 0){typeof a=="string"&&(a=this.getMidiOutputIndex(a));const o=this.midiOutputs[a];if(e=Math.min(Math.max(e,0),127),o){const l=[144+t,e,r],c=[128+t,e,0];o.send(l),s&&this.sendPitchBend(s,t,a);const d=setTimeout(()=>{o.send(c),s&&this.sendPitchBend(8192,t,a),delete this.scheduledNotes[e]},(i-.02)*1e3);this.scheduledNotes[e]=d}else console.error("MIDI output not available.")}sendSysExMessage(e){const t=this.midiOutputs[this.currentOutputIndex];t?t.send(e):console.error("MIDI output not available.")}sendPitchBend(e,t,r=this.currentOutputIndex){(e<0||e>16383)&&console.error("Invalid pitch bend value. Value must be in the range 0-16383."),(t<0||t>15)&&console.error("Invalid MIDI channel. Channel must be in the range 0-15."),typeof r=="string"&&(r=this.getMidiOutputIndex(r));const i=this.midiOutputs[r];if(i){const a=e&127,s=e>>7&127;i.send([224|t,a,s])}else console.error("MIDI output not available.")}sendProgramChange(e,t){const r=this.midiOutputs[this.currentOutputIndex];r?r.send([192+t,e]):console.error("MIDI output not available.")}sendMidiControlChange(e,t,r){const i=this.midiOutputs[this.currentOutputIndex];i?i.send([176+r,e,t]):console.error("MIDI output not available.")}panic(){const e=this.midiOutputs[this.currentOutputIndex];if(e){for(const t in this.scheduledNotes){const r=this.scheduledNotes[t];clearTimeout(r),e.send([128,parseInt(t),0])}this.scheduledNotes={}}else console.error("MIDI output not available.")}}class wP{constructor(e,t,r){C(this,"min");C(this,"max");C(this,"wrap");C(this,"position");this.min=e,this.max=t,this.wrap=r,this.position=0}step(){const e=Math.floor(Math.random()*3)-1;this.position+=e,this.wrap?this.position>this.max?this.position=this.min:this.positionthis.max&&(this.position=this.max)}getPosition(){return this.position}toggleWrap(e){this.wrap=e}}const DP={major:[0,2,4,5,7,9,11],naturalMinor:[0,2,3,5,7,8,10],harmonicMinor:[0,2,3,5,7,8,11],melodicMinor:[0,2,3,5,7,9,11],dorian:[0,2,3,5,7,9,10],phrygian:[0,1,3,5,7,8,10],lydian:[0,2,4,6,7,9,11],mixolydian:[0,2,4,5,7,9,10],aeolian:[0,2,3,5,7,8,10],locrian:[0,1,3,5,6,8,10],wholeTone:[0,2,4,6,8,10],majorPentatonic:[0,2,4,7,9],minorPentatonic:[0,3,5,7,10],chromatic:[0,1,2,3,4,5,6,7,8,9,10,11],blues:[0,3,5,6,7,10],diminished:[0,2,3,5,6,8,9,11],neapolitanMinor:[0,1,3,5,7,8,11],neapolitanMajor:[0,1,3,5,7,9,11],enigmatic:[0,1,4,6,8,10,11],doubleHarmonic:[0,1,4,5,7,8,11],octatonic:[0,2,3,5,6,8,9,11],bebopDominant:[0,2,4,5,7,9,10,11],bebopMajor:[0,2,4,5,7,8,9,11],bebopMinor:[0,2,3,5,7,8,9,11],bebopDorian:[0,2,3,4,5,7,9,10],harmonicMajor:[0,2,4,5,7,8,11],hungarianMinor:[0,2,3,6,7,8,11],hungarianMajor:[0,3,4,6,7,9,10],oriental:[0,1,4,5,6,9,10],romanianMinor:[0,2,3,6,7,9,10],spanishGypsy:[0,1,4,5,7,8,10],jewish:[0,1,4,5,7,8,10],hindu:[0,2,4,5,7,8,10],japanese:[0,1,5,7,8],hirajoshi:[0,2,3,7,8],kumoi:[0,2,3,7,9],inSen:[0,1,5,7,10],iwato:[0,1,5,6,10],yo:[0,2,5,7,9],minorBlues:[0,3,5,6,7,10],algerian:[0,2,3,5,6,7,8,11],augmented:[0,3,4,7,8,11],balinese:[0,1,3,7,8],byzantine:[0,1,4,5,7,8,11],chinese:[0,4,6,7,11],egyptian:[0,2,5,7,10],eightToneSpanish:[0,1,3,4,5,6,8,10],hawaiian:[0,2,3,5,7,9,10],hindustan:[0,2,4,5,7,8,10],persian:[0,1,4,5,6,8,11],eastIndianPurvi:[0,1,4,6,7,8,11],orientalA:[0,1,4,5,6,9,10]};function xP(n,e="major",t=4){const r=DP[e];if(!r)throw new Error(`Unknown scale ${e}`);let i=n%r.length;i<0&&(i+=r.length);let a=Math.floor(n/r.length);return 60+(t+a)*12+r[i]}class xg{constructor(e){C(this,"seedValue");C(this,"randomGen",Math.random);C(this,"app");C(this,"values",{});C(this,"odds",(e,t)=>this.randomGen()this.odds(.025,e));C(this,"rarely",e=>this.odds(.1,e));C(this,"scarcely",e=>this.odds(.25,e));C(this,"sometimes",e=>this.odds(.5,e));C(this,"often",e=>this.odds(.75,e));C(this,"frequently",e=>this.odds(.9,e));C(this,"almostAlways",e=>this.odds(.985,e));C(this,"modify",e=>e(this));C(this,"seed",e=>(this.seedValue=e.toString(),this.randomGen=this.app.api.localSeededRandom(this.seedValue),this));C(this,"clear",()=>(this.app.api.clearLocalSeed(this.seedValue),this));C(this,"apply",e=>this.modify(e));C(this,"length",e=>(this.values.length=e,this));this.app=e,this.app.api.currentSeed&&(this.randomGen=this.app.api.randomGen)}}class rR extends xg{constructor(t){super(t);C(this,"octave",t=>(this.values.octave=t,this.update(),this));C(this,"key",t=>(this.values.key=t,this.update(),this));C(this,"scale",t=>(Ag(t)?(this.values.scaleName=t,this.values.parsedScale=zn(t)):this.values.parsedScale=Rg(t),this.update(),this));C(this,"freq",t=>{this.values.freq=t;const r=uP(t);return r%1!==0?(this.values.note=Math.floor(r),this.values.bend=WA(r)[1]):this.values.note=r,this});C(this,"update",()=>{})}}let Cr=[],kP=(n,e)=>{let t,r=[],i={lc:0,l:e||0,value:n,set(a){i.value=a,i.notify()},get(){return i.lc||i.listen(()=>{})(),i.value},notify(a){t=r;let s=!Cr.length;for(let o=0;o{r===t&&(r=r.slice());let o=r.indexOf(a);~o&&(r.splice(o,2),i.lc--,i.lc||i.off())}},subscribe(a,s){let o=i.listen(a,s);return a(i.value),o},off(){}};return i},LP=(n={})=>{let e=kP(n);return e.setKey=function(t,r){typeof r>"u"?t in e.value&&(e.value={...e.value},delete e.value[t],e.notify(t)):e.value[t]!==r&&(e.value={...e.value,[t]:r},e.notify(t))},e};if(typeof DelayNode<"u"){class n extends DelayNode{constructor(t,r,i,a){super(t),r=Math.abs(r),this.delayTime.value=i;const s=t.createGain();s.gain.value=Math.min(Math.abs(a),.995),this.feedback=s.gain;const o=t.createGain();return o.gain.value=r,this.delayGain=o,this.connect(s),this.connect(o),s.connect(this),this.connect=l=>o.connect(l),this}start(t){this.delayGain.gain.setValueAtTime(this.delayGain.gain.value,t+this.delayTime.value)}}AudioContext.prototype.createFeedbackDelay=function(e,t,r){return new n(this,e,t,r)}}typeof AudioContext<"u"&&(AudioContext.prototype.impulseResponse=function(n,e=1){const t=this.sampleRate*n,r=this.createBuffer(e,t,this.sampleRate),i=r.getChannelData(0);for(let a=0;a(e.buffer=this.impulseResponse(t),e.duration=n,e),e.setDuration(n),e});var GO={a:{freqs:[660,1120,2750,3e3,3350],gains:[1,.5012,.0708,.0631,.0126],qs:[80,90,120,130,140]},e:{freqs:[440,1800,2700,3e3,3300],gains:[1,.1995,.1259,.1,.1],qs:[70,80,100,120,120]},i:{freqs:[270,1850,2900,3350,3590],gains:[1,.0631,.0631,.0158,.0158],qs:[40,90,100,120,120]},o:{freqs:[430,820,2700,3e3,3300],gains:[1,.3162,.0501,.0794,.01995],qs:[40,80,100,120,120]},u:{freqs:[370,630,2750,3e3,3400],gains:[1,.1,.0708,.0316,.01995],qs:[40,60,100,120,120]}};if(typeof GainNode<"u"){class n extends GainNode{constructor(t,r){if(super(t),!GO[r])throw new Error("vowel: unknown vowel "+r);const{gains:i,qs:a,freqs:s}=GO[r],o=t.createGain();for(let l=0;l<5;l++){const c=t.createGain();c.gain.value=i[l];const d=t.createBiquadFilter();d.type="bandpass",d.Q.value=a[l],d.frequency.value=s[l],this.connect(d),d.connect(c),c.connect(o)}return o.gain.value=8,this.connect=l=>o.connect(l),this}}AudioContext.prototype.createVowelFilter=function(e){return new n(this,e)}}const MP=n=>{var i;if(typeof n!="string")return[];const[e,t="",r]=((i=n.match(/^([a-gA-G])([#bsf]*)([0-9]*)$/))==null?void 0:i.slice(1))||[];return e?[e,t,r?Number(r):void 0]:[]},PP={c:0,d:2,e:4,f:5,g:7,a:9,b:11},BP={"#":1,b:-1,s:1,f:-1},Mc=(n,e=3)=>{const[t,r,i=e]=MP(n);if(!t)throw new Error('not a note: "'+n+'"');const a=PP[t.toLowerCase()],s=(r==null?void 0:r.split("").reduce((o,l)=>o+BP[l],0))||0;return(Number(i)+1)*12+a+s},nR=n=>Math.pow(2,(n-69)/12)*440,UP=(n,e,t)=>Math.min(Math.max(n,e),t),FP=n=>12*Math.log(n/440)/Math.LN2+69,YP=(n,e)=>{if(typeof n!="object")throw new Error("valueToMidi: expected object value");let{freq:t,note:r}=n;if(typeof t=="number")return FP(t);if(typeof r=="string")return Mc(r);if(typeof r=="number")return r;if(!e)throw new Error("valueToMidi: expected freq or note to be set");return e},GP="data:application/javascript;base64,Ly8gTElDRU5TRSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSB2My4wIHNlZSBodHRwczovL2dpdGh1Yi5jb20vZGt0cjAvV2ViRGlydC9ibG9iL21haW4vTElDRU5TRQovLyBhbGwgdGhlIGNyZWRpdCBnb2VzIHRvIGRrdHIwJ3Mgd2ViZGlydDogaHR0cHM6Ly9naXRodWIuY29tL2RrdHIwL1dlYkRpcnQvYmxvYi81Y2UzZDY5ODM2MmM1NGQ2ZTFiNjhhY2M0N2ViMjk1NWFjNjJjNzkzL2Rpc3QvQXVkaW9Xb3JrbGV0cy5qcwovLyA8MwoKY2xhc3MgQ29hcnNlUHJvY2Vzc29yIGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgZ2V0IHBhcmFtZXRlckRlc2NyaXB0b3JzKCkgewogICAgcmV0dXJuIFt7IG5hbWU6ICdjb2Fyc2UnLCBkZWZhdWx0VmFsdWU6IDEgfV07CiAgfQoKICBjb25zdHJ1Y3RvcigpIHsKICAgIHN1cGVyKCk7CiAgICB0aGlzLm5vdFN0YXJ0ZWQgPSB0cnVlOwogIH0KCiAgcHJvY2VzcyhpbnB1dHMsIG91dHB1dHMsIHBhcmFtZXRlcnMpIHsKICAgIGNvbnN0IGlucHV0ID0gaW5wdXRzWzBdOwogICAgY29uc3Qgb3V0cHV0ID0gb3V0cHV0c1swXTsKICAgIGNvbnN0IGNvYXJzZSA9IHBhcmFtZXRlcnMuY29hcnNlOwogICAgY29uc3QgYmxvY2tTaXplID0gMTI4OwogICAgY29uc3QgaGFzSW5wdXQgPSAhKGlucHV0WzBdID09PSB1bmRlZmluZWQpOwogICAgaWYgKGhhc0lucHV0KSB7CiAgICAgIHRoaXMubm90U3RhcnRlZCA9IGZhbHNlOwogICAgICBvdXRwdXRbMF1bMF0gPSBpbnB1dFswXVswXTsKICAgICAgZm9yIChsZXQgbiA9IDE7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgIGZvciAobGV0IG8gPSAwOyBvIDwgb3V0cHV0Lmxlbmd0aDsgbysrKSB7CiAgICAgICAgICBvdXRwdXRbb11bbl0gPSBuICUgY29hcnNlID09IDAgPyBpbnB1dFswXVtuXSA6IG91dHB1dFtvXVtuIC0gMV07CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ2NvYXJzZS1wcm9jZXNzb3InLCBDb2Fyc2VQcm9jZXNzb3IpOwoKY2xhc3MgQ3J1c2hQcm9jZXNzb3IgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3IgewogIHN0YXRpYyBnZXQgcGFyYW1ldGVyRGVzY3JpcHRvcnMoKSB7CiAgICByZXR1cm4gW3sgbmFtZTogJ2NydXNoJywgZGVmYXVsdFZhbHVlOiAwIH1dOwogIH0KCiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5ub3RTdGFydGVkID0gdHJ1ZTsKICB9CgogIHByb2Nlc3MoaW5wdXRzLCBvdXRwdXRzLCBwYXJhbWV0ZXJzKSB7CiAgICBjb25zdCBpbnB1dCA9IGlucHV0c1swXTsKICAgIGNvbnN0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBjcnVzaCA9IHBhcmFtZXRlcnMuY3J1c2g7CiAgICBjb25zdCBibG9ja1NpemUgPSAxMjg7CiAgICBjb25zdCBoYXNJbnB1dCA9ICEoaW5wdXRbMF0gPT09IHVuZGVmaW5lZCk7CiAgICBpZiAoaGFzSW5wdXQpIHsKICAgICAgdGhpcy5ub3RTdGFydGVkID0gZmFsc2U7CiAgICAgIGlmIChjcnVzaC5sZW5ndGggPT09IDEpIHsKICAgICAgICBjb25zdCB4ID0gTWF0aC5wb3coMiwgY3J1c2hbMF0gLSAxKTsKICAgICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgICBjb25zdCB2YWx1ZSA9IE1hdGgucm91bmQoaW5wdXRbMF1bbl0gKiB4KSAvIHg7CiAgICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgICBvdXRwdXRbb11bbl0gPSB2YWx1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0gZWxzZSB7CiAgICAgICAgZm9yIChsZXQgbiA9IDA7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgICAgbGV0IHggPSBNYXRoLnBvdygyLCBjcnVzaFtuXSAtIDEpOwogICAgICAgICAgY29uc3QgdmFsdWUgPSBNYXRoLnJvdW5kKGlucHV0WzBdW25dICogeCkgLyB4OwogICAgICAgICAgZm9yIChsZXQgbyA9IDA7IG8gPCBvdXRwdXQubGVuZ3RoOyBvKyspIHsKICAgICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQpyZWdpc3RlclByb2Nlc3NvcignY3J1c2gtcHJvY2Vzc29yJywgQ3J1c2hQcm9jZXNzb3IpOwoKY2xhc3MgU2hhcGVQcm9jZXNzb3IgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3IgewogIHN0YXRpYyBnZXQgcGFyYW1ldGVyRGVzY3JpcHRvcnMoKSB7CiAgICByZXR1cm4gW3sgbmFtZTogJ3NoYXBlJywgZGVmYXVsdFZhbHVlOiAwIH1dOwogIH0KCiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5ub3RTdGFydGVkID0gdHJ1ZTsKICB9CgogIHByb2Nlc3MoaW5wdXRzLCBvdXRwdXRzLCBwYXJhbWV0ZXJzKSB7CiAgICBjb25zdCBpbnB1dCA9IGlucHV0c1swXTsKICAgIGNvbnN0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBzaGFwZTAgPSBwYXJhbWV0ZXJzLnNoYXBlWzBdOwogICAgY29uc3Qgc2hhcGUxID0gc2hhcGUwIDwgMSA/IHNoYXBlMCA6IDEuMCAtIDRlLTEwOwogICAgY29uc3Qgc2hhcGUgPSAoMi4wICogc2hhcGUxKSAvICgxLjAgLSBzaGFwZTEpOwogICAgY29uc3QgYmxvY2tTaXplID0gMTI4OwogICAgY29uc3QgaGFzSW5wdXQgPSAhKGlucHV0WzBdID09PSB1bmRlZmluZWQpOwogICAgaWYgKGhhc0lucHV0KSB7CiAgICAgIHRoaXMubm90U3RhcnRlZCA9IGZhbHNlOwogICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgY29uc3QgdmFsdWUgPSAoKDEgKyBzaGFwZSkgKiBpbnB1dFswXVtuXSkgLyAoMSArIHNoYXBlICogTWF0aC5hYnMoaW5wdXRbMF1bbl0pKTsKICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ3NoYXBlLXByb2Nlc3NvcicsIFNoYXBlUHJvY2Vzc29yKTsK";function mc(n){const e=Ht().createGain();return e.gain.value=n,e}const _m=(n,e,t,r,i,a)=>{const s=Ht().createGain();return s.gain.setValueAtTime(0,a),s.gain.linearRampToValueAtTime(i,a+n),s.gain.linearRampToValueAtTime(t*i,a+n+e),{node:s,stop:o=>{s.gain.setValueAtTime(t*i,o),s.gain.linearRampToValueAtTime(0,o+r)}}},$P=(n,e,t,r,i,a)=>{t=Math.max(.001,t),i=Math.max(.001,i);const s=Ht().createGain();return s.gain.setValueAtTime(1e-4,a),s.gain.exponentialRampToValueAtTime(i,a+n),s.gain.exponentialRampToValueAtTime(t*i,a+n+e),{node:s,stop:o=>{s.gain.exponentialRampToValueAtTime(1e-4,o+r)}}},Cu=(n,e,t)=>{const r=Ht().createBiquadFilter();return r.type=n,r.frequency.value=e,r.Q.value=t,r};let QP=n=>console.log(n);const ps=(...n)=>QP(...n),kg=LP();function Lg(n,e,t={}){kg.setKey(n,{onTrigger:e,data:t})}function $O(n){return kg.get()[n]}let yu;const Ht=()=>(yu||(yu=new AudioContext),yu);let Ol;const Mg=()=>{const n=Ht();return Ol||(Ol=n.createGain(),Ol.connect(n.destination)),Ol};let Au;function qP(){return Au||(Au=Ht().audioWorklet.addModule(GP),Au)}function Ru(n,e,t){const r=new AudioWorkletNode(n,e);return Object.entries(t).forEach(([i,a])=>{r.parameters.get(i).value=a}),r}async function VP(n={}){const{disableWorklets:e=!1}=n;typeof window<"u"&&(await Ht().resume(),e?console.log("disableWorklets: AudioWorklet effects coarse, crush and shape are skipped!"):await qP().catch(t=>{console.warn("could not load AudioWorklet effects coarse, crush and shape",t)}))}async function HP(n){return new Promise(e=>{document.addEventListener("click",async function t(){await VP(n),e(),document.removeEventListener("click",t)})})}let ji={};function zP(n,e,t,r){var i;if(t=UP(t,0,.98),!ji[n]){const a=Ht().createFeedbackDelay(1,e,t);(i=a.start)==null||i.call(a,r),a.connect(Mg()),ji[n]=a}return ji[n].delayTime.value!==e&&ji[n].delayTime.setValueAtTime(e,r),ji[n].feedback.value!==t&&ji[n].feedback.setValueAtTime(t,r),ji[n]}let Ji={};function WP(n,e=2){if(!Ji[n]){const t=Ht().createReverb(e);t.connect(Mg()),Ji[n]=t}return Ji[n].duration!==e&&(Ji[n]=Ji[n].setDuration(e),Ji[n].duration=e),Ji[n]}let ea;function XP(n=2048){if(!ea){const e=Ht().createAnalyser();e.fftSize=n,ea=e,new Float32Array(ea.frequencyBinCount)}return ea.fftSize!==n&&(ea.fftSize=n,new Float32Array(ea.frequencyBinCount)),ea}function Iu(n,e,t){const r=mc(t);return n.connect(r),r.connect(e),r}const QO=async(n,e,t)=>{const r=Ht();if(typeof n!="object")throw new Error(`expected hap.value to be an object, but got "${n}". Hint: append .note() or .s() to the end`,"error");n.duration=t;let i=r.currentTime+e,{s:a="triangle",bank:s,source:o,gain:l=.8,cutoff:c,resonance:d=1,hcutoff:p,hresonance:m=1,bandf:_,bandq:b=1,coarse:A,crush:R,shape:x,pan:Y,vowel:Z,delay:h=0,delayfeedback:E=.5,delaytime:S=.25,orbit:I=1,room:D,size:L=2,velocity:k=1,analyze:$,fft:ee=8}=n;l*=k;let ne=[];const re=()=>{ne.forEach(se=>se==null?void 0:se.disconnect())};s&&a&&(a=`${s}_${a}`);let te;if(o)te=o(i,n,t);else if($O(a)){const{onTrigger:se}=$O(a),Oe=await se(i,n,re);Oe&&(te=Oe.node,Oe.stop(i+t))}else throw new Error(`sound ${a} not found! Is it loaded?`);if(!te)return;if(r.currentTime>i){ps("[webaudio] skip hap: still loading",r.currentTime-i);return}const M=[];if(M.push(te),M.push(mc(l)),c!==void 0&&M.push(Cu("lowpass",c,d)),p!==void 0&&M.push(Cu("highpass",p,m)),_!==void 0&&M.push(Cu("bandpass",_,b)),Z!==void 0&&M.push(r.createVowelFilter(Z)),A!==void 0&&M.push(Ru(r,"coarse-processor",{coarse:A})),R!==void 0&&M.push(Ru(r,"crush-processor",{crush:R})),x!==void 0&&M.push(Ru(r,"shape-processor",{shape:x})),Y!==void 0){const se=r.createStereoPanner();se.pan.value=2*Y-1,M.push(se)}const Q=mc(1);M.push(Q),Q.connect(Mg());let j;if(h>0&&S>0&&E>0){const se=zP(I,S,E,i);j=Iu(Q,se,h)}let X;if(D>0&&L>0){const se=WP(I,L);X=Iu(Q,se,D)}let le;if($){const se=XP(2**(ee+5));le=Iu(Q,se,$)}M.slice(1).reduce((se,Oe)=>se.connect(Oe),M[0]),ne=M.concat([j,X,le])},Nu={};function ZP(n,e){var t=e?1e3:1024;if(n=t);return n.toFixed(1)+" "+r[i]}const KP=async(n,e,t,r,i,a,s)=>{let o=0;i!==void 0&&t!==void 0&&ps("[sampler] hap has note and freq. ignoring note","warning");let l=YP({freq:i,note:t},36);o=l-36;const c=Ht();let d;if(Array.isArray(a))d=a[e%a.length];else{const b=R=>Mc(R)-l,A=Object.keys(a).filter(R=>!R.startsWith("_")).reduce((R,x,Y)=>!R||Math.abs(b(x)){const i=t?`sound "${t}:${r}"`:"sample";if(!Nu[n]){ps(`[sampler] load ${i}..`,"load-sample",{url:n});const a=Date.now();Nu[n]=fetch(n).then(s=>s.arrayBuffer()).then(async s=>{const o=Date.now()-a,l=ZP(s.byteLength);return ps(`[sampler] load ${i}... done! loaded ${l} in ${o}ms`,"loaded-sample",{url:n}),await e.decodeAudioData(s)})}return Nu[n]};function JP(n){const e=Ht(),t=e.createBuffer(n.numberOfChannels,n.length,e.sampleRate);for(let r=0;rObject.entries(n).forEach(([r,i])=>{if(typeof i=="string"&&(i=[i]),typeof i!="object")throw new Error("wrong sample map format for "+r);t=i._base||t;const a=s=>(t+s).replace("github:","https://raw.githubusercontent.com/");Array.isArray(i)?i=i.map(a):i=Object.fromEntries(Object.entries(i).map(([s,o])=>[s,(typeof o=="string"?[o]:o).map(a)])),e(r,i)});let t3={};function r3(n){const e=Object.entries(t3).find(([t])=>n.startsWith(t));if(e)return e[1]}const io=async(n,e=n._base||"",t={})=>{if(typeof n=="string"){const a=r3(n);if(a)return a(n);if(n.startsWith("github:")){let[o,l]=n.split("github:");l=l.endsWith("/")?l.slice(0,-1):l,n=`https://raw.githubusercontent.com/${l}/strudel.json`}if(typeof fetch!="function")return;const s=n.split("/").slice(0,-1).join("/");return typeof fetch>"u"?void 0:fetch(n).then(o=>o.json()).then(o=>io(o,e||o._base||s,t)).catch(o=>{throw console.error(o),new Error(`error loading "${n}"`)})}const{prebake:r,tag:i}=t;e3(n,(a,s)=>Lg(a,(o,l,c)=>n3(o,l,c,s),{type:"sample",samples:s,baseUrl:e,prebake:r,tag:i}),e)},qO=[];async function n3(n,e,t,r,i){const{s:a,freq:s,unit:o,nudge:l=0,cut:c,loop:d,clip:p=void 0,n:m=0,note:_,speed:b=1,begin:A=0,end:R=1}=e;if(b===0)return;const x=Ht(),{attack:Y=.001,decay:Z=.001,sustain:h=1,release:E=.001}=e,S=n+l,I=await KP(a,m,_,b,s,r,i);if(x.currentTime>n){ps(`[sampler] still loading sound "${a}:${m}"`,"highlight");return}if(!I){ps(`[sampler] could not load "${a}:${m}"`,"error");return}I.playbackRate.value=Math.abs(b)*I.playbackRate.value,o==="c"&&(I.playbackRate.value=I.playbackRate.value*I.buffer.duration*1);const D=A*I.buffer.duration;I.start(S,D);const L=I.buffer.duration/I.playbackRate.value,{node:k,stop:$}=_m(Y,Z,h,E,1,n);I.connect(k);const ee=x.createGain();k.connect(ee),I.onended=function(){I.disconnect(),k.disconnect(),ee.disconnect(),t()};const ne={node:ee,bufferSource:I,stop:(re,te=p===void 0)=>{let M=re;te&&(M=n+(R-A)*L),I.stop(M+E),$(M)}};if(c!==void 0){const re=qO[c];re&&(re.node.gain.setValueAtTime(1,S),re.node.gain.linearRampToValueAtTime(0,S+.01)),qO[c]=ne}return ne}const i3=(n,e=1,t="sine")=>{const r=Ht(),i=r.createOscillator();i.type=t,i.frequency.value=n,i.start();const a=new GainNode(r,{gain:e});return i.connect(a),{node:a,stop:s=>i.stop(s)}},a3=(n,e,t,r="sine")=>{const i=n.frequency.value*e,a=i*t;return i3(i,a,r)};function s3(){["sine","square","triangle","sawtooth"].forEach(n=>{Lg(n,(e,t,r)=>{let{attack:i=.001,decay:a=.05,sustain:s=.6,release:o=.01,fmh:l=1,fmi:c,fmenv:d="lin",fmattack:p,fmdecay:m,fmsustain:_,fmrelease:b,fmvelocity:A,fmwave:R="sine"}=t,{n:x,note:Y,freq:Z}=t;Y=Y||36,typeof Y=="string"&&(Y=Mc(Y)),!Z&&typeof Y=="number"&&(Z=nR(Y));const{node:h,stop:E}=l3({t:e,s:n,freq:Z,partials:x});let S,I;if(c){const{node:$,stop:ee}=a3(h,l,c,R);[p,m,_,b,A].find(ne=>ne!==void 0)?(p=p??.001,m=m??.001,_=_??1,b=b??.001,A=A??1,I=_m(p,m,_,b,A,e),d==="exp"&&(I=$P(p,m,_,b,A,e),I.node.maxValue=c*2,I.node.minValue=1e-5),$.connect(I.node),I.node.connect(h.frequency)):$.connect(h.frequency),S=ee}const D=mc(.3),{node:L,stop:k}=_m(i,a,s,o,1,e);return h.onended=()=>{h.disconnect(),D.disconnect(),r()},{node:h.connect(D).connect(L),stop:$=>{k($),I==null||I.stop($);let ee=$+o;E(ee),S==null||S(ee)}}},{type:"synth",prebake:!0})})}function o3(n,e){const t=new Float32Array(n+1),r=new Float32Array(n+1),i=Ht(),a=i.createOscillator(),s={sawtooth:c=>1/c,square:c=>c%2===0?0:1/c,triangle:c=>c%2===0?0:1/(c*c)};if(!s[e])throw new Error(`unknown wave type ${e}`);t[0]=0,r[0]=0;let o=1;for(;o<=n;)t[o]=s[e](o),r[o]=0,o++;const l=i.createPeriodicWave(t,r);return a.setPeriodicWave(l),a}function l3({s:n,freq:e,t,partials:r}){let i;return!r||n==="sine"?(i=Ht().createOscillator(),i.type=n||"triangle"):i=o3(r,n),i.frequency.value=Number(e),i.start(t),{node:i,stop:a=>i.stop(a)}}function c3(n=1,e=.05,t=220,r=0,i=0,a=.1,s=0,o=1,l=0,c=0,d=0,p=0,m=0,_=0,b=0,A=0,R=0,x=1,Y=0,Z=0){let h=Math.PI*2,E=Ht().sampleRate,S=X=>X>0?1:-1,I=l*=500*h/E/E,D=t*=(1+e*2*Math.random()-e)*h/E,L=[],k=0,$=0,ee=0,ne=1,re=0,te=0,M=0,Q,j;for(r=r*E+9,Y*=E,i*=E,a*=E,R*=E,c*=500*h/E**3,b*=h/E,d*=h/E,p*=E,m=m*E|0,j=r+Y+i+a+R|0;ee1?s>2?s>3?Math.sin((k%h)**3):Math.max(Math.min(Math.tan(k),1),-1):1-(2*k/h%2+2)%2:1-4*Math.abs(Math.round(k/h)-k/h):Math.sin(k),M=(m?1-Z+Z*Math.sin(h*ee/m):1)*S(M)*Math.abs(M)**o*n*1*(eeee?0:(eep&&(t+=d,D+=d,ne=0),m&&!(++re%m)&&(t=D,l=I,ne||(ne=1));return L}const u3=(n,e)=>{let{s:t,note:r=36,freq:i,zrand:a=0,attack:s=0,decay:o=0,sustain:l=.8,release:c=.1,curve:d=1,slide:p=0,deltaSlide:m=0,pitchJump:_=0,pitchJumpTime:b=0,lfo:A=0,noise:R=0,zmod:x=0,zcrush:Y=0,zdelay:Z=0,tremolo:h=0,duration:E=.2,zzfx:S}=n;const I=Math.max(E-s-o,0);typeof r=="string"&&(r=Mc(r)),!i&&typeof r=="number"&&(i=nR(r)),t=t.replace("z_","");const D=["sine","triangle","sawtooth","tan","noise"].indexOf(t)||0;d=t==="square"?0:d;const L=c3(...S||[.25,a,i,s,I,c,D,d,p,m,_,b,A,R,x,Y,Z,l,o,h]),k=Ht(),$=k.createBuffer(1,L.length,k.sampleRate);$.getChannelData(0).set(L);const ee=Ht().createBufferSource();return ee.buffer=$,ee.start(e),{node:ee}};function d3(){["zzfx","z_sine","z_sawtooth","z_triangle","z_square","z_tan","z_noise"].forEach(n=>{Lg(n,(e,t,r)=>{const{node:i}=u3({s:n,...t},e);return i.onended=()=>{i.disconnect(),r()},{node:i,stop:()=>{}}},{type:"synth",prebake:!0})})}class Sm extends rR{constructor(t,r){super(r);C(this,"volume",t=>this.updateValue("volume",t));C(this,"vol",this.volume);C(this,"zrand",t=>this.updateValue("zrand",t));C(this,"curve",t=>this.updateValue("curve",t));C(this,"slide",t=>this.updateValue("slide",t));C(this,"sld",this.slide);C(this,"deltaSlide",t=>this.updateValue("deltaSlide",t));C(this,"dslide",this.deltaSlide);C(this,"pitchJump",t=>this.updateValue("pitchJump",t));C(this,"pj",this.pitchJump);C(this,"pitchJumpTime",t=>this.updateValue("pitchJumpTime",t));C(this,"pjt",this.pitchJumpTime);C(this,"lfo",t=>this.updateValue("lfo",t));C(this,"noise",t=>this.updateValue("noise",t));C(this,"zmod",t=>this.updateValue("zmod",t));C(this,"zcrush",t=>this.updateValue("zcrush",t));C(this,"zdelay",t=>this.updateValue("zdelay",t));C(this,"sustainVolume",t=>this.updateValue("sustainVolume",t));C(this,"decay",t=>this.updateValue("decay",t));C(this,"dec",this.decay);C(this,"tremolo",t=>this.updateValue("tremolo",t));C(this,"duration",t=>this.updateValue("duration",t));C(this,"zzfx",t=>this.updateValue("zzfx",t));C(this,"fmi",t=>this.updateValue("fmi",t));C(this,"fmh",t=>this.updateValue("fmh",t));C(this,"fmenv",t=>this.updateValue("fmenv",t));C(this,"fmattack",t=>this.updateValue("fmattack",t));C(this,"fmatk",this.fmattack);C(this,"fmdecay",t=>this.updateValue("fmdecay",t));C(this,"fmdec",this.fmdecay);C(this,"fmsustain",t=>this.updateValue("fmsustain",t));C(this,"fmsus",this.fmsustain);C(this,"fmrelease",t=>this.updateValue("fmrelease",t));C(this,"fmrel",this.fmrelease);C(this,"fmvelocity",t=>this.updateValue("fmvelocity",t));C(this,"fmvel",this.fmvelocity);C(this,"fmwave",t=>this.updateValue("fmwave",t));C(this,"fmw",this.fmwave);C(this,"attack",t=>this.updateValue("attack",t));C(this,"atk",this.attack);C(this,"release",t=>this.updateValue("release",t));C(this,"rel",this.release);C(this,"sustain",t=>this.updateValue("sustain",t));C(this,"sus",this.sustain);C(this,"unit",t=>this.updateValue("unit",t));C(this,"u",this.unit);C(this,"freq",t=>this.updateValue("freq",t));C(this,"f",this.freq);C(this,"fm",t=>{if(typeof t=="number")this.values.fmi=t;else{let r=t.split(":");this.values.fmi=parseFloat(r[0]),r.length>1&&(this.values.fmh=parseFloat(r[1]))}return this});C(this,"sound",t=>this.updateValue("s",t));C(this,"chord",t=>this.updateValue("chord",t));C(this,"snd",this.sound);C(this,"nudge",t=>this.updateValue("nudge",t));C(this,"cut",t=>this.updateValue("cut",t));C(this,"loop",t=>this.updateValue("loop",t));C(this,"clip",t=>this.updateValue("clip",t));C(this,"n",t=>this.updateValue("n",t));C(this,"note",t=>this.updateValue("note",t));C(this,"speed",t=>this.updateValue("speed",t));C(this,"spd",this.speed);C(this,"begin",t=>this.updateValue("begin",t));C(this,"end",t=>this.updateValue("end",t));C(this,"gain",t=>this.updateValue("gain",t));C(this,"dbgain",t=>this.updateValue("gain",Math.min(Math.pow(10,t/20),10)));C(this,"db",this.dbgain);C(this,"cutoff",t=>this.updateValue("cutoff",t));C(this,"lpf",this.cutoff);C(this,"resonance",t=>this.updateValue("resonance",Math.min(Math.max(t,0),50)));C(this,"lpq",this.resonance);C(this,"hcutoff",t=>this.updateValue("hcutoff",t));C(this,"hpf",this.hcutoff);C(this,"hresonance",t=>this.updateValue("hresonance",t));C(this,"hpq",this.hresonance);C(this,"bandf",t=>this.updateValue("bandf",t));C(this,"bpf",this.bandf);C(this,"bandq",t=>this.updateValue("bandq",t));C(this,"bpq",this.bandq);C(this,"coarse",t=>this.updateValue("coarse",t));C(this,"crush",t=>this.updateValue("crush",t));C(this,"shape",t=>this.updateValue("shape",t));C(this,"pan",t=>this.updateValue("pan",t));C(this,"vowel",t=>this.updateValue("vowel",t));C(this,"vow",this.vowel);C(this,"delay",t=>this.updateValue("delay",t));C(this,"del",this.delay);C(this,"delayfeedback",t=>this.updateValue("delayfeedback",t));C(this,"delayfb",this.delayfeedback);C(this,"delaytime",t=>this.updateValue("delaytime",t));C(this,"delayt",this.delaytime);C(this,"orbit",t=>this.updateValue("orbit",t));C(this,"o",this.orbit);C(this,"room",t=>this.updateValue("room",t));C(this,"rm",this.room);C(this,"size",t=>this.updateValue("size",t));C(this,"sz",this.size);C(this,"velocity",t=>this.updateValue("velocity",t));C(this,"vel",this.velocity);C(this,"modify",t=>{const r=t(this);return r instanceof Object?r:(t(this.values),this.update(),this)});C(this,"update",()=>{const[t,r]=Ng(this.values.key||"C4",this.values.pitch||0,this.values.parsedScale||"MAJOR",this.values.octave||0);this.values.freq=Ro(t)});C(this,"out",()=>{this.values.chord?this.values.chord.forEach(t=>{const r={...this.values};r.freq=t,QO(r,1/4,this.values.dur||.5)}):QO(this.values,1/4,this.values.dur||.5)});this.app=r,typeof t=="string"?this.values={s:t,dur:.5}:this.values=t}updateValue(t,r){return this.values[t]=r,this}}class Om extends rR{constructor(t,r){super(r);C(this,"midiConnection");C(this,"chord",t=>(this.values.chord=t,this));C(this,"note",t=>(this.values.note=t,this));C(this,"sustain",t=>(this.values.sustain=t,this));C(this,"channel",t=>(this.values.channel=t,this));C(this,"port",t=>(this.values.port=this.midiConnection.getMidiOutputIndex(t),this));C(this,"add",t=>(this.values.note+=t,this));C(this,"modify",t=>{const r=t(this);return r instanceof Object?r:(t(this.values),this.update(),this)});C(this,"bend",t=>(this.values.bend=t,this));C(this,"random",(t=0,r=127)=>(t=Math.min(Math.max(t,0),127),r=Math.min(Math.max(r,0),127),this.values.note=Math.floor(this.randomGen()*(r-t+1))+t,this));C(this,"update",()=>{const[t,r]=Ng(this.values.key||"C4",this.values.pitch||0,this.values.parsedScale||"MAJOR",this.values.octave||0);this.values.note=t,this.values.freq=Ro(t),r&&(this.values.bend=r)});C(this,"out",()=>{function t(r,i){const a=i.values.channel?i.values.channel:0,s=i.values.velocity?i.values.velocity:100,o=i.values.sustain?i.values.sustain*i.app.clock.pulse_duration*i.app.api.ppqn():i.app.clock.pulse_duration*i.app.api.ppqn(),l=i.values.bend?i.values.bend:void 0,c=i.values.port?i.midiConnection.getMidiOutputIndex(i.values.port):i.midiConnection.getCurrentMidiPortIndex();i.midiConnection.sendMidiNote(r,a,s,o,c,l)}if(this.values.chord)this.values.chord.forEach(r=>{t(r,this)});else{const r=this.values.note?this.values.note:60;t(r,this)}});this.app=r,typeof t=="number"?this.values.note=t:this.values=t,this.midiConnection=r.api.MidiConnection}}const Gs=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,iR=new Set,Em=typeof process=="object"&&process?process:{},aR=(n,e,t,r)=>{typeof Em.emitWarning=="function"?Em.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)};let gc=globalThis.AbortController,VO=globalThis.AbortSignal;var MT;if(typeof gc>"u"){VO=class{constructor(){C(this,"onabort");C(this,"_onabort",[]);C(this,"reason");C(this,"aborted",!1)}addEventListener(r,i){this._onabort.push(i)}},gc=class{constructor(){C(this,"signal",new VO);e()}abort(r){var i,a;if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=!0;for(const s of this.signal._onabort)s(r);(a=(i=this.signal).onabort)==null||a.call(i,r)}}};let n=((MT=Em.env)==null?void 0:MT.LRU_CACHE_IGNORE_AC_WARNING)!=="1";const e=()=>{n&&(n=!1,aR("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}const p3=n=>!iR.has(n),Ri=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),sR=n=>Ri(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Ml:null:null;class Ml extends Array{constructor(e){super(e),this.fill(0)}}var Za;const na=class na{constructor(e,t){C(this,"heap");C(this,"length");if(!V(na,Za))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}static create(e){const t=sR(e);if(!t)return[];ze(na,Za,!0);const r=new na(e,t);return ze(na,Za,!1),r}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}};Za=new WeakMap,tt(na,Za,!1);let bm=na;var En,Qr,bn,Tn,Ka,Zt,vn,Kt,Nt,et,yr,qr,fr,nr,Cn,ir,ti,ri,yn,An,ki,Ar,Do,vm,ua,ni,xo,Vr,bc,oR,da,ja,ko,Pn,Ii,Bn,Ni,Lo,Cm,Ja,Pl,es,Bl,At,xt,Mo,ym,pa,Ks;const qg=class qg{constructor(e){tt(this,Do);tt(this,bc);tt(this,Pn);tt(this,Bn);tt(this,Lo);tt(this,Ja);tt(this,es);tt(this,At);tt(this,Mo);tt(this,pa);tt(this,En,void 0);tt(this,Qr,void 0);tt(this,bn,void 0);tt(this,Tn,void 0);tt(this,Ka,void 0);C(this,"ttl");C(this,"ttlResolution");C(this,"ttlAutopurge");C(this,"updateAgeOnGet");C(this,"updateAgeOnHas");C(this,"allowStale");C(this,"noDisposeOnSet");C(this,"noUpdateTTL");C(this,"maxEntrySize");C(this,"sizeCalculation");C(this,"noDeleteOnFetchRejection");C(this,"noDeleteOnStaleGet");C(this,"allowStaleOnFetchAbort");C(this,"allowStaleOnFetchRejection");C(this,"ignoreFetchAbort");tt(this,Zt,void 0);tt(this,vn,void 0);tt(this,Kt,void 0);tt(this,Nt,void 0);tt(this,et,void 0);tt(this,yr,void 0);tt(this,qr,void 0);tt(this,fr,void 0);tt(this,nr,void 0);tt(this,Cn,void 0);tt(this,ir,void 0);tt(this,ti,void 0);tt(this,ri,void 0);tt(this,yn,void 0);tt(this,An,void 0);tt(this,ki,void 0);tt(this,Ar,void 0);tt(this,ua,()=>{});tt(this,ni,()=>{});tt(this,xo,()=>{});tt(this,Vr,()=>!1);tt(this,da,e=>{});tt(this,ja,(e,t,r)=>{});tt(this,ko,(e,t,r,i)=>{if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});const{max:t=0,ttl:r,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:s,updateAgeOnHas:o,allowStale:l,dispose:c,disposeAfter:d,noDisposeOnSet:p,noUpdateTTL:m,maxSize:_=0,maxEntrySize:b=0,sizeCalculation:A,fetchMethod:R,noDeleteOnFetchRejection:x,noDeleteOnStaleGet:Y,allowStaleOnFetchRejection:Z,allowStaleOnFetchAbort:h,ignoreFetchAbort:E}=e;if(t!==0&&!Ri(t))throw new TypeError("max option must be a nonnegative integer");const S=t?sR(t):Array;if(!S)throw new Error("invalid max value: "+t);if(ze(this,En,t),ze(this,Qr,_),this.maxEntrySize=b||V(this,Qr),this.sizeCalculation=A,this.sizeCalculation){if(!V(this,Qr)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(R!==void 0&&typeof R!="function")throw new TypeError("fetchMethod must be a function if specified");if(ze(this,Ka,R),ze(this,ki,!!R),ze(this,Kt,new Map),ze(this,Nt,new Array(t).fill(void 0)),ze(this,et,new Array(t).fill(void 0)),ze(this,yr,new S(t)),ze(this,qr,new S(t)),ze(this,fr,0),ze(this,nr,0),ze(this,Cn,bm.create(t)),ze(this,Zt,0),ze(this,vn,0),typeof c=="function"&&ze(this,bn,c),typeof d=="function"?(ze(this,Tn,d),ze(this,ir,[])):(ze(this,Tn,void 0),ze(this,ir,void 0)),ze(this,An,!!V(this,bn)),ze(this,Ar,!!V(this,Tn)),this.noDisposeOnSet=!!p,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!x,this.allowStaleOnFetchRejection=!!Z,this.allowStaleOnFetchAbort=!!h,this.ignoreFetchAbort=!!E,this.maxEntrySize!==0){if(V(this,Qr)!==0&&!Ri(V(this,Qr)))throw new TypeError("maxSize must be a positive integer if specified");if(!Ri(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");Qe(this,bc,oR).call(this)}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!Y,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!o,this.ttlResolution=Ri(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!Ri(this.ttl))throw new TypeError("ttl must be a positive integer if specified");Qe(this,Do,vm).call(this)}if(V(this,En)===0&&this.ttl===0&&V(this,Qr)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!V(this,En)&&!V(this,Qr)){const I="LRU_CACHE_UNBOUNDED";p3(I)&&(iR.add(I),aR("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",I,qg))}}static unsafeExposeInternals(e){return{starts:V(e,ri),ttls:V(e,yn),sizes:V(e,ti),keyMap:V(e,Kt),keyList:V(e,Nt),valList:V(e,et),next:V(e,yr),prev:V(e,qr),get head(){return V(e,fr)},get tail(){return V(e,nr)},free:V(e,Cn),isBackgroundFetch:t=>{var r;return Qe(r=e,At,xt).call(r,t)},backgroundFetch:(t,r,i,a)=>{var s;return Qe(s=e,es,Bl).call(s,t,r,i,a)},moveToTail:t=>{var r;return Qe(r=e,pa,Ks).call(r,t)},indexes:t=>{var r;return Qe(r=e,Pn,Ii).call(r,t)},rindexes:t=>{var r;return Qe(r=e,Bn,Ni).call(r,t)},isStale:t=>{var r;return V(r=e,Vr).call(r,t)}}}get max(){return V(this,En)}get maxSize(){return V(this,Qr)}get calculatedSize(){return V(this,vn)}get size(){return V(this,Zt)}get fetchMethod(){return V(this,Ka)}get dispose(){return V(this,bn)}get disposeAfter(){return V(this,Tn)}getRemainingTTL(e){return V(this,Kt).has(e)?1/0:0}*entries(){for(const e of Qe(this,Pn,Ii).call(this))V(this,et)[e]!==void 0&&V(this,Nt)[e]!==void 0&&!Qe(this,At,xt).call(this,V(this,et)[e])&&(yield[V(this,Nt)[e],V(this,et)[e]])}*rentries(){for(const e of Qe(this,Bn,Ni).call(this))V(this,et)[e]!==void 0&&V(this,Nt)[e]!==void 0&&!Qe(this,At,xt).call(this,V(this,et)[e])&&(yield[V(this,Nt)[e],V(this,et)[e]])}*keys(){for(const e of Qe(this,Pn,Ii).call(this)){const t=V(this,Nt)[e];t!==void 0&&!Qe(this,At,xt).call(this,V(this,et)[e])&&(yield t)}}*rkeys(){for(const e of Qe(this,Bn,Ni).call(this)){const t=V(this,Nt)[e];t!==void 0&&!Qe(this,At,xt).call(this,V(this,et)[e])&&(yield t)}}*values(){for(const e of Qe(this,Pn,Ii).call(this))V(this,et)[e]!==void 0&&!Qe(this,At,xt).call(this,V(this,et)[e])&&(yield V(this,et)[e])}*rvalues(){for(const e of Qe(this,Bn,Ni).call(this))V(this,et)[e]!==void 0&&!Qe(this,At,xt).call(this,V(this,et)[e])&&(yield V(this,et)[e])}[Symbol.iterator](){return this.entries()}find(e,t={}){for(const r of Qe(this,Pn,Ii).call(this)){const i=V(this,et)[r],a=Qe(this,At,xt).call(this,i)?i.__staleWhileFetching:i;if(a!==void 0&&e(a,V(this,Nt)[r],this))return this.get(V(this,Nt)[r],t)}}forEach(e,t=this){for(const r of Qe(this,Pn,Ii).call(this)){const i=V(this,et)[r],a=Qe(this,At,xt).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,V(this,Nt)[r],this)}}rforEach(e,t=this){for(const r of Qe(this,Bn,Ni).call(this)){const i=V(this,et)[r],a=Qe(this,At,xt).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,V(this,Nt)[r],this)}}purgeStale(){let e=!1;for(const t of Qe(this,Bn,Ni).call(this,{allowStale:!0}))V(this,Vr).call(this,t)&&(this.delete(V(this,Nt)[t]),e=!0);return e}dump(){const e=[];for(const t of Qe(this,Pn,Ii).call(this,{allowStale:!0})){const r=V(this,Nt)[t],i=V(this,et)[t],a=Qe(this,At,xt).call(this,i)?i.__staleWhileFetching:i;if(a===void 0||r===void 0)continue;const s={value:a};if(V(this,yn)&&V(this,ri)){s.ttl=V(this,yn)[t];const o=Gs.now()-V(this,ri)[t];s.start=Math.floor(Date.now()-o)}V(this,ti)&&(s.size=V(this,ti)[t]),e.unshift([r,s])}return e}load(e){this.clear();for(const[t,r]of e){if(r.start){const i=Date.now()-r.start;r.start=Gs.now()-i}this.set(t,r.value,r)}}set(e,t,r={}){var m,_,b,A,R;if(t===void 0)return this.delete(e),this;const{ttl:i=this.ttl,start:a,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:l}=r;let{noUpdateTTL:c=this.noUpdateTTL}=r;const d=V(this,ko).call(this,e,t,r.size||0,o);if(this.maxEntrySize&&d>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.delete(e),this;let p=V(this,Zt)===0?void 0:V(this,Kt).get(e);if(p===void 0)p=V(this,Zt)===0?V(this,nr):V(this,Cn).length!==0?V(this,Cn).pop():V(this,Zt)===V(this,En)?Qe(this,Ja,Pl).call(this,!1):V(this,Zt),V(this,Nt)[p]=e,V(this,et)[p]=t,V(this,Kt).set(e,p),V(this,yr)[V(this,nr)]=p,V(this,qr)[p]=V(this,nr),ze(this,nr,p),Zo(this,Zt)._++,V(this,ja).call(this,p,d,l),l&&(l.set="add"),c=!1;else{Qe(this,pa,Ks).call(this,p);const x=V(this,et)[p];if(t!==x){if(V(this,ki)&&Qe(this,At,xt).call(this,x)){x.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:Y}=x;Y!==void 0&&!s&&(V(this,An)&&((m=V(this,bn))==null||m.call(this,Y,e,"set")),V(this,Ar)&&((_=V(this,ir))==null||_.push([Y,e,"set"])))}else s||(V(this,An)&&((b=V(this,bn))==null||b.call(this,x,e,"set")),V(this,Ar)&&((A=V(this,ir))==null||A.push([x,e,"set"])));if(V(this,da).call(this,p),V(this,ja).call(this,p,d,l),V(this,et)[p]=t,l){l.set="replace";const Y=x&&Qe(this,At,xt).call(this,x)?x.__staleWhileFetching:x;Y!==void 0&&(l.oldValue=Y)}}else l&&(l.set="update")}if(i!==0&&!V(this,yn)&&Qe(this,Do,vm).call(this),V(this,yn)&&(c||V(this,xo).call(this,p,i,a),l&&V(this,ni).call(this,l,p)),!s&&V(this,Ar)&&V(this,ir)){const x=V(this,ir);let Y;for(;Y=x==null?void 0:x.shift();)(R=V(this,Tn))==null||R.call(this,...Y)}return this}pop(){var e;try{for(;V(this,Zt);){const t=V(this,et)[V(this,fr)];if(Qe(this,Ja,Pl).call(this,!0),Qe(this,At,xt).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(V(this,Ar)&&V(this,ir)){const t=V(this,ir);let r;for(;r=t==null?void 0:t.shift();)(e=V(this,Tn))==null||e.call(this,...r)}}}has(e,t={}){const{updateAgeOnHas:r=this.updateAgeOnHas,status:i}=t,a=V(this,Kt).get(e);if(a!==void 0){const s=V(this,et)[a];if(Qe(this,At,xt).call(this,s)&&s.__staleWhileFetching===void 0)return!1;if(V(this,Vr).call(this,a))i&&(i.has="stale",V(this,ni).call(this,i,a));else return r&&V(this,ua).call(this,a),i&&(i.has="hit",V(this,ni).call(this,i,a)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){const{allowStale:r=this.allowStale}=t,i=V(this,Kt).get(e);if(i!==void 0&&(r||!V(this,Vr).call(this,i))){const a=V(this,et)[i];return Qe(this,At,xt).call(this,a)?a.__staleWhileFetching:a}}async fetch(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:l=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:p=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:_=this.ignoreFetchAbort,allowStaleOnFetchAbort:b=this.allowStaleOnFetchAbort,context:A,forceRefresh:R=!1,status:x,signal:Y}=t;if(!V(this,ki))return x&&(x.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:a,status:x});const Z={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:a,ttl:s,noDisposeOnSet:o,size:l,sizeCalculation:c,noUpdateTTL:d,noDeleteOnFetchRejection:p,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:b,ignoreFetchAbort:_,status:x,signal:Y};let h=V(this,Kt).get(e);if(h===void 0){x&&(x.fetch="miss");const E=Qe(this,es,Bl).call(this,e,h,Z,A);return E.__returned=E}else{const E=V(this,et)[h];if(Qe(this,At,xt).call(this,E)){const k=r&&E.__staleWhileFetching!==void 0;return x&&(x.fetch="inflight",k&&(x.returnedStale=!0)),k?E.__staleWhileFetching:E.__returned=E}const S=V(this,Vr).call(this,h);if(!R&&!S)return x&&(x.fetch="hit"),Qe(this,pa,Ks).call(this,h),i&&V(this,ua).call(this,h),x&&V(this,ni).call(this,x,h),E;const I=Qe(this,es,Bl).call(this,e,h,Z,A),L=I.__staleWhileFetching!==void 0&&r;return x&&(x.fetch=S?"stale":"refresh",L&&S&&(x.returnedStale=!0)),L?I.__staleWhileFetching:I.__returned=I}}get(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:s}=t,o=V(this,Kt).get(e);if(o!==void 0){const l=V(this,et)[o],c=Qe(this,At,xt).call(this,l);return s&&V(this,ni).call(this,s,o),V(this,Vr).call(this,o)?(s&&(s.get="stale"),c?(s&&r&&l.__staleWhileFetching!==void 0&&(s.returnedStale=!0),r?l.__staleWhileFetching:void 0):(a||this.delete(e),s&&r&&(s.returnedStale=!0),r?l:void 0)):(s&&(s.get="hit"),c?l.__staleWhileFetching:(Qe(this,pa,Ks).call(this,o),i&&V(this,ua).call(this,o),l))}else s&&(s.get="miss")}delete(e){var r,i,a,s;let t=!1;if(V(this,Zt)!==0){const o=V(this,Kt).get(e);if(o!==void 0)if(t=!0,V(this,Zt)===1)this.clear();else{V(this,da).call(this,o);const l=V(this,et)[o];Qe(this,At,xt).call(this,l)?l.__abortController.abort(new Error("deleted")):(V(this,An)||V(this,Ar))&&(V(this,An)&&((r=V(this,bn))==null||r.call(this,l,e,"delete")),V(this,Ar)&&((i=V(this,ir))==null||i.push([l,e,"delete"]))),V(this,Kt).delete(e),V(this,Nt)[o]=void 0,V(this,et)[o]=void 0,o===V(this,nr)?ze(this,nr,V(this,qr)[o]):o===V(this,fr)?ze(this,fr,V(this,yr)[o]):(V(this,yr)[V(this,qr)[o]]=V(this,yr)[o],V(this,qr)[V(this,yr)[o]]=V(this,qr)[o]),Zo(this,Zt)._--,V(this,Cn).push(o)}}if(V(this,Ar)&&((a=V(this,ir))!=null&&a.length)){const o=V(this,ir);let l;for(;l=o==null?void 0:o.shift();)(s=V(this,Tn))==null||s.call(this,...l)}return t}clear(){var e,t,r;for(const i of Qe(this,Bn,Ni).call(this,{allowStale:!0})){const a=V(this,et)[i];if(Qe(this,At,xt).call(this,a))a.__abortController.abort(new Error("deleted"));else{const s=V(this,Nt)[i];V(this,An)&&((e=V(this,bn))==null||e.call(this,a,s,"delete")),V(this,Ar)&&((t=V(this,ir))==null||t.push([a,s,"delete"]))}}if(V(this,Kt).clear(),V(this,et).fill(void 0),V(this,Nt).fill(void 0),V(this,yn)&&V(this,ri)&&(V(this,yn).fill(0),V(this,ri).fill(0)),V(this,ti)&&V(this,ti).fill(0),ze(this,fr,0),ze(this,nr,0),V(this,Cn).length=0,ze(this,vn,0),ze(this,Zt,0),V(this,Ar)&&V(this,ir)){const i=V(this,ir);let a;for(;a=i==null?void 0:i.shift();)(r=V(this,Tn))==null||r.call(this,...a)}}};En=new WeakMap,Qr=new WeakMap,bn=new WeakMap,Tn=new WeakMap,Ka=new WeakMap,Zt=new WeakMap,vn=new WeakMap,Kt=new WeakMap,Nt=new WeakMap,et=new WeakMap,yr=new WeakMap,qr=new WeakMap,fr=new WeakMap,nr=new WeakMap,Cn=new WeakMap,ir=new WeakMap,ti=new WeakMap,ri=new WeakMap,yn=new WeakMap,An=new WeakMap,ki=new WeakMap,Ar=new WeakMap,Do=new WeakSet,vm=function(){const e=new Ml(V(this,En)),t=new Ml(V(this,En));ze(this,yn,e),ze(this,ri,t),ze(this,xo,(a,s,o=Gs.now())=>{if(t[a]=s!==0?o:0,e[a]=s,s!==0&&this.ttlAutopurge){const l=setTimeout(()=>{V(this,Vr).call(this,a)&&this.delete(V(this,Nt)[a])},s+1);l.unref&&l.unref()}}),ze(this,ua,a=>{t[a]=e[a]!==0?Gs.now():0}),ze(this,ni,(a,s)=>{if(e[s]){const o=e[s],l=t[s];a.ttl=o,a.start=l,a.now=r||i();const c=a.now-l;a.remainingTTL=o-c}});let r=0;const i=()=>{const a=Gs.now();if(this.ttlResolution>0){r=a;const s=setTimeout(()=>r=0,this.ttlResolution);s.unref&&s.unref()}return a};this.getRemainingTTL=a=>{const s=V(this,Kt).get(a);if(s===void 0)return 0;const o=e[s],l=t[s];if(o===0||l===0)return 1/0;const c=(r||i())-l;return o-c},ze(this,Vr,a=>e[a]!==0&&t[a]!==0&&(r||i())-t[a]>e[a])},ua=new WeakMap,ni=new WeakMap,xo=new WeakMap,Vr=new WeakMap,bc=new WeakSet,oR=function(){const e=new Ml(V(this,En));ze(this,vn,0),ze(this,ti,e),ze(this,da,t=>{ze(this,vn,V(this,vn)-e[t]),e[t]=0}),ze(this,ko,(t,r,i,a)=>{if(Qe(this,At,xt).call(this,r))return 0;if(!Ri(i))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(i=a(r,t),!Ri(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i}),ze(this,ja,(t,r,i)=>{if(e[t]=r,V(this,Qr)){const a=V(this,Qr)-e[t];for(;V(this,vn)>a;)Qe(this,Ja,Pl).call(this,!0)}ze(this,vn,V(this,vn)+e[t]),i&&(i.entrySize=r,i.totalCalculatedSize=V(this,vn))})},da=new WeakMap,ja=new WeakMap,ko=new WeakMap,Pn=new WeakSet,Ii=function*({allowStale:e=this.allowStale}={}){if(V(this,Zt))for(let t=V(this,nr);!(!Qe(this,Lo,Cm).call(this,t)||((e||!V(this,Vr).call(this,t))&&(yield t),t===V(this,fr)));)t=V(this,qr)[t]},Bn=new WeakSet,Ni=function*({allowStale:e=this.allowStale}={}){if(V(this,Zt))for(let t=V(this,fr);!(!Qe(this,Lo,Cm).call(this,t)||((e||!V(this,Vr).call(this,t))&&(yield t),t===V(this,nr)));)t=V(this,yr)[t]},Lo=new WeakSet,Cm=function(e){return e!==void 0&&V(this,Kt).get(V(this,Nt)[e])===e},Ja=new WeakSet,Pl=function(e){var a,s;const t=V(this,fr),r=V(this,Nt)[t],i=V(this,et)[t];return V(this,ki)&&Qe(this,At,xt).call(this,i)?i.__abortController.abort(new Error("evicted")):(V(this,An)||V(this,Ar))&&(V(this,An)&&((a=V(this,bn))==null||a.call(this,i,r,"evict")),V(this,Ar)&&((s=V(this,ir))==null||s.push([i,r,"evict"]))),V(this,da).call(this,t),e&&(V(this,Nt)[t]=void 0,V(this,et)[t]=void 0,V(this,Cn).push(t)),V(this,Zt)===1?(ze(this,fr,ze(this,nr,0)),V(this,Cn).length=0):ze(this,fr,V(this,yr)[t]),V(this,Kt).delete(r),Zo(this,Zt)._--,t},es=new WeakSet,Bl=function(e,t,r,i){const a=t===void 0?void 0:V(this,et)[t];if(Qe(this,At,xt).call(this,a))return a;const s=new gc,{signal:o}=r;o==null||o.addEventListener("abort",()=>s.abort(o.reason),{signal:s.signal});const l={signal:s.signal,options:r,context:i},c=(A,R=!1)=>{const{aborted:x}=s.signal,Y=r.ignoreFetchAbort&&A!==void 0;if(r.status&&(x&&!R?(r.status.fetchAborted=!0,r.status.fetchError=s.signal.reason,Y&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),x&&!Y&&!R)return p(s.signal.reason);const Z=_;return V(this,et)[t]===_&&(A===void 0?Z.__staleWhileFetching?V(this,et)[t]=Z.__staleWhileFetching:this.delete(e):(r.status&&(r.status.fetchUpdated=!0),this.set(e,A,l.options))),A},d=A=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=A),p(A)),p=A=>{const{aborted:R}=s.signal,x=R&&r.allowStaleOnFetchAbort,Y=x||r.allowStaleOnFetchRejection,Z=Y||r.noDeleteOnFetchRejection,h=_;if(V(this,et)[t]===_&&(!Z||h.__staleWhileFetching===void 0?this.delete(e):x||(V(this,et)[t]=h.__staleWhileFetching)),Y)return r.status&&h.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),h.__staleWhileFetching;if(h.__returned===h)throw A},m=(A,R)=>{var Y;const x=(Y=V(this,Ka))==null?void 0:Y.call(this,e,a,l);x&&x instanceof Promise&&x.then(Z=>A(Z===void 0?void 0:Z),R),s.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(A(void 0),r.allowStaleOnFetchAbort&&(A=Z=>c(Z,!0)))})};r.status&&(r.status.fetchDispatched=!0);const _=new Promise(m).then(c,d),b=Object.assign(_,{__abortController:s,__staleWhileFetching:a,__returned:void 0});return t===void 0?(this.set(e,b,{...l.options,status:void 0}),t=V(this,Kt).get(e)):V(this,et)[t]=b,b},At=new WeakSet,xt=function(e){if(!V(this,ki))return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof gc},Mo=new WeakSet,ym=function(e,t){V(this,qr)[t]=e,V(this,yr)[e]=t},pa=new WeakSet,Ks=function(e){e!==V(this,nr)&&(e===V(this,fr)?ze(this,fr,V(this,yr)[e]):Qe(this,Mo,ym).call(this,V(this,qr)[e],V(this,yr)[e]),Qe(this,Mo,ym).call(this,V(this,nr),e),ze(this,nr,e))};let Tm=qg;const ao=class ao{constructor(){C(this,"_fallbackMethod",()=>ao.createSkipProxy());C(this,"out",()=>{})}};C(ao,"createSkipProxy",()=>{const e=new ao;return new Proxy(e,{get(t,r,i){return typeof t[r]>"u"?t._fallbackMethod:t[r]},set(t,r,i,a){return!1}})});let _c=ao;const so=class so extends xg{constructor(t,r){super(r);C(this,"_fallbackMethod",()=>so.createRestProxy(this.values.length,this.app));C(this,"out",()=>{});this.values.length=t}};C(so,"createRestProxy",(t,r)=>{const i=new so(t,r);return new Proxy(i,{get(a,s,o){return typeof a[s]>"u"?a._fallbackMethod:a[s]},set(a,s,o,l){return!1}})});let Sc=so;class h3 extends xg{constructor(t,r,i){super(i);C(this,"input");C(this,"ziffers");C(this,"initCallTime",0);C(this,"startCallTime",0);C(this,"lastCallTime",0);C(this,"waitTime",0);C(this,"startBeat",0);C(this,"played",!1);C(this,"current");C(this,"retro",!1);C(this,"index",-1);C(this,"zid","");C(this,"options",{});C(this,"skipIndex",0);C(this,"endTime",0);C(this,"next",()=>(this.current=this.ziffers.next(),this.played=!0,this.current));C(this,"pulseToSecond",t=>this.app.clock.convertPulseToSecond(t));C(this,"firstRun",()=>this.notStarted());C(this,"atTheBeginning",()=>this.skipIndex===0&&this.ziffers.index<=0);C(this,"origin",()=>this.app.clock.pulses_since_origin+1);C(this,"pulse",()=>this.app.clock.time_position.pulse);C(this,"beat",()=>this.app.clock.time_position.beat);C(this,"nextBeat",()=>this.app.clock.next_beat_in_ticks);C(this,"nextBeatInTicks",()=>this.app.clock.next_beat_in_ticks);C(this,"areWeThereYet",()=>{this.app.clock.pulses_since_origin=this.nextBeatInTicks())&&this.origin()>=this.waitTime||this.current&&this.pulseToSecond(this.origin())>=this.pulseToSecond(this.lastCallTime)+this.current.duration*4*this.pulseToSecond(this.app.api.ppqn())&&this.origin()>=this.waitTime;return this.skipIndex=t?0:this.skipIndex+1,this.index=t?this.index+1:this.index,t&&this.notStarted()&&(this.initCallTime=this.app.clock.pulses_since_origin),this.atTheBeginning()&&(this.startCallTime=this.app.clock.pulses_since_origin),t});C(this,"out",()=>{});this.app=i,this.input=t,this.options=r,this.ziffers=new RP(t,r)}get ticks(){return this.ziffers.duration*4*this.app.clock.ppqn}nextEndTime(){return this.startCallTime+this.ticks}updateLastCallTime(){(this.notStarted()||this.played)&&(this.lastCallTime=this.app.clock.pulses_since_origin,this.played=!1)}notStarted(){return this.ziffers.notStarted()}sound(t){if(this.areWeThereYet()){const r=this.next();if(r instanceof si){const i=r.getExisting("freq","pitch","key","scale","octave","parsedScale");return new Sm(i,this.app).sound(t)}else if(r instanceof Ao){const i=r.freqs();return new Sm(r,this.app).chord(i).sound(t)}else if(r instanceof gm)return Sc.createRestProxy(r.duration,this.app)}else return _c.createSkipProxy()}midi(t=void 0){if(this.areWeThereYet()){const r=this.next(),i=r.getExisting("note","pitch","bend","key","scale","octave","parsedScale");if(r instanceof si){const a=new Om(i,this.app);return t?a.note(t):a}else{if(r instanceof gm)return Sc.createRestProxy(r.duration,this.app);if(r instanceof Ao){const a=r.notes();return new Om(i,this.app).chord(a)}}}else return _c.createSkipProxy()}scale(t){return this.atTheBeginning()&&this.ziffers.scale(t),this}key(t){return this.atTheBeginning()&&this.ziffers.key(t),this}octave(t){return this.atTheBeginning()&&this.ziffers.octave(t),this}retrograde(){return this.atTheBeginning()&&this.ziffers.retrograde(),this}wait(t){if(this.atTheBeginning()){if(typeof t=="function"){const r=this.app.api.patternCache.get(t.name);return r&&(this.waitTime=r.nextEndTime()),this}this.waitTime=this.origin()+Math.ceil(t*4*this.app.clock.ppqn)}return this}sync(t){if(this.atTheBeginning()&&this.notStarted()){const r=this.app.clock.pulses_since_origin,i=typeof t=="function"?t.name:t;if(r>0){const a=this.app.api.patternCache.get(i);if(a){const s=a.ziffers.duration,o=a.startCallTime,l=s*4*this.app.clock.ppqn;this.waitTime=o+l}}}return this}}const f3=n=>n[0]==="{"&&n[n.length-1]==="}",$s=(n,e)=>{if(f3(n)){const t=JSON.parse(n);return JSON.stringify({...t,...e})}else return JSON.stringify({...e,text:n})},m3=n=>{String.prototype.speak=function(){const e=JSON.parse(this.valueOf());new lR({...e,text:e.text}).speak().then(()=>{}).catch(t=>{console.log("Error speaking:",t)})},String.prototype.rate=function(e){return $s(this.valueOf(),{rate:e})},String.prototype.pitch=function(e){return $s(this.valueOf(),{pitch:e})},String.prototype.lang=function(e){return $s(this.valueOf(),{lang:e})},String.prototype.volume=function(e){return $s(this.valueOf(),{volume:e})},String.prototype.voice=function(e){return $s(this.valueOf(),{voice:e})},String.prototype.z=function(){return n.z(this.valueOf())}};let wu;class lR{constructor(e){C(this,"speak",()=>new Promise((e,t)=>{if(this.options.text){const r=window.speechSynthesis;r.speaking&&r.cancel();const i=new SpeechSynthesisUtterance(this.options.text);i.rate=this.options.rate||1,i.pitch=this.options.pitch||1,i.volume=this.options.volume||1,this.options.voice&&(i.voice=r.getVoices()[this.options.voice]),this.options.lang&&(this.options.lang.length===2?i.lang=`${this.options.lang}-${this.options.lang.toUpperCase()}`:this.options.lang.length===5?i.lang=this.options.lang:i.lang="en-US"),i.onend=()=>{e()},i.onerror=a=>{t(a)},r.speaking?(r.cancel(),wu&&clearTimeout(wu),wu=setTimeout(()=>{r.speak(i)},200)):r.speak(i)}else t("No text provided")}));this.options=e}}async function HO(){return Promise.all([HP(),io("github:tidalcycles/Dirt-Samples/master").then(()=>s3()),d3(),io("github:Bubobubobubobubo/Dough-Samples/main"),io("github:Bubobubobubobubo/Dough-Amiga/main")])}class g3{constructor(e){C(this,"variables",{});C(this,"codeExamples",{});C(this,"counters",{});C(this,"_drunk",new wP(-100,100,!1));C(this,"randomGen",Math.random);C(this,"currentSeed");C(this,"localSeeds",new Map);C(this,"patternCache",new Tm({max:1e3,ttl:1e3*60*5}));C(this,"errorTimeoutID",0);C(this,"printTimeoutID",0);C(this,"MidiConnection",new NP);C(this,"load");C(this,"_loadUniverseFromInterface",e=>{this.app.loadUniverse(e),this.app.openBuffersModal()});C(this,"_deleteUniverseFromInterface",e=>{delete this.app.universes[e],this.app.settings.saveApplicationToLocalStorage(this.app.universes,this.app.settings),this.app.updateKnownUniversesView()});C(this,"_playDocExample",e=>{let t=this.app.universes[this.app.selected_universe];this.app.exampleIsPlaying=!0,t.example?t.example.candidate=e||this.app.selectedExample:(t.example={candidate:"",committed:"",evaluations:0},t.example.candidate=e||this.app.selectedExample),this.play()});C(this,"_stopDocExample",()=>{let e=this.app.universes[this.app.selected_universe];(e==null?void 0:e.example)!==void 0&&(this.app.exampleIsPlaying=!1,e.example.candidate="",e.example.committed=""),this.pause()});C(this,"_playDocExampleOnce",e=>{let t=this.app.universes[this.app.selected_universe];(t==null?void 0:t.example)!==void 0&&(t.example.candidate="",t.example.committed=""),this.play(),this.app.exampleIsPlaying=!0,QM(this.app,e)});C(this,"_all_samples",()=>kg.get());C(this,"_reportError",e=>{console.log(e),clearTimeout(this.errorTimeoutID),clearTimeout(this.printTimeoutID),this.app.error_line.innerHTML=e,this.app.error_line.style.color="color-red-800",this.app.error_line.classList.remove("hidden"),this.errorTimeoutID=setTimeout(()=>this.app.error_line.classList.add("hidden"),2e3)});C(this,"_logMessage",e=>{console.log(e),clearTimeout(this.printTimeoutID),clearTimeout(this.errorTimeoutID),this.app.error_line.innerHTML=e,this.app.error_line.style.color="white",this.app.error_line.classList.remove("hidden"),this.printTimeoutID=setTimeout(()=>this.app.error_line.classList.add("hidden"),4e3)});C(this,"time",()=>this.app.audioContext.currentTime);C(this,"play",()=>{this.app.setButtonHighlighting("play",!0),this.app.clock.start()});C(this,"pause",()=>{this.app.setButtonHighlighting("pause",!0),this.app.clock.pause()});C(this,"stop",()=>{this.app.setButtonHighlighting("stop",!0),this.app.clock.stop()});C(this,"silence",this.stop);C(this,"hush",this.stop);C(this,"warp",e=>{this.app.clock.tick=e,this.app.clock.time_position=this.app.clock.convertTicksToTimeposition(e)});C(this,"beat_warp",e=>{this.app.clock.tick=e*this.app.clock.ppqn,this.app.clock.time_position=this.app.clock.convertTicksToTimeposition(e*this.app.clock.ppqn)});C(this,"onmousemove",e=>{this.app._mouseX=e.pageX,this.app._mouseY=e.pageY});C(this,"mouseX",()=>this.app._mouseX);C(this,"mouseY",()=>this.app._mouseY);C(this,"noteX",()=>Math.floor(this.app._mouseX/document.body.clientWidth*127));C(this,"noteY",()=>Math.floor(this.app._mouseY/document.body.clientHeight*127));C(this,"script",(...e)=>{e.forEach(t=>{Xa(this.app,this.app.universes[this.app.selected_universe].locals[t])})});C(this,"s",this.script);C(this,"clear_script",e=>{this.app.universes[this.app.selected_universe].locals[e]={candidate:"",committed:"",evaluations:0}});C(this,"cs",this.clear_script);C(this,"copy_script",(e,t)=>{this.app.universes[this.app.selected_universe].locals[t]=this.app.universes[this.app.selected_universe].locals[e]});C(this,"cps",this.copy_script);C(this,"midi_outputs",()=>{this._logMessage(this.MidiConnection.listMidiOutputs())});C(this,"midi_output",e=>{e?this.MidiConnection.switchMidiOutput(e):console.log(this.MidiConnection.getCurrentMidiPort())});C(this,"midi",(e=60,t,r)=>(t!==void 0&&(typeof e=="number"&&(e={note:e}),e.velocity=t),r!==void 0&&(typeof e=="number"&&(e={note:e}),e.channel=r),new Om(e,this.app)));C(this,"sysex",e=>{this.MidiConnection.sendSysExMessage(e)});C(this,"pitch_bend",(e,t)=>{this.MidiConnection.sendPitchBend(e,t)});C(this,"program_change",(e,t)=>{this.MidiConnection.sendProgramChange(e,t)});C(this,"midi_clock",()=>{this.MidiConnection.sendMidiClock()});C(this,"control_change",({control:e=20,value:t=0,channel:r=0})=>{this.MidiConnection.sendMidiControlChange(e,t,r)});C(this,"midi_panic",()=>{this.MidiConnection.panic()});C(this,"generateCacheKey",(...e)=>e.map(t=>JSON.stringify(t)).join(","));C(this,"z",(e,t={},r="")=>{const i="z"+r.toString(),a=r===""?this.generateCacheKey(e,t):i;let s;return this.app.api.patternCache.has(a)&&(s=this.app.api.patternCache.get(a),s.input!==e&&(s=void 0)),s||(s=new h3(e,t,this.app),this.app.api.patternCache.set(a,s)),typeof r=="number"&&(s.zid=i),s.updateLastCallTime(),r!==""&&s.sync("z0"),s});C(this,"z0",(e,t={})=>this.z(e,t,0));C(this,"z1",(e,t={})=>this.z(e,t,1));C(this,"z2",(e,t={})=>this.z(e,t,2));C(this,"z3",(e,t={})=>this.z(e,t,3));C(this,"z4",(e,t={})=>this.z(e,t,4));C(this,"z5",(e,t={})=>this.z(e,t,5));C(this,"z6",(e,t={})=>this.z(e,t,6));C(this,"z7",(e,t={})=>this.z(e,t,7));C(this,"z8",(e,t={})=>this.z(e,t,8));C(this,"z9",(e,t={})=>this.z(e,t,9));C(this,"z10",(e,t={})=>this.z(e,t,10));C(this,"z11",(e,t={})=>this.z(e,t,11));C(this,"z12",(e,t={})=>this.z(e,t,12));C(this,"z13",(e,t={})=>this.z(e,t,13));C(this,"z14",(e,t={})=>this.z(e,t,14));C(this,"z15",(e,t={})=>this.z(e,t,15));C(this,"z16",(e,t={})=>this.z(e,t,16));C(this,"counter",(e,t,r)=>(e in this.counters?(this.counters[e].limit!==t&&(this.counters[e].value=0,this.counters[e].limit=t),this.counters[e].step!==r&&(this.counters[e].step=r??this.counters[e].step),this.counters[e].value+=this.counters[e].step,this.counters[e].limit!==void 0&&this.counters[e].value>this.counters[e].limit&&(this.counters[e].value=0)):this.counters[e]={value:0,step:r??1,limit:t},this.counters[e].value));C(this,"$",this.counter);C(this,"i",e=>e!==void 0?(this.app.universes[this.app.selected_universe].global.evaluations=e,this.app.universes[this.app.selected_universe]):this.app.universes[this.app.selected_universe].global.evaluations);C(this,"drunk",e=>e!==void 0?(this._drunk.position=e,this._drunk.getPosition()):(this._drunk.step(),this._drunk.getPosition()));C(this,"drunk_max",e=>{this._drunk.max=e});C(this,"drunk_min",e=>{this._drunk.min=e});C(this,"drunk_wrap",e=>{this._drunk.toggleWrap(e)});C(this,"variable",(e,t)=>typeof e=="string"&&t===void 0?this.variables[e]:(this.variables[e]=t,this.variables[e]));C(this,"v",this.variable);C(this,"delete_variable",e=>{delete this.variables[e]});C(this,"dv",this.delete_variable);C(this,"clear_variables",()=>{this.variables={}});C(this,"cv",this.clear_variables);C(this,"randI",(e,t)=>Math.floor(this.randomGen()*(t-e+1))+e);C(this,"rand",(e,t)=>this.randomGen()*(t-e)+e);C(this,"irand",this.randI);C(this,"rI",this.randI);C(this,"r",this.rand);C(this,"ir",this.randI);C(this,"seed",e=>{typeof e=="number"&&(e=e.toString()),this.currentSeed!==e&&(this.currentSeed=e,this.randomGen=mm(e))});C(this,"localSeededRandom",e=>{if(typeof e=="number"&&(e=e.toString()),this.localSeeds.has(e))return this.localSeeds.get(e);const t=mm(e);return this.localSeeds.set(e,t),t});C(this,"clearLocalSeed",(e=void 0)=>{e&&this.localSeeds.delete(e.toString()),this.localSeeds.clear()});C(this,"quantize",(e,t)=>{if(t.length===0)return e;let r=t[0];return t.forEach(i=>{Math.abs(i-e)Math.min(Math.max(e,t),r));C(this,"cmp",this.clamp);C(this,"bpm",e=>e===void 0?this.app.clock.bpm:((e<1||e>500)&&console.log(`Setting bpm to ${e}`),this.app.clock.bpm=e,e));C(this,"tempo",this.bpm);C(this,"bpb",e=>e===void 0?this.app.clock.time_signature[0]:(e<1&&console.log(`Setting bpb to ${e}`),this.app.clock.time_signature[0]=e,e));C(this,"ppqn",e=>e===void 0?this.app.clock.ppqn:(e<1&&console.log(`Setting ppqn to ${e}`),this.app.clock.ppqn=e,e));C(this,"time_signature",(e,t)=>{this.app.clock.time_signature=[e,t]});C(this,"prob",e=>this.randomGen()*100this.randomGen()>.5);C(this,"odds",(e,t=15)=>this.randomGen()this.randomGen()<.025*this.ppqn()/(this.ppqn()*e));C(this,"rarely",(e=15)=>this.randomGen()<.1*this.ppqn()/(this.ppqn()*e));C(this,"scarcely",(e=15)=>this.randomGen()<.25*this.ppqn()/(this.ppqn()*e));C(this,"sometimes",(e=15)=>this.randomGen()<.5*this.ppqn()/(this.ppqn()*e));C(this,"often",(e=15)=>this.randomGen()<.75*this.ppqn()/(this.ppqn()*e));C(this,"frequently",(e=15)=>this.randomGen()<.9*this.ppqn()/(this.ppqn()*e));C(this,"almostAlways",(e=15)=>this.randomGen()<.985*this.ppqn()/(this.ppqn()*e));C(this,"dice",e=>Math.floor(this.randomGen()*e)+1);C(this,"bar",()=>this.app.clock.time_position.bar+1);C(this,"tick",()=>this.app.clock.tick+1);C(this,"pulse",()=>this.app.clock.time_position.pulse+1);C(this,"beat",()=>this.app.clock.time_position.beat+1);C(this,"ebeat",()=>this.app.clock.beats_since_origin+1);C(this,"epulse",()=>this.app.clock.pulses_since_origin+1);C(this,"nominator",()=>this.app.clock.time_signature[0]);C(this,"meter",()=>this.app.clock.time_signature[1]);C(this,"denominator",this.meter);C(this,"mod",(...e)=>e.map(r=>this.app.clock.pulses_since_origin%Math.floor(r*this.ppqn())===0).some(r=>r===!0));C(this,"modpulse",(...e)=>e.map(r=>this.app.clock.pulses_since_origin%r===0).some(r=>r===!0));C(this,"modp",this.modpulse);C(this,"modbar",(...e)=>e.map(r=>this.app.clock.time_position.bar%Math.floor(r*this.ppqn())===0).some(r=>r===!0));C(this,"modb",this.modbar);C(this,"div",(e,t=50)=>{const r=this.app.clock.pulses_since_origin,i=Math.floor(e*this.ppqn()),a=Math.floor(t/100*i);return r%i{const t=this.app.clock.time_position.bar;return Math.floor(t/e)%2===0});C(this,"onbar",(e,t=this.app.clock.time_signature[0])=>{let r=this.app.clock.time_position.bar%t+1;return typeof e=="number"?e===r:e.some(i=>i==r)});C(this,"onbeat",(...e)=>{let t=[];return e.forEach(r=>{let i=r%this.nominator()||this.nominator(),a=Math.floor(i);a=a==0?this.nominator():a;let s=Math.floor((i-a)*this.ppqn()+1);s<=0&&(s=s+this.ppqn()*this.nominator()),t.push(a===this.beat()&&this.pulse()===s)}),t.some(r=>r==!0)});C(this,"oncount",(e,t)=>{typeof e=="number"&&(e=[e]);const r=this.app.clock.pulses_since_origin;let i=[];return e.forEach(a=>{a=a<1?0:a-1;const s=Math.ceil(a*this.ppqn()),o=r%(this.ppqn()*t);return i.push(o===s)}),i.some(a=>a==!0)});C(this,"oneuclid",(e,t,r=0)=>{const a=this._euclidean_cycle(e,t,r).reduce((s,o,l)=>(o&&s.push(l+1),s),[]);return this.oncount(a,t)});C(this,"delay",(e,t)=>{setTimeout(t,e)});C(this,"delayr",(e,t,r)=>{[...Array(t).keys()].map(a=>e*a).forEach((a,s)=>{setTimeout(r,a)})});C(this,"euclid",(e,t,r,i=0)=>this._euclidean_cycle(t,r,i)[e%r]);C(this,"ec",this.euclid);C(this,"rhythm",(e,t,r,i=0)=>this.mod(e)&&this._euclidean_cycle(t,r,i).div(e));C(this,"bin",(e,t)=>{let i=t.toString(2).split("").map(a=>a==="1");return i[e%i.length]});C(this,"binrhythm",(e,t)=>{let i=t.toString(2).split("").map(a=>a==="1");return this.mod(e)&&i.div(e)});C(this,"line",(e,t,r=1)=>{const i=[];if(t>e&&r>0||tMath.sin(this.app.clock.ctx.currentTime*Math.PI*2*e)+t);C(this,"usine",(e=1,t=0)=>(this.sine(e,t)+1)/2);C(this,"saw",(e=1,t=0)=>this.app.clock.ctx.currentTime*e%1*2-1+t);C(this,"usaw",(e=1,t=0)=>(this.saw(e,t)+1)/2);C(this,"triangle",(e=1,t=0)=>Math.abs(this.saw(e,t))*2-1);C(this,"utriangle",(e=1,t=0)=>(this.triangle(e,t)+1)/2);C(this,"square",(e=1,t=0,r=.5)=>{const i=1/e;return(Date.now()/1e3+t)%i/i(this.square(e,t,r)+1)/2);C(this,"noise",()=>this.randomGen()*2-1);C(this,"min",(...e)=>Math.min(...e));C(this,"max",(...e)=>Math.max(...e));C(this,"mean",(...e)=>e.reduce((r,i)=>r+i,0)/e.length);C(this,"limit",(e,t,r)=>Math.min(Math.max(e,t),r));C(this,"abs",Math.abs);C(this,"speak",(e,t="en-US",r=0,i=1,a=1)=>{new lR({text:e,lang:t,voice:r,rate:i,pitch:a}).speak().then(()=>{}).catch(o=>{console.log(o)})});C(this,"stop_hydra",()=>{this.app.hydra.hush()});C(this,"sound",e=>new Sm(e,this.app));C(this,"snd",this.sound);C(this,"samples",io);C(this,"log",e=>{console.log(e),this._logMessage(e)});C(this,"scale",xP);C(this,"rate",e=>{});C(this,"divseq",(...e)=>{const t=e[0],r=e.slice(1),i=this.app.clock.pulses_since_origin,a=Math.floor(i/Math.floor(t*this.ppqn()));return r[a%r.length]});C(this,"seqbeat",(...e)=>e[this.app.clock.time_position.beat%e.length]);C(this,"seqbar",(...e)=>e[(this.app.clock.time_position.bar+1)%e.length]);this.app=e}_euclidean_cycle(e,t,r=0){if(e==t)return Array.from({length:t},()=>!0);function i(o,l){const c=o.length,d=(l+1)%c;return o[l]>o[d]}if(e>=t)return[!0];const a=Array.from({length:t},(o,l)=>(e*(l-1)%t+t)%t);let s=a.map((o,l)=>i(a,l));return r!=0&&(s=s.slice(r).concat(s.slice(0,r))),s}}const _3=n=>{Array.prototype.in=function(e){return this.includes(e)},Array.prototype.square=function(){return this.map(e=>e*e)},Array.prototype.sqrt=function(){if(this.some(e=>e<0))throw new Error("Cannot take square root of negative number");return this.map(e=>Math.sqrt(e))},Array.prototype.add=function(e){return this.map(t=>t+e)},Array.prototype.sub=function(e){return this.map(t=>t-e)},Array.prototype.mult=function(e){return this.map(t=>t*e)},Array.prototype.division=function(e){if(e===0)throw new Error("Division by zero");return this.map(t=>t/e)},Array.prototype.pick=function(){return this[Math.floor(n.randomGen()*this.length)]},Array.prototype.beat=function(e=1){return this[n.app.clock.beats_since_origin/e%this.length]},Array.prototype.gen=function(e,t,r){return r<1?[]:Array.from({length:r},()=>Math.floor(n.randomGen()*(t-e+1))+e)},Array.prototype.bar=function(){return this[n.app.clock.time_position.bar%this.length]},Array.prototype.pulse=function(){return this[n.app.clock.time_position.pulse%this.length]},Array.prototype.div=function(e){const t=e,r=n.app.clock.pulses_since_origin,i=Math.floor(r/Math.floor(t*n.ppqn()));return this[i%this.length]},Array.prototype.shuffle=function(){let e=this.length,t;for(;e!==0;)t=Math.floor(n.randomGen()*e),e--,[this[e],this[t]]=[this[t],this[e]];return this},Array.prototype.rotate=function(e){const t=this.length;if(e<0)e=t+e%t;else if(e>0)e=e%t;else return this;const r=this.splice(-e,e);return this.unshift(...r),this},Array.prototype.unique=function(){const e=new Set;let t=0;for(let r=0;r100)throw new Error("Amount should be between 0 and 100");if(this.length<=1)return this;for(let t=0;t1)this.splice(t,1);else return this;else t++;return this},Array.prototype.repeatAll=function(e=1){if(e<1)throw new Error("Amount should be at least 1");let t=[];for(let r=0;r>1|(Dt&21845)<<1;yi=(yi&52428)>>2|(yi&13107)<<2,yi=(yi&61680)>>4|(yi&3855)<<4,Im[Dt]=((yi&65280)>>8|(yi&255)<<8)>>1}var Vn=function(n,e,t){for(var r=n.length,i=0,a=new Kr(e);i>l]=c}else for(o=new Kr(r),i=0;i>15-n[i]);return o},$i=new lr(288);for(var Dt=0;Dt<144;++Dt)$i[Dt]=8;for(var Dt=144;Dt<256;++Dt)$i[Dt]=9;for(var Dt=256;Dt<280;++Dt)$i[Dt]=7;for(var Dt=280;Dt<288;++Dt)$i[Dt]=8;var Io=new lr(32);for(var Dt=0;Dt<32;++Dt)Io[Dt]=5;var O3=Vn($i,9,0),E3=Vn($i,9,1),b3=Vn(Io,5,0),T3=Vn(Io,5,1),Du=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},On=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},xu=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},Bg=function(n){return(n+7)/8|0},Ug=function(n,e,t){(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length);var r=new lr(t-e);return r.set(n.subarray(e,t)),r},v3=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],xr=function(n,e,t){var r=new Error(e||v3[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,xr),!t)throw r;return r},Fg=function(n,e,t,r){var i=n.length,a=r?r.length:0;if(!i||e.f&&!e.l)return t||new lr(0);var s=!t||e.i!=2,o=e.i;t||(t=new lr(i*3));var l=function(Ve){var je=t.length;if(Ve>je){var ot=new lr(Math.max(je*2,Ve));ot.set(t),t=ot}},c=e.f||0,d=e.p||0,p=e.b||0,m=e.l,_=e.d,b=e.m,A=e.n,R=i*8;do{if(!m){c=On(n,d,1);var x=On(n,d+1,3);if(d+=3,x)if(x==1)m=E3,_=T3,b=9,A=5;else if(x==2){var E=On(n,d,31)+257,S=On(n,d+10,15)+4,I=E+On(n,d+5,31)+1;d+=14;for(var D=new lr(I),L=new lr(19),k=0;k>4;if(Y<16)D[k++]=Y;else{var te=0,M=0;for(Y==16?(M=3+On(n,d,3),d+=2,te=D[k-1]):Y==17?(M=3+On(n,d,7),d+=3):Y==18&&(M=11+On(n,d,127),d+=7);M--;)D[k++]=te}}var Q=D.subarray(0,E),j=D.subarray(E);b=Du(Q),A=Du(j),m=Vn(Q,b,1),_=Vn(j,A,1)}else xr(1);else{var Y=Bg(d)+4,Z=n[Y-4]|n[Y-3]<<8,h=Y+Z;if(h>i){o&&xr(0);break}s&&l(p+Z),t.set(n.subarray(Y,h),p),e.b=p+=Z,e.p=d=h*8,e.f=c;continue}if(d>R){o&&xr(0);break}}s&&l(p+131072);for(var X=(1<>4;if(d+=te&15,d>R){o&&xr(0);break}if(te||xr(2),Oe<256)t[p++]=Oe;else if(Oe==256){se=d,m=null;break}else{var ke=Oe-254;if(Oe>264){var k=Oe-257,Le=Pc[k];ke=On(n,d,(1<>4;Ee||xr(3),d+=Ee&15;var j=S3[Ne];if(Ne>3){var Le=Bc[Ne];j+=xu(n,d)&(1<R){o&&xr(0);break}s&&l(p+131072);var ue=p+ke;if(p>8},Qs=function(n,e,t){t<<=e&7;var r=e/8|0;n[r]|=t,n[r+1]|=t>>8,n[r+2]|=t>>16},ku=function(n,e){for(var t=[],r=0;rm&&(m=a[r].s);var _=new Kr(m+1),b=Nm(t[d-1],_,0);if(b>e){var r=0,A=0,R=b-e,x=1<e)A+=x-(1<>=R;A>0;){var Z=a[r].s;_[Z]=0&&A;--r){var h=a[r].s;_[h]==e&&(--_[h],++A)}b=e}return{t:new lr(_),l:b}},Nm=function(n,e,t){return n.s==-1?Math.max(Nm(n.l,e,t+1),Nm(n.r,e,t+1)):e[n.s]=t},WO=function(n){for(var e=n.length;e&&!n[--e];);for(var t=new Kr(++e),r=0,i=n[0],a=1,s=function(l){t[r++]=l},o=1;o<=e;++o)if(n[o]==i&&o!=e)++a;else{if(!i&&a>2){for(;a>138;a-=138)s(32754);a>2&&(s(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(s(i),--a;a>6;a-=6)s(8304);a>2&&(s(a-3<<5|8208),a=0)}for(;a--;)s(i);a=1,i=n[o]}return{c:t.subarray(0,r),n:e}},qs=function(n,e){for(var t=0,r=0;r>8,n[i+2]=n[i]^255,n[i+3]=n[i+1]^255;for(var a=0;a4&&!k[Am[ee-1]];--ee);var ne=c+5<<3,re=qs(i,$i)+qs(a,Io)+s,te=qs(i,m)+qs(a,A)+s+14+3*ee+qs(I,k)+2*I[16]+3*I[17]+7*I[18];if(l>=0&&ne<=re&&ne<=te)return hR(e,d,n.subarray(l,l+c));var M,Q,j,X;if(Jn(e,d,1+(te15&&(Jn(e,d,ke[D]>>5&127),d+=ke[D]>>12)}}else M=O3,Q=$i,j=b3,X=Io;for(var D=0;D255){var Le=Ee>>18&31;Qs(e,d,M[Le+257]),d+=Q[Le+257],Le>7&&(Jn(e,d,Ee>>23&31),d+=Pc[Le]);var Ne=Ee&31;Qs(e,d,j[Ne]),d+=X[Ne],Ne>3&&(Qs(e,d,Ee>>5&8191),d+=Bc[Ne])}else Qs(e,d,M[Ee]),d+=Q[Ee]}return Qs(e,d,M[256]),d+Q[256]},C3=new Pg([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),fR=new lr(0),y3=function(n,e,t,r,i,a){var s=a.z||n.length,o=new lr(r+s+5*(1+Math.ceil(s/7e3))+i),l=o.subarray(r,o.length-i),c=a.l,d=(a.r||0)&7;if(e){d&&(l[0]=a.r>>3);for(var p=C3[e-1],m=p>>13,_=p&8191,b=(1<7e3||k>24576)&&(M>423||!c)){d=XO(n,l,0,h,E,S,D,k,ee,L-ee,d),k=I=D=0,ee=L;for(var Q=0;Q<286;++Q)E[Q]=0;for(var Q=0;Q<30;++Q)S[Q]=0}var j=2,X=0,le=_,se=re-te&32767;if(M>2&&ne==Z(L-se))for(var Oe=Math.min(m,M)-1,ke=Math.min(32767,L),Le=Math.min(258,M);se<=ke&&--le&&re!=te;){if(n[L+j]==n[L+j-se]){for(var Ee=0;Eej){if(j=Ee,X=se,Ee>Oe)break;for(var Ne=Math.min(se,Ee-2),ue=0,Q=0;Que&&(ue=Ve,te=we)}}}re=te,te=A[re],se+=re-te&32767}if(X){h[k++]=268435456|Rm[j]<<18|zO[X];var je=Rm[j]&31,ot=zO[X]&31;D+=Pc[je]+Bc[ot],++E[257+je],++S[ot],$=L+j,++I}else h[k++]=n[L],++E[n[L]]}}for(L=Math.max(L,$);L=s&&(l[d/8|0]=c,St=s),d=hR(l,d+1,n.subarray(L,St))}a.i=s}return Ug(o,0,r+Bg(d)+i)},A3=function(){for(var n=new Int32Array(256),e=0;e<256;++e){for(var t=e,r=9;--r;)t=(t&1&&-306674912)^t>>>1;n[e]=t}return n}(),R3=function(){var n=-1;return{p:function(e){for(var t=n,r=0;r>>8;n=t},d:function(){return~n}}},I3=function(n,e,t,r,i){if(!i&&(i={l:1},e.dictionary)){var a=e.dictionary.subarray(-32768),s=new lr(a.length+n.length);s.set(a),s.set(n,a.length),n=s,i.w=a.length}return y3(n,e.level==null?6:e.level,e.mem==null?Math.ceil(Math.max(8,Math.min(13,Math.log(n.length)))*1.5):12+e.mem,t,r,i)},wm=function(n,e,t){for(;t;++e)n[e]=t,t>>>=8},N3=function(n,e){var t=e.filename;if(n[0]=31,n[1]=139,n[2]=8,n[8]=e.level<2?4:e.level==9?2:0,n[9]=3,e.mtime!=0&&wm(n,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),t){n[3]=8;for(var r=0;r<=t.length;++r)n[r+10]=t.charCodeAt(r)}},w3=function(n){(n[0]!=31||n[1]!=139||n[2]!=8)&&xr(6,"invalid gzip data");var e=n[3],t=10;e&4&&(t+=(n[10]|n[11]<<8)+2);for(var r=(e>>3&1)+(e>>4&1);r>0;r-=!n[t++]);return t+(e&2)},D3=function(n){var e=n.length;return(n[e-4]|n[e-3]<<8|n[e-2]<<16|n[e-1]<<24)>>>0},x3=function(n){return 10+(n.filename?n.filename.length+1:0)},k3=function(n,e){return((n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&xr(6,"invalid zlib data"),(n[1]>>5&1)==+!e&&xr(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function L3(n,e){return Fg(n,{i:2},e&&e.out,e&&e.dictionary)}function M3(n,e){e||(e={});var t=R3(),r=n.length;t.p(n);var i=I3(n,e,x3(e),8),a=i.length;return N3(i,e),wm(i,a-8,t.d()),wm(i,a-4,r),i}function P3(n,e){var t=w3(n);return t+8>n.length&&xr(6,"invalid gzip data"),Fg(n.subarray(t,-8),{i:2},e&&e.out||new lr(D3(n)),e&&e.dictionary)}function B3(n,e){return Fg(n.subarray(k3(n,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}function U3(n,e){return n[0]==31&&n[1]==139&&n[2]==8?P3(n,e):(n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31?L3(n,e):B3(n,e)}var Dm=typeof TextDecoder<"u"&&new TextDecoder,F3=0;try{Dm.decode(fR,{stream:!0}),F3=1}catch{}var Y3=function(n){for(var e="",t=0;;){var r=n[t++],i=(r>127)+(r>223)+(r>239);if(t+i>n.length)return{s:e,r:Ug(n,t-1)};i?i==3?(r=((r&15)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,e+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?e+=String.fromCharCode((r&31)<<6|n[t++]&63):e+=String.fromCharCode((r&15)<<12|(n[t++]&63)<<6|n[t++]&63):e+=String.fromCharCode(r)}};function G3(n,e){if(e){for(var t="",r=0;r (GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:!1,describe:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:!1,describe:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",describe:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:!0,describe:"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",type:"boolean"},openLinksInNewWindow:{defaultValue:!1,describe:"Open all links in new windows",type:"boolean"},backslashEscapesHTMLTags:{defaultValue:!1,describe:"Support for HTML Tag escaping. ex:
foo
",type:"boolean"},emoji:{defaultValue:!1,describe:"Enable emoji support. Ex: `this is a :smile: emoji`",type:"boolean"},underline:{defaultValue:!1,describe:"Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `` and ``",type:"boolean"},ellipsis:{defaultValue:!0,describe:"Replaces three dots with the ellipsis unicode character",type:"boolean"},completeHTMLDocument:{defaultValue:!1,describe:"Outputs a complete html document, including ``, `` and `` tags",type:"boolean"},metadata:{defaultValue:!1,describe:"Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).",type:"boolean"},splitAdjacentBlockquotes:{defaultValue:!1,describe:"Split adjacent blockquote blocks",type:"boolean"}};if(h===!1)return JSON.parse(JSON.stringify(E));var S={};for(var I in E)E.hasOwnProperty(I)&&(S[I]=E[I].defaultValue);return S}function t(){var h=e(!0),E={};for(var S in h)h.hasOwnProperty(S)&&(E[S]=!0);return E}var r={},i={},a={},s=e(!0),o="vanilla",l={github:{omitExtraWLInCodeBlocks:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,disableForced4SpacesIndentedSublists:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghCompatibleHeaderId:!0,ghMentions:!0,backslashEscapesHTMLTags:!0,emoji:!0,splitAdjacentBlockquotes:!0},original:{noHeaderId:!0,ghCodeBlocks:!1},ghost:{omitExtraWLInCodeBlocks:!0,parseImgDimensions:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,smoothLivePreview:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghMentions:!1,encodeEmails:!0},vanilla:e(!0),allOn:t()};r.helper={},r.extensions={},r.setOption=function(h,E){return s[h]=E,this},r.getOption=function(h){return s[h]},r.getOptions=function(){return s},r.resetOptions=function(){s=e(!0)},r.setFlavor=function(h){if(!l.hasOwnProperty(h))throw Error(h+" flavor was not found");r.resetOptions();var E=l[h];o=h;for(var S in E)E.hasOwnProperty(S)&&(s[S]=E[S])},r.getFlavor=function(){return o},r.getFlavorOptions=function(h){if(l.hasOwnProperty(h))return l[h]},r.getDefaultOptions=function(h){return e(h)},r.subParser=function(h,E){if(r.helper.isString(h))if(typeof E<"u")i[h]=E;else{if(i.hasOwnProperty(h))return i[h];throw Error("SubParser named "+h+" not registered!")}},r.extension=function(h,E){if(!r.helper.isString(h))throw Error("Extension 'name' must be a string");if(h=r.helper.stdExtName(h),r.helper.isUndefined(E)){if(!a.hasOwnProperty(h))throw Error("Extension named "+h+" is not registered!");return a[h]}else{typeof E=="function"&&(E=E()),r.helper.isArray(E)||(E=[E]);var S=c(E,h);if(S.valid)a[h]=E;else throw Error(S.error)}},r.getAllExtensions=function(){return a},r.removeExtension=function(h){delete a[h]},r.resetExtensions=function(){a={}};function c(h,E){var S=E?"Error in "+E+" extension->":"Error in unnamed extension",I={valid:!0,error:""};r.helper.isArray(h)||(h=[h]);for(var D=0;D"u"},r.helper.forEach=function(h,E){if(r.helper.isUndefined(h))throw new Error("obj param is required");if(r.helper.isUndefined(E))throw new Error("callback param is required");if(!r.helper.isFunction(E))throw new Error("callback param must be a function/closure");if(typeof h.forEach=="function")h.forEach(E);else if(r.helper.isArray(h))for(var S=0;S").replace(/&/g,"&")};var p=function(h,E,S,I){var D=I||"",L=D.indexOf("g")>-1,k=new RegExp(E+"|"+S,"g"+D.replace(/g/g,"")),$=new RegExp(E,D.replace(/g/g,"")),ee=[],ne,re,te,M,Q;do for(ne=0;te=k.exec(h);)if($.test(te[0]))ne++||(re=k.lastIndex,M=re-te[0].length);else if(ne&&!--ne){Q=te.index+te[0].length;var j={left:{start:M,end:re},match:{start:re,end:te.index},right:{start:te.index,end:Q},wholeMatch:{start:M,end:Q}};if(ee.push(j),!L)return ee}while(ne&&(k.lastIndex=re));return ee};r.helper.matchRecursiveRegExp=function(h,E,S,I){for(var D=p(h,E,S,I),L=[],k=0;k0){var ne=[];k[0].wholeMatch.start!==0&&ne.push(h.slice(0,k[0].wholeMatch.start));for(var re=0;re=0?I+(S||0):I},r.helper.splitAtIndex=function(h,E){if(!r.helper.isString(h))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";return[h.substring(0,E),h.substring(E)]},r.helper.encodeEmailAddress=function(h){var E=[function(S){return"&#"+S.charCodeAt(0)+";"},function(S){return"&#x"+S.charCodeAt(0).toString(16)+";"},function(S){return S}];return h=h.replace(/./g,function(S){if(S==="@")S=E[Math.floor(Math.random()*2)](S);else{var I=Math.random();S=I>.9?E[2](S):I>.45?E[1](S):E[0](S)}return S}),h},r.helper.padEnd=function(E,S,I){return S=S>>0,I=String(I||" "),E.length>S?String(E):(S=S-E.length,S>I.length&&(I+=I.repeat(S/I.length)),String(E)+I.slice(0,S))},typeof console>"u"&&(console={warn:function(h){alert(h)},log:function(h){alert(h)},error:function(h){throw h}}),r.helper.regexes={asteriskDashAndColon:/([*_:~])/g},r.helper.emojis={"+1":"👍","-1":"👎",100:"💯",1234:"🔢","1st_place_medal":"🥇","2nd_place_medal":"🥈","3rd_place_medal":"🥉","8ball":"🎱",a:"🅰️",ab:"🆎",abc:"🔤",abcd:"🔡",accept:"🉑",aerial_tramway:"🚡",airplane:"✈️",alarm_clock:"⏰",alembic:"⚗️",alien:"👽",ambulance:"🚑",amphora:"🏺",anchor:"⚓️",angel:"👼",anger:"💢",angry:"😠",anguished:"😧",ant:"🐜",apple:"🍎",aquarius:"♒️",aries:"♈️",arrow_backward:"◀️",arrow_double_down:"⏬",arrow_double_up:"⏫",arrow_down:"⬇️",arrow_down_small:"🔽",arrow_forward:"▶️",arrow_heading_down:"⤵️",arrow_heading_up:"⤴️",arrow_left:"⬅️",arrow_lower_left:"↙️",arrow_lower_right:"↘️",arrow_right:"➡️",arrow_right_hook:"↪️",arrow_up:"⬆️",arrow_up_down:"↕️",arrow_up_small:"🔼",arrow_upper_left:"↖️",arrow_upper_right:"↗️",arrows_clockwise:"🔃",arrows_counterclockwise:"🔄",art:"🎨",articulated_lorry:"🚛",artificial_satellite:"🛰",astonished:"😲",athletic_shoe:"👟",atm:"🏧",atom_symbol:"⚛️",avocado:"🥑",b:"🅱️",baby:"👶",baby_bottle:"🍼",baby_chick:"🐤",baby_symbol:"🚼",back:"🔙",bacon:"🥓",badminton:"🏸",baggage_claim:"🛄",baguette_bread:"🥖",balance_scale:"⚖️",balloon:"🎈",ballot_box:"🗳",ballot_box_with_check:"☑️",bamboo:"🎍",banana:"🍌",bangbang:"‼️",bank:"🏦",bar_chart:"📊",barber:"💈",baseball:"⚾️",basketball:"🏀",basketball_man:"⛹️",basketball_woman:"⛹️‍♀️",bat:"🦇",bath:"🛀",bathtub:"🛁",battery:"🔋",beach_umbrella:"🏖",bear:"🐻",bed:"🛏",bee:"🐝",beer:"🍺",beers:"🍻",beetle:"🐞",beginner:"🔰",bell:"🔔",bellhop_bell:"🛎",bento:"🍱",biking_man:"🚴",bike:"🚲",biking_woman:"🚴‍♀️",bikini:"👙",biohazard:"☣️",bird:"🐦",birthday:"🎂",black_circle:"⚫️",black_flag:"🏴",black_heart:"🖤",black_joker:"🃏",black_large_square:"⬛️",black_medium_small_square:"◾️",black_medium_square:"◼️",black_nib:"✒️",black_small_square:"▪️",black_square_button:"🔲",blonde_man:"👱",blonde_woman:"👱‍♀️",blossom:"🌼",blowfish:"🐡",blue_book:"📘",blue_car:"🚙",blue_heart:"💙",blush:"😊",boar:"🐗",boat:"⛵️",bomb:"💣",book:"📖",bookmark:"🔖",bookmark_tabs:"📑",books:"📚",boom:"💥",boot:"👢",bouquet:"💐",bowing_man:"🙇",bow_and_arrow:"🏹",bowing_woman:"🙇‍♀️",bowling:"🎳",boxing_glove:"🥊",boy:"👦",bread:"🍞",bride_with_veil:"👰",bridge_at_night:"🌉",briefcase:"💼",broken_heart:"💔",bug:"🐛",building_construction:"🏗",bulb:"💡",bullettrain_front:"🚅",bullettrain_side:"🚄",burrito:"🌯",bus:"🚌",business_suit_levitating:"🕴",busstop:"🚏",bust_in_silhouette:"👤",busts_in_silhouette:"👥",butterfly:"🦋",cactus:"🌵",cake:"🍰",calendar:"📆",call_me_hand:"🤙",calling:"📲",camel:"🐫",camera:"📷",camera_flash:"📸",camping:"🏕",cancer:"♋️",candle:"🕯",candy:"🍬",canoe:"🛶",capital_abcd:"🔠",capricorn:"♑️",car:"🚗",card_file_box:"🗃",card_index:"📇",card_index_dividers:"🗂",carousel_horse:"🎠",carrot:"🥕",cat:"🐱",cat2:"🐈",cd:"💿",chains:"⛓",champagne:"🍾",chart:"💹",chart_with_downwards_trend:"📉",chart_with_upwards_trend:"📈",checkered_flag:"🏁",cheese:"🧀",cherries:"🍒",cherry_blossom:"🌸",chestnut:"🌰",chicken:"🐔",children_crossing:"🚸",chipmunk:"🐿",chocolate_bar:"🍫",christmas_tree:"🎄",church:"⛪️",cinema:"🎦",circus_tent:"🎪",city_sunrise:"🌇",city_sunset:"🌆",cityscape:"🏙",cl:"🆑",clamp:"🗜",clap:"👏",clapper:"🎬",classical_building:"🏛",clinking_glasses:"🥂",clipboard:"📋",clock1:"🕐",clock10:"🕙",clock1030:"🕥",clock11:"🕚",clock1130:"🕦",clock12:"🕛",clock1230:"🕧",clock130:"🕜",clock2:"🕑",clock230:"🕝",clock3:"🕒",clock330:"🕞",clock4:"🕓",clock430:"🕟",clock5:"🕔",clock530:"🕠",clock6:"🕕",clock630:"🕡",clock7:"🕖",clock730:"🕢",clock8:"🕗",clock830:"🕣",clock9:"🕘",clock930:"🕤",closed_book:"📕",closed_lock_with_key:"🔐",closed_umbrella:"🌂",cloud:"☁️",cloud_with_lightning:"🌩",cloud_with_lightning_and_rain:"⛈",cloud_with_rain:"🌧",cloud_with_snow:"🌨",clown_face:"🤡",clubs:"♣️",cocktail:"🍸",coffee:"☕️",coffin:"⚰️",cold_sweat:"😰",comet:"☄️",computer:"💻",computer_mouse:"🖱",confetti_ball:"🎊",confounded:"😖",confused:"😕",congratulations:"㊗️",construction:"🚧",construction_worker_man:"👷",construction_worker_woman:"👷‍♀️",control_knobs:"🎛",convenience_store:"🏪",cookie:"🍪",cool:"🆒",policeman:"👮",copyright:"©️",corn:"🌽",couch_and_lamp:"🛋",couple:"👫",couple_with_heart_woman_man:"💑",couple_with_heart_man_man:"👨‍❤️‍👨",couple_with_heart_woman_woman:"👩‍❤️‍👩",couplekiss_man_man:"👨‍❤️‍💋‍👨",couplekiss_man_woman:"💏",couplekiss_woman_woman:"👩‍❤️‍💋‍👩",cow:"🐮",cow2:"🐄",cowboy_hat_face:"🤠",crab:"🦀",crayon:"🖍",credit_card:"💳",crescent_moon:"🌙",cricket:"🏏",crocodile:"🐊",croissant:"🥐",crossed_fingers:"🤞",crossed_flags:"🎌",crossed_swords:"⚔️",crown:"👑",cry:"😢",crying_cat_face:"😿",crystal_ball:"🔮",cucumber:"🥒",cupid:"💘",curly_loop:"➰",currency_exchange:"💱",curry:"🍛",custard:"🍮",customs:"🛃",cyclone:"🌀",dagger:"🗡",dancer:"💃",dancing_women:"👯",dancing_men:"👯‍♂️",dango:"🍡",dark_sunglasses:"🕶",dart:"🎯",dash:"💨",date:"📅",deciduous_tree:"🌳",deer:"🦌",department_store:"🏬",derelict_house:"🏚",desert:"🏜",desert_island:"🏝",desktop_computer:"🖥",male_detective:"🕵️",diamond_shape_with_a_dot_inside:"💠",diamonds:"♦️",disappointed:"😞",disappointed_relieved:"😥",dizzy:"💫",dizzy_face:"😵",do_not_litter:"🚯",dog:"🐶",dog2:"🐕",dollar:"💵",dolls:"🎎",dolphin:"🐬",door:"🚪",doughnut:"🍩",dove:"🕊",dragon:"🐉",dragon_face:"🐲",dress:"👗",dromedary_camel:"🐪",drooling_face:"🤤",droplet:"💧",drum:"🥁",duck:"🦆",dvd:"📀","e-mail":"📧",eagle:"🦅",ear:"👂",ear_of_rice:"🌾",earth_africa:"🌍",earth_americas:"🌎",earth_asia:"🌏",egg:"🥚",eggplant:"🍆",eight_pointed_black_star:"✴️",eight_spoked_asterisk:"✳️",electric_plug:"🔌",elephant:"🐘",email:"✉️",end:"🔚",envelope_with_arrow:"📩",euro:"💶",european_castle:"🏰",european_post_office:"🏤",evergreen_tree:"🌲",exclamation:"❗️",expressionless:"😑",eye:"👁",eye_speech_bubble:"👁‍🗨",eyeglasses:"👓",eyes:"👀",face_with_head_bandage:"🤕",face_with_thermometer:"🤒",fist_oncoming:"👊",factory:"🏭",fallen_leaf:"🍂",family_man_woman_boy:"👪",family_man_boy:"👨‍👦",family_man_boy_boy:"👨‍👦‍👦",family_man_girl:"👨‍👧",family_man_girl_boy:"👨‍👧‍👦",family_man_girl_girl:"👨‍👧‍👧",family_man_man_boy:"👨‍👨‍👦",family_man_man_boy_boy:"👨‍👨‍👦‍👦",family_man_man_girl:"👨‍👨‍👧",family_man_man_girl_boy:"👨‍👨‍👧‍👦",family_man_man_girl_girl:"👨‍👨‍👧‍👧",family_man_woman_boy_boy:"👨‍👩‍👦‍👦",family_man_woman_girl:"👨‍👩‍👧",family_man_woman_girl_boy:"👨‍👩‍👧‍👦",family_man_woman_girl_girl:"👨‍👩‍👧‍👧",family_woman_boy:"👩‍👦",family_woman_boy_boy:"👩‍👦‍👦",family_woman_girl:"👩‍👧",family_woman_girl_boy:"👩‍👧‍👦",family_woman_girl_girl:"👩‍👧‍👧",family_woman_woman_boy:"👩‍👩‍👦",family_woman_woman_boy_boy:"👩‍👩‍👦‍👦",family_woman_woman_girl:"👩‍👩‍👧",family_woman_woman_girl_boy:"👩‍👩‍👧‍👦",family_woman_woman_girl_girl:"👩‍👩‍👧‍👧",fast_forward:"⏩",fax:"📠",fearful:"😨",feet:"🐾",female_detective:"🕵️‍♀️",ferris_wheel:"🎡",ferry:"⛴",field_hockey:"🏑",file_cabinet:"🗄",file_folder:"📁",film_projector:"📽",film_strip:"🎞",fire:"🔥",fire_engine:"🚒",fireworks:"🎆",first_quarter_moon:"🌓",first_quarter_moon_with_face:"🌛",fish:"🐟",fish_cake:"🍥",fishing_pole_and_fish:"🎣",fist_raised:"✊",fist_left:"🤛",fist_right:"🤜",flags:"🎏",flashlight:"🔦",fleur_de_lis:"⚜️",flight_arrival:"🛬",flight_departure:"🛫",floppy_disk:"💾",flower_playing_cards:"🎴",flushed:"😳",fog:"🌫",foggy:"🌁",football:"🏈",footprints:"👣",fork_and_knife:"🍴",fountain:"⛲️",fountain_pen:"🖋",four_leaf_clover:"🍀",fox_face:"🦊",framed_picture:"🖼",free:"🆓",fried_egg:"🍳",fried_shrimp:"🍤",fries:"🍟",frog:"🐸",frowning:"😦",frowning_face:"☹️",frowning_man:"🙍‍♂️",frowning_woman:"🙍",middle_finger:"🖕",fuelpump:"⛽️",full_moon:"🌕",full_moon_with_face:"🌝",funeral_urn:"⚱️",game_die:"🎲",gear:"⚙️",gem:"💎",gemini:"♊️",ghost:"👻",gift:"🎁",gift_heart:"💝",girl:"👧",globe_with_meridians:"🌐",goal_net:"🥅",goat:"🐐",golf:"⛳️",golfing_man:"🏌️",golfing_woman:"🏌️‍♀️",gorilla:"🦍",grapes:"🍇",green_apple:"🍏",green_book:"📗",green_heart:"💚",green_salad:"🥗",grey_exclamation:"❕",grey_question:"❔",grimacing:"😬",grin:"😁",grinning:"😀",guardsman:"💂",guardswoman:"💂‍♀️",guitar:"🎸",gun:"🔫",haircut_woman:"💇",haircut_man:"💇‍♂️",hamburger:"🍔",hammer:"🔨",hammer_and_pick:"⚒",hammer_and_wrench:"🛠",hamster:"🐹",hand:"✋",handbag:"👜",handshake:"🤝",hankey:"💩",hatched_chick:"🐥",hatching_chick:"🐣",headphones:"🎧",hear_no_evil:"🙉",heart:"❤️",heart_decoration:"💟",heart_eyes:"😍",heart_eyes_cat:"😻",heartbeat:"💓",heartpulse:"💗",hearts:"♥️",heavy_check_mark:"✔️",heavy_division_sign:"➗",heavy_dollar_sign:"💲",heavy_heart_exclamation:"❣️",heavy_minus_sign:"➖",heavy_multiplication_x:"✖️",heavy_plus_sign:"➕",helicopter:"🚁",herb:"🌿",hibiscus:"🌺",high_brightness:"🔆",high_heel:"👠",hocho:"🔪",hole:"🕳",honey_pot:"🍯",horse:"🐴",horse_racing:"🏇",hospital:"🏥",hot_pepper:"🌶",hotdog:"🌭",hotel:"🏨",hotsprings:"♨️",hourglass:"⌛️",hourglass_flowing_sand:"⏳",house:"🏠",house_with_garden:"🏡",houses:"🏘",hugs:"🤗",hushed:"😯",ice_cream:"🍨",ice_hockey:"🏒",ice_skate:"⛸",icecream:"🍦",id:"🆔",ideograph_advantage:"🉐",imp:"👿",inbox_tray:"📥",incoming_envelope:"📨",tipping_hand_woman:"💁",information_source:"ℹ️",innocent:"😇",interrobang:"⁉️",iphone:"📱",izakaya_lantern:"🏮",jack_o_lantern:"🎃",japan:"🗾",japanese_castle:"🏯",japanese_goblin:"👺",japanese_ogre:"👹",jeans:"👖",joy:"😂",joy_cat:"😹",joystick:"🕹",kaaba:"🕋",key:"🔑",keyboard:"⌨️",keycap_ten:"🔟",kick_scooter:"🛴",kimono:"👘",kiss:"💋",kissing:"😗",kissing_cat:"😽",kissing_closed_eyes:"😚",kissing_heart:"😘",kissing_smiling_eyes:"😙",kiwi_fruit:"🥝",koala:"🐨",koko:"🈁",label:"🏷",large_blue_circle:"🔵",large_blue_diamond:"🔷",large_orange_diamond:"🔶",last_quarter_moon:"🌗",last_quarter_moon_with_face:"🌜",latin_cross:"✝️",laughing:"😆",leaves:"🍃",ledger:"📒",left_luggage:"🛅",left_right_arrow:"↔️",leftwards_arrow_with_hook:"↩️",lemon:"🍋",leo:"♌️",leopard:"🐆",level_slider:"🎚",libra:"♎️",light_rail:"🚈",link:"🔗",lion:"🦁",lips:"👄",lipstick:"💄",lizard:"🦎",lock:"🔒",lock_with_ink_pen:"🔏",lollipop:"🍭",loop:"➿",loud_sound:"🔊",loudspeaker:"📢",love_hotel:"🏩",love_letter:"💌",low_brightness:"🔅",lying_face:"🤥",m:"Ⓜ️",mag:"🔍",mag_right:"🔎",mahjong:"🀄️",mailbox:"📫",mailbox_closed:"📪",mailbox_with_mail:"📬",mailbox_with_no_mail:"📭",man:"👨",man_artist:"👨‍🎨",man_astronaut:"👨‍🚀",man_cartwheeling:"🤸‍♂️",man_cook:"👨‍🍳",man_dancing:"🕺",man_facepalming:"🤦‍♂️",man_factory_worker:"👨‍🏭",man_farmer:"👨‍🌾",man_firefighter:"👨‍🚒",man_health_worker:"👨‍⚕️",man_in_tuxedo:"🤵",man_judge:"👨‍⚖️",man_juggling:"🤹‍♂️",man_mechanic:"👨‍🔧",man_office_worker:"👨‍💼",man_pilot:"👨‍✈️",man_playing_handball:"🤾‍♂️",man_playing_water_polo:"🤽‍♂️",man_scientist:"👨‍🔬",man_shrugging:"🤷‍♂️",man_singer:"👨‍🎤",man_student:"👨‍🎓",man_teacher:"👨‍🏫",man_technologist:"👨‍💻",man_with_gua_pi_mao:"👲",man_with_turban:"👳",tangerine:"🍊",mans_shoe:"👞",mantelpiece_clock:"🕰",maple_leaf:"🍁",martial_arts_uniform:"🥋",mask:"😷",massage_woman:"💆",massage_man:"💆‍♂️",meat_on_bone:"🍖",medal_military:"🎖",medal_sports:"🏅",mega:"📣",melon:"🍈",memo:"📝",men_wrestling:"🤼‍♂️",menorah:"🕎",mens:"🚹",metal:"🤘",metro:"🚇",microphone:"🎤",microscope:"🔬",milk_glass:"🥛",milky_way:"🌌",minibus:"🚐",minidisc:"💽",mobile_phone_off:"📴",money_mouth_face:"🤑",money_with_wings:"💸",moneybag:"💰",monkey:"🐒",monkey_face:"🐵",monorail:"🚝",moon:"🌔",mortar_board:"🎓",mosque:"🕌",motor_boat:"🛥",motor_scooter:"🛵",motorcycle:"🏍",motorway:"🛣",mount_fuji:"🗻",mountain:"⛰",mountain_biking_man:"🚵",mountain_biking_woman:"🚵‍♀️",mountain_cableway:"🚠",mountain_railway:"🚞",mountain_snow:"🏔",mouse:"🐭",mouse2:"🐁",movie_camera:"🎥",moyai:"🗿",mrs_claus:"🤶",muscle:"💪",mushroom:"🍄",musical_keyboard:"🎹",musical_note:"🎵",musical_score:"🎼",mute:"🔇",nail_care:"💅",name_badge:"📛",national_park:"🏞",nauseated_face:"🤢",necktie:"👔",negative_squared_cross_mark:"❎",nerd_face:"🤓",neutral_face:"😐",new:"🆕",new_moon:"🌑",new_moon_with_face:"🌚",newspaper:"📰",newspaper_roll:"🗞",next_track_button:"⏭",ng:"🆖",no_good_man:"🙅‍♂️",no_good_woman:"🙅",night_with_stars:"🌃",no_bell:"🔕",no_bicycles:"🚳",no_entry:"⛔️",no_entry_sign:"🚫",no_mobile_phones:"📵",no_mouth:"😶",no_pedestrians:"🚷",no_smoking:"🚭","non-potable_water":"🚱",nose:"👃",notebook:"📓",notebook_with_decorative_cover:"📔",notes:"🎶",nut_and_bolt:"🔩",o:"⭕️",o2:"🅾️",ocean:"🌊",octopus:"🐙",oden:"🍢",office:"🏢",oil_drum:"🛢",ok:"🆗",ok_hand:"👌",ok_man:"🙆‍♂️",ok_woman:"🙆",old_key:"🗝",older_man:"👴",older_woman:"👵",om:"🕉",on:"🔛",oncoming_automobile:"🚘",oncoming_bus:"🚍",oncoming_police_car:"🚔",oncoming_taxi:"🚖",open_file_folder:"📂",open_hands:"👐",open_mouth:"😮",open_umbrella:"☂️",ophiuchus:"⛎",orange_book:"📙",orthodox_cross:"☦️",outbox_tray:"📤",owl:"🦉",ox:"🐂",package:"📦",page_facing_up:"📄",page_with_curl:"📃",pager:"📟",paintbrush:"🖌",palm_tree:"🌴",pancakes:"🥞",panda_face:"🐼",paperclip:"📎",paperclips:"🖇",parasol_on_ground:"⛱",parking:"🅿️",part_alternation_mark:"〽️",partly_sunny:"⛅️",passenger_ship:"🛳",passport_control:"🛂",pause_button:"⏸",peace_symbol:"☮️",peach:"🍑",peanuts:"🥜",pear:"🍐",pen:"🖊",pencil2:"✏️",penguin:"🐧",pensive:"😔",performing_arts:"🎭",persevere:"😣",person_fencing:"🤺",pouting_woman:"🙎",phone:"☎️",pick:"⛏",pig:"🐷",pig2:"🐖",pig_nose:"🐽",pill:"💊",pineapple:"🍍",ping_pong:"🏓",pisces:"♓️",pizza:"🍕",place_of_worship:"🛐",plate_with_cutlery:"🍽",play_or_pause_button:"⏯",point_down:"👇",point_left:"👈",point_right:"👉",point_up:"☝️",point_up_2:"👆",police_car:"🚓",policewoman:"👮‍♀️",poodle:"🐩",popcorn:"🍿",post_office:"🏣",postal_horn:"📯",postbox:"📮",potable_water:"🚰",potato:"🥔",pouch:"👝",poultry_leg:"🍗",pound:"💷",rage:"😡",pouting_cat:"😾",pouting_man:"🙎‍♂️",pray:"🙏",prayer_beads:"📿",pregnant_woman:"🤰",previous_track_button:"⏮",prince:"🤴",princess:"👸",printer:"🖨",purple_heart:"💜",purse:"👛",pushpin:"📌",put_litter_in_its_place:"🚮",question:"❓",rabbit:"🐰",rabbit2:"🐇",racehorse:"🐎",racing_car:"🏎",radio:"📻",radio_button:"🔘",radioactive:"☢️",railway_car:"🚃",railway_track:"🛤",rainbow:"🌈",rainbow_flag:"🏳️‍🌈",raised_back_of_hand:"🤚",raised_hand_with_fingers_splayed:"🖐",raised_hands:"🙌",raising_hand_woman:"🙋",raising_hand_man:"🙋‍♂️",ram:"🐏",ramen:"🍜",rat:"🐀",record_button:"⏺",recycle:"♻️",red_circle:"🔴",registered:"®️",relaxed:"☺️",relieved:"😌",reminder_ribbon:"🎗",repeat:"🔁",repeat_one:"🔂",rescue_worker_helmet:"⛑",restroom:"🚻",revolving_hearts:"💞",rewind:"⏪",rhinoceros:"🦏",ribbon:"🎀",rice:"🍚",rice_ball:"🍙",rice_cracker:"🍘",rice_scene:"🎑",right_anger_bubble:"🗯",ring:"💍",robot:"🤖",rocket:"🚀",rofl:"🤣",roll_eyes:"🙄",roller_coaster:"🎢",rooster:"🐓",rose:"🌹",rosette:"🏵",rotating_light:"🚨",round_pushpin:"📍",rowing_man:"🚣",rowing_woman:"🚣‍♀️",rugby_football:"🏉",running_man:"🏃",running_shirt_with_sash:"🎽",running_woman:"🏃‍♀️",sa:"🈂️",sagittarius:"♐️",sake:"🍶",sandal:"👡",santa:"🎅",satellite:"📡",saxophone:"🎷",school:"🏫",school_satchel:"🎒",scissors:"✂️",scorpion:"🦂",scorpius:"♏️",scream:"😱",scream_cat:"🙀",scroll:"📜",seat:"💺",secret:"㊙️",see_no_evil:"🙈",seedling:"🌱",selfie:"🤳",shallow_pan_of_food:"🥘",shamrock:"☘️",shark:"🦈",shaved_ice:"🍧",sheep:"🐑",shell:"🐚",shield:"🛡",shinto_shrine:"⛩",ship:"🚢",shirt:"👕",shopping:"🛍",shopping_cart:"🛒",shower:"🚿",shrimp:"🦐",signal_strength:"📶",six_pointed_star:"🔯",ski:"🎿",skier:"⛷",skull:"💀",skull_and_crossbones:"☠️",sleeping:"😴",sleeping_bed:"🛌",sleepy:"😪",slightly_frowning_face:"🙁",slightly_smiling_face:"🙂",slot_machine:"🎰",small_airplane:"🛩",small_blue_diamond:"🔹",small_orange_diamond:"🔸",small_red_triangle:"🔺",small_red_triangle_down:"🔻",smile:"😄",smile_cat:"😸",smiley:"😃",smiley_cat:"😺",smiling_imp:"😈",smirk:"😏",smirk_cat:"😼",smoking:"🚬",snail:"🐌",snake:"🐍",sneezing_face:"🤧",snowboarder:"🏂",snowflake:"❄️",snowman:"⛄️",snowman_with_snow:"☃️",sob:"😭",soccer:"⚽️",soon:"🔜",sos:"🆘",sound:"🔉",space_invader:"👾",spades:"♠️",spaghetti:"🍝",sparkle:"❇️",sparkler:"🎇",sparkles:"✨",sparkling_heart:"💖",speak_no_evil:"🙊",speaker:"🔈",speaking_head:"🗣",speech_balloon:"💬",speedboat:"🚤",spider:"🕷",spider_web:"🕸",spiral_calendar:"🗓",spiral_notepad:"🗒",spoon:"🥄",squid:"🦑",stadium:"🏟",star:"⭐️",star2:"🌟",star_and_crescent:"☪️",star_of_david:"✡️",stars:"🌠",station:"🚉",statue_of_liberty:"🗽",steam_locomotive:"🚂",stew:"🍲",stop_button:"⏹",stop_sign:"🛑",stopwatch:"⏱",straight_ruler:"📏",strawberry:"🍓",stuck_out_tongue:"😛",stuck_out_tongue_closed_eyes:"😝",stuck_out_tongue_winking_eye:"😜",studio_microphone:"🎙",stuffed_flatbread:"🥙",sun_behind_large_cloud:"🌥",sun_behind_rain_cloud:"🌦",sun_behind_small_cloud:"🌤",sun_with_face:"🌞",sunflower:"🌻",sunglasses:"😎",sunny:"☀️",sunrise:"🌅",sunrise_over_mountains:"🌄",surfing_man:"🏄",surfing_woman:"🏄‍♀️",sushi:"🍣",suspension_railway:"🚟",sweat:"😓",sweat_drops:"💦",sweat_smile:"😅",sweet_potato:"🍠",swimming_man:"🏊",swimming_woman:"🏊‍♀️",symbols:"🔣",synagogue:"🕍",syringe:"💉",taco:"🌮",tada:"🎉",tanabata_tree:"🎋",taurus:"♉️",taxi:"🚕",tea:"🍵",telephone_receiver:"📞",telescope:"🔭",tennis:"🎾",tent:"⛺️",thermometer:"🌡",thinking:"🤔",thought_balloon:"💭",ticket:"🎫",tickets:"🎟",tiger:"🐯",tiger2:"🐅",timer_clock:"⏲",tipping_hand_man:"💁‍♂️",tired_face:"😫",tm:"™️",toilet:"🚽",tokyo_tower:"🗼",tomato:"🍅",tongue:"👅",top:"🔝",tophat:"🎩",tornado:"🌪",trackball:"🖲",tractor:"🚜",traffic_light:"🚥",train:"🚋",train2:"🚆",tram:"🚊",triangular_flag_on_post:"🚩",triangular_ruler:"📐",trident:"🔱",triumph:"😤",trolleybus:"🚎",trophy:"🏆",tropical_drink:"🍹",tropical_fish:"🐠",truck:"🚚",trumpet:"🎺",tulip:"🌷",tumbler_glass:"🥃",turkey:"🦃",turtle:"🐢",tv:"📺",twisted_rightwards_arrows:"🔀",two_hearts:"💕",two_men_holding_hands:"👬",two_women_holding_hands:"👭",u5272:"🈹",u5408:"🈴",u55b6:"🈺",u6307:"🈯️",u6708:"🈷️",u6709:"🈶",u6e80:"🈵",u7121:"🈚️",u7533:"🈸",u7981:"🈲",u7a7a:"🈳",umbrella:"☔️",unamused:"😒",underage:"🔞",unicorn:"🦄",unlock:"🔓",up:"🆙",upside_down_face:"🙃",v:"✌️",vertical_traffic_light:"🚦",vhs:"📼",vibration_mode:"📳",video_camera:"📹",video_game:"🎮",violin:"🎻",virgo:"♍️",volcano:"🌋",volleyball:"🏐",vs:"🆚",vulcan_salute:"🖖",walking_man:"🚶",walking_woman:"🚶‍♀️",waning_crescent_moon:"🌘",waning_gibbous_moon:"🌖",warning:"⚠️",wastebasket:"🗑",watch:"⌚️",water_buffalo:"🐃",watermelon:"🍉",wave:"👋",wavy_dash:"〰️",waxing_crescent_moon:"🌒",wc:"🚾",weary:"😩",wedding:"💒",weight_lifting_man:"🏋️",weight_lifting_woman:"🏋️‍♀️",whale:"🐳",whale2:"🐋",wheel_of_dharma:"☸️",wheelchair:"♿️",white_check_mark:"✅",white_circle:"⚪️",white_flag:"🏳️",white_flower:"💮",white_large_square:"⬜️",white_medium_small_square:"◽️",white_medium_square:"◻️",white_small_square:"▫️",white_square_button:"🔳",wilted_flower:"🥀",wind_chime:"🎐",wind_face:"🌬",wine_glass:"🍷",wink:"😉",wolf:"🐺",woman:"👩",woman_artist:"👩‍🎨",woman_astronaut:"👩‍🚀",woman_cartwheeling:"🤸‍♀️",woman_cook:"👩‍🍳",woman_facepalming:"🤦‍♀️",woman_factory_worker:"👩‍🏭",woman_farmer:"👩‍🌾",woman_firefighter:"👩‍🚒",woman_health_worker:"👩‍⚕️",woman_judge:"👩‍⚖️",woman_juggling:"🤹‍♀️",woman_mechanic:"👩‍🔧",woman_office_worker:"👩‍💼",woman_pilot:"👩‍✈️",woman_playing_handball:"🤾‍♀️",woman_playing_water_polo:"🤽‍♀️",woman_scientist:"👩‍🔬",woman_shrugging:"🤷‍♀️",woman_singer:"👩‍🎤",woman_student:"👩‍🎓",woman_teacher:"👩‍🏫",woman_technologist:"👩‍💻",woman_with_turban:"👳‍♀️",womans_clothes:"👚",womans_hat:"👒",women_wrestling:"🤼‍♀️",womens:"🚺",world_map:"🗺",worried:"😟",wrench:"🔧",writing_hand:"✍️",x:"❌",yellow_heart:"💛",yen:"💴",yin_yang:"☯️",yum:"😋",zap:"⚡️",zipper_mouth_face:"🤐",zzz:"💤",octocat:':octocat:',showdown:`S`},r.Converter=function(h){var E={},S=[],I=[],D={},L=o,k={parsed:{},raw:"",format:""};$();function $(){h=h||{};for(var M in s)s.hasOwnProperty(M)&&(E[M]=s[M]);if(typeof h=="object")for(var Q in h)h.hasOwnProperty(Q)&&(E[Q]=h[Q]);else throw Error("Converter expects the passed parameter to be an object, but "+typeof h+" was passed instead.");E.extensions&&r.helper.forEach(E.extensions,ee)}function ee(M,Q){if(Q=Q||null,r.helper.isString(M))if(M=r.helper.stdExtName(M),Q=M,r.extensions[M]){console.warn("DEPRECATION WARNING: "+M+" is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"),ne(r.extensions[M],M);return}else if(!r.helper.isUndefined(a[M]))M=a[M];else throw Error('Extension "'+M+'" could not be loaded. It was either not found or is not a valid extension.');typeof M=="function"&&(M=M()),r.helper.isArray(M)||(M=[M]);var j=c(M,Q);if(!j.valid)throw Error(j.error);for(var X=0;X>",!1),zt=at("<<",!1),bt=at("<",!1),Fe=at(">",!1),Or=at("_",!1),Zn=at("?",!1),dt=at("r",!1),wr=at("#",!1),hr=at("b",!1),hi=_n([["a","z"],["A","Z"],["0","9"],"-","*","+"],!1,!1),wn=_n([["A","G"]],!1,!1),Yt=_n(["b","s"],!1,!1),mn=at("iii",!1),qi=at("ii",!1),fi=at("iv",!1),Vi=at("i",!1),en=at("vii",!1),Kn=at("vi",!1),gn=at("v",!1),Qt=function(y){return y.filter(P=>P)},mi=function(){return parseFloat(Fr())},gi=function(){return parseInt(Fr())},q=function(){},ie=function(){return XM[Fr()]},ce=function(y){return y.filter(P=>P)},ge=function(y,P){return P?me(FO,{item:y,times:P}):me(YO,{items:y})},Ce=function(y){return y},Ge=function(y,P,B){return me(cP,{left:y,operation:P,right:B})},Me=function(y,P){return me(lP,{items:y,times:P})},Tt=function(y){return me(zA,{items:y})},Er=function(){return parseInt(Fr())},Br=function(y){return y.map(P=>typeof P=="number"?P:void 0)},ba=function(){return Math.ceil(VA(Fr()))},Hi=function(y){var P=y.filter(B=>B).map(B=>me(si,{pitch:B[0]},B.toString()));return me(YO,{items:P})},_s=function(y){return y},Ur=function(){},Ss=function(y){return me(Ig,{items:y})},Ta=function(y){return me(sP,{octave:y})},va=function(){return Fr().split("").reduce((y,P)=>y+(P==="^"?1:-1),0)},Os=function(){return me(UO,{seededRandom:a.seededRandom})},Ca=function(y,P){return me(UO,{min:y,max:P,seededRandom:a.seededRandom})},Es=function(y,P){return me(FO,{item:y,times:P})},ya=function(y){return me(oP,{duration:y})},Dr=function(y){return me(gm,{duration:y})},bs=function(y,P,B,K){const pe=y?a.nodeOptions.octave+y:a.nodeOptions.octave;return me(si,{duration:P,pitch:K,octave:pe,add:B})},Ts=function(y){return y.reduce((P,B)=>P+(B==="#"?1:-1),0)},Aa=function(y,P){return me(Ao,{pitches:[y].concat(P)})},Ra=function(){return Fr()},vs=function(){return Fr()},Ia=function(y,P,B,K){const pe=a.nodeOptions.scaleName?a.nodeOptions.scaleName:"MAJOR",Se=SP(K,B,pe,y,P);return me(Ao,{duration:P,pitches:Se,chordName:K})},Cs=function(y,P,B,K){const pe=y?a.nodeOptions.octave+y:a.nodeOptions.octave,Se=P||a.nodeOptions.duration;return me(aP,{duration:Se,roman:B,octave:pe,chordName:K})},Na=function(y,P,B){const K=y?a.nodeOptions.octave+y:a.nodeOptions.octave,pe=a.nodeOptions.key?a.nodeOptions.key:"C",Se=a.nodeOptions.scaleName?a.nodeOptions.scaleName:"MAJOR",$e=yP(B,pe,Se);return me(si,{duration:P,pitch:$e.pc,octave:$e.octave+K,add:$e.add,key:pe,scale:Se})},w=0,it=0,br=[{line:1,column:1}],nt=0,zi=[],Te=0,Ie={},tn;if("startRule"in a){if(!(a.startRule in l))throw new Error(`Can't start parsing from rule "`+a.startRule+'".');c=l[a.startRule]}function Fr(){return i.substring(it,w)}function _i(){return Dn(it,w)}function at(y,P){return{type:"literal",text:y,ignoreCase:P}}function _n(y,P,B){return{type:"class",parts:y,inverted:P,ignoreCase:B}}function ys(){return{type:"end"}}function Si(y){return{type:"other",description:y}}function Wi(y){var P=br[y],B;if(P)return P;for(B=y-1;!br[B];)B--;for(P=br[B],P={line:P.line,column:P.column};Bnt&&(nt=w,zi=[]),zi.push(y))}function wa(y,P,B){return new e(e.buildMessage(y,P),y,P,B)}function Oi(){var y,P,B=w*39+0,K=Ie[B];return K?(w=K.nextPos,K.result):(y=w,P=bi(),P!==s&&(it=y,P=Qt(P)),y=P,Ie[B]={nextPos:w,result:y},y)}function jn(){var y,P,B,K,pe,Se,$e,Ke=w*39+1,lt=Ie[Ke];if(lt)return w=lt.nextPos,lt.result;for(y=w,P=w,i.charCodeAt(w)===45?(B=d,w++):(B=s,Te===0&&ye(vt)),B===s&&(B=null),K=[],we.test(i.charAt(w))?(pe=i.charAt(w),w++):(pe=s,Te===0&&ye(rt));pe!==s;)K.push(pe),we.test(i.charAt(w))?(pe=i.charAt(w),w++):(pe=s,Te===0&&ye(rt));if(i.charCodeAt(w)===46?(pe=p,w++):(pe=s,Te===0&&ye(yt)),pe!==s){if(Se=[],we.test(i.charAt(w))?($e=i.charAt(w),w++):($e=s,Te===0&&ye(rt)),$e!==s)for(;$e!==s;)Se.push($e),we.test(i.charAt(w))?($e=i.charAt(w),w++):($e=s,Te===0&&ye(rt));else Se=s;Se!==s?(B=[B,K,pe,Se],P=B):(w=P,P=s)}else w=P,P=s;if(P===s)if(P=w,i.charCodeAt(w)===46?(B=p,w++):(B=s,Te===0&&ye(yt)),B!==s){if(K=[],we.test(i.charAt(w))?(pe=i.charAt(w),w++):(pe=s,Te===0&&ye(rt)),pe!==s)for(;pe!==s;)K.push(pe),we.test(i.charAt(w))?(pe=i.charAt(w),w++):(pe=s,Te===0&&ye(rt));else K=s;K!==s?(B=[B,K],P=B):(w=P,P=s)}else w=P,P=s;return P!==s&&(it=y,P=mi()),y=P,Ie[Ke]={nextPos:w,result:y},y}function qt(){var y,P,B=w*39+2,K=Ie[B];return K?(w=K.nextPos,K.result):(y=w,i.charCodeAt(w)===45?w++:Te===0&&ye(vt),we.test(i.charAt(w))?(P=i.charAt(w),w++):(P=s,Te===0&&ye(rt)),P!==s?(it=y,y=gi()):(w=y,y=s),Ie[B]={nextPos:w,result:y},y)}function Ei(){var y,P,B=w*39+3,K=Ie[B];return K?(w=K.nextPos,K.result):(Te++,y=w,Xe.test(i.charAt(w))?(P=i.charAt(w),w++):(P=s,Te===0&&ye(Pr)),P!==s&&(it=y,P=q()),y=P,Te--,y===s&&(P=s,Te===0&&ye(Pt)),Ie[B]={nextPos:w,result:y},y)}function Yr(){var y,P,B=w*39+7,K=Ie[B];return K?(w=K.nextPos,K.result):(y=w,Ve.test(i.charAt(w))?(P=i.charAt(w),w++):(P=s,Te===0&&ye(ut)),P!==s&&(it=y,P=ie()),y=P,Ie[B]={nextPos:w,result:y},y)}function rn(){var y,P=w*39+8,B=Ie[P];return B?(w=B.nextPos,B.result):(y=Yr(),y===s&&(y=jn()),Ie[P]={nextPos:w,result:y},y)}function bi(){var y,P,B,K=w*39+9,pe=Ie[K];if(pe)return w=pe.nextPos,pe.result;if(y=w,P=[],B=T(),B===s&&(B=Ho(),B===s&&(B=As(),B===s&&(B=Ti(),B===s&&(B=zo(),B===s&&(B=ka(),B===s&&(B=Xo())))))),B!==s)for(;B!==s;)P.push(B),B=T(),B===s&&(B=Ho(),B===s&&(B=As(),B===s&&(B=Ti(),B===s&&(B=zo(),B===s&&(B=ka(),B===s&&(B=Xo()))))));else P=s;return P!==s&&(it=y,P=ce(P)),y=P,Ie[K]={nextPos:w,result:y},y}function Ti(){var y,P,B,K,pe,Se=w*39+10,$e=Ie[Se];return $e?(w=$e.nextPos,$e.result):(y=w,i.charCodeAt(w)===40?(P=b,w++):(P=s,Te===0&&ye(He)),P!==s?(i.charCodeAt(w)===58?w++:Te===0&&ye(dr),B=bi(),B!==s?(K=Vo(),K===s&&(K=null),i.charCodeAt(w)===41?(pe=R,w++):(pe=s,Te===0&&ye(Gt)),pe!==s?(it=y,y=ge(B,K)):(w=y,y=s)):(w=y,y=s)):(w=y,y=s),Ie[Se]={nextPos:w,result:y},y)}function Vo(){var y,P,B,K=w*39+11,pe=Ie[K];return pe?(w=pe.nextPos,pe.result):(y=w,i.charCodeAt(w)===58?(P=A,w++):(P=s,Te===0&&ye(dr)),P!==s?(B=Da(),B!==s?(it=y,y=Ce(B)):(w=y,y=s)):(w=y,y=s),Ie[K]={nextPos:w,result:y},y)}function Ho(){var y,P,B,K,pe=w*39+12,Se=Ie[pe];return Se?(w=Se.nextPos,Se.result):(y=w,P=Ti(),P!==s?(B=Is(),B!==s?(K=Ti(),K!==s?(it=y,y=Ge(P,B,K)):(w=y,y=s)):(w=y,y=s)):(w=y,y=s),Ie[pe]={nextPos:w,result:y},y)}function zo(){var y,P,B,K,pe,Se=w*39+13,$e=Ie[Se];return $e?(w=$e.nextPos,$e.result):(y=w,i.substr(w,2)===x?(P=x,w+=2):(P=s,Te===0&&ye(pr)),P!==s?(B=bi(),B!==s?(K=Vo(),K===s&&(K=null),i.charCodeAt(w)===93?(pe=Y,w++):(pe=s,Te===0&&ye(W)),pe!==s?(it=y,y=Me(B,K)):(w=y,y=s)):(w=y,y=s)):(w=y,y=s),Ie[Se]={nextPos:w,result:y},y)}function As(){var y,P,B,K,pe=w*39+14,Se=Ie[pe];return Se?(w=Se.nextPos,Se.result):(y=w,i.charCodeAt(w)===91?(P=Z,w++):(P=s,Te===0&&ye(_e)),P!==s?(B=bi(),B!==s?(i.charCodeAt(w)===93?(K=Y,w++):(K=s,Te===0&&ye(W)),K!==s?(it=y,y=Tt(B)):(w=y,y=s)):(w=y,y=s)):(w=y,y=s),Ie[pe]={nextPos:w,result:y},y)}function Da(){var y,P,B,K=w*39+15,pe=Ie[K];if(pe)return w=pe.nextPos,pe.result;if(y=w,i.charCodeAt(w)===45?w++:Te===0&&ye(vt),P=[],we.test(i.charAt(w))?(B=i.charAt(w),w++):(B=s,Te===0&&ye(rt)),B!==s)for(;B!==s;)P.push(B),we.test(i.charAt(w))?(B=i.charAt(w),w++):(B=s,Te===0&&ye(rt));else P=s;return P!==s?(it=y,y=Er()):(w=y,y=s),Ie[K]={nextPos:w,result:y},y}function xa(){var y,P=w*39+16,B=Ie[P];return B?(w=B.nextPos,B.result):(y=Da(),y===s&&(y=qt()),Ie[P]={nextPos:w,result:y},y)}function Xi(){var y,P,B,K=w*39+17,pe=Ie[K];if(pe)return w=pe.nextPos,pe.result;if(y=w,P=[],B=Rs(),B===s&&(B=xa()),B!==s)for(;B!==s;)P.push(B),B=Rs(),B===s&&(B=xa());else P=s;return P!==s&&(it=y,P=Br(P)),y=P,Ie[K]={nextPos:w,result:y},y}function Rs(){var y,P,B,K,pe=w*39+18,Se=Ie[pe];return Se?(w=Se.nextPos,Se.result):(y=w,i.charCodeAt(w)===40?w++:Te===0&&ye(He),P=xa(),P!==s?(B=Is(),B!==s?(K=Xi(),K!==s?(i.charCodeAt(w)===41?w++:Te===0&&ye(Gt),it=y,y=ba()):(w=y,y=s)):(w=y,y=s)):(w=y,y=s),Ie[pe]={nextPos:w,result:y},y)}function Wo(){var y,P,B,K,pe=w*39+19,Se=Ie[pe];if(Se)return w=Se.nextPos,Se.result;if(y=w,i.charCodeAt(w)===123?(P=h,w++):(P=s,Te===0&&ye(xe)),P!==s){if(B=[],K=Xi(),K===s&&(K=Ei()),K!==s)for(;K!==s;)B.push(K),K=Xi(),K===s&&(K=Ei());else B=s;B!==s?(i.charCodeAt(w)===125?(K=E,w++):(K=s,Te===0&&ye(De)),K!==s?(it=y,y=Hi(B)):(w=y,y=s)):(w=y,y=s)}else w=y,y=s;return Ie[pe]={nextPos:w,result:y},y}function Is(){var y,P=w*39+20,B=Ie[P];return B?(w=B.nextPos,B.result):(i.charCodeAt(w)===43?(y=S,w++):(y=s,Te===0&&ye(Je)),y===s&&(i.charCodeAt(w)===45?(y=d,w++):(y=s,Te===0&&ye(vt)),y===s&&(i.charCodeAt(w)===42?(y=I,w++):(y=s,Te===0&&ye(Re)),y===s&&(i.charCodeAt(w)===47?(y=D,w++):(y=s,Te===0&&ye(Ft)),y===s&&(i.charCodeAt(w)===37?(y=L,w++):(y=s,Te===0&&ye(pt)),y===s&&(i.charCodeAt(w)===94?(y=k,w++):(y=s,Te===0&&ye(mt)),y===s&&(i.charCodeAt(w)===124?(y=_,w++):(y=s,Te===0&&ye(Sr)),y===s&&(i.charCodeAt(w)===38?(y=$,w++):(y=s,Te===0&&ye(Jr)),y===s&&(i.substr(w,2)===ee?(y=ee,w+=2):(y=s,Te===0&&ye(ht)),y===s&&(i.substr(w,2)===ne?(y=ne,w+=2):(y=s,Te===0&&ye(zt))))))))))),Ie[P]={nextPos:w,result:y},y)}function ka(){var y,P,B=w*39+21,K=Ie[B];return K?(w=K.nextPos,K.result):(y=w,P=N(),P===s&&(P=he(),P===s&&(P=ae(),P===s&&(P=oe(),P===s&&(P=z(),P===s&&(P=F(),P===s&&(P=u(),P===s&&(P=Ei(),P===s&&(P=v(),P===s&&(P=g(),P===s&&(P=O(),P===s&&(P=Ti(),P===s&&(P=Wo(),P===s&&(P=Ns()))))))))))))),P!==s&&(it=y,P=_s(P)),y=P,Ie[B]={nextPos:w,result:y},y)}function Ns(){var y,P,B=w*39+22,K=Ie[B];return K?(w=K.nextPos,K.result):(y=w,i.charCodeAt(w)===124?(P=_,w++):(P=s,Te===0&&ye(Sr)),P!==s&&(it=y,P=Ur()),y=P,Ie[B]={nextPos:w,result:y},y)}function Xo(){var y,P,B,K,pe=w*39+23,Se=Ie[pe];return Se?(w=Se.nextPos,Se.result):(y=w,i.charCodeAt(w)===60?(P=re,w++):(P=s,Te===0&&ye(bt)),P!==s?(B=bi(),B!==s?(i.charCodeAt(w)===62?(K=te,w++):(K=s,Te===0&&ye(Fe)),K!==s?(it=y,y=Ss(B)):(w=y,y=s)):(w=y,y=s)):(w=y,y=s),Ie[pe]={nextPos:w,result:y},y)}function u(){var y,P,B=w*39+24,K=Ie[B];return K?(w=K.nextPos,K.result):(y=w,P=f(),P!==s&&(it=y,P=Ta(P)),y=P,Ie[B]={nextPos:w,result:y},y)}function f(){var y,P,B,K=w*39+25,pe=Ie[K];if(pe)return w=pe.nextPos,pe.result;if(y=w,P=[],i.charCodeAt(w)===94?(B=k,w++):(B=s,Te===0&&ye(mt)),B===s&&(i.charCodeAt(w)===95?(B=M,w++):(B=s,Te===0&&ye(Or))),B!==s)for(;B!==s;)P.push(B),i.charCodeAt(w)===94?(B=k,w++):(B=s,Te===0&&ye(mt)),B===s&&(i.charCodeAt(w)===95?(B=M,w++):(B=s,Te===0&&ye(Or)));else P=s;return P!==s&&(it=y,P=va()),y=P,Ie[K]={nextPos:w,result:y},y}function g(){var y,P,B=w*39+26,K=Ie[B];return K?(w=K.nextPos,K.result):(y=w,i.charCodeAt(w)===63?(P=Q,w++):(P=s,Te===0&&ye(Zn)),P!==s&&(it=y,P=Os()),y=P,Ie[B]={nextPos:w,result:y},y)}function O(){var y,P,B,K,pe,Se,$e=w*39+27,Ke=Ie[$e];return Ke?(w=Ke.nextPos,Ke.result):(y=w,i.charCodeAt(w)===40?(P=b,w++):(P=s,Te===0&&ye(He)),P!==s?(B=qt(),B!==s?(i.charCodeAt(w)===44?(K=m,w++):(K=s,Te===0&&ye(qe)),K!==s?(pe=qt(),pe!==s?(i.charCodeAt(w)===41?(Se=R,w++):(Se=s,Te===0&&ye(Gt)),Se!==s?(it=y,y=Ca(B,pe)):(w=y,y=s)):(w=y,y=s)):(w=y,y=s)):(w=y,y=s)):(w=y,y=s),Ie[$e]={nextPos:w,result:y},y)}function T(){var y,P,B,K,pe,Se,$e=w*39+28,Ke=Ie[$e];return Ke?(w=Ke.nextPos,Ke.result):(y=w,P=ka(),P!==s?(i.charCodeAt(w)===58?(B=A,w++):(B=s,Te===0&&ye(dr)),B!==s?(K=Da(),K!==s?(pe=w,Te++,i.charCodeAt(w)===41?(Se=R,w++):(Se=s,Te===0&&ye(Gt)),Se===s&&(i.charCodeAt(w)===93?(Se=Y,w++):(Se=s,Te===0&&ye(W))),Te--,Se===s?pe=void 0:(w=pe,pe=s),pe!==s?(it=y,y=Es(P,K)):(w=y,y=s)):(w=y,y=s)):(w=y,y=s)):(w=y,y=s),Ie[$e]={nextPos:w,result:y},y)}function v(){var y,P,B=w*39+29,K=Ie[B];return K?(w=K.nextPos,K.result):(y=w,P=rn(),P!==s&&(it=y,P=ya(P)),y=P,Ie[B]={nextPos:w,result:y},y)}function N(){var y,P,B,K=w*39+30,pe=Ie[K];return pe?(w=pe.nextPos,pe.result):(y=w,P=rn(),P===s&&(P=null),i.charCodeAt(w)===114?(B=j,w++):(B=s,Te===0&&ye(dt)),B!==s?(it=y,y=Dr(P)):(w=y,y=s),Ie[K]={nextPos:w,result:y},y)}function F(){var y,P,B,K,pe,Se=w*39+31,$e=Ie[Se];return $e?(w=$e.nextPos,$e.result):(y=w,P=f(),P===s&&(P=null),B=rn(),B===s&&(B=null),K=U(),K===s&&(K=null),pe=qt(),pe!==s?(it=y,y=bs(P,B,K,pe)):(w=y,y=s),Ie[Se]={nextPos:w,result:y},y)}function U(){var y,P,B,K=w*39+32,pe=Ie[K];if(pe)return w=pe.nextPos,pe.result;if(y=w,P=[],i.charCodeAt(w)===35?(B=X,w++):(B=s,Te===0&&ye(wr)),B===s&&(i.charCodeAt(w)===98?(B=le,w++):(B=s,Te===0&&ye(hr))),B!==s)for(;B!==s;)P.push(B),i.charCodeAt(w)===35?(B=X,w++):(B=s,Te===0&&ye(wr)),B===s&&(i.charCodeAt(w)===98?(B=le,w++):(B=s,Te===0&&ye(hr)));else P=s;return P!==s&&(it=y,P=Ts(P)),y=P,Ie[K]={nextPos:w,result:y},y}function z(){var y,P,B,K,pe=w*39+33,Se=Ie[pe];if(Se)return w=Se.nextPos,Se.result;if(y=w,P=F(),P!==s){if(B=[],K=F(),K!==s)for(;K!==s;)B.push(K),K=F();else B=s;B!==s?(it=y,y=Aa(P,B)):(w=y,y=s)}else w=y,y=s;return Ie[pe]={nextPos:w,result:y},y}function H(){var y,P,B,K=w*39+34,pe=Ie[K];if(pe)return w=pe.nextPos,pe.result;if(y=w,P=[],je.test(i.charAt(w))?(B=i.charAt(w),w++):(B=s,Te===0&&ye(hi)),B!==s)for(;B!==s;)P.push(B),je.test(i.charAt(w))?(B=i.charAt(w),w++):(B=s,Te===0&&ye(hi));else P=s;return P!==s&&(it=y,P=Ra()),y=P,Ie[K]={nextPos:w,result:y},y}function de(){var y,P,B=w*39+35,K=Ie[B];return K?(w=K.nextPos,K.result):(y=w,ot.test(i.charAt(w))?(P=i.charAt(w),w++):(P=s,Te===0&&ye(wn)),P!==s?(St.test(i.charAt(w))?(i.charAt(w),w++):Te===0&&ye(Yt),it=y,y=vs()):(w=y,y=s),Ie[B]={nextPos:w,result:y},y)}function he(){var y,P,B,K,pe,Se=w*39+36,$e=Ie[Se];return $e?(w=$e.nextPos,$e.result):(y=w,P=f(),P===s&&(P=null),B=rn(),B===s&&(B=null),K=de(),K!==s?(i.charCodeAt(w)===94?w++:Te===0&&ye(mt),pe=H(),pe!==s?(it=y,y=Ia(P,B,K,pe)):(w=y,y=s)):(w=y,y=s),Ie[Se]={nextPos:w,result:y},y)}function oe(){var y,P,B,K,pe,Se=w*39+37,$e=Ie[Se];return $e?(w=$e.nextPos,$e.result):(y=w,P=f(),P===s&&(P=null),B=rn(),B===s&&(B=null),i.substr(w,3)===se?(K=se,w+=3):(K=s,Te===0&&ye(mn)),K===s&&(i.substr(w,2)===Oe?(K=Oe,w+=2):(K=s,Te===0&&ye(qi)),K===s&&(i.substr(w,2)===ke?(K=ke,w+=2):(K=s,Te===0&&ye(fi)),K===s&&(i.charCodeAt(w)===105?(K=Le,w++):(K=s,Te===0&&ye(Vi)),K===s&&(i.substr(w,3)===Ee?(K=Ee,w+=3):(K=s,Te===0&&ye(en)),K===s&&(i.substr(w,2)===Ne?(K=Ne,w+=2):(K=s,Te===0&&ye(Kn)),K===s&&(i.charCodeAt(w)===118?(K=ue,w++):(K=s,Te===0&&ye(gn)))))))),K!==s?(i.charCodeAt(w)===94?w++:Te===0&&ye(mt),pe=H(),pe===s&&(pe=null),it=y,y=Cs(P,B,K,pe)):(w=y,y=s),Ie[Se]={nextPos:w,result:y},y)}function ae(){var y,P,B,K,pe=w*39+38,Se=Ie[pe];return Se?(w=Se.nextPos,Se.result):(y=w,P=f(),P===s&&(P=null),B=rn(),B===s&&(B=null),K=de(),K!==s?(it=y,y=Na(P,B,K)):(w=y,y=s),Ie[pe]={nextPos:w,result:y},y)}var ve=a.nodeOptions||{};function me(y,P,B=void 0){P.text=B||Fr(),P.location=_i();for(var K in ve)(P[K]===void 0||P[K]===null)&&(P[K]=ve[K]);return new y(P)}if(tn=c(),tn!==s&&w===i.length)return tn;throw tn!==s&&we.collect("pitch"))}notes(){return this.evaluated.map(e=>e.collect("note"))}freqs(){return this.evaluated.map(e=>e.collect("freq"))}durations(){return this.evaluated.map(e=>e.collect("duration"))}retrograde(){return this.evaluated=this.evaluated.reverse(),this}scale(e){return this.applyOptions({scale:e}),this}key(e){return this.applyOptions({key:e}),this}octave(e){return this.applyOptions({octave:e}),this}isInOptions(e,t){return this.options.nodeOptions&&this.options.nodeOptions[e]===t}atLast(){return this.index+1>=this.evaluated.length*this.redo}clone(){return yo(this)}notStarted(){return this.index<0}peek(){return this.evaluated[this.index-1||0]}hasStarted(){return this.index>=0}next(){this.index<0&&(this.index=0);const e=this.evaluated[this.index%this.evaluated.length];return this.index++,this.counter++,this.redo>0&&this.index>=this.evaluated.length*this.redo&&(this.index=0,this.evaluated=this.evaluate(this.values)),e}applyOptions(e={}){this.evaluated=this.evaluate(this.evaluated,e),this.applyTransformations()}applyTransformations(){var e;(e=this.globalOptions)!=null&&e.retrograde&&(this.evaluated=this.evaluated.reverse())}update(){return this.evaluated=this.evaluate(this.values),this.applyTransformations(),this}evaluate(e,t={}){let r=e.map(i=>i.evaluate(t)).flat(1/0).filter(i=>i!==void 0);if(t.subdivisions){const i=t.duration?t.duration:qA;r=tR(r,i)}return r}totalDuration(){return this.evaluated.reduce((t,r)=>t+r.collect("duration"),0)}}const tR=(n,e)=>{const t=n.length,r=e/t;return n.map(a=>a instanceof zA?tR(a.items,r):(a.duration=r,a)).flat(1/0)},IP=n=>{let e={};return iP.forEach(t=>{if(n[t]!==void 0){const r=n[t];e[t]=r,delete n[t]}}),e};class NP{constructor(){C(this,"midiAccess",null);C(this,"midiOutputs",[]);C(this,"currentOutputIndex",0);C(this,"scheduledNotes",{});this.initializeMidiAccess()}async initializeMidiAccess(){try{this.midiAccess=await navigator.requestMIDIAccess(),this.midiOutputs=Array.from(this.midiAccess.outputs.values()),this.midiOutputs.length===0&&(console.warn("No MIDI outputs available."),this.currentOutputIndex=-1)}catch(e){console.error("Failed to initialize MIDI:",e)}}getCurrentMidiPort(){return this.midiOutputs.length>0&&this.currentOutputIndex>=0&&this.currentOutputIndex0&&this.currentOutputIndex>=0&&this.currentOutputIndex=this.midiOutputs.length?(console.error(`Invalid MIDI output index. Index must be in the range 0-${this.midiOutputs.length-1}.`),this.currentOutputIndex):e;{const t=this.midiOutputs.findIndex(r=>r.name===e);return t!==-1?t:(console.error(`MIDI output "${e}" not found.`),this.currentOutputIndex)}}listMidiOutputs(){let e="Available MIDI Outputs: ";return this.midiOutputs.forEach((t,r)=>{e+=`(${r+1}) ${t.name} `}),e}sendMidiNote(e,t,r,i,a=this.currentOutputIndex,s=void 0){typeof a=="string"&&(a=this.getMidiOutputIndex(a));const o=this.midiOutputs[a];if(e=Math.min(Math.max(e,0),127),o){const l=[144+t,e,r],c=[128+t,e,0];o.send(l),s&&this.sendPitchBend(s,t,a);const d=setTimeout(()=>{o.send(c),s&&this.sendPitchBend(8192,t,a),delete this.scheduledNotes[e]},(i-.02)*1e3);this.scheduledNotes[e]=d}else console.error("MIDI output not available.")}sendSysExMessage(e){const t=this.midiOutputs[this.currentOutputIndex];t?t.send(e):console.error("MIDI output not available.")}sendPitchBend(e,t,r=this.currentOutputIndex){(e<0||e>16383)&&console.error("Invalid pitch bend value. Value must be in the range 0-16383."),(t<0||t>15)&&console.error("Invalid MIDI channel. Channel must be in the range 0-15."),typeof r=="string"&&(r=this.getMidiOutputIndex(r));const i=this.midiOutputs[r];if(i){const a=e&127,s=e>>7&127;i.send([224|t,a,s])}else console.error("MIDI output not available.")}sendProgramChange(e,t){const r=this.midiOutputs[this.currentOutputIndex];r?r.send([192+t,e]):console.error("MIDI output not available.")}sendMidiControlChange(e,t,r){const i=this.midiOutputs[this.currentOutputIndex];i?i.send([176+r,e,t]):console.error("MIDI output not available.")}panic(){const e=this.midiOutputs[this.currentOutputIndex];if(e){for(const t in this.scheduledNotes){const r=this.scheduledNotes[t];clearTimeout(r),e.send([128,parseInt(t),0])}this.scheduledNotes={}}else console.error("MIDI output not available.")}}class wP{constructor(e,t,r){C(this,"min");C(this,"max");C(this,"wrap");C(this,"position");this.min=e,this.max=t,this.wrap=r,this.position=0}step(){const e=Math.floor(Math.random()*3)-1;this.position+=e,this.wrap?this.position>this.max?this.position=this.min:this.positionthis.max&&(this.position=this.max)}getPosition(){return this.position}toggleWrap(e){this.wrap=e}}const DP={major:[0,2,4,5,7,9,11],naturalMinor:[0,2,3,5,7,8,10],harmonicMinor:[0,2,3,5,7,8,11],melodicMinor:[0,2,3,5,7,9,11],dorian:[0,2,3,5,7,9,10],phrygian:[0,1,3,5,7,8,10],lydian:[0,2,4,6,7,9,11],mixolydian:[0,2,4,5,7,9,10],aeolian:[0,2,3,5,7,8,10],locrian:[0,1,3,5,6,8,10],wholeTone:[0,2,4,6,8,10],majorPentatonic:[0,2,4,7,9],minorPentatonic:[0,3,5,7,10],chromatic:[0,1,2,3,4,5,6,7,8,9,10,11],blues:[0,3,5,6,7,10],diminished:[0,2,3,5,6,8,9,11],neapolitanMinor:[0,1,3,5,7,8,11],neapolitanMajor:[0,1,3,5,7,9,11],enigmatic:[0,1,4,6,8,10,11],doubleHarmonic:[0,1,4,5,7,8,11],octatonic:[0,2,3,5,6,8,9,11],bebopDominant:[0,2,4,5,7,9,10,11],bebopMajor:[0,2,4,5,7,8,9,11],bebopMinor:[0,2,3,5,7,8,9,11],bebopDorian:[0,2,3,4,5,7,9,10],harmonicMajor:[0,2,4,5,7,8,11],hungarianMinor:[0,2,3,6,7,8,11],hungarianMajor:[0,3,4,6,7,9,10],oriental:[0,1,4,5,6,9,10],romanianMinor:[0,2,3,6,7,9,10],spanishGypsy:[0,1,4,5,7,8,10],jewish:[0,1,4,5,7,8,10],hindu:[0,2,4,5,7,8,10],japanese:[0,1,5,7,8],hirajoshi:[0,2,3,7,8],kumoi:[0,2,3,7,9],inSen:[0,1,5,7,10],iwato:[0,1,5,6,10],yo:[0,2,5,7,9],minorBlues:[0,3,5,6,7,10],algerian:[0,2,3,5,6,7,8,11],augmented:[0,3,4,7,8,11],balinese:[0,1,3,7,8],byzantine:[0,1,4,5,7,8,11],chinese:[0,4,6,7,11],egyptian:[0,2,5,7,10],eightToneSpanish:[0,1,3,4,5,6,8,10],hawaiian:[0,2,3,5,7,9,10],hindustan:[0,2,4,5,7,8,10],persian:[0,1,4,5,6,8,11],eastIndianPurvi:[0,1,4,6,7,8,11],orientalA:[0,1,4,5,6,9,10]};function xP(n,e="major",t=4){const r=DP[e];if(!r)throw new Error(`Unknown scale ${e}`);let i=n%r.length;i<0&&(i+=r.length);let a=Math.floor(n/r.length);return 60+(t+a)*12+r[i]}class xg{constructor(e){C(this,"seedValue");C(this,"randomGen",Math.random);C(this,"app");C(this,"values",{});C(this,"odds",(e,t)=>this.randomGen()this);C(this,"almostNever",e=>this.odds(.025,e));C(this,"rarely",e=>this.odds(.1,e));C(this,"scarcely",e=>this.odds(.25,e));C(this,"sometimes",e=>this.odds(.5,e));C(this,"often",e=>this.odds(.75,e));C(this,"frequently",e=>this.odds(.9,e));C(this,"almostAlways",e=>this.odds(.985,e));C(this,"always",e=>this.modify(e));C(this,"modify",e=>e(this));C(this,"seed",e=>(this.seedValue=e.toString(),this.randomGen=this.app.api.localSeededRandom(this.seedValue),this));C(this,"clear",()=>(this.app.api.clearLocalSeed(this.seedValue),this));C(this,"apply",e=>this.modify(e));C(this,"length",e=>(this.values.length=e,this));this.app=e,this.app.api.currentSeed&&(this.randomGen=this.app.api.randomGen)}}class rR extends xg{constructor(t){super(t);C(this,"octave",t=>(this.values.octave=t,this.update(),this));C(this,"key",t=>(this.values.key=t,this.update(),this));C(this,"scale",t=>(Ag(t)?(this.values.scaleName=t,this.values.parsedScale=zn(t)):this.values.parsedScale=Rg(t),this.update(),this));C(this,"freq",t=>{this.values.freq=t;const r=uP(t);return r%1!==0?(this.values.note=Math.floor(r),this.values.bend=WA(r)[1]):this.values.note=r,this});C(this,"update",()=>{})}}let Cr=[],kP=(n,e)=>{let t,r=[],i={lc:0,l:e||0,value:n,set(a){i.value=a,i.notify()},get(){return i.lc||i.listen(()=>{})(),i.value},notify(a){t=r;let s=!Cr.length;for(let o=0;o{r===t&&(r=r.slice());let o=r.indexOf(a);~o&&(r.splice(o,2),i.lc--,i.lc||i.off())}},subscribe(a,s){let o=i.listen(a,s);return a(i.value),o},off(){}};return i},LP=(n={})=>{let e=kP(n);return e.setKey=function(t,r){typeof r>"u"?t in e.value&&(e.value={...e.value},delete e.value[t],e.notify(t)):e.value[t]!==r&&(e.value={...e.value,[t]:r},e.notify(t))},e};if(typeof DelayNode<"u"){class n extends DelayNode{constructor(t,r,i,a){super(t),r=Math.abs(r),this.delayTime.value=i;const s=t.createGain();s.gain.value=Math.min(Math.abs(a),.995),this.feedback=s.gain;const o=t.createGain();return o.gain.value=r,this.delayGain=o,this.connect(s),this.connect(o),s.connect(this),this.connect=l=>o.connect(l),this}start(t){this.delayGain.gain.setValueAtTime(this.delayGain.gain.value,t+this.delayTime.value)}}AudioContext.prototype.createFeedbackDelay=function(e,t,r){return new n(this,e,t,r)}}typeof AudioContext<"u"&&(AudioContext.prototype.impulseResponse=function(n,e=1){const t=this.sampleRate*n,r=this.createBuffer(e,t,this.sampleRate),i=r.getChannelData(0);for(let a=0;a(e.buffer=this.impulseResponse(t),e.duration=n,e),e.setDuration(n),e});var GO={a:{freqs:[660,1120,2750,3e3,3350],gains:[1,.5012,.0708,.0631,.0126],qs:[80,90,120,130,140]},e:{freqs:[440,1800,2700,3e3,3300],gains:[1,.1995,.1259,.1,.1],qs:[70,80,100,120,120]},i:{freqs:[270,1850,2900,3350,3590],gains:[1,.0631,.0631,.0158,.0158],qs:[40,90,100,120,120]},o:{freqs:[430,820,2700,3e3,3300],gains:[1,.3162,.0501,.0794,.01995],qs:[40,80,100,120,120]},u:{freqs:[370,630,2750,3e3,3400],gains:[1,.1,.0708,.0316,.01995],qs:[40,60,100,120,120]}};if(typeof GainNode<"u"){class n extends GainNode{constructor(t,r){if(super(t),!GO[r])throw new Error("vowel: unknown vowel "+r);const{gains:i,qs:a,freqs:s}=GO[r],o=t.createGain();for(let l=0;l<5;l++){const c=t.createGain();c.gain.value=i[l];const d=t.createBiquadFilter();d.type="bandpass",d.Q.value=a[l],d.frequency.value=s[l],this.connect(d),d.connect(c),c.connect(o)}return o.gain.value=8,this.connect=l=>o.connect(l),this}}AudioContext.prototype.createVowelFilter=function(e){return new n(this,e)}}const MP=n=>{var i;if(typeof n!="string")return[];const[e,t="",r]=((i=n.match(/^([a-gA-G])([#bsf]*)([0-9]*)$/))==null?void 0:i.slice(1))||[];return e?[e,t,r?Number(r):void 0]:[]},PP={c:0,d:2,e:4,f:5,g:7,a:9,b:11},BP={"#":1,b:-1,s:1,f:-1},Mc=(n,e=3)=>{const[t,r,i=e]=MP(n);if(!t)throw new Error('not a note: "'+n+'"');const a=PP[t.toLowerCase()],s=(r==null?void 0:r.split("").reduce((o,l)=>o+BP[l],0))||0;return(Number(i)+1)*12+a+s},nR=n=>Math.pow(2,(n-69)/12)*440,UP=(n,e,t)=>Math.min(Math.max(n,e),t),FP=n=>12*Math.log(n/440)/Math.LN2+69,YP=(n,e)=>{if(typeof n!="object")throw new Error("valueToMidi: expected object value");let{freq:t,note:r}=n;if(typeof t=="number")return FP(t);if(typeof r=="string")return Mc(r);if(typeof r=="number")return r;if(!e)throw new Error("valueToMidi: expected freq or note to be set");return e},GP="data:application/javascript;base64,Ly8gTElDRU5TRSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSB2My4wIHNlZSBodHRwczovL2dpdGh1Yi5jb20vZGt0cjAvV2ViRGlydC9ibG9iL21haW4vTElDRU5TRQovLyBhbGwgdGhlIGNyZWRpdCBnb2VzIHRvIGRrdHIwJ3Mgd2ViZGlydDogaHR0cHM6Ly9naXRodWIuY29tL2RrdHIwL1dlYkRpcnQvYmxvYi81Y2UzZDY5ODM2MmM1NGQ2ZTFiNjhhY2M0N2ViMjk1NWFjNjJjNzkzL2Rpc3QvQXVkaW9Xb3JrbGV0cy5qcwovLyA8MwoKY2xhc3MgQ29hcnNlUHJvY2Vzc29yIGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgZ2V0IHBhcmFtZXRlckRlc2NyaXB0b3JzKCkgewogICAgcmV0dXJuIFt7IG5hbWU6ICdjb2Fyc2UnLCBkZWZhdWx0VmFsdWU6IDEgfV07CiAgfQoKICBjb25zdHJ1Y3RvcigpIHsKICAgIHN1cGVyKCk7CiAgICB0aGlzLm5vdFN0YXJ0ZWQgPSB0cnVlOwogIH0KCiAgcHJvY2VzcyhpbnB1dHMsIG91dHB1dHMsIHBhcmFtZXRlcnMpIHsKICAgIGNvbnN0IGlucHV0ID0gaW5wdXRzWzBdOwogICAgY29uc3Qgb3V0cHV0ID0gb3V0cHV0c1swXTsKICAgIGNvbnN0IGNvYXJzZSA9IHBhcmFtZXRlcnMuY29hcnNlOwogICAgY29uc3QgYmxvY2tTaXplID0gMTI4OwogICAgY29uc3QgaGFzSW5wdXQgPSAhKGlucHV0WzBdID09PSB1bmRlZmluZWQpOwogICAgaWYgKGhhc0lucHV0KSB7CiAgICAgIHRoaXMubm90U3RhcnRlZCA9IGZhbHNlOwogICAgICBvdXRwdXRbMF1bMF0gPSBpbnB1dFswXVswXTsKICAgICAgZm9yIChsZXQgbiA9IDE7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgIGZvciAobGV0IG8gPSAwOyBvIDwgb3V0cHV0Lmxlbmd0aDsgbysrKSB7CiAgICAgICAgICBvdXRwdXRbb11bbl0gPSBuICUgY29hcnNlID09IDAgPyBpbnB1dFswXVtuXSA6IG91dHB1dFtvXVtuIC0gMV07CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ2NvYXJzZS1wcm9jZXNzb3InLCBDb2Fyc2VQcm9jZXNzb3IpOwoKY2xhc3MgQ3J1c2hQcm9jZXNzb3IgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3IgewogIHN0YXRpYyBnZXQgcGFyYW1ldGVyRGVzY3JpcHRvcnMoKSB7CiAgICByZXR1cm4gW3sgbmFtZTogJ2NydXNoJywgZGVmYXVsdFZhbHVlOiAwIH1dOwogIH0KCiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5ub3RTdGFydGVkID0gdHJ1ZTsKICB9CgogIHByb2Nlc3MoaW5wdXRzLCBvdXRwdXRzLCBwYXJhbWV0ZXJzKSB7CiAgICBjb25zdCBpbnB1dCA9IGlucHV0c1swXTsKICAgIGNvbnN0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBjcnVzaCA9IHBhcmFtZXRlcnMuY3J1c2g7CiAgICBjb25zdCBibG9ja1NpemUgPSAxMjg7CiAgICBjb25zdCBoYXNJbnB1dCA9ICEoaW5wdXRbMF0gPT09IHVuZGVmaW5lZCk7CiAgICBpZiAoaGFzSW5wdXQpIHsKICAgICAgdGhpcy5ub3RTdGFydGVkID0gZmFsc2U7CiAgICAgIGlmIChjcnVzaC5sZW5ndGggPT09IDEpIHsKICAgICAgICBjb25zdCB4ID0gTWF0aC5wb3coMiwgY3J1c2hbMF0gLSAxKTsKICAgICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgICBjb25zdCB2YWx1ZSA9IE1hdGgucm91bmQoaW5wdXRbMF1bbl0gKiB4KSAvIHg7CiAgICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgICBvdXRwdXRbb11bbl0gPSB2YWx1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0gZWxzZSB7CiAgICAgICAgZm9yIChsZXQgbiA9IDA7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgICAgbGV0IHggPSBNYXRoLnBvdygyLCBjcnVzaFtuXSAtIDEpOwogICAgICAgICAgY29uc3QgdmFsdWUgPSBNYXRoLnJvdW5kKGlucHV0WzBdW25dICogeCkgLyB4OwogICAgICAgICAgZm9yIChsZXQgbyA9IDA7IG8gPCBvdXRwdXQubGVuZ3RoOyBvKyspIHsKICAgICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQpyZWdpc3RlclByb2Nlc3NvcignY3J1c2gtcHJvY2Vzc29yJywgQ3J1c2hQcm9jZXNzb3IpOwoKY2xhc3MgU2hhcGVQcm9jZXNzb3IgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3IgewogIHN0YXRpYyBnZXQgcGFyYW1ldGVyRGVzY3JpcHRvcnMoKSB7CiAgICByZXR1cm4gW3sgbmFtZTogJ3NoYXBlJywgZGVmYXVsdFZhbHVlOiAwIH1dOwogIH0KCiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5ub3RTdGFydGVkID0gdHJ1ZTsKICB9CgogIHByb2Nlc3MoaW5wdXRzLCBvdXRwdXRzLCBwYXJhbWV0ZXJzKSB7CiAgICBjb25zdCBpbnB1dCA9IGlucHV0c1swXTsKICAgIGNvbnN0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBzaGFwZTAgPSBwYXJhbWV0ZXJzLnNoYXBlWzBdOwogICAgY29uc3Qgc2hhcGUxID0gc2hhcGUwIDwgMSA/IHNoYXBlMCA6IDEuMCAtIDRlLTEwOwogICAgY29uc3Qgc2hhcGUgPSAoMi4wICogc2hhcGUxKSAvICgxLjAgLSBzaGFwZTEpOwogICAgY29uc3QgYmxvY2tTaXplID0gMTI4OwogICAgY29uc3QgaGFzSW5wdXQgPSAhKGlucHV0WzBdID09PSB1bmRlZmluZWQpOwogICAgaWYgKGhhc0lucHV0KSB7CiAgICAgIHRoaXMubm90U3RhcnRlZCA9IGZhbHNlOwogICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgY29uc3QgdmFsdWUgPSAoKDEgKyBzaGFwZSkgKiBpbnB1dFswXVtuXSkgLyAoMSArIHNoYXBlICogTWF0aC5hYnMoaW5wdXRbMF1bbl0pKTsKICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ3NoYXBlLXByb2Nlc3NvcicsIFNoYXBlUHJvY2Vzc29yKTsK";function mc(n){const e=Ht().createGain();return e.gain.value=n,e}const _m=(n,e,t,r,i,a)=>{const s=Ht().createGain();return s.gain.setValueAtTime(0,a),s.gain.linearRampToValueAtTime(i,a+n),s.gain.linearRampToValueAtTime(t*i,a+n+e),{node:s,stop:o=>{s.gain.setValueAtTime(t*i,o),s.gain.linearRampToValueAtTime(0,o+r)}}},$P=(n,e,t,r,i,a)=>{t=Math.max(.001,t),i=Math.max(.001,i);const s=Ht().createGain();return s.gain.setValueAtTime(1e-4,a),s.gain.exponentialRampToValueAtTime(i,a+n),s.gain.exponentialRampToValueAtTime(t*i,a+n+e),{node:s,stop:o=>{s.gain.exponentialRampToValueAtTime(1e-4,o+r)}}},Cu=(n,e,t)=>{const r=Ht().createBiquadFilter();return r.type=n,r.frequency.value=e,r.Q.value=t,r};let QP=n=>console.log(n);const ps=(...n)=>QP(...n),kg=LP();function Lg(n,e,t={}){kg.setKey(n,{onTrigger:e,data:t})}function $O(n){return kg.get()[n]}let yu;const Ht=()=>(yu||(yu=new AudioContext),yu);let Ol;const Mg=()=>{const n=Ht();return Ol||(Ol=n.createGain(),Ol.connect(n.destination)),Ol};let Au;function qP(){return Au||(Au=Ht().audioWorklet.addModule(GP),Au)}function Ru(n,e,t){const r=new AudioWorkletNode(n,e);return Object.entries(t).forEach(([i,a])=>{r.parameters.get(i).value=a}),r}async function VP(n={}){const{disableWorklets:e=!1}=n;typeof window<"u"&&(await Ht().resume(),e?console.log("disableWorklets: AudioWorklet effects coarse, crush and shape are skipped!"):await qP().catch(t=>{console.warn("could not load AudioWorklet effects coarse, crush and shape",t)}))}async function HP(n){return new Promise(e=>{document.addEventListener("click",async function t(){await VP(n),e(),document.removeEventListener("click",t)})})}let ji={};function zP(n,e,t,r){var i;if(t=UP(t,0,.98),!ji[n]){const a=Ht().createFeedbackDelay(1,e,t);(i=a.start)==null||i.call(a,r),a.connect(Mg()),ji[n]=a}return ji[n].delayTime.value!==e&&ji[n].delayTime.setValueAtTime(e,r),ji[n].feedback.value!==t&&ji[n].feedback.setValueAtTime(t,r),ji[n]}let Ji={};function WP(n,e=2){if(!Ji[n]){const t=Ht().createReverb(e);t.connect(Mg()),Ji[n]=t}return Ji[n].duration!==e&&(Ji[n]=Ji[n].setDuration(e),Ji[n].duration=e),Ji[n]}let ea;function XP(n=2048){if(!ea){const e=Ht().createAnalyser();e.fftSize=n,ea=e,new Float32Array(ea.frequencyBinCount)}return ea.fftSize!==n&&(ea.fftSize=n,new Float32Array(ea.frequencyBinCount)),ea}function Iu(n,e,t){const r=mc(t);return n.connect(r),r.connect(e),r}const QO=async(n,e,t)=>{const r=Ht();if(typeof n!="object")throw new Error(`expected hap.value to be an object, but got "${n}". Hint: append .note() or .s() to the end`,"error");n.duration=t;let i=r.currentTime+e,{s:a="triangle",bank:s,source:o,gain:l=.8,cutoff:c,resonance:d=1,hcutoff:p,hresonance:m=1,bandf:_,bandq:b=1,coarse:A,crush:R,shape:x,pan:Y,vowel:Z,delay:h=0,delayfeedback:E=.5,delaytime:S=.25,orbit:I=1,room:D,size:L=2,velocity:k=1,analyze:$,fft:ee=8}=n;l*=k;let ne=[];const re=()=>{ne.forEach(se=>se==null?void 0:se.disconnect())};s&&a&&(a=`${s}_${a}`);let te;if(o)te=o(i,n,t);else if($O(a)){const{onTrigger:se}=$O(a),Oe=await se(i,n,re);Oe&&(te=Oe.node,Oe.stop(i+t))}else throw new Error(`sound ${a} not found! Is it loaded?`);if(!te)return;if(r.currentTime>i){ps("[webaudio] skip hap: still loading",r.currentTime-i);return}const M=[];if(M.push(te),M.push(mc(l)),c!==void 0&&M.push(Cu("lowpass",c,d)),p!==void 0&&M.push(Cu("highpass",p,m)),_!==void 0&&M.push(Cu("bandpass",_,b)),Z!==void 0&&M.push(r.createVowelFilter(Z)),A!==void 0&&M.push(Ru(r,"coarse-processor",{coarse:A})),R!==void 0&&M.push(Ru(r,"crush-processor",{crush:R})),x!==void 0&&M.push(Ru(r,"shape-processor",{shape:x})),Y!==void 0){const se=r.createStereoPanner();se.pan.value=2*Y-1,M.push(se)}const Q=mc(1);M.push(Q),Q.connect(Mg());let j;if(h>0&&S>0&&E>0){const se=zP(I,S,E,i);j=Iu(Q,se,h)}let X;if(D>0&&L>0){const se=WP(I,L);X=Iu(Q,se,D)}let le;if($){const se=XP(2**(ee+5));le=Iu(Q,se,$)}M.slice(1).reduce((se,Oe)=>se.connect(Oe),M[0]),ne=M.concat([j,X,le])},Nu={};function ZP(n,e){var t=e?1e3:1024;if(n=t);return n.toFixed(1)+" "+r[i]}const KP=async(n,e,t,r,i,a,s)=>{let o=0;i!==void 0&&t!==void 0&&ps("[sampler] hap has note and freq. ignoring note","warning");let l=YP({freq:i,note:t},36);o=l-36;const c=Ht();let d;if(Array.isArray(a))d=a[e%a.length];else{const b=R=>Mc(R)-l,A=Object.keys(a).filter(R=>!R.startsWith("_")).reduce((R,x,Y)=>!R||Math.abs(b(x)){const i=t?`sound "${t}:${r}"`:"sample";if(!Nu[n]){ps(`[sampler] load ${i}..`,"load-sample",{url:n});const a=Date.now();Nu[n]=fetch(n).then(s=>s.arrayBuffer()).then(async s=>{const o=Date.now()-a,l=ZP(s.byteLength);return ps(`[sampler] load ${i}... done! loaded ${l} in ${o}ms`,"loaded-sample",{url:n}),await e.decodeAudioData(s)})}return Nu[n]};function JP(n){const e=Ht(),t=e.createBuffer(n.numberOfChannels,n.length,e.sampleRate);for(let r=0;rObject.entries(n).forEach(([r,i])=>{if(typeof i=="string"&&(i=[i]),typeof i!="object")throw new Error("wrong sample map format for "+r);t=i._base||t;const a=s=>(t+s).replace("github:","https://raw.githubusercontent.com/");Array.isArray(i)?i=i.map(a):i=Object.fromEntries(Object.entries(i).map(([s,o])=>[s,(typeof o=="string"?[o]:o).map(a)])),e(r,i)});let t3={};function r3(n){const e=Object.entries(t3).find(([t])=>n.startsWith(t));if(e)return e[1]}const io=async(n,e=n._base||"",t={})=>{if(typeof n=="string"){const a=r3(n);if(a)return a(n);if(n.startsWith("github:")){let[o,l]=n.split("github:");l=l.endsWith("/")?l.slice(0,-1):l,n=`https://raw.githubusercontent.com/${l}/strudel.json`}if(typeof fetch!="function")return;const s=n.split("/").slice(0,-1).join("/");return typeof fetch>"u"?void 0:fetch(n).then(o=>o.json()).then(o=>io(o,e||o._base||s,t)).catch(o=>{throw console.error(o),new Error(`error loading "${n}"`)})}const{prebake:r,tag:i}=t;e3(n,(a,s)=>Lg(a,(o,l,c)=>n3(o,l,c,s),{type:"sample",samples:s,baseUrl:e,prebake:r,tag:i}),e)},qO=[];async function n3(n,e,t,r,i){const{s:a,freq:s,unit:o,nudge:l=0,cut:c,loop:d,clip:p=void 0,n:m=0,note:_,speed:b=1,begin:A=0,end:R=1}=e;if(b===0)return;const x=Ht(),{attack:Y=.001,decay:Z=.001,sustain:h=1,release:E=.001}=e,S=n+l,I=await KP(a,m,_,b,s,r,i);if(x.currentTime>n){ps(`[sampler] still loading sound "${a}:${m}"`,"highlight");return}if(!I){ps(`[sampler] could not load "${a}:${m}"`,"error");return}I.playbackRate.value=Math.abs(b)*I.playbackRate.value,o==="c"&&(I.playbackRate.value=I.playbackRate.value*I.buffer.duration*1);const D=A*I.buffer.duration;I.start(S,D);const L=I.buffer.duration/I.playbackRate.value,{node:k,stop:$}=_m(Y,Z,h,E,1,n);I.connect(k);const ee=x.createGain();k.connect(ee),I.onended=function(){I.disconnect(),k.disconnect(),ee.disconnect(),t()};const ne={node:ee,bufferSource:I,stop:(re,te=p===void 0)=>{let M=re;te&&(M=n+(R-A)*L),I.stop(M+E),$(M)}};if(c!==void 0){const re=qO[c];re&&(re.node.gain.setValueAtTime(1,S),re.node.gain.linearRampToValueAtTime(0,S+.01)),qO[c]=ne}return ne}const i3=(n,e=1,t="sine")=>{const r=Ht(),i=r.createOscillator();i.type=t,i.frequency.value=n,i.start();const a=new GainNode(r,{gain:e});return i.connect(a),{node:a,stop:s=>i.stop(s)}},a3=(n,e,t,r="sine")=>{const i=n.frequency.value*e,a=i*t;return i3(i,a,r)};function s3(){["sine","square","triangle","sawtooth"].forEach(n=>{Lg(n,(e,t,r)=>{let{attack:i=.001,decay:a=.05,sustain:s=.6,release:o=.01,fmh:l=1,fmi:c,fmenv:d="lin",fmattack:p,fmdecay:m,fmsustain:_,fmrelease:b,fmvelocity:A,fmwave:R="sine"}=t,{n:x,note:Y,freq:Z}=t;Y=Y||36,typeof Y=="string"&&(Y=Mc(Y)),!Z&&typeof Y=="number"&&(Z=nR(Y));const{node:h,stop:E}=l3({t:e,s:n,freq:Z,partials:x});let S,I;if(c){const{node:$,stop:ee}=a3(h,l,c,R);[p,m,_,b,A].find(ne=>ne!==void 0)?(p=p??.001,m=m??.001,_=_??1,b=b??.001,A=A??1,I=_m(p,m,_,b,A,e),d==="exp"&&(I=$P(p,m,_,b,A,e),I.node.maxValue=c*2,I.node.minValue=1e-5),$.connect(I.node),I.node.connect(h.frequency)):$.connect(h.frequency),S=ee}const D=mc(.3),{node:L,stop:k}=_m(i,a,s,o,1,e);return h.onended=()=>{h.disconnect(),D.disconnect(),r()},{node:h.connect(D).connect(L),stop:$=>{k($),I==null||I.stop($);let ee=$+o;E(ee),S==null||S(ee)}}},{type:"synth",prebake:!0})})}function o3(n,e){const t=new Float32Array(n+1),r=new Float32Array(n+1),i=Ht(),a=i.createOscillator(),s={sawtooth:c=>1/c,square:c=>c%2===0?0:1/c,triangle:c=>c%2===0?0:1/(c*c)};if(!s[e])throw new Error(`unknown wave type ${e}`);t[0]=0,r[0]=0;let o=1;for(;o<=n;)t[o]=s[e](o),r[o]=0,o++;const l=i.createPeriodicWave(t,r);return a.setPeriodicWave(l),a}function l3({s:n,freq:e,t,partials:r}){let i;return!r||n==="sine"?(i=Ht().createOscillator(),i.type=n||"triangle"):i=o3(r,n),i.frequency.value=Number(e),i.start(t),{node:i,stop:a=>i.stop(a)}}function c3(n=1,e=.05,t=220,r=0,i=0,a=.1,s=0,o=1,l=0,c=0,d=0,p=0,m=0,_=0,b=0,A=0,R=0,x=1,Y=0,Z=0){let h=Math.PI*2,E=Ht().sampleRate,S=X=>X>0?1:-1,I=l*=500*h/E/E,D=t*=(1+e*2*Math.random()-e)*h/E,L=[],k=0,$=0,ee=0,ne=1,re=0,te=0,M=0,Q,j;for(r=r*E+9,Y*=E,i*=E,a*=E,R*=E,c*=500*h/E**3,b*=h/E,d*=h/E,p*=E,m=m*E|0,j=r+Y+i+a+R|0;ee1?s>2?s>3?Math.sin((k%h)**3):Math.max(Math.min(Math.tan(k),1),-1):1-(2*k/h%2+2)%2:1-4*Math.abs(Math.round(k/h)-k/h):Math.sin(k),M=(m?1-Z+Z*Math.sin(h*ee/m):1)*S(M)*Math.abs(M)**o*n*1*(eeee?0:(eep&&(t+=d,D+=d,ne=0),m&&!(++re%m)&&(t=D,l=I,ne||(ne=1));return L}const u3=(n,e)=>{let{s:t,note:r=36,freq:i,zrand:a=0,attack:s=0,decay:o=0,sustain:l=.8,release:c=.1,curve:d=1,slide:p=0,deltaSlide:m=0,pitchJump:_=0,pitchJumpTime:b=0,lfo:A=0,noise:R=0,zmod:x=0,zcrush:Y=0,zdelay:Z=0,tremolo:h=0,duration:E=.2,zzfx:S}=n;const I=Math.max(E-s-o,0);typeof r=="string"&&(r=Mc(r)),!i&&typeof r=="number"&&(i=nR(r)),t=t.replace("z_","");const D=["sine","triangle","sawtooth","tan","noise"].indexOf(t)||0;d=t==="square"?0:d;const L=c3(...S||[.25,a,i,s,I,c,D,d,p,m,_,b,A,R,x,Y,Z,l,o,h]),k=Ht(),$=k.createBuffer(1,L.length,k.sampleRate);$.getChannelData(0).set(L);const ee=Ht().createBufferSource();return ee.buffer=$,ee.start(e),{node:ee}};function d3(){["zzfx","z_sine","z_sawtooth","z_triangle","z_square","z_tan","z_noise"].forEach(n=>{Lg(n,(e,t,r)=>{const{node:i}=u3({s:n,...t},e);return i.onended=()=>{i.disconnect(),r()},{node:i,stop:()=>{}}},{type:"synth",prebake:!0})})}class Sm extends rR{constructor(t,r){super(r);C(this,"volume",t=>this.updateValue("volume",t));C(this,"vol",this.volume);C(this,"zrand",t=>this.updateValue("zrand",t));C(this,"curve",t=>this.updateValue("curve",t));C(this,"slide",t=>this.updateValue("slide",t));C(this,"sld",this.slide);C(this,"deltaSlide",t=>this.updateValue("deltaSlide",t));C(this,"dslide",this.deltaSlide);C(this,"pitchJump",t=>this.updateValue("pitchJump",t));C(this,"pj",this.pitchJump);C(this,"pitchJumpTime",t=>this.updateValue("pitchJumpTime",t));C(this,"pjt",this.pitchJumpTime);C(this,"lfo",t=>this.updateValue("lfo",t));C(this,"noise",t=>this.updateValue("noise",t));C(this,"zmod",t=>this.updateValue("zmod",t));C(this,"zcrush",t=>this.updateValue("zcrush",t));C(this,"zdelay",t=>this.updateValue("zdelay",t));C(this,"sustainVolume",t=>this.updateValue("sustainVolume",t));C(this,"decay",t=>this.updateValue("decay",t));C(this,"dec",this.decay);C(this,"tremolo",t=>this.updateValue("tremolo",t));C(this,"duration",t=>this.updateValue("duration",t));C(this,"zzfx",t=>this.updateValue("zzfx",t));C(this,"fmi",t=>this.updateValue("fmi",t));C(this,"fmh",t=>this.updateValue("fmh",t));C(this,"fmenv",t=>this.updateValue("fmenv",t));C(this,"fmattack",t=>this.updateValue("fmattack",t));C(this,"fmatk",this.fmattack);C(this,"fmdecay",t=>this.updateValue("fmdecay",t));C(this,"fmdec",this.fmdecay);C(this,"fmsustain",t=>this.updateValue("fmsustain",t));C(this,"fmsus",this.fmsustain);C(this,"fmrelease",t=>this.updateValue("fmrelease",t));C(this,"fmrel",this.fmrelease);C(this,"fmvelocity",t=>this.updateValue("fmvelocity",t));C(this,"fmvel",this.fmvelocity);C(this,"fmwave",t=>this.updateValue("fmwave",t));C(this,"fmw",this.fmwave);C(this,"attack",t=>this.updateValue("attack",t));C(this,"atk",this.attack);C(this,"release",t=>this.updateValue("release",t));C(this,"rel",this.release);C(this,"sustain",t=>this.updateValue("sustain",t));C(this,"sus",this.sustain);C(this,"unit",t=>this.updateValue("unit",t));C(this,"u",this.unit);C(this,"freq",t=>this.updateValue("freq",t));C(this,"f",this.freq);C(this,"fm",t=>{if(typeof t=="number")this.values.fmi=t;else{let r=t.split(":");this.values.fmi=parseFloat(r[0]),r.length>1&&(this.values.fmh=parseFloat(r[1]))}return this});C(this,"sound",t=>this.updateValue("s",t));C(this,"chord",t=>this.updateValue("chord",t));C(this,"snd",this.sound);C(this,"nudge",t=>this.updateValue("nudge",t));C(this,"cut",t=>this.updateValue("cut",t));C(this,"loop",t=>this.updateValue("loop",t));C(this,"clip",t=>this.updateValue("clip",t));C(this,"n",t=>this.updateValue("n",t));C(this,"note",t=>this.updateValue("note",t));C(this,"speed",t=>this.updateValue("speed",t));C(this,"spd",this.speed);C(this,"begin",t=>this.updateValue("begin",t));C(this,"end",t=>this.updateValue("end",t));C(this,"gain",t=>this.updateValue("gain",t));C(this,"dbgain",t=>this.updateValue("gain",Math.min(Math.pow(10,t/20),10)));C(this,"db",this.dbgain);C(this,"cutoff",t=>this.updateValue("cutoff",t));C(this,"lpf",this.cutoff);C(this,"resonance",t=>this.updateValue("resonance",Math.min(Math.max(t,0),50)));C(this,"lpq",this.resonance);C(this,"hcutoff",t=>this.updateValue("hcutoff",t));C(this,"hpf",this.hcutoff);C(this,"hresonance",t=>this.updateValue("hresonance",t));C(this,"hpq",this.hresonance);C(this,"bandf",t=>this.updateValue("bandf",t));C(this,"bpf",this.bandf);C(this,"bandq",t=>this.updateValue("bandq",t));C(this,"bpq",this.bandq);C(this,"coarse",t=>this.updateValue("coarse",t));C(this,"crush",t=>this.updateValue("crush",t));C(this,"shape",t=>this.updateValue("shape",t));C(this,"pan",t=>this.updateValue("pan",t));C(this,"vowel",t=>this.updateValue("vowel",t));C(this,"vow",this.vowel);C(this,"delay",t=>this.updateValue("delay",t));C(this,"del",this.delay);C(this,"delayfeedback",t=>this.updateValue("delayfeedback",t));C(this,"delayfb",this.delayfeedback);C(this,"delaytime",t=>this.updateValue("delaytime",t));C(this,"delayt",this.delaytime);C(this,"orbit",t=>this.updateValue("orbit",t));C(this,"o",this.orbit);C(this,"room",t=>this.updateValue("room",t));C(this,"rm",this.room);C(this,"size",t=>this.updateValue("size",t));C(this,"sz",this.size);C(this,"velocity",t=>this.updateValue("velocity",t));C(this,"vel",this.velocity);C(this,"modify",t=>{const r=t(this);return r instanceof Object?r:(t(this.values),this.update(),this)});C(this,"update",()=>{const[t,r]=Ng(this.values.key||"C4",this.values.pitch||0,this.values.parsedScale||"MAJOR",this.values.octave||0);this.values.freq=Ro(t)});C(this,"out",()=>{this.values.chord?this.values.chord.forEach(t=>{const r={...this.values};r.freq=t,QO(r,1/4,this.values.dur||.5)}):QO(this.values,1/4,this.values.dur||.5)});this.app=r,typeof t=="string"?this.values={s:t,dur:.5}:this.values=t}updateValue(t,r){return this.values[t]=r,this}}class Om extends rR{constructor(t,r){super(r);C(this,"midiConnection");C(this,"chord",t=>(this.values.chord=t,this));C(this,"note",t=>(this.values.note=t,this));C(this,"sustain",t=>(this.values.sustain=t,this));C(this,"channel",t=>(this.values.channel=t,this));C(this,"port",t=>(this.values.port=this.midiConnection.getMidiOutputIndex(t),this));C(this,"add",t=>(this.values.note+=t,this));C(this,"modify",t=>{const r=t(this);return r instanceof Object?r:(t(this.values),this.update(),this)});C(this,"bend",t=>(this.values.bend=t,this));C(this,"random",(t=0,r=127)=>(t=Math.min(Math.max(t,0),127),r=Math.min(Math.max(r,0),127),this.values.note=Math.floor(this.randomGen()*(r-t+1))+t,this));C(this,"update",()=>{const[t,r]=Ng(this.values.key||"C4",this.values.pitch||0,this.values.parsedScale||"MAJOR",this.values.octave||0);this.values.note=t,this.values.freq=Ro(t),r&&(this.values.bend=r)});C(this,"out",()=>{function t(r,i){const a=i.values.channel?i.values.channel:0,s=i.values.velocity?i.values.velocity:100,o=i.values.sustain?i.values.sustain*i.app.clock.pulse_duration*i.app.api.ppqn():i.app.clock.pulse_duration*i.app.api.ppqn(),l=i.values.bend?i.values.bend:void 0,c=i.values.port?i.midiConnection.getMidiOutputIndex(i.values.port):i.midiConnection.getCurrentMidiPortIndex();i.midiConnection.sendMidiNote(r,a,s,o,c,l)}if(this.values.chord)this.values.chord.forEach(r=>{t(r,this)});else{const r=this.values.note?this.values.note:60;t(r,this)}});this.app=r,typeof t=="number"?this.values.note=t:this.values=t,this.midiConnection=r.api.MidiConnection}}const Gs=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,iR=new Set,Em=typeof process=="object"&&process?process:{},aR=(n,e,t,r)=>{typeof Em.emitWarning=="function"?Em.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)};let gc=globalThis.AbortController,VO=globalThis.AbortSignal;var MT;if(typeof gc>"u"){VO=class{constructor(){C(this,"onabort");C(this,"_onabort",[]);C(this,"reason");C(this,"aborted",!1)}addEventListener(r,i){this._onabort.push(i)}},gc=class{constructor(){C(this,"signal",new VO);e()}abort(r){var i,a;if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=!0;for(const s of this.signal._onabort)s(r);(a=(i=this.signal).onabort)==null||a.call(i,r)}}};let n=((MT=Em.env)==null?void 0:MT.LRU_CACHE_IGNORE_AC_WARNING)!=="1";const e=()=>{n&&(n=!1,aR("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}const p3=n=>!iR.has(n),Ri=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),sR=n=>Ri(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?Ml:null:null;class Ml extends Array{constructor(e){super(e),this.fill(0)}}var Za;const na=class na{constructor(e,t){C(this,"heap");C(this,"length");if(!V(na,Za))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}static create(e){const t=sR(e);if(!t)return[];ze(na,Za,!0);const r=new na(e,t);return ze(na,Za,!1),r}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}};Za=new WeakMap,tt(na,Za,!1);let bm=na;var En,Qr,bn,Tn,Ka,Zt,vn,Kt,Nt,et,yr,qr,fr,nr,Cn,ir,ti,ri,yn,An,ki,Ar,Do,vm,ua,ni,xo,Vr,bc,oR,da,ja,ko,Pn,Ii,Bn,Ni,Lo,Cm,Ja,Pl,es,Bl,At,xt,Mo,ym,pa,Ks;const qg=class qg{constructor(e){tt(this,Do);tt(this,bc);tt(this,Pn);tt(this,Bn);tt(this,Lo);tt(this,Ja);tt(this,es);tt(this,At);tt(this,Mo);tt(this,pa);tt(this,En,void 0);tt(this,Qr,void 0);tt(this,bn,void 0);tt(this,Tn,void 0);tt(this,Ka,void 0);C(this,"ttl");C(this,"ttlResolution");C(this,"ttlAutopurge");C(this,"updateAgeOnGet");C(this,"updateAgeOnHas");C(this,"allowStale");C(this,"noDisposeOnSet");C(this,"noUpdateTTL");C(this,"maxEntrySize");C(this,"sizeCalculation");C(this,"noDeleteOnFetchRejection");C(this,"noDeleteOnStaleGet");C(this,"allowStaleOnFetchAbort");C(this,"allowStaleOnFetchRejection");C(this,"ignoreFetchAbort");tt(this,Zt,void 0);tt(this,vn,void 0);tt(this,Kt,void 0);tt(this,Nt,void 0);tt(this,et,void 0);tt(this,yr,void 0);tt(this,qr,void 0);tt(this,fr,void 0);tt(this,nr,void 0);tt(this,Cn,void 0);tt(this,ir,void 0);tt(this,ti,void 0);tt(this,ri,void 0);tt(this,yn,void 0);tt(this,An,void 0);tt(this,ki,void 0);tt(this,Ar,void 0);tt(this,ua,()=>{});tt(this,ni,()=>{});tt(this,xo,()=>{});tt(this,Vr,()=>!1);tt(this,da,e=>{});tt(this,ja,(e,t,r)=>{});tt(this,ko,(e,t,r,i)=>{if(r||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});const{max:t=0,ttl:r,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:s,updateAgeOnHas:o,allowStale:l,dispose:c,disposeAfter:d,noDisposeOnSet:p,noUpdateTTL:m,maxSize:_=0,maxEntrySize:b=0,sizeCalculation:A,fetchMethod:R,noDeleteOnFetchRejection:x,noDeleteOnStaleGet:Y,allowStaleOnFetchRejection:Z,allowStaleOnFetchAbort:h,ignoreFetchAbort:E}=e;if(t!==0&&!Ri(t))throw new TypeError("max option must be a nonnegative integer");const S=t?sR(t):Array;if(!S)throw new Error("invalid max value: "+t);if(ze(this,En,t),ze(this,Qr,_),this.maxEntrySize=b||V(this,Qr),this.sizeCalculation=A,this.sizeCalculation){if(!V(this,Qr)&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(R!==void 0&&typeof R!="function")throw new TypeError("fetchMethod must be a function if specified");if(ze(this,Ka,R),ze(this,ki,!!R),ze(this,Kt,new Map),ze(this,Nt,new Array(t).fill(void 0)),ze(this,et,new Array(t).fill(void 0)),ze(this,yr,new S(t)),ze(this,qr,new S(t)),ze(this,fr,0),ze(this,nr,0),ze(this,Cn,bm.create(t)),ze(this,Zt,0),ze(this,vn,0),typeof c=="function"&&ze(this,bn,c),typeof d=="function"?(ze(this,Tn,d),ze(this,ir,[])):(ze(this,Tn,void 0),ze(this,ir,void 0)),ze(this,An,!!V(this,bn)),ze(this,Ar,!!V(this,Tn)),this.noDisposeOnSet=!!p,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!x,this.allowStaleOnFetchRejection=!!Z,this.allowStaleOnFetchAbort=!!h,this.ignoreFetchAbort=!!E,this.maxEntrySize!==0){if(V(this,Qr)!==0&&!Ri(V(this,Qr)))throw new TypeError("maxSize must be a positive integer if specified");if(!Ri(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");Qe(this,bc,oR).call(this)}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!Y,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!o,this.ttlResolution=Ri(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!Ri(this.ttl))throw new TypeError("ttl must be a positive integer if specified");Qe(this,Do,vm).call(this)}if(V(this,En)===0&&this.ttl===0&&V(this,Qr)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!V(this,En)&&!V(this,Qr)){const I="LRU_CACHE_UNBOUNDED";p3(I)&&(iR.add(I),aR("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",I,qg))}}static unsafeExposeInternals(e){return{starts:V(e,ri),ttls:V(e,yn),sizes:V(e,ti),keyMap:V(e,Kt),keyList:V(e,Nt),valList:V(e,et),next:V(e,yr),prev:V(e,qr),get head(){return V(e,fr)},get tail(){return V(e,nr)},free:V(e,Cn),isBackgroundFetch:t=>{var r;return Qe(r=e,At,xt).call(r,t)},backgroundFetch:(t,r,i,a)=>{var s;return Qe(s=e,es,Bl).call(s,t,r,i,a)},moveToTail:t=>{var r;return Qe(r=e,pa,Ks).call(r,t)},indexes:t=>{var r;return Qe(r=e,Pn,Ii).call(r,t)},rindexes:t=>{var r;return Qe(r=e,Bn,Ni).call(r,t)},isStale:t=>{var r;return V(r=e,Vr).call(r,t)}}}get max(){return V(this,En)}get maxSize(){return V(this,Qr)}get calculatedSize(){return V(this,vn)}get size(){return V(this,Zt)}get fetchMethod(){return V(this,Ka)}get dispose(){return V(this,bn)}get disposeAfter(){return V(this,Tn)}getRemainingTTL(e){return V(this,Kt).has(e)?1/0:0}*entries(){for(const e of Qe(this,Pn,Ii).call(this))V(this,et)[e]!==void 0&&V(this,Nt)[e]!==void 0&&!Qe(this,At,xt).call(this,V(this,et)[e])&&(yield[V(this,Nt)[e],V(this,et)[e]])}*rentries(){for(const e of Qe(this,Bn,Ni).call(this))V(this,et)[e]!==void 0&&V(this,Nt)[e]!==void 0&&!Qe(this,At,xt).call(this,V(this,et)[e])&&(yield[V(this,Nt)[e],V(this,et)[e]])}*keys(){for(const e of Qe(this,Pn,Ii).call(this)){const t=V(this,Nt)[e];t!==void 0&&!Qe(this,At,xt).call(this,V(this,et)[e])&&(yield t)}}*rkeys(){for(const e of Qe(this,Bn,Ni).call(this)){const t=V(this,Nt)[e];t!==void 0&&!Qe(this,At,xt).call(this,V(this,et)[e])&&(yield t)}}*values(){for(const e of Qe(this,Pn,Ii).call(this))V(this,et)[e]!==void 0&&!Qe(this,At,xt).call(this,V(this,et)[e])&&(yield V(this,et)[e])}*rvalues(){for(const e of Qe(this,Bn,Ni).call(this))V(this,et)[e]!==void 0&&!Qe(this,At,xt).call(this,V(this,et)[e])&&(yield V(this,et)[e])}[Symbol.iterator](){return this.entries()}find(e,t={}){for(const r of Qe(this,Pn,Ii).call(this)){const i=V(this,et)[r],a=Qe(this,At,xt).call(this,i)?i.__staleWhileFetching:i;if(a!==void 0&&e(a,V(this,Nt)[r],this))return this.get(V(this,Nt)[r],t)}}forEach(e,t=this){for(const r of Qe(this,Pn,Ii).call(this)){const i=V(this,et)[r],a=Qe(this,At,xt).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,V(this,Nt)[r],this)}}rforEach(e,t=this){for(const r of Qe(this,Bn,Ni).call(this)){const i=V(this,et)[r],a=Qe(this,At,xt).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,V(this,Nt)[r],this)}}purgeStale(){let e=!1;for(const t of Qe(this,Bn,Ni).call(this,{allowStale:!0}))V(this,Vr).call(this,t)&&(this.delete(V(this,Nt)[t]),e=!0);return e}dump(){const e=[];for(const t of Qe(this,Pn,Ii).call(this,{allowStale:!0})){const r=V(this,Nt)[t],i=V(this,et)[t],a=Qe(this,At,xt).call(this,i)?i.__staleWhileFetching:i;if(a===void 0||r===void 0)continue;const s={value:a};if(V(this,yn)&&V(this,ri)){s.ttl=V(this,yn)[t];const o=Gs.now()-V(this,ri)[t];s.start=Math.floor(Date.now()-o)}V(this,ti)&&(s.size=V(this,ti)[t]),e.unshift([r,s])}return e}load(e){this.clear();for(const[t,r]of e){if(r.start){const i=Date.now()-r.start;r.start=Gs.now()-i}this.set(t,r.value,r)}}set(e,t,r={}){var m,_,b,A,R;if(t===void 0)return this.delete(e),this;const{ttl:i=this.ttl,start:a,noDisposeOnSet:s=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:l}=r;let{noUpdateTTL:c=this.noUpdateTTL}=r;const d=V(this,ko).call(this,e,t,r.size||0,o);if(this.maxEntrySize&&d>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.delete(e),this;let p=V(this,Zt)===0?void 0:V(this,Kt).get(e);if(p===void 0)p=V(this,Zt)===0?V(this,nr):V(this,Cn).length!==0?V(this,Cn).pop():V(this,Zt)===V(this,En)?Qe(this,Ja,Pl).call(this,!1):V(this,Zt),V(this,Nt)[p]=e,V(this,et)[p]=t,V(this,Kt).set(e,p),V(this,yr)[V(this,nr)]=p,V(this,qr)[p]=V(this,nr),ze(this,nr,p),Zo(this,Zt)._++,V(this,ja).call(this,p,d,l),l&&(l.set="add"),c=!1;else{Qe(this,pa,Ks).call(this,p);const x=V(this,et)[p];if(t!==x){if(V(this,ki)&&Qe(this,At,xt).call(this,x)){x.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:Y}=x;Y!==void 0&&!s&&(V(this,An)&&((m=V(this,bn))==null||m.call(this,Y,e,"set")),V(this,Ar)&&((_=V(this,ir))==null||_.push([Y,e,"set"])))}else s||(V(this,An)&&((b=V(this,bn))==null||b.call(this,x,e,"set")),V(this,Ar)&&((A=V(this,ir))==null||A.push([x,e,"set"])));if(V(this,da).call(this,p),V(this,ja).call(this,p,d,l),V(this,et)[p]=t,l){l.set="replace";const Y=x&&Qe(this,At,xt).call(this,x)?x.__staleWhileFetching:x;Y!==void 0&&(l.oldValue=Y)}}else l&&(l.set="update")}if(i!==0&&!V(this,yn)&&Qe(this,Do,vm).call(this),V(this,yn)&&(c||V(this,xo).call(this,p,i,a),l&&V(this,ni).call(this,l,p)),!s&&V(this,Ar)&&V(this,ir)){const x=V(this,ir);let Y;for(;Y=x==null?void 0:x.shift();)(R=V(this,Tn))==null||R.call(this,...Y)}return this}pop(){var e;try{for(;V(this,Zt);){const t=V(this,et)[V(this,fr)];if(Qe(this,Ja,Pl).call(this,!0),Qe(this,At,xt).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(V(this,Ar)&&V(this,ir)){const t=V(this,ir);let r;for(;r=t==null?void 0:t.shift();)(e=V(this,Tn))==null||e.call(this,...r)}}}has(e,t={}){const{updateAgeOnHas:r=this.updateAgeOnHas,status:i}=t,a=V(this,Kt).get(e);if(a!==void 0){const s=V(this,et)[a];if(Qe(this,At,xt).call(this,s)&&s.__staleWhileFetching===void 0)return!1;if(V(this,Vr).call(this,a))i&&(i.has="stale",V(this,ni).call(this,i,a));else return r&&V(this,ua).call(this,a),i&&(i.has="hit",V(this,ni).call(this,i,a)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){const{allowStale:r=this.allowStale}=t,i=V(this,Kt).get(e);if(i!==void 0&&(r||!V(this,Vr).call(this,i))){const a=V(this,et)[i];return Qe(this,At,xt).call(this,a)?a.__staleWhileFetching:a}}async fetch(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,ttl:s=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:l=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:p=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:_=this.ignoreFetchAbort,allowStaleOnFetchAbort:b=this.allowStaleOnFetchAbort,context:A,forceRefresh:R=!1,status:x,signal:Y}=t;if(!V(this,ki))return x&&(x.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:a,status:x});const Z={allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:a,ttl:s,noDisposeOnSet:o,size:l,sizeCalculation:c,noUpdateTTL:d,noDeleteOnFetchRejection:p,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:b,ignoreFetchAbort:_,status:x,signal:Y};let h=V(this,Kt).get(e);if(h===void 0){x&&(x.fetch="miss");const E=Qe(this,es,Bl).call(this,e,h,Z,A);return E.__returned=E}else{const E=V(this,et)[h];if(Qe(this,At,xt).call(this,E)){const k=r&&E.__staleWhileFetching!==void 0;return x&&(x.fetch="inflight",k&&(x.returnedStale=!0)),k?E.__staleWhileFetching:E.__returned=E}const S=V(this,Vr).call(this,h);if(!R&&!S)return x&&(x.fetch="hit"),Qe(this,pa,Ks).call(this,h),i&&V(this,ua).call(this,h),x&&V(this,ni).call(this,x,h),E;const I=Qe(this,es,Bl).call(this,e,h,Z,A),L=I.__staleWhileFetching!==void 0&&r;return x&&(x.fetch=S?"stale":"refresh",L&&S&&(x.returnedStale=!0)),L?I.__staleWhileFetching:I.__returned=I}}get(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:s}=t,o=V(this,Kt).get(e);if(o!==void 0){const l=V(this,et)[o],c=Qe(this,At,xt).call(this,l);return s&&V(this,ni).call(this,s,o),V(this,Vr).call(this,o)?(s&&(s.get="stale"),c?(s&&r&&l.__staleWhileFetching!==void 0&&(s.returnedStale=!0),r?l.__staleWhileFetching:void 0):(a||this.delete(e),s&&r&&(s.returnedStale=!0),r?l:void 0)):(s&&(s.get="hit"),c?l.__staleWhileFetching:(Qe(this,pa,Ks).call(this,o),i&&V(this,ua).call(this,o),l))}else s&&(s.get="miss")}delete(e){var r,i,a,s;let t=!1;if(V(this,Zt)!==0){const o=V(this,Kt).get(e);if(o!==void 0)if(t=!0,V(this,Zt)===1)this.clear();else{V(this,da).call(this,o);const l=V(this,et)[o];Qe(this,At,xt).call(this,l)?l.__abortController.abort(new Error("deleted")):(V(this,An)||V(this,Ar))&&(V(this,An)&&((r=V(this,bn))==null||r.call(this,l,e,"delete")),V(this,Ar)&&((i=V(this,ir))==null||i.push([l,e,"delete"]))),V(this,Kt).delete(e),V(this,Nt)[o]=void 0,V(this,et)[o]=void 0,o===V(this,nr)?ze(this,nr,V(this,qr)[o]):o===V(this,fr)?ze(this,fr,V(this,yr)[o]):(V(this,yr)[V(this,qr)[o]]=V(this,yr)[o],V(this,qr)[V(this,yr)[o]]=V(this,qr)[o]),Zo(this,Zt)._--,V(this,Cn).push(o)}}if(V(this,Ar)&&((a=V(this,ir))!=null&&a.length)){const o=V(this,ir);let l;for(;l=o==null?void 0:o.shift();)(s=V(this,Tn))==null||s.call(this,...l)}return t}clear(){var e,t,r;for(const i of Qe(this,Bn,Ni).call(this,{allowStale:!0})){const a=V(this,et)[i];if(Qe(this,At,xt).call(this,a))a.__abortController.abort(new Error("deleted"));else{const s=V(this,Nt)[i];V(this,An)&&((e=V(this,bn))==null||e.call(this,a,s,"delete")),V(this,Ar)&&((t=V(this,ir))==null||t.push([a,s,"delete"]))}}if(V(this,Kt).clear(),V(this,et).fill(void 0),V(this,Nt).fill(void 0),V(this,yn)&&V(this,ri)&&(V(this,yn).fill(0),V(this,ri).fill(0)),V(this,ti)&&V(this,ti).fill(0),ze(this,fr,0),ze(this,nr,0),V(this,Cn).length=0,ze(this,vn,0),ze(this,Zt,0),V(this,Ar)&&V(this,ir)){const i=V(this,ir);let a;for(;a=i==null?void 0:i.shift();)(r=V(this,Tn))==null||r.call(this,...a)}}};En=new WeakMap,Qr=new WeakMap,bn=new WeakMap,Tn=new WeakMap,Ka=new WeakMap,Zt=new WeakMap,vn=new WeakMap,Kt=new WeakMap,Nt=new WeakMap,et=new WeakMap,yr=new WeakMap,qr=new WeakMap,fr=new WeakMap,nr=new WeakMap,Cn=new WeakMap,ir=new WeakMap,ti=new WeakMap,ri=new WeakMap,yn=new WeakMap,An=new WeakMap,ki=new WeakMap,Ar=new WeakMap,Do=new WeakSet,vm=function(){const e=new Ml(V(this,En)),t=new Ml(V(this,En));ze(this,yn,e),ze(this,ri,t),ze(this,xo,(a,s,o=Gs.now())=>{if(t[a]=s!==0?o:0,e[a]=s,s!==0&&this.ttlAutopurge){const l=setTimeout(()=>{V(this,Vr).call(this,a)&&this.delete(V(this,Nt)[a])},s+1);l.unref&&l.unref()}}),ze(this,ua,a=>{t[a]=e[a]!==0?Gs.now():0}),ze(this,ni,(a,s)=>{if(e[s]){const o=e[s],l=t[s];a.ttl=o,a.start=l,a.now=r||i();const c=a.now-l;a.remainingTTL=o-c}});let r=0;const i=()=>{const a=Gs.now();if(this.ttlResolution>0){r=a;const s=setTimeout(()=>r=0,this.ttlResolution);s.unref&&s.unref()}return a};this.getRemainingTTL=a=>{const s=V(this,Kt).get(a);if(s===void 0)return 0;const o=e[s],l=t[s];if(o===0||l===0)return 1/0;const c=(r||i())-l;return o-c},ze(this,Vr,a=>e[a]!==0&&t[a]!==0&&(r||i())-t[a]>e[a])},ua=new WeakMap,ni=new WeakMap,xo=new WeakMap,Vr=new WeakMap,bc=new WeakSet,oR=function(){const e=new Ml(V(this,En));ze(this,vn,0),ze(this,ti,e),ze(this,da,t=>{ze(this,vn,V(this,vn)-e[t]),e[t]=0}),ze(this,ko,(t,r,i,a)=>{if(Qe(this,At,xt).call(this,r))return 0;if(!Ri(i))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(i=a(r,t),!Ri(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i}),ze(this,ja,(t,r,i)=>{if(e[t]=r,V(this,Qr)){const a=V(this,Qr)-e[t];for(;V(this,vn)>a;)Qe(this,Ja,Pl).call(this,!0)}ze(this,vn,V(this,vn)+e[t]),i&&(i.entrySize=r,i.totalCalculatedSize=V(this,vn))})},da=new WeakMap,ja=new WeakMap,ko=new WeakMap,Pn=new WeakSet,Ii=function*({allowStale:e=this.allowStale}={}){if(V(this,Zt))for(let t=V(this,nr);!(!Qe(this,Lo,Cm).call(this,t)||((e||!V(this,Vr).call(this,t))&&(yield t),t===V(this,fr)));)t=V(this,qr)[t]},Bn=new WeakSet,Ni=function*({allowStale:e=this.allowStale}={}){if(V(this,Zt))for(let t=V(this,fr);!(!Qe(this,Lo,Cm).call(this,t)||((e||!V(this,Vr).call(this,t))&&(yield t),t===V(this,nr)));)t=V(this,yr)[t]},Lo=new WeakSet,Cm=function(e){return e!==void 0&&V(this,Kt).get(V(this,Nt)[e])===e},Ja=new WeakSet,Pl=function(e){var a,s;const t=V(this,fr),r=V(this,Nt)[t],i=V(this,et)[t];return V(this,ki)&&Qe(this,At,xt).call(this,i)?i.__abortController.abort(new Error("evicted")):(V(this,An)||V(this,Ar))&&(V(this,An)&&((a=V(this,bn))==null||a.call(this,i,r,"evict")),V(this,Ar)&&((s=V(this,ir))==null||s.push([i,r,"evict"]))),V(this,da).call(this,t),e&&(V(this,Nt)[t]=void 0,V(this,et)[t]=void 0,V(this,Cn).push(t)),V(this,Zt)===1?(ze(this,fr,ze(this,nr,0)),V(this,Cn).length=0):ze(this,fr,V(this,yr)[t]),V(this,Kt).delete(r),Zo(this,Zt)._--,t},es=new WeakSet,Bl=function(e,t,r,i){const a=t===void 0?void 0:V(this,et)[t];if(Qe(this,At,xt).call(this,a))return a;const s=new gc,{signal:o}=r;o==null||o.addEventListener("abort",()=>s.abort(o.reason),{signal:s.signal});const l={signal:s.signal,options:r,context:i},c=(A,R=!1)=>{const{aborted:x}=s.signal,Y=r.ignoreFetchAbort&&A!==void 0;if(r.status&&(x&&!R?(r.status.fetchAborted=!0,r.status.fetchError=s.signal.reason,Y&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),x&&!Y&&!R)return p(s.signal.reason);const Z=_;return V(this,et)[t]===_&&(A===void 0?Z.__staleWhileFetching?V(this,et)[t]=Z.__staleWhileFetching:this.delete(e):(r.status&&(r.status.fetchUpdated=!0),this.set(e,A,l.options))),A},d=A=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=A),p(A)),p=A=>{const{aborted:R}=s.signal,x=R&&r.allowStaleOnFetchAbort,Y=x||r.allowStaleOnFetchRejection,Z=Y||r.noDeleteOnFetchRejection,h=_;if(V(this,et)[t]===_&&(!Z||h.__staleWhileFetching===void 0?this.delete(e):x||(V(this,et)[t]=h.__staleWhileFetching)),Y)return r.status&&h.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),h.__staleWhileFetching;if(h.__returned===h)throw A},m=(A,R)=>{var Y;const x=(Y=V(this,Ka))==null?void 0:Y.call(this,e,a,l);x&&x instanceof Promise&&x.then(Z=>A(Z===void 0?void 0:Z),R),s.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(A(void 0),r.allowStaleOnFetchAbort&&(A=Z=>c(Z,!0)))})};r.status&&(r.status.fetchDispatched=!0);const _=new Promise(m).then(c,d),b=Object.assign(_,{__abortController:s,__staleWhileFetching:a,__returned:void 0});return t===void 0?(this.set(e,b,{...l.options,status:void 0}),t=V(this,Kt).get(e)):V(this,et)[t]=b,b},At=new WeakSet,xt=function(e){if(!V(this,ki))return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof gc},Mo=new WeakSet,ym=function(e,t){V(this,qr)[t]=e,V(this,yr)[e]=t},pa=new WeakSet,Ks=function(e){e!==V(this,nr)&&(e===V(this,fr)?ze(this,fr,V(this,yr)[e]):Qe(this,Mo,ym).call(this,V(this,qr)[e],V(this,yr)[e]),Qe(this,Mo,ym).call(this,V(this,nr),e),ze(this,nr,e))};let Tm=qg;const ao=class ao{constructor(){C(this,"_fallbackMethod",()=>ao.createSkipProxy());C(this,"out",()=>{})}};C(ao,"createSkipProxy",()=>{const e=new ao;return new Proxy(e,{get(t,r,i){return typeof t[r]>"u"?t._fallbackMethod:t[r]},set(t,r,i,a){return!1}})});let _c=ao;const so=class so extends xg{constructor(t,r){super(r);C(this,"_fallbackMethod",()=>so.createRestProxy(this.values.length,this.app));C(this,"out",()=>{});this.values.length=t}};C(so,"createRestProxy",(t,r)=>{const i=new so(t,r);return new Proxy(i,{get(a,s,o){return typeof a[s]>"u"?a._fallbackMethod:a[s]},set(a,s,o,l){return!1}})});let Sc=so;class h3 extends xg{constructor(t,r,i){super(i);C(this,"input");C(this,"ziffers");C(this,"initCallTime",0);C(this,"startCallTime",0);C(this,"lastCallTime",0);C(this,"waitTime",0);C(this,"startBeat",0);C(this,"played",!1);C(this,"current");C(this,"retro",!1);C(this,"index",-1);C(this,"zid","");C(this,"options",{});C(this,"skipIndex",0);C(this,"endTime",0);C(this,"next",()=>(this.current=this.ziffers.next(),this.played=!0,this.current));C(this,"pulseToSecond",t=>this.app.clock.convertPulseToSecond(t));C(this,"firstRun",()=>this.notStarted());C(this,"atTheBeginning",()=>this.skipIndex===0&&this.ziffers.index<=0);C(this,"origin",()=>this.app.clock.pulses_since_origin+1);C(this,"pulse",()=>this.app.clock.time_position.pulse);C(this,"beat",()=>this.app.clock.time_position.beat);C(this,"nextBeat",()=>this.app.clock.next_beat_in_ticks);C(this,"nextBeatInTicks",()=>this.app.clock.next_beat_in_ticks);C(this,"areWeThereYet",()=>{this.app.clock.pulses_since_origin=this.nextBeatInTicks())&&this.origin()>=this.waitTime||this.current&&this.pulseToSecond(this.origin())>=this.pulseToSecond(this.lastCallTime)+this.current.duration*4*this.pulseToSecond(this.app.api.ppqn())&&this.origin()>=this.waitTime;return this.skipIndex=t?0:this.skipIndex+1,this.index=t?this.index+1:this.index,t&&this.notStarted()&&(this.initCallTime=this.app.clock.pulses_since_origin),this.atTheBeginning()&&(this.startCallTime=this.app.clock.pulses_since_origin),t});C(this,"out",()=>{});this.app=i,this.input=t,this.options=r,this.ziffers=new RP(t,r)}get ticks(){return this.ziffers.duration*4*this.app.clock.ppqn}nextEndTime(){return this.startCallTime+this.ticks}updateLastCallTime(){(this.notStarted()||this.played)&&(this.lastCallTime=this.app.clock.pulses_since_origin,this.played=!1)}notStarted(){return this.ziffers.notStarted()}sound(t){if(this.areWeThereYet()){const r=this.next();if(r instanceof si){const i=r.getExisting("freq","pitch","key","scale","octave","parsedScale");return new Sm(i,this.app).sound(t)}else if(r instanceof Ao){const i=r.freqs();return new Sm(r,this.app).chord(i).sound(t)}else if(r instanceof gm)return Sc.createRestProxy(r.duration,this.app)}else return _c.createSkipProxy()}midi(t=void 0){if(this.areWeThereYet()){const r=this.next(),i=r.getExisting("note","pitch","bend","key","scale","octave","parsedScale");if(r instanceof si){const a=new Om(i,this.app);return t?a.note(t):a}else{if(r instanceof gm)return Sc.createRestProxy(r.duration,this.app);if(r instanceof Ao){const a=r.notes();return new Om(i,this.app).chord(a)}}}else return _c.createSkipProxy()}scale(t){return this.atTheBeginning()&&this.ziffers.scale(t),this}key(t){return this.atTheBeginning()&&this.ziffers.key(t),this}octave(t){return this.atTheBeginning()&&this.ziffers.octave(t),this}retrograde(){return this.atTheBeginning()&&this.ziffers.retrograde(),this}wait(t){if(this.atTheBeginning()){if(typeof t=="function"){const r=this.app.api.patternCache.get(t.name);return r&&(this.waitTime=r.nextEndTime()),this}this.waitTime=this.origin()+Math.ceil(t*4*this.app.clock.ppqn)}return this}sync(t){if(this.atTheBeginning()&&this.notStarted()){const r=this.app.clock.pulses_since_origin,i=typeof t=="function"?t.name:t;if(r>0){const a=this.app.api.patternCache.get(i);if(a){const s=a.ziffers.duration,o=a.startCallTime,l=s*4*this.app.clock.ppqn;this.waitTime=o+l}}}return this}}const f3=n=>n[0]==="{"&&n[n.length-1]==="}",$s=(n,e)=>{if(f3(n)){const t=JSON.parse(n);return JSON.stringify({...t,...e})}else return JSON.stringify({...e,text:n})},m3=n=>{String.prototype.speak=function(){const e=JSON.parse(this.valueOf());new lR({...e,text:e.text}).speak().then(()=>{}).catch(t=>{console.log("Error speaking:",t)})},String.prototype.rate=function(e){return $s(this.valueOf(),{rate:e})},String.prototype.pitch=function(e){return $s(this.valueOf(),{pitch:e})},String.prototype.lang=function(e){return $s(this.valueOf(),{lang:e})},String.prototype.volume=function(e){return $s(this.valueOf(),{volume:e})},String.prototype.voice=function(e){return $s(this.valueOf(),{voice:e})},String.prototype.z=function(){return n.z(this.valueOf())}};let wu;class lR{constructor(e){C(this,"speak",()=>new Promise((e,t)=>{if(this.options.text){const r=window.speechSynthesis;r.speaking&&r.cancel();const i=new SpeechSynthesisUtterance(this.options.text);i.rate=this.options.rate||1,i.pitch=this.options.pitch||1,i.volume=this.options.volume||1,this.options.voice&&(i.voice=r.getVoices()[this.options.voice]),this.options.lang&&(this.options.lang.length===2?i.lang=`${this.options.lang}-${this.options.lang.toUpperCase()}`:this.options.lang.length===5?i.lang=this.options.lang:i.lang="en-US"),i.onend=()=>{e()},i.onerror=a=>{t(a)},r.speaking?(r.cancel(),wu&&clearTimeout(wu),wu=setTimeout(()=>{r.speak(i)},200)):r.speak(i)}else t("No text provided")}));this.options=e}}async function HO(){return Promise.all([HP(),io("github:tidalcycles/Dirt-Samples/master").then(()=>s3()),d3(),io("github:Bubobubobubobubo/Dough-Samples/main"),io("github:Bubobubobubobubo/Dough-Amiga/main")])}class g3{constructor(e){C(this,"variables",{});C(this,"codeExamples",{});C(this,"counters",{});C(this,"_drunk",new wP(-100,100,!1));C(this,"randomGen",Math.random);C(this,"currentSeed");C(this,"localSeeds",new Map);C(this,"patternCache",new Tm({max:1e3,ttl:1e3*60*5}));C(this,"errorTimeoutID",0);C(this,"printTimeoutID",0);C(this,"MidiConnection",new NP);C(this,"load");C(this,"_loadUniverseFromInterface",e=>{this.app.loadUniverse(e),this.app.openBuffersModal()});C(this,"_deleteUniverseFromInterface",e=>{delete this.app.universes[e],this.app.settings.saveApplicationToLocalStorage(this.app.universes,this.app.settings),this.app.updateKnownUniversesView()});C(this,"_playDocExample",e=>{let t=this.app.universes[this.app.selected_universe];this.app.exampleIsPlaying=!0,t.example?t.example.candidate=e||this.app.selectedExample:(t.example={candidate:"",committed:"",evaluations:0},t.example.candidate=e||this.app.selectedExample),this.play()});C(this,"_stopDocExample",()=>{let e=this.app.universes[this.app.selected_universe];(e==null?void 0:e.example)!==void 0&&(this.app.exampleIsPlaying=!1,e.example.candidate="",e.example.committed=""),this.pause()});C(this,"_playDocExampleOnce",e=>{let t=this.app.universes[this.app.selected_universe];(t==null?void 0:t.example)!==void 0&&(t.example.candidate="",t.example.committed=""),this.play(),this.app.exampleIsPlaying=!0,QM(this.app,e)});C(this,"_all_samples",()=>kg.get());C(this,"_reportError",e=>{console.log(e),clearTimeout(this.errorTimeoutID),clearTimeout(this.printTimeoutID),this.app.error_line.innerHTML=e,this.app.error_line.style.color="color-red-800",this.app.error_line.classList.remove("hidden"),this.errorTimeoutID=setTimeout(()=>this.app.error_line.classList.add("hidden"),2e3)});C(this,"_logMessage",e=>{console.log(e),clearTimeout(this.printTimeoutID),clearTimeout(this.errorTimeoutID),this.app.error_line.innerHTML=e,this.app.error_line.style.color="white",this.app.error_line.classList.remove("hidden"),this.printTimeoutID=setTimeout(()=>this.app.error_line.classList.add("hidden"),4e3)});C(this,"time",()=>this.app.audioContext.currentTime);C(this,"play",()=>{this.app.setButtonHighlighting("play",!0),this.app.clock.start()});C(this,"pause",()=>{this.app.setButtonHighlighting("pause",!0),this.app.clock.pause()});C(this,"stop",()=>{this.app.setButtonHighlighting("stop",!0),this.app.clock.stop()});C(this,"silence",this.stop);C(this,"hush",this.stop);C(this,"warp",e=>{this.app.clock.tick=e,this.app.clock.time_position=this.app.clock.convertTicksToTimeposition(e)});C(this,"beat_warp",e=>{this.app.clock.tick=e*this.app.clock.ppqn,this.app.clock.time_position=this.app.clock.convertTicksToTimeposition(e*this.app.clock.ppqn)});C(this,"onmousemove",e=>{this.app._mouseX=e.pageX,this.app._mouseY=e.pageY});C(this,"mouseX",()=>this.app._mouseX);C(this,"mouseY",()=>this.app._mouseY);C(this,"noteX",()=>Math.floor(this.app._mouseX/document.body.clientWidth*127));C(this,"noteY",()=>Math.floor(this.app._mouseY/document.body.clientHeight*127));C(this,"script",(...e)=>{e.forEach(t=>{Xa(this.app,this.app.universes[this.app.selected_universe].locals[t])})});C(this,"s",this.script);C(this,"clear_script",e=>{this.app.universes[this.app.selected_universe].locals[e]={candidate:"",committed:"",evaluations:0}});C(this,"cs",this.clear_script);C(this,"copy_script",(e,t)=>{this.app.universes[this.app.selected_universe].locals[t]=this.app.universes[this.app.selected_universe].locals[e]});C(this,"cps",this.copy_script);C(this,"midi_outputs",()=>{this._logMessage(this.MidiConnection.listMidiOutputs())});C(this,"midi_output",e=>{e?this.MidiConnection.switchMidiOutput(e):console.log(this.MidiConnection.getCurrentMidiPort())});C(this,"midi",(e=60,t,r)=>(t!==void 0&&(typeof e=="number"&&(e={note:e}),e.velocity=t),r!==void 0&&(typeof e=="number"&&(e={note:e}),e.channel=r),new Om(e,this.app)));C(this,"sysex",e=>{this.MidiConnection.sendSysExMessage(e)});C(this,"pitch_bend",(e,t)=>{this.MidiConnection.sendPitchBend(e,t)});C(this,"program_change",(e,t)=>{this.MidiConnection.sendProgramChange(e,t)});C(this,"midi_clock",()=>{this.MidiConnection.sendMidiClock()});C(this,"control_change",({control:e=20,value:t=0,channel:r=0})=>{this.MidiConnection.sendMidiControlChange(e,t,r)});C(this,"midi_panic",()=>{this.MidiConnection.panic()});C(this,"generateCacheKey",(...e)=>e.map(t=>JSON.stringify(t)).join(","));C(this,"z",(e,t={},r="")=>{const i="z"+r.toString(),a=r===""?this.generateCacheKey(e,t):i;let s;return this.app.api.patternCache.has(a)&&(s=this.app.api.patternCache.get(a),s.input!==e&&(s=void 0)),s||(s=new h3(e,t,this.app),this.app.api.patternCache.set(a,s)),typeof r=="number"&&(s.zid=i),s.updateLastCallTime(),r!==""&&s.sync("z0"),s});C(this,"z0",(e,t={})=>this.z(e,t,0));C(this,"z1",(e,t={})=>this.z(e,t,1));C(this,"z2",(e,t={})=>this.z(e,t,2));C(this,"z3",(e,t={})=>this.z(e,t,3));C(this,"z4",(e,t={})=>this.z(e,t,4));C(this,"z5",(e,t={})=>this.z(e,t,5));C(this,"z6",(e,t={})=>this.z(e,t,6));C(this,"z7",(e,t={})=>this.z(e,t,7));C(this,"z8",(e,t={})=>this.z(e,t,8));C(this,"z9",(e,t={})=>this.z(e,t,9));C(this,"z10",(e,t={})=>this.z(e,t,10));C(this,"z11",(e,t={})=>this.z(e,t,11));C(this,"z12",(e,t={})=>this.z(e,t,12));C(this,"z13",(e,t={})=>this.z(e,t,13));C(this,"z14",(e,t={})=>this.z(e,t,14));C(this,"z15",(e,t={})=>this.z(e,t,15));C(this,"z16",(e,t={})=>this.z(e,t,16));C(this,"counter",(e,t,r)=>(e in this.counters?(this.counters[e].limit!==t&&(this.counters[e].value=0,this.counters[e].limit=t),this.counters[e].step!==r&&(this.counters[e].step=r??this.counters[e].step),this.counters[e].value+=this.counters[e].step,this.counters[e].limit!==void 0&&this.counters[e].value>this.counters[e].limit&&(this.counters[e].value=0)):this.counters[e]={value:0,step:r??1,limit:t},this.counters[e].value));C(this,"$",this.counter);C(this,"i",e=>e!==void 0?(this.app.universes[this.app.selected_universe].global.evaluations=e,this.app.universes[this.app.selected_universe]):this.app.universes[this.app.selected_universe].global.evaluations);C(this,"drunk",e=>e!==void 0?(this._drunk.position=e,this._drunk.getPosition()):(this._drunk.step(),this._drunk.getPosition()));C(this,"drunk_max",e=>{this._drunk.max=e});C(this,"drunk_min",e=>{this._drunk.min=e});C(this,"drunk_wrap",e=>{this._drunk.toggleWrap(e)});C(this,"variable",(e,t)=>typeof e=="string"&&t===void 0?this.variables[e]:(this.variables[e]=t,this.variables[e]));C(this,"v",this.variable);C(this,"delete_variable",e=>{delete this.variables[e]});C(this,"dv",this.delete_variable);C(this,"clear_variables",()=>{this.variables={}});C(this,"cv",this.clear_variables);C(this,"randI",(e,t)=>Math.floor(this.randomGen()*(t-e+1))+e);C(this,"rand",(e,t)=>this.randomGen()*(t-e)+e);C(this,"irand",this.randI);C(this,"rI",this.randI);C(this,"r",this.rand);C(this,"ir",this.randI);C(this,"seed",e=>{typeof e=="number"&&(e=e.toString()),this.currentSeed!==e&&(this.currentSeed=e,this.randomGen=mm(e))});C(this,"localSeededRandom",e=>{if(typeof e=="number"&&(e=e.toString()),this.localSeeds.has(e))return this.localSeeds.get(e);const t=mm(e);return this.localSeeds.set(e,t),t});C(this,"clearLocalSeed",(e=void 0)=>{e&&this.localSeeds.delete(e.toString()),this.localSeeds.clear()});C(this,"quantize",(e,t)=>{if(t.length===0)return e;let r=t[0];return t.forEach(i=>{Math.abs(i-e)Math.min(Math.max(e,t),r));C(this,"cmp",this.clamp);C(this,"bpm",e=>e===void 0?this.app.clock.bpm:((e<1||e>500)&&console.log(`Setting bpm to ${e}`),this.app.clock.bpm=e,e));C(this,"tempo",this.bpm);C(this,"bpb",e=>e===void 0?this.app.clock.time_signature[0]:(e<1&&console.log(`Setting bpb to ${e}`),this.app.clock.time_signature[0]=e,e));C(this,"ppqn",e=>e===void 0?this.app.clock.ppqn:(e<1&&console.log(`Setting ppqn to ${e}`),this.app.clock.ppqn=e,e));C(this,"time_signature",(e,t)=>{this.app.clock.time_signature=[e,t]});C(this,"prob",e=>this.randomGen()*100this.randomGen()>.5);C(this,"odds",(e,t=1)=>this.randomGen()!1);C(this,"almostNever",(e=1)=>this.randomGen()<.025*this.ppqn()/(this.ppqn()*e));C(this,"rarely",(e=1)=>this.randomGen()<.1*this.ppqn()/(this.ppqn()*e));C(this,"scarcely",(e=1)=>this.randomGen()<.25*this.ppqn()/(this.ppqn()*e));C(this,"sometimes",(e=1)=>this.randomGen()<.5*this.ppqn()/(this.ppqn()*e));C(this,"often",(e=1)=>this.randomGen()<.75*this.ppqn()/(this.ppqn()*e));C(this,"frequently",(e=1)=>this.randomGen()<.9*this.ppqn()/(this.ppqn()*e));C(this,"almostAlways",(e=1)=>this.randomGen()<.985*this.ppqn()/(this.ppqn()*e));C(this,"always",(e=1)=>!0);C(this,"dice",e=>Math.floor(this.randomGen()*e)+1);C(this,"bar",()=>this.app.clock.time_position.bar+1);C(this,"tick",()=>this.app.clock.tick+1);C(this,"pulse",()=>this.app.clock.time_position.pulse+1);C(this,"beat",()=>this.app.clock.time_position.beat+1);C(this,"ebeat",()=>this.app.clock.beats_since_origin+1);C(this,"epulse",()=>this.app.clock.pulses_since_origin+1);C(this,"nominator",()=>this.app.clock.time_signature[0]);C(this,"meter",()=>this.app.clock.time_signature[1]);C(this,"denominator",this.meter);C(this,"mod",(...e)=>e.map(r=>this.app.clock.pulses_since_origin%Math.floor(r*this.ppqn())===0).some(r=>r===!0));C(this,"modpulse",(...e)=>e.map(r=>this.app.clock.pulses_since_origin%r===0).some(r=>r===!0));C(this,"modp",this.modpulse);C(this,"modbar",(...e)=>e.map(r=>this.app.clock.time_position.bar%Math.floor(r*this.ppqn())===0).some(r=>r===!0));C(this,"modb",this.modbar);C(this,"div",(e,t=50)=>{const r=this.app.clock.pulses_since_origin,i=Math.floor(e*this.ppqn()),a=Math.floor(t/100*i);return r%i{const t=this.app.clock.time_position.bar;return Math.floor(t/e)%2===0});C(this,"onbar",(e,t=this.app.clock.time_signature[0])=>{let r=this.app.clock.time_position.bar%t+1;return typeof e=="number"?e===r:e.some(i=>i==r)});C(this,"onbeat",(...e)=>{let t=[];return e.forEach(r=>{let i=r%this.nominator()||this.nominator(),a=Math.floor(i);a=a==0?this.nominator():a;let s=Math.floor((i-a)*this.ppqn()+1);s<=0&&(s=s+this.ppqn()*this.nominator()),t.push(a===this.beat()&&this.pulse()===s)}),t.some(r=>r==!0)});C(this,"oncount",(e,t)=>{typeof e=="number"&&(e=[e]);const r=this.app.clock.pulses_since_origin;let i=[];return e.forEach(a=>{a=a<1?0:a-1;const s=Math.ceil(a*this.ppqn()),o=r%(this.ppqn()*t);return i.push(o===s)}),i.some(a=>a==!0)});C(this,"oneuclid",(e,t,r=0)=>{const a=this._euclidean_cycle(e,t,r).reduce((s,o,l)=>(o&&s.push(l+1),s),[]);return this.oncount(a,t)});C(this,"delay",(e,t)=>{setTimeout(t,e)});C(this,"delayr",(e,t,r)=>{[...Array(t).keys()].map(a=>e*a).forEach((a,s)=>{setTimeout(r,a)})});C(this,"euclid",(e,t,r,i=0)=>this._euclidean_cycle(t,r,i)[e%r]);C(this,"ec",this.euclid);C(this,"rhythm",(e,t,r,i=0)=>this.mod(e)&&this._euclidean_cycle(t,r,i).div(e));C(this,"bin",(e,t)=>{let i=t.toString(2).split("").map(a=>a==="1");return i[e%i.length]});C(this,"binrhythm",(e,t)=>{let i=t.toString(2).split("").map(a=>a==="1");return this.mod(e)&&i.div(e)});C(this,"line",(e,t,r=1)=>{const i=[];if(t>e&&r>0||tMath.sin(this.app.clock.ctx.currentTime*Math.PI*2*e)+t);C(this,"usine",(e=1,t=0)=>(this.sine(e,t)+1)/2);C(this,"saw",(e=1,t=0)=>this.app.clock.ctx.currentTime*e%1*2-1+t);C(this,"usaw",(e=1,t=0)=>(this.saw(e,t)+1)/2);C(this,"triangle",(e=1,t=0)=>Math.abs(this.saw(e,t))*2-1);C(this,"utriangle",(e=1,t=0)=>(this.triangle(e,t)+1)/2);C(this,"square",(e=1,t=0,r=.5)=>{const i=1/e;return(Date.now()/1e3+t)%i/i(this.square(e,t,r)+1)/2);C(this,"noise",()=>this.randomGen()*2-1);C(this,"min",(...e)=>Math.min(...e));C(this,"max",(...e)=>Math.max(...e));C(this,"mean",(...e)=>e.reduce((r,i)=>r+i,0)/e.length);C(this,"limit",(e,t,r)=>Math.min(Math.max(e,t),r));C(this,"abs",Math.abs);C(this,"speak",(e,t="en-US",r=0,i=1,a=1)=>{new lR({text:e,lang:t,voice:r,rate:i,pitch:a}).speak().then(()=>{}).catch(o=>{console.log(o)})});C(this,"stop_hydra",()=>{this.app.hydra.hush()});C(this,"sound",e=>new Sm(e,this.app));C(this,"snd",this.sound);C(this,"samples",io);C(this,"log",e=>{console.log(e),this._logMessage(e)});C(this,"scale",xP);C(this,"rate",e=>{});C(this,"divseq",(...e)=>{const t=e[0],r=e.slice(1),i=this.app.clock.pulses_since_origin,a=Math.floor(i/Math.floor(t*this.ppqn()));return r[a%r.length]});C(this,"seqbeat",(...e)=>e[this.app.clock.time_position.beat%e.length]);C(this,"seqbar",(...e)=>e[(this.app.clock.time_position.bar+1)%e.length]);this.app=e}_euclidean_cycle(e,t,r=0){if(e==t)return Array.from({length:t},()=>!0);function i(o,l){const c=o.length,d=(l+1)%c;return o[l]>o[d]}if(e>=t)return[!0];const a=Array.from({length:t},(o,l)=>(e*(l-1)%t+t)%t);let s=a.map((o,l)=>i(a,l));return r!=0&&(s=s.slice(r).concat(s.slice(0,r))),s}}const _3=n=>{Array.prototype.in=function(e){return this.includes(e)},Array.prototype.square=function(){return this.map(e=>e*e)},Array.prototype.sqrt=function(){if(this.some(e=>e<0))throw new Error("Cannot take square root of negative number");return this.map(e=>Math.sqrt(e))},Array.prototype.add=function(e){return this.map(t=>t+e)},Array.prototype.sub=function(e){return this.map(t=>t-e)},Array.prototype.mult=function(e){return this.map(t=>t*e)},Array.prototype.division=function(e){if(e===0)throw new Error("Division by zero");return this.map(t=>t/e)},Array.prototype.pick=function(){return this[Math.floor(n.randomGen()*this.length)]},Array.prototype.beat=function(e=1){return this[n.app.clock.beats_since_origin/e%this.length]},Array.prototype.gen=function(e,t,r){return r<1?[]:Array.from({length:r},()=>Math.floor(n.randomGen()*(t-e+1))+e)},Array.prototype.bar=function(){return this[n.app.clock.time_position.bar%this.length]},Array.prototype.pulse=function(){return this[n.app.clock.time_position.pulse%this.length]},Array.prototype.div=function(e){const t=e,r=n.app.clock.pulses_since_origin,i=Math.floor(r/Math.floor(t*n.ppqn()));return this[i%this.length]},Array.prototype.shuffle=function(){let e=this.length,t;for(;e!==0;)t=Math.floor(n.randomGen()*e),e--,[this[e],this[t]]=[this[t],this[e]];return this},Array.prototype.rotate=function(e){const t=this.length;if(e<0)e=t+e%t;else if(e>0)e=e%t;else return this;const r=this.splice(-e,e);return this.unshift(...r),this},Array.prototype.unique=function(){const e=new Set;let t=0;for(let r=0;r100)throw new Error("Amount should be between 0 and 100");if(this.length<=1)return this;for(let t=0;t1)this.splice(t,1);else return this;else t++;return this},Array.prototype.repeatAll=function(e=1){if(e<1)throw new Error("Amount should be at least 1");let t=[];for(let r=0;r>1|(Dt&21845)<<1;yi=(yi&52428)>>2|(yi&13107)<<2,yi=(yi&61680)>>4|(yi&3855)<<4,Im[Dt]=((yi&65280)>>8|(yi&255)<<8)>>1}var Vn=function(n,e,t){for(var r=n.length,i=0,a=new Kr(e);i>l]=c}else for(o=new Kr(r),i=0;i>15-n[i]);return o},$i=new lr(288);for(var Dt=0;Dt<144;++Dt)$i[Dt]=8;for(var Dt=144;Dt<256;++Dt)$i[Dt]=9;for(var Dt=256;Dt<280;++Dt)$i[Dt]=7;for(var Dt=280;Dt<288;++Dt)$i[Dt]=8;var Io=new lr(32);for(var Dt=0;Dt<32;++Dt)Io[Dt]=5;var O3=Vn($i,9,0),E3=Vn($i,9,1),b3=Vn(Io,5,0),T3=Vn(Io,5,1),Du=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},On=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},xu=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},Bg=function(n){return(n+7)/8|0},Ug=function(n,e,t){(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length);var r=new lr(t-e);return r.set(n.subarray(e,t)),r},v3=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],xr=function(n,e,t){var r=new Error(e||v3[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,xr),!t)throw r;return r},Fg=function(n,e,t,r){var i=n.length,a=r?r.length:0;if(!i||e.f&&!e.l)return t||new lr(0);var s=!t||e.i!=2,o=e.i;t||(t=new lr(i*3));var l=function(Ve){var je=t.length;if(Ve>je){var ot=new lr(Math.max(je*2,Ve));ot.set(t),t=ot}},c=e.f||0,d=e.p||0,p=e.b||0,m=e.l,_=e.d,b=e.m,A=e.n,R=i*8;do{if(!m){c=On(n,d,1);var x=On(n,d+1,3);if(d+=3,x)if(x==1)m=E3,_=T3,b=9,A=5;else if(x==2){var E=On(n,d,31)+257,S=On(n,d+10,15)+4,I=E+On(n,d+5,31)+1;d+=14;for(var D=new lr(I),L=new lr(19),k=0;k>4;if(Y<16)D[k++]=Y;else{var te=0,M=0;for(Y==16?(M=3+On(n,d,3),d+=2,te=D[k-1]):Y==17?(M=3+On(n,d,7),d+=3):Y==18&&(M=11+On(n,d,127),d+=7);M--;)D[k++]=te}}var Q=D.subarray(0,E),j=D.subarray(E);b=Du(Q),A=Du(j),m=Vn(Q,b,1),_=Vn(j,A,1)}else xr(1);else{var Y=Bg(d)+4,Z=n[Y-4]|n[Y-3]<<8,h=Y+Z;if(h>i){o&&xr(0);break}s&&l(p+Z),t.set(n.subarray(Y,h),p),e.b=p+=Z,e.p=d=h*8,e.f=c;continue}if(d>R){o&&xr(0);break}}s&&l(p+131072);for(var X=(1<>4;if(d+=te&15,d>R){o&&xr(0);break}if(te||xr(2),Oe<256)t[p++]=Oe;else if(Oe==256){se=d,m=null;break}else{var ke=Oe-254;if(Oe>264){var k=Oe-257,Le=Pc[k];ke=On(n,d,(1<>4;Ee||xr(3),d+=Ee&15;var j=S3[Ne];if(Ne>3){var Le=Bc[Ne];j+=xu(n,d)&(1<R){o&&xr(0);break}s&&l(p+131072);var ue=p+ke;if(p>8},Qs=function(n,e,t){t<<=e&7;var r=e/8|0;n[r]|=t,n[r+1]|=t>>8,n[r+2]|=t>>16},ku=function(n,e){for(var t=[],r=0;rm&&(m=a[r].s);var _=new Kr(m+1),b=Nm(t[d-1],_,0);if(b>e){var r=0,A=0,R=b-e,x=1<e)A+=x-(1<>=R;A>0;){var Z=a[r].s;_[Z]=0&&A;--r){var h=a[r].s;_[h]==e&&(--_[h],++A)}b=e}return{t:new lr(_),l:b}},Nm=function(n,e,t){return n.s==-1?Math.max(Nm(n.l,e,t+1),Nm(n.r,e,t+1)):e[n.s]=t},WO=function(n){for(var e=n.length;e&&!n[--e];);for(var t=new Kr(++e),r=0,i=n[0],a=1,s=function(l){t[r++]=l},o=1;o<=e;++o)if(n[o]==i&&o!=e)++a;else{if(!i&&a>2){for(;a>138;a-=138)s(32754);a>2&&(s(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(s(i),--a;a>6;a-=6)s(8304);a>2&&(s(a-3<<5|8208),a=0)}for(;a--;)s(i);a=1,i=n[o]}return{c:t.subarray(0,r),n:e}},qs=function(n,e){for(var t=0,r=0;r>8,n[i+2]=n[i]^255,n[i+3]=n[i+1]^255;for(var a=0;a4&&!k[Am[ee-1]];--ee);var ne=c+5<<3,re=qs(i,$i)+qs(a,Io)+s,te=qs(i,m)+qs(a,A)+s+14+3*ee+qs(I,k)+2*I[16]+3*I[17]+7*I[18];if(l>=0&&ne<=re&&ne<=te)return hR(e,d,n.subarray(l,l+c));var M,Q,j,X;if(Jn(e,d,1+(te15&&(Jn(e,d,ke[D]>>5&127),d+=ke[D]>>12)}}else M=O3,Q=$i,j=b3,X=Io;for(var D=0;D255){var Le=Ee>>18&31;Qs(e,d,M[Le+257]),d+=Q[Le+257],Le>7&&(Jn(e,d,Ee>>23&31),d+=Pc[Le]);var Ne=Ee&31;Qs(e,d,j[Ne]),d+=X[Ne],Ne>3&&(Qs(e,d,Ee>>5&8191),d+=Bc[Ne])}else Qs(e,d,M[Ee]),d+=Q[Ee]}return Qs(e,d,M[256]),d+Q[256]},C3=new Pg([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),fR=new lr(0),y3=function(n,e,t,r,i,a){var s=a.z||n.length,o=new lr(r+s+5*(1+Math.ceil(s/7e3))+i),l=o.subarray(r,o.length-i),c=a.l,d=(a.r||0)&7;if(e){d&&(l[0]=a.r>>3);for(var p=C3[e-1],m=p>>13,_=p&8191,b=(1<7e3||k>24576)&&(M>423||!c)){d=XO(n,l,0,h,E,S,D,k,ee,L-ee,d),k=I=D=0,ee=L;for(var Q=0;Q<286;++Q)E[Q]=0;for(var Q=0;Q<30;++Q)S[Q]=0}var j=2,X=0,le=_,se=re-te&32767;if(M>2&&ne==Z(L-se))for(var Oe=Math.min(m,M)-1,ke=Math.min(32767,L),Le=Math.min(258,M);se<=ke&&--le&&re!=te;){if(n[L+j]==n[L+j-se]){for(var Ee=0;Eej){if(j=Ee,X=se,Ee>Oe)break;for(var Ne=Math.min(se,Ee-2),ue=0,Q=0;Que&&(ue=Ve,te=we)}}}re=te,te=A[re],se+=re-te&32767}if(X){h[k++]=268435456|Rm[j]<<18|zO[X];var je=Rm[j]&31,ot=zO[X]&31;D+=Pc[je]+Bc[ot],++E[257+je],++S[ot],$=L+j,++I}else h[k++]=n[L],++E[n[L]]}}for(L=Math.max(L,$);L=s&&(l[d/8|0]=c,St=s),d=hR(l,d+1,n.subarray(L,St))}a.i=s}return Ug(o,0,r+Bg(d)+i)},A3=function(){for(var n=new Int32Array(256),e=0;e<256;++e){for(var t=e,r=9;--r;)t=(t&1&&-306674912)^t>>>1;n[e]=t}return n}(),R3=function(){var n=-1;return{p:function(e){for(var t=n,r=0;r>>8;n=t},d:function(){return~n}}},I3=function(n,e,t,r,i){if(!i&&(i={l:1},e.dictionary)){var a=e.dictionary.subarray(-32768),s=new lr(a.length+n.length);s.set(a),s.set(n,a.length),n=s,i.w=a.length}return y3(n,e.level==null?6:e.level,e.mem==null?Math.ceil(Math.max(8,Math.min(13,Math.log(n.length)))*1.5):12+e.mem,t,r,i)},wm=function(n,e,t){for(;t;++e)n[e]=t,t>>>=8},N3=function(n,e){var t=e.filename;if(n[0]=31,n[1]=139,n[2]=8,n[8]=e.level<2?4:e.level==9?2:0,n[9]=3,e.mtime!=0&&wm(n,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),t){n[3]=8;for(var r=0;r<=t.length;++r)n[r+10]=t.charCodeAt(r)}},w3=function(n){(n[0]!=31||n[1]!=139||n[2]!=8)&&xr(6,"invalid gzip data");var e=n[3],t=10;e&4&&(t+=(n[10]|n[11]<<8)+2);for(var r=(e>>3&1)+(e>>4&1);r>0;r-=!n[t++]);return t+(e&2)},D3=function(n){var e=n.length;return(n[e-4]|n[e-3]<<8|n[e-2]<<16|n[e-1]<<24)>>>0},x3=function(n){return 10+(n.filename?n.filename.length+1:0)},k3=function(n,e){return((n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&xr(6,"invalid zlib data"),(n[1]>>5&1)==+!e&&xr(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function L3(n,e){return Fg(n,{i:2},e&&e.out,e&&e.dictionary)}function M3(n,e){e||(e={});var t=R3(),r=n.length;t.p(n);var i=I3(n,e,x3(e),8),a=i.length;return N3(i,e),wm(i,a-8,t.d()),wm(i,a-4,r),i}function P3(n,e){var t=w3(n);return t+8>n.length&&xr(6,"invalid gzip data"),Fg(n.subarray(t,-8),{i:2},e&&e.out||new lr(D3(n)),e&&e.dictionary)}function B3(n,e){return Fg(n.subarray(k3(n,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}function U3(n,e){return n[0]==31&&n[1]==139&&n[2]==8?P3(n,e):(n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31?L3(n,e):B3(n,e)}var Dm=typeof TextDecoder<"u"&&new TextDecoder,F3=0;try{Dm.decode(fR,{stream:!0}),F3=1}catch{}var Y3=function(n){for(var e="",t=0;;){var r=n[t++],i=(r>127)+(r>223)+(r>239);if(t+i>n.length)return{s:e,r:Ug(n,t-1)};i?i==3?(r=((r&15)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,e+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?e+=String.fromCharCode((r&31)<<6|n[t++]&63):e+=String.fromCharCode((r&15)<<12|(n[t++]&63)<<6|n[t++]&63):e+=String.fromCharCode(r)}};function G3(n,e){if(e){for(var t="",r=0;r (GFM Style)",type:"boolean"},requireSpaceBeforeHeadingText:{defaultValue:!1,describe:"Makes adding a space between `#` and the header text mandatory (GFM Style)",type:"boolean"},ghMentions:{defaultValue:!1,describe:"Enables github @mentions",type:"boolean"},ghMentionsLink:{defaultValue:"https://github.com/{u}",describe:"Changes the link generated by @mentions. Only applies if ghMentions option is enabled.",type:"string"},encodeEmails:{defaultValue:!0,describe:"Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",type:"boolean"},openLinksInNewWindow:{defaultValue:!1,describe:"Open all links in new windows",type:"boolean"},backslashEscapesHTMLTags:{defaultValue:!1,describe:"Support for HTML Tag escaping. ex:
foo
",type:"boolean"},emoji:{defaultValue:!1,describe:"Enable emoji support. Ex: `this is a :smile: emoji`",type:"boolean"},underline:{defaultValue:!1,describe:"Enable support for underline. Syntax is double or triple underscores: `__underline word__`. With this option enabled, underscores no longer parses into `` and ``",type:"boolean"},ellipsis:{defaultValue:!0,describe:"Replaces three dots with the ellipsis unicode character",type:"boolean"},completeHTMLDocument:{defaultValue:!1,describe:"Outputs a complete html document, including ``, `` and `` tags",type:"boolean"},metadata:{defaultValue:!1,describe:"Enable support for document metadata (defined at the top of the document between `«««` and `»»»` or between `---` and `---`).",type:"boolean"},splitAdjacentBlockquotes:{defaultValue:!1,describe:"Split adjacent blockquote blocks",type:"boolean"}};if(h===!1)return JSON.parse(JSON.stringify(E));var S={};for(var I in E)E.hasOwnProperty(I)&&(S[I]=E[I].defaultValue);return S}function t(){var h=e(!0),E={};for(var S in h)h.hasOwnProperty(S)&&(E[S]=!0);return E}var r={},i={},a={},s=e(!0),o="vanilla",l={github:{omitExtraWLInCodeBlocks:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,disableForced4SpacesIndentedSublists:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghCompatibleHeaderId:!0,ghMentions:!0,backslashEscapesHTMLTags:!0,emoji:!0,splitAdjacentBlockquotes:!0},original:{noHeaderId:!0,ghCodeBlocks:!1},ghost:{omitExtraWLInCodeBlocks:!0,parseImgDimensions:!0,simplifiedAutoLink:!0,excludeTrailingPunctuationFromURLs:!0,literalMidWordUnderscores:!0,strikethrough:!0,tables:!0,tablesHeaderId:!0,ghCodeBlocks:!0,tasklists:!0,smoothLivePreview:!0,simpleLineBreaks:!0,requireSpaceBeforeHeadingText:!0,ghMentions:!1,encodeEmails:!0},vanilla:e(!0),allOn:t()};r.helper={},r.extensions={},r.setOption=function(h,E){return s[h]=E,this},r.getOption=function(h){return s[h]},r.getOptions=function(){return s},r.resetOptions=function(){s=e(!0)},r.setFlavor=function(h){if(!l.hasOwnProperty(h))throw Error(h+" flavor was not found");r.resetOptions();var E=l[h];o=h;for(var S in E)E.hasOwnProperty(S)&&(s[S]=E[S])},r.getFlavor=function(){return o},r.getFlavorOptions=function(h){if(l.hasOwnProperty(h))return l[h]},r.getDefaultOptions=function(h){return e(h)},r.subParser=function(h,E){if(r.helper.isString(h))if(typeof E<"u")i[h]=E;else{if(i.hasOwnProperty(h))return i[h];throw Error("SubParser named "+h+" not registered!")}},r.extension=function(h,E){if(!r.helper.isString(h))throw Error("Extension 'name' must be a string");if(h=r.helper.stdExtName(h),r.helper.isUndefined(E)){if(!a.hasOwnProperty(h))throw Error("Extension named "+h+" is not registered!");return a[h]}else{typeof E=="function"&&(E=E()),r.helper.isArray(E)||(E=[E]);var S=c(E,h);if(S.valid)a[h]=E;else throw Error(S.error)}},r.getAllExtensions=function(){return a},r.removeExtension=function(h){delete a[h]},r.resetExtensions=function(){a={}};function c(h,E){var S=E?"Error in "+E+" extension->":"Error in unnamed extension",I={valid:!0,error:""};r.helper.isArray(h)||(h=[h]);for(var D=0;D"u"},r.helper.forEach=function(h,E){if(r.helper.isUndefined(h))throw new Error("obj param is required");if(r.helper.isUndefined(E))throw new Error("callback param is required");if(!r.helper.isFunction(E))throw new Error("callback param must be a function/closure");if(typeof h.forEach=="function")h.forEach(E);else if(r.helper.isArray(h))for(var S=0;S").replace(/&/g,"&")};var p=function(h,E,S,I){var D=I||"",L=D.indexOf("g")>-1,k=new RegExp(E+"|"+S,"g"+D.replace(/g/g,"")),$=new RegExp(E,D.replace(/g/g,"")),ee=[],ne,re,te,M,Q;do for(ne=0;te=k.exec(h);)if($.test(te[0]))ne++||(re=k.lastIndex,M=re-te[0].length);else if(ne&&!--ne){Q=te.index+te[0].length;var j={left:{start:M,end:re},match:{start:re,end:te.index},right:{start:te.index,end:Q},wholeMatch:{start:M,end:Q}};if(ee.push(j),!L)return ee}while(ne&&(k.lastIndex=re));return ee};r.helper.matchRecursiveRegExp=function(h,E,S,I){for(var D=p(h,E,S,I),L=[],k=0;k0){var ne=[];k[0].wholeMatch.start!==0&&ne.push(h.slice(0,k[0].wholeMatch.start));for(var re=0;re=0?I+(S||0):I},r.helper.splitAtIndex=function(h,E){if(!r.helper.isString(h))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";return[h.substring(0,E),h.substring(E)]},r.helper.encodeEmailAddress=function(h){var E=[function(S){return"&#"+S.charCodeAt(0)+";"},function(S){return"&#x"+S.charCodeAt(0).toString(16)+";"},function(S){return S}];return h=h.replace(/./g,function(S){if(S==="@")S=E[Math.floor(Math.random()*2)](S);else{var I=Math.random();S=I>.9?E[2](S):I>.45?E[1](S):E[0](S)}return S}),h},r.helper.padEnd=function(E,S,I){return S=S>>0,I=String(I||" "),E.length>S?String(E):(S=S-E.length,S>I.length&&(I+=I.repeat(S/I.length)),String(E)+I.slice(0,S))},typeof console>"u"&&(console={warn:function(h){alert(h)},log:function(h){alert(h)},error:function(h){throw h}}),r.helper.regexes={asteriskDashAndColon:/([*_:~])/g},r.helper.emojis={"+1":"👍","-1":"👎",100:"💯",1234:"🔢","1st_place_medal":"🥇","2nd_place_medal":"🥈","3rd_place_medal":"🥉","8ball":"🎱",a:"🅰️",ab:"🆎",abc:"🔤",abcd:"🔡",accept:"🉑",aerial_tramway:"🚡",airplane:"✈️",alarm_clock:"⏰",alembic:"⚗️",alien:"👽",ambulance:"🚑",amphora:"🏺",anchor:"⚓️",angel:"👼",anger:"💢",angry:"😠",anguished:"😧",ant:"🐜",apple:"🍎",aquarius:"♒️",aries:"♈️",arrow_backward:"◀️",arrow_double_down:"⏬",arrow_double_up:"⏫",arrow_down:"⬇️",arrow_down_small:"🔽",arrow_forward:"▶️",arrow_heading_down:"⤵️",arrow_heading_up:"⤴️",arrow_left:"⬅️",arrow_lower_left:"↙️",arrow_lower_right:"↘️",arrow_right:"➡️",arrow_right_hook:"↪️",arrow_up:"⬆️",arrow_up_down:"↕️",arrow_up_small:"🔼",arrow_upper_left:"↖️",arrow_upper_right:"↗️",arrows_clockwise:"🔃",arrows_counterclockwise:"🔄",art:"🎨",articulated_lorry:"🚛",artificial_satellite:"🛰",astonished:"😲",athletic_shoe:"👟",atm:"🏧",atom_symbol:"⚛️",avocado:"🥑",b:"🅱️",baby:"👶",baby_bottle:"🍼",baby_chick:"🐤",baby_symbol:"🚼",back:"🔙",bacon:"🥓",badminton:"🏸",baggage_claim:"🛄",baguette_bread:"🥖",balance_scale:"⚖️",balloon:"🎈",ballot_box:"🗳",ballot_box_with_check:"☑️",bamboo:"🎍",banana:"🍌",bangbang:"‼️",bank:"🏦",bar_chart:"📊",barber:"💈",baseball:"⚾️",basketball:"🏀",basketball_man:"⛹️",basketball_woman:"⛹️‍♀️",bat:"🦇",bath:"🛀",bathtub:"🛁",battery:"🔋",beach_umbrella:"🏖",bear:"🐻",bed:"🛏",bee:"🐝",beer:"🍺",beers:"🍻",beetle:"🐞",beginner:"🔰",bell:"🔔",bellhop_bell:"🛎",bento:"🍱",biking_man:"🚴",bike:"🚲",biking_woman:"🚴‍♀️",bikini:"👙",biohazard:"☣️",bird:"🐦",birthday:"🎂",black_circle:"⚫️",black_flag:"🏴",black_heart:"🖤",black_joker:"🃏",black_large_square:"⬛️",black_medium_small_square:"◾️",black_medium_square:"◼️",black_nib:"✒️",black_small_square:"▪️",black_square_button:"🔲",blonde_man:"👱",blonde_woman:"👱‍♀️",blossom:"🌼",blowfish:"🐡",blue_book:"📘",blue_car:"🚙",blue_heart:"💙",blush:"😊",boar:"🐗",boat:"⛵️",bomb:"💣",book:"📖",bookmark:"🔖",bookmark_tabs:"📑",books:"📚",boom:"💥",boot:"👢",bouquet:"💐",bowing_man:"🙇",bow_and_arrow:"🏹",bowing_woman:"🙇‍♀️",bowling:"🎳",boxing_glove:"🥊",boy:"👦",bread:"🍞",bride_with_veil:"👰",bridge_at_night:"🌉",briefcase:"💼",broken_heart:"💔",bug:"🐛",building_construction:"🏗",bulb:"💡",bullettrain_front:"🚅",bullettrain_side:"🚄",burrito:"🌯",bus:"🚌",business_suit_levitating:"🕴",busstop:"🚏",bust_in_silhouette:"👤",busts_in_silhouette:"👥",butterfly:"🦋",cactus:"🌵",cake:"🍰",calendar:"📆",call_me_hand:"🤙",calling:"📲",camel:"🐫",camera:"📷",camera_flash:"📸",camping:"🏕",cancer:"♋️",candle:"🕯",candy:"🍬",canoe:"🛶",capital_abcd:"🔠",capricorn:"♑️",car:"🚗",card_file_box:"🗃",card_index:"📇",card_index_dividers:"🗂",carousel_horse:"🎠",carrot:"🥕",cat:"🐱",cat2:"🐈",cd:"💿",chains:"⛓",champagne:"🍾",chart:"💹",chart_with_downwards_trend:"📉",chart_with_upwards_trend:"📈",checkered_flag:"🏁",cheese:"🧀",cherries:"🍒",cherry_blossom:"🌸",chestnut:"🌰",chicken:"🐔",children_crossing:"🚸",chipmunk:"🐿",chocolate_bar:"🍫",christmas_tree:"🎄",church:"⛪️",cinema:"🎦",circus_tent:"🎪",city_sunrise:"🌇",city_sunset:"🌆",cityscape:"🏙",cl:"🆑",clamp:"🗜",clap:"👏",clapper:"🎬",classical_building:"🏛",clinking_glasses:"🥂",clipboard:"📋",clock1:"🕐",clock10:"🕙",clock1030:"🕥",clock11:"🕚",clock1130:"🕦",clock12:"🕛",clock1230:"🕧",clock130:"🕜",clock2:"🕑",clock230:"🕝",clock3:"🕒",clock330:"🕞",clock4:"🕓",clock430:"🕟",clock5:"🕔",clock530:"🕠",clock6:"🕕",clock630:"🕡",clock7:"🕖",clock730:"🕢",clock8:"🕗",clock830:"🕣",clock9:"🕘",clock930:"🕤",closed_book:"📕",closed_lock_with_key:"🔐",closed_umbrella:"🌂",cloud:"☁️",cloud_with_lightning:"🌩",cloud_with_lightning_and_rain:"⛈",cloud_with_rain:"🌧",cloud_with_snow:"🌨",clown_face:"🤡",clubs:"♣️",cocktail:"🍸",coffee:"☕️",coffin:"⚰️",cold_sweat:"😰",comet:"☄️",computer:"💻",computer_mouse:"🖱",confetti_ball:"🎊",confounded:"😖",confused:"😕",congratulations:"㊗️",construction:"🚧",construction_worker_man:"👷",construction_worker_woman:"👷‍♀️",control_knobs:"🎛",convenience_store:"🏪",cookie:"🍪",cool:"🆒",policeman:"👮",copyright:"©️",corn:"🌽",couch_and_lamp:"🛋",couple:"👫",couple_with_heart_woman_man:"💑",couple_with_heart_man_man:"👨‍❤️‍👨",couple_with_heart_woman_woman:"👩‍❤️‍👩",couplekiss_man_man:"👨‍❤️‍💋‍👨",couplekiss_man_woman:"💏",couplekiss_woman_woman:"👩‍❤️‍💋‍👩",cow:"🐮",cow2:"🐄",cowboy_hat_face:"🤠",crab:"🦀",crayon:"🖍",credit_card:"💳",crescent_moon:"🌙",cricket:"🏏",crocodile:"🐊",croissant:"🥐",crossed_fingers:"🤞",crossed_flags:"🎌",crossed_swords:"⚔️",crown:"👑",cry:"😢",crying_cat_face:"😿",crystal_ball:"🔮",cucumber:"🥒",cupid:"💘",curly_loop:"➰",currency_exchange:"💱",curry:"🍛",custard:"🍮",customs:"🛃",cyclone:"🌀",dagger:"🗡",dancer:"💃",dancing_women:"👯",dancing_men:"👯‍♂️",dango:"🍡",dark_sunglasses:"🕶",dart:"🎯",dash:"💨",date:"📅",deciduous_tree:"🌳",deer:"🦌",department_store:"🏬",derelict_house:"🏚",desert:"🏜",desert_island:"🏝",desktop_computer:"🖥",male_detective:"🕵️",diamond_shape_with_a_dot_inside:"💠",diamonds:"♦️",disappointed:"😞",disappointed_relieved:"😥",dizzy:"💫",dizzy_face:"😵",do_not_litter:"🚯",dog:"🐶",dog2:"🐕",dollar:"💵",dolls:"🎎",dolphin:"🐬",door:"🚪",doughnut:"🍩",dove:"🕊",dragon:"🐉",dragon_face:"🐲",dress:"👗",dromedary_camel:"🐪",drooling_face:"🤤",droplet:"💧",drum:"🥁",duck:"🦆",dvd:"📀","e-mail":"📧",eagle:"🦅",ear:"👂",ear_of_rice:"🌾",earth_africa:"🌍",earth_americas:"🌎",earth_asia:"🌏",egg:"🥚",eggplant:"🍆",eight_pointed_black_star:"✴️",eight_spoked_asterisk:"✳️",electric_plug:"🔌",elephant:"🐘",email:"✉️",end:"🔚",envelope_with_arrow:"📩",euro:"💶",european_castle:"🏰",european_post_office:"🏤",evergreen_tree:"🌲",exclamation:"❗️",expressionless:"😑",eye:"👁",eye_speech_bubble:"👁‍🗨",eyeglasses:"👓",eyes:"👀",face_with_head_bandage:"🤕",face_with_thermometer:"🤒",fist_oncoming:"👊",factory:"🏭",fallen_leaf:"🍂",family_man_woman_boy:"👪",family_man_boy:"👨‍👦",family_man_boy_boy:"👨‍👦‍👦",family_man_girl:"👨‍👧",family_man_girl_boy:"👨‍👧‍👦",family_man_girl_girl:"👨‍👧‍👧",family_man_man_boy:"👨‍👨‍👦",family_man_man_boy_boy:"👨‍👨‍👦‍👦",family_man_man_girl:"👨‍👨‍👧",family_man_man_girl_boy:"👨‍👨‍👧‍👦",family_man_man_girl_girl:"👨‍👨‍👧‍👧",family_man_woman_boy_boy:"👨‍👩‍👦‍👦",family_man_woman_girl:"👨‍👩‍👧",family_man_woman_girl_boy:"👨‍👩‍👧‍👦",family_man_woman_girl_girl:"👨‍👩‍👧‍👧",family_woman_boy:"👩‍👦",family_woman_boy_boy:"👩‍👦‍👦",family_woman_girl:"👩‍👧",family_woman_girl_boy:"👩‍👧‍👦",family_woman_girl_girl:"👩‍👧‍👧",family_woman_woman_boy:"👩‍👩‍👦",family_woman_woman_boy_boy:"👩‍👩‍👦‍👦",family_woman_woman_girl:"👩‍👩‍👧",family_woman_woman_girl_boy:"👩‍👩‍👧‍👦",family_woman_woman_girl_girl:"👩‍👩‍👧‍👧",fast_forward:"⏩",fax:"📠",fearful:"😨",feet:"🐾",female_detective:"🕵️‍♀️",ferris_wheel:"🎡",ferry:"⛴",field_hockey:"🏑",file_cabinet:"🗄",file_folder:"📁",film_projector:"📽",film_strip:"🎞",fire:"🔥",fire_engine:"🚒",fireworks:"🎆",first_quarter_moon:"🌓",first_quarter_moon_with_face:"🌛",fish:"🐟",fish_cake:"🍥",fishing_pole_and_fish:"🎣",fist_raised:"✊",fist_left:"🤛",fist_right:"🤜",flags:"🎏",flashlight:"🔦",fleur_de_lis:"⚜️",flight_arrival:"🛬",flight_departure:"🛫",floppy_disk:"💾",flower_playing_cards:"🎴",flushed:"😳",fog:"🌫",foggy:"🌁",football:"🏈",footprints:"👣",fork_and_knife:"🍴",fountain:"⛲️",fountain_pen:"🖋",four_leaf_clover:"🍀",fox_face:"🦊",framed_picture:"🖼",free:"🆓",fried_egg:"🍳",fried_shrimp:"🍤",fries:"🍟",frog:"🐸",frowning:"😦",frowning_face:"☹️",frowning_man:"🙍‍♂️",frowning_woman:"🙍",middle_finger:"🖕",fuelpump:"⛽️",full_moon:"🌕",full_moon_with_face:"🌝",funeral_urn:"⚱️",game_die:"🎲",gear:"⚙️",gem:"💎",gemini:"♊️",ghost:"👻",gift:"🎁",gift_heart:"💝",girl:"👧",globe_with_meridians:"🌐",goal_net:"🥅",goat:"🐐",golf:"⛳️",golfing_man:"🏌️",golfing_woman:"🏌️‍♀️",gorilla:"🦍",grapes:"🍇",green_apple:"🍏",green_book:"📗",green_heart:"💚",green_salad:"🥗",grey_exclamation:"❕",grey_question:"❔",grimacing:"😬",grin:"😁",grinning:"😀",guardsman:"💂",guardswoman:"💂‍♀️",guitar:"🎸",gun:"🔫",haircut_woman:"💇",haircut_man:"💇‍♂️",hamburger:"🍔",hammer:"🔨",hammer_and_pick:"⚒",hammer_and_wrench:"🛠",hamster:"🐹",hand:"✋",handbag:"👜",handshake:"🤝",hankey:"💩",hatched_chick:"🐥",hatching_chick:"🐣",headphones:"🎧",hear_no_evil:"🙉",heart:"❤️",heart_decoration:"💟",heart_eyes:"😍",heart_eyes_cat:"😻",heartbeat:"💓",heartpulse:"💗",hearts:"♥️",heavy_check_mark:"✔️",heavy_division_sign:"➗",heavy_dollar_sign:"💲",heavy_heart_exclamation:"❣️",heavy_minus_sign:"➖",heavy_multiplication_x:"✖️",heavy_plus_sign:"➕",helicopter:"🚁",herb:"🌿",hibiscus:"🌺",high_brightness:"🔆",high_heel:"👠",hocho:"🔪",hole:"🕳",honey_pot:"🍯",horse:"🐴",horse_racing:"🏇",hospital:"🏥",hot_pepper:"🌶",hotdog:"🌭",hotel:"🏨",hotsprings:"♨️",hourglass:"⌛️",hourglass_flowing_sand:"⏳",house:"🏠",house_with_garden:"🏡",houses:"🏘",hugs:"🤗",hushed:"😯",ice_cream:"🍨",ice_hockey:"🏒",ice_skate:"⛸",icecream:"🍦",id:"🆔",ideograph_advantage:"🉐",imp:"👿",inbox_tray:"📥",incoming_envelope:"📨",tipping_hand_woman:"💁",information_source:"ℹ️",innocent:"😇",interrobang:"⁉️",iphone:"📱",izakaya_lantern:"🏮",jack_o_lantern:"🎃",japan:"🗾",japanese_castle:"🏯",japanese_goblin:"👺",japanese_ogre:"👹",jeans:"👖",joy:"😂",joy_cat:"😹",joystick:"🕹",kaaba:"🕋",key:"🔑",keyboard:"⌨️",keycap_ten:"🔟",kick_scooter:"🛴",kimono:"👘",kiss:"💋",kissing:"😗",kissing_cat:"😽",kissing_closed_eyes:"😚",kissing_heart:"😘",kissing_smiling_eyes:"😙",kiwi_fruit:"🥝",koala:"🐨",koko:"🈁",label:"🏷",large_blue_circle:"🔵",large_blue_diamond:"🔷",large_orange_diamond:"🔶",last_quarter_moon:"🌗",last_quarter_moon_with_face:"🌜",latin_cross:"✝️",laughing:"😆",leaves:"🍃",ledger:"📒",left_luggage:"🛅",left_right_arrow:"↔️",leftwards_arrow_with_hook:"↩️",lemon:"🍋",leo:"♌️",leopard:"🐆",level_slider:"🎚",libra:"♎️",light_rail:"🚈",link:"🔗",lion:"🦁",lips:"👄",lipstick:"💄",lizard:"🦎",lock:"🔒",lock_with_ink_pen:"🔏",lollipop:"🍭",loop:"➿",loud_sound:"🔊",loudspeaker:"📢",love_hotel:"🏩",love_letter:"💌",low_brightness:"🔅",lying_face:"🤥",m:"Ⓜ️",mag:"🔍",mag_right:"🔎",mahjong:"🀄️",mailbox:"📫",mailbox_closed:"📪",mailbox_with_mail:"📬",mailbox_with_no_mail:"📭",man:"👨",man_artist:"👨‍🎨",man_astronaut:"👨‍🚀",man_cartwheeling:"🤸‍♂️",man_cook:"👨‍🍳",man_dancing:"🕺",man_facepalming:"🤦‍♂️",man_factory_worker:"👨‍🏭",man_farmer:"👨‍🌾",man_firefighter:"👨‍🚒",man_health_worker:"👨‍⚕️",man_in_tuxedo:"🤵",man_judge:"👨‍⚖️",man_juggling:"🤹‍♂️",man_mechanic:"👨‍🔧",man_office_worker:"👨‍💼",man_pilot:"👨‍✈️",man_playing_handball:"🤾‍♂️",man_playing_water_polo:"🤽‍♂️",man_scientist:"👨‍🔬",man_shrugging:"🤷‍♂️",man_singer:"👨‍🎤",man_student:"👨‍🎓",man_teacher:"👨‍🏫",man_technologist:"👨‍💻",man_with_gua_pi_mao:"👲",man_with_turban:"👳",tangerine:"🍊",mans_shoe:"👞",mantelpiece_clock:"🕰",maple_leaf:"🍁",martial_arts_uniform:"🥋",mask:"😷",massage_woman:"💆",massage_man:"💆‍♂️",meat_on_bone:"🍖",medal_military:"🎖",medal_sports:"🏅",mega:"📣",melon:"🍈",memo:"📝",men_wrestling:"🤼‍♂️",menorah:"🕎",mens:"🚹",metal:"🤘",metro:"🚇",microphone:"🎤",microscope:"🔬",milk_glass:"🥛",milky_way:"🌌",minibus:"🚐",minidisc:"💽",mobile_phone_off:"📴",money_mouth_face:"🤑",money_with_wings:"💸",moneybag:"💰",monkey:"🐒",monkey_face:"🐵",monorail:"🚝",moon:"🌔",mortar_board:"🎓",mosque:"🕌",motor_boat:"🛥",motor_scooter:"🛵",motorcycle:"🏍",motorway:"🛣",mount_fuji:"🗻",mountain:"⛰",mountain_biking_man:"🚵",mountain_biking_woman:"🚵‍♀️",mountain_cableway:"🚠",mountain_railway:"🚞",mountain_snow:"🏔",mouse:"🐭",mouse2:"🐁",movie_camera:"🎥",moyai:"🗿",mrs_claus:"🤶",muscle:"💪",mushroom:"🍄",musical_keyboard:"🎹",musical_note:"🎵",musical_score:"🎼",mute:"🔇",nail_care:"💅",name_badge:"📛",national_park:"🏞",nauseated_face:"🤢",necktie:"👔",negative_squared_cross_mark:"❎",nerd_face:"🤓",neutral_face:"😐",new:"🆕",new_moon:"🌑",new_moon_with_face:"🌚",newspaper:"📰",newspaper_roll:"🗞",next_track_button:"⏭",ng:"🆖",no_good_man:"🙅‍♂️",no_good_woman:"🙅",night_with_stars:"🌃",no_bell:"🔕",no_bicycles:"🚳",no_entry:"⛔️",no_entry_sign:"🚫",no_mobile_phones:"📵",no_mouth:"😶",no_pedestrians:"🚷",no_smoking:"🚭","non-potable_water":"🚱",nose:"👃",notebook:"📓",notebook_with_decorative_cover:"📔",notes:"🎶",nut_and_bolt:"🔩",o:"⭕️",o2:"🅾️",ocean:"🌊",octopus:"🐙",oden:"🍢",office:"🏢",oil_drum:"🛢",ok:"🆗",ok_hand:"👌",ok_man:"🙆‍♂️",ok_woman:"🙆",old_key:"🗝",older_man:"👴",older_woman:"👵",om:"🕉",on:"🔛",oncoming_automobile:"🚘",oncoming_bus:"🚍",oncoming_police_car:"🚔",oncoming_taxi:"🚖",open_file_folder:"📂",open_hands:"👐",open_mouth:"😮",open_umbrella:"☂️",ophiuchus:"⛎",orange_book:"📙",orthodox_cross:"☦️",outbox_tray:"📤",owl:"🦉",ox:"🐂",package:"📦",page_facing_up:"📄",page_with_curl:"📃",pager:"📟",paintbrush:"🖌",palm_tree:"🌴",pancakes:"🥞",panda_face:"🐼",paperclip:"📎",paperclips:"🖇",parasol_on_ground:"⛱",parking:"🅿️",part_alternation_mark:"〽️",partly_sunny:"⛅️",passenger_ship:"🛳",passport_control:"🛂",pause_button:"⏸",peace_symbol:"☮️",peach:"🍑",peanuts:"🥜",pear:"🍐",pen:"🖊",pencil2:"✏️",penguin:"🐧",pensive:"😔",performing_arts:"🎭",persevere:"😣",person_fencing:"🤺",pouting_woman:"🙎",phone:"☎️",pick:"⛏",pig:"🐷",pig2:"🐖",pig_nose:"🐽",pill:"💊",pineapple:"🍍",ping_pong:"🏓",pisces:"♓️",pizza:"🍕",place_of_worship:"🛐",plate_with_cutlery:"🍽",play_or_pause_button:"⏯",point_down:"👇",point_left:"👈",point_right:"👉",point_up:"☝️",point_up_2:"👆",police_car:"🚓",policewoman:"👮‍♀️",poodle:"🐩",popcorn:"🍿",post_office:"🏣",postal_horn:"📯",postbox:"📮",potable_water:"🚰",potato:"🥔",pouch:"👝",poultry_leg:"🍗",pound:"💷",rage:"😡",pouting_cat:"😾",pouting_man:"🙎‍♂️",pray:"🙏",prayer_beads:"📿",pregnant_woman:"🤰",previous_track_button:"⏮",prince:"🤴",princess:"👸",printer:"🖨",purple_heart:"💜",purse:"👛",pushpin:"📌",put_litter_in_its_place:"🚮",question:"❓",rabbit:"🐰",rabbit2:"🐇",racehorse:"🐎",racing_car:"🏎",radio:"📻",radio_button:"🔘",radioactive:"☢️",railway_car:"🚃",railway_track:"🛤",rainbow:"🌈",rainbow_flag:"🏳️‍🌈",raised_back_of_hand:"🤚",raised_hand_with_fingers_splayed:"🖐",raised_hands:"🙌",raising_hand_woman:"🙋",raising_hand_man:"🙋‍♂️",ram:"🐏",ramen:"🍜",rat:"🐀",record_button:"⏺",recycle:"♻️",red_circle:"🔴",registered:"®️",relaxed:"☺️",relieved:"😌",reminder_ribbon:"🎗",repeat:"🔁",repeat_one:"🔂",rescue_worker_helmet:"⛑",restroom:"🚻",revolving_hearts:"💞",rewind:"⏪",rhinoceros:"🦏",ribbon:"🎀",rice:"🍚",rice_ball:"🍙",rice_cracker:"🍘",rice_scene:"🎑",right_anger_bubble:"🗯",ring:"💍",robot:"🤖",rocket:"🚀",rofl:"🤣",roll_eyes:"🙄",roller_coaster:"🎢",rooster:"🐓",rose:"🌹",rosette:"🏵",rotating_light:"🚨",round_pushpin:"📍",rowing_man:"🚣",rowing_woman:"🚣‍♀️",rugby_football:"🏉",running_man:"🏃",running_shirt_with_sash:"🎽",running_woman:"🏃‍♀️",sa:"🈂️",sagittarius:"♐️",sake:"🍶",sandal:"👡",santa:"🎅",satellite:"📡",saxophone:"🎷",school:"🏫",school_satchel:"🎒",scissors:"✂️",scorpion:"🦂",scorpius:"♏️",scream:"😱",scream_cat:"🙀",scroll:"📜",seat:"💺",secret:"㊙️",see_no_evil:"🙈",seedling:"🌱",selfie:"🤳",shallow_pan_of_food:"🥘",shamrock:"☘️",shark:"🦈",shaved_ice:"🍧",sheep:"🐑",shell:"🐚",shield:"🛡",shinto_shrine:"⛩",ship:"🚢",shirt:"👕",shopping:"🛍",shopping_cart:"🛒",shower:"🚿",shrimp:"🦐",signal_strength:"📶",six_pointed_star:"🔯",ski:"🎿",skier:"⛷",skull:"💀",skull_and_crossbones:"☠️",sleeping:"😴",sleeping_bed:"🛌",sleepy:"😪",slightly_frowning_face:"🙁",slightly_smiling_face:"🙂",slot_machine:"🎰",small_airplane:"🛩",small_blue_diamond:"🔹",small_orange_diamond:"🔸",small_red_triangle:"🔺",small_red_triangle_down:"🔻",smile:"😄",smile_cat:"😸",smiley:"😃",smiley_cat:"😺",smiling_imp:"😈",smirk:"😏",smirk_cat:"😼",smoking:"🚬",snail:"🐌",snake:"🐍",sneezing_face:"🤧",snowboarder:"🏂",snowflake:"❄️",snowman:"⛄️",snowman_with_snow:"☃️",sob:"😭",soccer:"⚽️",soon:"🔜",sos:"🆘",sound:"🔉",space_invader:"👾",spades:"♠️",spaghetti:"🍝",sparkle:"❇️",sparkler:"🎇",sparkles:"✨",sparkling_heart:"💖",speak_no_evil:"🙊",speaker:"🔈",speaking_head:"🗣",speech_balloon:"💬",speedboat:"🚤",spider:"🕷",spider_web:"🕸",spiral_calendar:"🗓",spiral_notepad:"🗒",spoon:"🥄",squid:"🦑",stadium:"🏟",star:"⭐️",star2:"🌟",star_and_crescent:"☪️",star_of_david:"✡️",stars:"🌠",station:"🚉",statue_of_liberty:"🗽",steam_locomotive:"🚂",stew:"🍲",stop_button:"⏹",stop_sign:"🛑",stopwatch:"⏱",straight_ruler:"📏",strawberry:"🍓",stuck_out_tongue:"😛",stuck_out_tongue_closed_eyes:"😝",stuck_out_tongue_winking_eye:"😜",studio_microphone:"🎙",stuffed_flatbread:"🥙",sun_behind_large_cloud:"🌥",sun_behind_rain_cloud:"🌦",sun_behind_small_cloud:"🌤",sun_with_face:"🌞",sunflower:"🌻",sunglasses:"😎",sunny:"☀️",sunrise:"🌅",sunrise_over_mountains:"🌄",surfing_man:"🏄",surfing_woman:"🏄‍♀️",sushi:"🍣",suspension_railway:"🚟",sweat:"😓",sweat_drops:"💦",sweat_smile:"😅",sweet_potato:"🍠",swimming_man:"🏊",swimming_woman:"🏊‍♀️",symbols:"🔣",synagogue:"🕍",syringe:"💉",taco:"🌮",tada:"🎉",tanabata_tree:"🎋",taurus:"♉️",taxi:"🚕",tea:"🍵",telephone_receiver:"📞",telescope:"🔭",tennis:"🎾",tent:"⛺️",thermometer:"🌡",thinking:"🤔",thought_balloon:"💭",ticket:"🎫",tickets:"🎟",tiger:"🐯",tiger2:"🐅",timer_clock:"⏲",tipping_hand_man:"💁‍♂️",tired_face:"😫",tm:"™️",toilet:"🚽",tokyo_tower:"🗼",tomato:"🍅",tongue:"👅",top:"🔝",tophat:"🎩",tornado:"🌪",trackball:"🖲",tractor:"🚜",traffic_light:"🚥",train:"🚋",train2:"🚆",tram:"🚊",triangular_flag_on_post:"🚩",triangular_ruler:"📐",trident:"🔱",triumph:"😤",trolleybus:"🚎",trophy:"🏆",tropical_drink:"🍹",tropical_fish:"🐠",truck:"🚚",trumpet:"🎺",tulip:"🌷",tumbler_glass:"🥃",turkey:"🦃",turtle:"🐢",tv:"📺",twisted_rightwards_arrows:"🔀",two_hearts:"💕",two_men_holding_hands:"👬",two_women_holding_hands:"👭",u5272:"🈹",u5408:"🈴",u55b6:"🈺",u6307:"🈯️",u6708:"🈷️",u6709:"🈶",u6e80:"🈵",u7121:"🈚️",u7533:"🈸",u7981:"🈲",u7a7a:"🈳",umbrella:"☔️",unamused:"😒",underage:"🔞",unicorn:"🦄",unlock:"🔓",up:"🆙",upside_down_face:"🙃",v:"✌️",vertical_traffic_light:"🚦",vhs:"📼",vibration_mode:"📳",video_camera:"📹",video_game:"🎮",violin:"🎻",virgo:"♍️",volcano:"🌋",volleyball:"🏐",vs:"🆚",vulcan_salute:"🖖",walking_man:"🚶",walking_woman:"🚶‍♀️",waning_crescent_moon:"🌘",waning_gibbous_moon:"🌖",warning:"⚠️",wastebasket:"🗑",watch:"⌚️",water_buffalo:"🐃",watermelon:"🍉",wave:"👋",wavy_dash:"〰️",waxing_crescent_moon:"🌒",wc:"🚾",weary:"😩",wedding:"💒",weight_lifting_man:"🏋️",weight_lifting_woman:"🏋️‍♀️",whale:"🐳",whale2:"🐋",wheel_of_dharma:"☸️",wheelchair:"♿️",white_check_mark:"✅",white_circle:"⚪️",white_flag:"🏳️",white_flower:"💮",white_large_square:"⬜️",white_medium_small_square:"◽️",white_medium_square:"◻️",white_small_square:"▫️",white_square_button:"🔳",wilted_flower:"🥀",wind_chime:"🎐",wind_face:"🌬",wine_glass:"🍷",wink:"😉",wolf:"🐺",woman:"👩",woman_artist:"👩‍🎨",woman_astronaut:"👩‍🚀",woman_cartwheeling:"🤸‍♀️",woman_cook:"👩‍🍳",woman_facepalming:"🤦‍♀️",woman_factory_worker:"👩‍🏭",woman_farmer:"👩‍🌾",woman_firefighter:"👩‍🚒",woman_health_worker:"👩‍⚕️",woman_judge:"👩‍⚖️",woman_juggling:"🤹‍♀️",woman_mechanic:"👩‍🔧",woman_office_worker:"👩‍💼",woman_pilot:"👩‍✈️",woman_playing_handball:"🤾‍♀️",woman_playing_water_polo:"🤽‍♀️",woman_scientist:"👩‍🔬",woman_shrugging:"🤷‍♀️",woman_singer:"👩‍🎤",woman_student:"👩‍🎓",woman_teacher:"👩‍🏫",woman_technologist:"👩‍💻",woman_with_turban:"👳‍♀️",womans_clothes:"👚",womans_hat:"👒",women_wrestling:"🤼‍♀️",womens:"🚺",world_map:"🗺",worried:"😟",wrench:"🔧",writing_hand:"✍️",x:"❌",yellow_heart:"💛",yen:"💴",yin_yang:"☯️",yum:"😋",zap:"⚡️",zipper_mouth_face:"🤐",zzz:"💤",octocat:':octocat:',showdown:`S`},r.Converter=function(h){var E={},S=[],I=[],D={},L=o,k={parsed:{},raw:"",format:""};$();function $(){h=h||{};for(var M in s)s.hasOwnProperty(M)&&(E[M]=s[M]);if(typeof h=="object")for(var Q in h)h.hasOwnProperty(Q)&&(E[Q]=h[Q]);else throw Error("Converter expects the passed parameter to be an object, but "+typeof h+" was passed instead.");E.extensions&&r.helper.forEach(E.extensions,ee)}function ee(M,Q){if(Q=Q||null,r.helper.isString(M))if(M=r.helper.stdExtName(M),Q=M,r.extensions[M]){console.warn("DEPRECATION WARNING: "+M+" is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"),ne(r.extensions[M],M);return}else if(!r.helper.isUndefined(a[M]))M=a[M];else throw Error('Extension "'+M+'" could not be loaded. It was either not found or is not a valid extension.');typeof M=="function"&&(M=M()),r.helper.isArray(M)||(M=[M]);var j=c(M,Q);if(!j.valid)throw Error(j.error);for(var X=0;X - +