(function(i){var e="0.4.2",j="hasOwnProperty",b=/[\.\/]/,a="*",g=function(){},f=function(m,l){return m-l},d,h,k={n:{}},c=function(m,C){m=String(m);var v=k,s=h,w=Array.prototype.slice.call(arguments,2),y=c.listeners(m),x=0,u=false,p,o=[],t={},q=[],n=d,A=[];d=m;h=0;for(var r=0,B=y.length;r';a8=a7.firstChild;a8.style.behavior="url(#default#VML)";if(!(a8&&typeof a8.adj=="object")){return(bi.type=bn)}a7=null}bi.svg=!(bi.vml=bi.type=="VML");bi._Paper=bJ;bi.fn=ao=bJ.prototype=bi.prototype;bi._id=0;bi._oid=0;bi.is=function(d,b){b=aj.call(b);if(b=="finite"){return !B[bw](+d)}if(b=="array"){return d instanceof Array}return(b=="null"&&d===null)||(b==typeof d&&d!==null)||(b=="object"&&d===Object(d))||(b=="array"&&Array.isArray&&Array.isArray(d))||aM.call(d).slice(8,-1).toLowerCase()==b};function bl(g){if(typeof g=="function"||Object(g)!==g){return g}var d=new g.constructor;for(var b in g){if(g[bw](b)){d[b]=bl(g[b])}}return d}bi.angle=function(E,S,g,R,d,i){if(d==null){var b=E-g,bO=S-R;if(!b&&!bO){return 0}return(180+aI.atan2(-bO,-b)*180/ag+360)%360}else{return bi.angle(E,S,d,i)-bi.angle(g,R,d,i)}};bi.rad=function(b){return b%360*ag/180};bi.deg=function(b){return b*180/ag%360};bi.snapTo=function(d,E,b){b=bi.is(b,"finite")?b:10;if(bi.is(d,u)){var g=d.length;while(g--){if(ak(d[g]-E)<=b){return d[g]}}}else{d=+d;var R=E%d;if(Rd-b){return E-R+d}}return E};var aQ=bi.createUUID=(function(b,d){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(b,d).toUpperCase()}})(/[xy]/g,function(g){var d=aI.random()*16|0,b=g=="x"?d:(d&3|8);return b.toString(16)});bi.setWindow=function(b){bc("raphael.setWindow",bi,a5.win,b);a5.win=b;a5.doc=a5.win.document;if(bi._engine.initWin){bi._engine.initWin(a5.win)}};var J=function(g){if(bi.vml){var b=/^\s+|\s+$/g;var R;try{var S=new ActiveXObject("htmlfile");S.write("");S.close();R=S.body}catch(bO){R=createPopup().document.body}var d=R.createTextRange();J=H(function(i){try{R.style.color=k(i).replace(b,bn);var bP=d.queryCommandValue("ForeColor");bP=((bP&255)<<16)|(bP&65280)|((bP&16711680)>>>16);return"#"+("000000"+bP.toString(16)).slice(-6)}catch(bQ){return"none"}})}else{var E=a5.doc.createElement("i");E.title="Rapha\xebl Colour Picker";E.style.display="none";a5.doc.body.appendChild(E);J=H(function(i){E.style.color=i;return a5.doc.defaultView.getComputedStyle(E,bn).getPropertyValue("color")})}return J(g)},az=function(){return"hsb("+[this.h,this.s,this.b]+")"},bm=function(){return"hsl("+[this.h,this.s,this.l]+")"},w=function(){return this.hex},G=function(R,E,d){if(E==null&&bi.is(R,"object")&&"r" in R&&"g" in R&&"b" in R){d=R.b;E=R.g;R=R.r}if(E==null&&bi.is(R,a)){var i=bi.getRGB(R);R=i.r;E=i.g;d=i.b}if(R>1||E>1||d>1){R/=255;E/=255;d/=255}return[R,E,d]},N=function(R,E,d,S){R*=255;E*=255;d*=255;var i={r:R,g:E,b:d,hex:bi.rgb(R,E,d),toString:w};bi.is(S,"finite")&&(i.opacity=S);return i};bi.color=function(b){var d;if(bi.is(b,"object")&&"h" in b&&"s" in b&&"b" in b){d=bi.hsb2rgb(b);b.r=d.r;b.g=d.g;b.b=d.b;b.hex=d.hex}else{if(bi.is(b,"object")&&"h" in b&&"s" in b&&"l" in b){d=bi.hsl2rgb(b);b.r=d.r;b.g=d.g;b.b=d.b;b.hex=d.hex}else{if(bi.is(b,"string")){b=bi.getRGB(b)}if(bi.is(b,"object")&&"r" in b&&"g" in b&&"b" in b){d=bi.rgb2hsl(b);b.h=d.h;b.s=d.s;b.l=d.l;d=bi.rgb2hsb(b);b.v=d.b}else{b={hex:"none"};b.r=b.g=b.b=b.h=b.s=b.v=b.l=-1}}}b.toString=w;return b};bi.hsb2rgb=function(S,bQ,bO,i){if(this.is(S,"object")&&"h" in S&&"s" in S&&"b" in S){bO=S.b;bQ=S.s;S=S.h;i=S.o}S*=360;var E,bP,d,g,b;S=(S%360)/60;b=bO*bQ;g=b*(1-ak(S%2-1));E=bP=d=bO-b;S=~~S;E+=[b,g,0,0,g,b][S];bP+=[g,b,b,g,0,0][S];d+=[0,0,g,b,b,g][S];return N(E,bP,d,i)};bi.hsl2rgb=function(bO,bQ,E,i){if(this.is(bO,"object")&&"h" in bO&&"s" in bO&&"l" in bO){E=bO.l;bQ=bO.s;bO=bO.h}if(bO>1||bQ>1||E>1){bO/=360;bQ/=100;E/=100}bO*=360;var S,bP,d,g,b;bO=(bO%360)/60;b=2*bQ*(E<0.5?E:1-E);g=b*(1-ak(bO%2-1));S=bP=d=E-b/2;bO=~~bO;S+=[b,g,0,0,g,b][bO];bP+=[g,b,b,g,0,0][bO];d+=[0,0,g,b,b,g][bO];return N(S,bP,d,i)};bi.rgb2hsb=function(bP,bO,d){d=G(bP,bO,d);bP=d[0];bO=d[1];d=d[2];var R,E,i,bQ;i=bI(bP,bO,d);bQ=i-ai(bP,bO,d);R=(bQ==0?null:i==bP?(bO-d)/bQ:i==bO?(d-bP)/bQ+2:(bP-bO)/bQ+4);R=((R+360)%6)*60/360;E=bQ==0?0:bQ/i;return{h:R,s:E,b:i,toString:az}};bi.rgb2hsl=function(d,bO,bR){bR=G(d,bO,bR);d=bR[0];bO=bR[1];bR=bR[2];var bS,R,bQ,bP,E,i;bP=bI(d,bO,bR);E=ai(d,bO,bR);i=bP-E;bS=(i==0?null:bP==d?(bO-bR)/i:bP==bO?(bR-d)/i+2:(d-bO)/i+4);bS=((bS+360)%6)*60/360;bQ=(bP+E)/2;R=(i==0?0:bQ<0.5?i/(2*bQ):i/(2-2*bQ));return{h:bS,s:R,l:bQ,toString:bm}};bi._path2string=function(){return this.join(",").replace(aN,"$1")};function c(E,g){for(var b=0,d=E.length;b=1000&&delete R[bO.shift()];bO.push(S);R[S]=i[bs](d,E);return b?b(R[S]):R[S]}return g}var D=bi._preload=function(g,d){var b=a5.doc.createElement("img");b.style.cssText="position:absolute;left:-9999em;top:-9999em";b.onload=function(){d.call(this);this.onload=null;a5.doc.body.removeChild(this)};b.onerror=function(){a5.doc.body.removeChild(this)};a5.doc.body.appendChild(b);b.src=g};function h(){return this.hex}bi.getRGB=H(function(b){if(!b||!!((b=k(b)).indexOf("-")+1)){return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:h}}if(b=="none"){return{r:-1,g:-1,b:-1,hex:"none",toString:h}}!(ax[bw](b.toLowerCase().substring(0,2))||b.charAt()=="#")&&(b=J(b));var E,d,g,S,i,bP,bO,R=b.match(Z);if(R){if(R[2]){S=bK(R[2].substring(5),16);g=bK(R[2].substring(3,5),16);d=bK(R[2].substring(1,3),16)}if(R[3]){S=bK((bP=R[3].charAt(3))+bP,16);g=bK((bP=R[3].charAt(2))+bP,16);d=bK((bP=R[3].charAt(1))+bP,16)}if(R[4]){bO=R[4][l](bf);d=bM(bO[0]);bO[0].slice(-1)=="%"&&(d*=2.55);g=bM(bO[1]);bO[1].slice(-1)=="%"&&(g*=2.55);S=bM(bO[2]);bO[2].slice(-1)=="%"&&(S*=2.55);R[1].toLowerCase().slice(0,4)=="rgba"&&(i=bM(bO[3]));
bO[3]&&bO[3].slice(-1)=="%"&&(i/=100)}if(R[5]){bO=R[5][l](bf);d=bM(bO[0]);bO[0].slice(-1)=="%"&&(d*=2.55);g=bM(bO[1]);bO[1].slice(-1)=="%"&&(g*=2.55);S=bM(bO[2]);bO[2].slice(-1)=="%"&&(S*=2.55);(bO[0].slice(-3)=="deg"||bO[0].slice(-1)=="\xb0")&&(d/=360);R[1].toLowerCase().slice(0,4)=="hsba"&&(i=bM(bO[3]));bO[3]&&bO[3].slice(-1)=="%"&&(i/=100);return bi.hsb2rgb(d,g,S,i)}if(R[6]){bO=R[6][l](bf);d=bM(bO[0]);bO[0].slice(-1)=="%"&&(d*=2.55);g=bM(bO[1]);bO[1].slice(-1)=="%"&&(g*=2.55);S=bM(bO[2]);bO[2].slice(-1)=="%"&&(S*=2.55);(bO[0].slice(-3)=="deg"||bO[0].slice(-1)=="\xb0")&&(d/=360);R[1].toLowerCase().slice(0,4)=="hsla"&&(i=bM(bO[3]));bO[3]&&bO[3].slice(-1)=="%"&&(i/=100);return bi.hsl2rgb(d,g,S,i)}R={r:d,g:g,b:S,toString:h};R.hex="#"+(16777216|S|(g<<8)|(d<<16)).toString(16).slice(1);bi.is(i,"finite")&&(R.opacity=i);return R}return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:h}},bi);bi.hsb=H(function(i,g,d){return bi.hsb2rgb(i,g,d).hex});bi.hsl=H(function(g,d,b){return bi.hsl2rgb(g,d,b).hex});bi.rgb=H(function(E,i,d){return"#"+(16777216|d|(i<<8)|(E<<16)).toString(16).slice(1)});bi.getColor=function(d){var g=this.getColor.start=this.getColor.start||{h:0,s:1,b:d||0.75},b=this.hsb2rgb(g.h,g.s,g.b);g.h+=0.075;if(g.h>1){g.h=0;g.s-=0.2;g.s<=0&&(this.getColor.start={h:0,s:1,b:g.b})}return b.hex};bi.getColor.reset=function(){delete this.start};function am(E,bO){var S=[];for(var g=0,b=E.length;b-2*!bO>g;g+=2){var R=[{x:+E[g-2],y:+E[g-1]},{x:+E[g],y:+E[g+1]},{x:+E[g+2],y:+E[g+3]},{x:+E[g+4],y:+E[g+5]}];if(bO){if(!g){R[0]={x:+E[b-2],y:+E[b-1]}}else{if(b-4==g){R[3]={x:+E[0],y:+E[1]}}else{if(b-2==g){R[2]={x:+E[0],y:+E[1]};R[3]={x:+E[2],y:+E[3]}}}}}else{if(b-4==g){R[3]=R[2]}else{if(!g){R[0]={x:+E[g],y:+E[g+1]}}}}S.push(["C",(-R[0].x+6*R[1].x+R[2].x)/6,(-R[0].y+6*R[1].y+R[2].y)/6,(R[1].x+6*R[2].x-R[3].x)/6,(R[1].y+6*R[2].y-R[3].y)/6,R[2].x,R[2].y])}return S}bi.parsePathString=function(b){if(!b){return null}var g=aR(b);if(g.arr){return aY(g.arr)}var i={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},d=[];if(bi.is(b,u)&&bi.is(b[0],u)){d=aY(b)}if(!d.length){k(b).replace(bg,function(R,E,bP){var bO=[],S=E.toLowerCase();bP.replace(ap,function(bR,bQ){bQ&&bO.push(+bQ)});if(S=="m"&&bO.length>2){d.push([E][av](bO.splice(0,2)));S="l";E=E=="m"?"l":"L"}if(S=="r"){d.push([E][av](bO))}else{while(bO.length>=i[S]){d.push([E][av](bO.splice(0,i[S])));if(!i[S]){break}}}})}d.toString=bi._path2string;g.arr=aY(d);return d};bi.parseTransformString=H(function(d){if(!d){return null}var g={r:3,s:4,t:2,m:6},b=[];if(bi.is(d,u)&&bi.is(d[0],u)){b=aY(d)}if(!b.length){k(d).replace(ac,function(E,i,bO){var S=[],R=aj.call(i);bO.replace(ap,function(bQ,bP){bP&&S.push(+bP)});b.push([i][av](S))})}b.toString=bi._path2string;return b});var aR=function(d){var b=aR.ps=aR.ps||{};if(b[d]){b[d].sleep=1}else{b[d]={sleep:1}}setTimeout(function(){for(var g in b){if(b[bw](g)&&g!=d){b[g].sleep--;!b[g].sleep&&delete b[g]}}});return b[d]};bi.findDotsAtSegment=function(d,b,b5,b3,S,E,bQ,bO,bY){var bV=1-bY,b0=aS(bV,3),b1=aS(bV,2),bS=bY*bY,bP=bS*bY,bU=b0*d+b1*3*bY*b5+bV*3*bY*bY*S+bP*bQ,bR=b0*b+b1*3*bY*b3+bV*3*bY*bY*E+bP*bO,bZ=d+2*bY*(b5-d)+bS*(S-2*b5+d),bX=b+2*bY*(b3-b)+bS*(E-2*b3+b),b4=b5+2*bY*(S-b5)+bS*(bQ-2*S+b5),b2=b3+2*bY*(E-b3)+bS*(bO-2*E+b3),bW=bV*d+bY*b5,bT=bV*b+bY*b3,i=bV*S+bY*bQ,g=bV*E+bY*bO,R=(90-aI.atan2(bZ-b4,bX-b2)*180/ag);(bZ>b4||bX=d.x&&b<=d.x2&&g>=d.y&&g<=d.y2};bi.isBBoxIntersect=function(g,d){var b=bi.isPointInsideBBox;return b(d,g.x,g.y)||b(d,g.x2,g.y)||b(d,g.x,g.y2)||b(d,g.x2,g.y2)||b(g,d.x,d.y)||b(g,d.x2,d.y)||b(g,d.x,d.y2)||b(g,d.x2,d.y2)||(g.xd.x||d.xg.x)&&(g.yd.y||d.yg.y)};function aC(b,S,R,E,i){var g=-3*S+9*R-9*E+3*i,d=b*g+6*S-12*R+6*E;return b*d-3*S+3*R}function bb(bZ,R,bY,g,bX,d,bU,b,bR){if(bR==null){bR=1}bR=bR>1?1:bR<0?0:bR;var bS=bR/2,bT=12,bO=[-0.1252,0.1252,-0.3678,0.3678,-0.5873,0.5873,-0.7699,0.7699,-0.9041,0.9041,-0.9816,0.9816],bW=[0.2491,0.2491,0.2335,0.2335,0.2032,0.2032,0.1601,0.1601,0.1069,0.1069,0.0472,0.0472],E=0;for(var bV=0;bVS){i/=2;R+=(EbI(b,bV)||bI(bT,bR)bI(bQ,bP)){return}var bO=(i*bR-bT*g)*(b-bV)-(i-g)*(b*bP-bQ*bV),S=(i*bR-bT*g)*(bQ-bP)-(bT-bR)*(b*bP-bQ*bV),E=(i-g)*(bQ-bP)-(bT-bR)*(b-bV);if(!E){return}var bU=bO/E,bS=S/E,R=+bU.toFixed(2),d=+bS.toFixed(2);if(R<+ai(i,g).toFixed(2)||R>+bI(i,g).toFixed(2)||R<+ai(b,bV).toFixed(2)||R>+bI(b,bV).toFixed(2)||d<+ai(bT,bR).toFixed(2)||d>+bI(bT,bR).toFixed(2)||d<+ai(bQ,bP).toFixed(2)||d>+bI(bQ,bP).toFixed(2)){return}return{x:bU,y:bS}}function aV(d,b){return aP(d,b)}function aL(d,b){return aP(d,b,1)}function aP(b5,b4,b3){var E=bi.bezierBBox(b5),d=bi.bezierBBox(b4);if(!bi.isBBoxIntersect(E,d)){return b3?0:[]}var bY=bb.apply(0,b5),bX=bb.apply(0,b4),bP=bI(~~(bY/5),1),bO=bI(~~(bX/5),1),bV=[],bU=[],g={},b6=b3?0:[];for(var b0=0;b0=0&&bR<=1.001&&bQ>=0&&bQ<=1.001){if(b3){b6++}else{b6.push({x:R.x,y:R.y,t1:ai(bR,1),t2:ai(bQ,1)})}}}}}return b6}bi.pathIntersection=function(d,b){return bE(d,b)};bi.pathIntersectionNumber=function(d,b){return bE(d,b,1)};function bE(g,b,bZ){g=bi._path2curve(g);b=bi._path2curve(b);var bX,S,bW,E,bU,bO,d,bR,b3,b2,b4=bZ?0:[];for(var bV=0,bP=g.length;bV1){ck=aI.sqrt(ck);b4=ck*b4;b2=ck*b2}var g=b4*b4,cd=b2*b2,cf=(bQ==E?-1:1)*aI.sqrt(ak((g*cd-g*b9*b9-cd*ca*ca)/(g*b9*b9+cd*ca*ca))),bZ=cf*b4*b9/b2+(bV+bU)/2,bY=cf*-b2*ca/b4+(cq+cp)/2,bP=aI.asin(((cq-bY)/b2).toFixed(9)),bO=aI.asin(((cp-bY)/b2).toFixed(9));bP=bVbO){bP=bP-ag*2}if(!E&&bO>bP){bO=bO-ag*2}}else{bP=bX[0];bO=bX[1];bZ=bX[2];bY=bX[3]}var bT=bO-bP;if(ak(bT)>b1){var b0=bO,b3=bU,bR=cp;bO=bP+b1*(E&&bO>bP?1:-1);bU=bZ+b4*aI.cos(bO);cp=bY+b2*aI.sin(bO);b8=ab(bU,cp,b4,b2,bW,0,E,b3,bR,[bO,b0,bZ,bY])}bT=bO-bP;var S=aI.cos(bP),co=aI.sin(bP),R=aI.cos(bO),cn=aI.sin(bO),cb=aI.tan(bT/4),ce=4/3*b4*cb,cc=4/3*b2*cb,cl=[bV,cq],cj=[bV+ce*co,cq-cc*S],ci=[bU+ce*cn,cp-cc*R],cg=[bU,cp];cj[0]=2*cl[0]-cj[0];cj[1]=2*cl[1]-cj[1];if(bX){return[cj,ci,cg][av](b8)}else{b8=[cj,ci,cg][av](b8).join()[l](",");var b6=[];for(var ch=0,b7=b8.length;ch"1e12"&&(bO=0.5);ak(S)>"1e12"&&(S=0.5);if(bO>0&&bO<1){g=bL(i,d,R,E,bX,bW,bT,bQ,bO);bU.push(g.x);bR.push(g.y)}if(S>0&&S<1){g=bL(i,d,R,E,bX,bW,bT,bQ,S);bU.push(g.x);bR.push(g.y)}bV=(bW-2*E+d)-(bQ-2*bW+E);bS=2*(E-d)-2*(bW-E);bP=d-E;bO=(-bS+aI.sqrt(bS*bS-4*bV*bP))/2/bV;S=(-bS-aI.sqrt(bS*bS-4*bV*bP))/2/bV;ak(bO)>"1e12"&&(bO=0.5);ak(S)>"1e12"&&(S=0.5);if(bO>0&&bO<1){g=bL(i,d,R,E,bX,bW,bT,bQ,bO);bU.push(g.x);bR.push(g.y)}if(S>0&&S<1){g=bL(i,d,R,E,bX,bW,bT,bQ,S);bU.push(g.x);bR.push(g.y)}return{min:{x:ai[bs](0,bU),y:ai[bs](0,bR)},max:{x:bI[bs](0,bU),y:bI[bs](0,bR)}}}),bk=bi._path2curve=H(function(bX,bS){var bQ=!bS&&aR(bX);if(!bS&&bQ.curve){return aY(bQ.curve)}var E=p(bX),bT=bS&&p(bS),bU={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},d={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},S=function(bZ,b0,bY){var i,b1;if(!bZ){return["C",b0.x,b0.y,b0.x,b0.y,b0.x,b0.y]}!(bZ[0] in {T:1,Q:1})&&(b0.qx=b0.qy=null);switch(bZ[0]){case"M":b0.X=bZ[1];b0.Y=bZ[2];break;case"A":bZ=["C"][av](ab[bs](0,[b0.x,b0.y][av](bZ.slice(1))));break;case"S":if(bY=="C"||bY=="S"){i=b0.x*2-b0.bx;b1=b0.y*2-b0.by}else{i=b0.x;b1=b0.y}bZ=["C",i,b1][av](bZ.slice(1));break;case"T":if(bY=="Q"||bY=="T"){b0.qx=b0.x*2-b0.qx;b0.qy=b0.y*2-b0.qy}else{b0.qx=b0.x;b0.qy=b0.y}bZ=["C"][av](z(b0.x,b0.y,b0.qx,b0.qy,bZ[1],bZ[2]));break;case"Q":b0.qx=bZ[1];b0.qy=bZ[2];bZ=["C"][av](z(b0.x,b0.y,bZ[1],bZ[2],bZ[3],bZ[4]));break;case"L":bZ=["C"][av](aW(b0.x,b0.y,bZ[1],bZ[2]));break;case"H":bZ=["C"][av](aW(b0.x,b0.y,bZ[1],b0.y));break;case"V":bZ=["C"][av](aW(b0.x,b0.y,b0.x,bZ[1]));break;case"Z":bZ=["C"][av](aW(b0.x,b0.y,b0.X,b0.Y));break}return bZ},b=function(bY,bZ){if(bY[bZ].length>7){bY[bZ].shift();var b0=bY[bZ];while(b0.length){bY.splice(bZ++,0,["C"][av](b0.splice(0,6)))}bY.splice(bZ,1);bV=bI(E.length,bT&&bT.length||0)}},g=function(b2,b1,bZ,bY,b0){if(b2&&b1&&b2[b0][0]=="M"&&b1[b0][0]!="M"){b1.splice(b0,0,["M",bY.x,bY.y]);bZ.bx=0;bZ.by=0;bZ.x=b2[b0][1];bZ.y=b2[b0][2];bV=bI(E.length,bT&&bT.length||0)}};for(var bP=0,bV=bI(E.length,bT&&bT.length||0);
bPR){if(d&&!bV.start){bT=aO(bS,bR,g[1],g[2],g[3],g[4],g[5],g[6],R-bQ);E+=["C"+bT.start.x,bT.start.y,bT.m.x,bT.m.y,bT.x,bT.y];if(S){return E}bV.start=E;E=["M"+bT.x,bT.y+"C"+bT.n.x,bT.n.y,bT.end.x,bT.end.y,g[5],g[6]].join();bQ+=bO;bS=+g[5];bR=+g[6];continue}if(!b&&!d){bT=aO(bS,bR,g[1],g[2],g[3],g[4],g[5],g[6],R-bQ);return{x:bT.x,y:bT.y,alpha:bT.alpha}}}bQ+=bO;bS=+g[5];bR=+g[6]}E+=g.shift()+g}bV.end=E;bT=b?bQ:d?bV:bi.findDotsAtSegment(bS,bR,g[0],g[1],g[2],g[3],g[4],g[5],1);bT.alpha&&(bT={x:bT.x,y:bT.y,alpha:bT.alpha});return bT}};var bG=aD(1),by=aD(),aB=aD(0,1);bi.getTotalLength=bG;bi.getPointAtLength=by;bi.getSubpath=function(d,i,g){if(this.getTotalLength(d)-g<0.000001){return aB(d,i).end}var b=aB(d,g,1);return i?aB(b,i).end:b};aq.getTotalLength=function(){var b=this.getPath();if(!b){return}if(this.node.getTotalLength){return this.node.getTotalLength()}return bG(b)};aq.getPointAtLength=function(b){var d=this.getPath();if(!d){return}return by(d,b)};aq.getPath=function(){var d,b=bi._getPath[this.type];if(this.type=="text"||this.type=="set"){return}if(b){d=b(this)}return d};aq.getSubpath=function(g,d){var b=this.getPath();if(!b){return}return bi.getSubpath(b,g,d)};var aG=bi.easing_formulas={linear:function(b){return b},"<":function(b){return aS(b,1.7)},">":function(b){return aS(b,0.48)},"<>":function(bO){var i=0.48-bO/1.04,g=aI.sqrt(0.1734+i*i),b=g-i,S=aS(ak(b),1/3)*(b<0?-1:1),R=-g-i,E=aS(ak(R),1/3)*(R<0?-1:1),d=S+E+0.5;return(1-d)*3*d*d+d*d*d},backIn:function(d){var b=1.70158;return d*d*((b+1)*d-b)},backOut:function(d){d=d-1;var b=1.70158;return d*d*((b+1)*d+b)+1},elastic:function(b){if(b==!!b){return b}return aS(2,-10*b)*aI.sin((b-0.075)*(2*ag)/0.3)+1},bounce:function(i){var d=7.5625,g=2.75,b;if(i<(1/g)){b=d*i*i}else{if(i<(2/g)){i-=(1.5/g);b=d*i*i+0.75}else{if(i<(2.5/g)){i-=(2.25/g);b=d*i*i+0.9375}else{i-=(2.625/g);b=d*i*i+0.984375}}}return b}};aG.easeIn=aG["ease-in"]=aG["<"];aG.easeOut=aG["ease-out"]=aG[">"];aG.easeInOut=aG["ease-in-out"]=aG["<>"];aG["back-in"]=aG.backIn;aG["back-out"]=aG.backOut;var bF=[],bH=aT.requestAnimationFrame||aT.webkitRequestAnimationFrame||aT.mozRequestAnimationFrame||aT.oRequestAnimationFrame||aT.msRequestAnimationFrame||function(b){setTimeout(b,16)},at=function(){var bO=+new Date,bW=0;for(;bW1&&!b2.next){for(b4 in d){if(d[bw](b4)){b0[b4]=b2.totalOrigin[b4]}}b2.el.attr(b0);T(b2.anim,b2.el,b2.anim.percents[0],null,b2.totalOrigin,b2.repeat-1)}if(b2.next&&!b2.stop){T(b2.anim,b2.el,b2.next,null,b2.totalOrigin,b2.repeat)}}}bi.svg&&S&&S.paper&&S.paper.safari();bF.length&&bH(at)},a1=function(b){return b>255?255:b<0?0:b};aq.animateWith=function(d,E,g,b,bO,bT){var S=this;if(S.removed){bT&&bT.call(S);return S}var bR=g instanceof f?g:bi.animation(g,b,bO,bT),bQ,bP;T(bR,S,bR.percents[0],null,S.attr());for(var R=0,bS=bF.length;Rb1){return b1}while(b2bX){b2=bZ}else{b1=bZ}bZ=(b1-b2)/2+b2}return bZ}return g(bU,1/(200*bO))}aq.onAnimation=function(b){b?bc.on("raphael.anim.frame."+this.id,b):bc.unbind("raphael.anim.frame."+this.id);return this};function f(E,g){var d=[],i={};this.ms=g;this.times=1;if(E){for(var b in E){if(E[bw](b)){i[bM(b)]=E[b];d.push(bM(b))}}d.sort(bu)}this.anim=i;this.top=d[d.length-1];this.percents=d}f.prototype.delay=function(d){var b=new f(this.anim,this.ms);b.times=this.times;b.del=+d||0;return b};f.prototype.repeat=function(d){var b=new f(this.anim,this.ms);b.del=this.del;b.times=aI.floor(bI(d,0))||1;return b};function T(b6,g,b,b4,bO,bS){b=bM(b);var cd,S,bR,ce=[],bY,bX,R,b0=b6.ms,b5={},E={},bU={};if(b4){for(b9=0,bT=bF.length;b9b4*b6.top){b=b6.percents[b9];bX=b6.percents[b9-1]||0;b0=b0/b6.top*(b-bX);bY=b6.percents[b9+1];cd=b6.anim[b];break}else{if(b4){g.attr(b6.anim[b6.percents[b9]])}}}if(!cd){return}if(!S){for(var b2 in cd){if(cd[bw](b2)){if(bo[bw](b2)||g.paper.customAttributes[bw](b2)){b5[b2]=g.attr(b2);(b5[b2]==null)&&(b5[b2]=bq[b2]);E[b2]=cd[b2];switch(bo[b2]){case bj:bU[b2]=(E[b2]-b5[b2])/b0;break;case"colour":b5[b2]=bi.getRGB(b5[b2]);var b3=bi.getRGB(E[b2]);bU[b2]={r:(b3.r-b5[b2].r)/b0,g:(b3.g-b5[b2].g)/b0,b:(b3.b-b5[b2].b)/b0};break;case"path":var bP=bk(b5[b2],E[b2]),bW=bP[1];b5[b2]=bP[0];bU[b2]=[];for(b9=0,bT=b5[b2].length;b90.5)*2-1);bQ(cg-0.5,2)+bQ(ce-0.5,2)>0.25&&(ce=bO.sqrt(0.25-bQ(cg-0.5,2))*cq+0.5)&&ce!=0.5&&(ce=ce.toFixed(5)-0.00001*cq)}return bZ});cm=cm.split(/\s*\-\s*/);if(ck=="linear"){var cf=cm.shift();cf=-bV(cf);if(isNaN(cf)){return null}var cd=[0,0,bO.cos(bi.rad(cf)),bO.sin(bi.rad(cf))],cl=1/(ca(b0(cd[2]),b0(cd[3]))||1);cd[2]*=cl;cd[3]*=cl;if(cd[2]<0){cd[0]=-cd[2];cd[2]=0}if(cd[3]<0){cd[1]=-cd[3];cd[3]=0}}var cj=bi._parseDots(cm);if(!cj){return null}S=S.replace(/[\(\)\s,\xb0#]/g,"_");if(ci.gradient&&S!=ci.gradient.id){E.defs.removeChild(ci.gradient);delete ci.gradient}if(!ci.gradient){cb=bR(ck+"Gradient",{id:S});ci.gradient=cb;bR(cb,ck=="radial"?{fx:cg,fy:ce}:{x1:cd[0],y1:cd[1],x2:cd[2],y2:cd[3],gradientTransform:ci.matrix.invert()});E.defs.appendChild(cb);for(var ch=0,cn=cj.length;ch1?cc.opacity/100:cc.opacity});case"stroke":cc=bi.getRGB(cm);co.setAttribute(cn,cc.hex);cn=="stroke"&&cc[i]("opacity")&&bR(co,{"stroke-opacity":cc.opacity>1?cc.opacity/100:cc.opacity});if(cn=="stroke"&&ck._.arrows){"startString" in ck._.arrows&&g(ck,ck._.arrows.startString);"endString" in ck._.arrows&&g(ck,ck._.arrows.endString,1)}break;case"gradient":(ck.type=="circle"||ck.type=="ellipse"||b9(cm).charAt()!="r")&&b(ck,cm);break;case"opacity":if(cl.gradient&&!cl[i]("stroke-opacity")){bR(co,{"stroke-opacity":cm>1?cm/100:cm})}case"fill-opacity":if(cl.gradient){E=bi._g.doc.getElementById(co.getAttribute("fill").replace(/^url\(#|\)$/g,bZ));if(E){cf=E.getElementsByTagName("stop");bR(cf[cf.length-1],{"stop-opacity":cm})}break}default:cn=="font-size"&&(cm=bY(cm,10)+"px");var cg=cn.replace(/(\-.)/g,function(cu){return cu.substring(1).toUpperCase()});co.style[cg]=cm;ck._.dirty=1;co.setAttribute(cn,cm);break}}}bX(ck,cs);co.style.visibility=ci},b8=1.2,bX=function(E,cd){if(E.type!="text"||!(cd[i]("text")||cd[i]("font")||cd[i]("font-size")||cd[i]("x")||cd[i]("y"))){return}var ci=E.attrs,cb=E.node,ck=cb.firstChild?bY(bi._g.doc.defaultView.getComputedStyle(cb.firstChild,bZ).getPropertyValue("font-size"),10):10;if(cd[i]("text")){ci.text=cd.text;while(cb.firstChild){cb.removeChild(cb.firstChild)}var cc=b9(cd.text).split("\n"),S=[],cg;for(var ce=0,cj=cc.length;ce"));var cq=cE.getBoundingClientRect();cO.W=cL.w=(cq.right-cq.left)/cz;cO.H=cL.h=(cq.bottom-cq.top)/cz;cO.X=cL.x;cO.Y=cL.y+cO.H/2;("x" in cH||"y" in cH)&&(cO.path.v=bi.format("m{0},{1}l{2},{1}",b9(cL.x*d),b9(cL.y*d),b9(cL.x*d)+1));var cp=["x","y","text","font","font-family","font-weight","font-style","font-size"];for(var cG=0,cI=cp.length;cG0.25&&(cs=bQ.sqrt(0.25-ch(cu-0.5,2))*((cs>0.5)*2-1)+0.5);cm=cu+bT+cs}return bY});cn=cn.split(/\s*\-\s*/);if(cl=="linear"){var S=cn.shift();S=-bV(S);if(isNaN(S)){return null}}var ck=bi._parseDots(cn);if(!ck){return null}E=E.shape||E.node;if(ck.length){E.removeChild(cq);cq.on=true;cq.method="none";cq.color=ck[0].color;cq.color2=ck[ck.length-1].color;var cr=[];for(var cg=0,cp=ck.length;cg')}}catch(E){cd=function(ch){return S.createElement("<"+ch+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}};bi._engine.initWin(bi._g.win);bi._engine.create=function(){var cg=bi._getContainer.apply(0,arguments),E=cg.container,cm=cg.height,cn,S=cg.width,cl=cg.x,ck=cg.y;if(!E){throw new Error("VML container not found.")}var ci=new bi._Paper,cj=ci.canvas=bi._g.doc.createElement("div"),ch=cj.style;cl=cl||0;ck=ck||0;S=S||512;cm=cm||342;ci.width=S;ci.height=cm;S==+S&&(S+="px");cm==+cm&&(cm+="px");ci.coordsize=d*1000+bT+d*1000;ci.coordorigin="0 0";ci.span=bi._g.doc.createElement("span");ci.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;";cj.appendChild(ci.span);ch.cssText=bi.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",S,cm);if(E==1){bi._g.doc.body.appendChild(cj);ch.left=cl+"px";ch.top=ck+"px";ch.position="absolute"}else{if(E.firstChild){E.insertBefore(cj,E.firstChild)}else{E.appendChild(cj)}}ci.renderfix=function(){};return ci};bi.prototype.clear=function(){bi.eve("raphael.clear",this);this.canvas.innerHTML=bY;this.span=bi._g.doc.createElement("span");this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";this.canvas.appendChild(this.span);this.bottom=this.top=null};bi.prototype.remove=function(){bi.eve("raphael.remove",this);this.canvas.parentNode.removeChild(this.canvas);for(var E in this){this[E]=typeof this[E]=="function"?bi._removedFactory(E):null}return true};var b6=bi.st;for(var bP in bU){if(bU[R](bP)&&!b6[R](bP)){b6[bP]=(function(E){return function(){var S=arguments;return this.forEach(function(cg){cg[E].apply(cg,S)
})}})(bP)}}})();aE.was?(a5.win.Raphael=bi):(Raphael=bi);return bi}));if(!window.ABCJS){window.ABCJS={}}(function(){function a(g,f){var j=g.getAttribute("class");var i=/[\t\r\n\f]/g;var h=" "+f+" ";return(g.nodeType===1&&(" "+j+" ").replace(i," ").indexOf(h)>=0)}function e(l,g,f){var k=l.getElementsByClassName(g);var h=[];for(var j=0;j');$(h).append(c);$(h).css({position:"relative"})}d=false;var r=b(j,q);var p=r/60000;var m=j.getBeatLength();var g;function f(w,s){var u=e(h,"l"+w,"m"+s);if(u.length>0){for(var t=0;t0){var R=t.startTie;if(x){if(!R){x=false}}else{if(!z["event"+O]){z["event"+O]={type:"event",time:O,top:J,height:K,left:t.x,width:t.w}}else{z["event"+O].left=Math.min(z["event"+O].left,t.x)}if(R){x=true}}O+=t.duration}if(t.type==="bar"){if(k.length===0||k[k.length-1]!=="bar"){if(t.elemset&&t.elemset.length>0&&t.elemset[0].attrs){var E=t.elemset[0].attrs["class"];var s=E.split(" ");var P;var u;for(var M=0;M0){return k[0].time/m}return 0}if(q.showCursor){c.css({left:s.left+"px",top:s.top+"px",width:s.width+"px",height:s.height+"px"})}if(k.length>0){return k[0].time/m}d=true;return 0}function n(){if(d){ABCJS.stopAnimation();return}var t=l();var v=t/p;var u=new Date();u=u.getTime();var s=g+v-u;if(s<=0){n()}else{setTimeout(n,s)}}g=new Date();g=g.getTime();n()};ABCJS.stopAnimation=function(){d=true;if(c){c.remove();c=null}}})();if(!window.ABCJS){window.ABCJS={}}(function(){ABCJS.numberOfTunes=function(d){var b=d.split("\nX:");var c=b.length;if(c===0){c=1}return c};ABCJS.TuneBook=function(d){var h=this;var g="";d=window.ABCJS.parse.strip(d);var b=d.split("\nX:");for(var f=1;f1&&!window.ABCJS.parse.startsWith(h.tunes[0].abc,"X:")){var c=h.tunes.shift();var e=c.abc.split("\n");window.ABCJS.parse.each(e,function(i){if(window.ABCJS.parse.startsWith(i,"%%")){g+=i+"\n"}})}h.header=g;window.ABCJS.parse.each(h.tunes,function(k){var i=k.abc.indexOf("\n\n");if(i>0){k.abc=k.abc.substring(0,i)}k.pure=k.abc;k.abc=g+k.abc;var l=k.pure.split("T:");if(l.length>1){l=l[1].split("\n");k.title=l[0].replace(/^\s+|\s+$/g,"")}else{k.title=""}var m=k.pure.substring(2,k.pure.indexOf("\n"));k.id=m.replace(/^\s+|\s+$/g,"")})};ABCJS.TuneBook.prototype.getTuneById=function(c){for(var b=0;b0){var a=parseInt(d.value[0].num,10);var e=parseInt(d.value[0].den,10);if(a===6&&e===8){return 3/8}if(a===9&&e===8){return 3/8}if(a===12&&e===8){return 3/8}return 1/e}else{return null}}else{if(d.type==="cut_time"){return 1/2}else{return 1/4}}}}}}return null};this.reset=function(){this.version="1.0.1";this.media="screen";this.metaText={};this.formatting={};this.lines=[];this.staffNum=0;this.voiceNum=0;this.lineNum=0};this.cleanUp=function(f,p,z,q,w){this.closeLine();var b=false;var y,o,k;for(y=0;y=z){if(t=0;a--){var b=this.lines[this.lineNum].staff[this.staffNum].voices[this.voiceNum][a];if(b.el_type==="note"){return b}}}return null};this.addTieToLastNote=function(){var a=this.getLastNote();if(a&&a.pitches&&a.pitches.length>0){a.pitches[0].startTie={};return true}return false};this.getDuration=function(a){if(a.duration){return a.duration}return 0};this.closeLine=function(){if(this.potentialStartBeam&&this.potentialEndBeam){this.potentialStartBeam.startBeam=true;this.potentialEndBeam.endBeam=true}delete this.potentialStartBeam;delete this.potentialEndBeam};this.appendElement=function(h,i,e,a){var c=this;var g=function(l){if(l.pitches!==undefined){var j=c.lines[c.lineNum].staff[c.staffNum].workingClef.verticalPos;window.ABCJS.parse.each(l.pitches,function(m){m.verticalPos=m.pitch-j})}if(l.gracenotes!==undefined){var k=c.lines[c.lineNum].staff[c.staffNum].workingClef.verticalPos;window.ABCJS.parse.each(l.gracenotes,function(m){m.verticalPos=m.pitch-k})}c.lines[c.lineNum].staff[c.staffNum].voices[c.voiceNum].push(l)};a.el_type=h;if(i!==null){a.startChar=i}if(e!==null){a.endChar=e}var d=function(){c.potentialStartBeam.startBeam=true;a.endBeam=true;delete c.potentialStartBeam;delete c.potentialEndBeam};var f=function(){if(c.potentialStartBeam!==undefined&&c.potentialEndBeam!==undefined){c.potentialStartBeam.startBeam=true;c.potentialEndBeam.endBeam=true}delete c.potentialStartBeam;delete c.potentialEndBeam};if(h==="note"){var b=c.getDuration(a);if(b>=0.25){f()}else{if(a.force_end_beam_last&&c.potentialStartBeam!==undefined){f()}else{if(a.end_beam&&c.potentialStartBeam!==undefined){if(a.rest===undefined){d()}else{f()}}else{if(a.rest===undefined){if(c.potentialStartBeam===undefined){if(!a.end_beam){c.potentialStartBeam=a;delete c.potentialEndBeam}}else{c.potentialEndBeam=a}}}}}}else{f()}delete a.end_beam;delete a.force_end_beam_last;g(a)};this.appendStartingElement=function(f,a,h,c){this.closeLine();var e;if(f==="key"){e=c.impliedNaturals;delete c.impliedNaturals}var b=window.ABCJS.parse.clone(c);if(f==="clef"){this.lines[this.lineNum].staff[this.staffNum].workingClef=b}if(this.lines[this.lineNum].staff.length<=this.staffNum){this.lines[this.lineNum].staff[this.staffNum]={};this.lines[this.lineNum].staff[this.staffNum].clef=window.ABCJS.parse.clone(this.lines[this.lineNum].staff[0].clef);this.lines[this.lineNum].staff[this.staffNum].key=window.ABCJS.parse.clone(this.lines[this.lineNum].staff[0].key);this.lines[this.lineNum].staff[this.staffNum].meter=window.ABCJS.parse.clone(this.lines[this.lineNum].staff[0].meter);this.lines[this.lineNum].staff[this.staffNum].workingClef=window.ABCJS.parse.clone(this.lines[this.lineNum].staff[0].workingClef);
this.lines[this.lineNum].staff[this.staffNum].voices=[[]]}var g=this.lines[this.lineNum].staff[this.staffNum].voices[this.voiceNum];for(var d=0;d0){if(d.lines[d.lineNum].staff[d.staffNum].voices[0]!==undefined){var g=false;for(var f=0;f0};this.isFirstLine=function(a){for(var b=a-1;b>=0;b--){if(this.lines[b].staff!==undefined){return false}}return true};this.getCurrentVoice=function(){if(this.lines[this.lineNum]!==undefined&&this.lines[this.lineNum].staff[this.staffNum]!==undefined&&this.lines[this.lineNum].staff[this.staffNum].voices[this.voiceNum]!==undefined){return this.lines[this.lineNum].staff[this.staffNum].voices[this.voiceNum]}else{return null}};this.setCurrentVoice=function(c,b){this.staffNum=c;this.voiceNum=b;for(var a=0;a>7}for(var j=h.length-1;j>=0;j--){k=k<<8;var l=h[j];if(j!==0){l=l|128}k=k|l}var m=k.toString(16).length;m+=m%2;return c(k,m)}ABCJS.midi.MidiWriter=function(i,h){h=h||{};this.parent=i;this.scale=[0,2,4,5,7,9,11];this.restart={line:0,staff:0,voice:0,pos:0};this.visited={};this.multiplier=1;this.next=null;this.qpm=h.qpm||180;this.program=h.program||2;this.noteOnAndChannel="%90";this.javamidi=h.type==="java"||false;this.listeners=[];this.transpose=0;if(this.javamidi){MIDIPlugin=document.MIDIPlugin;setTimeout(function(){try{MIDIPlugin.openPlugin()}catch(k){var j=document.createElement("a");j.href="http://java.sun.com/products/java-media/sound/soundbanks.html";j.target="_blank";j.appendChild(document.createTextNode("Download Soundbank"));i.appendChild(j)}},0)}};ABCJS.midi.MidiWriter.prototype.addListener=function(h){this.listeners.push(h)};ABCJS.midi.MidiWriter.prototype.notifySelect=function(j){for(var h=0;h=0&&c.lastIndexOf(a)===b};window.ABCJS.parse.each=function(a,d,c){for(var b=0,e=a.length;b",">")};var B=function(K,G,J){if(!G){G=" "}var I=G.charAt(J);if(I===" "){I="SPACE"}var H=d(G.substring(0,J))+''+I+""+d(G.substring(J+1));F("Music Line:"+g.getNumLines()+":"+(J+1)+": "+K+": "+H)};var y=new window.ABCJS.parse.ParseHeader(r,B,C,g);this.getWarnings=function(){return C.warnings};var x=function(I,J){if(I.charAt(J)==='"'){var K=r.getBrackettedSubstring(I,J,5);if(!K[2]){B("Missing the closing quote while parsing the chord symbol",I,J)}if(K[0]>0&&K[1].length>0&&K[1].charAt(0)==="^"){K[1]=K[1].substring(1);K[2]="above"}else{if(K[0]>0&&K[1].length>0&&K[1].charAt(0)==="_"){K[1]=K[1].substring(1);K[2]="below"}else{if(K[0]>0&&K[1].length>0&&K[1].charAt(0)==="<"){K[1]=K[1].substring(1);K[2]="left"}else{if(K[0]>0&&K[1].length>0&&K[1].charAt(0)===">"){K[1]=K[1].substring(1);
K[2]="right"}else{if(K[0]>0&&K[1].length>0&&K[1].charAt(0)==="@"){K[1]=K[1].substring(1);var G=r.getFloat(K[1]);if(G.digits===0){B("Missing first position in absolutely positioned annotation.",I,J)}K[1]=K[1].substring(G.digits);if(K[1][0]!==","){B("Missing comma absolutely positioned annotation.",I,J)}K[1]=K[1].substring(1);var L=r.getFloat(K[1]);if(L.digits===0){B("Missing second position in absolutely positioned annotation.",I,J)}K[1]=K[1].substring(L.digits);var H=r.skipWhiteSpace(K[1]);K[1]=K[1].substring(H);K[2]=null;K[3]={x:G.value,y:L.value}}else{K[1]=K[1].replace(/([ABCDEFG])b/g,"$1♭");K[1]=K[1].replace(/([ABCDEFG])#/g,"$1♯");K[2]="default"}}}}}return K}return[0,""]};var t=["trill","lowermordent","uppermordent","mordent","pralltriller","accent","fermata","invertedfermata","tenuto","0","1","2","3","4","5","+","wedge","open","thumb","snap","turn","roll","breath","shortphrase","mediumphrase","longphrase","segno","coda","D.S.","D.C.","fine","slide","^","marcato","upbow","downbow","/","//","///","////","trem1","trem2","trem3","trem4","turnx","invertedturn","invertedturnx","trill(","trill)","arpeggio","xstem","mark","umarcato","style=normal","style=harmonic","style=rhythm","style=x"];var E=["p","pp","f","ff","mf","mp","ppp","pppp","fff","ffff","sfz"];var b=["crescendo(","crescendo)","diminuendo(","diminuendo)"];var v=[["<","accent"],[">","accent"],["tr","trill"],["plus","+"],["emphasis","accent"],["^","umarcato"],["marcato","umarcato"]];var i=[["<(","crescendo("],["<)","crescendo)"],[">(","diminuendo("],[">)","diminuendo)"]];var k=function(G,I){var J=C.macros[G.charAt(I)];if(J!==undefined){if(J.charAt(0)==="!"||J.charAt(0)==="+"){J=J.substring(1)}if(J.charAt(J.length-1)==="!"||J.charAt(J.length-1)==="+"){J=J.substring(0,J.length-1)}if(window.ABCJS.parse.detect(t,function(K){return(J===K)})){return[1,J]}else{if(window.ABCJS.parse.detect(E,function(K){return(J===K)})){if(C.volumePosition==="hidden"){J=""}return[1,J]}else{if(window.ABCJS.parse.detect(b,function(K){if(C.dynamicPosition==="hidden"){J=""}return(J===K)})){return[1,J]}else{if(!window.ABCJS.parse.detect(C.ignoredDecorations,function(K){return(J===K)})){B("Unknown macro: "+J,G,I)}return[1,""]}}}}switch(G.charAt(I)){case".":return[1,"staccato"];case"u":return[1,"upbow"];case"v":return[1,"downbow"];case"~":return[1,"irishroll"];case"!":case"+":var H=r.getBrackettedSubstring(G,I,5);if(H[1].length>0&&(H[1].charAt(0)==="^"||H[1].charAt(0)==="_")){H[1]=H[1].substring(1)}if(window.ABCJS.parse.detect(t,function(K){return(H[1]===K)})){return H}if(window.ABCJS.parse.detect(E,function(K){return(H[1]===K)})){if(C.volumePosition==="hidden"){H[1]=""}return H}if(window.ABCJS.parse.detect(b,function(K){return(H[1]===K)})){if(C.dynamicPosition==="hidden"){H[1]=""}return H}if(window.ABCJS.parse.detect(v,function(K){if(H[1]===K[0]){H[1]=K[1];return true}else{return false}})){return H}if(window.ABCJS.parse.detect(i,function(K){if(H[1]===K[0]){H[1]=K[1];return true}else{return false}})){if(C.dynamicPosition==="hidden"){H[1]=""}return H}if(G.charAt(I)==="!"&&(H[0]===1||G.charAt(I+H[0]-1)!=="!")){return[1,null]}B("Unknown decoration: "+H[1],G,I);H[1]="";return H;case"H":return[1,"fermata"];case"J":return[1,"slide"];case"L":return[1,"accent"];case"M":return[1,"mordent"];case"O":return[1,"coda"];case"P":return[1,"pralltriller"];case"R":return[1,"roll"];case"S":return[1,"segno"];case"T":return[1,"trill"]}return[0,0]};var f=function(G,H){var I=H;while(r.isWhiteSpace(G.charAt(H))){H++}return[H-I]};var w=function(I,L){var J=r.getBarLine(I,L);if(J.len===0){return[0,""]}if(J.warn){B(J.warn,I,L);return[J.len,""]}for(var H=0;H="2"&&G.charAt(I+1)<="9")){if(H.triplet!==undefined){B("Can't nest triplets",G,I)}else{H.triplet=G.charAt(I+1)-"0";if(I+2="1"&&G.charAt(I+4)<="9")){H.num_notes=G.charAt(I+4)-"0";I+=3}else{B("expected number after the two colons after the triplet to mark the duration",G,I)}}else{if(I+3="1"&&G.charAt(I+3)<="9")){if(I+4="1"&&G.charAt(I+5)<="9")){H.num_notes=G.charAt(I+5)-"0";I+=4}}else{H.num_notes=H.triplet;I+=3}}else{B("expected number after the triplet to mark the duration",G,I)}}}}I++}else{if(H.startSlur===undefined){H.startSlur=1}else{H.startSlur++}}}I++}H.consumed=I-J;return H};var q=function(H,N){if(!H){B("Can't add words before the first line of music",H,0);return}N=window.ABCJS.parse.strip(N);if(N.charAt(N.length-1)!=="-"){N=N+" "}var M=[];var L=0;var J=false;var G=function(O){var P=window.ABCJS.parse.strip(N.substring(L,O));L=O+1;if(P.length>0){if(J){P=window.ABCJS.parse.gsub(P,"~"," ")}var Q=N.charAt(O);if(Q!=="_"&&Q!=="-"){Q=" "}M.push({syllable:r.translateString(P),divider:Q});J=false;return true}return false};for(var I=0;I0){window.ABCJS.parse.last(M).divider="-";M.push({skip:true,to:"next"})}break;case"_":G(I);M.push({skip:true,to:"slur"});break;case"*":G(I);M.push({skip:true,to:"next"});break;case"|":G(I);M.push({skip:true,to:"bar"});break;case"~":J=true;break}}var K=false;window.ABCJS.parse.each(H,function(P){if(M.length!==0){if(M[0].skip){switch(M[0].to){case"next":if(P.el_type==="note"&&P.pitches!==null&&!K){M.shift()}break;case"slur":if(P.el_type==="note"&&P.pitches!==null){M.shift()}break;case"bar":if(P.el_type==="bar"){M.shift()}break}}else{if(P.el_type==="note"&&P.rest===undefined&&!K){var O=M.shift();if(P.lyric===undefined){P.lyric=[O]}else{P.lyric.push(O)}}}}})};var e=function(H,N){if(!H){B("Can't add symbols before the first line of music",H,0);return}N=window.ABCJS.parse.strip(N);if(N.charAt(N.length-1)!=="-"){N=N+" "}var M=[];var L=0;var J=false;var G=function(O){var P=window.ABCJS.parse.strip(N.substring(L,O));L=O+1;if(P.length>0){if(J){P=window.ABCJS.parse.gsub(P,"~"," ")}var Q=N.charAt(O);if(Q!=="_"&&Q!=="-"){Q=" "}M.push({syllable:r.translateString(P),divider:Q});J=false;return true}return false};for(var I=0;I0){window.ABCJS.parse.last(M).divider="-";M.push({skip:true,to:"next"})}break;case"_":G(I);M.push({skip:true,to:"slur"});break;case"*":G(I);M.push({skip:true,to:"next"});break;case"|":G(I);M.push({skip:true,to:"bar"});break;case"~":J=true;break}}var K=false;window.ABCJS.parse.each(H,function(P){if(M.length!==0){if(M[0].skip){switch(M[0].to){case"next":if(P.el_type==="note"&&P.pitches!==null&&!K){M.shift()
}break;case"slur":if(P.el_type==="note"&&P.pitches!==null){M.shift()}break;case"bar":if(P.el_type==="bar"){M.shift()}break}}else{if(P.el_type==="note"&&P.rest===undefined&&!K){var O=M.shift();if(P.lyric===undefined){P.lyric=[O]}else{P.lyric.push(O)}}}}})};var c=function(G,H){switch(G.charAt(H)){case">":if(H"){return[2,1.75,0.25]}else{return[1,1.5,0.5]}break;case"<":if(H")){M--;H="broken_rhythm"}else{return I}}else{return null}break;case">":case"<":if(N(H)){if(G){var K=c(P,M);M+=K[0]-1;C.next_note_duration=K[2]*I.duration;I.duration=K[1]*I.duration;H="end_slur"}else{I.endChar=M;return I}}else{return null}break;default:if(N(H)){I.endChar=M;return I}return null}M++;if(M===P.length){if(N(H)){I.endChar=M;return I}else{return null}}}return null};function z(){var H={startChar:-1,endChar:-1};if(C.partForNextLine.length){H.part=C.partForNextLine}H.clef=C.currentVoice&&C.staves[C.currentVoice.staffNum].clef!==undefined?window.ABCJS.parse.clone(C.staves[C.currentVoice.staffNum].clef):window.ABCJS.parse.clone(C.clef);H.key=window.ABCJS.parse.parseKeyVoice.deepCopyKey(C.key);window.ABCJS.parse.parseKeyVoice.addPosToKey(H.clef,H.key);if(C.meter!==null){if(C.currentVoice){window.ABCJS.parse.each(C.staves,function(I){I.meter=C.meter});H.meter=C.staves[C.currentVoice.staffNum].meter;C.staves[C.currentVoice.staffNum].meter=null}else{H.meter=C.meter}C.meter=null}else{if(C.currentVoice&&C.staves[C.currentVoice.staffNum].meter){H.meter=C.staves[C.currentVoice.staffNum].meter;C.staves[C.currentVoice.staffNum].meter=null}}if(C.currentVoice&&C.currentVoice.name){H.name=C.currentVoice.name}if(C.vocalfont){H.vocalfont=C.vocalfont}if(C.style){H.style=C.style}if(C.currentVoice){var G=C.staves[C.currentVoice.staffNum];if(G.brace){H.brace=G.brace}if(G.bracket){H.bracket=G.bracket}if(G.connectBarLines){H.connectBarLines=G.connectBarLines}if(G.name){H.name=G.name[C.currentVoice.index]}if(G.subname){H.subname=G.subname[C.currentVoice.index]}if(C.currentVoice.stem){H.stem=C.currentVoice.stem}if(C.currentVoice.scale){H.scale=C.currentVoice.scale}if(C.currentVoice.style){H.style=C.currentVoice.style}}g.startNewLine(H);C.partForNextLine="";if(C.currentVoice===undefined||(C.currentVoice.staffNum===C.staves.length-1&&C.staves[C.currentVoice.staffNum].numVoices-1===C.currentVoice.index)){if(C.barNumbers===0){C.barNumOnNextNote=C.currBarNumber}}}var A=function(H,J){if(H.charAt(J)==="{"){var I=r.getBrackettedSubstring(H,J,1,"}");if(!I[2]){B("Missing the closing '}' while parsing grace note",H,J)}if(H[J+I[0]]===")"){I[0]++;I[1]+=")"}var G=[];var L=0;var M=false;while(L0){G[G.length-1].end_beam=true}}else{B("Unknown character '"+I[1].charAt(L)+"' while parsing grace note",H,J)}L++}}if(G.length){return[I[0],G]}}return[0]};function j(G){var H=G.origMeter;if(!H||H.type!=="specified"){return 1}if(!H.value||H.value.length===0){return 1}return parseInt(H.value[0].num,10)/parseInt(H.value[0].den,10)}var u="ABCDEFGabcdefgxyzZ[]|^_{";var p=function(Q){y.resolveTempo();C.is_in_header=false;var X=0;var W=C.iChar;while(r.isWhiteSpace(Q.charAt(X))&&X0){X+=T[0]
}var I={};while(X0){X+=H[0]}else{if(aa){z();aa=false}var ac;while(1){ac=r.eatWhiteSpace(Q,X);if(ac>0){X+=ac}if(X>0&&Q.charAt(X-1)==="\x12"){ac=y.letter_to_body_header(Q,X);if(ac[0]>0){X=ac[0];C.start_new_line=false}}ac=f(Q,X);if(ac[0]>0){X+=ac[0]}ac=x(Q,X);if(ac[0]>0){if(!I.chord){I.chord=[]}var M=r.translateString(ac[1]);M=M.replace(/;/g,"\n");var L=false;for(var R=0;R0){I.force_end_beam_last=true}X+=S}else{if(u.indexOf(Q.charAt(X))===-1){ac=k(Q,X)}else{ac=[0]}if(ac[0]>0){if(ac[1]===null){if(X+10){if(ac[1].indexOf("style=")===0){I.style=ac[1].substr(6)}else{if(I.decoration===undefined){I.decoration=[]}I.decoration.push(ac[1])}}}X+=ac[0]}else{ac=A(Q,X);if(ac[0]>0){I.gracenotes=ac[1];X+=ac[0]}else{break}}}}ac=w(Q,X);if(ac[0]>0){if(I.gracenotes!==undefined){I.rest={type:"spacer"};I.duration=0.125;C.addFormattingOptions(I,g.formatting,"note");g.appendElement("note",W+X,W+X+ac[0],I);C.measureNotEmpty=true;I={}}var Z={type:ac[1]};if(Z.type.length===0){B("Unknown bar type",Q,X)}else{if(C.inEnding&&Z.type!=="bar_thin"){Z.endEnding=true;C.inEnding=false}if(ac[2]){Z.startEnding=ac[2];if(C.inEnding){Z.endEnding=true}C.inEnding=true}if(I.decoration!==undefined){Z.decoration=I.decoration}if(I.chord!==undefined){Z.chord=I.chord}if(Z.startEnding&&C.barFirstEndingNum===undefined){C.barFirstEndingNum=C.currBarNumber}else{if(Z.startEnding&&Z.endEnding&&C.barFirstEndingNum){C.currBarNumber=C.barFirstEndingNum}else{if(Z.endEnding){C.barFirstEndingNum=undefined}}}if(Z.type!=="bar_invisible"&&C.measureNotEmpty){C.currBarNumber++;if(C.barNumbers&&C.currBarNumber%C.barNumbers===0){C.barNumOnNextNote=C.currBarNumber}}C.addFormattingOptions(I,g.formatting,"bar");g.appendElement("bar",W+X,W+X+ac[0],Z);C.measureNotEmpty=false;I={}}X+=ac[0]}else{if(Q[X]==="&"){B("Overlay not yet supported",Q,X);X++}else{ac=s(Q,X);if(ac.consumed>0){if(ac.startSlur!==undefined){I.startSlur=ac.startSlur}if(ac.triplet!==undefined){if(N>0){B("Can't nest triplets",Q,X)}else{I.startTriplet=ac.triplet;N=ac.num_notes===undefined?ac.triplet:ac.num_notes}}X+=ac.consumed}if(Q.charAt(X)==="["){X++;var G=null;var V=false;while(!V){var P=l(Q,X,{},false);if(P!==null){if(P.end_beam){I.end_beam=true;delete P.end_beam}if(I.pitches===undefined){I.duration=P.duration;I.pitches=[P]}else{I.pitches.push(P)}delete P.duration;if(C.inTieChord[I.pitches.length]){P.endTie=true;C.inTieChord[I.pitches.length]=undefined}if(P.startTie){C.inTieChord[I.pitches.length]=true}X=P.endChar;delete P.endChar}else{if(Q.charAt(X)===" "){B("Spaces are not allowed in chords",Q,X);X++}else{if(X0){N--;if(N===0){I.endTriplet=true}}var O=false;while(X":case"<":var ab=c(Q,X);X+=ab[0]-1;C.next_note_duration=ab[2];G=ab[1];break;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"/":var K=r.getFraction(Q,X);G=K.value;X=K.index;if(Q.charAt(X)==="-"||Q.charAt(X)===")"){X--}else{O=true}break;default:O=true;break}if(!O){X++}}}else{B("Expected ']' to end the chords",Q,X)}if(I.pitches!==undefined){if(G!==null){I.duration=I.duration*G}if(C.barNumOnNextNote){I.barNumber=C.barNumOnNextNote;C.barNumOnNextNote=null}C.addFormattingOptions(I,g.formatting,"note");g.appendElement("note",W+X,W+X,I);C.measureNotEmpty=true;I={}}V=true}}}}else{var U={};var Y=l(Q,X,U,true);if(U.endTie!==undefined){C.inTie=true}if(Y!==null){if(Y.pitch!==undefined){I.pitches=[{}];if(Y.accidental!==undefined){I.pitches[0].accidental=Y.accidental}I.pitches[0].pitch=Y.pitch;if(Y.endSlur!==undefined){I.pitches[0].endSlur=Y.endSlur}if(Y.endTie!==undefined){I.pitches[0].endTie=Y.endTie}if(Y.startSlur!==undefined){I.pitches[0].startSlur=Y.startSlur}if(I.startSlur!==undefined){I.pitches[0].startSlur=I.startSlur}if(Y.startTie!==undefined){I.pitches[0].startTie=Y.startTie}if(I.startTie!==undefined){I.pitches[0].startTie=I.startTie}}else{I.rest=Y.rest;if(Y.endSlur!==undefined){I.endSlur=Y.endSlur}if(Y.endTie!==undefined){I.rest.endTie=Y.endTie}if(Y.startSlur!==undefined){I.startSlur=Y.startSlur}if(Y.startTie!==undefined){I.rest.startTie=Y.startTie}if(I.startTie!==undefined){I.rest.startTie=I.startTie}}if(Y.chord!==undefined){I.chord=Y.chord}if(Y.duration!==undefined){I.duration=Y.duration}if(Y.decoration!==undefined){I.decoration=Y.decoration}if(Y.graceNotes!==undefined){I.graceNotes=Y.graceNotes}delete I.startSlur;if(C.inTie){if(I.pitches!==undefined){I.pitches[0].endTie=true}else{I.rest.endTie=true}C.inTie=false}if(Y.startTie||I.startTie){C.inTie=true}X=Y.endChar;if(N>0){N--;if(N===0){I.endTriplet=true}}if(Y.end_beam){h(I)}if(I.rest&&I.rest.type==="rest"&&I.duration===1){I.rest.type="whole";I.duration=j(C)}if(C.barNumOnNextNote){I.barNumber=C.barNumOnNextNote;C.barNumOnNextNote=null}C.addFormattingOptions(I,g.formatting,"note");g.appendElement("note",W+J,W+X,I);C.measureNotEmpty=true;I={}}}if(X===J){if(Q.charAt(X)!==" "&&Q.charAt(X)!=="`"){B("Unknown character ignored",Q,X)}X++}}}}}};var o=function(G){var H=y.parseHeader(G);if(H.regular){p(H.str)}if(H.newline&&C.continueall===undefined){z()}if(H.words){q(g.getCurrentVoice(),G.substring(2))}if(H.symbols){e(g.getCurrentVoice(),G.substring(2))}if(H.recurse){o(H.str)}};this.parse=function(M,K){if(!K){K={}}g.reset();if(K.print){g.media="print"}C.reset();y.reset(r,B,C,g);M=window.ABCJS.parse.gsub(M,"\r\n","\n");M=window.ABCJS.parse.gsub(M,"\r","\n");M+="\n";M=M.replace(/\n\\.*\n/g,"\n");var I=function(P,R,S){var O=" ";var Q=S?O.substring(0,S.length):"";return R+" \x12"+Q};M=M.replace(/\\([ \t]*)(%.*)*\n/g,I);var H=M.split("\n");if(window.ABCJS.parse.last(H).length===0){H.pop()}try{if(K.format){window.ABCJS.parse.parseDirective.globalFormatting(K.format)}window.ABCJS.parse.each(H,function(O){if(K.header_only&&C.is_in_header===false){throw"normal_abort"}if(K.stop_on_warning&&C.warnings){throw"normal_abort"}if(C.is_in_history){if(O.charAt(1)===":"){C.is_in_history=false;o(O)}else{g.addMetaText("history",r.translateString(r.stripComment(O)))}}else{if(C.inTextBlock){if(window.ABCJS.parse.startsWith(O,"%%endtext")){g.addText(C.textBlock);
C.inTextBlock=false}else{if(window.ABCJS.parse.startsWith(O,"%%")){C.textBlock+=" "+O.substring(2)}else{C.textBlock+=" "+O}}}else{if(C.inPsBlock){if(window.ABCJS.parse.startsWith(O,"%%endps")){C.inPsBlock=false}else{C.textBlock+=" "+O}}else{o(O)}}}C.iChar+=O.length+1});var N=11*72;var J=8.5*72;switch(C.papersize){case"legal":N=14*72;J=8.5*72;break;case"A4":N=11.7*72;J=8.3*72;break}if(C.landscape){var G=N;N=J;J=G}C.openSlurs=g.cleanUp(J,N,C.barsperstaff,C.staffnonote,C.openSlurs)}catch(L){if(L!=="normal_abort"){throw L}}}};if(!window.ABCJS){window.ABCJS={}}if(!window.ABCJS.parse){window.ABCJS.parse={}}window.ABCJS.parse.parseDirective={};(function(){var p;var j;var e;var g;window.ABCJS.parse.parseDirective.initialize=function(u,s,t,r){p=u;j=s;e=t;g=r;o()};function o(){e.annotationfont={face:"Helvetica",size:12,weight:"normal",style:"normal",decoration:"none"};e.gchordfont={face:"Helvetica",size:12,weight:"normal",style:"normal",decoration:"none"};e.historyfont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"};e.infofont={face:'"Times New Roman"',size:14,weight:"normal",style:"italic",decoration:"none"};e.measurefont={face:'"Times New Roman"',size:14,weight:"normal",style:"italic",decoration:"none"};e.partsfont={face:'"Times New Roman"',size:15,weight:"normal",style:"normal",decoration:"none"};e.repeatfont={face:'"Times New Roman"',size:13,weight:"normal",style:"normal",decoration:"none"};e.textfont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"};e.vocalfont={face:'"Times New Roman"',size:13,weight:"bold",style:"normal",decoration:"none"};e.wordsfont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"};g.formatting.composerfont={face:'"Times New Roman"',size:14,weight:"normal",style:"italic",decoration:"none"};g.formatting.subtitlefont={face:'"Times New Roman"',size:16,weight:"normal",style:"normal",decoration:"none"};g.formatting.tempofont={face:'"Times New Roman"',size:15,weight:"bold",style:"normal",decoration:"none"};g.formatting.titlefont={face:'"Times New Roman"',size:20,weight:"normal",style:"normal",decoration:"none"};g.formatting.footerfont={face:'"Times New Roman"',size:12,weight:"normal",style:"normal",decoration:"none"};g.formatting.headerfont={face:'"Times New Roman"',size:12,weight:"normal",style:"normal",decoration:"none"};g.formatting.voicefont={face:'"Times New Roman"',size:13,weight:"bold",style:"normal",decoration:"none"};g.formatting.annotationfont=e.annotationfont;g.formatting.gchordfont=e.gchordfont;g.formatting.historyfont=e.historyfont;g.formatting.infofont=e.infofont;g.formatting.measurefont=e.measurefont;g.formatting.partsfont=e.partsfont;g.formatting.repeatfont=e.repeatfont;g.formatting.textfont=e.textfont;g.formatting.vocalfont=e.vocalfont;g.formatting.wordsfont=e.wordsfont}var a={gchordfont:true,measurefont:true,partsfont:true};var d=function(r){switch(r){case"Arial-Italic":return{face:"Arial",weight:"normal",style:"italic",decoration:"none"};case"Arial-Bold":return{face:"Arial",weight:"bold",style:"normal",decoration:"none"};case"Bookman-Demi":return{face:"Bookman,serif",weight:"bold",style:"normal",decoration:"none"};case"Bookman-DemiItalic":return{face:"Bookman,serif",weight:"bold",style:"italic",decoration:"none"};case"Bookman-Light":return{face:"Bookman,serif",weight:"normal",style:"normal",decoration:"none"};case"Bookman-LightItalic":return{face:"Bookman,serif",weight:"normal",style:"italic",decoration:"none"};case"Courier":return{face:'"Courier New"',weight:"normal",style:"normal",decoration:"none"};case"Courier-Oblique":return{face:'"Courier New"',weight:"normal",style:"italic",decoration:"none"};case"Courier-Bold":return{face:'"Courier New"',weight:"bold",style:"normal",decoration:"none"};case"Courier-BoldOblique":return{face:'"Courier New"',weight:"bold",style:"italic",decoration:"none"};case"AvantGarde-Book":return{face:"AvantGarde,Arial",weight:"normal",style:"normal",decoration:"none"};case"AvantGarde-BookOblique":return{face:"AvantGarde,Arial",weight:"normal",style:"italic",decoration:"none"};case"AvantGarde-Demi":case"Avant-Garde-Demi":return{face:"AvantGarde,Arial",weight:"bold",style:"normal",decoration:"none"};case"AvantGarde-DemiOblique":return{face:"AvantGarde,Arial",weight:"bold",style:"italic",decoration:"none"};case"Helvetica-Oblique":return{face:"Helvetica",weight:"normal",style:"italic",decoration:"none"};case"Helvetica-Bold":return{face:"Helvetica",weight:"bold",style:"normal",decoration:"none"};case"Helvetica-BoldOblique":return{face:"Helvetica",weight:"bold",style:"italic",decoration:"none"};case"Helvetica-Narrow":return{face:'"Helvetica Narrow",Helvetica',weight:"normal",style:"normal",decoration:"none"};case"Helvetica-Narrow-Oblique":return{face:'"Helvetica Narrow",Helvetica',weight:"normal",style:"italic",decoration:"none"};case"Helvetica-Narrow-Bold":return{face:'"Helvetica Narrow",Helvetica',weight:"bold",style:"normal",decoration:"none"};case"Helvetica-Narrow-BoldOblique":return{face:'"Helvetica Narrow",Helvetica',weight:"bold",style:"italic",decoration:"none"};case"Palatino-Roman":return{face:"Palatino",weight:"normal",style:"normal",decoration:"none"};case"Palatino-Italic":return{face:"Palatino",weight:"normal",style:"italic",decoration:"none"};case"Palatino-Bold":return{face:"Palatino",weight:"bold",style:"normal",decoration:"none"};case"Palatino-BoldItalic":return{face:"Palatino",weight:"bold",style:"italic",decoration:"none"};case"NewCenturySchlbk-Roman":return{face:'"New Century",serif',weight:"normal",style:"normal",decoration:"none"};case"NewCenturySchlbk-Italic":return{face:'"New Century",serif',weight:"normal",style:"italic",decoration:"none"};case"NewCenturySchlbk-Bold":return{face:'"New Century",serif',weight:"bold",style:"normal",decoration:"none"};case"NewCenturySchlbk-BoldItalic":return{face:'"New Century",serif',weight:"bold",style:"italic",decoration:"none"};case"Times":case"Times-Roman":case"Times-Narrow":case"Times-Courier":case"Times-New-Roman":return{face:'"Times New Roman"',weight:"normal",style:"normal",decoration:"none"};case"Times-Italic":case"Times-Italics":return{face:'"Times New Roman"',weight:"normal",style:"italic",decoration:"none"};case"Times-Bold":return{face:'"Times New Roman"',weight:"bold",style:"normal",decoration:"none"};case"Times-BoldItalic":return{face:'"Times New Roman"',weight:"bold",style:"italic",decoration:"none"};case"ZapfChancery-MediumItalic":return{face:'"Zapf Chancery",cursive,serif',weight:"normal",style:"normal",decoration:"none"};default:return null}};var q=function(z,r,D,I,E){function C(){var J=parseInt(z[0].token);z.shift();if(!r){j("Can't set just the size of the font since there is no default value.",D,I);return{face:'"Times New Roman"',weight:"normal",style:"normal",decoration:"none",size:J}}if(z.length===0){return{face:r.face,weight:r.weight,style:r.style,decoration:r.decoration,size:J}}if(z.length===1&&z[0].token==="box"&&a[E]){return{face:r.face,weight:r.weight,style:r.style,decoration:r.decoration,size:J,box:true}
}j("Extra parameters in font definition.",D,I);return{face:r.face,weight:r.weight,style:r.style,decoration:r.decoration,size:J}}if(z[0].token==="*"){z.shift();if(z[0].type==="number"){return C()}else{j("Expected font size number after *.",D,I)}}if(z[0].type==="number"){return C()}var u=[];var B;var y="normal";var G="normal";var v="none";var w=false;var s="face";var t=false;while(z.length){var F=z.shift();var H=F.token.toLowerCase();switch(s){case"face":if(t||(H!=="utf"&&F.type!=="number"&&H!=="bold"&&H!=="italic"&&H!=="underline"&&H!=="box")){if(u.length>0&&F.token==="-"){t=true;u[u.length-1]=u[u.length-1]+F.token}else{if(t){t=false;u[u.length-1]=u[u.length-1]+F.token}else{u.push(F.token)}}}else{if(F.type==="number"){if(B){j("Font size specified twice in font definition.",D,I)}else{B=F.token}s="modifier"}else{if(H==="bold"){y="bold"}else{if(H==="italic"){G="italic"}else{if(H==="underline"){v="underline"}else{if(H==="box"){if(a[E]){w=true}else{j('This font style doesn\'t support "box"',D,I)}s="finished"}else{if(H==="utf"){F=z.shift();s="size"}else{j("Unknown parameter "+F.token+" in font definition.",D,I)}}}}}}}break;case"size":if(F.type==="number"){if(B){j("Font size specified twice in font definition.",D,I)}else{B=F.token}}else{j("Expected font size in font definition.",D,I)}s="modifier";break;case"modifier":if(H==="bold"){y="bold"}else{if(H==="italic"){G="italic"}else{if(H==="underline"){v="underline"}else{if(H==="box"){if(a[E]){w=true}else{j('This font style doesn\'t support "box"',D,I)}s="finished"}else{j("Unknown parameter "+F.token+" in font definition.",D,I)}}}}break;case"finished":j('Extra characters found after "box" in font definition.',D,I);break}}if(B===undefined){if(!r){j("Must specify the size of the font since there is no default value.",D,I);B=12}else{B=r.size}}else{B=parseFloat(B)}u=u.join(" ");var x=d(u);var A={};if(x){A.face=x.face;A.weight=x.weight;A.style=x.style;A.decoration=x.decoration;A.size=B;if(w){A.box=true}return A}A.face=u;A.weight=y;A.style=G;A.decoration=v;A.size=B;if(w){A.box=true}return A};var f=function(r,s,t){if(s.length===0){return'Directive "'+r+'" requires a font as a parameter.'}e[r]=q(s,e[r],t,0,r);return null};var l=function(r,s,t){if(s.length===0){return'Directive "'+r+'" requires a font as a parameter.'}g.formatting[r]=q(s,g.formatting[r],t,0,r);return null};var n=function(t,u){var s="";window.ABCJS.parse.each(u,function(v){s+=v.token});var r=parseFloat(s);if(isNaN(r)||r===0){return'Directive "'+t+'" requires a number as a parameter.'}g.formatting.scale=r};var m=function(s,t){var r=p.getMeasurement(t);if(r.used===0||t.length!==0){return{error:'Directive "'+s+'" requires a measurement as a parameter.'}}return r.value};var k=function(s,t){var r=p.getMeasurement(t);if(r.used===0||t.length!==0){return'Directive "'+s+'" requires a measurement as a parameter.'}g.formatting[s]=r.value;return null};var c=function(u,v,w,t,r){if(w.length!==1||w[0].type!=="number"){return'Directive "'+v+'" requires a number as a parameter.'}var s=w[0].intt;if(t!==undefined&&sr){return'Directive "'+v+'" requires a number less than or equal to '+r+" as a parameter."}e[u]=s;return null};var b=function(r,s,t){var u=c(r,s,t,0,1);if(u!==null){return u}e[r]=(e[r]===1);return null};var i=function(t,v,w,x){if(w.length!==1){return'Directive "'+v+'" requires one of [ '+x.join(", ")+" ] as a parameter."}var r=w[0].token;var u=false;for(var s=0;!u&&s1&&e.setfont){var u=[{text:r[0]}];for(var s=1;s1){return u}}return t};var h=["auto","above","below","hidden"];window.ABCJS.parse.parseDirective.addDirective=function(R){var P=p.tokenize(R,0,R.length);if(P.length===0||P[0].type!=="alpha"){return null}var s=R.substring(R.indexOf(P[0].token)+P[0].token.length);s=p.stripComment(s);var ac=P.shift().token.toLowerCase();var w="";switch(ac){case"bagpipes":g.formatting.bagpipes=true;break;case"landscape":e.landscape=true;break;case"papersize":e.papersize=s;break;case"slurgraces":g.formatting.slurgraces=true;break;case"stretchlast":g.formatting.stretchlast=true;break;case"titlecaps":e.titlecaps=true;break;case"titleleft":g.formatting.titleleft=true;break;case"measurebox":g.formatting.measurebox=true;break;case"vocal":return i("vocalPosition",ac,P,h);case"dynamic":return i("dynamicPosition",ac,P,h);case"gchord":return i("chordPosition",ac,P,h);case"ornament":return i("ornamentPosition",ac,P,h);case"volume":return i("volumePosition",ac,P,h);case"botmargin":case"botspace":case"composerspace":case"indent":case"leftmargin":case"linesep":case"musicspace":case"partsspace":case"pageheight":case"pagewidth":case"rightmargin":case"staffsep":case"staffwidth":case"subtitlespace":case"sysstaffsep":case"systemsep":case"textspace":case"titlespace":case"topmargin":case"topspace":case"vocalspace":case"wordsspace":return k(ac,P);case"vskip":var v=m(ac,P);if(v.error){return v.error}g.addSpacing(v);return null;case"scale":n(ac,P);break;case"sep":if(P.length===0){g.addSeparator()}else{var V=p.getMeasurement(P);if(V.used===0){return'Directive "'+ac+'" requires 3 numbers: space above, space below, length of line'}var N=V.value;V=p.getMeasurement(P);if(V.used===0){return'Directive "'+ac+'" requires 3 numbers: space above, space below, length of line'}var ah=V.value;V=p.getMeasurement(P);if(V.used===0||P.length!==0){return'Directive "'+ac+'" requires 3 numbers: space above, space below, length of line'}var J=V.value;g.addSeparator(N,ah,J)}break;case"barsperstaff":w=c("barsperstaff",ac,P);if(w!==null){return w}break;case"staffnonote":w=b("staffnonote",ac,P);if(w!==null){return w}break;case"printtempo":w=b("printTempo",ac,P);if(w!==null){return w}break;case"partsbox":w=b("partsBox",ac,P);if(w!==null){return w}break;case"measurenb":case"barnumbers":w=c("barNumbers",ac,P);if(w!==null){return w}break;case"begintext":e.inTextBlock=true;break;case"continueall":e.continueall=true;break;case"beginps":e.inPsBlock=true;j("Postscript ignored",R,0);break;case"deco":if(s.length>0){e.ignoredDecorations.push(s.substring(0,s.indexOf(" ")))}j("Decoration redefinition ignored",R,0);break;case"text":var Z=p.translateString(s);g.addText(window.ABCJS.parse.parseDirective.parseFontChangeLine(Z));
break;case"center":var r=p.translateString(s);g.addCentered(window.ABCJS.parse.parseDirective.parseFontChangeLine(r));break;case"font":break;case"setfont":var G=p.tokenize(s,0,s.length);if(G.length>=4){if(G[0].token==="-"&&G[1].type==="number"){var u=parseInt(G[1].token);if(u>=1&&u<=4){if(!e.setfont){e.setfont=[]}G.shift();G.shift();e.setfont[u]=q(G,e.setfont[u],R,0,"setfont")}}}break;case"gchordfont":case"partsfont":case"vocalfont":case"textfont":case"annotationfont":case"historyfont":case"infofont":case"measurefont":case"repeatfont":case"wordsfont":return f(ac,P,R);case"composerfont":case"subtitlefont":case"tempofont":case"titlefont":case"voicefont":case"footerfont":case"headerfont":return l(ac,P,R);case"barlabelfont":case"barnumberfont":case"barnumfont":return f("measurefont",P,R);case"staves":case"score":e.score_is_present=true;var ag=function(am,aj,al,ak,ai){if(aj||e.staves.length===0){e.staves.push({index:e.staves.length,numVoices:0})}var t=window.ABCJS.parse.last(e.staves);if(al!==undefined){t.bracket=al}if(ak!==undefined){t.brace=ak}if(ai){t.connectBarLines="end"}if(e.voices[am]===undefined){e.voices[am]={staffNum:t.index,index:t.numVoices};t.numVoices++}};var T=false;var ab=false;var A=false;var U=false;var y=false;var B=false;var z=false;var D;var af=function(){z=true;if(D){var t="start";if(D.staffNum>0){if(e.staves[D.staffNum-1].connectBarLines==="start"||e.staves[D.staffNum-1].connectBarLines==="continue"){t="continue"}}e.staves[D.staffNum].connectBarLines=t}};while(P.length){var W=P.shift();switch(W.token){case"(":if(T){j("Can't nest parenthesis in %%score",R,W.start)}else{T=true;U=true}break;case")":if(!T||U){j("Unexpected close parenthesis in %%score",R,W.start)}else{T=false}break;case"[":if(ab){j("Can't nest brackets in %%score",R,W.start)}else{ab=true;y=true}break;case"]":if(!ab||y){j("Unexpected close bracket in %%score",R,W.start)}else{ab=false;e.staves[D.staffNum].bracket="end"}break;case"{":if(A){j("Can't nest braces in %%score",R,W.start)}else{A=true;B=true}break;case"}":if(!A||B){j("Unexpected close brace in %%score",R,W.start)}else{A=false;e.staves[D.staffNum].brace="end"}break;case"|":af();break;default:var K="";while(W.type==="alpha"||W.type==="number"){K+=W.token;if(W.continueId){W=P.shift()}else{break}}var O=!T||U;var Q=y?"start":ab?"continue":undefined;var I=B?"start":A?"continue":undefined;ag(K,O,Q,I,z);U=false;y=false;B=false;z=false;D=e.voices[K];if(ac==="staves"){af()}break}}break;case"newpage":var E=p.getInt(s);g.addNewPage(E.digits===0?-1:E.value);break;case"abc":var H=s.split(" ");switch(H[0]){case"-copyright":case"-creator":case"-edited-by":case"-version":case"-charset":var x=H.shift();g.addMetaText(ac+x,H.join(" "));break;default:return"Unknown directive: "+ac+H[0]}break;case"header":case"footer":var X=p.getMeat(s,0,s.length);X=s.substring(X.start,X.end);if(X.charAt(0)==='"'&&X.charAt(X.length-1)==='"'){X=X.substring(1,X.length-1)}var L=X.split("\t");var C={};if(L.length===1){C={left:"",center:L[0],right:""}}else{if(L.length===2){C={left:L[0],center:L[1],right:""}}else{C={left:L[0],center:L[1],right:L[2]}}}if(L.length>3){j("Too many tabs in "+ac+": "+L.length+" found.",s,0)}g.addMetaTextObj(ac,C);break;case"midi":var aa=p.tokenize(s,0,s.length);if(aa.length>0&&aa[0].token==="="){aa.shift()}if(aa.length===0){j("Expected midi command",s,0)}else{var F=function(ai){if(ai.length>0){var aj=ai.shift();var ak=aj.token;if(aj.type==="number"){ak=aj.intt}return ak}else{return null}};if(g.formatting[ac]===undefined){g.formatting[ac]={}}var M=aa.shift().token;var S=true;if(M==="program"){var ae=F(aa);if(ae){var ad=F(aa);if(ad){S={channel:ae,program:ad}}else{S={program:ae}}}}else{var Y=F(aa);if(Y!==null){S=Y}}g.formatting[ac][M]=S}break;case"playtempo":case"auquality":case"continuous":case"nobarcheck":g.formatting[ac]=s;break;default:return"Unknown directive: "+ac}return null};window.ABCJS.parse.parseDirective.globalFormatting=function(v){for(var t in v){if(v.hasOwnProperty(t)){var s=""+v[t];var u=p.tokenize(s,0,s.length);var r;switch(t){case"titlefont":case"gchordfont":f(t,u,s);break;case"scale":n(t,u);break;case"partsbox":r=b("partsBox",t,u);if(r!==null){j(r)}break;default:j("Formatting directive unrecognized: ",t,0)}}}}})();if(!window.ABCJS){window.ABCJS={}}if(!window.ABCJS.parse){window.ABCJS.parse={}}window.ABCJS.parse.ParseHeader=function(c,e,a,d){this.reset=function(g,i,f,h){window.ABCJS.parse.parseKeyVoice.initialize(g,i,f,h);window.ABCJS.parse.parseDirective.initialize(g,i,f,h)};this.reset(c,e,a,d);this.setTitle=function(f){if(a.hasMainTitle){d.addSubtitle(c.translateString(c.stripComment(f)))}else{d.addMetaText("title",c.translateString(c.theReverser(c.stripComment(f))));a.hasMainTitle=true}};this.setMeter=function(n){n=c.stripComment(n);if(n==="C"){if(a.havent_set_length===true){a.default_length=0.125}return{type:"common_time"}}else{if(n==="C|"){if(a.havent_set_length===true){a.default_length=0.125}return{type:"cut_time"}}else{if(n==="o"){if(a.havent_set_length===true){a.default_length=0.125}return{type:"tempus_perfectum"}}else{if(n==="c"){if(a.havent_set_length===true){a.default_length=0.125}return{type:"tempus_imperfectum"}}else{if(n==="o."){if(a.havent_set_length===true){a.default_length=0.125}return{type:"tempus_perfectum_prolatio"}}else{if(n==="c."){if(a.havent_set_length===true){a.default_length=0.125}return{type:"tempus_imperfectum_prolatio"}}else{if(n.length===0||n.toLowerCase()==="none"){if(a.havent_set_length===true){a.default_length=0.125}return null}else{var k=c.tokenize(n,0,n.length);try{var j=function(){var p={value:0,num:""};var o=k.shift();if(o.token==="("){o=k.shift()}while(1){if(o.type!=="number"){throw"Expected top number of meter"}p.value+=parseInt(o.token);p.num+=o.token;if(k.length===0||k[0].token==="/"){return p}o=k.shift();if(o.token===")"){if(k.length===0||k[0].token==="/"){return p}throw"Unexpected paren in meter"}if(o.token!=="."&&o.token!=="+"){throw"Expected top number of meter"}p.num+=o.token;if(k.length===0){throw"Expected top number of meter"}o=k.shift()}return p};var f=function(){var p=j();if(k.length===0){return p}var o=k.shift();if(o.token!=="/"){throw"Expected slash in meter"}o=k.shift();if(o.type!=="number"){throw"Expected bottom number of meter"}p.den=o.token;p.value=p.value/parseInt(p.den);return p};if(k.length===0){throw"Expected meter definition in M: line"}var g={type:"specified",value:[]};var l=0;while(1){var i=f();l+=i.value;var m={num:i.num};if(i.den!==undefined){m.den=i.den}g.value.push(m);if(k.length===0){break}}if(a.havent_set_length===true){a.default_length=l<0.75?0.0625:0.125}return g}catch(h){e(h,n,0)}}}}}}}}return null};this.calcTempo=function(f){var h=1/4;if(a.meter&&a.meter.type==="specified"){h=1/parseInt(a.meter.value[0].den)}else{if(a.origMeter&&a.origMeter.type==="specified"){h=1/parseInt(a.origMeter.value[0].den)}}for(var g=0;g0){a.default_length=j/i;a.havent_set_length=false}}};this.setTempo=function(o,f,i){try{var l=c.tokenize(o,f,i);if(l.length===0){throw"Missing parameter in Q: field"}var j={};var n=true;var h=l.shift();if(h.type==="quote"){j.preString=h.token;h=l.shift();if(l.length===0){return{type:"immediate",tempo:j}}}if(h.type==="alpha"&&h.token==="C"){if(l.length===0){throw"Missing tempo after C in Q: field"}h=l.shift();if(h.type==="punct"&&h.token==="="){if(l.length===0){throw"Missing tempo after = in Q: field"}h=l.shift();if(h.type!=="number"){throw"Expected number after = in Q: field"}j.duration=[1];j.bpm=parseInt(h.token)}else{if(h.type==="number"){j.duration=[parseInt(h.token)];if(l.length===0){throw"Missing = after duration in Q: field"}h=l.shift();if(h.type!=="punct"||h.token!=="="){throw"Expected = after duration in Q: field"}if(l.length===0){throw"Missing tempo after = in Q: field"}h=l.shift();if(h.type!=="number"){throw"Expected number after = in Q: field"}j.bpm=parseInt(h.token)}else{throw"Expected number or equal after C in Q: field"}}}else{if(h.type==="number"){var k=parseInt(h.token);if(l.length===0||l[0].type==="quote"){j.duration=[1];j.bpm=k}else{n=false;h=l.shift();if(h.type!=="punct"&&h.token!=="/"){throw"Expected fraction in Q: field"}h=l.shift();if(h.type!=="number"){throw"Expected fraction in Q: field"}var m=parseInt(h.token);j.duration=[k/m];while(l.length>0&&l[0].token!=="="&&l[0].type!=="quote"){h=l.shift();if(h.type!=="number"){throw"Expected fraction in Q: field"}k=parseInt(h.token);h=l.shift();if(h.type!=="punct"&&h.token!=="/"){throw"Expected fraction in Q: field"}h=l.shift();if(h.type!=="number"){throw"Expected fraction in Q: field"}m=parseInt(h.token);j.duration.push(k/m)}h=l.shift();if(h.type!=="punct"&&h.token!=="="){throw"Expected = in Q: field"}h=l.shift();if(h.type!=="number"){throw"Expected tempo in Q: field"}j.bpm=parseInt(h.token)}}else{throw"Unknown value in Q: field"}}if(l.length!==0){h=l.shift();if(h.type==="quote"){j.postString=h.token;h=l.shift()}if(l.length!==0){throw"Unexpected string at end of Q: field"}}if(a.printTempo===false){j.suppress=true}return{type:n?"delaySet":"immediate",tempo:j}}catch(g){e(g,o,f);return{type:"none"}}};this.letter_to_inline_header=function(h,k){var g=c.eatWhiteSpace(h,k);k+=g;if(h.length>=k+5&&h.charAt(k)==="["&&h.charAt(k+2)===":"){var n=h.indexOf("]",k);switch(h.substring(k,k+3)){case"[I:":var l=window.ABCJS.parse.parseDirective.addDirective(h.substring(k+3,n));if(l){e(l,h,k)}return[n-k+1+g];case"[M:":var m=this.setMeter(h.substring(k+3,n));if(d.hasBeginMusic()&&m){d.appendStartingElement("meter",-1,-1,m)}else{a.meter=m}return[n-k+1+g];case"[K:":var f=window.ABCJS.parse.parseKeyVoice.parseKey(h.substring(k+3,n));if(f.foundClef&&d.hasBeginMusic()){d.appendStartingElement("clef",-1,-1,a.clef)}if(f.foundKey&&d.hasBeginMusic()){d.appendStartingElement("key",-1,-1,window.ABCJS.parse.parseKeyVoice.fixKey(a.clef,a.key))}return[n-k+1+g];case"[P:":d.appendElement("part",-1,-1,{title:h.substring(k+3,n)});return[n-k+1+g];case"[L:":this.setDefaultLength(h,k+3,n);return[n-k+1+g];case"[Q:":if(n>0){var j=this.setTempo(h,k+3,n);if(j.type==="delaySet"){d.appendElement("tempo",-1,-1,this.calcTempo(j.tempo))}else{if(j.type==="immediate"){d.appendElement("tempo",-1,-1,j.tempo)}}return[n-k+1+g,h.charAt(k+1),h.substring(k+3,n)]}break;case"[V:":if(n>0){window.ABCJS.parse.parseKeyVoice.parseVoice(h,k+3,n);return[n-k+1+g,h.charAt(k+1),h.substring(k+3,n)]}break;default:}}return[0]};this.letter_to_body_header=function(g,j){if(g.length>=j+3){switch(g.substring(j,j+2)){case"I:":var k=window.ABCJS.parse.parseDirective.addDirective(g.substring(j+2));if(k){e(k,g,j)}return[g.length];case"M:":var l=this.setMeter(g.substring(j+2));if(d.hasBeginMusic()&&l){d.appendStartingElement("meter",-1,-1,l)}return[g.length];case"K:":var f=window.ABCJS.parse.parseKeyVoice.parseKey(g.substring(j+2));if(f.foundClef&&d.hasBeginMusic()){d.appendStartingElement("clef",-1,-1,a.clef)}if(f.foundKey&&d.hasBeginMusic()){d.appendStartingElement("key",-1,-1,window.ABCJS.parse.parseKeyVoice.fixKey(a.clef,a.key))}return[g.length];case"P:":if(d.hasBeginMusic()){d.appendElement("part",-1,-1,{title:g.substring(j+2)})}return[g.length];case"L:":this.setDefaultLength(g,j+2,g.length);return[g.length];case"Q:":var m=g.indexOf("\x12",j+2);if(m===-1){m=g.length}var h=this.setTempo(g,j+2,m);if(h.type==="delaySet"){d.appendElement("tempo",-1,-1,this.calcTempo(h.tempo))}else{if(h.type==="immediate"){d.appendElement("tempo",-1,-1,h.tempo)}}return[m,g.charAt(j),window.ABCJS.parse.strip(g.substring(j+2))];case"V:":window.ABCJS.parse.parseKeyVoice.parseVoice(g,2,g.length);return[g.length,g.charAt(j),window.ABCJS.parse(g.substring(j+2))];default:}}return[0]};var b={A:"author",B:"book",C:"composer",D:"discography",F:"url",G:"group",I:"instruction",N:"notes",O:"origin",R:"rhythm",S:"source",W:"unalignedWords",Z:"transcription"};this.parseHeader=function(g){if(window.ABCJS.parse.startsWith(g,"%%")){var l=window.ABCJS.parse.parseDirective.addDirective(g.substring(2));if(l){e(l,g,2)}return{}}var j=g.indexOf("%");if(j>=0){g=g.substring(0,j)}g=g.replace(/\s+$/,"");if(g.length===0){return{}}if(g.length>=2){if(g.charAt(1)===":"){var k="";if(g.indexOf("\x12")>=0&&g.charAt(0)!=="w"){k=g.substring(g.indexOf("\x12")+1);g=g.substring(0,g.indexOf("\x12"))}var m=b[g.charAt(0)];if(m!==undefined){if(m==="unalignedWords"){d.addMetaTextArray(m,window.ABCJS.parse.parseDirective.parseFontChangeLine(c.translateString(c.stripComment(g.substring(2)))))}else{d.addMetaText(m,c.translateString(c.stripComment(g.substring(2))))}return{}}else{switch(g.charAt(0)){case"H":d.addMetaText("history",c.translateString(c.stripComment(g.substring(2))));a.is_in_history=true;break;case"K":this.resolveTempo();var f=window.ABCJS.parse.parseKeyVoice.parseKey(g.substring(2));if(!a.is_in_header&&d.hasBeginMusic()){if(f.foundClef){d.appendStartingElement("clef",-1,-1,a.clef)}if(f.foundKey){d.appendStartingElement("key",-1,-1,window.ABCJS.parse.parseKeyVoice.fixKey(a.clef,a.key))}}a.is_in_header=false;break;case"L":this.setDefaultLength(g,2,g.length);break;case"M":a.origMeter=a.meter=this.setMeter(g.substring(2));break;case"P":if(a.is_in_header){d.addMetaText("partOrder",c.translateString(c.stripComment(g.substring(2))))}else{a.partForNextLine=c.translateString(c.stripComment(g.substring(2)))
}break;case"Q":var h=this.setTempo(g,2,g.length);if(h.type==="delaySet"){a.tempo=h.tempo}else{if(h.type==="immediate"){d.metaText.tempo=h.tempo}}break;case"T":this.setTitle(g.substring(2));break;case"U":this.addUserDefinition(g,2,g.length);break;case"V":window.ABCJS.parse.parseKeyVoice.parseVoice(g,2,g.length);if(!a.is_in_header){return{newline:true}}break;case"s":return{symbols:true};case"w":return{words:true};case"X":break;case"E":case"m":e("Ignored header",g,0);break;default:if(k.length){k="\x12"+k}return{regular:true,str:g+k}}}if(k.length>0){return{recurse:true,str:k}}return{}}}return{regular:true,str:g}}};if(!window.ABCJS){window.ABCJS={}}if(!window.ABCJS.parse){window.ABCJS.parse={}}window.ABCJS.parse.parseKeyVoice={};(function(){var i;var f;var b;var e;window.ABCJS.parse.parseKeyVoice.initialize=function(n,l,m,k){i=n;f=l;b=m;e=k};window.ABCJS.parse.parseKeyVoice.standardKey=function(x){var n={acc:"sharp",note:"f"};var s={acc:"sharp",note:"c"};var w={acc:"sharp",note:"g"};var l={acc:"sharp",note:"d"};var q={acc:"sharp",note:"A"};var v={acc:"sharp",note:"e"};var z={acc:"sharp",note:"B"};var u={acc:"flat",note:"B"};var t={acc:"flat",note:"e"};var r={acc:"flat",note:"A"};var p={acc:"flat",note:"d"};var o={acc:"flat",note:"G"};var m={acc:"flat",note:"c"};var k={acc:"flat",note:"F"};var y={"C#":[n,s,w,l,q,v,z],"A#m":[n,s,w,l,q,v,z],"G#Mix":[n,s,w,l,q,v,z],"D#Dor":[n,s,w,l,q,v,z],"E#Phr":[n,s,w,l,q,v,z],"F#Lyd":[n,s,w,l,q,v,z],"B#Loc":[n,s,w,l,q,v,z],"F#":[n,s,w,l,q,v],"D#m":[n,s,w,l,q,v],"C#Mix":[n,s,w,l,q,v],"G#Dor":[n,s,w,l,q,v],"A#Phr":[n,s,w,l,q,v],BLyd:[n,s,w,l,q,v],"E#Loc":[n,s,w,l,q,v],B:[n,s,w,l,q],"G#m":[n,s,w,l,q],"F#Mix":[n,s,w,l,q],"C#Dor":[n,s,w,l,q],"D#Phr":[n,s,w,l,q],ELyd:[n,s,w,l,q],"A#Loc":[n,s,w,l,q],E:[n,s,w,l],"C#m":[n,s,w,l],BMix:[n,s,w,l],"F#Dor":[n,s,w,l],"G#Phr":[n,s,w,l],ALyd:[n,s,w,l],"D#Loc":[n,s,w,l],A:[n,s,w],"F#m":[n,s,w],EMix:[n,s,w],BDor:[n,s,w],"C#Phr":[n,s,w],DLyd:[n,s,w],"G#Loc":[n,s,w],D:[n,s],Bm:[n,s],AMix:[n,s],EDor:[n,s],"F#Phr":[n,s],GLyd:[n,s],"C#Loc":[n,s],G:[n],Em:[n],DMix:[n],ADor:[n],BPhr:[n],CLyd:[n],"F#Loc":[n],C:[],Am:[],GMix:[],DDor:[],EPhr:[],FLyd:[],BLoc:[],F:[u],Dm:[u],CMix:[u],GDor:[u],APhr:[u],BbLyd:[u],ELoc:[u],Bb:[u,t],Gm:[u,t],FMix:[u,t],CDor:[u,t],DPhr:[u,t],EbLyd:[u,t],ALoc:[u,t],Eb:[u,t,r],Cm:[u,t,r],BbMix:[u,t,r],FDor:[u,t,r],GPhr:[u,t,r],AbLyd:[u,t,r],DLoc:[u,t,r],Ab:[u,t,r,p],Fm:[u,t,r,p],EbMix:[u,t,r,p],BbDor:[u,t,r,p],CPhr:[u,t,r,p],DbLyd:[u,t,r,p],GLoc:[u,t,r,p],Db:[u,t,r,p,o],Bbm:[u,t,r,p,o],AbMix:[u,t,r,p,o],EbDor:[u,t,r,p,o],FPhr:[u,t,r,p,o],GbLyd:[u,t,r,p,o],CLoc:[u,t,r,p,o],Gb:[u,t,r,p,o,m],Ebm:[u,t,r,p,o,m],DbMix:[u,t,r,p,o,m],AbDor:[u,t,r,p,o,m],BbPhr:[u,t,r,p,o,m],CbLyd:[u,t,r,p,o,m],FLoc:[u,t,r,p,o,m],Cb:[u,t,r,p,o,m,k],Abm:[u,t,r,p,o,m,k],GbMix:[u,t,r,p,o,m,k],DbDor:[u,t,r,p,o,m,k],EbPhr:[u,t,r,p,o,m,k],FbLyd:[u,t,r,p,o,m,k],BbLoc:[u,t,r,p,o,m,k],"A#":[u,t],"B#":[],"D#":[u,t,r],"E#":[u],"G#":[u,t,r,p],Gbm:[n,s,w,l,q,v,z]};return y[x]};var c={treble:{clef:"treble",pitch:4,mid:0},"treble+8":{clef:"treble+8",pitch:4,mid:0},"treble-8":{clef:"treble-8",pitch:4,mid:0},treble1:{clef:"treble",pitch:2,mid:2},treble2:{clef:"treble",pitch:4,mid:0},treble3:{clef:"treble",pitch:6,mid:-2},treble4:{clef:"treble",pitch:8,mid:-4},treble5:{clef:"treble",pitch:10,mid:-6},perc:{clef:"perc",pitch:6,mid:0},none:{clef:"none",mid:0},bass:{clef:"bass",pitch:8,mid:-12},"bass+8":{clef:"bass+8",pitch:8,mid:-12},"bass-8":{clef:"bass-8",pitch:8,mid:-12},"bass+16":{clef:"bass",pitch:8,mid:-12},"bass-16":{clef:"bass",pitch:8,mid:-12},bass1:{clef:"bass",pitch:2,mid:-6},bass2:{clef:"bass",pitch:4,mid:-8},bass3:{clef:"bass",pitch:6,mid:-10},bass4:{clef:"bass",pitch:8,mid:-12},bass5:{clef:"bass",pitch:10,mid:-14},tenor:{clef:"alto",pitch:8,mid:-8},tenor1:{clef:"alto",pitch:2,mid:-2},tenor2:{clef:"alto",pitch:4,mid:-4},tenor3:{clef:"alto",pitch:6,mid:-6},tenor4:{clef:"alto",pitch:8,mid:-8},tenor5:{clef:"alto",pitch:10,mid:-10},alto:{clef:"alto",pitch:6,mid:-6},alto1:{clef:"alto",pitch:2,mid:-2},alto2:{clef:"alto",pitch:4,mid:-4},alto3:{clef:"alto",pitch:6,mid:-6},alto4:{clef:"alto",pitch:8,mid:-8},alto5:{clef:"alto",pitch:10,mid:-10},"alto+8":{clef:"alto+8",pitch:6,mid:-6},"alto-8":{clef:"alto-8",pitch:6,mid:-6}};var j=function(n,k){var m=c[n];var l=m?m.mid:0;return l+k};window.ABCJS.parse.parseKeyVoice.fixClef=function(l){var k=c[l.type];if(k){l.clefPos=k.pitch;l.type=k.clef}};window.ABCJS.parse.parseKeyVoice.deepCopyKey=function(l){var k={accidentals:[],root:l.root,acc:l.acc,mode:l.mode};window.ABCJS.parse.each(l.accidentals,function(m){k.accidentals.push(window.ABCJS.parse.clone(m))});return k};var d={A:5,B:6,C:0,D:1,E:2,F:3,G:4,a:12,b:13,c:7,d:8,e:9,f:10,g:11};window.ABCJS.parse.parseKeyVoice.addPosToKey=function(m,l){var k=m.verticalPos;window.ABCJS.parse.each(l.accidentals,function(n){var o=d[n.note];o=o-k;n.verticalPos=o});if(l.impliedNaturals){window.ABCJS.parse.each(l.impliedNaturals,function(n){var o=d[n.note];o=o-k;n.verticalPos=o})}if(k<-10){window.ABCJS.parse.each(l.accidentals,function(n){n.verticalPos-=7;if(n.verticalPos>=11||(n.verticalPos===10&&n.acc==="flat")){n.verticalPos-=7}if(n.note==="A"&&n.acc==="sharp"){n.verticalPos-=7}if((n.note==="G"||n.note==="F")&&n.acc==="flat"){n.verticalPos-=7}});if(l.impliedNaturals){window.ABCJS.parse.each(l.impliedNaturals,function(n){n.verticalPos-=7;if(n.verticalPos>=11||(n.verticalPos===10&&n.acc==="flat")){n.verticalPos-=7}if(n.note==="A"&&n.acc==="sharp"){n.verticalPos-=7}if((n.note==="G"||n.note==="F")&&n.acc==="flat"){n.verticalPos-=7}})}}else{if(k<-4){window.ABCJS.parse.each(l.accidentals,function(n){n.verticalPos-=7;if(k===-8&&(n.note==="f"||n.note==="g")&&n.acc==="sharp"){n.verticalPos-=7}});if(l.impliedNaturals){window.ABCJS.parse.each(l.impliedNaturals,function(n){n.verticalPos-=7;if(k===-8&&(n.note==="f"||n.note==="g")&&n.acc==="sharp"){n.verticalPos-=7}})}}else{if(k>=7){window.ABCJS.parse.each(l.accidentals,function(n){n.verticalPos+=7});if(l.impliedNaturals){window.ABCJS.parse.each(l.impliedNaturals,function(n){n.verticalPos+=7})}}}}};window.ABCJS.parse.parseKeyVoice.fixKey=function(m,k){var l=window.ABCJS.parse.clone(k);window.ABCJS.parse.parseKeyVoice.addPosToKey(m,l);return l};var a=function(m){var k=d[m.charAt(0)];for(var l=1;l0){D.foundKey=true;var n="";var v="";if(w[0].token.length>1){w[0].token=w[0].token.substring(1)}else{w.shift()}var E=p.token;if(w.length>0){var l=i.getSharpFlat(w[0].token);if(l.len>0){if(w[0].token.length>1){w[0].token=w[0].token.substring(1)}else{w.shift()}E+=l.token;n=l.token}if(w.length>0){var C=i.getMode(w[0].token);if(C.len>0){w.shift();E+=C.token;v=C.token}}}var s=window.ABCJS.parse.parseKeyVoice.deepCopyKey(b.key);b.key=window.ABCJS.parse.parseKeyVoice.deepCopyKey({accidentals:window.ABCJS.parse.parseKeyVoice.standardKey(E)});b.key.root=p.token;b.key.acc=n;b.key.mode=v;if(s){var m;for(var z=0;z0){switch(w[0].token){case"m":case"middle":w.shift();if(w.length===0){f("Expected = after middle",x,0);return D}o=w.shift();if(o.token!=="="){f("Expected = after middle",x,o.start);break}if(w.length===0){f("Expected parameter after middle=",x,0);return D}var r=i.getPitchFromTokens(w);if(r.warn){f(r.warn,x,0)}if(r.position){b.clef.verticalPos=r.position-6}break;case"transpose":w.shift();if(w.length===0){f("Expected = after transpose",x,0);return D}o=w.shift();if(o.token!=="="){f("Expected = after transpose",x,o.start);break}if(w.length===0){f("Expected parameter after transpose=",x,0);return D}if(w[0].type!=="number"){f("Expected number after transpose",x,w[0].start);break}b.clef.transpose=w[0].intt;w.shift();break;case"stafflines":w.shift();if(w.length===0){f("Expected = after stafflines",x,0);return D}o=w.shift();if(o.token!=="="){f("Expected = after stafflines",x,o.start);break}if(w.length===0){f("Expected parameter after stafflines=",x,0);return D}if(w[0].type!=="number"){f("Expected number after stafflines",x,w[0].start);break}b.clef.stafflines=w[0].intt;w.shift();break;case"staffscale":w.shift();if(w.length===0){f("Expected = after staffscale",x,0);return D}o=w.shift();if(o.token!=="="){f("Expected = after staffscale",x,o.start);break}if(w.length===0){f("Expected parameter after staffscale=",x,0);return D}if(w[0].type!=="number"){f("Expected number after staffscale",x,w[0].start);break}b.clef.staffscale=w[0].floatt;w.shift();break;case"style":w.shift();if(w.length===0){f("Expected = after style",x,0);return D}o=w.shift();if(o.token!=="="){f("Expected = after style",x,o.start);break}if(w.length===0){f("Expected parameter after style=",x,0);return D}switch(w[0].token){case"normal":case"harmonic":case"rhythm":case"x":b.style=w[0].token;w.shift();break;default:f("error parsing style element: "+w[0].token,x,w[0].start);break}break;case"clef":w.shift();if(w.length===0){f("Expected = after clef",x,0);return D}o=w.shift();if(o.token!=="="){f("Expected = after clef",x,o.start);break}if(w.length===0){f("Expected parameter after clef=",x,0);return D}case"treble":case"bass":case"alto":case"tenor":case"perc":var y=w.shift();switch(y.token){case"treble":case"tenor":case"alto":case"bass":case"perc":case"none":break;case"C":y.token="alto";break;case"F":y.token="bass";break;case"G":y.token="treble";break;case"c":y.token="alto";break;case"f":y.token="bass";break;case"g":y.token="treble";break;default:f("Expected clef name. Found "+y.token,x,y.start);break}if(w.length>0&&w[0].type==="number"){y.token+=w[0].token;w.shift()}if(w.length>1&&(w[0].token==="-"||w[0].token==="+")&&w[1].token==="8"){y.token+=w[0].token+w[1].token;w.shift();w.shift()}b.clef={type:y.token,verticalPos:j(y.token,0)};D.foundClef=true;break;default:f("Unknown parameter: "+w[0].token,x,w[0].start);w.shift()}}return D};var g=function(k){b.currentVoice=b.voices[k];e.setCurrentVoice(b.currentVoice.staffNum,b.currentVoice.index)};window.ABCJS.parse.parseKeyVoice.parseVoice=function(n,x,y){var C=i.getMeat(n,x,y);var l=C.start;var k=C.end;var r=i.getToken(n,l,k);if(r.length===0){f("Expected a voice id",n,l);return}var A=false;if(b.voices[r]===undefined){b.voices[r]={};A=true;if(b.score_is_present){f("Can't have an unknown V: id when the %score directive is present",n,l)}}l+=r.length;l+=i.eatWhiteSpace(n,l);var p={startStaff:A};var D=function(v){var s=i.getVoiceToken(n,l,k);if(s.warn!==undefined){f("Expected value for "+v+" in voice: "+s.warn,n,l)}else{if(s.token.length===0&&n.charAt(l)!=='"'){f("Expected value for "+v+" in voice",n,l)}else{p[v]=s.token}}l+=s.len};var z=function(F,v,E){var s=i.getVoiceToken(n,l,k);if(s.warn!==undefined){f("Expected value for "+v+" in voice: "+s.warn,n,l)}else{if(s.token.length===0&&n.charAt(l)!=='"'){f("Expected value for "+v+" in voice",n,l)}else{if(E==="number"){s.token=parseFloat(s.token)}b.voices[F][v]=s.token}}l+=s.len};while(l=j.length};this.eatWhiteSpace=function(h,j){for(var k=j;k="a"&&i.charAt(m)<="z")||(i.charAt(m)>="A"&&i.charAt(m)<="Z"))){m++}return m};var j=this.skipWhiteSpace(l);if(g(l,j)){return{len:0}}var h=l.substring(j,j+3).toLowerCase();if(h.length>1&&h.charAt(1)===" "||h.charAt(1)==="^"||h.charAt(1)==="_"||h.charAt(1)==="="){h=h.charAt(0)}switch(h){case"mix":return{len:k(l,j),token:"Mix"};case"dor":return{len:k(l,j),token:"Dor"};case"phr":return{len:k(l,j),token:"Phr"};case"lyd":return{len:k(l,j),token:"Lyd"};case"loc":return{len:k(l,j),token:"Loc"};case"aeo":return{len:k(l,j),token:"m"};case"maj":return{len:k(l,j),token:""};case"ion":return{len:k(l,j),token:""};case"min":return{len:k(l,j),token:"m"};case"m":return{len:k(l,j),token:"m"}}return{len:0}};this.getClef=function(o,n){var h=o;var m=this.skipWhiteSpace(o);if(g(o,m)){return{len:0}}var q=false;var p=o.substring(m);if(window.ABCJS.parse.startsWith(p,"clef=")){q=true;p=p.substring(5);m+=5}if(p.length===0&&q){return{len:m+5,warn:"No clef specified: "+h}}var l=this.skipWhiteSpace(p);if(g(p,l)){return{len:0}}if(l>0){m+=l;p=p.substring(l)}var k=null;if(window.ABCJS.parse.startsWith(p,"treble")){k="treble"}else{if(window.ABCJS.parse.startsWith(p,"bass3")){k="bass3"}else{if(window.ABCJS.parse.startsWith(p,"bass")){k="bass"}else{if(window.ABCJS.parse.startsWith(p,"tenor")){k="tenor"}else{if(window.ABCJS.parse.startsWith(p,"alto2")){k="alto2"}else{if(window.ABCJS.parse.startsWith(p,"alto1")){k="alto1"}else{if(window.ABCJS.parse.startsWith(p,"alto")){k="alto"}else{if(!n&&(q&&window.ABCJS.parse.startsWith(p,"none"))){k="none"}else{if(window.ABCJS.parse.startsWith(p,"perc")){k="perc"}else{if(!n&&(q&&window.ABCJS.parse.startsWith(p,"C"))){k="tenor"}else{if(!n&&(q&&window.ABCJS.parse.startsWith(p,"F"))){k="bass"}else{if(!n&&(q&&window.ABCJS.parse.startsWith(p,"G"))){k="treble"}else{return{len:m+5,warn:"Unknown clef specified: "+h}}}}}}}}}}}}}p=p.substring(k.length);l=this.isMatch(p,"+8");if(l>0){k+="+8"}else{l=this.isMatch(p,"-8");if(l>0){k+="-8"}}return{len:m+k.length,token:k,explicit:q}};this.getBarLine=function(h,k){switch(h.charAt(k)){case"]":++k;switch(h.charAt(k)){case"|":return{len:2,token:"bar_thick_thin"};case"[":++k;if((h.charAt(k)>="1"&&h.charAt(k)<="9")||h.charAt(k)==='"'){return{len:2,token:"bar_invisible"}}return{len:1,warn:"Unknown bar symbol"};default:return{len:1,token:"bar_invisible"}}break;case":":++k;switch(h.charAt(k)){case":":return{len:2,token:"bar_dbl_repeat"};case"|":++k;switch(h.charAt(k)){case"]":++k;switch(h.charAt(k)){case"|":++k;if(h.charAt(k)===":"){return{len:5,token:"bar_dbl_repeat"}}return{len:3,token:"bar_right_repeat"};default:return{len:3,token:"bar_right_repeat"}}break;case"|":++k;if(h.charAt(k)===":"){return{len:4,token:"bar_dbl_repeat"}}return{len:3,token:"bar_right_repeat"};default:return{len:2,token:"bar_right_repeat"}}break;default:return{len:1,warn:"Unknown bar symbol"}}break;case"[":++k;if(h.charAt(k)==="|"){++k;switch(h.charAt(k)){case":":return{len:3,token:"bar_left_repeat"};case"]":return{len:3,token:"bar_invisible"};default:return{len:2,token:"bar_thick_thin"}}}else{if((h.charAt(k)>="1"&&h.charAt(k)<="9")||h.charAt(k)==='"'){return{len:1,token:"bar_invisible"}}return{len:0}}break;case"|":++k;switch(h.charAt(k)){case"]":return{len:2,token:"bar_thin_thick"};case"|":++k;if(h.charAt(k)===":"){return{len:3,token:"bar_left_repeat"}}return{len:2,token:"bar_thin_thin"};case":":var j=0;while(h.charAt(k+j)===":"){j++}return{len:1+j,token:"bar_left_repeat"};default:return{len:1,token:"bar_thin"}}break}return{len:0}};this.getTokenOf=function(k,j){for(var h=0;h0){var i;if(j[0].token==="^"){i="sharp";j.shift();if(j.length===0){return{accs:h,warn:"Expected note name after "+i}}switch(j[0].token){case"^":i="dblsharp";j.shift();break;case"/":i="quartersharp";j.shift();break}}else{if(j[0].token==="="){i="natural";j.shift()}else{if(j[0].token==="_"){i="flat";j.shift();if(j.length===0){return{accs:h,warn:"Expected note name after "+i}
}switch(j[0].token){case"_":i="dblflat";j.shift();break;case"/":i="quarterflat";j.shift();break}}else{return{accs:h}}}}if(j.length===0){return{accs:h,warn:"Expected note name after "+i}}switch(j[0].token.charAt(0)){case"a":case"b":case"c":case"d":case"e":case"f":case"g":case"A":case"B":case"C":case"D":case"E":case"F":case"G":if(h===undefined){h=[]}h.push({acc:i,note:j[0].token.charAt(0)});if(j[0].token.length===1){j.shift()}else{j[0].token=j[0].token.substring(1)}break;default:return{accs:h,warn:"Expected note name after "+i+" Found: "+j[0].token}}}return{accs:h}};this.getKeyAccidental=function(l){var k={"^":"sharp","^^":"dblsharp","=":"natural",_:"flat",__:"dblflat","_/":"quarterflat","^/":"quartersharp"};var h=this.skipWhiteSpace(l);if(g(l,h)){return{len:0}}var j=null;switch(l.charAt(h)){case"^":case"_":case"=":j=l.charAt(h);break;default:return{len:0}}h++;if(g(l,h)){return{len:1,warn:"Expected note name after accidental"}}switch(l.charAt(h)){case"a":case"b":case"c":case"d":case"e":case"f":case"g":case"A":case"B":case"C":case"D":case"E":case"F":case"G":return{len:h+1,token:{acc:k[j],note:l.charAt(h)}};case"^":case"_":case"/":j+=l.charAt(h);h++;if(g(l,h)){return{len:2,warn:"Expected note name after accidental"}}switch(l.charAt(h)){case"a":case"b":case"c":case"d":case"e":case"f":case"g":case"A":case"B":case"C":case"D":case"E":case"F":case"G":return{len:h+1,token:{acc:k[j],note:l.charAt(h)}};default:return{len:2,warn:"Expected note name after accidental"}}break;default:return{len:1,warn:"Expected note name after accidental"}}};this.isWhiteSpace=function(h){return h===" "||h==="\t"||h==="\x12"};this.getMeat=function(i,k,h){var j=i.indexOf("%",k);if(j>=0&&j="A"&&h<="Z")||(h>="a"&&h<="z")};var c=function(h){return(h>="0"&&h<="9")};this.tokenize=function(r,j,k){var n=this.getMeat(r,j,k);j=n.start;k=n.end;var p=[];var l;while(j=h){return{len:1,err:"Missing close quote"}}return{len:m-n+1,token:this.translateString(j.substring(k+1,m))}}else{var l=k;while(l=0){return window.ABCJS.parse.strip(j.substring(0,h))}return window.ABCJS.parse.strip(j)};this.getInt=function(l){var h=parseInt(l);if(isNaN(h)){return{digits:0}}var k=""+h;var j=l.indexOf(k);return{value:h,digits:j+k.length}};this.getFloat=function(l){var h=parseFloat(l);if(isNaN(h)){return{digits:0}}var k=""+h;var j=l.indexOf(k);return{value:h,digits:j+k.length}};this.getMeasurement=function(k){if(k.length===0){return{used:0}}var j=1;var i="";if(k[0].token==="-"){k.shift();i="-";j++}else{if(k[0].type!=="number"){return{used:0}}}i+=k.shift().token;if(k.length===0){return{used:1,value:parseInt(i)}}var h=k.shift();if(h.token==="."){j++;if(k.length===0){return{used:j,value:parseInt(i)}}if(k[0].type==="number"){h=k.shift();i=i+"."+h.token;j++;if(k.length===0){return{used:j,value:parseFloat(i)}}}h=k.shift()}switch(h.token){case"pt":return{used:j+1,value:parseFloat(i)};case"cm":return{used:j+1,value:parseFloat(i)/2.54*72};case"in":return{used:j+1,value:parseFloat(i)*72};default:k.unshift(h);return{used:j,value:parseFloat(i)}}return{used:0}};var a=function(h){while(h.indexOf("\\n")!==-1){h=h.replace("\\n","\n")}return h};this.getBrackettedSubstring=function(h,j,n,l){var k=l||h.charAt(j);var m=j+1;while((mh.length-1){m=h.length-1}return[m-j+1,a(h.substring(j+1,m)),false]}}};if(!window.ABCJS){window.ABCJS={}}if(!window.ABCJS.write){window.ABCJS.write={}}ABCJS.write.AbsoluteElement=function(d,c,b,a){this.abcelem=d;this.duration=c;this.minspacing=b||0;this.x=0;this.children=[];this.heads=[];this.extra=[];this.extraw=0;this.w=0;this.right=[];this.invisible=false;this.bottom=undefined;this.top=undefined;this.type=a;this.specialY={tempoHeightAbove:0,partHeightAbove:0,volumeHeightAbove:0,dynamicHeightAbove:0,endingHeightAbove:0,chordHeightAbove:0,lyricHeightAbove:0,lyricHeightBelow:0,chordHeightBelow:0,volumeHeightBelow:0,dynamicHeightBelow:0}};ABCJS.write.AbsoluteElement.prototype.setUpperAndLowerElements=function(c){for(var b=0;bthis.w){this.w=a.dx+a.w}this.right[this.right.length]=a;this.addChild(a)};ABCJS.write.AbsoluteElement.prototype.setLimit=function(b,a){if(!a[b]){return}if(!this.specialY[b]){this.specialY[b]=a[b]}else{this.specialY[b]=Math.max(this.specialY[b],a[b])}};ABCJS.write.AbsoluteElement.prototype.addChild=function(a){a.parent=this;this.children[this.children.length]=a;this.pushTop(a.top);this.pushBottom(a.bottom);this.setLimit("tempoHeightAbove",a);this.setLimit("partHeightAbove",a);this.setLimit("volumeHeightAbove",a);this.setLimit("dynamicHeightAbove",a);this.setLimit("endingHeightAbove",a);this.setLimit("chordHeightAbove",a);this.setLimit("lyricHeightAbove",a);this.setLimit("lyricHeightBelow",a);this.setLimit("chordHeightBelow",a);this.setLimit("volumeHeightBelow",a);this.setLimit("dynamicHeightBelow",a)};ABCJS.write.AbsoluteElement.prototype.pushTop=function(a){if(a!==undefined){if(this.top===undefined){this.top=a}else{this.top=Math.max(a,this.top)}}};ABCJS.write.AbsoluteElement.prototype.pushBottom=function(a){if(a!==undefined){if(this.bottom===undefined){this.bottom=a}else{this.bottom=Math.min(a,this.bottom)}}};ABCJS.write.AbsoluteElement.prototype.setX=function(a){this.x=a;for(var b=0;b0){if(a.length>0&&a.charAt(a.length-1)!==" "){a+=" "}a+=d}this.elemset[c][0].setAttribute("class",a)}}}};ABCJS.write.AbsoluteElement.prototype.highlight=function(a,b){if(a===undefined){a="note_selected"}if(b===undefined){b="#ff0000"}this.setClass(a,"",b)};ABCJS.write.AbsoluteElement.prototype.unhighlight=function(a,b){if(a===undefined){a="note_selected"}if(b===undefined){b="#000000"}this.setClass("",a,b)};if(!window.ABCJS){window.ABCJS={}}if(!window.ABCJS.write){window.ABCJS.write={}}(function(){ABCJS.write.getDuration=function(a){var b=0;if(a.duration){b=a.duration}return b};ABCJS.write.getDurlog=function(a){if(a===undefined){return 0}return Math.floor(Math.log(a)/Math.log(2))};ABCJS.write.AbstractEngraver=function(a,b){this.decoration=new ABCJS.write.Decoration();this.renderer=b;this.isBagpipes=a;this.chartable={rest:{0:"rests.whole",1:"rests.half",2:"rests.quarter",3:"rests.8th",4:"rests.16th",5:"rests.32nd",6:"rests.64th",7:"rests.128th"},note:{"-1":"noteheads.dbl",0:"noteheads.whole",1:"noteheads.half",2:"noteheads.quarter",3:"noteheads.quarter",4:"noteheads.quarter",5:"noteheads.quarter",6:"noteheads.quarter",7:"noteheads.quarter",nostem:"noteheads.quarter"},rhythm:{"-1":"noteheads.slash.whole",0:"noteheads.slash.whole",1:"noteheads.slash.whole",2:"noteheads.slash.quarter",3:"noteheads.slash.quarter",4:"noteheads.slash.quarter",5:"noteheads.slash.quarter",6:"noteheads.slash.quarter",7:"noteheads.slash.quarter",nostem:"noteheads.slash.nostem"},x:{"-1":"noteheads.indeterminate",0:"noteheads.indeterminate",1:"noteheads.indeterminate",2:"noteheads.indeterminate",3:"noteheads.indeterminate",4:"noteheads.indeterminate",5:"noteheads.indeterminate",6:"noteheads.indeterminate",7:"noteheads.indeterminate",nostem:"noteheads.indeterminate"},harmonic:{"-1":"noteheads.harmonic.quarter",0:"noteheads.harmonic.quarter",1:"noteheads.harmonic.quarter",2:"noteheads.harmonic.quarter",3:"noteheads.harmonic.quarter",4:"noteheads.harmonic.quarter",5:"noteheads.harmonic.quarter",6:"noteheads.harmonic.quarter",7:"noteheads.harmonic.quarter",nostem:"noteheads.harmonic.quarter"},uflags:{3:"flags.u8th",4:"flags.u16th",5:"flags.u32nd",6:"flags.u64th"},dflags:{3:"flags.d8th",4:"flags.d16th",5:"flags.d32nd",6:"flags.d64th"}};
this.reset()};ABCJS.write.AbstractEngraver.prototype.reset=function(){this.slurs={};this.ties=[];this.slursbyvoice={};this.tiesbyvoice={};this.endingsbyvoice={};this.s=0;this.v=0;this.tripletmultiplier=1;this.abcline=undefined;this.accidentalSlot=undefined;this.accidentalshiftx=undefined;this.dotshiftx=undefined;this.hasVocals=false;this.minY=undefined;this.partstartelem=undefined;this.pos=undefined;this.roomtaken=undefined;this.roomtakenright=undefined;this.staffgroup=undefined;this.startlimitelem=undefined;this.stemdir=undefined;this.voice=undefined};ABCJS.write.AbstractEngraver.prototype.setStemHeight=function(a){this.stemHeight=a/ABCJS.write.spacing.STEP};ABCJS.write.AbstractEngraver.prototype.getCurrentVoiceId=function(){return"s"+this.s+"v"+this.v};ABCJS.write.AbstractEngraver.prototype.pushCrossLineElems=function(){this.slursbyvoice[this.getCurrentVoiceId()]=this.slurs;this.tiesbyvoice[this.getCurrentVoiceId()]=this.ties;this.endingsbyvoice[this.getCurrentVoiceId()]=this.partstartelem};ABCJS.write.AbstractEngraver.prototype.popCrossLineElems=function(){this.slurs=this.slursbyvoice[this.getCurrentVoiceId()]||{};this.ties=this.tiesbyvoice[this.getCurrentVoiceId()]||[];this.partstartelem=this.endingsbyvoice[this.getCurrentVoiceId()]};ABCJS.write.AbstractEngraver.prototype.getElem=function(){if(this.abcline.length<=this.pos){return null}return this.abcline[this.pos]};ABCJS.write.AbstractEngraver.prototype.getNextElem=function(){if(this.abcline.length<=this.pos+1){return null}return this.abcline[this.pos+1]};ABCJS.write.AbstractEngraver.prototype.containsLyrics=function(e){for(var c=0;cc.pitches[d+1].pitch){a=false;var b=c.pitches[d];c.pitches[d]=c.pitches[d+1];c.pitches[d+1]=b}}}while(!a)};ABCJS.write.AbstractEngraver.prototype.createNote=function(T,d,ab){var s=null;var a=null;this.roomtaken=0;this.roomtakenright=0;var I=0;var ad="";var G=null;var t=[];var P,X,n;var b,aa,Z,f;var v=ABCJS.write.getDuration(T);var O=false;if(v===0){O=true;v=0.25;d=true}var C=Math.floor(Math.log(v)/Math.log(2));var af=0;for(var g=Math.pow(2,C),Y=g/2;g=6)?"down":"up";if(this.stemdir){ae=this.stemdir}var Q=T.style?T.style:this.style;if(!Q||Q==="normal"){Q="note"}var j;if(O){j=this.chartable[Q].nostem}else{j=this.chartable[Q][-C]}if(!j){console.log("noteSymbol:",Q,C,O)}for(P=(ae==="down")?T.pitches.length-2:1;(ae==="down")?P>=0:P11||J.verticalPos<1){t.push(J.verticalPos-(J.verticalPos%2))}if(ae==="down"){this.roomtaken=ABCJS.write.glyphs.getSymbolWidth(j)+2}else{I=ABCJS.write.glyphs.getSymbolWidth(j)+2}}}this.accidentalSlot=[];for(P=0;P6&&!this.stemdir){aa=6}Z=(ae==="down")?T.maxpitch-1/3:T.maxpitch+7;if(Z<6&&!this.stemdir){Z=6}f=(ae==="down"||h.heads.length===0)?0:h.heads[0].w;b=(ae==="down")?1:-1;if(s.c==="noteheads.slash.quarter"){if(ae==="down"){Z-=1}else{aa+=1}}h.addExtra(new ABCJS.write.RelativeElement(null,f,0,aa,{type:"stem",pitch2:Z,linewidth:b}));this.minY=Math.min(aa,this.minY);this.minY=Math.min(Z,this.minY)}}if(T.lyric!==undefined){var S="";window.ABCJS.parse.each(T.lyric,function(c){S+=c.syllable+c.divider+"\n"});var N=T.positioning?T.positioning.vocalPosition:"below";h.addRight(new ABCJS.write.RelativeElement(S,0,S.length*5,undefined,{type:"lyric",position:N}))}if(!ab&&T.gracenotes!==undefined){var A=3/5;var u=3.5/5;var k=null;if(T.gracenotes.length>1){k=new ABCJS.write.BeamElem(this.stemHeight*u,"grace",this.isBagpipes);k.mainNote=h}var ac=[];for(X=T.gracenotes.length-1;X>=0;X--){this.roomtaken+=10;ac[X]=this.roomtaken;if(T.gracenotes[X].accidental){this.roomtaken+=7}}for(X=0;X11;X--){if(X%2===0&&!T.rest){h.addChild(new ABCJS.write.RelativeElement(null,-2,ABCJS.write.glyphs.getSymbolWidth(ad)+4,X,{type:"ledger"}))}}for(X=T.minpitch;X<1;X++){if(X%2===0&&!T.rest){h.addChild(new ABCJS.write.RelativeElement(null,-2,ABCJS.write.glyphs.getSymbolWidth(ad)+4,X,{type:"ledger"}))}}for(X=0;X6):(g<6)){g=6}var r=(p==="down")?h:h+d.w-0.6;m.addRight(new ABCJS.write.RelativeElement(v,r,ABCJS.write.glyphs.getSymbolWidth(v)*C,g,{scalex:C,scaley:C}))}this.dotshiftx=d.w+y-2+5*q;for(;q>0;q--){var a=(1-Math.abs(k)%2);m.addRight(new ABCJS.write.RelativeElement("dots.dot",d.w+y-2+5*q,ABCJS.write.glyphs.getSymbolWidth("dots.dot"),k+a))}}}if(d){d.highestVert=B.highestVert}if(B.accidental){var b;switch(B.accidental){case"quartersharp":b="accidentals.halfsharp";break;case"dblsharp":b="accidentals.dblsharp";break;case"sharp":b="accidentals.sharp";break;case"quarterflat":b="accidentals.halfflat";break;case"flat":b="accidentals.flat";break;case"dblflat":b="accidentals.dblflat";break;case"natural":b="accidentals.nat"}var l=false;var x=e;for(var t=0;t=6){this.accidentalSlot[t][0]=k;x=this.accidentalSlot[t][1];l=true;break}}if(l===false){x-=(ABCJS.write.glyphs.getSymbolWidth(b)*C+2);this.accidentalSlot.push([k,x]);this.accidentalshiftx=(ABCJS.write.glyphs.getSymbolWidth(b)*C+2)}m.addExtra(new ABCJS.write.RelativeElement(b,x,ABCJS.write.glyphs.getSymbolWidth(b),k,{scalex:C,scaley:C}))}if(B.endTie){if(this.ties[0]){this.ties[0].setEndAnchor(d);this.ties=this.ties.slice(1,this.ties.length)}}if(B.startTie){var u=new ABCJS.write.TieElem(d,null,(this.stemdir==="down"||p==="down")&&this.stemdir!=="up",(this.stemdir==="down"||this.stemdir==="up"),true);this.ties[this.ties.length]=u;this.voice.addOther(u);m.startTie=true}if(B.endSlur){for(w=0;wthis.max){this.max=k.abcelem.maxpitch}};var c=6;ABCJS.write.BeamElem.prototype.calcDir=function(){if(this.forceup){return true}if(this.forcedown){return false}var k=g(this.total,this.elems.length);return kn){m=n}if(m<-n){m=-n}return m}function g(l,k){if(!k){return 0}return l/k}function b(m,l,o,n,k){return l+(n-l)/(o-m)*(k-m)}function d(l,m){var k=(l)?ABCJS.write.spacing.STEP:-ABCJS.write.spacing.STEP;if(m){k=k*0.4}return k}function e(q,m,k,p,o,l){k=q.calcY(k);o=q.calcY(o);var n="M"+m+" "+k+" L"+p+" "+o+"L"+p+" "+(o+l)+" L"+m+" "+(k+l)+"z";q.printPath({path:n,stroke:"none",fill:"#000000","class":q.addClasses("beam-elem")})}function a(p,n,q){var m=n.heads[p?0:n.heads.length-1];var l=q.heads[p?0:q.heads.length-1];var k=m.x;if(p){k+=m.w-0.6}var o=l.x;if(p){o+=l.w}return[k,o]}function i(x,o,p,y,r,n,v,l,z,s){var m=g(x,o);
var u=p-2;var k=p-2;var w=Math.round(y?Math.max(m+u,z+k):Math.min(m-u,l-k));var t=h(r,n,o,v);var q=w+Math.floor(t/2);var A=w+Math.floor(-t/2);if(!s){if(y&&w<6){q=6;A=6}else{if(!y&&w>6){q=6;A=6}}}return[q,A]}function f(k,v,y,z,t){for(var p=0;p=0;p--){if(q===l.length-1||ABCJS.write.getDurlog(l[q+1].abcelem.duration)>(-p-4)){var k=u;var A=s+t*(p+1);if(w[p].single){k=(q===0)?u+5:u-5;A=b(y.startX,y.startY,y.endX,y.endY,k)+t*(p+1)}o.push({startX:w[p].x,endX:k,startY:w[p].y,endY:A,dy:z});w=w.slice(0,p)}}}return o}})();if(!window.ABCJS){window.ABCJS={}}if(!window.ABCJS.write){window.ABCJS.write={}}(function(){ABCJS.write.createClef=function(e){var f;var c=0;var d=new ABCJS.write.AbsoluteElement(e,0,10,"staff-extra");switch(e.type){case"treble":f="clefs.G";break;case"tenor":f="clefs.C";break;case"alto":f="clefs.C";break;case"bass":f="clefs.F";break;case"treble+8":f="clefs.G";c=1;break;case"tenor+8":f="clefs.C";c=1;break;case"bass+8":f="clefs.F";c=1;break;case"alto+8":f="clefs.C";c=1;break;case"treble-8":f="clefs.G";c=-1;break;case"tenor-8":f="clefs.C";c=-1;break;case"bass-8":f="clefs.F";c=-1;break;case"alto-8":f="clefs.C";c=-1;break;case"none":return null;case"perc":f="clefs.perc";break;default:d.addChild(new ABCJS.write.RelativeElement("clef="+e.type,0,0,undefined,{type:"debug"}))}var b=5;if(f){d.addRight(new ABCJS.write.RelativeElement(f,b,ABCJS.write.glyphs.getSymbolWidth(f),e.clefPos));if(f==="clefs.G"){d.top=13;d.bottom=-1}else{d.top=10;d.bottom=2}if(c!==0){var g=2/3;var a=(ABCJS.write.glyphs.getSymbolWidth(f)-ABCJS.write.glyphs.getSymbolWidth("8")*g)/2;d.addRight(new ABCJS.write.RelativeElement("8",b+a,ABCJS.write.glyphs.getSymbolWidth("8")*g,(c>0)?d.top+3:d.bottom-1,{scalex:g,scaley:g}));d.top+=2}}return d}})();if(!window.ABCJS){window.ABCJS={}}if(!window.ABCJS.write){window.ABCJS.write={}}(function(){ABCJS.write.createKeySignature=function(c){if(!c.accidentals||c.accidentals.length===0){return null}var b=new ABCJS.write.AbsoluteElement(c,0,10,"staff-extra");var a=0;window.ABCJS.parse.each(c.accidentals,function(e){var d=(e.acc==="sharp")?"accidentals.sharp":(e.acc==="natural")?"accidentals.nat":"accidentals.flat";b.addRight(new ABCJS.write.RelativeElement(d,a,ABCJS.write.glyphs.getSymbolWidth(d),e.verticalPos,{thickness:ABCJS.write.glyphs.symbolHeightInPitches(d)}));a+=ABCJS.write.glyphs.getSymbolWidth(d)+2},this);return b}})();if(!window.ABCJS){window.ABCJS={}}if(!window.ABCJS.write){window.ABCJS.write={}}(function(){ABCJS.write.createTimeSignature=function(c){var b=new ABCJS.write.AbsoluteElement(c,0,10,"staff-extra");if(c.type==="specified"){for(var a=0;a9){h++}var l=g/2;if(ABCJS.write.glyphs.getSymbolAlign(k)!=="center"){l-=(ABCJS.write.glyphs.getSymbolWidth(k)/2)}s.addChild(new ABCJS.write.RelativeElement(k,l,ABCJS.write.glyphs.getSymbolWidth(k),h))}if(q[m]==="slide"&&s.heads[0]){var n=s.heads[0].pitch;n-=2;var r=new ABCJS.write.RelativeElement("",-t-15,0,n-1);var p=new ABCJS.write.RelativeElement("",-t-5,0,n+1);s.addChild(r);s.addChild(p);o.addOther(new ABCJS.write.TieElem(r,p,false,false,false))}}if(h===undefined){h=f}return{above:h,below:s.bottom}};var b=function(k,e,g,j){for(var f=0;fe){t=e}}return t}function s(v,t){var w=o(t);var i=2;var u=5;q.addChild(new ABCJS.write.RelativeElement(v,0,0,w+i,{type:"decoration",klass:"ornament",thickness:3}));h(t,u)}function l(v,u){var t=f/2;if(ABCJS.write.glyphs.getSymbolAlign(v)!=="center"){t-=(ABCJS.write.glyphs.getSymbolWidth(v)/2)}var i=ABCJS.write.glyphs.symbolHeightInPitches(v)+1;var w=o(u);w=(u==="above")?w+i/2:w-i/2;q.addChild(new ABCJS.write.RelativeElement(v,t,ABCJS.write.glyphs.getSymbolWidth(v),w,{klass:"ornament",thickness:ABCJS.write.glyphs.symbolHeightInPitches(v)}));h(u,i)}var m={"+":"scripts.stopped",open:"scripts.open",snap:"scripts.snap",wedge:"scripts.wedge",thumb:"scripts.thumb",shortphrase:"scripts.shortphrase",mediumphrase:"scripts.mediumphrase",longphrase:"scripts.longphrase",trill:"scripts.trill",roll:"scripts.roll",irishroll:"scripts.roll",marcato:"scripts.umarcato",dmarcato:"scripts.dmarcato",umarcato:"scripts.umarcato",turn:"scripts.turn",uppermordent:"scripts.prall",pralltriller:"scripts.prall",mordent:"scripts.mordent",lowermordent:"scripts.mordent",downbow:"scripts.downbow",upbow:"scripts.upbow",fermata:"scripts.ufermata",invertedfermata:"scripts.dfermata",breath:",",coda:"scripts.coda",segno:"scripts.segno"};var r=false;for(var k=0;k",k))}if(e){l.addOther(new ABCJS.write.CrescendoElem(e.start,e.stop,"<",k))}};ABCJS.write.Decoration.prototype.createDecoration=function(k,l,f,g,n,p,j,e,m,i){if(!m){m={ornamentPosition:"above",volumePosition:i?"above":"below",dynamicPosition:i?"above":"below"}}b(k,l,n,m.volumePosition);this.dynamicDecoration(k,l,n,m.dynamicPosition);a(l,f,g,n,j);var h=c(k,l,f,g,n,p,j,e);var o=d(l,g,n,h,m.ornamentPosition,this.minTop,this.minBottom);if(o){n.top=Math.max(h.above+3,n.top)}}})();if(!window.ABCJS){window.ABCJS={}}if(!window.ABCJS.write){window.ABCJS.write={}}ABCJS.write.DynamicDecoration=function(b,c,a){this.anchor=b;this.dec=c;if(a==="below"){this.volumeHeightBelow=5}else{this.volumeHeightAbove=5}this.pitch=undefined};ABCJS.write.DynamicDecoration.prototype.setUpperAndLowerElements=function(a){if(this.volumeHeightAbove){this.pitch=a.volumeHeightAbove}else{this.pitch=a.volumeHeightBelow}};ABCJS.write.DynamicDecoration.prototype.draw=function(d,e,a){if(this.pitch===undefined){window.console.error("Dynamic Element y-coordinate not set.")}var c=1;var b=1;d.printSymbol(this.anchor.x,this.pitch,this.dec,c,b,d.addClasses("decoration"))};if(!window.ABCJS){window.ABCJS={}}if(!window.ABCJS.write){window.ABCJS.write={}}ABCJS.write.EndingElem=function(c,b,a){this.text=c;this.anchor1=b;this.anchor2=a;this.endingHeightAbove=5;this.pitch=undefined};ABCJS.write.EndingElem.prototype.setUpperAndLowerElements=function(a){this.pitch=a.endingHeightAbove};ABCJS.write.EndingElem.prototype.draw=function(d,f,c){if(this.pitch===undefined){window.console.error("Ending Element y-coordinate not set.")}var e=d.calcY(this.pitch);var a=20;var b;if(this.anchor1){f=this.anchor1.x+this.anchor1.w;b=ABCJS.write.sprintf("M %f %f L %f %f",f,e,f,e+a);d.printPath({path:b,stroke:"#000000",fill:"#000000","class":d.addClasses("ending")});d.renderText(f+5,d.calcY(this.pitch-0.5),this.text,"repeatfont","ending","start")}if(this.anchor2){c=this.anchor2.x;b=ABCJS.write.sprintf("M %f %f L %f %f",c,e,c,e+a);d.printPath({path:b,stroke:"#000000",fill:"#000000","class":d.addClasses("ending")})}b=ABCJS.write.sprintf("M %f %f L %f %f",f,e,c,e);d.printPath({path:b,stroke:"#000000",fill:"#000000","class":d.addClasses("ending")})};if(!window.ABCJS){window.ABCJS={}}if(!window.ABCJS.write){window.ABCJS.write={}}ABCJS.write.spacing=function(){};ABCJS.write.spacing.FONTEM=360;ABCJS.write.spacing.FONTSIZE=30;ABCJS.write.spacing.STEP=ABCJS.write.spacing.FONTSIZE*93/720;ABCJS.write.spacing.SPACE=10;ABCJS.write.spacing.TOPNOTE=15;ABCJS.write.spacing.STAVEHEIGHT=100;ABCJS.write.spacing.INDENT=50;ABCJS.write.debugPlacement=false;ABCJS.write.EngraverController=function(b,a){a=a||{};this.space=3*ABCJS.write.spacing.SPACE;this.scale=a.scale||undefined;if(a.staffwidth){this.staffwidthScreen=a.staffwidth;this.staffwidthPrint=a.staffwidth}else{this.staffwidthScreen=740;this.staffwidthPrint=680}this.editable=a.editable||false;this.listeners=[];if(a.listener){this.addSelectListener(a.listener)}this.usingSvg=(window.SVGAngle||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?true:false);if(this.usingSvg&&a.add_classes){Raphael._availableAttrs["class"]=""}Raphael._availableAttrs["text-decoration"]="";this.renderer=new ABCJS.write.Renderer(b,a.regression);this.renderer.setPaddingOverride(a);this.renderer.controller=this;this.reset()};ABCJS.write.EngraverController.prototype.reset=function(){this.selected=[];this.ingroup=false;this.staffgroups=[];this.lastStaffGroupIndex=-1;if(this.engraver){this.engraver.reset()}this.engraver=null;this.renderer.reset()};ABCJS.write.EngraverController.prototype.engraveABC=function(a){if(a[0]===undefined){a=[a]}this.reset();for(var b=0;bf){f=a.staffGroup.w}}}for(e=0;e0){g=(h-f)/a;if(g*i>50){g=50/i}return g}return null}ABCJS.write.EngraverController.prototype.setXSpacing=function(d,b,e){var a=this.space;for(var c=0;c<3;c++){d.layout(a,this.renderer,false);var f=b.stretchlast?b.stretchlast:false;a=calcHorizontalSpacing(e,f,this.width+this.renderer.padding.left,d.w,a,d.spacingunits,d.minspace);if(a===null){break}}centerWholeRests(d.voices)};ABCJS.write.EngraverController.prototype.engraveStaffLine=function(b){if(this.lastStaffGroupIndex>-1){this.renderer.addStaffPadding(this.staffgroups[this.lastStaffGroupIndex],b)}b.draw(this.renderer);var a=b.height*ABCJS.write.spacing.STEP;this.staffgroups[this.staffgroups.length]=b;this.lastStaffGroupIndex=this.staffgroups.length-1;this.renderer.y+=a};ABCJS.write.EngraverController.prototype.notifySelect=function(b){this.clearSelection();if(b.highlight){this.selected=[b];b.highlight()}var c=b.abcelem||{};for(var a=0;ah&&bthis.top){this.top=this.pitch2}this.bottom=e;if(this.pitch2!==undefined&&this.pitch20){this.top+=d.stemHeight}else{this.bottom+=d.stemHeight}}this.centerVertically=false;var f;switch(this.type){case"debug":this.chordHeightAbove=3;break;case"lyric":f=this.c.split("\n").length;if(d.position&&d.position==="below"){this.lyricHeightBelow=3*f}else{this.lyricHeightAbove=3*f}break;case"chord":f=this.c.split("\n").length;if(d.position&&d.position==="below"){this.chordHeightBelow=4*f}else{this.chordHeightAbove=4*f}break;case"text":f=this.c.split("\n").length;if(this.pitch===undefined){if(d.position&&d.position==="below"){this.chordHeightBelow=4*f}else{this.chordHeightAbove=4*f}}else{this.centerVertically=true}break;case"part":this.partHeightAbove=6;break}};ABCJS.write.RelativeElement.prototype.setX=function(a){this.x=a+this.dx};ABCJS.write.RelativeElement.prototype.draw=function(b,c){if(this.pitch===undefined){window.console.error(this.type+" Relative Element y-coordinate not set.")}var d=b.calcY(this.pitch);switch(this.type){case"symbol":if(this.c===null){return null}var a="symbol";if(this.klass){a+=" "+this.klass}this.graphelem=b.printSymbol(this.x,this.pitch,this.c,this.scalex,this.scaley,b.addClasses(a));break;case"debug":this.graphelem=b.renderText(this.x,b.calcY(15),""+this.c,"debugfont","debug-msg","start");break;case"barNumber":this.graphelem=b.renderText(this.x,d,""+this.c,"measurefont","bar-number","start");break;case"lyric":this.graphelem=b.renderText(this.x,d,this.c,"vocalfont","abc-lyric","middle");break;case"chord":this.graphelem=b.renderText(this.x,d,this.c,"gchordfont","chord","middle");break;case"decoration":this.graphelem=b.renderText(this.x,d,this.c,"annotationfont","annotation","middle",true);break;case"text":this.graphelem=b.renderText(this.x,d,this.c,"annotationfont","annotation","start",this.centerVertically);break;case"part":this.graphelem=b.renderText(this.x,d,this.c,"partsfont","part","start");break;case"bar":this.graphelem=b.printStem(this.x,this.linewidth,d,(c)?c:b.calcY(this.pitch2));break;case"stem":this.graphelem=b.printStem(this.x,this.linewidth,d,b.calcY(this.pitch2));break;case"ledger":this.graphelem=b.printStaveLine(this.x,this.x+this.w,this.pitch);break}if(this.scalex!==1&&this.graphelem){this.graphelem.scale(this.scalex,this.scaley,this.x,d)}return this.graphelem};if(!window.ABCJS){window.ABCJS={}}if(!window.ABCJS.write){window.ABCJS.write={}}ABCJS.write.Renderer=function(b,a){this.paper=b;this.controller=null;this.space=3*ABCJS.write.spacing.SPACE;this.padding={};this.doRegression=a;if(this.doRegression){this.regressionLines=[]}this.reset()};ABCJS.write.Renderer.prototype.reset=function(){this.paper.clear();this.y=0;this.abctune=null;this.lastM=null;this.ingroup=false;this.path=null;this.isPrint=false;this.initVerticalSpace();if(this.doRegression){this.regressionLines=[]}};ABCJS.write.Renderer.prototype.setPrintMode=function(a){this.isPrint=a};ABCJS.write.Renderer.prototype.setPaperSize=function(maxwidth,scale){var w=(maxwidth+this.padding.right)*scale;var h=(this.y+this.padding.bottom)*scale;if(this.isPrint){h=Math.max(h,1056)}if(this.doRegression){this.regressionLines.push("PAPER SIZE: ("+w+","+h+")")}this.paper.setSize(w/scale,h/scale);var isIE=
/*@cc_on!@*/
false;if(isIE){this.paper.canvas.parentNode.style.width=w+"px";this.paper.canvas.parentNode.style.height=""+h+"px"}else{this.paper.canvas.parentNode.setAttribute("style","width:"+w+"px")}if(scale!==1){this.paper.canvas.style.transform="scale("+scale+","+scale+")";this.paper.canvas.style["-ms-tranform"]="scale("+scale+","+scale+")";this.paper.canvas.style["-webkit-tranform"]="scale("+scale+","+scale+")";this.paper.canvas.style["transform-origin"]="0 0";this.paper.canvas.style["-ms-transform-origin-x"]="0";this.paper.canvas.style["-ms-transform-origin-y"]="0";this.paper.canvas.style["-webkit-transform-origin-x"]="0";this.paper.canvas.style["-webkit-transform-origin-y"]="0"}else{this.paper.canvas.style.transform="";
this.paper.canvas.style["-ms-tranform"]="";this.paper.canvas.style["-webkit-tranform"]=""}this.paper.canvas.parentNode.style.overflow="hidden";this.paper.canvas.parentNode.style.height=""+h+"px"};ABCJS.write.Renderer.prototype.setPaddingOverride=function(a){this.paddingOverride={top:a.paddingtop,bottom:a.paddingbottom,right:a.paddingright,left:a.paddingleft}};ABCJS.write.Renderer.prototype.setPadding=function(a){function b(d,c,g,f,e){if(a.formatting[g]!==undefined){d.padding[c]=a.formatting[g]}else{if(d.paddingOverride[c]!==undefined){d.padding[c]=d.paddingOverride[c]}else{if(a.media==="print"){d.padding[c]=f}else{d.padding[c]=e}}}}b(this,"top","topmargin",38,15);b(this,"bottom","bottommargin",38,15);b(this,"left","leftmargin",68,15);b(this,"right","rightmargin",68,15)};ABCJS.write.Renderer.prototype.adjustNonScaledItems=function(a){this.padding.top/=a;this.padding.bottom/=a;this.padding.left/=a;this.padding.right/=a;this.abctune.formatting.headerfont.size/=a;this.abctune.formatting.footerfont.size/=a};ABCJS.write.Renderer.prototype.initVerticalSpace=function(){this.spacing={composer:7.56,graceBefore:8.67,graceInside:10.67,graceAfter:16,info:0,lineSkipFactor:1.1,music:7.56,paragraphSkipFactor:0.4,parts:11.33,slurHeight:1,staffSeparation:61.33,stemHeight:26.67+10,subtitle:3.78,systemStaffSeparation:48,text:18.9,title:7.56,top:30.24,vocal:30.67,words:0}};ABCJS.write.Renderer.prototype.setVerticalSpace=function(a){if(a.staffsep!==undefined){this.spacing.staffSeparation=a.staffsep*4/3}if(a.composerspace!==undefined){this.spacing.composer=a.composerspace*4/3}if(a.partsspace!==undefined){this.spacing.parts=a.partsspace*4/3}if(a.textspace!==undefined){this.spacing.text=a.textspace*4/3}if(a.musicspace!==undefined){this.spacing.music=a.musicspace*4/3}if(a.titlespace!==undefined){this.spacing.title=a.titlespace*4/3}if(a.sysstaffsep!==undefined){this.spacing.systemStaffSeparation=a.sysstaffsep*4/3}if(a.subtitlespace!==undefined){this.spacing.subtitle=a.subtitlespace*4/3}if(a.topspace!==undefined){this.spacing.top=a.topspace*4/3}if(a.vocalspace!==undefined){this.spacing.vocal=a.vocalspace*4/3}if(a.wordsspace!==undefined){this.spacing.words=a.wordsspace*4/3}};ABCJS.write.Renderer.prototype.topMargin=function(a){this.moveY(this.padding.top)};ABCJS.write.Renderer.prototype.addMusicPadding=function(){this.moveY(this.spacing.music)};ABCJS.write.Renderer.prototype.addStaffPadding=function(g,f){var e=g.staffs[g.staffs.length-1];var c=-(e.bottom-2);var b=f.staffs[0].top-10;var d=b+c;var a=d*ABCJS.write.spacing.STEP;if(a0){var d=this.outputTextIf(this.padding.left+c,b,"composerfont","meta-top",0,null,"end");this.moveY(d[1])}else{this.moveY(a[1])}this.moveY(-6)}this.outputTextIf(this.padding.left+c,f.metaText.author,"composerfont","meta-top",0,0,"end");this.outputTextIf(this.padding.left,f.metaText.partOrder,"partsfont","meta-bottom",0,0,"start")};ABCJS.write.Renderer.prototype.engraveExtraText=function(c,e){this.lineNumber=null;this.measureNumber=null;var d;if(e.metaText.unalignedWords){d="";for(var b=0;b0&&c.indexOf(".")<0){var h=this.paper.set();var m=0;for(var e=0;e=0;d--){this.printStaveLine(b,e,(d+1)*2,a);a=undefined}};ABCJS.write.Renderer.prototype.addClasses=function(b){var a=[];if(b.length>0){a.push(b)}if(this.lineNumber!==null){a.push("l"+this.lineNumber)}if(this.measureNumber!==null){a.push("m"+this.measureNumber)}return a.join(" ")};ABCJS.write.Renderer.prototype.getFontAndAttr=function(d,b){var c=this.abctune.formatting[d];if(c){c={face:c.face,size:c.size*4/3,decoration:c.decoration,style:c.style,weight:c.weight}}else{c={face:"Arial",size:12*4/3,decoration:"underline",style:"normal",weight:"normal"}}var a={"font-size":c.size,"font-style":c.style,"font-family":c.face,"font-weight":c.weight,"text-decoration":c.decoration,"class":this.addClasses(b)};a.font="";return{font:c,attr:a}};ABCJS.write.Renderer.prototype.getTextSize=function(f,d,a){var e=this.getFontAndAttr(d,a);var c=this.paper.text(0,0,f).attr(e.attr);var b=c.getBBox();c.remove();return b};ABCJS.write.Renderer.prototype.renderText=function(h,g,i,f,e,c,d){var b=this.getFontAndAttr(f,e);if(c){b.attr["text-anchor"]=c}i=i.replace(/\n\n/g,"\n \n");var a=this.paper.text(h,g,i).attr(b.attr);if(!d){var j=a.getBBox();a.attr({y:g+j.height/2});if(b.font.box){this.paper.rect(j.x-1,j.y-1,j.width+2,j.height+2).attr({stroke:"#cccccc"})}}if(f==="debugfont"){console.log("Debug msg: "+i);a.attr({stroke:"#ff0000"})}if(this.doRegression){this.addToRegression(a)}return a};ABCJS.write.Renderer.prototype.moveY=function(b,a){if(a===undefined){a=1}this.y+=b*a};ABCJS.write.Renderer.prototype.skipSpaceY=function(){this.y+=this.space};ABCJS.write.Renderer.prototype.outputTextIf=function(i,h,d,f,b,e,g){if(h){if(b){this.moveY(b)}var c=this.renderText(i,this.y,h,d,f,g);if(e!==null){var a=h.split("\n").length;this.moveY(c.getBBox().height/a,(a+e))}return[c.getBBox().width,c.getBBox().height]}return[0,0]};ABCJS.write.Renderer.prototype.printHorizontalLine=function(b,e,g){var k=0.35;var j="rgba(0,0,255,.4)";var h=this.y;if(e){h=e}h=Math.round(h);this.paper.text(10,h,""+Math.round(h)).attr({"text-anchor":"start","font-size":"18px",fill:j,stroke:j});var c=50;var a=b;var d=ABCJS.write.sprintf("M %f %f L %f %f L %f %f L %f %f z",c,h-k,c+a,h-k,a,h+k,c,h+k);this.paper.path().attr({path:d,stroke:"none",fill:j,"class":this.addClasses("staff")}).toBack();for(var f=1;f0){m.top+=d}}a=2-m.bottom}};ABCJS.write.StaffGroupElement.prototype.finished=function(){for(var a=0;am){m=o[e].getNextX();l=o[e].getSpacingUnits();p=o[e].spacingduration}}this.spacingunits+=l;this.minspace=Math.min(this.minspace,l);for(e=0;e0){m=f;for(var c=0;cm){m=this.voices[e].getNextX();l=this.voices[e].getSpacingUnits()}}this.spacingunits+=l;this.w=m;for(e=0;e6){m=0}}}}var g=l.y;for(var d=0;d1){l.printStem(this.startx,0.6,h,c)}l.y=g};if(!window.ABCJS){window.ABCJS={}}if(!window.ABCJS.write){window.ABCJS.write={}}(function(){var a=5;ABCJS.write.TempoElement=function(b){this.tempo=b;this.tempoHeightAbove=a;this.pitch=undefined};ABCJS.write.TempoElement.prototype.setUpperAndLowerElements=function(b){this.pitch=b.tempoHeightAbove};ABCJS.write.TempoElement.prototype.setX=function(b){this.x=b
};ABCJS.write.TempoElement.prototype.draw=function(v){var m=this.x;if(this.pitch===undefined){window.console.error("Tempo Element y-coordinate not set.")}var k=v.calcY(this.pitch);var q;if(this.tempo.preString){q=v.renderText(m,k,this.tempo.preString,"tempofont","tempo","start");var B=q.getBBox().width;var g=B/this.tempo.preString.length;m+=B+g}if(this.tempo.duration){var h=0.75;var z=this.pitch-a+1;var b=this.tempo.duration[0];var p=new ABCJS.write.AbsoluteElement(this.tempo,b,1,"tempo");var w=Math.floor(Math.log(b)/Math.log(2));var s=0;for(var o=Math.pow(2,w),l=o/2;o=this.children.length)};ABCJS.write.VoiceElement.prototype.getDurationIndex=function(){return this.durationindex-(this.children[this.i]&&(this.children[this.i].duration>0)?0:5e-7)};ABCJS.write.VoiceElement.prototype.getSpacingUnits=function(){return Math.sqrt(this.spacingduration*8)};ABCJS.write.VoiceElement.prototype.getNextX=function(){return Math.max(this.minx,this.nextx)};ABCJS.write.VoiceElement.prototype.beginLayout=function(a){this.i=0;this.durationindex=0;
this.startx=a;this.minx=a;this.nextx=a;this.spacingduration=0};ABCJS.write.VoiceElement.prototype.layoutOneItem=function(a,d){var c=this.children[this.i];if(!c){return 0}var b=a-this.minx;if(b0?"+"+e:e);l=d[3]?d[3]=="0"?"0":d[3].charAt(1):" ";b=d[5]-String(e).length;j=d[5]?str_repeat(l,b):"";k.push(d[4]?e+j:j+e)}else{throw ("Huh ?!")}}}h=h.substring(d[0].length)}return k.join("")};