vexflow 5.1.2 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/build/cjs/vexflow-bravura.js +2 -2
- package/build/cjs/vexflow-bravura.js.map +1 -1
- package/build/cjs/vexflow-core.js +2 -2
- package/build/cjs/vexflow-core.js.map +1 -1
- package/build/cjs/vexflow-debug-with-tests.js +5325 -1730
- package/build/cjs/vexflow-debug-with-tests.js.map +1 -1
- package/build/cjs/vexflow-debug.js +4228 -1545
- package/build/cjs/vexflow-debug.js.map +1 -1
- package/build/cjs/vexflow.js +2 -2
- package/build/cjs/vexflow.js.map +1 -1
- package/build/esm/src/accidental.js +13 -3
- package/build/esm/src/articulation.js +51 -20
- package/build/esm/src/beam.js +170 -30
- package/build/esm/src/bend.js +24 -19
- package/build/esm/src/clef.js +3 -0
- package/build/esm/src/clefnote.js +5 -1
- package/build/esm/src/curve.js +27 -53
- package/build/esm/src/dot.js +14 -5
- package/build/esm/src/easyscore/composition.js +336 -0
- package/build/esm/src/easyscore/elementindex.js +81 -0
- package/build/esm/src/easyscore/elements.js +324 -0
- package/build/esm/src/easyscore/policies.js +97 -0
- package/build/esm/src/easyscore/rhythm.js +42 -0
- package/build/esm/src/easyscore.js +448 -26
- package/build/esm/src/element.js +17 -2
- package/build/esm/src/engravinggeometry.js +150 -0
- package/build/esm/src/engravingprofile.js +44 -0
- package/build/esm/src/factory.js +268 -64
- package/build/esm/src/formatter.js +40 -4
- package/build/esm/src/gracenote.js +43 -38
- package/build/esm/src/gracenotegroup.js +53 -56
- package/build/esm/src/index.js +2 -0
- package/build/esm/src/keysignature.js +10 -2
- package/build/esm/src/keysignote.js +2 -2
- package/build/esm/src/modifiercontext.js +11 -0
- package/build/esm/src/note.js +5 -0
- package/build/esm/src/notehead.js +11 -6
- package/build/esm/src/ornament.js +38 -18
- package/build/esm/src/parenthesis.js +1 -1
- package/build/esm/src/parser.js +6 -1
- package/build/esm/src/proportionalformatter.js +234 -0
- package/build/esm/src/registry.js +27 -0
- package/build/esm/src/sheet.js +20 -3
- package/build/esm/src/stave.js +9 -2
- package/build/esm/src/stavenote.js +140 -127
- package/build/esm/src/stavetie.js +39 -7
- package/build/esm/src/stem.js +26 -11
- package/build/esm/src/stemmablenote.js +6 -1
- package/build/esm/src/tickable.js +5 -0
- package/build/esm/src/tickcontext.js +19 -0
- package/build/esm/src/timesignature.js +5 -0
- package/build/esm/src/tuplet.js +60 -19
- package/build/esm/src/version.js +3 -3
- package/build/esm/src/vexflow.js +6 -1
- package/build/esm/tests/beam_tests.js +35 -0
- package/build/esm/tests/bend_tests.js +14 -1
- package/build/esm/tests/curve_tests.js +14 -4
- package/build/esm/tests/demo_repertoire_tests.js +27 -0
- package/build/esm/tests/demos/drums.js +54 -0
- package/build/esm/tests/demos/electric.js +63 -0
- package/build/esm/tests/demos/greensleeves.js +90 -0
- package/build/esm/tests/demos/joy.js +61 -0
- package/build/esm/tests/demos/kesh.js +80 -0
- package/build/esm/tests/demos/prelude.js +59 -0
- package/build/esm/tests/demos/quartertones.js +50 -0
- package/build/esm/tests/demos/saints.js +65 -0
- package/build/esm/tests/easyscore_tests.js +40 -0
- package/build/esm/tests/easyscore_types.js +65 -0
- package/build/esm/tests/engraving/score-layout.mjs +75 -0
- package/build/esm/tests/engraving/score-persistence.mjs +262 -0
- package/build/esm/tests/engraving/studies.mjs +279 -0
- package/build/esm/tests/formatter_tests.js +51 -1
- package/build/esm/tests/index.js +1 -0
- package/build/esm/tests/node/audit-dependencies-tests.mjs +42 -0
- package/build/esm/tests/node/easyscore-rendering-tests.mjs +332 -0
- package/build/esm/tests/node/easyscore-tests.mjs +1024 -0
- package/build/esm/tests/node/engraving-layout-tests.mjs +449 -0
- package/build/esm/tests/node/local-engraving-tests.mjs +128 -0
- package/build/esm/tests/node/proportional-spacing-tests.mjs +278 -0
- package/build/esm/tests/node/rendering-tests.mjs +6 -2
- package/build/esm/tests/threevoice_tests.js +11 -1
- package/build/esm/tests/vexflow_test_helpers.js +19 -10
- package/build/esm/tools/audit-dependencies.mjs +61 -0
- package/build/esm/tools/easyscore-api-audit.mjs +58 -0
- package/build/esm/tools/easyscore-composition.mjs +62 -0
- package/build/esm/tools/easyscore-example.mjs +16 -0
- package/build/esm/tools/easyscore-families.mjs +61 -0
- package/build/esm/tools/easyscore-references-example.mjs +26 -0
- package/build/esm/tools/easyscore-rhythm.mjs +58 -0
- package/build/esm/tools/easyscore-structure.mjs +88 -0
- package/build/esm/tools/explorer/catalog/entries.mjs +6 -0
- package/build/esm/tools/explorer/catalog/expression.mjs +68 -0
- package/build/esm/tools/explorer/catalog/helpers.mjs +29 -0
- package/build/esm/tools/explorer/catalog/layout.mjs +109 -0
- package/build/esm/tools/explorer/catalog/notes.mjs +61 -0
- package/build/esm/tools/explorer/catalog/staves.mjs +85 -0
- package/build/esm/tools/explorer/catalog/strings.mjs +25 -0
- package/build/esm/tools/explorer/catalog.mjs +14 -0
- package/build/esm/tools/score-fixtures.mjs +23 -6
- package/build/types/src/accidental.d.ts +6 -0
- package/build/types/src/articulation.d.ts +12 -1
- package/build/types/src/beam.d.ts +16 -0
- package/build/types/src/clef.d.ts +2 -0
- package/build/types/src/curve.d.ts +9 -0
- package/build/types/src/dot.d.ts +5 -0
- package/build/types/src/easyscore/composition.d.ts +126 -0
- package/build/types/src/easyscore/elementindex.d.ts +30 -0
- package/build/types/src/easyscore/elements.d.ts +156 -0
- package/build/types/src/easyscore/policies.d.ts +12 -0
- package/build/types/src/easyscore/rhythm.d.ts +9 -0
- package/build/types/src/easyscore.d.ts +153 -11
- package/build/types/src/element.d.ts +7 -1
- package/build/types/src/engravinggeometry.d.ts +31 -0
- package/build/types/src/engravingprofile.d.ts +20 -0
- package/build/types/src/factory.d.ts +97 -9
- package/build/types/src/formatter.d.ts +7 -1
- package/build/types/src/gracenote.d.ts +7 -0
- package/build/types/src/gracenotegroup.d.ts +7 -2
- package/build/types/src/index.d.ts +2 -0
- package/build/types/src/keysignature.d.ts +3 -0
- package/build/types/src/keysignote.d.ts +1 -1
- package/build/types/src/modifiercontext.d.ts +4 -0
- package/build/types/src/note.d.ts +2 -0
- package/build/types/src/notehead.d.ts +5 -0
- package/build/types/src/ornament.d.ts +7 -0
- package/build/types/src/parser.d.ts +5 -0
- package/build/types/src/proportionalformatter.d.ts +39 -0
- package/build/types/src/registry.d.ts +4 -0
- package/build/types/src/stave.d.ts +2 -0
- package/build/types/src/stavenote.d.ts +21 -3
- package/build/types/src/stavetie.d.ts +4 -0
- package/build/types/src/stem.d.ts +10 -1
- package/build/types/src/stemmablenote.d.ts +6 -1
- package/build/types/src/tickable.d.ts +2 -0
- package/build/types/src/tickcontext.d.ts +5 -0
- package/build/types/src/timesignature.d.ts +2 -0
- package/build/types/src/tuplet.d.ts +5 -48
- package/build/types/src/vexflow.d.ts +6 -1
- package/changelog/CHANGELOG.md +52 -0
- package/package.json +13 -3
- package/tests/all.html +277 -0
- package/tests/demo_petzold_tests.ts +435 -0
- package/tests/demos/drums.ts +55 -0
- package/tests/demos/drums.webp +0 -0
- package/tests/demos/electric.ts +70 -0
- package/tests/demos/electric.webp +0 -0
- package/tests/demos/greensleeves.ts +97 -0
- package/tests/demos/greensleeves.webp +0 -0
- package/tests/demos/joy.ts +65 -0
- package/tests/demos/joy.webp +0 -0
- package/tests/demos/kesh.ts +86 -0
- package/tests/demos/kesh.webp +0 -0
- package/tests/demos/prelude.ts +65 -0
- package/tests/demos/prelude.webp +0 -0
- package/tests/demos/quartertones.ts +51 -0
- package/tests/demos/quartertones.webp +0 -0
- package/tests/demos/saints.ts +70 -0
- package/tests/demos/saints.webp +0 -0
- package/tests/flow.html +550 -239
- package/tests/fonts.css +493 -0
- package/tests/minuet.webp +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* VexFlow 5.
|
|
2
|
+
* VexFlow 5.3.0 2026-11-18T16:43:59.349Z 18f11424bdf291599683d063b18ded0dc840f0e0
|
|
3
3
|
* Copyright (c) 2023-present VexFlow contributors (see https://github.com/vexflow/vexflow/blob/main/AUTHORS.md).
|
|
4
4
|
*/
|
|
5
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.VexFlow=e():t.VexFlow=e()}("undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:this,()=>(()=>{"use strict";const t={d:(e,i)=>{if(Array.isArray(i))for(var s=0;s<i.length;){var n=i[s++],o=i[s++];t.o(e,n)?0===o&&s++:0===o?Object.defineProperty(e,n,{enumerable:!0,value:i[s++]}):Object.defineProperty(e,n,{enumerable:!0,get:o})}else for(var n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})}};t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),t.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let e={};t.d(e,{default:()=>Ri});const i="object"==typeof self?self:globalThis,s=t=>((t,e)=>{const s=(e,i)=>(t.set(i,e),e),n=o=>{if(t.has(o))return t.get(o);const[a,r]=e[o];switch(a){case 0:case-1:return s(r,o);case 1:{const t=s([],o);for(const e of r)t.push(n(e));return t}case 2:{const t=s({},o);for(const[e,i]of r)t[n(e)]=n(i);return t}case 3:return s(new Date(r),o);case 4:{const{source:t,flags:e}=r;return s(new RegExp(t,e),o)}case 5:{const t=s(new Map,o);for(const[e,i]of r)t.set(n(e),n(i));return t}case 6:{const t=s(new Set,o);for(const e of r)t.add(n(e));return t}case 7:{const{name:t,message:e}=r;return s(new i[t](e),o)}case 8:return s(BigInt(r),o);case"BigInt":return s(Object(BigInt(r)),o)}return s(new i[a](r),o)};return n})(new Map,t)(0),n="",{toString:o}={},{keys:a}=Object,r=t=>{const e=typeof t;if("object"!==e||!t)return[0,e];const i=o.call(t).slice(8,-1);switch(i){case"Array":return[1,n];case"Object":return[2,n];case"Date":return[3,n];case"RegExp":return[4,n];case"Map":return[5,n];case"Set":return[6,n]}return i.includes("Array")?[1,i]:i.includes("Error")?[7,i]:[2,i]},h=([t,e])=>0===t&&("function"===e||"symbol"===e),c=(t,{json:e,lossy:i}={})=>{const s=[];return((t,e,i,s)=>{const n=(t,e)=>{const n=s.push(t)-1;return i.set(e,n),n},o=s=>{if(i.has(s))return i.get(s);let[c,l]=r(s);switch(c){case 0:{let e=s;switch(l){case"bigint":c=8,e=s.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);e=null;break;case"undefined":return n([-1],s)}return n([c,e],s)}case 1:{if(l)return n([l,[...s]],s);const t=[],e=n([c,t],s);for(const e of s)t.push(o(e));return e}case 2:{if(l)switch(l){case"BigInt":return n([l,s.toString()],s);case"Boolean":case"Number":case"String":return n([l,s.valueOf()],s)}if(e&&"toJSON"in s)return o(s.toJSON());const i=[],d=n([c,i],s);for(const e of a(s))!t&&h(r(s[e]))||i.push([o(e),o(s[e])]);return d}case 3:return n([c,s.toISOString()],s);case 4:{const{source:t,flags:e}=s;return n([c,{source:t,flags:e}],s)}case 5:{const e=[],i=n([c,e],s);for(const[i,n]of s)(t||!h(r(i))&&!h(r(n)))&&e.push([o(i),o(n)]);return i}case 6:{const e=[],i=n([c,e],s);for(const i of s)!t&&h(r(i))||e.push(o(i));return i}}const{message:d}=s;return n([c,{name:l,message:d}],s)};return o})(!(e||i),!!e,new Map,s)(t),s},l="function"==typeof structuredClone?(t,e)=>e&&("json"in e||"lossy"in e)?s(c(t,e)):structuredClone(t):(t,e)=>s(c(t,e)),{parse:d,stringify:u}=JSON,g=l;class p extends Error{constructor(t,e=""){super("[RuntimeError] "+t+": "+e),this.code=t}}function m(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t.g?t.g:Function("return this")()}function f(t,e="undefined",i=""){if(void 0===t)throw new p(e,i);return t}function S(t,...e){if(!e)return;const i=Array.prototype.slice.call(e).join(" ");m().console.log(t+": "+i)}function T(t,e){let i=e+(t-e)/2;var s,n;return i%2>0&&(i=((s=10*i)%(n=5)>=n/2?parseInt(""+s/n,10)*n+n:parseInt(""+s/n,10)*n)/10),i}function x(t){return`vf-${t}`}function w(t){return(t%=2*Math.PI)<0&&(t+=2*Math.PI),t}function b(t){return t.reduce((t,e)=>t+e,0)}class y{static get CATEGORY(){return"Fraction"}static GCD(t,e){if(!Number.isFinite(t)||!Number.isFinite(e))throw new p("BadArgument",`Invalid numbers: ${t}, ${e}`);let i;for(;0!==e;)i=e,e=t%e,t=i;return t}static LCM(t,e){return t*e/y.GCD(t,e)}static LCMM(t){return 0===t.length?0:1===t.length?t[0]:2===t.length?y.LCM(t[0],t[1]):y.LCM(t.shift(),y.LCMM(t))}constructor(t,e){this.numerator=1,this.denominator=1,this.set(t,e)}set(t=1,e=1){if(!Number.isFinite(t)||!Number.isFinite(e)||0===e)throw new p("BadArgument",`Invalid fraction: ${t}/${e}`);return this.numerator=t,this.denominator=e,this}value(){return this.numerator/this.denominator}simplify(){let t=this.numerator,e=this.denominator;const i=y.GCD(t,e);return t/=i,e/=i,e<0&&(e=-e,t=-t),this.set(t,e)}add(t=0,e=1){const[i,s]=k(t,e),n=y.LCM(this.denominator,s),o=n/this.denominator,a=n/s,r=this.numerator*o+i*a;return this.set(r,n)}subtract(t=0,e=1){const[i,s]=k(t,e),n=y.LCM(this.denominator,s),o=n/this.denominator,a=n/s,r=this.numerator*o-i*a;return this.set(r,n)}multiply(t=1,e=1){const[i,s]=k(t,e);return this.set(this.numerator*i,this.denominator*s)}divide(t=1,e=1){const[i,s]=k(t,e);return this.set(this.numerator*s,this.denominator*i)}equals(t){const e=y.fractionA.copy(t).simplify(),i=y.fractionB.copy(this).simplify();return e.numerator===i.numerator&&e.denominator===i.denominator}greaterThan(t){const e=y.fractionA.copy(this);return e.subtract(t),e.numerator>0}greaterThanEquals(t){const e=y.fractionA.copy(this);return e.subtract(t),e.numerator>=0}lessThan(t){return!this.greaterThanEquals(t)}lessThanEquals(t){return!this.greaterThan(t)}clone(){return new y(this.numerator,this.denominator)}copy(t){return"number"==typeof t?this.set(t):this.set(t.numerator,t.denominator)}quotient(){return Math.floor(this.numerator/this.denominator)}remainder(){return this.numerator%this.denominator}makeAbs(){return this.denominator=Math.abs(this.denominator),this.numerator=Math.abs(this.numerator),this}toString(){return`${this.numerator}/${this.denominator}`}toSimplifiedString(){return y.fractionA.copy(this).simplify().toString()}toMixedString(){let t="";const e=this.quotient(),i=y.fractionA.copy(this);return e<0&&i.makeAbs(),0!==e?(t+=e,0!==i.numerator&&(t+=` ${i.toSimplifiedString()}`)):t=0===i.numerator?"0":i.toSimplifiedString(),t}parse(t){const e=t.split("/"),i=parseInt(e[0],10),s=e[1]?parseInt(e[1],10):1;return this.set(i,s)}}function k(t,e=1){return"number"==typeof t?[t,e]:[t.numerator,t.denominator]}y.fractionA=new y,y.fractionB=new y;class v{static clear(){this.entries.clear()}static fontsReady(){var t;const e="undefined"!=typeof document?document.fonts:globalThis.fonts;if(e!==this.fonts){for(const i of["loading","loadingdone","loadingerror"])null===(t=this.fonts)||void 0===t||t.removeEventListener(i,this.onFontsChanged),null==e||e.addEventListener(i,this.onFontsChanged);this.fonts=e,this.clear()}return(null==e?void 0:e.size)===this.fontCount&&(null==e?void 0:e.status)===this.fontStatus||(this.fontCount=null==e?void 0:e.size,this.fontStatus=null==e?void 0:e.status,this.clear()),"loading"!==(null==e?void 0:e.status)}static snapshot(t){return Object.freeze({width:t.width,actualBoundingBoxLeft:t.actualBoundingBoxLeft,actualBoundingBoxRight:t.actualBoundingBoxRight,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent,emHeightAscent:t.emHeightAscent,emHeightDescent:t.emHeightDescent,hangingBaseline:t.hangingBaseline,alphabeticBaseline:t.alphabeticBaseline,ideographicBaseline:t.ideographicBaseline})}static measure(t,e){var i,s,n;t!==this.context&&(this.context=t,this.clear());const o=this.fontsReady();let a=t.lang,r=t.direction;const h=t.canvas;h&&"ownerDocument"in h&&("inherit"===r&&(r=h.isConnected?(null===(i=h.ownerDocument.defaultView)||void 0===i?void 0:i.getComputedStyle(h).direction)||"ltr":h.style.direction||h.dir||"ltr"),a&&"inherit"!==a||(a=null!==(n=null===(s=h.closest("[lang]"))||void 0===s?void 0:s.getAttribute("lang"))&&void 0!==n?n:h.ownerDocument.documentElement.lang));const c=JSON.stringify([t.font,r,t.textAlign,t.textBaseline,t.fontKerning,t.fontStretch,t.fontVariantCaps,t.letterSpacing,t.wordSpacing,t.textRendering,a,e]),l=o?this.entries.get(c):void 0;if(l)return this.entries.delete(c),this.entries.set(c,l),l;const d=this.snapshot(t.measureText(e));return o&&c.length<=this.maxKeyLength&&(this.entries.size>=this.maxEntries&&this.entries.delete(this.entries.keys().next().value),this.entries.set(c,d)),d}}v.maxEntries=2048,v.maxKeyLength=4096,v.entries=new Map,v.onFontsChanged=()=>v.clear();class B{static clear(t){v.clear(),t?(this.cacheFont.delete(t),this.cacheStyle.delete(t)):(this.cacheFont.clear(),this.cacheStyle.clear())}static getFontInfo(t){let e=this.cacheFont.get(t);return e||(e={family:B.getFontFamily(t),size:B.get(`${t}.fontSize`)*B.get(`${t}.fontScale`),weight:B.get(`${t}.fontWeight`),style:B.get(`${t}.fontStyle`)},this.cacheFont.set(t,e)),Object.assign({},e)}static getFontFamily(t){var e;if(!B.get(`${t}.isText`,!1))return B.get(`${t}.fontFamily`);let i=C.textFontFamily,s=C;for(const n of t.split(".")){if(s=null==s?void 0:s[n],!s)break;i=null!==(e=s.fontFamily)&&void 0!==e?e:i}return i}static getStyle(t){let e=this.cacheStyle.get(t);return e||(e={fillStyle:B.get(`${t}.fillStyle`),strokeStyle:B.get(`${t}.strokeStyle`),lineWidth:B.get(`${t}.lineWidth`),lineDash:B.get(`${t}.lineDash`),shadowBlur:B.get(`${t}.shadowBlur`),shadowColor:B.get(`${t}.shadowColor`)},this.cacheStyle.set(t,e)),Object.assign({},e)}static get(t,e){var i;const s=t.split("."),n=s.pop();let o=C,a=e;for(;o;){a=null!==(i=o[n])&&void 0!==i?i:a;const t=s.shift();if(!t)break;o=o[t]}return a}}B.cacheStyle=new Map,B.cacheFont=new Map;const C={pointerRect:!1,fontFamily:"Bravura,Academico",textFontFamily:"Academico,Bravura",fontSize:30,fontScale:1,fontWeight:"normal",fontStyle:"normal",Accidental:{cautionary:{fontSize:20},grace:{fontSize:20},noteheadAccidentalPadding:1,leftPadding:2,accidentalSpacing:3},Annotation:{isText:!0,fontSize:10},Bend:{isText:!0,fontSize:10,line:{strokeStyle:"#777777",lineWidth:1}},ChordSymbol:{isText:!0,fontSize:12,spacing:.05,subscriptOffset:.2,superscriptOffset:-.4,superSubRatio:.6},FretHandFinger:{isText:!0,fontSize:9,fontWeight:"bold"},GraceNote:{fontScale:2/3},GraceTabNote:{fontScale:2/3},NoteHead:{minPadding:2},PedalMarking:{text:{isText:!0,fontSize:12,fontStyle:"italic"}},Repetition:{text:{isText:!0,fontSize:12,fontWeight:"bold",offsetX:12,offsetY:25,spacing:5},coda:{offsetY:25},segno:{offsetY:10}},Stave:{isText:!0,strokeStyle:"#999999",fontSize:8,padding:12,endPaddingMax:10,endPaddingMin:5,unalignedNotePadding:10},StaveConnector:{text:{isText:!0,fontSize:16}},StaveLine:{isText:!0,fontSize:10},StaveNote:{pointerRect:!0},StaveSection:{isText:!0,fontSize:10,fontWeight:"bold",lineWidth:2,padding:2,strokeStyle:"black"},StaveTempo:{isText:!0,fontSize:14,glyph:{isText:!1,fontSize:25},name:{fontWeight:"bold"}},StaveText:{isText:!0,fontSize:16},StaveTie:{isText:!0,fontSize:10},Stem:{strokeStyle:"black"},StringNumber:{isText:!0,fontSize:10,fontWeight:"bold",verticalPadding:8,stemPadding:2,leftPadding:5,rightPadding:6},Stroke:{text:{isText:!0,fontSize:10,fontStyle:"italic",fontWeight:"bold"}},TabNote:{text:{isText:!0,fontSize:9}},TabSlide:{isText:!0,fontSize:10,fontStyle:"italic",fontWeight:"bold"},TabStave:{isText:!0,strokeStyle:"#999999",fontSize:8},TabTie:{isText:!0,fontSize:10},TextBracket:{isText:!0,fontSize:15,fontStyle:"italic"},TextNote:{text:{isText:!0,fontSize:12}},Tremolo:{spacing:7},Tuplet:{pointerRect:!0,yOffset:0,textYOffset:2,bracket:{padding:5,lineWidth:1,legLength:10},suffix:{fontScale:.5,extraSpacing:1,suffixOffsetY:-3}},Volta:{isText:!0,fontSize:9,fontWeight:"bold"}};class D{static copy(t){return new D(t.x,t.y,t.w,t.h)}constructor(t,e,i,s){this.x=t,this.y=e,this.w=i,this.h=s}getX(){return this.x}getY(){return this.y}getW(){return this.w}getH(){return this.h}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setW(t){return this.w=t,this}setH(t){return this.h=t,this}move(t,e){return this.x+=t,this.y+=e,this}clone(){return D.copy(this)}mergeWith(t){const e=t,i=this.x<e.x?this.x:e.x,s=this.y<e.y?this.y:e.y,n=Math.max(this.x+this.w,e.x+e.w)-i,o=Math.max(this.y+this.h,e.y+e.h)-s;return this.x=i,this.y=s,this.w=n,this.h=o,this}}var E,L,N=function(t,e,i,s){return new(i||(i=Promise))(function(n,o){function a(t){try{h(s.next(t))}catch(t){o(t)}}function r(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(a,r)}h((s=s.apply(t,e||[])).next())})};let F;!function(t){t.NORMAL="normal",t.BOLD="bold"}(E||(E={})),function(t){t.NORMAL="normal",t.ITALIC="italic"}(L||(L={}));class A{static convertSizeToPixelValue(t){var e;if("number"==typeof t)return t*A.scaleToPxFrom.pt;{const i=parseFloat(t);if(isNaN(i))return 0;const s=t.replace(/[\d.\s]/g,"").toLowerCase();return i*(null!==(e=A.scaleToPxFrom[s])&&void 0!==e?e:1)}}static convertSizeToPointValue(t){var e;if("number"==typeof t)return t;{const i=parseFloat(t);if(isNaN(i))return 0;const s=t.replace(/[\d.\s]/g,"").toLowerCase();return i*((null!==(e=A.scaleToPxFrom[s])&&void 0!==e?e:1)/A.scaleToPxFrom.pt)}}static validate(t,e,i,s){if("string"==typeof t&&void 0===e&&void 0===i&&void 0===s)return A.fromCSSString(t);let n;return"object"==typeof t?(n=t.family,e=t.size,i=t.weight,s=t.style):n=t,n=null!=n?n:B.get("fontFamily"),e=null!=e?e:B.get("fontSize")+"pt",i=null!=i?i:E.NORMAL,s=null!=s?s:L.NORMAL,""===i&&(i=E.NORMAL),""===s&&(s=L.NORMAL),"number"==typeof e&&(e=`${e}pt`),"number"==typeof i&&(i=i.toString()),{family:n,size:e,weight:i,style:s}}static fromCSSString(t){F||(F=document.createElement("span")),F.style.font=t;const{fontFamily:e,fontSize:i,fontWeight:s,fontStyle:n}=F.style;return{family:e,size:i,weight:s,style:n}}static toCSSString(t){var e;if(!t)return"";let i;const s=t.style;let n;i=s===L.NORMAL||""===s||void 0===s?"":s.trim()+" ";const o=t.weight;let a;n=o===E.NORMAL||""===o||void 0===o?"":"number"==typeof o?o+" ":o.trim()+" ";const r=t.size;a=void 0===r?B.get("fontSize")+"pt":"number"==typeof r?r+"pt ":r.trim()+" ";return`${i}${n}${a}${null!==(e=t.family)&&void 0!==e?e:B.get("fontFamily")}`}static scaleSize(t,e){if("number"==typeof t)return t*e;return`${parseFloat(t)*e}${t.replace(/[\d.\s]/g,"")}`}static isBold(t){if(t){if("number"==typeof t)return t>=600;{const e=parseInt(t,10);return isNaN(e)?"bold"===t.toLowerCase():e>=600}}return!1}static isItalic(t){return!!t&&t.toLowerCase()===L.ITALIC}static load(t,e,i){return N(this,void 0,void 0,function*(){if("undefined"==typeof FontFace)return Promise.reject(new Error("FontFace API is not available in this environment. Cannot load fonts."));if(void 0===e){const i=A.FILES;if(!(t in i))return Promise.reject(new Error(`Font ${t} not found in Font.FILES`));e=A.HOST_URL+i[t]}const s=new FontFace(t,`url(${e})`,i),n=s.load();let o;return"undefined"!=typeof document?o=document.fonts:"undefined"!=typeof self&&"fonts"in self&&(o=self.fonts),null==o||o.add(s),v.clear(),n.finally(()=>v.clear())})}static getURLForFont(t){const e=A.FILES;if(t in e)return A.HOST_URL+e[t]}}A.TEXT_FONT_NAMES=["Academico","Edwin","Bravura Text","Finale Ash Text","Finale Broadway Text","Finale Jazz Text","Finale Maestro Text","Gootville Text","Leland Text","MuseJazz Text","Nepomuk","Petaluma Script","Petaluma Text","Roboto Slab","Sebastian Text"],A.scaleToPxFrom={pt:4/3,px:1,em:16,"%":.16,in:96,mm:96/25.4,cm:96/2.54},A.HOST_URL="https://cdn.jsdelivr.net/npm/@vexflow-fonts/",A.FILES={Academico:"academico/academico.woff2",Bravura:"bravura/bravura.woff2","Bravura Text":"bravuratext/bravuratext.woff2",Edwin:"edwin/edwin-roman.woff2","Finale Ash":"finaleash/finaleash.woff2","Finale Ash Text":"finaleashtext/finaleashtext.woff2","Finale Broadway":"finalebroadway/finalebroadway.woff2","Finale Broadway Text":"finalebroadwaytext/finalebroadwaytext.woff2","Finale Jazz":"finalejazz/finalejazz.woff2","Finale Jazz Text":"finalejazztext/finalejazztext.woff2","Finale Maestro":"finalemaestro/finalemaestro.woff2","Finale Maestro Text":"finalemaestrotext/finalemaestrotext-regular.woff2",Gonville:"gonville/gonville.woff2",Gootville:"gootville/gootville.woff2","Gootville Text":"gootvilletext/gootvilletext.woff2",Leipzig:"leipzig/leipzig.woff2",Leland:"leland/leland.woff2","Leland Text":"lelandtext/lelandtext.woff2",MuseJazz:"musejazz/musejazz.woff2","MuseJazz Text":"musejazztext/musejazztext.woff2",Nepomuk:"nepomuk/nepomuk.woff2",Petaluma:"petaluma/petaluma.woff2","Petaluma Script":"petalumascript/petalumascript.woff2","Petaluma Text":"petalumatext/petalumatext.woff2","Roboto Slab":"robotoslab/robotoslab-regular-400.woff2",Sebastian:"sebastian/sebastian.woff2","Sebastian Text":"sebastiantext/sebastiantext.woff2"};class O{constructor(){this.id=Object.create(null),this.type=Object.create(null),this.class=Object.create(null)}static isValidName(t){return"id"===t||"type"===t||"class"===t}}class R{static getDefaultRegistry(){return R.defaultRegistry}static enableDefaultRegistry(t){R.defaultRegistry=t}static disableDefaultRegistry(){R.defaultRegistry=void 0}constructor(){this.index=new O}clear(){return this.index=new O,this}setIndexValue(t,e,i,s){if(!O.isValidName(t))throw new p("BadArgument",`Unknown registry index: ${t}`);const n=this.index;n[t][e]||(n[t][e]=Object.create(null)),n[t][e][i]=s}updateIndex({id:t,name:e,value:i,oldValue:s}){if(!O.isValidName(e))throw new p("BadArgument",`Unknown registry index: ${e}`);const n=this.getElementById(t);void 0!==s&&this.index[e][s]&&delete this.index[e][s][t],i&&n&&this.setIndexValue(e,i,n.getAttribute("id"),n)}register(t,e){if(!(e=e||t.getAttribute("id")))throw new p("Can't add element without `id` attribute to registry");return t.setAttribute("id",e),this.setIndexValue("id",e,e,t),this.updateIndex({id:e,name:"type",value:t.getAttribute("type"),oldValue:void 0}),t.onRegister(this),this}getElementById(t){var e,i;return null===(i=null===(e=this.index.id)||void 0===e?void 0:e[t])||void 0===i?void 0:i[t]}getElementsByAttribute(t,e){if(!O.isValidName(t))return[];const i=this.index[t];if(i){const t=i[e];if(t){return Object.keys(t).map(e=>t[e])}}return[]}getElementsByType(t){return this.getElementsByAttribute("type",t)}getElementsByClass(t){return this.getElementsByAttribute("class",t)}onUpdate(t){return O.isValidName(t.name)&&this.updateIndex(t),this}}class P{static get CATEGORY(){return"Element"}static newID(){return"auto"+P.ID++}static setTextMeasurementCanvas(t){P.txtCanvas=t,P.clearTextMeasurementCache()}static clearTextMeasurementCache(){v.clear()}static getTextMeasurementCanvas(){let t=P.txtCanvas;return t||("undefined"!=typeof document?t=document.createElement("canvas"):"undefined"!=typeof OffscreenCanvas&&(t=new OffscreenCanvas(300,150)),P.txtCanvas=t),t}constructor(t){var e;this.children=[],this.style={},this.styleExplicit=!1,this._text="",this.metricsValid=!1,this._textMetrics={fontBoundingBoxAscent:0,fontBoundingBoxDescent:0,actualBoundingBoxAscent:0,actualBoundingBoxDescent:0,actualBoundingBoxLeft:0,actualBoundingBoxRight:0,width:0,alphabeticBaseline:0,emHeightAscent:0,emHeightDescent:0,hangingBaseline:0,ideographicBaseline:0},this._height=0,this._width=0,this.xShift=0,this.yShift=0,this.x=0,this.y=0,this.attrs={id:P.newID(),type:null!=t?t:this.constructor.CATEGORY,class:""},this.rendered=!1,this._fontInfo=B.getFontInfo(this.attrs.type),this.style=B.getStyle(this.attrs.type),this.fontScale=B.get(`${this.attrs.type}.fontScale`),this.shouldDrawPointerRect=B.get(`${this.attrs.type}.pointerRect`),null===(e=R.getDefaultRegistry())||void 0===e||e.register(this)}addChild(t){if(t.parent)throw new p("Element","Parent already defined");return t.parent=this,this.children.push(t),this}getCategory(){return this.attrs.type}setStyle(t){return this.style=t,this.styleExplicit=!0,this}setGroupStyle(t){return this.style=t,this.styleExplicit=!0,this.children.forEach(e=>e.setGroupStyle(t)),this}getStyle(){return this.style}applyStyle(t=this.context,e=this.getStyle()){if(!t)return this;if(e===this.style&&!this.styleExplicit){const i=t.getDefaultStyle();e=Object.assign({},e),void 0!==i.fillStyle&&delete e.fillStyle,void 0!==i.strokeStyle&&delete e.strokeStyle}return e.shadowColor&&t.setShadowColor(e.shadowColor),void 0!==e.shadowBlur&&t.setShadowBlur(e.shadowBlur),e.fillStyle&&t.setFillStyle(e.fillStyle),e.strokeStyle&&t.setStrokeStyle(e.strokeStyle),void 0!==e.lineWidth&&t.setLineWidth(e.lineWidth),void 0!==e.lineDash&&t.setLineDash(e.lineDash?e.lineDash.split(" ").map(Number):[]),this}drawWithStyle(){const t=this.checkContext(),e=t.getDefaultStyle();t.save();try{if(this.styleExplicit){const i=Object.assign({},e);void 0!==this.style.fillStyle&&(i.fillStyle=this.style.fillStyle),void 0!==this.style.strokeStyle&&(i.strokeStyle=this.style.strokeStyle),t.setDefaultStyle(i)}this.applyStyle(t),this.draw()}finally{t.setDefaultStyle(e),t.restore()}return this}draw(){throw new p("Element","Draw not defined")}hasClass(t){var e;return!!this.attrs.class&&-1!==(null===(e=this.attrs.class)||void 0===e?void 0:e.split(" ").indexOf(t))}addClass(t){var e;return this.hasClass(t)||(this.attrs.class?this.attrs.class=`${this.attrs.class} ${t}`:this.attrs.class=`${t}`,null===(e=this.registry)||void 0===e||e.onUpdate({id:this.attrs.id,name:"class",value:t,oldValue:void 0})),this}removeClass(t){var e,i;if(!this.hasClass(t))return this;const s=null===(e=this.attrs.class)||void 0===e?void 0:e.split(" ");return s&&(s.splice(s.indexOf(t)),this.attrs.class=s.join(" ")),null===(i=this.registry)||void 0===i||i.onUpdate({id:this.attrs.id,name:"class",value:void 0,oldValue:t}),this}onRegister(t){return this.registry=t,this}isRendered(){return this.rendered}setRendered(t=!0){return this.rendered=t,this}getAttributes(){return this.attrs}getAttribute(t){return this.attrs[t]}getSVGElement(t=""){const e=x(this.attrs.id+t),i=document.getElementById(e);if(i)return i}setAttribute(t,e){var i;const s=this.attrs.id,n=this.attrs[t];return this.attrs[t]=e,null===(i=this.registry)||void 0===i||i.onUpdate({id:s,name:t,value:e,oldValue:n}),this}getBoundingBox(){return new D(this.x+this.xShift,this.y+this.yShift-this.textMetrics.actualBoundingBoxAscent,this.width,this.height)}getContext(){return this.context}drawPointerRect(){var t;if(this.shouldDrawPointerRect){const e=this.getBoundingBox();null===(t=this.context)||void 0===t||t.pointerRect(e.getX(),e.getY(),e.getW(),e.getH())}}setContext(t){return this.context=t,this}checkContext(){return f(this.context,"NoContext","No rendering context attached to instance.")}set font(t){this.setFont(t)}get font(){return A.toCSSString(this._fontInfo)}setFont(t,e,i,s){const n=B.getFontInfo(this.attrs.type),o="object"==typeof t,a="string"==typeof t,r=void 0===e&&void 0===i&&void 0===s;return this.metricsValid=!1,this._fontInfo=o?Object.assign(Object.assign({},n),t):a&&r?A.fromCSSString(t):A.validate(null!=t?t:n.family,null!=e?e:n.size,null!=i?i:n.weight,null!=s?s:n.style),this}getFont(){return A.toCSSString(this._fontInfo)}get fontInfo(){return this._fontInfo}set fontInfo(t){this.setFont(t)}setFontSize(t){const e=this.fontInfo;return this.setFont(e.family,t,e.weight,e.style),this}getFontSize(){return this.fontSize}getFontScale(){return this.fontScale}set fontSize(t){this.setFontSize(t)}get fontSize(){let t=this.fontInfo.size;return"number"==typeof t&&(t=`${t}pt`),t}get fontSizeInPoints(){return A.convertSizeToPointValue(this.fontSize)}get fontSizeInPixels(){return A.convertSizeToPixelValue(this.fontSize)}get fontStyle(){return this.fontInfo.style}set fontStyle(t){const e=this.fontInfo;this.setFont(e.family,e.size,e.weight,t)}get fontWeight(){return this.fontInfo.weight+""}set fontWeight(t){const e=this.fontInfo;this.setFont(e.family,e.size,t,e.style)}getWidth(){return this.width}get width(){return this.metricsValid||this.measureText(),this._width}setWidth(t){return this.width=t,this}set width(t){this.metricsValid||this.measureText(),this._width=t}setX(t){return this.x=t,this}getX(){return this.x}getY(){return this.y}setY(t){return this.y=t,this}setYShift(t){return this.yShift=t,this}getYShift(){return this.yShift}setXShift(t){return this.xShift=t,this}getXShift(){return this.xShift}setText(t){return this.text=t,this}set text(t){this.metricsValid=!1,this._text=t}getText(){return this._text}get text(){return this._text}renderText(t,e,i){t.setFont(this._fontInfo),t.fillText(this._text,e+this.x+this.xShift,i+this.y+this.yShift),this.children.forEach(s=>{t.setFont(s.fontInfo),t.fillText(s.text,e+s.x+s.xShift,i+s.y+s.yShift)})}measureText(){var t;const e=null===(t=P.getTextMeasurementCanvas())||void 0===t?void 0:t.getContext("2d");return e?(e.font=A.toCSSString(A.validate(this.fontInfo)),this._textMetrics=Object.assign({},v.measure(e,this.text)),this._height=this._textMetrics.actualBoundingBoxAscent+this._textMetrics.actualBoundingBoxDescent,this._width=this._textMetrics.width,this.metricsValid=!0,this._textMetrics):(console.warn("Element: No context for txtCanvas. Returning empty text metrics."),this._textMetrics)}static measureWidth(t,e=""){var i;const s=null===(i=P.getTextMeasurementCanvas())||void 0===i?void 0:i.getContext("2d");return s?(s.font=A.toCSSString(B.getFontInfo(e)),v.measure(s,t).width):(console.warn("Element: No context for txtCanvas. Returning empty text metrics."),0)}getTextMetrics(){return this.textMetrics}get textMetrics(){return this.metricsValid||this.measureText(),this._textMetrics}getHeight(){return this.height}get height(){return this.metricsValid||this.measureText(),this._height}set height(t){this.metricsValid||this.measureText(),this._height=t}setOriginX(t){const e=this.getBoundingBox(),i=(t-Math.abs((e.getX()-this.x-this.xShift)/e.getW()))*e.getW();this.xShift=-i}setOriginY(t){const e=this.getBoundingBox(),i=(t-Math.abs((e.getY()-this.y-this.yShift)/e.getH()))*e.getH();this.yShift=-i}setOrigin(t,e){this.setOriginX(t),this.setOriginY(e)}}var M,I;P.ID=1e3,function(t){t[t.CENTER=0]="CENTER",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.ABOVE=3]="ABOVE",t[t.BELOW=4]="BELOW"}(M||(M={}));class W extends P{static get CATEGORY(){return"Modifier"}static get Position(){return M}static get PositionString(){return{center:M.CENTER,above:M.ABOVE,below:M.BELOW,left:M.LEFT,right:M.RIGHT}}constructor(){super(),this.width=0,this.textLine=0,this.position=W.Position.LEFT,this.spacingFromNextModifier=0}reset(){}getNote(){return f(this.note,"NoNote","Modifier has no note.")}checkAttachedNote(){const t=this.getCategory();return f(this.index,"NoIndex",`Can't draw ${t} without an index.`),f(this.note,"NoNote",`Can't draw ${t} without a note.`)}setNote(t){return this.note=t,this}getIndex(){return this.index}checkIndex(){return f(this.index,"NoIndex","Modifier has an invalid index.")}setIndex(t){return this.index=t,this}getModifierContext(){return this.modifierContext}checkModifierContext(){return f(this.modifierContext,"NoModifierContext","Modifier Context Required")}setModifierContext(t){return this.modifierContext=t,this}getPosition(){return this.position}setPosition(t){return this.position="string"==typeof t?W.PositionString[t]:t,this.reset(),this}setTextLine(t){return this.textLine=t,this}setYShift(t){return this.yShift=t,this}setSpacingFromNextModifier(t){this.spacingFromNextModifier=t}getSpacingFromNextModifier(){return this.spacingFromNextModifier}setXShift(t){return this.xShift=0,this.position===W.Position.LEFT?this.xShift-=t:this.xShift+=t,this}getXShift(){return this.xShift}draw(){throw this.checkContext(),new p("NotImplemented","draw() not implemented for this modifier.")}alignSubNotesWithNote(t,e,i=W.Position.LEFT){const s=e.getTickContext(),n=s.getMetrics(),o=e.getStave(),a=i===W.Position.RIGHT?s.getX()+this.getSpacingFromNextModifier()*t.length+10:s.getX()-n.modLeftPx-n.modRightPx+this.getSpacingFromNextModifier();t.forEach(t=>{const e=t.getTickContext();o&&t.setStave(o),e.setXOffset(a)})}}class H{static get NUM_TONES(){return this.canonicalNotes.length}static get roots(){return["c","d","e","f","g","a","b"]}static get rootValues(){return[0,2,4,5,7,9,11]}static get rootIndexes(){return{c:0,d:1,e:2,f:3,g:4,a:5,b:6}}static get canonicalNotes(){return["c","c#","d","d#","e","f","f#","g","g#","a","a#","b"]}static get diatonicIntervals(){return["unison","m2","M2","m3","M3","p4","dim5","p5","m6","M6","b7","M7","octave"]}static get diatonicAccidentals(){return{unison:{note:0,accidental:0},m2:{note:1,accidental:-1},M2:{note:1,accidental:0},m3:{note:2,accidental:-1},M3:{note:2,accidental:0},p4:{note:3,accidental:0},dim5:{note:4,accidental:-1},p5:{note:4,accidental:0},m6:{note:5,accidental:-1},M6:{note:5,accidental:0},b7:{note:6,accidental:-1},M7:{note:6,accidental:0},octave:{note:7,accidental:0}}}static get intervals(){return{u:0,unison:0,m2:1,b2:1,min2:1,S:1,H:1,2:2,M2:2,maj2:2,T:2,W:2,m3:3,b3:3,min3:3,M3:4,3:4,maj3:4,4:5,p4:5,"#4":6,b5:6,aug4:6,dim5:6,5:7,p5:7,"#5":8,b6:8,aug5:8,6:9,M6:9,maj6:9,b7:10,m7:10,min7:10,dom7:10,M7:11,maj7:11,8:12,octave:12}}static get scales(){return{major:[2,2,1,2,2,2,1],minor:[2,1,2,2,1,2,2],ionian:[2,2,1,2,2,2,1],dorian:[2,1,2,2,2,1,2],phyrgian:[1,2,2,2,1,2,2],lydian:[2,2,2,1,2,2,1],mixolydian:[2,2,1,2,2,1,2],aeolian:[2,1,2,2,1,2,2],locrian:[1,2,2,1,2,2,2]}}static get scaleTypes(){return{M:H.scales.major,m:H.scales.minor}}static get accidentals(){return["bb","b","n","#","##"]}static get noteValues(){return{c:{rootIndex:0,intVal:0},cn:{rootIndex:0,intVal:0},"c#":{rootIndex:0,intVal:1},"c##":{rootIndex:0,intVal:2},cb:{rootIndex:0,intVal:11},cbb:{rootIndex:0,intVal:10},d:{rootIndex:1,intVal:2},dn:{rootIndex:1,intVal:2},"d#":{rootIndex:1,intVal:3},"d##":{rootIndex:1,intVal:4},db:{rootIndex:1,intVal:1},dbb:{rootIndex:1,intVal:0},e:{rootIndex:2,intVal:4},en:{rootIndex:2,intVal:4},"e#":{rootIndex:2,intVal:5},"e##":{rootIndex:2,intVal:6},eb:{rootIndex:2,intVal:3},ebb:{rootIndex:2,intVal:2},f:{rootIndex:3,intVal:5},fn:{rootIndex:3,intVal:5},"f#":{rootIndex:3,intVal:6},"f##":{rootIndex:3,intVal:7},fb:{rootIndex:3,intVal:4},fbb:{rootIndex:3,intVal:3},g:{rootIndex:4,intVal:7},gn:{rootIndex:4,intVal:7},"g#":{rootIndex:4,intVal:8},"g##":{rootIndex:4,intVal:9},gb:{rootIndex:4,intVal:6},gbb:{rootIndex:4,intVal:5},a:{rootIndex:5,intVal:9},an:{rootIndex:5,intVal:9},"a#":{rootIndex:5,intVal:10},"a##":{rootIndex:5,intVal:11},ab:{rootIndex:5,intVal:8},abb:{rootIndex:5,intVal:7},b:{rootIndex:6,intVal:11},bn:{rootIndex:6,intVal:11},"b#":{rootIndex:6,intVal:0},"b##":{rootIndex:6,intVal:1},bb:{rootIndex:6,intVal:10},bbb:{rootIndex:6,intVal:9}}}isValidNoteValue(t){return t>=0&&t<H.canonicalNotes.length}isValidIntervalValue(t){return t>=0&&t<H.diatonicIntervals.length}getNoteParts(t){if(!t||t.length<1)throw new p("BadArguments","Invalid note name: "+t);if(t.length>3)throw new p("BadArguments","Invalid note name: "+t);const e=t.toLowerCase(),i=/^([cdefgab])(b|bb|n|#|##)?$/.exec(e);if(null!==i){return{root:i[1],accidental:i[2]}}throw new p("BadArguments","Invalid note name: "+t)}getKeyParts(t){if(!t||t.length<1)throw new p("BadArguments","Invalid key: "+t);const e=t.toLowerCase(),i=/^([cdefgab])(b|#)?(mel|harm|m|M)?$/.exec(e);if(null!==i){const t=i[1],e=i[2];let s=i[3];return s||(s="M"),{root:t,accidental:e,type:s}}throw new p("BadArguments",`Invalid key: ${t}`)}getNoteValue(t){const e=H.noteValues[t];if(void 0===e)throw new p("BadArguments",`Invalid note name: ${t}`);return e.intVal}getIntervalValue(t){const e=H.intervals[t];if(void 0===e)throw new p("BadArguments",`Invalid interval name: ${t}`);return e}getCanonicalNoteName(t){if(!this.isValidNoteValue(t))throw new p("BadArguments",`Invalid note value: ${t}`);return H.canonicalNotes[t]}getCanonicalIntervalName(t){if(!this.isValidIntervalValue(t))throw new p("BadArguments",`Invalid interval value: ${t}`);return H.diatonicIntervals[t]}getRelativeNoteValue(t,e,i=1){if(1!==i&&-1!==i)throw new p("BadArguments",`Invalid direction: ${i}`);let s=(t+i*e)%H.NUM_TONES;return s<0&&(s+=H.NUM_TONES),s}getRelativeNoteName(t,e){const i=this.getNoteParts(t),s=this.getNoteValue(i.root);let n=e-s;if(Math.abs(n)>H.NUM_TONES-3){let i=1;n>0&&(i=-1);const o=(e+1+(s+1))%H.NUM_TONES*i;if(Math.abs(o)>2)throw new p("BadArguments",`Notes not related: ${t}, ${e})`);n=o}if(Math.abs(n)>2)throw new p("BadArguments",`Notes not related: ${t}, ${e})`);let o=i.root;if(n>0)for(let t=1;t<=n;++t)o+="#";else if(n<0)for(let t=-1;t>=n;--t)o+="b";return o}getScaleTones(t,e){const i=[t];let s=t;for(let n=0;n<e.length;n++)s=this.getRelativeNoteValue(s,e[n]),s!==t&&i.push(s);return i}getIntervalBetween(t,e,i=1){if(1!==i&&-1!==i)throw new p("BadArguments",`Invalid direction: ${i}`);if(!this.isValidNoteValue(t)||!this.isValidNoteValue(e))throw new p("BadArguments",`Invalid notes: ${t}, ${e}`);let s=1===i?e-t:t-e;return s<0&&(s+=H.NUM_TONES),s}createScaleMap(t){const e=this.getKeyParts(t);if(!e.type)throw new p("BadArguments","Unsupported key type: undefined");const i=H.scaleTypes[e.type];let s=e.root;if(e.accidental&&(s+=e.accidental),!i)throw new p("BadArguments","Unsupported key type: "+t);const n=this.getScaleTones(this.getNoteValue(s),i),o=H.rootIndexes[e.root],a={};for(let t=0;t<H.roots.length;++t){const e=(o+t)%H.roots.length,i=H.roots[e];let s=this.getRelativeNoteName(i,n[t]);1===s.length&&(s+="n"),a[i]=s}return a}}!function(t){t.null="\0",t.fourStringTabClef="",t.sixStringTabClef="",t.accSagittal11LargeDiesisDown="",t.accSagittal11LargeDiesisUp="",t.accSagittal11MediumDiesisDown="",t.accSagittal11MediumDiesisUp="",t.accSagittal11v19LargeDiesisDown="",t.accSagittal11v19LargeDiesisUp="",t.accSagittal11v19MediumDiesisDown="",t.accSagittal11v19MediumDiesisUp="",t.accSagittal11v49CommaDown="",t.accSagittal11v49CommaUp="",t.accSagittal143CommaDown="",t.accSagittal143CommaUp="",t.accSagittal17CommaDown="",t.accSagittal17CommaUp="",t.accSagittal17KleismaDown="",t.accSagittal17KleismaUp="",t.accSagittal19CommaDown="",t.accSagittal19CommaUp="",t.accSagittal19SchismaDown="",t.accSagittal19SchismaUp="",t.accSagittal1MinaDown="",t.accSagittal1MinaUp="",t.accSagittal1TinaDown="",t.accSagittal1TinaUp="",t.accSagittal23CommaDown="",t.accSagittal23CommaUp="",t.accSagittal23SmallDiesisDown="",t.accSagittal23SmallDiesisUp="",t.accSagittal25SmallDiesisDown="",t.accSagittal25SmallDiesisUp="",t.accSagittal2MinasDown="",t.accSagittal2MinasUp="",t.accSagittal2TinasDown="",t.accSagittal2TinasUp="",t.accSagittal35LargeDiesisDown="",t.accSagittal35LargeDiesisUp="",t.accSagittal35MediumDiesisDown="",t.accSagittal35MediumDiesisUp="",t.accSagittal3TinasDown="",t.accSagittal3TinasUp="",t.accSagittal49LargeDiesisDown="",t.accSagittal49LargeDiesisUp="",t.accSagittal49MediumDiesisDown="",t.accSagittal49MediumDiesisUp="",t.accSagittal49SmallDiesisDown="",t.accSagittal49SmallDiesisUp="",t.accSagittal4TinasDown="",t.accSagittal4TinasUp="",t.accSagittal55CommaDown="",t.accSagittal55CommaUp="",t.accSagittal5CommaDown="",t.accSagittal5CommaUp="",t.accSagittal5TinasDown="",t.accSagittal5TinasUp="",t.accSagittal5v11SmallDiesisDown="",t.accSagittal5v11SmallDiesisUp="",t.accSagittal5v13LargeDiesisDown="",t.accSagittal5v13LargeDiesisUp="",t.accSagittal5v13MediumDiesisDown="",t.accSagittal5v13MediumDiesisUp="",t.accSagittal5v19CommaDown="",t.accSagittal5v19CommaUp="",t.accSagittal5v23SmallDiesisDown="",t.accSagittal5v23SmallDiesisUp="",t.accSagittal5v49MediumDiesisDown="",t.accSagittal5v49MediumDiesisUp="",t.accSagittal5v7KleismaDown="",t.accSagittal5v7KleismaUp="",t.accSagittal6TinasDown="",t.accSagittal6TinasUp="",t.accSagittal7CommaDown="",t.accSagittal7CommaUp="",t.accSagittal7TinasDown="",t.accSagittal7TinasUp="",t.accSagittal7v11CommaDown="",t.accSagittal7v11CommaUp="",t.accSagittal7v11KleismaDown="",t.accSagittal7v11KleismaUp="",t.accSagittal7v19CommaDown="",t.accSagittal7v19CommaUp="",t.accSagittal8TinasDown="",t.accSagittal8TinasUp="",t.accSagittal9TinasDown="",t.accSagittal9TinasUp="",t.accSagittalAcute="",t.accSagittalDoubleFlat="",t.accSagittalDoubleFlat11v49CUp="",t.accSagittalDoubleFlat143CUp="",t.accSagittalDoubleFlat17CUp="",t.accSagittalDoubleFlat17kUp="",t.accSagittalDoubleFlat19CUp="",t.accSagittalDoubleFlat19sUp="",t.accSagittalDoubleFlat23CUp="",t.accSagittalDoubleFlat23SUp="",t.accSagittalDoubleFlat25SUp="",t.accSagittalDoubleFlat49SUp="",t.accSagittalDoubleFlat55CUp="",t.accSagittalDoubleFlat5CUp="",t.accSagittalDoubleFlat5v11SUp="",t.accSagittalDoubleFlat5v19CUp="",t.accSagittalDoubleFlat5v23SUp="",t.accSagittalDoubleFlat5v7kUp="",t.accSagittalDoubleFlat7CUp="",t.accSagittalDoubleFlat7v11CUp="",t.accSagittalDoubleFlat7v11kUp="",t.accSagittalDoubleFlat7v19CUp="",t.accSagittalDoubleSharp="",t.accSagittalDoubleSharp11v49CDown="",t.accSagittalDoubleSharp143CDown="",t.accSagittalDoubleSharp17CDown="",t.accSagittalDoubleSharp17kDown="",t.accSagittalDoubleSharp19CDown="",t.accSagittalDoubleSharp19sDown="",t.accSagittalDoubleSharp23CDown="",t.accSagittalDoubleSharp23SDown="",t.accSagittalDoubleSharp25SDown="",t.accSagittalDoubleSharp49SDown="",t.accSagittalDoubleSharp55CDown="",t.accSagittalDoubleSharp5CDown="",t.accSagittalDoubleSharp5v11SDown="",t.accSagittalDoubleSharp5v19CDown="",t.accSagittalDoubleSharp5v23SDown="",t.accSagittalDoubleSharp5v7kDown="",t.accSagittalDoubleSharp7CDown="",t.accSagittalDoubleSharp7v11CDown="",t.accSagittalDoubleSharp7v11kDown="",t.accSagittalDoubleSharp7v19CDown="",t.accSagittalFlat="",t.accSagittalFlat11LDown="",t.accSagittalFlat11MDown="",t.accSagittalFlat11v19LDown="",t.accSagittalFlat11v19MDown="",t.accSagittalFlat11v49CDown="",t.accSagittalFlat11v49CUp="",t.accSagittalFlat143CDown="",t.accSagittalFlat143CUp="",t.accSagittalFlat17CDown="",t.accSagittalFlat17CUp="",t.accSagittalFlat17kDown="",t.accSagittalFlat17kUp="",t.accSagittalFlat19CDown="",t.accSagittalFlat19CUp="",t.accSagittalFlat19sDown="",t.accSagittalFlat19sUp="",t.accSagittalFlat23CDown="",t.accSagittalFlat23CUp="",t.accSagittalFlat23SDown="",t.accSagittalFlat23SUp="",t.accSagittalFlat25SDown="",t.accSagittalFlat25SUp="",t.accSagittalFlat35LDown="",t.accSagittalFlat35MDown="",t.accSagittalFlat49LDown="",t.accSagittalFlat49MDown="",t.accSagittalFlat49SDown="",t.accSagittalFlat49SUp="",t.accSagittalFlat55CDown="",t.accSagittalFlat55CUp="",t.accSagittalFlat5CDown="",t.accSagittalFlat5CUp="",t.accSagittalFlat5v11SDown="",t.accSagittalFlat5v11SUp="",t.accSagittalFlat5v13LDown="",t.accSagittalFlat5v13MDown="",t.accSagittalFlat5v19CDown="",t.accSagittalFlat5v19CUp="",t.accSagittalFlat5v23SDown="",t.accSagittalFlat5v23SUp="",t.accSagittalFlat5v49MDown="",t.accSagittalFlat5v7kDown="",t.accSagittalFlat5v7kUp="",t.accSagittalFlat7CDown="",t.accSagittalFlat7CUp="",t.accSagittalFlat7v11CDown="",t.accSagittalFlat7v11CUp="",t.accSagittalFlat7v11kDown="",t.accSagittalFlat7v11kUp="",t.accSagittalFlat7v19CDown="",t.accSagittalFlat7v19CUp="",t.accSagittalFractionalTinaDown="",t.accSagittalFractionalTinaUp="",t.accSagittalGrave="",t.accSagittalShaftDown="",t.accSagittalShaftUp="",t.accSagittalSharp="",t.accSagittalSharp11LUp="",t.accSagittalSharp11MUp="",t.accSagittalSharp11v19LUp="",t.accSagittalSharp11v19MUp="",t.accSagittalSharp11v49CDown="",t.accSagittalSharp11v49CUp="",t.accSagittalSharp143CDown="",t.accSagittalSharp143CUp="",t.accSagittalSharp17CDown="",t.accSagittalSharp17CUp="",t.accSagittalSharp17kDown="",t.accSagittalSharp17kUp="",t.accSagittalSharp19CDown="",t.accSagittalSharp19CUp="",t.accSagittalSharp19sDown="",t.accSagittalSharp19sUp="",t.accSagittalSharp23CDown="",t.accSagittalSharp23CUp="",t.accSagittalSharp23SDown="",t.accSagittalSharp23SUp="",t.accSagittalSharp25SDown="",t.accSagittalSharp25SUp="",t.accSagittalSharp35LUp="",t.accSagittalSharp35MUp="",t.accSagittalSharp49LUp="",t.accSagittalSharp49MUp="",t.accSagittalSharp49SDown="",t.accSagittalSharp49SUp="",t.accSagittalSharp55CDown="",t.accSagittalSharp55CUp="",t.accSagittalSharp5CDown="",t.accSagittalSharp5CUp="",t.accSagittalSharp5v11SDown="",t.accSagittalSharp5v11SUp="",t.accSagittalSharp5v13LUp="",t.accSagittalSharp5v13MUp="",t.accSagittalSharp5v19CDown="",t.accSagittalSharp5v19CUp="",t.accSagittalSharp5v23SDown="",t.accSagittalSharp5v23SUp="",t.accSagittalSharp5v49MUp="",t.accSagittalSharp5v7kDown="",t.accSagittalSharp5v7kUp="",t.accSagittalSharp7CDown="",t.accSagittalSharp7CUp="",t.accSagittalSharp7v11CDown="",t.accSagittalSharp7v11CUp="",t.accSagittalSharp7v11kDown="",t.accSagittalSharp7v11kUp="",t.accSagittalSharp7v19CDown="",t.accSagittalSharp7v19CUp="",t.accSagittalUnused1="",t.accSagittalUnused2="",t.accSagittalUnused3="",t.accSagittalUnused4="",t.accdnCombDot="",t.accdnCombLH2RanksEmpty="",t.accdnCombLH3RanksEmptySquare="",t.accdnCombRH3RanksEmpty="",t.accdnCombRH4RanksEmpty="",t.accdnDiatonicClef="",t.accdnLH2Ranks16Round="",t.accdnLH2Ranks8Plus16Round="",t.accdnLH2Ranks8Round="",t.accdnLH2RanksFullMasterRound="",t.accdnLH2RanksMasterPlus16Round="",t.accdnLH2RanksMasterRound="",t.accdnLH3Ranks2Plus8Square="",t.accdnLH3Ranks2Square="",t.accdnLH3Ranks8Square="",t.accdnLH3RanksDouble8Square="",t.accdnLH3RanksTuttiSquare="",t.accdnPull="",t.accdnPush="",t.accdnRH3RanksAccordion="",t.accdnRH3RanksAuthenticMusette="",t.accdnRH3RanksBandoneon="",t.accdnRH3RanksBassoon="",t.accdnRH3RanksClarinet="",t.accdnRH3RanksDoubleTremoloLower8ve="",t.accdnRH3RanksDoubleTremoloUpper8ve="",t.accdnRH3RanksFullFactory="",t.accdnRH3RanksHarmonium="",t.accdnRH3RanksImitationMusette="",t.accdnRH3RanksLowerTremolo8="",t.accdnRH3RanksMaster="",t.accdnRH3RanksOboe="",t.accdnRH3RanksOrgan="",t.accdnRH3RanksPiccolo="",t.accdnRH3RanksTremoloLower8ve="",t.accdnRH3RanksTremoloUpper8ve="",t.accdnRH3RanksTwoChoirs="",t.accdnRH3RanksUpperTremolo8="",t.accdnRH3RanksViolin="",t.accdnRH4RanksAlto="",t.accdnRH4RanksBassAlto="",t.accdnRH4RanksMaster="",t.accdnRH4RanksSoftBass="",t.accdnRH4RanksSoftTenor="",t.accdnRH4RanksSoprano="",t.accdnRH4RanksTenor="",t.accdnRicochet2="",t.accdnRicochet3="",t.accdnRicochet4="",t.accdnRicochet5="",t.accdnRicochet6="",t.accdnRicochetStem2="",t.accdnRicochetStem3="",t.accdnRicochetStem4="",t.accdnRicochetStem5="",t.accdnRicochetStem6="",t.accidental1CommaFlat="",t.accidental1CommaSharp="",t.accidental2CommaFlat="",t.accidental2CommaSharp="",t.accidental3CommaFlat="",t.accidental3CommaSharp="",t.accidental4CommaFlat="",t.accidental5CommaSharp="",t.accidentalArrowDown="",t.accidentalArrowUp="",t.accidentalBakiyeFlat="",t.accidentalBakiyeSharp="",t.accidentalBracketLeft="",t.accidentalBracketRight="",t.accidentalBuyukMucennebFlat="",t.accidentalBuyukMucennebSharp="",t.accidentalCombiningCloseCurlyBrace="",t.accidentalCombiningLower17Schisma="",t.accidentalCombiningLower19Schisma="",t.accidentalCombiningLower23Limit29LimitComma="",t.accidentalCombiningLower29LimitComma="",t.accidentalCombiningLower31Schisma="",t.accidentalCombiningLower37Quartertone="",t.accidentalCombiningLower41Comma="",t.accidentalCombiningLower43Comma="",t.accidentalCombiningLower47Quartertone="",t.accidentalCombiningLower53LimitComma="",t.accidentalCombiningOpenCurlyBrace="",t.accidentalCombiningRaise17Schisma="",t.accidentalCombiningRaise19Schisma="",t.accidentalCombiningRaise23Limit29LimitComma="",t.accidentalCombiningRaise29LimitComma="",t.accidentalCombiningRaise31Schisma="",t.accidentalCombiningRaise37Quartertone="",t.accidentalCombiningRaise41Comma="",t.accidentalCombiningRaise43Comma="",t.accidentalCombiningRaise47Quartertone="",t.accidentalCombiningRaise53LimitComma="",t.accidentalCommaSlashDown="",t.accidentalCommaSlashUp="",t.accidentalDoubleFlat="",t.accidentalDoubleFlatArabic="",t.accidentalDoubleFlatEqualTempered="",t.accidentalDoubleFlatOneArrowDown="",t.accidentalDoubleFlatOneArrowUp="",t.accidentalDoubleFlatReversed="",t.accidentalDoubleFlatThreeArrowsDown="",t.accidentalDoubleFlatThreeArrowsUp="",t.accidentalDoubleFlatTurned="",t.accidentalDoubleFlatTwoArrowsDown="",t.accidentalDoubleFlatTwoArrowsUp="",t.accidentalDoubleSharp="",t.accidentalDoubleSharpArabic="",t.accidentalDoubleSharpEqualTempered="",t.accidentalDoubleSharpOneArrowDown="",t.accidentalDoubleSharpOneArrowUp="",t.accidentalDoubleSharpThreeArrowsDown="",t.accidentalDoubleSharpThreeArrowsUp="",t.accidentalDoubleSharpTwoArrowsDown="",t.accidentalDoubleSharpTwoArrowsUp="",t.accidentalEnharmonicAlmostEqualTo="",t.accidentalEnharmonicEquals="",t.accidentalEnharmonicTilde="",t.accidentalFilledReversedFlatAndFlat="",t.accidentalFilledReversedFlatAndFlatArrowDown="",t.accidentalFilledReversedFlatAndFlatArrowUp="",t.accidentalFilledReversedFlatArrowDown="",t.accidentalFilledReversedFlatArrowUp="",t.accidentalFiveQuarterTonesFlatArrowDown="",t.accidentalFiveQuarterTonesSharpArrowUp="",t.accidentalFlat="",t.accidentalFlatArabic="",t.accidentalFlatEqualTempered="",t.accidentalFlatLoweredStockhausen="",t.accidentalFlatOneArrowDown="",t.accidentalFlatOneArrowUp="",t.accidentalFlatRaisedStockhausen="",t.accidentalFlatRepeatedLineStockhausen="",t.accidentalFlatRepeatedSpaceStockhausen="",t.accidentalFlatThreeArrowsDown="",t.accidentalFlatThreeArrowsUp="",t.accidentalFlatTurned="",t.accidentalFlatTwoArrowsDown="",t.accidentalFlatTwoArrowsUp="",t.accidentalHabaFlatQuarterToneHigher="",t.accidentalHabaFlatThreeQuarterTonesLower="",t.accidentalHabaQuarterToneHigher="",t.accidentalHabaQuarterToneLower="",t.accidentalHabaSharpQuarterToneLower="",t.accidentalHabaSharpThreeQuarterTonesHigher="",t.accidentalHalfSharpArrowDown="",t.accidentalHalfSharpArrowUp="",t.accidentalJohnston13="",t.accidentalJohnston31="",t.accidentalJohnstonDown="",t.accidentalJohnstonEl="",t.accidentalJohnstonMinus="",t.accidentalJohnstonPlus="",t.accidentalJohnstonSeven="",t.accidentalJohnstonUp="",t.accidentalKomaFlat="",t.accidentalKomaSharp="",t.accidentalKoron="",t.accidentalKucukMucennebFlat="",t.accidentalKucukMucennebSharp="",t.accidentalLargeDoubleSharp="",t.accidentalLowerOneSeptimalComma="",t.accidentalLowerOneTridecimalQuartertone="",t.accidentalLowerOneUndecimalQuartertone="",t.accidentalLowerTwoSeptimalCommas="",t.accidentalLoweredStockhausen="",t.accidentalNarrowReversedFlat="",t.accidentalNarrowReversedFlatAndFlat="",t.accidentalNatural="",t.accidentalNaturalArabic="",t.accidentalNaturalEqualTempered="",t.accidentalNaturalFlat="",t.accidentalNaturalLoweredStockhausen="",t.accidentalNaturalOneArrowDown="",t.accidentalNaturalOneArrowUp="",t.accidentalNaturalRaisedStockhausen="",t.accidentalNaturalReversed="",t.accidentalNaturalSharp="",t.accidentalNaturalThreeArrowsDown="",t.accidentalNaturalThreeArrowsUp="",t.accidentalNaturalTwoArrowsDown="",t.accidentalNaturalTwoArrowsUp="",t.accidentalOneAndAHalfSharpsArrowDown="",t.accidentalOneAndAHalfSharpsArrowUp="",t.accidentalOneQuarterToneFlatFerneyhough="",t.accidentalOneQuarterToneFlatStockhausen="",t.accidentalOneQuarterToneSharpFerneyhough="",t.accidentalOneQuarterToneSharpStockhausen="",t.accidentalOneThirdToneFlatFerneyhough="",t.accidentalOneThirdToneSharpFerneyhough="",t.accidentalParensLeft="",t.accidentalParensRight="",t.accidentalQuarterFlatEqualTempered="",t.accidentalQuarterSharpEqualTempered="",t.accidentalQuarterToneFlat4="",t.accidentalQuarterToneFlatArabic="",t.accidentalQuarterToneFlatArrowUp="",t.accidentalQuarterToneFlatFilledReversed="",t.accidentalQuarterToneFlatNaturalArrowDown="",t.accidentalQuarterToneFlatPenderecki="",t.accidentalQuarterToneFlatStein="",t.accidentalQuarterToneFlatVanBlankenburg="",t.accidentalQuarterToneSharp4="",t.accidentalQuarterToneSharpArabic="",t.accidentalQuarterToneSharpArrowDown="",t.accidentalQuarterToneSharpBusotti="",t.accidentalQuarterToneSharpNaturalArrowUp="",t.accidentalQuarterToneSharpStein="",t.accidentalQuarterToneSharpWiggle="",t.accidentalRaiseOneSeptimalComma="",t.accidentalRaiseOneTridecimalQuartertone="",t.accidentalRaiseOneUndecimalQuartertone="",t.accidentalRaiseTwoSeptimalCommas="",t.accidentalRaisedStockhausen="",t.accidentalReversedFlatAndFlatArrowDown="",t.accidentalReversedFlatAndFlatArrowUp="",t.accidentalReversedFlatArrowDown="",t.accidentalReversedFlatArrowUp="",t.accidentalSharp="",t.accidentalSharpArabic="",t.accidentalSharpEqualTempered="",t.accidentalSharpLoweredStockhausen="",t.accidentalSharpOneArrowDown="",t.accidentalSharpOneArrowUp="",t.accidentalSharpOneHorizontalStroke="",t.accidentalSharpRaisedStockhausen="",t.accidentalSharpRepeatedLineStockhausen="",t.accidentalSharpRepeatedSpaceStockhausen="",t.accidentalSharpReversed="",t.accidentalSharpSharp="",t.accidentalSharpThreeArrowsDown="",t.accidentalSharpThreeArrowsUp="",t.accidentalSharpTwoArrowsDown="",t.accidentalSharpTwoArrowsUp="",t.accidentalSims12Down="",t.accidentalSims12Up="",t.accidentalSims4Down="",t.accidentalSims4Up="",t.accidentalSims6Down="",t.accidentalSims6Up="",t.accidentalSori="",t.accidentalTavenerFlat="",t.accidentalTavenerSharp="",t.accidentalThreeQuarterTonesFlatArabic="",t.accidentalThreeQuarterTonesFlatArrowDown="",t.accidentalThreeQuarterTonesFlatArrowUp="",t.accidentalThreeQuarterTonesFlatCouper="",t.accidentalThreeQuarterTonesFlatGrisey="",t.accidentalThreeQuarterTonesFlatTartini="",t.accidentalThreeQuarterTonesFlatZimmermann="",t.accidentalThreeQuarterTonesSharpArabic="",t.accidentalThreeQuarterTonesSharpArrowDown="",t.accidentalThreeQuarterTonesSharpArrowUp="",t.accidentalThreeQuarterTonesSharpBusotti="",t.accidentalThreeQuarterTonesSharpStein="",t.accidentalThreeQuarterTonesSharpStockhausen="",t.accidentalTripleFlat="",t.accidentalTripleSharp="",t.accidentalTwoThirdTonesFlatFerneyhough="",t.accidentalTwoThirdTonesSharpFerneyhough="",t.accidentalUpsAndDownsDown="",t.accidentalUpsAndDownsLess="",t.accidentalUpsAndDownsMore="",t.accidentalUpsAndDownsUp="",t.accidentalWilsonMinus="",t.accidentalWilsonPlus="",t.accidentalWyschnegradsky10TwelfthsFlat="",t.accidentalWyschnegradsky10TwelfthsSharp="",t.accidentalWyschnegradsky11TwelfthsFlat="",t.accidentalWyschnegradsky11TwelfthsSharp="",t.accidentalWyschnegradsky1TwelfthsFlat="",t.accidentalWyschnegradsky1TwelfthsSharp="",t.accidentalWyschnegradsky2TwelfthsFlat="",t.accidentalWyschnegradsky2TwelfthsSharp="",t.accidentalWyschnegradsky3TwelfthsFlat="",t.accidentalWyschnegradsky3TwelfthsSharp="",t.accidentalWyschnegradsky4TwelfthsFlat="",t.accidentalWyschnegradsky4TwelfthsSharp="",t.accidentalWyschnegradsky5TwelfthsFlat="",t.accidentalWyschnegradsky5TwelfthsSharp="",t.accidentalWyschnegradsky6TwelfthsFlat="",t.accidentalWyschnegradsky6TwelfthsSharp="",t.accidentalWyschnegradsky7TwelfthsFlat="",t.accidentalWyschnegradsky7TwelfthsSharp="",t.accidentalWyschnegradsky8TwelfthsFlat="",t.accidentalWyschnegradsky8TwelfthsSharp="",t.accidentalWyschnegradsky9TwelfthsFlat="",t.accidentalWyschnegradsky9TwelfthsSharp="",t.accidentalXenakisOneThirdToneSharp="",t.accidentalXenakisTwoThirdTonesSharp="",t.analyticsChoralmelodie="",t.analyticsEndStimme="",t.analyticsHauptrhythmus="",t.analyticsHauptstimme="",t.analyticsInversion1="",t.analyticsNebenstimme="",t.analyticsStartStimme="",t.analyticsTheme="",t.analyticsTheme1="",t.analyticsThemeInversion="",t.analyticsThemeRetrograde="",t.analyticsThemeRetrogradeInversion="",t.arpeggiato="",t.arpeggiatoDown="",t.arpeggiatoUp="",t.arrowBlackDown="",t.arrowBlackDownLeft="",t.arrowBlackDownRight="",t.arrowBlackLeft="",t.arrowBlackRight="",t.arrowBlackUp="",t.arrowBlackUpLeft="",t.arrowBlackUpRight="",t.arrowOpenDown="",t.arrowOpenDownLeft="",t.arrowOpenDownRight="",t.arrowOpenLeft="",t.arrowOpenRight="",t.arrowOpenUp="",t.arrowOpenUpLeft="",t.arrowOpenUpRight="",t.arrowWhiteDown="",t.arrowWhiteDownLeft="",t.arrowWhiteDownRight="",t.arrowWhiteLeft="",t.arrowWhiteRight="",t.arrowWhiteUp="",t.arrowWhiteUpLeft="",t.arrowWhiteUpRight="",t.arrowheadBlackDown="",t.arrowheadBlackDownLeft="",t.arrowheadBlackDownRight="",t.arrowheadBlackLeft="",t.arrowheadBlackRight="",t.arrowheadBlackUp="",t.arrowheadBlackUpLeft="",t.arrowheadBlackUpRight="",t.arrowheadOpenDown="",t.arrowheadOpenDownLeft="",t.arrowheadOpenDownRight="",t.arrowheadOpenLeft="",t.arrowheadOpenRight="",t.arrowheadOpenUp="",t.arrowheadOpenUpLeft="",t.arrowheadOpenUpRight="",t.arrowheadWhiteDown="",t.arrowheadWhiteDownLeft="",t.arrowheadWhiteDownRight="",t.arrowheadWhiteLeft="",t.arrowheadWhiteRight="",t.arrowheadWhiteUp="",t.arrowheadWhiteUpLeft="",t.arrowheadWhiteUpRight="",t.articAccentAbove="",t.articAccentBelow="",t.articAccentStaccatoAbove="",t.articAccentStaccatoBelow="",t.articLaissezVibrerAbove="",t.articLaissezVibrerBelow="",t.articMarcatoAbove="",t.articMarcatoBelow="",t.articMarcatoStaccatoAbove="",t.articMarcatoStaccatoBelow="",t.articMarcatoTenutoAbove="",t.articMarcatoTenutoBelow="",t.articSoftAccentAbove="",t.articSoftAccentBelow="",t.articSoftAccentStaccatoAbove="",t.articSoftAccentStaccatoBelow="",t.articSoftAccentTenutoAbove="",t.articSoftAccentTenutoBelow="",t.articSoftAccentTenutoStaccatoAbove="",t.articSoftAccentTenutoStaccatoBelow="",t.articStaccatissimoAbove="",t.articStaccatissimoBelow="",t.articStaccatissimoStrokeAbove="",t.articStaccatissimoStrokeBelow="",t.articStaccatissimoWedgeAbove="",t.articStaccatissimoWedgeBelow="",t.articStaccatoAbove="",t.articStaccatoBelow="",t.articStressAbove="",t.articStressBelow="",t.articTenutoAbove="",t.articTenutoAccentAbove="",t.articTenutoAccentBelow="",t.articTenutoBelow="",t.articTenutoStaccatoAbove="",t.articTenutoStaccatoBelow="",t.articUnstressAbove="",t.articUnstressBelow="",t.augmentationDot="",t.barlineDashed="",t.barlineDotted="",t.barlineDouble="",t.barlineFinal="",t.barlineHeavy="",t.barlineHeavyHeavy="",t.barlineReverseFinal="",t.barlineShort="",t.barlineSingle="",t.barlineTick="",t.beamAccelRit1="",t.beamAccelRit10="",t.beamAccelRit11="",t.beamAccelRit12="",t.beamAccelRit13="",t.beamAccelRit14="",t.beamAccelRit15="",t.beamAccelRit2="",t.beamAccelRit3="",t.beamAccelRit4="",t.beamAccelRit5="",t.beamAccelRit6="",t.beamAccelRit7="",t.beamAccelRit8="",t.beamAccelRit9="",t.beamAccelRitFinal="",t.brace="",t.bracket="",t.bracketBottom="",t.bracketTop="",t.brassBend="",t.brassDoitLong="",t.brassDoitMedium="",t.brassDoitShort="",t.brassFallLipLong="",t.brassFallLipMedium="",t.brassFallLipShort="",t.brassFallRoughLong="",t.brassFallRoughMedium="",t.brassFallRoughShort="",t.brassFallSmoothLong="",t.brassFallSmoothMedium="",t.brassFallSmoothShort="",t.brassFlip="",t.brassHarmonMuteClosed="",t.brassHarmonMuteStemHalfLeft="",t.brassHarmonMuteStemHalfRight="",t.brassHarmonMuteStemOpen="",t.brassJazzTurn="",t.brassLiftLong="",t.brassLiftMedium="",t.brassLiftShort="",t.brassLiftSmoothLong="",t.brassLiftSmoothMedium="",t.brassLiftSmoothShort="",t.brassMuteClosed="",t.brassMuteHalfClosed="",t.brassMuteOpen="",t.brassPlop="",t.brassScoop="",t.brassSmear="",t.brassValveTrill="",t.breathMarkComma="",t.breathMarkSalzedo="",t.breathMarkTick="",t.breathMarkUpbow="",t.bridgeClef="",t.buzzRoll="",t.cClef="",t.cClef8vb="",t.cClefArrowDown="",t.cClefArrowUp="",t.cClefChange="",t.cClefCombining="",t.cClefReversed="",t.cClefSquare="",t.caesura="",t.caesuraCurved="",t.caesuraShort="",t.caesuraSingleStroke="",t.caesuraThick="",t.chantAccentusAbove="",t.chantAccentusBelow="",t.chantAuctumAsc="",t.chantAuctumDesc="",t.chantAugmentum="",t.chantCaesura="",t.chantCclef="",t.chantCirculusAbove="",t.chantCirculusBelow="",t.chantConnectingLineAsc2nd="",t.chantConnectingLineAsc3rd="",t.chantConnectingLineAsc4th="",t.chantConnectingLineAsc5th="",t.chantConnectingLineAsc6th="",t.chantCustosStemDownPosHigh="",t.chantCustosStemDownPosHighest="",t.chantCustosStemDownPosMiddle="",t.chantCustosStemUpPosLow="",t.chantCustosStemUpPosLowest="",t.chantCustosStemUpPosMiddle="",t.chantDeminutumLower="",t.chantDeminutumUpper="",t.chantDivisioFinalis="",t.chantDivisioMaior="",t.chantDivisioMaxima="",t.chantDivisioMinima="",t.chantEntryLineAsc2nd="",t.chantEntryLineAsc3rd="",t.chantEntryLineAsc4th="",t.chantEntryLineAsc5th="",t.chantEntryLineAsc6th="",t.chantEpisema="",t.chantFclef="",t.chantIctusAbove="",t.chantIctusBelow="",t.chantLigaturaDesc2nd="",t.chantLigaturaDesc3rd="",t.chantLigaturaDesc4th="",t.chantLigaturaDesc5th="",t.chantOriscusAscending="",t.chantOriscusDescending="",t.chantOriscusLiquescens="",t.chantPodatusLower="",t.chantPodatusUpper="",t.chantPunctum="",t.chantPunctumCavum="",t.chantPunctumDeminutum="",t.chantPunctumInclinatum="",t.chantPunctumInclinatumAuctum="",t.chantPunctumInclinatumDeminutum="",t.chantPunctumLinea="",t.chantPunctumLineaCavum="",t.chantPunctumVirga="",t.chantPunctumVirgaReversed="",t.chantQuilisma="",t.chantSemicirculusAbove="",t.chantSemicirculusBelow="",t.chantStaff="",t.chantStaffNarrow="",t.chantStaffWide="",t.chantStrophicus="",t.chantStrophicusAuctus="",t.chantStrophicusLiquescens2nd="",t.chantStrophicusLiquescens3rd="",t.chantStrophicusLiquescens4th="",t.chantStrophicusLiquescens5th="",t.chantVirgula="",t.clef15="",t.clef8="",t.clefChangeCombining="",t.coda="",t.codaSquare="",t.conductorBeat2Compound="",t.conductorBeat2Simple="",t.conductorBeat3Compound="",t.conductorBeat3Simple="",t.conductorBeat4Compound="",t.conductorBeat4Simple="",t.conductorLeftBeat="",t.conductorRightBeat="",t.conductorStrongBeat="",t.conductorUnconducted="",t.conductorWeakBeat="";t.controlBeginBeam="",t.controlBeginPhrase="",t.controlBeginSlur="",t.controlBeginTie="",t.controlEndBeam="",t.controlEndPhrase="",t.controlEndSlur="",t.controlEndTie="",t.csymAccidentalDoubleFlat="",t.csymAccidentalDoubleSharp="",t.csymAccidentalFlat="",t.csymAccidentalNatural="",t.csymAccidentalSharp="",t.csymAccidentalTripleFlat="",t.csymAccidentalTripleSharp="",t.csymAlteredBassSlash="",t.csymAugmented="",t.csymBracketLeftTall="",t.csymBracketRightTall="",t.csymDiagonalArrangementSlash="",t.csymDiminished="",t.csymHalfDiminished="",t.csymMajorSeventh="",t.csymMinor="",t.csymParensLeftTall="",t.csymParensLeftVeryTall="",t.csymParensRightTall="",t.csymParensRightVeryTall="",t.curlewSign="",t.daCapo="",t.dalSegno="",t.daseianExcellentes1="",t.daseianExcellentes2="",t.daseianExcellentes3="",t.daseianExcellentes4="",t.daseianFinales1="",t.daseianFinales2="",t.daseianFinales3="",t.daseianFinales4="",t.daseianGraves1="",t.daseianGraves2="",t.daseianGraves3="",t.daseianGraves4="",t.daseianResidua1="",t.daseianResidua2="",t.daseianSuperiores1="",t.daseianSuperiores2="",t.daseianSuperiores3="",t.daseianSuperiores4="",t.doubleLateralRollStevens="",t.doubleTongueAbove="",t.doubleTongueBelow="",t.dynamicCombinedSeparatorColon="",t.dynamicCombinedSeparatorHyphen="",t.dynamicCombinedSeparatorSlash="",t.dynamicCombinedSeparatorSpace="",t.dynamicCrescendoHairpin="",t.dynamicDiminuendoHairpin="",t.dynamicFF="",t.dynamicFFF="",t.dynamicFFFF="",t.dynamicFFFFF="",t.dynamicFFFFFF="",t.dynamicForte="",t.dynamicFortePiano="",t.dynamicForzando="",t.dynamicHairpinBracketLeft="",t.dynamicHairpinBracketRight="",t.dynamicHairpinParenthesisLeft="",t.dynamicHairpinParenthesisRight="",t.dynamicMF="",t.dynamicMP="",t.dynamicMessaDiVoce="",t.dynamicMezzo="",t.dynamicNiente="",t.dynamicNienteForHairpin="",t.dynamicPF="",t.dynamicPP="",t.dynamicPPP="",t.dynamicPPPP="",t.dynamicPPPPP="",t.dynamicPPPPPP="",t.dynamicPiano="",t.dynamicRinforzando="",t.dynamicRinforzando1="",t.dynamicRinforzando2="",t.dynamicSforzando="",t.dynamicSforzando1="",t.dynamicSforzandoPianissimo="",t.dynamicSforzandoPiano="",t.dynamicSforzato="",t.dynamicSforzatoFF="",t.dynamicSforzatoPiano="",t.dynamicZ="",t.elecAudioChannelsEight="",t.elecAudioChannelsFive="",t.elecAudioChannelsFour="",t.elecAudioChannelsOne="",t.elecAudioChannelsSeven="",t.elecAudioChannelsSix="",t.elecAudioChannelsThreeFrontal="",t.elecAudioChannelsThreeSurround="",t.elecAudioChannelsTwo="",t.elecAudioIn="",t.elecAudioMono="",t.elecAudioOut="",t.elecAudioStereo="",t.elecCamera="",t.elecDataIn="",t.elecDataOut="",t.elecDisc="",t.elecDownload="",t.elecEject="",t.elecFastForward="",t.elecHeadphones="",t.elecHeadset="",t.elecLineIn="",t.elecLineOut="",t.elecLoop="",t.elecLoudspeaker="",t.elecMIDIController0="",t.elecMIDIController100="",t.elecMIDIController20="",t.elecMIDIController40="",t.elecMIDIController60="",t.elecMIDIController80="",t.elecMIDIIn="",t.elecMIDIOut="",t.elecMicrophone="",t.elecMicrophoneMute="",t.elecMicrophoneUnmute="",t.elecMixingConsole="",t.elecMonitor="",t.elecMute="",t.elecPause="",t.elecPlay="",t.elecPowerOnOff="",t.elecProjector="",t.elecReplay="",t.elecRewind="",t.elecShuffle="",t.elecSkipBackwards="",t.elecSkipForwards="",t.elecStop="",t.elecTape="",t.elecUSB="",t.elecUnmute="",t.elecUpload="",t.elecVideoCamera="",t.elecVideoIn="",t.elecVideoOut="",t.elecVolumeFader="",t.elecVolumeFaderThumb="",t.elecVolumeLevel0="",t.elecVolumeLevel100="",t.elecVolumeLevel20="",t.elecVolumeLevel40="",t.elecVolumeLevel60="",t.elecVolumeLevel80="",t.fClef="",t.fClef15ma="",t.fClef15mb="",t.fClef8va="",t.fClef8vb="",t.fClefArrowDown="",t.fClefArrowUp="",t.fClefChange="",t.fClefReversed="",t.fClefTurned="",t.fermataAbove="",t.fermataBelow="",t.fermataLongAbove="",t.fermataLongBelow="",t.fermataLongHenzeAbove="",t.fermataLongHenzeBelow="",t.fermataShortAbove="",t.fermataShortBelow="",t.fermataShortHenzeAbove="",t.fermataShortHenzeBelow="",t.fermataVeryLongAbove="",t.fermataVeryLongBelow="",t.fermataVeryShortAbove="",t.fermataVeryShortBelow="",t.figbass0="",t.figbass1="",t.figbass2="",t.figbass2Raised="",t.figbass3="",t.figbass4="",t.figbass4Raised="",t.figbass5="",t.figbass5Raised1="",t.figbass5Raised2="",t.figbass5Raised3="",t.figbass6="",t.figbass6Raised="",t.figbass6Raised2="",t.figbass7="",t.figbass7Diminished="",t.figbass7Raised1="",t.figbass7Raised2="",t.figbass8="",t.figbass9="",t.figbass9Raised="",t.figbassBracketLeft="",t.figbassBracketRight="",t.figbassCombiningLowering="",t.figbassCombiningRaising="",t.figbassDoubleFlat="",t.figbassDoubleSharp="",t.figbassFlat="",t.figbassNatural="",t.figbassParensLeft="",t.figbassParensRight="",t.figbassPlus="",t.figbassSharp="",t.figbassTripleFlat="",t.figbassTripleSharp="",t.fingering0="",t.fingering0Italic="",t.fingering1="",t.fingering1Italic="",t.fingering2="",t.fingering2Italic="",t.fingering3="",t.fingering3Italic="",t.fingering4="",t.fingering4Italic="",t.fingering5="",t.fingering5Italic="",t.fingering6="",t.fingering6Italic="",t.fingering7="",t.fingering7Italic="",t.fingering8="",t.fingering8Italic="",t.fingering9="",t.fingering9Italic="",t.fingeringALower="",t.fingeringCLower="",t.fingeringELower="",t.fingeringILower="",t.fingeringLeftBracket="",t.fingeringLeftBracketItalic="",t.fingeringLeftParenthesis="",t.fingeringLeftParenthesisItalic="",t.fingeringMLower="",t.fingeringMultipleNotes="",t.fingeringOLower="",t.fingeringPLower="",t.fingeringQLower="",t.fingeringRightBracket="",t.fingeringRightBracketItalic="",t.fingeringRightParenthesis="",t.fingeringRightParenthesisItalic="",t.fingeringSLower="",t.fingeringSeparatorMiddleDot="",t.fingeringSeparatorMiddleDotWhite="",t.fingeringSeparatorSlash="",t.fingeringSubstitutionAbove="",t.fingeringSubstitutionBelow="",t.fingeringSubstitutionDash="",t.fingeringTLower="",t.fingeringTUpper="",t.fingeringXLower="",t.flag1024thDown="",t.flag1024thUp="",t.flag128thDown="",t.flag128thUp="",t.flag16thDown="",t.flag16thUp="",t.flag256thDown="",t.flag256thUp="",t.flag32ndDown="",t.flag32ndUp="",t.flag512thDown="",t.flag512thUp="",t.flag64thDown="",t.flag64thUp="",t.flag8thDown="",t.flag8thUp="",t.flagInternalDown="",t.flagInternalUp="",t.fretboard3String="",t.fretboard3StringNut="",t.fretboard4String="",t.fretboard4StringNut="",t.fretboard5String="",t.fretboard5StringNut="",t.fretboard6String="",t.fretboard6StringNut="",t.fretboardFilledCircle="",t.fretboardO="",t.fretboardX="",t.functionAngleLeft="",t.functionAngleRight="",t.functionBracketLeft="",t.functionBracketRight="",t.functionDD="",t.functionDLower="",t.functionDUpper="",t.functionEight="",t.functionFUpper="",t.functionFive="",t.functionFour="",t.functionGLower="",t.functionGUpper="",t.functionGreaterThan="",t.functionILower="",t.functionIUpper="",t.functionKLower="",t.functionKUpper="",t.functionLLower="",t.functionLUpper="",t.functionLessThan="",t.functionMLower="",t.functionMUpper="",t.functionMinus="",t.functionNLower="",t.functionNUpper="",t.functionNUpperSuperscript="",t.functionNine="",t.functionOne="",t.functionPLower="",t.functionPUpper="",t.functionParensLeft="",t.functionParensRight="",t.functionPlus="",t.functionRLower="",t.functionRepetition1="",t.functionRepetition2="",t.functionRing="",t.functionSLower="",t.functionSSLower="",t.functionSSUpper="",t.functionSUpper="",t.functionSeven="",t.functionSix="",t.functionSlashedDD="",t.functionTLower="",t.functionTUpper="",t.functionThree="",t.functionTwo="",t.functionVLower="",t.functionVUpper="",t.functionZero="",t.gClef="",t.gClef15ma="",t.gClef15mb="",t.gClef8va="",t.gClef8vb="",t.gClef8vbCClef="",t.gClef8vbOld="",t.gClef8vbParens="",t.gClefArrowDown="",t.gClefArrowUp="",t.gClefChange="",t.gClefLigatedNumberAbove="",t.gClefLigatedNumberBelow="",t.gClefReversed="",t.gClefTurned="",t.glissandoDown="",t.glissandoUp="",t.graceNoteAcciaccaturaStemDown="",t.graceNoteAcciaccaturaStemUp="",t.graceNoteAppoggiaturaStemDown="",t.graceNoteAppoggiaturaStemUp="",t.graceNoteSlashStemDown="",t.graceNoteSlashStemUp="",t.guitarBarreFull="",t.guitarBarreHalf="",t.guitarClosePedal="",t.guitarFadeIn="",t.guitarFadeOut="",t.guitarGolpe="",t.guitarHalfOpenPedal="",t.guitarLeftHandTapping="",t.guitarOpenPedal="",t.guitarRightHandTapping="",t.guitarShake="",t.guitarString0="",t.guitarString1="",t.guitarString10="",t.guitarString11="",t.guitarString12="",t.guitarString13="",t.guitarString2="",t.guitarString3="",t.guitarString4="",t.guitarString5="",t.guitarString6="",t.guitarString7="",t.guitarString8="",t.guitarString9="",t.guitarStrumDown="",t.guitarStrumUp="",t.guitarVibratoBarDip="",t.guitarVibratoBarScoop="",t.guitarVibratoStroke="",t.guitarVolumeSwell="",t.guitarWideVibratoStroke="",t.handbellsBelltree="",t.handbellsDamp3="",t.handbellsEcho1="",t.handbellsEcho2="",t.handbellsGyro="",t.handbellsHandMartellato="",t.handbellsMalletBellOnTable="",t.handbellsMalletBellSuspended="",t.handbellsMalletLft="",t.handbellsMartellato="",t.handbellsMartellatoLift="",t.handbellsMutedMartellato="",t.handbellsPluckLift="",t.handbellsSwing="",t.handbellsSwingDown="",t.handbellsSwingUp="",t.handbellsTablePairBells="",t.handbellsTableSingleBell="",t.harpMetalRod="",t.harpPedalCentered="",t.harpPedalDivider="",t.harpPedalLowered="",t.harpPedalRaised="",t.harpSalzedoAeolianAscending="",t.harpSalzedoAeolianDescending="",t.harpSalzedoDampAbove="",t.harpSalzedoDampBelow="",t.harpSalzedoDampBothHands="",t.harpSalzedoDampLowStrings="",t.harpSalzedoFluidicSoundsLeft="",t.harpSalzedoFluidicSoundsRight="",t.harpSalzedoIsolatedSounds="",t.harpSalzedoMetallicSounds="",t.harpSalzedoMetallicSoundsOneString="",t.harpSalzedoMuffleTotally="",t.harpSalzedoOboicFlux="",t.harpSalzedoPlayUpperEnd="",t.harpSalzedoSlideWithSuppleness="",t.harpSalzedoSnareDrum="",t.harpSalzedoTamTamSounds="",t.harpSalzedoThunderEffect="",t.harpSalzedoTimpanicSounds="",t.harpSalzedoWhistlingSounds="",t.harpStringNoiseStem="",t.harpTuningKey="",t.harpTuningKeyGlissando="",t.harpTuningKeyHandle="",t.harpTuningKeyShank="",t.indianDrumClef="",t.kahnBackChug="",t.kahnBackFlap="",t.kahnBackRiff="",t.kahnBackRip="",t.kahnBallChange="",t.kahnBallDig="",t.kahnBrushBackward="",t.kahnBrushForward="",t.kahnChug="",t.kahnClap="",t.kahnDoubleSnap="",t.kahnDoubleWing="",t.kahnDrawStep="",t.kahnDrawTap="",t.kahnFlam="",t.kahnFlap="",t.kahnFlapStep="",t.kahnFlat="",t.kahnFleaHop="",t.kahnFleaTap="",t.kahnGraceTap="",t.kahnGraceTapChange="",t.kahnGraceTapHop="",t.kahnGraceTapStamp="",t.kahnHeel="",t.kahnHeelChange="",t.kahnHeelClick="",t.kahnHeelDrop="",t.kahnHeelStep="",t.kahnHeelTap="",t.kahnHop="",t.kahnJumpApart="",t.kahnJumpTogether="",t.kahnKneeInward="",t.kahnKneeOutward="",t.kahnLeap="",t.kahnLeapFlatFoot="",t.kahnLeapHeelClick="",t.kahnLeftCatch="",t.kahnLeftCross="",t.kahnLeftFoot="",t.kahnLeftToeStrike="",t.kahnLeftTurn="",t.kahnOverTheTop="",t.kahnOverTheTopTap="",t.kahnPull="",t.kahnPush="",t.kahnRiff="",t.kahnRiffle="",t.kahnRightCatch="",t.kahnRightCross="",t.kahnRightFoot="",t.kahnRightToeStrike="",t.kahnRightTurn="",t.kahnRip="",t.kahnRipple="",t.kahnScrape="",t.kahnScuff="",t.kahnScuffle="",t.kahnShuffle="",t.kahnSlam="",t.kahnSlap="",t.kahnSlideStep="",t.kahnSlideTap="",t.kahnSnap="",t.kahnStamp="",t.kahnStampStamp="",t.kahnStep="",t.kahnStepStamp="",t.kahnStomp="",t.kahnStompBrush="",t.kahnTap="",t.kahnToe="",t.kahnToeClick="",t.kahnToeDrop="",t.kahnToeStep="",t.kahnToeTap="",t.kahnTrench="",t.kahnWing="",t.kahnWingChange="",t.kahnZank="",t.kahnZink="",t.keyboardBebung2DotsAbove="",t.keyboardBebung2DotsBelow="",t.keyboardBebung3DotsAbove="",t.keyboardBebung3DotsBelow="",t.keyboardBebung4DotsAbove="",t.keyboardBebung4DotsBelow="",t.keyboardLeftPedalPictogram="",t.keyboardMiddlePedalPictogram="",t.keyboardPedalD="",t.keyboardPedalDot="",t.keyboardPedalE="",t.keyboardPedalHalf="",t.keyboardPedalHalf2="",t.keyboardPedalHalf3="",t.keyboardPedalHeel1="",t.keyboardPedalHeel2="",t.keyboardPedalHeel3="",t.keyboardPedalHeelToToe="",t.keyboardPedalHeelToe="",t.keyboardPedalHookEnd="",t.keyboardPedalHookStart="",t.keyboardPedalHyphen="",t.keyboardPedalP="",t.keyboardPedalParensLeft="",t.keyboardPedalParensRight="",t.keyboardPedalPed="",t.keyboardPedalS="",t.keyboardPedalSost="",t.keyboardPedalToe1="",t.keyboardPedalToe2="",t.keyboardPedalToeToHeel="",t.keyboardPedalUp="",t.keyboardPedalUpNotch="",t.keyboardPedalUpSpecial="",t.keyboardPlayWithLH="",t.keyboardPlayWithLHEnd="",t.keyboardPlayWithRH="",t.keyboardPlayWithRHEnd="",t.keyboardPluckInside="",t.keyboardRightPedalPictogram="",t.kievanAccidentalFlat="",t.kievanAccidentalSharp="",t.kievanAugmentationDot="",t.kievanCClef="",t.kievanEndingSymbol="",t.kievanNote8thStemDown="",t.kievanNote8thStemUp="",t.kievanNoteBeam="",t.kievanNoteHalfStaffLine="",t.kievanNoteHalfStaffSpace="",t.kievanNoteQuarterStemDown="",t.kievanNoteQuarterStemUp="",t.kievanNoteReciting="",t.kievanNoteWhole="",t.kievanNoteWholeFinal="",t.kodalyHandDo="",t.kodalyHandFa="",t.kodalyHandLa="",t.kodalyHandMi="",t.kodalyHandRe="",t.kodalyHandSo="",t.kodalyHandTi="",t.leftRepeatSmall="",t.legerLine="",t.legerLineNarrow="",t.legerLineWide="",t.luteBarlineEndRepeat="",t.luteBarlineFinal="",t.luteBarlineStartRepeat="",t.luteDuration16th="",t.luteDuration32nd="",t.luteDuration8th="",t.luteDurationDoubleWhole="",t.luteDurationHalf="",t.luteDurationQuarter="",t.luteDurationWhole="",t.luteFingeringRHFirst="",t.luteFingeringRHSecond="",t.luteFingeringRHThird="",t.luteFingeringRHThumb="",t.luteFrench10thCourse="",t.luteFrench7thCourse="",t.luteFrench8thCourse="",t.luteFrench9thCourse="",t.luteFrenchAppoggiaturaAbove="",t.luteFrenchAppoggiaturaBelow="",t.luteFrenchFretA="",t.luteFrenchFretB="",t.luteFrenchFretC="",t.luteFrenchFretD="",t.luteFrenchFretE="",t.luteFrenchFretF="",t.luteFrenchFretG="",t.luteFrenchFretH="",t.luteFrenchFretI="",t.luteFrenchFretK="",t.luteFrenchFretL="",t.luteFrenchFretM="",t.luteFrenchFretN="",t.luteFrenchMordentInverted="",t.luteFrenchMordentLower="",t.luteFrenchMordentUpper="",t.luteGermanALower="",t.luteGermanAUpper="",t.luteGermanBLower="",t.luteGermanBUpper="",t.luteGermanCLower="",t.luteGermanCUpper="",t.luteGermanDLower="",t.luteGermanDUpper="",t.luteGermanELower="",t.luteGermanEUpper="",t.luteGermanFLower="",t.luteGermanFUpper="",t.luteGermanGLower="",t.luteGermanGUpper="",t.luteGermanHLower="",t.luteGermanHUpper="",t.luteGermanILower="",t.luteGermanIUpper="",t.luteGermanKLower="",t.luteGermanKUpper="",t.luteGermanLLower="",t.luteGermanLUpper="",t.luteGermanMLower="",t.luteGermanMUpper="",t.luteGermanNLower="",t.luteGermanNUpper="",t.luteGermanOLower="",t.luteGermanPLower="",t.luteGermanQLower="",t.luteGermanRLower="",t.luteGermanSLower="",t.luteGermanTLower="",t.luteGermanVLower="",t.luteGermanXLower="",t.luteGermanYLower="",t.luteGermanZLower="",t.luteItalianClefCSolFaUt="",t.luteItalianClefFFaUt="",t.luteItalianFret0="",t.luteItalianFret1="",t.luteItalianFret2="",t.luteItalianFret3="",t.luteItalianFret4="",t.luteItalianFret5="",t.luteItalianFret6="",t.luteItalianFret7="",t.luteItalianFret8="",t.luteItalianFret9="",t.luteItalianHoldFinger="",t.luteItalianHoldNote="",t.luteItalianReleaseFinger="",t.luteItalianTempoFast="",t.luteItalianTempoNeitherFastNorSlow="",t.luteItalianTempoSlow="",t.luteItalianTempoSomewhatFast="",t.luteItalianTempoVerySlow="",t.luteItalianTimeTriple="",t.luteItalianTremolo="",t.luteItalianVibrato="",t.luteStaff6Lines="",t.luteStaff6LinesNarrow="",t.luteStaff6LinesWide="",t.lyricsElision="",t.lyricsElisionNarrow="",t.lyricsElisionWide="",t.lyricsHyphenBaseline="",t.lyricsHyphenBaselineNonBreaking="",t.lyricsTextRepeat="",t.medRenFlatHardB="",t.medRenFlatSoftB="",t.medRenFlatWithDot="",t.medRenGClefCMN="",t.medRenLiquescenceCMN="",t.medRenLiquescentAscCMN="",t.medRenLiquescentDescCMN="",t.medRenNatural="",t.medRenNaturalWithCross="",t.medRenOriscusCMN="",t.medRenPlicaCMN="",t.medRenPunctumCMN="",t.medRenQuilismaCMN="",t.medRenSharpCroix="",t.medRenStrophicusCMN="",t.mensuralAlterationSign="",t.mensuralBlackBrevis="",t.mensuralBlackBrevisVoid="",t.mensuralBlackDragma="",t.mensuralBlackLonga="",t.mensuralBlackMaxima="",t.mensuralBlackMinima="",t.mensuralBlackMinimaVoid="",t.mensuralBlackSemibrevis="",t.mensuralBlackSemibrevisCaudata="",t.mensuralBlackSemibrevisOblique="",t.mensuralBlackSemibrevisVoid="",t.mensuralBlackSemiminima="",t.mensuralCclef="",t.mensuralCclefPetrucciPosHigh="",t.mensuralCclefPetrucciPosHighest="",t.mensuralCclefPetrucciPosLow="",t.mensuralCclefPetrucciPosLowest="",t.mensuralCclefPetrucciPosMiddle="",t.mensuralColorationEndRound="",t.mensuralColorationEndSquare="",t.mensuralColorationStartRound="",t.mensuralColorationStartSquare="",t.mensuralCombStemDiagonal="",t.mensuralCombStemDown="",t.mensuralCombStemDownFlagExtended="",t.mensuralCombStemDownFlagFlared="",t.mensuralCombStemDownFlagFusa="",t.mensuralCombStemDownFlagLeft="",t.mensuralCombStemDownFlagRight="",t.mensuralCombStemDownFlagSemiminima="",t.mensuralCombStemUp="",t.mensuralCombStemUpFlagExtended="",t.mensuralCombStemUpFlagFlared="",t.mensuralCombStemUpFlagFusa="",t.mensuralCombStemUpFlagLeft="",t.mensuralCombStemUpFlagRight="",t.mensuralCombStemUpFlagSemiminima="",t.mensuralCustosCheckmark="",t.mensuralCustosDown="",t.mensuralCustosTurn="",t.mensuralCustosUp="",t.mensuralFclef="",t.mensuralFclefPetrucci="",t.mensuralGclef="",t.mensuralGclefPetrucci="",t.mensuralModusImperfectumVert="",t.mensuralModusPerfectumVert="",t.mensuralNoteheadLongaBlack="",t.mensuralNoteheadLongaBlackVoid="",t.mensuralNoteheadLongaVoid="",t.mensuralNoteheadLongaWhite="",t.mensuralNoteheadMaximaBlack="",t.mensuralNoteheadMaximaBlackVoid="",t.mensuralNoteheadMaximaVoid="",t.mensuralNoteheadMaximaWhite="",t.mensuralNoteheadMinimaWhite="",t.mensuralNoteheadSemibrevisBlack="",t.mensuralNoteheadSemibrevisBlackVoid="",t.mensuralNoteheadSemibrevisBlackVoidTurned="",t.mensuralNoteheadSemibrevisVoid="",t.mensuralNoteheadSemiminimaWhite="",t.mensuralObliqueAsc2ndBlack="",t.mensuralObliqueAsc2ndBlackVoid="",t.mensuralObliqueAsc2ndVoid="",t.mensuralObliqueAsc2ndWhite="",t.mensuralObliqueAsc3rdBlack="",t.mensuralObliqueAsc3rdBlackVoid="",t.mensuralObliqueAsc3rdVoid="",t.mensuralObliqueAsc3rdWhite="",t.mensuralObliqueAsc4thBlack="",t.mensuralObliqueAsc4thBlackVoid="",t.mensuralObliqueAsc4thVoid="",t.mensuralObliqueAsc4thWhite="",t.mensuralObliqueAsc5thBlack="",t.mensuralObliqueAsc5thBlackVoid="",t.mensuralObliqueAsc5thVoid="",t.mensuralObliqueAsc5thWhite="",t.mensuralObliqueDesc2ndBlack="",t.mensuralObliqueDesc2ndBlackVoid="",t.mensuralObliqueDesc2ndVoid="",t.mensuralObliqueDesc2ndWhite="",t.mensuralObliqueDesc3rdBlack="";t.mensuralObliqueDesc3rdBlackVoid="",t.mensuralObliqueDesc3rdVoid="",t.mensuralObliqueDesc3rdWhite="",t.mensuralObliqueDesc4thBlack="",t.mensuralObliqueDesc4thBlackVoid="",t.mensuralObliqueDesc4thVoid="",t.mensuralObliqueDesc4thWhite="",t.mensuralObliqueDesc5thBlack="",t.mensuralObliqueDesc5thBlackVoid="",t.mensuralObliqueDesc5thVoid="",t.mensuralObliqueDesc5thWhite="",t.mensuralProlation1="",t.mensuralProlation10="",t.mensuralProlation11="",t.mensuralProlation2="",t.mensuralProlation3="",t.mensuralProlation4="",t.mensuralProlation5="",t.mensuralProlation6="",t.mensuralProlation7="",t.mensuralProlation8="",t.mensuralProlation9="",t.mensuralProlationCombiningDot="",t.mensuralProlationCombiningDotVoid="",t.mensuralProlationCombiningStroke="",t.mensuralProlationCombiningThreeDots="",t.mensuralProlationCombiningThreeDotsTri="",t.mensuralProlationCombiningTwoDots="",t.mensuralProportion1="",t.mensuralProportion2="",t.mensuralProportion3="",t.mensuralProportion4="",t.mensuralProportion5="",t.mensuralProportion6="",t.mensuralProportion7="",t.mensuralProportion8="",t.mensuralProportion9="",t.mensuralProportionMajor="",t.mensuralProportionMinor="",t.mensuralProportionProportioDupla1="",t.mensuralProportionProportioDupla2="",t.mensuralProportionProportioQuadrupla="",t.mensuralProportionProportioTripla="",t.mensuralProportionTempusPerfectum="",t.mensuralRestBrevis="",t.mensuralRestFusa="",t.mensuralRestLongaImperfecta="",t.mensuralRestLongaPerfecta="",t.mensuralRestMaxima="",t.mensuralRestMinima="",t.mensuralRestSemibrevis="",t.mensuralRestSemifusa="",t.mensuralRestSemiminima="",t.mensuralSignumDown="",t.mensuralSignumUp="",t.mensuralTempusImperfectumHoriz="",t.mensuralTempusPerfectumHoriz="",t.mensuralWhiteBrevis="",t.mensuralWhiteFusa="",t.mensuralWhiteLonga="",t.mensuralWhiteMaxima="",t.mensuralWhiteMinima="",t.mensuralWhiteSemibrevis="",t.mensuralWhiteSemiminima="",t.metAugmentationDot="",t.metNote1024thDown="",t.metNote1024thUp="",t.metNote128thDown="",t.metNote128thUp="",t.metNote16thDown="",t.metNote16thUp="",t.metNote256thDown="",t.metNote256thUp="",t.metNote32ndDown="",t.metNote32ndUp="",t.metNote512thDown="",t.metNote512thUp="",t.metNote64thDown="",t.metNote64thUp="",t.metNote8thDown="",t.metNote8thUp="",t.metNoteDoubleWhole="",t.metNoteDoubleWholeSquare="",t.metNoteHalfDown="",t.metNoteHalfUp="",t.metNoteQuarterDown="",t.metNoteQuarterUp="",t.metNoteWhole="",t.metricModulationArrowLeft="",t.metricModulationArrowRight="",t.miscDoNotCopy="",t.miscDoNotPhotocopy="",t.miscEyeglasses="",t.note1024thDown="",t.note1024thUp="",t.note128thDown="",t.note128thUp="",t.note16thDown="",t.note16thUp="",t.note256thDown="",t.note256thUp="",t.note32ndDown="",t.note32ndUp="",t.note512thDown="",t.note512thUp="",t.note64thDown="",t.note64thUp="",t.note8thDown="",t.note8thUp="",t.noteABlack="",t.noteAFlatBlack="",t.noteAFlatHalf="",t.noteAFlatWhole="",t.noteAHalf="",t.noteASharpBlack="",t.noteASharpHalf="",t.noteASharpWhole="",t.noteAWhole="",t.noteBBlack="",t.noteBFlatBlack="",t.noteBFlatHalf="",t.noteBFlatWhole="",t.noteBHalf="",t.noteBSharpBlack="",t.noteBSharpHalf="",t.noteBSharpWhole="",t.noteBWhole="",t.noteCBlack="",t.noteCFlatBlack="",t.noteCFlatHalf="",t.noteCFlatWhole="",t.noteCHalf="",t.noteCSharpBlack="",t.noteCSharpHalf="",t.noteCSharpWhole="",t.noteCWhole="",t.noteDBlack="",t.noteDFlatBlack="",t.noteDFlatHalf="",t.noteDFlatWhole="",t.noteDHalf="",t.noteDSharpBlack="",t.noteDSharpHalf="",t.noteDSharpWhole="",t.noteDWhole="",t.noteDiBlack="",t.noteDiHalf="",t.noteDiWhole="",t.noteDoBlack="",t.noteDoHalf="",t.noteDoWhole="",t.noteDoubleWhole="",t.noteDoubleWholeSquare="",t.noteEBlack="",t.noteEFlatBlack="",t.noteEFlatHalf="",t.noteEFlatWhole="",t.noteEHalf="",t.noteESharpBlack="",t.noteESharpHalf="",t.noteESharpWhole="",t.noteEWhole="",t.noteEmptyBlack="",t.noteEmptyHalf="",t.noteEmptyWhole="",t.noteFBlack="",t.noteFFlatBlack="",t.noteFFlatHalf="",t.noteFFlatWhole="",t.noteFHalf="",t.noteFSharpBlack="",t.noteFSharpHalf="",t.noteFSharpWhole="",t.noteFWhole="",t.noteFaBlack="",t.noteFaHalf="",t.noteFaWhole="",t.noteFiBlack="",t.noteFiHalf="",t.noteFiWhole="",t.noteGBlack="",t.noteGFlatBlack="",t.noteGFlatHalf="",t.noteGFlatWhole="",t.noteGHalf="",t.noteGSharpBlack="",t.noteGSharpHalf="",t.noteGSharpWhole="",t.noteGWhole="",t.noteHBlack="",t.noteHHalf="",t.noteHSharpBlack="",t.noteHSharpHalf="",t.noteHSharpWhole="",t.noteHWhole="",t.noteHalfDown="",t.noteHalfUp="",t.noteLaBlack="",t.noteLaHalf="",t.noteLaWhole="",t.noteLeBlack="",t.noteLeHalf="",t.noteLeWhole="",t.noteLiBlack="",t.noteLiHalf="",t.noteLiWhole="",t.noteMeBlack="",t.noteMeHalf="",t.noteMeWhole="",t.noteMiBlack="",t.noteMiHalf="",t.noteMiWhole="",t.noteQuarterDown="",t.noteQuarterUp="",t.noteRaBlack="",t.noteRaHalf="",t.noteRaWhole="",t.noteReBlack="",t.noteReHalf="",t.noteReWhole="",t.noteRiBlack="",t.noteRiHalf="",t.noteRiWhole="",t.noteSeBlack="",t.noteSeHalf="",t.noteSeWhole="",t.noteShapeArrowheadLeftBlack="",t.noteShapeArrowheadLeftDoubleWhole="",t.noteShapeArrowheadLeftWhite="",t.noteShapeDiamondBlack="",t.noteShapeDiamondDoubleWhole="",t.noteShapeDiamondWhite="",t.noteShapeIsoscelesTriangleBlack="",t.noteShapeIsoscelesTriangleDoubleWhole="",t.noteShapeIsoscelesTriangleWhite="",t.noteShapeKeystoneBlack="",t.noteShapeKeystoneDoubleWhole="",t.noteShapeKeystoneWhite="",t.noteShapeMoonBlack="",t.noteShapeMoonDoubleWhole="",t.noteShapeMoonLeftBlack="",t.noteShapeMoonLeftDoubleWhole="",t.noteShapeMoonLeftWhite="",t.noteShapeMoonWhite="",t.noteShapeQuarterMoonBlack="",t.noteShapeQuarterMoonDoubleWhole="",t.noteShapeQuarterMoonWhite="",t.noteShapeRoundBlack="",t.noteShapeRoundDoubleWhole="",t.noteShapeRoundWhite="",t.noteShapeSquareBlack="",t.noteShapeSquareDoubleWhole="",t.noteShapeSquareWhite="",t.noteShapeTriangleLeftBlack="",t.noteShapeTriangleLeftDoubleWhole="",t.noteShapeTriangleLeftWhite="",t.noteShapeTriangleRightBlack="",t.noteShapeTriangleRightDoubleWhole="",t.noteShapeTriangleRightWhite="",t.noteShapeTriangleRoundBlack="",t.noteShapeTriangleRoundDoubleWhole="",t.noteShapeTriangleRoundLeftBlack="",t.noteShapeTriangleRoundLeftDoubleWhole="",t.noteShapeTriangleRoundLeftWhite="",t.noteShapeTriangleRoundWhite="",t.noteShapeTriangleUpBlack="",t.noteShapeTriangleUpDoubleWhole="",t.noteShapeTriangleUpWhite="",t.noteSiBlack="",t.noteSiHalf="",t.noteSiWhole="",t.noteSoBlack="",t.noteSoHalf="",t.noteSoWhole="",t.noteTeBlack="",t.noteTeHalf="",t.noteTeWhole="",t.noteTiBlack="",t.noteTiHalf="",t.noteTiWhole="",t.noteWhole="",t.noteheadBlack="",t.noteheadCircleSlash="",t.noteheadCircleX="",t.noteheadCircleXDoubleWhole="",t.noteheadCircleXHalf="",t.noteheadCircleXWhole="",t.noteheadCircledBlack="",t.noteheadCircledBlackLarge="",t.noteheadCircledDoubleWhole="",t.noteheadCircledDoubleWholeLarge="",t.noteheadCircledHalf="",t.noteheadCircledHalfLarge="",t.noteheadCircledWhole="",t.noteheadCircledWholeLarge="",t.noteheadCircledXLarge="",t.noteheadClusterDoubleWhole2nd="",t.noteheadClusterDoubleWhole3rd="",t.noteheadClusterDoubleWholeBottom="",t.noteheadClusterDoubleWholeMiddle="",t.noteheadClusterDoubleWholeTop="",t.noteheadClusterHalf2nd="",t.noteheadClusterHalf3rd="",t.noteheadClusterHalfBottom="",t.noteheadClusterHalfMiddle="",t.noteheadClusterHalfTop="",t.noteheadClusterQuarter2nd="",t.noteheadClusterQuarter3rd="",t.noteheadClusterQuarterBottom="",t.noteheadClusterQuarterMiddle="",t.noteheadClusterQuarterTop="",t.noteheadClusterRoundBlack="",t.noteheadClusterRoundWhite="",t.noteheadClusterSquareBlack="",t.noteheadClusterSquareWhite="",t.noteheadClusterWhole2nd="",t.noteheadClusterWhole3rd="",t.noteheadClusterWholeBottom="",t.noteheadClusterWholeMiddle="",t.noteheadClusterWholeTop="",t.noteheadCowellEleventhNoteSeriesHalf="",t.noteheadCowellEleventhNoteSeriesWhole="",t.noteheadCowellEleventhSeriesBlack="",t.noteheadCowellFifteenthNoteSeriesBlack="",t.noteheadCowellFifteenthNoteSeriesHalf="",t.noteheadCowellFifteenthNoteSeriesWhole="",t.noteheadCowellFifthNoteSeriesBlack="",t.noteheadCowellFifthNoteSeriesHalf="",t.noteheadCowellFifthNoteSeriesWhole="",t.noteheadCowellNinthNoteSeriesBlack="",t.noteheadCowellNinthNoteSeriesHalf="",t.noteheadCowellNinthNoteSeriesWhole="",t.noteheadCowellSeventhNoteSeriesBlack="",t.noteheadCowellSeventhNoteSeriesHalf="",t.noteheadCowellSeventhNoteSeriesWhole="",t.noteheadCowellThirdNoteSeriesBlack="",t.noteheadCowellThirdNoteSeriesHalf="",t.noteheadCowellThirdNoteSeriesWhole="",t.noteheadCowellThirteenthNoteSeriesBlack="",t.noteheadCowellThirteenthNoteSeriesHalf="",t.noteheadCowellThirteenthNoteSeriesWhole="",t.noteheadDiamondBlack="",t.noteheadDiamondBlackOld="",t.noteheadDiamondBlackWide="",t.noteheadDiamondClusterBlack2nd="",t.noteheadDiamondClusterBlack3rd="",t.noteheadDiamondClusterBlackBottom="",t.noteheadDiamondClusterBlackMiddle="",t.noteheadDiamondClusterBlackTop="",t.noteheadDiamondClusterWhite2nd="",t.noteheadDiamondClusterWhite3rd="",t.noteheadDiamondClusterWhiteBottom="",t.noteheadDiamondClusterWhiteMiddle="",t.noteheadDiamondClusterWhiteTop="",t.noteheadDiamondDoubleWhole="",t.noteheadDiamondDoubleWholeOld="",t.noteheadDiamondHalf="",t.noteheadDiamondHalfFilled="",t.noteheadDiamondHalfOld="",t.noteheadDiamondHalfWide="",t.noteheadDiamondOpen="",t.noteheadDiamondWhite="",t.noteheadDiamondWhiteWide="",t.noteheadDiamondWhole="",t.noteheadDiamondWholeOld="",t.noteheadDoubleWhole="",t.noteheadDoubleWholeSquare="",t.noteheadDoubleWholeWithX="",t.noteheadHalf="",t.noteheadHalfFilled="",t.noteheadHalfWithX="",t.noteheadHeavyX="",t.noteheadHeavyXHat="",t.noteheadLargeArrowDownBlack="",t.noteheadLargeArrowDownDoubleWhole="",t.noteheadLargeArrowDownHalf="",t.noteheadLargeArrowDownWhole="",t.noteheadLargeArrowUpBlack="",t.noteheadLargeArrowUpDoubleWhole="",t.noteheadLargeArrowUpHalf="",t.noteheadLargeArrowUpWhole="",t.noteheadMoonBlack="",t.noteheadMoonWhite="",t.noteheadNancarrowSine="",t.noteheadNull="",t.noteheadParenthesis="",t.noteheadParenthesisLeft="",t.noteheadParenthesisRight="",t.noteheadPlusBlack="",t.noteheadPlusDoubleWhole="",t.noteheadPlusHalf="",t.noteheadPlusWhole="",t.noteheadRectangularClusterBlackBottom="",t.noteheadRectangularClusterBlackMiddle="",t.noteheadRectangularClusterBlackTop="",t.noteheadRectangularClusterWhiteBottom="",t.noteheadRectangularClusterWhiteMiddle="",t.noteheadRectangularClusterWhiteTop="",t.noteheadRoundBlack="",t.noteheadRoundBlackDoubleSlashed="",t.noteheadRoundBlackLarge="",t.noteheadRoundBlackSlashed="",t.noteheadRoundBlackSlashedLarge="",t.noteheadRoundWhite="",t.noteheadRoundWhiteDoubleSlashed="",t.noteheadRoundWhiteLarge="",t.noteheadRoundWhiteSlashed="",t.noteheadRoundWhiteSlashedLarge="",t.noteheadRoundWhiteWithDot="",t.noteheadRoundWhiteWithDotLarge="",t.noteheadSlashDiamondWhite="",t.noteheadSlashHorizontalEnds="",t.noteheadSlashHorizontalEndsMuted="",t.noteheadSlashVerticalEnds="",t.noteheadSlashVerticalEndsMuted="",t.noteheadSlashVerticalEndsSmall="",t.noteheadSlashWhiteDoubleWhole="",t.noteheadSlashWhiteHalf="",t.noteheadSlashWhiteMuted="",t.noteheadSlashWhiteWhole="",t.noteheadSlashX="",t.noteheadSlashedBlack1="",t.noteheadSlashedBlack2="",t.noteheadSlashedDoubleWhole1="",t.noteheadSlashedDoubleWhole2="",t.noteheadSlashedHalf1="",t.noteheadSlashedHalf2="",t.noteheadSlashedWhole1="",t.noteheadSlashedWhole2="",t.noteheadSquareBlack="",t.noteheadSquareBlackLarge="",t.noteheadSquareBlackWhite="",t.noteheadSquareWhite="",t.noteheadTriangleDownBlack="",t.noteheadTriangleDownDoubleWhole="",t.noteheadTriangleDownHalf="",t.noteheadTriangleDownWhite="",t.noteheadTriangleDownWhole="",t.noteheadTriangleLeftBlack="",t.noteheadTriangleLeftWhite="",t.noteheadTriangleRightBlack="",t.noteheadTriangleRightWhite="",t.noteheadTriangleRoundDownBlack="",t.noteheadTriangleRoundDownWhite="",t.noteheadTriangleUpBlack="",t.noteheadTriangleUpDoubleWhole="",t.noteheadTriangleUpHalf="",t.noteheadTriangleUpRightBlack="",t.noteheadTriangleUpRightWhite="",t.noteheadTriangleUpWhite="",t.noteheadTriangleUpWhole="",t.noteheadVoidWithX="",t.noteheadWhole="",t.noteheadWholeFilled="",t.noteheadWholeWithX="",t.noteheadXBlack="",t.noteheadXDoubleWhole="",t.noteheadXHalf="",t.noteheadXOrnate="",t.noteheadXOrnateEllipse="",t.noteheadXWhole="",t.octaveBaselineA="",t.octaveBaselineB="",t.octaveBaselineM="",t.octaveBaselineV="",t.octaveBassa="",t.octaveLoco="",t.octaveParensLeft="",t.octaveParensRight="",t.octaveSuperscriptA="",t.octaveSuperscriptB="",t.octaveSuperscriptM="",t.octaveSuperscriptV="",t.oneHandedRollStevens="",t.organGerman2Fusae="",t.organGerman2Minimae="",t.organGerman2OctaveUp="",t.organGerman2Semifusae="",t.organGerman2Semiminimae="",t.organGerman3Fusae="",t.organGerman3Minimae="",t.organGerman3Semifusae="",t.organGerman3Semiminimae="",t.organGerman4Fusae="",t.organGerman4Minimae="",t.organGerman4Semifusae="",t.organGerman4Semiminimae="",t.organGerman5Fusae="",t.organGerman5Minimae="",t.organGerman5Semifusae="",t.organGerman5Semiminimae="",t.organGerman6Fusae="",t.organGerman6Minimae="",t.organGerman6Semifusae="",t.organGerman6Semiminimae="",t.organGermanALower="",t.organGermanAUpper="",t.organGermanAugmentationDot="",t.organGermanBLower="",t.organGermanBUpper="",t.organGermanBuxheimerBrevis2="",t.organGermanBuxheimerBrevis3="",t.organGermanBuxheimerMinimaRest="",t.organGermanBuxheimerSemibrevis="",t.organGermanBuxheimerSemibrevisRest="",t.organGermanCLower="",t.organGermanCUpper="",t.organGermanCisLower="",t.organGermanCisUpper="",t.organGermanDLower="",t.organGermanDUpper="",t.organGermanDisLower="",t.organGermanDisUpper="",t.organGermanELower="",t.organGermanEUpper="",t.organGermanFLower="",t.organGermanFUpper="",t.organGermanFisLower="",t.organGermanFisUpper="",t.organGermanFusa="",t.organGermanFusaRest="",t.organGermanGLower="",t.organGermanGUpper="",t.organGermanGisLower="",t.organGermanGisUpper="",t.organGermanHLower="",t.organGermanHUpper="",t.organGermanMinima="",t.organGermanMinimaRest="",t.organGermanOctaveDown="",t.organGermanOctaveUp="",t.organGermanSemibrevis="",t.organGermanSemibrevisRest="",t.organGermanSemifusa="",t.organGermanSemifusaRest="",t.organGermanSemiminima="",t.organGermanSemiminimaRest="",t.organGermanTie="",t.ornamentBottomLeftConcaveStroke="",t.ornamentBottomLeftConcaveStrokeLarge="",t.ornamentBottomLeftConvexStroke="",t.ornamentBottomRightConcaveStroke="",t.ornamentBottomRightConvexStroke="",t.ornamentComma="",t.ornamentDoubleObliqueLinesAfterNote="",t.ornamentDoubleObliqueLinesBeforeNote="",t.ornamentDownCurve="",t.ornamentHaydn="",t.ornamentHighLeftConcaveStroke="",t.ornamentHighLeftConvexStroke="",t.ornamentHighRightConcaveStroke="",t.ornamentHighRightConvexStroke="",t.ornamentHookAfterNote="",t.ornamentHookBeforeNote="",t.ornamentLeftFacingHalfCircle="",t.ornamentLeftFacingHook="",t.ornamentLeftPlus="",t.ornamentLeftShakeT="",t.ornamentLeftVerticalStroke="",t.ornamentLeftVerticalStrokeWithCross="",t.ornamentLowLeftConcaveStroke="",t.ornamentLowLeftConvexStroke="",t.ornamentLowRightConcaveStroke="",t.ornamentLowRightConvexStroke="",t.ornamentMiddleVerticalStroke="",t.ornamentMordent="",t.ornamentObliqueLineAfterNote="",t.ornamentObliqueLineBeforeNote="",t.ornamentObliqueLineHorizAfterNote="",t.ornamentObliqueLineHorizBeforeNote="",t.ornamentOriscus="",t.ornamentPinceCouperin="",t.ornamentPortDeVoixV="",t.ornamentPrecompAppoggTrill="",t.ornamentPrecompAppoggTrillSuffix="",t.ornamentPrecompCadence="",t.ornamentPrecompCadenceUpperPrefix="",t.ornamentPrecompCadenceUpperPrefixTurn="",t.ornamentPrecompCadenceWithTurn="",t.ornamentPrecompDescendingSlide="",t.ornamentPrecompDoubleCadenceLowerPrefix="",t.ornamentPrecompDoubleCadenceUpperPrefix="",t.ornamentPrecompDoubleCadenceUpperPrefixTurn="",t.ornamentPrecompInvertedMordentUpperPrefix="",t.ornamentPrecompMordentRelease="",t.ornamentPrecompMordentUpperPrefix="",t.ornamentPrecompPortDeVoixMordent="",t.ornamentPrecompSlide="",t.ornamentPrecompSlideTrillBach="",t.ornamentPrecompSlideTrillDAnglebert="",t.ornamentPrecompSlideTrillMarpurg="",t.ornamentPrecompSlideTrillMuffat="",t.ornamentPrecompSlideTrillSuffixMuffat="",t.ornamentPrecompTrillLowerSuffix="",t.ornamentPrecompTrillSuffixDandrieu="",t.ornamentPrecompTrillWithMordent="",t.ornamentPrecompTurnTrillBach="",t.ornamentPrecompTurnTrillDAnglebert="",t.ornamentQuilisma="",t.ornamentRightFacingHalfCircle="",t.ornamentRightFacingHook="",t.ornamentRightVerticalStroke="",t.ornamentSchleifer="",t.ornamentShake3="",t.ornamentShakeMuffat1="",t.ornamentShortObliqueLineAfterNote="",t.ornamentShortObliqueLineBeforeNote="",t.ornamentShortTrill="",t.ornamentTopLeftConcaveStroke="",t.ornamentTopLeftConvexStroke="",t.ornamentTopRightConcaveStroke="",t.ornamentTopRightConvexStroke="",t.ornamentTremblement="",t.ornamentTremblementCouperin="",t.ornamentTrill="",t.ornamentTurn="",t.ornamentTurnInverted="",t.ornamentTurnSlash="",t.ornamentTurnUp="",t.ornamentTurnUpS="",t.ornamentUpCurve="",t.ornamentVerticalLine="",t.ornamentZigZagLineNoRightEnd="",t.ornamentZigZagLineWithRightEnd="",t.ottava="",t.ottavaAlta="",t.ottavaBassa="",t.ottavaBassaBa="",t.ottavaBassaVb="",t.pendereckiTremolo="",t.pictAgogo="",t.pictAlmglocken="",t.pictAnvil="",t.pictBambooChimes="",t.pictBambooScraper="",t.pictBassDrum="",t.pictBassDrumOnSide="",t.pictBeaterBow="",t.pictBeaterBox="",t.pictBeaterBrassMalletsDown="",t.pictBeaterBrassMalletsLeft="",t.pictBeaterBrassMalletsRight="",t.pictBeaterBrassMalletsUp="",t.pictBeaterCombiningDashedCircle="",t.pictBeaterCombiningParentheses="",t.pictBeaterDoubleBassDrumDown="",t.pictBeaterDoubleBassDrumUp="",t.pictBeaterFinger="",t.pictBeaterFingernails="",t.pictBeaterFist="",t.pictBeaterGuiroScraper="",t.pictBeaterHammer="",t.pictBeaterHammerMetalDown="",t.pictBeaterHammerMetalUp="",t.pictBeaterHammerPlasticDown="",t.pictBeaterHammerPlasticUp="",t.pictBeaterHammerWoodDown="",t.pictBeaterHammerWoodUp="",t.pictBeaterHand="",t.pictBeaterHardBassDrumDown="",t.pictBeaterHardBassDrumUp="",t.pictBeaterHardGlockenspielDown="",t.pictBeaterHardGlockenspielLeft="",t.pictBeaterHardGlockenspielRight="",t.pictBeaterHardGlockenspielUp="",t.pictBeaterHardTimpaniDown="",t.pictBeaterHardTimpaniLeft="",t.pictBeaterHardTimpaniRight="",t.pictBeaterHardTimpaniUp="",t.pictBeaterHardXylophoneDown="",t.pictBeaterHardXylophoneLeft="",t.pictBeaterHardXylophoneRight="",t.pictBeaterHardXylophoneUp="",t.pictBeaterHardYarnDown="",t.pictBeaterHardYarnLeft="",t.pictBeaterHardYarnRight="",t.pictBeaterHardYarnUp="",t.pictBeaterJazzSticksDown="",t.pictBeaterJazzSticksUp="",t.pictBeaterKnittingNeedle="",t.pictBeaterMallet="",t.pictBeaterMalletDown="",t.pictBeaterMediumBassDrumDown="",t.pictBeaterMediumBassDrumUp="",t.pictBeaterMediumTimpaniDown="",t.pictBeaterMediumTimpaniLeft="",t.pictBeaterMediumTimpaniRight="",t.pictBeaterMediumTimpaniUp="",t.pictBeaterMediumXylophoneDown="",t.pictBeaterMediumXylophoneLeft="",t.pictBeaterMediumXylophoneRight="",t.pictBeaterMediumXylophoneUp="",t.pictBeaterMediumYarnDown="",t.pictBeaterMediumYarnLeft="",t.pictBeaterMediumYarnRight="",t.pictBeaterMediumYarnUp="",t.pictBeaterMetalBassDrumDown="",t.pictBeaterMetalBassDrumUp="",t.pictBeaterMetalDown="",t.pictBeaterMetalHammer="",t.pictBeaterMetalLeft="",t.pictBeaterMetalRight="",t.pictBeaterMetalUp="",t.pictBeaterSnareSticksDown="",t.pictBeaterSnareSticksUp="",t.pictBeaterSoftBassDrumDown="",t.pictBeaterSoftBassDrumUp="",t.pictBeaterSoftGlockenspielDown="",t.pictBeaterSoftGlockenspielLeft="",t.pictBeaterSoftGlockenspielRight="",t.pictBeaterSoftGlockenspielUp="",t.pictBeaterSoftTimpaniDown="",t.pictBeaterSoftTimpaniLeft="",t.pictBeaterSoftTimpaniRight="",t.pictBeaterSoftTimpaniUp="",t.pictBeaterSoftXylophone="",t.pictBeaterSoftXylophoneDown="",t.pictBeaterSoftXylophoneLeft="",t.pictBeaterSoftXylophoneRight="",t.pictBeaterSoftXylophoneUp="",t.pictBeaterSoftYarnDown="",t.pictBeaterSoftYarnLeft="",t.pictBeaterSoftYarnRight="",t.pictBeaterSoftYarnUp="",t.pictBeaterSpoonWoodenMallet="",t.pictBeaterSuperballDown="",t.pictBeaterSuperballLeft="",t.pictBeaterSuperballRight="",t.pictBeaterSuperballUp="",t.pictBeaterTriangleDown="",t.pictBeaterTrianglePlain="",t.pictBeaterTriangleUp="",t.pictBeaterWireBrushesDown="",t.pictBeaterWireBrushesUp="",t.pictBeaterWoodTimpaniDown="",t.pictBeaterWoodTimpaniLeft="",t.pictBeaterWoodTimpaniRight="",t.pictBeaterWoodTimpaniUp="",t.pictBeaterWoodXylophoneDown="",t.pictBeaterWoodXylophoneLeft="",t.pictBeaterWoodXylophoneRight="",t.pictBeaterWoodXylophoneUp="",t.pictBell="",t.pictBellOfCymbal="",t.pictBellPlate="",t.pictBellTree="",t.pictBirdWhistle="",t.pictBoardClapper="",t.pictBongos="",t.pictBrakeDrum="",t.pictCabasa="",t.pictCannon="",t.pictCarHorn="",t.pictCastanets="",t.pictCastanetsWithHandle="",t.pictCelesta="",t.pictCencerro="",t.pictCenter1="",t.pictCenter2="",t.pictCenter3="",t.pictChainRattle="",t.pictChimes="",t.pictChineseCymbal="",t.pictChokeCymbal="",t.pictClaves="",t.pictCoins="",t.pictConga="",t.pictCowBell="",t.pictCrashCymbals="",t.pictCrotales="",t.pictCrushStem="",t.pictCuica="",t.pictCymbalTongs="",t.pictDamp1="",t.pictDamp2="",t.pictDamp3="",t.pictDamp4="",t.pictDeadNoteStem="",t.pictDrumStick="",t.pictDuckCall="",t.pictEdgeOfCymbal="",t.pictEmptyTrap="",t.pictFingerCymbals="",t.pictFlexatone="",t.pictFootballRatchet="",t.pictGlassHarmonica="",t.pictGlassHarp="",t.pictGlassPlateChimes="",t.pictGlassTubeChimes="",t.pictGlsp="",t.pictGlspSmithBrindle="",t.pictGobletDrum="",t.pictGong="",t.pictGongWithButton="",t.pictGuiro="",t.pictGumHardDown="",t.pictGumHardLeft="",t.pictGumHardRight="",t.pictGumHardUp="",t.pictGumMediumDown="";t.pictGumMediumLeft="",t.pictGumMediumRight="",t.pictGumMediumUp="",t.pictGumSoftDown="",t.pictGumSoftLeft="",t.pictGumSoftRight="",t.pictGumSoftUp="",t.pictHalfOpen1="",t.pictHalfOpen2="",t.pictHandbell="",t.pictHiHat="",t.pictHiHatOnStand="",t.pictJawHarp="",t.pictJingleBells="",t.pictKlaxonHorn="",t.pictLeftHandCircle="",t.pictLionsRoar="",t.pictLithophone="",t.pictLogDrum="",t.pictLotusFlute="",t.pictMar="",t.pictMarSmithBrindle="",t.pictMaraca="",t.pictMaracas="",t.pictMegaphone="",t.pictMetalPlateChimes="",t.pictMetalTubeChimes="",t.pictMusicalSaw="",t.pictNormalPosition="",t.pictOnRim="",t.pictOpen="",t.pictOpenRimShot="",t.pictPistolShot="",t.pictPoliceWhistle="",t.pictQuijada="",t.pictRainstick="",t.pictRatchet="",t.pictRecoReco="",t.pictRightHandSquare="",t.pictRim1="",t.pictRim2="",t.pictRim3="",t.pictRimShotOnStem="",t.pictSandpaperBlocks="",t.pictScrapeAroundRim="",t.pictScrapeAroundRimClockwise="",t.pictScrapeCenterToEdge="",t.pictScrapeEdgeToCenter="",t.pictShellBells="",t.pictShellChimes="",t.pictSiren="",t.pictSistrum="",t.pictSizzleCymbal="",t.pictSleighBell="",t.pictSlideBrushOnGong="",t.pictSlideWhistle="",t.pictSlitDrum="",t.pictSnareDrum="",t.pictSnareDrumMilitary="",t.pictSnareDrumSnaresOff="",t.pictSteelDrums="",t.pictStickShot="",t.pictSuperball="",t.pictSuspendedCymbal="",t.pictSwishStem="",t.pictTabla="",t.pictTamTam="",t.pictTamTamWithBeater="",t.pictTambourine="",t.pictTempleBlocks="",t.pictTenorDrum="",t.pictThundersheet="",t.pictTimbales="",t.pictTimpani="",t.pictTomTom="",t.pictTomTomChinese="",t.pictTomTomIndoAmerican="",t.pictTomTomJapanese="",t.pictTriangle="",t.pictTubaphone="",t.pictTubularBells="",t.pictTurnLeftStem="",t.pictTurnRightLeftStem="",t.pictTurnRightStem="",t.pictVib="",t.pictVibMotorOff="",t.pictVibSmithBrindle="",t.pictVibraslap="",t.pictVietnameseHat="",t.pictWhip="",t.pictWindChimesGlass="",t.pictWindMachine="",t.pictWindWhistle="",t.pictWoodBlock="",t.pictWoundHardDown="",t.pictWoundHardLeft="",t.pictWoundHardRight="",t.pictWoundHardUp="",t.pictWoundSoftDown="",t.pictWoundSoftLeft="",t.pictWoundSoftRight="",t.pictWoundSoftUp="",t.pictXyl="",t.pictXylBass="",t.pictXylSmithBrindle="",t.pictXylTenor="",t.pictXylTenorTrough="",t.pictXylTrough="",t.pluckedBuzzPizzicato="",t.pluckedDamp="",t.pluckedDampAll="",t.pluckedDampOnStem="",t.pluckedFingernailFlick="",t.pluckedLeftHandPizzicato="",t.pluckedPlectrum="",t.pluckedSnapPizzicatoAbove="",t.pluckedSnapPizzicatoBelow="",t.pluckedWithFingernails="",t.quindicesima="",t.quindicesimaAlta="",t.quindicesimaBassa="",t.quindicesimaBassaMb="",t.repeat1Bar="",t.repeat2Bars="",t.repeat4Bars="",t.repeatBarLowerDot="",t.repeatBarSlash="",t.repeatBarUpperDot="",t.repeatDot="",t.repeatDots="",t.repeatLeft="",t.repeatRight="",t.repeatRightLeft="",t.rest1024th="",t.rest128th="",t.rest16th="",t.rest256th="",t.rest32nd="",t.rest512th="",t.rest64th="",t.rest8th="",t.restDoubleWhole="",t.restDoubleWholeLegerLine="",t.restHBar="",t.restHBarLeft="",t.restHBarMiddle="",t.restHBarRight="",t.restHalf="",t.restHalfLegerLine="",t.restLonga="",t.restMaxima="",t.restQuarter="",t.restQuarterOld="",t.restQuarterZ="",t.restWhole="",t.restWholeLegerLine="",t.reversedBrace="",t.reversedBracketBottom="",t.reversedBracketTop="",t.rightRepeatSmall="",t.scaleDegree1="",t.scaleDegree2="",t.scaleDegree3="",t.scaleDegree4="",t.scaleDegree5="",t.scaleDegree6="",t.scaleDegree7="",t.scaleDegree8="",t.scaleDegree9="",t.schaefferClef="",t.schaefferFClefToGClef="",t.schaefferGClefToFClef="",t.schaefferPreviousClef="",t.segno="",t.segnoSerpent1="",t.segnoSerpent2="",t.semipitchedPercussionClef1="",t.semipitchedPercussionClef2="",t.smnFlat="",t.smnFlatWhite="",t.smnHistoryDoubleFlat="",t.smnHistoryDoubleSharp="",t.smnHistoryFlat="",t.smnHistorySharp="",t.smnNatural="",t.smnSharp="",t.smnSharpDown="",t.smnSharpWhite="",t.smnSharpWhiteDown="",t.splitBarDivider="",t.staff1Line="",t.staff1LineNarrow="",t.staff1LineWide="",t.staff2Lines="",t.staff2LinesNarrow="",t.staff2LinesWide="",t.staff3Lines="",t.staff3LinesNarrow="",t.staff3LinesWide="",t.staff4Lines="",t.staff4LinesNarrow="",t.staff4LinesWide="",t.staff5Lines="",t.staff5LinesNarrow="",t.staff5LinesWide="",t.staff6Lines="",t.staff6LinesNarrow="",t.staff6LinesWide="",t.staffDivideArrowDown="",t.staffDivideArrowUp="",t.staffDivideArrowUpDown="",t.staffPosLower1="",t.staffPosLower2="",t.staffPosLower3="",t.staffPosLower4="",t.staffPosLower5="",t.staffPosLower6="",t.staffPosLower7="",t.staffPosLower8="",t.staffPosRaise1="",t.staffPosRaise2="",t.staffPosRaise3="",t.staffPosRaise4="",t.staffPosRaise5="",t.staffPosRaise6="",t.staffPosRaise7="",t.staffPosRaise8="",t.stem="",t.stemBowOnBridge="",t.stemBowOnTailpiece="",t.stemBuzzRoll="",t.stemDamp="",t.stemHarpStringNoise="",t.stemMultiphonicsBlack="",t.stemMultiphonicsBlackWhite="",t.stemMultiphonicsWhite="",t.stemPendereckiTremolo="",t.stemRimShot="",t.stemSprechgesang="",t.stemSulPonticello="",t.stemSussurando="",t.stemSwished="",t.stemVibratoPulse="",t.stockhausenTremolo="",t.stringsBowBehindBridge="",t.stringsBowBehindBridgeFourStrings="",t.stringsBowBehindBridgeOneString="",t.stringsBowBehindBridgeThreeStrings="",t.stringsBowBehindBridgeTwoStrings="",t.stringsBowOnBridge="",t.stringsBowOnTailpiece="",t.stringsChangeBowDirection="",t.stringsDownBow="",t.stringsDownBowAwayFromBody="",t.stringsDownBowBeyondBridge="",t.stringsDownBowTowardsBody="",t.stringsDownBowTurned="",t.stringsFouette="",t.stringsHalfHarmonic="",t.stringsHarmonic="",t.stringsJeteAbove="",t.stringsJeteBelow="",t.stringsMuteOff="",t.stringsMuteOn="",t.stringsOverpressureDownBow="",t.stringsOverpressureNoDirection="",t.stringsOverpressurePossibileDownBow="",t.stringsOverpressurePossibileUpBow="",t.stringsOverpressureUpBow="",t.stringsScrapeCircularClockwise="",t.stringsScrapeCircularCounterclockwise="",t.stringsScrapeParallelInward="",t.stringsScrapeParallelOutward="",t.stringsThumbPosition="",t.stringsThumbPositionTurned="",t.stringsTripleChopInward="",t.stringsTripleChopOutward="",t.stringsUpBow="",t.stringsUpBowAwayFromBody="",t.stringsUpBowBeyondBridge="",t.stringsUpBowTowardsBody="",t.stringsUpBowTurned="",t.stringsVibratoPulse="",t.swissRudimentsNoteheadBlackDouble="",t.swissRudimentsNoteheadBlackFlam="",t.swissRudimentsNoteheadHalfDouble="",t.swissRudimentsNoteheadHalfFlam="",t.systemDivider="",t.systemDividerExtraLong="",t.systemDividerLong="",t.textAugmentationDot="",t.textBlackNoteFrac16thLongStem="",t.textBlackNoteFrac16thShortStem="",t.textBlackNoteFrac32ndLongStem="",t.textBlackNoteFrac8thLongStem="",t.textBlackNoteFrac8thShortStem="",t.textBlackNoteLongStem="",t.textBlackNoteShortStem="",t.textCont16thBeamLongStem="",t.textCont16thBeamShortStem="",t.textCont32ndBeamLongStem="",t.textCont8thBeamLongStem="",t.textCont8thBeamShortStem="",t.textHeadlessBlackNoteFrac16thLongStem="",t.textHeadlessBlackNoteFrac16thShortStem="",t.textHeadlessBlackNoteFrac32ndLongStem="",t.textHeadlessBlackNoteFrac8thLongStem="",t.textHeadlessBlackNoteFrac8thShortStem="",t.textHeadlessBlackNoteLongStem="",t.textHeadlessBlackNoteShortStem="",t.textTie="",t.textTuplet3LongStem="",t.textTuplet3ShortStem="",t.textTupletBracketEndLongStem="",t.textTupletBracketEndShortStem="",t.textTupletBracketStartLongStem="",t.textTupletBracketStartShortStem="",t.timeSig0="",t.timeSig0Reversed="",t.timeSig0Turned="",t.timeSig1="",t.timeSig1Reversed="",t.timeSig1Turned="",t.timeSig2="",t.timeSig2Reversed="",t.timeSig2Turned="",t.timeSig3="",t.timeSig3Reversed="",t.timeSig3Turned="",t.timeSig4="",t.timeSig4Reversed="",t.timeSig4Turned="",t.timeSig5="",t.timeSig5Reversed="",t.timeSig5Turned="",t.timeSig6="",t.timeSig6Reversed="",t.timeSig6Turned="",t.timeSig7="",t.timeSig7Reversed="",t.timeSig7Turned="",t.timeSig8="",t.timeSig8Reversed="",t.timeSig8Turned="",t.timeSig9="",t.timeSig9Reversed="",t.timeSig9Turned="",t.timeSigBracketLeft="",t.timeSigBracketLeftSmall="",t.timeSigBracketRight="",t.timeSigBracketRightSmall="",t.timeSigCombDenominator="",t.timeSigCombNumerator="",t.timeSigComma="",t.timeSigCommon="",t.timeSigCommonReversed="",t.timeSigCommonTurned="",t.timeSigCut2="",t.timeSigCut3="",t.timeSigCutCommon="",t.timeSigCutCommonReversed="",t.timeSigCutCommonTurned="",t.timeSigEquals="",t.timeSigFractionHalf="",t.timeSigFractionOneThird="",t.timeSigFractionQuarter="",t.timeSigFractionThreeQuarters="",t.timeSigFractionTwoThirds="",t.timeSigFractionalSlash="",t.timeSigMinus="",t.timeSigMultiply="",t.timeSigOpenPenderecki="",t.timeSigParensLeft="",t.timeSigParensLeftSmall="",t.timeSigParensRight="",t.timeSigParensRightSmall="",t.timeSigPlus="",t.timeSigPlusSmall="",t.timeSigSlash="",t.timeSigX="",t.tremolo1="",t.tremolo2="",t.tremolo3="",t.tremolo4="",t.tremolo5="",t.tremoloDivisiDots2="",t.tremoloDivisiDots3="",t.tremoloDivisiDots4="",t.tremoloDivisiDots6="",t.tremoloFingered1="",t.tremoloFingered2="",t.tremoloFingered3="",t.tremoloFingered4="",t.tremoloFingered5="",t.tripleTongueAbove="",t.tripleTongueBelow="",t.tuplet0="",t.tuplet1="",t.tuplet2="",t.tuplet3="",t.tuplet4="",t.tuplet5="",t.tuplet6="",t.tuplet7="",t.tuplet8="",t.tuplet9="",t.tupletColon="",t.unmeasuredTremolo="",t.unmeasuredTremoloSimple="",t.unpitchedPercussionClef1="",t.unpitchedPercussionClef2="",t.ventiduesima="",t.ventiduesimaAlta="",t.ventiduesimaBassa="",t.ventiduesimaBassaMb="",t.vocalFingerClickStockhausen="",t.vocalHalbGesungen="",t.vocalMouthClosed="",t.vocalMouthOpen="",t.vocalMouthPursed="",t.vocalMouthSlightlyOpen="",t.vocalMouthWideOpen="",t.vocalNasalVoice="",t.vocalSprechgesang="",t.vocalTongueClickStockhausen="",t.vocalTongueFingerClickStockhausen="",t.vocalsSussurando="",t.wiggleArpeggiatoDown="",t.wiggleArpeggiatoDownArrow="",t.wiggleArpeggiatoDownSwash="",t.wiggleArpeggiatoUp="",t.wiggleArpeggiatoUpArrow="",t.wiggleArpeggiatoUpSwash="",t.wiggleCircular="",t.wiggleCircularConstant="",t.wiggleCircularConstantFlipped="",t.wiggleCircularConstantFlippedLarge="",t.wiggleCircularConstantLarge="",t.wiggleCircularEnd="",t.wiggleCircularLarge="",t.wiggleCircularLarger="",t.wiggleCircularLargerStill="",t.wiggleCircularLargest="",t.wiggleCircularSmall="",t.wiggleCircularStart="",t.wiggleGlissando="",t.wiggleGlissandoGroup1="",t.wiggleGlissandoGroup2="",t.wiggleGlissandoGroup3="",t.wiggleRandom1="",t.wiggleRandom2="",t.wiggleRandom3="",t.wiggleRandom4="",t.wiggleSawtooth="",t.wiggleSawtoothNarrow="",t.wiggleSawtoothWide="",t.wiggleSquareWave="",t.wiggleSquareWaveNarrow="",t.wiggleSquareWaveWide="",t.wiggleTrill="",t.wiggleTrillFast="",t.wiggleTrillFaster="",t.wiggleTrillFasterStill="",t.wiggleTrillFastest="",t.wiggleTrillSlow="",t.wiggleTrillSlower="",t.wiggleTrillSlowerStill="",t.wiggleTrillSlowest="",t.wiggleVIbratoLargestSlower="",t.wiggleVIbratoMediumSlower="",t.wiggleVibrato="",t.wiggleVibratoLargeFast="",t.wiggleVibratoLargeFaster="",t.wiggleVibratoLargeFasterStill="",t.wiggleVibratoLargeFastest="",t.wiggleVibratoLargeSlow="",t.wiggleVibratoLargeSlower="",t.wiggleVibratoLargeSlowest="",t.wiggleVibratoLargestFast="",t.wiggleVibratoLargestFaster="",t.wiggleVibratoLargestFasterStill="",t.wiggleVibratoLargestFastest="",t.wiggleVibratoLargestSlow="",t.wiggleVibratoLargestSlowest="",t.wiggleVibratoMediumFast="",t.wiggleVibratoMediumFaster="",t.wiggleVibratoMediumFasterStill="",t.wiggleVibratoMediumFastest="",t.wiggleVibratoMediumSlow="",t.wiggleVibratoMediumSlowest="",t.wiggleVibratoSmallFast="",t.wiggleVibratoSmallFaster="",t.wiggleVibratoSmallFasterStill="",t.wiggleVibratoSmallFastest="",t.wiggleVibratoSmallSlow="",t.wiggleVibratoSmallSlower="",t.wiggleVibratoSmallSlowest="",t.wiggleVibratoSmallestFast="",t.wiggleVibratoSmallestFaster="",t.wiggleVibratoSmallestFasterStill="",t.wiggleVibratoSmallestFastest="",t.wiggleVibratoSmallestSlow="",t.wiggleVibratoSmallestSlower="",t.wiggleVibratoSmallestSlowest="",t.wiggleVibratoStart="",t.wiggleVibratoWide="",t.wiggleWavy="",t.wiggleWavyNarrow="",t.wiggleWavyWide="",t.windClosedHole="",t.windFlatEmbouchure="",t.windHalfClosedHole1="",t.windHalfClosedHole2="",t.windHalfClosedHole3="",t.windLessRelaxedEmbouchure="",t.windLessTightEmbouchure="",t.windMouthpiecePop="",t.windMultiphonicsBlackStem="",t.windMultiphonicsBlackWhiteStem="",t.windMultiphonicsWhiteStem="",t.windOpenHole="",t.windReedPositionIn="",t.windReedPositionNormal="",t.windReedPositionOut="",t.windRelaxedEmbouchure="",t.windRimOnly="",t.windSharpEmbouchure="",t.windStrongAirPressure="",t.windThreeQuartersClosedHole="",t.windTightEmbouchure="",t.windTrillKey="",t.windVeryTightEmbouchure="",t.windWeakAirPressure=""}(I||(I={}));const G=16384,U={"1/8":131072,"1/4":65536,"1/2":32768,1:16384,2:8192,4:4096,8:2048,16:1024,32:512,64:256,128:128,256:64,512:32,1024:16},V={m:"1/8",l:"1/4",w:"1",h:"2",q:"4",b:"256"},X=Object.assign(Object.assign({},(()=>{const t={};for(let e=1;e<=14;e++)t[`flats_${e}`]={accidental:"b",num:e},t[`sharps_${e}`]={accidental:"#",num:e};return t.flats_0={num:0},t.sharps_0={num:0},t})()),{C:{num:0},Am:{num:0},F:{accidental:"b",num:1},Dm:{accidental:"b",num:1},Bb:{accidental:"b",num:2},Gm:{accidental:"b",num:2},Eb:{accidental:"b",num:3},Cm:{accidental:"b",num:3},Ab:{accidental:"b",num:4},Fm:{accidental:"b",num:4},Db:{accidental:"b",num:5},Bbm:{accidental:"b",num:5},Gb:{accidental:"b",num:6},Ebm:{accidental:"b",num:6},Cb:{accidental:"b",num:7},Abm:{accidental:"b",num:7},Dbm:{accidental:"b",num:8},Gbm:{accidental:"b",num:9},G:{accidental:"#",num:1},Em:{accidental:"#",num:1},D:{accidental:"#",num:2},Bm:{accidental:"#",num:2},A:{accidental:"#",num:3},"F#m":{accidental:"#",num:3},E:{accidental:"#",num:4},"C#m":{accidental:"#",num:4},B:{accidental:"#",num:5},"G#m":{accidental:"#",num:5},"F#":{accidental:"#",num:6},"D#m":{accidental:"#",num:6},"C#":{accidental:"#",num:7},"A#m":{accidental:"#",num:7},"G#":{accidental:"#",num:8},"D#":{accidental:"#",num:9},"A#":{accidental:"#",num:10}}),Y={treble:{lineShift:0},bass:{lineShift:6},tenor:{lineShift:4},alto:{lineShift:3},soprano:{lineShift:1},percussion:{lineShift:0},"mezzo-soprano":{lineShift:2},"baritone-c":{lineShift:5},"baritone-f":{lineShift:5},subbass:{lineShift:7},french:{lineShift:-1}},_={C:{index:0,intVal:0},CN:{index:0,intVal:0},"C#":{index:0,intVal:1},"C##":{index:0,intVal:2},CB:{index:0,intVal:11},CBB:{index:0,intVal:10},D:{index:1,intVal:2},DN:{index:1,intVal:2},"D#":{index:1,intVal:3},"D##":{index:1,intVal:4},DB:{index:1,intVal:1},DBB:{index:1,intVal:0},E:{index:2,intVal:4},EN:{index:2,intVal:4},"E#":{index:2,intVal:5},"E##":{index:2,intVal:6},EB:{index:2,intVal:3},EBB:{index:2,intVal:2},F:{index:3,intVal:5},FN:{index:3,intVal:5},"F#":{index:3,intVal:6},"F##":{index:3,intVal:7},FB:{index:3,intVal:4},FBB:{index:3,intVal:3},G:{index:4,intVal:7},GN:{index:4,intVal:7},"G#":{index:4,intVal:8},"G##":{index:4,intVal:9},GB:{index:4,intVal:6},GBB:{index:4,intVal:5},A:{index:5,intVal:9},AN:{index:5,intVal:9},"A#":{index:5,intVal:10},"A##":{index:5,intVal:11},AB:{index:5,intVal:8},ABB:{index:5,intVal:7},B:{index:6,intVal:11},BN:{index:6,intVal:11},"B#":{index:6,intVal:12},"B##":{index:6,intVal:13},BB:{index:6,intVal:10},BBB:{index:6,intVal:9},R:{index:6},X:{index:6}},z={"#":I.accidentalSharp,"##":I.accidentalDoubleSharp,b:I.accidentalFlat,bb:I.accidentalDoubleFlat,n:I.accidentalNatural,"{":I.accidentalParensLeft,"}":I.accidentalParensRight,db:I.accidentalThreeQuarterTonesFlatZimmermann,d:I.accidentalQuarterToneFlatStein,"++":I.accidentalThreeQuarterTonesSharpStein,"+":I.accidentalQuarterToneSharpStein,"+-":I.accidentalKucukMucennebSharp,bs:I.accidentalBakiyeFlat,bss:I.accidentalBuyukMucennebFlat,o:I.accidentalSori,k:I.accidentalKoron,bbs:I.accidentalBuyukMucennebSharp,"++-":I.accidentalBuyukMucennebSharp,ashs:I.accidentalBuyukMucennebSharp,afhf:I.accidentalBuyukMucennebSharp},j={"a.":{code:I.augmentationDot,betweenLines:!0},av:{aboveCode:I.articStaccatissimoAbove,belowCode:I.articStaccatissimoBelow,betweenLines:!0},"a>":{aboveCode:I.articAccentAbove,belowCode:I.articAccentBelow,betweenLines:!0},"a-":{aboveCode:I.articTenutoAbove,belowCode:I.articTenutoBelow,betweenLines:!0},"a^":{aboveCode:I.articMarcatoAbove,belowCode:I.articMarcatoBelow,betweenLines:!1},"a+":{code:I.pluckedLeftHandPizzicato,betweenLines:!1},ao:{aboveCode:I.pluckedSnapPizzicatoAbove,belowCode:I.pluckedSnapPizzicatoBelow,betweenLines:!1},ah:{code:I.stringsHarmonic,betweenLines:!1},"a@":{aboveCode:I.fermataAbove,belowCode:I.fermataBelow,betweenLines:!1},"a@a":{code:I.fermataAbove,betweenLines:!1},"a@u":{code:I.fermataBelow,betweenLines:!1},"a@s":{aboveCode:I.fermataShortAbove,belowCode:I.fermataShortBelow,betweenLines:!1},"a@as":{code:I.fermataShortAbove,betweenLines:!1},"a@us":{code:I.fermataShortBelow,betweenLines:!1},"a@l":{aboveCode:I.fermataLongAbove,belowCode:I.fermataLongBelow,betweenLines:!1},"a@al":{code:I.fermataLongAbove,betweenLines:!1},"a@ul":{code:I.fermataLongBelow,betweenLines:!1},"a@vl":{aboveCode:I.fermataVeryLongAbove,belowCode:I.fermataVeryLongBelow,betweenLines:!1},"a@avl":{code:I.fermataVeryLongAbove,betweenLines:!1},"a@uvl":{code:I.fermataVeryLongBelow,betweenLines:!1},"a|":{code:I.stringsUpBow,betweenLines:!1},am:{code:I.stringsDownBow,betweenLines:!1},"a,":{code:I.pictChokeCymbal,betweenLines:!1}},q={mordent:I.ornamentShortTrill,mordentInverted:I.ornamentMordent,turn:I.ornamentTurn,turnInverted:I.ornamentTurnSlash,tr:I.ornamentTrill,upprall:I.ornamentPrecompSlideTrillDAnglebert,downprall:I.ornamentPrecompDoubleCadenceUpperPrefix,prallup:I.ornamentPrecompTrillSuffixDandrieu,pralldown:I.ornamentPrecompTrillLowerSuffix,upmordent:I.ornamentPrecompSlideTrillBach,downmordent:I.ornamentPrecompDoubleCadenceUpperPrefixTurn,lineprall:I.ornamentPrecompAppoggTrill,prallprall:I.ornamentTremblement,scoop:I.brassScoop,doit:I.brassDoitMedium,fall:I.brassFallLipShort,doitLong:I.brassLiftMedium,fallLong:I.brassFallRoughMedium,bend:I.brassBend,plungerClosed:I.brassMuteClosed,plungerOpen:I.brassMuteOpen,flip:I.brassFlip,jazzTurn:I.brassJazzTurn,smear:I.brassSmear};class K{static clefProperties(t){if(!t||!(t in Y))throw new p("BadArgument","Invalid clef: "+t);return Y[t]}static keyProperties(t,e="treble",i="N",s){let n={octaveShift:0,duration:"4"};"object"==typeof s&&(n=Object.assign(Object.assign({},n),s));const o=K.sanitizeDuration(n.duration),a=t.split("/");if(a.length<2)throw new p("BadArguments",`First argument must be note/octave or note/octave/glyph-code: ${t}`);const r=a[0].toUpperCase();i=i.toUpperCase();const h=_[r];if(!h)throw new p("BadArguments","Invalid key name: "+r);let c=parseInt(a[1],10);c-=n.octaveShift;let l=(7*c-28+h.index)/2;l+=K.clefProperties(e).lineShift;const d=void 0!==h.intVal?12*c+h.intVal:void 0;let u="",g="N";return g=a.length>2&&a[2]?a[2].toUpperCase():"N"!==i?i:r,u=this.codeNoteHead(g,o),{key:r,octave:c,line:l,intValue:d,code:u,displaced:!1}}static integerToNote(t){if(void 0===t||t<0||t>11)throw new p("BadArguments",`integerToNote() requires an integer in the range [0, 11]: ${t}`);const e={0:"C",1:"C#",2:"D",3:"D#",4:"E",5:"F",6:"F#",7:"G",8:"G#",9:"A",10:"A#",11:"B"}[t];if(!e)throw new p("BadArguments",`Unknown note value for integer: ${t}`);return e}static textWidth(t){return 7*t.toString().length}static articulationCodes(t){return j[t]}static accidentalCodes(t){var e;return null!==(e=z[t])&&void 0!==e?e:t}static ornamentCodes(t){var e;return null!==(e=q[t])&&void 0!==e?e:t}static keySignature(t){const e=X[t];if(!e)throw new p("BadKeySignature",`Bad key signature spec: '${t}'`);if(!e.accidental)return[];const i={b:[2,.5,2.5,1,3,1.5,3.5],"#":[0,1.5,-.5,1,2.5,.5,2]}[e.accidental],s=Math.min(e.num,7),n=Math.max(e.num-7,0);return[...i.slice(n,s).map(t=>({type:`${e.accidental}`,line:t})),...i.slice(0,n).map(t=>({type:`${e.accidental}${e.accidental}`,line:t}))]}static getKeySignatures(){return X}static hasKeySignature(t){return t in X}static sanitizeDuration(t){const e=V[t];if(void 0!==e&&(t=e),void 0===U[t])throw new p("BadArguments",`The provided duration is not valid: ${t}`);return t}static durationToFraction(t){return(new y).parse(K.sanitizeDuration(t))}static durationToNumber(t){return K.durationToFraction(t).value()}static durationToTicks(t){t=K.sanitizeDuration(t);const e=U[t];if(void 0===e)throw new p("InvalidDuration");return e}static codeNoteHead(t,e){switch(t){case"D0":return I.noteheadDiamondWhole;case"D1":return I.noteheadDiamondHalf;case"D2":case"D3":return I.noteheadDiamondBlack;case"T0":return I.noteheadTriangleUpWhole;case"T1":return I.noteheadTriangleUpHalf;case"T2":case"T3":return I.noteheadTriangleUpBlack;case"X0":return I.noteheadXWhole;case"X1":return I.noteheadXHalf;case"X2":return I.noteheadXBlack;case"X3":return I.noteheadCircleX;case"S1":return I.noteheadSquareWhite;case"S2":return I.noteheadSquareBlack;case"R1":case"R2":return I.noteheadSquareWhite;case"DO":return I.noteheadTriangleUpBlack;case"RE":return I.noteheadMoonBlack;case"MI":return I.noteheadDiamondBlack;case"FA":return I.noteheadTriangleLeftBlack;case"FAUP":return I.noteheadTriangleRightBlack;case"SO":return I.noteheadBlack;case"LA":return I.noteheadSquareBlack;case"TI":return I.noteheadTriangleRoundDownBlack;case"DI":case"H":switch(e){case"1/2":return I.noteheadDiamondDoubleWhole;case"1":return I.noteheadDiamondWhole;case"2":return I.noteheadDiamondHalf;default:return I.noteheadDiamondBlack}case"X":case"M":switch(e){case"1/2":return I.noteheadXDoubleWhole;case"1":return I.noteheadXWhole;case"2":return I.noteheadXHalf;default:return I.noteheadXBlack}case"CX":switch(e){case"1/2":return I.noteheadCircleXDoubleWhole;case"1":return I.noteheadCircleXWhole;case"2":return I.noteheadCircleXHalf;default:return I.noteheadCircleX}case"CI":switch(e){case"1/2":return I.noteheadCircledDoubleWhole;case"1":return I.noteheadCircledWhole;case"2":return I.noteheadCircledHalf;default:return I.noteheadCircledBlack}case"SQ":switch(e){case"1/2":return I.noteheadDoubleWholeSquare;case"1":case"2":return I.noteheadSquareWhite;default:return I.noteheadSquareBlack}case"TU":switch(e){case"1/2":return I.noteheadTriangleUpDoubleWhole;case"1":return I.noteheadTriangleUpWhole;case"2":return I.noteheadTriangleUpHalf;default:return I.noteheadTriangleUpBlack}case"TD":switch(e){case"1/2":return I.noteheadTriangleDownDoubleWhole;case"1":return I.noteheadTriangleDownWhole;case"2":return I.noteheadTriangleDownHalf;default:return I.noteheadTriangleDownBlack}case"SF":switch(e){case"1/2":return I.noteheadSlashedDoubleWhole1;case"1":return I.noteheadSlashedWhole1;case"2":return I.noteheadSlashedHalf1;default:return I.noteheadSlashedBlack1}case"SB":switch(e){case"1/2":return I.noteheadSlashedDoubleWhole2;case"1":return I.noteheadSlashedWhole2;case"2":return I.noteheadSlashedHalf2;default:return I.noteheadSlashedBlack2}case"R":switch(e){case"1/8":return I.restMaxima;case"1/4":return I.restLonga;case"1/2":return I.restDoubleWhole;case"1":return I.restWhole;case"2":return I.restHalf;case"4":return I.restQuarter;case"8":return I.rest8th;case"16":return I.rest16th;case"32":return I.rest32nd;case"64":return I.rest64th;case"128":return I.rest128th;case"256":return I.rest256th;case"512":return I.rest512th;case"1024":return I.rest1024th}break;case"S":switch(e){case"1/2":return I.noteheadSlashWhiteDoubleWhole;case"1":return I.noteheadSlashWhiteWhole;case"2":return I.noteheadSlashWhiteHalf;default:return I.noteheadSlashVerticalEnds}default:switch(e){case"1/8":return I.mensuralNoteheadMaximaBlack;case"1/4":return I.mensuralNoteheadLongaBlack;case"1/2":return I.noteheadDoubleWhole;case"1":return I.noteheadWhole;case"2":return I.noteheadHalf;default:return I.noteheadBlack}}return I.null}}function $(t,e,i=!0){if("object"!=typeof t||null===t)return!1;let s=t.constructor;if(i){for(;null!==t;){if(s=t.constructor,"CATEGORY"in s&&s.CATEGORY===e)return!0;t=Object.getPrototypeOf(t)}return!1}return"CATEGORY"in s&&s.CATEGORY===e}K.UNISON=!0,K.SOFTMAX_FACTOR=10,K.STEM_WIDTH=1.5,K.STEM_HEIGHT=35,K.STAVE_LINE_THICKNESS=1,K.RENDER_PRECISION_PLACES=3,K.RESOLUTION=G,K.durationCodes={"1/8":{stem:!0},"1/4":{stem:!1},"1/2":{stem:!1},1:{stem:!1},2:{stem:!0},4:{stem:!0},8:{stem:!0,beamCount:1,stemBeamExtension:0,codeFlagUp:I.flag8thUp},16:{beamCount:2,stemBeamExtension:0,stem:!0,codeFlagUp:I.flag16thUp},32:{beamCount:3,stemBeamExtension:7.5,stem:!0,codeFlagUp:I.flag32ndUp},64:{beamCount:4,stemBeamExtension:15,stem:!0,codeFlagUp:I.flag64thUp},128:{beamCount:5,stemBeamExtension:22.5,stem:!0,codeFlagUp:I.flag128thUp},256:{beamCount:6,stemBeamExtension:25,stem:!0,codeFlagUp:I.flag256thUp},512:{beamCount:7,stemBeamExtension:27.5,stem:!0,codeFlagUp:I.flag512thUp},1024:{beamCount:8,stemBeamExtension:30,stem:!0,codeFlagUp:I.flag1024thUp}},K.NOTATION_FONT_SCALE=39,K.TABLATURE_FONT_SCALE=39,K.SLASH_NOTEHEAD_WIDTH=15,K.STAVE_LINE_DISTANCE=10,K.noteHeadStemYOffsets={[I.noteheadXBlack]:{up:.444,down:-.44},[I.noteheadXHalf]:{up:.412,down:-.412}},K.TEXT_HEIGHT_OFFSET_HACK=1,K.accidentalColumnsTable={1:{a:[1],b:[1]},2:{a:[1,2]},3:{a:[1,3,2],b:[1,2,1],secondOnBottom:[1,2,3]},4:{a:[1,3,4,2],b:[1,2,3,1],spacedOutTetrachord:[1,2,1,2]},5:{a:[1,3,5,4,2],b:[1,2,4,3,1],spacedOutPentachord:[1,2,3,2,1],verySpacedOutPentachord:[1,2,1,2,1]},6:{a:[1,3,5,6,4,2],b:[1,2,4,5,3,1],spacedOutHexachord:[1,3,2,1,3,2],verySpacedOutHexachord:[1,2,1,2,1,2]}},K.unicode={sharp:"♯",flat:"♭",natural:"♮",triangle:"△","o-with-slash":"ø",degrees:"°",circle:"○"},K.validTypes={n:{name:"note"},r:{name:"rest"},h:{name:"harmonic"},m:{name:"muted"},s:{name:"slash"},g:{name:"ghost"},d:{name:"diamond"},x:{name:"x"},ci:{name:"circled"},cx:{name:"circle x"},sf:{name:"slashed"},sb:{name:"slashed backward"},sq:{name:"square"},tu:{name:"triangle up"},td:{name:"triangle down"}},K.TIME4_4={numBeats:4,beatValue:4,resolution:G};const Q=t=>$(t,"Annotation"),J=t=>$(t,"Barline"),Z=t=>$(t,"GraceNote"),tt=t=>$(t,"Note"),et=t=>$(t,"StaveNote"),it=t=>$(t,"StemmableNote"),st=t=>$(t,"TabNote");function nt(...t){ot.DEBUG&&S("VexFlow.Accidental",t)}class ot extends W{static get CATEGORY(){return"Accidental"}static format(t,e){if(!t||0===t.length)return;const i=B.get("Accidental.noteheadAccidentalPadding"),s=e.leftShift+i,n=B.get("Accidental.accidentalSpacing"),o=B.get("Accidental.leftPadding"),a=[];let r,h=0;for(let e=0;e<t.length;++e){const i=t[e],s=i.getNote(),n=s.getStave(),o=i.checkIndex(),c=s.getKeyProps()[o];if(s!==r){for(let t=0;t<s.keys.length;++t)h=Math.max(s.getLeftDisplacedHeadPx()-s.getXShift(),h);r=s}if(n){const t=n.getSpacingBetweenLines(),e=n.getYForLine(c.line),s=Math.round(e/t*2)/2;a.push({y:e,line:s,extraXSpaceNeeded:h,accidental:i,spacingBetweenStaveLines:t})}else a.push({line:c.line,extraXSpaceNeeded:h,accidental:i})}a.sort((t,e)=>e.line-t.line);const c=[];let l=0;for(let t=0;t<a.length;t++){const e=a[t],i=e.accidental.type,s=c[c.length-1];let o;s&&(null==s?void 0:s.line)===e.line?o=s:(o={line:e.line,flatLine:!0,dblSharpLine:!0,numAcc:0,width:0,column:0},c.push(o)),"b"!==i&&"bb"!==i&&(o.flatLine=!1),"##"!==i&&(o.dblSharpLine=!1),o.numAcc++,o.width+=e.accidental.getWidth()+n,l=Math.max(e.extraXSpaceNeeded,l)}let d=0;for(let t=0;t<c.length;t++){let e=!1;const i=t;let s=t;for(;s+1<c.length&&!e;)this.checkCollision(c[s],c[s+1])?s++:e=!0;const n=t=>c[i+t],o=t=>t.map(n),a=(t,e)=>{const[i,s]=o([t,e]).map(t=>t.line);return i-s},r=(...t)=>t.map(o).every(([t,e])=>!this.checkCollision(t,e)),h=s-i+1;let l,u,g=this.checkCollision(c[i],c[s])?"a":"b";switch(h){case 3:"a"===g&&.5===a(1,2)&&.5!==a(0,1)&&(g="secondOnBottom");break;case 4:r([0,2],[1,3])&&(g="spacedOutTetrachord");break;case 5:"b"===g&&r([1,3])&&(g="spacedOutPentachord",r([0,2],[2,4])&&(g="verySpacedOutPentachord"));break;case 6:r([0,3],[1,4],[2,5])&&(g="spacedOutHexachord"),r([0,2],[2,4],[1,3],[3,5])&&(g="verySpacedOutHexachord")}if(h>=7){let e=2,i=!0;for(;!0===i;){i=!1;for(let t=0;t+e<c.length;t++)if(this.checkCollision(c[t],c[t+e])){i=!0,e++;break}}for(l=t;l<=s;l++)u=(l-t)%e+1,c[l].column=u,d=d>u?d:u}else for(l=t;l<=s;l++)u=K.accidentalColumnsTable[h][g][l-t],c[l].column=u,d=d>u?d:u;t=s}const u=[],g=[];for(let t=0;t<=d;t++)u[t]=0,g[t]=0;u[0]=s+l,g[0]=s,c.forEach(t=>{t.width>u[t.column]&&(u[t.column]=t.width)});for(let t=1;t<u.length;t++)g[t]=u[t]+g[t-1];const p=g[g.length-1];let m=0;c.forEach(t=>{let e=0;const i=m+t.numAcc;for(;m<i;m++){const i=g[t.column-1]+e+l;a[m].accidental.setXShift(i),e+=a[m].accidental.getWidth()+n,nt("Line, accCount, shift: ",t.line,m,i)}}),e.leftShift=p+o}static checkCollision(t,e){let i=e.line-t.line,s=3;i>0?(s=e.flatLine||e.dblSharpLine?2.5:3,t.dblSharpLine&&(i-=.5)):(s=t.flatLine||t.dblSharpLine?2.5:3,e.dblSharpLine&&(i-=.5));const n=Math.abs(i)<s;return nt("Line1, Line2, Collision: ",t.line,e.line,n),n}static applyAccidentals(t,e){const i=[],s={};t.forEach(t=>{const e=new y(0,1);t.getTickables().forEach(t=>{if(t.shouldIgnoreTicks())return;const n=s[e.value()];n?n.push(t):(i.push(e.value()),s[e.value()]=[t]),e.add(t.getTicks())})}),i.sort((t,e)=>t-e);const n=new H;e||(e="C");const o=n.createScaleMap(e),a={};i.forEach(t=>{const e=s[t],i=[],r=t=>{if(!et(t)||t.isRest()||t.shouldIgnoreTicks())return;const e=t;e.keys.forEach((t,s)=>{const r=n.getNoteParts(t.split("/")[0]),h=t.split("/")[1],c=r.accidental||"n",l=r.root+c;a[r.root+h]||(a[r.root+h]=o[r.root]);const d=a[r.root+h]===l,u=i.indexOf(t)>-1;if(e.getModifiers().forEach((t,i)=>{$(t,"Accidental")&&t.type==c&&t.getIndex()==s&&e.getModifiers().splice(i,1)}),!d||d&&u){a[r.root+h]=l;const n=new ot(c);e.addModifier(n,s),i.push(t)}}),e.getModifiers().forEach(t=>{$(t,"GraceNoteGroup")&&t.getGraceNotes().forEach(r)})};e.forEach(r)})}constructor(t){super(),nt("New accidental: ",t),this.type=t,this.position=W.Position.LEFT,this.cautionary=!1,this.reset()}reset(){this.text="",this.cautionary?(this.text+=K.accidentalCodes("{"),this.text+=K.accidentalCodes(this.type),this.text+=K.accidentalCodes("}"),this.fontInfo.size=B.get("Accidental.cautionary.fontSize")):(this.text+=K.accidentalCodes(this.type),this.fontInfo.size=B.get("Accidental.fontSize")),Z(this.note)&&(this.fontInfo.size=B.get("Accidental.grace.fontSize"))}setNote(t){return f(t,"ArgumentError",`Bad note value: ${t}`),this.note=t,this.reset(),this}setAsCautionary(){return this.cautionary=!0,this.reset(),this}draw(){const{type:t,position:e,index:i}=this,s=this.checkContext(),n=this.checkAttachedNote();this.setRendered();const o=n.getModifierStartXY(e,i);this.x=o.x-this.width,this.y=o.y,nt("Rendering: ",t,o.x,o.y),this.renderText(s,0,0)}}ot.DEBUG=!1;class at extends P{static get CATEGORY(){return"Stem"}static get UP(){return 1}static get DOWN(){return-1}static get WIDTH(){return K.STEM_WIDTH}static get HEIGHT(){return K.STEM_HEIGHT}constructor(t){var e,i,s,n,o,a,r;super(),this.stemUpYOffset=0,this.stemDownYOffset=0,this.stemUpYBaseOffset=0,this.stemDownYBaseOffset=0,this.xBegin=null!==(e=null==t?void 0:t.xBegin)&&void 0!==e?e:0,this.xEnd=null!==(i=null==t?void 0:t.xEnd)&&void 0!==i?i:0,this.yTop=null!==(s=null==t?void 0:t.yTop)&&void 0!==s?s:0,this.yBottom=null!==(n=null==t?void 0:t.yBottom)&&void 0!==n?n:0,this.stemExtension=null!==(o=null==t?void 0:t.stemExtension)&&void 0!==o?o:0,this.stemDirection=null!==(a=null==t?void 0:t.stemDirection)&&void 0!==a?a:0,this.hide=(null==t?void 0:t.hide)||!1,this.isStemlet=(null==t?void 0:t.isStemlet)||!1,this.stemletHeight=null!==(r=null==t?void 0:t.stemletHeight)&&void 0!==r?r:0,this.renderHeightAdjustment=0,this.setOptions(t)}setOptions(t){var e,i,s,n;this.stemUpYOffset=null!==(e=null==t?void 0:t.stemUpYOffset)&&void 0!==e?e:0,this.stemDownYOffset=null!==(i=null==t?void 0:t.stemDownYOffset)&&void 0!==i?i:0,this.stemUpYBaseOffset=null!==(s=null==t?void 0:t.stemUpYBaseOffset)&&void 0!==s?s:0,this.stemDownYBaseOffset=null!==(n=null==t?void 0:t.stemDownYBaseOffset)&&void 0!==n?n:0}setNoteHeadXBounds(t,e){return this.xBegin=t,this.xEnd=e,this}setDirection(t){this.stemDirection=t}setExtension(t){this.stemExtension=t}getExtension(){return this.stemExtension}setYBounds(t,e){this.yTop=t,this.yBottom=e}getHeight(){const t=this.stemDirection===at.UP?this.stemUpYOffset:this.stemDownYOffset;return(this.yBottom-this.yTop+(at.HEIGHT-t+this.stemExtension))*this.stemDirection}getBoundingBox(){throw new p("NotImplemented","getBoundingBox() not implemented.")}getExtents(){const t=this.stemDirection===at.UP,e=[this.yTop,this.yBottom],i=at.HEIGHT+this.stemExtension,s=(t?Math.min:Math.max)(...e),n=(t?Math.max:Math.min)(...e);return{topY:s+i*-this.stemDirection,baseY:n}}setVisibility(t){return this.hide=!t,this}setStemlet(t,e){return this.isStemlet=t,this.stemletHeight=e,this}adjustHeightForFlag(){this.renderHeightAdjustment=B.get("Stem.heightAdjustmentForFlag",-3)}adjustHeightForBeam(){this.renderHeightAdjustment=-at.WIDTH/2}draw(){if(this.setRendered(),this.hide)return;const t=this.checkContext();let e,i;const s=this.stemDirection;let n=0;s===at.DOWN?(e=this.xBegin,i=this.yTop+this.stemDownYOffset,n=this.stemDownYBaseOffset):(e=this.xEnd,i=this.yBottom-this.stemUpYOffset,n=this.stemUpYBaseOffset);const o=this.getHeight();!function(...t){at.DEBUG&&S("VexFlow.Stem",t)}("Rendering stem - ","Top Y: ",this.yTop,"Bottom Y: ",this.yBottom);const a=this.isStemlet?o-this.stemletHeight*this.stemDirection:0,r=this.getAttribute("class");t.openGroup("stem"+(r?" "+r:""),this.getAttribute("id")),t.beginPath(),t.setLineWidth(at.WIDTH),t.moveTo(e,i-a+n),t.lineTo(e,i-o-this.renderHeightAdjustment*s),t.stroke(),t.closeGroup()}}var rt,ht;at.DEBUG=!1,function(t){t[t.LEFT=1]="LEFT",t[t.CENTER=2]="CENTER",t[t.RIGHT=3]="RIGHT",t[t.CENTER_STEM=4]="CENTER_STEM"}(rt||(rt={})),function(t){t[t.TOP=1]="TOP",t[t.CENTER=2]="CENTER",t[t.BOTTOM=3]="BOTTOM",t[t.CENTER_STEM=4]="CENTER_STEM"}(ht||(ht={}));class ct extends W{static get CATEGORY(){return"Annotation"}static get minAnnotationPadding(){return B.get("NoteHead.minPadding")}static format(t,e){if(!t||0===t.length)return!1;let i=0,s=0,n=0,o=0;for(let a=0;a<t.length;++a){const r=t[a];let h=(2+A.convertSizeToPixelValue(r.fontInfo.size))/K.STAVE_LINE_DISTANCE;const c=r.checkAttachedNote(),l=c.getGlyphWidth(),d=r.getWidth();r.horizontalJustification===rt.RIGHT?(n=Math.max(l,n),i=Math.max(i,d)+ct.minAnnotationPadding):r.horizontalJustification===rt.LEFT?(o=Math.max(l,o),s=Math.max(s,d)):(i=Math.max(i,d/2)+ct.minAnnotationPadding,s=Math.max(s,d/2),n=Math.max(l/2,n),o=Math.max(l/2,o));const u=c.getStave(),g=c.hasStem()?c.getStemDirection():at.UP;let p=0,m=5;if(st(c))if(c.renderOptions.drawStem){const t=c.getStem();t&&(p=Math.abs(t.getHeight())/K.STAVE_LINE_DISTANCE)}else p=0;else if(it(c)){const t=c.getStem();t&&"n"===c.getNoteType()&&(p=Math.abs(t.getHeight())/K.STAVE_LINE_DISTANCE)}if(u&&(m=u.getNumLines()),r.verticalJustification===this.VerticalJustify.TOP){let t=c.getLineNumber(!0);st(c)&&(t=m-(c.leastString()-.5)),g===at.UP&&(t+=p);t+e.topTextLine+.5<m?(r.setTextLine(m-t),h+=m-t,e.topTextLine=h):(r.setTextLine(e.topTextLine),e.topTextLine+=h)}else if(r.verticalJustification===this.VerticalJustify.BOTTOM){let t=m-c.getLineNumber();st(c)&&(t=c.greatestString()-1),g===at.DOWN&&(t+=p);const i=t+e.textLine+1;i<m?(r.setTextLine(m-i),h+=m-i,e.textLine=h):(r.setTextLine(e.textLine),e.textLine+=h)}else r.setTextLine(e.textLine)}const a=Math.min(Math.max(s-o,0),Math.max(s-e.rightShift,0)),r=Math.min(Math.max(i-n,0),Math.max(i-e.leftShift,0));return e.leftShift+=r,e.rightShift+=a,!0}constructor(t){super(),this.text=t,this.horizontalJustification=rt.CENTER,this.verticalJustification=ht.TOP}setVerticalJustification(t){return this.verticalJustification="string"==typeof t?ct.VerticalJustifyString[t]:t,this}getVerticalJustification(){return this.verticalJustification}getJustification(){return this.horizontalJustification}setJustification(t){return this.horizontalJustification="string"==typeof t?ct.HorizontalJustifyString[t]:t,this}setTextBaseline(t){if(void 0!==t&&!Number.isFinite(t))throw new p("BadArgument","Text baseline must be finite.");return this.textBaseline=t,this}computeX(){const t=this.checkAttachedNote(),e=t.getModifierStartXY(M.ABOVE,this.index),i=this.getWidth();let s;return s=this.horizontalJustification===rt.LEFT?e.x:this.horizontalJustification===rt.RIGHT?e.x-i:this.horizontalJustification===rt.CENTER?e.x-i/2:t.getStemX()-i/2,{x:s,textWidth:i}}computeY(){const t=A.convertSizeToPixelValue(this.fontInfo.size);if(void 0!==this.textBaseline)return{y:this.textBaseline,textHeight:t};const e=this.checkAttachedNote(),i=e.hasStem()?e.getStemDirection():at.UP;let s,n={},o=0;const a=e.hasStem(),r=e.checkStave();if(a&&(n=e.checkStem().getExtents(),o=r.getSpacingBetweenLines()),this.verticalJustification===ht.BOTTOM){s=e.getYs().reduce((t,e)=>t>e?t:e),s+=(this.textLine+1)*K.STAVE_LINE_DISTANCE+t,a&&i===at.DOWN&&(s=Math.max(s,n.topY+t+o*this.textLine))}else if(this.verticalJustification===ht.CENTER){const i=e.getYForTopText(this.textLine)-1;s=i+(r.getYForBottomText(this.textLine)-i)/2+t/2}else if(this.verticalJustification===ht.TOP){s=Math.min(...e.getYs())-(this.textLine+1)*K.STAVE_LINE_DISTANCE,a&&i===at.UP&&(o=n.topY<r.getTopLineTopY()?K.STAVE_LINE_DISTANCE:o,s=Math.min(s,n.topY-o*(this.textLine+1)))}else{const i=e.getStemExtents();s=i.topY+(i.baseY-i.topY)/2+t/2}return{y:s,textHeight:t}}draw(){const t=this.checkContext(),{x:e}=this.computeX(),{y:i}=this.computeY();this.setRendered();const s=this.getAttribute("class");t.openGroup("annotation"+(s?" "+s:""),this.getAttribute("id")),function(...t){ct.DEBUG&&S("VexFlow.Annotation",t)}("Rendering annotation: ",this.text,e,i),this.x=e,this.y=i,this.renderText(t,0,0),this.drawPointerRect(),t.closeGroup()}}ct.DEBUG=!1,ct.HorizontalJustify=rt,ct.HorizontalJustifyString={left:rt.LEFT,right:rt.RIGHT,center:rt.CENTER,centerStem:rt.CENTER_STEM},ct.VerticalJustify=ht,ct.VerticalJustifyString={above:ht.TOP,top:ht.TOP,below:ht.BOTTOM,bottom:ht.BOTTOM,center:ht.CENTER,centerStem:ht.CENTER_STEM};const{ABOVE:lt,BELOW:dt}=W.Position;function ut(t,e){return.5*t(e/.5)}function gt(t,e){return e===lt?t<=5:t>=1}function pt(t,e){return gt(t,e)?e===lt?Math.ceil:Math.floor:Math.round}const mt=t=>et(t)||Z(t);function ft(t,e){const i=t.getStemDirection(),{topY:s,baseY:n}=t.getStemExtents();if(mt(t))return t.hasStem()?i===at.UP?s:n:Math.min(...t.getYs());if(st(t))return t.hasStem()&&i===at.UP?s:t.checkStave().getYForTopText(e);throw new p("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")}function St(t,e){const i=t.getStemDirection(),{topY:s,baseY:n}=t.getStemExtents();if(mt(t))return t.hasStem()?i===at.UP?n:s:Math.max(...t.getYs());if(st(t))return t.hasStem()?i===at.UP?t.checkStave().getYForBottomText(e):s:t.checkStave().getYForBottomText(e);throw new p("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")}function Tt(t,e){const i=e===lt&&t.getStemDirection()===at.UP||e===dt&&t.getStemDirection()===at.DOWN;return mt(t)?t.hasStem()&&i?.5:1:t.hasStem()&&i?1:0}class xt extends W{static get CATEGORY(){return"Articulation"}static format(t,e){if(!t||0===t.length)return!1;let i=0;const s=(t,e,i)=>ut(pt(e,i),t.height/10+.5);t.forEach(t=>{const n=t.checkAttachedNote();i=Math.max(n.getGlyphWidth(),i);let o=5;const a=n.hasStem()?n.getStemDirection():at.UP;let r=0;if(it(n)){const t=n.getStem();t&&(r=Math.abs(t.getHeight())/K.STAVE_LINE_DISTANCE)}const h=n.getStave();if(h&&(o=h.getNumLines()),t.getPosition()===lt){let i=n.getLineNumber(!0);a===at.UP&&(i+=r);let h=s(t,e.topTextLine,lt);const c=i+e.topTextLine+.5;!t.articulation.betweenLines&&c<o&&(h+=o-c),t.setTextLine(e.topTextLine),e.topTextLine+=h,t.setOrigin(.5,1)}else if(t.getPosition()===dt){let i=Math.max(o-n.getLineNumber(),0);a===at.DOWN&&(i+=r);let h=s(t,e.textLine,dt);const c=i+e.textLine+.5;!t.articulation.betweenLines&&c<o&&(h+=o-c),t.setTextLine(e.textLine),e.textLine+=h,t.setOrigin(.5,0)}});const n=t.map(t=>t.getWidth()).reduce((t,e)=>Math.max(e,t)),o=Math.min(Math.max(n-i,0),Math.max(n-(e.leftShift+e.rightShift),0));return e.leftShift+=o/2,e.rightShift+=o/2,!0}static easyScoreHook({articulations:t},e,i){if(!t)return;const s={staccato:"a.",tenuto:"a-",accent:"a>"};t.split(",").map(t=>t.trim().split(".")).map(([t,e])=>{const n={type:s[t]};return e&&(n.position=W.PositionString[e]),i.getFactory().Articulation(n)}).map(t=>e.addModifier(t,0))}constructor(t){var e;super(),this.heightShift=0,this.type=t,this.position=lt,K.articulationCodes(this.type)||((null!==(e=this.type.codePointAt(0))&&void 0!==e?e:0)%2==0?this.position=lt:this.position=dt),this.articulation={betweenLines:!1},this.reset()}reset(){this.articulation=K.articulationCodes(this.type),this.articulation||(this.articulation={code:this.type,betweenLines:!1});const t=(this.position===lt?this.articulation.aboveCode:this.articulation.belowCode)||this.articulation.code||I.null;this.text=t}setBetweenLines(t=!0){return this.articulation.betweenLines=t,this}draw(){const t=this.checkContext(),e=this.checkAttachedNote();this.setRendered();const i=this.checkIndex(),{position:s,textLine:n}=this,o=this.articulation.betweenLines,a=e.checkStave(),r=a.getSpacingBetweenLines(),h=st(e),{x:c}=e.getModifierStartXY(s,i),l=!o||h,d=Tt(e,s);let u={[lt]:()=>{const t=ft(e,n)-(n+d)*r;return l?Math.min(a.getYForTopText(xt.INITIAL_OFFSET),t):t},[dt]:()=>{const t=St(e,n)+(n+d)*r;return l?Math.max(a.getYForBottomText(xt.INITIAL_OFFSET),t):t}}[s]();if(!h){const t=s===lt?-1:1,n=e.getKeyProps()[i].line,a=(e.getYs()[i]-u)/r+Number(n),h=function(t,e,i,s){const n=ut(pt(e,i),e);if(t&>(n,i)&&n%1==0)return n+.5*-s;return n}(o,a,s,t);gt(h,s)&&this.setOrigin(.5,.5),u+=Math.abs(h-a)*r*t}!function(...t){xt.DEBUG&&S("VexFlow.Articulation",t)}(`Rendering articulation at (x: ${c}, y: ${u})`),this.x=c,this.y=u,this.renderText(t,0,0)}}xt.DEBUG=!1,xt.INITIAL_OFFSET=-.5;class wt{constructor(){this.defaultStyle={}}setDefaultStyle(t){return this.defaultStyle=Object.assign({},t),this}getDefaultStyle(){return Object.assign({},this.defaultStyle)}static get CATEGORY(){return"RenderContext"}set font(t){this.setFont(t)}get font(){return this.getFont()}}class bt extends P{static get CATEGORY(){return"Tickable"}constructor(){super(),this._preFormatted=!1,this._postFormatted=!1,this.ticks=new y(0,1),this.intrinsicTicks=0,this.tickMultiplier=new y(1,1),this.modifiers=[],this.tupletStack=[],this.alignCenter=!1,this.centerXShift=0,this.ignoreTicks=!1,this.formatterMetrics={freedom:{left:0,right:0},duration:"",iterations:0,space:{used:0,mean:0,deviation:0}}}reset(){return this}getTicks(){return this.ticks}shouldIgnoreTicks(){return this.ignoreTicks}setIgnoreTicks(t){var e;return this.ignoreTicks=t,null===(e=this.voice)||void 0===e||e.invalidateTicks(),this}getWidth(){if(!this._preFormatted)throw new p("UnformattedNote","Can't call GetWidth on an unformatted note.");return this.width+(this.modifierContext?this.modifierContext.getWidth():0)}getX(){return this.checkTickContext("Can't getX() without a TickContext.").getX()+this.xShift}getFormatterMetrics(){return this.formatterMetrics}getCenterXShift(){return this.isCenterAligned()?this.centerXShift:0}setCenterXShift(t){return this.centerXShift=t,this}isCenterAligned(){return this.alignCenter}setCenterAlignment(t){return this.alignCenter=t,this}getVoice(){return f(this.voice,"NoVoice","Tickable has no voice.")}setVoice(t){this.voice=t}getTuplet(){return this.tupletStack.at(-1)}getTupletStack(){return this.tupletStack}removeTuplet(t){const e=this.tupletStack.indexOf(t);if(-1===e)throw new p("BadArguments","Tuplet is not found in this tickable");this.tupletStack.splice(e,1);const i=t.getNoteCount(),s=t.getNotesOccupied();return this.applyTickMultiplier(i,s),this}clearTuplets(){var t;return this.tupletStack.length?(this.tupletStack=[],this.tickMultiplier=new y(1,1),this.ticks=new y(this.intrinsicTicks,1),null===(t=this.voice)||void 0===t||t.invalidateTicks(),this):this}resetTuplet(t){if(t)try{this.removeTuplet(t)}catch(t){}else this.clearTuplets();return this}setTuplet(t){return this.tupletStack.length&&this.clearTuplets(),this.addTuplet(t)}addTuplet(t){if(this.tupletStack.includes(t))return this;this.tupletStack.push(t);const e=t.getNoteCount(),i=t.getNotesOccupied();return this.applyTickMultiplier(i,e),this}setTupletStack(t){this.clearTuplets();for(const e of t)this.addTuplet(e);return this}addToModifierContext(t){this.modifierContext=t;for(let t=0;t<this.modifiers.length;++t)this.modifierContext.addMember(this.modifiers[t]);return this.modifierContext.addMember(this),this._preFormatted=!1,this}addModifier(t,e=0){return this.modifiers.push(t),this._preFormatted=!1,this}getModifiers(){return this.modifiers}setTickContext(t){this.tickContext=t,this._preFormatted=!1}checkTickContext(t="Tickable has no tick context."){return f(this.tickContext,"NoTickContext",t)}preFormat(){this._preFormatted||(this.width=0,this.modifierContext&&(this.modifierContext.preFormat(),this.width+=this.modifierContext.getWidth()))}set preFormatted(t){this._preFormatted=t}get preFormatted(){return this._preFormatted}postFormat(){return this._postFormatted||(this._postFormatted=!0),this}set postFormatted(t){this._postFormatted=t}get postFormatted(){return this._postFormatted}getIntrinsicTicks(){return this.intrinsicTicks}setIntrinsicTicks(t){var e;this.intrinsicTicks=t,this.ticks=this.tickMultiplier.clone().multiply(this.intrinsicTicks),null===(e=this.voice)||void 0===e||e.invalidateTicks()}getTickMultiplier(){return this.tickMultiplier}applyTickMultiplier(t,e){var i;this.tickMultiplier.multiply(t,e),this.ticks=this.tickMultiplier.clone().multiply(this.intrinsicTicks),null===(i=this.voice)||void 0===i||i.invalidateTicks()}setDuration(t){var e;const i=t.numerator*(K.RESOLUTION/t.denominator);this.ticks=this.tickMultiplier.clone().multiply(i),this.intrinsicTicks=i,null===(e=this.voice)||void 0===e||e.invalidateTicks()}getAbsoluteX(){return this.checkTickContext("Can't getAbsoluteX() without a TickContext.").getX()}setModifierContext(t){return this.modifierContext=t,this}getModifierContext(){return this.modifierContext}checkModifierContext(){return f(this.modifierContext,"NoModifierContext","No modifier context attached to this tickable.")}}class yt extends bt{static get CATEGORY(){return"Note"}static getGlyphProps(t,e="n"){t=K.sanitizeDuration(t);let i=K.durationCodes[t];void 0===i&&(i=K.durationCodes[4]);const s=K.codeNoteHead(e.toUpperCase(),t);return s!==I.null&&(i=Object.assign(Object.assign({},i),{codeHead:s})),i}static plotMetrics(t,e,i){var s;const n=e.getMetrics(),o=e.getAbsoluteX()-n.modLeftPx-n.leftDisplacedHeadPx,a=e.getAbsoluteX()-n.leftDisplacedHeadPx,r=e.getAbsoluteX(),h=e.getAbsoluteX()+n.notePx,c=e.getAbsoluteX()+n.notePx+n.rightDisplacedHeadPx,l=e.getAbsoluteX()+n.notePx+n.rightDisplacedHeadPx+n.modRightPx,d=l+(null!==(s=e.getFormatterMetrics().freedom.right)&&void 0!==s?s:0),u=l-o;t.save(),t.setFont(B.get("fontFamily"),8),t.fillText(Math.round(u)+"px",o+e.getXShift(),i);const g=i+7;function p(i,s,n,o=g){t.beginPath(),t.setStrokeStyle(n),t.setFillStyle(n),t.setLineWidth(3),t.moveTo(i+e.getXShift(),o),t.lineTo(s+e.getXShift(),o),t.stroke()}p(o,a,"red"),p(a,r,"#999"),p(r,h,"green"),p(h,c,"#999"),p(c,l,"red"),p(l,d,"#DD0"),p(o-e.getXShift(),o,"#BBB"),function(t,e,i,s="#F55"){t.save(),t.setFillStyle(s),t.beginPath(),t.arc(e,i,3,0,2*Math.PI,!1),t.closePath(),t.fill(),t.restore()}(t,r+e.getXShift(),g,"blue");const m=e.getFormatterMetrics();if(m.iterations>0){const s=m.space.deviation,n=s>=0?"+":"";t.setFillStyle("red"),t.fillText(n+Math.round(s),r+e.getXShift(),i-10)}t.restore()}static parseDuration(t){if(!t||t.length>64)return;const e=/^(\d+(?:\/\d+)?|[a-z])(d*)([nrhms]?)$/.exec(t);if(!e)return;return{duration:e[1],dots:e[2].length,type:e[3]||"n"}}static parseNoteStruct(t){const e=yt.parseDuration(t.duration);if(!e)return;let i=t.type;if(i&&!K.validTypes[i])return;const s=[];i||(i=e.type||"n",void 0!==t.keys&&t.keys.forEach((t,e)=>{const n=t.split("/");s[e]=n&&3===n.length?n[2]:i}));let n=K.durationToTicks(e.duration);if(!n)return;const o=t.dots?t.dots:e.dots;if("number"!=typeof o)return;let a=n;for(let t=0;t<o;t++){if(a<=1)return;a/=2,n+=a}return{duration:e.duration,type:i,customTypes:s,dots:o,ticks:n}}constructor(t){if(super(),!t)throw new p("BadArguments","Note must have valid initialization data to identify duration and type.");const e=yt.parseNoteStruct(t);if(!e)throw new p("BadArguments",`Invalid note initialization object: ${JSON.stringify(t)}`);this.keys=t.keys||[],this.keyProps=[],this.duration=e.duration,this.noteType=e.type,this.customTypes=e.customTypes,t.durationOverride?this.setDuration(t.durationOverride):this.setIntrinsicTicks(e.ticks),this.modifiers=[],this.glyphProps=yt.getGlyphProps(this.duration,this.noteType),this.customGlyphs=this.customTypes.map(t=>yt.getGlyphProps(this.duration,t)),this.playNote=void 0,this.ignoreTicks=!1,this.width=0,this.leftDisplacedHeadPx=0,this.rightDisplacedHeadPx=0,this.xShift=0,this.ys=[],t.alignCenter&&this.setCenterAlignment(t.alignCenter),this.renderOptions={annotationSpacing:5,strokePx:1,yShift:0}}getPlayNote(){return this.playNote}setPlayNote(t){return this.playNote=t,this}isRest(){return!1}addStroke(t,e){return e.setNote(this),e.setIndex(t),this.modifiers.push(e),this.preFormatted=!1,this}getStave(){return this.stave}checkStave(){return f(this.stave,"NoStave","No stave attached to instance.")}setStave(t){return this.stave=t,this.setYs([t.getYForLine(0)]),this.setContext(this.stave.getContext()),this}getLeftDisplacedHeadPx(){return this.leftDisplacedHeadPx}getRightDisplacedHeadPx(){return this.rightDisplacedHeadPx}setLeftDisplacedHeadPx(t){return this.leftDisplacedHeadPx=t,this}setRightDisplacedHeadPx(t){return this.rightDisplacedHeadPx=t,this}shouldIgnoreTicks(){return this.ignoreTicks}getLineNumber(t){return 0}getLineForRest(){return 0}getGlyphProps(){return this.glyphProps}getGlyphWidth(){return 0}setYs(t){return this.ys=t,this}getYs(){if(0===this.ys.length)throw new p("NoYValues","No Y-values calculated for this note.");return this.ys}getYForTopText(t){return this.checkStave().getYForTopText(t)}getVoice(){if(!this.voice)throw new p("NoVoice","Note has no voice.");return this.voice}setVoice(t){return this.voice=t,this.preFormatted=!1,this}getTickContext(){return this.checkTickContext()}setTickContext(t){return this.tickContext=t,this.preFormatted=!1,this}getDuration(){return this.duration}isDotted(){return this.getModifiersByType("Dot").length>0}hasStem(){return!1}getNoteType(){return this.noteType}getBeam(){return this.beam}checkBeam(){return f(this.beam,"NoBeam","No beam attached to instance")}hasBeam(){return void 0!==this.beam}setBeam(t){return this.beam=t,this}addModifier(t,e=0){const i="Note.addModifier(modifier: Modifier, index: number=0)";if("string"==typeof e&&(e=parseInt(e),console.warn(i+" expected a number for `index`, but received a string.")),"object"!=typeof t||"number"!=typeof e)throw new p("WrongParams","Incorrect call signature. Use "+i+" instead.");return t.setNote(this),t.setIndex(e),super.addModifier(t),this}getModifiersByType(t){return this.modifiers.filter(e=>e.getCategory()===t)}getModifierStartXY(t,e,i){if(!this.preFormatted)throw new p("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");return{x:this.getAbsoluteX(),y:this.ys[0]}}getRightParenthesisPx(t){return this.getKeyProps()[t].displaced?this.getRightDisplacedHeadPx():0}getLeftParenthesisPx(t){return this.getKeyProps()[t].displaced?this.getLeftDisplacedHeadPx()-this.xShift:-this.xShift}getFirstDotPx(){let t=this.getRightDisplacedHeadPx();const e=this.checkModifierContext().getMembers("Parenthesis");return 0!==e.length&&(t+=e[0].getWidth()+1),t}getMetrics(){if(!this.preFormatted)throw new p("UnformattedNote","Can't call getMetrics on an unformatted note.");const t=this.modifierContext?this.modifierContext.getState().leftShift:0,e=this.modifierContext?this.modifierContext.getState().rightShift:0,i=this.getWidth();return{width:i,glyphWidth:this.getGlyphWidth(),notePx:i-t-e-this.leftDisplacedHeadPx-this.rightDisplacedHeadPx,modLeftPx:t,modRightPx:e,leftDisplacedHeadPx:this.leftDisplacedHeadPx,rightDisplacedHeadPx:this.rightDisplacedHeadPx,glyphPx:0}}getAbsoluteX(){let t=this.checkTickContext("Can't getAbsoluteX() without a TickContext.").getX();return this.stave&&(t+=this.stave.getNoteStartX()+B.get("Stave.padding",0)),this.isCenterAligned()&&(t+=this.getCenterXShift()),t}getStemDirection(){throw new p("NoStem","No stem attached to this note.")}getStemExtents(){throw new p("NoStem","No stem attached to this note.")}getTieRightX(){let t=this.getAbsoluteX();return t+=this.getGlyphWidth()/2,t+=-this.width/2+this.width+2,t}getTieLeftX(){let t=this.getAbsoluteX();return t+=this.getGlyphWidth()/2,t-=this.width/2+2,t}getKeys(){return this.keys}getKeyProps(){return this.keyProps}getBoundingBox(){const t=super.getBoundingBox();for(let e=0;e<this.modifiers.length;e++)t.mergeWith(this.modifiers[e].getBoundingBox());return t}}var kt,vt,Bt;!function(t){t[t.CENTER=0]="CENTER",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.ABOVE=3]="ABOVE",t[t.BELOW=4]="BELOW",t[t.BEGIN=5]="BEGIN",t[t.END=6]="END"}(kt||(kt={}));class Ct extends P{static get CATEGORY(){return"StaveModifier"}static get Position(){return kt}constructor(){super(),this.padding=10,this.position=kt.ABOVE}getPosition(){return this.position}setPosition(t){return this.position=t,this}getStave(){return this.stave}checkStave(){return f(this.stave,"NoStave","No stave attached to instance.")}setStave(t){return this.stave=t,this}getPadding(t){return void 0!==t&&t<2?0:this.padding}setPadding(t){return this.padding=t,this}setLayoutMetrics(t){return this.layoutMetrics=t,this}getLayoutMetrics(){return this.layoutMetrics}}!function(t){t[t.SINGLE=1]="SINGLE",t[t.DOUBLE=2]="DOUBLE",t[t.END=3]="END",t[t.REPEAT_BEGIN=4]="REPEAT_BEGIN",t[t.REPEAT_END=5]="REPEAT_END",t[t.REPEAT_BOTH=6]="REPEAT_BOTH",t[t.NONE=7]="NONE"}(vt||(vt={})),function(t){t[t.NONE=0]="NONE",t[t.STRAIGHT=1]="STRAIGHT",t[t.CURVED=2]="CURVED"}(Bt||(Bt={}));class Dt extends Ct{static get CATEGORY(){return"Barline"}static get type(){return vt}static get typeString(){return{single:vt.SINGLE,double:vt.DOUBLE,end:vt.END,repeatBegin:vt.REPEAT_BEGIN,repeatEnd:vt.REPEAT_END,repeatBoth:vt.REPEAT_BOTH,none:vt.NONE}}constructor(t){super(),this.repeatBrackets=Bt.NONE,this.thickness=K.STAVE_LINE_THICKNESS;const e=vt;this.widths={},this.widths[e.SINGLE]=5,this.widths[e.DOUBLE]=5,this.widths[e.END]=5,this.widths[e.REPEAT_BEGIN]=5,this.widths[e.REPEAT_END]=5,this.widths[e.REPEAT_BOTH]=5,this.widths[e.NONE]=5,this.paddings={},this.paddings[e.SINGLE]=0,this.paddings[e.DOUBLE]=0,this.paddings[e.END]=0,this.paddings[e.REPEAT_BEGIN]=15,this.paddings[e.REPEAT_END]=15,this.paddings[e.REPEAT_BOTH]=15,this.paddings[e.NONE]=0,this.layoutMetricsMap={},this.layoutMetricsMap[e.SINGLE]={xMin:0,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[e.DOUBLE]={xMin:-3,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[e.END]={xMin:-5,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[e.REPEAT_END]={xMin:-10,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[e.REPEAT_BEGIN]={xMin:-2,xMax:10,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[e.REPEAT_BOTH]={xMin:-10,xMax:10,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[e.NONE]={xMin:0,xMax:0,paddingLeft:5,paddingRight:5},this.setPosition(kt.BEGIN),this.setType(t)}setRepeatBracket(t){this.repeatBrackets=t}getRepeatBrackets(){return this.repeatBrackets}getType(){return this.type}setType(t){return this.type="string"==typeof t?Dt.typeString[t]:t,this.setWidth(this.widths[this.type]),this.setPadding(this.paddings[this.type]),this.setLayoutMetrics(this.layoutMetricsMap[this.type]),this}draw(){const t=this.checkStave(),e=t.checkContext();this.setRendered();const i=this.getAttribute("class");switch(e.openGroup("stavebarline"+(i?" "+i:""),this.getAttribute("id")),this.type){case vt.SINGLE:this.drawVerticalBar(t,this.x,!1);break;case vt.DOUBLE:this.drawVerticalBar(t,this.x,!0);break;case vt.END:this.drawVerticalEndBar(t,this.x);break;case vt.REPEAT_BEGIN:this.drawRepeatBar(t,this.x,!0),t.getX()!==this.x&&this.drawVerticalBar(t,t.getX());break;case vt.REPEAT_END:this.drawRepeatBar(t,this.x,!1);break;case vt.REPEAT_BOTH:this.drawRepeatBar(t,this.x,!1),this.drawRepeatBar(t,this.x,!0)}this.drawPointerRect(),e.closeGroup()}drawVerticalBar(t,e,i){const s=t.checkContext(),n=t.getTopLineTopY(),o=t.getBottomLineBottomY();i&&s.fillRect(e-3,n,1,o-n),s.fillRect(e,n,1,o-n)}drawVerticalEndBar(t,e){const i=t.checkContext(),s=t.getTopLineTopY(),n=t.getBottomLineBottomY();i.fillRect(e-5,s,1,n-s),i.fillRect(e-2,s,3,n-s)}drawStraightBrackets(t,e,i,s,n){const o=t.checkContext(),a=Math.round(1.5*K.STAVE_LINE_DISTANCE)*n,r=Math.round(.6*K.STAVE_LINE_DISTANCE),h=Math.round(r/2),c=i+s,l=n>0?e-2:e;o.moveTo(l,c),o.lineTo(l,c+r*(-1*s)),o.lineTo(l+a,c+r*s),o.lineTo(l+a,c+s*(r+h)),o.lineTo(l,c),o.fill()}drawCurvedBrackets(t,e,i,s,n){const o=t.checkContext(),a=Math.round(1.5*K.STAVE_LINE_DISTANCE)*n,r=Math.round(.6*K.STAVE_LINE_DISTANCE),h=Math.round(r/2),c=i+s,l=n>0?e-2:e;o.moveTo(l,c),o.lineTo(l,c+r*(-1*s)),o.quadraticCurveTo(l+a/2,c+r*(-1*s),l+a,c+r*s),o.lineTo(l+a,c+s*(r+h)),o.quadraticCurveTo(l+a/2,c,l,c),o.fill()}drawRepeatBar(t,e,i){const s=t.checkContext(),n=t.getTopLineTopY(),o=t.getBottomLineBottomY();let a=3;i||(a=-5);const r=i?1:-1;s.fillRect(e+a,n,1,o-n),s.fillRect(e-2,n,3,o-n),this.repeatBrackets===Bt.CURVED?(this.drawCurvedBrackets(t,e,n,-1,r),this.drawCurvedBrackets(t,e,o,1,r)):this.repeatBrackets===Bt.STRAIGHT&&(this.drawStraightBrackets(t,e,n,-1,r),this.drawStraightBrackets(t,e,o,1,r));i?a+=4:a-=4;const h=e+a+1;let c=(t.getNumLines()-1)*t.getSpacingBetweenLines();c=c/2-t.getSpacingBetweenLines()/2;let l=n+c+1;s.beginPath(),s.arc(h,l,2,0,2*Math.PI,!1),s.fill(),l+=t.getSpacingBetweenLines(),s.beginPath(),s.arc(h,l,2,0,2*Math.PI,!1),s.fill()}}class Et extends yt{static get CATEGORY(){return"BarNote"}constructor(t=vt.SINGLE){super({duration:"b"}),this.metrics={widths:{}};const e=vt;this.metrics.widths={[e.SINGLE]:8,[e.DOUBLE]:12,[e.END]:15,[e.REPEAT_BEGIN]:14,[e.REPEAT_END]:14,[e.REPEAT_BOTH]:18,[e.NONE]:0},this.ignoreTicks=!0,this.setType(t)}getType(){return this.type}setType(t){return this.type="string"==typeof t?Dt.typeString[t]:t,this.setWidth(this.metrics.widths[this.type]),this}addToModifierContext(t){return this}preFormat(){return this.preFormatted=!0,this}draw(){const t=this.checkContext();!function(...t){Et.DEBUG&&S("VexFlow.BarNote",t)}("Rendering bar line at: ",this.getAbsoluteX());const e=new Dt(this.type);e.setX(this.getAbsoluteX()),e.setStave(this.checkStave()),e.setContext(t),e.drawWithStyle(),this.setRendered()}}function Lt(t){let e=0;return t.forEach(t=>{t.keyProps&&t.keyProps.forEach(t=>{e+=t.line-3})}),e>=0?at.DOWN:at.UP}Et.DEBUG=!1;const Nt="L",Ft="B";class At extends P{static get CATEGORY(){return"Beam"}getStemDirection(){return this._stemDirection}static getDefaultBeamGroups(t){t&&"c"!==t||(t="4/4");const e={"1/2":["1/2"],"2/2":["1/2"],"3/2":["1/2"],"4/2":["1/2"],"1/4":["1/4"],"2/4":["1/4"],"3/4":["1/4"],"4/4":["1/4"],"1/8":["1/8"],"2/8":["2/8"],"3/8":["3/8"],"4/8":["2/8"],"1/16":["1/16"],"2/16":["2/16"],"3/16":["3/16"],"4/16":["2/16"]}[t];if(void 0!==e)return e.map(t=>(new y).parse(t));{const e=parseInt(t.split("/")[0],10),i=parseInt(t.split("/")[1],10);if(e%3==0)return[new y(3,i)];if(i>4)return[new y(2,i)];if(i<=4)return[new y(1,i)]}return[new y(1,4)]}static applyAndGetBeams(t,e,i){return At.generateBeams(t.getTickables(),{groups:i,stemDirection:e})}static generateBeams(t,e={}){e.groups&&e.groups.length||(e.groups=[new y(2,8)]);const i=e.groups.map(t=>{if(!t.multiply)throw new p("InvalidBeamGroups","The beam groups must be an array of VexFlow.Fractions");return t.clone().multiply(K.RESOLUTION,1)}),s=t;let n=0,o=[],a=[];function r(){i.length-1>n?n+=1:n=0}!function(){let t=[],e=new y(0,1);s.forEach(s=>{if(t=[],s.shouldIgnoreTicks())return o.push(a),void(a=t);a.push(s);const h=i[n].clone(),c=function(t){return t.reduce((t,e)=>e.getTicks().clone().add(t),new y(0,1))}(a).add(e),l=K.durationToNumber(s.getDuration())<8;if(l&&s.getTuplet()&&(h.numerator*=2),c.greaterThan(h)){if(!l){const e=a.pop();e&&t.push(e)}o.push(a);do{e=c.subtract(i[n]),r()}while(e.greaterThanEquals(i[n]));a=t}else c.equals(h)&&(o.push(a),e=new y(0,1),a=t,r())}),a.length>0&&o.push(a)}(),function(){const t=[];o.forEach(i=>{let s=[];i.forEach((i,n,o)=>{const a=0===n||n===o.length-1,r=o[n-1],h=!e.beamRests&&i.isRest(),c=e.beamRests&&e.beamMiddleOnly&&i.isRest()&&a;let l=!1;if(e.maintainStemDirections&&r&&!i.isRest()&&!r.isRest()){const t=r.getStemDirection();l=i.getStemDirection()!==t}const d=parseInt(i.getDuration(),10)<8;h||c||l||d?(s.length>0&&t.push(s),s=l?[i]:[]):s.push(i)}),s.length>0&&t.push(s)}),o=t}(),o.forEach(t=>{let i;if(e.maintainStemDirections){const e=function(t){for(let e=0;e<t.length;e++){const i=t[e];if(!i.isRest())return i}return!1}(t);i=e?e.getStemDirection():at.UP}else i=e.stemDirection?e.stemDirection:Lt(t);!function(t,e){t.forEach(t=>{t.setStemDirection(e)})}(t,i)});const h=o.filter(t=>{if(t.length>1){let e=!0;return t.forEach(t=>{t.getIntrinsicTicks()>=K.durationToTicks("4")&&(e=!1)}),e}return!1}),c=function(){const t=[];return o.forEach(e=>{let i;e.forEach(e=>{const s=e.getTuplet();s&&i!==s&&(i=s,t.push(i))})}),t}(),l=[];return h.forEach(t=>{const i=new At(t);e.showStemlets&&(i.renderOptions.showStemlets=!0),e.secondaryBreaks&&(i.renderOptions.secondaryBreakTicks=K.durationToTicks(e.secondaryBreaks)),!0===e.flatBeams&&(i.renderOptions.flatBeams=!0,i.renderOptions.flatBeamOffset=e.flatBeamOffset),l.push(i)}),c.forEach(t=>{const e=t.notes[0].stemDirection===at.DOWN?-1:1;t.setTupletLocation(e);let i=!1;for(let e=0;e<t.notes.length;e++){if(!t.notes[e].hasBeam()){i=!0;break}}t.setBracketed(i)}),l}constructor(t,e=!1){if(super(),this.slope=0,this.yShift=0,this.forcedPartialDirections={},!t||0===t.length)throw new p("BadArguments","No notes provided for beam.");if(1===t.length)throw new p("BadArguments","Too few notes for beam.");if(this._ticks=t[0].getIntrinsicTicks(),this._ticks>=K.durationToTicks("4"))throw new p("BadArguments","Beams can only be applied to notes shorter than a quarter note.");let i,s;this._stemDirection=t[0].getStemDirection();let n=this._stemDirection;if(e&&et(t[0]))n=Lt(t);else if(e&&st(t[0])){const e=t.reduce((t,e)=>t+e.getStemDirection(),0);n=e>-1?at.UP:at.DOWN}for(i=0;i<t.length;++i)s=t[i],e&&(s.setStemDirection(n),this._stemDirection=n),s.setBeam(this);this.postFormatted=!1,this.notes=t,this._beamCount=this.getBeamCount(),this.breakOnIndexes=[],this.renderOptions={beamWidth:5,maxSlope:.25,minSlope:-.25,slopeIterations:20,slopeCost:100,showStemlets:!1,stemletExtension:7,partialBeamLength:10,flatBeams:!1,minFlatBeamOffset:15}}getNotes(){return this.notes}getBeamCount(){return this.notes.map(t=>t.getGlyphProps().beamCount).reduce((t,e)=>e>t?e:t)}breakSecondaryAt(t){return this.breakOnIndexes=t,this}setPartialBeamSideAt(t,e){return this.forcedPartialDirections[t]=e,this}unsetPartialBeamSideAt(t){return delete this.forcedPartialDirections[t],this}getSlopeY(t,e,i,s){return i+(t-e)*s}calculateSlope(){const{notes:t,renderOptions:{maxSlope:e,minSlope:i,slopeIterations:s,slopeCost:n}}=this,o=this._stemDirection,a=t[0],r=function(t,e){const i=t.getStemExtents().topY,s=t.getStemX();return(e.getStemExtents().topY-i)/(e.getStemX()-s)}(a,t[t.length-1]),h=(e-i)/s;let c=Number.MAX_VALUE,l=0,d=0;for(let s=i;s<=e;s+=h){let e=0,i=0;for(let n=1;n<t.length;++n){const r=t[n];if(r.hasStem()||r.isRest()){const t=this.getSlopeY(r.getStemX(),a.getStemX(),a.getStemExtents().topY,s)+i,h=r.getStemExtents().topY;if(h*o<t*o){const s=Math.abs(h-t);i+=s*-o,e+=s*n}else e+=(h-t)*o}}const h=r/2,u=n*Math.abs(h-s)+Math.abs(e);u<c&&(c=u,l=s,d=i)}this.slope=l,this.yShift=d}calculateFlatSlope(){const{notes:t,renderOptions:{beamWidth:e,minFlatBeamOffset:i,flatBeamOffset:s}}=this,n=this._stemDirection;let o=0,a=0,r=0,h=0;for(let e=0;e<t.length;e++){const i=t[e],s=i.getStemExtents().topY;o+=s,n===at.DOWN&&h<s?(h=s,a=Math.max(...i.getYs()),r=i.getBeamCount()):n===at.UP&&(0===h||h>s)&&(h=s,a=Math.min(...i.getYs()),r=i.getBeamCount())}let c=o/t.length;const l=i+r*e*1.5,d=a+l*-n;n===at.DOWN&&c<d?c=a+l:n===at.UP&&c>d&&(c=a-l),s?(n===at.DOWN&&c>s||n===at.UP&&c<s)&&(this.renderOptions.flatBeamOffset=c):this.renderOptions.flatBeamOffset=c,this.slope=0,this.yShift=0}getBeamYToDraw(){let t=this.notes[0].getStemExtents().topY;return this.renderOptions.flatBeams&&this.renderOptions.flatBeamOffset&&(t=this.renderOptions.flatBeamOffset),t}applyStemExtensions(){const{notes:t,slope:e,renderOptions:{showStemlets:i,stemletExtension:s,beamWidth:n}}=this,o=this.yShift,a=this._beamCount,r=t[0],h=this.getBeamYToDraw(),c=r.getStemX();for(let r=0;r<t.length;++r){const l=t[r],d=l.getStem();if(d){const t=l.getStemX(),{topY:r}=l.getStemExtents(),u=this.getSlopeY(t,c,h,e)+o,g=d.getExtension(),p=l.getStemDirection()===at.UP?r-u:u-r;let m=0;if(l.getStemDirection()!==this._stemDirection){m=(1+1.5*(l.getGlyphProps().beamCount-1))*this.renderOptions.beamWidth}if(d.setExtension(g+p+m),d.adjustHeightForBeam(),l.isRest()&&i){const t=(a-1)*n*1.5+n;d.setVisibility(!0).setStemlet(!0,t+s)}}}}lookupBeamDirection(t,e,i,s,n){if("4"===t)return Nt;const o=this.forcedPartialDirections[n];if(o)return o;const a=""+K.durationToNumber(t)/2,r=e<K.durationToTicks(a),h=s<K.durationToTicks(a),c=i<K.durationToTicks(a);return r&&h&&c?Ft:r&&!h&&c?Nt:!r&&h&&c?"R":this.lookupBeamDirection(a,e,i,s,n)}getBeamLines(t){const e=K.durationToTicks(t);let i=!1;const s=[];let n;const o=this.renderOptions.partialBeamLength;let a=!1,r=0;for(let h=0;h<this.notes.length;++h){const c=this.notes[h];r+=c.getTicks().value();let l=!1;parseInt(t,10)>=8&&(l=-1!==this.breakOnIndexes.indexOf(h),this.renderOptions.secondaryBreakTicks&&r>=this.renderOptions.secondaryBreakTicks&&(r=0,l=!0));const d=c.getIntrinsicTicks()<e,u=c.getStemX()-at.WIDTH/2,g=this.notes[h-1],p=this.notes[h+1],m=p&&p.getIntrinsicTicks()<e,f=g&&g.getIntrinsicTicks()<e,S=g&&p&&d&&!f&&!m;if(d)if(i)n=s[s.length-1],n.end=u,l&&(i=!1,p&&!m&&void 0===n.end&&(n.end=n.start-o));else{if(n={start:u,end:void 0},i=!0,S){const e=g.getIntrinsicTicks(),i=p.getIntrinsicTicks(),s=c.getIntrinsicTicks(),a=this.lookupBeamDirection(t,e,s,i,h);[Nt,Ft].includes(a)?n.end=n.start-o:n.end=n.start+o}else m?l&&(n.end=n.start-o,i=!1):n.end=(a||0===h)&&p?n.start+o:n.start-o;s.push(n)}else i=!1;a=l}const h=s[s.length-1];return h&&void 0===h.end&&(h.end=h.start-o),s}drawStems(t){this.notes.forEach(e=>{const i=e.getStem();if(i){const s=e.getStemX();i.setNoteHeadXBounds(s,s),i.setContext(t).drawWithStyle()}},this)}drawBeamLines(t){const e=["4","8","16","32","64","128","256","512","1024"],i=this.notes[0];let s=this.getBeamYToDraw();const n=i.getStemX(),o=this.renderOptions.beamWidth*this._stemDirection;for(let i=0;i<e.length;++i){const a=e[i],r=this.getBeamLines(a);for(let e=0;e<r.length;++e){const i=r[e],a=i.start,h=this.getSlopeY(a,n,s,this.slope),c=i.end;if(!c)throw new p("NoLastBeamX","lastBeamX undefined.");{const e=this.getSlopeY(c,n,s,this.slope);t.beginPath(),t.moveTo(a,h),t.lineTo(a,h+o),t.lineTo(c+1,e+o),t.lineTo(c+1,e),t.closePath(),t.fill()}}s+=1.5*o}}preFormat(){return this}postFormat(){this.postFormatted||(st(this.notes[0])||this.renderOptions.flatBeams?this.calculateFlatSlope():this.calculateSlope(),this.applyStemExtensions(),this.postFormatted=!0)}draw(){const t=this.checkContext();if(this.setRendered(),this.unbeamable)return;this.postFormatted||this.postFormat();const e=this.getAttribute("class");t.openGroup("beam"+(e?" "+e:""),this.getAttribute("id")),this.drawStems(t),this.drawBeamLines(t),this.drawPointerRect(),t.closeGroup()}}class Ot extends W{static get CATEGORY(){return"Bend"}static get UP(){return 0}static get DOWN(){return 1}static format(t,e){if(!t||0===t.length)return!1;let i=0;for(let s=0;s<t.length;++s){const n=t[s],o=n.checkAttachedNote();if(st(o)){const t=o.leastString()-1;e.topTextLine<t&&(e.topTextLine=t)}n.setXShift(i),i=n.getWidth(),n.setTextLine(e.topTextLine)}return e.rightShift+=i,e.topTextLine+=1,!0}setStyleLine(t){return this.styleLine=t,this}getStyleLine(){return this.styleLine}constructor(t){super(),this.styleLine=B.getStyle("Bend.line"),this.xShift=0,this.tap="",this.renderOptions={bendWidth:8,releaseWidth:8},this.phrase=t,this.updateWidth()}setXShift(t){return this.xShift=t,this.updateWidth(),this}setTap(t){return this.tap=t,this}getTextHeight(){const t=new P("Bend");return t.setText(this.phrase[0].text),t.getHeight()}updateWidth(){const t=t=>{const e=new P("Bend");return e.setText(t),e.getWidth()};let e=0;for(let i=0;i<this.phrase.length;++i){const s=this.phrase[i];if(void 0!==s.width)e+=s.width;else{const i=s.type===Ot.UP?this.renderOptions.bendWidth:this.renderOptions.releaseWidth;s.width=Math.max(i,t(s.text))+3,s.drawWidth=s.width/2,e+=s.width}}return this.setWidth(e+this.xShift),this}draw(){var t;const e=this.checkContext(),i=this.checkAttachedNote();this.setRendered();const s=i.getModifierStartXY(W.Position.RIGHT,this.index);s.x+=3,s.y+=.5;const n=this.xShift,o=i.checkStave().getSpacingBetweenLines(),a=i.getYs().reduce((t,e)=>t<e?t:e),r=s.y-((this.textLine+1)*o+s.y-a)+3,h=s.y-((this.textLine+1)*o+s.y-a)-1,c=(t,i,s,n)=>{const o=t+s,a=i;this.applyStyle(e,this.styleLine),e.beginPath(),e.moveTo(t,i),e.quadraticCurveTo(o,a,t+s,n),e.stroke()},l=(t,i,s,n)=>{this.applyStyle(e,this.styleLine),e.beginPath(),e.moveTo(t,n),e.quadraticCurveTo(t+s,n,t+s,i),e.stroke()},d=(t,i,s)=>{const n=i+4*s;e.beginPath(),e.moveTo(t,i),e.lineTo(t-4,n),e.lineTo(t+4,n),e.closePath(),e.fill()},u=(t,i)=>{e.setFont(this.fontInfo);const s=t-e.measureText(i).width/2;e.fillText(i,s,h)};let g,m=0,f=0;if(null===(t=this.tap)||void 0===t?void 0:t.length){u(i.getModifierStartXY(W.Position.CENTER,this.index).x,this.tap)}for(let t=0;t<this.phrase.length;++t){const e=this.phrase[t];e.drawWidth||(e.drawWidth=0),0===t&&(e.drawWidth+=n),f=e.drawWidth+m-(1===t?n:0),e.type===Ot.UP&&(g&&g.type===Ot.UP&&d(s.x,r,1),c(s.x,s.y,f,r)),e.type===Ot.DOWN&&(g&&g.type===Ot.UP&&l(s.x,s.y,f,r),g&&g.type===Ot.DOWN&&(d(s.x,s.y,-1),l(s.x,s.y,f,r)),g||(f=e.drawWidth,l(s.x,s.y,f,r))),u(s.x+f,e.text),g=e,m=e.drawWidth,g.x=s.x,s.x+=f}if(!g||void 0===g.x)throw new p("NoLastBendForBend","Internal error.");g.type===Ot.UP?d(g.x+f,r,1):g.type===Ot.DOWN&&d(g.x+f,s.y,-1)}}function Rt(t){if(!t)return!1;const e=m();return"function"==typeof e.HTMLCanvasElement&&t instanceof e.HTMLCanvasElement||"function"==typeof t.getContext&&"function"==typeof t.toDataURL}class Pt extends wt{static get WIDTH(){return 600}static get HEIGHT(){return 400}static get CANVAS_BROWSER_SIZE_LIMIT(){return 32767}static sanitizeCanvasDims(t,e){const i=this.CANVAS_BROWSER_SIZE_LIMIT;return Math.max(t,e)>i&&(!function(...t){const e=t.join(" "),i=new Error;m().console.log("Warning: ",e,i.stack)}("Canvas dimensions exceed browser limit. Cropping to "+i),t>i&&(t=i),e>i&&(e=i)),[t,e]}constructor(t){super(),this.textHeight=0,this.context2D=t,this.curTransfrom=t.getTransform(),t.canvas?this.canvas=t.canvas:this.canvas={width:Pt.WIDTH,height:Pt.HEIGHT}}clear(){this.context2D.clearRect(0,0,this.canvas.width,this.canvas.height)}openGroup(t,e){}closeGroup(){}openRotation(t,e,i){this.curTransfrom=this.context2D.getTransform(),this.context2D.translate(e,i),this.context2D.rotate(t*Math.PI/180),this.context2D.translate(-e,-i)}closeRotation(){this.context2D.setTransform(this.curTransfrom)}add(t){}setFillStyle(t){return this.context2D.fillStyle=t,this}setBackgroundFillStyle(t){return this}setStrokeStyle(t){return this.context2D.strokeStyle=t,this}setShadowColor(t){return this.context2D.shadowColor=t,this}setShadowBlur(t){const e=this.context2D.getTransform(),i=Math.sqrt(e.a*e.a+e.b*e.b+e.c*e.c+e.d*e.d);return this.context2D.shadowBlur=i*t,this}setLineWidth(t){return this.context2D.lineWidth=t,this}setLineCap(t){return this.context2D.lineCap=t,this}setLineDash(t){return this.context2D.setLineDash(t),this}scale(t,e){return this.context2D.scale(t,e),this}resize(t,e,i){var s;const n=this.context2D.canvas,o=null!==(s=null!=i?i:m().devicePixelRatio)&&void 0!==s?s:1;return[t,e]=Pt.sanitizeCanvasDims(t*o,e*o),t=t/o|0,e=e/o|0,n.width=t*o,n.height=e*o,Rt(n)&&(n.style.width=t+"px",n.style.height=e+"px"),this.scale(o,o)}rect(t,e,i,s){return this.context2D.rect(t,e,i,s),this}fillRect(t,e,i,s){return this.context2D.fillRect(t,e,i,s),this}pointerRect(t,e,i,s){return this}clearRect(t,e,i,s){return this.context2D.clearRect(t,e,i,s),this}beginPath(){return this.context2D.beginPath(),this}moveTo(t,e){return this.context2D.moveTo(t,e),this}lineTo(t,e){return this.context2D.lineTo(t,e),this}bezierCurveTo(t,e,i,s,n,o){return this.context2D.bezierCurveTo(t,e,i,s,n,o),this}quadraticCurveTo(t,e,i,s){return this.context2D.quadraticCurveTo(t,e,i,s),this}arc(t,e,i,s,n,o){return this.context2D.arc(t,e,i,s,n,o),this}fill(){return this.context2D.fill(),this}stroke(){return this.context2D.stroke(),this}closePath(){return this.context2D.closePath(),this}measureText(t){const e=this.context2D.measureText(t);let i=0,s=0;return e.fontBoundingBoxAscent?(i=-e.fontBoundingBoxAscent,s=e.fontBoundingBoxDescent+e.fontBoundingBoxAscent):(i=-e.actualBoundingBoxAscent,s=e.actualBoundingBoxDescent+e.actualBoundingBoxAscent),{x:0,y:i,width:e.width,height:s}}fillText(t,e,i){return this.context2D.fillText(t,e,i),this}save(){return this.context2D.save(),this}restore(){return this.context2D.restore(),this}set fillStyle(t){this.context2D.fillStyle=t}get fillStyle(){return this.context2D.fillStyle}set strokeStyle(t){this.context2D.strokeStyle=t}get strokeStyle(){return this.context2D.strokeStyle}setFont(t,e,i,s){const n=A.validate(t,e,i,s);return this.context2D.font=A.toCSSString(n),this.textHeight=A.convertSizeToPixelValue(n.size),this}getFont(){return this.context2D.font}}function Mt(t,e){return[I.csymDiminished,I.csymHalfDiminished,I.csymMajorSeventh].flatMap(i=>[{left:"A",right:i,position:"superscript",adjustmentEm:t},{left:"F",right:i,position:"subscript",adjustmentEm:e}])}const It=[{textFont:"Academico",musicFont:"Bravura",pairs:Mt(-.18,-.12)},{textFont:"Petaluma Script",musicFont:"Petaluma",pairs:Mt(-.12,-.08)}];function Wt(t){return void 0===t||""===t||"normal"===t?"400":String(t)}function Ht(t){return/[\uE870-\uE87F\uED60-\uED67\uE260-\uE26F]/u.test(t)}function Gt(t){const e=[];for(const i of t){const t=Ht(i),s=e[e.length-1];(null==s?void 0:s.music)===t?s.text+=i:e.push({text:i,music:t})}return e}function Ut(t,e,i,s){var n,o;const a=Array.from(e).slice(-1)[0],r=Array.from(i)[0];return null!==(o=null===(n=t.pairs.find(t=>t.left===a&&t.right===r&&t.position===s))||void 0===n?void 0:n.adjustmentEm)&&void 0!==o?o:0}function Vt(t,e,i,s,n){var o,a;const r=A.convertSizeToPixelValue(null!==(o=e.size)&&void 0!==o?o:12),h=[];let c,l=0,d="";for(const o of function(t){const e=[];for(const i of t){if(!i.text)continue;const t=e[e.length-1];(null==t?void 0:t.position)===i.position?t.text+=i.text:e.push(Object.assign({},i))}return e}(t)){const t="baseline"!==o.position,u=t&&c&&c.position!==o.position;let g=u?c.x:l;!u&&h.length&&(g+=s.spacing*r+Ut(i,d,o.text,o.position)*r);const p=g,m="superscript"===o.position?s.superscript*r:"subscript"===o.position?s.subscript*r:0;let f="";for(const c of Gt(o.text)){f&&(g+=Ut(i,f,c.text,o.position)*r);const l=Object.assign(Object.assign({},e),{family:c.music?i.musicFont:i.textFont,size:t?A.scaleSize(null!==(a=e.size)&&void 0!==a?a:12,s.ratio):e.size}),d=n(c.text,l);h.push({text:c.text,position:o.position,font:l,x:g,y:m,metrics:d}),g+=d.width,f=c.text}l=u?Math.max(c.end,g):g,c=t&&!u?{position:o.position,x:p,end:l}:void 0,d=o.text}const u=Math.min(0,...h.map(t=>t.x-t.metrics.actualBoundingBoxLeft)),g=Math.max(l,...h.map(t=>t.x+t.metrics.actualBoundingBoxRight));for(const t of h)t.x-=u;return{runs:h,width:g-u}}function Xt(...t){Kt.DEBUG&&S("VexFlow.ChordSymbol",t)}class Yt extends P{constructor(t,e,i,s,n){super(),this.text=t,this.symbolModifier=e,this.xShift=i,this.yShift=s,this.vAlign=n}isSuperscript(){return this.symbolModifier===jt.SUPERSCRIPT}isSubscript(){return this.symbolModifier===jt.SUBSCRIPT}}var _t,zt,jt,qt;!function(t){t[t.LEFT=1]="LEFT",t[t.CENTER=2]="CENTER",t[t.RIGHT=3]="RIGHT",t[t.CENTER_STEM=4]="CENTER_STEM"}(_t||(_t={})),function(t){t[t.TOP=1]="TOP",t[t.BOTTOM=2]="BOTTOM"}(zt||(zt={})),function(t){t[t.NONE=1]="NONE",t[t.SUBSCRIPT=2]="SUBSCRIPT",t[t.SUPERSCRIPT=3]="SUPERSCRIPT"}(jt||(jt={}));class Kt extends W{static get CATEGORY(){return"ChordSymbol"}static get superSubRatio(){return B.get("ChordSymbol.superSubRatio")}static get spacingBetweenBlocks(){return B.get("ChordSymbol.spacing")}static get superscriptOffset(){return B.get("ChordSymbol.superscriptOffset")}static get subscriptOffset(){return B.get("ChordSymbol.subscriptOffset")}static get minPadding(){return B.get("NoteHead.minPadding")}static format(t,e){if(!t||0===t.length)return!1;let i=0,s=0,n=0,o=0,a=0;for(const r of t){const t=r.checkAttachedNote();let h=1;const c=r.formatKerning();if(void 0!==c)i=c,r.symbolBlocks.some(t=>t.isSuperscript()||t.isSubscript())&&(h=2);else for(let t=0;t<r.symbolBlocks.length;++t){const e=r.symbolBlocks[t],s=e.isSuperscript(),n=e.isSubscript();if(e.setXShift(i),(s||n)&&(h=2),n&&t>0){const s=r.symbolBlocks[t-1];s.isSuperscript()&&(e.setXShift(i-s.getWidth()-Kt.minPadding),e.vAlign=!0,i+=-s.getWidth()-Kt.minPadding+(s.getWidth()>e.getWidth()?s.getWidth()-e.getWidth():0))}i+=e.getWidth()+Kt.minPadding}if(r.getVertical()===zt.TOP?(r.setTextLine(e.topTextLine),e.topTextLine+=h):(r.setTextLine(e.textLine+1),e.textLine+=h+1),r.getReportWidth()&&it(t)){const e=t.getGlyphWidth();r.getHorizontal()===_t.RIGHT?(o=Math.max(e,o),s=Math.max(s,i)+Kt.minPadding):r.getHorizontal()===_t.LEFT?(a=Math.max(e,a),n=Math.max(n,i)):(s=Math.max(s,i/2)+Kt.minPadding,n=Math.max(n,i/2),o=Math.max(e/2,o),a=Math.max(e/2,a))}(r.getReportWidth()||r.kernedRuns)&&(r.width=i),i=0}const r=Math.min(Math.max(n-a,0),Math.max(n-e.rightShift,0)),h=Math.min(Math.max(s-o,0),Math.max(s-e.leftShift,0));return e.leftShift+=h,e.rightShift+=r,!0}setKerning(t){if("auto"!==t&&"none"!==t)throw new p("BadArgument","Kerning must be auto or none.");return this.kerning=t,this.kernedRuns=void 0,this}getKerning(){return this.kerning}setKerningProfile(t){if(t&&(!t.textFont.trim()||!t.musicFont.trim()||t.pairs.some(t=>1!==Array.from(t.left).length||1!==Array.from(t.right).length||!["baseline","superscript","subscript"].includes(t.position)||!Number.isFinite(t.adjustmentEm))))throw new p("BadArgument","Invalid chord kerning profile.");return this.kerningProfile=t&&Object.assign(Object.assign({},t),{pairs:t.pairs.map(t=>Object.assign({},t))}),this.kernedRuns=void 0,this}formatKerning(){var t;if(this.kernedRuns=void 0,"none"===this.kerning)return;const e=function(t,e){var i;const s=(null!==(i=t.family)&&void 0!==i?i:"").split(",").map(t=>t.trim().replace(/^['"]|['"]$/g,""));return(e?[e]:It).find(e=>s[0]===e.textFont&&s[1]===e.musicFont&&Wt(t.weight)===Wt(e.weight)&&(t.style||"normal")===(e.style||"normal"))}(this.fontInfo,this.kerningProfile);if(!e)return;const i=null!==(t=this.kerningMeasurement)&&void 0!==t?t:this.kerningMeasurement=new P,s=Vt(this.symbolBlocks.map(t=>({text:t.getText(),position:t.isSuperscript()?"superscript":t.isSubscript()?"subscript":"baseline"})),this.fontInfo,e,{spacing:Kt.spacingBetweenBlocks,ratio:Kt.superSubRatio,superscript:Kt.superscriptOffset,subscript:Kt.subscriptOffset},(t,e)=>i.setText(t).setFont(e).measureText());return this.kernedRuns=s.runs,s.width}constructor(){super(),this.symbolBlocks=[],this.horizontal=_t.LEFT,this.vertical=zt.TOP,this.reportWidth=!0,this.kerning="none",this.kerningOrigin={x:0,y:0}}get superscriptOffset(){return Kt.superscriptOffset*A.convertSizeToPixelValue(this.fontInfo.size)}get subscriptOffset(){return Kt.subscriptOffset*A.convertSizeToPixelValue(this.fontInfo.size)}setReportWidth(t){return this.reportWidth=t,this}getReportWidth(){return this.reportWidth}getSymbolBlock(t={}){var e,i;const s=new Yt(null!==(e=t.text)&&void 0!==e?e:"",null!==(i=t.symbolModifier)&&void 0!==i?i:jt.NONE,0,0,!1);if(s.isSubscript()&&s.setYShift(this.subscriptOffset),s.isSuperscript()&&s.setYShift(this.superscriptOffset),s.isSubscript()||s.isSuperscript()){const{family:t,size:e,weight:i,style:n}=this.fontInfo,o=A.scaleSize(e,Kt.superSubRatio);s.setFont(t,o,i,n)}else s.setFont(this.fontInfo);return s}addSymbolBlock(t){return this.symbolBlocks.push(this.getSymbolBlock(t)),this}addText(t,e={}){return this.addSymbolBlock(Object.assign(Object.assign({},e),{text:t}))}addTextSuperscript(t){const e=jt.SUPERSCRIPT;return this.addSymbolBlock({text:t,symbolModifier:e})}addTextSubscript(t){const e=jt.SUBSCRIPT;return this.addSymbolBlock({text:t,symbolModifier:e})}addGlyphSuperscript(t){return this.addTextSuperscript(Kt.glyphs[t])}addGlyph(t,e={}){return this.addText(Kt.glyphs[t],e)}addGlyphOrText(t,e={}){let i="";for(let e=0;e<t.length;++e){const s=t[e],n=Kt.glyphs[s];i+=n||s}return i.length>0&&this.addText(i,e),this}addLine(t={}){return this.addText("",t)}setVertical(t){return this.vertical="string"==typeof t?Kt.VerticalJustifyString[t]:t,this}getVertical(){return this.vertical}setHorizontal(t){return this.horizontal="string"==typeof t?Kt.HorizontalJustifyString[t]:t,this}getHorizontal(){return this.horizontal}draw(){const t=this.checkContext(),e=this.checkAttachedNote();this.setRendered();const i=this.getAttribute("class");t.openGroup("chordsymbol"+(i?" "+i:""),this.getAttribute("id"));const s=e.getModifierStartXY(W.Position.ABOVE,this.index);let n;t.setFont(this.fontInfo);const o=e.hasStem(),a=e.checkStave();if(this.vertical===zt.BOTTOM){if(n=a.getYForBottomText(this.textLine+K.TEXT_HEIGHT_OFFSET_HACK),o){const t=e.checkStem().getExtents(),i=a.getSpacingBetweenLines(),s=1===e.getStemDirection()?t.baseY:t.topY;n=Math.max(n,s+i*(this.textLine+2))}}else{const t=Math.min(...e.getYs());if(n=Math.min(a.getYForTopText(this.textLine),t-10),o){const t=e.checkStem().getExtents(),i=a.getSpacingBetweenLines();n=Math.min(n,t.topY-5-i*this.textLine)}}let r=s.x;if(r=this.horizontal===_t.LEFT?s.x:this.horizontal===_t.RIGHT?this.kernedRuns?s.x-this.getWidth():s.x+this.getWidth():this.horizontal===_t.CENTER?s.x-this.getWidth()/2:e.getStemX()-this.getWidth()/2,Xt("Rendering ChordSymbol: ",r,n),this.kernedRuns){this.kerningOrigin={x:r,y:n};for(const e of this.kernedRuns)t.setFont(e.font),t.fillText(e.text,r+e.x,n+e.y)}else this.symbolBlocks.forEach(e=>{Xt("Rendering Text: ",e.getText(),r+e.getXShift(),n+e.getYShift()),e.setX(r),e.setY(n),e.renderText(t,0,0)});this.drawPointerRect(),t.closeGroup()}getBoundingBox(){if(this.kernedRuns){const{x:t,y:e}=this.kerningOrigin;let i;for(const s of this.kernedRuns){const n=s.metrics,o=new D(t+s.x-n.actualBoundingBoxLeft,e+s.y-n.actualBoundingBoxAscent,n.actualBoundingBoxLeft+n.actualBoundingBoxRight,n.actualBoundingBoxAscent+n.actualBoundingBoxDescent);i?i.mergeWith(o):i=o}return null!=i?i:new D(t,e,0,0)}if(!this.symbolBlocks.length)return new D(0,0,0,0);const t=D.copy(this.symbolBlocks[0].getBoundingBox());for(let e=1;e<this.symbolBlocks.length;e++)t.mergeWith(this.symbolBlocks[e].getBoundingBox());return t}}Kt.DEBUG=!1,Kt.HorizontalJustify=_t,Kt.HorizontalJustifyString={left:_t.LEFT,right:_t.RIGHT,center:_t.CENTER,centerStem:_t.CENTER_STEM},Kt.VerticalJustify=zt,Kt.VerticalJustifyString={top:zt.TOP,above:zt.TOP,below:zt.BOTTOM,bottom:zt.BOTTOM},Kt.glyphs={diminished:I.csymDiminished,dim:I.csymDiminished,halfDiminished:I.csymHalfDiminished,"+":I.csymAugmented,augmented:I.csymAugmented,majorSeventh:I.csymMajorSeventh,minor:I.csymMinor,"-":I.csymMinor,"(":"(",leftParen:"(",")":")",rightParen:")",leftBracket:I.csymBracketLeftTall,rightBracket:I.csymBracketRightTall,leftParenTall:"(",rightParenTall:")","/":I.csymDiagonalArrangementSlash,over:I.csymDiagonalArrangementSlash,"#":I.csymAccidentalSharp,b:I.csymAccidentalFlat},Kt.symbolModifiers=jt;class $t extends Ct{static get CATEGORY(){return"Clef"}static get types(){const{gClef:t,fClef:e,cClef:i,unpitchedPercussionClef1:s,sixStringTabClef:n}=I;return{treble:{code:t,line:3},bass:{code:e,line:1},alto:{code:i,line:2},tenor:{code:i,line:1},percussion:{code:s,line:2},soprano:{code:i,line:4},"mezzo-soprano":{code:i,line:3},"baritone-c":{code:i,line:0},"baritone-f":{code:e,line:2},subbass:{code:e,line:0},french:{code:t,line:4},tab:{code:n,line:2.5}}}constructor(t,e,i){super(),this.code=$t.types.treble.code,this.line=$t.types.treble.line,this.size="default",this.type="treble",this.setPosition(kt.BEGIN),this.setType(t,e,i),function(...t){$t.DEBUG&&S("VexFlow.Clef",t)}("Creating clef:",t)}setType(t,e="default",i){return this.type=t,this.code=$t.types[t].code,this.line=$t.types[t].line,this.size=null!=e?e:"default","8va"===i&&(this.code===I.gClef&&(this.code=I.gClef8va),this.code===I.fClef&&(this.code=I.fClef8va)),"8vb"===i&&(this.code===I.gClef&&(this.code=I.gClef8vb),this.code===I.fClef&&(this.code=I.fClef8vb)),this.text=this.code,this.fontInfo.size=Math.floor($t.getPoint(this.size)),this}static getPoint(t){return"default"===t?B.get("fontSize"):2*B.get("fontSize")/3}setStave(t){return this.stave=t,this}draw(){const t=this.checkStave(),e=t.checkContext();this.setRendered();const i=this.getAttribute("class");e.openGroup("clef"+(i?" "+i:""),this.getAttribute("id")),this.y=t.getYForLine(this.line),this.renderText(e,0,0),this.drawPointerRect(),e.closeGroup()}}$t.DEBUG=!1;class Qt extends yt{static get CATEGORY(){return"ClefNote"}constructor(t,e="default",i){super({duration:"b"}),this.setType(t,e,i),this.ignoreTicks=!0}setType(t,e,i){return this.clef=new $t(t,e,i),this.setWidth(this.clef.getWidth()),this}getClef(){return this.clef}preFormat(){return this.preFormatted=!0,this}draw(){const t=this.checkStave(),e=this.checkContext();this.setRendered(),this.clef.setX(this.getAbsoluteX()),this.clef.setY(t.getYForLine(this.clef.line)),this.clef.renderText(e,0,0)}getBoundingBox(){return this.clef.getBoundingBox()}}class Jt{static getNextContext(t){const e=t.tContexts,i=e.indexOf(t);if(i+1<e.length)return e[i+1]}constructor(t){var e;this.preFormatted=!1,this.postFormatted=!1,this.tickID=null!==(e=null==t?void 0:t.tickID)&&void 0!==e?e:0,this.currentTick=new y(0,1),this.maxTicks=new y(0,1),this.maxTickable=void 0,this.minTicks=void 0,this.minTickable=void 0,this.padding=1,this.x=0,this.xBase=0,this.xOffset=0,this.tickables=[],this.tickablesByVoice={},this.notePx=0,this.glyphPx=0,this.leftDisplacedHeadPx=0,this.rightDisplacedHeadPx=0,this.modLeftPx=0,this.modRightPx=0,this.totalLeftPx=0,this.totalRightPx=0,this.tContexts=[],this.width=0,this.formatterMetrics={freedom:{left:0,right:0}}}getTickID(){return this.tickID}getX(){return this.x}setX(t){return this.x=t,this.xBase=t,this.xOffset=0,this}getXBase(){return this.xBase}setXBase(t){this.xBase=t,this.x=t+this.xOffset}getXOffset(){return this.xOffset}setXOffset(t){this.xOffset=t,this.x=this.xBase+t}getWidth(){return this.width+2*this.padding}setPadding(t){return this.padding=t,this}getMaxTicks(){return this.maxTicks}getMinTicks(){return this.minTicks}getMaxTickable(){return this.maxTickable}getMinTickable(){return this.minTickable}getTickables(){return this.tickables}getTickableForVoice(t){return this.tickablesByVoice[t]}getTickablesByVoice(){return this.tickablesByVoice}getCenterAlignedTickables(){return this.tickables.filter(t=>t.isCenterAligned())}getMetrics(){const{width:t,glyphPx:e,notePx:i,leftDisplacedHeadPx:s,rightDisplacedHeadPx:n,modLeftPx:o,modRightPx:a,totalLeftPx:r,totalRightPx:h}=this;return{width:t,glyphPx:e,notePx:i,leftDisplacedHeadPx:s,rightDisplacedHeadPx:n,modLeftPx:o,modRightPx:a,totalLeftPx:r,totalRightPx:h}}getCurrentTick(){return this.currentTick}setCurrentTick(t){this.currentTick=t,this.preFormatted=!1}addTickable(t,e){if(!t)throw new p("BadArgument","Invalid tickable added.");if(!t.shouldIgnoreTicks()){const e=t.getTicks();e.greaterThan(this.maxTicks)&&(this.maxTicks=e.clone(),this.maxTickable=t),(void 0===this.minTicks||e.lessThan(this.minTicks))&&(this.minTicks=e.clone(),this.minTickable=t)}return t.setTickContext(this),this.tickables.push(t),this.tickablesByVoice[null!=e?e:0]=t,this.preFormatted=!1,this}preFormat(){var t;if(this.preFormatted)return this;for(let e=0;e<this.tickables.length;++e){const i=this.tickables[e];i.preFormat();const s=i.getMetrics();this.leftDisplacedHeadPx=Math.max(this.leftDisplacedHeadPx,s.leftDisplacedHeadPx),this.rightDisplacedHeadPx=Math.max(this.rightDisplacedHeadPx,s.rightDisplacedHeadPx),this.notePx=Math.max(this.notePx,s.notePx),this.glyphPx=Math.max(this.glyphPx,null!==(t=s.glyphWidth)&&void 0!==t?t:0),this.modLeftPx=Math.max(this.modLeftPx,s.modLeftPx),this.modRightPx=Math.max(this.modRightPx,s.modRightPx),this.totalLeftPx=Math.max(this.totalLeftPx,s.modLeftPx+s.leftDisplacedHeadPx),this.totalRightPx=Math.max(this.totalRightPx,s.modRightPx+s.rightDisplacedHeadPx),this.width=this.notePx+this.totalLeftPx+this.totalRightPx}return this}postFormat(){return this.postFormatted||(this.postFormatted=!0),this}getFormatterMetrics(){return this.formatterMetrics}move(t,e,i){this.setX(this.getX()+t),this.getFormatterMetrics().freedom.left+=t,this.getFormatterMetrics().freedom.right-=t,e&&(e.getFormatterMetrics().freedom.right+=t),i&&(i.getFormatterMetrics().freedom.left-=t)}getDeviationCost(){return b(this.tickables.map(t=>t.getFormatterMetrics().space.deviation))}getAverageDeviationCost(){return this.tickables.length?this.getDeviationCost()/this.tickables.length:0}}class Zt extends yt{static get CATEGORY(){return"Crescendo"}constructor(t){var e;super(t),this.options={extendLeft:0,extendRight:0,yShift:0},this.decrescendo=!1,this.line=null!==(e=t.line)&&void 0!==e?e:0,this.height=15}setLine(t){return this.line=t,this}setHeight(t){return this.height=t,this}setDecrescendo(t){return this.decrescendo=t,this}preFormat(){return this.preFormatted=!0,this}draw(){const t=this.checkContext(),e=this.checkStave();this.setRendered();const i=this.getTickContext(),s=Jt.getNextContext(i),n=this.getAbsoluteX(),o=s?s.getX():e.getX()+e.getWidth(),a=e.getYForLine(this.line+-3)+1;!function(...t){Zt.DEBUG&&S("VexFlow.Crescendo",t)}("Drawing ",this.decrescendo?"decrescendo ":"crescendo ",this.height,"x",n-o),function(t,e){const i=e.beginX,s=e.endX,n=e.y,o=e.height/2;t.beginPath(),e.reverse?(t.moveTo(i,n-o),t.lineTo(s,n),t.lineTo(i,n+o)):(t.moveTo(s,n-o),t.lineTo(i,n),t.lineTo(s,n+o)),t.stroke(),t.closePath()}(t,{beginX:n-this.options.extendLeft,endX:o+this.options.extendRight,y:a+this.options.yShift,height:this.height,reverse:this.decrescendo})}}function te(t,e,i,s){const n=[t,s],o=3*e-t-3*i+s,a=2*(t-2*e+i),r=e-t,h=[];if(Math.abs(o)<1e-12)Math.abs(a)>1e-12&&h.push(-r/a);else{const t=a*a-4*o*r;if(t>=0){const e=Math.sqrt(t);h.push((-a+e)/(2*o),(-a-e)/(2*o))}}for(const o of h)if(o>0&&o<1){const a=1-o;n.push(a*a*a*t+3*a*a*o*e+3*a*o*o*i+o*o*o*s)}return n}Zt.DEBUG=!1,function(t){t[t.NEAR_HEAD=1]="NEAR_HEAD",t[t.NEAR_TOP=2]="NEAR_TOP"}(qt||(qt={}));class ee extends P{static get CATEGORY(){return"Curve"}static get Position(){return qt}static get PositionString(){return{nearHead:qt.NEAR_HEAD,nearTop:qt.NEAR_TOP}}constructor(t,e,i){super(),this.renderOptions=Object.assign({thickness:2,xShift:0,yShift:10,position:qt.NEAR_HEAD,positionEnd:qt.NEAR_HEAD,invert:!1,cps:[{x:0,y:10},{x:0,y:10}],openingDirection:"auto"},i),this.setNotes(t,e)}setNotes(t,e){if(!t&&!e)throw new p("BadArguments","Curve needs to have either `from` or `to` set.");return this.from=t,this.to=e,this}isPartial(){return!this.from||!this.to}getBezierPoints(t){const e=this.renderOptions.xShift,i=this.renderOptions.yShift*t.direction,s=t.firstX+e,n=t.firstY+i,o=t.lastX-e,a=t.lastY+i,r=this.renderOptions.thickness,h=this.renderOptions.cps,{x:c,y:l}=h[0],{x:d,y:u}=h[1],g=(o-s)/(h.length+2);return{first:{x:s,y:n},last:{x:o,y:a},cps:[{x:s+g+c,y:n+l*t.direction},{x:o-g+d,y:a+u*t.direction}],thicknessCps:[{x:o-g+d,y:a+(u+r)*t.direction},{x:s+g+c,y:n+(l+r)*t.direction}]}}renderCurve(t){var e,i;const s=this.checkContext(),{first:n,last:o,cps:a,thicknessCps:r}=this.getBezierPoints(t);s.beginPath(),s.moveTo(n.x,n.y),s.bezierCurveTo(a[0].x,a[0].y,a[1].x,a[1].y,o.x,o.y),(null===(e=this.style)||void 0===e?void 0:e.lineDash)||s.bezierCurveTo(r[0].x,r[0].y,r[1].x,r[1].y,n.x,n.y),s.stroke(),s.closePath(),(null===(i=this.style)||void 0===i?void 0:i.lineDash)||s.fill()}getRenderParams(){const t=this.from,e=this.to;let i,s,n,o,a=0,r="baseY",h="baseY";function c(t){return"string"==typeof t?ee.PositionString[t]:t}const l=c(this.renderOptions.position),d=c(this.renderOptions.positionEnd);if(l===qt.NEAR_TOP&&(r="topY",h="topY"),d===qt.NEAR_HEAD?h="baseY":d===qt.NEAR_TOP&&(h="topY"),t)i=t.getTieRightX(),a=t.getStemDirection(),n=t.getStemExtents()[r];else{i=e.checkStave().getTieStartX(),n=e.getStemExtents()[r]}if(e)s=e.getTieLeftX(),a=e.getStemDirection(),o=e.getStemExtents()[h];else{s=t.checkStave().getTieEndX(),o=t.getStemExtents()[h]}return"up"===this.renderOptions.openingDirection&&(a=1),"down"===this.renderOptions.openingDirection&&(a=-1),{firstX:i,lastX:s,firstY:n,lastY:o,direction:a*(!0===this.renderOptions.invert?-1:1)}}getBoundingBox(){var t;const{first:e,last:i,cps:s,thicknessCps:n}=this.getBezierPoints(this.getRenderParams()),o=te(e.x,s[0].x,s[1].x,i.x),a=te(e.y,s[0].y,s[1].y,i.y);(null===(t=this.style)||void 0===t?void 0:t.lineDash)||(o.push(...te(i.x,n[0].x,n[1].x,e.x)),a.push(...te(i.y,n[0].y,n[1].y,e.y)));const r=Math.min(...o),h=Math.min(...a);return new D(r,h,Math.max(...o)-r,Math.max(...a)-h)}draw(){return this.checkContext(),this.setRendered(),this.renderCurve(this.getRenderParams()),!0}}class ie extends W{static get CATEGORY(){return"Dot"}static getDots(t){return t.getModifiersByType(ie.CATEGORY)}static buildAndAttach(t,e){for(const i of t)if(null==e?void 0:e.all)for(let t=0;t<i.keys.length;t++){const e=new ie;i.addModifier(e,t)}else if(void 0!==(null==e?void 0:e.index)){const t=new ie;i.addModifier(t,null==e?void 0:e.index)}else{const t=new ie;i.addModifier(t,0)}}static format(t,e){const i=e.rightShift;if(!t||0===t.length)return!1;const s=[],n={};for(let e=0;e<t.length;++e){const o=t[e],a=o.getNote();let r,h;if(et(a)){const t=o.checkIndex();r=a.getKeyProps()[t],h=a.getFirstDotPx()}else{if(!st(a))throw new p("Internal","Unexpected instance.");r={line:.5},h=i}const c=a.getAttribute("id");s.push({line:r.line,note:a,noteId:c,dot:o}),n[c]=Math.max(n[c]||h,h)}s.sort((t,e)=>e.line-t.line);let o=i,a=0,r=null,h=null,c=null,l=0;for(let t=0;t<s.length;++t){const{dot:e,note:i,noteId:d,line:u}=s[t];u===r&&i===h||(o=n[d]),i.isRest()||u===r||(.5===Math.abs(u%1)?l=0:(l=.5,null===h||h.isRest()||null===r||r-u!==.5?u+l===c&&(l=-.5):l=-.5)),i.isRest()?e.dotShiftY+=-l:e.dotShiftY=-l,c=u+l,e.setXShift(o),o+=e.getWidth()+1,a=o>a?o:a,r=u,h=i}return e.rightShift+=a,!0}constructor(){super(),this.position=W.Position.RIGHT,this.setText(I.augmentationDot),this.dotShiftY=0}setNote(t){return this.note=t,this.font=t.font,this}setDotShiftY(t){return this.dotShiftY=t,this}draw(){const t=this.checkContext(),e=this.checkAttachedNote();this.setRendered();const i=e.checkStave().getSpacingBetweenLines(),s=e.getModifierStartXY(this.position,this.index,{forceFlagRight:!0});st(e)&&(s.y=e.getStemExtents().baseY),this.x=s.x,this.y=s.y+this.dotShiftY*i,this.renderText(t,0,0)}}class se extends W{static get CATEGORY(){return"FretHandFinger"}static format(t,e){const{leftShift:i,rightShift:s}=e;if(!t||0===t.length)return!1;const n=[];let o=null,a=0,r=0;for(let h=0;h<t.length;++h){const c=t[h],l=c.getNote(),d=c.getPosition(),u=c.checkIndex(),g=l.getKeyProps()[u],p=B.get("FretHandFinger.fontSize");if(c.position===M.ABOVE&&(e.topTextLine+=p/K.STAVE_LINE_DISTANCE+.5),c.position===M.BELOW&&(e.textLine+=p/K.STAVE_LINE_DISTANCE+.5),l!==o){for(let t=0;t<l.keys.length;++t)0===i&&(a=Math.max(l.getLeftDisplacedHeadPx(),a)),0===s&&(r=Math.max(l.getRightDisplacedHeadPx(),r));o=l}n.push({note:l,num:c,pos:d,line:g.line,shiftL:a,shiftR:r})}n.sort((t,e)=>e.line-t.line);let h=0,c=0,l=0,d=0,u=null,g=null;for(let t=0;t<n.length;++t){let e=0;const{note:o,pos:a,num:p,line:m,shiftL:f,shiftR:S}=n[t];m===u&&o===g||(h=i+f,c=s+S);const T=p.getWidth()+1;a===W.Position.LEFT?(p.setXShift(i+h),e=i+T,l=e>l?e:l):a===W.Position.RIGHT&&(p.setXShift(c),e=r+T,d=e>d?e:d),u=m,g=o}return e.leftShift+=l,e.rightShift+=d,!0}static easyScoreHook({fingerings:t}={},e,i){null==t||t.split(",").map(t=>{const e=t.trim().split("."),s={number:e[0]};return e[1]&&(s.position=e[1]),i.getFactory().Fingering(s)}).map((t,i)=>e.addModifier(t,i))}constructor(t){super(),this.setFretHandFinger(t),this.position=W.Position.LEFT,this.xOffset=0,this.yOffset=0}setFretHandFinger(t){return this.text=t,this}getFretHandFinger(){return this.text}setOffsetX(t){return this.xOffset=t,this}setOffsetY(t){return this.yOffset=t,this}draw(){const t=this.checkContext(),e=this.checkAttachedNote();this.setRendered();const i=e.getModifierStartXY(this.position,this.index);let s=i.x+this.xOffset,n=i.y+this.yOffset+5;switch(this.position){case W.Position.ABOVE:s-=4,n-=12;break;case W.Position.BELOW:s-=2,n+=10;break;case W.Position.LEFT:s-=this.width;break;case W.Position.RIGHT:s+=1;break;default:throw new p("InvalidPosition",`The position ${this.position} does not exist`)}this.renderText(t,s,n)}}function ne(...t){ae.DEBUG&&S("VexFlow.Parser",t)}function oe(t){if("matchedString"in t)return t.matchedString;if("results"in t)return oe(t.results);const e=t;return 1===e.length?oe(e[0]):0===e.length?null:e.map(oe)}class ae{constructor(t){this.grammar=t,this.line="",this.pos=0,this.errorPos=-1}parse(t){this.line=t,this.pos=0,this.errorPos=-1;const e=this.expect(this.grammar.begin());return e.errorPos=this.errorPos,e}matchFail(t){-1===this.errorPos&&(this.errorPos=this.pos),this.pos=t}matchSuccess(){this.errorPos=-1}matchToken(t,e=!1){const i=e?new RegExp("^(("+t+"))"):new RegExp("^(("+t+")\\s*)"),s=this.line.slice(this.pos).match(i);return null!==s?{success:!0,matchedString:s[2],incrementPos:s[1].length,pos:this.pos}:{success:!1,pos:this.pos}}expectOne(t,e=!1){const i=[],s=this.pos;let n=!0,o=!1;if(e=!0===e||!0===t.maybe,t.expect)for(const e of t.expect){const s=this.pos,a=this.expect(e);if(a.success){if(i.push(a),o=!0,t.or)break}else if(n=!1,!t.or){this.pos=s;break}}const a=t.or&&o||n,r=a||!0===e,h=a?1:0;return e&&!a&&(this.pos=s),r?this.matchSuccess():this.matchFail(s),{success:r,results:i,numMatches:h}}expectOneOrMore(t,e=!1){const i=[],s=this.pos;let n=0,o=!0;do{const e=this.expectOne(t);e.success&&e.results?(n++,i.push(e.results)):o=!1}while(o);const a=n>0||!0===e;return!e||n>0||(this.pos=s),a?this.matchSuccess():this.matchFail(s),{success:a,results:i,numMatches:n}}expectZeroOrMore(t){return this.expectOneOrMore(t,!0)}expect(t){if(ne("Evaluating rule function:",t),!t)throw new p("Invalid rule function");let e;const i=t.bind(this.grammar)();if(i.token)e=this.matchToken(i.token,!0===i.noSpace),e.success&&(this.pos+=e.incrementPos);else{if(!i.expect)throw ne(i),new p("Bad grammar! No `token` or `expect` property "+i);e=i.oneOrMore?this.expectOneOrMore(i):i.zeroOrMore?this.expectZeroOrMore(i):this.expectOne(i)}const s=[];return e.matches=s,e.results&&e.results.forEach(t=>s.push(oe(t))),i.run&&e.success&&i.run({matches:s}),e}}function re(...t){pe.DEBUG&&S("VexFlow.EasyScore",t)}ae.DEBUG=!1;class he{constructor(t){this.builder=t}begin(){return this.LINE}LINE(){return{expect:[this.PIECE,this.PIECES,this.EOL]}}PIECE(){return{expect:[this.CHORDORNOTE,this.PARAMS],run:()=>this.builder.commitPiece()}}PIECES(){return{expect:[this.COMMA,this.PIECE],zeroOrMore:!0}}PARAMS(){return{expect:[this.DURATION,this.TYPE,this.DOTS,this.OPTS]}}CHORDORNOTE(){return{expect:[this.CHORD,this.SINGLENOTE],or:!0}}CHORD(){return{expect:[this.LPAREN,this.NOTES,this.RPAREN],run:t=>this.builder.addChord(t.matches[1])}}NOTES(){return{expect:[this.NOTE],oneOrMore:!0}}NOTE(){return{expect:[this.NOTENAME,this.ACCIDENTAL,this.OCTAVE]}}SINGLENOTE(){return{expect:[this.NOTENAME,this.ACCIDENTAL,this.OCTAVE],run:t=>{const e=t;this.builder.addSingleNote(e.matches[0],e.matches[1],e.matches[2])}}}ACCIDENTAL(){return{expect:[this.MICROTONES,this.ACCIDENTALS],maybe:!0,or:!0}}DOTS(){return{expect:[this.DOT],zeroOrMore:!0,run:t=>this.builder.setNoteDots(t.matches)}}TYPE(){return{expect:[this.SLASH,this.MAYBESLASH,this.TYPES],maybe:!0,run:t=>this.builder.setNoteType(t.matches[2])}}DURATION(){return{expect:[this.SLASH,this.DURATIONS],maybe:!0,run:t=>this.builder.setNoteDuration(t.matches[1])}}OPTS(){return{expect:[this.LBRACKET,this.KEYVAL,this.KEYVALS,this.RBRACKET],maybe:!0}}KEYVALS(){return{expect:[this.COMMA,this.KEYVAL],zeroOrMore:!0}}KEYVAL(){return{expect:[this.KEY,this.EQUALS,this.VAL],run:t=>this.builder.addNoteOption(t.matches[0],t.matches[2].slice(1,-1))}}VAL(){return{expect:[this.SVAL,this.DVAL],or:!0}}KEY(){return{token:"[a-zA-Z][a-zA-Z0-9]*"}}DVAL(){return{token:'["][^"]*["]'}}SVAL(){return{token:"['][^']*[']"}}NOTENAME(){return{token:"[a-gA-G]"}}OCTAVE(){return{token:"[0-9]+"}}ACCIDENTALS(){return{token:"bb|b|##|#|n"}}MICROTONES(){return{token:"bbs|bss|bs|db|d|\\+\\+-|\\+-|\\+\\+|\\+|k|o"}}DURATIONS(){return{token:"[0-9whq]+"}}TYPES(){return{token:"[rRsSmMhHgG]"}}LPAREN(){return{token:"[(]"}}RPAREN(){return{token:"[)]"}}COMMA(){return{token:"[,]"}}DOT(){return{token:"[.]"}}SLASH(){return{token:"[/]"}}MAYBESLASH(){return{token:"[/]?"}}EQUALS(){return{token:"[=]"}}LBRACKET(){return{token:"\\["}}RBRACKET(){return{token:"\\]"}}EOL(){return{token:"$"}}}class ce{constructor(t){this.chord=[],this.dots=0,this.options={},this.duration=t}}class le{constructor(t){this.commitHooks=[],this.factory=t,this.reset()}reset(t){var e;this.options=Object.assign({stem:"auto",clef:"treble"},t),this.elements={notes:[],accidentals:[]},this.rollingDuration=null!==(e=null==t?void 0:t.duration)&&void 0!==e?e:"8",this.resetPiece()}getFactory(){return this.factory}getElements(){return this.elements}addCommitHook(t){this.commitHooks.push(t)}resetPiece(){re("resetPiece"),this.piece=new ce(this.rollingDuration)}setNoteDots(t){re("setNoteDots:",t),t&&(this.piece.dots=t.length)}setNoteDuration(t){re("setNoteDuration:",t),this.rollingDuration=this.piece.duration=t||this.rollingDuration}setNoteType(t){re("setNoteType:",t),t&&(this.piece.type=t)}addNoteOption(t,e){re("addNoteOption: key:",t,"value:",e),this.piece.options[t]=e}addNote(t,e,i){re("addNote:",t,e,i),this.piece.chord.push({key:t,accid:e,octave:i})}addSingleNote(t,e,i){re("addSingleNote:",t,e,i),this.addNote(t,e,i)}addChord(t){re("startChord"),"object"!=typeof t[0]?this.addSingleNote(t[0]):t.forEach(t=>{t&&this.addNote(...t)}),re("endChord")}commitPiece(){re("commitPiece");const{factory:t}=this;if(!t)return;const e=Object.assign(Object.assign({},this.options),this.piece.options),i=f(e.stem,"BadArguments","options.stem is not defined").toLowerCase(),s=f(e.clef,"BadArguments","options.clef is not defined").toLowerCase(),{chord:n,duration:o,dots:a,type:r}=this.piece,h=H.accidentals,c=n.map(t=>{var e;return t.key+(h.includes(null!==(e=t.accid)&&void 0!==e?e:"")?t.accid:"")+"/"+t.octave}),l="auto"===i,d="g"===(null==r?void 0:r.toLowerCase())?t.GhostNote({duration:o,dots:a}):t.StaveNote({keys:c,duration:o,dots:a,type:r,clef:s,autoStem:l});l||d.setStemDirection("up"===i?at.UP:at.DOWN);const u=[];n.forEach((e,i)=>{const s=e.accid;if("string"==typeof s){const e=t.Accidental({type:s});d.addModifier(e,i),u.push(e)}else u.push(void 0)});for(let t=0;t<a;t++)ie.buildAndAttach([d],{all:!0});this.commitHooks.forEach(t=>t(e,d,this)),this.elements.notes.push(d),this.elements.accidentals.push(u),this.resetPiece()}}function de(t,e){void 0!==t.id&&e.setAttribute("id",t.id)}const ue=/\s*,\s*/;function ge(t,e){void 0!==t.class&&t.class.split(ue).forEach(t=>e.addClass(t))}class pe{constructor(t={}){this.defaults={clef:"treble",time:"4/4",stem:"auto"},this.setOptions(t)}set(t){return this.defaults=Object.assign(Object.assign({},this.defaults),t),this}setOptions(t){var e,i;const s=t.factory,n=null!==(e=t.builder)&&void 0!==e?e:new le(s);return this.options=Object.assign(Object.assign({commitHooks:[de,ge,xt.easyScoreHook,se.easyScoreHook],throwOnError:!1},t),{factory:s,builder:n}),this.factory=s,this.builder=n,this.grammar=new he(this.builder),this.parser=new ae(this.grammar),null===(i=this.options.commitHooks)||void 0===i||i.forEach(t=>this.addCommitHook(t)),this}setContext(t){return this.factory.setContext(t),this}parse(t,e={}){this.builder.reset(e);const i=this.parser.parse(t);if(!i.success&&this.options.throwOnError)throw re(i),new p("Error parsing line: "+t);return i}beam(t,e){return this.factory.Beam({notes:t,options:e}),t}tuplet(t,e){return this.factory.Tuplet({notes:t,options:e}),t}notes(t,e={}){return e=Object.assign({clef:this.defaults.clef,stem:this.defaults.stem},e),this.parse(t,e),this.builder.getElements().notes}measures(t,e={}){const i=[];let s=0,n="";for(let e=0;e<t.length;e++){const o=t[e];n?o===n&&(n=""):'"'===o||"'"===o?n=o:"|"===o&&(i.push(t.slice(s,e)),s=e+1)}i.push(t.slice(s));const o=i.map((t,e)=>{let s=t.trim();if(e>0&&(s=s.replace(/^,\s*/,"")),e<i.length-1&&(s=s.replace(/\s*,$/,"")),!s)throw new p("BadArguments","Empty EasyScore measure. Use an explicit rest.");return s});let a=e.duration;return o.map(t=>{if(!this.parse(t,Object.assign(Object.assign({clef:this.defaults.clef,stem:this.defaults.stem},e),{duration:a})).success)throw new p("BadArguments",`Invalid EasyScore measure: ${t}`);return a=this.builder.rollingDuration,this.builder.getElements().notes})}voice(t,e={}){return e=Object.assign({time:this.defaults.time},e),this.factory.Voice(e).addTickables(t)}addCommitHook(t){this.builder.addCommitHook(t)}}pe.DEBUG=!1;class me extends yt{static get CATEGORY(){return"NoteHead"}constructor(t){var e;super(t),this.customGlyph=!1,this.ledger={"":"","":""},this.index=t.index,this.x=t.x||0,this.y=t.y||0,t.noteType&&(this.noteType=t.noteType),this.displaced=t.displaced||!1,this.stemDirection=t.stemDirection||at.UP,this.line=t.line||0,this.glyphProps=yt.getGlyphProps(this.duration,this.noteType),f(this.glyphProps,"BadArguments",`No glyph found for duration '${this.duration}' and type '${this.noteType}'`),(this.line>5||this.line<0)&&this.ledger[this.glyphProps.codeHead]&&(this.glyphProps.codeHead=this.ledger[this.glyphProps.codeHead]),this.text=this.glyphProps.codeHead,t.customGlyphCode&&(this.customGlyph=!0,this.text=t.customGlyphCode),this.setStyle(null!==(e=t.style)&&void 0!==e?e:{}),this.slashed=t.slashed||!1,this.renderOptions=Object.assign({},this.renderOptions)}getWidth(){return this.width}isDisplaced(){return!0===this.displaced}getLine(){return this.line}setLine(t){return this.line=t,this}getAbsoluteX(){const t=this.preFormatted?super.getAbsoluteX():this.x,e=at.WIDTH/2;return t+(this.displaced?(this.width-e)*this.stemDirection:0)}setStave(t){const e=this.getLine();return this.stave=t,this.stave&&(this.setY(this.stave.getYForNote(e)),this.setContext(this.stave.getContext())),this}preFormat(){return this.preFormatted||(this.preFormatted=!0),this}draw(){var t;const e=this.checkContext();this.setRendered();const i=this.getAttribute("class");e.openGroup("notehead"+(i?" "+i:""),this.getAttribute("id")),function(...t){me.DEBUG&&S("VexFlow.NoteHead",t)}("Drawing note head '",this.noteType,this.duration,"' at",this.x,this.y),this.x=this.getAbsoluteX(),this.renderText(e,0,0),null===(t=this.parent)||void 0===t||t.drawModifiers(this),this.drawPointerRect(),e.closeGroup()}}me.DEBUG=!1;class fe extends P{static get CATEGORY(){return"Flag"}draw(){const t=this.checkContext();this.setRendered();const e=this.getAttribute("class");t.openGroup("flag"+(e?" "+e:""),this.getAttribute("id")),function(...t){fe.DEBUG&&S("VexFlow.Flag",t)}("Drawing flag '",this.text,"' at",this.x,this.y),this.renderText(t,0,0),this.drawPointerRect(),t.closeGroup()}}fe.DEBUG=!1;class Se extends yt{static get CATEGORY(){return"StemmableNote"}constructor(t){super(t),this.flag=new fe}getStem(){return this.stem}checkStem(){if(!this.stem)throw new p("NoStem","No stem attached to instance");return this.stem}setStem(t){return this.stem=t,this.addChild(t),this}buildStem(){const t=new at;return this.setStem(t),this}buildFlag(){var t,e,i;const{glyphProps:s}=this;if(this.hasFlag()){const n=this.getStemDirection()===at.DOWN?String.fromCodePoint((null!==(e=null===(t=s.codeFlagUp)||void 0===t?void 0:t.codePointAt(0))&&void 0!==e?e:-1)+1):null!==(i=s.codeFlagUp)&&void 0!==i?i:I.null;this.flag.setText(n),this.flag.fontInfo=this.fontInfo}}getBaseCustomNoteHeadGlyphProps(){return this.getStemDirection()===at.DOWN?this.customGlyphs[this.customGlyphs.length-1]:this.customGlyphs[0]}getStemLength(){return at.HEIGHT+this.getStemExtension()}getBeamCount(){const t=this.getGlyphProps();return t?t.beamCount:0}getStemMinimumLength(){const t=K.durationToFraction(this.duration),e=void 0===this.beam;let i=t.value()<=1?0:20;switch(this.duration){case"8":case"16":i=e?35:25;break;case"32":i=e?45:35;break;case"64":i=e?50:40;break;case"128":i=e?55:45;break;case"256":i=e?60:55;break;case"512":i=e?65:60;break;case"1024":i=e?70:65}return i}getStemDirection(){if(!this.stemDirection)throw new p("NoStem","No stem attached to this note.");return this.stemDirection}setStemDirection(t){if(t||(t=at.UP),t!==at.UP&&t!==at.DOWN)throw new p("BadArgument",`Invalid stem direction: ${t}`);return this.stemDirection=t,this.reset(),this.hasFlag()&&this.buildFlag(),this.beam=void 0,this.stem&&(this.stem.setDirection(t),this.stem.setExtension(this.getStemExtension())),this.preFormatted&&this.preFormat(),this}getStemX(){const t=this.getAbsoluteX()+this.xShift,e=this.getAbsoluteX()+this.xShift+this.getGlyphWidth();return this.stemDirection===at.DOWN?t:e}getCenterGlyphX(){return this.getAbsoluteX()+this.xShift+this.getGlyphWidth()/2}getStemExtension(){const t=this.getGlyphProps(),e=this.flag.getHeight(),i=this.getFontScale();return void 0!==this.stemExtensionOverride?this.stemExtensionOverride:this.beam?t.stemBeamExtension*i:e>at.HEIGHT*i?e-at.HEIGHT*i:0}setStemLength(t){return this.stemExtensionOverride=t-at.HEIGHT,this}getStemExtents(){if(!this.stem)throw new p("NoStem","No stem attached to this note.");return this.stem.getExtents()}getYForTopText(t){const e=this.checkStave();if(this.hasStem()){const i=this.getStemExtents();if(!i)throw new p("InvalidState","Stem does not have extents.");return Math.min(e.getYForTopText(t),i.topY-this.renderOptions.annotationSpacing*(t+1))}return e.getYForTopText(t)}getYForBottomText(t){const e=this.checkStave();if(this.hasStem()){const i=this.getStemExtents();if(!i)throw new p("InvalidState","Stem does not have extents.");return Math.max(e.getYForTopText(t),i.baseY+this.renderOptions.annotationSpacing*t)}return e.getYForBottomText(t)}hasFlag(){return void 0!==this.glyphProps.codeFlagUp&&!this.beam&&!this.isRest()}postFormat(){var t;return null===(t=this.beam)||void 0===t||t.postFormat(),this.postFormatted=!0,this}drawStem(t){var e;this.checkContext(),this.setRendered(),this.setStem(new at(t)),null===(e=this.stem)||void 0===e||e.setContext(this.getContext()).drawWithStyle()}}function Te(t,e,i){const s=i>0?e.maxLine+.5-t.minLine:t.maxLine+.5-e.minLine,n=i*Math.max(1,Math.ceil(s));t.line+=n,t.maxLine+=n,t.minLine+=n,t.note.setKeyLine(0,t.note.getKeyLine(0)+n)}class xe extends Se{static get CATEGORY(){return"StaveNote"}static get LEDGER_LINE_OFFSET(){return 3}static get minNoteheadPadding(){return B.get("NoteHead.minPadding")}static format(t,e){if(!t||t.length<2)return!1;const i=[];for(let e=0;e<t.length;e++){const s=t[e].sortedKeyProps,n=s[0].keyProps.line;let o=s[s.length-1].keyProps.line;const a=t[e].getStemDirection(),r=t[e].getStemLength()/10,h=t[e].getStemMinimumLength()/10;let c;t[e].isRest()?(c=n+Math.ceil(t[e]._noteHeads[0].getTextMetrics().actualBoundingBoxAscent/K.STAVE_LINE_DISTANCE),o=n-Math.ceil(t[e]._noteHeads[0].getTextMetrics().actualBoundingBoxDescent/K.STAVE_LINE_DISTANCE)):(c=1===a?s[s.length-1].keyProps.line+r:s[s.length-1].keyProps.line,o=1===a?s[0].keyProps.line:s[0].keyProps.line-r),i.push({line:s[0].keyProps.line,maxLine:c,minLine:o,isrest:t[e].isRest(),stemDirection:a,stemMax:r,stemMin:h,voiceShift:t[e].getVoiceShiftWidth(),isDisplaced:t[e].isDisplaced(),note:t[e]})}let s,n,o,a=0;const r=[!1,!1,!1];for(let t=0;t<i.length;t++)r[t]=!1!==i[t].note.renderOptions.draw;if(r[0]&&r[1]&&r[2])a=3,s=i[0],n=i[1],o=i[2];else if(r[0]&&r[1])a=2,s=i[0],o=i[1];else if(r[0]&&r[2])a=2,s=i[0],o=i[2];else{if(!r[1]||!r[2])return!0;a=2,s=i[1],o=i[2]}2===a&&-1===s.stemDirection&&1===o.stemDirection&&(s=i[1],o=i[0]);const h=Math.max(s.voiceShift,o.voiceShift);let c=0;if(2===a){const t=s.note.hasStem()&&o.note.hasStem()&&s.stemDirection===o.stemDirection?0:.5;if(o.isrest&&s.isrest&&s.note.duration===o.note.duration)o.note.renderOptions.draw=!1;else if(s.minLine<=o.maxLine+t)if(s.isrest)Te(s,o,1);else if(o.isrest)Te(o,s,-1);else{const t=Math.abs(s.line-o.line);if(s.note.hasStem()&&o.note.hasStem()){const e=s.note.sortedKeyProps[0].keyProps.code,i=o.note.sortedKeyProps[o.note.sortedKeyProps.length-1].keyProps.code;!K.UNISON||e!==i||s.note.getModifiers().filter(t=>"Dot"===t.getCategory()&&0===t.getIndex()).length!==o.note.getModifiers().filter(t=>"Dot"===t.getCategory()&&0===t.getIndex()).length||t<1&&t>0||JSON.stringify(s.note.getStyle())!==JSON.stringify(o.note.getStyle())?(c=h+2,s.stemDirection===o.stemDirection?s.note.setXShift(c):o.note.setXShift(c)):s.note.voice!==o.note.voice&&s.stemDirection===o.stemDirection&&(s.line!==o.line?(c=h+2,s.note.setXShift(c)):1===o.stemDirection&&(o.stemDirection=-1,o.note.setStemDirection(-1)))}else t<1?(c=h+2,s.note.duration<o.note.duration?s.note.setXShift(c):o.note.setXShift(c)):s.note.hasStem()?(s.stemDirection=-s.note.getStemDirection(),s.note.setStemDirection(s.stemDirection)):o.note.hasStem()&&(o.stemDirection=-o.note.getStemDirection(),o.note.setStemDirection(o.stemDirection))}return e.rightShift+=c,!0}if(!n)throw new p("InvalidState","noteM not defined.");if(n.isrest&&!s.isrest&&!o.isrest&&(s.minLine<=n.maxLine||n.minLine<=o.maxLine)){return n.maxLine-n.minLine<s.minLine-o.maxLine?function(t,e,i){const s=t.line-T(e.minLine,i.maxLine);t.note.setKeyLine(0,t.note.getKeyLine(0)-s),t.line-=s,t.maxLine-=s,t.minLine-=s}(n,s,o):(c=h+2,n.note.setXShift(c),!1===o.note.hasBeam()&&(o.stemDirection=-1,o.note.setStemDirection(-1)),s.minLine<=o.maxLine&&!1===s.note.hasBeam()&&(s.stemDirection=1,s.note.setStemDirection(1))),e.rightShift+=c,!0}return s.isrest&&n.isrest&&o.isrest?(s.note.renderOptions.draw=!1,o.note.renderOptions.draw=!1,e.rightShift+=c,!0):(n.isrest&&s.isrest&&n.minLine<=o.maxLine&&(n.note.renderOptions.draw=!1),n.isrest&&o.isrest&&s.minLine<=n.maxLine&&(n.note.renderOptions.draw=!1),s.isrest&&s.minLine<=n.maxLine&&Te(s,n,1),o.isrest&&n.minLine<=o.maxLine&&Te(o,n,-1),(s.minLine<=n.maxLine+.5||n.minLine<=o.maxLine)&&(c=h+2,n.note.setXShift(c),!1===o.note.hasBeam()&&(o.stemDirection=-1,o.note.setStemDirection(-1)),s.minLine<=o.maxLine&&!1===s.note.hasBeam()&&(s.stemDirection=1,s.note.setStemDirection(1))),e.rightShift+=c,!0)}static postFormat(t){return!!t&&(t.forEach(t=>t.postFormat()),!0)}constructor(t){var e,i,s;super(t),this.minLine=0,this.maxLine=0,this.sortedKeyProps=[],this.ledgerLineStyle={},this.clef=null!==(e=t.clef)&&void 0!==e?e:"treble",this.octaveShift=null!==(i=t.octaveShift)&&void 0!==i?i:0,this.glyphProps=yt.getGlyphProps(this.duration,this.noteType),f(this.glyphProps,"BadArguments",`No glyph found for duration '${this.duration}' and type '${this.noteType}'`),this.displaced=!1,this.dotShiftY=0,this.useDefaultHeadX=!1,this._noteHeads=[],this.modifiers=[],this.renderOptions=Object.assign(Object.assign({},this.renderOptions),{strokePx:t.strokePx||xe.LEDGER_LINE_OFFSET}),this.calculateKeyProps(),this.buildStem(),t.autoStem?this.autoStem():this.setStemDirection(null!==(s=t.stemDirection)&&void 0!==s?s:at.UP)}reset(){super.reset();const t=this._noteHeads.map(t=>t.getStyle());this.buildNoteHeads(),this._noteHeads.forEach((e,i)=>{const s=t[i];s&&e.setStyle(s)});const e=this.stave;return e&&this.setStave(e),this.calcNoteDisplacements(),this}setBeam(t){return this.beam=t,this.calcNoteDisplacements(),this.stem&&this.stem.setExtension(this.getStemExtension()),this}buildStem(){return this.setStem(new at({hide:this.isRest()})),this}buildNoteHeads(){const t=new Set(this._noteHeads);this.children=this.children.filter(e=>!t.has(e)),this._noteHeads=[];const e=this.getStemDirection(),i=this.getKeys();let s,n,o,a,r,h=!1;e===at.UP?(o=0,a=i.length,r=1):(o=i.length-1,a=-1,r=-1);for(let t=o;t!==a;t+=r){const i=this.sortedKeyProps[t].keyProps,o=i.line;void 0===s?s=o:(n=Math.abs(s-o),0===n||.5===n?h=!h:(h=!1,this.useDefaultHeadX=!0)),s=o;const a=new me({duration:this.duration,noteType:this.noteType,displaced:h,stemDirection:e,customGlyphCode:i.code,line:i.line});a.fontInfo=this.fontInfo,this.addChild(a),this._noteHeads[this.sortedKeyProps[t].index]=a}return this._noteHeads}autoStem(){this.setStemDirection(this.calculateOptimalStemDirection())}calculateOptimalStemDirection(){this.minLine=this.sortedKeyProps[0].keyProps.line,this.maxLine=this.sortedKeyProps[this.keyProps.length-1].keyProps.line;return(this.minLine+this.maxLine)/2<3?at.UP:at.DOWN}calculateKeyProps(){var t;let e;for(let i=0;i<this.keys.length;++i){const s=this.keys[i],n={octaveShift:null!==(t=this.octaveShift)&&void 0!==t?t:0,duration:this.duration},o=K.keyProperties(s,this.clef,this.noteType,n);if(!o)throw new p("BadArguments",`Invalid key for note properties: ${s}`);"R"===o.key&&("1"===this.duration||"w"===this.duration?o.line=4:o.line=3);const a=o.line;void 0===e?e=a:Math.abs(e-a)<1&&(this.displaced=!0,o.displaced=!0,this.keyProps.length>0&&(this.keyProps[i-1].displaced=!0)),e=a,this.keyProps.push(o)}this.keyProps.forEach((t,e)=>{this.sortedKeyProps.push({keyProps:t,index:e})}),this.sortedKeyProps.sort((t,e)=>t.keyProps.line-e.keyProps.line)}getBoundingBox(){const t=new D(this.getAbsoluteX(),this.ys[0],0,0);this._noteHeads.forEach(e=>{const i=e.isDisplaced()?(e.getWidth()-at.WIDTH/2)*this.getStemDirection():0,s=e.getBoundingBox();s.setX(this.getNoteHeadBeginX()+i+e.getXShift()),t.mergeWith(s)});const{yTop:e,yBottom:i}=this.getNoteHeadBounds();if(!this.isRest()&&this.hasStem()){const s=this.stem.getHeight(),n=this.getStemDirection()===at.DOWN?e-s-this.flag.getTextMetrics().actualBoundingBoxDescent:i-s+this.flag.getTextMetrics().actualBoundingBoxAscent;t.mergeWith(new D(this.getAbsoluteX(),n,0,0))}if(this.shouldDrawFlag()){const{x:e,y:i}=this.getFlagPosition(),s=this.flag.getBoundingBox();s.setX(e+this.flag.getXShift()),s.setY(i+this.flag.getYShift()-this.flag.getTextMetrics().actualBoundingBoxAscent),t.mergeWith(s)}for(let e=0;e<this.modifiers.length;e++)t.mergeWith(this.modifiers[e].getBoundingBox());return t}getLineNumber(t){if(!this.keyProps.length)throw new p("NoKeyProps","Can't get bottom note line, because note is not initialized properly.");let e=this.keyProps[0].line;for(let i=0;i<this.keyProps.length;i++){const s=this.keyProps[i].line;t?s>e&&(e=s):s<e&&(e=s)}return e}isRest(){const t=this.glyphProps.codeHead;return t>=""&&t<=""}isChord(){return!this.isRest()&&this.keys.length>1}hasStem(){return this.glyphProps.stem}hasFlag(){return super.hasFlag()&&!this.isRest()}getStemX(){return"r"===this.noteType?this.getCenterGlyphX():super.getStemX()+(this.stemDirection?at.WIDTH/(2*-this.stemDirection):0)}getYForTopText(t){const e=this.getStemExtents();return Math.min(this.checkStave().getYForTopText(t),e.topY-this.renderOptions.annotationSpacing*(t+1))}getYForBottomText(t){const e=this.getStemExtents();return Math.max(this.checkStave().getYForTopText(t),e.baseY+this.renderOptions.annotationSpacing*t)}setStave(t){super.setStave(t);const e=this._noteHeads.map(e=>(e.setStave(t),e.getY()));if(this.setYs(e),this.stem){const{yTop:t,yBottom:e}=this.getStemYBounds();this.stem.setYBounds(t,e)}return this}isDisplaced(){return this.displaced}setNoteDisplaced(t){return this.displaced=t,this}getTieRightX(){let t=this.getAbsoluteX();return t+=this.getGlyphWidth()+this.xShift+this.rightDisplacedHeadPx,this.modifierContext&&(t+=this.modifierContext.getRightShiftForTie()),t}getTieLeftX(){let t=this.getAbsoluteX();return t+=this.xShift-this.leftDisplacedHeadPx,t}getLineForRest(){let t=this.keyProps[0].line;if(this.keyProps.length>1){const e=this.keyProps[this.keyProps.length-1].line;t=T(Math.max(t,e),Math.min(t,e))}return t}getModifierStartXY(t,e,i={}){if(!this.preFormatted)throw new p("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");if(0===this.ys.length)throw new p("NoYValues","No Y-Values calculated for this note.");const{ABOVE:s,BELOW:n,LEFT:o,RIGHT:a}=W.Position;let r=0;t===o?r=-2:t===a?(r=this.getGlyphWidth()+this.xShift+2,this.stemDirection===at.UP&&this.hasFlag()&&(i.forceFlagRight||((t,e)=>e===(t.getStemDirection()===at.UP?t.keyProps.length-1:0))(this,e))&&(r+=this.flag.getWidth())):t!==n&&t!==s||(r=this.getGlyphWidth()/2);let h=0;switch(this._noteHeads[e].getText()){case I.restWhole:h+=.5;break;case I.restHalf:case I.restQuarter:case I.rest8th:case I.rest16th:h-=.5;break;case I.rest32nd:case I.rest64th:h-=1.5;break;case I.rest128th:case I.rest256th:h-=2.5;break;case I.rest512th:h-=3.5;break;case I.rest1024th:h-=4.5}return{x:this.getAbsoluteX()+r,y:this.ys[e]+h*this.checkStave().getSpacingBetweenLines()}}setStyle(t){return super.setGroupStyle(t)}setStemStyle(t){const e=this.getStem();return e&&e.setStyle(t),this}getStemStyle(){var t;return null===(t=this.stem)||void 0===t?void 0:t.getStyle()}setLedgerLineStyle(t){this.ledgerLineStyle=t}getLedgerLineStyle(){return this.ledgerLineStyle}setFlagStyle(t){this.flag.setStyle(t)}getFlagStyle(){return this.flag.getStyle()}getGlyphWidth(){return this.noteHeads[0].getWidth()}setKeyStyle(t,e){return this._noteHeads[t].setStyle(e),this}setKeyLine(t,e){return this.keyProps[t].line=e,this.reset(),this}getKeyLine(t){return this.keyProps[t].line}getVoiceShiftWidth(){return this.getGlyphWidth()*(this.displaced?2:1)}calcNoteDisplacements(){this.setLeftDisplacedHeadPx(this.displaced&&this.stemDirection===at.DOWN?this.getGlyphWidth():0),this.setRightDisplacedHeadPx(!this.hasFlag()&&this.displaced&&this.stemDirection===at.UP?this.getGlyphWidth():0)}preFormat(){if(this.preFormatted)return;let t=0;this.modifierContext&&(this.modifierContext.preFormat(),0===this.modifierContext.getWidth()&&(t=xe.minNoteheadPadding));let e=this.getGlyphWidth()+this.leftDisplacedHeadPx+this.rightDisplacedHeadPx+t;this.shouldDrawFlag()&&this.stemDirection===at.UP&&(e+=this.getGlyphWidth()),this.setWidth(e),this.preFormatted=!0}getStemYBounds(){const t=this.stemDirection===at.UP?"up":"down";let e=1/0,i=-1/0;if(this._noteHeads.forEach(s=>{const n=K.noteHeadStemYOffsets[s.text],o=n?n[t]:0,a=s.getY()-o*K.STAVE_LINE_DISTANCE;e=Math.min(a,e),i=Math.max(a,i)}),!isFinite(e)||!isFinite(i)){const t=this.getNoteHeadBounds();return{yTop:t.yTop,yBottom:t.yBottom}}return{yTop:e,yBottom:i}}getNoteHeadBounds(){let t,e,i,s,n=1/0,o=-1/0,a=this.checkStave().getNumLines(),r=1,h=a,c=r;return this._noteHeads.forEach(l=>{const d=l.getLine(),u=l.getY();n=Math.min(u,n),o=Math.max(u,o),void 0===e&&l.isDisplaced()&&(e=l.getAbsoluteX()),void 0!==t||l.isDisplaced()||(t=l.getAbsoluteX()),a=Math.max(d,a),r=Math.min(d,r),l.isDisplaced()?(i=void 0===i?d:Math.max(d,i),s=void 0===s?d:Math.min(d,s)):(h=Math.max(d,h),c=Math.min(d,c))},this),{yTop:n,yBottom:o,displacedX:e,nonDisplacedX:t,highestLine:a,lowestLine:r,highestDisplacedLine:i,lowestDisplacedLine:s,highestNonDisplacedLine:h,lowestNonDisplacedLine:c}}getNoteHeadBeginX(){return this.getAbsoluteX()+this.xShift}getNoteHeadEndX(){return this.getNoteHeadBeginX()+this.getGlyphWidth()}get noteHeads(){return this._noteHeads.slice()}drawLedgerLines(){const t=this.checkStave(),{renderOptions:{strokePx:e}}=this,i=this.checkContext(),s=this.getGlyphWidth()+2*e,n=2*(this.getGlyphWidth()+e)-at.WIDTH/2;if(this.isRest())return;if(!i)throw new p("NoCanvasContext","Can't draw without a canvas context.");const{highestLine:o,lowestLine:a,highestDisplacedLine:r,highestNonDisplacedLine:h,lowestDisplacedLine:c,lowestNonDisplacedLine:l,displacedX:d,nonDisplacedX:u}=this.getNoteHeadBounds();if(o<6&&a>0)return;const g=Math.min(null!=d?d:0,null!=u?u:0),m=(t,o,a)=>{let r;r=a&&o?g-e:o?(null!=u?u:0)-e:(null!=d?d:0)-e;const h=o&&a?n:s;i.beginPath(),i.moveTo(r,t),i.lineTo(r+h,t),i.stroke()},f=Object.assign(Object.assign({},t.getDefaultLedgerLineStyle()),this.getLedgerLineStyle());i.save(),this.applyStyle(i,f);for(let e=6;e<=o;++e){const i=void 0!==u&&e<=h,s=void 0!==r&&e<=r;m(t.getYForNote(e),i,s)}for(let e=0;e>=a;--e){const i=void 0!==u&&e>=l,s=void 0!==c&&e>=c;m(t.getYForNote(e),i,s)}i.restore()}drawModifiers(t){const e=this.checkContext();for(let i=0;i<this.modifiers.length;i++){const s=this.modifiers[i],n=s.checkIndex();this._noteHeads[n]===t&&(s.setContext(e),s.drawWithStyle())}}shouldDrawFlag(){const t=void 0!==this.stem,e=void 0!==this.glyphProps.codeFlagUp,i=void 0===this.beam;return t&&e&&i&&!this.isRest()}getFlagPosition(){const{yTop:t,yBottom:e}=this.getNoteHeadBounds(),i=this.checkStem().getHeight();return{x:this.getStemX()-K.STEM_WIDTH/2,y:this.getStemDirection()===at.DOWN?t-i-this.flag.getTextMetrics().actualBoundingBoxDescent:e-i+this.flag.getTextMetrics().actualBoundingBoxAscent}}drawFlag(){const t=this.checkContext();if(!t)throw new p("NoCanvasContext","Can't draw without a canvas context.");if(this.shouldDrawFlag()){const{x:e,y:i}=this.getFlagPosition();this.flag.setContext(t).setX(e).setY(i).drawWithStyle()}}drawNoteHeads(){const t=this.checkContext();this._noteHeads.forEach(e=>{e.setContext(t).drawWithStyle()})}drawStem(t){const e=this.checkContext();t&&this.setStem(new at(t)),this.shouldDrawFlag()&&this.stem&&this.stem.adjustHeightForFlag(),this.stem&&this.stem.setContext(e).drawWithStyle()}getStemExtension(){const t=super.getStemExtension();if(!this.glyphProps.stem)return t;const e=this.getStemDirection();if(e!==this.calculateOptimalStemDirection())return t;let i;i=e===at.UP?3-this.maxLine:this.minLine-3;const s=i-3.5;if(s<=0)return t;const n=this.getStave();let o=10;return void 0!==n&&(o=n.getSpacingBetweenLines()),t+s*o}draw(){if(!1===this.renderOptions.draw)return;if(0===this.ys.length)throw new p("NoYValues","Can't draw note without Y values.");const t=this.checkContext(),e=this.getNoteHeadBeginX(),i=this.hasStem()&&!this.beam;if(this._noteHeads.forEach(t=>t.setX(e)),this.stem){const t=this.getStemX();this.stem.setNoteHeadXBounds(t,t)}!function(...t){xe.DEBUG&&S("VexFlow.StaveNote",t)}("Rendering ",this.isChord()?"chord :":"note :",this.keys);const s=this.getAttribute("class");t.openGroup("stavenote"+(s?" "+s:""),this.getAttribute("id")),this.drawLedgerLines(),i&&this.drawStem(),this.drawNoteHeads(),this.drawFlag(),this.drawPointerRect(),t.closeGroup(),this.setRendered()}}xe.DEBUG=!1;class we extends P{static get CATEGORY(){return"StaveTie"}constructor(t,e=""){super(),this.setNotes(t),this.text=e,this.renderOptions={cp1:8,cp2:12,shortTieCutoff:10,cp1Short:2,cp2Short:8,textShiftX:0,firstXShift:0,lastXShift:0,yShift:7,tieSpacing:0}}getDirection(){return void 0!==this.direction&&null!==this.direction?this.direction:this.notes.lastNote?this.notes.lastNote.getStemDirection():this.notes.firstNote?this.notes.firstNote.getStemDirection():0}setDirection(t){return this.direction=t,this}setNotes(t){if(!t.firstNote&&!t.lastNote)throw new p("BadArguments","Tie needs to have either firstNote or lastNote set.");if(t.firstIndexes||(t.firstIndexes=[0]),t.lastIndexes||(t.lastIndexes=[0]),t.firstIndexes.length!==t.lastIndexes.length)throw new p("BadArguments","Tied notes must have same number of indexes.");return this.notes=t,this}isPartial(){return!this.notes.firstNote||!this.notes.lastNote}renderTie(t){if(0===t.firstYs.length||0===t.lastYs.length)throw new p("BadArguments","No Y-values to render");const e=this.checkContext();let i=this.renderOptions.cp1,s=this.renderOptions.cp2;Math.abs(t.lastX-t.firstX)<this.renderOptions.shortTieCutoff&&(i=this.renderOptions.cp1Short,s=this.renderOptions.cp2Short);const n=this.renderOptions.firstXShift,o=this.renderOptions.lastXShift,a=this.renderOptions.yShift*t.direction,r=this.notes.firstIndexes,h=this.notes.lastIndexes,c=this.getAttribute("class");e.openGroup("stavetie"+(c?" "+c:""),this.getAttribute("id"));for(let c=0;c<r.length;++c){const l=(t.lastX+o+(t.firstX+n))/2,d=t.firstYs[r[c]]+a,u=t.lastYs[h[c]]+a;if(isNaN(d)||isNaN(u))throw new p("BadArguments","Bad indexes for tie rendering.");const g=(d+u)/2+i*t.direction,m=(d+u)/2+s*t.direction;e.beginPath(),e.moveTo(t.firstX+n,d),e.quadraticCurveTo(l,g,t.lastX+o,u),e.quadraticCurveTo(l,m,t.firstX+n,d),e.closePath(),e.fill()}this.drawPointerRect(),e.closeGroup()}renderTieText(t,e){var i,s,n;const o=this.checkContext();let a=(t+e)/2;a-=o.measureText(this.text).width/2;const r=null!==(s=null===(i=this.notes.firstNote)||void 0===i?void 0:i.checkStave())&&void 0!==s?s:null===(n=this.notes.lastNote)||void 0===n?void 0:n.checkStave();r&&(o.setFont(this.fontInfo),o.fillText(this.text,a+this.renderOptions.textShiftX,r.getYForTopText()-1))}getNotes(){return this.notes}getFirstX(){return this.notes.firstNote?this.notes.firstNote.getTieRightX()+this.renderOptions.tieSpacing:this.notes.lastNote?this.notes.lastNote.checkStave().getTieStartX():0}getLastX(){return this.notes.lastNote?this.notes.lastNote.getTieLeftX()+this.renderOptions.tieSpacing:this.notes.firstNote?this.notes.firstNote.checkStave().getTieEndX():0}getFirstYs(){return this.notes.firstNote?this.notes.firstNote.getYs():this.notes.lastNote?this.notes.lastNote.getYs():[0]}getLastYs(){return this.notes.lastNote?this.notes.lastNote.getYs():this.notes.firstNote?this.notes.firstNote.getYs():[0]}synchronizeIndexes(){this.notes.firstNote&&this.notes.lastNote||(this.notes.firstNote||this.notes.lastNote)&&(this.notes.firstNote?this.notes.lastIndexes=this.notes.firstIndexes:this.notes.firstIndexes=this.notes.lastIndexes)}draw(){this.checkContext(),this.setRendered(),this.synchronizeIndexes();const t=this.getFirstX(),e=this.getLastX();return this.renderTie({firstX:t,lastX:e,firstYs:this.getFirstYs(),lastYs:this.getLastYs(),direction:this.getDirection()}),this.renderTieText(t,e),!0}}class be extends we{static get CATEGORY(){return"TabTie"}static createHammeron(t){return new be(t,"H")}static createPulloff(t){return new be(t,"P")}constructor(t,e){super(t,e),this.renderOptions.cp1=9,this.renderOptions.cp2=11,this.renderOptions.yShift=3,this.direction=-1}}var ye;!function(t){t[t.STRICT=1]="STRICT",t[t.SOFT=2]="SOFT",t[t.FULL=3]="FULL"}(ye||(ye={}));class ke extends P{static get CATEGORY(){return"Voice"}static get Mode(){return ye}constructor(t){let e;if(super(),this.resolutionMultiplier=1,this.mode=ye.STRICT,this.preFormatted=!1,this.ticksDirty=!1,this.ticksUsed=new y(0,1),this.largestTickWidth=0,this.tickables=[],this.options={softmaxFactor:K.SOFTMAX_FACTOR},"string"==typeof t){const i=t.length<=64?/^(\d+)\/(\d+)$/.exec(t):null;if(!i)throw new p("BadArgument","Invalid time signature. Expected positive integers such as 4/4.");e={numBeats:Number(i[1]),beatValue:Number(i[2])}}else e=t;this.time=Object.assign({numBeats:4,beatValue:4,resolution:K.RESOLUTION},e);const{numBeats:i,beatValue:s,resolution:n}=this.time;if(![i,s,n].every(t=>Number.isSafeInteger(t)&&t>0))throw new p("BadArgument","Meter and resolution must be positive safe integers.");const o=i*(n/s);if(!Number.isFinite(o)||o<=0||o>Number.MAX_SAFE_INTEGER)throw new p("BadArgument","Meter exceeds the supported tick range.");this.totalTicks=new y(o,1),this.smallestTickCount=this.totalTicks.clone()}getTotalTicks(){return this.refreshTicks(),this.totalTicks}getTicksUsed(){return this.refreshTicks(),this.ticksUsed}getLargestTickWidth(){return this.largestTickWidth}getSmallestTickCount(){return this.refreshTicks(),this.smallestTickCount}getTickables(){return this.tickables}getMode(){return this.mode}setMode(t){return this.mode=t,this}getResolutionMultiplier(){return this.refreshTicks(),this.resolutionMultiplier}getActualResolution(){return this.getResolutionMultiplier()*this.time.resolution}setStave(t){return this.stave=t,this}getStave(){return this.stave}getBoundingBox(){const t=this.tickables[0].getBoundingBox();for(let e=1;e<this.tickables.length;++e){const i=this.tickables[e];!i.getStave()&&this.stave&&i.setStave(this.stave);const s=i.getBoundingBox();t.mergeWith(s)}return t}setStrict(t){return this.mode=t?ye.STRICT:ye.SOFT,this}isComplete(){return this.refreshTicks(),this.mode!==ye.STRICT&&this.mode!==ye.FULL||this.ticksUsed.equals(this.totalTicks)}setSoftmaxFactor(t){return this.options.softmaxFactor=t,this.expTicksUsed=0,this}reCalculateExpTicksUsed(){const t=this.ticksUsed.value();return this.expTicksUsed=b(this.tickables.map(e=>Math.pow(this.options.softmaxFactor,e.getTicks().value()/t))),this.expTicksUsed}softmax(t){this.refreshTicks(),this.expTicksUsed||(this.expTicksUsed=this.reCalculateExpTicksUsed());const e=this.ticksUsed.value();return(t=>Math.pow(this.options.softmaxFactor,t/e))(t)/this.expTicksUsed}invalidateTicks(){this.ticksDirty=!0,this.expTicksUsed=void 0}refreshTicks(){if(this.ticksDirty){this.ticksUsed.set(0,1),this.totalTicks.set(this.time.numBeats*(this.time.resolution/this.time.beatValue),1),this.smallestTickCount=this.totalTicks.clone();for(const t of this.tickables){if(t.shouldIgnoreTicks())continue;const e=t.getTicks();this.ticksUsed.add(e),e.lessThan(this.smallestTickCount)&&(this.smallestTickCount=e.clone())}this.resolutionMultiplier=this.ticksUsed.denominator,this.totalTicks.add(0,this.resolutionMultiplier),this.ticksDirty=!1}}addTickable(t){if(this.refreshTicks(),!t.shouldIgnoreTicks()){const e=t.getTicks();if(this.ticksUsed.add(e),this.expTicksUsed=0,(this.mode===ye.STRICT||this.mode===ye.FULL)&&this.ticksUsed.greaterThan(this.totalTicks))throw this.ticksUsed.subtract(e),new p("BadArgument","Too many ticks.");e.lessThan(this.smallestTickCount)&&(this.smallestTickCount=e.clone()),this.resolutionMultiplier=this.ticksUsed.denominator,this.totalTicks.add(0,this.ticksUsed.denominator)}return this.tickables.push(t),t.setVoice(this),this}addTickables(t){for(let e=0;e<t.length;++e)this.addTickable(t[e]);return this}preFormat(){if(this.preFormatted)return this;const t=this.checkStave();return this.tickables.forEach(e=>{e.getStave()||e.setStave(t)}),this.preFormatted=!0,this}checkStave(){return f(this.stave,"NoStave","No stave attached to instance.")}draw(t=this.checkContext(),e){e=null!=e?e:this.stave,this.setRendered();for(let i=0;i<this.tickables.length;++i){const s=this.tickables[i];e&&s.setStave(e),f(s.getStave(),"MissingStave","The voice cannot draw tickables without staves."),s.setContext(t),s.drawWithStyle()}}}class ve extends W{static get CATEGORY(){return"GraceNoteGroup"}static format(t,e){if(!t||0===t.length)return!1;const i=[];let s=null,n=0;for(let e=0;e<t.length;++e){const o=t[e],a=o.getNote(),r=et(a),h=r?4:0;if(r&&a!==s){for(let t=0;t<a.keys.length;++t)n=Math.max(a.getLeftDisplacedHeadPx(),n);s=a}i.push({shift:n,gracenoteGroup:o,spacing:h})}let o,a=i[0].shift,r=!1,h=!1;for(let t=0;t<i.length;++t){const e=i[t].gracenoteGroup;e.position===W.Position.RIGHT?r=!0:h=!0,e.preFormat(),o=e.getWidth()+i[t].spacing,a=Math.max(o,a)}for(let t=0;t<i.length;++t){const e=i[t].gracenoteGroup;o=e.getWidth()+i[t].spacing,e.setSpacingFromNextModifier(a-Math.min(o,a)+xe.minNoteheadPadding)}return r&&(e.rightShift+=a),h&&(e.leftShift+=a),!0}constructor(t,e){return super(),this.preFormatted=!1,this.position=W.Position.LEFT,this.graceNotes=t,this.width=0,this.showSlur=e,this.slur=void 0,this.voice=new ke({numBeats:4,beatValue:4,resolution:K.RESOLUTION}).setStrict(!1),this.renderOptions={slurYShift:0},this.beams=[],this.voice.addTickables(this.graceNotes),this}preFormat(){this.preFormatted||(this.formatter||(this.formatter=new ni),this.formatter.joinVoices([this.voice]).format([this.voice],0,{}),this.setWidth(this.formatter.getMinTotalWidth()),this.preFormatted=!0)}beamNotes(t){if((t=t||this.graceNotes).length>1){const e=new At(t);e.renderOptions.beamWidth=3,e.renderOptions.partialBeamLength=4,this.beams.push(e)}return this}setWidth(t){return this.width=t,this}getWidth(){return this.width+xe.minNoteheadPadding}getGraceNotes(){return this.graceNotes}positionGraceNotes(){const t=this.checkAttachedNote();t.checkStave(),this.preFormat(),this.alignSubNotesWithNote(this.getGraceNotes(),t,this.position),this.beams.forEach(t=>t.postFormat())}getBoundingBox(){if(0===this.graceNotes.length)return super.getBoundingBox();this.positionGraceNotes();const t=this.graceNotes[0].getBoundingBox();for(let e=1;e<this.graceNotes.length;e++)t.mergeWith(this.graceNotes[e].getBoundingBox());return t}draw(){const t=this.checkContext(),e=this.checkAttachedNote();if(this.setRendered(),function(...t){ve.DEBUG&&S("VexFlow.GraceNoteGroup",t)}("Drawing grace note group for:",e),this.positionGraceNotes(),this.graceNotes.forEach(e=>e.setContext(t).drawWithStyle()),this.beams.forEach(e=>e.setContext(t).drawWithStyle()),this.showSlur){const i=et(e),s=i?we:be;this.slur=new s({lastNote:this.graceNotes[0],firstNote:e,firstIndexes:[0],lastIndexes:[0]}),this.slur.renderOptions.cp2=12,this.slur.renderOptions.yShift=(i?7:5)+this.renderOptions.slurYShift,this.slur.setContext(t).drawWithStyle()}}}ve.DEBUG=!1;class Be extends W{static get CATEGORY(){return"NoteSubGroup"}static format(t,e){if(!t||0===t.length)return!1;let i=0;for(let e=0;e<t.length;++e){const s=t[e];s.preFormat(),i+=s.getWidth()}return e.leftShift+=i,!0}constructor(t){super(),this.preFormatted=!1,this.position=W.Position.LEFT,this.subNotes=t,this.subNotes.forEach(t=>{t.setIgnoreTicks(!1)}),this.width=0,this.formatter=new ni,this.voice=new ke({numBeats:4,beatValue:4,resolution:K.RESOLUTION}).setStrict(!1),this.voice.addTickables(this.subNotes)}preFormat(){this.preFormatted||(this.formatter.joinVoices([this.voice]).format([this.voice],0),this.setWidth(this.formatter.getMinTotalWidth()),this.preFormatted=!0)}setWidth(t){return this.width=t,this}getWidth(){return this.width}draw(){const t=this.checkContext(),e=this.checkAttachedNote();this.setRendered(),this.alignSubNotesWithNote(this.subNotes,e),this.subNotes.forEach(e=>e.setContext(t).drawWithStyle())}}class Ce extends W{static get CATEGORY(){return"Ornament"}static get minPadding(){return B.get("NoteHead.minPadding")}static format(t,e){var i,s;if(!t||0===t.length)return!1;let n=0,o=e.rightShift,a=e.leftShift;for(let r=0;r<t.length;++r){const h=t[r],c=2;if(h.position===M.RIGHT)h.xShift+=o+2,o+=h.width+Ce.minPadding;else if(h.position===M.LEFT)h.xShift-=a+h.width+2,a+=h.width+Ce.minPadding;else if(h.position===M.ABOVE){n=Math.max(h.getWidth(),n);const t=h.getNote();let o=t.getLineNumber(!0)+e.topTextLine;const a=t.getStem();a&&t.getStemDirection()===at.UP&&(o+=Math.abs(a.getHeight())/K.STAVE_LINE_DISTANCE);const r=null!==(s=null===(i=t.getStave())||void 0===i?void 0:i.getNumLines())&&void 0!==s?s:0;o<r&&(e.topTextLine+=r-o),h.setTextLine(e.topTextLine),e.topTextLine+=c}else n=Math.max(h.getWidth(),n),h.setTextLine(e.textLine),e.textLine+=c}return e.leftShift=a+n/2,e.rightShift=o+n/2,!0}static get ornamentNoteTransition(){return["flip","jazzTurn","smear"]}static get ornamentAttack(){return["scoop"]}static get ornamentAlignWithNoteHead(){return["doit","fall","fallLong","doitLong","scoop"]}static get ornamentRelease(){return["doit","fall","fallLong","doitLong","jazzTurn","smear","flip"]}static get ornamentLeft(){return["scoop"]}static get ornamentRight(){return["doit","fall","fallLong","doitLong"]}static get ornamentYShift(){return["fallLong"]}static get ornamentArticulation(){return["bend","plungerClosed","plungerOpen"]}constructor(t){super(),this.position=M.ABOVE,Ce.ornamentRight.indexOf(t)>=0&&(this.position=M.RIGHT),Ce.ornamentLeft.indexOf(t)>=0&&(this.position=M.LEFT),this.type=t,this.delayed=!1,this.renderOptions={accidentalLowerPadding:3,accidentalUpperPadding:3},this.adjustForStemDirection=!1,this.ornamentAlignWithNoteHead=Ce.ornamentAlignWithNoteHead.indexOf(this.type)>=0,Ce.ornamentNoteTransition.indexOf(this.type)>=0&&(this.delayed=!0),this.text=K.ornamentCodes(this.type)}setNote(t){return super.setNote(t),Ce.ornamentArticulation.indexOf(this.type)>=0&&(t.getLineNumber()>=3?this.position=W.Position.ABOVE:this.position=W.Position.BELOW),this}setDelayed(t){return this.delayed=t,this}setUpperAccidental(t){return this.accidentalUpper=new P,this.accidentalUpper.setText(K.accidentalCodes(t)),this}setLowerAccidental(t){return this.accidentalLower=new P,this.accidentalLower.setText(K.accidentalCodes(t)),this}draw(){const t=this.checkContext(),e=this.checkAttachedNote();this.setRendered();const i=e.checkStave(),s=this.getAttribute("class");t.openGroup("ornament"+(s?" "+s:""),this.getAttribute("id"));const n=e.getModifierStartXY(this.position,this.index);let o=n.x;const a=i.getSpacingBetweenLines(),r=Tt(e,this.position);let h=this.ornamentAlignWithNoteHead?n.y:0;if(this.position===M.ABOVE&&(h=ft(e,this.textLine)-(this.textLine+r)*a),this.position===M.BELOW&&(h=St(e,this.textLine)+(this.textLine+r+1.5)*a),this.delayed){let t=0;const s=e.getTickContext().getX();if(void 0!==this.delayXShift)t=this.delayXShift;else{const n=e.getVoice().getTickables(),a=n.indexOf(e),r=a+1<n.length?n[a+1].checkTickContext():void 0;t+=r?.5*(r.getX()-s):.5*(i.getX()+i.getWidth()-o),this.delayXShift=t}o+=t}!function(...t){Ce.DEBUG&&S("VexFlow.Ornament",t)}("Rendering ornament: ",this.text.charCodeAt(0),o,h),this.accidentalLower&&(this.accidentalLower.renderText(t,o+this.xShift-.5*this.accidentalLower.getWidth(),h+this.yShift-this.accidentalLower.getTextMetrics().actualBoundingBoxDescent),h-=this.accidentalLower.getHeight()+this.renderOptions.accidentalLowerPadding),Ce.ornamentYShift.indexOf(this.type)>=0&&(this.yShift+=this.getHeight()),this.x=o-(this.position===M.ABOVE||this.position===M.BELOW?.5*this.width:0),this.y=h,this.renderText(t,0,0),this.accidentalUpper&&(h-=this.getHeight()+this.renderOptions.accidentalUpperPadding,this.accidentalUpper.renderText(t,o+this.xShift-.5*this.accidentalUpper.getWidth(),h+this.yShift-this.accidentalUpper.getTextMetrics().actualBoundingBoxDescent)),this.drawPointerRect(),t.closeGroup()}}Ce.DEBUG=!1;class De extends W{static get CATEGORY(){return"Parenthesis"}static buildAndAttach(t){for(const e of t)for(let t=0;t<e.keys.length;t++)e.addModifier(new De(M.LEFT),t),e.addModifier(new De(M.RIGHT),t)}static format(t,e){if(!t||0===t.length)return!1;let i=0,s=0;for(let e=0;e<t.length;++e){const n=t[e],o=n.getNote(),a=n.getPosition(),r=n.checkIndex();let h=0;a===M.RIGHT&&(h=o.getRightParenthesisPx(r),s=s>h+n.width?s:h+n.width),a===M.LEFT&&(h=o.getLeftParenthesisPx(r)+n.width,i=i>h+n.width?i:h+n.width),n.setXShift(h)}return e.leftShift+=i,e.rightShift+=s,!0}constructor(t){super(),this.position=null!=t?t:W.Position.LEFT,this.position===W.Position.RIGHT?this.text="":this.position===W.Position.LEFT&&(this.text="")}setNote(t){return this.note=t,this.setFont(t.getFont()),this}draw(){const t=this.checkContext(),e=this.checkAttachedNote();this.setRendered();const i=e.getModifierStartXY(this.position,this.index,{forceFlagRight:!0});this.renderText(t,i.x,i.y)}}function Ee(t="normal"){return"normal"===t?"400":"bold"===t?"700":String(t)}function Le(t,e){let i=t;for(;i;){const t=i.getAttribute(e);if(null!==t)return t;i=i.parentElement}return null}function Ne(t,e){var i,s,n,o,a,r,h,c;const l=(null!==(i=Le(t,"font-family"))&&void 0!==i?i:"").split(",").map(t=>t.trim().replace(/^['"]|['"]$/g,"").toLowerCase()),d=Ee(null!==(s=Le(t,"font-weight"))&&void 0!==s?s:"normal"),u=null!==(n=Le(t,"font-style"))&&void 0!==n?n:"normal",g=l.map(t=>e.find(e=>{var i;return e.family.toLowerCase()===t&&Ee(e.weight)===d&&(null!==(i=e.style)&&void 0!==i?i:"normal")===u})),m=A.convertSizeToPixelValue(null!==(o=Le(t,"font-size"))&&void 0!==o?o:"10pt");let f=Number(null!==(a=t.getAttribute("x"))&&void 0!==a?a:0);const S=Number(null!==(r=t.getAttribute("y"))&&void 0!==r?r:0);let T,x="",w="";function b(){T&&w&&(x+=T.getPath(w,f,S,m).toPathData(5),f+=T.getAdvanceWidth(w,m),w="")}for(const e of null!==(h=t.textContent)&&void 0!==h?h:""){const t=null===(c=g.find(t=>t&&t.font.charToGlyphIndex(e)>0))||void 0===c?void 0:c.font;if(!t)throw new p("MissingFont",`No outline for ${JSON.stringify(e)} in ${l.join(", ")} (${d} ${u}).`);t!==T&&(b(),T=t),w+=e}return b(),x}const Fe={path:{x:!0,y:!0,width:!0,height:!0,"font-family":!0,"font-weight":!0,"font-style":!0,"font-size":!0},rect:{"font-family":!0,"font-weight":!0,"font-style":!0,"font-size":!0},text:{width:!0,height:!0}},Ae=2*Math.PI;class Oe extends wt{static toSVG(t,e){var i,s;const n=void 0===e?t:function(t,e){const i=t.cloneNode(!0);for(const t of Array.from(i.querySelectorAll("text"))){if(t.children.length)throw new p("BadArgument","Portable export expects plain SVGContext text.");const s=i.ownerDocument.createElementNS("http://www.w3.org/2000/svg","path");for(const e of Array.from(t.attributes))"x"===e.name||"y"===e.name||e.name.startsWith("font-")||s.setAttribute(e.name,e.value);s.setAttribute("d",Ne(t,e)),t.replaceWith(s)}return i}(t,e);return(new(null!==(s=null===(i=t.ownerDocument.defaultView)||void 0===i?void 0:i.XMLSerializer)&&void 0!==s?s:XMLSerializer)).serializeToString(n)}toSVG(t){return Oe.toSVG(this.svg,t)}constructor(t){super(),this.width=0,this.height=0,this.precision=1,this.backgroundFillStyle="white",this.fontCSSString="",this.element=t,this.precision=Math.pow(10,K.RENDER_PRECISION_PLACES);const e=this.create("svg");e.setAttribute("pointer-events","none"),this.element.appendChild(e),this.svg=e,this.parent=this.svg,this.groups=[this.svg],this.path="",this.pen={x:NaN,y:NaN};const i={"font-family":B.get("fontFamily"),"font-size":"10pt","font-weight":E.NORMAL,"font-style":L.NORMAL};this.state=Object.assign({scaleX:1,scaleY:1},i),this.attributes=Object.assign({"stroke-width":1,"stroke-dasharray":"none",fill:"black",stroke:"black",shadowBlur:0,shadowColor:"black"},i),this.groupAttributes=[],this.applyAttributes(e,this.attributes),this.groupAttributes.push(Object.assign({},this.attributes)),this.stateStack=[]}round(t){return Math.round(t*this.precision)/this.precision}create(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}openGroup(t,e){const i=this.create("g");return this.groups.push(i),this.parent.appendChild(i),this.parent=i,t&&i.setAttribute("class",x(t)),e&&i.setAttribute("id",x(e)),this.applyAttributes(i,this.attributes),this.groupAttributes.push(Object.assign(Object.assign({},this.groupAttributes[this.groupAttributes.length-1]),this.attributes)),i}closeGroup(){this.groups.pop(),this.groupAttributes.pop(),this.parent=this.groups[this.groups.length-1]}openRotation(t,e,i){this.openGroup().setAttribute("transform",`translate(${e},${i}) rotate(${t}) translate(-${e},-${i})`)}closeRotation(){this.closeGroup()}add(t){this.parent.appendChild(t)}setFillStyle(t){return this.attributes.fill=t,this}setBackgroundFillStyle(t){return this.backgroundFillStyle=t,this}setStrokeStyle(t){return this.attributes.stroke=t,this}setShadowColor(t){return this.attributes.shadowColor=t,this}setShadowBlur(t){return this.attributes.shadowBlur=t,this}setLineWidth(t){return this.attributes["stroke-width"]=t,this}setLineDash(t){if("[object Array]"===Object.prototype.toString.call(t))return this.attributes["stroke-dasharray"]=t.join(","),this;throw new p("ArgumentError","lineDash must be an array of integers.")}setLineCap(t){return this.attributes["stroke-linecap"]=t,this}resize(t,e){this.width=t,this.height=e,this.element.style.width=`${t}px`,this.svg.style.width=`${t}px`,this.svg.style.height=`${e}px`;const i={width:t,height:e};return this.applyAttributes(this.svg,i),this.scale(this.state.scaleX,this.state.scaleY),this}scale(t,e){this.state.scaleX=this.state.scaleX?this.state.scaleX*t:t,this.state.scaleY=this.state.scaleY?this.state.scaleY*e:e;const i=this.width/this.state.scaleX,s=this.height/this.state.scaleY;return this.setViewBox(0,0,i,s),this}setViewBox(t,e,i,s){if("string"==typeof t)this.svg.setAttribute("viewBox",t);else{const n=t+" "+e+" "+i+" "+s;this.svg.setAttribute("viewBox",n)}}applyAttributes(t,e){const i=Fe[t.nodeName];for(const s in e)i&&i[s]||!e[s]||0!==this.groupAttributes.length&&e[s]==this.groupAttributes[this.groupAttributes.length-1][s]||t.setAttributeNS(null,s,e[s]);return t}clear(){for(;this.svg.lastChild;)this.svg.removeChild(this.svg.lastChild)}rect(t,e,i,s,n){s<0&&(e+=s,s*=-1);const o=this.create("rect");return n=null!=n?n:{fill:"none","stroke-width":this.attributes["stroke-width"],stroke:"black"},t=this.round(t),e=this.round(e),i=this.round(i),s=this.round(s),this.applyAttributes(o,Object.assign({x:t,y:e,width:i,height:s},n)),this.add(o),this}fillRect(t,e,i,s){const n={fill:this.attributes.fill,stroke:"none"};return this.rect(t,e,i,s,n),this}pointerRect(t,e,i,s){return this.rect(t,e,i,s,{opacity:"0","pointer-events":"auto"}),this}clearRect(t,e,i,s){return this.rect(t,e,i,s,{fill:this.backgroundFillStyle,stroke:"none"}),this}beginPath(){return this.path="",this.pen.x=NaN,this.pen.y=NaN,this}moveTo(t,e){return t=this.round(t),e=this.round(e),this.path+="M"+t+" "+e,this.pen.x=t,this.pen.y=e,this}lineTo(t,e){return t=this.round(t),e=this.round(e),this.path+="L"+t+" "+e,this.pen.x=t,this.pen.y=e,this}bezierCurveTo(t,e,i,s,n,o){return n=this.round(n),o=this.round(o),t=this.round(t),e=this.round(e),i=this.round(i),s=this.round(s),this.path+="C"+t+" "+e+","+i+" "+s+","+n+" "+o,this.pen.x=n,this.pen.y=o,this}quadraticCurveTo(t,e,i,s){return i=this.round(i),s=this.round(s),t=this.round(t),e=this.round(e),this.path+="Q"+t+" "+e+","+i+" "+s,this.pen.x=i,this.pen.y=s,this}arc(t,e,i,s,n,o){let a=t+i*Math.cos(s),r=e+i*Math.sin(s);a=this.round(a),r=this.round(r);const h=w(s),c=w(n);if(!o&&n-s>=Ae||o&&s-n>=Ae||h===c){let n=t+i*Math.cos(s+Math.PI),o=e+i*Math.sin(s+Math.PI);n=this.round(n),o=this.round(o),i=this.round(i),this.path+=`M${a} ${r} A${i} ${i} 0 0 0 ${n} ${o} `,this.path+=`A${i} ${i} 0 0 0 ${a} ${r}`,this.pen.x=a,this.pen.y=r}else{let l,d=t+i*Math.cos(n),u=e+i*Math.sin(n);s=h,n=c,l=Math.abs(n-s)<Math.PI?o:!o,s>n&&(l=!l);const g=!o;d=this.round(d),u=this.round(u),i=this.round(i),this.path+=`M${a} ${r} A${i} ${i} 0 ${+l} ${+g} ${d} ${u}`,this.pen.x=d,this.pen.y=u}return this}closePath(){return this.path+="Z",this}getShadowStyle(){return`filter: drop-shadow(0 0 ${this.attributes.shadowBlur/1.5}px ${this.attributes.shadowColor})`}fill(t){const e=this.create("path");return void 0===t&&(t=Object.assign(Object.assign({},this.attributes),{stroke:"none"})),t.d=this.path,this.attributes.shadowBlur>0&&(t.style=this.getShadowStyle()),this.applyAttributes(e,t),this.add(e),this}stroke(){const t=this.create("path"),e=Object.assign(Object.assign({},this.attributes),{fill:"none",d:this.path});return this.attributes.shadowBlur>0&&(e.style=this.getShadowStyle()),this.applyAttributes(t,e),this.add(t),this}measureText(t){Oe.measureTextElement.setText(t),Oe.measureTextElement.setFont(this.attributes["font-family"],this.attributes["font-size"],this.attributes["font-weight"],this.attributes["font-style"]);const e=Oe.measureTextElement.getBoundingBox();return{x:e.x,y:e.y,width:e.w,height:e.h}}fillText(t,e,i){if(!t||t.length<=0)return this;e=this.round(e),i=this.round(i);const s=Object.assign(Object.assign({},this.attributes),{stroke:"none",x:e,y:i}),n=this.create("text");return n.textContent=t,this.applyAttributes(n,s),this.add(n),this}save(){return this.stateStack.push({state:g(this.state),attributes:g(this.attributes)}),this}restore(){const t=this.stateStack.pop();if(t){const e=t;this.state=g(e.state),this.attributes=g(e.attributes)}return this}set fillStyle(t){this.setFillStyle(t)}get fillStyle(){return this.attributes.fill}set strokeStyle(t){this.setStrokeStyle(t)}get strokeStyle(){return this.attributes.stroke}setFont(t,e,i,s){const n=A.validate(t,e,i,s);this.fontCSSString=A.toCSSString(n);const o={"font-family":n.family,"font-size":n.size,"font-weight":n.weight,"font-style":n.style};return this.attributes=Object.assign(Object.assign({},this.attributes),o),this.state=Object.assign(Object.assign({},this.state),o),this}getFont(){return this.fontCSSString}}var Re,Pe,Me,Ie;Oe.measureTextElement=new P,function(t){t[t.CANVAS=1]="CANVAS",t[t.SVG=2]="SVG"}(Re||(Re={})),function(t){t[t.NONE=1]="NONE",t[t.UP=2]="UP",t[t.DOWN=3]="DOWN"}(Pe||(Pe={}));class We{static buildContext(t,e,i,s,n="#FFF"){const o=new We(t,e);i&&s&&o.resize(i,s);const a=o.getContext();return a.setBackgroundFillStyle(n),We.lastContext=a,a}static getCanvasContext(t,e,i,s){return We.buildContext(t,We.Backends.CANVAS,e,i,s)}static getSVGContext(t,e,i,s){return We.buildContext(t,We.Backends.SVG,e,i,s)}static drawDashedLine(t,e,i,s,n,o){t.beginPath();const a=s-e,r=n-i,h=Math.atan2(r,a);let c=e,l=i;t.moveTo(e,i);let d=0,u=!0;for(;!(a<0?c<=s:c>=s)||!(r<0?l<=n:l>=n);){const e=o[d++%o.length],i=c+Math.cos(h)*e;c=a<0?Math.max(s,i):Math.min(s,i);const g=l+Math.sin(h)*e;l=r<0?Math.max(n,g):Math.min(n,g),u?t.lineTo(c,l):t.moveTo(c,l),u=!u}t.closePath(),t.stroke()}constructor(t,e){if($(t,"RenderContext"))this.ctx=t;else{if(void 0===e)throw new p("InvalidArgument","Missing backend argument");const i=e;let s;if("string"==typeof t){const e=document.getElementById(t);if(!e)throw new p("BadElementId",`Can't find element with ID "${e}"`);s=e}else s=t;if(i===We.Backends.CANVAS){if(!Rt(s))throw new p("BadElement","CANVAS context requires an HTMLCanvasElement.");const t=s.getContext("2d",{willReadFrequently:!0});if(!t)throw new p("BadElement","Can't get canvas context");this.ctx=new Pt(t)}else{if(i!==We.Backends.SVG)throw new p("InvalidBackend",`No support for backend: ${i}`);if(!function(t){if(!t)return!1;const e=m();return"function"==typeof e.HTMLDivElement&&t instanceof e.HTMLDivElement||"function"==typeof t.appendChild&&"object"==typeof t.style}(s))throw new p("BadElement","SVG context requires an HTMLDivElement.");this.ctx=new Oe(s)}}}resize(t,e){return this.ctx.resize(t,e),this}getContext(){return this.ctx}}We.Backends=Re,We.LineEndType=Pe,We.lastContext=void 0;class He extends W{static get CATEGORY(){return"StringNumber"}static format(t,e){const i=e.leftShift,s=e.rightShift;if(!t||0===t.length)return!1;const n=[];let o=null,a=0,r=0;for(let i=0;i<t.length;++i){const h=t[i],c=h.getNote(),l=h.getPosition();if(!et(c))throw new p("NoStaveNote");const d=h.checkIndex(),u=c.getKeyProps()[d],g=c.getModifierContext(),m=2*h.radius/K.STAVE_LINE_DISTANCE+.5;if(g&&(l===M.ABOVE?(h.textLine=g.getState().topTextLine,e.topTextLine+=m):l===M.BELOW&&(h.textLine=g.getState().textLine,e.textLine+=m)),c!==o){for(let t=0;t<c.keys.length;++t)l===W.Position.LEFT&&(a=Math.max(c.getLeftDisplacedHeadPx(),a)),0===s&&(r=Math.max(c.getRightDisplacedHeadPx(),r));o=c}const f=u.line;n.push({pos:l,note:c,num:h,line:f,shiftL:a,shiftR:r})}n.sort((t,e)=>e.line-t.line);let h=0,c=0,l=0,d=null,u=null;for(let t=0;t<n.length;++t){const e=n[t].note,o=n[t].pos,r=n[t].num,g=n[t].line,p=n[t].shiftR;g===d&&e===u||(h=s+p);const m=r.getWidth()+1;let f=0;o===W.Position.LEFT?(r.setXShift(i+a),f=m,c=Math.max(f,c)):o===W.Position.RIGHT&&(r.setXShift(h),f+=m,l=f>l?f:l),d=g,u=e}return e.leftShift+=c,e.rightShift+=l,!0}constructor(t){super(),this.stringNumber=t,this.position=W.Position.ABOVE,this.xShift=0,this.yShift=0,this.textLine=0,this.stemOffset=0,this.xOffset=0,this.yOffset=0,this.dashed=!0,this.leg=We.LineEndType.NONE,this.radius=8,this.drawCircle=!0,this.setWidth(2*this.radius+4)}setLineEndType(t){return t>=We.LineEndType.NONE&&t<=We.LineEndType.DOWN&&(this.leg=t),this}setStringNumber(t){return this.stringNumber=t,this}setOffsetX(t){return this.xOffset=t,this}setOffsetY(t){return this.yOffset=t,this}setLastNote(t){return this.lastNote=t,this}setDashed(t){return this.dashed=t,this}setDrawCircle(t){return this.drawCircle=t,this}draw(){const t=this.checkContext(),e=this.checkAttachedNote();this.setRendered();const i=e.getModifierStartXY(this.position,this.index),s=e.hasStem()?e.getStemDirection():at.UP;let n=i.x+this.xShift+this.xOffset,o={};e.hasStem()&&(o=e.checkStem().getExtents());let a=i.y+this.yShift+this.yOffset;switch(this.position){case W.Position.ABOVE:a=e.getYs().reduce((t,e)=>t<e?t:e),e.hasStem()&&s===at.UP&&(a=o.topY+B.get("StringNumber.stemPadding")),a-=this.radius+B.get("StringNumber.verticalPadding")+this.textLine*K.STAVE_LINE_DISTANCE;break;case W.Position.BELOW:a=e.getYs().reduce((t,e)=>t>e?t:e),e.hasStem()&&s===at.DOWN&&(a=o.topY-B.get("StringNumber.stemPadding")),a+=this.radius+B.get("StringNumber.verticalPadding")+this.textLine*K.STAVE_LINE_DISTANCE;break;case W.Position.LEFT:n-=this.radius/2+B.get("StringNumber.leftPadding");break;case W.Position.RIGHT:n+=this.radius/2+B.get("StringNumber.rightPadding");break;default:throw new p("InvalidPosition",`The position ${this.position} is invalid`)}this.drawCircle&&(t.beginPath(),t.arc(n,a,this.radius,0,2*Math.PI,!1),t.setLineWidth(1.5),t.stroke()),t.setFont(this.fontInfo);const r=n-t.measureText(this.stringNumber).width/2;t.fillText(""+this.stringNumber,r,a+4.5);const h=this.lastNote;if(it(h)){const i=h.getStemX()-e.getX()+5;let s,o;switch(t.setLineCap("round"),t.setLineWidth(.6),this.dashed?We.drawDashedLine(t,n+10,a,n+i,a,[3,3]):We.drawDashedLine(t,n+10,a,n+i,a,[3,0]),this.leg){case We.LineEndType.UP:s=-10,o=this.dashed?[3,3]:[3,0],We.drawDashedLine(t,n+i,a,n+i,a+s,o);break;case We.LineEndType.DOWN:s=10,o=this.dashed?[3,3]:[3,0],We.drawDashedLine(t,n+i,a,n+i,a+s,o)}}}}class Ge extends W{static get CATEGORY(){return"Stroke"}static format(t,e){const i=e.leftShift;if(!t||0===t.length)return!1;const s=t.map(t=>{const e=t.getNote(),i=t.checkIndex();if(et(e)){const{line:s}=e.getKeyProps()[i];return{line:s,shift:e.getLeftDisplacedHeadPx(),stroke:t}}if(st(e)){const{str:s}=e.getPositions()[i];return{line:s,shift:0,stroke:t}}throw new p("Internal","Unexpected instance.")}),n=i,o=s.reduce((t,{stroke:e,shift:i})=>(e.setXShift(n+i),Math.max(e.getWidth()+5,t)),0);return e.leftShift+=o,!0}constructor(t,e){super(),this.boundingBox=new D(0,0,0,0),this.options=Object.assign({allVoices:!0},e),this.allVoices=this.options.allVoices,this.type=t,this.position=W.Position.LEFT,this.renderOptions={fontScale:B.get("Stroke.fontSize")},this.setXShift(0),this.setWidth(10)}getPosition(){return this.position}addEndNote(t){return this.noteEnd=t,this}draw(){const t=this.checkContext(),e=this.checkAttachedNote();this.setRendered();const i=e.getModifierStartXY(this.position,this.index);let s=e.getYs(),n=i.y,o=i.y;const a=i.x-5,r=e.checkStave().getSpacingBetweenLines(),h=this.checkModifierContext().getMembers(e.getCategory());for(let t=0;t<h.length;t++){const e=h[t];if(tt(e)){s=e.getYs();for(let e=0;e<s.length;e++)(this.note===h[t]||this.allVoices)&&(n=Math.min(n,s[e]),o=Math.max(o,s[e]))}}let c="",l=0,d=0;switch(this.type){case Ge.Type.BRUSH_DOWN:case Ge.Type.ROLL_DOWN:case Ge.Type.RASGUEADO_DOWN:c=I.arrowheadBlackUp,l=n,n-=r/2,o+=r/2;break;case Ge.Type.BRUSH_UP:case Ge.Type.ROLL_UP:case Ge.Type.RASGUEADO_UP:c=I.arrowheadBlackDown,l=o+r,n-=r/2;break;case Ge.Type.ARPEGGIO_DIRECTIONLESS:n-=r/2,o+=r/2;break;default:throw new p("InvalidType",`The stroke type ${this.type} does not exist`)}if(this.type===Ge.Type.BRUSH_DOWN||this.type===Ge.Type.BRUSH_UP)t.fillRect(a+this.xShift,n,1,o-n),this.boundingBox=new D(a+this.xShift,n,1,o-n);else{const e=c===I.arrowheadBlackDown?I.wiggleArpeggiatoDown:I.wiggleArpeggiatoUp;let i="";const s=new P;for(;s.getWidth()<o-n;)i+=e,s.setText(i);this.type===Ge.Type.RASGUEADO_DOWN||this.type===Ge.Type.ROLL_DOWN||this.type===Ge.Type.ARPEGGIO_DIRECTIONLESS?(t.openRotation(90,a+this.xShift,n),s.renderText(t,a+this.xShift,n-s.getTextMetrics().actualBoundingBoxDescent+s.getHeight()/2),t.closeRotation(),d=n+s.getWidth()+5,this.boundingBox=new D(a+this.xShift-s.getHeight()/2,n-s.getTextMetrics().actualBoundingBoxDescent+s.getHeight()/2,s.getHeight(),s.getWidth())):(t.openRotation(-90,a+this.xShift,o),s.renderText(t,a+this.xShift,o-s.getTextMetrics().actualBoundingBoxDescent+s.getHeight()/2),t.closeRotation(),d=o-s.getWidth()-5,this.boundingBox=new D(a+this.xShift-s.getHeight()/2,o-s.getTextMetrics().actualBoundingBoxDescent+s.getHeight()/2-s.getWidth(),s.getHeight(),s.getWidth()))}if(0!==l){const e=new P;e.setText(c),e.renderText(t,a+this.xShift-e.getWidth()/2,l),this.boundingBox.mergeWith(new D(a+this.xShift-e.getWidth()/2,l-e.getHeight(),e.getWidth(),e.getHeight()))}if(this.type===Ge.Type.RASGUEADO_DOWN||this.type===Ge.Type.RASGUEADO_UP){const e=new P("Stroke.text");e.setText("R"),e.renderText(t,a+this.xShift-e.getWidth()/2,d+(this.type===Ge.Type.RASGUEADO_DOWN?e.getHeight():0)),this.boundingBox.mergeWith(new D(a+this.xShift-e.getWidth()/2,d+(this.type===Ge.Type.RASGUEADO_DOWN?e.getHeight():0)-e.getHeight(),e.getWidth(),e.getHeight()))}}getBoundingBox(){return this.boundingBox}}Ge.Type={BRUSH_DOWN:1,BRUSH_UP:2,ROLL_DOWN:3,ROLL_UP:4,RASGUEADO_DOWN:5,RASGUEADO_UP:6,ARPEGGIO_DIRECTIONLESS:7};class Ue extends W{static get CATEGORY(){return"Vibrato"}static format(t,e,i){if(!t||0===t.length)return!1;let s=e.topTextLine,n=0,o=e.rightShift-7;const a=i.getMembers(Ot.CATEGORY);if(a&&a.length>0){s-=a.map(t=>t.getTextHeight()).reduce((t,e)=>t>e?t:e)/K.STAVE_LINE_DISTANCE+1}else e.topTextLine+=1;for(let e=0;e<t.length;++e){const i=t[e];i.setXShift(o),i.setTextLine(s),n+=i.getWidth(),o+=n}return e.rightShift+=n,!0}constructor(){super(),this.position=W.Position.RIGHT,this.renderOptions={code:60080,width:20},this.setVibratoWidth(this.renderOptions.width)}setVibratoWidth(t){this.renderOptions.width=t,this.text=String.fromCodePoint(this.renderOptions.code);const e=this.getWidth();if(!e)throw new p("Cannot set vibrato width if width is 0");const i=Math.round(this.renderOptions.width/e);for(let t=1;t<i;t++)this.text+=String.fromCodePoint(this.renderOptions.code);return this}setVibratoCode(t){return this.renderOptions.code=t,this.setVibratoWidth(this.renderOptions.width)}draw(){const t=this.checkContext(),e=this.checkAttachedNote();this.setRendered();const i=e.getModifierStartXY(W.Position.RIGHT,this.index).x,s=e.getYForTopText(this.textLine)+5;this.renderText(t,i,s)}}function Ve(...t){Xe.DEBUG&&S("VexFlow.ModifierContext",t)}class Xe{constructor(){this.state={leftShift:0,rightShift:0,textLine:0,topTextLine:0},this.members={},this.preFormatted=!1,this.postFormatted=!1,this.formatted=!1,this.width=0,this.spacing=0,this.annotationRightShift=0}addModifier(t){return Ve("addModifier is deprecated, use addMember instead."),this.addMember(t)}addMember(t){const e=t.getCategory();return this.members[e]||(this.members[e]=[]),this.members[e].push(t),t.setModifierContext(this),this.preFormatted=!1,this}getModifiers(t){return Ve("getModifiers is deprecated, use getMembers instead."),this.getMembers(t)}getMembers(t){var e;return null!==(e=this.members[t])&&void 0!==e?e:[]}getWidth(){return this.width}getLeftShift(){return this.state.leftShift}getRightShift(){return this.state.rightShift}getRightShiftForTie(){return this.state.rightShift-this.annotationRightShift}getState(){return this.state}getMetrics(){if(!this.formatted)throw new p("UnformattedMember","Unformatted member has no metrics.");return{width:this.state.leftShift+this.state.rightShift+this.spacing,spacing:this.spacing}}preFormat(){var t;if(this.preFormatted)return;Ve("Preformatting ModifierContext");const e=this.state,i=this.members;xe.format(i.StaveNote,e),De.format(i.Parenthesis,e),ie.format(i.Dot,e),se.format(i.FretHandFinger,e),ot.format(i.Accidental,e),Ge.format(i.Stroke,e),ve.format(i.GraceNoteGroup,e),Be.format(i.NoteSubGroup,e),He.format(i.StringNumber,e),xt.format(i.Articulation,e),Ce.format(i.Ornament,e);const s=null!==(t=i.Annotation)&&void 0!==t?t:[],n=t=>t.getVerticalJustification()===ct.VerticalJustify.TOP||t.getVerticalJustification()===ct.VerticalJustify.BOTTOM;ct.format(s.filter(t=>!n(t)),e);const o=e.rightShift;ct.format(s.filter(n),e);const a=e.rightShift;e.rightShift=o,Kt.format(i.ChordSymbol,e),Ot.format(i.Bend,e),Ue.format(i.Vibrato,e,this),this.annotationRightShift=Math.max(0,a-e.rightShift),e.rightShift+=this.annotationRightShift,this.width=e.leftShift+e.rightShift,this.preFormatted=!0}postFormat(){this.postFormatted||(Ve("Postformatting ModifierContext"),xe.postFormat(this.getMembers("StaveNote")))}}Xe.DEBUG=!1;class Ye extends Ct{static get CATEGORY(){return"KeySignature"}constructor(t,e,i){super(),this.accList=[],this.setKeySig(t,e,i),this.setPosition(kt.BEGIN),this.children=[],this.paddingForced=!1}convertToGlyph(t,e,i){const s=K.accidentalCodes(t.type),n=new P("KeySignature");n.setText(s);let o=1;if(n.setYShift(i.getYForLine(t.line)),this.children.length>0){const t=this.children[this.children.length-1],e=t=>t.getText()===I.accidentalNatural,i=(t,e)=>Math.abs(e.getYShift()-t.getYShift());(e(t)||e(n))&&i(t,n)<10&&(o=2),n.setXShift(t.getXShift()+t.getWidth()+o)}this.children.push(n),this.width+=n.getWidth()+o}cancelKey(t){return this.formatted=!1,this.cancelKeySpec=t,this}convertToCancelAccList(t){const e=K.keySignature(t),i=this.accList.length>0&&e.length>0&&e[0].type!==this.accList[0].type,s=i?e.length:e.length-this.accList.length;if(s<1)return;const n=[];for(let t=0;t<s;t++){let o=t;i||(o=e.length-s+t);const a=e[o];n.push({type:"n",line:a.line})}return this.accList=n.concat(this.accList),{accList:n,type:e[0].type}}addToStave(t){return this.paddingForced=!0,t.addModifier(this),this}setStave(t){return this.formatted=!1,super.setStave(t)}getBoundingBox(){return this.formatted||this.format(),super.getBoundingBox()}calculateDimensions(){let t;t=this.children.length>0?this.children[0].getBoundingBox():new D(this.x+this.xShift,this.y+this.yShift,0,0),this.children.forEach(e=>{t.mergeWith(e.getBoundingBox())}),this.width=t.getW(),this.height=t.getH(),this.y=t.getY()}convertAccLines(t,e,i=this.accList){let s,n,o=0;switch(t){case"soprano":"#"===e?s=[2.5,.5,2,0,1.5,-.5,1]:o=-1;break;case"mezzo-soprano":"b"===e?s=[0,2,.5,2.5,1,3,1.5]:o=1.5;break;case"alto":o=.5;break;case"tenor":"#"===e?s=[3,1,2.5,.5,2,0,1.5]:o=-.5;break;case"baritone-f":case"baritone-c":"b"===e?s=[.5,2.5,1,3,1.5,3.5,2]:o=2;break;case"bass":case"french":o=1}if(void 0!==s)for(n=0;n<i.length;++n)i[n].line=s[n];else if(0!==o)for(n=0;n<i.length;++n)i[n].line+=o}getPadding(t){return this.formatted||this.format(),0===this.children.length||!this.paddingForced&&t<2?0:this.padding}getWidth(){return this.formatted||this.format(),this.width}setKeySig(t,e,i){return this.formatted=!1,this.keySpec=t,this.cancelKeySpec=e,this.alterKeySpec=i,this}alterKey(t){return this.formatted=!1,this.alterKeySpec=t,this}convertToAlterAccList(t){const e=Math.min(t.length,this.accList.length);for(let i=0;i<e;++i)t[i]&&(this.accList[i].type=t[i])}format(){let t=this.getStave();t||(t=new ti(0,0,100),this.setStave(t)),this.width=0,this.children=[],this.accList=K.keySignature(f(this.keySpec));const e=this.accList,i=e.length>0?e[0].type:void 0;let s;if(this.cancelKeySpec&&(s=this.convertToCancelAccList(this.cancelKeySpec)),this.alterKeySpec&&this.convertToAlterAccList(this.alterKeySpec),this.accList.length>0){const n=(this.position===kt.END?t.getEndClef():t.getClef())||t.getClef();s&&this.convertAccLines(n,s.type,s.accList),this.convertAccLines(n,i,e);for(let e=0;e<this.accList.length;++e)this.convertToGlyph(this.accList[e],this.accList[e+1],t)}this.calculateDimensions(),this.formatted=!0}draw(){const t=this.checkStave().checkContext();this.formatted||this.format(),this.setRendered();const e=this.getAttribute("class");t.openGroup("keysignature"+(e?" "+e:""),this.getAttribute("id"));for(let e=0;e<this.children.length;e++){this.children[e].renderText(t,this.x,0)}this.drawPointerRect(),t.closeGroup()}}class _e extends Ct{static get CATEGORY(){return"Repetition"}constructor(t,e,i){super(),this.symbolType=t,this.x=e,this.xShift=0,this.yShift=i}setShiftX(t){return this.xShift=t,this}setShiftY(t){return this.yShift=t,this}draw(){const t=this.checkStave(),e=t.getModifierXShift(this.getPosition());switch(this.setRendered(),this.symbolType){case _e.type.CODA_RIGHT:this.drawCodaFixed(t,e+t.getWidth());break;case _e.type.CODA_LEFT:this.drawSymbolText(t,e,"Coda",!0);break;case _e.type.SEGNO_LEFT:this.drawSegnoFixed(t,e);break;case _e.type.SEGNO_RIGHT:this.drawSegnoFixed(t,e+t.getWidth());break;case _e.type.DC:this.drawSymbolText(t,e,"D.C.",!1);break;case _e.type.DC_AL_CODA:this.drawSymbolText(t,e,"D.C. al",!0);break;case _e.type.DC_AL_FINE:this.drawSymbolText(t,e,"D.C. al Fine",!1);break;case _e.type.DS:this.drawSymbolText(t,e,"D.S.",!1);break;case _e.type.DS_AL_CODA:this.drawSymbolText(t,e,"D.S. al",!0);break;case _e.type.DS_AL_FINE:this.drawSymbolText(t,e,"D.S. al Fine",!1);break;case _e.type.FINE:this.drawSymbolText(t,e,"Fine",!1);break;case _e.type.TO_CODA:this.drawSymbolText(t,e,"To",!0)}}drawCodaFixed(t,e){const i=t.getYForTopText(t.getNumLines());return this.text=I.coda,this.renderText(t.checkContext(),e,i+B.get("Repetition.coda.offsetY")),this}drawSegnoFixed(t,e){const i=t.getYForTopText(t.getNumLines());return this.text=I.segno,this.renderText(t.checkContext(),e,i+B.get("Repetition.segno.offsetY")),this}drawSymbolText(t,e,i,s){const n=t.checkContext();let o=0;switch(this.text=i,s&&(this.text+=" "),this.setFont(B.getFontInfo("Repetition.text")),this.symbolType){case _e.type.CODA_LEFT:o=t.getVerticalBarWidth();break;case _e.type.DC:case _e.type.DC_AL_FINE:case _e.type.DS:case _e.type.DS_AL_FINE:case _e.type.FINE:default:o=e-(t.getNoteStartX()-this.x)+t.getWidth()-this.width-B.get("Repetition.text.offsetX")}const a=t.getYForTopText(t.getNumLines())+B.get("Repetition.text.offsetY");return this.renderText(n,o,a),this}}_e.type={NONE:1,CODA_LEFT:2,CODA_RIGHT:3,SEGNO_LEFT:4,SEGNO_RIGHT:5,DC:6,DC_AL_CODA:7,DC_AL_FINE:8,DS:9,DS_AL_CODA:10,DS_AL_FINE:11,FINE:12,TO_CODA:13};class ze extends Ct{static get CATEGORY(){return"StaveSection"}constructor(t,e=0,i=0,s=!0){super(),this.setText(t),this.x=e,this.yShift=i,this.drawRect=s,this.padding=B.get("StaveSection.padding")}setDrawRect(t){return this.drawRect=t,this}draw(){const t=this.checkStave(),e=t.checkContext();this.setRendered(),this.x=t.getX()+t.getModifierXShift(this.getPosition());const i=-1*this.textMetrics.actualBoundingBoxDescent,s=this.width+2*this.padding,n=this.height+2*this.padding,o=t.getYForTopText(1.5)+this.yShift,a=this.x+this.xShift;this.drawRect&&(e.beginPath(),e.rect(a,o-n+i,s,n),e.stroke()),this.renderText(e,this.xShift+this.padding,o-this.padding)}}class je extends Ct{static get CATEGORY(){return"StaveTempo"}constructor(t,e,i){super(),this.durationToCode={"1/4":I.metNoteDoubleWholeSquare,long:I.metNoteDoubleWholeSquare,"1/2":I.metNoteDoubleWhole,breve:I.metNoteDoubleWhole,1:I.metNoteWhole,whole:I.metNoteWhole,w:I.metNoteWhole,2:I.metNoteHalfUp,half:I.metNoteHalfUp,h:I.metNoteHalfUp,4:I.metNoteQuarterUp,quarter:I.metNoteQuarterUp,q:I.metNoteQuarterUp,8:I.metNote8thUp,eighth:I.metNote8thUp,16:I.metNote16thUp,"16th":I.metNote16thUp,32:I.metNote32ndUp,"32nd":I.metNote32ndUp,64:I.metNote64thUp,"64th":I.metNote64thUp,128:I.metNote128thUp,"128th":I.metNote128thUp,256:I.metNote256thUp,"256th":I.metNote256thUp,512:I.metNote512thUp,"512th":I.metNote512thUp,1024:I.metNote1024thUp,"1024th":I.metNote1024thUp},this.tempo=t,this.position=kt.ABOVE,this.x=e,this.setXShift(10),this.setYShift(i)}setTempo(t){return this.tempo=t,this}draw(){const t=this.checkStave(),e=t.getModifierXShift(this.getPosition()),i=t.checkContext();this.setRendered();const{name:s,duration:n,dots:o,bpm:a,duration2:r,dots2:h,parenthesis:c}=this.tempo;let l=this.x+e;const d=t.getYForTopText(1),u=new P("StaveTempo.glyph"),g=new P("StaveTempo");if(s&&(this.text=s,this.fontInfo=B.getFontInfo("StaveTempo.name"),this.renderText(i,e,d),l+=this.getWidth()+3),(s&&n||c)&&(g.setText("("),g.renderText(i,l+this.xShift,d+this.yShift),l+=g.getWidth()+3),n){if(u.setText(this.durationToCode[n]),u.renderText(i,l+this.xShift,d+this.yShift),l+=u.getWidth()+3,o){u.setText(I.metAugmentationDot);for(let t=0;t<o;t++)u.renderText(i,l+this.xShift,d+2+this.yShift),l+=u.getWidth()+3}if(g.setText("="),g.renderText(i,l+this.xShift,d+this.yShift),l+=g.getWidth()+3,r){if(u.setText(this.durationToCode[r]),u.renderText(i,l+this.xShift,d+this.yShift),l+=u.getWidth()+3,h){u.setText(I.metAugmentationDot);for(let t=0;t<h;t++)u.renderText(i,l+this.xShift,d+2+this.yShift),l+=u.getWidth()+3}}else a&&(g.setText(""+a),g.renderText(i,l+this.xShift,d+this.yShift),l+=g.getWidth()+3);(s||c)&&(g.setText(")"),g.renderText(i,l+this.xShift,d+this.yShift))}}}!function(t){t[t.LEFT=1]="LEFT",t[t.CENTER=2]="CENTER",t[t.RIGHT=3]="RIGHT"}(Me||(Me={}));class qe extends yt{static get CATEGORY(){return"TextNote"}static get GLYPHS(){return{segno:I.segno,tr:I.ornamentTrill,mordent:I.ornamentMordent,mordentUpper:I.ornamentShortTrill,mordentLower:I.ornamentMordent,f:I.dynamicForte,p:I.dynamicPiano,m:I.dynamicMezzo,s:I.dynamicSforzando,z:I.dynamicZ,coda:I.coda,pedalOpen:I.keyboardPedalPed,pedalClose:I.keyboardPedalUp,caesuraStraight:I.caesura,caesuraCurved:I.caesuraCurved,breath:I.breathMarkComma,tick:I.breathMarkTick,turn:I.ornamentTurn,turnInverted:I.ornamentTurnSlash}}constructor(t){var e,i;super(t),this.text=null!==(e=t.text)&&void 0!==e?e:"",t.glyph&&(this.text+=qe.GLYPHS[t.glyph]||t.glyph),t.font?this.setFont(t.font):void 0===t.glyph&&this.setFont(B.getFontInfo("TextNote.text"));const s=.769231*A.convertSizeToPointValue(this.fontInfo.size);t.superscript&&(this.superscript=new P("TextNote.text"),this.superscript.setText(t.superscript),this.superscript.setFontSize(s)),t.subscript&&(this.subscript=new P("TextNote.text"),this.subscript.setText(t.subscript),this.subscript.setFontSize(s)),this.line=null!==(i=t.line)&&void 0!==i?i:0,this.smooth=t.smooth||!1,this.ignoreTicks=t.ignoreTicks||!1,this.justification=Me.LEFT}setJustification(t){return this.justification=t,this}setLine(t){return this.line=t,this}getLine(){return this.line}preFormat(){if(this.preFormatted)return;const t=this.checkTickContext("Can't preformat without a TickContext.");this.justification===Me.CENTER?this.leftDisplacedHeadPx=this.width/2:this.justification===Me.RIGHT&&(this.leftDisplacedHeadPx=this.width),this.rightDisplacedHeadPx=t.getMetrics().glyphPx/2,this.preFormatted=!0}draw(){const t=this.checkContext(),e=this.checkStave(),i=this.checkTickContext("Can't draw without a TickContext.");this.setRendered();let s=this.getAbsoluteX()+i.getMetrics().glyphPx/2;const n=this.getWidth();this.justification===Me.CENTER?s-=n/2:this.justification===Me.RIGHT&&(s-=n);const o=e.getYForLine(this.line+-3);this.renderText(t,s,o);const a=this.getHeight();this.superscript&&this.superscript.renderText(t,s+this.width+2,o-a/2.2),this.subscript&&this.subscript.renderText(t,s+this.width+2,o+a/2.2-1)}}qe.Justification=Me;class Ke extends Ct{static get CATEGORY(){return"StaveText"}constructor(t,e,i={}){var s,n,o;super(),this.setText(t),this.setXShift(null!==(s=i.shiftX)&&void 0!==s?s:0),this.setYShift(null!==(n=i.shiftY)&&void 0!==n?n:0),this.position=e,this.justification=null!==(o=i.justification)&&void 0!==o?o:qe.Justification.CENTER}draw(){const t=this.checkStave(),e=t.checkContext();let i,s;switch(this.setRendered(),this.position){case kt.LEFT:case kt.RIGHT:s=(t.getYForLine(0)+t.getBottomLineY())/2,i=this.position===kt.LEFT?t.getX()-this.width-24:t.getX()+t.getWidth()+24;break;case kt.ABOVE:case kt.BELOW:i=t.getX(),this.justification===Me.CENTER?i+=t.getWidth()/2-this.width/2:this.justification===Me.RIGHT&&(i+=t.getWidth()-this.width),s=this.position===kt.ABOVE?t.getYForTopText(2):t.getYForBottomText(2);break;default:throw new p("InvalidPosition","Value Must be in Modifier.Position.")}this.renderText(e,i,s+4)}}!function(t){t[t.NONE=1]="NONE",t[t.BEGIN=2]="BEGIN",t[t.MID=3]="MID",t[t.END=4]="END",t[t.BEGIN_END=5]="BEGIN_END"}(Ie||(Ie={}));class $e extends Ct{static get CATEGORY(){return"Volta"}static get type(){return Ie}constructor(t,e,i,s){super(),this.type=t,this.x=i,this.yShift=s,this.text=e}draw(){const t=this.checkStave(),e=t.getModifierXShift(this.getPosition()),i=t.checkContext();this.setRendered();let s=t.getWidth()-e;const n=t.getYForTopText(t.getNumLines())+this.yShift,o=1.5*t.getSpacingBetweenLines();switch(this.type){case Ie.BEGIN:i.fillRect(this.x+e,n,1,o);break;case Ie.END:s-=5,i.fillRect(this.x+e+s,n,1,o);break;case Ie.BEGIN_END:s-=3,i.fillRect(this.x+e,n,1,o),i.fillRect(this.x+e+s,n,1,o)}this.type!==Ie.BEGIN&&this.type!==Ie.BEGIN_END||this.renderText(i,e+5,n-this.yShift+15),i.fillRect(this.x+e,n,s,1)}}class Qe extends Ct{static get CATEGORY(){return"TimeSignature"}constructor(t="4/4",e=15,i=!0){super(),this.topRenderY=0,this.botRenderY=0,this.timeSpec="4/4",this.line=0,this.isNumeric=!0,this.topStartX=0,this.botStartX=0,this.lineShift=0,this.topText=new P,this.botText=new P,this.validateArgs=i;const s=e;this.topLine=1,this.bottomLine=3,this.setPosition(kt.BEGIN),this.setTimeSig(t),this.setPadding(s)}static getTimeSigCode(t,e=!1){let i=I.null;switch(t){case"C":i=I.timeSigCommon;break;case"C|":i=I.timeSigCutCommon;break;case"+":i=e?I.timeSigPlusSmall:I.timeSigPlus;break;case"-":i=I.timeSigMinus;break;case"(":i=e?I.timeSigParensLeftSmall:I.timeSigParensLeft;break;case")":i=e?I.timeSigParensRightSmall:I.timeSigParensRight;break;default:i=String.fromCodePoint(57472+Number(t[0]))}return i}makeTimeSignatureGlyph(t,e){let i="",s=0,n=0;for(let s=0;s<t.length;++s){i+=Qe.getTimeSigCode(t[s],e.length>0)}this.topText.setText(i),s=this.topText.getWidth(),n=this.topText.getHeight();let o=0;i="";for(let t=0;t<e.length;++t){i+=Qe.getTimeSigCode(e[t],!0)}this.botText.setText(i),o=this.botText.getWidth(),n=Math.max(n,this.botText.getHeight()),this.lineShift=n>30?.5:0,this.width=Math.max(s,o),this.topStartX=(this.width-s)/2,this.botStartX=(this.width-o)/2}setTimeSig(t){var e,i;if(this.timeSpec=t,"C"===t||"C|"===t){const e=Qe.getTimeSigCode(t);this.line=2,this.text=e,this.isNumeric=!1}else{this.validateArgs&&(t=>{t.split("/").forEach(e=>{if(!1===/^[0-9+\-()]+$/.test(e))throw new p("BadTimeSignature",`Invalid time spec: ${t}. Must contain valid signatures.`)})})(t);const s=t.split("/");this.line=0,this.isNumeric=!0,this.makeTimeSignatureGlyph(null!==(e=s[0])&&void 0!==e?e:"",null!==(i=s[1])&&void 0!==i?i:"")}return this}getTimeSpec(){return this.timeSpec}getLine(){return this.line}setLine(t){this.line=t}getIsNumeric(){return this.isNumeric}setIsNumeric(t){this.isNumeric=t}draw(){const t=this.checkStave(),e=t.checkContext();this.setRendered();const i=this.getAttribute("class");e.openGroup("timesignature"+(i?" "+i:""),this.getAttribute("id")),this.drawAt(e,t,this.x),this.drawPointerRect(),e.closeGroup()}drawAt(t,e,i){if(this.setRendered(),this.isNumeric){let s=i+this.topStartX;this.botText.getText().length>0?this.topRenderY=e.getYForLine(this.topLine-this.lineShift):this.topRenderY=(e.getYForLine(this.topLine)+e.getYForLine(this.bottomLine))/2,this.topText.renderText(t,s,this.topRenderY),s=i+this.botStartX,this.botRenderY=e.getYForLine(this.bottomLine+this.lineShift),this.botText.renderText(t,s,this.botRenderY)}else this.renderText(t,i-this.x,e.getYForLine(this.line))}getBoundingBox(){if(this.isNumeric){const t=this.topText.getBoundingBox(),e=this.botText.getBoundingBox();t.move(this.x+this.topStartX,this.topRenderY),e.move(this.x+this.botStartX,this.botRenderY);return t.mergeWith(e)}{const t=this.checkStave(),e=super.getBoundingBox();return e.move(0,t.getYForLine(this.line)),e}}}const Je={[Dt.CATEGORY]:0,[$t.CATEGORY]:1,[Ye.CATEGORY]:2,[Qe.CATEGORY]:3},Ze={[Qe.CATEGORY]:0,[Ye.CATEGORY]:1,[Dt.CATEGORY]:2,[$t.CATEGORY]:3};class ti extends P{static get CATEGORY(){return"Stave"}static get defaultPadding(){return B.get("Stave.padding")+B.get("Stave.endPaddingMax")}static get rightPadding(){return B.get("Stave.endPaddingMax")}constructor(t,e,i,s){super(),this.x=t,this.y=e,this.width=i,this.formatted=!1,this.startX=t+5,this.endX=t+i,this.modifiers=[],this.measure=0,this.clef="treble",this.endClef=void 0,this.options=Object.assign({verticalBarWidth:10,numLines:5,leftBar:!0,rightBar:!0,spacingBetweenLinesPx:K.STAVE_LINE_DISTANCE,spaceAboveStaffLn:4,spaceBelowStaffLn:4,topTextPosition:1,bottomTextPosition:4,lineConfig:[]},s),this.bounds={x:this.x,y:this.y,w:this.width,h:0},this.defaultLedgerLineStyle={lineWidth:2},this.resetLines(),this.addModifier(new Dt(this.options.leftBar?vt.SINGLE:vt.NONE)),this.addEndModifier(new Dt(this.options.rightBar?vt.SINGLE:vt.NONE))}setDefaultLedgerLineStyle(t){this.defaultLedgerLineStyle=t}getDefaultLedgerLineStyle(){var t;const e=void 0!==(null===(t=this.getContext())||void 0===t?void 0:t.getDefaultStyle().strokeStyle)?{}:{strokeStyle:"#444"};return Object.assign(Object.assign(Object.assign({},e),this.styleExplicit?this.getStyle():{}),this.defaultLedgerLineStyle)}space(t){return this.options.spacingBetweenLinesPx*t}resetLines(){this.options.lineConfig=[];for(let t=0;t<this.options.numLines;t++)this.options.lineConfig.push({visible:!0});this.height=(this.options.numLines+this.options.spaceAboveStaffLn)*this.options.spacingBetweenLinesPx,this.options.bottomTextPosition=this.options.numLines}setNoteStartX(t){return this.formatted||this.format(),this.startX=t,this}getNoteStartX(){return this.formatted||this.format(),this.startX}getNoteEndX(){return this.formatted||this.format(),this.endX}getTieStartX(){return this.startX}getTieEndX(){return this.endX}getNumLines(){return this.options.numLines}setNumLines(t){return this.options.numLines=t,this.resetLines(),this}getTopLineTopY(){return this.getYForLine(0)}getBottomLineBottomY(){var t;return this.getYForLine(this.getNumLines()-1)+(null!==(t=this.getStyle().lineWidth)&&void 0!==t?t:1)}setX(t){const e=t-this.x;this.formatted=!1,this.x=t,this.startX+=e,this.endX+=e;for(let t=0;t<this.modifiers.length;t++){const i=this.modifiers[t];i.setX(i.getX()+e)}return this}setWidth(t){return this.formatted=!1,this.width=t,this.endX=this.x+t,this}setMeasure(t){return this.measure=t,this}getMeasure(){return this.measure}getModifierXShift(t=0){if("number"!=typeof t)throw new p("InvalidIndex","Must be of number type");if(this.formatted||this.format(),1===this.getModifiers(kt.BEGIN).length)return 0;if(this.modifiers[t].getPosition()===kt.RIGHT)return 0;let e=this.startX-this.x;const i=this.modifiers[0];return i.getType()===vt.REPEAT_BEGIN&&e>i.getWidth()&&(e-=i.getWidth()),e}setRepetitionType(t,e=0){return this.modifiers.push(new _e(t,this.x,e)),this}setVoltaType(t,e,i){return this.modifiers.push(new $e(t,e,this.x,i)),this}setSection(t,e,i=0,s,n=!0){const o=new ze(t).setYShift(e).setXShift(i).setDrawRect(n);return s&&o.setFontSize(s),this.addModifier(o),this}setTempo(t,e){return this.modifiers.push(new je(t,this.x,e)),this}setStaveText(t,e,i={}){return this.modifiers.push(new Ke(t,e,i)),this}getSpacingBetweenLines(){return this.options.spacingBetweenLinesPx}getBoundingBox(){return new D(this.x,this.y,this.width,this.getBottomY()-this.y)}getBottomY(){const t=this.options,e=t.spacingBetweenLinesPx;return this.getYForLine(t.numLines)+t.spaceBelowStaffLn*e}getBottomLineY(){return this.getYForLine(this.options.numLines)}getYForLine(t){const e=this.options,i=e.spacingBetweenLinesPx,s=e.spaceAboveStaffLn;return this.y+t*i+s*i}getLineForY(t){const e=this.options,i=e.spacingBetweenLinesPx,s=e.spaceAboveStaffLn;return(t-this.y)/i-s}getYForTopText(t=0){return this.getYForLine(-t-this.options.topTextPosition)}getYForBottomText(t=0){return this.getYForLine(this.options.bottomTextPosition+t)}getYForNote(t){const e=this.options,i=e.spacingBetweenLinesPx,s=e.spaceAboveStaffLn;return this.y+s*i+5*i-t*i}getYForGlyphs(){return this.getYForLine(3)}addModifier(t,e){return void 0!==e&&t.setPosition(e),t.setStave(this),this.formatted=!1,this.modifiers.push(t),this}addEndModifier(t){return this.addModifier(t,kt.END),this}setBegBarType(t,e=Bt.NONE){const{SINGLE:i,REPEAT_BEGIN:s,NONE:n}=vt;return t!==i&&t!==s&&t!==n||(this.modifiers[0].setType(t).setRepeatBracket(e),this.formatted=!1),this}setEndBarType(t,e=Bt.NONE){return t!==vt.REPEAT_BEGIN&&(this.modifiers[1].setType(t).setRepeatBracket(e),this.formatted=!1),this}setClef(t,e,i,s){void 0===s&&(s=kt.BEGIN),s===kt.END?this.endClef=t:this.clef=t;const n=this.getModifiers(s,$t.CATEGORY);return 0===n.length?this.addClef(t,e,i,s):n[0].setType(t,e,i),this}getClef(){return this.clef}setEndClef(t,e,i){return this.setClef(t,e,i,kt.END),this}getEndClef(){return this.endClef}setKeySignature(t,e,i){void 0===i&&(i=kt.BEGIN);const s=this.getModifiers(i,Ye.CATEGORY);return 0===s.length?this.addKeySignature(t,e,i):s[0].setKeySig(t,e),this}setEndKeySignature(t,e){return this.setKeySignature(t,e,kt.END),this}setTimeSignature(t,e,i){void 0===i&&(i=kt.BEGIN);const s=this.getModifiers(i,Qe.CATEGORY);return 0===s.length?this.addTimeSignature(t,e,i):s[0].setTimeSig(t),this}setEndTimeSignature(t,e){return this.setTimeSignature(t,e,kt.END),this}addKeySignature(t,e,i){return void 0===i&&(i=kt.BEGIN),this.addModifier(new Ye(t,e).setPosition(i),i),this}addClef(t,e,i,s){return void 0===s||s===kt.BEGIN?this.clef=t:s===kt.END&&(this.endClef=t),this.addModifier(new $t(t,e,i),s),this}addEndClef(t,e,i){return this.addClef(t,e,i,kt.END),this}addTimeSignature(t,e,i){return this.addModifier(new Qe(t,e),i),this}addEndTimeSignature(t,e){return this.addTimeSignature(t,e,kt.END),this}addTrebleGlyph(){return this.addClef("treble"),this}getModifiers(t,e){const i=void 0===t,s=void 0===e;return i&&s?this.modifiers:i?this.modifiers.filter(t=>e===t.getCategory()):s?this.modifiers.filter(e=>t===e.getPosition()):this.modifiers.filter(i=>t===i.getPosition()&&e===i.getCategory())}sortByCategory(t,e){for(let i=t.length-1;i>=0;i--)for(let s=0;s<i;s++)if(e[t[s].getCategory()]>e[t[s+1].getCategory()]){const e=t[s];t[s]=t[s+1],t[s+1]=e}}format(){var t,e,i,s;const n=this.modifiers[0],o=this.modifiers[1],a=this.getModifiers(kt.BEGIN),r=this.getModifiers(kt.END);let h,c,l;this.sortByCategory(a,Je),this.sortByCategory(r,Ze),a.length>1&&n.getType()===vt.REPEAT_BEGIN&&(a.push(a.splice(0,1)[0]),a.splice(0,0,new Dt(vt.SINGLE))),r.indexOf(o)>0&&r.splice(0,0,new Dt(vt.NONE));let d=0,u=this.x;for(let t=0;t<a.length;t++)l=a[t],c=l.getPadding(t+d),h=l.getWidth(),u+=c,l.setX(u),u+=h,c+h===0&&d--;this.startX=u,u=this.x+this.width;const g={left:0,right:0,paddingRight:0,paddingLeft:0};let p=0;for(let n=0;n<r.length;n++){l=r[n],p=J(l)?n:p,g.right=0,g.left=0,g.paddingRight=0,g.paddingLeft=0;const o=l.getLayoutMetrics();o?(0!==n&&(g.right=null!==(t=o.xMax)&&void 0!==t?t:0,g.paddingRight=null!==(e=o.paddingRight)&&void 0!==e?e:0),g.left=-(null!==(i=o.xMin)&&void 0!==i?i:0),g.paddingLeft=null!==(s=o.paddingLeft)&&void 0!==s?s:0,n===r.length-1&&(g.paddingLeft=0)):(g.paddingRight=l.getPadding(n-p),0!==n&&(g.right=l.getWidth()),0===n&&(g.left=l.getWidth())),u-=g.paddingRight,u-=g.right,l.setX(u),u-=g.left,u-=g.paddingLeft}this.endX=1===r.length?this.x+this.width:u,this.formatted=!0}draw(){var t;const e=this.checkContext();this.setRendered();const i=this.getAttribute("class");e.openGroup("stave"+(i?" "+i:""),this.getAttribute("id")),this.formatted||this.format();const s=this.options.numLines,n=this.width,o=this.x;let a;const r=(null!==(t=this.getStyle().lineWidth)&&void 0!==t?t:1)%2==0?0:.5;for(let t=0;t<s;t++)a=this.getYForLine(t),this.options.lineConfig[t].visible&&(e.beginPath(),e.moveTo(o,a+r),e.lineTo(o+n,a+r),e.stroke());this.drawPointerRect(),e.closeGroup();for(let t=0;t<this.modifiers.length;t++){const i=this.modifiers[t];i.setContext(e),i.setStave(this),i.drawWithStyle()}if(this.measure>0){e.setFont(this.fontInfo);const t=e.measureText(""+this.measure).width;a=this.getYForTopText(0)+3,e.fillText(""+this.measure,this.x-t/2,a)}}getVerticalBarWidth(){return this.options.verticalBarWidth}getConfigForLines(){return this.options.lineConfig}setConfigForLine(t,e){if(t>=this.options.numLines||t<0)throw new p("StaveConfigError","The line number must be within the range of the number of lines in the Stave.");if(void 0===e.visible)throw new p("StaveConfigError","The line configuration object is missing the 'visible' property.");if("boolean"!=typeof e.visible)throw new p("StaveConfigError","The line configuration objects 'visible' property must be true or false.");return this.options.lineConfig[t]=e,this}setConfigForLines(t){if(t.length!==this.options.numLines)throw new p("StaveConfigError","The length of the lines configuration array must match the number of lines in the Stave");for(const e in t)void 0===t[e].visible&&(t[e]=this.options.lineConfig[e]),this.options.lineConfig[e]=Object.assign(Object.assign({},this.options.lineConfig[e]),t[e]);return this.options.lineConfig=t,this}static formatBegModifiers(t){const e=e=>{let i=0;t.forEach(t=>{const s=t.getModifiers(kt.BEGIN,e);s.length>0&&s[0].getX()>i&&(i=s[0].getX())});let s=0;t.forEach(t=>{s=0;t.getModifiers(kt.BEGIN,e).forEach(t=>{i-t.getX()>s&&(s=i-t.getX())});const n=t.getModifiers(kt.BEGIN);let o=!1;n.forEach(t=>{t.getCategory()===e&&(o=!0),o&&s>0&&t.setX(t.getX()+s)}),t.setNoteStartX(t.getNoteStartX()+s)})};t.forEach(t=>{t.formatted||t.format()}),e("Clef"),e("KeySignature"),e("TimeSignature");let i=0;t.forEach(t=>{t.getNoteStartX()>i&&(i=t.getNoteStartX())}),t.forEach(t=>{t.setNoteStartX(i)}),i=0,t.forEach(t=>{t.getModifiers(kt.BEGIN,"Barline").forEach(t=>{t.getType()===vt.REPEAT_BEGIN&&t.getX()>i&&(i=t.getX())})}),t.forEach(t=>{t.getModifiers(kt.BEGIN,"Barline").forEach(t=>{t.getType()===vt.REPEAT_BEGIN&&t.setX(i)})})}}function ei(t,e,i,s,n){if(e!==ii.type.BOLD_DOUBLE_LEFT&&e!==ii.type.BOLD_DOUBLE_RIGHT)throw new p("InvalidConnector","A REPEAT_BEGIN or REPEAT_END type must be provided.");let o=3,a=3.5;e===ii.type.BOLD_DOUBLE_RIGHT&&(o=-5,a=3),t.fillRect(i+o,s,1,n-s),t.fillRect(i-2,s,a,n-s)}class ii extends P{static get CATEGORY(){return"StaveConnector"}constructor(t,e){super(),this.thickness=K.STAVE_LINE_THICKNESS,this.topStave=t,this.bottomStave=e,this.type=ii.type.DOUBLE,this.xShift=0,this.texts=[]}setType(t){const e="string"==typeof t?ii.typeString[t]:t;return Object.values(ii.type).includes(e)&&(this.type=e),this}getType(){return this.type}setText(t,e={}){var i,s;const n=new P("StaveConnector.text");return n.setText(t),n.setXShift(null!==(i=e.shiftX)&&void 0!==i?i:0),n.setYShift(null!==(s=e.shiftY)&&void 0!==s?s:0),this.texts.push(n),this}draw(){const t=this.checkContext();this.setRendered();let e=this.topStave.getYForLine(0),i=this.bottomStave.getYForLine(this.bottomStave.getNumLines()-1)+this.thickness,s=3,n=this.topStave.getX();(this.type===ii.type.SINGLE_RIGHT||this.type===ii.type.BOLD_DOUBLE_RIGHT||this.type===ii.type.THIN_DOUBLE)&&(n=this.topStave.getX()+this.topStave.getWidth());let o=i-e;const a=new P;switch(this.type){case ii.type.SINGLE:case ii.type.SINGLE_LEFT:case ii.type.SINGLE_RIGHT:s=1;break;case ii.type.DOUBLE:n-=5,e-=this.thickness,o+=.5;break;case ii.type.BRACE:{s=12;const n=this.topStave.getX()-2+this.xShift,a=e,r=n,h=i,c=n-s,l=a+o/2,d=c-.9*s,u=a+.2*o,g=n+1.1*s,p=l-.135*o,m=g,f=l+.135*o,S=d,T=h-.2*o,x=c-s,w=T,b=n+.4*s,y=l+.135*o,k=b,v=l-.135*o,B=x,C=u;t.beginPath(),t.moveTo(n,a),t.bezierCurveTo(d,u,g,p,c,l),t.bezierCurveTo(m,f,S,T,r,h),t.bezierCurveTo(x,w,b,y,c,l),t.bezierCurveTo(k,v,B,C,n,a),t.fill(),t.stroke();break}case ii.type.BRACKET:e-=6,i+=6,o=i-e,a.setText(I.bracketTop),a.renderText(t,n-5,e),a.setText(I.bracketBottom),a.renderText(t,n-5,i),n-=5;break;case ii.type.BOLD_DOUBLE_LEFT:ei(t,this.type,n+this.xShift,e,i-this.thickness);break;case ii.type.BOLD_DOUBLE_RIGHT:ei(t,this.type,n,e,i-this.thickness);break;case ii.type.THIN_DOUBLE:s=1,o-=this.thickness;break;case ii.type.NONE:break;default:throw new p("InvalidType",`The provided StaveConnector.type (${this.type}) is invalid.`)}this.type!==ii.type.BRACE&&this.type!==ii.type.BOLD_DOUBLE_LEFT&&this.type!==ii.type.BOLD_DOUBLE_RIGHT&&this.type!==ii.type.NONE&&t.fillRect(n,e,s,o),this.type===ii.type.THIN_DOUBLE&&t.fillRect(n-3,e,s,o);for(let e=0;e<this.texts.length;e++){const i=this.texts[e],s=this.topStave.getX()-i.getWidth()-24,n=(this.topStave.getYForLine(0)+this.bottomStave.getBottomLineY())/2;i.renderText(t,s,n+4)}}}function si(t,e,i,s){let n=e;for(let e=i+1;e<t.length;e++){const i=t[e];if(tt(i)&&!i.isRest()&&!i.shouldIgnoreTicks()){n=i.getLineForRest();break}}if(s&&e!==n){n=T(Math.max(e,n),Math.min(e,n))}return n}ii.type={SINGLE_RIGHT:0,SINGLE_LEFT:1,SINGLE:1,DOUBLE:2,BRACE:3,BRACKET:4,BOLD_DOUBLE_LEFT:5,BOLD_DOUBLE_RIGHT:6,THIN_DOUBLE:7,NONE:8},ii.typeString={singleRight:ii.type.SINGLE_RIGHT,singleLeft:ii.type.SINGLE_LEFT,single:ii.type.SINGLE,double:ii.type.DOUBLE,brace:ii.type.BRACE,bracket:ii.type.BRACKET,boldDoubleLeft:ii.type.BOLD_DOUBLE_LEFT,boldDoubleRight:ii.type.BOLD_DOUBLE_RIGHT,thinDouble:ii.type.THIN_DOUBLE,none:ii.type.NONE};class ni{static SimpleFormat(t,e=0,{paddingBetween:i=10}={}){t.reduce((t,e)=>{e.addToModifierContext(new Xe);const s=(new Jt).addTickable(e).preFormat(),n=s.getMetrics();return s.setX(t+n.totalLeftPx),t+s.getWidth()+n.totalRightPx+i},e)}static plotDebugging(t,e,i,s,n,o){var a,r;const h=i+(o=Object.assign({stavePadding:B.get("Stave.padding")},o)).stavePadding,c=e.contextGaps;t.save(),t.setFont(B.get("fontFamily"),8),c.gaps.forEach(e=>{var i,o,a;i=h+e.x1,o=h+e.x2,a="rgba(100,200,100,0.4)",t.beginPath(),t.setStrokeStyle(a),t.setFillStyle(a),t.setLineWidth(1),t.fillRect(i,s,Math.max(o-i,0),n-s),t.setFillStyle("green"),t.fillText(Math.round(e.x2-e.x1).toString(),h+e.x1,n+12)}),t.setFillStyle("red"),t.fillText(`Loss: ${(null!==(a=e.totalCost)&&void 0!==a?a:0).toFixed(2)} Shift: ${(null!==(r=e.totalShift)&&void 0!==r?r:0).toFixed(2)} Gap: ${c.total.toFixed(2)}`,h-20,n+27),t.restore()}static FormatAndDraw(t,e,i,s){let n={autoBeam:!1,alignRests:!1};"object"==typeof s?n=Object.assign(Object.assign({},n),s):"boolean"==typeof s&&(n.autoBeam=s);const o=new ke(K.TIME4_4).setMode(ke.Mode.SOFT).addTickables(i),a=n.autoBeam?At.applyAndGetBeams(o):[];return(new ni).joinVoices([o]).formatToStave([o],e,{alignRests:n.alignRests,stave:e}),o.setContext(t).setStave(e).drawWithStyle(),a.forEach(e=>e.setContext(t).drawWithStyle()),o.getBoundingBox()}static FormatAndDrawTab(t,e,i,s,n,o,a){let r={autoBeam:o,alignRests:!1};"object"==typeof a?r=Object.assign(Object.assign({},r),a):"boolean"==typeof a&&(r.autoBeam=a);const h=new ke(K.TIME4_4).setMode(ke.Mode.SOFT).addTickables(n),c=new ke(K.TIME4_4).setMode(ke.Mode.SOFT).addTickables(s),l=r.autoBeam?At.applyAndGetBeams(h):[];(new ni).joinVoices([h]).joinVoices([c]).formatToStave([h,c],i,{alignRests:r.alignRests}),h.draw(t,i),c.draw(t,e),l.forEach(e=>e.setContext(t).drawWithStyle()),new ii(i,e).setContext(t).drawWithStyle()}static AlignRestsToNotes(t,e,i=!1){t.forEach((s,n)=>{if(et(s)&&s.isRest()){if(s.getTuplet()&&!i)return;if(3!==s.getLineForRest())return;if(e||s.getBeam()){const e=s.getKeyProps()[0];if(0===n)e.line=si(t,e.line,n,!1);else if(n>0&&n<t.length){const i=t[n-1];if(et(i))if(i.isRest())e.line=i.getKeyProps()[0].line;else{const s=i.getLineForRest();e.line=si(t,s,n,!0)}}s.setKeyLine(0,e.line)}}})}constructor(t){this.formatterOptions=Object.assign({globalSoftmax:!1,softmaxFactor:K.SOFTMAX_FACTOR,maxIterations:5},t),this.justifyWidth=0,this.totalCost=0,this.totalShift=0,this.durationStats={},this.minTotalWidth=0,this.hasMinTotalWidth=!1,this.tickContexts={map:{},array:[],list:[],resolutionMultiplier:0},this.modifierContexts=[],this.contextGaps={total:0,gaps:[]},this.voices=[],this.lossHistory=[]}alignRests(t,e){if(!t||!t.length)throw new p("BadArgument","No voices to format rests");t.forEach(t=>ni.AlignRestsToNotes(t.getTickables(),e))}preCalculateMinTotalWidth(t){const e=B.get("Stave.unalignedNotePadding");let i=0,s=0,n=0;const o=[],a=[];if(this.hasMinTotalWidth)return this.minTotalWidth;if(!t)throw new p("BadArgument","'voices' required to run preCalculateMinTotalWidth");this.createTickContexts(t);const{list:r,map:h}=this.tickContexts;this.minTotalWidth=0,r.forEach(e=>{const r=h[e];r.preFormat(),r.getTickables().length<t.length&&(i+=1),r.getTickables().forEach(t=>{s+=t.getMetrics().width,n+=t.getTicks().value(),o.push(t.getMetrics().width),a.push(t.getTicks().value())});const c=r.getWidth();this.minTotalWidth+=c}),this.hasMinTotalWidth=!0;const c=s>0?s/o.length:1/o.length,l=b(o.map(t=>Math.pow(t-c,2))),d=Math.pow(l/o.length,.5)/c,u=n/a.length,g=b(a.map(t=>Math.pow(t-u,2))),m=Math.pow(g/a.length,.5)/u,f=Math.max(m,d)*r.length*e,S=e*i;return this.minTotalWidth+Math.max(S,f)}getMinTotalWidth(){if(!this.hasMinTotalWidth)throw new p("NoMinTotalWidth","Call 'preCalculateMinTotalWidth' or 'preFormat' before calling 'getMinTotalWidth'");return this.minTotalWidth}static getResolutionMultiplier(t){if(!t||!t.length)throw new p("BadArgument","No voices to format");const e=t[0].getTotalTicks();return t.reduce((t,i)=>{if(!i.getTotalTicks().equals(e))throw new p("TickMismatch","Voices should have same total note duration in ticks.");if(i.getMode()===ke.Mode.STRICT&&!i.isComplete())throw new p("IncompleteVoice","Voice does not have enough notes.");return Math.max(t,y.LCM(t,i.getResolutionMultiplier()))},1)}createModifierContexts(t){if(0===t.length)return;const e=ni.getResolutionMultiplier(t),i=new Map,s=[];t.forEach(t=>{const n=new y(0,e);t.getTickables().forEach(t=>{const e=n.numerator;let o=i.get(t.getStave());if(o||(i.set(t.getStave(),{}),o=i.get(t.getStave())),!(o?o[e]:void 0)){const t=new Xe;s.push(t),o[e]=t}t.addToModifierContext(o[e]),n.add(t.getTicks())})}),this.modifierContexts.push({map:i,array:s,resolutionMultiplier:e})}createTickContexts(t){if(0===t.length)return{map:{},array:[],list:[],resolutionMultiplier:0};const e={},i=[],s=[],n=ni.getResolutionMultiplier(t);t.forEach((t,o)=>{const a=new y(0,n);t.getTickables().forEach(t=>{const n=a.numerator;if(!e[n]){const t=new Jt({tickID:n});s.push(t),e[n]=t,i.push(n)}e[n].addTickable(t,o),a.add(t.getTicks())})});const o={map:e,array:s,list:i.sort((t,e)=>t-e),resolutionMultiplier:n};this.tickContexts=o;const a=this.tickContexts.array;return a.forEach(t=>{t.tContexts=a}),o}getTickContexts(){return this.tickContexts}preFormat(t=0,e,i,s){const n=this.tickContexts;if(!n)throw new p("NoTickContexts","preFormat requires TickContexts");const{list:o,map:a}=n;this.lossHistory=[],i&&s&&i.forEach(t=>t.setStave(s).preFormat());let r=0,h=0;this.minTotalWidth=0;let c=0;o.forEach(t=>{const e=a[t];e.preFormat();const i=e.getWidth();this.minTotalWidth+=i;const s=e.getMaxTicks().value();c+=s;const n=e.getMetrics();r=r+h+n.totalLeftPx,e.setX(r),h=i-n.totalLeftPx});const{globalSoftmax:l,softmaxFactor:d,maxIterations:u}=this.formatterOptions,g=b(o.map(t=>Math.pow(d,a[t].getMaxTicks().value()/c)));if(this.minTotalWidth=r+h,this.hasMinTotalWidth=!0,t<=0)return this.evaluate();const m=a[o[0]],S=a[o[o.length-1]];function T(t){return o.map((e,i)=>{const s=a[e],n=s.getTickablesByVoice();let r;if(i>0){const e=a[o[i-1]];for(let h=i-1;h>=0;h--){const i=a[o[h]].getTickablesByVoice(),u=[];if(Object.keys(n).forEach(t=>{i[t]&&u.push(t)}),u.length>0){let o=0,a=1/0,h=0;if(u.forEach(t=>{const e=i[t].getTicks().value();e>o&&(r=i[t],o=e);const s=n[t],h=s.getX()-(s.getMetrics().modLeftPx+s.getMetrics().leftDisplacedHeadPx),c=i[t].getMetrics(),l=i[t].getX()+c.notePx+c.modRightPx+c.rightDisplacedHeadPx;a=Math.min(a,h-l)}),a=Math.min(a,s.getX()-(e.getX()+.05*t)),l){const e=c;h=Math.pow(d,o/e)/g*t}else void 0!==r&&(h=r.getVoice().softmax(o)*t);return{expectedDistance:h,maxNegativeShiftPx:a,fromTickable:r}}}}return{expectedDistance:0,fromTickablePx:0,maxNegativeShiftPx:0}})}function x(t){const e=w/2;let i=0;return o.forEach((s,n)=>{const o=a[s];if(n>0){const e=o.getX(),s=t[n],a=f(s.fromTickable).getX()+s.expectedDistance-(e+i);let r=0;a>0?i+=a:a<0&&(r=Math.min(s.maxNegativeShiftPx,Math.abs(a)),i+=-r),o.setX(e+i)}o.getCenterAlignedTickables().forEach(t=>{t.setCenterXShift(e-o.getX())})}),S.getX()-m.getX()}const w=t-S.getMetrics().notePx-S.getMetrics().totalRightPx-m.getMetrics().totalLeftPx,y=B.get("Stave.endPaddingMin"),k=B.get("Stave.endPaddingMax"),v=B.get("Stave.padding");let C=w;const D=T(C);let E=x(D);if(1===o.length)return 0;const L=((t,e)=>{let i=t/2;if(e.length>1)for(let t=1;t<e.length;++t)i=Math.min(e[t].expectedDistance/2,i);return i})(C,D),N=t=>{let e=0;const i=S&&S.getMaxTickable();if(i){const s=i.getVoice();if(s.getTicksUsed().value()>s.getTotalTicks().value())return 2*k<L?L:k;const n=i.getWidth();e=s.softmax(S.getMaxTicks().value())*t-(n+v)}return 2*k<e?e:k};let F=N(C),A=F-(k-y);const O=w-A;let R=u;for(;E>O&&R>0||E+F<O&&R>1;)C-=E-O,F=N(C),A=F-(k-y),E=x(T(C)),R--;return this.justifyWidth=t,this.evaluate()}evaluate(){const t=this.tickContexts,e=this.justifyWidth;this.contextGaps={total:0,gaps:[]},t.list.forEach((e,i)=>{if(0===i)return;const s=t.list[i-1],n=t.map[s],o=t.map[e],a=n.getMetrics(),r=o.getMetrics(),h=n.getX()+a.notePx+a.totalRightPx,c=o.getX()-r.totalLeftPx,l=c-h;this.contextGaps.total+=l,this.contextGaps.gaps.push({x1:h,x2:c}),o.getFormatterMetrics().freedom.left=l,n.getFormatterMetrics().freedom.right=l}),this.durationStats={};const i=this.durationStats;this.voices.forEach(t=>{t.getTickables().forEach((t,s,n)=>{const o=t.getTicks().clone().simplify().toString(),a=t.getMetrics(),r=t.getFormatterMetrics(),h=t.getX()+a.notePx+a.modRightPx+a.rightDisplacedHeadPx;let c=0;if(s<n.length-1){const e=n[s+1],i=e.getMetrics();c=e.getX()-i.modLeftPx-i.leftDisplacedHeadPx-h,r.space.used=e.getX()-t.getX(),e.getFormatterMetrics().freedom.left=c}else c=e-h,r.space.used=e-t.getX();r.freedom.right=c,function(t,e){const s=i[t];void 0===s?i[t]={mean:e,count:1,total:e}:(s.count+=1,s.total+=e,s.mean=s.total/s.count)}(o,r.space.used)})});let s=0;return this.voices.forEach(t=>{t.getTickables().forEach(t=>{const e=t.getTicks().clone().simplify().toString(),n=t.getFormatterMetrics();n.space.mean=i[e].mean,n.duration=e,n.iterations+=1,n.space.deviation=n.space.used-n.space.mean,s+=Math.pow(n.space.deviation,2)})}),this.totalCost=Math.sqrt(s),this.lossHistory.push(this.totalCost),this.totalCost}tune(t){var e;const i=this.tickContexts;if(!i)return 0;const s=null!==(e=null==t?void 0:t.alpha)&&void 0!==e?e:.5;let n=0;return this.totalShift=0,i.list.forEach((t,e,o)=>{const a=i.map[t],r=e>0?i.map[o[e-1]]:void 0,h=e<o.length-1?i.map[o[e+1]]:void 0;a.move(n,r,h);const c=-a.getDeviationCost();c>0?n=-Math.min(a.getFormatterMetrics().freedom.right,Math.abs(c)):c<0&&(n=h?Math.min(h.getFormatterMetrics().freedom.right,Math.abs(c)):0),n*=s,this.totalShift+=n}),this.evaluate()}postFormat(){return this.modifierContexts.forEach(t=>{t.array.forEach(t=>t.postFormat())}),this.tickContexts.list.forEach(t=>{this.tickContexts.map[t].postFormat()}),this}joinVoices(t){return this.createModifierContexts(t),this.hasMinTotalWidth=!1,this}format(t,e,i){const s=Object.assign({alignRests:!1},i);this.voices=t;const n=this.formatterOptions.softmaxFactor;return n&&this.voices.forEach(t=>t.setSoftmaxFactor(n)),this.alignRests(t,s.alignRests),this.createTickContexts(t),this.preFormat(e,s.context,t,s.stave),s.stave&&this.postFormat(),this}formatToStave(t,e,i){const s=Object.assign({context:e.getContext()},i),n=e.getNoteEndX()-e.getNoteStartX()-ti.defaultPadding;return function(...t){ni.DEBUG&&S("VexFlow.Formatter",t)}("Formatting voices to width: ",n),this.format(t,n,s)}getTickContext(t){var e;return null===(e=this.tickContexts)||void 0===e?void 0:e.map[t]}}ni.DEBUG=!1;const oi="Ghost note must have valid initialization data to identify duration.";class ai extends Se{static get CATEGORY(){return"GhostNote"}constructor(t){if(!t)throw new p("BadArguments",oi);let e;if("string"==typeof t)e={duration:t};else{if("object"!=typeof t)throw new p("BadArguments",oi);e=t}super(e),this.setWidth(0)}isRest(){return!0}setStave(t){return super.setStave(t),this}addToModifierContext(t){return this}preFormat(){return this.preFormatted=!0,this}draw(){this.setRendered();for(let t=0;t<this.modifiers.length;++t){const e=this.modifiers[t];Q(e)&&(e.setContext(this.getContext()),e.drawWithStyle())}}}class ri extends yt{static get CATEGORY(){return"GlyphNote"}constructor(t,e,i){super(e),this.options=Object.assign({ignoreTicks:!1,line:2},i),this.ignoreTicks=this.options.ignoreTicks,this.setGlyph(t)}setGlyph(t){return this.text=t,this}preFormat(){return!this.preFormatted&&this.modifierContext&&this.modifierContext.preFormat(),this.preFormatted=!0,this}drawModifiers(){const t=this.checkContext();for(let e=0;e<this.modifiers.length;e++){const i=this.modifiers[e];i.setContext(t),i.drawWithStyle()}}draw(){const t=this.checkStave(),e=t.checkContext();this.setRendered();const i=this.getAttribute("class");e.openGroup("glyphNote"+(i?" "+i:""),this.getAttribute("id")),this.x=this.isCenterAligned()?this.getAbsoluteX()-this.getWidth()/2:this.getAbsoluteX(),this.y=t.getYForLine(this.options.line),this.renderText(e,0,0),this.drawModifiers(),this.drawPointerRect(),e.closeGroup()}}class hi extends xe{static get CATEGORY(){return"GraceNote"}static get LEDGER_LINE_OFFSET(){return 2}constructor(t){super(Object.assign({strokePx:hi.LEDGER_LINE_OFFSET},t)),this.slash=t.slash||!1,this.slur=!0,this.buildNoteHeads(),this.width=3}getStemExtension(){if(this.stemExtensionOverride)return this.stemExtensionOverride;let t=super.getStemExtension();return t=at.HEIGHT*this.getFontScale()-at.HEIGHT+t,t}draw(){super.draw(),this.setRendered();const t=this.stem;if(this.slash&&t){const t=this.getFontScale();let e;const i=this.beam;if(i)i.postFormatted||i.postFormat(),e=this.calcBeamedNotesSlashBBox(8*t,8*t,{stem:6*t,beam:5*t});else{const i=this.getStemDirection(),s=this.getNoteHeadBounds(),n=this.noteHeads[0].getWidth(),o=i===at.DOWN?this.getAbsoluteX():this.getAbsoluteX()+n,a=K.STEM_HEIGHT*t/2,r=i===at.DOWN?s.yBottom+a:s.yTop-a;e=i===at.DOWN?{x1:o-n,y1:r-n,x2:o+n,y2:r+n}:{x1:o-n,y1:r+n,x2:o+n,y2:r-n}}const s=this.checkContext();s.setLineWidth(1*t),s.beginPath(),s.moveTo(e.x1,e.y1),s.lineTo(e.x2,e.y2),s.closePath(),s.stroke()}}calcBeamedNotesSlashBBox(t,e,i){const s=this.beam;if(!s)throw new p("NoBeam","Can't calculate without a beam.");const n=s.slope,o=s.notes[s.notes.length-1]===this?-1:1,a=Math.atan(n*o),r=Math.cos(a)*e,h=Math.sin(a)*e;t*=this.getStemDirection();const c=Math.atan((h-t)/r),l=Math.cos(c)*i.stem*o,d=Math.sin(c)*i.stem,u=Math.cos(c)*i.beam*o,g=Math.sin(c)*i.beam,m=this.getStemX(),f=s.notes[0].getStemX(),S=s.getBeamYToDraw()+(m-f)*n;return{x1:m-l,y1:S+t-d,x2:m+r*o+u,y2:S+h+g}}}class ci extends yt{static get CATEGORY(){return"KeySigNote"}constructor(t,e,i){super({duration:"b"}),this.keySignature=new Ye(t,e,i),this.ignoreTicks=!0}addToModifierContext(t){return this}preFormat(){return this.preFormatted=!0,this.keySignature.setStave(this.checkStave()),this.setWidth(this.keySignature.getWidth()),this}draw(){const t=this.checkStave().checkContext();this.setRendered(),this.keySignature.setX(this.getAbsoluteX()),this.keySignature.setContext(t),this.keySignature.drawWithStyle()}}class li extends P{static get CATEGORY(){return"MultiMeasureRest"}constructor(t,e){var i;super(),this.xs={left:NaN,right:NaN},this.hasPaddingLeft=!1,this.hasPaddingRight=!1,this.hasLineThickness=!1,this.hasSymbolSpacing=!1;const s=null!==(i=e.numberGlyphPoint)&&void 0!==i?i:B.get("MultiMeasureRest.fontSize");this.fontInfo.size=s,this.numberOfMeasures=t,this.text="";const n=`${this.numberOfMeasures}`;for(const t of n)this.text+=String.fromCodePoint(57472+Number(t));this.hasPaddingLeft="number"==typeof e.paddingLeft,this.hasPaddingRight="number"==typeof e.paddingRight,this.hasLineThickness="number"==typeof e.lineThickness,this.hasSymbolSpacing="number"==typeof e.symbolSpacing,this.renderOptions=Object.assign({useSymbols:!1,showNumber:!0,numberLine:-.5,numberGlyphPoint:s,line:2,spacingBetweenLinesPx:K.STAVE_LINE_DISTANCE,serifThickness:2,semibreveRestGlyphScale:B.get("fontSize"),paddingLeft:0,paddingRight:0,lineThickness:5,symbolSpacing:0},e)}getXs(){return this.xs}setStave(t){return this.stave=t,this}getStave(){return this.stave}checkStave(){return f(this.stave,"NoStave","No stave attached to instance.")}drawLine(t,e,i,s){const n=this.renderOptions,o=t.getYForLine(n.line),a=.1*(s-i);i+=a,s-=a;let r="";const h=new P;h.setText(r);const c=h.getWidth();if(!c)throw new p("Cannot drawLine if width is 0");for(let t=1;(t+2)*c+i<=s;t++)r+="";r+="",h.setText(r),h.renderText(e,i+.5*(s-i)-.5*h.getWidth(),o)}drawSymbols(t,e,i,s){const n=Math.floor(this.numberOfMeasures/4),o=this.numberOfMeasures%4,a=Math.floor(o/2),r=o%2,h=this.renderOptions,c=new P;let l="";for(let t=0;t<n;++t)l+=I.restLonga+" ";for(let t=0;t<a;++t)l+=I.restDoubleWhole+" ";c.setText(l);const d=new P;l="";for(let t=0;t<r;++t)l+=I.restWhole+" ";d.setText(l);let u=i+.5*(s-i)-.5*(c.getWidth()+d.getWidth());const g=h.line,p=t.getYForLine(g-1),m=t.getYForLine(g);c.renderText(e,u,m),u+=c.getWidth(),d.renderText(e,u,p),u+=d.getWidth()}draw(){const t=this.checkContext();this.setRendered();const e=this.checkStave();let i=e.getNoteStartX(),s=e.getNoteEndX();const n=e.getModifiers(kt.BEGIN);1===n.length&&J(n[0])&&(i-=n[0].getWidth());const o=this.renderOptions;this.hasPaddingLeft&&(i=e.getX()+o.paddingLeft),this.hasPaddingRight&&(s=e.getX()+e.getWidth()-o.paddingRight),this.xs.left=i,this.xs.right=s,o.useSymbols?this.drawSymbols(e,t,i,s):this.drawLine(e,t,i,s),o.showNumber&&this.renderText(t,i+.5*(s-i)-.5*this.width,e.getYForLine(o.numberLine)-.5*this.height)}}class di extends P{static get CATEGORY(){return"PedalMarking"}static createSustain(t){return new di(t)}static createSostenuto(t){const e=new di(t);return e.setType(di.type.MIXED),e.setCustomText("Sost. Ped."),e}static createUnaCorda(t){const e=new di(t);return e.setType(di.type.TEXT),e.setCustomText("una corda","tre corda"),e}constructor(t){super(),this.notes=t,this.type=di.type.TEXT,this.line=0,this.depressText=di.GLYPHS.pedalDepress,this.releaseText=di.GLYPHS.pedalRelease,this.renderOptions={bracketHeight:10,textMarginRight:6,bracketLineWidth:1}}setType(t){return(t="string"==typeof t?di.typeString[t]:t)>=di.type.TEXT&&t<=di.type.MIXED&&(this.type=t),this}setCustomText(t,e){return this.depressText=t||"",this.releaseText=e||"",this.setFont(B.getFontInfo("PedalMarking.text")),this}setLine(t){return this.line=t,this}getYForStave(t){let e=t.getYForBottomText(this.line+3);const i=this.notes.filter(e=>e.getStave()===t);if(!i.length)return e;const s=Math.min(...i.map(t=>t.getAbsoluteX())),n=Math.max(...i.map(t=>t.getAbsoluteX())),o=new Set(i.map(t=>t.getVoice())),a=new P("PedalMarking").setFont(this.fontInfo),r=Math.max(a.setText(this.depressText).getTextMetrics().actualBoundingBoxAscent,a.setText(this.releaseText).getTextMetrics().actualBoundingBoxAscent),h=this.type===di.type.BRACKET?this.renderOptions.bracketHeight:Math.max(r,this.type===di.type.MIXED?this.renderOptions.bracketHeight:0);for(const i of o)for(const o of i.getTickables())if(et(o)&&o.getStave()===t&&!(o.getAbsoluteX()<s||o.getAbsoluteX()>n))for(const t of o.getModifiers()){if(!Q(t)||t.getVerticalJustification()!==ct.VerticalJustify.BOTTOM)continue;const i=t.computeY().y+t.getYShift()+t.getTextMetrics().actualBoundingBoxDescent;e=Math.max(e,i+4+h)}return e}drawBracketed(){const t=this.checkContext();let e,i,s=!1,n=0;const o=new Map(this.notes.map(t=>[t.checkStave(),0]));for(const t of o.keys())o.set(t,this.getYForStave(t));this.notes.forEach((a,r,h)=>{var c,l,d,u;s=!s;const g=a.getAbsoluteX(),m=o.get(a.checkStave());if(g<e)throw new p("InvalidConfiguration","The notes provided must be in order of ascending x positions");const f=h[r+1]===a,S=h[r-1]===a;let T=0;if(s)T=S?5:0,this.type!==di.type.MIXED||S?(t.beginPath(),t.moveTo(g,m-this.renderOptions.bracketHeight),t.lineTo(g+T,m),t.stroke(),t.closePath()):(n=t.measureText(this.depressText).width,t.fillText(this.depressText,g,m),T=n+this.renderOptions.textMarginRight);else{const s=a.getVoice().getTickables().indexOf(a),n=s+1<a.getVoice().getTickables().length?a.getVoice().getTickables()[s+1].getAbsoluteX():(null!==(l=null===(c=a.getStave())||void 0===c?void 0:c.getX())&&void 0!==l?l:0)+(null!==(u=null===(d=a.getStave())||void 0===d?void 0:d.getWidth())&&void 0!==u?u:0);t.beginPath(),t.moveTo(e,i),t.lineTo(f?g-5:n-5,m),t.lineTo(f?g:n-5,m-this.renderOptions.bracketHeight),t.stroke(),t.closePath()}e=g+T,i=m})}drawText(){const t=this.checkContext();let e=!1,i=0;const s=new Map(this.notes.map(t=>[t.checkStave(),0]));for(const t of s.keys())s.set(t,this.getYForStave(t));this.notes.forEach(n=>{var o,a,r,h;e=!e;const c=n.checkStave(),l=n.getAbsoluteX(),d=s.get(c);if(e)i=t.measureText(this.depressText).width,t.fillText(this.depressText,l,d);else{const e=n.getVoice().getTickables().indexOf(n),s=e+1<n.getVoice().getTickables().length?n.getVoice().getTickables()[e+1].getAbsoluteX():(null!==(a=null===(o=n.getStave())||void 0===o?void 0:o.getX())&&void 0!==a?a:0)+(null!==(h=null===(r=n.getStave())||void 0===r?void 0:r.getWidth())&&void 0!==h?h:0);i=t.measureText(this.releaseText).width,t.fillText(this.releaseText,s-i,d)}})}draw(){const t=this.checkContext();this.setRendered(),void 0!==this.renderOptions.color&&(t.setStrokeStyle(this.renderOptions.color),t.setFillStyle(this.renderOptions.color)),this.applyStyle(t),t.setFont(this.font),function(...t){di.DEBUG&&S("VexFlow.PedalMarking",t)}("Rendering Pedal Marking"),this.type===di.type.BRACKET||this.type===di.type.MIXED?(t.setLineWidth(this.renderOptions.bracketLineWidth),this.drawBracketed()):this.type===di.type.TEXT&&this.drawText()}}di.DEBUG=!1,di.GLYPHS={pedalDepress:I.keyboardPedalPed,pedalRelease:I.keyboardPedalUp},di.type={TEXT:1,BRACKET:2,MIXED:3},di.typeString={text:di.type.TEXT,bracket:di.type.BRACKET,mixed:di.type.MIXED};const ui={1:I.repeat1Bar,2:I.repeat2Bars,4:I.repeat4Bars,slash:I.repeatBarSlash};class gi extends ri{static get CATEGORY(){return"RepeatNote"}constructor(t,e,i){super(ui[t]||"",Object.assign({duration:"q",alignCenter:"slash"!==t},e),i)}}class pi{constructor(t){this.systems=[],this.rows=[],this.options=Object.assign({width:500,x:10,y:10,rowGap:40,measureGap:0,measurePadding:20,justify:!0},t),this.setWidth(this.options.width);for(const t of["x","y","rowGap","measureGap","measurePadding"])if(!Number.isFinite(this.options[t])||this.options[t]<0)throw new p("BadArgument",`Sheet ${t} must be a nonnegative finite number.`)}addSystem(t={}){const e=this.options.factory.System(Object.assign(Object.assign({},t),{autoWidth:!0,noJustification:!1}));return this.systems.push(e),e}setWidth(t){if(!Number.isFinite(t)||t<=0)throw new p("BadArgument","Sheet width must be a positive finite number.");return this.options.width=t,this}getSystems(){return this.systems.slice()}getRows(){return this.rows.map(t=>Object.assign(Object.assign({},t),{systems:t.systems.slice()}))}getHeight(){const t=this.rows[this.rows.length-1];return t?t.y+t.height:this.options.y}format(){const t=this.measureSystems();this.rows=[];let e=this.options.y;for(const i of this.packRows(t)){const s=this.formatRow(i,t,e);this.rows.push(s),e+=s.height+this.options.rowGap}return this}measureSystems(){return this.systems.map(t=>(t.setX(0).setY(0).setWidth(),t.format(),t.getWidth()+this.options.measurePadding))}packRows(t){const e=[];let i=[],s=0;return t.forEach((t,n)=>{const o=i.length?this.options.measureGap:0;i.length&&s+o+t>this.options.width&&(e.push(i),i=[],s=0),s+=(i.length?this.options.measureGap:0)+t,i.push(n)}),i.length&&e.push(i),e}verticalBounds(t){let e=0,i=t.getBoundingBox().getH();for(const s of t.getVoices())for(const t of s.getTickables()){const s=t.getBoundingBox();e=Math.min(e,s.getY()),i=Math.max(i,s.getY()+s.getH())}return{top:e,bottom:i}}formatRow(t,e,i){const s=t.reduce((t,i)=>t+e[i],0)+this.options.measureGap*(t.length-1),n=this.options.justify?Math.max(0,this.options.width-s)/t.length:0;let o=this.options.x,a=0,r=0;const h=t.map(t=>this.systems[t]);t.forEach(t=>{const i=this.systems[t];i.setX(o).setY(0).setWidth(e[t]+n),i.format();const s=this.verticalBounds(i);a=Math.min(a,s.top),r=Math.max(r,s.bottom),o+=i.getWidth()+this.options.measureGap});for(const t of h)t.setY(i-a),t.format();const c=o-this.options.x-this.options.measureGap;return{systems:h,x:this.options.x,y:i,width:c,height:r-a,overflow:Math.max(0,c-this.options.width)}}}function mi(t,e,i,s,n,o,a){t.beginPath(),t.moveTo(e,i),t.lineTo(s,n),t.lineTo(o,a),t.lineTo(e,i),t.closePath(),t.fill()}class fi extends P{static get CATEGORY(){return"StaveLine"}constructor(t){super(),this.setNotes(t),this.text="",this.renderOptions={paddingLeft:4,paddingRight:3,lineWidth:1,lineDash:void 0,roundedEnd:!0,color:void 0,drawStartArrow:!1,drawEndArrow:!1,arrowheadLength:10,arrowheadAngle:Math.PI/8,textPositionVertical:fi.TextVerticalPosition.TOP,textJustification:fi.TextJustification.CENTER}}setText(t){return this.text=t,this}setNotes(t){if(!t.firstNote&&!t.lastNote)throw new p("BadArguments","Notes needs to have either firstNote or lastNote set.");if(t.firstIndexes||(t.firstIndexes=[0]),t.lastIndexes||(t.lastIndexes=[0]),t.firstIndexes.length!==t.lastIndexes.length)throw new p("BadArguments","Connected notes must have same number of indexes.");return this.notes=t,this.firstNote=t.firstNote,this.firstIndexes=t.firstIndexes,this.lastNote=t.lastNote,this.lastIndexes=t.lastIndexes,this}applyLineStyle(){const t=this.checkContext(),e=this.renderOptions;e.lineDash&&t.setLineDash(e.lineDash),e.lineWidth&&t.setLineWidth(e.lineWidth),e.roundedEnd?t.setLineCap("round"):t.setLineCap("square")}drawArrowLine(t,e,i){const s=this.renderOptions.drawStartArrow&&this.renderOptions.drawEndArrow,n=e.x,o=e.y,a=i.x,r=i.y,h=Math.sqrt((a-n)*(a-n)+(r-o)*(r-o)),c=(h-this.renderOptions.arrowheadLength/3)/h;let l,d,u,g;this.renderOptions.drawEndArrow||s?(l=Math.round(n+(a-n)*c),d=Math.round(o+(r-o)*c)):(l=a,d=r),this.renderOptions.drawStartArrow||s?(u=n+(a-n)*(1-c),g=o+(r-o)*(1-c)):(u=n,g=o),this.renderOptions.color&&(t.setStrokeStyle(this.renderOptions.color),t.setFillStyle(this.renderOptions.color)),this.applyStyle(t),t.beginPath(),t.moveTo(u,g),t.lineTo(l,d),t.stroke(),t.closePath();const p=Math.atan2(r-o,a-n),m=Math.abs(this.renderOptions.arrowheadLength/Math.cos(this.renderOptions.arrowheadAngle));let f,S,T,x,w,b;(this.renderOptions.drawEndArrow||s)&&(f=p+Math.PI+this.renderOptions.arrowheadAngle,T=a+Math.cos(f)*m,x=r+Math.sin(f)*m,S=p+Math.PI-this.renderOptions.arrowheadAngle,w=a+Math.cos(S)*m,b=r+Math.sin(S)*m,mi(t,T,x,a,r,w,b)),(this.renderOptions.drawStartArrow||s)&&(f=p+this.renderOptions.arrowheadAngle,T=n+Math.cos(f)*m,x=o+Math.sin(f)*m,S=p-this.renderOptions.arrowheadAngle,w=n+Math.cos(S)*m,b=o+Math.sin(S)*m,mi(t,T,x,n,o,w,b))}draw(){const t=this.checkContext();this.setRendered();const e=this.firstNote,i=this.lastNote,s=this.renderOptions;this.applyLineStyle();let n={x:0,y:0},o={x:0,y:0};this.firstIndexes.forEach((a,r)=>{const h=this.lastIndexes[r];n=e.getModifierStartXY(2,a),o=i.getModifierStartXY(1,h);const c=n.y>o.y;n.x+=e.getMetrics().modRightPx+s.paddingLeft,o.x-=i.getMetrics().modLeftPx+s.paddingRight;const l=e.getGlyphWidth();e.getKeyProps()[a].displaced&&1===e.getStemDirection()&&(n.x+=l+s.paddingLeft);i.getKeyProps()[h].displaced&&-1===i.getStemDirection()&&(o.x-=l+s.paddingRight),n.y+=c?-3:1,o.y+=c?2:0,this.drawArrowLine(t,n,o)});const a=this.width,r=s.textJustification;let h=0;if(r===fi.TextJustification.LEFT)h=n.x;else if(r===fi.TextJustification.CENTER){h=(o.x-n.x)/2+n.x-a/2}else r===fi.TextJustification.RIGHT&&(h=o.x-a);let c=0;const l=s.textPositionVertical;l===fi.TextVerticalPosition.TOP?c=e.checkStave().getYForTopText():l===fi.TextVerticalPosition.BOTTOM&&(c=e.checkStave().getYForBottomText(K.TEXT_HEIGHT_OFFSET_HACK));const d=s.color;this.applyStyle(t,{fillStyle:d,strokeStyle:d}),this.applyStyle(t),this.renderText(t,h,c)}}fi.TextVerticalPosition={TOP:1,BOTTOM:2},fi.TextJustification=Me;class Si extends P{static get CATEGORY(){return"System"}constructor(t={}){super(),this.setOptions(t),this.partStaves=[],this.partStaveInfos=[],this.partVoices=[]}setOptions(t={}){if(!t.factory)throw new p("NoFactory","System.setOptions(options) requires a factory.");this.factory=t.factory,this.options=Object.assign(Object.assign({factory:this.factory,x:10,y:10,width:500,spaceBetweenStaves:12,autoWidth:!1,noJustification:!1,debugFormatter:!1,formatIterations:0,noPadding:!1},t),{details:Object.assign({alpha:.5},t.details),formatOptions:Object.assign({},t.formatOptions)}),!1===this.options.noJustification&&void 0===t.width&&(this.options.autoWidth=!0)}getX(){return this.options.x}setX(t){return this.options.x=t,this.partStaves.forEach(e=>{e.setX(t)}),this}getY(){return this.options.y}setY(t){return this.options.y=t,this.partStaves.forEach(e=>{e.setY(t)}),this}getStaves(){return this.partStaves}getVoices(){return this.partVoices}setWidth(t){if(void 0!==t&&(!Number.isFinite(t)||t<=0))throw new p("BadArgument","System width must be a positive finite number.");return this.options.autoWidth=void 0===t,void 0!==t&&(this.options.width=t,this.partStaves.forEach(e=>e.setWidth(t))),this}getWidth(){return this.options.width}setContext(t){return super.setContext(t),this.factory.setContext(t),this}addConnector(t="double"){return this.connector=this.factory.StaveConnector({topStave:this.partStaves[0],bottomStave:this.partStaves[this.partStaves.length-1],type:t}),this.connector}addStave(t){var e;const i=Object.assign({leftBar:!1},t.options),s=null!==(e=t.stave)&&void 0!==e?e:this.factory.Stave({x:this.options.x,y:this.options.y,width:this.options.width,options:i}),n=Object.assign(Object.assign({spaceAbove:0,spaceBelow:0,debugNoteMetrics:!1,noJustification:!1},t),{options:i}),o=this.getContext();return n.voices.forEach(t=>{t.setContext(o).setStave(s).getTickables().forEach(t=>t.setStave(s)),this.partVoices.push(t)}),this.partStaves.push(s),this.partStaveInfos.push(n),s}addVoices(t){const e=this.getContext();t.forEach(t=>{t.setContext(e),this.partVoices.push(t)})}format(){const t=this.options.details;let e=0;const i=new ni(t);this.formatter=i;let s=this.options.y,n=0;const o=[];this.partStaves.forEach((t,e)=>{s+=t.space(this.partStaveInfos[e].spaceAbove),t.setY(s),s+=t.space(this.partStaveInfos[e].spaceBelow),s+=t.space(this.options.spaceBetweenStaves),this.partStaveInfos[e].debugNoteMetrics&&(o.push({y:s,stave:t}),s+=15),n=Math.max(n,t.getNoteStartX())}),this.partVoices.forEach(t=>{t.getTickables().forEach(t=>{const e=t.getStave();e&&t.setStave(e)})}),i.joinVoices(this.partVoices),this.partStaves.forEach(t=>t.setNoteStartX(n)),this.options.autoWidth&&this.partVoices.length>0?(e=i.preCalculateMinTotalWidth(this.partVoices),this.options.width=e+ti.rightPadding+(n-this.options.x),this.partStaves.forEach(t=>{t.setWidth(this.options.width)})):e=this.options.noPadding?this.options.width-(n-this.options.x):this.options.width-(n-this.options.x)-ti.defaultPadding,this.partVoices.length>0&&i.format(this.partVoices,this.options.noJustification?0:e,this.options.formatOptions),i.postFormat();for(let e=0;e<this.options.formatIterations;e++)i.tune(t);this.startX=n,this.debugNoteMetricsYs=o,this.lastY=s,ti.formatBegModifiers(this.partStaves)}getBoundingBox(){var t;return new D(this.options.x,this.options.y,this.options.width,(null!==(t=this.lastY)&&void 0!==t?t:0)-this.options.y)}draw(){const t=this.checkContext();if(!(this.formatter&&this.startX&&this.lastY&&this.debugNoteMetricsYs))throw new p("NoFormatter","format() must be called before draw()");this.setRendered(),this.options.debugFormatter&&ni.plotDebugging(t,this.formatter,this.startX,this.options.y,this.lastY),this.debugNoteMetricsYs.forEach(e=>{this.partVoices.forEach(i=>{i.getTickables().forEach(i=>{i.getStave()===e.stave&&yt.plotMetrics(t,i,e.y)})})})}}class Ti extends Se{static get CATEGORY(){return"TabNote"}constructor(t,e=!1){super(t),this.fretElement=[],this.greatestString=()=>this.positions.map(t=>t.str).reduce((t,e)=>t>e?t:e),this.leastString=()=>this.positions.map(t=>t.str).reduce((t,e)=>t<e?t:e),this.ghost=!1,this.positions=t.positions||[],this.renderOptions=Object.assign(Object.assign({},this.renderOptions),{drawStem:e,drawDots:e,drawStemThroughStave:!1,yShift:0}),this.glyphProps=yt.getGlyphProps(this.duration,this.noteType),f(this.glyphProps,"BadArguments",`No glyph found for duration '${this.duration}' and type '${this.noteType}'`),this.buildStem(),t.stemDirection?this.setStemDirection(t.stemDirection):this.setStemDirection(at.UP),this.ghost=!1,this.updateWidth()}reset(){return super.reset(),this.stave&&this.setStave(this.stave),this}setGhost(t){return this.ghost=t,this.updateWidth(),this}hasStem(){return!!this.renderOptions.drawStem}getStemExtension(){return void 0!==this.stemExtensionOverride?this.stemExtensionOverride:this.flag.getHeight()>at.HEIGHT?this.flag.getHeight()-at.HEIGHT:0}static tabToElement(t){let e;return"X"===t.toUpperCase()?(e=new P("TabNote"),e.setText(I.accidentalDoubleSharp)):(e=new P("TabNote.text"),e.setText(t),e.setYShift(e.getHeight()/2)),e}setFontSize(t){return super.setFontSize(t),this.fretFontSize=t,this.positions&&this.updateWidth(),this.preFormatted=!1,this}updateWidth(){this.fretElement=[],this.width=0;for(let t=0;t<this.positions.length;++t){let e=this.positions[t].fret;this.ghost&&(e="("+e+")");const i=Ti.tabToElement(e.toString()),s=A.convertSizeToPointValue(B.getFontInfo("TabNote.text").size),n=void 0===this.fretFontSize?s*this.getFontScale():A.convertSizeToPointValue(this.fretFontSize);i.setFontSize(A.convertSizeToPointValue(i.fontInfo.size)*n/s);const o=i.getTextMetrics();i.setYShift((o.actualBoundingBoxAscent-o.actualBoundingBoxDescent)/2),this.fretElement.push(i),this.width=Math.max(i.getWidth(),this.width)}}setStave(t){super.setStave(t);const e=t.getContext();this.setContext(e);const i=this.positions.map(({str:e})=>t.getYForLine(Number(e)-1));return this.setYs(i),this.stem&&this.stem.setYBounds(this.getStemY(),this.getStemY()),this}getPositions(){return this.positions}getModifierStartXY(t,e){if(!this.preFormatted)throw new p("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");if(0===this.ys.length)throw new p("NoYValues","No Y-Values calculated for this note.");let i=0;if(t===W.Position.LEFT)i=-2;else if(t===W.Position.RIGHT)i=this.width+2;else if(t===W.Position.BELOW||t===W.Position.ABOVE){i=this.width/2}return{x:this.getAbsoluteX()+i,y:this.ys[e]}}getLineForRest(){return Number(this.positions[0].str)}preFormat(){this.preFormatted||(this.modifierContext&&this.modifierContext.preFormat(),this.preFormatted=!0)}getStemX(){return this.getCenterGlyphX()}getStemY(){const t=this.checkStave().getNumLines()-.5,e=at.UP===this.stemDirection?-.5:t;return this.checkStave().getYForLine(e)}getStemExtents(){return this.checkStem().getExtents()}drawFlag(){const{beam:t,glyphProps:e,renderOptions:{drawStem:i}}=this,s=this.checkContext(),n=void 0===t&&i;if(e.codeFlagUp&&n){const t=this.getStemX(),e=this.getStemDirection()===at.DOWN?this.getStemY()-this.checkStem().getHeight()-this.getStemExtension():this.getStemY()-this.checkStem().getHeight()+this.getStemExtension();this.flag.setContext(s).setX(t).setY(e).drawWithStyle()}}drawModifiers(){this.modifiers.forEach(t=>{$(t,"Dot")&&!this.renderOptions.drawDots||(t.setContext(this.getContext()),t.drawWithStyle())})}drawStemThrough(){const t=this.getStemX(),e=this.getStemY(),i=this.checkContext(),s=this.renderOptions.drawStem,n=this.renderOptions.drawStemThroughStave;if(s&&n){const s=function(t,e){const i=[];let s=[];for(let n=1;n<=t;n++)e.indexOf(n)>-1?(i.push(s),s=[]):s.push(n);return s.length>0&&i.push(s),i}(this.checkStave().getNumLines(),this.positions.map(t=>Number(t.str))),n=function(t,e,i,s){const n=1!==s,o=-1!==s,a=i.getSpacingBetweenLines(),r=i.getNumLines(),h=[];return e.forEach(e=>{const c=e.indexOf(r)>-1,l=e.indexOf(1)>-1;if(n&&l||o&&c)return;1===e.length&&e.push(e[0]);const d=[];e.forEach((e,n,o)=>{const h=1===e,c=e===r;let l=i.getYForLine(e-1);0!==n||h?n!==o.length-1||c||(l+=a/2-1):l-=a/2-1,d.push(l),1===s&&h?d.push(t-2):-1===s&&c&&d.push(t+2)}),h.push(d.sort((t,e)=>t-e))}),h}(e,s,this.checkStave(),this.getStemDirection());i.setLineWidth(at.WIDTH),n.forEach(e=>{0!==e.length&&(i.beginPath(),i.moveTo(t,e[0]),i.lineTo(t,e[e.length-1]),i.stroke(),i.closePath())})}}drawPositions(){const t=this.checkContext(),e=this.getAbsoluteX(),i=this.ys;for(let s=0;s<this.positions.length;++s){const n=i[s]+this.renderOptions.yShift,o=this.fretElement[s],a=e-o.getWidth()/2;t.clearRect(a-2,n-3,o.getWidth()+4,6),o.renderText(t,a,n)}}draw(){const t=this.checkContext();if(0===this.ys.length)throw new p("NoYValues","Can't draw note without Y values.");this.setRendered();const e=void 0===this.beam&&this.renderOptions.drawStem,i=this.getAttribute("class");if(t.openGroup("tabnote"+(i?" "+i:""),this.getAttribute("id")),this.drawPositions(),this.drawStemThrough(),this.stem&&e){const e=this.getStemX();this.stem.setNoteHeadXBounds(e,e),this.stem.setContext(t).drawWithStyle()}this.drawFlag(),this.drawModifiers(),this.drawPointerRect(),t.closeGroup()}}class xi extends ti{static get CATEGORY(){return"TabStave"}constructor(t,e,i,s){super(t,e,i,Object.assign({spacingBetweenLinesPx:13,numLines:6,topTextPosition:1},s))}getYForGlyphs(){return this.getYForLine(2.5)}addTabGlyph(){return this.addClef("tab"),this}}var wi;!function(t){t[t.TOP=1]="TOP",t[t.BOTTOM=-1]="BOTTOM"}(wi||(wi={}));class bi extends P{static get CATEGORY(){return"TextBracket"}static get Position(){return wi}static get PositionString(){return{top:wi.TOP,bottom:wi.BOTTOM}}constructor({start:t,stop:e,text:i="",superscript:s="",position:n=wi.TOP}){super(),this.start=t,this.stop=e,this.textElement=new P("TextBracket"),this.textElement.setText(i),this.superscriptElement=new P("TextBracket"),this.superscriptElement.setText(s);const o=A.scaleSize(this.fontInfo.size,.714286);this.superscriptElement.setFontSize(o),this.position="string"==typeof n?bi.PositionString[n]:n,this.line=1,this.renderOptions={dashed:!0,dash:[5],lineWidth:1,showBracket:!0,bracketHeight:8,underlineSuperscript:!0}}applyStyle(t){this.textElement.setFont(this.fontInfo);const{family:e,size:i,weight:s,style:n}=this.fontInfo,o=A.scaleSize(i,.714286);this.superscriptElement.setFont(e,o,s,n);const a=this.renderOptions;return void 0!==a.color&&(t.setStrokeStyle(a.color),t.setFillStyle(a.color)),t.setLineWidth(a.lineWidth),super.applyStyle(t)}setDashed(t,e){return this.renderOptions.dashed=t,e&&(this.renderOptions.dash=e),this}setLine(t){return this.line=t,this}draw(){const t=this.checkContext();this.setRendered();let e=0;switch(this.position){case wi.TOP:e=this.start.checkStave().getYForTopText(this.line);break;case wi.BOTTOM:e=this.start.checkStave().getYForBottomText(this.line+K.TEXT_HEIGHT_OFFSET_HACK);break;default:throw new p("InvalidPosition",`The position ${this.position} is invalid.`)}const i={x:this.start.getAbsoluteX(),y:e},s={x:this.stop.getAbsoluteX(),y:e};!function(...t){bi.DEBUG&&S("VexFlow.TextBracket",t)}("Rendering TextBracket: start:",i,"stop:",s,"y:",e);const n=this.renderOptions.bracketHeight*this.position;this.textElement.renderText(t,i.x,i.y);const o=this.textElement.getWidth(),a=this.textElement.getHeight(),r=i.y-a/2.5;this.superscriptElement.renderText(t,i.x+o+1,r);const h=this.superscriptElement.getWidth(),c=this.superscriptElement.getHeight();let l=i.x,d=r;const u=s.x+this.stop.getGlyphWidth();this.position===wi.TOP?(l+=o+h+5,d-=c/2.7):this.position===wi.BOTTOM&&(d+=c/2.7,l+=o+2,this.renderOptions.underlineSuperscript||(l+=h)),this.renderOptions.dashed?(We.drawDashedLine(t,l,d,u,d,this.renderOptions.dash),this.renderOptions.showBracket&&We.drawDashedLine(t,u,d+1*this.position,u,d+n,this.renderOptions.dash)):(t.beginPath(),t.moveTo(l,d),t.lineTo(u,d),this.renderOptions.showBracket&&t.lineTo(u,d+n),t.stroke(),t.closePath())}}function yi(...t){ki.DEBUG&&S("VexFlow.TextDynamics",t)}bi.DEBUG=!1;class ki extends yt{static get CATEGORY(){return"TextDynamics"}static get GLYPHS(){return{f:I.dynamicForte,p:I.dynamicPiano,m:I.dynamicMezzo,s:I.dynamicSforzando,z:I.dynamicZ,r:I.dynamicRinforzando}}constructor(t){var e,i;super(t),this.sequence=(null!==(e=t.text)&&void 0!==e?e:"").toLowerCase(),this.line=null!==(i=t.line)&&void 0!==i?i:0,this.text="",yi("New Dynamics Text: ",this.sequence)}setLine(t){return this.line=t,this}preFormat(){return this.text="",this.sequence.split("").forEach(t=>{const e=ki.GLYPHS[t];if(!e)throw new p("Invalid dynamics character: "+t);this.text+=e}),this.preFormatted=!0,this}getBoundingBox(){const t=this.getTextMetrics();return new D(this.getAbsoluteX()+this.x+this.xShift,this.checkStave().getYForLine(this.line-3)+this.y+this.yShift-t.actualBoundingBoxAscent,this.getWidth(),this.getHeight())}draw(){this.setRendered();const t=this.getAbsoluteX(),e=this.checkStave().getYForLine(this.line+-3);yi("Rendering Dynamics: ",this.sequence),this.renderText(this.checkContext(),t,e)}}ki.DEBUG=!1;class vi extends yt{static get CATEGORY(){return"TimeSigNote"}constructor(t,e){super({duration:"b"}),this.timeSig=new Qe(t,e),this.setWidth(this.timeSig.getWidth()),this.ignoreTicks=!0}addToModifierContext(t){return this}preFormat(){return this.preFormatted=!0,this}draw(){const t=this.checkStave(),e=this.checkContext();this.setRendered();const i=this.getAttribute("class");e.openGroup("timesignote"+(i?" "+i:""),this.getAttribute("id")),this.timeSig.drawAt(e,t,this.getAbsoluteX()),this.drawPointerRect(),e.closeGroup()}}class Bi extends P{static get CATEGORY(){return"Tuplet"}static get LOCATION_TOP(){return 1}static get LOCATION_BOTTOM(){return-1}static get NESTING_OFFSET(){return 15}constructor(t,e={}){if(super(),!t||!t.length)throw new p("BadArguments","No notes provided for tuplet.");this.notes=t;const i=void 0!==e.numNotes?e.numNotes:t.length,s=e.notesOccupied||2,n=void 0!==e.bracketed?e.bracketed:t.some(t=>!t.hasBeam()),o=void 0!==e.ratioed?e.ratioed:Math.abs(s-i)>1,a=e.location||Bi.LOCATION_TOP,r=e.yOffset||B.get("Tuplet.yOffset"),h=e.textYOffset||B.get("Tuplet.textYOffset"),c=e.suffix||"";this.options={bracketed:n,location:a,notesOccupied:s,numNotes:i,ratioed:o,yOffset:r,textYOffset:h,suffix:c},this.textElement=new P("Tuplet"),this.suffixElement=new P("Tuplet.suffix"),this.setTupletLocation(a||Bi.LOCATION_TOP),ni.AlignRestsToNotes(t,!0,!0),this.resolveGlyphs(),this.attach()}attach(){for(let t=0;t<this.notes.length;t++){const e=this.notes[t];e.getTupletStack().includes(this)||e.addTuplet(this)}}detach(){for(let t=0;t<this.notes.length;t++){this.notes[t].removeTuplet(this)}}setBracketed(t){return this.options.bracketed=t,this}setRatioed(t){return this.options.ratioed=t,this}setTupletLocation(t){return t!==Bi.LOCATION_TOP&&t!==Bi.LOCATION_BOTTOM&&(console.warn(`Invalid tuplet location [${t}]. Using Tuplet.LOCATION_TOP.`),t=Bi.LOCATION_TOP),this.options.location=t,this}getNotes(){return this.notes}getNoteCount(){return this.options.numNotes}getNotesOccupied(){return this.options.notesOccupied}setNotesOccupied(t){this.detach(),this.options.notesOccupied=t,this.resolveGlyphs(),this.attach()}resolveGlyphs(){let t="",e="",i=this.options.numNotes;for(;i>=1;)t=String.fromCharCode(59520+i%10)+t,i=Math.floor(i/10);if(this.options.ratioed){for(i=this.options.notesOccupied;i>=1;)e=String.fromCharCode(59520+i%10)+e,i=Math.floor(i/10);e=I.tupletColon+e}this.textElement.setText(t+e),this.options.suffix&&this.suffixElement.setText(this.options.suffix)}getNestedTupletCount(){const{location:t}=this.options;let e=0;for(const i of this.notes){const s=i.getTupletStack().filter(e=>e.options.location===t).indexOf(this);s>=0&&s>e&&(e=s)}return e}getYPosition(){var t;const e=this.getNestedTupletCount()*Bi.NESTING_OFFSET*-this.options.location,i=null!==(t=this.options.yOffset)&&void 0!==t?t:0,s=this.notes[0];let n;if(this.options.location===Bi.LOCATION_TOP){n=s.checkStave().getYForLine(0)-1.5*K.STAVE_LINE_DISTANCE;for(let t=0;t<this.notes.length;++t){const e=this.notes[t];let i=0;const s=e.getModifierContext();s&&(i=Math.max(i,s.getState().topTextLine));const o=e.getYForTopText(i)-2*K.STAVE_LINE_DISTANCE;if(e.hasStem()||e.isRest()){const t=e.getStemDirection()===at.UP?e.getStemExtents().topY-K.STAVE_LINE_DISTANCE:e.getStemExtents().baseY-2*K.STAVE_LINE_DISTANCE;n=Math.min(t,n),i>0&&(n=Math.min(o,n))}}}else{let t=4;this.notes.forEach(e=>{const i=e.getModifierContext();i&&(t=Math.max(t,i.getState().textLine+1))}),n=s.checkStave().getYForLine(t)+2*K.STAVE_LINE_DISTANCE;for(let t=0;t<this.notes.length;++t)if(this.notes[t].hasStem()||this.notes[t].isRest()){const e=this.notes[t].getStemDirection()===at.UP?this.notes[t].getStemExtents().baseY+2*K.STAVE_LINE_DISTANCE:this.notes[t].getStemExtents().topY+K.STAVE_LINE_DISTANCE;e>n&&(n=e)}}return n+e+i}draw(){const{location:t,bracketed:e,textYOffset:i,suffix:s}=this.options,n=B.get("Tuplet.bracket.padding"),o=B.get("Tuplet.bracket.lineWidth"),a=B.get("Tuplet.bracket.legLength"),r=B.get("Tuplet.suffix.extraSpacing"),h=B.get("Tuplet.suffix.suffixOffsetY"),c=this.checkContext();let l=0,d=0;const u=this.notes[0],g=this.notes[this.notes.length-1];let p=0;e?(l=u.getTieLeftX()-n,p=g.getTieRightX()-l+n,this.setWidth(p+o)):(l=u.getStemX(),p=g.getStemX()-l,this.setWidth(p)),this.setX(l),d=this.getYPosition(),this.setY(1===t?d:d-a+o),this.height=a;const m=this.textElement.getWidth();let f=m,S=0;s&&(S=this.suffixElement.getWidth(),f=m+r+S);const T=l+p/2-f/2,x=d+this.textElement.getHeight()/2+(t===Bi.LOCATION_TOP?-1:1)*i,w=this.getAttribute("class");if(c.openGroup("tuplet"+(w?" "+w:""),this.getAttribute("id")),e){const e=p/2-f/2-n,i=t===Bi.LOCATION_BOTTOM;e>0&&(c.fillRect(l,d,e,o),c.fillRect(l+p/2+f/2+n,d,e,o),c.fillRect(l,d+(i?1:0),o,t*a),c.fillRect(l+p,d+(i?1:0),o,t*a))}let b=T;if(this.textElement.setX(b),this.textElement.setY(x),this.textElement.renderText(c,0,0),b+=m+r,s){const t=x+h;this.suffixElement.setX(b),this.suffixElement.setY(t),this.suffixElement.renderText(c,0,0),b+=S}this.drawPointerRect(),c.closeGroup(),this.setRendered()}getBoundingBox(){const{bracketed:t,suffix:e}=this.options,i=this.textElement.getBoundingBox(),s=this.suffixElement.getBoundingBox(),n=e?i.mergeWith(s):i;if(!t)return n;return new D(this.x,this.y,this.width,this.height).mergeWith(n)}}class Ci extends P{static get CATEGORY(){return"VibratoBracket"}constructor(t){super(),this.vibrato=new Ue,t.start&&(this.start=t.start),t.stop&&(this.stop=t.stop),this.line=1}setLine(t){return this.line=t,this}setVibratoCode(t){return this.vibrato.setVibratoCode(t),this}draw(){const t=this.checkContext();this.setRendered();const e=this.start&&this.start.checkStave().getYForTopText(this.line)||this.stop&&this.stop.checkStave().getYForTopText(this.line)||0,i=this.start&&this.start.getAbsoluteX()||this.stop&&this.stop.checkStave().getTieStartX()||0,s=this.stop&&this.stop.getAbsoluteX()-this.stop.getWidth()-5||this.start&&this.start.checkStave().getTieEndX()-10||0;this.vibrato.setVibratoWidth(s-i),function(...t){Ci.DEBUG&&S("VexFlow.VibratoBracket",t)}("Rendering VibratoBracket: startX:",i,"stopX:",s,"y:",e),this.vibrato.renderText(t,i,e)}}function Di(...t){Ei.DEBUG&&S("VexFlow.Factory",t)}Ci.DEBUG=!1;class Ei{static newFromElementId(t,e=500,i=200){return new Ei({renderer:{elementId:t,width:e,height:i}})}constructor(t={}){this.retained=!1,this.style={},Di("New factory: ",t),this.options={stave:{space:10},renderer:{elementId:"",width:500,height:200,background:"#FFF"}},this.setOptions(t)}reset(){this.sheets=[],this.retained=!1,this.renderQ=[],this.systems=[],this.staves=[],this.voices=[],this.stave=void 0}setOptions(t){this.options=Object.assign(Object.assign({},this.options),t),this.initRenderer(),this.reset()}initRenderer(){const{elementId:t,width:e,height:i,background:s}=this.options.renderer;if(null===t)return;if(""===t)throw Di(this),new p("renderer.elementId not set in FactoryOptions");let n=this.options.renderer.backend;if(void 0===n){n=Rt(document.getElementById(t))?We.Backends.CANVAS:We.Backends.SVG}this.context=We.buildContext(t,n,e,i,s)}getContext(){return this.context}setContext(t){return this.context=t,this}getStave(){return this.stave}getVoices(){return this.voices}setStyle(t){return this.style=Object.assign({},t),this}Sheet(t={}){const e=new pi(Object.assign(Object.assign({},t),{factory:this}));return this.sheets.push(e),e}Stave(t){const e=this.options.stave.space,i=Object.assign({x:0,y:0,width:this.options.renderer.width-1*e,options:{spacingBetweenLinesPx:1*e}},t),s=new ti(i.x,i.y,i.width,i.options);return this.staves.push(s),s.setContext(this.context),this.stave=s,s}TabStave(t){const e=this.options.stave.space,i=Object.assign({x:0,y:0,width:this.options.renderer.width-1*e,options:{spacingBetweenLinesPx:1.3*e}},t),s=new xi(i.x,i.y,i.width,i.options);return this.staves.push(s),s.setContext(this.context),this.stave=s,s}StaveNote(t){const e=new xe(t);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}GlyphNote(t,e,i){const s=new ri(t,e,i);return this.stave&&s.setStave(this.stave),s.setContext(this.context),this.renderQ.push(s),s}RepeatNote(t,e,i){const s=new gi(t,e,i);return this.stave&&s.setStave(this.stave),s.setContext(this.context),this.renderQ.push(s),s}GhostNote(t){const e=new ai(t);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}TextNote(t){const e=new qe(t);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}BarNote(t={}){const e=new Et(t.type);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}ClefNote(t){const e=Object.assign({type:"treble",options:{size:"default",annotation:void 0}},t),i=new Qt(e.type,e.options.size,e.options.annotation);return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}TimeSigNote(t){const e=Object.assign({time:"4/4"},t),i=new vi(e.time);return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}KeySigNote(t){const e=new ci(t.key,t.cancelKey,t.alterKey);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}TabNote(t){const e=new Ti(t);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}GraceNote(t){const e=new hi(t);return this.stave&&e.setStave(this.stave),e.setContext(this.context),e}GraceNoteGroup(t){const e=new ve(t.notes,t.slur);return e.setContext(this.context),e}Accidental(t){const e=new ot(t.type);return e.setContext(this.context),e}Annotation(t){const e=Object.assign({text:"p",hJustify:rt.CENTER,vJustify:ht.BOTTOM},t),i=new ct(e.text);return i.setJustification(e.hJustify),i.setVerticalJustification(e.vJustify),i.setFont(e.font),i.setContext(this.context),i}ChordSymbol(t){const e=Object.assign({vJustify:"top",hJustify:"center"},t),i=new Kt;return i.setHorizontal(e.hJustify),i.setVertical(e.vJustify),"string"==typeof e.fontFamily&&"number"==typeof e.fontSize?"string"==typeof e.fontWeight?i.setFont(e.fontFamily,e.fontSize,e.fontWeight):i.setFont(e.fontFamily,e.fontSize,""):"number"==typeof e.fontSize&&i.setFontSize(e.fontSize),i.setContext(this.context),i}Articulation(t){var e;const i=new xt(null!==(e=null==t?void 0:t.type)&&void 0!==e?e:"a.");return void 0!==(null==t?void 0:t.position)&&i.setPosition(t.position),void 0!==(null==t?void 0:t.betweenLines)&&i.setBetweenLines(t.betweenLines),i.setContext(this.context),i}Ornament(t,e){const i=Object.assign({type:t,accidental:""},e),s=new Ce(t);return void 0!==(null==e?void 0:e.position)&&s.setPosition(e.position),i.upperAccidental&&s.setUpperAccidental(i.upperAccidental),i.lowerAccidental&&s.setLowerAccidental(i.lowerAccidental),void 0!==i.delayed&&s.setDelayed(i.delayed),s.setContext(this.context),s}TextDynamics(t){const e=Object.assign({text:"p",duration:"q",dots:0,line:0},t),i=new ki({text:e.text,line:e.line,duration:e.duration,dots:e.dots});return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),i}Fingering(t){const e=Object.assign({number:"0",position:"left"},t),i=new se(e.number);return i.setPosition(e.position),i.setContext(this.context),i}StringNumber(t,e=!0){const i=new He(t.number);return i.setPosition(t.position),i.setContext(this.context),i.setDrawCircle(e),i}TickContext(){return new Jt}ModifierContext(){return new Xe}MultiMeasureRest(t){const e=f(t.numberOfMeasures,"NoNumberOfMeasures"),i=new li(e,t);return i.setContext(this.context),this.renderQ.push(i),i}Voice(t){const e=Object.assign({time:"4/4"},t),i=new ke(e.time);return this.voices.push(i),i}StaveConnector(t){const e=new ii(t.topStave,t.bottomStave);return e.setType(t.type).setContext(this.context),this.renderQ.push(e),e}Formatter(t){return new ni(t)}Tuplet(t){const e=Object.assign({notes:[],options:{}},t),i=new Bi(e.notes,e.options).setContext(this.context);return this.renderQ.push(i),i}Beam(t){var e,i,s,n,o;const a=new At(t.notes,null===(e=t.options)||void 0===e?void 0:e.autoStem).setContext(this.context);return a.breakSecondaryAt(null!==(s=null===(i=t.options)||void 0===i?void 0:i.secondaryBeamBreaks)&&void 0!==s?s:[]),(null===(n=t.options)||void 0===n?void 0:n.partialBeamDirections)&&Object.entries(null===(o=t.options)||void 0===o?void 0:o.partialBeamDirections).forEach(([t,e])=>{a.setPartialBeamSideAt(Number(t),e)}),this.renderQ.push(a),a}Curve(t){const e=new ee(t.from,t.to,t.options).setContext(this.context);return this.renderQ.push(e),e}StaveTie(t){var e;const i=new we({firstNote:t.from,lastNote:t.to,firstIndexes:t.firstIndexes,lastIndexes:t.lastIndexes},t.text);return(null===(e=t.options)||void 0===e?void 0:e.direction)&&i.setDirection(t.options.direction),i.setContext(this.context),this.renderQ.push(i),i}StaveLine(t){var e,i;const s=new fi({firstNote:t.from,lastNote:t.to,firstIndexes:t.firstIndexes,lastIndexes:t.lastIndexes});return(null===(e=t.options)||void 0===e?void 0:e.text)&&s.setText(t.options.text),(null===(i=t.options)||void 0===i?void 0:i.font)&&s.setFont(t.options.font),s.setContext(this.context),this.renderQ.push(s),s}VibratoBracket(t){const e=new Ci({start:t.from,stop:t.to});return t.options.line&&e.setLine(t.options.line),t.options.code&&e.setVibratoCode(t.options.code),e.setContext(this.context),this.renderQ.push(e),e}TextBracket(t){const e=new bi({start:t.from,stop:t.to,text:t.text,superscript:t.options.superscript,position:t.options.position});return t.options.line&&e.setLine(t.options.line),t.options.font&&e.setFont(t.options.font),e.setContext(this.context),this.renderQ.push(e),e}System(t={}){t.factory=this;const e=new Si(t).setContext(this.context);return this.systems.push(e),e}EasyScore(t={}){return t.factory=this,new pe(t)}PedalMarking(t){const e=Object.assign({notes:[],options:{style:"mixed"}},t),i=new di(e.notes);return i.setType(di.typeString[e.options.style]),i.setContext(this.context),this.renderQ.push(i),i}NoteSubGroup(t){const e=Object.assign({notes:[]},t),i=new Be(e.notes);return i.setContext(this.context),i}draw(t={}){var e;const i=this.context;this.sheets.forEach(t=>t.format());const s=new Set(this.sheets.flatMap(t=>t.getSystems()));this.systems.forEach(t=>{s.has(t)||t.setContext(i).format()});const n=i.getDefaultStyle();i.save(),i.setDefaultStyle(this.style),void 0!==this.style.fillStyle&&i.setFillStyle(this.style.fillStyle),void 0!==this.style.strokeStyle&&i.setStrokeStyle(this.style.strokeStyle),this.retained&&this.renderQ.forEach(t=>t.setRendered(!1));try{this.staves.forEach(t=>t.setContext(i).drawWithStyle()),this.voices.forEach(t=>t.setContext(i).drawWithStyle()),this.renderQ.forEach(t=>{t.isRendered()||t.setContext(i).drawWithStyle()}),this.systems.forEach(t=>t.setContext(i).drawWithStyle())}finally{i.setDefaultStyle(n),i.restore()}this.retained=null!==(e=t.retain)&&void 0!==e&&e,t.retain||this.reset()}}Ei.DEBUG=!1;class Li extends P{static get CATEGORY(){return"StaveHairpin"}static FormatByTicksAndDraw(t,e,i,s,n,o){var a,r;const h=e.pixelsPerTick;if(null===h)throw new p("BadArguments","A valid Formatter must be provide to draw offsets by ticks.");const c=h*(null!==(a=o.leftShiftTicks)&&void 0!==a?a:0),l=h*(null!==(r=o.rightShiftTicks)&&void 0!==r?r:0),d={height:o.height,yShift:o.yShift,leftShiftPx:c,rightShiftPx:l,rightShiftTicks:0,leftShiftTicks:0};new Li({firstNote:i.firstNote,lastNote:i.lastNote},s).setContext(t).setRenderOptions(d).setPosition(n).drawWithStyle()}constructor(t,e){super(),this.setNotes(t),this.hairpin=e,this.position=W.Position.BELOW,this.renderOptions={height:10,yShift:0,leftShiftPx:0,rightShiftPx:0,rightShiftTicks:0,leftShiftTicks:0}}setPosition(t){return t!==W.Position.ABOVE&&t!==W.Position.BELOW||(this.position=t),this}setRenderOptions(t){return this.renderOptions=t,this}setNotes(t){if(!t.firstNote&&!t.lastNote)throw new p("BadArguments","Hairpin needs to have either firstNote or lastNote set.");return this.notes=t,this.firstNote=t.firstNote,this.lastNote=t.lastNote,this}renderHairpin(t){const e=this.checkContext();let i=this.renderOptions.yShift+20,s=t.firstY;this.position===W.Position.ABOVE&&(i=30-i,s=t.firstY-t.staffHeight);const n=this.renderOptions.leftShiftPx,o=this.renderOptions.rightShiftPx;switch(e.beginPath(),this.hairpin){case Li.type.CRESC:e.moveTo(t.lastX+o,s+i),e.lineTo(t.firstX+n,s+this.renderOptions.height/2+i),e.lineTo(t.lastX+o,s+this.renderOptions.height+i);break;case Li.type.DECRESC:e.moveTo(t.firstX+n,s+i),e.lineTo(t.lastX+o,s+this.renderOptions.height/2+i),e.lineTo(t.firstX+n,s+this.renderOptions.height+i)}e.stroke(),e.closePath()}draw(){this.checkContext(),this.setRendered();const t=this.firstNote,e=this.lastNote;if(!t||!e)throw new p("NoNote","Notes required to draw");const i=t.getModifierStartXY(this.position,0),s=e.getModifierStartXY(this.position,0);this.renderHairpin({firstX:i.x,lastX:s.x,firstY:t.checkStave().getY()+t.checkStave().getHeight(),lastY:e.checkStave().getY()+e.checkStave().getHeight(),staffHeight:t.checkStave().getHeight()})}}Li.type={CRESC:1,DECRESC:2};class Ni extends be{static get CATEGORY(){return"TabSlide"}static get SLIDE_UP(){return 1}static get SLIDE_DOWN(){return-1}static createSlideUp(t){return new Ni(t,Ni.SLIDE_UP)}static createSlideDown(t){return new Ni(t,Ni.SLIDE_DOWN)}constructor(t,e){if(super(t,"sl."),!e){let i=t.firstNote.getPositions()[0].fret;"string"==typeof i&&(i=parseInt(i,10));let s=t.lastNote.getPositions()[0].fret;"string"==typeof s&&(s=parseInt(s,10)),e=isNaN(i)||isNaN(s)?Ni.SLIDE_UP:i>s?Ni.SLIDE_DOWN:Ni.SLIDE_UP}this.direction=e,this.renderOptions.cp1=11,this.renderOptions.cp2=14,this.renderOptions.yShift=.5}renderTie(t){if(0===t.firstYs.length||0===t.lastYs.length)throw new p("BadArguments","No Y-values to render");const e=this.checkContext(),i=t.firstX,s=t.firstYs,n=t.lastX,o=t.direction;if(o!==Ni.SLIDE_UP&&o!==Ni.SLIDE_DOWN)throw new p("BadSlide","Invalid slide direction");const a=this.notes.firstIndexes;for(let t=0;t<a.length;++t){const r=s[a[t]]+this.renderOptions.yShift;if(isNaN(r))throw new p("BadArguments","Bad indexes for slide rendering.");e.beginPath(),e.moveTo(i,r+3*o),e.lineTo(n,r-3*o),e.closePath(),e.stroke()}this.setRendered()}}class Fi{static get names(){return{standard:"E/5,B/4,G/4,D/4,A/3,E/3",dagdad:"D/5,A/4,G/4,D/4,A/3,D/3",dropd:"E/5,B/4,G/4,D/4,A/3,D/3",eb:"Eb/5,Bb/4,Gb/4,Db/4,Ab/3,Db/3",standardBanjo:"D/5,B/4,G/4,D/4,G/5"}}constructor(t="E/5,B/4,G/4,D/4,A/3,E/3,B/2,E/2"){this.tuningValues=[],this.setTuning(t)}noteToInteger(t){var e;return null!==(e=K.keyProperties(t).intValue)&&void 0!==e?e:-1}setTuning(t){Object.prototype.hasOwnProperty.call(Fi.names,t)&&(t=Fi.names[t]),this.tuningValues=[];const e=t.split(",").map(t=>t.trim());if(0===e.length)throw new p("BadArguments",`Invalid tuning string: ${t}`);for(let t=0;t<e.length;++t)this.tuningValues[t]=this.noteToInteger(e[t])}getValueForString(t){const e=Number(t);if(e<1||e>this.tuningValues.length)throw new p("BadArguments",`String number must be between 1 and ${this.tuningValues.length}:${t}`);return this.tuningValues[e-1]}getValueForFret(t,e){const i=this.getValueForString(e),s=Number(t);if(s<0)throw new p("BadArguments",`Fret number must be 0 or higher: ${t}`);return i+s}getNoteForFret(t,e){const i=this.getValueForFret(t,e),s=Math.floor(i/12),n=i%12;return`${K.integerToNote(n)}/${s}`}}var Ai=function(t,e,i,s){return new(i||(i=Promise))(function(n,o){function a(t){try{h(s.next(t))}catch(t){o(t)}}function r(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(a,r)}h((s=s.apply(t,e||[])).next())})};class Oi{static loadFonts(...t){return Ai(this,void 0,void 0,function*(){t||(t=Object.keys(A.FILES));const e=[];for(const i of t)e.push(A.load(i));yield Promise.all(e)})}static setFonts(...t){const e=t.flatMap(t=>t.split(",").map(t=>t.trim())).filter(Boolean);C.fontFamily=e.join(",");const i=e.filter(t=>A.TEXT_FONT_NAMES.includes(t));Oi.setTextFonts(...i.length?i:["Academico"])}static setTextFonts(...t){C.textFontFamily=[...new Set([...t,...Oi.getFonts()])].join(","),B.clear()}static getTextFonts(){return B.get("textFontFamily").split(",")}static getFonts(){return B.get("fontFamily").split(",")}static get RENDER_PRECISION_PLACES(){return K.RENDER_PRECISION_PLACES}static set RENDER_PRECISION_PLACES(t){K.RENDER_PRECISION_PLACES=t}static get SOFTMAX_FACTOR(){return K.SOFTMAX_FACTOR}static set SOFTMAX_FACTOR(t){K.SOFTMAX_FACTOR=t}static get UNISON(){return K.UNISON}static set UNISON(t){K.UNISON=t}static get NOTATION_FONT_SCALE(){return K.NOTATION_FONT_SCALE}static set NOTATION_FONT_SCALE(t){K.NOTATION_FONT_SCALE=t}static get TABLATURE_FONT_SCALE(){return K.TABLATURE_FONT_SCALE}static set TABLATURE_FONT_SCALE(t){K.TABLATURE_FONT_SCALE=t}static get RESOLUTION(){return K.RESOLUTION}static set RESOLUTION(t){K.RESOLUTION=t}static get SLASH_NOTEHEAD_WIDTH(){return K.SLASH_NOTEHEAD_WIDTH}static set SLASH_NOTEHEAD_WIDTH(t){K.SLASH_NOTEHEAD_WIDTH=t}static get STAVE_LINE_DISTANCE(){return K.STAVE_LINE_DISTANCE}static set STAVE_LINE_DISTANCE(t){K.STAVE_LINE_DISTANCE=t}static get STAVE_LINE_THICKNESS(){return C.Stave.lineWidth}static set STAVE_LINE_THICKNESS(t){C.Stave.lineWidth=t,C.TabStave.lineWidth=t,B.clear("Stave"),B.clear("TabStave")}static get STEM_HEIGHT(){return K.STEM_HEIGHT}static set STEM_HEIGHT(t){K.STEM_HEIGHT=t}static get STEM_WIDTH(){return K.STEM_WIDTH}static set STEM_WIDTH(t){K.STEM_WIDTH=t}static get TIME4_4(){return K.TIME4_4}static get unicode(){return K.unicode}static keySignature(t){return K.keySignature(t)}static hasKeySignature(t){return K.hasKeySignature(t)}static getKeySignatures(){return K.getKeySignatures()}static clefProperties(t){return K.clefProperties(t)}static keyProperties(t,e,i){return K.keyProperties(t,e,i)}static durationToTicks(t){return K.durationToTicks(t)}}Oi.BUILD={VERSION:"5.1.2",ID:"419436ad3c5fb5efeb2590a6a88b2a403cbdae64",DATE:"2026-11-16T14:50:27.719Z",INFO:""},Oi.Accidental=ot,Oi.Annotation=ct,Oi.Articulation=xt,Oi.Barline=Dt,Oi.BarNote=Et,Oi.Beam=At,Oi.Bend=Ot,Oi.BoundingBox=D,Oi.CanvasContext=Pt,Oi.ChordSymbol=Kt,Oi.Clef=$t,Oi.ClefNote=Qt,Oi.Crescendo=Zt,Oi.Curve=ee,Oi.Dot=ie,Oi.EasyScore=pe,Oi.Element=P,Oi.Factory=Ei,Oi.Font=A,Oi.Formatter=ni,Oi.Fraction=y,Oi.FretHandFinger=se,Oi.GhostNote=ai,Oi.GlyphNote=ri,Oi.GraceNote=hi,Oi.GraceNoteGroup=ve,Oi.GraceTabNote=class extends Ti{static get CATEGORY(){return"GraceTabNote"}constructor(t){super(t,!1),this.renderOptions=Object.assign(Object.assign({},this.renderOptions),{yShift:.3}),this.updateWidth()}},Oi.KeyManager=class{constructor(t){this.music=new H,this.setKey(t)}setKey(t){return this.key=t,this.reset(),this}getKey(){return this.key}reset(){this.keyParts=this.music.getKeyParts(this.key),this.keyString=this.keyParts.root,this.keyParts.accidental&&(this.keyString+=this.keyParts.accidental);if(!H.scaleTypes[this.keyParts.type])throw new p("BadArguments",`Unsupported key type: ${this.key}`);this.scale=this.music.getScaleTones(this.music.getNoteValue(this.keyString),H.scaleTypes[this.keyParts.type]),this.scaleMap={},this.scaleMapByValue={},this.originalScaleMapByValue={};const t=H.rootIndexes[this.keyParts.root];for(let e=0;e<H.roots.length;++e){const i=(t+e)%H.roots.length,s=H.roots[i],n=this.music.getRelativeNoteName(s,this.scale[e]);this.scaleMap[s]=n,this.scaleMapByValue[this.scale[e]]=n,this.originalScaleMapByValue[this.scale[e]]=n}return this}getAccidental(t){const e=this.music.getKeyParts(t).root,i=this.music.getNoteParts(this.scaleMap[e]);return{note:this.scaleMap[e],accidental:i.accidental}}selectNote(t){t=t.toLowerCase();const e=this.music.getNoteParts(t),i=this.scaleMap[e.root],s=this.music.getNoteParts(i);if(i===t)return{note:i,accidental:e.accidental,change:!1};const n=this.scaleMapByValue[this.music.getNoteValue(t)];if(void 0!==n)return{note:n,accidental:this.music.getNoteParts(n).accidental,change:!1};const o=this.originalScaleMapByValue[this.music.getNoteValue(t)];return void 0!==o?(this.scaleMap[s.root]=o,delete this.scaleMapByValue[this.music.getNoteValue(i)],this.scaleMapByValue[this.music.getNoteValue(t)]=o,{note:o,accidental:this.music.getNoteParts(o).accidental,change:!0}):s.root===t?(delete this.scaleMapByValue[this.music.getNoteValue(this.scaleMap[e.root])],this.scaleMapByValue[this.music.getNoteValue(s.root)]=s.root,this.scaleMap[s.root]=s.root,{note:s.root,accidental:void 0,change:!0}):(delete this.scaleMapByValue[this.music.getNoteValue(this.scaleMap[e.root])],this.scaleMapByValue[this.music.getNoteValue(t)]=t,delete this.scaleMap[s.root],this.scaleMap[s.root]=t,{note:t,accidental:e.accidental,change:!0})}},Oi.KeySignature=Ye,Oi.KeySigNote=ci,Oi.Modifier=W,Oi.ModifierContext=Xe,Oi.MultiMeasureRest=li,Oi.Music=H,Oi.Note=yt,Oi.NoteHead=me,Oi.NoteSubGroup=Be,Oi.Ornament=Ce,Oi.Parenthesis=De,Oi.Parser=ae,Oi.PedalMarking=di,Oi.Registry=R,Oi.RenderContext=wt,Oi.Renderer=We,Oi.RepeatNote=gi,Oi.Repetition=_e,Oi.Stave=ti,Oi.StaveConnector=ii,Oi.StaveHairpin=Li,Oi.StaveLine=fi,Oi.StaveModifier=Ct,Oi.StaveNote=xe,Oi.StaveTempo=je,Oi.StaveText=Ke,Oi.StaveTie=we,Oi.Stem=at,Oi.StringNumber=He,Oi.Stroke=Ge,Oi.SVGContext=Oe,Oi.System=Si,Oi.Sheet=pi,Oi.TabNote=Ti,Oi.TabSlide=Ni,Oi.TabStave=xi,Oi.TabTie=be,Oi.TextBracket=bi,Oi.TextDynamics=ki,Oi.TextNote=qe,Oi.TickContext=Jt,Oi.TimeSignature=Qe,Oi.TimeSigNote=vi,Oi.Tremolo=class extends W{static get CATEGORY(){return"Tremolo"}constructor(t){super(),this.num=t,this.position=W.Position.CENTER,this.text=I.tremolo1}draw(){const t=this.checkContext(),e=this.checkAttachedNote();this.setRendered();const i=e.getStemDirection(),s=e.getFontScale(),n=B.get("Tremolo.spacing")*i*s,o=e.getAbsoluteX()+(i===at.UP?e.getGlyphWidth()-at.WIDTH/2:at.WIDTH/2);let a=e.getStemExtents().topY+(this.num<=3?n:0);this.fontInfo.size=B.get("Tremolo.fontSize")*s;for(let e=0;e<this.num;++e)this.renderText(t,o,a),a+=n}},Oi.Tuning=Fi,Oi.Tuplet=Bi,Oi.Vibrato=Ue,Oi.VibratoBracket=Ci,Oi.Voice=ke,Oi.Volta=$e,Oi.RuntimeError=p,Oi.Test=void 0,Oi.AnnotationHorizontalJustify=rt,Oi.AnnotationVerticalJustify=ht,Oi.ChordSymbolHorizontalJustify=_t,Oi.ChordSymbolVerticalJustify=zt,Oi.SymbolModifiers=jt,Oi.CurvePosition=qt,Oi.FontWeight=E,Oi.FontStyle=L,Oi.Glyphs=I,Oi.ModifierPosition=M,Oi.RendererBackends=Re,Oi.RendererLineEndType=Pe,Oi.BarlineType=vt,Oi.RepeatBracketType=Bt,Oi.StaveModifierPosition=kt,Oi.VoltaType=Ie,Oi.TextBracketPosition=wi,Oi.TextJustification=Me,Oi.VoiceMode=ye,Oi.BUILD.INFO="vexflow-core";const Ri=Oi;return e=e.default,e})());
|
|
5
|
+
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.VexFlow=e():t.VexFlow=e()}("undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:this,()=>(()=>{"use strict";const t={d:(e,i)=>{if(Array.isArray(i))for(var s=0;s<i.length;){var n=i[s++],o=i[s++];t.o(e,n)?0===o&&s++:0===o?Object.defineProperty(e,n,{enumerable:!0,value:i[s++]}):Object.defineProperty(e,n,{enumerable:!0,get:o})}else for(var n in i)t.o(i,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:i[n]})}};t.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),t.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);let e={};t.d(e,{default:()=>as});const i="object"==typeof self?self:globalThis,s=t=>((t,e)=>{const s=(e,i)=>(t.set(i,e),e),n=o=>{if(t.has(o))return t.get(o);const[a,r]=e[o];switch(a){case 0:case-1:return s(r,o);case 1:{const t=s([],o);for(const e of r)t.push(n(e));return t}case 2:{const t=s({},o);for(const[e,i]of r)t[n(e)]=n(i);return t}case 3:return s(new Date(r),o);case 4:{const{source:t,flags:e}=r;return s(new RegExp(t,e),o)}case 5:{const t=s(new Map,o);for(const[e,i]of r)t.set(n(e),n(i));return t}case 6:{const t=s(new Set,o);for(const e of r)t.add(n(e));return t}case 7:{const{name:t,message:e}=r;return s(new i[t](e),o)}case 8:return s(BigInt(r),o);case"BigInt":return s(Object(BigInt(r)),o)}return s(new i[a](r),o)};return n})(new Map,t)(0),n="",{toString:o}={},{keys:a}=Object,r=t=>{const e=typeof t;if("object"!==e||!t)return[0,e];const i=o.call(t).slice(8,-1);switch(i){case"Array":return[1,n];case"Object":return[2,n];case"Date":return[3,n];case"RegExp":return[4,n];case"Map":return[5,n];case"Set":return[6,n]}return i.includes("Array")?[1,i]:i.includes("Error")?[7,i]:[2,i]},h=([t,e])=>0===t&&("function"===e||"symbol"===e),c=(t,{json:e,lossy:i}={})=>{const s=[];return((t,e,i,s)=>{const n=(t,e)=>{const n=s.push(t)-1;return i.set(e,n),n},o=s=>{if(i.has(s))return i.get(s);let[c,l]=r(s);switch(c){case 0:{let e=s;switch(l){case"bigint":c=8,e=s.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);e=null;break;case"undefined":return n([-1],s)}return n([c,e],s)}case 1:{if(l)return n([l,[...s]],s);const t=[],e=n([c,t],s);for(const e of s)t.push(o(e));return e}case 2:{if(l)switch(l){case"BigInt":return n([l,s.toString()],s);case"Boolean":case"Number":case"String":return n([l,s.valueOf()],s)}if(e&&"toJSON"in s)return o(s.toJSON());const i=[],d=n([c,i],s);for(const e of a(s))!t&&h(r(s[e]))||i.push([o(e),o(s[e])]);return d}case 3:return n([c,s.toISOString()],s);case 4:{const{source:t,flags:e}=s;return n([c,{source:t,flags:e}],s)}case 5:{const e=[],i=n([c,e],s);for(const[i,n]of s)(t||!h(r(i))&&!h(r(n)))&&e.push([o(i),o(n)]);return i}case 6:{const e=[],i=n([c,e],s);for(const i of s)!t&&h(r(i))||e.push(o(i));return i}}const{message:d}=s;return n([c,{name:l,message:d}],s)};return o})(!(e||i),!!e,new Map,s)(t),s},l="function"==typeof structuredClone?(t,e)=>e&&("json"in e||"lossy"in e)?s(c(t,e)):structuredClone(t):(t,e)=>s(c(t,e)),{parse:d,stringify:u}=JSON,g=l;class p extends Error{constructor(t,e=""){super("[RuntimeError] "+t+": "+e),this.code=t}}function m(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t.g?t.g:Function("return this")()}function f(t,e="undefined",i=""){if(void 0===t)throw new p(e,i);return t}function S(t,...e){if(!e)return;const i=Array.prototype.slice.call(e).join(" ");m().console.log(t+": "+i)}function x(t,e){let i=e+(t-e)/2;var s,n;return i%2>0&&(i=((s=10*i)%(n=5)>=n/2?parseInt(""+s/n,10)*n+n:parseInt(""+s/n,10)*n)/10),i}function w(t){return`vf-${t}`}function T(t){return(t%=2*Math.PI)<0&&(t+=2*Math.PI),t}function b(t){return t.reduce((t,e)=>t+e,0)}class y{static get CATEGORY(){return"Fraction"}static GCD(t,e){if(!Number.isFinite(t)||!Number.isFinite(e))throw new p("BadArgument",`Invalid numbers: ${t}, ${e}`);let i;for(;0!==e;)i=e,e=t%e,t=i;return t}static LCM(t,e){return t*e/y.GCD(t,e)}static LCMM(t){return 0===t.length?0:1===t.length?t[0]:2===t.length?y.LCM(t[0],t[1]):y.LCM(t.shift(),y.LCMM(t))}constructor(t,e){this.numerator=1,this.denominator=1,this.set(t,e)}set(t=1,e=1){if(!Number.isFinite(t)||!Number.isFinite(e)||0===e)throw new p("BadArgument",`Invalid fraction: ${t}/${e}`);return this.numerator=t,this.denominator=e,this}value(){return this.numerator/this.denominator}simplify(){let t=this.numerator,e=this.denominator;const i=y.GCD(t,e);return t/=i,e/=i,e<0&&(e=-e,t=-t),this.set(t,e)}add(t=0,e=1){const[i,s]=v(t,e),n=y.LCM(this.denominator,s),o=n/this.denominator,a=n/s,r=this.numerator*o+i*a;return this.set(r,n)}subtract(t=0,e=1){const[i,s]=v(t,e),n=y.LCM(this.denominator,s),o=n/this.denominator,a=n/s,r=this.numerator*o-i*a;return this.set(r,n)}multiply(t=1,e=1){const[i,s]=v(t,e);return this.set(this.numerator*i,this.denominator*s)}divide(t=1,e=1){const[i,s]=v(t,e);return this.set(this.numerator*s,this.denominator*i)}equals(t){const e=y.fractionA.copy(t).simplify(),i=y.fractionB.copy(this).simplify();return e.numerator===i.numerator&&e.denominator===i.denominator}greaterThan(t){const e=y.fractionA.copy(this);return e.subtract(t),e.numerator>0}greaterThanEquals(t){const e=y.fractionA.copy(this);return e.subtract(t),e.numerator>=0}lessThan(t){return!this.greaterThanEquals(t)}lessThanEquals(t){return!this.greaterThan(t)}clone(){return new y(this.numerator,this.denominator)}copy(t){return"number"==typeof t?this.set(t):this.set(t.numerator,t.denominator)}quotient(){return Math.floor(this.numerator/this.denominator)}remainder(){return this.numerator%this.denominator}makeAbs(){return this.denominator=Math.abs(this.denominator),this.numerator=Math.abs(this.numerator),this}toString(){return`${this.numerator}/${this.denominator}`}toSimplifiedString(){return y.fractionA.copy(this).simplify().toString()}toMixedString(){let t="";const e=this.quotient(),i=y.fractionA.copy(this);return e<0&&i.makeAbs(),0!==e?(t+=e,0!==i.numerator&&(t+=` ${i.toSimplifiedString()}`)):t=0===i.numerator?"0":i.toSimplifiedString(),t}parse(t){const e=t.split("/"),i=parseInt(e[0],10),s=e[1]?parseInt(e[1],10):1;return this.set(i,s)}}function v(t,e=1){return"number"==typeof t?[t,e]:[t.numerator,t.denominator]}y.fractionA=new y,y.fractionB=new y;class k{static clear(){this.entries.clear()}static fontsReady(){var t;const e="undefined"!=typeof document?document.fonts:globalThis.fonts;if(e!==this.fonts){for(const i of["loading","loadingdone","loadingerror"])null===(t=this.fonts)||void 0===t||t.removeEventListener(i,this.onFontsChanged),null==e||e.addEventListener(i,this.onFontsChanged);this.fonts=e,this.clear()}return(null==e?void 0:e.size)===this.fontCount&&(null==e?void 0:e.status)===this.fontStatus||(this.fontCount=null==e?void 0:e.size,this.fontStatus=null==e?void 0:e.status,this.clear()),"loading"!==(null==e?void 0:e.status)}static snapshot(t){return Object.freeze({width:t.width,actualBoundingBoxLeft:t.actualBoundingBoxLeft,actualBoundingBoxRight:t.actualBoundingBoxRight,actualBoundingBoxAscent:t.actualBoundingBoxAscent,actualBoundingBoxDescent:t.actualBoundingBoxDescent,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent,emHeightAscent:t.emHeightAscent,emHeightDescent:t.emHeightDescent,hangingBaseline:t.hangingBaseline,alphabeticBaseline:t.alphabeticBaseline,ideographicBaseline:t.ideographicBaseline})}static measure(t,e){var i,s,n;t!==this.context&&(this.context=t,this.clear());const o=this.fontsReady();let a=t.lang,r=t.direction;const h=t.canvas;h&&"ownerDocument"in h&&("inherit"===r&&(r=h.isConnected?(null===(i=h.ownerDocument.defaultView)||void 0===i?void 0:i.getComputedStyle(h).direction)||"ltr":h.style.direction||h.dir||"ltr"),a&&"inherit"!==a||(a=null!==(n=null===(s=h.closest("[lang]"))||void 0===s?void 0:s.getAttribute("lang"))&&void 0!==n?n:h.ownerDocument.documentElement.lang));const c=JSON.stringify([t.font,r,t.textAlign,t.textBaseline,t.fontKerning,t.fontStretch,t.fontVariantCaps,t.letterSpacing,t.wordSpacing,t.textRendering,a,e]),l=o?this.entries.get(c):void 0;if(l)return this.entries.delete(c),this.entries.set(c,l),l;const d=this.snapshot(t.measureText(e));return o&&c.length<=this.maxKeyLength&&(this.entries.size>=this.maxEntries&&this.entries.delete(this.entries.keys().next().value),this.entries.set(c,d)),d}}k.maxEntries=2048,k.maxKeyLength=4096,k.entries=new Map,k.onFontsChanged=()=>k.clear();class B{static clear(t){k.clear(),t?(this.cacheFont.delete(t),this.cacheStyle.delete(t)):(this.cacheFont.clear(),this.cacheStyle.clear())}static getFontInfo(t){let e=this.cacheFont.get(t);return e||(e={family:B.getFontFamily(t),size:B.get(`${t}.fontSize`)*B.get(`${t}.fontScale`),weight:B.get(`${t}.fontWeight`),style:B.get(`${t}.fontStyle`)},this.cacheFont.set(t,e)),Object.assign({},e)}static getFontFamily(t){var e;if(!B.get(`${t}.isText`,!1))return B.get(`${t}.fontFamily`);let i=C.textFontFamily,s=C;for(const n of t.split(".")){if(s=null==s?void 0:s[n],!s)break;i=null!==(e=s.fontFamily)&&void 0!==e?e:i}return i}static getStyle(t){let e=this.cacheStyle.get(t);return e||(e={fillStyle:B.get(`${t}.fillStyle`),strokeStyle:B.get(`${t}.strokeStyle`),lineWidth:B.get(`${t}.lineWidth`),lineDash:B.get(`${t}.lineDash`),shadowBlur:B.get(`${t}.shadowBlur`),shadowColor:B.get(`${t}.shadowColor`)},this.cacheStyle.set(t,e)),Object.assign({},e)}static get(t,e){var i;const s=t.split("."),n=s.pop();let o=C,a=e;for(;o;){a=null!==(i=o[n])&&void 0!==i?i:a;const t=s.shift();if(!t)break;o=o[t]}return a}}B.cacheStyle=new Map,B.cacheFont=new Map;const C={pointerRect:!1,fontFamily:"Bravura,Academico",textFontFamily:"Academico,Bravura",fontSize:30,fontScale:1,fontWeight:"normal",fontStyle:"normal",Accidental:{cautionary:{fontSize:20},grace:{fontSize:20},noteheadAccidentalPadding:1,leftPadding:2,accidentalSpacing:3},Annotation:{isText:!0,fontSize:10},Bend:{isText:!0,fontSize:10,line:{strokeStyle:"#777777",lineWidth:1}},ChordSymbol:{isText:!0,fontSize:12,spacing:.05,subscriptOffset:.2,superscriptOffset:-.4,superSubRatio:.6},FretHandFinger:{isText:!0,fontSize:9,fontWeight:"bold"},GraceNote:{fontScale:2/3},GraceTabNote:{fontScale:2/3},NoteHead:{minPadding:2},PedalMarking:{text:{isText:!0,fontSize:12,fontStyle:"italic"}},Repetition:{text:{isText:!0,fontSize:12,fontWeight:"bold",offsetX:12,offsetY:25,spacing:5},coda:{offsetY:25},segno:{offsetY:10}},Stave:{isText:!0,strokeStyle:"#999999",fontSize:8,padding:12,endPaddingMax:10,endPaddingMin:5,unalignedNotePadding:10},StaveConnector:{text:{isText:!0,fontSize:16}},StaveLine:{isText:!0,fontSize:10},StaveNote:{pointerRect:!0},StaveSection:{isText:!0,fontSize:10,fontWeight:"bold",lineWidth:2,padding:2,strokeStyle:"black"},StaveTempo:{isText:!0,fontSize:14,glyph:{isText:!1,fontSize:25},name:{fontWeight:"bold"}},StaveText:{isText:!0,fontSize:16},StaveTie:{isText:!0,fontSize:10},Stem:{strokeStyle:"black"},StringNumber:{isText:!0,fontSize:10,fontWeight:"bold",verticalPadding:8,stemPadding:2,leftPadding:5,rightPadding:6},Stroke:{text:{isText:!0,fontSize:10,fontStyle:"italic",fontWeight:"bold"}},TabNote:{text:{isText:!0,fontSize:9}},TabSlide:{isText:!0,fontSize:10,fontStyle:"italic",fontWeight:"bold"},TabStave:{isText:!0,strokeStyle:"#999999",fontSize:8},TabTie:{isText:!0,fontSize:10},TextBracket:{isText:!0,fontSize:15,fontStyle:"italic"},TextNote:{text:{isText:!0,fontSize:12}},Tremolo:{spacing:7},Tuplet:{pointerRect:!0,yOffset:0,textYOffset:2,bracket:{padding:5,lineWidth:1,legLength:10},suffix:{fontScale:.5,extraSpacing:1,suffixOffsetY:-3}},Volta:{isText:!0,fontSize:9,fontWeight:"bold"}};class D{static copy(t){return new D(t.x,t.y,t.w,t.h)}constructor(t,e,i,s){this.x=t,this.y=e,this.w=i,this.h=s}getX(){return this.x}getY(){return this.y}getW(){return this.w}getH(){return this.h}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setW(t){return this.w=t,this}setH(t){return this.h=t,this}move(t,e){return this.x+=t,this.y+=e,this}clone(){return D.copy(this)}mergeWith(t){const e=t,i=this.x<e.x?this.x:e.x,s=this.y<e.y?this.y:e.y,n=Math.max(this.x+this.w,e.x+e.w)-i,o=Math.max(this.y+this.h,e.y+e.h)-s;return this.x=i,this.y=s,this.w=n,this.h=o,this}}var E,L,N=function(t,e,i,s){return new(i||(i=Promise))(function(n,o){function a(t){try{h(s.next(t))}catch(t){o(t)}}function r(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(a,r)}h((s=s.apply(t,e||[])).next())})};let O;!function(t){t.NORMAL="normal",t.BOLD="bold"}(E||(E={})),function(t){t.NORMAL="normal",t.ITALIC="italic"}(L||(L={}));class A{static convertSizeToPixelValue(t){var e;if("number"==typeof t)return t*A.scaleToPxFrom.pt;{const i=parseFloat(t);if(isNaN(i))return 0;const s=t.replace(/[\d.\s]/g,"").toLowerCase();return i*(null!==(e=A.scaleToPxFrom[s])&&void 0!==e?e:1)}}static convertSizeToPointValue(t){var e;if("number"==typeof t)return t;{const i=parseFloat(t);if(isNaN(i))return 0;const s=t.replace(/[\d.\s]/g,"").toLowerCase();return i*((null!==(e=A.scaleToPxFrom[s])&&void 0!==e?e:1)/A.scaleToPxFrom.pt)}}static validate(t,e,i,s){if("string"==typeof t&&void 0===e&&void 0===i&&void 0===s)return A.fromCSSString(t);let n;return"object"==typeof t?(n=t.family,e=t.size,i=t.weight,s=t.style):n=t,n=null!=n?n:B.get("fontFamily"),e=null!=e?e:B.get("fontSize")+"pt",i=null!=i?i:E.NORMAL,s=null!=s?s:L.NORMAL,""===i&&(i=E.NORMAL),""===s&&(s=L.NORMAL),"number"==typeof e&&(e=`${e}pt`),"number"==typeof i&&(i=i.toString()),{family:n,size:e,weight:i,style:s}}static fromCSSString(t){O||(O=document.createElement("span")),O.style.font=t;const{fontFamily:e,fontSize:i,fontWeight:s,fontStyle:n}=O.style;return{family:e,size:i,weight:s,style:n}}static toCSSString(t){var e;if(!t)return"";let i;const s=t.style;let n;i=s===L.NORMAL||""===s||void 0===s?"":s.trim()+" ";const o=t.weight;let a;n=o===E.NORMAL||""===o||void 0===o?"":"number"==typeof o?o+" ":o.trim()+" ";const r=t.size;a=void 0===r?B.get("fontSize")+"pt":"number"==typeof r?r+"pt ":r.trim()+" ";return`${i}${n}${a}${null!==(e=t.family)&&void 0!==e?e:B.get("fontFamily")}`}static scaleSize(t,e){if("number"==typeof t)return t*e;return`${parseFloat(t)*e}${t.replace(/[\d.\s]/g,"")}`}static isBold(t){if(t){if("number"==typeof t)return t>=600;{const e=parseInt(t,10);return isNaN(e)?"bold"===t.toLowerCase():e>=600}}return!1}static isItalic(t){return!!t&&t.toLowerCase()===L.ITALIC}static load(t,e,i){return N(this,void 0,void 0,function*(){if("undefined"==typeof FontFace)return Promise.reject(new Error("FontFace API is not available in this environment. Cannot load fonts."));if(void 0===e){const i=A.FILES;if(!(t in i))return Promise.reject(new Error(`Font ${t} not found in Font.FILES`));e=A.HOST_URL+i[t]}const s=new FontFace(t,`url(${e})`,i),n=s.load();let o;return"undefined"!=typeof document?o=document.fonts:"undefined"!=typeof self&&"fonts"in self&&(o=self.fonts),null==o||o.add(s),k.clear(),n.finally(()=>k.clear())})}static getURLForFont(t){const e=A.FILES;if(t in e)return A.HOST_URL+e[t]}}A.TEXT_FONT_NAMES=["Academico","Edwin","Bravura Text","Finale Ash Text","Finale Broadway Text","Finale Jazz Text","Finale Maestro Text","Gootville Text","Leland Text","MuseJazz Text","Nepomuk","Petaluma Script","Petaluma Text","Roboto Slab","Sebastian Text"],A.scaleToPxFrom={pt:4/3,px:1,em:16,"%":.16,in:96,mm:96/25.4,cm:96/2.54},A.HOST_URL="https://cdn.jsdelivr.net/npm/@vexflow-fonts/",A.FILES={Academico:"academico/academico.woff2",Bravura:"bravura/bravura.woff2","Bravura Text":"bravuratext/bravuratext.woff2",Edwin:"edwin/edwin-roman.woff2","Finale Ash":"finaleash/finaleash.woff2","Finale Ash Text":"finaleashtext/finaleashtext.woff2","Finale Broadway":"finalebroadway/finalebroadway.woff2","Finale Broadway Text":"finalebroadwaytext/finalebroadwaytext.woff2","Finale Jazz":"finalejazz/finalejazz.woff2","Finale Jazz Text":"finalejazztext/finalejazztext.woff2","Finale Maestro":"finalemaestro/finalemaestro.woff2","Finale Maestro Text":"finalemaestrotext/finalemaestrotext-regular.woff2",Gonville:"gonville/gonville.woff2",Gootville:"gootville/gootville.woff2","Gootville Text":"gootvilletext/gootvilletext.woff2",Leipzig:"leipzig/leipzig.woff2",Leland:"leland/leland.woff2","Leland Text":"lelandtext/lelandtext.woff2",MuseJazz:"musejazz/musejazz.woff2","MuseJazz Text":"musejazztext/musejazztext.woff2",Nepomuk:"nepomuk/nepomuk.woff2",Petaluma:"petaluma/petaluma.woff2","Petaluma Script":"petalumascript/petalumascript.woff2","Petaluma Text":"petalumatext/petalumatext.woff2","Roboto Slab":"robotoslab/robotoslab-regular-400.woff2",Sebastian:"sebastian/sebastian.woff2","Sebastian Text":"sebastiantext/sebastiantext.woff2"};class F{constructor(){this.id=Object.create(null),this.type=Object.create(null),this.class=Object.create(null)}static isValidName(t){return"id"===t||"type"===t||"class"===t}}class M{static getDefaultRegistry(){return M.defaultRegistry}static enableDefaultRegistry(t){M.defaultRegistry=t}static disableDefaultRegistry(){M.defaultRegistry=void 0}transaction(t){const e=new F;for(const t of Object.keys(this.index))for(const[i,s]of Object.entries(this.index[t]))e[t][i]=Object.assign(Object.create(null),s);const i=new Set(Object.values(e.id).flatMap(t=>Object.values(t))),s=new Set;this.transactions.push(s);try{return t()}catch(t){throw s.forEach(t=>{i.has(t)||t.onRegister(void 0)}),this.index=e,t}finally{this.transactions.pop()}}constructor(){this.transactions=[],this.index=new F}clear(){return this.index=new F,this}setIndexValue(t,e,i,s){if(!F.isValidName(t))throw new p("BadArgument",`Unknown registry index: ${t}`);const n=this.index;n[t][e]||(n[t][e]=Object.create(null)),n[t][e][i]=s}updateIndex({id:t,name:e,value:i,oldValue:s}){if(!F.isValidName(e))throw new p("BadArgument",`Unknown registry index: ${e}`);const n=this.getElementById(t);void 0!==s&&this.index[e][s]&&delete this.index[e][s][t],i&&n&&this.setIndexValue(e,i,n.getAttribute("id"),n)}register(t,e){if(!(e=e||t.getAttribute("id")))throw new p("Can't add element without `id` attribute to registry");return this.transactions.forEach(e=>e.add(t)),t.setAttribute("id",e),this.setIndexValue("id",e,e,t),this.updateIndex({id:e,name:"type",value:t.getAttribute("type"),oldValue:void 0}),t.onRegister(this),this}getElementById(t){var e,i;return null===(i=null===(e=this.index.id)||void 0===e?void 0:e[t])||void 0===i?void 0:i[t]}getElementsByAttribute(t,e){if(!F.isValidName(t))return[];const i=this.index[t];if(i){const t=i[e];if(t){return Object.keys(t).map(e=>t[e])}}return[]}getElementsByType(t){return this.getElementsByAttribute("type",t)}getElementsByClass(t){return this.getElementsByAttribute("class",t)}onUpdate(t){return F.isValidName(t.name)&&this.updateIndex(t),this}}class P{static get CATEGORY(){return"Element"}static newID(){return"auto"+P.ID++}static setTextMeasurementCanvas(t){P.txtCanvas=t,P.clearTextMeasurementCache()}static clearTextMeasurementCache(){k.clear()}static getTextMeasurementCanvas(){let t=P.txtCanvas;return t||("undefined"!=typeof document?t=document.createElement("canvas"):"undefined"!=typeof OffscreenCanvas&&(t=new OffscreenCanvas(300,150)),P.txtCanvas=t),t}constructor(t){var e;this.children=[],this.style={},this.styleExplicit=!1,this._text="",this.metricsValid=!1,this._textMetrics={fontBoundingBoxAscent:0,fontBoundingBoxDescent:0,actualBoundingBoxAscent:0,actualBoundingBoxDescent:0,actualBoundingBoxLeft:0,actualBoundingBoxRight:0,width:0,alphabeticBaseline:0,emHeightAscent:0,emHeightDescent:0,hangingBaseline:0,ideographicBaseline:0},this._height=0,this._width=0,this.xShift=0,this.yShift=0,this.x=0,this.y=0,this.attrs={id:P.newID(),type:null!=t?t:this.constructor.CATEGORY,class:""},this.rendered=!1,this._fontInfo=B.getFontInfo(this.attrs.type),this.style=B.getStyle(this.attrs.type),this.fontScale=B.get(`${this.attrs.type}.fontScale`),this.shouldDrawPointerRect=B.get(`${this.attrs.type}.pointerRect`),null===(e=M.getDefaultRegistry())||void 0===e||e.register(this)}addChild(t){if(t.parent)throw new p("Element","Parent already defined");return t.parent=this,this.children.push(t),this}getCategory(){return this.attrs.type}setStyle(t){return this.style=t,this.styleExplicit=!0,this}setGroupStyle(t){return this.style=t,this.styleExplicit=!0,this.children.forEach(e=>e.setGroupStyle(t)),this}getStyle(){return this.style}applyStyle(t=this.context,e=this.getStyle()){if(!t)return this;if(e===this.style&&!this.styleExplicit){const i=t.getDefaultStyle();e=Object.assign({},e),void 0!==i.fillStyle&&delete e.fillStyle,void 0!==i.strokeStyle&&delete e.strokeStyle}return e.shadowColor&&t.setShadowColor(e.shadowColor),void 0!==e.shadowBlur&&t.setShadowBlur(e.shadowBlur),e.fillStyle&&t.setFillStyle(e.fillStyle),e.strokeStyle&&t.setStrokeStyle(e.strokeStyle),void 0!==e.lineWidth&&t.setLineWidth(e.lineWidth),void 0!==e.lineDash&&t.setLineDash(e.lineDash?e.lineDash.split(" ").map(Number):[]),this}drawWithStyle(){const t=this.checkContext(),e=t.getDefaultStyle();t.save();try{if(this.styleExplicit){const i=Object.assign({},e);void 0!==this.style.fillStyle&&(i.fillStyle=this.style.fillStyle),void 0!==this.style.strokeStyle&&(i.strokeStyle=this.style.strokeStyle),t.setDefaultStyle(i)}this.applyStyle(t),this.draw()}finally{t.setDefaultStyle(e),t.restore()}return this}draw(){throw new p("Element","Draw not defined")}hasClass(t){var e;return!!this.attrs.class&&-1!==(null===(e=this.attrs.class)||void 0===e?void 0:e.split(" ").indexOf(t))}addClass(t){var e;return this.hasClass(t)||(this.attrs.class?this.attrs.class=`${this.attrs.class} ${t}`:this.attrs.class=`${t}`,null===(e=this.registry)||void 0===e||e.onUpdate({id:this.attrs.id,name:"class",value:t,oldValue:void 0})),this}removeClass(t){var e,i;if(!this.hasClass(t))return this;const s=null===(e=this.attrs.class)||void 0===e?void 0:e.split(" ");return s&&(s.splice(s.indexOf(t)),this.attrs.class=s.join(" ")),null===(i=this.registry)||void 0===i||i.onUpdate({id:this.attrs.id,name:"class",value:void 0,oldValue:t}),this}onRegister(t){return this.registry=t,this}isRendered(){return this.rendered}setRendered(t=!0){return this.rendered=t,this}getAttributes(){return this.attrs}getAttribute(t){return this.attrs[t]}getSVGElement(t=""){const e=w(this.attrs.id+t),i=document.getElementById(e);if(i)return i}onIdChange(t,e){var i;const s={validate:t,changed:e},n=null!==(i=this.idListeners)&&void 0!==i?i:this.idListeners=new Set;return n.add(s),()=>n.delete(s)}setAttribute(t,e){var i,s,n;const o=this.attrs.id,a=this.attrs[t];return"id"===t&&(null===(i=this.idListeners)||void 0===i||i.forEach(t=>t.validate(e))),this.attrs[t]=e,null===(s=this.registry)||void 0===s||s.onUpdate({id:o,name:t,value:e,oldValue:a}),"id"===t&&(null===(n=this.idListeners)||void 0===n||n.forEach(t=>t.changed())),this}getTextInk(t,e){const i=this.textMetrics;return new D(t+this.xShift-i.actualBoundingBoxLeft,e+this.yShift-i.actualBoundingBoxAscent,i.actualBoundingBoxLeft+i.actualBoundingBoxRight,i.actualBoundingBoxAscent+i.actualBoundingBoxDescent)}getBoundingBox(){return new D(this.x+this.xShift,this.y+this.yShift-this.textMetrics.actualBoundingBoxAscent,this.width,this.height)}getContext(){return this.context}drawPointerRect(){var t;if(this.shouldDrawPointerRect){const e=this.getBoundingBox();null===(t=this.context)||void 0===t||t.pointerRect(e.getX(),e.getY(),e.getW(),e.getH())}}setContext(t){return this.context=t,this}checkContext(){return f(this.context,"NoContext","No rendering context attached to instance.")}set font(t){this.setFont(t)}get font(){return A.toCSSString(this._fontInfo)}setFont(t,e,i,s){const n=B.getFontInfo(this.attrs.type),o="object"==typeof t,a="string"==typeof t,r=void 0===e&&void 0===i&&void 0===s;return this.metricsValid=!1,this._fontInfo=o?Object.assign(Object.assign({},n),t):a&&r?A.fromCSSString(t):A.validate(null!=t?t:n.family,null!=e?e:n.size,null!=i?i:n.weight,null!=s?s:n.style),this}getFont(){return A.toCSSString(this._fontInfo)}get fontInfo(){return this._fontInfo}set fontInfo(t){this.setFont(t)}setFontSize(t){const e=this.fontInfo;return this.setFont(e.family,t,e.weight,e.style),this}getFontSize(){return this.fontSize}getFontScale(){return this.fontScale}set fontSize(t){this.setFontSize(t)}get fontSize(){let t=this.fontInfo.size;return"number"==typeof t&&(t=`${t}pt`),t}get fontSizeInPoints(){return A.convertSizeToPointValue(this.fontSize)}get fontSizeInPixels(){return A.convertSizeToPixelValue(this.fontSize)}get fontStyle(){return this.fontInfo.style}set fontStyle(t){const e=this.fontInfo;this.setFont(e.family,e.size,e.weight,t)}get fontWeight(){return this.fontInfo.weight+""}set fontWeight(t){const e=this.fontInfo;this.setFont(e.family,e.size,t,e.style)}getWidth(){return this.width}get width(){return this.metricsValid||this.measureText(),this._width}setWidth(t){return this.width=t,this}set width(t){this.metricsValid||this.measureText(),this._width=t}setX(t){return this.x=t,this}getX(){return this.x}getY(){return this.y}setY(t){return this.y=t,this}setYShift(t){return this.yShift=t,this}getYShift(){return this.yShift}setXShift(t){return this.xShift=t,this}getXShift(){return this.xShift}setText(t){return this.text=t,this}set text(t){this.metricsValid=!1,this._text=t}getText(){return this._text}get text(){return this._text}renderText(t,e,i){t.setFont(this._fontInfo),t.fillText(this._text,e+this.x+this.xShift,i+this.y+this.yShift),this.children.forEach(s=>{t.setFont(s.fontInfo),t.fillText(s.text,e+s.x+s.xShift,i+s.y+s.yShift)})}measureText(){var t;const e=null===(t=P.getTextMeasurementCanvas())||void 0===t?void 0:t.getContext("2d");return e?(e.font=A.toCSSString(A.validate(this.fontInfo)),this._textMetrics=Object.assign({},k.measure(e,this.text)),this._height=this._textMetrics.actualBoundingBoxAscent+this._textMetrics.actualBoundingBoxDescent,this._width=this._textMetrics.width,this.metricsValid=!0,this._textMetrics):(console.warn("Element: No context for txtCanvas. Returning empty text metrics."),this._textMetrics)}static measureWidth(t,e=""){var i;const s=null===(i=P.getTextMeasurementCanvas())||void 0===i?void 0:i.getContext("2d");return s?(s.font=A.toCSSString(B.getFontInfo(e)),k.measure(s,t).width):(console.warn("Element: No context for txtCanvas. Returning empty text metrics."),0)}getTextMetrics(){return this.textMetrics}get textMetrics(){return this.metricsValid||this.measureText(),this._textMetrics}getHeight(){return this.height}get height(){return this.metricsValid||this.measureText(),this._height}set height(t){this.metricsValid||this.measureText(),this._height=t}setOriginX(t){const e=this.getBoundingBox(),i=(t-Math.abs((e.getX()-this.x-this.xShift)/e.getW()))*e.getW();this.xShift=-i}setOriginY(t){const e=this.getBoundingBox(),i=(t-Math.abs((e.getY()-this.y-this.yShift)/e.getH()))*e.getH();this.yShift=-i}setOrigin(t,e){this.setOriginX(t),this.setOriginY(e)}}var R,I;P.ID=1e3,function(t){t[t.CENTER=0]="CENTER",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.ABOVE=3]="ABOVE",t[t.BELOW=4]="BELOW"}(R||(R={}));class W extends P{static get CATEGORY(){return"Modifier"}static get Position(){return R}static get PositionString(){return{center:R.CENTER,above:R.ABOVE,below:R.BELOW,left:R.LEFT,right:R.RIGHT}}constructor(){super(),this.width=0,this.textLine=0,this.position=W.Position.LEFT,this.spacingFromNextModifier=0}reset(){}getNote(){return f(this.note,"NoNote","Modifier has no note.")}checkAttachedNote(){const t=this.getCategory();return f(this.index,"NoIndex",`Can't draw ${t} without an index.`),f(this.note,"NoNote",`Can't draw ${t} without a note.`)}setNote(t){return this.note=t,this}getIndex(){return this.index}checkIndex(){return f(this.index,"NoIndex","Modifier has an invalid index.")}setIndex(t){return this.index=t,this}getModifierContext(){return this.modifierContext}checkModifierContext(){return f(this.modifierContext,"NoModifierContext","Modifier Context Required")}setModifierContext(t){return this.modifierContext=t,this}getPosition(){return this.position}setPosition(t){return this.position="string"==typeof t?W.PositionString[t]:t,this.reset(),this}setTextLine(t){return this.textLine=t,this}setYShift(t){return this.yShift=t,this}setSpacingFromNextModifier(t){this.spacingFromNextModifier=t}getSpacingFromNextModifier(){return this.spacingFromNextModifier}setXShift(t){return this.xShift=0,this.position===W.Position.LEFT?this.xShift-=t:this.xShift+=t,this}getXShift(){return this.xShift}draw(){throw this.checkContext(),new p("NotImplemented","draw() not implemented for this modifier.")}alignSubNotesWithNote(t,e,i=W.Position.LEFT){const s=e.getTickContext(),n=s.getMetrics(),o=e.getStave(),a=i===W.Position.RIGHT?s.getX()+this.getSpacingFromNextModifier()*t.length+10:s.getX()-n.modLeftPx-n.modRightPx+this.getSpacingFromNextModifier();t.forEach(t=>{const e=t.getTickContext();o&&t.setStave(o),e.setXOffset(a)})}}class H{static get NUM_TONES(){return this.canonicalNotes.length}static get roots(){return["c","d","e","f","g","a","b"]}static get rootValues(){return[0,2,4,5,7,9,11]}static get rootIndexes(){return{c:0,d:1,e:2,f:3,g:4,a:5,b:6}}static get canonicalNotes(){return["c","c#","d","d#","e","f","f#","g","g#","a","a#","b"]}static get diatonicIntervals(){return["unison","m2","M2","m3","M3","p4","dim5","p5","m6","M6","b7","M7","octave"]}static get diatonicAccidentals(){return{unison:{note:0,accidental:0},m2:{note:1,accidental:-1},M2:{note:1,accidental:0},m3:{note:2,accidental:-1},M3:{note:2,accidental:0},p4:{note:3,accidental:0},dim5:{note:4,accidental:-1},p5:{note:4,accidental:0},m6:{note:5,accidental:-1},M6:{note:5,accidental:0},b7:{note:6,accidental:-1},M7:{note:6,accidental:0},octave:{note:7,accidental:0}}}static get intervals(){return{u:0,unison:0,m2:1,b2:1,min2:1,S:1,H:1,2:2,M2:2,maj2:2,T:2,W:2,m3:3,b3:3,min3:3,M3:4,3:4,maj3:4,4:5,p4:5,"#4":6,b5:6,aug4:6,dim5:6,5:7,p5:7,"#5":8,b6:8,aug5:8,6:9,M6:9,maj6:9,b7:10,m7:10,min7:10,dom7:10,M7:11,maj7:11,8:12,octave:12}}static get scales(){return{major:[2,2,1,2,2,2,1],minor:[2,1,2,2,1,2,2],ionian:[2,2,1,2,2,2,1],dorian:[2,1,2,2,2,1,2],phyrgian:[1,2,2,2,1,2,2],lydian:[2,2,2,1,2,2,1],mixolydian:[2,2,1,2,2,1,2],aeolian:[2,1,2,2,1,2,2],locrian:[1,2,2,1,2,2,2]}}static get scaleTypes(){return{M:H.scales.major,m:H.scales.minor}}static get accidentals(){return["bb","b","n","#","##"]}static get noteValues(){return{c:{rootIndex:0,intVal:0},cn:{rootIndex:0,intVal:0},"c#":{rootIndex:0,intVal:1},"c##":{rootIndex:0,intVal:2},cb:{rootIndex:0,intVal:11},cbb:{rootIndex:0,intVal:10},d:{rootIndex:1,intVal:2},dn:{rootIndex:1,intVal:2},"d#":{rootIndex:1,intVal:3},"d##":{rootIndex:1,intVal:4},db:{rootIndex:1,intVal:1},dbb:{rootIndex:1,intVal:0},e:{rootIndex:2,intVal:4},en:{rootIndex:2,intVal:4},"e#":{rootIndex:2,intVal:5},"e##":{rootIndex:2,intVal:6},eb:{rootIndex:2,intVal:3},ebb:{rootIndex:2,intVal:2},f:{rootIndex:3,intVal:5},fn:{rootIndex:3,intVal:5},"f#":{rootIndex:3,intVal:6},"f##":{rootIndex:3,intVal:7},fb:{rootIndex:3,intVal:4},fbb:{rootIndex:3,intVal:3},g:{rootIndex:4,intVal:7},gn:{rootIndex:4,intVal:7},"g#":{rootIndex:4,intVal:8},"g##":{rootIndex:4,intVal:9},gb:{rootIndex:4,intVal:6},gbb:{rootIndex:4,intVal:5},a:{rootIndex:5,intVal:9},an:{rootIndex:5,intVal:9},"a#":{rootIndex:5,intVal:10},"a##":{rootIndex:5,intVal:11},ab:{rootIndex:5,intVal:8},abb:{rootIndex:5,intVal:7},b:{rootIndex:6,intVal:11},bn:{rootIndex:6,intVal:11},"b#":{rootIndex:6,intVal:0},"b##":{rootIndex:6,intVal:1},bb:{rootIndex:6,intVal:10},bbb:{rootIndex:6,intVal:9}}}isValidNoteValue(t){return t>=0&&t<H.canonicalNotes.length}isValidIntervalValue(t){return t>=0&&t<H.diatonicIntervals.length}getNoteParts(t){if(!t||t.length<1)throw new p("BadArguments","Invalid note name: "+t);if(t.length>3)throw new p("BadArguments","Invalid note name: "+t);const e=t.toLowerCase(),i=/^([cdefgab])(b|bb|n|#|##)?$/.exec(e);if(null!==i){return{root:i[1],accidental:i[2]}}throw new p("BadArguments","Invalid note name: "+t)}getKeyParts(t){if(!t||t.length<1)throw new p("BadArguments","Invalid key: "+t);const e=t.toLowerCase(),i=/^([cdefgab])(b|#)?(mel|harm|m|M)?$/.exec(e);if(null!==i){const t=i[1],e=i[2];let s=i[3];return s||(s="M"),{root:t,accidental:e,type:s}}throw new p("BadArguments",`Invalid key: ${t}`)}getNoteValue(t){const e=H.noteValues[t];if(void 0===e)throw new p("BadArguments",`Invalid note name: ${t}`);return e.intVal}getIntervalValue(t){const e=H.intervals[t];if(void 0===e)throw new p("BadArguments",`Invalid interval name: ${t}`);return e}getCanonicalNoteName(t){if(!this.isValidNoteValue(t))throw new p("BadArguments",`Invalid note value: ${t}`);return H.canonicalNotes[t]}getCanonicalIntervalName(t){if(!this.isValidIntervalValue(t))throw new p("BadArguments",`Invalid interval value: ${t}`);return H.diatonicIntervals[t]}getRelativeNoteValue(t,e,i=1){if(1!==i&&-1!==i)throw new p("BadArguments",`Invalid direction: ${i}`);let s=(t+i*e)%H.NUM_TONES;return s<0&&(s+=H.NUM_TONES),s}getRelativeNoteName(t,e){const i=this.getNoteParts(t),s=this.getNoteValue(i.root);let n=e-s;if(Math.abs(n)>H.NUM_TONES-3){let i=1;n>0&&(i=-1);const o=(e+1+(s+1))%H.NUM_TONES*i;if(Math.abs(o)>2)throw new p("BadArguments",`Notes not related: ${t}, ${e})`);n=o}if(Math.abs(n)>2)throw new p("BadArguments",`Notes not related: ${t}, ${e})`);let o=i.root;if(n>0)for(let t=1;t<=n;++t)o+="#";else if(n<0)for(let t=-1;t>=n;--t)o+="b";return o}getScaleTones(t,e){const i=[t];let s=t;for(let n=0;n<e.length;n++)s=this.getRelativeNoteValue(s,e[n]),s!==t&&i.push(s);return i}getIntervalBetween(t,e,i=1){if(1!==i&&-1!==i)throw new p("BadArguments",`Invalid direction: ${i}`);if(!this.isValidNoteValue(t)||!this.isValidNoteValue(e))throw new p("BadArguments",`Invalid notes: ${t}, ${e}`);let s=1===i?e-t:t-e;return s<0&&(s+=H.NUM_TONES),s}createScaleMap(t){const e=this.getKeyParts(t);if(!e.type)throw new p("BadArguments","Unsupported key type: undefined");const i=H.scaleTypes[e.type];let s=e.root;if(e.accidental&&(s+=e.accidental),!i)throw new p("BadArguments","Unsupported key type: "+t);const n=this.getScaleTones(this.getNoteValue(s),i),o=H.rootIndexes[e.root],a={};for(let t=0;t<H.roots.length;++t){const e=(o+t)%H.roots.length,i=H.roots[e];let s=this.getRelativeNoteName(i,n[t]);1===s.length&&(s+="n"),a[i]=s}return a}}!function(t){t.null="\0",t.fourStringTabClef="",t.sixStringTabClef="",t.accSagittal11LargeDiesisDown="",t.accSagittal11LargeDiesisUp="",t.accSagittal11MediumDiesisDown="",t.accSagittal11MediumDiesisUp="",t.accSagittal11v19LargeDiesisDown="",t.accSagittal11v19LargeDiesisUp="",t.accSagittal11v19MediumDiesisDown="",t.accSagittal11v19MediumDiesisUp="",t.accSagittal11v49CommaDown="",t.accSagittal11v49CommaUp="",t.accSagittal143CommaDown="",t.accSagittal143CommaUp="",t.accSagittal17CommaDown="",t.accSagittal17CommaUp="",t.accSagittal17KleismaDown="",t.accSagittal17KleismaUp="",t.accSagittal19CommaDown="",t.accSagittal19CommaUp="",t.accSagittal19SchismaDown="",t.accSagittal19SchismaUp="",t.accSagittal1MinaDown="",t.accSagittal1MinaUp="",t.accSagittal1TinaDown="",t.accSagittal1TinaUp="",t.accSagittal23CommaDown="",t.accSagittal23CommaUp="",t.accSagittal23SmallDiesisDown="",t.accSagittal23SmallDiesisUp="",t.accSagittal25SmallDiesisDown="",t.accSagittal25SmallDiesisUp="",t.accSagittal2MinasDown="",t.accSagittal2MinasUp="",t.accSagittal2TinasDown="",t.accSagittal2TinasUp="",t.accSagittal35LargeDiesisDown="",t.accSagittal35LargeDiesisUp="",t.accSagittal35MediumDiesisDown="",t.accSagittal35MediumDiesisUp="",t.accSagittal3TinasDown="",t.accSagittal3TinasUp="",t.accSagittal49LargeDiesisDown="",t.accSagittal49LargeDiesisUp="",t.accSagittal49MediumDiesisDown="",t.accSagittal49MediumDiesisUp="",t.accSagittal49SmallDiesisDown="",t.accSagittal49SmallDiesisUp="",t.accSagittal4TinasDown="",t.accSagittal4TinasUp="",t.accSagittal55CommaDown="",t.accSagittal55CommaUp="",t.accSagittal5CommaDown="",t.accSagittal5CommaUp="",t.accSagittal5TinasDown="",t.accSagittal5TinasUp="",t.accSagittal5v11SmallDiesisDown="",t.accSagittal5v11SmallDiesisUp="",t.accSagittal5v13LargeDiesisDown="",t.accSagittal5v13LargeDiesisUp="",t.accSagittal5v13MediumDiesisDown="",t.accSagittal5v13MediumDiesisUp="",t.accSagittal5v19CommaDown="",t.accSagittal5v19CommaUp="",t.accSagittal5v23SmallDiesisDown="",t.accSagittal5v23SmallDiesisUp="",t.accSagittal5v49MediumDiesisDown="",t.accSagittal5v49MediumDiesisUp="",t.accSagittal5v7KleismaDown="",t.accSagittal5v7KleismaUp="",t.accSagittal6TinasDown="",t.accSagittal6TinasUp="",t.accSagittal7CommaDown="",t.accSagittal7CommaUp="",t.accSagittal7TinasDown="",t.accSagittal7TinasUp="",t.accSagittal7v11CommaDown="",t.accSagittal7v11CommaUp="",t.accSagittal7v11KleismaDown="",t.accSagittal7v11KleismaUp="",t.accSagittal7v19CommaDown="",t.accSagittal7v19CommaUp="",t.accSagittal8TinasDown="",t.accSagittal8TinasUp="",t.accSagittal9TinasDown="",t.accSagittal9TinasUp="",t.accSagittalAcute="",t.accSagittalDoubleFlat="",t.accSagittalDoubleFlat11v49CUp="",t.accSagittalDoubleFlat143CUp="",t.accSagittalDoubleFlat17CUp="",t.accSagittalDoubleFlat17kUp="",t.accSagittalDoubleFlat19CUp="",t.accSagittalDoubleFlat19sUp="",t.accSagittalDoubleFlat23CUp="",t.accSagittalDoubleFlat23SUp="",t.accSagittalDoubleFlat25SUp="",t.accSagittalDoubleFlat49SUp="",t.accSagittalDoubleFlat55CUp="",t.accSagittalDoubleFlat5CUp="",t.accSagittalDoubleFlat5v11SUp="",t.accSagittalDoubleFlat5v19CUp="",t.accSagittalDoubleFlat5v23SUp="",t.accSagittalDoubleFlat5v7kUp="",t.accSagittalDoubleFlat7CUp="",t.accSagittalDoubleFlat7v11CUp="",t.accSagittalDoubleFlat7v11kUp="",t.accSagittalDoubleFlat7v19CUp="",t.accSagittalDoubleSharp="",t.accSagittalDoubleSharp11v49CDown="",t.accSagittalDoubleSharp143CDown="",t.accSagittalDoubleSharp17CDown="",t.accSagittalDoubleSharp17kDown="",t.accSagittalDoubleSharp19CDown="",t.accSagittalDoubleSharp19sDown="",t.accSagittalDoubleSharp23CDown="",t.accSagittalDoubleSharp23SDown="",t.accSagittalDoubleSharp25SDown="",t.accSagittalDoubleSharp49SDown="",t.accSagittalDoubleSharp55CDown="",t.accSagittalDoubleSharp5CDown="",t.accSagittalDoubleSharp5v11SDown="",t.accSagittalDoubleSharp5v19CDown="",t.accSagittalDoubleSharp5v23SDown="",t.accSagittalDoubleSharp5v7kDown="",t.accSagittalDoubleSharp7CDown="",t.accSagittalDoubleSharp7v11CDown="",t.accSagittalDoubleSharp7v11kDown="",t.accSagittalDoubleSharp7v19CDown="",t.accSagittalFlat="",t.accSagittalFlat11LDown="",t.accSagittalFlat11MDown="",t.accSagittalFlat11v19LDown="",t.accSagittalFlat11v19MDown="",t.accSagittalFlat11v49CDown="",t.accSagittalFlat11v49CUp="",t.accSagittalFlat143CDown="",t.accSagittalFlat143CUp="",t.accSagittalFlat17CDown="",t.accSagittalFlat17CUp="",t.accSagittalFlat17kDown="",t.accSagittalFlat17kUp="",t.accSagittalFlat19CDown="",t.accSagittalFlat19CUp="",t.accSagittalFlat19sDown="",t.accSagittalFlat19sUp="",t.accSagittalFlat23CDown="",t.accSagittalFlat23CUp="",t.accSagittalFlat23SDown="",t.accSagittalFlat23SUp="",t.accSagittalFlat25SDown="",t.accSagittalFlat25SUp="",t.accSagittalFlat35LDown="",t.accSagittalFlat35MDown="",t.accSagittalFlat49LDown="",t.accSagittalFlat49MDown="",t.accSagittalFlat49SDown="",t.accSagittalFlat49SUp="",t.accSagittalFlat55CDown="",t.accSagittalFlat55CUp="",t.accSagittalFlat5CDown="",t.accSagittalFlat5CUp="",t.accSagittalFlat5v11SDown="",t.accSagittalFlat5v11SUp="",t.accSagittalFlat5v13LDown="",t.accSagittalFlat5v13MDown="",t.accSagittalFlat5v19CDown="",t.accSagittalFlat5v19CUp="",t.accSagittalFlat5v23SDown="",t.accSagittalFlat5v23SUp="",t.accSagittalFlat5v49MDown="",t.accSagittalFlat5v7kDown="",t.accSagittalFlat5v7kUp="",t.accSagittalFlat7CDown="",t.accSagittalFlat7CUp="",t.accSagittalFlat7v11CDown="",t.accSagittalFlat7v11CUp="",t.accSagittalFlat7v11kDown="",t.accSagittalFlat7v11kUp="",t.accSagittalFlat7v19CDown="",t.accSagittalFlat7v19CUp="",t.accSagittalFractionalTinaDown="",t.accSagittalFractionalTinaUp="",t.accSagittalGrave="",t.accSagittalShaftDown="",t.accSagittalShaftUp="",t.accSagittalSharp="",t.accSagittalSharp11LUp="",t.accSagittalSharp11MUp="",t.accSagittalSharp11v19LUp="",t.accSagittalSharp11v19MUp="",t.accSagittalSharp11v49CDown="",t.accSagittalSharp11v49CUp="",t.accSagittalSharp143CDown="",t.accSagittalSharp143CUp="",t.accSagittalSharp17CDown="",t.accSagittalSharp17CUp="",t.accSagittalSharp17kDown="",t.accSagittalSharp17kUp="",t.accSagittalSharp19CDown="",t.accSagittalSharp19CUp="",t.accSagittalSharp19sDown="",t.accSagittalSharp19sUp="",t.accSagittalSharp23CDown="",t.accSagittalSharp23CUp="",t.accSagittalSharp23SDown="",t.accSagittalSharp23SUp="",t.accSagittalSharp25SDown="",t.accSagittalSharp25SUp="",t.accSagittalSharp35LUp="",t.accSagittalSharp35MUp="",t.accSagittalSharp49LUp="",t.accSagittalSharp49MUp="",t.accSagittalSharp49SDown="",t.accSagittalSharp49SUp="",t.accSagittalSharp55CDown="",t.accSagittalSharp55CUp="",t.accSagittalSharp5CDown="",t.accSagittalSharp5CUp="",t.accSagittalSharp5v11SDown="",t.accSagittalSharp5v11SUp="",t.accSagittalSharp5v13LUp="",t.accSagittalSharp5v13MUp="",t.accSagittalSharp5v19CDown="",t.accSagittalSharp5v19CUp="",t.accSagittalSharp5v23SDown="",t.accSagittalSharp5v23SUp="",t.accSagittalSharp5v49MUp="",t.accSagittalSharp5v7kDown="",t.accSagittalSharp5v7kUp="",t.accSagittalSharp7CDown="",t.accSagittalSharp7CUp="",t.accSagittalSharp7v11CDown="",t.accSagittalSharp7v11CUp="",t.accSagittalSharp7v11kDown="",t.accSagittalSharp7v11kUp="",t.accSagittalSharp7v19CDown="",t.accSagittalSharp7v19CUp="",t.accSagittalUnused1="",t.accSagittalUnused2="",t.accSagittalUnused3="",t.accSagittalUnused4="",t.accdnCombDot="",t.accdnCombLH2RanksEmpty="",t.accdnCombLH3RanksEmptySquare="",t.accdnCombRH3RanksEmpty="",t.accdnCombRH4RanksEmpty="",t.accdnDiatonicClef="",t.accdnLH2Ranks16Round="",t.accdnLH2Ranks8Plus16Round="",t.accdnLH2Ranks8Round="",t.accdnLH2RanksFullMasterRound="",t.accdnLH2RanksMasterPlus16Round="",t.accdnLH2RanksMasterRound="",t.accdnLH3Ranks2Plus8Square="",t.accdnLH3Ranks2Square="",t.accdnLH3Ranks8Square="",t.accdnLH3RanksDouble8Square="",t.accdnLH3RanksTuttiSquare="",t.accdnPull="",t.accdnPush="",t.accdnRH3RanksAccordion="",t.accdnRH3RanksAuthenticMusette="",t.accdnRH3RanksBandoneon="",t.accdnRH3RanksBassoon="",t.accdnRH3RanksClarinet="",t.accdnRH3RanksDoubleTremoloLower8ve="",t.accdnRH3RanksDoubleTremoloUpper8ve="",t.accdnRH3RanksFullFactory="",t.accdnRH3RanksHarmonium="",t.accdnRH3RanksImitationMusette="",t.accdnRH3RanksLowerTremolo8="",t.accdnRH3RanksMaster="",t.accdnRH3RanksOboe="",t.accdnRH3RanksOrgan="",t.accdnRH3RanksPiccolo="",t.accdnRH3RanksTremoloLower8ve="",t.accdnRH3RanksTremoloUpper8ve="",t.accdnRH3RanksTwoChoirs="",t.accdnRH3RanksUpperTremolo8="",t.accdnRH3RanksViolin="",t.accdnRH4RanksAlto="",t.accdnRH4RanksBassAlto="",t.accdnRH4RanksMaster="",t.accdnRH4RanksSoftBass="",t.accdnRH4RanksSoftTenor="",t.accdnRH4RanksSoprano="",t.accdnRH4RanksTenor="",t.accdnRicochet2="",t.accdnRicochet3="",t.accdnRicochet4="",t.accdnRicochet5="",t.accdnRicochet6="",t.accdnRicochetStem2="",t.accdnRicochetStem3="",t.accdnRicochetStem4="",t.accdnRicochetStem5="",t.accdnRicochetStem6="",t.accidental1CommaFlat="",t.accidental1CommaSharp="",t.accidental2CommaFlat="",t.accidental2CommaSharp="",t.accidental3CommaFlat="",t.accidental3CommaSharp="",t.accidental4CommaFlat="",t.accidental5CommaSharp="",t.accidentalArrowDown="",t.accidentalArrowUp="",t.accidentalBakiyeFlat="",t.accidentalBakiyeSharp="",t.accidentalBracketLeft="",t.accidentalBracketRight="",t.accidentalBuyukMucennebFlat="",t.accidentalBuyukMucennebSharp="",t.accidentalCombiningCloseCurlyBrace="",t.accidentalCombiningLower17Schisma="",t.accidentalCombiningLower19Schisma="",t.accidentalCombiningLower23Limit29LimitComma="",t.accidentalCombiningLower29LimitComma="",t.accidentalCombiningLower31Schisma="",t.accidentalCombiningLower37Quartertone="",t.accidentalCombiningLower41Comma="",t.accidentalCombiningLower43Comma="",t.accidentalCombiningLower47Quartertone="",t.accidentalCombiningLower53LimitComma="",t.accidentalCombiningOpenCurlyBrace="",t.accidentalCombiningRaise17Schisma="",t.accidentalCombiningRaise19Schisma="",t.accidentalCombiningRaise23Limit29LimitComma="",t.accidentalCombiningRaise29LimitComma="",t.accidentalCombiningRaise31Schisma="",t.accidentalCombiningRaise37Quartertone="",t.accidentalCombiningRaise41Comma="",t.accidentalCombiningRaise43Comma="",t.accidentalCombiningRaise47Quartertone="",t.accidentalCombiningRaise53LimitComma="",t.accidentalCommaSlashDown="",t.accidentalCommaSlashUp="",t.accidentalDoubleFlat="",t.accidentalDoubleFlatArabic="",t.accidentalDoubleFlatEqualTempered="",t.accidentalDoubleFlatOneArrowDown="",t.accidentalDoubleFlatOneArrowUp="",t.accidentalDoubleFlatReversed="",t.accidentalDoubleFlatThreeArrowsDown="",t.accidentalDoubleFlatThreeArrowsUp="",t.accidentalDoubleFlatTurned="",t.accidentalDoubleFlatTwoArrowsDown="",t.accidentalDoubleFlatTwoArrowsUp="",t.accidentalDoubleSharp="",t.accidentalDoubleSharpArabic="",t.accidentalDoubleSharpEqualTempered="",t.accidentalDoubleSharpOneArrowDown="",t.accidentalDoubleSharpOneArrowUp="",t.accidentalDoubleSharpThreeArrowsDown="",t.accidentalDoubleSharpThreeArrowsUp="",t.accidentalDoubleSharpTwoArrowsDown="",t.accidentalDoubleSharpTwoArrowsUp="",t.accidentalEnharmonicAlmostEqualTo="",t.accidentalEnharmonicEquals="",t.accidentalEnharmonicTilde="",t.accidentalFilledReversedFlatAndFlat="",t.accidentalFilledReversedFlatAndFlatArrowDown="",t.accidentalFilledReversedFlatAndFlatArrowUp="",t.accidentalFilledReversedFlatArrowDown="",t.accidentalFilledReversedFlatArrowUp="",t.accidentalFiveQuarterTonesFlatArrowDown="",t.accidentalFiveQuarterTonesSharpArrowUp="",t.accidentalFlat="",t.accidentalFlatArabic="",t.accidentalFlatEqualTempered="",t.accidentalFlatLoweredStockhausen="",t.accidentalFlatOneArrowDown="",t.accidentalFlatOneArrowUp="",t.accidentalFlatRaisedStockhausen="",t.accidentalFlatRepeatedLineStockhausen="",t.accidentalFlatRepeatedSpaceStockhausen="",t.accidentalFlatThreeArrowsDown="",t.accidentalFlatThreeArrowsUp="",t.accidentalFlatTurned="",t.accidentalFlatTwoArrowsDown="",t.accidentalFlatTwoArrowsUp="",t.accidentalHabaFlatQuarterToneHigher="",t.accidentalHabaFlatThreeQuarterTonesLower="",t.accidentalHabaQuarterToneHigher="",t.accidentalHabaQuarterToneLower="",t.accidentalHabaSharpQuarterToneLower="",t.accidentalHabaSharpThreeQuarterTonesHigher="",t.accidentalHalfSharpArrowDown="",t.accidentalHalfSharpArrowUp="",t.accidentalJohnston13="",t.accidentalJohnston31="",t.accidentalJohnstonDown="",t.accidentalJohnstonEl="",t.accidentalJohnstonMinus="",t.accidentalJohnstonPlus="",t.accidentalJohnstonSeven="",t.accidentalJohnstonUp="",t.accidentalKomaFlat="",t.accidentalKomaSharp="",t.accidentalKoron="",t.accidentalKucukMucennebFlat="",t.accidentalKucukMucennebSharp="",t.accidentalLargeDoubleSharp="",t.accidentalLowerOneSeptimalComma="",t.accidentalLowerOneTridecimalQuartertone="",t.accidentalLowerOneUndecimalQuartertone="",t.accidentalLowerTwoSeptimalCommas="",t.accidentalLoweredStockhausen="",t.accidentalNarrowReversedFlat="",t.accidentalNarrowReversedFlatAndFlat="",t.accidentalNatural="",t.accidentalNaturalArabic="",t.accidentalNaturalEqualTempered="",t.accidentalNaturalFlat="",t.accidentalNaturalLoweredStockhausen="",t.accidentalNaturalOneArrowDown="",t.accidentalNaturalOneArrowUp="",t.accidentalNaturalRaisedStockhausen="",t.accidentalNaturalReversed="",t.accidentalNaturalSharp="",t.accidentalNaturalThreeArrowsDown="",t.accidentalNaturalThreeArrowsUp="",t.accidentalNaturalTwoArrowsDown="",t.accidentalNaturalTwoArrowsUp="",t.accidentalOneAndAHalfSharpsArrowDown="",t.accidentalOneAndAHalfSharpsArrowUp="",t.accidentalOneQuarterToneFlatFerneyhough="",t.accidentalOneQuarterToneFlatStockhausen="",t.accidentalOneQuarterToneSharpFerneyhough="",t.accidentalOneQuarterToneSharpStockhausen="",t.accidentalOneThirdToneFlatFerneyhough="",t.accidentalOneThirdToneSharpFerneyhough="",t.accidentalParensLeft="",t.accidentalParensRight="",t.accidentalQuarterFlatEqualTempered="",t.accidentalQuarterSharpEqualTempered="",t.accidentalQuarterToneFlat4="",t.accidentalQuarterToneFlatArabic="",t.accidentalQuarterToneFlatArrowUp="",t.accidentalQuarterToneFlatFilledReversed="",t.accidentalQuarterToneFlatNaturalArrowDown="",t.accidentalQuarterToneFlatPenderecki="",t.accidentalQuarterToneFlatStein="",t.accidentalQuarterToneFlatVanBlankenburg="",t.accidentalQuarterToneSharp4="",t.accidentalQuarterToneSharpArabic="",t.accidentalQuarterToneSharpArrowDown="",t.accidentalQuarterToneSharpBusotti="",t.accidentalQuarterToneSharpNaturalArrowUp="",t.accidentalQuarterToneSharpStein="",t.accidentalQuarterToneSharpWiggle="",t.accidentalRaiseOneSeptimalComma="",t.accidentalRaiseOneTridecimalQuartertone="",t.accidentalRaiseOneUndecimalQuartertone="",t.accidentalRaiseTwoSeptimalCommas="",t.accidentalRaisedStockhausen="",t.accidentalReversedFlatAndFlatArrowDown="",t.accidentalReversedFlatAndFlatArrowUp="",t.accidentalReversedFlatArrowDown="",t.accidentalReversedFlatArrowUp="",t.accidentalSharp="",t.accidentalSharpArabic="",t.accidentalSharpEqualTempered="",t.accidentalSharpLoweredStockhausen="",t.accidentalSharpOneArrowDown="",t.accidentalSharpOneArrowUp="",t.accidentalSharpOneHorizontalStroke="",t.accidentalSharpRaisedStockhausen="",t.accidentalSharpRepeatedLineStockhausen="",t.accidentalSharpRepeatedSpaceStockhausen="",t.accidentalSharpReversed="",t.accidentalSharpSharp="",t.accidentalSharpThreeArrowsDown="",t.accidentalSharpThreeArrowsUp="",t.accidentalSharpTwoArrowsDown="",t.accidentalSharpTwoArrowsUp="",t.accidentalSims12Down="",t.accidentalSims12Up="",t.accidentalSims4Down="",t.accidentalSims4Up="",t.accidentalSims6Down="",t.accidentalSims6Up="",t.accidentalSori="",t.accidentalTavenerFlat="",t.accidentalTavenerSharp="",t.accidentalThreeQuarterTonesFlatArabic="",t.accidentalThreeQuarterTonesFlatArrowDown="",t.accidentalThreeQuarterTonesFlatArrowUp="",t.accidentalThreeQuarterTonesFlatCouper="",t.accidentalThreeQuarterTonesFlatGrisey="",t.accidentalThreeQuarterTonesFlatTartini="",t.accidentalThreeQuarterTonesFlatZimmermann="",t.accidentalThreeQuarterTonesSharpArabic="",t.accidentalThreeQuarterTonesSharpArrowDown="",t.accidentalThreeQuarterTonesSharpArrowUp="",t.accidentalThreeQuarterTonesSharpBusotti="",t.accidentalThreeQuarterTonesSharpStein="",t.accidentalThreeQuarterTonesSharpStockhausen="",t.accidentalTripleFlat="",t.accidentalTripleSharp="",t.accidentalTwoThirdTonesFlatFerneyhough="",t.accidentalTwoThirdTonesSharpFerneyhough="",t.accidentalUpsAndDownsDown="",t.accidentalUpsAndDownsLess="",t.accidentalUpsAndDownsMore="",t.accidentalUpsAndDownsUp="",t.accidentalWilsonMinus="",t.accidentalWilsonPlus="",t.accidentalWyschnegradsky10TwelfthsFlat="",t.accidentalWyschnegradsky10TwelfthsSharp="",t.accidentalWyschnegradsky11TwelfthsFlat="",t.accidentalWyschnegradsky11TwelfthsSharp="",t.accidentalWyschnegradsky1TwelfthsFlat="",t.accidentalWyschnegradsky1TwelfthsSharp="",t.accidentalWyschnegradsky2TwelfthsFlat="",t.accidentalWyschnegradsky2TwelfthsSharp="",t.accidentalWyschnegradsky3TwelfthsFlat="",t.accidentalWyschnegradsky3TwelfthsSharp="",t.accidentalWyschnegradsky4TwelfthsFlat="",t.accidentalWyschnegradsky4TwelfthsSharp="",t.accidentalWyschnegradsky5TwelfthsFlat="",t.accidentalWyschnegradsky5TwelfthsSharp="",t.accidentalWyschnegradsky6TwelfthsFlat="",t.accidentalWyschnegradsky6TwelfthsSharp="",t.accidentalWyschnegradsky7TwelfthsFlat="",t.accidentalWyschnegradsky7TwelfthsSharp="",t.accidentalWyschnegradsky8TwelfthsFlat="",t.accidentalWyschnegradsky8TwelfthsSharp="",t.accidentalWyschnegradsky9TwelfthsFlat="",t.accidentalWyschnegradsky9TwelfthsSharp="",t.accidentalXenakisOneThirdToneSharp="",t.accidentalXenakisTwoThirdTonesSharp="",t.analyticsChoralmelodie="",t.analyticsEndStimme="",t.analyticsHauptrhythmus="",t.analyticsHauptstimme="",t.analyticsInversion1="",t.analyticsNebenstimme="",t.analyticsStartStimme="",t.analyticsTheme="",t.analyticsTheme1="",t.analyticsThemeInversion="",t.analyticsThemeRetrograde="",t.analyticsThemeRetrogradeInversion="",t.arpeggiato="",t.arpeggiatoDown="",t.arpeggiatoUp="",t.arrowBlackDown="",t.arrowBlackDownLeft="",t.arrowBlackDownRight="",t.arrowBlackLeft="",t.arrowBlackRight="",t.arrowBlackUp="",t.arrowBlackUpLeft="",t.arrowBlackUpRight="",t.arrowOpenDown="",t.arrowOpenDownLeft="",t.arrowOpenDownRight="",t.arrowOpenLeft="",t.arrowOpenRight="",t.arrowOpenUp="",t.arrowOpenUpLeft="",t.arrowOpenUpRight="",t.arrowWhiteDown="",t.arrowWhiteDownLeft="",t.arrowWhiteDownRight="",t.arrowWhiteLeft="",t.arrowWhiteRight="",t.arrowWhiteUp="",t.arrowWhiteUpLeft="",t.arrowWhiteUpRight="",t.arrowheadBlackDown="",t.arrowheadBlackDownLeft="",t.arrowheadBlackDownRight="",t.arrowheadBlackLeft="",t.arrowheadBlackRight="",t.arrowheadBlackUp="",t.arrowheadBlackUpLeft="",t.arrowheadBlackUpRight="",t.arrowheadOpenDown="",t.arrowheadOpenDownLeft="",t.arrowheadOpenDownRight="",t.arrowheadOpenLeft="",t.arrowheadOpenRight="",t.arrowheadOpenUp="",t.arrowheadOpenUpLeft="",t.arrowheadOpenUpRight="",t.arrowheadWhiteDown="",t.arrowheadWhiteDownLeft="",t.arrowheadWhiteDownRight="",t.arrowheadWhiteLeft="",t.arrowheadWhiteRight="",t.arrowheadWhiteUp="",t.arrowheadWhiteUpLeft="",t.arrowheadWhiteUpRight="",t.articAccentAbove="",t.articAccentBelow="",t.articAccentStaccatoAbove="",t.articAccentStaccatoBelow="",t.articLaissezVibrerAbove="",t.articLaissezVibrerBelow="",t.articMarcatoAbove="",t.articMarcatoBelow="",t.articMarcatoStaccatoAbove="",t.articMarcatoStaccatoBelow="",t.articMarcatoTenutoAbove="",t.articMarcatoTenutoBelow="",t.articSoftAccentAbove="",t.articSoftAccentBelow="",t.articSoftAccentStaccatoAbove="",t.articSoftAccentStaccatoBelow="",t.articSoftAccentTenutoAbove="",t.articSoftAccentTenutoBelow="",t.articSoftAccentTenutoStaccatoAbove="",t.articSoftAccentTenutoStaccatoBelow="",t.articStaccatissimoAbove="",t.articStaccatissimoBelow="",t.articStaccatissimoStrokeAbove="",t.articStaccatissimoStrokeBelow="",t.articStaccatissimoWedgeAbove="",t.articStaccatissimoWedgeBelow="",t.articStaccatoAbove="",t.articStaccatoBelow="",t.articStressAbove="",t.articStressBelow="",t.articTenutoAbove="",t.articTenutoAccentAbove="",t.articTenutoAccentBelow="",t.articTenutoBelow="",t.articTenutoStaccatoAbove="",t.articTenutoStaccatoBelow="",t.articUnstressAbove="",t.articUnstressBelow="",t.augmentationDot="",t.barlineDashed="",t.barlineDotted="",t.barlineDouble="",t.barlineFinal="",t.barlineHeavy="",t.barlineHeavyHeavy="",t.barlineReverseFinal="",t.barlineShort="",t.barlineSingle="",t.barlineTick="",t.beamAccelRit1="",t.beamAccelRit10="",t.beamAccelRit11="",t.beamAccelRit12="",t.beamAccelRit13="",t.beamAccelRit14="",t.beamAccelRit15="",t.beamAccelRit2="",t.beamAccelRit3="",t.beamAccelRit4="",t.beamAccelRit5="",t.beamAccelRit6="",t.beamAccelRit7="",t.beamAccelRit8="",t.beamAccelRit9="",t.beamAccelRitFinal="",t.brace="",t.bracket="",t.bracketBottom="",t.bracketTop="",t.brassBend="",t.brassDoitLong="",t.brassDoitMedium="",t.brassDoitShort="",t.brassFallLipLong="",t.brassFallLipMedium="",t.brassFallLipShort="",t.brassFallRoughLong="",t.brassFallRoughMedium="",t.brassFallRoughShort="",t.brassFallSmoothLong="",t.brassFallSmoothMedium="",t.brassFallSmoothShort="",t.brassFlip="",t.brassHarmonMuteClosed="",t.brassHarmonMuteStemHalfLeft="",t.brassHarmonMuteStemHalfRight="",t.brassHarmonMuteStemOpen="",t.brassJazzTurn="",t.brassLiftLong="",t.brassLiftMedium="",t.brassLiftShort="",t.brassLiftSmoothLong="",t.brassLiftSmoothMedium="",t.brassLiftSmoothShort="",t.brassMuteClosed="",t.brassMuteHalfClosed="",t.brassMuteOpen="",t.brassPlop="",t.brassScoop="",t.brassSmear="",t.brassValveTrill="",t.breathMarkComma="",t.breathMarkSalzedo="",t.breathMarkTick="",t.breathMarkUpbow="",t.bridgeClef="",t.buzzRoll="",t.cClef="",t.cClef8vb="",t.cClefArrowDown="",t.cClefArrowUp="",t.cClefChange="",t.cClefCombining="",t.cClefReversed="",t.cClefSquare="",t.caesura="",t.caesuraCurved="",t.caesuraShort="",t.caesuraSingleStroke="",t.caesuraThick="",t.chantAccentusAbove="",t.chantAccentusBelow="",t.chantAuctumAsc="",t.chantAuctumDesc="",t.chantAugmentum="",t.chantCaesura="",t.chantCclef="",t.chantCirculusAbove="",t.chantCirculusBelow="",t.chantConnectingLineAsc2nd="",t.chantConnectingLineAsc3rd="",t.chantConnectingLineAsc4th="",t.chantConnectingLineAsc5th="",t.chantConnectingLineAsc6th="",t.chantCustosStemDownPosHigh="",t.chantCustosStemDownPosHighest="",t.chantCustosStemDownPosMiddle="",t.chantCustosStemUpPosLow="",t.chantCustosStemUpPosLowest="",t.chantCustosStemUpPosMiddle="",t.chantDeminutumLower="",t.chantDeminutumUpper="",t.chantDivisioFinalis="",t.chantDivisioMaior="",t.chantDivisioMaxima="",t.chantDivisioMinima="",t.chantEntryLineAsc2nd="",t.chantEntryLineAsc3rd="",t.chantEntryLineAsc4th="",t.chantEntryLineAsc5th="",t.chantEntryLineAsc6th="",t.chantEpisema="",t.chantFclef="",t.chantIctusAbove="",t.chantIctusBelow="",t.chantLigaturaDesc2nd="",t.chantLigaturaDesc3rd="",t.chantLigaturaDesc4th="",t.chantLigaturaDesc5th="",t.chantOriscusAscending="",t.chantOriscusDescending="",t.chantOriscusLiquescens="",t.chantPodatusLower="",t.chantPodatusUpper="",t.chantPunctum="",t.chantPunctumCavum="",t.chantPunctumDeminutum="",t.chantPunctumInclinatum="",t.chantPunctumInclinatumAuctum="",t.chantPunctumInclinatumDeminutum="",t.chantPunctumLinea="",t.chantPunctumLineaCavum="",t.chantPunctumVirga="",t.chantPunctumVirgaReversed="",t.chantQuilisma="",t.chantSemicirculusAbove="",t.chantSemicirculusBelow="",t.chantStaff="",t.chantStaffNarrow="",t.chantStaffWide="",t.chantStrophicus="",t.chantStrophicusAuctus="",t.chantStrophicusLiquescens2nd="",t.chantStrophicusLiquescens3rd="",t.chantStrophicusLiquescens4th="",t.chantStrophicusLiquescens5th="",t.chantVirgula="",t.clef15="",t.clef8="",t.clefChangeCombining="",t.coda="",t.codaSquare="",t.conductorBeat2Compound="",t.conductorBeat2Simple="",t.conductorBeat3Compound="",t.conductorBeat3Simple="",t.conductorBeat4Compound="",t.conductorBeat4Simple="",t.conductorLeftBeat="",t.conductorRightBeat="",t.conductorStrongBeat="",t.conductorUnconducted="",t.conductorWeakBeat="";t.controlBeginBeam="",t.controlBeginPhrase="",t.controlBeginSlur="",t.controlBeginTie="",t.controlEndBeam="",t.controlEndPhrase="",t.controlEndSlur="",t.controlEndTie="",t.csymAccidentalDoubleFlat="",t.csymAccidentalDoubleSharp="",t.csymAccidentalFlat="",t.csymAccidentalNatural="",t.csymAccidentalSharp="",t.csymAccidentalTripleFlat="",t.csymAccidentalTripleSharp="",t.csymAlteredBassSlash="",t.csymAugmented="",t.csymBracketLeftTall="",t.csymBracketRightTall="",t.csymDiagonalArrangementSlash="",t.csymDiminished="",t.csymHalfDiminished="",t.csymMajorSeventh="",t.csymMinor="",t.csymParensLeftTall="",t.csymParensLeftVeryTall="",t.csymParensRightTall="",t.csymParensRightVeryTall="",t.curlewSign="",t.daCapo="",t.dalSegno="",t.daseianExcellentes1="",t.daseianExcellentes2="",t.daseianExcellentes3="",t.daseianExcellentes4="",t.daseianFinales1="",t.daseianFinales2="",t.daseianFinales3="",t.daseianFinales4="",t.daseianGraves1="",t.daseianGraves2="",t.daseianGraves3="",t.daseianGraves4="",t.daseianResidua1="",t.daseianResidua2="",t.daseianSuperiores1="",t.daseianSuperiores2="",t.daseianSuperiores3="",t.daseianSuperiores4="",t.doubleLateralRollStevens="",t.doubleTongueAbove="",t.doubleTongueBelow="",t.dynamicCombinedSeparatorColon="",t.dynamicCombinedSeparatorHyphen="",t.dynamicCombinedSeparatorSlash="",t.dynamicCombinedSeparatorSpace="",t.dynamicCrescendoHairpin="",t.dynamicDiminuendoHairpin="",t.dynamicFF="",t.dynamicFFF="",t.dynamicFFFF="",t.dynamicFFFFF="",t.dynamicFFFFFF="",t.dynamicForte="",t.dynamicFortePiano="",t.dynamicForzando="",t.dynamicHairpinBracketLeft="",t.dynamicHairpinBracketRight="",t.dynamicHairpinParenthesisLeft="",t.dynamicHairpinParenthesisRight="",t.dynamicMF="",t.dynamicMP="",t.dynamicMessaDiVoce="",t.dynamicMezzo="",t.dynamicNiente="",t.dynamicNienteForHairpin="",t.dynamicPF="",t.dynamicPP="",t.dynamicPPP="",t.dynamicPPPP="",t.dynamicPPPPP="",t.dynamicPPPPPP="",t.dynamicPiano="",t.dynamicRinforzando="",t.dynamicRinforzando1="",t.dynamicRinforzando2="",t.dynamicSforzando="",t.dynamicSforzando1="",t.dynamicSforzandoPianissimo="",t.dynamicSforzandoPiano="",t.dynamicSforzato="",t.dynamicSforzatoFF="",t.dynamicSforzatoPiano="",t.dynamicZ="",t.elecAudioChannelsEight="",t.elecAudioChannelsFive="",t.elecAudioChannelsFour="",t.elecAudioChannelsOne="",t.elecAudioChannelsSeven="",t.elecAudioChannelsSix="",t.elecAudioChannelsThreeFrontal="",t.elecAudioChannelsThreeSurround="",t.elecAudioChannelsTwo="",t.elecAudioIn="",t.elecAudioMono="",t.elecAudioOut="",t.elecAudioStereo="",t.elecCamera="",t.elecDataIn="",t.elecDataOut="",t.elecDisc="",t.elecDownload="",t.elecEject="",t.elecFastForward="",t.elecHeadphones="",t.elecHeadset="",t.elecLineIn="",t.elecLineOut="",t.elecLoop="",t.elecLoudspeaker="",t.elecMIDIController0="",t.elecMIDIController100="",t.elecMIDIController20="",t.elecMIDIController40="",t.elecMIDIController60="",t.elecMIDIController80="",t.elecMIDIIn="",t.elecMIDIOut="",t.elecMicrophone="",t.elecMicrophoneMute="",t.elecMicrophoneUnmute="",t.elecMixingConsole="",t.elecMonitor="",t.elecMute="",t.elecPause="",t.elecPlay="",t.elecPowerOnOff="",t.elecProjector="",t.elecReplay="",t.elecRewind="",t.elecShuffle="",t.elecSkipBackwards="",t.elecSkipForwards="",t.elecStop="",t.elecTape="",t.elecUSB="",t.elecUnmute="",t.elecUpload="",t.elecVideoCamera="",t.elecVideoIn="",t.elecVideoOut="",t.elecVolumeFader="",t.elecVolumeFaderThumb="",t.elecVolumeLevel0="",t.elecVolumeLevel100="",t.elecVolumeLevel20="",t.elecVolumeLevel40="",t.elecVolumeLevel60="",t.elecVolumeLevel80="",t.fClef="",t.fClef15ma="",t.fClef15mb="",t.fClef8va="",t.fClef8vb="",t.fClefArrowDown="",t.fClefArrowUp="",t.fClefChange="",t.fClefReversed="",t.fClefTurned="",t.fermataAbove="",t.fermataBelow="",t.fermataLongAbove="",t.fermataLongBelow="",t.fermataLongHenzeAbove="",t.fermataLongHenzeBelow="",t.fermataShortAbove="",t.fermataShortBelow="",t.fermataShortHenzeAbove="",t.fermataShortHenzeBelow="",t.fermataVeryLongAbove="",t.fermataVeryLongBelow="",t.fermataVeryShortAbove="",t.fermataVeryShortBelow="",t.figbass0="",t.figbass1="",t.figbass2="",t.figbass2Raised="",t.figbass3="",t.figbass4="",t.figbass4Raised="",t.figbass5="",t.figbass5Raised1="",t.figbass5Raised2="",t.figbass5Raised3="",t.figbass6="",t.figbass6Raised="",t.figbass6Raised2="",t.figbass7="",t.figbass7Diminished="",t.figbass7Raised1="",t.figbass7Raised2="",t.figbass8="",t.figbass9="",t.figbass9Raised="",t.figbassBracketLeft="",t.figbassBracketRight="",t.figbassCombiningLowering="",t.figbassCombiningRaising="",t.figbassDoubleFlat="",t.figbassDoubleSharp="",t.figbassFlat="",t.figbassNatural="",t.figbassParensLeft="",t.figbassParensRight="",t.figbassPlus="",t.figbassSharp="",t.figbassTripleFlat="",t.figbassTripleSharp="",t.fingering0="",t.fingering0Italic="",t.fingering1="",t.fingering1Italic="",t.fingering2="",t.fingering2Italic="",t.fingering3="",t.fingering3Italic="",t.fingering4="",t.fingering4Italic="",t.fingering5="",t.fingering5Italic="",t.fingering6="",t.fingering6Italic="",t.fingering7="",t.fingering7Italic="",t.fingering8="",t.fingering8Italic="",t.fingering9="",t.fingering9Italic="",t.fingeringALower="",t.fingeringCLower="",t.fingeringELower="",t.fingeringILower="",t.fingeringLeftBracket="",t.fingeringLeftBracketItalic="",t.fingeringLeftParenthesis="",t.fingeringLeftParenthesisItalic="",t.fingeringMLower="",t.fingeringMultipleNotes="",t.fingeringOLower="",t.fingeringPLower="",t.fingeringQLower="",t.fingeringRightBracket="",t.fingeringRightBracketItalic="",t.fingeringRightParenthesis="",t.fingeringRightParenthesisItalic="",t.fingeringSLower="",t.fingeringSeparatorMiddleDot="",t.fingeringSeparatorMiddleDotWhite="",t.fingeringSeparatorSlash="",t.fingeringSubstitutionAbove="",t.fingeringSubstitutionBelow="",t.fingeringSubstitutionDash="",t.fingeringTLower="",t.fingeringTUpper="",t.fingeringXLower="",t.flag1024thDown="",t.flag1024thUp="",t.flag128thDown="",t.flag128thUp="",t.flag16thDown="",t.flag16thUp="",t.flag256thDown="",t.flag256thUp="",t.flag32ndDown="",t.flag32ndUp="",t.flag512thDown="",t.flag512thUp="",t.flag64thDown="",t.flag64thUp="",t.flag8thDown="",t.flag8thUp="",t.flagInternalDown="",t.flagInternalUp="",t.fretboard3String="",t.fretboard3StringNut="",t.fretboard4String="",t.fretboard4StringNut="",t.fretboard5String="",t.fretboard5StringNut="",t.fretboard6String="",t.fretboard6StringNut="",t.fretboardFilledCircle="",t.fretboardO="",t.fretboardX="",t.functionAngleLeft="",t.functionAngleRight="",t.functionBracketLeft="",t.functionBracketRight="",t.functionDD="",t.functionDLower="",t.functionDUpper="",t.functionEight="",t.functionFUpper="",t.functionFive="",t.functionFour="",t.functionGLower="",t.functionGUpper="",t.functionGreaterThan="",t.functionILower="",t.functionIUpper="",t.functionKLower="",t.functionKUpper="",t.functionLLower="",t.functionLUpper="",t.functionLessThan="",t.functionMLower="",t.functionMUpper="",t.functionMinus="",t.functionNLower="",t.functionNUpper="",t.functionNUpperSuperscript="",t.functionNine="",t.functionOne="",t.functionPLower="",t.functionPUpper="",t.functionParensLeft="",t.functionParensRight="",t.functionPlus="",t.functionRLower="",t.functionRepetition1="",t.functionRepetition2="",t.functionRing="",t.functionSLower="",t.functionSSLower="",t.functionSSUpper="",t.functionSUpper="",t.functionSeven="",t.functionSix="",t.functionSlashedDD="",t.functionTLower="",t.functionTUpper="",t.functionThree="",t.functionTwo="",t.functionVLower="",t.functionVUpper="",t.functionZero="",t.gClef="",t.gClef15ma="",t.gClef15mb="",t.gClef8va="",t.gClef8vb="",t.gClef8vbCClef="",t.gClef8vbOld="",t.gClef8vbParens="",t.gClefArrowDown="",t.gClefArrowUp="",t.gClefChange="",t.gClefLigatedNumberAbove="",t.gClefLigatedNumberBelow="",t.gClefReversed="",t.gClefTurned="",t.glissandoDown="",t.glissandoUp="",t.graceNoteAcciaccaturaStemDown="",t.graceNoteAcciaccaturaStemUp="",t.graceNoteAppoggiaturaStemDown="",t.graceNoteAppoggiaturaStemUp="",t.graceNoteSlashStemDown="",t.graceNoteSlashStemUp="",t.guitarBarreFull="",t.guitarBarreHalf="",t.guitarClosePedal="",t.guitarFadeIn="",t.guitarFadeOut="",t.guitarGolpe="",t.guitarHalfOpenPedal="",t.guitarLeftHandTapping="",t.guitarOpenPedal="",t.guitarRightHandTapping="",t.guitarShake="",t.guitarString0="",t.guitarString1="",t.guitarString10="",t.guitarString11="",t.guitarString12="",t.guitarString13="",t.guitarString2="",t.guitarString3="",t.guitarString4="",t.guitarString5="",t.guitarString6="",t.guitarString7="",t.guitarString8="",t.guitarString9="",t.guitarStrumDown="",t.guitarStrumUp="",t.guitarVibratoBarDip="",t.guitarVibratoBarScoop="",t.guitarVibratoStroke="",t.guitarVolumeSwell="",t.guitarWideVibratoStroke="",t.handbellsBelltree="",t.handbellsDamp3="",t.handbellsEcho1="",t.handbellsEcho2="",t.handbellsGyro="",t.handbellsHandMartellato="",t.handbellsMalletBellOnTable="",t.handbellsMalletBellSuspended="",t.handbellsMalletLft="",t.handbellsMartellato="",t.handbellsMartellatoLift="",t.handbellsMutedMartellato="",t.handbellsPluckLift="",t.handbellsSwing="",t.handbellsSwingDown="",t.handbellsSwingUp="",t.handbellsTablePairBells="",t.handbellsTableSingleBell="",t.harpMetalRod="",t.harpPedalCentered="",t.harpPedalDivider="",t.harpPedalLowered="",t.harpPedalRaised="",t.harpSalzedoAeolianAscending="",t.harpSalzedoAeolianDescending="",t.harpSalzedoDampAbove="",t.harpSalzedoDampBelow="",t.harpSalzedoDampBothHands="",t.harpSalzedoDampLowStrings="",t.harpSalzedoFluidicSoundsLeft="",t.harpSalzedoFluidicSoundsRight="",t.harpSalzedoIsolatedSounds="",t.harpSalzedoMetallicSounds="",t.harpSalzedoMetallicSoundsOneString="",t.harpSalzedoMuffleTotally="",t.harpSalzedoOboicFlux="",t.harpSalzedoPlayUpperEnd="",t.harpSalzedoSlideWithSuppleness="",t.harpSalzedoSnareDrum="",t.harpSalzedoTamTamSounds="",t.harpSalzedoThunderEffect="",t.harpSalzedoTimpanicSounds="",t.harpSalzedoWhistlingSounds="",t.harpStringNoiseStem="",t.harpTuningKey="",t.harpTuningKeyGlissando="",t.harpTuningKeyHandle="",t.harpTuningKeyShank="",t.indianDrumClef="",t.kahnBackChug="",t.kahnBackFlap="",t.kahnBackRiff="",t.kahnBackRip="",t.kahnBallChange="",t.kahnBallDig="",t.kahnBrushBackward="",t.kahnBrushForward="",t.kahnChug="",t.kahnClap="",t.kahnDoubleSnap="",t.kahnDoubleWing="",t.kahnDrawStep="",t.kahnDrawTap="",t.kahnFlam="",t.kahnFlap="",t.kahnFlapStep="",t.kahnFlat="",t.kahnFleaHop="",t.kahnFleaTap="",t.kahnGraceTap="",t.kahnGraceTapChange="",t.kahnGraceTapHop="",t.kahnGraceTapStamp="",t.kahnHeel="",t.kahnHeelChange="",t.kahnHeelClick="",t.kahnHeelDrop="",t.kahnHeelStep="",t.kahnHeelTap="",t.kahnHop="",t.kahnJumpApart="",t.kahnJumpTogether="",t.kahnKneeInward="",t.kahnKneeOutward="",t.kahnLeap="",t.kahnLeapFlatFoot="",t.kahnLeapHeelClick="",t.kahnLeftCatch="",t.kahnLeftCross="",t.kahnLeftFoot="",t.kahnLeftToeStrike="",t.kahnLeftTurn="",t.kahnOverTheTop="",t.kahnOverTheTopTap="",t.kahnPull="",t.kahnPush="",t.kahnRiff="",t.kahnRiffle="",t.kahnRightCatch="",t.kahnRightCross="",t.kahnRightFoot="",t.kahnRightToeStrike="",t.kahnRightTurn="",t.kahnRip="",t.kahnRipple="",t.kahnScrape="",t.kahnScuff="",t.kahnScuffle="",t.kahnShuffle="",t.kahnSlam="",t.kahnSlap="",t.kahnSlideStep="",t.kahnSlideTap="",t.kahnSnap="",t.kahnStamp="",t.kahnStampStamp="",t.kahnStep="",t.kahnStepStamp="",t.kahnStomp="",t.kahnStompBrush="",t.kahnTap="",t.kahnToe="",t.kahnToeClick="",t.kahnToeDrop="",t.kahnToeStep="",t.kahnToeTap="",t.kahnTrench="",t.kahnWing="",t.kahnWingChange="",t.kahnZank="",t.kahnZink="",t.keyboardBebung2DotsAbove="",t.keyboardBebung2DotsBelow="",t.keyboardBebung3DotsAbove="",t.keyboardBebung3DotsBelow="",t.keyboardBebung4DotsAbove="",t.keyboardBebung4DotsBelow="",t.keyboardLeftPedalPictogram="",t.keyboardMiddlePedalPictogram="",t.keyboardPedalD="",t.keyboardPedalDot="",t.keyboardPedalE="",t.keyboardPedalHalf="",t.keyboardPedalHalf2="",t.keyboardPedalHalf3="",t.keyboardPedalHeel1="",t.keyboardPedalHeel2="",t.keyboardPedalHeel3="",t.keyboardPedalHeelToToe="",t.keyboardPedalHeelToe="",t.keyboardPedalHookEnd="",t.keyboardPedalHookStart="",t.keyboardPedalHyphen="",t.keyboardPedalP="",t.keyboardPedalParensLeft="",t.keyboardPedalParensRight="",t.keyboardPedalPed="",t.keyboardPedalS="",t.keyboardPedalSost="",t.keyboardPedalToe1="",t.keyboardPedalToe2="",t.keyboardPedalToeToHeel="",t.keyboardPedalUp="",t.keyboardPedalUpNotch="",t.keyboardPedalUpSpecial="",t.keyboardPlayWithLH="",t.keyboardPlayWithLHEnd="",t.keyboardPlayWithRH="",t.keyboardPlayWithRHEnd="",t.keyboardPluckInside="",t.keyboardRightPedalPictogram="",t.kievanAccidentalFlat="",t.kievanAccidentalSharp="",t.kievanAugmentationDot="",t.kievanCClef="",t.kievanEndingSymbol="",t.kievanNote8thStemDown="",t.kievanNote8thStemUp="",t.kievanNoteBeam="",t.kievanNoteHalfStaffLine="",t.kievanNoteHalfStaffSpace="",t.kievanNoteQuarterStemDown="",t.kievanNoteQuarterStemUp="",t.kievanNoteReciting="",t.kievanNoteWhole="",t.kievanNoteWholeFinal="",t.kodalyHandDo="",t.kodalyHandFa="",t.kodalyHandLa="",t.kodalyHandMi="",t.kodalyHandRe="",t.kodalyHandSo="",t.kodalyHandTi="",t.leftRepeatSmall="",t.legerLine="",t.legerLineNarrow="",t.legerLineWide="",t.luteBarlineEndRepeat="",t.luteBarlineFinal="",t.luteBarlineStartRepeat="",t.luteDuration16th="",t.luteDuration32nd="",t.luteDuration8th="",t.luteDurationDoubleWhole="",t.luteDurationHalf="",t.luteDurationQuarter="",t.luteDurationWhole="",t.luteFingeringRHFirst="",t.luteFingeringRHSecond="",t.luteFingeringRHThird="",t.luteFingeringRHThumb="",t.luteFrench10thCourse="",t.luteFrench7thCourse="",t.luteFrench8thCourse="",t.luteFrench9thCourse="",t.luteFrenchAppoggiaturaAbove="",t.luteFrenchAppoggiaturaBelow="",t.luteFrenchFretA="",t.luteFrenchFretB="",t.luteFrenchFretC="",t.luteFrenchFretD="",t.luteFrenchFretE="",t.luteFrenchFretF="",t.luteFrenchFretG="",t.luteFrenchFretH="",t.luteFrenchFretI="",t.luteFrenchFretK="",t.luteFrenchFretL="",t.luteFrenchFretM="",t.luteFrenchFretN="",t.luteFrenchMordentInverted="",t.luteFrenchMordentLower="",t.luteFrenchMordentUpper="",t.luteGermanALower="",t.luteGermanAUpper="",t.luteGermanBLower="",t.luteGermanBUpper="",t.luteGermanCLower="",t.luteGermanCUpper="",t.luteGermanDLower="",t.luteGermanDUpper="",t.luteGermanELower="",t.luteGermanEUpper="",t.luteGermanFLower="",t.luteGermanFUpper="",t.luteGermanGLower="",t.luteGermanGUpper="",t.luteGermanHLower="",t.luteGermanHUpper="",t.luteGermanILower="",t.luteGermanIUpper="",t.luteGermanKLower="",t.luteGermanKUpper="",t.luteGermanLLower="",t.luteGermanLUpper="",t.luteGermanMLower="",t.luteGermanMUpper="",t.luteGermanNLower="",t.luteGermanNUpper="",t.luteGermanOLower="",t.luteGermanPLower="",t.luteGermanQLower="",t.luteGermanRLower="",t.luteGermanSLower="",t.luteGermanTLower="",t.luteGermanVLower="",t.luteGermanXLower="",t.luteGermanYLower="",t.luteGermanZLower="",t.luteItalianClefCSolFaUt="",t.luteItalianClefFFaUt="",t.luteItalianFret0="",t.luteItalianFret1="",t.luteItalianFret2="",t.luteItalianFret3="",t.luteItalianFret4="",t.luteItalianFret5="",t.luteItalianFret6="",t.luteItalianFret7="",t.luteItalianFret8="",t.luteItalianFret9="",t.luteItalianHoldFinger="",t.luteItalianHoldNote="",t.luteItalianReleaseFinger="",t.luteItalianTempoFast="",t.luteItalianTempoNeitherFastNorSlow="",t.luteItalianTempoSlow="",t.luteItalianTempoSomewhatFast="",t.luteItalianTempoVerySlow="",t.luteItalianTimeTriple="",t.luteItalianTremolo="",t.luteItalianVibrato="",t.luteStaff6Lines="",t.luteStaff6LinesNarrow="",t.luteStaff6LinesWide="",t.lyricsElision="",t.lyricsElisionNarrow="",t.lyricsElisionWide="",t.lyricsHyphenBaseline="",t.lyricsHyphenBaselineNonBreaking="",t.lyricsTextRepeat="",t.medRenFlatHardB="",t.medRenFlatSoftB="",t.medRenFlatWithDot="",t.medRenGClefCMN="",t.medRenLiquescenceCMN="",t.medRenLiquescentAscCMN="",t.medRenLiquescentDescCMN="",t.medRenNatural="",t.medRenNaturalWithCross="",t.medRenOriscusCMN="",t.medRenPlicaCMN="",t.medRenPunctumCMN="",t.medRenQuilismaCMN="",t.medRenSharpCroix="",t.medRenStrophicusCMN="",t.mensuralAlterationSign="",t.mensuralBlackBrevis="",t.mensuralBlackBrevisVoid="",t.mensuralBlackDragma="",t.mensuralBlackLonga="",t.mensuralBlackMaxima="",t.mensuralBlackMinima="",t.mensuralBlackMinimaVoid="",t.mensuralBlackSemibrevis="",t.mensuralBlackSemibrevisCaudata="",t.mensuralBlackSemibrevisOblique="",t.mensuralBlackSemibrevisVoid="",t.mensuralBlackSemiminima="",t.mensuralCclef="",t.mensuralCclefPetrucciPosHigh="",t.mensuralCclefPetrucciPosHighest="",t.mensuralCclefPetrucciPosLow="",t.mensuralCclefPetrucciPosLowest="",t.mensuralCclefPetrucciPosMiddle="",t.mensuralColorationEndRound="",t.mensuralColorationEndSquare="",t.mensuralColorationStartRound="",t.mensuralColorationStartSquare="",t.mensuralCombStemDiagonal="",t.mensuralCombStemDown="",t.mensuralCombStemDownFlagExtended="",t.mensuralCombStemDownFlagFlared="",t.mensuralCombStemDownFlagFusa="",t.mensuralCombStemDownFlagLeft="",t.mensuralCombStemDownFlagRight="",t.mensuralCombStemDownFlagSemiminima="",t.mensuralCombStemUp="",t.mensuralCombStemUpFlagExtended="",t.mensuralCombStemUpFlagFlared="",t.mensuralCombStemUpFlagFusa="",t.mensuralCombStemUpFlagLeft="",t.mensuralCombStemUpFlagRight="",t.mensuralCombStemUpFlagSemiminima="",t.mensuralCustosCheckmark="",t.mensuralCustosDown="",t.mensuralCustosTurn="",t.mensuralCustosUp="",t.mensuralFclef="",t.mensuralFclefPetrucci="",t.mensuralGclef="",t.mensuralGclefPetrucci="",t.mensuralModusImperfectumVert="",t.mensuralModusPerfectumVert="",t.mensuralNoteheadLongaBlack="",t.mensuralNoteheadLongaBlackVoid="",t.mensuralNoteheadLongaVoid="",t.mensuralNoteheadLongaWhite="",t.mensuralNoteheadMaximaBlack="",t.mensuralNoteheadMaximaBlackVoid="",t.mensuralNoteheadMaximaVoid="",t.mensuralNoteheadMaximaWhite="",t.mensuralNoteheadMinimaWhite="",t.mensuralNoteheadSemibrevisBlack="",t.mensuralNoteheadSemibrevisBlackVoid="",t.mensuralNoteheadSemibrevisBlackVoidTurned="",t.mensuralNoteheadSemibrevisVoid="",t.mensuralNoteheadSemiminimaWhite="",t.mensuralObliqueAsc2ndBlack="",t.mensuralObliqueAsc2ndBlackVoid="",t.mensuralObliqueAsc2ndVoid="",t.mensuralObliqueAsc2ndWhite="",t.mensuralObliqueAsc3rdBlack="",t.mensuralObliqueAsc3rdBlackVoid="",t.mensuralObliqueAsc3rdVoid="",t.mensuralObliqueAsc3rdWhite="",t.mensuralObliqueAsc4thBlack="",t.mensuralObliqueAsc4thBlackVoid="",t.mensuralObliqueAsc4thVoid="",t.mensuralObliqueAsc4thWhite="",t.mensuralObliqueAsc5thBlack="",t.mensuralObliqueAsc5thBlackVoid="",t.mensuralObliqueAsc5thVoid="",t.mensuralObliqueAsc5thWhite="",t.mensuralObliqueDesc2ndBlack="",t.mensuralObliqueDesc2ndBlackVoid="",t.mensuralObliqueDesc2ndVoid="",t.mensuralObliqueDesc2ndWhite="",t.mensuralObliqueDesc3rdBlack="";t.mensuralObliqueDesc3rdBlackVoid="",t.mensuralObliqueDesc3rdVoid="",t.mensuralObliqueDesc3rdWhite="",t.mensuralObliqueDesc4thBlack="",t.mensuralObliqueDesc4thBlackVoid="",t.mensuralObliqueDesc4thVoid="",t.mensuralObliqueDesc4thWhite="",t.mensuralObliqueDesc5thBlack="",t.mensuralObliqueDesc5thBlackVoid="",t.mensuralObliqueDesc5thVoid="",t.mensuralObliqueDesc5thWhite="",t.mensuralProlation1="",t.mensuralProlation10="",t.mensuralProlation11="",t.mensuralProlation2="",t.mensuralProlation3="",t.mensuralProlation4="",t.mensuralProlation5="",t.mensuralProlation6="",t.mensuralProlation7="",t.mensuralProlation8="",t.mensuralProlation9="",t.mensuralProlationCombiningDot="",t.mensuralProlationCombiningDotVoid="",t.mensuralProlationCombiningStroke="",t.mensuralProlationCombiningThreeDots="",t.mensuralProlationCombiningThreeDotsTri="",t.mensuralProlationCombiningTwoDots="",t.mensuralProportion1="",t.mensuralProportion2="",t.mensuralProportion3="",t.mensuralProportion4="",t.mensuralProportion5="",t.mensuralProportion6="",t.mensuralProportion7="",t.mensuralProportion8="",t.mensuralProportion9="",t.mensuralProportionMajor="",t.mensuralProportionMinor="",t.mensuralProportionProportioDupla1="",t.mensuralProportionProportioDupla2="",t.mensuralProportionProportioQuadrupla="",t.mensuralProportionProportioTripla="",t.mensuralProportionTempusPerfectum="",t.mensuralRestBrevis="",t.mensuralRestFusa="",t.mensuralRestLongaImperfecta="",t.mensuralRestLongaPerfecta="",t.mensuralRestMaxima="",t.mensuralRestMinima="",t.mensuralRestSemibrevis="",t.mensuralRestSemifusa="",t.mensuralRestSemiminima="",t.mensuralSignumDown="",t.mensuralSignumUp="",t.mensuralTempusImperfectumHoriz="",t.mensuralTempusPerfectumHoriz="",t.mensuralWhiteBrevis="",t.mensuralWhiteFusa="",t.mensuralWhiteLonga="",t.mensuralWhiteMaxima="",t.mensuralWhiteMinima="",t.mensuralWhiteSemibrevis="",t.mensuralWhiteSemiminima="",t.metAugmentationDot="",t.metNote1024thDown="",t.metNote1024thUp="",t.metNote128thDown="",t.metNote128thUp="",t.metNote16thDown="",t.metNote16thUp="",t.metNote256thDown="",t.metNote256thUp="",t.metNote32ndDown="",t.metNote32ndUp="",t.metNote512thDown="",t.metNote512thUp="",t.metNote64thDown="",t.metNote64thUp="",t.metNote8thDown="",t.metNote8thUp="",t.metNoteDoubleWhole="",t.metNoteDoubleWholeSquare="",t.metNoteHalfDown="",t.metNoteHalfUp="",t.metNoteQuarterDown="",t.metNoteQuarterUp="",t.metNoteWhole="",t.metricModulationArrowLeft="",t.metricModulationArrowRight="",t.miscDoNotCopy="",t.miscDoNotPhotocopy="",t.miscEyeglasses="",t.note1024thDown="",t.note1024thUp="",t.note128thDown="",t.note128thUp="",t.note16thDown="",t.note16thUp="",t.note256thDown="",t.note256thUp="",t.note32ndDown="",t.note32ndUp="",t.note512thDown="",t.note512thUp="",t.note64thDown="",t.note64thUp="",t.note8thDown="",t.note8thUp="",t.noteABlack="",t.noteAFlatBlack="",t.noteAFlatHalf="",t.noteAFlatWhole="",t.noteAHalf="",t.noteASharpBlack="",t.noteASharpHalf="",t.noteASharpWhole="",t.noteAWhole="",t.noteBBlack="",t.noteBFlatBlack="",t.noteBFlatHalf="",t.noteBFlatWhole="",t.noteBHalf="",t.noteBSharpBlack="",t.noteBSharpHalf="",t.noteBSharpWhole="",t.noteBWhole="",t.noteCBlack="",t.noteCFlatBlack="",t.noteCFlatHalf="",t.noteCFlatWhole="",t.noteCHalf="",t.noteCSharpBlack="",t.noteCSharpHalf="",t.noteCSharpWhole="",t.noteCWhole="",t.noteDBlack="",t.noteDFlatBlack="",t.noteDFlatHalf="",t.noteDFlatWhole="",t.noteDHalf="",t.noteDSharpBlack="",t.noteDSharpHalf="",t.noteDSharpWhole="",t.noteDWhole="",t.noteDiBlack="",t.noteDiHalf="",t.noteDiWhole="",t.noteDoBlack="",t.noteDoHalf="",t.noteDoWhole="",t.noteDoubleWhole="",t.noteDoubleWholeSquare="",t.noteEBlack="",t.noteEFlatBlack="",t.noteEFlatHalf="",t.noteEFlatWhole="",t.noteEHalf="",t.noteESharpBlack="",t.noteESharpHalf="",t.noteESharpWhole="",t.noteEWhole="",t.noteEmptyBlack="",t.noteEmptyHalf="",t.noteEmptyWhole="",t.noteFBlack="",t.noteFFlatBlack="",t.noteFFlatHalf="",t.noteFFlatWhole="",t.noteFHalf="",t.noteFSharpBlack="",t.noteFSharpHalf="",t.noteFSharpWhole="",t.noteFWhole="",t.noteFaBlack="",t.noteFaHalf="",t.noteFaWhole="",t.noteFiBlack="",t.noteFiHalf="",t.noteFiWhole="",t.noteGBlack="",t.noteGFlatBlack="",t.noteGFlatHalf="",t.noteGFlatWhole="",t.noteGHalf="",t.noteGSharpBlack="",t.noteGSharpHalf="",t.noteGSharpWhole="",t.noteGWhole="",t.noteHBlack="",t.noteHHalf="",t.noteHSharpBlack="",t.noteHSharpHalf="",t.noteHSharpWhole="",t.noteHWhole="",t.noteHalfDown="",t.noteHalfUp="",t.noteLaBlack="",t.noteLaHalf="",t.noteLaWhole="",t.noteLeBlack="",t.noteLeHalf="",t.noteLeWhole="",t.noteLiBlack="",t.noteLiHalf="",t.noteLiWhole="",t.noteMeBlack="",t.noteMeHalf="",t.noteMeWhole="",t.noteMiBlack="",t.noteMiHalf="",t.noteMiWhole="",t.noteQuarterDown="",t.noteQuarterUp="",t.noteRaBlack="",t.noteRaHalf="",t.noteRaWhole="",t.noteReBlack="",t.noteReHalf="",t.noteReWhole="",t.noteRiBlack="",t.noteRiHalf="",t.noteRiWhole="",t.noteSeBlack="",t.noteSeHalf="",t.noteSeWhole="",t.noteShapeArrowheadLeftBlack="",t.noteShapeArrowheadLeftDoubleWhole="",t.noteShapeArrowheadLeftWhite="",t.noteShapeDiamondBlack="",t.noteShapeDiamondDoubleWhole="",t.noteShapeDiamondWhite="",t.noteShapeIsoscelesTriangleBlack="",t.noteShapeIsoscelesTriangleDoubleWhole="",t.noteShapeIsoscelesTriangleWhite="",t.noteShapeKeystoneBlack="",t.noteShapeKeystoneDoubleWhole="",t.noteShapeKeystoneWhite="",t.noteShapeMoonBlack="",t.noteShapeMoonDoubleWhole="",t.noteShapeMoonLeftBlack="",t.noteShapeMoonLeftDoubleWhole="",t.noteShapeMoonLeftWhite="",t.noteShapeMoonWhite="",t.noteShapeQuarterMoonBlack="",t.noteShapeQuarterMoonDoubleWhole="",t.noteShapeQuarterMoonWhite="",t.noteShapeRoundBlack="",t.noteShapeRoundDoubleWhole="",t.noteShapeRoundWhite="",t.noteShapeSquareBlack="",t.noteShapeSquareDoubleWhole="",t.noteShapeSquareWhite="",t.noteShapeTriangleLeftBlack="",t.noteShapeTriangleLeftDoubleWhole="",t.noteShapeTriangleLeftWhite="",t.noteShapeTriangleRightBlack="",t.noteShapeTriangleRightDoubleWhole="",t.noteShapeTriangleRightWhite="",t.noteShapeTriangleRoundBlack="",t.noteShapeTriangleRoundDoubleWhole="",t.noteShapeTriangleRoundLeftBlack="",t.noteShapeTriangleRoundLeftDoubleWhole="",t.noteShapeTriangleRoundLeftWhite="",t.noteShapeTriangleRoundWhite="",t.noteShapeTriangleUpBlack="",t.noteShapeTriangleUpDoubleWhole="",t.noteShapeTriangleUpWhite="",t.noteSiBlack="",t.noteSiHalf="",t.noteSiWhole="",t.noteSoBlack="",t.noteSoHalf="",t.noteSoWhole="",t.noteTeBlack="",t.noteTeHalf="",t.noteTeWhole="",t.noteTiBlack="",t.noteTiHalf="",t.noteTiWhole="",t.noteWhole="",t.noteheadBlack="",t.noteheadCircleSlash="",t.noteheadCircleX="",t.noteheadCircleXDoubleWhole="",t.noteheadCircleXHalf="",t.noteheadCircleXWhole="",t.noteheadCircledBlack="",t.noteheadCircledBlackLarge="",t.noteheadCircledDoubleWhole="",t.noteheadCircledDoubleWholeLarge="",t.noteheadCircledHalf="",t.noteheadCircledHalfLarge="",t.noteheadCircledWhole="",t.noteheadCircledWholeLarge="",t.noteheadCircledXLarge="",t.noteheadClusterDoubleWhole2nd="",t.noteheadClusterDoubleWhole3rd="",t.noteheadClusterDoubleWholeBottom="",t.noteheadClusterDoubleWholeMiddle="",t.noteheadClusterDoubleWholeTop="",t.noteheadClusterHalf2nd="",t.noteheadClusterHalf3rd="",t.noteheadClusterHalfBottom="",t.noteheadClusterHalfMiddle="",t.noteheadClusterHalfTop="",t.noteheadClusterQuarter2nd="",t.noteheadClusterQuarter3rd="",t.noteheadClusterQuarterBottom="",t.noteheadClusterQuarterMiddle="",t.noteheadClusterQuarterTop="",t.noteheadClusterRoundBlack="",t.noteheadClusterRoundWhite="",t.noteheadClusterSquareBlack="",t.noteheadClusterSquareWhite="",t.noteheadClusterWhole2nd="",t.noteheadClusterWhole3rd="",t.noteheadClusterWholeBottom="",t.noteheadClusterWholeMiddle="",t.noteheadClusterWholeTop="",t.noteheadCowellEleventhNoteSeriesHalf="",t.noteheadCowellEleventhNoteSeriesWhole="",t.noteheadCowellEleventhSeriesBlack="",t.noteheadCowellFifteenthNoteSeriesBlack="",t.noteheadCowellFifteenthNoteSeriesHalf="",t.noteheadCowellFifteenthNoteSeriesWhole="",t.noteheadCowellFifthNoteSeriesBlack="",t.noteheadCowellFifthNoteSeriesHalf="",t.noteheadCowellFifthNoteSeriesWhole="",t.noteheadCowellNinthNoteSeriesBlack="",t.noteheadCowellNinthNoteSeriesHalf="",t.noteheadCowellNinthNoteSeriesWhole="",t.noteheadCowellSeventhNoteSeriesBlack="",t.noteheadCowellSeventhNoteSeriesHalf="",t.noteheadCowellSeventhNoteSeriesWhole="",t.noteheadCowellThirdNoteSeriesBlack="",t.noteheadCowellThirdNoteSeriesHalf="",t.noteheadCowellThirdNoteSeriesWhole="",t.noteheadCowellThirteenthNoteSeriesBlack="",t.noteheadCowellThirteenthNoteSeriesHalf="",t.noteheadCowellThirteenthNoteSeriesWhole="",t.noteheadDiamondBlack="",t.noteheadDiamondBlackOld="",t.noteheadDiamondBlackWide="",t.noteheadDiamondClusterBlack2nd="",t.noteheadDiamondClusterBlack3rd="",t.noteheadDiamondClusterBlackBottom="",t.noteheadDiamondClusterBlackMiddle="",t.noteheadDiamondClusterBlackTop="",t.noteheadDiamondClusterWhite2nd="",t.noteheadDiamondClusterWhite3rd="",t.noteheadDiamondClusterWhiteBottom="",t.noteheadDiamondClusterWhiteMiddle="",t.noteheadDiamondClusterWhiteTop="",t.noteheadDiamondDoubleWhole="",t.noteheadDiamondDoubleWholeOld="",t.noteheadDiamondHalf="",t.noteheadDiamondHalfFilled="",t.noteheadDiamondHalfOld="",t.noteheadDiamondHalfWide="",t.noteheadDiamondOpen="",t.noteheadDiamondWhite="",t.noteheadDiamondWhiteWide="",t.noteheadDiamondWhole="",t.noteheadDiamondWholeOld="",t.noteheadDoubleWhole="",t.noteheadDoubleWholeSquare="",t.noteheadDoubleWholeWithX="",t.noteheadHalf="",t.noteheadHalfFilled="",t.noteheadHalfWithX="",t.noteheadHeavyX="",t.noteheadHeavyXHat="",t.noteheadLargeArrowDownBlack="",t.noteheadLargeArrowDownDoubleWhole="",t.noteheadLargeArrowDownHalf="",t.noteheadLargeArrowDownWhole="",t.noteheadLargeArrowUpBlack="",t.noteheadLargeArrowUpDoubleWhole="",t.noteheadLargeArrowUpHalf="",t.noteheadLargeArrowUpWhole="",t.noteheadMoonBlack="",t.noteheadMoonWhite="",t.noteheadNancarrowSine="",t.noteheadNull="",t.noteheadParenthesis="",t.noteheadParenthesisLeft="",t.noteheadParenthesisRight="",t.noteheadPlusBlack="",t.noteheadPlusDoubleWhole="",t.noteheadPlusHalf="",t.noteheadPlusWhole="",t.noteheadRectangularClusterBlackBottom="",t.noteheadRectangularClusterBlackMiddle="",t.noteheadRectangularClusterBlackTop="",t.noteheadRectangularClusterWhiteBottom="",t.noteheadRectangularClusterWhiteMiddle="",t.noteheadRectangularClusterWhiteTop="",t.noteheadRoundBlack="",t.noteheadRoundBlackDoubleSlashed="",t.noteheadRoundBlackLarge="",t.noteheadRoundBlackSlashed="",t.noteheadRoundBlackSlashedLarge="",t.noteheadRoundWhite="",t.noteheadRoundWhiteDoubleSlashed="",t.noteheadRoundWhiteLarge="",t.noteheadRoundWhiteSlashed="",t.noteheadRoundWhiteSlashedLarge="",t.noteheadRoundWhiteWithDot="",t.noteheadRoundWhiteWithDotLarge="",t.noteheadSlashDiamondWhite="",t.noteheadSlashHorizontalEnds="",t.noteheadSlashHorizontalEndsMuted="",t.noteheadSlashVerticalEnds="",t.noteheadSlashVerticalEndsMuted="",t.noteheadSlashVerticalEndsSmall="",t.noteheadSlashWhiteDoubleWhole="",t.noteheadSlashWhiteHalf="",t.noteheadSlashWhiteMuted="",t.noteheadSlashWhiteWhole="",t.noteheadSlashX="",t.noteheadSlashedBlack1="",t.noteheadSlashedBlack2="",t.noteheadSlashedDoubleWhole1="",t.noteheadSlashedDoubleWhole2="",t.noteheadSlashedHalf1="",t.noteheadSlashedHalf2="",t.noteheadSlashedWhole1="",t.noteheadSlashedWhole2="",t.noteheadSquareBlack="",t.noteheadSquareBlackLarge="",t.noteheadSquareBlackWhite="",t.noteheadSquareWhite="",t.noteheadTriangleDownBlack="",t.noteheadTriangleDownDoubleWhole="",t.noteheadTriangleDownHalf="",t.noteheadTriangleDownWhite="",t.noteheadTriangleDownWhole="",t.noteheadTriangleLeftBlack="",t.noteheadTriangleLeftWhite="",t.noteheadTriangleRightBlack="",t.noteheadTriangleRightWhite="",t.noteheadTriangleRoundDownBlack="",t.noteheadTriangleRoundDownWhite="",t.noteheadTriangleUpBlack="",t.noteheadTriangleUpDoubleWhole="",t.noteheadTriangleUpHalf="",t.noteheadTriangleUpRightBlack="",t.noteheadTriangleUpRightWhite="",t.noteheadTriangleUpWhite="",t.noteheadTriangleUpWhole="",t.noteheadVoidWithX="",t.noteheadWhole="",t.noteheadWholeFilled="",t.noteheadWholeWithX="",t.noteheadXBlack="",t.noteheadXDoubleWhole="",t.noteheadXHalf="",t.noteheadXOrnate="",t.noteheadXOrnateEllipse="",t.noteheadXWhole="",t.octaveBaselineA="",t.octaveBaselineB="",t.octaveBaselineM="",t.octaveBaselineV="",t.octaveBassa="",t.octaveLoco="",t.octaveParensLeft="",t.octaveParensRight="",t.octaveSuperscriptA="",t.octaveSuperscriptB="",t.octaveSuperscriptM="",t.octaveSuperscriptV="",t.oneHandedRollStevens="",t.organGerman2Fusae="",t.organGerman2Minimae="",t.organGerman2OctaveUp="",t.organGerman2Semifusae="",t.organGerman2Semiminimae="",t.organGerman3Fusae="",t.organGerman3Minimae="",t.organGerman3Semifusae="",t.organGerman3Semiminimae="",t.organGerman4Fusae="",t.organGerman4Minimae="",t.organGerman4Semifusae="",t.organGerman4Semiminimae="",t.organGerman5Fusae="",t.organGerman5Minimae="",t.organGerman5Semifusae="",t.organGerman5Semiminimae="",t.organGerman6Fusae="",t.organGerman6Minimae="",t.organGerman6Semifusae="",t.organGerman6Semiminimae="",t.organGermanALower="",t.organGermanAUpper="",t.organGermanAugmentationDot="",t.organGermanBLower="",t.organGermanBUpper="",t.organGermanBuxheimerBrevis2="",t.organGermanBuxheimerBrevis3="",t.organGermanBuxheimerMinimaRest="",t.organGermanBuxheimerSemibrevis="",t.organGermanBuxheimerSemibrevisRest="",t.organGermanCLower="",t.organGermanCUpper="",t.organGermanCisLower="",t.organGermanCisUpper="",t.organGermanDLower="",t.organGermanDUpper="",t.organGermanDisLower="",t.organGermanDisUpper="",t.organGermanELower="",t.organGermanEUpper="",t.organGermanFLower="",t.organGermanFUpper="",t.organGermanFisLower="",t.organGermanFisUpper="",t.organGermanFusa="",t.organGermanFusaRest="",t.organGermanGLower="",t.organGermanGUpper="",t.organGermanGisLower="",t.organGermanGisUpper="",t.organGermanHLower="",t.organGermanHUpper="",t.organGermanMinima="",t.organGermanMinimaRest="",t.organGermanOctaveDown="",t.organGermanOctaveUp="",t.organGermanSemibrevis="",t.organGermanSemibrevisRest="",t.organGermanSemifusa="",t.organGermanSemifusaRest="",t.organGermanSemiminima="",t.organGermanSemiminimaRest="",t.organGermanTie="",t.ornamentBottomLeftConcaveStroke="",t.ornamentBottomLeftConcaveStrokeLarge="",t.ornamentBottomLeftConvexStroke="",t.ornamentBottomRightConcaveStroke="",t.ornamentBottomRightConvexStroke="",t.ornamentComma="",t.ornamentDoubleObliqueLinesAfterNote="",t.ornamentDoubleObliqueLinesBeforeNote="",t.ornamentDownCurve="",t.ornamentHaydn="",t.ornamentHighLeftConcaveStroke="",t.ornamentHighLeftConvexStroke="",t.ornamentHighRightConcaveStroke="",t.ornamentHighRightConvexStroke="",t.ornamentHookAfterNote="",t.ornamentHookBeforeNote="",t.ornamentLeftFacingHalfCircle="",t.ornamentLeftFacingHook="",t.ornamentLeftPlus="",t.ornamentLeftShakeT="",t.ornamentLeftVerticalStroke="",t.ornamentLeftVerticalStrokeWithCross="",t.ornamentLowLeftConcaveStroke="",t.ornamentLowLeftConvexStroke="",t.ornamentLowRightConcaveStroke="",t.ornamentLowRightConvexStroke="",t.ornamentMiddleVerticalStroke="",t.ornamentMordent="",t.ornamentObliqueLineAfterNote="",t.ornamentObliqueLineBeforeNote="",t.ornamentObliqueLineHorizAfterNote="",t.ornamentObliqueLineHorizBeforeNote="",t.ornamentOriscus="",t.ornamentPinceCouperin="",t.ornamentPortDeVoixV="",t.ornamentPrecompAppoggTrill="",t.ornamentPrecompAppoggTrillSuffix="",t.ornamentPrecompCadence="",t.ornamentPrecompCadenceUpperPrefix="",t.ornamentPrecompCadenceUpperPrefixTurn="",t.ornamentPrecompCadenceWithTurn="",t.ornamentPrecompDescendingSlide="",t.ornamentPrecompDoubleCadenceLowerPrefix="",t.ornamentPrecompDoubleCadenceUpperPrefix="",t.ornamentPrecompDoubleCadenceUpperPrefixTurn="",t.ornamentPrecompInvertedMordentUpperPrefix="",t.ornamentPrecompMordentRelease="",t.ornamentPrecompMordentUpperPrefix="",t.ornamentPrecompPortDeVoixMordent="",t.ornamentPrecompSlide="",t.ornamentPrecompSlideTrillBach="",t.ornamentPrecompSlideTrillDAnglebert="",t.ornamentPrecompSlideTrillMarpurg="",t.ornamentPrecompSlideTrillMuffat="",t.ornamentPrecompSlideTrillSuffixMuffat="",t.ornamentPrecompTrillLowerSuffix="",t.ornamentPrecompTrillSuffixDandrieu="",t.ornamentPrecompTrillWithMordent="",t.ornamentPrecompTurnTrillBach="",t.ornamentPrecompTurnTrillDAnglebert="",t.ornamentQuilisma="",t.ornamentRightFacingHalfCircle="",t.ornamentRightFacingHook="",t.ornamentRightVerticalStroke="",t.ornamentSchleifer="",t.ornamentShake3="",t.ornamentShakeMuffat1="",t.ornamentShortObliqueLineAfterNote="",t.ornamentShortObliqueLineBeforeNote="",t.ornamentShortTrill="",t.ornamentTopLeftConcaveStroke="",t.ornamentTopLeftConvexStroke="",t.ornamentTopRightConcaveStroke="",t.ornamentTopRightConvexStroke="",t.ornamentTremblement="",t.ornamentTremblementCouperin="",t.ornamentTrill="",t.ornamentTurn="",t.ornamentTurnInverted="",t.ornamentTurnSlash="",t.ornamentTurnUp="",t.ornamentTurnUpS="",t.ornamentUpCurve="",t.ornamentVerticalLine="",t.ornamentZigZagLineNoRightEnd="",t.ornamentZigZagLineWithRightEnd="",t.ottava="",t.ottavaAlta="",t.ottavaBassa="",t.ottavaBassaBa="",t.ottavaBassaVb="",t.pendereckiTremolo="",t.pictAgogo="",t.pictAlmglocken="",t.pictAnvil="",t.pictBambooChimes="",t.pictBambooScraper="",t.pictBassDrum="",t.pictBassDrumOnSide="",t.pictBeaterBow="",t.pictBeaterBox="",t.pictBeaterBrassMalletsDown="",t.pictBeaterBrassMalletsLeft="",t.pictBeaterBrassMalletsRight="",t.pictBeaterBrassMalletsUp="",t.pictBeaterCombiningDashedCircle="",t.pictBeaterCombiningParentheses="",t.pictBeaterDoubleBassDrumDown="",t.pictBeaterDoubleBassDrumUp="",t.pictBeaterFinger="",t.pictBeaterFingernails="",t.pictBeaterFist="",t.pictBeaterGuiroScraper="",t.pictBeaterHammer="",t.pictBeaterHammerMetalDown="",t.pictBeaterHammerMetalUp="",t.pictBeaterHammerPlasticDown="",t.pictBeaterHammerPlasticUp="",t.pictBeaterHammerWoodDown="",t.pictBeaterHammerWoodUp="",t.pictBeaterHand="",t.pictBeaterHardBassDrumDown="",t.pictBeaterHardBassDrumUp="",t.pictBeaterHardGlockenspielDown="",t.pictBeaterHardGlockenspielLeft="",t.pictBeaterHardGlockenspielRight="",t.pictBeaterHardGlockenspielUp="",t.pictBeaterHardTimpaniDown="",t.pictBeaterHardTimpaniLeft="",t.pictBeaterHardTimpaniRight="",t.pictBeaterHardTimpaniUp="",t.pictBeaterHardXylophoneDown="",t.pictBeaterHardXylophoneLeft="",t.pictBeaterHardXylophoneRight="",t.pictBeaterHardXylophoneUp="",t.pictBeaterHardYarnDown="",t.pictBeaterHardYarnLeft="",t.pictBeaterHardYarnRight="",t.pictBeaterHardYarnUp="",t.pictBeaterJazzSticksDown="",t.pictBeaterJazzSticksUp="",t.pictBeaterKnittingNeedle="",t.pictBeaterMallet="",t.pictBeaterMalletDown="",t.pictBeaterMediumBassDrumDown="",t.pictBeaterMediumBassDrumUp="",t.pictBeaterMediumTimpaniDown="",t.pictBeaterMediumTimpaniLeft="",t.pictBeaterMediumTimpaniRight="",t.pictBeaterMediumTimpaniUp="",t.pictBeaterMediumXylophoneDown="",t.pictBeaterMediumXylophoneLeft="",t.pictBeaterMediumXylophoneRight="",t.pictBeaterMediumXylophoneUp="",t.pictBeaterMediumYarnDown="",t.pictBeaterMediumYarnLeft="",t.pictBeaterMediumYarnRight="",t.pictBeaterMediumYarnUp="",t.pictBeaterMetalBassDrumDown="",t.pictBeaterMetalBassDrumUp="",t.pictBeaterMetalDown="",t.pictBeaterMetalHammer="",t.pictBeaterMetalLeft="",t.pictBeaterMetalRight="",t.pictBeaterMetalUp="",t.pictBeaterSnareSticksDown="",t.pictBeaterSnareSticksUp="",t.pictBeaterSoftBassDrumDown="",t.pictBeaterSoftBassDrumUp="",t.pictBeaterSoftGlockenspielDown="",t.pictBeaterSoftGlockenspielLeft="",t.pictBeaterSoftGlockenspielRight="",t.pictBeaterSoftGlockenspielUp="",t.pictBeaterSoftTimpaniDown="",t.pictBeaterSoftTimpaniLeft="",t.pictBeaterSoftTimpaniRight="",t.pictBeaterSoftTimpaniUp="",t.pictBeaterSoftXylophone="",t.pictBeaterSoftXylophoneDown="",t.pictBeaterSoftXylophoneLeft="",t.pictBeaterSoftXylophoneRight="",t.pictBeaterSoftXylophoneUp="",t.pictBeaterSoftYarnDown="",t.pictBeaterSoftYarnLeft="",t.pictBeaterSoftYarnRight="",t.pictBeaterSoftYarnUp="",t.pictBeaterSpoonWoodenMallet="",t.pictBeaterSuperballDown="",t.pictBeaterSuperballLeft="",t.pictBeaterSuperballRight="",t.pictBeaterSuperballUp="",t.pictBeaterTriangleDown="",t.pictBeaterTrianglePlain="",t.pictBeaterTriangleUp="",t.pictBeaterWireBrushesDown="",t.pictBeaterWireBrushesUp="",t.pictBeaterWoodTimpaniDown="",t.pictBeaterWoodTimpaniLeft="",t.pictBeaterWoodTimpaniRight="",t.pictBeaterWoodTimpaniUp="",t.pictBeaterWoodXylophoneDown="",t.pictBeaterWoodXylophoneLeft="",t.pictBeaterWoodXylophoneRight="",t.pictBeaterWoodXylophoneUp="",t.pictBell="",t.pictBellOfCymbal="",t.pictBellPlate="",t.pictBellTree="",t.pictBirdWhistle="",t.pictBoardClapper="",t.pictBongos="",t.pictBrakeDrum="",t.pictCabasa="",t.pictCannon="",t.pictCarHorn="",t.pictCastanets="",t.pictCastanetsWithHandle="",t.pictCelesta="",t.pictCencerro="",t.pictCenter1="",t.pictCenter2="",t.pictCenter3="",t.pictChainRattle="",t.pictChimes="",t.pictChineseCymbal="",t.pictChokeCymbal="",t.pictClaves="",t.pictCoins="",t.pictConga="",t.pictCowBell="",t.pictCrashCymbals="",t.pictCrotales="",t.pictCrushStem="",t.pictCuica="",t.pictCymbalTongs="",t.pictDamp1="",t.pictDamp2="",t.pictDamp3="",t.pictDamp4="",t.pictDeadNoteStem="",t.pictDrumStick="",t.pictDuckCall="",t.pictEdgeOfCymbal="",t.pictEmptyTrap="",t.pictFingerCymbals="",t.pictFlexatone="",t.pictFootballRatchet="",t.pictGlassHarmonica="",t.pictGlassHarp="",t.pictGlassPlateChimes="",t.pictGlassTubeChimes="",t.pictGlsp="",t.pictGlspSmithBrindle="",t.pictGobletDrum="",t.pictGong="",t.pictGongWithButton="",t.pictGuiro="",t.pictGumHardDown="",t.pictGumHardLeft="",t.pictGumHardRight="",t.pictGumHardUp="",t.pictGumMediumDown="";t.pictGumMediumLeft="",t.pictGumMediumRight="",t.pictGumMediumUp="",t.pictGumSoftDown="",t.pictGumSoftLeft="",t.pictGumSoftRight="",t.pictGumSoftUp="",t.pictHalfOpen1="",t.pictHalfOpen2="",t.pictHandbell="",t.pictHiHat="",t.pictHiHatOnStand="",t.pictJawHarp="",t.pictJingleBells="",t.pictKlaxonHorn="",t.pictLeftHandCircle="",t.pictLionsRoar="",t.pictLithophone="",t.pictLogDrum="",t.pictLotusFlute="",t.pictMar="",t.pictMarSmithBrindle="",t.pictMaraca="",t.pictMaracas="",t.pictMegaphone="",t.pictMetalPlateChimes="",t.pictMetalTubeChimes="",t.pictMusicalSaw="",t.pictNormalPosition="",t.pictOnRim="",t.pictOpen="",t.pictOpenRimShot="",t.pictPistolShot="",t.pictPoliceWhistle="",t.pictQuijada="",t.pictRainstick="",t.pictRatchet="",t.pictRecoReco="",t.pictRightHandSquare="",t.pictRim1="",t.pictRim2="",t.pictRim3="",t.pictRimShotOnStem="",t.pictSandpaperBlocks="",t.pictScrapeAroundRim="",t.pictScrapeAroundRimClockwise="",t.pictScrapeCenterToEdge="",t.pictScrapeEdgeToCenter="",t.pictShellBells="",t.pictShellChimes="",t.pictSiren="",t.pictSistrum="",t.pictSizzleCymbal="",t.pictSleighBell="",t.pictSlideBrushOnGong="",t.pictSlideWhistle="",t.pictSlitDrum="",t.pictSnareDrum="",t.pictSnareDrumMilitary="",t.pictSnareDrumSnaresOff="",t.pictSteelDrums="",t.pictStickShot="",t.pictSuperball="",t.pictSuspendedCymbal="",t.pictSwishStem="",t.pictTabla="",t.pictTamTam="",t.pictTamTamWithBeater="",t.pictTambourine="",t.pictTempleBlocks="",t.pictTenorDrum="",t.pictThundersheet="",t.pictTimbales="",t.pictTimpani="",t.pictTomTom="",t.pictTomTomChinese="",t.pictTomTomIndoAmerican="",t.pictTomTomJapanese="",t.pictTriangle="",t.pictTubaphone="",t.pictTubularBells="",t.pictTurnLeftStem="",t.pictTurnRightLeftStem="",t.pictTurnRightStem="",t.pictVib="",t.pictVibMotorOff="",t.pictVibSmithBrindle="",t.pictVibraslap="",t.pictVietnameseHat="",t.pictWhip="",t.pictWindChimesGlass="",t.pictWindMachine="",t.pictWindWhistle="",t.pictWoodBlock="",t.pictWoundHardDown="",t.pictWoundHardLeft="",t.pictWoundHardRight="",t.pictWoundHardUp="",t.pictWoundSoftDown="",t.pictWoundSoftLeft="",t.pictWoundSoftRight="",t.pictWoundSoftUp="",t.pictXyl="",t.pictXylBass="",t.pictXylSmithBrindle="",t.pictXylTenor="",t.pictXylTenorTrough="",t.pictXylTrough="",t.pluckedBuzzPizzicato="",t.pluckedDamp="",t.pluckedDampAll="",t.pluckedDampOnStem="",t.pluckedFingernailFlick="",t.pluckedLeftHandPizzicato="",t.pluckedPlectrum="",t.pluckedSnapPizzicatoAbove="",t.pluckedSnapPizzicatoBelow="",t.pluckedWithFingernails="",t.quindicesima="",t.quindicesimaAlta="",t.quindicesimaBassa="",t.quindicesimaBassaMb="",t.repeat1Bar="",t.repeat2Bars="",t.repeat4Bars="",t.repeatBarLowerDot="",t.repeatBarSlash="",t.repeatBarUpperDot="",t.repeatDot="",t.repeatDots="",t.repeatLeft="",t.repeatRight="",t.repeatRightLeft="",t.rest1024th="",t.rest128th="",t.rest16th="",t.rest256th="",t.rest32nd="",t.rest512th="",t.rest64th="",t.rest8th="",t.restDoubleWhole="",t.restDoubleWholeLegerLine="",t.restHBar="",t.restHBarLeft="",t.restHBarMiddle="",t.restHBarRight="",t.restHalf="",t.restHalfLegerLine="",t.restLonga="",t.restMaxima="",t.restQuarter="",t.restQuarterOld="",t.restQuarterZ="",t.restWhole="",t.restWholeLegerLine="",t.reversedBrace="",t.reversedBracketBottom="",t.reversedBracketTop="",t.rightRepeatSmall="",t.scaleDegree1="",t.scaleDegree2="",t.scaleDegree3="",t.scaleDegree4="",t.scaleDegree5="",t.scaleDegree6="",t.scaleDegree7="",t.scaleDegree8="",t.scaleDegree9="",t.schaefferClef="",t.schaefferFClefToGClef="",t.schaefferGClefToFClef="",t.schaefferPreviousClef="",t.segno="",t.segnoSerpent1="",t.segnoSerpent2="",t.semipitchedPercussionClef1="",t.semipitchedPercussionClef2="",t.smnFlat="",t.smnFlatWhite="",t.smnHistoryDoubleFlat="",t.smnHistoryDoubleSharp="",t.smnHistoryFlat="",t.smnHistorySharp="",t.smnNatural="",t.smnSharp="",t.smnSharpDown="",t.smnSharpWhite="",t.smnSharpWhiteDown="",t.splitBarDivider="",t.staff1Line="",t.staff1LineNarrow="",t.staff1LineWide="",t.staff2Lines="",t.staff2LinesNarrow="",t.staff2LinesWide="",t.staff3Lines="",t.staff3LinesNarrow="",t.staff3LinesWide="",t.staff4Lines="",t.staff4LinesNarrow="",t.staff4LinesWide="",t.staff5Lines="",t.staff5LinesNarrow="",t.staff5LinesWide="",t.staff6Lines="",t.staff6LinesNarrow="",t.staff6LinesWide="",t.staffDivideArrowDown="",t.staffDivideArrowUp="",t.staffDivideArrowUpDown="",t.staffPosLower1="",t.staffPosLower2="",t.staffPosLower3="",t.staffPosLower4="",t.staffPosLower5="",t.staffPosLower6="",t.staffPosLower7="",t.staffPosLower8="",t.staffPosRaise1="",t.staffPosRaise2="",t.staffPosRaise3="",t.staffPosRaise4="",t.staffPosRaise5="",t.staffPosRaise6="",t.staffPosRaise7="",t.staffPosRaise8="",t.stem="",t.stemBowOnBridge="",t.stemBowOnTailpiece="",t.stemBuzzRoll="",t.stemDamp="",t.stemHarpStringNoise="",t.stemMultiphonicsBlack="",t.stemMultiphonicsBlackWhite="",t.stemMultiphonicsWhite="",t.stemPendereckiTremolo="",t.stemRimShot="",t.stemSprechgesang="",t.stemSulPonticello="",t.stemSussurando="",t.stemSwished="",t.stemVibratoPulse="",t.stockhausenTremolo="",t.stringsBowBehindBridge="",t.stringsBowBehindBridgeFourStrings="",t.stringsBowBehindBridgeOneString="",t.stringsBowBehindBridgeThreeStrings="",t.stringsBowBehindBridgeTwoStrings="",t.stringsBowOnBridge="",t.stringsBowOnTailpiece="",t.stringsChangeBowDirection="",t.stringsDownBow="",t.stringsDownBowAwayFromBody="",t.stringsDownBowBeyondBridge="",t.stringsDownBowTowardsBody="",t.stringsDownBowTurned="",t.stringsFouette="",t.stringsHalfHarmonic="",t.stringsHarmonic="",t.stringsJeteAbove="",t.stringsJeteBelow="",t.stringsMuteOff="",t.stringsMuteOn="",t.stringsOverpressureDownBow="",t.stringsOverpressureNoDirection="",t.stringsOverpressurePossibileDownBow="",t.stringsOverpressurePossibileUpBow="",t.stringsOverpressureUpBow="",t.stringsScrapeCircularClockwise="",t.stringsScrapeCircularCounterclockwise="",t.stringsScrapeParallelInward="",t.stringsScrapeParallelOutward="",t.stringsThumbPosition="",t.stringsThumbPositionTurned="",t.stringsTripleChopInward="",t.stringsTripleChopOutward="",t.stringsUpBow="",t.stringsUpBowAwayFromBody="",t.stringsUpBowBeyondBridge="",t.stringsUpBowTowardsBody="",t.stringsUpBowTurned="",t.stringsVibratoPulse="",t.swissRudimentsNoteheadBlackDouble="",t.swissRudimentsNoteheadBlackFlam="",t.swissRudimentsNoteheadHalfDouble="",t.swissRudimentsNoteheadHalfFlam="",t.systemDivider="",t.systemDividerExtraLong="",t.systemDividerLong="",t.textAugmentationDot="",t.textBlackNoteFrac16thLongStem="",t.textBlackNoteFrac16thShortStem="",t.textBlackNoteFrac32ndLongStem="",t.textBlackNoteFrac8thLongStem="",t.textBlackNoteFrac8thShortStem="",t.textBlackNoteLongStem="",t.textBlackNoteShortStem="",t.textCont16thBeamLongStem="",t.textCont16thBeamShortStem="",t.textCont32ndBeamLongStem="",t.textCont8thBeamLongStem="",t.textCont8thBeamShortStem="",t.textHeadlessBlackNoteFrac16thLongStem="",t.textHeadlessBlackNoteFrac16thShortStem="",t.textHeadlessBlackNoteFrac32ndLongStem="",t.textHeadlessBlackNoteFrac8thLongStem="",t.textHeadlessBlackNoteFrac8thShortStem="",t.textHeadlessBlackNoteLongStem="",t.textHeadlessBlackNoteShortStem="",t.textTie="",t.textTuplet3LongStem="",t.textTuplet3ShortStem="",t.textTupletBracketEndLongStem="",t.textTupletBracketEndShortStem="",t.textTupletBracketStartLongStem="",t.textTupletBracketStartShortStem="",t.timeSig0="",t.timeSig0Reversed="",t.timeSig0Turned="",t.timeSig1="",t.timeSig1Reversed="",t.timeSig1Turned="",t.timeSig2="",t.timeSig2Reversed="",t.timeSig2Turned="",t.timeSig3="",t.timeSig3Reversed="",t.timeSig3Turned="",t.timeSig4="",t.timeSig4Reversed="",t.timeSig4Turned="",t.timeSig5="",t.timeSig5Reversed="",t.timeSig5Turned="",t.timeSig6="",t.timeSig6Reversed="",t.timeSig6Turned="",t.timeSig7="",t.timeSig7Reversed="",t.timeSig7Turned="",t.timeSig8="",t.timeSig8Reversed="",t.timeSig8Turned="",t.timeSig9="",t.timeSig9Reversed="",t.timeSig9Turned="",t.timeSigBracketLeft="",t.timeSigBracketLeftSmall="",t.timeSigBracketRight="",t.timeSigBracketRightSmall="",t.timeSigCombDenominator="",t.timeSigCombNumerator="",t.timeSigComma="",t.timeSigCommon="",t.timeSigCommonReversed="",t.timeSigCommonTurned="",t.timeSigCut2="",t.timeSigCut3="",t.timeSigCutCommon="",t.timeSigCutCommonReversed="",t.timeSigCutCommonTurned="",t.timeSigEquals="",t.timeSigFractionHalf="",t.timeSigFractionOneThird="",t.timeSigFractionQuarter="",t.timeSigFractionThreeQuarters="",t.timeSigFractionTwoThirds="",t.timeSigFractionalSlash="",t.timeSigMinus="",t.timeSigMultiply="",t.timeSigOpenPenderecki="",t.timeSigParensLeft="",t.timeSigParensLeftSmall="",t.timeSigParensRight="",t.timeSigParensRightSmall="",t.timeSigPlus="",t.timeSigPlusSmall="",t.timeSigSlash="",t.timeSigX="",t.tremolo1="",t.tremolo2="",t.tremolo3="",t.tremolo4="",t.tremolo5="",t.tremoloDivisiDots2="",t.tremoloDivisiDots3="",t.tremoloDivisiDots4="",t.tremoloDivisiDots6="",t.tremoloFingered1="",t.tremoloFingered2="",t.tremoloFingered3="",t.tremoloFingered4="",t.tremoloFingered5="",t.tripleTongueAbove="",t.tripleTongueBelow="",t.tuplet0="",t.tuplet1="",t.tuplet2="",t.tuplet3="",t.tuplet4="",t.tuplet5="",t.tuplet6="",t.tuplet7="",t.tuplet8="",t.tuplet9="",t.tupletColon="",t.unmeasuredTremolo="",t.unmeasuredTremoloSimple="",t.unpitchedPercussionClef1="",t.unpitchedPercussionClef2="",t.ventiduesima="",t.ventiduesimaAlta="",t.ventiduesimaBassa="",t.ventiduesimaBassaMb="",t.vocalFingerClickStockhausen="",t.vocalHalbGesungen="",t.vocalMouthClosed="",t.vocalMouthOpen="",t.vocalMouthPursed="",t.vocalMouthSlightlyOpen="",t.vocalMouthWideOpen="",t.vocalNasalVoice="",t.vocalSprechgesang="",t.vocalTongueClickStockhausen="",t.vocalTongueFingerClickStockhausen="",t.vocalsSussurando="",t.wiggleArpeggiatoDown="",t.wiggleArpeggiatoDownArrow="",t.wiggleArpeggiatoDownSwash="",t.wiggleArpeggiatoUp="",t.wiggleArpeggiatoUpArrow="",t.wiggleArpeggiatoUpSwash="",t.wiggleCircular="",t.wiggleCircularConstant="",t.wiggleCircularConstantFlipped="",t.wiggleCircularConstantFlippedLarge="",t.wiggleCircularConstantLarge="",t.wiggleCircularEnd="",t.wiggleCircularLarge="",t.wiggleCircularLarger="",t.wiggleCircularLargerStill="",t.wiggleCircularLargest="",t.wiggleCircularSmall="",t.wiggleCircularStart="",t.wiggleGlissando="",t.wiggleGlissandoGroup1="",t.wiggleGlissandoGroup2="",t.wiggleGlissandoGroup3="",t.wiggleRandom1="",t.wiggleRandom2="",t.wiggleRandom3="",t.wiggleRandom4="",t.wiggleSawtooth="",t.wiggleSawtoothNarrow="",t.wiggleSawtoothWide="",t.wiggleSquareWave="",t.wiggleSquareWaveNarrow="",t.wiggleSquareWaveWide="",t.wiggleTrill="",t.wiggleTrillFast="",t.wiggleTrillFaster="",t.wiggleTrillFasterStill="",t.wiggleTrillFastest="",t.wiggleTrillSlow="",t.wiggleTrillSlower="",t.wiggleTrillSlowerStill="",t.wiggleTrillSlowest="",t.wiggleVIbratoLargestSlower="",t.wiggleVIbratoMediumSlower="",t.wiggleVibrato="",t.wiggleVibratoLargeFast="",t.wiggleVibratoLargeFaster="",t.wiggleVibratoLargeFasterStill="",t.wiggleVibratoLargeFastest="",t.wiggleVibratoLargeSlow="",t.wiggleVibratoLargeSlower="",t.wiggleVibratoLargeSlowest="",t.wiggleVibratoLargestFast="",t.wiggleVibratoLargestFaster="",t.wiggleVibratoLargestFasterStill="",t.wiggleVibratoLargestFastest="",t.wiggleVibratoLargestSlow="",t.wiggleVibratoLargestSlowest="",t.wiggleVibratoMediumFast="",t.wiggleVibratoMediumFaster="",t.wiggleVibratoMediumFasterStill="",t.wiggleVibratoMediumFastest="",t.wiggleVibratoMediumSlow="",t.wiggleVibratoMediumSlowest="",t.wiggleVibratoSmallFast="",t.wiggleVibratoSmallFaster="",t.wiggleVibratoSmallFasterStill="",t.wiggleVibratoSmallFastest="",t.wiggleVibratoSmallSlow="",t.wiggleVibratoSmallSlower="",t.wiggleVibratoSmallSlowest="",t.wiggleVibratoSmallestFast="",t.wiggleVibratoSmallestFaster="",t.wiggleVibratoSmallestFasterStill="",t.wiggleVibratoSmallestFastest="",t.wiggleVibratoSmallestSlow="",t.wiggleVibratoSmallestSlower="",t.wiggleVibratoSmallestSlowest="",t.wiggleVibratoStart="",t.wiggleVibratoWide="",t.wiggleWavy="",t.wiggleWavyNarrow="",t.wiggleWavyWide="",t.windClosedHole="",t.windFlatEmbouchure="",t.windHalfClosedHole1="",t.windHalfClosedHole2="",t.windHalfClosedHole3="",t.windLessRelaxedEmbouchure="",t.windLessTightEmbouchure="",t.windMouthpiecePop="",t.windMultiphonicsBlackStem="",t.windMultiphonicsBlackWhiteStem="",t.windMultiphonicsWhiteStem="",t.windOpenHole="",t.windReedPositionIn="",t.windReedPositionNormal="",t.windReedPositionOut="",t.windRelaxedEmbouchure="",t.windRimOnly="",t.windSharpEmbouchure="",t.windStrongAirPressure="",t.windThreeQuartersClosedHole="",t.windTightEmbouchure="",t.windTrillKey="",t.windVeryTightEmbouchure="",t.windWeakAirPressure=""}(I||(I={}));const G=16384,U={"1/8":131072,"1/4":65536,"1/2":32768,1:16384,2:8192,4:4096,8:2048,16:1024,32:512,64:256,128:128,256:64,512:32,1024:16},V={m:"1/8",l:"1/4",w:"1",h:"2",q:"4",b:"256"},Y=Object.assign(Object.assign({},(()=>{const t={};for(let e=1;e<=14;e++)t[`flats_${e}`]={accidental:"b",num:e},t[`sharps_${e}`]={accidental:"#",num:e};return t.flats_0={num:0},t.sharps_0={num:0},t})()),{C:{num:0},Am:{num:0},F:{accidental:"b",num:1},Dm:{accidental:"b",num:1},Bb:{accidental:"b",num:2},Gm:{accidental:"b",num:2},Eb:{accidental:"b",num:3},Cm:{accidental:"b",num:3},Ab:{accidental:"b",num:4},Fm:{accidental:"b",num:4},Db:{accidental:"b",num:5},Bbm:{accidental:"b",num:5},Gb:{accidental:"b",num:6},Ebm:{accidental:"b",num:6},Cb:{accidental:"b",num:7},Abm:{accidental:"b",num:7},Dbm:{accidental:"b",num:8},Gbm:{accidental:"b",num:9},G:{accidental:"#",num:1},Em:{accidental:"#",num:1},D:{accidental:"#",num:2},Bm:{accidental:"#",num:2},A:{accidental:"#",num:3},"F#m":{accidental:"#",num:3},E:{accidental:"#",num:4},"C#m":{accidental:"#",num:4},B:{accidental:"#",num:5},"G#m":{accidental:"#",num:5},"F#":{accidental:"#",num:6},"D#m":{accidental:"#",num:6},"C#":{accidental:"#",num:7},"A#m":{accidental:"#",num:7},"G#":{accidental:"#",num:8},"D#":{accidental:"#",num:9},"A#":{accidental:"#",num:10}}),X={treble:{lineShift:0},bass:{lineShift:6},tenor:{lineShift:4},alto:{lineShift:3},soprano:{lineShift:1},percussion:{lineShift:0},"mezzo-soprano":{lineShift:2},"baritone-c":{lineShift:5},"baritone-f":{lineShift:5},subbass:{lineShift:7},french:{lineShift:-1}},_={C:{index:0,intVal:0},CN:{index:0,intVal:0},"C#":{index:0,intVal:1},"C##":{index:0,intVal:2},CB:{index:0,intVal:11},CBB:{index:0,intVal:10},D:{index:1,intVal:2},DN:{index:1,intVal:2},"D#":{index:1,intVal:3},"D##":{index:1,intVal:4},DB:{index:1,intVal:1},DBB:{index:1,intVal:0},E:{index:2,intVal:4},EN:{index:2,intVal:4},"E#":{index:2,intVal:5},"E##":{index:2,intVal:6},EB:{index:2,intVal:3},EBB:{index:2,intVal:2},F:{index:3,intVal:5},FN:{index:3,intVal:5},"F#":{index:3,intVal:6},"F##":{index:3,intVal:7},FB:{index:3,intVal:4},FBB:{index:3,intVal:3},G:{index:4,intVal:7},GN:{index:4,intVal:7},"G#":{index:4,intVal:8},"G##":{index:4,intVal:9},GB:{index:4,intVal:6},GBB:{index:4,intVal:5},A:{index:5,intVal:9},AN:{index:5,intVal:9},"A#":{index:5,intVal:10},"A##":{index:5,intVal:11},AB:{index:5,intVal:8},ABB:{index:5,intVal:7},B:{index:6,intVal:11},BN:{index:6,intVal:11},"B#":{index:6,intVal:12},"B##":{index:6,intVal:13},BB:{index:6,intVal:10},BBB:{index:6,intVal:9},R:{index:6},X:{index:6}},z={"#":I.accidentalSharp,"##":I.accidentalDoubleSharp,b:I.accidentalFlat,bb:I.accidentalDoubleFlat,n:I.accidentalNatural,"{":I.accidentalParensLeft,"}":I.accidentalParensRight,db:I.accidentalThreeQuarterTonesFlatZimmermann,d:I.accidentalQuarterToneFlatStein,"++":I.accidentalThreeQuarterTonesSharpStein,"+":I.accidentalQuarterToneSharpStein,"+-":I.accidentalKucukMucennebSharp,bs:I.accidentalBakiyeFlat,bss:I.accidentalBuyukMucennebFlat,o:I.accidentalSori,k:I.accidentalKoron,bbs:I.accidentalBuyukMucennebSharp,"++-":I.accidentalBuyukMucennebSharp,ashs:I.accidentalBuyukMucennebSharp,afhf:I.accidentalBuyukMucennebSharp},j={"a.":{code:I.augmentationDot,betweenLines:!0},av:{aboveCode:I.articStaccatissimoAbove,belowCode:I.articStaccatissimoBelow,betweenLines:!0},"a>":{aboveCode:I.articAccentAbove,belowCode:I.articAccentBelow,betweenLines:!0},"a-":{aboveCode:I.articTenutoAbove,belowCode:I.articTenutoBelow,betweenLines:!0},"a^":{aboveCode:I.articMarcatoAbove,belowCode:I.articMarcatoBelow,betweenLines:!1},"a+":{code:I.pluckedLeftHandPizzicato,betweenLines:!1},ao:{aboveCode:I.pluckedSnapPizzicatoAbove,belowCode:I.pluckedSnapPizzicatoBelow,betweenLines:!1},ah:{code:I.stringsHarmonic,betweenLines:!1},"a@":{aboveCode:I.fermataAbove,belowCode:I.fermataBelow,betweenLines:!1},"a@a":{code:I.fermataAbove,betweenLines:!1},"a@u":{code:I.fermataBelow,betweenLines:!1},"a@s":{aboveCode:I.fermataShortAbove,belowCode:I.fermataShortBelow,betweenLines:!1},"a@as":{code:I.fermataShortAbove,betweenLines:!1},"a@us":{code:I.fermataShortBelow,betweenLines:!1},"a@l":{aboveCode:I.fermataLongAbove,belowCode:I.fermataLongBelow,betweenLines:!1},"a@al":{code:I.fermataLongAbove,betweenLines:!1},"a@ul":{code:I.fermataLongBelow,betweenLines:!1},"a@vl":{aboveCode:I.fermataVeryLongAbove,belowCode:I.fermataVeryLongBelow,betweenLines:!1},"a@avl":{code:I.fermataVeryLongAbove,betweenLines:!1},"a@uvl":{code:I.fermataVeryLongBelow,betweenLines:!1},"a|":{code:I.stringsUpBow,betweenLines:!1},am:{code:I.stringsDownBow,betweenLines:!1},"a,":{code:I.pictChokeCymbal,betweenLines:!1}},q={mordent:I.ornamentShortTrill,mordentInverted:I.ornamentMordent,turn:I.ornamentTurn,turnInverted:I.ornamentTurnSlash,tr:I.ornamentTrill,upprall:I.ornamentPrecompSlideTrillDAnglebert,downprall:I.ornamentPrecompDoubleCadenceUpperPrefix,prallup:I.ornamentPrecompTrillSuffixDandrieu,pralldown:I.ornamentPrecompTrillLowerSuffix,upmordent:I.ornamentPrecompSlideTrillBach,downmordent:I.ornamentPrecompDoubleCadenceUpperPrefixTurn,lineprall:I.ornamentPrecompAppoggTrill,prallprall:I.ornamentTremblement,scoop:I.brassScoop,doit:I.brassDoitMedium,fall:I.brassFallLipShort,doitLong:I.brassLiftMedium,fallLong:I.brassFallRoughMedium,bend:I.brassBend,plungerClosed:I.brassMuteClosed,plungerOpen:I.brassMuteOpen,flip:I.brassFlip,jazzTurn:I.brassJazzTurn,smear:I.brassSmear};class ${static clefProperties(t){if(!t||!(t in X))throw new p("BadArgument","Invalid clef: "+t);return X[t]}static keyProperties(t,e="treble",i="N",s){let n={octaveShift:0,duration:"4"};"object"==typeof s&&(n=Object.assign(Object.assign({},n),s));const o=$.sanitizeDuration(n.duration),a=t.split("/");if(a.length<2)throw new p("BadArguments",`First argument must be note/octave or note/octave/glyph-code: ${t}`);const r=a[0].toUpperCase();i=i.toUpperCase();const h=_[r];if(!h)throw new p("BadArguments","Invalid key name: "+r);let c=parseInt(a[1],10);c-=n.octaveShift;let l=(7*c-28+h.index)/2;l+=$.clefProperties(e).lineShift;const d=void 0!==h.intVal?12*c+h.intVal:void 0;let u="",g="N";return g=a.length>2&&a[2]?a[2].toUpperCase():"N"!==i?i:r,u=this.codeNoteHead(g,o),{key:r,octave:c,line:l,intValue:d,code:u,displaced:!1}}static integerToNote(t){if(void 0===t||t<0||t>11)throw new p("BadArguments",`integerToNote() requires an integer in the range [0, 11]: ${t}`);const e={0:"C",1:"C#",2:"D",3:"D#",4:"E",5:"F",6:"F#",7:"G",8:"G#",9:"A",10:"A#",11:"B"}[t];if(!e)throw new p("BadArguments",`Unknown note value for integer: ${t}`);return e}static textWidth(t){return 7*t.toString().length}static articulationCodes(t){return j[t]}static accidentalCodes(t){var e;return null!==(e=z[t])&&void 0!==e?e:t}static ornamentCodes(t){var e;return null!==(e=q[t])&&void 0!==e?e:t}static keySignature(t){const e=Y[t];if(!e)throw new p("BadKeySignature",`Bad key signature spec: '${t}'`);if(!e.accidental)return[];const i={b:[2,.5,2.5,1,3,1.5,3.5],"#":[0,1.5,-.5,1,2.5,.5,2]}[e.accidental],s=Math.min(e.num,7),n=Math.max(e.num-7,0);return[...i.slice(n,s).map(t=>({type:`${e.accidental}`,line:t})),...i.slice(0,n).map(t=>({type:`${e.accidental}${e.accidental}`,line:t}))]}static getKeySignatures(){return Y}static hasKeySignature(t){return t in Y}static sanitizeDuration(t){const e=V[t];if(void 0!==e&&(t=e),void 0===U[t])throw new p("BadArguments",`The provided duration is not valid: ${t}`);return t}static durationToFraction(t){return(new y).parse($.sanitizeDuration(t))}static durationToNumber(t){return $.durationToFraction(t).value()}static durationToTicks(t){t=$.sanitizeDuration(t);const e=U[t];if(void 0===e)throw new p("InvalidDuration");return e}static codeNoteHead(t,e){switch(t){case"D0":return I.noteheadDiamondWhole;case"D1":return I.noteheadDiamondHalf;case"D2":case"D3":return I.noteheadDiamondBlack;case"T0":return I.noteheadTriangleUpWhole;case"T1":return I.noteheadTriangleUpHalf;case"T2":case"T3":return I.noteheadTriangleUpBlack;case"X0":return I.noteheadXWhole;case"X1":return I.noteheadXHalf;case"X2":return I.noteheadXBlack;case"X3":return I.noteheadCircleX;case"S1":return I.noteheadSquareWhite;case"S2":return I.noteheadSquareBlack;case"R1":case"R2":return I.noteheadSquareWhite;case"DO":return I.noteheadTriangleUpBlack;case"RE":return I.noteheadMoonBlack;case"MI":return I.noteheadDiamondBlack;case"FA":return I.noteheadTriangleLeftBlack;case"FAUP":return I.noteheadTriangleRightBlack;case"SO":return I.noteheadBlack;case"LA":return I.noteheadSquareBlack;case"TI":return I.noteheadTriangleRoundDownBlack;case"DI":case"H":switch(e){case"1/2":return I.noteheadDiamondDoubleWhole;case"1":return I.noteheadDiamondWhole;case"2":return I.noteheadDiamondHalf;default:return I.noteheadDiamondBlack}case"X":case"M":switch(e){case"1/2":return I.noteheadXDoubleWhole;case"1":return I.noteheadXWhole;case"2":return I.noteheadXHalf;default:return I.noteheadXBlack}case"CX":switch(e){case"1/2":return I.noteheadCircleXDoubleWhole;case"1":return I.noteheadCircleXWhole;case"2":return I.noteheadCircleXHalf;default:return I.noteheadCircleX}case"CI":switch(e){case"1/2":return I.noteheadCircledDoubleWhole;case"1":return I.noteheadCircledWhole;case"2":return I.noteheadCircledHalf;default:return I.noteheadCircledBlack}case"SQ":switch(e){case"1/2":return I.noteheadDoubleWholeSquare;case"1":case"2":return I.noteheadSquareWhite;default:return I.noteheadSquareBlack}case"TU":switch(e){case"1/2":return I.noteheadTriangleUpDoubleWhole;case"1":return I.noteheadTriangleUpWhole;case"2":return I.noteheadTriangleUpHalf;default:return I.noteheadTriangleUpBlack}case"TD":switch(e){case"1/2":return I.noteheadTriangleDownDoubleWhole;case"1":return I.noteheadTriangleDownWhole;case"2":return I.noteheadTriangleDownHalf;default:return I.noteheadTriangleDownBlack}case"SF":switch(e){case"1/2":return I.noteheadSlashedDoubleWhole1;case"1":return I.noteheadSlashedWhole1;case"2":return I.noteheadSlashedHalf1;default:return I.noteheadSlashedBlack1}case"SB":switch(e){case"1/2":return I.noteheadSlashedDoubleWhole2;case"1":return I.noteheadSlashedWhole2;case"2":return I.noteheadSlashedHalf2;default:return I.noteheadSlashedBlack2}case"R":switch(e){case"1/8":return I.restMaxima;case"1/4":return I.restLonga;case"1/2":return I.restDoubleWhole;case"1":return I.restWhole;case"2":return I.restHalf;case"4":return I.restQuarter;case"8":return I.rest8th;case"16":return I.rest16th;case"32":return I.rest32nd;case"64":return I.rest64th;case"128":return I.rest128th;case"256":return I.rest256th;case"512":return I.rest512th;case"1024":return I.rest1024th}break;case"S":switch(e){case"1/2":return I.noteheadSlashWhiteDoubleWhole;case"1":return I.noteheadSlashWhiteWhole;case"2":return I.noteheadSlashWhiteHalf;default:return I.noteheadSlashVerticalEnds}default:switch(e){case"1/8":return I.mensuralNoteheadMaximaBlack;case"1/4":return I.mensuralNoteheadLongaBlack;case"1/2":return I.noteheadDoubleWhole;case"1":return I.noteheadWhole;case"2":return I.noteheadHalf;default:return I.noteheadBlack}}return I.null}}function K(t,e,i=!0){if("object"!=typeof t||null===t)return!1;let s=t.constructor;if(i){for(;null!==t;){if(s=t.constructor,"CATEGORY"in s&&s.CATEGORY===e)return!0;t=Object.getPrototypeOf(t)}return!1}return"CATEGORY"in s&&s.CATEGORY===e}$.UNISON=!0,$.SOFTMAX_FACTOR=10,$.STEM_WIDTH=1.5,$.STEM_HEIGHT=35,$.STAVE_LINE_THICKNESS=1,$.RENDER_PRECISION_PLACES=3,$.RESOLUTION=G,$.durationCodes={"1/8":{stem:!0},"1/4":{stem:!1},"1/2":{stem:!1},1:{stem:!1},2:{stem:!0},4:{stem:!0},8:{stem:!0,beamCount:1,stemBeamExtension:0,codeFlagUp:I.flag8thUp},16:{beamCount:2,stemBeamExtension:0,stem:!0,codeFlagUp:I.flag16thUp},32:{beamCount:3,stemBeamExtension:7.5,stem:!0,codeFlagUp:I.flag32ndUp},64:{beamCount:4,stemBeamExtension:15,stem:!0,codeFlagUp:I.flag64thUp},128:{beamCount:5,stemBeamExtension:22.5,stem:!0,codeFlagUp:I.flag128thUp},256:{beamCount:6,stemBeamExtension:25,stem:!0,codeFlagUp:I.flag256thUp},512:{beamCount:7,stemBeamExtension:27.5,stem:!0,codeFlagUp:I.flag512thUp},1024:{beamCount:8,stemBeamExtension:30,stem:!0,codeFlagUp:I.flag1024thUp}},$.NOTATION_FONT_SCALE=39,$.TABLATURE_FONT_SCALE=39,$.SLASH_NOTEHEAD_WIDTH=15,$.STAVE_LINE_DISTANCE=10,$.noteHeadStemYOffsets={[I.noteheadXBlack]:{up:.444,down:-.44},[I.noteheadXHalf]:{up:.412,down:-.412}},$.TEXT_HEIGHT_OFFSET_HACK=1,$.accidentalColumnsTable={1:{a:[1],b:[1]},2:{a:[1,2]},3:{a:[1,3,2],b:[1,2,1],secondOnBottom:[1,2,3]},4:{a:[1,3,4,2],b:[1,2,3,1],spacedOutTetrachord:[1,2,1,2]},5:{a:[1,3,5,4,2],b:[1,2,4,3,1],spacedOutPentachord:[1,2,3,2,1],verySpacedOutPentachord:[1,2,1,2,1]},6:{a:[1,3,5,6,4,2],b:[1,2,4,5,3,1],spacedOutHexachord:[1,3,2,1,3,2],verySpacedOutHexachord:[1,2,1,2,1,2]}},$.unicode={sharp:"♯",flat:"♭",natural:"♮",triangle:"△","o-with-slash":"ø",degrees:"°",circle:"○"},$.validTypes={n:{name:"note"},r:{name:"rest"},h:{name:"harmonic"},m:{name:"muted"},s:{name:"slash"},g:{name:"ghost"},d:{name:"diamond"},x:{name:"x"},ci:{name:"circled"},cx:{name:"circle x"},sf:{name:"slashed"},sb:{name:"slashed backward"},sq:{name:"square"},tu:{name:"triangle up"},td:{name:"triangle down"}},$.TIME4_4={numBeats:4,beatValue:4,resolution:G};const Q=t=>K(t,"Annotation"),J=t=>K(t,"Barline"),Z=t=>K(t,"GraceNote"),tt=t=>K(t,"Note"),et=t=>K(t,"StaveNote"),it=t=>K(t,"StemmableNote"),st=t=>K(t,"TabNote");function nt(...t){ot.DEBUG&&S("VexFlow.Accidental",t)}class ot extends W{static get CATEGORY(){return"Accidental"}static format(t,e){if(!t||0===t.length)return;const i=B.get("Accidental.noteheadAccidentalPadding"),s=e.leftShift+i,n=B.get("Accidental.accidentalSpacing"),o=B.get("Accidental.leftPadding"),a=[];let r,h=0;for(let e=0;e<t.length;++e){const i=t[e],s=i.getNote(),n=s.getStave(),o=i.checkIndex(),c=s.getKeyProps()[o];if(s!==r){for(let t=0;t<s.keys.length;++t)h=Math.max(s.getLeftDisplacedHeadPx()-s.getXShift(),h);r=s}if(n){const t=n.getSpacingBetweenLines(),e=n.getYForLine(c.line),s=Math.round(e/t*2)/2;a.push({y:e,line:s,extraXSpaceNeeded:h,accidental:i,spacingBetweenStaveLines:t})}else a.push({line:c.line,extraXSpaceNeeded:h,accidental:i})}a.sort((t,e)=>e.line-t.line);const c=[];let l=0;for(let t=0;t<a.length;t++){const e=a[t],i=e.accidental.type,s=c[c.length-1];let o;s&&(null==s?void 0:s.line)===e.line?o=s:(o={line:e.line,flatLine:!0,dblSharpLine:!0,numAcc:0,width:0,column:0},c.push(o)),"b"!==i&&"bb"!==i&&(o.flatLine=!1),"##"!==i&&(o.dblSharpLine=!1),o.numAcc++,o.width+=e.accidental.getWidth()+n,l=Math.max(e.extraXSpaceNeeded,l)}let d=0;for(let t=0;t<c.length;t++){let e=!1;const i=t;let s=t;for(;s+1<c.length&&!e;)this.checkCollision(c[s],c[s+1])?s++:e=!0;const n=t=>c[i+t],o=t=>t.map(n),a=(t,e)=>{const[i,s]=o([t,e]).map(t=>t.line);return i-s},r=(...t)=>t.map(o).every(([t,e])=>!this.checkCollision(t,e)),h=s-i+1;let l,u,g=this.checkCollision(c[i],c[s])?"a":"b";switch(h){case 3:"a"===g&&.5===a(1,2)&&.5!==a(0,1)&&(g="secondOnBottom");break;case 4:r([0,2],[1,3])&&(g="spacedOutTetrachord");break;case 5:"b"===g&&r([1,3])&&(g="spacedOutPentachord",r([0,2],[2,4])&&(g="verySpacedOutPentachord"));break;case 6:r([0,3],[1,4],[2,5])&&(g="spacedOutHexachord"),r([0,2],[2,4],[1,3],[3,5])&&(g="verySpacedOutHexachord")}if(h>=7){let e=2,i=!0;for(;!0===i;){i=!1;for(let t=0;t+e<c.length;t++)if(this.checkCollision(c[t],c[t+e])){i=!0,e++;break}}for(l=t;l<=s;l++)u=(l-t)%e+1,c[l].column=u,d=d>u?d:u}else for(l=t;l<=s;l++)u=$.accidentalColumnsTable[h][g][l-t],c[l].column=u,d=d>u?d:u;t=s}const u=[],g=[];for(let t=0;t<=d;t++)u[t]=0,g[t]=0;u[0]=s+l,g[0]=s,c.forEach(t=>{t.width>u[t.column]&&(u[t.column]=t.width)});for(let t=1;t<u.length;t++)g[t]=u[t]+g[t-1];const p=g[g.length-1];let m=0;c.forEach(t=>{let e=0;const i=m+t.numAcc;for(;m<i;m++){const i=g[t.column-1]+e+l;a[m].accidental.setXShift(i),e+=a[m].accidental.getWidth()+n,nt("Line, accCount, shift: ",t.line,m,i)}}),e.leftShift=p+o}static checkCollision(t,e){let i=e.line-t.line,s=3;i>0?(s=e.flatLine||e.dblSharpLine?2.5:3,t.dblSharpLine&&(i-=.5)):(s=t.flatLine||t.dblSharpLine?2.5:3,e.dblSharpLine&&(i-=.5));const n=Math.abs(i)<s;return nt("Line1, Line2, Collision: ",t.line,e.line,n),n}static applyAccidentals(t,e){const i=[],s={};t.forEach(t=>{const e=new y(0,1);t.getTickables().forEach(t=>{if(t.shouldIgnoreTicks())return;const n=s[e.value()];n?n.push(t):(i.push(e.value()),s[e.value()]=[t]),e.add(t.getTicks())})}),i.sort((t,e)=>t-e);const n=new H;e||(e="C");const o=n.createScaleMap(e),a={};i.forEach(t=>{const e=s[t],i=[],r=t=>{if(!et(t)||t.isRest()||t.shouldIgnoreTicks())return;const e=t;e.keys.forEach((t,s)=>{const r=n.getNoteParts(t.split("/")[0]),h=t.split("/")[1],c=r.accidental||"n",l=r.root+c;a[r.root+h]||(a[r.root+h]=o[r.root]);const d=a[r.root+h]===l,u=i.indexOf(t)>-1;if(e.getModifiers().forEach((t,i)=>{K(t,"Accidental")&&t.type==c&&t.getIndex()==s&&e.getModifiers().splice(i,1)}),!d||d&&u){a[r.root+h]=l;const n=new ot(c);e.addModifier(n,s),i.push(t)}}),e.getModifiers().forEach(t=>{K(t,"GraceNoteGroup")&&t.getGraceNotes().forEach(r)})};e.forEach(r)})}constructor(t){super(),nt("New accidental: ",t),this.type=t,this.position=W.Position.LEFT,this.cautionary=!1,this.reset()}reset(){this.text="",this.cautionary?(this.text+=$.accidentalCodes("{"),this.text+=$.accidentalCodes(this.type),this.text+=$.accidentalCodes("}"),this.fontInfo.size=B.get("Accidental.cautionary.fontSize")):(this.text+=$.accidentalCodes(this.type),this.fontInfo.size=B.get("Accidental.fontSize")),Z(this.note)&&(this.fontInfo.size=B.get("Accidental.grace.fontSize"))}setNote(t){return f(t,"ArgumentError",`Bad note value: ${t}`),this.note=t,this.reset(),this}setAsCautionary(){return this.cautionary=!0,this.reset(),this}isCautionary(){return this.cautionary}positionGlyph(){const{type:t,position:e,index:i}=this,s=this.checkAttachedNote().getModifierStartXY(e,i);this.x=s.x-this.width,this.y=s.y,nt("Rendering: ",t,s.x,s.y)}getInkBounds(){return this.positionGlyph(),this.getTextInk(this.x,this.y)}draw(){const t=this.checkContext();this.positionGlyph(),this.setRendered(),this.renderText(t,0,0)}}ot.DEBUG=!1;class at extends P{static get CATEGORY(){return"Stem"}static get UP(){return 1}static get DOWN(){return-1}static get WIDTH(){return $.STEM_WIDTH}static get HEIGHT(){return $.STEM_HEIGHT}constructor(t){var e,i,s,n,o,a,r;super(),this.stemUpYOffset=0,this.stemDownYOffset=0,this.stemUpYBaseOffset=0,this.stemDownYBaseOffset=0,this.xBegin=null!==(e=null==t?void 0:t.xBegin)&&void 0!==e?e:0,this.xEnd=null!==(i=null==t?void 0:t.xEnd)&&void 0!==i?i:0,this.yTop=null!==(s=null==t?void 0:t.yTop)&&void 0!==s?s:0,this.yBottom=null!==(n=null==t?void 0:t.yBottom)&&void 0!==n?n:0,this.stemExtension=null!==(o=null==t?void 0:t.stemExtension)&&void 0!==o?o:0,this.stemDirection=null!==(a=null==t?void 0:t.stemDirection)&&void 0!==a?a:0,this.hide=(null==t?void 0:t.hide)||!1,this.isStemlet=(null==t?void 0:t.isStemlet)||!1,this.stemletHeight=null!==(r=null==t?void 0:t.stemletHeight)&&void 0!==r?r:0,this.renderHeightAdjustment=0,this.setOptions(t)}setOptions(t){var e,i,s,n;this.stemUpYOffset=null!==(e=null==t?void 0:t.stemUpYOffset)&&void 0!==e?e:0,this.stemDownYOffset=null!==(i=null==t?void 0:t.stemDownYOffset)&&void 0!==i?i:0,this.stemUpYBaseOffset=null!==(s=null==t?void 0:t.stemUpYBaseOffset)&&void 0!==s?s:0,this.stemDownYBaseOffset=null!==(n=null==t?void 0:t.stemDownYBaseOffset)&&void 0!==n?n:0}setNoteHeadXBounds(t,e){return this.xBegin=t,this.xEnd=e,this}setDirection(t){this.stemDirection=t}setExtension(t){this.stemExtension=t}getExtension(){return this.stemExtension}setYBounds(t,e){this.yTop=t,this.yBottom=e}getHeight(){const t=this.stemDirection===at.UP?this.stemUpYOffset:this.stemDownYOffset;return(this.yBottom-this.yTop+(at.HEIGHT-t+this.stemExtension))*this.stemDirection}getExtents(){const t=this.stemDirection===at.UP,e=[this.yTop,this.yBottom],i=at.HEIGHT+this.stemExtension,s=(t?Math.min:Math.max)(...e),n=(t?Math.max:Math.min)(...e);return{topY:s+i*-this.stemDirection,baseY:n}}isVisible(){return!this.hide}setVisibility(t){return this.hide=!t,this}setStemlet(t,e){return this.isStemlet=t,this.stemletHeight=e,this}adjustHeightForFlag(){this.renderHeightAdjustment=B.get("Stem.heightAdjustmentForFlag",-3)}adjustHeightForBeam(){this.renderHeightAdjustment=-at.WIDTH/2}getSegment(t,e=this.renderHeightAdjustment){let i,s;const n=this.stemDirection;let o=0;n===at.DOWN?(i=this.xBegin,s=this.yTop+this.stemDownYOffset,o=this.stemDownYBaseOffset):(i=this.xEnd,s=this.yBottom-this.stemUpYOffset,o=this.stemUpYBaseOffset);const a=this.getHeight();!function(...t){at.DEBUG&&S("VexFlow.Stem",t)}("Rendering stem - ","Top Y: ",this.yTop,"Bottom Y: ",this.yBottom);return{x:null!=t?t:i,baseY:s-(this.isStemlet?a-this.stemletHeight*this.stemDirection:0)+o,tipY:s-a-e*n}}getBoundingBox(){const{x:t,baseY:e,tipY:i}=this.getSegment();return this.hide?new D(t,e,0,0):new D(t-at.WIDTH/2,Math.min(e,i),at.WIDTH,Math.abs(e-i))}draw(){if(this.setRendered(),this.hide)return;const t=this.checkContext(),{x:e,baseY:i,tipY:s}=this.getSegment(),n=this.getAttribute("class");t.openGroup("stem"+(n?" "+n:""),this.getAttribute("id")),t.beginPath(),t.setLineWidth(at.WIDTH),t.moveTo(e,i),t.lineTo(e,s),t.stroke(),t.closeGroup()}}var rt,ht;at.DEBUG=!1,function(t){t[t.LEFT=1]="LEFT",t[t.CENTER=2]="CENTER",t[t.RIGHT=3]="RIGHT",t[t.CENTER_STEM=4]="CENTER_STEM"}(rt||(rt={})),function(t){t[t.TOP=1]="TOP",t[t.CENTER=2]="CENTER",t[t.BOTTOM=3]="BOTTOM",t[t.CENTER_STEM=4]="CENTER_STEM"}(ht||(ht={}));class ct extends W{static get CATEGORY(){return"Annotation"}static get minAnnotationPadding(){return B.get("NoteHead.minPadding")}static format(t,e){if(!t||0===t.length)return!1;let i=0,s=0,n=0,o=0;for(let a=0;a<t.length;++a){const r=t[a];let h=(2+A.convertSizeToPixelValue(r.fontInfo.size))/$.STAVE_LINE_DISTANCE;const c=r.checkAttachedNote(),l=c.getGlyphWidth(),d=r.getWidth();r.horizontalJustification===rt.RIGHT?(n=Math.max(l,n),i=Math.max(i,d)+ct.minAnnotationPadding):r.horizontalJustification===rt.LEFT?(o=Math.max(l,o),s=Math.max(s,d)):(i=Math.max(i,d/2)+ct.minAnnotationPadding,s=Math.max(s,d/2),n=Math.max(l/2,n),o=Math.max(l/2,o));const u=c.getStave(),g=c.hasStem()?c.getStemDirection():at.UP;let p=0,m=5;if(st(c))if(c.renderOptions.drawStem){const t=c.getStem();t&&(p=Math.abs(t.getHeight())/$.STAVE_LINE_DISTANCE)}else p=0;else if(it(c)){const t=c.getStem();t&&"n"===c.getNoteType()&&(p=Math.abs(t.getHeight())/$.STAVE_LINE_DISTANCE)}if(u&&(m=u.getNumLines()),r.verticalJustification===this.VerticalJustify.TOP){let t=c.getLineNumber(!0);st(c)&&(t=m-(c.leastString()-.5)),g===at.UP&&(t+=p);t+e.topTextLine+.5<m?(r.setTextLine(m-t),h+=m-t,e.topTextLine=h):(r.setTextLine(e.topTextLine),e.topTextLine+=h)}else if(r.verticalJustification===this.VerticalJustify.BOTTOM){let t=m-c.getLineNumber();st(c)&&(t=c.greatestString()-1),g===at.DOWN&&(t+=p);const i=t+e.textLine+1;i<m?(r.setTextLine(m-i),h+=m-i,e.textLine=h):(r.setTextLine(e.textLine),e.textLine+=h)}else r.setTextLine(e.textLine)}const a=Math.min(Math.max(s-o,0),Math.max(s-e.rightShift,0)),r=Math.min(Math.max(i-n,0),Math.max(i-e.leftShift,0));return e.leftShift+=r,e.rightShift+=a,!0}constructor(t){super(),this.text=t,this.horizontalJustification=rt.CENTER,this.verticalJustification=ht.TOP}setVerticalJustification(t){return this.verticalJustification="string"==typeof t?ct.VerticalJustifyString[t]:t,this}getVerticalJustification(){return this.verticalJustification}getJustification(){return this.horizontalJustification}setJustification(t){return this.horizontalJustification="string"==typeof t?ct.HorizontalJustifyString[t]:t,this}setTextBaseline(t){if(void 0!==t&&!Number.isFinite(t))throw new p("BadArgument","Text baseline must be finite.");return this.textBaseline=t,this}computeX(){const t=this.checkAttachedNote(),e=t.getModifierStartXY(R.ABOVE,this.index),i=this.getWidth();let s;return s=this.horizontalJustification===rt.LEFT?e.x:this.horizontalJustification===rt.RIGHT?e.x-i:this.horizontalJustification===rt.CENTER?e.x-i/2:t.getStemX()-i/2,{x:s,textWidth:i}}computeY(){const t=A.convertSizeToPixelValue(this.fontInfo.size);if(void 0!==this.textBaseline)return{y:this.textBaseline,textHeight:t};const e=this.checkAttachedNote(),i=e.hasStem()?e.getStemDirection():at.UP;let s,n={},o=0;const a=e.hasStem(),r=e.checkStave();if(a&&(n=e.checkStem().getExtents(),o=r.getSpacingBetweenLines()),this.verticalJustification===ht.BOTTOM){s=e.getYs().reduce((t,e)=>t>e?t:e),s+=(this.textLine+1)*$.STAVE_LINE_DISTANCE+t,a&&i===at.DOWN&&(s=Math.max(s,n.topY+t+o*this.textLine))}else if(this.verticalJustification===ht.CENTER){const i=e.getYForTopText(this.textLine)-1;s=i+(r.getYForBottomText(this.textLine)-i)/2+t/2}else if(this.verticalJustification===ht.TOP){s=Math.min(...e.getYs())-(this.textLine+1)*$.STAVE_LINE_DISTANCE,a&&i===at.UP&&(o=n.topY<r.getTopLineTopY()?$.STAVE_LINE_DISTANCE:o,s=Math.min(s,n.topY-o*(this.textLine+1)))}else{const i=e.getStemExtents();s=i.topY+(i.baseY-i.topY)/2+t/2}return{y:s,textHeight:t}}draw(){const t=this.checkContext(),{x:e}=this.computeX(),{y:i}=this.computeY();this.setRendered();const s=this.getAttribute("class");t.openGroup("annotation"+(s?" "+s:""),this.getAttribute("id")),function(...t){ct.DEBUG&&S("VexFlow.Annotation",t)}("Rendering annotation: ",this.text,e,i),this.x=e,this.y=i,this.renderText(t,0,0),this.drawPointerRect(),t.closeGroup()}}ct.DEBUG=!1,ct.HorizontalJustify=rt,ct.HorizontalJustifyString={left:rt.LEFT,right:rt.RIGHT,center:rt.CENTER,centerStem:rt.CENTER_STEM},ct.VerticalJustify=ht,ct.VerticalJustifyString={above:ht.TOP,top:ht.TOP,below:ht.BOTTOM,bottom:ht.BOTTOM,center:ht.CENTER,centerStem:ht.CENTER_STEM};const{ABOVE:lt,BELOW:dt}=W.Position,ut=new Set(Object.values(I));function gt(t,e){return.5*t(e/.5)}function pt(t,e){return e===lt?t<=5:t>=1}function mt(t,e){return pt(t,e)?e===lt?Math.ceil:Math.floor:Math.round}const ft=t=>et(t)||Z(t);function St(t,e){const i=t.getStemDirection(),{topY:s,baseY:n}=t.getStemExtents();if(ft(t))return t.hasStem()?i===at.UP?s:n:Math.min(...t.getYs());if(st(t))return t.hasStem()&&i===at.UP?s:t.checkStave().getYForTopText(e);throw new p("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")}function xt(t,e){const i=t.getStemDirection(),{topY:s,baseY:n}=t.getStemExtents();if(ft(t))return t.hasStem()?i===at.UP?n:s:Math.max(...t.getYs());if(st(t))return t.hasStem()?i===at.UP?t.checkStave().getYForBottomText(e):s:t.checkStave().getYForBottomText(e);throw new p("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")}function wt(t,e){const i=e===lt&&t.getStemDirection()===at.UP||e===dt&&t.getStemDirection()===at.DOWN;return ft(t)?t.hasStem()&&i?.5:1:t.hasStem()&&i?1:0}class Tt extends W{static get CATEGORY(){return"Articulation"}static format(t,e){if(!t||0===t.length)return!1;let i=0;const s=(t,e,i)=>gt(mt(e,i),t.height/10+.5);t.forEach(t=>{const n=t.checkAttachedNote();i=Math.max(n.getGlyphWidth(),i);let o=5;const a=n.hasStem()?n.getStemDirection():at.UP;let r=0;if(it(n)){const t=n.getStem();t&&(r=Math.abs(t.getHeight())/$.STAVE_LINE_DISTANCE)}const h=n.getStave();if(h&&(o=h.getNumLines()),t.getPosition()===lt){let i=n.getLineNumber(!0);a===at.UP&&(i+=r);let h=s(t,e.topTextLine,lt);const c=i+e.topTextLine+.5;!t.articulation.betweenLines&&c<o&&(h+=o-c),t.setTextLine(e.topTextLine),e.topTextLine+=h,t.setOrigin(.5,1)}else if(t.getPosition()===dt){let i=Math.max(o-n.getLineNumber(),0);a===at.DOWN&&(i+=r);let h=s(t,e.textLine,dt);const c=i+e.textLine+.5;!t.articulation.betweenLines&&c<o&&(h+=o-c),t.setTextLine(e.textLine),e.textLine+=h,t.setOrigin(.5,0)}});const n=t.map(t=>t.getWidth()).reduce((t,e)=>Math.max(e,t)),o=Math.min(Math.max(n-i,0),Math.max(n-(e.leftShift+e.rightShift),0));return e.leftShift+=o/2,e.rightShift+=o/2,!0}static parseEasyScore(t){const e={staccato:"a.",tenuto:"a-",accent:"a>",fermata:"a@",marcato:"a^",staccatissimo:"av"},i=t.trim().replace(/\.(above|below|left|right)$/,"");return($.articulationCodes(i)?[t]:t.split(",")).map(t=>{var i;const s=/^(.*)\.(above|below|left|right)$/.exec(t.trim()),n=s?s[1]:t.trim(),o=Object.hasOwnProperty.call(e,n)?e[n]:n,a=Object.hasOwnProperty.call(I,o)?I[o]:o;if(!Object.hasOwnProperty.call(null!==(i=$.articulationCodes(o))&&void 0!==i?i:{},"betweenLines")&&!ut.has(a))throw new p("BadArguments",`Unknown EasyScore articulation: ${n}`);return{type:a,position:s?W.PositionString[s[2]]:void 0}})}static easyScoreHook({articulations:t},e,i){t&&Tt.parseEasyScore(t).forEach(t=>{e.addModifier(i.getFactory().Articulation(t),0)})}constructor(t){var e;super(),this.heightShift=0,this.type=t,this.position=lt,$.articulationCodes(this.type)||((null!==(e=this.type.codePointAt(0))&&void 0!==e?e:0)%2==0?this.position=lt:this.position=dt),this.articulation={betweenLines:!1},this.reset()}reset(){this.articulation=$.articulationCodes(this.type),this.articulation||(this.articulation={code:this.type,betweenLines:!1}),void 0!==this.betweenLinesOverride&&(this.articulation=Object.assign(Object.assign({},this.articulation),{betweenLines:this.betweenLinesOverride}));const t=(this.position===lt?this.articulation.aboveCode:this.articulation.belowCode)||this.articulation.code||I.null;this.text=t}setBetweenLines(t=!0){return this.betweenLinesOverride=t,this.articulation=Object.assign(Object.assign({},this.articulation),{betweenLines:t}),this}getPlacement(){const t=this.checkAttachedNote();let e=!1;const i=this.checkIndex(),{position:s,textLine:n}=this,o=this.articulation.betweenLines,a=t.checkStave(),r=a.getSpacingBetweenLines(),h=st(t),{x:c}=t.getModifierStartXY(s,i),l=!o||h,d=wt(t,s);let u={[lt]:()=>{const e=St(t,n)-(n+d)*r;return l?Math.min(a.getYForTopText(Tt.INITIAL_OFFSET),e):e},[dt]:()=>{const e=xt(t,n)+(n+d)*r;return l?Math.max(a.getYForBottomText(Tt.INITIAL_OFFSET),e):e}}[s]();if(!h){const n=s===lt?-1:1,a=t.getKeyProps()[i].line,h=(t.getYs()[i]-u)/r+Number(a),c=function(t,e,i,s){const n=gt(mt(e,i),e);if(t&&pt(n,i)&&n%1==0)return n+.5*-s;return n}(o,h,s,n);e=pt(c,s),u+=Math.abs(c-h)*r*n}return{x:c,y:u,centered:e}}getInkBounds(){const{x:t,y:e,centered:i}=this.getPlacement(),s=this.getTextInk(t,e);return i&&(s.x+=-this.width/2-this.xShift,s.y=e-this.height/2),s}draw(){const t=this.checkContext(),{x:e,y:i,centered:s}=this.getPlacement();s&&this.setOrigin(.5,.5),this.setRendered(),function(...t){Tt.DEBUG&&S("VexFlow.Articulation",t)}(`Rendering articulation at (x: ${e}, y: ${i})`),this.x=e,this.y=i,this.renderText(t,0,0)}}Tt.DEBUG=!1,Tt.INITIAL_OFFSET=-.5;class bt{constructor(){this.defaultStyle={}}setDefaultStyle(t){return this.defaultStyle=Object.assign({},t),this}getDefaultStyle(){return Object.assign({},this.defaultStyle)}static get CATEGORY(){return"RenderContext"}set font(t){this.setFont(t)}get font(){return this.getFont()}}class yt extends P{static get CATEGORY(){return"Tickable"}constructor(){super(),this._preFormatted=!1,this._postFormatted=!1,this.ticks=new y(0,1),this.intrinsicTicks=0,this.tickMultiplier=new y(1,1),this.modifiers=[],this.tupletStack=[],this.alignCenter=!1,this.centerXShift=0,this.ignoreTicks=!1,this.formatterMetrics={freedom:{left:0,right:0},duration:"",iterations:0,space:{used:0,mean:0,deviation:0}}}reset(){return this}getTicks(){return this.ticks}shouldIgnoreTicks(){return this.ignoreTicks}setIgnoreTicks(t){var e;return this.ignoreTicks=t,null===(e=this.voice)||void 0===e||e.invalidateTicks(),this}getWidth(){if(!this._preFormatted)throw new p("UnformattedNote","Can't call GetWidth on an unformatted note.");return this.width+(this.modifierContext?this.modifierContext.getWidth():0)}getX(){return this.checkTickContext("Can't getX() without a TickContext.").getX()+this.xShift}getFormatterMetrics(){return this.formatterMetrics}getCenterXShift(){return this.isCenterAligned()?this.centerXShift:0}setCenterXShift(t){return this.centerXShift=t,this}isCenterAligned(){return this.alignCenter}setCenterAlignment(t){return this.alignCenter=t,this}getVoice(){return f(this.voice,"NoVoice","Tickable has no voice.")}setVoice(t){this.voice=t}clearVoice(){return this.voice=void 0,this.preFormatted=!1,this}getTuplet(){return this.tupletStack.at(-1)}getTupletStack(){return this.tupletStack}removeTuplet(t){const e=this.tupletStack.indexOf(t);if(-1===e)throw new p("BadArguments","Tuplet is not found in this tickable");this.tupletStack.splice(e,1);const i=t.getNoteCount(),s=t.getNotesOccupied();return this.applyTickMultiplier(i,s),this}clearTuplets(){var t;return this.tupletStack.length?(this.tupletStack=[],this.tickMultiplier=new y(1,1),this.ticks=new y(this.intrinsicTicks,1),null===(t=this.voice)||void 0===t||t.invalidateTicks(),this):this}resetTuplet(t){if(t)try{this.removeTuplet(t)}catch(t){}else this.clearTuplets();return this}setTuplet(t){return this.tupletStack.length&&this.clearTuplets(),this.addTuplet(t)}addTuplet(t){if(this.tupletStack.includes(t))return this;this.tupletStack.push(t);const e=t.getNoteCount(),i=t.getNotesOccupied();return this.applyTickMultiplier(i,e),this}setTupletStack(t){this.clearTuplets();for(const e of t)this.addTuplet(e);return this}addToModifierContext(t){this.modifierContext=t;for(let t=0;t<this.modifiers.length;++t)this.modifierContext.addMember(this.modifiers[t]);return this.modifierContext.addMember(this),this._preFormatted=!1,this}addModifier(t,e=0){return this.modifiers.push(t),this._preFormatted=!1,this}getModifiers(){return this.modifiers}setTickContext(t){this.tickContext=t,this._preFormatted=!1}checkTickContext(t="Tickable has no tick context."){return f(this.tickContext,"NoTickContext",t)}preFormat(){this._preFormatted||(this.width=0,this.modifierContext&&(this.modifierContext.preFormat(),this.width+=this.modifierContext.getWidth()))}set preFormatted(t){this._preFormatted=t}get preFormatted(){return this._preFormatted}postFormat(){return this._postFormatted||(this._postFormatted=!0),this}set postFormatted(t){this._postFormatted=t}get postFormatted(){return this._postFormatted}getIntrinsicTicks(){return this.intrinsicTicks}setIntrinsicTicks(t){var e;this.intrinsicTicks=t,this.ticks=this.tickMultiplier.clone().multiply(this.intrinsicTicks),null===(e=this.voice)||void 0===e||e.invalidateTicks()}getTickMultiplier(){return this.tickMultiplier}applyTickMultiplier(t,e){var i;this.tickMultiplier.multiply(t,e),this.ticks=this.tickMultiplier.clone().multiply(this.intrinsicTicks),null===(i=this.voice)||void 0===i||i.invalidateTicks()}setDuration(t){var e;const i=t.numerator*($.RESOLUTION/t.denominator);this.ticks=this.tickMultiplier.clone().multiply(i),this.intrinsicTicks=i,null===(e=this.voice)||void 0===e||e.invalidateTicks()}getAbsoluteX(){return this.checkTickContext("Can't getAbsoluteX() without a TickContext.").getX()}setModifierContext(t){return this.modifierContext=t,this}getModifierContext(){return this.modifierContext}checkModifierContext(){return f(this.modifierContext,"NoModifierContext","No modifier context attached to this tickable.")}}class vt extends yt{static get CATEGORY(){return"Note"}static getGlyphProps(t,e="n"){t=$.sanitizeDuration(t);let i=$.durationCodes[t];void 0===i&&(i=$.durationCodes[4]);const s=$.codeNoteHead(e.toUpperCase(),t);return s!==I.null&&(i=Object.assign(Object.assign({},i),{codeHead:s})),i}static plotMetrics(t,e,i){var s;const n=e.getMetrics(),o=e.getAbsoluteX()-n.modLeftPx-n.leftDisplacedHeadPx,a=e.getAbsoluteX()-n.leftDisplacedHeadPx,r=e.getAbsoluteX(),h=e.getAbsoluteX()+n.notePx,c=e.getAbsoluteX()+n.notePx+n.rightDisplacedHeadPx,l=e.getAbsoluteX()+n.notePx+n.rightDisplacedHeadPx+n.modRightPx,d=l+(null!==(s=e.getFormatterMetrics().freedom.right)&&void 0!==s?s:0),u=l-o;t.save(),t.setFont(B.get("fontFamily"),8),t.fillText(Math.round(u)+"px",o+e.getXShift(),i);const g=i+7;function p(i,s,n,o=g){t.beginPath(),t.setStrokeStyle(n),t.setFillStyle(n),t.setLineWidth(3),t.moveTo(i+e.getXShift(),o),t.lineTo(s+e.getXShift(),o),t.stroke()}p(o,a,"red"),p(a,r,"#999"),p(r,h,"green"),p(h,c,"#999"),p(c,l,"red"),p(l,d,"#DD0"),p(o-e.getXShift(),o,"#BBB"),function(t,e,i,s="#F55"){t.save(),t.setFillStyle(s),t.beginPath(),t.arc(e,i,3,0,2*Math.PI,!1),t.closePath(),t.fill(),t.restore()}(t,r+e.getXShift(),g,"blue");const m=e.getFormatterMetrics();if(m.iterations>0){const s=m.space.deviation,n=s>=0?"+":"";t.setFillStyle("red"),t.fillText(n+Math.round(s),r+e.getXShift(),i-10)}t.restore()}static parseDuration(t){if(!t||t.length>64)return;const e=/^(\d+(?:\/\d+)?|[a-z])(d*)([nrhms]?)$/.exec(t);if(!e)return;return{duration:e[1],dots:e[2].length,type:e[3]||"n"}}static parseNoteStruct(t){const e=vt.parseDuration(t.duration);if(!e)return;let i=t.type;if(i&&!$.validTypes[i])return;const s=[];i||(i=e.type||"n",void 0!==t.keys&&t.keys.forEach((t,e)=>{const n=t.split("/");s[e]=n&&3===n.length?n[2]:i}));let n=$.durationToTicks(e.duration);if(!n)return;const o=t.dots?t.dots:e.dots;if("number"!=typeof o)return;let a=n;for(let t=0;t<o;t++){if(a<=1)return;a/=2,n+=a}return{duration:e.duration,type:i,customTypes:s,dots:o,ticks:n}}constructor(t){if(super(),!t)throw new p("BadArguments","Note must have valid initialization data to identify duration and type.");const e=vt.parseNoteStruct(t);if(!e)throw new p("BadArguments",`Invalid note initialization object: ${JSON.stringify(t)}`);this.keys=t.keys||[],this.keyProps=[],this.duration=e.duration,this.noteType=e.type,this.customTypes=e.customTypes,t.durationOverride?this.setDuration(t.durationOverride):this.setIntrinsicTicks(e.ticks),this.modifiers=[],this.glyphProps=vt.getGlyphProps(this.duration,this.noteType),this.customGlyphs=this.customTypes.map(t=>vt.getGlyphProps(this.duration,t)),this.playNote=void 0,this.ignoreTicks=!1,this.width=0,this.leftDisplacedHeadPx=0,this.rightDisplacedHeadPx=0,this.xShift=0,this.ys=[],t.alignCenter&&this.setCenterAlignment(t.alignCenter),this.renderOptions={annotationSpacing:5,strokePx:1,yShift:0}}getPlayNote(){return this.playNote}setPlayNote(t){return this.playNote=t,this}isRest(){return!1}addStroke(t,e){return e.setNote(this),e.setIndex(t),this.modifiers.push(e),this.preFormatted=!1,this}getStave(){return this.stave}clearStave(){return this.stave=void 0,this.preFormatted=!1,this}checkStave(){return f(this.stave,"NoStave","No stave attached to instance.")}setStave(t){return this.stave=t,this.setYs([t.getYForLine(0)]),this.setContext(this.stave.getContext()),this}getLeftDisplacedHeadPx(){return this.leftDisplacedHeadPx}getRightDisplacedHeadPx(){return this.rightDisplacedHeadPx}setLeftDisplacedHeadPx(t){return this.leftDisplacedHeadPx=t,this}setRightDisplacedHeadPx(t){return this.rightDisplacedHeadPx=t,this}shouldIgnoreTicks(){return this.ignoreTicks}getLineNumber(t){return 0}getLineForRest(){return 0}getGlyphProps(){return this.glyphProps}getGlyphWidth(){return 0}setYs(t){return this.ys=t,this}getYs(){if(0===this.ys.length)throw new p("NoYValues","No Y-values calculated for this note.");return this.ys}getYForTopText(t){return this.checkStave().getYForTopText(t)}getVoice(){if(!this.voice)throw new p("NoVoice","Note has no voice.");return this.voice}setVoice(t){return this.voice=t,this.preFormatted=!1,this}getTickContext(){return this.checkTickContext()}setTickContext(t){return this.tickContext=t,this.preFormatted=!1,this}getDuration(){return this.duration}isDotted(){return this.getModifiersByType("Dot").length>0}hasStem(){return!1}getNoteType(){return this.noteType}getBeam(){return this.beam}checkBeam(){return f(this.beam,"NoBeam","No beam attached to instance")}hasBeam(){return void 0!==this.beam}setBeam(t){return this.beam=t,this}addModifier(t,e=0){const i="Note.addModifier(modifier: Modifier, index: number=0)";if("string"==typeof e&&(e=parseInt(e),console.warn(i+" expected a number for `index`, but received a string.")),"object"!=typeof t||"number"!=typeof e)throw new p("WrongParams","Incorrect call signature. Use "+i+" instead.");return t.setNote(this),t.setIndex(e),super.addModifier(t),this}getModifiersByType(t){return this.modifiers.filter(e=>e.getCategory()===t)}getModifierStartXY(t,e,i){if(!this.preFormatted)throw new p("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");return{x:this.getAbsoluteX(),y:this.ys[0]}}getRightParenthesisPx(t){return this.getKeyProps()[t].displaced?this.getRightDisplacedHeadPx():0}getLeftParenthesisPx(t){return this.getKeyProps()[t].displaced?this.getLeftDisplacedHeadPx()-this.xShift:-this.xShift}getFirstDotPx(){let t=this.getRightDisplacedHeadPx();const e=this.checkModifierContext().getMembers("Parenthesis");return 0!==e.length&&(t+=e[0].getWidth()+1),t}getMetrics(){if(!this.preFormatted)throw new p("UnformattedNote","Can't call getMetrics on an unformatted note.");const t=this.modifierContext?this.modifierContext.getState().leftShift:0,e=this.modifierContext?this.modifierContext.getState().rightShift:0,i=this.getWidth();return{width:i,glyphWidth:this.getGlyphWidth(),notePx:i-t-e-this.leftDisplacedHeadPx-this.rightDisplacedHeadPx,modLeftPx:t,modRightPx:e,leftDisplacedHeadPx:this.leftDisplacedHeadPx,rightDisplacedHeadPx:this.rightDisplacedHeadPx,glyphPx:0}}getAbsoluteX(){let t=this.checkTickContext("Can't getAbsoluteX() without a TickContext.").getX();return this.stave&&(t+=this.stave.getNoteStartX()+B.get("Stave.padding",0)),this.isCenterAligned()&&(t+=this.getCenterXShift()),t}getStemDirection(){throw new p("NoStem","No stem attached to this note.")}getStemExtents(){throw new p("NoStem","No stem attached to this note.")}getTieRightX(){let t=this.getAbsoluteX();return t+=this.getGlyphWidth()/2,t+=-this.width/2+this.width+2,t}getTieLeftX(){let t=this.getAbsoluteX();return t+=this.getGlyphWidth()/2,t-=this.width/2+2,t}getKeys(){return this.keys}getKeyProps(){return this.keyProps}getBoundingBox(){const t=super.getBoundingBox();for(let e=0;e<this.modifiers.length;e++)t.mergeWith(this.modifiers[e].getBoundingBox());return t}}var kt,Bt,Ct;!function(t){t[t.CENTER=0]="CENTER",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.ABOVE=3]="ABOVE",t[t.BELOW=4]="BELOW",t[t.BEGIN=5]="BEGIN",t[t.END=6]="END"}(kt||(kt={}));class Dt extends P{static get CATEGORY(){return"StaveModifier"}static get Position(){return kt}constructor(){super(),this.padding=10,this.position=kt.ABOVE}getPosition(){return this.position}setPosition(t){return this.position=t,this}getStave(){return this.stave}checkStave(){return f(this.stave,"NoStave","No stave attached to instance.")}setStave(t){return this.stave=t,this}getPadding(t){return void 0!==t&&t<2?0:this.padding}setPadding(t){return this.padding=t,this}setLayoutMetrics(t){return this.layoutMetrics=t,this}getLayoutMetrics(){return this.layoutMetrics}}!function(t){t[t.SINGLE=1]="SINGLE",t[t.DOUBLE=2]="DOUBLE",t[t.END=3]="END",t[t.REPEAT_BEGIN=4]="REPEAT_BEGIN",t[t.REPEAT_END=5]="REPEAT_END",t[t.REPEAT_BOTH=6]="REPEAT_BOTH",t[t.NONE=7]="NONE"}(Bt||(Bt={})),function(t){t[t.NONE=0]="NONE",t[t.STRAIGHT=1]="STRAIGHT",t[t.CURVED=2]="CURVED"}(Ct||(Ct={}));class Et extends Dt{static get CATEGORY(){return"Barline"}static get type(){return Bt}static get typeString(){return{single:Bt.SINGLE,double:Bt.DOUBLE,end:Bt.END,repeatBegin:Bt.REPEAT_BEGIN,repeatEnd:Bt.REPEAT_END,repeatBoth:Bt.REPEAT_BOTH,none:Bt.NONE}}constructor(t){super(),this.repeatBrackets=Ct.NONE,this.thickness=$.STAVE_LINE_THICKNESS;const e=Bt;this.widths={},this.widths[e.SINGLE]=5,this.widths[e.DOUBLE]=5,this.widths[e.END]=5,this.widths[e.REPEAT_BEGIN]=5,this.widths[e.REPEAT_END]=5,this.widths[e.REPEAT_BOTH]=5,this.widths[e.NONE]=5,this.paddings={},this.paddings[e.SINGLE]=0,this.paddings[e.DOUBLE]=0,this.paddings[e.END]=0,this.paddings[e.REPEAT_BEGIN]=15,this.paddings[e.REPEAT_END]=15,this.paddings[e.REPEAT_BOTH]=15,this.paddings[e.NONE]=0,this.layoutMetricsMap={},this.layoutMetricsMap[e.SINGLE]={xMin:0,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[e.DOUBLE]={xMin:-3,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[e.END]={xMin:-5,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[e.REPEAT_END]={xMin:-10,xMax:1,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[e.REPEAT_BEGIN]={xMin:-2,xMax:10,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[e.REPEAT_BOTH]={xMin:-10,xMax:10,paddingLeft:5,paddingRight:5},this.layoutMetricsMap[e.NONE]={xMin:0,xMax:0,paddingLeft:5,paddingRight:5},this.setPosition(kt.BEGIN),this.setType(t)}setRepeatBracket(t){this.repeatBrackets=t}getRepeatBrackets(){return this.repeatBrackets}getType(){return this.type}setType(t){return this.type="string"==typeof t?Et.typeString[t]:t,this.setWidth(this.widths[this.type]),this.setPadding(this.paddings[this.type]),this.setLayoutMetrics(this.layoutMetricsMap[this.type]),this}draw(){const t=this.checkStave(),e=t.checkContext();this.setRendered();const i=this.getAttribute("class");switch(e.openGroup("stavebarline"+(i?" "+i:""),this.getAttribute("id")),this.type){case Bt.SINGLE:this.drawVerticalBar(t,this.x,!1);break;case Bt.DOUBLE:this.drawVerticalBar(t,this.x,!0);break;case Bt.END:this.drawVerticalEndBar(t,this.x);break;case Bt.REPEAT_BEGIN:this.drawRepeatBar(t,this.x,!0),t.getX()!==this.x&&this.drawVerticalBar(t,t.getX());break;case Bt.REPEAT_END:this.drawRepeatBar(t,this.x,!1);break;case Bt.REPEAT_BOTH:this.drawRepeatBar(t,this.x,!1),this.drawRepeatBar(t,this.x,!0)}this.drawPointerRect(),e.closeGroup()}drawVerticalBar(t,e,i){const s=t.checkContext(),n=t.getTopLineTopY(),o=t.getBottomLineBottomY();i&&s.fillRect(e-3,n,1,o-n),s.fillRect(e,n,1,o-n)}drawVerticalEndBar(t,e){const i=t.checkContext(),s=t.getTopLineTopY(),n=t.getBottomLineBottomY();i.fillRect(e-5,s,1,n-s),i.fillRect(e-2,s,3,n-s)}drawStraightBrackets(t,e,i,s,n){const o=t.checkContext(),a=Math.round(1.5*$.STAVE_LINE_DISTANCE)*n,r=Math.round(.6*$.STAVE_LINE_DISTANCE),h=Math.round(r/2),c=i+s,l=n>0?e-2:e;o.moveTo(l,c),o.lineTo(l,c+r*(-1*s)),o.lineTo(l+a,c+r*s),o.lineTo(l+a,c+s*(r+h)),o.lineTo(l,c),o.fill()}drawCurvedBrackets(t,e,i,s,n){const o=t.checkContext(),a=Math.round(1.5*$.STAVE_LINE_DISTANCE)*n,r=Math.round(.6*$.STAVE_LINE_DISTANCE),h=Math.round(r/2),c=i+s,l=n>0?e-2:e;o.moveTo(l,c),o.lineTo(l,c+r*(-1*s)),o.quadraticCurveTo(l+a/2,c+r*(-1*s),l+a,c+r*s),o.lineTo(l+a,c+s*(r+h)),o.quadraticCurveTo(l+a/2,c,l,c),o.fill()}drawRepeatBar(t,e,i){const s=t.checkContext(),n=t.getTopLineTopY(),o=t.getBottomLineBottomY();let a=3;i||(a=-5);const r=i?1:-1;s.fillRect(e+a,n,1,o-n),s.fillRect(e-2,n,3,o-n),this.repeatBrackets===Ct.CURVED?(this.drawCurvedBrackets(t,e,n,-1,r),this.drawCurvedBrackets(t,e,o,1,r)):this.repeatBrackets===Ct.STRAIGHT&&(this.drawStraightBrackets(t,e,n,-1,r),this.drawStraightBrackets(t,e,o,1,r));i?a+=4:a-=4;const h=e+a+1;let c=(t.getNumLines()-1)*t.getSpacingBetweenLines();c=c/2-t.getSpacingBetweenLines()/2;let l=n+c+1;s.beginPath(),s.arc(h,l,2,0,2*Math.PI,!1),s.fill(),l+=t.getSpacingBetweenLines(),s.beginPath(),s.arc(h,l,2,0,2*Math.PI,!1),s.fill()}}class Lt extends vt{static get CATEGORY(){return"BarNote"}constructor(t=Bt.SINGLE){super({duration:"b"}),this.metrics={widths:{}};const e=Bt;this.metrics.widths={[e.SINGLE]:8,[e.DOUBLE]:12,[e.END]:15,[e.REPEAT_BEGIN]:14,[e.REPEAT_END]:14,[e.REPEAT_BOTH]:18,[e.NONE]:0},this.ignoreTicks=!0,this.setType(t)}getType(){return this.type}setType(t){return this.type="string"==typeof t?Et.typeString[t]:t,this.setWidth(this.metrics.widths[this.type]),this}addToModifierContext(t){return this}preFormat(){return this.preFormatted=!0,this}draw(){const t=this.checkContext();!function(...t){Lt.DEBUG&&S("VexFlow.BarNote",t)}("Rendering bar line at: ",this.getAbsoluteX());const e=new Et(this.type);e.setX(this.getAbsoluteX()),e.setStave(this.checkStave()),e.setContext(t),e.drawWithStyle(),this.setRendered()}}function Nt(t){let e=0;return t.forEach(t=>{t.keyProps&&t.keyProps.forEach(t=>{e+=t.line-3})}),e>=0?at.DOWN:at.UP}Lt.DEBUG=!1;const Ot="L",At="B";class Ft extends P{static get CATEGORY(){return"Beam"}getStemDirection(){return this._stemDirection}static getDefaultBeamGroups(t){t&&"c"!==t||(t="4/4");const e={"1/2":["1/2"],"2/2":["1/2"],"3/2":["1/2"],"4/2":["1/2"],"1/4":["1/4"],"2/4":["1/4"],"3/4":["1/4"],"4/4":["1/4"],"1/8":["1/8"],"2/8":["2/8"],"3/8":["3/8"],"4/8":["2/8"],"1/16":["1/16"],"2/16":["2/16"],"3/16":["3/16"],"4/16":["2/16"]}[t];if(void 0!==e)return e.map(t=>(new y).parse(t));{const e=parseInt(t.split("/")[0],10),i=parseInt(t.split("/")[1],10);if(e%3==0)return[new y(3,i)];if(i>4)return[new y(2,i)];if(i<=4)return[new y(1,i)]}return[new y(1,4)]}static applyAndGetBeams(t,e,i){return Ft.generateBeams(t.getTickables(),{groups:i,stemDirection:e})}static generateBeams(t,e={}){e.groups&&e.groups.length||(e.groups=[new y(2,8)]);const i=e.groups.map(t=>{if(!t.multiply)throw new p("InvalidBeamGroups","The beam groups must be an array of VexFlow.Fractions");return t.clone().multiply($.RESOLUTION,1)}),s=t;let n=0,o=[],a=[];function r(){i.length-1>n?n+=1:n=0}!function(){let t=[],e=new y(0,1);s.forEach(s=>{if(t=[],s.shouldIgnoreTicks())return o.push(a),void(a=t);a.push(s);const h=i[n].clone(),c=function(t){return t.reduce((t,e)=>e.getTicks().clone().add(t),new y(0,1))}(a).add(e),l=$.durationToNumber(s.getDuration())<8;if(l&&s.getTuplet()&&(h.numerator*=2),c.greaterThan(h)){if(!l){const e=a.pop();e&&t.push(e)}o.push(a);do{e=c.subtract(i[n]),r()}while(e.greaterThanEquals(i[n]));a=t}else c.equals(h)&&(o.push(a),e=new y(0,1),a=t,r())}),a.length>0&&o.push(a)}(),function(){const t=[];o.forEach(i=>{let s=[];i.forEach((i,n,o)=>{const a=0===n||n===o.length-1,r=o[n-1],h=!e.beamRests&&i.isRest(),c=e.beamRests&&e.beamMiddleOnly&&i.isRest()&&a;let l=!1;if(e.maintainStemDirections&&r&&!i.isRest()&&!r.isRest()){const t=r.getStemDirection();l=i.getStemDirection()!==t}const d=parseInt(i.getDuration(),10)<8;h||c||l||d?(s.length>0&&t.push(s),s=l?[i]:[]):s.push(i)}),s.length>0&&t.push(s)}),o=t}(),o.forEach(t=>{if("preserve"===e.stemPolicy)return;if("explicit"===e.stemPolicy){const e=new Set(t.filter(t=>!t.isRest()&&!t.isAutoStem()).map(t=>t.getStemDirection()));if(e.size>1)return;const i=e.size?[...e][0]:Nt(t);return void t.filter(t=>t.isAutoStem()).forEach(t=>t.setStemDirection(i,!0))}let i;if(e.maintainStemDirections){const e=function(t){for(let e=0;e<t.length;e++){const i=t[e];if(!i.isRest())return i}return!1}(t);i=e?e.getStemDirection():at.UP}else i=e.stemDirection?e.stemDirection:Nt(t);!function(t,i){t.forEach(t=>{t.setStemDirection(i,void 0===e.stemDirection&&t.isAutoStem())})}(t,i)});const h=o.filter(t=>{if(t.length>1){let e=!0;return t.forEach(t=>{t.getIntrinsicTicks()>=$.durationToTicks("4")&&(e=!1)}),e}return!1}),c=function(){const t=[];return o.forEach(e=>{let i;e.forEach(e=>{const s=e.getTuplet();s&&i!==s&&(i=s,t.push(i))})}),t}(),l=[];return h.forEach(t=>{const i=new Ft(t);e.showStemlets&&(i.renderOptions.showStemlets=!0),e.secondaryBreaks&&(i.renderOptions.secondaryBreakTicks=$.durationToTicks(e.secondaryBreaks)),!0===e.flatBeams&&(i.renderOptions.flatBeams=!0,i.renderOptions.flatBeamOffset=e.flatBeamOffset),l.push(i)}),c.forEach(t=>{const e=t.notes[0].stemDirection===at.DOWN?-1:1;t.setTupletLocation(e);let i=!1;for(let e=0;e<t.notes.length;e++){if(!t.notes[e].hasBeam()){i=!0;break}}t.setBracketed(i)}),l}constructor(t,e=!1){if(super(),this.slope=0,this.yShift=0,this.fittedStems=[],this.forcedPartialDirections={},!t||0===t.length)throw new p("BadArguments","No notes provided for beam.");if(1===t.length)throw new p("BadArguments","Too few notes for beam.");if(this._ticks=t[0].getIntrinsicTicks(),this._ticks>=$.durationToTicks("4"))throw new p("BadArguments","Beams can only be applied to notes shorter than a quarter note.");let i,s;this._stemDirection=t[0].getStemDirection();let n=this._stemDirection;if(e&&et(t[0]))n=Nt(t);else if(e&&st(t[0])){const e=t.reduce((t,e)=>t+e.getStemDirection(),0);n=e>-1?at.UP:at.DOWN}for(i=0;i<t.length;++i)s=t[i],e&&(s.setStemDirection(n,!0),this._stemDirection=n),s.setBeam(this);this.postFormatted=!1,this.notes=t,this._beamCount=this.getBeamCount(),this.breakOnIndexes=[],this.renderOptions={beamWidth:5,maxSlope:.25,minSlope:-.25,slopeIterations:20,slopeCost:100,showStemlets:!1,stemletExtension:7,partialBeamLength:10,flatBeams:!1,minFlatBeamOffset:15};const o=t[0],a=et(o)?o.engraving:void 0;if(a){let t;Object.defineProperty(this.renderOptions,"beamWidth",{enumerable:!0,configurable:!0,get:()=>{var e,i;return null!=t?t:a.beamThickness*(null!==(i=null===(e=o.getStave())||void 0===e?void 0:e.getSpacingBetweenLines())&&void 0!==i?i:$.STAVE_LINE_DISTANCE)},set:e=>{t=e}})}}getNotes(){return this.notes}getBeamCount(){return this.notes.map(t=>t.getGlyphProps().beamCount).reduce((t,e)=>e>t?e:t)}breakSecondaryAt(t){return this.breakOnIndexes=t,this}setPartialBeamSideAt(t,e){return this.forcedPartialDirections[t]=e,this}unsetPartialBeamSideAt(t){return delete this.forcedPartialDirections[t],this}getSlopeY(t,e,i,s){return i+(t-e)*s}calculateSlope(){const{notes:t,renderOptions:{maxSlope:e,minSlope:i,slopeIterations:s,slopeCost:n}}=this,o=this._stemDirection,a=t[0],r=function(t,e){const i=t.getStemExtents().topY,s=t.getStemX();return(e.getStemExtents().topY-i)/(e.getStemX()-s)}(a,t[t.length-1]),h=(e-i)/s;let c=Number.MAX_VALUE,l=0,d=0;const u=this.renderOptions.contourSlope&&i<=0&&e>=0;for(let s=i;s<=e;s+=h){if(u&&Math.abs(s)>1e-8&&s*r<=0)continue;let e=0,i=0;for(let n=1;n<t.length;++n){const r=t[n];if(r.hasStem()||r.isRest()){const t=this.getSlopeY(r.getStemX(),a.getStemX(),a.getStemExtents().topY,s)+i,h=r.getStemExtents().topY;if(h*o<t*o){const s=Math.abs(h-t);i+=s*-o,e+=s*n}else e+=(h-t)*o}}const h=r/2,g=n*Math.abs(h-s)+Math.abs(e);g<c&&(c=g,l=s,d=i)}if(this.renderOptions.contourSlope&&Math.abs(l)<1e-8){const t=a.checkStave(),e=t.getYForLine(0),i=a.getStemExtents().topY+d,s=t.getSpacingBetweenLines()/2;if(i>=e&&i<=t.getYForLine(t.getNumLines()-1)){const t=(i-e)/s;d+=e+(o===at.UP?Math.floor(t):Math.ceil(t))*s-i}}this.slope=l,this.yShift=d}clearOtherVoiceHeads(){var t,e;const i=this.notes[0],s=i.getStave(),n=this._stemDirection;if(!s||this.notes.some(t=>t.getStave()!==s||t.getStemDirection()!==n))return;const o=i.checkTickContext(),a=this.notes[this.notes.length-1].checkTickContext(),r=(o.tContexts.length?[...o.through(a)]:this.notes.map(t=>t.checkTickContext())).flatMap(t=>t.getTickables()).filter(et).filter(t=>t.getBeam()!==this&&t.getStave()===s&&!t.isRest());if(!r.length)return;const h=i.getStemX(),c=s.getSpacingBetweenLines()*(et(i)&&null!==(e=null===(t=i.engraving)||void 0===t?void 0:t.clearance)&&void 0!==e?e:.25),l=this.renderOptions.beamWidth,d=i.getStemExtents().topY+this.yShift,u=t=>(d+(t-h)*this.slope)*-n;let g=0,p=1/0;for(const t of this.notes){const e=l*(1+1.5*(t.getGlyphProps().beamCount-1)),i=u(t.getStemX())-e;if(!et(t))return;for(const e of t.noteHeads){const t=e.getBoundingBox(),s=n===at.UP?t.getY():t.getY()+t.getH();p=Math.min(p,i-s*-n-c)}}const m=Array.from(this.getStrips(d));for(const t of r)for(const e of t.getHeadInk()){let t=-1/0,i=1/0;for(const s of m){const o=Math.max(Math.min(s.x1,s.x2),e.x),a=Math.min(Math.max(s.x1,s.x2),e.x+e.w);if(a<=o)continue;const r=(s.y1-d-(s.x1-h)*this.slope)*-n;t=Math.max(t,Math.max(u(o),u(a))+r),i=Math.min(i,Math.min(u(o),u(a))+r-l)}if(t===-1/0)continue;const s=e.y*-n,o=(e.y+e.h)*-n,a=Math.min(s,o),r=Math.max(s,o);r<=i?p=Math.min(p,i-r-c):a<=t&&r>=i&&(g=Math.max(g,t-a+c))}g<=0||(g<=p?this.yShift+=n*g:g-p<2*c&&(this.yShift+=n*((g+p)/2)))}calculateFlatSlope(){const{notes:t,renderOptions:{beamWidth:e,minFlatBeamOffset:i,flatBeamOffset:s}}=this,n=this._stemDirection;let o=0,a=0,r=0,h=0;for(let e=0;e<t.length;e++){const i=t[e],s=i.getStemExtents().topY;o+=s,n===at.DOWN&&h<s?(h=s,a=Math.max(...i.getYs()),r=i.getBeamCount()):n===at.UP&&(0===h||h>s)&&(h=s,a=Math.min(...i.getYs()),r=i.getBeamCount())}let c=o/t.length;const l=i+r*e*1.5,d=a+l*-n;n===at.DOWN&&c<d?c=a+l:n===at.UP&&c>d&&(c=a-l),s?(n===at.DOWN&&c>s||n===at.UP&&c<s)&&(this.renderOptions.flatBeamOffset=c):this.renderOptions.flatBeamOffset=c,this.slope=0,this.yShift=0}getBeamYToDraw(){let t=this.notes[0].getStemExtents().topY;return this.renderOptions.flatBeams&&this.renderOptions.flatBeamOffset&&(t=this.renderOptions.flatBeamOffset),t}applyStemExtensions(){const{notes:t,slope:e,renderOptions:{showStemlets:i,stemletExtension:s,beamWidth:n}}=this,o=this.yShift,a=this._beamCount,r=t[0],h=this.getBeamYToDraw(),c=r.getStemX();for(let r=0;r<t.length;++r){const l=t[r],d=l.getStem();if(d){const t=l.getStemX(),{topY:r}=l.getStemExtents(),u=this.getSlopeY(t,c,h,e)+o,g=d.getExtension(),p=l.getStemDirection()===at.UP?r-u:u-r;let m=0;if(l.getStemDirection()!==this._stemDirection){m=(1+1.5*(l.getGlyphProps().beamCount-1))*this.renderOptions.beamWidth}const f=g+p+m;if(this.fittedStems.push({stem:d,before:g,after:f}),d.setExtension(f),d.adjustHeightForBeam(),l.isRest()&&i){const t=(a-1)*n*1.5+n;d.setVisibility(!0).setStemlet(!0,t+s)}}}}lookupBeamDirection(t,e,i,s,n){if("4"===t)return Ot;const o=this.forcedPartialDirections[n];if(o)return o;const a=""+$.durationToNumber(t)/2,r=e<$.durationToTicks(a),h=s<$.durationToTicks(a),c=i<$.durationToTicks(a);return r&&h&&c?At:r&&!h&&c?Ot:!r&&h&&c?"R":this.lookupBeamDirection(a,e,i,s,n)}getBeamLines(t){const e=$.durationToTicks(t);let i=!1;const s=[];let n;const o=this.renderOptions.partialBeamLength;let a=!1,r=0;for(let h=0;h<this.notes.length;++h){const c=this.notes[h];r+=c.getTicks().value();let l=!1;parseInt(t,10)>=8&&(l=-1!==this.breakOnIndexes.indexOf(h),this.renderOptions.secondaryBreakTicks&&r>=this.renderOptions.secondaryBreakTicks&&(r=0,l=!0));const d=c.getIntrinsicTicks()<e,u=c.getStemX()-at.WIDTH/2,g=this.notes[h-1],p=this.notes[h+1],m=p&&p.getIntrinsicTicks()<e,f=g&&g.getIntrinsicTicks()<e,S=g&&p&&d&&!f&&!m;if(d)if(i)n=s[s.length-1],n.end=u,l&&(i=!1,p&&!m&&void 0===n.end&&(n.end=n.start-o));else{if(n={start:u,end:void 0},i=!0,S){const e=g.getIntrinsicTicks(),i=p.getIntrinsicTicks(),s=c.getIntrinsicTicks(),a=this.lookupBeamDirection(t,e,s,i,h);[Ot,At].includes(a)?n.end=n.start-o:n.end=n.start+o}else m?l&&(n.end=n.start-o,i=!1):n.end=(a||0===h)&&p?n.start+o:n.start-o;s.push(n)}else i=!1;a=l}const h=s[s.length-1];return h&&void 0===h.end&&(h.end=h.start-o),s}drawStems(t){this.notes.forEach(e=>{const i=e.getStem();if(i){const s=e.getStemX();i.setNoteHeadXBounds(s,s),i.setContext(t).drawWithStyle()}},this)}*getStrips(t=this.getBeamYToDraw()){const e=this.notes[0].getStemX(),i=this.renderOptions.beamWidth*this._stemDirection;for(const s of["4","8","16","32","64","128","256","512","1024"]){for(const{start:n,end:o}of this.getBeamLines(s)){if(void 0===o)throw new p("NoLastBeamX","lastBeamX undefined.");yield{x1:n,x2:o+1,y1:this.getSlopeY(n,e,t,this.slope),y2:this.getSlopeY(o,e,t,this.slope),thickness:i}}t+=1.5*i}}getBoundingBox(){let t;this.postFormat();for(const{x1:e,x2:i,y1:s,y2:n,thickness:o}of this.getStrips()){const a=new D(Math.min(e,i),Math.min(s,n)+Math.min(0,o),Math.abs(i-e),Math.abs(n-s)+Math.abs(o));t=t?t.mergeWith(a):a}return null!=t?t:new D(this.notes[0].getStemX(),this.getBeamYToDraw(),0,0)}drawBeamLines(t){for(const{x1:e,x2:i,y1:s,y2:n,thickness:o}of this.getStrips())t.beginPath(),t.moveTo(e,s),t.lineTo(e,s+o),t.lineTo(i,n+o),t.lineTo(i,n),t.closePath(),t.fill()}resetLayout(){if(this.postFormatted){for(const{stem:t,before:e,after:i}of this.fittedStems)t.getExtension()===i&&t.setExtension(e);this.flatOffset&&this.renderOptions.flatBeamOffset===this.flatOffset.after&&(this.renderOptions.flatBeamOffset=this.flatOffset.before),this.fittedStems.length=0,this.flatOffset=void 0,this.postFormatted=!1}}preFormat(){return this}postFormat(){if(!this.postFormatted){if(st(this.notes[0])||this.renderOptions.flatBeams){const t=this.renderOptions.flatBeamOffset;this.calculateFlatSlope(),this.flatOffset={before:t,after:this.renderOptions.flatBeamOffset}}else this.calculateSlope(),this.clearOtherVoiceHeads();this.applyStemExtensions(),this.postFormatted=!0}}draw(){const t=this.checkContext();if(this.setRendered(),this.unbeamable)return;this.postFormatted||this.postFormat();const e=this.getAttribute("class");t.openGroup("beam"+(e?" "+e:""),this.getAttribute("id")),this.drawStems(t),this.drawBeamLines(t),this.drawPointerRect(),t.closeGroup()}}class Mt extends W{static get CATEGORY(){return"Bend"}static get UP(){return 0}static get DOWN(){return 1}static format(t,e){var i;if(!t||0===t.length)return!1;const s=new Map;for(const n of t){const t=n.checkAttachedNote(),o=null!==(i=s.get(t))&&void 0!==i?i:[];o.push(n),s.set(t,o),st(t)&&(e.topTextLine=Math.max(e.topTextLine,t.leastString()-1))}let n=0;for(const[t,i]of s){if(st(t)){const e=t.getPositions();i.sort((t,i)=>e[t.checkIndex()].str-e[i.checkIndex()].str)}for(const t of i)t.setXShift(n),n=t.getWidth(),t.setTextLine(e.topTextLine)}return e.rightShift+=n,e.topTextLine+=1,!0}setStyleLine(t){return this.styleLine=t,this}getStyleLine(){return this.styleLine}constructor(t){super(),this.styleLine=B.getStyle("Bend.line"),this.xShift=0,this.tap="",this.renderOptions={bendWidth:8,releaseWidth:8},this.phrase=t,this.updateWidth()}setXShift(t){return this.xShift=t,this.updateWidth(),this}setTap(t){return this.tap=t,this}getTextHeight(){const t=new P("Bend");return t.setText(this.phrase[0].text),t.getHeight()}updateWidth(){const t=t=>{const e=new P("Bend");return e.setText(t),e.getWidth()};let e=0;for(let i=0;i<this.phrase.length;++i){const s=this.phrase[i];if(void 0!==s.width)e+=s.width;else{const i=s.type===Mt.UP?this.renderOptions.bendWidth:this.renderOptions.releaseWidth;s.width=Math.max(i,t(s.text))+3,s.drawWidth=s.width/2,e+=s.width}}return this.setWidth(e+this.xShift),this}draw(){var t,e;const i=this.checkContext(),s=this.checkAttachedNote();this.setRendered();const n=s.getModifierStartXY(W.Position.RIGHT,this.index);n.x+=3,n.y+=.5;const o=this.xShift,a=s.checkStave().getSpacingBetweenLines(),r=s.getYs().reduce((t,e)=>t<e?t:e),h=n.y-((this.textLine+1)*a+n.y-r)+3,c=n.y-((this.textLine+1)*a+n.y-r)-1,l=(t,e,s,n)=>{const o=t+s,a=e;this.applyStyle(i,this.styleLine),i.beginPath(),i.moveTo(t,e),i.quadraticCurveTo(o,a,t+s,n),i.stroke()},d=(t,e,s,n)=>{this.applyStyle(i,this.styleLine),i.beginPath(),i.moveTo(t,n),i.quadraticCurveTo(t+s,n,t+s,e),i.stroke()},u=(t,e,s)=>{const n=e+4*s;i.beginPath(),i.moveTo(t,e),i.lineTo(t-4,n),i.lineTo(t+4,n),i.closePath(),i.fill()},g=(t,e)=>{i.setFont(this.fontInfo);const s=t-i.measureText(e).width/2;i.fillText(e,s,c)};let m,f=0,S=0;if(null===(t=this.tap)||void 0===t?void 0:t.length){g(s.getModifierStartXY(W.Position.CENTER,this.index).x,this.tap)}for(let t=0;t<this.phrase.length;++t){const i=this.phrase[t],s=(null!==(e=i.drawWidth)&&void 0!==e?e:0)+(0===t?o:0);S=s+f-(1===t?o:0),i.type===Mt.UP&&(m&&m.type===Mt.UP&&u(n.x,h,1),l(n.x,n.y,S,h)),i.type===Mt.DOWN&&(m&&m.type===Mt.UP&&d(n.x,n.y,S,h),m&&m.type===Mt.DOWN&&(u(n.x,n.y,-1),d(n.x,n.y,S,h)),m||(S=s,d(n.x,n.y,S,h))),g(n.x+S,i.text),m=i,f=s,m.x=n.x,n.x+=S}if(!m||void 0===m.x)throw new p("NoLastBendForBend","Internal error.");m.type===Mt.UP?u(m.x+S,h,1):m.type===Mt.DOWN&&u(m.x+S,n.y,-1)}}function Pt(t){if(!t)return!1;const e=m();return"function"==typeof e.HTMLCanvasElement&&t instanceof e.HTMLCanvasElement||"function"==typeof t.getContext&&"function"==typeof t.toDataURL}class Rt extends bt{static get WIDTH(){return 600}static get HEIGHT(){return 400}static get CANVAS_BROWSER_SIZE_LIMIT(){return 32767}static sanitizeCanvasDims(t,e){const i=this.CANVAS_BROWSER_SIZE_LIMIT;return Math.max(t,e)>i&&(!function(...t){const e=t.join(" "),i=new Error;m().console.log("Warning: ",e,i.stack)}("Canvas dimensions exceed browser limit. Cropping to "+i),t>i&&(t=i),e>i&&(e=i)),[t,e]}constructor(t){super(),this.textHeight=0,this.context2D=t,this.curTransfrom=t.getTransform(),t.canvas?this.canvas=t.canvas:this.canvas={width:Rt.WIDTH,height:Rt.HEIGHT}}clear(){this.context2D.clearRect(0,0,this.canvas.width,this.canvas.height)}openGroup(t,e){}closeGroup(){}openRotation(t,e,i){this.curTransfrom=this.context2D.getTransform(),this.context2D.translate(e,i),this.context2D.rotate(t*Math.PI/180),this.context2D.translate(-e,-i)}closeRotation(){this.context2D.setTransform(this.curTransfrom)}add(t){}setFillStyle(t){return this.context2D.fillStyle=t,this}setBackgroundFillStyle(t){return this}setStrokeStyle(t){return this.context2D.strokeStyle=t,this}setShadowColor(t){return this.context2D.shadowColor=t,this}setShadowBlur(t){const e=this.context2D.getTransform(),i=Math.sqrt(e.a*e.a+e.b*e.b+e.c*e.c+e.d*e.d);return this.context2D.shadowBlur=i*t,this}setLineWidth(t){return this.context2D.lineWidth=t,this}setLineCap(t){return this.context2D.lineCap=t,this}setLineDash(t){return this.context2D.setLineDash(t),this}scale(t,e){return this.context2D.scale(t,e),this}resize(t,e,i){var s;const n=this.context2D.canvas,o=null!==(s=null!=i?i:m().devicePixelRatio)&&void 0!==s?s:1;return[t,e]=Rt.sanitizeCanvasDims(t*o,e*o),t=t/o|0,e=e/o|0,n.width=t*o,n.height=e*o,Pt(n)&&(n.style.width=t+"px",n.style.height=e+"px"),this.scale(o,o)}rect(t,e,i,s){return this.context2D.rect(t,e,i,s),this}fillRect(t,e,i,s){return this.context2D.fillRect(t,e,i,s),this}pointerRect(t,e,i,s){return this}clearRect(t,e,i,s){return this.context2D.clearRect(t,e,i,s),this}beginPath(){return this.context2D.beginPath(),this}moveTo(t,e){return this.context2D.moveTo(t,e),this}lineTo(t,e){return this.context2D.lineTo(t,e),this}bezierCurveTo(t,e,i,s,n,o){return this.context2D.bezierCurveTo(t,e,i,s,n,o),this}quadraticCurveTo(t,e,i,s){return this.context2D.quadraticCurveTo(t,e,i,s),this}arc(t,e,i,s,n,o){return this.context2D.arc(t,e,i,s,n,o),this}fill(){return this.context2D.fill(),this}stroke(){return this.context2D.stroke(),this}closePath(){return this.context2D.closePath(),this}measureText(t){const e=this.context2D.measureText(t);let i=0,s=0;return e.fontBoundingBoxAscent?(i=-e.fontBoundingBoxAscent,s=e.fontBoundingBoxDescent+e.fontBoundingBoxAscent):(i=-e.actualBoundingBoxAscent,s=e.actualBoundingBoxDescent+e.actualBoundingBoxAscent),{x:0,y:i,width:e.width,height:s}}fillText(t,e,i){return this.context2D.fillText(t,e,i),this}save(){return this.context2D.save(),this}restore(){return this.context2D.restore(),this}set fillStyle(t){this.context2D.fillStyle=t}get fillStyle(){return this.context2D.fillStyle}set strokeStyle(t){this.context2D.strokeStyle=t}get strokeStyle(){return this.context2D.strokeStyle}setFont(t,e,i,s){const n=A.validate(t,e,i,s);return this.context2D.font=A.toCSSString(n),this.textHeight=A.convertSizeToPixelValue(n.size),this}getFont(){return this.context2D.font}}function It(t,e){return[I.csymDiminished,I.csymHalfDiminished,I.csymMajorSeventh].flatMap(i=>[{left:"A",right:i,position:"superscript",adjustmentEm:t},{left:"F",right:i,position:"subscript",adjustmentEm:e}])}const Wt=[{textFont:"Academico",musicFont:"Bravura",pairs:It(-.18,-.12)},{textFont:"Petaluma Script",musicFont:"Petaluma",pairs:It(-.12,-.08)}];function Ht(t){return void 0===t||""===t||"normal"===t?"400":String(t)}function Gt(t){return/[\uE870-\uE87F\uED60-\uED67\uE260-\uE26F]/u.test(t)}function Ut(t){const e=[];for(const i of t){const t=Gt(i),s=e[e.length-1];(null==s?void 0:s.music)===t?s.text+=i:e.push({text:i,music:t})}return e}function Vt(t,e,i,s){var n,o;const a=Array.from(e).slice(-1)[0],r=Array.from(i)[0];return null!==(o=null===(n=t.pairs.find(t=>t.left===a&&t.right===r&&t.position===s))||void 0===n?void 0:n.adjustmentEm)&&void 0!==o?o:0}function Yt(t,e,i,s,n){var o,a;const r=A.convertSizeToPixelValue(null!==(o=e.size)&&void 0!==o?o:12),h=[];let c,l=0,d="";for(const o of function(t){const e=[];for(const i of t){if(!i.text)continue;const t=e[e.length-1];(null==t?void 0:t.position)===i.position?t.text+=i.text:e.push(Object.assign({},i))}return e}(t)){const t="baseline"!==o.position,u=t&&c&&c.position!==o.position;let g=u?c.x:l;!u&&h.length&&(g+=s.spacing*r+Vt(i,d,o.text,o.position)*r);const p=g,m="superscript"===o.position?s.superscript*r:"subscript"===o.position?s.subscript*r:0;let f="";for(const c of Ut(o.text)){f&&(g+=Vt(i,f,c.text,o.position)*r);const l=Object.assign(Object.assign({},e),{family:c.music?i.musicFont:i.textFont,size:t?A.scaleSize(null!==(a=e.size)&&void 0!==a?a:12,s.ratio):e.size}),d=n(c.text,l);h.push({text:c.text,position:o.position,font:l,x:g,y:m,metrics:d}),g+=d.width,f=c.text}l=u?Math.max(c.end,g):g,c=t&&!u?{position:o.position,x:p,end:l}:void 0,d=o.text}const u=Math.min(0,...h.map(t=>t.x-t.metrics.actualBoundingBoxLeft)),g=Math.max(l,...h.map(t=>t.x+t.metrics.actualBoundingBoxRight));for(const t of h)t.x-=u;return{runs:h,width:g-u}}function Xt(...t){Kt.DEBUG&&S("VexFlow.ChordSymbol",t)}class _t extends P{constructor(t,e,i,s,n){super(),this.text=t,this.symbolModifier=e,this.xShift=i,this.yShift=s,this.vAlign=n}isSuperscript(){return this.symbolModifier===qt.SUPERSCRIPT}isSubscript(){return this.symbolModifier===qt.SUBSCRIPT}}var zt,jt,qt,$t;!function(t){t[t.LEFT=1]="LEFT",t[t.CENTER=2]="CENTER",t[t.RIGHT=3]="RIGHT",t[t.CENTER_STEM=4]="CENTER_STEM"}(zt||(zt={})),function(t){t[t.TOP=1]="TOP",t[t.BOTTOM=2]="BOTTOM"}(jt||(jt={})),function(t){t[t.NONE=1]="NONE",t[t.SUBSCRIPT=2]="SUBSCRIPT",t[t.SUPERSCRIPT=3]="SUPERSCRIPT"}(qt||(qt={}));class Kt extends W{static get CATEGORY(){return"ChordSymbol"}static get superSubRatio(){return B.get("ChordSymbol.superSubRatio")}static get spacingBetweenBlocks(){return B.get("ChordSymbol.spacing")}static get superscriptOffset(){return B.get("ChordSymbol.superscriptOffset")}static get subscriptOffset(){return B.get("ChordSymbol.subscriptOffset")}static get minPadding(){return B.get("NoteHead.minPadding")}static format(t,e){if(!t||0===t.length)return!1;let i=0,s=0,n=0,o=0,a=0;for(const r of t){const t=r.checkAttachedNote();let h=1;const c=r.formatKerning();if(void 0!==c)i=c,r.symbolBlocks.some(t=>t.isSuperscript()||t.isSubscript())&&(h=2);else for(let t=0;t<r.symbolBlocks.length;++t){const e=r.symbolBlocks[t],s=e.isSuperscript(),n=e.isSubscript();if(e.setXShift(i),(s||n)&&(h=2),n&&t>0){const s=r.symbolBlocks[t-1];s.isSuperscript()&&(e.setXShift(i-s.getWidth()-Kt.minPadding),e.vAlign=!0,i+=-s.getWidth()-Kt.minPadding+(s.getWidth()>e.getWidth()?s.getWidth()-e.getWidth():0))}i+=e.getWidth()+Kt.minPadding}if(r.getVertical()===jt.TOP?(r.setTextLine(e.topTextLine),e.topTextLine+=h):(r.setTextLine(e.textLine+1),e.textLine+=h+1),r.getReportWidth()&&it(t)){const e=t.getGlyphWidth();r.getHorizontal()===zt.RIGHT?(o=Math.max(e,o),s=Math.max(s,i)+Kt.minPadding):r.getHorizontal()===zt.LEFT?(a=Math.max(e,a),n=Math.max(n,i)):(s=Math.max(s,i/2)+Kt.minPadding,n=Math.max(n,i/2),o=Math.max(e/2,o),a=Math.max(e/2,a))}(r.getReportWidth()||r.kernedRuns)&&(r.width=i),i=0}const r=Math.min(Math.max(n-a,0),Math.max(n-e.rightShift,0)),h=Math.min(Math.max(s-o,0),Math.max(s-e.leftShift,0));return e.leftShift+=h,e.rightShift+=r,!0}setKerning(t){if("auto"!==t&&"none"!==t)throw new p("BadArgument","Kerning must be auto or none.");return this.kerning=t,this.kernedRuns=void 0,this}getKerning(){return this.kerning}setKerningProfile(t){if(t&&(!t.textFont.trim()||!t.musicFont.trim()||t.pairs.some(t=>1!==Array.from(t.left).length||1!==Array.from(t.right).length||!["baseline","superscript","subscript"].includes(t.position)||!Number.isFinite(t.adjustmentEm))))throw new p("BadArgument","Invalid chord kerning profile.");return this.kerningProfile=t&&Object.assign(Object.assign({},t),{pairs:t.pairs.map(t=>Object.assign({},t))}),this.kernedRuns=void 0,this}formatKerning(){var t;if(this.kernedRuns=void 0,"none"===this.kerning)return;const e=function(t,e){var i;const s=(null!==(i=t.family)&&void 0!==i?i:"").split(",").map(t=>t.trim().replace(/^['"]|['"]$/g,""));return(e?[e]:Wt).find(e=>s[0]===e.textFont&&s[1]===e.musicFont&&Ht(t.weight)===Ht(e.weight)&&(t.style||"normal")===(e.style||"normal"))}(this.fontInfo,this.kerningProfile);if(!e)return;const i=null!==(t=this.kerningMeasurement)&&void 0!==t?t:this.kerningMeasurement=new P,s=Yt(this.symbolBlocks.map(t=>({text:t.getText(),position:t.isSuperscript()?"superscript":t.isSubscript()?"subscript":"baseline"})),this.fontInfo,e,{spacing:Kt.spacingBetweenBlocks,ratio:Kt.superSubRatio,superscript:Kt.superscriptOffset,subscript:Kt.subscriptOffset},(t,e)=>i.setText(t).setFont(e).measureText());return this.kernedRuns=s.runs,s.width}constructor(){super(),this.symbolBlocks=[],this.horizontal=zt.LEFT,this.vertical=jt.TOP,this.reportWidth=!0,this.kerning="none",this.kerningOrigin={x:0,y:0}}get superscriptOffset(){return Kt.superscriptOffset*A.convertSizeToPixelValue(this.fontInfo.size)}get subscriptOffset(){return Kt.subscriptOffset*A.convertSizeToPixelValue(this.fontInfo.size)}setReportWidth(t){return this.reportWidth=t,this}getReportWidth(){return this.reportWidth}getSymbolBlock(t={}){var e,i;const s=new _t(null!==(e=t.text)&&void 0!==e?e:"",null!==(i=t.symbolModifier)&&void 0!==i?i:qt.NONE,0,0,!1);if(s.isSubscript()&&s.setYShift(this.subscriptOffset),s.isSuperscript()&&s.setYShift(this.superscriptOffset),s.isSubscript()||s.isSuperscript()){const{family:t,size:e,weight:i,style:n}=this.fontInfo,o=A.scaleSize(e,Kt.superSubRatio);s.setFont(t,o,i,n)}else s.setFont(this.fontInfo);return s}addSymbolBlock(t){return this.symbolBlocks.push(this.getSymbolBlock(t)),this}addText(t,e={}){return this.addSymbolBlock(Object.assign(Object.assign({},e),{text:t}))}addTextSuperscript(t){const e=qt.SUPERSCRIPT;return this.addSymbolBlock({text:t,symbolModifier:e})}addTextSubscript(t){const e=qt.SUBSCRIPT;return this.addSymbolBlock({text:t,symbolModifier:e})}addGlyphSuperscript(t){return this.addTextSuperscript(Kt.glyphs[t])}addGlyph(t,e={}){return this.addText(Kt.glyphs[t],e)}addGlyphOrText(t,e={}){let i="";for(let e=0;e<t.length;++e){const s=t[e],n=Kt.glyphs[s];i+=n||s}return i.length>0&&this.addText(i,e),this}addLine(t={}){return this.addText("",t)}setVertical(t){return this.vertical="string"==typeof t?Kt.VerticalJustifyString[t]:t,this}getVertical(){return this.vertical}setHorizontal(t){return this.horizontal="string"==typeof t?Kt.HorizontalJustifyString[t]:t,this}getHorizontal(){return this.horizontal}draw(){const t=this.checkContext(),e=this.checkAttachedNote();this.setRendered();const i=this.getAttribute("class");t.openGroup("chordsymbol"+(i?" "+i:""),this.getAttribute("id"));const s=e.getModifierStartXY(W.Position.ABOVE,this.index);let n;t.setFont(this.fontInfo);const o=e.hasStem(),a=e.checkStave();if(this.vertical===jt.BOTTOM){if(n=a.getYForBottomText(this.textLine+$.TEXT_HEIGHT_OFFSET_HACK),o){const t=e.checkStem().getExtents(),i=a.getSpacingBetweenLines(),s=1===e.getStemDirection()?t.baseY:t.topY;n=Math.max(n,s+i*(this.textLine+2))}}else{const t=Math.min(...e.getYs());if(n=Math.min(a.getYForTopText(this.textLine),t-10),o){const t=e.checkStem().getExtents(),i=a.getSpacingBetweenLines();n=Math.min(n,t.topY-5-i*this.textLine)}}let r=s.x;if(r=this.horizontal===zt.LEFT?s.x:this.horizontal===zt.RIGHT?this.kernedRuns?s.x-this.getWidth():s.x+this.getWidth():this.horizontal===zt.CENTER?s.x-this.getWidth()/2:e.getStemX()-this.getWidth()/2,Xt("Rendering ChordSymbol: ",r,n),this.kernedRuns){this.kerningOrigin={x:r,y:n};for(const e of this.kernedRuns)t.setFont(e.font),t.fillText(e.text,r+e.x,n+e.y)}else this.symbolBlocks.forEach(e=>{Xt("Rendering Text: ",e.getText(),r+e.getXShift(),n+e.getYShift()),e.setX(r),e.setY(n),e.renderText(t,0,0)});this.drawPointerRect(),t.closeGroup()}getBoundingBox(){if(this.kernedRuns){const{x:t,y:e}=this.kerningOrigin;let i;for(const s of this.kernedRuns){const n=s.metrics,o=new D(t+s.x-n.actualBoundingBoxLeft,e+s.y-n.actualBoundingBoxAscent,n.actualBoundingBoxLeft+n.actualBoundingBoxRight,n.actualBoundingBoxAscent+n.actualBoundingBoxDescent);i?i.mergeWith(o):i=o}return null!=i?i:new D(t,e,0,0)}if(!this.symbolBlocks.length)return new D(0,0,0,0);const t=D.copy(this.symbolBlocks[0].getBoundingBox());for(let e=1;e<this.symbolBlocks.length;e++)t.mergeWith(this.symbolBlocks[e].getBoundingBox());return t}}Kt.DEBUG=!1,Kt.HorizontalJustify=zt,Kt.HorizontalJustifyString={left:zt.LEFT,right:zt.RIGHT,center:zt.CENTER,centerStem:zt.CENTER_STEM},Kt.VerticalJustify=jt,Kt.VerticalJustifyString={top:jt.TOP,above:jt.TOP,below:jt.BOTTOM,bottom:jt.BOTTOM},Kt.glyphs={diminished:I.csymDiminished,dim:I.csymDiminished,halfDiminished:I.csymHalfDiminished,"+":I.csymAugmented,augmented:I.csymAugmented,majorSeventh:I.csymMajorSeventh,minor:I.csymMinor,"-":I.csymMinor,"(":"(",leftParen:"(",")":")",rightParen:")",leftBracket:I.csymBracketLeftTall,rightBracket:I.csymBracketRightTall,leftParenTall:"(",rightParenTall:")","/":I.csymDiagonalArrangementSlash,over:I.csymDiagonalArrangementSlash,"#":I.csymAccidentalSharp,b:I.csymAccidentalFlat},Kt.symbolModifiers=qt;class Qt extends Dt{static get CATEGORY(){return"Clef"}static get types(){const{gClef:t,fClef:e,cClef:i,unpitchedPercussionClef1:s,sixStringTabClef:n}=I;return{treble:{code:t,line:3},bass:{code:e,line:1},alto:{code:i,line:2},tenor:{code:i,line:1},percussion:{code:s,line:2},soprano:{code:i,line:4},"mezzo-soprano":{code:i,line:3},"baritone-c":{code:i,line:0},"baritone-f":{code:e,line:2},subbass:{code:e,line:0},french:{code:t,line:4},tab:{code:n,line:2.5}}}constructor(t,e,i){super(),this.code=Qt.types.treble.code,this.line=Qt.types.treble.line,this.size="default",this.type="treble",this.setPosition(kt.BEGIN),this.setType(t,e,i),function(...t){Qt.DEBUG&&S("VexFlow.Clef",t)}("Creating clef:",t)}getType(){return this.type}setType(t,e="default",i){return this.type=t,this.code=Qt.types[t].code,this.line=Qt.types[t].line,this.size=null!=e?e:"default","8va"===i&&(this.code===I.gClef&&(this.code=I.gClef8va),this.code===I.fClef&&(this.code=I.fClef8va)),"8vb"===i&&(this.code===I.gClef&&(this.code=I.gClef8vb),this.code===I.fClef&&(this.code=I.fClef8vb)),this.text=this.code,this.fontInfo.size=Math.floor(Qt.getPoint(this.size)),this}static getPoint(t){return"default"===t?B.get("fontSize"):2*B.get("fontSize")/3}setStave(t){return this.stave=t,this}draw(){const t=this.checkStave(),e=t.checkContext();this.setRendered();const i=this.getAttribute("class");e.openGroup("clef"+(i?" "+i:""),this.getAttribute("id")),this.y=t.getYForLine(this.line),this.renderText(e,0,0),this.drawPointerRect(),e.closeGroup()}}Qt.DEBUG=!1;class Jt extends vt{static get CATEGORY(){return"ClefNote"}constructor(t,e="default",i){super({duration:"b"}),this.setType(t,e,i),this.ignoreTicks=!0}setType(t,e,i){return this.clef=new Qt(t,e,i),this.setWidth(this.clef.getWidth()),this}getClef(){return this.clef}preFormat(){return this.preFormatted=!0,this}draw(){const t=this.checkStave(),e=this.checkContext();this.setRendered(),this.clef.setX(this.getAbsoluteX()),this.clef.setY(t.getYForLine(this.clef.line)),this.clef.renderText(e,0,0)}getBoundingBox(){const t=this.clef.getBoundingBox(),e=this.getStave();return e&&t.setY(e.getYForLine(this.clef.line)+this.clef.getYShift()-this.clef.getTextMetrics().actualBoundingBoxAscent),t}}class Zt{static linkTimeline(t){t.forEach((e,i)=>{e.nextAttack=t[i+1]})}*through(t){if(this.tickID>t.tickID)return;if(yield this,this===t)return;let e=this.nextAttack;for(;e&&e.tickID<=t.tickID;){if(yield e,e===t)return;e=e.nextAttack}}static getNextContext(t){const e=t.tContexts,i=e.indexOf(t);if(i+1<e.length)return e[i+1]}constructor(t){var e;this.preFormatted=!1,this.postFormatted=!1,this.tickID=null!==(e=null==t?void 0:t.tickID)&&void 0!==e?e:0,this.currentTick=new y(0,1),this.maxTicks=new y(0,1),this.maxTickable=void 0,this.minTicks=void 0,this.minTickable=void 0,this.padding=1,this.x=0,this.xBase=0,this.xOffset=0,this.tickables=[],this.tickablesByVoice={},this.notePx=0,this.glyphPx=0,this.leftDisplacedHeadPx=0,this.rightDisplacedHeadPx=0,this.modLeftPx=0,this.modRightPx=0,this.totalLeftPx=0,this.totalRightPx=0,this.tContexts=[],this.width=0,this.formatterMetrics={freedom:{left:0,right:0}}}getTickID(){return this.tickID}getX(){return this.x}setX(t){return this.x=t,this.xBase=t,this.xOffset=0,this}getXBase(){return this.xBase}setXBase(t){this.xBase=t,this.x=t+this.xOffset}getXOffset(){return this.xOffset}setXOffset(t){this.xOffset=t,this.x=this.xBase+t}getWidth(){return this.width+2*this.padding}setPadding(t){return this.padding=t,this}getMaxTicks(){return this.maxTicks}getMinTicks(){return this.minTicks}getMaxTickable(){return this.maxTickable}getMinTickable(){return this.minTickable}getTickables(){return this.tickables}getTickableForVoice(t){return this.tickablesByVoice[t]}getTickablesByVoice(){return this.tickablesByVoice}getCenterAlignedTickables(){return this.tickables.filter(t=>t.isCenterAligned())}getMetrics(){const{width:t,glyphPx:e,notePx:i,leftDisplacedHeadPx:s,rightDisplacedHeadPx:n,modLeftPx:o,modRightPx:a,totalLeftPx:r,totalRightPx:h}=this;return{width:t,glyphPx:e,notePx:i,leftDisplacedHeadPx:s,rightDisplacedHeadPx:n,modLeftPx:o,modRightPx:a,totalLeftPx:r,totalRightPx:h}}getCurrentTick(){return this.currentTick}setCurrentTick(t){this.currentTick=t,this.preFormatted=!1}addTickable(t,e){if(!t)throw new p("BadArgument","Invalid tickable added.");if(!t.shouldIgnoreTicks()){const e=t.getTicks();e.greaterThan(this.maxTicks)&&(this.maxTicks=e.clone(),this.maxTickable=t),(void 0===this.minTicks||e.lessThan(this.minTicks))&&(this.minTicks=e.clone(),this.minTickable=t)}return t.setTickContext(this),this.tickables.push(t),this.tickablesByVoice[null!=e?e:0]=t,this.preFormatted=!1,this}preFormat(){var t;if(this.preFormatted)return this;for(let e=0;e<this.tickables.length;++e){const i=this.tickables[e];i.preFormat();const s=i.getMetrics();this.leftDisplacedHeadPx=Math.max(this.leftDisplacedHeadPx,s.leftDisplacedHeadPx),this.rightDisplacedHeadPx=Math.max(this.rightDisplacedHeadPx,s.rightDisplacedHeadPx),this.notePx=Math.max(this.notePx,s.notePx),this.glyphPx=Math.max(this.glyphPx,null!==(t=s.glyphWidth)&&void 0!==t?t:0),this.modLeftPx=Math.max(this.modLeftPx,s.modLeftPx),this.modRightPx=Math.max(this.modRightPx,s.modRightPx),this.totalLeftPx=Math.max(this.totalLeftPx,s.modLeftPx+s.leftDisplacedHeadPx),this.totalRightPx=Math.max(this.totalRightPx,s.modRightPx+s.rightDisplacedHeadPx),this.width=this.notePx+this.totalLeftPx+this.totalRightPx}return this}postFormat(){return this.postFormatted||(this.postFormatted=!0),this}getFormatterMetrics(){return this.formatterMetrics}move(t,e,i){this.setX(this.getX()+t),this.getFormatterMetrics().freedom.left+=t,this.getFormatterMetrics().freedom.right-=t,e&&(e.getFormatterMetrics().freedom.right+=t),i&&(i.getFormatterMetrics().freedom.left-=t)}getDeviationCost(){return b(this.tickables.map(t=>t.getFormatterMetrics().space.deviation))}getAverageDeviationCost(){return this.tickables.length?this.getDeviationCost()/this.tickables.length:0}}class te extends vt{static get CATEGORY(){return"Crescendo"}constructor(t){var e;super(t),this.options={extendLeft:0,extendRight:0,yShift:0},this.decrescendo=!1,this.line=null!==(e=t.line)&&void 0!==e?e:0,this.height=15}setLine(t){return this.line=t,this}setHeight(t){return this.height=t,this}setDecrescendo(t){return this.decrescendo=t,this}preFormat(){return this.preFormatted=!0,this}draw(){const t=this.checkContext(),e=this.checkStave();this.setRendered();const i=this.getTickContext(),s=Zt.getNextContext(i),n=this.getAbsoluteX(),o=s?s.getX():e.getX()+e.getWidth(),a=e.getYForLine(this.line+-3)+1;!function(...t){te.DEBUG&&S("VexFlow.Crescendo",t)}("Drawing ",this.decrescendo?"decrescendo ":"crescendo ",this.height,"x",n-o),function(t,e){const i=e.beginX,s=e.endX,n=e.y,o=e.height/2;t.beginPath(),e.reverse?(t.moveTo(i,n-o),t.lineTo(s,n),t.lineTo(i,n+o)):(t.moveTo(s,n-o),t.lineTo(i,n),t.lineTo(s,n+o)),t.stroke(),t.closePath()}(t,{beginX:n-this.options.extendLeft,endX:o+this.options.extendRight,y:a+this.options.yShift,height:this.height,reverse:this.decrescendo})}}function ee(t,e,i,s){const n=[t,s],o=3*e-t-3*i+s,a=2*(t-2*e+i),r=e-t,h=[];if(Math.abs(o)<1e-12)Math.abs(a)>1e-12&&h.push(-r/a);else{const t=a*a-4*o*r;if(t>=0){const e=Math.sqrt(t);h.push((-a+e)/(2*o),(-a-e)/(2*o))}}for(const o of h)if(o>0&&o<1){const a=1-o;n.push(a*a*a*t+3*a*a*o*e+3*a*o*o*i+o*o*o*s)}return n}te.DEBUG=!1,function(t){t[t.NEAR_HEAD=1]="NEAR_HEAD",t[t.NEAR_TOP=2]="NEAR_TOP"}($t||($t={}));class ie extends P{static get CATEGORY(){return"Curve"}static get Position(){return $t}static get PositionString(){return{nearHead:$t.NEAR_HEAD,nearTop:$t.NEAR_TOP}}constructor(t,e,i){super(),this.renderOptions=Object.assign({thickness:2,xShift:0,yShift:10,position:"auto",positionEnd:"auto",invert:!1,cps:[{x:0,y:10},{x:0,y:10}],openingDirection:"auto"},i),this.setNotes(t,e)}setNotes(t,e){if(!t&&!e)throw new p("BadArguments","Curve needs to have either `from` or `to` set.");return this.from=t,this.to=e,this}isPartial(){return!this.from||!this.to}getBezierPoints(t){const e=this.renderOptions.xShift,i=this.renderOptions.yShift*t.direction,s=t.firstX+e,n=t.firstY+i,o=t.lastX-e,a=t.lastY+i,r=this.renderOptions.thickness,h=this.renderOptions.cps,{x:c,y:l}=h[0],{x:d,y:u}=h[1],g=(o-s)/(h.length+2);return{first:{x:s,y:n},last:{x:o,y:a},cps:[{x:s+g+c,y:n+l*t.direction},{x:o-g+d,y:a+u*t.direction}],thicknessCps:[{x:o-g+d,y:a+(u+r)*t.direction},{x:s+g+c,y:n+(l+r)*t.direction}]}}renderCurve(t){var e,i;const s=this.checkContext(),{first:n,last:o,cps:a,thicknessCps:r}=this.getBezierPoints(t);s.beginPath(),s.moveTo(n.x,n.y),s.bezierCurveTo(a[0].x,a[0].y,a[1].x,a[1].y,o.x,o.y),(null===(e=this.style)||void 0===e?void 0:e.lineDash)||s.bezierCurveTo(r[0].x,r[0].y,r[1].x,r[1].y,n.x,n.y),s.stroke(),s.closePath(),(null===(i=this.style)||void 0===i?void 0:i.lineDash)||s.fill()}getRenderParams(){const t=this.from,e=this.to,i=null!=t?t:e,s=null!=e?e:t,{openingDirection:n,invert:o}=this.renderOptions;let a=s.getStemDirection();function r(t,e){const i=t.getStemExtents(),s=a===-t.getStemDirection();return e===$t.NEAR_TOP||"nearTop"===e||"auto"===e&&"auto"!==n&&s?i.topY:i.baseY}return"up"===n&&(a=1),"down"===n&&(a=-1),o&&(a*=-1),{firstX:t?t.getTieRightX():s.checkStave().getTieStartX(),lastX:e?e.getTieLeftX():i.checkStave().getTieEndX(),firstY:r(i,this.renderOptions.position),lastY:r(s,this.renderOptions.positionEnd),direction:a}}getBoundingBox(){var t;const{first:e,last:i,cps:s,thicknessCps:n}=this.getBezierPoints(this.getRenderParams()),o=ee(e.x,s[0].x,s[1].x,i.x),a=ee(e.y,s[0].y,s[1].y,i.y);(null===(t=this.style)||void 0===t?void 0:t.lineDash)||(o.push(...ee(i.x,n[0].x,n[1].x,e.x)),a.push(...ee(i.y,n[0].y,n[1].y,e.y)));const r=Math.min(...o),h=Math.min(...a);return new D(r,h,Math.max(...o)-r,Math.max(...a)-h)}getAnchors(){const{first:t,last:e}=this.getBezierPoints(this.getRenderParams());return{start:t,end:e}}draw(){return this.checkContext(),this.setRendered(),this.renderCurve(this.getRenderParams()),!0}}class se extends W{static get CATEGORY(){return"Dot"}static getDots(t){return t.getModifiersByType(se.CATEGORY)}static buildAndAttach(t,e){for(const i of t)if(null==e?void 0:e.all)for(let t=0;t<i.keys.length;t++){const e=new se;i.addModifier(e,t)}else if(void 0!==(null==e?void 0:e.index)){const t=new se;i.addModifier(t,null==e?void 0:e.index)}else{const t=new se;i.addModifier(t,0)}}static format(t,e){const i=e.rightShift;if(!t||0===t.length)return!1;const s=[],n={};for(let e=0;e<t.length;++e){const o=t[e],a=o.getNote();let r,h;if(et(a)){const t=o.checkIndex();r=a.getKeyProps()[t],h=a.getFirstDotPx()}else{if(!st(a))throw new p("Internal","Unexpected instance.");r={line:.5},h=i}const c=a.getAttribute("id");s.push({line:r.line,note:a,noteId:c,dot:o}),n[c]=Math.max(n[c]||h,h)}s.sort((t,e)=>e.line-t.line);let o=i,a=0,r=null,h=null,c=null,l=0;for(let t=0;t<s.length;++t){const{dot:e,note:i,noteId:d,line:u}=s[t];u===r&&i===h||(o=n[d]),i.isRest()||u===r||(.5===Math.abs(u%1)?l=0:(l=.5,null===h||h.isRest()||null===r||r-u!==.5?u+l===c&&(l=-.5):l=-.5)),i.isRest()?e.dotShiftY=e.restShiftY-l:e.dotShiftY=-l,c=u+l,e.setXShift(o),o+=e.getWidth()+1,a=o>a?o:a,r=u,h=i}return e.rightShift+=a,!0}constructor(){super(),this.restShiftY=0,this.position=W.Position.RIGHT,this.setText(I.augmentationDot),this.dotShiftY=0}setNote(t){return this.note=t,this.setFont(t.fontInfo),this}setDotShiftY(t){return this.restShiftY=t,this.dotShiftY=t,this}positionGlyph(){const t=this.checkAttachedNote(),e=t.checkStave().getSpacingBetweenLines(),i=t.getModifierStartXY(this.position,this.index,{forceFlagRight:!0});st(t)&&(i.y=t.getStemExtents().baseY),this.x=i.x,this.y=i.y+this.dotShiftY*e}getInkBounds(){return this.positionGlyph(),this.getTextInk(this.x,this.y)}draw(){const t=this.checkContext();this.positionGlyph(),this.setRendered(),this.renderText(t,0,0)}}class ne extends W{static get CATEGORY(){return"FretHandFinger"}static format(t,e){const{leftShift:i,rightShift:s}=e;if(!t||0===t.length)return!1;const n=[];let o=null,a=0,r=0;for(let h=0;h<t.length;++h){const c=t[h],l=c.getNote(),d=c.getPosition(),u=c.checkIndex(),g=l.getKeyProps()[u],p=B.get("FretHandFinger.fontSize");if(c.position===R.ABOVE&&(e.topTextLine+=p/$.STAVE_LINE_DISTANCE+.5),c.position===R.BELOW&&(e.textLine+=p/$.STAVE_LINE_DISTANCE+.5),l!==o){for(let t=0;t<l.keys.length;++t)0===i&&(a=Math.max(l.getLeftDisplacedHeadPx(),a)),0===s&&(r=Math.max(l.getRightDisplacedHeadPx(),r));o=l}n.push({note:l,num:c,pos:d,line:g.line,shiftL:a,shiftR:r})}n.sort((t,e)=>e.line-t.line);let h=0,c=0,l=0,d=0,u=null,g=null;for(let t=0;t<n.length;++t){let e=0;const{note:o,pos:a,num:p,line:m,shiftL:f,shiftR:S}=n[t];m===u&&o===g||(h=i+f,c=s+S);const x=p.getWidth()+1;a===W.Position.LEFT?(p.setXShift(i+h),e=i+x,l=e>l?e:l):a===W.Position.RIGHT&&(p.setXShift(c),e=r+x,d=e>d?e:d),u=m,g=o}return e.leftShift+=l,e.rightShift+=d,!0}static easyScoreHook({fingerings:t}={},e,i){null==t||t.split(",").map(t=>{const e=t.trim().split("."),s={number:e[0]};return e[1]&&(s.position=e[1]),i.getFactory().Fingering(s)}).map((t,i)=>e.addModifier(t,i))}constructor(t){super(),this.setFretHandFinger(t),this.position=W.Position.LEFT,this.xOffset=0,this.yOffset=0}setFretHandFinger(t){return this.text=t,this}getFretHandFinger(){return this.text}setOffsetX(t){return this.xOffset=t,this}setOffsetY(t){return this.yOffset=t,this}draw(){const t=this.checkContext(),e=this.checkAttachedNote();this.setRendered();const i=e.getModifierStartXY(this.position,this.index);let s=i.x+this.xOffset,n=i.y+this.yOffset+5;switch(this.position){case W.Position.ABOVE:s-=4,n-=12;break;case W.Position.BELOW:s-=2,n+=10;break;case W.Position.LEFT:s-=this.width;break;case W.Position.RIGHT:s+=1;break;default:throw new p("InvalidPosition",`The position ${this.position} does not exist`)}this.renderText(t,s,n)}}class oe extends vt{static get CATEGORY(){return"NoteHead"}constructor(t){var e,i;if(super(t),this.customGlyph=!1,this.ledger={"":"","":""},this.index=t.index,this.x=t.x||0,this.y=t.y||0,t.noteType&&(this.noteType=t.noteType),this.displacementColumn=null!==(e=t.displacementColumn)&&void 0!==e?e:t.displaced?1:0,!Number.isSafeInteger(this.displacementColumn)||this.displacementColumn<0)throw new p("BadArguments","Head displacement column must be a nonnegative integer.");this.displaced=0!==this.displacementColumn,this.stemDirection=t.stemDirection||at.UP,this.line=t.line||0,this.glyphProps=vt.getGlyphProps(this.duration,this.noteType),f(this.glyphProps,"BadArguments",`No glyph found for duration '${this.duration}' and type '${this.noteType}'`),(this.line>5||this.line<0)&&this.ledger[this.glyphProps.codeHead]&&(this.glyphProps.codeHead=this.ledger[this.glyphProps.codeHead]),this.text=this.glyphProps.codeHead,t.customGlyphCode&&(this.customGlyph=!0,this.text=t.customGlyphCode),this.setStyle(null!==(i=t.style)&&void 0!==i?i:{}),this.slashed=t.slashed||!1,this.renderOptions=Object.assign({},this.renderOptions)}getWidth(){return this.width}isDisplaced(){return!0===this.displaced}getLine(){return this.line}setLine(t){return this.line=t,this}getAbsoluteX(){return(this.preFormatted?super.getAbsoluteX():this.x)+this.getDisplacementX()}getDisplacementX(){return this.displacementColumn*(this.width-at.WIDTH/2)*this.stemDirection}setStave(t){const e=this.getLine();return this.stave=t,this.stave&&(this.setY(this.stave.getYForNote(e)),this.setContext(this.stave.getContext())),this}preFormat(){return this.preFormatted||(this.preFormatted=!0),this}draw(){var t;const e=this.checkContext();this.setRendered();const i=this.getAttribute("class");e.openGroup("notehead"+(i?" "+i:""),this.getAttribute("id")),function(...t){oe.DEBUG&&S("VexFlow.NoteHead",t)}("Drawing note head '",this.noteType,this.duration,"' at",this.x,this.y),this.x=this.getAbsoluteX(),this.renderText(e,0,0),null===(t=this.parent)||void 0===t||t.drawModifiers(this),this.drawPointerRect(),e.closeGroup()}}oe.DEBUG=!1;class ae extends P{static get CATEGORY(){return"Flag"}draw(){const t=this.checkContext();this.setRendered();const e=this.getAttribute("class");t.openGroup("flag"+(e?" "+e:""),this.getAttribute("id")),function(...t){ae.DEBUG&&S("VexFlow.Flag",t)}("Drawing flag '",this.text,"' at",this.x,this.y),this.renderText(t,0,0),this.drawPointerRect(),t.closeGroup()}}ae.DEBUG=!1;class re extends vt{static get CATEGORY(){return"StemmableNote"}constructor(t){super(t),this.autoStemEnabled=!1,this.flag=new ae}getStem(){return this.stem}checkStem(){if(!this.stem)throw new p("NoStem","No stem attached to instance");return this.stem}setStem(t){return this.stem=t,this.addChild(t),this}buildStem(){const t=new at;return this.setStem(t),this}buildFlag(){var t,e,i;const{glyphProps:s}=this;if(this.hasFlag()){const n=this.getStemDirection()===at.DOWN?String.fromCodePoint((null!==(e=null===(t=s.codeFlagUp)||void 0===t?void 0:t.codePointAt(0))&&void 0!==e?e:-1)+1):null!==(i=s.codeFlagUp)&&void 0!==i?i:I.null;this.flag.setText(n),this.flag.fontInfo=this.fontInfo}}getBaseCustomNoteHeadGlyphProps(){return this.getStemDirection()===at.DOWN?this.customGlyphs[this.customGlyphs.length-1]:this.customGlyphs[0]}getStemLength(){return at.HEIGHT+this.getStemExtension()}getBeamCount(){const t=this.getGlyphProps();return t?t.beamCount:0}getStemMinimumLength(){const t=$.durationToFraction(this.duration),e=void 0===this.beam;let i=t.value()<=1?0:20;switch(this.duration){case"8":case"16":i=e?35:25;break;case"32":i=e?45:35;break;case"64":i=e?50:40;break;case"128":i=e?55:45;break;case"256":i=e?60:55;break;case"512":i=e?65:60;break;case"1024":i=e?70:65}return i}getStemDirection(){if(!this.stemDirection)throw new p("NoStem","No stem attached to this note.");return this.stemDirection}isAutoStem(){return this.autoStemEnabled}setStemDirection(t,e=!1){if(t||(t=at.UP),t!==at.UP&&t!==at.DOWN)throw new p("BadArgument",`Invalid stem direction: ${t}`);return this.stemDirection=t,this.autoStemEnabled=e,this.reset(),this.hasFlag()&&this.buildFlag(),this.beam=void 0,this.stem&&(this.stem.setDirection(t),this.stem.setExtension(this.getStemExtension())),this.preFormatted&&this.preFormat(),this}getStemX(){const t=this.getAbsoluteX()+this.xShift,e=this.getAbsoluteX()+this.xShift+this.getGlyphWidth();return this.stemDirection===at.DOWN?t:e}getCenterGlyphX(){return this.getAbsoluteX()+this.xShift+this.getGlyphWidth()/2}getStemExtension(){const t=this.getGlyphProps(),e=this.flag.getHeight(),i=this.getFontScale();return void 0!==this.stemExtensionOverride?this.stemExtensionOverride:this.beam?t.stemBeamExtension*i:e>at.HEIGHT*i?e-at.HEIGHT*i:0}setStemLength(t){return this.stemExtensionOverride=t-at.HEIGHT,this}getStemExtents(){if(!this.stem)throw new p("NoStem","No stem attached to this note.");return this.stem.getExtents()}getYForTopText(t){const e=this.checkStave();if(this.hasStem()){const i=this.getStemExtents();if(!i)throw new p("InvalidState","Stem does not have extents.");return Math.min(e.getYForTopText(t),i.topY-this.renderOptions.annotationSpacing*(t+1))}return e.getYForTopText(t)}getYForBottomText(t){const e=this.checkStave();if(this.hasStem()){const i=this.getStemExtents();if(!i)throw new p("InvalidState","Stem does not have extents.");return Math.max(e.getYForTopText(t),i.baseY+this.renderOptions.annotationSpacing*t)}return e.getYForBottomText(t)}hasFlag(){return void 0!==this.glyphProps.codeFlagUp&&!this.beam&&!this.isRest()}postFormat(){var t;return null===(t=this.beam)||void 0===t||t.postFormat(),this.postFormatted=!0,this}drawStem(t){var e;this.checkContext(),this.setRendered(),this.setStem(new at(t)),null===(e=this.stem)||void 0===e||e.setContext(this.getContext()).drawWithStyle()}}function he(t,e,i){const s=i>0?e.maxLine+.5-t.minLine:t.maxLine+.5-e.minLine,n=i*Math.max(1,Math.ceil(s));t.line+=n,t.maxLine+=n,t.minLine+=n,t.note.setKeyLine(0,t.note.getKeyLine(0)+n)}class ce extends re{static get CATEGORY(){return"StaveNote"}static get LEDGER_LINE_OFFSET(){return 3}static get minNoteheadPadding(){return B.get("NoteHead.minPadding")}static format(t,e){if(!t||t.length<2)return!1;const i=[];for(let e=0;e<t.length;e++){const s=t[e].sortedKeyProps,n=s[0].keyProps.line;let o=s[s.length-1].keyProps.line;const a=t[e].getStemDirection(),r=t[e].getStemLength()/10,h=t[e].getStemMinimumLength()/10;let c;t[e].isRest()?(c=n+Math.ceil(t[e]._noteHeads[0].getTextMetrics().actualBoundingBoxAscent/$.STAVE_LINE_DISTANCE),o=n-Math.ceil(t[e]._noteHeads[0].getTextMetrics().actualBoundingBoxDescent/$.STAVE_LINE_DISTANCE)):(c=1===a?s[s.length-1].keyProps.line+r:s[s.length-1].keyProps.line,o=1===a?s[0].keyProps.line:s[0].keyProps.line-r),i.push({line:s[0].keyProps.line,maxLine:c,minLine:o,isrest:t[e].isRest(),stemDirection:a,stemMax:r,stemMin:h,voiceShift:t[e].getVoiceShiftWidth(),isDisplaced:t[e].isDisplaced(),note:t[e]})}const s=i.filter(t=>!1!==t.note.renderOptions.draw);if(s.length<2)return!0;if(s.length>3){const t=[];for(const e of s.sort((t,e)=>e.maxLine-t.maxLine||e.line-t.line)){let i=t.find(t=>e.maxLine+.5<t.bottom);i||(i={bottom:e.minLine,width:0,members:[]},t.push(i)),i.bottom=e.minLine,i.width=Math.max(i.width,e.voiceShift),i.members.push(e)}let i=0;for(const e of t){for(const t of e.members)t.note.setXShift(i);e!==t[t.length-1]&&(i+=e.width+2)}return e.rightShift+=i,!0}const n=s.length;let o=s[0],a=s[n-1];const r=3===n?s[1]:void 0;2===n&&-1===o.stemDirection&&1===a.stemDirection&&([o,a]=[a,o]);const h=Math.max(o.voiceShift,a.voiceShift);let c=0;if(2===n){const t=o.note.hasStem()&&a.note.hasStem()&&o.stemDirection===a.stemDirection?0:.5;if(a.isrest&&o.isrest&&o.note.duration===a.note.duration)a.note.renderOptions.draw=!1;else if(o.minLine<=a.maxLine+t)if(o.isrest)he(o,a,1);else if(a.isrest)he(a,o,-1);else{const t=Math.abs(o.line-a.line);if(o.note.hasStem()&&a.note.hasStem()){const e=o.note.sortedKeyProps[0].keyProps.code,i=a.note.sortedKeyProps[a.note.sortedKeyProps.length-1].keyProps.code;!$.UNISON||e!==i||o.note.getModifiers().filter(t=>"Dot"===t.getCategory()&&0===t.getIndex()).length!==a.note.getModifiers().filter(t=>"Dot"===t.getCategory()&&0===t.getIndex()).length||t<1&&t>0||JSON.stringify(o.note.getStyle())!==JSON.stringify(a.note.getStyle())?(c=h+2,o.stemDirection===a.stemDirection?o.note.setXShift(c):a.note.setXShift(c)):o.note.voice!==a.note.voice&&o.stemDirection===a.stemDirection&&(o.line!==a.line?(c=h+2,o.note.setXShift(c)):1===a.stemDirection&&(a.stemDirection=-1,a.note.setStemDirection(-1,a.note.isAutoStem())))}else t<1?(c=h+2,o.note.duration<a.note.duration?o.note.setXShift(c):a.note.setXShift(c)):o.note.hasStem()?(o.stemDirection=-o.note.getStemDirection(),o.note.setStemDirection(o.stemDirection,o.note.isAutoStem())):a.note.hasStem()&&(a.stemDirection=-a.note.getStemDirection(),a.note.setStemDirection(a.stemDirection,a.note.isAutoStem()))}return e.rightShift+=c,!0}if(!r)throw new p("InvalidState","noteM not defined.");if(r.isrest&&!o.isrest&&!a.isrest&&(o.minLine<=r.maxLine||r.minLine<=a.maxLine)){return r.maxLine-r.minLine<o.minLine-a.maxLine?function(t,e,i){const s=t.line-x(e.minLine,i.maxLine);t.note.setKeyLine(0,t.note.getKeyLine(0)-s),t.line-=s,t.maxLine-=s,t.minLine-=s}(r,o,a):(c=h+2,r.note.setXShift(c),!1===a.note.hasBeam()&&(a.stemDirection=-1,a.note.setStemDirection(-1,a.note.isAutoStem())),o.minLine<=a.maxLine&&!1===o.note.hasBeam()&&(o.stemDirection=1,o.note.setStemDirection(1,o.note.isAutoStem()))),e.rightShift+=c,!0}return o.isrest&&r.isrest&&a.isrest?(o.note.renderOptions.draw=!1,a.note.renderOptions.draw=!1,e.rightShift+=c,!0):(r.isrest&&o.isrest&&r.minLine<=a.maxLine&&(r.note.renderOptions.draw=!1),r.isrest&&a.isrest&&o.minLine<=r.maxLine&&(r.note.renderOptions.draw=!1),o.isrest&&o.minLine<=r.maxLine&&he(o,r,1),a.isrest&&r.minLine<=a.maxLine&&he(a,r,-1),(o.minLine<=r.maxLine+.5||r.minLine<=a.maxLine)&&(c=h+2,r.note.setXShift(c),!1===a.note.hasBeam()&&(a.stemDirection=-1,a.note.setStemDirection(-1,a.note.isAutoStem())),o.minLine<=a.maxLine&&!1===o.note.hasBeam()&&(o.stemDirection=1,o.note.setStemDirection(1,o.note.isAutoStem()))),e.rightShift+=c,!0)}static postFormat(t){return!!t&&(t.forEach(t=>t.postFormat()),!0)}constructor(t){var e,i,s,n,o;super(t),this.minLine=0,this.maxLine=0,this.useDefaultHeadX=!1,this.extraHeadColumns=0,this.sortedKeyProps=[],this.engraving=t.engraving;const a=null!==(e=t.musicFont)&&void 0!==e?e:null===(i=this.engraving)||void 0===i?void 0:i.musicFont;a&&this.setFont(Object.assign(Object.assign({},this.fontInfo),{family:a})),this.ledgerLineStyle={},this.clef=null!==(s=t.clef)&&void 0!==s?s:"treble",this.octaveShift=null!==(n=t.octaveShift)&&void 0!==n?n:0,this.glyphProps=vt.getGlyphProps(this.duration,this.noteType),f(this.glyphProps,"BadArguments",`No glyph found for duration '${this.duration}' and type '${this.noteType}'`),this.displaced=!1,this.dotShiftY=0,this._noteHeads=[],this.modifiers=[],this.renderOptions=Object.assign(Object.assign({},this.renderOptions),{strokePx:t.strokePx||ce.LEDGER_LINE_OFFSET}),this.calculateKeyProps(),this.buildStem(),t.autoStem?this.autoStem():this.setStemDirection(null!==(o=t.stemDirection)&&void 0!==o?o:at.UP)}reset(){super.reset();const t=this._noteHeads.map(t=>t.getStyle());this.buildNoteHeads(),this._noteHeads.forEach((e,i)=>{const s=t[i];s&&e.setStyle(s)});const e=this.stave;return e&&this.setStave(e),this.calcNoteDisplacements(),this}setBeam(t){return this.beam=t,this.calcNoteDisplacements(),this.stem&&this.stem.setExtension(this.getStemExtension()),this}buildStem(){return this.setStem(new at({hide:this.isRest()})),this}buildNoteHeads(){const t=new Set(this._noteHeads);this.children=this.children.filter(e=>!t.has(e)),this._noteHeads=[];const e=this.getStemDirection(),i=this.getKeys(),s=[];let n,o,a;this.extraHeadColumns=0,e===at.UP?(n=0,o=i.length,a=1):(n=i.length-1,o=-1,a=-1);for(let t=n;t!==o;t+=a){const i=this.sortedKeyProps[t].keyProps,o=i.line;let r=s.findIndex(t=>Math.abs(t-o)>=1);t!==n&&Math.abs(this.sortedKeyProps[t-a].keyProps.line-o)>=1&&(this.useDefaultHeadX=!0),r<0&&(r=s.length),s[r]=o,this.extraHeadColumns=Math.max(this.extraHeadColumns,r);const h=new oe({duration:this.duration,noteType:this.noteType,displacementColumn:r,stemDirection:e,customGlyphCode:i.code,line:i.line});h.fontInfo=this.fontInfo,this.addChild(h),this._noteHeads[this.sortedKeyProps[t].index]=h}return this._noteHeads}autoStem(){this.setStemDirection(this.calculateOptimalStemDirection(),!0)}calculateOptimalStemDirection(){this.minLine=this.sortedKeyProps[0].keyProps.line,this.maxLine=this.sortedKeyProps[this.keyProps.length-1].keyProps.line;return(this.minLine+this.maxLine)/2<3?at.UP:at.DOWN}calculateKeyProps(){var t;for(let e=0;e<this.keys.length;++e){const i=this.keys[e],s={octaveShift:null!==(t=this.octaveShift)&&void 0!==t?t:0,duration:this.duration},n=$.keyProperties(i,this.clef,this.noteType,s);if(!n)throw new p("BadArguments",`Invalid key for note properties: ${i}`);"R"===n.key&&("1"===this.duration||"w"===this.duration?n.line=4:n.line=3),this.keyProps.push(n)}this.keyProps.forEach((t,e)=>{this.sortedKeyProps.push({keyProps:t,index:e})}),this.sortedKeyProps.sort((t,e)=>t.keyProps.line-e.keyProps.line);for(let t=1;t<this.sortedKeyProps.length;t++){const e=this.sortedKeyProps[t-1].keyProps,i=this.sortedKeyProps[t].keyProps;i.line-e.line<1&&(this.displaced=!0,e.displaced=i.displaced=!0)}}getHeadInk(){return this._noteHeads.map(t=>{const e=t.getDisplacementX();return t.getTextInk(this.getNoteHeadBeginX()+e,t.getY())})}getFlagInk(){if(!this.shouldDrawFlag())return;const{x:t,y:e}=this.getFlagPosition();return this.flag.getTextInk(t,e)}getStemSegment(){var t;if(!(null===(t=this.stem)||void 0===t?void 0:t.isVisible())||!this.hasStem()&&!this.beam)return;const e=this.shouldDrawFlag()?B.get("Stem.heightAdjustmentForFlag",-3):void 0;return this.checkStem().getSegment(this.getStemX(),e)}getBoundingBox(t=!0){const e=new D(this.getAbsoluteX(),this.ys[0],0,0);this._noteHeads.forEach(t=>{const i=t.getDisplacementX(),s=t.getBoundingBox();s.setX(this.getNoteHeadBeginX()+i+t.getXShift()),e.mergeWith(s)});const{yTop:i,yBottom:s}=this.getNoteHeadBounds();if(!this.isRest()&&this.hasStem()){const t=this.stem.getHeight(),n=this.getStemDirection()===at.DOWN?i-t-this.flag.getTextMetrics().actualBoundingBoxDescent:s-t+this.flag.getTextMetrics().actualBoundingBoxAscent;e.mergeWith(new D(this.getAbsoluteX(),n,0,0))}if(this.shouldDrawFlag()){const{x:t,y:i}=this.getFlagPosition(),s=this.flag.getBoundingBox();s.setX(t+this.flag.getXShift()),s.setY(i+this.flag.getYShift()-this.flag.getTextMetrics().actualBoundingBoxAscent),e.mergeWith(s)}if(t)for(const t of this.modifiers)e.mergeWith(t.getBoundingBox());return e}getLineNumber(t){if(!this.keyProps.length)throw new p("NoKeyProps","Can't get bottom note line, because note is not initialized properly.");let e=this.keyProps[0].line;for(let i=0;i<this.keyProps.length;i++){const s=this.keyProps[i].line;t?s>e&&(e=s):s<e&&(e=s)}return e}isRest(){const t=this.glyphProps.codeHead;return t>=""&&t<=""}isChord(){return!this.isRest()&&this.keys.length>1}hasStem(){return this.glyphProps.stem}hasFlag(){return super.hasFlag()&&!this.isRest()}getStemX(){var t;if("r"===this.noteType)return this.getCenterGlyphX();{const e=this.stemDirection===at.UP,i=this.engraving&&this._noteHeads.find(t=>!t.isDisplaced());if(i&&(null===(t=this.engraving)||void 0===t?void 0:t.musicFont)===i.fontInfo.family){const t=this.engraving.stemAnchor(i.text,e?"up":"down");if(t)return this.getNoteHeadBeginX()+i.getXShift()+t[0]*i.fontSizeInPixels/4+(e?-1:1)*at.WIDTH/2}return super.getStemX()+(this.stemDirection?at.WIDTH/(2*-this.stemDirection):0)}}getYForTopText(t){const e=this.getStemExtents();return Math.min(this.checkStave().getYForTopText(t),e.topY-this.renderOptions.annotationSpacing*(t+1))}getYForBottomText(t){const e=this.getStemExtents();return Math.max(this.checkStave().getYForTopText(t),e.baseY+this.renderOptions.annotationSpacing*t)}setStave(t){super.setStave(t);const e=this._noteHeads.map(e=>(e.setStave(t),e.getY()));if(this.setYs(e),this.stem){const{yTop:t,yBottom:e}=this.getStemYBounds();this.stem.setYBounds(t,e)}return this}isDisplaced(){return this.displaced}setNoteDisplaced(t){return this.displaced=t,this}getTieRightX(){let t=this.getAbsoluteX();return t+=this.getGlyphWidth()+this.xShift+this.rightDisplacedHeadPx,this.modifierContext&&(t+=this.modifierContext.getRightShiftForTie()),t}getTieLeftX(){let t=this.getAbsoluteX();return t+=this.xShift-this.leftDisplacedHeadPx,t}getLineForRest(){let t=this.keyProps[0].line;if(this.keyProps.length>1){const e=this.keyProps[this.keyProps.length-1].line;t=x(Math.max(t,e),Math.min(t,e))}return t}getModifierStartXY(t,e,i={}){if(!this.preFormatted)throw new p("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");if(0===this.ys.length)throw new p("NoYValues","No Y-Values calculated for this note.");const{ABOVE:s,BELOW:n,LEFT:o,RIGHT:a}=W.Position;let r=0;t===o?r=-2:t===a?(r=this.getGlyphWidth()+this.xShift+2,this.stemDirection===at.UP&&this.hasFlag()&&(i.forceFlagRight||((t,e)=>e===(t.getStemDirection()===at.UP?t.keyProps.length-1:0))(this,e))&&(r+=this.flag.getWidth())):t!==n&&t!==s||(r=this.getGlyphWidth()/2);let h=0;switch(this._noteHeads[e].getText()){case I.restWhole:h+=.5;break;case I.restHalf:case I.restQuarter:case I.rest8th:case I.rest16th:h-=.5;break;case I.rest32nd:case I.rest64th:h-=1.5;break;case I.rest128th:case I.rest256th:h-=2.5;break;case I.rest512th:h-=3.5;break;case I.rest1024th:h-=4.5}return{x:this.getAbsoluteX()+r,y:this.ys[e]+h*this.checkStave().getSpacingBetweenLines()}}setStyle(t){return super.setGroupStyle(t)}setStemStyle(t){const e=this.getStem();return e&&e.setStyle(t),this}getStemStyle(){var t;return null===(t=this.stem)||void 0===t?void 0:t.getStyle()}setLedgerLineStyle(t){this.ledgerLineStyle=t}getLedgerLineStyle(){return this.ledgerLineStyle}setFlagStyle(t){this.flag.setStyle(t)}getFlagStyle(){return this.flag.getStyle()}getGlyphWidth(){return this.noteHeads[0].getWidth()}setKeyStyle(t,e){return this._noteHeads[t].setStyle(e),this}setKeyLine(t,e){return this.keyProps[t].line=e,this.reset(),this}getKeyLine(t){return this.keyProps[t].line}getVoiceShiftWidth(){return this.getGlyphWidth()*(this.displaced?1+Math.max(1,this.extraHeadColumns):1)}calcNoteDisplacements(){const t=this.getVoiceShiftWidth()-this.getGlyphWidth();this.setLeftDisplacedHeadPx(this.stemDirection===at.DOWN?t:0),this.setRightDisplacedHeadPx(this.stemDirection===at.UP?Math.max(0,t-(this.hasFlag()?this.getGlyphWidth():0)):0)}preFormat(){if(this.preFormatted)return;let t=0;this.modifierContext&&(this.modifierContext.preFormat(),0===this.modifierContext.getWidth()&&(t=ce.minNoteheadPadding));let e=this.getGlyphWidth()+this.leftDisplacedHeadPx+this.rightDisplacedHeadPx+t;this.shouldDrawFlag()&&this.stemDirection===at.UP&&(e+=this.getGlyphWidth()),this.setWidth(e),this.preFormatted=!0}getStemYBounds(){const t=this.stemDirection===at.UP?"up":"down";let e=1/0,i=-1/0;if(this._noteHeads.forEach(s=>{const n=$.noteHeadStemYOffsets[s.text],o=n?n[t]:0,a=this.engraving&&this.engraving.musicFont===s.fontInfo.family?this.engraving.stemAnchor(s.text,t):void 0,r=s.getY()-(a?a[1]*s.fontSizeInPixels/4:o*$.STAVE_LINE_DISTANCE);e=Math.min(r,e),i=Math.max(r,i)}),!isFinite(e)||!isFinite(i)){const t=this.getNoteHeadBounds();return{yTop:t.yTop,yBottom:t.yBottom}}return{yTop:e,yBottom:i}}getNoteHeadBounds(t=!1){let e,i,s,n,o=1/0,a=-1/0,r=this.checkStave().getNumLines(),h=1,c=r,l=h;return this._noteHeads.forEach(d=>{const u=d.getLine(),g=d.getY();o=Math.min(g,o),a=Math.max(g,a),void 0===i&&d.isDisplaced()&&(i=t?this.getNoteHeadBeginX()+d.getDisplacementX():d.getAbsoluteX()),void 0!==e||d.isDisplaced()||(e=t?this.getNoteHeadBeginX():d.getAbsoluteX()),r=Math.max(u,r),h=Math.min(u,h),d.isDisplaced()?(s=void 0===s?u:Math.max(u,s),n=void 0===n?u:Math.min(u,n)):(c=Math.max(u,c),l=Math.min(u,l))},this),{yTop:o,yBottom:a,displacedX:i,nonDisplacedX:e,highestLine:r,lowestLine:h,highestDisplacedLine:s,lowestDisplacedLine:n,highestNonDisplacedLine:c,lowestNonDisplacedLine:l}}getNoteHeadBeginX(){return this.getAbsoluteX()+this.xShift}getNoteHeadEndX(){return this.getNoteHeadBeginX()+this.getGlyphWidth()}get noteHeads(){return this._noteHeads.slice()}getLedgerLines(){const t=[],e=this.checkStave(),{strokePx:i}=this.renderOptions;if(this.isRest())return t;const{highestLine:s,lowestLine:n}=this.getNoteHeadBounds(!0),o=(s,n)=>{if(!n.length)return;const o=Math.min(...n.map(t=>t.getDisplacementX())),a=Math.max(...n.map(t=>t.getDisplacementX()+t.getWidth()));t.push({x:this.getNoteHeadBeginX()+o-i,y:e.getYForNote(s),width:a-o+2*i})};for(let t=6;t<=s;++t)o(t,this._noteHeads.filter(e=>e.getLine()>=t));for(let t=0;t>=n;--t)o(t,this._noteHeads.filter(e=>e.getLine()<=t));return t}drawLedgerLines(){const t=this.getLedgerLines();if(!t.length)return;const e=this.checkContext();e.save(),this.applyStyle(e,Object.assign(Object.assign({},this.checkStave().getDefaultLedgerLineStyle()),this.getLedgerLineStyle()));for(const{x:i,y:s,width:n}of t)e.beginPath(),e.moveTo(i,s),e.lineTo(i+n,s),e.stroke();e.restore()}drawModifiers(t){const e=this.checkContext();for(let i=0;i<this.modifiers.length;i++){const s=this.modifiers[i],n=s.checkIndex();this._noteHeads[n]===t&&(s.setContext(e),s.drawWithStyle())}}shouldDrawFlag(){const t=void 0!==this.stem,e=void 0!==this.glyphProps.codeFlagUp,i=void 0===this.beam;return t&&e&&i&&!this.isRest()}getFlagPosition(){const{yTop:t,yBottom:e}=this.getNoteHeadBounds(),i=this.checkStem().getHeight();return{x:this.getStemX()-$.STEM_WIDTH/2,y:this.getStemDirection()===at.DOWN?t-i-this.flag.getTextMetrics().actualBoundingBoxDescent:e-i+this.flag.getTextMetrics().actualBoundingBoxAscent}}drawFlag(){const t=this.checkContext();if(!t)throw new p("NoCanvasContext","Can't draw without a canvas context.");if(this.shouldDrawFlag()){const{x:e,y:i}=this.getFlagPosition();this.flag.setContext(t).setX(e).setY(i).drawWithStyle()}}drawNoteHeads(){const t=this.checkContext();this._noteHeads.forEach(e=>{e.setContext(t).drawWithStyle()})}drawStem(t){const e=this.checkContext();t&&this.setStem(new at(t)),this.shouldDrawFlag()&&this.stem&&this.stem.adjustHeightForFlag(),this.stem&&this.stem.setContext(e).drawWithStyle()}getStemExtension(){const t=super.getStemExtension();if(!this.glyphProps.stem)return t;const e=this.getStemDirection();if(e!==this.calculateOptimalStemDirection())return t;let i;i=e===at.UP?3-this.maxLine:this.minLine-3;const s=i-3.5;if(s<=0)return t;const n=this.getStave();let o=10;return void 0!==n&&(o=n.getSpacingBetweenLines()),t+s*o}draw(){if(!1===this.renderOptions.draw)return;if(0===this.ys.length)throw new p("NoYValues","Can't draw note without Y values.");const t=this.checkContext(),e=this.getNoteHeadBeginX(),i=this.hasStem()&&!this.beam;if(this._noteHeads.forEach(t=>t.setX(e)),this.stem){const t=this.getStemX();this.stem.setNoteHeadXBounds(t,t)}!function(...t){ce.DEBUG&&S("VexFlow.StaveNote",t)}("Rendering ",this.isChord()?"chord :":"note :",this.keys);const s=this.getAttribute("class");t.openGroup("stavenote"+(s?" "+s:""),this.getAttribute("id")),this.drawLedgerLines(),i&&this.drawStem(),this.drawNoteHeads(),this.drawFlag(),this.drawPointerRect(),t.closeGroup(),this.setRendered()}}ce.DEBUG=!1;class le extends P{static get CATEGORY(){return"StaveTie"}constructor(t,e=""){super(),this.setNotes(t),this.text=e,this.renderOptions={cp1:8,cp2:12,shortTieCutoff:10,cp1Short:2,cp2Short:8,textShiftX:0,firstXShift:0,lastXShift:0,yShift:7,tieSpacing:0}}getDirection(){return void 0!==this.direction&&null!==this.direction?this.direction:this.notes.lastNote?this.notes.lastNote.getStemDirection():this.notes.firstNote?this.notes.firstNote.getStemDirection():0}setDirection(t){return this.direction=t,this}setNotes(t){if(!t.firstNote&&!t.lastNote)throw new p("BadArguments","Tie needs to have either firstNote or lastNote set.");if(t.firstIndexes||(t.firstIndexes=[0]),t.lastIndexes||(t.lastIndexes=[0]),t.firstIndexes.length!==t.lastIndexes.length)throw new p("BadArguments","Tied notes must have same number of indexes.");return this.notes=t,this}isPartial(){return!this.notes.firstNote||!this.notes.lastNote}*tieCurves(t){if(0===t.firstYs.length||0===t.lastYs.length)throw new p("BadArguments","No Y-values to render");let e=this.renderOptions.cp1,i=this.renderOptions.cp2;Math.abs(t.lastX-t.firstX)<this.renderOptions.shortTieCutoff&&(e=this.renderOptions.cp1Short,i=this.renderOptions.cp2Short);const s=this.renderOptions.firstXShift,n=this.renderOptions.lastXShift,o=this.renderOptions.yShift*t.direction,a=this.notes.firstIndexes,r=this.notes.lastIndexes;for(let h=0;h<a.length;++h){const c=(t.lastX+n+(t.firstX+s))/2,l=t.firstYs[a[h]]+o,d=t.lastYs[r[h]]+o;if(isNaN(l)||isNaN(d))throw new p("BadArguments","Bad indexes for tie rendering.");const u=(l+d)/2+e*t.direction,g=(l+d)/2+i*t.direction;yield{x1:t.firstX+s,x2:t.lastX+n,firstY:l,lastY:d,cpX:c,topControlPointY:u,bottomControlPointY:g}}}getRibbonBounds(){this.synchronizeIndexes();const t=this.tieCurves({firstX:this.getFirstX(),lastX:this.getLastX(),firstYs:this.getFirstYs(),lastYs:this.getLastYs(),direction:this.getDirection()});let e;for(const{x1:i,x2:s,firstY:n,lastY:o,topControlPointY:a,bottomControlPointY:r}of t){const t=Math.min(n,o,a,r),h=Math.max(n,o,a,r),c=new D(Math.min(i,s),t,Math.abs(s-i),h-t);e=e?e.mergeWith(c):c}return null!=e?e:new D(this.getFirstX(),this.getFirstYs()[0],0,0)}renderTie(t){const e=this.checkContext(),i=this.getAttribute("class");e.openGroup("stavetie"+(i?" "+i:""),this.getAttribute("id"));for(const{x1:i,x2:s,firstY:n,lastY:o,cpX:a,topControlPointY:r,bottomControlPointY:h}of this.tieCurves(t))e.beginPath(),e.moveTo(i,n),e.quadraticCurveTo(a,r,s,o),e.quadraticCurveTo(a,h,i,n),e.closePath(),e.fill();this.drawPointerRect(),e.closeGroup()}renderTieText(t,e){var i,s,n;const o=this.checkContext();let a=(t+e)/2;a-=o.measureText(this.text).width/2;const r=null!==(s=null===(i=this.notes.firstNote)||void 0===i?void 0:i.checkStave())&&void 0!==s?s:null===(n=this.notes.lastNote)||void 0===n?void 0:n.checkStave();r&&(o.setFont(this.fontInfo),o.fillText(this.text,a+this.renderOptions.textShiftX,r.getYForTopText()-1))}getNotes(){return this.notes}getFirstX(){return this.notes.firstNote?this.notes.firstNote.getTieRightX()+this.renderOptions.tieSpacing:this.notes.lastNote?this.notes.lastNote.checkStave().getTieStartX():0}getLastX(){return this.notes.lastNote?this.notes.lastNote.getTieLeftX()+this.renderOptions.tieSpacing:this.notes.firstNote?this.notes.firstNote.checkStave().getTieEndX():0}getFirstYs(){return this.notes.firstNote?this.notes.firstNote.getYs():this.notes.lastNote?this.notes.lastNote.getYs():[0]}getLastYs(){return this.notes.lastNote?this.notes.lastNote.getYs():this.notes.firstNote?this.notes.firstNote.getYs():[0]}synchronizeIndexes(){this.notes.firstNote&&this.notes.lastNote||(this.notes.firstNote||this.notes.lastNote)&&(this.notes.firstNote?this.notes.lastIndexes=this.notes.firstIndexes:this.notes.firstIndexes=this.notes.lastIndexes)}draw(){this.checkContext(),this.setRendered(),this.synchronizeIndexes();const t=this.getFirstX(),e=this.getLastX();return this.renderTie({firstX:t,lastX:e,firstYs:this.getFirstYs(),lastYs:this.getLastYs(),direction:this.getDirection()}),this.renderTieText(t,e),!0}}class de extends le{static get CATEGORY(){return"TabTie"}static createHammeron(t){return new de(t,"H")}static createPulloff(t){return new de(t,"P")}constructor(t,e){super(t,e),this.renderOptions.cp1=9,this.renderOptions.cp2=11,this.renderOptions.yShift=3,this.direction=-1}}var ue;!function(t){t[t.STRICT=1]="STRICT",t[t.SOFT=2]="SOFT",t[t.FULL=3]="FULL"}(ue||(ue={}));class ge extends P{static get CATEGORY(){return"Voice"}static get Mode(){return ue}constructor(t){let e;if(super(),this.resolutionMultiplier=1,this.mode=ue.STRICT,this.preFormatted=!1,this.ticksDirty=!1,this.ticksUsed=new y(0,1),this.largestTickWidth=0,this.tickables=[],this.options={softmaxFactor:$.SOFTMAX_FACTOR},"string"==typeof t){const i=t.length<=64?/^(\d+)\/(\d+)$/.exec(t):null;if(!i)throw new p("BadArgument","Invalid time signature. Expected positive integers such as 4/4.");e={numBeats:Number(i[1]),beatValue:Number(i[2])}}else e=t;this.time=Object.assign({numBeats:4,beatValue:4,resolution:$.RESOLUTION},e);const{numBeats:i,beatValue:s,resolution:n}=this.time;if(![i,s,n].every(t=>Number.isSafeInteger(t)&&t>0))throw new p("BadArgument","Meter and resolution must be positive safe integers.");const o=i*(n/s);if(!Number.isFinite(o)||o<=0||o>Number.MAX_SAFE_INTEGER)throw new p("BadArgument","Meter exceeds the supported tick range.");this.totalTicks=new y(o,1),this.smallestTickCount=this.totalTicks.clone()}getTotalTicks(){return this.refreshTicks(),this.totalTicks}getTicksUsed(){return this.refreshTicks(),this.ticksUsed}getLargestTickWidth(){return this.largestTickWidth}getSmallestTickCount(){return this.refreshTicks(),this.smallestTickCount}getTickables(){return this.tickables}getMode(){return this.mode}setMode(t){return this.mode=t,this}getResolutionMultiplier(){return this.refreshTicks(),this.resolutionMultiplier}getActualResolution(){return this.getResolutionMultiplier()*this.time.resolution}setStave(t){return this.stave=t,this}getStave(){return this.stave}getBoundingBox(){const t=this.tickables[0].getBoundingBox();for(let e=1;e<this.tickables.length;++e){const i=this.tickables[e];!i.getStave()&&this.stave&&i.setStave(this.stave);const s=i.getBoundingBox();t.mergeWith(s)}return t}setStrict(t){return this.mode=t?ue.STRICT:ue.SOFT,this}isComplete(){return this.refreshTicks(),this.mode!==ue.STRICT&&this.mode!==ue.FULL||this.ticksUsed.equals(this.totalTicks)}setSoftmaxFactor(t){return this.options.softmaxFactor=t,this.expTicksUsed=0,this}reCalculateExpTicksUsed(){const t=this.ticksUsed.value();return this.expTicksUsed=b(this.tickables.map(e=>Math.pow(this.options.softmaxFactor,e.getTicks().value()/t))),this.expTicksUsed}softmax(t){this.refreshTicks(),this.expTicksUsed||(this.expTicksUsed=this.reCalculateExpTicksUsed());const e=this.ticksUsed.value();return(t=>Math.pow(this.options.softmaxFactor,t/e))(t)/this.expTicksUsed}invalidateTicks(){this.ticksDirty=!0,this.expTicksUsed=void 0}refreshTicks(){if(this.ticksDirty){this.ticksUsed.set(0,1),this.totalTicks.set(this.time.numBeats*(this.time.resolution/this.time.beatValue),1),this.smallestTickCount=this.totalTicks.clone();for(const t of this.tickables){if(t.shouldIgnoreTicks())continue;const e=t.getTicks();this.ticksUsed.add(e),e.lessThan(this.smallestTickCount)&&(this.smallestTickCount=e.clone())}this.resolutionMultiplier=this.ticksUsed.denominator,this.totalTicks.add(0,this.resolutionMultiplier),this.ticksDirty=!1}}addTickable(t){if(this.refreshTicks(),!t.shouldIgnoreTicks()){const e=t.getTicks();if(this.ticksUsed.add(e),this.expTicksUsed=0,(this.mode===ue.STRICT||this.mode===ue.FULL)&&this.ticksUsed.greaterThan(this.totalTicks))throw this.ticksUsed.subtract(e),new p("BadArgument","Too many ticks.");e.lessThan(this.smallestTickCount)&&(this.smallestTickCount=e.clone()),this.resolutionMultiplier=this.ticksUsed.denominator,this.totalTicks.add(0,this.ticksUsed.denominator)}return this.tickables.push(t),t.setVoice(this),this}addTickables(t){for(let e=0;e<t.length;++e)this.addTickable(t[e]);return this}preFormat(){if(this.preFormatted)return this;const t=this.checkStave();return this.tickables.forEach(e=>{e.getStave()||e.setStave(t)}),this.preFormatted=!0,this}checkStave(){return f(this.stave,"NoStave","No stave attached to instance.")}draw(t=this.checkContext(),e){e=null!=e?e:this.stave,this.setRendered();for(let i=0;i<this.tickables.length;++i){const s=this.tickables[i];e&&s.setStave(e),f(s.getStave(),"MissingStave","The voice cannot draw tickables without staves."),s.setContext(t),s.drawWithStyle()}}}class pe extends W{static get CATEGORY(){return"GraceNoteGroup"}static format(t,e){if(!(null==t?void 0:t.length))return!1;const i=t.map(t=>{t.preFormat();const e=t.getNote(),i=t.getWidth()+(et(e)?4:0);return{group:t,note:e,width:i,after:t.position===W.Position.RIGHT}}),s=Math.max(0,...i.filter(t=>t.after).map(t=>t.width)),n=Math.max(0,...i.filter(t=>!t.after).map(t=>Math.max(t.width,t.note.getLeftDisplacedHeadPx())));for(const{group:t,width:o,after:a,note:r}of i)t.afterWidth=s,t.afterOffset=r.getGlyphWidth()+r.getRightDisplacedHeadPx()+e.rightShift+ce.minNoteheadPadding,t.setSpacingFromNextModifier((a?0:n-o)+ce.minNoteheadPadding);return e.leftShift+=n,e.rightShift+=s,!0}constructor(t,e){return super(),this.preFormatted=!1,this.afterWidth=0,this.afterOffset=0,this.position=W.Position.LEFT,this.graceNotes=t,this.width=0,this.showSlur=e,this.slur=void 0,this.voice=new ge({numBeats:4,beatValue:4,resolution:$.RESOLUTION}).setStrict(!1),this.renderOptions={slurYShift:0},this.beams=[],this.voice.addTickables(this.graceNotes),this}preFormat(){this.preFormatted||(this.formatter||(this.formatter=new Qe),this.formatter.joinVoices([this.voice]).format([this.voice],0,{}),this.setWidth(this.formatter.getMinTotalWidth()),this.preFormatted=!0)}beamNotes(t){if((t=t||this.graceNotes).length>1){const e=new Ft(t);e.renderOptions.beamWidth=3,e.renderOptions.partialBeamLength=4,this.beams.push(e)}return this}setWidth(t){return this.width=t,this}getWidth(){return this.width+ce.minNoteheadPadding}getGraceNotes(){return this.graceNotes}positionGraceNotes(){const t=this.checkAttachedNote();if(t.checkStave(),this.preFormat(),this.alignSubNotesWithNote(this.getGraceNotes(),t,this.position),this.afterWidth)for(const e of this.graceNotes){const i=e.getTickContext();i.setXOffset(this.position===W.Position.RIGHT?t.getTickContext().getX()+this.afterOffset:i.getXOffset()+this.afterWidth)}this.beams.forEach(t=>t.postFormat())}getBoundingBox(){if(0===this.graceNotes.length)return super.getBoundingBox();this.positionGraceNotes();const t=this.graceNotes[0].getBoundingBox();for(let e=1;e<this.graceNotes.length;e++)t.mergeWith(this.graceNotes[e].getBoundingBox());return t}getLayoutElements(){var t,e;const i=this.checkAttachedNote();if(this.positionGraceNotes(),this.showSlur&&this.graceNotes.length){const s=et(i),n=s?le:de,o=this.position===W.Position.RIGHT,a=o?this.graceNotes[this.graceNotes.length-1]:this.graceNotes[0];if((null===(t=this.slur)||void 0===t?void 0:t.getNotes().firstNote)===i&&(null===(e=this.slur)||void 0===e?void 0:e.getNotes().lastNote)===a||(this.slur=new n({lastNote:a,firstNote:i,firstIndexes:[0],lastIndexes:[0]})),this.afterWidth&&s){const t=i.getNoteHeadBeginX()+(o?i.getGlyphWidth():0);this.slur.renderOptions.firstXShift=t-i.getTieRightX()}else this.slur.renderOptions.firstXShift=0;this.slur.renderOptions.cp2=12,this.slur.renderOptions.yShift=(s?7:5)+this.renderOptions.slurYShift}return[...this.graceNotes,...this.beams,...this.slur?[this.slur]:[]]}draw(){const t=this.checkContext();this.setRendered(),function(...t){pe.DEBUG&&S("VexFlow.GraceNoteGroup",t)}("Drawing grace note group for:",this.checkAttachedNote()),this.getLayoutElements().forEach(e=>e.setContext(t).drawWithStyle())}}pe.DEBUG=!1;class me extends W{static get CATEGORY(){return"NoteSubGroup"}static format(t,e){if(!t||0===t.length)return!1;let i=0;for(let e=0;e<t.length;++e){const s=t[e];s.preFormat(),i+=s.getWidth()}return e.leftShift+=i,!0}constructor(t){super(),this.preFormatted=!1,this.position=W.Position.LEFT,this.subNotes=t,this.subNotes.forEach(t=>{t.setIgnoreTicks(!1)}),this.width=0,this.formatter=new Qe,this.voice=new ge({numBeats:4,beatValue:4,resolution:$.RESOLUTION}).setStrict(!1),this.voice.addTickables(this.subNotes)}preFormat(){this.preFormatted||(this.formatter.joinVoices([this.voice]).format([this.voice],0),this.setWidth(this.formatter.getMinTotalWidth()),this.preFormatted=!0)}setWidth(t){return this.width=t,this}getWidth(){return this.width}draw(){const t=this.checkContext(),e=this.checkAttachedNote();this.setRendered(),this.alignSubNotesWithNote(this.subNotes,e),this.subNotes.forEach(e=>e.setContext(t).drawWithStyle())}}class fe extends W{static get CATEGORY(){return"Ornament"}static get minPadding(){return B.get("NoteHead.minPadding")}static format(t,e){var i,s;if(!t||0===t.length)return!1;let n=0,o=e.rightShift,a=e.leftShift;for(let r=0;r<t.length;++r){const h=t[r],c=2;if(h.sideOffset=0,h.position===R.RIGHT)h.sideOffset=o+2,o+=h.width+fe.minPadding;else if(h.position===R.LEFT)h.sideOffset=-(a+h.width+2),a+=h.width+fe.minPadding;else if(h.position===R.ABOVE){n=Math.max(h.getWidth(),n);const t=h.getNote();let o=t.getLineNumber(!0)+e.topTextLine;const a=t.getStem();a&&t.getStemDirection()===at.UP&&(o+=Math.abs(a.getHeight())/$.STAVE_LINE_DISTANCE);const r=null!==(s=null===(i=t.getStave())||void 0===i?void 0:i.getNumLines())&&void 0!==s?s:0;o<r&&(e.topTextLine+=r-o),h.setTextLine(e.topTextLine),e.topTextLine+=c}else n=Math.max(h.getWidth(),n),h.setTextLine(e.textLine),e.textLine+=c}return e.leftShift=a+n/2,e.rightShift=o+n/2,!0}static get ornamentNoteTransition(){return["flip","jazzTurn","smear"]}static get ornamentAttack(){return["scoop"]}static get ornamentAlignWithNoteHead(){return["doit","fall","fallLong","doitLong","scoop"]}static get ornamentRelease(){return["doit","fall","fallLong","doitLong","jazzTurn","smear","flip"]}static get ornamentLeft(){return["scoop"]}static get ornamentRight(){return["doit","fall","fallLong","doitLong"]}static get ornamentYShift(){return["fallLong"]}static get ornamentArticulation(){return["bend","plungerClosed","plungerOpen"]}constructor(t){super(),this.sideOffset=0,this.position=R.ABOVE,fe.ornamentRight.indexOf(t)>=0&&(this.position=R.RIGHT),fe.ornamentLeft.indexOf(t)>=0&&(this.position=R.LEFT),this.type=t,this.delayed=!1,this.renderOptions={accidentalLowerPadding:3,accidentalUpperPadding:3},this.adjustForStemDirection=!1,this.ornamentAlignWithNoteHead=fe.ornamentAlignWithNoteHead.indexOf(this.type)>=0,fe.ornamentNoteTransition.indexOf(this.type)>=0&&(this.delayed=!0),this.text=$.ornamentCodes(this.type)}setNote(t){return super.setNote(t),fe.ornamentArticulation.indexOf(this.type)>=0&&(t.getLineNumber()>=3?this.position=W.Position.ABOVE:this.position=W.Position.BELOW),this}setDelayed(t){return this.delayed=t,this}setUpperAccidental(t){return this.accidentalUpper=new P,this.accidentalUpper.setText($.accidentalCodes(t)),this}setLowerAccidental(t){return this.accidentalLower=new P,this.accidentalLower.setText($.accidentalCodes(t)),this}positionElements(){const t=this.checkAttachedNote(),e=t.checkStave(),i=[],s=t.getModifierStartXY(this.position,this.index);let n=s.x+this.sideOffset;const o=e.getSpacingBetweenLines(),a=wt(t,this.position);let r=this.ornamentAlignWithNoteHead?s.y:0;if(this.position===R.ABOVE&&(r=St(t,this.textLine)-(this.textLine+a)*o),this.position===R.BELOW&&(r=xt(t,this.textLine)+(this.textLine+a+1.5)*o),this.delayed){let i=0;const s=t.getTickContext().getX();if(void 0!==this.delayXShift)i=this.delayXShift;else{const o=t.getVoice().getTickables(),a=o.indexOf(t),r=a+1<o.length?o[a+1].checkTickContext():void 0;i+=r?.5*(r.getX()-s):.5*(e.getX()+e.getWidth()-n)}n+=i}!function(...t){fe.DEBUG&&S("VexFlow.Ornament",t)}("Rendering ornament: ",this.text.charCodeAt(0),n,r),this.accidentalLower&&(i.push({element:this.accidentalLower,x:n+this.xShift-this.accidentalLower.getWidth()/2,y:r+this.yShift-this.accidentalLower.getTextMetrics().actualBoundingBoxDescent}),r-=this.accidentalLower.getHeight()+this.renderOptions.accidentalLowerPadding);const h=fe.ornamentYShift.includes(this.type)?this.getHeight():0;return this.x=n-(this.position===R.ABOVE||this.position===R.BELOW?this.width/2:0),this.y=r+h,i.push({element:this,x:0,y:0}),this.accidentalUpper&&i.push({element:this.accidentalUpper,x:n+this.xShift-this.accidentalUpper.getWidth()/2,y:this.y+this.yShift-this.getHeight()-this.renderOptions.accidentalUpperPadding-this.accidentalUpper.getTextMetrics().actualBoundingBoxDescent}),i}getBoundingBox(){return this.positionElements().map(({element:t,x:e,y:i})=>t.getTextInk(e+t.getX(),i+t.getY())).reduce((t,e)=>t.mergeWith(e))}draw(){const t=this.checkContext();this.setRendered();const e=this.getAttribute("class");t.openGroup("ornament"+(e?" "+e:""),this.getAttribute("id"));for(const{element:e,x:i,y:s}of this.positionElements())e.renderText(t,i,s);this.drawPointerRect(),t.closeGroup()}}fe.DEBUG=!1;class Se extends W{static get CATEGORY(){return"Parenthesis"}static buildAndAttach(t){for(const e of t)for(let t=0;t<e.keys.length;t++)e.addModifier(new Se(R.LEFT),t),e.addModifier(new Se(R.RIGHT),t)}static format(t,e){if(!t||0===t.length)return!1;let i=0,s=0;for(let e=0;e<t.length;++e){const n=t[e],o=n.getNote(),a=n.getPosition(),r=n.checkIndex();let h=0;a===R.RIGHT&&(h=o.getRightParenthesisPx(r),s=s>h+n.width?s:h+n.width),a===R.LEFT&&(h=o.getLeftParenthesisPx(r)+n.width,i=i>h+n.width?i:h+n.width),n.setXShift(h)}return e.leftShift+=i,e.rightShift+=s,!0}constructor(t){super(),this.position=null!=t?t:W.Position.LEFT,this.position===W.Position.RIGHT?this.text="":this.position===W.Position.LEFT&&(this.text="")}setNote(t){return this.note=t,this.setFont(t.fontInfo),this}draw(){const t=this.checkContext(),e=this.checkAttachedNote();this.setRendered();const i=e.getModifierStartXY(this.position,this.index,{forceFlagRight:!0});this.renderText(t,i.x,i.y)}}function xe(t="normal"){return"normal"===t?"400":"bold"===t?"700":String(t)}function we(t,e){let i=t;for(;i;){const t=i.getAttribute(e);if(null!==t)return t;i=i.parentElement}return null}function Te(t,e){var i,s,n,o,a,r,h,c;const l=(null!==(i=we(t,"font-family"))&&void 0!==i?i:"").split(",").map(t=>t.trim().replace(/^['"]|['"]$/g,"").toLowerCase()),d=xe(null!==(s=we(t,"font-weight"))&&void 0!==s?s:"normal"),u=null!==(n=we(t,"font-style"))&&void 0!==n?n:"normal",g=l.map(t=>e.find(e=>{var i;return e.family.toLowerCase()===t&&xe(e.weight)===d&&(null!==(i=e.style)&&void 0!==i?i:"normal")===u})),m=A.convertSizeToPixelValue(null!==(o=we(t,"font-size"))&&void 0!==o?o:"10pt");let f=Number(null!==(a=t.getAttribute("x"))&&void 0!==a?a:0);const S=Number(null!==(r=t.getAttribute("y"))&&void 0!==r?r:0);let x,w="",T="";function b(){x&&T&&(w+=x.getPath(T,f,S,m).toPathData(5),f+=x.getAdvanceWidth(T,m),T="")}for(const e of null!==(h=t.textContent)&&void 0!==h?h:""){const t=null===(c=g.find(t=>t&&t.font.charToGlyphIndex(e)>0))||void 0===c?void 0:c.font;if(!t)throw new p("MissingFont",`No outline for ${JSON.stringify(e)} in ${l.join(", ")} (${d} ${u}).`);t!==x&&(b(),x=t),T+=e}return b(),w}const be={path:{x:!0,y:!0,width:!0,height:!0,"font-family":!0,"font-weight":!0,"font-style":!0,"font-size":!0},rect:{"font-family":!0,"font-weight":!0,"font-style":!0,"font-size":!0},text:{width:!0,height:!0}},ye=2*Math.PI;class ve extends bt{static toSVG(t,e){var i,s;const n=void 0===e?t:function(t,e){const i=t.cloneNode(!0);for(const t of Array.from(i.querySelectorAll("text"))){if(t.children.length)throw new p("BadArgument","Portable export expects plain SVGContext text.");const s=i.ownerDocument.createElementNS("http://www.w3.org/2000/svg","path");for(const e of Array.from(t.attributes))"x"===e.name||"y"===e.name||e.name.startsWith("font-")||s.setAttribute(e.name,e.value);s.setAttribute("d",Te(t,e)),t.replaceWith(s)}return i}(t,e);return(new(null!==(s=null===(i=t.ownerDocument.defaultView)||void 0===i?void 0:i.XMLSerializer)&&void 0!==s?s:XMLSerializer)).serializeToString(n)}toSVG(t){return ve.toSVG(this.svg,t)}constructor(t){super(),this.width=0,this.height=0,this.precision=1,this.backgroundFillStyle="white",this.fontCSSString="",this.element=t,this.precision=Math.pow(10,$.RENDER_PRECISION_PLACES);const e=this.create("svg");e.setAttribute("pointer-events","none"),this.element.appendChild(e),this.svg=e,this.parent=this.svg,this.groups=[this.svg],this.path="",this.pen={x:NaN,y:NaN};const i={"font-family":B.get("fontFamily"),"font-size":"10pt","font-weight":E.NORMAL,"font-style":L.NORMAL};this.state=Object.assign({scaleX:1,scaleY:1},i),this.attributes=Object.assign({"stroke-width":1,"stroke-dasharray":"none",fill:"black",stroke:"black",shadowBlur:0,shadowColor:"black"},i),this.groupAttributes=[],this.applyAttributes(e,this.attributes),this.groupAttributes.push(Object.assign({},this.attributes)),this.stateStack=[]}round(t){return Math.round(t*this.precision)/this.precision}create(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}openGroup(t,e){const i=this.create("g");return this.groups.push(i),this.parent.appendChild(i),this.parent=i,t&&i.setAttribute("class",w(t)),e&&i.setAttribute("id",w(e)),this.applyAttributes(i,this.attributes),this.groupAttributes.push(Object.assign(Object.assign({},this.groupAttributes[this.groupAttributes.length-1]),this.attributes)),i}closeGroup(){this.groups.pop(),this.groupAttributes.pop(),this.parent=this.groups[this.groups.length-1]}openRotation(t,e,i){this.openGroup().setAttribute("transform",`translate(${e},${i}) rotate(${t}) translate(-${e},-${i})`)}closeRotation(){this.closeGroup()}add(t){this.parent.appendChild(t)}setFillStyle(t){return this.attributes.fill=t,this}setBackgroundFillStyle(t){return this.backgroundFillStyle=t,this}setStrokeStyle(t){return this.attributes.stroke=t,this}setShadowColor(t){return this.attributes.shadowColor=t,this}setShadowBlur(t){return this.attributes.shadowBlur=t,this}setLineWidth(t){return this.attributes["stroke-width"]=t,this}setLineDash(t){if("[object Array]"===Object.prototype.toString.call(t))return this.attributes["stroke-dasharray"]=t.join(","),this;throw new p("ArgumentError","lineDash must be an array of integers.")}setLineCap(t){return this.attributes["stroke-linecap"]=t,this}resize(t,e){this.width=t,this.height=e,this.element.style.width=`${t}px`,this.svg.style.width=`${t}px`,this.svg.style.height=`${e}px`;const i={width:t,height:e};return this.applyAttributes(this.svg,i),this.scale(this.state.scaleX,this.state.scaleY),this}scale(t,e){this.state.scaleX=this.state.scaleX?this.state.scaleX*t:t,this.state.scaleY=this.state.scaleY?this.state.scaleY*e:e;const i=this.width/this.state.scaleX,s=this.height/this.state.scaleY;return this.setViewBox(0,0,i,s),this}setViewBox(t,e,i,s){if("string"==typeof t)this.svg.setAttribute("viewBox",t);else{const n=t+" "+e+" "+i+" "+s;this.svg.setAttribute("viewBox",n)}}applyAttributes(t,e){const i=be[t.nodeName];for(const s in e)i&&i[s]||!e[s]||0!==this.groupAttributes.length&&e[s]==this.groupAttributes[this.groupAttributes.length-1][s]||t.setAttributeNS(null,s,e[s]);return t}clear(){for(;this.svg.lastChild;)this.svg.removeChild(this.svg.lastChild)}rect(t,e,i,s,n){s<0&&(e+=s,s*=-1);const o=this.create("rect");return n=null!=n?n:{fill:"none","stroke-width":this.attributes["stroke-width"],stroke:"black"},t=this.round(t),e=this.round(e),i=this.round(i),s=this.round(s),this.applyAttributes(o,Object.assign({x:t,y:e,width:i,height:s},n)),this.add(o),this}fillRect(t,e,i,s){const n={fill:this.attributes.fill,stroke:"none"};return this.rect(t,e,i,s,n),this}pointerRect(t,e,i,s){return this.rect(t,e,i,s,{opacity:"0","pointer-events":"auto"}),this}clearRect(t,e,i,s){return this.rect(t,e,i,s,{fill:this.backgroundFillStyle,stroke:"none"}),this}beginPath(){return this.path="",this.pen.x=NaN,this.pen.y=NaN,this}moveTo(t,e){return t=this.round(t),e=this.round(e),this.path+="M"+t+" "+e,this.pen.x=t,this.pen.y=e,this}lineTo(t,e){return t=this.round(t),e=this.round(e),this.path+="L"+t+" "+e,this.pen.x=t,this.pen.y=e,this}bezierCurveTo(t,e,i,s,n,o){return n=this.round(n),o=this.round(o),t=this.round(t),e=this.round(e),i=this.round(i),s=this.round(s),this.path+="C"+t+" "+e+","+i+" "+s+","+n+" "+o,this.pen.x=n,this.pen.y=o,this}quadraticCurveTo(t,e,i,s){return i=this.round(i),s=this.round(s),t=this.round(t),e=this.round(e),this.path+="Q"+t+" "+e+","+i+" "+s,this.pen.x=i,this.pen.y=s,this}arc(t,e,i,s,n,o){let a=t+i*Math.cos(s),r=e+i*Math.sin(s);a=this.round(a),r=this.round(r);const h=T(s),c=T(n);if(!o&&n-s>=ye||o&&s-n>=ye||h===c){let n=t+i*Math.cos(s+Math.PI),o=e+i*Math.sin(s+Math.PI);n=this.round(n),o=this.round(o),i=this.round(i),this.path+=`M${a} ${r} A${i} ${i} 0 0 0 ${n} ${o} `,this.path+=`A${i} ${i} 0 0 0 ${a} ${r}`,this.pen.x=a,this.pen.y=r}else{let l,d=t+i*Math.cos(n),u=e+i*Math.sin(n);s=h,n=c,l=Math.abs(n-s)<Math.PI?o:!o,s>n&&(l=!l);const g=!o;d=this.round(d),u=this.round(u),i=this.round(i),this.path+=`M${a} ${r} A${i} ${i} 0 ${+l} ${+g} ${d} ${u}`,this.pen.x=d,this.pen.y=u}return this}closePath(){return this.path+="Z",this}getShadowStyle(){return`filter: drop-shadow(0 0 ${this.attributes.shadowBlur/1.5}px ${this.attributes.shadowColor})`}fill(t){const e=this.create("path");return void 0===t&&(t=Object.assign(Object.assign({},this.attributes),{stroke:"none"})),t.d=this.path,this.attributes.shadowBlur>0&&(t.style=this.getShadowStyle()),this.applyAttributes(e,t),this.add(e),this}stroke(){const t=this.create("path"),e=Object.assign(Object.assign({},this.attributes),{fill:"none",d:this.path});return this.attributes.shadowBlur>0&&(e.style=this.getShadowStyle()),this.applyAttributes(t,e),this.add(t),this}measureText(t){ve.measureTextElement.setText(t),ve.measureTextElement.setFont(this.attributes["font-family"],this.attributes["font-size"],this.attributes["font-weight"],this.attributes["font-style"]);const e=ve.measureTextElement.getBoundingBox();return{x:e.x,y:e.y,width:e.w,height:e.h}}fillText(t,e,i){if(!t||t.length<=0)return this;e=this.round(e),i=this.round(i);const s=Object.assign(Object.assign({},this.attributes),{stroke:"none",x:e,y:i}),n=this.create("text");return n.textContent=t,this.applyAttributes(n,s),this.add(n),this}save(){return this.stateStack.push({state:g(this.state),attributes:g(this.attributes)}),this}restore(){const t=this.stateStack.pop();if(t){const e=t;this.state=g(e.state),this.attributes=g(e.attributes)}return this}set fillStyle(t){this.setFillStyle(t)}get fillStyle(){return this.attributes.fill}set strokeStyle(t){this.setStrokeStyle(t)}get strokeStyle(){return this.attributes.stroke}setFont(t,e,i,s){const n=A.validate(t,e,i,s);this.fontCSSString=A.toCSSString(n);const o={"font-family":n.family,"font-size":n.size,"font-weight":n.weight,"font-style":n.style};return this.attributes=Object.assign(Object.assign({},this.attributes),o),this.state=Object.assign(Object.assign({},this.state),o),this}getFont(){return this.fontCSSString}}var ke,Be;ve.measureTextElement=new P,function(t){t[t.CANVAS=1]="CANVAS",t[t.SVG=2]="SVG"}(ke||(ke={})),function(t){t[t.NONE=1]="NONE",t[t.UP=2]="UP",t[t.DOWN=3]="DOWN"}(Be||(Be={}));class Ce{static buildContext(t,e,i,s,n="#FFF"){const o=new Ce(t,e);i&&s&&o.resize(i,s);const a=o.getContext();return a.setBackgroundFillStyle(n),Ce.lastContext=a,a}static getCanvasContext(t,e,i,s){return Ce.buildContext(t,Ce.Backends.CANVAS,e,i,s)}static getSVGContext(t,e,i,s){return Ce.buildContext(t,Ce.Backends.SVG,e,i,s)}static drawDashedLine(t,e,i,s,n,o){t.beginPath();const a=s-e,r=n-i,h=Math.atan2(r,a);let c=e,l=i;t.moveTo(e,i);let d=0,u=!0;for(;!(a<0?c<=s:c>=s)||!(r<0?l<=n:l>=n);){const e=o[d++%o.length],i=c+Math.cos(h)*e;c=a<0?Math.max(s,i):Math.min(s,i);const g=l+Math.sin(h)*e;l=r<0?Math.max(n,g):Math.min(n,g),u?t.lineTo(c,l):t.moveTo(c,l),u=!u}t.closePath(),t.stroke()}constructor(t,e){if(K(t,"RenderContext"))this.ctx=t;else{if(void 0===e)throw new p("InvalidArgument","Missing backend argument");const i=e;let s;if("string"==typeof t){const e=document.getElementById(t);if(!e)throw new p("BadElementId",`Can't find element with ID "${e}"`);s=e}else s=t;if(i===Ce.Backends.CANVAS){if(!Pt(s))throw new p("BadElement","CANVAS context requires an HTMLCanvasElement.");const t=s.getContext("2d",{willReadFrequently:!0});if(!t)throw new p("BadElement","Can't get canvas context");this.ctx=new Rt(t)}else{if(i!==Ce.Backends.SVG)throw new p("InvalidBackend",`No support for backend: ${i}`);if(!function(t){if(!t)return!1;const e=m();return"function"==typeof e.HTMLDivElement&&t instanceof e.HTMLDivElement||"function"==typeof t.appendChild&&"object"==typeof t.style}(s))throw new p("BadElement","SVG context requires an HTMLDivElement.");this.ctx=new ve(s)}}}resize(t,e){return this.ctx.resize(t,e),this}getContext(){return this.ctx}}Ce.Backends=ke,Ce.LineEndType=Be,Ce.lastContext=void 0;class De extends W{static get CATEGORY(){return"StringNumber"}static format(t,e){const i=e.leftShift,s=e.rightShift;if(!t||0===t.length)return!1;const n=[];let o=null,a=0,r=0;for(let i=0;i<t.length;++i){const h=t[i],c=h.getNote(),l=h.getPosition();if(!et(c))throw new p("NoStaveNote");const d=h.checkIndex(),u=c.getKeyProps()[d],g=c.getModifierContext(),m=2*h.radius/$.STAVE_LINE_DISTANCE+.5;if(g&&(l===R.ABOVE?(h.textLine=g.getState().topTextLine,e.topTextLine+=m):l===R.BELOW&&(h.textLine=g.getState().textLine,e.textLine+=m)),c!==o){for(let t=0;t<c.keys.length;++t)l===W.Position.LEFT&&(a=Math.max(c.getLeftDisplacedHeadPx(),a)),0===s&&(r=Math.max(c.getRightDisplacedHeadPx(),r));o=c}const f=u.line;n.push({pos:l,note:c,num:h,line:f,shiftL:a,shiftR:r})}n.sort((t,e)=>e.line-t.line);let h=0,c=0,l=0,d=null,u=null;for(let t=0;t<n.length;++t){const e=n[t].note,o=n[t].pos,r=n[t].num,g=n[t].line,p=n[t].shiftR;g===d&&e===u||(h=s+p);const m=r.getWidth()+1;let f=0;o===W.Position.LEFT?(r.setXShift(i+a),f=m,c=Math.max(f,c)):o===W.Position.RIGHT&&(r.setXShift(h),f+=m,l=f>l?f:l),d=g,u=e}return e.leftShift+=c,e.rightShift+=l,!0}constructor(t){super(),this.stringNumber=t,this.position=W.Position.ABOVE,this.xShift=0,this.yShift=0,this.textLine=0,this.stemOffset=0,this.xOffset=0,this.yOffset=0,this.dashed=!0,this.leg=Ce.LineEndType.NONE,this.radius=8,this.drawCircle=!0,this.setWidth(2*this.radius+4)}setLineEndType(t){return t>=Ce.LineEndType.NONE&&t<=Ce.LineEndType.DOWN&&(this.leg=t),this}setStringNumber(t){return this.stringNumber=t,this}setOffsetX(t){return this.xOffset=t,this}setOffsetY(t){return this.yOffset=t,this}setLastNote(t){return this.lastNote=t,this}setDashed(t){return this.dashed=t,this}setDrawCircle(t){return this.drawCircle=t,this}draw(){const t=this.checkContext(),e=this.checkAttachedNote();this.setRendered();const i=e.getModifierStartXY(this.position,this.index),s=e.hasStem()?e.getStemDirection():at.UP;let n=i.x+this.xShift+this.xOffset,o={};e.hasStem()&&(o=e.checkStem().getExtents());let a=i.y+this.yShift+this.yOffset;switch(this.position){case W.Position.ABOVE:a=e.getYs().reduce((t,e)=>t<e?t:e),e.hasStem()&&s===at.UP&&(a=o.topY+B.get("StringNumber.stemPadding")),a-=this.radius+B.get("StringNumber.verticalPadding")+this.textLine*$.STAVE_LINE_DISTANCE;break;case W.Position.BELOW:a=e.getYs().reduce((t,e)=>t>e?t:e),e.hasStem()&&s===at.DOWN&&(a=o.topY-B.get("StringNumber.stemPadding")),a+=this.radius+B.get("StringNumber.verticalPadding")+this.textLine*$.STAVE_LINE_DISTANCE;break;case W.Position.LEFT:n-=this.radius/2+B.get("StringNumber.leftPadding");break;case W.Position.RIGHT:n+=this.radius/2+B.get("StringNumber.rightPadding");break;default:throw new p("InvalidPosition",`The position ${this.position} is invalid`)}this.drawCircle&&(t.beginPath(),t.arc(n,a,this.radius,0,2*Math.PI,!1),t.setLineWidth(1.5),t.stroke()),t.setFont(this.fontInfo);const r=n-t.measureText(this.stringNumber).width/2;t.fillText(""+this.stringNumber,r,a+4.5);const h=this.lastNote;if(it(h)){const i=h.getStemX()-e.getX()+5;let s,o;switch(t.setLineCap("round"),t.setLineWidth(.6),this.dashed?Ce.drawDashedLine(t,n+10,a,n+i,a,[3,3]):Ce.drawDashedLine(t,n+10,a,n+i,a,[3,0]),this.leg){case Ce.LineEndType.UP:s=-10,o=this.dashed?[3,3]:[3,0],Ce.drawDashedLine(t,n+i,a,n+i,a+s,o);break;case Ce.LineEndType.DOWN:s=10,o=this.dashed?[3,3]:[3,0],Ce.drawDashedLine(t,n+i,a,n+i,a+s,o)}}}}class Ee extends W{static get CATEGORY(){return"Stroke"}static format(t,e){const i=e.leftShift;if(!t||0===t.length)return!1;const s=t.map(t=>{const e=t.getNote(),i=t.checkIndex();if(et(e)){const{line:s}=e.getKeyProps()[i];return{line:s,shift:e.getLeftDisplacedHeadPx(),stroke:t}}if(st(e)){const{str:s}=e.getPositions()[i];return{line:s,shift:0,stroke:t}}throw new p("Internal","Unexpected instance.")}),n=i,o=s.reduce((t,{stroke:e,shift:i})=>(e.setXShift(n+i),Math.max(e.getWidth()+5,t)),0);return e.leftShift+=o,!0}constructor(t,e){super(),this.boundingBox=new D(0,0,0,0),this.options=Object.assign({allVoices:!0},e),this.allVoices=this.options.allVoices,this.type=t,this.position=W.Position.LEFT,this.renderOptions={fontScale:B.get("Stroke.fontSize")},this.setXShift(0),this.setWidth(10)}getPosition(){return this.position}addEndNote(t){return this.noteEnd=t,this}draw(){const t=this.checkContext(),e=this.checkAttachedNote();this.setRendered();const i=e.getModifierStartXY(this.position,this.index);let s=e.getYs(),n=i.y,o=i.y;const a=i.x-5,r=e.checkStave().getSpacingBetweenLines(),h=this.checkModifierContext().getMembers(e.getCategory());for(let t=0;t<h.length;t++){const e=h[t];if(tt(e)){s=e.getYs();for(let e=0;e<s.length;e++)(this.note===h[t]||this.allVoices)&&(n=Math.min(n,s[e]),o=Math.max(o,s[e]))}}let c="",l=0,d=0;switch(this.type){case Ee.Type.BRUSH_DOWN:case Ee.Type.ROLL_DOWN:case Ee.Type.RASGUEADO_DOWN:c=I.arrowheadBlackUp,l=n,n-=r/2,o+=r/2;break;case Ee.Type.BRUSH_UP:case Ee.Type.ROLL_UP:case Ee.Type.RASGUEADO_UP:c=I.arrowheadBlackDown,l=o+r,n-=r/2;break;case Ee.Type.ARPEGGIO_DIRECTIONLESS:n-=r/2,o+=r/2;break;default:throw new p("InvalidType",`The stroke type ${this.type} does not exist`)}if(this.type===Ee.Type.BRUSH_DOWN||this.type===Ee.Type.BRUSH_UP)t.fillRect(a+this.xShift,n,1,o-n),this.boundingBox=new D(a+this.xShift,n,1,o-n);else{const e=c===I.arrowheadBlackDown?I.wiggleArpeggiatoDown:I.wiggleArpeggiatoUp;let i="";const s=new P;for(;s.getWidth()<o-n;)i+=e,s.setText(i);this.type===Ee.Type.RASGUEADO_DOWN||this.type===Ee.Type.ROLL_DOWN||this.type===Ee.Type.ARPEGGIO_DIRECTIONLESS?(t.openRotation(90,a+this.xShift,n),s.renderText(t,a+this.xShift,n-s.getTextMetrics().actualBoundingBoxDescent+s.getHeight()/2),t.closeRotation(),d=n+s.getWidth()+5,this.boundingBox=new D(a+this.xShift-s.getHeight()/2,n-s.getTextMetrics().actualBoundingBoxDescent+s.getHeight()/2,s.getHeight(),s.getWidth())):(t.openRotation(-90,a+this.xShift,o),s.renderText(t,a+this.xShift,o-s.getTextMetrics().actualBoundingBoxDescent+s.getHeight()/2),t.closeRotation(),d=o-s.getWidth()-5,this.boundingBox=new D(a+this.xShift-s.getHeight()/2,o-s.getTextMetrics().actualBoundingBoxDescent+s.getHeight()/2-s.getWidth(),s.getHeight(),s.getWidth()))}if(0!==l){const e=new P;e.setText(c),e.renderText(t,a+this.xShift-e.getWidth()/2,l),this.boundingBox.mergeWith(new D(a+this.xShift-e.getWidth()/2,l-e.getHeight(),e.getWidth(),e.getHeight()))}if(this.type===Ee.Type.RASGUEADO_DOWN||this.type===Ee.Type.RASGUEADO_UP){const e=new P("Stroke.text");e.setText("R"),e.renderText(t,a+this.xShift-e.getWidth()/2,d+(this.type===Ee.Type.RASGUEADO_DOWN?e.getHeight():0)),this.boundingBox.mergeWith(new D(a+this.xShift-e.getWidth()/2,d+(this.type===Ee.Type.RASGUEADO_DOWN?e.getHeight():0)-e.getHeight(),e.getWidth(),e.getHeight()))}}getBoundingBox(){return this.boundingBox}}Ee.Type={BRUSH_DOWN:1,BRUSH_UP:2,ROLL_DOWN:3,ROLL_UP:4,RASGUEADO_DOWN:5,RASGUEADO_UP:6,ARPEGGIO_DIRECTIONLESS:7};class Le extends W{static get CATEGORY(){return"Vibrato"}static format(t,e,i){if(!t||0===t.length)return!1;let s=e.topTextLine,n=0,o=e.rightShift-7;const a=i.getMembers(Mt.CATEGORY);if(a&&a.length>0){s-=a.map(t=>t.getTextHeight()).reduce((t,e)=>t>e?t:e)/$.STAVE_LINE_DISTANCE+1}else e.topTextLine+=1;for(let e=0;e<t.length;++e){const i=t[e];i.setXShift(o),i.setTextLine(s),n+=i.getWidth(),o+=n}return e.rightShift+=n,!0}constructor(){super(),this.position=W.Position.RIGHT,this.renderOptions={code:60080,width:20},this.setVibratoWidth(this.renderOptions.width)}setVibratoWidth(t){this.renderOptions.width=t,this.text=String.fromCodePoint(this.renderOptions.code);const e=this.getWidth();if(!e)throw new p("Cannot set vibrato width if width is 0");const i=Math.round(this.renderOptions.width/e);for(let t=1;t<i;t++)this.text+=String.fromCodePoint(this.renderOptions.code);return this}setVibratoCode(t){return this.renderOptions.code=t,this.setVibratoWidth(this.renderOptions.width)}draw(){const t=this.checkContext(),e=this.checkAttachedNote();this.setRendered();const i=e.getModifierStartXY(W.Position.RIGHT,this.index).x,s=e.getYForTopText(this.textLine)+5;this.renderText(t,i,s)}}function Ne(...t){Oe.DEBUG&&S("VexFlow.ModifierContext",t)}class Oe{constructor(){this.state={leftShift:0,rightShift:0,textLine:0,topTextLine:0},this.members={},this.preFormatted=!1,this.postFormatted=!1,this.formatted=!1,this.width=0,this.spacing=0,this.annotationRightShift=0,this.measuredTopLines=0,this.measuredBottomLines=0}addModifier(t){return Ne("addModifier is deprecated, use addMember instead."),this.addMember(t)}addMember(t){const e=t.getCategory();return this.members[e]||(this.members[e]=[]),this.members[e].push(t),t.setModifierContext(this),this.preFormatted=!1,this}getModifiers(t){return Ne("getModifiers is deprecated, use getMembers instead."),this.getMembers(t)}getMembers(t){var e;return null!==(e=this.members[t])&&void 0!==e?e:[]}getWidth(){return this.width}getLeftShift(){return this.state.leftShift}getRightShift(){return this.state.rightShift}getRightShiftForTie(){return this.state.rightShift-this.annotationRightShift}getUnmeasuredTextLines(t){return t?this.state.topTextLine-this.measuredTopLines:this.state.textLine-this.measuredBottomLines}getState(){return this.state}getMetrics(){if(!this.formatted)throw new p("UnformattedMember","Unformatted member has no metrics.");return{width:this.state.leftShift+this.state.rightShift+this.spacing,spacing:this.spacing}}preFormat(){var t;if(this.preFormatted)return;Ne("Preformatting ModifierContext");const e=this.state,i=this.members;ce.format(i.StaveNote,e),Se.format(i.Parenthesis,e),se.format(i.Dot,e),ne.format(i.FretHandFinger,e),ot.format(i.Accidental,e),Ee.format(i.Stroke,e),pe.format(i.GraceNoteGroup,e),me.format(i.NoteSubGroup,e),De.format(i.StringNumber,e),Tt.format(i.Articulation,e),fe.format(i.Ornament,e);const s=null!==(t=i.Annotation)&&void 0!==t?t:[],n=t=>t.getVerticalJustification()===ct.VerticalJustify.TOP||t.getVerticalJustification()===ct.VerticalJustify.BOTTOM;ct.format(s.filter(t=>!n(t)),e);const o=e.rightShift,a=e.topTextLine,r=e.textLine;ct.format(s.filter(n),e);const h=e.topTextLine,c=e.textLine,l=e.rightShift;e.rightShift=o,Kt.format(i.ChordSymbol,e),Mt.format(i.Bend,e),Le.format(i.Vibrato,e,this),this.measuredTopLines=e.topTextLine===h?h-a:0,this.measuredBottomLines=e.textLine===c?c-r:0,this.annotationRightShift=Math.max(0,l-e.rightShift),e.rightShift+=this.annotationRightShift,this.width=e.leftShift+e.rightShift,this.preFormatted=!0}postFormat(){this.postFormatted||(Ne("Postformatting ModifierContext"),ce.postFormat(this.getMembers("StaveNote")))}}Oe.DEBUG=!1;const Ae=1e-7;function Fe(t){return(Math.ceil(100*t)/100).toFixed(2)}class Me{constructor(t,e){var i,s;this.origin=0,this.tail=2,this.minimumScale=0,this.centeredWidth=0;const n=t[0].getActualResolution()/t[0].getResolutionMultiplier();this.quarterTicks=n/4;let o=t[0].getTotalTicks().value();for(const i of t){if(i.getActualResolution()/i.getResolutionMultiplier()!==n)throw new p("BadArgument","Proportional voices must use the same tick resolution.");o=Math.max(o,i.getTicksUsed().value());for(const t of i.getTickables()){if(t.shouldIgnoreTicks())continue;const i=t.getTicks();if(i.value()<=0)throw new p("BadArgument","Rhythmic durations must be positive.");e=y.LCM(e,i.denominator)}}if(!Number.isSafeInteger(e)||e<=0)throw new p("BadArgument","Proportional timeline exceeds the supported rational tick range.");this.duration=o/this.quarterTicks;const a=new Map;for(const[n,o]of t.entries()){const t=new y(0,e);for(const e of o.getTickables()){const o=t.numerator;if(!Number.isSafeInteger(o))throw new p("BadArgument","Proportional timeline exceeds the supported rational tick range.");let r=a.get(o);if(r||(r={tick:o,context:new Zt({tickID:o}),prefixes:[],extents:new Map},a.set(o,r)),e.shouldIgnoreTicks()){(null!==(i=(s=r.prefixes)[n])&&void 0!==i?i:s[n]={contexts:[]}).contexts.push(new Zt({tickID:o}).addTickable(e,n))}else r.context.addTickable(e,n),t.add(e.getTicks())}}this.anchors=[...a.values()].sort((t,e)=>t.tick-e.tick);const r={},h=[];for(const t of this.anchors)r[t.tick]=t.context,t.prefixes.forEach(t=>h.push(...t.contexts)),h.push(t.context);Zt.linkTimeline(this.anchors.map(t=>t.context)),h.forEach(t=>t.tContexts=h),this.contexts={map:r,array:h,list:this.anchors.map(t=>t.tick),resolutionMultiplier:e}}quarters(t){return t.tick/this.contexts.resolutionMultiplier/this.quarterTicks}measure(t=!0){var e,i,s,n;this.origin=2,this.tail=2,this.minimumScale=0,this.centeredWidth=0;for(const t of this.anchors){t.extents.clear(),t.context.preFormat();for(const i of t.context.getTickables()){const s=i.getMetrics(),n=s.modLeftPx+s.leftDisplacedHeadPx,o=s.notePx+s.modRightPx+s.rightDisplacedHeadPx;if(i.isCenterAligned()){this.centeredWidth=Math.max(this.centeredWidth,2*Math.max(n,o));continue}const a=null!==(e=t.extents.get(i.getStave()))&&void 0!==e?e:{left:0,right:0};a.left=Math.max(a.left,n),a.right=Math.max(a.right,o),t.extents.set(i.getStave(),a)}const s=new Map;t.prefixes.forEach(t=>{var e;let i=0;for(const e of t.contexts)i+=e.preFormat().getWidth();const n=t.contexts[0].getTickables()[0].getStave();s.set(n,Math.max(null!==(e=s.get(n))&&void 0!==e?e:0,i))});for(const[e,n]of s){const s=null!==(i=t.extents.get(e))&&void 0!==i?i:{left:0,right:0};s.left+=n,t.extents.set(e,s)}for(const e of t.extents.values())0===this.quarters(t)&&(this.origin=Math.max(this.origin,e.left+2)),this.quarters(t)===this.duration&&(this.tail=Math.max(this.tail,e.right+2))}if(!t)return;const o=new Map;for(const t of this.anchors){const e=this.quarters(t);for(const[i,a]of t.extents){for(const t of null!==(s=o.get(i))&&void 0!==s?s:[])this.minimumScale=Math.max(this.minimumScale,(t.extent.right+a.left+2)/(e-t.time));e>0&&(this.minimumScale=Math.max(this.minimumScale,(a.left+2-this.origin)/e)),e<this.duration&&(this.minimumScale=Math.max(this.minimumScale,(a.right+2-this.tail)/(this.duration-e)));const t=null!==(n=o.get(i))&&void 0!==n?n:[];t.push({time:e,extent:a}),o.set(i,t)}}this.minimumScale=Math.max(this.minimumScale,this.centeredWidth/this.duration)}dimensions(t,e){if(!Number.isFinite(e)||e<0)throw new p("BadArgument","Width must be finite and nonnegative.");const i=t.pixelsPerQuarter;if(void 0!==i&&(!Number.isFinite(i)||i<=0))throw new p("BadArgument","pixelsPerQuarter must be positive and finite.");this.measure();const s=this.origin+this.duration*this.minimumScale+this.tail,n=null!=i?i:e>0?(e-this.origin-this.tail)/this.duration:this.minimumScale,o=this.origin+this.duration*n+this.tail;if(!Number.isFinite(o)||!Number.isFinite(this.minimumScale))throw new p("BadArgument","Proportional dimensions exceed the supported pixel range.");if(n+Ae<this.minimumScale||e>0&&e+Ae<o)throw new p("InsufficientProportionalSpace",`Proportional spacing requires at least ${Fe(this.minimumScale)} px/quarter and ${Fe(Math.max(s,o))} px width; received ${n.toFixed(2)} px/quarter`+(e>0?` and ${e.toFixed(2)} px width.`:"."));return{scale:n,width:o}}opticalLayout(t){var e;if(!Number.isFinite(t)||t<0)throw new p("BadArgument","Width must be finite and nonnegative.");this.measure(!1);const i=new Map,s=[],n=[];let o=0,a=0,r=0;for(const t of this.anchors){const h=this.quarters(t);let c=o+2;for(const[s,n]of t.extents)c=Math.max(c,(null!==(e=i.get(s))&&void 0!==e?e:0)+2+n.left);for(const[e,s]of t.extents)i.set(e,c+s.right);r+=Math.sqrt(h-a),n.push(r),s.push(c),o=c,a=h}r+=Math.sqrt(this.duration-a);const h=Math.max(this.centeredWidth+4,o+2,...Array.from(i.values(),t=>t+2));if(t>0&&t+Ae<h)throw new p("InsufficientOpticalSpace",`Optical spacing requires at least ${Fe(h)} px width; received ${t.toFixed(2)} px.`);const c=t||h;return{width:c,center:c/2,positions:s.map((t,e)=>t+(r?n[e]/r:0)*(c-h))}}minimumWidth(t){return"optical"===t.mode?this.opticalLayout(0).width:this.dimensions(t,0).width}proportionalLayout(t,e){const i=this.dimensions(t,e);return{width:i.width,center:this.origin+this.duration*i.scale/2,positions:this.anchors.map(t=>this.origin+this.quarters(t)*i.scale)}}format(t,e){const{positions:i,center:s,width:n}="optical"===t.mode?this.opticalLayout(e):this.proportionalLayout(t,e);for(const[t,e]of this.anchors.entries()){const n=i[t];e.context.setX(n),e.context.getCenterAlignedTickables().forEach(t=>{t.setCenterXShift(s-n)}),e.prefixes.forEach(t=>{const i=t.contexts[0].getTickables()[0].getStave(),s=e.context.getTickables().filter(t=>t.getStave()===i);let o=n-Math.max(0,...s.map(t=>{const e=t.getMetrics();return e.modLeftPx+e.leftDisplacedHeadPx}));for(const e of[...t.contexts].reverse()){const t=e.getMetrics();e.setX(o-1-t.notePx-t.totalRightPx),o-=e.getWidth()}})}return n}}class Pe extends Dt{static get CATEGORY(){return"KeySignature"}constructor(t,e,i){super(),this.accList=[],this.setKeySig(t,e,i),this.setPosition(kt.BEGIN),this.children=[],this.paddingForced=!1}convertToGlyph(t,e,i){const s=$.accidentalCodes(t.type),n=new P("KeySignature");n.setFont(this.fontInfo).setText(s);let o=1;if(n.setYShift(i.getYForLine(t.line)),this.children.length>0){const t=this.children[this.children.length-1],e=t=>t.getText()===I.accidentalNatural,i=(t,e)=>Math.abs(e.getYShift()-t.getYShift());(e(t)||e(n))&&i(t,n)<10&&(o=2),n.setXShift(t.getXShift()+t.getWidth()+o)}this.children.push(n),this.width+=n.getWidth()+o}cancelKey(t){return this.formatted=!1,this.cancelKeySpec=t,this}convertToCancelAccList(t){const e=$.keySignature(t),i=this.accList.length>0&&e.length>0&&e[0].type!==this.accList[0].type,s=i?e.length:e.length-this.accList.length;if(s<1)return;const n=[];for(let t=0;t<s;t++){let o=t;i||(o=e.length-s+t);const a=e[o];n.push({type:"n",line:a.line})}return this.accList=n.concat(this.accList),{accList:n,type:e[0].type}}addToStave(t){return this.paddingForced=!0,t.addModifier(this),this}setStave(t){return this.formatted=!1,super.setStave(t)}getBoundingBox(){return this.formatted||this.format(),super.getBoundingBox()}calculateDimensions(){let t;t=this.children.length>0?this.children[0].getBoundingBox():new D(this.x+this.xShift,this.y+this.yShift,0,0),this.children.forEach(e=>{t.mergeWith(e.getBoundingBox())}),this.width=t.getW(),this.height=t.getH(),this.y=t.getY()}convertAccLines(t,e,i=this.accList){let s,n,o=0;switch(t){case"soprano":"#"===e?s=[2.5,.5,2,0,1.5,-.5,1]:o=-1;break;case"mezzo-soprano":"b"===e?s=[0,2,.5,2.5,1,3,1.5]:o=1.5;break;case"alto":o=.5;break;case"tenor":"#"===e?s=[3,1,2.5,.5,2,0,1.5]:o=-.5;break;case"baritone-f":case"baritone-c":"b"===e?s=[.5,2.5,1,3,1.5,3.5,2]:o=2;break;case"bass":case"french":o=1}if(void 0!==s)for(n=0;n<i.length;++n)i[n].line=s[n];else if(0!==o)for(n=0;n<i.length;++n)i[n].line+=o}getPadding(t){return this.formatted||this.format(),0===this.children.length||!this.paddingForced&&t<2?0:this.padding}getWidth(){return this.formatted||this.format(),this.width}setClef(t){return void 0!==t&&$.clefProperties(t),this.clefOverride=t,this.formatted=!1,this}setKeySig(t,e,i){return this.formatted=!1,this.keySpec=t,this.cancelKeySpec=e,this.alterKeySpec=i,this}alterKey(t){return this.formatted=!1,this.alterKeySpec=t,this}convertToAlterAccList(t){const e=Math.min(t.length,this.accList.length);for(let i=0;i<e;++i)t[i]&&(this.accList[i].type=t[i])}format(){var t;let e=this.getStave();e||(e=new je(0,0,100),this.setStave(e)),this.width=0,this.children=[],this.accList=$.keySignature(f(this.keySpec));const i=this.accList,s=i.length>0?i[0].type:void 0;let n;if(this.cancelKeySpec&&(n=this.convertToCancelAccList(this.cancelKeySpec)),this.alterKeySpec&&this.convertToAlterAccList(this.alterKeySpec),this.accList.length>0){const o=null!==(t=this.clefOverride)&&void 0!==t?t:(this.position===kt.END?e.getEndClef():e.getClef())||e.getClef();n&&this.convertAccLines(o,n.type,n.accList),this.convertAccLines(o,s,i);for(let t=0;t<this.accList.length;++t)this.convertToGlyph(this.accList[t],this.accList[t+1],e)}this.calculateDimensions(),this.formatted=!0}draw(){const t=this.checkStave().checkContext();this.formatted||this.format(),this.setRendered();const e=this.getAttribute("class");t.openGroup("keysignature"+(e?" "+e:""),this.getAttribute("id"));for(let e=0;e<this.children.length;e++){this.children[e].renderText(t,this.x,0)}this.drawPointerRect(),t.closeGroup()}}class Re extends Dt{static get CATEGORY(){return"Repetition"}constructor(t,e,i){super(),this.symbolType=t,this.x=e,this.xShift=0,this.yShift=i}setShiftX(t){return this.xShift=t,this}setShiftY(t){return this.yShift=t,this}draw(){const t=this.checkStave(),e=t.getModifierXShift(this.getPosition());switch(this.setRendered(),this.symbolType){case Re.type.CODA_RIGHT:this.drawCodaFixed(t,e+t.getWidth());break;case Re.type.CODA_LEFT:this.drawSymbolText(t,e,"Coda",!0);break;case Re.type.SEGNO_LEFT:this.drawSegnoFixed(t,e);break;case Re.type.SEGNO_RIGHT:this.drawSegnoFixed(t,e+t.getWidth());break;case Re.type.DC:this.drawSymbolText(t,e,"D.C.",!1);break;case Re.type.DC_AL_CODA:this.drawSymbolText(t,e,"D.C. al",!0);break;case Re.type.DC_AL_FINE:this.drawSymbolText(t,e,"D.C. al Fine",!1);break;case Re.type.DS:this.drawSymbolText(t,e,"D.S.",!1);break;case Re.type.DS_AL_CODA:this.drawSymbolText(t,e,"D.S. al",!0);break;case Re.type.DS_AL_FINE:this.drawSymbolText(t,e,"D.S. al Fine",!1);break;case Re.type.FINE:this.drawSymbolText(t,e,"Fine",!1);break;case Re.type.TO_CODA:this.drawSymbolText(t,e,"To",!0)}}drawCodaFixed(t,e){const i=t.getYForTopText(t.getNumLines());return this.text=I.coda,this.renderText(t.checkContext(),e,i+B.get("Repetition.coda.offsetY")),this}drawSegnoFixed(t,e){const i=t.getYForTopText(t.getNumLines());return this.text=I.segno,this.renderText(t.checkContext(),e,i+B.get("Repetition.segno.offsetY")),this}drawSymbolText(t,e,i,s){const n=t.checkContext();let o=0;switch(this.text=i,s&&(this.text+=" "),this.setFont(B.getFontInfo("Repetition.text")),this.symbolType){case Re.type.CODA_LEFT:o=t.getVerticalBarWidth();break;case Re.type.DC:case Re.type.DC_AL_FINE:case Re.type.DS:case Re.type.DS_AL_FINE:case Re.type.FINE:default:o=e-(t.getNoteStartX()-this.x)+t.getWidth()-this.width-B.get("Repetition.text.offsetX")}const a=t.getYForTopText(t.getNumLines())+B.get("Repetition.text.offsetY");return this.renderText(n,o,a),this}}Re.type={NONE:1,CODA_LEFT:2,CODA_RIGHT:3,SEGNO_LEFT:4,SEGNO_RIGHT:5,DC:6,DC_AL_CODA:7,DC_AL_FINE:8,DS:9,DS_AL_CODA:10,DS_AL_FINE:11,FINE:12,TO_CODA:13};class Ie extends Dt{static get CATEGORY(){return"StaveSection"}constructor(t,e=0,i=0,s=!0){super(),this.setText(t),this.x=e,this.yShift=i,this.drawRect=s,this.padding=B.get("StaveSection.padding")}setDrawRect(t){return this.drawRect=t,this}draw(){const t=this.checkStave(),e=t.checkContext();this.setRendered(),this.x=t.getX()+t.getModifierXShift(this.getPosition());const i=-1*this.textMetrics.actualBoundingBoxDescent,s=this.width+2*this.padding,n=this.height+2*this.padding,o=t.getYForTopText(1.5)+this.yShift,a=this.x+this.xShift;this.drawRect&&(e.beginPath(),e.rect(a,o-n+i,s,n),e.stroke()),this.renderText(e,this.xShift+this.padding,o-this.padding)}}class We extends Dt{static get CATEGORY(){return"StaveTempo"}constructor(t,e,i){super(),this.durationToCode={"1/4":I.metNoteDoubleWholeSquare,long:I.metNoteDoubleWholeSquare,"1/2":I.metNoteDoubleWhole,breve:I.metNoteDoubleWhole,1:I.metNoteWhole,whole:I.metNoteWhole,w:I.metNoteWhole,2:I.metNoteHalfUp,half:I.metNoteHalfUp,h:I.metNoteHalfUp,4:I.metNoteQuarterUp,quarter:I.metNoteQuarterUp,q:I.metNoteQuarterUp,8:I.metNote8thUp,eighth:I.metNote8thUp,16:I.metNote16thUp,"16th":I.metNote16thUp,32:I.metNote32ndUp,"32nd":I.metNote32ndUp,64:I.metNote64thUp,"64th":I.metNote64thUp,128:I.metNote128thUp,"128th":I.metNote128thUp,256:I.metNote256thUp,"256th":I.metNote256thUp,512:I.metNote512thUp,"512th":I.metNote512thUp,1024:I.metNote1024thUp,"1024th":I.metNote1024thUp},this.tempo=t,this.position=kt.ABOVE,this.x=e,this.setXShift(10),this.setYShift(i)}setTempo(t){return this.tempo=t,this}draw(){const t=this.checkStave(),e=t.getModifierXShift(this.getPosition()),i=t.checkContext();this.setRendered();const{name:s,duration:n,dots:o,bpm:a,duration2:r,dots2:h,parenthesis:c}=this.tempo;let l=this.x+e;const d=t.getYForTopText(1),u=new P("StaveTempo.glyph"),g=new P("StaveTempo");if(s&&(this.text=s,this.fontInfo=B.getFontInfo("StaveTempo.name"),this.renderText(i,e,d),l+=this.getWidth()+3),(s&&n||c)&&(g.setText("("),g.renderText(i,l+this.xShift,d+this.yShift),l+=g.getWidth()+3),n){if(u.setText(this.durationToCode[n]),u.renderText(i,l+this.xShift,d+this.yShift),l+=u.getWidth()+3,o){u.setText(I.metAugmentationDot);for(let t=0;t<o;t++)u.renderText(i,l+this.xShift,d+2+this.yShift),l+=u.getWidth()+3}if(g.setText("="),g.renderText(i,l+this.xShift,d+this.yShift),l+=g.getWidth()+3,r){if(u.setText(this.durationToCode[r]),u.renderText(i,l+this.xShift,d+this.yShift),l+=u.getWidth()+3,h){u.setText(I.metAugmentationDot);for(let t=0;t<h;t++)u.renderText(i,l+this.xShift,d+2+this.yShift),l+=u.getWidth()+3}}else a&&(g.setText(""+a),g.renderText(i,l+this.xShift,d+this.yShift),l+=g.getWidth()+3);(s||c)&&(g.setText(")"),g.renderText(i,l+this.xShift,d+this.yShift))}}}var He,Ge;!function(t){t[t.LEFT=1]="LEFT",t[t.CENTER=2]="CENTER",t[t.RIGHT=3]="RIGHT"}(He||(He={}));class Ue extends vt{static get CATEGORY(){return"TextNote"}static get GLYPHS(){return{segno:I.segno,tr:I.ornamentTrill,mordent:I.ornamentMordent,mordentUpper:I.ornamentShortTrill,mordentLower:I.ornamentMordent,f:I.dynamicForte,p:I.dynamicPiano,m:I.dynamicMezzo,s:I.dynamicSforzando,z:I.dynamicZ,coda:I.coda,pedalOpen:I.keyboardPedalPed,pedalClose:I.keyboardPedalUp,caesuraStraight:I.caesura,caesuraCurved:I.caesuraCurved,breath:I.breathMarkComma,tick:I.breathMarkTick,turn:I.ornamentTurn,turnInverted:I.ornamentTurnSlash}}constructor(t){var e,i;super(t),this.text=null!==(e=t.text)&&void 0!==e?e:"",t.glyph&&(this.text+=Ue.GLYPHS[t.glyph]||t.glyph),t.font?this.setFont(t.font):void 0===t.glyph&&this.setFont(B.getFontInfo("TextNote.text"));const s=.769231*A.convertSizeToPointValue(this.fontInfo.size);t.superscript&&(this.superscript=new P("TextNote.text"),this.superscript.setText(t.superscript),this.superscript.setFontSize(s)),t.subscript&&(this.subscript=new P("TextNote.text"),this.subscript.setText(t.subscript),this.subscript.setFontSize(s)),this.line=null!==(i=t.line)&&void 0!==i?i:0,this.smooth=t.smooth||!1,this.ignoreTicks=t.ignoreTicks||!1,this.justification=He.LEFT}setJustification(t){return this.justification=t,this}setLine(t){return this.line=t,this}getLine(){return this.line}preFormat(){if(this.preFormatted)return;const t=this.checkTickContext("Can't preformat without a TickContext.");this.justification===He.CENTER?this.leftDisplacedHeadPx=this.width/2:this.justification===He.RIGHT&&(this.leftDisplacedHeadPx=this.width),this.rightDisplacedHeadPx=t.getMetrics().glyphPx/2,this.preFormatted=!0}draw(){const t=this.checkContext(),e=this.checkStave(),i=this.checkTickContext("Can't draw without a TickContext.");this.setRendered();let s=this.getAbsoluteX()+i.getMetrics().glyphPx/2;const n=this.getWidth();this.justification===He.CENTER?s-=n/2:this.justification===He.RIGHT&&(s-=n);const o=e.getYForLine(this.line+-3);this.renderText(t,s,o);const a=this.getHeight();this.superscript&&this.superscript.renderText(t,s+this.width+2,o-a/2.2),this.subscript&&this.subscript.renderText(t,s+this.width+2,o+a/2.2-1)}}Ue.Justification=He;class Ve extends Dt{static get CATEGORY(){return"StaveText"}constructor(t,e,i={}){var s,n,o;super(),this.setText(t),this.setXShift(null!==(s=i.shiftX)&&void 0!==s?s:0),this.setYShift(null!==(n=i.shiftY)&&void 0!==n?n:0),this.position=e,this.justification=null!==(o=i.justification)&&void 0!==o?o:Ue.Justification.CENTER}draw(){const t=this.checkStave(),e=t.checkContext();let i,s;switch(this.setRendered(),this.position){case kt.LEFT:case kt.RIGHT:s=(t.getYForLine(0)+t.getBottomLineY())/2,i=this.position===kt.LEFT?t.getX()-this.width-24:t.getX()+t.getWidth()+24;break;case kt.ABOVE:case kt.BELOW:i=t.getX(),this.justification===He.CENTER?i+=t.getWidth()/2-this.width/2:this.justification===He.RIGHT&&(i+=t.getWidth()-this.width),s=this.position===kt.ABOVE?t.getYForTopText(2):t.getYForBottomText(2);break;default:throw new p("InvalidPosition","Value Must be in Modifier.Position.")}this.renderText(e,i,s+4)}}!function(t){t[t.NONE=1]="NONE",t[t.BEGIN=2]="BEGIN",t[t.MID=3]="MID",t[t.END=4]="END",t[t.BEGIN_END=5]="BEGIN_END"}(Ge||(Ge={}));class Ye extends Dt{static get CATEGORY(){return"Volta"}static get type(){return Ge}constructor(t,e,i,s){super(),this.type=t,this.x=i,this.yShift=s,this.text=e}draw(){const t=this.checkStave(),e=t.getModifierXShift(this.getPosition()),i=t.checkContext();this.setRendered();let s=t.getWidth()-e;const n=t.getYForTopText(t.getNumLines())+this.yShift,o=1.5*t.getSpacingBetweenLines();switch(this.type){case Ge.BEGIN:i.fillRect(this.x+e,n,1,o);break;case Ge.END:s-=5,i.fillRect(this.x+e+s,n,1,o);break;case Ge.BEGIN_END:s-=3,i.fillRect(this.x+e,n,1,o),i.fillRect(this.x+e+s,n,1,o)}this.type!==Ge.BEGIN&&this.type!==Ge.BEGIN_END||this.renderText(i,e+5,n-this.yShift+15),i.fillRect(this.x+e,n,s,1)}}class Xe extends Dt{static get CATEGORY(){return"TimeSignature"}constructor(t="4/4",e=15,i=!0){super(),this.topRenderY=0,this.botRenderY=0,this.timeSpec="4/4",this.line=0,this.isNumeric=!0,this.topStartX=0,this.botStartX=0,this.lineShift=0,this.topText=new P,this.botText=new P,this.validateArgs=i;const s=e;this.topLine=1,this.bottomLine=3,this.setPosition(kt.BEGIN),this.setTimeSig(t),this.setPadding(s)}setMusicFont(t){for(const e of[this,this.topText,this.botText])e.setFont(Object.assign(Object.assign({},e.fontInfo),{family:t}));return this.setTimeSig(this.timeSpec)}static getTimeSigCode(t,e=!1){let i=I.null;switch(t){case"C":i=I.timeSigCommon;break;case"C|":i=I.timeSigCutCommon;break;case"+":i=e?I.timeSigPlusSmall:I.timeSigPlus;break;case"-":i=I.timeSigMinus;break;case"(":i=e?I.timeSigParensLeftSmall:I.timeSigParensLeft;break;case")":i=e?I.timeSigParensRightSmall:I.timeSigParensRight;break;default:i=String.fromCodePoint(57472+Number(t[0]))}return i}makeTimeSignatureGlyph(t,e){let i="",s=0,n=0;for(let s=0;s<t.length;++s){i+=Xe.getTimeSigCode(t[s],e.length>0)}this.topText.setText(i),s=this.topText.getWidth(),n=this.topText.getHeight();let o=0;i="";for(let t=0;t<e.length;++t){i+=Xe.getTimeSigCode(e[t],!0)}this.botText.setText(i),o=this.botText.getWidth(),n=Math.max(n,this.botText.getHeight()),this.lineShift=n>30?.5:0,this.width=Math.max(s,o),this.topStartX=(this.width-s)/2,this.botStartX=(this.width-o)/2}setTimeSig(t){var e,i;if(this.timeSpec=t,"C"===t||"C|"===t){const e=Xe.getTimeSigCode(t);this.line=2,this.text=e,this.isNumeric=!1}else{this.validateArgs&&(t=>{t.split("/").forEach(e=>{if(!1===/^[0-9+\-()]+$/.test(e))throw new p("BadTimeSignature",`Invalid time spec: ${t}. Must contain valid signatures.`)})})(t);const s=t.split("/");this.line=0,this.isNumeric=!0,this.makeTimeSignatureGlyph(null!==(e=s[0])&&void 0!==e?e:"",null!==(i=s[1])&&void 0!==i?i:"")}return this}getTimeSpec(){return this.timeSpec}getLine(){return this.line}setLine(t){this.line=t}getIsNumeric(){return this.isNumeric}setIsNumeric(t){this.isNumeric=t}draw(){const t=this.checkStave(),e=t.checkContext();this.setRendered();const i=this.getAttribute("class");e.openGroup("timesignature"+(i?" "+i:""),this.getAttribute("id")),this.drawAt(e,t,this.x),this.drawPointerRect(),e.closeGroup()}drawAt(t,e,i){if(this.setRendered(),this.isNumeric){let s=i+this.topStartX;this.botText.getText().length>0?this.topRenderY=e.getYForLine(this.topLine-this.lineShift):this.topRenderY=(e.getYForLine(this.topLine)+e.getYForLine(this.bottomLine))/2,this.topText.renderText(t,s,this.topRenderY),s=i+this.botStartX,this.botRenderY=e.getYForLine(this.bottomLine+this.lineShift),this.botText.renderText(t,s,this.botRenderY)}else this.renderText(t,i-this.x,e.getYForLine(this.line))}getBoundingBox(){if(this.isNumeric){const t=this.topText.getBoundingBox(),e=this.botText.getBoundingBox();t.move(this.x+this.topStartX,this.topRenderY),e.move(this.x+this.botStartX,this.botRenderY);return t.mergeWith(e)}{const t=this.checkStave(),e=super.getBoundingBox();return e.move(0,t.getYForLine(this.line)),e}}}const _e={[Et.CATEGORY]:0,[Qt.CATEGORY]:1,[Pe.CATEGORY]:2,[Xe.CATEGORY]:3},ze={[Xe.CATEGORY]:0,[Pe.CATEGORY]:1,[Et.CATEGORY]:2,[Qt.CATEGORY]:3};class je extends P{static get CATEGORY(){return"Stave"}static get defaultPadding(){return B.get("Stave.padding")+B.get("Stave.endPaddingMax")}static get rightPadding(){return B.get("Stave.endPaddingMax")}constructor(t,e,i,s){var n;super(),this.x=t,this.y=e,this.width=i,this.formatted=!1,this.startX=t+5,this.endX=t+i,this.modifiers=[],this.measure=0,this.clef=null!==(n=null==s?void 0:s.clef)&&void 0!==n?n:"treble",this.endClef=void 0,this.options=Object.assign({clef:"treble",verticalBarWidth:10,numLines:5,leftBar:!0,rightBar:!0,spacingBetweenLinesPx:$.STAVE_LINE_DISTANCE,spaceAboveStaffLn:4,spaceBelowStaffLn:4,topTextPosition:1,bottomTextPosition:4,lineConfig:[]},s),this.bounds={x:this.x,y:this.y,w:this.width,h:0},this.defaultLedgerLineStyle={lineWidth:2},this.resetLines(),this.addModifier(new Et(this.options.leftBar?Bt.SINGLE:Bt.NONE)),this.addEndModifier(new Et(this.options.rightBar?Bt.SINGLE:Bt.NONE))}setDefaultLedgerLineStyle(t){this.defaultLedgerLineStyle=t}getDefaultLedgerLineStyle(){var t;const e=void 0!==(null===(t=this.getContext())||void 0===t?void 0:t.getDefaultStyle().strokeStyle)?{}:{strokeStyle:"#444"};return Object.assign(Object.assign(Object.assign({},e),this.styleExplicit?this.getStyle():{}),this.defaultLedgerLineStyle)}space(t){return this.options.spacingBetweenLinesPx*t}resetLines(){this.options.lineConfig=[];for(let t=0;t<this.options.numLines;t++)this.options.lineConfig.push({visible:!0});this.height=(this.options.numLines+this.options.spaceAboveStaffLn)*this.options.spacingBetweenLinesPx,this.options.bottomTextPosition=this.options.numLines}setNoteStartX(t){return this.formatted||this.format(),this.startX=t,this}getNoteStartX(){return this.formatted||this.format(),this.startX}getNoteEndX(){return this.formatted||this.format(),this.endX}getTieStartX(){return this.startX}getTieEndX(){return this.endX}getNumLines(){return this.options.numLines}setNumLines(t){return this.options.numLines=t,this.resetLines(),this}getTopLineTopY(){return this.getYForLine(0)}getBottomLineBottomY(){var t;return this.getYForLine(this.getNumLines()-1)+(null!==(t=this.getStyle().lineWidth)&&void 0!==t?t:1)}setX(t){const e=t-this.x;this.formatted=!1,this.x=t,this.startX+=e,this.endX+=e;for(let t=0;t<this.modifiers.length;t++){const i=this.modifiers[t];i.setX(i.getX()+e)}return this}setWidth(t){return this.formatted=!1,this.width=t,this.endX=this.x+t,this}setMeasure(t){return this.measure=t,this}getMeasure(){return this.measure}getModifierXShift(t=0){if("number"!=typeof t)throw new p("InvalidIndex","Must be of number type");if(this.formatted||this.format(),1===this.getModifiers(kt.BEGIN).length)return 0;if(this.modifiers[t].getPosition()===kt.RIGHT)return 0;let e=this.startX-this.x;const i=this.modifiers[0];return i.getType()===Bt.REPEAT_BEGIN&&e>i.getWidth()&&(e-=i.getWidth()),e}setRepetitionType(t,e=0){return this.modifiers.push(new Re(t,this.x,e)),this}setVoltaType(t,e,i){return this.modifiers.push(new Ye(t,e,this.x,i)),this}setSection(t,e,i=0,s,n=!0){const o=new Ie(t).setYShift(e).setXShift(i).setDrawRect(n);return s&&o.setFontSize(s),this.addModifier(o),this}setTempo(t,e){return this.modifiers.push(new We(t,this.x,e)),this}setStaveText(t,e,i={}){return this.modifiers.push(new Ve(t,e,i)),this}getSpacingBetweenLines(){return this.options.spacingBetweenLinesPx}getBoundingBox(){return new D(this.x,this.y,this.width,this.getBottomY()-this.y)}getBottomY(){const t=this.options,e=t.spacingBetweenLinesPx;return this.getYForLine(t.numLines)+t.spaceBelowStaffLn*e}getBottomLineY(){return this.getYForLine(this.options.numLines)}getYForLine(t){const e=this.options,i=e.spacingBetweenLinesPx,s=e.spaceAboveStaffLn;return this.y+t*i+s*i}getLineForY(t){const e=this.options,i=e.spacingBetweenLinesPx,s=e.spaceAboveStaffLn;return(t-this.y)/i-s}getYForTopText(t=0){return this.getYForLine(-t-this.options.topTextPosition)}getYForBottomText(t=0){return this.getYForLine(this.options.bottomTextPosition+t)}getYForNote(t){const e=this.options,i=e.spacingBetweenLinesPx,s=e.spaceAboveStaffLn;return this.y+s*i+5*i-t*i}getYForGlyphs(){return this.getYForLine(3)}addModifier(t,e){return void 0!==e&&t.setPosition(e),t instanceof Qt&&(t.getPosition()===kt.BEGIN?this.clef=t.getType():t.getPosition()===kt.END&&(this.endClef=t.getType())),t.setStave(this),this.formatted=!1,this.modifiers.push(t),this}addEndModifier(t){return this.addModifier(t,kt.END),this}setBegBarType(t,e=Ct.NONE){const{SINGLE:i,REPEAT_BEGIN:s,NONE:n}=Bt;return t!==i&&t!==s&&t!==n||(this.modifiers[0].setType(t).setRepeatBracket(e),this.formatted=!1),this}setEndBarType(t,e=Ct.NONE){return t!==Bt.REPEAT_BEGIN&&(this.modifiers[1].setType(t).setRepeatBracket(e),this.formatted=!1),this}setClef(t,e,i,s){void 0===s&&(s=kt.BEGIN),s===kt.END?this.endClef=t:this.clef=t;const n=this.getModifiers(s,Qt.CATEGORY);return 0===n.length?this.addClef(t,e,i,s):n[0].setType(t,e,i),this}getClef(){return this.clef}setEndClef(t,e,i){return this.setClef(t,e,i,kt.END),this}getEndClef(){return this.endClef}setKeySignature(t,e,i){void 0===i&&(i=kt.BEGIN);const s=this.getModifiers(i,Pe.CATEGORY);return 0===s.length?this.addKeySignature(t,e,i):s[0].setKeySig(t,e),this}setEndKeySignature(t,e){return this.setKeySignature(t,e,kt.END),this}setTimeSignature(t,e,i){void 0===i&&(i=kt.BEGIN);const s=this.getModifiers(i,Xe.CATEGORY);return 0===s.length?this.addTimeSignature(t,e,i):s[0].setTimeSig(t),this}setEndTimeSignature(t,e){return this.setTimeSignature(t,e,kt.END),this}addKeySignature(t,e,i){return void 0===i&&(i=kt.BEGIN),this.addModifier(new Pe(t,e).setPosition(i),i),this}addClef(t,e,i,s){return void 0===s||s===kt.BEGIN?this.clef=t:s===kt.END&&(this.endClef=t),this.addModifier(new Qt(t,e,i),s),this}addEndClef(t,e,i){return this.addClef(t,e,i,kt.END),this}addTimeSignature(t,e,i){return this.addModifier(new Xe(t,e),i),this}addEndTimeSignature(t,e){return this.addTimeSignature(t,e,kt.END),this}addTrebleGlyph(){return this.addClef("treble"),this}getModifiers(t,e){const i=void 0===t,s=void 0===e;return i&&s?this.modifiers:i?this.modifiers.filter(t=>e===t.getCategory()):s?this.modifiers.filter(e=>t===e.getPosition()):this.modifiers.filter(i=>t===i.getPosition()&&e===i.getCategory())}sortByCategory(t,e){for(let i=t.length-1;i>=0;i--)for(let s=0;s<i;s++)if(e[t[s].getCategory()]>e[t[s+1].getCategory()]){const e=t[s];t[s]=t[s+1],t[s+1]=e}}format(){var t,e,i,s;const n=this.modifiers[0],o=this.modifiers[1],a=this.getModifiers(kt.BEGIN),r=this.getModifiers(kt.END);let h,c,l;this.sortByCategory(a,_e),this.sortByCategory(r,ze),a.length>1&&n.getType()===Bt.REPEAT_BEGIN&&(a.push(a.splice(0,1)[0]),a.splice(0,0,new Et(Bt.SINGLE))),r.indexOf(o)>0&&r.splice(0,0,new Et(Bt.NONE));let d=0,u=this.x;for(let t=0;t<a.length;t++)l=a[t],c=l.getPadding(t+d),h=l.getWidth(),u+=c,l.setX(u),u+=h,c+h===0&&d--;this.startX=u,u=this.x+this.width;const g={left:0,right:0,paddingRight:0,paddingLeft:0};let p=0;for(let n=0;n<r.length;n++){l=r[n],p=J(l)?n:p,g.right=0,g.left=0,g.paddingRight=0,g.paddingLeft=0;const o=l.getLayoutMetrics();o?(0!==n&&(g.right=null!==(t=o.xMax)&&void 0!==t?t:0,g.paddingRight=null!==(e=o.paddingRight)&&void 0!==e?e:0),g.left=-(null!==(i=o.xMin)&&void 0!==i?i:0),g.paddingLeft=null!==(s=o.paddingLeft)&&void 0!==s?s:0,n===r.length-1&&(g.paddingLeft=0)):(g.paddingRight=l.getPadding(n-p),0!==n&&(g.right=l.getWidth()),0===n&&(g.left=l.getWidth())),u-=g.paddingRight,u-=g.right,l.setX(u),u-=g.left,u-=g.paddingLeft}this.endX=1===r.length?this.x+this.width:u,this.formatted=!0}draw(){var t;const e=this.checkContext();this.setRendered();const i=this.getAttribute("class");e.openGroup("stave"+(i?" "+i:""),this.getAttribute("id")),this.formatted||this.format();const s=this.options.numLines,n=this.width,o=this.x;let a;const r=(null!==(t=this.getStyle().lineWidth)&&void 0!==t?t:1)%2==0?0:.5;for(let t=0;t<s;t++)a=this.getYForLine(t),this.options.lineConfig[t].visible&&(e.beginPath(),e.moveTo(o,a+r),e.lineTo(o+n,a+r),e.stroke());this.drawPointerRect(),e.closeGroup();for(let t=0;t<this.modifiers.length;t++){const i=this.modifiers[t];i.setContext(e),i.setStave(this),i.drawWithStyle()}if(this.measure>0){e.setFont(this.fontInfo);const t=e.measureText(""+this.measure).width;a=this.getYForTopText(0)+3,e.fillText(""+this.measure,this.x-t/2,a)}}getVerticalBarWidth(){return this.options.verticalBarWidth}getConfigForLines(){return this.options.lineConfig}setConfigForLine(t,e){if(t>=this.options.numLines||t<0)throw new p("StaveConfigError","The line number must be within the range of the number of lines in the Stave.");if(void 0===e.visible)throw new p("StaveConfigError","The line configuration object is missing the 'visible' property.");if("boolean"!=typeof e.visible)throw new p("StaveConfigError","The line configuration objects 'visible' property must be true or false.");return this.options.lineConfig[t]=e,this}setConfigForLines(t){if(t.length!==this.options.numLines)throw new p("StaveConfigError","The length of the lines configuration array must match the number of lines in the Stave");for(const e in t)void 0===t[e].visible&&(t[e]=this.options.lineConfig[e]),this.options.lineConfig[e]=Object.assign(Object.assign({},this.options.lineConfig[e]),t[e]);return this.options.lineConfig=t,this}static formatBegModifiers(t){const e=e=>{let i=0;t.forEach(t=>{const s=t.getModifiers(kt.BEGIN,e);s.length>0&&s[0].getX()>i&&(i=s[0].getX())});let s=0;t.forEach(t=>{s=0;t.getModifiers(kt.BEGIN,e).forEach(t=>{i-t.getX()>s&&(s=i-t.getX())});const n=t.getModifiers(kt.BEGIN);let o=!1;n.forEach(t=>{t.getCategory()===e&&(o=!0),o&&s>0&&t.setX(t.getX()+s)}),t.setNoteStartX(t.getNoteStartX()+s)})};t.forEach(t=>{t.formatted||t.format()}),e("Clef"),e("KeySignature"),e("TimeSignature");let i=0;t.forEach(t=>{t.getNoteStartX()>i&&(i=t.getNoteStartX())}),t.forEach(t=>{t.setNoteStartX(i)}),i=0,t.forEach(t=>{t.getModifiers(kt.BEGIN,"Barline").forEach(t=>{t.getType()===Bt.REPEAT_BEGIN&&t.getX()>i&&(i=t.getX())})}),t.forEach(t=>{t.getModifiers(kt.BEGIN,"Barline").forEach(t=>{t.getType()===Bt.REPEAT_BEGIN&&t.setX(i)})})}}function qe(t,e,i,s,n){if(e!==$e.type.BOLD_DOUBLE_LEFT&&e!==$e.type.BOLD_DOUBLE_RIGHT)throw new p("InvalidConnector","A REPEAT_BEGIN or REPEAT_END type must be provided.");let o=3,a=3.5;e===$e.type.BOLD_DOUBLE_RIGHT&&(o=-5,a=3),t.fillRect(i+o,s,1,n-s),t.fillRect(i-2,s,a,n-s)}class $e extends P{static get CATEGORY(){return"StaveConnector"}constructor(t,e){super(),this.thickness=$.STAVE_LINE_THICKNESS,this.topStave=t,this.bottomStave=e,this.type=$e.type.DOUBLE,this.xShift=0,this.texts=[]}setType(t){const e="string"==typeof t?$e.typeString[t]:t;return Object.values($e.type).includes(e)&&(this.type=e),this}getType(){return this.type}setText(t,e={}){var i,s;const n=new P("StaveConnector.text");return n.setText(t),n.setXShift(null!==(i=e.shiftX)&&void 0!==i?i:0),n.setYShift(null!==(s=e.shiftY)&&void 0!==s?s:0),this.texts.push(n),this}draw(){const t=this.checkContext();this.setRendered();let e=this.topStave.getYForLine(0),i=this.bottomStave.getYForLine(this.bottomStave.getNumLines()-1)+this.thickness,s=3,n=this.topStave.getX();(this.type===$e.type.SINGLE_RIGHT||this.type===$e.type.BOLD_DOUBLE_RIGHT||this.type===$e.type.THIN_DOUBLE)&&(n=this.topStave.getX()+this.topStave.getWidth());let o=i-e;const a=new P;switch(this.type){case $e.type.SINGLE:case $e.type.SINGLE_LEFT:case $e.type.SINGLE_RIGHT:s=1;break;case $e.type.DOUBLE:n-=5,e-=this.thickness,o+=.5;break;case $e.type.BRACE:{s=12;const n=this.topStave.getX()-2+this.xShift,a=e,r=n,h=i,c=n-s,l=a+o/2,d=c-.9*s,u=a+.2*o,g=n+1.1*s,p=l-.135*o,m=g,f=l+.135*o,S=d,x=h-.2*o,w=c-s,T=x,b=n+.4*s,y=l+.135*o,v=b,k=l-.135*o,B=w,C=u;t.beginPath(),t.moveTo(n,a),t.bezierCurveTo(d,u,g,p,c,l),t.bezierCurveTo(m,f,S,x,r,h),t.bezierCurveTo(w,T,b,y,c,l),t.bezierCurveTo(v,k,B,C,n,a),t.fill(),t.stroke();break}case $e.type.BRACKET:e-=6,i+=6,o=i-e,a.setText(I.bracketTop),a.renderText(t,n-5,e),a.setText(I.bracketBottom),a.renderText(t,n-5,i),n-=5;break;case $e.type.BOLD_DOUBLE_LEFT:qe(t,this.type,n+this.xShift,e,i-this.thickness);break;case $e.type.BOLD_DOUBLE_RIGHT:qe(t,this.type,n,e,i-this.thickness);break;case $e.type.THIN_DOUBLE:s=1,o-=this.thickness;break;case $e.type.NONE:break;default:throw new p("InvalidType",`The provided StaveConnector.type (${this.type}) is invalid.`)}this.type!==$e.type.BRACE&&this.type!==$e.type.BOLD_DOUBLE_LEFT&&this.type!==$e.type.BOLD_DOUBLE_RIGHT&&this.type!==$e.type.NONE&&t.fillRect(n,e,s,o),this.type===$e.type.THIN_DOUBLE&&t.fillRect(n-3,e,s,o);for(let e=0;e<this.texts.length;e++){const i=this.texts[e],s=this.topStave.getX()-i.getWidth()-24,n=(this.topStave.getYForLine(0)+this.bottomStave.getBottomLineY())/2;i.renderText(t,s,n+4)}}}function Ke(t,e,i,s){let n=e;for(let e=i+1;e<t.length;e++){const i=t[e];if(tt(i)&&!i.isRest()&&!i.shouldIgnoreTicks()){n=i.getLineForRest();break}}if(s&&e!==n){n=x(Math.max(e,n),Math.min(e,n))}return n}$e.type={SINGLE_RIGHT:0,SINGLE_LEFT:1,SINGLE:1,DOUBLE:2,BRACE:3,BRACKET:4,BOLD_DOUBLE_LEFT:5,BOLD_DOUBLE_RIGHT:6,THIN_DOUBLE:7,NONE:8},$e.typeString={singleRight:$e.type.SINGLE_RIGHT,singleLeft:$e.type.SINGLE_LEFT,single:$e.type.SINGLE,double:$e.type.DOUBLE,brace:$e.type.BRACE,bracket:$e.type.BRACKET,boldDoubleLeft:$e.type.BOLD_DOUBLE_LEFT,boldDoubleRight:$e.type.BOLD_DOUBLE_RIGHT,thinDouble:$e.type.THIN_DOUBLE,none:$e.type.NONE};class Qe{static SimpleFormat(t,e=0,{paddingBetween:i=10}={}){t.reduce((t,e)=>{e.addToModifierContext(new Oe);const s=(new Zt).addTickable(e).preFormat(),n=s.getMetrics();return s.setX(t+n.totalLeftPx),t+s.getWidth()+n.totalRightPx+i},e)}static plotDebugging(t,e,i,s,n,o){var a,r;const h=i+(o=Object.assign({stavePadding:B.get("Stave.padding")},o)).stavePadding,c=e.contextGaps;t.save(),t.setFont(B.get("fontFamily"),8),c.gaps.forEach(e=>{var i,o,a;i=h+e.x1,o=h+e.x2,a="rgba(100,200,100,0.4)",t.beginPath(),t.setStrokeStyle(a),t.setFillStyle(a),t.setLineWidth(1),t.fillRect(i,s,Math.max(o-i,0),n-s),t.setFillStyle("green"),t.fillText(Math.round(e.x2-e.x1).toString(),h+e.x1,n+12)}),t.setFillStyle("red"),t.fillText(`Loss: ${(null!==(a=e.totalCost)&&void 0!==a?a:0).toFixed(2)} Shift: ${(null!==(r=e.totalShift)&&void 0!==r?r:0).toFixed(2)} Gap: ${c.total.toFixed(2)}`,h-20,n+27),t.restore()}static FormatAndDraw(t,e,i,s){let n={autoBeam:!1,alignRests:!1};"object"==typeof s?n=Object.assign(Object.assign({},n),s):"boolean"==typeof s&&(n.autoBeam=s);const o=new ge($.TIME4_4).setMode(ge.Mode.SOFT).addTickables(i),a=n.autoBeam?Ft.applyAndGetBeams(o):[];return(new Qe).joinVoices([o]).formatToStave([o],e,{alignRests:n.alignRests,stave:e}),o.setContext(t).setStave(e).drawWithStyle(),a.forEach(e=>e.setContext(t).drawWithStyle()),o.getBoundingBox()}static FormatAndDrawTab(t,e,i,s,n,o,a){let r={autoBeam:o,alignRests:!1};"object"==typeof a?r=Object.assign(Object.assign({},r),a):"boolean"==typeof a&&(r.autoBeam=a);const h=new ge($.TIME4_4).setMode(ge.Mode.SOFT).addTickables(n),c=new ge($.TIME4_4).setMode(ge.Mode.SOFT).addTickables(s),l=r.autoBeam?Ft.applyAndGetBeams(h):[];(new Qe).joinVoices([h]).joinVoices([c]).formatToStave([h,c],i,{alignRests:r.alignRests}),h.draw(t,i),c.draw(t,e),l.forEach(e=>e.setContext(t).drawWithStyle()),new $e(i,e).setContext(t).drawWithStyle()}static AlignRestsToNotes(t,e,i=!1){t.forEach((s,n)=>{if(et(s)&&s.isRest()){if(s.getTuplet()&&!i)return;if(3!==s.getLineForRest())return;if(e||s.getBeam()){const e=s.getKeyProps()[0];if(0===n)e.line=Ke(t,e.line,n,!1);else if(n>0&&n<t.length){const i=t[n-1];if(et(i))if(i.isRest())e.line=i.getKeyProps()[0].line;else{const s=i.getLineForRest();e.line=Ke(t,s,n,!0)}}s.setKeyLine(0,e.line)}}})}constructor(t){if(this.formatterOptions=Object.assign({globalSoftmax:!1,softmaxFactor:$.SOFTMAX_FACTOR,maxIterations:5},t),(null==t?void 0:t.spacing)&&!["proportional","optical"].includes(t.spacing.mode))throw new p("BadArgument","Unknown formatter spacing mode.");this.justifyWidth=0,this.totalCost=0,this.totalShift=0,this.durationStats={},this.minTotalWidth=0,this.hasMinTotalWidth=!1,this.tickContexts={map:{},array:[],list:[],resolutionMultiplier:0},this.modifierContexts=[],this.contextGaps={total:0,gaps:[]},this.voices=[],this.lossHistory=[]}alignRests(t,e){if(!t||!t.length)throw new p("BadArgument","No voices to format rests");t.forEach(t=>Qe.AlignRestsToNotes(t.getTickables(),e))}preCalculateMinTotalWidth(t){if(this.formatterOptions.spacing)return this.createTickContexts(t),this.minTotalWidth=this.proportional.minimumWidth(this.formatterOptions.spacing),this.hasMinTotalWidth=!0,this.minTotalWidth;const e=B.get("Stave.unalignedNotePadding");let i=0,s=0,n=0;const o=[],a=[];if(this.hasMinTotalWidth)return this.minTotalWidth;if(!t)throw new p("BadArgument","'voices' required to run preCalculateMinTotalWidth");this.createTickContexts(t);const{list:r,map:h}=this.tickContexts;this.minTotalWidth=0,r.forEach(e=>{const r=h[e];r.preFormat(),r.getTickables().length<t.length&&(i+=1),r.getTickables().forEach(t=>{s+=t.getMetrics().width,n+=t.getTicks().value(),o.push(t.getMetrics().width),a.push(t.getTicks().value())});const c=r.getWidth();this.minTotalWidth+=c}),this.hasMinTotalWidth=!0;const c=s>0?s/o.length:1/o.length,l=b(o.map(t=>Math.pow(t-c,2))),d=Math.pow(l/o.length,.5)/c,u=n/a.length,g=b(a.map(t=>Math.pow(t-u,2))),m=Math.pow(g/a.length,.5)/u,f=Math.max(m,d)*r.length*e,S=e*i;return this.minTotalWidth+Math.max(S,f)}getMinTotalWidth(){if(!this.hasMinTotalWidth)throw new p("NoMinTotalWidth","Call 'preCalculateMinTotalWidth' or 'preFormat' before calling 'getMinTotalWidth'");return this.minTotalWidth}static getResolutionMultiplier(t){if(!t||!t.length)throw new p("BadArgument","No voices to format");const e=t[0].getTotalTicks();return t.reduce((t,i)=>{if(!i.getTotalTicks().equals(e))throw new p("TickMismatch","Voices should have same total note duration in ticks.");if(i.getMode()===ge.Mode.STRICT&&!i.isComplete())throw new p("IncompleteVoice","Voice does not have enough notes.");return Math.max(t,y.LCM(t,i.getResolutionMultiplier()))},1)}createModifierContexts(t){if(0===t.length)return;const e=Qe.getResolutionMultiplier(t),i=new Map,s=[];t.forEach(t=>{const n=new y(0,e);t.getTickables().forEach(t=>{const e=n.numerator;let o=i.get(t.getStave());if(o||(i.set(t.getStave(),{}),o=i.get(t.getStave())),!(o?o[e]:void 0)){const t=new Oe;s.push(t),o[e]=t}t.addToModifierContext(o[e]),this.formatterOptions.spacing&&t.shouldIgnoreTicks()||n.add(t.getTicks())})}),this.modifierContexts.push({map:i,array:s,resolutionMultiplier:e})}createTickContexts(t){if(0===t.length){if(this.formatterOptions.spacing)throw new p("BadArgument","No voices to format");return{map:{},array:[],list:[],resolutionMultiplier:0}}if(this.formatterOptions.spacing)return this.proportional=new Me(t,Qe.getResolutionMultiplier(t)),this.tickContexts=this.proportional.contexts,this.tickContexts;const e={},i=[],s=[],n=Qe.getResolutionMultiplier(t);t.forEach((t,o)=>{const a=new y(0,n);t.getTickables().forEach(t=>{const n=a.numerator;if(!e[n]){const t=new Zt({tickID:n});s.push(t),e[n]=t,i.push(n)}e[n].addTickable(t,o),a.add(t.getTicks())})});const o={map:e,array:s,list:i.sort((t,e)=>t-e),resolutionMultiplier:n};Zt.linkTimeline(o.list.map(t=>o.map[t])),this.tickContexts=o;const a=this.tickContexts.array;return a.forEach(t=>{t.tContexts=a}),o}getTickContexts(){return this.tickContexts}preFormat(t=0,e,i,s){const n=this.tickContexts;if(!n)throw new p("NoTickContexts","preFormat requires TickContexts");const{list:o,map:a}=n;if(this.lossHistory=[],i&&s&&i.forEach(t=>t.setStave(s).preFormat()),this.proportional&&this.formatterOptions.spacing){const e=this.formatterOptions.spacing;return this.minTotalWidth=this.proportional.minimumWidth(e),this.justifyWidth=this.proportional.format(e,t),this.hasMinTotalWidth=!0,this.evaluate()}let r=0,h=0;this.minTotalWidth=0;let c=0;o.forEach(t=>{const e=a[t];e.preFormat();const i=e.getWidth();this.minTotalWidth+=i;const s=e.getMaxTicks().value();c+=s;const n=e.getMetrics();r=r+h+n.totalLeftPx,e.setX(r),h=i-n.totalLeftPx});const{globalSoftmax:l,softmaxFactor:d,maxIterations:u}=this.formatterOptions,g=b(o.map(t=>Math.pow(d,a[t].getMaxTicks().value()/c)));if(this.minTotalWidth=r+h,this.hasMinTotalWidth=!0,t<=0)return this.evaluate();const m=a[o[0]],S=a[o[o.length-1]];function x(t){return o.map((e,i)=>{const s=a[e],n=s.getTickablesByVoice();let r;if(i>0){const e=a[o[i-1]];for(let h=i-1;h>=0;h--){const i=a[o[h]].getTickablesByVoice(),u=[];if(Object.keys(n).forEach(t=>{i[t]&&u.push(t)}),u.length>0){let o=0,a=1/0,h=0;if(u.forEach(t=>{const e=i[t].getTicks().value();e>o&&(r=i[t],o=e);const s=n[t],h=s.getX()-(s.getMetrics().modLeftPx+s.getMetrics().leftDisplacedHeadPx),c=i[t].getMetrics(),l=i[t].getX()+c.notePx+c.modRightPx+c.rightDisplacedHeadPx;a=Math.min(a,h-l)}),a=Math.min(a,s.getX()-(e.getX()+.05*t)),l){const e=c;h=Math.pow(d,o/e)/g*t}else void 0!==r&&(h=r.getVoice().softmax(o)*t);return{expectedDistance:h,maxNegativeShiftPx:a,fromTickable:r}}}}return{expectedDistance:0,fromTickablePx:0,maxNegativeShiftPx:0}})}function w(t){const e=T/2;let i=0;return o.forEach((s,n)=>{const o=a[s];if(n>0){const e=o.getX(),s=t[n],a=f(s.fromTickable).getX()+s.expectedDistance-(e+i);let r=0;a>0?i+=a:a<0&&(r=Math.min(s.maxNegativeShiftPx,Math.abs(a)),i+=-r),o.setX(e+i)}o.getCenterAlignedTickables().forEach(t=>{t.setCenterXShift(e-o.getX())})}),S.getX()-m.getX()}const T=t-S.getMetrics().notePx-S.getMetrics().totalRightPx-m.getMetrics().totalLeftPx,y=B.get("Stave.endPaddingMin"),v=B.get("Stave.endPaddingMax"),k=B.get("Stave.padding");let C=T;const D=x(C);let E=w(D);if(1===o.length)return 0;const L=((t,e)=>{let i=t/2;if(e.length>1)for(let t=1;t<e.length;++t)i=Math.min(e[t].expectedDistance/2,i);return i})(C,D),N=t=>{let e=0;const i=S&&S.getMaxTickable();if(i){const s=i.getVoice();if(s.getTicksUsed().value()>s.getTotalTicks().value())return 2*v<L?L:v;const n=i.getWidth();e=s.softmax(S.getMaxTicks().value())*t-(n+k)}return 2*v<e?e:v};let O=N(C),A=O-(v-y);const F=T-A;let M=u;for(;E>F&&M>0||E+O<F&&M>1;)C-=E-F,O=N(C),A=O-(v-y),E=w(x(C)),M--;return this.justifyWidth=t,this.evaluate()}evaluate(){const t=this.tickContexts,e=this.justifyWidth;this.contextGaps={total:0,gaps:[]},t.list.forEach((e,i)=>{if(0===i)return;const s=t.list[i-1],n=t.map[s],o=t.map[e],a=n.getMetrics(),r=o.getMetrics(),h=n.getX()+a.notePx+a.totalRightPx,c=o.getX()-r.totalLeftPx,l=c-h;this.contextGaps.total+=l,this.contextGaps.gaps.push({x1:h,x2:c}),o.getFormatterMetrics().freedom.left=l,n.getFormatterMetrics().freedom.right=l}),this.durationStats={};const i=this.durationStats;this.voices.forEach(t=>{t.getTickables().forEach((t,s,n)=>{const o=t.getTicks().clone().simplify().toString(),a=t.getMetrics(),r=t.getFormatterMetrics(),h=t.getX()+a.notePx+a.modRightPx+a.rightDisplacedHeadPx;let c=0;if(s<n.length-1){const e=n[s+1],i=e.getMetrics();c=e.getX()-i.modLeftPx-i.leftDisplacedHeadPx-h,r.space.used=e.getX()-t.getX(),e.getFormatterMetrics().freedom.left=c}else c=e-h,r.space.used=e-t.getX();r.freedom.right=c,function(t,e){const s=i[t];void 0===s?i[t]={mean:e,count:1,total:e}:(s.count+=1,s.total+=e,s.mean=s.total/s.count)}(o,r.space.used)})});let s=0;return this.voices.forEach(t=>{t.getTickables().forEach(t=>{const e=t.getTicks().clone().simplify().toString(),n=t.getFormatterMetrics();n.space.mean=i[e].mean,n.duration=e,n.iterations+=1,n.space.deviation=n.space.used-n.space.mean,s+=Math.pow(n.space.deviation,2)})}),this.totalCost=Math.sqrt(s),this.lossHistory.push(this.totalCost),this.totalCost}tune(t){var e;if(this.proportional)return this.totalCost;const i=this.tickContexts;if(!i)return 0;const s=null!==(e=null==t?void 0:t.alpha)&&void 0!==e?e:.5;let n=0;return this.totalShift=0,i.list.forEach((t,e,o)=>{const a=i.map[t],r=e>0?i.map[o[e-1]]:void 0,h=e<o.length-1?i.map[o[e+1]]:void 0;a.move(n,r,h);const c=-a.getDeviationCost();c>0?n=-Math.min(a.getFormatterMetrics().freedom.right,Math.abs(c)):c<0&&(n=h?Math.min(h.getFormatterMetrics().freedom.right,Math.abs(c)):0),n*=s,this.totalShift+=n}),this.evaluate()}postFormat(){this.modifierContexts.forEach(t=>{t.array.forEach(t=>t.postFormat())});return(this.proportional?this.tickContexts.array:this.tickContexts.list.map(t=>this.tickContexts.map[t])).forEach(t=>t.postFormat()),this}joinVoices(t){return this.createModifierContexts(t),this.hasMinTotalWidth=!1,this}format(t,e,i){var s;const n=Object.assign({alignRests:!1},i);this.voices=t;for(const e of t)for(const t of e.getTickables())tt(t)&&(null===(s=t.getBeam())||void 0===s||s.resetLayout());const o=this.formatterOptions.softmaxFactor;return o&&this.voices.forEach(t=>t.setSoftmaxFactor(o)),this.alignRests(t,n.alignRests),this.createTickContexts(t),this.preFormat(e,n.context,t,n.stave),n.stave&&this.postFormat(),this}formatToStave(t,e,i){const s=Object.assign({context:e.getContext()},i),n=e.getNoteEndX()-e.getNoteStartX()-je.defaultPadding;return function(...t){Qe.DEBUG&&S("VexFlow.Formatter",t)}("Formatting voices to width: ",n),this.format(t,n,s)}getTickContext(t){var e;return null===(e=this.tickContexts)||void 0===e?void 0:e.map[t]}}Qe.DEBUG=!1;const Je="Ghost note must have valid initialization data to identify duration.";class Ze extends re{static get CATEGORY(){return"GhostNote"}constructor(t){if(!t)throw new p("BadArguments",Je);let e;if("string"==typeof t)e={duration:t};else{if("object"!=typeof t)throw new p("BadArguments",Je);e=t}super(e),this.setWidth(0)}isRest(){return!0}setStave(t){return super.setStave(t),this}addToModifierContext(t){return this}preFormat(){return this.preFormatted=!0,this}draw(){this.setRendered();for(let t=0;t<this.modifiers.length;++t){const e=this.modifiers[t];Q(e)&&(e.setContext(this.getContext()),e.drawWithStyle())}}}class ti extends vt{static get CATEGORY(){return"GlyphNote"}constructor(t,e,i){super(e),this.options=Object.assign({ignoreTicks:!1,line:2},i),this.ignoreTicks=this.options.ignoreTicks,this.setGlyph(t)}setGlyph(t){return this.text=t,this}preFormat(){return!this.preFormatted&&this.modifierContext&&this.modifierContext.preFormat(),this.preFormatted=!0,this}drawModifiers(){const t=this.checkContext();for(let e=0;e<this.modifiers.length;e++){const i=this.modifiers[e];i.setContext(t),i.drawWithStyle()}}draw(){const t=this.checkStave(),e=t.checkContext();this.setRendered();const i=this.getAttribute("class");e.openGroup("glyphNote"+(i?" "+i:""),this.getAttribute("id")),this.x=this.isCenterAligned()?this.getAbsoluteX()-this.getWidth()/2:this.getAbsoluteX(),this.y=t.getYForLine(this.options.line),this.renderText(e,0,0),this.drawModifiers(),this.drawPointerRect(),e.closeGroup()}}class ei extends ce{static get CATEGORY(){return"GraceNote"}static get LEDGER_LINE_OFFSET(){return 2}constructor(t){super(Object.assign({strokePx:ei.LEDGER_LINE_OFFSET},t)),this.slash=t.slash||!1,this.slur=!0,this.buildNoteHeads(),this.width=3}getStemExtension(){if(this.stemExtensionOverride)return this.stemExtensionOverride;let t=super.getStemExtension();return t=at.HEIGHT*this.getFontScale()-at.HEIGHT+t,t}getSlash(){if(!this.slash||!this.stem)return;const t=this.getFontScale();let e;const i=this.beam;if(i)i.postFormatted||i.postFormat(),e=this.calcBeamedNotesSlashBBox(8*t,8*t,{stem:6*t,beam:5*t});else{const i=this.getStemDirection(),s=this.getNoteHeadBounds(),n=this.noteHeads[0].getWidth(),o=i===at.DOWN?this.getAbsoluteX():this.getAbsoluteX()+n,a=$.STEM_HEIGHT*t/2,r=i===at.DOWN?s.yBottom+a:s.yTop-a;e=i===at.DOWN?{x1:o-n,y1:r-n,x2:o+n,y2:r+n}:{x1:o-n,y1:r+n,x2:o+n,y2:r-n}}return{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2}}draw(){super.draw();const t=this.getSlash();if(t){const e=this.getFontScale(),i=this.checkContext();i.setLineWidth(1*e),i.beginPath(),i.moveTo(t.x1,t.y1),i.lineTo(t.x2,t.y2),i.closePath(),i.stroke()}}calcBeamedNotesSlashBBox(t,e,i){const s=this.beam;if(!s)throw new p("NoBeam","Can't calculate without a beam.");const n=s.slope,o=s.notes[s.notes.length-1]===this?-1:1,a=Math.atan(n*o),r=Math.cos(a)*e,h=Math.sin(a)*e;t*=this.getStemDirection();const c=Math.atan((h-t)/r),l=Math.cos(c)*i.stem*o,d=Math.sin(c)*i.stem,u=Math.cos(c)*i.beam*o,g=Math.sin(c)*i.beam,m=this.getStemX(),f=s.notes[0].getStemX(),S=s.getBeamYToDraw()+(m-f)*n;return{x1:m-l,y1:S+t-d,x2:m+r*o+u,y2:S+h+g}}}class ii extends re{static get CATEGORY(){return"TabNote"}constructor(t,e=!1){super(t),this.fretElement=[],this.greatestString=()=>this.positions.map(t=>t.str).reduce((t,e)=>t>e?t:e),this.leastString=()=>this.positions.map(t=>t.str).reduce((t,e)=>t<e?t:e),this.ghost=!1,this.positions=t.positions||[],this.renderOptions=Object.assign(Object.assign({},this.renderOptions),{drawStem:e,drawDots:e,drawStemThroughStave:!1,yShift:0}),this.glyphProps=vt.getGlyphProps(this.duration,this.noteType),f(this.glyphProps,"BadArguments",`No glyph found for duration '${this.duration}' and type '${this.noteType}'`),this.buildStem(),t.stemDirection?this.setStemDirection(t.stemDirection):this.setStemDirection(at.UP),this.ghost=!1,this.updateWidth()}reset(){return super.reset(),this.stave&&this.setStave(this.stave),this}setGhost(t){return this.ghost=t,this.updateWidth(),this}hasStem(){return!!this.renderOptions.drawStem}getStemExtension(){return void 0!==this.stemExtensionOverride?this.stemExtensionOverride:this.flag.getHeight()>at.HEIGHT?this.flag.getHeight()-at.HEIGHT:0}static tabToElement(t){let e;return"X"===t.toUpperCase()?(e=new P("TabNote"),e.setText(I.accidentalDoubleSharp)):(e=new P("TabNote.text"),e.setText(t),e.setYShift(e.getHeight()/2)),e}setFontSize(t){return super.setFontSize(t),this.fretFontSize=t,this.positions&&this.updateWidth(),this.preFormatted=!1,this}updateWidth(){this.fretElement=[],this.width=0;for(let t=0;t<this.positions.length;++t){let e=this.positions[t].fret;this.ghost&&(e="("+e+")");const i=ii.tabToElement(e.toString()),s=A.convertSizeToPointValue(B.getFontInfo("TabNote.text").size),n=void 0===this.fretFontSize?s*this.getFontScale():A.convertSizeToPointValue(this.fretFontSize);i.setFontSize(A.convertSizeToPointValue(i.fontInfo.size)*n/s);const o=i.getTextMetrics();i.setYShift((o.actualBoundingBoxAscent-o.actualBoundingBoxDescent)/2),this.fretElement.push(i),this.width=Math.max(i.getWidth(),this.width)}}setStave(t){super.setStave(t);const e=t.getContext();this.setContext(e);const i=this.positions.map(({str:e})=>t.getYForLine(Number(e)-1));return this.setYs(i),this.stem&&this.stem.setYBounds(this.getStemY(),this.getStemY()),this}getPositions(){return this.positions}getModifierStartXY(t,e){if(!this.preFormatted)throw new p("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");if(0===this.ys.length)throw new p("NoYValues","No Y-Values calculated for this note.");let i=0;if(t===W.Position.LEFT)i=-2;else if(t===W.Position.RIGHT)i=this.width+2;else if(t===W.Position.BELOW||t===W.Position.ABOVE){i=this.width/2}return{x:this.getAbsoluteX()+i,y:this.ys[e]}}getLineForRest(){return Number(this.positions[0].str)}preFormat(){this.preFormatted||(this.modifierContext&&this.modifierContext.preFormat(),this.preFormatted=!0)}getStemX(){return this.getCenterGlyphX()}getStemY(){const t=this.checkStave().getNumLines()-.5,e=at.UP===this.stemDirection?-.5:t;return this.checkStave().getYForLine(e)}getStemExtents(){return this.checkStem().getExtents()}drawFlag(){const{beam:t,glyphProps:e,renderOptions:{drawStem:i}}=this,s=this.checkContext(),n=void 0===t&&i;if(e.codeFlagUp&&n){const t=this.getStemX(),e=this.getStemDirection()===at.DOWN?this.getStemY()-this.checkStem().getHeight()-this.getStemExtension():this.getStemY()-this.checkStem().getHeight()+this.getStemExtension();this.flag.setContext(s).setX(t).setY(e).drawWithStyle()}}drawModifiers(){this.modifiers.forEach(t=>{K(t,"Dot")&&!this.renderOptions.drawDots||(t.setContext(this.getContext()),t.drawWithStyle())})}drawStemThrough(){const t=this.getStemX(),e=this.getStemY(),i=this.checkContext(),s=this.renderOptions.drawStem,n=this.renderOptions.drawStemThroughStave;if(s&&n){const s=function(t,e){const i=[];let s=[];for(let n=1;n<=t;n++)e.indexOf(n)>-1?(i.push(s),s=[]):s.push(n);return s.length>0&&i.push(s),i}(this.checkStave().getNumLines(),this.positions.map(t=>Number(t.str))),n=function(t,e,i,s){const n=1!==s,o=-1!==s,a=i.getSpacingBetweenLines(),r=i.getNumLines(),h=[];return e.forEach(e=>{const c=e.indexOf(r)>-1,l=e.indexOf(1)>-1;if(n&&l||o&&c)return;1===e.length&&e.push(e[0]);const d=[];e.forEach((e,n,o)=>{const h=1===e,c=e===r;let l=i.getYForLine(e-1);0!==n||h?n!==o.length-1||c||(l+=a/2-1):l-=a/2-1,d.push(l),1===s&&h?d.push(t-2):-1===s&&c&&d.push(t+2)}),h.push(d.sort((t,e)=>t-e))}),h}(e,s,this.checkStave(),this.getStemDirection());i.setLineWidth(at.WIDTH),n.forEach(e=>{0!==e.length&&(i.beginPath(),i.moveTo(t,e[0]),i.lineTo(t,e[e.length-1]),i.stroke(),i.closePath())})}}drawPositions(){const t=this.checkContext(),e=this.getAbsoluteX(),i=this.ys;for(let s=0;s<this.positions.length;++s){const n=i[s]+this.renderOptions.yShift,o=this.fretElement[s],a=e-o.getWidth()/2;t.clearRect(a-2,n-3,o.getWidth()+4,6),o.renderText(t,a,n)}}draw(){const t=this.checkContext();if(0===this.ys.length)throw new p("NoYValues","Can't draw note without Y values.");this.setRendered();const e=void 0===this.beam&&this.renderOptions.drawStem,i=this.getAttribute("class");if(t.openGroup("tabnote"+(i?" "+i:""),this.getAttribute("id")),this.drawPositions(),this.drawStemThrough(),this.stem&&e){const e=this.getStemX();this.stem.setNoteHeadXBounds(e,e),this.stem.setContext(t).drawWithStyle()}this.drawFlag(),this.drawModifiers(),this.drawPointerRect(),t.closeGroup()}}class si extends ii{static get CATEGORY(){return"GraceTabNote"}constructor(t){super(t,!1),this.renderOptions=Object.assign(Object.assign({},this.renderOptions),{yShift:.3}),this.updateWidth()}}class ni extends vt{static get CATEGORY(){return"KeySigNote"}constructor(t,e,i,s){super({duration:"b"}),this.keySignature=new Pe(t,e,i).setClef(s),this.ignoreTicks=!0}addToModifierContext(t){return this}preFormat(){return this.preFormatted=!0,this.keySignature.setStave(this.checkStave()),this.setWidth(this.keySignature.getWidth()),this}draw(){const t=this.checkStave().checkContext();this.setRendered(),this.keySignature.setX(this.getAbsoluteX()),this.keySignature.setContext(t),this.keySignature.drawWithStyle()}}class oi extends P{static get CATEGORY(){return"MultiMeasureRest"}constructor(t,e){var i;super(),this.xs={left:NaN,right:NaN},this.hasPaddingLeft=!1,this.hasPaddingRight=!1,this.hasLineThickness=!1,this.hasSymbolSpacing=!1;const s=null!==(i=e.numberGlyphPoint)&&void 0!==i?i:B.get("MultiMeasureRest.fontSize");this.fontInfo.size=s,this.numberOfMeasures=t,this.text="";const n=`${this.numberOfMeasures}`;for(const t of n)this.text+=String.fromCodePoint(57472+Number(t));this.hasPaddingLeft="number"==typeof e.paddingLeft,this.hasPaddingRight="number"==typeof e.paddingRight,this.hasLineThickness="number"==typeof e.lineThickness,this.hasSymbolSpacing="number"==typeof e.symbolSpacing,this.renderOptions=Object.assign({useSymbols:!1,showNumber:!0,numberLine:-.5,numberGlyphPoint:s,line:2,spacingBetweenLinesPx:$.STAVE_LINE_DISTANCE,serifThickness:2,semibreveRestGlyphScale:B.get("fontSize"),paddingLeft:0,paddingRight:0,lineThickness:5,symbolSpacing:0},e)}getXs(){return this.xs}setStave(t){return this.stave=t,this}getStave(){return this.stave}checkStave(){return f(this.stave,"NoStave","No stave attached to instance.")}drawLine(t,e,i,s){const n=this.renderOptions,o=t.getYForLine(n.line),a=.1*(s-i);i+=a,s-=a;let r="";const h=new P;h.setText(r);const c=h.getWidth();if(!c)throw new p("Cannot drawLine if width is 0");for(let t=1;(t+2)*c+i<=s;t++)r+="";r+="",h.setText(r),h.renderText(e,i+.5*(s-i)-.5*h.getWidth(),o)}drawSymbols(t,e,i,s){const n=Math.floor(this.numberOfMeasures/4),o=this.numberOfMeasures%4,a=Math.floor(o/2),r=o%2,h=this.renderOptions,c=new P;let l="";for(let t=0;t<n;++t)l+=I.restLonga+" ";for(let t=0;t<a;++t)l+=I.restDoubleWhole+" ";c.setText(l);const d=new P;l="";for(let t=0;t<r;++t)l+=I.restWhole+" ";d.setText(l);let u=i+.5*(s-i)-.5*(c.getWidth()+d.getWidth());const g=h.line,p=t.getYForLine(g-1),m=t.getYForLine(g);c.renderText(e,u,m),u+=c.getWidth(),d.renderText(e,u,p),u+=d.getWidth()}draw(){const t=this.checkContext();this.setRendered();const e=this.checkStave();let i=e.getNoteStartX(),s=e.getNoteEndX();const n=e.getModifiers(kt.BEGIN);1===n.length&&J(n[0])&&(i-=n[0].getWidth());const o=this.renderOptions;this.hasPaddingLeft&&(i=e.getX()+o.paddingLeft),this.hasPaddingRight&&(s=e.getX()+e.getWidth()-o.paddingRight),this.xs.left=i,this.xs.right=s,o.useSymbols?this.drawSymbols(e,t,i,s):this.drawLine(e,t,i,s),o.showNumber&&this.renderText(t,i+.5*(s-i)-.5*this.width,e.getYForLine(o.numberLine)-.5*this.height)}}class ai extends P{static get CATEGORY(){return"PedalMarking"}static createSustain(t){return new ai(t)}static createSostenuto(t){const e=new ai(t);return e.setType(ai.type.MIXED),e.setCustomText("Sost. Ped."),e}static createUnaCorda(t){const e=new ai(t);return e.setType(ai.type.TEXT),e.setCustomText("una corda","tre corda"),e}constructor(t){super(),this.notes=t,this.type=ai.type.TEXT,this.line=0,this.depressText=ai.GLYPHS.pedalDepress,this.releaseText=ai.GLYPHS.pedalRelease,this.renderOptions={bracketHeight:10,textMarginRight:6,bracketLineWidth:1}}setType(t){return(t="string"==typeof t?ai.typeString[t]:t)>=ai.type.TEXT&&t<=ai.type.MIXED&&(this.type=t),this}setCustomText(t,e){return this.depressText=t||"",this.releaseText=e||"",this.setFont(B.getFontInfo("PedalMarking.text")),this}setLine(t){return this.line=t,this}getYForStave(t){let e=t.getYForBottomText(this.line+3);const i=this.notes.filter(e=>e.getStave()===t);if(!i.length)return e;const s=Math.min(...i.map(t=>t.getAbsoluteX())),n=Math.max(...i.map(t=>t.getAbsoluteX())),o=new Set(i.map(t=>t.getVoice())),a=new P("PedalMarking").setFont(this.fontInfo),r=Math.max(a.setText(this.depressText).getTextMetrics().actualBoundingBoxAscent,a.setText(this.releaseText).getTextMetrics().actualBoundingBoxAscent),h=this.type===ai.type.BRACKET?this.renderOptions.bracketHeight:Math.max(r,this.type===ai.type.MIXED?this.renderOptions.bracketHeight:0);for(const i of o)for(const o of i.getTickables())if(et(o)&&o.getStave()===t&&!(o.getAbsoluteX()<s||o.getAbsoluteX()>n))for(const t of o.getModifiers()){if(!Q(t)||t.getVerticalJustification()!==ct.VerticalJustify.BOTTOM)continue;const i=t.computeY().y+t.getYShift()+t.getTextMetrics().actualBoundingBoxDescent;e=Math.max(e,i+4+h)}return e}drawBracketed(){const t=this.checkContext();let e,i,s=!1,n=0;const o=new Map(this.notes.map(t=>[t.checkStave(),0]));for(const t of o.keys())o.set(t,this.getYForStave(t));this.notes.forEach((a,r,h)=>{var c,l,d,u;s=!s;const g=a.getAbsoluteX(),m=o.get(a.checkStave());if(g<e)throw new p("InvalidConfiguration","The notes provided must be in order of ascending x positions");const f=h[r+1]===a,S=h[r-1]===a;let x=0;if(s)x=S?5:0,this.type!==ai.type.MIXED||S?(t.beginPath(),t.moveTo(g,m-this.renderOptions.bracketHeight),t.lineTo(g+x,m),t.stroke(),t.closePath()):(n=t.measureText(this.depressText).width,t.fillText(this.depressText,g,m),x=n+this.renderOptions.textMarginRight);else{const s=a.getVoice().getTickables().indexOf(a),n=s+1<a.getVoice().getTickables().length?a.getVoice().getTickables()[s+1].getAbsoluteX():(null!==(l=null===(c=a.getStave())||void 0===c?void 0:c.getX())&&void 0!==l?l:0)+(null!==(u=null===(d=a.getStave())||void 0===d?void 0:d.getWidth())&&void 0!==u?u:0);t.beginPath(),t.moveTo(e,i),t.lineTo(f?g-5:n-5,m),t.lineTo(f?g:n-5,m-this.renderOptions.bracketHeight),t.stroke(),t.closePath()}e=g+x,i=m})}drawText(){const t=this.checkContext();let e=!1,i=0;const s=new Map(this.notes.map(t=>[t.checkStave(),0]));for(const t of s.keys())s.set(t,this.getYForStave(t));this.notes.forEach(n=>{var o,a,r,h;e=!e;const c=n.checkStave(),l=n.getAbsoluteX(),d=s.get(c);if(e)i=t.measureText(this.depressText).width,t.fillText(this.depressText,l,d);else{const e=n.getVoice().getTickables().indexOf(n),s=e+1<n.getVoice().getTickables().length?n.getVoice().getTickables()[e+1].getAbsoluteX():(null!==(a=null===(o=n.getStave())||void 0===o?void 0:o.getX())&&void 0!==a?a:0)+(null!==(h=null===(r=n.getStave())||void 0===r?void 0:r.getWidth())&&void 0!==h?h:0);i=t.measureText(this.releaseText).width,t.fillText(this.releaseText,s-i,d)}})}draw(){const t=this.checkContext();this.setRendered(),void 0!==this.renderOptions.color&&(t.setStrokeStyle(this.renderOptions.color),t.setFillStyle(this.renderOptions.color)),this.applyStyle(t),t.setFont(this.font),function(...t){ai.DEBUG&&S("VexFlow.PedalMarking",t)}("Rendering Pedal Marking"),this.type===ai.type.BRACKET||this.type===ai.type.MIXED?(t.setLineWidth(this.renderOptions.bracketLineWidth),this.drawBracketed()):this.type===ai.type.TEXT&&this.drawText()}}ai.DEBUG=!1,ai.GLYPHS={pedalDepress:I.keyboardPedalPed,pedalRelease:I.keyboardPedalUp},ai.type={TEXT:1,BRACKET:2,MIXED:3},ai.typeString={text:ai.type.TEXT,bracket:ai.type.BRACKET,mixed:ai.type.MIXED};const ri={1:I.repeat1Bar,2:I.repeat2Bars,4:I.repeat4Bars,slash:I.repeatBarSlash};class hi extends ti{static get CATEGORY(){return"RepeatNote"}constructor(t,e,i){super(ri[t]||"",Object.assign({duration:"q",alignCenter:"slash"!==t},e),i)}}class ci{constructor(t){this.systems=[],this.rows=[],this.options=Object.assign({width:500,x:10,y:10,rowGap:40,measureGap:0,measurePadding:20,justify:!0},t),this.setWidth(this.options.width);for(const t of["x","y","rowGap","measureGap","measurePadding"])if(!Number.isFinite(this.options[t])||this.options[t]<0)throw new p("BadArgument",`Sheet ${t} must be a nonnegative finite number.`)}addSystem(t={}){const e=this.options.factory.System(Object.assign(Object.assign({},t),{autoWidth:!0,noJustification:!1}));return this.systems.push(e),e}setWidth(t){if(!Number.isFinite(t)||t<=0)throw new p("BadArgument","Sheet width must be a positive finite number.");return this.options.width=t,this}getSystems(){return this.systems.slice()}getRows(){return this.rows.map(t=>Object.assign(Object.assign({},t),{systems:t.systems.slice()}))}getHeight(){const t=this.rows[this.rows.length-1];return t?t.y+t.height:this.options.y}format(){const t=this.measureSystems();this.rows=[];let e=this.options.y;for(const i of this.packRows(t)){const s=this.formatRow(i,t,e);this.rows.push(s),e+=s.height+this.options.rowGap}return this}measureSystems(){return this.systems.map(t=>(t.setX(0).setY(0).setWidth(),t.format(),t.getWidth()+this.options.measurePadding))}packRows(t){const e=[];let i=[],s=0;return t.forEach((t,n)=>{const o=i.length?this.options.measureGap:0;i.length&&s+o+t>this.options.width&&(e.push(i),i=[],s=0),s+=(i.length?this.options.measureGap:0)+t,i.push(n)}),i.length&&e.push(i),e}verticalBounds(t){let e=0,i=t.getBoundingBox().getH();for(const s of t.getVoices())for(const t of s.getTickables())if(t instanceof ce||t instanceof Jt){const s=t instanceof ce?t.getBoundingBox(!1):t.getBoundingBox();e=Math.min(e,s.getY()),i=Math.max(i,s.getY()+s.getH())}else if(t instanceof vt){const s=t.checkStave().getSpacingBetweenLines(),n=t.getYs();if(e=Math.min(e,...n.map(t=>t-s)),i=Math.max(i,...n.map(t=>t+s)),t instanceof re&&t.hasStem()){const{topY:s,baseY:n}=t.getStemExtents();e=Math.min(e,s,n),i=Math.max(i,s,n)}}return{top:e,bottom:i}}formatRow(t,e,i){const s=t.reduce((t,i)=>t+e[i],0)+this.options.measureGap*(t.length-1),n=this.options.justify?Math.max(0,this.options.width-s)/t.length:0;let o=this.options.x,a=0,r=0;const h=t.map(t=>this.systems[t]);t.forEach(t=>{const i=this.systems[t];i.setX(o).setY(0).setWidth(e[t]+n),i.format();const s=this.verticalBounds(i);a=Math.min(a,s.top),r=Math.max(r,s.bottom),o+=i.getWidth()+this.options.measureGap});for(const t of h)t.setY(i-a),t.format();const c=o-this.options.x-this.options.measureGap;return{systems:h,x:this.options.x,y:i,width:c,height:r-a,overflow:Math.max(0,c-this.options.width)}}}class li extends P{static get CATEGORY(){return"StaveHairpin"}static FormatByTicksAndDraw(t,e,i,s,n,o){var a,r;const h=e.pixelsPerTick;if(null===h)throw new p("BadArguments","A valid Formatter must be provide to draw offsets by ticks.");const c=h*(null!==(a=o.leftShiftTicks)&&void 0!==a?a:0),l=h*(null!==(r=o.rightShiftTicks)&&void 0!==r?r:0),d={height:o.height,yShift:o.yShift,leftShiftPx:c,rightShiftPx:l,rightShiftTicks:0,leftShiftTicks:0};new li({firstNote:i.firstNote,lastNote:i.lastNote},s).setContext(t).setRenderOptions(d).setPosition(n).drawWithStyle()}constructor(t,e){super(),this.setNotes(t),this.hairpin=e,this.position=W.Position.BELOW,this.renderOptions={height:10,yShift:0,leftShiftPx:0,rightShiftPx:0,rightShiftTicks:0,leftShiftTicks:0}}setPosition(t){return t!==W.Position.ABOVE&&t!==W.Position.BELOW||(this.position=t),this}setRenderOptions(t){return this.renderOptions=t,this}setNotes(t){if(!t.firstNote&&!t.lastNote)throw new p("BadArguments","Hairpin needs to have either firstNote or lastNote set.");return this.notes=t,this.firstNote=t.firstNote,this.lastNote=t.lastNote,this}renderHairpin(t){const e=this.checkContext();let i=this.renderOptions.yShift+20,s=t.firstY;this.position===W.Position.ABOVE&&(i=30-i,s=t.firstY-t.staffHeight);const n=this.renderOptions.leftShiftPx,o=this.renderOptions.rightShiftPx;switch(e.beginPath(),this.hairpin){case li.type.CRESC:e.moveTo(t.lastX+o,s+i),e.lineTo(t.firstX+n,s+this.renderOptions.height/2+i),e.lineTo(t.lastX+o,s+this.renderOptions.height+i);break;case li.type.DECRESC:e.moveTo(t.firstX+n,s+i),e.lineTo(t.lastX+o,s+this.renderOptions.height/2+i),e.lineTo(t.firstX+n,s+this.renderOptions.height+i)}e.stroke(),e.closePath()}draw(){this.checkContext(),this.setRendered();const t=this.firstNote,e=this.lastNote;if(!t||!e)throw new p("NoNote","Notes required to draw");const i=t.getModifierStartXY(this.position,0),s=e.getModifierStartXY(this.position,0);this.renderHairpin({firstX:i.x,lastX:s.x,firstY:t.checkStave().getY()+t.checkStave().getHeight(),lastY:e.checkStave().getY()+e.checkStave().getHeight(),staffHeight:t.checkStave().getHeight()})}}function di(t,e,i,s,n,o,a){t.beginPath(),t.moveTo(e,i),t.lineTo(s,n),t.lineTo(o,a),t.lineTo(e,i),t.closePath(),t.fill()}li.type={CRESC:1,DECRESC:2};class ui extends P{static get CATEGORY(){return"StaveLine"}constructor(t){super(),this.setNotes(t),this.text="",this.renderOptions={paddingLeft:4,paddingRight:3,lineWidth:1,lineDash:void 0,roundedEnd:!0,color:void 0,drawStartArrow:!1,drawEndArrow:!1,arrowheadLength:10,arrowheadAngle:Math.PI/8,textPositionVertical:ui.TextVerticalPosition.TOP,textJustification:ui.TextJustification.CENTER}}setText(t){return this.text=t,this}setNotes(t){if(!t.firstNote&&!t.lastNote)throw new p("BadArguments","Notes needs to have either firstNote or lastNote set.");if(t.firstIndexes||(t.firstIndexes=[0]),t.lastIndexes||(t.lastIndexes=[0]),t.firstIndexes.length!==t.lastIndexes.length)throw new p("BadArguments","Connected notes must have same number of indexes.");return this.notes=t,this.firstNote=t.firstNote,this.firstIndexes=t.firstIndexes,this.lastNote=t.lastNote,this.lastIndexes=t.lastIndexes,this}applyLineStyle(){const t=this.checkContext(),e=this.renderOptions;e.lineDash&&t.setLineDash(e.lineDash),e.lineWidth&&t.setLineWidth(e.lineWidth),e.roundedEnd?t.setLineCap("round"):t.setLineCap("square")}drawArrowLine(t,e,i){const s=this.renderOptions.drawStartArrow&&this.renderOptions.drawEndArrow,n=e.x,o=e.y,a=i.x,r=i.y,h=Math.sqrt((a-n)*(a-n)+(r-o)*(r-o)),c=(h-this.renderOptions.arrowheadLength/3)/h;let l,d,u,g;this.renderOptions.drawEndArrow||s?(l=Math.round(n+(a-n)*c),d=Math.round(o+(r-o)*c)):(l=a,d=r),this.renderOptions.drawStartArrow||s?(u=n+(a-n)*(1-c),g=o+(r-o)*(1-c)):(u=n,g=o),this.renderOptions.color&&(t.setStrokeStyle(this.renderOptions.color),t.setFillStyle(this.renderOptions.color)),this.applyStyle(t),t.beginPath(),t.moveTo(u,g),t.lineTo(l,d),t.stroke(),t.closePath();const p=Math.atan2(r-o,a-n),m=Math.abs(this.renderOptions.arrowheadLength/Math.cos(this.renderOptions.arrowheadAngle));let f,S,x,w,T,b;(this.renderOptions.drawEndArrow||s)&&(f=p+Math.PI+this.renderOptions.arrowheadAngle,x=a+Math.cos(f)*m,w=r+Math.sin(f)*m,S=p+Math.PI-this.renderOptions.arrowheadAngle,T=a+Math.cos(S)*m,b=r+Math.sin(S)*m,di(t,x,w,a,r,T,b)),(this.renderOptions.drawStartArrow||s)&&(f=p+this.renderOptions.arrowheadAngle,x=n+Math.cos(f)*m,w=o+Math.sin(f)*m,S=p-this.renderOptions.arrowheadAngle,T=n+Math.cos(S)*m,b=o+Math.sin(S)*m,di(t,x,w,n,o,T,b))}draw(){const t=this.checkContext();this.setRendered();const e=this.firstNote,i=this.lastNote,s=this.renderOptions;this.applyLineStyle();let n={x:0,y:0},o={x:0,y:0};this.firstIndexes.forEach((a,r)=>{const h=this.lastIndexes[r];n=e.getModifierStartXY(2,a),o=i.getModifierStartXY(1,h);const c=n.y>o.y;n.x+=e.getMetrics().modRightPx+s.paddingLeft,o.x-=i.getMetrics().modLeftPx+s.paddingRight;const l=e.getGlyphWidth();e.getKeyProps()[a].displaced&&1===e.getStemDirection()&&(n.x+=l+s.paddingLeft);i.getKeyProps()[h].displaced&&-1===i.getStemDirection()&&(o.x-=l+s.paddingRight),n.y+=c?-3:1,o.y+=c?2:0,this.drawArrowLine(t,n,o)});const a=this.width,r=s.textJustification;let h=0;if(r===ui.TextJustification.LEFT)h=n.x;else if(r===ui.TextJustification.CENTER){h=(o.x-n.x)/2+n.x-a/2}else r===ui.TextJustification.RIGHT&&(h=o.x-a);let c=0;const l=s.textPositionVertical;l===ui.TextVerticalPosition.TOP?c=e.checkStave().getYForTopText():l===ui.TextVerticalPosition.BOTTOM&&(c=e.checkStave().getYForBottomText($.TEXT_HEIGHT_OFFSET_HACK));const d=s.color;this.applyStyle(t,{fillStyle:d,strokeStyle:d}),this.applyStyle(t),this.renderText(t,h,c)}}ui.TextVerticalPosition={TOP:1,BOTTOM:2},ui.TextJustification=He;class gi extends P{static get CATEGORY(){return"System"}constructor(t={}){super(),this.setOptions(t),this.partStaves=[],this.partStaveInfos=[],this.partVoices=[]}setOptions(t={}){if(!t.factory)throw new p("NoFactory","System.setOptions(options) requires a factory.");this.factory=t.factory,this.options=Object.assign(Object.assign({factory:this.factory,x:10,y:10,width:500,spaceBetweenStaves:12,autoWidth:!1,noJustification:!1,debugFormatter:!1,formatIterations:0,noPadding:!1},t),{details:Object.assign({alpha:.5},t.details),formatOptions:Object.assign({},t.formatOptions)}),!1===this.options.noJustification&&void 0===t.width&&(this.options.autoWidth=!0)}getX(){return this.options.x}setX(t){return this.options.x=t,this.partStaves.forEach(e=>{e.setX(t)}),this}getY(){return this.options.y}setY(t){return this.options.y=t,this.partStaves.forEach(e=>{e.setY(t)}),this}getStaves(){return this.partStaves}getVoices(){return this.partVoices}setWidth(t){if(void 0!==t&&(!Number.isFinite(t)||t<=0))throw new p("BadArgument","System width must be a positive finite number.");return this.options.autoWidth=void 0===t,void 0!==t&&(this.options.width=t,this.partStaves.forEach(e=>e.setWidth(t))),this}getWidth(){return this.options.width}setContext(t){return super.setContext(t),this.factory.setContext(t),this}addConnector(t="double"){return this.connector=this.factory.StaveConnector({topStave:this.partStaves[0],bottomStave:this.partStaves[this.partStaves.length-1],type:t}),this.connector}addStave(t){var e;const i=Object.assign({leftBar:!1},t.options),s=null!==(e=t.stave)&&void 0!==e?e:this.factory.Stave({x:this.options.x,y:this.options.y,width:this.options.width,options:i}),n=Object.assign(Object.assign({spaceAbove:0,spaceBelow:0,debugNoteMetrics:!1,noJustification:!1},t),{options:i}),o=this.getContext();return n.voices.forEach(t=>{t.setContext(o).setStave(s).getTickables().forEach(t=>t.setStave(s)),this.partVoices.push(t)}),this.partStaves.push(s),this.partStaveInfos.push(n),s}addVoices(t){const e=this.getContext();t.forEach(t=>{t.setContext(e),this.partVoices.push(t)})}format(){const t=this.options.details;let e=0;const i=new Qe(t);this.formatter=i;let s=this.options.y,n=0;const o=[];this.partStaves.forEach((t,e)=>{s+=t.space(this.partStaveInfos[e].spaceAbove),t.setY(s),s+=t.space(this.partStaveInfos[e].spaceBelow),s+=t.space(this.options.spaceBetweenStaves),this.partStaveInfos[e].debugNoteMetrics&&(o.push({y:s,stave:t}),s+=15),n=Math.max(n,t.getNoteStartX())}),this.partVoices.forEach(t=>{t.getTickables().forEach(t=>{const e=t.getStave();e&&t.setStave(e)})}),i.joinVoices(this.partVoices),this.partStaves.forEach(t=>t.setNoteStartX(n)),this.options.autoWidth&&this.partVoices.length>0?(e=i.preCalculateMinTotalWidth(this.partVoices),this.options.width=e+je.rightPadding+(n-this.options.x),this.partStaves.forEach(t=>{t.setWidth(this.options.width)})):e=this.options.noPadding?this.options.width-(n-this.options.x):this.options.width-(n-this.options.x)-je.defaultPadding,this.partVoices.length>0&&i.format(this.partVoices,this.options.noJustification?0:e,this.options.formatOptions),i.postFormat();for(let e=0;e<this.options.formatIterations;e++)i.tune(t);this.startX=n,this.debugNoteMetricsYs=o,this.lastY=s,je.formatBegModifiers(this.partStaves)}getBoundingBox(){var t;return new D(this.options.x,this.options.y,this.options.width,(null!==(t=this.lastY)&&void 0!==t?t:0)-this.options.y)}draw(){const t=this.checkContext();if(!(this.formatter&&this.startX&&this.lastY&&this.debugNoteMetricsYs))throw new p("NoFormatter","format() must be called before draw()");this.setRendered(),this.options.debugFormatter&&Qe.plotDebugging(t,this.formatter,this.startX,this.options.y,this.lastY),this.debugNoteMetricsYs.forEach(e=>{this.partVoices.forEach(i=>{i.getTickables().forEach(i=>{i.getStave()===e.stave&&vt.plotMetrics(t,i,e.y)})})})}}class pi extends de{static get CATEGORY(){return"TabSlide"}static get SLIDE_UP(){return 1}static get SLIDE_DOWN(){return-1}static createSlideUp(t){return new pi(t,pi.SLIDE_UP)}static createSlideDown(t){return new pi(t,pi.SLIDE_DOWN)}constructor(t,e){if(super(t,"sl."),!e){let i=t.firstNote.getPositions()[0].fret;"string"==typeof i&&(i=parseInt(i,10));let s=t.lastNote.getPositions()[0].fret;"string"==typeof s&&(s=parseInt(s,10)),e=isNaN(i)||isNaN(s)?pi.SLIDE_UP:i>s?pi.SLIDE_DOWN:pi.SLIDE_UP}this.direction=e,this.renderOptions.cp1=11,this.renderOptions.cp2=14,this.renderOptions.yShift=.5}renderTie(t){if(0===t.firstYs.length||0===t.lastYs.length)throw new p("BadArguments","No Y-values to render");const e=this.checkContext(),i=t.firstX,s=t.firstYs,n=t.lastX,o=t.direction;if(o!==pi.SLIDE_UP&&o!==pi.SLIDE_DOWN)throw new p("BadSlide","Invalid slide direction");const a=this.notes.firstIndexes;for(let t=0;t<a.length;++t){const r=s[a[t]]+this.renderOptions.yShift;if(isNaN(r))throw new p("BadArguments","Bad indexes for slide rendering.");e.beginPath(),e.moveTo(i,r+3*o),e.lineTo(n,r-3*o),e.closePath(),e.stroke()}this.setRendered()}}class mi extends je{static get CATEGORY(){return"TabStave"}constructor(t,e,i,s){super(t,e,i,Object.assign({spacingBetweenLinesPx:13,numLines:6,topTextPosition:1},s))}getYForGlyphs(){return this.getYForLine(2.5)}addTabGlyph(){return this.addClef("tab"),this}}var fi;!function(t){t[t.TOP=1]="TOP",t[t.BOTTOM=-1]="BOTTOM"}(fi||(fi={}));class Si extends P{static get CATEGORY(){return"TextBracket"}static get Position(){return fi}static get PositionString(){return{top:fi.TOP,bottom:fi.BOTTOM}}constructor({start:t,stop:e,text:i="",superscript:s="",position:n=fi.TOP}){super(),this.start=t,this.stop=e,this.textElement=new P("TextBracket"),this.textElement.setText(i),this.superscriptElement=new P("TextBracket"),this.superscriptElement.setText(s);const o=A.scaleSize(this.fontInfo.size,.714286);this.superscriptElement.setFontSize(o),this.position="string"==typeof n?Si.PositionString[n]:n,this.line=1,this.renderOptions={dashed:!0,dash:[5],lineWidth:1,showBracket:!0,bracketHeight:8,underlineSuperscript:!0}}applyStyle(t){this.textElement.setFont(this.fontInfo);const{family:e,size:i,weight:s,style:n}=this.fontInfo,o=A.scaleSize(i,.714286);this.superscriptElement.setFont(e,o,s,n);const a=this.renderOptions;return void 0!==a.color&&(t.setStrokeStyle(a.color),t.setFillStyle(a.color)),t.setLineWidth(a.lineWidth),super.applyStyle(t)}setDashed(t,e){return this.renderOptions.dashed=t,e&&(this.renderOptions.dash=e),this}setLine(t){return this.line=t,this}draw(){const t=this.checkContext();this.setRendered();let e=0;switch(this.position){case fi.TOP:e=this.start.checkStave().getYForTopText(this.line);break;case fi.BOTTOM:e=this.start.checkStave().getYForBottomText(this.line+$.TEXT_HEIGHT_OFFSET_HACK);break;default:throw new p("InvalidPosition",`The position ${this.position} is invalid.`)}const i={x:this.start.getAbsoluteX(),y:e},s={x:this.stop.getAbsoluteX(),y:e};!function(...t){Si.DEBUG&&S("VexFlow.TextBracket",t)}("Rendering TextBracket: start:",i,"stop:",s,"y:",e);const n=this.renderOptions.bracketHeight*this.position;this.textElement.renderText(t,i.x,i.y);const o=this.textElement.getWidth(),a=this.textElement.getHeight(),r=i.y-a/2.5;this.superscriptElement.renderText(t,i.x+o+1,r);const h=this.superscriptElement.getWidth(),c=this.superscriptElement.getHeight();let l=i.x,d=r;const u=s.x+this.stop.getGlyphWidth();this.position===fi.TOP?(l+=o+h+5,d-=c/2.7):this.position===fi.BOTTOM&&(d+=c/2.7,l+=o+2,this.renderOptions.underlineSuperscript||(l+=h)),this.renderOptions.dashed?(Ce.drawDashedLine(t,l,d,u,d,this.renderOptions.dash),this.renderOptions.showBracket&&Ce.drawDashedLine(t,u,d+1*this.position,u,d+n,this.renderOptions.dash)):(t.beginPath(),t.moveTo(l,d),t.lineTo(u,d),this.renderOptions.showBracket&&t.lineTo(u,d+n),t.stroke(),t.closePath())}}function xi(...t){wi.DEBUG&&S("VexFlow.TextDynamics",t)}Si.DEBUG=!1;class wi extends vt{static get CATEGORY(){return"TextDynamics"}static get GLYPHS(){return{f:I.dynamicForte,p:I.dynamicPiano,m:I.dynamicMezzo,s:I.dynamicSforzando,z:I.dynamicZ,r:I.dynamicRinforzando}}constructor(t){var e,i;super(t),this.sequence=(null!==(e=t.text)&&void 0!==e?e:"").toLowerCase(),this.line=null!==(i=t.line)&&void 0!==i?i:0,this.text="",xi("New Dynamics Text: ",this.sequence)}setLine(t){return this.line=t,this}preFormat(){return this.text="",this.sequence.split("").forEach(t=>{const e=wi.GLYPHS[t];if(!e)throw new p("Invalid dynamics character: "+t);this.text+=e}),this.preFormatted=!0,this}getBoundingBox(){const t=this.getTextMetrics();return new D(this.getAbsoluteX()+this.x+this.xShift,this.checkStave().getYForLine(this.line-3)+this.y+this.yShift-t.actualBoundingBoxAscent,this.getWidth(),this.getHeight())}draw(){this.setRendered();const t=this.getAbsoluteX(),e=this.checkStave().getYForLine(this.line+-3);xi("Rendering Dynamics: ",this.sequence),this.renderText(this.checkContext(),t,e)}}wi.DEBUG=!1;class Ti extends vt{static get CATEGORY(){return"TimeSigNote"}constructor(t,e){super({duration:"b"}),this.timeSig=new Xe(t,e),this.setWidth(this.timeSig.getWidth()),this.ignoreTicks=!0}addToModifierContext(t){return this}preFormat(){return this.preFormatted=!0,this}draw(){const t=this.checkStave(),e=this.checkContext();this.setRendered();const i=this.getAttribute("class");e.openGroup("timesignote"+(i?" "+i:""),this.getAttribute("id")),this.timeSig.drawAt(e,t,this.getAbsoluteX()),this.drawPointerRect(),e.closeGroup()}}class bi extends W{static get CATEGORY(){return"Tremolo"}constructor(t){super(),this.num=t,this.position=W.Position.CENTER,this.text=I.tremolo1}draw(){const t=this.checkContext(),e=this.checkAttachedNote();this.setRendered();const i=e.getStemDirection(),s=e.getFontScale(),n=B.get("Tremolo.spacing")*i*s,o=e.getAbsoluteX()+(i===at.UP?e.getGlyphWidth()-at.WIDTH/2:at.WIDTH/2);let a=e.getStemExtents().topY+(this.num<=3?n:0);this.fontInfo.size=B.get("Tremolo.fontSize")*s;for(let e=0;e<this.num;++e)this.renderText(t,o,a),a+=n}}class yi extends P{static get CATEGORY(){return"Tuplet"}static get LOCATION_TOP(){return 1}static get LOCATION_BOTTOM(){return-1}static get NESTING_OFFSET(){return 15}constructor(t,e={}){var i,s;if(super(),!t||!t.length)throw new p("BadArguments","No notes provided for tuplet.");this.notes=t;const n=void 0!==e.numNotes?e.numNotes:t.length,o=e.notesOccupied||2,a=void 0!==e.bracketed?e.bracketed:t.some(t=>!t.hasBeam()),r=void 0!==e.ratioed?e.ratioed:Math.abs(o-n)>1,h=e.location||yi.LOCATION_TOP,c=null!==(i=e.yOffset)&&void 0!==i?i:B.get("Tuplet.yOffset"),l=null!==(s=e.textYOffset)&&void 0!==s?s:B.get("Tuplet.textYOffset"),d=e.suffix||"";if(e.displayRatio&&(2!==e.displayRatio.length||!e.displayRatio.every(t=>Number.isSafeInteger(t)&&t>0)))throw new p("BadArguments","Tuplet display ratio requires two positive integers.");this.options={displayRatio:e.displayRatio&&[...e.displayRatio],bracketed:a,location:h,notesOccupied:o,numNotes:n,ratioed:r,yOffset:c,textYOffset:l,suffix:d},this.textElement=new P("Tuplet"),this.suffixElement=new P("Tuplet.suffix"),this.setTupletLocation(h||yi.LOCATION_TOP),Qe.AlignRestsToNotes(t,!0,!0),this.resolveGlyphs(),this.attach()}attach(){for(let t=0;t<this.notes.length;t++){const e=this.notes[t];e.getTupletStack().includes(this)||e.addTuplet(this)}}detach(){for(let t=0;t<this.notes.length;t++){this.notes[t].removeTuplet(this)}}setBracketed(t){return this.options.bracketed=t,this}setRatioed(t){return this.options.ratioed=t,this.resolveGlyphs(),this}setTupletLocation(t){return t!==yi.LOCATION_TOP&&t!==yi.LOCATION_BOTTOM&&(console.warn(`Invalid tuplet location [${t}]. Using Tuplet.LOCATION_TOP.`),t=yi.LOCATION_TOP),this.options.location=t,this}getNotes(){return this.notes}getNoteCount(){return this.options.numNotes}getNotesOccupied(){return this.options.notesOccupied}setNotesOccupied(t){this.detach(),this.options.notesOccupied=t,this.resolveGlyphs(),this.attach()}resolveGlyphs(){var t,e,i,s;let n="",o="",a=null!==(e=null===(t=this.options.displayRatio)||void 0===t?void 0:t[0])&&void 0!==e?e:this.options.numNotes;for(;a>=1;)n=String.fromCharCode(59520+a%10)+n,a=Math.floor(a/10);if(this.options.ratioed){for(a=null!==(s=null===(i=this.options.displayRatio)||void 0===i?void 0:i[1])&&void 0!==s?s:this.options.notesOccupied;a>=1;)o=String.fromCharCode(59520+a%10)+o,a=Math.floor(a/10);o=I.tupletColon+o}this.textElement.setText(n+o),this.options.suffix&&this.suffixElement.setText(this.options.suffix)}getNestedTupletCount(){const{location:t}=this.options;let e=0;for(const i of this.notes){const s=i.getTupletStack().filter(e=>e.options.location===t).indexOf(this);s>=0&&s>e&&(e=s)}return e}getYPosition(){var t,e,i;const s=this.getNestedTupletCount()*yi.NESTING_OFFSET*-this.options.location,n=null!==(t=this.options.yOffset)&&void 0!==t?t:0,o=this.notes[0];let a;if(this.options.location===yi.LOCATION_TOP){a=o.checkStave().getYForLine(0)-1.5*$.STAVE_LINE_DISTANCE;for(let t=0;t<this.notes.length;++t){const e=this.notes[t];let i=0;const s=e.getModifierContext();s&&(i=s.getUnmeasuredTextLines(!0));const n=e.getYForTopText(i)-2*$.STAVE_LINE_DISTANCE;if(e.hasStem()||e.isRest()){const t=e.getStemDirection()===at.UP?e.getStemExtents().topY-$.STAVE_LINE_DISTANCE:e.getStemExtents().baseY-2*$.STAVE_LINE_DISTANCE;a=Math.min(t,a),i>0&&(a=Math.min(n,a))}}}else{let t=4;this.notes.forEach(e=>{const i=e.getModifierContext();i&&(t=Math.max(t,i.getUnmeasuredTextLines(!1)+1))}),a=o.checkStave().getYForLine(t)+2*$.STAVE_LINE_DISTANCE;for(let t=0;t<this.notes.length;++t)if(this.notes[t].hasStem()||this.notes[t].isRest()){const e=this.notes[t].getStemDirection()===at.UP?this.notes[t].getStemExtents().baseY+2*$.STAVE_LINE_DISTANCE:this.notes[t].getStemExtents().topY+$.STAVE_LINE_DISTANCE;e>a&&(a=e)}}const r=this.options.location===yi.LOCATION_TOP,h=r?ct.VerticalJustify.TOP:ct.VerticalJustify.BOTTOM,c=(this.options.bracketed?B.get("Tuplet.bracket.legLength"):this.textElement.getHeight()/2)+o.checkStave().getSpacingBetweenLines()/4;for(const t of this.notes){for(const e of t.getModifiers()){if(e.getPosition()!==(r?W.Position.ABOVE:W.Position.BELOW))continue;const t=e instanceof Tt?e.getInkBounds():e instanceof fe?e.getBoundingBox():void 0;t&&(a=r?Math.min(a,t.y-c):Math.max(a,t.y+t.h+c))}const s=null!==(i=null===(e=t.getModifierContext())||void 0===e?void 0:e.getMembers("Annotation"))&&void 0!==i?i:[];for(const e of s){if(!Q(e)||e.getVerticalJustification()!==h||e.checkAttachedNote().getStave()!==t.getStave())continue;const i=e.computeY().y+e.getYShift(),s=e.getTextMetrics();a=r?Math.min(a,i-s.actualBoundingBoxAscent-c):Math.max(a,i+s.actualBoundingBoxDescent+c)}}return a+s+n}positionElements(){const{location:t,bracketed:e,textYOffset:i,suffix:s}=this.options,n=B.get("Tuplet.bracket.padding"),o=B.get("Tuplet.bracket.lineWidth"),a=B.get("Tuplet.bracket.legLength"),r=B.get("Tuplet.suffix.extraSpacing"),h=B.get("Tuplet.suffix.suffixOffsetY");let c=0,l=0;const d=this.notes[0],u=this.notes[this.notes.length-1];let g=0;e?(c=d.getTieLeftX()-n,g=u.getTieRightX()-c+n,this.setWidth(g+o)):(c=d.getStemX(),g=u.getStemX()-c,this.setWidth(g)),this.setX(c),l=this.getYPosition(),this.setY(1===t?l:l-a+o),this.height=a;const p=this.textElement.getWidth();let m=p,f=0;s&&(f=this.suffixElement.getWidth(),m=p+r+f);const S=c+g/2-m/2,x=l+this.textElement.getHeight()/2+(t===yi.LOCATION_TOP?-1:1)*i;return this.textElement.setX(S).setY(x),s&&this.suffixElement.setX(S+p+r).setY(x+h),{xPos:c,yPos:l,bodyWidth:g,totalTextWidth:m,bracketPadding:n,bracketThickness:o,bracketLegLength:a}}draw(){const{location:t,bracketed:e,suffix:i}=this.options,{xPos:s,yPos:n,bodyWidth:o,totalTextWidth:a,bracketPadding:r,bracketThickness:h,bracketLegLength:c}=this.positionElements(),l=this.checkContext(),d=this.getAttribute("class");if(l.openGroup("tuplet"+(d?" "+d:""),this.getAttribute("id")),e){const e=o/2-a/2-r,i=t===yi.LOCATION_BOTTOM;e>0&&(l.fillRect(s,n,e,h),l.fillRect(s+o/2+a/2+r,n,e,h),l.fillRect(s,n+(i?1:0),h,t*c),l.fillRect(s+o,n+(i?1:0),h,t*c))}this.textElement.renderText(l,0,0),i&&this.suffixElement.renderText(l,0,0),this.drawPointerRect(),l.closeGroup(),this.setRendered()}getBoundingBox(){this.positionElements();const{bracketed:t,suffix:e}=this.options,i=this.textElement.getBoundingBox(),s=this.suffixElement.getBoundingBox(),n=e?i.mergeWith(s):i;if(!t)return n;return new D(this.x,this.y,this.width,this.height).mergeWith(n)}}class vi extends P{static get CATEGORY(){return"VibratoBracket"}constructor(t){super(),this.vibrato=new Le,t.start&&(this.start=t.start),t.stop&&(this.stop=t.stop),this.line=1}setLine(t){return this.line=t,this}setVibratoCode(t){return this.vibrato.setVibratoCode(t),this}draw(){const t=this.checkContext();this.setRendered();const e=this.start&&this.start.checkStave().getYForTopText(this.line)||this.stop&&this.stop.checkStave().getYForTopText(this.line)||0,i=this.start&&this.start.getAbsoluteX()||this.stop&&this.stop.checkStave().getTieStartX()||0,s=this.stop&&this.stop.getAbsoluteX()-this.stop.getWidth()-5||this.start&&this.start.checkStave().getTieEndX()-10||0;this.vibrato.setVibratoWidth(s-i),function(...t){vi.DEBUG&&S("VexFlow.VibratoBracket",t)}("Rendering VibratoBracket: startX:",i,"stopX:",s,"y:",e),this.vibrato.renderText(t,i,e)}}function ki(...t){Bi.DEBUG&&S("VexFlow.Factory",t)}vi.DEBUG=!1;class Bi{static newFromElementId(t,e=500,i=200){return new Bi({renderer:{elementId:t,width:e,height:i}})}static getGroup(t){return Bi.groups.get(t)}static getOwner(t){return Bi.owners.get(t)}own(t){const e=Bi.owners.get(t);if(e===this)return t;if(e)throw new p("BadArguments","Element belongs to another Factory.");return Bi.owners.set(t,this),this.constructionScopes.forEach(e=>e.push(t)),t}adopt(t,e){if(!!(!("note"===e&&t instanceof vt||"modifier"===e&&t instanceof W||"staveModifier"===e&&t instanceof Dt)&&(!("drawable"===e&&t instanceof P)||t instanceof vt||t instanceof W||t instanceof ge||t instanceof je||t instanceof Dt||t instanceof gi)))throw new p("BadArguments",`Invalid adopted element role: ${e}`);if(t instanceof vt&&Bi.groups.has(t))throw new p("BadArguments","A grouped note cannot be queued independently.");return this.own(t),"note"!==e&&"drawable"!==e||this.renderQ.includes(t)||this.renderQ.push(t),t}transaction(t){const e={staves:this.staves.slice(),voices:this.voices.slice(),renderQ:this.renderQ.slice(),systems:this.systems.slice(),sheets:this.sheets.slice(),stave:this.stave,retained:this.retained},i=[],s=[];this.constructionScopes.push(i),this.groupScopes.push(s);const n=()=>{try{return t()}catch(t){throw Object.assign(this,e),i.forEach(t=>Bi.owners.delete(t)),s.slice().reverse().forEach(t=>t()),t}finally{this.constructionScopes.pop(),this.groupScopes.pop()}},o=M.getDefaultRegistry();return o?o.transaction(n):n()}constructor(t={}){this.retained=!1,this.constructionScopes=[],this.groupScopes=[],this.style={},ki("New factory: ",t),this.options={stave:{space:10},renderer:{elementId:"",width:500,height:200,background:"#FFF"}},this.setOptions(t)}reset(){this.sheets=[],this.retained=!1,this.renderQ=[],this.systems=[],this.staves=[],this.voices=[],this.stave=void 0}setOptions(t){this.options=Object.assign(Object.assign({},this.options),t),this.initRenderer(),this.reset()}initRenderer(){const{elementId:t,width:e,height:i,background:s}=this.options.renderer;if(null===t)return;if(""===t)throw ki(this),new p("renderer.elementId not set in FactoryOptions");let n=this.options.renderer.backend;if(void 0===n){n=Pt(document.getElementById(t))?Ce.Backends.CANVAS:Ce.Backends.SVG}this.context=Ce.buildContext(t,n,e,i,s)}getContext(){return this.context}setContext(t){return this.context=t,this}getStave(){return this.stave}getVoices(){return this.voices}setStyle(t){return this.style=Object.assign({},t),this}Sheet(t={}){const e=new ci(Object.assign(Object.assign({},t),{factory:this}));return this.sheets.push(e),e}Stave(t){const e=this.options.stave.space,i=Object.assign({x:0,y:0,width:this.options.renderer.width-1*e,options:{spacingBetweenLinesPx:1*e}},t),s=new je(i.x,i.y,i.width,i.options);return this.staves.push(s),s.setContext(this.context),this.stave=s,this.own(s)}TabStave(t){const e=this.options.stave.space,i=Object.assign({x:0,y:0,width:this.options.renderer.width-1*e,options:{spacingBetweenLinesPx:1.3*e}},t),s=new mi(i.x,i.y,i.width,i.options);return this.staves.push(s),s.setContext(this.context),this.stave=s,this.own(s)}Bend(...t){return this.adopt(new Mt(...t).setContext(this.context),"modifier")}musicGlyph(t){return this.options.engraving&&t.setFont(Object.assign(Object.assign({},t.fontInfo),{family:this.options.engraving.musicFont})),t}Clef(...t){return this.adopt(this.musicGlyph(new Qt(...t)).setContext(this.context),"staveModifier")}KeySignature(...t){return this.adopt(this.musicGlyph(new Pe(...t)).setContext(this.context),"staveModifier")}TimeSignature(...t){const e=new Xe(...t);return this.options.engraving&&e.setMusicFont(this.options.engraving.musicFont),this.adopt(e.setContext(this.context),"staveModifier")}Barline(...t){return this.adopt(new Et(...t).setContext(this.context),"staveModifier")}Repetition(...t){return this.adopt(new Re(...t).setContext(this.context),"staveModifier")}Volta(...t){return this.adopt(new Ye(...t).setContext(this.context),"staveModifier")}StaveSection(...t){return this.adopt(new Ie(...t).setContext(this.context),"staveModifier")}StaveTempo(...t){return this.adopt(new We(...t).setContext(this.context),"staveModifier")}StaveText(...t){return this.adopt(new Ve(...t).setContext(this.context),"staveModifier")}TabTie(...t){return this.adopt(new de(...t).setContext(this.context),"drawable")}TabSlide(...t){return this.adopt(new pi(...t).setContext(this.context),"drawable")}GraceTabNote(t){return this.own(new si(t).setContext(this.context))}StaveNote(t){const e=new ce(Object.assign({engraving:this.options.engraving},t));return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),this.own(e)}GlyphNote(t,e,i){const s=new ti(t,e,i);return this.stave&&s.setStave(this.stave),s.setContext(this.context),this.renderQ.push(s),this.own(s)}RepeatNote(t,e,i){const s=new hi(t,e,i);return this.stave&&s.setStave(this.stave),s.setContext(this.context),this.renderQ.push(s),this.own(s)}GhostNote(t){const e=new Ze(t);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),this.own(e)}TextNote(t){const e=new Ue(t);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),this.own(e)}BarNote(t={}){const e=new Lt(t.type);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),this.own(e)}ClefNote(t){var e,i,s;const n=new Jt(null!==(e=null==t?void 0:t.type)&&void 0!==e?e:"treble",null===(i=null==t?void 0:t.options)||void 0===i?void 0:i.size,null===(s=null==t?void 0:t.options)||void 0===s?void 0:s.annotation);return this.stave&&n.setStave(this.stave),n.setContext(this.context),this.renderQ.push(n),this.own(n)}TimeSigNote(t){const e=Object.assign({time:"4/4"},t),i=new Ti(e.time);return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),this.own(i)}KeySigNote(t){const e=new ni(t.key,t.cancelKey,t.alterKey,t.clef);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),this.own(e)}TabNote(t,e=!1){const i=new ii(t,e);return this.stave&&i.setStave(this.stave),i.setContext(this.context),this.renderQ.push(i),this.own(i)}GraceNote(t){const e=new ei(Object.assign({engraving:this.options.engraving},t));return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.own(e)}GraceNoteGroup(t){return this.own(new pe(t.notes,t.slur).setContext(this.context))}Accidental(t){const e=this.musicGlyph(new ot(t.type));return e.setContext(this.context),this.own(e)}Annotation(t){const e=Object.assign({text:"p",hJustify:rt.CENTER,vJustify:ht.BOTTOM},t),i=new ct(e.text);return i.setJustification(e.hJustify),i.setVerticalJustification(e.vJustify),i.setFont(e.font),i.setContext(this.context),this.own(i)}ChordSymbol(t){const e=Object.assign({vJustify:"top",hJustify:"center"},t),i=new Kt;return i.setHorizontal(e.hJustify),i.setVertical(e.vJustify),"string"==typeof e.fontFamily&&"number"==typeof e.fontSize?"string"==typeof e.fontWeight?i.setFont(e.fontFamily,e.fontSize,e.fontWeight):i.setFont(e.fontFamily,e.fontSize,""):"number"==typeof e.fontSize&&i.setFontSize(e.fontSize),i.setContext(this.context),this.own(i)}Articulation(t){var e;const i=this.musicGlyph(new Tt(null!==(e=null==t?void 0:t.type)&&void 0!==e?e:"a."));return void 0!==(null==t?void 0:t.position)&&i.setPosition(t.position),void 0!==(null==t?void 0:t.betweenLines)&&i.setBetweenLines(t.betweenLines),i.setContext(this.context),this.own(i)}Ornament(t,e){const i=Object.assign({type:t,accidental:""},e),s=new fe(t);return void 0!==(null==e?void 0:e.position)&&s.setPosition(e.position),i.upperAccidental&&s.setUpperAccidental(i.upperAccidental),i.lowerAccidental&&s.setLowerAccidental(i.lowerAccidental),void 0!==i.delayed&&s.setDelayed(i.delayed),s.setContext(this.context),this.own(s)}TextDynamics(t){const e=new wi(Object.assign({text:"p",duration:"q",dots:0,line:0},t));return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),this.own(e)}Fingering(t){const e=Object.assign({number:"0",position:"left"},t),i=new ne(e.number);return i.setPosition(e.position),i.setContext(this.context),this.own(i)}StringNumber(t,e=!0){const i=new De(t.number);return i.setPosition(t.position),i.setContext(this.context),i.setDrawCircle(e),this.own(i)}TickContext(){return new Zt}ModifierContext(){return new Oe}MultiMeasureRest(t){const e=f(t.numberOfMeasures,"NoNumberOfMeasures"),i=new oi(e,t);return i.setContext(this.context),this.renderQ.push(i),this.own(i)}Voice(t){const e=Object.assign({time:"4/4"},t),i=new ge(e.time);return this.voices.push(i),this.own(i)}StaveConnector(t){const e=new $e(t.topStave,t.bottomStave);return e.setType(t.type).setContext(this.context),this.renderQ.push(e),this.own(e)}Formatter(t){return new Qe(t)}Tuplet(t){const e=Object.assign({notes:[],options:{}},t),i=new yi(e.notes,e.options).setContext(this.context);return this.renderQ.push(i),this.own(i)}Beam(t){var e,i,s,n,o;const a=new Ft(t.notes,null===(e=t.options)||void 0===e?void 0:e.autoStem).setContext(this.context);return a.breakSecondaryAt(null!==(s=null===(i=t.options)||void 0===i?void 0:i.secondaryBeamBreaks)&&void 0!==s?s:[]),(null===(n=t.options)||void 0===n?void 0:n.partialBeamDirections)&&Object.entries(null===(o=t.options)||void 0===o?void 0:o.partialBeamDirections).forEach(([t,e])=>{a.setPartialBeamSideAt(Number(t),e)}),this.renderQ.push(a),this.own(a)}Curve(t){const e=new ie(t.from,t.to,t.options).setContext(this.context);return this.renderQ.push(e),this.own(e)}StaveTie(t){var e;const i=new le({firstNote:t.from,lastNote:t.to,firstIndexes:t.firstIndexes,lastIndexes:t.lastIndexes},t.text);return(null===(e=t.options)||void 0===e?void 0:e.direction)&&i.setDirection(t.options.direction),i.setContext(this.context),this.renderQ.push(i),this.own(i)}StaveLine(t){var e,i;const s=new ui({firstNote:t.from,lastNote:t.to,firstIndexes:t.firstIndexes,lastIndexes:t.lastIndexes});return(null===(e=t.options)||void 0===e?void 0:e.text)&&s.setText(t.options.text),(null===(i=t.options)||void 0===i?void 0:i.font)&&s.setFont(t.options.font),s.setContext(this.context),this.renderQ.push(s),this.own(s)}VibratoBracket(t){const e=new vi({start:t.from,stop:t.to});return void 0!==t.options.line&&e.setLine(t.options.line),void 0!==t.options.code&&e.setVibratoCode(t.options.code),e.setContext(this.context),this.renderQ.push(e),this.own(e)}TextBracket(t){const e=new Si({start:t.from,stop:t.to,text:t.text,superscript:t.options.superscript,position:t.options.position});return void 0!==t.options.line&&e.setLine(t.options.line),t.options.font&&e.setFont(t.options.font),e.setContext(this.context),this.renderQ.push(e),this.own(e)}System(t={}){const e=new gi(Object.assign(Object.assign({},t),{factory:this})).setContext(this.context);return this.systems.push(e),this.own(e)}EasyScore(t={}){return new Qi(Object.assign(Object.assign({},t),{factory:this}))}PedalMarking(t){const e=Object.assign({notes:[],options:{style:"mixed"}},t),i=new ai(e.notes);return i.setType(ai.typeString[e.options.style]),i.setContext(this.context),this.renderQ.push(i),this.own(i)}NoteSubGroup(t){const e=Object.assign({notes:[]},t);return this.own(new me(e.notes).setContext(this.context))}groupNotes(t,e){if(!t.length||new Set(t).size!==t.length)throw new p("BadArguments","A note group needs distinct notes.");t.forEach(t=>{const e=Bi.getOwner(t);if(e&&e!==this)throw new p("BadArguments","Group note belongs to another Factory.");if(Bi.groups.has(t))throw new p("BadArguments","Note already belongs to a group.");let i;try{i=t.getVoice()}catch(t){if(!(t instanceof p)||"NoVoice"!==t.code)throw t}if(i)throw new p("BadArguments","A voiced note cannot be moved into a group.")});const i=t.map(t=>t.shouldIgnoreTicks()),s=()=>t.forEach((t,e)=>{Bi.groups.delete(t),t.clearVoice().setIgnoreTicks(i[e])});let n;try{n=this.own(e().setContext(this.context))}catch(t){throw s(),t}return this.groupScopes.forEach(t=>t.push(s)),t.forEach(t=>{this.own(t),Bi.groups.set(t,n)}),this.renderQ=this.renderQ.filter(e=>!t.includes(e)),n}Dot(...t){return this.adopt(new se(...t).setContext(this.context),"modifier")}Parenthesis(...t){return this.adopt(new Se(...t).setContext(this.context),"modifier")}Stroke(...t){return this.adopt(new Ee(...t).setContext(this.context),"modifier")}Tremolo(...t){return this.adopt(new bi(...t).setContext(this.context),"modifier")}Vibrato(...t){return this.adopt(new Le(...t).setContext(this.context),"modifier")}Crescendo(...t){const e=new te(...t).setContext(this.context);return this.stave&&e.setStave(this.stave),this.adopt(e,"note")}StaveHairpin(t){const e=Object.assign(Object.assign({},t.from&&{firstNote:t.from}),t.to&&{lastNote:t.to}),i=new li(e,t.type).setContext(this.context);return t.options&&i.setRenderOptions(Object.assign(Object.assign({},i.renderOptions),t.options)),this.adopt(i,"drawable")}draw(t={}){var e;const i=this.context;this.sheets.forEach(t=>t.format());const s=new Set(this.sheets.flatMap(t=>t.getSystems()));this.systems.forEach(t=>{s.has(t)||t.setContext(i).format()});const n=i.getDefaultStyle();i.save(),i.setDefaultStyle(this.style),void 0!==this.style.fillStyle&&i.setFillStyle(this.style.fillStyle),void 0!==this.style.strokeStyle&&i.setStrokeStyle(this.style.strokeStyle),this.retained&&this.renderQ.forEach(t=>t.setRendered(!1));try{this.staves.forEach(t=>t.setContext(i).drawWithStyle()),this.voices.forEach(t=>t.setContext(i).drawWithStyle()),this.renderQ.forEach(t=>{t.isRendered()||t.setContext(i).drawWithStyle()}),this.systems.forEach(t=>t.setContext(i).drawWithStyle())}finally{i.setDefaultStyle(n),i.restore()}this.retained=null!==(e=t.retain)&&void 0!==e&&e,t.retain||this.reset()}}function Ci(t,e){const i=new Map([[0,t.filter(t=>!t.isRest())]]);if(e)for(const e of t)for(const t of e.getModifiers()){if(!(t instanceof pe))continue;const e=t.getGraceNotes();e.forEach((s,n)=>{var o;if(!(s instanceof ce)||s.isRest())return;const a=t.getPosition()===W.Position.RIGHT?n+1:n-e.length,r=null!==(o=i.get(a))&&void 0!==o?o:[];r.push(s),i.set(a,r)})}return[...i.entries()].sort(([t],[e])=>t-e).map(([,t])=>t)}function Di(t,e,i,s,n,o,a=!1){var r;const h=new H;let c=h.createScaleMap(i);const l=new Map,d=new Map;for(const t of e){const e=new y(0,1);for(const i of t.getTickables()){if(i.shouldIgnoreTicks())continue;const t=e.clone().simplify().toString(),s=null!==(r=d.get(t))&&void 0!==r?r:{at:e.clone(),notes:[]};i instanceof ce&&i.getStave()===o&&s.notes.push(i),d.set(t,s),e.add(i.getTicks())}}let u=0;const g=[...d.values()].sort((t,e)=>t.at.equals(e.at)?0:t.at.lessThan(e.at)?-1:1);for(const t of g){for(;u<s.length&&!s[u].at.greaterThan(t.at);)c=h.createScaleMap(s[u++].key),l.clear();for(const e of Ci(t.notes,a))p(e)}function p(e){var i;const s=new Map;for(const t of e)for(const e of t.getKeys()){const[t,n]=e.split("/"),o=h.getNoteParts(t),a=`${o.root}/${n}`,r=null!==(i=s.get(a))&&void 0!==i?i:new Set;r.add(o.accidental||"n"),s.set(a,r)}const o=new Map;for(const i of e)i.getKeys().forEach((e,a)=>{var r,d,u,g;const[p,m]=e.split("/"),f=h.getNoteParts(p),S=f.accidental||"n",x=f.root+S,w=`${f.root}/${m}`,T=null!==(r=l.get(w))&&void 0!==r?r:c[f.root],b=i.getModifiers().filter(t=>t instanceof ot&&t.getIndex()===a),y=b.filter(t=>!n.has(t)||t.isCautionary()||!H.accidentals.includes(t.type));for(const t of b)y.includes(t)||i.getModifiers().splice(i.getModifiers().indexOf(t),1);!y.length&&(T!==x||(null!==(u=null===(d=s.get(w))||void 0===d?void 0:d.size)&&void 0!==u?u:0)>1)&&t.attach(i,t.make.accidental({type:S}),a);const v=y.some(t=>!H.accidentals.includes(t.type))?"microtonal":x,k=null!==(g=o.get(w))&&void 0!==g?g:new Set;k.add(v),o.set(w,k)});o.forEach((t,e)=>l.set(e,1===t.size?[...t][0]:"ambiguous"))}}Bi.DEBUG=!1,Bi.owners=new WeakMap,Bi.groups=new WeakMap;var Ei=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};function Li(t,{side:e,notes:i,slur:s,beam:n}){["before","after"].includes(e)&&i.length||Ni("Expected a nonempty before or after grace group.");const o=i.map(e=>{var{accidentals:i}=e,s=Ei(e,["accidentals"]);const n=t.make.graceNote(s);for(const{index:e,type:s,cautionary:o}of null!=i?i:[]){const i=t.make.accidental({type:s});o&&i.setAsCautionary(),t.attach(n,i,e)}return n}),a=t.make.graceNoteGroup({notes:o,slur:s});return a.setPosition("after"===e?W.Position.RIGHT:W.Position.LEFT),n&&a.beamNotes(),a}function Ni(t){throw new p("BadComposition",t)}function Oi(t){return t.changes.map(({index:e,state:i})=>({at:t.notes.slice(0,e).reduce((t,e)=>e.shouldIgnoreTicks()?t:t.add(e.getTicks()),new y(0,1)),state:i}))}function Ai(t,e,i,s,n,o){var a,r,h,c;const l=new Map,d=i.measures[s];d.voices.length||Ni("Every stave measure needs at least one voice.");const u={clef:null!==(a=d.clef)&&void 0!==a?a:n.clef,key:null!==(r=d.key)&&void 0!==r?r:n.key,time:null!==(h=d.time)&&void 0!==h?h:n.time},g=null!==(c=d.span)&&void 0!==c?c:u.time,m=new ge(g).getTotalTicks().clone();const f=d.voices.map((e,i)=>function(t,e,i,s){var n;return t.withDefaults({clef:i.clef,time:i.time,stem:null!==(n=e.stem)&&void 0!==n?n:"auto"},()=>{var n;let o=Object.assign({},i);const a=[],r=[],h=new Map,c=new Set;for(const i of"string"==typeof e.notes?[e.notes]:e.notes)if("string"==typeof i)a.push(...t.notes(i)),t.builder.getElements().accidentals.flat().forEach(t=>{t&&c.add(t)});else if(i instanceof yt){Bi.getOwner(i)!==t.factory&&Ni("Adopt native notes before composing them.");try{i.getVoice(),Ni("Composition requires notes that are not already in a voice.")}catch(t){if(!(t instanceof p)||"NoVoice"!==t.code)throw t}a.push(i)}else if("change"in i){const e=o;o=Object.assign(Object.assign({},o),i.change),r.push({index:a.length,state:Object.assign({},o)}),s&&(i.change.clef&&a.push(t.make.clefNote({type:o.clef,options:{size:"small"}})),i.change.key&&a.push(t.make.keySigNote({key:o.key,cancelKey:e.key,clef:o.clef})),i.change.time&&a.push(t.make.timeSigNote({time:o.time}))),t.set({clef:o.clef,time:o.time})}else{const e="tab"in i?t.make.tabNote(i.tab,i.drawStem):t.make.note("note"in i?i.note:i);"grace"in i&&i.grace&&t.attach(e,Li(t,i.grace),0),"id"in i&&void 0!==i.id&&e.setAttribute("id",i.id),"stave"in i&&i.stave&&h.set(e,i.stave),a.push(e)}const l=a.filter(t=>!t.shouldIgnoreTicks());for(const i of null!==(n=e.tuplets)&&void 0!==n?n:[]){(!Number.isInteger(i.start)||!Number.isInteger(i.count)||i.start<0||i.count<1||i.start+i.count>l.length)&&Ni("Tuplet range is outside its voice.");const e=l.slice(i.start,i.start+i.count);e.every(t=>t instanceof vt)||Ni("Tuplets require native notes."),t.make.tuplet({notes:e,options:i.options})}return e.autoBeam&&(l.every(t=>t instanceof re)||Ni("Automatic beams require stemmable notes."),t.set({time:i.time}),t.autoBeam(l,"boolean"==typeof e.autoBeam?{}:e.autoBeam)),{notes:a,state:o,changes:r,assignments:h,generated:c}})}(t,e,u,0===i)),S=Oi(f[0]),x=t=>JSON.stringify(t.map(({at:t,state:e})=>[t.clone().simplify().toString(),e]));for(const t of f){x(Oi(t))!==x(S)&&Ni("Inline staff changes must agree in all voices.");t.notes.reduce((t,e)=>e.shouldIgnoreTicks()?t:t.add(e.getTicks()),new y(0,1)).equals(m)||Ni(`Measure ${s+1} on ${i.id} does not fill its declared span.`);for(const e of t.notes)o.seen.has(e)&&Ni("A note cannot belong to two composition voices."),o.seen.add(e),e instanceof vt&&o.noteMeasures.set(e,s);t.assignments.forEach((t,e)=>l.set(e,t))}const w=f.map((e,i)=>t.voice(e.notes,Object.assign(Object.assign({},d.voices[i].options),{time:g,mode:"strict"})));let T=u.key;const b=[];for(const t of S)t.state.key!==T&&(T=t.state.key,b.push({at:t.at,key:T}));const v={key:u.key,changes:b,generated:new Set(f.flatMap(t=>[...t.generated]))},k="tab"===i.kind?t.make.tabStave({options:i.options}):t.make.stave({options:Object.assign(Object.assign({},i.options),{clef:u.clef})});return function(t,e,i,s){s&&s.clef===i.clef||t.attachToStave(e,t.make.clef(i.clef)),"tab"===i.clef||s&&s.key===i.key||t.attachToStave(e,t.make.keySignature(i.key,null==s?void 0:s.key)),s&&s.time===i.time||t.attachToStave(e,t.make.timeSignature(i.time))}(t,k,u,s&&"every-measure"!==e.signatures?n:void 0),{stave:k,voices:w,notes:f.map(t=>t.notes),assignments:l,policy:v,ticks:m,state:f[0].state}}function Fi(t,e){var i,s;const n=null!==(s=null===(i=e.staves[0])||void 0===i?void 0:i.measures.length)&&void 0!==s?s:0;n&&e.staves.length||Ni("A composition needs staves and measures."),(new Set(e.staves.map(t=>t.id)).size!==e.staves.length||e.staves.some(t=>!t.id))&&Ni("Staff IDs must be unique and nonempty."),e.staves.some(t=>t.measures.length!==n)&&Ni("All staves need the same number of measures."),e.accidentals&&!["literal","key-aware"].includes(e.accidentals)&&Ni("Unknown accidental policy."),e.graceAccidentals&&!["explicit","ordered"].includes(e.graceAccidentals)&&Ni("Unknown grace accidental policy."),"ordered"===e.graceAccidentals&&"key-aware"!==e.accidentals&&Ni("Ordered grace accidentals require key-aware accidentals."),e.signatures&&!["changes","every-measure"].includes(e.signatures)&&Ni("Unknown signature policy."),e.crossMeasureSpans&&!["reject","manual"].includes(e.crossMeasureSpans)&&Ni("Unknown span policy.");const o=[];for(const t of e.staves)for(const e of t.measures)for(const t of e.voices)if("string"!=typeof t.notes)for(const e of t.notes)e instanceof vt&&o.push(e);o.length&&("key-aware"===e.accidentals||e.staves.some(t=>t.measures.some(t=>t.voices.some(t=>{var e;return t.autoBeam||(null===(e=t.tuplets)||void 0===e?void 0:e.length)}))))&&Ni("Apply rhythm and accidental policies before adopting native inputs, or use typed note descriptions.");const a=new Map(o.map(t=>[t,t.getStave()])),r=new Set;try{return t.build(()=>{const i={sheet:t.sheet(e.sheet),systems:[],staves:[],voices:[],notes:[],spans:[],diagnostics:[],getElement:e=>t.getElement(e),getNote:e=>t.getNote(e)};"every-measure"!==e.signatures&&i.diagnostics.push({code:"SignaturePolicy",message:"Signatures appear at the first measure and explicit changes. Sheet does not repeat them at wrapped row starts."});const s=e.staves.map(t=>{var e,i,s;return{clef:null!==(e=t.clef)&&void 0!==e?e:"tab"===t.kind?"tab":"treble",key:null!==(i=t.key)&&void 0!==i?i:"C",time:null!==(s=t.time)&&void 0!==s?s:"4/4"}}),o=new Map;for(let a=0;a<n;a++){const n=i.sheet.addSystem(e.system);i.systems.push(n);const h=e.staves.map((i,h)=>{const c=Ai(t,e,i,a,s[h],{seen:r,noteMeasures:o});return s[h]=c.state,n.addStave(Object.assign(Object.assign({stave:c.stave,voices:c.voices},void 0===i.spaceAbove?{}:{spaceAbove:i.spaceAbove}),void 0===i.spaceBelow?{}:{spaceBelow:i.spaceBelow})),c});h.some(t=>!t.ticks.equals(h[0].ticks))&&Ni("Staves must share the same actual measure span.");const c=h.map(t=>t.stave),l=h.map(t=>t.voices),d=h.map(t=>t.notes),u=h.map(t=>t.policy);if(new Map(h.flatMap(t=>[...t.assignments])).forEach((t,i)=>{const s=e.staves.findIndex(e=>e.id===t);s<0&&Ni(`Unknown cross-staff target: ${t}`),i.setStave(c[s])}),"key-aware"===e.accidentals){const i=new Set(u.flatMap(t=>[...t.generated]));u.forEach((s,n)=>Di(t,l.flat(),s.key,s.changes,i,c[n],"ordered"===e.graceAccidentals))}i.staves.push(c),i.voices.push(l),i.notes.push(d)}return i.spans=function(t,e,i,s){var n;return(null!==(n=e.spans)&&void 0!==n?n:[]).map(n=>{const o=void 0===n.from?void 0:t.getNote(n.from),a=void 0===n.to?void 0:t.getNote(n.to);for(const t of[o,a])t&&!i.has(t)&&Ni("Span endpoints must belong to this composition.");return o&&a&&i.get(o)!==i.get(a)&&("manual"!==e.crossMeasureSpans&&Ni("Cross-measure spans need explicit manual segmentation."),s.push({code:"ManualSpan",message:"A cross-measure span will not split when Sheet wraps. Replace it with native partial segments before drawing across rows."})),"tie"===n.kind?t.make.tie(Object.assign(Object.assign({},n),{from:o,to:a})):"curve"===n.kind?t.make.curve({from:o,to:a,options:n.options}):(o&&a||Ni("Hairpins require both endpoints."),t.make.hairpin({from:o,to:a,type:n.type,options:n.options}))})}(t,e,o,i.diagnostics),i})}catch(t){for(const t of o)if(r.has(t)){t.clearVoice();const e=a.get(t);e?t.setStave(e):t.clearStave()}throw t}}class Mi{constructor(){this.ids=new Map,this.entries=new Map,this.scopes=[]}static sourceOf(t){const e=this.sources.get(t);return e&&Object.assign({},e)}get(t){return this.ids.get(t)}getSource(t){var e;const i=null===(e=this.entries.get(t))||void 0===e?void 0:e.source;return i&&Object.assign({},i)}validate(t,e){if(!e)throw new p("BadArguments","Score elements need a nonempty ID.");const i=this.ids.get(e);if(i&&i!==t)throw new p("BadArguments",`Duplicate score element ID: ${e}`)}add(t,e){var i;if(this.entries.get(t))return t;const s=t.getAttribute("id");this.validate(t,s);const n={id:s,source:e&&Object.assign({},e),unsubscribe:t.onIdChange(e=>this.validate(t,e),()=>{this.ids.delete(n.id),n.id=t.getAttribute("id"),this.ids.set(n.id,t)})};return this.entries.set(t,n),this.ids.set(s,t),n.source&&Mi.sources.set(t,n.source),null===(i=this.scopes[this.scopes.length-1])||void 0===i||i.push(()=>this.remove(t)),t}remove(t){const e=this.entries.get(t);e&&(e.unsubscribe(),this.ids.delete(e.id),this.entries.delete(t),e.source===Mi.sources.get(t)&&Mi.sources.delete(t))}clear(){for(const t of this.entries.keys())this.remove(t)}transaction(t){var e;const i=[];this.scopes.push(i);try{const s=t();return this.scopes.pop(),null===(e=this.scopes[this.scopes.length-1])||void 0===e||e.push(...i),s}catch(t){throw this.scopes.pop(),i.reverse().forEach(t=>t()),t}}}Mi.sources=new WeakMap;class Pi{constructor(t){this.host=t}get factory(){return this.host.factory()}stave(...t){return this.host.manage(()=>this.factory.Stave(...t))}tabStave(...t){return this.host.manage(()=>this.factory.TabStave(...t))}glyphNote(...t){return this.host.manage(()=>this.factory.GlyphNote(...t))}repeatNote(...t){return this.host.manage(()=>this.factory.RepeatNote(...t))}barNote(...t){return this.host.manage(()=>this.factory.BarNote(...t))}clefNote(...t){return this.host.manage(()=>this.factory.ClefNote(...t))}keySigNote(...t){return this.host.manage(()=>this.factory.KeySigNote(...t))}timeSigNote(...t){return this.host.manage(()=>this.factory.TimeSigNote(...t))}clef(...t){return this.host.manage(()=>this.factory.Clef(...t))}keySignature(...t){return this.host.manage(()=>this.factory.KeySignature(...t))}timeSignature(...t){return this.host.manage(()=>this.factory.TimeSignature(...t))}barline(...t){return this.host.manage(()=>this.factory.Barline(...t))}repetition(...t){return this.host.manage(()=>this.factory.Repetition(...t))}volta(...t){return this.host.manage(()=>this.factory.Volta(...t))}section(...t){return this.host.manage(()=>this.factory.StaveSection(...t))}tempo(...t){return this.host.manage(()=>this.factory.StaveTempo(...t))}staveText(...t){return this.host.manage(()=>this.factory.StaveText(...t))}tabPositions(t){if(!t.positions.length)throw new p("BadArguments","Tab notes need positions.");for(const{str:e,fret:i}of t.positions)if(!Number.isSafeInteger(e)||e<1||("number"==typeof i?!Number.isFinite(i)||i<0:"string"!=typeof i||!i.length))throw new p("BadArguments","Invalid tablature position.")}tabNote(t,e=!1){return this.tabPositions(t),this.host.manage(()=>this.factory.TabNote(t,e))}graceTabNote(t){return this.tabPositions(t),this.host.manage(()=>this.factory.GraceTabNote(t))}bend(...t){if(!t[0].length||t[0].some(t=>0!==t.type&&1!==t.type))throw new p("BadArguments","A bend needs valid phrase directions.");return this.host.manage(()=>this.factory.Bend(...t))}tabEndpoints(t){var e,i;this.endpoints(t.firstNote,t.lastNote,!0);const s=null!==(e=t.firstIndexes)&&void 0!==e?e:[0],n=null!==(i=t.lastIndexes)&&void 0!==i?i:[0];if(!s.length||s.length!==n.length)throw new p("BadArguments","Tab span index lists must match.");for(const[e,i]of[[t.firstNote,s],[t.lastNote,n]])if(e){if(!(e instanceof ii))throw new p("BadArguments","Tab spans need tab notes.");i.forEach(t=>this.host.checkIndex(e,t))}}tabTie(...t){return this.tabEndpoints(t[0]),this.host.manage(()=>this.factory.TabTie(...t))}tabSlide(...t){if(this.tabEndpoints(t[0]),void 0!==t[1]&&1!==t[1]&&-1!==t[1]||void 0===t[1]&&(!t[0].firstNote||!t[0].lastNote))throw new p("BadArguments","Partial tab slides need direction 1 or -1.");return this.host.manage(()=>this.factory.TabSlide(...t))}connector(t){return this.host.owned(t.topStave),this.host.owned(t.bottomStave),this.host.manage(()=>this.factory.StaveConnector(t))}multiMeasureRest(t){var e;if(!Number.isSafeInteger(t.numberOfMeasures)||(null!==(e=t.numberOfMeasures)&&void 0!==e?e:0)<1)throw new p("BadArguments","A multi-measure rest needs a positive measure count.");return this.host.manage(()=>this.factory.MultiMeasureRest(t))}note(t){return this.host.manage(()=>this.factory.StaveNote(Object.assign(Object.assign(Object.assign({},this.host.noteDefaults()),void 0!==t.stemDirection&&void 0===t.autoStem?{autoStem:!1}:{}),t)))}annotation(...t){return this.host.manage(()=>this.factory.Annotation(...t))}ghostNote(...t){return this.host.manage(()=>this.factory.GhostNote(...t))}graceNote(t){return this.host.manage(()=>this.factory.GraceNote(Object.assign(Object.assign(Object.assign({},this.host.noteDefaults()),void 0!==t.stemDirection&&void 0===t.autoStem?{autoStem:!1}:{}),t)))}accidental(...t){return this.host.manage(()=>this.factory.Accidental(...t))}articulation(t={}){var e;const i=Tt.parseEasyScore(null!==(e=t.type)&&void 0!==e?e:"staccato");if(1!==i.length)throw new p("BadArguments","Create one articulation per helper call.");return this.host.manage(()=>this.factory.Articulation(Object.assign(Object.assign(Object.assign({},i[0]),t),{type:i[0].type})))}ornament(...t){return this.host.manage(()=>this.factory.Ornament(...t))}dot(...t){return this.host.manage(()=>this.factory.Dot(...t))}parenthesis(...t){return this.host.manage(()=>this.factory.Parenthesis(...t))}stroke(...t){return this.host.manage(()=>this.factory.Stroke(...t))}tremolo(...t){return this.host.manage(()=>this.factory.Tremolo(...t))}vibrato(...t){return this.host.manage(()=>this.factory.Vibrato(...t))}chordSymbol(...t){return this.host.manage(()=>this.factory.ChordSymbol(...t))}textNote(...t){return this.host.manage(()=>this.factory.TextNote(...t))}fingering(...t){return this.host.manage(()=>this.factory.Fingering(...t))}stringNumber(...t){return this.host.manage(()=>this.factory.StringNumber(...t))}graceNoteGroup(t){return t.notes.forEach(t=>this.host.owned(t)),this.host.manage(()=>this.factory.groupNotes(t.notes,()=>this.factory.GraceNoteGroup(Object.assign(Object.assign({},t),{notes:t.notes.slice()}))))}noteSubGroup(t){return t.notes.forEach(t=>this.host.owned(t)),this.host.manage(()=>this.factory.groupNotes(t.notes,()=>this.factory.NoteSubGroup({notes:t.notes.slice()})))}tie(t){var e,i;const{from:s,to:n}=t;this.endpoints(s,n,!0);const o=null!==(e=t.firstIndexes)&&void 0!==e?e:[0],a=null!==(i=t.lastIndexes)&&void 0!==i?i:[0];if(!o.length||o.length!==a.length)throw new p("BadArguments","Tie index lists must be nonempty and have the same length.");for(const[t,e]of[[s,o],[n,a]])t&&(this.host.owned(t),e.forEach(e=>this.host.checkIndex(t,e)));return this.host.manage(()=>this.factory.StaveTie(t))}endpoints(t,e,i=!1){if(!t&&!e||!i&&(!t||!e))throw new p("BadArguments","Missing span endpoint.");for(const i of[t,e])if(i){if(!(i instanceof vt))throw new p("BadArguments","Span endpoints must be notes.");this.host.owned(i)}}beam(t){var e,i,s;const{notes:n,options:o}=t;if(n.length<2||new Set(n).size!==n.length)throw new p("BadArguments","A beam needs at least two distinct notes.");n.forEach(t=>{if(!(t instanceof re))throw new p("BadArguments","Beam endpoints must be stemmable notes.");if(this.host.owned(t),t.hasBeam())throw new p("BadArguments","Note already belongs to a beam.");if(t.getIntrinsicTicks()>=$.durationToTicks("4"))throw new p("BadArguments","Beamed notes must be shorter than a quarter note.")});for(const t of null!==(e=null==o?void 0:o.secondaryBeamBreaks)&&void 0!==e?e:[])this.noteIndex(n.length,t);for(const[t,e]of Object.entries(null!==(i=null==o?void 0:o.partialBeamDirections)&&void 0!==i?i:{}))if(this.noteIndex(n.length,Number(t)),!["L","R","B"].includes(e))throw new p("BadArguments","Invalid partial beam direction.");const a=null!==(s=null==o?void 0:o.autoStem)&&void 0!==s?s:this.host.beamStems(n);return this.host.manage(()=>this.factory.Beam({notes:n,options:Object.assign(Object.assign({},o),{autoStem:a})}))}noteIndex(t,e){if(!Number.isInteger(e)||e<0||e>=t)throw new p("BadArguments","Invalid beam note index.")}tuplet(t){var e,i;const{notes:s,options:n}=t;if(!s.length||new Set(s).size!==s.length)throw new p("BadArguments","A tuplet needs distinct notes.");s.forEach(t=>{if(!(t instanceof vt))throw new p("BadArguments","Tuplets require notes.");this.host.owned(t);let e=!1;try{t.getVoice(),e=!0}catch(t){if(!(t instanceof p)||"NoVoice"!==t.code)throw t}if(e)throw new p("BadArguments","Create tuplets before inserting notes into a voice.")});for(const t of[null!==(e=null==n?void 0:n.numNotes)&&void 0!==e?e:s.length,null!==(i=null==n?void 0:n.notesOccupied)&&void 0!==i?i:2])if(!Number.isSafeInteger(t)||t<=0)throw new p("BadArguments","Tuplet ratios must be positive integers.");return this.host.manage(()=>this.factory.Tuplet(t))}curve(t){return this.endpoints(t.from,t.to,!0),this.host.manage(()=>{var e;return this.factory.Curve({from:t.from,to:t.to,options:null!==(e=t.options)&&void 0!==e?e:{}})})}hairpin(t){if(this.endpoints(t.from,t.to),![1,2].includes(t.type))throw new p("BadArguments","Unknown hairpin type.");return this.host.manage(()=>this.factory.StaveHairpin(t))}line(t){if(this.endpoints(t.from,t.to),!(t.from instanceof ce&&t.to instanceof ce))throw new p("BadArguments","Lines require staff notes.");if(!t.firstIndexes.length||t.firstIndexes.length!==t.lastIndexes.length)throw new p("BadArguments","Line index lists must be nonempty and matched.");return t.firstIndexes.forEach(e=>this.host.checkIndex(t.from,e)),t.lastIndexes.forEach(e=>this.host.checkIndex(t.to,e)),this.host.manage(()=>this.factory.StaveLine(t))}textBracket(t){return this.endpoints(t.from,t.to),this.host.manage(()=>this.factory.TextBracket(t))}vibratoBracket(t){return this.endpoints(t.from,t.to,!0),this.host.manage(()=>this.factory.VibratoBracket(t))}pedalMarking(t){var e,i;if(!t.notes.length)throw new p("BadArguments","Pedal markings need notes.");if(t.notes.forEach(t=>{if(!(t instanceof ce))throw new p("BadArguments","Pedal points must be staff notes.");this.host.owned(t)}),!["text","bracket","mixed"].includes(null!==(i=null===(e=t.options)||void 0===e?void 0:e.style)&&void 0!==i?i:"mixed"))throw new p("BadArguments","Unknown pedal style.");return this.host.manage(()=>this.factory.PedalMarking(t))}textDynamics(t={}){var e;if(!/^[pmfsrz]*$/i.test(null!==(e=t.text)&&void 0!==e?e:"p"))throw new p("BadArguments","Unknown dynamics glyph.");return this.host.manage(()=>this.factory.TextDynamics(t))}crescendo(...t){return this.host.manage(()=>this.factory.Crescendo(...t))}}var Ri=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(i[s[n]]=t[s[n]])}return i};function Ii(...t){Gi.DEBUG&&S("VexFlow.Parser",t)}const Wi=-1;function Hi(t){if("matchedString"in t)return t.matchedString;if("results"in t)return Hi(t.results);const e=t;return 1===e.length?Hi(e[0]):0===e.length?null:e.map(Hi)}class Gi{constructor(t){this.furthestErrorPos=Wi,this.grammar=t,this.line="",this.pos=0,this.errorPos=Wi}parse(t){this.line=t,this.pos=0,this.errorPos=Wi,this.furthestErrorPos=Wi;const e=this.expect(this.grammar.begin());return e.errorPos=this.errorPos,e.furthestErrorPos=e.success?Wi:this.furthestErrorPos,e}matchFail(t){this.errorPos===Wi&&(this.errorPos=this.pos),this.pos=t}matchSuccess(){this.errorPos=Wi}matchToken(t,e=!1){const i=e?new RegExp("^(("+t+"))"):new RegExp("^(("+t+")\\s*)"),s=this.line.slice(this.pos).match(i);return null!==s?{success:!0,matchedString:s[2],incrementPos:s[1].length,pos:this.pos}:(this.furthestErrorPos=Math.max(this.furthestErrorPos,this.pos),{success:!1,pos:this.pos})}expectOne(t,e=!1){const i=[],s=this.pos;let n=!0,o=!1;if(e=!0===e||!0===t.maybe,t.expect)for(const e of t.expect){const s=this.pos,a=this.expect(e);if(a.success){if(i.push(a),o=!0,t.or)break}else if(n=!1,!t.or){this.pos=s;break}}const a=t.or&&o||n,r=a||!0===e,h=a?1:0;return e&&!a&&(this.pos=s),r?this.matchSuccess():this.matchFail(s),{success:r,results:i,numMatches:h}}expectOneOrMore(t,e=!1){const i=[],s=this.pos;let n=0,o=!0;do{const e=this.expectOne(t);e.success&&e.results?(n++,i.push(e.results)):o=!1}while(o);const a=n>0||!0===e;return!e||n>0||(this.pos=s),a?this.matchSuccess():this.matchFail(s),{success:a,results:i,numMatches:n}}expectZeroOrMore(t){return this.expectOneOrMore(t,!0)}expect(t){if(Ii("Evaluating rule function:",t),!t)throw new p("Invalid rule function");const e=this.pos;let i;const s=t.bind(this.grammar)();if(s.token)i=this.matchToken(s.token,!0===s.noSpace),i.success&&(this.pos+=i.incrementPos);else{if(!s.expect)throw Ii(s),new p("Bad grammar! No `token` or `expect` property "+s);i=s.oneOrMore?this.expectOneOrMore(s):s.zeroOrMore?this.expectZeroOrMore(s):this.expectOne(s)}const n=[];return i.matches=n,i.results&&i.results.forEach(t=>n.push(Hi(t))),s.run&&i.success&&s.run({matches:n,start:e,end:this.pos}),i}}function Ui(...t){Qi.DEBUG&&S("VexFlow.EasyScore",t)}Gi.DEBUG=!1;class Vi{constructor(t){this.builder=t}begin(){return this.LINE}LINE(){return{expect:[this.PIECE,this.PIECES,this.EOL]}}PIECE(){return{expect:[this.CHORDORNOTE,this.PARAMS],run:t=>this.builder.commitPiece(t&&{start:t.start,end:t.end})}}PIECES(){return{expect:[this.COMMA,this.PIECE],zeroOrMore:!0}}PARAMS(){return{expect:[this.DURATION,this.TYPE,this.DOTS,this.OPTS]}}CHORDORNOTE(){return{expect:[this.CHORD,this.SINGLENOTE],or:!0}}CHORD(){return{expect:[this.LPAREN,this.NOTES,this.RPAREN],run:t=>this.builder.addChord(t.matches[1])}}NOTES(){return{expect:[this.NOTE],oneOrMore:!0}}NOTE(){return{expect:[this.NOTENAME,this.ACCIDENTAL,this.OCTAVE]}}SINGLENOTE(){return{expect:[this.NOTENAME,this.ACCIDENTAL,this.OCTAVE],run:t=>{const e=t;this.builder.addSingleNote(e.matches[0],e.matches[1],e.matches[2])}}}ACCIDENTAL(){return{expect:[this.MICROTONES,this.ACCIDENTALS],maybe:!0,or:!0}}DOTS(){return{expect:[this.DOT],zeroOrMore:!0,run:t=>this.builder.setNoteDots(t.matches)}}TYPE(){return{expect:[this.SLASH,this.MAYBESLASH,this.TYPES],maybe:!0,run:t=>this.builder.setNoteType(t.matches[2])}}DURATION(){return{expect:[this.SLASH,this.DURATIONS],maybe:!0,run:t=>this.builder.setNoteDuration(t.matches[1])}}OPTS(){return{expect:[this.LBRACKET,this.KEYVAL,this.KEYVALS,this.RBRACKET],maybe:!0}}KEYVALS(){return{expect:[this.COMMA,this.KEYVAL],zeroOrMore:!0}}KEYVAL(){return{expect:[this.KEY,this.EQUALS,this.VAL],run:t=>this.builder.addNoteOption(t.matches[0],t.matches[2].slice(1,-1))}}VAL(){return{expect:[this.SVAL,this.DVAL],or:!0}}KEY(){return{token:"[a-zA-Z][a-zA-Z0-9]*"}}DVAL(){return{token:'["][^"]*["]'}}SVAL(){return{token:"['][^']*[']"}}NOTENAME(){return{token:"[a-gA-G]"}}OCTAVE(){return{token:"[0-9]+"}}ACCIDENTALS(){return{token:"bb|b|##|#|n"}}MICROTONES(){return{token:"bbs|bss|bs|db|d|\\+\\+-|\\+-|\\+\\+|\\+|k|o"}}DURATIONS(){return{token:"[0-9whq]+"}}TYPES(){return{token:"[rRsSmMhHgG]"}}LPAREN(){return{token:"[(]"}}RPAREN(){return{token:"[)]"}}COMMA(){return{token:"[,]"}}DOT(){return{token:"[.]"}}SLASH(){return{token:"[/]"}}MAYBESLASH(){return{token:"[/]?"}}EQUALS(){return{token:"[=]"}}LBRACKET(){return{token:"\\["}}RBRACKET(){return{token:"\\]"}}EOL(){return{token:"$"}}}class Yi{constructor(t){this.chord=[],this.dots=0,this.options={},this.duration=t}}class Xi{constructor(t){this.commitHooks=[],this.factory=t,this.reset()}reset(t){var e;this.options=Object.assign({stem:"auto",clef:"treble"},t),this.elements={notes:[],accidentals:[]},this.rollingDuration=null!==(e=null==t?void 0:t.duration)&&void 0!==e?e:"8",this.resetPiece()}getFactory(){return f(this.factory,"NoFactory","Create EasyScore with a Factory before constructing notes.")}getElements(){return this.elements}addCommitHook(t){this.commitHooks.push(t)}resetPiece(){Ui("resetPiece"),this.piece=new Yi(this.rollingDuration)}setNoteDots(t){Ui("setNoteDots:",t),t&&(this.piece.dots=t.length)}setNoteDuration(t){Ui("setNoteDuration:",t),this.rollingDuration=this.piece.duration=t||this.rollingDuration}setNoteType(t){Ui("setNoteType:",t),t&&(this.piece.type=t)}addNoteOption(t,e){Ui("addNoteOption: key:",t,"value:",e),this.piece.options[t]=e}addNote(t,e,i){Ui("addNote:",t,e,i),this.piece.chord.push({key:t,accid:e,octave:i})}addSingleNote(t,e,i){Ui("addSingleNote:",t,e,i),this.addNote(t,e,i)}addChord(t){Ui("startChord"),"object"!=typeof t[0]?this.addSingleNote(t[0]):t.forEach(t=>{t&&this.addNote(...t)}),Ui("endChord")}commitPiece(t){var e;this.piece.source=t,Ui("commitPiece");const{factory:i}=this;if(!i)return;const s=Object.assign(Object.assign({},this.options),this.piece.options),n=f(s.stem,"BadArguments","options.stem is not defined").toLowerCase(),o=f(s.clef,"BadArguments","options.clef is not defined").toLowerCase(),{chord:a,duration:r,dots:h,type:c}=this.piece,l=H.accidentals,d=a.map(t=>{var e;return t.key+(l.includes(null!==(e=t.accid)&&void 0!==e?e:"")?t.accid:"")+"/"+t.octave}),u={octaveShift:void 0===s.octaveShift?void 0:Number(s.octaveShift),strokePx:void 0===s.strokePx?void 0:Number(s.strokePx),line:void 0===s.line?void 0:Number(s.line),alignCenter:"true"===String(s.alignCenter),durationOverride:s.durationOverride},g="auto"===n,p="g"===(null==c?void 0:c.toLowerCase())?i.GhostNote(Object.assign(Object.assign({},u),{duration:r,dots:h})):i.StaveNote(Object.assign(Object.assign({},u),{keys:d,duration:r,dots:h,type:c,clef:o,autoStem:g}));g||p.setStemDirection("up"===n?at.UP:at.DOWN);const m=[];a.forEach((t,e)=>{const s=t.accid;if("string"==typeof s){const t=i.Accidental({type:s});p.addModifier(t,e),m.push(t)}else m.push(void 0)});for(let t=0;t<h;t++)se.buildAndAttach([p],{all:!0});this.commitHooks.forEach(t=>t(s,p,this)),null===(e=this.onNote)||void 0===e||e.call(this,p,t),this.elements.notes.push(p),this.elements.accidentals.push(m),this.resetPiece()}}class _i extends p{constructor(t){super("EasyScoreError",t.map(t=>`${t.message} (${t.line}:${t.column})`).join("; ")),this.diagnostics=t}}class zi extends Xi{constructor(){super(...arguments),this.pieces=[]}commitPiece(t={start:0,end:0}){this.pieces.push(Object.assign(Object.assign({},this.piece),{source:t})),this.resetPiece()}}function ji(t,e,i,s){const n=t.slice(0,s.start);return Object.assign(Object.assign({},s),{code:e,message:i,line:n.split("\n").length,column:s.start-n.lastIndexOf("\n")})}function qi(t,e){void 0!==t.id&&e.setAttribute("id",t.id)}const $i=/\s*,\s*/;function Ki(t,e){void 0!==t.class&&t.class.split($i).forEach(t=>e.addClass(t))}class Qi{static getSource(t){return Mi.sourceOf(t)}getElement(t){return this.references.get(t)}getNote(t){const e=this.getElement(t);if(!(e instanceof vt))throw new p("BadArguments",`No note with ID: ${t}`);return e}getSource(t){return this.references.getSource(t)}adopt(t,e){return this.transaction(()=>this.references.add(this.factory.adopt(t,e)))}transaction(t){return this.references.transaction(()=>this.factory?this.factory.transaction(t):t())}static create(t,e={}){return new Bi(t).EasyScore(Object.assign({throwOnError:!0,strictOptions:!0},e))}attach(t,e,i=0){this.requireOwned(t),this.checkIndex(t,i);const s=Bi.getOwner(e);if(s&&s!==this.factory)throw new p("BadArguments","Modifier belongs to another Factory.");let n;try{n=e.getNote()}catch(t){if(!(t instanceof p)||"NoNote"!==t.code)throw t}if(n){if(n===t&&e.getIndex()===i&&t.getModifiers().includes(e))return t;throw new p("BadArguments","Modifier is already attached. Create a separate modifier.")}return this.transaction(()=>(this.adopt(e,"modifier"),t.addModifier(e,i)))}attachToStave(t,e,i){this.requireOwned(t);const s=Bi.getOwner(e);if(s&&s!==this.factory)throw new p("BadArguments","Modifier belongs to another Factory.");if(void 0!==i&&(!Number.isInteger(i)||i<0||i>6))throw new p("BadArguments","Invalid stave modifier position.");if(e.getStave()){if(e.getStave()===t&&t.getModifiers().includes(e)&&(void 0===i||i===e.getPosition()))return t;throw new p("BadArguments","Stave modifier is already attached.")}return this.transaction(()=>(this.adopt(e,"staveModifier"),t.addModifier(e,i),t))}withDefaults(t,e){const i=this.defaults;try{return this.set(t),this.build(e)}finally{this.defaults=i}}compose(t){return Fi(this,t)}system(t={}){return this.transaction(()=>this.references.add(this.factory.System(t)))}sheet(t={}){return this.transaction(()=>this.factory.Sheet(t))}build(t){const e={elements:this.builder.elements,options:this.builder.options,piece:this.builder.piece,rollingDuration:this.builder.rollingDuration};try{return this.transaction(()=>{const e=t(this);if(e&&"object"==typeof e&&"then"in e)throw new p("BadArguments","EasyScore.build() requires a synchronous callback.");return e})}catch(t){throw Object.assign(this.builder,e),t}}setStyle(t){return this.factory.setStyle(t),this}draw(t={}){this.factory.draw(t)}reset(){return this.factory.reset(),this.builder.reset(),this.references.clear(),this}requireOwned(t){if(Bi.getOwner(t)!==this.factory)throw new p("BadArguments","Note belongs to another Factory or was constructed outside this Factory.")}checkIndex(t,e){if(!Number.isInteger(e)||e<0||e>=(t instanceof ii?t.getPositions().length:Math.max(1,t.getKeys().length)))throw new p("BadArguments",`Invalid chord index: ${e}`)}constructor(t={}){this.references=new Mi,this.make=new Pi({factory:()=>this.factory,manage:t=>this.transaction(()=>this.references.add(t())),owned:t=>this.requireOwned(t),checkIndex:(t,e)=>this.checkIndex(t,e),beamStems:t=>this.resolveBeamStems(t),noteDefaults:()=>({clef:this.defaults.clef,autoStem:"auto"===this.defaults.stem,stemDirection:"down"===this.defaults.stem?at.DOWN:at.UP})}),this.defaults={clef:"treble",time:"4/4",stem:"auto"},this.setOptions(t)}set(t){return this.defaults=Object.assign(Object.assign({},this.defaults),t),this}setOptions(t){var e,i;const s=t.factory,n=null!==(e=t.builder)&&void 0!==e?e:new Xi(s);return this.options=Object.assign(Object.assign({commitHooks:[qi,Ki,Tt.easyScoreHook,ne.easyScoreHook],throwOnError:!1},t),{factory:s,builder:n}),this.factory=s,this.builder=n,this.grammar=new Vi(this.builder),this.parser=new Gi(this.grammar),null===(i=this.options.commitHooks)||void 0===i||i.forEach(t=>this.addCommitHook(t)),this}setContext(t){return this.factory.setContext(t),this}parseNotation(t,e={}){var i,s,n,o;const a=new zi;a.reset(Object.assign({clef:this.defaults.clef,stem:this.defaults.stem},e));const r=new Gi(new Vi(a)).parse(t);if(!r.success){const e=Math.max(0,null!==(s=null!==(i=r.furthestErrorPos)&&void 0!==i?i:r.errorPos)&&void 0!==s?s:0);return{success:!1,pieces:[],diagnostics:[ji(t,"SyntaxError","Invalid EasyScore notation",{start:e,end:Math.min(t.length,e+1)})]}}const h=[];for(const e of a.pieces)try{const t=Object.assign(Object.assign({},a.options),e.options);this.validatePiece(e,t),null===(o=(n=this.options).validate)||void 0===o||o.call(n,{piece:Object.assign(Object.assign({},e),{chord:e.chord.map(t=>Object.assign({},t)),options:Object.assign({},e.options),source:Object.assign({},e.source)}),options:Object.assign({},t)})}catch(i){h.push(ji(t,"InvalidNotation",i instanceof Error?i.message:String(i),e.source))}return{success:0===h.length,pieces:h.length?[]:a.pieces,diagnostics:h}}validatePiece(t,e){var i;if($.durationToTicks(t.duration),!["auto","up","down"].includes(String(e.stem).toLowerCase()))throw new p("BadArguments",`Invalid stem: ${e.stem}`);if(!Object.hasOwnProperty.call(Qt.types,String(e.clef).toLowerCase()))throw new p("BadArguments",`Invalid clef: ${e.clef}`);for(const t of["octaveShift","strokePx","line"])if(void 0!==e[t]&&!Number.isFinite(Number(e[t])))throw new p("BadArguments",`Invalid numeric option: ${t}`);if(void 0!==e.alignCenter&&![!0,!1,"true","false"].includes(e.alignCenter))throw new p("BadArguments","alignCenter must be true or false.");if(void 0!==e.durationOverride&&(!(e.durationOverride instanceof y)||!Number.isFinite(e.durationOverride.value())||e.durationOverride.value()<=0))throw new p("BadArguments","durationOverride must be a positive finite Fraction.");if(e.articulations&&this.builder.commitHooks.includes(Tt.easyScoreHook)&&Tt.parseEasyScore(e.articulations),this.options.strictOptions){const t=new Set(["stem","clef","duration","id","class","articulations","fingerings","octaveShift","strokePx","line","alignCenter","durationOverride",...null!==(i=this.options.extensions)&&void 0!==i?i:[]]);for(const i of Object.keys(e))if(!t.has(i))throw new p("BadArguments",`Unknown EasyScore option: ${i}`)}}parse(t,e={}){const i=this.builder.onNote,s=this.sourceContext;this.builder.onNote=(e,n)=>{var o,a,r;null==i||i(e,n);const h=n&&Object.assign({input:null!==(o=null==s?void 0:s.input)&&void 0!==o?o:t,start:n.start+(null!==(a=null==s?void 0:s.offset)&&void 0!==a?a:0),end:n.end+(null!==(r=null==s?void 0:s.offset)&&void 0!==r?r:0)},s&&{measure:s.measure});this.references.add(e,h),e.getModifiers().forEach(t=>this.references.add(t,h))};try{return this.parseInput(t,e)}finally{this.builder.onNote=i}}parseInput(t,e){var i,s;if(!this.options.throwOnError)return this.builder.reset(e),this.parser.parse(t);const n=this.parseNotation(t,Object.assign({clef:"treble",stem:"auto"},e));if(!n.success)throw new _i(n.diagnostics);const o={elements:this.builder.elements,options:this.builder.options,piece:this.builder.piece,rollingDuration:this.builder.rollingDuration},a=()=>{this.builder.reset(e);const i=this.parser.parse(t);if(!i.success)throw new p("BadArguments","Error parsing line: "+t);return i};try{return this.transaction(a)}catch(e){const a=null!==(s=null===(i=n.pieces[this.builder.elements.notes.length])||void 0===i?void 0:i.source)&&void 0!==s?s:{start:0,end:t.length};throw Object.assign(this.builder,o),new _i([ji(t,"ConstructionError",e instanceof Error?e.message:String(e),a)])}}beam(t,e){var i;if(this.options.strictOptions)this.make.beam({notes:t,options:e});else{const s=null!==(i=null==e?void 0:e.autoStem)&&void 0!==i?i:this.resolveBeamStems(t);this.transaction(()=>this.references.add(this.factory.Beam({notes:t,options:Object.assign(Object.assign({},e),{autoStem:s})})))}return t}autoBeam(t,e={}){return function(t,e,i){var s,n;if(new Set(e).size!==e.length)throw new p("BadArguments","Beam notes must be distinct.");e.forEach(e=>{if(!(e instanceof re)||Bi.getOwner(e)!==t.factory)throw new p("BadArguments","Beam notes must belong to this Factory.");if(e.hasBeam())throw new p("BadArguments","Note already belongs to a beam.")});const o=null!==(s=t.defaults.time)&&void 0!==s?s:"4/4",a="string"==typeof o?o:`${o.numBeats}/${o.beatValue}`,r=null!==(n=i.groups)&&void 0!==n?n:Ft.getDefaultBeamGroups(a);if(!r.length||r.some(t=>!(t instanceof y)||!Number.isFinite(t.value())||t.value()<=0))throw new p("BadArguments","Beam groups must be positive finite Fractions.");if(void 0!==i.secondaryBreaks&&$.durationToTicks(i.secondaryBreaks),void 0!==i.stemDirection&&![1,-1].includes(i.stemDirection))throw new p("BadArguments","Invalid beam stem direction.");const{autoStem:h}=i,c=Ri(i,["autoStem"]),l=!1===h?"preserve":!0===h||void 0!==i.stemDirection?"auto":"explicit";return t.build(()=>Ft.generateBeams(e,Object.assign(Object.assign({},c),{groups:r.map(t=>t.clone()),stemPolicy:l})).map(e=>t.adopt(e,"drawable")))}(this,t,e)}resolveBeamStems(t){const e=new Set(t.filter(t=>!t.isRest()&&!t.isAutoStem()).map(t=>t.getStemDirection()));if(0===e.size)return!0;if(1===e.size){const i=e.values().next().value;t.filter(t=>t.isAutoStem()).forEach(t=>t.setStemDirection(i,!0))}return!1}tuplet(t,e){return this.options.strictOptions?this.make.tuplet({notes:t,options:e}):this.transaction(()=>this.references.add(this.factory.Tuplet({notes:t,options:e}))),t}notes(t,e={}){return e=Object.assign({clef:this.defaults.clef,stem:this.defaults.stem},e),this.parse(t,e),this.builder.getElements().notes}sequence(t,e={}){return this.build(()=>t.flatMap(t=>{if("string"==typeof t)return this.notes(t,e);if(t instanceof yt){if(this.requireOwned(t),t instanceof vt&&Bi.getGroup(t))throw new p("BadArguments","Grouped notes cannot be sequence entries.");return[t]}return[this.make.note(t)]}))}measures(t,e={}){const i=this.splitMeasures(t);let s=e.duration;for(const[n,{text:o,offset:a}]of i.entries()){const i=this.parseNotation(o,Object.assign(Object.assign({},e),{duration:s}));if(!i.success)throw new _i(i.diagnostics.map(e=>Object.assign(Object.assign({},ji(t,e.code,e.message,{start:a+e.start,end:a+e.end})),{measure:n+1})));s=i.pieces[i.pieces.length-1].duration}const n=()=>(s=e.duration,i.map(({text:i,offset:n},o)=>{const a=this.sourceContext;this.sourceContext={input:t,offset:n,measure:o+1};try{if(!this.parse(i,Object.assign(Object.assign({clef:this.defaults.clef,stem:this.defaults.stem},e),{duration:s})).success)throw new p("BadArguments",`Invalid EasyScore measure: ${i}`);return s=this.builder.rollingDuration,this.builder.getElements().notes}catch(e){const s=e instanceof _i?e.diagnostics:[ji(i,"ConstructionError",e instanceof Error?e.message:String(e),{start:0,end:i.length})];throw new _i(s.map(e=>Object.assign(Object.assign({},ji(t,e.code,e.message,{start:n+e.start,end:n+e.end})),{measure:o+1})))}finally{this.sourceContext=a}})),o={elements:this.builder.elements,options:this.builder.options,piece:this.builder.piece,rollingDuration:this.builder.rollingDuration};try{return this.transaction(n)}catch(t){throw Object.assign(this.builder,o),t}}splitMeasures(t){const e=[],i=[0];let s=0,n="";for(let o=0;o<t.length;o++){const a=t[o];n?a===n&&(n=""):'"'===a||"'"===a?n=a:"|"===a&&(e.push(t.slice(s,o)),s=o+1,i.push(s))}return e.push(t.slice(s)),e.map((s,n)=>{let o=s.trim();if(n>0&&(o=o.replace(/^,\s*/,"")),n<e.length-1&&(o=o.replace(/\s*,$/,"")),!o)throw new _i([Object.assign(Object.assign({},ji(t,"EmptyMeasure","Empty EasyScore measure. Use an explicit rest.",{start:i[n],end:i[n]+s.length})),{measure:n+1})]);return{text:o,offset:i[n]+s.indexOf(o)}})}voice(t,e={}){var i,s,n;const o="string"==typeof e.mode?{strict:ue.STRICT,soft:ue.SOFT,full:ue.FULL}[e.mode]:null!==(i=e.mode)&&void 0!==i?i:ue.STRICT;if(![ue.STRICT,ue.SOFT,ue.FULL].includes(o))throw new p("BadArguments","Invalid voice mode.");const a=null!==(s=e.softmaxFactor)&&void 0!==s?s:null===(n=e.options)||void 0===n?void 0:n.softmaxFactor;if(void 0!==a&&(!Number.isFinite(a)||a<=0))throw new p("BadArguments","softmaxFactor must be positive and finite.");if(this.options.strictOptions&&t.forEach(t=>this.requireOwned(t)),t.some(t=>t instanceof vt&&Bi.getGroup(t)))throw new p("BadArguments","Grouped notes cannot be inserted into a main voice.");return this.transaction(()=>{var i;const s=this.factory.Voice({time:null!==(i=e.time)&&void 0!==i?i:this.defaults.time});s.setMode(o),void 0!==a&&s.setSoftmaxFactor(a);const n=t.reduce((t,e)=>e.shouldIgnoreTicks()?t:t.add(e.getTicks()),new y(0,1));if(o!==ue.SOFT&&n.greaterThan(s.getTotalTicks()))throw new p("BadArguments","Too many ticks for this voice.");return this.references.add(s.addTickables(t))})}addCommitHook(t){this.builder.addCommitHook(t)}}function Ji(t,e){return new D(t.x-e,t.y-e,t.w+2*e,t.h+2*e)}function Zi(t){var e,i,s;if(!1===t.renderOptions.draw)return{parts:[],anchors:{}};null===(e=t.getBeam())||void 0===e||e.postFormat();const n=t.getHeadInk(),o={};n.forEach((e,i)=>{o[`head${i}`]={x:e.x+e.w/2,y:t.getYs()[i]}});const a=t.getStemSegment();if(a){const{x:t,baseY:e,tipY:i}=a;n.push(new D(t-at.WIDTH/2,Math.min(e,i),at.WIDTH,Math.abs(i-e))),o.stemBase={x:t,y:e},o.stemTip={x:t,y:i}}const r=t.getFlagInk();r&&n.push(r);const h=null!==(s=null!==(i=t.getLedgerLineStyle().lineWidth)&&void 0!==i?i:t.checkStave().getDefaultLedgerLineStyle().lineWidth)&&void 0!==s?s:1;for(const{x:e,y:i,width:s}of t.getLedgerLines())n.push(new D(e,i-h/2,s,h));if(t instanceof ei){const e=t.getSlash();e&&n.push(Ji((c=e.x1,l=e.y1,d=e.x2,u=e.y2,new D(Math.min(c,d),Math.min(l,u),Math.abs(d-c),Math.abs(u-l))),t.getFontScale()/2))}var c,l,d,u;return{parts:n,anchors:o}}function ts(t){return null!==t&&"object"==typeof t?t:{}}function es(t,e,i=!1){return"number"==typeof t&&Number.isFinite(t)&&(i?t>=0:t>0)&&t<=16?t:e}function is(t){if(Array.isArray(t)&&2===t.length&&t.every(t=>Number.isFinite(t)&&Math.abs(t)<=16))return Object.freeze([t[0],t[1]])}Qi.DEBUG=!1;class ss{static get names(){return{standard:"E/5,B/4,G/4,D/4,A/3,E/3",dagdad:"D/5,A/4,G/4,D/4,A/3,D/3",dropd:"E/5,B/4,G/4,D/4,A/3,D/3",eb:"Eb/5,Bb/4,Gb/4,Db/4,Ab/3,Db/3",standardBanjo:"D/5,B/4,G/4,D/4,G/5"}}constructor(t="E/5,B/4,G/4,D/4,A/3,E/3,B/2,E/2"){this.tuningValues=[],this.setTuning(t)}noteToInteger(t){var e;return null!==(e=$.keyProperties(t).intValue)&&void 0!==e?e:-1}setTuning(t){Object.prototype.hasOwnProperty.call(ss.names,t)&&(t=ss.names[t]),this.tuningValues=[];const e=t.split(",").map(t=>t.trim());if(0===e.length)throw new p("BadArguments",`Invalid tuning string: ${t}`);for(let t=0;t<e.length;++t)this.tuningValues[t]=this.noteToInteger(e[t])}getValueForString(t){const e=Number(t);if(e<1||e>this.tuningValues.length)throw new p("BadArguments",`String number must be between 1 and ${this.tuningValues.length}:${t}`);return this.tuningValues[e-1]}getValueForFret(t,e){const i=this.getValueForString(e),s=Number(t);if(s<0)throw new p("BadArguments",`Fret number must be 0 or higher: ${t}`);return i+s}getNoteForFret(t,e){const i=this.getValueForFret(t,e),s=Math.floor(i/12),n=i%12;return`${$.integerToNote(n)}/${s}`}}var ns=function(t,e,i,s){return new(i||(i=Promise))(function(n,o){function a(t){try{h(s.next(t))}catch(t){o(t)}}function r(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i(function(t){t(e)})).then(a,r)}h((s=s.apply(t,e||[])).next())})};class os{static loadFonts(...t){return ns(this,void 0,void 0,function*(){t||(t=Object.keys(A.FILES));const e=[];for(const i of t)e.push(A.load(i));yield Promise.all(e)})}static setFonts(...t){const e=t.flatMap(t=>t.split(",").map(t=>t.trim())).filter(Boolean);C.fontFamily=e.join(",");const i=e.filter(t=>A.TEXT_FONT_NAMES.includes(t));os.setTextFonts(...i.length?i:["Academico"])}static setTextFonts(...t){C.textFontFamily=[...new Set([...t,...os.getFonts()])].join(","),B.clear()}static getTextFonts(){return B.get("textFontFamily").split(",")}static getFonts(){return B.get("fontFamily").split(",")}static get RENDER_PRECISION_PLACES(){return $.RENDER_PRECISION_PLACES}static set RENDER_PRECISION_PLACES(t){$.RENDER_PRECISION_PLACES=t}static get SOFTMAX_FACTOR(){return $.SOFTMAX_FACTOR}static set SOFTMAX_FACTOR(t){$.SOFTMAX_FACTOR=t}static get UNISON(){return $.UNISON}static set UNISON(t){$.UNISON=t}static get NOTATION_FONT_SCALE(){return $.NOTATION_FONT_SCALE}static set NOTATION_FONT_SCALE(t){$.NOTATION_FONT_SCALE=t}static get TABLATURE_FONT_SCALE(){return $.TABLATURE_FONT_SCALE}static set TABLATURE_FONT_SCALE(t){$.TABLATURE_FONT_SCALE=t}static get RESOLUTION(){return $.RESOLUTION}static set RESOLUTION(t){$.RESOLUTION=t}static get SLASH_NOTEHEAD_WIDTH(){return $.SLASH_NOTEHEAD_WIDTH}static set SLASH_NOTEHEAD_WIDTH(t){$.SLASH_NOTEHEAD_WIDTH=t}static get STAVE_LINE_DISTANCE(){return $.STAVE_LINE_DISTANCE}static set STAVE_LINE_DISTANCE(t){$.STAVE_LINE_DISTANCE=t}static get STAVE_LINE_THICKNESS(){return C.Stave.lineWidth}static set STAVE_LINE_THICKNESS(t){C.Stave.lineWidth=t,C.TabStave.lineWidth=t,B.clear("Stave"),B.clear("TabStave")}static get STEM_HEIGHT(){return $.STEM_HEIGHT}static set STEM_HEIGHT(t){$.STEM_HEIGHT=t}static get STEM_WIDTH(){return $.STEM_WIDTH}static set STEM_WIDTH(t){$.STEM_WIDTH=t}static get TIME4_4(){return $.TIME4_4}static get unicode(){return $.unicode}static keySignature(t){return $.keySignature(t)}static hasKeySignature(t){return $.hasKeySignature(t)}static getKeySignatures(){return $.getKeySignatures()}static clefProperties(t){return $.clefProperties(t)}static keyProperties(t,e,i){return $.keyProperties(t,e,i)}static durationToTicks(t){return $.durationToTicks(t)}}os.BUILD={VERSION:"5.3.0",ID:"18f11424bdf291599683d063b18ded0dc840f0e0",DATE:"2026-11-18T16:43:59.349Z",INFO:""},os.measureEngraving=function(t,e={}){var i;const s=[],n=(t,e)=>{s.push({code:e,phase:"measure",severity:"LayoutOverflow"===e?"warning":"error",sourceId:t.getAttribute("id")})},o=function t(i){var s,o;const a={parts:[],anchors:{}},r=e=>{for(const i of e)a.parts.push(...t(i).parts)};try{const t=Object.getPrototypeOf(i).constructor,h=null===(s=e.extension)||void 0===s?void 0:s.call(e,i);if(h)Object.assign(a,h);else if(t===ce||t===ei){const t=i;Object.assign(a,Zi(t)),!1!==t.renderOptions.draw&&r(t.getModifiers())}else if(t===pe)r(i.getLayoutElements());else if(t===Tt){const t=i.getInkBounds();a.parts.push(t),a.anchors.center={x:t.x+t.w/2,y:t.y+t.h/2}}else if(t===ot||t===se)a.parts.push(i.getInkBounds());else if(t===yi||t===fe)a.parts.push(i.getBoundingBox());else if(t===Ft){const t=i;a.parts.push(t.getBoundingBox());for(const[e,i]of t.getNotes().entries())a.anchors[`stem${e}`]={x:i.getStemX(),y:i.getStemExtents().topY}}else if(t===ie){const t=i;a.parts.push(Ji(t.getBoundingBox(),(null!==(o=t.getStyle().lineWidth)&&void 0!==o?o:1)/2)),a.anchors=t.getAnchors()}else if(t===ct){const t=i,{x:e}=t.computeX(),{y:s}=t.computeY();a.parts.push(t.getTextInk(e,s)),a.anchors.baseline={x:e+t.getXShift(),y:s+t.getYShift()}}else t!==le||i.text?n(i,"UnsupportedGeometry"):a.parts.push(i.getRibbonBounds());const c=t=>[t.x,t.y,t.w,t.h].every(Number.isFinite)&&t.w>=0&&t.h>=0;if(!a.parts.every(c)||!Object.values(a.anchors).every(t=>Number.isFinite(t.x)&&Number.isFinite(t.y)))return n(i,"InvalidGeometry"),{parts:[],anchors:{}}}catch(t){if(!(t instanceof p))throw t;n(i,"UnformattedGeometry")}return a}(t),a=null!==(i=e.paddingPx)&&void 0!==i?i:0;if(!Number.isFinite(a)||a<0)throw new RangeError("Expected finite nonnegative layout padding.");let r;for(const t of o.parts){const e=new D(t.x,t.y,t.w,t.h);r=r?r.mergeWith(e):e}const h=r&&Ji(r,a);r&&t instanceof pe&&(o.anchors.left={x:r.x,y:t.checkAttachedNote().getYs()[t.checkIndex()]},o.anchors.right={x:r.x+r.w,y:o.anchors.left.y});const c=e.viewport;return c&&h&&(h.x<c.x||h.y<c.y||h.x+h.w>c.x+c.w||h.y+h.h>c.y+c.h)&&n(t,"LayoutOverflow"),Object.assign(Object.assign({},o),{ink:r,layout:h,diagnostics:s})},os.EngravingProfile=class{constructor(t){var e,i;if(!t.musicFont.trim())throw new RangeError("Expected a music font family.");this.musicFont=t.musicFont;const s=ts(t.metadata),n=s.fontName===this.musicFont?s:{};if(this.beamThickness=null!==(e=t.beamThickness)&&void 0!==e?e:es(ts(n.engravingDefaults).beamThickness,.5),this.clearance=null!==(i=t.clearance)&&void 0!==i?i:.25,!Number.isFinite(es(this.beamThickness,NaN))||!Number.isFinite(es(this.clearance,NaN,!0)))throw new RangeError("Invalid engraving distance in staff spaces.");const o={};for(const[t,e]of Object.entries(ts(n.glyphsWithAnchors))){if(!Object.prototype.hasOwnProperty.call(I,t))continue;o[I[t]]=Object.freeze({up:is(ts(e).stemUpSE),down:is(ts(e).stemDownNW)})}this.anchors=Object.freeze(o),Object.freeze(this)}stemAnchor(t,e){var i;return null===(i=this.anchors[t])||void 0===i?void 0:i[e]}},os.Accidental=ot,os.Annotation=ct,os.Articulation=Tt,os.Barline=Et,os.BarNote=Lt,os.Beam=Ft,os.Bend=Mt,os.BoundingBox=D,os.CanvasContext=Rt,os.ChordSymbol=Kt,os.Clef=Qt,os.ClefNote=Jt,os.Crescendo=te,os.Curve=ie,os.Dot=se,os.EasyScore=Qi,os.EasyScoreError=_i,os.Element=P,os.Factory=Bi,os.Font=A,os.Formatter=Qe,os.Fraction=y,os.FretHandFinger=ne,os.GhostNote=Ze,os.GlyphNote=ti,os.GraceNote=ei,os.GraceNoteGroup=pe,os.GraceTabNote=si,os.KeyManager=class{constructor(t){this.music=new H,this.setKey(t)}setKey(t){return this.key=t,this.reset(),this}getKey(){return this.key}reset(){this.keyParts=this.music.getKeyParts(this.key),this.keyString=this.keyParts.root,this.keyParts.accidental&&(this.keyString+=this.keyParts.accidental);if(!H.scaleTypes[this.keyParts.type])throw new p("BadArguments",`Unsupported key type: ${this.key}`);this.scale=this.music.getScaleTones(this.music.getNoteValue(this.keyString),H.scaleTypes[this.keyParts.type]),this.scaleMap={},this.scaleMapByValue={},this.originalScaleMapByValue={};const t=H.rootIndexes[this.keyParts.root];for(let e=0;e<H.roots.length;++e){const i=(t+e)%H.roots.length,s=H.roots[i],n=this.music.getRelativeNoteName(s,this.scale[e]);this.scaleMap[s]=n,this.scaleMapByValue[this.scale[e]]=n,this.originalScaleMapByValue[this.scale[e]]=n}return this}getAccidental(t){const e=this.music.getKeyParts(t).root,i=this.music.getNoteParts(this.scaleMap[e]);return{note:this.scaleMap[e],accidental:i.accidental}}selectNote(t){t=t.toLowerCase();const e=this.music.getNoteParts(t),i=this.scaleMap[e.root],s=this.music.getNoteParts(i);if(i===t)return{note:i,accidental:e.accidental,change:!1};const n=this.scaleMapByValue[this.music.getNoteValue(t)];if(void 0!==n)return{note:n,accidental:this.music.getNoteParts(n).accidental,change:!1};const o=this.originalScaleMapByValue[this.music.getNoteValue(t)];return void 0!==o?(this.scaleMap[s.root]=o,delete this.scaleMapByValue[this.music.getNoteValue(i)],this.scaleMapByValue[this.music.getNoteValue(t)]=o,{note:o,accidental:this.music.getNoteParts(o).accidental,change:!0}):s.root===t?(delete this.scaleMapByValue[this.music.getNoteValue(this.scaleMap[e.root])],this.scaleMapByValue[this.music.getNoteValue(s.root)]=s.root,this.scaleMap[s.root]=s.root,{note:s.root,accidental:void 0,change:!0}):(delete this.scaleMapByValue[this.music.getNoteValue(this.scaleMap[e.root])],this.scaleMapByValue[this.music.getNoteValue(t)]=t,delete this.scaleMap[s.root],this.scaleMap[s.root]=t,{note:t,accidental:e.accidental,change:!0})}},os.KeySignature=Pe,os.KeySigNote=ni,os.Modifier=W,os.ModifierContext=Oe,os.MultiMeasureRest=oi,os.Music=H,os.Note=vt,os.NoteHead=oe,os.NoteSubGroup=me,os.Ornament=fe,os.Parenthesis=Se,os.Parser=Gi,os.PedalMarking=ai,os.Registry=M,os.RenderContext=bt,os.Renderer=Ce,os.RepeatNote=hi,os.Repetition=Re,os.Stave=je,os.StaveConnector=$e,os.StaveHairpin=li,os.StaveLine=ui,os.StaveModifier=Dt,os.StaveNote=ce,os.StaveTempo=We,os.StaveText=Ve,os.StaveTie=le,os.Stem=at,os.StringNumber=De,os.Stroke=Ee,os.SVGContext=ve,os.System=gi,os.Sheet=ci,os.TabNote=ii,os.TabSlide=pi,os.TabStave=mi,os.TabTie=de,os.TextBracket=Si,os.TextDynamics=wi,os.TextNote=Ue,os.TickContext=Zt,os.TimeSignature=Xe,os.TimeSigNote=Ti,os.Tremolo=bi,os.Tuning=ss,os.Tuplet=yi,os.Vibrato=Le,os.VibratoBracket=vi,os.Voice=ge,os.Volta=Ye,os.RuntimeError=p,os.Test=void 0,os.AnnotationHorizontalJustify=rt,os.AnnotationVerticalJustify=ht,os.ChordSymbolHorizontalJustify=zt,os.ChordSymbolVerticalJustify=jt,os.SymbolModifiers=qt,os.CurvePosition=$t,os.FontWeight=E,os.FontStyle=L,os.Glyphs=I,os.ModifierPosition=R,os.RendererBackends=ke,os.RendererLineEndType=Be,os.BarlineType=Bt,os.RepeatBracketType=Ct,os.StaveModifierPosition=kt,os.VoltaType=Ge,os.TextBracketPosition=fi,os.TextJustification=He,os.VoiceMode=ue,os.BUILD.INFO="vexflow-core";const as=os;return e=e.default,e})());
|
|
6
6
|
//# sourceMappingURL=vexflow-core.js.map
|