diff --git a/assets/index-1af95af6.js b/assets/index-d735c372.js similarity index 94% rename from assets/index-1af95af6.js rename to assets/index-d735c372.js index ea52872..7499cf9 100644 --- a/assets/index-1af95af6.js +++ b/assets/index-d735c372.js @@ -1378,7 +1378,7 @@ Ziffers provides shorthands for **many** numeric and algorithimic operations suc * **List operations:** Cartesian operation (_e.g._ (3 2 1)+(2 5)) using the + operator. All the arithmetic operators are supported. -${e("Cartesian operation for melodic generation",` +${e("Element-wise operations for melodic generation",` z1("q 0 s (3 2 1)+(2 5) q 0 s (4 5 6)-(2 3)").sound('sine') .scale('minor').fmi(2).fmh(2).room(0.5).size(0.5).sustain(0.1) .delay(0.5).delay(0.125).delayfb(0.25).out(); @@ -1465,7 +1465,26 @@ mod(1, 1.75) :: snd(['kick', 'hat'].div(1)).out() ## Synchronization -Ziffers numbered methods **(z0-z16)** can be used to parse and play patterns. Each method is individually cached and can be used to play multiple patterns simultaneously. They can be synchronized together by using a **cue** system. By default, each Ziffers expression will have a different duration. This system is thus necessary to make everything fit together in a loop-based environment like Topos. +Ziffers numbered methods **(z0-z16)** can be used to parse and play patterns. Each method is individually cached and can be used to play multiple patterns simultaneously. By default, each Ziffers expression can have a different duration. This system is thus necessary to make everything fit together in a loop-based environment like Topos. + +Numbered methods are synced automatically to **z0** method if it exsists. Syncing can also be done manually by using either the wait method, which will always wait for the current pattern to finish before starting the next cycle, or the sync method will only wait for the synced pattern to finish on the first time. + +${e("Automatic sync to z0",` +z0('w 0 8').sound('peri').gain(3.0).out() +z1('e 0 4 5 9').sound('bell').gain(6.0).out() +`,!0)} + +${e("Sync with wait",` +z1('w 0 5').sound('pluck').release(0.1).sustain(0.25).out() +z2('q 6 3').wait(z1).sound('sine').release(0.16).sustain(0.55).out() +`,!0)} + +${e("Sync on first run",` + z1('w __ 0 5 9 3').sound('bin').out() + z2('q __ 4 2 e 6 3 q 6').sync(z1).sound('east').out() +`,!0)} + + ## Examples @@ -1775,7 +1794,7 @@ ${e("Live coded poetry with array and string chaining",` `+c.line+" | "+_+` `+m+" | "+t("",l.column-1," ")+t("",y,"^")}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(y){return Array.isArray(y)?c(y[0])+"-"+c(y[1]):c(y)});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),y,R;if(b.sort(),b.length>0){for(y=1,R=1;y>",x="<<",D="<",U=">",ee="_",ie="?",ne=":",re="r",L="#",F="b",K=/^[0-9]/,X=/^[ \n\r\t]/,le=/^[mklpdcwyhnqaefsxtgujzo]/,ae=Se("-",!1),ge=gt([["0","9"]],!1,!1),Ne=Se(".",!1),we=Gr("whitespace"),be=gt([" ",` -`,"\r"," "],!1,!1),Ae=Se(",",!1),ce=Se("|",!1),De=gt(["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=Se("(",!1),Fe=Se(")",!1),Je=Se("{",!1),nt=Se("}",!1),mt=Se("+",!1),Rt=Se("*",!1),pt=Se("/",!1),It=Se("%",!1),Nt=Se("^",!1),Fr=Se("&",!1),$e=Se(">>",!1),Lr=Se("<<",!1),at=Se("<",!1),ze=Se(">",!1),br=Se("_",!1),rr=Se("?",!1),mr=Se(":",!1),z=Se("r",!1),me=Se("#",!1),Re=Se("b",!1),Ie=function(k){return k.filter(q=>q)},je=function(){return parseFloat(Oe())},ve=function(){return parseInt(Oe())},Yt=function(){},ot=function(){return LM[Oe()]},Tt=function(k){return k.filter(q=>q)},en=function(k){return qt(TO,{items:k})},lt=function(k,q,j){return qt(JM,{left:k,operation:q,right:j})},zt=function(){return parseInt(Oe())},bt=function(k){return k.map(q=>typeof q=="number"?q:void 0)},Me=function(){return Math.ceil(TA(Oe()))},kr=function(k){var q=k.filter(j=>j).map(j=>qt(Bi,{pitch:j[0]},j.toString()));return qt(TO,{items:q})},Zn=function(k){return k},st=function(){},Yr=function(k){return qt(cg,{items:k})},Tr=function(k){return qt(ZM,{octave:k})},Yi=function(){return Oe().split("").reduce((k,q)=>k+(q==="^"?1:-1),0)},xn=function(){return qt(bO,{seededRandom:a.seededRandom})},Gt=function(k,q){return qt(bO,{min:k,max:q,seededRandom:a.seededRandom})},mn=function(k,q){return qt(jM,{item:k,times:q})},Gi=function(k){return qt(KM,{duration:k})},fi=function(k){return qt(jh,{duration:k})},$i=function(k,q,j,pe){const Te=k?a.nodeOptions.octave+k:a.nodeOptions.octave;return qt(Bi,{duration:q,pitch:pe,octave:Te,add:j})},tn=function(k){return k.reduce((q,j)=>q+(j==="#"?1:-1),0)},Kn=function(k,q){return qt(XM,{pitches:[k].concat(q)})},G=0,Xe=0,gn=[{line:1,column:1}],cr=0,$=[],W=0,te={},he;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 Oe(){return i.substring(Xe,G)}function Be(){return jn(Xe,G)}function Se(k,q){return{type:"literal",text:k,ignoreCase:q}}function gt(k,q,j){return{type:"class",parts:k,inverted:q,ignoreCase:j}}function Cr(){return{type:"end"}}function Gr(k){return{type:"other",description:k}}function Qi(k){var q=gn[k],j;if(q)return q;for(j=k-1;!gn[j];)j--;for(q=gn[j],q={line:q.line,column:q.column};jcr&&(cr=G,$=[]),$.push(k))}function $r(k,q,j){return new e(e.buildMessage(k,q),k,q,j)}function _a(){var k,q,j=G*31+0,pe=te[j];return pe?(G=pe.nextPos,pe.result):(k=G,q=hi(),q!==s&&(Xe=k,q=Ie(q)),k=q,te[j]={nextPos:G,result:k},k)}function Sa(){var k,q,j,pe,Te,Qe,Ot,Sn=G*31+1,vr=te[Sn];if(vr)return G=vr.nextPos,vr.result;for(k=G,q=G,i.charCodeAt(G)===45?(j=d,G++):(j=s,W===0&&Ye(ae)),j===s&&(j=null),pe=[],K.test(i.charAt(G))?(Te=i.charAt(G),G++):(Te=s,W===0&&Ye(ge));Te!==s;)pe.push(Te),K.test(i.charAt(G))?(Te=i.charAt(G),G++):(Te=s,W===0&&Ye(ge));if(i.charCodeAt(G)===46?(Te=p,G++):(Te=s,W===0&&Ye(Ne)),Te!==s){if(Qe=[],K.test(i.charAt(G))?(Ot=i.charAt(G),G++):(Ot=s,W===0&&Ye(ge)),Ot!==s)for(;Ot!==s;)Qe.push(Ot),K.test(i.charAt(G))?(Ot=i.charAt(G),G++):(Ot=s,W===0&&Ye(ge));else Qe=s;Qe!==s?(j=[j,pe,Te,Qe],q=j):(G=q,q=s)}else G=q,q=s;if(q===s)if(q=G,i.charCodeAt(G)===46?(j=p,G++):(j=s,W===0&&Ye(Ne)),j!==s){if(pe=[],K.test(i.charAt(G))?(Te=i.charAt(G),G++):(Te=s,W===0&&Ye(ge)),Te!==s)for(;Te!==s;)pe.push(Te),K.test(i.charAt(G))?(Te=i.charAt(G),G++):(Te=s,W===0&&Ye(ge));else pe=s;pe!==s?(j=[j,pe],q=j):(G=q,q=s)}else G=q,q=s;return q!==s&&(Xe=k,q=je()),k=q,te[Sn]={nextPos:G,result:k},k}function Ln(){var k,q,j=G*31+2,pe=te[j];return pe?(G=pe.nextPos,pe.result):(k=G,i.charCodeAt(G)===45?G++:W===0&&Ye(ae),K.test(i.charAt(G))?(q=i.charAt(G),G++):(q=s,W===0&&Ye(ge)),q!==s?(Xe=k,k=ve()):(G=k,k=s),te[j]={nextPos:G,result:k},k)}function qi(){var k,q,j=G*31+3,pe=te[j];return pe?(G=pe.nextPos,pe.result):(W++,k=G,X.test(i.charAt(G))?(q=i.charAt(G),G++):(q=s,W===0&&Ye(be)),q!==s&&(Xe=k,q=Yt()),k=q,W--,k===s&&(q=s,W===0&&Ye(we)),te[j]={nextPos:G,result:k},k)}function Oa(){var k,q,j=G*31+7,pe=te[j];return pe?(G=pe.nextPos,pe.result):(k=G,le.test(i.charAt(G))?(q=i.charAt(G),G++):(q=s,W===0&&Ye(De)),q!==s&&(Xe=k,q=ot()),k=q,te[j]={nextPos:G,result:k},k)}function Vi(){var k,q=G*31+8,j=te[q];return j?(G=j.nextPos,j.result):(k=Oa(),k===s&&(k=Sa()),te[q]={nextPos:G,result:k},k)}function hi(){var k,q,j,pe=G*31+9,Te=te[pe];if(Te)return G=Te.nextPos,Te.result;if(k=G,q=[],j=ya(),j===s&&(j=Ea(),j===s&&(j=nr(),j===s&&(j=_i(),j===s&&(j=va())))),j!==s)for(;j!==s;)q.push(j),j=ya(),j===s&&(j=Ea(),j===s&&(j=nr(),j===s&&(j=_i(),j===s&&(j=va()))));else q=s;return q!==s&&(Xe=k,q=Tt(q)),k=q,te[pe]={nextPos:G,result:k},k}function nr(){var k,q,j,pe,Te=G*31+10,Qe=te[Te];return Qe?(G=Qe.nextPos,Qe.result):(k=G,i.charCodeAt(G)===40?(q=b,G++):(q=s,W===0&&Ye(He)),q!==s?(j=hi(),j!==s?(i.charCodeAt(G)===41?(pe=y,G++):(pe=s,W===0&&Ye(Fe)),pe!==s?(Xe=k,k=en(j)):(G=k,k=s)):(G=k,k=s)):(G=k,k=s),te[Te]={nextPos:G,result:k},k)}function Ea(){var k,q,j,pe,Te=G*31+11,Qe=te[Te];return Qe?(G=Qe.nextPos,Qe.result):(k=G,q=nr(),q!==s?(j=Ca(),j!==s?(pe=nr(),pe!==s?(Xe=k,k=lt(q,j,pe)):(G=k,k=s)):(G=k,k=s)):(G=k,k=s),te[Te]={nextPos:G,result:k},k)}function ds(){var k,q,j,pe=G*31+12,Te=te[pe];if(Te)return G=Te.nextPos,Te.result;if(k=G,i.charCodeAt(G)===45?G++:W===0&&Ye(ae),q=[],K.test(i.charAt(G))?(j=i.charAt(G),G++):(j=s,W===0&&Ye(ge)),j!==s)for(;j!==s;)q.push(j),K.test(i.charAt(G))?(j=i.charAt(G),G++):(j=s,W===0&&Ye(ge));else q=s;return q!==s?(Xe=k,k=zt()):(G=k,k=s),te[pe]={nextPos:G,result:k},k}function mi(){var k,q=G*31+13,j=te[q];return j?(G=j.nextPos,j.result):(k=ds(),k===s&&(k=Ln()),te[q]={nextPos:G,result:k},k)}function gi(){var k,q,j,pe=G*31+14,Te=te[pe];if(Te)return G=Te.nextPos,Te.result;if(k=G,q=[],j=ba(),j===s&&(j=mi()),j!==s)for(;j!==s;)q.push(j),j=ba(),j===s&&(j=mi());else q=s;return q!==s&&(Xe=k,q=bt(q)),k=q,te[pe]={nextPos:G,result:k},k}function ba(){var k,q,j,pe,Te=G*31+15,Qe=te[Te];return Qe?(G=Qe.nextPos,Qe.result):(k=G,i.charCodeAt(G)===40?G++:W===0&&Ye(He),q=mi(),q!==s?(j=Ca(),j!==s?(pe=gi(),pe!==s?(i.charCodeAt(G)===41?G++:W===0&&Ye(Fe),Xe=k,k=Me()):(G=k,k=s)):(G=k,k=s)):(G=k,k=s),te[Te]={nextPos:G,result:k},k)}function Ta(){var k,q,j,pe,Te=G*31+16,Qe=te[Te];if(Qe)return G=Qe.nextPos,Qe.result;if(k=G,i.charCodeAt(G)===123?(q=R,G++):(q=s,W===0&&Ye(Je)),q!==s){if(j=[],pe=gi(),pe===s&&(pe=qi()),pe!==s)for(;pe!==s;)j.push(pe),pe=gi(),pe===s&&(pe=qi());else j=s;j!==s?(i.charCodeAt(G)===125?(pe=w,G++):(pe=s,W===0&&Ye(nt)),pe!==s?(Xe=k,k=kr(j)):(G=k,k=s)):(G=k,k=s)}else G=k,k=s;return te[Te]={nextPos:G,result:k},k}function Ca(){var k,q=G*31+17,j=te[q];return j?(G=j.nextPos,j.result):(i.charCodeAt(G)===43?(k=B,G++):(k=s,W===0&&Ye(mt)),k===s&&(i.charCodeAt(G)===45?(k=d,G++):(k=s,W===0&&Ye(ae)),k===s&&(i.charCodeAt(G)===42?(k=Z,G++):(k=s,W===0&&Ye(Rt)),k===s&&(i.charCodeAt(G)===47?(k=f,G++):(k=s,W===0&&Ye(pt)),k===s&&(i.charCodeAt(G)===37?(k=E,G++):(k=s,W===0&&Ye(It)),k===s&&(i.charCodeAt(G)===94?(k=S,G++):(k=s,W===0&&Ye(Nt)),k===s&&(i.charCodeAt(G)===124?(k=_,G++):(k=s,W===0&&Ye(ce)),k===s&&(i.charCodeAt(G)===38?(k=A,G++):(k=s,W===0&&Ye(Fr)),k===s&&(i.substr(G,2)===N?(k=N,G+=2):(k=s,W===0&&Ye($e)),k===s&&(i.substr(G,2)===x?(k=x,G+=2):(k=s,W===0&&Ye(Lr))))))))))),te[q]={nextPos:G,result:k},k)}function _i(){var k,q,j=G*31+18,pe=te[j];return pe?(G=pe.nextPos,pe.result):(k=G,q=hs(),q===s&&(q=Ra(),q===s&&(q=_n(),q===s&&(q=rn(),q===s&&(q=qi(),q===s&&(q=Jn(),q===s&&(q=fs(),q===s&&(q=Si(),q===s&&(q=nr(),q===s&&(q=Ta(),q===s&&(q=ps())))))))))),q!==s&&(Xe=k,q=Zn(q)),k=q,te[j]={nextPos:G,result:k},k)}function ps(){var k,q,j=G*31+19,pe=te[j];return pe?(G=pe.nextPos,pe.result):(k=G,i.charCodeAt(G)===124?(q=_,G++):(q=s,W===0&&Ye(ce)),q!==s&&(Xe=k,q=st()),k=q,te[j]={nextPos:G,result:k},k)}function va(){var k,q,j,pe,Te=G*31+20,Qe=te[Te];return Qe?(G=Qe.nextPos,Qe.result):(k=G,i.charCodeAt(G)===60?(q=D,G++):(q=s,W===0&&Ye(at)),q!==s?(j=hi(),j!==s?(i.charCodeAt(G)===62?(pe=U,G++):(pe=s,W===0&&Ye(ze)),pe!==s?(Xe=k,k=Yr(j)):(G=k,k=s)):(G=k,k=s)):(G=k,k=s),te[Te]={nextPos:G,result:k},k)}function rn(){var k,q,j=G*31+21,pe=te[j];return pe?(G=pe.nextPos,pe.result):(k=G,q=ft(),q!==s&&(Xe=k,q=Tr(q)),k=q,te[j]={nextPos:G,result:k},k)}function ft(){var k,q,j,pe=G*31+22,Te=te[pe];if(Te)return G=Te.nextPos,Te.result;if(k=G,q=[],i.charCodeAt(G)===94?(j=S,G++):(j=s,W===0&&Ye(Nt)),j===s&&(i.charCodeAt(G)===95?(j=ee,G++):(j=s,W===0&&Ye(br))),j!==s)for(;j!==s;)q.push(j),i.charCodeAt(G)===94?(j=S,G++):(j=s,W===0&&Ye(Nt)),j===s&&(i.charCodeAt(G)===95?(j=ee,G++):(j=s,W===0&&Ye(br)));else q=s;return q!==s&&(Xe=k,q=Yi()),k=q,te[pe]={nextPos:G,result:k},k}function fs(){var k,q,j=G*31+23,pe=te[j];return pe?(G=pe.nextPos,pe.result):(k=G,i.charCodeAt(G)===63?(q=ie,G++):(q=s,W===0&&Ye(rr)),q!==s&&(Xe=k,q=xn()),k=q,te[j]={nextPos:G,result:k},k)}function Si(){var k,q,j,pe,Te,Qe,Ot=G*31+24,Sn=te[Ot];return Sn?(G=Sn.nextPos,Sn.result):(k=G,i.charCodeAt(G)===40?(q=b,G++):(q=s,W===0&&Ye(He)),q!==s?(j=Ln(),j!==s?(i.charCodeAt(G)===44?(pe=m,G++):(pe=s,W===0&&Ye(Ae)),pe!==s?(Te=Ln(),Te!==s?(i.charCodeAt(G)===41?(Qe=y,G++):(Qe=s,W===0&&Ye(Fe)),Qe!==s?(Xe=k,k=Gt(j,Te)):(G=k,k=s)):(G=k,k=s)):(G=k,k=s)):(G=k,k=s)):(G=k,k=s),te[Ot]={nextPos:G,result:k},k)}function ya(){var k,q,j,pe,Te=G*31+25,Qe=te[Te];return Qe?(G=Qe.nextPos,Qe.result):(k=G,q=_i(),q!==s?(i.charCodeAt(G)===58?(j=ne,G++):(j=s,W===0&&Ye(mr)),j!==s?(pe=Ln(),pe!==s?(Xe=k,k=mn(q,pe)):(G=k,k=s)):(G=k,k=s)):(G=k,k=s),te[Te]={nextPos:G,result:k},k)}function Jn(){var k,q,j=G*31+26,pe=te[j];return pe?(G=pe.nextPos,pe.result):(k=G,q=Vi(),q!==s&&(Xe=k,q=Gi(q)),k=q,te[j]={nextPos:G,result:k},k)}function hs(){var k,q,j,pe=G*31+27,Te=te[pe];return Te?(G=Te.nextPos,Te.result):(k=G,q=Vi(),q===s&&(q=null),i.charCodeAt(G)===114?(j=re,G++):(j=s,W===0&&Ye(z)),j!==s?(Xe=k,k=fi(q)):(G=k,k=s),te[pe]={nextPos:G,result:k},k)}function _n(){var k,q,j,pe,Te,Qe=G*31+28,Ot=te[Qe];return Ot?(G=Ot.nextPos,Ot.result):(k=G,q=ft(),q===s&&(q=null),j=Vi(),j===s&&(j=null),pe=Aa(),pe===s&&(pe=null),Te=Ln(),Te!==s?(Xe=k,k=$i(q,j,pe,Te)):(G=k,k=s),te[Qe]={nextPos:G,result:k},k)}function Aa(){var k,q,j,pe=G*31+29,Te=te[pe];if(Te)return G=Te.nextPos,Te.result;if(k=G,q=[],i.charCodeAt(G)===35?(j=L,G++):(j=s,W===0&&Ye(me)),j===s&&(i.charCodeAt(G)===98?(j=F,G++):(j=s,W===0&&Ye(Re))),j!==s)for(;j!==s;)q.push(j),i.charCodeAt(G)===35?(j=L,G++):(j=s,W===0&&Ye(me)),j===s&&(i.charCodeAt(G)===98?(j=F,G++):(j=s,W===0&&Ye(Re)));else q=s;return q!==s&&(Xe=k,q=tn(q)),k=q,te[pe]={nextPos:G,result:k},k}function Ra(){var k,q,j,pe,Te=G*31+30,Qe=te[Te];if(Qe)return G=Qe.nextPos,Qe.result;if(k=G,q=_n(),q!==s){if(j=[],pe=_n(),pe!==s)for(;pe!==s;)j.push(pe),pe=_n();else j=s;j!==s?(Xe=k,k=Kn(q,j)):(G=k,k=s)}else G=k,k=s;return te[Te]={nextPos:G,result:k},k}var Ia=a.nodeOptions||{};function qt(k,q,j=void 0){q.text=j||Oe(),q.location=Be();for(var pe in Ia)(q[pe]===void 0||q[pe]===null)&&(q[pe]=Ia[pe]);return new k(q)}if(he=c(),he!==s&&G===i.length)return he;throw he!==s&&Ge.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 lo(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.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())}evaluate(e,t={}){return e.map(i=>i.evaluate(t)).flat(1/0).filter(i=>i!==void 0)}totalDuration(){return this.evaluated.reduce((t,r)=>t+r.collect("duration"),0)}}const rP=n=>{let e={};return WM.forEach(t=>{if(n[t]!==void 0){const r=n[t];e[t]=r,delete n[t]}}),e};class nP{constructor(){v(this,"midiAccess",null);v(this,"midiOutputs",[]);v(this,"currentOutputIndex",0);v(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 iP{constructor(e,t,r){v(this,"min");v(this,"max");v(this,"wrap");v(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 aP={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 sP(n,e="major",t=4){const r=aP[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 ug{constructor(e){v(this,"seedValue");v(this,"randomGen",Math.random);v(this,"app");v(this,"values",{});v(this,"odds",(e,t)=>this.randomGen()this.odds(.025,e));v(this,"rarely",e=>this.odds(.1,e));v(this,"scarcely",e=>this.odds(.25,e));v(this,"sometimes",e=>this.odds(.5,e));v(this,"often",e=>this.odds(.75,e));v(this,"frequently",e=>this.odds(.9,e));v(this,"almostAlways",e=>this.odds(.985,e));v(this,"modify",e=>e(this));v(this,"seed",e=>(this.seedValue=e.toString(),this.randomGen=this.app.api.localSeededRandom(this.seedValue),this));v(this,"clear",()=>(this.app.api.clearLocalSeed(this.seedValue),this));v(this,"apply",e=>this.modify(e));v(this,"duration",e=>(this.values.duration=e,this));this.app=e,this.app.api.currentSeed&&(this.randomGen=this.app.api.randomGen)}}class RA extends ug{constructor(t){super(t);v(this,"octave",t=>(this.values.octave=t,this.update(),this));v(this,"key",t=>(this.values.key=t,this.update(),this));v(this,"scale",t=>(sg(t)?(this.values.scaleName=t,this.values.parsedScale=fa(t)):this.values.parsedScale=og(t),this.update(),this));v(this,"freq",t=>{this.values.freq=t;const r=FM(t);return r%1!==0?(this.values.note=Math.floor(r),this.values.bend=vA(r)[1]):this.values.note=r,this});v(this,"update",()=>{})}}let Rr=[],oP=(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=!Rr.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=oP(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 CO={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),!CO[r])throw new Error("vowel: unknown vowel "+r);const{gains:i,qs:a,freqs:s}=CO[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 cP=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]:[]},uP={c:0,d:2,e:4,f:5,g:7,a:9,b:11},dP={"#":1,b:-1,s:1,f:-1},hc=(n,e=3)=>{const[t,r,i=e]=cP(n);if(!t)throw new Error('not a note: "'+n+'"');const a=uP[t.toLowerCase()],s=(r==null?void 0:r.split("").reduce((o,l)=>o+dP[l],0))||0;return(Number(i)+1)*12+a+s},IA=n=>Math.pow(2,(n-69)/12)*440,pP=(n,e,t)=>Math.min(Math.max(n,e),t),fP=n=>12*Math.log(n/440)/Math.LN2+69,hP=(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 hc(r);if(typeof r=="number")return r;if(!e)throw new Error("valueToMidi: expected freq or note to be set");return e},mP="data:application/javascript;base64,Ly8gTElDRU5TRSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSB2My4wIHNlZSBodHRwczovL2dpdGh1Yi5jb20vZGt0cjAvV2ViRGlydC9ibG9iL21haW4vTElDRU5TRQovLyBhbGwgdGhlIGNyZWRpdCBnb2VzIHRvIGRrdHIwJ3Mgd2ViZGlydDogaHR0cHM6Ly9naXRodWIuY29tL2RrdHIwL1dlYkRpcnQvYmxvYi81Y2UzZDY5ODM2MmM1NGQ2ZTFiNjhhY2M0N2ViMjk1NWFjNjJjNzkzL2Rpc3QvQXVkaW9Xb3JrbGV0cy5qcwovLyA8MwoKY2xhc3MgQ29hcnNlUHJvY2Vzc29yIGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgZ2V0IHBhcmFtZXRlckRlc2NyaXB0b3JzKCkgewogICAgcmV0dXJuIFt7IG5hbWU6ICdjb2Fyc2UnLCBkZWZhdWx0VmFsdWU6IDEgfV07CiAgfQoKICBjb25zdHJ1Y3RvcigpIHsKICAgIHN1cGVyKCk7CiAgICB0aGlzLm5vdFN0YXJ0ZWQgPSB0cnVlOwogIH0KCiAgcHJvY2VzcyhpbnB1dHMsIG91dHB1dHMsIHBhcmFtZXRlcnMpIHsKICAgIGNvbnN0IGlucHV0ID0gaW5wdXRzWzBdOwogICAgY29uc3Qgb3V0cHV0ID0gb3V0cHV0c1swXTsKICAgIGNvbnN0IGNvYXJzZSA9IHBhcmFtZXRlcnMuY29hcnNlOwogICAgY29uc3QgYmxvY2tTaXplID0gMTI4OwogICAgY29uc3QgaGFzSW5wdXQgPSAhKGlucHV0WzBdID09PSB1bmRlZmluZWQpOwogICAgaWYgKGhhc0lucHV0KSB7CiAgICAgIHRoaXMubm90U3RhcnRlZCA9IGZhbHNlOwogICAgICBvdXRwdXRbMF1bMF0gPSBpbnB1dFswXVswXTsKICAgICAgZm9yIChsZXQgbiA9IDE7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgIGZvciAobGV0IG8gPSAwOyBvIDwgb3V0cHV0Lmxlbmd0aDsgbysrKSB7CiAgICAgICAgICBvdXRwdXRbb11bbl0gPSBuICUgY29hcnNlID09IDAgPyBpbnB1dFswXVtuXSA6IG91dHB1dFtvXVtuIC0gMV07CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ2NvYXJzZS1wcm9jZXNzb3InLCBDb2Fyc2VQcm9jZXNzb3IpOwoKY2xhc3MgQ3J1c2hQcm9jZXNzb3IgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3IgewogIHN0YXRpYyBnZXQgcGFyYW1ldGVyRGVzY3JpcHRvcnMoKSB7CiAgICByZXR1cm4gW3sgbmFtZTogJ2NydXNoJywgZGVmYXVsdFZhbHVlOiAwIH1dOwogIH0KCiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5ub3RTdGFydGVkID0gdHJ1ZTsKICB9CgogIHByb2Nlc3MoaW5wdXRzLCBvdXRwdXRzLCBwYXJhbWV0ZXJzKSB7CiAgICBjb25zdCBpbnB1dCA9IGlucHV0c1swXTsKICAgIGNvbnN0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBjcnVzaCA9IHBhcmFtZXRlcnMuY3J1c2g7CiAgICBjb25zdCBibG9ja1NpemUgPSAxMjg7CiAgICBjb25zdCBoYXNJbnB1dCA9ICEoaW5wdXRbMF0gPT09IHVuZGVmaW5lZCk7CiAgICBpZiAoaGFzSW5wdXQpIHsKICAgICAgdGhpcy5ub3RTdGFydGVkID0gZmFsc2U7CiAgICAgIGlmIChjcnVzaC5sZW5ndGggPT09IDEpIHsKICAgICAgICBjb25zdCB4ID0gTWF0aC5wb3coMiwgY3J1c2hbMF0gLSAxKTsKICAgICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgICBjb25zdCB2YWx1ZSA9IE1hdGgucm91bmQoaW5wdXRbMF1bbl0gKiB4KSAvIHg7CiAgICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgICBvdXRwdXRbb11bbl0gPSB2YWx1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0gZWxzZSB7CiAgICAgICAgZm9yIChsZXQgbiA9IDA7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgICAgbGV0IHggPSBNYXRoLnBvdygyLCBjcnVzaFtuXSAtIDEpOwogICAgICAgICAgY29uc3QgdmFsdWUgPSBNYXRoLnJvdW5kKGlucHV0WzBdW25dICogeCkgLyB4OwogICAgICAgICAgZm9yIChsZXQgbyA9IDA7IG8gPCBvdXRwdXQubGVuZ3RoOyBvKyspIHsKICAgICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQpyZWdpc3RlclByb2Nlc3NvcignY3J1c2gtcHJvY2Vzc29yJywgQ3J1c2hQcm9jZXNzb3IpOwoKY2xhc3MgU2hhcGVQcm9jZXNzb3IgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3IgewogIHN0YXRpYyBnZXQgcGFyYW1ldGVyRGVzY3JpcHRvcnMoKSB7CiAgICByZXR1cm4gW3sgbmFtZTogJ3NoYXBlJywgZGVmYXVsdFZhbHVlOiAwIH1dOwogIH0KCiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5ub3RTdGFydGVkID0gdHJ1ZTsKICB9CgogIHByb2Nlc3MoaW5wdXRzLCBvdXRwdXRzLCBwYXJhbWV0ZXJzKSB7CiAgICBjb25zdCBpbnB1dCA9IGlucHV0c1swXTsKICAgIGNvbnN0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBzaGFwZTAgPSBwYXJhbWV0ZXJzLnNoYXBlWzBdOwogICAgY29uc3Qgc2hhcGUxID0gc2hhcGUwIDwgMSA/IHNoYXBlMCA6IDEuMCAtIDRlLTEwOwogICAgY29uc3Qgc2hhcGUgPSAoMi4wICogc2hhcGUxKSAvICgxLjAgLSBzaGFwZTEpOwogICAgY29uc3QgYmxvY2tTaXplID0gMTI4OwogICAgY29uc3QgaGFzSW5wdXQgPSAhKGlucHV0WzBdID09PSB1bmRlZmluZWQpOwogICAgaWYgKGhhc0lucHV0KSB7CiAgICAgIHRoaXMubm90U3RhcnRlZCA9IGZhbHNlOwogICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgY29uc3QgdmFsdWUgPSAoKDEgKyBzaGFwZSkgKiBpbnB1dFswXVtuXSkgLyAoMSArIHNoYXBlICogTWF0aC5hYnMoaW5wdXRbMF1bbl0pKTsKICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ3NoYXBlLXByb2Nlc3NvcicsIFNoYXBlUHJvY2Vzc29yKTsK";function Wl(n){const e=Ht().createGain();return e.gain.value=n,e}const Jh=(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)}}},gP=(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)}}},nu=(n,e,t)=>{const r=Ht().createBiquadFilter();return r.type=n,r.frequency.value=e,r.Q.value=t,r};let _P=n=>console.log(n);const ss=(...n)=>_P(...n),dg=lP();function pg(n,e,t={}){dg.setKey(n,{onTrigger:e,data:t})}function vO(n){return dg.get()[n]}let iu;const Ht=()=>(iu||(iu=new AudioContext),iu);let Ko;const fg=()=>{const n=Ht();return Ko||(Ko=n.createGain(),Ko.connect(n.destination)),Ko};let au;function SP(){return au||(au=Ht().audioWorklet.addModule(mP),au)}function su(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 OP(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 SP().catch(t=>{console.warn("could not load AudioWorklet effects coarse, crush and shape",t)}))}async function EP(n){return new Promise(e=>{document.addEventListener("click",async function t(){await OP(n),e(),document.removeEventListener("click",t)})})}let Wi={};function bP(n,e,t,r){var i;if(t=pP(t,0,.98),!Wi[n]){const a=Ht().createFeedbackDelay(1,e,t);(i=a.start)==null||i.call(a,r),a.connect(fg()),Wi[n]=a}return Wi[n].delayTime.value!==e&&Wi[n].delayTime.setValueAtTime(e,r),Wi[n].feedback.value!==t&&Wi[n].feedback.setValueAtTime(t,r),Wi[n]}let Xi={};function TP(n,e=2){if(!Xi[n]){const t=Ht().createReverb(e);t.connect(fg()),Xi[n]=t}return Xi[n].duration!==e&&(Xi[n]=Xi[n].setDuration(e),Xi[n].duration=e),Xi[n]}let Zi;function CP(n=2048){if(!Zi){const e=Ht().createAnalyser();e.fftSize=n,Zi=e,new Float32Array(Zi.frequencyBinCount)}return Zi.fftSize!==n&&(Zi.fftSize=n,new Float32Array(Zi.frequencyBinCount)),Zi}function ou(n,e,t){const r=Wl(t);return n.connect(r),r.connect(e),r}const vP=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:y,crush:R,shape:w,pan:B,vowel:Z,delay:f=0,delayfeedback:E=.5,delaytime:S=.25,orbit:A=1,room:N,size:x=2,velocity:D=1,analyze:U,fft:ee=8}=n;l*=D;let ie=[];const ne=()=>{ie.forEach(ae=>ae==null?void 0:ae.disconnect())};s&&a&&(a=`${s}_${a}`);let re;if(o)re=o(i,n,t);else if(vO(a)){const{onTrigger:ae}=vO(a),ge=await ae(i,n,ne);ge&&(re=ge.node,ge.stop(i+t))}else throw new Error(`sound ${a} not found! Is it loaded?`);if(!re)return;if(r.currentTime>i){ss("[webaudio] skip hap: still loading",r.currentTime-i);return}const L=[];if(L.push(re),L.push(Wl(l)),c!==void 0&&L.push(nu("lowpass",c,d)),p!==void 0&&L.push(nu("highpass",p,m)),_!==void 0&&L.push(nu("bandpass",_,b)),Z!==void 0&&L.push(r.createVowelFilter(Z)),y!==void 0&&L.push(su(r,"coarse-processor",{coarse:y})),R!==void 0&&L.push(su(r,"crush-processor",{crush:R})),w!==void 0&&L.push(su(r,"shape-processor",{shape:w})),B!==void 0){const ae=r.createStereoPanner();ae.pan.value=2*B-1,L.push(ae)}const F=Wl(1);L.push(F),F.connect(fg());let K;if(f>0&&S>0&&E>0){const ae=bP(A,S,E,i);K=ou(F,ae,f)}let X;if(N>0&&x>0){const ae=TP(A,x);X=ou(F,ae,N)}let le;if(U){const ae=CP(2**(ee+5));le=ou(F,ae,U)}L.slice(1).reduce((ae,ge)=>ae.connect(ge),L[0]),ie=L.concat([K,X,le])},lu={};function yP(n,e){var t=e?1e3:1024;if(n=t);return n.toFixed(1)+" "+r[i]}const AP=async(n,e,t,r,i,a,s)=>{let o=0;i!==void 0&&t!==void 0&&ss("[sampler] hap has note and freq. ignoring note","warning");let l=hP({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=>hc(R)-l,y=Object.keys(a).filter(R=>!R.startsWith("_")).reduce((R,w,B)=>!R||Math.abs(b(w)){const i=t?`sound "${t}:${r}"`:"sample";if(!lu[n]){ss(`[sampler] load ${i}..`,"load-sample",{url:n});const a=Date.now();lu[n]=fetch(n).then(s=>s.arrayBuffer()).then(async s=>{const o=Date.now()-a,l=yP(s.byteLength);return ss(`[sampler] load ${i}... done! loaded ${l} in ${o}ms`,"loaded-sample",{url:n}),await e.decodeAudioData(s)})}return lu[n]};function IP(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 wP={};function DP(n){const e=Object.entries(wP).find(([t])=>n.startsWith(t));if(e)return e[1]}const Xl=async(n,e=n._base||"",t={})=>{if(typeof n=="string"){const a=DP(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=>Xl(o,e||o._base||s,t)).catch(o=>{throw console.error(o),new Error(`error loading "${n}"`)})}const{prebake:r,tag:i}=t;NP(n,(a,s)=>pg(a,(o,l,c)=>xP(o,l,c,s),{type:"sample",samples:s,baseUrl:e,prebake:r,tag:i}),e)},yO=[];async function xP(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:y=0,end:R=1}=e;if(b===0)return;const w=Ht(),{attack:B=.001,decay:Z=.001,sustain:f=1,release:E=.001}=e,S=n+l,A=await AP(a,m,_,b,s,r,i);if(w.currentTime>n){ss(`[sampler] still loading sound "${a}:${m}"`,"highlight");return}if(!A){ss(`[sampler] could not load "${a}:${m}"`,"error");return}A.playbackRate.value=Math.abs(b)*A.playbackRate.value,o==="c"&&(A.playbackRate.value=A.playbackRate.value*A.buffer.duration*1);const N=y*A.buffer.duration;A.start(S,N);const x=A.buffer.duration/A.playbackRate.value,{node:D,stop:U}=Jh(B,Z,f,E,1,n);A.connect(D);const ee=w.createGain();D.connect(ee),A.onended=function(){A.disconnect(),D.disconnect(),ee.disconnect(),t()};const ie={node:ee,bufferSource:A,stop:(ne,re=p===void 0)=>{let L=ne;re&&(L=n+(R-y)*x),A.stop(L+E),U(L)}};if(c!==void 0){const ne=yO[c];ne&&(ne.node.gain.setValueAtTime(1,S),ne.node.gain.linearRampToValueAtTime(0,S+.01)),yO[c]=ie}return ie}const LP=(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)}},kP=(n,e,t,r="sine")=>{const i=n.frequency.value*e,a=i*t;return LP(i,a,r)};function MP(){["sine","square","triangle","sawtooth"].forEach(n=>{pg(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:y,fmwave:R="sine"}=t,{n:w,note:B,freq:Z}=t;B=B||36,typeof B=="string"&&(B=hc(B)),!Z&&typeof B=="number"&&(Z=IA(B));const{node:f,stop:E}=BP({t:e,s:n,freq:Z,partials:w});let S,A;if(c){const{node:U,stop:ee}=kP(f,l,c,R);[p,m,_,b,y].find(ie=>ie!==void 0)?(p=p??.001,m=m??.001,_=_??1,b=b??.001,y=y??1,A=Jh(p,m,_,b,y,e),d==="exp"&&(A=gP(p,m,_,b,y,e),A.node.maxValue=c*2,A.node.minValue=1e-5),U.connect(A.node),A.node.connect(f.frequency)):U.connect(f.frequency),S=ee}const N=Wl(.3),{node:x,stop:D}=Jh(i,a,s,o,1,e);return f.onended=()=>{f.disconnect(),N.disconnect(),r()},{node:f.connect(N).connect(x),stop:U=>{D(U),A==null||A.stop(U);let ee=U+o;E(ee),S==null||S(ee)}}},{type:"synth",prebake:!0})})}function PP(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 BP({s:n,freq:e,t,partials:r}){let i;return!r||n==="sine"?(i=Ht().createOscillator(),i.type=n||"triangle"):i=PP(r,n),i.frequency.value=Number(e),i.start(t),{node:i,stop:a=>i.stop(a)}}function UP(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,y=0,R=0,w=1,B=0,Z=0){let f=Math.PI*2,E=Ht().sampleRate,S=X=>X>0?1:-1,A=l*=500*f/E/E,N=t*=(1+e*2*Math.random()-e)*f/E,x=[],D=0,U=0,ee=0,ie=1,ne=0,re=0,L=0,F,K;for(r=r*E+9,B*=E,i*=E,a*=E,R*=E,c*=500*f/E**3,b*=f/E,d*=f/E,p*=E,m=m*E|0,K=r+B+i+a+R|0;ee1?s>2?s>3?Math.sin((D%f)**3):Math.max(Math.min(Math.tan(D),1),-1):1-(2*D/f%2+2)%2:1-4*Math.abs(Math.round(D/f)-D/f):Math.sin(D),L=(m?1-Z+Z*Math.sin(f*ee/m):1)*S(L)*Math.abs(L)**o*n*1*(eeee?0:(eep&&(t+=d,N+=d,ie=0),m&&!(++ne%m)&&(t=N,l=A,ie||(ie=1));return x}const FP=(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:y=0,noise:R=0,zmod:w=0,zcrush:B=0,zdelay:Z=0,tremolo:f=0,duration:E=.2,zzfx:S}=n;const A=Math.max(E-s-o,0);typeof r=="string"&&(r=hc(r)),!i&&typeof r=="number"&&(i=IA(r)),t=t.replace("z_","");const N=["sine","triangle","sawtooth","tan","noise"].indexOf(t)||0;d=t==="square"?0:d;const x=UP(...S||[.25,a,i,s,A,c,N,d,p,m,_,b,y,R,w,B,Z,l,o,f]),D=Ht(),U=D.createBuffer(1,x.length,D.sampleRate);U.getChannelData(0).set(x);const ee=Ht().createBufferSource();return ee.buffer=U,ee.start(e),{node:ee}};function YP(){["zzfx","z_sine","z_sawtooth","z_triangle","z_square","z_tan","z_noise"].forEach(n=>{pg(n,(e,t,r)=>{const{node:i}=FP({s:n,...t},e);return i.onended=()=>{i.disconnect(),r()},{node:i,stop:()=>{}}},{type:"synth",prebake:!0})})}class NA extends RA{constructor(t,r){super(r);v(this,"volume",t=>this.updateValue("volume",t));v(this,"vol",this.volume);v(this,"zrand",t=>this.updateValue("zrand",t));v(this,"curve",t=>this.updateValue("curve",t));v(this,"slide",t=>this.updateValue("slide",t));v(this,"sld",this.slide);v(this,"deltaSlide",t=>this.updateValue("deltaSlide",t));v(this,"dslide",this.deltaSlide);v(this,"pitchJump",t=>this.updateValue("pitchJump",t));v(this,"pj",this.pitchJump);v(this,"pitchJumpTime",t=>this.updateValue("pitchJumpTime",t));v(this,"pjt",this.pitchJumpTime);v(this,"lfo",t=>this.updateValue("lfo",t));v(this,"noise",t=>this.updateValue("noise",t));v(this,"zmod",t=>this.updateValue("zmod",t));v(this,"zcrush",t=>this.updateValue("zcrush",t));v(this,"zdelay",t=>this.updateValue("zdelay",t));v(this,"sustainVolume",t=>this.updateValue("sustainVolume",t));v(this,"decay",t=>this.updateValue("decay",t));v(this,"dec",this.decay);v(this,"tremolo",t=>this.updateValue("tremolo",t));v(this,"duration",t=>this.updateValue("duration",t));v(this,"zzfx",t=>this.updateValue("zzfx",t));v(this,"fmi",t=>this.updateValue("fmi",t));v(this,"fmh",t=>this.updateValue("fmh",t));v(this,"fmenv",t=>this.updateValue("fmenv",t));v(this,"fmattack",t=>this.updateValue("fmattack",t));v(this,"fmatk",this.fmattack);v(this,"fmdecay",t=>this.updateValue("fmdecay",t));v(this,"fmdec",this.fmdecay);v(this,"fmsustain",t=>this.updateValue("fmsustain",t));v(this,"fmsus",this.fmsustain);v(this,"fmrelease",t=>this.updateValue("fmrelease",t));v(this,"fmrel",this.fmrelease);v(this,"fmvelocity",t=>this.updateValue("fmvelocity",t));v(this,"fmvel",this.fmvelocity);v(this,"fmwave",t=>this.updateValue("fmwave",t));v(this,"fmw",this.fmwave);v(this,"attack",t=>this.updateValue("attack",t));v(this,"atk",this.attack);v(this,"release",t=>this.updateValue("release",t));v(this,"rel",this.release);v(this,"sustain",t=>this.updateValue("sustain",t));v(this,"sus",this.sustain);v(this,"unit",t=>this.updateValue("unit",t));v(this,"u",this.unit);v(this,"freq",t=>this.updateValue("freq",t));v(this,"f",this.freq);v(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});v(this,"sound",t=>this.updateValue("s",t));v(this,"snd",this.sound);v(this,"nudge",t=>this.updateValue("nudge",t));v(this,"cut",t=>this.updateValue("cut",t));v(this,"loop",t=>this.updateValue("loop",t));v(this,"clip",t=>this.updateValue("clip",t));v(this,"n",t=>this.updateValue("n",t));v(this,"note",t=>this.updateValue("note",t));v(this,"speed",t=>this.updateValue("speed",t));v(this,"spd",this.speed);v(this,"begin",t=>this.updateValue("begin",t));v(this,"end",t=>this.updateValue("end",t));v(this,"gain",t=>this.updateValue("gain",t));v(this,"cutoff",t=>this.updateValue("cutoff",t));v(this,"lpf",this.cutoff);v(this,"resonance",t=>this.updateValue("resonance",t));v(this,"lpq",this.resonance);v(this,"hcutoff",t=>this.updateValue("hcutoff",t));v(this,"hpf",this.hcutoff);v(this,"hresonance",t=>this.updateValue("hresonance",t));v(this,"hpq",this.hresonance);v(this,"bandf",t=>this.updateValue("bandf",t));v(this,"bpf",this.bandf);v(this,"bandq",t=>this.updateValue("bandq",t));v(this,"bpq",this.bandq);v(this,"coarse",t=>this.updateValue("coarse",t));v(this,"crush",t=>this.updateValue("crush",t));v(this,"shape",t=>this.updateValue("shape",t));v(this,"pan",t=>this.updateValue("pan",t));v(this,"vowel",t=>this.updateValue("vowel",t));v(this,"vow",this.vowel);v(this,"delay",t=>this.updateValue("delay",t));v(this,"del",this.delay);v(this,"delayfeedback",t=>this.updateValue("delayfeedback",t));v(this,"delayfb",this.delayfeedback);v(this,"delaytime",t=>this.updateValue("delaytime",t));v(this,"delayt",this.delaytime);v(this,"orbit",t=>this.updateValue("orbit",t));v(this,"o",this.orbit);v(this,"room",t=>this.updateValue("room",t));v(this,"rm",this.room);v(this,"size",t=>this.updateValue("size",t));v(this,"sz",this.size);v(this,"velocity",t=>this.updateValue("velocity",t));v(this,"vel",this.velocity);v(this,"modify",t=>{const r=t(this);return r instanceof Object?r:(t(this.values),this.update(),this)});v(this,"update",()=>{const[t,r]=lg(this.values.key||"C4",this.values.pitch||0,this.values.parsedScale||"MAJOR",this.values.octave||0);this.values.freq=co(t)});v(this,"out",()=>vP(this.values,this.app.clock.pulse_duration,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 wA extends RA{constructor(t,r){super(r);v(this,"midiConnection");v(this,"note",t=>(this.values.note=t,this));v(this,"sustain",t=>(this.values.sustain=t,this));v(this,"channel",t=>(this.values.channel=t,this));v(this,"port",t=>(this.values.port=this.midiConnection.getMidiOutputIndex(t),this));v(this,"add",t=>(this.values.note+=t,this));v(this,"modify",t=>{const r=t(this);return r instanceof Object?r:(t(this.values),this.update(),this)});v(this,"bend",t=>(this.values.bend=t,this));v(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));v(this,"update",()=>{const[t,r]=lg(this.values.key||"C4",this.values.pitch||0,this.values.parsedScale||"MAJOR",this.values.octave||0);this.values.note=t,this.values.freq=co(t),r&&(this.values.bend=r)});v(this,"out",()=>{const t=this.values.note?this.values.note:60,r=this.values.channel?this.values.channel:0,i=this.values.velocity?this.values.velocity:100,a=this.values.sustain?this.values.sustain*this.app.clock.pulse_duration*this.app.api.ppqn():this.app.clock.pulse_duration*this.app.api.ppqn(),s=this.values.bend?this.values.bend:void 0,o=this.values.port?this.midiConnection.getMidiOutputIndex(this.values.port):this.midiConnection.getCurrentMidiPortIndex();this.midiConnection.sendMidiNote(t,r,i,a,o,s)});this.app=r,typeof t=="number"?this.values.note=t:this.values=t,this.midiConnection=r.api.MidiConnection}}const As=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,DA=new Set,em=typeof process=="object"&&process?process:{},xA=(n,e,t,r)=>{typeof em.emitWarning=="function"?em.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)};let Zl=globalThis.AbortController,AO=globalThis.AbortSignal;var g1;if(typeof Zl>"u"){AO=class{constructor(){v(this,"onabort");v(this,"_onabort",[]);v(this,"reason");v(this,"aborted",!1)}addEventListener(r,i){this._onabort.push(i)}},Zl=class{constructor(){v(this,"signal",new AO);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=((g1=em.env)==null?void 0:g1.LRU_CACHE_IGNORE_AC_WARNING)!=="1";const e=()=>{n&&(n=!1,xA("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 GP=n=>!DA.has(n),Ti=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),LA=n=>Ti(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?hl:null:null;class hl extends Array{constructor(e){super(e),this.fill(0)}}var qa;const Ji=class Ji{constructor(e,t){v(this,"heap");v(this,"length");if(!Q(Ji,qa))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}static create(e){const t=LA(e);if(!t)return[];Ve(Ji,qa,!0);const r=new Ji(e,t);return Ve(Ji,qa,!1),r}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}};qa=new WeakMap,tt(Ji,qa,!1);let tm=Ji;var bn,Vr,Tn,Cn,Va,Zt,vn,Kt,Dt,et,Ir,Hr,_r,sr,yn,or,ri,ni,An,Rn,Ii,Nr,ho,nm,ia,ii,mo,zr,tc,kA,aa,Ha,go,Un,Ci,Fn,vi,_o,im,za,ml,Wa,gl,vt,kt,So,am,sa,Ps;const Tg=class Tg{constructor(e){tt(this,ho);tt(this,tc);tt(this,Un);tt(this,Fn);tt(this,_o);tt(this,za);tt(this,Wa);tt(this,vt);tt(this,So);tt(this,sa);tt(this,bn,void 0);tt(this,Vr,void 0);tt(this,Tn,void 0);tt(this,Cn,void 0);tt(this,Va,void 0);v(this,"ttl");v(this,"ttlResolution");v(this,"ttlAutopurge");v(this,"updateAgeOnGet");v(this,"updateAgeOnHas");v(this,"allowStale");v(this,"noDisposeOnSet");v(this,"noUpdateTTL");v(this,"maxEntrySize");v(this,"sizeCalculation");v(this,"noDeleteOnFetchRejection");v(this,"noDeleteOnStaleGet");v(this,"allowStaleOnFetchAbort");v(this,"allowStaleOnFetchRejection");v(this,"ignoreFetchAbort");tt(this,Zt,void 0);tt(this,vn,void 0);tt(this,Kt,void 0);tt(this,Dt,void 0);tt(this,et,void 0);tt(this,Ir,void 0);tt(this,Hr,void 0);tt(this,_r,void 0);tt(this,sr,void 0);tt(this,yn,void 0);tt(this,or,void 0);tt(this,ri,void 0);tt(this,ni,void 0);tt(this,An,void 0);tt(this,Rn,void 0);tt(this,Ii,void 0);tt(this,Nr,void 0);tt(this,ia,()=>{});tt(this,ii,()=>{});tt(this,mo,()=>{});tt(this,zr,()=>!1);tt(this,aa,e=>{});tt(this,Ha,(e,t,r)=>{});tt(this,go,(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:y,fetchMethod:R,noDeleteOnFetchRejection:w,noDeleteOnStaleGet:B,allowStaleOnFetchRejection:Z,allowStaleOnFetchAbort:f,ignoreFetchAbort:E}=e;if(t!==0&&!Ti(t))throw new TypeError("max option must be a nonnegative integer");const S=t?LA(t):Array;if(!S)throw new Error("invalid max value: "+t);if(Ve(this,bn,t),Ve(this,Vr,_),this.maxEntrySize=b||Q(this,Vr),this.sizeCalculation=y,this.sizeCalculation){if(!Q(this,Vr)&&!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(Ve(this,Va,R),Ve(this,Ii,!!R),Ve(this,Kt,new Map),Ve(this,Dt,new Array(t).fill(void 0)),Ve(this,et,new Array(t).fill(void 0)),Ve(this,Ir,new S(t)),Ve(this,Hr,new S(t)),Ve(this,_r,0),Ve(this,sr,0),Ve(this,yn,tm.create(t)),Ve(this,Zt,0),Ve(this,vn,0),typeof c=="function"&&Ve(this,Tn,c),typeof d=="function"?(Ve(this,Cn,d),Ve(this,or,[])):(Ve(this,Cn,void 0),Ve(this,or,void 0)),Ve(this,Rn,!!Q(this,Tn)),Ve(this,Nr,!!Q(this,Cn)),this.noDisposeOnSet=!!p,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!w,this.allowStaleOnFetchRejection=!!Z,this.allowStaleOnFetchAbort=!!f,this.ignoreFetchAbort=!!E,this.maxEntrySize!==0){if(Q(this,Vr)!==0&&!Ti(Q(this,Vr)))throw new TypeError("maxSize must be a positive integer if specified");if(!Ti(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");Ge(this,tc,kA).call(this)}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!B,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!o,this.ttlResolution=Ti(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!Ti(this.ttl))throw new TypeError("ttl must be a positive integer if specified");Ge(this,ho,nm).call(this)}if(Q(this,bn)===0&&this.ttl===0&&Q(this,Vr)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!Q(this,bn)&&!Q(this,Vr)){const A="LRU_CACHE_UNBOUNDED";GP(A)&&(DA.add(A),xA("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",A,Tg))}}static unsafeExposeInternals(e){return{starts:Q(e,ni),ttls:Q(e,An),sizes:Q(e,ri),keyMap:Q(e,Kt),keyList:Q(e,Dt),valList:Q(e,et),next:Q(e,Ir),prev:Q(e,Hr),get head(){return Q(e,_r)},get tail(){return Q(e,sr)},free:Q(e,yn),isBackgroundFetch:t=>{var r;return Ge(r=e,vt,kt).call(r,t)},backgroundFetch:(t,r,i,a)=>{var s;return Ge(s=e,Wa,gl).call(s,t,r,i,a)},moveToTail:t=>{var r;return Ge(r=e,sa,Ps).call(r,t)},indexes:t=>{var r;return Ge(r=e,Un,Ci).call(r,t)},rindexes:t=>{var r;return Ge(r=e,Fn,vi).call(r,t)},isStale:t=>{var r;return Q(r=e,zr).call(r,t)}}}get max(){return Q(this,bn)}get maxSize(){return Q(this,Vr)}get calculatedSize(){return Q(this,vn)}get size(){return Q(this,Zt)}get fetchMethod(){return Q(this,Va)}get dispose(){return Q(this,Tn)}get disposeAfter(){return Q(this,Cn)}getRemainingTTL(e){return Q(this,Kt).has(e)?1/0:0}*entries(){for(const e of Ge(this,Un,Ci).call(this))Q(this,et)[e]!==void 0&&Q(this,Dt)[e]!==void 0&&!Ge(this,vt,kt).call(this,Q(this,et)[e])&&(yield[Q(this,Dt)[e],Q(this,et)[e]])}*rentries(){for(const e of Ge(this,Fn,vi).call(this))Q(this,et)[e]!==void 0&&Q(this,Dt)[e]!==void 0&&!Ge(this,vt,kt).call(this,Q(this,et)[e])&&(yield[Q(this,Dt)[e],Q(this,et)[e]])}*keys(){for(const e of Ge(this,Un,Ci).call(this)){const t=Q(this,Dt)[e];t!==void 0&&!Ge(this,vt,kt).call(this,Q(this,et)[e])&&(yield t)}}*rkeys(){for(const e of Ge(this,Fn,vi).call(this)){const t=Q(this,Dt)[e];t!==void 0&&!Ge(this,vt,kt).call(this,Q(this,et)[e])&&(yield t)}}*values(){for(const e of Ge(this,Un,Ci).call(this))Q(this,et)[e]!==void 0&&!Ge(this,vt,kt).call(this,Q(this,et)[e])&&(yield Q(this,et)[e])}*rvalues(){for(const e of Ge(this,Fn,vi).call(this))Q(this,et)[e]!==void 0&&!Ge(this,vt,kt).call(this,Q(this,et)[e])&&(yield Q(this,et)[e])}[Symbol.iterator](){return this.entries()}find(e,t={}){for(const r of Ge(this,Un,Ci).call(this)){const i=Q(this,et)[r],a=Ge(this,vt,kt).call(this,i)?i.__staleWhileFetching:i;if(a!==void 0&&e(a,Q(this,Dt)[r],this))return this.get(Q(this,Dt)[r],t)}}forEach(e,t=this){for(const r of Ge(this,Un,Ci).call(this)){const i=Q(this,et)[r],a=Ge(this,vt,kt).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,Q(this,Dt)[r],this)}}rforEach(e,t=this){for(const r of Ge(this,Fn,vi).call(this)){const i=Q(this,et)[r],a=Ge(this,vt,kt).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,Q(this,Dt)[r],this)}}purgeStale(){let e=!1;for(const t of Ge(this,Fn,vi).call(this,{allowStale:!0}))Q(this,zr).call(this,t)&&(this.delete(Q(this,Dt)[t]),e=!0);return e}dump(){const e=[];for(const t of Ge(this,Un,Ci).call(this,{allowStale:!0})){const r=Q(this,Dt)[t],i=Q(this,et)[t],a=Ge(this,vt,kt).call(this,i)?i.__staleWhileFetching:i;if(a===void 0||r===void 0)continue;const s={value:a};if(Q(this,An)&&Q(this,ni)){s.ttl=Q(this,An)[t];const o=As.now()-Q(this,ni)[t];s.start=Math.floor(Date.now()-o)}Q(this,ri)&&(s.size=Q(this,ri)[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=As.now()-i}this.set(t,r.value,r)}}set(e,t,r={}){var m,_,b,y,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=Q(this,go).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=Q(this,Zt)===0?void 0:Q(this,Kt).get(e);if(p===void 0)p=Q(this,Zt)===0?Q(this,sr):Q(this,yn).length!==0?Q(this,yn).pop():Q(this,Zt)===Q(this,bn)?Ge(this,za,ml).call(this,!1):Q(this,Zt),Q(this,Dt)[p]=e,Q(this,et)[p]=t,Q(this,Kt).set(e,p),Q(this,Ir)[Q(this,sr)]=p,Q(this,Hr)[p]=Q(this,sr),Ve(this,sr,p),Io(this,Zt)._++,Q(this,Ha).call(this,p,d,l),l&&(l.set="add"),c=!1;else{Ge(this,sa,Ps).call(this,p);const w=Q(this,et)[p];if(t!==w){if(Q(this,Ii)&&Ge(this,vt,kt).call(this,w)){w.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:B}=w;B!==void 0&&!s&&(Q(this,Rn)&&((m=Q(this,Tn))==null||m.call(this,B,e,"set")),Q(this,Nr)&&((_=Q(this,or))==null||_.push([B,e,"set"])))}else s||(Q(this,Rn)&&((b=Q(this,Tn))==null||b.call(this,w,e,"set")),Q(this,Nr)&&((y=Q(this,or))==null||y.push([w,e,"set"])));if(Q(this,aa).call(this,p),Q(this,Ha).call(this,p,d,l),Q(this,et)[p]=t,l){l.set="replace";const B=w&&Ge(this,vt,kt).call(this,w)?w.__staleWhileFetching:w;B!==void 0&&(l.oldValue=B)}}else l&&(l.set="update")}if(i!==0&&!Q(this,An)&&Ge(this,ho,nm).call(this),Q(this,An)&&(c||Q(this,mo).call(this,p,i,a),l&&Q(this,ii).call(this,l,p)),!s&&Q(this,Nr)&&Q(this,or)){const w=Q(this,or);let B;for(;B=w==null?void 0:w.shift();)(R=Q(this,Cn))==null||R.call(this,...B)}return this}pop(){var e;try{for(;Q(this,Zt);){const t=Q(this,et)[Q(this,_r)];if(Ge(this,za,ml).call(this,!0),Ge(this,vt,kt).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(Q(this,Nr)&&Q(this,or)){const t=Q(this,or);let r;for(;r=t==null?void 0:t.shift();)(e=Q(this,Cn))==null||e.call(this,...r)}}}has(e,t={}){const{updateAgeOnHas:r=this.updateAgeOnHas,status:i}=t,a=Q(this,Kt).get(e);if(a!==void 0){const s=Q(this,et)[a];if(Ge(this,vt,kt).call(this,s)&&s.__staleWhileFetching===void 0)return!1;if(Q(this,zr).call(this,a))i&&(i.has="stale",Q(this,ii).call(this,i,a));else return r&&Q(this,ia).call(this,a),i&&(i.has="hit",Q(this,ii).call(this,i,a)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){const{allowStale:r=this.allowStale}=t,i=Q(this,Kt).get(e);if(i!==void 0&&(r||!Q(this,zr).call(this,i))){const a=Q(this,et)[i];return Ge(this,vt,kt).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:y,forceRefresh:R=!1,status:w,signal:B}=t;if(!Q(this,Ii))return w&&(w.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:a,status:w});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:w,signal:B};let f=Q(this,Kt).get(e);if(f===void 0){w&&(w.fetch="miss");const E=Ge(this,Wa,gl).call(this,e,f,Z,y);return E.__returned=E}else{const E=Q(this,et)[f];if(Ge(this,vt,kt).call(this,E)){const D=r&&E.__staleWhileFetching!==void 0;return w&&(w.fetch="inflight",D&&(w.returnedStale=!0)),D?E.__staleWhileFetching:E.__returned=E}const S=Q(this,zr).call(this,f);if(!R&&!S)return w&&(w.fetch="hit"),Ge(this,sa,Ps).call(this,f),i&&Q(this,ia).call(this,f),w&&Q(this,ii).call(this,w,f),E;const A=Ge(this,Wa,gl).call(this,e,f,Z,y),x=A.__staleWhileFetching!==void 0&&r;return w&&(w.fetch=S?"stale":"refresh",x&&S&&(w.returnedStale=!0)),x?A.__staleWhileFetching:A.__returned=A}}get(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:s}=t,o=Q(this,Kt).get(e);if(o!==void 0){const l=Q(this,et)[o],c=Ge(this,vt,kt).call(this,l);return s&&Q(this,ii).call(this,s,o),Q(this,zr).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:(Ge(this,sa,Ps).call(this,o),i&&Q(this,ia).call(this,o),l))}else s&&(s.get="miss")}delete(e){var r,i,a,s;let t=!1;if(Q(this,Zt)!==0){const o=Q(this,Kt).get(e);if(o!==void 0)if(t=!0,Q(this,Zt)===1)this.clear();else{Q(this,aa).call(this,o);const l=Q(this,et)[o];Ge(this,vt,kt).call(this,l)?l.__abortController.abort(new Error("deleted")):(Q(this,Rn)||Q(this,Nr))&&(Q(this,Rn)&&((r=Q(this,Tn))==null||r.call(this,l,e,"delete")),Q(this,Nr)&&((i=Q(this,or))==null||i.push([l,e,"delete"]))),Q(this,Kt).delete(e),Q(this,Dt)[o]=void 0,Q(this,et)[o]=void 0,o===Q(this,sr)?Ve(this,sr,Q(this,Hr)[o]):o===Q(this,_r)?Ve(this,_r,Q(this,Ir)[o]):(Q(this,Ir)[Q(this,Hr)[o]]=Q(this,Ir)[o],Q(this,Hr)[Q(this,Ir)[o]]=Q(this,Hr)[o]),Io(this,Zt)._--,Q(this,yn).push(o)}}if(Q(this,Nr)&&((a=Q(this,or))!=null&&a.length)){const o=Q(this,or);let l;for(;l=o==null?void 0:o.shift();)(s=Q(this,Cn))==null||s.call(this,...l)}return t}clear(){var e,t,r;for(const i of Ge(this,Fn,vi).call(this,{allowStale:!0})){const a=Q(this,et)[i];if(Ge(this,vt,kt).call(this,a))a.__abortController.abort(new Error("deleted"));else{const s=Q(this,Dt)[i];Q(this,Rn)&&((e=Q(this,Tn))==null||e.call(this,a,s,"delete")),Q(this,Nr)&&((t=Q(this,or))==null||t.push([a,s,"delete"]))}}if(Q(this,Kt).clear(),Q(this,et).fill(void 0),Q(this,Dt).fill(void 0),Q(this,An)&&Q(this,ni)&&(Q(this,An).fill(0),Q(this,ni).fill(0)),Q(this,ri)&&Q(this,ri).fill(0),Ve(this,_r,0),Ve(this,sr,0),Q(this,yn).length=0,Ve(this,vn,0),Ve(this,Zt,0),Q(this,Nr)&&Q(this,or)){const i=Q(this,or);let a;for(;a=i==null?void 0:i.shift();)(r=Q(this,Cn))==null||r.call(this,...a)}}};bn=new WeakMap,Vr=new WeakMap,Tn=new WeakMap,Cn=new WeakMap,Va=new WeakMap,Zt=new WeakMap,vn=new WeakMap,Kt=new WeakMap,Dt=new WeakMap,et=new WeakMap,Ir=new WeakMap,Hr=new WeakMap,_r=new WeakMap,sr=new WeakMap,yn=new WeakMap,or=new WeakMap,ri=new WeakMap,ni=new WeakMap,An=new WeakMap,Rn=new WeakMap,Ii=new WeakMap,Nr=new WeakMap,ho=new WeakSet,nm=function(){const e=new hl(Q(this,bn)),t=new hl(Q(this,bn));Ve(this,An,e),Ve(this,ni,t),Ve(this,mo,(a,s,o=As.now())=>{if(t[a]=s!==0?o:0,e[a]=s,s!==0&&this.ttlAutopurge){const l=setTimeout(()=>{Q(this,zr).call(this,a)&&this.delete(Q(this,Dt)[a])},s+1);l.unref&&l.unref()}}),Ve(this,ia,a=>{t[a]=e[a]!==0?As.now():0}),Ve(this,ii,(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=As.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=Q(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},Ve(this,zr,a=>e[a]!==0&&t[a]!==0&&(r||i())-t[a]>e[a])},ia=new WeakMap,ii=new WeakMap,mo=new WeakMap,zr=new WeakMap,tc=new WeakSet,kA=function(){const e=new hl(Q(this,bn));Ve(this,vn,0),Ve(this,ri,e),Ve(this,aa,t=>{Ve(this,vn,Q(this,vn)-e[t]),e[t]=0}),Ve(this,go,(t,r,i,a)=>{if(Ge(this,vt,kt).call(this,r))return 0;if(!Ti(i))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(i=a(r,t),!Ti(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}),Ve(this,Ha,(t,r,i)=>{if(e[t]=r,Q(this,Vr)){const a=Q(this,Vr)-e[t];for(;Q(this,vn)>a;)Ge(this,za,ml).call(this,!0)}Ve(this,vn,Q(this,vn)+e[t]),i&&(i.entrySize=r,i.totalCalculatedSize=Q(this,vn))})},aa=new WeakMap,Ha=new WeakMap,go=new WeakMap,Un=new WeakSet,Ci=function*({allowStale:e=this.allowStale}={}){if(Q(this,Zt))for(let t=Q(this,sr);!(!Ge(this,_o,im).call(this,t)||((e||!Q(this,zr).call(this,t))&&(yield t),t===Q(this,_r)));)t=Q(this,Hr)[t]},Fn=new WeakSet,vi=function*({allowStale:e=this.allowStale}={}){if(Q(this,Zt))for(let t=Q(this,_r);!(!Ge(this,_o,im).call(this,t)||((e||!Q(this,zr).call(this,t))&&(yield t),t===Q(this,sr)));)t=Q(this,Ir)[t]},_o=new WeakSet,im=function(e){return e!==void 0&&Q(this,Kt).get(Q(this,Dt)[e])===e},za=new WeakSet,ml=function(e){var a,s;const t=Q(this,_r),r=Q(this,Dt)[t],i=Q(this,et)[t];return Q(this,Ii)&&Ge(this,vt,kt).call(this,i)?i.__abortController.abort(new Error("evicted")):(Q(this,Rn)||Q(this,Nr))&&(Q(this,Rn)&&((a=Q(this,Tn))==null||a.call(this,i,r,"evict")),Q(this,Nr)&&((s=Q(this,or))==null||s.push([i,r,"evict"]))),Q(this,aa).call(this,t),e&&(Q(this,Dt)[t]=void 0,Q(this,et)[t]=void 0,Q(this,yn).push(t)),Q(this,Zt)===1?(Ve(this,_r,Ve(this,sr,0)),Q(this,yn).length=0):Ve(this,_r,Q(this,Ir)[t]),Q(this,Kt).delete(r),Io(this,Zt)._--,t},Wa=new WeakSet,gl=function(e,t,r,i){const a=t===void 0?void 0:Q(this,et)[t];if(Ge(this,vt,kt).call(this,a))return a;const s=new Zl,{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=(y,R=!1)=>{const{aborted:w}=s.signal,B=r.ignoreFetchAbort&&y!==void 0;if(r.status&&(w&&!R?(r.status.fetchAborted=!0,r.status.fetchError=s.signal.reason,B&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),w&&!B&&!R)return p(s.signal.reason);const Z=_;return Q(this,et)[t]===_&&(y===void 0?Z.__staleWhileFetching?Q(this,et)[t]=Z.__staleWhileFetching:this.delete(e):(r.status&&(r.status.fetchUpdated=!0),this.set(e,y,l.options))),y},d=y=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=y),p(y)),p=y=>{const{aborted:R}=s.signal,w=R&&r.allowStaleOnFetchAbort,B=w||r.allowStaleOnFetchRejection,Z=B||r.noDeleteOnFetchRejection,f=_;if(Q(this,et)[t]===_&&(!Z||f.__staleWhileFetching===void 0?this.delete(e):w||(Q(this,et)[t]=f.__staleWhileFetching)),B)return r.status&&f.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),f.__staleWhileFetching;if(f.__returned===f)throw y},m=(y,R)=>{var B;const w=(B=Q(this,Va))==null?void 0:B.call(this,e,a,l);w&&w instanceof Promise&&w.then(Z=>y(Z===void 0?void 0:Z),R),s.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(y(void 0),r.allowStaleOnFetchAbort&&(y=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=Q(this,Kt).get(e)):Q(this,et)[t]=b,b},vt=new WeakSet,kt=function(e){if(!Q(this,Ii))return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Zl},So=new WeakSet,am=function(e,t){Q(this,Hr)[t]=e,Q(this,Ir)[e]=t},sa=new WeakSet,Ps=function(e){e!==Q(this,sr)&&(e===Q(this,_r)?Ve(this,_r,Q(this,Ir)[e]):Ge(this,So,am).call(this,Q(this,Hr)[e],Q(this,Ir)[e]),Ge(this,So,am).call(this,Q(this,sr),e),Ve(this,sr,e))};let rm=Tg;const $s=class $s{constructor(){v(this,"_fallbackMethod",()=>$s.createSkipProxy());v(this,"out",()=>{})}};v($s,"createSkipProxy",()=>{const e=new $s;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 Kl=$s;const Qs=class Qs extends ug{constructor(t,r){super(r);v(this,"_fallbackMethod",()=>Qs.createRestProxy(this.values.duration,this.app));v(this,"out",()=>{});this.values.duration=t}};v(Qs,"createRestProxy",(t,r)=>{const i=new Qs(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 jl=Qs;class $P extends ug{constructor(t,r,i){super(i);v(this,"input");v(this,"ziffers");v(this,"initCallTime",1);v(this,"startCallTime",1);v(this,"lastCallTime",1);v(this,"waitTime",0);v(this,"startBeat",0);v(this,"played",!1);v(this,"current");v(this,"retro",!1);v(this,"index",-1);v(this,"zid","");v(this,"options",{});v(this,"skipIndex",0);v(this,"endTime",0);v(this,"next",()=>(this.current=this.ziffers.next(),this.played=!0,this.current));v(this,"pulseToSecond",t=>this.app.clock.convertPulseToSecond(t));v(this,"firstRun",()=>this.notStarted());v(this,"atTheBeginning",()=>this.skipIndex===0&&this.ziffers.index<=0);v(this,"origin",()=>this.app.clock.pulses_since_origin+1);v(this,"pulse",()=>this.app.clock.time_position.pulse);v(this,"beat",()=>this.app.clock.time_position.beat);v(this,"nextBeat",()=>this.app.clock.next_beat_in_ticks);v(this,"nextBeatInTicks",()=>this.app.clock.next_beat_in_ticks);v(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});v(this,"out",()=>{});this.app=i,this.input=t,this.options=r,this.ziffers=new tP(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 Bi){const i=r.getExisting("freq","pitch","key","scale","octave","parsedScale");return new NA(i,this.app).sound(t)}else if(r instanceof jh)return jl.createRestProxy(r.duration,this.app)}else return Kl.createSkipProxy()}midi(t=void 0){if(this.areWeThereYet()){const r=this.next();if(r instanceof Bi){const i=r.getExisting("note","pitch","bend","key","scale","octave","parsedScale"),a=new wA(i,this.app);return t?a.note(t):a}else if(r instanceof jh)return jl.createRestProxy(r.duration,this.app)}else return Kl.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}}const QP=n=>n[0]==="{"&&n[n.length-1]==="}",Rs=(n,e)=>{if(QP(n)){const t=JSON.parse(n);return JSON.stringify({...t,...e})}else return JSON.stringify({...e,text:n})},qP=n=>{String.prototype.speak=function(){const e=JSON.parse(this.valueOf());new MA({...e,text:e.text}).speak().then(()=>{}).catch(t=>{console.log("Error speaking:",t)})},String.prototype.rate=function(e){return Rs(this.valueOf(),{rate:e})},String.prototype.pitch=function(e){return Rs(this.valueOf(),{pitch:e})},String.prototype.lang=function(e){return Rs(this.valueOf(),{lang:e})},String.prototype.volume=function(e){return Rs(this.valueOf(),{volume:e})},String.prototype.voice=function(e){return Rs(this.valueOf(),{voice:e})},String.prototype.z=function(){return n.z(this.valueOf())}};let cu;class MA{constructor(e){v(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(),cu&&clearTimeout(cu),cu=setTimeout(()=>{r.speak(i)},200)):r.speak(i)}else t("No text provided")}));this.options=e}}async function RO(){return Promise.all([EP(),Xl("github:tidalcycles/Dirt-Samples/master").then(()=>MP()),YP(),Xl("github:Bubobubobubobubo/Topos-Samples/main")])}class VP{constructor(e){v(this,"variables",{});v(this,"codeExamples",{});v(this,"counters",{});v(this,"_drunk",new iP(-100,100,!1));v(this,"randomGen",Math.random);v(this,"currentSeed");v(this,"localSeeds",new Map);v(this,"patternCache",new rm({max:1e3,ttl:1e3*60*5}));v(this,"errorTimeoutID",0);v(this,"printTimeoutID",0);v(this,"MidiConnection",new nP);v(this,"load");v(this,"_loadUniverseFromInterface",e=>{this.app.loadUniverse(e),this.app.openBuffersModal()});v(this,"_deleteUniverseFromInterface",e=>{delete this.app.universes[e],this.app.settings.saveApplicationToLocalStorage(this.app.universes,this.app.settings),this.app.updateKnownUniversesView()});v(this,"_playDocExample",e=>{this.play(),console.log("Executing documentation example: "+this.app.selectedExample),this.app.universes[this.app.selected_universe].global.candidate=e||this.app.selectedExample,oo(this.app,this.app.universes[this.app.selected_universe].global)});v(this,"_playDocExampleOnce",e=>{this.play(),console.log("Executing documentation example: "+this.app.selectedExample),RM(this.app,e)});v(this,"_all_samples",()=>dg.get());v(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)});v(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)});v(this,"time",()=>this.app.audioContext.currentTime);v(this,"play",()=>{this.app.setButtonHighlighting("play",!0),this.app.clock.start()});v(this,"pause",()=>{this.app.setButtonHighlighting("pause",!0),this.app.clock.pause()});v(this,"stop",()=>{this.app.setButtonHighlighting("stop",!0),this.app.clock.stop()});v(this,"silence",this.stop);v(this,"hush",this.stop);v(this,"onmousemove",e=>{this.app._mouseX=e.clientX,this.app._mouseY=e.clientY});v(this,"mouseX",()=>this.app._mouseX);v(this,"mouseY",()=>this.app._mouseY);v(this,"noteX",()=>Math.floor(this.app._mouseX/document.body.clientWidth*127));v(this,"noteY",()=>Math.floor(this.app._mouseY/document.body.clientHeight*127));v(this,"script",(...e)=>{e.forEach(t=>{oo(this.app,this.app.universes[this.app.selected_universe].locals[t])})});v(this,"s",this.script);v(this,"clear_script",e=>{this.app.universes[this.app.selected_universe].locals[e]={candidate:"",committed:"",evaluations:0}});v(this,"cs",this.clear_script);v(this,"copy_script",(e,t)=>{this.app.universes[this.app.selected_universe].locals[t]=this.app.universes[this.app.selected_universe].locals[e]});v(this,"cps",this.copy_script);v(this,"midi_outputs",()=>{this._logMessage(this.MidiConnection.listMidiOutputs())});v(this,"midi_output",e=>{e?this.MidiConnection.switchMidiOutput(e):console.log(this.MidiConnection.getCurrentMidiPort())});v(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 wA(e,this.app)));v(this,"sysex",e=>{this.MidiConnection.sendSysExMessage(e)});v(this,"pitch_bend",(e,t)=>{this.MidiConnection.sendPitchBend(e,t)});v(this,"program_change",(e,t)=>{this.MidiConnection.sendProgramChange(e,t)});v(this,"midi_clock",()=>{this.MidiConnection.sendMidiClock()});v(this,"control_change",({control:e=20,value:t=0,channel:r=0})=>{this.MidiConnection.sendMidiControlChange(e,t,r)});v(this,"midi_panic",()=>{this.MidiConnection.panic()});v(this,"generateCacheKey",(...e)=>e.map(t=>JSON.stringify(t)).join(","));v(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 $P(e,t,this.app),this.app.api.patternCache.set(a,s)),typeof r=="number"&&(s.zid=i),s.updateLastCallTime(),s});v(this,"z0",(e,t={})=>this.z(e,t,0));v(this,"z1",(e,t={})=>this.z(e,t,1));v(this,"z2",(e,t={})=>this.z(e,t,2));v(this,"z3",(e,t={})=>this.z(e,t,3));v(this,"z4",(e,t={})=>this.z(e,t,4));v(this,"z5",(e,t={})=>this.z(e,t,5));v(this,"z6",(e,t={})=>this.z(e,t,6));v(this,"z7",(e,t={})=>this.z(e,t,7));v(this,"z8",(e,t={})=>this.z(e,t,8));v(this,"z9",(e,t={})=>this.z(e,t,9));v(this,"z10",(e,t={})=>this.z(e,t,10));v(this,"z11",(e,t={})=>this.z(e,t,11));v(this,"z12",(e,t={})=>this.z(e,t,12));v(this,"z13",(e,t={})=>this.z(e,t,13));v(this,"z14",(e,t={})=>this.z(e,t,14));v(this,"z15",(e,t={})=>this.z(e,t,15));v(this,"z16",(e,t={})=>this.z(e,t,16));v(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));v(this,"$",this.counter);v(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);v(this,"drunk",e=>e!==void 0?(this._drunk.position=e,this._drunk.getPosition()):(this._drunk.step(),this._drunk.getPosition()));v(this,"drunk_max",e=>{this._drunk.max=e});v(this,"drunk_min",e=>{this._drunk.min=e});v(this,"drunk_wrap",e=>{this._drunk.toggleWrap(e)});v(this,"variable",(e,t)=>typeof e=="string"&&t===void 0?this.variables[e]:(this.variables[e]=t,this.variables[e]));v(this,"v",this.variable);v(this,"delete_variable",e=>{delete this.variables[e]});v(this,"dv",this.delete_variable);v(this,"clear_variables",()=>{this.variables={}});v(this,"cv",this.clear_variables);v(this,"randI",(e,t)=>Math.floor(this.randomGen()*(t-e+1))+e);v(this,"rand",(e,t)=>this.randomGen()*(t-e)+e);v(this,"irand",this.randI);v(this,"rI",this.randI);v(this,"r",this.rand);v(this,"ir",this.randI);v(this,"seed",e=>{typeof e=="number"&&(e=e.toString()),this.currentSeed!==e&&(this.currentSeed=e,this.randomGen=Kh(e))});v(this,"localSeededRandom",e=>{if(typeof e=="number"&&(e=e.toString()),this.localSeeds.has(e))return this.localSeeds.get(e);const t=Kh(e);return this.localSeeds.set(e,t),t});v(this,"clearLocalSeed",(e=void 0)=>{e&&this.localSeeds.delete(e.toString()),this.localSeeds.clear()});v(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));v(this,"cmp",this.clamp);v(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));v(this,"tempo",this.bpm);v(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));v(this,"ppqn",e=>e===void 0?this.app.clock.ppqn:(e<1&&console.log(`Setting ppqn to ${e}`),this.app.clock.ppqn=e,e));v(this,"time_signature",(e,t)=>{this.app.clock.time_signature=[e,t]});v(this,"prob",e=>this.randomGen()*100this.randomGen()>.5);v(this,"odds",(e,t=15)=>this.randomGen()this.randomGen()<.025*this.ppqn()/(this.ppqn()*e));v(this,"rarely",(e=15)=>this.randomGen()<.1*this.ppqn()/(this.ppqn()*e));v(this,"scarcely",(e=15)=>this.randomGen()<.25*this.ppqn()/(this.ppqn()*e));v(this,"sometimes",(e=15)=>this.randomGen()<.5*this.ppqn()/(this.ppqn()*e));v(this,"often",(e=15)=>this.randomGen()<.75*this.ppqn()/(this.ppqn()*e));v(this,"frequently",(e=15)=>this.randomGen()<.9*this.ppqn()/(this.ppqn()*e));v(this,"almostAlways",(e=15)=>this.randomGen()<.985*this.ppqn()/(this.ppqn()*e));v(this,"dice",e=>Math.floor(this.randomGen()*e)+1);v(this,"bar",()=>this.app.clock.time_position.bar+1);v(this,"tick",()=>this.app.clock.tick+1);v(this,"pulse",()=>this.app.clock.time_position.pulse+1);v(this,"beat",()=>this.app.clock.time_position.beat+1);v(this,"ebeat",()=>this.app.clock.beats_since_origin+1);v(this,"epulse",()=>this.app.clock.pulses_since_origin+1);v(this,"nominator",()=>this.app.clock.time_signature[0]);v(this,"meter",()=>this.app.clock.time_signature[1]);v(this,"denominator",this.meter);v(this,"mod",(...e)=>e.map(r=>this.app.clock.pulses_since_origin%Math.floor(r*this.ppqn())===0).some(r=>r===!0));v(this,"modpulse",(...e)=>e.map(r=>this.app.clock.pulses_since_origin%r===0).some(r=>r===!0));v(this,"modp",this.modpulse);v(this,"modbar",(...e)=>e.map(r=>this.app.clock.time_position.bar%Math.floor(r*this.ppqn())===0).some(r=>r===!0));v(this,"modb",this.modbar);v(this,"div",e=>{const t=this.app.clock.pulses_since_origin;return Math.floor(t/Math.floor(e*this.ppqn()))%2===0});v(this,"divbar",e=>{const t=this.app.clock.time_position.bar-1;return Math.floor(t/e)%2===0});v(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)});v(this,"onbeat",(...e)=>{let t=[];return e.forEach(r=>{const i=r%this.nominator()||this.nominator(),a=Math.floor(i),s=(i-a)*this.ppqn()+1;t.push(a===this.beat()&&this.pulse()===s)}),t.some(r=>r==!0)});v(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)});v(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)});v(this,"delay",(e,t)=>{setTimeout(t,e)});v(this,"delayr",(e,t,r)=>{[...Array(t).keys()].map(a=>e*a).forEach((a,s)=>{setTimeout(r,a)})});v(this,"euclid",(e,t,r,i=0)=>this._euclidean_cycle(t,r,i)[e%r]);v(this,"ec",this.euclid);v(this,"rhythm",(e,t,r,i=0)=>this.mod(e)&&this._euclidean_cycle(t,r,i).div(e));v(this,"bin",(e,t)=>{let i=t.toString(2).split("").map(a=>a==="1");return i[e%i.length]});v(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);v(this,"usine",(e=1,t=0)=>(this.sine(e,t)+1)/2);v(this,"saw",(e=1,t=0)=>this.app.clock.ctx.currentTime*e%1*2-1+t);v(this,"usaw",(e=1,t=0)=>(this.saw(e,t)+1)/2);v(this,"triangle",(e=1,t=0)=>Math.abs(this.saw(e,t))*2-1);v(this,"utriangle",(e=1,t=0)=>(this.triangle(e,t)+1)/2);v(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);v(this,"noise",()=>this.randomGen()*2-1);v(this,"min",(...e)=>Math.min(...e));v(this,"max",(...e)=>Math.max(...e));v(this,"mean",(...e)=>e.reduce((r,i)=>r+i,0)/e.length);v(this,"limit",(e,t,r)=>Math.min(Math.max(e,t),r));v(this,"abs",Math.abs);v(this,"speak",(e,t="en-US",r=0,i=1,a=1)=>{new MA({text:e,lang:t,voice:r,rate:i,pitch:a}).speak().then(()=>{}).catch(o=>{console.log(o)})});v(this,"sound",e=>new NA(e,this.app));v(this,"snd",this.sound);v(this,"samples",Xl);v(this,"log",e=>{console.log(e),this._logMessage(e)});v(this,"scale",sP);v(this,"rate",e=>{});v(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]});v(this,"seqbeat",(...e)=>e[this.app.clock.time_position.beat%e.length]);v(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 HP=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.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(Math.random()*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|(Lt&21845)<<1;bi=(bi&52428)>>2|(bi&13107)<<2,bi=(bi&61680)>>4|(bi&3855)<<4,lm[Lt]=((bi&65280)>>8|(bi&255)<<8)>>1}var Hn=function(n,e,t){for(var r=n.length,i=0,a=new Jr(e);i>l]=c}else for(o=new Jr(r),i=0;i>15-n[i]);return o},Ui=new fr(288);for(var Lt=0;Lt<144;++Lt)Ui[Lt]=8;for(var Lt=144;Lt<256;++Lt)Ui[Lt]=9;for(var Lt=256;Lt<280;++Lt)Ui[Lt]=7;for(var Lt=280;Lt<288;++Lt)Ui[Lt]=8;var uo=new fr(32);for(var Lt=0;Lt<32;++Lt)uo[Lt]=5;var WP=Hn(Ui,9,0),XP=Hn(Ui,9,1),ZP=Hn(uo,5,0),KP=Hn(uo,5,1),uu=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},En=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},du=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},mg=function(n){return(n+7)/8|0},gg=function(n,e,t){(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length);var r=new fr(t-e);return r.set(n.subarray(e,t)),r},jP=["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"],Mr=function(n,e,t){var r=new Error(e||jP[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,Mr),!t)throw r;return r},_g=function(n,e,t,r){var i=n.length,a=r?r.length:0;if(!i||e.f&&!e.l)return t||new fr(0);var s=!t||e.i!=2,o=e.i;t||(t=new fr(i*3));var l=function(Fe){var Je=t.length;if(Fe>Je){var nt=new fr(Math.max(Je*2,Fe));nt.set(t),t=nt}},c=e.f||0,d=e.p||0,p=e.b||0,m=e.l,_=e.d,b=e.m,y=e.n,R=i*8;do{if(!m){c=En(n,d,1);var w=En(n,d+1,3);if(d+=3,w)if(w==1)m=XP,_=KP,b=9,y=5;else if(w==2){var E=En(n,d,31)+257,S=En(n,d+10,15)+4,A=E+En(n,d+5,31)+1;d+=14;for(var N=new fr(A),x=new fr(19),D=0;D>4;if(B<16)N[D++]=B;else{var re=0,L=0;for(B==16?(L=3+En(n,d,3),d+=2,re=N[D-1]):B==17?(L=3+En(n,d,7),d+=3):B==18&&(L=11+En(n,d,127),d+=7);L--;)N[D++]=re}}var F=N.subarray(0,E),K=N.subarray(E);b=uu(F),y=uu(K),m=Hn(F,b,1),_=Hn(K,y,1)}else Mr(1);else{var B=mg(d)+4,Z=n[B-4]|n[B-3]<<8,f=B+Z;if(f>i){o&&Mr(0);break}s&&l(p+Z),t.set(n.subarray(B,f),p),e.b=p+=Z,e.p=d=f*8,e.f=c;continue}if(d>R){o&&Mr(0);break}}s&&l(p+131072);for(var X=(1<>4;if(d+=re&15,d>R){o&&Mr(0);break}if(re||Mr(2),ge<256)t[p++]=ge;else if(ge==256){ae=d,m=null;break}else{var Ne=ge-254;if(ge>264){var D=ge-257,we=mc[D];Ne=En(n,d,(1<>4;be||Mr(3),d+=be&15;var K=zP[Ae];if(Ae>3){var we=gc[Ae];K+=du(n,d)&(1<R){o&&Mr(0);break}s&&l(p+131072);var ce=p+Ne;if(p>8},Is=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},pu=function(n,e){for(var t=[],r=0;rm&&(m=a[r].s);var _=new Jr(m+1),b=cm(t[d-1],_,0);if(b>e){var r=0,y=0,R=b-e,w=1<e)y+=w-(1<>=R;y>0;){var Z=a[r].s;_[Z]=0&&y;--r){var f=a[r].s;_[f]==e&&(--_[f],++y)}b=e}return{t:new fr(_),l:b}},cm=function(n,e,t){return n.s==-1?Math.max(cm(n.l,e,t+1),cm(n.r,e,t+1)):e[n.s]=t},NO=function(n){for(var e=n.length;e&&!n[--e];);for(var t=new Jr(++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}},Ns=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&&!D[sm[ee-1]];--ee);var ie=c+5<<3,ne=Ns(i,Ui)+Ns(a,uo)+s,re=Ns(i,m)+Ns(a,y)+s+14+3*ee+Ns(A,D)+2*A[16]+3*A[17]+7*A[18];if(l>=0&&ie<=ne&&ie<=re)return YA(e,d,n.subarray(l,l+c));var L,F,K,X;if(ei(e,d,1+(re15&&(ei(e,d,Ne[N]>>5&127),d+=Ne[N]>>12)}}else L=WP,F=Ui,K=ZP,X=uo;for(var N=0;N255){var we=be>>18&31;Is(e,d,L[we+257]),d+=F[we+257],we>7&&(ei(e,d,be>>23&31),d+=mc[we]);var Ae=be&31;Is(e,d,K[Ae]),d+=X[Ae],Ae>3&&(Is(e,d,be>>5&8191),d+=gc[Ae])}else Is(e,d,L[be]),d+=F[be]}return Is(e,d,L[256]),d+F[256]},JP=new hg([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),GA=new fr(0),e3=function(n,e,t,r,i,a){var s=a.z||n.length,o=new fr(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=JP[e-1],m=p>>13,_=p&8191,b=(1<7e3||D>24576)&&(L>423||!c)){d=wO(n,l,0,f,E,S,N,D,ee,x-ee,d),D=A=N=0,ee=x;for(var F=0;F<286;++F)E[F]=0;for(var F=0;F<30;++F)S[F]=0}var K=2,X=0,le=_,ae=ne-re&32767;if(L>2&&ie==Z(x-ae))for(var ge=Math.min(m,L)-1,Ne=Math.min(32767,x),we=Math.min(258,L);ae<=Ne&&--le&&ne!=re;){if(n[x+K]==n[x+K-ae]){for(var be=0;beK){if(K=be,X=ae,be>ge)break;for(var Ae=Math.min(ae,be-2),ce=0,F=0;Fce&&(ce=Fe,re=De)}}}ne=re,re=y[ne],ae+=ne-re&32767}if(X){f[D++]=268435456|om[K]<<18|IO[X];var Je=om[K]&31,nt=IO[X]&31;N+=mc[Je]+gc[nt],++E[257+Je],++S[nt],U=x+K,++A}else f[D++]=n[x],++E[n[x]]}}for(x=Math.max(x,U);x=s&&(l[d/8|0]=c,mt=s),d=YA(l,d+1,n.subarray(x,mt))}a.i=s}return gg(o,0,r+mg(d)+i)},t3=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}}},n3=function(n,e,t,r,i){if(!i&&(i={l:1},e.dictionary)){var a=e.dictionary.subarray(-32768),s=new fr(a.length+n.length);s.set(a),s.set(n,a.length),n=s,i.w=a.length}return e3(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)},um=function(n,e,t){for(;t;++e)n[e]=t,t>>>=8},i3=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&&um(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)}},a3=function(n){(n[0]!=31||n[1]!=139||n[2]!=8)&&Mr(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)},s3=function(n){var e=n.length;return(n[e-4]|n[e-3]<<8|n[e-2]<<16|n[e-1]<<24)>>>0},o3=function(n){return 10+(n.filename?n.filename.length+1:0)},l3=function(n,e){return((n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&Mr(6,"invalid zlib data"),(n[1]>>5&1)==+!e&&Mr(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function c3(n,e){return _g(n,{i:2},e&&e.out,e&&e.dictionary)}function u3(n,e){e||(e={});var t=r3(),r=n.length;t.p(n);var i=n3(n,e,o3(e),8),a=i.length;return i3(i,e),um(i,a-8,t.d()),um(i,a-4,r),i}function d3(n,e){var t=a3(n);return t+8>n.length&&Mr(6,"invalid gzip data"),_g(n.subarray(t,-8),{i:2},e&&e.out||new fr(s3(n)),e&&e.dictionary)}function p3(n,e){return _g(n.subarray(l3(n,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}function f3(n,e){return n[0]==31&&n[1]==139&&n[2]==8?d3(n,e):(n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31?c3(n,e):p3(n,e)}var dm=typeof TextDecoder<"u"&&new TextDecoder,h3=0;try{dm.decode(GA,{stream:!0}),h3=1}catch{}var m3=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:gg(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(f===!1)return JSON.parse(JSON.stringify(E));var S={};for(var A in E)E.hasOwnProperty(A)&&(S[A]=E[A].defaultValue);return S}function t(){var f=e(!0),E={};for(var S in f)f.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(f,E){return s[f]=E,this},r.getOption=function(f){return s[f]},r.getOptions=function(){return s},r.resetOptions=function(){s=e(!0)},r.setFlavor=function(f){if(!l.hasOwnProperty(f))throw Error(f+" flavor was not found");r.resetOptions();var E=l[f];o=f;for(var S in E)E.hasOwnProperty(S)&&(s[S]=E[S])},r.getFlavor=function(){return o},r.getFlavorOptions=function(f){if(l.hasOwnProperty(f))return l[f]},r.getDefaultOptions=function(f){return e(f)},r.subParser=function(f,E){if(r.helper.isString(f))if(typeof E<"u")i[f]=E;else{if(i.hasOwnProperty(f))return i[f];throw Error("SubParser named "+f+" not registered!")}},r.extension=function(f,E){if(!r.helper.isString(f))throw Error("Extension 'name' must be a string");if(f=r.helper.stdExtName(f),r.helper.isUndefined(E)){if(!a.hasOwnProperty(f))throw Error("Extension named "+f+" is not registered!");return a[f]}else{typeof E=="function"&&(E=E()),r.helper.isArray(E)||(E=[E]);var S=c(E,f);if(S.valid)a[f]=E;else throw Error(S.error)}},r.getAllExtensions=function(){return a},r.removeExtension=function(f){delete a[f]},r.resetExtensions=function(){a={}};function c(f,E){var S=E?"Error in "+E+" extension->":"Error in unnamed extension",A={valid:!0,error:""};r.helper.isArray(f)||(f=[f]);for(var N=0;N"u"},r.helper.forEach=function(f,E){if(r.helper.isUndefined(f))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 f.forEach=="function")f.forEach(E);else if(r.helper.isArray(f))for(var S=0;S").replace(/&/g,"&")};var p=function(f,E,S,A){var N=A||"",x=N.indexOf("g")>-1,D=new RegExp(E+"|"+S,"g"+N.replace(/g/g,"")),U=new RegExp(E,N.replace(/g/g,"")),ee=[],ie,ne,re,L,F;do for(ie=0;re=D.exec(f);)if(U.test(re[0]))ie++||(ne=D.lastIndex,L=ne-re[0].length);else if(ie&&!--ie){F=re.index+re[0].length;var K={left:{start:L,end:ne},match:{start:ne,end:re.index},right:{start:re.index,end:F},wholeMatch:{start:L,end:F}};if(ee.push(K),!x)return ee}while(ie&&(D.lastIndex=ne));return ee};r.helper.matchRecursiveRegExp=function(f,E,S,A){for(var N=p(f,E,S,A),x=[],D=0;D0){var ie=[];D[0].wholeMatch.start!==0&&ie.push(f.slice(0,D[0].wholeMatch.start));for(var ne=0;ne=0?A+(S||0):A},r.helper.splitAtIndex=function(f,E){if(!r.helper.isString(f))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";return[f.substring(0,E),f.substring(E)]},r.helper.encodeEmailAddress=function(f){var E=[function(S){return"&#"+S.charCodeAt(0)+";"},function(S){return"&#x"+S.charCodeAt(0).toString(16)+";"},function(S){return S}];return f=f.replace(/./g,function(S){if(S==="@")S=E[Math.floor(Math.random()*2)](S);else{var A=Math.random();S=A>.9?E[2](S):A>.45?E[1](S):E[0](S)}return S}),f},r.helper.padEnd=function(E,S,A){return S=S>>0,A=String(A||" "),E.length>S?String(E):(S=S-E.length,S>A.length&&(A+=A.repeat(S/A.length)),String(E)+A.slice(0,S))},typeof console>"u"&&(console={warn:function(f){alert(f)},log:function(f){alert(f)},error:function(f){throw f}}),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(f){var E={},S=[],A=[],N={},x=o,D={parsed:{},raw:"",format:""};U();function U(){f=f||{};for(var L in s)s.hasOwnProperty(L)&&(E[L]=s[L]);if(typeof f=="object")for(var F in f)f.hasOwnProperty(F)&&(E[F]=f[F]);else throw Error("Converter expects the passed parameter to be an object, but "+typeof f+" was passed instead.");E.extensions&&r.helper.forEach(E.extensions,ee)}function ee(L,F){if(F=F||null,r.helper.isString(L))if(L=r.helper.stdExtName(L),F=L,r.extensions[L]){console.warn("DEPRECATION WARNING: "+L+" is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"),ie(r.extensions[L],L);return}else if(!r.helper.isUndefined(a[L]))L=a[L];else throw Error('Extension "'+L+'" could not be loaded. It was either not found or is not a valid extension.');typeof L=="function"&&(L=L()),r.helper.isArray(L)||(L=[L]);var K=c(L,F);if(!K.valid)throw Error(K.error);for(var X=0;X>",!1),Lr=Se("<<",!1),at=Se("<",!1),ze=Se(">",!1),br=Se("_",!1),rr=Se("?",!1),mr=Se(":",!1),z=Se("r",!1),me=Se("#",!1),Re=Se("b",!1),Ie=function(k){return k.filter(q=>q)},je=function(){return parseFloat(Oe())},ve=function(){return parseInt(Oe())},Yt=function(){},ot=function(){return LM[Oe()]},Tt=function(k){return k.filter(q=>q)},en=function(k){return qt(TO,{items:k})},lt=function(k,q,j){return qt(JM,{left:k,operation:q,right:j})},zt=function(){return parseInt(Oe())},bt=function(k){return k.map(q=>typeof q=="number"?q:void 0)},Me=function(){return Math.ceil(TA(Oe()))},kr=function(k){var q=k.filter(j=>j).map(j=>qt(Bi,{pitch:j[0]},j.toString()));return qt(TO,{items:q})},Zn=function(k){return k},st=function(){},Yr=function(k){return qt(cg,{items:k})},Tr=function(k){return qt(ZM,{octave:k})},Yi=function(){return Oe().split("").reduce((k,q)=>k+(q==="^"?1:-1),0)},xn=function(){return qt(bO,{seededRandom:a.seededRandom})},Gt=function(k,q){return qt(bO,{min:k,max:q,seededRandom:a.seededRandom})},mn=function(k,q){return qt(jM,{item:k,times:q})},Gi=function(k){return qt(KM,{duration:k})},fi=function(k){return qt(jh,{duration:k})},$i=function(k,q,j,pe){const Te=k?a.nodeOptions.octave+k:a.nodeOptions.octave;return qt(Bi,{duration:q,pitch:pe,octave:Te,add:j})},tn=function(k){return k.reduce((q,j)=>q+(j==="#"?1:-1),0)},Kn=function(k,q){return qt(XM,{pitches:[k].concat(q)})},G=0,Xe=0,gn=[{line:1,column:1}],cr=0,$=[],W=0,te={},he;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 Oe(){return i.substring(Xe,G)}function Be(){return jn(Xe,G)}function Se(k,q){return{type:"literal",text:k,ignoreCase:q}}function gt(k,q,j){return{type:"class",parts:k,inverted:q,ignoreCase:j}}function Cr(){return{type:"end"}}function Gr(k){return{type:"other",description:k}}function Qi(k){var q=gn[k],j;if(q)return q;for(j=k-1;!gn[j];)j--;for(q=gn[j],q={line:q.line,column:q.column};jcr&&(cr=G,$=[]),$.push(k))}function $r(k,q,j){return new e(e.buildMessage(k,q),k,q,j)}function _a(){var k,q,j=G*31+0,pe=te[j];return pe?(G=pe.nextPos,pe.result):(k=G,q=hi(),q!==s&&(Xe=k,q=Ie(q)),k=q,te[j]={nextPos:G,result:k},k)}function Sa(){var k,q,j,pe,Te,Qe,Ot,Sn=G*31+1,vr=te[Sn];if(vr)return G=vr.nextPos,vr.result;for(k=G,q=G,i.charCodeAt(G)===45?(j=d,G++):(j=s,W===0&&Ye(ae)),j===s&&(j=null),pe=[],K.test(i.charAt(G))?(Te=i.charAt(G),G++):(Te=s,W===0&&Ye(ge));Te!==s;)pe.push(Te),K.test(i.charAt(G))?(Te=i.charAt(G),G++):(Te=s,W===0&&Ye(ge));if(i.charCodeAt(G)===46?(Te=p,G++):(Te=s,W===0&&Ye(Ne)),Te!==s){if(Qe=[],K.test(i.charAt(G))?(Ot=i.charAt(G),G++):(Ot=s,W===0&&Ye(ge)),Ot!==s)for(;Ot!==s;)Qe.push(Ot),K.test(i.charAt(G))?(Ot=i.charAt(G),G++):(Ot=s,W===0&&Ye(ge));else Qe=s;Qe!==s?(j=[j,pe,Te,Qe],q=j):(G=q,q=s)}else G=q,q=s;if(q===s)if(q=G,i.charCodeAt(G)===46?(j=p,G++):(j=s,W===0&&Ye(Ne)),j!==s){if(pe=[],K.test(i.charAt(G))?(Te=i.charAt(G),G++):(Te=s,W===0&&Ye(ge)),Te!==s)for(;Te!==s;)pe.push(Te),K.test(i.charAt(G))?(Te=i.charAt(G),G++):(Te=s,W===0&&Ye(ge));else pe=s;pe!==s?(j=[j,pe],q=j):(G=q,q=s)}else G=q,q=s;return q!==s&&(Xe=k,q=je()),k=q,te[Sn]={nextPos:G,result:k},k}function Ln(){var k,q,j=G*31+2,pe=te[j];return pe?(G=pe.nextPos,pe.result):(k=G,i.charCodeAt(G)===45?G++:W===0&&Ye(ae),K.test(i.charAt(G))?(q=i.charAt(G),G++):(q=s,W===0&&Ye(ge)),q!==s?(Xe=k,k=ve()):(G=k,k=s),te[j]={nextPos:G,result:k},k)}function qi(){var k,q,j=G*31+3,pe=te[j];return pe?(G=pe.nextPos,pe.result):(W++,k=G,X.test(i.charAt(G))?(q=i.charAt(G),G++):(q=s,W===0&&Ye(be)),q!==s&&(Xe=k,q=Yt()),k=q,W--,k===s&&(q=s,W===0&&Ye(we)),te[j]={nextPos:G,result:k},k)}function Oa(){var k,q,j=G*31+7,pe=te[j];return pe?(G=pe.nextPos,pe.result):(k=G,le.test(i.charAt(G))?(q=i.charAt(G),G++):(q=s,W===0&&Ye(De)),q!==s&&(Xe=k,q=ot()),k=q,te[j]={nextPos:G,result:k},k)}function Vi(){var k,q=G*31+8,j=te[q];return j?(G=j.nextPos,j.result):(k=Oa(),k===s&&(k=Sa()),te[q]={nextPos:G,result:k},k)}function hi(){var k,q,j,pe=G*31+9,Te=te[pe];if(Te)return G=Te.nextPos,Te.result;if(k=G,q=[],j=ya(),j===s&&(j=Ea(),j===s&&(j=nr(),j===s&&(j=_i(),j===s&&(j=va())))),j!==s)for(;j!==s;)q.push(j),j=ya(),j===s&&(j=Ea(),j===s&&(j=nr(),j===s&&(j=_i(),j===s&&(j=va()))));else q=s;return q!==s&&(Xe=k,q=Tt(q)),k=q,te[pe]={nextPos:G,result:k},k}function nr(){var k,q,j,pe,Te=G*31+10,Qe=te[Te];return Qe?(G=Qe.nextPos,Qe.result):(k=G,i.charCodeAt(G)===40?(q=b,G++):(q=s,W===0&&Ye(He)),q!==s?(j=hi(),j!==s?(i.charCodeAt(G)===41?(pe=y,G++):(pe=s,W===0&&Ye(Fe)),pe!==s?(Xe=k,k=en(j)):(G=k,k=s)):(G=k,k=s)):(G=k,k=s),te[Te]={nextPos:G,result:k},k)}function Ea(){var k,q,j,pe,Te=G*31+11,Qe=te[Te];return Qe?(G=Qe.nextPos,Qe.result):(k=G,q=nr(),q!==s?(j=Ca(),j!==s?(pe=nr(),pe!==s?(Xe=k,k=lt(q,j,pe)):(G=k,k=s)):(G=k,k=s)):(G=k,k=s),te[Te]={nextPos:G,result:k},k)}function ds(){var k,q,j,pe=G*31+12,Te=te[pe];if(Te)return G=Te.nextPos,Te.result;if(k=G,i.charCodeAt(G)===45?G++:W===0&&Ye(ae),q=[],K.test(i.charAt(G))?(j=i.charAt(G),G++):(j=s,W===0&&Ye(ge)),j!==s)for(;j!==s;)q.push(j),K.test(i.charAt(G))?(j=i.charAt(G),G++):(j=s,W===0&&Ye(ge));else q=s;return q!==s?(Xe=k,k=zt()):(G=k,k=s),te[pe]={nextPos:G,result:k},k}function mi(){var k,q=G*31+13,j=te[q];return j?(G=j.nextPos,j.result):(k=ds(),k===s&&(k=Ln()),te[q]={nextPos:G,result:k},k)}function gi(){var k,q,j,pe=G*31+14,Te=te[pe];if(Te)return G=Te.nextPos,Te.result;if(k=G,q=[],j=ba(),j===s&&(j=mi()),j!==s)for(;j!==s;)q.push(j),j=ba(),j===s&&(j=mi());else q=s;return q!==s&&(Xe=k,q=bt(q)),k=q,te[pe]={nextPos:G,result:k},k}function ba(){var k,q,j,pe,Te=G*31+15,Qe=te[Te];return Qe?(G=Qe.nextPos,Qe.result):(k=G,i.charCodeAt(G)===40?G++:W===0&&Ye(He),q=mi(),q!==s?(j=Ca(),j!==s?(pe=gi(),pe!==s?(i.charCodeAt(G)===41?G++:W===0&&Ye(Fe),Xe=k,k=Me()):(G=k,k=s)):(G=k,k=s)):(G=k,k=s),te[Te]={nextPos:G,result:k},k)}function Ta(){var k,q,j,pe,Te=G*31+16,Qe=te[Te];if(Qe)return G=Qe.nextPos,Qe.result;if(k=G,i.charCodeAt(G)===123?(q=R,G++):(q=s,W===0&&Ye(Je)),q!==s){if(j=[],pe=gi(),pe===s&&(pe=qi()),pe!==s)for(;pe!==s;)j.push(pe),pe=gi(),pe===s&&(pe=qi());else j=s;j!==s?(i.charCodeAt(G)===125?(pe=w,G++):(pe=s,W===0&&Ye(nt)),pe!==s?(Xe=k,k=kr(j)):(G=k,k=s)):(G=k,k=s)}else G=k,k=s;return te[Te]={nextPos:G,result:k},k}function Ca(){var k,q=G*31+17,j=te[q];return j?(G=j.nextPos,j.result):(i.charCodeAt(G)===43?(k=B,G++):(k=s,W===0&&Ye(mt)),k===s&&(i.charCodeAt(G)===45?(k=d,G++):(k=s,W===0&&Ye(ae)),k===s&&(i.charCodeAt(G)===42?(k=Z,G++):(k=s,W===0&&Ye(Rt)),k===s&&(i.charCodeAt(G)===47?(k=f,G++):(k=s,W===0&&Ye(pt)),k===s&&(i.charCodeAt(G)===37?(k=E,G++):(k=s,W===0&&Ye(It)),k===s&&(i.charCodeAt(G)===94?(k=S,G++):(k=s,W===0&&Ye(Nt)),k===s&&(i.charCodeAt(G)===124?(k=_,G++):(k=s,W===0&&Ye(ce)),k===s&&(i.charCodeAt(G)===38?(k=A,G++):(k=s,W===0&&Ye(Fr)),k===s&&(i.substr(G,2)===N?(k=N,G+=2):(k=s,W===0&&Ye($e)),k===s&&(i.substr(G,2)===x?(k=x,G+=2):(k=s,W===0&&Ye(Lr))))))))))),te[q]={nextPos:G,result:k},k)}function _i(){var k,q,j=G*31+18,pe=te[j];return pe?(G=pe.nextPos,pe.result):(k=G,q=hs(),q===s&&(q=Ra(),q===s&&(q=_n(),q===s&&(q=rn(),q===s&&(q=qi(),q===s&&(q=Jn(),q===s&&(q=fs(),q===s&&(q=Si(),q===s&&(q=nr(),q===s&&(q=Ta(),q===s&&(q=ps())))))))))),q!==s&&(Xe=k,q=Zn(q)),k=q,te[j]={nextPos:G,result:k},k)}function ps(){var k,q,j=G*31+19,pe=te[j];return pe?(G=pe.nextPos,pe.result):(k=G,i.charCodeAt(G)===124?(q=_,G++):(q=s,W===0&&Ye(ce)),q!==s&&(Xe=k,q=st()),k=q,te[j]={nextPos:G,result:k},k)}function va(){var k,q,j,pe,Te=G*31+20,Qe=te[Te];return Qe?(G=Qe.nextPos,Qe.result):(k=G,i.charCodeAt(G)===60?(q=D,G++):(q=s,W===0&&Ye(at)),q!==s?(j=hi(),j!==s?(i.charCodeAt(G)===62?(pe=U,G++):(pe=s,W===0&&Ye(ze)),pe!==s?(Xe=k,k=Yr(j)):(G=k,k=s)):(G=k,k=s)):(G=k,k=s),te[Te]={nextPos:G,result:k},k)}function rn(){var k,q,j=G*31+21,pe=te[j];return pe?(G=pe.nextPos,pe.result):(k=G,q=ft(),q!==s&&(Xe=k,q=Tr(q)),k=q,te[j]={nextPos:G,result:k},k)}function ft(){var k,q,j,pe=G*31+22,Te=te[pe];if(Te)return G=Te.nextPos,Te.result;if(k=G,q=[],i.charCodeAt(G)===94?(j=S,G++):(j=s,W===0&&Ye(Nt)),j===s&&(i.charCodeAt(G)===95?(j=ee,G++):(j=s,W===0&&Ye(br))),j!==s)for(;j!==s;)q.push(j),i.charCodeAt(G)===94?(j=S,G++):(j=s,W===0&&Ye(Nt)),j===s&&(i.charCodeAt(G)===95?(j=ee,G++):(j=s,W===0&&Ye(br)));else q=s;return q!==s&&(Xe=k,q=Yi()),k=q,te[pe]={nextPos:G,result:k},k}function fs(){var k,q,j=G*31+23,pe=te[j];return pe?(G=pe.nextPos,pe.result):(k=G,i.charCodeAt(G)===63?(q=ie,G++):(q=s,W===0&&Ye(rr)),q!==s&&(Xe=k,q=xn()),k=q,te[j]={nextPos:G,result:k},k)}function Si(){var k,q,j,pe,Te,Qe,Ot=G*31+24,Sn=te[Ot];return Sn?(G=Sn.nextPos,Sn.result):(k=G,i.charCodeAt(G)===40?(q=b,G++):(q=s,W===0&&Ye(He)),q!==s?(j=Ln(),j!==s?(i.charCodeAt(G)===44?(pe=m,G++):(pe=s,W===0&&Ye(Ae)),pe!==s?(Te=Ln(),Te!==s?(i.charCodeAt(G)===41?(Qe=y,G++):(Qe=s,W===0&&Ye(Fe)),Qe!==s?(Xe=k,k=Gt(j,Te)):(G=k,k=s)):(G=k,k=s)):(G=k,k=s)):(G=k,k=s)):(G=k,k=s),te[Ot]={nextPos:G,result:k},k)}function ya(){var k,q,j,pe,Te=G*31+25,Qe=te[Te];return Qe?(G=Qe.nextPos,Qe.result):(k=G,q=_i(),q!==s?(i.charCodeAt(G)===58?(j=ne,G++):(j=s,W===0&&Ye(mr)),j!==s?(pe=Ln(),pe!==s?(Xe=k,k=mn(q,pe)):(G=k,k=s)):(G=k,k=s)):(G=k,k=s),te[Te]={nextPos:G,result:k},k)}function Jn(){var k,q,j=G*31+26,pe=te[j];return pe?(G=pe.nextPos,pe.result):(k=G,q=Vi(),q!==s&&(Xe=k,q=Gi(q)),k=q,te[j]={nextPos:G,result:k},k)}function hs(){var k,q,j,pe=G*31+27,Te=te[pe];return Te?(G=Te.nextPos,Te.result):(k=G,q=Vi(),q===s&&(q=null),i.charCodeAt(G)===114?(j=re,G++):(j=s,W===0&&Ye(z)),j!==s?(Xe=k,k=fi(q)):(G=k,k=s),te[pe]={nextPos:G,result:k},k)}function _n(){var k,q,j,pe,Te,Qe=G*31+28,Ot=te[Qe];return Ot?(G=Ot.nextPos,Ot.result):(k=G,q=ft(),q===s&&(q=null),j=Vi(),j===s&&(j=null),pe=Aa(),pe===s&&(pe=null),Te=Ln(),Te!==s?(Xe=k,k=$i(q,j,pe,Te)):(G=k,k=s),te[Qe]={nextPos:G,result:k},k)}function Aa(){var k,q,j,pe=G*31+29,Te=te[pe];if(Te)return G=Te.nextPos,Te.result;if(k=G,q=[],i.charCodeAt(G)===35?(j=L,G++):(j=s,W===0&&Ye(me)),j===s&&(i.charCodeAt(G)===98?(j=F,G++):(j=s,W===0&&Ye(Re))),j!==s)for(;j!==s;)q.push(j),i.charCodeAt(G)===35?(j=L,G++):(j=s,W===0&&Ye(me)),j===s&&(i.charCodeAt(G)===98?(j=F,G++):(j=s,W===0&&Ye(Re)));else q=s;return q!==s&&(Xe=k,q=tn(q)),k=q,te[pe]={nextPos:G,result:k},k}function Ra(){var k,q,j,pe,Te=G*31+30,Qe=te[Te];if(Qe)return G=Qe.nextPos,Qe.result;if(k=G,q=_n(),q!==s){if(j=[],pe=_n(),pe!==s)for(;pe!==s;)j.push(pe),pe=_n();else j=s;j!==s?(Xe=k,k=Kn(q,j)):(G=k,k=s)}else G=k,k=s;return te[Te]={nextPos:G,result:k},k}var Ia=a.nodeOptions||{};function qt(k,q,j=void 0){q.text=j||Oe(),q.location=Be();for(var pe in Ia)(q[pe]===void 0||q[pe]===null)&&(q[pe]=Ia[pe]);return new k(q)}if(he=c(),he!==s&&G===i.length)return he;throw he!==s&&Ge.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 lo(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.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())}evaluate(e,t={}){return e.map(i=>i.evaluate(t)).flat(1/0).filter(i=>i!==void 0)}totalDuration(){return this.evaluated.reduce((t,r)=>t+r.collect("duration"),0)}}const rP=n=>{let e={};return WM.forEach(t=>{if(n[t]!==void 0){const r=n[t];e[t]=r,delete n[t]}}),e};class nP{constructor(){v(this,"midiAccess",null);v(this,"midiOutputs",[]);v(this,"currentOutputIndex",0);v(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 iP{constructor(e,t,r){v(this,"min");v(this,"max");v(this,"wrap");v(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 aP={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 sP(n,e="major",t=4){const r=aP[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 ug{constructor(e){v(this,"seedValue");v(this,"randomGen",Math.random);v(this,"app");v(this,"values",{});v(this,"odds",(e,t)=>this.randomGen()this.odds(.025,e));v(this,"rarely",e=>this.odds(.1,e));v(this,"scarcely",e=>this.odds(.25,e));v(this,"sometimes",e=>this.odds(.5,e));v(this,"often",e=>this.odds(.75,e));v(this,"frequently",e=>this.odds(.9,e));v(this,"almostAlways",e=>this.odds(.985,e));v(this,"modify",e=>e(this));v(this,"seed",e=>(this.seedValue=e.toString(),this.randomGen=this.app.api.localSeededRandom(this.seedValue),this));v(this,"clear",()=>(this.app.api.clearLocalSeed(this.seedValue),this));v(this,"apply",e=>this.modify(e));v(this,"length",e=>(this.values.length=e,this));this.app=e,this.app.api.currentSeed&&(this.randomGen=this.app.api.randomGen)}}class RA extends ug{constructor(t){super(t);v(this,"octave",t=>(this.values.octave=t,this.update(),this));v(this,"key",t=>(this.values.key=t,this.update(),this));v(this,"scale",t=>(sg(t)?(this.values.scaleName=t,this.values.parsedScale=fa(t)):this.values.parsedScale=og(t),this.update(),this));v(this,"freq",t=>{this.values.freq=t;const r=FM(t);return r%1!==0?(this.values.note=Math.floor(r),this.values.bend=vA(r)[1]):this.values.note=r,this});v(this,"update",()=>{})}}let Rr=[],oP=(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=!Rr.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=oP(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 CO={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),!CO[r])throw new Error("vowel: unknown vowel "+r);const{gains:i,qs:a,freqs:s}=CO[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 cP=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]:[]},uP={c:0,d:2,e:4,f:5,g:7,a:9,b:11},dP={"#":1,b:-1,s:1,f:-1},hc=(n,e=3)=>{const[t,r,i=e]=cP(n);if(!t)throw new Error('not a note: "'+n+'"');const a=uP[t.toLowerCase()],s=(r==null?void 0:r.split("").reduce((o,l)=>o+dP[l],0))||0;return(Number(i)+1)*12+a+s},IA=n=>Math.pow(2,(n-69)/12)*440,pP=(n,e,t)=>Math.min(Math.max(n,e),t),fP=n=>12*Math.log(n/440)/Math.LN2+69,hP=(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 hc(r);if(typeof r=="number")return r;if(!e)throw new Error("valueToMidi: expected freq or note to be set");return e},mP="data:application/javascript;base64,Ly8gTElDRU5TRSBHTlUgR2VuZXJhbCBQdWJsaWMgTGljZW5zZSB2My4wIHNlZSBodHRwczovL2dpdGh1Yi5jb20vZGt0cjAvV2ViRGlydC9ibG9iL21haW4vTElDRU5TRQovLyBhbGwgdGhlIGNyZWRpdCBnb2VzIHRvIGRrdHIwJ3Mgd2ViZGlydDogaHR0cHM6Ly9naXRodWIuY29tL2RrdHIwL1dlYkRpcnQvYmxvYi81Y2UzZDY5ODM2MmM1NGQ2ZTFiNjhhY2M0N2ViMjk1NWFjNjJjNzkzL2Rpc3QvQXVkaW9Xb3JrbGV0cy5qcwovLyA8MwoKY2xhc3MgQ29hcnNlUHJvY2Vzc29yIGV4dGVuZHMgQXVkaW9Xb3JrbGV0UHJvY2Vzc29yIHsKICBzdGF0aWMgZ2V0IHBhcmFtZXRlckRlc2NyaXB0b3JzKCkgewogICAgcmV0dXJuIFt7IG5hbWU6ICdjb2Fyc2UnLCBkZWZhdWx0VmFsdWU6IDEgfV07CiAgfQoKICBjb25zdHJ1Y3RvcigpIHsKICAgIHN1cGVyKCk7CiAgICB0aGlzLm5vdFN0YXJ0ZWQgPSB0cnVlOwogIH0KCiAgcHJvY2VzcyhpbnB1dHMsIG91dHB1dHMsIHBhcmFtZXRlcnMpIHsKICAgIGNvbnN0IGlucHV0ID0gaW5wdXRzWzBdOwogICAgY29uc3Qgb3V0cHV0ID0gb3V0cHV0c1swXTsKICAgIGNvbnN0IGNvYXJzZSA9IHBhcmFtZXRlcnMuY29hcnNlOwogICAgY29uc3QgYmxvY2tTaXplID0gMTI4OwogICAgY29uc3QgaGFzSW5wdXQgPSAhKGlucHV0WzBdID09PSB1bmRlZmluZWQpOwogICAgaWYgKGhhc0lucHV0KSB7CiAgICAgIHRoaXMubm90U3RhcnRlZCA9IGZhbHNlOwogICAgICBvdXRwdXRbMF1bMF0gPSBpbnB1dFswXVswXTsKICAgICAgZm9yIChsZXQgbiA9IDE7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgIGZvciAobGV0IG8gPSAwOyBvIDwgb3V0cHV0Lmxlbmd0aDsgbysrKSB7CiAgICAgICAgICBvdXRwdXRbb11bbl0gPSBuICUgY29hcnNlID09IDAgPyBpbnB1dFswXVtuXSA6IG91dHB1dFtvXVtuIC0gMV07CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ2NvYXJzZS1wcm9jZXNzb3InLCBDb2Fyc2VQcm9jZXNzb3IpOwoKY2xhc3MgQ3J1c2hQcm9jZXNzb3IgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3IgewogIHN0YXRpYyBnZXQgcGFyYW1ldGVyRGVzY3JpcHRvcnMoKSB7CiAgICByZXR1cm4gW3sgbmFtZTogJ2NydXNoJywgZGVmYXVsdFZhbHVlOiAwIH1dOwogIH0KCiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5ub3RTdGFydGVkID0gdHJ1ZTsKICB9CgogIHByb2Nlc3MoaW5wdXRzLCBvdXRwdXRzLCBwYXJhbWV0ZXJzKSB7CiAgICBjb25zdCBpbnB1dCA9IGlucHV0c1swXTsKICAgIGNvbnN0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBjcnVzaCA9IHBhcmFtZXRlcnMuY3J1c2g7CiAgICBjb25zdCBibG9ja1NpemUgPSAxMjg7CiAgICBjb25zdCBoYXNJbnB1dCA9ICEoaW5wdXRbMF0gPT09IHVuZGVmaW5lZCk7CiAgICBpZiAoaGFzSW5wdXQpIHsKICAgICAgdGhpcy5ub3RTdGFydGVkID0gZmFsc2U7CiAgICAgIGlmIChjcnVzaC5sZW5ndGggPT09IDEpIHsKICAgICAgICBjb25zdCB4ID0gTWF0aC5wb3coMiwgY3J1c2hbMF0gLSAxKTsKICAgICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgICBjb25zdCB2YWx1ZSA9IE1hdGgucm91bmQoaW5wdXRbMF1bbl0gKiB4KSAvIHg7CiAgICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgICBvdXRwdXRbb11bbl0gPSB2YWx1ZTsKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0gZWxzZSB7CiAgICAgICAgZm9yIChsZXQgbiA9IDA7IG4gPCBibG9ja1NpemU7IG4rKykgewogICAgICAgICAgbGV0IHggPSBNYXRoLnBvdygyLCBjcnVzaFtuXSAtIDEpOwogICAgICAgICAgY29uc3QgdmFsdWUgPSBNYXRoLnJvdW5kKGlucHV0WzBdW25dICogeCkgLyB4OwogICAgICAgICAgZm9yIChsZXQgbyA9IDA7IG8gPCBvdXRwdXQubGVuZ3RoOyBvKyspIHsKICAgICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQpyZWdpc3RlclByb2Nlc3NvcignY3J1c2gtcHJvY2Vzc29yJywgQ3J1c2hQcm9jZXNzb3IpOwoKY2xhc3MgU2hhcGVQcm9jZXNzb3IgZXh0ZW5kcyBBdWRpb1dvcmtsZXRQcm9jZXNzb3IgewogIHN0YXRpYyBnZXQgcGFyYW1ldGVyRGVzY3JpcHRvcnMoKSB7CiAgICByZXR1cm4gW3sgbmFtZTogJ3NoYXBlJywgZGVmYXVsdFZhbHVlOiAwIH1dOwogIH0KCiAgY29uc3RydWN0b3IoKSB7CiAgICBzdXBlcigpOwogICAgdGhpcy5ub3RTdGFydGVkID0gdHJ1ZTsKICB9CgogIHByb2Nlc3MoaW5wdXRzLCBvdXRwdXRzLCBwYXJhbWV0ZXJzKSB7CiAgICBjb25zdCBpbnB1dCA9IGlucHV0c1swXTsKICAgIGNvbnN0IG91dHB1dCA9IG91dHB1dHNbMF07CiAgICBjb25zdCBzaGFwZTAgPSBwYXJhbWV0ZXJzLnNoYXBlWzBdOwogICAgY29uc3Qgc2hhcGUxID0gc2hhcGUwIDwgMSA/IHNoYXBlMCA6IDEuMCAtIDRlLTEwOwogICAgY29uc3Qgc2hhcGUgPSAoMi4wICogc2hhcGUxKSAvICgxLjAgLSBzaGFwZTEpOwogICAgY29uc3QgYmxvY2tTaXplID0gMTI4OwogICAgY29uc3QgaGFzSW5wdXQgPSAhKGlucHV0WzBdID09PSB1bmRlZmluZWQpOwogICAgaWYgKGhhc0lucHV0KSB7CiAgICAgIHRoaXMubm90U3RhcnRlZCA9IGZhbHNlOwogICAgICBmb3IgKGxldCBuID0gMDsgbiA8IGJsb2NrU2l6ZTsgbisrKSB7CiAgICAgICAgY29uc3QgdmFsdWUgPSAoKDEgKyBzaGFwZSkgKiBpbnB1dFswXVtuXSkgLyAoMSArIHNoYXBlICogTWF0aC5hYnMoaW5wdXRbMF1bbl0pKTsKICAgICAgICBmb3IgKGxldCBvID0gMDsgbyA8IG91dHB1dC5sZW5ndGg7IG8rKykgewogICAgICAgICAgb3V0cHV0W29dW25dID0gdmFsdWU7CiAgICAgICAgfQogICAgICB9CiAgICB9CiAgICByZXR1cm4gdGhpcy5ub3RTdGFydGVkIHx8IGhhc0lucHV0OwogIH0KfQoKcmVnaXN0ZXJQcm9jZXNzb3IoJ3NoYXBlLXByb2Nlc3NvcicsIFNoYXBlUHJvY2Vzc29yKTsK";function Wl(n){const e=Ht().createGain();return e.gain.value=n,e}const Jh=(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)}}},gP=(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)}}},nu=(n,e,t)=>{const r=Ht().createBiquadFilter();return r.type=n,r.frequency.value=e,r.Q.value=t,r};let _P=n=>console.log(n);const ss=(...n)=>_P(...n),dg=lP();function pg(n,e,t={}){dg.setKey(n,{onTrigger:e,data:t})}function vO(n){return dg.get()[n]}let iu;const Ht=()=>(iu||(iu=new AudioContext),iu);let Ko;const fg=()=>{const n=Ht();return Ko||(Ko=n.createGain(),Ko.connect(n.destination)),Ko};let au;function SP(){return au||(au=Ht().audioWorklet.addModule(mP),au)}function su(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 OP(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 SP().catch(t=>{console.warn("could not load AudioWorklet effects coarse, crush and shape",t)}))}async function EP(n){return new Promise(e=>{document.addEventListener("click",async function t(){await OP(n),e(),document.removeEventListener("click",t)})})}let Wi={};function bP(n,e,t,r){var i;if(t=pP(t,0,.98),!Wi[n]){const a=Ht().createFeedbackDelay(1,e,t);(i=a.start)==null||i.call(a,r),a.connect(fg()),Wi[n]=a}return Wi[n].delayTime.value!==e&&Wi[n].delayTime.setValueAtTime(e,r),Wi[n].feedback.value!==t&&Wi[n].feedback.setValueAtTime(t,r),Wi[n]}let Xi={};function TP(n,e=2){if(!Xi[n]){const t=Ht().createReverb(e);t.connect(fg()),Xi[n]=t}return Xi[n].duration!==e&&(Xi[n]=Xi[n].setDuration(e),Xi[n].duration=e),Xi[n]}let Zi;function CP(n=2048){if(!Zi){const e=Ht().createAnalyser();e.fftSize=n,Zi=e,new Float32Array(Zi.frequencyBinCount)}return Zi.fftSize!==n&&(Zi.fftSize=n,new Float32Array(Zi.frequencyBinCount)),Zi}function ou(n,e,t){const r=Wl(t);return n.connect(r),r.connect(e),r}const vP=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:y,crush:R,shape:w,pan:B,vowel:Z,delay:f=0,delayfeedback:E=.5,delaytime:S=.25,orbit:A=1,room:N,size:x=2,velocity:D=1,analyze:U,fft:ee=8}=n;l*=D;let ie=[];const ne=()=>{ie.forEach(ae=>ae==null?void 0:ae.disconnect())};s&&a&&(a=`${s}_${a}`);let re;if(o)re=o(i,n,t);else if(vO(a)){const{onTrigger:ae}=vO(a),ge=await ae(i,n,ne);ge&&(re=ge.node,ge.stop(i+t))}else throw new Error(`sound ${a} not found! Is it loaded?`);if(!re)return;if(r.currentTime>i){ss("[webaudio] skip hap: still loading",r.currentTime-i);return}const L=[];if(L.push(re),L.push(Wl(l)),c!==void 0&&L.push(nu("lowpass",c,d)),p!==void 0&&L.push(nu("highpass",p,m)),_!==void 0&&L.push(nu("bandpass",_,b)),Z!==void 0&&L.push(r.createVowelFilter(Z)),y!==void 0&&L.push(su(r,"coarse-processor",{coarse:y})),R!==void 0&&L.push(su(r,"crush-processor",{crush:R})),w!==void 0&&L.push(su(r,"shape-processor",{shape:w})),B!==void 0){const ae=r.createStereoPanner();ae.pan.value=2*B-1,L.push(ae)}const F=Wl(1);L.push(F),F.connect(fg());let K;if(f>0&&S>0&&E>0){const ae=bP(A,S,E,i);K=ou(F,ae,f)}let X;if(N>0&&x>0){const ae=TP(A,x);X=ou(F,ae,N)}let le;if(U){const ae=CP(2**(ee+5));le=ou(F,ae,U)}L.slice(1).reduce((ae,ge)=>ae.connect(ge),L[0]),ie=L.concat([K,X,le])},lu={};function yP(n,e){var t=e?1e3:1024;if(n=t);return n.toFixed(1)+" "+r[i]}const AP=async(n,e,t,r,i,a,s)=>{let o=0;i!==void 0&&t!==void 0&&ss("[sampler] hap has note and freq. ignoring note","warning");let l=hP({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=>hc(R)-l,y=Object.keys(a).filter(R=>!R.startsWith("_")).reduce((R,w,B)=>!R||Math.abs(b(w)){const i=t?`sound "${t}:${r}"`:"sample";if(!lu[n]){ss(`[sampler] load ${i}..`,"load-sample",{url:n});const a=Date.now();lu[n]=fetch(n).then(s=>s.arrayBuffer()).then(async s=>{const o=Date.now()-a,l=yP(s.byteLength);return ss(`[sampler] load ${i}... done! loaded ${l} in ${o}ms`,"loaded-sample",{url:n}),await e.decodeAudioData(s)})}return lu[n]};function IP(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 wP={};function DP(n){const e=Object.entries(wP).find(([t])=>n.startsWith(t));if(e)return e[1]}const Xl=async(n,e=n._base||"",t={})=>{if(typeof n=="string"){const a=DP(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=>Xl(o,e||o._base||s,t)).catch(o=>{throw console.error(o),new Error(`error loading "${n}"`)})}const{prebake:r,tag:i}=t;NP(n,(a,s)=>pg(a,(o,l,c)=>xP(o,l,c,s),{type:"sample",samples:s,baseUrl:e,prebake:r,tag:i}),e)},yO=[];async function xP(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:y=0,end:R=1}=e;if(b===0)return;const w=Ht(),{attack:B=.001,decay:Z=.001,sustain:f=1,release:E=.001}=e,S=n+l,A=await AP(a,m,_,b,s,r,i);if(w.currentTime>n){ss(`[sampler] still loading sound "${a}:${m}"`,"highlight");return}if(!A){ss(`[sampler] could not load "${a}:${m}"`,"error");return}A.playbackRate.value=Math.abs(b)*A.playbackRate.value,o==="c"&&(A.playbackRate.value=A.playbackRate.value*A.buffer.duration*1);const N=y*A.buffer.duration;A.start(S,N);const x=A.buffer.duration/A.playbackRate.value,{node:D,stop:U}=Jh(B,Z,f,E,1,n);A.connect(D);const ee=w.createGain();D.connect(ee),A.onended=function(){A.disconnect(),D.disconnect(),ee.disconnect(),t()};const ie={node:ee,bufferSource:A,stop:(ne,re=p===void 0)=>{let L=ne;re&&(L=n+(R-y)*x),A.stop(L+E),U(L)}};if(c!==void 0){const ne=yO[c];ne&&(ne.node.gain.setValueAtTime(1,S),ne.node.gain.linearRampToValueAtTime(0,S+.01)),yO[c]=ie}return ie}const LP=(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)}},kP=(n,e,t,r="sine")=>{const i=n.frequency.value*e,a=i*t;return LP(i,a,r)};function MP(){["sine","square","triangle","sawtooth"].forEach(n=>{pg(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:y,fmwave:R="sine"}=t,{n:w,note:B,freq:Z}=t;B=B||36,typeof B=="string"&&(B=hc(B)),!Z&&typeof B=="number"&&(Z=IA(B));const{node:f,stop:E}=BP({t:e,s:n,freq:Z,partials:w});let S,A;if(c){const{node:U,stop:ee}=kP(f,l,c,R);[p,m,_,b,y].find(ie=>ie!==void 0)?(p=p??.001,m=m??.001,_=_??1,b=b??.001,y=y??1,A=Jh(p,m,_,b,y,e),d==="exp"&&(A=gP(p,m,_,b,y,e),A.node.maxValue=c*2,A.node.minValue=1e-5),U.connect(A.node),A.node.connect(f.frequency)):U.connect(f.frequency),S=ee}const N=Wl(.3),{node:x,stop:D}=Jh(i,a,s,o,1,e);return f.onended=()=>{f.disconnect(),N.disconnect(),r()},{node:f.connect(N).connect(x),stop:U=>{D(U),A==null||A.stop(U);let ee=U+o;E(ee),S==null||S(ee)}}},{type:"synth",prebake:!0})})}function PP(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 BP({s:n,freq:e,t,partials:r}){let i;return!r||n==="sine"?(i=Ht().createOscillator(),i.type=n||"triangle"):i=PP(r,n),i.frequency.value=Number(e),i.start(t),{node:i,stop:a=>i.stop(a)}}function UP(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,y=0,R=0,w=1,B=0,Z=0){let f=Math.PI*2,E=Ht().sampleRate,S=X=>X>0?1:-1,A=l*=500*f/E/E,N=t*=(1+e*2*Math.random()-e)*f/E,x=[],D=0,U=0,ee=0,ie=1,ne=0,re=0,L=0,F,K;for(r=r*E+9,B*=E,i*=E,a*=E,R*=E,c*=500*f/E**3,b*=f/E,d*=f/E,p*=E,m=m*E|0,K=r+B+i+a+R|0;ee1?s>2?s>3?Math.sin((D%f)**3):Math.max(Math.min(Math.tan(D),1),-1):1-(2*D/f%2+2)%2:1-4*Math.abs(Math.round(D/f)-D/f):Math.sin(D),L=(m?1-Z+Z*Math.sin(f*ee/m):1)*S(L)*Math.abs(L)**o*n*1*(eeee?0:(eep&&(t+=d,N+=d,ie=0),m&&!(++ne%m)&&(t=N,l=A,ie||(ie=1));return x}const FP=(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:y=0,noise:R=0,zmod:w=0,zcrush:B=0,zdelay:Z=0,tremolo:f=0,duration:E=.2,zzfx:S}=n;const A=Math.max(E-s-o,0);typeof r=="string"&&(r=hc(r)),!i&&typeof r=="number"&&(i=IA(r)),t=t.replace("z_","");const N=["sine","triangle","sawtooth","tan","noise"].indexOf(t)||0;d=t==="square"?0:d;const x=UP(...S||[.25,a,i,s,A,c,N,d,p,m,_,b,y,R,w,B,Z,l,o,f]),D=Ht(),U=D.createBuffer(1,x.length,D.sampleRate);U.getChannelData(0).set(x);const ee=Ht().createBufferSource();return ee.buffer=U,ee.start(e),{node:ee}};function YP(){["zzfx","z_sine","z_sawtooth","z_triangle","z_square","z_tan","z_noise"].forEach(n=>{pg(n,(e,t,r)=>{const{node:i}=FP({s:n,...t},e);return i.onended=()=>{i.disconnect(),r()},{node:i,stop:()=>{}}},{type:"synth",prebake:!0})})}class NA extends RA{constructor(t,r){super(r);v(this,"volume",t=>this.updateValue("volume",t));v(this,"vol",this.volume);v(this,"zrand",t=>this.updateValue("zrand",t));v(this,"curve",t=>this.updateValue("curve",t));v(this,"slide",t=>this.updateValue("slide",t));v(this,"sld",this.slide);v(this,"deltaSlide",t=>this.updateValue("deltaSlide",t));v(this,"dslide",this.deltaSlide);v(this,"pitchJump",t=>this.updateValue("pitchJump",t));v(this,"pj",this.pitchJump);v(this,"pitchJumpTime",t=>this.updateValue("pitchJumpTime",t));v(this,"pjt",this.pitchJumpTime);v(this,"lfo",t=>this.updateValue("lfo",t));v(this,"noise",t=>this.updateValue("noise",t));v(this,"zmod",t=>this.updateValue("zmod",t));v(this,"zcrush",t=>this.updateValue("zcrush",t));v(this,"zdelay",t=>this.updateValue("zdelay",t));v(this,"sustainVolume",t=>this.updateValue("sustainVolume",t));v(this,"decay",t=>this.updateValue("decay",t));v(this,"dec",this.decay);v(this,"tremolo",t=>this.updateValue("tremolo",t));v(this,"duration",t=>this.updateValue("duration",t));v(this,"zzfx",t=>this.updateValue("zzfx",t));v(this,"fmi",t=>this.updateValue("fmi",t));v(this,"fmh",t=>this.updateValue("fmh",t));v(this,"fmenv",t=>this.updateValue("fmenv",t));v(this,"fmattack",t=>this.updateValue("fmattack",t));v(this,"fmatk",this.fmattack);v(this,"fmdecay",t=>this.updateValue("fmdecay",t));v(this,"fmdec",this.fmdecay);v(this,"fmsustain",t=>this.updateValue("fmsustain",t));v(this,"fmsus",this.fmsustain);v(this,"fmrelease",t=>this.updateValue("fmrelease",t));v(this,"fmrel",this.fmrelease);v(this,"fmvelocity",t=>this.updateValue("fmvelocity",t));v(this,"fmvel",this.fmvelocity);v(this,"fmwave",t=>this.updateValue("fmwave",t));v(this,"fmw",this.fmwave);v(this,"attack",t=>this.updateValue("attack",t));v(this,"atk",this.attack);v(this,"release",t=>this.updateValue("release",t));v(this,"rel",this.release);v(this,"sustain",t=>this.updateValue("sustain",t));v(this,"sus",this.sustain);v(this,"unit",t=>this.updateValue("unit",t));v(this,"u",this.unit);v(this,"freq",t=>this.updateValue("freq",t));v(this,"f",this.freq);v(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});v(this,"sound",t=>this.updateValue("s",t));v(this,"snd",this.sound);v(this,"nudge",t=>this.updateValue("nudge",t));v(this,"cut",t=>this.updateValue("cut",t));v(this,"loop",t=>this.updateValue("loop",t));v(this,"clip",t=>this.updateValue("clip",t));v(this,"n",t=>this.updateValue("n",t));v(this,"note",t=>this.updateValue("note",t));v(this,"speed",t=>this.updateValue("speed",t));v(this,"spd",this.speed);v(this,"begin",t=>this.updateValue("begin",t));v(this,"end",t=>this.updateValue("end",t));v(this,"gain",t=>this.updateValue("gain",t));v(this,"cutoff",t=>this.updateValue("cutoff",t));v(this,"lpf",this.cutoff);v(this,"resonance",t=>this.updateValue("resonance",t));v(this,"lpq",this.resonance);v(this,"hcutoff",t=>this.updateValue("hcutoff",t));v(this,"hpf",this.hcutoff);v(this,"hresonance",t=>this.updateValue("hresonance",t));v(this,"hpq",this.hresonance);v(this,"bandf",t=>this.updateValue("bandf",t));v(this,"bpf",this.bandf);v(this,"bandq",t=>this.updateValue("bandq",t));v(this,"bpq",this.bandq);v(this,"coarse",t=>this.updateValue("coarse",t));v(this,"crush",t=>this.updateValue("crush",t));v(this,"shape",t=>this.updateValue("shape",t));v(this,"pan",t=>this.updateValue("pan",t));v(this,"vowel",t=>this.updateValue("vowel",t));v(this,"vow",this.vowel);v(this,"delay",t=>this.updateValue("delay",t));v(this,"del",this.delay);v(this,"delayfeedback",t=>this.updateValue("delayfeedback",t));v(this,"delayfb",this.delayfeedback);v(this,"delaytime",t=>this.updateValue("delaytime",t));v(this,"delayt",this.delaytime);v(this,"orbit",t=>this.updateValue("orbit",t));v(this,"o",this.orbit);v(this,"room",t=>this.updateValue("room",t));v(this,"rm",this.room);v(this,"size",t=>this.updateValue("size",t));v(this,"sz",this.size);v(this,"velocity",t=>this.updateValue("velocity",t));v(this,"vel",this.velocity);v(this,"modify",t=>{const r=t(this);return r instanceof Object?r:(t(this.values),this.update(),this)});v(this,"update",()=>{const[t,r]=lg(this.values.key||"C4",this.values.pitch||0,this.values.parsedScale||"MAJOR",this.values.octave||0);this.values.freq=co(t)});v(this,"out",()=>vP(this.values,this.app.clock.pulse_duration,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 wA extends RA{constructor(t,r){super(r);v(this,"midiConnection");v(this,"note",t=>(this.values.note=t,this));v(this,"sustain",t=>(this.values.sustain=t,this));v(this,"channel",t=>(this.values.channel=t,this));v(this,"port",t=>(this.values.port=this.midiConnection.getMidiOutputIndex(t),this));v(this,"add",t=>(this.values.note+=t,this));v(this,"modify",t=>{const r=t(this);return r instanceof Object?r:(t(this.values),this.update(),this)});v(this,"bend",t=>(this.values.bend=t,this));v(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));v(this,"update",()=>{const[t,r]=lg(this.values.key||"C4",this.values.pitch||0,this.values.parsedScale||"MAJOR",this.values.octave||0);this.values.note=t,this.values.freq=co(t),r&&(this.values.bend=r)});v(this,"out",()=>{const t=this.values.note?this.values.note:60,r=this.values.channel?this.values.channel:0,i=this.values.velocity?this.values.velocity:100,a=this.values.sustain?this.values.sustain*this.app.clock.pulse_duration*this.app.api.ppqn():this.app.clock.pulse_duration*this.app.api.ppqn(),s=this.values.bend?this.values.bend:void 0,o=this.values.port?this.midiConnection.getMidiOutputIndex(this.values.port):this.midiConnection.getCurrentMidiPortIndex();this.midiConnection.sendMidiNote(t,r,i,a,o,s)});this.app=r,typeof t=="number"?this.values.note=t:this.values=t,this.midiConnection=r.api.MidiConnection}}const As=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,DA=new Set,em=typeof process=="object"&&process?process:{},xA=(n,e,t,r)=>{typeof em.emitWarning=="function"?em.emitWarning(n,e,t,r):console.error(`[${t}] ${e}: ${n}`)};let Zl=globalThis.AbortController,AO=globalThis.AbortSignal;var g1;if(typeof Zl>"u"){AO=class{constructor(){v(this,"onabort");v(this,"_onabort",[]);v(this,"reason");v(this,"aborted",!1)}addEventListener(r,i){this._onabort.push(i)}},Zl=class{constructor(){v(this,"signal",new AO);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=((g1=em.env)==null?void 0:g1.LRU_CACHE_IGNORE_AC_WARNING)!=="1";const e=()=>{n&&(n=!1,xA("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 GP=n=>!DA.has(n),Ti=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),LA=n=>Ti(n)?n<=Math.pow(2,8)?Uint8Array:n<=Math.pow(2,16)?Uint16Array:n<=Math.pow(2,32)?Uint32Array:n<=Number.MAX_SAFE_INTEGER?hl:null:null;class hl extends Array{constructor(e){super(e),this.fill(0)}}var qa;const Ji=class Ji{constructor(e,t){v(this,"heap");v(this,"length");if(!Q(Ji,qa))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}static create(e){const t=LA(e);if(!t)return[];Ve(Ji,qa,!0);const r=new Ji(e,t);return Ve(Ji,qa,!1),r}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}};qa=new WeakMap,tt(Ji,qa,!1);let tm=Ji;var bn,Vr,Tn,Cn,Va,Zt,vn,Kt,Dt,et,Ir,Hr,_r,sr,yn,or,ri,ni,An,Rn,Ii,Nr,ho,nm,ia,ii,mo,zr,tc,kA,aa,Ha,go,Un,Ci,Fn,vi,_o,im,za,ml,Wa,gl,vt,kt,So,am,sa,Ps;const Tg=class Tg{constructor(e){tt(this,ho);tt(this,tc);tt(this,Un);tt(this,Fn);tt(this,_o);tt(this,za);tt(this,Wa);tt(this,vt);tt(this,So);tt(this,sa);tt(this,bn,void 0);tt(this,Vr,void 0);tt(this,Tn,void 0);tt(this,Cn,void 0);tt(this,Va,void 0);v(this,"ttl");v(this,"ttlResolution");v(this,"ttlAutopurge");v(this,"updateAgeOnGet");v(this,"updateAgeOnHas");v(this,"allowStale");v(this,"noDisposeOnSet");v(this,"noUpdateTTL");v(this,"maxEntrySize");v(this,"sizeCalculation");v(this,"noDeleteOnFetchRejection");v(this,"noDeleteOnStaleGet");v(this,"allowStaleOnFetchAbort");v(this,"allowStaleOnFetchRejection");v(this,"ignoreFetchAbort");tt(this,Zt,void 0);tt(this,vn,void 0);tt(this,Kt,void 0);tt(this,Dt,void 0);tt(this,et,void 0);tt(this,Ir,void 0);tt(this,Hr,void 0);tt(this,_r,void 0);tt(this,sr,void 0);tt(this,yn,void 0);tt(this,or,void 0);tt(this,ri,void 0);tt(this,ni,void 0);tt(this,An,void 0);tt(this,Rn,void 0);tt(this,Ii,void 0);tt(this,Nr,void 0);tt(this,ia,()=>{});tt(this,ii,()=>{});tt(this,mo,()=>{});tt(this,zr,()=>!1);tt(this,aa,e=>{});tt(this,Ha,(e,t,r)=>{});tt(this,go,(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:y,fetchMethod:R,noDeleteOnFetchRejection:w,noDeleteOnStaleGet:B,allowStaleOnFetchRejection:Z,allowStaleOnFetchAbort:f,ignoreFetchAbort:E}=e;if(t!==0&&!Ti(t))throw new TypeError("max option must be a nonnegative integer");const S=t?LA(t):Array;if(!S)throw new Error("invalid max value: "+t);if(Ve(this,bn,t),Ve(this,Vr,_),this.maxEntrySize=b||Q(this,Vr),this.sizeCalculation=y,this.sizeCalculation){if(!Q(this,Vr)&&!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(Ve(this,Va,R),Ve(this,Ii,!!R),Ve(this,Kt,new Map),Ve(this,Dt,new Array(t).fill(void 0)),Ve(this,et,new Array(t).fill(void 0)),Ve(this,Ir,new S(t)),Ve(this,Hr,new S(t)),Ve(this,_r,0),Ve(this,sr,0),Ve(this,yn,tm.create(t)),Ve(this,Zt,0),Ve(this,vn,0),typeof c=="function"&&Ve(this,Tn,c),typeof d=="function"?(Ve(this,Cn,d),Ve(this,or,[])):(Ve(this,Cn,void 0),Ve(this,or,void 0)),Ve(this,Rn,!!Q(this,Tn)),Ve(this,Nr,!!Q(this,Cn)),this.noDisposeOnSet=!!p,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!w,this.allowStaleOnFetchRejection=!!Z,this.allowStaleOnFetchAbort=!!f,this.ignoreFetchAbort=!!E,this.maxEntrySize!==0){if(Q(this,Vr)!==0&&!Ti(Q(this,Vr)))throw new TypeError("maxSize must be a positive integer if specified");if(!Ti(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");Ge(this,tc,kA).call(this)}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!B,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!o,this.ttlResolution=Ti(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=r||0,this.ttl){if(!Ti(this.ttl))throw new TypeError("ttl must be a positive integer if specified");Ge(this,ho,nm).call(this)}if(Q(this,bn)===0&&this.ttl===0&&Q(this,Vr)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!Q(this,bn)&&!Q(this,Vr)){const A="LRU_CACHE_UNBOUNDED";GP(A)&&(DA.add(A),xA("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",A,Tg))}}static unsafeExposeInternals(e){return{starts:Q(e,ni),ttls:Q(e,An),sizes:Q(e,ri),keyMap:Q(e,Kt),keyList:Q(e,Dt),valList:Q(e,et),next:Q(e,Ir),prev:Q(e,Hr),get head(){return Q(e,_r)},get tail(){return Q(e,sr)},free:Q(e,yn),isBackgroundFetch:t=>{var r;return Ge(r=e,vt,kt).call(r,t)},backgroundFetch:(t,r,i,a)=>{var s;return Ge(s=e,Wa,gl).call(s,t,r,i,a)},moveToTail:t=>{var r;return Ge(r=e,sa,Ps).call(r,t)},indexes:t=>{var r;return Ge(r=e,Un,Ci).call(r,t)},rindexes:t=>{var r;return Ge(r=e,Fn,vi).call(r,t)},isStale:t=>{var r;return Q(r=e,zr).call(r,t)}}}get max(){return Q(this,bn)}get maxSize(){return Q(this,Vr)}get calculatedSize(){return Q(this,vn)}get size(){return Q(this,Zt)}get fetchMethod(){return Q(this,Va)}get dispose(){return Q(this,Tn)}get disposeAfter(){return Q(this,Cn)}getRemainingTTL(e){return Q(this,Kt).has(e)?1/0:0}*entries(){for(const e of Ge(this,Un,Ci).call(this))Q(this,et)[e]!==void 0&&Q(this,Dt)[e]!==void 0&&!Ge(this,vt,kt).call(this,Q(this,et)[e])&&(yield[Q(this,Dt)[e],Q(this,et)[e]])}*rentries(){for(const e of Ge(this,Fn,vi).call(this))Q(this,et)[e]!==void 0&&Q(this,Dt)[e]!==void 0&&!Ge(this,vt,kt).call(this,Q(this,et)[e])&&(yield[Q(this,Dt)[e],Q(this,et)[e]])}*keys(){for(const e of Ge(this,Un,Ci).call(this)){const t=Q(this,Dt)[e];t!==void 0&&!Ge(this,vt,kt).call(this,Q(this,et)[e])&&(yield t)}}*rkeys(){for(const e of Ge(this,Fn,vi).call(this)){const t=Q(this,Dt)[e];t!==void 0&&!Ge(this,vt,kt).call(this,Q(this,et)[e])&&(yield t)}}*values(){for(const e of Ge(this,Un,Ci).call(this))Q(this,et)[e]!==void 0&&!Ge(this,vt,kt).call(this,Q(this,et)[e])&&(yield Q(this,et)[e])}*rvalues(){for(const e of Ge(this,Fn,vi).call(this))Q(this,et)[e]!==void 0&&!Ge(this,vt,kt).call(this,Q(this,et)[e])&&(yield Q(this,et)[e])}[Symbol.iterator](){return this.entries()}find(e,t={}){for(const r of Ge(this,Un,Ci).call(this)){const i=Q(this,et)[r],a=Ge(this,vt,kt).call(this,i)?i.__staleWhileFetching:i;if(a!==void 0&&e(a,Q(this,Dt)[r],this))return this.get(Q(this,Dt)[r],t)}}forEach(e,t=this){for(const r of Ge(this,Un,Ci).call(this)){const i=Q(this,et)[r],a=Ge(this,vt,kt).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,Q(this,Dt)[r],this)}}rforEach(e,t=this){for(const r of Ge(this,Fn,vi).call(this)){const i=Q(this,et)[r],a=Ge(this,vt,kt).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,Q(this,Dt)[r],this)}}purgeStale(){let e=!1;for(const t of Ge(this,Fn,vi).call(this,{allowStale:!0}))Q(this,zr).call(this,t)&&(this.delete(Q(this,Dt)[t]),e=!0);return e}dump(){const e=[];for(const t of Ge(this,Un,Ci).call(this,{allowStale:!0})){const r=Q(this,Dt)[t],i=Q(this,et)[t],a=Ge(this,vt,kt).call(this,i)?i.__staleWhileFetching:i;if(a===void 0||r===void 0)continue;const s={value:a};if(Q(this,An)&&Q(this,ni)){s.ttl=Q(this,An)[t];const o=As.now()-Q(this,ni)[t];s.start=Math.floor(Date.now()-o)}Q(this,ri)&&(s.size=Q(this,ri)[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=As.now()-i}this.set(t,r.value,r)}}set(e,t,r={}){var m,_,b,y,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=Q(this,go).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=Q(this,Zt)===0?void 0:Q(this,Kt).get(e);if(p===void 0)p=Q(this,Zt)===0?Q(this,sr):Q(this,yn).length!==0?Q(this,yn).pop():Q(this,Zt)===Q(this,bn)?Ge(this,za,ml).call(this,!1):Q(this,Zt),Q(this,Dt)[p]=e,Q(this,et)[p]=t,Q(this,Kt).set(e,p),Q(this,Ir)[Q(this,sr)]=p,Q(this,Hr)[p]=Q(this,sr),Ve(this,sr,p),Io(this,Zt)._++,Q(this,Ha).call(this,p,d,l),l&&(l.set="add"),c=!1;else{Ge(this,sa,Ps).call(this,p);const w=Q(this,et)[p];if(t!==w){if(Q(this,Ii)&&Ge(this,vt,kt).call(this,w)){w.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:B}=w;B!==void 0&&!s&&(Q(this,Rn)&&((m=Q(this,Tn))==null||m.call(this,B,e,"set")),Q(this,Nr)&&((_=Q(this,or))==null||_.push([B,e,"set"])))}else s||(Q(this,Rn)&&((b=Q(this,Tn))==null||b.call(this,w,e,"set")),Q(this,Nr)&&((y=Q(this,or))==null||y.push([w,e,"set"])));if(Q(this,aa).call(this,p),Q(this,Ha).call(this,p,d,l),Q(this,et)[p]=t,l){l.set="replace";const B=w&&Ge(this,vt,kt).call(this,w)?w.__staleWhileFetching:w;B!==void 0&&(l.oldValue=B)}}else l&&(l.set="update")}if(i!==0&&!Q(this,An)&&Ge(this,ho,nm).call(this),Q(this,An)&&(c||Q(this,mo).call(this,p,i,a),l&&Q(this,ii).call(this,l,p)),!s&&Q(this,Nr)&&Q(this,or)){const w=Q(this,or);let B;for(;B=w==null?void 0:w.shift();)(R=Q(this,Cn))==null||R.call(this,...B)}return this}pop(){var e;try{for(;Q(this,Zt);){const t=Q(this,et)[Q(this,_r)];if(Ge(this,za,ml).call(this,!0),Ge(this,vt,kt).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(Q(this,Nr)&&Q(this,or)){const t=Q(this,or);let r;for(;r=t==null?void 0:t.shift();)(e=Q(this,Cn))==null||e.call(this,...r)}}}has(e,t={}){const{updateAgeOnHas:r=this.updateAgeOnHas,status:i}=t,a=Q(this,Kt).get(e);if(a!==void 0){const s=Q(this,et)[a];if(Ge(this,vt,kt).call(this,s)&&s.__staleWhileFetching===void 0)return!1;if(Q(this,zr).call(this,a))i&&(i.has="stale",Q(this,ii).call(this,i,a));else return r&&Q(this,ia).call(this,a),i&&(i.has="hit",Q(this,ii).call(this,i,a)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){const{allowStale:r=this.allowStale}=t,i=Q(this,Kt).get(e);if(i!==void 0&&(r||!Q(this,zr).call(this,i))){const a=Q(this,et)[i];return Ge(this,vt,kt).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:y,forceRefresh:R=!1,status:w,signal:B}=t;if(!Q(this,Ii))return w&&(w.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:i,noDeleteOnStaleGet:a,status:w});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:w,signal:B};let f=Q(this,Kt).get(e);if(f===void 0){w&&(w.fetch="miss");const E=Ge(this,Wa,gl).call(this,e,f,Z,y);return E.__returned=E}else{const E=Q(this,et)[f];if(Ge(this,vt,kt).call(this,E)){const D=r&&E.__staleWhileFetching!==void 0;return w&&(w.fetch="inflight",D&&(w.returnedStale=!0)),D?E.__staleWhileFetching:E.__returned=E}const S=Q(this,zr).call(this,f);if(!R&&!S)return w&&(w.fetch="hit"),Ge(this,sa,Ps).call(this,f),i&&Q(this,ia).call(this,f),w&&Q(this,ii).call(this,w,f),E;const A=Ge(this,Wa,gl).call(this,e,f,Z,y),x=A.__staleWhileFetching!==void 0&&r;return w&&(w.fetch=S?"stale":"refresh",x&&S&&(w.returnedStale=!0)),x?A.__staleWhileFetching:A.__returned=A}}get(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:s}=t,o=Q(this,Kt).get(e);if(o!==void 0){const l=Q(this,et)[o],c=Ge(this,vt,kt).call(this,l);return s&&Q(this,ii).call(this,s,o),Q(this,zr).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:(Ge(this,sa,Ps).call(this,o),i&&Q(this,ia).call(this,o),l))}else s&&(s.get="miss")}delete(e){var r,i,a,s;let t=!1;if(Q(this,Zt)!==0){const o=Q(this,Kt).get(e);if(o!==void 0)if(t=!0,Q(this,Zt)===1)this.clear();else{Q(this,aa).call(this,o);const l=Q(this,et)[o];Ge(this,vt,kt).call(this,l)?l.__abortController.abort(new Error("deleted")):(Q(this,Rn)||Q(this,Nr))&&(Q(this,Rn)&&((r=Q(this,Tn))==null||r.call(this,l,e,"delete")),Q(this,Nr)&&((i=Q(this,or))==null||i.push([l,e,"delete"]))),Q(this,Kt).delete(e),Q(this,Dt)[o]=void 0,Q(this,et)[o]=void 0,o===Q(this,sr)?Ve(this,sr,Q(this,Hr)[o]):o===Q(this,_r)?Ve(this,_r,Q(this,Ir)[o]):(Q(this,Ir)[Q(this,Hr)[o]]=Q(this,Ir)[o],Q(this,Hr)[Q(this,Ir)[o]]=Q(this,Hr)[o]),Io(this,Zt)._--,Q(this,yn).push(o)}}if(Q(this,Nr)&&((a=Q(this,or))!=null&&a.length)){const o=Q(this,or);let l;for(;l=o==null?void 0:o.shift();)(s=Q(this,Cn))==null||s.call(this,...l)}return t}clear(){var e,t,r;for(const i of Ge(this,Fn,vi).call(this,{allowStale:!0})){const a=Q(this,et)[i];if(Ge(this,vt,kt).call(this,a))a.__abortController.abort(new Error("deleted"));else{const s=Q(this,Dt)[i];Q(this,Rn)&&((e=Q(this,Tn))==null||e.call(this,a,s,"delete")),Q(this,Nr)&&((t=Q(this,or))==null||t.push([a,s,"delete"]))}}if(Q(this,Kt).clear(),Q(this,et).fill(void 0),Q(this,Dt).fill(void 0),Q(this,An)&&Q(this,ni)&&(Q(this,An).fill(0),Q(this,ni).fill(0)),Q(this,ri)&&Q(this,ri).fill(0),Ve(this,_r,0),Ve(this,sr,0),Q(this,yn).length=0,Ve(this,vn,0),Ve(this,Zt,0),Q(this,Nr)&&Q(this,or)){const i=Q(this,or);let a;for(;a=i==null?void 0:i.shift();)(r=Q(this,Cn))==null||r.call(this,...a)}}};bn=new WeakMap,Vr=new WeakMap,Tn=new WeakMap,Cn=new WeakMap,Va=new WeakMap,Zt=new WeakMap,vn=new WeakMap,Kt=new WeakMap,Dt=new WeakMap,et=new WeakMap,Ir=new WeakMap,Hr=new WeakMap,_r=new WeakMap,sr=new WeakMap,yn=new WeakMap,or=new WeakMap,ri=new WeakMap,ni=new WeakMap,An=new WeakMap,Rn=new WeakMap,Ii=new WeakMap,Nr=new WeakMap,ho=new WeakSet,nm=function(){const e=new hl(Q(this,bn)),t=new hl(Q(this,bn));Ve(this,An,e),Ve(this,ni,t),Ve(this,mo,(a,s,o=As.now())=>{if(t[a]=s!==0?o:0,e[a]=s,s!==0&&this.ttlAutopurge){const l=setTimeout(()=>{Q(this,zr).call(this,a)&&this.delete(Q(this,Dt)[a])},s+1);l.unref&&l.unref()}}),Ve(this,ia,a=>{t[a]=e[a]!==0?As.now():0}),Ve(this,ii,(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=As.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=Q(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},Ve(this,zr,a=>e[a]!==0&&t[a]!==0&&(r||i())-t[a]>e[a])},ia=new WeakMap,ii=new WeakMap,mo=new WeakMap,zr=new WeakMap,tc=new WeakSet,kA=function(){const e=new hl(Q(this,bn));Ve(this,vn,0),Ve(this,ri,e),Ve(this,aa,t=>{Ve(this,vn,Q(this,vn)-e[t]),e[t]=0}),Ve(this,go,(t,r,i,a)=>{if(Ge(this,vt,kt).call(this,r))return 0;if(!Ti(i))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(i=a(r,t),!Ti(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}),Ve(this,Ha,(t,r,i)=>{if(e[t]=r,Q(this,Vr)){const a=Q(this,Vr)-e[t];for(;Q(this,vn)>a;)Ge(this,za,ml).call(this,!0)}Ve(this,vn,Q(this,vn)+e[t]),i&&(i.entrySize=r,i.totalCalculatedSize=Q(this,vn))})},aa=new WeakMap,Ha=new WeakMap,go=new WeakMap,Un=new WeakSet,Ci=function*({allowStale:e=this.allowStale}={}){if(Q(this,Zt))for(let t=Q(this,sr);!(!Ge(this,_o,im).call(this,t)||((e||!Q(this,zr).call(this,t))&&(yield t),t===Q(this,_r)));)t=Q(this,Hr)[t]},Fn=new WeakSet,vi=function*({allowStale:e=this.allowStale}={}){if(Q(this,Zt))for(let t=Q(this,_r);!(!Ge(this,_o,im).call(this,t)||((e||!Q(this,zr).call(this,t))&&(yield t),t===Q(this,sr)));)t=Q(this,Ir)[t]},_o=new WeakSet,im=function(e){return e!==void 0&&Q(this,Kt).get(Q(this,Dt)[e])===e},za=new WeakSet,ml=function(e){var a,s;const t=Q(this,_r),r=Q(this,Dt)[t],i=Q(this,et)[t];return Q(this,Ii)&&Ge(this,vt,kt).call(this,i)?i.__abortController.abort(new Error("evicted")):(Q(this,Rn)||Q(this,Nr))&&(Q(this,Rn)&&((a=Q(this,Tn))==null||a.call(this,i,r,"evict")),Q(this,Nr)&&((s=Q(this,or))==null||s.push([i,r,"evict"]))),Q(this,aa).call(this,t),e&&(Q(this,Dt)[t]=void 0,Q(this,et)[t]=void 0,Q(this,yn).push(t)),Q(this,Zt)===1?(Ve(this,_r,Ve(this,sr,0)),Q(this,yn).length=0):Ve(this,_r,Q(this,Ir)[t]),Q(this,Kt).delete(r),Io(this,Zt)._--,t},Wa=new WeakSet,gl=function(e,t,r,i){const a=t===void 0?void 0:Q(this,et)[t];if(Ge(this,vt,kt).call(this,a))return a;const s=new Zl,{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=(y,R=!1)=>{const{aborted:w}=s.signal,B=r.ignoreFetchAbort&&y!==void 0;if(r.status&&(w&&!R?(r.status.fetchAborted=!0,r.status.fetchError=s.signal.reason,B&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),w&&!B&&!R)return p(s.signal.reason);const Z=_;return Q(this,et)[t]===_&&(y===void 0?Z.__staleWhileFetching?Q(this,et)[t]=Z.__staleWhileFetching:this.delete(e):(r.status&&(r.status.fetchUpdated=!0),this.set(e,y,l.options))),y},d=y=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=y),p(y)),p=y=>{const{aborted:R}=s.signal,w=R&&r.allowStaleOnFetchAbort,B=w||r.allowStaleOnFetchRejection,Z=B||r.noDeleteOnFetchRejection,f=_;if(Q(this,et)[t]===_&&(!Z||f.__staleWhileFetching===void 0?this.delete(e):w||(Q(this,et)[t]=f.__staleWhileFetching)),B)return r.status&&f.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),f.__staleWhileFetching;if(f.__returned===f)throw y},m=(y,R)=>{var B;const w=(B=Q(this,Va))==null?void 0:B.call(this,e,a,l);w&&w instanceof Promise&&w.then(Z=>y(Z===void 0?void 0:Z),R),s.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(y(void 0),r.allowStaleOnFetchAbort&&(y=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=Q(this,Kt).get(e)):Q(this,et)[t]=b,b},vt=new WeakSet,kt=function(e){if(!Q(this,Ii))return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Zl},So=new WeakSet,am=function(e,t){Q(this,Hr)[t]=e,Q(this,Ir)[e]=t},sa=new WeakSet,Ps=function(e){e!==Q(this,sr)&&(e===Q(this,_r)?Ve(this,_r,Q(this,Ir)[e]):Ge(this,So,am).call(this,Q(this,Hr)[e],Q(this,Ir)[e]),Ge(this,So,am).call(this,Q(this,sr),e),Ve(this,sr,e))};let rm=Tg;const $s=class $s{constructor(){v(this,"_fallbackMethod",()=>$s.createSkipProxy());v(this,"out",()=>{})}};v($s,"createSkipProxy",()=>{const e=new $s;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 Kl=$s;const Qs=class Qs extends ug{constructor(t,r){super(r);v(this,"_fallbackMethod",()=>Qs.createRestProxy(this.values.length,this.app));v(this,"out",()=>{});this.values.length=t}};v(Qs,"createRestProxy",(t,r)=>{const i=new Qs(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 jl=Qs;class $P extends ug{constructor(t,r,i){super(i);v(this,"input");v(this,"ziffers");v(this,"initCallTime",0);v(this,"startCallTime",0);v(this,"lastCallTime",0);v(this,"waitTime",0);v(this,"startBeat",0);v(this,"played",!1);v(this,"current");v(this,"retro",!1);v(this,"index",-1);v(this,"zid","");v(this,"options",{});v(this,"skipIndex",0);v(this,"endTime",0);v(this,"next",()=>(this.current=this.ziffers.next(),this.played=!0,this.current));v(this,"pulseToSecond",t=>this.app.clock.convertPulseToSecond(t));v(this,"firstRun",()=>this.notStarted());v(this,"atTheBeginning",()=>this.skipIndex===0&&this.ziffers.index<=0);v(this,"origin",()=>this.app.clock.pulses_since_origin+1);v(this,"pulse",()=>this.app.clock.time_position.pulse);v(this,"beat",()=>this.app.clock.time_position.beat);v(this,"nextBeat",()=>this.app.clock.next_beat_in_ticks);v(this,"nextBeatInTicks",()=>this.app.clock.next_beat_in_ticks);v(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});v(this,"out",()=>{});this.app=i,this.input=t,this.options=r,this.ziffers=new tP(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 Bi){const i=r.getExisting("freq","pitch","key","scale","octave","parsedScale");return new NA(i,this.app).sound(t)}else if(r instanceof jh)return jl.createRestProxy(r.duration,this.app)}else return Kl.createSkipProxy()}midi(t=void 0){if(this.areWeThereYet()){const r=this.next();if(r instanceof Bi){const i=r.getExisting("note","pitch","bend","key","scale","octave","parsedScale"),a=new wA(i,this.app);return t?a.note(t):a}else if(r instanceof jh)return jl.createRestProxy(r.duration,this.app)}else return Kl.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 QP=n=>n[0]==="{"&&n[n.length-1]==="}",Rs=(n,e)=>{if(QP(n)){const t=JSON.parse(n);return JSON.stringify({...t,...e})}else return JSON.stringify({...e,text:n})},qP=n=>{String.prototype.speak=function(){const e=JSON.parse(this.valueOf());new MA({...e,text:e.text}).speak().then(()=>{}).catch(t=>{console.log("Error speaking:",t)})},String.prototype.rate=function(e){return Rs(this.valueOf(),{rate:e})},String.prototype.pitch=function(e){return Rs(this.valueOf(),{pitch:e})},String.prototype.lang=function(e){return Rs(this.valueOf(),{lang:e})},String.prototype.volume=function(e){return Rs(this.valueOf(),{volume:e})},String.prototype.voice=function(e){return Rs(this.valueOf(),{voice:e})},String.prototype.z=function(){return n.z(this.valueOf())}};let cu;class MA{constructor(e){v(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(),cu&&clearTimeout(cu),cu=setTimeout(()=>{r.speak(i)},200)):r.speak(i)}else t("No text provided")}));this.options=e}}async function RO(){return Promise.all([EP(),Xl("github:tidalcycles/Dirt-Samples/master").then(()=>MP()),YP(),Xl("github:Bubobubobubobubo/Topos-Samples/main")])}class VP{constructor(e){v(this,"variables",{});v(this,"codeExamples",{});v(this,"counters",{});v(this,"_drunk",new iP(-100,100,!1));v(this,"randomGen",Math.random);v(this,"currentSeed");v(this,"localSeeds",new Map);v(this,"patternCache",new rm({max:1e3,ttl:1e3*60*5}));v(this,"errorTimeoutID",0);v(this,"printTimeoutID",0);v(this,"MidiConnection",new nP);v(this,"load");v(this,"_loadUniverseFromInterface",e=>{this.app.loadUniverse(e),this.app.openBuffersModal()});v(this,"_deleteUniverseFromInterface",e=>{delete this.app.universes[e],this.app.settings.saveApplicationToLocalStorage(this.app.universes,this.app.settings),this.app.updateKnownUniversesView()});v(this,"_playDocExample",e=>{this.play(),console.log("Executing documentation example: "+this.app.selectedExample),this.app.universes[this.app.selected_universe].global.candidate=e||this.app.selectedExample,oo(this.app,this.app.universes[this.app.selected_universe].global)});v(this,"_playDocExampleOnce",e=>{this.play(),console.log("Executing documentation example: "+this.app.selectedExample),RM(this.app,e)});v(this,"_all_samples",()=>dg.get());v(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)});v(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)});v(this,"time",()=>this.app.audioContext.currentTime);v(this,"play",()=>{this.app.setButtonHighlighting("play",!0),this.app.clock.start()});v(this,"pause",()=>{this.app.setButtonHighlighting("pause",!0),this.app.clock.pause()});v(this,"stop",()=>{this.app.setButtonHighlighting("stop",!0),this.app.clock.stop()});v(this,"silence",this.stop);v(this,"hush",this.stop);v(this,"onmousemove",e=>{this.app._mouseX=e.clientX,this.app._mouseY=e.clientY});v(this,"mouseX",()=>this.app._mouseX);v(this,"mouseY",()=>this.app._mouseY);v(this,"noteX",()=>Math.floor(this.app._mouseX/document.body.clientWidth*127));v(this,"noteY",()=>Math.floor(this.app._mouseY/document.body.clientHeight*127));v(this,"script",(...e)=>{e.forEach(t=>{oo(this.app,this.app.universes[this.app.selected_universe].locals[t])})});v(this,"s",this.script);v(this,"clear_script",e=>{this.app.universes[this.app.selected_universe].locals[e]={candidate:"",committed:"",evaluations:0}});v(this,"cs",this.clear_script);v(this,"copy_script",(e,t)=>{this.app.universes[this.app.selected_universe].locals[t]=this.app.universes[this.app.selected_universe].locals[e]});v(this,"cps",this.copy_script);v(this,"midi_outputs",()=>{this._logMessage(this.MidiConnection.listMidiOutputs())});v(this,"midi_output",e=>{e?this.MidiConnection.switchMidiOutput(e):console.log(this.MidiConnection.getCurrentMidiPort())});v(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 wA(e,this.app)));v(this,"sysex",e=>{this.MidiConnection.sendSysExMessage(e)});v(this,"pitch_bend",(e,t)=>{this.MidiConnection.sendPitchBend(e,t)});v(this,"program_change",(e,t)=>{this.MidiConnection.sendProgramChange(e,t)});v(this,"midi_clock",()=>{this.MidiConnection.sendMidiClock()});v(this,"control_change",({control:e=20,value:t=0,channel:r=0})=>{this.MidiConnection.sendMidiControlChange(e,t,r)});v(this,"midi_panic",()=>{this.MidiConnection.panic()});v(this,"generateCacheKey",(...e)=>e.map(t=>JSON.stringify(t)).join(","));v(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 $P(e,t,this.app),this.app.api.patternCache.set(a,s)),typeof r=="number"&&(s.zid=i),s.updateLastCallTime(),r!==""&&s.sync("z0"),s});v(this,"z0",(e,t={})=>this.z(e,t,0));v(this,"z1",(e,t={})=>this.z(e,t,1));v(this,"z2",(e,t={})=>this.z(e,t,2));v(this,"z3",(e,t={})=>this.z(e,t,3));v(this,"z4",(e,t={})=>this.z(e,t,4));v(this,"z5",(e,t={})=>this.z(e,t,5));v(this,"z6",(e,t={})=>this.z(e,t,6));v(this,"z7",(e,t={})=>this.z(e,t,7));v(this,"z8",(e,t={})=>this.z(e,t,8));v(this,"z9",(e,t={})=>this.z(e,t,9));v(this,"z10",(e,t={})=>this.z(e,t,10));v(this,"z11",(e,t={})=>this.z(e,t,11));v(this,"z12",(e,t={})=>this.z(e,t,12));v(this,"z13",(e,t={})=>this.z(e,t,13));v(this,"z14",(e,t={})=>this.z(e,t,14));v(this,"z15",(e,t={})=>this.z(e,t,15));v(this,"z16",(e,t={})=>this.z(e,t,16));v(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));v(this,"$",this.counter);v(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);v(this,"drunk",e=>e!==void 0?(this._drunk.position=e,this._drunk.getPosition()):(this._drunk.step(),this._drunk.getPosition()));v(this,"drunk_max",e=>{this._drunk.max=e});v(this,"drunk_min",e=>{this._drunk.min=e});v(this,"drunk_wrap",e=>{this._drunk.toggleWrap(e)});v(this,"variable",(e,t)=>typeof e=="string"&&t===void 0?this.variables[e]:(this.variables[e]=t,this.variables[e]));v(this,"v",this.variable);v(this,"delete_variable",e=>{delete this.variables[e]});v(this,"dv",this.delete_variable);v(this,"clear_variables",()=>{this.variables={}});v(this,"cv",this.clear_variables);v(this,"randI",(e,t)=>Math.floor(this.randomGen()*(t-e+1))+e);v(this,"rand",(e,t)=>this.randomGen()*(t-e)+e);v(this,"irand",this.randI);v(this,"rI",this.randI);v(this,"r",this.rand);v(this,"ir",this.randI);v(this,"seed",e=>{typeof e=="number"&&(e=e.toString()),this.currentSeed!==e&&(this.currentSeed=e,this.randomGen=Kh(e))});v(this,"localSeededRandom",e=>{if(typeof e=="number"&&(e=e.toString()),this.localSeeds.has(e))return this.localSeeds.get(e);const t=Kh(e);return this.localSeeds.set(e,t),t});v(this,"clearLocalSeed",(e=void 0)=>{e&&this.localSeeds.delete(e.toString()),this.localSeeds.clear()});v(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));v(this,"cmp",this.clamp);v(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));v(this,"tempo",this.bpm);v(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));v(this,"ppqn",e=>e===void 0?this.app.clock.ppqn:(e<1&&console.log(`Setting ppqn to ${e}`),this.app.clock.ppqn=e,e));v(this,"time_signature",(e,t)=>{this.app.clock.time_signature=[e,t]});v(this,"prob",e=>this.randomGen()*100this.randomGen()>.5);v(this,"odds",(e,t=15)=>this.randomGen()this.randomGen()<.025*this.ppqn()/(this.ppqn()*e));v(this,"rarely",(e=15)=>this.randomGen()<.1*this.ppqn()/(this.ppqn()*e));v(this,"scarcely",(e=15)=>this.randomGen()<.25*this.ppqn()/(this.ppqn()*e));v(this,"sometimes",(e=15)=>this.randomGen()<.5*this.ppqn()/(this.ppqn()*e));v(this,"often",(e=15)=>this.randomGen()<.75*this.ppqn()/(this.ppqn()*e));v(this,"frequently",(e=15)=>this.randomGen()<.9*this.ppqn()/(this.ppqn()*e));v(this,"almostAlways",(e=15)=>this.randomGen()<.985*this.ppqn()/(this.ppqn()*e));v(this,"dice",e=>Math.floor(this.randomGen()*e)+1);v(this,"bar",()=>this.app.clock.time_position.bar+1);v(this,"tick",()=>this.app.clock.tick+1);v(this,"pulse",()=>this.app.clock.time_position.pulse+1);v(this,"beat",()=>this.app.clock.time_position.beat+1);v(this,"ebeat",()=>this.app.clock.beats_since_origin+1);v(this,"epulse",()=>this.app.clock.pulses_since_origin+1);v(this,"nominator",()=>this.app.clock.time_signature[0]);v(this,"meter",()=>this.app.clock.time_signature[1]);v(this,"denominator",this.meter);v(this,"mod",(...e)=>e.map(r=>this.app.clock.pulses_since_origin%Math.floor(r*this.ppqn())===0).some(r=>r===!0));v(this,"modpulse",(...e)=>e.map(r=>this.app.clock.pulses_since_origin%r===0).some(r=>r===!0));v(this,"modp",this.modpulse);v(this,"modbar",(...e)=>e.map(r=>this.app.clock.time_position.bar%Math.floor(r*this.ppqn())===0).some(r=>r===!0));v(this,"modb",this.modbar);v(this,"div",e=>{const t=this.app.clock.pulses_since_origin;return Math.floor(t/Math.floor(e*this.ppqn()))%2===0});v(this,"divbar",e=>{const t=this.app.clock.time_position.bar-1;return Math.floor(t/e)%2===0});v(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)});v(this,"onbeat",(...e)=>{let t=[];return e.forEach(r=>{const i=r%this.nominator()||this.nominator(),a=Math.floor(i),s=(i-a)*this.ppqn()+1;t.push(a===this.beat()&&this.pulse()===s)}),t.some(r=>r==!0)});v(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)});v(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)});v(this,"delay",(e,t)=>{setTimeout(t,e)});v(this,"delayr",(e,t,r)=>{[...Array(t).keys()].map(a=>e*a).forEach((a,s)=>{setTimeout(r,a)})});v(this,"euclid",(e,t,r,i=0)=>this._euclidean_cycle(t,r,i)[e%r]);v(this,"ec",this.euclid);v(this,"rhythm",(e,t,r,i=0)=>this.mod(e)&&this._euclidean_cycle(t,r,i).div(e));v(this,"bin",(e,t)=>{let i=t.toString(2).split("").map(a=>a==="1");return i[e%i.length]});v(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);v(this,"usine",(e=1,t=0)=>(this.sine(e,t)+1)/2);v(this,"saw",(e=1,t=0)=>this.app.clock.ctx.currentTime*e%1*2-1+t);v(this,"usaw",(e=1,t=0)=>(this.saw(e,t)+1)/2);v(this,"triangle",(e=1,t=0)=>Math.abs(this.saw(e,t))*2-1);v(this,"utriangle",(e=1,t=0)=>(this.triangle(e,t)+1)/2);v(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);v(this,"noise",()=>this.randomGen()*2-1);v(this,"min",(...e)=>Math.min(...e));v(this,"max",(...e)=>Math.max(...e));v(this,"mean",(...e)=>e.reduce((r,i)=>r+i,0)/e.length);v(this,"limit",(e,t,r)=>Math.min(Math.max(e,t),r));v(this,"abs",Math.abs);v(this,"speak",(e,t="en-US",r=0,i=1,a=1)=>{new MA({text:e,lang:t,voice:r,rate:i,pitch:a}).speak().then(()=>{}).catch(o=>{console.log(o)})});v(this,"sound",e=>new NA(e,this.app));v(this,"snd",this.sound);v(this,"samples",Xl);v(this,"log",e=>{console.log(e),this._logMessage(e)});v(this,"scale",sP);v(this,"rate",e=>{});v(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]});v(this,"seqbeat",(...e)=>e[this.app.clock.time_position.beat%e.length]);v(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 HP=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.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(Math.random()*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|(Lt&21845)<<1;bi=(bi&52428)>>2|(bi&13107)<<2,bi=(bi&61680)>>4|(bi&3855)<<4,lm[Lt]=((bi&65280)>>8|(bi&255)<<8)>>1}var Hn=function(n,e,t){for(var r=n.length,i=0,a=new Jr(e);i>l]=c}else for(o=new Jr(r),i=0;i>15-n[i]);return o},Ui=new fr(288);for(var Lt=0;Lt<144;++Lt)Ui[Lt]=8;for(var Lt=144;Lt<256;++Lt)Ui[Lt]=9;for(var Lt=256;Lt<280;++Lt)Ui[Lt]=7;for(var Lt=280;Lt<288;++Lt)Ui[Lt]=8;var uo=new fr(32);for(var Lt=0;Lt<32;++Lt)uo[Lt]=5;var WP=Hn(Ui,9,0),XP=Hn(Ui,9,1),ZP=Hn(uo,5,0),KP=Hn(uo,5,1),uu=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},En=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},du=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},mg=function(n){return(n+7)/8|0},gg=function(n,e,t){(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length);var r=new fr(t-e);return r.set(n.subarray(e,t)),r},jP=["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"],Mr=function(n,e,t){var r=new Error(e||jP[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,Mr),!t)throw r;return r},_g=function(n,e,t,r){var i=n.length,a=r?r.length:0;if(!i||e.f&&!e.l)return t||new fr(0);var s=!t||e.i!=2,o=e.i;t||(t=new fr(i*3));var l=function(Fe){var Je=t.length;if(Fe>Je){var nt=new fr(Math.max(Je*2,Fe));nt.set(t),t=nt}},c=e.f||0,d=e.p||0,p=e.b||0,m=e.l,_=e.d,b=e.m,y=e.n,R=i*8;do{if(!m){c=En(n,d,1);var w=En(n,d+1,3);if(d+=3,w)if(w==1)m=XP,_=KP,b=9,y=5;else if(w==2){var E=En(n,d,31)+257,S=En(n,d+10,15)+4,A=E+En(n,d+5,31)+1;d+=14;for(var N=new fr(A),x=new fr(19),D=0;D>4;if(B<16)N[D++]=B;else{var re=0,L=0;for(B==16?(L=3+En(n,d,3),d+=2,re=N[D-1]):B==17?(L=3+En(n,d,7),d+=3):B==18&&(L=11+En(n,d,127),d+=7);L--;)N[D++]=re}}var F=N.subarray(0,E),K=N.subarray(E);b=uu(F),y=uu(K),m=Hn(F,b,1),_=Hn(K,y,1)}else Mr(1);else{var B=mg(d)+4,Z=n[B-4]|n[B-3]<<8,f=B+Z;if(f>i){o&&Mr(0);break}s&&l(p+Z),t.set(n.subarray(B,f),p),e.b=p+=Z,e.p=d=f*8,e.f=c;continue}if(d>R){o&&Mr(0);break}}s&&l(p+131072);for(var X=(1<>4;if(d+=re&15,d>R){o&&Mr(0);break}if(re||Mr(2),ge<256)t[p++]=ge;else if(ge==256){ae=d,m=null;break}else{var Ne=ge-254;if(ge>264){var D=ge-257,we=mc[D];Ne=En(n,d,(1<>4;be||Mr(3),d+=be&15;var K=zP[Ae];if(Ae>3){var we=gc[Ae];K+=du(n,d)&(1<R){o&&Mr(0);break}s&&l(p+131072);var ce=p+Ne;if(p>8},Is=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},pu=function(n,e){for(var t=[],r=0;rm&&(m=a[r].s);var _=new Jr(m+1),b=cm(t[d-1],_,0);if(b>e){var r=0,y=0,R=b-e,w=1<e)y+=w-(1<>=R;y>0;){var Z=a[r].s;_[Z]=0&&y;--r){var f=a[r].s;_[f]==e&&(--_[f],++y)}b=e}return{t:new fr(_),l:b}},cm=function(n,e,t){return n.s==-1?Math.max(cm(n.l,e,t+1),cm(n.r,e,t+1)):e[n.s]=t},NO=function(n){for(var e=n.length;e&&!n[--e];);for(var t=new Jr(++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}},Ns=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&&!D[sm[ee-1]];--ee);var ie=c+5<<3,ne=Ns(i,Ui)+Ns(a,uo)+s,re=Ns(i,m)+Ns(a,y)+s+14+3*ee+Ns(A,D)+2*A[16]+3*A[17]+7*A[18];if(l>=0&&ie<=ne&&ie<=re)return YA(e,d,n.subarray(l,l+c));var L,F,K,X;if(ei(e,d,1+(re15&&(ei(e,d,Ne[N]>>5&127),d+=Ne[N]>>12)}}else L=WP,F=Ui,K=ZP,X=uo;for(var N=0;N255){var we=be>>18&31;Is(e,d,L[we+257]),d+=F[we+257],we>7&&(ei(e,d,be>>23&31),d+=mc[we]);var Ae=be&31;Is(e,d,K[Ae]),d+=X[Ae],Ae>3&&(Is(e,d,be>>5&8191),d+=gc[Ae])}else Is(e,d,L[be]),d+=F[be]}return Is(e,d,L[256]),d+F[256]},JP=new hg([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),GA=new fr(0),e3=function(n,e,t,r,i,a){var s=a.z||n.length,o=new fr(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=JP[e-1],m=p>>13,_=p&8191,b=(1<7e3||D>24576)&&(L>423||!c)){d=wO(n,l,0,f,E,S,N,D,ee,x-ee,d),D=A=N=0,ee=x;for(var F=0;F<286;++F)E[F]=0;for(var F=0;F<30;++F)S[F]=0}var K=2,X=0,le=_,ae=ne-re&32767;if(L>2&&ie==Z(x-ae))for(var ge=Math.min(m,L)-1,Ne=Math.min(32767,x),we=Math.min(258,L);ae<=Ne&&--le&&ne!=re;){if(n[x+K]==n[x+K-ae]){for(var be=0;beK){if(K=be,X=ae,be>ge)break;for(var Ae=Math.min(ae,be-2),ce=0,F=0;Fce&&(ce=Fe,re=De)}}}ne=re,re=y[ne],ae+=ne-re&32767}if(X){f[D++]=268435456|om[K]<<18|IO[X];var Je=om[K]&31,nt=IO[X]&31;N+=mc[Je]+gc[nt],++E[257+Je],++S[nt],U=x+K,++A}else f[D++]=n[x],++E[n[x]]}}for(x=Math.max(x,U);x=s&&(l[d/8|0]=c,mt=s),d=YA(l,d+1,n.subarray(x,mt))}a.i=s}return gg(o,0,r+mg(d)+i)},t3=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}}},n3=function(n,e,t,r,i){if(!i&&(i={l:1},e.dictionary)){var a=e.dictionary.subarray(-32768),s=new fr(a.length+n.length);s.set(a),s.set(n,a.length),n=s,i.w=a.length}return e3(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)},um=function(n,e,t){for(;t;++e)n[e]=t,t>>>=8},i3=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&&um(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)}},a3=function(n){(n[0]!=31||n[1]!=139||n[2]!=8)&&Mr(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)},s3=function(n){var e=n.length;return(n[e-4]|n[e-3]<<8|n[e-2]<<16|n[e-1]<<24)>>>0},o3=function(n){return 10+(n.filename?n.filename.length+1:0)},l3=function(n,e){return((n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31)&&Mr(6,"invalid zlib data"),(n[1]>>5&1)==+!e&&Mr(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function c3(n,e){return _g(n,{i:2},e&&e.out,e&&e.dictionary)}function u3(n,e){e||(e={});var t=r3(),r=n.length;t.p(n);var i=n3(n,e,o3(e),8),a=i.length;return i3(i,e),um(i,a-8,t.d()),um(i,a-4,r),i}function d3(n,e){var t=a3(n);return t+8>n.length&&Mr(6,"invalid gzip data"),_g(n.subarray(t,-8),{i:2},e&&e.out||new fr(s3(n)),e&&e.dictionary)}function p3(n,e){return _g(n.subarray(l3(n,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}function f3(n,e){return n[0]==31&&n[1]==139&&n[2]==8?d3(n,e):(n[0]&15)!=8||n[0]>>4>7||(n[0]<<8|n[1])%31?c3(n,e):p3(n,e)}var dm=typeof TextDecoder<"u"&&new TextDecoder,h3=0;try{dm.decode(GA,{stream:!0}),h3=1}catch{}var m3=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:gg(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(f===!1)return JSON.parse(JSON.stringify(E));var S={};for(var A in E)E.hasOwnProperty(A)&&(S[A]=E[A].defaultValue);return S}function t(){var f=e(!0),E={};for(var S in f)f.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(f,E){return s[f]=E,this},r.getOption=function(f){return s[f]},r.getOptions=function(){return s},r.resetOptions=function(){s=e(!0)},r.setFlavor=function(f){if(!l.hasOwnProperty(f))throw Error(f+" flavor was not found");r.resetOptions();var E=l[f];o=f;for(var S in E)E.hasOwnProperty(S)&&(s[S]=E[S])},r.getFlavor=function(){return o},r.getFlavorOptions=function(f){if(l.hasOwnProperty(f))return l[f]},r.getDefaultOptions=function(f){return e(f)},r.subParser=function(f,E){if(r.helper.isString(f))if(typeof E<"u")i[f]=E;else{if(i.hasOwnProperty(f))return i[f];throw Error("SubParser named "+f+" not registered!")}},r.extension=function(f,E){if(!r.helper.isString(f))throw Error("Extension 'name' must be a string");if(f=r.helper.stdExtName(f),r.helper.isUndefined(E)){if(!a.hasOwnProperty(f))throw Error("Extension named "+f+" is not registered!");return a[f]}else{typeof E=="function"&&(E=E()),r.helper.isArray(E)||(E=[E]);var S=c(E,f);if(S.valid)a[f]=E;else throw Error(S.error)}},r.getAllExtensions=function(){return a},r.removeExtension=function(f){delete a[f]},r.resetExtensions=function(){a={}};function c(f,E){var S=E?"Error in "+E+" extension->":"Error in unnamed extension",A={valid:!0,error:""};r.helper.isArray(f)||(f=[f]);for(var N=0;N"u"},r.helper.forEach=function(f,E){if(r.helper.isUndefined(f))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 f.forEach=="function")f.forEach(E);else if(r.helper.isArray(f))for(var S=0;S").replace(/&/g,"&")};var p=function(f,E,S,A){var N=A||"",x=N.indexOf("g")>-1,D=new RegExp(E+"|"+S,"g"+N.replace(/g/g,"")),U=new RegExp(E,N.replace(/g/g,"")),ee=[],ie,ne,re,L,F;do for(ie=0;re=D.exec(f);)if(U.test(re[0]))ie++||(ne=D.lastIndex,L=ne-re[0].length);else if(ie&&!--ie){F=re.index+re[0].length;var K={left:{start:L,end:ne},match:{start:ne,end:re.index},right:{start:re.index,end:F},wholeMatch:{start:L,end:F}};if(ee.push(K),!x)return ee}while(ie&&(D.lastIndex=ne));return ee};r.helper.matchRecursiveRegExp=function(f,E,S,A){for(var N=p(f,E,S,A),x=[],D=0;D0){var ie=[];D[0].wholeMatch.start!==0&&ie.push(f.slice(0,D[0].wholeMatch.start));for(var ne=0;ne=0?A+(S||0):A},r.helper.splitAtIndex=function(f,E){if(!r.helper.isString(f))throw"InvalidArgumentError: first parameter of showdown.helper.regexIndexOf function must be a string";return[f.substring(0,E),f.substring(E)]},r.helper.encodeEmailAddress=function(f){var E=[function(S){return"&#"+S.charCodeAt(0)+";"},function(S){return"&#x"+S.charCodeAt(0).toString(16)+";"},function(S){return S}];return f=f.replace(/./g,function(S){if(S==="@")S=E[Math.floor(Math.random()*2)](S);else{var A=Math.random();S=A>.9?E[2](S):A>.45?E[1](S):E[0](S)}return S}),f},r.helper.padEnd=function(E,S,A){return S=S>>0,A=String(A||" "),E.length>S?String(E):(S=S-E.length,S>A.length&&(A+=A.repeat(S/A.length)),String(E)+A.slice(0,S))},typeof console>"u"&&(console={warn:function(f){alert(f)},log:function(f){alert(f)},error:function(f){throw f}}),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(f){var E={},S=[],A=[],N={},x=o,D={parsed:{},raw:"",format:""};U();function U(){f=f||{};for(var L in s)s.hasOwnProperty(L)&&(E[L]=s[L]);if(typeof f=="object")for(var F in f)f.hasOwnProperty(F)&&(E[F]=f[F]);else throw Error("Converter expects the passed parameter to be an object, but "+typeof f+" was passed instead.");E.extensions&&r.helper.forEach(E.extensions,ee)}function ee(L,F){if(F=F||null,r.helper.isString(L))if(L=r.helper.stdExtName(L),F=L,r.extensions[L]){console.warn("DEPRECATION WARNING: "+L+" is an old extension that uses a deprecated loading method.Please inform the developer that the extension should be updated!"),ie(r.extensions[L],L);return}else if(!r.helper.isUndefined(a[L]))L=a[L];else throw Error('Extension "'+L+'" could not be loaded. It was either not found or is not a valid extension.');typeof L=="function"&&(L=L()),r.helper.isArray(L)||(L=[L]);var K=c(L,F);if(!K.valid)throw Error(K.error);for(var X=0;X Topos - +