From 9e9a4d968f377defa46d8fab69be98d1fd8bb960 Mon Sep 17 00:00:00 2001 From: amiika Date: Fri, 17 Nov 2023 14:10:01 +0000 Subject: [PATCH] deploy: 569f0add3d732cb5c93f13e0e75420e77ed3cc08 --- .../{index-70b0bd84.js => index-fb9d67fc.js} | 2 +- ...ex-70b0bd84.js.gz => index-fb9d67fc.js.gz} | Bin 747773 -> 747782 bytes index.html | 2 +- index.html.gz | Bin 11891 -> 11891 bytes sw.js | 2 +- 5 files changed, 3 insertions(+), 3 deletions(-) rename assets/{index-70b0bd84.js => index-fb9d67fc.js} (99%) rename assets/{index-70b0bd84.js.gz => index-fb9d67fc.js.gz} (99%) diff --git a/assets/index-70b0bd84.js b/assets/index-fb9d67fc.js similarity index 99% rename from assets/index-70b0bd84.js rename to assets/index-fb9d67fc.js index 07b6e0f..8f43331 100644 --- a/assets/index-70b0bd84.js +++ b/assets/index-fb9d67fc.js @@ -3170,5 +3170,5 @@ https://github.com/highlightjs/highlight.js/issues/2277`),se=P,ne=q),z===void 0& `+m+" | "+t("",l.column-1," ")+t("",R,"^")}else a+=` at `+u}return a},e.buildMessage=function(i,a){var s={literal:function(_){return'"'+l(_.text)+'"'},class:function(_){var E=_.parts.map(function(R){return Array.isArray(R)?c(R[0])+"-"+c(R[1]):c(R)});return"["+(_.inverted?"^":"")+E.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(E){return"\\x0"+o(E)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(E){return"\\x"+o(E)})}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(E){return"\\x0"+o(E)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(E){return"\\x"+o(E)})}function u(_){return s[_.type](_)}function p(_){var E=_.map(u),R,w;if(E.sort(),E.length>0){for(R=1,w=1;R",w="@",k=":",$="/",H="(",h=")",S="[:",b="]",N="[",M="{",B="}",F="+",V="*",re="%",ae="^",ie="&",te=">>",x="<<",P="_",q="?",z="!",ne="r",se="#",_e="b",ye="iii",Ae="ii",Ee="iv",Ie="i",de="vii",Pe="vi",je="v",Fe=/^[0-9]/,rt=/^[ \n\r\t]/,st=/^[a-z]/,gt=/^[a-z_]/,yt=/^[a-z_0-9]/,_t=/^[mklpdcwyhnqaefsxtgujzo]/,Rt=/^[a-zA-Z0-9]/,xt=/^[a-zA-Z0-9\-*+]/,Fn=/^[A-G]/,Ve=/^[bs]/,cn=ct("-",!1),Je=or([["0","9"]],!1,!1),Me=ct(".",!1),an=vo("whitespace"),en=or([" ",` `,"\r"," "],!1,!1),un=ct(",",!1),K=ct("|",!1),me=or([["a","z"]],!1,!1),xe=or([["a","z"],"_"],!1,!1),Le=or([["a","z"],"_",["0","9"]],!1,!1),tt=ct("<",!1),we=ct(">",!1),Zt=ct("@",!1),ut=ct(":",!1),It=or(["m","k","l","p","d","c","w","y","h","n","q","a","e","f","s","x","t","g","u","j","z","o"],!1,!1),nr=ct("/",!1),ft=ct("(",!1),tn=ct(")",!1),Ct=ct("[:",!1),Ye=ct("]",!1),Xn=ct("[",!1),ei=ct("{",!1),dt=ct("}",!1),rr=ct("+",!1),Un=ct("*",!1),Qi=ct("%",!1),Yn=ct("^",!1),Kt=ct("&",!1),Br=ct(">>",!1),Ta=ct("<<",!1),Ei=ct("_",!1),ya=ct("?",!1),Or=ct("!",!1),vi=ct("r",!1),Fr=or([["a","z"],["A","Z"],["0","9"]],!1,!1),nn=ct("#",!1),Ti=ct("b",!1),yi=or([["a","z"],["A","Z"],["0","9"],"-","*","+"],!1,!1),W=or([["A","G"]],!1,!1),oe=or(["b","s"],!1,!1),pe=ct("iii",!1),Se=ct("ii",!1),Ne=ct("iv",!1),qe=ct("i",!1),Be=ct("vii",!1),At=ct("vi",!1),$n=ct("v",!1),ir=function(T){return T.filter(D=>D)},ns=function(){return parseFloat(Kn())},Ca=function(){return parseInt(Kn())},so=function(){return parseInt(Kn())},ar=function(){},oo=function(T){return $t(ZQ,{sound:T})},rs=function(){return Kn()},is=function(T){return $t(tl,{items:T})},lo=function(T){return T},as=function(T,D){return $t(KQ,{item:T,sound:D})},co=function(T,D){return $t(jQ,{item:T,soundIndex:D})},ss=function(T){return T},Zn=function(){return cQ[Kn()]},uo=function(T,D){return T/D},po=function(T){return T.filter(D=>D)},os=function(T){return $t(tl,{items:T})},ls=function(T,D){return D?$t(fv,{item:T,times:D}):$t(hv,{items:T})},fo=function(T){return T},cs=function(T,D,U){return $t(rq,{left:T,operation:D,right:U})},ho=function(T,D){return $t(nq,{items:T,times:D})},us=function(T){return $t(bI,{items:T})},mo=function(T){return T.map(D=>typeof D=="number"?D:void 0)},go=function(){return Math.ceil(mI(Kn()))},Er=function(T){var D=T.filter(U=>U).map(U=>$t(_n,{pitch:U[0]},U.toString()));return $t(hv,{items:D})},Et=function(T){return T},_o=function(T){return T},qi=function(){},bo=function(T){return $t(tl,{items:T})},Ci=function(T){return $t(eq,{octave:T})},So=function(){return Kn().split("").reduce((T,D)=>T+(D==="^"?1:-1),0)},Vi=function(){return $t(Tu,{seededRandom:a.seededRandom})},ds=function(T,D){return $t(Tu,{min:T,max:D,seededRandom:a.seededRandom})},ps=function(T,D){return $t(fv,{item:T,times:D})},Oo=function(T){return $t(tq,{duration:T})},zi=function(T){return T},fs=function(T){return $t($g,{duration:T})},Hi=function(T,D,U,J){const ue=T?a.nodeOptions.octave+T:a.nodeOptions.octave;return $t(_n,{duration:D,pitch:J,pitchOctave:ue,add:U})},Wi=function(T){return T.reduce((D,U)=>D+(U==="#"?1:-1),0)},hs=function(T,D,U){return $t(Cn,{pitches:[T].concat(D),inversion:U})},Aa=function(){return Kn()},Ai=function(T){return T},Tn=function(){return Kn()},ms=function(T,D,U,J,ue){const Te=a.nodeOptions.scaleName?a.nodeOptions.scaleName:"MAJOR",mt=a.nodeOptions.key?a.nodeOptions.key:"C",yr=pq(J,U,Te,T,D),Ao=D||a.nodeOptions.duration,SD=T?a.nodeOptions.octave+T:a.nodeOptions.octave;return $t(Cn,{duration:Ao,chordOctave:SD,pitches:yr,chordName:J,inversion:ue,scaleName:Te,key:mt})},sr=function(T,D,U){const J=a.nodeOptions.scaleName?a.nodeOptions.scaleName:"MAJOR",ue=a.nodeOptions.key?a.nodeOptions.key:"C";return $t(JQ,{roman:T,chordName:D,inversion:U,scaleName:J,key:ue})},Ia=function(T){const D=a.nodeOptions.scaleName?a.nodeOptions.scaleName:"MAJOR",U=a.nodeOptions.key?a.nodeOptions.key:"C",J=Oq(T,U,D);return $t(_n,{pitch:J.pc,add:J.add,scaleName:D,key:U})},A=0,Ze=0,gs=[{line:1,column:1}],vr=0,Eo=[],ve=0,be={},Ra;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 Kn(){return i.substring(Ze,A)}function $l(){return d(Ze,A)}function ct(T,D){return{type:"literal",text:T,ignoreCase:D}}function or(T,D,U){return{type:"class",parts:T,inverted:D,ignoreCase:U}}function Gl(){return{type:"end"}}function vo(T){return{type:"other",description:T}}function Ql(T){var D=gs[T],U;if(D)return D;for(U=T-1;!gs[U];)U--;for(D=gs[U],D={line:D.line,column:D.column};Uvr&&(vr=A,Eo=[]),Eo.push(T))}function g(T,D,U){return new e(e.buildMessage(T,D),T,D,U)}function O(){var T,D,U=A*56+0,J=be[U];return J?(A=J.nextPos,J.result):(T=A,D=jt(),D!==s&&(Ze=T,D=ir(D)),T=D,be[U]={nextPos:A,result:T},T)}function y(){var T,D,U,J,ue,Te,mt,yr=A*56+1,Ao=be[yr];if(Ao)return A=Ao.nextPos,Ao.result;for(T=A,D=A,i.charCodeAt(A)===45?(U=u,A++):(U=s,ve===0&&f(cn)),U===s&&(U=null),J=[],Fe.test(i.charAt(A))?(ue=i.charAt(A),A++):(ue=s,ve===0&&f(Je));ue!==s;)J.push(ue),Fe.test(i.charAt(A))?(ue=i.charAt(A),A++):(ue=s,ve===0&&f(Je));if(i.charCodeAt(A)===46?(ue=p,A++):(ue=s,ve===0&&f(Me)),ue!==s){if(Te=[],Fe.test(i.charAt(A))?(mt=i.charAt(A),A++):(mt=s,ve===0&&f(Je)),mt!==s)for(;mt!==s;)Te.push(mt),Fe.test(i.charAt(A))?(mt=i.charAt(A),A++):(mt=s,ve===0&&f(Je));else Te=s;Te!==s?(U=[U,J,ue,Te],D=U):(A=D,D=s)}else A=D,D=s;if(D===s)if(D=A,i.charCodeAt(A)===46?(U=p,A++):(U=s,ve===0&&f(Me)),U!==s){if(J=[],Fe.test(i.charAt(A))?(ue=i.charAt(A),A++):(ue=s,ve===0&&f(Je)),ue!==s)for(;ue!==s;)J.push(ue),Fe.test(i.charAt(A))?(ue=i.charAt(A),A++):(ue=s,ve===0&&f(Je));else J=s;J!==s?(U=[U,J],D=U):(A=D,D=s)}else A=D,D=s;return D!==s&&(Ze=T,D=ns()),T=D,be[yr]={nextPos:A,result:T},T}function C(){var T,D,U=A*56+2,J=be[U];return J?(A=J.nextPos,J.result):(T=A,i.charCodeAt(A)===45?A++:ve===0&&f(cn),Fe.test(i.charAt(A))?(D=i.charAt(A),A++):(D=s,ve===0&&f(Je)),D!==s?(Ze=T,T=Ca()):(A=T,T=s),be[U]={nextPos:A,result:T},T)}function L(){var T,D,U,J=A*56+3,ue=be[J];if(ue)return A=ue.nextPos,ue.result;if(T=A,i.charCodeAt(A)===45?A++:ve===0&&f(cn),D=[],Fe.test(i.charAt(A))?(U=i.charAt(A),A++):(U=s,ve===0&&f(Je)),U!==s)for(;U!==s;)D.push(U),Fe.test(i.charAt(A))?(U=i.charAt(A),A++):(U=s,ve===0&&f(Je));else D=s;return D!==s?(Ze=T,T=so()):(A=T,T=s),be[J]={nextPos:A,result:T},T}function G(){var T,D,U=A*56+4,J=be[U];return J?(A=J.nextPos,J.result):(ve++,T=A,rt.test(i.charAt(A))?(D=i.charAt(A),A++):(D=s,ve===0&&f(en)),D!==s&&(Ze=T,D=ar()),T=D,ve--,T===s&&(D=s,ve===0&&f(an)),be[U]={nextPos:A,result:T},T)}function Y(){var T,D,U=A*56+8,J=be[U];return J?(A=J.nextPos,J.result):(T=A,D=j(),D!==s&&(Ze=T,D=oo(D)),T=D,be[U]={nextPos:A,result:T},T)}function j(){var T,D,U,J,ue,Te=A*56+10,mt=be[Te];if(mt)return A=mt.nextPos,mt.result;if(T=A,st.test(i.charAt(A))?(D=i.charAt(A),A++):(D=s,ve===0&&f(me)),D!==s){if(U=[],gt.test(i.charAt(A))?(J=i.charAt(A),A++):(J=s,ve===0&&f(xe)),J!==s)for(;J!==s;)U.push(J),gt.test(i.charAt(A))?(J=i.charAt(A),A++):(J=s,ve===0&&f(xe));else U=s;if(U!==s){for(J=[],yt.test(i.charAt(A))?(ue=i.charAt(A),A++):(ue=s,ve===0&&f(Le));ue!==s;)J.push(ue),yt.test(i.charAt(A))?(ue=i.charAt(A),A++):(ue=s,ve===0&&f(Le));Ze=T,T=rs()}else A=T,T=s}else A=T,T=s;return be[Te]={nextPos:A,result:T},T}function Z(){var T,D=A*56+11,U=be[D];return U?(A=U.nextPos,U.result):(T=fe(),T===s&&(T=ge()),be[D]={nextPos:A,result:T},T)}function fe(){var T,D,U,J,ue=A*56+12,Te=be[ue];if(Te)return A=Te.nextPos,Te.result;if(T=A,i.charCodeAt(A)===60?(D=E,A++):(D=s,ve===0&&f(tt)),D!==s){if(U=[],J=Z(),J!==s)for(;J!==s;)U.push(J),J=Z();else U=s;U!==s?(i.charCodeAt(A)===62?(J=R,A++):(J=s,ve===0&&f(we)),J!==s?(Ze=T,T=is(U)):(A=T,T=s)):(A=T,T=s)}else A=T,T=s;return be[ue]={nextPos:A,result:T},T}function ge(){var T,D=A*56+13,U=be[D];return U?(A=U.nextPos,U.result):(T=j(),T===s&&(T=fe(),T===s&&(T=G())),be[D]={nextPos:A,result:T},T)}function ce(){var T,D,U,J=A*56+14,ue=be[J];return ue?(A=ue.nextPos,ue.result):(T=A,i.charCodeAt(A)===64?(D=w,A++):(D=s,ve===0&&f(Zt)),D!==s?(U=Z(),U!==s?(Ze=T,T=lo(U)):(A=T,T=s)):(A=T,T=s),be[J]={nextPos:A,result:T},T)}function le(){var T,D=A*56+15,U=be[D];return U?(A=U.nextPos,U.result):(T=dn(),T===s&&(T=ot(),T===s&&(T=Ht(),T===s&&(T=Xu(),T===s&&(T=zt())))),be[D]={nextPos:A,result:T},T)}function Re(){var T,D,U,J=A*56+16,ue=be[J];return ue?(A=ue.nextPos,ue.result):(T=A,D=le(),D===s&&(D=Co()),D!==s?(U=ce(),U!==s?(Ze=T,T=as(D,U)):(A=T,T=s)):(A=T,T=s),be[J]={nextPos:A,result:T},T)}function Oe(){var T,D,U,J=A*56+17,ue=be[J];return ue?(A=ue.nextPos,ue.result):(T=A,D=Re(),D===s&&(D=le(),D===s&&(D=Co())),D!==s?(U=He(),U!==s?(Ze=T,T=co(D,U)):(A=T,T=s)):(A=T,T=s),be[J]={nextPos:A,result:T},T)}function He(){var T,D,U,J=A*56+18,ue=be[J];return ue?(A=ue.nextPos,ue.result):(T=A,i.charCodeAt(A)===58?(D=k,A++):(D=s,ve===0&&f(ut)),D!==s?(U=Dt(),U!==s?(Ze=T,T=ss(U)):(A=T,T=s)):(A=T,T=s),be[J]={nextPos:A,result:T},T)}function et(){var T,D,U=A*56+19,J=be[U];return J?(A=J.nextPos,J.result):(T=A,_t.test(i.charAt(A))?(D=i.charAt(A),A++):(D=s,ve===0&&f(It)),D!==s&&(Ze=T,D=Zn()),T=D,be[U]={nextPos:A,result:T},T)}function $e(){var T,D=A*56+20,U=be[D];return U?(A=U.nextPos,U.result):(T=wt(),T===s&&(T=y(),T===s&&(T=et())),be[D]={nextPos:A,result:T},T)}function wt(){var T,D,U,J,ue=A*56+21,Te=be[ue];return Te?(A=Te.nextPos,Te.result):(T=A,D=L(),D!==s?(i.charCodeAt(A)===47?(U=$,A++):(U=s,ve===0&&f(nr)),U!==s?(J=L(),J!==s?(Ze=T,T=uo(D,J)):(A=T,T=s)):(A=T,T=s)):(A=T,T=s),be[ue]={nextPos:A,result:T},T)}function jt(){var T,D,U,J=A*56+22,ue=be[J];if(ue)return A=ue.nextPos,ue.result;if(T=A,D=[],U=C1(),U===s&&(U=Oe(),U===s&&(U=Re(),U===s&&(U=dn(),U===s&&(U=Ht(),U===s&&(U=ot(),U===s&&(U=zt(),U===s&&(U=Co(),U===s&&(U=Xu())))))))),U!==s)for(;U!==s;)D.push(U),U=C1(),U===s&&(U=Oe(),U===s&&(U=Re(),U===s&&(U=dn(),U===s&&(U=Ht(),U===s&&(U=ot(),U===s&&(U=zt(),U===s&&(U=Co(),U===s&&(U=Xu()))))))));else D=s;return D!==s&&(Ze=T,D=po(D)),T=D,be[J]={nextPos:A,result:T},T}function Dt(){var T,D=A*56+23,U=be[D];return U?(A=U.nextPos,U.result):(T=G(),T===s&&(T=L(),T===s&&(T=y1(),T===s&&(T=Ku(),T===s&&(T=sn(),T===s&&(T=v1()))))),be[D]={nextPos:A,result:T},T)}function sn(){var T,D,U,J,ue=A*56+24,Te=be[ue];if(Te)return A=Te.nextPos,Te.result;if(T=A,i.charCodeAt(A)===60?(D=E,A++):(D=s,ve===0&&f(tt)),D!==s){if(U=[],J=Dt(),J!==s)for(;J!==s;)U.push(J),J=Dt();else U=s;U!==s?(i.charCodeAt(A)===62?(J=R,A++):(J=s,ve===0&&f(we)),J!==s?(Ze=T,T=os(U)):(A=T,T=s)):(A=T,T=s)}else A=T,T=s;return be[ue]={nextPos:A,result:T},T}function ot(){var T,D,U,J,ue,Te=A*56+25,mt=be[Te];return mt?(A=mt.nextPos,mt.result):(T=A,i.charCodeAt(A)===40?(D=H,A++):(D=s,ve===0&&f(ft)),D!==s?(i.charCodeAt(A)===58?A++:ve===0&&f(ut),U=jt(),U!==s?(J=ht(),J===s&&(J=null),i.charCodeAt(A)===41?(ue=h,A++):(ue=s,ve===0&&f(tn)),ue!==s?(Ze=T,T=ls(U,J)):(A=T,T=s)):(A=T,T=s)):(A=T,T=s),be[Te]={nextPos:A,result:T},T)}function ht(){var T,D,U,J=A*56+26,ue=be[J];return ue?(A=ue.nextPos,ue.result):(T=A,i.charCodeAt(A)===58?(D=k,A++):(D=s,ve===0&&f(ut)),D!==s?(U=L(),U!==s?(Ze=T,T=fo(U)):(A=T,T=s)):(A=T,T=s),be[J]={nextPos:A,result:T},T)}function dn(){var T,D,U,J,ue=A*56+27,Te=be[ue];return Te?(A=Te.nextPos,Te.result):(T=A,D=ot(),D!==s?(U=T1(),U!==s?(J=ot(),J!==s?(Ze=T,T=cs(D,U,J)):(A=T,T=s)):(A=T,T=s)):(A=T,T=s),be[ue]={nextPos:A,result:T},T)}function zt(){var T,D,U,J,ue,Te=A*56+28,mt=be[Te];return mt?(A=mt.nextPos,mt.result):(T=A,i.substr(A,2)===S?(D=S,A+=2):(D=s,ve===0&&f(Ct)),D!==s?(U=jt(),U!==s?(J=ht(),J===s&&(J=null),i.charCodeAt(A)===93?(ue=b,A++):(ue=s,ve===0&&f(Ye)),ue!==s?(Ze=T,T=ho(U,J)):(A=T,T=s)):(A=T,T=s)):(A=T,T=s),be[Te]={nextPos:A,result:T},T)}function Ht(){var T,D,U,J,ue=A*56+29,Te=be[ue];return Te?(A=Te.nextPos,Te.result):(T=A,i.charCodeAt(A)===91?(D=N,A++):(D=s,ve===0&&f(Xn)),D!==s?(U=jt(),U!==s?(i.charCodeAt(A)===93?(J=b,A++):(J=s,ve===0&&f(Ye)),J!==s?(Ze=T,T=us(U)):(A=T,T=s)):(A=T,T=s)):(A=T,T=s),be[ue]={nextPos:A,result:T},T)}function Tr(){var T,D=A*56+30,U=be[D];return U?(A=U.nextPos,U.result):(T=L(),T===s&&(T=C()),be[D]={nextPos:A,result:T},T)}function To(){var T,D,U,J=A*56+31,ue=be[J];if(ue)return A=ue.nextPos,ue.result;if(T=A,D=[],U=ql(),U===s&&(U=Tr()),U!==s)for(;U!==s;)D.push(U),U=ql(),U===s&&(U=Tr());else D=s;return D!==s&&(Ze=T,D=mo(D)),T=D,be[J]={nextPos:A,result:T},T}function ql(){var T,D,U,J,ue=A*56+32,Te=be[ue];return Te?(A=Te.nextPos,Te.result):(T=A,i.charCodeAt(A)===40?A++:ve===0&&f(ft),D=Tr(),D!==s?(U=T1(),U!==s?(J=To(),J!==s?(i.charCodeAt(A)===41?A++:ve===0&&f(tn),Ze=T,T=go()):(A=T,T=s)):(A=T,T=s)):(A=T,T=s),be[ue]={nextPos:A,result:T},T)}function yo(){var T,D,U,J,ue=A*56+33,Te=be[ue];if(Te)return A=Te.nextPos,Te.result;if(T=A,i.charCodeAt(A)===123?(D=M,A++):(D=s,ve===0&&f(ei)),D!==s){if(U=[],J=To(),J===s&&(J=G()),J!==s)for(;J!==s;)U.push(J),J=To(),J===s&&(J=G());else U=s;U!==s?(i.charCodeAt(A)===125?(J=B,A++):(J=s,ve===0&&f(dt)),J!==s?(Ze=T,T=Er(U)):(A=T,T=s)):(A=T,T=s)}else A=T,T=s;return be[ue]={nextPos:A,result:T},T}function v1(){var T,D,U,J,ue=A*56+34,Te=be[ue];return Te?(A=Te.nextPos,Te.result):(T=A,i.charCodeAt(A)===123?(D=M,A++):(D=s,ve===0&&f(ei)),D!==s?(U=L(),U===s&&(U=Ku()),U!==s?(i.charCodeAt(A)===125?(J=B,A++):(J=s,ve===0&&f(dt)),J!==s?(Ze=T,T=Et(U)):(A=T,T=s)):(A=T,T=s)):(A=T,T=s),be[ue]={nextPos:A,result:T},T)}function T1(){var T,D=A*56+35,U=be[D];return U?(A=U.nextPos,U.result):(i.charCodeAt(A)===43?(T=F,A++):(T=s,ve===0&&f(rr)),T===s&&(i.charCodeAt(A)===45?(T=u,A++):(T=s,ve===0&&f(cn)),T===s&&(i.charCodeAt(A)===42?(T=V,A++):(T=s,ve===0&&f(Un)),T===s&&(i.charCodeAt(A)===47?(T=$,A++):(T=s,ve===0&&f(nr)),T===s&&(i.charCodeAt(A)===37?(T=re,A++):(T=s,ve===0&&f(Qi)),T===s&&(i.charCodeAt(A)===94?(T=ae,A++):(T=s,ve===0&&f(Yn)),T===s&&(i.charCodeAt(A)===124?(T=_,A++):(T=s,ve===0&&f(K)),T===s&&(i.charCodeAt(A)===38?(T=ie,A++):(T=s,ve===0&&f(Kt)),T===s&&(i.substr(A,2)===te?(T=te,A+=2):(T=s,ve===0&&f(Br)),T===s&&(i.substr(A,2)===x?(T=x,A+=2):(T=s,ve===0&&f(Ta))))))))))),be[D]={nextPos:A,result:T},T)}function Co(){var T,D,U=A*56+36,J=be[U];return J?(A=J.nextPos,J.result):(T=A,D=fD(),D===s&&(D=_D(),D===s&&(D=gD(),D===s&&(D=bD(),D===s&&(D=Y(),D===s&&(D=mD(),D===s&&(D=Vl(),D===s&&(D=uD(),D===s&&(D=G(),D===s&&(D=dD(),D===s&&(D=ot(),D===s&&(D=yo(),D===s&&(D=cD())))))))))))),D!==s&&(Ze=T,D=_o(D)),T=D,be[U]={nextPos:A,result:T},T)}function cD(){var T,D,U=A*56+37,J=be[U];return J?(A=J.nextPos,J.result):(T=A,i.charCodeAt(A)===124?(D=_,A++):(D=s,ve===0&&f(K)),D!==s&&(Ze=T,D=qi()),T=D,be[U]={nextPos:A,result:T},T)}function Xu(){var T,D,U,J,ue=A*56+38,Te=be[ue];return Te?(A=Te.nextPos,Te.result):(T=A,i.charCodeAt(A)===60?(D=E,A++):(D=s,ve===0&&f(tt)),D!==s?(U=jt(),U!==s?(i.charCodeAt(A)===62?(J=R,A++):(J=s,ve===0&&f(we)),J!==s?(Ze=T,T=bo(U)):(A=T,T=s)):(A=T,T=s)):(A=T,T=s),be[ue]={nextPos:A,result:T},T)}function uD(){var T,D,U=A*56+39,J=be[U];return J?(A=J.nextPos,J.result):(T=A,D=Zu(),D!==s&&(Ze=T,D=Ci(D)),T=D,be[U]={nextPos:A,result:T},T)}function Zu(){var T,D,U,J=A*56+40,ue=be[J];if(ue)return A=ue.nextPos,ue.result;if(T=A,D=[],i.charCodeAt(A)===94?(U=ae,A++):(U=s,ve===0&&f(Yn)),U===s&&(i.charCodeAt(A)===95?(U=P,A++):(U=s,ve===0&&f(Ei))),U!==s)for(;U!==s;)D.push(U),i.charCodeAt(A)===94?(U=ae,A++):(U=s,ve===0&&f(Yn)),U===s&&(i.charCodeAt(A)===95?(U=P,A++):(U=s,ve===0&&f(Ei)));else D=s;return D!==s&&(Ze=T,D=So()),T=D,be[J]={nextPos:A,result:T},T}function y1(){var T,D,U=A*56+41,J=be[U];return J?(A=J.nextPos,J.result):(T=A,i.charCodeAt(A)===63?(D=q,A++):(D=s,ve===0&&f(ya)),D!==s&&(Ze=T,D=Vi()),T=D,be[U]={nextPos:A,result:T},T)}function Ku(){var T,D,U,J,ue,Te,mt=A*56+42,yr=be[mt];return yr?(A=yr.nextPos,yr.result):(T=A,i.charCodeAt(A)===40?(D=H,A++):(D=s,ve===0&&f(ft)),D!==s?(U=L(),U!==s?(i.charCodeAt(A)===44?(J=m,A++):(J=s,ve===0&&f(un)),J!==s?(ue=L(),ue!==s?(i.charCodeAt(A)===41?(Te=h,A++):(Te=s,ve===0&&f(tn)),Te!==s?(Ze=T,T=ds(U,ue)):(A=T,T=s)):(A=T,T=s)):(A=T,T=s)):(A=T,T=s)):(A=T,T=s),be[mt]={nextPos:A,result:T},T)}function C1(){var T,D,U,J,ue=A*56+43,Te=be[ue];return Te?(A=Te.nextPos,Te.result):(T=A,D=Oe(),D===s&&(D=Re(),D===s&&(D=le(),D===s&&(D=Co()))),D!==s?(i.charCodeAt(A)===33?(U=z,A++):(U=s,ve===0&&f(Or)),U!==s?(J=L(),J!==s?(Ze=T,T=ps(D,J)):(A=T,T=s)):(A=T,T=s)):(A=T,T=s),be[ue]={nextPos:A,result:T},T)}function dD(){var T,D,U=A*56+44,J=be[U];return J?(A=J.nextPos,J.result):(T=A,D=$e(),D!==s&&(Ze=T,D=Oo(D)),T=D,be[U]={nextPos:A,result:T},T)}function pD(){var T,D,U,J=A*56+45,ue=be[J];return ue?(A=ue.nextPos,ue.result):(T=A,D=$e(),D!==s?(i.charCodeAt(A)===94?(U=ae,A++):(U=s,ve===0&&f(Yn)),U!==s?(Ze=T,T=zi(D)):(A=T,T=s)):(A=T,T=s),be[J]={nextPos:A,result:T},T)}function fD(){var T,D,U,J,ue,Te=A*56+46,mt=be[Te];return mt?(A=mt.nextPos,mt.result):(T=A,D=pD(),D===s&&(D=null),i.charCodeAt(A)===114?(U=ne,A++):(U=s,ve===0&&f(vi)),U!==s?(J=A,ve++,Rt.test(i.charAt(A))?(ue=i.charAt(A),A++):(ue=s,ve===0&&f(Fr)),ve--,ue===s?J=void 0:(A=J,J=s),J!==s?(Ze=T,T=fs(D)):(A=T,T=s)):(A=T,T=s),be[Te]={nextPos:A,result:T},T)}function Vl(){var T,D,U,J,ue,Te=A*56+47,mt=be[Te];return mt?(A=mt.nextPos,mt.result):(T=A,D=Zu(),D===s&&(D=null),U=$e(),U===s&&(U=null),J=hD(),J===s&&(J=null),ue=C(),ue===s&&(ue=y1(),ue===s&&(ue=Ku(),ue===s&&(ue=v1()))),ue!==s?(Ze=T,T=Hi(D,U,J,ue)):(A=T,T=s),be[Te]={nextPos:A,result:T},T)}function hD(){var T,D,U,J=A*56+48,ue=be[J];if(ue)return A=ue.nextPos,ue.result;if(T=A,D=[],i.charCodeAt(A)===35?(U=se,A++):(U=s,ve===0&&f(nn)),U===s&&(i.charCodeAt(A)===98?(U=_e,A++):(U=s,ve===0&&f(Ti))),U!==s)for(;U!==s;)D.push(U),i.charCodeAt(A)===35?(U=se,A++):(U=s,ve===0&&f(nn)),U===s&&(i.charCodeAt(A)===98?(U=_e,A++):(U=s,ve===0&&f(Ti)));else D=s;return D!==s&&(Ze=T,D=Wi(D)),T=D,be[J]={nextPos:A,result:T},T}function mD(){var T,D,U,J,ue=A*56+49,Te=be[ue];if(Te)return A=Te.nextPos,Te.result;if(T=A,D=Vl(),D!==s){if(U=[],J=Vl(),J!==s)for(;J!==s;)U.push(J),J=Vl();else U=s;U!==s?(J=ju(),J===s&&(J=null),Ze=T,T=hs(D,U,J)):(A=T,T=s)}else A=T,T=s;return be[ue]={nextPos:A,result:T},T}function A1(){var T,D,U,J=A*56+50,ue=be[J];if(ue)return A=ue.nextPos,ue.result;if(T=A,D=[],xt.test(i.charAt(A))?(U=i.charAt(A),A++):(U=s,ve===0&&f(yi)),U!==s)for(;U!==s;)D.push(U),xt.test(i.charAt(A))?(U=i.charAt(A),A++):(U=s,ve===0&&f(yi));else D=s;return D!==s&&(Ze=T,D=Aa()),T=D,be[J]={nextPos:A,result:T},T}function ju(){var T,D,U,J=A*56+51,ue=be[J];return ue?(A=ue.nextPos,ue.result):(T=A,i.charCodeAt(A)===37?(D=re,A++):(D=s,ve===0&&f(Qi)),D!==s?(U=L(),U!==s?(Ze=T,T=Ai(U)):(A=T,T=s)):(A=T,T=s),be[J]={nextPos:A,result:T},T)}function I1(){var T,D,U=A*56+52,J=be[U];return J?(A=J.nextPos,J.result):(T=A,Fn.test(i.charAt(A))?(D=i.charAt(A),A++):(D=s,ve===0&&f(W)),D!==s?(Ve.test(i.charAt(A))?(i.charAt(A),A++):ve===0&&f(oe),Ze=T,T=Tn()):(A=T,T=s),be[U]={nextPos:A,result:T},T)}function gD(){var T,D,U,J,ue,Te,mt=A*56+53,yr=be[mt];return yr?(A=yr.nextPos,yr.result):(T=A,D=Zu(),D===s&&(D=null),U=$e(),U===s&&(U=null),J=I1(),J!==s?(i.charCodeAt(A)===94?A++:ve===0&&f(Yn),ue=A1(),ue!==s?(Te=ju(),Te===s&&(Te=null),Ze=T,T=ms(D,U,J,ue,Te)):(A=T,T=s)):(A=T,T=s),be[mt]={nextPos:A,result:T},T)}function _D(){var T,D,U,J,ue=A*56+54,Te=be[ue];return Te?(A=Te.nextPos,Te.result):(T=A,i.substr(A,3)===ye?(D=ye,A+=3):(D=s,ve===0&&f(pe)),D===s&&(i.substr(A,2)===Ae?(D=Ae,A+=2):(D=s,ve===0&&f(Se)),D===s&&(i.substr(A,2)===Ee?(D=Ee,A+=2):(D=s,ve===0&&f(Ne)),D===s&&(i.charCodeAt(A)===105?(D=Ie,A++):(D=s,ve===0&&f(qe)),D===s&&(i.substr(A,3)===de?(D=de,A+=3):(D=s,ve===0&&f(Be)),D===s&&(i.substr(A,2)===Pe?(D=Pe,A+=2):(D=s,ve===0&&f(At)),D===s&&(i.charCodeAt(A)===118?(D=je,A++):(D=s,ve===0&&f($n)))))))),D!==s?(i.charCodeAt(A)===94?A++:ve===0&&f(Yn),U=A1(),U===s&&(U=null),J=ju(),J===s&&(J=null),Ze=T,T=sr(D,U,J)):(A=T,T=s),be[ue]={nextPos:A,result:T},T)}function bD(){var T,D,U=A*56+55,J=be[U];return J?(A=J.nextPos,J.result):(T=A,D=I1(),D!==s&&(Ze=T,D=Ia(D)),T=D,be[U]={nextPos:A,result:T},T)}var R1=a.nodeOptions||{};function $t(T,D,U=void 0){D.text=U||Kn(),D.location=$l();for(var J in R1)(D[J]===void 0||D[J]===null)&&(D[J]=R1[J]);return new T(D)}if(Ra=c(),Ra!==s&&A===i.length)return Ra;throw Ra!==s&&A1&&(c=c.slice(1));const u=c.map(p=>isNaN(parseInt(p))?p:parseInt(p));return o(...u).toString()}return o.toString()}}return a[0]}const i=new RegExp(t.join("|"),"g");return r.replace(i,a=>n(a))}function Cq(r,e,t){let n=r;for(let i=0;i1&&(t=t.split("").join(" ")),t}revaluate(){this.values=gv(this.input,this.options),this.evaluated=this.evaluate(this.values),this.applyTransformations(),this.duration=this.totalDuration()}pitches(){return this.evaluated.map(e=>e.collect("pitch"))}notes(){return this.evaluated.map(e=>e.collect("note"))}sounds(){return this.evaluated.map(e=>e.collect("sound"))}indices(){return this.evaluated.map(e=>e.collect("soundIndex"))}freqs(){return this.evaluated.map(e=>e.collect("freq"))}durations(){return this.evaluated.map(e=>e.collect("duration"))}octaves(){return this.evaluated.map(e=>e.collect("octave"))}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}invert(e){return this.applyOptions({inversion: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 fi(this)}notStarted(){return this.index<0}peek(){return this.evaluated[this.index-1||0]}hasStarted(){return this.index>=0}reset(){this.index=-1,this.counter=0}next(){this.index<0&&(this.index=0);const e=this.evaluated[this.index%this.evaluated.length];if(this.index++,this.counter++,this.redo>0&&this.index>=this.evaluated.length*this.redo){if(this.index=0,this.generator){const t=this.generator.next();t.done?this.generatorDone=!0:(this.input=Ha.inputFromNumber(t.value),this.revaluate())}this.evaluated=this.evaluate(this.values)}return e}applyOptions(e={}){this.evaluated=this.evaluate(this.evaluated,e),this.applyTransformations()}applyTransformations(){var e;(e=this.globalOptions)!=null&&e.retrograde&&(this.evaluated=this.evaluated.reverse())}update(){return this.evaluated=this.evaluate(this.values),this.applyTransformations(),this}evaluate(e,t={}){let n=e.map(i=>i.evaluate(t)).flat(1/0).filter(i=>i!==void 0);return t.subdivisions&&(n=CI(n)),n}totalDuration(){return this.evaluated.reduce((t,n)=>t+n.collect("duration"),0)}lead(){let e=this.evaluated.findIndex(t=>t instanceof Cn);if(e>=0){for(let t=e+1;t<=this.evaluated.length;t++)if(this.evaluated[t]instanceof Cn){const n=this.evaluated[e],i=this.evaluated[t],a=vq(n.notes(),i.notes()),s=fi(i);s.voiceLeadFromNotes(a,this.options.nodeOptions),this.evaluated[t]=s,e=t}}return this}toString(){return this.evaluated.map(e=>e.toString()).join(" ")}rules(e,t=1){const n=Cq(this.input,e,t);return new Ha(n,this.options.nodeOptions,this.globalOptions)}tonnetzChords(e,t=[3,4,5]){return this.evaluated&&(this.evaluated=this.evaluated.map(n=>n instanceof _n?n.tonnetzChord(e,t):n)),this}triadTonnetz(e,t=[3,4,5]){return this.evaluated&&(this.evaluated=this.evaluated.map(n=>n instanceof Cn?n.triadTonnetz(e,t):n)),this}tetraTonnetz(e,t=[3,4,5]){return this.evaluated&&(this.evaluated=this.evaluated.map(n=>n instanceof Cn?n.tetraTonnetz(e,t):n)),this}hexaCycle(e=[3,4,5]){return this.evaluated&&(this.evaluated=this.evaluated.map(t=>t instanceof _n?xQ(t.pitch,e).map(a=>Cn.fromPitchClassArray(a,t.key||"C4",t.scaleName||"MAJOR").evaluate()):t).flat(1/0)),this}octaCycle(e=[3,4,5]){return this.evaluated&&(this.evaluated=this.evaluated.map(t=>t instanceof _n?DQ(t.pitch,e).map(a=>Cn.fromPitchClassArray(a,t.key||"C4",t.scaleName||"MAJOR").evaluate()):t).flat(1/0)),this}enneaCycle(e=[3,4,5]){return this.evaluated&&(this.evaluated=this.evaluated.map(t=>t instanceof _n?kQ(t.pitch,e).map(a=>Cn.fromPitchClassArray(a,t.key||"C4",t.scaleName||"MAJOR").evaluate()):t).flat(1/0)),this}}const CI=(r,e=void 0)=>r.map(n=>{if(n instanceof bI){const i=n.evaluated.length,a=(e||n.duration)/i;return CI(n.evaluated,a)}else return n.duration=e||n.duration,n}).flat(1/0),Aq=r=>{let e={};return XQ.forEach(t=>{if(r[t]!==void 0){const n=r[t];e[t]=n,delete r[t]}}),e},Oi=(r,e)=>{let t=0;if(r<1)return t;for(;r%e**t===0;)t++;return t-1},$i=(r,e)=>{if(r===0)return 0;const t=Oi(r,e);return 1/e**t},Iq=(r,e,t=11)=>{const n=[];for(let a=1;a{const n=[];for(let s=1;ss!==0))};function*Rq(){let[r,e]=[0,1];for(;;)yield r,[r,e]=[e,r+e]}function*wq(){let[r,e,t]=[0,0,1];for(;;)yield e,[r,e,t]=[t,r,r+e+t]}function*Nq(){let[r,e,t,n]=[0,0,0,1];for(;;)yield t,[r,e,t,n]=[n,r,e,r+e+t+n]}function*xq(){let[r,e,t,n,i]=[0,0,0,0,1];for(;;)yield n,[r,e,t,n,i]=[i,r,e,t,r+e+t+n+i]}function*Dq(){let[r,e,t,n,i,a]=[0,0,0,0,0,1];for(;;)yield i,[r,e,t,n,i,a]=[a,r,e,t,n,r+e+t+n+i+a]}function*kq(){let[r,e,t,n,i,a,s]=[0,0,0,0,0,0,1];for(;;)yield a,[r,e,t,n,i,a,s]=[s,r,e,t,n,i,r+e+t+n+i+a+s]}function*Lq(){let[r,e,t,n,i,a,s,o]=[0,0,0,0,0,0,0,1];for(;;)yield s,[r,e,t,n,i,a,s,o]=[o,r,e,t,n,i,a,r+e+t+n+i+a+s+o]}function*Mq(){let[r,e,t,n,i,a,s,o,l]=[0,0,0,0,0,0,0,0,1];for(;;)yield o,[r,e,t,n,i,a,s,o,l]=[l,r,e,t,n,i,a,s,r+e+t+n+i+a+s+o+l]}function*Pq(r){let[e,t]=[0,1];for(;;)yield e,[e,t]=[t,(e+t)%r]}function*Bq(r){let[e,t,n]=[0,0,1];for(;;)yield t,[e,t,n]=[n,e,(e+t+n)%r]}function*Fq(r){let[e,t,n,i]=[0,0,0,1];for(;;)yield n,[e,t,n,i]=[i,e,t,(e+t+n+i)%r]}function*Uq(r){let[e,t,n,i,a]=[0,0,0,0,1];for(;;)yield i,[e,t,n,i,a]=[a,e,t,n,(e+t+n+i+a)%r]}function*Yq(r){let[e,t,n,i,a,s]=[0,0,0,0,0,1];for(;;)yield a,[e,t,n,i,a,s]=[s,e,t,n,i,(e+t+n+i+a+s)%r]}function*$q(r){let[e,t,n,i,a,s,o]=[0,0,0,0,0,0,1];for(;;)yield s,[e,t,n,i,a,s,o]=[o,e,t,n,i,a,(e+t+n+i+a+s+o)%r]}function*Gq(r){let[e,t,n,i,a,s,o,l]=[0,0,0,0,0,0,0,1];for(;;)yield o,[e,t,n,i,a,s,o,l]=[l,e,t,n,i,a,s,(e+t+n+i+a+s+o+l)%r]}function*Qq(r){let[e,t,n,i,a,s,o,l,c]=[0,0,0,0,0,0,0,0,1];for(;;)yield l,[e,t,n,i,a,s,o,l,c]=[c,e,t,n,i,a,s,o,(e+t+n+i+a+s+o+l+c)%r]}function*qq(r){let[e,t]=[0,1];for(;;)yield Oi(e,r),[e,t]=[t,e+t]}function*Vq(r){let[e,t,n]=[0,0,1];for(;;)yield Oi(t,r),[e,t,n]=[n,e,e+t+n]}function*zq(r){let[e,t,n,i]=[0,0,0,1];for(;;)yield Oi(n,r),[e,t,n,i]=[i,e,t,e+t+n+i]}function*Hq(r){let[e,t,n,i,a]=[0,0,0,0,1];for(;;)yield Oi(i,r),[e,t,n,i,a]=[a,e,t,n,e+t+n+i+a]}function*Wq(r){let[e,t,n,i,a,s]=[0,0,0,0,0,1];for(;;)yield Oi(a,r),[e,t,n,i,a,s]=[s,e,t,n,i,e+t+n+i+a+s]}function*Xq(r){let[e,t,n,i,a,s,o]=[0,0,0,0,0,0,1];for(;;)yield Oi(s,r),[e,t,n,i,a,s,o]=[o,e,t,n,i,a,e+t+n+i+a+s+o]}function*Zq(r){let[e,t,n,i,a,s,o,l]=[0,0,0,0,0,0,0,1];for(;;)yield Oi(o,r),[e,t,n,i,a,s,o,l]=[l,e,t,n,i,a,s,e+t+n+i+a+s+o+l]}function*Kq(r){const e=Array(9).fill(0);e[9-1]=1;let[t,n,i,a,s,o,l,c,u]=e;for(;;)yield Oi(c,r),[t,n,i,a,s,o,l,c,u]=[u,t,n,i,a,s,o,l,t+n+i+a+s+o+l+c+u]}function*jq(r){let[e,t]=[0,1];for(;;)yield $i(e,r),[e,t]=[t,e+t]}function*Jq(r){let[e,t,n]=[0,0,1];for(;;)yield $i(t,r),[e,t,n]=[n,e,e+t+n]}function*eV(r){let[e,t,n,i]=[0,0,0,1];for(;;)yield $i(n,r),[e,t,n,i]=[i,e,t,e+t+n+i]}function*tV(r){let[e,t,n,i,a]=[0,0,0,0,1];for(;;)yield $i(i,r),[e,t,n,i,a]=[a,e,t,n,e+t+n+i+a]}function*nV(r){let[e,t,n,i,a,s]=[0,0,0,0,0,1];for(;;)yield $i(a,r),[e,t,n,i,a,s]=[s,e,t,n,i,e+t+n+i+a+s]}function*rV(r){let[e,t,n,i,a,s,o]=[0,0,0,0,0,0,1];for(;;)yield $i(s,r),[e,t,n,i,a,s,o]=[o,e,t,n,i,a,e+t+n+i+a+s+o]}function*iV(r){let[e,t,n,i,a,s,o,l]=[0,0,0,0,0,0,0,1];for(;;)yield $i(o,r),[e,t,n,i,a,s,o,l]=[l,e,t,n,i,a,s,e+t+n+i+a+s+o+l]}function*aV(r){const e=Array(9).fill(0);e[9-1]=1;let[t,n,i,a,s,o,l,c,u]=e;for(;;)yield $i(c,r),[t,n,i,a,s,o,l,c,u]=[u,t,n,i,a,s,o,l,t+n+i+a+s+o+l+c+u]}function*sV(r,e=11){let[t,n]=[0,1];for(;;)yield Gi(t,r,e),[t,n]=[n,t+n]}function*oV(r,e=11){let[t,n,i]=[0,0,1];for(;;)yield Gi(n,r,e),[t,n,i]=[i,t,t+n+i]}function*lV(r,e=11){let[t,n,i,a]=[0,0,0,1];for(;;)yield Gi(i,r,e),[t,n,i,a]=[a,t,n,t+n+i+a]}function*cV(r,e=11){let[t,n,i,a,s]=[0,0,0,0,1];for(;;)yield Gi(a,r,e),[t,n,i,a,s]=[s,t,n,i,t+n+i+a+s]}function*uV(r,e=11){let[t,n,i,a,s,o]=[0,0,0,0,0,1];for(;;)yield Gi(s,r,e),[t,n,i,a,s,o]=[o,t,n,i,a,t+n+i+a+s+o]}function*dV(r,e=11){let[t,n,i,a,s,o,l]=[0,0,0,0,0,0,1];for(;;)yield Gi(o,r,e),[t,n,i,a,s,o,l]=[l,t,n,i,a,s,t+n+i+a+s+o+l]}function*pV(r,e=11){let[t,n,i,a,s,o,l,c]=[0,0,0,0,0,0,0,1];for(;;)yield Gi(l,r,e),[t,n,i,a,s,o,l,c]=[c,t,n,i,a,s,o,t+n+i+a+s+o+l+c]}function*fV(r,e=11){const t=Array(9).fill(0);t[9-1]=1;let[n,i,a,s,o,l,c,u,p]=t;for(;;)yield Gi(u,r,e),[n,i,a,s,o,l,c,u,p]=[p,n,i,a,s,o,l,c,n+i+a+s+o+l+c+u+p]}const hV=Object.freeze(Object.defineProperty({__proto__:null,enneanacci:Mq,fibonacci:Rq,heptanacci:kq,hexanacci:Dq,modularEnneanacci:Qq,modularFibonacci:Pq,modularHeptanacci:$q,modularHexanacci:Yq,modularOctanacci:Gq,modularPentanacci:Uq,modularTetranacci:Fq,modularTribonacci:Bq,normPadicEnneanacci:aV,normPadicFibonacci:jq,normPadicHeptanacci:rV,normPadicHexanacci:nV,normPadicOctanacci:iV,normPadicPentanacci:tV,normPadicTetranacci:eV,normPadicTribonacci:Jq,octanacci:Lq,pAdicExpansion:Iq,pAdicExpansionArithmetic:Gi,pAdicExpansionEnneanacci:fV,pAdicExpansionFibonacci:sV,pAdicExpansionHeptanacci:dV,pAdicExpansionHexanacci:uV,pAdicExpansionOctanacci:pV,pAdicExpansionPentanacci:cV,pAdicExpansionTetranacci:lV,pAdicExpansionTribonacci:oV,pAdicNorm:$i,pAdicValuation:Oi,padicEnneanacci:Kq,padicFibonacci:qq,padicHeptanacci:Xq,padicHexanacci:Wq,padicOctanacci:Zq,padicPentanacci:Hq,padicTetranacci:zq,padicTribonacci:Vq,pentanacci:xq,tetranacci:Nq,tribonacci:wq},Symbol.toStringTag,{value:"Module"}));class mV{constructor(e,t){I(this,"api");I(this,"settings");I(this,"midiAccess",null);I(this,"midiOutputs",[]);I(this,"currentOutputIndex",0);I(this,"scheduledNotes",{});I(this,"midiInputs",[]);I(this,"currentInputIndex");I(this,"bufferLength",512);I(this,"noteInputBuffer",[]);I(this,"ccInputBuffer",[]);I(this,"activeNotes",[]);I(this,"stickyNotes",[]);I(this,"lastNote");I(this,"lastCC",{});I(this,"lastNoteInChannel",{});I(this,"lastCCInChannel",{});I(this,"midiClockInputIndex");I(this,"midiClockInput");I(this,"lastTimestamp",0);I(this,"midiClockDelta",0);I(this,"lastBPM");I(this,"roundedBPM",0);I(this,"clockBuffer",[]);I(this,"clockBufferLength",24);I(this,"clockTicks",0);I(this,"clockErrorCount",0);I(this,"skipOnError",0);this.api=e,this.settings=t,this.lastBPM=e.bpm(),this.roundedBPM=this.lastBPM,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),this.midiInputs=Array.from(this.midiAccess.inputs.values()),this.midiInputs.length===0?console.warn("No MIDI inputs available."):this.updateInputSelects()}catch(e){console.error("Failed to initialize MIDI:",e)}}getCurrentMidiPort(){return this.midiOutputs.length>0&&this.currentOutputIndex>=0&&this.currentOutputIndex0&&this.currentOutputIndex>=0&&this.currentOutputIndex0){const e=document.getElementById("midi-clock-input"),t=document.getElementById("default-midi-input");e.innerHTML="",t.innerHTML="";const n=document.createElement("option");n.value="-1",n.text="Internal",e.appendChild(n);const i=document.createElement("option");if(i.value="-1",i.text="None",t.appendChild(i),this.midiInputs.forEach((a,s)=>{const o=document.createElement("option");o.value=s.toString(),o.text=a.name||s.toString(),e.appendChild(o),t.appendChild(o.cloneNode(!0))}),this.settings.midi_clock_input){const a=this.getMidiInputIndex(this.settings.midi_clock_input);e.value=a.toString(),a>0&&(this.midiClockInput=this.midiInputs[a],this.registerMidiInputListener(a))}else e.value="-1";if(this.settings.default_midi_input){const a=this.getMidiInputIndex(this.settings.default_midi_input);t.value=a.toString(),a>0&&(this.currentInputIndex=a,this.registerMidiInputListener(a))}else t.value="-1";e.addEventListener("change",a=>{const s=a.target.value;if(s==="-1")this.midiClockInput&&this.midiClockInputIndex!=this.currentInputIndex&&(this.midiClockInput.onmidimessage=null),this.midiClockInput=void 0,this.settings.midi_clock_input=void 0;else{const o=parseInt(s);this.midiClockInputIndex=o,this.midiClockInput&&this.midiClockInputIndex!=this.currentInputIndex&&(this.midiClockInput.onmidimessage=null),this.midiClockInput=this.midiInputs[o],this.registerMidiInputListener(o),this.settings.midi_clock_input=this.midiClockInput.name||void 0}}),t.addEventListener("change",a=>{const s=a.target.value;s==="-1"?(this.currentInputIndex&&this.currentInputIndex!=this.midiClockInputIndex&&this.unregisterMidiInputListener(this.currentInputIndex),this.currentInputIndex=void 0,this.settings.default_midi_input=void 0):(this.currentInputIndex&&this.currentInputIndex!=this.midiClockInputIndex&&this.unregisterMidiInputListener(this.currentInputIndex),this.currentInputIndex=parseInt(s),this.registerMidiInputListener(this.currentInputIndex),this.settings.default_midi_input=this.midiInputs[this.currentInputIndex].name||void 0)})}}registerMidiInputListener(e){if(e!==void 0){const t=this.midiInputs[e];t&&!t.onmidimessage&&(t.onmidimessage=n=>{const i=n;if(t.name===this.settings.midi_clock_input&&(i.data[0]===248?this.skipOnError>0?this.skipOnError-=1:this.onMidiClock(n.timeStamp):i.data[0]===250?(console.log("MIDI start received"),this.api.stop(),this.api.play()):i.data[0]===252?(console.log("MIDI stop received"),this.api.pause()):i.data[0]===251?(console.log("MIDI continue received"),this.api.play()):i.data[0]===254&&console.log("MIDI active sensing received")),t.name===this.settings.default_midi_input){if(i.data[0]>=144&&i.data[0]<=159){const a=i.data[0]-144+1,s=i.data[1],o=i.data[2];this.lastNote={note:s,velocity:o,channel:a,timestamp:n.timeStamp},this.lastNoteInChannel[a]={note:s,velocity:o,channel:a,timestamp:n.timeStamp},this.settings.midi_channels_scripts&&this.api.script(a),this.pushToMidiInputBuffer({note:s,velocity:o,channel:a,timestamp:n.timeStamp}),this.activeNotes.push({note:s,velocity:o,channel:a,timestamp:n.timeStamp}),this.removeFromStickyNotes(s,a)||this.stickyNotes.push({note:s,velocity:o,channel:a,timestamp:n.timeStamp})}if(i.data[0]>=128&&i.data[0]<=143){const a=i.data[0]-128+1,s=i.data[1];this.removeFromActiveNotes(s,a)}if(i.data[0]>=176&&i.data[0]<=191){const a=i.data[0]-176+1,s=i.data[1],o=i.data[2];this.lastCC[s]=o,this.lastCCInChannel[a]?this.lastCCInChannel[a][s]=o:(this.lastCCInChannel[a]={},this.lastCCInChannel[a][s]=o),this.pushToMidiCCBuffer({control:s,value:o,channel:a,timestamp:n.timeStamp})}}})}}removeFromActiveNotes(e,t){const n=this.activeNotes.findIndex(i=>i.note===e&&i.channel===t);n>=0&&this.activeNotes.splice(n,1)}removeFromStickyNotes(e,t){const n=this.stickyNotes.findIndex(i=>i.note===e&&i.channel===t);return n>=0?(this.stickyNotes.splice(n,1),!0):!1}stickyNotesFromChannel(e){return this.stickyNotes.filter(t=>t.channel===e)}activeNotesFromChannel(e){return this.activeNotes.filter(t=>t.channel===e)}killActiveNotes(){this.activeNotes=[]}killActiveNotesFromChannel(e){this.activeNotes=this.activeNotes.filter(t=>t.channel!==e)}pushToMidiInputBuffer(e){this.noteInputBuffer.push(e),this.noteInputBuffer.length>this.bufferLength&&this.noteInputBuffer.shift()}pushToMidiCCBuffer(e){this.ccInputBuffer.push(e),this.ccInputBuffer.length>this.bufferLength&&this.ccInputBuffer.shift()}findNoteFromBufferInChannel(e){const t=this.noteInputBuffer.findIndex(n=>n.channel===e);if(t>=0){const n=this.noteInputBuffer[t];return this.noteInputBuffer.splice(t,1),n}else return}findCCFromBufferInChannel(e){const t=this.ccInputBuffer.findIndex(n=>n.channel===e);if(t>=0){const n=this.ccInputBuffer[t];return this.ccInputBuffer.splice(t,1),n}else return}unregisterMidiInputListener(e){if(e!==void 0){const t=this.midiInputs[e];t&&(t.onmidimessage=null)}}onMidiClock(e){if(this.clockTicks+=1,this.lastTimestamp>0)if(this.lastTimestamp===e)this.clockErrorCount+=1;else if(this.clockErrorCount>0)console.log("Timestamp error count: ",this.clockErrorCount),console.log("Current timestamp: ",e),console.log("Last timestamp: ",this.lastTimestamp),console.log("Last delta: ",this.midiClockDelta),console.log("Current delta: ",e-this.lastTimestamp),console.log("BPMs",this.clockBuffer),this.clockErrorCount=0,this.skipOnError=this.settings.midi_clock_ppqn/4,e=0;else{this.midiClockDelta=e-this.lastTimestamp,this.lastBPM=60*(1e3/this.midiClockDelta/this.settings.midi_clock_ppqn),this.clockBuffer.push(this.lastBPM),this.clockBuffer.length>this.clockBufferLength&&this.clockBuffer.shift();const t=this.estimatedBPM();t!==this.roundedBPM&&(console.log("Estimated BPM: ",t),this.api.bpm(t),this.roundedBPM=t)}this.lastTimestamp=e}estimatedBPM(){const e=this.clockBuffer.reduce((t,n)=>t+n);return Math.round(e/this.clockBuffer.length)}sendMidiClock(){if(!this.midiClockInput){const e=this.midiOutputs[this.currentOutputIndex];e&&e.send([248])}}switchMidiOutput(e){const t=this.getMidiOutputIndex(e);return t!==-1?(this.currentOutputIndex=t,!0):!1}getMidiOutputIndex(e){if(typeof e=="number")return e<0||e>=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(n=>n.name===e);return t!==-1?t:(console.error(`MIDI output "${e}" not found.`),this.currentOutputIndex)}}getMidiInputIndex(e){if(typeof e=="number")return e<0||e>=this.midiInputs.length?(console.error(`Invalid MIDI input index. Index must be in the range 0-${this.midiInputs.length-1}.`),-1):e;{const t=this.midiInputs.findIndex(n=>n.name===e);return t!==-1?t:(console.error(`MIDI input "${e}" not found.`),-1)}}listMidiOutputs(){let e="Available MIDI Outputs: ";return this.midiOutputs.forEach((t,n)=>{e+=`(${n+1}) ${t.name} `}),e}sendMidiNote(e,t,n,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,n],c=[128+t,e,0];o.send(l),s&&this.sendPitchBend(s,t,a);const u=setTimeout(()=>{o.send(c),s&&this.sendPitchBend(8192,t,a),delete this.scheduledNotes[e]},(i-.02)*1e3);this.scheduledNotes[e]=u}else console.error("MIDI output not available.")}sendMidiOn(e,t,n,i=this.currentOutputIndex){typeof i=="string"&&(i=this.getMidiOutputIndex(i));const a=this.midiOutputs[i];if(e=Math.min(Math.max(e,0),127),a){const s=[144+t,e,n];a.send(s)}else console.error("MIDI output not available.")}sendMidiOff(e,t,n=this.currentOutputIndex){typeof n=="string"&&(n=this.getMidiOutputIndex(n));const i=this.midiOutputs[n];if(e=Math.min(Math.max(e,0),127),i){const a=[128+t,e,0];i.send(a)}else console.error("MIDI output not available.")}sendAllNotesOff(e,t=this.currentOutputIndex){typeof t=="string"&&(t=this.getMidiOutputIndex(t));const n=this.midiOutputs[t];if(n){const i=[176+e,123,0];n.send(i)}else console.error("MIDI output not available.")}sendAllSoundOff(e,t=this.currentOutputIndex){typeof t=="string"&&(t=this.getMidiOutputIndex(t));const n=this.midiOutputs[t];if(n){const i=[176+e,120,0];n.send(i)}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,n=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 n=="string"&&(n=this.getMidiOutputIndex(n));const i=this.midiOutputs[n];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 n=this.midiOutputs[this.currentOutputIndex];n?n.send([192+t,e]):console.error("MIDI output not available.")}sendMidiControlChange(e,t,n){const i=this.midiOutputs[this.currentOutputIndex];i?i.send([176+n,e,t]):console.error("MIDI output not available.")}panic(){const e=this.midiOutputs[this.currentOutputIndex];if(e){for(const t in this.scheduledNotes){const n=this.scheduledNotes[t];clearTimeout(n),e.send([128,parseInt(t),0])}this.scheduledNotes={}}else console.error("MIDI output not available.")}}class gV{constructor(e,t,n){I(this,"min");I(this,"max");I(this,"wrap");I(this,"position");this.min=e,this.max=t,this.wrap=n,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}}class Wu{constructor(e){I(this,"seedValue");I(this,"randomGen",Math.random);I(this,"app");I(this,"values",{});I(this,"evenbar",e=>this.app.clock.time_position.bar%2===0?this.modify(e):this);I(this,"even",e=>this.app.clock.time_position.beat%2===0?this.modify(e):this);I(this,"odd",e=>this.app.clock.time_position.beat%2!==0?this.modify(e):this);I(this,"odds",(e,t)=>this.randomGen()this);I(this,"almostNever",e=>this.odds(.025,e));I(this,"rarely",e=>this.odds(.1,e));I(this,"scarcely",e=>this.odds(.25,e));I(this,"sometimes",e=>this.odds(.5,e));I(this,"often",e=>this.odds(.75,e));I(this,"frequently",e=>this.odds(.9,e));I(this,"almostAlways",e=>this.odds(.985,e));I(this,"always",e=>this.modify(e));I(this,"modify",e=>e(this));I(this,"seed",e=>(this.seedValue=e.toString(),this.randomGen=this.app.api.localSeededRandom(this.seedValue),this));I(this,"clear",()=>(this.app.api.clearLocalSeed(this.seedValue),this));I(this,"apply",e=>this.modify(e));I(this,"noteLength",(e,...t)=>(t.length>0&&(e=Array.isArray(e)?e.concat(t):[e,...t]),Array.isArray(e)?(this.values.noteLength=e,this.values.dur=e.map(n=>this.app.clock.convertPulseToSecond(n*4*this.app.clock.ppqn))):(this.values.noteLength=e,this.values.dur=this.app.clock.convertPulseToSecond(e*4*this.app.clock.ppqn)),this));this.app=e,this.app.api.currentSeed&&(this.randomGen=this.app.api.randomGen)}}class AI extends Wu{constructor(t){super(t);I(this,"pitch",(t,...n)=>(n.length>0&&(t=Array.isArray(t)?t.concat(n):[t,...n]),this.values.pitch=t,this.values.key&&this.values.parsedScale&&this.update(),this));I(this,"pc",this.pitch);I(this,"octave",(t,...n)=>(n.length>0&&(t=Array.isArray(t)?t.concat(n):[t,...n]),this.values.octave=t,this.values.key&&(this.values.pitch||this.values.pitch===0)&&this.values.parsedScale&&this.update(),this));I(this,"key",(t,...n)=>(n.length>0&&(t=Array.isArray(t)?t.concat(n):[t,...n]),this.values.key=t,(this.values.pitch||this.values.pitch===0)&&this.values.parsedScale&&this.update(),this));I(this,"scale",(t,...n)=>(n.length>0&&(t=Array.isArray(t)?t.concat(n):[t,...n]),typeof t=="string"||typeof t=="number"?this.values.parsedScale=Bi(t):Array.isArray(t)&&(this.values.parsedScale=t.map(i=>Bi(i))),this.values.key&&(this.values.pitch||this.values.pitch===0)&&this.update(),this));I(this,"freq",(t,...n)=>{if(n.length>0&&(t=Array.isArray(t)?t.concat(n):[t,...n]),this.values.freq=t,Array.isArray(t)){this.values.note=[],this.values.bend=[];for(const i of t){const a=mv(i);a%1!==0?(this.values.note.push(Math.floor(a)),this.values.bend.push(Gg(a)[1])):this.values.note.push(a)}this.values.bend.length===0&&delete this.values.bend}else{const i=mv(t);i%1!==0?(this.values.note=Math.floor(i),this.values.bend=Gg(i)[1]):this.values.note=i}return this});I(this,"update",()=>{})}}function yu(r,e){e.forEach(a=>{Array.isArray(r[a])&&!Array.isArray(r[a][0])&&(r[a]=[r[a]])});const t=Object.keys(r),n=Math.max(...t.map(a=>Array.isArray(r[a])?r[a].length:1)),i=[];for(let a=0;a(Object.keys(e).forEach(i=>{n[i]=e[i]}),Object.keys(n).forEach(i=>{t[i]||(t[i]=[]),t[i].push(n[i])}),t),{})}function II(r,e){return Object.fromEntries(Object.entries(r).filter(([t])=>e.includes(t)))}class qg extends AI{constructor(t,n){super(n);I(this,"nudge");I(this,"sound");I(this,"methodMap",{volume:["volume","vol"],zrand:["zrand","zr"],curve:["curve"],slide:["slide","sld"],deltaSlide:["deltaSlide","dslide"],pitchJump:["pitchJump","pj"],pitchJumpTime:["pitchJumpTime","pjt"],lfo:["lfo"],znoise:["znoise"],noise:["noise"],zmod:["zmod"],zcrush:["zcrush"],zdelay:["zdelay"],sustainVolume:["sustainVolume"],tremolo:["tremolo"],dur:["dur"],zzfx:["zzfx"],fmi:["fmi"],fmh:["fmh"],fmenv:["fmenv"],fmattack:["fmattack","fmatk"],fmdecay:["fmdecay","fmdec"],fmsustain:["fmsustain","fmsus"],fmrelease:["fmrelease","fmrel"],fmvelocity:["fmvelocity","fmvel"],fmwave:["fmwave","fmw"],fmadsr:(t,n,i,a)=>(this.updateValue("fmattack",t),this.updateValue("fmdecay",n),this.updateValue("fmsustain",i),this.updateValue("fmrelease",a),this),fmad:(t,n)=>(this.updateValue("fmattack",t),this.updateValue("fmdecay",n),this),ftype:["ftype"],fanchor:["fanchor"],attack:["attack","atk"],decay:["decay","dec"],sustain:["sustain","sus"],release:["release","rel"],adsr:(t,n,i,a)=>(this.updateValue("attack",t),this.updateValue("decay",n),this.updateValue("sustain",i),this.updateValue("release",a),this),ad:(t,n)=>(this.updateValue("attack",t),this.updateValue("decay",n),this.updateValue("sustain",0),this.updateValue("release",0),this),lpenv:["lpenv","lpe"],lpattack:["lpattack","lpa"],lpdecay:["lpdecay","lpd"],lpsustain:["lpsustain","lps"],lprelease:["lprelease","lpr"],cutoff:(t,n)=>(this.updateValue("cutoff",t),n&&this.updateValue("resonance",n),this),lpf:(t,n)=>(this.updateValue("cutoff",t),n&&this.updateValue("resonance",n),this),resonance:t=>(t>=0&&t<=1&&this.updateValue("resonance",50*t),this),lpadsr:(t,n,i,a,s)=>(this.updateValue("lpenv",t),this.updateValue("lpattack",n),this.updateValue("lpdecay",i),this.updateValue("lpsustain",a),this.updateValue("lprelease",s),this),lpad:(t,n,i)=>(this.updateValue("lpenv",t),this.updateValue("lpattack",n),this.updateValue("lpdecay",i),this.updateValue("lpsustain",0),this.updateValue("lprelease",0),this),hpenv:["hpenv","hpe"],hpattack:["hpattack","hpa"],hpdecay:["hpdecay","hpd"],hpsustain:["hpsustain","hpsus"],hprelease:["hprelease","hpr"],hcutoff:(t,n)=>(this.updateValue("hcutoff",t),n&&this.updateValue("hresonance",n),this),hpf:(t,n)=>(this.updateValue("hcutoff",t),n&&this.updateValue("hresonance",n),this),hpq:t=>(this.updateValue("hresonance",t),this),hpadsr:(t,n,i,a,s)=>(this.updateValue("hpenv",t),this.updateValue("hpattack",n),this.updateValue("hpdecay",i),this.updateValue("hpsustain",a),this.updateValue("hprelease",s),this),hpad:(t,n,i)=>(this.updateValue("hpenv",t),this.updateValue("hpattack",n),this.updateValue("hpdecay",i),this.updateValue("hpsustain",0),this.updateValue("hprelease",0),this),bpenv:["bpenv","bpe"],bpattack:["bpattack","bpa"],bpdecay:["bpdecay","bpd"],bpsustain:["bpsustain","bps"],bprelease:["bprelease","bpr"],bandf:(t,n)=>(this.updateValue("bandf",t),n&&this.updateValue("bandq",n),this),bpf:(t,n)=>(this.updateValue("bandf",t),n&&this.updateValue("bandq",n),this),bandq:["bandq","bpq"],bpadsr:(t,n,i,a,s)=>(this.updateValue("bpenv",t),this.updateValue("bpattack",n),this.updateValue("bpdecay",i),this.updateValue("bpsustain",a),this.updateValue("bprelease",s),this),bpad:(t,n,i)=>(this.updateValue("bpenv",t),this.updateValue("bpattack",n),this.updateValue("bpdecay",i),this.updateValue("bpsustain",0),this.updateValue("bprelease",0),this),vib:["vib"],vibmod:["vibmod"],fm:t=>{if(typeof t=="number")this.values.fmi=t;else{let n=t.split(":");this.values.fmi=parseFloat(n[0]),n.length>1&&(this.values.fmh=parseFloat(n[1]))}return this},loop:["loop"],loopBegin:["loopBegin","loopb"],loopEnd:["loopEnd","loope"],begin:["begin"],end:["end"],gain:["gain"],dbgain:t=>(this.updateValue("gain",Math.min(Math.pow(10,t/20),10)),this),db:t=>(this.updateValue("gain",Math.min(Math.pow(10,t/20),10)),this),velocity:["velocity","vel"],pan:["pan"],cut:["cut"],clip:["clip"],n:["n"],speed:["speed","spd"],coarse:["coarse"],crush:["crush"],shape:["shape"],vowel:["vowel","vow"],delay:["delay","del"],delayfeedback:["delayfeedback","delayfb"],delaytime:["delaytime","delayt"],orbit:["orbit","o"],room:["room","rm"],roomfade:["roomfade","rfade"],roomlp:["roomlp","rlp"],roomdim:["roomdim","rdim"],sound:["s","sound"],size:t=>(this.updateValue("roomsize",t),this),sz:t=>(this.updateValue("roomsize",t),this),comp:["compressor","cmp"],ratio:t=>(this.updateValue("compressorRatio",t),this),knee:t=>(this.updateValue("compressorKnee",t),this),compAttack:t=>(this.updateValue("compressorAttack",t),this),compRelease:t=>(this.updateValue("compressorRelease",t),this),stretch:t=>(this.updateValue("unit","c"),this.updateValue("speed",1/t),this.updateValue("cut",t),this)});I(this,"processSound",t=>{if(Array.isArray(t)&&typeof t[0]=="string"){const n=[],i=[];return t.forEach(a=>{const s=a.split(":");n.push(s[0]),s[1]&&i.push(parseInt(s[1]))}),{s:n,n:i.length>0?i:void 0,dur:this.app.clock.convertPulseToSecond(this.app.clock.ppqn),analyze:!0}}else{if(typeof t=="object")return{dur:this.app.clock.convertPulseToSecond(this.app.clock.ppqn),analyze:!0,...t};if(t.includes(":")){const n=t.split(":"),i=n[0],a=parseInt(n[1]);return{s:i,n:a,dur:this.app.clock.convertPulseToSecond(this.app.clock.ppqn),analyze:!0}}else return{s:t,dur:.5,analyze:!0}}});I(this,"modify",t=>{const n=t(this);return n instanceof Object?n:(t(this.values),this.update(),this)});I(this,"update",()=>{const t=II(this.values,["key","pitch","parsedScale","octave"]),n=yu(t,["parsedScale"]);n.forEach(a=>{const[s,o]=p1(a.key||"C4",a.pitch||0,a.parsedScale||a.scale||"MAJOR",a.octave||0);a.note=s,a.freq=Js(s)});const i=Cu(n);this.values.note=i.note,this.values.freq=i.freq});I(this,"chord",t=>{const n=EI(t);return this.updateValue("note",n)});I(this,"invert",(t=0)=>{if(this.values.chord){let n=this.values.chord.map(a=>a.note);n=t<0?[...n].reverse():n;for(let a=0;a({note:a,freq:Js(a)}));return this.updateValue("chord",i)}else return this});I(this,"note",t=>typeof t=="string"?this.updateValue("note",Pr(t)):typeof t==null||t==null?this.updateValue("note",0).updateValue("gain",0):this.updateValue("note",t));I(this,"out",()=>{const t=yu(this.values,["parsedScale"]);for(const n of t){const i=n;i.freq&&delete i.note,QD(i,this.nudge-this.app.clock.deviation,i.dur)}});this.app=n,this.nudge=n.dough_nudge/100;for(const[i,a]of Object.entries(this.methodMap))if(Symbol.iterator in Object(a))for(const s of a)this[s]=o=>this.updateValue(a[0],o);else this[i]=a;this.values=this.processSound(t)}updateValue(t,n){return n==null?this:(this.values[t]=n,this)}}class Vg extends AI{constructor(t,n){super(n);I(this,"midiConnection");I(this,"chord",t=>(this.values.note=EI(t),this));I(this,"note",t=>(this.values.note=t,this));I(this,"sustain",t=>(this.values.sustain=t,this));I(this,"velocity",t=>(this.values.velocity=t,this));I(this,"channel",t=>(this.values.channel=t,this));I(this,"port",t=>(typeof t=="string"?this.values.port=this.midiConnection.getMidiOutputIndex(t):Array.isArray(t)&&(this.values.port=t.map(n=>typeof n=="string"?this.midiConnection.getMidiOutputIndex(n):n)),this));I(this,"add",t=>(this.values.note+=t,this));I(this,"modify",t=>{const n=t(this);return n instanceof Object?n:(t(this.values),this.update(),this)});I(this,"bend",t=>(this.values.bend=t,this));I(this,"random",(t=0,n=127)=>(t=Math.min(Math.max(t,0),127),n=Math.min(Math.max(n,0),127),this.values.note=Math.floor(this.randomGen()*(n-t+1))+t,this));I(this,"update",()=>{const t=II(this.values,["key","pitch","parsedScale","octave"]),n=yu(t,["parsedScale"]);n.forEach(a=>{const[s,o]=p1(a.key||"C4",a.pitch||0,a.parsedScale||a.scale||"MAJOR",a.octave||0);a.note=s,o&&(a.bend=o)});const i=Cu(n);this.values.note=i.note,i.bend&&(this.values.bend=i.bend)});I(this,"out",()=>{function t(i,a){const s=a.channel?a.channel:0,o=a.velocity?a.velocity:100,l=a.note?a.note:60,c=a.sustain?a.sustain*i.app.clock.pulse_duration*i.app.api.ppqn():i.app.clock.pulse_duration*i.app.api.ppqn(),u=a.bend?a.bend:void 0,p=a.port?i.midiConnection.getMidiOutputIndex(a.port):i.midiConnection.getCurrentMidiPortIndex()||0;i.midiConnection.sendMidiNote(l,s,o,c,p,u)}yu(this.values,["parsedScale"]).forEach(i=>{t(this,i)})});this.app=n,this.values=t,this.midiConnection=n.api.MidiConnection}}const Uo=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,RI=new Set,zg=typeof process=="object"&&process?process:{},wI=(r,e,t,n)=>{typeof zg.emitWarning=="function"?zg.emitWarning(r,e,t,n):console.error(`[${t}] ${e}: ${r}`)};let Au=globalThis.AbortController,_v=globalThis.AbortSignal;var Ev;if(typeof Au>"u"){_v=class{constructor(){I(this,"onabort");I(this,"_onabort",[]);I(this,"reason");I(this,"aborted",!1)}addEventListener(n,i){this._onabort.push(i)}},Au=class{constructor(){I(this,"signal",new _v);e()}abort(n){var i,a;if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(const s of this.signal._onabort)s(n);(a=(i=this.signal).onabort)==null||a.call(i,n)}}};let r=((Ev=zg.env)==null?void 0:Ev.LRU_CACHE_IGNORE_AC_WARNING)!=="1";const e=()=>{r&&(r=!1,wI("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 _V=r=>!RI.has(r),ji=r=>r&&r===Math.floor(r)&&r>0&&isFinite(r),NI=r=>ji(r)?r<=Math.pow(2,8)?Uint8Array:r<=Math.pow(2,16)?Uint16Array:r<=Math.pow(2,32)?Uint32Array:r<=Number.MAX_SAFE_INTEGER?Mc:null:null;class Mc extends Array{constructor(e){super(e),this.fill(0)}}var Ls;const Pa=class Pa{constructor(e,t){I(this,"heap");I(this,"length");if(!X(Pa,Ls))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}static create(e){const t=NI(e);if(!t)return[];Ke(Pa,Ls,!0);const n=new Pa(e,t);return Ke(Pa,Ls,!1),n}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}};Ls=new WeakMap,lt(Pa,Ls,!1);let Hg=Pa;var $r,dr,Gr,Qr,Ms,pn,qr,fn,Bt,it,qn,pr,xn,On,Vr,En,Ni,xi,zr,Hr,sa,Vn,Al,Xg,Ga,Di,Il,fr,wu,xI,Qa,Ps,Rl,ai,Ji,si,ea,wl,Zg,Bs,Pc,Fs,Bc,kt,Gt,Nl,Kg,qa,Ho;const E1=class E1{constructor(e){lt(this,Al);lt(this,wu);lt(this,ai);lt(this,si);lt(this,wl);lt(this,Bs);lt(this,Fs);lt(this,kt);lt(this,Nl);lt(this,qa);lt(this,$r,void 0);lt(this,dr,void 0);lt(this,Gr,void 0);lt(this,Qr,void 0);lt(this,Ms,void 0);I(this,"ttl");I(this,"ttlResolution");I(this,"ttlAutopurge");I(this,"updateAgeOnGet");I(this,"updateAgeOnHas");I(this,"allowStale");I(this,"noDisposeOnSet");I(this,"noUpdateTTL");I(this,"maxEntrySize");I(this,"sizeCalculation");I(this,"noDeleteOnFetchRejection");I(this,"noDeleteOnStaleGet");I(this,"allowStaleOnFetchAbort");I(this,"allowStaleOnFetchRejection");I(this,"ignoreFetchAbort");lt(this,pn,void 0);lt(this,qr,void 0);lt(this,fn,void 0);lt(this,Bt,void 0);lt(this,it,void 0);lt(this,qn,void 0);lt(this,pr,void 0);lt(this,xn,void 0);lt(this,On,void 0);lt(this,Vr,void 0);lt(this,En,void 0);lt(this,Ni,void 0);lt(this,xi,void 0);lt(this,zr,void 0);lt(this,Hr,void 0);lt(this,sa,void 0);lt(this,Vn,void 0);lt(this,Ga,()=>{});lt(this,Di,()=>{});lt(this,Il,()=>{});lt(this,fr,()=>!1);lt(this,Qa,e=>{});lt(this,Ps,(e,t,n)=>{});lt(this,Rl,(e,t,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});const{max:t=0,ttl:n,ttlResolution:i=1,ttlAutopurge:a,updateAgeOnGet:s,updateAgeOnHas:o,allowStale:l,dispose:c,disposeAfter:u,noDisposeOnSet:p,noUpdateTTL:m,maxSize:_=0,maxEntrySize:E=0,sizeCalculation:R,fetchMethod:w,noDeleteOnFetchRejection:k,noDeleteOnStaleGet:$,allowStaleOnFetchRejection:H,allowStaleOnFetchAbort:h,ignoreFetchAbort:S}=e;if(t!==0&&!ji(t))throw new TypeError("max option must be a nonnegative integer");const b=t?NI(t):Array;if(!b)throw new Error("invalid max value: "+t);if(Ke(this,$r,t),Ke(this,dr,_),this.maxEntrySize=E||X(this,dr),this.sizeCalculation=R,this.sizeCalculation){if(!X(this,dr)&&!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(w!==void 0&&typeof w!="function")throw new TypeError("fetchMethod must be a function if specified");if(Ke(this,Ms,w),Ke(this,sa,!!w),Ke(this,fn,new Map),Ke(this,Bt,new Array(t).fill(void 0)),Ke(this,it,new Array(t).fill(void 0)),Ke(this,qn,new b(t)),Ke(this,pr,new b(t)),Ke(this,xn,0),Ke(this,On,0),Ke(this,Vr,Hg.create(t)),Ke(this,pn,0),Ke(this,qr,0),typeof c=="function"&&Ke(this,Gr,c),typeof u=="function"?(Ke(this,Qr,u),Ke(this,En,[])):(Ke(this,Qr,void 0),Ke(this,En,void 0)),Ke(this,Hr,!!X(this,Gr)),Ke(this,Vn,!!X(this,Qr)),this.noDisposeOnSet=!!p,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!k,this.allowStaleOnFetchRejection=!!H,this.allowStaleOnFetchAbort=!!h,this.ignoreFetchAbort=!!S,this.maxEntrySize!==0){if(X(this,dr)!==0&&!ji(X(this,dr)))throw new TypeError("maxSize must be a positive integer if specified");if(!ji(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");We(this,wu,xI).call(this)}if(this.allowStale=!!l,this.noDeleteOnStaleGet=!!$,this.updateAgeOnGet=!!s,this.updateAgeOnHas=!!o,this.ttlResolution=ji(i)||i===0?i:1,this.ttlAutopurge=!!a,this.ttl=n||0,this.ttl){if(!ji(this.ttl))throw new TypeError("ttl must be a positive integer if specified");We(this,Al,Xg).call(this)}if(X(this,$r)===0&&this.ttl===0&&X(this,dr)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!X(this,$r)&&!X(this,dr)){const N="LRU_CACHE_UNBOUNDED";_V(N)&&(RI.add(N),wI("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",N,E1))}}static unsafeExposeInternals(e){return{starts:X(e,xi),ttls:X(e,zr),sizes:X(e,Ni),keyMap:X(e,fn),keyList:X(e,Bt),valList:X(e,it),next:X(e,qn),prev:X(e,pr),get head(){return X(e,xn)},get tail(){return X(e,On)},free:X(e,Vr),isBackgroundFetch:t=>{var n;return We(n=e,kt,Gt).call(n,t)},backgroundFetch:(t,n,i,a)=>{var s;return We(s=e,Fs,Bc).call(s,t,n,i,a)},moveToTail:t=>{var n;return We(n=e,qa,Ho).call(n,t)},indexes:t=>{var n;return We(n=e,ai,Ji).call(n,t)},rindexes:t=>{var n;return We(n=e,si,ea).call(n,t)},isStale:t=>{var n;return X(n=e,fr).call(n,t)}}}get max(){return X(this,$r)}get maxSize(){return X(this,dr)}get calculatedSize(){return X(this,qr)}get size(){return X(this,pn)}get fetchMethod(){return X(this,Ms)}get dispose(){return X(this,Gr)}get disposeAfter(){return X(this,Qr)}getRemainingTTL(e){return X(this,fn).has(e)?1/0:0}*entries(){for(const e of We(this,ai,Ji).call(this))X(this,it)[e]!==void 0&&X(this,Bt)[e]!==void 0&&!We(this,kt,Gt).call(this,X(this,it)[e])&&(yield[X(this,Bt)[e],X(this,it)[e]])}*rentries(){for(const e of We(this,si,ea).call(this))X(this,it)[e]!==void 0&&X(this,Bt)[e]!==void 0&&!We(this,kt,Gt).call(this,X(this,it)[e])&&(yield[X(this,Bt)[e],X(this,it)[e]])}*keys(){for(const e of We(this,ai,Ji).call(this)){const t=X(this,Bt)[e];t!==void 0&&!We(this,kt,Gt).call(this,X(this,it)[e])&&(yield t)}}*rkeys(){for(const e of We(this,si,ea).call(this)){const t=X(this,Bt)[e];t!==void 0&&!We(this,kt,Gt).call(this,X(this,it)[e])&&(yield t)}}*values(){for(const e of We(this,ai,Ji).call(this))X(this,it)[e]!==void 0&&!We(this,kt,Gt).call(this,X(this,it)[e])&&(yield X(this,it)[e])}*rvalues(){for(const e of We(this,si,ea).call(this))X(this,it)[e]!==void 0&&!We(this,kt,Gt).call(this,X(this,it)[e])&&(yield X(this,it)[e])}[Symbol.iterator](){return this.entries()}find(e,t={}){for(const n of We(this,ai,Ji).call(this)){const i=X(this,it)[n],a=We(this,kt,Gt).call(this,i)?i.__staleWhileFetching:i;if(a!==void 0&&e(a,X(this,Bt)[n],this))return this.get(X(this,Bt)[n],t)}}forEach(e,t=this){for(const n of We(this,ai,Ji).call(this)){const i=X(this,it)[n],a=We(this,kt,Gt).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,X(this,Bt)[n],this)}}rforEach(e,t=this){for(const n of We(this,si,ea).call(this)){const i=X(this,it)[n],a=We(this,kt,Gt).call(this,i)?i.__staleWhileFetching:i;a!==void 0&&e.call(t,a,X(this,Bt)[n],this)}}purgeStale(){let e=!1;for(const t of We(this,si,ea).call(this,{allowStale:!0}))X(this,fr).call(this,t)&&(this.delete(X(this,Bt)[t]),e=!0);return e}dump(){const e=[];for(const t of We(this,ai,Ji).call(this,{allowStale:!0})){const n=X(this,Bt)[t],i=X(this,it)[t],a=We(this,kt,Gt).call(this,i)?i.__staleWhileFetching:i;if(a===void 0||n===void 0)continue;const s={value:a};if(X(this,zr)&&X(this,xi)){s.ttl=X(this,zr)[t];const o=Uo.now()-X(this,xi)[t];s.start=Math.floor(Date.now()-o)}X(this,Ni)&&(s.size=X(this,Ni)[t]),e.unshift([n,s])}return e}load(e){this.clear();for(const[t,n]of e){if(n.start){const i=Date.now()-n.start;n.start=Uo.now()-i}this.set(t,n.value,n)}}set(e,t,n={}){var m,_,E,R,w;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}=n;let{noUpdateTTL:c=this.noUpdateTTL}=n;const u=X(this,Rl).call(this,e,t,n.size||0,o);if(this.maxEntrySize&&u>this.maxEntrySize)return l&&(l.set="miss",l.maxEntrySizeExceeded=!0),this.delete(e),this;let p=X(this,pn)===0?void 0:X(this,fn).get(e);if(p===void 0)p=X(this,pn)===0?X(this,On):X(this,Vr).length!==0?X(this,Vr).pop():X(this,pn)===X(this,$r)?We(this,Bs,Pc).call(this,!1):X(this,pn),X(this,Bt)[p]=e,X(this,it)[p]=t,X(this,fn).set(e,p),X(this,qn)[X(this,On)]=p,X(this,pr)[p]=X(this,On),Ke(this,On,p),zl(this,pn)._++,X(this,Ps).call(this,p,u,l),l&&(l.set="add"),c=!1;else{We(this,qa,Ho).call(this,p);const k=X(this,it)[p];if(t!==k){if(X(this,sa)&&We(this,kt,Gt).call(this,k)){k.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:$}=k;$!==void 0&&!s&&(X(this,Hr)&&((m=X(this,Gr))==null||m.call(this,$,e,"set")),X(this,Vn)&&((_=X(this,En))==null||_.push([$,e,"set"])))}else s||(X(this,Hr)&&((E=X(this,Gr))==null||E.call(this,k,e,"set")),X(this,Vn)&&((R=X(this,En))==null||R.push([k,e,"set"])));if(X(this,Qa).call(this,p),X(this,Ps).call(this,p,u,l),X(this,it)[p]=t,l){l.set="replace";const $=k&&We(this,kt,Gt).call(this,k)?k.__staleWhileFetching:k;$!==void 0&&(l.oldValue=$)}}else l&&(l.set="update")}if(i!==0&&!X(this,zr)&&We(this,Al,Xg).call(this),X(this,zr)&&(c||X(this,Il).call(this,p,i,a),l&&X(this,Di).call(this,l,p)),!s&&X(this,Vn)&&X(this,En)){const k=X(this,En);let $;for(;$=k==null?void 0:k.shift();)(w=X(this,Qr))==null||w.call(this,...$)}return this}pop(){var e;try{for(;X(this,pn);){const t=X(this,it)[X(this,xn)];if(We(this,Bs,Pc).call(this,!0),We(this,kt,Gt).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(X(this,Vn)&&X(this,En)){const t=X(this,En);let n;for(;n=t==null?void 0:t.shift();)(e=X(this,Qr))==null||e.call(this,...n)}}}has(e,t={}){const{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=t,a=X(this,fn).get(e);if(a!==void 0){const s=X(this,it)[a];if(We(this,kt,Gt).call(this,s)&&s.__staleWhileFetching===void 0)return!1;if(X(this,fr).call(this,a))i&&(i.has="stale",X(this,Di).call(this,i,a));else return n&&X(this,Ga).call(this,a),i&&(i.has="hit",X(this,Di).call(this,i,a)),!0}else i&&(i.has="miss");return!1}peek(e,t={}){const{allowStale:n=this.allowStale}=t,i=X(this,fn).get(e);if(i!==void 0&&(n||!X(this,fr).call(this,i))){const a=X(this,it)[i];return We(this,kt,Gt).call(this,a)?a.__staleWhileFetching:a}}async fetch(e,t={}){const{allowStale:n=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:u=this.noUpdateTTL,noDeleteOnFetchRejection:p=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:_=this.ignoreFetchAbort,allowStaleOnFetchAbort:E=this.allowStaleOnFetchAbort,context:R,forceRefresh:w=!1,status:k,signal:$}=t;if(!X(this,sa))return k&&(k.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,status:k});const H={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:a,ttl:s,noDisposeOnSet:o,size:l,sizeCalculation:c,noUpdateTTL:u,noDeleteOnFetchRejection:p,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:E,ignoreFetchAbort:_,status:k,signal:$};let h=X(this,fn).get(e);if(h===void 0){k&&(k.fetch="miss");const S=We(this,Fs,Bc).call(this,e,h,H,R);return S.__returned=S}else{const S=X(this,it)[h];if(We(this,kt,Gt).call(this,S)){const F=n&&S.__staleWhileFetching!==void 0;return k&&(k.fetch="inflight",F&&(k.returnedStale=!0)),F?S.__staleWhileFetching:S.__returned=S}const b=X(this,fr).call(this,h);if(!w&&!b)return k&&(k.fetch="hit"),We(this,qa,Ho).call(this,h),i&&X(this,Ga).call(this,h),k&&X(this,Di).call(this,k,h),S;const N=We(this,Fs,Bc).call(this,e,h,H,R),B=N.__staleWhileFetching!==void 0&&n;return k&&(k.fetch=b?"stale":"refresh",B&&b&&(k.returnedStale=!0)),B?N.__staleWhileFetching:N.__returned=N}}get(e,t={}){const{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:a=this.noDeleteOnStaleGet,status:s}=t,o=X(this,fn).get(e);if(o!==void 0){const l=X(this,it)[o],c=We(this,kt,Gt).call(this,l);return s&&X(this,Di).call(this,s,o),X(this,fr).call(this,o)?(s&&(s.get="stale"),c?(s&&n&&l.__staleWhileFetching!==void 0&&(s.returnedStale=!0),n?l.__staleWhileFetching:void 0):(a||this.delete(e),s&&n&&(s.returnedStale=!0),n?l:void 0)):(s&&(s.get="hit"),c?l.__staleWhileFetching:(We(this,qa,Ho).call(this,o),i&&X(this,Ga).call(this,o),l))}else s&&(s.get="miss")}delete(e){var n,i,a,s;let t=!1;if(X(this,pn)!==0){const o=X(this,fn).get(e);if(o!==void 0)if(t=!0,X(this,pn)===1)this.clear();else{X(this,Qa).call(this,o);const l=X(this,it)[o];We(this,kt,Gt).call(this,l)?l.__abortController.abort(new Error("deleted")):(X(this,Hr)||X(this,Vn))&&(X(this,Hr)&&((n=X(this,Gr))==null||n.call(this,l,e,"delete")),X(this,Vn)&&((i=X(this,En))==null||i.push([l,e,"delete"]))),X(this,fn).delete(e),X(this,Bt)[o]=void 0,X(this,it)[o]=void 0,o===X(this,On)?Ke(this,On,X(this,pr)[o]):o===X(this,xn)?Ke(this,xn,X(this,qn)[o]):(X(this,qn)[X(this,pr)[o]]=X(this,qn)[o],X(this,pr)[X(this,qn)[o]]=X(this,pr)[o]),zl(this,pn)._--,X(this,Vr).push(o)}}if(X(this,Vn)&&((a=X(this,En))!=null&&a.length)){const o=X(this,En);let l;for(;l=o==null?void 0:o.shift();)(s=X(this,Qr))==null||s.call(this,...l)}return t}clear(){var e,t,n;for(const i of We(this,si,ea).call(this,{allowStale:!0})){const a=X(this,it)[i];if(We(this,kt,Gt).call(this,a))a.__abortController.abort(new Error("deleted"));else{const s=X(this,Bt)[i];X(this,Hr)&&((e=X(this,Gr))==null||e.call(this,a,s,"delete")),X(this,Vn)&&((t=X(this,En))==null||t.push([a,s,"delete"]))}}if(X(this,fn).clear(),X(this,it).fill(void 0),X(this,Bt).fill(void 0),X(this,zr)&&X(this,xi)&&(X(this,zr).fill(0),X(this,xi).fill(0)),X(this,Ni)&&X(this,Ni).fill(0),Ke(this,xn,0),Ke(this,On,0),X(this,Vr).length=0,Ke(this,qr,0),Ke(this,pn,0),X(this,Vn)&&X(this,En)){const i=X(this,En);let a;for(;a=i==null?void 0:i.shift();)(n=X(this,Qr))==null||n.call(this,...a)}}};$r=new WeakMap,dr=new WeakMap,Gr=new WeakMap,Qr=new WeakMap,Ms=new WeakMap,pn=new WeakMap,qr=new WeakMap,fn=new WeakMap,Bt=new WeakMap,it=new WeakMap,qn=new WeakMap,pr=new WeakMap,xn=new WeakMap,On=new WeakMap,Vr=new WeakMap,En=new WeakMap,Ni=new WeakMap,xi=new WeakMap,zr=new WeakMap,Hr=new WeakMap,sa=new WeakMap,Vn=new WeakMap,Al=new WeakSet,Xg=function(){const e=new Mc(X(this,$r)),t=new Mc(X(this,$r));Ke(this,zr,e),Ke(this,xi,t),Ke(this,Il,(a,s,o=Uo.now())=>{if(t[a]=s!==0?o:0,e[a]=s,s!==0&&this.ttlAutopurge){const l=setTimeout(()=>{X(this,fr).call(this,a)&&this.delete(X(this,Bt)[a])},s+1);l.unref&&l.unref()}}),Ke(this,Ga,a=>{t[a]=e[a]!==0?Uo.now():0}),Ke(this,Di,(a,s)=>{if(e[s]){const o=e[s],l=t[s];a.ttl=o,a.start=l,a.now=n||i();const c=a.now-l;a.remainingTTL=o-c}});let n=0;const i=()=>{const a=Uo.now();if(this.ttlResolution>0){n=a;const s=setTimeout(()=>n=0,this.ttlResolution);s.unref&&s.unref()}return a};this.getRemainingTTL=a=>{const s=X(this,fn).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=(n||i())-l;return o-c},Ke(this,fr,a=>e[a]!==0&&t[a]!==0&&(n||i())-t[a]>e[a])},Ga=new WeakMap,Di=new WeakMap,Il=new WeakMap,fr=new WeakMap,wu=new WeakSet,xI=function(){const e=new Mc(X(this,$r));Ke(this,qr,0),Ke(this,Ni,e),Ke(this,Qa,t=>{Ke(this,qr,X(this,qr)-e[t]),e[t]=0}),Ke(this,Rl,(t,n,i,a)=>{if(We(this,kt,Gt).call(this,n))return 0;if(!ji(i))if(a){if(typeof a!="function")throw new TypeError("sizeCalculation must be a function");if(i=a(n,t),!ji(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}),Ke(this,Ps,(t,n,i)=>{if(e[t]=n,X(this,dr)){const a=X(this,dr)-e[t];for(;X(this,qr)>a;)We(this,Bs,Pc).call(this,!0)}Ke(this,qr,X(this,qr)+e[t]),i&&(i.entrySize=n,i.totalCalculatedSize=X(this,qr))})},Qa=new WeakMap,Ps=new WeakMap,Rl=new WeakMap,ai=new WeakSet,Ji=function*({allowStale:e=this.allowStale}={}){if(X(this,pn))for(let t=X(this,On);!(!We(this,wl,Zg).call(this,t)||((e||!X(this,fr).call(this,t))&&(yield t),t===X(this,xn)));)t=X(this,pr)[t]},si=new WeakSet,ea=function*({allowStale:e=this.allowStale}={}){if(X(this,pn))for(let t=X(this,xn);!(!We(this,wl,Zg).call(this,t)||((e||!X(this,fr).call(this,t))&&(yield t),t===X(this,On)));)t=X(this,qn)[t]},wl=new WeakSet,Zg=function(e){return e!==void 0&&X(this,fn).get(X(this,Bt)[e])===e},Bs=new WeakSet,Pc=function(e){var a,s;const t=X(this,xn),n=X(this,Bt)[t],i=X(this,it)[t];return X(this,sa)&&We(this,kt,Gt).call(this,i)?i.__abortController.abort(new Error("evicted")):(X(this,Hr)||X(this,Vn))&&(X(this,Hr)&&((a=X(this,Gr))==null||a.call(this,i,n,"evict")),X(this,Vn)&&((s=X(this,En))==null||s.push([i,n,"evict"]))),X(this,Qa).call(this,t),e&&(X(this,Bt)[t]=void 0,X(this,it)[t]=void 0,X(this,Vr).push(t)),X(this,pn)===1?(Ke(this,xn,Ke(this,On,0)),X(this,Vr).length=0):Ke(this,xn,X(this,qn)[t]),X(this,fn).delete(n),zl(this,pn)._--,t},Fs=new WeakSet,Bc=function(e,t,n,i){const a=t===void 0?void 0:X(this,it)[t];if(We(this,kt,Gt).call(this,a))return a;const s=new Au,{signal:o}=n;o==null||o.addEventListener("abort",()=>s.abort(o.reason),{signal:s.signal});const l={signal:s.signal,options:n,context:i},c=(R,w=!1)=>{const{aborted:k}=s.signal,$=n.ignoreFetchAbort&&R!==void 0;if(n.status&&(k&&!w?(n.status.fetchAborted=!0,n.status.fetchError=s.signal.reason,$&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),k&&!$&&!w)return p(s.signal.reason);const H=_;return X(this,it)[t]===_&&(R===void 0?H.__staleWhileFetching?X(this,it)[t]=H.__staleWhileFetching:this.delete(e):(n.status&&(n.status.fetchUpdated=!0),this.set(e,R,l.options))),R},u=R=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=R),p(R)),p=R=>{const{aborted:w}=s.signal,k=w&&n.allowStaleOnFetchAbort,$=k||n.allowStaleOnFetchRejection,H=$||n.noDeleteOnFetchRejection,h=_;if(X(this,it)[t]===_&&(!H||h.__staleWhileFetching===void 0?this.delete(e):k||(X(this,it)[t]=h.__staleWhileFetching)),$)return n.status&&h.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),h.__staleWhileFetching;if(h.__returned===h)throw R},m=(R,w)=>{var $;const k=($=X(this,Ms))==null?void 0:$.call(this,e,a,l);k&&k instanceof Promise&&k.then(H=>R(H===void 0?void 0:H),w),s.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(R(void 0),n.allowStaleOnFetchAbort&&(R=H=>c(H,!0)))})};n.status&&(n.status.fetchDispatched=!0);const _=new Promise(m).then(c,u),E=Object.assign(_,{__abortController:s,__staleWhileFetching:a,__returned:void 0});return t===void 0?(this.set(e,E,{...l.options,status:void 0}),t=X(this,fn).get(e)):X(this,it)[t]=E,E},kt=new WeakSet,Gt=function(e){if(!X(this,sa))return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof Au},Nl=new WeakSet,Kg=function(e,t){X(this,pr)[t]=e,X(this,qn)[e]=t},qa=new WeakSet,Ho=function(e){e!==X(this,On)&&(e===X(this,xn)?Ke(this,xn,X(this,qn)[e]):We(this,Nl,Kg).call(this,X(this,pr)[e],X(this,qn)[e]),We(this,Nl,Kg).call(this,X(this,On),e),Ke(this,On,e))};let Wg=E1;const nl=class nl{constructor(){I(this,"_fallbackMethod",()=>nl.createSkipProxy());I(this,"out",()=>{})}};I(nl,"createSkipProxy",()=>{const e=new nl;return new Proxy(e,{get(t,n,i){return typeof t[n]>"u"?t._fallbackMethod:t[n]},set(t,n,i,a){return!1}})});let Cl=nl;const rl=class rl extends Wu{constructor(t,n){super(n);I(this,"_fallbackMethod",()=>rl.createRestProxy(this.values.noteLength,this.app));I(this,"out",()=>{});this.values.noteLength=t}};I(rl,"createRestProxy",(t,n)=>{const i=new rl(t,n);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 Iu=rl;class bV extends Wu{constructor(t,n,i,a=""){super(i);I(this,"input");I(this,"ziffers");I(this,"initCallTime",0);I(this,"startCallTime",0);I(this,"lastCallTime",0);I(this,"waitTime",0);I(this,"played",!1);I(this,"current");I(this,"retro",!1);I(this,"index",-1);I(this,"zid","");I(this,"options",{});I(this,"skipIndex",0);I(this,"next",()=>(this.current=this.ziffers.next(),this.played=!0,this.current));I(this,"pulseToSecond",t=>this.app.clock.convertPulseToSecond(t));I(this,"firstRun",()=>this.notStarted());I(this,"atTheBeginning",()=>this.skipIndex===0&&this.ziffers.index<=0);I(this,"origin",()=>this.app.clock.pulses_since_origin+1);I(this,"pulse",()=>this.app.clock.time_position.pulse);I(this,"beat",()=>this.app.clock.time_position.beat);I(this,"nextBeat",()=>this.app.clock.next_beat_in_ticks);I(this,"nextBeatInTicks",()=>this.app.clock.next_beat_in_ticks);I(this,"areWeThereYet",()=>{this.app.clock.pulses_since_origin=this.nextBeatInTicks())&&this.origin()>=this.waitTime,n=this.current&&this.pulseToSecond(this.origin())>=this.pulseToSecond(this.lastCallTime)+this.pulseToSecond(this.current.duration*4*this.app.clock.ppqn)&&this.origin()>=this.waitTime,i=t||n;return this.skipIndex=i?0:this.skipIndex+1,this.index=i?this.index+1:this.index,i&&this.notStarted()&&(this.initCallTime=this.app.clock.pulses_since_origin),this.atTheBeginning()&&(this.startCallTime=this.app.clock.pulses_since_origin),i});I(this,"lead",()=>this.voiceleading());I(this,"invert",t=>(this.atTheBeginning()&&this.ziffers.invert(t),this));I(this,"out",()=>{});this.app=i,this.options=n,typeof t=="string"?(this.input=t,this.ziffers=new Ha(t,n)):typeof t=="number"?(this.input=t,this.ziffers=Ha.fromNumber(t,n)):(this.ziffers=Ha.fromGenerator(t,n),this.input=this.ziffers.input),this.zid=a}reset(){this.initCallTime=0,this.startCallTime=0,this.lastCallTime=0,this.waitTime=0,this.index=0,this.skipIndex=0,this.played=!1,this.skipIndex=0,this.ziffers.reset()}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 n=this.next(),i=this.app.clock.convertPulseToSecond(n.duration*4*this.app.clock.ppqn);if(n instanceof _n){const a=n.getExisting("freq","note","pitch","key","scale","octave","parsedScale");return n.sound&&(t=n.sound),n.soundIndex&&(a.n=n.soundIndex),a.dur=i,new qg(a,this.app).sound(t||"sine")}else if(n instanceof Cn){const a=n.pitches.map(l=>l.getExisting("freq","note","pitch","key","scale","octave","parsedScale")),s={dur:i};t&&(s.s=t);let o=Cu(a,s);return new qg(o,this.app)}else if(n instanceof $g)return Iu.createRestProxy(n.duration,this.app)}else return Cl.createSkipProxy()}midi(t=void 0){if(this.areWeThereYet()){const n=this.next(),i=n.getExisting("note","pitch","bend","key","scale","octave","parsedScale");if(n instanceof _n){n.soundIndex&&(i.channel=n.soundIndex);const a=new Vg(i,this.app);return t?a.note(t):a}else{if(n instanceof $g)return Iu.createRestProxy(n.duration,this.app);if(n instanceof Cn){const a=n.midiChord(),s=Cu(a);return new Vg(s,this.app)}}}else return Cl.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}triadTonnetz(t,n=[3,4,5]){return this.atTheBeginning()&&this.ziffers.triadTonnetz(t,n),this}tetraTonnetz(t,n=[3,4,5]){return this.atTheBeginning()&&this.ziffers.tetraTonnetz(t,n),this}octaCycle(t=[3,4,5]){return this.atTheBeginning()&&this.ziffers.octaCycle(t),this}hexaCycle(t=[3,4,5]){return this.atTheBeginning()&&this.ziffers.hexaCycle(t),this}enneaCycle(t=[3,4,5]){return this.atTheBeginning()&&this.ziffers.enneaCycle(t),this}tonnetzChord(t){return this.atTheBeginning()&&this.ziffers.tonnetzChords(t),this}voiceleading(){return this.atTheBeginning()&&this.ziffers.lead(),this}retrograde(){return this.atTheBeginning()&&this.ziffers.retrograde(),this}wait(t){if(this.atTheBeginning()){if(typeof t=="function"){const n=this.app.api.patternCache.get(t.name);return n&&(this.waitTime=n.nextEndTime()),this}this.waitTime=this.origin()+Math.ceil(t*4*this.app.clock.ppqn)}return this}sync(t){if(this.atTheBeginning()&&this.notStarted()){const n=this.app.clock.pulses_since_origin,i=typeof t=="function"?t.name:t;if(n>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 SV=r=>r[0]==="{"&&r[r.length-1]==="}",Yo=(r,e)=>{if(SV(r)){const t=JSON.parse(r);return JSON.stringify({...t,...e})}else return JSON.stringify({...e,text:r})},OV=r=>{String.prototype.speak=function(){const e=JSON.parse(this.valueOf());new DI({...e,text:e.text}).speak().then(()=>{}).catch(t=>{console.log("Error speaking:",t)})},String.prototype.rate=function(e){return Yo(this.valueOf(),{rate:e})},String.prototype.pitch=function(e){return Yo(this.valueOf(),{pitch:e})},String.prototype.lang=function(e){return Yo(this.valueOf(),{lang:e})},String.prototype.volume=function(e){return Yo(this.valueOf(),{volume:e})},String.prototype.voice=function(e){return Yo(this.valueOf(),{voice:e})},String.prototype.z=function(e={}){return r.z(this.valueOf(),e)},String.prototype.z0=function(e={}){return r.z0(this.valueOf(),e)},String.prototype.z1=function(e={}){return r.z1(this.valueOf(),e)},String.prototype.z2=function(e={}){return r.z2(this.valueOf(),e)},String.prototype.z3=function(e={}){return r.z3(this.valueOf(),e)},String.prototype.z4=function(e={}){return r.z4(this.valueOf(),e)},String.prototype.z5=function(e={}){return r.z5(this.valueOf(),e)},String.prototype.z6=function(e={}){return r.z6(this.valueOf(),e)},String.prototype.z7=function(e={}){return r.z7(this.valueOf(),e)},String.prototype.z8=function(e={}){return r.z8(this.valueOf(),e)},String.prototype.z9=function(e={}){return r.z9(this.valueOf(),e)},String.prototype.z10=function(e={}){return r.z10(this.valueOf(),e)},String.prototype.z11=function(e={}){return r.z11(this.valueOf(),e)},String.prototype.z12=function(e={}){return r.z12(this.valueOf(),e)},String.prototype.z13=function(e={}){return r.z13(this.valueOf(),e)},String.prototype.z14=function(e={}){return r.z14(this.valueOf(),e)},String.prototype.z15=function(e={}){return r.z15(this.valueOf(),e)},String.prototype.z16=function(e={}){return r.z16(this.valueOf(),e)},String.prototype.note=function(){try{return parseInt(this.valueOf())}catch{return Pr(this.valueOf())}}};let Nm;class DI{constructor(e){I(this,"speak",()=>new Promise((e,t)=>{if(this.options.text){const n=window.speechSynthesis;n.speaking&&n.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=n.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)},n.speaking?(n.cancel(),Nm&&clearTimeout(Nm),Nm=setTimeout(()=>{n.speak(i)},200)):n.speak(i)}else t("No text provided")}));this.options=e}}async function kI(){return Promise.all([YD(),ta("github:tidalcycles/Dirt-Samples/master").then(()=>rk()),lk(),ta("github:Bubobubobubobubo/Dough-Fox/main"),ta("github:Bubobubobubobubo/Dough-Samples/main"),ta("github:Bubobubobubobubo/Dough-Amiga/main"),ta("github:Bubobubobubobubo/Dough-Amen/main"),ta("github:Bubobubobubobubo/Dough-Waveforms/main")])}class EV{constructor(e){I(this,"variables",{});I(this,"codeExamples",{});I(this,"counters",{});I(this,"_drunk",new gV(-100,100,!1));I(this,"randomGen",Math.random);I(this,"currentSeed");I(this,"localSeeds",new Map);I(this,"patternCache",new Wg({max:1e3,ttl:1e3*60*5}));I(this,"errorTimeoutID",0);I(this,"printTimeoutID",0);I(this,"MidiConnection");I(this,"scale_aid");I(this,"load");I(this,"_loadUniverseFromInterface",e=>{this.app.selected_universe=e.trim(),this.app.settings.selected_universe=e.trim(),cu(this.app,e),uu()});I(this,"_deleteUniverseFromInterface",e=>{delete this.app.universes[e],this.app.settings.selected_universe===e&&(this.app.settings.selected_universe="Welcome",this.app.selected_universe="Welcome"),this.app.settings.saveApplicationToLocalStorage(this.app.universes,this.app.settings),this.app.updateKnownUniversesView()});I(this,"_playDocExample",e=>{let t=this.app.universes[this.app.selected_universe];this.app.exampleIsPlaying=!0,t.example?t.example.candidate=e||this.app.selectedExample:(t.example={candidate:"",committed:"",evaluations:0},t.example.candidate=e||this.app.selectedExample),this.stop(),this.play()});I(this,"_stopDocExample",()=>{let e=this.app.universes[this.app.selected_universe];(e==null?void 0:e.example)!==void 0&&(this.app.exampleIsPlaying=!1,e.example.candidate="",e.example.committed=""),this.stop()});I(this,"_playDocExampleOnce",e=>{let t=this.app.universes[this.app.selected_universe];(t==null?void 0:t.example)!==void 0&&(t.example.candidate="",t.example.committed=""),this.stop(),this.play(),this.app.exampleIsPlaying=!0,i9(this.app,e)});I(this,"_all_samples",()=>xu.get());I(this,"_reportError",e=>{const t=s=>{var l;const o=(l=s.stack)==null?void 0:l.split(` -`);if(o){for(const c of o)if(c.includes("")){const u=c.match(/:(\d+):(\d+)/);if(u)return{line:parseInt(u[1],10),column:parseInt(u[2],10)}}}return{line:null,column:null}},{line:n,column:i}=t(e),a=n&&i?`${e.message} (Line: ${n-2}, Column: ${i})`:e.message;clearTimeout(this.errorTimeoutID),clearTimeout(this.printTimeoutID),this.app.interface.error_line.innerHTML=a,this.app.interface.error_line.style.color="color-red-800",this.app.interface.error_line.classList.remove("hidden"),this.errorTimeoutID=setTimeout(()=>this.app.interface.error_line.classList.add("hidden"),2e3)});I(this,"_logMessage",e=>{console.log(e),clearTimeout(this.printTimeoutID),clearTimeout(this.errorTimeoutID),this.app.interface.error_line.innerHTML=e,this.app.interface.error_line.style.color="white",this.app.interface.error_line.classList.remove("hidden"),this.printTimeoutID=setTimeout(()=>this.app.interface.error_line.classList.add("hidden"),4e3)});I(this,"time",()=>this.app.audioContext.currentTime);I(this,"play",()=>{this.app.setButtonHighlighting("play",!0),this.MidiConnection.sendStartMessage(),this.app.clock.start()});I(this,"pause",()=>{this.app.setButtonHighlighting("pause",!0),this.app.clock.pause()});I(this,"stop",()=>{this.app.setButtonHighlighting("stop",!0),this.app.clock.stop()});I(this,"silence",this.stop);I(this,"hush",this.stop);I(this,"warp",e=>{this.app.clock.tick=e,this.app.clock.time_position=this.app.clock.convertTicksToTimeposition(e)});I(this,"beat_warp",e=>{this.app.clock.tick=e*this.app.clock.ppqn,this.app.clock.time_position=this.app.clock.convertTicksToTimeposition(e*this.app.clock.ppqn)});I(this,"onmousemove",e=>{this.app._mouseX=e.pageX,this.app._mouseY=e.pageY});I(this,"mouseX",()=>this.app._mouseX);I(this,"mouseY",()=>this.app._mouseY);I(this,"noteX",()=>Math.floor(this.app._mouseX/document.body.clientWidth*127));I(this,"noteY",()=>Math.floor(this.app._mouseY/document.body.clientHeight*127));I(this,"script",(...e)=>{e.forEach(t=>{t>=1&&t<=9&&(uk(this.app,"local",t),ja(this.app,this.app.universes[this.app.selected_universe].locals[t]))})});I(this,"s",this.script);I(this,"delete_script",e=>{this.app.universes[this.app.selected_universe].locals[e]={candidate:"",committed:"",evaluations:0}});I(this,"cs",this.delete_script);I(this,"copy_script",(e,t)=>{this.app.universes[this.app.selected_universe].locals[t]={...this.app.universes[this.app.selected_universe].locals[e]}});I(this,"cps",this.copy_script);I(this,"copy_universe",(e,t)=>{this.app.universes[t]={...this.app.universes[e]}});I(this,"delete_universe",e=>{this.app.selected_universe===e&&(this.app.selected_universe="Default"),delete this.app.universes[e],this.app.settings.saveApplicationToLocalStorage(this.app.universes,this.app.settings),this.app.updateKnownUniversesView()});I(this,"big_bang",()=>{confirm("Are you sure you want to delete all universes?")&&(this.app.universes={...q_},this.app.settings.saveApplicationToLocalStorage(this.app.universes,this.app.settings)),this.app.selected_universe="Default",this.app.updateKnownUniversesView()});I(this,"midi_outputs",()=>{this._logMessage(this.MidiConnection.listMidiOutputs())});I(this,"midi_output",e=>{e?this.MidiConnection.switchMidiOutput(e):console.log(this.MidiConnection.getCurrentMidiPort())});I(this,"midi",(e=60,t,n,i)=>{const a={note:e,velocity:t,channel:n,port:i};return new Vg(a,this.app)});I(this,"sysex",e=>{this.MidiConnection.sendSysExMessage(e)});I(this,"pitch_bend",(e,t)=>{this.MidiConnection.sendPitchBend(e,t)});I(this,"program_change",(e,t)=>{this.MidiConnection.sendProgramChange(e,t)});I(this,"midi_clock",()=>{this.MidiConnection.sendMidiClock()});I(this,"control_change",({control:e=20,value:t=0,channel:n=0})=>{this.MidiConnection.sendMidiControlChange(e,t,n)});I(this,"midi_panic",()=>{this.MidiConnection.panic()});I(this,"active_note_events",e=>{let t;if(e?t=this.MidiConnection.activeNotesFromChannel(e):t=this.MidiConnection.activeNotes,t.length>0)return t});I(this,"active_notes",e=>{const t=this.active_note_events(e);if(t&&t.length>0)return t.map(n=>n.note)});I(this,"kill_active_notes",()=>{this.MidiConnection.activeNotes=[]});I(this,"sticky_notes",e=>{let t;if(e?t=this.MidiConnection.stickyNotesFromChannel(e):t=this.MidiConnection.stickyNotes,t.length>0)return t.map(n=>n.note)});I(this,"kill_sticky_notes",()=>{this.MidiConnection.stickyNotes=[]});I(this,"buffer",e=>e?this.MidiConnection.findNoteFromBufferInChannel(e)!==void 0:this.MidiConnection.noteInputBuffer.length>0);I(this,"buffer_event",e=>e?this.MidiConnection.findNoteFromBufferInChannel(e):this.MidiConnection.noteInputBuffer.shift());I(this,"buffer_note",e=>{const t=this.buffer_event(e);return t?t.note:void 0});I(this,"last_note_event",e=>e?this.MidiConnection.lastNoteInChannel[e]:this.MidiConnection.lastNote);I(this,"last_note",e=>{const t=this.last_note_event(e);return t?t.note:60});I(this,"last_cc",(e,t)=>t?this.MidiConnection.lastCCInChannel[t]?this.MidiConnection.lastCCInChannel[t][e]:0:this.MidiConnection.lastCC[e]||0);I(this,"has_cc",e=>e?this.MidiConnection.findCCFromBufferInChannel(e)!==void 0:this.MidiConnection.ccInputBuffer.length>0);I(this,"buffer_cc",e=>e?this.MidiConnection.findCCFromBufferInChannel(e):this.MidiConnection.ccInputBuffer.shift());I(this,"show_scale",(e,t,n=0,i=this.MidiConnection.currentOutputIndex||0,a=!1)=>{(!this.scale_aid||t!==this.scale_aid)&&(this.hide_scale(e,t,n,i),fq(t,e).forEach(o=>{this.MidiConnection.sendMidiOn(o,n,1,i),a&&this.MidiConnection.sendAllSoundOff(n,i)}),this.scale_aid=t)});I(this,"hide_scale",(e=0,t=0,n=0,i=this.MidiConnection.currentOutputIndex||0)=>{Array.from(Array(128).keys()).forEach(s=>{this.MidiConnection.sendMidiOff(s,n,i)}),this.scale_aid=void 0});I(this,"midi_notes_off",(e=0,t=this.MidiConnection.currentOutputIndex||0)=>{this.MidiConnection.sendAllNotesOff(e,t)});I(this,"midi_sound_off",(e=0,t=this.MidiConnection.currentOutputIndex||0)=>{this.MidiConnection.sendAllSoundOff(e,t)});I(this,"generateCacheKey",(...e)=>e.map(t=>JSON.stringify(t)).join(","));I(this,"resetAllFromCache",()=>{this.patternCache.forEach(e=>e.reset())});I(this,"removePatternFromCache",e=>{this.patternCache.delete(e)});I(this,"z",(e,t={},n="")=>{const i="z"+n.toString(),a=n===""?this.generateCacheKey(e,t):i;let s;return this.app.api.patternCache.has(a)&&(s=this.app.api.patternCache.get(a),typeof e=="string"&&s.input!==e&&(s=void 0)),s||(s=new bV(e,t,this.app,i),this.app.api.patternCache.set(a,s)),s.ziffers.generator&&s.ziffers.generatorDone&&this.removePatternFromCache(a),typeof n=="number"&&(s.zid=i),s.updateLastCallTime(),n!==""&&i!=="z0"&&s.sync("z0"),s});I(this,"z0",(e,t={})=>this.z(e,t,0));I(this,"z1",(e,t={})=>this.z(e,t,1));I(this,"z2",(e,t={})=>this.z(e,t,2));I(this,"z3",(e,t={})=>this.z(e,t,3));I(this,"z4",(e,t={})=>this.z(e,t,4));I(this,"z5",(e,t={})=>this.z(e,t,5));I(this,"z6",(e,t={})=>this.z(e,t,6));I(this,"z7",(e,t={})=>this.z(e,t,7));I(this,"z8",(e,t={})=>this.z(e,t,8));I(this,"z9",(e,t={})=>this.z(e,t,9));I(this,"z10",(e,t={})=>this.z(e,t,10));I(this,"z11",(e,t={})=>this.z(e,t,11));I(this,"z12",(e,t={})=>this.z(e,t,12));I(this,"z13",(e,t={})=>this.z(e,t,13));I(this,"z14",(e,t={})=>this.z(e,t,14));I(this,"z15",(e,t={})=>this.z(e,t,15));I(this,"z16",(e,t={})=>this.z(e,t,16));I(this,"counter",(e,t,n)=>(e in this.counters?(this.counters[e].limit!==t&&(this.counters[e].value=0,this.counters[e].limit=t),this.counters[e].step!==n&&(this.counters[e].step=n??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:n??1,limit:t},this.counters[e].value));I(this,"$",this.counter);I(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);I(this,"drunk",e=>e!==void 0?(this._drunk.position=e,this._drunk.getPosition()):(this._drunk.step(),this._drunk.getPosition()));I(this,"drunk_max",e=>{this._drunk.max=e});I(this,"drunk_min",e=>{this._drunk.min=e});I(this,"drunk_wrap",e=>{this._drunk.toggleWrap(e)});I(this,"variable",(e,t)=>typeof e=="string"&&t===void 0?this.variables[e]:(this.variables[e]=t,this.variables[e]));I(this,"v",this.variable);I(this,"delete_variable",e=>{delete this.variables[e]});I(this,"dv",this.delete_variable);I(this,"clear_variables",()=>{this.variables={}});I(this,"cv",this.clear_variables);I(this,"randI",(e,t)=>Math.floor(this.randomGen()*(t-e+1))+e);I(this,"rand",(e,t)=>this.randomGen()*(t-e)+e);I(this,"irand",this.randI);I(this,"rI",this.randI);I(this,"r",this.rand);I(this,"ir",this.randI);I(this,"seed",e=>{typeof e=="number"&&(e=e.toString()),this.currentSeed!==e&&(this.currentSeed=e,this.randomGen=Yg(e))});I(this,"localSeededRandom",e=>{if(typeof e=="number"&&(e=e.toString()),this.localSeeds.has(e))return this.localSeeds.get(e);const t=Yg(e);return this.localSeeds.set(e,t),t});I(this,"clearLocalSeed",(e=void 0)=>{e&&this.localSeeds.delete(e.toString()),this.localSeeds.clear()});I(this,"quantize",(e,t)=>{if(t.length===0)return e;let n=t[0];return t.forEach(i=>{Math.abs(i-e)Math.min(Math.max(e,t),n));I(this,"cmp",this.clamp);I(this,"prob",e=>this.randomGen()*100this.randomGen()>.5);I(this,"odds",(e,t=1)=>this.randomGen()!1);I(this,"almostNever",(e=1)=>this.randomGen()<.025*this.ppqn()/(this.ppqn()*e));I(this,"rarely",(e=1)=>this.randomGen()<.1*this.ppqn()/(this.ppqn()*e));I(this,"scarcely",(e=1)=>this.randomGen()<.25*this.ppqn()/(this.ppqn()*e));I(this,"sometimes",(e=1)=>this.randomGen()<.5*this.ppqn()/(this.ppqn()*e));I(this,"often",(e=1)=>this.randomGen()<.75*this.ppqn()/(this.ppqn()*e));I(this,"frequently",(e=1)=>this.randomGen()<.9*this.ppqn()/(this.ppqn()*e));I(this,"almostAlways",(e=1)=>this.randomGen()<.985*this.ppqn()/(this.ppqn()*e));I(this,"always",(e=1)=>!0);I(this,"dice",e=>Math.floor(this.randomGen()*e)+1);I(this,"cbar",()=>this.app.clock.time_position.bar+1);I(this,"ctick",()=>this.app.clock.tick+1);I(this,"cpulse",()=>this.app.clock.time_position.pulse+1);I(this,"cbeat",()=>this.app.clock.time_position.beat+1);I(this,"ebeat",()=>this.app.clock.beats_since_origin+1);I(this,"epulse",()=>this.app.clock.pulses_since_origin+1);I(this,"nominator",()=>this.app.clock.time_signature[0]);I(this,"meter",()=>this.app.clock.time_signature[1]);I(this,"denominator",this.meter);I(this,"fill",()=>this.app.fill);I(this,"fullseq",(e,t)=>e.split("").every(n=>n==="x"||n==="o")?[...e].map(n=>n==="x").beat(t):!1);I(this,"seq",(e,t=.5)=>{let n=e.length*t,i=[];for(let a=1;a<=n+1;a+=t)i.push(Math.floor(a*10)/10);return i.pop(),i=i.filter((a,s)=>{const o=s%e.length;return e[o]==="x"}),this.oncount(i,n)});I(this,"beat",(e=1,t=0)=>(Array.isArray(e)?e:[e]).map(a=>(this.app.clock.pulses_since_origin-Math.floor(t*this.ppqn()))%Math.floor(a*this.ppqn())===0).some(a=>a===!0));I(this,"b",this.beat);I(this,"bar",(e=1,t=0)=>{const n=Array.isArray(e)?e:[e],i=this.app.clock.time_signature[1]*this.ppqn(),a=Math.floor(t*i);return n.map(o=>(this.app.clock.pulses_since_origin-a)%Math.floor(o*i)===0).some(o=>o===!0)});I(this,"B",this.bar);I(this,"pulse",(e=1,t=0)=>(Array.isArray(e)?e:[e]).map(a=>(this.app.clock.pulses_since_origin-t)%a===0).some(a=>a===!0));I(this,"p",this.pulse);I(this,"tick",(e,t=0)=>(Array.isArray(e)?e:[e]).map(a=>this.app.clock.time_position.pulse===a+t).some(a=>a===!0));I(this,"dur",e=>{let t=Array.isArray(e)?e:[e];return this.beat(t.dur(...t))});I(this,"flip",(e,t=50)=>{let n=e*2;const i=this.app.clock.pulses_since_origin,a=Math.floor(n*this.ppqn()),s=Math.floor(t/100*a);return i%a{let t=e*2;const n=this.app.clock.time_position.bar;return Math.floor(n/t)%2===0});I(this,"onbar",(e,t=this.app.clock.time_signature[0])=>{let n=this.app.clock.time_position.bar%t+1;return typeof e=="number"?e===n:e.some(i=>i==n)});I(this,"onbeat",(...e)=>{let t=[];return e.forEach(n=>{let i=n%this.nominator()||this.nominator(),a=Math.floor(i);a=a==0?this.nominator():a;let s=Math.floor((i-a)*this.ppqn()+1);s<=0&&(s=s+this.ppqn()*this.nominator()),t.push(a===this.cbeat()&&this.cpulse()===s)}),t.some(n=>n==!0)});I(this,"oncount",(e,t)=>{typeof e=="number"&&(e=[e]);const n=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=n%(this.ppqn()*t);return i.push(o===s)}),i.some(a=>a==!0)});I(this,"oneuclid",(e,t,n=0)=>{const a=this._euclidean_cycle(e,t,n).reduce((s,o,l)=>(o&&s.push(l+1),s),[]);return this.oncount(a,t)});I(this,"delay",(e,t)=>{setTimeout(t,e)});I(this,"delayr",(e,t,n)=>{[...Array(t).keys()].map(a=>e*a).forEach((a,s)=>{setTimeout(n,a)})});I(this,"euclid",(e,t,n,i=0)=>this._euclidean_cycle(t,n,i)[e%n]);I(this,"ec",this.euclid);I(this,"rhythm",(e,t,n,i=0)=>this.beat(e)&&this._euclidean_cycle(t,n,i).beat(e));I(this,"bin",(e,t)=>{let i=t.toString(2).split("").map(a=>a==="1");return i[e%i.length]});I(this,"binrhythm",(e,t)=>{let i=t.toString(2).split("").map(a=>a==="1");return this.beat(e)&&i.beat(e)});I(this,"line",(e,t,n=1)=>{const i=[];if(t>e&&n>0||t(Math.sin(this.app.clock.ctx.currentTime*Math.PI*2*e)+n)*t);I(this,"usine",(e=1,t=1,n=0)=>(this.sine(e,t,n)+1)/2*t);I(this,"saw",(e=1,t=1,n=0)=>(this.app.clock.ctx.currentTime*e%1*2-1+n)*t);I(this,"usaw",(e=1,t=1,n=0)=>(this.saw(e,t,n)+1)/2*t);I(this,"triangle",(e=1,t=1,n=0)=>(Math.abs(this.saw(e,t,n))*2-1)*t);I(this,"utriangle",(e=1,t=1,n=0)=>(this.triangle(e,t,n)+1)/2*t);I(this,"square",(e=1,t=1,n=0,i=.5)=>{const a=1/e;return((Date.now()/1e3+n)%a/a(this.square(e,t,n,i)+1)/2*t);I(this,"noise",(e=1)=>(this.randomGen()*2-1)*e);I(this,"min",(...e)=>Math.min(...e));I(this,"max",(...e)=>Math.max(...e));I(this,"mean",(...e)=>e.reduce((n,i)=>n+i,0)/e.length);I(this,"range",(e,t,n,i,a)=>(e-t)/(n-t)*(a-i)+i);I(this,"limit",(e,t,n)=>Math.min(Math.max(e,t),n));I(this,"abs",Math.abs);I(this,"speak",(e,t="en-US",n=0,i=1,a=1)=>{new DI({text:e,lang:t,voice:n,rate:i,pitch:a}).speak().then(()=>{}).catch(o=>{console.log(o)})});I(this,"stop_hydra",()=>{this.app.hydra.hush()});I(this,"sound",e=>e?new qg(e,this.app):new Cl);I(this,"snd",this.sound);I(this,"samples",ta);I(this,"log",e=>{console.log(e),this._logMessage(e)});I(this,"scale",f1);I(this,"nearScales",Tq);I(this,"rate",e=>{});I(this,"divseq",(...e)=>{const t=e[0],n=e.slice(1),i=this.app.clock.pulses_since_origin,a=Math.floor(i/Math.floor(t*this.ppqn()));return n[a%n.length]});I(this,"seqbeat",(...e)=>e[this.app.clock.time_position.beat%e.length]);I(this,"seqbar",(...e)=>e[(this.app.clock.time_position.bar+1)%e.length]);I(this,"register",(e,t)=>{Wu.prototype[e]=function(){return t(this)}});I(this,"shuffle",e=>e.sort(()=>this.randomGen()-.5));I(this,"reverse",e=>e.reverse());I(this,"rotate",e=>t=>t.slice(e,t.length).concat(t.slice(0,e)));I(this,"repeat",e=>t=>t.flatMap(n=>Array(e).fill(n)));I(this,"repeatOdd",e=>t=>t.flatMap((n,i)=>i%2===0?Array(e).fill(n):n));I(this,"repeatEven",e=>t=>t.flatMap((n,i)=>i%2!==0?Array(e).fill(n):n));I(this,"palindrome",e=>e.concat(e.slice(0,e.length-1).reverse()));I(this,"scope",e=>{this.app.osc={...this.app.osc,...e}});I(this,"raltfont",(e,t)=>{this.app.view.dispatch({effects:this.app.fontSize.reconfigure(ke.theme({"&":{fontFamily:e},".cm-gutters":{fontFamily:e},".cm-content":{fontFamily:e},".cm-comment":{fontFamily:t}}))})});I(this,"gif",e=>{const{url:t,posX:n=0,posY:i=0,opacity:a=1,size:s="auto",center:o=!1,rotation:l=0,filter:c="none",dur:u=1}=e;let p=u*this.app.clock.pulse_duration*this.app.clock.ppqn,m=p*.1,_=p-m;const E=document.createElement("img");E.src=t,E.style.position="fixed",E.style.left=o?"50%":`${n}px`,E.style.top=o?"50%":`${i}px`,E.style.opacity=`${a}`,E.style.zIndex="-1",s!=="auto"&&(E.style.width=s,E.style.height=s);const R=[`rotate(${l}deg)`];o&&R.unshift("translate(-50%, -50%)"),E.style.transform=R.join(" "),E.style.filter=c,E.style.transition=`opacity ${m}s ease`,document.body.appendChild(E),setTimeout(()=>{E.style.opacity="0"},_*1e3),setTimeout(()=>{document.body.contains(E)&&document.body.removeChild(E)},p*1e3)});I(this,"nudge",e=>(e&&(this.app.clock.nudge=e),this.app.clock.nudge));I(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));I(this,"tempo",this.bpm);I(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));I(this,"ppqn",e=>e===void 0?this.app.clock.ppqn:(e<1&&console.log(`Setting ppqn to ${e}`),this.app.clock.ppqn=e,e));I(this,"time_signature",(e,t)=>{this.app.clock.time_signature=[e,t]});this.app=e,this.MidiConnection=new mV(this,e.settings)}transmission(){return this.MidiConnection.activeNotes.length>0}_euclidean_cycle(e,t,n=0){if(e==t)return Array.from({length:t},()=>!0);function i(o,l){const c=o.length,u=(l+1)%c;return o[l]>o[u]}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 n!=0&&(s=s.slice(n).concat(s.slice(0,n))),s}}function v(){v=function(){return e};var r,e={},t=Object.prototype,n=t.hasOwnProperty,i=Object.defineProperty||function(x,P,q){x[P]=q.value},a=typeof Symbol=="function"?Symbol:{},s=a.iterator||"@@iterator",o=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function c(x,P,q){return Object.defineProperty(x,P,{value:q,enumerable:!0,configurable:!0,writable:!0}),x[P]}try{c({},"")}catch{c=function(P,q,z){return P[q]=z}}function u(x,P,q,z){var ne=Object.create((P&&P.prototype instanceof k?P:k).prototype),se=new ie(z||[]);return i(ne,"_invoke",{value:F(x,q,se)}),ne}function p(x,P,q){try{return{type:"normal",arg:x.call(P,q)}}catch(z){return{type:"throw",arg:z}}}e.wrap=u;var m="suspendedStart",_="suspendedYield",E="executing",R="completed",w={};function k(){}function $(){}function H(){}var h={};c(h,s,function(){return this});var S=Object.getPrototypeOf,b=S&&S(S(te([])));b&&b!==t&&n.call(b,s)&&(h=b);var N=H.prototype=k.prototype=Object.create(h);function M(x){["next","throw","return"].forEach(function(P){c(x,P,function(q){return this._invoke(P,q)})})}function B(x,P){function q(ne,se,_e,ye){var Ae=p(x[ne],x,se);if(Ae.type!=="throw"){var Ee=Ae.arg,Ie=Ee.value;return Ie&&typeof Ie=="object"&&n.call(Ie,"__await")?P.resolve(Ie.__await).then(function(de){q("next",de,_e,ye)},function(de){q("throw",de,_e,ye)}):P.resolve(Ie).then(function(de){Ee.value=de,_e(Ee)},function(de){return q("throw",de,_e,ye)})}ye(Ae.arg)}var z;i(this,"_invoke",{value:function(ne,se){function _e(){return new P(function(ye,Ae){q(ne,se,ye,Ae)})}return z=z?z.then(_e,_e):_e()}})}function F(x,P,q){var z=m;return function(ne,se){if(z===E)throw new Error("Generator is already running");if(z===R){if(ne==="throw")throw se;return{value:r,done:!0}}for(q.method=ne,q.arg=se;;){var _e=q.delegate;if(_e){var ye=V(_e,q);if(ye){if(ye===w)continue;return ye}}if(q.method==="next")q.sent=q._sent=q.arg;else if(q.method==="throw"){if(z===m)throw z=R,q.arg;q.dispatchException(q.arg)}else q.method==="return"&&q.abrupt("return",q.arg);z=E;var Ae=p(x,P,q);if(Ae.type==="normal"){if(z=q.done?R:_,Ae.arg===w)continue;return{value:Ae.arg,done:q.done}}Ae.type==="throw"&&(z=R,q.method="throw",q.arg=Ae.arg)}}}function V(x,P){var q=P.method,z=x.iterator[q];if(z===r)return P.delegate=null,q==="throw"&&x.iterator.return&&(P.method="return",P.arg=r,V(x,P),P.method==="throw")||q!=="return"&&(P.method="throw",P.arg=new TypeError("The iterator does not provide a '"+q+"' method")),w;var ne=p(z,x.iterator,P.arg);if(ne.type==="throw")return P.method="throw",P.arg=ne.arg,P.delegate=null,w;var se=ne.arg;return se?se.done?(P[x.resultName]=se.value,P.next=x.nextLoc,P.method!=="return"&&(P.method="next",P.arg=r),P.delegate=null,w):se:(P.method="throw",P.arg=new TypeError("iterator result is not an object"),P.delegate=null,w)}function re(x){var P={tryLoc:x[0]};1 in x&&(P.catchLoc=x[1]),2 in x&&(P.finallyLoc=x[2],P.afterLoc=x[3]),this.tryEntries.push(P)}function ae(x){var P=x.completion||{};P.type="normal",delete P.arg,x.completion=P}function ie(x){this.tryEntries=[{tryLoc:"root"}],x.forEach(re,this),this.reset(!0)}function te(x){if(x||x===""){var P=x[s];if(P)return P.call(x);if(typeof x.next=="function")return x;if(!isNaN(x.length)){var q=-1,z=function ne(){for(;++q=0;--z){var ne=this.tryEntries[z],se=ne.completion;if(ne.tryLoc==="root")return q("end");if(ne.tryLoc<=this.prev){var _e=n.call(ne,"catchLoc"),ye=n.call(ne,"finallyLoc");if(_e&&ye){if(this.prev=0;--q){var z=this.tryEntries[q];if(z.tryLoc<=this.prev&&n.call(z,"finallyLoc")&&this.prev=0;--P){var q=this.tryEntries[P];if(q.finallyLoc===x)return this.complete(q.completion,q.afterLoc),ae(q),w}},catch:function(x){for(var P=this.tryEntries.length-1;P>=0;--P){var q=this.tryEntries[P];if(q.tryLoc===x){var z=q.completion;if(z.type==="throw"){var ne=z.arg;ae(q)}return ne}}throw new Error("illegal catch attempt")},delegateYield:function(x,P,q){return this.delegate={iterator:te(x),resultName:P,nextLoc:q},this.method==="next"&&(this.arg=r),w}},e}function bv(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t=r.length?{done:!0}:{done:!1,value:r[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +`);if(o){for(const c of o)if(c.includes("")){const u=c.match(/:(\d+):(\d+)/);if(u)return{line:parseInt(u[1],10),column:parseInt(u[2],10)}}}return{line:null,column:null}},{line:n,column:i}=t(e),a=n&&i?`${e.message} (Line: ${n-2}, Column: ${i})`:e.message;clearTimeout(this.errorTimeoutID),clearTimeout(this.printTimeoutID),this.app.interface.error_line.innerHTML=a,this.app.interface.error_line.style.color="color-red-800",this.app.interface.error_line.classList.remove("hidden"),this.errorTimeoutID=setTimeout(()=>this.app.interface.error_line.classList.add("hidden"),2e3)});I(this,"_logMessage",e=>{console.log(e),clearTimeout(this.printTimeoutID),clearTimeout(this.errorTimeoutID),this.app.interface.error_line.innerHTML=e,this.app.interface.error_line.style.color="white",this.app.interface.error_line.classList.remove("hidden"),this.printTimeoutID=setTimeout(()=>this.app.interface.error_line.classList.add("hidden"),4e3)});I(this,"time",()=>this.app.audioContext.currentTime);I(this,"play",()=>{this.app.setButtonHighlighting("play",!0),this.MidiConnection.sendStartMessage(),this.app.clock.start()});I(this,"pause",()=>{this.app.setButtonHighlighting("pause",!0),this.app.clock.pause()});I(this,"stop",()=>{this.app.setButtonHighlighting("stop",!0),this.app.clock.stop()});I(this,"silence",this.stop);I(this,"hush",this.stop);I(this,"warp",e=>{this.app.clock.tick=e,this.app.clock.time_position=this.app.clock.convertTicksToTimeposition(e)});I(this,"beat_warp",e=>{this.app.clock.tick=e*this.app.clock.ppqn,this.app.clock.time_position=this.app.clock.convertTicksToTimeposition(e*this.app.clock.ppqn)});I(this,"onmousemove",e=>{this.app._mouseX=e.pageX,this.app._mouseY=e.pageY});I(this,"mouseX",()=>this.app._mouseX);I(this,"mouseY",()=>this.app._mouseY);I(this,"noteX",()=>Math.floor(this.app._mouseX/document.body.clientWidth*127));I(this,"noteY",()=>Math.floor(this.app._mouseY/document.body.clientHeight*127));I(this,"script",(...e)=>{e.forEach(t=>{t>=1&&t<=9&&(uk(this.app,"local",t),ja(this.app,this.app.universes[this.app.selected_universe].locals[t]))})});I(this,"s",this.script);I(this,"delete_script",e=>{this.app.universes[this.app.selected_universe].locals[e]={candidate:"",committed:"",evaluations:0}});I(this,"cs",this.delete_script);I(this,"copy_script",(e,t)=>{this.app.universes[this.app.selected_universe].locals[t]={...this.app.universes[this.app.selected_universe].locals[e]}});I(this,"cps",this.copy_script);I(this,"copy_universe",(e,t)=>{this.app.universes[t]={...this.app.universes[e]}});I(this,"delete_universe",e=>{this.app.selected_universe===e&&(this.app.selected_universe="Default"),delete this.app.universes[e],this.app.settings.saveApplicationToLocalStorage(this.app.universes,this.app.settings),this.app.updateKnownUniversesView()});I(this,"big_bang",()=>{confirm("Are you sure you want to delete all universes?")&&(this.app.universes={...q_},this.app.settings.saveApplicationToLocalStorage(this.app.universes,this.app.settings)),this.app.selected_universe="Default",this.app.updateKnownUniversesView()});I(this,"midi_outputs",()=>{this._logMessage(this.MidiConnection.listMidiOutputs())});I(this,"midi_output",e=>{e?this.MidiConnection.switchMidiOutput(e):console.log(this.MidiConnection.getCurrentMidiPort())});I(this,"midi",(e=60,t,n,i)=>{const a={note:e,velocity:t,channel:n,port:i};return new Vg(a,this.app)});I(this,"sysex",e=>{this.MidiConnection.sendSysExMessage(e)});I(this,"pitch_bend",(e,t)=>{this.MidiConnection.sendPitchBend(e,t)});I(this,"program_change",(e,t)=>{this.MidiConnection.sendProgramChange(e,t)});I(this,"midi_clock",()=>{this.MidiConnection.sendMidiClock()});I(this,"control_change",({control:e=20,value:t=0,channel:n=0})=>{this.MidiConnection.sendMidiControlChange(e,t,n)});I(this,"midi_panic",()=>{this.MidiConnection.panic()});I(this,"active_note_events",e=>{let t;if(e?t=this.MidiConnection.activeNotesFromChannel(e):t=this.MidiConnection.activeNotes,t.length>0)return t});I(this,"active_notes",e=>{const t=this.active_note_events(e);if(t&&t.length>0)return t.map(n=>n.note)});I(this,"kill_active_notes",()=>{this.MidiConnection.activeNotes=[]});I(this,"sticky_notes",e=>{let t;if(e?t=this.MidiConnection.stickyNotesFromChannel(e):t=this.MidiConnection.stickyNotes,t.length>0)return t.map(n=>n.note)});I(this,"kill_sticky_notes",()=>{this.MidiConnection.stickyNotes=[]});I(this,"buffer",e=>e?this.MidiConnection.findNoteFromBufferInChannel(e)!==void 0:this.MidiConnection.noteInputBuffer.length>0);I(this,"buffer_event",e=>e?this.MidiConnection.findNoteFromBufferInChannel(e):this.MidiConnection.noteInputBuffer.shift());I(this,"buffer_note",e=>{const t=this.buffer_event(e);return t?t.note:void 0});I(this,"last_note_event",e=>e?this.MidiConnection.lastNoteInChannel[e]:this.MidiConnection.lastNote);I(this,"last_note",e=>{const t=this.last_note_event(e);return t?t.note:60});I(this,"last_cc",(e,t)=>t?this.MidiConnection.lastCCInChannel[t]?this.MidiConnection.lastCCInChannel[t][e]:0:this.MidiConnection.lastCC[e]||0);I(this,"has_cc",e=>e?this.MidiConnection.findCCFromBufferInChannel(e)!==void 0:this.MidiConnection.ccInputBuffer.length>0);I(this,"buffer_cc",e=>e?this.MidiConnection.findCCFromBufferInChannel(e):this.MidiConnection.ccInputBuffer.shift());I(this,"show_scale",(e,t,n=0,i=this.MidiConnection.currentOutputIndex||0,a=!1)=>{(!this.scale_aid||t!==this.scale_aid)&&(this.hide_scale(e,t,n,i),fq(t,e).forEach(o=>{this.MidiConnection.sendMidiOn(o,n,1,i),a&&this.MidiConnection.sendAllSoundOff(n,i)}),this.scale_aid=t)});I(this,"hide_scale",(e=0,t=0,n=0,i=this.MidiConnection.currentOutputIndex||0)=>{Array.from(Array(128).keys()).forEach(s=>{this.MidiConnection.sendMidiOff(s,n,i)}),this.scale_aid=void 0});I(this,"midi_notes_off",(e=0,t=this.MidiConnection.currentOutputIndex||0)=>{this.MidiConnection.sendAllNotesOff(e,t)});I(this,"midi_sound_off",(e=0,t=this.MidiConnection.currentOutputIndex||0)=>{this.MidiConnection.sendAllSoundOff(e,t)});I(this,"generateCacheKey",(...e)=>e.map(t=>JSON.stringify(t)).join(","));I(this,"resetAllFromCache",()=>{this.patternCache.forEach(e=>e.reset())});I(this,"removePatternFromCache",e=>{this.patternCache.delete(e)});I(this,"z",(e,t={},n="")=>{const i="z"+n.toString(),a=n===""?this.generateCacheKey(e,t):i;let s;return this.app.api.patternCache.has(a)&&(s=this.app.api.patternCache.get(a),typeof e=="string"&&s.input!==e&&(s=void 0)),s||(s=new bV(e,t,this.app,i),this.app.api.patternCache.set(a,s)),s.ziffers.generator&&s.ziffers.generatorDone&&this.removePatternFromCache(a),typeof n=="number"&&(s.zid=i),s.updateLastCallTime(),n!==""&&i!=="z0"&&s.sync("z0"),s});I(this,"z0",(e,t={})=>this.z(e,t,0));I(this,"z1",(e,t={})=>this.z(e,t,1));I(this,"z2",(e,t={})=>this.z(e,t,2));I(this,"z3",(e,t={})=>this.z(e,t,3));I(this,"z4",(e,t={})=>this.z(e,t,4));I(this,"z5",(e,t={})=>this.z(e,t,5));I(this,"z6",(e,t={})=>this.z(e,t,6));I(this,"z7",(e,t={})=>this.z(e,t,7));I(this,"z8",(e,t={})=>this.z(e,t,8));I(this,"z9",(e,t={})=>this.z(e,t,9));I(this,"z10",(e,t={})=>this.z(e,t,10));I(this,"z11",(e,t={})=>this.z(e,t,11));I(this,"z12",(e,t={})=>this.z(e,t,12));I(this,"z13",(e,t={})=>this.z(e,t,13));I(this,"z14",(e,t={})=>this.z(e,t,14));I(this,"z15",(e,t={})=>this.z(e,t,15));I(this,"z16",(e,t={})=>this.z(e,t,16));I(this,"counter",(e,t,n)=>(e in this.counters?(this.counters[e].limit!==t&&(this.counters[e].value=0,this.counters[e].limit=t),this.counters[e].step!==n&&(this.counters[e].step=n??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:n??1,limit:t},this.counters[e].value));I(this,"$",this.counter);I(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);I(this,"drunk",e=>e!==void 0?(this._drunk.position=e,this._drunk.getPosition()):(this._drunk.step(),this._drunk.getPosition()));I(this,"drunk_max",e=>{this._drunk.max=e});I(this,"drunk_min",e=>{this._drunk.min=e});I(this,"drunk_wrap",e=>{this._drunk.toggleWrap(e)});I(this,"variable",(e,t)=>typeof e=="string"&&t===void 0?this.variables[e]:(this.variables[e]=t,this.variables[e]));I(this,"v",this.variable);I(this,"delete_variable",e=>{delete this.variables[e]});I(this,"dv",this.delete_variable);I(this,"clear_variables",()=>{this.variables={}});I(this,"cv",this.clear_variables);I(this,"randI",(e,t)=>Math.floor(this.randomGen()*(t-e+1))+e);I(this,"rand",(e,t)=>this.randomGen()*(t-e)+e);I(this,"irand",this.randI);I(this,"rI",this.randI);I(this,"r",this.rand);I(this,"ir",this.randI);I(this,"seed",e=>{typeof e=="number"&&(e=e.toString()),this.currentSeed!==e&&(this.currentSeed=e,this.randomGen=Yg(e))});I(this,"localSeededRandom",e=>{if(typeof e=="number"&&(e=e.toString()),this.localSeeds.has(e))return this.localSeeds.get(e);const t=Yg(e);return this.localSeeds.set(e,t),t});I(this,"clearLocalSeed",(e=void 0)=>{e&&this.localSeeds.delete(e.toString()),this.localSeeds.clear()});I(this,"quantize",(e,t)=>{if(t.length===0)return e;let n=t[0];return t.forEach(i=>{Math.abs(i-e)Math.min(Math.max(e,t),n));I(this,"cmp",this.clamp);I(this,"prob",e=>this.randomGen()*100this.randomGen()>.5);I(this,"odds",(e,t=1)=>this.randomGen()!1);I(this,"almostNever",(e=1)=>this.randomGen()<.025*this.ppqn()/(this.ppqn()*e));I(this,"rarely",(e=1)=>this.randomGen()<.1*this.ppqn()/(this.ppqn()*e));I(this,"scarcely",(e=1)=>this.randomGen()<.25*this.ppqn()/(this.ppqn()*e));I(this,"sometimes",(e=1)=>this.randomGen()<.5*this.ppqn()/(this.ppqn()*e));I(this,"often",(e=1)=>this.randomGen()<.75*this.ppqn()/(this.ppqn()*e));I(this,"frequently",(e=1)=>this.randomGen()<.9*this.ppqn()/(this.ppqn()*e));I(this,"almostAlways",(e=1)=>this.randomGen()<.985*this.ppqn()/(this.ppqn()*e));I(this,"always",(e=1)=>!0);I(this,"dice",e=>Math.floor(this.randomGen()*e)+1);I(this,"cbar",()=>this.app.clock.time_position.bar+1);I(this,"ctick",()=>this.app.clock.tick+1);I(this,"cpulse",()=>this.app.clock.time_position.pulse+1);I(this,"cbeat",()=>this.app.clock.time_position.beat+1);I(this,"ebeat",()=>this.app.clock.beats_since_origin+1);I(this,"epulse",()=>this.app.clock.pulses_since_origin+1);I(this,"nominator",()=>this.app.clock.time_signature[0]);I(this,"meter",()=>this.app.clock.time_signature[1]);I(this,"denominator",this.meter);I(this,"fill",()=>this.app.fill);I(this,"fullseq",(e,t)=>e.split("").every(n=>n==="x"||n==="o")?[...e].map(n=>n==="x").beat(t):!1);I(this,"seq",(e,t=.5)=>{let n=e.length*t,i=[];for(let a=1;a<=n+1;a+=t)i.push(Math.floor(a*10)/10);return i.pop(),i=i.filter((a,s)=>{const o=s%e.length;return e[o]==="x"}),this.oncount(i,n)});I(this,"beat",(e=1,t=0)=>(Array.isArray(e)?e:[e]).map(a=>(this.app.clock.pulses_since_origin-Math.floor(t*this.ppqn()))%Math.floor(a*this.ppqn())===0).some(a=>a===!0));I(this,"b",this.beat);I(this,"bar",(e=1,t=0)=>{const n=Array.isArray(e)?e:[e],i=this.app.clock.time_signature[1]*this.ppqn(),a=Math.floor(t*i);return n.map(o=>(this.app.clock.pulses_since_origin-a)%Math.floor(o*i)===0).some(o=>o===!0)});I(this,"B",this.bar);I(this,"pulse",(e=1,t=0)=>(Array.isArray(e)?e:[e]).map(a=>(this.app.clock.pulses_since_origin-t)%a===0).some(a=>a===!0));I(this,"p",this.pulse);I(this,"tick",(e,t=0)=>(Array.isArray(e)?e:[e]).map(a=>this.app.clock.time_position.pulse===a+t).some(a=>a===!0));I(this,"dur",e=>{let t=Array.isArray(e)?e:[e];return this.beat(t.dur(...t))});I(this,"flip",(e,t=50)=>{let n=e*2;const i=this.app.clock.pulses_since_origin,a=Math.floor(n*this.ppqn()),s=Math.floor(t/100*a);return i%a{let t=e*2;const n=this.app.clock.time_position.bar;return Math.floor(n/t)%2===0});I(this,"onbar",(e,t=this.app.clock.time_signature[0])=>{let n=this.app.clock.time_position.bar%t+1;return typeof e=="number"?e===n:e.some(i=>i==n)});I(this,"onbeat",(...e)=>{let t=[];return e.forEach(n=>{let i=n%this.nominator()||this.nominator(),a=Math.floor(i);a=a==0?this.nominator():a;let s=Math.floor((i-a)*this.ppqn()+1);s<=0&&(s=s+this.ppqn()*this.nominator()),t.push(a===this.cbeat()&&this.cpulse()===s)}),t.some(n=>n==!0)});I(this,"oncount",(e,t)=>{typeof e=="number"&&(e=[e]);const n=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=n%(this.ppqn()*t);return i.push(o===s)}),i.some(a=>a==!0)});I(this,"oneuclid",(e,t,n=0)=>{const a=this._euclidean_cycle(e,t,n).reduce((s,o,l)=>(o&&s.push(l+1),s),[]);return this.oncount(a,t)});I(this,"delay",(e,t)=>{setTimeout(t,e)});I(this,"delayr",(e,t,n)=>{[...Array(t).keys()].map(a=>e*a).forEach((a,s)=>{setTimeout(n,a)})});I(this,"euclid",(e,t,n,i=0)=>this._euclidean_cycle(t,n,i)[e%n]);I(this,"ec",this.euclid);I(this,"rhythm",(e,t,n,i=0)=>this.beat(e)&&this._euclidean_cycle(t,n,i).beat(e));I(this,"bin",(e,t)=>{let i=t.toString(2).split("").map(a=>a==="1");return i[e%i.length]});I(this,"binrhythm",(e,t)=>{let i=t.toString(2).split("").map(a=>a==="1");return this.beat(e)&&i.beat(e)});I(this,"line",(e,t,n=1)=>{const i=[];if(t>e&&n>0||t(Math.sin(this.app.clock.ctx.currentTime*Math.PI*2*e)+n)*t);I(this,"usine",(e=1,t=1,n=0)=>(this.sine(e,t,n)+1)/2*t);I(this,"saw",(e=1,t=1,n=0)=>(this.app.clock.ctx.currentTime*e%1*2-1+n)*t);I(this,"usaw",(e=1,t=1,n=0)=>(this.saw(e,t,n)+1)/2*t);I(this,"triangle",(e=1,t=1,n=0)=>(Math.abs(this.saw(e,t,n))*2-1)*t);I(this,"utriangle",(e=1,t=1,n=0)=>(this.triangle(e,t,n)+1)/2*t);I(this,"square",(e=1,t=1,n=0,i=.5)=>{const a=1/e;return((Date.now()/1e3+n)%a/a(this.square(e,t,n,i)+1)/2*t);I(this,"noise",(e=1)=>(this.randomGen()*2-1)*e);I(this,"min",(...e)=>Math.min(...e));I(this,"max",(...e)=>Math.max(...e));I(this,"mean",(...e)=>e.reduce((n,i)=>n+i,0)/e.length);I(this,"range",(e,t,n,i,a)=>(e-t)/(n-t)*(a-i)+i);I(this,"limit",(e,t,n)=>Math.min(Math.max(e,t),n));I(this,"abs",Math.abs);I(this,"speak",(e,t="en-US",n=0,i=1,a=1)=>{new DI({text:e,lang:t,voice:n,rate:i,pitch:a}).speak().then(()=>{}).catch(o=>{console.log(o)})});I(this,"stop_hydra",()=>{this.app.hydra.hush()});I(this,"sound",e=>e?new qg(e,this.app):new Cl);I(this,"snd",this.sound);I(this,"samples",ta);I(this,"log",e=>{console.log(e),this._logMessage(e)});I(this,"scale",f1);I(this,"nearScales",Tq);I(this,"rate",e=>{});I(this,"divseq",(...e)=>{const t=e[0],n=e.slice(1),i=this.app.clock.pulses_since_origin,a=Math.floor(i/Math.floor(t*this.ppqn()));return n[a%n.length]});I(this,"seqbeat",(...e)=>e[this.app.clock.time_position.beat%e.length]);I(this,"seqbar",(...e)=>e[(this.app.clock.time_position.bar+1)%e.length]);I(this,"register",(e,t)=>{Wu.prototype[e]=function(...n){return t(this,...n)}});I(this,"shuffle",e=>e.sort(()=>this.randomGen()-.5));I(this,"reverse",e=>e.reverse());I(this,"rotate",e=>t=>t.slice(e,t.length).concat(t.slice(0,e)));I(this,"repeat",e=>t=>t.flatMap(n=>Array(e).fill(n)));I(this,"repeatOdd",e=>t=>t.flatMap((n,i)=>i%2===0?Array(e).fill(n):n));I(this,"repeatEven",e=>t=>t.flatMap((n,i)=>i%2!==0?Array(e).fill(n):n));I(this,"palindrome",e=>e.concat(e.slice(0,e.length-1).reverse()));I(this,"scope",e=>{this.app.osc={...this.app.osc,...e}});I(this,"raltfont",(e,t)=>{this.app.view.dispatch({effects:this.app.fontSize.reconfigure(ke.theme({"&":{fontFamily:e},".cm-gutters":{fontFamily:e},".cm-content":{fontFamily:e},".cm-comment":{fontFamily:t}}))})});I(this,"gif",e=>{const{url:t,posX:n=0,posY:i=0,opacity:a=1,size:s="auto",center:o=!1,rotation:l=0,filter:c="none",dur:u=1}=e;let p=u*this.app.clock.pulse_duration*this.app.clock.ppqn,m=p*.1,_=p-m;const E=document.createElement("img");E.src=t,E.style.position="fixed",E.style.left=o?"50%":`${n}px`,E.style.top=o?"50%":`${i}px`,E.style.opacity=`${a}`,E.style.zIndex="-1",s!=="auto"&&(E.style.width=s,E.style.height=s);const R=[`rotate(${l}deg)`];o&&R.unshift("translate(-50%, -50%)"),E.style.transform=R.join(" "),E.style.filter=c,E.style.transition=`opacity ${m}s ease`,document.body.appendChild(E),setTimeout(()=>{E.style.opacity="0"},_*1e3),setTimeout(()=>{document.body.contains(E)&&document.body.removeChild(E)},p*1e3)});I(this,"nudge",e=>(e&&(this.app.clock.nudge=e),this.app.clock.nudge));I(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));I(this,"tempo",this.bpm);I(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));I(this,"ppqn",e=>e===void 0?this.app.clock.ppqn:(e<1&&console.log(`Setting ppqn to ${e}`),this.app.clock.ppqn=e,e));I(this,"time_signature",(e,t)=>{this.app.clock.time_signature=[e,t]});this.app=e,this.MidiConnection=new mV(this,e.settings)}transmission(){return this.MidiConnection.activeNotes.length>0}_euclidean_cycle(e,t,n=0){if(e==t)return Array.from({length:t},()=>!0);function i(o,l){const c=o.length,u=(l+1)%c;return o[l]>o[u]}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 n!=0&&(s=s.slice(n).concat(s.slice(0,n))),s}}function v(){v=function(){return e};var r,e={},t=Object.prototype,n=t.hasOwnProperty,i=Object.defineProperty||function(x,P,q){x[P]=q.value},a=typeof Symbol=="function"?Symbol:{},s=a.iterator||"@@iterator",o=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function c(x,P,q){return Object.defineProperty(x,P,{value:q,enumerable:!0,configurable:!0,writable:!0}),x[P]}try{c({},"")}catch{c=function(P,q,z){return P[q]=z}}function u(x,P,q,z){var ne=Object.create((P&&P.prototype instanceof k?P:k).prototype),se=new ie(z||[]);return i(ne,"_invoke",{value:F(x,q,se)}),ne}function p(x,P,q){try{return{type:"normal",arg:x.call(P,q)}}catch(z){return{type:"throw",arg:z}}}e.wrap=u;var m="suspendedStart",_="suspendedYield",E="executing",R="completed",w={};function k(){}function $(){}function H(){}var h={};c(h,s,function(){return this});var S=Object.getPrototypeOf,b=S&&S(S(te([])));b&&b!==t&&n.call(b,s)&&(h=b);var N=H.prototype=k.prototype=Object.create(h);function M(x){["next","throw","return"].forEach(function(P){c(x,P,function(q){return this._invoke(P,q)})})}function B(x,P){function q(ne,se,_e,ye){var Ae=p(x[ne],x,se);if(Ae.type!=="throw"){var Ee=Ae.arg,Ie=Ee.value;return Ie&&typeof Ie=="object"&&n.call(Ie,"__await")?P.resolve(Ie.__await).then(function(de){q("next",de,_e,ye)},function(de){q("throw",de,_e,ye)}):P.resolve(Ie).then(function(de){Ee.value=de,_e(Ee)},function(de){return q("throw",de,_e,ye)})}ye(Ae.arg)}var z;i(this,"_invoke",{value:function(ne,se){function _e(){return new P(function(ye,Ae){q(ne,se,ye,Ae)})}return z=z?z.then(_e,_e):_e()}})}function F(x,P,q){var z=m;return function(ne,se){if(z===E)throw new Error("Generator is already running");if(z===R){if(ne==="throw")throw se;return{value:r,done:!0}}for(q.method=ne,q.arg=se;;){var _e=q.delegate;if(_e){var ye=V(_e,q);if(ye){if(ye===w)continue;return ye}}if(q.method==="next")q.sent=q._sent=q.arg;else if(q.method==="throw"){if(z===m)throw z=R,q.arg;q.dispatchException(q.arg)}else q.method==="return"&&q.abrupt("return",q.arg);z=E;var Ae=p(x,P,q);if(Ae.type==="normal"){if(z=q.done?R:_,Ae.arg===w)continue;return{value:Ae.arg,done:q.done}}Ae.type==="throw"&&(z=R,q.method="throw",q.arg=Ae.arg)}}}function V(x,P){var q=P.method,z=x.iterator[q];if(z===r)return P.delegate=null,q==="throw"&&x.iterator.return&&(P.method="return",P.arg=r,V(x,P),P.method==="throw")||q!=="return"&&(P.method="throw",P.arg=new TypeError("The iterator does not provide a '"+q+"' method")),w;var ne=p(z,x.iterator,P.arg);if(ne.type==="throw")return P.method="throw",P.arg=ne.arg,P.delegate=null,w;var se=ne.arg;return se?se.done?(P[x.resultName]=se.value,P.next=x.nextLoc,P.method!=="return"&&(P.method="next",P.arg=r),P.delegate=null,w):se:(P.method="throw",P.arg=new TypeError("iterator result is not an object"),P.delegate=null,w)}function re(x){var P={tryLoc:x[0]};1 in x&&(P.catchLoc=x[1]),2 in x&&(P.finallyLoc=x[2],P.afterLoc=x[3]),this.tryEntries.push(P)}function ae(x){var P=x.completion||{};P.type="normal",delete P.arg,x.completion=P}function ie(x){this.tryEntries=[{tryLoc:"root"}],x.forEach(re,this),this.reset(!0)}function te(x){if(x||x===""){var P=x[s];if(P)return P.call(x);if(typeof x.next=="function")return x;if(!isNaN(x.length)){var q=-1,z=function ne(){for(;++q=0;--z){var ne=this.tryEntries[z],se=ne.completion;if(ne.tryLoc==="root")return q("end");if(ne.tryLoc<=this.prev){var _e=n.call(ne,"catchLoc"),ye=n.call(ne,"finallyLoc");if(_e&&ye){if(this.prev=0;--q){var z=this.tryEntries[q];if(z.tryLoc<=this.prev&&n.call(z,"finallyLoc")&&this.prev=0;--P){var q=this.tryEntries[P];if(q.finallyLoc===x)return this.complete(q.completion,q.afterLoc),ae(q),w}},catch:function(x){for(var P=this.tryEntries.length-1;P>=0;--P){var q=this.tryEntries[P];if(q.tryLoc===x){var z=q.completion;if(z.type==="throw"){var ne=z.arg;ae(q)}return ne}}throw new Error("illegal catch attempt")},delegateYield:function(x,P,q){return this.delegate={iterator:te(x),resultName:P,nextLoc:q},this.method==="next"&&(this.arg=r),w}},e}function bv(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t=r.length?{done:!0}:{done:!1,value:r[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var LI="0.9.7",vV=v().mark(MI);function MI(){var r,e,t;return v().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:r=0,e=[0n,1n,1n,1n,2n,1n,2n,1n,5n,2n,2n,1n,5n,1n,2n,1n,14n,1n,5n,1n,5n,2n,2n,1n,15n,2n,2n,5n,4n,1n,4n,1n,51n,1n,2n,1n,14n,1n,2n,2n,14n,1n,6n,1n,4n,2n,2n,1n,52n,2n,5n,1n,5n,1n,15n,2n,13n,2n,2n,1n,13n,1n,2n,4n,267n,1n,4n,1n,5n,1n,4n,1n,50n,1n,2n,3n,4n,1n,6n,1n,52n,15n,2n,1n,15n,1n,2n,1n,12n,1n,10n,1n,4n,2n,2n,1n,231n,1n,5n,2n,16n,1n,4n,1n,14n,2n,2n,1n,45n,1n,6n,2n,43n,1n,6n,1n,5n,4n,2n,1n,47n,2n,2n,1n,4n,5n,16n,1n,2328n,2n,4n,1n,10n,1n,2n,5n,15n,1n,4n,1n,11n,1n,2n,1n,197n,1n,2n,6n,5n,1n,13n,1n,12n,2n,4n,2n,18n,1n,2n,1n,238n,1n,55n,1n,5n,2n,2n,1n,57n,2n,4n,5n,4n,1n,4n,2n,42n,1n,2n,1n,37n,1n,4n,2n,12n,1n,6n,1n,4n,13n,4n,1n,1543n,1n,2n,2n,12n,1n,10n,1n,52n,2n,2n,2n,12n,2n,2n,2n,51n,1n,12n,1n,5n,1n,2n,1n,177n,1n,2n,2n,15n,1n,6n,1n,197n,6n,2n,1n,15n,1n,4n,2n,14n,1n,16n,1n,4n,2n,4n,1n,208n,1n,5n,67n,5n,2n,4n,1n,12n,1n,15n,1n,46n,2n,2n,1n,56092n,1n,6n,1n,15n,2n,2n,1n,39n,1n,4n,1n,4n,1n,30n,1n,54n,5n,2n,4n,10n,1n,2n,4n,40n,1n,4n,1n,4n,2n,4n,1n,1045n,2n,4n,2n,5n,1n,23n,1n,14n,5n,2n,1n,49n,2n,2n,1n,42n,2n,10n,1n,9n,2n,6n,1n,61n,1n,2n,4n,4n,1n,4n,1n,1640n,1n,4n,1n,176n,2n,2n,2n,15n,1n,12n,1n,4n,5n,2n,1n,228n,1n,5n,1n,15n,1n,18n,5n,12n,1n,2n,1n,12n,1n,10n,14n,195n,1n,4n,2n,5n,2n,2n,1n,162n,2n,2n,3n,11n,1n,6n,1n,42n,2n,4n,1n,15n,1n,4n,7n,12n,1n,60n,1n,11n,2n,2n,1n,20169n,2n,2n,4n,5n,1n,12n,1n,44n,1n,2n,1n,30n,1n,2n,5n,221n,1n,6n,1n,5n,16n,6n,1n,46n,1n,6n,1n,4n,1n,10n,1n,235n,2n,4n,1n,41n,1n,2n,2n,14n,2n,4n,1n,4n,2n,4n,1n,775n,1n,4n,1n,5n,1n,6n,1n,51n,13n,4n,1n,18n,1n,2n,1n,1396n,1n,34n,1n,5n,2n,2n,1n,54n,1n,2n,5n,11n,1n,12n,1n,51n,4n,2n,1n,55n,1n,4n,2n,12n,1n,6n,2n,11n,2n,2n,1n,1213n,1n,2n,2n,12n,1n,261n,1n,14n,2n,10n,1n,12n,1n,4n,4n,42n,2n,4n,1n,56n,1n,2n,1n,202n,2n,6n,6n,4n,1n,8n,1n,10494213n,15n,2n,1n,15n,1n,4n,1n,49n,1n,10n,1n,4n,6n,2n,1n,170n,2n,4n,2n,9n,1n,4n,1n,12n,1n,2n,2n,119n,1n,2n,2n,246n,1n,24n,1n,5n,4n,16n,1n,39n,1n,2n,2n,4n,1n,16n,1n,180n,1n,2n,1n,10n,1n,2n,49n,12n,1n,12n,1n,11n,1n,4n,2n,8681n,1n,5n,2n,15n,1n,6n,1n,15n,4n,2n,1n,66n,1n,4n,1n,51n,1n,30n,1n,5n,2n,4n,1n,205n,1n,6n,4n,4n,7n,4n,1n,195n,3n,6n,1n,36n,1n,2n,2n,35n,1n,6n,1n,15n,5n,2n,1n,260n,15n,2n,2n,5n,1n,32n,1n,12n,2n,2n,1n,12n,2n,4n,2n,21541n,1n,4n,1n,9n,2n,4n,1n,757n,1n,10n,5n,4n,1n,6n,2n,53n,5n,4n,1n,40n,1n,2n,2n,12n,1n,18n,1n,4n,2n,4n,1n,1280n,1n,2n,17n,16n,1n,4n,1n,53n,1n,4n,1n,51n,1n,15n,2n,42n,2n,8n,1n,5n,4n,2n,1n,44n,1n,2n,1n,36n,1n,62n,1n,1387n,1n,2n,1n,10n,1n,6n,4n,15n,1n,12n,2n,4n,1n,2n,1n,840n,1n,5n,2n,5n,2n,13n,1n,40n,504n,4n,1n,18n,1n,2n,6n,195n,2n,10n,1n,15n,5n,4n,1n,54n,1n,2n,2n,11n,1n,39n,1n,42n,1n,4n,2n,189n,1n,2n,2n,39n,1n,6n,1n,4n,2n,2n,1n,1090235n,1n,12n,1n,5n,1n,16n,4n,15n,5n,2n,1n,53n,1n,4n,5n,172n,1n,4n,1n,5n,1n,4n,2n,137n,1n,2n,1n,4n,1n,24n,1n,1211n,2n,2n,1n,15n,1n,4n,1n,14n,1n,113n,1n,16n,2n,4n,1n,205n,1n,2n,11n,20n,1n,4n,1n,12n,5n,4n,1n,30n,1n,4n,2n,1630n,2n,6n,1n,9n,13n,2n,1n,186n,2n,2n,1n,4n,2n,10n,2n,51n,2n,10n,1n,10n,1n,4n,5n,12n,1n,12n,1n,11n,2n,2n,1n,4725n,1n,2n,3n,9n,1n,8n,1n,14n,4n,4n,5n,18n,1n,2n,1n,221n,1n,68n,1n,15n,1n,2n,1n,61n,2n,4n,15n,4n,1n,4n,1n,19349n,2n,2n,1n,150n,1n,4n,7n,15n,2n,6n,1n,4n,2n,8n,1n,222n,1n,2n,4n,5n,1n,30n,1n,39n,2n,2n,1n,34n,2n,2n,4n,235n,1n,18n,2n,5n,1n,2n,2n,222n,1n,4n,2n,11n,1n,6n,1n,42n,13n,4n,1n,15n,1n,10n,1n,42n,1n,10n,2n,4n,1n,2n,1n,11394n,2n,4n,2n,5n,1n,12n,1n,42n,2n,4n,1n,900n,1n,2n,6n,51n,1n,6n,2n,34n,5n,2n,1n,46n,1n,4n,2n,11n,1n,30n,1n,196n,2n,6n,1n,10n,1n,2n,15n,199n,1n,4n,1n,4n,2n,2n,1n,954n,1n,6n,2n,13n,1n,23n,2n,12n,2n,2n,1n,37n,1n,4n,2n,49487367289n,4n,66n,2n,5n,19n,4n,1n,54n,1n,4n,2n,11n,1n,4n,1n,231n,1n,2n,1n,36n,2n,2n,2n,12n,1n,40n,1n,4n,51n,4n,2n,1028n,1n,5n,1n,15n,1n,10n,1n,35n,2n,4n,1n,12n,1n,4n,4n,42n,1n,4n,2n,5n,1n,10n,1n,583n,2n,2n,6n,4n,2n,6n,1n,1681n,6n,4n,1n,77n,1n,2n,2n,15n,1n,16n,1n,51n,2n,4n,1n,170n,1n,4n,5n,5n,1n,12n,1n,12n,2n,2n,1n,46n,1n,4n,2n,1092n,1n,8n,1n,5n,14n,2n,2n,39n,1n,4n,2n,4n,1n,254n,1n,42n,2n,2n,1n,41n,1n,2n,5n,39n,1n,4n,1n,11n,1n,10n,1n,157877n,1n,2n,4n,16n,1n,6n,1n,49n,13n,4n,1n,18n,1n,4n,1n,53n,1n,32n,1n,5n,1n,2n,2n,279n,1n,4n,2n,11n,1n,4n,3n,235n,2n,2n,1n,99n,1n,8n,2n,14n,1n,6n,1n,11n,14n,2n,1n,1040n,1n,2n,1n,13n,2n,16n,1n,12n,5n,27n,1n,12n,1n,2n,69n,1387n,1n,16n,1n,20n,2n,4n,1n,164n,4n,2n,2n,4n,1n,12n,1n,153n,2n,2n,1n,15n,1n,2n,2n,51n,1n,30n,1n,4n,1n,4n,1n,1460n,1n,55n,4n,5n,1n,12n,2n,14n,1n,4n,1n,131n,1n,2n,2n,42n,3n,6n,1n,5n,5n,4n,1n,44n,1n,10n,3n,11n,1n,10n,1n,1116461n,5n,2n,1n,10n,1n,2n,4n,35n,1n,12n,1n,11n,1n,2n,1n,3609n,1n,4n,2n,50n,1n,24n,1n,12n,2n,2n,1n,18n,1n,6n,2n,244n,1n,18n,1n,9n,2n,2n,1n,181n,1n,2n,51n,4n,2n,12n,1n,42n,1n,8n,5n,61n,1n,4n,1n,12n,1n,6n,1n,11n,2n,4n,1n,11720n,1n,2n,1n,5n,1n,112n,1n,52n,1n,2n,2n,12n,1n,4n,4n,245n,1n,4n,1n,9n,5n,2n,1n,211n,2n,4n,2n,38n,1n,6n,15n,195n,15n,6n,2n,29n,1n,2n,1n,14n,1n,32n,1n,4n,2n,4n,1n,198n,1n,4n,8n,5n,1n,4n,1n,153n,1n,2n,1n,227n,2n,4n,5n,19324n,1n,8n,1n,5n,4n,4n,1n,39n,1n,2n,2n,15n,4n,16n,1n,53n,6n,4n,1n,40n,1n,12n,5n,12n,1n,4n,2n,4n,1n,2n,1n,5958n,1n,4n,5n,12n,2n,6n,1n,14n,4n,10n,1n,40n,1n,2n,2n,179n,1n,1798n,1n,15n,2n,4n,1n,61n,1n,2n,5n,4n,1n,46n,1n,1387n,1n,6n,2n,36n,2n,2n,1n,49n,1n,24n,1n,11n,10n,2n,1n,222n,1n,4n,3n,5n,1n,10n,1n,41n,2n,4n,1n,174n,1n,2n,2n,195n,2n,4n,1n,15n,1n,6n,1n,889n,1n,2n,2n,4n,1n,12n,2n,178n,13n,2n,1n,15n,4n,4n,1n,12n,1n,20n,1n,4n,5n,4n,1n,408641062n,1n,2n,60n,36n,1n,4n,1n,15n,2n,2n,1n,46n,1n,16n,1n,54n,1n,24n,2n,5n,2n,4n,1n,221n,1n,4n,1n,11n,1n,30n,1n,928n,2n,4n,1n,10n,2n,2n,13n,14n,1n,4n,1n,11n,2n,6n,1n,697n,1n,4n,3n,5n,1n,8n,1n,12n,5n,2n,2n,64n,1n,4n,2n,10281n,1n,10n,1n,5n,1n,4n,1n,54n,1n,8n,2n,11n,1n,4n,1n,51n,6n,2n,1n,477n,1n,2n,2n,56n,5n,6n,1n,11n,5n,4n,1n,1213n,1n,4n,2n,5n,1n,72n,1n,68n,2n,2n,1n,12n,1n,2n,13n,42n,1n,38n,1n,9n,2n,2n,2n,137n,1n,2n,5n,11n,1n,6n,1n,21507n,5n,10n,1n,15n,1n,4n,1n,34n,2n,60n,2n,4n,5n,2n,1n,1005n,2n,5n,2n,5n,1n,4n,1n,12n,1n,10n,1n,30n,1n,10n,1n,235n,1n,6n,1n,50n,309n,4n,2n,39n,7n,2n,1n,11n,1n,36n,2n,42n,2n,2n,5n,40n,1n,2n,2n,39n,1n,12n,1n,4n,3n,2n,1n,47937n,1n,4n,2n,5n,1n,13n,1n,35n,4n,4n,1n,37n,1n,4n,2n,51n,1n,16n,1n,9n,1n,30n,2n,64n,1n,2n,14n,4n,1n,4n,1n,1285n,1n,2n,1n,228n,1n,2n,5n,53n,1n,8n,2n,4n,2n,2n,4n,260n,1n,6n,1n,15n,1n,110n,1n,12n,2n,4n,1n,12n,1n,4n,5n,1083553n,1n,12n,1n,5n,1n,4n,1n,749n,1n,4n,2n,11n,3n,30n,1n,54n,13n,6n,1n,15n,2n,2n,9n,12n,1n,10n,1n,35n,2n,2n,1n,1264n,2n,4n,6n,5n,1n,18n,1n,14n,2n,4n,1n,117n,1n,2n,2n,178n,1n,6n,1n,5n,4n,4n,1n,162n,2n,10n,1n,4n,1n,16n,1n,1630n,2n,2n,2n,56n,1n,10n,15n,15n,1n,4n,1n,4n,2n,12n,1n,1096n,1n,2n,21n,9n,1n,6n,1n,39n,5n,2n,1n,18n,1n,4n,2n,195n,1n,120n,1n,9n,2n,2n,1n,54n,1n,4n,4n,36n,1n,4n,1n,186n,2n,2n,1n,36n,1n,6n,15n,12n,1n,8n,1n,4n,5n,4n,1n,241004n,1n,5n,1n,15n,4n,10n,1n,15n,2n,4n,1n,34n,1n,2n,4n,167n,1n,12n,1n,15n,1n,2n,1n,3973n,1n,4n,1n,4n,1n,40n,1n,235n,11n,2n,1n,15n,1n,6n,1n,144n,1n,18n,1n,4n,2n,2n,2n,203n,1n,4n,15n,15n,1n,12n,2n,39n,1n,4n,1n,120n,1n,2n,2n,1388n,1n,6n,1n,13n,4n,4n,1n,39n,1n,2n,5n,4n,1n,66n,1n,963n,1n,8n,1n,10n,2n,4n,4n,12n,2n,12n,1n,4n,2n,4n,2n,6538n,1n,2n,2n,20n,1n,6n,2n,46n,63n,2n,1n,88n,1n,12n,1n,42n,1n,10n,2n,5n,5n,2n,1n,175n,2n,2n,2n,11n,1n,12n,1n];case 1:if(!(r1n;e--)r*=e;return r}function YI(r){for(var e=[];r>0n;)e.unshift(r%2n),r>>=1n;return e.join("")}var xV=v().mark(va);function va(){var r;return v().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=2n;case 1:if(!Jr(r)){e.next=4;break}return e.next=4,r;case 4:r++,e.next=1;break;case 7:case"end":return e.stop()}},xV)}var DV=v().mark($I);function $I(){var r,e,t;return v().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:r=ln(va());case 1:if((e=r()).done){n.next=7;break}return t=e.value,n.next=5,BigInt(0|Math.sqrt(Number(t)));case 5:n.next=1;break;case 7:case"end":return n.stop()}},DV)}var kV=v().mark(GI);function GI(){return v().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,1n;case 2:return r.next=4,0n;case 4:r.next=2;break;case 6:case"end":return r.stop()}},kV)}var LV=v().mark(QI);function QI(){var r,e,t;return v().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:r=0,e=[1n,1n,2n,2n,3n,4n,5n,6n,7n,8n,11n,12n,15n,16n,19n,22n,25n,28n,31n,34n,40n,43n,49n,52n,58n,64n,70n,76n,82n,88n,98n,104n,114n,120n,130n,140n,150n,160n,170n,180n,195n,205n,220n,230n,245n,260n,275n,290n,305n,320n,341n,356n,377n,392n,413n,434n,455n,476n,497n,518n,546n];case 1:if(!(rr)){a.next=8;break}return a.next=7,t[r];case 7:r++;case 8:e++,a.next=2;break;case 11:case"end":return a.stop()}},fz)}var hz=v().mark(OR);function OR(){var r,e,t,n,i,a;return v().wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return t=function(o){return o in e||(e[o]=r.next().value),e[o]},s.next=3,1n;case 3:r=_1(),e=[],n=[1n],i=1;case 7:for(n[i]=0n,a=1;a<=i;a++)n[i]+=n[i-a]*t(a);return n[i]/=BigInt(i),s.next=12,n[i];case 12:i++,s.next=7;break;case 15:case"end":return s.stop()}},hz)}var mz=v().mark(ER);function ER(){var r;return v().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=1n;case 1:return e.next=3,r;case 3:r=10n*r+1n,e.next=1;break;case 6:case"end":return e.stop()}},mz)}var gz=v().mark(vR);function vR(){var r,e,t;return v().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:r=ln(va());case 1:if((e=r()).done){n.next=8;break}if(t=e.value,!Jr(BigInt(Math.pow(2,Number(t)))-1n)){n.next=6;break}return n.next=6,t;case 6:n.next=1;break;case 8:case"end":return n.stop()}},gz)}var _z=v().mark(TR);function TR(){var r,e,t;return v().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:r=0,e=[1n,1n,1n,2n,3n,5n,8n,13n,21n,34n,55n,89n,144n,232n,375n,606n,979n,1582n,2556n,4130n,6673n,10782n,17421n,28148n,45480n,73484n,118732n,191841n,309967n,500829n,809214n,1307487n,2112571n,3413385n,5515174n,8911138n,14398164n,23263822n,37588502n,60733592n,98130253n,158553878n,256183302n,413927966n,668803781n,1080619176n,1746009572n,2821113574n,4558212008n];case 1:if(!(rr||r%n!==0n)){i.next=7;break}return i.abrupt("continue",11);case 7:i.next=2;break;case 9:return i.next=11,r;case 11:r++,i.next=1;break;case 14:case"end":return i.stop()}},RZ)}var wZ=v().mark(D3);function D3(){var r;return v().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=0n;case 1:if((YI(r).match(/1/g)||[]).length%2!=0){e.next=4;break}return e.next=4,r;case 4:r++,e.next=1;break;case 7:case"end":return e.stop()}},wZ)}var NZ=v().mark(k3);function k3(){var r,e;return v().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:r=1n;case 1:e=0;case 2:if(!(er?0n:e===1n||e===r?1n:jg(r-1n,e-1n)+jg(r-e,e)}function H3(){var r,e;return v().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:r=1n;case 1:e=1n;case 2:if(!(e<=r)){t.next=8;break}return t.next=5,jg(r,e);case 5:e++,t.next=2;break;case 8:r++,t.next=1;break;case 11:case"end":return t.stop()}},zZ)}var HZ=v().mark(W3);function W3(){var r;return v().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=1n;case 1:return e.next=3,Jr(r)?1n:0n;case 3:r++,e.next=1;break;case 6:case"end":return e.stop()}},HZ)}var WZ=v().mark(X3);function X3(){var r,e;return v().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:r=0n;case 1:return t.next=3,1n;case 3:e=0;case 4:if(!(el)){m.next=6;break}return m.abrupt("break",11);case 6:return m.next=8,p;case 8:t.delete(p);case 9:m.next=2;break;case 11:return m.next=13,l;case 13:r.push(l),e.push(2n),Object.keys(r).forEach(function(_){for(var E=parseInt(_,10),R=-1n,w=e[E];R{Array.prototype.mouseX=function(){const e=r.mouseX(),n=window.innerWidth/this.length,i=Math.floor(e/n);return this[i]},Array.prototype.mouseY=function(){const e=r.mouseY(),n=window.innerHeight/this.length,i=Math.floor(e/n);return this[i]},Array.prototype.square=function(){return this.map(e=>e*e)},Array.prototype.sometimes=function(e){return r.randomGen()<.5?e(this):this},Array.prototype.apply=function(e){return e(this)},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.div=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(r.randomGen()*this.length)]},Array.prototype.gen=function(e,t,n){return n<1?[]:Array.from({length:n},()=>Math.floor(r.randomGen()*(t-e+1))+e)},Array.prototype.bar=function(e=1){return e===1?this[r.app.clock.time_position.bar%this.length]:this[Math.floor(r.app.clock.time_position.bar/e)%this.length]},Array.prototype.beat=function(e=1){const t=e,n=r.app.clock.pulses_since_origin,i=Math.floor(n/Math.floor(t*r.ppqn()));return this[i%this.length]},Array.prototype.b=Array.prototype.beat,Array.prototype.dur=function(...e){const t=r.app.clock.pulses_since_origin,n=r.ppqn(),i=this.map((l,c)=>e[c%e.length]),a=i.reduce((l,c)=>l+c*n,0),s=t%a;let o=0;for(let l=0;l0)e=e%t;else return this;const n=this.splice(-e,e);return this.unshift(...n),this},Array.prototype.unique=function(){const e=new Set;let t=0;for(let n=0;n100)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.repeat=function(e=1){if(e<1)throw new Error("Amount should be at least 1");let t=[];for(let n=0;n(i%a+a)%a,n=OI(Bi(r));return this.map(i=>{const a=Math.floor(i/n.length)*12;return n[t(i,n.length)]+e+a})};Array.prototype.scaleArp=function(r="major",e=0){const t=OI(Bi(r));let n=[];e=e>t.length?t.length:e,e=e==0?t.length:e;for(let i=0;i{if(!r)return;r.width=window.innerWidth,r.height=window.innerHeight;const e=r.getContext("2d"),t=window.devicePixelRatio||1;r.width=window.innerWidth*t,r.height=window.innerHeight*t,e&&e.scale(t,t)},lD=r=>(r.settings.saveApplicationToLocalStorage(r.universes,r.settings),null),uK=r=>(r.currentFile().candidate=r.view.state.doc.toString(),r.currentFile().committed=r.view.state.doc.toString(),r.settings.saveApplicationToLocalStorage(r.universes,r.settings),null),dK=(r,e,t=!1)=>{e.addEventListener("resize",()=>Sv(r.interface.scope)),e.addEventListener("resize",()=>Sv(r.interface.feedback)),e.addEventListener("beforeunload",n=>{n.preventDefault(),uK(r)}),e.addEventListener("visibilitychange",n=>{n.preventDefault(),lD(r)}),t&&(localStorage.openpages=Date.now(),e.addEventListener("storage",function(n){n.key=="openpages"&&(localStorage.page_available=Date.now()),n.key=="page_available"&&(document.getElementById("all").classList.add("invisible"),alert("Topos is already opened in another tab. Close this tab now to prevent data loss."))},!1))},pK=r=>{const e=qC(),t=Object.keys(e).map(i=>({type:"output",regex:new RegExp(`<${i}([^>]*)>`,"g"),replace:(a,s)=>`<${i} class="${e[i]}" ${s}>`}));r.interface.line_numbers_checkbox.checked=r.settings.line_numbers,r.interface.time_position_checkbox.checked=r.settings.time_position,r.interface.tips_checkbox.checked=r.settings.tips,r.interface.completion_checkbox.checked=r.settings.completions,r.interface.midi_clock_checkbox.checked=r.settings.send_clock,r.interface.midi_channels_scripts.checked=r.settings.midi_channels_scripts,r.interface.midi_clock_ppqn.value=r.settings.midi_clock_ppqn.toString(),r.interface.load_demo_songs.checked=r.settings.load_demo_songs;const n=document.querySelectorAll('[id^="tab-"]');for(let i=0;i{n[i].classList.add("bg-orange-300");for(let l=0;l{Ri(),r.updateKnownUniversesView(),uu()}),r.buttonElements.play_buttons.forEach(i=>{i.addEventListener("click",()=>{r.isPlaying?(r.setButtonHighlighting("pause",!0),r.isPlaying=!r.isPlaying,r.clock.pause(),r.api.MidiConnection.sendStopMessage()):(r.setButtonHighlighting("play",!0),r.isPlaying=!r.isPlaying,r.clock.start(),r.api.MidiConnection.sendStartMessage())})}),r.buttonElements.clear_buttons.forEach(i=>{i.addEventListener("click",()=>{r.setButtonHighlighting("clear",!0),confirm("Do you want to reset the current universe?")&&(r.universes[r.selected_universe]=structuredClone(Jo),r.updateEditorView())})}),r.interface.documentation_button.addEventListener("click",()=>{iI(r)}),r.interface.destroy_universes_button.addEventListener("click",()=>{confirm("Do you want to destroy all universes?")&&(r.universes={...q_},r.updateKnownUniversesView())}),r.interface.audio_nudge_range.addEventListener("input",()=>{r.clock.nudge=parseInt(r.interface.audio_nudge_range.value)}),r.interface.dough_nudge_range.addEventListener("input",()=>{r.dough_nudge=parseInt(r.interface.dough_nudge_range.value)}),r.interface.upload_universe_button.addEventListener("click",()=>{const i=document.createElement("input");i.type="file",i.accept=".json",i.addEventListener("change",a=>{var l;const o=(l=a.target.files)==null?void 0:l[0];if(o){const c=new FileReader;c.readAsText(o,"UTF-8"),c.onload=u=>{const p=JSON.parse(u.target.result);for(const[m,_]of Object.entries(p))r.universes[m]=_},c.onerror=u=>{console.error("An error occurred reading the file:",u)}}}),document.body.appendChild(i),i.click(),document.body.removeChild(i)}),r.interface.download_universe_button.addEventListener("click",()=>{r.settings.saveApplicationToLocalStorage(r.universes,r.settings);let i=`topos-universes-${Date.now()}.json`;const a=new Blob([JSON.stringify(r.settings.universes)],{type:"application/json"}),s=URL.createObjectURL(a),o=document.createElement("a");o.href=s,o.download=i,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(s)}),r.interface.load_universe_button.addEventListener("click",()=>{let i=r.interface.buffer_search.value;i.length>2&&i.length<20&&!i.includes(" ")&&(r.settings.selected_universe=i,cu(r,i),r.interface.buffer_search.value="",Dg(),r.view.focus(),QC())}),r.interface.eval_button.addEventListener("click",()=>{r.currentFile().candidate=r.view.state.doc.toString(),r.flashBackground("#404040",200)}),r.buttonElements.stop_buttons.forEach(i=>{i.addEventListener("click",()=>{r.setButtonHighlighting("stop",!0),r.isPlaying=!1,r.clock.stop()})}),r.interface.local_button.addEventListener("click",()=>r.changeModeFromInterface("local")),r.interface.global_button.addEventListener("click",()=>r.changeModeFromInterface("global")),r.interface.init_button.addEventListener("click",()=>r.changeModeFromInterface("init")),r.interface.note_button.addEventListener("click",()=>r.changeModeFromInterface("notes")),r.interface.font_family_selector.addEventListener("change",()=>{let i=r.interface.font_family_selector.value;console.log("Picking new font : "+i),r.settings.font=i,r.view.dispatch({effects:r.fontSize.reconfigure(ke.theme({"&":{fontSize:r.settings.font_size+"px"},".cm-content":{fontFamily:i,fontSize:r.settings.font_size+"px"},".cm-gutters":{fontSize:r.settings.font_size+"px"}}))})}),r.interface.font_size_input.addEventListener("input",()=>{let i=r.interface.font_size_input.value;r.settings.font_size=parseInt(i),r.view.dispatch({effects:r.fontSize.reconfigure(ke.theme({"&":{fontSize:r.settings.font_size+"px"},".cm-content":{fontFamily:r.settings.font,fontSize:r.settings.font_size+"px"},".cm-gutters":{fontSize:r.settings.font_size+"px"}}))})}),r.interface.settings_button.addEventListener("click",()=>{const i=document.getElementById("font-family");i&&(i.value=r.settings.font);const a=r.interface.dough_nudge_range;a.value=r.dough_nudge.toString();const s=document.getElementById("doughnumber");s.value=r.dough_nudge.toString(),r.settings.font_size===null&&(r.settings.font_size=12);const o=r.interface.font_size_input;o.value=r.settings.font_size.toString();const l=r.interface.line_numbers_checkbox;l.checked=r.settings.line_numbers;const c=r.interface.time_position_checkbox;c.checked=r.settings.time_position;const u=r.interface.tips_checkbox;u.checked=r.settings.tips;const p=r.interface.midi_clock_checkbox;p.checked=r.settings.send_clock;const m=r.interface.midi_channels_scripts;m.checked=r.settings.midi_channels_scripts;const _=r.interface.midi_clock_ppqn;_.value=r.settings.midi_clock_ppqn.toString();const E=r.interface.load_demo_songs;E.checked=r.settings.load_demo_songs;const R=r.interface.vim_mode_checkbox;R.checked=r.settings.vimMode;let w=document.getElementById("modal-settings"),k=document.getElementById("editor");w==null||w.classList.remove("invisible"),k==null||k.classList.add("invisible")}),r.interface.close_settings_button.addEventListener("click",()=>{let i=document.getElementById("modal-settings"),a=document.getElementById("editor");i==null||i.classList.add("invisible"),a==null||a.classList.remove("invisible");let s=r.interface.font_size_input.value;r.settings.font_size=parseInt(s),r.view.dispatch({effects:r.fontSize.reconfigure(ke.theme({"&":{fontSize:r.settings.font_size+"px"},".cm-content":{fontFamily:r.settings.font,fontSize:r.settings.font_size+"px"},".cm-gutters":{fontSize:r.settings.font_size+"px"}}))})}),r.interface.close_universes_button.addEventListener("click",()=>{lD(r),uu()}),r.interface.share_button.addEventListener("click",async()=>{r.currentFile().candidate=r.view.state.doc.toString(),r.currentFile().committed=r.view.state.doc.toString(),r.settings.saveApplicationToLocalStorage(r.universes,r.settings),await o9(r)}),r.interface.vim_mode_checkbox.addEventListener("change",()=>{let i=!!r.interface.vim_mode_checkbox.checked;r.settings.vimMode=i,r.view.dispatch({effects:r.vimModeCompartment.reconfigure(i?a1():[])})}),r.interface.line_numbers_checkbox.addEventListener("change",()=>{let a=!!r.interface.line_numbers_checkbox.checked;r.settings.line_numbers=a,r.view.dispatch({effects:r.withLineNumbers.reconfigure(a?[iy()]:[])})}),r.interface.time_position_checkbox.addEventListener("change",()=>{let i=document.getElementById("timeviewer"),a=!!r.interface.time_position_checkbox.checked;r.settings.time_position=a,a?i.classList.remove("hidden"):i.classList.add("hidden")}),r.interface.tips_checkbox.addEventListener("change",()=>{let i=!!r.interface.tips_checkbox.checked;r.settings.tips=i,r.view.dispatch({effects:r.hoveringCompartment.reconfigure(i?pI:[])})}),r.interface.completion_checkbox.addEventListener("change",()=>{let i=!!r.interface.completion_checkbox.checked;r.settings.completions=i,r.view.dispatch({effects:r.completionsCompartment.reconfigure(i?fI:[])})}),r.interface.midi_clock_checkbox.addEventListener("change",()=>{let i=!!r.interface.midi_clock_checkbox.checked;r.settings.send_clock=i}),r.interface.midi_channels_scripts.addEventListener("change",()=>{let i=!!r.interface.midi_channels_scripts.checked;r.settings.midi_channels_scripts=i}),r.interface.midi_clock_ppqn.addEventListener("change",()=>{let i=parseInt(r.interface.midi_clock_ppqn.value);r.settings.midi_clock_ppqn=i}),r.interface.load_demo_songs.addEventListener("change",()=>{let i=!!r.interface.load_demo_songs.checked;r.settings.load_demo_songs=i}),r.interface.universe_creator.addEventListener("submit",i=>{i.preventDefault();let s=new FormData(r.interface.universe_creator).get("universe");s&&s.length>2&&s.length<20&&(s=s.trim(),r.settings.selected_universe=s,r.selected_universe=s,cu(r,s),r.interface.buffer_search.value="",Dg(),r.view.focus())}),ja(r,r.universes[r.selected_universe.toString()].init),["introduction","interface","interaction","code","time","linear","cyclic","longform","sound","samples","synths","chaining","patterns","ziffers","midi","functions","lfos","probabilities","variables","synchronisation","mouse","shortcuts","about","bonus","oscilloscope"].forEach(i=>{let a="docs_"+i;document.getElementById(a).addEventListener("click",async()=>{a!=="docs_samples"?(r.currentDocumentationPane=i,Ug(r,t)):(console.log("Loading samples!"),await kI().then(()=>{r.docs=rI(r),r.currentDocumentationPane=i,Ug(r,t)}))})})},fK=r=>{Number.prototype.z0=function(e={}){return r.z0(this.valueOf().toString().split("").join(" "),e)},Number.prototype.z1=function(e={}){return r.z1(this.valueOf().toString().split("").join(" "),e)},Number.prototype.z2=function(e={}){return r.z2(this.valueOf().toString().split("").join(" "),e)},Number.prototype.z3=function(e={}){return r.z3(this.valueOf().toString().split("").join(" "),e)},Number.prototype.z4=function(e={}){return r.z4(this.valueOf().toString().split("").join(" "),e)},Number.prototype.z5=function(e={}){return r.z5(this.valueOf().toString().split("").join(" "),e)},Number.prototype.z6=function(e={}){return r.z6(this.valueOf().toString().split("").join(" "),e)},Number.prototype.z7=function(e={}){return r.z7(this.valueOf().toString().split("").join(" "),e)},Number.prototype.z8=function(e={}){return r.z8(this.valueOf().toString().split("").join(" "),e)},Number.prototype.z9=function(e={}){return r.z9(this.valueOf().toString().split("").join(" "),e)},Number.prototype.z10=function(e={}){return r.z10(this.valueOf().toString().split("").join(" "),e)},Number.prototype.z11=function(e={}){return r.z11(this.valueOf().toString().split("").join(" "),e)},Number.prototype.z12=function(e={}){return r.z12(this.valueOf().toString().split("").join(" "),e)},Number.prototype.z13=function(e={}){return r.z13(this.valueOf().toString().split("").join(" "),e)},Number.prototype.z14=function(e={}){return r.z14(this.valueOf().toString().split("").join(" "),e)},Number.prototype.z15=function(e={}){return r.z15(this.valueOf().toString().split("").join(" "),e)},Number.prototype.z16=function(e={}){return r.z16(this.valueOf().toString().split("").join(" "),e)},Number.prototype.midi=function(...e){return r.midi(this.valueOf(),...e)},Number.prototype.sound=function(e){return Number.isInteger(this.valueOf())?r.sound(e).note(this.valueOf()):r.sound(e).freq(this.valueOf())}},hK="modulepreload",mK=function(r){return"/"+r},Ov={},gK=function(e,t,n){if(!t||t.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(t.map(a=>{if(a=mK(a),a in Ov)return;Ov[a]=!0;const s=a.endsWith(".css"),o=s?'[rel="stylesheet"]':"";if(!!n)for(let u=i.length-1;u>=0;u--){const p=i[u];if(p.href===a&&(!s||p.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${a}"]${o}`))return;const c=document.createElement("link");if(c.rel=s?"stylesheet":hK,s||(c.as="script",c.crossOrigin=""),c.href=a,document.head.appendChild(c),s)return new Promise((u,p)=>{c.addEventListener("load",u),c.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${a}`)))})})).then(()=>e()).catch(a=>{const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=a,window.dispatchEvent(s),!s.defaultPrevented)throw a})};function _K(r={}){const{immediate:e=!1,onNeedRefresh:t,onOfflineReady:n,onRegistered:i,onRegisteredSW:a,onRegisterError:s}=r;let o,l;const c=async(p=!0)=>{await l};async function u(){if("serviceWorker"in navigator){const{Workbox:p}=await gK(()=>import("./workbox-window.prod.es5-a7b12eab.js"),[]);o=new p("/sw.js",{scope:"/",type:"classic"}),o.addEventListener("activated",m=>{(m.isUpdate||m.isExternal)&&window.location.reload()}),o.addEventListener("installed",m=>{m.isUpdate||n==null||n()}),o.register({immediate:e}).then(m=>{a?a("/sw.js",m):i==null||i(m)}).catch(m=>{s==null||s(m)})}}return l=u(),c}"serviceWorker"in navigator&&_K();class bK{constructor(){I(this,"settings",new a9);I(this,"universes",{});I(this,"selected_universe","Welcome");I(this,"fill",!1);I(this,"local_index",1);I(this,"editor_mode","global");I(this,"fontSize");I(this,"withLineNumbers");I(this,"vimModeCompartment");I(this,"hoveringCompartment");I(this,"completionsCompartment");I(this,"chosenLanguage");I(this,"dynamicPlugins");I(this,"currentDocumentationPane","introduction");I(this,"exampleCounter",0);I(this,"exampleIsPlaying",!1);I(this,"editorExtensions",[]);I(this,"userPlugins",[]);I(this,"state");I(this,"view");I(this,"selectedExample","");I(this,"docs",{});I(this,"_mouseX",0);I(this,"_mouseY",0);I(this,"show_error",!1);I(this,"buttonElements",{});I(this,"interface",{});I(this,"blinkTimeouts",{});I(this,"osc",{enabled:!1,color:"#fdba74",thickness:4,refresh:1,fftSize:1024,orientation:"horizontal",offsetX:0,offsetY:0,mode:"scope",size:1});I(this,"api");I(this,"audioContext");I(this,"clock");I(this,"dough_nudge",20);I(this,"manualPlay",!1);I(this,"isPlaying",!1);I(this,"hydra_backend");I(this,"hydra");I(this,"updateKnownUniversesView",()=>{let e=document.getElementById("ui-known-universe-item-template");if(!e){console.warn("Missing template #ui-known-universe-item-template");return}let t=document.getElementById("existing-universes");if(!t){console.warn("Missing element #existing-universes");return}let n=document.createElement("ul");n.className="lg:h-80 lg:text-normal text-sm h-auto lg:w-80 w-auto lg:pb-2 lg:pt-2 overflow-y-scroll text-white lg:mb-4 border rounded-lg bg-neutral-800",n.append(...Object.keys(this.universes).map(i=>{var o,l;let a=e.content.cloneNode(!0),s=window;return a.querySelector(".universe-name").textContent=i,(o=a.querySelector(".load-universe"))==null||o.addEventListener("click",()=>s._loadUniverseFromInterface(i)),(l=a.querySelector(".delete-universe"))==null||l.addEventListener("click",()=>s._deleteUniverseFromInterface(i)),a})),t.innerHTML="",t.append(n)});this.initializeElements(),this.initializeButtonGroups(),this.setCanvas(this.interface.feedback),this.setCanvas(this.interface.scope);try{this.loadHydraSynthAsync()}catch(t){console.log("Couldn't start Hydra: ",t)}this.universes={...this.settings.universes},s9(this),this.audioContext=new AudioContext({latencyHint:"playback"}),this.clock=new sQ(this,this.audioContext),this.api=new EV(this),cK(this.api),OV(this.api),fK(this.api),Object.entries(this.api).forEach(([t,n])=>{globalThis[t]=n}),Object.entries(lK).forEach(([t,n])=>{globalThis[t]=n}),Object.entries(hV).forEach(([t,n])=>{globalThis[t]=n}),(async()=>{await kI()})(),this.docs=rI(this),RG(this),wG(this),pK(this),Cv(this),rQ(this),dk(this.interface.scope,this),ja(this,this.universes[this.selected_universe.toString()].init),this.changeModeFromInterface("global"),l9(this)}getBuffer(e){const t=this.universes[this.selected_universe.toString()];return e==="locals"?t[e][this.local_index]:t[e]}get note_buffer(){return this.getBuffer("notes")}get example_buffer(){return this.getBuffer("example")}get global_buffer(){return this.getBuffer("global")}get init_buffer(){return this.getBuffer("init")}get local_buffer(){return this.getBuffer("locals")}changeToLocalBuffer(e){const t=document.querySelectorAll('[id^="tab-"]'),n=t[e];n.classList.add("bg-orange-300");for(let a=0;a{t.forEach(a=>{let s=a.children[0];s.classList.contains("text-orange-300")&&(s.classList.remove("text-orange-300"),a.classList.remove("text-orange-300"))}),i.children[0].classList.remove("text-white"),i.children[0].classList.add("text-orange-300"),i.classList.add("text-orange-300"),i.classList.add("fill-orange-300")};switch(e){case"local":this.interface.local_script_tabs.classList.contains("hidden")&&this.interface.local_script_tabs.classList.remove("hidden"),this.editor_mode="local",this.local_index=0,document.getElementById("editor").style.height="calc(100% - 100px)",this.changeToLocalBuffer(this.local_index),n(this.interface.local_button);break;case"global":this.interface.local_script_tabs.classList.contains("hidden")||this.interface.local_script_tabs.classList.add("hidden"),this.editor_mode="global",document.getElementById("editor").style.height="100%",n(this.interface.global_button);break;case"init":this.interface.local_script_tabs.classList.contains("hidden")||this.interface.local_script_tabs.classList.add("hidden"),this.editor_mode="init",n(this.interface.init_button);break;case"notes":this.interface.local_script_tabs.classList.contains("hidden")||this.interface.local_script_tabs.classList.add("hidden"),this.editor_mode="notes",n(this.interface.note_button);break}this.view.dispatch({effects:this.chosenLanguage.reconfigure(this.editor_mode=="notes"?[y6()]:[x_()])}),this.updateEditorView()}setButtonHighlighting(e,t){document.getElementById("play-label").textContent=e!=="pause"?"Pause":"Play",e!=="pause"?(document.getElementById("pause-icon").classList.remove("hidden"),document.getElementById("play-icon").classList.add("hidden")):(document.getElementById("pause-icon").classList.add("hidden"),document.getElementById("play-icon").classList.remove("hidden")),e==="stop"&&(this.isPlaying==!1,document.getElementById("play-label").textContent="Play",document.getElementById("pause-icon").classList.add("hidden"),document.getElementById("play-icon").classList.remove("hidden")),this.flashBackground("#404040",200);const n=['[id^="play-button-"]','[id^="clear-button-"]','[id^="stop-button-"]'];let i;switch(e){case"play":i=0;break;case"pause":i=1;break;case"clear":i=2;break;case"stop":i=3;break}document.querySelectorAll(n[i]).forEach(a=>{t&&a.children[0].classList.add("animate-pulse")}),document.querySelectorAll(n.filter((a,s)=>s!=i).join(",")).forEach(a=>{a.children[0].classList.remove("animate-pulse"),a.children[1].classList.remove("animate-pulse")})}unfocusPlayButtons(){document.querySelectorAll('[id^="play-button-"]').forEach(e=>{e.children[0].classList.remove("fill-orange-300"),e.children[0].classList.remove("animate-pulse")})}updateEditorView(){this.view.dispatch({changes:{from:0,to:this.view.state.doc.toString().length,insert:this.currentFile().candidate}})}currentFile(){switch(this.editor_mode){case"global":return this.global_buffer;case"local":return this.local_buffer;case"init":return this.init_buffer;case"notes":return this.note_buffer}}flashBackground(e,t){const n=this.view.dom,i=n.getElementsByClassName("cm-gutter");n.classList.add("fluid-bg-transition"),Array.from(i).forEach(a=>a.classList.add("fluid-bg-transition")),n.style.backgroundColor=e,Array.from(i).forEach(a=>a.style.backgroundColor=e),setTimeout(()=>{n.style.backgroundColor="",Array.from(i).forEach(a=>a.style.backgroundColor=""),n.classList.remove("fluid-bg-transition"),Array.from(i).forEach(a=>a.classList.remove("fluid-bg-transition"))},t)}initializeElements(){for(const[e,t]of Object.entries(d9))this.interface[e]=document.getElementById(t)}initializeButtonGroups(){for(const[e,t]of Object.entries(p9))this.buttonElements[e]=t.map(n=>document.getElementById(n))}loadHydraSynthAsync(){var e=document.createElement("script");e.src="https://unpkg.com/hydra-synth",e.async=!0,e.onload=()=>{console.log("Hydra loaded successfully"),this.initializeHydra()},e.onerror=function(){console.error("Error loading Hydra script")},document.head.appendChild(e)}initializeHydra(){this.hydra_backend=new Hydra({canvas:this.interface.hydra_canvas,detectAudio:!1,enableStreamCapture:!1}),this.hydra=this.hydra_backend.synth}setCanvas(e){if(!e)return;const t=e.getContext("2d"),n=window.devicePixelRatio||1;e.width=window.innerWidth*n,e.height=window.innerHeight*n,t&&t.scale(n,n)}}let SK=new bK;dK(SK,window,!1); diff --git a/assets/index-70b0bd84.js.gz b/assets/index-fb9d67fc.js.gz similarity index 99% rename from assets/index-70b0bd84.js.gz rename to assets/index-fb9d67fc.js.gz index a58186b520d337973cf4513fde72bae993651cff..2728cfa3c83920e2060b426b3404e726d48b4b99 100644 GIT binary patch delta 2749 zcmV;u3PSb$(JhA3Er5gpgaU*Egam{Iga(8Mgb0KQvw(2ly= zE;D&?^z2!%4Kc4iR&jKSe5_yhEuWeu#DVuazG=5J8c&2XC#etMt7^y7E{8pBLsXMn z3D>&NFF3%m$LF8z4yHeeZYBzUQW6{yxL(a!{e1S` zeh%o|AMK2he;NP_73N$ubFNd@b=4~BeYJlu8%VN0*>1<9&;?0Vr(Kl>yVGa;qebyJ zuZGp}^_@`frt`LX_N>~TP8w@4KgRVDX+VhLcurzr=Vir|jd=LCYgg7b-g29727ANZ z*BjMoZ|(Z_-um;SDbi{zyos`4G@2zh_x9#)PH8r6e>(Ym_)K}DzC9Z65I8KI)s(z8HfJ`bSq6(VVS1NAsc(z`g##)$69W)jwF@3&PZ$ejT7DX=Cr~R{X8A zHr#toe|+Gb>yz&zCP`!ut{;uWE0uV-!Dzzue>XepG`QX+{@q>cHUsDTod2c&AUN_} zQg;PP{q1&hS)jkdv@TtKyLURdR1GH8U%hrTAc3bE?c9Db+}-Ki>Goz50?n?^TC#T9 z+qz0@+kD%ZFhfGx!EiL8Uawqf-x5c)_|DVb0s2!oJv!P6G2ES2ELbQU!FT)BTtF?Z ze`{gvKy19#j9Y;+4jk-lbUM{d^X^^sg-;S1sXpKTdML3_m#7`bW?g<;o&GiVTDsY< zdiurFYVTk_YAz4<^oX9mXGC*qrwtz7(qTPaKCHQ(W(LW-@jZj#CTG2$?=K$!-<@5U z)|eI$;YCC5Kc-esbPa@RQG7U@E%zRUe^Sj zCD%Bu-87oWmFx3cd78bUI>B65C&C(bP-H09w%!kK>K*l=p80&cu5tZ%_sJLgkB^?5 z@{7KxU-bC1^TL*7cRnhZogor<Xu&z&(TDEUu(d;9fui~V&SCFCiv1F_No!l z$T55WY1o}rWaI&Rq5@$H%-p9$A?e)Zxqaq zWPsd+VKl1Zy2}~d>D<3^<$ePyohkn1t@|4g8_rFCot@SCM?l8C{@Ubd!iQcZ=_J;O8EG#4$@P?pr6BqDq}o23qR7(&PKLr# zAr}ws9TPG)fF|koZ8L?-L9K7!@i%_y3w~s~^P)HD&F>NNdDwZ_A;3K5V!@kFuUvU5ZmT0%kEgu}JKC2@wh9{yfv&iUYckBWC$-L(aJC91 zQ*iW`Ri7~8@u+&zJ7H{L<>Qyc-_RVG6_epf(>qn4?hw3tcdP!LN{B*4!n^D*CB)$_ z8w&O@|FwGM?lOvQ4LHm8TKCp{4sqbBwsie^xE%Bsm*}<%Ga$^3GqVNjF0twg4qGZG zJ(7zy!+TxzzQnu)Qu6h*&eoSZw+bXn)mBx(yRI#CX*jtw*d-L+d3|YoB*oZ(A^hM2 zbTMMiCZdV-G>J$NmSIfX@CYRJly%sL>{jt&e}{-!?~s?VPY-O$aJMQtY}n10s<#R! z6U|nPMBPJ<`rF*ITm&~{da7BYoPB3opCUmEN!oFO+w7Ek(ARRof zAJ zR)K+R#jd-YqD#WIlXve<5VThh`SApM@P31KIEqgs)qotbiZ*soDaQqW5TKjRA`nd`$XkiHTNqSi^Yv1*T zoqNc65!3wEXZUxsG6K64biP~M`0|3rmvL0=4qo%l>~lr%-ClFTep9bHiPOW$-1SD% zs4+24PQ#4Jry5XQD*Ha~1VW0-@7~dlPy>1Q?!FYAVT@TYn$sRfx|fc+3SThp_frP-q7Wj^ScUm0gjhyyb3EYXWiVK zeWK~P^^Ce)*RI_9CoinaGk*5EnwMW`RW41~9K_a;OUFZk;nDOGo@XDZm&LpaC=^z; z=Hb85!;JX$X7eeXo-a>NIe(V{y$U!1_?J4p3Sj|^mz=!{IRevqm)E@tHh)v_ZA|0O zrqr0_sS9W9`diIpNpc~cYIGFYoZhT9r`N7^N1Ru5OuuS*t9jM#NM0pfwCp`M*N#y1 zP`=d~k0k9e>Kl(;Uy@<{s)2 zo5LoWJz^~_4>uLUG-m*-jhBqR3Q|+Y(^flO>EZH?>(gp7?M%A2!t7!?wo_h6LI8q9 zt#TjN(Ztb1pZGHx_n50mV@J@2o7Dq1D(Ek2^ttsm>S{N_Clhi#jvtS%U3+r6Sm6FE zIvSTTzY19$3nc}sX>S@=hTF1q*~nX?AbD(dC9i2`Buu^(WVffk3daT+Ut%cxd)j;T zNQ{ENDofxCqbz|hjJ5j;3`+ zm-WXAk132?yb>HS8ZQq6&eL+p!Nzq1H^-k3v8J2d&#Eg|2JBfT@djMek28Unt;h-& zAEyGNzZLhi%Uf~tv(B_Xh=(pBpN7|moY&@OuJs_*m*dC^M*<|Smn_K&Pz!?3!|}9p z4=#jU)3=Ao3fc(*7i+g;(+Zw30sof^1q((AQS;)q%W7QaQMXYA3#4NRjbpk8P`@Jp D4vCx= delta 2695 zcmV;23V8K~(k=bbEr5gpgaU*Egam{Iga(8Mgb0KQvb{Gm>kPLO&Lus%(eYQVZ6o&I^SRG&A z31x0NZ>wj|s_p5dF#_{rTo#cAgy4%lX458*&xg;He-rB4qwy}0VcI8uu(vyZ_;Z8U z+1~!a0Fehoy?b1)a%0k88yrpd*LvF(8{aqfIes4aNn2xMmmU$-+Qv3XRQt>maSq_4 zzB%oS4d|eMbafG_*{V}BFN*xz>mOXbZhBk&gY~^2L*41uacPn*_Rem_-#TlPKJzzamvkyIDv_MrdxFWK~+%Wrp2 zcdF;zzn*N8Aok$;(MX(8iFF%{CR}#2vrdESe_i6=-L-BraK6uJU-}P%|K25aSD@72 zZa0?&`YTN9(&e{%r;|(7U{d|nYX<=mc&gFP?H9w{oz9(ZZ#ECm?E0)FYp1=ftHiC% zx1EVDB%~b-M-%Gx%9Zvl@lT8IJnbEzKZVnyqn!}C-D!n@g?bTuw_nZ0(c-$6!4AZ< ze_PFX6DXU&!QMuvQ{6Q0-c?`tB%zV&WBsp(5(0IJ+HpwM<+s)8UvsaeoBgV%Up%e$ z4)&wM@?cMo=;?b#G^cIa;NdMD*3;#~n(Jw1kh~k;GZ=1i*8BPX@&WMO*@bD1X#o*l zH1z&sYV|~yKByLjg~P{k?@_4D)&o?mlWf)cGGAX zS02xAI5rYo&RdsL2aQ}(t1C^s5`Rc>|~fLYrZStJpPs-e*yh7Y^f5&5}&&f8&{% zi{9k)w4T!|TGv+#_^Rr3lQV;idz@X5M2S!nuI9$L0Ln}~G~!=FtDWi@$=mVzyLWZ> zC%yZJ~55=kMlsMX;0etv+@9F+-D}}FI+Mpru)<(>f2i+k4Vbs%FvC(ToD|vw7rMhy}kFQNwxO)@JauTg4vM_kee`!MpayQ zIfFZ$`&X{qZ$PCJ#J{|Cf8%AhxyMHVw%@Soym|LdDHVsEQPo@98jfD=f4`*t9;W&Y zz50-zfg?!O4Cx@QS(8N(dfg3TK*oCc6z`$P*@n`n!&weLgoh0 zB-Flbrf|9S?K}R)FMYv}UTk+>^d`Lp(g){n?qYBcBM{h;FD~!T&w5Y$53gK#*m>9? zz&z#}!JAL7TzM+qsv}vCr@aaL*SzRIm9FmfziS}Wf2lsV;rv3;rk^?|-M5cJU9Px_ zYckBWC$*}VdA15A5MK0`Ri7~8@u+&zJ7H{LotLh*3LYgUCB)$_+XwbB|FwGM?lOvQ z4LG^>TKCp{j%?s!wsie^xE$0Lm+`g=GayWfGqVNjF0twg4qGY}J#vaR!+TxzzQnu) zQu6h*PSTe|w+bW{u~t>MyDlkoX*jtw*d-L+d3|YoBsG_Qw+b5?Ro92?P4QxXhlpA4 zke9Jf4{XYCw<0|+}3JB>to%O*T6HEZwf#klam*lW9MD!LAm&2N{ybbGn zC{C(OsV0?lI!i%_iEfdY)24x`;YjXuUN zf;`0%n038nVLZnnt|^SE4svRa!RU0Xj^t2i?|FP$9bC0E_Y|S}XD8jb%J*YLX7@hV z!W(}%?IhUmN-Trma-U?{KKV?nquGU9{{yH`k6( z>rlSc8jmOM-i;q?Gmki~29)YhCqlf&-7e7k`qLq5Rzt_t3Z@u$NluwId?dT$@#Y@t z%9_I_h&^I0Ee|&p!Zc?9tBseHz6w%PhtXC$UFqTSjqB5DGVM&dx5DgV7PeDfNJ0RD zM6Gfk*FnV5F`xJ|8uyrsNMlFPhMUy`H!A2aYV^7FHtK3O!Y30_JdPiau3dX_x>(@; zEBY6gI=>289qS_nt7&f53#13-Os8kR|f1^Ch-Pb%8wI(_Qp5* z!_8ShU7D&m$Kyvb%z6Oyb{;xs0GH3m3K;}0@gPN)?8pj70^F^aHOUH43trE|@w9Uf zE`(glw~)yS+6e;JXt!+B3Z5|v!Fl1>MKmt_sQ#A=1q(*ES_KQFV+h5Pthh(NBLD!T Bf4l$y diff --git a/index.html b/index.html index 6112cce..dcba5e2 100644 --- a/index.html +++ b/index.html @@ -14,7 +14,7 @@ - +