/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/staffrender@1.2.4/dist/staffrender.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(t){var e={};function i(s){if(e[s])return e[s].exports;var n=e[s]={i:s,l:!1,exports:{}};return t[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(s,n,function(e){return t[e]}.bind(null,n));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=4)}([function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getBarLength=e.DEFAULT_TIME_SIGNATURE=e.DEFAULT_KEY_SIGNATURE=e.DEFAULT_TEMPO=void 0,e.DEFAULT_TEMPO={start:0,qpm:60},e.DEFAULT_KEY_SIGNATURE={start:0,key:0},e.DEFAULT_TIME_SIGNATURE={start:0,numerator:4,denominator:4},e.getBarLength=function(t){return 4*t.numerator/t.denominator}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BASS_CLEF=e.TREBLE_CLEF=e.KEY_ACCIDENTALS=e.SCALES=e.MAX_QUARTER_DIVISION=e.MIN_RESOLUTION=void 0,e.MIN_RESOLUTION=.0625,e.MAX_QUARTER_DIVISION=240,e.SCALES=[{steps:[0,0,-1,-1,-2,-3,-3,-4,-4,-5,-5,-6],accidental:[0,1,0,1,0,0,1,0,1,0,1,0]},{steps:[0,-1,-1,-2,-2,-3,-4,-4,-5,-5,-6,-6],accidental:[0,0,3,0,3,0,0,3,0,3,0,3]},{steps:[0,0,-1,-1,-2,-3,-3,-4,-4,-5,-5,-6],accidental:[3,0,0,1,0,3,0,0,1,0,1,0]},{steps:[0,-1,-1,-2,-2,-3,-4,-4,-5,-5,-6,-6],accidental:[0,2,0,0,3,0,2,0,0,3,0,3]},{steps:[0,0,-1,-1,-2,-3,-3,-4,-4,-5,-5,-6],accidental:[3,0,3,0,0,3,0,3,0,0,1,0]},{steps:[0,-1,-1,-2,-2,-3,-4,-4,-5,-5,-6,-6],accidental:[0,2,0,2,0,0,2,0,2,0,0,3]},{steps:[0,-1,-1,-2,-2,-3,-4,-4,-5,-5,-6,-7],accidental:[3,0,3,0,3,0,0,3,0,3,0,0]},{steps:[0,0,-1,-1,-2,-3,-3,-4,-4,-5,-5,-6],accidental:[0,1,0,1,0,3,0,0,1,0,1,0]},{steps:[0,-1,-1,-2,-2,-3,-4,-4,-5,-5,-6,-6],accidental:[0,0,3,0,3,0,2,0,0,3,0,3]},{steps:[0,0,-1,-1,-2,-3,-3,-4,-4,-5,-5,-6],accidental:[3,0,0,1,0,3,0,3,0,0,1,0]},{steps:[0,-1,-1,-2,-2,-3,-4,-4,-5,-5,-6,-6],accidental:[0,2,0,0,3,0,2,0,2,0,0,3]},{steps:[0,0,-1,-1,-2,-3,-3,-4,-4,-5,-5,-6],accidental:[3,0,3,0,0,3,0,3,0,3,0,0]}],e.KEY_ACCIDENTALS=[{accidental:1,pitches:[]},{accidental:2,pitches:[70,75,68,73,66]},{accidental:1,pitches:[78,73]},{accidental:2,pitches:[70,75,68]},{accidental:1,pitches:[78,73,80,75]},{accidental:2,pitches:[70]},{accidental:2,pitches:[70,75,68,73,66,71]},{accidental:1,pitches:[78]},{accidental:2,pitches:[70,75,68,73]},{accidental:1,pitches:[78,73,80]},{accidental:2,pitches:[70,75]},{accidental:1,pitches:[78,73,80,75,70]}],e.TREBLE_CLEF=71,e.BASS_CLEF=50},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getNoteDetails=e.StaffModel=e.KEY_ACCIDENTALS=void 0;var s=i(0),n=i(10),a=i(3),r=i(1);Object.defineProperty(e,"KEY_ACCIDENTALS",{enumerable:!0,get:function(){return r.KEY_ACCIDENTALS}});var o=function(){function t(t,e){this.staffInfo=null,this.clef=function(t){var e=0,i=0;return t.notes.forEach((function(t){e+=t.pitch,++i})),e/i<60?r.BASS_CLEF:r.TREBLE_CLEF}(t),this.staffBlockMap=null,this.update(t,e)}return t.prototype.update=function(t,e){var i=this;t.notes.sort((function(t,e){return t.start-e.start})),this.lastQ=0,t.notes.forEach((function(t){t.start+t.length>i.lastQ&&(i.lastQ=t.start+t.length)})),t.tempos&&t.tempos.length?t.tempos.sort((function(t,e){return t.start-e.start})):t.tempos=[s.DEFAULT_TEMPO],0!==t.tempos[0].start&&(t.tempos=[s.DEFAULT_TEMPO].concat(t.tempos));var a=e?{start:0,key:e}:s.DEFAULT_KEY_SIGNATURE;t.keySignatures&&t.keySignatures.length?t.keySignatures.sort((function(t,e){return t.start-e.start})):t.keySignatures=[a],0!==t.keySignatures[0].start&&(t.keySignatures=[a].concat(t.keySignatures)),t.timeSignatures&&t.timeSignatures.length?t.timeSignatures.sort((function(t,e){return t.start-e.start})):t.timeSignatures=[s.DEFAULT_TIME_SIGNATURE],0!==t.timeSignatures[0].start&&(t.timeSignatures=[s.DEFAULT_TIME_SIGNATURE].concat(t.timeSignatures)),this.barsInfo=new n.BarsInfo(t,this.lastQ),this.infoToBlocks(t)},t.prototype.infoToBlocks=function(t){var e=this;if(null===this.staffBlockMap||t.notes.length!==this.staffInfo.notes.length||t.tempos.length!==this.staffInfo.tempos.length||t.keySignatures.length!==this.staffInfo.keySignatures.length||t.timeSignatures.length!==this.staffInfo.timeSignatures.length){this.staffInfo=t;var i=new Map,s={},n=0,r=null;for(this.staffInfo.notes.forEach((function(t){var o=function(t){return{start:t.start,length:t.length,pitch:t.pitch,intensity:t.intensity,vSteps:0,accidental:0}}(t),l=e.barsInfo.barNumberAtQ(o.start),u=Math.trunc(l);u>n&&(n=u,s={});var c=e.barsInfo.keySignatureAtQ(o.start);if(function(t,e,i,s){var n=h(t.pitch,i,s);n.vSteps in e?n.accidental===e[n.vSteps]?n.accidental=0:(3===e[n.vSteps]?n.accidental=n.keyAccidental:0===n.accidental&&(n.accidental=3),e[n.vSteps]=n.accidental):(t.tiedFrom&&(n.accidental=0),e[n.vSteps]=n.accidental);t.vSteps=n.vSteps,t.accidental=n.accidental}(o,s,e.clef,c),r||(0!==o.start&&(r=new a.StaffBlock(0,o.start,[],l)).mergeToMap(i),r=new a.StaffBlock),0===r.notes.length||r.start===o.start)r.addNote(o);else{for(var f=r.start+r.length;r.notes.length&&r.notes[0].start<o.start;){var d=Math.min(o.start,r.start+r.notes[0].length),S=r.split(d,e.barsInfo);r.mergeToMap(i),S||(S=new a.StaffBlock),r=S}if(r.length)r.addNote(o);else{if(f!==o.start)new a.StaffBlock(f,o.start-f,[],e.barsInfo.barNumberAtQ(f)).mergeToMap(i);r=new a.StaffBlock(o.start,o.length,[o],l,o.vSteps,o.vSteps)}}}));r.notes.length&&r.notes[0].start<Number.MAX_VALUE;){var o=r.start+r.notes[0].length,l=r.split(o,this.barsInfo);r.mergeToMap(i),l||(l=new a.StaffBlock),r=l}this.lastQ=r.start+r.length,this.staffBlockMap=new Map;var u=null;i.forEach((function(t){var i=null;do{i=t.splitToBeat(e.barsInfo);var s=!t.beatBegin&&t.beatEnd,n=null;do{n=t.splitToSymbols(e.barsInfo,s),t.setBeaming(u,e.barsInfo),t.mergeToMap(e.staffBlockMap),n&&(u=t,t=n)}while(n);i&&(u=t,t=i)}while(i)}))}return this.staffBlockMap},t}();function h(t,e,i){var s=t-60,n=Math.floor(s/12),a=s-12*n,o=r.SCALES[i].steps[a],h=71===e?6:-6,l=1===r.KEY_ACCIDENTALS[i].accidental?69+(a+3)%12:64+(a+8)%12;return{vSteps:h-7*n+o,accidental:r.SCALES[i].accidental[a],keyAccidental:r.KEY_ACCIDENTALS[i].pitches.indexOf(l)>-1?r.KEY_ACCIDENTALS[i].accidental:0}}e.StaffModel=o,e.getNoteDetails=h},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.StaffBlock=e.splitStaffNote=void 0;var s=i(1);function n(t,e){var i=t.start+t.length-e,s=null;return e>t.start&&i>0&&(t.length-=i,s={start:e,length:i,pitch:t.pitch,intensity:t.intensity,vSteps:t.vSteps,accidental:t.accidental,tiedFrom:t},t.tiedTo&&(s.tiedTo=t.tiedTo,t.tiedTo.tiedFrom=s),t.tiedTo=s),s}e.splitStaffNote=n;var a=function(){function t(t,e,i,s,n,a){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=[]),void 0===s&&(s=0),void 0===n&&(n=Number.MAX_SAFE_INTEGER),void 0===a&&(a=Number.MIN_SAFE_INTEGER),this.start=t,this.length=e,this.headIndex=0,this.notes=i,this.barNumber=s,this.maxVStep=n,this.minVStep=a}return t.prototype.addNote=function(t){var e=!1,i=this.notes.length,s=-1;0===this.notes.length&&(this.start=t.start);for(var n=0;-1===s&&n<this.notes.length;++n)i===this.notes.length&&t.length<this.notes[n].length&&(i=n),t.pitch===this.notes[n].pitch&&(t.length<this.notes[n].length?s=n:e=!0);return e||(this.notes.splice(i,0,t),this.minVStep=Math.max(t.vSteps,this.minVStep),this.maxVStep=Math.min(t.vSteps,this.maxVStep),s>=0&&(s+=s>=i?1:0,this.notes[s].tiedFrom&&(t.tiedFrom=this.notes[s].tiedFrom,t.tiedFrom.tiedTo=this.notes[i]),this.notes.splice(s,1))),this.length=this.notes[this.notes.length-1].length,!e},t.prototype.split=function(e,i){var s=this.start+this.length-e,a=null;return e>this.start&&s>0&&(a=new t(e,s,[],i.barNumberAtQ(e)),this.length-=s,this.notes.forEach((function(t){var i=n(t,e);i&&a.addNote(i)}))),a&&this.beatEnd&&(a.beatEnd=!0,this.beatEnd=!1),a},t.prototype.splitToBeat=function(t){var e=t.timeSignatureAtQ(this.start),i=t.barLenghtAtQ(this.start),s=this.barNumber-Math.floor(this.barNumber),n=Math.round(i*s*1e6)/1e6,a=this.start-n,o=4/e.denominator,h=n/o,l=Math.ceil(h),u=null;if(r(l-h)){this.beatBegin=!0;var c=Math.round(1e6*(a+e.numerator*o))/1e6;u=this.split(c,t),r(this.start+this.length-c)&&(this.beatEnd=!0)}else{var f=Math.round(1e6*(a+l*o))/1e6;u=this.split(f,t),r(this.start+this.length-f)&&(this.beatEnd=!0)}return u&&(this.beatEnd=!0),u},t.prototype.splitToSymbols=function(t,e){var i=null;if(this.length>=s.MIN_RESOLUTION)this.notes.length||this.length!==t.barLenghtAtQ(this.start)?i=e?this.splitShorter(t):this.splitLonger(t):this.headIndex=4;else{var n=r(this.length)?"[infinite]":""+4/this.length;console.warn("%cStaffRender:","background:orange; color:white","StaffRender does not handle notes shorther than 1/"+4/s.MIN_RESOLUTION+"th, and this score tries to draw a 1/"+n+"th. Shortest possible note will be drawn instead."),this.headIndex=s.MIN_RESOLUTION,i=null}return i},t.prototype.splitShorter=function(t){for(var e=this.length,i=0,s=0,n=0,a=4;!r(e);a/=2)r(e-3*a/2)&&(t.allowDottedRests||this.notes.length)?(e-=3*a/2,i=3*a/2,s=a,n=1):e>=a?(e-=a,i=a,s=a):r(e-4*a/5)?(e-=4*a/5,i=4*a/5,s=a,n=5):r(e-2*a/3)&&(e-=2*a/3,i=2*a/3,s=a,n=3);var o=this.split(this.start+i,t);return this.headIndex=s,this.headAlteration=n,o},t.prototype.splitLonger=function(t){for(var e=null,i=4;!this.headIndex;i/=2)r(this.length-3*i/2)&&(t.allowDottedRests||this.notes.length)?(e=this.split(this.start+3*i/2,t),this.headIndex=i,this.headAlteration=1):this.length>=i?(e=this.split(this.start+i,t),this.headIndex=i):r(this.length-4*i/5)?(e=this.split(this.start+4*i/5,t),this.headIndex=i,this.headAlteration=5):r(this.length-2*i/3)&&(e=this.split(this.start+2*i/3,t),this.headIndex=i,this.headAlteration=3);return e},t.prototype.mergeToMap=function(t){var e=t.get(this.start);void 0!==e?this.notes.forEach((function(t){return e.addNote(t)})):t.set(this.start,this)},t.prototype.isBarBeginning=function(){return this.barNumber-Math.trunc(this.barNumber)==0},t.prototype.setBeaming=function(t,e){},t}();function r(t){return 0===Math.round(1e6*t)}e.StaffBlock=a},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var s=i(5);window.sr=s},function(t,e,i){"use strict";var s=this&&this.__createBinding||(Object.create?function(t,e,i,s){void 0===s&&(s=i),Object.defineProperty(t,s,{enumerable:!0,get:function(){return e[i]}})}:function(t,e,i,s){void 0===s&&(s=i),t[s]=e[i]}),n=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||e.hasOwnProperty(i)||s(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),n(i(6),e),n(i(2),e),n(i(3),e),n(i(0),e)},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.StaffSVGRender=e.ScrollType=e.MAX_QUARTER_DIVISION=void 0;var s,n=i(7),a=i(8),r=i(9),o=i(0),h=i(2);e.MAX_QUARTER_DIVISION=16,function(t){t[t.PAGE=0]="PAGE",t[t.NOTE=1]="NOTE",t[t.BAR=2]="BAR"}(s=e.ScrollType||(e.ScrollType={}));var l=function(){function t(t,e,i){var a=this;this.handleScrollEvent=function(t){a.lastKnownScrollLeft=a.parentElement.scrollLeft,a.ticking||window.requestAnimationFrame((function(){a.changeAndDrawSignaturesIfNeeded(a.lastKnownScrollLeft),a.ticking=!1})),a.ticking=!0},this.staffInfo=t;this.config={noteHeight:e.noteHeight||6,noteSpacing:e.noteSpacing||1,pixelsPerTimeStep:e.pixelsPerTimeStep||30,noteRGB:e.noteRGB||"8, 41, 64",activeNoteRGB:e.activeNoteRGB||"240, 84, 119"},this.div=i,this.scrollType=e.scrollType||s.PAGE,this.scale=this.config.noteHeight/r.PATH_SCALE,(void 0===e.pixelsPerTimeStep||e.pixelsPerTimeStep<=0)&&(this.config.pixelsPerTimeStep=0,this.config.noteSpacing=n.COMPACT_SPACING*this.scale),this.staffModel=new h.StaffModel(this.staffInfo,e.defaultKey),this.currentKey=this.staffModel.barsInfo.keySignatureAtQ(0),this.currentTimeSignature=this.staffModel.barsInfo.timeSignatureAtQ(0),this.clear(),this.redraw()}return t.prototype.clear=function(){for(;this.div.lastChild;)this.div.removeChild(this.div.lastChild);this.div.style.overflow="visible",this.div.style.position="relative",this.overlaySVG=document.createElementNS(a.SVGNS,"svg"),this.overlaySVG.style.position="absolute",this.div.appendChild(this.overlaySVG),this.overlayG=a.createSVGGroupChild(this.overlaySVG,"overlay"),this.signaturesBlinking=!1,this.signaturesQuarters=0,this.parentElement=document.createElement("div"),this.parentElement.style.overflow="auto",this.div.appendChild(this.parentElement),this.ticking=!1,this.lastKnownScrollLeft=0,this.parentElement.addEventListener("scroll",this.handleScrollEvent),this.staffSVG=document.createElementNS(a.SVGNS,"svg"),this.parentElement.appendChild(this.staffSVG),this.staffG=a.createSVGGroupChild(this.staffSVG,"staff"),this.linesG=a.createSVGGroupChild(this.staffSVG,"lines"),a.setStroke(this.linesG,n.LINE_STROKE,this.getColor()),this.staffG.appendChild(this.linesG),this.musicG=a.createSVGGroupChild(this.staffSVG,"music"),a.setFill(this.musicG,this.getColor()),a.setStroke(this.musicG,0,this.getColor()),this.staffG.appendChild(this.musicG),this.signaturesG=a.createSVGGroupChild(this.staffSVG,"signatures"),this.staffG.appendChild(this.signaturesG),this.signaturesList=[{x:0,q:0}],this.signatureCurrent=0,this.signatureNext=0,this.changeKeySignatureIfNeeded(0),this.changeTimeSignatureIfNeeded(0),this.vStepSize=this.config.noteHeight/2,this.hStepSize=this.config.pixelsPerTimeStep,this.staffOffset=0,this.height=0,this.width=0,this.playingNotes=[],this.lastBar=0,this.lastQ=-1},t.prototype.redraw=function(t,e){var i=this,n=-1,r=0===this.config.pixelsPerTimeStep;if(t){var o=[];this.playingNotes.forEach((function(e){i.isPaintingActiveNote(e,t)?o.push(e):a.highlightElement(i.getGroup(e),i.getColor(!1))})),this.playingNotes=o;var h=this.getGroup(t);if(h){this.playingNotes.push(t),a.highlightElement(h,this.getColor(!0)),n=h.getBoundingClientRect().left-this.staffSVG.getBoundingClientRect().left;var l=t.start,u=h.getAttribute("data-is-bar-beginning");(this.scrollType!==s.BAR||u)&&this.scrollIntoViewIfNeeded(e,n),!r&&this.signaturesBlinking&&l>=this.signaturesQuarters&&(this.signaturesBlinking=!1,a.setFade(this.overlayG,this.signaturesBlinking))}}else{var c=-1===this.lastQ;this.staffModel.update(this.staffInfo,this.config.defaultKey);var f=0,d=0;c?(d=this.drawSignatures(this.overlayG,f,!0,!0,!0),r&&(this.width=0,d+=this.config.noteSpacing)):f=this.width;var S=new Map;this.staffModel.staffBlockMap.forEach((function(t,e){r||(f=i.staffModel.barsInfo.quartersToTime(e)*i.hStepSize),e>i.lastQ&&(d+=i.drawStaffBlock(t,f+d,S),i.lastQ=e)}));var p=this.staffSVG.getBoundingClientRect(),g=this.musicG.getBoundingClientRect();if(this.updateVerticalBoundaries(g.top-p.top,g.bottom-p.top),r)this.width+=d;else{var v=this.staffModel.staffBlockMap.get(this.lastQ),m=this.staffModel.barsInfo.quartersToTime(this.lastQ+v.length);this.width=m*this.config.pixelsPerTimeStep}this.staffSVG.setAttributeNS(null,"width",""+this.width),this.redrawStaffLines(this.linesG,0,this.width)}return n},t.prototype.isPaintingActiveNote=function(t,e){var i=t.start===e.start,s=t.start<=e.start&&t.start+t.length>=e.start+e.length;return i||s},t.prototype.drawStaffBlock=function(t,e,i){var s=t.start,n=this.drawBarIfNeeded(s,e);return n+=this.drawSignaturesIfNeeded(s,e+n),t.notes.length?n+=this.drawNotes(t,e+n,i):n+=this.drawRests(t,e+n),n},t.prototype.drawNotes=function(t,e,i){var s,o=this,h=0,l=r.NOTE_PATHS[t.headIndex];if(l.stemAnchor&&(s=a.createSVGGroupChild(this.musicG,"stem")),t.notes.forEach((function(s){for(var n=o.getOpacity(s.intensity),u=s.vSteps*o.vStepSize,c=2*(s.vSteps>0?Math.floor(s.vSteps/2):Math.ceil(s.vSteps/2)),f=s.vSteps>0?-2:2,d=c;Math.abs(d)>4;d+=f)a.drawSVGPath(o.linesG,r.extraLinePath,e+h,d*o.vStepSize,o.scale,1);var S=null;s.tiedFrom&&((S=i.get(s.tiedFrom))||console.warn("%cStaffRender:","background:orange; color:white","Wrong linkage at q = "+s.start));var p=S?S.g:a.createSVGGroupChild(o.musicG,s.start+"-"+s.pitch);if(t.isBarBeginning()&&p.setAttribute("data-is-bar-beginning","true"),s.tiedFrom&&S){var g=e+h-i.get(s.tiedFrom).xHeadRight;a.drawSVGPath(p,r.tiePath,i.get(s.tiedFrom).xHeadRight,u,g/r.PATH_SCALE,o.scale*(s.vSteps<0?-1:1),n)}a.drawSVGPath(p,l.path,e+h,u,o.scale,o.scale,n);var v=e+h+l.width*o.scale;1===t.headAlteration&&a.drawSVGPath(p,r.dotPath,e+h+l.width*o.scale+o.vStepSize/2,u-o.vStepSize/2,o.scale,o.scale,n),0!==s.accidental&&a.drawSVGPath(p,r.ACCIDENTAL_PATHS[s.accidental],e+h,u,o.scale,o.scale,n),s.tiedTo&&i.set(s,{g:p,xHeadRight:v})})),l.stemAnchor){var u=e+h,c=void 0,f=void 0,d=l.stemAnchor*this.scale,S=t.minVStep+t.maxVStep<0,p=l.flags>2?2*(l.flags-2):0;if(S?(c=t.maxVStep*this.vStepSize-d,f=(t.minVStep+7+p)*this.vStepSize):(u+=(l.width-n.STEM_WIDTH)*this.scale,c=t.minVStep*this.vStepSize+d,f=(t.maxVStep-7-p)*this.vStepSize),a.drawSVGPath(s,r.stemPath,u,c,this.scale,(f-c)/r.PATH_SCALE),1===l.flags)a.drawSVGPath(s,r.singleFlagPath,u,f,this.scale,this.scale*(S?-1:1),1);else if(l.flags>1)for(var g=0;g<l.flags;++g)a.drawSVGPath(s,r.multiFlagPath,u,f,this.scale,this.scale*(S?-1:1),1),f+=(S?-2:2)*this.vStepSize}return 0===this.config.pixelsPerTimeStep&&(h+=l.width*this.scale,s&&(h+=s.getBoundingClientRect().width),h+=this.config.noteSpacing),h},t.prototype.drawRests=function(t,e){var i=0,s=a.drawSVGPath(this.musicG,r.REST_PATHS[t.headIndex],e+i,0,this.scale,this.scale);return this.config.pixelsPerTimeStep>0?e+=this.staffModel.barsInfo.quartersToTime(t.headIndex)*this.hStepSize:(i+=s.getBoundingClientRect().width,i+=this.config.noteSpacing),i},t.prototype.redrawStaffLines=function(t,e,i){var s=t.querySelector('g[data-id="staff-five-lines"]');if(s)s.setAttributeNS(null,"transform","scale("+i/r.PATH_SCALE+", 1)");else{s=a.createSVGGroupChild(t,"staff-five-lines");for(var n=-4;n<=4;n+=2)a.drawSVGPath(s,r.staffLinePath,e,0+n*this.vStepSize,i/r.PATH_SCALE,1)}return s},t.prototype.drawBarIfNeeded=function(t,e){var i=0;if(0!==t){var s=this.lastBar+o.getBarLength(this.currentTimeSignature);t>=s&&(this.config.pixelsPerTimeStep>0?e-=this.config.noteSpacing:i=this.config.noteSpacing,a.drawSVGPath(this.linesG,r.barPath,e,0,1,this.scale),this.lastBar=s)}return i},t.prototype.clearSignatureOverlay=function(){for(;this.overlayG.lastChild;)this.overlayG.removeChild(this.overlayG.lastChild)},t.prototype.drawSignaturesIfNeeded=function(t,e){var i=0;if(0!==t){var s=this.changeKeySignatureIfNeeded(t),r=this.changeTimeSignatureIfNeeded(t);if(s||r){var o=n.COMPACT_SPACING*this.scale*(this.config.pixelsPerTimeStep>0?3:2);this.signaturesList.push({x:e-o,q:t}),null===this.signatureNext&&(this.signatureNext=e);var h=t>0?a.createSVGGroupChild(this.signaturesG,"signatures"):this.overlayG;i+=this.drawSignatures(h,e+i,!1,s,r)}}return 0===this.config.pixelsPerTimeStep?i:0},t.prototype.drawSignatures=function(t,e,i,s,o){var l,u=this,c=n.COMPACT_SPACING*this.scale,f=c,d=t===this.overlayG||this.config.pixelsPerTimeStep>0;if(d){(l=document.createElementNS(a.SVGNS,"rect")).setAttributeNS(null,"x",""+e),l.setAttributeNS(null,"y","0"),l.setAttributeNS(null,"width","1"),l.setAttributeNS(null,"height","1"),l.setAttribute("data-id","background"),t.appendChild(l);var S=document.defaultView.getComputedStyle(this.div.parentElement);l.setAttributeNS(null,"fill",S.getPropertyValue("background-color"))}if(i){var p=a.drawSVGPath(t,r.CLEF_PATHS[this.staffModel.clef],e+f,0,this.scale,this.scale);a.setFill(p,this.getColor()),f+=3*c}if(s){var g=h.KEY_ACCIDENTALS[this.currentKey].accidental,v=71===this.staffModel.clef?0:14;h.KEY_ACCIDENTALS[this.currentKey].pitches.forEach((function(i){var s=h.getNoteDetails(i,u.staffModel.clef,u.currentKey).vSteps,n=a.drawSVGPath(t,r.ACCIDENTAL_PATHS[g],e+f,(v+s)*u.vStepSize,u.scale,u.scale);a.setFill(n,u.getColor()),f+=n.getBoundingClientRect().width}))}if(o){var m=a.createSVGGroupChild(t,"time-key"),A=2.85*this.config.noteHeight+"px";a.drawSVGText(m,""+this.currentTimeSignature.numerator,e+f,-.5,A,!0),a.drawSVGText(m,""+this.currentTimeSignature.denominator,e+f,4*this.vStepSize-.5,A,!0),a.setFill(m,this.getColor()),f+=m.getBoundingClientRect().width+c}var T=this.redrawStaffLines(t,e,f);a.setStroke(T,n.LINE_STROKE,this.getColor());var E=this.div.getBoundingClientRect(),N=t.getBoundingClientRect();if(this.updateVerticalBoundaries(N.top-E.top,N.bottom-E.top),d&&(l.setAttributeNS(null,"y",""+-this.staffOffset),l.setAttributeNS(null,"height",""+this.height),l.setAttributeNS(null,"width",""+f)),t===this.overlayG){this.overlaySVG.setAttributeNS(null,"width",""+(f+5));for(var b=0;b<5;++b){var y=a.drawSVGPath(t,r.stemPath,f+b,b*b-this.staffOffset,1/n.STEM_WIDTH,(this.height-2*b*b)/r.PATH_SCALE,(b-5)*(b-5)*2/r.PATH_SCALE);a.setFill(y,this.getColor())}}if(this.config.pixelsPerTimeStep>0){var C=0===this.signaturesQuarters;return C&&(this.signaturesQuarters=this.staffModel.barsInfo.timeToQuarters(f/this.hStepSize)),(C||e>0)&&(this.signaturesBlinking=!0,a.setFade(t,this.signaturesBlinking)),0}return f},t.prototype.changeKeySignatureIfNeeded=function(t){var e=this.staffModel.barsInfo.keySignatureAtQ(t,!0);return e>=0&&(this.currentKey=e,!0)},t.prototype.changeTimeSignatureIfNeeded=function(t){var e=this.staffModel.barsInfo.timeSignatureAtQ(t,!0);return!!e&&(this.currentTimeSignature=e,!0)},t.prototype.changeAndDrawSignaturesIfNeeded=function(t){var e;if(t<this.signatureCurrent||null!==this.signatureNext&&this.signatureNext<=t){e=this.signaturesList[0].q,this.signatureNext=null;for(var i=0;i<this.signaturesList.length;++i){if(t<this.signaturesList[i].x){this.signatureNext=this.signaturesList[i].x;break}this.signatureCurrent=this.signaturesList[i].x,e=this.signaturesList[i].q}}if(void 0!==e){var s=this.currentKey,n=this.currentTimeSignature;this.changeKeySignatureIfNeeded(e),this.changeTimeSignatureIfNeeded(e),this.clearSignatureOverlay(),this.drawSignatures(this.overlayG,0,!0,!0,!0),this.currentKey=s,this.currentTimeSignature=n}this.config.pixelsPerTimeStep>0&&0===t&&(this.signatureNext=0,this.signaturesBlinking=!0,a.setFade(this.overlayG,this.signaturesBlinking))},t.prototype.scrollIntoViewIfNeeded=function(t,e){if(t)if(this.scrollType===s.PAGE){var i=this.parentElement.getBoundingClientRect().width;e>this.parentElement.scrollLeft+i&&(this.parentElement.scrollLeft=e-20)}else{i=this.parentElement.getBoundingClientRect().width;this.parentElement.scrollLeft=e-.5*i}},t.prototype.updateVerticalBoundaries=function(t,e){var i=0;if(t<0){this.staffOffset-=t;var s="translate(0, "+this.staffOffset+")";this.overlayG.setAttributeNS(null,"transform",s),this.staffG.setAttributeNS(null,"transform",s),i=this.height-t}if((i=Math.max(i,e-t))>this.height){this.height=i,this.overlaySVG.setAttributeNS(null,"height",""+this.height),this.staffSVG.setAttributeNS(null,"height",""+this.height);for(var n=this.div.querySelectorAll('rect[data-id="background"]'),a=0;a<n.length;++a){var r=n[a];r.setAttributeNS(null,"y",""+-this.staffOffset),r.setAttributeNS(null,"height",""+this.height)}}},t.prototype.getColor=function(t){return void 0===t&&(t=!1),"rgb("+(t?this.config.activeNoteRGB:this.config.noteRGB)+")"},t.prototype.getOpacity=function(t){return t?t/127*.8+.2:1},t.prototype.getGroup=function(t){var e=t.start,i=t.pitch;return this.staffSVG.querySelector('g[data-id="'+e+"-"+i+'"]')},t}();e.StaffSVGRender=l},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.COMPACT_SPACING=e.LINE_STROKE=e.STEM_WIDTH=void 0,e.STEM_WIDTH=15,e.LINE_STROKE=1,e.COMPACT_SPACING=150},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.highlightElement=e.setStroke=e.setFill=e.setFade=e.createSVGGroupChild=e.drawSVGText=e.drawSVGPath=e.SVGNS=void 0,e.SVGNS="http://www.w3.org/2000/svg",e.drawSVGPath=function(t,i,s,n,a,r,o){void 0===o&&(o=1);var h=document.createElementNS(e.SVGNS,"path");return h.setAttributeNS(null,"d",i),h.setAttributeNS(null,"transform","translate("+s+", "+n+") scale("+a+", "+r+")"),h.setAttributeNS(null,"opacity",""+o),t.appendChild(h),h},e.drawSVGText=function(t,i,s,n,a,r,o,h){void 0===r&&(r=!1),void 0===o&&(o=1),void 0===h&&(h=1);var l=document.createElementNS(e.SVGNS,"text");l.setAttributeNS(null,"font-family","Times"),l.setAttributeNS(null,"font-size",a),r&&l.setAttributeNS(null,"font-weight","bold"),l.setAttributeNS(null,"transform","translate("+s+", "+n+") scale("+o+", "+h+")");var u=document.createTextNode(i);return l.appendChild(u),t.appendChild(l),l},e.createSVGGroupChild=function(t,i){var s=document.createElementNS(e.SVGNS,"g");return s.setAttribute("data-id",i),t.appendChild(s),s},e.setFade=function(t,i,s,n){void 0===i&&(i=!1),void 0===s&&(s=1),void 0===n&&(n=0);var a=t.querySelector("animate");if(!a){(a=document.createElementNS(e.SVGNS,"animate")).setAttributeNS(null,"attributeName","opacity"),a.setAttributeNS(null,"dur","4s"),a.setAttributeNS(null,"fill","freeze"),a.setAttributeNS(null,"keyTimes","0; 0.25; 0.5; 0.75; 1");var r=(s+3*n)/4;a.setAttributeNS(null,"values",s+"; "+r+"; "+n+"; "+r+"; "+s)}return i?a.setAttributeNS(null,"repeatCount","indefinite"):a.setAttributeNS(null,"repeatCount","1"),t.appendChild(a),t},e.setFill=function(t,e){t.setAttributeNS(null,"fill",e)},e.setStroke=function(t,e,i){t.setAttributeNS(null,"stroke-width",""+e),t.setAttributeNS(null,"stroke",i)},e.highlightElement=function(t,e){t.setAttribute("fill",e),t.setAttribute("stroke",e)}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ACCIDENTAL_PATHS=e.CLEF_PATHS=e.REST_PATHS=e.NOTE_PATHS=e.dotPath=e.tiePath=e.multiFlagPath=e.singleFlagPath=e.stemPath=e.barPath=e.extraLinePath=e.staffLinePath=e.PATH_SCALE=void 0,e.PATH_SCALE=100;var s="M 0,10 C 0,-15 35,-50 80,-50 110,-50 125,-35 125,-10 \n125,15 90,50 45,50 15,50 0,35 0,10 Z";e.staffLinePath="m 0,0 h 100",e.extraLinePath="m -25,0 h 175",e.barPath="m 0,-200 v 400",e.stemPath="m 0,0 v 100 h 15 v -100 z",e.singleFlagPath="M0,0 h 12 c 7,100 175,156 62,314 79,-177 -49,\n-193 -61,-200 l -13,-5 z",e.multiFlagPath="m 0,0 h 10 c 6,72 173,64 84,227 44,-120 -44,\n-123 -94,-167 z",e.tiePath="M 0,25 C 10,46 30,67 50,67 69,67 90,47 100,25 94,\n65 73,89 50,89 26,89 5,63 0,25 Z",e.dotPath="M 5 -20 a 20 20 0 1 0 0.00001 0 z",e.NOTE_PATHS={4:{path:"m 0,0 c 0,-37 49,-51 79,-51 31,0 83,13 83,51 0,39 \n-55,51 -84,51 C 49,51 0,37 0,0 Z m 111,31 c 13,-19 0,-58 -22,-68 -33,-15 \n-53,10 -39,49 9,27 48,39 61,19 z",width:150,stemVSteps:0,stemAnchor:0,flags:0},2:{path:"m 0,10 c 0,-25 35,-60 80,-60 15,0 45,4 45,40 C 125,16 \n89,50 45,50 17,50 0,36 0,10 Z m 71,7 c 17,-11 45,-34 38,-45 -7,-10 -39,1 \n-57,12 -19,11 -42,31 -36,42 6,10 37,2 55,-9 z",width:125,stemVSteps:7,stemAnchor:-10,flags:0},1:{path:s,width:125,stemVSteps:7,stemAnchor:-10,flags:0},.5:{path:s,width:125,stemVSteps:7,stemAnchor:-10,flags:1},.25:{path:s,width:125,stemVSteps:9,stemAnchor:-10,flags:2},.125:{path:s,width:125,stemVSteps:11,stemAnchor:-10,flags:3},.0625:{path:s,width:125,stemVSteps:13,stemAnchor:-10,flags:4}},e.REST_PATHS={4:"m 0,-50 h 125 v -50 H 0 Z",2:"M 0,0 H 125 V -50 H 0 Z",1:"m 0,-25 c 39,-39 37,-75 8,-120 l 6,-5 61,103 C \n40,-13 31,4 73,71 l -5,5 C 14,52 16,125 67,144 l -4,6 C -37,102 -1,22 59,60 Z",.5:"m 52,-47 c 26,-2 42,-21 48,-42 l 12,4 L 64,83 52,79 \n88,-49 c 0,0 -17,22 -57,22 -16,0 -31,-13 -31,-27 0,-18 10,-31 27,-31 17,0 \n33,15 25,38 z",.25:"m 129,-191 c -6,21 -22,40 -48,42 8,-23 -8,-38 \n-25,-38 -17,0 -27,13 -27,31 0,14 15,27 31,27 40,0 57,-22 57,-22 l -20,69 \nc -7,18 -22,33 -45,35 8,-23 -8,-38 -25,-38 -17,0 -27,13 -27,31 0,14 15,27 \n31,27 40,0 57,-22 57,-22 l -36,128 12,4 77,-270 z",.125:"m 129,-191 c -6,21 -22,40 -48,42 8,-23 -8,-38 \n-25,-38 -17,0 -27,13 -27,31 0,14 15,27 31,27 40,0 57,-22 57,-22 l -20,69 \nc -7,18 -22,33 -45,35 8,-23 -8,-38 -25,-38 -17,0 -27,13 -27,31 0,14 15,27 \n31,27 40,0 57,-22 57,-22 L 68,20 C 61,37 46,51 24,52 32,29 16,14 -1,14 c \n-17,0 -27,13 -27,31 0,14 15,27 31,27 38,0 55,-20 57,-22 l -36,128 12,4 \n105,-369 z",.0625:"m 158,-292 c -6,21 -22,40 -48,42 8,-23 -8,-38 \n-25,-38 -17,0 -27,13 -27,31 0,14 15,27 31,27 40,0 57,-22 57,-22 l -17,61 \nv 0 c -6,21 -22,40 -48,42 8,-23 -8,-38 -25,-38 -17,0 -27,13 -27,31 0,14 \n15,27 31,27 40,0 57,-22 57,-22 l -20,69 c -7,18 -22,33 -45,35 8,-23 -8,-38 \n-25,-38 -17,0 -27,13 -27,31 0,14 15,27 31,27 40,0 57,-22 57,-22 L 68,20 C \n61,37 46,51 24,52 32,29 16,14 -1,14 c -17,0 -27,13 -27,31 0,14 15,27 31,27 \n38,0 55,-20 57,-22 l -36,128 12,4 134,-469 z"},e.CLEF_PATHS={50:"m 101,-199 c -49,0 -100,28 -100,83 0,39 58,57 82,26 15,-20 \n-4,-47 -32,-47 -23,1 -25,0 -25,-8 0,-22 40,-46 71,-41 91,16 67,208 -105,302 \n75,-27 198,-94 211,-201 6,-66 -42,-114 -102,-114 z m 143,33 c -13,0 -23,11 \n-23,24 0,14 10,24 23,24 13,0 23,-11 23,-24 0,-13 -10,-24 -23,-24 z m 2,83 c \n-13,0 -23,11 -23,24 0,14 10,24 23,24 13,0 23,-11 23,-24 0,-13 -10,-24 -23,-24 \nz",71:"M 139,48 C 102,57 76,120 131,151 41,128 64,24 129,2 L \n117,-57 C -32,47 26,217 166,182 Z m 12,-1 27,131 C 242,153 216,46 151,47 \nZ m -35,-177 c 34,-23 82,-117 50,-140 -23,-17 -71,33 -50,140 z m -10,10 c \n-23,-77 -20,-200 48,-213 19,-4 89,171 -26,266 l 13,66 c 120,-6 137,155 \n39,191 l 12,58 c 30,131 -137,145 -138,47 0,-29 37,-59 63,-37 21,18 25,71 \n-25,70 32,42 103,0 91,-65 L 167,193 C 56,232 -112,63 106,-120 Z"},e.ACCIDENTAL_PATHS=[null,"m -49,-121 v 52 l -29,9 v -48 h -8 v 51 l -20,6 v 29 l \n20,-6 v 70 l -20,6 v 30 l 20,-6 v 51 h 8 V 69 l 30,-8 v 50 h 8 V 58 l 20,-6 \nV 23 l -20,6 v -71 l 20,-6 v -29 l -20,6 v -50 z m 1,82 v 71 l -29,9 v -71 z","M -106,-166 V 67 c 52,-42 85,-56 85,-94 0,-47 -46,-51 \n-73,-22 v -117 z m 31,120 c 20,0 42,46 -20,91 V -7 c 0,-28 10,-39 20,-39 z","m -81,-58 v -48 H -92 V 73 l 60,-13 v 50 h 11 V -72 Z m \n50,24 v 58 l -50,11 v -58 z"]},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BarsInfo=void 0;var s=i(0),n=i(1),a=function(){function t(t,e){this.barsInfo=[];for(var i=0,n=0,a=0,r=t.tempos[0],o=t.keySignatures[0],h=t.timeSignatures[0],l=0,u=s.getBarLength(h),c=0;c<e;c+=1/16){var f={start:c,barNumber:l+(c-h.start)/u,barLength:u,tempo:r,keySignature:o,timeSignature:h};i<t.tempos.length&&t.tempos[i].start===c&&(r=t.tempos[i++],f.tempo=r,f.tempoChange=!0),n<t.keySignatures.length&&t.keySignatures[n].start===c&&(o=t.keySignatures[n++],f.keySignature=o,f.keyChange=!0),a<t.timeSignatures.length&&t.timeSignatures[a].start===c&&(l=f.barNumber,h=t.timeSignatures[a++],f.timeSignature=h,u=s.getBarLength(h),f.barLength=u,f.timeChange=!0),this.barsInfo.push(f)}}return t.prototype.barNumberAtQ=function(t){var e=this.barsInfo[Math.trunc(16*t)],i=(t-e.start)/e.barLength;return e.barNumber+i},t.prototype.barLenghtAtQ=function(t){return this.barsInfo[Math.trunc(16*t)].barLength},t.prototype.tempoAtQ=function(t,e){void 0===e&&(e=!1);var i=this.barsInfo[0];return!e||i.tempoChange?i.tempo.qpm:-1},t.prototype.keySignatureAtQ=function(t,e){void 0===e&&(e=!1);var i=this.barsInfo[Math.trunc(16*t)];return!e||i.keyChange?i.keySignature.key:-1},t.prototype.timeSignatureAtQ=function(t,e){void 0===e&&(e=!1);var i=this.barsInfo[Math.trunc(16*t)];return!e||i.timeChange?i.timeSignature:null},t.prototype.quartersToTime=function(t){return t/this.barsInfo[0].tempo.qpm*60},t.prototype.timeToQuarters=function(t){var e=t*this.barsInfo[0].tempo.qpm/60;return Math.round(e*n.MAX_QUARTER_DIVISION)/n.MAX_QUARTER_DIVISION},t}();e.BarsInfo=a}]);