@coderline/alphatab
Version:
alphaTab is a music notation and guitar tablature rendering library
51 lines • 995 kB
JavaScript
/*!
* alphaTab v1.6.1 (, build 20)
*
* Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Integrated Libraries:
*
* Library: TinySoundFont
* License: MIT
* Copyright: Copyright (C) 2017, 2018 Bernhard Schelling
* URL: https://github.com/schellingb/TinySoundFont
* Purpose: SoundFont loading and Audio Synthesis
*
* Library: SFZero
* License: MIT
* Copyright: Copyright (C) 2012 Steve Folta ()
* URL: https://github.com/stevefolta/SFZero
* Purpose: TinySoundFont is based on SFZEro
*
* Library: Haxe Standard Library
* License: MIT
* Copyright: Copyright (C)2005-2025 Haxe Foundation
* URL: https://github.com/HaxeFoundation/haxe/tree/development/std
* Purpose: XML Parser & Zip Inflate Algorithm
*
* Library: SharpZipLib
* License: MIT
* Copyright: Copyright © 2000-2018 SharpZipLib Contributors
* URL: https://github.com/icsharpcode/SharpZipLib
* Purpose: Zip Deflate Algorithm for writing compressed Zips
*
* Library: NVorbis
* License: MIT
* Copyright: Copyright (c) 2020 Andrew Ward
* URL: https://github.com/NVorbis/NVorbis
* Purpose: Vorbis Stream Decoding
*
* Library: libvorbis
* License: BSD-3-Clause
* Copyright: Copyright (c) 2002-2020 Xiph.org Foundation
* URL: https://github.com/xiph/vorbis
* Purpose: NVorbis adopted some code from libvorbis.
*
* @preserve
* @license
*/
class e{constructor(e){this._targets=new Set,this._callback=e,window.addEventListener("resize",this.onWindowResize.bind(this),!1)}observe(e){this._targets.add(e)}unobserve(e){this._targets.delete(e)}disconnect(){this._targets.clear()}onWindowResize(){const e=[];for(const t of this._targets)e.push({target:t,contentRect:void 0,borderBoxSize:void 0,contentBoxSize:[],devicePixelContentBoxSize:[]});this._callback(e,this)}}class t{constructor(e){this._elements=[];let t=null;const s=this.check.bind(this);this.check=()=>{t||(t=setTimeout((()=>{s(),t=null}),100))},this._callback=e,window.addEventListener("resize",this.check,!0),document.addEventListener("scroll",this.check,!0)}observe(e){this._elements.indexOf(e)>=0||(this._elements.push(e),this.check())}unobserve(e){this._elements=this._elements.filter((t=>t!==e))}check(){const e=[];for(const t of this._elements){const s=t.getBoundingClientRect();s.top+s.height>=0&&s.top<=window.innerHeight&&s.left+s.width>=0&&s.left<=window.innerWidth&&e.push({target:t,isIntersecting:!0})}e.length&&this._callback(e,this)}}var s,i,a,n,r,o,h,l,c,d,u,p,m,g,f,y,b,S,_,w,B,k,T,N,x,P,v,F,C,E,D,M,L,I,A,R;void 0===Symbol.dispose&&(Symbol.dispose=Symbol("Symbol.dispose")),"undefined"!=typeof window&&("ResizeObserver"in globalThis||(globalThis.ResizeObserver=e),"IntersectionObserver"in globalThis||(globalThis.IntersectionObserver=t),"replaceChildren"in Element.prototype||(Element.prototype.replaceChildren=function(...e){this.innerHTML="",this.append(...e)},Document.prototype.replaceChildren=Element.prototype.replaceChildren,DocumentFragment.prototype.replaceChildren=Element.prototype.replaceChildren)),"replaceAll"in String.prototype||(String.prototype.replaceAll=function(e,t){return this.replace(new RegExp(e,"g"),t)}),function(e){e[e.Page=0]="Page",e[e.Horizontal=1]="Horizontal"}(s||(s={})),function(e){e[e.Default=0]="Default",e[e.ScoreTab=1]="ScoreTab",e[e.Score=2]="Score",e[e.Tab=3]="Tab",e[e.TabMixed=4]="TabMixed"}(i||(i={}));class O{static getValue(e){return O._values||(O._values=new Map),e=e.toLowerCase().replaceAll(" ",""),O._values.has(e)?O._values.get(e):0}static isPiano(e){return e<=7||e>=16&&e<=23}static isGuitar(e){return e>=24&&e<=39||105===e||43===e}}O._values=new Map([["acousticgrandpiano",0],["brightacousticpiano",1],["electricgrandpiano",2],["honkytonkpiano",3],["electricpiano1",4],["electricpiano2",5],["harpsichord",6],["clavinet",7],["celesta",8],["glockenspiel",9],["musicbox",10],["vibraphone",11],["marimba",12],["xylophone",13],["tubularbells",14],["dulcimer",15],["drawbarorgan",16],["percussiveorgan",17],["rockorgan",18],["churchorgan",19],["reedorgan",20],["accordion",21],["harmonica",22],["tangoaccordion",23],["acousticguitarnylon",24],["acousticguitarsteel",25],["electricguitarjazz",26],["electricguitarclean",27],["electricguitarmuted",28],["overdrivenguitar",29],["distortionguitar",30],["guitarharmonics",31],["acousticbass",32],["electricbassfinger",33],["electricbasspick",34],["fretlessbass",35],["slapbass1",36],["slapbass2",37],["synthbass1",38],["synthbass2",39],["violin",40],["viola",41],["cello",42],["contrabass",43],["tremolostrings",44],["pizzicatostrings",45],["orchestralharp",46],["timpani",47],["stringensemble1",48],["stringensemble2",49],["synthstrings1",50],["synthstrings2",51],["choiraahs",52],["voiceoohs",53],["synthvoice",54],["orchestrahit",55],["trumpet",56],["trombone",57],["tuba",58],["mutedtrumpet",59],["frenchhorn",60],["brasssection",61],["synthbrass1",62],["synthbrass2",63],["sopranosax",64],["altosax",65],["tenorsax",66],["baritonesax",67],["oboe",68],["englishhorn",69],["bassoon",70],["clarinet",71],["piccolo",72],["flute",73],["recorder",74],["panflute",75],["blownbottle",76],["shakuhachi",77],["whistle",78],["ocarina",79],["lead1square",80],["lead2sawtooth",81],["lead3calliope",82],["lead4chiff",83],["lead5charang",84],["lead6voice",85],["lead7fifths",86],["lead8bassandlead",87],["pad1newage",88],["pad2warm",89],["pad3polysynth",90],["pad4choir",91],["pad5bowed",92],["pad6metallic",93],["pad7halo",94],["pad8sweep",95],["fx1rain",96],["fx2soundtrack",97],["fx3crystal",98],["fx4atmosphere",99],["fx5brightness",100],["fx6goblins",101],["fx7echoes",102],["fx8scifi",103],["sitar",104],["banjo",105],["shamisen",106],["koto",107],["kalimba",108],["bagpipe",109],["fiddle",110],["shanai",111],["tinklebell",112],["agogo",113],["steeldrums",114],["woodblock",115],["taikodrum",116],["melodictom",117],["synthdrum",118],["reversecymbal",119],["guitarfretnoise",120],["breathnoise",121],["seashore",122],["birdtweet",123],["telephonering",124],["helicopter",125],["applause",126],["gunshot",127]]),function(e){e[e.NoBrackets=0]="NoBrackets",e[e.GroupStaves=1]="GroupStaves",e[e.GroupSimilarInstruments=2]="GroupSimilarInstruments"}(a||(a={})),function(e){e[e.Hidden=0]="Hidden",e[e.FirstSystem=1]="FirstSystem",e[e.AllSystems=2]="AllSystems"}(n||(n={})),function(e){e[e.FullName=0]="FullName",e[e.ShortName=1]="ShortName"}(r||(r={})),function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical"}(o||(o={}));class H{constructor(){this.hideDynamics=!1,this.bracketExtendMode=a.GroupStaves,this.useSystemSignSeparator=!1,this.globalDisplayTuning=!0,this.perTrackDisplayTuning=null,this.globalDisplayChordDiagramsOnTop=!0,this.perTrackChordDiagramsOnTop=null,this.singleTrackTrackNamePolicy=n.FirstSystem,this.multiTrackTrackNamePolicy=n.FirstSystem,this.firstSystemTrackNameMode=r.ShortName,this.otherSystemsTrackNameMode=r.ShortName,this.firstSystemTrackNameOrientation=o.Vertical,this.otherSystemsTrackNameOrientation=o.Vertical,this.multiTrackMultiBarRest=!1,this.perTrackMultiBarRest=null}}class V{constructor(){this.masterBars=[],this.opening=null,this.closings=[],this.isClosed=!1}get openings(){const e=this.opening;return e?[e]:[]}get isOpened(){return!0===this.opening?.isRepeatStart}addMasterBar(e){null===this.opening&&(this.opening=e),this.masterBars.push(e),e.repeatGroup=this,e.isRepeatEnd&&(this.closings.push(e),this.isClosed=!0)}}class W{constructor(){this.colors=new Map}}!function(e){e[e.Neutral=0]="Neutral",e[e.C3=1]="C3",e[e.C4=2]="C4",e[e.F4=3]="F4",e[e.G2=4]="G2"}(h||(h={})),function(e){e[e._15ma=0]="_15ma",e[e._8va=1]="_8va",e[e.Regular=2]="Regular",e[e._8vb=3]="_8vb",e[e._15mb=4]="_15mb"}(l||(l={})),function(e){e[e.None=0]="None",e[e.Simple=1]="Simple",e[e.FirstOfDouble=2]="FirstOfDouble",e[e.SecondOfDouble=3]="SecondOfDouble"}(c||(c={})),function(e){e[e.Cb=-7]="Cb",e[e.Gb=-6]="Gb",e[e.Db=-5]="Db",e[e.Ab=-4]="Ab",e[e.Eb=-3]="Eb",e[e.Bb=-2]="Bb",e[e.F=-1]="F",e[e.C=0]="C",e[e.G=1]="G",e[e.D=2]="D",e[e.A=3]="A",e[e.E=4]="E",e[e.B=5]="B",e[e.FSharp=6]="FSharp",e[e.CSharp=7]="CSharp"}(d||(d={})),function(e){e[e.Major=0]="Major",e[e.Minor=1]="Minor"}(u||(u={})),function(e){e[e.Down=0]="Down",e[e.Hold=1]="Hold",e[e.Up=2]="Up"}(p||(p={}));class G{constructor(){this.ratioPosition=0,this.pedalType=p.Down,this.nextPedalMarker=null,this.previousPedalMarker=null}}!function(e){e[e.StandardNotationRepeats=0]="StandardNotationRepeats",e[e.GuitarTabsRepeats=1]="GuitarTabsRepeats",e[e.SlashRepeats=2]="SlashRepeats",e[e.NumberedRepeats=3]="NumberedRepeats",e[e.StandardNotationBarNumber=4]="StandardNotationBarNumber",e[e.GuitarTabsBarNumber=5]="GuitarTabsBarNumber",e[e.SlashBarNumber=6]="SlashBarNumber",e[e.NumberedBarNumber=7]="NumberedBarNumber",e[e.StandardNotationBarLines=8]="StandardNotationBarLines",e[e.GuitarTabsBarLines=9]="GuitarTabsBarLines",e[e.SlashBarLines=10]="SlashBarLines",e[e.NumberedBarLines=11]="NumberedBarLines",e[e.StandardNotationClef=12]="StandardNotationClef",e[e.GuitarTabsClef=13]="GuitarTabsClef",e[e.StandardNotationKeySignature=14]="StandardNotationKeySignature",e[e.NumberedKeySignature=15]="NumberedKeySignature",e[e.StandardNotationTimeSignature=16]="StandardNotationTimeSignature",e[e.GuitarTabsTimeSignature=17]="GuitarTabsTimeSignature",e[e.SlashTimeSignature=18]="SlashTimeSignature",e[e.NumberedTimeSignature=19]="NumberedTimeSignature",e[e.StandardNotationStaffLine=20]="StandardNotationStaffLine",e[e.GuitarTabsStaffLine=21]="GuitarTabsStaffLine",e[e.SlashStaffLine=22]="SlashStaffLine",e[e.NumberedStaffLine=23]="NumberedStaffLine"}(m||(m={}));class z extends W{}!function(e){e[e.Automatic=0]="Automatic",e[e.Dashed=1]="Dashed",e[e.Dotted=2]="Dotted",e[e.Heavy=3]="Heavy",e[e.HeavyHeavy=4]="HeavyHeavy",e[e.HeavyLight=5]="HeavyLight",e[e.LightHeavy=6]="LightHeavy",e[e.LightLight=7]="LightLight",e[e.None=8]="None",e[e.Regular=9]="Regular",e[e.Short=10]="Short",e[e.Tick=11]="Tick"}(g||(g={}));class U{constructor(){this.id=U._globalBarId++,this.index=0,this.nextBar=null,this.previousBar=null,this.clef=h.G2,this.clefOttava=l.Regular,this.voices=[],this.simileMark=c.None,this.isMultiVoice=!1,this.displayScale=1,this.displayWidth=-1,this.sustainPedals=[],this._isEmpty=!0,this._isRestOnly=!0,this.barLineLeft=g.Automatic,this.barLineRight=g.Automatic,this.keySignature=d.C,this.keySignatureType=u.Major}static resetIds(){U._globalBarId=0}get masterBar(){return this.staff.track.score.masterBars[this.index]}get isEmpty(){return this._isEmpty}get hasChanges(){if(0===this.index)return!0;return!(this.keySignature===this.previousBar.keySignature&&this.keySignatureType===this.previousBar.keySignatureType&&this.clef===this.previousBar.clef&&this.clefOttava===this.previousBar.clefOttava)||(this.simileMark!==c.None||this.sustainPedals.length>0||this.barLineLeft!==g.Automatic||this.barLineRight!==g.Automatic)}get isRestOnly(){return this._isRestOnly}getActualBarLineLeft(e){return U.actualBarLine(this,!1,e)}getActualBarLineRight(){return U.actualBarLine(this,!0,!1)}static automaticToActualType(e,t,s){let i;return i=t?e.isRepeatEnd?g.LightHeavy:e.nextMasterBar?e.isFreeTime?g.Dashed:e.isDoubleBar?g.LightLight:g.Regular:g.LightHeavy:e.isRepeatStart?g.HeavyLight:s?g.Regular:g.None,i}static actualBarLine(e,t,s){const i=e.masterBar,a=t?e.barLineRight:e.barLineLeft;let n;return n=a===g.Automatic?U.automaticToActualType(i,t,s):a,n}addVoice(e){e.bar=this,e.index=this.voices.length,this.voices.push(e)}finish(e,t=null){this.isMultiVoice=!1,this._isEmpty=!0,this._isRestOnly=!0;for(let s=0,i=this.voices.length;s<i;s++){const i=this.voices[s];i.finish(e,t),s>0&&!i.isEmpty&&(this.isMultiVoice=!0),i.isEmpty||(this._isEmpty=!1),i.isRestOnly||(this._isRestOnly=!1)}const s=this.sustainPedals;if(s.length>0){let e=null;this.sustainPedals=[],this.previousBar&&this.previousBar.sustainPedals.length>0&&(e=this.previousBar.sustainPedals[this.previousBar.sustainPedals.length-1]);const t=null!==e&&e.pedalType!==p.Up;for(const i of s){if(e&&e.pedalType!==p.Up){if(e.bar===this&&i.ratioPosition<=e.ratioPosition)continue;e.nextPedalMarker=i,i.previousPedalMarker=e}t&&i.pedalType===p.Down&&(i.pedalType=p.Hold),i.bar=this,this.sustainPedals.push(i),e=i}}else if(this.previousBar&&this.previousBar.sustainPedals.length>0){const e=this.previousBar.sustainPedals[this.previousBar.sustainPedals.length-1];if(e.pedalType!==p.Up){const t=new G;t.ratioPosition=0,t.bar=this,t.pedalType=p.Hold,this.sustainPedals.push(t),e.nextPedalMarker=t,t.previousPedalMarker=e}}}calculateDuration(){let e=0;for(const t of this.voices){const s=t.calculateDuration();s>e&&(e=s)}return e}}U._globalBarId=0,function(e){e[e.PPP=0]="PPP",e[e.PP=1]="PP",e[e.P=2]="P",e[e.MP=3]="MP",e[e.MF=4]="MF",e[e.F=5]="F",e[e.FF=6]="FF",e[e.FFF=7]="FFF",e[e.PPPP=8]="PPPP",e[e.PPPPP=9]="PPPPP",e[e.PPPPPP=10]="PPPPPP",e[e.FFFF=11]="FFFF",e[e.FFFFF=12]="FFFFF",e[e.FFFFFF=13]="FFFFFF",e[e.SF=14]="SF",e[e.SFP=15]="SFP",e[e.SFPP=16]="SFPP",e[e.FP=17]="FP",e[e.RF=18]="RF",e[e.RFZ=19]="RFZ",e[e.SFZ=20]="SFZ",e[e.SFFZ=21]="SFFZ",e[e.FZ=22]="FZ",e[e.N=23]="N",e[e.PF=24]="PF",e[e.SFZP=25]="SFZP"}(f||(f={}));class X{static ticksToMillis(e,t){return e*(6e4/(t*X.QuarterTime))|0}static millisToTicks(e,t){return e/(6e4/(t*X.QuarterTime))|0}static toTicks(e){return X.valueToTicks(e)}static valueToTicks(e){let t=e;return t<0&&(t=1/-t),X.QuarterTime*(4/t)|0}static applyDot(e,t){return t?e+3*(e/4|0):e+(e/2|0)}static applyTuplet(e,t,s){return e*s/t|0}static removeTuplet(e,t,s){return e*t/s|0}static dynamicToVelocity(e,t=0){let s=1;switch(e){case f.PPP:s=X.MinVelocity+0*X.VelocityIncrement;break;case f.PP:s=X.MinVelocity+1*X.VelocityIncrement;break;case f.P:s=X.MinVelocity+2*X.VelocityIncrement;break;case f.MP:s=X.MinVelocity+3*X.VelocityIncrement;break;case f.MF:s=X.MinVelocity+4*X.VelocityIncrement;break;case f.F:s=X.MinVelocity+5*X.VelocityIncrement;break;case f.FF:s=X.MinVelocity+6*X.VelocityIncrement;break;case f.FFF:s=X.MinVelocity+7*X.VelocityIncrement;break;case f.PPPP:s=10;break;case f.PPPPP:s=5;break;case f.PPPPPP:s=3;break;case f.FFFF:s=X.MinVelocity+8*X.VelocityIncrement;break;case f.FFFFF:s=X.MinVelocity+9*X.VelocityIncrement;break;case f.FFFFFF:s=X.MinVelocity+10*X.VelocityIncrement;break;case f.SF:case f.SFP:case f.SFZP:case f.SFPP:case f.SFZ:case f.FZ:s=X.MinVelocity+6*X.VelocityIncrement;break;case f.FP:case f.RF:case f.RFZ:case f.SFFZ:s=X.MinVelocity+5*X.VelocityIncrement;break;case f.N:s=1;break;case f.PF:s=X.MinVelocity+(4.5*X.VelocityIncrement|0)}return s+=t*X.VelocityIncrement,Math.min(Math.max(s,1),127)}}X.QuarterTime=960,X.MinVelocity=15,X.VelocityIncrement=16,function(e){e[e.Tempo=0]="Tempo",e[e.Volume=1]="Volume",e[e.Instrument=2]="Instrument",e[e.Balance=3]="Balance",e[e.SyncPoint=4]="SyncPoint"}(y||(y={}));class J{constructor(){this.barOccurence=0,this.millisecondOffset=0}}class Y{constructor(){this.isLinear=!1,this.type=y.Tempo,this.value=0,this.ratioPosition=0,this.text=""}static buildTempoAutomation(e,t,s,i){(i<1||i>5)&&(i=2);const a=new Float32Array([1,.5,1,1.5,2,3]),n=new Y;return n.type=y.Tempo,n.isLinear=e,n.ratioPosition=t,n.value=s*a[i],n}static buildInstrumentAutomation(e,t,s){const i=new Y;return i.type=y.Instrument,i.isLinear=e,i.ratioPosition=t,i.value=s,i}}class q{constructor(e=0,t=0){this.offset=e,this.value=t}}q.MaxPosition=60,q.MaxValue=12,function(e){e[e.Default=0]="Default",e[e.Gradual=1]="Gradual",e[e.Fast=2]="Fast"}(b||(b={})),function(e){e[e.None=0]="None",e[e.Custom=1]="Custom",e[e.Bend=2]="Bend",e[e.Release=3]="Release",e[e.BendRelease=4]="BendRelease",e[e.Hold=5]="Hold",e[e.Prebend=6]="Prebend",e[e.PrebendBend=7]="PrebendBend",e[e.PrebendRelease=8]="PrebendRelease"}(S||(S={})),function(e){e[e.None=0]="None",e[e.BrushUp=1]="BrushUp",e[e.BrushDown=2]="BrushDown",e[e.ArpeggioUp=3]="ArpeggioUp",e[e.ArpeggioDown=4]="ArpeggioDown"}(_||(_={})),function(e){e[e.None=0]="None",e[e.Crescendo=1]="Crescendo",e[e.Decrescendo=2]="Decrescendo"}(w||(w={})),function(e){e[e.QuadrupleWhole=-4]="QuadrupleWhole",e[e.DoubleWhole=-2]="DoubleWhole",e[e.Whole=1]="Whole",e[e.Half=2]="Half",e[e.Quarter=4]="Quarter",e[e.Eighth=8]="Eighth",e[e.Sixteenth=16]="Sixteenth",e[e.ThirtySecond=32]="ThirtySecond",e[e.SixtyFourth=64]="SixtyFourth",e[e.OneHundredTwentyEighth=128]="OneHundredTwentyEighth",e[e.TwoHundredFiftySixth=256]="TwoHundredFiftySixth"}(B||(B={})),function(e){e[e.None=0]="None",e[e.OnBeat=1]="OnBeat",e[e.BeforeBeat=2]="BeforeBeat",e[e.BendGrace=3]="BendGrace"}(k||(k={})),function(e){e[e.None=0]="None",e[e.Normal=1]="Normal",e[e.Heavy=2]="Heavy",e[e.Tenuto=3]="Tenuto"}(T||(T={})),function(e){e[e.Unknown=-2]="Unknown",e[e.NoOrDead=-1]="NoOrDead",e[e.Thumb=0]="Thumb",e[e.IndexFinger=1]="IndexFinger",e[e.MiddleFinger=2]="MiddleFinger",e[e.AnnularFinger=3]="AnnularFinger",e[e.LittleFinger=4]="LittleFinger"}(N||(N={})),function(e){e[e.None=0]="None",e[e.Natural=1]="Natural",e[e.Artificial=2]="Artificial",e[e.Pinch=3]="Pinch",e[e.Tap=4]="Tap",e[e.Semi=5]="Semi",e[e.Feedback=6]="Feedback"}(x||(x={})),function(e){e[e.Default=0]="Default",e[e.ForceNone=1]="ForceNone",e[e.ForceNatural=2]="ForceNatural",e[e.ForceSharp=3]="ForceSharp",e[e.ForceDoubleSharp=4]="ForceDoubleSharp",e[e.ForceFlat=5]="ForceFlat",e[e.ForceDoubleFlat=6]="ForceDoubleFlat"}(P||(P={})),function(e){e[e.None=0]="None",e[e.IntoFromBelow=1]="IntoFromBelow",e[e.IntoFromAbove=2]="IntoFromAbove"}(v||(v={})),function(e){e[e.None=0]="None",e[e.Shift=1]="Shift",e[e.Legato=2]="Legato",e[e.OutUp=3]="OutUp",e[e.OutDown=4]="OutDown",e[e.PickSlideDown=5]="PickSlideDown",e[e.PickSlideUp=6]="PickSlideUp"}(F||(F={})),function(e){e[e.None=0]="None",e[e.Slight=1]="Slight",e[e.Wide=2]="Wide"}(C||(C={})),function(e){e[e.Hidden=0]="Hidden",e[e.ShowWithBeams=1]="ShowWithBeams",e[e.ShowWithBars=2]="ShowWithBars",e[e.Automatic=3]="Automatic"}(E||(E={})),function(e){e[e.ScoreDefault=0]="ScoreDefault",e[e.ScoreForcePiano=1]="ScoreForcePiano",e[e.SingleNoteEffectBand=2]="SingleNoteEffectBand",e[e.SingleNoteEffectBandForcePiano=3]="SingleNoteEffectBandForcePiano"}(D||(D={})),function(e){e[e.GuitarPro=0]="GuitarPro",e[e.SongBook=1]="SongBook"}(M||(M={})),function(e){e[e.ScoreTitle=0]="ScoreTitle",e[e.ScoreSubTitle=1]="ScoreSubTitle",e[e.ScoreArtist=2]="ScoreArtist",e[e.ScoreAlbum=3]="ScoreAlbum",e[e.ScoreWords=4]="ScoreWords",e[e.ScoreMusic=5]="ScoreMusic",e[e.ScoreWordsAndMusic=6]="ScoreWordsAndMusic",e[e.ScoreCopyright=7]="ScoreCopyright",e[e.GuitarTuning=8]="GuitarTuning",e[e.TrackNames=9]="TrackNames",e[e.ChordDiagrams=10]="ChordDiagrams",e[e.ParenthesisOnTiedBends=11]="ParenthesisOnTiedBends",e[e.TabNotesOnTiedBends=12]="TabNotesOnTiedBends",e[e.ZerosOnDiveWhammys=13]="ZerosOnDiveWhammys",e[e.EffectAlternateEndings=14]="EffectAlternateEndings",e[e.EffectCapo=15]="EffectCapo",e[e.EffectChordNames=16]="EffectChordNames",e[e.EffectCrescendo=17]="EffectCrescendo",e[e.EffectDynamics=18]="EffectDynamics",e[e.EffectFadeIn=19]="EffectFadeIn",e[e.EffectFermata=20]="EffectFermata",e[e.EffectFingering=21]="EffectFingering",e[e.EffectHarmonics=22]="EffectHarmonics",e[e.EffectLetRing=23]="EffectLetRing",e[e.EffectLyrics=24]="EffectLyrics",e[e.EffectMarker=25]="EffectMarker",e[e.EffectOttavia=26]="EffectOttavia",e[e.EffectPalmMute=27]="EffectPalmMute",e[e.EffectPickSlide=28]="EffectPickSlide",e[e.EffectPickStroke=29]="EffectPickStroke",e[e.EffectSlightBeatVibrato=30]="EffectSlightBeatVibrato",e[e.EffectSlightNoteVibrato=31]="EffectSlightNoteVibrato",e[e.EffectTap=32]="EffectTap",e[e.EffectTempo=33]="EffectTempo",e[e.EffectText=34]="EffectText",e[e.EffectTrill=35]="EffectTrill",e[e.EffectTripletFeel=36]="EffectTripletFeel",e[e.EffectWhammyBar=37]="EffectWhammyBar",e[e.EffectWideBeatVibrato=38]="EffectWideBeatVibrato",e[e.EffectWideNoteVibrato=39]="EffectWideNoteVibrato",e[e.EffectLeftHandTap=40]="EffectLeftHandTap",e[e.EffectFreeTime=41]="EffectFreeTime",e[e.EffectSustainPedal=42]="EffectSustainPedal",e[e.EffectGolpe=43]="EffectGolpe",e[e.EffectWahPedal=44]="EffectWahPedal",e[e.EffectBeatBarre=45]="EffectBeatBarre",e[e.EffectNoteOrnament=46]="EffectNoteOrnament",e[e.EffectRasgueado=47]="EffectRasgueado",e[e.EffectDirections=48]="EffectDirections",e[e.EffectBeatTimer=49]="EffectBeatTimer"}(L||(L={}));class ${constructor(){this.notationMode=M.GuitarPro,this.fingeringMode=D.ScoreDefault,this.elements=new Map,this.rhythmMode=E.Automatic,this.rhythmHeight=15,this.transpositionPitches=[],this.displayTranspositionPitches=[],this.smallGraceTabNotes=!0,this.extendBendArrowsOnTiedNotes=!0,this.extendLineEffectsToBeatEnd=!1,this.slurHeight=5}isNotationElementVisible(e){return this.elements.has(e)?this.elements.get(e):!$.defaultElements.has(e)||$.defaultElements.get(e)}}$.defaultElements=new Map([[L.ZerosOnDiveWhammys,!1]]);class j{constructor(e){this._value=void 0,this._factory=e}get value(){return void 0===this._value&&(this._value=this._factory()),this._value}}!function(e){e[e.None=0]="None",e[e.Debug=1]="Debug",e[e.Info=2]="Info",e[e.Warning=3]="Warning",e[e.Error=4]="Error"}(I||(I={}));class K{static format(e,t){return`[AlphaTab][${e}] ${t}`}debug(e,t,...s){console.debug(K.format(e,t),...s)}warning(e,t,...s){console.warn(K.format(e,t),...s)}info(e,t,...s){console.info(K.format(e,t),...s)}error(e,t,...s){console.error(K.format(e,t),...s)}}K.logLevel=I.Info;class Q{static shouldLog(e){return Q.logLevel!==I.None&&e>=Q.logLevel}static debug(e,t,...s){Q.shouldLog(I.Debug)&&Q.log.debug(e,t,...s)}static warning(e,t,...s){Q.shouldLog(I.Warning)&&Q.log.warning(e,t,...s)}static info(e,t,...s){Q.shouldLog(I.Info)&&Q.log.info(e,t,...s)}static error(e,t,...s){Q.shouldLog(I.Error)&&Q.log.error(e,t,...s)}}Q.logLevel=I.Info,Q.log=new K,function(e){e[e.NoTripletFeel=0]="NoTripletFeel",e[e.Triplet16th=1]="Triplet16th",e[e.Triplet8th=2]="Triplet8th",e[e.Dotted16th=3]="Dotted16th",e[e.Dotted8th=4]="Dotted8th",e[e.Scottish16th=5]="Scottish16th",e[e.Scottish8th=6]="Scottish8th"}(A||(A={}));class Z{constructor(){this.alternateEndings=0,this.nextMasterBar=null,this.previousMasterBar=null,this.index=0,this.isDoubleBar=!1,this.isRepeatStart=!1,this.repeatCount=0,this.timeSignatureNumerator=4,this.timeSignatureDenominator=4,this.timeSignatureCommon=!1,this.isFreeTime=!1,this.tripletFeel=A.NoTripletFeel,this.section=null,this.tempoAutomations=[],this.fermata=null,this.start=0,this.isAnacrusis=!1,this.displayScale=1,this.displayWidth=-1,this.directions=null}get hasChanges(){if(0===this.index)return!1;return!(this.timeSignatureCommon===this.previousMasterBar.timeSignatureCommon&&this.timeSignatureNumerator===this.previousMasterBar.timeSignatureNumerator&&this.timeSignatureDenominator===this.previousMasterBar.timeSignatureDenominator&&this.tripletFeel===this.previousMasterBar.tripletFeel)||(0!==this.alternateEndings||this.isRepeatStart||this.isRepeatEnd||this.isFreeTime||this.isSectionStart||this.tempoAutomations.length>0||this.syncPoints&&this.syncPoints.length>0||null!==this.fermata&&this.fermata.size>0||null!==this.directions&&this.directions.size>0||this.isAnacrusis)}get keySignature(){return this.score.tracks[0].staves[0].bars[this.index].keySignature}set keySignature(e){this.score.tracks[0].staves[0].bars[this.index].keySignature=e}get keySignatureType(){return this.score.tracks[0].staves[0].bars[this.index].keySignatureType}set keySignatureType(e){this.score.tracks[0].staves[0].bars[this.index].keySignatureType=e}get isRepeatEnd(){return this.repeatCount>0}get isSectionStart(){return!!this.section}get tempoAutomation(){return this.tempoAutomations.length>0?this.tempoAutomations[0]:null}calculateDuration(e=!0){if(this.isAnacrusis&&e){let e=0;for(const t of this.score.tracks)for(const s of t.staves){const t=this.index<s.bars.length?s.bars[this.index].calculateDuration():0;t>e&&(e=t)}return e}return this.timeSignatureNumerator*X.valueToTicks(this.timeSignatureDenominator)}addFermata(e,t){let s=this.fermata;null===s&&(s=new Map,this.fermata=s),s.set(e,t)}addDirection(e){null==this.directions&&(this.directions=new Set),this.directions.add(e)}getFermata(e){const t=this.fermata;return null===t?null:t.has(e.playbackStart)?t.get(e.playbackStart):null}addSyncPoint(e){this.syncPoints||(this.syncPoints=[]),this.syncPoints.push(e)}}Z.MaxAlternateEndings=8;class ee{}ee.DefaultChannelCount=17,ee.MetronomeChannel=ee.DefaultChannelCount-1,ee.MetronomeKey=33,ee.AudioChannels=2,ee.MinVolume=0,ee.MinProgram=0,ee.MaxProgram=127,ee.MinPlaybackSpeed=.125,ee.MaxPlaybackSpeed=8,ee.PercussionChannel=9,ee.PercussionBank=128,ee.MaxPitchWheel=16384,ee.MaxPitchWheel20=4294967296,ee.DefaultPitchWheel=ee.MaxPitchWheel/2,ee.MicroBufferCount=32,ee.MicroBufferSize=64;class te{constructor(){this.beats=[],this.id="empty",this.isComplete=!1}addBeat(e){e.graceIndex=this.beats.length,e.graceGroup=this,this.beats.push(e)}finish(){this.beats.length>0&&(this.id=`${this.beats[0].absoluteDisplayStart}_${this.beats[0].voice.index}`)}}!function(e){e[e.Glyphs=0]="Glyphs"}(R||(R={}));class se extends W{}let ie=class e{constructor(){this._isEmpty=!0,this._isRestOnly=!0,this.id=e._globalVoiceId++,this.index=0,this.beats=[]}static resetIds(){e._globalVoiceId=0}get isEmpty(){return this._isEmpty}forceNonEmpty(){this._isEmpty=!1}get isRestOnly(){return this._isRestOnly}insertBeat(e,t){t.nextBeat=e.nextBeat,t.nextBeat&&(t.nextBeat.previousBeat=t),t.previousBeat=e,t.voice=this,e.nextBeat=t,this.beats.splice(e.index+1,0,t)}addBeat(e){e.voice=this,e.index=this.beats.length,this.beats.push(e),e.isEmpty||(this._isEmpty=!1),e.isRest||(this._isRestOnly=!1)}chain(e,t=null){if(this.bar){if(e.index<this.beats.length-1)e.nextBeat=this.beats[e.index+1],e.nextBeat.previousBeat=e;else if(e.isLastOfVoice&&e.voice.bar.nextBar){const t=this.bar.nextBar.voices[this.index];t.beats.length>0?(e.nextBeat=t.beats[0],e.nextBeat.previousBeat=e):e.nextBeat.previousBeat=e}e.chain(t)}}addGraceBeat(e){if(0===this.beats.length)return void this.addBeat(e);const t=this.beats[this.beats.length-1];this.beats.splice(this.beats.length-1,1),this.addBeat(e),this.addBeat(t),this._isEmpty=!1,this._isRestOnly=!1}getBeatAtPlaybackStart(e){return this._beatLookup.has(e)?this._beatLookup.get(e):null}finish(e,t=null){this._isEmpty=!0,this._isRestOnly=!0,this._beatLookup=new Map;let s=null;for(let e=0;e<this.beats.length;e++){const i=this.beats[e];i.index=e,this.chain(i,t),i.graceType===k.None?(i.graceGroup=s,s&&(s.isComplete=!0),s=null):(s||(s=new te),s.addBeat(i)),i.isEmpty||(this._isEmpty=!1),i.isRest||(this._isRestOnly=!1)}let i=0,a=0;for(let s=0;s<this.beats.length;s++){const n=this.beats[s];if(n.index=s,n.finish(e,t),n.graceType===k.None){if(n.graceGroup){const e=n.graceGroup.beats[0],t=n.graceGroup.beats[n.graceGroup.beats.length-1];if(e.graceType!==k.BendGrace){const s=t.playbackStart+t.playbackDuration-e.playbackStart;switch(e.graceType){case k.BeforeBeat:e.previousBeat?(e.previousBeat.playbackDuration-=s,a=e.previousBeat.voice===this?e.previousBeat.playbackStart+e.previousBeat.playbackDuration:-s):a=-s;for(const e of n.graceGroup.beats)this._beatLookup.delete(e.playbackStart),e.playbackStart=a,this._beatLookup.set(e.playbackStart,n),a+=e.playbackDuration;break;case k.OnBeat:n.playbackDuration-=s,a=t.voice===this?t.playbackStart+t.playbackDuration:-s}}}n.displayStart=i,n.playbackStart=a,n.fermata?this.bar.masterBar.addFermata(n.playbackStart,n.fermata):n.fermata=this.bar.masterBar.getFermata(n),this._beatLookup.set(n.playbackStart,n)}else n.displayStart=i,n.playbackStart=a;n.finishTuplet(),n.graceGroup&&n.graceGroup.finish(),i+=n.displayDuration,a+=n.playbackDuration}}calculateDuration(){if(this.isEmpty||0===this.beats.length)return 0;const e=this.beats[this.beats.length-1],t=this.beats[0];return e.playbackStart+e.playbackDuration-t.playbackStart}};ie._globalVoiceId=0;class ae{constructor(){this.note=null,this.tone=new ne,this.octave=0}get realValue(){return 12*this.octave+this.tone.noteValue}}class ne{constructor(e=0,t=P.Default){this.noteValue=e,this.accidentalMode=t}}class re{static getIndex(e){return e<0?0:0|Math.log2(e)}static keySignatureIsFlat(e){return e<0}static keySignatureIsNatural(e){return 0===e}static keySignatureIsSharp(e){return e>0}static applyPitchOffsets(e,t){for(let s=0;s<t.tracks.length;s++){if(s<e.notation.displayTranspositionPitches.length)for(const i of t.tracks[s].staves)i.displayTranspositionPitch=-e.notation.displayTranspositionPitches[s];if(s<e.notation.transpositionPitches.length)for(const i of t.tracks[s].staves)i.transpositionPitch=-e.notation.transpositionPitches[s]}}static fingerToString(e,t,s,i){if(e.notation.fingeringMode===D.ScoreForcePiano||e.notation.fingeringMode===D.SingleNoteEffectBandForcePiano||O.isPiano(t.voice.bar.staff.track.playbackInfo.program))switch(s){case N.Unknown:case N.NoOrDead:return null;case N.Thumb:return"1";case N.IndexFinger:return"2";case N.MiddleFinger:return"3";case N.AnnularFinger:return"4";case N.LittleFinger:return"5";default:return null}if(i)switch(s){case N.Unknown:return null;case N.NoOrDead:return"0";case N.Thumb:return"t";case N.IndexFinger:return"1";case N.MiddleFinger:return"2";case N.AnnularFinger:return"3";case N.LittleFinger:return"4";default:return null}switch(s){case N.Unknown:case N.NoOrDead:return null;case N.Thumb:return"p";case N.IndexFinger:return"i";case N.MiddleFinger:return"m";case N.AnnularFinger:return"a";case N.LittleFinger:return"c";default:return null}}static isTuning(e){return!!re.parseTuning(e)}static parseTuning(e){let t="",s="";for(let i=0;i<e.length;i++){const a=e.charCodeAt(i);if(a>=48&&a<=57){if(!t)return null;s+=String.fromCharCode(a)}else{if(!re.TuningLetters.has(a))return null;t+=String.fromCharCode(a)}}if(!s||!t)return null;const i=new ae;return i.octave=Number.parseInt(s)+1,i.note=t.toLowerCase(),i.tone=re.getToneForText(i.note),i.tone.noteValue<0&&(i.octave--,i.tone.noteValue+=12),i}static getTuningForText(e){const t=re.parseTuning(e);return t?t.realValue:-1}static getToneForText(e){const t=e.substring(0,1),s=e.substring(1);let i,a;switch(t.toLowerCase()){case"c":default:i=0;break;case"d":i=2;break;case"e":i=4;break;case"f":i=5;break;case"g":i=7;break;case"a":i=9;break;case"b":i=11}switch(a=re.parseAccidentalMode(s),a){case P.Default:case P.ForceNone:case P.ForceNatural:break;case P.ForceSharp:i++;break;case P.ForceDoubleSharp:i+=2;break;case P.ForceFlat:i--;break;case P.ForceDoubleFlat:i-=2}return new ne(i,a)}static parseAccidentalMode(e){const t=e.toLowerCase();return re.accidentalModeMapping.has(t)?re.accidentalModeMapping.get(t):P.Default}static newGuid(){return`${Math.floor(65536*(1+Math.random())).toString(16).substring(1)+Math.floor(65536*(1+Math.random())).toString(16).substring(1)}-${Math.floor(65536*(1+Math.random())).toString(16).substring(1)}-${Math.floor(65536*(1+Math.random())).toString(16).substring(1)}-${Math.floor(65536*(1+Math.random())).toString(16).substring(1)}-${Math.floor(65536*(1+Math.random())).toString(16).substring(1)}${Math.floor(65536*(1+Math.random())).toString(16).substring(1)}${Math.floor(65536*(1+Math.random())).toString(16).substring(1)}`}static isAlmostEqualTo(e,t){return Math.abs(e-t)<1e-5}static toHexString(e,t=0){let s="";do{s=String.fromCharCode("0123456789ABCDEF".charCodeAt(15&e))+s,e>>=4}while(e>0);for(;s.length<t;)s=`0${s}`;return s}static getAlternateEndingsList(e){const t=[];for(let s=0;s<Z.MaxAlternateEndings;s++)e&1<<s&&t.push(s);return t}static deltaFretToHarmonicValue(e){switch(e){case 2:return 2.4;case 3:return 3.2;case 4:case 5:case 7:case 9:case 12:case 16:case 17:case 19:case 24:return e;case 8:return 8.2;case 10:return 9.6;case 14:case 15:return 14.7;case 21:case 22:return 21.7;default:return 12}}static clamp(e,t,s){return e<=t?t:e>=s?s:e}static buildMultiBarRestInfo(e,t,s){if(!e)return null;const i=e[0].score.stylesheet;if(!(e.length>1?i.multiTrackMultiBarRest:!0===i.perTrackMultiBarRest?.has(e[0].index)))return null;const a=new Map,n=e[0].score;let r=t,o=n.tempo;for(;r<=s;){const i=r;let h=null;for(;r<=s;){const s=n.masterBars[r];let a=!1;for(const e of s.tempoAutomations)e.value!==o&&(a=!0),o=e.value;if(s.alternateEndings||s.isRepeatStart&&s.index!==i||s.isFreeTime||s.isAnacrusis||null!==s.section||s.index!==i&&a||null!==s.fermata&&s.fermata.size>0||null!==s.directions&&s.directions.size>0)break;if(i>t&&s.previousMasterBar&&(s.timeSignatureCommon!==s.previousMasterBar.timeSignatureCommon||s.timeSignatureNumerator!==s.previousMasterBar.timeSignatureNumerator||s.timeSignatureDenominator!==s.previousMasterBar.timeSignatureDenominator||s.tripletFeel!==s.previousMasterBar.tripletFeel))break;let l=!0;for(const t of e){for(const e of t.staves){const t=e.bars[s.index];if(!t.isRestOnly){l=!1;break}if(t.index>0&&(t.keySignature!==t.previousBar.keySignature||t.keySignatureType!==t.previousBar.keySignatureType)){l=!1;break}}if(!l)break}if(!l)break;if(r++,s.index>i&&(null===h?h=[s.index]:h.push(s.index)),s.isRepeatEnd)break}h?a.set(i,h):r++}return a}static computeFirstDisplayedBarIndex(e,t){let s=t.display.startBar;return s--,s=Math.min(e.masterBars.length-1,Math.max(0,s)),s}static computeLastDisplayedBarIndex(e,t,s){let i=t.display.barCount;return i<0&&(i=e.masterBars.length),i=s+i-1,i=Math.min(e.masterBars.length-1,Math.max(0,i)),i}static getOrCreateHeaderFooterStyle(e,t){let s,i=e.style;if(e.style||(i=new $e,e.style=i),i.headerAndFooter.has(t))s=i.headerAndFooter.get(t);else{if(s=new qe,$e.defaultHeaderAndFooter.has(t)){const e=$e.defaultHeaderAndFooter.get(t);s.template=e.template,s.textAlign=e.textAlign}i.headerAndFooter.set(t,s)}return s}static consolidate(e){if(0===e.masterBars.length){const t=new Z;e.addMasterBar(t);const s=new Y;s.isLinear=!1,s.type=y.Tempo,s.value=e.tempo,t.tempoAutomations.push(s);const i=new U;e.tracks[0].staves[0].addBar(i);const a=new ie;i.addVoice(a);const n=new Ye;return n.isEmpty=!0,void a.addBeat(n)}const t=new Set([ee.PercussionChannel]);for(const s of e.tracks){if(1===s.staves.length&&s.staves[0].isPercussion)s.playbackInfo.primaryChannel=ee.PercussionChannel,s.playbackInfo.secondaryChannel=ee.PercussionChannel;else{if(s.playbackInfo.primaryChannel!==ee.PercussionChannel)for(;t.has(s.playbackInfo.primaryChannel);)s.playbackInfo.primaryChannel++;if(t.add(s.playbackInfo.primaryChannel),s.playbackInfo.secondaryChannel!==ee.PercussionChannel)for(;t.has(s.playbackInfo.secondaryChannel);)s.playbackInfo.secondaryChannel++;t.add(s.playbackInfo.secondaryChannel)}for(const t of s.staves){for(const e of t.bars)for(const t of e.voices)if(t.isEmpty&&0===t.beats.length){const e=new Ye;e.isEmpty=!0,t.addBeat(e)}const s=0===t.bars.length?1:t.bars[0].voices.length;for(;t.bars.length<e.masterBars.length;){const e=new U;t.addBar(e);const i=e.previousBar;i&&(e.clef=i.clef,e.clefOttava=i.clefOttava,e.keySignature=e.previousBar.keySignature,e.keySignatureType=e.previousBar.keySignatureType);for(let t=0;t<s;t++){const t=new ie;e.addVoice(t);const s=new Ye;s.isEmpty=!0,t.addBeat(s)}}}}}static trimEmptyBarsAtEnd(e){for(;e.masterBars.length>1;){const t=e.masterBars.length-1,s=e.masterBars[t];if(s.hasChanges)return;for(const s of e.tracks)for(const e of s.staves)if(t<e.bars.length){const s=e.bars[t];if(!s.isEmpty||s.hasChanges)return}for(const s of e.tracks)for(const e of s.staves)if(t<e.bars.length){const s=e.bars[t];e.bars.pop(),s.previousBar.nextBar=null}e.masterBars.pop(),s.previousMasterBar.nextMasterBar=null}}}var oe,he,le,ce,de,ue,pe,me,ge,fe,ye,be,Se,_e,we,Be,ke,Te,Ne,xe,Pe,ve,Fe,Ce,Ee,De,Me;re.TuningLetters=new Set([67,68,69,70,71,65,66,99,100,101,102,103,97,98,35]),re.accidentalModeMapping=new Map([["default",P.Default],["d",P.Default],["forcenone",P.ForceNone],["-",P.ForceNone],["forcenatural",P.ForceNatural],["n",P.ForceNatural],["forcesharp",P.ForceSharp],["#",P.ForceSharp],["forcedoublesharp",P.ForceDoubleSharp],["##",P.ForceDoubleSharp],["x",P.ForceDoubleSharp],["forceflat",P.ForceFlat],["b",P.ForceFlat],["forcedoubleflat",P.ForceDoubleFlat],["bb",P.ForceDoubleFlat]]),function(e){e[e.None=0]="None",e[e.Up=1]="Up",e[e.Down=2]="Down"}(oe||(oe={})),function(e){e[e.None=-1]="None",e[e.Space=32]="Space",e[e.Brace=57344]="Brace",e[e.BracketTop=57347]="BracketTop",e[e.BracketBottom=57348]="BracketBottom",e[e.SystemDivider=57351]="SystemDivider",e[e.GClef=57424]="GClef",e[e.CClef=57436]="CClef",e[e.FClef=57442]="FClef",e[e.UnpitchedPercussionClef1=57449]="UnpitchedPercussionClef1",e[e.SixStringTabClef=57453]="SixStringTabClef",e[e.FourStringTabClef=57454]="FourStringTabClef",e[e.TimeSig0=57472]="TimeSig0",e[e.TimeSig1=57473]="TimeSig1",e[e.TimeSig2=57474]="TimeSig2",e[e.TimeSig3=57475]="TimeSig3",e[e.TimeSig4=57476]="TimeSig4",e[e.TimeSig5=57477]="TimeSig5",e[e.TimeSig6=57478]="TimeSig6",e[e.TimeSig7=57479]="TimeSig7",e[e.TimeSig8=57480]="TimeSig8",e[e.TimeSig9=57481]="TimeSig9",e[e.TimeSigCommon=57482]="TimeSigCommon",e[e.TimeSigCutCommon=57483]="TimeSigCutCommon",e[e.NoteheadDoubleWholeSquare=57505]="NoteheadDoubleWholeSquare",e[e.NoteheadDoubleWhole=57504]="NoteheadDoubleWhole",e[e.NoteheadWhole=57506]="NoteheadWhole",e[e.NoteheadHalf=57507]="NoteheadHalf",e[e.NoteheadBlack=57508]="NoteheadBlack",e[e.NoteheadNull=57509]="NoteheadNull",e[e.NoteheadXOrnate=57514]="NoteheadXOrnate",e[e.NoteheadPlusDoubleWhole=57516]="NoteheadPlusDoubleWhole",e[e.NoteheadPlusWhole=57517]="NoteheadPlusWhole",e[e.NoteheadPlusHalf=57518]="NoteheadPlusHalf",e[e.NoteheadPlusBlack=57519]="NoteheadPlusBlack",e[e.NoteheadSquareWhite=57528]="NoteheadSquareWhite",e[e.NoteheadSquareBlack=57529]="NoteheadSquareBlack",e[e.NoteheadTriangleUpDoubleWhole=57530]="NoteheadTriangleUpDoubleWhole",e[e.NoteheadTriangleUpWhole=57531]="NoteheadTriangleUpWhole",e[e.NoteheadTriangleUpHalf=57532]="NoteheadTriangleUpHalf",e[e.NoteheadTriangleUpBlack=57534]="NoteheadTriangleUpBlack",e[e.NoteheadTriangleRightWhite=57537]="NoteheadTriangleRightWhite",e[e.NoteheadTriangleRightBlack=57538]="NoteheadTriangleRightBlack",e[e.NoteheadTriangleDownDoubleWhole=57548]="NoteheadTriangleDownDoubleWhole",e[e.NoteheadTriangleDownWhole=57540]="NoteheadTriangleDownWhole",e[e.NoteheadTriangleDownHalf=57541]="NoteheadTriangleDownHalf",e[e.NoteheadTriangleDownBlack=57543]="NoteheadTriangleDownBlack",e[e.NoteheadDiamondDoubleWhole=57559]="NoteheadDiamondDoubleWhole",e[e.NoteheadDiamondWhole=57560]="NoteheadDiamondWhole",e[e.NoteheadDiamondHalf=57561]="NoteheadDiamondHalf",e[e.NoteheadDiamondBlack=57563]="NoteheadDiamondBlack",e[e.NoteheadDiamondBlackWide=57564]="NoteheadDiamondBlackWide",e[e.NoteheadDiamondWhite=57565]="NoteheadDiamondWhite",e[e.NoteheadDiamondWhiteWide=57566]="NoteheadDiamondWhiteWide",e[e.NoteheadCircleXDoubleWhole=57520]="NoteheadCircleXDoubleWhole",e[e.NoteheadCircleXWhole=57521]="NoteheadCircleXWhole",e[e.NoteheadCircleXHalf=57522]="NoteheadCircleXHalf",e[e.NoteheadCircleX=57523]="NoteheadCircleX",e[e.NoteheadXDoubleWhole=57510]="NoteheadXDoubleWhole",e[e.NoteheadXWhole=57511]="NoteheadXWhole",e[e.NoteheadXHalf=57512]="NoteheadXHalf",e[e.NoteheadXBlack=57513]="NoteheadXBlack",e[e.NoteheadParenthesis=57550]="NoteheadParenthesis",e[e.NoteheadSlashedBlack1=57551]="NoteheadSlashedBlack1",e[e.NoteheadSlashedBlack2=57552]="NoteheadSlashedBlack2",e[e.NoteheadSlashedHalf1=57553]="NoteheadSlashedHalf1",e[e.NoteheadSlashedHalf2=57554]="NoteheadSlashedHalf2",e[e.NoteheadSlashedWhole1=57555]="NoteheadSlashedWhole1",e[e.NoteheadSlashedWhole2=57556]="NoteheadSlashedWhole2",e[e.NoteheadSlashedDoubleWhole1=57557]="NoteheadSlashedDoubleWhole1",e[e.NoteheadSlashedDoubleWhole2=57558]="NoteheadSlashedDoubleWhole2",e[e.NoteheadCircledBlack=57572]="NoteheadCircledBlack",e[e.NoteheadCircledHalf=57573]="NoteheadCircledHalf",e[e.NoteheadCircledWhole=57574]="NoteheadCircledWhole",e[e.NoteheadCircledDoubleWhole=57575]="NoteheadCircledDoubleWhole",e[e.NoteheadCircleSlash=57591]="NoteheadCircleSlash",e[e.NoteheadHeavyX=57592]="NoteheadHeavyX",e[e.NoteheadHeavyXHat=57593]="NoteheadHeavyXHat",e[e.NoteheadSlashVerticalEnds=57600]="NoteheadSlashVerticalEnds",e[e.NoteheadSlashWhiteWhole=57602]="NoteheadSlashWhiteWhole",e[e.NoteheadSlashWhiteHalf=57603]="NoteheadSlashWhiteHalf",e[e.NoteheadRoundWhiteWithDot=57621]="NoteheadRoundWhiteWithDot",e[e.NoteheadSquareBlackLarge=57626]="NoteheadSquareBlackLarge",e[e.NoteheadSquareBlackWhite=57627]="NoteheadSquareBlackWhite",e[e.NoteheadClusterDoubleWhole3rd=57640]="NoteheadClusterDoubleWhole3rd",e[e.NoteheadClusterWhole3rd=57641]="NoteheadClusterWhole3rd",e[e.NoteheadClusterHalf3rd=57642]="NoteheadClusterHalf3rd",e[e.NoteheadClusterQuarter3rd=57643]="NoteheadClusterQuarter3rd",e[e.NoteShapeRoundWhite=57776]="NoteShapeRoundWhite",e[e.NoteShapeRoundBlack=57777]="NoteShapeRoundBlack",e[e.NoteShapeSquareWhite=57778]="NoteShapeSquareWhite",e[e.NoteShapeSquareBlack=57779]="NoteShapeSquareBlack",e[e.NoteShapeTriangleRightWhite=57780]="NoteShapeTriangleRightWhite",e[e.NoteShapeTriangleRightBlack=57781]="NoteShapeTriangleRightBlack",e[e.NoteShapeTriangleLeftWhite=57782]="NoteShapeTriangleLeftWhite",e[e.NoteShapeTriangleLeftBlack=57783]="NoteShapeTriangleLeftBlack",e[e.NoteShapeDiamondWhite=57784]="NoteShapeDiamondWhite",e[e.NoteShapeDiamondBlack=57785]="NoteShapeDiamondBlack",e[e.NoteShapeTriangleUpWhite=57786]="NoteShapeTriangleUpWhite",e[e.NoteShapeTriangleUpBlack=57787]="NoteShapeTriangleUpBlack",e[e.NoteShapeMoonWhite=57788]="NoteShapeMoonWhite",e[e.NoteShapeMoonBlack=57789]="NoteShapeMoonBlack",e[e.NoteShapeTriangleRoundWhite=57790]="NoteShapeTriangleRoundWhite",e[e.NoteShapeTriangleRoundBlack=57791]="NoteShapeTriangleRoundBlack",e[e.NoteQuarterUp=57813]="NoteQuarterUp",e[e.NoteEighthUp=57815]="NoteEighthUp",e[e.TextBlackNoteLongStem=57841]="TextBlackNoteLongStem",e[e.TextBlackNoteFrac8thLongStem=57843]="TextBlackNoteFrac8thLongStem",e[e.TextBlackNoteFrac16thLongStem=57845]="TextBlackNoteFrac16thLongStem",e[e.TextBlackNoteFrac32ndLongStem=57846]="TextBlackNoteFrac32ndLongStem",e[e.TextCont8thBeamLongStem=57848]="TextCont8thBeamLongStem",e[e.TextCont16thBeamLongStem=57850]="TextCont16thBeamLongStem",e[e.TextCont32ndBeamLongStem=57851]="TextCont32ndBeamLongStem",e[e.TextAugmentationDot=57852]="TextAugmentationDot",e[e.TextTupletBracketStartLongStem=57857]="TextTupletBracketStartLongStem",e[e.TextTuplet3LongStem=57858]="TextTuplet3LongStem",e[e.TextTupletBracketEndLongStem=57859]="TextTupletBracketEndLongStem",e[e.Tremolo3=57890]="Tremolo3",e[e.Tremolo2=57889]="Tremolo2",e[e.Tremolo1=57888]="Tremolo1",e[e.FlagEighthUp=57920]="FlagEighthUp",e[e.FlagEighthDown=57921]="FlagEighthDown",e[e.FlagSixteenthUp=57922]="FlagSixteenthUp",e[e.FlagSixteenthDown=57923]="FlagSixteenthDown",e[e.FlagThirtySecondUp=57924]="FlagThirtySecondUp",e[e.FlagThirtySecondDown=57925]="FlagThirtySecondDown",e[e.FlagSixtyFourthUp=57926]="FlagSixtyFourthUp",e[e.FlagSixtyFourthDown=57927]="FlagSixtyFourthDown",e[e.FlagOneHundredTwentyEighthUp=57928]="FlagOneHundredTwentyEighthUp",e[e.FlagOneHundredTwentyEighthDown=57929]="FlagOneHundredTwentyEighthDown",e[e.FlagTwoHundredFiftySixthUp=57930]="FlagTwoHundredFiftySixthUp",e[e.FlagTwoHundredFiftySixthDown=57931]="FlagTwoHundredFiftySixthDown",e[e.AccidentalFlat=57952]="AccidentalFlat",e[e.AccidentalNatural=57953]="AccidentalNatural",e[e.AccidentalSharp=57954]="AccidentalSharp",e[e.AccidentalDoubleSharp=57955]="AccidentalDoubleSharp",e[e.AccidentalDoubleFlat=57956]="AccidentalDoubleFlat",e[e.AccidentalQuarterToneFlatArrowUp=57968]="AccidentalQuarterToneFlatArrowUp",e[e.AccidentalQuarterToneSharpArrowUp=57972]="AccidentalQuarterToneSharpArrowUp",e[e.AccidentalQuarterToneNaturalArrowUp=57970]="AccidentalQuarterToneNaturalArrowUp",e[e.Segno=57415]="Segno",e[e.Coda=57416]="Coda",e[e.ArticAccentAbove=58528]="ArticAccentAbove",e[e.ArticAccentBelow=58529]="ArticAccentBelow",e[e.ArticStaccatoAbove=58530]="ArticStaccatoAbove",e[e.ArticStaccatoBelow=58531]="ArticStaccatoBelow",e[e.ArticTenutoAbove=58532]="ArticTenutoAbove",e[e.ArticTenutoBelow=58533]="ArticTenutoBelow",e[e.ArticMarcatoAbove=58540]="ArticMarcatoAbove",e[e.ArticMarcatoBelow=58541]="ArticMarcatoBelow",e[e.FermataAbove=58560]="FermataAbove",e[e.FermataShortAbove=58564]="FermataShortAbove",e[e.FermataLongAbove=58566]="FermataLongAbove",e[e.RestLonga=58593]="RestLonga",e[e.RestDoubleWhole=58594]="RestDoubleWhole",e[e.RestWhole=58595]="RestWhole",e[e.RestHalf=58596]="RestHalf",e[e.RestQuarter=58597]="RestQuarter",e[e.RestEighth=58598]="RestEighth",e[e.RestSixteenth=58599]="RestSixteenth",e[e.RestThirtySecond=58600]="RestThirtySecond",e[e.RestSixtyFourth=58601]="RestSixtyFourth",e[e.RestOneHundredTwentyEighth=58602]="RestOneHundredTwentyEighth",e[e.RestTwoHundredFiftySixth=58603]="RestTwoHundredFiftySixth",e[e.RestHBarLeft=58607]="RestHBarLeft",e[e.RestHBarMiddle=58608]="RestHBarMiddle",e[e.RestHBarRight=58609]="RestHBarRight",e[e.Repeat1Bar=58624]="Repeat1Bar",e[e.Repeat2Bars=58625]="Repeat2Bars",e[e.Ottava=58640]="Ottava",e[e.OttavaAlta=58641]="OttavaAlta",e[e.OttavaBassaVb=58652]="OttavaBassaVb",e[e.Quindicesima=58644]="Quindicesima",e[e.QuindicesimaAlta=58645]="QuindicesimaAlta",e[e.DynamicPPPPPP=58663]="DynamicPPPPPP",e[e.DynamicPPPPP=58664]="DynamicPPPPP",e[e.DynamicPPPP=58665]="DynamicPPPP",e[e.DynamicPPP=58666]="DynamicPPP",e[e.DynamicPP=58667]="DynamicPP",e[e.DynamicPiano=58656]="DynamicPiano",e[e.DynamicMP=58668]="DynamicMP",e[e.DynamicMF=58669]="DynamicMF",e[e.DynamicPF=58670]="DynamicPF",e[e.DynamicForte=58658]="DynamicForte",e[e.DynamicFF=58671]="DynamicFF",e[e.DynamicFFF=58672]="DynamicFFF",e[e.DynamicFFFF=58673]="DynamicFFFF",e[e.DynamicFFFFF=58674]="DynamicFFFFF",e[e.DynamicFFFFFF=58675]="DynamicFFFFFF",e[e.DynamicFortePiano=58676]="DynamicFortePiano",e[e.DynamicNiente=58662]="DynamicNiente",e[e.DynamicSforzando1=58678]="DynamicSforzando1",e[e.DynamicSforzandoPiano=58679]="DynamicSforzandoPiano",e[e.DynamicSforzandoPianissimo=58680]="DynamicSforzandoPianissimo",e[e.DynamicSforzato=58681]="DynamicSforzato",e[e.DynamicSforzatoPiano=58682]="DynamicSforzatoPiano",e[e.DynamicSforzatoFF=58683]="DynamicSforzatoFF",e[e.DynamicRinforzando1=58684]="DynamicRinforzando1",e[e.DynamicRinforzando2=58685]="DynamicRinforzando2",e[e.DynamicForzando=58677]="DynamicForzando",e[e.OrnamentTrill=58726]="OrnamentTrill",e[e.OrnamentTurn=58727]="OrnamentTurn",e[e.OrnamentTurnInverted=58728]="OrnamentTurnInverted",e[e.OrnamentShortTrill=58732]="OrnamentShortTrill",e[e.OrnamentMordent=58733]="OrnamentMordent",e[e.StringsDownBow=58896]="StringsDownBow",e[e.StringsUpBow=58898]="StringsUpBow",e[e.KeyboardPedalPed=58960]="KeyboardPedalPed",e[e.KeyboardPedalUp=58965]="KeyboardPedalUp",e[e.PictEdgeOfCymbal=59177]="PictEdgeOfCymbal",e[e.GuitarString0=59443]="GuitarString0",e[e.GuitarString1=59444]="GuitarString1",e[e.GuitarString2=59445]="GuitarString2",e[e.GuitarString3=59446]="GuitarString3",e[e.GuitarString4=59447]="GuitarString4",e[e.GuitarString5=59448]="GuitarString5",e[e.GuitarString6=59449]="GuitarString6",e[e.GuitarString7=59450]="GuitarString7",e[e.GuitarString8=59451]="GuitarString8",e[e.GuitarString9=59452]="GuitarString9",e[e.GuitarOpenPedal=59453]="GuitarOpenPedal",e[e.GuitarClosePedal=59455]="GuitarClosePedal",e[e.GuitarGolpe=59458]="GuitarGolpe",e[e.GuitarFadeIn=59459]="GuitarFadeIn",e[e.GuitarFadeOut=59460]="GuitarFadeOut",e[e.GuitarVolumeSwell=59461]="GuitarVolumeSwell",e[e.FretboardX=59481]="FretboardX",e[e.FretboardO=59482]="FretboardO",e[e.WiggleTrill=60068]="WiggleTrill",e[e.WiggleVibratoMediumFast=60126]="WiggleVibratoMediumFast",e[e.OctaveBaselineM=60565]="OctaveBaselineM",e[e.OctaveBaselineB=60563]="OctaveBaselineB"}(he||(he={})),function(e){e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right"}(le||(le={})),function(e){e[e.Top=0]="Top",e[e.Middle=1]="Middle",e[e.Bottom=2]="Bottom"}(ce||(ce={}));class Le{constructor(e,t){this.width=e,this.height=t}}class Ie{constructor(e="",t=0,s=0,i=he.None,a=he.None,n=he.None,r=he.None,o=ce.Middle){this.elementType=e,this.outputMidiNumber=s,this.staffLine=t,this.noteHeadDefault=i,this.noteHeadHalf=a!==he.None?a:i,this.noteHeadWhole=n!==he.None?n:i,this.techniqueSymbol=r,this.techniqueSymbolPlacement=o}getSymbol(e){switch(e){case B.Whole:return this.noteHeadWhole;case B.Half:return this.noteHeadHalf;default:return this.noteHeadDefault}}}class Ae{static articulationFromElementVariation(e,t){return e<Ae.gp6ElementAndVariationToArticulation.length?(t>=Ae.gp6ElementAndVariationToArticulation.length&&(t=0),Ae.gp6ElementAndVariationToArticulation[e][t]):38}static getArticulation(e){const t=e.percussionArticulation;if(t<0)return null;const s=e.beat.voice.bar.staff.track.percussionArticulations;return t<s.length?s[t]:Ae.getArticulationByInputMidiNumber(t)}static getElementAndVariation(e){const t=Ae.getArticulation(e);if(!t)return[-1,-1];for(let e=0;e<Ae.gp6ElementAndVariationToArticulation.length;e++){const s=Ae.gp6ElementAndVariationToArticulation[e];for(let i=0;i<s.length;i++){const a=Ae.getArticulationByInputMidiNumber(s[i]);if(a?.outputMidiNumber===t.outputMidiNumber)return[e,i]}}return[-1,-1]}static getArticulationByInputMidiNumber(e){return Ae.instrumentArticulations.has(e)?Ae.instrumentArticulations.get(e):null}}Ae.gp6ElementAndVariationToArticulation=[[35,35,35],[38,91,37],[99,100,99],[56,100,56],[102,103,102],[43,43,43],[45,45,45],[47,47,47],[48,48,48],[50,50,50],[42,92,46],[44,44,44],[57,98,57],[49,97,49],[55,95,55],[51,93,127],[52,96,52]],Ae.instrumentArticulations=new Map([[38,new Ie("snare",3,38,he.NoteheadBlack,he.NoteheadHalf,he.NoteheadWhole)],[37,new Ie("snare",3,37,he.NoteheadXBlack,he.NoteheadXBlack,he.NoteheadXBlack)],[91,new Ie("snare",3,38,he.NoteheadDiamondWhite,he.NoteheadDiamondWhite,he.NoteheadDiamondWhite)],[42,new Ie("hiHat",-1,42,he.NoteheadXBlack,he.NoteheadXBlack,he.NoteheadXBlack)],[92,new Ie("hiHat",-1,46,he.NoteheadCircleSlash,he.NoteheadCircleSlash,he.NoteheadCircleSlash)],[46,new Ie("hiHat",-1,46,he.NoteheadCircleX,he.NoteheadCircleX,he.NoteheadCircleX)],[44,new Ie("hiHat",9,44,he.NoteheadXBlack,he.NoteheadXBlack,he.NoteheadXBlack)],[35,new Ie("kickDrum",8,35,he.NoteheadBlack,he.NoteheadHalf,he.NoteheadWhole)],[36,new Ie("kickDrum",7,36,he.NoteheadBlack,he.NoteheadHalf,he.Notehea