UNPKG

music21j-port

Version:

A toolkit for computer-aided musicology, Javascript version

8 lines 463 kB
/** * VexFlow 1.2.84 built on 2018-02-26. * Copyright (c) 2010 Mohit Muthanna Cheppudira <mohit@muthanna.com> * * http://www.vexflow.com http://github.com/0xfe/vexflow */ !function(a,b){"object"==typeof exports&&"object"==typeof module?module.exports=b():"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?exports.Vex=b():a.Vex=b()}("undefined"!=typeof self?self:this,function(){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={i:d,l:!1,exports:{}};return a[d].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c={};return b.m=a,b.c=c,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{configurable:!1,enumerable:!0,get:d})},b.n=function(a){var c=a&&a.__esModule?function(){return a["default"]}:function(){return a};return b.d(c,"a",c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p="",b(b.s=64)}([function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(b,"__esModule",{value:!0});var g=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),h=function(){};h.L=function(a,b){if(b){var c=Array.prototype.slice.call(b).join(" ");window.console.log(a+": "+c)}},h.MakeException=function(a){var b=function(b){function c(b,f){d(this,c);var g=e(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,b));return g.name=a,g.message=b,g.data=f,g}return f(c,b),c}(Error);return b};var i=function(){function a(b,c){d(this,a),this.code=b,this.message=c}return g(a,[{key:"toString",value:function(){return"[RuntimeError] "+this.code+":"+this.message}}]),a}();h.RuntimeError=i,h.RERR=h.RuntimeError,h.Merge=function(a,b){for(var c in b)a[c]=b[c];return a},h.Min=Math.min,h.Max=Math.max,h.forEach=function(a,b){for(var c=0;c<a.length;c++)b(a[c],c)},h.RoundN=function(a,b){return a%b>=b/2?parseInt(a/b,10)*b+b:parseInt(a/b,10)*b},h.MidLine=function(a,b){var c=b+(a-b)/2;return c%2>0&&(c=h.RoundN(10*c,5)/10),c},h.SortAndUnique=function(a,b,c){if(a.length>1){var d=[],e=void 0;a.sort(b);for(var f=0;f<a.length;++f)0!==f&&c(a[f],e)||d.push(a[f]),e=a[f];return d}return a},h.Contains=function(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1},h.getCanvasContext=function(a){if(!a)throw new h.RERR("BadArgument","Invalid canvas selector: "+a);var b=document.getElementById(a);if(!b||!b.getContext)throw new h.RERR("UnsupportedBrowserError","This browser does not support HTML5 Canvas");return b.getContext("2d")},h.drawDot=function(a,b,c){var d=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"#55";a.save(),a.setFillStyle(d),a.beginPath(),a.arc(b,c,3,0,2*Math.PI,!0),a.closePath(),a.fill(),a.restore()},h.BM=function(a,b){var c=(new Date).getTime();b();var d=(new Date).getTime()-c;h.L(a+d+"ms")},h.StackTrace=function(){var a=new Error;return a.stack},h.W=function(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];var d=b.join(" ");window.console.log("Warning: ",d,h.StackTrace())},h.Prefix=function(a){return h.Prefix.prefix+a},h.Prefix.prefix="vf-",b.Vex=h},function(a,b,c){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),b.Flow=void 0;var d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},e=c(0),f=c(8),g=c(2),h={STEM_WIDTH:1.5,STEM_HEIGHT:35,STAVE_LINE_THICKNESS:1,RESOLUTION:16384,DEFAULT_NOTATION_FONT_SCALE:39,DEFAULT_TABLATURE_FONT_SCALE:39,SLASH_NOTEHEAD_WIDTH:15,TEXT_HEIGHT_OFFSET_HACK:1,IsKerned:!0};h.clefProperties=function(a){if(!a)throw new e.Vex.RERR("BadArgument","Invalid clef: "+a);var b=h.clefProperties.values[a];if(!b)throw new e.Vex.RERR("BadArgument","Invalid clef: "+a);return b},h.clefProperties.values={treble:{line_shift:0},bass:{line_shift:6},tenor:{line_shift:4},alto:{line_shift:3},soprano:{line_shift:1},percussion:{line_shift:0},"mezzo-soprano":{line_shift:2},"baritone-c":{line_shift:5},"baritone-f":{line_shift:5},subbass:{line_shift:7},french:{line_shift:-1}},h.keyProperties=function(a,b,c){void 0===b&&(b="treble");var f={octave_shift:0};"object"===("undefined"==typeof c?"undefined":d(c))&&e.Vex.Merge(f,c);var g=a.split("/");if(g.length<2)throw new e.Vex.RERR("BadArguments","Key must have note + octave and an optional glyph: "+a);var i=g[0].toUpperCase(),j=h.keyProperties.note_values[i];if(!j)throw new e.Vex.RERR("BadArguments","Invalid key name: "+i);j.octave&&(g[1]=j.octave);var k=parseInt(g[1],10);k+=-1*f.octave_shift;var l=7*k-28,m=(l+j.index)/2;m+=h.clefProperties(b).line_shift;var n=0;m<=0&&2*m%2===0&&(n=1),m>=6&&2*m%2===0&&(n=-1);var o="undefined"!=typeof j.int_val?12*k+j.int_val:null,p=j.code,q=j.shift_right;if(g.length>2&&g[2]){var r=g[2].toUpperCase(),s=h.keyProperties.note_glyph[r];s&&(p=s.code,q=s.shift_right)}return{key:i,octave:k,line:m,int_value:o,accidental:j.accidental,code:p,stroke:n,shift_right:q,displaced:!1}},h.keyProperties.note_values={C:{index:0,int_val:0,accidental:null},CN:{index:0,int_val:0,accidental:"n"},"C#":{index:0,int_val:1,accidental:"#"},"C##":{index:0,int_val:2,accidental:"##"},CB:{index:0,int_val:-1,accidental:"b"},CBB:{index:0,int_val:-2,accidental:"bb"},D:{index:1,int_val:2,accidental:null},DN:{index:1,int_val:2,accidental:"n"},"D#":{index:1,int_val:3,accidental:"#"},"D##":{index:1,int_val:4,accidental:"##"},DB:{index:1,int_val:1,accidental:"b"},DBB:{index:1,int_val:0,accidental:"bb"},E:{index:2,int_val:4,accidental:null},EN:{index:2,int_val:4,accidental:"n"},"E#":{index:2,int_val:5,accidental:"#"},"E##":{index:2,int_val:6,accidental:"##"},EB:{index:2,int_val:3,accidental:"b"},EBB:{index:2,int_val:2,accidental:"bb"},F:{index:3,int_val:5,accidental:null},FN:{index:3,int_val:5,accidental:"n"},"F#":{index:3,int_val:6,accidental:"#"},"F##":{index:3,int_val:7,accidental:"##"},FB:{index:3,int_val:4,accidental:"b"},FBB:{index:3,int_val:3,accidental:"bb"},G:{index:4,int_val:7,accidental:null},GN:{index:4,int_val:7,accidental:"n"},"G#":{index:4,int_val:8,accidental:"#"},"G##":{index:4,int_val:9,accidental:"##"},GB:{index:4,int_val:6,accidental:"b"},GBB:{index:4,int_val:5,accidental:"bb"},A:{index:5,int_val:9,accidental:null},AN:{index:5,int_val:9,accidental:"n"},"A#":{index:5,int_val:10,accidental:"#"},"A##":{index:5,int_val:11,accidental:"##"},AB:{index:5,int_val:8,accidental:"b"},ABB:{index:5,int_val:7,accidental:"bb"},B:{index:6,int_val:11,accidental:null},BN:{index:6,int_val:11,accidental:"n"},"B#":{index:6,int_val:12,accidental:"#"},"B##":{index:6,int_val:13,accidental:"##"},BB:{index:6,int_val:10,accidental:"b"},BBB:{index:6,int_val:9,accidental:"bb"},R:{index:6,int_val:9,rest:!0},X:{index:6,accidental:"",octave:4,code:"v3e",shift_right:5.5}},h.keyProperties.note_glyph={D0:{code:"v27",shift_right:-.5},D1:{code:"v2d",shift_right:-.5},D2:{code:"v22",shift_right:-.5},D3:{code:"v70",shift_right:-.5},T0:{code:"v49",shift_right:-2},T1:{code:"v93",shift_right:.5},T2:{code:"v40",shift_right:.5},T3:{code:"v7d",shift_right:.5},X0:{code:"v92",shift_right:-2},X1:{code:"v95",shift_right:-.5},X2:{code:"v7f",shift_right:.5},X3:{code:"v3b",shift_right:-2}},h.integerToNote=function(a){if("undefined"==typeof a)throw new e.Vex.RERR("BadArguments","Undefined integer for integerToNote");if(a<-2)throw new e.Vex.RERR("BadArguments","integerToNote requires integer > -2: "+a);var b=h.integerToNote.table[a];if(!b)throw new e.Vex.RERR("BadArguments","Unknown note value for integer: "+a);return b},h.integerToNote.table={0:"C",1:"C#",2:"D",3:"D#",4:"E",5:"F",6:"F#",7:"G",8:"G#",9:"A",10:"A#",11:"B"},h.tabToGlyph=function(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,c=null,d=0,e=0;if("X"===a.toString().toUpperCase()){var f=new g.Glyph("v7f",h.DEFAULT_TABLATURE_FONT_SCALE).getMetrics();c="v7f",d=f.width,e=-f.height/2}else d=h.textWidth(a.toString());return{text:a,code:c,getWidth:function(){return d*b},shift_y:e}},h.textWidth=function(a){return 7*a.toString().length},h.articulationCodes=function(a){return h.articulationCodes.articulations[a]},h.articulationCodes.articulations={"a.":{code:"v23",between_lines:!0},av:{code:"v28",between_lines:!0},"a>":{code:"v42",between_lines:!0},"a-":{code:"v25",between_lines:!0},"a^":{code:"va",between_lines:!1},"a+":{code:"v8b",between_lines:!1},ao:{code:"v94",between_lines:!1},ah:{code:"vb9",between_lines:!1},"a@a":{code:"v43",between_lines:!1},"a@u":{code:"v5b",between_lines:!1},"a|":{code:"v75",between_lines:!1},am:{code:"v97",between_lines:!1},"a,":{code:"vb3",between_lines:!1}},h.accidentalCodes=function(a){return h.accidentalCodes.accidentals[a]},h.accidentalCodes.accidentals={"#":{code:"v18",parenRightPaddingAdjustment:-1},"##":{code:"v7f",parenRightPaddingAdjustment:-1},b:{code:"v44",parenRightPaddingAdjustment:-2},bb:{code:"v26",parenRightPaddingAdjustment:-2},n:{code:"v4e",parenRightPaddingAdjustment:-1},"{":{code:"v9c",parenRightPaddingAdjustment:-1},"}":{code:"v84",parenRightPaddingAdjustment:-1},db:{code:"v9e",parenRightPaddingAdjustment:-1},d:{code:"vab",parenRightPaddingAdjustment:0},bbs:{code:"v90",parenRightPaddingAdjustment:-1},"++":{code:"v51",parenRightPaddingAdjustment:-1},"+":{code:"v78",parenRightPaddingAdjustment:-1},"+-":{code:"v8d",parenRightPaddingAdjustment:-1},"++-":{code:"v7a",parenRightPaddingAdjustment:-1},bs:{code:"vb7",parenRightPaddingAdjustment:-1},bss:{code:"v39",parenRightPaddingAdjustment:-1},o:{code:"vd0",parenRightPaddingAdjustment:-1},k:{code:"vd1",parenRightPaddingAdjustment:-1}},h.accidentalColumnsTable={1:{a:[1],b:[1]},2:{a:[1,2]},3:{a:[1,3,2],b:[1,2,1],second_on_bottom:[1,2,3]},4:{a:[1,3,4,2],b:[1,2,3,1],spaced_out_tetrachord:[1,2,1,2]},5:{a:[1,3,5,4,2],b:[1,2,4,3,1],spaced_out_pentachord:[1,2,3,2,1],very_spaced_out_pentachord:[1,2,1,2,1]},6:{a:[1,3,5,6,4,2],b:[1,2,4,5,3,1],spaced_out_hexachord:[1,3,2,1,3,2],very_spaced_out_hexachord:[1,2,1,2,1,2]}},h.ornamentCodes=function(a){return h.ornamentCodes.ornaments[a]},h.ornamentCodes.ornaments={mordent:{code:"v1e"},mordent_inverted:{code:"v45"},turn:{code:"v72"},turn_inverted:{code:"v33"},tr:{code:"v1f"},upprall:{code:"v60"},downprall:{code:"vb4"},prallup:{code:"v6d"},pralldown:{code:"v2c"},upmordent:{code:"v29"},downmordent:{code:"v68"},lineprall:{code:"v20"},prallprall:{code:"v86"}},h.keySignature=function(a){var b=h.keySignature.keySpecs[a];if(!b)throw new e.Vex.RERR("BadKeySignature","Bad key signature spec: '"+a+"'");if(!b.acc)return[];for(var c=h.keySignature.accidentalList(b.acc),d=[],f=0;f<b.num;++f){var g=c[f];d.push({type:b.acc,line:g})}return d},h.keySignature.keySpecs={C:{acc:null,num:0},Am:{acc:null,num:0},F:{acc:"b",num:1},Dm:{acc:"b",num:1},Bb:{acc:"b",num:2},Gm:{acc:"b",num:2},Eb:{acc:"b",num:3},Cm:{acc:"b",num:3},Ab:{acc:"b",num:4},Fm:{acc:"b",num:4},Db:{acc:"b",num:5},Bbm:{acc:"b",num:5},Gb:{acc:"b",num:6},Ebm:{acc:"b",num:6},Cb:{acc:"b",num:7},Abm:{acc:"b",num:7},G:{acc:"#",num:1},Em:{acc:"#",num:1},D:{acc:"#",num:2},Bm:{acc:"#",num:2},A:{acc:"#",num:3},"F#m":{acc:"#",num:3},E:{acc:"#",num:4},"C#m":{acc:"#",num:4},B:{acc:"#",num:5},"G#m":{acc:"#",num:5},"F#":{acc:"#",num:6},"D#m":{acc:"#",num:6},"C#":{acc:"#",num:7},"A#m":{acc:"#",num:7}},h.unicode={sharp:String.fromCharCode(parseInt("266F",16)),flat:String.fromCharCode(parseInt("266D",16)),natural:String.fromCharCode(parseInt("266E",16)),triangle:String.fromCharCode(parseInt("25B3",16)),"o-with-slash":String.fromCharCode(parseInt("00F8",16)),degrees:String.fromCharCode(parseInt("00B0",16)),circle:String.fromCharCode(parseInt("25CB",16))},h.keySignature.accidentalList=function(a){var b={b:[2,.5,2.5,1,3,1.5,3.5],"#":[0,1.5,-.5,1,2.5,.5,2]};return b[a]},h.parseNoteDurationString=function(a){if("string"!=typeof a)return null;var b=/(\d*\/?\d+|[a-z])(d*)([nrhms]|$)/,c=b.exec(a);if(!c)return null;var d=c[1],e=c[2].length,f=c[3];return 0===f.length&&(f="n"),{duration:d,dots:e,type:f}},h.parseNoteData=function(a){var b=a.duration,c=h.parseNoteDurationString(b);if(!c)return null;var d=h.durationToTicks(c.duration);if(null==d)return null;var e=a.type;if(e){if("n"!==e&&"r"!==e&&"h"!==e&&"m"!==e&&"s"!==e)return null}else e=c.type,e||(e="n");var f=a.dots?a.dots:c.dots;if("number"!=typeof f)return null;for(var g=d,i=0;i<f;i++){if(g<=1)return null;g/=2,d+=g}return{duration:c.duration,type:e,dots:f,ticks:d}},h.sanitizeDuration=function(a){var b=h.durationAliases[a];if(void 0!==b&&(a=b),void 0===h.durationToTicks.durations[a])throw new e.Vex.RERR("BadArguments","The provided duration is not valid: "+a);return a},h.durationToFraction=function(a){return(new f.Fraction).parse(h.sanitizeDuration(a))},h.durationToNumber=function(a){return h.durationToFraction(a).value()},h.durationToTicks=function(a){a=h.sanitizeDuration(a);var b=h.durationToTicks.durations[a];return void 0===b?null:b},h.durationToTicks.durations={"1/2":2*h.RESOLUTION,1:h.RESOLUTION/1,2:h.RESOLUTION/2,4:h.RESOLUTION/4,8:h.RESOLUTION/8,16:h.RESOLUTION/16,32:h.RESOLUTION/32,64:h.RESOLUTION/64,128:h.RESOLUTION/128,256:h.RESOLUTION/256},h.durationAliases={w:"1",h:"2",q:"4",b:"256"},h.durationToGlyph=function(a,b){a=h.sanitizeDuration(a);var c=h.durationToGlyph.duration_codes[a];if(void 0===c)return null;b||(b="n");var d=c.type[b];return void 0===d?null:e.Vex.Merge(e.Vex.Merge({},c.common),d)},h.durationToGlyph.duration_codes={"1/2":{common:{getWidth:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:h.DEFAULT_NOTATION_FONT_SCALE;return new g.Glyph(this.code_head||"v53",a).getMetrics().width},stem:!1,stem_offset:0,flag:!1,stem_up_extension:-h.STEM_HEIGHT,stem_down_extension:-h.STEM_HEIGHT,gracenote_stem_up_extension:-h.STEM_HEIGHT,gracenote_stem_down_extension:-h.STEM_HEIGHT,tabnote_stem_up_extension:-h.STEM_HEIGHT,tabnote_stem_down_extension:-h.STEM_HEIGHT,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"v53"},h:{code_head:"v59"},m:{code_head:"vf",stem_offset:0},r:{code_head:"v31",rest:!0,position:"B/5",dot_shiftY:.5},s:{getWidth:function(){return h.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},1:{common:{getWidth:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:h.DEFAULT_NOTATION_FONT_SCALE;return new g.Glyph(this.code_head||"v1d",a).getMetrics().width},stem:!1,stem_offset:0,flag:!1,stem_up_extension:-h.STEM_HEIGHT,stem_down_extension:-h.STEM_HEIGHT,gracenote_stem_up_extension:-h.STEM_HEIGHT,gracenote_stem_down_extension:-h.STEM_HEIGHT,tabnote_stem_up_extension:-h.STEM_HEIGHT,tabnote_stem_down_extension:-h.STEM_HEIGHT,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"v1d"},h:{code_head:"v46"},m:{code_head:"v92",stem_offset:-3},r:{code_head:"v5c",rest:!0,position:"D/5",dot_shiftY:.5},s:{getWidth:function(){return h.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},2:{common:{getWidth:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:h.DEFAULT_NOTATION_FONT_SCALE;return new g.Glyph(this.code_head||"v81",a).getMetrics().width},stem:!0,stem_offset:0,flag:!1,stem_up_extension:0,stem_down_extension:0,gracenote_stem_up_extension:-14,gracenote_stem_down_extension:-14,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"v81"},h:{code_head:"v2d"},m:{code_head:"v95",stem_offset:-3},r:{code_head:"vc",stem:!1,rest:!0,position:"B/4",dot_shiftY:-.5},s:{getWidth:function(){return h.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},4:{common:{getWidth:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:h.DEFAULT_NOTATION_FONT_SCALE;return new g.Glyph(this.code_head||"vb",a).getMetrics().width},stem:!0,stem_offset:0,flag:!1,stem_up_extension:0,stem_down_extension:0,gracenote_stem_up_extension:-14,gracenote_stem_down_extension:-14,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e",stem_offset:-3},r:{code_head:"v7c",stem:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1.5,line_below:1.5},s:{getWidth:function(){return h.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},8:{common:{getWidth:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:h.DEFAULT_NOTATION_FONT_SCALE;return new g.Glyph(this.code_head||"vb",a).getMetrics().width},stem:!0,stem_offset:0,flag:!0,beam_count:1,code_flag_upstem:"v54",code_flag_downstem:"v9a",stem_up_extension:0,stem_down_extension:0,gracenote_stem_up_extension:-14,gracenote_stem_down_extension:-14,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"va5",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1,line_below:1},s:{getWidth:function(){return h.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},16:{common:{beam_count:2,getWidth:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:h.DEFAULT_NOTATION_FONT_SCALE;return new g.Glyph(this.code_head||"vb",a).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"v3f",code_flag_downstem:"v8f",stem_up_extension:0,stem_down_extension:0,gracenote_stem_up_extension:-14,gracenote_stem_down_extension:-14,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"v3c",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1,line_below:2},s:{getWidth:function(){return h.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},32:{common:{beam_count:3,getWidth:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:h.DEFAULT_NOTATION_FONT_SCALE;return new g.Glyph(this.code_head||"vb",a).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"v47",code_flag_downstem:"v2a",stem_up_extension:9,stem_down_extension:9,gracenote_stem_up_extension:-12,gracenote_stem_down_extension:-12,tabnote_stem_up_extension:8,tabnote_stem_down_extension:5,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"v55",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-1.5,line_above:2,line_below:2},s:{getWidth:function(){return h.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},64:{common:{beam_count:4,getWidth:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:h.DEFAULT_NOTATION_FONT_SCALE;return new g.Glyph(this.code_head||"vb",a).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"va9",code_flag_downstem:"v58",stem_up_extension:13,stem_down_extension:13,gracenote_stem_up_extension:-10,gracenote_stem_down_extension:-10,tabnote_stem_up_extension:12,tabnote_stem_down_extension:9,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"v38",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-1.5,line_above:2,line_below:3},s:{getWidth:function(){return h.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}},128:{common:{beam_count:5,getWidth:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:h.DEFAULT_NOTATION_FONT_SCALE;return new g.Glyph(this.code_head||"vb",a).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"v9b",code_flag_downstem:"v30",stem_up_extension:22,stem_down_extension:22,gracenote_stem_up_extension:-8,gracenote_stem_down_extension:-8,tabnote_stem_up_extension:21,tabnote_stem_down_extension:18,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"vaa",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:1.5,line_above:3,line_below:3},s:{getWidth:function(){return h.SLASH_NOTEHEAD_WIDTH},position:"B/4"}}}},h.TIME4_4={num_beats:4,beat_value:4,resolution:h.RESOLUTION},b.Flow=h},function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function g(a,b,c,d,e,f){function g(){return b+a[l++]*d}function h(){return c+a[l++]*e}for(var i=void 0,j=void 0,k=void 0,l=0;l<a.length;)switch(i=a[l++]){case"m":case"l":f[i](g(),h());break;case"q":j=g(),k=h(),f.q(g(),h(),j,k);break;case"b":j=g(),k=h(),f.b(g(),h(),g(),h(),j,k)}}Object.defineProperty(b,"__esModule",{value:!0}),b.Glyph=void 0;var h=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),i=c(0),j=c(3),k=c(65),l=c(10),m=c(40);b.Glyph=function(a){function b(a,c,f){d(this,b);var g=e(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return g.setAttribute("type","Glyph"),g.code=a,g.point=c,g.options={cache:!0,font:m.Font},g.metrics=null,g.x_shift=0,g.y_shift=0,g.originShift={x:0,y:0},f?g.setOptions(f):g.reset(),g}return f(b,a),h(b,null,[{key:"loadMetrics",value:function(a,b,c){var d=a.glyphs[b];if(!d)throw new i.Vex.RERR("BadGlyph","Glyph "+b+" does not exist in font.");var e=d.x_min,f=d.x_max,g=d.ha,h=void 0;if(d.o)return c?d.cached_outline?h=d.cached_outline:(h=d.o.split(" "),d.cached_outline=h):(d.cached_outline&&delete d.cached_outline,h=d.o.split(" ")),{x_min:e,x_max:f,ha:g,outline:h};throw new i.Vex.RERR("BadGlyph","Glyph "+b+" has no outline defined.")}},{key:"renderGlyph",value:function(a,c,d,e,f,g){var h=72*e/(100*m.Font.resolution),i=b.loadMetrics(m.Font,f,!g);b.renderOutline(a,i.outline,h,c,d)}},{key:"renderOutline",value:function(a,b,c,d,e){a.beginPath(),a.moveTo(d,e),g(b,d,e,c,-c,{m:a.moveTo.bind(a),l:a.lineTo.bind(a),q:a.quadraticCurveTo.bind(a),b:a.bezierCurveTo.bind(a)}),a.fill()}},{key:"getOutlineBoundingBox",value:function(a,b,c,d){var e=new k.BoundingBoxComputation;return g(a,c,d,b,-b,{m:e.addPoint.bind(e),l:e.addPoint.bind(e),q:e.addQuadraticCurve.bind(e),b:e.addBezierCurve.bind(e)}),new l.BoundingBox(e.x1,e.y1,e.width(),e.height())}}]),h(b,[{key:"setOptions",value:function(a){i.Vex.Merge(this.options,a),this.reset()}},{key:"setPoint",value:function(a){return this.point=a,this}},{key:"setStave",value:function(a){return this.stave=a,this}},{key:"setXShift",value:function(a){return this.x_shift=a,this}},{key:"setYShift",value:function(a){return this.y_shift=a,this}},{key:"reset",value:function(){this.scale=72*this.point/(100*this.options.font.resolution),this.metrics=b.loadMetrics(this.options.font,this.code,this.options.cache),this.bbox=b.getOutlineBoundingBox(this.metrics.outline,this.scale,0,0)}},{key:"getMetrics",value:function(){if(!this.metrics)throw new i.Vex.RuntimeError("BadGlyph","Glyph "+this.code+" is not initialized.");return{x_min:this.metrics.x_min*this.scale,x_max:this.metrics.x_max*this.scale,width:this.bbox.getW(),height:this.bbox.getH()}}},{key:"setOriginX",value:function(a){var b=this.bbox,c=Math.abs(b.getX()/b.getW()),d=(a-c)*b.getW();this.originShift.x=-d}},{key:"setOriginY",value:function(a){var b=this.bbox,c=Math.abs(b.getY()/b.getH()),d=(a-c)*b.getH();this.originShift.y=-d}},{key:"setOrigin",value:function(a,b){this.setOriginX(a),this.setOriginY(b)}},{key:"render",value:function(a,c,d){if(!this.metrics)throw new i.Vex.RuntimeError("BadGlyph","Glyph "+this.code+" is not initialized.");var e=this.metrics.outline,f=this.scale;this.setRendered(),this.applyStyle(a),b.renderOutline(a,e,f,c+this.originShift.x,d+this.originShift.y),this.restoreStyle(a)}},{key:"renderToStave",value:function(a){if(this.checkContext(),!this.metrics)throw new i.Vex.RuntimeError("BadGlyph","Glyph "+this.code+" is not initialized.");if(!this.stave)throw new i.Vex.RuntimeError("GlyphError","No valid stave");var c=this.metrics.outline,d=this.scale;this.setRendered(),this.applyStyle(),b.renderOutline(this.context,c,d,a+this.x_shift,this.stave.getYForGlyphs()+this.y_shift),this.restoreStyle()}}]),b}(j.Element)},function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(b,"__esModule",{value:!0}),b.Element=void 0;var e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=c(0),g=c(39),h=b.Element=function(){function a(){var b=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c=b.type;d(this,a),this.attrs={id:a.newID(),el:null,type:c||"Base",classes:{}},this.boundingBox=null,this.context=null,this.rendered=!1,g.Registry.getDefaultRegistry()&&g.Registry.getDefaultRegistry().register(this)}return e(a,null,[{key:"newID",value:function(){return"auto"+a.ID++}}]),e(a,[{key:"setStyle",value:function(a){return this.style=a,this}},{key:"getStyle",value:function(){return this.style}},{key:"applyStyle",value:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.context,b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getStyle();return b?(a.save(),b.shadowColor&&a.setShadowColor(b.shadowColor),b.shadowBlur&&a.setShadowBlur(b.shadowBlur),b.fillStyle&&a.setFillStyle(b.fillStyle),b.strokeStyle&&a.setStrokeStyle(b.strokeStyle),b.lineWidth&&a.setLineWidth(b.lineWidth),this):this}},{key:"restoreStyle",value:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.context,b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getStyle();return b?(a.restore(),this):this}},{key:"hasClass",value:function(a){return this.attrs.classes[a]===!0}},{key:"addClass",value:function(a){return this.attrs.classes[a]=!0,this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:a,oldValue:null}),this}},{key:"removeClass",value:function(a){return delete this.attrs.classes[a],this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:null,oldValue:a}),this}},{key:"onRegister",value:function(a){return this.registry=a,this}},{key:"isRendered",value:function(){return this.rendered}},{key:"setRendered",value:function(){var a=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.rendered=a,this}},{key:"getAttributes",value:function(){return this.attrs}},{key:"getAttribute",value:function(a){return this.attrs[a]}},{key:"setAttribute",value:function(a,b){var c=this.attrs.id,d=this.attrs[a];return this.attrs[a]=b,this.registry&&this.registry.onUpdate({id:c,name:a,value:b,oldValue:d}),this}},{key:"getContext",value:function(){return this.context}},{key:"setContext",value:function(a){return this.context=a,this}},{key:"getBoundingBox",value:function(){return this.boundingBox}},{key:"checkContext",value:function(){if(!this.context)throw new f.Vex.RERR("NoContext","No rendering context attached to instance");return this.context}}]),a}();h.ID=1e3},function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(b,"__esModule",{value:!0}),b.Modifier=void 0;var g=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),h=c(0),i=c(3);b.Modifier=function(a){function b(){d(this,b);var a=e(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));return a.setAttribute("type","Modifier"),a.width=0,a.note=null,a.index=null,a.text_line=0,a.position=b.Position.LEFT,a.modifier_context=null,a.x_shift=0,a.y_shift=0,a.spacingFromNextModifier=0,a}return f(b,a),g(b,null,[{key:"CATEGORY",get:function(){return"none"}},{key:"Position",get:function(){return{LEFT:1,RIGHT:2,ABOVE:3,BELOW:4}}},{key:"PositionString",get:function(){return{above:b.Position.ABOVE,below:b.Position.BELOW,left:b.Position.LEFT,right:b.Position.RIGHT}}}]),g(b,[{key:"getCategory",value:function(){return b.CATEGORY}},{key:"getWidth",value:function(){return this.width}},{key:"setWidth",value:function(a){return this.width=a,this}},{key:"getNote",value:function(){return this.note}},{key:"setNote",value:function(a){return this.note=a,this}},{key:"getIndex",value:function(){return this.index}},{key:"setIndex",value:function(a){return this.index=a,this}},{key:"getModifierContext",value:function(){return this.modifier_context}},{key:"setModifierContext",value:function(a){return this.modifier_context=a,this}},{key:"getPosition",value:function(){return this.position}},{key:"setPosition",value:function(a){return this.position="string"==typeof a?b.PositionString[a]:a,this}},{key:"setTextLine",value:function(a){return this.text_line=a,this}},{key:"setYShift",value:function(a){return this.y_shift=a,this}},{key:"setSpacingFromNextModifier",value:function(a){this.spacingFromNextModifier=a}},{key:"getSpacingFromNextModifier",value:function(){return this.spacingFromNextModifier}},{key:"setXShift",value:function(a){this.x_shift=0,this.position===b.Position.LEFT?this.x_shift-=a:this.x_shift+=a}},{key:"getXShift",value:function(){return this.x_shift}},{key:"draw",value:function(){throw this.checkContext(),new h.Vex.RERR("MethodNotImplemented","draw() not implemented for this modifier.")}}]),b}(i.Element)},function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function g(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];w.DEBUG&&m.Vex.L("Vex.Flow.StaveNote",b)}function h(a,b,c){var d=(b.isrest?0:1)*c;a.line+=d,a.maxLine+=d,a.minLine+=d,a.note.setKeyLine(0,a.note.getKeyLine(0)+d)}function i(a,b,c){var d=a.line-m.Vex.MidLine(b.minLine,c.maxLine);a.note.setKeyLine(0,a.note.getKeyLine(0)-d),a.line-=d,a.maxLine-=d,a.minLine-=d}Object.defineProperty(b,"__esModule",{value:!0}),b.StaveNote=void 0;var j=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a},k=function x(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){var e=Object.getPrototypeOf(a);return null===e?void 0:x(e,b,c)}if("value"in d)return d.value;var f=d.get;if(void 0!==f)return f.call(c)},l=function(){function a(a,b){for(var c=0;c<b.length;c++){ var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),m=c(0),n=c(1),o=c(10),p=c(9),q=c(41),r=c(20),s=c(4),t=c(21),u=function(a){return p.Stem.WIDTH/(2*-a.getStemDirection())},v=function(a,b){return b===(a.getStemDirection()===p.Stem.UP?a.keyProps.length-1:0)},w=b.StaveNote=function(a){function b(a){d(this,b);var c=e(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));if(c.setAttribute("type","StaveNote"),c.keys=a.keys,c.clef=a.clef,c.octave_shift=a.octave_shift,c.beam=null,c.glyph=n.Flow.durationToGlyph(c.duration,c.noteType),!c.glyph)throw new m.Vex.RuntimeError("BadArguments","Invalid note initialization data (No glyph found): "+JSON.stringify(a));return c.displaced=!1,c.dot_shiftY=0,c.keyProps=[],c.use_default_head_x=!1,c.note_heads=[],c.modifiers=[],m.Vex.Merge(c.render_options,{glyph_font_scale:a.glyph_font_scale||n.Flow.DEFAULT_NOTATION_FONT_SCALE,stroke_px:a.stroke_px||b.DEFAULT_LEDGER_LINE_OFFSET}),c.calculateKeyProps(),c.buildStem(),a.auto_stem?c.autoStem():c.setStemDirection(a.stem_direction),c.reset(),c.buildFlag(),c}return f(b,a),l(b,null,[{key:"format",value:function(a,c){if(!a||a.length<2)return!1;if(a[0].getStave())return b.formatByY(a,c);for(var d=[],e=0;e<a.length;e++){var f=a[e].getKeyProps(),g=f[0].line,j=f[f.length-1].line,k=a[e].getStemDirection(),l=a[e].getStemLength()/10,m=a[e].getStemMinumumLength()/10,n=void 0;a[e].isRest()?(n=g+a[e].glyph.line_above,j=g-a[e].glyph.line_below):(n=1===k?f[f.length-1].line+l:f[f.length-1].line,j=1===k?f[0].line:f[0].line-l),d.push({line:f[0].line,maxLine:n,minLine:j,isrest:a[e].isRest(),stemDirection:k,stemMax:l,stemMin:m,voice_shift:a[e].getVoiceShiftWidth(),is_displaced:a[e].isDisplaced(),note:a[e]})}var o=d.length,p=d[0],q=o>2?d[1]:null,r=o>2?d[2]:d[1];2===o&&p.stemDirection===-1&&1===r.stemDirection&&(p=d[1],r=d[0]);var s=Math.max(p.voice_shift,r.voice_shift),t=0,u=void 0;if(2===o){var v=p.stemDirection===r.stemDirection?0:.5;return p.stemDirection===r.stemDirection&&p.minLine<=r.maxLine&&(p.isrest||(u=Math.abs(p.line-(r.maxLine+.5)),u=Math.max(u,p.stemMin),p.minLine=p.line-u,p.note.setStemLength(10*u))),p.minLine<=r.maxLine+v&&(p.isrest?h(p,r,1):r.isrest?h(r,p,-1):(t=s,p.stemDirection===r.stemDirection?p.note.setXShift(t+3):r.note.setXShift(t))),!0}if(null!==q&&q.minLine<r.maxLine+.5&&(q.isrest||(u=Math.abs(q.line-(r.maxLine+.5)),u=Math.max(u,q.stemMin),q.minLine=q.line-u,q.note.setStemLength(10*u))),q.isrest&&!p.isrest&&!r.isrest&&(p.minLine<=q.maxLine||q.minLine<=r.maxLine)){var w=q.maxLine-q.minLine,x=p.minLine-r.maxLine;return w<x?i(q,p,r):(t=s+3,q.note.setXShift(t)),!0}return p.isrest&&q.isrest&&r.isrest?(h(p,q,1),h(r,q,-1),!0):(q.isrest&&p.isrest&&q.minLine<=r.maxLine&&h(q,r,1),q.isrest&&r.isrest&&p.minLine<=q.maxLine&&h(q,p,-1),p.isrest&&p.minLine<=q.maxLine&&h(p,q,1),r.isrest&&q.minLine<=r.maxLine&&h(r,q,-1),(!p.isrest&&!q.isrest&&p.minLine<=q.maxLine+.5||!q.isrest&&!r.isrest&&q.minLine<=r.maxLine)&&(t=s+3,q.note.setXShift(t)),!0)}},{key:"formatByY",value:function(a,b){for(var c=!0,d=0;d<a.length;d++)c=c&&null!=a[d].getStave();if(!c)throw new m.Vex.RERR("Stave Missing","All notes must have a stave - Vex.Flow.ModifierContext.formatMultiVoice!");for(var e=0,f=0;f<a.length-1;f++){var g=a[f],h=a[f+1];g.getStemDirection()===p.Stem.DOWN&&(g=a[f+1],h=a[f]);var i=g.getKeyProps(),j=h.getKeyProps(),k=.5,l=g.getStave().getYForLine(5-i[0].line+k),n=h.getStave().getYForLine(5-j[j.length-1].line-k),o=n-l<0;o&&(e=g.getVoiceShiftWidth()+2,h.setXShift(e))}b.right_shift+=e}},{key:"postFormat",value:function(a){return!!a&&(a.forEach(function(a){return a.postFormat()}),!0)}},{key:"CATEGORY",get:function(){return"stavenotes"}},{key:"STEM_UP",get:function(){return p.Stem.UP}},{key:"STEM_DOWN",get:function(){return p.Stem.DOWN}},{key:"DEFAULT_LEDGER_LINE_OFFSET",get:function(){return 3}}]),l(b,[{key:"reset",value:function(){var a=this;k(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"reset",this).call(this);var c=this.note_heads.map(function(a){return a.getStyle()});this.buildNoteHeads(),this.note_heads.forEach(function(a,b){return a.setStyle(c[b])}),this.stave&&this.note_heads.forEach(function(b){return b.setStave(a.stave)}),this.calcExtraPx()}},{key:"getCategory",value:function(){return b.CATEGORY}},{key:"buildStem",value:function(){var a=this.getGlyph(),b="v95"===a.code_head||"v3e"===a.code_head?-4:0;this.setStem(new p.Stem({yExtend:b,hide:!!this.isRest()}))}},{key:"buildNoteHeads",value:function(){this.note_heads=[];var a=this.getStemDirection(),b=this.getKeys(),c=null,d=null,e=!1,f=void 0,g=void 0,h=void 0;a===p.Stem.UP?(f=0,g=b.length,h=1):a===p.Stem.DOWN&&(f=b.length-1,g=-1,h=-1);for(var i=f;i!==g;i+=h){var j=this.keyProps[i],k=j.line;null===c?c=k:(d=Math.abs(c-k),0===d||.5===d?e=!e:(e=!1,this.use_default_head_x=!0)),c=k;var l=new q.NoteHead({duration:this.duration,note_type:this.noteType,displaced:e,stem_direction:a,custom_glyph_code:j.code,glyph_font_scale:this.render_options.glyph_font_scale,x_shift:j.shift_right,line:j.line});this.note_heads[i]=l}}},{key:"autoStem",value:function(){this.minLine=this.keyProps[0].line,this.maxLine=this.keyProps[this.keyProps.length-1].line;var a=3,b=(this.minLine+this.maxLine)/2,c=b<a?p.Stem.UP:p.Stem.DOWN;this.setStemDirection(c)}},{key:"calculateKeyProps",value:function(){for(var a=null,b=0;b<this.keys.length;++b){var c=this.keys[b];this.glyph.rest&&(this.glyph.position=c);var d={octave_shift:this.octave_shift||0},e=n.Flow.keyProperties(c,this.clef,d);if(!e)throw new m.Vex.RuntimeError("BadArguments","Invalid key for note properties: "+c);"R"===e.key&&("1"===this.duration||"w"===this.duration?e.line=4:e.line=3);var f=e.line;null===a?a=f:.5===Math.abs(a-f)&&(this.displaced=!0,e.displaced=!0,this.keyProps.length>0&&(this.keyProps[b-1].displaced=!0)),a=f,this.keyProps.push(e)}a=-(1/0),this.keyProps.forEach(function(b){b.line<a&&m.Vex.W("Unsorted keys in note will be sorted. See https://github.com/0xfe/vexflow/issues/104 for details."),a=b.line}),this.keyProps.sort(function(a,b){return a.line-b.line})}},{key:"getBoundingBox",value:function(){if(!this.preFormatted)throw new m.Vex.RERR("UnformattedNote","Can't call getBoundingBox on an unformatted note.");var a=this.getMetrics(),b=a.width,c=a.modLeftPx,d=a.extraLeftPx,e=this.getAbsoluteX()-c-d,f=0,g=0,h=this.getStave().getSpacingBetweenLines()/2,i=2*h;if(this.isRest()){var j=this.ys[0],k=n.Flow.durationToFraction(this.duration);k.equals(1)||k.equals(2)?(f=j-h,g=j+h):(f=j-this.glyph.line_above*i,g=j+this.glyph.line_below*i)}else if(this.glyph.stem){var l=this.getStemExtents();l.baseY+=h*this.stem_direction,f=Math.min(l.topY,l.baseY),g=Math.max(l.topY,l.baseY)}else{f=null,g=null;for(var p=0;p<this.ys.length;++p){var q=this.ys[p];0===p?(f=q,g=q):(f=Math.min(q,f),g=Math.max(q,g))}f-=h,g+=h}return new o.BoundingBox(e,f,b,g-f)}},{key:"getLineNumber",value:function(a){if(!this.keyProps.length)throw new m.Vex.RERR("NoKeyProps","Can't get bottom note line, because note is not initialized properly.");for(var b=this.keyProps[0].line,c=0;c<this.keyProps.length;c++){var d=this.keyProps[c].line;a?d>b&&(b=d):d<b&&(b=d)}return b}},{key:"isRest",value:function(){return this.glyph.rest}},{key:"isChord",value:function(){return!this.isRest()&&this.keys.length>1}},{key:"hasStem",value:function(){return this.glyph.stem}},{key:"hasFlag",value:function(){return k(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"hasFlag",this).call(this)&&!this.isRest()}},{key:"getStemX",value:function(){return"r"===this.noteType?this.getCenterGlyphX():k(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"getStemX",this).call(this)+u(this)}},{key:"getYForTopText",value:function(a){var b=this.getStemExtents();return Math.min(this.stave.getYForTopText(a),b.topY-this.render_options.annotation_spacing*(a+1))}},{key:"getYForBottomText",value:function(a){var b=this.getStemExtents();return Math.max(this.stave.getYForTopText(a),b.baseY+this.render_options.annotation_spacing*a)}},{key:"setStave",value:function(a){k(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"setStave",this).call(this,a);var c=this.note_heads.map(function(b){return b.setStave(a),b.getY()});if(this.setYs(c),this.stem){var d=this.getNoteHeadBounds(),e=d.y_top,f=d.y_bottom;this.stem.setYBounds(e,f)}return this}},{key:"getKeys",value:function(){return this.keys}},{key:"getKeyProps",value:function(){return this.keyProps}},{key:"isDisplaced",value:function(){return this.displaced}},{key:"setNoteDisplaced",value:function(a){return this.displaced=a,this}},{key:"getTieRightX",value:function(){var a=this.getAbsoluteX();return a+=this.getGlyphWidth()+this.x_shift+this.extraRightPx,this.modifierContext&&(a+=this.modifierContext.getExtraRightPx()),a}},{key:"getTieLeftX",value:function(){var a=this.getAbsoluteX();return a+=this.x_shift-this.extraLeftPx}},{key:"getLineForRest",value:function(){var a=this.keyProps[0].line;if(this.keyProps.length>1){var b=this.keyProps[this.keyProps.length-1].line,c=Math.max(a,b),d=Math.min(a,b);a=m.Vex.MidLine(c,d)}return a}},{key:"getModifierStartXY",value:function(a,b){if(!this.preFormatted)throw new m.Vex.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");if(0===this.ys.length)throw new m.Vex.RERR("NoYValues","No Y-Values calculated for this note.");var c=s.Modifier.Position,d=c.ABOVE,e=c.BELOW,f=c.LEFT,g=c.RIGHT,h=0;return a===f?h=-2:a===g?(h=this.getGlyphWidth()+this.x_shift+2,this.stem_direction===p.Stem.UP&&this.hasFlag()&&v(this,b)&&(h+=this.flag.getMetrics().width)):a!==e&&a!==d||(h=this.getGlyphWidth()/2),{x:this.getAbsoluteX()+h,y:this.ys[b]}}},{key:"setStyle",value:function(a){k(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"setStyle",this).call(this,a),this.note_heads.forEach(function(b){return b.setStyle(a)}),this.stem.setStyle(a)}},{key:"setStemStyle",value:function(a){var b=this.getStem();b.setStyle(a)}},{key:"getStemStyle",value:function(){return this.stem.getStyle()}},{key:"setLedgerLineStyle",value:function(a){this.ledgerLineStyle=a}},{key:"getLedgerLineStyle",value:function(){return this.ledgerLineStyle}},{key:"setFlagStyle",value:function(a){this.flagStyle=a}},{key:"getFlagStyle",value:function(){return this.flagStyle}},{key:"setKeyStyle",value:function(a,b){return this.note_heads[a].setStyle(b),this}},{key:"setKeyLine",value:function(a,b){return this.keyProps[a].line=b,this.reset(),this}},{key:"getKeyLine",value:function(a){return this.keyProps[a].line}},{key:"addToModifierContext",value:function(a){this.setModifierContext(a);for(var b=0;b<this.modifiers.length;++b)this.modifierContext.addModifier(this.modifiers[b]);return this.modifierContext.addModifier(this),this.setPreFormatted(!1),this}},{key:"addModifier",value:function(a,b){return b.setNote(this),b.setIndex(a),this.modifiers.push(b),this.setPreFormatted(!1),this}},{key:"addAccidental",value:function(a,b){return this.addModifier(a,b)}},{key:"addArticulation",value:function(a,b){return this.addModifier(a,b)}},{key:"addAnnotation",value:function(a,b){return this.addModifier(a,b)}},{key:"addDot",value:function(a){var b=new t.Dot;return b.setDotShiftY(this.glyph.dot_shiftY),this.dots++,this.addModifier(a,b)}},{key:"addDotToAll",value:function(){for(var a=0;a<this.keys.length;++a)this.addDot(a);return this}},{key:"getAccidentals",value:function(){return this.modifierContext.getModifiers("accidentals")}},{key:"getDots",value:function(){return this.modifierContext.getModifiers("dots")}},{key:"getVoiceShiftWidth",value:function(){return this.getGlyphWidth()*(this.displaced?2:1)}},{key:"calcExtraPx",value:function(){this.setExtraLeftPx(this.displaced&&this.stem_direction===p.Stem.DOWN?this.getGlyphWidth():0),this.setExtraRightPx(!this.hasFlag()&&this.displaced&&this.stem_direction===p.Stem.UP?this.getGlyphWidth():0)}},{key:"preFormat",value:function(){if(!this.preFormatted){this.modifierContext&&this.modifierContext.preFormat();var a=this.getGlyphWidth()+this.extraLeftPx+this.extraRightPx;this.glyph.flag&&null===this.beam&&this.stem_direction===p.Stem.UP&&(a+=this.getGlyphWidth()),this.setWidth(a),this.setPreFormatted(!0)}}},{key:"getNoteHeadBounds",value:function(){var a=null,b=null,c=null,d=null,e=this.stave.getNumLines(),f=1,g=!1,h=!1,i=e,j=f;return this.note_heads.forEach(function(k){var l=k.getLine(),m=k.getY();(null===a||m<a)&&(a=m),(null===b||m>b)&&(b=m),null===d&&k.isDisplaced()&&(d=k.getAbsoluteX()),null!==c||k.isDisplaced()||(c=k.getAbsoluteX()),e=l>e?l:e,f=l<f?l:f,k.isDisplaced()?(g=g===!1?l:Math.max(l,g),h=h===!1?l:Math.min(l,h)):(i=Math.max(l,i),j=Math.min(l,j))},this),{y_top:a,y_bottom:b,displaced_x:d,non_displaced_x:c,highest_line:e,lowest_line:f,highest_displaced_line:g,lowest_displaced_line:h,highest_non_displaced_line:i,lowest_non_displaced_line:j}}},{key:"getNoteHeadBeginX",value:function(){return this.getAbsoluteX()+this.x_shift}},{key:"getNoteHeadEndX",value:function(){var a=this.getNoteHeadBeginX();return a+this.getGlyphWidth()}},{key:"drawLedgerLines",value:function(){var a=this.stave,b=this.glyph,c=this.render_options.stroke_px,d=this.context,e=b.getWidth()+2*c,f=2*(b.getWidth()+c)-p.Stem.WIDTH/2;if(!this.isRest()){if(!d)throw new m.Vex.RERR("NoCanvasContext","Can't draw without a canvas context.");var g=this.getNoteHeadBounds(),h=g.highest_line,i=g.lowest_line,k=g.highest_displaced_line,l=g.highest_non_displaced_line,n=g.lowest_displaced_line,o=g.lowest_non_displaced_line,q=g.displaced_x,r=g.non_displaced_x,s=Math.min(q,r),t=function(a,b,g){var h=void 0;h=g&&b?s-c:b?r-c:q-c;var i=b&&g?f:e;d.beginPath(),d.moveTo(h,a),d.lineTo(h+i,a),d.stroke()},u=j({},a.getStyle()||{},this.getLedgerLineStyle()||{});this.applyStyle(d,u);for(var v=6;v<=h;++v){var w=null!==r&&v<=l,x=null!==q&&v<=k;t(a.getYForNote(v),w,x)}for(var y=0;y>=i;--y){var z=null!==r&&y>=o,A=null!==q&&y>=n;t(a.getYForNote(y),z,A)}this.restoreStyle(d,u)}}},{key:"drawModifiers",value:function(){if(!this.context)throw new m.Vex.RERR("NoCanvasContext","Can't draw without a canvas context.");var a=this.context;a.openGroup("modifiers");for(var b=0;b<this.modifiers.length;b++){var c=this.modifiers[b],d=this.note_heads[c.getIndex()],e=d.getStyle();e&&(a.save(),d.applyStyle(a)),c.setContext(a),c.draw(),e&&a.restore()}a.closeGroup()}},{key:"drawFlag",value:function(){var a=this.stem,b=this.beam,c=this.context;if(!c)throw new m.Vex.RERR("NoCanvasContext","Can't draw without a canvas context.");var d=null===b,e=this.getGlyph();if(e.flag&&d){var f=this.getNoteHeadBounds(),g=f.y_top,h=f.y_bottom,i=a.getHeight(),j=this.getStemX(),k=this.getStemDirection()===p.Stem.DOWN?g-i+2:h-i-2;c.openGroup("flag",null,{pointerBBox:!0}),this.applyStyle(c,this.getFlagStyle()||!1),this.flag.render(c,j,k),this.restoreStyle(c,this.getFlagStyle()||!1),c.closeGroup()}}},{key:"drawNoteHeads",value:function(){var a=this;this.note_heads.forEach(function(b){a.context.openGroup("notehead",null,{pointerBBox:!0}),b.setContext(a.context).draw(),a.context.closeGroup()})}},{key:"drawStem",value:function(a){if(!this.context)throw new m.Vex.RERR("NoCanvasContext","Can't draw without a canvas context.");a&&this.setStem(new p.Stem(a)),this.context.openGroup("stem",null,{pointerBBox:!0}),this.stem.setContext(this.context).draw(),this.context.closeGroup()}},{key:"draw",value:function(){if(!this.context)throw new m.Vex.RERR("NoCanvasContext","Can't draw without a canvas context.");if(!this.stave)throw new m.Vex.RERR("NoStave","Can't draw without a stave.");if(0===this.ys.length)throw new m.Vex.RERR("NoYValues","Can't draw note without Y values.");var a=this.getNoteHeadBeginX(),b=this.hasStem()&&!this.beam;this.note_heads.forEach(function(b){return b.setX(a)});var c=this.getStemX();this.stem.setNoteHeadXBounds(c,c),g("Rendering ",this.isChord()?"chord :":"note :",this.keys),this.drawLedgerLines(),this.applyStyle(),this.setAttribute("el",this.context.openGroup("stavenote",this.getAttribute("id"))),this.context.openGroup("note",null,{pointerBBox:!0}),b&&this.drawStem(),this.drawNoteHeads(),this.drawFlag(),this.context.closeGroup(),this.drawModifiers(),this.context.closeGroup(),this.restoreStyle(),this.setRendered()}}]),b}(r.StemmableNote)},function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b}function f(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(b,"__esModule",{value:!0}),b.Note=void 0;var g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},h=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),i=c(0),j=c(1),k=c(42);b.Note=function(a){function b(a){d(this,b);var c=e(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));if(c.setAttribute("type","Note"),!a)throw new i.Vex.RuntimeError("BadArguments","Note must have valid initialization data to identify duration and type.");var f=j.Flow.parseNoteData(a);if(!f)throw new i.Vex.RuntimeError("BadArguments","Invalid note initialization object: "+JSON.stringify(a));if(c.duration=f.duration,c.dots=f.dots,c.no