TransposeCalculator.3ece0f8f.js 1.2 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. var Al=Object.defineProperty,Il=Object.defineProperties;var kl=Object.getOwnPropertyDescriptors;var Bo=Object.getOwnPropertySymbols;var Bl=Object.prototype.hasOwnProperty,Dl=Object.prototype.propertyIsEnumerable;var Do=(n,t,e)=>t in n?Al(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,be=(n,t)=>{for(var e in t||(t={}))Bl.call(t,e)&&Do(n,e,t[e]);if(Bo)for(var e of Bo(t))Dl.call(t,e)&&Do(n,e,t[e]);return n},os=(n,t)=>Il(n,kl(t));import{aE as We,aR as Oi,aS as Fl}from"./base.d7a641ab.js";class Ol{static ajax(t,e=9e3){let i;const s=t.indexOf(".mxl")>-1?"text/plain; charset=x-user-defined":"application/xml";if(XMLHttpRequest)i=new XMLHttpRequest;else if(ActiveXObject)i=new ActiveXObject("Microsoft.XMLHTTP");else return Promise.reject(new Error("XMLHttp not supported."));return i.timeout=e,new Promise((r,o)=>{i.onreadystatechange=()=>{i.readyState===XMLHttpRequest.DONE&&(i.status===200||i.status===0&&i.responseText?r(i.responseText):o(new Error("Could not retrieve requested URL "+i.status)))},i.ontimeout=a=>{o(new Error("Server request Timeout"))},i.overrideMimeType(s),i.open("GET",t,!0),i.send()})}}const Fe=class{constructor(n=0,t=1,e=0,i=!0){this.numerator=0,this.denominator=1,this.wholeValue=0,this.numerator=n,this.denominator=t,this.wholeValue=e,i&&this.simplify(),this.setRealValue()}static max(n,t){return n.RealValue>t.RealValue?n:t}static Equal(n,t){return n.wholeValue===t.wholeValue&&n.Denominator===t.Denominator&&n.Numerator===t.Numerator}static createFromFraction(n){return new Fe(n.numerator,n.denominator,n.wholeValue,!1)}static plus(n,t){const e=n.clone();return e.Add(t),e}static minus(n,t){const e=n.clone();return e.Sub(t),e}static multiply(n,t){return new Fe((n.wholeValue*n.denominator+n.numerator)*(t.wholeValue*t.denominator+t.numerator),n.denominator*t.denominator)}static greatestCommonDenominator(n,t){if(n===0)return t;if(t===1)return 1;for(;Math.abs(t)>1e-8;)n>t?n-=t:t-=n;return Math.round(n)}toString(){let n=this.numerator+"/"+this.denominator;return this.wholeValue!==0&&(n=this.wholeValue+" "+n),n}clone(){return new Fe(this.numerator,this.denominator,this.wholeValue,!1)}get Numerator(){return this.numerator}set Numerator(n){this.numerator!==n&&(this.numerator=n,this.simplify(),this.setRealValue())}get Denominator(){return this.denominator}set Denominator(n){this.denominator!==n&&(this.denominator=n,this.numerator!==0&&this.simplify(),this.setRealValue())}get WholeValue(){return this.wholeValue}set WholeValue(n){this.wholeValue!==n&&(this.wholeValue=n,this.setRealValue())}GetExpandedNumerator(){return this.wholeValue*this.denominator+this.numerator}calculateNumberOfNeededDots(){let n=1,t=2;const e=this.GetExpandedNumerator();for(;t<e;)n++,t=Math.pow(2,n);return Math.min(3,n-1)}IsNegative(){return this.realValue<0}get RealValue(){return this.realValue}expand(n){this.numerator*=n,this.denominator*=n,this.wholeValue!==0&&(this.numerator+=this.wholeValue*this.denominator,this.wholeValue=0)}Add(n){return this.numerator=(this.wholeValue*this.denominator+this.numerator)*n.denominator+(n.wholeValue*n.denominator+n.numerator)*this.denominator,this.denominator=this.denominator*n.denominator,this.wholeValue=0,this.simplify(),this.setRealValue(),this}Sub(n){return this.numerator=(this.wholeValue*this.denominator+this.numerator)*n.denominator-(n.wholeValue*n.denominator+n.numerator)*this.denominator,this.denominator=this.denominator*n.denominator,this.wholeValue=0,this.simplify(),this.setRealValue(),this}getHalfLength(){return new Fe(this.WholeValue,2).Add(new Fe(this.Numerator,this.Denominator*2))}Quantize(n){if(this.denominator<=n)return this;const t=new Fe(this.numerator+1,this.denominator,this.wholeValue);for(;t.Denominator>n;)t.Numerator++;if(this.numerator>this.denominator){const e=new Fe(this.numerator-1,this.denominator,this.wholeValue);for(;e.Denominator>n;)e.Numerator--;if(e.Denominator<t.Denominator)return e}return t}Equals(n){return this.realValue===(n==null?void 0:n.realValue)}CompareTo(n){const t=this.realValue-n.realValue;return t?t<0?-1:1:0}lt(n){return this.realValue<n.realValue}lte(n){return this.realValue<=n.realValue}gt(n){return!this.lte(n)}gte(n){return!this.lt(n)}setRealValue(){this.realValue=this.wholeValue+this.numerator/this.denominator}simplify(){if(this.numerator===0){this.denominator=1;return}const n=Fe.greatestCommonDenominator(Math.abs(this.numerator),Math.abs(this.denominator));this.numerator/=n,this.denominator/=n;const t=Math.floor(this.numerator/this.denominator);if(t!==0&&(this.wholeValue+=t,this.numerator-=t*this.denominator,this.numerator===0&&(this.denominator=1)),this.denominator>Fe.maximumAllowedNumber){const e=this.denominator/Fe.maximumAllowedNumber;this.numerator=Math.round(this.numerator/e),this.denominator=Math.round(this.denominator/e)}if(this.numerator>Fe.maximumAllowedNumber){const e=this.numerator/Fe.maximumAllowedNumber;this.numerator=Math.round(this.numerator/e),this.denominator=Math.round(this.denominator/e)}}isOnBeat(n){const t=this.distanceFromBeat(n);return Math.abs(t)<Fe.FloatInaccuracyTolerance}distanceFromBeat(n){const t=new Fe(1,n.Denominator);return this.RealValue%t.RealValue}};let W=Fe;W.maximumAllowedNumber=46340;W.FloatInaccuracyTolerance=1e-4;class Ii{constructor(t){this.placement=t}static isStringInStringList(t,e){for(let i=0,s=t.length;i<s;++i){const r=t[i];if(e===r.toLowerCase().trim())return!0}return!1}get Placement(){return this.placement}static PlacementEnumFromString(t){switch(t.toLowerCase()){case"above":return z.Above;case"below":return z.Below;case"aboveorbelow":case"abovebelow":return z.AboveOrBelow;case"left":return z.Left;case"right":return z.Right;case"auto":default:return z.NotYetDefined}}}var z=(n=>(n[n.Above=0]="Above",n[n.Below=1]="Below",n[n.Left=2]="Left",n[n.Right=3]="Right",n[n.NotYetDefined=4]="NotYetDefined",n[n.AboveOrBelow=5]="AboveOrBelow",n))(z||{});const vi=class extends Ii{constructor(n,t,e,i,s,r,o=""){super(t),super.parentMeasure=i,this.NumberXml=r,this.dynamicType=n,this.label=o,this.staffNumber=e,this.activeInstantaneousDynamic=s,this.startVolume=1,this.endVolume=1,this.setStartAndEndVolume(),o!==""&&this.setType()}setStartAndEndVolume(){this.activeInstantaneousDynamic&&(this.dynamicType===Re.crescendo&&(this.startVolume=this.activeInstantaneousDynamic.Volume,this.endVolume=this.activeInstantaneousDynamic.Volume*1.2),this.dynamicType===Re.diminuendo&&(this.startVolume=this.activeInstantaneousDynamic.Volume,this.endVolume=this.activeInstantaneousDynamic.Volume*.8))}get DynamicType(){return this.dynamicType}set DynamicType(n){this.dynamicType=n}get StartMultiExpression(){return this.startMultiExpression}set StartMultiExpression(n){this.startMultiExpression=n}get EndMultiExpression(){return this.endMultiExpression}set EndMultiExpression(n){this.endMultiExpression=n}get Placement(){return this.placement}set Placement(n){this.placement=n}get StartVolume(){return this.startVolume}set StartVolume(n){this.startVolume=n}get EndVolume(){return this.endVolume}set EndVolume(n){this.endVolume=n}get StaffNumber(){return this.staffNumber}set StaffNumber(n){this.staffNumber=n}get Label(){return this.label}set Label(n){this.label=n,this.setType()}static isInputStringContinuousDynamic(n){return n?vi.isStringInStringList(vi.listContinuousDynamicIncreasing,n)||vi.isStringInStringList(vi.listContinuousDynamicDecreasing,n):!1}getInterpolatedDynamic(n){const t=this.StartMultiExpression.AbsoluteTimestamp;let e;if(this.EndMultiExpression?e=this.EndMultiExpression.AbsoluteTimestamp:e=W.plus(this.startMultiExpression.SourceMeasureParent.AbsoluteTimestamp,this.startMultiExpression.SourceMeasureParent.Duration),n.lt(t))return-1;if(e.lt(n))return-2;const i=W.minus(n,t).RealValue/W.minus(e,t).RealValue;return Math.max(0,Math.min(99.9,this.startVolume+(this.endVolume-this.startVolume)*i))}isWedge(){return!this.label}setType(){vi.isStringInStringList(vi.listContinuousDynamicIncreasing,this.label)?this.dynamicType=Re.crescendo:vi.isStringInStringList(vi.listContinuousDynamicDecreasing,this.label)&&(this.dynamicType=Re.diminuendo)}};let ei=vi;ei.listContinuousDynamicIncreasing=["crescendo","cresc","cresc.","cres."];ei.listContinuousDynamicDecreasing=["decrescendo","decresc","decr.","diminuendo","dim.","dim"];var Re=(n=>(n[n.crescendo=0]="crescendo",n[n.diminuendo=1]="diminuendo",n))(Re||{}),Ki=(n=>(n[n.p=0]="p",n[n.f=1]="f",n[n.s=2]="s",n[n.z=3]="z",n[n.m=4]="m",n[n.r=5]="r",n))(Ki||{});class Ee{constructor(t,e){this.message=t,e&&(this.message+=" "+e.toString())}}class Li{constructor(t){this.message=t}}class Vl{constructor(t){this.message=t}}var _a={exports:{}};(function(n){(function(t,e){n.exports?n.exports=e():t.log=e()})(We,function(){var t=function(){},e="undefined",i=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),s=["trace","debug","info","warn","error"];function r(g,m){var S=g[m];if(typeof S.bind=="function")return S.bind(g);try{return Function.prototype.bind.call(S,g)}catch{return function(){return Function.prototype.apply.apply(S,[g,arguments])}}}function o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function a(g){return g==="debug"&&(g="log"),typeof console===e?!1:g==="trace"&&i?o:console[g]!==void 0?r(console,g):console.log!==void 0?r(console,"log"):t}function l(g,m){for(var S=0;S<s.length;S++){var b=s[S];this[b]=S<g?t:this.methodFactory(b,g,m)}this.log=this.debug}function h(g,m,S){return function(){typeof console!==e&&(l.call(this,m,S),this[g].apply(this,arguments))}}function c(g,m,S){return a(g)||h.apply(this,arguments)}function u(g,m,S){var b=this,y;m=m==null?"WARN":m;var x="loglevel";typeof g=="string"?x+=":"+g:typeof g=="symbol"&&(x=void 0);function w(P){var I=(s[P]||"silent").toUpperCase();if(!(typeof window===e||!x)){try{window.localStorage[x]=I;return}catch{}try{window.document.cookie=encodeURIComponent(x)+"="+I+";"}catch{}}}function T(){var P;if(!(typeof window===e||!x)){try{P=window.localStorage[x]}catch{}if(typeof P===e)try{var I=window.document.cookie,F=I.indexOf(encodeURIComponent(x)+"=");F!==-1&&(P=/^([^;]+)/.exec(I.slice(F))[1])}catch{}return b.levels[P]===void 0&&(P=void 0),P}}function E(){if(!(typeof window===e||!x)){try{window.localStorage.removeItem(x);return}catch{}try{window.document.cookie=encodeURIComponent(x)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}b.name=g,b.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},b.methodFactory=S||c,b.getLevel=function(){return y},b.setLevel=function(P,I){if(typeof P=="string"&&b.levels[P.toUpperCase()]!==void 0&&(P=b.levels[P.toUpperCase()]),typeof P=="number"&&P>=0&&P<=b.levels.SILENT){if(y=P,I!==!1&&w(P),l.call(b,P,g),typeof console===e&&P<b.levels.SILENT)return"No console available for logging"}else throw"log.setLevel() called with invalid level: "+P},b.setDefaultLevel=function(P){m=P,T()||b.setLevel(P,!1)},b.resetLevel=function(){b.setLevel(m,!1),E()},b.enableAll=function(P){b.setLevel(b.levels.TRACE,P)},b.disableAll=function(P){b.setLevel(b.levels.SILENT,P)};var C=T();C==null&&(C=m),b.setLevel(C,!1)}var f=new u,d={};f.getLogger=function(m){if(typeof m!="symbol"&&typeof m!="string"||m==="")throw new TypeError("You must supply a name when creating a logger.");var S=d[m];return S||(S=d[m]=new u(m,f.getLevel(),f.methodFactory)),S};var p=typeof window!==e?window.log:void 0;return f.noConflict=function(){return typeof window!==e&&window.log===f&&(window.log=p),f},f.getLoggers=function(){return d},f.default=f,f})})(_a);var j=_a.exports,Me={},ke={},Ke={};(function(n){Object.defineProperty(n,"__esModule",{value:!0});var t=Object.prototype.hasOwnProperty;n.has=function(u,f){return t.call(u,f)};function e(u,f){return u<f?-1:u===f?0:1}n.defaultCompare=e;function i(u,f){return u===f}n.defaultEquals=i;function s(u){return u===null?"COLLECTION_NULL":a(u)?"COLLECTION_UNDEFINED":l(u)?"$s"+u:"$o"+u.toString()}n.defaultToString=s;function r(u,f){if(f===void 0&&(f=","),u===null)return"COLLECTION_NULL";if(a(u))return"COLLECTION_UNDEFINED";if(l(u))return u.toString();var d="{",p=!0;for(var g in u)n.has(u,g)&&(p?p=!1:d=d+f,d=d+g+":"+u[g]);return d+"}"}n.makeString=r;function o(u){return typeof u=="function"}n.isFunction=o;function a(u){return typeof u=="undefined"}n.isUndefined=a;function l(u){return Object.prototype.toString.call(u)==="[object String]"}n.isString=l;function h(u){return a(u)||!o(u)?function(f,d){return f<d?1:f===d?0:-1}:function(f,d){return u(f,d)*-1}}n.reverseCompareFunction=h;function c(u){return function(f,d){return u(f,d)===0}}n.compareToEquals=c})(Ke);Object.defineProperty(ke,"__esModule",{value:!0});var Yn=Ke;function Zr(n,t,e){for(var i=e||Yn.defaultEquals,s=n.length,r=0;r<s;r++)if(i(n[r],t))return r;return-1}ke.indexOf=Zr;function Gl(n,t,e){for(var i=e||Yn.defaultEquals,s=n.length,r=s-1;r>=0;r--)if(i(n[r],t))return r;return-1}ke.lastIndexOf=Gl;function Wl(n,t,e){return Zr(n,t,e)>=0}ke.contains=Wl;function Ul(n,t,e){var i=Zr(n,t,e);return i<0?!1:(n.splice(i,1),!0)}ke.remove=Ul;function zl(n,t,e){for(var i=e||Yn.defaultEquals,s=n.length,r=0,o=0;o<s;o++)i(n[o],t)&&r++;return r}ke.frequency=zl;function Hl(n,t,e){var i=e||Yn.defaultEquals;if(n.length!==t.length)return!1;for(var s=n.length,r=0;r<s;r++)if(!i(n[r],t[r]))return!1;return!0}ke.equals=Hl;function Xl(n){return n.concat()}ke.copy=Xl;function Yl(n,t,e){if(t<0||t>=n.length||e<0||e>=n.length)return!1;var i=n[t];return n[t]=n[e],n[e]=i,!0}ke.swap=Yl;function jl(n){return"["+n.toString()+"]"}ke.toString=jl;function Kl(n,t){for(var e=0,i=n;e<i.length;e++){var s=i[e];if(t(s)===!1)return}}ke.forEach=Kl;var Qr={},zi={};Object.defineProperty(zi,"__esModule",{value:!0});var fi=Ke,ql=function(){function n(t){this.table={},this.nElements=0,this.toStr=t||fi.defaultToString}return n.prototype.getValue=function(t){var e=this.table["$"+this.toStr(t)];if(!fi.isUndefined(e))return e.value},n.prototype.setValue=function(t,e){if(!(fi.isUndefined(t)||fi.isUndefined(e))){var i,s="$"+this.toStr(t),r=this.table[s];return fi.isUndefined(r)?(this.nElements++,i=void 0):i=r.value,this.table[s]={key:t,value:e},i}},n.prototype.remove=function(t){var e="$"+this.toStr(t),i=this.table[e];if(!fi.isUndefined(i))return delete this.table[e],this.nElements--,i.value},n.prototype.keys=function(){var t=[];for(var e in this.table)if(fi.has(this.table,e)){var i=this.table[e];t.push(i.key)}return t},n.prototype.values=function(){var t=[];for(var e in this.table)if(fi.has(this.table,e)){var i=this.table[e];t.push(i.value)}return t},n.prototype.forEach=function(t){for(var e in this.table)if(fi.has(this.table,e)){var i=this.table[e],s=t(i.key,i.value);if(s===!1)return}},n.prototype.containsKey=function(t){return!fi.isUndefined(this.getValue(t))},n.prototype.clear=function(){this.table={},this.nElements=0},n.prototype.size=function(){return this.nElements},n.prototype.isEmpty=function(){return this.nElements<=0},n.prototype.toString=function(){var t="{";return this.forEach(function(e,i){t+=`
  2. `+e+" : "+i}),t+`
  3. }`},n}(),Jl=zi.default=ql,jn={};Object.defineProperty(jn,"__esModule",{value:!0});var Zl=Ke,Ql=ke,$l=zi,th=function(){function n(t){this.dictionary=new $l.default(t)}return n.prototype.contains=function(t){return this.dictionary.containsKey(t)},n.prototype.add=function(t){return this.contains(t)||Zl.isUndefined(t)?!1:(this.dictionary.setValue(t,t),!0)},n.prototype.intersection=function(t){var e=this;this.forEach(function(i){return t.contains(i)||e.remove(i),!0})},n.prototype.union=function(t){var e=this;t.forEach(function(i){return e.add(i),!0})},n.prototype.difference=function(t){var e=this;t.forEach(function(i){return e.remove(i),!0})},n.prototype.isSubsetOf=function(t){if(this.size()>t.size())return!1;var e=!0;return this.forEach(function(i){return t.contains(i)?!0:(e=!1,!1)}),e},n.prototype.remove=function(t){return this.contains(t)?(this.dictionary.remove(t),!0):!1},n.prototype.forEach=function(t){this.dictionary.forEach(function(e,i){return t(i)})},n.prototype.toArray=function(){return this.dictionary.values()},n.prototype.isEmpty=function(){return this.dictionary.isEmpty()},n.prototype.size=function(){return this.dictionary.size()},n.prototype.clear=function(){this.dictionary.clear()},n.prototype.toString=function(){return Ql.toString(this.toArray())},n}();jn.default=th;Object.defineProperty(Qr,"__esModule",{value:!0});var or=Ke,eh=zi,ih=jn,sh=function(){function n(t){this.toStrF=t||or.defaultToString,this.dictionary=new eh.default(this.toStrF),this.nElements=0}return n.prototype.add=function(t,e){if(e===void 0&&(e=1),or.isUndefined(t)||e<=0)return!1;if(this.contains(t))this.dictionary.getValue(t).copies+=e;else{var i={value:t,copies:e};this.dictionary.setValue(t,i)}return this.nElements+=e,!0},n.prototype.count=function(t){return this.contains(t)?this.dictionary.getValue(t).copies:0},n.prototype.contains=function(t){return this.dictionary.containsKey(t)},n.prototype.remove=function(t,e){if(e===void 0&&(e=1),or.isUndefined(t)||e<=0)return!1;if(this.contains(t)){var i=this.dictionary.getValue(t);return e>i.copies?this.nElements-=i.copies:this.nElements-=e,i.copies-=e,i.copies<=0&&this.dictionary.remove(t),!0}else return!1},n.prototype.toArray=function(){for(var t=[],e=this.dictionary.values(),i=0,s=e;i<s.length;i++)for(var r=s[i],o=r.value,a=r.copies,l=0;l<a;l++)t.push(o);return t},n.prototype.toSet=function(){for(var t=new ih.default(this.toStrF),e=this.dictionary.values(),i=0,s=e;i<s.length;i++){var r=s[i],o=r.value;t.add(o)}return t},n.prototype.forEach=function(t){this.dictionary.forEach(function(e,i){for(var s=i.value,r=i.copies,o=0;o<r;o++)if(t(s)===!1)return!1;return!0})},n.prototype.size=function(){return this.nElements},n.prototype.isEmpty=function(){return this.nElements===0},n.prototype.clear=function(){this.nElements=0,this.dictionary.clear()},n}();Qr.default=sh;var $r={},Kn={},qn={},Zs={};Object.defineProperty(Zs,"__esModule",{value:!0});var Xi=Ke,nh=ke,rh=function(){function n(){this.firstNode=null,this.lastNode=null,this.nElements=0}return n.prototype.add=function(t,e){if(Xi.isUndefined(e)&&(e=this.nElements),e<0||e>this.nElements||Xi.isUndefined(t))return!1;var i=this.createNode(t);if(this.nElements===0||this.lastNode===null)this.firstNode=i,this.lastNode=i;else if(e===this.nElements)this.lastNode.next=i,this.lastNode=i;else if(e===0)i.next=this.firstNode,this.firstNode=i;else{var s=this.nodeAtIndex(e-1);if(s===null)return!1;i.next=s.next,s.next=i}return this.nElements++,!0},n.prototype.first=function(){if(this.firstNode!==null)return this.firstNode.element},n.prototype.last=function(){if(this.lastNode!==null)return this.lastNode.element},n.prototype.elementAtIndex=function(t){var e=this.nodeAtIndex(t);if(e!==null)return e.element},n.prototype.indexOf=function(t,e){var i=e||Xi.defaultEquals;if(Xi.isUndefined(t))return-1;for(var s=this.firstNode,r=0;s!==null;){if(i(s.element,t))return r;r++,s=s.next}return-1},n.prototype.contains=function(t,e){return this.indexOf(t,e)>=0},n.prototype.remove=function(t,e){var i=e||Xi.defaultEquals;if(this.nElements<1||Xi.isUndefined(t))return!1;for(var s=null,r=this.firstNode;r!==null;){if(i(r.element,t))return s===null?(this.firstNode=r.next,r===this.lastNode&&(this.lastNode=null)):r===this.lastNode?(this.lastNode=s,s.next=r.next,r.next=null):(s.next=r.next,r.next=null),this.nElements--,!0;s=r,r=r.next}return!1},n.prototype.clear=function(){this.firstNode=null,this.lastNode=null,this.nElements=0},n.prototype.equals=function(t,e){var i=e||Xi.defaultEquals;return!(t instanceof n)||this.size()!==t.size()?!1:this.equalsAux(this.firstNode,t.firstNode,i)},n.prototype.equalsAux=function(t,e,i){for(;t!==null&&e!==null;){if(!i(t.element,e.element))return!1;t=t.next,e=e.next}return!0},n.prototype.removeElementAtIndex=function(t){if(!(t<0||t>=this.nElements||this.firstNode===null||this.lastNode===null)){var e;if(this.nElements===1)e=this.firstNode.element,this.firstNode=null,this.lastNode=null;else{var i=this.nodeAtIndex(t-1);i===null?(e=this.firstNode.element,this.firstNode=this.firstNode.next):i.next===this.lastNode&&(e=this.lastNode.element,this.lastNode=i),i!==null&&i.next!==null&&(e=i.next.element,i.next=i.next.next)}return this.nElements--,e}},n.prototype.forEach=function(t){for(var e=this.firstNode;e!==null&&t(e.element)!==!1;)e=e.next},n.prototype.reverse=function(){for(var t=null,e=this.firstNode,i=null;e!==null;)i=e.next,e.next=t,t=e,e=i;i=this.firstNode,this.firstNode=this.lastNode,this.lastNode=i},n.prototype.toArray=function(){for(var t=[],e=this.firstNode;e!==null;)t.push(e.element),e=e.next;return t},n.prototype.size=function(){return this.nElements},n.prototype.isEmpty=function(){return this.nElements<=0},n.prototype.toString=function(){return nh.toString(this.toArray())},n.prototype.nodeAtIndex=function(t){if(t<0||t>=this.nElements)return null;if(t===this.nElements-1)return this.lastNode;for(var e=this.firstNode,i=0;i<t&&e!==null;i++)e=e.next;return e},n.prototype.createNode=function(t){return{element:t,next:null}},n}();Zs.default=rh;Object.defineProperty(qn,"__esModule",{value:!0});var oh=Zs,ah=function(){function n(){this.list=new oh.default}return n.prototype.enqueue=function(t){return this.list.add(t)},n.prototype.add=function(t){return this.list.add(t)},n.prototype.dequeue=function(){if(this.list.size()!==0){var t=this.list.first();return this.list.removeElementAtIndex(0),t}},n.prototype.peek=function(){if(this.list.size()!==0)return this.list.first()},n.prototype.size=function(){return this.list.size()},n.prototype.contains=function(t,e){return this.list.contains(t,e)},n.prototype.isEmpty=function(){return this.list.size()<=0},n.prototype.clear=function(){this.list.clear()},n.prototype.forEach=function(t){this.list.forEach(t)},n}();qn.default=ah;Object.defineProperty(Kn,"__esModule",{value:!0});var ar=Ke,lh=qn,hh=function(){function n(t){this.root=null,this.compare=t||ar.defaultCompare,this.nElements=0}return n.prototype.add=function(t){return ar.isUndefined(t)?!1:this.insertNode(this.createNode(t))!==null?(this.nElements++,!0):!1},n.prototype.clear=function(){this.root=null,this.nElements=0},n.prototype.isEmpty=function(){return this.nElements===0},n.prototype.size=function(){return this.nElements},n.prototype.contains=function(t){return ar.isUndefined(t)?!1:this.searchNode(this.root,t)!==null},n.prototype.search=function(t){var e=this.searchNode(this.root,t);if(e!==null)return e.element},n.prototype.remove=function(t){var e=this.searchNode(this.root,t);return e===null?!1:(this.removeNode(e),this.nElements--,!0)},n.prototype.inorderTraversal=function(t){this.inorderTraversalAux(this.root,t,{stop:!1})},n.prototype.preorderTraversal=function(t){this.preorderTraversalAux(this.root,t,{stop:!1})},n.prototype.postorderTraversal=function(t){this.postorderTraversalAux(this.root,t,{stop:!1})},n.prototype.levelTraversal=function(t){this.levelTraversalAux(this.root,t)},n.prototype.minimum=function(){if(!(this.isEmpty()||this.root===null))return this.minimumAux(this.root).element},n.prototype.maximum=function(){if(!(this.isEmpty()||this.root===null))return this.maximumAux(this.root).element},n.prototype.forEach=function(t){this.inorderTraversal(t)},n.prototype.toArray=function(){var t=[];return this.inorderTraversal(function(e){return t.push(e),!0}),t},n.prototype.height=function(){return this.heightAux(this.root)},n.prototype.searchNode=function(t,e){for(var i=1;t!==null&&i!==0;)i=this.compare(e,t.element),i<0?t=t.leftCh:i>0&&(t=t.rightCh);return t},n.prototype.transplant=function(t,e){t.parent===null?this.root=e:t===t.parent.leftCh?t.parent.leftCh=e:t.parent.rightCh=e,e!==null&&(e.parent=t.parent)},n.prototype.removeNode=function(t){if(t.leftCh===null)this.transplant(t,t.rightCh);else if(t.rightCh===null)this.transplant(t,t.leftCh);else{var e=this.minimumAux(t.rightCh);e.parent!==t&&(this.transplant(e,e.rightCh),e.rightCh=t.rightCh,e.rightCh.parent=e),this.transplant(t,e),e.leftCh=t.leftCh,e.leftCh.parent=e}},n.prototype.inorderTraversalAux=function(t,e,i){t===null||i.stop||(this.inorderTraversalAux(t.leftCh,e,i),!i.stop&&(i.stop=e(t.element)===!1,!i.stop&&this.inorderTraversalAux(t.rightCh,e,i)))},n.prototype.levelTraversalAux=function(t,e){var i=new lh.default;for(t!==null&&i.enqueue(t),t=i.dequeue()||null;t!=null;){if(e(t.element)===!1)return;t.leftCh!==null&&i.enqueue(t.leftCh),t.rightCh!==null&&i.enqueue(t.rightCh),t=i.dequeue()||null}},n.prototype.preorderTraversalAux=function(t,e,i){t===null||i.stop||(i.stop=e(t.element)===!1,!i.stop&&(this.preorderTraversalAux(t.leftCh,e,i),!i.stop&&this.preorderTraversalAux(t.rightCh,e,i)))},n.prototype.postorderTraversalAux=function(t,e,i){t===null||i.stop||(this.postorderTraversalAux(t.leftCh,e,i),!i.stop&&(this.postorderTraversalAux(t.rightCh,e,i),!i.stop&&(i.stop=e(t.element)===!1)))},n.prototype.minimumAux=function(t){for(;t!=null&&t.leftCh!==null;)t=t.leftCh;return t},n.prototype.maximumAux=function(t){for(;t!=null&&t.rightCh!==null;)t=t.rightCh;return t},n.prototype.heightAux=function(t){return t===null?-1:Math.max(this.heightAux(t.leftCh),this.heightAux(t.rightCh))+1},n.prototype.insertNode=function(t){for(var e=null,i=this.root;i!==null;){var s=this.compare(t.element,i.element);if(s===0)return null;s<0?(e=i,i=i.leftCh):(e=i,i=i.rightCh)}return t.parent=e,e===null?this.root=t:this.compare(t.element,e.element)<0?e.leftCh=t:e.rightCh=t,t},n.prototype.createNode=function(t){return{element:t,leftCh:null,rightCh:null,parent:null}},n}();Kn.default=hh;var ch=We&&We.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(t,e){n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}();Object.defineProperty($r,"__esModule",{value:!0});var uh=Kn,fh=function(n){ch(t,n);function t(){return n!==null&&n.apply(this,arguments)||this}return t}(uh.default);$r.default=fh;var Jn={};Object.defineProperty(Jn,"__esModule",{value:!0});var lr=Ke,fn=ke,dh=function(){function n(t){this.data=[],this.compare=t||lr.defaultCompare}return n.prototype.leftChildIndex=function(t){return 2*t+1},n.prototype.rightChildIndex=function(t){return 2*t+2},n.prototype.parentIndex=function(t){return Math.floor((t-1)/2)},n.prototype.minIndex=function(t,e){return e>=this.data.length?t>=this.data.length?-1:t:this.compare(this.data[t],this.data[e])<=0?t:e},n.prototype.siftUp=function(t){for(var e=this.parentIndex(t);t>0&&this.compare(this.data[e],this.data[t])>0;)fn.swap(this.data,e,t),t=e,e=this.parentIndex(t)},n.prototype.siftDown=function(t){for(var e=this.minIndex(this.leftChildIndex(t),this.rightChildIndex(t));e>=0&&this.compare(this.data[t],this.data[e])>0;)fn.swap(this.data,e,t),t=e,e=this.minIndex(this.leftChildIndex(t),this.rightChildIndex(t))},n.prototype.peek=function(){if(this.data.length>0)return this.data[0]},n.prototype.add=function(t){return lr.isUndefined(t)?!1:(this.data.push(t),this.siftUp(this.data.length-1),!0)},n.prototype.removeRoot=function(){if(this.data.length>0){var t=this.data[0];return this.data[0]=this.data[this.data.length-1],this.data.splice(this.data.length-1,1),this.data.length>0&&this.siftDown(0),t}},n.prototype.contains=function(t){var e=lr.compareToEquals(this.compare);return fn.contains(this.data,t,e)},n.prototype.size=function(){return this.data.length},n.prototype.isEmpty=function(){return this.data.length<=0},n.prototype.clear=function(){this.data.length=0},n.prototype.forEach=function(t){fn.forEach(this.data,t)},n}();Jn.default=dh;var to={},ph=We&&We.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(t,e){n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}();Object.defineProperty(to,"__esModule",{value:!0});var mh=zi,as=Ke,gh=function(){function n(t,e){this.key=t,this.value=e}return n.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},n}(),Fo=function(){function n(){this.key=null,this.value=null}return n.prototype.unlink=function(){this.prev.next=this.next,this.next.prev=this.prev},n}();function bh(n){return!n.next}var Sh=function(n){ph(t,n);function t(e){var i=n.call(this,e)||this;return i.head=new Fo,i.tail=new Fo,i.head.next=i.tail,i.tail.prev=i.head,i}return t.prototype.appendToTail=function(e){var i=this.tail.prev;i.next=e,e.prev=i,e.next=this.tail,this.tail.prev=e},t.prototype.getLinkedDictionaryPair=function(e){if(!as.isUndefined(e)){var i="$"+this.toStr(e),s=this.table[i];return s}},t.prototype.getValue=function(e){var i=this.getLinkedDictionaryPair(e);if(!as.isUndefined(i))return i.value},t.prototype.remove=function(e){var i=this.getLinkedDictionaryPair(e);if(!as.isUndefined(i))return n.prototype.remove.call(this,e),i.unlink(),i.value},t.prototype.clear=function(){n.prototype.clear.call(this),this.head.next=this.tail,this.tail.prev=this.head},t.prototype.replace=function(e,i){var s="$"+this.toStr(i.key);i.next=e.next,i.prev=e.prev,this.remove(e.key),i.prev.next=i,i.next.prev=i,this.table[s]=i,++this.nElements},t.prototype.setValue=function(e,i){if(!(as.isUndefined(e)||as.isUndefined(i))){var s=this.getLinkedDictionaryPair(e),r=new gh(e,i),o="$"+this.toStr(e);if(as.isUndefined(s)){this.appendToTail(r),this.table[o]=r,++this.nElements;return}else return this.replace(s,r),s.value}},t.prototype.keys=function(){var e=[];return this.forEach(function(i,s){e.push(i)}),e},t.prototype.values=function(){var e=[];return this.forEach(function(i,s){e.push(s)}),e},t.prototype.forEach=function(e){for(var i=this.head.next;!bh(i);){var s=e(i.key,i.value);if(s===!1)return;i=i.next}},t}(mh.default);to.default=Sh;var eo={};Object.defineProperty(eo,"__esModule",{value:!0});var Bi=Ke,yh=zi,hr=ke,xh=function(){function n(t,e,i){i===void 0&&(i=!1),this.dict=new yh.default(t),this.equalsF=e||Bi.defaultEquals,this.allowDuplicate=i}return n.prototype.getValue=function(t){var e=this.dict.getValue(t);return Bi.isUndefined(e)?[]:hr.copy(e)},n.prototype.setValue=function(t,e){if(Bi.isUndefined(t)||Bi.isUndefined(e))return!1;var i=this.dict.getValue(t);return Bi.isUndefined(i)?(this.dict.setValue(t,[e]),!0):!this.allowDuplicate&&hr.contains(i,e,this.equalsF)?!1:(i.push(e),!0)},n.prototype.remove=function(t,e){if(Bi.isUndefined(e)){var i=this.dict.remove(t);return!Bi.isUndefined(i)}var s=this.dict.getValue(t);return!Bi.isUndefined(s)&&hr.remove(s,e,this.equalsF)?(s.length===0&&this.dict.remove(t),!0):!1},n.prototype.keys=function(){return this.dict.keys()},n.prototype.values=function(){for(var t=this.dict.values(),e=[],i=0,s=t;i<s.length;i++)for(var r=s[i],o=0,a=r;o<a.length;o++){var l=a[o];e.push(l)}return e},n.prototype.containsKey=function(t){return this.dict.containsKey(t)},n.prototype.clear=function(){this.dict.clear()},n.prototype.size=function(){return this.dict.size()},n.prototype.isEmpty=function(){return this.dict.isEmpty()},n}();eo.default=xh;var Zn={},vh=We&&We.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])};return function(t,e){n(t,e);function i(){this.constructor=t}t.prototype=e===null?Object.create(e):(i.prototype=e.prototype,new i)}}();Object.defineProperty(Zn,"__esModule",{value:!0});var _h=zi,wh=Ke,Eh=function(n){vh(t,n);function t(e,i){var s=n.call(this,i)||this;return s.defaultFactoryFunction=e,s}return t.prototype.setDefault=function(e,i){var s=n.prototype.getValue.call(this,e);return wh.isUndefined(s)?(this.setValue(e,i),i):s},t.prototype.getValue=function(e){return this.setDefault(e,this.defaultFactoryFunction())},t}(_h.default);Zn.default=Eh;var io={};Object.defineProperty(io,"__esModule",{value:!0});var Mh=Ke,Ph=Jn,Lh=function(){function n(t){this.heap=new Ph.default(Mh.reverseCompareFunction(t))}return n.prototype.enqueue=function(t){return this.heap.add(t)},n.prototype.add=function(t){return this.heap.add(t)},n.prototype.dequeue=function(){if(this.heap.size()!==0){var t=this.heap.peek();return this.heap.removeRoot(),t}},n.prototype.peek=function(){return this.heap.peek()},n.prototype.contains=function(t){return this.heap.contains(t)},n.prototype.isEmpty=function(){return this.heap.isEmpty()},n.prototype.size=function(){return this.heap.size()},n.prototype.clear=function(){this.heap.clear()},n.prototype.forEach=function(t){this.heap.forEach(t)},n}();io.default=Lh;var so={};Object.defineProperty(so,"__esModule",{value:!0});var Th=Zs,Ch=function(){function n(){this.list=new Th.default}return n.prototype.push=function(t){return this.list.add(t,0)},n.prototype.add=function(t){return this.list.add(t,0)},n.prototype.pop=function(){return this.list.removeElementAtIndex(0)},n.prototype.peek=function(){return this.list.first()},n.prototype.size=function(){return this.list.size()},n.prototype.contains=function(t,e){return this.list.contains(t,e)},n.prototype.isEmpty=function(){return this.list.isEmpty()},n.prototype.clear=function(){this.list.clear()},n.prototype.forEach=function(t){this.list.forEach(t)},n}();so.default=Ch;var no={};Object.defineProperty(no,"__esModule",{value:!0});var de;(function(n){n[n.BEFORE=0]="BEFORE",n[n.AFTER=1]="AFTER",n[n.INSIDE_AT_END=2]="INSIDE_AT_END",n[n.INSIDE_AT_START=3]="INSIDE_AT_START"})(de||(de={}));var Rh=function(){function n(t,e){t===void 0&&(t=[]),e===void 0&&(e={}),this.rootIds=t,this.nodes=e,this.initRootIds(),this.initNodes()}return n.prototype.initRootIds=function(){for(var t=0,e=this.rootIds;t<e.length;t++){var i=e[t];this.createEmptyNodeIfNotExist(i)}},n.prototype.initNodes=function(){for(var t in this.nodes)if(this.nodes.hasOwnProperty(t))for(var e=0,i=this.nodes[t];e<i.length;e++){var s=i[e];this.createEmptyNodeIfNotExist(s)}},n.prototype.createEmptyNodeIfNotExist=function(t){this.nodes[t]||(this.nodes[t]=[])},n.prototype.getRootIds=function(){var t=this.rootIds.slice();return t},n.prototype.getNodes=function(){var t={};for(var e in this.nodes)this.nodes.hasOwnProperty(e)&&(t[e]=this.nodes[e].slice());return t},n.prototype.getObject=function(){return{rootIds:this.getRootIds(),nodes:this.getNodes()}},n.prototype.toObject=function(){return this.getObject()},n.prototype.flatten=function(){for(var t=this,e=[],i=0;i<this.rootIds.length;i++){var s=this.rootIds[i];e.push({id:s,level:0,hasParent:!1,childrenCount:0}),h(s,this.nodes,e,0)}for(var r=0,o=e;r<o.length;r++){var a=o[r];a.childrenCount=l(a.id)}return e;function l(c){if(t.nodes[c]){var u=t.nodes[c].length;return u}else return 0}function h(c,u,f,d){if(d===void 0&&(d=0),!(!c||!u||!f||!u[c])){d++;for(var p=u[c],g=0;g<p.length;g++){var m=p[g];f.push({id:m,level:d,hasParent:!0}),h(m,u,f,d)}d--}}},n.prototype.moveIdBeforeId=function(t,e){return this.moveId(t,e,de.BEFORE)},n.prototype.moveIdAfterId=function(t,e){return this.moveId(t,e,de.AFTER)},n.prototype.moveIdIntoId=function(t,e,i){return i===void 0&&(i=!0),i?this.moveId(t,e,de.INSIDE_AT_START):this.moveId(t,e,de.INSIDE_AT_END)},n.prototype.swapRootIdWithRootId=function(t,e){var i=this.findRootId(t),s=this.findRootId(e);this.swapRootPositionWithRootPosition(i,s)},n.prototype.swapRootPositionWithRootPosition=function(t,e){var i=this.rootIds[e];this.rootIds[e]=this.rootIds[t],this.rootIds[t]=i},n.prototype.deleteId=function(t){this.rootDeleteId(t),this.nodeAndSubNodesDelete(t),this.nodeRefrencesDelete(t)},n.prototype.insertIdBeforeId=function(t,e){var i=this.findRootId(t);i>-1&&this.insertIdIntoRoot(e,i);for(var s in this.nodes)if(this.nodes.hasOwnProperty(s)){var r=this.findNodeId(s,t);r>-1&&this.insertIdIntoNode(s,e,r)}},n.prototype.insertIdAfterId=function(t,e){var i=this.findRootId(t);i>-1&&this.insertIdIntoRoot(e,i+1);for(var s in this.nodes)if(this.nodes.hasOwnProperty(s)){var r=this.findNodeId(s,t);r>-1&&this.insertIdIntoNode(s,e,r+1)}},n.prototype.insertIdIntoId=function(t,e){this.nodeInsertAtEnd(t,e),this.nodes[e]=[]},n.prototype.insertIdIntoRoot=function(t,e){if(e===void 0)this.rootInsertAtEnd(t);else if(e<0){var i=this.rootIds.length;this.rootIds.splice(e+i+1,0,t)}else this.rootIds.splice(e,0,t);this.nodes[t]=this.nodes[t]||[]},n.prototype.insertIdIntoNode=function(t,e,i){if(this.nodes[t]=this.nodes[t]||[],this.nodes[e]=this.nodes[e]||[],i===void 0)this.nodeInsertAtEnd(t,e);else if(i<0){var s=this.nodes[t].length;this.nodes[t].splice(i+s+1,0,e)}else this.nodes[t].splice(i,0,e)},n.prototype.moveId=function(t,e,i){var s=t,r=this.findRootId(s);this.nodes[e];for(var o in this.nodes)if(this.nodes.hasOwnProperty(o)){this.findNodeId(o,e);break}var a=e,l=this.findRootId(a);this.nodes[e];for(var o in this.nodes)if(this.nodes.hasOwnProperty(o)){this.findNodeId(o,e);break}if(r>-1)if(l>-1)switch(this.rootDelete(r),l>r&&l--,i){case de.BEFORE:this.insertIdIntoRoot(s,l);break;case de.AFTER:this.insertIdIntoRoot(s,l+1);break;case de.INSIDE_AT_START:this.nodeInsertAtStart(a,s);break;case de.INSIDE_AT_END:this.nodeInsertAtEnd(a,s);break}else{this.rootDelete(r);for(var o in this.nodes)if(this.nodes.hasOwnProperty(o)){var h=this.findNodeId(o,a);if(h>-1){switch(i){case de.BEFORE:this.insertIdIntoNode(o,s,h);break;case de.AFTER:this.insertIdIntoNode(o,s,h+1);break;case de.INSIDE_AT_START:this.nodeInsertAtStart(a,s);break;case de.INSIDE_AT_END:this.nodeInsertAtEnd(a,s);break}break}}}else if(l>-1){for(var o in this.nodes)if(this.nodes.hasOwnProperty(o)){var h=this.findNodeId(o,s);if(h>-1){this.nodeDeleteAtIndex(o,h);break}}switch(i){case de.BEFORE:this.insertIdIntoRoot(s,l);break;case de.AFTER:this.insertIdIntoRoot(s,l+1);break;case de.INSIDE_AT_START:this.nodeInsertAtStart(a,s);break;case de.INSIDE_AT_END:this.nodeInsertAtEnd(a,s);break}}else{for(var o in this.nodes)if(this.nodes.hasOwnProperty(o)){var h=this.findNodeId(o,s);if(h>-1){this.nodeDeleteAtIndex(o,h);break}}for(var o in this.nodes)if(this.nodes.hasOwnProperty(o)){var h=this.findNodeId(o,a);if(h>-1){switch(i){case de.BEFORE:this.insertIdIntoNode(o,s,h);break;case de.AFTER:this.insertIdIntoNode(o,s,h+1);break;case de.INSIDE_AT_START:this.nodeInsertAtStart(a,s);break;case de.INSIDE_AT_END:this.nodeInsertAtEnd(a,s);break}break}}}},n.prototype.swapArrayElements=function(t,e,i){var s=t[e];return t[e]=t[i],t[i]=s,t},n.prototype.rootDeleteId=function(t){var e=this.findRootId(t);e>-1&&this.rootDelete(e)},n.prototype.nodeAndSubNodesDelete=function(t){for(var e=[],i=0;i<this.nodes[t].length;i++){var s=this.nodes[t][i];this.nodeAndSubNodesDelete(s),e.push(t)}this.nodeDelete(t);for(var i=0;i<e.length;i++)this.nodeDelete(e[i])},n.prototype.nodeRefrencesDelete=function(t){for(var e in this.nodes)if(this.nodes.hasOwnProperty(e))for(var i=0;i<this.nodes[e].length;i++){var s=this.nodes[e][i];s===t&&this.nodeDeleteAtIndex(e,i)}},n.prototype.nodeDelete=function(t){delete this.nodes[t]},n.prototype.findRootId=function(t){return this.rootIds.indexOf(t)},n.prototype.findNodeId=function(t,e){return this.nodes[t].indexOf(e)},n.prototype.findNode=function(t){return this.nodes[t]},n.prototype.nodeInsertAtStart=function(t,e){this.nodes[t].unshift(e)},n.prototype.nodeInsertAtEnd=function(t,e){this.nodes[t].push(e)},n.prototype.rootDelete=function(t){this.rootIds.splice(t,1)},n.prototype.nodeDeleteAtIndex=function(t,e){this.nodes[t].splice(e,1)},n.prototype.rootInsertAtStart=function(t){this.rootIds.unshift(t)},n.prototype.rootInsertAtEnd=function(t){this.rootIds.push(t)},n}();no.default=Rh;Object.defineProperty(Me,"__esModule",{value:!0});var Nh=ke;Me.arrays=Nh;var Ah=Qr;Me.Bag=Ah.default;var Ih=$r;Me.BSTree=Ih.default;var kh=Kn;Me.BSTreeKV=kh.default;var Bh=zi,Ye=Me.Dictionary=Bh.default,Dh=Jn;Me.Heap=Dh.default;var Fh=to;Me.LinkedDictionary=Fh.default;var Oh=Zs;Me.LinkedList=Oh.default;var Vh=eo;Me.MultiDictionary=Vh.default;var Gh=Zn;Me.FactoryDictionary=Gh.default;var Wh=Zn;Me.DefaultDictionary=Wh.default;var Uh=qn;Me.Queue=Uh.default;var zh=io;Me.PriorityQueue=zh.default;var Hh=jn;Me.Set=Hh.default;var Xh=so;Me.Stack=Xh.default;var Yh=no;Me.MultiRootTree=Yh.default;var jh=Ke;Me.util=jh;const $t=class extends Ii{constructor(n,t,e,i,s){super(e),super.parentMeasure=s,this.dynamicEnum=ie[n.toLowerCase()],this.soundDynamic=t,this.staffNumber=i}static staticConstructor(){$t.dynamicToRelativeVolumeDict.setValue(ie.ffffff,127/127),$t.dynamicToRelativeVolumeDict.setValue(ie.fffff,126/127),$t.dynamicToRelativeVolumeDict.setValue(ie.ffff,125/127),$t.dynamicToRelativeVolumeDict.setValue(ie.fff,124/127),$t.dynamicToRelativeVolumeDict.setValue(ie.ff,122/127),$t.dynamicToRelativeVolumeDict.setValue(ie.f,108/127),$t.dynamicToRelativeVolumeDict.setValue(ie.mf,76/127),$t.dynamicToRelativeVolumeDict.setValue(ie.sf,.5),$t.dynamicToRelativeVolumeDict.setValue(ie.sfp,.5),$t.dynamicToRelativeVolumeDict.setValue(ie.sfpp,.5),$t.dynamicToRelativeVolumeDict.setValue(ie.fp,.5),$t.dynamicToRelativeVolumeDict.setValue(ie.rf,.5),$t.dynamicToRelativeVolumeDict.setValue(ie.rfz,.5),$t.dynamicToRelativeVolumeDict.setValue(ie.sfz,.5),$t.dynamicToRelativeVolumeDict.setValue(ie.sffz,.5),$t.dynamicToRelativeVolumeDict.setValue(ie.fz,.5),$t.dynamicToRelativeVolumeDict.setValue(ie.mp,60/127),$t.dynamicToRelativeVolumeDict.setValue(ie.p,28/127),$t.dynamicToRelativeVolumeDict.setValue(ie.pp,12/127),$t.dynamicToRelativeVolumeDict.setValue(ie.ppp,10/127),$t.dynamicToRelativeVolumeDict.setValue(ie.pppp,7/127),$t.dynamicToRelativeVolumeDict.setValue(ie.ppppp,5/127),$t.dynamicToRelativeVolumeDict.setValue(ie.pppppp,4/127)}get ParentMultiExpression(){return this.multiExpression}set ParentMultiExpression(n){this.multiExpression=n}get DynEnum(){return this.dynamicEnum}set DynEnum(n){this.dynamicEnum=n}get SoundDynamic(){return this.soundDynamic}set SoundDynamic(n){this.soundDynamic=n}get Placement(){return this.placement}set Placement(n){this.placement=n}get StaffNumber(){return this.staffNumber}set StaffNumber(n){this.staffNumber=n}get Length(){return Math.abs(this.length)<1e-4&&(this.length=this.calculateLength()),this.length}get MidiVolume(){return this.Volume*127}get Volume(){return $t.dynamicToRelativeVolumeDict.getValue(this.dynamicEnum)}static isInputStringInstantaneousDynamic(n){return n?$t.isStringInStringList($t.listInstantaneousDynamics,n):!1}getDynamicExpressionSymbol(n){switch(n){case"p":return Ki.p;case"f":return Ki.f;case"s":return Ki.s;case"z":return Ki.z;case"m":return Ki.m;case"r":return Ki.r;default:throw new Vl("unknown DynamicExpressionSymbolEnum: "+n)}}calculateLength(){return j.debug("[Andrea] instantaneousDynamicExpression: not implemented: calculateLength!"),0}};let Ai=$t;Ai.dynamicToRelativeVolumeDict=new Ye;Ai.listInstantaneousDynamics=["pppppp","ppppp","pppp","ppp","pp","p","ffffff","fffff","ffff","fff","ff","f","mf","mp","sf","sff","sp","spp","fp","rf","rfz","sfz","sffz","fz"];var ie=(n=>(n[n.pppppp=0]="pppppp",n[n.ppppp=1]="ppppp",n[n.pppp=2]="pppp",n[n.ppp=3]="ppp",n[n.pp=4]="pp",n[n.p=5]="p",n[n.mp=6]="mp",n[n.mf=7]="mf",n[n.f=8]="f",n[n.ff=9]="ff",n[n.fff=10]="fff",n[n.ffff=11]="ffff",n[n.fffff=12]="fffff",n[n.ffffff=13]="ffffff",n[n.sf=14]="sf",n[n.sff=15]="sff",n[n.sfp=16]="sfp",n[n.sfpp=17]="sfpp",n[n.fp=18]="fp",n[n.rf=19]="rf",n[n.rfz=20]="rfz",n[n.sfz=21]="sfz",n[n.sffz=22]="sffz",n[n.fz=23]="fz",n[n.other=24]="other",n))(ie||{});Ai.staticConstructor();class Pi{constructor(t,e){t instanceof ei?this.continuousDynamicExpression=t:t instanceof Ai&&(this.instantaneousDynamicExpression=t),this.staffNumber=e}static Compare(t,e){return t.parMultiExpression().AbsoluteTimestamp.CompareTo(e.parMultiExpression().AbsoluteTimestamp)}parMultiExpression(){if(this.continuousDynamicExpression)return this.continuousDynamicExpression.StartMultiExpression;if(this.instantaneousDynamicExpression)return this.instantaneousDynamicExpression.ParentMultiExpression}}class ro{constructor(t){this.printObject=!0,this.parent=t}get Parent(){return this.parent}set Parent(t){this.parent=t}get PrintObject(){return this.printObject}set PrintObject(t){this.printObject=t}}class Ae extends ro{constructor(t,e){super(void 0),this.rhythm=t,this.numerator=t.Numerator,this.denominator=t.Denominator,this.symbolEnum=e}get Rhythm(){return this.rhythm}set Rhythm(t){this.rhythm=t}get SymbolEnum(){return this.symbolEnum}set SymbolEnum(t){this.symbolEnum=t}clone(){return new Ae(this.rhythm.clone(),this.symbolEnum)}OperatorEquals(t){const e=this;return e===t?!0:!e||!t?!1:e.numerator===t.numerator&&e.denominator===t.denominator}OperatorNotEqual(t){return this!==t}ToString(){return"Rhythm: "+this.rhythm.toString()}}var ii=(n=>(n[n.NONE=0]="NONE",n[n.COMMON=1]="COMMON",n[n.CUT=2]="CUT",n))(ii||{});class Ss{constructor(t,e,i){this.currentMeasureIndex=0,this.currentPartIndex=0,this.currentVoiceEntryIndex=-1,this.currentDynamicEntryIndex=0,this.currentTempoEntryIndex=0,this.currentDynamicChangingExpressions=[],this.repetitionIterationCountDictKeys=[],this.repetitionIterationCountDictValues=[],this.currentRepetition=void 0,this.endReached=!1,this.frontReached=!1,this.currentTimeStamp=new W(0,1),this.currentEnrolledMeasureTimestamp=new W(0,1),this.currentRelativeInMeasureTimestamp=new W(0,1),this.currentVerticalContainerInMeasureTimestamp=new W(0,1),this.jumpResponsibleRepetition=void 0,this.activeDynamicExpressions=[];try{this.frontReached=!0,this.musicSheet=t,this.currentBpm=t.userStartTempoInBPM,this.currentVoiceEntries=void 0,this.frontReached=!1;for(const s of this.musicSheet.Repetitions)this.setRepetitionIterationCount(s,1);for(let s=0;s<t.getCompleteNumberOfStaves();s++)this.ActiveDynamicExpressions.push(void 0);this.currentMeasure=this.musicSheet.SourceMeasures[0],e||(e=new W);do this.moveToNext();while((!this.currentVoiceEntries||this.currentTimeStamp.lt(e))&&!this.endReached);for(let s=0;s<this.activeDynamicExpressions.length;s++)if(this.activeDynamicExpressions[s])if(this.activeDynamicExpressions[s]instanceof ei){const r=this.activeDynamicExpressions[s];this.currentDynamicChangingExpressions.push(new Pi(r,s))}else{const r=this.activeDynamicExpressions[s];this.currentDynamicChangingExpressions.push(new Pi(r,s))}this.currentTempoChangingExpression=this.activeTempoExpression}catch(s){j.info("MusicPartManagerIterator: "+s)}}get EndReached(){return this.endReached}get FrontReached(){return this.frontReached}get CurrentMeasure(){return this.currentMeasure}get CurrentRepetition(){return this.currentRepetition}get CurrentRepetitionIteration(){return this.CurrentRepetition?this.getRepetitionIterationCount(this.CurrentRepetition):0}get CurrentJumpResponsibleRepetitionIterationBeforeJump(){return this.jumpResponsibleRepetition?this.getRepetitionIterationCount(this.jumpResponsibleRepetition)-1:0}get CurrentBpm(){return this.currentBpm}get CurrentVoiceEntries(){return this.currentVoiceEntries}get CurrentMeasureIndex(){return this.currentMeasureIndex}get CurrentEnrolledTimestamp(){return W.plus(this.currentEnrolledMeasureTimestamp,this.currentVerticalContainerInMeasureTimestamp)}get CurrentSourceTimestamp(){return this.currentTimeStamp}get CurrentRelativeInMeasureTimestamp(){return this.currentRelativeInMeasureTimestamp}get JumpOccurred(){return this.backJumpOccurred||this.forwardJumpOccurred}get ActiveTempoExpression(){return this.activeTempoExpression}get ActiveDynamicExpressions(){return this.activeDynamicExpressions}get CurrentTempoChangingExpression(){return this.currentTempoChangingExpression}get JumpResponsibleRepetition(){return this.jumpResponsibleRepetition}clone(t=void 0,e=void 0){const i=new Ss(this.musicSheet,t!=null?t:this.currentTimeStamp,e);return i.currentVoiceEntryIndex=this.currentVoiceEntryIndex,i.currentMappingPart=this.currentMappingPart,i.currentPartIndex=this.currentPartIndex,i.currentVoiceEntries=this.currentVoiceEntries,i.endReached=this.endReached,i.frontReached=this.frontReached,i}CurrentVisibleVoiceEntries(t){const e=[];if(!this.currentVoiceEntries)return e;if(t){for(const i of this.currentVoiceEntries)if(i.ParentVoice.Parent.IdString===t.IdString)return this.getVisibleEntries(i,e),e}else for(const i of this.currentVoiceEntries)this.getVisibleEntries(i,e);return e}CurrentAudibleVoiceEntries(t){const e=[];if(this.currentVoiceEntries)if(t){for(const i of this.currentVoiceEntries)if(i.ParentVoice.Parent.IdString===t.IdString)return this.getAudibleEntries(i,e),e}else for(const i of this.currentVoiceEntries)this.getAudibleEntries(i,e);return e}getCurrentDynamicChangingExpressions(){return this.currentDynamicChangingExpressions}CurrentScoreFollowingVoiceEntries(t){const e=[];if(!this.currentVoiceEntries)return e;if(t){for(const i of this.currentVoiceEntries)if(i.ParentVoice.Parent.IdString===t.IdString)return this.getScoreFollowingEntries(i,e),e}else for(const i of this.currentVoiceEntries)this.getScoreFollowingEntries(i,e);return e}currentPlaybackSettings(){return this.musicSheet.SheetPlaybackSetting}moveToNext(){this.forwardJumpOccurred=this.backJumpOccurred=!1,!this.endReached&&(this.currentVoiceEntries&&(this.currentVoiceEntries.length=0),this.recursiveMove(),this.currentMeasure||(this.currentTimeStamp=new W(99999,1)),this.CurrentTempoChangingExpression!==void 0&&(this.CurrentTempoChangingExpression.ContinuousTempo!==void 0?this.currentBpm=this.CurrentTempoChangingExpression.ContinuousTempo.getInterpolatedTempo(this.CurrentSourceTimestamp):this.currentBpm=this.CurrentTempoChangingExpression.InstantaneousTempo.TempoInBpm))}moveToNextVisibleVoiceEntry(t){for(;!this.endReached;)if(this.moveToNext(),this.checkEntries(t))return}resetRepetitionIterationCount(t){return 1}incrementRepetitionIterationCount(t){return this.repetitionIterationCountDictKeys.indexOf(t)===-1?this.setRepetitionIterationCount(t,1):this.setRepetitionIterationCount(t,this.getRepetitionIterationCount(t)+1)}setRepetitionIterationCount(t,e){const i=this.repetitionIterationCountDictKeys.indexOf(t);return i===-1?(this.repetitionIterationCountDictKeys.push(t),this.repetitionIterationCountDictValues.push(e)):this.repetitionIterationCountDictValues[i]=e,e}getRepetitionIterationCount(t){const e=this.repetitionIterationCountDictKeys.indexOf(t);if(e!==-1)return this.repetitionIterationCountDictValues[e]}handleRepetitionsAtMeasureBegin(){for(let t=0,e=this.currentMeasure.FirstRepetitionInstructions.length;t<e;++t){const i=this.currentMeasure.FirstRepetitionInstructions[t];if(!i.parentRepetition)continue;const s=i.parentRepetition;this.currentRepetition=s,s.StartIndex===this.currentMeasureIndex&&this.JumpResponsibleRepetition!==void 0&&s!==this.JumpResponsibleRepetition&&s.StartIndex>=this.JumpResponsibleRepetition.StartIndex&&s.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(s)}}handleRepetitionsAtMeasureEnd(){for(let t=0,e=this.currentMeasure.LastRepetitionInstructions.length;t<e;++t){const i=this.currentMeasure.LastRepetitionInstructions[t],s=i.parentRepetition;if(!!s){if(s.BackwardJumpInstructions.indexOf(i)>-1&&this.getRepetitionIterationCount(s)<s.UserNumberOfRepetitions){this.doBackJump(s);return}if(i===s.forwardJumpInstruction&&(this.JumpResponsibleRepetition!==void 0&&s!==this.JumpResponsibleRepetition&&s.StartIndex>=this.JumpResponsibleRepetition.StartIndex&&s.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(s),this.repetitionIterationCountDictKeys.contains(s))){const r=s.getForwardJumpTargetForIteration(this.getRepetitionIterationCount(s));if(r>=0){this.currentMeasureIndex=r,this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentVoiceEntryIndex=-1,this.jumpResponsibleRepetition=s,this.forwardJumpOccurred=!0;return}r===-2&&(this.endReached=!0)}}}this.currentMeasureIndex++,this.JumpResponsibleRepetition!==void 0&&this.currentMeasureIndex>this.JumpResponsibleRepetition.EndIndex&&(this.jumpResponsibleRepetition=void 0)}doBackJump(t){this.currentMeasureIndex=t.getBackwardJumpTarget(),this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentVoiceEntryIndex=-1,this.incrementRepetitionIterationCount(t),this.jumpResponsibleRepetition=t,this.backJumpOccurred=!0}activateCurrentRhythmInstructions(){if(this.currentMeasure!==void 0&&this.currentMeasure.FirstInstructionsStaffEntries.length>0&&this.currentMeasure.FirstInstructionsStaffEntries[0]!==void 0){const t=this.currentMeasure.FirstInstructionsStaffEntries[0].Instructions;for(let e=0,i=t.length;e<i;++e){const s=t[e];s instanceof Ae&&(this.musicSheet.SheetPlaybackSetting.rhythm=s.Rhythm)}}}activateCurrentDynamicOrTempoInstructions(){const t=this.musicSheet.TimestampSortedDynamicExpressionsList;for(;this.currentDynamicEntryIndex>0&&(this.currentDynamicEntryIndex>=t.length||t[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp.gte(this.CurrentSourceTimestamp));)this.currentDynamicEntryIndex--;for(;this.currentDynamicEntryIndex<t.length&&t[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp.lt(this.CurrentSourceTimestamp);)this.currentDynamicEntryIndex++;for(;this.currentDynamicEntryIndex<t.length&&t[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp.Equals(this.CurrentSourceTimestamp);){const i=t[this.currentDynamicEntryIndex],s=i.staffNumber;this.CurrentSourceTimestamp.Equals(i.parMultiExpression().AbsoluteTimestamp)&&(i.continuousDynamicExpression?this.activeDynamicExpressions[s]=i.continuousDynamicExpression:i.instantaneousDynamicExpression&&(this.activeDynamicExpressions[s]=i.instantaneousDynamicExpression)),this.currentDynamicEntryIndex++}this.currentDynamicChangingExpressions.length=0;for(let i=0;i<this.activeDynamicExpressions.length;i++)if(this.activeDynamicExpressions[i]){let s,r;if(this.activeDynamicExpressions[i]instanceof ei){const o=this.activeDynamicExpressions[i];s=o.StartMultiExpression.AbsoluteTimestamp,r=o.EndMultiExpression.AbsoluteTimestamp,this.CurrentSourceTimestamp.gte(s)&&this.CurrentSourceTimestamp.lte(r)&&this.currentDynamicChangingExpressions.push(new Pi(o,i))}else{const o=this.activeDynamicExpressions[i];this.CurrentSourceTimestamp.Equals(o.ParentMultiExpression.AbsoluteTimestamp)&&this.currentDynamicChangingExpressions.push(new Pi(o,i))}}const e=this.musicSheet.TimestampSortedTempoExpressionsList;for(;this.currentTempoEntryIndex>0&&(this.currentTempoEntryIndex>=e.length||e[this.currentTempoEntryIndex].AbsoluteTimestamp.gte(this.CurrentSourceTimestamp));)this.currentTempoEntryIndex--;for(;this.currentTempoEntryIndex<e.length&&e[this.currentTempoEntryIndex].AbsoluteTimestamp.lt(this.CurrentSourceTimestamp);)this.currentTempoEntryIndex++;for(;this.currentTempoEntryIndex<e.length&&e[this.currentTempoEntryIndex].AbsoluteTimestamp.Equals(this.CurrentSourceTimestamp);)this.activeTempoExpression=e[this.currentTempoEntryIndex],this.currentTempoEntryIndex++;if(this.currentTempoChangingExpression=void 0,this.activeTempoExpression){let i=this.activeTempoExpression.AbsoluteTimestamp;this.activeTempoExpression.ContinuousTempo&&(i=this.activeTempoExpression.ContinuousTempo.AbsoluteEndTimestamp),(this.CurrentSourceTimestamp.gte(this.activeTempoExpression.AbsoluteTimestamp)||this.CurrentSourceTimestamp.lte(i))&&(this.currentTempoChangingExpression=this.activeTempoExpression)}}recursiveMove(){if(this.currentVoiceEntryIndex++,this.currentVoiceEntryIndex===0&&(this.handleRepetitionsAtMeasureBegin(),this.activateCurrentRhythmInstructions()),this.currentVoiceEntryIndex>=0&&this.currentVoiceEntryIndex<this.currentMeasure.VerticalSourceStaffEntryContainers.length){const t=this.currentMeasure.VerticalSourceStaffEntryContainers[this.currentVoiceEntryIndex];this.currentVoiceEntries=this.getVoiceEntries(t),this.currentVerticalContainerInMeasureTimestamp=t.Timestamp,this.currentTimeStamp=W.plus(this.currentMeasure.AbsoluteTimestamp,this.currentVerticalContainerInMeasureTimestamp);const e=this.musicSheet.SelectionEnd;e&&this.currentTimeStamp.gte(e)&&(this.endReached=!0),this.activateCurrentDynamicOrTempoInstructions();return}if(this.currentEnrolledMeasureTimestamp.Add(this.currentMeasure.Duration),this.handleRepetitionsAtMeasureEnd(),this.currentMeasureIndex>=0&&this.currentMeasureIndex<this.musicSheet.SourceMeasures.length){this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentTimeStamp=W.plus(this.currentMeasure.AbsoluteTimestamp,this.currentVerticalContainerInMeasureTimestamp),this.currentVoiceEntryIndex=-1,this.recursiveMove();return}this.currentVerticalContainerInMeasureTimestamp=new W,this.currentMeasure=void 0,this.currentVoiceEntries=void 0,this.endReached=!0}checkEntries(t){const e=this.CurrentVisibleVoiceEntries();if(e.length>0){if(!t)return!0;for(let i=0,s=e.length;i<s;++i)if(e[i].Notes[0].Pitch)return!0}return!1}getVisibleEntries(t,e){t.ParentVoice.Visible&&e.push(t)}getAudibleEntries(t,e){if(t.hasTie()){const i=t.Notes[0];if(i.NoteTie!==void 0&&i.NoteTie.StartNote!==i)return}t.ParentVoice.Audible&&e.push(t)}getScoreFollowingEntries(t,e){t.ParentVoice.Following&&t.ParentVoice.Parent.Following&&e.push(t)}getVoiceEntries(t){var i,s;const e=[];for(const r of t.StaffEntries)(s=(i=r==null?void 0:r.ParentStaff)==null?void 0:i.ParentInstrument)!=null&&s.Visible&&r.VoiceEntries[0]&&e.push(...r.VoiceEntries);return e}}class Kh{constructor(t,e,i){this.hidden=!1,this.currentPageNumber=1,this.container=t,this.openSheetMusicDisplay=e,this.rules=this.openSheetMusicDisplay.EngravingRules,this.cursorOptions=i;let s=0;for(this.cursorElementId="cursorImg-0";document.getElementById(this.cursorElementId);)s++,this.cursorElementId=`cursorImg-${s}`;const r=document.createElement("img");r.id=this.cursorElementId,r.style.position="absolute",this.cursorOptions.follow===!0?(this.wantedZIndex="-1",r.style.zIndex=this.wantedZIndex):(this.wantedZIndex="-2",r.style.zIndex=this.wantedZIndex),this.cursorElement=r,this.container.appendChild(r)}cursorPositionChanged(t,e){for(;this.iterator.CurrentEnrolledTimestamp.lt(t);)this.iterator.moveToNext();this.iterator.CurrentEnrolledTimestamp.gt(t)&&(this.iterator=new Ss(this.manager.MusicSheet,t)),this.updateWithTimestamp(e.PredictedPosition)}pauseOccurred(t){}setSound(){}selectionEndReached(t){}resetOccurred(t){this.reset()}notesPlaybackEventOccurred(t){}adjustToBackgroundColor(){let t;this.rules.PageBackgroundColor?t="1":t=this.wantedZIndex,this.cursorElement.style.zIndex=t}init(t,e){this.manager=t,this.graphic=e,this.reset(),this.hidden=!1}show(){this.hidden=!1,this.update(),this.adjustToBackgroundColor()}resetIterator(){if(!this.openSheetMusicDisplay.Sheet||!this.openSheetMusicDisplay.Sheet.SourceMeasures){console.log("OSMD.Cursor.resetIterator(): sheet or measures were null/undefined.");return}const t=this.openSheetMusicDisplay.Sheet.SourceMeasures.length-1;let e=this.rules.MinMeasureToDrawIndex;e=Math.min(e,t);let i=this.rules.MaxMeasureToDrawIndex;if(i=Math.min(i,t),this.openSheetMusicDisplay.Sheet&&(!this.openSheetMusicDisplay.Sheet.SelectionStart||this.openSheetMusicDisplay.Sheet.SelectionStart.WholeValue<e)&&this.openSheetMusicDisplay.Sheet.SourceMeasures.length>e&&(this.openSheetMusicDisplay.Sheet.SelectionStart=this.openSheetMusicDisplay.Sheet.SourceMeasures[e].AbsoluteTimestamp),this.openSheetMusicDisplay.Sheet&&this.openSheetMusicDisplay.Sheet.SourceMeasures.length>i){const r=this.openSheetMusicDisplay.Sheet.SourceMeasures[i];this.openSheetMusicDisplay.Sheet.SelectionEnd=W.plus(r.AbsoluteTimestamp,r.Duration)}this.iterator=this.manager.getIterator()}getStaffEntryFromVoiceEntry(t){const e=t.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.measureListIndex,i=t.ParentSourceStaffEntry.ParentStaff.idInMusicSheet;return this.graphic.findGraphicalStaffEntryFromMeasureList(i,e,t.ParentSourceStaffEntry)}updateWithTimestamp(t){const e=this.manager.absoluteEnrolledToSheetTimestamp(t),i=this.graphic.calculateXPositionFromTimestamp(e),s=i[0],r=i[1];this.updateCurrentPageFromSystem(r);const o=i[2];if(!o)return;const a=Math.max(o.parentMeasure.MeasureNumber,1);let l;for(const f of this.graphic.MeasureList[a-1])if(f){l=f;break}const h=this.graphic.calculateCursorPoints(s,r),c=h[0].y,u=h[1].y-c;if(!!l){if(this.updateWidthAndStyle(l.PositionAndShape,s,c,u),this.openSheetMusicDisplay.FollowCursor){const f=this.cursorElement.getBoundingClientRect().top;this.cursorElement.scrollIntoView({behavior:f<1e3?"smooth":"auto",block:"center"})}this.cursorElement.style.display=""}}update(){if(this.hidden||this.hidden===void 0||this.hidden===null)return;this.updateCurrentPage();const t=this.Iterator,e=t.CurrentVisibleVoiceEntries();if(t.EndReached||!t.CurrentVoiceEntries||e.length===0)return;let i=0,s=0,r=0,o;if(t.CurrentMeasure.isReducedToMultiRest){const c=this.graphic.findGraphicalMeasure(t.CurrentMeasureIndex,0),u=c.parentSourceMeasure.multipleRestMeasures,d=t.CurrentMeasure.multipleRestMeasureNumber/(u+1),p=c.PositionAndShape.Size.width-c.beginInstructionsWidth;i=c.PositionAndShape.AbsolutePosition.x+c.beginInstructionsWidth+d*p,o=c.ParentMusicSystem}else{const u=e.map(f=>this.getStaffEntryFromVoiceEntry(f)).sort((f,d)=>{var p,g,m,S;return((g=(p=f==null?void 0:f.PositionAndShape)==null?void 0:p.AbsolutePosition)==null?void 0:g.x)<=((S=(m=d==null?void 0:d.PositionAndShape)==null?void 0:m.AbsolutePosition)==null?void 0:S.x)?-1:1})[0];u&&(i=u.PositionAndShape.AbsolutePosition.x,o=u.parentMeasure.ParentMusicSystem)}if(!o)return;s=o.PositionAndShape.AbsolutePosition.y+o.StaffLines[0].PositionAndShape.RelativePosition.y;const a=o.StaffLines[o.StaffLines.length-1];r=o.PositionAndShape.AbsolutePosition.y+a.PositionAndShape.RelativePosition.y+a.StaffHeight-s;const h=this.graphic.findGraphicalMeasure(t.CurrentMeasureIndex,0).PositionAndShape;if(this.updateWidthAndStyle(h,i,s,r),this.openSheetMusicDisplay.FollowCursor&&this.cursorOptions.follow)if(this.openSheetMusicDisplay.EngravingRules.RenderSingleHorizontalStaffline)this.cursorElement.scrollIntoView({behavior:"smooth",inline:"center"});else{const c=this.cursorElement.getBoundingClientRect().top;this.cursorElement.scrollIntoView({behavior:c<1e3?"smooth":"auto",block:"center"})}this.cursorElement.style.display=""}updateWidthAndStyle(t,e,i,s){const r=this.cursorElement;let o=0,a=s;switch(this.cursorOptions.type){case 1:r.style.top=i*10*this.openSheetMusicDisplay.zoom+"px",r.style.left=(e-1.5)*10*this.openSheetMusicDisplay.zoom+"px",a=s*10*this.openSheetMusicDisplay.zoom,r.height=a,r.style.height=a+"px",o=5*this.openSheetMusicDisplay.zoom;break;case 2:r.style.top=(i-2.5)*10*this.openSheetMusicDisplay.zoom+"px",r.style.left=e*10*this.openSheetMusicDisplay.zoom+"px",a=1.5*10*this.openSheetMusicDisplay.zoom,r.height=a,r.style.height=a+"px",o=5*this.openSheetMusicDisplay.zoom;break;case 3:r.style.top=t.AbsolutePosition.y*10*this.openSheetMusicDisplay.zoom+"px",r.style.left=t.AbsolutePosition.x*10*this.openSheetMusicDisplay.zoom+"px",a=s*10*this.openSheetMusicDisplay.zoom,r.height=a,r.style.height=a+"px",o=t.Size.width*10*this.openSheetMusicDisplay.zoom;break;case 4:r.style.top=t.AbsolutePosition.y*10*this.openSheetMusicDisplay.zoom+"px",r.style.left=t.AbsolutePosition.x*10*this.openSheetMusicDisplay.zoom+"px",a=s*10*this.openSheetMusicDisplay.zoom,r.height=a,r.style.height=a+"px",o=(e-t.AbsolutePosition.x)*10*this.openSheetMusicDisplay.zoom;break;default:r.style.top=i*10*this.openSheetMusicDisplay.zoom+"px",r.style.left=(e-1.5)*10*this.openSheetMusicDisplay.zoom+"px",a=s*10*this.openSheetMusicDisplay.zoom,r.height=a,r.style.height=a+"px",o=3*10*this.openSheetMusicDisplay.zoom;break}o!==r.width&&(r.width=o,this.updateStyle(o,this.cursorOptions))}hide(){this.cursorElement.style.display="none",this.hidden=!0}next(){this.Iterator.moveToNextVisibleVoiceEntry(!1),this.update()}reset(){this.resetIterator();const t=this.manager.getIterator(this.graphic.ParentMusicSheet.SelectionStart);this.updateWithTimestamp(t.CurrentEnrolledTimestamp)}updateStyle(t,e=void 0){e!==void 0&&(this.cursorOptions=e);const i=document.createElement("canvas");i.width=this.cursorElement.width,i.height=1;const s=i.getContext("2d");s.globalAlpha=this.cursorOptions.alpha;const r=s.createLinearGradient(0,0,this.cursorElement.width,0);switch(this.cursorOptions.type){case 1:case 2:case 3:case 4:r.addColorStop(1,this.cursorOptions.color);break;default:r.addColorStop(0,"white"),r.addColorStop(.2,this.cursorOptions.color),r.addColorStop(.8,this.cursorOptions.color),r.addColorStop(1,"white");break}s.fillStyle=r,s.fillRect(0,0,t,1),this.cursorElement.src=i.toDataURL("image/png")}get Iterator(){return this.iterator}get Hidden(){return this.hidden}VoicesUnderCursor(t){return this.Iterator.CurrentVisibleVoiceEntries(t)}NotesUnderCursor(t){const e=this.VoicesUnderCursor(t),i=[];return e.forEach(s=>{i.push.apply(i,s.Notes)}),i}GNotesUnderCursor(t){const e=this.VoicesUnderCursor(t),i=[];return e.forEach(s=>{i.push(...s.Notes.map(r=>this.rules.GNote(r)))}),i}updateCurrentPage(){const t=this.Iterator.currentTimeStamp;for(const e of this.graphic.MusicPages)if(e.MusicSystems.last().GetSystemsLastTimeStamp().gt(t)){const s=e.PageNumber;return s!==this.currentPageNumber&&(this.container.removeChild(this.cursorElement),this.container=document.getElementById(this.rules.DYContainerId+s),this.container.appendChild(this.cursorElement)),this.currentPageNumber=s}return 1}updateCurrentPageFromSystem(t){if(t!=null&&t.Parent){const e=t.Parent.PageNumber;return e!==this.currentPageNumber&&(this.container.removeChild(this.cursorElement),this.container=document.getElementById(this.rules.DYContainerId+e),this.container.appendChild(this.cursorElement)),this.currentPageNumber=e}return 1}}class O{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}static get Empty(){return new O}static pointsAreEqual(t,e){return t.x===e.x&&t.y===e.y}ToString(){return"["+this.x+", "+this.y+"]"}}class $e{constructor(t=0,e=0){this.width=t,this.height=e}}class Qe{constructor(t,e,i,s){this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=e,this.width=i,this.height=s}static createFromLocationAndSize(t,e){return new Qe(t.x,t.y,e.width,e.height)}get Location(){return new O(this.x,this.y)}get Size(){return new $e(this.width,this.height)}}class qh{isInstanceOfClass(t){let e=this.constructor.prototype;for(;e;){if(t===e.constructor.name)return!0;e=e.__proto__}return!1}}class Pe extends qh{get PositionAndShape(){return this.boundingBox}set PositionAndShape(t){this.boundingBox=t}}class wa extends Pe{constructor(t){super(),this.parentStaffLine=t;const e=t.PositionAndShape;this.boundingBox=new le(this,e),this.boundingBox.BorderRight=6,this.boundingBox.BorderBottom=4.5,this.boundingBox.BorderLeft=-1.5,this.boundingBox.BorderTop=-1.5}}class Tn extends Pe{}class le{constructor(t=void 0,e=void 0,i=!1){this.isSymbol=!1,this.relativePositionHasBeenSet=!1,this.xBordersHaveBeenSet=!1,this.yBordersHaveBeenSet=!1,this.absolutePosition=new O,this.relativePosition=new O,this.size=new $e,this.marginSize=new $e,this.upperLeftCorner=new O,this.upperLeftMarginCorner=new O,this.borderLeft=0,this.borderRight=0,this.borderTop=0,this.borderBottom=0,this.borderMarginLeft=0,this.borderMarginRight=0,this.borderMarginTop=0,this.borderMarginBottom=0,this.childElements=[],this.parent=e,this.dataObject=t,this.isSymbol=i,this.xBordersHaveBeenSet=!1,this.yBordersHaveBeenSet=!1,e&&(this.Parent=e)}get RelativePositionHasBeenSet(){return this.relativePositionHasBeenSet}get XBordersHaveBeenSet(){return this.xBordersHaveBeenSet}set XBordersHaveBeenSet(t){this.xBordersHaveBeenSet=t}get YBordersHaveBeenSet(){return this.yBordersHaveBeenSet}set YBordersHaveBeenSet(t){this.yBordersHaveBeenSet=t}get AbsolutePosition(){return this.absolutePosition}set AbsolutePosition(t){this.absolutePosition=t}get RelativePosition(){return this.relativePosition}set RelativePosition(t){this.relativePosition=t,this.relativePositionHasBeenSet=!0}get Size(){return this.size}set Size(t){this.size=t}get MarginSize(){return this.marginSize}get UpperLeftCorner(){return this.upperLeftCorner}get UpperLeftMarginCorner(){return this.upperLeftMarginCorner}get BorderLeft(){return this.borderLeft}set BorderLeft(t){this.borderLeft=t,this.calculateRectangle()}get BorderRight(){return this.borderRight}set BorderRight(t){this.borderRight=t,this.calculateRectangle()}get BorderTop(){return this.borderTop}set BorderTop(t){this.borderTop=t,this.calculateRectangle()}get BorderBottom(){return this.borderBottom}set BorderBottom(t){this.borderBottom=t,this.calculateRectangle()}get BorderMarginLeft(){return this.borderMarginLeft>this.borderLeft?this.borderLeft:this.borderMarginLeft}set BorderMarginLeft(t){this.borderMarginLeft=t,this.calculateMarginRectangle()}get BorderMarginRight(){return this.borderMarginRight<this.borderRight?this.borderRight:this.borderMarginRight}set BorderMarginRight(t){this.borderMarginRight=t,this.calculateMarginRectangle()}get BorderMarginTop(){return this.borderMarginTop>this.borderTop?this.borderTop:this.borderMarginTop}set BorderMarginTop(t){this.borderMarginTop=t,this.calculateMarginRectangle()}get BorderMarginBottom(){return this.borderMarginBottom<this.borderBottom?this.borderBottom:this.borderMarginBottom}set BorderMarginBottom(t){this.borderMarginBottom=t,this.calculateMarginRectangle()}get BoundingRectangle(){return this.boundingRectangle}get BoundingMarginRectangle(){return this.boundingMarginRectangle}get ChildElements(){return this.childElements}set ChildElements(t){this.childElements=t}get Parent(){return this.parent}set Parent(t){var e,i,s,r;if(this.parent){const o=this.parent.ChildElements.indexOf(this,0);o>-1&&this.parent.ChildElements.splice(o,1)}this.parent=t,((i=(e=this.parent)==null?void 0:e.ChildElements)==null?void 0:i.indexOf(this))>-1?j.error("BoundingBox of "+this.dataObject.constructor.name+" already in children list of "+this.parent.dataObject.constructor.name+"'s BoundingBox"):(r=(s=this.parent)==null?void 0:s.ChildElements)==null||r.push(this)}get DataObject(){return this.dataObject}get Center(){return new O(this.RelativePosition.x+(this.BorderMarginRight+this.BorderMarginLeft),this.RelativePosition.y+(this.BorderMarginBottom+this.BorderMarginTop))}setAbsolutePositionFromParent(){this.parent?(this.absolutePosition.x=this.parent.AbsolutePosition.x+this.relativePosition.x,this.absolutePosition.y=this.parent.AbsolutePosition.y+this.relativePosition.y):this.absolutePosition=this.relativePosition}calculateAbsolutePosition(){this.absolutePosition.x=this.relativePosition.x,this.absolutePosition.y=this.relativePosition.y;let t=this.parent;for(;t;)this.absolutePosition.x+=t.relativePosition.x,this.absolutePosition.y+=t.relativePosition.y,t=t.parent}calculateAbsolutePositionsRecursiveWithoutTopelement(){this.absolutePosition.x=0,this.absolutePosition.y=0;for(let t=0,e=this.ChildElements.length;t<e;++t)this.ChildElements[t].calculateAbsolutePositionsRecursive(this.absolutePosition.x,this.absolutePosition.y)}calculateAbsolutePositionsRecursive(t,e){this.absolutePosition.x=this.relativePosition.x+t,this.absolutePosition.y=this.relativePosition.y+e;for(let i=0,s=this.ChildElements.length;i<s;++i)this.ChildElements[i].calculateAbsolutePositionsRecursive(this.absolutePosition.x,this.absolutePosition.y)}calculateAbsolutePositionsOfChildren(){for(let t=0,e=this.ChildElements.length;t<e;++t)this.ChildElements[t].calculateAbsolutePositionsRecursive(this.absolutePosition.x,this.absolutePosition.y)}calculateBoundingBox(){if(this.childElements.length===0)return;for(let h=0,c=this.ChildElements.length;h<c;++h)this.ChildElements[h].calculateBoundingBox();let t=Number.MAX_VALUE,e=Number.MIN_VALUE,i=Number.MAX_VALUE,s=Number.MIN_VALUE,r=Number.MAX_VALUE,o=Number.MIN_VALUE,a=Number.MAX_VALUE,l=Number.MIN_VALUE;this.isSymbol&&(t=this.borderLeft,e=this.borderRight,i=this.borderTop,s=this.borderBottom,r=this.borderMarginLeft,o=this.borderMarginRight,a=this.borderMarginTop,l=this.borderMarginBottom);for(let h=0,c=this.ChildElements.length;h<c;++h){const u=this.ChildElements[h];t=Math.min(t,u.relativePosition.x+u.borderLeft),e=Math.max(e,u.relativePosition.x+u.borderRight),i=Math.min(i,u.relativePosition.y+u.borderTop),s=Math.max(s,u.relativePosition.y+u.borderBottom),r=Math.min(r,u.relativePosition.x+u.borderMarginLeft),o=Math.max(o,u.relativePosition.x+u.borderMarginRight),a=Math.min(a,u.relativePosition.y+u.borderMarginTop),l=Math.max(l,u.relativePosition.y+u.borderMarginBottom)}this.borderLeft=t,this.borderRight=e,this.borderTop=i,this.borderBottom=s,this.borderMarginLeft=r,this.borderMarginRight=o,this.borderMarginTop=a,this.borderMarginBottom=l,this.calculateRectangle(),this.calculateMarginRectangle(),this.xBordersHaveBeenSet=!0,this.yBordersHaveBeenSet=!0}calculateTopBottomBorders(){if(this.childElements.length===0)return;for(let r=0,o=this.ChildElements.length;r<o;++r)this.ChildElements[r].calculateTopBottomBorders();let t=Number.MAX_VALUE,e=Number.MIN_VALUE,i=Number.MAX_VALUE,s=Number.MIN_VALUE;this.yBordersHaveBeenSet&&(t=this.borderTop,e=this.borderBottom,i=this.borderMarginTop,s=this.borderMarginBottom);for(let r=0,o=this.ChildElements.length;r<o;++r){const a=this.ChildElements[r];t=Math.min(t,a.relativePosition.y+a.borderTop),(!Ui.FixStafflineBoundingBox||!(a.dataObject instanceof wa))&&(e=Math.max(e,a.relativePosition.y+a.borderBottom)),i=Math.min(i,a.relativePosition.y+a.borderMarginTop),s=Math.max(s,a.relativePosition.y+a.borderMarginBottom)}this.borderTop=t,this.borderBottom=e,this.borderMarginTop=i,this.borderMarginBottom=s,this.calculateRectangle(),this.calculateMarginRectangle()}computeNonOverlappingPositionWithMargin(t,e,i){this.RelativePosition=new O(i.x,i.y),this.setAbsolutePositionFromParent();let s=0,r=!1;do switch(e){case ve.Left:case ve.Right:s=this.relativePosition.x,t.calculateMarginPositionAlongDirection(this,e),r=Math.abs(s-this.relativePosition.x)>.001;break;case ve.Up:case ve.Down:s=this.relativePosition.y,t.calculateMarginPositionAlongDirection(this,e),r=Math.abs(s-this.relativePosition.y)>.001;break;default:throw new Li("direction")}while(r)}collisionDetection(t){const e=Math.min(this.AbsolutePosition.x+this.borderRight,t.absolutePosition.x+t.borderRight)-Math.max(this.AbsolutePosition.x+this.borderLeft,t.absolutePosition.x+t.borderLeft),i=Math.min(this.AbsolutePosition.y+this.borderBottom,t.absolutePosition.y+t.borderBottom)-Math.max(this.AbsolutePosition.y+this.borderTop,t.absolutePosition.y+t.borderTop);return e>0&&i>0}liesInsideBorders(t){const e=this.AbsolutePosition.x+this.borderLeft<=t.absolutePosition.x+t.borderLeft&&t.absolutePosition.x+t.borderLeft<=this.AbsolutePosition.x+this.borderRight,i=this.AbsolutePosition.x+this.borderLeft<=t.absolutePosition.x+t.borderRight&&t.absolutePosition.x+t.borderRight<=this.AbsolutePosition.x+this.borderRight;if(e&&i){const s=this.AbsolutePosition.y+this.borderTop<=t.absolutePosition.y+t.borderTop&&t.absolutePosition.y+t.borderTop<=this.AbsolutePosition.y+this.borderBottom,r=this.AbsolutePosition.y+this.borderTop<=t.absolutePosition.y+t.borderBottom&&t.absolutePosition.y+t.borderBottom<=this.AbsolutePosition.y+this.borderBottom;if(s&&r)return!0}return!1}pointLiesInsideBorders(t){return this.AbsolutePosition.x+this.borderLeft<=t.x&&t.x<=this.AbsolutePosition.x+this.borderRight&&this.AbsolutePosition.y+this.borderTop<=t.y&&t.y<=this.AbsolutePosition.y+this.borderBottom}marginCollisionDetection(t){const e=Math.min(this.AbsolutePosition.x+this.borderMarginRight,t.absolutePosition.x+t.borderMarginRight)-Math.max(this.AbsolutePosition.x+this.borderMarginLeft,t.absolutePosition.x+t.borderMarginLeft),i=Math.min(this.AbsolutePosition.y+this.borderMarginBottom,t.absolutePosition.y+t.borderMarginBottom)-Math.max(this.AbsolutePosition.y+this.borderMarginTop,t.absolutePosition.y+t.borderMarginTop);return e>0&&i>0}liesInsideMargins(t){const e=this.AbsolutePosition.x+this.borderMarginLeft<=t.absolutePosition.x+t.borderMarginLeft&&t.absolutePosition.x+t.borderMarginLeft<=this.AbsolutePosition.x+this.borderMarginRight,i=this.AbsolutePosition.x+this.borderMarginLeft<=t.absolutePosition.x+t.borderMarginRight&&t.absolutePosition.x+t.borderMarginRight<=this.AbsolutePosition.x+this.borderMarginRight;if(e&&i){const s=this.AbsolutePosition.y+this.borderMarginTop<=t.absolutePosition.y+t.borderMarginTop&&t.absolutePosition.y+t.borderMarginTop<=this.AbsolutePosition.y+this.borderMarginBottom,r=this.AbsolutePosition.y+this.borderMarginTop<=t.absolutePosition.y+t.borderMarginBottom&&t.absolutePosition.y+t.borderMarginBottom<=this.AbsolutePosition.y+this.borderMarginBottom;if(s&&r)return!0}return!1}pointLiesInsideMargins(t){return this.AbsolutePosition.x+this.borderMarginLeft<=t.x&&t.x<=this.AbsolutePosition.x+this.borderMarginRight&&this.AbsolutePosition.y+this.borderMarginTop<=t.y&&t.y<=this.AbsolutePosition.y+this.borderMarginBottom}computeNonOverlappingPosition(t,e,i){this.RelativePosition=new O(i.x,i.y),this.setAbsolutePositionFromParent();let s=0,r=!1;do switch(e){case ve.Left:case ve.Right:s=this.relativePosition.x,t.calculatePositionAlongDirection(this,e),r=Math.abs(s-this.relativePosition.x)>1e-4;break;case ve.Up:case ve.Down:s=this.relativePosition.y,t.calculatePositionAlongDirection(this,e),r=Math.abs(s-this.relativePosition.y)>1e-4;break;default:throw new Li("direction")}while(r)}getClickedObjectOfType(t){const e=this.dataObject;if(this.pointLiesInsideBorders(t)&&e)return e;for(let i=0,s=this.childElements.length;i<s;++i){const o=this.childElements[i].getClickedObjectOfType(t);if(o)return o}}getClickedClickable(t){const e=this.dataObject;if(this.pointLiesInsideBorders(t)&&e&&e instanceof Tn)return e;for(let i=0,s=this.childElements.length;i<s;++i){const o=this.childElements[i].getClickedClickable(t);if(o&&o instanceof Tn)return o}}getObjectsInRegion(t,e=!0,i=Pe.name){let s=[];for(const r of this.childElements)s=s.concat(r.getObjectsInRegion(t,e,i));return this.dataObject&&this.dataObject.isInstanceOfClass(i)&&(e?t.liesInsideBorders(this)&&s.push(this.dataObject):t.collisionDetection(this)&&s.push(this.dataObject)),s}calculateRectangle(){this.upperLeftCorner=new O(this.BorderLeft,this.BorderTop),this.size=new $e(this.BorderRight-this.BorderLeft,this.BorderBottom-this.BorderTop),this.boundingRectangle=Qe.createFromLocationAndSize(this.upperLeftCorner,this.size)}calculateMarginRectangle(){this.upperLeftMarginCorner=new O(this.BorderMarginLeft,this.BorderMarginTop),this.marginSize=new $e(this.BorderMarginRight-this.BorderMarginLeft,this.BorderMarginBottom-this.BorderMarginTop),this.boundingMarginRectangle=Qe.createFromLocationAndSize(this.upperLeftMarginCorner,this.marginSize)}calculateMarginPositionAlongDirection(t,e){if(this!==t){if(this.isSymbol&&this.marginCollisionDetection(t)){let i=0;switch(e){case ve.Left:i=this.absolutePosition.x+this.borderMarginLeft-(t.absolutePosition.x+t.borderMarginRight),t.relativePosition.x+=i,t.absolutePosition.x+=i;return;case ve.Right:i=this.absolutePosition.x+this.borderMarginRight-(t.absolutePosition.x+t.borderMarginLeft),t.relativePosition.x+=i,t.absolutePosition.x+=i;return;case ve.Up:i=this.absolutePosition.y+this.borderMarginTop-(t.absolutePosition.y+t.borderMarginBottom),t.relativePosition.y+=i,t.absolutePosition.y+=i;return;case ve.Down:i=this.absolutePosition.y+this.borderMarginBottom-(t.absolutePosition.y+t.borderMarginTop),t.relativePosition.y+=i,t.absolutePosition.y+=i;return;default:throw new Li("direction")}}for(let i=0,s=this.ChildElements.length;i<s;++i)this.ChildElements[i].calculateMarginPositionAlongDirection(t,e)}}calculatePositionAlongDirection(t,e){if(this!==t){if(this.isSymbol&&this.collisionDetection(t)){let i;switch(e){case ve.Left:i=this.absolutePosition.x+this.borderLeft-(t.absolutePosition.x+t.borderRight),t.relativePosition.x+=i,t.absolutePosition.x+=i;return;case ve.Right:i=this.absolutePosition.x+this.borderRight-(t.absolutePosition.x+t.borderLeft),t.relativePosition.x+=i,t.absolutePosition.x+=i;return;case ve.Up:i=this.absolutePosition.y+this.borderTop-(t.absolutePosition.y+t.borderBottom),t.relativePosition.y+=i,t.absolutePosition.y+=i;return;case ve.Down:i=this.absolutePosition.y+this.borderBottom-(t.absolutePosition.y+t.borderTop),t.relativePosition.y+=i,t.absolutePosition.y+=i;return;default:throw new Li("direction")}}for(let i=0,s=this.ChildElements.length;i<s;++i)this.ChildElements[i].calculatePositionAlongDirection(t,e)}}}var ve=(n=>(n[n.Left=0]="Left",n[n.Right=1]="Right",n[n.Up=2]="Up",n[n.Down=3]="Down",n))(ve||{});class vr extends Pe{constructor(t){super(),this.musicSystems=[],this.labels=[],this.parent=t,this.boundingBox=new le(this,void 0)}get MusicSystems(){return this.musicSystems}set MusicSystems(t){this.musicSystems=t}get Labels(){return this.labels}set Labels(t){this.labels=t}get Parent(){return this.parent}set Parent(t){this.parent=t}get PageNumber(){return this.pageNumber}set PageNumber(t){this.pageNumber=t}setMusicPageAbsolutePosition(t,e){return new O(0,0)}}var Ea=(n=>(n[n.Down=0]="Down",n[n.Right=1]="Right",n[n.RightDown=2]="RightDown",n))(Ea||{}),vt=(n=>(n[n.LeftTop=0]="LeftTop",n[n.LeftCenter=1]="LeftCenter",n[n.LeftBottom=2]="LeftBottom",n[n.CenterTop=3]="CenterTop",n[n.CenterCenter=4]="CenterCenter",n[n.CenterBottom=5]="CenterBottom",n[n.RightTop=6]="RightTop",n[n.RightCenter=7]="RightCenter",n[n.RightBottom=8]="RightBottom",n))(vt||{});class cr{static IsLeft(t){return t===0||t===1||t===2}static IsCenterAligned(t){return t===3||t===4||t===5}static IsRight(t){return t===6||t===7||t===8}}var ue=(n=>(n[n.Regular=0]="Regular",n[n.Bold=1]="Bold",n[n.Italic=2]="Italic",n[n.BoldItalic=3]="BoldItalic",n[n.Underlined=4]="Underlined",n))(ue||{}),_r=(n=>(n[n.TimesNewRoman=0]="TimesNewRoman",n[n.Kokila=1]="Kokila",n[n.Gonville=2]="Gonville",n))(_r||{});const Jh={0:"Times New Roman",1:"Kokila",2:"Gonville"};var Fs=(n=>(n.SIMPLE="",n.HAMMERON="H",n.PULLOFF="P",n.SLIDE="S",n.TAPPING="T",n))(Fs||{});const dn={"-2":[4,12,23],"-7":[13],"-9":[6]};var ut=(n=>(n[n.C=0]="C",n[n.D=2]="D",n[n.E=4]="E",n[n.F=5]="F",n[n.G=7]="G",n[n.A=9]="A",n[n.B=11]="B",n))(ut||{}),yt=(n=>(n[n.SHARP=0]="SHARP",n[n.FLAT=1]="FLAT",n[n.NONE=2]="NONE",n[n.NATURAL=3]="NATURAL",n[n.DOUBLESHARP=4]="DOUBLESHARP",n[n.DOUBLEFLAT=5]="DOUBLEFLAT",n[n.TRIPLESHARP=6]="TRIPLESHARP",n[n.TRIPLEFLAT=7]="TRIPLEFLAT",n[n.QUARTERTONESHARP=8]="QUARTERTONESHARP",n[n.QUARTERTONEFLAT=9]="QUARTERTONEFLAT",n[n.SLASHFLAT=10]="SLASHFLAT",n[n.THREEQUARTERSSHARP=11]="THREEQUARTERSSHARP",n[n.THREEQUARTERSFLAT=12]="THREEQUARTERSFLAT",n[n.SLASHQUARTERSHARP=13]="SLASHQUARTERSHARP",n[n.SLASHSHARP=14]="SLASHSHARP",n[n.DOUBLESLASHFLAT=15]="DOUBLESLASHFLAT",n[n.SORI=16]="SORI",n[n.KORON=17]="KORON",n))(yt||{});const At=class{constructor(n,t,e,i=void 0){this.accidental=2,this.fundamentalNote=n,this.octave=t,this.accidental=e,this.accidentalXml=i,this.halfTone=n+(t+At.octXmlDiff)*12+At.HalfTonesFromAccidental(e),this.frequency=At.calcFrequency(this),this.nextFrequency=At.calcFrequency(this,"next"),this.prevFrequency=At.calcFrequency(this,"prev")}static getNoteEnumString(n){switch(n){case 0:return"C";case 2:return"D";case 4:return"E";case 5:return"F";case 7:return"G";case 9:return"A";case 11:return"B";default:return""}}static lineShiftFromNoteEnum(n,t){if(t===0)return[n,0];const e=At.pitchEnumValues,i=e.indexOf(n);let s=0,r=(i+t)%e.length;return i+t>e.length-1&&(s=1),r<0&&(r=e.length+r,s=-1),[e[r],s]}static CalculateTransposedHalfTone(n,t){const e=n.fundamentalNote+n.AccidentalHalfTones+t;return At.WrapAroundCheck(e,12)}static WrapAroundCheck(n,t){let e=0;for(;n<0;)n+=t,e--;for(;n>=t;)n-=t,e++;return{overflow:e,halftone:n}}static calcFrequency(n,t){let e=0,i;if(n instanceof At){const a=n;e=a.octave-1,i=a.fundamentalNote-9+a.AccidentalHalfTones}else typeof n=="number"&&(i=n-57);const s=window.DYSubjectId;let r=0;window.DYEnvironment==="COLEXIU"&&(dn["12"]=[120]);for(const a in dn)if(Object.prototype.hasOwnProperty.call(dn,a)&&dn[a].includes(s)){r=parseFloat(a);break}let o=i+r;return t==="next"&&o++,t==="prev"&&o--,442*Math.pow(2,e)*Math.pow(2,o/12)}static calcFractionalKey(n){return Math.log(n/440)/Math.LN10*At.halftoneFactor+57}static fromFrequency(n){const t=At.calcFractionalKey(n)+.5,e=Math.floor(t/12)-At.octXmlDiff,i=Math.floor(t)%12;let s=i,r=2;return this.pitchEnumValues.indexOf(s)===-1&&(s=i-1,r=0),new At(s,e,r)}static fromHalftone(n){const t=Math.floor(n/12)-At.octXmlDiff,e=n%12;let i=e,s=2;return this.pitchEnumValues.indexOf(i)===-1&&(i=e-1,s=0),new At(i,t,s)}static ceiling(n){n=n%12;let t=n;return this.pitchEnumValues.indexOf(t)===-1&&(t=n+1),t}static floor(n){n=n%12;let t=n;return this.pitchEnumValues.indexOf(t)===-1&&(t=n-1),t}static HalfTonesFromAccidental(n){switch(n){case 2:return 0;case 0:return 1;case 1:return-1;case 3:return 0;case 4:return 2;case 5:return-2;case 6:return 3;case 7:return-3;case 8:return .5;case 9:return-.5;case 10:return-.51;case 11:return 1.5;case 12:return-1.5;case 13:return .0013;case 14:return .0014;case 15:return-.0015;case 16:return .0016;case 17:return .0017;default:throw new Error("Unhandled AccidentalEnum value")}}static AccidentalFromHalfTones(n){switch(n){case 0:return 2;case 1:return 0;case-1:return 1;case 2:return 4;case-2:return 5;case 3:return 6;case-3:return 7;case .5:return 8;case-.5:return 9;case 1.5:return 11;case-1.5:return 12;default:return n>0&&n<1?8:n<0&&n>-1?9:8}}static accidentalVexflow(n){let t;switch(n){case 3:t="n";break;case 1:t="b";break;case 0:t="#";break;case 4:t="##";break;case 6:t="###";break;case 5:t="bb";break;case 7:t="bbs";break;case 8:t="+";break;case 9:t="d";break;case 10:t="bs";break;case 11:t="++";break;case 12:t="db";break;case 13:t="+-";break;case 14:t="++-";break;case 15:t="bss";break;case 16:t="o";break;case 17:t="k";break}return t}get AccidentalHalfTones(){return At.HalfTonesFromAccidental(this.accidental)}get Octave(){return this.octave}get FundamentalNote(){return this.fundamentalNote}get Accidental(){return this.accidental}get AccidentalXml(){return this.accidentalXml}get Frequency(){return this.frequency}static get OctaveXmlDifference(){return At.octXmlDiff}getHalfTone(){return this.halfTone}getTransposedPitch(n){if(n>12)throw new Error("rewrite this method to handle bigger octave changes or don't use is with bigger octave changes!");return n>0?this.getHigherPitchByTransposeFactor(n):n<0?this.getLowerPitchByTransposeFactor(-n):this}DoEnharmonicChange(){switch(this.accidental){case 1:case 5:this.fundamentalNote=this.getPreviousFundamentalNote(this.fundamentalNote),this.accidental=At.AccidentalFromHalfTones(this.halfTone-(this.fundamentalNote+(this.octave+At.octXmlDiff)*12));break;case 0:case 4:this.fundamentalNote=this.getNextFundamentalNote(this.fundamentalNote),this.accidental=At.AccidentalFromHalfTones(this.halfTone-(this.fundamentalNote+(this.octave+At.octXmlDiff)*12));break;default:return}}ToString(){let n=At.accidentalVexflow(this.accidental);return n||(n=""),"Key: "+At.getNoteEnumString(this.fundamentalNote)+n+", Note: "+this.fundamentalNote+", octave: "+this.octave.toString()}OperatorEquals(n){const t=this;return!t||!n?!1:t.FundamentalNote===n.FundamentalNote&&t.Octave===n.Octave&&t.Accidental===n.Accidental}OperatorNotEqual(n){return this!==n}OperatorFundamentalGreaterThan(n){const t=this;return t.Octave===n.Octave?t.FundamentalNote>n.FundamentalNote:t.Octave>n.Octave}OperatorFundamentalLessThan(n){const t=this;return t.Octave===n.Octave?t.FundamentalNote<n.FundamentalNote:t.Octave<n.Octave}getHigherPitchByTransposeFactor(n){const t=At.pitchEnumValues.indexOf(this.fundamentalNote);let e=this.octave,i;return t+n>At.pitchEnumValues.length-1?(i=At.pitchEnumValues[t+n-At.pitchEnumValues.length],e++):i=At.pitchEnumValues[t+n],new At(i,e,2)}getLowerPitchByTransposeFactor(n){const t=At.pitchEnumValues.indexOf(this.fundamentalNote);let e=this.octave,i;return t-n<0?(i=At.pitchEnumValues[At.pitchEnumValues.length+t-n],e--):i=At.pitchEnumValues[t-n],new At(i,e,2)}getNextFundamentalNote(n){let t=At.pitchEnumValues.indexOf(n);return t=(t+1)%At.pitchEnumValues.length,At.pitchEnumValues[t]}getPreviousFundamentalNote(n){const t=At.pitchEnumValues.indexOf(n);return t>0?At.pitchEnumValues[t-1]:At.pitchEnumValues[At.pitchEnumValues.length-1]}};let Kt=At;Kt.pitchEnumValues=[0,2,4,5,7,9,11];Kt.halftoneFactor=12/(Math.LN2/Math.LN10);Kt.octXmlDiff=3;class pn{constructor(t,e){this.staffEntries=[],this.absoluteTimestamp=e,this.staffEntries=new Array(t)}get Index(){return this.index}set Index(t){this.index=t}get AbsoluteTimestamp(){return this.absoluteTimestamp}get StaffEntries(){return this.staffEntries}set StaffEntries(t){this.staffEntries=t}static compareByTimestamp(t,e){const i=t.absoluteTimestamp.RealValue,s=e.absoluteTimestamp.RealValue;return i<s?-1:i>s?1:0}getFirstNonNullStaffEntry(){for(let t=0,e=this.staffEntries.length;t<e;++t){const i=this.staffEntries[t];if(i)return i}}}var fs=(n=>(n[n.BaseWritingColor=0]="BaseWritingColor",n[n.FollowingCursor=1]="FollowingCursor",n[n.AlternativeFollowingCursor=2]="AlternativeFollowingCursor",n[n.PlaybackCursor=3]="PlaybackCursor",n[n.Highlighted=4]="Highlighted",n[n.ErrorUnderlay=5]="ErrorUnderlay",n[n.Selected=6]="Selected",n[n.SelectionSymbol=7]="SelectionSymbol",n[n.DebugColor1=8]="DebugColor1",n[n.DebugColor2=9]="DebugColor2",n[n.DebugColor3=10]="DebugColor3",n[n.SplitScreenDivision=11]="SplitScreenDivision",n[n.GreyTransparentOverlay=12]="GreyTransparentOverlay",n[n.MarkedArea1=13]="MarkedArea1",n[n.MarkedArea2=14]="MarkedArea2",n[n.MarkedArea3=15]="MarkedArea3",n[n.MarkedArea4=16]="MarkedArea4",n[n.MarkedArea5=17]="MarkedArea5",n[n.MarkedArea6=18]="MarkedArea6",n[n.MarkedArea7=19]="MarkedArea7",n[n.MarkedArea8=20]="MarkedArea8",n[n.MarkedArea9=21]="MarkedArea9",n[n.MarkedArea10=22]="MarkedArea10",n[n.Comment1=23]="Comment1",n[n.Comment2=24]="Comment2",n[n.Comment3=25]="Comment3",n[n.Comment4=26]="Comment4",n[n.Comment5=27]="Comment5",n[n.Comment6=28]="Comment6",n[n.Comment7=29]="Comment7",n[n.Comment8=30]="Comment8",n[n.Comment9=31]="Comment9",n[n.Comment10=32]="Comment10",n))(fs||{});const zt=new Ye;zt.setValue(0,"Thistle");zt.setValue(1,"Aqua");zt.setValue(2,"Azure");zt.setValue(3,"Bisque");zt.setValue(4,"CadetBlue");zt.setValue(5,"DarkBlue");zt.setValue(6,"DarkGoldenRod");zt.setValue(7,"BlanchedAlmond");zt.setValue(8,"Chartreuse");zt.setValue(9,"DarkGreen");zt.setValue(10,"DarkOrange");zt.setValue(11,"FireBrick");zt.setValue(12,"DarkSalmon");zt.setValue(13,"DarkSeaGreen");zt.setValue(14,"DarkOrchid");zt.setValue(15,"Aquamarine");zt.setValue(16,"DarkKhaki");zt.setValue(17,"ForestGreen");zt.setValue(18,"AliceBlue");zt.setValue(19,"DeepPink");zt.setValue(20,"Coral");zt.setValue(21,"DarkOliveGreen");zt.setValue(22,"Chocolate");zt.setValue(23,"DodgerBlue");zt.setValue(24,"Blue");zt.setValue(25,"Beige");zt.setValue(26,"Crimson");zt.setValue(27,"Fuchsia");zt.setValue(28,"Brown");zt.setValue(29,"BlanchedAlmond");zt.setValue(30,"CornflowerBlue");zt.setValue(31,"Cornsilk");zt.setValue(32,"DarkGrey");var pe=(n=>(n[n.Background=0]="Background",n[n.Highlight=1]="Highlight",n[n.MeasureError=2]="MeasureError",n[n.SelectionSymbol=3]="SelectionSymbol",n[n.Cursor=4]="Cursor",n[n.PSI_Debug=5]="PSI_Debug",n[n.Notes=6]="Notes",n[n.Comment=7]="Comment",n[n.Debug_above=8]="Debug_above",n))(pe||{}),Ma=(n=>(n[n.Normal=0]="Normal",n[n.Selected=1]="Selected",n[n.Follow_Confirmed=2]="Follow_Confirmed",n[n.QFeedback_NotFound=3]="QFeedback_NotFound",n[n.QFeedback_OK=4]="QFeedback_OK",n[n.QFeedback_Perfect=5]="QFeedback_Perfect",n[n.Debug1=6]="Debug1",n[n.Debug2=7]="Debug2",n[n.Debug3=8]="Debug3",n))(Ma||{}),wr=(n=>(n.C="#d82c6b",n.D="#F89D15",n.E="#FFE21A",n.F="#4dbd5c",n.G="#009D96",n.A="#43469d",n.B="#76429c",n.Rest="#000000",n))(wr||{});class ci{constructor(t,e,i=0,s=fs.BaseWritingColor,r=void 0){this.start=t,this.end=e,this.width=i,this.styleId=s,this.colorHex=r}get Start(){return this.start}set Start(t){this.start=t}get End(){return this.end}set End(t){this.end=t}get Width(){return this.width}set Width(t){this.width=t}}class Wt extends ro{constructor(t=Pt.G,e=0,i=2){super(void 0),this.clefType=Pt.G,this.line=2,this.octaveOffset=0,this.line=i,this.clefType=t,this.octaveOffset=e,this.calcParameters()}static getDefaultClefFromMidiInstrument(t){switch(t){case st.Acoustic_Grand_Piano:return new Wt(Pt.F,0,4);case st.Electric_Bass_finger:return new Wt(Pt.F,0,4);case st.Electric_Bass_pick:return new Wt(Pt.F,0,4);case st.Fretless_Bass:return new Wt(Pt.F,0,4);case st.Slap_Bass_1:return new Wt(Pt.F,0,4);case st.Slap_Bass_2:return new Wt(Pt.F,0,4);case st.Synth_Bass_1:return new Wt(Pt.F,0,4);case st.Synth_Bass_2:return new Wt(Pt.F,0,4);case st.Contrabass:return new Wt(Pt.F,0,4);default:return new Wt(Pt.G,0,2)}}static getAllPossibleClefs(){const t=[];for(let e=0;e<=2;e++){const i=new Wt(Pt.G,e,2);t.push(i)}for(let e=-2;e<=0;e++){const i=new Wt(Pt.F,e,4);t.push(i)}return t}static isSupportedClef(t){switch(t){case Pt.G:case Pt.F:case Pt.C:case Pt.percussion:case Pt.TAB:return!0;default:return!1}}get ClefType(){return this.clefType}set ClefType(t){this.clefType=t}get Line(){return this.line}set Line(t){this.line=t}get OctaveOffset(){return this.octaveOffset}set OctaveOffset(t){this.octaveOffset=t}get ClefPitch(){return this.clefPitch}set ClefPitch(t){this.clefPitch=t}get ReferenceCyPosition(){return this.referenceCyPosition}set ReferenceCyPosition(t){this.referenceCyPosition=t}Equals(t){return this===t?!0:!this||!t?!1:this.clefPitch===t.clefPitch&&this.Line===t.Line}NotEqual(t){return!this.Equals(t)}ToString(){return"ClefType: "+this.clefType}calcParameters(){switch(this.clefType){case Pt.G:this.clefPitch=new Kt(ut.G,1+this.octaveOffset,yt.NONE),this.referenceCyPosition=5-this.line+2;break;case Pt.F:this.clefPitch=new Kt(ut.F,0+this.octaveOffset,yt.NONE),this.referenceCyPosition=5-this.line+1.5;break;case Pt.C:this.clefPitch=new Kt(ut.C,1+this.octaveOffset,yt.NONE),this.referenceCyPosition=5-this.line;break;case Pt.percussion:this.clefPitch=new Kt(ut.C,2,yt.NONE),this.referenceCyPosition=2;break;case Pt.TAB:this.clefPitch=new Kt(ut.G,0,yt.NONE),this.referenceCyPosition=0;break;default:throw new Li("clefType")}}}var Pt=(n=>(n[n.G=0]="G",n[n.F=1]="F",n[n.C=2]="C",n[n.percussion=3]="percussion",n[n.TAB=4]="TAB",n))(Pt||{}),st=(n=>(n[n.None=-1]="None",n[n.Acoustic_Grand_Piano=0]="Acoustic_Grand_Piano",n[n.Bright_Acoustic_Piano=1]="Bright_Acoustic_Piano",n[n.Electric_Grand_Piano=2]="Electric_Grand_Piano",n[n.Honky_tonk_Piano=3]="Honky_tonk_Piano",n[n.Electric_Piano_1=4]="Electric_Piano_1",n[n.Electric_Piano_2=5]="Electric_Piano_2",n[n.Harpsichord=6]="Harpsichord",n[n.Clavinet=7]="Clavinet",n[n.Celesta=8]="Celesta",n[n.Glockenspiel=9]="Glockenspiel",n[n.Music_Box=10]="Music_Box",n[n.Vibraphone=11]="Vibraphone",n[n.Marimba=12]="Marimba",n[n.Xylophone=13]="Xylophone",n[n.Tubular_Bells=14]="Tubular_Bells",n[n.Dulcimer=15]="Dulcimer",n[n.Drawbar_Organ=16]="Drawbar_Organ",n[n.Percussive_Organ=17]="Percussive_Organ",n[n.Rock_Organ=18]="Rock_Organ",n[n.Church_Organ=19]="Church_Organ",n[n.Reed_Organ=20]="Reed_Organ",n[n.Accordion=21]="Accordion",n[n.Harmonica=22]="Harmonica",n[n.Tango_Accordion=23]="Tango_Accordion",n[n.Acoustic_Guitar_nylon=24]="Acoustic_Guitar_nylon",n[n.Acoustic_Guitar_steel=25]="Acoustic_Guitar_steel",n[n.Electric_Guitar_jazz=26]="Electric_Guitar_jazz",n[n.Electric_Guitar_clean=27]="Electric_Guitar_clean",n[n.Electric_Guitar_muted=28]="Electric_Guitar_muted",n[n.Overdriven_Guitar=29]="Overdriven_Guitar",n[n.Distortion_Guitar=30]="Distortion_Guitar",n[n.Guitar_harmonics=31]="Guitar_harmonics",n[n.Acoustic_Bass=32]="Acoustic_Bass",n[n.Electric_Bass_finger=33]="Electric_Bass_finger",n[n.Electric_Bass_pick=34]="Electric_Bass_pick",n[n.Fretless_Bass=35]="Fretless_Bass",n[n.Slap_Bass_1=36]="Slap_Bass_1",n[n.Slap_Bass_2=37]="Slap_Bass_2",n[n.Synth_Bass_1=38]="Synth_Bass_1",n[n.Synth_Bass_2=39]="Synth_Bass_2",n[n.Violin=40]="Violin",n[n.Viola=41]="Viola",n[n.Cello=42]="Cello",n[n.Contrabass=43]="Contrabass",n[n.Tremolo_Strings=44]="Tremolo_Strings",n[n.Pizzicato_Strings=45]="Pizzicato_Strings",n[n.Orchestral_Harp=46]="Orchestral_Harp",n[n.Timpani=47]="Timpani",n[n.String_Ensemble_1=48]="String_Ensemble_1",n[n.String_Ensemble_2=49]="String_Ensemble_2",n[n.Synth_Strings_1=50]="Synth_Strings_1",n[n.Synth_Strings_2=51]="Synth_Strings_2",n[n.Choir_Aahs=52]="Choir_Aahs",n[n.Voice_Oohs=53]="Voice_Oohs",n[n.Synth_Voice=54]="Synth_Voice",n[n.Orchestra_Hit=55]="Orchestra_Hit",n[n.Trumpet=56]="Trumpet",n[n.Trombone=57]="Trombone",n[n.Tuba=58]="Tuba",n[n.Muted_Trumpet=59]="Muted_Trumpet",n[n.French_Horn=60]="French_Horn",n[n.Brass_Section=61]="Brass_Section",n[n.Synth_Brass_1=62]="Synth_Brass_1",n[n.Synth_Brass_2=63]="Synth_Brass_2",n[n.Soprano_Sax=64]="Soprano_Sax",n[n.Alto_Sax=65]="Alto_Sax",n[n.Tenor_Sax=66]="Tenor_Sax",n[n.Baritone_Sax=67]="Baritone_Sax",n[n.Oboe=68]="Oboe",n[n.English_Horn=69]="English_Horn",n[n.Bassoon=70]="Bassoon",n[n.Clarinet=71]="Clarinet",n[n.Piccolo=72]="Piccolo",n[n.Flute=73]="Flute",n[n.Recorder=74]="Recorder",n[n.Pan_Flute=75]="Pan_Flute",n[n.Blown_Bottle=76]="Blown_Bottle",n[n.Shakuhachi=77]="Shakuhachi",n[n.Whistle=78]="Whistle",n[n.Ocarina=79]="Ocarina",n[n.Lead_1_square=80]="Lead_1_square",n[n.Lead_2_sawtooth=81]="Lead_2_sawtooth",n[n.Lead_3_calliope=82]="Lead_3_calliope",n[n.Lead_4_chiff=83]="Lead_4_chiff",n[n.Lead_5_charang=84]="Lead_5_charang",n[n.Lead_6_voice=85]="Lead_6_voice",n[n.Lead_7_fifths=86]="Lead_7_fifths",n[n.Lead_8_bass_lead=87]="Lead_8_bass_lead",n[n.Pad_1_new_age=88]="Pad_1_new_age",n[n.Pad_2_warm=89]="Pad_2_warm",n[n.Pad_3_polysynth=90]="Pad_3_polysynth",n[n.Pad_4_choir=91]="Pad_4_choir",n[n.Pad_5_bowed=92]="Pad_5_bowed",n[n.Pad_6_metallic=93]="Pad_6_metallic",n[n.Pad_7_halo=94]="Pad_7_halo",n[n.Pad_8_sweep=95]="Pad_8_sweep",n[n.FX_1_rain=96]="FX_1_rain",n[n.FX_2_soundtrack=97]="FX_2_soundtrack",n[n.FX_3_crystal=98]="FX_3_crystal",n[n.FX_4_atmosphere=99]="FX_4_atmosphere",n[n.FX_5_brightness=100]="FX_5_brightness",n[n.FX_6_goblins=101]="FX_6_goblins",n[n.FX_7_echoes=102]="FX_7_echoes",n[n.FX_8_scifi=103]="FX_8_scifi",n[n.Sitar=104]="Sitar",n[n.Banjo=105]="Banjo",n[n.Shamisen=106]="Shamisen",n[n.Koto=107]="Koto",n[n.Kalimba=108]="Kalimba",n[n.Bag_pipe=109]="Bag_pipe",n[n.Fiddle=110]="Fiddle",n[n.Shanai=111]="Shanai",n[n.Tinkle_Bell=112]="Tinkle_Bell",n[n.Agogo=113]="Agogo",n[n.Steel_Drums=114]="Steel_Drums",n[n.Woodblock=115]="Woodblock",n[n.Taiko_Drum=116]="Taiko_Drum",n[n.Melodic_Tom=117]="Melodic_Tom",n[n.Synth_Drum=118]="Synth_Drum",n[n.Reverse_Cymbal=119]="Reverse_Cymbal",n[n.Guitar_Fret_Noise=120]="Guitar_Fret_Noise",n[n.Breath_Noise=121]="Breath_Noise",n[n.Seashore=122]="Seashore",n[n.Bird_Tweet=123]="Bird_Tweet",n[n.Telephone_Ring=124]="Telephone_Ring",n[n.Helicopter=125]="Helicopter",n[n.Applause=126]="Applause",n[n.Gunshot=127]="Gunshot",n[n.euphonium=128]="euphonium",n[n.AltoClarinetInEb=200]="AltoClarinetInEb",n[n.TrumpetInBb=201]="TrumpetInBb",n[n.BaritoneSaxophone=202]="BaritoneSaxophone",n[n.TenorSaxophone=203]="TenorSaxophone",n[n.ClarinetInEb=204]="ClarinetInEb",n[n.Euphonium=205]="Euphonium",n[n.Alto_Clarinet=206]="Alto_Clarinet",n[n.Bass_Clarinet=207]="Bass_Clarinet",n[n.Bass_Trombone=208]="Bass_Trombone",n[n.clarinet_in_bb=209]="clarinet_in_bb",n[n.clarinet_in_eb=210]="clarinet_in_eb",n[n.Percussion=135]="Percussion",n))(st||{});const Os=class extends ro{constructor(n=void 0,t=0,e=bi.major){super(n),this.isTransposedBy=0,this.Key=t,this.keyTypeOriginal=t,this.mode=e,this.alteratedNotes=this.calcAlteratedNotes()}static copy(n){const t=new Os(n.parent,n.Key,n.Mode);return t.keyTypeOriginal=n.keyTypeOriginal,t}static getAllPossibleMajorKeyInstructions(){const n=[];for(let t=-7;t<7;t++){const e=new Os(void 0,t,bi.major);n.push(e)}return n}get Key(){return this.keyType}set Key(n){this.keyType=n,this.alteratedNotes=this.calcAlteratedNotes()}get Mode(){return this.mode}set Mode(n){this.mode=n}get AlteratedNotes(){return this.alteratedNotes}calcAlteratedNotes(){const n=[];if(this.keyType>0)for(let t=0;t<this.keyType;t++)n.push(Os.sharpPositionList[t]);else if(this.keyType<0)for(let t=0;t<-this.keyType;t++)n.push(Os.flatPositionList[t]);return n}willAlterateNote(n){return this.alteratedNotes.indexOf(n)>=0}getAlterationForPitch(n){return this.keyType>0&&this.alteratedNotes.indexOf(n.FundamentalNote)<=this.keyType?yt.SHARP:this.keyType<0&&this.alteratedNotes.indexOf(n.FundamentalNote)<=Math.abs(this.keyType)?yt.FLAT:yt.NONE}ToString(){return"Key: "+this.keyType+this.mode}OperatorEquals(n){const t=this;return t===n?!0:!t||!n?!1:t.Key===n.Key&&t.Mode===n.Mode}OperatorNotEqual(n){return!this.OperatorEquals(n)}};let xe=Os;xe.sharpPositionList=[ut.F,ut.C,ut.G,ut.D,ut.A,ut.E,ut.B];xe.flatPositionList=[ut.B,ut.E,ut.A,ut.D,ut.G,ut.C,ut.F];var bi=(n=>(n[n.major=0]="major",n[n.minor=1]="minor",n[n.none=2]="none",n[n.dorian=3]="dorian",n[n.phrygian=4]="phrygian",n[n.lydian=5]="lydian",n[n.mixolydian=6]="mixolydian",n[n.aeolian=7]="aeolian",n[n.ionian=8]="ionian",n[n.locrian=9]="locrian",n))(bi||{});Array.prototype.last||Object.defineProperty(Array.prototype,"last",{enumerable:!1,value:function(){return this[this.length-1]}});Array.prototype.clear||Object.defineProperty(Array.prototype,"clear",{enumerable:!1,value:function(){this.length=0}});Array.prototype.contains||Object.defineProperty(Array.prototype,"contains",{enumerable:!1,value:function(n){return this.indexOf(n)!==-1}});class Ti{static contains2(t,e){for(let i=0;i<t.length;i++)if(t[i]===e)return!0;return!1}static last(t){return t[t.length-1]}static removeDictElementIfTrue(t,e,i){const s=[];e.forEach(function(r,o){i(t,r,o)&&s.push(r)});for(let r=0;r<s.length;r++)e.remove(s[r])}static getLastElement(t){return t[t.length-1]}static binarySearch(t,e,i,s=0,r=t.length-1){let o=1;for(;s<=r;){o=Math.floor((s+r)/2);const a=i(t[o],e);if(a===0)return o;a<0&&(s=o+1),0<a&&(r=o)}return-o}}class Pa extends Pe{constructor(t,e){super(),this.parentVoiceEntry=t,this.parentStaffEntry=e,this.PositionAndShape=new le(this,e?e.PositionAndShape:void 0,!0),this.notes=[],this.rules=e?e.parentMeasure.parentSourceMeasure.Rules:new Ui}sort(){return this.notes.sort((t,e)=>{var i,s,r,o;return((s=(i=e.sourceNote.Pitch)==null?void 0:i.getHalfTone())!=null?s:0)-((o=(r=t.sourceNote.Pitch)==null?void 0:r.getHalfTone())!=null?o:0)}),this.notes}sortForVexflow(){return this.notes.sort((t,e)=>{var i,s,r;return((s=(i=t.sourceNote.Pitch)==null?void 0:i.getHalfTone())!=null?s:0)-((r=e.sourceNote.Pitch.getHalfTone())!=null?r:0)}),this.notes}color(){}}class La{constructor(t,e){this.musicPages=[],this.measureList=[],this.verticalGraphicalStaffEntryContainers=[],this.cursors=[],this.leadSheet=!1,this.musicSheet=t,this.numberOfStaves=this.musicSheet.Staves.length,this.calculator=e,this.calculator.initialize(this)}get ParentMusicSheet(){return this.musicSheet}get GetCalculator(){return this.calculator}get JianpuKeySignature(){return this.jianpuKeySignature}set JianpuKeySignature(t){this.jianpuKeySignature=t}get MusicPages(){return this.musicPages}set MusicPages(t){this.musicPages=t}get MeasureList(){return this.measureList}set MeasureList(t){this.measureList=t}get VerticalGraphicalStaffEntryContainers(){return this.verticalGraphicalStaffEntryContainers}set VerticalGraphicalStaffEntryContainers(t){this.verticalGraphicalStaffEntryContainers=t}get Title(){return this.title}set Title(t){this.title=t}get Subtitle(){return this.subtitle}set Subtitle(t){this.subtitle=t}get Composer(){return this.composer}set Composer(t){this.composer=t}get Lyricist(){return this.lyricist}set Lyricist(t){this.lyricist=t}get Cursors(){return this.cursors}get SelectionStartSymbol(){return this.selectionStartSymbol}get SelectionEndSymbol(){return this.selectionEndSymbol}get MinAllowedSystemWidth(){return this.minAllowedSystemWidth}set MinAllowedSystemWidth(t){this.minAllowedSystemWidth=t}get NumberOfStaves(){return this.numberOfStaves}get LeadSheet(){return this.leadSheet}set LeadSheet(t){this.leadSheet=t}static transformRelativeToAbsolutePosition(t){for(let e=0;e<t.MusicPages.length;e++){const i=t.MusicPages[e].setMusicPageAbsolutePosition(e,t.ParentMusicSheet.Rules);t.MusicPages[e].PositionAndShape.calculateAbsolutePositionsRecursive(i.x,i.y)}}Initialize(){this.verticalGraphicalStaffEntryContainers=[],this.musicPages=[],this.measureList=[]}reCalculate(){this.calculator.calculate()}EnforceRedrawOfMusicSystems(){for(let t=0,e=this.musicPages.length;t<e;++t){const i=this.musicPages[t];for(let s=0,r=i.MusicSystems.length;s<r;++s){const o=i.MusicSystems[s];o.needsToBeRedrawn=!0}}}getClickedObject(t){for(let e=0,i=this.MusicPages.length;e<i;++e)return this.MusicPages[e].PositionAndShape.getClickedObjectOfType(t)}findGraphicalMeasure(t,e){for(let i=t;i>=0;i--){const s=this.measureList[i][e];if(s)return s}}findGraphicalStaffEntryFromMeasureList(t,e,i){for(let s=e;s<this.measureList.length;s++){const r=this.measureList[s][t];if(!!r)for(let o=0,a=r.staffEntries.length;o<a;++o){const l=r.staffEntries[o];if(l.sourceStaffEntry===i)return l}}}findNextGraphicalStaffEntry(t,e,i){const s=i.parentMeasure,r=s.staffEntries.indexOf(i);if(r<s.staffEntries.length-1)return s.staffEntries[r+1];if(e<this.measureList.length-1){const o=this.measureList[e+1][t];if(o.staffEntries.length>0)return o.staffEntries[0]}}getFirstVisibleMeasuresListFromIndices(t,e){const i=[],s=this.measureList[0].length;for(let r=t;r<=e;r++)for(let o=0;o<s;o++)if(this.measureList[r][o].isVisible()){i.push(this.measureList[r][o]);break}return i}orderMeasuresByStaffLine(t){const e=[];let i=[];e.push(i);for(let s=0;s<t.length;s++)s===0?i.push(t[0]):(t[s].ParentStaffLine===t[s-1].ParentStaffLine||(e.indexOf(i)===-1&&e.push(i),i=[],e.push(i)),i.push(t[s]));return e}initializeActiveClefs(){const t=[],e=this.musicSheet.getFirstSourceMeasure();if(e)for(let i=0;i<e.CompleteNumberOfStaves;i++){let s=new Wt;if(e.FirstInstructionsStaffEntries[i])for(let r=0,o=e.FirstInstructionsStaffEntries[i].Instructions.length;r<o;++r){const a=e.FirstInstructionsStaffEntries[i].Instructions[r];a instanceof Wt&&(s=a)}t.push(s)}return t}GetMainKey(){const t=this.musicSheet.getFirstSourceMeasure();if(t)for(let e=0;e<t.CompleteNumberOfStaves;e++)for(let i=0,s=t.FirstInstructionsStaffEntries[e].Instructions.length;i<s;++i){const r=t.FirstInstructionsStaffEntries[e].Instructions[i];if(r instanceof xe)return r}}getOrCreateVerticalContainer(t){if(this.verticalGraphicalStaffEntryContainers.length===0||Ti.getLastElement(this.verticalGraphicalStaffEntryContainers).AbsoluteTimestamp.lt(t)){const e=new pn(this.numberOfStaves,t);return this.verticalGraphicalStaffEntryContainers.push(e),e}for(let e=this.verticalGraphicalStaffEntryContainers.length-1;e>=0;e--){if(this.verticalGraphicalStaffEntryContainers[e].AbsoluteTimestamp.lt(t)){const i=new pn(this.numberOfStaves,t);return this.verticalGraphicalStaffEntryContainers.splice(e+1,0,i),i}if(this.verticalGraphicalStaffEntryContainers[e].AbsoluteTimestamp.Equals(t))return this.verticalGraphicalStaffEntryContainers[e]}}GetVerticalContainerFromTimestamp(t,e=0){const i=Ti.binarySearch(this.verticalGraphicalStaffEntryContainers,new pn(0,t),pn.compareByTimestamp,e);if(i>=0)return this.verticalGraphicalStaffEntryContainers[i]}GetInterpolatedIndexInVerticalContainers(t){const e=this.verticalGraphicalStaffEntryContainers;let i=0,s=e.length-1,r,o;if(t.lte(e[e.length-1].AbsoluteTimestamp)){for(;s-i>1;){const c=Math.floor((s+i)/2);if(e[i].AbsoluteTimestamp.Equals(t)){s=i;break}else if(e[s].AbsoluteTimestamp.Equals(t)){i=s;break}else{if(e[c].AbsoluteTimestamp.Equals(t))return this.verticalGraphicalStaffEntryContainers.indexOf(e[c]);t.lt(e[c].AbsoluteTimestamp)?s=c:i=c}}if(i===s)return this.verticalGraphicalStaffEntryContainers.indexOf(e[i]);r=e[i].AbsoluteTimestamp,o=e[s].AbsoluteTimestamp}else r=e[e.length-1].AbsoluteTimestamp,o=W.plus(this.getLongestStaffEntryDuration(e.length-1),r),s=e.length;const a=o.RealValue-r.RealValue,l=o.RealValue-t.RealValue,h=s-l/a;return Math.min(h,this.verticalGraphicalStaffEntryContainers.length)}getVisibleStavesIndicesFromSourceMeasure(t){const e=[],i=[];for(let s=0,r=t.length;s<r;++s){const a=t[s].ParentStaff.ParentInstrument;e.indexOf(a)===-1&&e.push(a)}for(let s=0,r=e.length;s<r;++s){const o=e[s],a=this.musicSheet.getGlobalStaffIndexOfFirstStaff(o);for(let l=0;l<o.Staves.length;l++)i.push(a+l)}return i}getGraphicalMeasureFromSourceMeasureAndIndex(t,e){var i;for(let s=0;s<this.measureList.length;s++)if(((i=this.measureList[s][0])==null?void 0:i.parentSourceMeasure)===t)return this.measureList[s][e]}getLastGraphicalMeasureFromIndex(t,e=!0){let i=this.measureList.length-1;return e&&(i=Math.min(i,this.musicSheet.Rules.MaxMeasureToDrawIndex)),this.measureList[i][t]}getMeasureIndex(t,e,i){for(e=0;e<this.measureList.length;e++)for(let s=0,r=this.measureList[e].length;s<r;++s)if(this.measureList[e][s]===t)return!0;return!1}GetNearestGraphicalObject(t,e=Pe.name,i=5,s=20,r=5,o=void 0){const a=[];for(;a.length===0&&i<=s;){const h=new le(void 0);h.BorderLeft=t.x-i,h.BorderTop=t.y-i,h.BorderRight=t.x+i,h.BorderBottom=t.y+i,h.AbsolutePosition=new O(t.x,t.y),h.calculateAbsolutePosition();for(let c=0,u=this.MusicPages.length;c<u;++c){const d=this.MusicPages[c].PositionAndShape.getObjectsInRegion(h,!1,e);if(!(!d||d.length===0))for(let p=0,g=d.length;p<g;++p)o?o(d[p])&&a.push(d[p]):a.push(d[p])}i+=r}let l;for(let h=0,c=a.length;h<c;++h){const u=a[h];if(l===void 0)l=u;else{const f=this.CalculateDistance(u.PositionAndShape.AbsolutePosition,t),d=this.CalculateDistance(l.PositionAndShape.AbsolutePosition,t);f<d&&(l=u)}}if(l)return l}GetNearestVoiceEntry(t){return this.GetNearestGraphicalObject(t,Pa.name,5,20,5,e=>{var i;return((i=e.parentStaffEntry)==null?void 0:i.relInMeasureTimestamp)!==void 0})}GetNearestNote(t,e){const i=this.GetNearestVoiceEntry(t);if(!i)return;let s,r=Number.MAX_SAFE_INTEGER;for(const o of i.notes){const a=o.PositionAndShape.AbsolutePosition.y,l=Math.abs(o.PositionAndShape.AbsolutePosition.x-t.x),h=Math.abs(a-t.y);l+h<r&&(s=o,r=l+h)}return s}domToSvg(t){return this.domToSvgTransform(t,!0)}svgToDom(t){return this.domToSvgTransform(t,!1)}svgToOsmd(t){const e=new O(t.x,t.y);return e.x/=10,e.y/=10,e}domToSvgTransform(t,e){const s=this.drawer.Backends[0].getSvgElement(),r=s.createSVGPoint();r.x=t.x,r.y=t.y;let o=s.getScreenCTM();e&&(o=o.inverse());const a=r.matrixTransform(o);return new O(a.x,a.y)}GetClickableLabel(t){const s=new le;s.BorderLeft=t.x-4,s.BorderTop=t.y-4,s.BorderRight=t.x+4,s.BorderBottom=t.y+4,s.AbsolutePosition=new O(0,0);for(let r=0,o=this.MusicPages.length;r<o;++r){const l=this.MusicPages[r].PositionAndShape.getObjectsInRegion(s);if(l.length===1)for(let h=0,c=l.length;h<c;++h)return l[h]}}GetPossibleCommentAnchor(t){const e=this.GetNearestVoiceEntry(t);if(!!e)return e.parentStaffEntry.sourceStaffEntry}GetClickedObjectOfType(t){for(let e=0,i=this.musicPages.length;e<i;++e){const r=this.musicPages[e].PositionAndShape.getClickedObjectOfType(t);if(r)return r}}GetClickedClickable(t){for(let e=0,i=this.musicPages.length;e<i;++e){const r=this.musicPages[e].PositionAndShape.getClickedClickable(t);if(r&&r instanceof Tn)return r}}tryGetTimestampFromPosition(t){const e=this.GetClickedObjectOfType(t);if(!!e)return e.getAbsoluteTimestamp()}tryGetClickableLabel(t){try{return this.GetClickableLabel(t)}catch(e){j.info("GraphicalMusicSheet.tryGetClickableObject","positionOnMusicSheet: "+t,e)}}tryGetTimeStampFromPosition(t){try{const e=this.GetNearestVoiceEntry(t);return e?e.parentStaffEntry.getAbsoluteTimestamp():void 0}catch(e){j.info("GraphicalMusicSheet.tryGetTimeStampFromPosition","positionOnMusicSheet: "+t,e)}}getStaffEntry(t){const e=this.VerticalGraphicalStaffEntryContainers[t];let i;try{for(let s=0,r=e.StaffEntries.length;s<r;++s){const o=e.StaffEntries[s];!o||!o.sourceStaffEntry.ParentStaff.ParentInstrument.Visible||(i?o.PositionAndShape&&i.PositionAndShape&&i.PositionAndShape.RelativePosition.x>o.PositionAndShape.RelativePosition.x&&(i=o):i=o)}}catch(s){j.info("GraphicalMusicSheet.getStaffEntry",s)}return i}GetPreviousVisibleContainerIndex(t){for(let e=t-1;e>=0;e--){const i=this.verticalGraphicalStaffEntryContainers[e].StaffEntries;for(let s=0,r=i.length;s<r;++s){const o=i[s];if(o&&o.sourceStaffEntry.ParentStaff.ParentInstrument.Visible)return e}}return-1}GetNextVisibleContainerIndex(t){for(let e=t+1;e<this.verticalGraphicalStaffEntryContainers.length;++e){const i=this.verticalGraphicalStaffEntryContainers[e].StaffEntries;for(let s=0,r=i.length;s<r;++s){const o=i[s];if(o&&o.sourceStaffEntry.ParentStaff.ParentInstrument.Visible)return e}}return-1}findClosestLeftStaffEntry(t,e){let i,s=Math.floor(t);s=Math.min(this.VerticalGraphicalStaffEntryContainers.length-1,s);for(let r=s;r>=0;r--)if(i=this.getStaffEntry(r),i)if(e){if(i.sourceStaffEntry.ParentStaff.ParentInstrument.Visible)return i}else return i}findClosestRightStaffEntry(t,e){let i;const s=Math.max(0,Math.ceil(t));for(let r=s;r<this.VerticalGraphicalStaffEntryContainers.length;r++)if(i=this.getStaffEntry(r),i)if(e){if(i.sourceStaffEntry.ParentStaff.ParentInstrument.Visible)return i}else return i}calculateCursorLineAtTimestamp(t,e){const i=this.calculateXPositionFromTimestamp(t),s=i[0],r=i[1];if(!r||r.StaffLines.length===0)return;const o=r.PositionAndShape.AbsolutePosition.y,a=Ti.last(r.StaffLines).PositionAndShape.RelativePosition.y+4;return new ci(new O(s,o),new O(s,o+a),3,e)}calculateXPositionFromTimestamp(t){var h,c,u,f;let e;const i=this.GetInterpolatedIndexInVerticalContainers(t),s=this.findClosestLeftStaffEntry(i,!0),r=this.findClosestRightStaffEntry(i,!0),o=t.RealValue;if(!s&&!r)return[0,void 0,void 0];let a;s?a=(h=s.parentMeasure.ParentStaffLine)==null?void 0:h.ParentMusicSystem:a=(c=r.parentMeasure.ParentStaffLine)==null?void 0:c.ParentMusicSystem;let l;if(r?l=(u=r.parentMeasure.ParentStaffLine)==null?void 0:u.ParentMusicSystem:l=(f=s.parentMeasure.ParentStaffLine)==null?void 0:f.ParentMusicSystem,a===l){e=a;let d,p,g;if(!s)p=g=r.PositionAndShape.AbsolutePosition.x,d=0;else if(r)p=s.PositionAndShape.AbsolutePosition.x,g=r.PositionAndShape.AbsolutePosition.x,s===r?d=0:d=(o-s.getAbsoluteTimestamp().RealValue)/(r.getAbsoluteTimestamp().RealValue-s.getAbsoluteTimestamp().RealValue);else{p=s.PositionAndShape.AbsolutePosition.x,g=e.GetRightBorderAbsoluteXPosition();const S=s.parentMeasure.parentSourceMeasure;d=(o-s.getAbsoluteTimestamp().RealValue)/(W.plus(S.AbsoluteTimestamp,S.Duration).RealValue-s.getAbsoluteTimestamp().RealValue)}return d=Math.min(1,Math.max(0,d)),[p+d*(g-p),e,s]}else{const d=r.parentMeasure.parentSourceMeasure.AbsoluteTimestamp.RealValue;let p,g;if(o<d){e=a;const m=s.PositionAndShape.AbsolutePosition.x,S=e.GetRightBorderAbsoluteXPosition();p=(o-s.getAbsoluteTimestamp().RealValue)/(d-s.getAbsoluteTimestamp().RealValue),p=Math.min(1,Math.max(0,p)),g=m+p*(S-m)}else{e=l;const m=r.PositionAndShape.AbsolutePosition.x,S=e.GetLeftBorderAbsoluteXPosition();p=(o-d)/(r.getAbsoluteTimestamp().RealValue-d),p=Math.min(1,Math.max(0,p)),g=S+p*(m-S)}return[g,e,s]}}calculateCursorPoints(t,e){if(e===void 0||e.StaffLines.length===0)return[new O,new O];const i=e.PositionAndShape.AbsolutePosition.y,s=e.StaffLines.last(),r=s.PositionAndShape.RelativePosition.y+s.StaffHeight;return[new O(t,i),new O(t,i+r)]}GetNumberOfVisibleInstruments(){let t=0;for(let e=0,i=this.musicSheet.Instruments.length;e<i;++e)this.musicSheet.Instruments[e].Visible===!0&&t++;return t}GetNumberOfFollowedInstruments(){let t=0;for(let e=0,i=this.musicSheet.Instruments.length;e<i;++e)this.musicSheet.Instruments[e].Following===!0&&t++;return t}GetGraphicalFromSourceStaffEntry(t){var i;return(i=t.VerticalContainerParent.ParentMeasure)!=null&&i.VerticalMeasureList?t.VerticalContainerParent.ParentMeasure.VerticalMeasureList[t.ParentStaff.idInMusicSheet].findGraphicalStaffEntryFromTimestamp(t.Timestamp):void 0}CalculateDistance(t,e){const i=t.x-e.x,s=t.y-e.y;return i*i+s*s}getLongestStaffEntryDuration(t){let e=new W(0,1);for(const i of this.verticalGraphicalStaffEntryContainers[t].StaffEntries){if(!i)continue;const s=i.findStaffEntryMaxNoteLength();e.lt(s)&&(e=s)}return e}}class Cn{constructor(t,e,i,s,r,o){this.slurs=[],this.playbackInstrumentId=void 0,this.notehead=void 0,this.printObject=!0,this.voiceEntry=t,this.parentStaffEntry=e,this.length=i,this.pitch=s,this.sourceMeasure=r,this.isRestFlag=o!=null?o:!1,this.noteTremoloType="",this.glissandoType="",s?this.halfTone=s.getHalfTone():this.halfTone=0}get NoteAsString(){return this.pitch.toString()}get TremoloType(){return this.noteTremoloType}set TremoloType(t){this.noteTremoloType=t}get ParentVoiceEntry(){return this.voiceEntry}set ParentVoiceEntry(t){this.voiceEntry=t}get ParentStaffEntry(){return this.parentStaffEntry}get ParentStaff(){return this.parentStaffEntry.ParentStaff}get Length(){return this.length}set PlaybackNote(t){this.playbackNote=t}get PlaybackNote(){return this.playbackNote}set Length(t){this.length=t}get SourceMeasure(){return this.sourceMeasure}get TypeLength(){return this.typeLength}set TypeLength(t){this.typeLength=t}get NoteTypeXml(){return this.noteTypeXml}set NoteTypeXml(t){this.noteTypeXml=t}get NormalNotes(){return this.normalNotes}set NormalNotes(t){this.normalNotes=t}get Pitch(){return this.pitch}get NoteBeam(){return this.beam}set NoteBeam(t){this.beam=t}set Notehead(t){this.notehead=t}get Notehead(){return this.notehead}get NoteTuplet(){return this.tuplet}set NoteTuplet(t){this.tuplet=t}get NoteTie(){return this.tie}set NoteTie(t){this.tie=t}get NoteSlurs(){return this.slurs}set NoteSlurs(t){this.slurs=t}get PlaybackInstrumentId(){return this.playbackInstrumentId}set PlaybackInstrumentId(t){this.playbackInstrumentId=t}get PrintObject(){return this.printObject}set PrintObject(t){this.printObject=t}get Arpeggio(){return this.arpeggio}set Arpeggio(t){this.arpeggio=t}get IsCueNote(){return this.isCueNote}set IsCueNote(t){this.isCueNote=t}get StemDirectionXml(){return this.stemDirectionXml}set StemDirectionXml(t){this.stemDirectionXml=t}get TremoloStrokes(){return this.tremoloStrokes}set TremoloStrokes(t){this.tremoloStrokes=t}get StemColorXml(){return this.stemColorXml}set StemColorXml(t){this.stemColorXml=t}get NoteheadColorXml(){return this.noteheadColorXml}set NoteheadColorXml(t){this.noteheadColorXml=t}get NoteheadColor(){return this.noteheadColor}set NoteheadColor(t){this.noteheadColor=t}get NoteheadColorCurrentlyRendered(){return this.noteheadColorCurrentlyRendered}set NoteheadColorCurrentlyRendered(t){this.noteheadColorCurrentlyRendered=t}isRest(){return this.isRestFlag}isWholeRest(){return this.isRest()&&this.Length.RealValue===this.sourceMeasure.ActiveTimeSignature.RealValue}ToString(){return this.pitch?this.Pitch.ToString()+", length: "+this.length.toString():"rest note, length: "+this.length.toString()}getAbsoluteTimestamp(){return W.plus(this.voiceEntry.Timestamp,this.sourceMeasure.AbsoluteTimestamp)}checkForDoubleSlur(t){for(let e=0,i=this.slurs.length;e<i;++e){const s=this.slurs[e];if(s.StartNote!==void 0&&s.EndNote!==void 0&&t.StartNote!==void 0&&t.StartNote===s.StartNote&&s.EndNote===this)return!0}return!1}}const M=()=>{};M.L=(n,t)=>{if(!t)return;const e=Array.prototype.slice.call(t).join(" ");window.console.log(n+": "+e)};M.MakeException=n=>class extends Error{constructor(e,i){super(e),this.name=n,this.message=e,this.data=i}};class Zh{constructor(t,e){this.code=t,this.message=e}toString(){return"[RuntimeError] "+this.code+":"+this.message}}M.RuntimeError=Zh;M.RERR=M.RuntimeError;M.Merge=(n,t)=>{for(const e in t)n[e]=t[e];return n};M.Min=Math.min;M.Max=Math.max;M.forEach=(n,t)=>{for(let e=0;e<n.length;e++)t(n[e],e)};M.RoundN=(n,t)=>n%t>=t/2?parseInt(n/t,10)*t+t:parseInt(n/t,10)*t;M.MidLine=(n,t)=>{let e=t+(n-t)/2;return e%2>0&&(e=M.RoundN(e*10,5)/10),e};M.SortAndUnique=(n,t,e)=>{if(n.length>1){const i=[];let s;n.sort(t);for(let r=0;r<n.length;++r)(r===0||!e(n[r],s))&&i.push(n[r]),s=n[r];return i}else return n};M.Contains=(n,t)=>{let e=n.length;for(;e--;)if(n[e]===t)return!0;return!1};M.getCanvasContext=n=>{if(!n)throw new M.RERR("BadArgument","Invalid canvas selector: "+n);const t=document.getElementById(n);if(!(t&&t.getContext))throw new M.RERR("UnsupportedBrowserError","This browser does not support HTML5 Canvas");return t.getContext("2d")};M.drawDot=(n,t,e,i="#55")=>{n.save(),n.setFillStyle(i),n.beginPath(),n.arc(t,e,3,0,Math.PI*2,!0),n.closePath(),n.fill(),n.restore()};M.BM=(n,t)=>{const e=new Date().getTime();t();const i=new Date().getTime()-e;M.L(n+i+"ms")};M.StackTrace=()=>new Error().stack;M.W=(...n)=>{const t=n.join(" ");window.console.log("Warning: ",t,M.StackTrace())};M.Prefix=n=>M.Prefix.prefix+n;M.Prefix.prefix="vf-";class Rt{static GCD(t,e){if(typeof t!="number"||typeof e!="number")throw new M.RERR("BadArgument",`Invalid numbers: ${t}, ${e}`);let i;for(;e!==0;)i=e,e=t%e,t=i;return t}static LCM(t,e){return t*e/Rt.GCD(t,e)}static LCMM(t){if(t.length===0)return 0;if(t.length===1)return t[0];if(t.length===2)return Rt.LCM(t[0],t[1]);{const e=t[0];return t.shift(),Rt.LCM(e,Rt.LCMM(t))}}constructor(t,e){this.set(t,e)}set(t,e){return this.numerator=t===void 0?1:t,this.denominator=e===void 0?1:e,this}value(){return this.numerator/this.denominator}simplify(){let t=this.numerator,e=this.denominator;const i=Rt.GCD(t,e);return t/=i,e/=i,e<0&&(e=-e,t=-t),this.set(t,e)}add(t,e){let i,s;t instanceof Rt?(i=t.numerator,s=t.denominator):(t!==void 0?i=t:i=0,e!==void 0?s=e:s=1);const r=Rt.LCM(this.denominator,s),o=r/this.denominator,a=r/s,l=this.numerator*o+i*a;return this.set(l,r)}subtract(t,e){let i,s;t instanceof Rt?(i=t.numerator,s=t.denominator):(t!==void 0?i=t:i=0,e!==void 0?s=e:s=1);const r=Rt.LCM(this.denominator,s),o=r/this.denominator,a=r/s,l=this.numerator*o-i*a;return this.set(l,r)}multiply(t,e){let i,s;return t instanceof Rt?(i=t.numerator,s=t.denominator):(t!==void 0?i=t:i=1,e!==void 0?s=e:s=1),this.set(this.numerator*i,this.denominator*s)}divide(t,e){let i,s;return t instanceof Rt?(i=t.numerator,s=t.denominator):(t!==void 0?i=t:i=1,e!==void 0?s=e:s=1),this.set(this.numerator*s,this.denominator*i)}equals(t){const e=Rt.__compareA.copy(t).simplify(),i=Rt.__compareB.copy(this).simplify();return e.numerator===i.numerator&&e.denominator===i.denominator}greaterThan(t){const e=Rt.__compareB.copy(this);return e.subtract(t),e.numerator>0}greaterThanEquals(t){const e=Rt.__compareB.copy(this);return e.subtract(t),e.numerator>=0}lessThan(t){return!this.greaterThanEquals(t)}lessThanEquals(t){return!this.greaterThan(t)}clone(){return new Rt(this.numerator,this.denominator)}copy(t){return typeof t=="number"?this.set(t||0,1):this.set(t.numerator,t.denominator)}quotient(){return Math.floor(this.numerator/this.denominator)}fraction(){return this.numerator%this.denominator}abs(){return this.denominator=Math.abs(this.denominator),this.numerator=Math.abs(this.numerator),this}toString(){return this.numerator+"/"+this.denominator}toSimplifiedString(){return Rt.__tmp.copy(this).simplify().toString()}toMixedString(){let t="";const e=this.quotient(),i=Rt.__tmp.copy(this);return e<0?i.abs().fraction():i.fraction(),e!==0?(t+=e,i.numerator!==0&&(t+=" "+i.toSimplifiedString())):i.numerator===0?t="0":t=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)}}Rt.__compareA=new Rt;Rt.__compareB=new Rt;Rt.__tmp=new Rt;const Qh=M.MakeException("RegistryError");function Oo(n,t,e,i,s){n[t][e]||(n[t][e]={}),n[t][e][i]=s}class gi{static get INDEXES(){return["type"]}constructor(){this.clear()}static enableDefaultRegistry(t){gi.defaultRegistry=t}static getDefaultRegistry(){return gi.defaultRegistry}static disableDefaultRegistry(){gi.defaultRegistry=null}clear(){return this.index={id:{},type:{},class:{}},this}updateIndex({id:t,name:e,value:i,oldValue:s}){const r=this.getElementById(t);s!==null&&this.index[e][s]&&delete this.index[e][s][t],i!==null&&Oo(this.index,e,i,r.getAttribute("id"),r)}register(t,e){if(e=e||t.getAttribute("id"),!e)throw new Qh("Can't add element without `id` attribute to registry",t);return t.setAttribute("id",e),Oo(this.index,"id",e,e,t),gi.INDEXES.forEach(i=>{this.updateIndex({id:e,name:i,value:t.getAttribute(i),oldValue:null})}),t.onRegister(this),this}getElementById(t){return this.index.id[t]?this.index.id[t][t]:null}getElementsByAttribute(t,e){const i=this.index[t];return i&&i[e]?Object.keys(i[e]).map(s=>i[e][s]):[]}getElementsByType(t){return this.getElementsByAttribute("type",t)}getElementsByClass(t){return this.getElementsByAttribute("class",t)}onUpdate({id:t,name:e,value:i,oldValue:s}){function r(o,a){return o.filter(l=>l===a).length>0}return r(gi.INDEXES.concat(["id","class"]),e)?(this.updateIndex({id:t,name:e,value:i,oldValue:s}),this):this}}gi.defaultRegistry=null;class he{static newID(){return"auto"+he.ID++}constructor({type:t}={}){this.attrs={id:he.newID(),el:null,type:t||"Base",classes:{}},this.boundingBox=null,this.context=null,this.rendered=!1,gi.getDefaultRegistry()&&gi.getDefaultRegistry().register(this)}setStyle(t){return this.style=t,this}getStyle(){return this.style}applyStyle(t=this.context,e=this.getStyle()){return e?(t.save(),e.shadowColor&&t.setShadowColor(e.shadowColor),e.shadowBlur&&t.setShadowBlur(e.shadowBlur),e.fillStyle&&t.setFillStyle(e.fillStyle),e.strokeStyle&&t.setStrokeStyle(e.strokeStyle),e.lineWidth&&t.setLineWidth(e.lineWidth),this):this}restoreStyle(t=this.context,e=this.getStyle()){return e?(t.restore(),this):this}drawWithStyle(){this.checkContext(),this.applyStyle(),this.draw(),this.restoreStyle()}hasClass(t){return this.attrs.classes[t]===!0}addClass(t){return this.attrs.classes[t]=!0,this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:t,oldValue:null}),this}removeClass(t){return delete this.attrs.classes[t],this.registry&&this.registry.onUpdate({id:this.getAttribute("id"),name:"class",value:null,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]}setAttribute(t,e){const i=this.attrs.id,s=this.attrs[t];return this.attrs[t]=e,this.registry&&this.registry.onUpdate({id:i,name:t,value:e,oldValue:s}),this}getContext(){return this.context}setContext(t){return this.context=t,this}getBoundingBox(){return this.boundingBox}checkContext(){if(!this.context)throw new M.RERR("NoContext","No rendering context attached to instance");return this.context}}he.ID=1e3;class $h{constructor(t,e,i,s){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN,this.addPoint(t,e),this.addPoint(i,s)}width(){return this.x2-this.x1}height(){return this.y2-this.y1}addPoint(t,e){t!=null&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=t,this.x2=t),t<this.x1&&(this.x1=t),t>this.x2&&(this.x2=t)),e!=null&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),e<this.y1&&(this.y1=e),e>this.y2&&(this.y2=e))}addX(t){this.addPoint(t,null)}addY(t){this.addPoint(null,t)}addQuadraticCurve(t,e,i,s,r,o){const a=t+.6666666666666666*(i-t),l=e+2/3*(s-e),h=a+1/3*(r-t),c=l+1/3*(o-e);this.addBezierCurve(t,e,a,l,h,c,r,o)}addBezierCurve(t,e,i,s,r,o,a,l){const h=[t,e],c=[i,s],u=[r,o],f=[a,l];let d;this.addPoint(h[0],h[1]),this.addPoint(f[0],f[1]);const p=(g,m)=>Math.pow(1-g,3)*h[m]+3*Math.pow(1-g,2)*g*c[m]+3*(1-g)*Math.pow(g,2)*u[m]+Math.pow(g,3)*f[m];for(d=0;d<=1;d++){const g=6*h[d]-12*c[d]+6*u[d],m=-3*h[d]+9*c[d]-9*u[d]+3*f[d],S=3*c[d]-3*h[d];if(m===0){if(g===0)continue;const w=-S/g;0<w&&w<1&&(d===0&&this.addX(p(w,d)),d===1&&this.addY(p(w,d)));continue}const b=Math.pow(g,2)-4*S*m;if(b<0)continue;const y=(-g+Math.sqrt(b))/(2*m);0<y&&y<1&&(d===0&&this.addX(p(y,d)),d===1&&this.addY(p(y,d)));const x=(-g-Math.sqrt(b))/(2*m);0<x&&x<1&&(d===0&&this.addX(p(x,d)),d===1&&this.addY(p(x,d)))}}}class es{static copy(t){return new es(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){this.x+=t,this.y+=e}clone(){return es.copy(this)}mergeWith(t,e){const i=t,s=this.x<i.x?this.x:i.x,r=this.y<i.y?this.y:i.y,o=Math.max(this.x+this.w,i.x+i.w)-s,a=Math.max(this.y+this.h,i.y+i.h)-r;return this.x=s,this.y=r,this.w=o,this.h=a,e&&this.draw(e),this}draw(t,e,i){e||(e=0),i||(i=0),t.rect(this.x+e,this.y+i,this.w,this.h),t.stroke()}}const bn={glyphs:{v0:{x_min:0,x_max:514.5,ha:525,o:"m 236 648 b 246 648 238 648 242 648 b 288 646 261 648 283 648 b 472 513 364 634 428 587 b 514 347 502 464 514 413 b 462 163 514 272 499 217 b 257 44 409 83 333 44 b 50 163 181 44 103 83 b 0 347 14 217 0 272 b 40 513 0 413 12 464 b 236 648 87 591 155 638 m 277 614 b 253 616 273 616 261 616 b 242 616 247 616 243 616 b 170 499 193 609 181 589 b 159 348 163 446 159 398 b 166 222 159 308 161 266 b 201 91 174 138 183 106 b 257 76 215 81 235 76 b 311 91 277 76 299 81 b 347 222 330 106 338 138 b 353 348 352 266 353 308 b 344 499 353 398 351 446 b 277 614 333 587 322 606 m 257 -1 l 258 -1 l 255 -1 l 257 -1 m 257 673 l 258 673 l 255 673 l 257 673 "},v1:{x_min:-1.359375,x_max:344.359375,ha:351,o:"m 126 637 l 129 638 l 198 638 l 266 638 l 269 635 b 274 631 272 634 273 632 l 277 627 l 277 395 b 279 156 277 230 277 161 b 329 88 281 123 295 106 b 344 69 341 81 344 79 b 337 55 344 62 343 59 l 333 54 l 197 54 l 61 54 l 58 55 b 50 69 53 59 50 62 b 65 88 50 79 53 81 b 80 97 72 91 74 93 b 117 156 103 113 112 129 b 117 345 117 161 117 222 l 117 528 l 100 503 l 38 406 b 14 383 24 384 23 383 b -1 398 5 383 -1 390 b 4 415 -1 403 1 409 b 16 437 5 416 10 426 l 72 539 l 100 596 b 121 632 119 631 119 631 b 126 637 122 634 125 635 m 171 -1 l 172 -1 l 170 -1 l 171 -1 m 171 673 l 172 673 l 170 673 l 171 673 "},v2:{x_min:-1.359375,x_max:458.6875,ha:468,o:"m 197 648 b 216 648 201 648 208 648 b 258 646 232 648 253 648 b 419 546 333 637 393 599 b 432 489 428 528 432 509 b 356 342 432 440 405 384 b 235 278 322 313 288 295 b 69 170 166 256 107 217 b 69 169 69 170 69 169 b 69 169 69 169 69 169 b 74 173 69 169 72 170 b 209 222 112 204 163 222 b 310 195 247 222 274 215 b 371 179 332 184 352 179 b 396 181 379 179 387 179 b 428 202 409 184 423 194 b 442 212 431 209 436 212 b 458 197 450 212 458 206 b 441 148 458 190 449 165 b 299 44 409 84 353 44 b 288 45 295 44 292 44 b 250 61 274 45 268 49 b 122 99 212 86 164 99 b 73 91 104 99 88 97 b 28 63 53 84 34 72 b 14 54 25 56 20 54 b 1 62 9 54 4 56 l -1 65 l -1 79 b 0 99 -1 91 0 95 b 2 113 1 102 2 108 b 164 309 20 197 81 272 b 285 470 232 341 277 398 b 287 487 287 476 287 481 b 171 595 287 551 239 595 b 155 595 166 595 160 595 b 142 592 145 594 142 594 b 145 589 142 592 142 591 b 179 527 168 576 179 551 b 132 455 179 496 163 467 b 104 451 122 452 112 451 b 27 530 62 451 27 487 b 29 555 27 538 27 546 b 197 648 44 601 115 639 m 228 -1 l 230 -1 l 227 -1 l 228 -1 m 228 673 l 230 673 l 227 673 l 228 673 "},v3:{x_min:-1.359375,x_max:409.6875,ha:418,o:"m 174 648 b 191 648 176 648 183 648 b 225 648 204 648 220 648 b 402 523 317 638 389 588 b 404 503 404 517 404 510 b 402 484 404 495 404 488 b 264 373 389 437 334 394 b 257 370 259 371 257 371 b 257 370 257 370 257 370 b 264 369 258 370 261 369 b 409 202 359 334 409 267 b 318 72 409 152 381 104 b 200 43 281 52 240 43 b 23 113 134 43 69 68 b 0 169 6 129 0 149 b 77 249 0 210 29 249 l 77 249 b 152 174 125 249 152 212 b 103 102 152 145 137 116 b 103 102 103 102 103 102 b 147 94 103 101 132 95 b 153 94 149 94 151 94 b 265 206 219 94 265 141 b 264 226 265 213 265 219 b 147 355 253 299 204 353 b 126 371 133 356 126 362 b 147 388 126 383 132 388 b 254 474 196 391 238 424 b 259 502 258 484 259 494 b 182 592 259 544 228 582 b 156 595 175 595 166 595 b 115 592 142 595 129 594 l 111 591 l 115 588 b 152 524 141 574 152 549 b 92 449 152 491 130 458 b 76 448 87 448 81 448 b -1 530 32 448 -1 488 b 20 581 -1 548 5 566 b 174 648 55 619 108 641 m 204 -1 l 205 -1 l 202 -1 l 204 -1 m 204 673 l 205 673 l 202 673 l 204 673 "},v4:{x_min:0,x_max:468.21875,ha:478,o:"m 174 637 b 232 638 175 638 189 638 b 277 638 245 638 259 638 l 378 638 l 381 635 b 389 623 386 632 389 627 b 382 609 389 617 386 613 b 366 589 381 606 372 598 l 313 528 l 245 451 l 209 410 l 155 348 l 84 267 b 59 240 72 252 59 240 b 59 240 59 240 59 240 b 151 238 59 238 68 238 l 242 238 l 242 303 b 243 371 242 369 242 370 b 289 426 245 374 254 385 l 303 441 l 317 456 l 338 483 l 360 506 l 371 520 b 386 527 375 526 381 527 b 400 519 392 527 397 524 b 401 440 401 516 401 514 b 401 377 401 423 401 402 l 401 238 l 426 238 b 453 237 449 238 450 238 b 465 217 461 234 465 226 b 460 202 465 212 464 206 b 426 197 454 197 453 197 l 401 197 l 401 180 b 451 88 402 129 412 109 b 468 69 465 81 468 79 b 461 55 468 62 466 59 l 458 54 l 321 54 l 185 54 l 182 55 b 175 69 176 59 175 62 b 191 88 175 79 176 81 b 240 180 230 109 240 129 l 240 197 l 125 197 b 73 195 104 195 87 195 b 8 197 10 195 9 197 b 0 212 2 199 0 205 b 0 212 0 212 0 212 b 20 242 0 219 0 219 b 163 610 104 344 163 492 b 174 637 163 628 166 634 m 234 -1 l 235 -1 l 232 -1 l 234 -1 m 234 673 l 235 673 l 232 673 l 234 673 "},v5:{x_min:0,x_max:409.6875,ha:418,o:"m 47 637 b 53 638 49 638 50 638 b 69 634 55 638 61 637 b 210 610 114 619 161 610 b 363 634 259 610 311 619 b 382 638 372 637 378 638 b 392 634 386 638 389 637 b 397 623 396 630 397 627 b 393 610 397 620 396 616 b 298 505 368 552 338 520 b 212 494 277 498 246 494 b 65 517 163 494 106 502 b 61 517 62 517 61 517 b 61 517 61 517 61 517 b 51 408 61 517 51 412 b 51 408 51 408 51 408 b 51 408 51 408 51 408 b 61 412 53 408 55 409 b 125 434 80 421 103 430 b 185 441 145 440 166 441 b 409 244 310 441 409 353 b 401 191 409 227 406 209 b 197 43 375 105 287 43 b 159 47 183 43 171 44 b 23 123 112 56 61 86 b 0 180 6 140 0 159 b 76 260 0 220 31 260 b 92 259 81 260 87 259 b 152 183 132 251 152 216 b 100 112 152 152 134 122 b 95 111 98 112 95 111 b 95 111 95 111 95 111 b 129 98 95 109 119 101 b 148 97 136 97 141 97 b 264 235 206 97 261 158 b 265 248 265 240 265 244 b 210 398 265 312 243 373 b 179 408 201 406 194 408 b 174 408 178 408 176 408 b 53 369 130 408 88 394 b 34 359 39 359 38 359 b 17 374 24 359 17 365 b 39 628 17 384 38 625 b 47 637 40 631 43 635 m 204 -1 l 205 -1 l 202 -1 l 204 -1 m 204 673 l 205 673 l 202 673 l 204 673 "},v6:{x_min:0,x_max:475.03125,ha:485,o:"m 255 648 b 274 648 259 648 266 648 b 314 646 288 648 307 648 b 450 555 374 637 438 594 b 454 530 453 546 454 538 b 375 451 454 485 416 451 b 328 467 359 451 343 455 b 300 526 310 483 300 503 b 352 598 300 557 319 589 b 356 599 355 598 356 599 b 352 602 356 599 355 601 b 288 616 330 612 308 616 b 210 584 257 616 230 605 b 164 433 189 559 174 508 b 160 374 163 415 160 381 b 160 374 160 374 160 374 b 160 374 160 374 160 374 b 168 377 160 374 164 376 b 258 395 200 390 228 395 b 366 367 294 395 328 387 b 475 223 436 333 475 283 b 472 197 475 215 473 206 b 349 65 462 141 419 95 b 259 43 317 51 288 43 b 167 69 230 43 200 52 b 4 290 80 113 20 195 b 0 349 1 309 0 328 b 20 467 0 391 6 433 b 255 648 58 563 155 637 m 269 363 b 257 363 265 363 261 363 b 210 345 236 363 220 356 b 186 226 196 324 186 272 b 187 198 186 216 186 206 b 213 95 191 151 202 112 b 257 76 221 83 238 76 b 270 77 261 76 266 76 b 321 156 299 81 310 99 b 329 229 326 183 329 206 b 321 301 329 252 326 274 b 269 363 311 342 298 359 m 236 -1 l 238 -1 l 235 -1 l 236 -1 m 236 673 l 238 673 l 235 673 l 236 673 "},v7:{x_min:0,x_max:442.359375,ha:451,o:"m 147 648 b 166 649 153 649 160 649 b 313 598 217 649 273 630 b 340 587 323 588 328 587 l 341 587 b 412 628 367 587 390 601 b 427 638 416 635 421 638 b 439 632 431 638 435 637 b 442 623 441 630 442 628 b 430 569 442 616 439 603 b 352 369 408 492 377 410 b 300 259 325 324 313 298 b 273 84 283 205 273 140 b 265 55 273 65 272 59 l 261 54 l 181 54 l 99 54 l 96 55 b 91 61 95 56 92 59 l 89 63 l 89 77 b 147 263 89 133 111 202 b 261 401 176 313 212 355 b 378 541 315 449 349 489 l 382 548 l 375 544 b 240 495 333 512 285 495 b 129 535 198 495 160 509 b 84 560 108 552 95 560 b 76 559 81 560 78 560 b 31 487 59 555 43 530 b 14 470 27 473 24 470 b 1 477 8 470 4 471 l 0 480 l 0 553 l 0 627 l 1 630 b 16 638 4 635 9 638 b 23 635 17 638 20 637 b 49 626 36 626 39 626 b 96 638 59 626 80 630 b 104 639 99 638 102 639 b 117 644 107 641 112 642 b 147 648 125 645 137 648 m 220 -1 l 221 -1 l 219 -1 l 220 -1 m 220 673 l 221 673 l 219 673 l 220 673 "},v8:{x_min:0,x_max:488.640625,ha:499,o:"m 217 648 b 245 649 225 648 235 649 b 453 516 343 649 430 595 b 458 478 455 503 458 491 b 412 370 458 440 441 398 b 411 369 412 369 411 369 b 415 365 411 367 412 367 b 488 231 462 331 488 281 b 472 165 488 208 483 186 b 243 43 434 86 338 43 b 63 104 178 43 112 62 b 0 233 20 140 0 186 b 73 365 0 283 24 331 l 77 369 l 72 374 b 29 476 42 406 29 441 b 217 648 29 557 103 635 m 258 605 b 242 606 253 605 247 606 b 157 552 198 606 157 580 b 160 541 157 548 159 544 b 319 413 176 503 242 452 l 337 403 l 338 406 b 359 476 352 428 359 452 b 258 605 359 537 318 595 m 138 326 b 130 330 134 328 130 330 b 130 330 130 330 130 330 b 107 305 127 330 112 313 b 84 231 91 281 84 256 b 243 86 84 156 151 86 b 249 87 245 86 246 87 b 347 156 303 88 347 120 b 344 172 347 162 345 167 b 156 319 325 227 257 281 b 138 326 151 322 144 324 m 243 -1 l 245 -1 l 242 -1 l 243 -1 m 243 673 l 245 673 l 242 673 l 243 673 "},v9:{x_min:0,x_max:475.03125,ha:485,o:"m 191 646 b 212 649 198 648 205 649 b 255 644 227 649 243 646 b 458 448 348 616 428 539 b 475 342 469 415 475 378 b 460 244 475 308 469 274 b 193 44 421 124 303 44 b 91 69 157 44 122 51 b 19 161 43 97 19 126 b 21 181 19 167 20 174 b 98 241 32 220 65 241 b 170 186 129 241 160 223 b 172 166 171 179 172 173 b 121 94 172 134 152 102 b 117 93 118 94 117 93 b 121 90 117 93 118 91 b 185 76 142 80 164 76 b 270 119 220 76 251 91 b 308 259 287 145 300 194 b 313 317 310 277 313 310 b 313 317 313 317 313 317 b 313 317 313 317 313 317 b 304 315 313 317 308 316 b 216 295 273 302 245 295 b 145 308 193 295 170 299 b 19 398 88 327 42 360 b 0 469 5 420 0 444 b 24 551 0 496 8 526 b 191 646 54 596 125 637 m 227 614 b 215 616 224 616 220 616 b 202 614 210 616 206 616 b 152 535 174 610 163 592 b 144 463 147 509 144 485 b 152 391 144 440 147 417 b 216 328 163 344 179 328 b 280 391 253 328 269 344 b 288 463 285 417 288 440 b 280 535 288 485 285 509 b 227 614 269 594 258 610 m 236 -1 l 238 -1 l 235 -1 l 236 -1 m 236 673 l 238 673 l 235 673 l 236 673 "},va:{x_min:-149.71875,x_max:148.359375,ha:151,o:"m -8 -1 b -1 0 -5 -1 -4 0 b 16 -11 5 0 13 -4 b 83 -186 17 -12 47 -90 l 148 -358 l 148 -363 b 127 -385 148 -376 138 -385 b 112 -378 122 -385 118 -383 b 54 -226 110 -374 114 -385 b 0 -81 24 -147 0 -81 b -55 -226 -1 -81 -25 -147 b -114 -378 -115 -385 -111 -374 b -129 -385 -119 -383 -123 -385 b -149 -363 -140 -385 -149 -376 l -149 -358 l -84 -186 b -19 -11 -49 -90 -19 -12 b -8 -1 -17 -8 -12 -4 "},vb:{x_min:0,x_max:428.75,ha:438,o:"m 262 186 b 273 186 266 186 272 186 b 274 186 273 186 274 186 b 285 186 274 186 280 186 b 428 48 375 181 428 122 b 386 -68 428 12 416 -29 b 155 -187 329 -145 236 -187 b 12 -111 92 -187 38 -162 b 0 -51 4 -91 0 -72 b 262 186 0 58 122 179 "},vc:{x_min:0,x_max:447.8125,ha:457,o:"m 0 86 l 0 173 l 223 173 l 447 173 l 447 86 l 447 0 l 223 0 l 0 0 l 0 86 "},vf:{x_min:0,x_max:370.21875,ha:378,o:"m 0 0 l 0 277 l 61 277 l 122 277 l 122 0 l 122 -278 l 61 -278 l 0 -278 l 0 0 m 246 -1 l 246 277 l 308 277 l 370 277 l 370 -1 l 370 -278 l 308 -278 l 246 -278 l 246 -1 "},v10:{x_min:0,x_max:559.421875,ha:571,o:"m 5 127 b 14 127 6 127 9 127 b 51 126 25 127 43 127 b 175 98 93 122 138 112 l 186 94 b 279 51 210 86 255 65 b 285 47 280 51 283 48 b 319 27 291 44 311 31 l 326 22 b 359 0 332 19 352 4 l 367 -6 b 371 -9 368 -6 370 -8 l 379 -15 b 387 -22 383 -18 386 -20 l 398 -30 l 411 -40 l 417 -47 l 427 -55 l 434 -61 b 441 -66 436 -62 439 -65 l 446 -72 l 453 -77 l 462 -87 b 558 -188 490 -113 549 -176 b 559 -195 559 -191 559 -194 b 548 -205 559 -201 555 -205 b 541 -204 547 -205 544 -205 b 534 -198 539 -201 536 -199 l 525 -191 b 481 -162 518 -187 490 -167 b 472 -155 477 -159 472 -156 b 468 -152 470 -155 469 -154 b 461 -149 466 -152 464 -151 b 428 -130 454 -145 441 -137 b 371 -99 413 -122 372 -99 b 363 -95 371 -99 367 -98 b 353 -91 357 -94 353 -91 b 348 -90 353 -91 352 -91 b 332 -81 343 -87 341 -86 b 27 -12 230 -37 127 -13 b 0 -5 4 -11 2 -11 b 0 58 0 -2 0 27 b 0 122 0 88 0 120 b 5 127 1 124 4 126 "},v11:{x_min:-155.171875,x_max:153.8125,ha:157,o:"m -137 353 b -130 353 -136 353 -133 353 b -112 349 -125 353 -119 352 b -100 342 -110 347 -104 344 b 0 317 -69 326 -35 317 b 111 349 38 317 76 328 b 129 353 117 352 123 353 b 153 327 142 353 153 344 b 144 302 153 320 153 317 b 27 6 93 226 50 113 b 21 -13 24 -11 24 -11 b 0 -26 17 -22 8 -26 b -24 -12 -9 -26 -19 -22 b -28 5 -24 -9 -27 -2 b -145 302 -53 117 -95 224 b -155 327 -155 317 -155 320 b -137 353 -155 340 -148 349 "},v18:{x_min:0,x_max:323.9375,ha:331,o:"m 217 535 b 225 537 220 537 221 537 b 245 524 235 537 242 533 l 246 521 l 247 390 l 247 258 l 273 265 b 306 270 288 269 299 270 b 322 259 315 270 319 267 b 323 208 323 256 323 233 b 322 158 323 184 323 159 b 288 140 318 148 315 147 b 247 130 254 131 247 130 b 247 65 247 130 247 104 b 247 20 247 51 247 36 l 247 -88 l 273 -81 b 306 -76 289 -77 299 -76 b 318 -81 311 -76 315 -77 b 323 -123 323 -87 323 -86 l 323 -138 l 323 -154 b 318 -195 323 -191 323 -190 b 269 -210 314 -199 315 -199 b 249 -216 259 -213 250 -216 l 247 -216 l 247 -349 l 246 -483 l 245 -487 b 225 -499 242 -495 234 -499 b 206 -487 219 -499 210 -495 l 205 -483 l 205 -355 l 205 -227 l 204 -227 l 181 -233 l 138 -244 b 117 -249 127 -247 117 -249 b 115 -385 115 -249 115 -256 l 115 -523 l 114 -526 b 95 -538 110 -534 102 -538 b 74 -526 87 -538 78 -534 l 73 -523 l 73 -391 b 72 -260 73 -269 73 -260 b 72 -260 72 -260 72 -260 b 19 -273 61 -263 23 -273 b 0 -260 10 -273 4 -267 b 0 -209 0 -256 0 -256 l 0 -162 l 1 -158 b 61 -134 5 -148 5 -148 l 73 -131 l 73 -22 b 72 86 73 79 73 86 b 72 86 72 86 72 86 b 19 74 61 83 23 74 b 0 86 10 74 4 79 b 0 137 0 90 0 90 l 0 184 l 1 188 b 61 212 5 198 5 198 l 73 215 l 73 348 l 73 481 l 74 485 b 95 498 78 492 87 498 b 103 495 98 498 100 496 b 114 485 107 494 111 489 l 115 481 l 115 353 l 115 226 l 121 226 b 159 235 123 227 141 231 l 198 247 l 205 248 l 205 384 l 205 521 l 206 524 b 217 535 209 528 212 533 m 205 9 b 205 119 205 70 205 119 l 205 119 b 182 113 204 119 194 116 l 138 102 b 117 97 127 99 117 97 b 115 -12 115 97 115 91 l 115 -122 l 121 -120 b 159 -111 123 -119 141 -115 l 198 -101 l 205 -98 l 205 9 "},v1b:{x_min:0,x_max:559.421875,ha:571,o:"m 544 204 b 548 204 545 204 547 204 b 559 194 555 204 559 199 b 559 190 559 192 559 191 b 530 156 559 188 556 184 b 462 86 510 134 481 104 b 453 76 458 81 454 77 l 446 70 l 441 65 b 434 59 439 63 436 61 l 427 54 b 409 37 426 51 416 44 b 392 23 398 29 394 26 b 387 19 389 22 387 20 b 379 13 386 19 383 16 l 371 8 l 367 5 l 359 -1 l 337 -16 b 285 -48 319 -29 298 -41 l 279 -52 b 186 -95 255 -66 210 -87 l 175 -99 b 23 -129 127 -117 68 -129 b 17 -129 20 -129 19 -129 b 1 -123 2 -129 2 -129 b 0 -49 0 -122 0 -83 b 0 4 0 -22 0 1 b 27 11 2 9 4 9 b 185 31 78 12 145 20 b 198 34 186 31 193 33 b 314 73 234 44 277 58 b 349 88 328 79 340 84 b 353 90 352 90 353 90 b 363 94 353 90 357 93 b 371 98 367 97 371 98 b 428 129 372 98 413 120 b 461 148 441 136 454 144 b 468 151 464 149 466 151 b 472 154 469 152 470 154 b 481 161 473 155 477 158 b 525 190 490 166 518 186 l 534 197 b 540 201 536 198 539 199 b 544 204 541 202 544 204 "},v1d:{x_min:0,x_max:619.3125,ha:632,o:"m 274 184 b 307 186 285 186 296 186 b 616 22 465 186 597 116 b 619 -1 617 13 619 5 b 308 -187 619 -104 483 -187 b 0 -1 133 -187 0 -102 b 5 36 0 11 1 23 b 274 184 29 115 141 176 m 289 161 b 272 162 284 162 277 162 b 171 41 209 162 171 108 b 205 -73 171 5 182 -34 b 345 -163 243 -133 298 -163 b 436 -98 385 -163 420 -142 b 446 -43 443 -80 446 -62 b 289 161 446 47 377 147 "},v1e:{x_min:-402.890625,x_max:401.53125,ha:410,o:"m -219 173 b -213 174 -217 174 -215 174 b -202 173 -209 174 -205 173 b -114 86 -200 172 -179 151 b -28 0 -66 37 -28 0 b 40 84 -28 0 2 37 b 117 174 111 173 110 172 b 122 174 118 174 119 174 b 132 173 125 174 129 173 b 295 11 134 172 171 134 l 307 -1 l 336 34 b 374 76 366 72 368 74 b 381 77 375 77 378 77 b 401 56 392 77 401 68 b 400 48 401 54 401 51 b 223 -172 397 41 230 -166 b 210 -176 220 -174 215 -176 b 201 -174 206 -176 204 -176 b 112 -87 198 -173 178 -152 b 27 0 65 -38 27 0 b -42 -86 27 0 -4 -38 b -118 -174 -112 -174 -111 -173 b -123 -176 -119 -176 -121 -176 b -133 -174 -126 -176 -130 -174 b -296 -12 -136 -173 -172 -137 l -308 0 l -337 -34 b -375 -77 -367 -73 -370 -76 b -382 -79 -377 -79 -379 -79 b -402 -58 -393 -79 -402 -69 b -401 -49 -402 -55 -402 -52 b -224 172 -398 -43 -228 167 b -219 173 -223 172 -220 173 "},v1f:{x_min:-340.28125,x_max:338.921875,ha:346,o:"m -32 520 b -29 521 -31 520 -31 521 b -23 519 -27 521 -24 520 b -20 513 -21 517 -20 516 b -21 506 -20 512 -20 509 b -31 474 -23 502 -27 488 l -53 402 l -66 352 l -68 349 l -57 349 b -32 351 -51 349 -40 351 b 123 370 19 352 74 359 b 137 371 127 370 133 371 b 170 356 152 371 164 366 b 171 355 170 355 170 355 b 216 366 174 355 183 358 b 280 378 268 377 266 377 b 287 378 283 378 284 378 b 332 349 307 378 322 369 b 338 319 336 341 338 330 b 332 301 338 310 336 302 b 242 280 329 299 246 280 b 242 280 242 280 242 280 b 235 288 236 280 235 283 b 235 292 235 290 235 291 b 236 302 236 297 236 299 b 220 337 236 316 230 330 l 216 340 l 210 335 b 159 276 189 322 172 301 b 118 149 152 265 156 274 b 81 34 84 36 85 36 b -8 13 78 33 -4 13 b -8 13 -8 13 -8 13 b -14 20 -12 15 -14 15 b -8 44 -14 24 -12 31 b -2 66 -5 55 -2 65 b -2 66 -2 66 -2 66 l -2 66 b -43 41 -2 66 -21 55 b -114 4 -98 8 -98 8 b -144 0 -123 0 -134 0 b -242 99 -197 0 -242 43 b -242 109 -242 102 -242 105 b -212 219 -240 122 -242 116 b -185 312 -197 270 -185 312 l -185 312 b -189 312 -185 312 -186 312 b -259 312 -200 312 -227 312 b -321 310 -291 312 -310 310 b -334 312 -330 310 -334 312 b -340 319 -338 313 -340 316 b -336 326 -340 322 -338 324 b -291 337 -334 326 -314 331 l -247 347 l -210 348 b -172 348 -190 348 -172 348 b -168 363 -172 348 -171 355 b -145 442 -151 424 -145 441 b -133 452 -144 444 -140 446 l -77 489 b -32 520 -53 506 -32 520 m 57 334 b 53 335 55 335 54 335 b 44 334 50 335 49 335 b -70 316 8 326 -28 320 b -78 309 -78 316 -78 316 b -108 202 -80 305 -88 274 b -141 81 -136 112 -141 93 b -140 74 -141 79 -141 77 b -117 49 -137 59 -127 49 b -107 52 -114 49 -110 51 b 16 127 -106 54 14 126 b 42 217 16 127 42 215 b 49 241 42 222 44 229 b 73 320 53 251 73 317 b 57 334 73 327 65 333 "},v20:{x_min:-571.671875,x_max:570.3125,ha:582,o:"m -559 351 b -551 352 -556 352 -553 352 b -530 338 -543 352 -533 348 b -529 169 -530 337 -529 291 l -529 1 l -507 27 l -441 112 b -382 174 -394 169 -390 174 b -378 174 -381 174 -379 174 b -281 86 -370 174 -375 179 b -196 0 -234 37 -196 0 b -126 84 -196 0 -164 37 b -50 174 -55 173 -57 172 b -44 174 -49 174 -47 174 b -35 173 -42 174 -38 173 b 53 86 -32 172 -12 151 b 138 0 100 37 138 0 b 208 84 140 0 170 37 b 284 174 279 173 279 172 b 289 174 285 174 288 174 b 300 173 294 174 298 173 b 462 11 303 172 340 134 l 475 -1 l 503 34 b 541 76 534 72 536 74 b 548 77 544 77 545 77 b 570 56 560 77 570 68 b 567 48 570 54 568 51 b 392 -172 564 41 397 -166 b 378 -176 387 -174 382 -176 b 368 -174 375 -176 371 -176 b 280 -87 367 -173 347 -152 b 194 0 234 -38 194 0 b 126 -86 194 0 163 -38 b 49 -174 54 -174 55 -173 b 44 -176 47 -176 46 -176 b 34 -174 40 -176 36 -174 b -54 -87 31 -173 10 -152 b -140 0 -102 -38 -140 0 b -209 -86 -140 0 -171 -38 b -285 -174 -280 -174 -279 -173 b -291 -176 -287 -176 -288 -176 b -300 -174 -294 -176 -298 -174 b -464 -11 -303 -173 -374 -102 l -476 0 l -506 -37 b -539 -76 -528 -65 -537 -74 b -551 -80 -543 -79 -547 -80 b -570 -68 -558 -80 -566 -76 l -571 -65 l -571 136 b -570 340 -571 331 -571 337 b -559 351 -568 344 -564 348 "},v22:{x_min:0,x_max:432.828125,ha:442,o:"m 209 186 b 213 187 210 187 212 187 b 216 187 215 187 216 187 b 224 174 216 186 220 180 b 420 -1 269 105 338 43 b 432 -12 431 -8 432 -9 b 421 -23 432 -15 432 -16 b 228 -180 345 -70 264 -137 b 219 -188 221 -188 221 -188 l 219 -188 b 208 -177 215 -188 215 -188 b 10 1 163 -106 93 -44 b 0 11 0 6 0 8 b 10 22 0 13 0 15 b 202 179 87 69 167 136 b 209 186 206 183 209 186 "},v23:{x_min:0,x_max:133.390625,ha:136,o:"m 54 66 b 65 68 58 68 61 68 b 122 37 88 68 110 56 b 133 -1 130 26 133 12 b 104 -58 133 -23 123 -44 b 66 -69 92 -65 78 -69 b 10 -38 44 -69 23 -58 b 0 -1 2 -27 0 -13 b 54 66 0 30 20 61 "},v25:{x_min:0,x_max:318.5,ha:325,o:"m 20 376 b 167 377 23 377 96 377 b 296 376 231 377 294 377 b 318 347 311 371 318 359 b 296 316 318 333 311 320 b 159 315 294 315 227 315 b 21 316 91 315 24 315 b 0 345 6 320 0 333 b 20 376 0 359 6 371 "},v26:{x_min:-21.78125,x_max:483.1875,ha:493,o:"m -8 631 b -1 632 -6 632 -4 632 b 19 620 8 632 16 628 b 20 383 20 616 20 616 l 20 148 l 21 151 b 140 199 59 183 102 199 b 206 179 164 199 187 192 l 210 176 l 210 396 l 210 617 l 212 621 b 231 632 216 628 223 632 b 250 620 239 632 247 628 b 251 383 251 616 251 616 l 251 148 l 254 151 b 370 199 291 183 332 199 b 415 191 385 199 400 197 b 483 84 458 176 483 134 b 461 0 483 58 476 29 b 332 -142 439 -40 411 -72 l 255 -215 b 231 -229 240 -229 239 -229 b 216 -223 224 -229 220 -227 b 210 -158 210 -217 210 -223 b 210 -120 210 -148 210 -136 l 210 -29 l 205 -34 b 100 -142 182 -65 159 -88 l 23 -215 b -1 -229 9 -229 6 -229 b -20 -216 -9 -229 -17 -224 l -21 -212 l -21 201 l -21 616 l -20 620 b -8 631 -17 624 -13 630 m 110 131 b 96 133 106 133 100 133 b 89 133 93 133 91 133 b 24 87 63 129 40 113 l 20 80 l 20 -37 l 20 -156 l 23 -152 b 144 81 96 -72 144 20 l 144 83 b 110 131 144 113 134 126 m 341 131 b 328 133 337 133 332 133 b 322 133 326 133 323 133 b 257 87 296 129 273 113 l 251 80 l 251 -37 l 251 -156 l 255 -152 b 375 81 328 -72 375 20 l 375 83 b 341 131 375 113 367 126 "},v27:{x_min:0,x_max:432.828125,ha:442,o:"m 208 184 b 213 187 209 186 212 187 b 224 176 217 187 221 183 b 245 147 225 172 235 159 b 419 -1 288 90 347 38 b 431 -8 424 -4 431 -8 b 432 -12 432 -9 432 -11 b 430 -18 432 -13 432 -16 b 364 -61 424 -20 383 -47 b 225 -183 307 -102 250 -152 b 223 -187 224 -184 223 -187 b 220 -188 221 -188 220 -188 b 208 -176 216 -188 210 -184 b 187 -148 205 -173 197 -159 b 12 0 144 -90 84 -38 b 0 11 4 5 0 8 b 16 24 0 13 4 18 b 183 158 83 69 141 115 b 208 184 194 169 198 173 m 183 105 b 176 113 181 109 176 113 b 172 109 176 113 175 112 b 92 45 149 90 117 62 l 88 41 l 102 31 b 247 -105 160 -6 210 -55 l 254 -115 l 257 -112 l 269 -102 b 340 -45 287 -87 319 -61 l 344 -43 l 330 -33 b 183 105 272 6 221 54 "},v28:{x_min:-73.5,x_max:72.140625,ha:74,o:"m -72 252 l -73 254 l 0 254 l 72 254 l 70 252 b 0 -1 70 248 0 -1 b -72 252 -1 -1 -72 248 "},v29:{x_min:-590.71875,x_max:589.359375,ha:601,o:"m 175 273 b 182 274 178 273 181 274 b 202 262 190 274 198 269 b 204 158 204 259 204 259 l 204 56 l 250 112 b 303 174 296 172 298 172 b 308 174 304 174 307 174 b 318 173 313 174 317 173 b 481 11 322 172 357 134 l 494 -1 l 522 34 b 560 76 553 72 555 74 b 567 77 563 77 564 77 b 589 56 579 77 589 68 b 586 48 589 54 588 51 b 411 -172 583 41 416 -166 b 397 -176 406 -174 401 -176 b 387 -174 393 -176 390 -176 b 299 -87 386 -173 366 -152 b 213 0 253 -38 213 0 b 208 -6 213 0 210 -2 l 204 -12 l 204 -147 b 204 -210 204 -173 204 -194 b 198 -292 204 -297 204 -287 b 183 -299 194 -297 189 -299 b 164 -287 175 -299 167 -295 b 163 -174 163 -284 163 -284 l 161 -63 l 119 -117 b 65 -176 76 -170 73 -176 b 61 -176 63 -176 62 -176 b -35 -87 51 -174 57 -180 b -121 0 -83 -38 -121 0 b -190 -86 -122 0 -152 -38 b -266 -174 -261 -174 -259 -173 b -272 -176 -268 -176 -270 -176 b -281 -174 -276 -176 -280 -174 b -371 -86 -284 -173 -304 -152 b -457 0 -417 -38 -457 0 l -457 0 b -477 -26 -457 0 -470 -16 b -548 -227 -524 -88 -548 -161 b -536 -303 -548 -254 -544 -280 b -533 -317 -534 -309 -533 -313 b -553 -338 -533 -330 -541 -338 b -577 -315 -566 -338 -571 -333 b -590 -227 -586 -287 -590 -258 b -518 -9 -590 -154 -564 -77 b -465 56 -509 2 -504 8 l -402 134 b -363 174 -374 170 -371 174 b -359 174 -362 174 -360 174 b -262 86 -351 174 -356 179 b -176 0 -216 37 -176 0 b -107 84 -176 0 -145 37 b -31 174 -36 173 -38 172 b -25 174 -29 174 -28 174 b -16 173 -23 174 -19 173 b 147 11 -13 172 35 123 l 157 -1 l 160 1 l 163 4 l 163 130 b 164 260 163 256 163 258 b 175 273 166 266 170 270 "},v2a:{x_min:-21.78125,x_max:366.140625,ha:374,o:"m 276 1378 b 284 1379 279 1379 281 1379 b 306 1360 292 1379 298 1374 b 352 1247 326 1326 343 1286 b 366 1139 362 1213 366 1175 b 347 1009 366 1093 359 1049 l 344 1002 l 347 992 b 352 971 348 986 351 977 b 366 863 362 936 366 899 b 347 732 366 818 359 773 l 344 725 l 347 716 b 352 695 348 710 351 700 b 366 588 362 659 366 623 b 223 262 366 464 314 345 b 189 233 212 252 212 252 b 35 76 126 183 73 129 b -1 16 20 56 2 27 b -19 4 -4 9 -12 4 l -21 4 l -21 137 l -21 270 l -17 270 b 186 344 59 281 134 308 b 319 606 270 399 319 499 b 317 650 319 620 319 635 l 315 659 l 314 655 b 223 537 288 607 258 570 b 189 509 212 528 212 528 b 35 352 126 459 73 405 b -1 292 20 333 2 303 b -19 280 -4 285 -12 280 l -21 280 l -21 413 l -21 546 l -17 546 b 186 620 59 557 134 584 b 319 882 270 675 319 775 b 317 925 319 896 319 911 l 315 935 l 314 931 b 223 813 288 884 258 846 b 189 785 212 805 212 805 b 35 628 126 735 73 681 b -1 569 20 609 2 580 b -19 556 -4 562 -12 556 l -21 556 l -21 689 l -21 823 l -17 823 b 202 907 68 835 152 867 b 319 1157 280 968 319 1061 b 270 1338 319 1218 303 1281 b 262 1358 264 1349 262 1353 b 262 1364 262 1360 262 1363 b 276 1378 265 1371 269 1376 "},v2c:{x_min:-597.53125,x_max:596.171875,ha:608,o:"m -413 173 b -408 174 -412 174 -409 174 b -397 173 -404 174 -400 173 b -308 86 -394 172 -374 151 b -223 0 -261 37 -223 0 b -153 84 -223 0 -191 37 b -77 174 -83 173 -84 172 b -72 174 -76 174 -74 174 b -62 173 -68 174 -63 173 b 25 86 -59 172 -39 151 b 112 0 73 37 111 0 b 181 84 112 0 144 37 b 257 174 251 173 251 172 b 262 174 258 174 261 174 b 273 173 266 174 270 173 b 436 9 276 172 347 101 l 447 -1 l 477 36 b 522 79 511 79 513 79 l 522 79 b 552 51 533 79 539 73 b 596 -112 582 6 596 -51 b 567 -262 596 -161 586 -213 b 539 -322 558 -287 544 -316 b 524 -327 534 -326 529 -327 b 504 -315 515 -327 507 -323 b 503 -308 503 -312 503 -309 b 511 -285 503 -302 504 -297 b 555 -113 540 -227 555 -169 b 544 -34 555 -86 551 -59 b 522 19 540 -16 530 8 l 521 22 l 481 -26 l 405 -122 b 353 -176 366 -172 362 -176 b 349 -176 352 -176 351 -176 b 253 -87 341 -176 347 -180 b 167 0 206 -38 167 0 b 99 -86 167 0 136 -38 b 21 -174 27 -174 28 -173 b 17 -176 20 -176 19 -176 b 6 -174 13 -176 9 -174 b -81 -87 4 -173 -14 -152 b -167 0 -129 -38 -167 0 b -236 -86 -167 0 -198 -38 b -313 -174 -307 -174 -306 -173 b -318 -176 -314 -176 -315 -176 b -328 -174 -321 -176 -325 -174 b -491 -12 -330 -173 -367 -137 l -503 0 l -530 -34 b -570 -77 -562 -73 -564 -76 b -577 -79 -571 -79 -574 -79 b -597 -58 -588 -79 -597 -69 b -596 -49 -597 -55 -597 -52 b -417 172 -593 -43 -423 167 b -413 173 -417 172 -415 173 "},v2d:{x_min:0,x_max:438.28125,ha:447,o:"m 212 190 b 219 191 213 191 216 191 b 236 176 225 191 228 190 b 419 18 277 105 341 49 b 436 5 431 13 434 11 b 438 -1 438 4 438 1 b 424 -16 438 -8 432 -13 b 356 -49 409 -20 379 -36 b 234 -180 306 -83 258 -133 b 219 -192 230 -188 224 -192 b 200 -176 213 -192 206 -187 b 9 -15 157 -102 89 -45 b 0 0 2 -12 0 -6 b 16 18 0 9 2 12 b 200 176 93 48 159 104 b 212 190 205 186 208 188 m 239 113 b 236 117 238 116 238 117 b 230 108 235 117 234 115 b 92 -15 196 58 140 8 b 88 -18 91 -16 88 -18 b 92 -20 88 -18 91 -19 b 198 -116 130 -43 166 -74 b 200 -117 200 -117 200 -117 b 201 -117 200 -117 201 -117 b 264 -43 212 -98 242 -62 b 345 15 288 -19 321 4 b 348 18 347 16 348 16 b 344 20 348 18 347 19 b 239 113 307 41 266 79 "},v2f:{x_min:-1.359375,x_max:680.5625,ha:694,o:"m 597 1042 b 604 1042 600 1042 602 1042 b 642 1002 627 1042 642 1022 b 619 966 642 988 635 974 b 439 927 574 942 503 927 l 426 927 l 426 921 b 430 838 428 893 430 866 b 345 480 430 696 398 560 b 179 391 307 423 249 391 b 156 392 171 391 164 392 b 138 394 149 394 142 394 b 103 434 115 396 103 416 b 129 471 103 451 111 466 b 141 474 133 473 137 474 b 172 459 153 474 164 469 b 181 455 175 456 176 455 b 187 456 182 455 185 455 b 253 520 212 460 234 483 b 315 836 294 605 315 714 b 311 928 315 867 314 898 b 302 945 310 943 311 942 b 245 953 283 950 262 953 b 130 891 193 953 149 931 b 84 860 119 870 102 860 b 36 905 61 860 39 877 b 36 910 36 907 36 909 b 80 970 36 931 50 949 b 249 1017 125 1000 187 1017 b 322 1009 273 1017 299 1014 l 341 1003 b 436 991 372 995 406 991 b 577 1031 495 991 545 1004 b 597 1042 583 1038 590 1041 m 416 360 b 424 360 419 360 421 360 b 481 309 454 360 479 338 b 503 145 484 280 495 199 b 585 -185 525 16 555 -106 b 630 -245 596 -213 613 -237 l 634 -247 l 638 -245 b 647 -244 641 -245 645 -244 b 680 -278 666 -244 680 -262 b 664 -308 680 -290 675 -301 b 638 -312 658 -310 650 -312 b 613 -309 631 -312 623 -310 b 477 -201 555 -303 502 -260 b 417 -2 460 -159 434 -72 b 416 5 417 1 416 5 b 416 5 416 5 416 5 b 411 -5 415 5 413 0 b 359 -97 397 -33 377 -70 b 353 -106 355 -102 353 -105 b 359 -112 353 -108 355 -109 b 409 -130 375 -123 390 -129 b 426 -134 420 -130 421 -131 b 431 -147 428 -137 431 -141 b 420 -162 431 -152 427 -159 b 382 -169 409 -166 396 -169 b 323 -155 363 -169 341 -165 l 317 -152 l 314 -155 b 62 -303 240 -240 148 -295 b 36 -305 55 -305 44 -305 b 23 -303 29 -305 24 -305 b -1 -273 6 -299 -1 -287 b 31 -240 -1 -256 10 -240 b 36 -240 32 -240 34 -240 b 42 -241 38 -241 39 -241 b 134 -204 63 -241 99 -226 b 367 288 265 -115 357 81 b 375 330 368 313 370 320 b 416 360 383 347 400 358 m 360 -359 b 379 -359 363 -359 371 -359 b 424 -360 396 -359 416 -359 b 646 -502 536 -373 624 -430 b 649 -527 649 -510 649 -519 b 530 -673 649 -578 604 -635 l 521 -677 l 529 -681 b 653 -811 592 -714 637 -762 b 660 -853 658 -827 660 -839 b 645 -911 660 -873 656 -892 b 426 -1021 608 -981 519 -1021 b 283 -989 377 -1021 328 -1011 b 235 -949 249 -972 239 -964 b 234 -936 234 -946 234 -941 b 234 -928 234 -934 234 -931 l 235 -925 l 234 -927 l 225 -934 b 87 -982 186 -966 138 -982 b 80 -982 85 -982 83 -982 b 55 -981 70 -981 58 -981 b 17 -943 32 -981 17 -964 b 54 -904 17 -921 35 -904 b 78 -914 62 -904 72 -909 l 83 -918 l 88 -918 b 190 -831 122 -918 166 -881 b 269 -506 242 -727 269 -612 b 268 -462 269 -492 269 -477 b 266 -449 266 -458 266 -452 b 265 -444 266 -445 266 -444 b 257 -446 264 -444 261 -445 b 132 -545 196 -470 152 -505 b 88 -573 122 -563 104 -573 b 39 -523 63 -573 39 -553 b 63 -476 39 -505 44 -494 b 360 -359 136 -408 235 -369 m 419 -424 b 393 -423 411 -423 406 -423 l 375 -423 l 377 -426 b 379 -439 377 -427 378 -434 b 383 -510 382 -463 383 -487 b 314 -811 383 -609 360 -710 b 266 -893 296 -850 285 -870 b 264 -898 265 -896 264 -898 l 264 -898 b 264 -898 264 -898 264 -898 b 268 -898 264 -898 266 -898 b 273 -898 270 -898 272 -898 b 300 -909 283 -898 291 -900 b 426 -957 340 -941 385 -957 b 476 -949 443 -957 460 -954 b 547 -853 522 -931 547 -893 b 485 -745 547 -816 526 -775 b 397 -707 460 -727 432 -714 b 366 -675 375 -703 366 -692 b 396 -642 366 -657 377 -645 b 530 -557 455 -637 511 -601 b 536 -527 534 -548 536 -537 b 419 -424 536 -480 490 -437 "},v30:{x_min:-21.78125,x_max:367.5,ha:375,o:"m 276 1900 b 284 1901 279 1900 281 1901 b 306 1883 291 1901 298 1896 b 367 1686 347 1825 367 1757 b 343 1558 367 1643 359 1600 l 338 1549 l 343 1537 b 367 1411 359 1497 367 1454 b 343 1282 367 1367 359 1324 l 338 1272 l 343 1261 b 367 1135 359 1221 367 1178 b 343 1007 367 1090 359 1047 l 338 996 l 343 985 b 367 859 359 945 367 902 b 343 731 367 814 359 771 l 338 720 l 343 709 b 367 582 359 667 367 626 b 289 362 367 503 340 426 b 239 312 276 345 259 330 b 29 77 152 237 76 152 b -1 18 14 54 2 30 b -19 4 -4 11 -12 4 l -21 4 l -21 133 l -20 260 l -13 262 b 98 299 17 269 62 284 b 111 305 103 302 110 305 b 167 334 123 310 156 327 b 319 595 264 391 319 491 b 313 659 319 616 318 638 b 310 667 311 664 311 667 b 307 663 310 667 308 666 b 240 588 289 637 269 614 b 16 331 141 505 62 413 b -1 294 8 316 1 302 b -19 280 -4 287 -12 280 l -21 280 l -21 408 l -20 537 l -13 538 b 98 576 17 545 62 560 b 111 581 103 578 110 581 b 167 610 123 587 156 603 b 319 871 264 667 319 767 b 313 935 319 892 318 913 b 310 942 311 941 311 942 b 307 939 310 942 308 941 b 240 864 289 913 269 889 b 16 607 141 781 62 689 b -1 570 8 592 1 578 b -19 556 -4 563 -12 556 l -21 556 l -21 684 l -20 813 l -13 814 b 98 852 17 821 62 836 b 111 857 103 855 110 857 b 167 886 123 863 156 880 b 319 1147 264 943 319 1043 b 313 1211 319 1168 318 1189 b 310 1218 311 1217 311 1218 b 307 1215 310 1218 308 1217 b 240 1140 289 1188 269 1165 b 16 884 141 1057 62 966 b -1 846 8 868 1 855 b -19 832 -4 839 -12 832 l -21 832 l -21 960 l -20 1089 l -13 1090 b 98 1128 17 1097 62 1111 b 111 1134 103 1131 110 1134 b 167 1163 123 1139 156 1156 b 319 1424 264 1220 319 1320 b 313 1486 319 1444 318 1465 b 310 1494 311 1493 311 1494 b 307 1492 310 1494 308 1493 b 240 1417 289 1464 269 1442 b 16 1160 141 1333 62 1242 b -1 1121 8 1145 1 1131 b -19 1109 -4 1115 -12 1109 l -21 1109 l -21 1236 l -20 1365 l -13 1367 b 98 1404 17 1374 62 1388 b 111 1410 103 1407 110 1410 b 250 1508 172 1437 215 1467 b 319 1701 296 1564 319 1633 b 270 1859 319 1757 303 1814 b 262 1882 265 1868 262 1875 b 276 1900 262 1890 266 1896 "},v31:{x_min:0,x_max:386.5625,ha:394,o:"m 0 173 l 0 347 l 193 347 l 386 347 l 386 173 l 386 0 l 193 0 l 0 0 l 0 173 "},v33:{x_min:-423.3125,x_max:421.9375,ha:431,o:"m -10 276 b -2 277 -8 277 -5 277 b 17 265 5 277 13 273 b 19 163 19 260 19 260 l 19 68 l 39 45 b 277 -95 122 -34 200 -81 b 289 -97 281 -97 285 -97 b 378 0 332 -97 371 -54 b 378 11 378 4 378 6 b 302 83 378 55 345 83 b 242 66 283 83 262 77 b 208 56 231 59 219 56 b 148 120 175 56 148 81 b 200 186 148 151 164 172 b 261 198 220 194 240 198 b 420 45 341 198 411 137 b 421 22 421 37 421 29 b 257 -198 421 -86 347 -188 b 242 -198 251 -198 247 -198 b 20 -105 181 -198 95 -163 l 19 -104 l 19 -183 b 19 -216 19 -195 19 -206 b 12 -273 19 -272 17 -267 b -2 -278 8 -277 2 -278 b -21 -266 -10 -278 -19 -274 b -23 -165 -23 -263 -23 -262 l -23 -69 l -44 -47 b -250 86 -117 23 -183 66 b -295 94 -270 93 -284 94 b -315 91 -302 94 -308 94 b -381 5 -356 81 -381 43 b -355 -56 -381 -16 -372 -40 b -299 -81 -338 -73 -319 -81 b -246 -68 -283 -81 -265 -77 b -212 -58 -234 -61 -223 -58 b -168 -77 -196 -58 -179 -65 b -151 -122 -156 -90 -151 -105 b -179 -174 -151 -141 -160 -162 b -239 -195 -194 -184 -217 -192 b -257 -197 -245 -195 -250 -197 b -423 -5 -349 -197 -423 -113 b -423 0 -423 -4 -423 -1 b -277 194 -420 97 -362 173 b -247 197 -268 197 -258 197 b -24 104 -185 197 -100 162 l -23 102 l -23 181 b -21 265 -23 260 -23 260 b -10 276 -20 269 -14 274 "},v34:{x_min:0,x_max:622.03125,ha:635,o:"m 398 417 b 406 419 401 419 404 419 b 427 398 417 419 427 409 b 427 391 427 395 427 392 b 34 -274 424 385 38 -272 b 20 -280 29 -278 25 -280 b 0 -259 9 -280 0 -270 b 0 -252 0 -256 0 -254 b 393 413 2 -247 389 410 b 398 417 394 415 397 416 m 592 417 b 600 419 594 419 597 419 b 622 398 611 419 622 409 b 620 391 622 395 620 392 b 227 -274 617 385 231 -272 b 213 -280 223 -278 219 -280 b 193 -259 202 -280 193 -270 b 194 -252 193 -256 193 -254 b 586 413 196 -247 582 410 b 592 417 588 415 590 416 "},v36:{x_min:-1.359375,x_max:1064.390625,ha:1086,o:"m 296 692 b 314 694 302 694 307 694 b 386 685 337 694 366 689 b 548 498 480 660 548 580 b 548 481 548 492 548 487 b 455 395 541 426 499 395 b 370 462 420 395 383 417 b 362 496 364 477 362 488 b 377 514 362 509 367 514 b 393 501 386 514 390 510 b 432 474 397 484 413 474 b 470 487 445 474 458 478 b 491 530 484 496 491 510 b 490 544 491 534 491 539 b 333 660 479 606 411 657 l 323 662 l 315 646 b 269 524 285 591 269 556 b 321 431 269 492 287 466 b 349 395 338 413 343 408 b 363 342 359 378 363 362 b 359 312 363 333 362 322 b 285 158 348 266 318 206 b 281 152 283 155 281 152 b 281 152 281 152 281 152 b 287 154 283 152 284 152 b 318 155 298 154 308 155 b 461 98 371 155 419 136 l 464 97 l 483 112 b 503 129 494 120 503 127 b 504 130 503 129 504 129 b 503 138 504 131 503 134 b 500 180 500 152 500 166 b 553 326 500 238 518 288 b 604 366 560 331 592 358 b 649 381 617 376 632 381 b 696 362 665 381 681 374 b 724 302 714 347 724 324 b 695 238 724 278 714 255 b 660 210 691 234 662 212 b 579 148 658 209 582 151 b 579 148 579 148 579 148 b 596 106 579 144 589 119 b 622 77 604 88 609 83 b 657 69 632 72 645 69 b 748 112 688 69 721 84 b 755 123 754 117 755 120 b 755 127 755 124 755 126 b 751 165 752 137 751 151 b 758 219 751 183 754 202 b 894 387 774 290 820 347 b 896 390 896 388 896 388 b 891 398 896 391 895 392 b 622 560 827 477 730 535 b 600 580 605 564 600 569 b 617 596 600 591 607 596 b 628 595 622 596 624 596 b 1057 248 846 552 1020 412 b 1064 191 1061 229 1064 209 b 922 0 1064 94 1005 9 b 902 -1 916 -1 909 -1 b 774 76 847 -1 800 26 b 769 83 770 81 770 83 b 769 81 769 83 769 83 b 627 -1 733 29 677 -1 b 548 27 597 -1 570 8 b 515 88 537 37 525 61 l 513 95 l 510 93 l 453 45 b 390 0 396 0 396 0 b 390 0 390 0 390 0 b 374 15 381 0 377 4 b 268 105 359 69 314 105 b 250 104 262 105 257 105 l 243 102 l 234 90 b 155 1 201 49 159 2 b 147 -1 152 0 149 -1 b 130 15 138 -1 130 6 b 132 20 130 18 132 19 b 136 31 133 22 134 27 b 220 131 149 74 178 109 b 231 137 225 134 230 136 b 302 278 280 202 302 244 b 265 335 302 299 295 309 b 209 442 234 363 213 402 b 209 455 209 446 209 451 b 279 648 209 502 232 564 l 285 659 l 283 659 b 176 627 238 653 210 645 b 57 477 111 594 66 538 b 55 459 55 471 55 464 b 72 409 55 437 61 415 b 93 403 78 405 87 403 b 152 467 123 403 151 431 b 168 488 153 483 157 488 b 185 462 181 488 185 483 l 185 460 b 137 344 183 409 168 369 b 78 322 119 328 98 322 b 13 360 50 322 25 335 b -1 426 4 380 -1 402 b 89 610 -1 488 32 559 b 296 692 147 659 210 685 m 926 348 b 921 353 924 351 922 353 b 914 348 920 353 918 351 b 823 167 857 306 823 237 b 828 124 823 154 826 138 b 890 31 837 79 862 40 b 896 31 892 31 894 31 b 956 104 916 31 940 59 b 970 191 965 129 970 159 b 966 241 970 208 969 224 b 926 348 959 277 945 313 m 627 326 b 619 326 624 326 622 326 b 598 316 611 326 604 323 b 568 215 579 288 568 255 b 568 208 568 213 568 210 b 571 183 570 195 570 184 l 571 183 b 594 201 571 183 582 191 l 634 231 b 660 259 653 247 656 248 b 664 278 662 266 664 272 b 627 326 664 299 649 320 "},v38:{x_min:-1.359375,x_max:651.96875,ha:665,o:"m 389 644 b 405 645 394 645 400 645 b 504 566 450 645 492 613 b 507 541 506 557 507 549 b 480 471 507 514 498 489 l 477 467 l 483 470 b 609 591 539 485 586 531 b 613 601 611 595 613 599 b 631 609 619 607 624 609 b 651 588 641 609 651 602 b 200 -946 651 584 204 -941 b 182 -957 197 -953 190 -957 b 163 -945 174 -957 166 -953 b 161 -939 161 -942 161 -942 b 217 -743 161 -931 170 -904 b 272 -555 247 -639 272 -555 b 272 -555 272 -555 272 -555 b 264 -560 272 -555 268 -557 b 140 -603 227 -589 182 -603 b 36 -567 102 -603 65 -592 b -1 -487 12 -548 -1 -517 b 17 -427 -1 -466 5 -445 b 103 -380 38 -395 70 -380 b 191 -433 137 -380 172 -398 b 205 -484 201 -448 205 -466 b 178 -553 205 -509 196 -535 l 175 -557 l 182 -555 b 307 -435 236 -539 284 -494 b 372 -213 308 -430 372 -215 b 372 -213 372 -213 372 -213 b 364 -219 372 -213 368 -216 b 240 -262 328 -247 283 -262 b 137 -226 202 -262 166 -249 b 99 -145 112 -206 99 -176 b 118 -84 99 -124 106 -104 b 204 -38 138 -54 171 -38 b 292 -91 238 -38 273 -56 b 306 -141 302 -106 306 -124 b 279 -212 306 -167 296 -194 l 276 -215 l 281 -213 b 408 -93 336 -198 385 -151 b 473 129 409 -88 473 127 b 473 129 473 129 473 129 b 465 122 473 129 469 126 b 341 80 428 94 383 80 b 236 115 303 80 266 91 b 200 195 213 136 200 165 b 217 256 200 217 206 238 b 304 303 239 287 272 303 b 393 249 338 303 374 285 b 406 199 402 234 406 217 b 379 129 406 173 397 148 l 377 126 l 382 127 b 509 248 436 142 485 190 b 574 470 510 254 574 469 b 574 470 574 470 574 470 b 566 464 574 470 570 467 b 442 421 529 435 484 421 b 337 458 404 421 367 433 b 300 537 313 478 300 508 b 389 644 300 585 334 635 "},v39:{x_min:-171.5,x_max:251.8125,ha:257,o:"m -8 631 b -1 632 -6 632 -4 632 b 19 620 8 632 16 628 b 20 553 20 616 20 614 b 20 491 20 503 20 491 l 20 491 b 153 535 47 501 149 535 b 174 514 167 535 174 524 b 164 496 174 508 171 501 b 92 470 164 495 132 484 l 20 445 l 20 390 b 20 363 20 378 20 370 b 20 333 20 340 20 333 l 20 333 b 153 377 47 344 149 377 b 174 356 167 377 174 367 b 164 338 174 349 171 342 b 92 312 164 338 132 326 l 20 288 l 20 219 l 20 148 l 21 151 b 137 199 59 183 99 199 b 182 191 152 199 167 197 b 251 84 227 176 251 134 b 228 0 251 58 243 29 b 100 -142 206 -40 178 -72 l 23 -215 b -1 -229 9 -229 6 -229 b -20 -216 -9 -229 -17 -224 b -21 30 -21 -212 -21 -212 b -21 273 -21 163 -21 273 b -84 252 -21 273 -50 263 b -152 230 -133 234 -145 230 b -157 231 -155 230 -156 231 b -171 252 -166 234 -171 244 b -160 270 -171 259 -167 266 b -27 316 -159 270 -93 294 l -21 319 l -21 374 b -21 431 -21 406 -21 431 b -84 409 -21 431 -50 421 b -152 388 -133 392 -145 388 b -157 390 -155 388 -156 388 b -171 409 -166 392 -171 401 b -160 428 -171 417 -167 424 b -27 474 -159 428 -93 451 l -21 476 l -21 546 b -20 620 -21 614 -21 616 b -8 631 -17 624 -13 630 m 110 131 b 96 133 106 133 100 133 b 89 133 93 133 91 133 b 24 87 63 129 40 113 l 20 80 l 20 -37 l 20 -156 l 23 -152 b 144 81 96 -72 144 20 l 144 83 b 110 131 144 113 134 126 "},v3b:{x_min:0,x_max:484.5625,ha:494,o:"m 228 245 b 239 247 234 247 239 247 b 243 247 240 247 242 247 b 303 238 257 247 287 242 b 484 -2 417 208 484 104 b 412 -177 484 -65 461 -127 b 243 -248 363 -226 303 -248 b 6 -63 138 -248 36 -180 b 0 -1 1 -41 0 -20 b 228 245 0 127 98 240 m 255 181 b 240 183 247 183 245 183 b 232 181 238 183 235 183 b 142 152 200 180 168 170 l 138 149 l 190 97 l 242 44 l 294 97 l 345 149 l 340 152 b 255 181 315 169 284 180 m 147 -54 l 197 -1 l 147 51 l 95 104 l 91 99 b 62 -1 72 70 62 34 b 66 -43 62 -15 63 -29 b 91 -101 72 -63 80 -84 l 95 -106 l 147 -54 m 393 99 b 389 104 390 102 389 104 b 337 51 389 104 366 80 l 285 -1 l 337 -54 l 389 -106 l 393 -101 b 421 -1 412 -72 421 -36 b 393 99 421 34 412 69 m 294 -98 b 242 -45 265 -69 242 -45 b 190 -98 242 -45 219 -69 l 138 -151 l 142 -154 b 242 -184 172 -174 206 -184 b 340 -154 276 -184 311 -174 l 345 -151 l 294 -98 "},v3c:{x_min:0,x_max:450.53125,ha:460,o:"m 189 302 b 204 303 193 302 198 303 b 303 224 250 303 292 270 b 306 199 304 216 306 208 b 279 129 306 173 296 147 l 276 126 l 281 127 b 408 249 337 142 385 190 b 412 259 409 254 412 258 b 430 267 417 265 423 267 b 450 247 441 267 450 259 b 200 -605 450 242 204 -599 b 182 -616 197 -612 190 -616 b 163 -602 174 -616 166 -610 b 161 -598 161 -601 161 -601 b 217 -402 161 -589 170 -562 b 272 -213 247 -298 272 -213 b 272 -213 272 -213 272 -213 b 264 -219 272 -213 268 -216 b 140 -262 227 -247 182 -262 b 36 -226 102 -262 65 -249 b 0 -145 12 -206 0 -176 b 17 -84 0 -124 5 -104 b 103 -38 38 -54 70 -38 b 191 -91 137 -38 172 -56 b 205 -141 201 -106 205 -124 b 178 -212 205 -167 196 -194 l 175 -215 l 182 -213 b 307 -93 236 -198 284 -151 b 372 129 308 -88 372 127 b 372 129 372 129 372 129 b 364 122 372 129 368 126 b 240 80 328 94 283 80 b 137 115 202 80 166 91 b 99 194 111 136 99 165 b 189 302 99 244 133 292 "},v3e:{x_min:0,x_max:406.96875,ha:415,o:"m 21 183 b 28 183 24 183 25 183 b 42 181 34 183 39 183 b 127 108 47 179 47 179 b 202 41 168 72 202 41 b 279 108 204 41 238 72 b 357 177 321 145 356 176 b 375 183 363 181 370 183 b 406 151 392 183 406 169 b 404 137 406 147 405 141 b 322 62 401 131 398 129 b 251 0 284 27 251 0 b 322 -63 251 -1 284 -29 b 404 -138 398 -130 401 -133 b 406 -152 405 -142 406 -148 b 375 -184 406 -170 392 -184 b 357 -179 370 -184 363 -183 b 279 -109 356 -177 321 -147 b 202 -43 238 -73 204 -43 b 127 -109 202 -43 168 -73 b 49 -179 85 -147 50 -177 b 31 -184 43 -183 36 -184 b 0 -152 13 -184 0 -170 b 2 -138 0 -148 0 -142 b 83 -63 5 -133 8 -130 b 155 0 122 -29 155 -1 b 83 62 155 0 122 27 b 8 129 43 97 10 127 b 0 151 2 136 0 144 b 21 183 0 165 8 177 "},v3f:{x_min:-24.5,x_max:317.140625,ha:324,o:"m -24 -147 l -24 -5 l -20 -5 b -1 -19 -12 -5 -4 -11 b 58 -123 6 -43 31 -86 b 196 -278 93 -173 134 -219 b 317 -570 274 -356 317 -460 b 294 -713 317 -617 308 -666 l 289 -724 l 294 -735 b 317 -873 308 -780 317 -827 b 235 -1132 317 -963 288 -1054 b 209 -1165 228 -1140 224 -1146 b 189 -1177 204 -1172 196 -1177 b 171 -1164 182 -1177 175 -1172 b 168 -1154 170 -1161 168 -1159 b 181 -1132 168 -1149 172 -1142 b 269 -891 238 -1064 269 -975 b 269 -881 269 -886 269 -884 b 262 -814 269 -857 265 -827 b 258 -800 261 -811 259 -806 b 142 -628 240 -731 198 -667 b -8 -589 112 -606 47 -589 b -20 -589 -13 -589 -19 -589 l -24 -589 l -24 -449 l -24 -308 l -20 -308 b -1 -322 -12 -308 -4 -313 b 58 -424 6 -345 31 -388 b 194 -580 93 -476 136 -523 b 259 -660 221 -606 245 -635 b 261 -663 259 -662 261 -663 b 264 -656 262 -663 262 -660 b 269 -587 268 -632 269 -610 b 264 -521 269 -566 268 -544 b 262 -512 264 -517 262 -513 b 258 -498 261 -509 259 -503 b 142 -326 240 -428 198 -365 b -8 -287 112 -303 47 -288 b -20 -287 -13 -287 -19 -287 l -24 -287 l -24 -147 "},v40:{x_min:-1.359375,x_max:436.921875,ha:446,o:"m 213 205 b 217 205 215 205 216 205 b 234 194 224 205 234 199 b 236 187 234 194 235 190 l 245 167 l 261 129 l 270 106 b 355 -61 294 54 329 -13 b 420 -163 381 -105 402 -138 b 436 -188 435 -184 436 -184 b 436 -191 436 -190 436 -190 b 421 -206 436 -201 431 -206 l 421 -206 l 416 -206 l 405 -201 b 217 -158 347 -172 283 -158 b 31 -201 153 -158 88 -172 l 20 -206 l 14 -206 l 14 -206 b 0 -191 5 -206 0 -201 b -1 -188 0 -190 -1 -190 b 14 -163 -1 -186 0 -184 b 95 -34 36 -136 72 -77 b 166 106 119 8 148 68 l 175 129 l 183 148 l 200 188 b 213 205 205 199 208 202 "},v41:{x_min:-1.359375,x_max:556.6875,ha:568,o:"m 294 322 b 318 323 299 322 308 323 b 360 320 334 323 352 322 b 526 217 430 310 490 273 b 543 166 537 202 543 184 b 447 70 543 117 503 70 b 445 70 447 70 446 70 b 359 159 394 72 359 113 b 368 201 359 173 362 187 b 442 245 382 229 412 245 b 455 244 446 245 451 245 b 460 244 458 244 460 244 b 460 244 460 244 460 244 b 454 248 460 244 458 245 b 325 291 417 276 372 291 b 285 287 313 291 299 290 b 144 -2 183 269 144 190 b 281 -290 144 -208 179 -280 b 304 -291 289 -291 298 -291 b 524 -105 412 -291 506 -212 b 541 -84 526 -88 530 -84 b 556 -101 551 -84 556 -90 b 549 -138 556 -111 553 -122 b 334 -322 521 -237 435 -310 b 302 -324 323 -323 313 -324 b 13 -101 172 -324 54 -234 b -1 -1 4 -68 -1 -34 b 294 322 -1 161 121 303 "},v42:{x_min:-348.4375,x_max:24.5,ha:25,o:"m -330 155 b -322 156 -329 156 -326 156 b -315 156 -319 156 -317 156 b -298 147 -311 155 -308 154 b -19 30 -224 98 -122 55 l 2 26 b 24 -1 17 22 24 13 b 2 -27 24 -15 17 -23 l -19 -31 b -298 -148 -122 -56 -224 -99 b -322 -158 -313 -158 -315 -158 b -348 -131 -338 -158 -348 -145 b -344 -117 -348 -127 -347 -122 b -328 -104 -341 -112 -338 -111 b -127 -8 -269 -65 -202 -33 b -106 0 -115 -4 -106 -1 b -127 6 -106 0 -115 2 b -328 102 -202 31 -269 63 b -344 116 -338 109 -341 111 b -348 130 -347 120 -348 124 b -330 155 -348 141 -341 152 "},v43:{x_min:-442.359375,x_max:441,ha:450,o:"m -31 487 b -1 488 -21 488 -10 488 b 434 104 216 488 397 330 b 441 27 438 79 441 47 b 439 12 441 20 439 15 b 419 0 435 4 427 0 b 404 5 413 0 408 1 b 398 30 400 11 398 13 b 0 351 390 213 213 351 b -59 348 -20 351 -39 349 b -400 30 -251 324 -393 191 b -405 5 -400 13 -401 11 b -420 0 -409 1 -415 0 b -441 12 -428 0 -436 4 b -442 27 -441 15 -442 20 b -435 104 -442 47 -439 79 b -31 487 -401 316 -235 474 m -13 131 b -1 133 -9 133 -5 133 b 51 105 19 133 39 123 b 61 70 58 95 61 83 b 51 34 61 58 58 45 b -1 6 39 16 19 6 b -46 27 -17 6 -34 13 b -62 69 -57 38 -62 54 b -13 131 -62 98 -44 124 "},v44:{x_min:-21.78125,x_max:251.8125,ha:257,o:"m -8 631 b -1 632 -6 632 -4 632 b 19 620 8 632 16 628 b 20 383 20 616 20 616 l 20 148 l 21 151 b 137 199 59 183 99 199 b 182 191 152 199 167 197 b 251 84 227 176 251 134 b 228 0 251 58 243 29 b 100 -142 206 -40 178 -72 l 23 -215 b 0 -229 9 -229 6 -229 b -20 -216 -9 -229 -17 -224 l -21 -212 l -21 201 l -21 616 l -20 620 b -8 631 -17 624 -13 630 m 110 131 b 96 133 106 133 100 133 b 89 133 93 133 91 133 b 24 87 63 129 40 113 l 20 80 l 20 -37 l 20 -156 l 23 -152 b 144 81 96 -72 144 20 l 144 83 b 110 131 144 113 134 126 "},v45:{x_min:-402.890625,x_max:401.53125,ha:410,o:"m -10 273 b -4 274 -9 273 -6 274 b 16 262 4 274 12 269 b 17 158 17 259 17 259 l 17 56 l 62 112 b 117 174 110 172 110 172 b 122 174 118 174 119 174 b 132 173 125 174 129 173 b 295 11 134 172 171 134 l 307 -1 l 336 34 b 374 76 366 72 368 74 b 381 77 375 77 378 77 b 401 56 392 77 401 68 b 400 48 401 54 401 51 b 223 -172 397 41 230 -166 b 210 -176 220 -174 215 -176 b 201 -174 206 -176 204 -176 b 112 -87 198 -173 178 -152 b 27 0 65 -38 27 0 b 21 -6 27 0 24 -2 l 17 -12 l 17 -147 b 17 -210 17 -173 17 -194 b 10 -292 17 -297 16 -287 b -2 -299 6 -297 2 -299 b -21 -287 -10 -299 -19 -295 b -24 -174 -23 -284 -23 -284 l -24 -63 l -66 -117 b -121 -176 -110 -170 -114 -176 b -125 -176 -122 -176 -123 -176 b -296 -12 -134 -174 -125 -184 l -308 0 l -337 -34 b -375 -77 -367 -73 -370 -76 b -382 -79 -377 -79 -379 -79 b -402 -58 -393 -79 -402 -69 b -401 -49 -402 -55 -402 -52 b -224 170 -398 -43 -231 165 b -212 174 -221 173 -216 174 b -202 173 -208 174 -205 174 b -39 11 -200 172 -151 122 l -28 -1 l -25 1 l -24 4 l -24 130 b -23 260 -24 256 -24 258 b -10 273 -20 266 -16 270 "},v46:{x_min:0,x_max:627.46875,ha:640,o:"m 306 190 b 314 191 308 191 311 191 b 326 184 318 191 322 190 l 336 173 b 510 52 377 127 442 80 b 515 49 513 51 515 49 b 611 16 537 40 579 24 b 627 0 624 13 627 9 b 607 -18 627 -11 624 -13 b 330 -181 490 -49 389 -109 b 314 -192 323 -190 319 -192 b 306 -191 311 -192 308 -192 b 294 -177 302 -188 302 -188 b 257 -140 287 -170 265 -148 b 19 -18 193 -84 114 -44 b 0 0 2 -13 0 -11 b 16 16 0 9 2 13 b 110 49 47 24 89 40 b 117 52 111 49 114 51 b 145 65 126 56 130 58 b 281 163 200 93 245 124 b 300 186 288 170 291 174 b 306 190 300 187 303 188 m 317 137 b 313 142 315 141 314 142 b 308 137 313 142 311 141 b 161 4 276 84 220 33 b 155 0 159 1 155 0 b 163 -4 155 0 159 -2 b 308 -138 220 -34 276 -84 b 313 -142 311 -141 313 -142 b 317 -138 314 -142 315 -141 b 464 -4 351 -84 406 -34 b 470 0 468 -2 470 0 b 464 4 470 0 468 1 b 317 137 406 33 351 84 "},v47:{x_min:-24.5,x_max:315.78125,ha:322,o:"m -24 -145 l -24 -5 l -20 -5 b 1 -26 -10 -5 -6 -9 b 175 -241 31 -86 96 -166 b 314 -548 259 -323 304 -420 b 315 -589 315 -555 315 -571 b 314 -630 315 -606 315 -623 b 298 -730 311 -664 306 -699 l 295 -742 l 296 -748 b 314 -850 304 -778 311 -813 b 315 -892 315 -857 315 -874 b 314 -932 315 -909 315 -925 b 298 -1032 311 -967 306 -1002 l 295 -1045 l 296 -1050 b 314 -1153 304 -1081 311 -1115 b 315 -1193 315 -1160 315 -1177 b 314 -1235 315 -1211 315 -1228 b 217 -1526 306 -1338 270 -1444 b 201 -1533 213 -1532 208 -1533 b 182 -1522 193 -1533 185 -1529 b 179 -1514 181 -1518 179 -1517 b 189 -1489 179 -1508 182 -1501 b 266 -1217 240 -1403 266 -1308 b 262 -1156 266 -1196 265 -1177 b 110 -907 247 -1043 190 -950 b 0 -889 87 -895 50 -889 l -1 -889 l -24 -889 l -24 -749 l -24 -610 l -20 -610 b 1 -631 -10 -610 -6 -614 b 175 -846 31 -691 96 -771 b 259 -956 213 -884 236 -914 b 265 -966 262 -961 264 -966 b 265 -966 265 -966 265 -966 b 265 -953 265 -964 265 -959 b 266 -920 266 -943 266 -932 b 262 -853 266 -898 265 -873 b 110 -605 247 -741 190 -648 b 0 -587 87 -592 50 -587 l -1 -587 l -24 -587 l -24 -448 l -24 -308 l -20 -308 b 1 -328 -10 -308 -6 -312 b 175 -544 31 -388 96 -469 b 259 -655 213 -581 236 -612 b 265 -663 262 -659 264 -663 b 265 -663 265 -663 265 -663 b 265 -650 265 -663 265 -657 b 266 -617 266 -641 266 -630 b 262 -551 266 -595 265 -570 b 110 -303 247 -438 190 -345 b 0 -284 87 -290 50 -284 l -1 -284 l -24 -284 l -24 -145 "},v49:{x_min:0,x_max:630.203125,ha:643,o:"m 308 204 b 314 205 310 205 313 205 b 326 201 319 205 323 204 b 355 154 328 199 338 180 b 401 83 362 142 392 95 l 409 72 b 431 41 412 66 424 49 b 619 -174 498 -51 570 -134 b 630 -192 626 -180 630 -186 b 626 -202 630 -195 628 -199 b 616 -206 623 -205 620 -206 b 552 -188 608 -206 592 -202 b 310 -155 488 -169 392 -155 b 268 -156 295 -155 281 -155 b 77 -188 197 -161 126 -173 b 13 -206 35 -202 20 -206 b 9 -206 12 -206 10 -206 b 0 -191 2 -202 0 -197 b 8 -176 0 -186 2 -180 b 204 49 58 -136 138 -43 l 220 72 l 227 83 b 295 188 245 108 281 166 b 308 204 299 197 304 202 m 315 147 b 314 147 315 147 314 147 b 314 147 314 147 314 147 b 306 129 314 145 310 138 l 296 105 b 281 72 292 97 284 77 l 274 56 b 181 -123 247 -4 212 -72 l 174 -134 l 176 -133 b 314 -123 215 -127 272 -123 b 451 -133 356 -123 413 -127 l 454 -134 l 449 -123 b 353 56 417 -72 381 -4 l 347 72 b 332 105 344 77 336 97 l 322 129 b 315 147 318 138 315 145 "},v4a:{x_min:70.78125,x_max:378.390625,ha:315,o:"m 246 373 b 254 373 249 373 251 373 b 372 324 303 373 360 351 b 378 302 377 317 378 309 b 338 251 378 278 362 255 b 328 249 334 249 332 249 b 283 294 303 249 283 270 b 288 315 283 301 284 308 b 289 319 289 317 289 319 b 289 319 289 319 289 319 b 283 320 289 320 287 320 b 270 322 279 322 274 322 b 206 288 242 322 215 308 b 206 283 206 287 206 285 b 257 223 206 267 230 238 b 284 206 272 213 277 210 b 351 90 328 173 351 130 b 340 47 351 74 348 59 b 205 -30 314 -2 264 -30 b 182 -29 198 -30 190 -30 b 84 15 147 -24 103 -5 b 70 48 74 24 70 36 b 108 99 70 70 85 94 b 121 102 112 101 117 102 b 167 56 147 102 167 80 b 159 31 167 48 164 40 l 156 26 l 157 26 b 190 20 167 22 178 20 b 220 26 201 20 212 22 b 258 65 243 34 258 51 b 257 70 258 66 258 69 b 204 126 249 94 234 109 b 114 258 148 158 114 209 b 125 302 114 273 118 288 b 246 373 147 342 193 370 "},v4b:{x_min:0,x_max:503.609375,ha:514,o:"m 274 430 b 277 430 276 430 277 430 b 310 394 296 430 310 415 b 308 383 310 391 308 387 b 306 367 307 381 307 374 b 236 120 298 305 272 210 b 40 -273 189 -5 125 -134 b 20 -287 35 -283 27 -287 b 5 -281 14 -287 9 -285 b 0 -267 1 -277 0 -273 b 9 -242 0 -262 2 -255 b 246 395 137 -12 232 242 b 274 430 249 416 257 427 m 468 430 b 472 430 469 430 470 430 b 503 394 490 430 503 415 b 502 383 503 391 503 387 b 499 367 502 381 500 374 b 431 120 491 305 465 210 b 234 -273 382 -5 318 -134 b 213 -287 228 -283 220 -287 b 198 -281 208 -287 202 -285 b 193 -267 194 -277 193 -273 b 202 -242 193 -262 196 -255 b 439 395 330 -12 426 242 b 468 430 442 416 451 427 "},v4d:{x_min:-311.6875,x_max:310.328125,ha:317,o:"m -9 388 b -2 390 -8 390 -5 390 b 5 388 1 390 4 390 b 19 378 10 387 16 383 b 23 333 23 371 23 371 b 24 298 23 299 24 298 b 81 276 34 298 65 285 b 213 91 145 240 190 177 b 224 24 217 76 224 36 b 257 24 224 24 235 24 b 299 19 292 24 292 24 b 310 -1 306 15 310 6 b 299 -23 310 -11 306 -19 b 257 -27 292 -27 292 -27 b 224 -29 235 -27 224 -29 b 213 -95 224 -40 217 -80 b 81 -280 190 -181 145 -244 b 24 -301 65 -290 34 -301 b 23 -335 24 -301 23 -303 l 23 -340 b 17 -381 23 -374 23 -374 b -1 -391 13 -388 5 -391 b -21 -381 -9 -391 -17 -388 b -27 -340 -27 -374 -27 -374 l -27 -335 b -28 -301 -27 -303 -27 -301 b -85 -280 -38 -301 -69 -290 b -217 -95 -149 -244 -194 -181 b -228 -29 -221 -80 -228 -40 b -259 -27 -228 -29 -238 -27 b -300 -23 -294 -27 -294 -27 b -311 -2 -307 -19 -311 -11 b -294 23 -311 8 -304 19 b -259 24 -291 23 -284 24 b -228 24 -239 24 -228 24 b -217 91 -228 36 -221 76 b -85 276 -194 177 -149 240 b -28 298 -69 285 -38 298 b -27 333 -27 298 -27 299 b -27 371 -27 362 -27 369 b -9 388 -24 378 -17 385 m -27 136 b -28 247 -27 197 -28 247 b -61 216 -31 247 -53 226 b -123 33 -95 172 -121 98 l -125 24 l -76 24 l -27 24 l -27 136 m 29 242 b 24 247 27 245 24 247 b 23 136 24 247 23 197 l 23 24 l 72 24 l 121 24 l 119 33 b 29 242 115 116 77 206 m -27 -140 l -27 -27 l -76 -27 l -125 -27 l -123 -36 b -61 -220 -121 -102 -95 -176 b -28 -251 -53 -230 -31 -251 b -27 -140 -28 -251 -27 -201 m 119 -36 l 121 -27 l 72 -27 l 23 -27 l 23 -140 b 24 -251 23 -201 24 -251 b 57 -220 27 -251 49 -230 b 119 -36 91 -176 117 -102 "},v4e:{x_min:0,x_max:239.5625,ha:244,o:"m 10 460 b 20 462 13 462 14 462 b 39 449 28 462 35 458 l 40 446 l 40 326 b 40 205 40 259 40 205 b 127 227 40 205 80 215 b 220 249 196 244 213 249 b 227 247 224 249 225 248 b 238 237 231 245 235 241 l 239 233 l 239 -106 l 239 -448 l 238 -451 b 219 -463 234 -459 225 -463 b 198 -451 210 -463 202 -459 l 197 -448 l 197 -324 b 197 -201 197 -248 197 -201 b 110 -223 196 -201 157 -210 b 17 -245 42 -240 24 -245 b 10 -242 13 -245 13 -244 b 0 -233 6 -241 2 -237 l 0 -230 l 0 108 l 0 446 l 0 449 b 10 460 2 453 6 458 m 197 22 b 197 70 197 41 197 58 b 196 116 197 113 197 116 l 196 116 b 118 97 196 116 160 106 l 40 77 l 40 -18 b 40 -112 40 -69 40 -112 l 119 -93 l 197 -73 l 197 22 "},v51:{x_min:-1.359375,x_max:455.96875,ha:465,o:"m 352 541 b 357 542 353 542 355 542 b 377 530 364 542 372 537 l 378 526 l 378 394 l 379 262 l 404 266 b 436 270 420 269 430 270 b 450 265 443 270 446 269 b 455 220 455 259 455 260 l 455 208 l 455 161 l 454 156 b 411 140 449 147 447 147 b 378 133 393 137 379 134 b 378 68 378 133 378 106 b 378 22 378 54 378 38 l 379 -87 l 404 -83 b 436 -79 420 -80 430 -79 b 450 -84 443 -79 446 -80 b 455 -129 455 -90 455 -88 l 455 -141 l 455 -188 l 454 -192 b 413 -209 449 -202 447 -202 b 382 -215 398 -212 383 -215 l 378 -215 l 378 -345 l 378 -380 b 375 -485 378 -484 378 -480 b 357 -494 371 -491 364 -494 b 340 -485 351 -494 344 -491 b 336 -383 337 -480 336 -484 l 336 -349 l 336 -223 l 334 -223 b 291 -231 334 -223 314 -227 l 247 -240 l 247 -371 l 246 -503 l 245 -506 b 225 -519 242 -514 234 -519 b 206 -506 219 -519 210 -514 l 205 -503 l 205 -376 l 205 -248 l 160 -256 l 115 -265 l 115 -396 l 115 -527 l 114 -531 b 95 -544 110 -539 102 -544 b 76 -531 87 -544 78 -539 l 73 -527 l 73 -399 b 73 -273 73 -330 73 -273 b 49 -277 73 -273 61 -274 b 17 -281 32 -280 24 -281 b 4 -276 10 -281 8 -280 b -1 -234 0 -269 -1 -272 b 0 -219 -1 -229 0 -224 l 0 -170 l 1 -167 b 10 -158 2 -163 6 -159 b 49 -149 13 -156 16 -155 l 73 -145 l 73 -34 b 73 76 73 26 73 76 b 49 72 73 76 61 74 b 17 68 32 69 24 68 b 4 73 10 68 8 69 b -1 115 0 80 -1 77 b 0 130 -1 120 0 124 l 0 179 l 1 181 b 10 191 2 186 6 190 b 49 199 13 192 16 194 l 73 204 l 73 338 b 73 374 73 352 73 365 b 77 483 73 484 73 477 b 95 492 81 489 88 492 b 111 483 100 492 107 489 b 115 378 115 477 115 483 l 115 342 b 117 212 115 223 115 212 b 204 229 117 212 200 227 l 205 229 l 205 365 l 205 502 l 206 505 b 225 517 210 513 219 517 b 245 505 234 517 242 513 l 246 502 l 247 369 l 247 237 l 249 237 b 336 254 253 238 336 254 b 337 390 336 254 337 302 l 337 526 l 338 530 b 352 541 341 535 347 539 m 336 15 b 336 126 336 102 336 126 l 336 126 b 291 117 336 126 315 122 l 247 109 l 247 -1 l 247 -112 l 249 -112 b 336 -95 253 -111 336 -95 b 336 15 336 -95 336 -56 m 205 -120 b 205 -55 205 -120 205 -93 b 205 -9 205 -41 205 -24 l 205 101 l 160 93 l 115 84 l 115 -26 b 115 -83 115 -49 115 -69 b 117 -137 115 -133 115 -137 b 205 -120 118 -137 204 -120 "},v52:{x_min:-10.890625,x_max:298.078125,ha:294,o:"m 138 473 b 142 474 140 473 141 474 b 164 459 148 474 153 470 b 191 402 183 442 191 423 b 181 353 191 388 187 371 b 178 349 179 352 178 349 b 179 348 178 348 179 348 b 185 349 181 348 182 348 b 255 376 210 355 234 363 b 272 381 264 381 266 381 b 298 355 287 381 298 370 b 288 330 298 348 298 345 b 171 34 238 254 194 141 b 166 13 168 16 168 16 b 144 1 161 5 152 1 b 121 15 134 1 125 5 b 115 33 119 18 117 24 b 0 330 91 145 49 252 b -10 355 -9 345 -10 348 b 13 381 -10 371 0 381 b 31 376 19 381 25 380 b 132 345 61 358 103 345 l 136 345 l 137 355 b 145 378 138 359 142 370 b 152 415 149 394 152 405 b 137 452 152 427 148 438 b 133 464 134 458 133 460 b 138 473 133 467 134 470 "},v53:{x_min:0,x_max:902.421875,ha:921,o:"m 17 240 b 24 241 19 241 21 241 b 32 240 28 241 31 241 b 46 229 38 238 43 234 b 50 88 50 223 50 237 b 50 -1 50 63 50 34 b 50 -90 50 -36 50 -65 b 46 -231 50 -238 50 -224 b 25 -242 42 -238 34 -242 b 0 -224 14 -242 4 -235 b 0 2 0 -222 0 -108 b 0 223 0 112 0 220 b 17 240 2 230 9 237 m 110 240 b 118 241 111 241 114 241 b 126 240 121 241 123 241 b 142 223 133 237 140 230 b 144 123 144 220 144 205 b 144 29 144 45 144 29 b 144 29 144 29 144 29 b 393 183 166 106 264 167 b 450 186 412 184 431 186 b 756 29 600 186 732 120 b 756 29 756 29 756 29 b 758 123 758 29 758 45 b 760 227 758 226 758 223 b 784 241 766 237 774 241 b 804 229 792 241 800 237 b 809 88 808 223 809 237 l 809 -1 l 809 -90 b 804 -231 809 -238 808 -224 b 784 -242 800 -238 792 -242 b 762 -231 775 -242 766 -238 b 758 -124 756 -224 758 -231 b 756 -30 758 -47 758 -30 b 756 -30 756 -30 756 -30 b 509 -184 736 -108 637 -169 b 450 -187 488 -187 469 -187 b 144 -30 300 -187 168 -122 b 144 -30 144 -30 144 -30 b 144 -124 144 -30 144 -47 b 140 -231 144 -231 144 -224 b 118 -242 134 -238 126 -242 b 92 -224 107 -242 96 -235 b 92 2 92 -222 92 -108 b 92 223 92 112 92 220 b 110 240 95 230 102 237 m 432 161 b 413 162 426 162 420 162 b 313 41 351 162 313 109 b 347 -73 313 5 323 -34 b 487 -163 385 -133 439 -163 b 578 -97 526 -163 562 -142 b 588 -43 585 -80 588 -62 b 432 161 588 47 518 147 m 868 240 b 876 241 869 241 872 241 b 884 240 879 241 882 241 b 898 229 890 238 894 234 b 902 88 902 223 902 237 l 902 -1 l 902 -90 b 898 -231 902 -238 902 -224 b 876 -242 892 -238 884 -242 b 852 -224 865 -242 854 -235 b 850 2 850 -222 850 -108 b 852 223 850 112 850 220 b 868 240 853 230 860 237 "},v54:{x_min:-24.5,x_max:317.140625,ha:324,o:"m -24 -161 l -24 -5 l -20 -5 b 0 -24 -9 -5 -2 -12 b 171 -315 21 -124 84 -233 b 317 -660 268 -406 317 -531 b 187 -1014 317 -782 274 -909 b 161 -1034 172 -1034 171 -1034 b 141 -1013 149 -1034 141 -1025 b 152 -991 141 -1004 142 -1002 b 266 -682 228 -899 266 -788 b 174 -430 266 -588 236 -498 b -23 -317 136 -388 66 -348 b -24 -161 -23 -316 -24 -285 "},v55:{x_min:0,x_max:551.25,ha:563,o:"m 289 644 b 304 645 294 645 299 645 b 404 566 349 645 392 613 b 406 541 405 557 406 549 b 379 471 406 514 397 489 l 377 467 l 382 470 b 509 591 438 485 485 531 b 513 601 510 595 513 599 b 530 609 518 607 524 609 b 551 588 540 609 551 602 b 200 -605 551 584 204 -599 b 182 -616 197 -612 190 -616 b 163 -602 174 -616 166 -610 b 161 -598 161 -601 161 -601 b 217 -402 161 -589 170 -562 b 272 -213 247 -298 272 -213 b 272 -213 272 -213 272 -213 b 264 -219 272 -213 268 -216 b 140 -262 227 -247 182 -262 b 36 -226 102 -262 65 -249 b 0 -145 12 -206 0 -176 b 17 -84 0 -124 5 -104 b 103 -38 38 -54 70 -38 b 191 -91 137 -38 172 -56 b 205 -141 201 -106 205 -124 b 178 -212 205 -167 196 -194 l 175 -215 l 182 -213 b 307 -93 236 -198 284 -151 b 372 129 308 -88 372 127 b 372 129 372 129 372 129 b 364 122 372 129 368 126 b 240 80 328 94 283 80 b 137 115 202 80 166 91 b 99 195 112 136 99 165 b 118 256 99 217 106 238 b 204 303 138 287 171 303 b 292 249 238 303 273 285 b 306 199 302 234 306 217 b 279 129 306 173 296 148 l 276 126 l 281 127 b 408 248 336 142 385 190 b 473 470 409 254 473 469 b 473 470 473 470 473 470 b 465 464 473 470 469 467 b 341 421 428 435 383 421 b 236 458 303 421 266 433 b 200 537 212 478 200 508 b 289 644 200 585 234 635 "},v58:{x_min:-21.78125,x_max:367.5,ha:375,o:"m 259 1553 b 265 1553 261 1553 264 1553 b 288 1540 272 1553 277 1550 b 367 1351 340 1493 367 1424 b 336 1221 367 1308 357 1263 l 332 1211 l 333 1208 b 367 1077 356 1170 367 1124 b 336 945 367 1032 357 986 l 332 935 l 333 932 b 367 800 356 893 367 848 b 336 669 367 756 357 710 l 332 659 l 333 656 b 367 523 356 617 367 571 b 345 412 367 485 360 446 b 231 273 322 356 284 310 b -1 19 121 195 27 93 b -17 4 -4 11 -10 5 l -21 4 l -21 134 l -21 265 l -17 265 b 133 291 20 265 96 278 b 318 537 245 328 318 433 b 307 603 318 559 315 582 b 303 614 304 612 304 614 b 298 609 302 614 300 613 b 231 549 281 589 258 567 b -1 295 121 471 27 369 b -17 280 -4 287 -10 281 l -21 280 l -21 410 l -21 541 l -17 541 b 133 567 20 541 96 555 b 318 813 245 605 318 709 b 307 880 318 835 315 859 b 303 891 304 888 304 891 b 298 885 302 891 300 888 b 231 825 281 866 258 843 b -1 571 121 748 27 645 b -17 556 -4 563 -10 557 l -21 556 l -21 687 l -21 817 l -17 817 b 133 843 20 817 96 830 b 318 1089 245 881 318 985 b 307 1156 318 1111 315 1134 b 303 1167 304 1164 304 1167 b 298 1161 302 1167 300 1164 b 231 1102 281 1140 258 1120 b -1 848 121 1024 27 921 b -17 832 -4 839 -10 834 l -21 832 l -21 963 l -21 1093 l -17 1093 b 114 1113 12 1093 78 1103 b 313 1314 215 1142 289 1218 b 318 1364 317 1331 318 1347 b 255 1511 318 1422 295 1478 b 243 1532 247 1519 243 1525 b 259 1553 243 1540 250 1550 "},v59:{x_min:0,x_max:464.140625,ha:474,o:"m 0 0 l 0 347 l 76 347 l 153 347 l 153 0 l 153 -348 l 76 -348 l 0 -348 l 0 0 m 308 -1 l 308 347 l 386 347 l 464 347 l 464 -1 l 464 -348 l 386 -348 l 308 -348 l 308 -1 "},v5a:{x_min:-171.5,x_max:170.140625,ha:174,o:"m -6 566 b 0 567 -5 567 -2 567 b 14 556 6 567 12 563 b 92 285 14 555 50 433 b 170 13 166 33 170 19 b 168 13 170 13 170 13 b 161 1 168 8 167 4 l 159 0 l 122 0 l 84 0 l 81 1 b 21 195 76 5 78 -5 b -32 381 -8 297 -32 381 b -87 197 -32 381 -57 298 b -141 8 -115 94 -140 9 b -155 0 -142 2 -149 0 b -171 15 -163 0 -171 5 b -14 556 -171 18 -24 528 b -6 566 -14 560 -10 564 "},v5b:{x_min:-441,x_max:439.640625,ha:449,o:"m -428 -2 b -421 0 -427 -1 -424 0 b -406 -6 -416 0 -409 -2 b -400 -31 -401 -12 -400 -15 b -1 -352 -392 -215 -215 -352 b 58 -349 19 -352 38 -351 b 398 -31 250 -326 392 -192 b 404 -6 398 -15 400 -12 b 419 -1 408 -2 413 -1 b 439 -13 427 -1 435 -5 b 439 -29 439 -16 439 -22 b 434 -105 439 -48 438 -80 b 0 -489 397 -333 213 -489 b -68 -484 -23 -489 -44 -488 b -441 -36 -280 -452 -436 -263 b -441 -30 -441 -34 -441 -31 b -428 -2 -441 -11 -439 -5 m -13 -9 b -1 -8 -9 -8 -5 -8 b 50 -36 19 -8 39 -19 b 61 -72 57 -47 61 -59 b 50 -106 61 -84 57 -97 b -1 -134 39 -124 19 -134 b -46 -115 -17 -134 -34 -129 b -62 -72 -57 -102 -62 -87 b -13 -9 -62 -44 -44 -16 "},v5c:{x_min:0,x_max:447.8125,ha:457,o:"m 0 -87 l 0 0 l 223 0 l 447 0 l 447 -87 l 447 -174 l 223 -174 l 0 -174 l 0 -87 "},v5d:{x_min:-1.359375,x_max:592.078125,ha:604,o:"m 280 692 b 295 694 283 692 289 694 b 310 692 300 694 307 692 b 357 630 340 684 357 657 b 336 580 357 612 351 594 b 311 538 321 566 311 549 b 352 492 311 512 330 492 b 366 495 357 492 362 492 b 397 553 390 503 397 517 b 415 603 397 576 402 591 b 460 623 427 617 443 623 b 509 599 479 623 498 614 b 522 559 518 587 522 573 b 494 506 522 538 513 519 b 451 495 481 498 473 496 b 415 488 432 495 426 494 b 394 449 404 483 394 464 b 394 448 394 448 394 448 l 394 440 l 397 433 b 428 409 404 420 413 413 b 438 408 431 408 435 408 b 479 431 450 408 462 415 b 528 455 495 448 510 455 b 548 452 534 455 541 453 b 592 391 577 442 592 416 b 549 331 592 365 577 340 b 528 327 541 328 534 327 b 479 351 510 327 495 335 b 438 374 464 367 450 374 b 417 369 431 374 424 373 b 394 333 402 360 394 348 b 400 312 394 326 396 319 b 451 287 408 294 420 288 b 513 258 484 285 499 278 b 522 223 519 247 522 234 b 461 159 522 190 496 159 b 449 161 457 159 453 159 b 397 229 416 167 397 191 b 366 288 397 265 390 278 b 352 290 362 290 357 290 b 315 262 336 290 321 280 b 311 245 313 256 311 251 b 334 204 311 233 318 220 b 355 170 348 190 351 184 b 357 152 356 166 357 159 b 355 136 357 147 356 140 b 295 88 345 104 321 88 b 232 152 264 88 232 112 b 255 204 232 174 238 186 b 279 244 273 222 279 231 l 279 245 b 238 290 279 270 259 290 b 224 288 234 290 228 290 b 193 229 200 278 193 265 b 141 161 193 191 174 167 b 129 159 137 159 133 159 b 68 223 93 159 68 190 b 77 258 68 234 70 247 b 138 287 91 278 106 285 b 185 302 166 287 175 291 b 196 333 193 312 196 323 b 174 369 196 347 187 360 b 152 374 166 373 159 374 b 111 351 140 374 126 367 b 62 327 95 335 80 327 b 51 328 58 327 54 327 b -1 391 16 334 -1 363 b 53 455 -1 420 17 449 b 62 455 57 455 59 455 b 111 431 80 455 95 448 b 152 408 127 415 140 408 b 161 409 155 408 159 408 b 193 433 176 413 186 420 l 196 440 l 196 448 b 196 451 196 449 196 449 b 190 471 196 459 194 463 b 137 495 182 489 167 495 l 134 495 l 134 495 b 68 560 95 495 68 521 b 129 623 68 596 95 623 b 144 621 134 623 138 623 b 193 553 175 614 193 589 b 224 495 193 517 200 503 b 238 492 228 492 234 492 b 279 538 259 492 279 512 b 254 580 279 549 269 566 b 232 630 239 594 232 612 b 280 692 232 657 250 684 m 307 456 b 295 458 303 458 299 458 b 230 391 258 458 230 426 b 236 360 230 381 231 371 b 295 324 249 337 272 324 b 353 360 318 324 341 337 b 360 391 357 370 360 381 b 307 456 360 421 340 451 "},v60:{x_min:-590.71875,x_max:589.359375,ha:601,o:"m -367 173 b -362 174 -366 174 -364 174 b -351 173 -357 174 -353 173 b -262 86 -348 172 -328 151 b -176 0 -216 37 -176 0 b -107 84 -176 0 -145 37 b -31 174 -36 173 -38 172 b -25 174 -29 174 -28 174 b -16 173 -23 174 -19 173 b 72 86 -13 172 6 151 b 157 0 119 37 157 0 b 227 84 159 0 189 37 b 303 174 298 173 296 172 b 308 174 304 174 307 174 b 318 173 313 174 317 173 b 481 11 322 172 357 134 l 494 -1 l 522 34 b 560 76 553 72 555 74 b 567 77 563 77 564 77 b 589 56 579 77 589 68 b 586 48 589 54 588 51 b 411 -172 583 41 416 -166 b 397 -176 406 -174 401 -176 b 387 -174 393 -176 390 -176 b 299 -87 386 -173 366 -152 b 213 0 253 -38 213 0 b 144 -86 213 0 182 -38 b 68 -174 73 -174 74 -173 b 62 -176 66 -176 65 -176 b 53 -174 59 -176 55 -174 b -35 -87 50 -173 29 -152 b -121 0 -83 -38 -121 0 b -190 -86 -122 0 -152 -38 b -266 -174 -261 -174 -259 -173 b -272 -176 -268 -176 -270 -176 b -281 -174 -276 -176 -280 -174 b -371 -86 -284 -173 -304 -152 b -457 0 -417 -38 -457 0 l -457 0 b -477 -26 -457 0 -470 -16 b -548 -227 -524 -88 -548 -161 b -536 -303 -548 -254 -544 -280 b -533 -317 -534 -309 -533 -313 b -553 -338 -533 -330 -541 -338 b -577 -315 -566 -338 -571 -333 b -590 -227 -586 -287 -590 -258 b -518 -9 -590 -154 -564 -77 b -465 56 -509 2 -504 8 l -402 134 b -367 173 -375 169 -372 172 "},v62:{x_min:46.28125,x_max:669.671875,ha:563,o:"m 183 376 b 189 376 185 376 187 376 b 212 374 197 376 208 376 b 265 337 234 369 253 355 b 274 317 268 331 273 320 b 274 316 274 317 274 316 b 280 323 276 316 276 319 b 311 358 288 337 299 348 b 319 366 315 360 318 365 b 356 376 326 373 340 376 b 382 371 364 376 374 374 b 428 337 400 366 417 352 b 436 317 431 331 436 320 b 438 316 436 317 436 316 b 442 323 438 316 439 319 b 475 358 451 337 462 348 b 483 366 477 360 481 365 b 518 376 488 373 503 376 b 544 373 528 376 536 376 b 604 285 579 360 604 326 b 597 249 604 273 601 258 b 543 63 596 247 544 70 b 541 54 543 61 541 55 b 540 44 540 51 540 47 b 552 23 540 33 545 23 b 552 23 552 23 552 23 b 647 126 586 29 627 72 b 658 138 651 136 653 138 b 660 138 660 138 660 138 b 669 129 666 137 669 136 b 654 88 669 122 665 109 b 562 -12 631 43 602 9 l 549 -19 b 521 -27 540 -24 530 -27 b 447 30 490 -27 458 -4 b 443 58 445 38 443 48 b 450 93 443 72 446 84 b 504 278 453 97 504 272 b 507 288 506 283 506 287 b 509 298 507 292 509 295 b 491 326 509 310 502 320 b 487 327 490 327 488 327 b 479 324 484 327 483 326 b 441 270 462 316 443 288 b 435 249 441 265 436 254 b 398 127 434 248 419 195 b 362 4 379 61 362 5 b 328 -1 359 -1 362 -1 b 314 -1 323 -1 319 -1 b 302 -1 310 -1 306 -1 b 266 4 266 -1 269 -1 b 265 6 265 5 265 5 b 303 144 265 13 272 34 b 343 278 325 216 343 276 b 344 288 343 281 344 285 b 345 298 345 291 345 295 b 330 326 345 310 340 320 b 323 327 328 327 325 327 b 317 324 322 327 321 326 b 279 270 300 316 281 288 b 273 249 279 265 274 254 b 236 127 272 248 255 195 b 200 4 216 61 200 5 b 164 -1 197 -1 198 -1 b 151 -1 161 -1 156 -1 b 140 -1 147 -1 142 -1 b 103 4 104 -1 106 -1 b 103 6 103 5 103 5 b 141 144 103 13 108 34 b 181 278 161 216 179 276 b 182 288 181 281 181 285 b 183 298 182 291 183 295 b 168 324 183 310 178 320 b 160 327 166 326 163 327 b 141 320 156 327 151 324 b 69 230 112 305 85 272 b 57 215 65 217 62 215 b 55 215 57 215 55 215 b 46 224 49 215 46 217 b 59 260 46 231 50 242 b 151 363 81 306 112 341 b 161 369 155 365 160 367 b 183 376 166 371 174 374 "},v68:{x_min:-597.53125,x_max:596.171875,ha:608,o:"m -533 324 b -525 327 -530 326 -528 327 b -504 305 -514 327 -504 317 b -504 305 -504 305 -504 305 b -513 284 -504 299 -504 299 b -556 112 -541 226 -556 167 b -545 33 -556 84 -552 58 b -524 -20 -541 15 -532 -9 l -522 -23 l -491 15 l -413 111 b -355 174 -367 169 -363 174 b -351 174 -353 174 -352 174 b -254 86 -343 174 -348 179 b -168 -1 -208 37 -168 -1 b -100 84 -168 -1 -137 37 b -23 173 -28 173 -29 172 b -19 174 -21 174 -20 174 b -8 173 -14 174 -10 173 b 155 11 -5 172 43 123 l 166 -1 l 168 1 l 170 4 l 170 130 b 171 260 170 256 170 258 b 191 274 175 269 183 274 b 205 267 196 274 201 272 b 212 158 212 262 210 273 l 212 56 l 257 112 b 311 173 304 172 304 172 b 317 174 313 174 314 174 b 326 173 319 174 323 173 b 490 11 329 172 366 134 l 502 -1 l 530 34 b 568 76 560 72 563 74 b 575 77 570 77 573 77 b 596 56 586 77 596 68 b 594 48 596 54 596 51 b 417 -172 592 41 424 -166 b 405 -176 415 -174 409 -176 b 396 -174 401 -176 398 -176 b 307 -87 393 -173 372 -152 b 221 -1 259 -38 221 -1 b 216 -6 221 -1 219 -2 l 212 -12 l 212 -147 b 212 -210 212 -173 212 -194 b 205 -292 212 -297 210 -287 b 191 -299 201 -297 196 -299 b 172 -287 183 -299 175 -295 b 170 -174 171 -284 171 -284 l 170 -63 l 127 -117 b 73 -176 84 -170 80 -176 b 68 -176 72 -176 70 -176 b -27 -87 59 -174 65 -180 b -114 0 -74 -38 -112 0 b -182 -86 -114 0 -145 -38 b -258 -174 -253 -174 -253 -173 b -264 -176 -259 -176 -262 -176 b -274 -174 -268 -176 -272 -174 b -438 -11 -277 -173 -348 -102 l -449 0 l -479 -37 b -524 -80 -513 -80 -514 -80 l -524 -80 b -553 -52 -534 -80 -540 -74 b -597 109 -583 -8 -597 48 b -560 280 -597 165 -585 224 b -533 324 -548 310 -540 322 "},v6c:{x_min:-1.359375,x_max:193.28125,ha:197,o:"m 78 233 b 87 233 81 233 84 233 b 187 140 132 233 174 195 b 193 102 190 127 193 115 b 43 -113 193 22 136 -62 b 27 -119 36 -116 31 -119 b 19 -108 21 -119 19 -115 b 29 -97 19 -102 20 -101 b 102 13 73 -72 102 -27 b 92 51 102 26 98 40 l 91 54 l 84 54 b 8 104 53 54 21 74 b -1 142 1 116 -1 130 b 78 233 -1 187 31 227 "},v6d:{x_min:-590.71875,x_max:589.359375,ha:601,o:"m 544 335 b 553 337 548 337 551 337 b 575 313 563 337 570 330 b 589 226 583 285 589 256 b 517 8 589 152 563 76 b 464 -58 507 -4 503 -9 l 401 -136 b 362 -176 372 -172 370 -176 b 357 -176 360 -176 359 -176 b 261 -87 349 -174 355 -180 b 175 0 215 -38 175 0 b 106 -86 175 0 144 -38 b 29 -174 35 -174 36 -173 b 24 -176 28 -176 27 -176 b 14 -174 21 -176 17 -174 b -73 -87 12 -173 -8 -152 b -159 0 -121 -38 -159 0 b -228 -86 -160 0 -190 -38 b -304 -174 -299 -174 -298 -173 b -310 -176 -306 -176 -308 -176 b -319 -174 -314 -176 -318 -174 b -483 -12 -323 -173 -359 -137 l -495 0 l -524 -34 b -562 -77 -553 -73 -556 -76 b -568 -79 -564 -79 -566 -79 b -590 -58 -581 -79 -590 -69 b -588 -49 -590 -55 -589 -52 b -412 170 -585 -43 -417 165 b -398 174 -408 173 -402 174 b -389 173 -394 174 -392 174 b -300 86 -387 172 -366 151 b -215 -1 -254 37 -215 -1 b -145 84 -215 -1 -183 37 b -69 173 -74 173 -76 172 b -63 174 -68 174 -66 174 b -54 173 -61 174 -57 173 b 34 86 -51 172 -31 151 b 119 -1 81 37 119 -1 b 189 84 121 -1 151 37 b 265 173 259 173 258 172 b 270 174 266 174 269 174 b 280 173 274 174 279 173 b 370 84 283 172 303 151 b 455 -1 416 37 455 -1 l 455 -1 b 476 24 455 -1 469 15 b 547 226 522 87 547 159 b 534 302 547 252 543 278 b 532 317 533 308 532 313 b 544 335 532 326 536 333 "},v6f:{x_min:-80.3125,x_max:78.9375,ha:81,o:"m 63 191 b 69 192 65 192 66 192 b 77 188 72 192 76 191 b 78 183 78 187 78 186 b 74 158 78 179 77 172 l 66 115 b 9 -161 49 30 10 -158 b -10 -187 6 -172 -1 -181 b -34 -194 -17 -191 -25 -194 b -80 -147 -58 -194 -80 -174 b -80 -141 -80 -144 -80 -142 b 9 70 -80 -134 -73 -117 l 49 163 b 63 191 59 188 61 190 "},v70:{x_min:0,x_max:436.921875,ha:446,o:"m 213 190 b 217 191 215 191 216 191 b 231 184 223 191 228 188 b 249 154 240 167 246 159 b 419 18 292 91 348 45 b 436 -1 435 11 436 8 b 424 -16 436 -9 434 -13 b 308 -87 394 -26 340 -59 b 231 -186 276 -117 257 -142 b 219 -192 228 -191 225 -192 b 198 -174 209 -192 208 -191 b 47 -33 161 -113 110 -63 b 10 -16 34 -26 17 -19 b 0 -1 2 -13 0 -9 b 17 18 0 8 1 11 b 198 173 95 48 156 101 b 213 190 206 187 208 188 "},v72:{x_min:-423.3125,x_max:421.9375,ha:431,o:"m -262 197 b -247 197 -257 197 -253 197 b -118 162 -210 197 -163 184 b 40 45 -61 134 -13 98 b 277 -95 119 -33 200 -81 b 289 -97 281 -97 285 -97 b 378 0 332 -97 371 -55 b 378 11 378 4 378 6 b 302 83 378 55 345 83 b 242 66 283 83 262 77 b 208 56 231 59 219 56 b 148 120 175 56 148 81 b 201 186 148 151 164 172 b 261 198 220 194 240 198 b 420 45 341 198 411 136 b 421 22 421 37 421 29 b 245 -199 421 -93 338 -199 b 238 -198 243 -199 240 -199 b -44 -47 148 -194 50 -141 b -250 86 -114 22 -183 66 b -295 94 -270 91 -283 94 b -315 91 -302 94 -307 94 b -381 4 -356 81 -381 43 b -355 -56 -381 -18 -372 -40 b -298 -81 -338 -73 -319 -81 b -246 -68 -283 -81 -265 -77 b -212 -58 -234 -61 -223 -58 b -178 -69 -200 -58 -189 -62 b -151 -122 -160 -81 -151 -101 b -171 -167 -151 -138 -157 -155 b -239 -195 -185 -181 -213 -192 b -257 -197 -245 -197 -250 -197 b -423 -5 -352 -197 -423 -109 b -412 65 -423 16 -419 40 b -262 197 -389 137 -329 188 "},v74:{x_min:-206.890625,x_max:428.75,ha:438,o:"m 389 -351 b 394 -351 390 -351 393 -351 b 428 -385 413 -351 428 -367 b 428 -394 428 -388 428 -391 b 394 -428 426 -406 421 -410 l 332 -473 l 269 -516 l 205 -560 l 141 -603 l 77 -648 l 13 -692 l -50 -737 l -114 -780 l -145 -802 b -171 -813 -157 -810 -163 -813 b -175 -813 -172 -813 -174 -813 b -206 -777 -194 -811 -206 -795 b -202 -760 -206 -771 -205 -766 b -87 -675 -197 -752 -206 -757 l -34 -639 l 83 -557 l 145 -514 l 209 -470 l 272 -427 b 389 -351 375 -356 381 -352 "},v75:{x_min:-149.71875,x_max:148.359375,ha:151,o:"m -137 381 b -130 383 -134 383 -133 383 b -111 371 -122 383 -114 378 b -55 224 -110 370 -85 305 b 0 80 -25 145 -1 80 b 54 224 0 80 24 145 b 112 377 114 384 110 373 b 127 384 118 381 122 384 b 148 362 138 384 148 374 l 148 356 l 83 183 b 16 9 47 88 17 11 b -1 0 12 2 5 0 b -14 5 -5 0 -10 1 b -84 183 -19 9 -13 -6 l -149 356 l -149 362 b -137 381 -149 371 -145 378 "},v78:{x_min:0,x_max:193.28125,ha:197,o:"m 85 514 b 95 517 88 517 89 517 b 114 505 103 517 110 513 l 115 502 l 115 376 b 115 249 115 306 115 249 b 141 258 117 249 127 252 l 167 266 l 172 266 b 190 254 181 265 187 262 l 193 251 l 193 202 l 193 188 b 187 147 193 149 191 152 b 147 130 183 142 182 141 l 115 119 l 115 9 b 115 -99 115 -51 115 -99 b 141 -91 115 -99 127 -95 b 171 -81 166 -81 167 -81 l 171 -81 b 191 -94 181 -81 189 -87 b 193 -142 191 -97 193 -120 b 191 -195 193 -167 191 -194 b 125 -227 187 -205 187 -204 l 115 -230 l 115 -366 l 115 -503 l 114 -506 b 95 -519 110 -514 102 -519 b 74 -506 87 -519 78 -514 l 73 -503 l 73 -374 b 73 -245 73 -260 73 -245 b 73 -245 73 -245 73 -245 b 55 -252 72 -245 63 -249 l 32 -260 b 19 -263 27 -262 23 -263 b 4 -256 13 -263 8 -260 b 0 -215 0 -251 0 -254 b 0 -199 0 -210 0 -206 l 0 -152 l 1 -149 b 8 -140 2 -145 5 -141 b 42 -127 9 -140 24 -133 l 73 -116 l 73 -5 b 73 23 73 4 73 15 b 73 105 73 70 73 105 b 49 97 73 105 61 101 b 17 88 32 91 23 88 b 4 95 10 88 8 91 b 0 137 0 101 0 98 b 0 151 0 141 0 145 l 0 199 l 1 202 b 43 224 5 212 5 212 l 73 234 l 73 367 l 73 502 l 74 505 b 85 514 77 509 81 513 "},v79:{x_min:-1.359375,x_max:899.703125,ha:918,o:"m 307 349 b 332 351 315 351 323 351 b 443 340 367 351 408 347 b 741 47 607 306 720 195 b 744 0 743 31 744 16 b 660 -303 744 -90 713 -206 b 28 -755 534 -531 304 -695 b 14 -756 23 -755 19 -756 b -1 -741 4 -756 -1 -750 b 21 -720 -1 -731 1 -728 b 567 -56 337 -601 548 -344 b 568 -11 568 -41 568 -24 b 442 285 568 129 525 233 b 325 319 406 308 367 319 b 93 177 232 319 137 266 b 84 154 91 170 84 155 b 84 154 84 154 84 154 b 88 156 84 154 85 155 b 159 177 110 170 134 177 b 257 134 194 177 231 162 b 294 41 281 108 294 73 b 171 -97 294 -24 246 -90 b 156 -98 166 -97 161 -98 b 6 74 73 -98 6 -22 b 6 80 6 76 6 79 b 307 349 10 223 141 340 m 839 215 b 845 216 841 216 842 216 b 862 213 852 216 860 215 b 899 163 887 206 899 184 b 872 117 899 145 890 127 b 847 111 865 112 856 111 b 808 130 833 111 818 117 b 796 162 800 140 796 151 b 839 215 796 187 812 212 m 839 -112 b 845 -112 841 -112 842 -112 b 862 -115 852 -112 860 -113 b 899 -165 887 -122 899 -144 b 872 -210 899 -183 890 -201 b 847 -217 865 -215 856 -217 b 808 -198 833 -217 818 -210 b 796 -165 800 -188 796 -177 b 839 -112 796 -140 812 -116 "},v7a:{x_min:-1.359375,x_max:386.5625,ha:394,o:"m 249 535 b 257 537 251 537 253 537 b 276 524 266 537 273 533 l 277 521 l 279 419 l 279 316 l 304 323 b 337 328 319 326 330 328 b 353 316 347 328 349 324 b 355 266 355 315 355 290 b 353 215 355 241 355 217 b 319 198 349 206 347 205 b 279 187 284 190 279 188 b 279 156 279 187 279 174 b 279 136 279 151 279 144 l 279 84 l 289 87 l 330 98 b 367 105 352 102 362 105 b 378 101 372 105 375 104 b 386 61 385 95 386 94 b 386 40 386 55 386 48 l 386 -5 l 385 -8 b 374 -19 383 -12 378 -18 b 291 -40 372 -19 347 -26 b 279 -43 284 -41 279 -43 b 279 -83 279 -43 279 -59 b 279 -95 279 -87 279 -91 l 279 -145 l 304 -140 b 337 -133 321 -136 330 -133 b 349 -140 343 -133 347 -136 b 355 -181 355 -145 355 -142 l 355 -197 l 355 -210 b 349 -252 355 -249 355 -247 b 300 -269 345 -258 347 -258 b 280 -274 291 -272 281 -273 l 279 -274 l 277 -378 l 277 -483 l 276 -487 b 257 -499 273 -495 265 -499 b 238 -487 249 -499 242 -495 l 236 -483 l 236 -384 l 236 -285 l 235 -285 l 212 -291 l 170 -301 b 148 -308 159 -305 148 -306 b 147 -415 147 -308 147 -313 l 147 -523 l 145 -526 b 126 -538 141 -534 133 -538 b 106 -526 118 -538 110 -534 l 104 -523 l 104 -420 b 103 -317 104 -326 104 -317 b 103 -317 103 -317 103 -317 b 50 -330 92 -322 54 -330 b 31 -317 42 -330 35 -326 b 29 -267 29 -315 29 -315 l 29 -219 l 32 -216 b 92 -192 36 -206 36 -206 l 104 -190 l 104 -138 b 103 -87 104 -91 104 -87 b 103 -87 103 -87 103 -87 b 88 -91 103 -87 96 -88 l 49 -101 b 17 -106 32 -105 23 -106 b 6 -102 13 -106 10 -105 b -1 -62 0 -97 -1 -95 b 0 -41 -1 -56 0 -49 l 0 4 l 1 6 b 10 16 2 11 6 15 b 91 37 12 18 38 24 l 104 41 l 104 93 b 103 144 104 140 104 144 b 103 144 103 144 103 144 b 50 131 92 141 54 131 b 31 144 42 131 35 137 b 29 195 29 147 29 148 l 29 242 l 32 245 b 92 269 36 255 36 255 l 104 273 l 104 377 l 104 481 l 106 485 b 126 498 110 492 118 498 b 134 495 129 498 132 496 b 145 485 138 494 142 489 l 147 481 l 147 383 l 147 283 l 152 284 b 190 294 155 285 171 290 l 230 303 l 236 305 l 236 413 l 236 521 l 238 524 b 249 535 240 528 243 533 m 236 126 b 235 177 236 154 236 177 l 235 177 b 213 172 235 177 225 174 l 170 161 b 147 155 157 158 147 155 b 147 124 147 155 147 142 b 147 102 147 117 147 111 l 147 52 l 153 54 l 228 72 l 236 74 l 236 126 m 236 -105 b 235 -54 236 -65 236 -54 l 235 -54 b 231 -55 235 -54 234 -54 b 172 -69 227 -55 204 -62 l 149 -76 l 147 -76 l 147 -127 l 147 -179 l 152 -177 b 190 -167 155 -177 171 -173 l 230 -158 l 236 -156 l 236 -105 "},v7c:{x_min:0,x_max:300.8125,ha:307,o:"m 49 505 b 53 506 50 505 51 506 b 70 496 58 506 62 503 b 81 485 73 492 78 488 l 96 473 l 111 459 l 122 449 l 134 438 l 182 396 l 255 330 b 292 291 292 298 292 298 l 292 290 l 292 284 l 283 270 b 209 36 234 197 209 113 b 288 -170 209 -44 235 -119 b 299 -184 295 -179 299 -181 b 300 -191 300 -187 300 -188 b 285 -206 300 -199 294 -206 b 280 -206 283 -206 281 -206 b 247 -201 270 -202 259 -201 b 176 -222 223 -201 197 -208 b 114 -340 136 -249 114 -292 b 172 -471 114 -384 134 -433 b 185 -492 182 -481 185 -487 b 181 -502 185 -496 183 -499 b 171 -508 176 -505 174 -508 b 152 -498 166 -508 160 -503 b 0 -284 65 -428 12 -352 b 0 -260 0 -278 0 -270 b 1 -238 0 -252 0 -242 b 148 -140 16 -177 73 -140 b 209 -148 167 -140 189 -142 b 215 -149 212 -148 215 -149 b 215 -149 215 -149 215 -149 l 215 -149 b 201 -136 215 -148 209 -142 l 157 -97 l 96 -41 b 17 34 21 24 17 29 b 17 37 17 36 17 36 b 17 38 17 37 17 38 b 25 56 17 44 17 44 b 110 298 81 131 110 219 b 46 474 110 367 88 431 b 38 491 40 480 38 487 b 49 505 38 498 42 502 "},v7d:{x_min:-1.359375,x_max:436.921875,ha:446,o:"m 213 205 b 217 205 215 205 216 205 b 234 194 224 205 234 199 b 236 187 234 194 235 190 l 245 167 l 261 129 l 270 106 b 355 -61 294 54 329 -13 b 420 -163 381 -105 402 -138 b 436 -188 435 -184 436 -184 b 436 -191 436 -190 436 -190 b 421 -206 436 -201 431 -206 l 421 -206 l 416 -206 l 405 -201 b 217 -158 347 -172 283 -158 b 31 -201 153 -158 88 -172 l 20 -206 l 14 -206 l 14 -206 b 0 -191 5 -206 0 -201 b -1 -188 0 -190 -1 -190 b 14 -163 -1 -186 0 -184 b 95 -34 36 -136 72 -77 b 166 106 119 8 148 68 l 175 129 l 183 148 l 200 188 b 213 205 205 199 208 202 "},v7f:{x_min:0,x_max:367.5,ha:375,o:"m 0 124 l 0 187 l 61 187 l 122 187 l 122 138 l 122 91 l 153 61 l 183 30 l 213 61 l 243 91 l 243 138 l 243 187 l 306 187 l 367 187 l 367 124 l 367 61 l 321 61 l 274 61 l 243 30 l 213 0 l 243 -31 l 274 -62 l 321 -62 l 367 -62 l 367 -124 l 367 -188 l 306 -188 l 243 -188 l 243 -140 l 243 -93 l 213 -62 l 183 -31 l 153 -62 l 122 -93 l 122 -140 l 122 -188 l 61 -188 l 0 -188 l 0 -124 l 0 -62 l 46 -62 l 92 -62 l 123 -31 l 153 0 l 123 30 l 92 61 l 46 61 l 0 61 l 0 124 "},v80:{x_min:29.9375,x_max:420.578125,ha:371,o:"m 115 345 b 221 347 117 345 166 347 b 411 345 306 347 409 345 b 420 330 416 342 420 335 b 415 319 420 326 419 321 b 178 118 397 303 179 118 b 178 117 178 118 178 117 b 181 117 178 117 178 117 b 189 117 182 117 185 117 b 193 117 190 117 191 117 b 247 98 215 117 232 111 b 296 75 266 83 280 76 b 302 75 299 75 300 75 b 322 91 311 75 315 79 b 322 91 322 91 322 91 b 322 91 322 91 322 91 b 319 91 322 91 321 91 b 313 90 318 90 315 90 b 283 107 300 90 288 97 b 277 126 279 114 277 121 b 319 167 277 149 295 167 b 319 167 319 167 319 167 b 362 118 347 167 362 147 b 355 82 362 108 359 96 b 311 33 349 65 340 55 b 224 1 284 12 253 1 b 194 5 213 1 204 2 b 168 18 183 8 178 11 b 110 36 151 30 130 36 b 57 15 88 36 68 29 b 47 11 54 12 51 11 b 31 20 40 11 34 13 b 29 26 31 22 29 25 b 68 66 29 36 39 45 b 285 250 73 71 281 248 b 285 250 285 250 285 250 b 231 252 285 252 261 252 b 137 250 190 252 141 250 b 93 227 122 248 110 241 b 78 220 88 222 83 220 b 66 227 74 220 70 222 b 63 234 65 229 63 231 b 85 291 63 241 69 252 b 115 345 108 342 108 344 "},v81:{x_min:0,x_max:428.75,ha:438,o:"m 262 186 b 273 186 266 186 272 186 b 274 186 273 186 274 186 b 285 186 274 186 280 186 b 428 48 375 181 428 122 b 386 -68 428 12 416 -29 b 155 -187 329 -145 236 -187 b 12 -111 92 -187 38 -162 b 0 -51 4 -91 0 -72 b 262 186 0 58 122 179 m 366 131 b 352 134 362 133 357 134 b 219 81 321 134 269 115 b 47 -111 126 23 50 -62 b 47 -112 47 -111 47 -112 b 77 -136 47 -129 58 -136 b 264 -45 118 -136 194 -101 b 382 109 336 12 382 76 b 366 131 382 120 377 129 "},v83:{x_min:-1.359375,x_max:847.96875,ha:865,o:"m 488 1499 b 495 1500 490 1500 492 1500 b 541 1465 507 1500 521 1490 b 679 1078 622 1372 679 1210 b 677 1050 679 1068 677 1060 b 477 642 668 893 604 764 l 443 609 l 431 596 l 431 592 l 438 562 l 449 508 l 460 458 b 481 355 475 390 481 355 b 481 355 481 355 481 355 b 490 356 481 355 485 355 b 528 358 495 356 511 358 b 558 356 540 358 552 356 b 839 95 699 338 808 237 b 847 22 845 72 847 47 b 631 -303 847 -113 766 -242 b 620 -309 623 -308 620 -309 l 620 -310 b 631 -359 620 -310 626 -333 l 646 -435 l 660 -496 b 672 -588 668 -535 672 -563 b 664 -653 672 -610 669 -630 b 383 -875 630 -792 509 -875 b 201 -810 321 -875 257 -855 b 129 -680 151 -768 129 -730 b 274 -530 129 -592 200 -530 b 351 -553 300 -530 326 -538 b 412 -669 393 -582 412 -626 b 287 -805 412 -735 366 -800 l 279 -805 l 285 -809 b 383 -830 318 -823 351 -830 b 586 -718 464 -830 540 -789 b 626 -584 612 -678 626 -631 b 619 -528 626 -566 623 -548 b 612 -495 619 -526 616 -510 b 577 -324 590 -387 577 -324 b 577 -324 577 -324 577 -324 b 568 -326 575 -324 571 -324 b 528 -334 558 -328 537 -333 b 465 -338 506 -337 485 -338 b 24 -11 269 -338 87 -206 b -1 145 8 41 -1 93 b 96 442 -1 249 32 351 b 322 714 166 541 236 626 l 352 745 l 345 782 l 332 843 l 315 921 b 303 984 310 950 304 978 b 295 1082 298 1017 295 1049 b 413 1426 295 1208 336 1329 b 488 1499 436 1456 477 1496 m 549 1301 b 541 1301 547 1301 544 1301 b 411 1207 500 1301 447 1263 b 355 1004 374 1152 355 1079 b 359 942 355 984 356 963 b 371 881 362 927 363 917 l 385 818 b 392 782 389 799 392 784 l 392 782 b 434 828 393 782 424 816 b 607 1165 534 941 594 1060 b 608 1193 608 1175 608 1183 b 597 1270 608 1224 604 1254 b 549 1301 589 1286 571 1299 m 398 528 b 393 555 396 542 393 553 b 392 555 393 555 393 555 b 317 470 390 555 347 505 b 190 298 266 408 212 334 b 127 70 148 227 127 148 b 155 -77 127 19 137 -30 b 468 -303 209 -216 333 -303 b 519 -299 484 -303 502 -302 b 568 -284 541 -295 568 -287 l 568 -284 b 563 -263 568 -284 566 -274 l 534 -120 l 511 -13 l 496 61 l 480 133 b 469 187 472 176 469 187 b 468 188 469 187 469 188 b 416 162 462 188 430 172 b 337 13 364 126 337 69 b 413 -124 337 -40 363 -93 b 428 -144 424 -131 428 -137 b 428 -149 428 -145 428 -148 b 409 -166 426 -161 419 -166 b 394 -162 405 -166 400 -165 b 240 77 302 -122 240 -27 l 240 77 b 430 342 240 197 315 301 l 436 344 l 426 394 l 398 528 m 548 194 b 526 195 540 195 532 195 b 519 195 524 195 521 195 l 514 195 l 518 177 l 539 79 l 552 15 l 566 -48 l 594 -187 l 605 -240 b 612 -266 609 -254 611 -266 b 612 -266 612 -266 612 -266 b 641 -248 613 -266 630 -256 b 744 -98 692 -212 730 -156 b 751 -40 749 -79 751 -59 b 548 194 751 76 665 181 "},v84:{x_min:25.859375,x_max:164.6875,ha:168,o:"m 34 369 b 40 370 35 370 38 370 b 59 353 49 370 50 367 b 164 40 122 254 155 158 b 164 0 164 33 164 16 b 164 -40 164 -16 164 -34 b 59 -353 155 -158 122 -254 b 40 -371 53 -366 47 -371 b 34 -370 38 -371 36 -370 b 25 -358 28 -367 25 -363 b 31 -337 25 -352 27 -347 b 92 0 72 -234 92 -117 b 31 335 92 116 72 233 b 25 356 27 345 25 352 b 34 369 25 363 28 366 "},v86:{x_min:-571.671875,x_max:570.3125,ha:582,o:"m -386 173 b -381 174 -385 174 -383 174 b -370 173 -377 174 -372 173 b -281 86 -367 172 -347 151 b -196 0 -235 37 -196 0 b -126 84 -196 0 -164 37 b -50 174 -55 173 -57 172 b -44 174 -49 174 -47 174 b -35 173 -42 174 -38 173 b 53 86 -32 172 -12 151 b 138 0 100 37 138 0 b 208 84 140 0 170 37 b 284 174 279 173 277 172 b 289 174 285 174 288 174 b 299 173 294 174 298 173 b 462 11 303 172 338 134 l 475 -1 l 503 34 b 541 76 534 72 536 74 b 548 77 544 77 545 77 b 570 56 560 77 570 68 b 567 48 570 54 568 51 b 392 -172 564 41 397 -166 b 378 -176 387 -174 382 -176 b 368 -174 374 -176 371 -176 b 280 -87 367 -173 345 -152 b 194 0 234 -38 194 0 b 125 -86 194 0 163 -38 b 49 -174 54 -174 55 -173 b 43 -176 47 -176 46 -176 b 34 -174 40 -176 36 -174 b -54 -87 31 -173 10 -152 b -140 0 -102 -38 -140 0 b -209 -86 -141 0 -171 -38 b -285 -174 -280 -174 -279 -173 b -291 -176 -287 -176 -289 -176 b -300 -174 -295 -176 -299 -174 b -464 -12 -304 -173 -340 -137 l -476 0 l -504 -34 b -543 -77 -534 -73 -537 -76 b -549 -79 -545 -79 -547 -79 b -571 -58 -562 -79 -571 -69 b -568 -49 -571 -55 -570 -52 b -392 172 -566 -43 -396 167 b -386 173 -390 172 -387 173 "},v8a:{x_min:-170.140625,x_max:168.78125,ha:172,o:"m -160 567 b -122 567 -159 567 -149 567 l -87 567 l -84 566 b -74 553 -78 563 -77 560 b -20 366 -73 551 -49 466 b 31 186 8 267 31 186 b 85 371 31 186 55 269 b 140 559 114 473 138 557 b 153 567 141 564 148 567 b 168 559 159 567 166 564 b 168 555 168 557 168 557 b 92 281 168 548 159 513 b 14 13 50 134 14 13 b 0 0 14 6 6 0 b -17 15 -8 0 -17 8 b -93 283 -17 15 -51 136 b -170 552 -166 533 -170 548 b -170 553 -170 552 -170 552 b -160 567 -170 560 -167 564 "},v8b:{x_min:0,x_max:319.859375,ha:326,o:"m 149 508 b 159 509 152 509 155 509 b 186 494 170 509 181 503 b 190 440 190 487 190 488 l 190 430 l 190 377 l 242 377 l 251 377 b 303 373 298 377 296 377 b 319 345 314 367 319 356 b 304 319 319 335 314 324 b 250 315 296 315 299 315 l 242 315 l 190 315 l 190 262 l 190 252 b 186 198 190 204 190 205 b 159 183 179 188 170 183 b 132 198 148 183 138 188 b 127 252 127 205 127 204 l 127 262 l 127 315 l 76 315 l 68 315 b 14 319 20 315 21 315 b 0 347 4 324 0 335 b 14 373 0 356 4 367 b 68 377 21 377 20 377 l 76 377 l 127 377 l 127 430 l 127 440 b 132 494 127 488 127 487 b 149 508 136 501 142 505 "},v8c:{x_min:-330.75,x_max:329.390625,ha:336,o:"m -133 483 b -117 484 -127 484 -122 484 b 31 373 -51 484 9 440 b 35 348 34 365 35 356 b -25 285 35 313 10 285 b -87 331 -55 285 -76 302 b -167 402 -100 376 -133 402 b -191 398 -175 402 -183 401 b -227 341 -215 388 -227 369 b -225 320 -227 334 -227 327 b -13 74 -209 230 -125 133 b 6 65 -4 70 5 66 l 9 63 l 10 65 b 117 231 12 68 40 112 l 189 341 l 242 424 b 268 460 262 456 264 458 b 283 464 273 463 277 464 b 308 438 296 464 308 453 l 308 437 b 287 396 308 430 308 428 l 95 98 l 59 43 l 58 41 l 65 37 b 253 -156 151 -8 217 -77 b 281 -285 272 -199 281 -244 b 148 -481 281 -381 231 -463 b 115 -485 137 -484 126 -485 b -32 -376 51 -485 -9 -442 b -36 -349 -35 -366 -36 -358 b 25 -287 -36 -315 -12 -287 b 85 -333 54 -287 74 -302 b 166 -403 99 -377 133 -403 b 190 -399 174 -403 182 -402 b 225 -342 215 -390 225 -370 b 224 -322 225 -335 225 -328 b 12 -76 208 -231 125 -134 b -8 -66 2 -72 -6 -68 l -10 -65 l -12 -66 b -118 -231 -13 -68 -42 -113 l -190 -342 l -243 -426 b -269 -462 -264 -458 -265 -458 b -284 -466 -274 -464 -279 -466 b -310 -440 -298 -466 -310 -455 l -310 -438 b -288 -398 -310 -430 -308 -430 l -96 -99 l -59 -44 l -59 -43 l -66 -38 b -281 284 -198 33 -281 158 l -281 284 b -133 483 -281 392 -220 474 m 254 177 b 266 179 258 177 262 179 b 319 149 287 179 307 167 b 329 115 326 140 329 127 b 319 79 329 102 326 90 b 268 51 307 61 287 51 b 221 72 250 51 234 58 b 205 115 210 84 205 99 b 254 177 205 142 223 170 m -281 -54 b -269 -52 -277 -52 -273 -52 b -223 -73 -253 -52 -235 -59 b -206 -116 -212 -84 -206 -101 b -216 -151 -206 -129 -209 -141 b -269 -179 -228 -170 -249 -179 b -314 -159 -285 -179 -302 -173 b -330 -116 -325 -147 -330 -131 b -281 -54 -330 -88 -313 -61 "},v8d:{x_min:-1.359375,x_max:255.890625,ha:261,o:"m 118 514 b 127 517 121 517 122 517 b 147 505 136 517 142 513 l 148 502 l 148 403 b 148 306 148 351 148 306 b 174 315 149 306 160 310 l 200 324 l 205 323 b 223 312 213 323 220 319 l 225 308 l 225 260 b 225 245 225 255 225 249 b 220 204 225 208 224 209 b 179 188 216 199 215 199 l 148 177 l 148 124 l 148 70 l 189 84 b 236 98 219 94 230 98 b 247 94 240 98 243 97 b 255 52 254 88 255 87 b 255 33 255 47 255 40 l 254 -12 l 253 -15 b 249 -22 253 -18 250 -20 l 245 -24 l 196 -41 l 148 -58 l 148 -108 b 148 -158 148 -136 148 -158 b 174 -148 148 -158 160 -154 b 204 -140 198 -140 200 -140 l 204 -140 b 224 -152 213 -140 221 -145 b 225 -201 224 -155 225 -177 b 224 -254 225 -226 224 -251 b 157 -284 220 -262 220 -262 l 148 -288 l 148 -395 l 148 -503 l 147 -506 b 127 -519 142 -514 134 -519 b 107 -506 119 -519 111 -514 l 106 -503 l 106 -403 b 106 -303 106 -316 106 -303 b 104 -303 104 -303 104 -303 b 88 -310 104 -303 96 -306 l 63 -319 b 51 -322 59 -320 55 -322 b 36 -315 46 -322 40 -319 b 31 -273 32 -309 31 -312 b 31 -258 31 -269 31 -263 l 31 -210 l 34 -206 b 40 -198 35 -204 38 -199 b 74 -186 42 -197 57 -191 l 106 -173 l 106 -123 b 106 -97 106 -112 106 -104 b 106 -72 106 -76 106 -72 b 104 -72 106 -72 106 -72 b 20 -99 89 -79 23 -99 b 0 -84 10 -99 2 -93 b -1 -37 0 -81 -1 -59 b 0 11 -1 -15 0 9 b 58 40 4 22 2 22 l 106 56 l 106 109 b 106 123 106 115 106 119 b 106 162 106 147 106 162 b 81 155 106 162 93 159 b 50 147 65 149 55 147 b 36 152 43 147 40 148 b 31 194 32 158 31 156 b 31 209 31 198 31 204 l 31 256 l 34 260 b 76 281 38 269 38 269 l 106 292 l 106 396 l 106 502 l 107 505 b 118 514 110 509 114 513 "},v8f:{x_min:-21.78125,x_max:362.0625,ha:369,o:"m 302 1031 b 308 1032 304 1032 307 1032 b 330 1016 318 1032 325 1027 b 362 867 351 970 362 920 b 340 738 362 824 353 780 l 336 727 l 340 717 b 362 591 355 677 362 634 b 257 323 362 496 325 401 b 204 272 243 306 227 290 b 20 56 129 206 66 133 b -1 18 12 44 0 22 b -19 4 -4 9 -12 4 l -21 4 l -21 140 l -21 276 l -12 277 b 167 333 61 288 127 309 b 319 598 262 388 319 491 b 311 664 319 620 317 642 l 310 673 l 304 664 b 204 548 279 620 250 587 b 20 333 129 483 66 409 b -1 292 12 320 0 298 b -19 280 -4 285 -12 280 l -21 280 l -21 416 l -21 552 l -12 553 b 167 609 61 564 127 585 b 319 874 264 666 319 770 b 294 992 319 914 311 954 b 288 1011 288 1004 288 1007 b 302 1031 288 1021 294 1028 "},v90:{x_min:-171.5,x_max:483.1875,ha:493,o:"m -8 631 b -1 632 -6 632 -4 632 b 19 620 8 632 16 628 b 20 495 20 616 20 616 b 20 373 20 427 20 373 b 115 410 20 373 63 390 l 210 448 l 210 531 b 212 620 210 614 210 616 b 231 632 215 628 223 632 b 246 627 236 632 242 631 b 251 541 251 620 251 628 l 251 463 l 315 489 b 387 514 368 509 381 514 b 393 513 390 514 392 514 b 406 494 402 510 406 502 b 397 476 406 487 404 480 b 323 446 396 474 363 462 l 251 417 l 251 283 l 251 148 l 254 151 b 370 199 291 183 332 199 b 415 191 385 199 400 197 b 483 84 458 176 483 134 b 461 0 483 58 476 29 b 332 -142 439 -40 411 -72 l 255 -215 b 231 -229 240 -229 239 -229 b 216 -223 224 -229 220 -227 b 210 -158 210 -217 210 -223 b 210 -120 210 -148 210 -136 l 210 -29 l 205 -34 b 100 -142 182 -65 159 -88 l 23 -215 b -1 -229 9 -229 6 -229 b -19 -217 -9 -229 -16 -224 l -20 -215 l -21 48 l -21 310 l -83 287 b -152 262 -133 266 -145 262 b -157 263 -153 262 -155 262 b -171 283 -166 266 -171 274 b -161 301 -171 290 -167 297 b -91 328 -160 302 -129 315 l -21 356 l -21 487 l -20 617 l -19 621 b -8 631 -17 626 -12 630 m 210 288 b 210 401 210 351 210 401 b 114 365 209 401 167 384 l 20 327 l 20 238 l 20 148 l 21 151 b 140 199 59 183 102 199 b 206 180 164 199 187 192 l 209 177 b 209 177 209 177 209 177 b 210 288 210 177 210 199 m 110 131 b 96 133 106 133 100 133 b 89 133 93 133 91 133 b 24 87 63 129 40 113 l 20 80 l 20 -37 l 20 -156 l 23 -152 b 144 81 96 -72 144 20 l 144 83 b 110 131 144 113 134 126 m 341 131 b 328 133 337 133 332 133 b 322 133 326 133 323 133 b 257 87 296 129 273 113 l 251 80 l 251 -37 l 251 -156 l 255 -152 b 375 81 328 -72 375 20 l 375 83 b 341 131 375 113 367 126 "},v92:{x_min:0,x_max:598.890625,ha:611,o:"m 62 181 b 77 183 66 183 72 183 b 91 181 83 183 88 183 b 202 131 100 180 106 177 l 299 87 l 394 131 b 517 183 499 181 502 183 b 519 183 517 183 518 183 b 598 104 567 183 598 144 b 577 49 598 84 592 65 b 518 15 567 38 563 37 b 484 0 499 6 484 0 b 518 -16 484 -1 499 -8 b 577 -51 563 -38 567 -40 b 598 -105 592 -66 598 -86 b 519 -184 598 -145 567 -184 b 517 -184 518 -184 517 -184 b 394 -133 502 -184 499 -183 l 299 -88 l 202 -133 b 81 -184 99 -183 95 -184 b 77 -184 80 -184 78 -184 b 0 -105 29 -184 0 -145 b 20 -51 0 -86 5 -66 b 80 -16 29 -40 34 -38 b 114 -1 98 -8 114 -1 b 80 15 114 0 98 6 b 20 49 34 37 29 38 b 0 104 6 65 0 84 b 62 181 0 140 23 174 m 88 134 b 74 136 85 134 80 136 b 68 134 72 136 69 136 b 46 104 54 130 46 117 b 55 81 46 95 49 88 b 149 34 59 76 53 80 b 224 -1 190 15 224 0 b 144 -38 224 -1 187 -18 b 54 -84 59 -79 58 -79 b 46 -105 49 -90 46 -98 b 76 -137 46 -122 58 -137 b 78 -137 77 -137 77 -137 b 194 -86 87 -137 76 -141 b 298 -36 250 -58 298 -36 b 298 -36 298 -36 298 -36 b 402 -84 299 -36 345 -58 b 518 -137 522 -141 510 -137 b 521 -137 519 -137 519 -137 b 551 -105 539 -137 551 -122 b 541 -83 551 -98 548 -90 b 447 -36 537 -77 544 -81 b 374 -1 406 -16 374 -1 b 447 34 374 0 406 15 b 541 81 544 80 537 76 b 551 104 548 88 551 97 b 521 136 551 120 539 136 b 518 136 519 136 519 136 b 517 136 518 136 517 136 l 517 136 b 402 83 511 136 511 136 b 298 34 345 56 299 34 b 298 34 298 34 298 34 b 194 84 298 34 250 56 b 88 134 137 111 89 133 "},v93:{x_min:0,x_max:438.28125,ha:447,o:"m 212 205 b 219 205 213 205 216 205 b 239 183 228 205 231 204 b 421 -163 298 40 363 -83 b 438 -191 434 -180 438 -186 b 436 -197 438 -192 438 -195 b 424 -206 434 -204 431 -206 b 406 -201 420 -206 415 -205 b 216 -156 347 -172 281 -156 b 23 -205 148 -156 80 -173 b 14 -206 20 -206 17 -206 b 0 -191 6 -206 0 -201 b 6 -176 0 -187 1 -183 b 202 192 63 -104 142 45 b 212 205 205 199 208 202 m 264 48 l 249 81 l 243 94 l 242 91 b 89 -126 208 36 137 -66 b 81 -138 85 -133 81 -138 b 81 -138 81 -138 81 -138 b 81 -138 81 -138 81 -138 b 95 -133 81 -138 87 -136 b 280 -94 156 -108 221 -94 b 334 -98 299 -94 317 -95 b 343 -99 338 -99 343 -99 b 343 -99 343 -99 343 -99 b 338 -94 343 -99 341 -97 b 264 48 318 -58 287 1 "},v94:{x_min:-149.71875,x_max:148.359375,ha:151,o:"m -9 215 b 0 217 -6 217 -4 217 b 19 205 8 217 14 213 b 20 142 20 202 20 201 l 20 84 l 23 84 b 144 -27 81 74 129 30 b 148 -66 147 -40 148 -54 b 36 -213 148 -134 103 -197 b 0 -219 24 -217 12 -219 b -145 -104 -68 -219 -129 -173 b -149 -68 -148 -91 -149 -79 b -24 84 -149 6 -98 74 l -21 84 l -21 142 b -19 205 -20 201 -20 202 b -9 215 -17 209 -13 213 m -21 -15 b -23 41 -21 37 -21 41 b -23 41 -23 41 -23 41 b -76 11 -35 40 -62 26 b -108 -65 -98 -11 -108 -38 b -1 -176 -108 -122 -65 -176 b 107 -65 63 -176 107 -122 b 74 11 107 -38 96 -11 b 20 41 61 26 32 41 b 20 -15 20 41 20 15 b 19 -74 20 -72 20 -72 b 0 -87 14 -83 6 -87 b -19 -74 -8 -87 -16 -83 b -21 -15 -20 -72 -20 -72 "},v95:{x_min:0,x_max:406.96875,ha:415,o:"m 55 181 b 70 183 61 183 66 183 b 111 170 85 183 99 179 b 160 130 115 167 137 149 l 202 95 l 245 130 b 319 181 299 176 302 179 b 334 183 325 183 330 183 b 406 109 375 183 406 148 b 401 81 406 99 405 91 b 348 24 394 65 390 59 b 318 -1 332 11 318 0 b 348 -26 318 -1 332 -12 b 401 -83 390 -61 394 -66 b 406 -111 405 -93 406 -101 b 334 -184 406 -149 375 -184 b 319 -183 330 -184 325 -184 b 245 -131 302 -180 299 -177 l 202 -97 l 160 -131 b 85 -183 107 -177 103 -180 b 70 -184 80 -184 76 -184 b 0 -111 31 -184 0 -149 b 4 -83 0 -101 1 -93 b 58 -26 10 -66 16 -61 b 88 -1 74 -12 88 -1 b 58 24 88 0 74 11 b 10 69 23 54 17 59 b 0 109 2 81 0 95 b 55 181 0 142 21 173 m 83 133 b 72 136 78 136 76 136 b 57 131 66 136 61 134 b 46 109 49 126 46 117 b 50 93 46 104 47 98 b 107 45 51 91 77 70 b 160 0 137 20 160 0 b 107 -47 160 -1 137 -22 b 50 -94 77 -72 51 -93 b 46 -111 47 -99 46 -105 b 59 -134 46 -120 50 -130 b 72 -137 62 -136 68 -137 b 83 -136 76 -137 80 -136 b 144 -84 84 -134 107 -116 b 202 -36 176 -58 202 -36 b 261 -84 202 -36 230 -58 b 323 -136 299 -116 321 -134 b 334 -137 326 -136 330 -137 b 345 -134 338 -137 343 -136 b 360 -111 355 -130 360 -120 b 355 -94 360 -105 359 -99 b 299 -47 353 -93 329 -72 b 245 0 269 -22 245 -1 b 299 45 245 0 269 20 b 355 93 329 70 353 91 b 360 109 359 98 360 104 b 345 133 360 119 355 129 b 334 136 343 134 338 136 b 323 134 330 136 326 134 b 261 83 321 133 299 115 b 202 34 230 56 202 34 b 144 83 202 34 176 56 b 83 133 106 115 84 133 "},v97:{x_min:-228.671875,x_max:227.3125,ha:232,o:"m -217 487 l -213 488 l 0 488 l 212 488 l 216 487 b 225 476 220 484 224 480 l 227 473 l 227 244 l 227 15 l 225 12 b 206 0 223 4 215 0 b 197 1 204 0 200 0 b 187 12 193 4 189 6 l 186 15 l 186 138 l 186 262 l -1 262 l -187 262 l -187 138 l -187 15 l -189 12 b -208 0 -193 4 -200 0 b -227 12 -216 0 -223 4 l -228 15 l -228 244 l -228 473 l -227 476 b -217 487 -225 480 -221 484 "},v9a:{x_min:-21.78125,x_max:367.5,ha:375,o:"m 230 1031 b 238 1032 232 1032 235 1032 b 259 1014 245 1032 251 1027 b 367 662 330 906 367 782 b 364 602 367 641 367 621 b 232 317 352 488 304 384 b 57 120 155 245 103 187 b -1 18 31 84 6 40 b -19 4 -4 11 -12 4 l -21 4 l -21 159 l -21 315 l -16 315 b 96 335 10 315 62 324 b 315 695 227 380 315 527 b 313 738 315 709 314 724 b 224 991 304 825 273 916 b 216 1013 219 999 216 1007 b 230 1031 216 1021 220 1028 "},v9b:{x_min:-24.5,x_max:313.0625,ha:319,o:"m -24 -133 l -24 -5 l -20 -5 b -1 -19 -12 -5 -4 -11 b 142 -213 13 -61 74 -144 b 258 -376 196 -269 230 -315 b 313 -605 295 -449 313 -528 b 292 -742 313 -652 306 -699 b 288 -752 289 -748 288 -752 b 288 -752 288 -752 288 -752 b 292 -764 289 -753 291 -757 b 313 -907 306 -811 313 -860 b 292 -1045 313 -954 306 -1002 b 288 -1054 289 -1050 288 -1054 b 288 -1054 288 -1054 288 -1054 b 292 -1067 289 -1054 291 -1060 b 313 -1210 306 -1113 313 -1161 b 292 -1346 313 -1257 306 -1304 b 288 -1357 289 -1353 288 -1357 b 288 -1357 288 -1357 288 -1357 b 292 -1368 289 -1357 291 -1363 b 313 -1512 306 -1415 313 -1464 b 292 -1648 313 -1560 306 -1605 b 288 -1660 289 -1654 288 -1660 b 288 -1660 288 -1660 288 -1660 b 292 -1671 289 -1660 291 -1665 b 313 -1814 306 -1719 313 -1766 b 250 -2040 313 -1897 291 -1977 b 232 -2062 238 -2057 236 -2059 b 221 -2065 230 -2063 225 -2065 b 200 -2045 210 -2065 201 -2057 b 200 -2043 200 -2044 200 -2044 b 208 -2026 200 -2037 202 -2034 b 269 -1826 249 -1966 269 -1897 b 153 -1544 269 -1726 230 -1625 b -9 -1472 115 -1506 58 -1481 b -21 -1471 -14 -1471 -19 -1471 l -24 -1471 l -24 -1343 l -24 -1215 l -20 -1215 b -1 -1229 -12 -1215 -4 -1221 b 142 -1424 13 -1270 74 -1353 b 257 -1582 196 -1478 228 -1524 b 264 -1594 261 -1589 264 -1594 l 264 -1594 b 265 -1582 264 -1594 264 -1589 b 270 -1525 268 -1562 270 -1544 b 153 -1243 270 -1424 228 -1321 b -9 -1170 115 -1203 58 -1178 b -21 -1168 -14 -1170 -19 -1168 l -24 -1168 l -24 -1041 l -24 -913 l -20 -913 b -1 -927 -12 -913 -4 -918 b 142 -1121 13 -967 74 -1050 b 257 -1281 196 -1175 228 -1221 b 264 -1292 261 -1286 264 -1292 l 264 -1292 b 265 -1279 264 -1292 264 -1286 b 270 -1222 268 -1261 270 -1242 b 153 -941 270 -1121 228 -1018 b -9 -867 115 -900 58 -875 b -21 -866 -14 -867 -19 -866 l -24 -866 l -24 -738 l -24 -610 l -20 -610 b -1 -624 -12 -610 -4 -616 b 142 -818 13 -664 74 -749 b 257 -978 196 -873 228 -918 b 264 -989 261 -984 264 -989 l 264 -989 b 265 -977 264 -989 264 -984 b 270 -920 268 -959 270 -939 b 153 -638 270 -818 228 -716 b -9 -564 115 -598 58 -573 b -21 -563 -14 -564 -19 -563 l -24 -563 l -24 -435 l -24 -308 l -20 -308 b -1 -322 -12 -308 -4 -313 b 142 -516 13 -363 74 -446 b 257 -675 196 -571 228 -616 b 264 -687 261 -681 264 -687 l 264 -687 b 265 -674 264 -687 264 -681 b 270 -617 268 -656 270 -637 b 153 -335 270 -516 228 -413 b -9 -262 115 -295 58 -270 b -21 -260 -14 -262 -19 -260 l -24 -260 l -24 -133 "},v9c:{x_min:-166.0625,x_max:-25.859375,ha:0,o:"m -49 369 b -42 370 -46 369 -44 370 b -27 360 -36 370 -29 366 b -25 355 -27 359 -25 358 b -32 335 -25 351 -28 347 b -92 52 -66 248 -87 159 b -93 -1 -93 43 -93 20 b -92 -54 -93 -23 -93 -45 b -32 -337 -85 -162 -66 -251 b -25 -355 -27 -349 -25 -352 b -42 -371 -25 -365 -32 -371 b -61 -353 -50 -371 -51 -369 b -163 -63 -119 -262 -153 -165 b -166 -1 -166 -37 -166 -31 b -163 62 -166 30 -166 36 b -61 352 -153 163 -119 260 b -49 369 -54 365 -51 366 "},v9e:{x_min:0,x_max:607.0625,ha:619,o:"m 243 631 b 250 632 246 632 249 632 b 270 620 259 632 268 628 l 272 616 l 272 201 l 272 -212 l 270 -216 b 251 -229 268 -224 259 -229 b 227 -215 243 -229 240 -229 l 151 -142 b 32 -16 81 -80 53 -49 b 0 84 9 18 0 52 b 111 199 0 149 42 199 b 137 197 119 199 127 198 b 228 151 168 191 197 177 l 231 148 l 231 383 b 232 620 231 616 231 616 b 243 631 234 624 238 630 m 168 131 b 152 133 163 133 157 133 b 107 102 130 133 111 120 b 106 86 107 97 106 91 b 111 41 106 73 108 56 b 227 -152 125 -13 171 -90 l 231 -156 l 231 -37 l 231 80 l 225 87 b 168 131 210 111 190 126 m 347 631 b 353 632 348 632 351 632 b 374 620 363 632 371 628 b 375 383 375 616 375 616 l 375 148 l 377 151 b 492 199 415 183 454 199 b 537 191 507 199 522 197 b 607 84 582 176 607 134 b 583 0 607 58 598 29 b 455 -142 562 -40 533 -72 l 378 -215 b 355 -229 364 -229 362 -229 b 334 -216 345 -229 337 -224 l 333 -212 l 333 201 l 333 616 l 334 620 b 347 631 337 624 341 630 m 465 131 b 451 133 461 133 455 133 b 445 133 449 133 446 133 b 379 87 419 129 396 113 l 375 80 l 375 -37 l 375 -156 l 378 -152 b 499 81 451 -72 499 20 l 499 83 b 465 131 499 113 490 126 "},va3:{x_min:58.53125,x_max:228.671875,ha:294,o:"m 138 371 b 142 373 140 371 141 373 b 178 342 149 373 156 366 b 228 251 217 297 228 278 b 228 244 228 248 228 247 b 176 147 227 212 212 184 b 123 73 152 122 132 93 b 121 62 122 70 121 66 b 145 13 121 48 129 31 b 153 -2 151 6 153 1 b 149 -9 153 -5 152 -6 b 144 -11 148 -11 145 -11 b 129 -1 140 -11 136 -8 b 61 87 89 37 68 68 b 58 113 59 95 58 105 b 110 215 58 144 74 177 b 163 287 134 240 155 269 b 166 299 166 291 166 295 b 141 348 166 313 157 330 b 133 360 134 356 133 358 b 133 363 133 362 133 362 b 138 371 133 367 136 370 "},va5:{x_min:0,x_max:349.8125,ha:357,o:"m 88 302 b 103 303 93 302 98 303 b 202 224 149 303 191 270 b 205 199 204 216 205 208 b 178 129 205 173 196 147 l 175 126 l 182 127 b 307 249 236 142 284 190 b 313 259 308 254 311 258 b 329 267 317 265 323 267 b 349 247 340 267 349 259 b 201 -263 349 242 204 -258 b 182 -273 197 -270 190 -273 b 163 -260 174 -273 166 -269 b 161 -256 161 -259 161 -258 b 217 -59 161 -248 170 -220 b 272 129 247 43 272 127 b 272 129 272 129 272 129 b 264 122 272 129 268 126 b 140 80 227 94 183 80 b 36 115 102 80 65 91 b 0 194 10 136 0 165 b 88 302 0 244 32 292 "},va9:{x_min:-24.5,x_max:314.421875,ha:321,o:"m -24 -145 l -24 -5 l -20 -5 b 0 -23 -9 -5 -2 -12 b 27 -87 4 -38 14 -66 b 138 -220 53 -136 88 -177 b 235 -328 179 -255 208 -288 b 314 -592 287 -409 314 -501 b 292 -732 314 -639 307 -687 l 289 -742 l 294 -756 b 314 -896 307 -802 314 -849 b 292 -1035 314 -943 307 -991 l 289 -1045 l 294 -1057 b 314 -1197 307 -1104 314 -1152 b 292 -1338 314 -1246 307 -1292 l 289 -1347 l 294 -1360 b 314 -1500 307 -1407 314 -1454 b 273 -1689 314 -1565 300 -1628 b 250 -1712 265 -1710 261 -1712 b 228 -1691 236 -1712 228 -1704 l 228 -1685 l 234 -1675 b 270 -1507 258 -1621 270 -1564 b 98 -1193 270 -1381 209 -1261 b 40 -1174 76 -1179 58 -1174 b -10 -1189 24 -1174 8 -1178 b -20 -1192 -14 -1192 -16 -1192 l -24 -1192 l -24 -1052 l -24 -913 l -20 -913 b 0 -931 -9 -913 -2 -920 b 27 -995 4 -946 14 -974 b 138 -1128 53 -1043 88 -1085 b 257 -1275 190 -1172 228 -1220 b 262 -1283 259 -1279 262 -1283 l 262 -1283 b 269 -1249 264 -1282 268 -1260 b 270 -1206 270 -1233 270 -1220 b 98 -891 270 -1075 206 -957 b 40 -871 76 -877 58 -871 b -10 -886 24 -871 8 -875 b -20 -889 -14 -889 -16 -889 l -24 -889 l -24 -749 l -24 -610 l -20 -610 b 0 -628 -9 -610 -2 -617 b 27 -692 4 -644 14 -671 b 138 -825 53 -741 88 -782 b 257 -973 190 -870 228 -917 b 262 -981 259 -977 262 -981 l 262 -981 b 269 -946 264 -979 268 -957 b 270 -903 270 -931 270 -917 b 98 -588 270 -774 206 -655 b 40 -569 76 -574 58 -569 b -10 -584 24 -569 8 -574 b -20 -587 -14 -587 -16 -587 l -24 -587 l -24 -448 l -24 -308 l -20 -308 b 0 -326 -9 -308 -2 -315 b 27 -390 4 -341 14 -369 b 138 -523 53 -438 88 -480 b 257 -670 190 -567 228 -614 b 262 -678 259 -674 262 -678 b 262 -678 262 -678 262 -678 b 269 -644 264 -677 268 -656 b 270 -601 270 -628 270 -614 b 98 -285 270 -471 206 -352 b 40 -266 76 -273 58 -266 b -10 -281 24 -266 8 -272 b -20 -284 -14 -284 -16 -284 l -24 -284 l -24 -145 "},vaa:{x_min:-1.359375,x_max:752.703125,ha:768,o:"m 490 985 b 504 986 495 986 500 986 b 604 907 551 986 593 954 b 607 884 607 900 607 892 b 581 813 607 857 597 831 l 578 810 l 583 811 b 710 932 638 827 687 873 b 714 943 711 936 713 942 b 730 952 720 949 725 952 b 752 931 741 952 752 943 b 200 -946 752 927 204 -941 b 182 -957 197 -953 190 -957 b 163 -945 174 -957 166 -953 b 161 -939 161 -942 161 -942 b 217 -743 161 -931 170 -904 b 272 -555 247 -639 272 -555 b 272 -555 272 -555 272 -555 b 264 -560 272 -555 268 -557 b 140 -603 227 -589 182 -603 b 36 -567 102 -603 65 -592 b -1 -487 12 -548 -1 -517 b 17 -427 -1 -466 5 -445 b 103 -380 38 -395 70 -380 b 191 -433 137 -380 172 -398 b 205 -484 201 -448 205 -466 b 178 -553 205 -509 196 -535 l 175 -557 l 182 -555 b 307 -435 236 -539 284 -494 b 372 -213 308 -430 372 -215 b 372 -213 372 -213 372 -213 b 364 -219 372 -213 368 -216 b 240 -262 328 -247 283 -262 b 137 -226 202 -262 166 -249 b 99 -145 112 -206 99 -176 b 118 -84 99 -124 106 -104 b 204 -38 138 -54 171 -38 b 292 -91 238 -38 273 -56 b 306 -141 302 -106 306 -124 b 279 -212 306 -167 296 -194 l 276 -215 l 281 -213 b 408 -93 336 -198 385 -151 b 473 129 409 -88 473 127 b 473 129 473 129 473 129 b 465 122 473 129 469 126 b 341 80 428 94 383 80 b 236 115 303 80 266 91 b 200 195 213 136 200 165 b 217 256 200 217 206 238 b 304 303 239 287 272 303 b 393 249 338 303 374 285 b 406 199 402 234 406 217 b 379 129 406 173 397 148 l 377 126 l 382 127 b 509 248 436 142 485 190 b 574 470 510 254 574 469 b 574 470 574 470 574 470 b 566 464 574 470 570 467 b 442 421 529 435 484 421 b 337 458 404 421 367 433 b 300 538 314 477 300 508 b 318 598 300 559 306 580 b 404 645 340 630 372 645 b 494 592 439 645 475 627 b 507 541 502 577 507 559 b 480 471 507 516 498 489 l 477 467 l 483 470 b 608 589 537 485 586 531 b 675 811 611 595 675 810 b 675 811 675 811 675 811 b 666 806 675 811 671 809 b 543 763 628 777 585 763 b 438 799 504 763 468 775 b 401 878 412 820 401 849 b 490 985 401 928 434 977 "},vab:{x_min:0,x_max:272.21875,ha:278,o:"m 243 631 b 250 632 246 632 249 632 b 270 620 259 632 268 628 l 272 616 l 272 201 l 272 -212 l 270 -216 b 251 -229 268 -224 259 -229 b 227 -215 243 -229 240 -229 l 151 -142 b 32 -16 81 -80 53 -49 b 0 84 9 18 0 52 b 111 199 0 149 42 199 b 137 197 119 199 127 198 b 228 151 168 191 197 177 l 231 148 l 231 383 b 232 620 231 616 231 616 b 243 631 234 624 238 630 m 168 131 b 152 133 163 133 157 133 b 107 102 130 133 111 120 b 106 86 107 97 106 91 b 111 41 106 73 108 56 b 227 -152 125 -13 171 -90 l 231 -156 l 231 -37 l 231 80 l 225 87 b 168 131 210 111 190 126 "},vad:{x_min:0,x_max:873.828125,ha:892,o:"m 0 0 l 0 703 l 81 703 l 164 703 l 164 0 l 164 -705 l 81 -705 l 0 -705 l 0 0 m 225 0 l 225 703 l 246 703 l 268 703 l 268 366 l 268 30 l 274 36 b 314 79 284 44 302 63 b 413 302 357 137 392 213 b 432 327 419 324 421 327 b 449 306 443 327 447 322 b 611 115 457 195 529 115 b 651 122 624 115 638 117 b 728 316 705 140 724 188 b 729 388 728 342 729 366 b 671 635 729 533 711 602 b 581 662 649 652 616 662 b 477 637 545 662 510 653 l 475 635 l 477 634 b 503 627 488 632 495 631 b 545 556 532 612 545 584 b 491 480 545 524 526 491 b 465 474 481 476 473 474 b 379 563 417 474 379 516 b 389 602 379 576 382 588 b 541 691 409 641 479 681 b 582 694 555 692 568 694 b 865 462 714 694 834 598 b 873 392 871 440 873 416 b 865 317 873 367 871 341 b 639 84 839 194 748 101 b 612 83 630 83 620 83 b 511 116 577 83 543 94 b 504 120 509 119 506 120 b 504 120 504 120 504 120 b 469 59 504 120 488 93 l 432 -1 l 469 -61 b 504 -122 488 -94 504 -122 b 504 -122 504 -122 504 -122 b 511 -117 506 -122 509 -120 b 612 -84 543 -95 577 -84 b 665 -91 630 -84 647 -87 b 869 -338 771 -122 850 -216 b 873 -392 872 -356 873 -374 b 798 -595 873 -469 847 -539 b 581 -695 741 -662 660 -695 b 406 -626 517 -695 454 -671 b 381 -563 389 -607 381 -585 b 465 -477 381 -519 413 -477 b 545 -559 514 -477 545 -519 b 503 -628 545 -587 532 -613 b 477 -635 495 -632 488 -634 l 475 -637 l 477 -638 b 581 -663 510 -655 545 -663 b 671 -637 616 -663 649 -653 b 729 -391 711 -603 729 -534 b 728 -317 729 -367 728 -344 b 623 -117 722 -173 698 -124 b 611 -116 619 -116 615 -116 b 449 -308 528 -116 457 -198 b 432 -328 447 -323 443 -328 b 413 -303 421 -328 419 -326 b 314 -80 392 -215 357 -138 b 274 -37 302 -65 284 -45 l 268 -31 l 268 -367 l 268 -705 l 246 -705 l 225 -705 l 225 0 "},vb1:{x_min:78.9375,x_max:485.921875,ha:417,o:"m 362 378 b 378 380 367 380 372 380 b 472 348 415 380 453 367 b 485 315 481 338 485 327 b 462 273 485 298 477 281 b 439 267 454 269 446 267 b 398 290 424 267 409 274 b 344 319 385 309 364 319 b 281 269 315 319 289 301 b 279 262 280 266 279 262 b 276 256 279 260 277 258 b 274 249 276 254 274 251 b 238 127 273 248 257 192 b 201 4 217 61 201 5 b 166 -1 198 -1 200 -1 b 153 -1 163 -1 157 -1 b 141 -1 148 -1 144 -1 b 104 4 106 -1 107 -1 b 104 6 104 5 104 5 b 142 144 104 13 110 34 b 182 278 164 219 181 276 b 183 288 182 281 182 285 b 185 302 185 292 185 298 b 164 330 185 317 176 328 b 159 330 163 330 161 330 b 102 302 140 330 119 320 b 91 294 95 295 93 294 b 88 294 91 294 89 294 b 78 303 83 294 78 298 b 81 312 78 306 78 309 b 200 373 106 347 160 373 b 215 371 205 373 209 371 b 266 335 235 367 254 353 b 269 331 268 333 269 331 b 269 331 269 331 269 331 b 273 335 269 331 270 334 b 362 378 298 359 330 376 "},vb3:{x_min:0,x_max:227.3125,ha:232,o:"m 91 213 b 100 215 93 215 96 215 b 227 58 167 215 224 144 b 227 52 227 56 227 54 b 61 -201 227 -43 164 -138 b 29 -216 44 -212 36 -216 b 23 -210 27 -216 24 -213 b 21 -205 21 -208 21 -206 b 34 -192 21 -201 25 -197 b 122 -55 89 -161 122 -106 b 104 6 122 -33 117 -12 l 103 9 l 96 9 b 4 79 57 9 17 38 b 0 112 1 90 0 101 b 91 213 0 163 36 209 "},vb4:{x_min:-597.53125,x_max:596.171875,ha:608,o:"m -533 324 b -525 327 -530 326 -528 327 b -504 305 -514 327 -504 317 b -504 305 -504 305 -504 305 b -513 284 -504 299 -504 299 b -556 112 -541 226 -556 167 b -545 33 -556 84 -552 58 b -524 -20 -541 15 -532 -9 l -522 -23 l -491 15 l -413 111 b -355 174 -367 169 -363 174 b -351 174 -353 174 -352 174 b -254 86 -343 174 -348 179 b -168 -1 -208 37 -168 -1 b -100 84 -168 -1 -137 37 b -23 173 -28 173 -29 172 b -19 174 -21 174 -20 174 b -8 173 -14 174 -10 173 b 80 86 -5 172 13 151 b 166 -1 127 37 166 -1 b 235 84 166 -1 197 37 b 311 173 306 173 304 172 b 317 174 313 174 314 174 b 326 173 319 174 323 173 b 490 11 329 172 366 134 l 502 -1 l 530 34 b 568 76 560 72 563 74 b 575 77 570 77 573 77 b 596 56 586 77 596 68 b 594 48 596 54 596 51 b 417 -172 592 41 424 -166 b 405 -176 415 -174 409 -176 b 396 -174 401 -176 398 -176 b 307 -87 393 -173 372 -152 b 221 -1 259 -38 221 -1 b 152 -86 221 -1 190 -38 b 76 -176 81 -174 83 -173 b 70 -176 74 -176 73 -176 b 61 -174 66 -176 62 -174 b -27 -87 58 -173 38 -152 b -114 -1 -74 -38 -112 -1 b -182 -86 -114 -1 -145 -38 b -258 -176 -253 -174 -253 -173 b -264 -176 -259 -176 -262 -176 b -274 -174 -268 -176 -272 -174 b -438 -11 -277 -173 -348 -102 l -449 0 l -479 -37 b -524 -80 -513 -80 -514 -80 l -524 -80 b -553 -52 -534 -80 -540 -74 b -597 109 -583 -8 -597 48 b -560 280 -597 165 -585 224 b -533 324 -548 310 -540 322 "},vb6:{x_min:0,x_max:556.6875,ha:568,o:"m 289 545 b 298 546 292 545 295 546 b 318 533 306 546 315 541 b 319 428 319 530 319 528 l 319 327 l 334 327 b 526 223 412 326 485 285 b 543 172 537 206 543 190 b 447 76 543 122 503 76 b 445 76 446 76 446 76 b 359 165 394 77 359 119 b 368 205 359 179 362 192 b 441 251 382 233 412 251 b 455 249 446 251 451 251 b 460 248 458 249 460 248 b 460 248 460 248 460 248 b 454 254 460 249 458 251 b 334 295 419 280 378 294 l 319 295 l 319 4 l 319 -287 l 321 -285 b 328 -285 322 -285 325 -285 b 524 -99 424 -277 507 -198 b 541 -79 526 -84 530 -79 b 556 -97 551 -79 556 -84 b 548 -133 556 -105 553 -117 b 334 -317 521 -233 434 -306 b 322 -319 329 -317 323 -317 l 319 -319 l 319 -424 b 319 -471 319 -444 319 -459 b 313 -541 319 -544 318 -535 b 298 -548 308 -545 303 -548 b 279 -534 289 -548 281 -542 b 277 -424 277 -531 277 -530 l 277 -317 l 273 -317 b 13 -95 153 -305 51 -217 b 0 2 4 -62 0 -29 b 182 295 0 126 66 238 b 274 324 210 309 249 320 l 277 324 l 277 427 b 279 533 277 528 277 530 b 289 545 281 538 285 542 m 277 2 b 277 291 277 161 277 291 b 268 288 277 291 273 290 b 144 1 179 265 144 184 b 276 -284 144 -199 175 -267 l 277 -285 l 277 2 "},vb7:{x_min:-176.9375,x_max:251.8125,ha:257,o:"m -8 631 b -1 632 -6 632 -4 632 b 19 620 8 632 16 628 b 20 503 20 616 20 614 b 20 391 20 442 20 391 b 84 424 20 391 49 406 l 147 456 l 152 456 b 153 456 153 456 153 456 b 175 435 166 456 175 446 b 172 427 175 433 174 430 b 92 380 170 420 172 421 l 20 342 l 20 245 l 20 148 l 21 151 b 137 199 59 183 99 199 b 182 191 152 199 167 197 b 251 84 227 176 251 134 b 228 0 251 58 243 29 b 100 -142 206 -40 178 -72 l 23 -215 b 0 -229 9 -229 6 -229 b -20 -216 -9 -229 -17 -224 b -21 54 -21 -212 -21 -212 b -21 322 -21 201 -21 322 b -85 290 -21 322 -50 308 l -148 256 l -153 256 b -155 256 -155 256 -155 256 b -176 277 -167 256 -176 266 b -174 285 -176 280 -175 283 b -93 333 -171 294 -174 292 l -21 370 l -21 494 b -20 620 -21 616 -21 616 b -8 631 -17 624 -13 630 m 110 131 b 96 133 106 133 100 133 b 89 133 93 133 91 133 b 24 87 63 129 40 113 l 20 80 l 20 -37 l 20 -156 l 23 -152 b 144 81 96 -72 144 20 l 144 83 b 110 131 144 113 134 126 "},vb9:{x_min:-122.5,x_max:121.140625,ha:124,o:"m -16 145 b 0 147 -10 147 -5 147 b 121 -1 66 147 121 77 b 114 -49 121 -16 118 -33 b -1 -148 95 -112 47 -148 b -85 -106 -31 -148 -61 -134 b -122 -1 -110 -76 -122 -38 b -16 145 -122 68 -81 134 m 12 111 b 0 113 8 113 4 113 b -68 22 -29 113 -61 73 b -70 0 -69 15 -70 6 b -13 -113 -70 -49 -47 -98 b -1 -115 -9 -115 -5 -115 b 63 -40 24 -115 53 -83 b 68 -1 66 -27 68 -15 b 12 111 68 48 46 97 "},vba:{x_min:-118.421875,x_max:597.53125,ha:381,o:"m 460 574 b 464 574 461 574 462 574 b 488 574 470 574 481 574 b 500 573 491 574 498 574 b 594 503 543 570 588 538 b 597 488 596 498 597 494 b 528 417 597 449 564 417 b 502 423 519 417 510 419 b 465 481 477 434 465 458 b 488 528 465 499 472 516 b 490 530 490 530 490 530 b 490 530 490 530 490 530 b 468 517 488 530 475 523 b 349 340 419 485 377 420 b 347 330 348 334 347 330 b 383 328 347 328 363 328 b 428 326 423 328 424 328 b 442 302 438 320 442 312 b 430 281 442 294 438 285 b 385 276 424 277 426 276 l 377 276 l 332 276 l 330 269 b 178 -117 303 126 250 -9 b 1 -249 129 -194 69 -237 b -20 -251 -6 -251 -13 -251 b -114 -187 -65 -251 -100 -227 b -118 -156 -117 -177 -118 -166 b -51 -84 -118 -116 -91 -84 b -31 -87 -46 -84 -39 -86 b 16 -152 0 -95 16 -124 b -12 -205 16 -173 8 -194 b -16 -208 -14 -206 -16 -208 b -14 -208 -16 -208 -14 -208 b -9 -206 -14 -208 -12 -208 b 74 -124 23 -197 54 -166 b 172 224 98 -79 125 22 b 185 276 178 252 183 274 b 185 276 185 276 185 276 b 141 276 185 276 181 276 b 91 280 96 276 96 276 b 77 302 83 285 77 294 b 91 326 77 312 83 320 b 148 328 95 328 96 328 l 198 330 l 202 341 b 460 574 249 473 351 566 "},vbf:{x_min:-53.078125,x_max:513.140625,ha:485,o:"m 185 383 b 196 384 187 383 191 384 b 277 334 230 384 259 365 b 288 301 281 324 288 306 b 288 297 288 298 288 297 b 294 302 289 297 291 299 b 394 370 323 338 367 367 b 404 371 398 370 401 371 b 510 272 453 371 498 328 b 513 237 513 262 513 251 b 507 172 513 217 511 192 b 326 -34 487 59 412 -26 b 314 -36 322 -36 318 -36 b 274 -24 298 -36 283 -31 l 265 -16 b 224 44 246 -1 232 20 b 223 49 224 47 223 49 b 223 49 223 49 223 49 b 149 -197 221 48 149 -194 b 149 -198 149 -197 149 -198 b 170 -210 149 -202 155 -205 b 187 -215 174 -210 175 -212 b 204 -231 201 -219 204 -222 b 197 -245 204 -240 202 -242 l 194 -248 l 76 -248 l -42 -248 l -46 -245 b -53 -231 -51 -242 -53 -240 b -35 -215 -53 -222 -49 -217 b -13 -210 -21 -212 -20 -212 b -6 -208 -10 -209 -8 -208 b 0 -206 -6 -208 -2 -206 b 25 -188 13 -201 21 -195 b 163 280 28 -183 163 276 b 166 291 163 283 164 287 b 167 302 167 295 167 299 b 155 324 167 315 161 324 b 155 324 155 324 155 324 b 65 230 125 322 85 280 b 53 215 61 217 58 215 b 51 215 53 215 51 215 b 42 224 46 215 42 217 b 57 263 42 231 47 244 b 140 360 77 305 104 337 b 152 370 144 365 149 369 b 185 383 157 376 172 381 m 374 306 b 366 308 371 308 368 308 b 300 273 348 308 321 294 b 284 254 288 262 287 259 b 280 242 283 249 281 245 b 257 169 279 240 270 213 l 236 98 l 236 93 b 251 48 238 77 243 61 b 279 27 258 37 272 27 b 281 27 279 27 280 27 b 291 31 281 27 287 30 b 396 170 334 52 378 109 b 406 247 402 197 406 224 b 401 277 406 259 405 270 b 374 306 397 290 383 303 "},vc3:{x_min:-10.890625,x_max:299.4375,ha:294,o:"m 136 460 b 142 462 137 462 140 462 b 166 449 152 462 161 456 b 171 428 168 446 168 445 b 288 131 194 322 238 209 b 298 115 295 120 296 117 b 299 106 298 112 299 109 b 273 81 299 91 287 81 b 255 86 268 81 261 83 b 155 116 225 104 183 116 l 152 116 l 149 108 b 141 83 148 102 144 91 b 134 48 137 69 134 58 b 149 9 134 34 140 24 b 153 -1 152 5 153 1 b 149 -9 153 -5 152 -6 b 144 -11 148 -11 147 -11 b 122 2 138 -11 133 -6 b 95 61 104 20 95 38 b 107 108 95 74 99 90 b 108 113 107 111 108 112 b 107 113 108 113 108 113 b 102 113 106 113 104 113 b 31 86 76 108 53 98 b 14 80 24 81 20 80 b -10 106 0 80 -10 91 b 0 131 -10 115 -9 116 b 115 430 49 209 91 317 b 136 460 119 451 123 456 "},vd0:{x_min:-10.890625,x_max:299.4375,ha:294,o:"m 44 174 b 51 174 47 174 49 174 b 68 173 55 174 61 174 l 287 112 l 551 40 b 615 20 617 22 609 23 b 626 0 622 16 626 8 b 615 -22 626 -9 622 -18 b 613 -23 613 -23 613 -23 b 613 -23 613 -23 613 -23 b 287 -113 613 -24 597 -29 l 68 -174 b 53 -176 61 -176 57 -176 b 39 -172 47 -176 43 -174 b 27 -151 31 -167 27 -159 b 39 -129 27 -141 31 -133 b 230 -74 43 -124 20 -131 l 370 -36 l 468 -9 b 498 0 484 -4 498 -1 b 468 8 498 0 484 2 l 370 34 l 230 73 b 40 126 28 129 43 124 b 27 149 31 131 27 140 b 44 174 27 161 34 170 m 205 110 l 205 300 b 205 330 245 330 245 300 l 245 300 l 245 -300 b 245 -330 205 -330 205 -300 l 205 -300 l 205 110 l 345 90 m 345 90 l 345 330 b 345 360 385 360 385 330 l 385 330 l 385 -270 b 385 -300 345 -300 345 -270 l 345 -270 l 345 90 "},vd1:{x_min:-20,x_max:320,ha:257,o:"m -8 200 b -8 210 8 200 16 200 l 20 148 -199 l 23 -615 b 0 -629 9 -629 6 -629 l -21 -612 l -21 -201 l -21 216 l -20 200 m 16 200 l 310 0 l 240 0 l 16 140 l 16 -120 l 240 0 l 310 0 l 16 -200 "},vd2:{x_min:0,x_max:430.75,ha:386,o:"m 0 200 l 0 -200 l 430 -200 l 430 200 l 0 200 "},vd3:{x_min:0,x_max:430.75,ha:386,o:"m 0 200 l 0 -200 l 430 -200 l 430 200 l 0 200 l 50 150 l 380 150 l 380 -150 l 50 -150 l 50 150 "},vd4:{x_min:0,x_max:430.75,ha:360,o:"m 0 150 l 0 -150 l 430 -150 l 430 150 l 0 150 "},vd5:{x_min:0,x_max:430.75,ha:360,o:"m 0 150 l 0 -150 l 430 -150 l 430 150 l 0 150 l 50 100 l 380 100 l 380 -100 l 50 -100 l 50 100"},vd6:{x_min:0,x_max:430.75,ha:360,o:"m -146 537 b -138 538 -143 538 -141 538 b -118 525 -129 538 -121 533 b -117 390 -117 522 -117 521 b -115 259 -117 268 -117 259 b -115 259 -115 259 -115 259 b -59 272 -104 263 -62 272 b -39 259 -50 272 -42 267 b -37 209 -38 257 -37 233 b -39 159 -37 185 -38 162 b -85 138 -43 149 -44 149 l -117 131 l -117 21 b -115 -88 -117 -80 -117 -88 b -115 -88 -115 -88 -115 -88 b -59 -75 -104 -84 -62 -75 b -44 -81 -52 -75 -48 -77 b -38 -124 -38 -87 -38 -85 b -38 -138 -38 -124 -38 -138 b -38 -152 -38 -138 -38 -152 b -44 -195 -38 -191 -38 -190 b -85 -209 -48 -200 -48 -200 l -117 -217 l -117 -349 b -118 -486 -117 -481 -117 -482 b -138 -499 -121 -494 -129 -499 b -153 -493 -143 -499 -149 -497 b -159 -415 -158 -487 -159 -496 b -159 -355 -159 -398 -159 -379 b -159 -227 -159 -284 -159 -227 b -205 -238 -159 -227 -180 -232 b -250 -249 -230 -244 -250 -249 b -251 -386 -251 -249 -251 -311 b -252 -525 -251 -521 -251 -522 b -272 -538 -255 -534 -264 -538 b -287 -532 -277 -538 -283 -536 b -293 -452 -292 -527 -293 -536 b -293 -391 -293 -436 -293 -415 b -294 -260 -293 -269 -293 -260 b -294 -260 -294 -260 -294 -260 b -348 -272 -306 -264 -345 -272 b -368 -259 -357 -272 -365 -267 b -369 -209 -369 -257 -369 -233 b -368 -159 -369 -185 -369 -162 b -323 -139 -364 -149 -362 -148 l -293 -131 l -293 -22 b -294 87 -293 80 -293 87 b -294 87 -294 87 -294 87 b -348 75 -306 84 -345 75 b -368 88 -357 75 -365 80 b -369 138 -369 91 -369 114 b -368 188 -369 162 -369 186 b -323 209 -364 198 -362 199 l -293 216 l -293 349 b -292 486 -293 481 -293 482 b -272 499 -288 494 -280 499 b -257 493 -266 499 -261 497 b -251 414 -251 487 -251 496 b -251 354 -251 398 -251 378 b -251 226 -251 284 -251 226 b -205 238 -250 226 -230 231 b -159 249 -180 244 -159 249 b -159 385 -159 249 -159 310 b -157 525 -159 521 -159 522 b -146 537 -156 530 -151 535 z m -159 11 b -159 120 -159 98 -159 120 l -159 120 b -175 116 -160 120 -167 119 b -221 105 -184 114 -204 109 l -251 98 l -251 -12 b -251 -121 -251 -72 -251 -121 b -205 -110 -250 -121 -230 -116 b -159 -99 -180 -104 -159 -99 b -159 11 -159 -99 -159 -49 z m 89 517 b 97 519 92 518 94 519 b 117 505 106 519 114 513 b 119 376 119 502 119 501 l 119 249 l 145 258 b 176 267 169 266 172 267 b 177 267 176 267 177 267 b 196 255 186 267 192 263 l 197 252 l 197 205 b 197 181 197 195 197 187 b 193 149 197 153 197 153 b 152 131 190 144 187 143 l 119 120 l 119 10 b 119 -100 119 -62 119 -100 b 145 -91 120 -100 131 -96 b 173 -82 159 -86 171 -82 b 176 -81 174 -81 175 -81 b 196 -94 185 -81 193 -87 b 198 -151 197 -97 198 -125 b 197 -194 198 -172 197 -192 b 153 -218 193 -203 192 -204 l 119 -230 l 119 -367 l 118 -504 l 117 -507 b 97 -519 113 -514 105 -519 b 82 -512 92 -519 87 -517 b 76 -434 77 -507 76 -516 b 76 -374 76 -418 76 -398 b 76 -245 76 -303 76 -245 b 52 -254 76 -245 65 -249 b 19 -263 34 -260 25 -263 b 6 -257 13 -263 10 -261 b 0 -214 0 -251 0 -253 b 0 -200 0 -210 0 -205 b 0 -188 0 -196 0 -192 b 6 -143 0 -147 0 -149 b 46 -126 10 -139 10 -139 l 76 -115 l 76 -5 b 76 106 76 56 76 106 b 51 98 76 106 64 102 b 18 89 34 92 25 89 b 6 95 13 89 10 91 b 0 139 0 101 0 99 b 0 153 0 143 0 148 b 0 179 0 163 0 172 b 44 225 0 215 3 211 l 76 236 l 76 369 b 78 505 76 501 76 502 b 89 517 80 510 85 515 z "},vd7:{x_min:0,x_max:430.75,ha:360,o:"m 283 633 b 291 634 286 634 289 634 b 311 621 300 634 308 629 b 313 505 313 618 313 617 b 313 393 313 443 313 393 b 378 425 313 393 343 407 l 443 458 l 448 458 b 449 458 449 458 449 458 b 471 437 462 458 471 448 b 469 429 471 434 470 432 b 387 382 466 421 469 423 l 313 344 l 313 247 l 313 150 l 315 152 b 433 201 353 184 394 201 b 479 193 448 201 464 198 b 549 86 524 177 549 135 b 526 1 549 59 541 29 b 395 -143 504 -39 475 -71 b 316 -214 351 -182 341 -191 b 292 -229 302 -228 300 -229 b 272 -216 283 -229 275 -224 b 271 55 271 -212 271 -212 b 270 323 271 203 270 323 b 205 291 270 323 241 308 l 140 258 l 135 258 b 134 258 135 258 134 258 b 112 279 121 258 112 267 b 114 287 112 281 113 284 b 196 334 117 295 114 293 l 271 371 l 271 495 b 272 621 271 617 271 618 b 283 633 274 626 279 631 z m 404 133 b 391 134 400 134 395 134 b 384 134 388 134 386 134 b 318 88 358 130 335 114 l 313 81 l 313 -37 l 313 -156 l 316 -152 b 439 83 391 -71 439 22 l 439 84 b 404 133 439 115 430 128 z m -8 633 l -8 633 b 0 634 -6 634 -3 634 b 20 621 8 634 17 629 b 21 384 21 618 21 617 l 21 150 l 24 152 b 141 201 62 184 102 201 b 187 193 157 201 172 198 b 257 86 232 177 257 135 b 234 1 257 59 250 29 b 103 -143 212 -39 183 -71 b 24 -214 60 -182 49 -191 b 0 -229 10 -228 8 -229 b -20 -216 -9 -229 -17 -224 l -21 -212 l -21 203 l -21 618 l -20 621 b -8 633 -18 626 -13 631 z m 113 133 l 113 133 b 99 134 109 134 103 134 b 93 134 97 134 94 134 b 26 88 66 130 43 114 l 21 81 l 21 -37 l 21 -156 l 25 -152 b 148 83 99 -71 148 22 l 148 84 b 113 133 148 115 138 128 z "}},cssFontWeight:"normal",ascender:1903,underlinePosition:-125,cssFontStyle:"normal",boundingBox:{yMin:-2065.375,xMin:-695.53125,yMax:1901.578125,xMax:1159.671875},resolution:1e3,descender:-2066,familyName:"VexFlow-18",lineHeight:4093,underlineThickness:50};function Vo(n,t,e,i,s,r){let o,a,l,h=0;function c(){return t+n[h++]*i}function u(){return e+n[h++]*s}for(;h<n.length;)switch(o=n[h++],o){case"m":case"l":r[o](c(),u());break;case"q":a=c(),l=u(),r.q(c(),u(),a,l);break;case"b":a=c(),l=u(),r.b(c(),u(),c(),u(),a,l);break}}class xt extends he{static loadMetrics(t,e,i){const s=t.glyphs[e];if(!s)throw new M.RERR("BadGlyph",`Glyph ${e} does not exist in font.`);const r=s.x_min,o=s.x_max,a=s.ha;let l;if(s.o)return i?s.cached_outline?l=s.cached_outline:(l=s.o.split(" "),s.cached_outline=l):(s.cached_outline&&delete s.cached_outline,l=s.o.split(" ")),{x_min:r,x_max:o,ha:a,outline:l};throw new M.RERR("BadGlyph",`Glyph ${e} has no outline defined.`)}static renderGlyph(t,e,i,s,r,o){const a=s*72/(bn.resolution*100),l=xt.loadMetrics(bn,r,!o);xt.renderOutline(t,l.outline,a,e,i)}static renderOutline(t,e,i,s,r){t.beginPath(),t.moveTo(s,r),Vo(e,s,r,i,-i,{m:t.moveTo.bind(t),l:t.lineTo.bind(t),q:t.quadraticCurveTo.bind(t),b:t.bezierCurveTo.bind(t)}),t.fill()}static getOutlineBoundingBox(t,e,i,s){const r=new $h;return Vo(t,i,s,e,-e,{m:r.addPoint.bind(r),l:r.addPoint.bind(r),q:r.addQuadraticCurve.bind(r),b:r.addBezierCurve.bind(r)}),new es(r.x1,r.y1,r.width(),r.height())}constructor(t,e,i){super(),this.setAttribute("type","Glyph"),this.code=t,this.point=e,this.options={cache:!0,font:bn},this.metrics=null,this.x_shift=0,this.y_shift=0,this.originShift={x:0,y:0},i?this.setOptions(i):this.reset()}setOptions(t){M.Merge(this.options,t),this.reset()}setPoint(t){return this.point=t,this}setStave(t){return this.stave=t,this}setXShift(t){return this.x_shift=t,this}setYShift(t){return this.y_shift=t,this}reset(){this.scale=this.point*72/(this.options.font.resolution*100),this.metrics=xt.loadMetrics(this.options.font,this.code,this.options.cache),this.bbox=xt.getOutlineBoundingBox(this.metrics.outline,this.scale,0,0)}getMetrics(){if(!this.metrics)throw new M.RuntimeError("BadGlyph",`Glyph ${this.code} is not initialized.`);return{x_min:this.metrics.x_min*this.scale,x_max:this.metrics.x_max*this.scale,width:this.bbox.getW(),height:this.bbox.getH()}}setOriginX(t){const{bbox:e}=this,i=Math.abs(e.getX()/e.getW()),s=(t-i)*e.getW();this.originShift.x=-s}setOriginY(t){const{bbox:e}=this,i=Math.abs(e.getY()/e.getH()),s=(t-i)*e.getH();this.originShift.y=-s}setOrigin(t,e){this.setOriginX(t),this.setOriginY(e)}render(t,e,i){if(!this.metrics)throw new M.RuntimeError("BadGlyph",`Glyph ${this.code} is not initialized.`);const s=this.metrics.outline,r=this.scale;this.setRendered(),this.applyStyle(t),xt.renderOutline(t,s,r,e+this.originShift.x,i+this.originShift.y),this.restoreStyle(t)}renderToStave(t){if(this.checkContext(),!this.metrics)throw new M.RuntimeError("BadGlyph",`Glyph ${this.code} is not initialized.`);if(!this.stave)throw new M.RuntimeError("GlyphError","No valid stave");const e=this.metrics.outline,i=this.scale;this.setRendered(),this.applyStyle(),xt.renderOutline(this.context,e,i,t+this.x_shift,this.stave.getYForGlyphs()+this.y_shift),this.restoreStyle()}}const V={STEM_WIDTH:1.5,STEM_HEIGHT:35,STAVE_LINE_THICKNESS:1,RESOLUTION:16384,DEFAULT_NOTATION_FONT_SCALE:39,DEFAULT_TABLATURE_FONT_SCALE:39,SLASH_NOTEHEAD_WIDTH:15,TEXT_HEIGHT_OFFSET_HACK:1,IsKerned:!0};V.clefProperties=n=>{if(!n)throw new M.RERR("BadArgument","Invalid clef: "+n);const t=V.clefProperties.values[n];if(!t)throw new M.RERR("BadArgument","Invalid clef: "+n);return t};V.clefProperties.values={treble:{line_shift:0},bass:{line_shift:6},tenor:{line_shift:4},alto:{line_shift:3},soprano:{line_shift:1},percussion:{line_shift:0},"mezzo-soprano":{line_shift:2},"baritone-c":{line_shift:5},"baritone-f":{line_shift:5},subbass:{line_shift:7},french:{line_shift:-1}};V.keyProperties=(n,t,e)=>{t===void 0&&(t="treble");const i={octave_shift:0};typeof e=="object"&&M.Merge(i,e);const s=n.split("/");if(s.length<2)throw new M.RERR("BadArguments",`Key must have note + octave and an optional glyph: ${n}`);const r=s[0].toUpperCase(),o=V.keyProperties.note_values[r];if(!o)throw new M.RERR("BadArguments","Invalid key name: "+r);o.octave&&(s[1]=o.octave);let a=parseInt(s[1],10);a+=-1*i.octave_shift;let h=(a*7-4*7+o.index)/2;h+=V.clefProperties(t).line_shift;let c=0;h<=0&&h*2%2===0&&(c=1),h>=6&&h*2%2===0&&(c=-1);const u=typeof o.int_val!="undefined"?a*12+o.int_val:null,f=o.code,d=o.shift_right;let p={};if(s.length>2&&s[2]){const g=s[2].toUpperCase();p=V.keyProperties.customNoteHeads[g]||{}}return be({key:r,octave:a,line:h,int_value:u,accidental:o.accidental,code:f,stroke:c,shift_right:d,displaced:!1},p)};V.keyProperties.note_values={C:{index:0,int_val:0,accidental:null},CN:{index:0,int_val:0,accidental:"n"},"C#":{index:0,int_val:1,accidental:"#"},"C##":{index:0,int_val:2,accidental:"##"},CB:{index:0,int_val:-1,accidental:"b"},CBB:{index:0,int_val:-2,accidental:"bb"},D:{index:1,int_val:2,accidental:null},DN:{index:1,int_val:2,accidental:"n"},"D#":{index:1,int_val:3,accidental:"#"},"D##":{index:1,int_val:4,accidental:"##"},DB:{index:1,int_val:1,accidental:"b"},DBB:{index:1,int_val:0,accidental:"bb"},E:{index:2,int_val:4,accidental:null},EN:{index:2,int_val:4,accidental:"n"},"E#":{index:2,int_val:5,accidental:"#"},"E##":{index:2,int_val:6,accidental:"##"},EB:{index:2,int_val:3,accidental:"b"},EBB:{index:2,int_val:2,accidental:"bb"},F:{index:3,int_val:5,accidental:null},FN:{index:3,int_val:5,accidental:"n"},"F#":{index:3,int_val:6,accidental:"#"},"F##":{index:3,int_val:7,accidental:"##"},FB:{index:3,int_val:4,accidental:"b"},FBB:{index:3,int_val:3,accidental:"bb"},G:{index:4,int_val:7,accidental:null},GN:{index:4,int_val:7,accidental:"n"},"G#":{index:4,int_val:8,accidental:"#"},"G##":{index:4,int_val:9,accidental:"##"},GB:{index:4,int_val:6,accidental:"b"},GBB:{index:4,int_val:5,accidental:"bb"},A:{index:5,int_val:9,accidental:null},AN:{index:5,int_val:9,accidental:"n"},"A#":{index:5,int_val:10,accidental:"#"},"A##":{index:5,int_val:11,accidental:"##"},AB:{index:5,int_val:8,accidental:"b"},ABB:{index:5,int_val:7,accidental:"bb"},B:{index:6,int_val:11,accidental:null},BN:{index:6,int_val:11,accidental:"n"},"B#":{index:6,int_val:12,accidental:"#"},"B##":{index:6,int_val:13,accidental:"##"},BB:{index:6,int_val:10,accidental:"b"},BBB:{index:6,int_val:9,accidental:"bb"},R:{index:6,int_val:9,rest:!0},X:{index:6,accidental:"",octave:4,code:"v3e",shift_right:5.5}};V.keyProperties.customNoteHeads={D0:{code:"v27",shift_right:0,stem_up_x_offset:0,stem_down_x_offset:0,stem_up_y_offset:-1,stem_down_y_offset:0},D1:{code:"v2d",shift_right:-.5},D2:{code:"v22",shift_right:-.5},D3:{code:"v70",shift_right:-.5},T0:{code:"v49",shift_right:-2,stem_up_y_offset:-4,stem_down_y_offset:4},T1:{code:"v93",shift_right:.5,stem_up_y_offset:-4,stem_down_y_offset:4},T2:{code:"v40",shift_right:.5,stem_up_y_offset:-4,stem_down_y_offset:4},T3:{code:"v7d",shift_right:.5,stem_up_y_offset:-4,stem_down_y_offset:4},X0:{code:"v92",stem_up_x_offset:-2,stem_down_x_offset:0,stem_up_y_offset:4,stem_down_y_offset:4},X1:{code:"v95",shift_right:-.5,stem_up_y_offset:4,stem_down_y_offset:4},X2:{code:"v3e",shift_right:.5,stem_up_y_offset:4,stem_down_y_offset:4},X3:{code:"v3b",shift_right:0,stem_up_x_offset:-1.2,stem_down_x_offset:0,stem_up_y_offset:-1,stem_down_y_offset:2},S1:{code:"vd3",shift_right:0},S2:{code:"vd2",shift_right:0},R1:{code:"vd5",shift_right:0},R2:{code:"vd4",shift_right:0}};V.integerToNote=n=>{if(typeof n=="undefined")throw new M.RERR("BadArguments","Undefined integer for integerToNote");if(n<-2)throw new M.RERR("BadArguments",`integerToNote requires integer > -2: ${n}`);const t=V.integerToNote.table[n];if(!t)throw new M.RERR("BadArguments",`Unknown note value for integer: ${n}`);return t};V.integerToNote.table={0:"C",1:"C#",2:"D",3:"D#",4:"E",5:"F",6:"F#",7:"G",8:"G#",9:"A",10:"A#",11:"B"};V.tabToGlyph=(n,t=1)=>{let e=null,i=0,s=0;if(n.toString().toUpperCase()==="X"){const r=new xt("v7f",V.DEFAULT_TABLATURE_FONT_SCALE).getMetrics();e="v7f",i=r.width,s=-r.height/2}else i=V.textWidth(n.toString());return{text:n,code:e,getWidth:()=>i*t,shift_y:s}};V.textWidth=n=>7*n.toString().length;V.articulationCodes=n=>V.articulationCodes.articulations[n];V.articulationCodes.articulations={"a.":{code:"v23",between_lines:!0},av:{code:"v28",between_lines:!0},"a>":{code:"v42",between_lines:!0},"a-":{code:"v25",between_lines:!0},"a^":{code:"va",between_lines:!1},"a+":{code:"v8b",between_lines:!1},ao:{code:"v94",between_lines:!1},ah:{code:"vb9",between_lines:!1},"a@a":{code:"v43",between_lines:!1},"a@u":{code:"v5b",between_lines:!1},"a|":{code:"v75",between_lines:!1},am:{code:"v97",between_lines:!1},"a,":{code:"vb3",between_lines:!1}};V.accidentalCodes=n=>V.accidentalCodes.accidentals[n];V.accidentalCodes.accidentals={"#":{code:"v18",parenRightPaddingAdjustment:-1},"##":{code:"v7f",parenRightPaddingAdjustment:-1},b:{code:"v44",parenRightPaddingAdjustment:-2},bb:{code:"v26",parenRightPaddingAdjustment:-2},n:{code:"v4e",parenRightPaddingAdjustment:-1},"{":{code:"v9c",parenRightPaddingAdjustment:-1},"}":{code:"v84",parenRightPaddingAdjustment:-1},db:{code:"v9e",parenRightPaddingAdjustment:-1},d:{code:"vab",parenRightPaddingAdjustment:0},bbs:{code:"v90",parenRightPaddingAdjustment:-1},"++":{code:"v51",parenRightPaddingAdjustment:-1},"+":{code:"v78",parenRightPaddingAdjustment:-1},"+-":{code:"v8d",parenRightPaddingAdjustment:-1},"++-":{code:"v7a",parenRightPaddingAdjustment:-1},bs:{code:"vb7",parenRightPaddingAdjustment:-1},bss:{code:"v39",parenRightPaddingAdjustment:-1},o:{code:"vd0",parenRightPaddingAdjustment:-1},k:{code:"vd1",parenRightPaddingAdjustment:-1},ashs:{code:"vd6",parenRightPaddingAdjustment:-1},afhf:{code:"vd7",parenRightPaddingAdjustment:-1}};V.accidentalColumnsTable={1:{a:[1],b:[1]},2:{a:[1,2]},3:{a:[1,3,2],b:[1,2,1],second_on_bottom:[1,2,3]},4:{a:[1,3,4,2],b:[1,2,3,1],spaced_out_tetrachord:[1,2,1,2]},5:{a:[1,3,5,4,2],b:[1,2,4,3,1],spaced_out_pentachord:[1,2,3,2,1],very_spaced_out_pentachord:[1,2,1,2,1]},6:{a:[1,3,5,6,4,2],b:[1,2,4,5,3,1],spaced_out_hexachord:[1,3,2,1,3,2],very_spaced_out_hexachord:[1,2,1,2,1,2]}};V.ornamentCodes=n=>V.ornamentCodes.ornaments[n];V.ornamentCodes.ornaments={mordent:{code:"v1e"},mordent_inverted:{code:"v45"},turn:{code:"v72"},turn_inverted:{code:"v33"},tr:{code:"v1f"},upprall:{code:"v60"},downprall:{code:"vb4"},prallup:{code:"v6d"},pralldown:{code:"v2c"},upmordent:{code:"v29"},downmordent:{code:"v68"},lineprall:{code:"v20"},prallprall:{code:"v86"}};V.keySignature=n=>{const t=V.keySignature.keySpecs[n];if(!t)throw new M.RERR("BadKeySignature",`Bad key signature spec: '${n}'`);if(!t.acc)return[];const e=V.keySignature.accidentalList(t.acc),i=[];for(let s=0;s<t.num;++s){const r=e[s];i.push({type:t.acc,line:r})}return i};V.keySignature.keySpecs={C:{acc:null,num:0},Am:{acc:null,num:0},F:{acc:"b",num:1},Dm:{acc:"b",num:1},Bb:{acc:"b",num:2},Gm:{acc:"b",num:2},Eb:{acc:"b",num:3},Cm:{acc:"b",num:3},Ab:{acc:"b",num:4},Fm:{acc:"b",num:4},Db:{acc:"b",num:5},Bbm:{acc:"b",num:5},Gb:{acc:"b",num:6},Ebm:{acc:"b",num:6},Cb:{acc:"b",num:7},Abm:{acc:"b",num:7},G:{acc:"#",num:1},Em:{acc:"#",num:1},D:{acc:"#",num:2},Bm:{acc:"#",num:2},A:{acc:"#",num:3},"F#m":{acc:"#",num:3},E:{acc:"#",num:4},"C#m":{acc:"#",num:4},B:{acc:"#",num:5},"G#m":{acc:"#",num:5},"F#":{acc:"#",num:6},"D#m":{acc:"#",num:6},"C#":{acc:"#",num:7},"A#m":{acc:"#",num:7}};V.unicode={sharp:String.fromCharCode(parseInt("266F",16)),flat:String.fromCharCode(parseInt("266D",16)),natural:String.fromCharCode(parseInt("266E",16)),triangle:String.fromCharCode(parseInt("25B3",16)),"o-with-slash":String.fromCharCode(parseInt("00F8",16)),degrees:String.fromCharCode(parseInt("00B0",16)),circle:String.fromCharCode(parseInt("25CB",16))};V.keySignature.accidentalList=n=>({b:[2,.5,2.5,1,3,1.5,3.5],"#":[0,1.5,-.5,1,2.5,.5,2]})[n];V.parseNoteDurationString=n=>{if(typeof n!="string")return null;const e=/(\d*\/?\d+|[a-z])(d*)([nrhms]|$)/.exec(n);if(!e)return null;const i=e[1],s=e[2].length;let r=e[3];return r.length===0&&(r="n"),{duration:i,dots:s,type:r}};V.parseNoteStruct=n=>{const t=n.duration,e=V.parseNoteDurationString(t);if(!e)return null;let i=V.durationToTicks(e.duration);if(i==null)return null;let s=n.type;const r=[];if(s){if(!V.getGlyphProps.validTypes[s])return null}else s=e.type||"n",n.keys!==void 0&&n.keys.forEach((l,h)=>{const c=l.split("/");c&&c.length===3&&(r[h]=c[2])});const o=n.dots?n.dots:e.dots;if(typeof o!="number")return null;let a=i;for(let l=0;l<o;l++){if(a<=1)return null;a=a/2,i+=a}return{duration:e.duration,type:s,customTypes:r,dots:o,ticks:i}};V.sanitizeDuration=n=>{const t=V.durationAliases[n];if(t!==void 0&&(n=t),V.durationToTicks.durations[n]===void 0)throw new M.RERR("BadArguments",`The provided duration is not valid: ${n}`);return n};V.durationToFraction=n=>new Rt().parse(V.sanitizeDuration(n));V.durationToNumber=n=>V.durationToFraction(n).value();V.durationToTicks=n=>{n=V.sanitizeDuration(n);const t=V.durationToTicks.durations[n];return t===void 0?null:t};V.durationToTicks.durations={"1/2":V.RESOLUTION*2,"1":V.RESOLUTION/1,"2":V.RESOLUTION/2,"4":V.RESOLUTION/4,"8":V.RESOLUTION/8,"16":V.RESOLUTION/16,"32":V.RESOLUTION/32,"64":V.RESOLUTION/64,"128":V.RESOLUTION/128,"256":V.RESOLUTION/256};V.durationAliases={w:"1",h:"2",q:"4",b:"256"};V.getGlyphProps=(n,t)=>{n=V.sanitizeDuration(n);const e=V.getGlyphProps.duration_codes[n];if(e===void 0)return null;t||(t="n");let i=e.type[t];if(i===void 0){const s=V.keyProperties.customNoteHeads[t.toUpperCase()];if(s===void 0)return null;i=be({code_head:s.code},s)}return be(be({},e.common),i)};V.getGlyphProps.validTypes={n:{name:"note"},r:{name:"rest"},h:{name:"harmonic"},m:{name:"muted"},s:{name:"slash"}};V.getGlyphProps.duration_codes={"1/2":{common:{getWidth(n=V.DEFAULT_NOTATION_FONT_SCALE){return new xt(this.code_head||"v53",n).getMetrics().width},stem:!1,stem_offset:0,flag:!1,stem_up_extension:-V.STEM_HEIGHT,stem_down_extension:-V.STEM_HEIGHT,tabnote_stem_up_extension:-V.STEM_HEIGHT,tabnote_stem_down_extension:-V.STEM_HEIGHT,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"v53"},h:{code_head:"v59"},m:{code_head:"vf",stem_offset:0},r:{code_head:"v31",rest:!0,position:"B/5",dot_shiftY:.5},s:{getWidth:()=>V.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},"1":{common:{getWidth(n=V.DEFAULT_NOTATION_FONT_SCALE){return new xt(this.code_head||"v1d",n).getMetrics().width},stem:!1,stem_offset:0,flag:!1,stem_up_extension:-V.STEM_HEIGHT,stem_down_extension:-V.STEM_HEIGHT,tabnote_stem_up_extension:-V.STEM_HEIGHT,tabnote_stem_down_extension:-V.STEM_HEIGHT,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"v1d"},h:{code_head:"v46"},m:{code_head:"v92",stem_offset:-3},r:{code_head:"v5c",rest:!0,position:"D/5",dot_shiftY:.5},s:{getWidth:()=>V.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},"2":{common:{getWidth(n=V.DEFAULT_NOTATION_FONT_SCALE){return new xt(this.code_head||"v81",n).getMetrics().width},stem:!0,stem_offset:0,flag:!1,stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"v81"},h:{code_head:"v2d"},m:{code_head:"v95",stem_offset:-3},r:{code_head:"vc",stem:!1,rest:!0,position:"B/4",dot_shiftY:-.5},s:{getWidth:()=>V.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},"4":{common:{getWidth(n=V.DEFAULT_NOTATION_FONT_SCALE){return new xt(this.code_head||"vb",n).getMetrics().width},stem:!0,stem_offset:0,flag:!1,stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e",stem_offset:-3},r:{code_head:"v7c",stem:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1.5,line_below:1.5},s:{getWidth:()=>V.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},"8":{common:{getWidth(n=V.DEFAULT_NOTATION_FONT_SCALE){return new xt(this.code_head||"vb",n).getMetrics().width},stem:!0,stem_offset:0,flag:!0,beam_count:1,code_flag_upstem:"v54",code_flag_downstem:"v9a",stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"va5",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1,line_below:1},s:{getWidth:()=>V.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},"16":{common:{beam_count:2,getWidth(n=V.DEFAULT_NOTATION_FONT_SCALE){return new xt(this.code_head||"vb",n).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"v3f",code_flag_downstem:"v8f",stem_up_extension:0,stem_down_extension:0,tabnote_stem_up_extension:0,tabnote_stem_down_extension:0,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"v3c",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-.5,line_above:1,line_below:2},s:{getWidth:()=>V.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},"32":{common:{beam_count:3,getWidth(n=V.DEFAULT_NOTATION_FONT_SCALE){return new xt(this.code_head||"vb",n).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"v47",code_flag_downstem:"v2a",stem_up_extension:9,stem_down_extension:9,tabnote_stem_up_extension:8,tabnote_stem_down_extension:5,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"v55",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-1.5,line_above:2,line_below:2},s:{getWidth:()=>V.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},"64":{common:{beam_count:4,getWidth(n=V.DEFAULT_NOTATION_FONT_SCALE){return new xt(this.code_head||"vb",n).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"va9",code_flag_downstem:"v58",stem_up_extension:13,stem_down_extension:13,tabnote_stem_up_extension:12,tabnote_stem_down_extension:9,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"v38",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:-1.5,line_above:2,line_below:3},s:{getWidth:()=>V.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},"128":{common:{beam_count:5,getWidth(n=V.DEFAULT_NOTATION_FONT_SCALE){return new xt(this.code_head||"vb",n).getMetrics().width},stem:!0,stem_offset:0,flag:!0,code_flag_upstem:"v9b",code_flag_downstem:"v30",stem_up_extension:22,stem_down_extension:22,tabnote_stem_up_extension:21,tabnote_stem_down_extension:18,dot_shiftY:0,line_above:0,line_below:0},type:{n:{code_head:"vb"},h:{code_head:"v22"},m:{code_head:"v3e"},r:{code_head:"vaa",stem:!1,flag:!1,rest:!0,position:"B/4",dot_shiftY:1.5,line_above:3,line_below:3},s:{getWidth:()=>V.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}}};V.smufl={};V.smufl.to_code_points={bracketTop:"v1b",bracketBottom:"v10",barlineTick:"v6f",segno:"v8c",coda:"v4d",gClef:"v83",cClef:"vad",fClef:"v79",unpitchedPercussionClef1:"v59","6stringTabClef":"v2f",timeSig0:"v0",timeSig1:"v1",timeSig2:"v2",timeSig3:"v3",timeSig4:"v4",timeSig5:"v5",timeSig6:"v6",timeSig7:"v7",timeSig8:"v8",timeSig9:"v9",timeSigCommon:"v41",timeSigCutCommon:"vb6",noteheadDoubleWhole:"v53",noteheadWhole:"v1d",noteheadHalf:"v81",noteheadBlack:"vb",noteheadXWhole:"v92",noteheadXHalf:"v95",noteheadXBlack:"v3e",noteheadCircleX:"v3b",noteheadTriangleUpWhole:"v49",noteheadTriangleUpHalf:"v93",noteheadTriangleUpBlack:"v40",noteheadDiamondWhole:"v46",noteheadDiamondHalf:"v2d",noteheadDiamondBlack:"v22",augmentationDot:"v23",tremolo1:"v74",flag8thUp:"v54",flag8thDown:"v9a",flag16thUp:"v3f",flag16thDown:"v8f",flag32ndUp:"v47",flag32ndDown:"v2a",flag64thUp:"va9",flag64thDown:"v58",flag128thUp:"v9b",flag128thDown:"v30",accidentalFlat:"v44",accidentalNatural:"v4e",accidentalSharp:"v18",accidentalDoubleSharp:"v7f",accidentalDoubleFlat:"v26",accidentalParensLeft:"v9c",accidentalParensRight:"v84",accidentalQuarterToneFlatStein:"vab",accidentalThreeQuarterTonesFlatZimmermann:"v9e",accidentalQuarterToneSharpStein:"v78",accidentalThreeQuarterTonesSharpStein:"v51",accidentalBuyukMucennebFlat:"v39",accidentalBakiyeFlat:"vb7",accidentalKomaSharp:"v51",accidentalKucukMucennebSharp:"v8d",accidentalKoron:"vd1",accidentalSori:"vd0",articAccentAbove:"v42",articAccentBelow:"v42",articTenutoAbove:"v25",articTenutoBelow:"v25",articStaccatoAbove:"v23",articStaccatoBelow:"v23",articStaccatissimoAbove:"v28",articMarcatoAbove:"va",fermataAbove:"v43",fermataBelow:"v5b",breathMarkComma:"v6c",breathMarkUpbow:"v8a",caesura:"v34",caesuraCurved:"v4b",restMaxima:"v59",restDoubleWhole:"v31",restWhole:"v5c",restHalf:"vc",restQuarter:"v7c",rest8th:"va5",rest16th:"v3c",rest32nd:"v55",rest64th:"v38",rest128th:"vaa",dynamicPiano:"vbf",dynamicMezzo:"v62",dynamicForte:"vba",dynamicRinforzando:"vba",dynamicSforzando:"v4a",dynamicZ:"v80",ornamentTrill:"v1f",ornamentTurn:"v72",ornamentTurnSlash:"v33",ornamentMordent:"v45",ornamentMordentInverted:"v1e",ornamentTremblement:"v86",ornamentPrecompAppoggTrill:"v20",ornamentPrecompSlideTrillDAnglebert:"v60",ornamentPrecompSlideTrillBach:"v29",ornamentPrecompTrillSuffixDandrieu:"v6d",ornamentPrecompDoubleCadenceUpperPrefix:"vb4",ornamentPrecompDoubleCadenceUpperPrefixTurn:"v68",ornamentPrecompTrillLowerSuffix:"v2c",stringsDownBow:"v94",stringsUpBow:"v75",stringsHarmonic:"vb9",pluckedSnapPizzicatoAbove:"v94",pluckedLeftHandPizzicato:"v8b",keyboardPedalPed:"v36",keyboardPedalUp:"v5d",pictChokeCymbal:"vb3",wiggleArpeggiatoUp:"va3",arrowheadBlackUp:"vc3",arrowheadBlackDown:"v52"};V.TIME4_4={num_beats:4,beat_value:4,resolution:V.RESOLUTION};class gs{static get WIDTH(){return 600}static get HEIGHT(){return 400}static get CANVAS_BROWSER_SIZE_LIMIT(){return 32767}static SanitizeCanvasDims(t,e){return Math.max(t,e)>this.CANVAS_BROWSER_SIZE_LIMIT&&(M.W("Canvas dimensions exceed browser limit. Cropping to "+this.CANVAS_BROWSER_SIZE_LIMIT),t>this.CANVAS_BROWSER_SIZE_LIMIT&&(t=this.CANVAS_BROWSER_SIZE_LIMIT),e>this.CANVAS_BROWSER_SIZE_LIMIT&&(e=this.CANVAS_BROWSER_SIZE_LIMIT)),[t,e]}constructor(t){this.vexFlowCanvasContext=t,t.canvas?this.canvas=t.canvas:this.canvas={width:gs.WIDTH,height:gs.HEIGHT}}clear(){this.vexFlowCanvasContext.clearRect(0,0,this.canvas.width,this.canvas.height)}openGroup(){}closeGroup(){}add(){}setFont(t,e,i){return this.vexFlowCanvasContext.font=(i||"")+" "+e+"pt "+t,this}setRawFont(t){return this.vexFlowCanvasContext.font=t,this}setFillStyle(t){return this.vexFlowCanvasContext.fillStyle=t,this}setBackgroundFillStyle(t){return this.background_fillStyle=t,this}setStrokeStyle(t){return this.vexFlowCanvasContext.strokeStyle=t,this}setShadowColor(t){return this.vexFlowCanvasContext.shadowColor=t,this}setShadowBlur(t){return this.vexFlowCanvasContext.shadowBlur=t,this}setLineWidth(t){return this.vexFlowCanvasContext.lineWidth=t,this}setLineCap(t){return this.vexFlowCanvasContext.lineCap=t,this}setLineDash(t){return this.vexFlowCanvasContext.lineDash=t,this}scale(t,e){return this.vexFlowCanvasContext.scale(parseFloat(t),parseFloat(e))}resize(t,e){return[t,e]=this.SanitizeCanvasDims(parseInt(t,10),parseInt(e,10)),this.vexFlowCanvasContext.resize(t,e)}rect(t,e,i,s){return this.vexFlowCanvasContext.rect(t,e,i,s)}fillRect(t,e,i,s){return this.vexFlowCanvasContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){return this.vexFlowCanvasContext.clearRect(t,e,i,s)}beginPath(){return this.vexFlowCanvasContext.beginPath()}moveTo(t,e){return this.vexFlowCanvasContext.moveTo(t,e)}lineTo(t,e){return this.vexFlowCanvasContext.lineTo(t,e)}bezierCurveTo(t,e,i,s,r,o){return this.vexFlowCanvasContext.bezierCurveTo(t,e,i,s,r,o)}quadraticCurveTo(t,e,i,s){return this.vexFlowCanvasContext.quadraticCurveTo(t,e,i,s)}arc(t,e,i,s,r,o){return this.vexFlowCanvasContext.arc(t,e,i,s,r,o)}glow(){return this.vexFlowCanvasContext.glow()}fill(){return this.vexFlowCanvasContext.fill()}stroke(){return this.vexFlowCanvasContext.stroke()}closePath(){return this.vexFlowCanvasContext.closePath()}measureText(t){return this.vexFlowCanvasContext.measureText(t)}fillText(t,e,i){return this.vexFlowCanvasContext.fillText(t,e,i)}save(){return this.vexFlowCanvasContext.save()}restore(){return this.vexFlowCanvasContext.restore()}}class tc{constructor(t){this.element=t,this.paper=Raphael(t),this.path="",this.pen={x:0,y:0},this.lineWidth=1,this.state={scale:{x:1,y:1},font_family:"Arial",font_size:8,font_weight:800},this.attributes={"stroke-width":.3,fill:"black",stroke:"black",font:"10pt Arial"},this.background_attributes={"stroke-width":0,fill:"white",stroke:"white",font:"10pt Arial"},this.shadow_attributes={width:0,color:"black"},this.state_stack=[]}openGroup(){}closeGroup(){}add(){}setFont(t,e,i){return this.state.font_family=t,this.state.font_size=e,this.state.font_weight=i,this.attributes.font=(this.state.font_weight||"")+" "+this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this}setRawFont(t){return this.attributes.font=t,this}setFillStyle(t){return this.attributes.fill=t,this}setBackgroundFillStyle(t){return this.background_attributes.fill=t,this.background_attributes.stroke=t,this}setStrokeStyle(t){return this.attributes.stroke=t,this}setShadowColor(t){return this.shadow_attributes.color=t,this}setShadowBlur(t){return this.shadow_attributes.width=t,this}setLineWidth(t){this.attributes["stroke-width"]=t,this.lineWidth=t}setLineDash(){return this}setLineCap(){return this}scale(t,e){return this.state.scale={x:t,y:e},this.attributes.transform="S"+t+","+e+",0,0",this.attributes.scale=t+","+e+",0,0",this.attributes.font=this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this.background_attributes.transform="S"+t+","+e+",0,0",this.background_attributes.font=this.state.font_size*this.state.scale.x+"pt "+this.state.font_family,this}clear(){this.paper.clear()}resize(t,e){return this.element.style.width=t,this.paper.setSize(t,e),this}setViewBox(t){this.paper.canvas.setAttribute("viewBox",t)}rect(t,e,i,s){return s<0&&(e+=s,s=-s),this.paper.rect(t,e,i-.5,s-.5).attr(this.attributes).attr("fill","none").attr("stroke-width",this.lineWidth),this}fillRect(t,e,i,s){return s<0&&(e+=s,s=-s),this.paper.rect(t,e,i-.5,s-.5).attr(this.attributes),this}clearRect(t,e,i,s){return s<0&&(e+=s,s=-s),this.paper.rect(t,e,i-.5,s-.5).attr(this.background_attributes),this}beginPath(){return this.path="",this.pen.x=0,this.pen.y=0,this}moveTo(t,e){return this.path+="M"+t+","+e,this.pen.x=t,this.pen.y=e,this}lineTo(t,e){return this.path+="L"+t+","+e,this.pen.x=t,this.pen.y=e,this}bezierCurveTo(t,e,i,s,r,o){return this.path+="C"+t+","+e+","+i+","+s+","+r+","+o,this.pen.x=r,this.pen.y=o,this}quadraticCurveTo(t,e,i,s){return this.path+="Q"+t+","+e+","+i+","+s,this.pen.x=i,this.pen.y=s,this}arc(t,e,i,s,r,o){function a(h){for(;h<0;)h+=Math.PI*2;for(;h>Math.PI*2;)h-=Math.PI*2;return h}if(s=a(s),r=a(r),s>r){const h=s;s=r,r=h,o=!o}const l=r-s;return l>Math.PI?(this.arcHelper(t,e,i,s,s+l/2,o),this.arcHelper(t,e,i,s+l/2,r,o)):this.arcHelper(t,e,i,s,r,o),this}arcHelper(t,e,i,s,r,o){const a=t+i*Math.cos(s),l=e+i*Math.sin(s),h=t+i*Math.cos(r),c=e+i*Math.sin(r);let u=0,f=0;o?(f=1,r-s<Math.PI&&(u=1)):r-s>Math.PI&&(u=1),this.path+="M"+a+","+l+",A"+i+","+i+",0,"+u+","+f+","+h+","+c+"M"+this.pen.x+","+this.pen.y}glow(){const t=this.paper.set();if(this.shadow_attributes.width>0){const e=this.shadow_attributes,i=e.width/2;for(let s=1;s<=i;s++)t.push(this.paper.path(this.path).attr({stroke:e.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(e.width/i*s).toFixed(3),opacity:+((e.opacity||.3)/i).toFixed(3),transform:this.attributes.transform,scale:this.attributes.scale}))}return t}fill(){const t=this.paper.path(this.path).attr(this.attributes).attr("stroke-width",0);return this.glow(t),this}stroke(){const t=this.lineWidth*(this.state.scale.x+this.state.scale.y)/2,e=this.paper.path(this.path).attr(this.attributes).attr("fill","none").attr("stroke-width",t);return this.glow(e),this}closePath(){return this.path+="Z",this}measureText(t){const e=this.paper.text(0,0,t).attr(this.attributes).attr("fill","none").attr("stroke","none"),i=e.getBBox();return e.remove(),{width:i.width,height:i.height}}fillText(t,e,i){return this.paper.text(e+this.measureText(t).width/2,i-this.state.font_size/(2.25*this.state.scale.y),t).attr(this.attributes),this}save(){return this.state_stack.push({state:{font_family:this.state.font_family},attributes:{font:this.attributes.font,fill:this.attributes.fill,stroke:this.attributes.stroke,"stroke-width":this.attributes["stroke-width"]},shadow_attributes:{width:this.shadow_attributes.width,color:this.shadow_attributes.color}}),this}restore(){const t=this.state_stack.pop();return this.state.font_family=t.state.font_family,this.attributes.font=t.attributes.font,this.attributes.fill=t.attributes.fill,this.attributes.stroke=t.attributes.stroke,this.attributes["stroke-width"]=t.attributes["stroke-width"],this.shadow_attributes.width=t.shadow_attributes.width,this.shadow_attributes.color=t.shadow_attributes.color,this}}const Er={path:{x:!0,y:!0,width:!0,height:!0},rect:{},text:{width:!0,height:!0}};{const n={"font-family":!0,"font-weight":!0,"font-style":!0,"font-size":!0};M.Merge(Er.rect,n),M.Merge(Er.path,n)}class ec{constructor(t){this.element=t,this.svgNS="http://www.w3.org/2000/svg";const e=this.create("svg");this.element.appendChild(e),this.svg=e,this.groups=[this.svg],this.parent=this.svg,this.path="",this.pen={x:NaN,y:NaN},this.lineWidth=1,this.state={scale:{x:1,y:1},"font-family":"Arial","font-size":"8pt","font-weight":"normal"},this.attributes={"stroke-width":.3,fill:"black",stroke:"black","stroke-dasharray":"none","font-family":"Arial","font-size":"10pt","font-weight":"normal","font-style":"normal"},this.background_attributes={"stroke-width":0,fill:"white",stroke:"white","stroke-dasharray":"none","font-family":"Arial","font-size":"10pt","font-weight":"normal","font-style":"normal"},this.shadow_attributes={width:0,color:"black"},this.state_stack=[],this.iePolyfill()}create(t){return document.createElementNS(this.svgNS,t)}openGroup(t,e,i){const s=this.create("g");return this.groups.push(s),this.parent.appendChild(s),this.parent=s,t&&s.setAttribute("class",M.Prefix(t)),e&&s.setAttribute("id",M.Prefix(e)),i&&i.pointerBBox&&s.setAttribute("pointer-events","bounding-box"),s}closeGroup(){this.groups.pop(),this.parent=this.groups[this.groups.length-1]}add(t){this.parent.appendChild(t)}iePolyfill(){typeof navigator!="undefined"&&(this.ie=/MSIE 9/i.test(navigator.userAgent)||/MSIE 10/i.test(navigator.userAgent)||/rv:11\.0/i.test(navigator.userAgent)||/Trident/i.test(navigator.userAgent))}setFont(t,e,i){let s=!1,r=!1,o="normal";typeof i=="string"&&(i.indexOf("italic")!==-1&&(i=i.replace(/italic/g,""),r=!0),i.indexOf("bold")!==-1&&(i=i.replace(/bold/g,""),s=!0),i=i.replace(/ /g,"")),i=s?"bold":i,i=typeof i=="undefined"||i===""?"normal":i,o=r?"italic":o;const a={"font-family":t,"font-size":e+"pt","font-weight":i,"font-style":o};return this.fontSize=Number(e),M.Merge(this.attributes,a),M.Merge(this.state,a),this}setRawFont(t){t=t.trim();const e=t.split(" ");return this.attributes["font-family"]=e[1],this.state["font-family"]=e[1],this.attributes["font-size"]=e[0],this.state["font-size"]=e[0],this.fontSize=Number(e[0].match(/\d+/)),this}setFillStyle(t){return this.attributes.fill=t,this}setBackgroundFillStyle(t){return this.background_attributes.fill=t,this.background_attributes.stroke=t,this}setStrokeStyle(t){return this.attributes.stroke=t,this}setShadowColor(t){return this.shadow_attributes.color=t,this}setShadowBlur(t){return this.shadow_attributes.width=t,this}setLineWidth(t){this.attributes["stroke-width"]=t,this.lineWidth=t}setLineDash(t){if(Object.prototype.toString.call(t)==="[object Array]")return t=t.join(", "),this.attributes["stroke-dasharray"]=t,this;throw new M.RERR("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;const i={width:t,height:e};return this.applyAttributes(this.svg,i),this.scale(this.state.scale.x,this.state.scale.y),this}scale(t,e){this.state.scale={x:t,y:e};const i=this.width/t,s=this.height/e;return this.setViewBox(0,0,i,s),this}setViewBox(...t){if(t.length===1){const[e]=t;this.svg.setAttribute("viewBox",e)}else{const[e,i,s,r]=t,o=e+" "+i+" "+s+" "+r;this.svg.setAttribute("viewBox",o)}}applyAttributes(t,e){const i=Er[t.nodeName];return Object.keys(e).forEach(s=>{var r;i&&i[s]||!s||!e[s]||s==="d"&&((r=e[s])==null?void 0:r.indexOf("NaN"))>-1||t.setAttributeNS(null,s,e[s])}),t}clear(){for(;this.svg.lastChild;)this.svg.removeChild(this.svg.lastChild);this.scale(this.state.scale.x,this.state.scale.y)}rect(t,e,i,s,r){s<0&&(e+=s,s*=-1);const o=this.create("rect");return typeof r=="undefined"&&(r={fill:"none","stroke-width":this.lineWidth,stroke:"black"}),M.Merge(r,{x:t,y:e,width:i,height:s}),this.applyAttributes(o,r),this.add(o),this}fillRect(t,e,i,s){return s<0&&(e+=s,s*=-1),this.rect(t,e,i,s,this.attributes),this}clearRect(t,e,i,s){return this.rect(t,e,i,s,this.background_attributes),this}beginPath(){return this.path="",this.pen.x=NaN,this.pen.y=NaN,this}moveTo(t,e){return this.path+="M"+t+" "+e,this.pen.x=t,this.pen.y=e,this}lineTo(t,e){return this.path+="L"+t+" "+e,this.pen.x=t,this.pen.y=e,this}bezierCurveTo(t,e,i,s,r,o){return this.path+="C"+t+" "+e+","+i+" "+s+","+r+" "+o,this.pen.x=r,this.pen.y=o,this}quadraticCurveTo(t,e,i,s){return this.path+="Q"+t+" "+e+","+i+" "+s,this.pen.x=i,this.pen.y=s,this}arc(t,e,i,s,r,o){function a(h){for(;h<0;)h+=Math.PI*2;for(;h>Math.PI*2;)h-=Math.PI*2;return h}if(s=a(s),r=a(r),s>r){const h=s;s=r,r=h,o=!o}const l=r-s;return l>Math.PI?(this.arcHelper(t,e,i,s,s+l/2,o),this.arcHelper(t,e,i,s+l/2,r,o)):this.arcHelper(t,e,i,s,r,o),this}arcHelper(t,e,i,s,r,o){const a=t+i*Math.cos(s),l=e+i*Math.sin(s),h=t+i*Math.cos(r),c=e+i*Math.sin(r);let u=0,f=0;o?(f=1,r-s<Math.PI&&(u=1)):r-s>Math.PI&&(u=1),this.path+="M"+a+" "+l+" A"+i+" "+i+" 0 "+u+" "+f+" "+h+" "+c,!isNaN(this.pen.x)&&!isNaN(this.pen.y)&&(this.peth+="M"+this.pen.x+" "+this.pen.y)}closePath(){return this.path+="Z",this}glow(){if(this.shadow_attributes.width>0){const t=this.shadow_attributes,e=t.width/2;for(let i=1;i<=e;i++){const s={stroke:t.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(t.width*.4/e*i).toFixed(3),opacity:+((t.opacity||.3)/e).toFixed(3)},r=this.create("path");s.d=this.path,this.applyAttributes(r,s),this.add(r)}}return this}fill(t){this.glow();const e=this.create("path");let i=t;return typeof t=="undefined"?(t={},M.Merge(t,this.attributes),t.stroke="none",i=t):(i=t,M.Merge(i,this.attributes),t.class&&(i.class=t.class),t.id&&(i.id=t.id)),t.d=this.path,this.applyAttributes(e,t),this.add(e),this}stroke(t=void 0){this.glow();const e=this.create("path"),i={};return M.Merge(i,this.attributes),t&&M.Merge(i,t),i.fill="none",i["stroke-width"]=this.lineWidth,i.d=this.path,this.applyAttributes(e,i),this.add(e),this}measureText(t){const e=this.create("text");if(typeof e.getBBox!="function")return{x:0,y:0,width:0,height:0};e.textContent=t,this.applyAttributes(e,this.attributes),this.svg.appendChild(e);let i=e.getBBox();return this.ie&&t!==""&&this.attributes["font-style"]==="italic"&&(i=this.ieMeasureTextFix(i,t)),this.svg.removeChild(e),i}ieMeasureTextFix(t){const e=Number(this.fontSize),i=1.196,s=1.9598,r=i*e+s,o=t.width-r,a=t.height-1.5;return{x:t.x,y:t.y,width:o,height:a}}fillText(t,e,i){if(!t||t.length<=0)return;const s={};M.Merge(s,this.attributes),s.stroke="none",s.x=e,s.y=i;const r=this.create("text");r.textContent=t,this.applyAttributes(r,s),this.add(r)}save(){return this.state_stack.push({state:{"font-family":this.state["font-family"],"font-weight":this.state["font-weight"],"font-style":this.state["font-style"],"font-size":this.state["font-size"],scale:this.state.scale},attributes:{"font-family":this.attributes["font-family"],"font-weight":this.attributes["font-weight"],"font-style":this.attributes["font-style"],"font-size":this.attributes["font-size"],fill:this.attributes.fill,stroke:this.attributes.stroke,"stroke-width":this.attributes["stroke-width"],"stroke-dasharray":this.attributes["stroke-dasharray"]},shadow_attributes:{width:this.shadow_attributes.width,color:this.shadow_attributes.color},lineWidth:this.lineWidth}),this}restore(){const t=this.state_stack.pop();return this.state["font-family"]=t.state["font-family"],this.state["font-weight"]=t.state["font-weight"],this.state["font-style"]=t.state["font-style"],this.state["font-size"]=t.state["font-size"],this.state.scale=t.state.scale,this.attributes["font-family"]=t.attributes["font-family"],this.attributes["font-weight"]=t.attributes["font-weight"],this.attributes["font-style"]=t.attributes["font-style"],this.attributes["font-size"]=t.attributes["font-size"],this.attributes.fill=t.attributes.fill,this.attributes.stroke=t.attributes.stroke,this.attributes["stroke-width"]=t.attributes["stroke-width"],this.attributes["stroke-dasharray"]=t.attributes["stroke-dasharray"],this.shadow_attributes.width=t.shadow_attributes.width,this.shadow_attributes.color=t.shadow_attributes.color,this.lineWidth=t.lineWidth,this}}let Go=null;class Zt{static get Backends(){return{CANVAS:1,RAPHAEL:2,SVG:3,VML:4}}static get LineEndType(){return{NONE:1,UP:2,DOWN:3}}static get USE_CANVAS_PROXY(){return!1}static get lastContext(){return Go}static set lastContext(t){Go=t}static buildContext(t,e,i,s,r){const o=new Zt(t,e);i&&s&&o.resize(i,s),r||(r="#FFF");const a=o.getContext();return a.setBackgroundFillStyle(r),Zt.lastContext=a,a}static getCanvasContext(t,e,i,s){return Zt.buildContext(t,Zt.Backends.CANVAS,e,i,s)}static getRaphaelContext(t,e,i,s){return Zt.buildContext(t,Zt.Backends.RAPHAEL,e,i,s)}static getSVGContext(t,e,i,s){return Zt.buildContext(t,Zt.Backends.SVG,e,i,s)}static bolsterCanvasContext(t){if(Zt.USE_CANVAS_PROXY)return new gs(t);const e=["clear","setFont","setRawFont","setFillStyle","setBackgroundFillStyle","setStrokeStyle","setShadowColor","setShadowBlur","setLineWidth","setLineCap","setLineDash","openGroup","closeGroup","getGroup"];return t.vexFlowCanvasContext=t,e.forEach(i=>{t[i]=t[i]||gs.prototype[i]}),t}static drawDashedLine(t,e,i,s,r,o){t.beginPath();const a=s-e,l=r-i,h=Math.atan2(l,a);let c=e,u=i;t.moveTo(e,i);let f=0,d=!0;for(;!((a<0?c<=s:c>=s)&&(l<0?u<=r:u>=r));){const p=o[f++%o.length],g=c+Math.cos(h)*p;c=a<0?Math.max(s,g):Math.min(s,g);const m=u+Math.sin(h)*p;u=l<0?Math.max(r,m):Math.min(r,m),d?t.lineTo(c,u):t.moveTo(c,u),d=!d}t.closePath(),t.stroke()}constructor(t,e){if(this.elementId=t,!this.elementId)throw new M.RERR("BadArgument","Invalid id for renderer.");if(this.element=document.getElementById(t),this.element||(this.element=t),this.ctx=null,this.paper=null,this.backend=e,this.backend===Zt.Backends.CANVAS){if(!this.element.getContext)throw new M.RERR("BadElement",`Can't get canvas context from element: ${t}`);this.ctx=Zt.bolsterCanvasContext(this.element.getContext("2d"))}else if(this.backend===Zt.Backends.RAPHAEL)this.ctx=new tc(this.element);else if(this.backend===Zt.Backends.SVG)this.ctx=new ec(this.element);else throw new M.RERR("InvalidBackend",`No support for backend: ${this.backend}`)}resize(t,e){if(this.backend===Zt.Backends.CANVAS){if(!this.element.getContext)throw new M.RERR("BadElement",`Can't get canvas context from element: ${this.elementId}`);[t,e]=gs.SanitizeCanvasDims(t,e);const i=window.devicePixelRatio||1;this.element.width=t*i,this.element.height=e*i,this.element.style.width=t+"px",this.element.style.height=e+"px",this.ctx=Zt.bolsterCanvasContext(this.element.getContext("2d")),this.ctx.scale(i,i)}else this.ctx.resize(t,e);return this}getContext(){return this.ctx}}function ic(...n){ft.DEBUG&&M.L("Vex.Flow.Stem",n)}class ft extends he{static get CATEGORY(){return"stem"}static get UP(){return 1}static get DOWN(){return-1}static get WIDTH(){return V.STEM_WIDTH}static get HEIGHT(){return V.STEM_HEIGHT}constructor(t={}){super(),this.setAttribute("type","Stem"),this.x_begin=t.x_begin||0,this.x_end=t.x_end||0,this.y_top=t.y_top||0,this.y_bottom=t.y_bottom||0,this.stem_extension=t.stem_extension||0,this.stem_direction=t.stem_direction||0,this.hide=t.hide||!1,this.isStemlet=t.isStemlet||!1,this.stemletHeight=t.stemletHeight||0,this.resetHeight=0,this.renderHeightAdjustment=0,this.setOptions(t)}setResetHeight(t){this.resetHeight=t}setOptions(t){this.stem_up_y_offset=t.stem_up_y_offset||0,this.stem_down_y_offset=t.stem_down_y_offset||0}setNoteHeadXBounds(t,e){return this.x_begin=t,this.x_end=e,this}setDirection(t){this.stem_direction=t}setExtension(t){this.stem_extension=t}getExtension(){return this.stem_extension}setYBounds(t,e){this.y_top=t,this.y_bottom=e}getCategory(){return ft.CATEGORY}getHeight(){const t=this.stem_direction===ft.UP?this.stem_up_y_offset:this.stem_down_y_offset;return(this.y_bottom-this.y_top)*this.stem_direction+(ft.HEIGHT-t+this.stem_extension)*this.stem_direction}getBoundingBox(){throw new M.RERR("NotImplemented","getBoundingBox() not implemented.")}getExtents(){const t=this.stem_direction===ft.UP,e=[this.y_top,this.y_bottom],i=ft.HEIGHT+this.stem_extension,s=(t?Math.min:Math.max)(...e),r=(t?Math.max:Math.min)(...e);return{topY:s+i*-this.stem_direction+this.resetHeight*-this.stem_direction,baseY:r}}setVisibility(t){return this.hide=!t,this}setStemlet(t,e){return this.isStemlet=t,this.stemletHeight=e,this}draw(){if(this.setRendered(),this.hide)return;const t=this.checkContext();let e,i;const s=this.stem_direction;s===ft.DOWN?(e=this.x_begin,i=this.y_top+this.stem_down_y_offset):(e=this.x_end,i=this.y_bottom-this.stem_up_y_offset);const r=this.getHeight();ic("Rendering stem - ","Top Y: ",this.y_top,"Bottom Y: ",this.y_bottom);const o=this.isStemlet?r-this.stemletHeight*this.stem_direction:0;if(t.save(),this.applyStyle(t),t.beginPath(),t.setLineWidth(ft.WIDTH),t.moveTo(e,i-o),t.lineTo(e,i-r-this.renderHeightAdjustment*s-this.resetHeight*s),t.svg){const a={class:M.Prefix("stem")};this.id&&(a.id=this.id),t.stroke(a)}else t.stroke();this.restoreStyle(t),t.restore()}}class He extends he{static get LOCATION_TOP(){return 1}static get LOCATION_BOTTOM(){return-1}static get NESTING_OFFSET(){return 15}constructor(t,e){if(super(),this.setAttribute("type","Tuplet"),!t||!t.length)throw new M.RuntimeError("BadArguments","No notes provided for tuplet.");this.options=M.Merge({},e),this.notes=t,this.num_notes="num_notes"in this.options?this.options.num_notes:t.length,this.options.beats_occupied&&this.beatsOccupiedDeprecationWarning(),this.notes_occupied=this.options.notes_occupied||this.options.beats_occupied||2,"bracketed"in this.options?this.bracketed=this.options.bracketed:this.bracketed=t.some(i=>i.beam===null),this.ratioed="ratioed"in this.options?this.options.ratioed:Math.abs(this.notes_occupied-this.num_notes)>1,this.point=28,this.y_pos=16,this.x_pos=100,this.width=200,this.location=this.options.location||He.LOCATION_TOP,si.AlignRestsToNotes(t,!0,!0),this.resolveGlyphs(),this.attach()}attach(){for(let t=0;t<this.notes.length;t++)this.notes[t].setTuplet(this)}detach(){for(let t=0;t<this.notes.length;t++)this.notes[t].resetTuplet(this)}setBracketed(t){return this.bracketed=!!t,this}setRatioed(t){return this.ratioed=!!t,this}setTupletLocation(t){if(!t)t=He.LOCATION_TOP;else if(t!==He.LOCATION_TOP&&t!==He.LOCATION_BOTTOM)throw new M.RERR("BadArgument","Invalid tuplet location: "+t);return this.location=t,this}getNotes(){return this.notes}getNoteCount(){return this.num_notes}beatsOccupiedDeprecationWarning(){const t=["beats_occupied has been deprecated as an ","option for tuplets. Please use notes_occupied ","instead. Calls to getBeatsOccupied and ","setBeatsOccupied should now be routed to ","getNotesOccupied and setNotesOccupied instead"].join("");console&&console.warn?console.warn(t):console&&console.log(t)}getBeatsOccupied(){return this.beatsOccupiedDeprecationWarning(),this.getNotesOccupied()}setBeatsOccupied(t){return this.beatsOccupiedDeprecationWarning(),this.setNotesOccupied(t)}getNotesOccupied(){return this.notes_occupied}setNotesOccupied(t){this.detach(),this.notes_occupied=t,this.resolveGlyphs(),this.attach()}resolveGlyphs(){this.numerator_glyphs=[];let t=this.num_notes;for(;t>=1;)this.numerator_glyphs.unshift(new xt("v"+t%10,this.point)),t=parseInt(t/10,10);for(this.denom_glyphs=[],t=this.notes_occupied;t>=1;)this.denom_glyphs.unshift(new xt("v"+t%10,this.point)),t=parseInt(t/10,10)}getNestedTupletCount(){const t=this.location,e=this.notes[0];let i=r(e,t),s=r(e,t);function r(o,a){return o.tupletStack.filter(l=>l.location===a).length}return this.notes.forEach(o=>{const a=r(o,t);i=a>i?a:i,s=a<s?a:s}),i-s}getYPosition(){const t=this.getNestedTupletCount()*He.NESTING_OFFSET*-this.location,e=this.options.y_offset||0,i=this.notes[0];let s;if(this.location===He.LOCATION_TOP){s=i.getStave().getYForLine(0)-15;for(let r=0;r<this.notes.length;++r){const o=this.notes[r].getStemDirection()===ft.UP?this.notes[r].getStemExtents().topY-10:this.notes[r].getStemExtents().baseY-20;o<s&&(s=o)}}else{s=i.getStave().getYForLine(4)+20;for(let r=0;r<this.notes.length;++r){const o=this.notes[r].getStemDirection()===ft.UP?this.notes[r].getStemExtents().baseY+20:this.notes[r].getStemExtents().topY+10;o>s&&(s=o)}}return s+t+e}draw(){this.checkContext(),this.setRendered();const t=this.notes[0],e=this.notes[this.notes.length-1];this.bracketed?(this.x_pos=t.getTieLeftX()-5,this.width=e.getTieRightX()-this.x_pos+5):(this.x_pos=t.getStemX(),this.width=e.getStemX()-this.x_pos),this.y_pos=this.getYPosition();const i=(l,h)=>l+h.getMetrics().width;let s=this.numerator_glyphs.reduce(i,0);this.ratioed&&(s=this.denom_glyphs.reduce(i,s),s+=this.point*.32);const o=this.x_pos+this.width/2-s/2;if(this.bracketed){const l=this.width/2-s/2-5;l>0&&(this.context.fillRect(this.x_pos,this.y_pos,l,1),this.context.fillRect(this.x_pos+this.width/2+s/2+5,this.y_pos,l,1),this.context.fillRect(this.x_pos,this.y_pos+(this.location===He.LOCATION_BOTTOM),1,this.location*10),this.context.fillRect(this.x_pos+this.width,this.y_pos+(this.location===He.LOCATION_BOTTOM),1,this.location*10))}let a=0;if(this.numerator_glyphs.forEach(l=>{l.render(this.context,o+a,this.y_pos+this.point/3-2),a+=l.getMetrics().width}),this.ratioed){const l=o+a+this.point*.16,h=this.point*.06;this.context.beginPath(),this.context.arc(l,this.y_pos-this.point*.08,h,0,Math.PI*2,!0),this.context.closePath(),this.context.fill(),this.context.beginPath(),this.context.arc(l,this.y_pos+this.point*.12,h,0,Math.PI*2,!0),this.context.closePath(),this.context.fill(),a+=this.point*.32,this.denom_glyphs.forEach(c=>{c.render(this.context,o+a,this.y_pos+this.point/3-2),a+=c.getMetrics().width})}}}function Wo(n){let t=0;return n.forEach(e=>{e.keyProps&&e.keyProps.forEach(i=>{t+=i.line-3})}),t>=0?ft.DOWN:ft.UP}const sc=(n,t)=>{const e=n.getStemExtents().topY,i=n.getStemX(),s=t.getStemExtents().topY,r=t.getStemX();return(s-e)/(r-i)},ur="L",nc="R",Uo="B";class Vi extends he{static getDefaultBeamGroups(t){(!t||t==="c")&&(t="4/4");const i={"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(i===void 0){const s=parseInt(t.split("/")[0],10),r=parseInt(t.split("/")[1],10);if(s%3===0)return[new Rt(3,r)];if(r>4)return[new Rt(2,r)];if(r<=4)return[new Rt(1,r)]}else return i.map(s=>new Rt().parse(s));return[new Rt(1,4)]}static applyAndGetBeams(t,e,i){return Vi.generateBeams(t.getTickables(),{groups:i,stem_direction:e})}static generateBeams(t,e){e||(e={}),(!e.groups||!e.groups.length)&&(e.groups=[new Rt(2,8)]);const i=e.groups.map(x=>{if(!x.multiply)throw new M.RuntimeError("InvalidBeamGroups","The beam groups must be an array of Vex.Flow.Fractions");return x.clone().multiply(V.RESOLUTION,1)}),s=t;let r=0,o=[],a=[];function l(x){return x.reduce((w,T)=>T.getTicks().clone().add(w),new Rt(0,1))}function h(){i.length-1>r?r+=1:r=0}function c(){let x=[];s.forEach(w=>{if(x=[],w.shouldIgnoreTicks()){o.push(a),a=x;return}a.push(w);const T=i[r].clone(),E=l(a),C=V.durationToNumber(w.duration)<8;C&&w.tuplet&&(T.numerator*=2),E.greaterThan(T)?(C||x.push(a.pop()),o.push(a),a=x,h()):E.equals(T)&&(o.push(a),a=x,h())}),a.length>0&&o.push(a)}function u(){return o.filter(x=>{if(x.length>1){let w=!0;return x.forEach(T=>{T.getIntrinsicTicks()>=V.durationToTicks("4")&&(w=!1)}),w}return!1})}function f(){const x=[];o.forEach(w=>{let T=[];w.forEach((E,C,P)=>{const I=C===0||C===P.length-1,F=P[C-1],L=!e.beam_rests&&E.isRest(),k=e.beam_rests&&e.beam_middle_only&&E.isRest()&&I;let v=!1;if(e.maintain_stem_directions&&F&&!E.isRest()&&!F.isRest()){const H=F.getStemDirection();v=E.getStemDirection()!==H}const G=parseInt(E.duration,10)<8;L||k||v||G?(T.length>0&&x.push(T),T=v?[E]:[]):T.push(E)}),T.length>0&&x.push(T)}),o=x}function d(){o.forEach(x=>{let w;if(e.maintain_stem_directions){const T=p(x);w=T?T.getStemDirection():ft.UP}else e.stem_direction?w=e.stem_direction:w=Wo(x);g(x,w)})}function p(x){for(let w=0;w<x.length;w++){const T=x[w];if(!T.isRest())return T}return!1}function g(x,w){x.forEach(T=>{T.setStemDirection(w)})}function m(){const x=[];return o.forEach(w=>{let T=null;w.forEach(E=>{E.tuplet&&T!==E.tuplet&&(T=E.tuplet,x.push(T))})}),x}c(),f(),d();const S=u(),b=m(),y=[];return S.forEach(x=>{const w=new Vi(x);e.show_stemlets&&(w.render_options.show_stemlets=!0),e.secondary_breaks&&(w.render_options.secondary_break_ticks=V.durationToTicks(e.secondary_breaks)),e.flat_beams===!0&&(w.render_options.flat_beams=!0,w.render_options.flat_beam_offset=e.flat_beam_offset),y.push(w)}),b.forEach(x=>{const w=x.notes[0].stem_direction===ft.DOWN?He.LOCATION_BOTTOM:He.LOCATION_TOP;x.setTupletLocation(w);let T=!1;for(let E=0;E<x.notes.length;E++)if(x.notes[E].beam===null){T=!0;break}x.setBracketed(T)}),y}constructor(t,e){if(super(),this.setAttribute("type","Beam"),!t||t===[])throw new M.RuntimeError("BadArguments","No notes provided for beam.");if(t.length===1)throw new M.RuntimeError("BadArguments","Too few notes for beam.");if(this.ticks=t[0].getIntrinsicTicks(),this.ticks>=V.durationToTicks("4"))throw new M.RuntimeError("BadArguments","Beams can only be applied to notes shorter than a quarter note.");let i,s;for(this.stem_direction=ft.UP,i=0;i<t.length;++i)if(s=t[i],s.hasStem()){this.stem_direction=s.getStemDirection();break}let r=this.stem_direction;for(e&&t[0].getCategory()==="stavenotes"?r=Wo(t):e&&t[0].getCategory()==="tabnotes"&&(r=t.reduce((a,l)=>a+l.stem_direction,0)>-1?ft.UP:ft.DOWN),i=0;i<t.length;++i)s=t[i],e&&(s.setStemDirection(r),this.stem_direction=r),s.setBeam(this);this.postFormatted=!1,this.notes=t,this.beam_count=this.getBeamCount(),this.break_on_indices=[],this.render_options={beam_width:5,max_slope:.25,min_slope:-.25,slope_iterations:20,slope_cost:100,show_stemlets:!1,stemlet_extension:7,partial_beam_length:10,flat_beams:!1,min_flat_beam_offset:15}}getNotes(){return this.notes}getBeamCount(){return this.notes.map(i=>i.getGlyph().beam_count).reduce((i,s)=>s>i?s:i)}breakSecondaryAt(t){return this.break_on_indices=t,this}getSlopeY(t,e,i,s){return i+(t-e)*s}calculateSlope(){const{notes:t,stem_direction:e,render_options:{max_slope:i,min_slope:s,slope_iterations:r,slope_cost:o}}=this,a=t[0],l=sc(a,t[t.length-1]),h=(i-s)/r;let c=Number.MAX_VALUE,u=0,f=0;for(let d=s;d<=i;d+=h){let p=0,g=0;for(let y=1;y<t.length;++y){const x=t[y],w=this.getSlopeY(x.getStemX(),a.getStemX(),a.getStemExtents().topY,d)+g,T=x.getStemExtents().topY;if(T*e<w*e){const E=Math.abs(T-w);g+=E*-e,p+=E*y}else p+=(T-w)*e}const m=l/2,S=Math.abs(m-d),b=o*S+Math.abs(p);b<c&&(c=b,u=d,f=g)}this.slope=u,this.y_shift=f}calculateFlatSlope(){const{notes:t,stem_direction:e,render_options:{beam_width:i,min_flat_beam_offset:s,flat_beam_offset:r}}=this;let o=0,a=0,l=0,h=0;for(let p=0;p<t.length;p++){const g=t[p],m=g.getStemExtents().topY;o+=m,e===ft.DOWN&&h<m?(h=m,a=Math.max(...g.getYs()),l=g.getBeamCount()):e===ft.UP&&(h===0||h>m)&&(h=m,a=Math.min(...g.getYs()),l=g.getBeamCount())}let c=o/t.length;const u=i*1.5,f=s+l*u,d=a+f*-e;e===ft.DOWN&&c<d?c=a+f:e===ft.UP&&c>d&&(c=a-f),r+this.render_options.flat_beam_offset_per_beam>0?e===ft.DOWN&&c>r&&!this.render_options.flat_beams?this.render_options.flat_beam_offset=c:e===ft.UP&&c<r&&!this.render_options.flat_beams&&(this.render_options.flat_beam_offset=c):this.render_options.flat_beam_offset=c,this.slope=0,this.y_shift=0}getBeamYToDraw(){let i=this.notes[0].getStemExtents().topY;if(this.render_options.flat_beams&&this.render_options.flat_beam_offset+this.render_options.flat_beam_offset_per_beam>0){let s=this.render_options.flat_beam_offset;this.render_options.flat_beam_offset_per_beam&&(s+=this.render_options.flat_beam_offset_per_beam*this.getBeamCount());let r=this.notes[0].note_heads[0].y;const o=this.stem_direction>0?Math.min:Math.max;for(const a of this.notes)for(const l of a.note_heads)r=o(r,l.y);i=r+s*-this.stem_direction}return i}applyStemExtensions(){const{notes:t,slope:e,y_shift:i,stem_direction:s,beam_count:r,render_options:{show_stemlets:o,stemlet_extension:a,beam_width:l}}=this,h=t[0],c=this.getBeamYToDraw(),u=h.getStemX();for(let f=0;f<t.length;++f){const d=t[f],p=d.getStemX(),{topY:g}=d.getStemExtents(),m=this.getSlopeY(p,u,c,e)+i,S=d.getStem().getExtension(),b=s===ft.UP?g-m:m-g;if(d.stem.setExtension(S+b),d.stem.renderHeightAdjustment=-ft.WIDTH/2,d.isRest()&&o){const y=l,x=(r-1)*y*1.5+y;d.stem.setVisibility(!0).setStemlet(!0,x+a)}}}lookupBeamDirection(t,e,i,s){if(t==="4")return ur;const r=`${V.durationToNumber(t)/2}`,o=e<V.durationToTicks(r),a=s<V.durationToTicks(r),l=i<V.durationToTicks(r);return o&&a&&l?Uo:o&&!a&&l?ur:!o&&a&&l?nc:this.lookupBeamDirection(r,e,i,s)}getBeamLines(t){const e=V.durationToTicks(t),i=[];let s=!1,r=null;const o=this.render_options.partial_beam_length;let a=!1,l=0;for(let c=0;c<this.notes.length;++c){const u=this.notes[c];l+=u.ticks.value();let d=!1;parseInt(t,10)>=8&&(d=this.break_on_indices.indexOf(c)!==-1,this.render_options.secondary_break_ticks&&l>=this.render_options.secondary_break_ticks&&(l=0,d=!0));const p=u.getIntrinsicTicks()<e,g=u.getStemX()-ft.WIDTH/2,m=this.notes[c-1],S=this.notes[c+1],b=S&&S.getIntrinsicTicks()<e,y=m&&m.getIntrinsicTicks()<e,x=m&&S&&p&&!y&&!b;if(p)if(s)r=i[i.length-1],r.end=g,d&&(s=!1,S&&!b&&r.end===null&&(r.end=r.start-o));else{if(r={start:g,end:null,start_note:u},s=!0,x){const w=m.getIntrinsicTicks(),T=S.getIntrinsicTicks(),E=u.getIntrinsicTicks(),C=this.lookupBeamDirection(t,w,E,T);[ur,Uo].includes(C)?r.end=r.start-o:r.end=r.start+o}else b?d&&(r.end=r.start-o,s=!1):(a||c===0)&&S?r.end=r.start+o:r.end=r.start-o;i.push(r)}else s=!1;a=d}const h=i[i.length-1];return h&&h.end===null&&(h.end=h.start-o),i}drawStems(){this.notes.forEach(t=>{t.getStem()&&(this.context.openGroup("stem",t.getAttribute("id")+"-stem"),t.getStem().setContext(this.context).draw(),this.context.closeGroup())},this)}drawBeamLines(){this.checkContext();const t=["4","8","16","32","64"],e=this.notes[0];let i=this.getBeamYToDraw();const s=e.getStemX(),r=this.render_options.beam_width*this.stem_direction,o={};for(const a of this.notes)o[a.getAttribute("id")]=0;for(let a=0;a<t.length;++a){const l=t[a],h=this.getBeamLines(l);for(let c=0;c<h.length;++c){const u=h[c],f=u.start,d=u.start_note.getAttribute("id"),p=o[d];o[d]++;const g=this.getSlopeY(f,s,i,this.slope),m=u.end,S=this.getSlopeY(m,s,i,this.slope),b=d;this.context.openGroup("beam",`${b}-beam${p}`),this.context.beginPath(),this.context.moveTo(f,g),this.context.lineTo(f,g+r),this.context.lineTo(m+1,S+r),this.context.lineTo(m+1,S),this.context.closePath(),this.context.fill(),this.context.closeGroup()}i+=r*1.5}}preFormat(){return this}postFormat(){this.postFormatted||(this.notes[0].getCategory()==="tabnotes"||this.render_options.flat_beams?this.calculateFlatSlope():this.calculateSlope(),this.applyStemExtensions(),this.postFormatted=!0)}draw(){this.checkContext(),this.setRendered(),!this.unbeamable&&(this.postFormatted||this.postFormat(),this.drawStems(),this.applyStyle(),this.drawBeamLines(),this.restoreStyle())}}class ye extends he{static get Mode(){return{STRICT:1,SOFT:2,FULL:3}}constructor(t){if(super(),this.setAttribute("type","Voice"),typeof t=="string"){const e=t.match(/(\d+)\/(\d+)/);e&&(t={num_beats:e[1],beat_value:e[2],resolution:V.RESOLUTION})}this.time=M.Merge({num_beats:4,beat_value:4,resolution:V.RESOLUTION},t),this.totalTicks=new Rt(this.time.num_beats*(this.time.resolution/this.time.beat_value),1),this.resolutionMultiplier=1,this.tickables=[],this.ticksUsed=new Rt(0,1),this.smallestTickCount=this.totalTicks.clone(),this.largestTickWidth=0,this.stave=null,this.mode=ye.Mode.STRICT,this.voiceGroup=null}getTotalTicks(){return this.totalTicks}getTicksUsed(){return this.ticksUsed}getLargestTickWidth(){return this.largestTickWidth}getSmallestTickCount(){return this.smallestTickCount}getTickables(){return this.tickables}getMode(){return this.mode}setMode(t){return this.mode=t,this}getResolutionMultiplier(){return this.resolutionMultiplier}getActualResolution(){return this.resolutionMultiplier*this.time.resolution}setStave(t){return this.stave=t,this.boundingBox=null,this}getBoundingBox(){let t,e,i,s;if(!this.boundingBox){if(!this.stave)throw new M.RERR("NoStave","Can't get bounding box without stave.");for(t=this.stave,e=null,s=0;s<this.tickables.length;++s)this.tickables[s].setStave(t),i=this.tickables[s].getBoundingBox(),i&&(e=e?e.mergeWith(i):i);this.boundingBox=e}return this.boundingBox}getVoiceGroup(){if(!this.voiceGroup)throw new M.RERR("NoVoiceGroup","No voice group for voice.");return this.voiceGroup}setVoiceGroup(t){return this.voiceGroup=t,this}setStrict(t){return this.mode=t?ye.Mode.STRICT:ye.Mode.SOFT,this}isComplete(){return this.mode===ye.Mode.STRICT||this.mode===ye.Mode.FULL?this.ticksUsed.equals(this.totalTicks):!0}addTickable(t){if(!t.shouldIgnoreTicks()){const e=t.getTicks();if(this.ticksUsed.add(e),(this.mode===ye.Mode.STRICT||this.mode===ye.Mode.FULL)&&this.ticksUsed.greaterThan(this.totalTicks))throw this.ticksUsed.subtract(e),new M.RERR("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(){return this.preFormatted?this:(this.tickables.forEach(t=>{t.getStave()||t.setStave(this.stave)}),this.preFormatted=!0,this)}draw(t=this.context,e=this.stave){this.setRendered();let i=null;for(let s=0;s<this.tickables.length;++s){const r=this.tickables[s];if(e&&r.setStave(e),!r.getStave())throw new M.RuntimeError("MissingStave","The voice cannot draw tickables without staves.");if(s===0&&(i=r.getBoundingBox()),s>0&&i){const o=r.getBoundingBox();o&&i.mergeWith(o)}r.setContext(t),r.drawWithStyle()}this.boundingBox=i}}function zo(n,t,e,i,s){if(t!==Bt.type.BOLD_DOUBLE_LEFT&&t!==Bt.type.BOLD_DOUBLE_RIGHT)throw new M.RERR("InvalidConnector","A REPEAT_BEGIN or REPEAT_END type must be provided.");let r=3,o=3.5;const a=2;t===Bt.type.BOLD_DOUBLE_RIGHT&&(r=-5,o=3),n.fillRect(e+r,i,1,s-i),n.fillRect(e-a,i,o,s-i)}class Bt extends he{static get type(){return{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}}static get typeString(){return{singleRight:Bt.type.SINGLE_RIGHT,singleLeft:Bt.type.SINGLE_LEFT,single:Bt.type.SINGLE,double:Bt.type.DOUBLE,brace:Bt.type.BRACE,bracket:Bt.type.BRACKET,boldDoubleLeft:Bt.type.BOLD_DOUBLE_LEFT,boldDoubleRight:Bt.type.BOLD_DOUBLE_RIGHT,thinDouble:Bt.type.THIN_DOUBLE,none:Bt.type.NONE}}constructor(t,e){super(),this.setAttribute("type","StaveConnector"),this.thickness=V.STAVE_LINE_THICKNESS,this.width=3,this.top_stave=t,this.bottom_stave=e,this.type=Bt.type.DOUBLE,this.font={family:"times",size:16,weight:"normal"},this.x_shift=0,this.texts=[]}setType(t){return t=typeof t=="string"?Bt.typeString[t]:t,t>=Bt.type.SINGLE_RIGHT&&t<=Bt.type.NONE&&(this.type=t),this}setText(t,e){return this.texts.push({content:t,options:M.Merge({shift_x:0,shift_y:0},e)}),this}setFont(t){M.Merge(this.font,t)}setXShift(t){if(typeof t!="number")throw M.RERR("InvalidType","x_shift must be a Number");return this.x_shift=t,this}draw(){const t=this.checkContext();this.setRendered();let e=this.top_stave.getYForLine(0),i=this.bottom_stave.getYForLine(this.bottom_stave.getNumLines()-1)+this.thickness,s=this.width,r=this.top_stave.getX();(this.type===Bt.type.SINGLE_RIGHT||this.type===Bt.type.BOLD_DOUBLE_RIGHT||this.type===Bt.type.THIN_DOUBLE)&&(r=this.top_stave.getX()+this.top_stave.width);let a=i-e;switch(this.type){case Bt.type.SINGLE:s=1;break;case Bt.type.SINGLE_LEFT:s=1;break;case Bt.type.SINGLE_RIGHT:s=1;break;case Bt.type.DOUBLE:r-=this.width+2;break;case Bt.type.BRACE:{s=12;const l=this.top_stave.getX()-2+this.x_shift,h=e,c=l,u=i,f=l-s,d=h+a/2,p=f-.9*s,g=h+.2*a,m=l+1.1*s,S=d-.135*a,b=m,y=d+.135*a,x=p,w=u-.2*a,T=f-s,E=w,C=l+.4*s,P=d+.135*a,I=C,F=d-.135*a,L=T,k=g;t.beginPath(),t.moveTo(l,h),t.bezierCurveTo(p,g,m,S,f,d),t.bezierCurveTo(b,y,x,w,c,u),t.bezierCurveTo(T,E,C,P,f,d),t.bezierCurveTo(I,F,L,k,l,h),t.fill(),t.stroke();break}case Bt.type.BRACKET:e-=4,i+=4,a=i-e,xt.renderGlyph(t,r-5,e-3,40,"v1b",!0),xt.renderGlyph(t,r-5,i+3,40,"v10",!0),r-=this.width+2;break;case Bt.type.BOLD_DOUBLE_LEFT:zo(t,this.type,r+this.x_shift,e,i);break;case Bt.type.BOLD_DOUBLE_RIGHT:zo(t,this.type,r,e,i);break;case Bt.type.THIN_DOUBLE:s=1;break;case Bt.type.NONE:break;default:throw new M.RERR("InvalidType",`The provided StaveConnector.type (${this.type}) is invalid`)}this.type!==Bt.type.BRACE&&this.type!==Bt.type.BOLD_DOUBLE_LEFT&&this.type!==Bt.type.BOLD_DOUBLE_RIGHT&&this.type!==Bt.type.NONE&&t.fillRect(r,e,s,a),this.type===Bt.type.THIN_DOUBLE&&t.fillRect(r-3,e,s,a),t.save(),t.lineWidth=2,t.setFont(this.font.family,this.font.size,this.font.weight);for(let l=0;l<this.texts.length;l++){const h=this.texts[l],c=t.measureText(""+h.content).width,u=this.top_stave.getX()-c-24+h.options.shift_x,f=(this.top_stave.getYForLine(0)+this.bottom_stave.getBottomLineY())/2+h.options.shift_y;t.fillText(""+h.content,u,f+4)}t.restore()}}class Ta extends he{constructor(){super(),this.setAttribute("type","Tickable"),this.ticks=new Rt(0,1),this.intrinsicTicks=0,this.tickMultiplier=new Rt(1,1),this.width=0,this.x_shift=0,this.voice=null,this.tickContext=null,this.modifierContext=null,this.modifiers=[],this.preFormatted=!1,this.postFormatted=!1,this.tuplet=null,this.tupletStack=[],this.align_center=!1,this.center_x_shift=0,this.ignore_ticks=!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.ignore_ticks}getWidth(){return this.width}getFormatterMetrics(){return this.formatterMetrics}setXShift(t){this.x_shift=t}getCenterXShift(){return this.isCenterAligned()?this.center_x_shift:0}isCenterAligned(){return this.align_center}setCenterAlignment(t){return this.align_center=t,this}getVoice(){if(!this.voice)throw new M.RERR("NoVoice","Tickable has no voice.");return this.voice}setVoice(t){this.voice=t}getTuplet(){return this.tuplet}resetTuplet(t){let e,i;if(t){const s=this.tupletStack.indexOf(t);return s!==-1&&(this.tupletStack.splice(s,1),e=t.getNoteCount(),i=t.getNotesOccupied(),this.applyTickMultiplier(e,i)),this}for(;this.tupletStack.length;)t=this.tupletStack.pop(),e=t.getNoteCount(),i=t.getNotesOccupied(),this.applyTickMultiplier(e,i);return this}setTuplet(t){if(t){this.tupletStack.push(t);const e=t.getNoteCount(),i=t.getNotesOccupied();this.applyTickMultiplier(i,e)}return this.tuplet=t,this}addToModifierContext(t){this.modifierContext=t,this.preFormatted=!1}addModifier(t){return this.modifiers.push(t),this.preFormatted=!1,this}getModifiers(){return this.modifiers}setTickContext(t){this.tickContext=t,this.preFormatted=!1}preFormat(){this.preFormatted||(this.width=0,this.modifierContext&&(this.modifierContext.preFormat(),this.width+=this.modifierContext.getWidth()))}postFormat(){return this.postFormatted?this:(this.postFormatted=!0,this)}getIntrinsicTicks(){return this.intrinsicTicks}setIntrinsicTicks(t){this.intrinsicTicks=t,this.ticks=this.tickMultiplier.clone().multiply(this.intrinsicTicks)}getTickMultiplier(){return this.tickMultiplier}applyTickMultiplier(t,e){this.tickMultiplier.multiply(t,e),this.ticks=this.tickMultiplier.clone().multiply(this.intrinsicTicks)}setDuration(t){const e=t.numerator*(V.RESOLUTION/t.denominator);this.ticks=this.tickMultiplier.clone().multiply(e),this.intrinsicTicks=this.ticks.value()}}class Ie extends Ta{static get CATEGORY(){return"note"}static get STAVEPADDING(){return 12}static plotMetrics(t,e,i){const s=e.getMetrics(),r=e.getAbsoluteX()-s.modLeftPx-s.extraLeftPx,o=e.getAbsoluteX()-s.extraLeftPx,a=e.getAbsoluteX(),l=e.getAbsoluteX()+s.noteWidth,h=e.getAbsoluteX()+s.noteWidth+s.extraRightPx,c=e.getAbsoluteX()+s.noteWidth+s.extraRightPx+s.modRightPx,u=c+e.getFormatterMetrics().freedom.right,f=c-r;t.save(),t.setFont("Arial",8,""),t.fillText(Math.round(f)+"px",r+e.getXShift(),i);const d=i+7;function p(m,S,b,y=d){t.beginPath(),t.setStrokeStyle(b),t.setFillStyle(b),t.setLineWidth(3),t.moveTo(m+e.getXShift(),y),t.lineTo(S+e.getXShift(),y),t.stroke()}p(r,o,"red"),p(o,a,"#999"),p(a,l,"green"),p(l,h,"#999"),p(h,c,"red"),p(c,u,"#DD0"),p(r-e.getXShift(),r,"#BBB"),M.drawDot(t,a+e.getXShift(),d,"blue");const g=e.getFormatterMetrics();if(g.iterations>0){const m=g.space.deviation,S=m>=0?"+":"";t.setFillStyle("red"),t.fillText(S+Math.round(m),a+e.getXShift(),i-10)}t.restore()}constructor(t){if(super(),this.setAttribute("type","Note"),!t)throw new M.RuntimeError("BadArguments","Note must have valid initialization data to identify duration and type.");const e=V.parseNoteStruct(t);if(!e)throw new M.RuntimeError("BadArguments",`Invalid note initialization object: ${JSON.stringify(t)}`);if(this.duration=e.duration,this.dots=e.dots,this.noteType=e.type,this.customTypes=e.customTypes,this.DYMusicScoreType=t.DYMusicScoreType,t.duration_override?this.setDuration(t.duration_override):this.setIntrinsicTicks(e.ticks),this.modifiers=[],this.glyph=V.getGlyphProps(this.duration,this.noteType),this.customGlyphs=this.customTypes.map(i=>V.getGlyphProps(this.duration,i)),this.positions&&(typeof this.positions!="object"||!this.positions.length))throw new M.RuntimeError("BadArguments","Note keys must be array type.");this.playNote=null,this.tickContext=null,this.modifierContext=null,this.ignore_ticks=!1,this.width=0,this.extraLeftPx=0,this.extraRightPx=0,this.x_shift=0,this.left_modPx=0,this.right_modPx=0,this.voice=null,this.preFormatted=!1,this.ys=[],t.align_center&&this.setCenterAlignment(t.align_center),this.stave=null,this.render_options={annotation_spacing:5,stave_padding:Ie.STAVEPADDING}}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.setPreFormatted(!1),this}getStave(){return this.stave}setStave(t){return this.stave=t,this.setYs([t.getYForLine(0)]),this.context=this.stave.context,this}getCategory(){return Ie.CATEGORY}setContext(t){return this.context=t,this}getExtraLeftPx(){return this.extraLeftPx}getExtraRightPx(){return this.extraRightPx}setExtraLeftPx(t){return this.extraLeftPx=t,this}setExtraRightPx(t){return this.extraRightPx=t,this}shouldIgnoreTicks(){return this.ignore_ticks}getLineNumber(){return 0}getLineForRest(){return 0}getGlyph(){return this.glyph}getGlyphWidth(){return this.glyph.getWidth?this.glyph.getWidth(this.render_options.glyph_font_scale):15}setYs(t){return this.ys=t,this}getYs(){if(this.ys.length===0)throw new M.RERR("NoYValues","No Y-values calculated for this note.");return this.ys}getYForTopText(t){if(!this.stave)throw new M.RERR("NoStave","No stave attached to this note.");return this.stave.getYForTopText(t)}getBoundingBox(){return null}getVoice(){if(!this.voice)throw new M.RERR("NoVoice","Note has no voice.");return this.voice}setVoice(t){return this.voice=t,this.preFormatted=!1,this}getTickContext(){return this.tickContext}setTickContext(t){return this.tickContext=t,this.preFormatted=!1,this}getDuration(){return this.duration}isDotted(){return this.dots>0}hasStem(){return!1}getDots(){return this.dots}getNoteType(){return this.noteType}setBeam(){return this}setModifierContext(t){return this.modifierContext=t,this}addModifier(t,e=0){return t.setNote(this),t.setIndex(e),this.modifiers.push(t),this.setPreFormatted(!1),this}getModifierStartXY(){if(!this.preFormatted)throw new M.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");return{x:this.getAbsoluteX(),y:this.ys[0]}}getMetrics(){if(!this.preFormatted)throw new M.RERR("UnformattedNote","Can't call getMetrics on an unformatted note.");let t=0,e=0;this.modifierContext!=null&&(t=this.modifierContext.state.left_shift,e=this.modifierContext.state.right_shift);const i=this.getWidth();return{width:i,noteWidth:i-t-e-this.extraLeftPx-this.extraRightPx,left_shift:this.x_shift,modLeftPx:t,modRightPx:e,extraLeftPx:this.extraLeftPx,extraRightPx:this.extraRightPx}}setWidth(t){this.width=t}getWidth(){if(!this.preFormatted)throw new M.RERR("UnformattedNote","Can't call GetWidth on an unformatted note.");return this.width+(this.modifierContext?this.modifierContext.getWidth():0)}setXShift(t){return this.x_shift=t,this}getXShift(){return this.x_shift}getX(){if(!this.tickContext)throw new M.RERR("NoTickContext","Note needs a TickContext assigned for an X-Value");return this.tickContext.getX()+this.x_shift}getAbsoluteX(){if(!this.tickContext)throw new M.RERR("NoTickContext","Note needs a TickContext assigned for an X-Value");let t=this.tickContext.getX();return this.stave&&(t+=this.stave.getNoteStartX()+this.render_options.stave_padding),this.isCenterAligned()&&(this.DYMusicScoreType==="jianpu"||(t+=this.getCenterXShift())),t}setPreFormatted(t){if(this.preFormatted=t,this.preFormatted){const e=this.tickContext.getExtraPx();this.left_modPx=Math.max(this.left_modPx,e.left),this.right_modPx=Math.max(this.right_modPx,e.right)}}}function rc(...n){Ms.DEBUG&&M.L("Vex.Flow.NoteHead",n)}function oc(n,t,e,i,s,r){const o=V.SLASH_NOTEHEAD_WIDTH;n.save(),n.setLineWidth(V.STEM_WIDTH);let a=!1;if(V.durationToNumber(t)>2&&(a=!0),a||(e-=V.STEM_WIDTH/2*s),n.beginPath(),n.moveTo(e,i+r),n.lineTo(e,i+1),n.lineTo(e+o,i-r),n.lineTo(e+o,i),n.lineTo(e,i+r),n.closePath(),a?n.fill():n.stroke(),V.durationToFraction(t).equals(.5)){const l=[-3,-1,o+1,o+3];for(let h=0;h<l.length;h++)n.beginPath(),n.moveTo(e+l[h],i-10),n.lineTo(e+l[h],i+11),n.stroke()}n.restore()}class Ms extends Ie{static get CATEGORY(){return"notehead"}constructor(t){if(super(t),this.setAttribute("type","NoteHead"),this.index=t.index,this.x=t.x||0,this.y=t.y||0,this.note_type=t.note_type,this.duration=t.duration,this.displaced=t.displaced||!1,this.stem_direction=t.stem_direction||ae.STEM_UP,this.line=t.line,this._line=t._line,this.glyph=V.getGlyphProps(this.duration,this.note_type),!this.glyph)throw new M.RuntimeError("BadArguments",`No glyph found for duration '${this.duration}' and type '${this.note_type}'`);this.glyph_code=this.glyph.code_head,this.x_shift=t.x_shift||0,t.custom_glyph_code&&(this.custom_glyph=!0,this.glyph_code=t.custom_glyph_code,this.stem_up_x_offset=t.stem_up_x_offset||0,this.stem_down_x_offset=t.stem_down_x_offset||0),this.style=t.style,this.slashed=t.slashed,M.Merge(this.render_options,{glyph_font_scale:t.glyph_font_scale||V.DEFAULT_NOTATION_FONT_SCALE,stroke_px:3}),this.setWidth(this.glyph.getWidth(this.render_options.glyph_font_scale))}getCategory(){return Ms.CATEGORY}getWidth(){return this.width}isDisplaced(){return this.displaced===!0}getGlyph(){return this.glyph}setX(t){return this.x=t,this}getY(){return this.y}setY(t){return this.y=t,this}getLine(){return this.line}setLine(t){return this.line=t,this}getAbsoluteX(){const t=this.preFormatted?super.getAbsoluteX():this.x,e=ft.WIDTH/2;return t+(this.displaced?(this.width-e)*this.stem_direction:0)}getBoundingBox(){if(!this.preFormatted)throw new M.RERR("UnformattedNote","Can't call getBoundingBox on an unformatted note.");const t=this.stave.getSpacingBetweenLines(),e=t/2,i=this.y-e;return new V.BoundingBox(this.getAbsoluteX(),i,this.width,t)}setStave(t){const e=this.getLine();return this.stave=t,this.setY(t.getYForNote(e)),this.context=this.stave.context,this}preFormat(){if(this.preFormatted)return this;const t=this.getWidth()+this.extraLeftPx+this.extraRightPx;return this.setWidth(t),this.setPreFormatted(!0),this}draw(){this.checkContext(),this.setRendered();const t=this.context;let e=this.getAbsoluteX();this.custom_glyph&&(e+=this.stem_direction===ft.UP?this.stem_up_x_offset:this.stem_down_x_offset);const i=this.y;rc("Drawing note head '",this.note_type,this.duration,"' at",e,i);const s=this.stem_direction,r=this.render_options.glyph_font_scale;if(this.style&&this.applyStyle(t),this.note_type==="s"){const o=this.stave.getSpacingBetweenLines();oc(t,this.duration,e,i,s,o)}else xt.renderGlyph(t,e,i,r,this.glyph_code);this.style&&this.restoreStyle(t)}}class oo extends Ie{constructor(t){super(t),this.setAttribute("type","StemmableNote"),this.stem=null,this.stemExtensionOverride=null,this.beam=null,this.renderFlag=!0}getStem(){return this.stem}setStem(t){return this.stem=t,this}buildStem(){const t=new ft;return this.setStem(t),this}buildFlag(){const{glyph:t,beam:e}=this,i=e===null&&this.renderFlag;if(t&&t.flag&&i){const s=this.getStemDirection()===ft.DOWN?t.code_flag_downstem:t.code_flag_upstem;this.flag=new xt(s,this.render_options.glyph_font_scale)}}getTopGlyph(){return this.getStemDirection()===ft.DOWN?this.customGlyphs[this.customGlyphs.length-1]:this.customGlyphs[0]}getStemLength(){return ft.HEIGHT+this.getStemExtension()}getBeamCount(){const t=this.getGlyph();return t?t.beam_count:0}getStemMinumumLength(){let e=V.durationToFraction(this.duration).value()<=1?0:20;switch(this.duration){case"8":this.beam==null&&(e=35);break;case"16":e=this.beam==null?35:25;break;case"32":e=this.beam==null?45:35;break;case"64":e=this.beam==null?50:40;break;case"128":e=this.beam==null?55:45;break}return e}getStemDirection(){return this.stem_direction}setStemDirection(t){if(t||(t=ft.UP),t!==ft.UP&&t!==ft.DOWN)throw new M.RERR("BadArgument",`Invalid stem direction: ${t}`);if(this.stem_direction=t,this.stem){this.stem.setDirection(t),this.stem.setExtension(this.getStemExtension());const e=this.getTopGlyph()||this.getGlyph();this.stem.setOptions({stem_up_y_offset:e.stem_up_y_offset,stem_down_y_offset:e.stem_down_y_offset})}return this.reset(),this.flag&&this.renderFlag&&this.buildFlag(),this.beam=null,this.preFormatted&&this.preFormat(),this}getStemX(){const t=this.getAbsoluteX()+this.x_shift,e=this.getAbsoluteX()+this.x_shift+this.getGlyphWidth();return this.stem_direction===ft.DOWN?t:e}getCenterGlyphX(){return this.getAbsoluteX()+this.x_shift+this.getGlyphWidth()/2}getStemExtension(){const t=this.getGlyph();return this.stemExtensionOverride!=null?this.stemExtensionOverride:t?this.getStemDirection()===1?t.stem_up_extension:t.stem_down_extension:0}setStemLength(t){return this.stemExtensionOverride=t-ft.HEIGHT,this}getStemExtents(){return this.stem.getExtents()}setBeam(t){return this.beam=t,this}getYForTopText(t){const e=this.getStemExtents();return this.hasStem()?Math.min(this.stave.getYForTopText(t),e.topY-this.render_options.annotation_spacing*(t+1)):this.stave.getYForTopText(t)}getYForBottomText(t){const e=this.getStemExtents();return this.hasStem()?Math.max(this.stave.getYForTopText(t),e.baseY+this.render_options.annotation_spacing*t):this.stave.getYForBottomText(t)}hasFlag(){return this.renderFlag&&V.getGlyphProps(this.duration).flag&&!this.beam}postFormat(){return this.beam&&this.beam.postFormat(),this.postFormatted=!0,this}drawStem(t){this.checkContext(),this.setRendered(),this.setStem(new ft(t)),this.stem.setContext(this.context).draw()}}class St extends he{static get CATEGORY(){return"none"}static get Position(){return{LEFT:1,RIGHT:2,ABOVE:3,BELOW:4}}static get PositionString(){return{above:St.Position.ABOVE,below:St.Position.BELOW,left:St.Position.LEFT,right:St.Position.RIGHT}}constructor(){super(),this.setAttribute("type","Modifier"),this.width=0,this.note=null,this.index=null,this.text_line=0,this.position=St.Position.LEFT,this.modifier_context=null,this.x_shift=0,this.y_shift=0,this.spacingFromNextModifier=0}getCategory(){return St.CATEGORY}getWidth(){return this.width}setWidth(t){return this.width=t,this}getNote(){return this.note}setNote(t){return this.note=t,this}getIndex(){return this.index}setIndex(t){return this.index=t,this}getModifierContext(){return this.modifier_context}setModifierContext(t){return this.modifier_context=t,this}getPosition(){return this.position}setPosition(t){return this.position=typeof t=="string"?St.PositionString[t]:t,this}setTextLine(t){return this.text_line=t,this}setYShift(t){return this.y_shift=t,this}setSpacingFromNextModifier(t){this.spacingFromNextModifier=t}getSpacingFromNextModifier(){return this.spacingFromNextModifier}setXShift(t){this.x_shift=0,this.position===St.Position.LEFT?this.x_shift-=t:this.x_shift+=t}getXShift(){return this.x_shift}draw(){throw this.checkContext(),new M.RERR("MethodNotImplemented","draw() not implemented for this modifier.")}alignSubNotesWithNote(t,e){const i=e.getTickContext(),s=i.getExtraPx(),r=i.getX()-s.left-s.extraLeft+this.getSpacingFromNextModifier();t.forEach(o=>{const a=o.getTickContext();o.setStave(e.stave),a.setXOffset(r)})}}class Gi extends St{static get CATEGORY(){return"dots"}static format(t,e){const i=e.right_shift,s=1;if(!t||t.length===0)return!1;const r=[],o={};for(let d=0;d<t.length;++d){const p=t[d],g=p.getNote();let m,S;typeof g.getKeyProps=="function"?(m=g.getKeyProps()[p.getIndex()],S=m.displaced?g.getExtraRightPx():0):(m={line:.5},S=0);const b=g.getAttribute("id");r.push({line:m.line,note:g,note_id:b,dot:p}),o[b]=Math.max(o[b]||S,S)}r.sort((d,p)=>p.line-d.line);let a=i,l=0,h=null,c=null,u=null,f=0;for(let d=0;d<r.length;++d){const{dot:p,note:g,note_id:m,line:S}=r[d];(S!==h||g!==c)&&(a=o[m]),!g.isRest()&&S!==h&&(Math.abs(S%1)===.5?f=0:(f=.5,(c!=null&&!c.isRest()&&h-S===.5||S+f===u)&&(f=-.5))),g.isRest()?p.dot_shiftY+=-f:p.dot_shiftY=-f,u=S+f,p.setXShift(a),a+=p.getWidth()+s,l=a>l?a:l,h=S,c=g}return e.right_shift+=l,!0}constructor(){super(),this.setAttribute("type","Dot"),this.note=null,this.index=null,this.position=St.Position.RIGHT,this.radius=2,this.setWidth(5),this.dot_shiftY=0}getCategory(){return Gi.CATEGORY}setNote(t){this.note=t,this.note.getCategory()==="gracenotes"&&(this.radius*=.5,this.setWidth(3))}setDotShiftY(t){return this.dot_shiftY=t,this}draw(){if(this.checkContext(),this.setRendered(),!this.note||this.index===null)throw new M.RERR("NoAttachedNote","Can't draw dot without a note and index.");const t=this.note.stave.options.spacing_between_lines_px,e=this.note.getModifierStartXY(this.position,this.index,{forceFlagRight:!0});this.note.getCategory()==="tabnotes"&&(e.y=this.note.getStemExtents().baseY+1);const i=e.x+this.x_shift+this.width-this.radius,s=e.y+this.y_shift+this.dot_shiftY*t,r=this.context;r.beginPath(),r.arc(i,s,this.radius,0,Math.PI*2,!1),r.fill()}}function ac(...n){ae.DEBUG&&M.L("Vex.Flow.StaveNote",n)}const lc=n=>ft.WIDTH/(2*-n.getStemDirection()),hc=(n,t)=>t===(n.getStemDirection()===ft.UP?n.keyProps.length-1:0);function Di(n,t,e){const i=(t.isrest?0:1)*e;n.line+=i,n.maxLine+=i,n.minLine+=i,n.note.setKeyLine(0,n.note.getKeyLine(0)+i)}function cc(n,t,e){const i=n.line-M.MidLine(t.minLine,e.maxLine);n.note.setKeyLine(0,n.note.getKeyLine(0)-i),n.line-=i,n.maxLine-=i,n.minLine-=i}class ae extends oo{static get CATEGORY(){return"stavenotes"}static get STEM_UP(){return ft.UP}static get STEM_DOWN(){return ft.DOWN}static get DEFAULT_LEDGER_LINE_OFFSET(){return 3}static renderVibrato(t,e,i,s,r){const{vibrato_width:o,wave_width:a,wave_girth:l,wave_height:h}=s,c=o/a,u=Math.abs(r-i)/c+2;t.beginPath();let f;for(t.moveTo(e,i+l),f=0;f<c/2;++f)t.quadraticCurveTo(e+a/2,i-h/2,e+a,i),e+=a,i+=u,t.quadraticCurveTo(e+a/2,i+h/2,e+a,i),e+=a;for(f=0;f<c/2;++f)t.quadraticCurveTo(e-a/2,i+h/2+l,e-a,i+l),e-=a,i-=u,t.quadraticCurveTo(e-a/2,i-h/2+l,e-a,i+l),e-=a;t.fill()}static format(t,e){if(!t||t.length<2)return!1;const i=[],s=t[0].stagger_same_whole_notes;for(let f=0;f<t.length;f++){const d=t[f].getKeyProps(),p=d[0].line;let g=d[d.length-1].line;const m=t[f].getStemDirection(),S=t[f].getStemLength()/10,b=t[f].getStemMinumumLength()/10;let y;t[f].isRest()?(y=p+t[f].glyph.line_above,g=p-t[f].glyph.line_below):(y=m===1?d[d.length-1].line+S:d[d.length-1].line,g=m===1?d[0].line:d[0].line-S),i.push({line:d[0].line,maxLine:y,minLine:g,isrest:t[f].isRest(),stemDirection:m,stemMax:S,stemMin:b,voice_shift:t[f].getVoiceShiftWidth(),is_displaced:t[f].isDisplaced(),note:t[f]})}const r=i.length;let o=i[0];const a=r>2?i[1]:null;let l=r>2?i[2]:i[1];r===2&&o.stemDirection===-1&&l.stemDirection===1&&(o=i[1],l=i[0]);const h=Math.max(o.voice_shift,l.voice_shift);let c=0,u;if(r===2){const f=o.stemDirection===l.stemDirection?0:.5;if(o.stemDirection===l.stemDirection&&o.minLine<=l.maxLine&&(o.isrest||(u=Math.abs(o.line-(l.maxLine+.5)),u=Math.max(u,o.stemMin),o.minLine=o.line-u,o.note.setStemLength(u*10))),o.minLine<=l.maxLine+f)if(o.isrest)Di(o,l,1);else if(l.isrest)Di(l,o,-1);else{c=h;const d=Math.abs(o.line-l.line);let p=0,g=0;o.note.duration==="h"?p++:o.note.duration==="w"&&g++,l.note.duration==="h"?p++:l.note.duration==="w"&&g++;let m=p===1||g===1||o.note.dots!==l.note.dots;if(s&&(m=m||g===2),d===0&&m){if(l.note.setXShift(c),o.note.dots>0){let S=0;for(const b of o.note.modifiers)if(b instanceof Gi&&(S++,b.setYShift(-10*(l.maxLine-o.line+1)),S===o.note.dots))break}}else d<1&&d>0?l.note.setXShift(c):o.note.voice!==l.note.voice&&o.stemDirection===l.stemDirection&&(o.line>l.line?o.stemDirection===1?l.note.renderFlag=!1:o.note.renderFlag=!1:l.line>o.line?l.stemDirection===1?o.note.renderFlag=!1:l.note.renderFlag=!1:l.stemDirection===1&&(l.stemDirection=-1,l.note.setStemDirection(-1)))}return!0}if(a!==null&&a.minLine<l.maxLine+.5&&(a.isrest||(u=Math.abs(a.line-(l.maxLine+.5)),u=Math.max(u,a.stemMin),a.minLine=a.line-u,a.note.setStemLength(u*10))),a.isrest&&!o.isrest&&!l.isrest&&(o.minLine<=a.maxLine||a.minLine<=l.maxLine)){const f=a.maxLine-a.minLine,d=o.minLine-l.maxLine;return f<d?cc(a,o,l):(c=h+3,a.note.setXShift(c)),!0}return o.isrest&&a.isrest&&l.isrest?(Di(o,a,1),Di(l,a,-1),!0):(a.isrest&&o.isrest&&a.minLine<=l.maxLine&&Di(a,l,1),a.isrest&&l.isrest&&o.minLine<=a.maxLine&&Di(a,o,-1),o.isrest&&o.minLine<=a.maxLine&&Di(o,a,1),l.isrest&&a.minLine<=l.maxLine&&Di(l,a,-1),(!o.isrest&&!a.isrest&&o.minLine<=a.maxLine+.5||!a.isrest&&!l.isrest&&a.minLine<=l.maxLine)&&(c=h+3,a.note.setXShift(c)),!0)}static formatByY(t,e){let i=!0;for(let r=0;r<t.length;r++)i=i&&t[r].getStave()!=null;if(!i)throw new M.RERR("Stave Missing","All notes must have a stave - Vex.Flow.ModifierContext.formatMultiVoice!");let s=0;for(let r=0;r<t.length-1;r++){let o=t[r],a=t[r+1];o.maxLine<a.maxLine&&(o=t[r+1],a=t[r]);const l=o.getKeyProps(),h=a.getKeyProps(),c=.5,u=o.getStave().getYForLine(5-l[0].line+c);a.getStave().getYForLine(5-h[h.length-1].line-c)-u<0&&o.voice===a.voice&&(s=o.getVoiceShiftWidth()+2,a.setXShift(s))}e.right_shift+=s}static postFormat(t){return t?(t.forEach(e=>e.postFormat()),!0):!1}constructor(t){if(super(t),this.setAttribute("type","StaveNote"),this.keys=t.keys,this.clef=t.clef,this.octave_shift=t.octave_shift,this.beam=null,this.vibrato=null,this.glyph=V.getGlyphProps(this.duration,this.noteType),!this.glyph)throw new M.RuntimeError("BadArguments",`Invalid note initialization data (No glyph found): ${JSON.stringify(t)}`);this.displaced=!1,this.dot_shiftY=0,this.addDotsCount=0,this.keyProps=[],this.use_default_head_x=!1,this.note_heads=[],this.modifiers=[],M.Merge(this.render_options,{glyph_font_scale:t.glyph_font_scale||V.DEFAULT_NOTATION_FONT_SCALE,stroke_px:t.stroke_px||ae.DEFAULT_LEDGER_LINE_OFFSET}),this.calculateKeyProps(),this.buildStem(),t.auto_stem?this.autoStem():this.setStemDirection(t.stem_direction),this.reset(),this.buildFlag()}reset(){super.reset();const t=this.note_heads.map(e=>e.getStyle());this.buildNoteHeads(),this.note_heads.forEach((e,i)=>e.setStyle(t[i])),this.stave&&this.note_heads.forEach(e=>e.setStave(this.stave)),this.calcExtraPx()}setBeam(t){return this.beam=t,this.calcExtraPx(),this}setVibrato(t){this.vibrato=t}getCategory(){return ae.CATEGORY}buildStem(){this.setStem(new ft({hide:!!this.isRest()})),this.stem.id=M.Prefix(`${this.getAttribute("id")}-stem`)}buildNoteHeads(){this.note_heads=[];const t=this.getStemDirection(),e=this.getKeys();let i=null,s=null,r=!1,o,a,l;t===ft.UP?(o=0,a=e.length,l=1):t===ft.DOWN&&(o=e.length-1,a=-1,l=-1);for(let h=o;h!==a;h+=l){const c=this.keyProps[h],u=c.line;i===null?i=u:(s=Math.abs(i-u),s===0||s===.5?r=!r:(r=!1,this.use_default_head_x=!0)),i=u;const f=new Ms({duration:this.duration,note_type:this.noteType,displaced:r,stem_direction:t,custom_glyph_code:c.code,glyph_font_scale:this.render_options.glyph_font_scale,x_shift:c.shift_right,stem_up_x_offset:c.stem_up_x_offset,stem_down_x_offset:c.stem_down_x_offset,line:c.line});this.note_heads[h]=f}}autoStem(){this.minLine=this.keyProps[0].line,this.maxLine=this.keyProps[this.keyProps.length-1].line;const t=3,i=(this.minLine+this.maxLine)/2<t?ft.UP:ft.DOWN;this.setStemDirection(i)}calculateKeyProps(){let t=null;for(let e=0;e<this.keys.length;++e){const i=this.keys[e];this.glyph.rest&&(this.glyph.position=i);const s={octave_shift:this.octave_shift||0},r=V.keyProperties(i,this.clef,s);if(!r)throw new M.RuntimeError("BadArguments",`Invalid key for note properties: ${i}`);r.key==="R"&&(this.duration==="1"||this.duration==="w"?r.line=4:r.line=3);const o=r.line;t===null?t=o:Math.abs(t-o)===.5&&(this.displaced=!0,r.displaced=!0,this.keyProps.length>0&&(this.keyProps[e-1].displaced=!0)),t=o,this.keyProps.push(r)}t=-1/0,this.keyProps.forEach(e=>{e.line<t&&M.W("Unsorted keys in note will be sorted. See https://github.com/0xfe/vexflow/issues/104 for details."),t=e.line}),this.keyProps.sort((e,i)=>e.line-i.line)}getBoundingBox(){if(!this.preFormatted)throw new M.RERR("UnformattedNote","Can't call getBoundingBox on an unformatted note.");const{width:t,modLeftPx:e,extraLeftPx:i}=this.getMetrics(),s=this.getAbsoluteX()-e-i;let r=0,o=0;const a=this.getStave().getSpacingBetweenLines()/2,l=a*2;if(this.isRest()){const h=this.ys[0],c=V.durationToFraction(this.duration);c.equals(1)||c.equals(2)?(r=h-a,o=h+a):(r=h-this.glyph.line_above*l,o=h+this.glyph.line_below*l)}else if(this.glyph.stem){const h=this.getStemExtents();h.baseY+=a*this.stem_direction,r=Math.min(h.topY,h.baseY),o=Math.max(h.topY,h.baseY)}else{r=null,o=null;for(let h=0;h<this.ys.length;++h){const c=this.ys[h];h===0?(r=c,o=c):(r=Math.min(c,r),o=Math.max(c,o))}r-=a,o+=a}return new es(s,r,t,o-r)}getLineNumber(t){if(!this.keyProps.length)throw new M.RERR("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(){return this.glyph.rest}isChord(){return!this.isRest()&&this.keys.length>1}hasStem(){return this.glyph.stem}hasFlag(){return super.hasFlag()&&!this.isRest()&&this.renderFlag}getStemX(){return this.noteType==="r"?this.getCenterGlyphX():super.getStemX()+lc(this)}getYForTopText(t){const e=this.getStemExtents();return Math.min(this.stave.getYForTopText(t),e.topY-this.render_options.annotation_spacing*(t+1))}getYForBottomText(t){const e=this.getStemExtents();return Math.max(this.stave.getYForTopText(t),e.baseY+this.render_options.annotation_spacing*t)}setStave(t){super.setStave(t);const e=this.note_heads.map(i=>(i.setStave(t),i.getY()));if(this.setYs(e),this.stem){const{y_top:i,y_bottom:s}=this.getNoteHeadBounds();this.stem.setYBounds(i,s)}return this}getKeys(){return this.keys}getKeyProps(){return this.keyProps}isDisplaced(){return this.displaced}setNoteDisplaced(t){return this.displaced=t,this}getTieRightX(){let t=this.getAbsoluteX();return t+=this.getGlyphWidth()+this.x_shift+this.extraRightPx,this.modifierContext&&(t+=this.modifierContext.getExtraRightPx()),t}getTieLeftX(){let t=this.getAbsoluteX();return t+=this.x_shift-this.extraLeftPx,t}getLineForRest(){let t=this.keyProps[0].line;if(this.keyProps.length>1){const e=this.keyProps[this.keyProps.length-1].line,i=Math.max(t,e),s=Math.min(t,e);t=M.MidLine(i,s)}return t}getModifierStartXY(t,e,i){if(i=i||{},!this.preFormatted)throw new M.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");if(this.ys.length===0)throw new M.RERR("NoYValues","No Y-Values calculated for this note.");const{ABOVE:s,BELOW:r,LEFT:o,RIGHT:a}=St.Position;let l=0;return t===o?l=-1*2:t===a?(l=this.getGlyphWidth()+this.x_shift+2,this.stem_direction===ft.UP&&this.hasFlag()&&(i.forceFlagRight||hc(this,e))&&(l+=this.flag.getMetrics().width)):(t===r||t===s)&&(l=this.getGlyphWidth()/2),{x:this.getAbsoluteX()+l,y:this.ys[e]}}setStyle(t){super.setStyle(t),this.note_heads.forEach(e=>e.setStyle(t)),this.stem&&this.stem.setStyle(t)}setStemStyle(t){this.stem&&this.getStem().setStyle(t)}getStemStyle(){return this.stem.getStyle()}setLedgerLineStyle(t){this.ledgerLineStyle=t}getLedgerLineStyle(){return this.ledgerLineStyle}setFlagStyle(t){this.flagStyle=t}getFlagStyle(){return this.flagStyle}setKeyStyle(t,e){return this.note_heads[t].setStyle(e),this}setKeyLine(t,e){return(this.glyph.code_head=="va5"||this.glyph.code_head=="v3c")&&(e=3),this.keyProps[t].line=e,this.reset(),this}getKeyLine(t){return this.keyProps[t].line}addToModifierContext(t){this.setModifierContext(t);for(let e=0;e<this.modifiers.length;++e)this.modifierContext.addModifier(this.modifiers[e]);return this.modifierContext.addModifier(this),this.setPreFormatted(!1),this}addModifier(t,e){return e.setNote(this),e.setIndex(t),this.modifiers.push(e),this.setPreFormatted(!1),this}addAccidental(t,e){return this.addModifier(t,e)}addArticulation(t,e){return this.addModifier(t,e)}addAnnotation(t,e){return this.addModifier(t,e)}addDot(t){const e=new Gi;return e.setDotShiftY(this.glyph.dot_shiftY),this.addDotsCount++,this.addModifier(t,e)}addDotToAll(){for(let t=0;t<this.keys.length;++t)this.addDot(t);return this}getAccidentals(){return this.modifierContext.getModifiers("accidentals")}getDots(){return this.modifierContext.getModifiers("dots")}getVoiceShiftWidth(){return this.getGlyphWidth()*(this.displaced?2:1)}calcExtraPx(){this.setExtraLeftPx(this.displaced&&this.stem_direction===ft.DOWN?this.getGlyphWidth():0),this.setExtraRightPx(!this.hasFlag()&&this.displaced&&this.stem_direction===ft.UP?this.getGlyphWidth():0)}preFormat(){if(this.preFormatted)return;this.modifierContext&&this.modifierContext.preFormat();let t=this.getGlyphWidth()+this.extraLeftPx+this.extraRightPx;this.renderFlag&&this.glyph.flag&&this.beam===null&&this.stem_direction===ft.UP&&(t+=this.getGlyphWidth()),this.setWidth(t),this.setPreFormatted(!0)}getNoteHeadBounds(){let t=null,e=null,i=null,s=null,r=this.stave.getNumLines(),o=1,a=!1,l=!1,h=r,c=o;return this.note_heads.forEach(u=>{const f=u.getLine(),d=u.getY();(t===null||d<t)&&(t=d),(e===null||d>e)&&(e=d),s===null&&u.isDisplaced()&&(s=u.getAbsoluteX()),i===null&&!u.isDisplaced()&&(i=u.getAbsoluteX()),r=f>r?f:r,o=f<o?f:o,u.isDisplaced()?(a=a===!1?f:Math.max(f,a),l=l===!1?f:Math.min(f,l)):(h=Math.max(f,h),c=Math.min(f,c))},this),{y_top:t,y_bottom:e,displaced_x:s,non_displaced_x:i,highest_line:r,lowest_line:o,highest_displaced_line:a,lowest_displaced_line:l,highest_non_displaced_line:h,lowest_non_displaced_line:c}}getNoteHeadBeginX(){return this.getAbsoluteX()+this.x_shift}getNoteHeadEndX(){return this.getNoteHeadBeginX()+this.getGlyphWidth()}drawLedgerLines(){const{stave:t,glyph:e,render_options:{stroke_px:i},context:s}=this,r=e.getWidth()+i*2,o=2*(e.getWidth()+i)-ft.WIDTH/2;if(this.isRest())return;if(!s)throw new M.RERR("NoCanvasContext","Can't draw without a canvas context.");const{highest_line:a,lowest_line:l,highest_displaced_line:h,highest_non_displaced_line:c,lowest_displaced_line:u,lowest_non_displaced_line:f,displaced_x:d,non_displaced_x:p}=this.getNoteHeadBounds(),g=Math.min(d,p),m=(b,y,x)=>{let w;x&&y?w=g-i:y?w=p-i:w=d-i;const T=y&&x?o:r;s.beginPath(),s.moveTo(w,b),s.lineTo(w+T,b),s.stroke()},S=be(be({},t.getStyle()||{}),this.getLedgerLineStyle()||{});this.applyStyle(s,S);for(let b=6;b<=a;++b){const y=p!==null&&b<=c,x=d!==null&&b<=h;m(t.getYForNote(b),y,x)}for(let b=0;b>=l;--b){const y=p!==null&&b>=f,x=d!==null&&b>=u;m(t.getYForNote(b),y,x)}this.restoreStyle(s,S)}drawVibrato(){if(this.vibrato){const t=this.context;t.openGroup("vibrato");const e=this.vibrato.getNoteHeadEndX()+2,{y_top:i}=this.vibrato.getNoteHeadBounds();let{y_bottom:s}=this.getNoteHeadBounds(),r=Math.abs(this.getNoteHeadBeginX()-e)-10;this.vibrato.stave.y!==this.stave.y&&(r=30,s=i+10),ae.renderVibrato(this.context,e,i,{harsh:!0,vibrato_width:r,wave_height:6,wave_width:4,wave_girth:2},s),t.closeGroup()}}drawModifiers(){if(!this.context)throw new M.RERR("NoCanvasContext","Can't draw without a canvas context.");const t=this.context;t.openGroup("modifiers");for(let e=0;e<this.modifiers.length;e++){const i=this.modifiers[e],s=this.note_heads[i.getIndex()],r=s.getStyle();this.isRest()&&i.getCategory()==="articulations"||i.note&&i.note.DYMusicScoreType=="jianpu"&&i.getAttribute("type")==="Dot"&&!i.note.formatterMetrics.duration||(s.applyStyle(t,r),i.setContext(t),i.drawWithStyle(),s.restoreStyle(t,r))}t.closeGroup(),this.drawVibrato()}drawFlag(){const{stem:t,beam:e,context:i}=this;if(!i)throw new M.RERR("NoCanvasContext","Can't draw without a canvas context.");const s=e===null&&this.renderFlag;if(this.getGlyph().flag&&s){const{y_top:o,y_bottom:a}=this.getNoteHeadBounds(),l=t.getHeight(),h=this.getStemX();let c=this.getStemDirection()===ft.DOWN?o-l+2:a-l-2;if(t&&!e){const u=this.keyProps[0].line;(u>6.5||u<-.5)&&(c=c+(u>6.5?(u-6.5)*10:(u+.5)*10))}i.openGroup("flag",null,{pointerBBox:!0}),this.applyStyle(i,this.getFlagStyle()||!1),this.flag.render(i,h,c),this.restoreStyle(i,this.getFlagStyle()||!1),i.closeGroup()}}drawNoteHeads(){this.note_heads.forEach(t=>{this.context.openGroup("notehead",null,{pointerBBox:!0});try{if(this.isRest()&&this.duration==="w"){const e=this.stave.options.line_config.filter(s=>s.visible).length;this.keyProps[0].line===4&&e<5&&t.setY(t.getY()+10),e===1&&t.setLine(3)}}catch{}t.setContext(this.context).draw(),this.context.closeGroup()})}drawStem(t){if(!this.context)throw new M.RERR("NoCanvasContext","Can't draw without a canvas context.");t&&this.setStem(new ft(t)),this.stem.id=M.Prefix(`${this.getAttribute("id")}-stem`),this.stem&&(this.context.openGroup("stem",null,{pointerBBox:!0}),this.stem.setContext(this.context).draw(),this.context.closeGroup())}draw(){if(!this.context)throw new M.RERR("NoCanvasContext","Can't draw without a canvas context.");if(!this.stave)throw new M.RERR("NoStave","Can't draw without a stave.");if(this.ys.length===0)throw new M.RERR("NoYValues","Can't draw note without Y values.");const t=this.stave.getLines();if(t===2||t===3||t===4)for(let s=0;s<this.note_heads.length;s++)if(this.isRest())t===2&&this.note_heads[s].setLine(3);else{let r=t===2?2:t===3?.65:.3,o=this.note_heads[s].line;this.note_heads[s].setLine(o+r)}const e=this.getNoteHeadBeginX(),i=this.hasStem()&&!this.beam;if(this.note_heads.forEach(s=>s.setX(e)),this.stem){let s=this.getStemX();const r=this.keyProps[0].line;(r>6.5||r<-.5)&&(this.beam||(this.stem.renderHeightAdjustment=r>6.5?(r-6.5)*10:Math.abs(r+.5)*10)),this.stem.setNoteHeadXBounds(s,s)}ac("Rendering ",this.isChord()?"chord :":"note :",this.keys),this.drawLedgerLines(),this.applyStyle(),this.setAttribute("el",this.context.openGroup("stavenote",this.getAttribute("id"))),this.context.openGroup("note",null,{pointerBBox:!0}),i&&this.drawStem(),this.drawNoteHeads(),this.drawFlag(),this.context.closeGroup(),this.drawModifiers(),this.context.closeGroup(),this.restoreStyle(),this.setRendered()}}class Qs extends St{static get CATEGORY(){return"frethandfinger"}static format(t,e){const{left_shift:i,right_shift:s}=e,r=1;if(!t||t.length===0)return!1;const o=[];let a=null,l=0,h=0;for(let m=0;m<t.length;++m){const S=t[m],b=S.getNote(),y=S.getPosition(),x=b.getKeyProps()[S.getIndex()];if(b!==a){for(let w=0;w<b.keys.length;++w){const T=b.getKeyProps()[w];i===0&&(l=T.displaced?b.getExtraLeftPx():l),s===0&&(h=T.displaced?b.getExtraRightPx():h)}a=b}o.push({note:b,num:S,pos:y,line:x.line,shiftL:l,shiftR:h})}o.sort((m,S)=>S.line-m.line);let c=0,u=0,f=0,d=0,p=null,g=null;for(let m=0;m<o.length;++m){let S=0;const{note:b,pos:y,num:x,line:w,shiftL:T,shiftR:E}=o[m];(w!==p||b!==g)&&(c=i+T,u=s+E);const C=x.getWidth()+r;y===St.Position.LEFT?(x.setXShift(i+c),S=i+C,f=S>f?S:f):y===St.Position.RIGHT&&(x.setXShift(u),S=h+C,d=S>d?S:d),p=w,g=b}return e.left_shift+=f,e.right_shift+=d,!0}constructor(t){super(),this.setAttribute("type","FretHandFinger"),this.note=null,this.index=null,this.finger=t,this.width=7,this.position=St.Position.LEFT,this.x_shift=0,this.y_shift=0,this.x_offset=0,this.y_offset=0,this.font={family:"sans-serif",size:9,weight:"bold"}}getCategory(){return Qs.CATEGORY}setFretHandFinger(t){return this.finger=t,this}setOffsetX(t){return this.x_offset=t,this}setOffsetY(t){return this.y_offset=t,this}draw(){if(this.checkContext(),!this.note||this.index==null)throw new M.RERR("NoAttachedNote","Can't draw string number without a note and index.");this.setRendered();const t=this.context,e=this.note.getModifierStartXY(this.position,this.index);let i=e.x+this.x_shift+this.x_offset,s=e.y+this.y_shift+this.y_offset+5;switch(this.position){case St.Position.ABOVE:i-=4,s-=12;break;case St.Position.BELOW:i-=2,s+=10;break;case St.Position.LEFT:i-=this.width;break;case St.Position.RIGHT:i+=1;break;default:throw new M.RERR("InvalidPostion",`The position ${this.position} does not exist`)}t.save(),t.setFont(this.font.family,this.font.size,this.font.weight),t.fillText(""+this.finger,i,s),t.restore()}}class te{static get NUM_TONES(){return 12}static get roots(){return["c","d","e","f","g","a","b"]}static get root_values(){return[0,2,4,5,7,9,11]}static get root_indices(){return{c:0,d:1,e:2,f:3,g:4,a:5,b:6}}static get canonical_notes(){return["c","c#","d","d#","e","f","f#","g","g#","a","a#","b"]}static get diatonic_intervals(){return["unison","m2","M2","m3","M3","p4","dim5","p5","m6","M6","b7","M7","octave"]}static get diatonic_accidentals(){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],dorian:[2,1,2,2,2,1,2],mixolydian:[2,2,1,2,2,1,2],minor:[2,1,2,2,1,2,2]}}static get scaleTypes(){return{M:te.scales.major,m:te.scales.minor}}static get accidentals(){return["bb","b","n","#","##"]}static get noteValues(){return{c:{root_index:0,int_val:0},cn:{root_index:0,int_val:0},"c#":{root_index:0,int_val:1},"c##":{root_index:0,int_val:2},cb:{root_index:0,int_val:11},cbb:{root_index:0,int_val:10},d:{root_index:1,int_val:2},dn:{root_index:1,int_val:2},"d#":{root_index:1,int_val:3},"d##":{root_index:1,int_val:4},db:{root_index:1,int_val:1},dbb:{root_index:1,int_val:0},e:{root_index:2,int_val:4},en:{root_index:2,int_val:4},"e#":{root_index:2,int_val:5},"e##":{root_index:2,int_val:6},eb:{root_index:2,int_val:3},ebb:{root_index:2,int_val:2},f:{root_index:3,int_val:5},fn:{root_index:3,int_val:5},"f#":{root_index:3,int_val:6},"f##":{root_index:3,int_val:7},fb:{root_index:3,int_val:4},fbb:{root_index:3,int_val:3},g:{root_index:4,int_val:7},gn:{root_index:4,int_val:7},"g#":{root_index:4,int_val:8},"g##":{root_index:4,int_val:9},gb:{root_index:4,int_val:6},gbb:{root_index:4,int_val:5},a:{root_index:5,int_val:9},an:{root_index:5,int_val:9},"a#":{root_index:5,int_val:10},"a##":{root_index:5,int_val:11},ab:{root_index:5,int_val:8},abb:{root_index:5,int_val:7},b:{root_index:6,int_val:11},bn:{root_index:6,int_val:11},"b#":{root_index:6,int_val:0},"b##":{root_index:6,int_val:1},bb:{root_index:6,int_val:10},bbb:{root_index:6,int_val:9}}}isValidNoteValue(t){return!(t==null||t<0||t>=te.NUM_TONES)}isValidIntervalValue(t){return this.isValidNoteValue(t)}getNoteParts(t){if(!t||t.length<1)throw new M.RERR("BadArguments","Invalid note name: "+t);if(t.length>3)throw new M.RERR("BadArguments","Invalid note name: "+t);const e=t.toLowerCase(),s=/^([cdefgab])(b|bb|n|#|##)?$/.exec(e);if(s!=null){const r=s[1],o=s[2];return{root:r,accidental:o}}else throw new M.RERR("BadArguments","Invalid note name: "+t)}getKeyParts(t){if(!t||t.length<1)throw new M.RERR("BadArguments","Invalid key: "+t);const e=t.toLowerCase(),s=/^([cdefgab])(b|#)?(mel|harm|m|M)?$/.exec(e);if(s!=null){const r=s[1],o=s[2];let a=s[3];return a||(a="M"),{root:r,accidental:o,type:a}}else throw new M.RERR("BadArguments",`Invalid key: ${t}`)}getNoteValue(t){const e=te.noteValues[t];if(e==null)throw new M.RERR("BadArguments",`Invalid note name: ${t}`);return e.int_val}getIntervalValue(t){const e=te.intervals[t];if(e==null)throw new M.RERR("BadArguments",`Invalid interval name: ${t}`);return e}getCanonicalNoteName(t){if(!this.isValidNoteValue(t))throw new M.RERR("BadArguments",`Invalid note value: ${t}`);return te.canonical_notes[t]}getCanonicalIntervalName(t){if(!this.isValidIntervalValue(t))throw new M.RERR("BadArguments",`Invalid interval value: ${t}`);return te.diatonic_intervals[t]}getRelativeNoteValue(t,e,i){if(i==null&&(i=1),i!==1&&i!==-1)throw new M.RERR("BadArguments",`Invalid direction: ${i}`);let s=(t+i*e)%te.NUM_TONES;return s<0&&(s+=te.NUM_TONES),s}getRelativeNoteName(t,e){const i=this.getNoteParts(t),s=this.getNoteValue(i.root);let r=e-s;if(Math.abs(r)>te.NUM_TONES-3){let a=1;r>0&&(a=-1);const l=(e+1+(s+1))%te.NUM_TONES*a;if(Math.abs(l)>2)throw new M.RERR("BadArguments",`Notes not related: ${t}, ${e})`);r=l}if(Math.abs(r)>2)throw new M.RERR("BadArguments",`Notes not related: ${t}, ${e})`);let o=i.root;if(r>0)for(let a=1;a<=r;++a)o+="#";else if(r<0)for(let a=-1;a>=r;--a)o+="b";return o}getScaleTones(t,e){const i=[t];let s=t;for(let r=0;r<e.length;r+=1)s=this.getRelativeNoteValue(s,e[r]),s!==t&&i.push(s);return i}getIntervalBetween(t,e,i){if(i==null&&(i=1),i!==1&&i!==-1)throw new M.RERR("BadArguments",`Invalid direction: ${i}`);if(!this.isValidNoteValue(t)||!this.isValidNoteValue(e))throw new M.RERR("BadArguments",`Invalid notes: ${t}, ${e}`);let s=i===1?e-t:t-e;return s<0&&(s+=te.NUM_TONES),s}createScaleMap(t){const e=this.getKeyParts(t),i=te.scaleTypes[e.type];let s=e.root;if(e.accidental&&(s+=e.accidental),!i)throw new M.RERR("BadArguments","Unsupported key type: "+t);const r=this.getScaleTones(this.getNoteValue(s),i),o=te.root_indices[e.root],a={};for(let l=0;l<te.roots.length;++l){const h=(o+l)%te.roots.length,c=te.roots[h];let u=this.getRelativeNoteName(c,r[l]);u.length===1&&(u+="n"),a[c]=u}return a}}function mn(...n){is.DEBUG&&M.L("Vex.Flow.Accidental",n)}const Ns=n=>n.getMetrics().width;class is extends St{static get CATEGORY(){return"accidentals"}static format(t,e){const s=e.left_shift+1,r=3;if(!t||t.length===0)return;const o=[];let a=null,l=0,h;for(let b=0;b<t.length;++b){const y=t[b],x=y.getNote(),w=x.getStave(),T=x.getKeyProps()[y.getIndex()];if(x!==a){for(let E=0;E<x.keys.length;++E)h=x.getKeyProps()[E],l=h.displaced?x.getExtraLeftPx():l;a=x}if(w!==null){const E=w.options.spacing_between_lines_px,C=w.getYForLine(T.line),P=Math.round(C/E*2)/2;o.push({y:C,line:P,shift:l,acc:y,lineSpace:E})}else o.push({line:T.line,shift:l,acc:y})}o.sort((b,y)=>y.line-b.line);const c=[];let u=0,f=null;for(let b=0;b<o.length;b++){const y=o[b];(f===null||f!==y.line)&&c.push({line:y.line,flatLine:!0,dblSharpLine:!0,numAcc:0,width:0}),y.acc.type!=="b"&&y.acc.type!=="bb"&&(c[c.length-1].flatLine=!1),y.acc.type!=="##"&&(c[c.length-1].dblSharpLine=!1),c[c.length-1].numAcc++,c[c.length-1].width+=y.acc.getWidth()+r,u=y.shift>u?y.shift:u,f=y.line}let d=0;for(let b=0;b<c.length;b++){let y=!1;const x=b;let w=b;for(;w+1<c.length&&!y;)this.checkCollision(c[w],c[w+1])?w++:y=!0;const T=v=>c[x+v],E=v=>v.map(T),C=(v,G)=>{const[et,H]=E([v,G]).map(nt=>nt.line);return et-H},P=(...v)=>v.map(E).every(G=>!this.checkCollision(...G)),I=w-x+1;let F=this.checkCollision(c[x],c[w])?"a":"b";switch(I){case 3:F==="a"&&C(1,2)===.5&&C(0,1)!==.5&&(F="second_on_bottom");break;case 4:P([0,2],[1,3])&&(F="spaced_out_tetrachord");break;case 5:F==="b"&&P([1,3])&&(F="spaced_out_pentachord",P([0,2],[2,4])&&(F="very_spaced_out_pentachord"));break;case 6:P([0,3],[1,4],[2,5])&&(F="spaced_out_hexachord"),P([0,2],[2,4],[1,3],[3,5])&&(F="very_spaced_out_hexachord");break}let L,k;if(I>=7){let v=2,G=!0;for(;G===!0;){G=!1;for(let et=0;et+v<c.length;et++)if(this.checkCollision(c[et],c[et+v])){G=!0,v++;break}}for(L=b;L<=w;L++)k=(L-b)%v+1,c[L].column=k,d=d>k?d:k}else for(L=b;L<=w;L++)k=V.accidentalColumnsTable[I][F][L-b],c[L].column=k,d=d>k?d:k;b=w}const p=[],g=[];for(let b=0;b<=d;b++)p[b]=0,g[b]=0;p[0]=u+s,g[0]=u+s,c.forEach(b=>{b.width>p[b.column]&&(p[b.column]=b.width)});for(let b=1;b<p.length;b++)g[b]=p[b]+g[b-1];const m=g[g.length-1];let S=0;c.forEach(b=>{let y=0;const x=S+b.numAcc;for(S;S<x;S++){const w=g[b.column-1]+y;o[S].acc.setXShift(w),y+=o[S].acc.getWidth()+r,mn("Line, accCount, shift: ",b.line,S,w)}}),e.left_shift+=m}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 r=Math.abs(i)<s;return mn("Line_1, Line_2, Collision: ",t.line,e.line,r),r}static applyAccidentals(t,e){const i=[],s={};t.forEach(a=>{const l=new Rt(0,1);a.getTickables().forEach(c=>{if(c.shouldIgnoreTicks())return;const u=s[l.value()];u?u.push(c):(i.push(l.value()),s[l.value()]=[c]),l.add(c.getTicks())})});const r=new te;e||(e="C");const o=r.createScaleMap(e);i.forEach(a=>{const l=s[a],h=[],c=u=>{u.isRest()||u.shouldIgnoreTicks()||(u.keys.forEach((f,d)=>{const p=r.getNoteParts(f.split("/")[0]),g=p.accidental||"n",m=p.root+g,S=o[p.root]===m,b=h.indexOf(m)>-1;if(!S||S&&b){o[p.root]=m;const y=new is(g);u.addAccidental(d,y),h.push(m)}}),u.getModifiers().forEach(f=>{f.getCategory()==="gracenotegroups"&&f.getGraceNotes().forEach(c)}))};l.forEach(c)})}constructor(t=null){if(super(),this.setAttribute("type","Accidental"),mn("New accidental: ",t),this.note=null,this.index=null,this.type=t,this.position=St.Position.LEFT,this.render_options={font_scale:38,stroke_px:3,parenLeftPadding:2,parenRightPadding:2},this.accidental=V.accidentalCodes(this.type),!this.accidental)throw new M.RERR("ArgumentError",`Unknown accidental type: ${t}`);this.cautionary=!1,this.parenLeft=null,this.parenRight=null,this.reset()}reset(){const t=this.render_options.font_scale;this.glyph=new xt(this.accidental.code,t),this.glyph.setOriginX(1),this.cautionary&&(this.parenLeft=new xt(V.accidentalCodes("{").code,t),this.parenRight=new xt(V.accidentalCodes("}").code,t),this.parenLeft.setOriginX(1),this.parenRight.setOriginX(1))}getCategory(){return is.CATEGORY}getWidth(){const t=this.cautionary?Ns(this.parenLeft)+Ns(this.parenRight)+this.render_options.parenLeftPadding+this.render_options.parenRightPadding:0;return Ns(this.glyph)+t}setNote(t){if(!t)throw new M.RERR("ArgumentError",`Bad note value: ${t}`);this.note=t,this.note.getCategory()==="gracenotes"&&(this.render_options.font_scale=25,this.reset())}setAsCautionary(){return this.cautionary=!0,this.render_options.font_scale=28,this.reset(),this}draw(){const{context:t,type:e,position:i,note:s,index:r,cautionary:o,x_shift:a,y_shift:l,glyph:h,parenLeft:c,parenRight:u,render_options:{parenLeftPadding:f,parenRightPadding:d}}=this;if(this.checkContext(),!(s&&r!=null))throw new M.RERR("NoAttachedNote","Can't draw accidental without a note and index.");const p=s.getModifierStartXY(i,r);let g=p.x+a;const m=p.y+l;mn("Rendering: ",e,g,m),o?(u.render(t,g,m),g-=Ns(u),g-=d,g-=this.accidental.parenRightPaddingAdjustment,h.render(t,g,m),g-=Ns(h),g-=f,c.render(t,g,m)):h.render(t,g,m),this.setRendered()}}class $s extends St{static get CATEGORY(){return"notesubgroup"}static format(t,e){if(!t||t.length===0)return!1;let i=0;for(let s=0;s<t.length;++s){const r=t[s];r.preFormat(),i+=r.getWidth()}return e.left_shift+=i,!0}constructor(t){return super(),this.setAttribute("type","NoteSubGroup"),this.note=null,this.index=null,this.position=St.Position.LEFT,this.subNotes=t,this.subNotes.forEach(e=>{e.ignore_ticks=!1}),this.width=0,this.preFormatted=!1,this.formatter=new si,this.voice=new ye({num_beats:4,beat_value:4,resolution:V.RESOLUTION}).setStrict(!1),this.voice.addTickables(this.subNotes),this}getCategory(){return $s.CATEGORY}preFormat(){this.preFormatted||(this.formatter.joinVoices([this.voice]).format([this.voice],0),this.setWidth(this.formatter.getMinTotalWidth()),this.preFormatted=!0)}setNote(t){this.note=t}setWidth(t){this.width=t}getWidth(){return this.width}draw(){this.checkContext();const t=this.getNote();if(!(t&&this.index!==null))throw new M.RuntimeError("NoAttachedNote","Can't draw notes without a parent note and parent note index.");this.setRendered(),this.alignSubNotesWithNote(this.subNotes,t),this.subNotes.forEach(e=>e.setContext(this.context).drawWithStyle())}}class Qn extends he{constructor(t,e){super(),this.setAttribute("type","StaveTie"),this.notes=t,this.context=null,this.text=e,this.direction=null,this.render_options={cp1:8,cp2:12,text_shift_x:0,first_x_shift:0,last_x_shift:0,y_shift:7,tie_spacing:0,font:{family:"Arial",size:15,style:""}},this.font=this.render_options.font,this.setNotes(t)}setFont(t){return this.font=t,this}setDirection(t){return this.direction=t,this}setNotes(t){if(!t.first_note&&!t.last_note)throw new M.RuntimeError("BadArguments","Tie needs to have either first_note or last_note set.");if(t.first_indices||(t.first_indices=[0]),t.last_indices||(t.last_indices=[0]),t.first_indices.length!==t.last_indices.length)throw new M.RuntimeError("BadArguments","Tied notes must have similar index sizes");return this.first_note=t.first_note,this.first_indices=t.first_indices,this.last_note=t.last_note,this.last_indices=t.last_indices,this}isPartial(){return!this.first_note||!this.last_note}renderTie(t){if(t.first_ys.length===0||t.last_ys.length===0)throw new M.RERR("BadArguments","No Y-values to render");const e=this.context;let i=this.render_options.cp1,s=this.render_options.cp2;Math.abs(t.last_x_px-t.first_x_px)<10&&(i=2,s=8);const r=this.render_options.first_x_shift,o=this.render_options.last_x_shift,a=this.render_options.y_shift*t.direction;for(let l=0;l<this.first_indices.length;++l){const h=(t.last_x_px+o+(t.first_x_px+r))/2;let c=t.first_ys[this.first_indices[l]]+a,u=t.last_ys[this.last_indices[l]]+a;if(isNaN(c)||isNaN(u))throw new M.RERR("BadArguments","Bad indices for tie rendering.");const f=(c+u)/2+i*t.direction,d=(c+u)/2+s*t.direction;let p=c>f&&Math.abs(c-f)<10?-6:0;if(this.first_note&&this.first_note.DYMusicScoreType==="jianpu"){if(this.getAttribute("type")==="TabTie")continue;c<f&&(p=-15),c!=u&&(c=u=Math.max(c,u))}let g;this.first_note&&(g=this.first_note.getAttribute("id")+"-tie"),this.setAttribute("el",e.openGroup("stavetie",g)),e.beginPath(),e.moveTo(t.first_x_px+r,c+p),e.quadraticCurveTo(h,f+p*2.3,t.last_x_px+o,u+p),e.quadraticCurveTo(h,d+p*2.3,t.first_x_px+r,c+p),e.closePath(),e.fill(),e.closeGroup()}}renderText(t,e){if(!this.text)return;let i=(t+e)/2;i-=this.context.measureText(this.text).width/2;let s=0;this.first_note&&this.first_note.DYMusicScoreType==="jianpu"&&(s=2),this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.style),this.context.fillText(this.text,i+this.render_options.text_shift_x,(this.first_note||this.last_note).getStave().getYForTopText()-1+s),this.context.restore()}draw(){this.checkContext(),this.setRendered();const t=this.first_note,e=this.last_note;let i,s,r,o,a;return t?(i=t.getTieRightX()+this.render_options.tie_spacing,a=t.getStemDirection(),r=t.getYs()):(i=e.getStave().getTieStartX(),r=e.getYs(),this.first_indices=this.last_indices),e?(s=e.getTieLeftX()+this.render_options.tie_spacing,a=e.getStemDirection(),o=e.getYs(),e.attrs.type==="GraceNote"&&(s+=5,i-=15)):(s=t.getStave().getTieEndX(),o=t.getYs(),this.last_indices=this.first_indices),this.direction&&(a=this.direction),this.renderTie({first_x_px:i,last_x_px:s,first_ys:r,last_ys:o,direction:a}),this.renderText(i,s),!0}}class ys extends Qn{static createHammeron(t){return new ys(t,"H")}static createPulloff(t){return new ys(t,"P")}constructor(t,e){super(t,e),this.setAttribute("type","TabTie"),this.render_options.cp1=9,this.render_options.cp2=11,this.render_options.y_shift=3,this.setNotes(t)}draw(){this.checkContext(),this.setRendered();const t=this.first_note,e=this.last_note;let i,s,r,o;return t?(i=t.getTieRightX()+this.render_options.tie_spacing,r=t.getYs()):(i=e.getStave().getTieStartX(),r=e.getYs(),this.first_indices=this.last_indices),e?(s=e.getTieLeftX()+this.render_options.tie_spacing,o=e.getYs()):(s=t.getStave().getTieEndX(),o=t.getYs(),this.last_indices=this.first_indices),this.renderTie({first_x_px:i,last_x_px:s,first_ys:r,last_ys:o,direction:-1}),this.renderText(i,s),!0}}function uc(...n){Ps.DEBUG&&M.L("Vex.Flow.GraceNoteGroup",n)}class Ps extends St{static get CATEGORY(){return"gracenotegroups"}static format(t,e){if(!t||t.length===0)return!1;const r=[];let o=null,a=0;for(let c=0;c<t.length;++c){const u=t[c],f=u.getNote(),d=f.getCategory()===ae.CATEGORY,p=d?4:0;if(d&&f!==o){for(let g=0;g<f.keys.length;++g)a=f.getKeyProps()[g].displaced?f.getExtraLeftPx():a;o=f}r.push({shift:a,gracenote_group:u,spacing:p})}let l=r[0].shift,h;for(let c=0;c<r.length;++c){const u=r[c].gracenote_group;u.preFormat(),h=u.getWidth()+r[c].spacing,l=Math.max(h,l)}for(let c=0;c<r.length;++c){const u=r[c].gracenote_group;h=u.getWidth()+r[c].spacing,u.setSpacingFromNextModifier(l-Math.min(h,l))}return e.left_shift+=l,!0}constructor(t,e){return super(),this.setAttribute("type","GraceNoteGroup"),this.note=null,this.index=null,this.position=St.Position.LEFT,this.grace_notes=t,this.width=0,this.preFormatted=!1,this.show_slur=e,this.slur=null,this.formatter=new si,this.voice=new ye({num_beats:4,beat_value:4,resolution:V.RESOLUTION}).setStrict(!1),this.render_options={slur_y_shift:0},this.beams=[],this.voice.addTickables(this.grace_notes),this}getCategory(){return Ps.CATEGORY}preFormat(){this.preFormatted||(this.formatter.joinVoices([this.voice]).format([this.voice],0),this.setWidth(this.formatter.getMinTotalWidth()),this.preFormatted=!0)}beamNotes(t){if(t=t||this.grace_notes,t.length>1){const e=new Vi(t);e.render_options.beam_width=3,e.render_options.partial_beam_length=4,this.beams.push(e)}return this}setNote(t){this.note=t}setWidth(t){this.width=t}getWidth(){return this.width}getGraceNotes(){return this.grace_notes}draw(){this.checkContext();const t=this.getNote();if(uc("Drawing grace note group for:",t),!(t&&this.index!==null))throw new M.RuntimeError("NoAttachedNote","Can't draw grace note without a parent note and parent note index.");if(this.setRendered(),this.alignSubNotesWithNote(this.getGraceNotes(),t),this.grace_notes.forEach(e=>{e.setContext(this.context).draw()}),this.beams.forEach(e=>{e.setContext(this.context).draw()}),this.show_slur){const e=this.getNote().getCategory()===ae.CATEGORY,i=e?Qn:ys;this.slur=new i({last_note:this.grace_notes[0],first_note:t,first_indices:[0],last_indices:[0]}),this.slur.render_options.cp2=12,this.slur.render_options.y_shift=(e?7:5)+this.render_options.slur_y_shift,this.slur.setContext(this.context).draw()}}}class Te extends St{static get CATEGORY(){return"strokes"}static get Type(){return{BRUSH_DOWN:1,BRUSH_UP:2,ROLL_DOWN:3,ROLL_UP:4,RASQUEDO_DOWN:5,RASQUEDO_UP:6,ARPEGGIO_DIRECTIONLESS:7}}static format(t,e){const i=e.left_shift,s=0;if(!t||t.length===0)return this;const r=t.map(l=>{const h=l.getNote();if(h instanceof ae){const{line:c,displaced:u}=h.getKeyProps()[l.getIndex()],f=u?h.getExtraLeftPx():0;return{line:c,shift:f,stroke:l}}else{const{str:c}=h.getPositions()[l.getIndex()];return{line:c,shift:0,stroke:l}}}),o=i,a=r.reduce((l,{stroke:h,shift:c})=>(h.setXShift(o+c),Math.max(h.getWidth()+s,l)),0);return e.left_shift+=a,!0}constructor(t,e){super(),this.setAttribute("type","Stroke"),this.note=null,this.options=M.Merge({},e),this.all_voices="all_voices"in this.options?this.options.all_voices:!0,this.note_end=null,this.index=null,this.type=t,this.position=St.Position.LEFT,this.render_options={font_scale:38,stroke_px:3,stroke_spacing:10},this.font={family:"serif",size:10,weight:"bold italic"},this.setXShift(0),this.setWidth(10)}getCategory(){return Te.CATEGORY}getPosition(){return this.position}addEndNote(t){return this.note_end=t,this}draw(){if(this.checkContext(),this.setRendered(),!(this.note&&this.index!=null))throw new M.RERR("NoAttachedNote","Can't draw stroke without a note and index.");const t=this.note.getModifierStartXY(this.position,this.index);let e=this.note.getYs(),i=t.y,s=t.y;const r=t.x-5,o=this.note.stave.options.spacing_between_lines_px,a=this.getModifierContext().getModifiers(this.note.getCategory());for(let d=0;d<a.length;d++){e=a[d].getYs();for(let p=0;p<e.length;p++)(this.note===a[d]||this.all_voices)&&(i=M.Min(i,e[p]),s=M.Max(s,e[p]))}let l,h,c,u,f;switch(this.type){case Te.Type.BRUSH_DOWN:l="vc3",h=-3,c=i-o/2+10,s+=o/2;break;case Te.Type.BRUSH_UP:l="v11",h=.5,c=s+o/2,i-=o/2;break;case Te.Type.ROLL_DOWN:case Te.Type.RASQUEDO_DOWN:l="vc3",h=-3,u=this.x_shift+h-2,this.note instanceof ae?(i+=1.5*o,(s-i)%2!==0?s+=.5*o:s+=o,c=i-o,f=s+o+2):(i+=1.5*o,s+=o,c=i-.75*o,f=s+.25*o);break;case Te.Type.ROLL_UP:case Te.Type.RASQUEDO_UP:l="v52",h=-4,u=this.x_shift+h-1,this.note instanceof ae?(c=o/2,i+=.5*o,(s-i)%2===0&&(s+=o/2),c=s+.5*o,f=i-1.25*o):(i+=.25*o,s+=.5*o,c=s+.25*o,f=i-o);break;case Te.Type.ARPEGGIO_DIRECTIONLESS:i+=.5*o,s+=o;break;default:throw new M.RERR("InvalidType",`The stroke type ${this.type} does not exist`)}if(this.type===Te.Type.BRUSH_DOWN||this.type===Te.Type.BRUSH_UP)this.context.fillRect(r+this.x_shift,i,1,s-i);else if(this.note instanceof ae)for(let d=i;d<=s;d+=o)xt.renderGlyph(this.context,r+this.x_shift-4,d,this.render_options.font_scale,"va3");else{let d;for(d=i;d<=s;d+=10)xt.renderGlyph(this.context,r+this.x_shift-4,d,this.render_options.font_scale,"va3");this.type===Te.Type.RASQUEDO_DOWN&&(f=d+.25*o)}this.type!==Te.Type.ARPEGGIO_DIRECTIONLESS&&(xt.renderGlyph(this.context,r+this.x_shift+h,c,this.render_options.font_scale,l),(this.type===Te.Type.RASQUEDO_DOWN||this.type===Te.Type.RASQUEDO_UP)&&(this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.weight),this.context.fillText("R",r+u,f),this.context.restore()))}}class tn extends St{static get CATEGORY(){return"stringnumber"}static format(t,e){const i=e.left_shift,s=e.right_shift,r=1;if(!t||t.length===0)return this;const o=[];let a=null,l=0,h=0,c,u,f,d,p;for(c=0;c<t.length;++c)for(u=t[c],f=u.getNote(),c=0;c<t.length;++c){u=t[c],f=u.getNote(),d=u.getPosition();const x=f.getKeyProps()[u.getIndex()];if(f!==a){for(let w=0;w<f.keys.length;++w)p=f.getKeyProps()[w],i===0&&(l=p.displaced?f.getExtraLeftPx():l),s===0&&(h=p.displaced?f.getExtraRightPx():h);a=f}o.push({pos:d,note:f,num:u,line:x.line,shiftL:l,shiftR:h})}o.sort((x,w)=>w.line-x.line);let g=0,m=0,S=0,b=null,y=null;for(c=0;c<o.length;++c){let x=0;f=o[c].note,d=o[c].pos,u=o[c].num;const w=o[c].line;o[c].shiftL;const T=o[c].shiftR;(w!==b||f!==y)&&(g=s+T);const E=u.getWidth()+r;d===St.Position.LEFT?(u.setXShift(i),x=l+E,m=x>m?x:m):d===St.Position.RIGHT&&(u.setXShift(g),x+=E,S=x>S?x:S),b=w,y=f}return e.left_shift+=m,e.right_shift+=S,!0}constructor(t){super(),this.setAttribute("type","StringNumber"),this.note=null,this.last_note=null,this.index=null,this.string_number=t,this.setWidth(20),this.position=St.Position.ABOVE,this.x_shift=0,this.y_shift=0,this.x_offset=0,this.y_offset=0,this.dashed=!0,this.leg=Zt.LineEndType.NONE,this.radius=8,this.font={family:"sans-serif",size:10,weight:"bold"}}getCategory(){return tn.CATEGORY}getNote(){return this.note}setNote(t){return this.note=t,this}getIndex(){return this.index}setIndex(t){return this.index=t,this}setLineEndType(t){return t>=Zt.LineEndType.NONE&&t<=Zt.LineEndType.DOWN&&(this.leg=t),this}setStringNumber(t){return this.string_number=t,this}setOffsetX(t){return this.x_offset=t,this}setOffsetY(t){return this.y_offset=t,this}setLastNote(t){return this.last_note=t,this}setDashed(t){return this.dashed=t,this}draw(){const t=this.checkContext();if(!(this.note&&this.index!=null))throw new M.RERR("NoAttachedNote","Can't draw string number without a note and index.");this.setRendered();const e=this.note.stave.options.spacing_between_lines_px,i=this.note.getModifierStartXY(this.position,this.index);let s=i.x+this.x_shift+this.x_offset,r=i.y+this.y_shift+this.y_offset;switch(this.position){case St.Position.ABOVE:case St.Position.BELOW:{const a=this.note.getStemExtents();let l=a.topY,h=a.baseY+2;this.note.stem_direction===ae.STEM_DOWN&&(l=a.baseY,h=a.topY-2),this.position===St.Position.ABOVE?r=this.note.hasStem()?l-e*1.75:i.y-e*1.75:r=this.note.hasStem()?h+e*1.5:i.y+e*1.75,r+=this.y_shift+this.y_offset;break}case St.Position.LEFT:s-=this.radius/2+5;break;case St.Position.RIGHT:s+=this.radius/2+6;break;default:throw new M.RERR("InvalidPosition",`The position ${this.position} is invalid`)}t.save(),t.beginPath(),t.arc(s,r,this.radius,0,Math.PI*2,!1),t.lineWidth=1.5,t.stroke(),t.setFont(this.font.family,this.font.size,this.font.weight);const o=s-t.measureText(this.string_number).width/2;if(t.fillText(""+this.string_number,o,r+4.5),this.last_note!=null){const a=this.last_note.getStemX()-this.note.getX()+5;t.strokeStyle="#000000",t.lineCap="round",t.lineWidth=.6,this.dashed?Zt.drawDashedLine(t,s+10,r,s+a,r,[3,3]):Zt.drawDashedLine(t,s+10,r,s+a,r,[3,0]);let l,h;switch(this.leg){case Zt.LineEndType.UP:l=-10,h=this.dashed?[3,3]:[3,0],Zt.drawDashedLine(t,s+a,r,s+a,r+l,h);break;case Zt.LineEndType.DOWN:l=10,h=this.dashed?[3,3]:[3,0],Zt.drawDashedLine(t,s+a,r,s+a,r+l,h);break}}t.restore()}}function fc(...n){Ri.DEBUG&&M.L("Vex.Flow.Articulation",n)}const{ABOVE:Qi,BELOW:Vs}=St.Position,Ca=(n,t)=>n(t/.5)*.5,ao=(n,t)=>t===Qi?n<=5:n>=1,Ra=(n,t)=>ao(n,t)?t===Qi?Math.ceil:Math.floor:Math.round,dc=(n,t,e,i)=>{const s=Ca(Ra(t,e),t),r=n&&ao(s,e),o=s%1===0;return r&&o?s+.5*-i:s},lo=n=>{const t=n.getCategory();return t==="stavenotes"||t==="gracenotes"},Na=n=>{const t=n.getCategory();return t==="tabnotes"||t==="numberednotes"},pc=(n,t)=>{const e=n.getStave(),i=n.getStemDirection(),{topY:s,baseY:r}=n.getStemExtents();if(lo(n))return n.hasStem()?i===ft.UP?s:r:Math.min(...n.getYs());if(Na(n))return n.hasStem()&&i===ft.UP?s:e.getYForTopText(t);throw new M.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")},mc=(n,t)=>{const e=n.getStave(),i=n.getStemDirection(),{topY:s,baseY:r}=n.getStemExtents();if(lo(n))return n.hasStem()?i===ft.UP?r:s:Math.max(...n.getYs());if(Na(n))return n.hasStem()?i===ft.UP?e.getYForBottomText(t):s:e.getYForBottomText(t);throw new M.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")},gc=(n,t)=>{const e=t===Qi&&n.getStemDirection()===ft.UP||t===Vs&&n.getStemDirection()===ft.DOWN;return lo(n)?n.hasStem()&&e?.5:1:n.hasStem()&&e?1:0};class Ri extends St{static get CATEGORY(){return"articulations"}static get INITIAL_OFFSET(){return-.5}static format(t,e){if(!t||t.length===0)return!1;const i=l=>l.getPosition()===Qi,s=l=>l.getPosition()===Vs,r=.5,o=(l,h,c)=>Ca(Ra(h,c),l.glyph.getMetrics().height/10+r);t.filter(i).forEach(l=>{l.setTextLine(e.top_text_line),e.top_text_line+=o(l,e.top_text_line,Qi)}),t.filter(s).forEach(l=>{l.setTextLine(e.text_line),e.text_line+=o(l,e.text_line,Vs)});const a=t.map(l=>l.getWidth()).reduce((l,h)=>Math.max(h,l));return e.left_shift+=a/2,e.right_shift+=a/2,!0}static easyScoreHook({articulations:t},e,i){if(!t)return;const s={staccato:"a.",tenuto:"a-"};t.split(",").map(r=>r.trim().split(".")).map(([r,o])=>{const a={type:s[r]};return o&&(a.position=St.PositionString[o]),i.getFactory().Articulation(a)}).map(r=>e.addModifier(0,r))}constructor(t){if(super(),this.setAttribute("type","Articulation"),this.note=null,this.index=null,this.type=t,this.position=Vs,this.render_options={font_scale:38},this.articulation=V.articulationCodes(this.type),!this.articulation)throw new M.RERR("ArgumentError",`Articulation not found: ${this.type}`);this.glyph=new xt(this.articulation.code,this.render_options.font_scale),this.setWidth(this.glyph.getMetrics().width)}getCategory(){return Ri.CATEGORY}draw(){const{note:t,index:e,position:i,glyph:s,articulation:{between_lines:r},text_line:o,context:a}=this;if(this.checkContext(),!t||e==null)throw new M.RERR("NoAttachedNote","Can't draw Articulation without a note and index.");this.setRendered();const l=t.getStave(),h=l.getSpacingBetweenLines(),c=t.getCategory()==="tabnotes",{x:u}=t.getModifierStartXY(i,e),f=!r||c,d=gc(t,i);let p={[Qi]:()=>{s.setOrigin(.5,1);const g=pc(t,o)-(o+d)*h+(this.y_shift||0);return f?Math.min(l.getYForTopText(Ri.INITIAL_OFFSET),g):g},[Vs]:()=>{s.setOrigin(.5,0);const g=mc(t,o)+(o+d)*h;return f?Math.max(l.getYForBottomText(Ri.INITIAL_OFFSET),g):g}}[i]();if(!c){const g=i===Qi?-1:1,m=c?t.positions[e].str:t.getKeyProps()[e].line,b=(t.getYs()[e]-p)/h+m,y=dc(r,b,i,g);ao(y,i)&&s.setOrigin(.5,.5),p+=Math.abs(y-b)*h*g}fc(`Rendering articulation at (x: ${u}, y: ${p})`),s.render(a,u,p)}}class xs extends Ta{static getNextContext(t){const e=t.tContexts,i=e.indexOf(t);return e[i+1]}constructor(){super(),this.setAttribute("type","TickContext"),this.currentTick=new Rt(0,1),this.maxTicks=new Rt(0,1),this.minTicks=null,this.padding=3,this.x=0,this.xBase=0,this.xOffset=0,this.tickables=[],this.notePx=0,this.extraLeftPx=0,this.extraRightPx=0,this.tContexts=[]}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+this.padding*2}setPadding(t){return this.padding=t,this}getMaxTicks(){return this.maxTicks}getMinTicks(){return this.minTicks}getTickables(){return this.tickables}getCenterAlignedTickables(){return this.tickables.filter(t=>t.isCenterAligned())}getMetrics(){const{width:t,notePx:e,extraLeftPx:i,extraRightPx:s}=this;return{width:t,notePx:e,extraLeftPx:i,extraRightPx:s}}getCurrentTick(){return this.currentTick}setCurrentTick(t){this.currentTick=t,this.preFormatted=!1}getExtraPx(){let t=0,e=0,i=0,s=0;for(let r=0;r<this.tickables.length;r++){i=Math.max(this.tickables[r].extraLeftPx||0,i),s=Math.max(this.tickables[r].extraRightPx||0,s);const o=this.tickables[r].modifierContext;o&&o!=null&&(t=Math.max(t,o.state.left_shift),e=Math.max(e,o.state.right_shift))}return{left:t,right:e,extraLeft:i,extraRight:s}}addTickable(t){if(!t)throw new M.RERR("BadArgument","Invalid tickable added.");if(!t.shouldIgnoreTicks()){this.ignore_ticks=!1;const e=t.getTicks();e.greaterThan(this.maxTicks)&&(this.maxTicks=e.clone()),this.minTicks==null?this.minTicks=e.clone():e.lessThan(this.minTicks)&&(this.minTicks=e.clone())}return t.setTickContext(this),this.tickables.push(t),this.preFormatted=!1,this}preFormat(){if(this.preFormatted)return this;for(let t=0;t<this.tickables.length;++t){const e=this.tickables[t];e.preFormat();const i=e.getMetrics();this.extraLeftPx=Math.max(this.extraLeftPx,i.extraLeftPx+i.modLeftPx),this.extraRightPx=Math.max(this.extraRightPx,i.extraRightPx+i.modRightPx),this.notePx=Math.max(this.notePx,i.noteWidth),this.width=this.notePx+this.extraLeftPx+this.extraRightPx}return this}postFormat(){return this.postFormatted?this:(this.postFormatted=!0,this)}}function bc(...n){en.DEBUG&&M.L("Vex.Flow.Ornament",n)}class en extends St{static get CATEGORY(){return"ornaments"}static format(t,e){if(!t||t.length===0)return!1;let i=0;for(let s=0;s<t.length;++s){const r=t[s],o=2;i=Math.max(r.getWidth(),i),r.getPosition()===St.Position.ABOVE?(r.setTextLine(e.top_text_line),e.top_text_line+=o):(r.setTextLine(e.text_line),e.text_line+=o)}return e.left_shift+=i/2,e.right_shift+=i/2,!0}constructor(t){if(super(),this.setAttribute("type","Ornament"),this.note=null,this.index=null,this.type=t,this.position=St.Position.ABOVE,this.delayed=!1,this.accidentalUpper=null,this.accidentalLower=null,this.render_options={font_scale:38,accidentalLowerPadding:3,accidentalUpperPadding:3},this.ornament=V.ornamentCodes(this.type),!this.ornament)throw new M.RERR("ArgumentError",`Ornament not found: '${this.type}'`);this.glyph=new xt(this.ornament.code,this.render_options.font_scale),this.glyph.setOrigin(.5,1)}getCategory(){return en.CATEGORY}setDelayed(t){return this.delayed=t,this}setUpperAccidental(t){const e=this.render_options.font_scale/1.3;return this.accidentalUpper=new xt(V.accidentalCodes(t).code,e),this.accidentalUpper.setOrigin(.5,1),this}setLowerAccidental(t){const e=this.render_options.font_scale/1.3;return this.accidentalLower=new xt(V.accidentalCodes(t).code,e),this.accidentalLower.setOrigin(.5,1),this}draw(){if(this.checkContext(),!this.note||this.index==null)throw new M.RERR("NoAttachedNote","Can't draw Ornament without a note and index.");this.setRendered();const t=this.context,e=this.note.getStemDirection(),i=this.note.getStave(),s=this.note.getStem().getExtents();let r=e===ae.STEM_DOWN?s.baseY:s.topY;this.note.getCategory()==="tabnotes"&&(this.note.hasStem()?e===ae.STEM_DOWN&&(r=i.getYForTopText(this.text_line)):r=i.getYForTopText(this.text_line));const o=e===ae.STEM_DOWN,a=i.getSpacingBetweenLines();let l=1;!o&&this.note.beam&&(l+=.5);const h=a*(this.text_line+l),c=r-h;let f=this.note.getModifierStartXY(this.position,this.index).x,d=Math.min(i.getYForTopText(this.text_line),c);if(d+=this.y_shift,this.delayed){let p=0;if(this.delayXShift!==void 0)p=this.delayXShift;else{p+=this.glyph.getMetrics().width/2;const g=xs.getNextContext(this.note.getTickContext());g?p+=(g.getX()-f)*.5:p+=(i.x+i.width-f)*.5,this.delayXShift=p}f+=p}bc("Rendering ornament: ",this.ornament,f,d),this.accidentalLower&&(this.accidentalLower.render(t,f,d),d-=this.accidentalLower.getMetrics().height,d-=this.render_options.accidentalLowerPadding),this.glyph.render(t,f,d),d-=this.glyph.getMetrics().height,this.accidentalUpper&&(d-=this.render_options.accidentalUpperPadding,this.accidentalUpper.render(t,f,d))}}function Sc(...n){se.DEBUG&&M.L("Vex.Flow.Annotation",n)}class se extends St{static get CATEGORY(){return"annotations"}static get Justify(){return{LEFT:1,CENTER:2,RIGHT:3,CENTER_STEM:4}}static get JustifyString(){return{left:se.Justify.LEFT,right:se.Justify.RIGHT,center:se.Justify.CENTER,centerStem:se.Justify.CENTER_STEM}}static get VerticalJustify(){return{TOP:1,CENTER:2,BOTTOM:3,CENTER_STEM:4}}static get VerticalJustifyString(){return{above:se.VerticalJustify.TOP,top:se.VerticalJustify.TOP,below:se.VerticalJustify.BOTTOM,bottom:se.VerticalJustify.BOTTOM,center:se.VerticalJustify.CENTER,centerStem:se.VerticalJustify.CENTER_STEM}}static format(t,e){if(!t||t.length===0)return!1;let i=0;for(let s=0;s<t.length;++s){const r=t[s];i=Math.max(r.getWidth(),i),r.getPosition()===St.Position.ABOVE?(r.setTextLine(e.top_text_line),e.top_text_line++):(r.setTextLine(e.text_line),e.text_line++)}return e.left_shift+=i/2,e.right_shift+=i/2,!0}constructor(t){super(),this.setAttribute("type","Annotation"),this.note=null,this.index=null,this.text=t,this.justification=se.Justify.CENTER,this.vert_justification=se.VerticalJustify.TOP,this.font={family:"Arial",size:10,weight:""},this.setWidth(V.textWidth(t))}getCategory(){return se.CATEGORY}setFont(t,e,i){return this.font={family:t,size:e,weight:i},this}setVerticalJustification(t){return this.vert_justification=typeof t=="string"?se.VerticalJustifyString[t]:t,this}getJustification(){return this.justification}setJustification(t){return this.justification=typeof t=="string"?se.JustifyString[t]:t,this}draw(){if(this.checkContext(),!this.note)throw new M.RERR("NoNoteForAnnotation","Can't draw text annotation without an attached note.");this.setRendered();const t=this.note.getModifierStartXY(St.Position.ABOVE,this.index);this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.weight);const e=this.context.measureText(this.text).width,i=this.context.measureText("m").width;let s,r;this.justification===se.Justify.LEFT?s=t.x:this.justification===se.Justify.RIGHT?s=t.x-e:this.justification===se.Justify.CENTER?s=t.x-e/2:s=this.note.getStemX()-e/2;let o,a;const l=this.note.hasStem(),h=this.note.getStave();if(l&&(o=this.note.getStem().getExtents(),a=h.getSpacingBetweenLines()),this.vert_justification===se.VerticalJustify.BOTTOM){if(r=h.getYForBottomText(this.text_line+V.TEXT_HEIGHT_OFFSET_HACK),l){const u=this.note.getStemDirection()===1?o.baseY:o.topY;r=Math.max(r,u+a*(this.text_line+2))}}else if(this.vert_justification===se.VerticalJustify.CENTER){const u=this.note.getYForTopText(this.text_line)-1,f=h.getYForBottomText(this.text_line);r=u+(f-u)/2+i/2}else if(this.vert_justification===se.VerticalJustify.TOP)r=Math.min(h.getYForTopText(this.text_line),this.note.getYs()[0]-10),l&&(r=Math.min(r,o.topY-5-a*this.text_line));else{const u=this.note.getStemExtents();r=u.topY+(u.baseY-u.topY)/2+i/2}Sc("Rendering annotation: ",this.text,s,r),["b","bb","#","##","n"].includes(this.text)?(new xt(V.accidentalCodes(this.text).code,38).render(this.context,s+2,r-27),this.setRendered()):(this.context.fillText(this.text,s,r),this.context.restore())}}class Oe extends St{static get CATEGORY(){return"bends"}static get UP(){return 0}static get DOWN(){return 1}static format(t,e){if(!t||t.length===0)return!1;let i=0;const s=e.top_text_line;for(let r=0;r<t.length;++r){const o=t[r];o.setXShift(i),i=o.getWidth(),o.setTextLine(s)}return e.right_shift+=i,e.top_text_line+=1,!0}constructor(t,e,i){super(),this.setAttribute("type","Bend"),this.text=t,this.x_shift=0,this.release=e||!1,this.font="10pt Arial",this.render_options={line_width:1.5,line_style:"#777777",bend_width:8,release_width:8},i?this.phrase=i:(this.phrase=[{type:Oe.UP,text:this.text}],this.release&&this.phrase.push({type:Oe.DOWN,text:""})),this.updateWidth()}getCategory(){return Oe.CATEGORY}setXShift(t){this.x_shift=t,this.updateWidth()}setFont(t){return this.font=t,this}getText(){return this.text}updateWidth(){const t=this;function e(s){let r;return t.context?r=t.context.measureText(s).width:r=V.textWidth(s),r}let i=0;for(let s=0;s<this.phrase.length;++s){const r=this.phrase[s];if("width"in r)i+=r.width;else{const o=r.type===Oe.UP?this.render_options.bend_width:this.render_options.release_width;r.width=M.Max(o,e(r.text))+3,r.draw_width=r.width/2,i+=r.width}}return this.setWidth(i+this.x_shift),this}draw(){if(this.checkContext(),!(this.note&&this.index!=null))throw new M.RERR("NoNoteForBend","Can't draw bend without a note or index.");this.setRendered();const t=this.note.getModifierStartXY(St.Position.RIGHT,this.index);t.x+=3,t.y+=.5;const e=this.x_shift,i=this.context,s=this.note.getStave().getYForTopText(this.text_line)+3,r=this.note.getStave().getYForTopText(this.text_line)-1,o=this;function a(d,p,g,m){const S=d+g,b=p;i.save(),i.beginPath(),i.setLineWidth(o.render_options.line_width),i.setStrokeStyle(o.render_options.line_style),i.setFillStyle(o.render_options.line_style),i.moveTo(d,p),i.quadraticCurveTo(S,b,d+g,m),i.stroke(),i.restore()}function l(d,p,g,m){i.save(),i.beginPath(),i.setLineWidth(o.render_options.line_width),i.setStrokeStyle(o.render_options.line_style),i.setFillStyle(o.render_options.line_style),i.moveTo(d,m),i.quadraticCurveTo(d+g,m,d+g,p),i.stroke(),i.restore()}function h(d,p,g){const S=g||1;i.beginPath(),i.moveTo(d,p),i.lineTo(d-4,p+4*S),i.lineTo(d+4,p+4*S),i.closePath(),i.fill()}function c(d,p){i.save(),i.setRawFont(o.font);const g=d-i.measureText(p).width/2;i.fillText(p,g,r),i.restore()}let u=null,f=0;for(let d=0;d<this.phrase.length;++d){const p=this.phrase[d];d===0&&(p.draw_width+=e),f=p.draw_width+(u?u.draw_width:0)-(d===1?e:0),p.type===Oe.UP&&(u&&u.type===Oe.UP&&h(t.x,s),a(t.x,t.y,f,s)),p.type===Oe.DOWN&&(u&&u.type===Oe.UP&&l(t.x,t.y,f,s),u&&u.type===Oe.DOWN&&(h(t.x,t.y,-1),l(t.x,t.y,f,s)),u===null&&(f=p.draw_width,l(t.x,t.y,f,s))),c(t.x+f,p.text),u=p,u.x=t.x,t.x+=f}u.type===Oe.UP?h(u.x+f,s):u.type===Oe.DOWN&&h(u.x+f,t.y,-1)}}class vs extends St{static get CATEGORY(){return"vibratos"}static format(t,e,i){if(!t||t.length===0)return!1;let s=e.top_text_line,r=0,o=e.right_shift-7;const a=i.getModifiers(Oe.CATEGORY);a&&a.length>0&&s--;for(let l=0;l<t.length;++l){const h=t[l];h.setXShift(o),h.setTextLine(s),r+=h.getWidth(),o+=r}return e.right_shift+=r,e.top_text_line+=1,!0}constructor(){super(),this.setAttribute("type","Vibrato"),this.position=St.Position.RIGHT,this.render_options={harsh:!1,vibrato_width:20,wave_height:6,wave_width:4,wave_girth:2},this.setVibratoWidth(this.render_options.vibrato_width)}getCategory(){return vs.CATEGORY}setHarsh(t){return this.render_options.harsh=t,this}setVibratoWidth(t){return this.render_options.vibrato_width=t,this.setWidth(t),this}draw(){const t=this.checkContext();if(!this.note)throw new M.RERR("NoNoteForVibrato","Can't draw vibrato without an attached note.");this.setRendered();const i=this.note.getModifierStartXY(St.Position.RIGHT,this.index).x+this.x_shift,s=this.note.getYForTopText(this.text_line)+2;vs.renderVibrato(t,i,s,this.render_options)}static renderVibrato(t,e,i,s){const{harsh:r,vibrato_width:o,wave_width:a,wave_girth:l,wave_height:h}=s,c=o/a;t.beginPath();let u;if(r){for(t.moveTo(e,i+l+1),u=0;u<c/2;++u)t.lineTo(e+a,i-h/2),e+=a,t.lineTo(e+a,i+h/2),e+=a;for(u=0;u<c/2;++u)t.lineTo(e-a,i-h/2+l+1),e-=a,t.lineTo(e-a,i+h/2+l+1),e-=a;t.fill()}else{for(t.moveTo(e,i+l),u=0;u<c/2;++u)t.quadraticCurveTo(e+a/2,i-h/2,e+a,i),e+=a,t.quadraticCurveTo(e+a/2,i+h/2,e+a,i),e+=a;for(u=0;u<c/2;++u)t.quadraticCurveTo(e-a/2,i+h/2+l,e-a,i+l),e-=a,t.quadraticCurveTo(e-a/2,i-h/2+l,e-a,i+l),e-=a;t.fill()}}}function Ho(...n){Ys.DEBUG&&M.L("Vex.Flow.ModifierContext",n)}class Ys{constructor(){this.modifiers={},this.preFormatted=!1,this.postFormatted=!1,this.width=0,this.spacing=0,this.state={left_shift:0,right_shift:0,text_line:0,top_text_line:0},this.PREFORMAT=[ae,Gi,Qs,is,Te,Ps,$s,tn,Ri,en,se,Oe,vs],this.POSTFORMAT=[ae]}addModifier(t){const e=t.getCategory();return this.modifiers[e]||(this.modifiers[e]=[]),this.modifiers[e].push(t),t.setModifierContext(this),this.preFormatted=!1,this}getModifiers(t){return this.modifiers[t]}getWidth(){return this.width}getExtraLeftPx(){return this.state.left_shift}getExtraRightPx(){return this.state.right_shift}getState(){return this.state}getMetrics(){if(!this.formatted)throw new M.RERR("UnformattedModifier","Unformatted modifier has no metrics.");return{width:this.state.left_shift+this.state.right_shift+this.spacing,spacing:this.spacing,extra_left_px:this.state.left_shift,extra_right_px:this.state.right_shift}}preFormat(){this.preFormatted||(this.PREFORMAT.forEach(t=>{Ho("Preformatting ModifierContext: ",t.CATEGORY),t.format(this.getModifiers(t.CATEGORY),this.state,this)}),this.width=this.state.left_shift+this.state.right_shift,this.preFormatted=!0)}postFormat(){this.postFormatted||this.POSTFORMAT.forEach(t=>{Ho("Postformatting ModifierContext: ",t.CATEGORY),t.postFormat(this.getModifiers(t.CATEGORY),this)})}}function yc(...n){si.DEBUG&&M.L("Vex.Flow.Formatter",n)}function Aa(n,t){var i,s;const e=n[t+1];return e&&((i=e==null?void 0:e.keys)==null?void 0:i.includes("b/4"))||((s=e==null?void 0:e.keys)==null?void 0:s.includes("r/4"))?Aa(n,t+1):e}function Xo(n,t,e,i,s=0){let r=t;for(e+=1;e<n.length;e+=1){const o=n[e];if(!o.isRest()&&!o.shouldIgnoreTicks()){r=o.getLineForRest();break}}if(i&&t!==r){const o=Math.max(t,r),a=Math.min(t,r);r=M.MidLine(o,a)}for(e=0;e<n.length;e+=1)if(n[e].beam&&(r>4.5||r<1.5)){const a=n[e].stem;if(a)if(a.stem_direction>0){const l=r<1.5?Math.abs(r-1.5)*s:0;a.setResetHeight(l)}else{const l=r>4.5?Math.abs(r-4.5)*s:0;a.setResetHeight(l)}}return r}function Yo(n,t,e){if(!n||!n.length)throw new M.RERR("BadArgument","No voices to format");const i=n[0].getTotalTicks(),s=n.reduce((l,h)=>{if(!h.getTotalTicks().equals(i))throw new M.RERR("TickMismatch","Voices should have same total note duration in ticks.");if(h.getMode()===ye.Mode.STRICT&&!h.isComplete())throw new M.RERR("IncompleteVoice","Voice does not have enough notes.");return Math.max(l,Rt.LCM(l,h.getResolutionMultiplier()))},1),r={},o=[],a=[];return n.forEach(l=>{const h=new Rt(0,s);l.getTickables().forEach(c=>{const u=h.numerator;if(!r[u]){const f=new t;a.push(f),r[u]=f}e(c,r[u]),o.push(u),h.add(c.getTicks())})}),{map:r,array:a,list:M.SortAndUnique(o,(l,h)=>l-h,(l,h)=>l===h),resolutionMultiplier:s}}class si{static SimpleFormat(t,e=0,{paddingBetween:i=10}={}){t.reduce((s,r)=>{r.addToModifierContext(new Ys);const o=new xs().addTickable(r).preFormat(),a=o.getExtraPx();return o.setX(s+a.left),s+o.getWidth()+a.right+i},e)}static plotDebugging(t,e,i,s,r){const o=i+Ie.STAVEPADDING,a=e.contextGaps;function l(h,c,u){t.beginPath(),t.setStrokeStyle(u),t.setFillStyle(u),t.setLineWidth(1),t.fillRect(h,s,c-h,r-s)}t.save(),t.setFont("Arial",8,""),a.gaps.forEach(h=>{l(o+h.x1,o+h.x2,"#aaa"),t.fillText(Math.round(h.x2-h.x1),o+h.x1,r+12)}),t.fillText(Math.round(a.total)+"px",o-20,r+12),t.setFillStyle("red"),t.fillText("Loss: "+e.lossHistory.map(h=>Math.round(h)),o-20,r+22),t.restore()}static FormatAndDraw(t,e,i,s){const r={auto_beam:!1,align_rests:!1};typeof s=="object"?M.Merge(r,s):typeof s=="boolean"&&(r.auto_beam=s);const o=new ye(V.TIME4_4).setMode(ye.Mode.SOFT).addTickables(i),a=r.auto_beam?Vi.applyAndGetBeams(o):[];return new si().joinVoices([o],{align_rests:r.align_rests}).formatToStave([o],e,{align_rests:r.align_rests,stave:e}),o.setStave(e).draw(t,e),a.forEach(l=>l.setContext(t).draw()),o.getBoundingBox()}static FormatAndDrawTab(t,e,i,s,r,o,a){const l={auto_beam:o,align_rests:!1};typeof a=="object"?M.Merge(l,a):typeof a=="boolean"&&(l.auto_beam=a);const h=new ye(V.TIME4_4).setMode(ye.Mode.SOFT).addTickables(r),c=new ye(V.TIME4_4).setMode(ye.Mode.SOFT).addTickables(s),u=l.auto_beam?Vi.applyAndGetBeams(h):[];new si().joinVoices([h],{align_rests:l.align_rests}).joinVoices([c]).formatToStave([h,c],i,{align_rests:l.align_rests}),h.draw(t,i),c.draw(t,e),u.forEach(f=>f.setContext(t).draw()),new Bt(i,e).setContext(t).draw()}static AlignRestsToNotes(t,e,i){return t.forEach((s,r)=>{if(s instanceof ae&&s.isRest()){if(s.tuplet&&!i)return;if(s.getGlyph().position.toUpperCase(),s.glyph.code_head==="va5"||s.glyph.code_head==="v3c"){const o=s.glyph.code_head==="va5"?10:20,a=t[r-1],l=Aa(t,r);let h=!1;if(a&&l&&a.beam&&l.beam&&(h=a.beam.notes.includes(l)),e||s.beam!=null||h){const c=s.getKeyProps()[0];if(r===0)c.line=Xo(t,c.line,r,!1,o),s.setKeyLine(0,c.line);else if(r>0&&r<t.length){let u;t[r-1].isRest()?(u=t[r-1].getKeyProps()[0].line,c.line=u):(u=t[r-1].getLineForRest(),c.line=Xo(t,u,r,!0,o)),s.setKeyLine(0,c.line)}}}}}),this}constructor(){this.minTotalWidth=0,this.hasMinTotalWidth=!1,this.totalTicks=new Rt(0,1),this.tickContexts=null,this.modiferContexts=null,this.contextGaps={total:0,gaps:[]},this.voices=[]}alignRests(t,e){if(!t||!t.length)throw new M.RERR("BadArgument","No voices to format rests");t.forEach(i=>si.AlignRestsToNotes(i.getTickables(),e))}preCalculateMinTotalWidth(t){if(this.hasMinTotalWidth)return this.minTotalWidth;if(!this.tickContexts){if(!t)throw new M.RERR("BadArgument","'voices' required to run preCalculateMinTotalWidth");this.createTickContexts(t)}const{list:e,map:i}=this.tickContexts;return this.minTotalWidth=e.map(s=>{const r=i[s];return r.preFormat(),r.getWidth()}).reduce((s,r)=>s+r,0),this.hasMinTotalWidth=!0,this.minTotalWidth}getMinTotalWidth(){if(!this.hasMinTotalWidth)throw new M.RERR("NoMinTotalWidth","Call 'preCalculateMinTotalWidth' or 'preFormat' before calling 'getMinTotalWidth'");return this.minTotalWidth}createModifierContexts(t){const e=Yo(t,Ys,(i,s)=>i.addToModifierContext(s));return this.modiferContexts=e,e}createTickContexts(t){const e=Yo(t,xs,(i,s)=>s.addTickable(i));return e.array.forEach(i=>{i.tContexts=e.array}),this.totalTicks=t[0].getTicksUsed().clone(),this.tickContexts=e,e}preFormat(t=0,e,i,s){const r=this.tickContexts,{list:o,map:a,resolutionMultiplier:l}=r;i&&s&&i.forEach(g=>g.setStave(s).preFormat());let h=0,c=0;const u=t/2;if(this.minTotalWidth=0,o.forEach(g=>{const m=a[g];e&&m.setContext(e),m.preFormat();const S=m.getWidth();this.minTotalWidth+=S;const b=m.getMetrics();h=h+c+b.extraLeftPx,m.setX(h),c=S-b.extraLeftPx}),this.minTotalWidth=h+c,this.hasMinTotalWidth=!0,t<=0)return;const d=(t-this.minTotalWidth)/(this.totalTicks.value()*l);let p=0;o.forEach((g,m)=>{const S=o[m-1]||0,b=a[g];p+=(g-S)*d,b.setX(b.getX()+p),b.getCenterAlignedTickables().forEach(x=>{x.center_x_shift=u-b.getX()})}),o.length!==1&&(this.justifyWidth=t,this.lossHistory=[],this.evaluate())}evaluate(){const t=this.justifyWidth;this.contextGaps={total:0,gaps:[]},this.tickContexts.list.forEach((r,o)=>{if(o===0)return;const a=this.tickContexts.list[o-1],l=this.tickContexts.map[a],h=this.tickContexts.map[r],c=l.getMetrics(),u=l.getX()+c.width,f=h.getX(),d=f-u;this.contextGaps.total+=d,this.contextGaps.gaps.push({x1:u,x2:f}),h.getFormatterMetrics().freedom.left=d,l.getFormatterMetrics().freedom.right=d});const e=this.durationStats={};function i(r,o){const a=e[r];a===void 0?e[r]={mean:o,count:1}:(a.count+=1,a.mean=(a.mean+o)/2)}this.voices.forEach(r=>{r.getTickables().forEach((o,a,l)=>{const h=o.getTicks().clone().simplify().toString(),c=o.getMetrics(),u=o.getFormatterMetrics(),f=o.getX()+c.noteWidth+c.modRightPx+c.extraRightPx;let d=0;if(a<l.length-1){const p=l[a+1],g=p.getMetrics();d=p.getX()-g.modLeftPx-g.extraLeftPx-f,u.space.used=p.getX()-o.getX(),p.getFormatterMetrics().freedom.left=d}else d=t-f,u.space.used=t-o.getX();u.freedom.right=d,i(h,u.space.used)})});let s=0;return this.voices.forEach(r=>{r.getTickables().forEach(o=>{const a=o.getTicks().clone().simplify().toString(),l=o.getFormatterMetrics();l.iterations+=1,l.space.deviation=l.space.used-e[a].mean,l.duration=a,l.space.mean=e[a].mean,s+=Math.pow(e[a].mean,2)})}),this.totalCost=Math.sqrt(s),this.lossHistory.push(this.totalCost),this}tune(){const t=s=>s.reduce((r,o)=>r+o);function e(s,r,o,a){s.setX(s.getX()+a),s.getFormatterMetrics().freedom.left+=a,s.getFormatterMetrics().freedom.right-=a,r&&(r.getFormatterMetrics().freedom.right+=a),o&&(o.getFormatterMetrics().freedom.left-=a)}let i=0;return this.tickContexts.list.forEach((s,r,o)=>{const a=this.tickContexts.map[s],l=r>0?this.tickContexts.map[o[r-1]]:null,h=r<o.length-1?this.tickContexts.map[o[r+1]]:null;e(a,l,h,i);const c=-t(a.getTickables().map(f=>f.getFormatterMetrics().space.deviation));c>0?i=-Math.min(a.getFormatterMetrics().freedom.right,Math.abs(c)):c<0&&(h?i=Math.min(h.getFormatterMetrics().freedom.right,Math.abs(c)):i=0);const u=Math.min(5,Math.abs(i));i=i>0?u:-u}),this.evaluate()}postFormat(){const t=e=>e.list.forEach(i=>e.map[i].postFormat());return t(this.modiferContexts),t(this.tickContexts),this}joinVoices(t){return this.createModifierContexts(t),this.hasMinTotalWidth=!1,this}format(t,e,i){const s={align_rests:!1,context:null,stave:null};return M.Merge(s,i),this.voices=t,this.alignRests(t,s.align_rests),this.createTickContexts(t),this.preFormat(e,s.context,t,s.stave),s.stave&&this.postFormat(),this}formatToStave(t,e,i){const s=e.getNoteEndX()-e.getNoteStartX()-10;yc("Formatting voices to width: ",s);const r={context:e.getContext()};return M.Merge(r,i),this.format(t,s,r)}}class Vt extends he{static get Position(){return{LEFT:1,RIGHT:2,ABOVE:3,BELOW:4,BEGIN:5,END:6}}constructor(){super(),this.setAttribute("type","StaveModifier"),this.padding=10,this.position=Vt.Position.ABOVE,this.layoutMetrics=null}getPosition(){return this.position}setPosition(t){return this.position=t,this}getStave(){return this.stave}setStave(t){return this.stave=t,this}getWidth(){return this.width}setWidth(t){return this.width=t,this}getX(){return this.x}setX(t){return this.x=t,this}getCategory(){return""}makeSpacer(t){return{getContext(){return!0},setStave(){},renderToStave(){},getMetrics(){return{width:t}}}}placeGlyphOnLine(t,e,i){t.setYShift(e.getYForLine(i)-e.getYForGlyphs())}getPadding(t){return t!==void 0&&t<2?0:this.padding}setPadding(t){return this.padding=t,this}setLayoutMetrics(t){return this.layoutMetrics=t,this}getLayoutMetrics(){return this.layoutMetrics}}class Xt extends Vt{static get CATEGORY(){return"barlines"}static get type(){return{SINGLE:1,DOUBLE:2,END:3,REPEAT_BEGIN:4,REPEAT_END:5,REPEAT_BOTH:6,NONE:7}}static get typeString(){return{single:Xt.type.SINGLE,double:Xt.type.DOUBLE,end:Xt.type.END,repeatBegin:Xt.type.REPEAT_BEGIN,repeatEnd:Xt.type.REPEAT_END,repeatBoth:Xt.type.REPEAT_BOTH,none:Xt.type.NONE}}constructor(t){super(),this.setAttribute("type","Barline"),this.thickness=V.STAVE_LINE_THICKNESS;const e=Xt.type;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(Vt.Position.BEGIN),this.setType(t)}getCategory(){return Xt.CATEGORY}getType(){return this.type}setType(t){return this.type=typeof t=="string"?Xt.typeString[t]:t,this.setWidth(this.widths[this.type]),this.setPadding(this.paddings[this.type]),this.setLayoutMetrics(this.layoutMetricsMap[this.type]),this}draw(t){switch(t.checkContext(),this.setRendered(),this.type){case Xt.type.SINGLE:this.drawVerticalBar(t,this.x,!1);break;case Xt.type.DOUBLE:this.drawVerticalBar(t,this.x,!0);break;case Xt.type.END:this.drawVerticalEndBar(t,this.x);break;case Xt.type.REPEAT_BEGIN:this.drawRepeatBar(t,this.x,!0),t.getX()!==this.x&&this.drawVerticalBar(t,t.getX());break;case Xt.type.REPEAT_END:this.drawRepeatBar(t,this.x,!1);break;case Xt.type.REPEAT_BOTH:this.drawRepeatBar(t,this.x,!1),this.drawRepeatBar(t,this.x,!0);break}}drawVerticalBar(t,e,i){t.checkContext();const s=t.getTopLineTopY(),r=t.getBottomLineBottomY();i&&t.context.fillRect(e-3,s,1,r-s),t.context.fillRect(e,s,1,r-s)}drawVerticalEndBar(t,e){t.checkContext();const i=t.getTopLineTopY(),s=t.getBottomLineBottomY();t.context.fillRect(e-5,i,1,s-i),t.context.fillRect(e-2,i,3,s-i)}drawRepeatBar(t,e,i){t.checkContext();const s=t.getTopLineTopY(),r=t.getBottomLineBottomY();let o=3;i||(o=-5),t.context.fillRect(e+o,s,1,r-s),t.context.fillRect(e-2,s,3,r-s);const a=2;i?o+=4:o-=4;const l=e+o+a/2;let h=(t.getNumLines()-1)*t.getSpacingBetweenLines();h=h/2-t.getSpacingBetweenLines()/2;let c=s+h+a/2;t.context.beginPath(),t.context.arc(l,c,a,0,Math.PI*2,!1),t.context.fill(),c+=t.getSpacingBetweenLines(),t.context.beginPath(),t.context.arc(l,c,a,0,Math.PI*2,!1),t.context.fill()}}class _e extends Vt{static get CATEGORY(){return"repetitions"}static get type(){return{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}}constructor(t,e,i){super(),this.setAttribute("type","Repetition"),this.symbol_type=t,this.x=e,this.x_shift=0,this.y_shift=i,this.font={family:"times",size:12,weight:"bold italic"}}getCategory(){return _e.CATEGORY}setShiftX(t){return this.x_shift=t,this}setShiftY(t){return this.y_shift=t,this}setX(t){return this.x=t,this}draw(t,e){switch(this.setRendered(),this.symbol_type){case _e.type.CODA_RIGHT:this.drawCodaFixed(t,e+t.width);break;case _e.type.CODA_LEFT:this.drawSymbolText(t,e,"Coda",!1);break;case _e.type.SEGNO_LEFT:this.drawSignoFixed(t,e);break;case _e.type.SEGNO_RIGHT:this.drawSignoFixed(t,e+t.width);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 Coda",!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 Coda",!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 Coda",!0);break}return this}drawCodaFixed(t,e){const i=t.getYForTopText(t.options.num_lines)+this.y_shift;return xt.renderGlyph(t.context,this.x+e+this.x_shift,i+25,40,"v4d",!0),this}drawSignoFixed(t,e){const i=t.getYForTopText(t.options.num_lines)+this.y_shift;return xt.renderGlyph(t.context,this.x+e+this.x_shift,i+25,30,"v8c",!0),this}drawSymbolText(t,e,i,s){const r=t.checkContext();r.save(),r.setFont(this.font.family,this.font.size,this.font.weight);let o=0+this.x_shift,a=e+this.x_shift;this.symbol_type===_e.type.CODA_LEFT?(o=this.x+t.options.vertical_bar_width,a=o+r.measureText(i).width+12):(this.x_shift=-(o+r.measureText(i).width+12+t.options.vertical_bar_width+12),o=this.x+this.x_shift+t.options.vertical_bar_width,a=o+r.measureText(i).width+12);const l=t.getYForTopText(t.options.num_lines)+this.y_shift+25;return s&&xt.renderGlyph(r,a,l,40,"v4d",!0),r.fillText(i,o,l+5),r.restore(),this}}class ho extends Vt{static get CATEGORY(){return"stavesection"}constructor(t,e,i){super(),this.setAttribute("type","StaveSection"),this.setWidth(16),this.section=t,this.x=e,this.shift_x=0,this.shift_y=i,this.font={family:"sans-serif",size:12,weight:"bold"}}getCategory(){return ho.CATEGORY}setStaveSection(t){return this.section=t,this}setShiftX(t){return this.shift_x=t,this}setShiftY(t){return this.shift_y=t,this}draw(t,e){const i=t.checkContext();this.setRendered(),i.save(),i.lineWidth=2,i.setFont(this.font.family,this.font.size,this.font.weight);const s=i.measureText(""+this.section),r=s.width,o=s.height;let a=r+6;a<18&&(a=18);const l=o,h=t.getYForTopText(3)+this.shift_y;let c=this.x+e;return i.beginPath(),i.lineWidth=2,i.rect(c,h+o/4,a,l),i.stroke(),c+=(a-r)/2,i.fillText(""+this.section,c,h+16),i.restore(),this}}class $n extends Vt{static get CATEGORY(){return"stavetempo"}constructor(t,e,i){super(),this.setAttribute("type","StaveTempo"),this.tempo=t,this.position=St.Position.ABOVE,this.x=e,this.shift_x=10,this.shift_y=i,this.font={family:"times",size:14,weight:"bold"},this.render_options={glyph_font_scale:30}}getCategory(){return $n.CATEGORY}setTempo(t){return this.tempo=t,this}setShiftX(t){return this.shift_x=t,this}setShiftY(t){return this.shift_y=t,this}draw(t,e){const i=t.checkContext();this.setRendered();const s=this.render_options,r=s.glyph_font_scale/38,o=this.tempo.name,a=this.tempo.duration,l=this.tempo.dots,h=this.tempo.bpm,c=this.font;let u=this.x+this.shift_x+e;const f=t.getYForTopText(1)+this.shift_y;if(i.save(),i.openGroup("stavetempo",null,{}),o&&(i.setFont(c.family,c.size,c.weight),i.fillText(o,u,f),u+=i.measureText(o).width),a&&h){i.setFont(c.family,c.size,"normal"),o&&(u+=i.measureText(" ").width,i.fillText("(",u,f),u+=i.measureText("(").width);const d=V.getGlyphProps(a);if(u+=3*r,xt.renderGlyph(i,u,f,s.glyph_font_scale,d.code_head),u+=d.getWidth()*r,d.stem){let p=30;d.beam_count&&(p+=3*(d.beam_count-1)),p*=r;const g=f-p;i.fillRect(u-r,g,r,p),d.flag&&(xt.renderGlyph(i,u,g,s.glyph_font_scale,d.code_flag_upstem),l||(u+=6*r))}for(let p=0;p<l;p++)u+=6*r,i.beginPath(),i.arc(u,f+2*r,2*r,0,Math.PI*2,!1),i.fill();i.fillText(" = "+h+(o?")":""),u+3*r,f)}return i.closeGroup(),i.restore(),this}}class li extends Ie{static get Justification(){return{LEFT:1,CENTER:2,RIGHT:3}}static get GLYPHS(){return{segno:{code:"v8c",point:40,x_shift:0,y_shift:-10},tr:{code:"v1f",point:40,x_shift:0,y_shift:0},mordent_upper:{code:"v1e",point:40,x_shift:0,y_shift:0},mordent_lower:{code:"v45",point:40,x_shift:0,y_shift:0},f:{code:"vba",point:40,x_shift:0,y_shift:0},p:{code:"vbf",point:40,x_shift:0,y_shift:0},m:{code:"v62",point:40,x_shift:0,y_shift:0},s:{code:"v4a",point:40,x_shift:0,y_shift:0},z:{code:"v80",point:40,x_shift:0,y_shift:0},coda:{code:"v4d",point:40,x_shift:0,y_shift:-8},pedal_open:{code:"v36",point:40,x_shift:0,y_shift:0},pedal_close:{code:"v5d",point:40,x_shift:0,y_shift:3},caesura_straight:{code:"v34",point:40,x_shift:0,y_shift:2},caesura_curved:{code:"v4b",point:40,x_shift:0,y_shift:2},breath:{code:"v6c",point:40,x_shift:0,y_shift:0},tick:{code:"v6f",point:50,x_shift:0,y_shift:0},turn:{code:"v72",point:40,x_shift:0,y_shift:0},turn_inverted:{code:"v33",point:40,x_shift:0,y_shift:0},mordent:{code:"v1e",point:40,x_shift:0,y_shift:0}}}constructor(t){if(super(t),this.setAttribute("type","TextNote"),this.text=t.text,this.superscript=t.superscript,this.subscript=t.subscript,this.glyph_type=t.glyph,this.glyph=null,this.font={family:"Arial",size:12,weight:""},t.font&&(this.font=t.font),this.glyph_type){const e=li.GLYPHS[this.glyph_type];if(!e)throw new M.RERR("Invalid glyph type: "+this.glyph_type);this.glyph=new xt(e.code,e.point,{cache:!1}),e.width?this.setWidth(e.width):this.setWidth(this.glyph.getMetrics().width),this.glyph_struct=e}else this.setWidth(V.textWidth(this.text));this.line=t.line||0,this.smooth=t.smooth||!1,this.ignore_ticks=t.ignore_ticks||!1,this.justification=li.Justification.LEFT}setJustification(t){return this.justification=t,this}setLine(t){return this.line=t,this}preFormat(){this.checkContext(),!this.preFormatted&&(this.smooth?this.setWidth(0):this.glyph||this.setWidth(this.context.measureText(this.text).width),this.justification===li.Justification.CENTER?this.extraLeftPx=this.width/2:this.justification===li.Justification.RIGHT&&(this.extraLeftPx=this.width),this.setPreFormatted(!0))}draw(){if(this.checkContext(),!this.stave)throw new M.RERR("NoStave","Can't draw without a stave.");this.setRendered();const t=this.context;let e=this.getAbsoluteX();this.justification===li.Justification.CENTER?e-=this.getWidth()/2:this.justification===li.Justification.RIGHT&&(e-=this.getWidth());let i;if(this.glyph)i=this.stave.getYForLine(this.line+-3),this.glyph.render(this.context,e+this.glyph_struct.x_shift,i+this.glyph_struct.y_shift);else{i=this.stave.getYForLine(this.line+-3),this.applyStyle(t),t.setFont(this.font.family,this.font.size,this.font.weight),t.fillText(this.text,e,i);const s=t.measureText("M").width,r=t.measureText(this.text).width;this.superscript&&(t.setFont(this.font.family,this.font.size/1.3,this.font.weight),t.fillText(this.superscript,e+r+2,i-s/2.2)),this.subscript&&(t.setFont(this.font.family,this.font.size/1.3,this.font.weight),t.fillText(this.subscript,e+r+2,i+s/2.2-1)),this.restoreStyle(t)}}}class co extends Vt{static get CATEGORY(){return"stavetext"}constructor(t,e,i){super(),this.setAttribute("type","StaveText"),this.setWidth(16),this.text=t,this.position=e,this.options={shift_x:0,shift_y:0,justification:li.Justification.CENTER},M.Merge(this.options,i),this.font={family:"times",size:16,weight:"normal"}}getCategory(){return co.CATEGORY}setStaveText(t){return this.text=t,this}setShiftX(t){return this.shift_x=t,this}setShiftY(t){return this.shift_y=t,this}setFont(t){M.Merge(this.font,t)}setText(t){this.text=t}draw(t){const e=t.checkContext();this.setRendered(),e.save(),e.lineWidth=2,e.setFont(this.font.family,this.font.size,this.font.weight);const i=e.measureText(""+this.text).width;let s,r;const o=Vt.Position,a=li.Justification;switch(this.position){case o.LEFT:case o.RIGHT:r=(t.getYForLine(0)+t.getBottomLineY())/2+this.options.shift_y,this.position===o.LEFT?s=t.getX()-i-24+this.options.shift_x:s=t.getX()+t.getWidth()+24+this.options.shift_x;break;case o.ABOVE:case o.BELOW:s=t.getX()+this.options.shift_x,this.options.justification===a.CENTER?s+=t.getWidth()/2-i/2:this.options.justification===a.RIGHT&&(s+=t.getWidth()-i),this.position===o.ABOVE?r=t.getYForTopText(2)+this.options.shift_y:r=t.getYForBottomText(2)+this.options.shift_y;break;default:throw new M.RERR("InvalidPosition","Value Must be in Modifier.Position.")}return e.fillText(""+this.text,s,r+4),e.restore(),this}}function xc(...n){hi.DEBUG&&M.L("Vex.Flow.Clef",n)}class hi extends Vt{static get CATEGORY(){return"clefs"}static get types(){return{treble:{code:"v83",line:3},bass:{code:"v79",line:1},alto:{code:"vad",line:2},tenor:{code:"vad",line:1},percussion:{code:"v59",line:2},soprano:{code:"vad",line:4},"mezzo-soprano":{code:"vad",line:3},"baritone-c":{code:"vad",line:0},"baritone-f":{code:"v79",line:2},subbass:{code:"v79",line:0},french:{code:"v83",line:4},tab:{code:"v2f"}}}static get sizes(){return{default:{point:40,width:26},small:{point:32,width:20}}}static get annotations(){return{"8va":{code:"v8",sizes:{default:{point:20,attachments:{treble:{line:-1.2,x_shift:11}}},small:{point:18,attachments:{treble:{line:-.4,x_shift:8}}}}},"8vb":{code:"v8",sizes:{default:{point:20,attachments:{treble:{line:6.3,x_shift:10},bass:{line:4,x_shift:1}}},small:{point:18,attachments:{treble:{line:5.8,x_shift:6},bass:{line:3.5,x_shift:.5}}}}}}}constructor(t,e,i){super(),this.setAttribute("type","Clef"),this.setPosition(Vt.Position.BEGIN),this.setType(t,e,i),this.setWidth(hi.sizes[this.size].width),xc("Creating clef:",t)}getCategory(){return hi.CATEGORY}setType(t,e,i){if(this.type=t,this.clef=hi.types[t],e===void 0?this.size="default":this.size=e,this.clef.point=hi.sizes[this.size].point,this.glyph=new xt(this.clef.code,this.clef.point),i!==void 0){const s=hi.annotations[i];this.annotation={code:s.code,point:s.sizes[this.size].point,line:s.sizes[this.size].attachments[this.type].line,x_shift:s.sizes[this.size].attachments[this.type].x_shift},this.attachment=new xt(this.annotation.code,this.annotation.point),this.attachment.metrics.x_max=0,this.attachment.setXShift(this.annotation.x_shift)}else this.annotation=void 0;return this}getWidth(){if(this.type==="tab"&&!this.stave)throw new M.RERR("ClefError","Can't get width without stave.");return this.width}setStave(t){if(this.stave=t,this.type!=="tab")return this;let e,i;const s=this.stave.getOptions().num_lines;switch(s){case 8:e=55,i=14;break;case 7:e=47,i=8;break;case 6:e=40,i=1;break;case 5:e=30,i=-6;break;case 4:e=23,i=-12;break;default:throw new M.RERR("ClefError",`Invalid number of lines: ${s}`)}return this.glyph.setPoint(e),this.glyph.setYShift(i),this}draw(){if(!this.x)throw new M.RERR("ClefError","Can't draw clef without x.");if(!this.stave)throw new M.RERR("ClefError","Can't draw clef without stave.");this.setRendered(),this.glyph.setStave(this.stave),this.glyph.setContext(this.stave.context),this.clef.line!==void 0&&this.placeGlyphOnLine(this.glyph,this.stave,this.clef.line),this.stave.context.openGroup("clef"),this.glyph.renderToStave(this.x),this.annotation!==void 0&&(this.placeGlyphOnLine(this.attachment,this.stave,this.annotation.line),this.attachment.setStave(this.stave),this.attachment.setContext(this.stave.context),this.attachment.renderToStave(this.x)),this.stave.context.closeGroup()}}class ss extends Vt{static get CATEGORY(){return"keysignatures"}static get accidentalSpacing(){return{"#":{above:6,below:4},b:{above:4,below:7},n:{above:4,below:1},"##":{above:6,below:4},bb:{above:4,below:7},db:{above:4,below:7},d:{above:4,below:7},bbs:{above:4,below:7},"++":{above:6,below:4},"+":{above:6,below:4},"+-":{above:6,below:4},"++-":{above:6,below:4},bs:{above:4,below:10},bss:{above:4,below:10}}}constructor(t,e,i){super(),this.setAttribute("type","KeySignature"),this.setKeySig(t,e,i),this.setPosition(Vt.Position.BEGIN),this.glyphFontScale=38,this.glyphs=[],this.xPositions=[],this.paddingForced=!1}getCategory(){return ss.CATEGORY}convertToGlyph(t,e){const i=V.accidentalCodes(t.type),s=new xt(i.code,this.glyphFontScale);let r=1;if(t.type==="n"&&e){const l=ss.accidentalSpacing[e.type];l&&(r=e.line>=t.line?l.above:l.below)}this.placeGlyphOnLine(s,this.stave,t.line),this.glyphs.push(s);const o=this.xPositions[this.xPositions.length-1],a=s.getMetrics().width+r;this.xPositions.push(o+a),this.width+=a}cancelKey(t){return this.formatted=!1,this.cancelKeySpec=t,this}convertToCancelAccList(t){const e=V.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 r=[];for(let o=0;o<s;o++){let a=o;i||(a=e.length-s+o);const l=e[a];r.push({type:"n",line:l.line})}return this.accList=r.concat(this.accList),{accList:r,type:e[0].type}}addToStave(t){return this.paddingForced=!0,t.addModifier(this),this}convertAccLines(t,e,i=this.accList){let s=0,r;switch(t){case"soprano":e==="#"?r=[2.5,.5,2,0,1.5,-.5,1]:s=-1;break;case"mezzo-soprano":e==="b"?r=[0,2,.5,2.5,1,3,1.5]:s=1.5;break;case"alto":s=.5;break;case"tenor":e==="#"?r=[3,1,2.5,.5,2,0,1.5]:s=-.5;break;case"baritone-f":case"baritone-c":e==="b"?r=[.5,2.5,1,3,1.5,3.5,2]:s=2;break;case"bass":case"french":s=1;break}let o;if(typeof r!="undefined")for(o=0;o<i.length;++o)i[o].line=r[o];else if(s!==0)for(o=0;o<i.length;++o)i[o].line+=s}getPadding(t){return this.formatted||this.format(),this.glyphs.length===0||!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(){if(!this.stave)throw new M.RERR("KeySignatureError","Can't draw key signature without stave.");this.width=0,this.glyphs=[],this.xPositions=[0],this.accList=V.keySignature(this.keySpec);const t=this.accList,e=t.length>0?t[0].type:null;let i;if(this.cancelKeySpec&&(i=this.convertToCancelAccList(this.cancelKeySpec)),this.alterKeySpec&&this.convertToAlterAccList(this.alterKeySpec),this.accList.length>0){const s=(this.position===Vt.Position.END?this.stave.endClef:this.stave.clef)||this.stave.clef;i&&this.convertAccLines(s,i.type,i.accList),this.convertAccLines(s,e,t);for(let r=0;r<this.accList.length;++r)this.convertToGlyph(this.accList[r],this.accList[r+1])}this.formatted=!0}draw(){if(!this.x)throw new M.RERR("KeySignatureError","Can't draw key signature without x.");if(!this.stave)throw new M.RERR("KeySignatureError","Can't draw key signature without stave.");if(this.formatted||this.format(),this.setRendered(),this.glyphs.length>0){this.stave.context.openGroup("keysignature");for(let t=0;t<this.glyphs.length;t++){const e=this.glyphs[t],i=this.x+this.xPositions[t];e.setStave(this.stave),e.setContext(this.stave.context),e.renderToStave(i)}this.stave.context.closeGroup()}}}const vc=n=>{const t=n.split("/").filter(e=>e!=="");if(t.length!==2)throw new M.RERR("BadTimeSignature",`Invalid time spec: ${n}. Must be in the form "<numerator>/<denominator>"`);t.forEach(e=>{if(isNaN(Number(e)))throw new M.RERR("BadTimeSignature",`Invalid time spec: ${n}. Must contain two valid numbers.`)})};class Wi extends Vt{static get CATEGORY(){return"timesignatures"}static get glyphs(){return{C:{code:"v41",point:40,line:2},"C|":{code:"vb6",point:40,line:2}}}constructor(t=null,e=15,i=!0){if(super(),this.setAttribute("type","TimeSignature"),this.validate_args=i,t===null)return;const s=e;this.point=40,this.topLine=2,this.bottomLine=4,this.setPosition(Vt.Position.BEGIN),this.setTimeSig(t),this.setWidth(this.timeSig.glyph.getMetrics().width),this.setPadding(s)}getCategory(){return Wi.CATEGORY}parseTimeSpec(t){if(t==="C"||t==="C|"){const{line:s,code:r,point:o}=Wi.glyphs[t];return{line:s,num:!1,glyph:new xt(r,o)}}this.validate_args&&vc(t);const[e,i]=t.split("/").map(s=>s.split(""));return{num:!0,glyph:this.makeTimeSignatureGlyph(e,i)}}makeTimeSignatureGlyph(t,e){const i=new xt("v0",this.point);i.topGlyphs=[],i.botGlyphs=[];let s=0;for(let u=0;u<t.length;++u){const f=t[u],d=new xt("v"+f,this.point);i.topGlyphs.push(d),s+=d.getMetrics().width}let r=0;for(let u=0;u<e.length;++u){const f=e[u],d=new xt("v"+f,this.point);i.botGlyphs.push(d),r+=d.getMetrics().width}const o=s>r?s:r,a=i.getMetrics().x_min;i.getMetrics=()=>({x_min:a,x_max:a+o,width:o});const l=(o-s)/2,h=(o-r)/2,c=this;return i.renderToStave=function(f){let d=f+l;for(let p=0;p<this.topGlyphs.length;++p){const g=this.topGlyphs[p];xt.renderOutline(this.context,g.metrics.outline,g.scale,d+g.x_shift,this.stave.getYForLine(c.topLine)),d+=g.getMetrics().width}d=f+h;for(let p=0;p<this.botGlyphs.length;++p){const g=this.botGlyphs[p];c.placeGlyphOnLine(g,this.stave,g.line),xt.renderOutline(this.context,g.metrics.outline,g.scale,d+g.x_shift,this.stave.getYForLine(c.bottomLine)),d+=g.getMetrics().width}},i}getTimeSig(){return this.timeSig}setTimeSig(t){return this.timeSig=this.parseTimeSpec(t),this}draw(){if(!this.x)throw new M.RERR("TimeSignatureError","Can't draw time signature without x.");if(!this.stave)throw new M.RERR("TimeSignatureError","Can't draw time signature without stave.");this.setRendered(),this.timeSig.glyph.setStave(this.stave),this.timeSig.glyph.setContext(this.stave.context),this.placeGlyphOnLine(this.timeSig.glyph,this.stave,this.timeSig.line),this.timeSig.glyph.renderToStave(this.x)}}class ti extends Vt{static get CATEGORY(){return"voltas"}static get type(){return{NONE:1,BEGIN:2,MID:3,END:4,BEGIN_END:5}}constructor(t,e,i,s){super(),this.setAttribute("type","Volta"),this.volta=t,this.x=i,this.y_shift=s,this.number=e,this.font={family:"sans-serif",size:9,weight:"bold"}}getCategory(){return ti.CATEGORY}setShiftY(t){return this.y_shift=t,this}draw(t,e){const i=t.checkContext();this.setRendered();let s=t.width-e;const r=t.getYForTopText(t.options.num_lines)+this.y_shift,o=1.5*t.options.spacing_between_lines_px;switch(this.volta){case ti.type.BEGIN:i.fillRect(this.x+e,r,1,o);break;case ti.type.END:s-=5,i.fillRect(this.x+e+s,r,1,o);break;case ti.type.BEGIN_END:s-=3,i.fillRect(this.x+e,r,1,o),i.fillRect(this.x+e+s,r,1,o);break}return(this.volta===ti.type.BEGIN||this.volta===ti.type.BEGIN_END)&&(i.save(),i.setFont(this.font.family,this.font.size,this.font.weight),i.fillText(this.number,this.x+e+5,r+15),i.restore()),i.fillRect(this.x+e,r,s,1),this}}let jo="",Le={};const fr={};class sn extends he{static saxophoneMap(t){const e={C:"bE","#C":"E","C#":"E",Db:"E",D:"F",Eb:"bG",E:"G",F:"bA","#F":"A","F#":"A",Gb:"A",G:"bB",Ab:"B",A:"C",Bb:"bD",B:"D"};return e[t]?e[t]:t}constructor(t,e,i,s){super(),this.setAttribute("type","Stave"),this.x=t,this.y=e,this.width=i,this.formatted=!1,this.setStartX(t+5),this.end_x=t+i,this.staveTempos=[],this.modifiers=[],this.measure=0,this.clef="treble",this.endClef=void 0,this.font={family:"sans-serif",size:8,weight:""},this.timeSignature={numerator:"",denominator:""},this.options={vertical_bar_width:10,glyph_spacing_px:10,num_lines:5,fill_style:"#999999",left_bar:!1,right_bar:!0,spacing_between_lines_px:10,space_above_staff_ln:4,space_below_staff_ln:4,top_text_position:1,DYMusicScoreType:"",keySignature:""},this.bounds={x:this.x,y:this.y,w:this.width,h:0},M.Merge(this.options,s),this.resetLines();const r=Xt.type;this.addModifier(new Xt(this.options.left_bar?r.SINGLE:r.NONE)),this.addEndModifier(new Xt(this.options.right_bar?r.SINGLE:r.NONE))}space(t){return this.options.spacing_between_lines_px*t}resetLines(){this.options.line_config=[];for(let t=0;t<this.options.num_lines;t++)this.options.DYMusicScoreType==="jianpu"?this.options.line_config.push({visible:!1}):this.options.line_config.push({visible:!0});this.height=(this.options.num_lines+this.options.space_above_staff_ln)*this.options.spacing_between_lines_px,this.options.bottom_text_position=this.options.num_lines}getLines(){return this.options.line_config.map(e=>e.visible).filter(Boolean).length}getOptions(){return this.options}setNoteStartX(t){this.formatted||this.format(),this.setStartX(t);const e=this.modifiers[0];return e.setX(this.start_x-e.getWidth()),this}setStartX(t){this.start_x=t}getNoteStartX(){return this.formatted||this.format(),this.start_x}getNoteEndX(){return this.formatted||this.format(),this.end_x}getTieStartX(){return this.start_x}getTieEndX(){return this.x+this.width}getX(){return this.x}getNumLines(){return this.options.num_lines}setNumLines(t){return this.options.num_lines=parseInt(t,10),this.resetLines(),this}setY(t){return this.y=t,this}getTopLineTopY(){return this.getYForLine(0)-V.STAVE_LINE_THICKNESS/2}getBottomLineBottomY(){return this.getLines()===2?this.getYForLine(6)+V.STAVE_LINE_THICKNESS/2:this.getYForLine(this.getNumLines()-1)+V.STAVE_LINE_THICKNESS/2}setX(t){const e=t-this.x;this.formatted=!1,this.x=t,this.start_x+=e,this.end_x+=e;for(let i=0;i<this.modifiers.length;i++){const s=this.modifiers[i];s.x!==void 0&&(s.x+=e)}return this}setWidth(t){return this.formatted=!1,this.width=t,this.end_x=this.x+t,this}getWidth(){return this.width}getStyle(){return be({fillStyle:this.options.fill_style,strokeStyle:this.options.fill_style,lineWidth:V.STAVE_LINE_THICKNESS},this.style||{})}setMeasure(t){return this.measure=t,this}getModifierXShift(t=0){if(typeof t!="number")throw new M.RERR("InvalidIndex","Must be of number type");if(this.formatted||this.format(),this.getModifiers(Vt.Position.BEGIN).length===1)return 0;let e=this.start_x-this.x;const i=this.modifiers[0];return i.getType()===Xt.type.REPEAT_BEGIN&&e>i.getWidth()&&(e-=i.getWidth()),e}setRepetitionTypeLeft(t,e){return this.modifiers.push(new _e(t,this.x,e)),this}setRepetitionTypeRight(t,e){return this.modifiers.push(new _e(t,this.x,e)),this}setVoltaType(t,e,i){if(t===2)Le.type===2&&Le.stave.modifiers.push(new ti(Le.type,Le.number_t,Le.x,Le.y)),Le={stave:this,type:t,number_t:e,MeasureNumber:this.MeasureNumber,y:i,x:this.x};else if(t===4){let s=this.MeasureNumber-Le.MeasureNumber,r=Math.max(Le.y,i);for(let o=0;o<=s;o++)fr[Le.MeasureNumber+o]={type:o===0?2:o===s?4:0,number_t:e,y:r};Le={}}else this.modifiers.push(new ti(t,e,this.x,i));return this}drawVolta(){let t=fr[this.MeasureNumber];t&&(this.modifiers.push(new ti(t.type,t.number_t,this.x,t.y)),delete fr[this.MeasureNumber]),Le.type&&Le.MeasureNumber==this.MeasureNumber&&(this.modifiers.push(new ti(Le.type,Le.number_t,this.x,Le.y)),Le={})}setSection(t,e,i=0,s=12){const r=new ho(t,this.x+i,e);return r.font.size=s,this.modifiers.push(r),this}setTempo(t,e){return this.modifiers.push(new $n(t,this.x,e)),this}setText(t,e,i){let s=new co(t,e,i);return s.setFont({family:"Arial",size:14,weight:"normal"}),this.modifiers.push(s),this}getHeight(){return this.height}getSpacingBetweenLines(){return this.options.spacing_between_lines_px}getBoundingBox(){return new es(this.x,this.y,this.width,this.getBottomY()-this.y)}getBottomY(){const t=this.options,e=t.spacing_between_lines_px;return this.getYForLine(t.num_lines)+t.space_below_staff_ln*e}getBottomLineY(){return this.getYForLine(this.options.num_lines)}getYForLine(t){const e=this.options,i=e.spacing_between_lines_px,s=e.space_above_staff_ln;return this.y+t*i+s*i}getLineForY(t){const e=this.options,i=e.spacing_between_lines_px,s=e.space_above_staff_ln;return(t-this.y)/i-s}getYForTopText(t){const e=t||0;return this.getYForLine(-e-this.options.top_text_position)}getYForBottomText(t){const e=t||0;return this.getYForLine(this.options.bottom_text_position+e)}getYForNote(t){const e=this.options,i=e.spacing_between_lines_px,s=e.space_above_staff_ln;return this.y+s*i+5*i-t*i}getYForGlyphs(){return this.getYForLine(3)}addModifier(t,e,i){return e!==void 0&&t.setPosition(e),i&&(this.timeSignature.numerator=i.numerator,this.timeSignature.denominator=i.denominator),t.setStave(this),this.formatted=!1,this.modifiers.push(t),this}addEndModifier(t){return this.addModifier(t,Vt.Position.END),this}setBegBarType(t){const{SINGLE:e,REPEAT_BEGIN:i,NONE:s}=Xt.type;return(t===e||t===i||t===s)&&(this.modifiers[0].setType(t),this.formatted=!1),this}setEndBarType(t){return t!==Xt.type.REPEAT_BEGIN&&(this.modifiers[1].setType(t),this.formatted=!1),this}setClef(t,e,i,s){s===void 0&&(s=Vt.Position.BEGIN),s===Vt.Position.END?this.endClef=t:this.clef=t;const r=this.getModifiers(s,hi.CATEGORY);return r.length===0?this.addClef(t,e,i,s):r[0].setType(t,e,i),this}setEndClef(t,e,i){return this.setClef(t,e,i,Vt.Position.END),this}setKeySignature(t,e,i){this.options.keySignature=t,i===void 0&&(i=Vt.Position.BEGIN);const s=this.getModifiers(i,ss.CATEGORY);return s.length===0?this.options.DYMusicScoreType!=="jianpu"&&this.addKeySignature(t,e,i):s[0].setKeySig(t,e),this}setEndKeySignature(t,e){return this.setKeySignature(t,e,Vt.Position.END),this}setTimeSignature(t,e,i){i===void 0&&(i=Vt.Position.BEGIN);const s=this.getModifiers(i,Wi.CATEGORY);return s.length===0?this.addTimeSignature(t,e,i):s[0].setTimeSig(t),this}setEndTimeSignature(t,e){return this.setTimeSignature(t,e,Vt.Position.END),this}addKeySignature(t,e,i){return i===void 0&&(i=Vt.Position.BEGIN),this.addModifier(new ss(t,e).setPosition(i),i),this}addClef(t,e,i,s){return s===void 0||s===Vt.Position.BEGIN?this.clef=t:s===Vt.Position.END&&(this.endClef=t),this.addModifier(new hi(t,e,i),s),this}addEndClef(t,e,i){return this.addClef(t,e,i,Vt.Position.END),this}addTimeSignature(t,e,i){return this.addModifier(new Wi(t,e),i),this}addEndTimeSignature(t,e){return this.addTimeSignature(t,e,Vt.Position.END),this}addTrebleGlyph(){return this.addClef("treble"),this}getModifiers(t,e){return t===void 0&&e===void 0?this.modifiers:this.modifiers.filter(i=>(t===void 0||t===i.getPosition())&&(e===void 0||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 r=t[s];t[s]=t[s+1],t[s+1]=r}}format(){const t=this.modifiers[0],e=this.modifiers[1],i=this.getModifiers(Vt.Position.BEGIN),s=this.getModifiers(Vt.Position.END);this.sortByCategory(i,{barlines:0,clefs:1,keysignatures:2,timesignatures:3}),this.sortByCategory(s,{timesignatures:0,keysignatures:1,barlines:2,clefs:3}),i.length>1&&t.getType()===Xt.type.REPEAT_BEGIN&&(i.push(i.splice(0,1)[0]),i.splice(0,0,new Xt(Xt.type.SINGLE))),s.indexOf(e)>0&&s.splice(0,0,new Xt(Xt.type.NONE));let r,o,a,l=0,h=this.x;for(let f=0;f<i.length;f++)a=i[f],o=a.getPadding(f+l),r=a.getWidth(),isNaN(r)&&(a.setWidth(10),r=10),h+=o,a.setX(h),h+=r,o+r===0&&l--;this.setStartX(h),h=this.x+this.width;const c={left:0,right:0,paddingRight:0,paddingLeft:0};let u=0;for(let f=0;f<s.length;f++){a=s[f],u=a.getCategory()==="barlines"?f:u,c.right=0,c.left=0,c.paddingRight=0,c.paddingLeft=0;const d=a.getLayoutMetrics();d?(f!==0&&(c.right=d.xMax||0,c.paddingRight=d.paddingRight||0),c.left=-d.xMin||0,c.paddingLeft=d.paddingLeft||0,f===s.length-1&&(c.paddingLeft=0)):(c.paddingRight=a.getPadding(f-u)||0,f!==0&&(c.right=a.getWidth()||0),f===0&&(c.left=a.getWidth()||0)),h-=c.paddingRight,h-=c.right,a.setX(h),h-=c.left,h-=c.paddingLeft}this.end_x=s.length===1?this.x+this.width:h,this.formatted=!0}draw(){this.checkContext(),this.setRendered(),this.formatted||this.format();const t=this.options.num_lines,e=this.width,i=this.x;let s;const r=this.getLines();if(r===2||r===3){const o=r===2?[2,4]:[0,2,4];this.options.line_config.forEach((a,l)=>{o.includes(l)?a.visible=!0:a.visible=!1})}for(let o=0;o<t;o++)s=this.getYForLine(o),this.applyStyle(),this.options.line_config[o].visible&&(this.context.beginPath(),this.context.moveTo(i,s),this.context.lineTo(i+e,s),this.context.stroke()),this.restoreStyle();this.drawVolta(),this.options.DYMusicScoreType==="jianpu"&&this.drawJianpuKey();for(let o=0;o<this.modifiers.length;o++){if(this.options.DYMusicScoreType==="jianpu"){let l=this.modifiers[o].attrs.type;if(["StaveTempo","TimeSignature"].includes(l))continue}if(this.modifiers[o].attrs.type==="StaveTempo"){this.staveTempos.push(this.modifiers[o]);continue}r===2&&(this.modifiers[o].attrs.type==="Clef"&&(this.modifiers[o].clef.line=3),this.modifiers[o].attrs.type==="TimeSignature"&&(this.modifiers[o].bottomLine=5,this.modifiers[o].topLine=3)),r===4&&this.modifiers[o].attrs.type==="Clef"&&(this.modifiers[o].clef.line=1.5);let a=!1;["StaveSection","Repetition"].includes(this.modifiers[o].attrs.type)&&(a=!0,this.context.openGroup(this.modifiers[o].attrs.type)),typeof this.modifiers[o].draw=="function"&&(this.modifiers[o].applyStyle(this.context),this.modifiers[o].draw(this,this.getModifierXShift(o)),this.modifiers[o].restoreStyle(this.context)),a&&this.context.closeGroup()}if(setTimeout(()=>this.drawStaveTempo()),this.measure>0){this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.weight);const o=this.context.measureText(""+this.measure).width;s=this.getYForTopText(0)+3,this.context.fillText(""+this.measure,this.x-o/2,s),this.context.restore()}return this}drawStaveTempo(){if(!this.staveTempos.length)return;const t=document.querySelector(`#${this.attrs.id}`);if(!t)return;const e=t.parentElement.getBBox(),i=this.getYForLine(0),s=t.parentElement.parentElement.querySelectorAll(".vf-curve");if(s.length){const r=this.x+this.staveTempos[0].shift_x+this.getModifierXShift(0),o=this.getYForTopText(1)+e.y-i+5;s.forEach(a=>{const l=a.getBBox();l.x-10<r&&l.x+l.width>r&&l.y-10<o&&l.y+l.height>o&&(e.y=l.y+5)})}for(let r=0;r<this.staveTempos.length;r++)this.staveTempos[r].shift_y=e.y-i+5,this.staveTempos[r].applyStyle(this.context),this.staveTempos[r].draw(this,this.getModifierXShift(r)),this.staveTempos[r].restoreStyle(this.context);this.staveTempos=[]}drawJianpuKey(){if(this.options.keySignature){let t=this.options.keySignature;window.DYSubjectId===6&&(t=sn.saxophoneMap(t)),window&&window.sett&&window.sett.keySignature&&(t="C"),this.MeasureNumber<2?this.setText(`1=${t}`,1,{justification:1,shift_x:50,shift_y:-75}):this.options.keySignature!=jo&&this.setText(`1=${t}`,1,{justification:1,shift_x:50,shift_y:-50}),jo=this.options.keySignature}if(this.MeasureNumber>=0&&this.timeSignature.numerator){let t=40,e=0;this.MeasureNumber<2&&(t=70,e=-72),this.setText(`${this.timeSignature.numerator}`,1,{justification:1,shift_x:t,shift_y:e-13}),this.setText("\u1173",1,{justification:1,shift_x:t+3,shift_y:e-2}),this.setText(`${this.timeSignature.denominator}`,1,{justification:1,shift_x:t,shift_y:e+8})}}drawVertical(t,e){this.drawVerticalFixed(this.x+t,e)}drawVerticalFixed(t,e){this.checkContext();const i=this.getYForLine(0),s=this.getYForLine(this.options.num_lines-1);e&&this.context.fillRect(t-3,i,1,s-i+1),this.context.fillRect(t,i,1,s-i+1)}drawVerticalBar(t){this.drawVerticalBarFixed(this.x+t,!1)}drawVerticalBarFixed(t){this.checkContext();const e=this.getYForLine(0),i=this.getYForLine(this.options.num_lines-1);this.context.fillRect(t,e,1,i-e+1)}getConfigForLines(){return this.options.line_config}setConfigForLine(t,e){if(t>=this.options.num_lines||t<0)throw new M.RERR("StaveConfigError","The line number must be within the range of the number of lines in the Stave.");if(e.visible===void 0)throw new M.RERR("StaveConfigError","The line configuration object is missing the 'visible' property.");if(typeof e.visible!="boolean")throw new M.RERR("StaveConfigError","The line configuration objects 'visible' property must be true or false.");return this.options.line_config[t]=e,this}setConfigForLines(t){if(t.length!==this.options.num_lines)throw new M.RERR("StaveConfigError","The length of the lines configuration array must match the number of lines in the Stave");for(const e in t)t[e]||(t[e]=this.options.line_config[e]),M.Merge(this.options.line_config[e],t[e]);return this.options.line_config=t,this}}class Ia extends sn{constructor(t,e,i,s){const r={spacing_between_lines_px:13,num_lines:6,top_text_position:1};M.Merge(r,s),super(t,e,i,r),this.setAttribute("type","TabStave")}getYForGlyphs(){return this.getYForLine(2.5)}addTabGlyph(){return this.addClef("tab"),this}}function _c(n,t){const e=[];let i=[];for(let s=1;s<=n;s++)t.indexOf(s)>-1?(e.push(i),i=[]):i.push(s);return i.length>0&&e.push(i),e}function wc(n,t,e,i){const s=i!==1,r=i!==-1,o=e.getSpacingBetweenLines(),a=e.getNumLines(),l=[];return t.forEach(h=>{const c=h.indexOf(a)>-1,u=h.indexOf(1)>-1;if(s&&u||r&&c)return;h.length===1&&h.push(h[0]);const f=[];h.forEach((d,p,g)=>{const m=d===1,S=d===a;let b=e.getYForLine(d-1);p===0&&!m?b-=o/2-1:p===g.length-1&&!S&&(b+=o/2-1),f.push(b),i===1&&m?f.push(n-2):i===-1&&S&&f.push(n+2)}),l.push(f.sort((d,p)=>d-p))}),l}class nn extends oo{static get CATEGORY(){return"tabnotes"}constructor(t,e){if(super(t),this.setAttribute("type","TabNote"),this.ghost=!1,this.positions=t.positions,M.Merge(this.render_options,{glyph_font_scale:V.DEFAULT_TABLATURE_FONT_SCALE,draw_stem:e,draw_dots:e,draw_stem_through_stave:!1,y_shift:0,scale:1,font:"10pt Arial"}),this.glyph=V.getGlyphProps(this.duration,this.noteType),!this.glyph)throw new M.RuntimeError("BadArguments",`Invalid note initialization data (No glyph found): ${JSON.stringify(t)}`);this.buildStem(),t.stem_direction?this.setStemDirection(t.stem_direction):this.setStemDirection(ft.UP),this.ghost=!1,this.updateWidth()}reset(){this.stave&&this.setStave(this.stave)}getCategory(){return nn.CATEGORY}setGhost(t){return this.ghost=t,this.updateWidth(),this}hasStem(){return this.render_options.draw_stem}getStemExtension(){const t=this.getGlyph();return this.stem_extension_override!=null?this.stem_extension_override:t?this.getStemDirection()===1?t.tabnote_stem_up_extension:t.tabnote_stem_down_extension:0}addDot(){const t=new Gi;return this.dots+=1,this.addModifier(t,0)}updateWidth(){this.glyphs=[],this.width=0;for(let t=0;t<this.positions.length;++t){let e=this.positions[t].fret;this.ghost&&(e="("+e+")");const i=V.tabToGlyph(e,this.render_options.scale);this.glyphs.push(i),this.width=Math.max(i.getWidth(),this.width)}this.glyph.getWidth=()=>this.width}setStave(t){super.setStave(t),this.context=t.context;let e;if(this.context){const s=this.context;for(this.width=0,e=0;e<this.glyphs.length;++e){const r=this.glyphs[e],o=""+r.text;o.toUpperCase()!=="X"&&(s.save(),s.setRawFont(this.render_options.font),r.width=s.measureText(o).width,s.restore(),r.getWidth=()=>r.width),this.width=Math.max(r.getWidth(),this.width)}this.glyph.getWidth=()=>this.width}const i=this.positions.map(({str:s})=>t.getYForLine(s-1));return this.setYs(i),this.stem&&this.stem.setYBounds(this.getStemY(),this.getStemY()),this}getPositions(){return this.positions}addToModifierContext(t){this.setModifierContext(t);for(let e=0;e<this.modifiers.length;++e)this.modifierContext.addModifier(this.modifiers[e]);return this.modifierContext.addModifier(this),this.preFormatted=!1,this}getTieRightX(){let t=this.getAbsoluteX();return t+=this.glyph.getWidth()/2,t+=-this.width/2+this.width+2,t}getTieLeftX(){let t=this.getAbsoluteX();return t+=this.glyph.getWidth()/2,t-=this.width/2+2,t}getModifierStartXY(t,e){if(!this.preFormatted)throw new M.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");if(this.ys.length===0)throw new M.RERR("NoYValues","No Y-Values calculated for this note.");let i=0;return t===St.Position.LEFT?i=-1*2:t===St.Position.RIGHT?i=this.width+2:(t===St.Position.BELOW||t===St.Position.ABOVE)&&(i=this.glyph.getWidth()/2),{x:this.getAbsoluteX()+i,y:this.ys[e]}}getLineForRest(){return this.positions[0].str}preFormat(){this.preFormatted||(this.modifierContext&&this.modifierContext.preFormat(),this.setPreFormatted(!0))}getStemX(){return this.getCenterGlyphX()}getStemY(){const t=this.stave.getNumLines(),e=-.5,i=t-.5,s=ft.UP===this.stem_direction?e:i;return this.stave.getYForLine(s)}getStemExtents(){return this.stem.getExtents()}drawFlag(){const{beam:t,glyph:e,context:i,stem:s,stem_direction:r,render_options:{draw_stem:o,glyph_font_scale:a}}=this,l=t==null&&o;if(e.flag&&l){const h=this.getStemX()+1,c=this.getStemY()-s.getHeight(),u=r===ft.DOWN?e.code_flag_downstem:e.code_flag_upstem;xt.renderGlyph(i,h,c,a,u)}}drawModifiers(){this.modifiers.forEach(t=>{t.getCategory()==="dots"&&!this.render_options.draw_dots||(t.setContext(this.context),t.drawWithStyle())})}drawStemThrough(){const t=this.getStemX(),e=this.getStemY(),i=this.context,s=this.render_options.draw_stem_through_stave;if(this.render_options.draw_stem&&s){const o=this.stave.getNumLines(),a=this.positions.map(c=>c.str),l=_c(o,a),h=wc(e,l,this.getStave(),this.getStemDirection());i.save(),i.setLineWidth(ft.WIDTH),h.forEach(c=>{c.length!==0&&(i.beginPath(),i.moveTo(t,c[0]),i.lineTo(t,c[c.length-1]),i.stroke(),i.closePath())}),i.restore()}}drawPositions(){const t=this.context,e=this.getAbsoluteX(),i=this.ys;for(let s=0;s<this.positions.length;++s){const r=i[s]+this.render_options.y_shift,o=this.glyphs[s],a=this.glyph.getWidth(),l=e+a/2-o.getWidth()/2;if(t.clearRect(l-2,r-3,o.getWidth()+4,6),o.code)xt.renderGlyph(t,l,r,this.render_options.glyph_font_scale*this.render_options.scale,o.code);else{t.save(),t.setRawFont(this.render_options.font);const h=o.text.toString();t.fillText(h,l,r+5*this.render_options.scale),t.restore()}}}draw(){if(this.checkContext(),!this.stave)throw new M.RERR("NoStave","Can't draw without a stave.");if(this.ys.length===0)throw new M.RERR("NoYValues","Can't draw note without Y values.");this.setRendered();const t=this.beam==null&&this.render_options.draw_stem;this.setAttribute("el",this.context.openGroup("tabnote",this.getAttribute("id"),{pointerBBox:!0})),this.drawPositions(),this.drawStemThrough();const e=this.getStemX();this.stem.setNoteHeadXBounds(e,e),t&&(this.context.openGroup("stem",null,{pointerBBox:!0}),this.stem.setContext(this.context).draw(),this.context.closeGroup()),this.drawFlag(),this.drawModifiers(),this.context.closeGroup()}}function Ec(...n){uo.DEBUG&&M.L("Vex.Flow.VibratoBracket",n)}class uo extends he{constructor(t){super(),this.setAttribute("type","VibratoBracket"),this.start=t.start,this.stop=t.stop,this.toEndOfStopStave=t.toEndOfStopStave,this.line=1,this.render_options={harsh:!1,wave_height:6,wave_width:4,wave_girth:2}}setLine(t){return this.line=t,this}setHarsh(t){return this.render_options.harsh=t,this}draw(){const t=this.context;this.setRendered();const e=this.start?this.start.getStave().getYForTopText(this.line):this.stop.getStave().getYForTopText(this.line);let i=0;if(this.start){let r=0;for(const o of this.start.modifiers)if(o&&o.type==="tr"){r=o.glyph.bbox.w;break}i=this.start.getNoteHeadBeginX?this.start.getNoteHeadBeginX():this.start.getAbsoluteX(),i+=r}else i=this.stop.getStave().getTieStartX();let s=0;this.stop?s=this.toEndOfStopStave?this.stop.getStave().getTieEndX()-10:this.stop.getAbsoluteX()+this.stop.getWidth():s=this.start.getStave().getTieEndX()-10,this.render_options.vibrato_width=s-i,Ec("Rendering VibratoBracket: start_x:",i,"stop_x:",s,"y:",e),vs.renderVibrato(t,i,e,this.render_options)}}let dr;function Mc(){if(!dr){const n=new Ms({duration:"w",note_type:"r"});dr={glyph_font_scale:n.render_options.glyph_font_scale,glyph_code:n.glyph_code,width:n.getWidth()}}return dr}class ka extends he{constructor(t,e){super(),this.setAttribute("type","MultiMeasureRest"),this.render_options={show_number:!0,number_line:-.5,number_glyph_point:40,padding_left:void 0,padding_right:void 0,line:2,spacing_between_lines_px:10,line_thickness:void 0,serif_thickness:2,use_symbols:!1,symbol_spacing:void 0,semibrave_rest_glyph_scale:V.DEFAULT_NOTATION_FONT_SCALE},M.Merge(this.render_options,e),this.number_of_measures=t,this.xs={left:NaN,right:NaN}}getXs(){return this.xs}setStave(t){return this.stave=t,this}getStave(){return this.stave}drawLine(t,e,i,s){const r=this.stave.getYForLine(this.render_options.line),o=(i-e)*.1;e+=o,i-=o;const a={thickness:this.render_options.serif_thickness,height:s};let l=s*.25;isNaN(this.render_options.line_thickness)||(l=this.render_options.line_thickness*.5),t.save(),t.beginPath(),t.moveTo(e,r-s),t.lineTo(e+a.thickness,r-s),t.lineTo(e+a.thickness,r-l),t.lineTo(i-a.thickness,r-l),t.lineTo(i-a.thickness,r-s),t.lineTo(i,r-s),t.lineTo(i,r+s),t.lineTo(i-a.thickness,r+s),t.lineTo(i-a.thickness,r+l),t.lineTo(e+a.thickness,r+l),t.lineTo(e+a.thickness,r+s),t.lineTo(e,r+s),t.closePath(),t.fill()}drawSymbols(t,e,i,s){const r=Math.floor(this.number_of_measures/4),o=this.number_of_measures%4,a=Math.floor(o/2),l=o%2,h=Mc(),c=h.width*(this.render_options.semibrave_rest_glyph_scale/h.glyph_font_scale),u={2:{width:c*.5,height:s},1:{width:c}};let f=c*1.35;isNaN(this.render_options.symbol_spacing)||(f=this.render_options.symbol_spacing);const d=r*u[2].width+a*u[2].width+l*u[1].width+(r+a+l-1)*f;let p=e+(i-e)*.5-d*.5;const g=this.stave.getYForLine(this.render_options.line-1),m=this.stave.getYForLine(this.render_options.line),S=this.stave.getYForLine(this.render_options.line+1);t.save(),t.setStrokeStyle("none"),t.setLineWidth(0);for(let b=0;b<r;++b)t.fillRect(p,m-u[2].height,u[2].width,u[2].height),t.fillRect(p,S-u[2].height,u[2].width,u[2].height),p+=u[2].width+f;for(let b=0;b<a;++b)t.fillRect(p,m-u[2].height,u[2].width,u[2].height),p+=u[2].width+f;for(let b=0;b<l;++b)xt.renderGlyph(t,p,g,this.render_options.semibrave_rest_glyph_scale,h.glyph_code),p+=u[1].width+f;t.restore()}draw(){this.checkContext(),this.setRendered();const t=this.context,e=this.stave,i=this.render_options.spacing_between_lines_px;let s=e.getNoteStartX(),r=e.getNoteEndX();const o=e.getModifiers(Vt.Position.BEGIN);if(o.length===1&&o[0].getCategory()==="barlines"&&(s-=o[0].getWidth()),isNaN(this.render_options.padding_left)||(s=e.getX()+this.render_options.padding_left),isNaN(this.render_options.padding_right)||(r=e.getX()+e.getWidth()-this.render_options.padding_right),this.xs.left=s,this.xs.right=r,this.render_options.use_symbols?this.drawSymbols(t,s,r,i):this.drawLine(t,s,r,i),this.render_options.show_number){const a="/"+this.number_of_measures,l=new Wi(null,void 0,!1);l.point=this.render_options.number_glyph_point,l.setTimeSig(a),l.setStave(e),l.x=s+(r-s)*.5-l.timeSig.glyph.getMetrics().width*.5,l.bottomLine=this.render_options.number_line,l.setContext(t).draw()}}}class tr extends Ie{static get CATEGORY(){return"clefnote"}constructor(t,e,i){super({duration:"b"}),this.setAttribute("type","ClefNote"),this.setType(t,e,i),this.ignore_ticks=!0}setType(t,e,i){return this.type=t,this.clef_obj=new hi(t,e,i),this.clef=this.clef_obj.clef,this.glyph=new xt(this.clef.code,this.clef.point),this.setWidth(this.glyph.getMetrics().width),this}getClef(){return this.clef}setContext(t){return this.context=t,this.glyph.setContext(this.context),this}getBoundingBox(){return super.getBoundingBox()}addToModifierContext(){return this}getCategory(){return tr.CATEGORY}preFormat(){return this.setPreFormatted(!0),this}draw(){if(!this.stave)throw new M.RERR("NoStave","Can't draw without a stave.");this.glyph.getContext()||this.glyph.setContext(this.context),this.setRendered();const t=this.getAbsoluteX();if(this.glyph.setStave(this.stave),this.glyph.setYShift(this.stave.getYForLine(this.clef.line)-this.stave.getYForGlyphs()),this.glyph.renderToStave(t),this.clef_obj.annotation!==void 0){const e=new xt(this.clef_obj.annotation.code,this.clef_obj.annotation.point);e.getContext()||e.setContext(this.context),e.setStave(this.stave),e.setYShift(this.stave.getYForLine(this.clef_obj.annotation.line)-this.stave.getYForGlyphs()),e.setXShift(this.clef_obj.annotation.x_shift),e.renderToStave(t)}}}class Ba extends Ie{constructor(t,e,i){super({duration:"b"}),this.setAttribute("type","KeySigNote"),this.keySignature=new ss(t,e,i),this.ignore_ticks=!0}getBoundingBox(){return super.getBoundingBox()}addToModifierContext(){return this}preFormat(){return this.setPreFormatted(!0),this.keySignature.setStave(this.stave),this.keySignature.format(),this.setWidth(this.keySignature.width),this}draw(){this.stave.checkContext(),this.setRendered(),this.keySignature.x=this.getAbsoluteX(),this.keySignature.setContext(this.context),this.keySignature.draw()}}class Da extends Ie{constructor(t,e){super({duration:"b"}),this.setAttribute("type","TimeSigNote");const i=new Wi(t,e);this.timeSig=i.getTimeSig(),this.setWidth(this.timeSig.glyph.getMetrics().width),this.ignore_ticks=!0}getBoundingBox(){return super.getBoundingBox()}addToModifierContext(){return this}preFormat(){return this.setPreFormatted(!0),this}draw(){this.stave.checkContext(),this.setRendered(),this.timeSig.glyph.getContext()||this.timeSig.glyph.setContext(this.context),this.timeSig.glyph.setStave(this.stave),this.timeSig.glyph.setYShift(this.stave.getYForLine(this.timeSig.line)-this.stave.getYForGlyphs()),this.timeSig.glyph.renderToStave(this.getAbsoluteX())}}class pi extends ys{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."),this.setAttribute("type","TabSlide"),!e){const i=t.first_note.getPositions()[0].fret,s=t.last_note.getPositions()[0].fret;e=parseInt(i,10)>parseInt(s,10)?pi.SLIDE_DOWN:pi.SLIDE_UP}this.slide_direction=e,this.render_options.cp1=11,this.render_options.cp2=14,this.render_options.y_shift=.5,this.setFont({font:"Times",size:10,style:"bold italic"}),this.setNotes(t)}renderTie(t){if(t.first_ys.length===0||t.last_ys.length===0)throw new M.RERR("BadArguments","No Y-values to render");const e=this.context,i=t.first_x_px,s=t.first_ys,r=t.last_x_px,o=this.slide_direction;if(o!==pi.SLIDE_UP&&o!==pi.SLIDE_DOWN)throw new M.RERR("BadSlide","Invalid slide direction");for(let a=0;a<this.first_indices.length;++a){const l=s[this.first_indices[a]]+this.render_options.y_shift;if(isNaN(l))throw new M.RERR("BadArguments","Bad indices for slide rendering.");e.beginPath(),e.moveTo(i,l+3*o),e.lineTo(r,l-3*o),e.closePath(),e.stroke()}this.setRendered()}}class ts extends ae{static get CATEGORY(){return"gracenotes"}static get LEDGER_LINE_OFFSET(){return 2}static get SCALE(){return .66}constructor(t){super(Object.assign(t,{glyph_font_scale:V.DEFAULT_NOTATION_FONT_SCALE*ts.SCALE,stroke_px:ts.LEDGER_LINE_OFFSET})),this.setAttribute("type","GraceNote"),this.slash=t.slash,this.slur=!0,this.buildNoteHeads(),this.width=3}getStemExtension(){if(this.stem_extension_override!=null)return this.stem_extension_override;const t=this.getGlyph();if(t){let e=super.getStemExtension();if(t.stem){const i=this.getStaveNoteScale();e=(ft.HEIGHT+e)*i-ft.HEIGHT}return e}return 0}getCategory(){return ts.CATEGORY}getStaveNoteScale(){return this.render_options.glyph_font_scale/V.DEFAULT_NOTATION_FONT_SCALE}draw(){super.draw(),this.setRendered();const t=this.stem;if(this.slash&&t){const e=this.getStaveNoteScale(),i=e/.66;let s;const r=this.beam;if(r)r.postFormatted||r.postFormat(),s=this.calcBeamedNotesSlashBBox(8*i,8*i,{stem:6*i,beam:5*i});else{const a=this.getStemDirection(),l=this.getNoteHeadBounds(),h=t.getHeight();let c=this.getAbsoluteX(),u=a===V.Stem.DOWN?l.y_top-h:l.y_bottom-h;const f=a===V.Stem.DOWN?this.glyph.stem_down_extension:this.glyph.stem_up_extension;let d=V.STEM_HEIGHT;d-=d/2.8,d+=f,u+=d*e*a;const p=a===V.Stem.UP?{x1:1,y1:0,x2:13,y2:-9}:{x1:-4,y1:1,x2:13,y2:9};c+=p.x1*i,u+=p.y1*i,s={x1:c,y1:u,x2:c+p.x2*i,y2:u+p.y2*i}}const o=this.context;o.save(),o.setLineWidth(1*i),o.beginPath(),o.moveTo(s.x1,s.y1),o.lineTo(s.x2,s.y2),o.closePath(),o.stroke(),o.restore()}}calcBeamedNotesSlashBBox(t,e,i){const s=this.beam,r=s.slope,a=s.notes[s.notes.length-1]===this?-1:1,l=Math.atan(r*a),h={dx:Math.cos(l)*e,dy:Math.sin(l)*e};t*=this.getStemDirection();const c=Math.atan((h.dy-t)/h.dx),u=Math.cos(c)*i.stem*a,f=Math.sin(c)*i.stem,d=Math.cos(c)*i.beam*a,p=Math.sin(c)*i.beam,g=this.getStemX(),m=s.notes[0].getStemX(),S=this.beam.getBeamYToDraw()+(g-m)*r;return{x1:g-u,y1:S+t-f,x2:g+h.dx*a+d,y2:S+h.dy+p}}}class fo extends nn{static get CATEGORY(){return"gracetabnotes"}constructor(t){super(t,!1),this.setAttribute("type","GraceTabNote"),M.Merge(this.render_options,{y_shift:.3,scale:.6,font:"7.5pt Arial"}),this.updateWidth()}getCategory(){return fo.CATEGORY}draw(){super.draw(),this.setRendered()}}class Rn{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.setTuning(t)}noteToInteger(t){return V.keyProperties(t).int_value}setTuning(t){Rn.names[t]&&(t=Rn.names[t]),this.tuningString=t,this.tuningValues=[],this.numStrings=0;const e=t.split(/\s*,\s*/);if(e.length===0)throw new M.RERR("BadArguments","Invalid tuning string: "+t);this.numStrings=e.length;for(let i=0;i<this.numStrings;++i)this.tuningValues[i]=this.noteToInteger(e[i])}getValueForString(t){const e=parseInt(t,10);if(e<1||e>this.numStrings)throw new M.RERR("BadArguments",`String number must be between 1 and ${this.numStrings}:${t}`);return this.tuningValues[e-1]}getValueForFret(t,e){const i=this.getValueForString(e),s=parseInt(t,10);if(s<0)throw new M.RERR("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),r=i%12;return V.integerToNote(r)+"/"+s}}class Pc{constructor(t){this.music=new te,this.setKey(t)}setKey(t){return this.key=t,this.reset(),this}getKey(){return this.key}reset(){if(this.keyParts=this.music.getKeyParts(this.key),this.keyString=this.keyParts.root,this.keyParts.accidental&&(this.keyString+=this.keyParts.accidental),!te.scaleTypes[this.keyParts.type])throw new M.RERR("BadArguments",`Unsupported key type: ${this.key}`);this.scale=this.music.getScaleTones(this.music.getNoteValue(this.keyString),te.scaleTypes[this.keyParts.type]),this.scaleMap={},this.scaleMapByValue={},this.originalScaleMapByValue={};const e=te.root_indices[this.keyParts.root];for(let i=0;i<te.roots.length;++i){const s=(e+i)%te.roots.length,r=te.roots[s],o=this.music.getRelativeNoteName(r,this.scale[i]);this.scaleMap[r]=o,this.scaleMapByValue[this.scale[i]]=o,this.originalScaleMapByValue[this.scale[i]]=o}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 r=this.scaleMapByValue[this.music.getNoteValue(t)];if(r!=null)return{note:r,accidental:this.music.getNoteParts(r).accidental,change:!1};const o=this.originalScaleMapByValue[this.music.getNoteValue(t)];return o!=null?(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:null,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})}}class Ws extends he{static get type(){return{CRESC:1,DECRESC:2}}static FormatByTicksAndDraw(t,e,i,s,r,o){const a=e.pixelsPerTick;if(a==null)throw new M.RuntimeError("BadArguments","A valid Formatter must be provide to draw offsets by ticks.");const l=a*o.left_shift_ticks,h=a*o.right_shift_ticks,c={height:o.height,y_shift:o.y_shift,left_shift_px:l,right_shift_px:h};new Ws({first_note:i.first_note,last_note:i.last_note},s).setContext(t).setRenderOptions(c).setPosition(r).draw()}constructor(t,e){super(),this.setAttribute("type","StaveHairpin"),this.notes=t,this.hairpin=e,this.position=St.Position.BELOW,this.render_options={height:10,y_shift:0,left_shift_px:0,right_shift_px:0},this.setNotes(t)}setPosition(t){return(t===St.Position.ABOVE||t===St.Position.BELOW)&&(this.position=t),this}setRenderOptions(t){return t.height!=null&&t.y_shift!=null&&t.left_shift_px!=null&&t.right_shift_px!=null&&(this.render_options=t),this}setNotes(t){if(!t.first_note&&!t.last_note)throw new M.RuntimeError("BadArguments","Hairpin needs to have either first_note or last_note set.");return this.first_note=t.first_note,this.last_note=t.last_note,this}renderHairpin(t){const e=this.checkContext();let i=this.render_options.y_shift+20,s=t.first_y;this.position===St.Position.ABOVE&&(i=-i+30,s=t.first_y-t.staff_height);const r=this.render_options.left_shift_px,o=this.render_options.right_shift_px;switch(e.beginPath(),this.hairpin){case Ws.type.CRESC:e.moveTo(t.last_x+o,s+i),e.lineTo(t.first_x+r,s+this.render_options.height/2+i),e.lineTo(t.last_x+o,s+this.render_options.height+i);break;case Ws.type.DECRESC:e.moveTo(t.first_x+r,s+i),e.lineTo(t.last_x+o,s+this.render_options.height/2+i),e.lineTo(t.first_x+r,s+this.render_options.height+i);break}e.stroke(),e.closePath()}draw(){this.checkContext(),this.setRendered();const t=this.first_note,e=this.last_note,i=t.getModifierStartXY(this.position,0),s=e.getModifierStartXY(this.position,0);return this.renderHairpin({first_x:i.x,last_x:s.x,first_y:t.getStave().y+t.getStave().height,last_y:e.getStave().y+e.getStave().height,staff_height:t.getStave().height}),!0}}class oi extends he{static get Position(){return{NEAR_HEAD:1,NEAR_TOP:2}}static get PositionString(){return{nearHead:oi.Position.NEAR_HEAD,nearTop:oi.Position.NEAR_TOP}}constructor(t,e,i){super(),this.setAttribute("type","Curve"),this.render_options={spacing:2,thickness:2,x_shift:0,y_shift:10,position:oi.Position.NEAR_HEAD,position_end:oi.Position.NEAR_HEAD,invert:!1,cps:[{x:0,y:10},{x:0,y:10}]},M.Merge(this.render_options,i),this.setNotes(t,e)}setNotes(t,e){if(!t&&!e)throw new M.RuntimeError("BadArguments","Curve needs to have either first_note or last_note set.");return this.from=t,this.to=e,this}isPartial(){return!this.from||!this.to}renderCurve(t){const e=this.context,i=this.render_options.cps,s=this.render_options.x_shift,r=this.render_options.y_shift*t.direction,o=t.first_x+s,a=t.first_y+r,l=t.last_x-s,h=t.last_y+r,c=this.render_options.thickness,u=(l-o)/(i.length+2);e.beginPath(),e.moveTo(o,a),e.bezierCurveTo(o+u+i[0].x,a+i[0].y*t.direction,l-u+i[1].x,h+i[1].y*t.direction,l,h),e.bezierCurveTo(l-u+i[1].x,h+(i[1].y+c)*t.direction,o+u+i[0].x,a+(i[0].y+c)*t.direction,o,a),e.stroke(),e.closePath(),e.fill()}draw(){this.checkContext(),this.setRendered();const t=this.from,e=this.to;let i,s,r,o,a,l="baseY",h="baseY";function c(d){return typeof d=="string"?oi.PositionString[d]:d}const u=c(this.render_options.position),f=c(this.render_options.position_end);return u===oi.Position.NEAR_TOP&&(l="topY",h="topY"),f===oi.Position.NEAR_HEAD?h="baseY":f===oi.Position.NEAR_TOP&&(h="topY"),t?(i=t.getTieRightX(),a=t.getStemDirection(),r=t.getStemExtents()[l]):(i=e.getStave().getTieStartX(),r=e.getStemExtents()[l]),e?(s=e.getTieLeftX(),a=e.getStemDirection(),o=e.getStemExtents()[h]):(s=t.getStave().getTieEndX(),o=t.getStemExtents()[h]),this.renderCurve({first_x:i,last_x:s,first_y:r,last_y:o,direction:a*(this.render_options.invert===!0?-1:1)}),!0}}function Ko(...n){_s.DEBUG&&M.L("Vex.Flow.TextDynamics",n)}class _s extends Ie{static get GLYPHS(){return{f:{code:"vba",width:12},p:{code:"vbf",width:14},m:{code:"v62",width:17},s:{code:"v4a",width:10},z:{code:"v80",width:12},r:{code:"vb1",width:12}}}constructor(t){super(t),this.setAttribute("type","TextDynamics"),this.sequence=t.text.toLowerCase(),this.line=t.line||0,this.glyphs=[],M.Merge(this.render_options,{glyph_font_size:40}),Ko("New Dynamics Text: ",this.sequence)}setLine(t){return this.line=t,this}preFormat(){let t=0;return this.sequence.split("").forEach(e=>{const i=_s.GLYPHS[e];if(!i)throw new M.RERR("Invalid dynamics character: "+e);const s=this.render_options.glyph_font_size,r=new xt(i.code,s);this.glyphs.push(r),t+=i.width}),this.setWidth(t),this.preFormatted=!0,this}draw(){this.setRendered();const t=this.getAbsoluteX(),e=this.stave.getYForLine(this.line+-3);Ko("Rendering Dynamics: ",this.sequence);let i=t;this.glyphs.forEach((s,r)=>{const o=this.sequence[r];s.render(this.context,i,e),i+=_s.GLYPHS[o].width})}}function qo(n,t,e,i,s,r,o){n.beginPath(),n.moveTo(t,e),n.lineTo(i,s),n.lineTo(r,o),n.lineTo(t,e),n.closePath(),n.fill()}function Lc(n,t,e,i){const s=i.draw_start_arrow&&i.draw_end_arrow,r=t.x,o=t.y,a=e.x,l=e.y,h=Math.sqrt((a-r)*(a-r)+(l-o)*(l-o)),c=(h-i.arrowhead_length/3)/h;let u,f,d,p;i.draw_end_arrow||s?(u=Math.round(r+(a-r)*c),f=Math.round(o+(l-o)*c)):(u=a,f=l),i.draw_start_arrow||s?(d=r+(a-r)*(1-c),p=o+(l-o)*(1-c)):(d=r,p=o),i.color&&(n.setStrokeStyle(i.color),n.setFillStyle(i.color)),n.beginPath(),n.moveTo(d,p),n.lineTo(u,f),n.stroke(),n.closePath();const g=Math.atan2(l-o,a-r),m=Math.abs(i.arrowhead_length/Math.cos(i.arrowhead_angle));let S,b,y,x,w,T;(i.draw_end_arrow||s)&&(S=g+Math.PI+i.arrowhead_angle,y=a+Math.cos(S)*m,x=l+Math.sin(S)*m,b=g+Math.PI-i.arrowhead_angle,w=a+Math.cos(b)*m,T=l+Math.sin(b)*m,qo(n,y,x,a,l,w,T)),(i.draw_start_arrow||s)&&(S=g+i.arrowhead_angle,y=r+Math.cos(S)*m,x=o+Math.sin(S)*m,b=g-i.arrowhead_angle,w=r+Math.cos(b)*m,T=o+Math.sin(b)*m,qo(n,y,x,r,o,w,T))}class mi extends he{static get TextVerticalPosition(){return{TOP:1,BOTTOM:2}}static get TextJustification(){return{LEFT:1,CENTER:2,RIGHT:3}}constructor(t){super(),this.setAttribute("type","StaveLine"),this.notes=t,this.text="",this.font={family:"Arial",size:10,weight:""},this.render_options={padding_left:4,padding_right:3,line_width:1,line_dash:null,rounded_end:!0,color:null,draw_start_arrow:!1,draw_end_arrow:!1,arrowhead_length:10,arrowhead_angle:Math.PI/8,text_position_vertical:mi.TextVerticalPosition.TOP,text_justification:mi.TextJustification.CENTER},this.setNotes(t)}setFont(t){return this.font=t,this}setText(t){return this.text=t,this}setNotes(t){if(!t.first_note&&!t.last_note)throw new M.RuntimeError("BadArguments","Notes needs to have either first_note or last_note set.");if(t.first_indices||(t.first_indices=[0]),t.last_indices||(t.last_indices=[0]),t.first_indices.length!==t.last_indices.length)throw new M.RuntimeError("BadArguments","Connected notes must have similar index sizes");return this.first_note=t.first_note,this.first_indices=t.first_indices,this.last_note=t.last_note,this.last_indices=t.last_indices,this}applyLineStyle(){const t=this.checkContext(),e=this.render_options;e.line_dash&&t.setLineDash(e.line_dash),e.line_width&&t.setLineWidth(e.line_width),e.rounded_end?t.setLineCap("round"):t.setLineCap("square")}applyFontStyle(){const t=this.checkContext();this.font&&t.setFont(this.font.family,this.font.size,this.font.weight),this.render_options.color&&(t.setStrokeStyle(this.render_options.color),t.setFillStyle(this.render_options.color))}draw(){const t=this.checkContext();this.setRendered();const e=this.first_note,i=this.last_note,s=this.render_options;t.save(),this.applyLineStyle();let r,o;this.first_indices.forEach((f,d)=>{const p=this.last_indices[d];r=e.getModifierStartXY(2,f),o=i.getModifierStartXY(1,p);const g=r.y>o.y;r.x+=e.getMetrics().modRightPx+s.padding_left,o.x-=i.getMetrics().modLeftPx+s.padding_right;const m=e.getGlyph().getWidth();e.getKeyProps()[f].displaced&&e.getStemDirection()===1&&(r.x+=m+s.padding_left),i.getKeyProps()[p].displaced&&i.getStemDirection()===-1&&(o.x-=m+s.padding_right),r.y+=g?-3:1,o.y+=g?2:0,Lc(t,r,o,this.render_options)}),t.restore();const a=t.measureText(this.text).width,l=s.text_justification;let h=0;l===mi.TextJustification.LEFT?h=r.x:l===mi.TextJustification.CENTER?h=(o.x-r.x)/2+r.x-a/2:l===mi.TextJustification.RIGHT&&(h=o.x-a);let c;const u=s.text_position_vertical;return u===mi.TextVerticalPosition.TOP?c=e.getStave().getYForTopText():u===mi.TextVerticalPosition.BOTTOM&&(c=e.getStave().getYForBottomText(V.TEXT_HEIGHT_OFFSET_HACK)),t.save(),this.applyFontStyle(),t.fillText(this.text,h,c),t.restore(),this}}function Tc(...n){Ot.DEBUG&&M.L("Vex.Flow.PedalMarking",n)}function pr(n,t,e,i,s){const r=Ot.GLYPHS[n];new xt(r.code,s).render(t,e+r.x_shift,i+r.y_shift)}class Ot extends he{static get GLYPHS(){return{pedal_depress:{code:"v36",x_shift:-10,y_shift:0},pedal_release:{code:"v5d",x_shift:-2,y_shift:3}}}static get Styles(){return{TEXT:1,BRACKET:2,MIXED:3,MIXED_OPEN_END:4,BRACKET_OPEN_BEGIN:5,BRACKET_OPEN_END:6,BRACKET_OPEN_BOTH:7}}static get StylesString(){return{text:Ot.Styles.TEXT,bracket:Ot.Styles.BRACKET,mixed:Ot.Styles.MIXED,mixed_open_end:Ot.Styles.MIXED_OPEN_END,bracket_open_begin:Ot.Styles.BRACKET_OPEN_BEGIN,bracket_open_end:Ot.Styles.BRACKET_OPEN_END,bracket_open_both:Ot.Styles.BRACKET_OPEN_BOTH}}static createSustain(t){return new Ot(t)}static createSostenuto(t){const e=new Ot(t);return e.setStyle(Ot.Styles.MIXED),e.setCustomText("Sost. Ped."),e}static createUnaCorda(t){const e=new Ot(t);return e.setStyle(Ot.Styles.TEXT),e.setCustomText("una corda","tre corda"),e}constructor(t){super(),this.setAttribute("type","PedalMarking"),this.EndsStave=!1,this.ChangeBegin=!1,this.ChangeEnd=!1,this.notes=t,this.style=Ot.TEXT,this.line=0,this.custom_depress_text="",this.custom_release_text="",this.font={family:"Times New Roman",size:12,weight:"italic bold"},this.render_options={bracket_height:10,text_margin_right:6,bracket_line_width:1,glyph_point_size:40,color:"black"}}setEndStave(t){if(this.endStave=t,this.endStaveAddedWidth=0,this.startMargin=0,this.endMargin=0,Array.isArray(this.endStave.modifiers))for(let e=0;e<this.endStave.modifiers.length;e++){let i=this.endStave.modifiers[e];i&&i.position===Vt.Position.END&&i.width&&(this.endStaveAddedWidth+=i.width)}}setCustomText(t,e){return this.custom_depress_text=t||"",this.custom_release_text=e||"",this}setStyle(t){if(t<1&&t>3)throw new M.RERR("InvalidParameter","The style must be one found in PedalMarking.Styles");return this.style=t,this}setLine(t){return this.line=t,this}drawBracketed(){const t=this.context;let e=!1,i,s;const r=this;this.notes.forEach((o,a,l)=>{e=!e;let h=0;if(o?h=o.getNoteHeadBeginX():h=this.endStave.end_x+this.endStaveAddedWidth,this.EndsStave)e?this.ChangeBegin&&(h=o.getAbsoluteX()):(o?this.ChangeEnd?h=o.getAbsoluteX():h=o.getStave().end_x+this.endStaveAddedWidth-r.render_options.text_margin_right:h=this.endStave.end_x+this.endStaveAddedWidth-r.render_options.text_margin_right,this.endMargin=-r.render_options.text_margin_right);else if(o)if(e)this.ChangeBegin&&(h=o.getAbsoluteX());else switch(r.style){case Ot.Styles.BRACKET_OPEN_END:case Ot.Styles.BRACKET_OPEN_BOTH:case Ot.Styles.MIXED_OPEN_END:h=o.getNoteHeadEndX();break;default:this.ChangeEnd?h=o.getAbsoluteX():(h=o.getNoteHeadBeginX()-r.render_options.text_margin_right,this.startMargin=-r.render_options.text_margin_right);break}let c=this.endStave;o&&(c=o.getStave());let u=c.getYForBottomText(r.line+3);s&&s>u&&(u=s);const f=l[a+1]===o,d=l[a-1]===o;let p=0;if(e)if(p=d?5:0,(r.style===Ot.Styles.MIXED||r.style===Ot.Styles.MIXED_OPEN_END)&&!d)if(r.custom_depress_text){const g=t.measureText(r.custom_depress_text).width;t.fillText(r.custom_depress_text,h-g/2,u),p=g/2+r.render_options.text_margin_right}else pr("pedal_depress",t,h,u,r.render_options.glyph_point_size),p=20+r.render_options.text_margin_right;else t.beginPath(),r.style===Ot.Styles.BRACKET_OPEN_BEGIN||r.style===Ot.Styles.BRACKET_OPEN_BOTH?t.moveTo(h+p,u):(this.ChangeBegin&&(h+=5),t.moveTo(h,u-r.render_options.bracket_height),this.ChangeBegin&&(h+=5),t.lineTo(h+p,u)),t.stroke(),t.closePath();else p=f&&!this.EndsStave?-5:0,t.beginPath(),t.moveTo(i,s),t.lineTo(h+p,u),r.style!==Ot.Styles.BRACKET_OPEN_END&&r.style!==Ot.Styles.MIXED_OPEN_END&&r.style!==Ot.Styles.BRACKET_OPEN_BOTH&&(this.ChangeEnd&&(h+=5),t.lineTo(h,u-r.render_options.bracket_height)),t.stroke(),t.closePath();i=h+p,s=u})}drawText(){const t=this.context;let e=!1;const i=this,s=i.render_options.glyph_point_size;this.notes.forEach(r=>{e=!e;const o=r.getStave(),a=r.getAbsoluteX(),l=o.getYForBottomText(i.line+3);let h=0;e?i.custom_depress_text?(h=t.measureText(i.custom_depress_text).width,t.fillText(i.custom_depress_text,a-h/2,l)):pr("pedal_depress",t,a,l,s):i.custom_release_text?(h=t.measureText(i.custom_release_text).width,t.fillText(i.custom_release_text,a-h/2,l)):pr("pedal_release",t,a,l,s)})}draw(){const t=this.checkContext();this.setRendered(),t.save(),t.setStrokeStyle(this.render_options.color),t.setFillStyle(this.render_options.color),t.setFont(this.font.family,this.font.size,this.font.weight),Tc("Rendering Pedal Marking"),this.style===Ot.Styles.BRACKET||this.style===Ot.Styles.MIXED||this.style===Ot.Styles.MIXED_OPEN_END||this.style===Ot.Styles.BRACKET_OPEN_BEGIN||this.style===Ot.Styles.BRACKET_OPEN_END||this.style===Ot.Styles.BRACKET_OPEN_BOTH?(t.setLineWidth(this.render_options.bracket_line_width),this.drawBracketed()):this.style===Ot.Styles.TEXT&&this.drawText(),t.restore()}}function Cc(...n){Ze.DEBUG&&M.L("Vex.Flow.TextBracket",n)}class Ze extends he{static get Positions(){return{TOP:1,BOTTOM:-1}}static get PositionString(){return{top:Ze.Positions.TOP,bottom:Ze.Positions.BOTTOM}}constructor({start:t,stop:e,text:i="",superscript:s="",position:r=Ze.Positions.TOP}){super(),this.setAttribute("type","TextBracket"),this.start=t,this.stop=e,this.text=i,this.superscript=s,this.position=typeof r=="string"?Ze.PositionString[r]:r,this.line=1,this.font={family:"Serif",size:15,weight:"italic"},this.render_options={dashed:!0,dash:[5],color:"black",line_width:1,show_bracket:!0,bracket_height:8,underline_superscript:!0}}applyStyle(t){return t.setFont(this.font.family,this.font.size,this.font.weight),t.setStrokeStyle(this.render_options.color),t.setFillStyle(this.render_options.color),t.setLineWidth(this.render_options.line_width),this}setDashed(t,e){return this.render_options.dashed=t,e&&(this.render_options.dash=e),this}setFont(t){return this.font=be(be({},this.font),t),this}setLine(t){return this.line=t,this}draw(){const t=this.context;this.setRendered();let e=0;switch(this.position){case Ze.Positions.TOP:e=this.start.getStave().getYForTopText(this.line);break;case Ze.Positions.BOTTOM:e=this.start.getStave().getYForBottomText(this.line+V.TEXT_HEIGHT_OFFSET_HACK);break;default:throw new M.RERR("InvalidPosition",`The position ${this.position} is invalid`)}const i={x:this.start.getAbsoluteX(),y:e},s={x:this.stop.getAbsoluteX(),y:e};Cc("Rendering TextBracket: start:",i,"stop:",s,"y:",e);const r=this.render_options.bracket_height*this.position;t.save(),this.applyStyle(t),t.fillText(this.text,i.x,i.y);const o=t.measureText(this.text).width,a=t.measureText("M").width,l=i.y-a/2.5;t.setFont(this.font.family,this.font.size/1.4,this.font.weight),t.fillText(this.superscript,i.x+o+1,l);const h=t.measureText(this.superscript).width,c=t.measureText("M").width;let u=i.x,f=l;const d=s.x+this.stop.getGlyph().getWidth();this.position===Ze.Positions.TOP?(u+=o+h+5,f-=c/2.7):this.position===Ze.Positions.BOTTOM&&(f+=c/2.7,u+=o+2,this.render_options.underline_superscript||(u+=h)),this.render_options.dashed?(Zt.drawDashedLine(t,u,f,d,f,this.render_options.dash),this.render_options.show_bracket&&Zt.drawDashedLine(t,d,f+1*this.position,d,f+r,this.render_options.dash)):(t.beginPath(),t.moveTo(u,f),t.lineTo(d,f),this.render_options.show_bracket&&t.lineTo(d,f+r),t.stroke(),t.closePath()),t.restore()}}function Rc(...n){po.DEBUG&&M.L("Vex.Flow.BarNote",n)}class po extends Ie{constructor(t=Xt.type.SINGLE){super({duration:"b"}),this.setAttribute("type","BarNote"),this.metrics={widths:{}};const e=Xt.type;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.ignore_ticks=!0,this.setType(t)}getType(){return this.type}setType(t){return this.type=typeof t=="string"?Xt.typeString[t]:t,this.setWidth(this.metrics.widths[this.type]),this}getBoundingBox(){return super.getBoundingBox()}addToModifierContext(){return this}preFormat(){return this.setPreFormatted(!0),this}draw(){if(this.checkContext(),!this.stave)throw new M.RERR("NoStave","Can't draw without a stave.");Rc("Rendering bar line at: ",this.getAbsoluteX());const t=new Xt(this.type);t.setX(this.getAbsoluteX()),t.draw(this.stave),this.setRendered()}}class Fa extends oo{constructor(t){if(!t)throw new M.RuntimeError("BadArguments","Ghost note must have valid initialization data to identify duration.");let e;if(typeof t=="string")e={duration:t};else if(typeof t=="object")e=t;else throw new M.RuntimeError("BadArguments","Ghost note must have valid initialization data to identify duration.");super(e),this.setAttribute("type","GhostNote"),this.setWidth(0)}isRest(){return!0}setStave(t){super.setStave(t)}addToModifierContext(){return this}preFormat(){return this.setPreFormatted(!0),this}draw(){if(!this.stave)throw new M.RERR("NoStave","Can't draw without a stave.");this.setRendered();for(let t=0;t<this.modifiers.length;++t){const e=this.modifiers[t];e.setContext(this.context),e.drawWithStyle()}}}class Zi extends St{static get CATEGORY(){return"tremolo"}static get YOFFSETSTEMUP(){return-9}static get YOFFSETSTEMDOWN(){return-21}static get XOFFSETSTEMUP(){return 6}static get XOFFSETSTEMDOWN(){return-2}constructor(t,e){super(),this.setAttribute("type","Tremolo"),this.num=t,this.note=null,this.index=null,this.position=St.Position.CENTER,this.code="v74",this.y_spacing_scale=1,this.extra_stroke_scale=1,this.noteTremoloList=[],e&&Array.isArray(e)&&(this.noteTremoloList=e)}getCategory(){return Zi.CATEGORY}getShift_x(){let t=0;if(this.noteTremoloList.length===2)try{t=this.noteTremoloList[0].formatterMetrics.freedom.right/1.5,t=isNaN(t)?0:-t}catch{}return t}draw(){if(this.checkContext(),!(this.note&&this.index!=null))throw new M.RERR("NoAttachedNote","Can't draw Tremolo without a note and index.");this.setRendered();const t=this.note.getStemDirection();this.y_spacing=4*t*this.y_spacing_scale;let i=this.note.getModifierStartXY(this.position,this.index).x,s=this.note.stem.getExtents().topY,r=this.note.getCategory()==="gracenotes"?ts.SCALE:1;r*=this.extra_stroke_scale,t<0?s+=Zi.YOFFSETSTEMDOWN*r:s+=Zi.YOFFSETSTEMUP*r,this.font={family:"Arial",size:16*r,weight:""},this.render_options={font_scale:35*r,stroke_px:3,stroke_spacing:10*r},i+=t<0?Zi.XOFFSETSTEMDOWN:Zi.XOFFSETSTEMUP,i+=this.getShift_x();for(let a=0;a<this.num;++a)xt.renderGlyph(this.context,i,s,this.render_options.font_scale,this.code),s+=this.y_spacing}}function Nc(...n){Oa.DEBUG&&M.L("Vex.Flow.Crescendo",n)}function Ac(n,t){const e=t.begin_x,i=t.end_x,s=t.y,r=t.height/2;n.beginPath(),t.reverse?(n.moveTo(e,s-r),n.lineTo(i,s),n.lineTo(e,s+r)):(n.moveTo(i,s-r),n.lineTo(e,s),n.lineTo(i,s+r)),n.stroke(),n.closePath()}class Oa extends Ie{constructor(t){super(t),this.setAttribute("type","Crescendo"),this.decrescendo=!1,this.line=t.line||0,this.height=15,M.Merge(this.render_options,{extend_left:0,extend_right:0,y_shift:0})}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(){this.checkContext(),this.setRendered();const t=this.getTickContext(),e=xs.getNextContext(t),i=this.getAbsoluteX(),s=e?e.getX():this.stave.x+this.stave.width,r=this.stave.getYForLine(this.line+-3)+1;Nc("Drawing ",this.decrescendo?"decrescendo ":"crescendo ",this.height,"x",i-s),Ac(this.context,{begin_x:i-this.render_options.extend_left,end_x:s+this.render_options.extend_right,y:r+this.render_options.y_shift,height:this.height,reverse:this.decrescendo})}}function Ic(...n){mo.DEBUG&&M.L("Vex.Flow.Parser",n)}const Jo=M.MakeException("ParserError");function Sn(n){return n.matchedString!==void 0?n.matchedString:n.results?Sn(n.results):n.length===1?Sn(n[0]):n.length===0?null:n.map(Sn)}class mo{constructor(t){this.grammar=t}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){this.errorPos===-1&&(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*)"),r=this.line.slice(this.pos).match(i);return r!==null?{success:!0,matchedString:r[2],incrementPos:r[1].length,pos:this.pos}:{success:!1,pos:this.pos}}expectOne(t,e=!1){const i=[],s=this.pos;let r=!0,o=!1;e=e===!0||t.maybe===!0;for(let h=0;h<t.expect.length;h++){const c=t.expect[h],u=this.pos,f=this.expect(c);if(f.success){if(i.push(f),o=!0,t.or)break}else if(r=!1,!t.or){this.pos=u;break}}const a=t.or&&o||r,l=a||e===!0;return e&&!a&&(this.pos=s),l?this.matchSuccess():this.matchFail(s),{success:l,results:i,numMatches:a?1:0}}expectOneOrMore(t,e=!1){const i=[],s=this.pos;let r=0,o=!0;do{const l=this.expectOne(t);l.success?(r++,i.push(l.results)):o=!1}while(o);const a=r>0||e===!0;return e&&!(r>0)&&(this.pos=s),a?this.matchSuccess():this.matchFail(s),{success:a,results:i,numMatches:r}}expectZeroOrMore(t){return this.expectOneOrMore(t,!0)}expect(t){Ic("Evaluating rules:",t);let e;if(!t)throw new Jo("Invalid Rule: "+t,t);const i=t.bind(this.grammar)();if(i.token)e=this.matchToken(i.token,i.noSpace===!0),e.success&&(this.pos+=e.incrementPos);else if(i.expect)i.oneOrMore?e=this.expectOneOrMore(i):i.zeroOrMore?e=this.expectZeroOrMore(i):e=this.expectOne(i);else throw new Jo("Bad grammar! No `token` or `expect` property",i);return e.matches=[],e.results&&e.results.forEach(s=>e.matches.push(Sn(s))),i.run&&e.success&&i.run(e),e}}function di(...n){go.DEBUG&&M.L("Vex.Flow.EasyScore",n)}const kc=M.MakeException("EasyScoreError");class Bc{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=>this.builder.addSingleNote(t.matches[0],t.matches[1],t.matches[2])}}ACCIDENTAL(){return{expect:[this.ACCIDENTALS],maybe:!0}}DOTS(){return{expect:[this.DOT],zeroOrMore:!0,run:t=>this.builder.setNoteDots(t.matches[0])}}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(){const t=e=>e.slice(1,-1);return{expect:[this.KEY,this.EQUALS,this.VAL],run:e=>this.builder.addNoteOption(e.matches[0],t(e.matches[2]))}}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:"bbs|bb|bss|bs|b|db|d|##|#|n|\\+\\+-|\\+-|\\+\\+|\\+|k|o"}}DURATIONS(){return{token:"[0-9whq]+"}}TYPES(){return{token:"[rRsSxX]"}}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 Dc{constructor(t){this.factory=t,this.commitHooks=[],this.reset()}reset(t={}){this.options={stem:"auto",clef:"treble"},this.elements={notes:[],accidentals:[]},this.rollingDuration="8",this.resetPiece(),Object.assign(this.options,t)}getFactory(){return this.factory}getElements(){return this.elements}addCommitHook(t){this.commitHooks.push(t)}resetPiece(){di("resetPiece"),this.piece={chord:[],duration:this.rollingDuration,dots:0,type:void 0,options:{}}}setNoteDots(t){di("setNoteDots:",t),t&&(this.piece.dots=t.length)}setNoteDuration(t){di("setNoteDuration:",t),this.rollingDuration=this.piece.duration=t||this.rollingDuration}setNoteType(t){di("setNoteType:",t),t&&(this.piece.type=t)}addNoteOption(t,e){di("addNoteOption: key:",t,"value:",e),this.piece.options[t]=e}addNote(t,e,i){di("addNote:",t,e,i),this.piece.chord.push({key:t,accid:e,octave:i})}addSingleNote(t,e,i){di("addSingleNote:",t,e,i),this.addNote(t,e,i)}addChord(t){di("startChord"),typeof t[0]!="object"?this.addSingleNote(t[0]):t.forEach(e=>{e&&this.addNote(...e)}),di("endChord")}commitPiece(){di("commitPiece");const{factory:t}=this;if(!t)return;const e=be(be({},this.options),this.piece.options),{stem:i,clef:s}=e,r=i.toLowerCase()==="auto",o=!r&&i.toLowerCase()==="up"?ae.STEM_UP:ae.STEM_DOWN,{chord:a,duration:l,dots:h,type:c}=this.piece,u=a.map(p=>p.key+"/"+p.octave),f=t.StaveNote({keys:u,duration:l,dots:h,type:c,clef:s,auto_stem:r});r||f.setStemDirection(o);const d=a.map(p=>p.accid||null);d.forEach((p,g)=>{p&&f.addAccidental(g,t.Accidental({type:p}))});for(let p=0;p<h;p++)f.addDotToAll();this.commitHooks.forEach(p=>p(e,f,this)),this.elements.notes.push(f),this.elements.accidentals.concat(d),this.resetPiece()}}function Fc({id:n},t){n!==void 0&&t.setAttribute("id",n)}function Oc(n,t){if(!n.class)return;const e=/\s*,\s*/;n.class.split(e).forEach(i=>t.addClass(i))}class go{constructor(t={}){this.setOptions(t),this.defaults={clef:"treble",time:"4/4",stem:"auto"}}set(t){return Object.assign(this.defaults,t),this}setOptions(t){return this.options=be({factory:null,builder:null,commitHooks:[Fc,Oc,Ri.easyScoreHook],throwOnError:!1},t),this.factory=this.options.factory,this.builder=this.options.builder||new Dc(this.factory),this.grammar=new Bc(this.builder),this.parser=new mo(this.grammar),this.options.commitHooks.forEach(e=>this.addCommitHook(e)),this}setContext(t){return this.factory&&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 new kc("Error parsing line: "+t,i);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=be({clef:this.defaults.clef,stem:this.defaults.stem},e),this.parse(t,e),this.builder.getElements().notes}voice(t,e){return e=be({time:this.defaults.time},e),this.factory.Voice(e).addTickables(t)}addCommitHook(t){return this.builder.addCommitHook(t)}}function cs(){return{notes:[],finish:!1,total:0,staveId:""}}let Nn=null,ds="C",Be=cs(),gn="",ls="",De="";class ai extends ae{static get CATEGORY(){return"numberednotes"}static accidentalAndKey(t){switch(t){case"G":return{"4":"#"};case"D":return{"1":"#","4":"#"};case"A":return{"1":"#","4":"#","5":"#"};case"E":return{"1":"#","2":"#","4":"#","5":"#"};case"B":return{"1":"#","2":"#","4":"#","5":"#","6":"#"};case"F#":return{"1":"#","2":"#","3":"#","4":"#","5":"#","6":"#"};case"C#":return{"1":"#","2":"#","3":"#","4":"#","5":"#","6":"#","7":"#"};case"F":return{"7":"b"};case"Bb":return{"7":"b","3":"b"};case"Eb":return{"7":"b","3":"b","6":"b"};case"Ab":return{"7":"b","2":"b","3":"b","6":"b"};case"Db":return{"7":"b","2":"b","3":"b","5":"b","6":"b"};case"Gb":return{"7":"b","1":"b","2":"b","3":"b","5":"b","6":"b"};case"Cb":return{"7":"b","1":"b","2":"b","3":"b","4":"b","5":"b","6":"b"};default:return{}}}static accidentalMap(t){switch(t){case"C":return"";case"F":case"Bb":case"Eb":case"Ab":case"Db":case"Gb":case"Cb":return{bb:"b",b:"",n:"#","#":"##"};default:return{b:"bb",n:"b","#":"","##":"#"}}}static get noteLift(){switch(ds){case"G":return["7"];case"D":return["7","3"];case"A":return["7","3","6"];case"E":return["2","6","3","7"];case"B":return["5","2","6","3","7"];case"F#":return["1","5","2","6","3","7"];case"C#":return["4","1","5","2","6","3","7"];case"F":return["4"];case"Bb":return["1","4"];case"Eb":return["5","1","4"];case"Ab":return["2","5","1","4"];case"Db":return["6","2","5","1","4"];case"Gb":return["3","6","2","5","1","4"];case"Cb":return["7","3","6","2","5","1","4"]}}static get longDurationLine(){return{"1":3,"2":1,"6":2}}static get numberedDurationLine(){return{"8":1,"16":2,"32":3,"64":4,"128":5}}static get durationTime(){return{8:6144,4:4096}}constructor(t){super(t),this.setAttribute("type","NumberedNote"),ds=t.keyString,this.ornament=!!t.ornament,this.line=0,this.keys=t.keys||[],this.fontSize=20,this.offset_x=0,this.offset_y=0,this.note_tones=[],this.duration_lines=0,this.long_duration_lines=0,this.note_size=t.note_size||16;const e=V.sanitizeDuration(this.duration);var i=ai.numberedDurationLine[e.toString()];if(i&&(this.duration_lines=i),i=ai.longDurationLine[e.toString()],i&&(this.long_duration_lines=i),!Nn){var s="__$text_wraper$$__";let o=document.createElement("canvas");o.id=s,document.body.append(o);const a=document.getElementById(s),l=a.getContext("2d");l.font="Arial 22px";var r=l.measureText("5");Nn=r.width+2,document.body.removeChild(a)}}getCategory(){return ai.CATEGORY}setKeySignature(t){this.keySignature=t}preFormat(){this.preFormatted||(this.modifierContext&&this.modifierContext.preFormat(),this.setWidth(this.full_width),this.setPreFormatted(!0))}filterNote(){if(window&&window.sett&&window.sett.keySignature||!this.keys||!this.keys.length)return;const t=ai.accidentalMap(ds);if(!t)return;const e=ai.noteLift;if(!e)return;var i=this.keys[0].split("/"),s=i[0];s==="b"&&(s="R"),s=s.replaceAll("#",""),s=s.replaceAll("n",""),s.length>1&&(s=s.replaceAll("b",""));const r=Fi.numberedNotationMapping[s.toUpperCase()];if(e.includes(r))for(let o=0;o<this.modifiers.length;o++){const a=this.modifiers[o];if(a.getAttribute("type")==="Accidental"&&a.accidental){const l=t[a.type];l?a.accidental=V.accidentalCodes(l):this.modifiers.splice(o,1)}}}preFormatModifier(){let t=0,e=0;this.filterNote(),this.modifiers.forEach((i,s)=>{switch(i.getAttribute("type")){case"Accidental":i.render_options.font_scale=this.note_width*1.4,i.x_shift=2,i.y_shift=this.unit_height/2,this.ornament&&(i.render_options.font_scale=this.note_width,i.x_shift=14,i.y_shift=-10);break;case"Stroke":i.x_shift=-1*t,i.y_shift=1*this.unit_height;break;case"Dot":i.x_shift=e*this.duration_dot_width+7,i.y_shift=1*this.unit_height,e++;break;case"Ornament":i.y_shift=-3;break;default:i.y_shift=1*this.unit_height}i.reset&&i.reset(),t+=i.getWidth()/2})}handleDeleteDot(){for(let t=0;t<this.modifiers.length;t++)this.modifiers[t].attrs.type=="Dot"&&this.modifiers.splice(t,1)}calcGroup(){if(Be.staveId!=this.stave.attrs.id&&(this.drawDurationLoneLine(),Be=cs()),this.stave.timeSignature.denominator&&(gn=this.stave.timeSignature.denominator,ls=this.stave.timeSignature.numerator),!gn||!ls)return;let t=ai.durationTime[gn],e=this.formatterMetrics.duration.split("/").filter(o=>o),i=e.length?e[0]/e[1]:0;if(this.ornament)return;if(i===0)return this.long_duration_lines=this.intrinsicTicks/t-1,this.long_duration_lines>=ls&&(this.long_duration_lines=ls-1),gn==8&&(this.long_duration_lines=0,ls==3&&this.draw_dot(this.context,this.bottom_x+25,this.bottom_y-30,this.dot_width),ls==6&&(this.draw_dot(this.context,this.bottom_x+25,this.bottom_y-30,this.dot_width),new xt("v0",40).render(this.context,this.bottom_x+40,this.top_y),this.draw_dot(this.context,this.bottom_x+65,this.bottom_y-30,this.dot_width))),Be=cs();let s={lines:this.duration_lines,duration:i,id:this.attrs.id,x:this.x-this.duration_line_space/2-this.left_width,y:this.y,width:this.full_width};i>t*2&&(this.long_duration_lines=parseInt(i/t)-1,this.handleDeleteDot()),De&&(s.x+=this.note_width),Be.notes.push(s);let r=Be.notes.reduce((o,a)=>o+a.duration,0);r=parseInt(r),r>t&&(r-=t),r>t-10&&r<t+10&&(Be.finish=!0,Be.notes.length===1&&(Be=cs()),Be.notes.filter(a=>a.lines===0).length&&(this.drawDurationLoneLine(),Be=cs()))}draw(){if(this.checkContext(),!this.stave)throw new M.RERR("NoStave","Can't draw without a stave.");let t=this.context;t.save(),t.setFont("Arial",this.note_height,"normal"),this.setAttribute("el",t.openGroup("stavenote",this.getAttribute("id"))),t.openGroup("note",null,{pointerBBox:!0});let e=this.getAbsoluteX()+2.5;this.x=e;let i=this.stave.getYForLine(2)+this.note_height/2;this.y=i,this.buildToneHeads(),this.preFormatModifier(),this.applyStyle(),this.note_tones.forEach(s=>{s.draw(t)}),t.openGroup("modifier",null,{pointerBBox:!0}),this.drawModifiers(),t.closeGroup(),t.closeGroup(),t.closeGroup(),this.calcGroup(),Be.staveId=this.stave.attrs.id,this.drawDurationLine(t,{}),this.drawLongDurationLines(t),this.restoreStyle(),this.setRendered(),this.ornament?De?De=Object.assign(De,{lines:this.duration_lines,id:this.attrs.id,x:this.x-this.duration_line_space/2-this.left_width,width:this.full_width}):De={lines:this.duration_lines,id:this.attrs.id,x:this.x-this.duration_line_space/2-this.left_width,width:this.full_width}:De=""}drawDurationLoneLine(t,e){t=t||this.context;let i=e||this.y+this.duration_line_space;for(let s=0;s<5;s++){let r=[],o=0;for(let a=0;a<Be.notes.length;a++){let l=Be.notes[a];if(o==a&&l.lines>s)r.push(l),o++;else{if(r.length>1){let h=r.length-1;i=r[0].y+this.duration_line_space,t.rect(r[0].x,i+s*3,r[h].x-r[0].x+r[h].width,.5)}r=[],o=a+1}}if(r.length>1){let a=r.length-1;i=r[0].y+this.duration_line_space,t.rect(r[0].x,i+s*3,r[a].x-r[0].x+r[a].width,.5)}}}draw_dot(t,e,i,s){t.openGroup("numbered-note-dot"),t.beginPath(),t.arc(e,i,s,0,2*Math.PI),t.closePath(),t.fill(),t.closeGroup()}drawDurationLine(t,e){var i=this.attrs.id+"-lines";t.openGroup("numbered_note_lines",i);var s,r;if(this.duration_lines>0){const l=this.duration_line_space;var o=this.full_width;if(e&&e.width&&(o=e.width),o<0&&(o=this.note_width),!e||typeof e.startX=="undefined"?s=this.x-l/2-this.left_width:s=e.startX,!e||typeof e.startY=="undefined"?r=this.y+this.duration_line_space:r=e.startY,Be.finish&&(this.drawDurationLoneLine(t,r),Be=cs()),this.ornament?(s+=12,r-=22,o=15,De&&(s-=10,o+=10)):De&&(s+=this.note_width,o-=this.note_width),o>0){for(var a=0;a<this.duration_lines;a++)t.rect(s,r,o,.5),r+=3;this.ornament&&(De?(De.startX=s,De.startY=r):De={startX:s,startY:r})}}!this.ornament&&De&&(s=De.startX,r=De.startY,s+=5,r-=3,t.beginPath(),t.moveTo(s,r),t.lineTo(s,r+5),t.lineTo(s+5,r+5),t.stroke()),t.closeGroup()}removeDurationLines(){var t="vf-"+this.attrs.id+"-lines",e=document.getElementById(t);e&&e.remove()}drawLongDurationLines(t){let e=this.x+this.note_width+this.right_width+10;for(let i=1;i<=this.long_duration_lines;i++)t.fillRect(e+2,this.y-this.full_height/2,this.long_duration_width,2),e+=this.long_duration_space+this.long_duration_width}setStave(t){return super.setStave(t),this}buildToneHeads(){this.offset_x=this.x,this.offset_y=this.y;let t=[];this.note_tones=[];for(let e=0;e<this.keys.length;e++){const i=new Fi({key:this.keys[e],x:this.ornament?this.note_x+12:this.note_x,y:this.ornament?this.offset_y-this.note_height:this.offset_y,idx:e,note:this});this.offset_y-=i.height+this.head_space,this.note_tones.push(i),t.push(this.offset_y);try{if(e===0&&window&&window.sett&&window.sett.keySignature){const s=ai.accidentalAndKey(ds)[i.meta.key],r=this.modifiers.find(a=>a.getAttribute("type")==="Accidental"),o=this.modifiers.findIndex(a=>a.getAttribute("type")==="Accidental");s&&o>-1?this.modifiers[o].accidental.code=s==="#"?"v18":"v44":this.modifiers.splice(o,1)}}catch(s){console.log("\u{1F680} ~ error",s)}}this.setYs(t)}getFullWidth(){return this.full_width}getFullHeight(){return this.full_height}getLine(){return this.keyProps[0].line}get full_width(){return this.note_width+this.left_width+this.right_width+this.long_duration_line_width}get long_duration_line_width(){return(this.long_duration_width+this.long_duration_space)*this.long_duration_lines}get full_height(){return this.bottom_y-this.top_y}get note_width(){return this.note_size||0}get note_dot_width(){return 6}get note_height(){return this.unit_height}get unit_height(){return this.note_size||0}get note_x(){return this.x||0}get top_x(){return this.x||0}get top_y(){var t=this;return(this.y||0)-(t.note_tones.map(i=>(i.td+i.bd)*(t.dot_space+t.dot_width)).reduce((i,s)=>i+s,0)+this.note_height*this.note_tones.length-this.unit_height-this.note_tones[0].bd*(t.dot_space+t.dot_width)+(this.note_tones.length-1)*this.head_space)}get bottom_x(){return this.x||0}get bottom_y(){return(this.y||0)+this.unit_height+this.duration_lines*(this.duration_line_height+this.duration_line_space)+this.note_tones[0].meta.bd*(this.dot_width+this.dot_space)}get left_width(){return this.modifiers_width}get right_width(){return this.full_duration_dot_width}get duration_dot_width(){return 6}get full_duration_dot_width(){return this.duration_dot_width*this.getModifiersByCategory(Gi.CATEGORY).length}getModifiersByCategory(t){var e=[];return this.modifiers.forEach(i=>{i.getCategory()===t&&e.push(i)}),e}get head_space(){return 6}get duration_line_height(){return 2}get duration_line_space(){return 4}get dot_width(){return 2}get dot_space(){return 2}get long_duration_space(){return 10}get long_duration_width(){return 20}getWidth(){return this.full_width}get modifiers_width(){let t=0;return this.modifiers.forEach(e=>{t+=e.getWidth()}),t}}class Fi{static get numberedNotationMapping(){let t=ds;switch(window&&window.sett&&window.sett.keySignature&&(t="C"),t){case"A":return{C:"3",D:"4",E:"5",F:"6",G:"7",A:"1",B:"2",R:"0",min:2.5,max:5.5};case"B":return{C:"2",D:"3",E:"4",F:"5",G:"6",A:"7",B:"1",R:"0",min:-.5,max:2.5};case"D":return{C:"7",D:"1",E:"2",F:"3",G:"4",A:"5",B:"6",R:"0",min:.5,max:3.5};case"E":return{C:"6",D:"7",E:"1",F:"2",G:"3",A:"4",B:"5",R:"0",min:1,max:4};case"F":return{C:"5",D:"6",E:"7",F:"1",G:"2",A:"3",B:"4",R:"0",min:1.5,max:4.5};case"G":case"Gb":return{C:"4",D:"5",E:"6",F:"7",G:"1",A:"2",B:"3",R:"0",min:2,max:5};case"Eb":return{C:"6",D:"7",E:"1",F:"2",G:"3",A:"4",B:"5",R:"0",min:1,max:4};case"D#":case"Db":return{C:"7",D:"1",E:"2",F:"3",G:"4",A:"5",B:"6",R:"0",min:.5,max:3.5};case"F#":return{C:"5",D:"6",E:"7",F:"1",G:"2",A:"3",B:"4",R:"0",min:1.5,max:4.5};case"Ab":case"G#":return{C:"3",D:"4",E:"5",F:"6",G:"7",A:"1",B:"2",R:"0",min:-1,max:2};case"Bb":case"A#":return{C:"2",D:"3",E:"4",F:"5",G:"6",A:"7",B:"1",R:"0",min:-.5,max:2.5};case"C#":case"Cb":default:return{C:"1",D:"2",E:"3",F:"4",G:"5",A:"6",B:"7",R:"0",min:0,max:3}}}tone_to_numbered_key(){var t=this.key.split("/"),e=t[0];e==="b"&&(e="R"),e=e.replaceAll("#",""),e=e.replaceAll("n",""),e.length>1&&(e=e.replaceAll("b",""));let i=0,s=0;this.note.stave&&this.note.stave.options&&this.note.stave.options.keySignature&&(ds=this.note.stave.options.keySignature);const r=this.note.getLine();return r<Fi.numberedNotationMapping.min&&(i=Math.ceil(Math.abs((r-Fi.numberedNotationMapping.min)/3.5))),r>Fi.numberedNotationMapping.max&&(s=Math.ceil((r-Fi.numberedNotationMapping.max)/3.5)),e.toUpperCase()==="R"&&(i=0,s=0),{key:Fi.numberedNotationMapping[e.toUpperCase()],td:s,bd:i}}constructor(t){this.key=t.key,this.x=t.x||0,this.y=t.y||0,this.idx=t.idx||0,this.note=t.note||0,this.meta=this.tone_to_numbered_key(),this.noteSize=t.noteSize||16,this.td=this.meta.td,this.bd=this.meta.bd}draw(t){let e=this.y;t.openGroup("numbered-note-head");var i=this.x+(this.note.ornament?-2:0);let s=e-this.note.unit_height-this.note.dot_space-(this.note.ornament?-4:2);for(let o=0;o<this.meta.td;o++)this.draw_dot(t,i+Nn-1,s,this.note.dot_width),s-=this.note.dot_width+this.note.dot_space+4;new xt("v"+this.meta.key,this.note.ornament?30:40).render(t,i+1,e),e+=this.note.dot_space+this.note.dot_width-(this.note.ornament?2:0);for(let o=0;o<this.meta.bd;o++){if(this.idx===0){let a=this.note.duration_lines*(this.note.duration_line_height+this.note.duration_line_space);this.note.duration_lines>1&&(a-=this.note.duration_line_space),e+=a}this.draw_dot(t,i+Nn,e,this.note.dot_width),e+=this.note.dot_width+this.note.dot_space}t.closeGroup()}get height(){return this.note.note_height+(this.meta.bd+this.meta.td)*(this.note.dot_width+this.note.dot_space)}draw_dot(t,e,i,s){t.openGroup("numbered-note-dot"),t.beginPath(),t.arc(e,i,s,0,2*Math.PI),t.closePath(),t.fill(),t.closeGroup()}}function Vc(...n){rn.DEBUG&&M.L("Vex.Flow.Factory",n)}const Gc=M.MakeException("FactoryError");function fe(n={},t){const e=t.options;return n=Object.assign(t,n),n.options=Object.assign(e,n.options),n}class rn{constructor(t){Vc("New factory: ",t);const e={stave:{space:10},renderer:{context:null,elementId:"",backend:Zt.Backends.SVG,width:500,height:200,background:"#FFF"},font:{face:"Arial",point:10,style:""}};this.options=e,this.setOptions(t)}static newFromElementId(t,e=500,i=200){return new rn({renderer:{elementId:t,width:e,height:i}})}reset(){this.renderQ=[],this.systems=[],this.staves=[],this.voices=[],this.stave=null}getOptions(){return this.options}setOptions(t){for(const e of["stave","renderer","font"])Object.assign(this.options[e],t[e]);(this.options.renderer.elementId!==null||this.options.renderer.context)&&this.initRenderer(),this.reset()}initRenderer(){const{elementId:t,backend:e,width:i,height:s,background:r}=this.options.renderer;if(t==="")throw new Gc("HTML DOM element not set in Factory");this.context=Zt.buildContext(t,e,i,s,r)}getContext(){return this.context}setContext(t){return this.context=t,this}getStave(){return this.stave}getVoices(){return this.voices}space(t){return this.options.stave.space*t}Stave(t){t=fe(t,{x:0,y:0,width:this.options.renderer.width-this.space(1),options:{spacing_between_lines_px:this.options.stave.space}});const e=new sn(t.x,t.y,t.width,t.options);return this.staves.push(e),e.setContext(this.context),this.stave=e,e}TabStave(t){t=fe(t,{x:0,y:0,width:this.options.renderer.width-this.space(1),options:{spacing_between_lines_px:this.options.stave.space*1.3}});const e=new Ia(t.x,t.y,t.width,t.options);return this.staves.push(e),e.setContext(this.context),this.stave=e,e}StaveNote(t){const e=new ae(t);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}GhostNote(t){const e=new Fa(t);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}TextNote(t){const e=new li(t);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}NumberedNote(t){const e=new ai(t);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}BarNote(t){t=fe(t,{type:"single",options:{}});const e=new po(t.type);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}ClefNote(t){t=fe(t,{type:"treble",options:{size:"default"}});const e=new tr(t.type,t.options.size,t.options.annotation);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}TimeSigNote(t){t=fe(t,{time:"4/4",options:{}});const e=new Da(t.time);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}KeySigNote(t){const e=new Ba(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 nn(t);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}GraceNote(t){const e=new ts(t);return this.stave&&e.setStave(this.stave),e.setContext(this.context),e}GraceNoteGroup(t){const e=new Ps(t.notes,t.slur);return e.setContext(this.context),e}Accidental(t){t=fe(t,{type:null,options:{}});const e=new is(t.type);return e.setContext(this.context),e}Annotation(t){t=fe(t,{text:"p",vJustify:"below",hJustify:"center",fontFamily:"Times",fontSize:14,fontWeight:"bold italic",options:{}});const e=new se(t.text);return e.setJustification(t.hJustify),e.setVerticalJustification(t.vJustify),e.setFont(t.fontFamily,t.fontSize,t.fontWeight),e.setContext(this.context),e}Articulation(t){t=fe(t,{type:"a.",position:"above",options:{}});const e=new Ri(t.type);return e.setPosition(t.position),e.setContext(this.context),e}TextDynamics(t){t=fe(t,{text:"p",duration:"q",dots:0,line:0,options:{}});const e=new _s({text:t.text,line:t.line,duration:t.duration,dots:t.dots});return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}Fingering(t){t=fe(t,{number:"0",position:"left",options:{}});const e=new Qs(t.number);return e.setPosition(t.position),e.setContext(this.context),e}StringNumber(t){t=fe(t,{number:"0",position:"left",options:{}});const e=new tn(t.number);return e.setPosition(t.position),e.setContext(this.context),e}TickContext(){return new xs().setContext(this.context)}ModifierContext(){return new Ys}MultiMeasureRest(t){const e=new ka(t.number_of_measures,t);return e.setContext(this.context),this.renderQ.push(e),e}Voice(t){t=fe(t,{time:"4/4",options:{}});const e=new ye(t.time);return this.voices.push(e),e}StaveConnector(t){t=fe(t,{top_stave:null,bottom_stave:null,type:"double",options:{}});const e=new Bt(t.top_stave,t.bottom_stave);return e.setType(t.type).setContext(this.context),this.renderQ.push(e),e}Formatter(){return new si}Tuplet(t){t=fe(t,{notes:[],options:{}});const e=new He(t.notes,t.options).setContext(this.context);return this.renderQ.push(e),e}Beam(t){t=fe(t,{notes:[],options:{autoStem:!1,secondaryBeamBreaks:[]}});const e=new Vi(t.notes,t.options.autoStem).setContext(this.context);return e.breakSecondaryAt(t.options.secondaryBeamBreaks),this.renderQ.push(e),e}Curve(t){t=fe(t,{from:null,to:null,options:{}});const e=new oi(t.from,t.to,t.options).setContext(this.context);return this.renderQ.push(e),e}StaveTie(t){t=fe(t,{from:null,to:null,first_indices:[0],last_indices:[0],text:null,options:{direction:void 0}});const e=new Qn({first_note:t.from,last_note:t.to,first_indices:t.first_indices,last_indices:t.last_indices},t.text);return t.options.direction&&e.setDirection(t.options.direction),e.setContext(this.context),this.renderQ.push(e),e}StaveLine(t){t=fe(t,{from:null,to:null,first_indices:[0],last_indices:[0],options:{}});const e=new mi({first_note:t.from,last_note:t.to,first_indices:t.first_indices,last_indices:t.last_indices});return t.options.text&&e.setText(t.options.text),t.options.font&&e.setFont(t.options.font),e.setContext(this.context),this.renderQ.push(e),e}VibratoBracket(t){t=fe(t,{from:null,to:null,options:{harsh:!1}});const e=new uo({start:t.from,stop:t.to});return t.options.line&&e.setLine(t.options.line),t.options.harsh&&e.setHarsh(t.options.harsh),e.setContext(this.context),this.renderQ.push(e),e}TextBracket(t){t=fe(t,{from:null,to:null,text:"",options:{superscript:"",position:1}});const e=new Ze({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 Va(t).setContext(this.context);return this.systems.push(e),e}EasyScore(t={}){return t.factory=this,new go(t)}PedalMarking(t={}){t=fe(t,{notes:[],options:{style:"mixed"}});const e=new Ot(t.notes);return e.setStyle(Ot.StylesString[t.options.style]),e.setContext(this.context),this.renderQ.push(e),e}NoteSubGroup(t={}){t=fe(t,{notes:[],options:{}});const e=new $s(t.notes);return e.setContext(this.context),e}draw(){this.systems.forEach(t=>t.setContext(this.context).format()),this.staves.forEach(t=>t.setContext(this.context).draw()),this.voices.forEach(t=>t.setContext(this.context).draw()),this.renderQ.forEach(t=>{t.isRendered()||t.setContext(this.context).draw()}),this.systems.forEach(t=>t.setContext(this.context).draw()),this.reset()}}function Zo(n,t){const e=t.options;return n=Object.assign(t,n),n.options=Object.assign(e,n.options),n}class Va extends he{constructor(t={}){super(),this.setAttribute("type","System"),this.setOptions(t),this.parts=[]}setOptions(t={}){this.options=Zo(t,{x:10,y:10,width:500,connector:null,spaceBetweenStaves:12,factory:null,debugFormatter:!1,formatIterations:0,options:{}}),this.factory=this.options.factory||new rn({renderer:{el:null}})}setContext(t){return super.setContext(t),this.factory.setContext(t),this}addConnector(t="double"){return this.connector=this.factory.StaveConnector({top_stave:this.parts[0].stave,bottom_stave:this.parts[this.parts.length-1].stave,type:t}),this.connector}addStave(t){return t=Zo(t,{stave:null,voices:[],spaceAbove:0,spaceBelow:0,debugNoteMetrics:!1,options:{left_bar:!1}}),t.stave||(t.stave=this.factory.Stave({x:this.options.x,y:this.options.y,width:this.options.width,options:t.options})),t.voices.forEach(e=>e.setContext(this.context).setStave(t.stave).getTickables().forEach(i=>i.setStave(t.stave))),this.parts.push(t),t.stave}format(){const t=new si;this.formatter=t;let e=this.options.y,i=0,s=[];const r=[];this.parts.forEach(a=>{e=e+a.stave.space(a.spaceAbove),a.stave.setY(e),t.joinVoices(a.voices),e=e+a.stave.space(a.spaceBelow),e=e+a.stave.space(this.options.spaceBetweenStaves),a.debugNoteMetrics&&(r.push({y:e,voice:a.voices[0]}),e+=15),s=s.concat(a.voices),i=Math.max(i,a.stave.getNoteStartX())}),this.parts.forEach(a=>a.stave.setNoteStartX(i));const o=this.options.width-(i-this.options.x)-Ie.STAVEPADDING;t.format(s,o);for(let a=0;a<this.options.formatIterations;a++)t.tune();this.startX=i,this.debugNoteMetricsYs=r,this.lastY=e}draw(){const t=this.checkContext();this.setRendered(),this.options.debugFormatter&&si.plotDebugging(t,this.formatter,this.startX,this.options.y,this.lastY),this.debugNoteMetricsYs.forEach(e=>{e.voice.getTickables().forEach(i=>Ie.plotMetrics(t,i,e.y))})}}M.Flow=V;M.Flow.Element=he;M.Flow.Fraction=Rt;M.Flow.Renderer=Zt;M.Flow.Formatter=si;M.Flow.Music=te;M.Flow.Glyph=xt;M.Flow.Stave=sn;M.Flow.StaveNote=ae;M.Flow.StaveModifier=Vt;M.Flow.StaveTempo=$n;M.Flow.Voice=ye;M.Flow.Accidental=is;M.Flow.Beam=Vi;M.Flow.StaveTie=Qn;M.Flow.TabStave=Ia;M.Flow.TabNote=nn;M.Flow.Bend=Oe;M.Flow.Vibrato=vs;M.Flow.VibratoBracket=uo;M.Flow.Note=Ie;M.Flow.ModifierContext=Ys;M.Flow.MultiMeasureRest=ka;M.Flow.TickContext=xs;M.Flow.Articulation=Ri;M.Flow.Annotation=se;M.Flow.Barline=Xt;M.Flow.NoteHead=Ms;M.Flow.StaveConnector=Bt;M.Flow.ClefNote=tr;M.Flow.KeySignature=ss;M.Flow.KeySigNote=Ba;M.Flow.TimeSignature=Wi;M.Flow.TimeSigNote=Da;M.Flow.Stem=ft;M.Flow.TabTie=ys;M.Flow.Clef=hi;M.Flow.Dot=Gi;M.Flow.Modifier=St;M.Flow.TabSlide=pi;M.Flow.Tuplet=He;M.Flow.GraceNote=ts;M.Flow.GraceTabNote=fo;M.Flow.Tuning=Rn;M.Flow.KeyManager=Pc;M.Flow.StaveHairpin=Ws;M.Flow.BoundingBox=es;M.Flow.Stroke=Te;M.Flow.TextNote=li;M.Flow.Curve=oi;M.Flow.TextDynamics=_s;M.Flow.StaveLine=mi;M.Flow.Ornament=en;M.Flow.PedalMarking=Ot;M.Flow.TextBracket=Ze;M.Flow.FretHandFinger=Qs;M.Flow.Repetition=_e;M.Flow.BarNote=po;M.Flow.GhostNote=Fa;M.Flow.NoteSubGroup=$s;M.Flow.GraceNoteGroup=Ps;M.Flow.Tremolo=Zi;M.Flow.StringNumber=tn;M.Flow.Crescendo=Oa;M.Flow.Volta=ti;M.Flow.Font=bn;M.Flow.System=Va;M.Flow.Factory=rn;M.Flow.Parser=mo;M.Flow.EasyScore=go;M.Flow.Registry=gi;var Et=(n=>(n[n.SingleThin=0]="SingleThin",n[n.DoubleThin=1]="DoubleThin",n[n.ThinBold=2]="ThinBold",n[n.BoldThinDots=3]="BoldThinDots",n[n.DotsThinBold=4]="DotsThinBold",n[n.DotsBoldBoldDots=5]="DotsBoldBoldDots",n[n.None=6]="None",n[n.Dotted=7]="Dotted",n[n.Dashed=8]="Dashed",n[n.Bold=9]="Bold",n[n.BoldThin=10]="BoldThin",n[n.DoubleBold=11]="DoubleBold",n[n.Tick=12]="Tick",n[n.Short=13]="Short",n))(Et||{});class Wc{static xmlBarlineStyleToSystemLinesEnum(t){return t==="regular"?0:t==="dotted"?7:t==="dashed"?8:t==="heavy"?9:t==="light-light"?1:t==="light-heavy"?2:t==="heavy-light"?10:t==="heavy-heavy"?11:t==="tick"?12:t==="short"?13:t==="none"?6:0}}class js{constructor(){this.matrix=[];for(let t=0;t<2;t++){this.matrix[t]=[];for(let e=0;e<2;e++)this.matrix[t][e]=0}}static getRotationMatrix(t){const e=new js,i=Math.cos(t),s=Math.sin(t);return e.matrix[0][0]=i,e.matrix[0][1]=-s,e.matrix[1][0]=s,e.matrix[1][1]=i,e}scalarMultiplication(t){for(let e=0;e<2;e++)for(let i=0;i<2;i++)this.matrix[e][i]*=t}getTransposeMatrix(){const t=new js;for(let e=0;e<2;e++)for(let i=0;i<2;i++)t.matrix[e][i]=this.matrix[i][e];return t}vectorMultiplication(t){const e=new O;return e.x=t.x*this.matrix[0][0]+t.y*this.matrix[0][1],e.y=t.x*this.matrix[1][0]+t.y*this.matrix[1][1],e}}class Uc{constructor(){this.measureErrors={},this.errors=[],this.tempErrors=[]}finalizeMeasure(t){let e=this.measureErrors[t];e||(e=[]),this.measureErrors[t]=e.concat(this.tempErrors),this.tempErrors=[]}pushMeasureError(t){this.tempErrors.push(t)}push(t){this.errors.push(t)}}class zc{constructor(t,e=Xe.ARPEGGIO_DIRECTIONLESS){this.parentVoiceEntry=t,this.type=e,this.notes=[]}addNote(t){this.notes.push(t),t.Arpeggio=this}}var Xe=(n=>(n[n.BRUSH_DOWN=1]="BRUSH_DOWN",n[n.BRUSH_UP=2]="BRUSH_UP",n[n.ROLL_DOWN=3]="ROLL_DOWN",n[n.ROLL_UP=4]="ROLL_UP",n[n.RASQUEDO_DOWN=5]="RASQUEDO_DOWN",n[n.RASQUEDO_UP=6]="RASQUEDO_UP",n[n.ARPEGGIO_DIRECTIONLESS=7]="ARPEGGIO_DIRECTIONLESS",n))(Xe||{});class Hc{constructor(t=1,e=0){this.notes=[],this.extendedNoteList=[],this.BeamNumberOffsetToXML=0,this.BeamNumber=t,this.BeamNumberOffsetToXML=e}get Notes(){return this.notes}set Notes(t){this.notes=t}get ExtendedNoteList(){return this.extendedNoteList}set ExtendedNoteList(t){this.extendedNoteList=t}addNoteToBeam(t){t&&(t.NoteBeam=this,this.notes.push(t),this.extendedNoteList.push(t))}}class bo{constructor(t,e){this.voiceEntries=[],this.volume=1,this.parent=t,this.visible=!0,this.audible=!0,this.following=!0,this.voiceId=e,this.uniqueVoiceId="I:"+this.parent.Id+" V: "+this.voiceId}get VoiceEntries(){return this.voiceEntries}get Parent(){return this.parent}get Visible(){return this.visible}set Visible(t){this.visible=t}get Audible(){return this.audible}set Audible(t){this.audible=t}get Following(){return this.following}set Following(t){this.following=t}get Solo(){return this.solo}set Solo(t){this.solo=t}get VoiceId(){return this.voiceId}get Volume(){return this.volume}set Volume(t){this.volume=t}toString(){return this.uniqueVoiceId}}class bs extends bo{constructor(t,e,i){super(t,e),this.master=i}get Master(){return this.master}}class So{constructor(t,e,i=void 0){this.sourceNote=t,this.setShapeFromXml(e,i)}setShapeFromXml(t,e=void 0){this.shape=So.ShapeTypeXmlToShape(t);let i=e;i===void 0&&(this.sourceNote?i=this.sourceNote.Length.Denominator>2:(j.warn("notehead: sourceNote and filledXmlAttribute undefined."),i=!0)),this.filled=i}get SourceNote(){return this.sourceNote}get Shape(){return this.shape}get Filled(){return this.filled}static ShapeTypeXmlToShape(t){switch(t.toLowerCase()){case"normal":return Qt.NORMAL;case"x":return Qt.X;case"slash":return Qt.SLASH;case"diamond":return Qt.DIAMOND;case"square":return Qt.SQUARE;case"la":return Qt.SQUARE;case"do":case"triangle":return Qt.TRIANGLE;case"rectangle":return Qt.RECTANGLE;case"circle-x":return Qt.CIRCLEX;default:return j.info("unsupported/unhandled xml notehead '"+t+"'. Using normal notehead."),Qt.NORMAL}}}var Qt=(n=>(n[n.CIRCLEX=0]="CIRCLEX",n[n.DIAMOND=1]="DIAMOND",n[n.NORMAL=2]="NORMAL",n[n.RECTANGLE=3]="RECTANGLE",n[n.SLASH=4]="SLASH",n[n.SQUARE=5]="SQUARE",n[n.TRIANGLE=6]="TRIANGLE",n[n.X=7]="X",n))(Qt||{});class Tt{static translateText(t,e){if(!this.defaultTextTranslation)return e}}var yo=(n=>(n[n.UNDEFINED=0]="UNDEFINED",n[n._1024th=1]="_1024th",n[n._512th=2]="_512th",n[n._256th=3]="_256th",n[n._128th=4]="_128th",n[n._64th=5]="_64th",n[n._32nd=6]="_32nd",n[n._16th=7]="_16th",n[n.EIGTH=8]="EIGTH",n[n.QUARTER=9]="QUARTER",n[n.HALF=10]="HALF",n[n.WHOLE=11]="WHOLE",n[n.BREVE=12]="BREVE",n[n.LONG=13]="LONG",n[n.MAXIMA=14]="MAXIMA",n))(yo||{});class ws{static NoteTypeToString(t){return this.NoteTypeXmlValues[t]}static StringToNoteType(t){const e=this.NoteTypeXmlValues.indexOf(t);return e!==-1?e:0}static getNoteDurationFromType(t){switch(t){case"1024th":return new W(1,1024);case"512th":return new W(1,512);case"256th":return new W(1,256);case"128th":return new W(1,128);case"64th":return new W(1,64);case"32th":case"32nd":return new W(1,32);case"16th":return new W(1,16);case"eighth":return new W(1,8);case"quarter":return new W(1,4);case"half":return new W(1,2);case"whole":return new W(1,1);case"breve":return new W(2,1);case"long":return new W(4,1);case"maxima":return new W(8,1);default:{const e=Tt.translateText("ReaderErrorMessages/NoteDurationError","Invalid note duration.");throw new Ee(e)}}}}ws.NoteTypeXmlValues=["","1024th","512th","256th","128th","64th","32nd","16th","eigth","quarter","half","whole","breve","long","maxima"];class Xc{constructor(t){this.placement=z.Above,this.accidentalAbove=yt.NONE,this.accidentalBelow=yt.NONE,this.ornament=t}get GetOrnament(){return this.ornament}get AccidentalAbove(){return this.accidentalAbove}set AccidentalAbove(t){this.accidentalAbove=t}get AccidentalBelow(){return this.accidentalBelow}set AccidentalBelow(t){this.accidentalBelow=t}}var Ne=(n=>(n[n.Trill=0]="Trill",n[n.Turn=1]="Turn",n[n.InvertedTurn=2]="InvertedTurn",n[n.DelayedTurn=3]="DelayedTurn",n[n.DelayedInvertedTurn=4]="DelayedInvertedTurn",n[n.Mordent=5]="Mordent",n[n.InvertedMordent=6]="InvertedMordent",n))(Ne||{});class yn{constructor(t,e,i){this.staffEntries=[],this.comments=[],this.timestamp=e,this.staffEntries=new Array(i),this.parentMeasure=t}$get$(t){return this.staffEntries[t]}$set$(t,e){this.staffEntries[t]=e}get Timestamp(){return this.timestamp}set Timestamp(t){this.timestamp=t}get StaffEntries(){return this.staffEntries}set StaffEntries(t){this.staffEntries=t}get Comments(){return this.comments}set Comments(t){this.comments=t}get ParentMeasure(){return this.parentMeasure}set ParentMeasure(t){this.parentMeasure=t}getAbsoluteTimestamp(){return W.plus(this.timestamp,this.parentMeasure.AbsoluteTimestamp)}}class we{constructor(t,e){this.voiceEntries=[],this.instructions=[],this.chordSymbolContainers=[],this.verticalContainerParent=t,this.parentStaff=e}get ParentStaff(){return this.parentStaff}get VerticalContainerParent(){return this.verticalContainerParent}get Timestamp(){if(this.VerticalContainerParent)return this.VerticalContainerParent.Timestamp}get AbsoluteTimestamp(){if(this.VerticalContainerParent)return W.plus(this.VerticalContainerParent.ParentMeasure.AbsoluteTimestamp,this.VerticalContainerParent.Timestamp)}get VoiceEntries(){return this.voiceEntries}set VoiceEntries(t){this.voiceEntries=t}get Link(){return this.staffEntryLink}set Link(t){this.staffEntryLink=t}get Instructions(){return this.instructions}set Instructions(t){this.instructions=t}get ChordContainers(){return this.chordSymbolContainers}set ChordContainers(t){this.chordSymbolContainers=t}removeAllInstructionsOfTypeClefInstruction(){let t=0,e=0;for(;t<this.instructions.length;)this.instructions[t]instanceof Wt?(this.instructions.splice(t,1),e++):t++;return e}removeFirstInstructionOfTypeClefInstruction(){for(let t=0;t<this.instructions.length;t++)if(this.instructions[t]instanceof Wt)return this.instructions.splice(t,1),!0;return!1}removeAllInstructionsOfTypeKeyInstruction(){let t=0,e=0;for(;t<this.instructions.length;)this.instructions[t]instanceof xe?(this.instructions.splice(t,1),e++):t++;return e}removeFirstInstructionOfTypeKeyInstruction(){for(let t=0;t<this.instructions.length;t++)if(this.instructions[t]instanceof xe)return this.instructions.splice(t,1),!0;return!1}removeAllInstructionsOfTypeRhythmInstruction(){let t=0,e=0;for(;t<this.instructions.length;)this.instructions[t]instanceof Ae?(this.instructions.splice(t,1),e++):t++;return e}removeFirstInstructionOfTypeRhythmInstruction(){for(let t=0;t<this.instructions.length;t++)if(this.instructions[t]instanceof Ae)return this.instructions.splice(t,1),!0;return!1}calculateMinNoteLength(){let t=new W(Number.MAX_VALUE,1);for(let e=0,i=this.VoiceEntries.length;e<i;++e){const s=this.VoiceEntries[e];for(let r=0,o=s.Notes.length;r<o;++r){const a=s.Notes[r];a.Length.lt(t)&&(t=a.Length)}}return t}calculateMaxNoteLength(){let t=new W(0,1);for(let e=0,i=this.VoiceEntries.length;e<i;++e){const s=this.VoiceEntries[e];for(let r=0,o=s.Notes.length;r<o;++r){const a=s.Notes[r];if(a.NoteTie){const l=W.createFromFraction(a.Length);let h=!1;for(const c of a.NoteTie.Notes){if(c===a){h=!0;continue}h&&l.Add(c.Length)}t.lt(l)&&(t=l)}else t.lt(a.Length)&&(t=a.Length)}}return t}hasNotes(){for(let t=0,e=this.VoiceEntries.length;t<e;++t)if(this.VoiceEntries[t].Notes.length>0)return!0;return!1}hasTie(){for(let t=0,e=this.VoiceEntries.length;t<e;++t)if(this.VoiceEntries[t].hasTie())return!0;return!1}findLinkedNotes(t){for(let e=0,i=this.voiceEntries.length;e<i;++e){const s=this.voiceEntries[e];for(let r=0,o=s.Notes.length;r<o;++r){const a=s.Notes[r];a.ParentStaffEntry===this&&t.push(a)}}}get hasOnlyRests(){for(const t of this.voiceEntries)for(const e of t.Notes)if(!e.isRest)return!1;return!0}}class Mr{static Compare(t,e){if(t.parentRepetition!==void 0&&e.parentRepetition){if(t.alignment===Dt.End&&e.alignment===Dt.End){if(t.parentRepetition.StartIndex<e.parentRepetition.StartIndex)return 1;if(t.parentRepetition.StartIndex>e.parentRepetition.StartIndex)return-1}if(t.alignment===Dt.Begin&&e.alignment===Dt.Begin){if(t.parentRepetition.EndIndex<e.parentRepetition.EndIndex)return 1;if(t.parentRepetition.EndIndex>e.parentRepetition.EndIndex)return-1}}return 0}}class It{constructor(t,e,i=Dt.End,s=void 0,r=void 0){this.endingIndices=void 0,this.measureIndex=t,r&&(this.endingIndices=r.slice()),this.type=e,this.alignment=i,this.parentRepetition=s}CompareTo(t){const e=t;if(this.measureIndex>e.measureIndex)return 1;if(this.measureIndex<e.measureIndex)return-1;if(this.alignment===Dt.Begin){if(e.alignment===Dt.End)return-1;switch(this.type){case q.Ending:return 1;case q.StartLine:return e.type===q.Ending?-1:1;case q.Coda:case q.Segno:return e.type===q.Coda?1:-1}}else{if(e.alignment===Dt.Begin)return 1;switch(this.type){case q.Ending:return-1;case q.Fine:case q.ToCoda:return e.type===q.Ending?1:-1;case q.ForwardJump:switch(e.type){case q.Ending:case q.Fine:case q.ToCoda:return 1}return-1;case q.DalSegnoAlFine:case q.DaCapoAlFine:case q.DalSegnoAlCoda:case q.DaCapoAlCoda:case q.DaCapo:case q.DalSegno:case q.BackJumpLine:return 1}}return 0}equals(t){if(this.measureIndex!==t.measureIndex||this.type!==t.type||this.alignment!==t.alignment)return!1;if(this.endingIndices===t.endingIndices)return!0;if(!this.endingIndices||!t.endingIndices||this.endingIndices.length!==t.endingIndices.length)return!1;for(let e=0;e<this.endingIndices.length;e++)if(this.endingIndices[e]!==t.endingIndices[e])return!1;return!0}}var q=(n=>(n[n.StartLine=0]="StartLine",n[n.ForwardJump=1]="ForwardJump",n[n.BackJumpLine=2]="BackJumpLine",n[n.Ending=3]="Ending",n[n.DaCapo=4]="DaCapo",n[n.DalSegno=5]="DalSegno",n[n.Fine=6]="Fine",n[n.ToCoda=7]="ToCoda",n[n.DalSegnoAlFine=8]="DalSegnoAlFine",n[n.DaCapoAlFine=9]="DaCapoAlFine",n[n.DalSegnoAlCoda=10]="DalSegnoAlCoda",n[n.DaCapoAlCoda=11]="DaCapoAlCoda",n[n.Coda=12]="Coda",n[n.Segno=13]="Segno",n[n.None=14]="None",n))(q||{}),Dt=(n=>(n[n.Begin=0]="Begin",n[n.End=1]="End",n))(Dt||{});let xi=null;class Yc{constructor(t,e){this.printNewSystemXml=!1,this.printNewPageXml=!1,this.IsSystemStartMeasure=!1,this.hasLyrics=!1,this.hasMoodExpressions=!1,this.allRests=!1,this.isReducedToMultiRest=!1,this.multipleRestMeasureNumber=0,this.staffLinkedExpressions=[],this.tempoExpressions=[],this.verticalSourceStaffEntryContainers=[],this.graphicalMeasureErrors=[],this.firstRepetitionInstructions=[],this.lastRepetitionInstructions=[],this.metronomeNoteIndex=0,this.completeNumberOfStaves=t,this.implicitMeasure=!1,this.hasEndLine=!1,this.endingBarStyleXml="",this.endingBarStyleEnum=Et.SingleThin,this.firstInstructionsStaffEntries=new Array(t),this.lastInstructionsStaffEntries=new Array(t),this.rules=e,this.TempoInBPM=0;for(let i=0;i<t;i++)this.graphicalMeasureErrors.push(!1),this.staffLinkedExpressions.push([])}get MeasureNumber(){return this.measureNumber}set MeasureNumber(t){this.measureNumber=t}getPrintedMeasureNumber(){return this.rules.UseXMLMeasureNumbers&&Number.isInteger(this.MeasureNumberXML)?(this.MeasureNumberPrinted=this.MeasureNumberXML,this.MeasureNumberPrinted):(this.MeasureNumberPrinted=this.MeasureNumber,this.MeasureNumberPrinted)}get AbsoluteTimestamp(){return this.absoluteTimestamp}set AbsoluteTimestamp(t){this.absoluteTimestamp=t}get CompleteNumberOfStaves(){return this.completeNumberOfStaves}get Duration(){return this.duration}set Duration(t){this.duration=t}get ActiveTimeSignature(){return this.activeTimeSignature}set ActiveTimeSignature(t){this.activeTimeSignature=t}get ImplicitMeasure(){return this.implicitMeasure}set ImplicitMeasure(t){this.implicitMeasure=t}get HasEndLine(){return this.hasEndLine}set HasEndLine(t){this.hasEndLine=t}get StaffLinkedExpressions(){return this.staffLinkedExpressions}get TempoExpressions(){return this.tempoExpressions}get VerticalSourceStaffEntryContainers(){return this.verticalSourceStaffEntryContainers}get FirstInstructionsStaffEntries(){return this.firstInstructionsStaffEntries}get LastInstructionsStaffEntries(){return this.lastInstructionsStaffEntries}get FirstRepetitionInstructions(){return this.firstRepetitionInstructions}get LastRepetitionInstructions(){return this.lastRepetitionInstructions}getErrorInMeasure(t){return this.graphicalMeasureErrors[t]}setErrorInGraphicalMeasure(t,e){this.graphicalMeasureErrors[t]=e}getNextMeasure(t){return t[this.measureListIndex+1]}getPreviousMeasure(t){if(this.measureListIndex>1)return t[this.measureListIndex-1]}get Rules(){return this.rules}get VerticalMeasureList(){return this.verticalMeasureList}set VerticalMeasureList(t){this.verticalMeasureList=t}get TempoInBPM(){return this.tempoInBPM}set TempoInBPM(t){this.tempoInBPM=t}findOrCreateStaffEntry(t,e,i){let s,r;for(const a of this.verticalSourceStaffEntryContainers)if(a.Timestamp.Equals(t)){r=a;break}if(r)return r.StaffEntries[e]?s=r.StaffEntries[e]:(s=new we(r,i),r.StaffEntries[e]=s),{createdNewContainer:!1,staffEntry:s};const o=this.verticalSourceStaffEntryContainers[this.verticalSourceStaffEntryContainers.length-1];if(this.verticalSourceStaffEntryContainers.length===0||o.Timestamp.lt(t)){const a=new yn(this,t.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.push(a),s=new we(a,i),a.StaffEntries[e]=s}else for(let a=this.verticalSourceStaffEntryContainers.length-1;a>=0;a--){if(this.verticalSourceStaffEntryContainers[a].Timestamp.lt(t)){const l=new yn(this,t.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(a+1,0,l),s=new we(l,i),l.StaffEntries[e]=s;break}if(a===0){const l=new yn(this,t.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(a,0,l),s=new we(l,i),l.StaffEntries[e]=s;break}}return{createdNewContainer:!0,staffEntry:s}}findOrCreateVoiceEntry(t,e){let i,s=!1;for(const r of t.VoiceEntries)if(r.ParentVoice===e){i=r;break}return i||(i=new ir(t.Timestamp,e,t),s=!0),{createdVoiceEntry:s,voiceEntry:i}}getPreviousSourceStaffEntryFromIndex(t,e){for(let i=e-1;i>=0;i--)if(this.verticalSourceStaffEntryContainers[i][t])return this.verticalSourceStaffEntryContainers[i][t]}getVerticalContainerIndexByTimestamp(t){for(let e=0,i=this.VerticalSourceStaffEntryContainers.length;e<i;++e)if(this.VerticalSourceStaffEntryContainers[e].Timestamp.Equals(t))return e;return-1}getVerticalContainerByTimestamp(t){for(let e=0,i=this.VerticalSourceStaffEntryContainers.length;e<i;++e){const s=this.VerticalSourceStaffEntryContainers[e];if(s.Timestamp.Equals(t))return s}}checkForEmptyVerticalContainer(t){let e=0;for(let i=0;i<this.completeNumberOfStaves;i++)this.verticalSourceStaffEntryContainers[t][i]||e++;e===this.completeNumberOfStaves&&this.verticalSourceStaffEntryContainers.splice(t,1)}reverseCheck(t,e){let i=new W(0,1);const s=[];for(let r=0;r<t.Instruments.length;r++){let o=new W(0,1);const a=t.getGlobalStaffIndexOfFirstStaff(t.Instruments[r]);for(let l=0;l<t.Instruments[r].Staves.length;l++){const h=this.getLastSourceStaffEntryForInstrument(a+l);if(h!==void 0&&!h.hasTie()){const c=this.verticalSourceStaffEntryContainers.indexOf(h.VerticalContainerParent);for(let u=c-1;u>=0;u--){const f=this.verticalSourceStaffEntryContainers[u][a+l];if(f!==void 0&&f.hasTie()&&o.lt(W.plus(f.Timestamp,f.calculateMaxNoteLength()))){o=W.plus(f.Timestamp,f.calculateMaxNoteLength());break}}}}s.push(o)}for(let r=0,o=s.length;r<o;++r){const a=s[r];i.lt(a)&&(i=a)}return W.max(i,e)}calculateInstrumentsDuration(t,e){const i=[];for(let s=0;s<t.Instruments.length;s++){let r=new W(0,1);const o=t.getGlobalStaffIndexOfFirstStaff(t.Instruments[s]);for(let a=0;a<t.Instruments[s].Staves.length;a++){const l=this.getLastSourceStaffEntryForInstrument(o+a);l!==void 0&&l.Timestamp&&r.lt(W.plus(l.Timestamp,l.calculateMaxNoteLength()))&&(r=W.plus(l.Timestamp,l.calculateMaxNoteLength()))}r.lt(e[s])&&(r=e[s]),i.push(r)}return i}getEntriesPerStaff(t){const e=[];for(const i of this.VerticalSourceStaffEntryContainers){const s=i.StaffEntries[t];s&&e.push(s)}return e}hasBeginInstructions(){for(let t=0,e=this.FirstInstructionsStaffEntries.length;t<e;t++){const i=this.FirstInstructionsStaffEntries[t];if(i!==void 0&&i.Instructions.length>0)return!0}return!1}beginsWithLineRepetition(){for(let t=0,e=this.FirstRepetitionInstructions.length;t<e;++t){const i=this.FirstRepetitionInstructions[t];if(i.type===q.StartLine||i.parentRepetition!==void 0&&i===i.parentRepetition.startMarker&&!i.parentRepetition.FromWords)return!0}return!1}endsWithLineRepetition(){for(let t=0,e=this.LastRepetitionInstructions.length;t<e;++t){const i=this.LastRepetitionInstructions[t];if(i.type===q.BackJumpLine)return!0;const s=i.parentRepetition;if(!!s&&!s.FromWords)for(let r=0,o=s.BackwardJumpInstructions.length;r<o;++r){const a=s.BackwardJumpInstructions[r];if(i===a)return!0}}return!1}beginsWithWordRepetition(){for(let t=0,e=this.FirstRepetitionInstructions.length;t<e;++t){const i=this.FirstRepetitionInstructions[t];if(i.parentRepetition!==void 0&&i===i.parentRepetition.startMarker&&i.parentRepetition.FromWords)return!0}return!1}endsWithWordRepetition(){for(let t=0,e=this.LastRepetitionInstructions.length;t<e;++t){const i=this.LastRepetitionInstructions[t],s=i.parentRepetition;if(!!s&&!!s.FromWords){for(let r=0,o=s.BackwardJumpInstructions.length;r<o;++r){const a=s.BackwardJumpInstructions[r];if(i===a)return!0}if(i===s.forwardJumpInstruction)return!0}}return!1}beginsRepetitionEnding(){for(const t of this.FirstRepetitionInstructions)if(t.type===q.Ending&&t.alignment===Dt.Begin)return!0;return!1}endsRepetitionEnding(){for(const t of this.LastRepetitionInstructions)if(t.type===q.Ending&&t.alignment===Dt.End)return!0;return!1}getKeyInstruction(t){if(this.FirstInstructionsStaffEntries[t]){const e=this.FirstInstructionsStaffEntries[t];for(let i=0,s=e.Instructions.length;i<s;++i){const r=e.Instructions[i];if(r instanceof xe)return r}}}getLastSourceStaffEntryForInstrument(t){let e;for(let i=this.verticalSourceStaffEntryContainers.length-1;i>=0&&(e=this.verticalSourceStaffEntryContainers[i].StaffEntries[t],!e);i--);return e}canBeReducedToMultiRest(){var i,s,r,o,a,l;let t=!0,e=!1;for(const h of this.verticalSourceStaffEntryContainers)if(!!h){for(const c of h.StaffEntries)if(!(!c||!c.ParentStaff.ParentInstrument.Visible)){if(c.ChordContainers.length>0||(c.ParentStaff.hasLyrics&&(e=!0),this.firstRepetitionInstructions.length>0||this.lastRepetitionInstructions.length>0))return!1;for(const u of c.VoiceEntries){for(const f of u.Notes)if(!f.isRest()){t=!1;break}if(!t)break}}}if(!t||e||this.hasMoodExpressions||this.tempoExpressions.length>0)return!1;for(const h of this.staffLinkedExpressions)if(h.length>0)return!1;for(const h of this.lastInstructionsStaffEntries)for(let c=0,u=h==null?void 0:h.Instructions.length;c<u;++c)if(h.Instructions[c]instanceof Wt)return!1;return xi&&(((i=xi==null?void 0:xi.ActiveTimeSignature)==null?void 0:i.Numerator)!==((s=this.ActiveTimeSignature)==null?void 0:s.Numerator)||((r=xi==null?void 0:xi.ActiveTimeSignature)==null?void 0:r.Denominator)!==((o=this.ActiveTimeSignature)==null?void 0:o.Denominator))?(xi=this,!1):(xi=this,((a=this.Duration)==null?void 0:a.RealValue)===((l=this.ActiveTimeSignature)==null?void 0:l.RealValue))}}class jc{constructor(t,e){this.isTab=!1,this.voices=[],this.volume=1,this.stafflineCount=5,this.hasLyrics=!1,this.openTieDict={},this.parentInstrument=t,this.id=e,this.audible=!0,this.following=!0}get ParentInstrument(){return this.parentInstrument}set ParentInstrument(t){this.parentInstrument=t}get Voices(){return this.voices}get Solo(){return this.solo}set Solo(t){this.solo=t}get Id(){return this.id}get Volume(){return this.volume}set Volume(t){this.volume=t}get StafflineCount(){return this.stafflineCount}set StafflineCount(t){this.stafflineCount=t}toString(){return"Staff "+this.idInMusicSheet.toString()}}class Kc{constructor(t){this.linkStaffEntries=[],this.voiceEntry=t}get GetVoiceEntry(){return this.voiceEntry}get LinkStaffEntries(){return this.linkStaffEntries}set LinkStaffEntries(t){this.linkStaffEntries=t}}class qc{constructor(t,e){this.notes=[],this.TieNumber=1,this.TieDirection=z.NotYetDefined,this.NoteIndexToTieDirection={},this.AddNote(t),this.type=e}getTieDirection(t){if(!t)return this.TieDirection;for(let e=0;e<this.Notes.length;e++)if(this.Notes[e]===t){const s=this.NoteIndexToTieDirection[e];return s||this.TieDirection}return j.debug("tie.getTieDuration note not in tie.Notes"),this.TieDirection}get Notes(){return this.notes}get Type(){return this.type}get StartNote(){return this.notes[0]}get Duration(){const t=new W;for(const e of this.notes)t.Add(e.Length);return t}get Pitch(){return this.StartNote.Pitch}AddNote(t){this.notes.push(t),t.NoteTie=this}}class Qo{constructor(t,e=!1){this.PlacementFromXml=!1,this.notes=[],this.fractions=[],this.tupletLabelNumber=t,this.bracket=e}get TupletLabelNumber(){return this.tupletLabelNumber}set TupletLabelNumber(t){this.tupletLabelNumber=t}get Notes(){return this.notes}set Notes(t){this.notes=t}get Fractions(){return this.fractions}set Fractions(t){this.fractions=t}get Bracket(){return this.bracket}set Bracket(t){this.bracket=t}getNoteIndex(t){for(let e=this.notes.length-1;e>=0;e--)for(let i=0;i<this.notes[e].length;i++)if(t===this.notes[e][i])return e;return 0}}var Pr=(n=>(n[n.Fingering=0]="Fingering",n[n.String=1]="String",n))(Pr||{});class Jc{}class er{constructor(t,e){this.parentEntry=t,this.parentNote=e,this.ParentNote.PlaybackNote=this,this.Length=this.ParentNote.Length,e.Pitch!==void 0?this.ParentNote.ParentStaff.ParentInstrument.MidiInstrumentId===st.Percussion?this.MidiKey=er.noteToMidiDrumKey(e):this.MidiKey=e.Pitch.getHalfTone()+12:this.MidiKey=0}setLength(){this.ParentNote.NoteTie!==void 0&&this.ParentNote.NoteTie.StartNote===this.ParentNote&&(this.Length=this.ParentNote.NoteTie.Duration)}get ParentEntry(){return this.parentEntry}get ParentNote(){return this.parentNote}static noteToMidiDrumKey(t){var s;const e=t.Pitch.getHalfTone()-12,i=(s=t.Notehead)==null?void 0:s.Shape;switch(t.Pitch.Octave){case 1:switch(t.Pitch.FundamentalNote){case ut.D:switch(i){default:return 44}case ut.E:switch(i){default:return 35}case ut.F:switch(i){default:return 36}case ut.G:switch(i){default:return 41}case ut.A:switch(i){default:return 43}case ut.B:switch(i){case Qt.TRIANGLE:return 54;default:return 47}default:return e}case 2:switch(t.Pitch.FundamentalNote){case ut.C:switch(i){case Qt.X:return 37;default:return 38}case ut.D:switch(i){case Qt.X:return 59;default:return 48}case ut.E:switch(i){case Qt.X:return 42;case Qt.CIRCLEX:return 46;case Qt.TRIANGLE:return 56;default:return 50}case ut.F:switch(i){case Qt.DIAMOND:return 53;default:return 51}case ut.G:switch(i){case Qt.CIRCLEX:case Qt.DIAMOND:return 46;default:return 42}case ut.A:switch(i){default:return 49}case ut.B:switch(i){default:return 57}default:return e}case 3:switch(t.Pitch.FundamentalNote){case ut.C:switch(i){case Qt.CIRCLEX:return 52;default:return 55}default:return e}default:return e}}}class Zc{constructor(t){this.notes=[],this.TimestampShift=new W,this.parentVoiceEntry=t;for(const e of t.Notes)this.Notes.push(new er(this,e))}get ParentVoiceEntry(){return this.parentVoiceEntry}get Notes(){return this.notes}get Length(){if(this.Notes.length>0)return this.Notes[0].Length}set Length(t){for(const e of this.Notes)e.Length=t}get HasNotes(){return this.Notes.length>0}}class ir{constructor(t,e,i,s=!0,r=!1,o=!1,a=!1){if(this.notes=[],this.graceVoiceEntriesBefore=[],this.graceVoiceEntriesAfter=[],this.articulations=[],this.playbackEntries=[],this.technicalInstructions=[],this.lyricsEntries=new Ye,this.wantedStemDirection=Ft.Undefined,this.stemDirectionXml=Ft.Undefined,this.stemDirection=Ft.Undefined,this.timestamp=t,this.parentVoice=e,this.parentSourceStaffEntry=i,this.isGrace=r,this.graceAfterMainNote=!1,this.graceNoteSlash=o,this.graceSlur=a,r||e.VoiceEntries.push(this),s&&i!==void 0){const l=i.VoiceEntries;l.indexOf(this)===-1&&l.push(this)}this.mainPlaybackEntry=new Zc(this),this.PlaybackEntries.push(this.mainPlaybackEntry)}get ParentSourceStaffEntry(){return this.parentSourceStaffEntry}get ParentVoice(){return this.parentVoice}get Timestamp(){return this.timestamp}set Timestamp(t){this.timestamp=t}get Notes(){return this.notes}addNote(t){this.notes.push(t),!t.isRest()&&(t.NoteTie===void 0||t.NoteTie.StartNote===t)&&this.MainPlaybackEntry.Notes.push(new er(this.MainPlaybackEntry,t))}get GraceVoiceEntriesBefore(){return this.graceVoiceEntriesBefore}set GraceVoiceEntriesBefore(t){this.graceVoiceEntriesBefore=t;for(const e of this.graceVoiceEntriesBefore)e.parentSourceStaffEntry=this.ParentSourceStaffEntry}get GraceVoiceEntriesAfter(){return this.graceVoiceEntriesAfter}set GraceVoiceEntriesAfter(t){this.graceVoiceEntriesAfter=t;for(const e of this.graceVoiceEntriesAfter)e.parentSourceStaffEntry=this.ParentSourceStaffEntry}get IsGrace(){return this.isGrace}set IsGrace(t){this.isGrace=t}get GraceAfterMainNote(){return this.graceAfterMainNote}set GraceAfterMainNote(t){this.graceAfterMainNote=t}get GraceNoteSlash(){return this.graceNoteSlash}set GraceNoteSlash(t){this.graceNoteSlash=t}get GraceSlur(){return this.graceSlur}set GraceSlur(t){this.graceSlur=t}get Articulations(){return this.articulations}get PlaybackEntries(){return this.playbackEntries}get Fermata(){return this.fermata}get MainPlaybackEntry(){return this.mainPlaybackEntry}set MainPlaybackEntry(t){this.mainPlaybackEntry=t}removeMainPlaybackEntry(){this.mainPlaybackEntry!==void 0&&this.removePlaybackEntry(this.mainPlaybackEntry)}removePlaybackEntry(t){this.mainPlaybackEntry===t&&(this.mainPlaybackEntry=void 0);const e=this.playbackEntries.indexOf(t);e>-1&&this.playbackEntries.splice(e,1)}get TechnicalInstructions(){return this.technicalInstructions}get LyricsEntries(){return this.lyricsEntries}get Arpeggio(){return this.arpeggio}set Arpeggio(t){this.arpeggio=t}get OrnamentContainer(){return this.ornamentContainer}set OrnamentContainer(t){this.ornamentContainer=t}set WantedStemDirection(t){this.wantedStemDirection=t}get WantedStemDirection(){return this.wantedStemDirection}set StemDirectionXml(t){this.stemDirectionXml=t}get StemDirectionXml(){return this.stemDirectionXml}set StemDirection(t){this.stemDirection=t}get StemDirection(){return this.stemDirection}get StemColorXml(){return this.stemColorXml}set StemColorXml(t){this.stemColorXml=t}get StemColor(){return this.stemColor}set StemColor(t){this.stemColor=t}get VolumeModifier(){return this.volumeModifier}set VolumeModifier(t){this.volumeModifier=t}get DurationModifier(){return this.durationModifier}set DurationModifier(t){this.durationModifier=t}hasArticulation(t){for(const e of this.articulations)if(e.Equals(t))return!0;return!1}static isSupportedArticulation(t){switch(t){case wt.accent:case wt.strongaccent:case wt.invertedstrongaccent:case wt.staccato:case wt.staccatissimo:case wt.spiccato:case wt.tenuto:case wt.fermata:case wt.invertedfermata:case wt.breathmark:case wt.caesura:case wt.lefthandpizzicato:case wt.naturalharmonic:case wt.snappizzicato:case wt.upbow:case wt.downbow:case wt.bend:case wt.detachedlegato:return!0;default:return!1}}hasTie(){for(let t=0,e=this.Notes.length;t<e;++t)if(this.Notes[t].NoteTie)return!0;return!1}hasSlur(){for(let t=0,e=this.Notes.length;t<e;++t)if(this.Notes[t].NoteSlurs.length>0)return!0;return!1}isStaccato(){for(const t of this.Articulations)if(t.articulationEnum===wt.staccato)return!0;return!1}isAccent(){for(const t of this.Articulations)if(t.articulationEnum===wt.accent||t.articulationEnum===wt.strongaccent)return!0;return!1}getVerseNumberForLyricEntry(t){let e=1;return this.lyricsEntries.forEach((i,s)=>{t===s&&(e=i)}),e}}var wt=(n=>(n[n.accent=0]="accent",n[n.strongaccent=1]="strongaccent",n[n.marcatoup=2]="marcatoup",n[n.marcatodown=3]="marcatodown",n[n.invertedstrongaccent=4]="invertedstrongaccent",n[n.staccato=5]="staccato",n[n.staccatissimo=6]="staccatissimo",n[n.spiccato=7]="spiccato",n[n.tenuto=8]="tenuto",n[n.fermata=9]="fermata",n[n.invertedfermata=10]="invertedfermata",n[n.breathmark=11]="breathmark",n[n.caesura=12]="caesura",n[n.lefthandpizzicato=13]="lefthandpizzicato",n[n.naturalharmonic=14]="naturalharmonic",n[n.snappizzicato=15]="snappizzicato",n[n.upbow=16]="upbow",n[n.downbow=17]="downbow",n[n.scoop=18]="scoop",n[n.plop=19]="plop",n[n.doit=20]="doit",n[n.falloff=21]="falloff",n[n.stress=22]="stress",n[n.unstress=23]="unstress",n[n.detachedlegato=24]="detachedlegato",n[n.otherarticulation=25]="otherarticulation",n[n.bend=26]="bend",n))(wt||{}),Ft=(n=>(n[n.Undefined=-1]="Undefined",n[n.Up=0]="Up",n[n.Down=1]="Down",n[n.None=2]="None",n[n.Double=3]="Double",n))(Ft||{}),ns=(n=>(n[n.MeasureBegin=0]="MeasureBegin",n[n.MeasureEnd=1]="MeasureEnd",n))(ns||{});class Se extends Tn{constructor(t,e,i,s,r=void 0){super(),this.label=t,this.boundingBox=new le(this,r),this.label.fontHeight=e,this.label.textAlignment=i,this.rules=s,this.rules.MpatMode&&this.label.text==="TRIO"&&(this.label.fontFamily="Arial")}get Label(){return this.label}toString(){return`${this.label.text} (${this.boundingBox.RelativePosition.x},${this.boundingBox.RelativePosition.y})`}setLabelPositionAndShapeBorders(){var a,l;if(this.Label.text.trim()==="")return;this.TextLines=[];const t=(l=(a=this.rules)==null?void 0:a.LabelMarginBorderFactor)!=null?l:.1,e=this.Label.text.split(/[\n\r]+/g),i=e.length;let s=0;for(let h=0;h<i;h++){const c=e[h].trim();if(!c||c==="")continue;const u=Lt.TextMeasurer.computeTextWidthToHeightRatio(c,this.Label.font,this.Label.fontStyle,this.label.fontFamily),f=this.Label.fontHeight*u;s=Math.max(s,f),this.TextLines.push({text:c,xOffset:0,width:f})}for(const h of this.TextLines){let c=0;switch(this.Label.textAlignment){case vt.RightBottom:case vt.RightCenter:case vt.RightTop:c=s-h.width;break;case vt.CenterBottom:case vt.CenterCenter:case vt.CenterTop:c=(s-h.width)/2;break}h.xOffset=c}let r=this.Label.fontHeight*i;this.rules.SpacingBetweenTextLines>0&&this.TextLines.length>1&&(r+=this.rules.SpacingBetweenTextLines*i/10);const o=this.PositionAndShape;switch(this.Label.textAlignment){case vt.CenterBottom:o.BorderTop=-r,o.BorderLeft=-s/2,o.BorderBottom=0,o.BorderRight=s/2;break;case vt.CenterCenter:o.BorderTop=-r/2,o.BorderLeft=-s/2,o.BorderBottom=r/2,o.BorderRight=s/2;break;case vt.CenterTop:o.BorderTop=0,o.BorderLeft=-s/2,o.BorderBottom=r,o.BorderRight=s/2;break;case vt.LeftBottom:o.BorderTop=-r,o.BorderLeft=0,o.BorderBottom=0,o.BorderRight=s;break;case vt.LeftCenter:o.BorderTop=-r/2,o.BorderLeft=0,o.BorderBottom=r/2,o.BorderRight=s;break;case vt.LeftTop:o.BorderTop=0,o.BorderLeft=0,o.BorderBottom=r,o.BorderRight=s;break;case vt.RightBottom:o.BorderTop=-r,o.BorderLeft=-s,o.BorderBottom=0,o.BorderRight=0;break;case vt.RightCenter:o.BorderTop=-r/2,o.BorderLeft=-s,o.BorderBottom=r/2,o.BorderRight=0;break;case vt.RightTop:o.BorderTop=0,o.BorderLeft=-s,o.BorderBottom=r,o.BorderRight=0;break}o.BorderMarginTop=o.BorderTop-r*t,o.BorderMarginLeft=o.BorderLeft-r*t,o.BorderMarginBottom=o.BorderBottom+r*t,o.BorderMarginRight=o.BorderRight+r*t}}class jt{constructor(t="",e=vt.CenterBottom,i=void 0,s=!0){this.IsCreditLabel=!1,this.text=t,this.print=s,this.textAlignment=e,this.font=i,this.fontFamily=void 0}set font(t){this.fontEnumValue=t,this.fontFamily=Jh[t]}get font(){return this.fontEnumValue}ToString(){return this.text}}const Lr={Grava:40,Largo:46,Lento:52,Adagio:56,Larghetto:60,Andante:66,Anderato:69,Andantino:69,Moderato:88,Allegretto:108,"Allegro Moderato":108,Allegro:132,Vivace:152,Vivo:160,Vivacissimo:168,Presto:184,Prestissimo:208},Qc=["\u7EAF\u5F8B","\u7EAF\u5F8B\u7ED3\u675F"],$c=["\u8DF3\u8FC7\u4E0B\u4E00\u4E2A","b","#","\xA7","\xBA","X"],Ga=["poco rit.","rall.","rit.","accel.","molto rit.","molto rall","lentando","poco accel.","calando"],Wa="\u7ED3\u675F\u8303\u56F4\u901F\u5EA6",$1="a tempo",tu=[Wa],Ua="\u901F\u5EA6 ",za="\u4EC5\u6587\u672C\u901F\u5EA6 ";function ps(n){return n.indexOf(Ua)===0}function An(n){return n.indexOf(za)===0}function eu(n){return n.replace(za,"").replace(Ua,"")}function tp(n){return Ga.includes(n)}function Ha(n){return[...Object.keys(Lr),...Qc,...tu,...$c].map(t=>t.trim().toLocaleUpperCase()).includes(n.toLocaleUpperCase().trim())}function $o(n){return[vt.CenterTop,vt.RightTop].includes(n)}var Ge=(n=>(n[n.Unused_first_Symbol=0]="Unused_first_Symbol",n[n.BLACK_HEAD=1]="BLACK_HEAD",n[n.UPWARDS_TAIL=2]="UPWARDS_TAIL",n[n.DOWNWARDS_TAIL=3]="DOWNWARDS_TAIL",n[n.UPWARDS_DOUBLE_TAIL=4]="UPWARDS_DOUBLE_TAIL",n[n.DOWNWARDS_DOUBLE_TAIL=5]="DOWNWARDS_DOUBLE_TAIL",n[n.UPWARDS_TRIPLE_TAIL=6]="UPWARDS_TRIPLE_TAIL",n[n.DOWNWARDS_TRIPLE_TAIL=7]="DOWNWARDS_TRIPLE_TAIL",n[n.UPWARDS_QUAD_TAIL=8]="UPWARDS_QUAD_TAIL",n[n.DOWNWARDS_QUAD_TAIL=9]="DOWNWARDS_QUAD_TAIL",n[n.ROUND_HEAD=10]="ROUND_HEAD",n[n.WHITE_HEAD=11]="WHITE_HEAD",n[n.G_CLEF=12]="G_CLEF",n[n.F_CLEF=13]="F_CLEF",n[n.C_CLEF=14]="C_CLEF",n[n.BREVE=15]="BREVE",n[n.BREVE_REST=16]="BREVE_REST",n[n.COMMON_TIME=17]="COMMON_TIME",n[n.CUT_TIME=18]="CUT_TIME",n[n.WHOLE_REST=19]="WHOLE_REST",n[n.HALF_REST=20]="HALF_REST",n[n.QUARTER_REST=21]="QUARTER_REST",n[n.EIGHTH_REST=22]="EIGHTH_REST",n[n.SIXTEENTH_REST=23]="SIXTEENTH_REST",n[n.THIRTYSECOND_REST=24]="THIRTYSECOND_REST",n[n.SIXTYFOURTH_REST=25]="SIXTYFOURTH_REST",n[n.FLAT=26]="FLAT",n[n.SHARP=27]="SHARP",n[n.NATURAL=28]="NATURAL",n[n.DOUBLE_FLAT=29]="DOUBLE_FLAT",n[n.DOUBLE_SHARP=30]="DOUBLE_SHARP",n[n.ZERO=31]="ZERO",n[n.ONE=32]="ONE",n[n.TWO=33]="TWO",n[n.THREE=34]="THREE",n[n.FOUR=35]="FOUR",n[n.FIVE=36]="FIVE",n[n.SIX=37]="SIX",n[n.SEVEN=38]="SEVEN",n[n.EIGHT=39]="EIGHT",n[n.NINE=40]="NINE",n[n.DOT=41]="DOT",n[n.FERMATA=42]="FERMATA",n[n.INVERTED_FERMATA=43]="INVERTED_FERMATA",n[n.SPICCATO=44]="SPICCATO",n[n.TENUTO=45]="TENUTO",n[n.MARCATO=46]="MARCATO",n[n.MARCATISSIMO=47]="MARCATISSIMO",n[n.INVERTED_MARCATISSIMO=48]="INVERTED_MARCATISSIMO",n[n.P=49]="P",n[n.F=50]="F",n[n.S=51]="S",n[n.Z=52]="Z",n[n.M=53]="M",n[n.R=54]="R",n[n.SEGNO=55]="SEGNO",n[n.CODA=56]="CODA",n[n.DRUM_CLEF=57]="DRUM_CLEF",n[n.G_CLEF_SUB8=58]="G_CLEF_SUB8",n[n.G_CLEF_SUPER8=59]="G_CLEF_SUPER8",n[n.G_CLEF_SUB15=60]="G_CLEF_SUB15",n[n.G_CLEF_SUPER15=61]="G_CLEF_SUPER15",n[n.F_CLEF_SUB8=62]="F_CLEF_SUB8",n[n.F_CLEF_SUPER8=63]="F_CLEF_SUPER8",n[n.F_CLEF_SUB15=64]="F_CLEF_SUB15",n[n.F_CLEF_SUPER15=65]="F_CLEF_SUPER15",n[n.DOWN_BOW=66]="DOWN_BOW",n[n.MORDENT=67]="MORDENT",n[n.INVERTED_MORDENT=68]="INVERTED_MORDENT",n[n.TURN=69]="TURN",n[n.INVERTED_TURN=70]="INVERTED_TURN",n[n.LEFTHAND_PIZZICATO=71]="LEFTHAND_PIZZICATO",n[n.RELEASE_PED=72]="RELEASE_PED",n[n.ENGAGE_PED=73]="ENGAGE_PED",n[n.VA8=74]="VA8",n[n.VB8=75]="VB8",n[n.TRILL=76]="TRILL",n[n.MA15=77]="MA15",n[n.MB15=78]="MB15",n[n.HIGH=79]="HIGH",n[n.PLAY=80]="PLAY",n[n.MIC=81]="MIC",n[n.SNAP_PIZZICATO=82]="SNAP_PIZZICATO",n[n.NATURAL_HARMONIC=83]="NATURAL_HARMONIC",n[n.EditPen=84]="EditPen",n[n.PEDAL_BRACKET=85]="PEDAL_BRACKET",n[n.PEDAL_MIXED=86]="PEDAL_MIXED",n[n.PEDAL_SYMBOL=87]="PEDAL_SYMBOL",n))(Ge||{}),xn=(n=>(n[n.Normal=0]="Normal",n[n.Disabled=1]="Disabled",n[n.Selected=2]="Selected",n[n.Clickable=3]="Clickable",n[n.PlaybackSymbols=4]="PlaybackSymbols",n[n.FollowSymbols=5]="FollowSymbols",n[n.QFeedbackNotFound=6]="QFeedbackNotFound",n[n.QFeedbackOk=7]="QFeedbackOk",n[n.QFeedbackPerfect=8]="QFeedbackPerfect",n[n.Debug1=9]="Debug1",n[n.Debug2=10]="Debug2",n[n.Debug3=11]="Debug3",n))(xn||{}),vn=(n=>(n[n.Following=0]="Following",n[n.Midi=1]="Midi",n[n.Manual=2]="Manual",n))(vn||{});class ta{}class iu{constructor(t,e){this.drawableBoundingBoxElement="None",this.skyLineVisible=!1,this.bottomLineVisible=!1,this.phonicScoreMode=vn.Manual,this.textMeasurer=t,this.splitScreenLineColor=-1,this.drawingParameters=e,this.rules=e.Rules}set Mode(t){this.phonicScoreMode=t}drawSheet(t){if(this.graphicalMusicSheet=t,this.rules=t.ParentMusicSheet.Rules,this.drawSplitScreenLine(),this.drawingParameters.drawCursors)for(const i of t.Cursors){if(!i)continue;const s=new le(i);s.AbsolutePosition=i.Start,s.BorderBottom=i.End.y-i.Start.y,s.BorderRight=i.Width/2,s.BorderLeft=-i.Width/2,this.isVisible(s)&&this.drawLineAsVerticalRectangle(i,pe.Cursor)}this.drawingParameters.drawScrollIndicator&&this.drawScrollIndicator();const e=Math.min(this.graphicalMusicSheet.MusicPages.length,this.rules.MaxPageToDrawNumber);for(let i=0;i<e;i++){const s=this.graphicalMusicSheet.MusicPages[i];this.drawPage(s)}}drawLineAsHorizontalRectangle(t,e){let i=new Qe(t.Start.x,t.End.y-t.Width/2,t.End.x-t.Start.x,t.Width);i=this.applyScreenTransformationForRect(i),this.renderRectangle(i,e,t.styleId,t.colorHex)}drawLineAsVerticalRectangle(t,e){const i=t.Start,s=t.Width;let r=new Qe(i.x-s/2,i.y,s,t.End.y-i.y);r=this.applyScreenTransformationForRect(r),this.renderRectangle(r,e,t.styleId)}drawLineAsHorizontalRectangleWithOffset(t,e,i){const s=new O(t.Start.x+e.x,t.Start.y+e.y),r=new O(t.End.x+e.x,t.End.y+e.y),o=t.Width;let a=new Qe(s.x,r.y-o/2,r.x-s.x,o);a=this.applyScreenTransformationForRect(a),this.renderRectangle(a,i,t.styleId)}drawLineAsVerticalRectangleWithOffset(t,e,i){const s=new O(t.Start.x+e.x,t.Start.y+e.y),r=new O(t.End.x+e.x,t.End.y+e.y),o=t.Width;let a=new Qe(s.x,s.y,o,r.y-s.y);a=this.applyScreenTransformationForRect(a),this.renderRectangle(a,i,t.styleId)}drawRectangle(t,e){const i=t.PositionAndShape;let s=new Qe(i.AbsolutePosition.x,i.AbsolutePosition.y,i.BorderRight,i.BorderBottom);s=this.applyScreenTransformationForRect(s),this.renderRectangle(s,e,t.style)}drawLabel(t,e){var c,u,f,d,p,g;const i=this.graphicalMusicSheet.GetNearestNote(t.PositionAndShape.AbsolutePosition);if(!this.isVisible(t.PositionAndShape))return;const s=t.Label;if(s.text.trim()==="")return;const r=this.calculateLabel(t),o=this.applyScreenTransformation(t.PositionAndShape.AbsolutePosition),a=t.PositionAndShape.Parent.DataObject;if(this.rules.MetronomeMarksDrawn&&((u=(c=a==null?void 0:a.measures)==null?void 0:c[0])==null?void 0:u.MeasureNumber)===1&&((f=a==null?void 0:a.ParentMusicSystem)==null?void 0:f.Id)===0&&$o(t.Label.textAlignment)&&(r.ScreenPosition.y-=1*10),s.text==="\uFF0C"){let m=0;m=((d=i.sourceNote.SourceMeasure.VerticalMeasureList[0])==null?void 0:d.getVFStave()).end_x;const b=0;r.ScreenPosition.x=m,r.ScreenPosition.y=(t.PositionAndShape.Parent.AbsolutePosition.y-3-b)*10}const l=t.PositionAndShape.Size.width/2*10;if(o.x-l<t.PositionAndShape.RelativePosition.x&&(r.ScreenPosition.x=(t.PositionAndShape.RelativePosition.x+this.rules.PageLeftMargin)*10),Ha(t.Label.text||"")&&(t.Label.fontHeight=0),this.rules.MetronomeMarksDrawn&&t.Label.fontHeight>0&&($o(t.Label.textAlignment)||[vt.CenterBottom].includes(t.Label.textAlignment))){let m=-1,S=!1;for(const b of(a==null?void 0:a.AbstractExpressions)||[])if(b.Label===t?m=(p=b==null?void 0:b.parentMeasure)==null?void 0:p.measureListIndex:(g=b.expression)!=null&&g.TempoInBpm&&(S=b.expression.TempoInBpm>0),S&&m>-1){r.ScreenPosition.y-=4*10;break}}this.rules.DYMusicScoreType==="jianpu"?isNaN(parseInt(t.Label.text,10))&&this.renderLabel(t,e,r):this.renderLabel(t,e,r)}calculateLabel(t){const e=new ta,i=t.Label,s=new le(this);s.AbsolutePosition.x=t.PositionAndShape.AbsolutePosition.x,s.AbsolutePosition.y=t.PositionAndShape.AbsolutePosition.y||t.PositionAndShape.Parent.AbsolutePosition.y,e.ScreenPosition=this.applyScreenTransformation(s.AbsolutePosition),e.FontHeightInPixel=this.calculatePixelDistance(i.fontHeight);const r=this.calculatePixelDistance(t.PositionAndShape.Size.width);switch(e.BitmapWidth=Math.ceil(r),e.BitmapHeight=t.TextLines?Math.ceil(e.FontHeightInPixel*(.2+t.TextLines.length)):10,i.textAlignment){case vt.LeftTop:e.ScreenPosition.x-=e.BitmapWidth/2,e.ScreenPosition.y+=e.BitmapHeight*1.5;break;case vt.LeftCenter:e.ScreenPosition.y-=e.BitmapHeight/2;break;case vt.LeftBottom:e.ScreenPosition.y-=e.BitmapHeight;break;case vt.CenterTop:e.ScreenPosition.x-=e.BitmapWidth/2;break;case vt.CenterCenter:e.ScreenPosition.x-=e.BitmapWidth/2,e.ScreenPosition.y-=e.BitmapHeight/2;break;case vt.CenterBottom:e.ScreenPosition.x-=e.BitmapWidth/2,e.ScreenPosition.y-=e.BitmapHeight;break;case vt.RightTop:e.ScreenPosition.x-=e.BitmapWidth;break;case vt.RightCenter:e.ScreenPosition.x-=e.BitmapWidth,e.ScreenPosition.y-=e.BitmapHeight/2;break;case vt.RightBottom:e.ScreenPosition.x-=e.BitmapWidth,e.ScreenPosition.y-=e.BitmapHeight;break;default:throw new Li("")}return e}applyScreenTransformations(t){const e=[];for(const i of t)e.push(this.applyScreenTransformation(i));return e}drawSplitScreenLine(){}renderRectangle(t,e,i,s=void 0,r=1){throw new Error("not implemented")}drawScrollIndicator(){}drawSelectionStartSymbol(t){}drawSelectionEndSymbol(t){}renderLabel(t,e,i){throw new Error("not implemented")}renderSystemToScreen(t,e,i){}drawSkyLine(t){}drawBottomLine(t){}drawInstrumentBrace(t,e){}drawGroupBracket(t,e){}isVisible(t){return!0}drawMusicSystem(t){const e=this.getSystemAbsBoundingRect(t),i=this.getSytemBoundingBoxInPixels(e);this.drawMusicSystemComponents(t,i,e)}getSytemBoundingBoxInPixels(t){const e=this.applyScreenTransformationForRect(t);return e.x=Math.round(e.x),e.y=Math.round(e.y),e}getSystemAbsBoundingRect(t){const e=t.PositionAndShape.BoundingRectangle;return new Qe(t.PositionAndShape.AbsolutePosition.x+t.PositionAndShape.BorderLeft-1,t.PositionAndShape.AbsolutePosition.y+t.PositionAndShape.BorderTop-1,e.width+6,e.height+2)}drawMusicSystemComponents(t,e,i){const s=this.graphicalMusicSheet.SelectionStartSymbol,r=this.graphicalMusicSheet.SelectionEndSymbol;this.drawingParameters.drawSelectionStartSymbol&&s!==void 0&&this.isVisible(s.PositionAndShape)&&this.drawSelectionStartSymbol(s),this.drawingParameters.drawSelectionEndSymbol&&r!==void 0&&this.isVisible(r.PositionAndShape)&&this.drawSelectionEndSymbol(r);for(const l of t.StaffLines)this.drawStaffLine(l),this.rules.RenderLyrics&&(l.LyricsDashes.length>0&&this.drawDashes(l.LyricsDashes),l.LyricLines.length>0&&this.drawLyricLines(l.LyricLines,l));for(const l of t.SystemLines)this.drawSystemLineObject(l);if(t.Parent===t.Parent.Parent.MusicPages[0])for(const l of t.Labels)l.SVGNode=this.drawLabel(l,pe.Notes);const o=this.graphicalMusicSheet.ParentMusicSheet.Instruments,a=o.filter(l=>l.Visible).length;for(const l of t.InstrumentBrackets)this.drawInstrumentBrace(l,t);if(o.length>0)if(a>1)for(const l of t.GroupBrackets)this.drawGroupBracket(l,t);else for(const l of t.GroupBrackets)l.Visible=!1;if(!this.leadSheet)for(const l of t.MeasureNumberLabels)l.SVGNode=this.drawLabel(l,pe.Notes);for(const l of t.StaffLines)this.drawStaffLineSymbols(l);this.drawingParameters.drawMarkedAreas&&this.drawMarkedAreas(t)}activateSystemRendering(t,e,i,s){return!0}drawSystemLineObject(t){}drawStaffLine(t){for(const e of t.Measures)this.drawMeasure(e);this.rules.RenderLyrics&&t.LyricsDashes.length>0&&this.drawDashes(t.LyricsDashes),this.drawOctaveShifts(t),this.drawPedals(t),this.drawWavyLines(t),this.drawExpressions(t),this.skyLineVisible&&this.drawSkyLine(t),this.bottomLineVisible&&this.drawBottomLine(t)}drawLyricLines(t,e){e.LyricLines.forEach(i=>{i.Start.y+=e.PositionAndShape.AbsolutePosition.y,i.End.y+=e.PositionAndShape.AbsolutePosition.y,i.Start.x+=e.PositionAndShape.AbsolutePosition.x,i.End.x+=e.PositionAndShape.AbsolutePosition.x,this.drawGraphicalLine(i,this.rules.LyricUnderscoreLineWidth)})}drawExpressions(t){}drawGraphicalLine(t,e,i="black"){return this.drawLine(t.Start,t.End,i,e)}drawLine(t,e,i="#FF0000FF",s){}drawDashes(t){t.forEach(e=>e.SVGNode=this.drawLabel(e,pe.Notes))}drawOctaveShifts(t){}drawStaffLines(t){if(t.StaffLines){const e=t.PositionAndShape.AbsolutePosition;for(let i=0;i<5;i++)this.drawLineAsHorizontalRectangleWithOffset(t.StaffLines[i],e,pe.Notes)}}drawSymbol(t,e,i,s=1,r=pe.Notes){}get leadSheet(){return this.graphicalMusicSheet.LeadSheet}set leadSheet(t){this.graphicalMusicSheet.LeadSheet=t}drawPage(t){if(!!this.isVisible(t.PositionAndShape)){for(const e of t.MusicSystems)this.isVisible(e.PositionAndShape)&&this.drawMusicSystem(e);if(t===t.Parent.MusicPages[0])for(const e of t.Labels)e.SVGNode=this.drawLabel(e,pe.Notes);this.drawableBoundingBoxElement&&this.drawBoundingBoxes(t.PositionAndShape,0,this.drawableBoundingBoxElement)}}drawBoundingBoxes(t,e=0,i="all"){const s=t.DataObject.constructor.name;let r=!1;i==="all"&&(r=!0),(r||s===i)&&this.drawBoundingBox(t,void 0,!0,s,e),e++,t.ChildElements.forEach(o=>this.drawBoundingBoxes(o,e,i))}drawBoundingBox(t,e=void 0,i=!1,s=void 0,r=0){let o=new Qe(t.AbsolutePosition.x+t.BorderMarginLeft,t.AbsolutePosition.y+t.BorderMarginTop,t.BorderMarginRight-t.BorderMarginLeft,t.BorderMarginBottom-t.BorderMarginTop);i&&(this.drawLineAsHorizontalRectangle(new ci(new O(t.AbsolutePosition.x-1,t.AbsolutePosition.y),new O(t.AbsolutePosition.x+1,t.AbsolutePosition.y),.1,fs.BaseWritingColor,e),r-1),this.drawLineAsVerticalRectangle(new ci(new O(t.AbsolutePosition.x,t.AbsolutePosition.y-1),new O(t.AbsolutePosition.x,t.AbsolutePosition.y+1),.1,fs.BaseWritingColor,e),r-1)),o=this.applyScreenTransformationForRect(o);const a=this.renderRectangle(o,pe.Background,r,e,.5);if(s){const l=new jt(s),h=new ta;h.BitmapWidth=o.width,h.BitmapHeight=o.height,h.FontHeightInPixel=o.height,h.ScreenPosition=new O(o.x,o.y+12),this.renderLabel(new Se(l,.8,vt.CenterCenter,this.rules),r,h)}return a}drawMarkedAreas(t){for(const e of t.GraphicalMarkedAreas)e&&(e.systemRectangle&&this.drawRectangle(e.systemRectangle,pe.Background),e.settings&&(e.settings.SVGNode=this.drawLabel(e.settings,pe.Comment)),e.labelRectangle&&this.drawRectangle(e.labelRectangle,pe.Background),e.label&&(e.label.SVGNode=this.drawLabel(e.label,pe.Comment)))}drawStaffLineSymbols(t){const e=t.ParentStaff.ParentInstrument,i=t.PositionAndShape.AbsolutePosition.x,s=t.PositionAndShape.AbsolutePosition.y+2,r=t.PositionAndShape.BorderRight;e.highlight&&this.drawingParameters.drawHighlights&&this.drawLineAsHorizontalRectangle(new ci(new O(i,s),new O(i+r,s),4,fs.Highlighted),pe.Highlight);let o=xn.Disabled,a=Ge.PLAY,l=this.drawingParameters.drawActivitySymbols;switch(this.phonicScoreMode){case vn.Midi:a=Ge.PLAY,this.midiPlaybackAvailable&&t.ParentStaff.audible&&(o=xn.PlaybackSymbols);break;case vn.Following:a=Ge.MIC,t.ParentStaff.following&&(o=xn.FollowSymbols);break;default:l=!1;break}if(l){const h=new O(i+r+2,s);this.drawSymbol(a,o,h)}if(this.drawingParameters.drawErrors)for(const h of t.Measures){const c=h.PositionAndShape,u=c.AbsolutePosition.x,f=c.AbsolutePosition.y+2;h.hasError&&this.graphicalMusicSheet.ParentMusicSheet.DrawErroneousMeasures&&this.drawLineAsHorizontalRectangle(new ci(new O(u,f),new O(u+c.BorderRight,f),4,fs.ErrorUnderlay),pe.MeasureError)}}}class Xa{constructor(t){this.fontSize=20,this.fontSizeStandard=this.fontSize;const e=document.createElement("canvas");this.context=e.getContext("2d"),this.rules=t}computeTextWidthToHeightRatio(t,e,i,s=void 0,r=this.fontSize){return this.context.font=Yt.font(r,i,e,this.rules,s),this.context.measureText(t).width/r}setFontSize(t=this.fontSizeStandard){return this.fontSize=t,t}}class sr extends Pe{constructor(t,e,i){super(),this.expression=e,this.parentMeasure=i,this.boundingBox=new le(this,t.PositionAndShape),this.parentStaffLine=t,this.parentStaffLine.AbstractExpressions.push(this),this.rules=t.ParentMusicSystem.rules}get Label(){return this.label}get ParentStaffLine(){return this.parentStaffLine}get SourceExpression(){return this.expression}get Placement(){return this.expression.Placement}}class Tr extends sr{constructor(t,e){super(e.PositionAndShape.Parent.DataObject,t,t.parentMeasure),this.label=e}get GraphicalLabel(){return this.label}updateSkyBottomLine(){}}class Ya extends sr{constructor(t,e,i){super(e,t,i.parentSourceMeasure),this.mInstantaneousDynamicExpression=t,this.mMeasure=i}updateSkyBottomLine(){const t=this.parentStaffLine.SkyBottomLineCalculator,e=this.PositionAndShape.RelativePosition.x+this.PositionAndShape.BorderMarginLeft,i=this.PositionAndShape.RelativePosition.x+this.PositionAndShape.BorderMarginRight;let s=0;switch(this.Placement){case z.Above:s=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginTop,t.updateSkyLineInRange(e,i,s);break;case z.Below:s=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginBottom,t.updateBottomLineInRange(e,i,s);break;default:j.error("Placement for GraphicalInstantaneousDynamicExpression is unknown")}}}class xo extends sr{constructor(t,e,i){super(e,t,i),this.lines=[],this.isSplittedPart=!1,this.notToBeRemoved=!1}get StartMeasure(){return this.startMeasure}set StartMeasure(t){this.startMeasure=t}get EndMeasure(){return this.endMeasure}set EndMeasure(t){this.endMeasure=t}get EndStaffLine(){return this.endMeasure?this.endMeasure.ParentStaffLine:void 0}get IsSplittedPart(){return this.isSplittedPart}set IsSplittedPart(t){this.isSplittedPart=t}get IsVerbal(){return this.ContinuousDynamic.Label&&this.ContinuousDynamic.Label.length>0}get NotToBeRemoved(){return this.notToBeRemoved}set NotToBeRemoved(t){this.notToBeRemoved=t}get Lines(){return this.lines}get ContinuousDynamic(){return this.SourceExpression}updateSkyBottomLine(){var s;const t=this.parentStaffLine.SkyBottomLineCalculator,e=this.IsVerbal?this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginLeft:0,i=this.IsVerbal?this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginRight:0;switch(!this.IsVerbal&&this.lines.length<2&&j.warn("Not enough lines for SkyBottomLine calculation"),this.IsVerbal||this.ContinuousDynamic.DynamicType!==Re.crescendo&&this.ContinuousDynamic.DynamicType!==Re.diminuendo&&j.warn("GraphicalContinuousDynamicExpression.updateSkyBottomLine(): unhandled continuous dynamic type. start measure: "+((s=this.startMeasure)==null?void 0:s.MeasureNumber)),this.Placement){case z.Above:if(!this.IsVerbal)this.ContinuousDynamic.DynamicType===Re.crescendo?t.updateSkyLineWithWedge(this.lines[0].Start,this.lines[0].End):this.ContinuousDynamic.DynamicType===Re.diminuendo&&t.updateSkyLineWithWedge(this.lines[0].End,this.lines[0].Start);else{const r=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;t.updateSkyLineInRange(e,i,r)}break;case z.Below:if(!this.IsVerbal)this.ContinuousDynamic.DynamicType===Re.crescendo?t.updateBottomLineWithWedge(this.lines[1].Start,this.lines[1].End):this.ContinuousDynamic.DynamicType===Re.diminuendo&&t.updateBottomLineWithWedge(this.lines[1].End,this.lines[1].Start);else{const r=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;t.updateBottomLineInRange(e,i,r)}break;default:j.error("Placement for GraphicalContinuousDynamicExpression is unknown")}}createCrescendoLines(t,e,i,s=this.rules.WedgeOpeningLength,r=this.rules.WedgeLineWidth){const o=new O(t,i),a=new O(e,i-s/2),l=new O(e,i+s/2);this.addWedgeLines(o,a,l,r)}createFirstHalfCrescendoLines(t,e,i,s=this.rules.WedgeMeasureEndOpeningLength,r=this.rules.WedgeLineWidth){const o=new O(t,i),a=new O(e,i-s/2),l=new O(e,i+s/2);this.addWedgeLines(o,a,l,r)}createSecondHalfCrescendoLines(t,e,i,s=this.rules.WedgeMeasureBeginOpeningLength,r=this.rules.WedgeOpeningLength,o=this.rules.WedgeLineWidth){const a=new O(t,i-s/2),l=new O(t,i+s/2),h=new O(e,i-r/2),c=new O(e,i+r/2);this.addDoubleLines(a,h,l,c,o)}recalculateCrescendoLines(t,e,i){const s=Math.abs(this.lines[0].Start.y-this.lines[1].Start.y)>1e-4;this.lines.clear(),s?this.createSecondHalfCrescendoLines(t,e,i):this.isSplittedPart?this.createFirstHalfCrescendoLines(t,e,i):this.createCrescendoLines(t,e,i)}createDiminuendoLines(t,e,i,s=this.rules.WedgeOpeningLength,r=this.rules.WedgeLineWidth){const o=new O(t,i-s/2),a=new O(t,i+s/2),l=new O(e,i);this.addWedgeLines(l,o,a,r)}createFirstHalfDiminuendoLines(t,e,i,s=this.rules.WedgeOpeningLength,r=this.rules.WedgeMeasureEndOpeningLength,o=this.rules.WedgeLineWidth){const a=new O(t,i-s/2),l=new O(t,i+s/2),h=new O(e,i-r/2),c=new O(e,i+r/2);this.addDoubleLines(a,h,l,c,o)}createSecondHalfDiminuendoLines(t,e,i,s=this.rules.WedgeMeasureBeginOpeningLength,r=this.rules.WedgeLineWidth){const o=new O(t,i-s/2),a=new O(t,i+s/2),l=new O(e,i);this.addWedgeLines(l,o,a,r)}recalculateDiminuendoLines(t,e,i){const s=Math.abs(this.lines[0].End.y-this.lines[1].End.y)>1e-4;this.lines.clear(),s?this.createFirstHalfDiminuendoLines(t,e,i):this.isSplittedPart?this.createSecondHalfDiminuendoLines(t,e,i):this.createDiminuendoLines(t,e,i)}calcPsi(){if(this.IsVerbal){this.PositionAndShape.calculateBoundingBox();return}this.PositionAndShape.RelativePosition=this.lines[0].Start,this.PositionAndShape.BorderMarginTop=this.lines[0].End.y-this.lines[0].Start.y,this.PositionAndShape.BorderMarginBottom=this.lines[1].End.y-this.lines[1].Start.y,this.PositionAndShape.Center.y=(this.PositionAndShape.BorderMarginTop+this.PositionAndShape.BorderMarginBottom)/2,this.ContinuousDynamic.DynamicType===Re.crescendo?(this.PositionAndShape.BorderMarginLeft=0,this.PositionAndShape.BorderMarginRight=this.lines[0].End.x-this.lines[0].Start.x):(this.PositionAndShape.BorderMarginLeft=this.lines[0].End.x-this.lines[0].Start.x,this.PositionAndShape.BorderMarginRight=0)}cleanUp(){this.lines.clear()}shiftYPosition(t){this.IsVerbal?(this.PositionAndShape.RelativePosition.y+=t,this.PositionAndShape.calculateBoundingBox()):(this.lines[0].Start.y+=t,this.lines[0].End.y+=t,this.lines[1].End.y+=t)}squeeze(t){this.IsVerbal||Math.abs(this.lines[0].End.x-this.lines[0].Start.x)<Math.abs(t)||(this.ContinuousDynamic.DynamicType===Re.crescendo?t>0?this.lines[0].Start.x+=t:(this.lines[0].End.x+=t,this.lines[1].End.x+=t):t<0?this.lines[0].Start.x+=t:(this.lines[0].End.x+=t,this.lines[1].End.x+=t),this.calcPsi())}addWedgeLines(t,e,i,s){const r=new ci(t,e,s),o=new ci(t,i,s);this.lines.push(r),this.lines.push(o)}addDoubleLines(t,e,i,s,r){const o=new ci(t,e,r),a=new ci(i,s,r);this.lines.push(o),this.lines.push(a)}}class Us extends sr{constructor(t,e,i,s,r=void 0){super(t,new Ii(i),s),this.label=e,this.sourceMultiExpression=r}updateSkyBottomLine(){const t=this.parentStaffLine.SkyBottomLineCalculator,e=this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginLeft,i=this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginRight;switch(this.Placement){case z.Above:const s=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;t.updateSkyLineInRange(e,i,s);break;case z.Below:const r=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;t.updateBottomLineInRange(e,i,r);break;default:j.error("Placement for GraphicalUnknownExpression is unknown")}}}const _t=10;class su extends iu{constructor(t=new Ja){super(new Xa(t.Rules),t),this.backends=[],this.zoom=1,this.pageIdx=0,this.getDotId=(e,i)=>i?String(e.Label.PositionAndShape.RelativePosition[i]):String(e.Label.PositionAndShape.RelativePosition.x)+String(e.Label.PositionAndShape.RelativePosition.y),this.hasDot=(e,i,s,r)=>{const o=i||Object.values(r);for(const a of o){if(s)return e.x===a.x&&e.y===a.y;if(e.x===a.x)return!0}return!1}}get Zoom(){return this.zoom}get Backends(){return this.backends}initializeBackendForPage(t){this.backend=this.backends[t.PageNumber-1]}drawSheet(t){var e,i,s;this.rules.DefaultVexFlowNoteFont==="gonville"&&(M.Flow.DEFAULT_FONT_STACK=[(e=M.Flow.Fonts)==null?void 0:e.Gonville,(i=M.Flow.Fonts)==null?void 0:i.Bravura,(s=M.Flow.Fonts)==null?void 0:s.Custom]),M.Flow.STAVE_LINE_THICKNESS=this.rules.StaffLineWidth*_t,M.Flow.STEM_WIDTH=this.rules.StemWidth*_t,M.Flow.DEFAULT_NOTATION_FONT_SCALE=this.rules.VexFlowDefaultNotationFontScale,M.Flow.DEFAULT_TAB_FONT_SCALE=this.rules.VexFlowDefaultTabFontScale,this.pageIdx=0;for(const r of t.MusicPages){if(r.PageNumber>this.rules.MaxPageToDrawNumber)break;const o=this.backends[this.pageIdx];o.graphicalMusicPage=r,o.scale(this.zoom),this.pageIdx+=1}this.pageIdx=0,this.backend=this.backends[0],super.drawSheet(t)}drawPage(t){!t||(this.backend=this.backends[t.PageNumber-1],super.drawPage(t),this.pageIdx+=1)}clear(){for(const t of this.backends)t.clear()}setZoom(t){this.zoom=t}calculatePixelDistance(t){return t*_t}drawStaffLine(t){const e=this.backend.getContext().openGroup();e&&e.classList.add("staffline"),super.drawStaffLine(t);const i=t.PositionAndShape.AbsolutePosition;this.rules.RenderSlurs&&this.drawSlurs(t,i),this.backend.getContext().closeGroup()}drawSlurs(t,e){for(const i of t.GraphicalSlurs)i.slur.isCrossed()||this.drawSlur(i,e)}drawSlur(t,e){const i=[];let s,r,o,a;this.rules.DYMusicScoreType==="jianpu"?((t.placement>0||t.bezierStartPt.y>0)&&(t.bezierStartPt.y=-.8,t.bezierStartControlPt.y=-2.5),s=new O(t.bezierStartPt.x+e.x,t.bezierStartPt.y+e.y),r=new O(t.bezierStartControlPt.x+e.x,t.bezierStartControlPt.y+e.y),o=new O(t.bezierEndControlPt.x+e.x,t.bezierStartControlPt.y+e.y),a=new O(t.bezierEndPt.x+e.x,t.bezierStartPt.y+e.y)):(s=new O(t.bezierStartPt.x+e.x,t.bezierStartPt.y+e.y),r=new O(t.bezierStartControlPt.x+e.x,t.bezierStartControlPt.y+e.y),o=new O(t.bezierEndControlPt.x+e.x,t.bezierEndControlPt.y+e.y),a=new O(t.bezierEndPt.x+e.x,t.bezierEndPt.y+e.y)),i.push(this.applyScreenTransformation(s)),i.push(this.applyScreenTransformation(r)),i.push(this.applyScreenTransformation(o)),i.push(this.applyScreenTransformation(a)),t.placement===z.Above?(s.y-=.05,r.y-=.3,o.y-=.3,a.y-=.05):(s.y+=.05,r.y+=.3,o.y+=.3,a.y+=.05),i.push(this.applyScreenTransformation(s)),i.push(this.applyScreenTransformation(r)),i.push(this.applyScreenTransformation(o)),i.push(this.applyScreenTransformation(a)),t.SVGElement=this.backend.renderCurve(i)}drawMeasure(t){t.setAbsoluteCoordinates(t.PositionAndShape.AbsolutePosition.x*_t,t.PositionAndShape.AbsolutePosition.y*_t);const e=this.backend.getContext();try{t.draw(e)}catch(i){j.warn("VexFlowMusicSheetDrawer.drawMeasure",i)}for(const i of t.staffEntries)this.drawStaffEntry(i)}drawLine(t,e,i="#FF0000FF",s=.2){return t=this.applyScreenTransformation(t),e=this.applyScreenTransformation(e),this.backend.renderLine(t,e,i,s*_t)}DrawOverlayLine(t,e,i,s="#FF0000FF",r=.2){if(!i.PageNumber||i.PageNumber>this.backends.length||i.PageNumber<1){console.log("VexFlowMusicSheetDrawer.drawOverlayLine: invalid page number / music page number doesn't correspond to an existing backend.");return}const o=i.PageNumber-1,a=this.backends[o];return t=this.applyScreenTransformation(t),e=this.applyScreenTransformation(e),a.renderLine(t,e,s,r*_t)}drawSkyLine(t){const e=t.PositionAndShape.AbsolutePosition,i=t.PositionAndShape.Size.width;this.drawSampledLine(t.SkyLine,e,i)}drawBottomLine(t){const e=new O(t.PositionAndShape.AbsolutePosition.x,t.PositionAndShape.AbsolutePosition.y),i=t.PositionAndShape.Size.width;this.drawSampledLine(t.BottomLine,e,i,"#0000FFFF")}drawSampledLine(t,e,i,s="#FF0000FF"){const r=[];let o=0;for(let l=0;l<t.length;l++)t[l]!==o&&(r.push(l),o=t[l]);const a=e;if(r.length>0){const l=this.rules.SamplingUnit;let h=new O(a.x,a.y),c=new O(r[0]/l+a.x,a.y);this.drawLine(h,c,s);let u,f;t[0]>=0&&(u=new O(r[0]/l+a.x,a.y),f=new O(r[0]/l+a.x,a.y+t[r[0]]),this.drawLine(u,f,s));for(let d=1;d<r.length;d++)h=new O(r[d-1]/l+a.x,a.y+t[r[d-1]]),c=new O(r[d]/l+a.x,a.y+t[r[d-1]]),this.drawLine(h,c,s),u=new O(r[d]/l+a.x,a.y+t[r[d-1]]),f=new O(r[d]/l+a.x,a.y+t[r[d]]),this.drawLine(u,f,s);r[r.length-1]<t.length?(h=new O(r[r.length-1]/l+a.x,a.y+t[r[r.length-1]]),c=new O(a.x+i,a.y+t[r[r.length-1]]),this.drawLine(h,c,s)):(h=new O(r[r.length-1]/l+a.x,a.y),c=new O(a.x+i,a.y),this.drawLine(h,c,s))}else{const l=new O(a.x,a.y),h=new O(a.x+i,a.y);this.drawLine(l,h,s)}}drawStaffEntry(t){if(t.FingeringEntries.length>0)for(const e of t.FingeringEntries)e.SVGNode=this.drawLabel(e,pe.Notes);if(t.graphicalChordContainers!==void 0&&t.graphicalChordContainers.length>0)for(const e of t.graphicalChordContainers){const i=e.GraphicalLabel;i.SVGNode=this.drawLabel(i,pe.Notes)}this.rules.RenderLyrics&&t.LyricsEntries.length>0&&this.drawLyrics(t.LyricsEntries,pe.Notes)}drawLyrics(t,e){t.forEach(i=>{const s=i.GraphicalLabel;s.SVGNode=this.drawLabel(s,e)})}drawInstrumentBrace(t,e){t.draw(this.backend.getContext())}drawGroupBracket(t,e){t.draw(this.backend.getContext())}drawOctaveShifts(t){for(const e of t.OctaveShifts)if(e){const i=e,s=this.backend.getContext(),r=i.getTextBracket();r.setContext(s);try{r.draw()}catch(o){j.warn(o)}}}drawPedals(t){for(const e of t.Pedals)if(e){const i=e,s=this.backend.getContext(),r=i.getPedalMarking();r.setContext(s),r.draw()}}drawWavyLines(t){for(const e of t.WavyLines)if(e){const i=e,s=this.backend.getContext(),r=i.getVibratoBracket();r.setContext(s),r.draw()}}getMaxExpressionsYAndDots(t){var l,h;const e=[];let i=0;for(const c of t.measures)e.push(c.measureNumber);const s={},r={},o={};for(const c of t.AbstractExpressions)if(c instanceof Us&&e.includes(c.parentMeasure.MeasureNumber)){const u=this.getDotId(c),f=this.getDotId(c,"x");r[u]||(r[u]=[]),o[f]||(o[f]=[]),this.hasDot(c.Label.PositionAndShape.RelativePosition,r[u],!0)||(r[u].push(c.Label.PositionAndShape.RelativePosition),o[f].push(c.Label.PositionAndShape.RelativePosition)),s[u]=c.Label.PositionAndShape.RelativePosition}let a=0;for(const c of t.AbstractExpressions){const u=(l=c.parentMeasure)==null?void 0:l.MeasureNumber;if(c instanceof Us&&e.includes(u)){const f=(h=c.parentMeasure.verticalMeasureList[0])==null?void 0:h.stave,d=(f==null?void 0:f.end_x)-(f==null?void 0:f.x),p=this.getDotId(c,"x");if((o[p]||[]).length===1&&a!==u){const g=c.Label.PositionAndShape.AbsolutePosition.y;i=i===0?g:Math.min(i,g)}(o[p]||[]).length!==1&&d/10<c.Label.PositionAndShape.MarginSize.width&&(a=u+1)}}return{maxY:i,dots:s,dotsPoint:r,dotsPointByX:o}}drawExpressions(t){const e={},i=[],{maxY:s,dotsPointByX:r}=this.getMaxExpressionsYAndDots(t);for(const o of t.AbstractExpressions)if(o instanceof Ya)this.drawInstantaneousDynamic(o);else if(o instanceof Tr){const a=o.GraphicalLabel;a.SVGNode=this.drawLabel(a,pe.Notes)}else if(o instanceof xo)this.drawContinuousDynamic(o);else if(o instanceof Us){const a=this.getDotId(o),l=this.getDotId(o,"x");if((r[l]||[]).length!==1){const c=o.Label.PositionAndShape.AbsolutePosition.y;e[l]?!i.includes(a)&&e[l]!==0&&(o.Label.PositionAndShape.AbsolutePosition.y=c-1):(e[l]=-Math.abs(s-c),o.Label.PositionAndShape.AbsolutePosition.y=c+e[l]),i.push(a)}const h=o.Label;h.SVGNode=this.drawLabel(h,pe.Notes)}else j.warn("Unkown type of expression!")}drawInstantaneousDynamic(t){const e=t.Label;e.SVGNode=this.drawLabel(e,pe.Notes)}drawContinuousDynamic(t){if(t.IsVerbal){const e=t.Label;e.SVGNode=this.drawLabel(e,pe.Notes)}else{try{if(t.Lines.length===2&&Math.abs(t.Lines[0].Start.x-t.Lines[1].Start.x)>1){let i=Math.min(...t.Lines.map(s=>s.Start.x));t.Lines[0].Start.x=i,t.Lines[1].Start.x=i,[t.Lines[0].Start.y,t.Lines[1].Start.y]=[t.Lines[1].Start.y,t.Lines[0].Start.y],t.Lines[0].End.y+=this.rules.WedgeOpeningLength/2,t.Lines[1].End.y+=this.rules.WedgeOpeningLength}}catch{}const e=this.backend.getContext();e.openGroup("lineGroup");for(const i of t.Lines){const s=new O(t.ParentStaffLine.PositionAndShape.AbsolutePosition.x+i.Start.x,t.ParentStaffLine.PositionAndShape.AbsolutePosition.y+i.Start.y),r=new O(t.ParentStaffLine.PositionAndShape.AbsolutePosition.x+i.End.x,t.ParentStaffLine.PositionAndShape.AbsolutePosition.y+i.End.y);this.drawLine(s,r,"black",i.Width)}e.closeGroup()}}renderLabel(t,e,i){return this._renderLabel(t,i)}_renderLabel(t,e){var h;if(!t.Label.print)return;const i=t.Label.fontHeight*_t,{font:s}=t.Label;let r;this.rules.ColoringEnabled&&(r=t.Label.colorDefault,t.Label.color&&(r=t.Label.color.toString()),r||(r=this.rules.DefaultColorLabel));let{fontStyle:o,fontFamily:a}=t.Label;o||(o=this.rules.DefaultFontStyle),a||(a=this.rules.DefaultFontFamily);let l;for(let c=0;c<((h=t.TextLines)==null?void 0:h.length);c++){const u=t.TextLines[c],f=this.calculatePixelDistance(u.xOffset),d=new O(e.ScreenPosition.x+f,e.ScreenPosition.y),p=this.backend.renderText(i,o,s,u.text,e.FontHeightInPixel,d,r,t.Label.fontFamily);l?l.appendChild(p):l=p,e.ScreenPosition.y=e.ScreenPosition.y+e.FontHeightInPixel,t.TextLines.length>1&&(e.ScreenPosition.y+=this.rules.SpacingBetweenTextLines)}return l}renderRectangle(t,e,i,s,r){return this.backend.renderRectangle(t,i,s,r)}applyScreenTransformation(t){return new O(t.x*_t,t.y*_t)}applyScreenTransformationForRect(t){return new Qe(t.x*_t,t.y*_t,t.width*_t,t.height*_t)}}const ht=M.Flow,ze=class{static durations(n,t){const e=[],i=n.clone();for(;i.RealValue>0;){const s=i.RealValue;if(s>=2)e.push("1/2"),i.Sub(new W(2,1));else if(s>=1)e.push("w"),i.Sub(new W(1,1));else if(s<1&&s>=.5){if(t&&s>.5)return["w"];e.push("h"),i.Sub(new W(1,2))}else if(s<.5&&s>=.25){if(t&&s>.25)return["h"];e.push("q"),i.Sub(new W(1,4))}else if(s<.25&&s>=.125){if(t&&s>.125)return["q"];e.push("8"),i.Sub(new W(1,8))}else if(s<.125&&s>=.0625){if(t&&s>.0625)return["8"];e.push("16"),i.Sub(new W(1,16))}else if(s<.0625&&s>=.03125){if(t&&s>.03125)return["16"];e.push("32"),i.Sub(new W(1,32))}else if(s<.03125&&s>=.015625){if(t&&s>.015625)return["32"];e.push("64"),i.Sub(new W(1,64))}else{if(t)return["64"];e.push("128"),i.Sub(new W(1,128))}}return e}static pitch(n,t,e,i=void 0,s=void 0){let r=s;s===void 0&&(r=3),t&&s===void 0&&(r=0,e.ClefType===Pt.F&&(r=2),e.ClefType===Pt.C&&(r=2));const o=ut[n.FundamentalNote].toLowerCase(),a=Kt.accidentalVexflow(n.Accidental),l=n.Octave-e.OctaveOffset+r;let h="";return i&&(h=this.NoteHeadCode(i)),[o+"n/"+l+h,a,e]}static restToNotePitch(n,t){let e=n.Octave;switch(t){case Pt.C:case Pt.F:{e+=2;break}case Pt.G:}return new Kt(n.FundamentalNote,e,yt.NONE)}static NoteHeadCode(n){const t="/",e=n.Filled?"2":"1";switch(n.Shape){case Qt.NORMAL:return"";case Qt.DIAMOND:return t+"D"+e;case Qt.TRIANGLE:return t+"T"+e;case Qt.X:return t+"X"+e;case Qt.CIRCLEX:return t+"X3";case Qt.RECTANGLE:return t+"R"+e;case Qt.SQUARE:return t+"S"+e;case Qt.SLASH:return"";default:return""}}static GhostNotes(n){const t=[],e=ze.durations(n,!1);for(const i of e)t.push(new ht.GhostNote({duration:i}));return t}static StaveNote(n){var w,T,E,C,P,I,F,L,k,v,G,et,H,nt,K,lt;n.sortForVexflow();const t=n.notes,e=n.parentStaffEntry.parentMeasure.parentSourceMeasure.Rules,i=t[0];let s=[],r;const o=[],a=i.graphicalNoteLength,l=i.sourceNote.NoteTuplet!==void 0;let h=ze.durations(a,l)[0];i.sourceNote.TypeLength!==void 0&&i.sourceNote.TypeLength!==a&&i.sourceNote.TypeLength.RealValue!==0&&(h=ze.durations(i.sourceNote.TypeLength,l)[0],i.numberOfDots=i.sourceNote.DotsXml);let c,u=i.numberOfDots,f=!1,d=0,p=!1,g=!1,m;for(const A of t){if(u<A.numberOfDots&&(u=A.numberOfDots),A.sourceNote.isRest()){if(g=!0,A.sourceNote.Pitch){s=[A.vfpitch[0]];break}else{s=["b/4"];const J=(w=A.parentVoiceEntry)==null?void 0:w.parentVoiceEntry;if(J){const ct=(T=A.parentVoiceEntry)==null?void 0:T.parentStaffEntry.parentMeasure.staffEntries;let Nt,pt,dt=-1;for(let Ct=0;Ct<ct.length;Ct++)if(((E=ct[Ct])==null?void 0:E.graphicalVoiceEntries[0].parentVoiceEntry)===J){dt=Ct;break}if(dt>=1&&ct.length-1>=dt+1&&(Nt=(P=(C=ct[dt-1])==null?void 0:C.graphicalVoiceEntries[0])==null?void 0:P.parentVoiceEntry,pt=(F=(I=ct[dt+1])==null?void 0:I.graphicalVoiceEntries[0])==null?void 0:F.parentVoiceEntry,Nt&&pt)){const Ct=Nt.Notes[0],Ht=pt.Notes[0];if(((L=Ct.NoteBeam)==null?void 0:L.Notes.includes(Ht))&&Ht.ParentStaffEntry.ParentStaff.StafflineCount!==1){const me=Nt.Notes.last().Pitch,ce=A.Clef(),_=ze.pitch(ze.restToNotePitch(me.getTransposedPitch(-2),ce.ClefType),!1,ce);me.FundamentalNote===4&&(s=[_[0]])}}}}if(a.RealValue===A.sourceNote.SourceMeasure.ActiveTimeSignature.RealValue&&(s=e.DYMusicScoreType==="staff"?["d/5"]:["R/5"],h="w",u=0,f=!0,d=e.WholeRestXShiftVexflow*_t),[...A.sourceNote.ParentStaff.Voices].filter(J=>(J==null?void 0:J.VoiceId)!=1).length){const J=A.parentVoiceEntry.parentStaffEntry.graphicalVoiceEntries,ct=A.parentVoiceEntry.parentVoiceEntry.ParentVoice.VoiceId;let Nt,pt;for(const dt of J)for(const Ct of dt.notes){if(Ct===A||Ct.sourceNote.isRest()||!Ct.sourceNote.PrintObject){A.lineShift=-2;continue}const Ht=Ct.parentVoiceEntry.parentVoiceEntry.WantedStemDirection,me=ct===1||ct===5,ce=me?1:-1,Z=Ct.sourceNote.Pitch.getHalfTone(),Y=ce===1&&Z>Nt,N=ce===-1&&Z<Nt;(!Nt||Y||N)&&(Nt=Z,pt=0,me&&Ht===Ft.Up||!me&&Ht===Ft.Down?pt+=7:me?pt+=1:pt+=2,h.includes("8")||Ht===Ft.Up&&ce===-1&&(pt+=1),Ct.sourceNote.NoteBeam&&(pt+=1),h.includes("w")&&(pt=3.5),pt+=Math.ceil(e.RestCollisionYPadding)*.5,pt*=ce,A.lineShift=pt)}if(Nt>0){let dt=3;const Ct=A.Clef();switch(Ct.ClefType){case Pt.F:dt=5;break;case Pt.C:dt=4;break}m=Kt.fromHalftone(Nt),s=[ze.pitch(m,!0,Ct,void 0,dt)[0]]}}break}A.sourceNote.Notehead&&A.sourceNote.Notehead.Shape===Qt.SLASH&&(p=!0);const B=A.vfpitch;if((v=(k=B[2])==null?void 0:k.Parent)!=null&&v.Instructions)for(let ot=0,rt=B[2].Parent.Instructions.length;ot<rt;++ot){const J=B[2].Parent.Instructions[ot];J instanceof xe&&(r=J)}s.push(B[0]),o.push(B[1]),c||(c=ze.Clef(B[2]).type),c==="percussion"&&A.sourceNote.ParentStaff.StafflineCount===1&&(s=["b/4"])}if(!c)try{const A=ze.Clef(n.notes[0].clef);(A==null?void 0:A.type)==="percussion"&&n.notes[0].sourceNote.ParentStaff.StafflineCount===1&&(s=["b/4"])}catch{}for(let A=0,B=u;A<B;++A)h+="d";p&&(h+="s"),g&&(h+="r");let S;const b={align_center:f,auto_stem:!1,clef:c,duration:h,keys:s,stem_direction:1,slash:n.GraceSlash,note_size:20,DYMusicScoreType:e.DYMusicScoreType,keyString:ze.keySignature(r)},y=n.notes[0].sourceNote;y.IsCueNote&&(b.glyph_font_scale=ht.DEFAULT_NOTATION_FONT_SCALE*ht.GraceNote.SCALE,b.stroke_px=ht.GraceNote.LEDGER_LINE_OFFSET),n.parentVoiceEntry.IsGrace||n.notes[0].sourceNote.IsCueNote?e.DYMusicScoreType==="jianpu"?(b.ornament=!0,S=new ai(b)):S=new ht.GraceNote(b):(e.DYMusicScoreType==="jianpu"?S=new ai(b):S=new ht.StaveNote(b),S.stagger_same_whole_notes=e.StaggerSameWholeNotes);const x=n.notes[0].lineShift;if(x!==0&&(S.getKeyProps()[0].line+=x),S.getKeyProps().forEach(({line:A},B)=>n.notes[B].staffLine=A),(e.LedgerLineWidth||e.LedgerLineStrokeStyle)&&(S.ledgerLineStyle||(S.ledgerLineStyle={}),e.LedgerLineWidth&&(S.ledgerLineStyle.lineWidth=e.LedgerLineWidth),e.LedgerLineStrokeStyle&&(S.ledgerLineStyle.strokeStyle=e.LedgerLineStrokeStyle)),e.ColoringEnabled){const A=e.DefaultColorStem;let B=n.parentVoiceEntry.StemColor;!B&&A&&(B=A);const ot={fillStyle:B,strokeStyle:B};B&&(S.setStemStyle(ot),S.flag&&e.ColorFlags&&S.setFlagStyle(ot))}if(S.x_shift=d,n.parentVoiceEntry.IsGrace&&n.notes[0].sourceNote.NoteBeam&&(n.parentVoiceEntry.WantedStemDirection=n.notes[0].sourceNote.NoteBeam.Notes[0].ParentVoiceEntry.WantedStemDirection),n.parentVoiceEntry)switch(n.parentVoiceEntry.WantedStemDirection){case Ft.Up:S.setStemDirection(ht.Stem.UP),n.parentVoiceEntry.StemDirection=Ft.Up;break;case Ft.Down:S.setStemDirection(ht.Stem.DOWN),n.parentVoiceEntry.StemDirection=Ft.Down;break}for(let A=0,B=t.length;A<B;A+=1){if(t[A].setIndex(S,A),o[A]){if(o[A]==="###"){S.addAccidental(A,new ht.Accidental("##")),S.addAccidental(A,new ht.Accidental("#"));continue}else if(o[A]==="bbs"){S.addAccidental(A,new ht.Accidental("bb")),S.addAccidental(A,new ht.Accidental("b"));continue}S.addAccidental(A,new ht.Accidental(o[A]))}const ot=t[A].sourceNote.TremoloStrokes,rt=t[A].sourceNote.TremoloType;if(ot>0&&rt==="single"){const J=new ht.Tremolo(ot);J.extra_stroke_scale=e.TremoloStrokeScale,J.y_spacing_scale=e.TremoloYSpacingScale,S&&S.duration==="w"&&S.stem.setExtension(-9),S.addModifier(A,J)}if(ot>0&&rt==="start"&&this.noteTremoloList.push(S),ot>0&&rt==="stop"){this.noteTremoloList.push(S);const J=new ht.Tremolo(ot,[...this.noteTremoloList]);J.extra_stroke_scale=1.2,J.y_spacing_scale=1.2,J.x_shift=-30,S.addModifier(A,J),this.noteTremoloList=[]}this.glissandoList.length&&(S.setVibrato(this.glissandoList[0].vfnote[0]),((H=(et=(G=this.glissandoList[0])==null?void 0:G.sourceNote)==null?void 0:et.SourceMeasure)==null?void 0:H.MeasureNumberXML)!=((lt=(K=(nt=t[A])==null?void 0:nt.sourceNote)==null?void 0:K.SourceMeasure)==null?void 0:lt.MeasureNumberXML),this.glissandoList=[]),t[A].sourceNote.glissandoType==="start"&&this.glissandoList.push(t[A])}if(y.Length.RealValue===.25&&y.Notehead&&y.Notehead.Filled===!1){const A=S.getKeyProps();for(let B=0;B<A.length;B++)A[B].code="v81"}for(let A=0,B=u;A<B;++A)S.addDotToAll();s.length>1&&S.getKeyProps().filter(B=>!B.code&&B.line>3).length===s.length&&S.setStemDirection(-1),e.DYMusicScoreType==="jianpu"&&window&&window.sett&&window.sett.keySignature&&S.addAccidental(0,new ht.Accidental("#"));try{const A=["b","#","\xA7","\xBA","X"],B={b:"b","#":"#","\xA7":"n",\u00BA:"bb",X:"##"};for(const ot of t){const rt=ot.sourceNote.voiceEntry.Timestamp;for(const J of ot.sourceNote.SourceMeasure.StaffLinkedExpressions)for(const ct of J){const Nt=W.Equal(rt,ct.Timestamp),dt=ct.EntriesList.map(Ct=>Ct.label).filter(Ct=>A.includes(Ct)).map(Ct=>B[Ct]);if(Nt){for(const Ct of dt)Ct&&S.addAnnotation(0,new ht.Annotation(Ct));break}}}}catch{}return S}static generateArticulations(n,t,e){var i,s;if(!(!n||n.getAttribute("type")==="GhostNote"))for(const r of t){let o=ht.Modifier.Position.ABOVE;n.getStemDirection()===ht.Stem.UP&&(o=ht.Modifier.Position.BELOW);let a;const l=r.articulationEnum;switch(e.ArticulationPlacementFromXML&&(r.placement===z.Above?o=ht.Modifier.Position.ABOVE:r.placement===z.Below&&(o=ht.Modifier.Position.BELOW)),l){case wt.accent:{a=new ht.Articulation("a>");break}case wt.downbow:{a=new ht.Articulation("am"),r.placement===void 0&&(o=ht.Modifier.Position.ABOVE);break}case wt.fermata:{a=new ht.Articulation("a@a"),o=ht.Modifier.Position.ABOVE;break}case wt.marcatodown:{a=new ht.Articulation("a|");break}case wt.marcatoup:{a=new ht.Articulation("a^");break}case wt.invertedfermata:{a=new ht.Articulation("a@u"),o=ht.Modifier.Position.BELOW;break}case wt.lefthandpizzicato:{a=new ht.Articulation("a+");break}case wt.naturalharmonic:{a=new ht.Articulation("ah");break}case wt.snappizzicato:{a=new ht.Articulation("ao");break}case wt.staccatissimo:{a=new ht.Articulation("av");break}case wt.staccato:{a=new ht.Articulation("a.");break}case wt.tenuto:{a=new ht.Articulation("a-");break}case wt.upbow:{a=new ht.Articulation("a|"),r.placement===void 0&&(o=ht.Modifier.Position.ABOVE);break}case wt.strongaccent:{a=new ht.Articulation("a^");break}}a&&(!n.hasStem()&&!n.isRest()&&l==wt.accent&&n.getLineNumber()>=3&&(o=ht.Modifier.Position.ABOVE,(s=(i=n==null?void 0:n.modifiers)==null?void 0:i.filter(h=>["TREMOLO"].includes(h.getCategory().toLocaleUpperCase())))!=null&&s.length&&a.setYShift(-16)),l===wt.strongaccent&&(o=ht.Modifier.Position.ABOVE),a.setPosition(o),n.addModifier(0,a))}}static generateOrnaments(n,t){let e=ht.Modifier.Position.ABOVE;t.placement===z.Below&&(e=ht.Modifier.Position.BELOW);let i;switch(t.GetOrnament){case Ne.DelayedInvertedTurn:{i=new ht.Ornament("turn_inverted"),i.setDelayed(!0);break}case Ne.DelayedTurn:{i=new ht.Ornament("turn"),i.setDelayed(!0);break}case Ne.InvertedMordent:{i=new ht.Ornament("mordent"),i.setDelayed(!1);break}case Ne.InvertedTurn:{i=new ht.Ornament("turn_inverted"),i.setDelayed(!1);break}case Ne.Mordent:{i=new ht.Ornament("mordent_inverted"),i.setDelayed(!1);break}case Ne.Trill:{i=new ht.Ornament("tr"),i.setDelayed(!1);break}case Ne.Turn:{i=new ht.Ornament("turn"),i.setDelayed(!1);break}default:{j.warn("unhandled OrnamentEnum type: "+t.GetOrnament);return}}i&&(t.AccidentalBelow!==yt.NONE&&i.setLowerAccidental(Kt.accidentalVexflow(t.AccidentalBelow)),t.AccidentalAbove!==yt.NONE&&i.setUpperAccidental(Kt.accidentalVexflow(t.AccidentalAbove)),i.setPosition(e),n.addModifier(0,i))}static StrokeTypeFromArpeggioType(n){switch(n){case Xe.ARPEGGIO_DIRECTIONLESS:return ht.Stroke.Type.ARPEGGIO_DIRECTIONLESS;case Xe.BRUSH_DOWN:return ht.Stroke.Type.BRUSH_UP;case Xe.BRUSH_UP:return ht.Stroke.Type.BRUSH_DOWN;case Xe.RASQUEDO_DOWN:return ht.Stroke.Type.RASQUEDO_UP;case Xe.RASQUEDO_UP:return ht.Stroke.Type.RASQUEDO_DOWN;case Xe.ROLL_DOWN:return ht.Stroke.Type.ROLL_UP;case Xe.ROLL_UP:return ht.Stroke.Type.ROLL_DOWN;default:return ht.Stroke.Type.ARPEGGIO_DIRECTIONLESS}}static CreateTabNote(n){const t=[],e=n.notes.reverse(),i=[],s=n.notes[0].graphicalNoteLength,r=n.notes[0].sourceNote.NoteTuplet!==void 0;let o=ze.durations(s,r)[0],a=0;for(const h of n.notes){const c=h.sourceNote,u={str:c.StringNumberTab,fret:c.FretNumber};t.push(u),c.BendArray&&c.BendArray.forEach(function(f){let d;const p=f.bendalter-u.fret;p>1?d="Full":p===1?d="1/2":d="1/4",f.direction==="up"?i.push({type:ht.Bend.UP,text:d,width:10}):i.push({type:ht.Bend.DOWN,text:d,width:10})}),a<h.numberOfDots&&(a=h.numberOfDots)}for(let h=0,c=a;h<c;++h)o+="d";const l=new ht.TabNote({duration:o,positions:t});for(let h=0,c=e.length;h<c;h+=1)e[h].setIndex(l,h);return i.forEach(function(h){h.type===ht.Bend.UP?l.addModifier(new ht.Bend(h.text,!1)):l.addModifier(new ht.Bend(h.text,!0))}),l}static Clef(n,t="default"){let e,i;switch(t!=="default"&&t!=="small"&&(j.warn(`Invalid VexFlow clef size "${t}" specified. Using "default".`),t="default"),n.ClefType){case Pt.G:switch(n.Line){case 1:e="french";break;case 2:e="treble";break;default:e="treble",j.error(`Clef ${Pt[n.ClefType]} on line ${n.Line} not supported by VexFlow. Using default value "${e}".`)}break;case Pt.F:switch(n.Line){case 4:e="bass";break;case 3:e="baritone-f";break;case 5:e="subbass";break;default:e="bass",j.error(`Clef ${Pt[n.ClefType]} on line ${n.Line} not supported by VexFlow. Using default value "${e}".`)}break;case Pt.C:switch(n.Line){case 3:e="alto";break;case 4:e="tenor";break;case 1:e="soprano";break;case 2:e="mezzo-soprano";break;default:e="alto",j.error(`Clef ${Pt[n.ClefType]} on line ${n.Line} not supported by VexFlow. Using default value "${e}".`)}break;case Pt.percussion:e="percussion";break;case Pt.TAB:e="treble";break;default:j.info("bad clef type: "+n.ClefType),e="treble"}return n.OctaveOffset===1&&e!=="bass"?i="8va":n.OctaveOffset===-1&&(i="8vb"),{type:e,size:t,annotation:i}}static TimeSignature(n){let t;switch(n.SymbolEnum){case ii.NONE:t=n.Rhythm.Numerator+"/"+n.Rhythm.Denominator;break;case ii.COMMON:t="C";break;case ii.CUT:t="C|";break}return new ht.TimeSignature(t)}static keySignature(n){if(!n)return;let t;switch(n.Mode){case bi.minor:t=ze.minorMap[n.Key]+"m";break;case bi.major:t=ze.majorMap[n.Key];break;case bi.none:t=ze.majorMap[n.Key];break;default:t="C"}return t}static line(n,t){switch(n){case Et.SingleThin:return t===ns.MeasureBegin?ht.StaveConnector.type.SINGLE:ht.StaveConnector.type.SINGLE_RIGHT;case Et.DoubleThin:return ht.StaveConnector.type.THIN_DOUBLE;case Et.ThinBold:return ht.StaveConnector.type.BOLD_DOUBLE_RIGHT;case Et.BoldThinDots:return ht.StaveConnector.type.BOLD_DOUBLE_LEFT;case Et.DotsThinBold:return ht.StaveConnector.type.BOLD_DOUBLE_RIGHT;case Et.DotsBoldBoldDots:return ht.StaveConnector.type.BOLD_DOUBLE_RIGHT;case Et.None:return ht.StaveConnector.type.NONE}}static font(n,t=ue.Regular,e=_r.TimesNewRoman,i,s=void 0){let r="normal",o="normal",a=`'${i.DefaultFontFamily}'`;switch(t){case ue.Bold:o="bold";break;case ue.Italic:r="italic";break;case ue.BoldItalic:r="italic",o="bold";break;case ue.Underlined:break}switch(e){case _r.Kokila:break}return s&&s!=="default"&&(a=`'${s}'`),r+" "+o+" "+Math.floor(n)+"px "+a}static fontStyle(n){switch(n){case ue.Bold:return"bold";case ue.Italic:return"italic";case ue.BoldItalic:return"italic bold";default:return"normal"}}static style(n){return zt.getValue(n)}};let Yt=ze;Yt.majorMap={"-1":"F","-2":"Bb","-3":"Eb","-4":"Ab","-5":"Db","-6":"Gb","-7":"Cb","-8":"Fb","0":"C","1":"G","2":"D","3":"A","4":"E","5":"B","6":"F#","7":"C#","8":"G#"};Yt.minorMap={"-1":"D","-2":"G","-3":"C","-4":"F","-5":"Bb","-6":"Eb","-7":"Ab","-8":"Db","0":"A","1":"E","2":"B","3":"F#","4":"C#","5":"G#","6":"D#","7":"A#","8":"E#"};Yt.noteTremoloList=[];Yt.glissandoList=[];class _n{constructor(t,e){this.numberXml=1,this.setOctaveShiftValue(t,e)}get Type(){return this.octaveValue}set Type(t){this.octaveValue=t}get StaffNumber(){return this.staffNumber}set StaffNumber(t){this.staffNumber=t}get ParentStartMultiExpression(){return this.startMultiExpression}set ParentStartMultiExpression(t){this.startMultiExpression=t}get ParentEndMultiExpression(){return this.endMultiExpression}set ParentEndMultiExpression(t){this.endMultiExpression=t}setOctaveShiftValue(t,e){e===1&&t==="down"?this.octaveValue=oe.VA8:e===1&&t==="up"?this.octaveValue=oe.VB8:e===2&&t==="down"?this.octaveValue=oe.MA15:e===2&&t==="up"?this.octaveValue=oe.MB15:this.octaveValue=oe.NONE}static getPitchFromOctaveShift(t,e){if(!t)return;let i=t.Octave;switch(e){case oe.VA8:i-=1;break;case oe.VB8:i+=1;break;case oe.MA15:i-=2;break;case oe.MB15:i+=2;break;case oe.NONE:default:i+=0}return new Kt(t.FundamentalNote,i,t.Accidental)}}var oe=(n=>(n[n.VA8=0]="VA8",n[n.VB8=1]="VB8",n[n.MA15=2]="MA15",n[n.MB15=3]="MB15",n[n.NONE=4]="NONE",n))(oe||{});class nr extends Ii{constructor(t,e,i,s){super(e),this.label=t,this.staffNumber=i,this.parentMultiTempoExpression=s}get Label(){return this.label}set Label(t){this.label=t}get Placement(){return this.placement}set Placement(t){this.placement=t}get StaffNumber(){return this.staffNumber}set StaffNumber(t){this.staffNumber=t}get ParentMultiTempoExpression(){return this.parentMultiTempoExpression}static isStringInStringList(t,e){for(const i of t)if(nr.stringContainsSeparatedWord(e.toLowerCase().trim(),i.toLowerCase().trim()))return!0;return!1}static stringContainsSeparatedWord(t,e){return t===e||t.indexOf(" "+e)!==-1||t.indexOf(e+" ")!==-1}}const tt=class extends nr{constructor(n,t,e,i,s,r=!1){super(n,t,e,s),this.setTempoAndTempoType(i)}static getDefaultValueForTempoType(n){switch(n){case bt.larghissimo:return 20;case bt.grave:return 30;case bt.lento:return 48;case bt.largo:return 52;case bt.larghetto:return 63;case bt.adagio:return 70;case bt.adagietto:return 75;case bt.andanteModerato:return 88;case bt.andante:return 92;case bt.andantino:return 96;case bt.moderato:return 106;case bt.allegretto:return 112;case bt.allegroModerato:return 118;case bt.allegro:return 130;case bt.vivace:return 140;case bt.vivacissimo:return 155;case bt.allegrissimo:return 170;case bt.presto:return 184;case bt.prestissimo:return 200;default:throw new Li("tempoEnum")}}static isInputStringInstantaneousTempo(n){return n?tt.isStringInStringList(tt.listInstantaneousTempoLarghissimo,n)||tt.isStringInStringList(tt.listInstantaneousTempoGrave,n)||tt.isStringInStringList(tt.listInstantaneousTempoLento,n)||tt.isStringInStringList(tt.listInstantaneousTempoLargo,n)||tt.isStringInStringList(tt.listInstantaneousTempoLarghetto,n)||tt.isStringInStringList(tt.listInstantaneousTempoAdagio,n)||tt.isStringInStringList(tt.listInstantaneousTempoAdagietto,n)||tt.isStringInStringList(tt.listInstantaneousTempoAndanteModerato,n)||tt.isStringInStringList(tt.listInstantaneousTempoAndante,n)||tt.isStringInStringList(tt.listInstantaneousTempoAndantino,n)||tt.isStringInStringList(tt.listInstantaneousTempoModerato,n)||tt.isStringInStringList(tt.listInstantaneousTempoAllegretto,n)||tt.isStringInStringList(tt.listInstantaneousTempoAllegroModerato,n)||tt.isStringInStringList(tt.listInstantaneousTempoAllegro,n)||tt.isStringInStringList(tt.listInstantaneousTempoVivace,n)||tt.isStringInStringList(tt.listInstantaneousTempoVivacissimo,n)||tt.isStringInStringList(tt.listInstantaneousTempoAllegrissimo,n)||tt.isStringInStringList(tt.listInstantaneousTempoPresto,n)||tt.isStringInStringList(tt.listInstantaneousTempoPrestissimo,n)||tt.isStringInStringList(tt.listInstantaneousTempoChangesGeneral,n):!1}get Label(){return this.label}set Label(n){this.label=n}get Placement(){return this.placement}set Placement(n){this.placement=n}get StaffNumber(){return this.staffNumber}set StaffNumber(n){this.staffNumber=n}get Enum(){return this.tempoEnum}get TempoInBpm(){return this.tempoInBpm}set TempoInBpm(n){this.tempoInBpm=n}get ParentMultiTempoExpression(){return this.parentMultiTempoExpression}getAbsoluteTimestamp(){return W.plus(this.ParentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.ParentMultiTempoExpression.Timestamp)}getAbsoluteFloatTimestamp(){return W.plus(this.ParentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.ParentMultiTempoExpression.Timestamp).RealValue}setTempoAndTempoType(n){if(!this.label){this.tempoInBpm=n,this.tempoEnum=bt.metronomeMark;return}if(tt.isStringInStringList(tt.listInstantaneousTempoLarghissimo,this.label)){n===0&&(n=tt.getDefaultValueForTempoType(bt.larghissimo)),this.tempoInBpm=n,this.tempoEnum=bt.larghissimo;return}if(tt.isStringInStringList(tt.listInstantaneousTempoGrave,this.label)){n===0&&(n=tt.getDefaultValueForTempoType(bt.grave)),this.tempoInBpm=n,this.tempoEnum=bt.grave;return}if(tt.isStringInStringList(tt.listInstantaneousTempoLento,this.label)){n===0&&(n=tt.getDefaultValueForTempoType(bt.lento)),this.tempoInBpm=n,this.tempoEnum=bt.lento;return}if(tt.isStringInStringList(tt.listInstantaneousTempoLargo,this.label)){n===0&&(n=tt.getDefaultValueForTempoType(bt.largo)),this.tempoInBpm=n,this.tempoEnum=bt.largo;return}if(tt.isStringInStringList(tt.listInstantaneousTempoLarghetto,this.label)){n===0&&(n=tt.getDefaultValueForTempoType(bt.larghetto)),this.tempoInBpm=n,this.tempoEnum=bt.larghetto;return}if(tt.isStringInStringList(tt.listInstantaneousTempoAdagio,this.label)){n===0&&(n=tt.getDefaultValueForTempoType(bt.adagio)),this.tempoInBpm=n,this.tempoEnum=bt.adagio;return}if(tt.isStringInStringList(tt.listInstantaneousTempoAdagietto,this.label)){n===0&&(n=tt.getDefaultValueForTempoType(bt.adagietto)),this.tempoInBpm=n,this.tempoEnum=bt.adagietto;return}if(tt.isStringInStringList(tt.listInstantaneousTempoAndanteModerato,this.label)){n===0&&(n=tt.getDefaultValueForTempoType(bt.andanteModerato)),this.tempoInBpm=n,this.tempoEnum=bt.andanteModerato;return}if(tt.isStringInStringList(tt.listInstantaneousTempoAndante,this.label)){n===0&&(n=tt.getDefaultValueForTempoType(bt.andante)),this.tempoInBpm=n,this.tempoEnum=bt.andante;return}if(tt.isStringInStringList(tt.listInstantaneousTempoAndantino,this.label)){n===0&&(n=tt.getDefaultValueForTempoType(bt.andantino)),this.tempoInBpm=n,this.tempoEnum=bt.andantino;return}if(tt.isStringInStringList(tt.listInstantaneousTempoModerato,this.label)){n===0&&(n=tt.getDefaultValueForTempoType(bt.moderato)),this.tempoInBpm=n,this.tempoEnum=bt.moderato;return}if(tt.isStringInStringList(tt.listInstantaneousTempoAllegretto,this.label)){n===0&&(n=tt.getDefaultValueForTempoType(bt.allegretto)),this.tempoInBpm=n,this.tempoEnum=bt.allegretto;return}if(tt.isStringInStringList(tt.listInstantaneousTempoAllegroModerato,this.label)){n===0&&(n=tt.getDefaultValueForTempoType(bt.allegroModerato)),this.tempoInBpm=n,this.tempoEnum=bt.allegroModerato;return}if(tt.isStringInStringList(tt.listInstantaneousTempoAllegro,this.label)){n===0&&(n=tt.getDefaultValueForTempoType(bt.allegro)),this.tempoInBpm=n,this.tempoEnum=bt.allegro;return}if(tt.isStringInStringList(tt.listInstantaneousTempoVivace,this.label)){n===0&&(n=tt.getDefaultValueForTempoType(bt.vivace)),this.tempoInBpm=n,this.tempoEnum=bt.vivace;return}if(tt.isStringInStringList(tt.listInstantaneousTempoVivacissimo,this.label)){n===0&&(n=tt.getDefaultValueForTempoType(bt.vivacissimo)),this.tempoInBpm=n,this.tempoEnum=bt.vivacissimo;return}if(tt.isStringInStringList(tt.listInstantaneousTempoAllegrissimo,this.label)){n===0&&(n=tt.getDefaultValueForTempoType(bt.allegrissimo)),this.tempoInBpm=n,this.tempoEnum=bt.allegrissimo;return}if(tt.isStringInStringList(tt.listInstantaneousTempoPresto,this.label)){n===0&&(n=tt.getDefaultValueForTempoType(bt.presto)),this.tempoInBpm=n,this.tempoEnum=bt.presto;return}if(tt.isStringInStringList(tt.listInstantaneousTempoPrestissimo,this.label)){n===0&&(n=tt.getDefaultValueForTempoType(bt.prestissimo)),this.tempoInBpm=n,this.tempoEnum=bt.prestissimo;return}if(tt.isStringInStringList(tt.listInstantaneousTempoAddons,this.label)){this.tempoInBpm=0,this.tempoEnum=bt.addon;return}if(tt.isStringInStringList(tt.listInstantaneousTempoChangesGeneral,this.label)){this.tempoInBpm=0,this.tempoEnum=bt.changes;return}}};let qt=tt;qt.listInstantaneousTempoLarghissimo=["Larghissimo","Sehr breit","very, very slow"];qt.listInstantaneousTempoGrave=["Grave","Schwer","slow and solemn"];qt.listInstantaneousTempoLento=["Lento","Lent","Langsam","slowly"];qt.listInstantaneousTempoLargo=["Largo","Breit","broadly"];qt.listInstantaneousTempoLarghetto=["Larghetto","Etwas breit","rather broadly"];qt.listInstantaneousTempoAdagio=["Adagio","Langsam","Ruhig","slow and stately"];qt.listInstantaneousTempoAdagietto=["Adagietto","Ziemlich ruhig","Ziemlich langsam","rather slow"];qt.listInstantaneousTempoAndanteModerato=["Andante moderato"];qt.listInstantaneousTempoAndante=["Andante","Gehend","Schreitend","at a walking pace"];qt.listInstantaneousTempoAndantino=["Andantino"];qt.listInstantaneousTempoModerato=["Moderato","M\xE4\xDFig","Mod\uFFFDr\uFFFD","moderately"];qt.listInstantaneousTempoAllegretto=["Allegretto","fast"];qt.listInstantaneousTempoAllegroModerato=["Allegro moderato"];qt.listInstantaneousTempoAllegro=["Allegro","Rapide","Vite","Rasch","Schnell","Fr\uFFFDhlich"];qt.listInstantaneousTempoVivace=["Vivace","Lebhaft","Lebendig","lively and fast"];qt.listInstantaneousTempoVivacissimo=["Vivacissimo","Sehr lebhaft","Sehr lebendig"];qt.listInstantaneousTempoAllegrissimo=["Allegrissimo","very fast"];qt.listInstantaneousTempoPresto=["Presto","Sehr schnell","Geschwind"];qt.listInstantaneousTempoPrestissimo=["Prestissimo","\xE4u\xDFerst schnell"];qt.listInstantaneousTempoChangesGeneral=["tempo primo","a tempo","tempo i","rubato","doppio movimento"];qt.listInstantaneousTempoAddons=["assai","amoroso","cantabile","con brio","con dolore","con espressione","con fuoco","con moto","con spirito","spiritoso","espressivo","giocoso","giusto","grazioso","lesto","lugubre","maestoso","ma non troppo","marcato","molto","morendo","mosso","non tanto","piu","un poco","poco","quasi","risoluto","scherzando","sostenuto","teneramente","tempo giusto","tranquillo","sehr","lieblich","liebevoll","mit Leidenschaft","mit Liebe","amour\xF6s","gesanglich","mit Schwung","mit Feuer","mit Schmerz","mit Ausdruck","mit Bewegung","geistvoll","ausdrucksvoll","freudig","verspielt","angemessen","grazi\xF6s","mit Grazie","flink","beh\xE4nde","traurig","klagend","majest\xE4tisch","aber nicht zu sehr","markant","gem\xE4\xDFigt","viel","sehr","ersterbend","bewegt","nicht zu sehr","mehr","ein wenig","gleichsam","entschlossen","zupackend","heiter","nachdr\xFCcklich","getragen","gewichtig","zart","z\xE4rtlich","im angemessenen Zeitma\xDF","ruhig","ein wenig","alla marcia","ad libitum","alla breve"];var bt=(n=>(n[n.none=0]="none",n[n.larghissimo=1]="larghissimo",n[n.grave=2]="grave",n[n.lento=3]="lento",n[n.largo=4]="largo",n[n.larghetto=5]="larghetto",n[n.adagio=6]="adagio",n[n.adagietto=7]="adagietto",n[n.andanteModerato=8]="andanteModerato",n[n.andante=9]="andante",n[n.andantino=10]="andantino",n[n.moderato=11]="moderato",n[n.allegretto=12]="allegretto",n[n.allegroModerato=13]="allegroModerato",n[n.allegro=14]="allegro",n[n.vivace=15]="vivace",n[n.vivacissimo=16]="vivacissimo",n[n.allegrissimo=17]="allegrissimo",n[n.presto=18]="presto",n[n.prestissimo=19]="prestissimo",n[n.lastRealTempo=20]="lastRealTempo",n[n.addon=21]="addon",n[n.changes=22]="changes",n[n.metronomeMark=23]="metronomeMark",n))(bt||{});const X=class extends Ii{constructor(n,t,e){super(t),this.label=n,this.staffNumber=e,this.setMoodType()}static isInputStringMood(n){return n?X.isStringInStringList(X.listMoodAffettuoso,n)||X.isStringInStringList(X.listMoodAgitato,n)||X.isStringInStringList(X.listMoodAnimato,n)||X.isStringInStringList(X.listMoodAppassionato,n)||X.isStringInStringList(X.listMoodBrillante,n)||X.isStringInStringList(X.listMoodCantabile,n)||X.isStringInStringList(X.listMoodDolce,n)||X.isStringInStringList(X.listMoodEnergico,n)||X.isStringInStringList(X.listMoodEroico,n)||X.isStringInStringList(X.listMoodEspressivo,n)||X.isStringInStringList(X.listMoodFurioso,n)||X.isStringInStringList(X.listMoodGiocoso,n)||X.isStringInStringList(X.listMoodGioioso,n)||X.isStringInStringList(X.listMoodGrandioso,n)||X.isStringInStringList(X.listMoodGrazioso,n)||X.isStringInStringList(X.listMoodLacrimoso,n)||X.isStringInStringList(X.listMoodLeggiero,n)||X.isStringInStringList(X.listMoodMaestoso,n)||X.isStringInStringList(X.listMoodMalinconico,n)||X.isStringInStringList(X.listMoodMarcato,n)||X.isStringInStringList(X.listMoodMarziale,n)||X.isStringInStringList(X.listMoodMesto,n)||X.isStringInStringList(X.listMoodMorendo,n)||X.isStringInStringList(X.listMoodNobilmente,n)||X.isStringInStringList(X.listMoodPatetico,n)||X.isStringInStringList(X.listMoodPesante,n)||X.isStringInStringList(X.listMoodSaltando,n)||X.isStringInStringList(X.listMoodSautille,n)||X.isStringInStringList(X.listMoodScherzando,n)||X.isStringInStringList(X.listMoodSostenuto,n)||X.isStringInStringList(X.listMoodSpiccato,n)||X.isStringInStringList(X.listMoodTenerezza,n)||X.isStringInStringList(X.listMoodTranquillamente,n)||X.isStringInStringList(X.listMoodTrionfante,n):!1}get Label(){return this.label}set Label(n){this.label=n}get Mood(){return this.moodType}set Mood(n){this.moodType=n}get StaffNumber(){return this.staffNumber}set StaffNumber(n){this.staffNumber=n}get Placement(){return this.placement}set Placement(n){this.placement=n}setMoodType(){X.isStringInStringList(X.listMoodAffettuoso,this.label)?this.moodType=Gt.Affettuoso:X.isStringInStringList(X.listMoodAgitato,this.label)?this.moodType=Gt.Agitato:X.isStringInStringList(X.listMoodAnimato,this.label)?this.moodType=Gt.Animato:X.isStringInStringList(X.listMoodAppassionato,this.label)?this.moodType=Gt.Appassionato:X.isStringInStringList(X.listMoodBrillante,this.label)?this.moodType=Gt.Brillante:X.isStringInStringList(X.listMoodCantabile,this.label)?this.moodType=Gt.Cantabile:X.isStringInStringList(X.listMoodDolce,this.label)?this.moodType=Gt.Dolce:X.isStringInStringList(X.listMoodEnergico,this.label)?this.moodType=Gt.Energico:X.isStringInStringList(X.listMoodEroico,this.label)?this.moodType=Gt.Eroico:X.isStringInStringList(X.listMoodEspressivo,this.label)?this.moodType=Gt.Espressivo:X.isStringInStringList(X.listMoodFurioso,this.label)?this.moodType=Gt.Furioso:X.isStringInStringList(X.listMoodGiocoso,this.label)?this.moodType=Gt.Giocoso:X.isStringInStringList(X.listMoodGioioso,this.label)?this.moodType=Gt.Gioioso:X.isStringInStringList(X.listMoodGrandioso,this.label)?this.moodType=Gt.Grandioso:X.isStringInStringList(X.listMoodGrazioso,this.label)?this.moodType=Gt.Grazioso:X.isStringInStringList(X.listMoodLacrimoso,this.label)?this.moodType=Gt.Lacrimoso:X.isStringInStringList(X.listMoodLeggiero,this.label)?this.moodType=Gt.Leggiero:X.isStringInStringList(X.listMoodMaestoso,this.label)?this.moodType=Gt.Maestoso:X.isStringInStringList(X.listMoodMalinconico,this.label)?this.moodType=Gt.Malinconico:X.isStringInStringList(X.listMoodMarcato,this.label)?this.moodType=Gt.Marcato:X.isStringInStringList(X.listMoodMarziale,this.label)?this.moodType=Gt.Marziale:X.isStringInStringList(X.listMoodMesto,this.label)?this.moodType=Gt.Mesto:X.isStringInStringList(X.listMoodMorendo,this.label)?this.moodType=Gt.Morendo:X.isStringInStringList(X.listMoodNobilmente,this.label)?this.moodType=Gt.Nobilmente:X.isStringInStringList(X.listMoodPatetico,this.label)?this.moodType=Gt.Patetico:X.isStringInStringList(X.listMoodPesante,this.label)?this.moodType=Gt.Pesante:X.isStringInStringList(X.listMoodSaltando,this.label)?this.moodType=Gt.Saltando:X.isStringInStringList(X.listMoodSautille,this.label)?this.moodType=Gt.Sautille:X.isStringInStringList(X.listMoodScherzando,this.label)?this.moodType=Gt.Scherzando:X.isStringInStringList(X.listMoodSostenuto,this.label)?this.moodType=Gt.Sostenuto:X.isStringInStringList(X.listMoodSpiccato,this.label)?this.moodType=Gt.Spiccato:X.isStringInStringList(X.listMoodTenerezza,this.label)?this.moodType=Gt.Tenerezza:X.isStringInStringList(X.listMoodTranquillamente,this.label)?this.moodType=Gt.Tranquillamente:X.isStringInStringList(X.listMoodTrionfante,this.label)&&(this.moodType=Gt.Trionfante)}};let kt=X;kt.listMoodAffettuoso=["affettuoso"];kt.listMoodAgitato=["agitato"];kt.listMoodAppassionato=["appassionato"];kt.listMoodAnimato=["animato","lively"];kt.listMoodBrillante=["brillante"];kt.listMoodCantabile=["cantabile"];kt.listMoodDolce=["dolce"];kt.listMoodEnergico=["energico"];kt.listMoodEroico=["eroico"];kt.listMoodEspressivo=["espressivo"];kt.listMoodFurioso=["furioso"];kt.listMoodGiocoso=["giocoso"];kt.listMoodGioioso=["gioioso"];kt.listMoodLacrimoso=["lacrimoso"];kt.listMoodGrandioso=["grandioso"];kt.listMoodGrazioso=["grazioso"];kt.listMoodLeggiero=["leggiero"];kt.listMoodMaestoso=["maestoso"];kt.listMoodMalinconico=["malinconico"];kt.listMoodMarcato=["marcato"];kt.listMoodMarziale=["marziale"];kt.listMoodMesto=["mesto"];kt.listMoodMorendo=["morendo"];kt.listMoodNobilmente=["nobilmente"];kt.listMoodPatetico=["patetico"];kt.listMoodPesante=["pesante"];kt.listMoodSautille=["sautille"];kt.listMoodSaltando=["saltando"];kt.listMoodScherzando=["scherzando"];kt.listMoodSostenuto=["sostenuto"];kt.listMoodSpiccato=["spiccato"];kt.listMoodTenerezza=["tenerezza"];kt.listMoodTranquillamente=["tranquillamente"];kt.listMoodTrionfante=["trionfante"];var Gt=(n=>(n[n.Affettuoso=0]="Affettuoso",n[n.Agitato=1]="Agitato",n[n.Appassionato=2]="Appassionato",n[n.Animato=3]="Animato",n[n.Brillante=4]="Brillante",n[n.Cantabile=5]="Cantabile",n[n.Dolce=6]="Dolce",n[n.Energico=7]="Energico",n[n.Eroico=8]="Eroico",n[n.Espressivo=9]="Espressivo",n[n.Furioso=10]="Furioso",n[n.Giocoso=11]="Giocoso",n[n.Gioioso=12]="Gioioso",n[n.Lacrimoso=13]="Lacrimoso",n[n.Grandioso=14]="Grandioso",n[n.Grazioso=15]="Grazioso",n[n.Leggiero=16]="Leggiero",n[n.Maestoso=17]="Maestoso",n[n.Malinconico=18]="Malinconico",n[n.Marcato=19]="Marcato",n[n.Marziale=20]="Marziale",n[n.Mesto=21]="Mesto",n[n.Morendo=22]="Morendo",n[n.Nobilmente=23]="Nobilmente",n[n.Patetico=24]="Patetico",n[n.Pesante=25]="Pesante",n[n.Sautille=26]="Sautille",n[n.Saltando=27]="Saltando",n[n.Scherzando=28]="Scherzando",n[n.Sostenuto=29]="Sostenuto",n[n.Spiccato=30]="Spiccato",n[n.Tenerezza=31]="Tenerezza",n[n.Tranquillamente=32]="Tranquillamente",n[n.Trionfante=33]="Trionfante",n[n.Vivace=34]="Vivace",n))(Gt||{});class ms extends Ii{constructor(t,e,i,s){super(e),this.label=t,this.staffNumber=s,i===void 0&&(i=vt.LeftBottom),this.textAlignment=i}get Label(){return this.label}get Placement(){return this.placement}set Placement(t){this.placement=t}get StaffNumber(){return this.staffNumber}set StaffNumber(t){this.staffNumber=t}get TextAlignment(){return this.textAlignment}}class nu{constructor(t,e){this.unknownList=[],this.moodList=[],this.expressions=[],this.sourceMeasure=t,this.timestamp=e}get SourceMeasureParent(){return this.sourceMeasure}set SourceMeasureParent(t){this.sourceMeasure=t}get StaffNumber(){return this.staffNumber}set StaffNumber(t){this.staffNumber=t}get Timestamp(){return this.timestamp}set Timestamp(t){this.timestamp=t}get AbsoluteTimestamp(){return W.plus(this.timestamp,this.sourceMeasure.AbsoluteTimestamp)}get InstantaneousDynamic(){return this.instantaneousDynamic}set InstantaneousDynamic(t){this.instantaneousDynamic=t}get EndingContinuousDynamic(){return this.endingContinuousDynamic}set EndingContinuousDynamic(t){this.endingContinuousDynamic=t}get StartingContinuousDynamic(){return this.startingContinuousDynamic}set StartingContinuousDynamic(t){this.startingContinuousDynamic=t}get MoodList(){return this.moodList}get UnknownList(){return this.unknownList}get EntriesList(){return this.expressions}get OctaveShiftStart(){return this.octaveShiftStart}set OctaveShiftStart(t){this.octaveShiftStart=t}get OctaveShiftEnd(){return this.octaveShiftEnd}set OctaveShiftEnd(t){this.octaveShiftEnd=t}get CombinedExpressionsText(){return this.combinedExpressionsText}set CombinedExpressionsText(t){this.combinedExpressionsText=t}getPlacementOfFirstEntry(){let t=z.Above;return this.expressions.length>0&&(this.expressions[0].expression instanceof Ai?t=this.expressions[0].expression.Placement:this.expressions[0].expression instanceof ei?t=this.expressions[0].expression.Placement:this.expressions[0].expression instanceof kt?t=this.expressions[0].expression.Placement:this.expressions[0].expression instanceof ms&&(t=this.expressions[0].expression.Placement)),t}getFontstyleOfFirstEntry(){var e;let t=ue.Regular;return this.expressions.length>0&&(this.expressions[0].expression instanceof ei||this.expressions[0].expression instanceof kt?t=ue.Italic:this.expressions[0].expression instanceof ms&&(t=(e=this.expressions[0].expression.fontStyle)!=null?e:ue.Regular)),t}addExpression(t,e){t instanceof Ai?(this.instantaneousDynamic&&this.removeExpressionFromEntryList(this.InstantaneousDynamic),this.instantaneousDynamic=t,this.instantaneousDynamic.ParentMultiExpression=this):t instanceof ei?this.startingContinuousDynamic=t:t instanceof kt?this.moodList.push(t):t instanceof ms&&this.unknownList.push(t),this.addExpressionToEntryList(t,e)}CompareTo(t){return this.Timestamp.RealValue>t.Timestamp.RealValue?1:this.Timestamp.RealValue<t.Timestamp.RealValue?-1:0}addExpressionToEntryList(t,e){const i=new ru;i.prefix=e,i.expression=t,t instanceof ei||t instanceof kt||t instanceof ms?i.label=t.Label:i.label="",this.expressions.push(i)}removeExpressionFromEntryList(t){for(let e=0,i=this.expressions.length;e<i;++e)if(this.expressions[e].expression===t){this.expressions.splice(e,1);break}}}class ru{}const _i=class extends nr{constructor(n,t,e,i){super(n,t,e,i),this.setTempoType()}static isInputStringContinuousTempo(n){return n?_i.isStringInStringList(_i.listContinuousTempoFaster,n)||_i.isStringInStringList(_i.listContinuousTempoSlower,n):!1}static isIncreasingTempo(n){return n<=us.piuMosso}static isDecreasingTempo(n){return n>=us.allargando&&n<=us.ritenuto}get TempoType(){return this.tempoType}set TempoType(n){this.tempoType=n}get StartTempo(){return this.startTempo}set StartTempo(n){this.startTempo=n}get EndTempo(){return this.endTempo}set EndTempo(n){this.endTempo=n}get AbsoluteEndTimestamp(){return this.absoluteEndTimestamp}set AbsoluteEndTimestamp(n){this.absoluteEndTimestamp=n}get AbsoluteTimestamp(){return this.ParentMultiTempoExpression.AbsoluteTimestamp}getAbsoluteFloatTimestamp(){return this.ParentMultiTempoExpression.AbsoluteTimestamp.RealValue}getInterpolatedTempo(n){const t=W.plus(this.parentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.parentMultiTempoExpression.Timestamp);if(n.lt(t))return-1;if(this.absoluteEndTimestamp.lt(n))return-2;const e=W.minus(n,t).RealValue/W.minus(this.absoluteEndTimestamp,t).RealValue;return Math.max(0,Math.min(250,this.startTempo+(this.endTempo-this.startTempo)*e))}setTempoType(){_i.isStringInStringList(_i.listContinuousTempoFaster,this.label)?this.tempoType=us.accelerando:_i.isStringInStringList(_i.listContinuousTempoSlower,this.label)&&(this.tempoType=us.ritardando)}};let Ni=_i;Ni.listContinuousTempoFaster=["accelerando","piu mosso","poco piu","stretto"];Ni.listContinuousTempoSlower=["poco meno","meno mosso","piu lento","rallentando","ritardando","ritenuto","ritard.","ritard","riten.","riten"];var us=(n=>(n[n.accelerando=0]="accelerando",n[n.stretto=1]="stretto",n[n.stringendo=2]="stringendo",n[n.mosso=3]="mosso",n[n.piuMosso=4]="piuMosso",n[n.allargando=5]="allargando",n[n.calando=6]="calando",n[n.menoMosso=7]="menoMosso",n[n.rallentando=8]="rallentando",n[n.ritardando=9]="ritardando",n[n.ritard=10]="ritard",n[n.rit=11]="rit",n[n.ritenuto=12]="ritenuto",n[n.rubato=13]="rubato",n[n.precipitando=14]="precipitando",n))(us||{});class ou{constructor(t,e){this.expressions=[],this.sourceMeasure=t,this.timestamp=e}get Timestamp(){return this.timestamp}get AbsoluteTimestamp(){return W.plus(this.sourceMeasure.AbsoluteTimestamp,this.timestamp)}get SourceMeasureParent(){return this.sourceMeasure}set SourceMeasureParent(t){this.sourceMeasure=t}get InstantaneousTempo(){return this.instantaneousTempo}get ContinuousTempo(){return this.continuousTempo}get EntriesList(){return this.expressions}get CombinedExpressionsText(){return this.combinedExpressionsText}set CombinedExpressionsText(t){this.combinedExpressionsText=t}getPlacementOfFirstEntry(){let t=z.Above;return this.expressions.length>0&&(this.expressions[0].Expression instanceof qt?t=this.expressions[0].Expression.Placement:this.expressions[0].Expression instanceof Ni&&(t=this.expressions[0].Expression.Placement)),t}getFontstyleOfFirstEntry(){let t=ue.Regular;return this.expressions[0].Expression instanceof qt?t=ue.Bold:this.expressions[0].Expression instanceof Ni&&(t=ue.Italic),t}addExpression(t,e){if(this.checkIfAlreadyExists(t))return;t instanceof qt?this.instantaneousTempo=t:t instanceof Ni&&(this.continuousTempo=t);const i=new au;i.prefix=e,i.Expression=t,i.label=t.Label,this.expressions.push(i)}CompareTo(t){return this.Timestamp.RealValue>t.Timestamp.RealValue?1:this.Timestamp.RealValue<t.Timestamp.RealValue?-1:0}checkIfAlreadyExists(t){for(const e of this.expressions)if(e.label===t.Label)return!0;return!1}}class au{get Expression(){return this.expression}set Expression(t){this.expression=t}}class lu extends Ii{constructor(t,e){super(e),this.label=t}}class ja{constructor(){this.musicSystems=[],this.globalSystemIndex=0,this.leadSheet=!1}initialize(t,e,i){this.leadSheet=t.LeadSheet,this.graphicalMusicSheet=t,this.rules=this.graphicalMusicSheet.ParentMusicSheet.Rules,this.measureList=e,this.numberOfVisibleStaffLines=i,this.activeRhythm=new Array(this.numberOfVisibleStaffLines),this.activeKeys=new Array(this.numberOfVisibleStaffLines),this.activeClefs=new Array(this.numberOfVisibleStaffLines),this.initializeActiveInstructions(this.measureList[0])}buildMusicSystems(){var r,o,a;const t=this.getFullPageSystemWidth();let e=!1;this.measureListIndex=0,this.currentSystemParams=new In,this.currentSystemParams.currentSystem=this.initMusicSystem();let i=0,s=0;for(;this.measureListIndex<this.measureList.length;){const l=this.measureList[this.measureListIndex];if(!l||!l[0]){this.measureListIndex++;continue}for(let P=0,I=l.length;P<I;++P)l[P].resetLayout();const h=l[0].parentSourceMeasure,c=h.HasEndLine,u=c&&this.rules.NewPartAndSystemAfterFinalBarline,f=this.currentSystemParams.IsSystemStartMeasure();h.IsSystemStartMeasure=f;const d=h===this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();let p=this.rules.MeasureLeftMargin,g=0;const m=this.getMeasureStartLine();if(p+=this.getLineWidth(l[0],m,f),!this.leadSheet){let P=!1;e&&this.rules.ShowRhythmAgainAfterPartEndOrFinalBarline&&(P=!0),p+=this.addBeginInstructions(l,f,d||P),g+=this.addEndInstructions(l)}let S=0;for(let P=0;P<this.numberOfVisibleStaffLines;P++)S=Math.max(S,l[P].minimumStaffEntriesWidth);const b=this.getMeasureEndLine();g+=this.getLineWidth(l[0],b,f);let y=this.rules.MeasureLeftMargin,x;if(this.measureListIndex+1<this.measureList.length){const P=this.measureList[this.measureListIndex+1];x=(r=P[0])==null?void 0:r.parentSourceMeasure,x!=null&&x.hasBeginInstructions()&&(y+=this.addBeginInstructions(P,!1,!1))}let w=p+g+S;(a=(o=l[0])==null?void 0:o.parentSourceMeasure)!=null&&a.multipleRestMeasures&&(w=this.rules.MultipleRestMeasureDefaultWidth);const T=this.currentSystemParams.currentWidth+w+y<t;i===0&&(i=Math.abs(Math.floor((t-p-g-y)/(w-p))),i=i%2===0?i:i-1,i<1&&(i=1));const E=this.rules.NewPageAtXMLNewPageAttribute&&h.printNewPageXml,C=E||this.rules.NewSystemAtXMLNewSystemAttribute&&h.printNewSystemXml;if((f||T&&!C)&&(this.rules.DYWorkSpecial||s<i)){if(this.addMeasureToSystem(l,m,b,w,p,S,g),this.updateActiveClefs(h,l),this.measureListIndex++,u){if(this.rules.MaxSystemToDrawNumber===this.musicSystems.length)return this.finalizeCurrentSystem(l,!this.rules.StretchLastSystemLine,!1),this.musicSystems;this.finalizeCurrentAndCreateNewSystem(l,!this.rules.StretchLastSystemLine,!1)}e=c}else{if(s=0,this.rules.MaxSystemToDrawNumber===this.musicSystems.length)return this.finalizeCurrentSystem(l,!1,!0,E),this.musicSystems;this.finalizeCurrentAndCreateNewSystem(l,!1,!0,E)}}if(this.currentSystemParams.systemMeasures.length>0){if(this.rules.MaxSystemToDrawNumber===this.musicSystems.length)return this.finalizeCurrentSystem(this.measureList[this.measureList.length-1],!this.rules.StretchLastSystemLine,!1),this.musicSystems;this.finalizeCurrentAndCreateNewSystem(this.measureList[this.measureList.length-1],!this.rules.StretchLastSystemLine,!1)}return this.musicSystems}calculateSystemYLayout(){for(const t of this.musicSystems)this.optimizeDistanceBetweenStaffLines(t);this.calculateMusicSystemsRelativePositions()}setMeasureWidth(t,e,i,s){for(let r=0,o=t.length;r<o;++r){const a=t[r];a.setWidth(e),i>0&&(a.beginInstructionsWidth=i),s>0&&(a.endInstructionsWidth=s)}}finalizeCurrentAndCreateNewSystem(t,e=!1,i=!0,s=!1){this.finalizeCurrentSystem(t,e,i,s),this.currentSystemParams=new In,t!==void 0&&this.measureListIndex<this.measureList.length&&(this.currentSystemParams.currentSystem=this.initMusicSystem())}finalizeCurrentSystem(t,e=!1,i=!0,s=!1){this.currentSystemParams.currentSystem.breaksPage=s,this.adaptRepetitionLineWithIfNeeded(),t!==void 0&&i&&this.checkAndCreateExtraInstructionMeasure(t),this.stretchMusicSystem(e)}adaptRepetitionLineWithIfNeeded(){const t=this.currentSystemParams.systemMeasures;if(t.length>=1){const e=this.currentSystemParams.currentSystem.GraphicalMeasures[this.currentSystemParams.currentSystem.GraphicalMeasures.length-1];let i=0;const s=t[t.length-1];s.endLine===Et.DotsBoldBoldDots&&(s.endLine=Et.DotsThinBold,i=e[0].getLineWidth(Et.DotsBoldBoldDots)/2-e[0].getLineWidth(Et.DotsThinBold)),this.currentSystemParams.currentSystemFixWidth-=i;for(let r=0,o=e.length;r<o;++r){const a=e[r];a.endInstructionsWidth-=i}}}addMeasureToSystem(t,e,i,s,r,o,a){this.currentSystemParams.systemMeasures.push({beginLine:e,endLine:i}),this.setMeasureWidth(t,s,r,a),this.addStaveMeasuresToSystem(t),this.currentSystemParams.currentWidth+=s,this.currentSystemParams.currentSystemFixWidth+=r+a,this.currentSystemParams.currentSystemVarWidth+=o,this.currentSystemParams.systemMeasureIndex++}initMusicSystem(){const t=Lt.symbolFactory.createMusicSystem(this.globalSystemIndex++,this.rules);return this.musicSystems.push(t),this.layoutSystemStaves(t),t.createMusicSystemLabel(this.rules.InstrumentLabelTextHeight,this.rules.SystemLabelsRightMargin,this.rules.LabelMarginBorderFactor,this.musicSystems.length===1),t}getFullPageSystemWidth(){return this.graphicalMusicSheet.ParentMusicSheet.pageWidth-this.rules.PageLeftMargin-this.rules.PageRightMargin-this.rules.SystemLeftMargin-this.rules.SystemRightMargin}layoutSystemStaves(t){const e=this.getFullPageSystemWidth(),i=t.PositionAndShape;i.BorderLeft=0,i.BorderRight=e,i.BorderTop=0;const s=[],r=this.graphicalMusicSheet.ParentMusicSheet.Instruments;for(let l=0,h=r.length;l<h;++l){const c=r[l];if(!(!c.Visible||c.Voices.length===0))for(let u=0,f=c.Staves.length;u<f;++u){const d=c.Staves[u];s.push(d)}}let o=!1;if(this.leadSheet){for(let l=0,h=s.length;l<h;++l)if(s[l].ParentInstrument.LyricVersesNumbers.length>1){o=!0;break}}let a=0;for(let l=0;l<s.length;l++)if(this.addStaffLineToMusicSystem(t,a,s[l]),a+=this.rules.StaffHeight,l+1<s.length){let h=0;this.leadSheet&&!o?h=2.5:s[l].ParentInstrument===s[l+1].ParentInstrument?h=this.rules.BetweenStaffDistance:h=this.rules.StaffDistance,a+=h}i.BorderBottom=a}addStaffLineToMusicSystem(t,e,i){if(t){const s=Lt.symbolFactory.createStaffLine(t,i);t.StaffLines.push(s);const r=s.PositionAndShape,o=new O;o.x=0,r.BorderRight=t.PositionAndShape.Size.width,o.y=e,r.RelativePosition=o,r.BorderLeft=0,r.BorderTop=0,r.BorderBottom=this.rules.StaffHeight;for(let a=0;a<5;a++){const l=new O;l.x=0,l.y=a*this.rules.StaffHeight/4;const h=new O;h.x=s.PositionAndShape.Size.width,h.y=a*this.rules.StaffHeight/4,this.leadSheet&&(l.y=h.y=0),s.StaffLines[a]=new ci(l,h,this.rules.StaffLineWidth)}}}initializeActiveInstructions(t){const e=this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();if(e){this.visibleStaffIndices=this.graphicalMusicSheet.getVisibleStavesIndicesFromSourceMeasure(t);for(let i=0,s=this.visibleStaffIndices.length;i<s;i++){const r=this.visibleStaffIndices[i],o=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(e,r);this.activeClefs[i]=e.FirstInstructionsStaffEntries[r].Instructions[0];const a=e.FirstInstructionsStaffEntries[r].Instructions[1];if(a){let h=xe.copy(a);h=this.transposeKeyInstruction(h,o),this.activeKeys[i]=h}const l=e.FirstInstructionsStaffEntries[r].Instructions[2];this.activeRhythm[i]=l}}}transposeKeyInstruction(t,e){const i=e.getTransposedHalftones();return i!==t.isTransposedBy&&e.ParentStaff.ParentInstrument.MidiInstrumentId!==st.Percussion&&Lt.transposeCalculator!==void 0&&Lt.transposeCalculator.transposeKey(t,i),t}addBeginInstructions(t,e,i){const s=t.length;if(s===0)return 0;let r=0;const o=t[0].parentSourceMeasure;for(let a=0;a<s;++a){const l=t[a],h=this.visibleStaffIndices[a],c=o.FirstInstructionsStaffEntries[h],u=this.AddInstructionsAtMeasureBegin(c,l,a,i,e);r=Math.max(r,u)}return r}addEndInstructions(t){const e=t.length;if(e===0)return 0;let i=.5;const s=t[0].parentSourceMeasure;for(let r=0;r<e;r++){const o=t[r],a=this.visibleStaffIndices[r],l=s.LastInstructionsStaffEntries[a],h=this.addInstructionsAtMeasureEnd(l,o,t);i=Math.max(i,h)}return i}AddInstructionsAtMeasureBegin(t,e,i,s,r){var d;let o=0,a,l,h;if(t)for(let p=0,g=t.Instructions.length;p<g;++p){const m=t.Instructions[p];m instanceof Wt?a=m:m instanceof xe?l=m:m instanceof Ae&&(h=m)}r&&(a||(a=this.activeClefs[i]),l||(l=xe.copy(this.activeKeys[i])),s&&!h&&(h=this.activeRhythm[i]));let c=!1,u=!1,f=!1;if(a?(e.addClefAtBegin(a),c=!0):a=this.activeClefs[i],l){l=this.transposeKeyInstruction(l,e);const p=r?void 0:this.activeKeys[i];e.addKeyAtBegin(l,p,a),u=!0}if(h!==void 0&&h.PrintObject&&this.rules.RenderTimeSignatures){let p=!0;const m=e.MeasureNumber-1-this.rules.MinMeasureToDrawIndex;if(e.MeasureNumber-1>=0&&this.measureList[m]){const b=(d=this.measureList[m][0])==null?void 0:d.parentSourceMeasure;(b==null?void 0:b.ImplicitMeasure)&&(b==null?void 0:b.RhythmPrinted)&&(p=!1)}p&&(e.addRhythmAtBegin(h),e.parentSourceMeasure.RhythmPrinted=h,f=!0)}return(c||u||f)&&(o+=e.beginInstructionsWidth,f&&(o+=this.rules.RhythmRightMargin)),o}addInstructionsAtMeasureEnd(t,e,i){if(!t||!t.Instructions||t.Instructions.length===0)return 0;for(let s=0,r=t.Instructions.length;s<r;++s){const o=t.Instructions[s];if(o instanceof Wt){const a=o;e.addClefAtEnd(a);for(const l of i)l!==e&&l.addClefAtEnd(a,!1)}}return this.rules.MeasureRightMargin+e.endInstructionsWidth}updateActiveClefs(t,e){for(let i=0,s=e.length;i<s;i++){const r=this.visibleStaffIndices[i],o=t.FirstInstructionsStaffEntries[r];if(o)for(let h=0,c=o.Instructions.length;h<c;++h){const u=o.Instructions[h];u instanceof Wt?this.activeClefs[i]=u:u instanceof xe?this.activeKeys[i]=u:u instanceof Ae&&(this.activeRhythm[i]=u)}const a=t.getEntriesPerStaff(r);for(let h=0,c=a.length;h<c;++h){const u=a[h];if(u.Instructions)for(let f=0,d=u.Instructions.length;f<d;++f){const p=u.Instructions[f];p instanceof Wt&&(this.activeClefs[i]=p)}}const l=t.LastInstructionsStaffEntries[r];if(l){const h=l.Instructions;for(let c=0,u=h.length;c<u;++c){const f=h[c];f instanceof Wt&&(this.activeClefs[i]=f)}}}}checkAndCreateExtraInstructionMeasure(t){const e=t[0].parentSourceMeasure.FirstInstructionsStaffEntries,i=[];for(let r=0,o=t.length;r<o;++r){const a=t[r];i.push(e[a.ParentStaff.idInMusicSheet])}let s=0;for(let r=0,o=i.length;r<o;++r){const a=i[r];if(!a)continue;const l=a.Instructions;let h,c;for(let u=0,f=l.length;u<f;++u){const d=l[u];d instanceof xe&&d.Key!==this.activeKeys[r].Key&&(h=d),d instanceof Ae&&d!==this.activeRhythm[r]&&(c=d)}if(h!==void 0||c){const u=this.addExtraInstructionMeasure(r,h,c);s=Math.max(s,u)}}s>0&&(this.currentSystemParams.systemMeasures.push({beginLine:Et.None,endLine:Et.None}),this.currentSystemParams.currentWidth+=s,this.currentSystemParams.currentSystemFixWidth+=s)}addExtraInstructionMeasure(t,e,i){const s=this.currentSystemParams.currentSystem,r=Lt.symbolFactory.createExtraGraphicalMeasure(s.StaffLines[t]);e&&r.addKeyAtBegin(e,this.activeKeys[t],this.activeClefs[t]),i!==void 0&&i.PrintObject&&r.addRhythmAtBegin(i),r.PositionAndShape.BorderLeft=0,r.PositionAndShape.BorderTop=0,r.PositionAndShape.BorderBottom=this.rules.StaffHeight;const o=this.rules.MeasureLeftMargin+r.beginInstructionsWidth+this.rules.MeasureRightMargin;return r.PositionAndShape.BorderRight=o,s.StaffLines[t].Measures.push(r),o}addStaveMeasuresToSystem(t){if(t[0]){const e=[];for(let s=0;s<t.length;s++)e.push(t[s]);const i=this.currentSystemParams.currentSystem;for(let s=0;s<this.numberOfVisibleStaffLines;s++){const r=e[s];i.StaffLines[s].Measures.push(r),r.ParentStaffLine=i.StaffLines[s]}i.AddGraphicalMeasures(e)}}getMeasureStartLine(){if(this.thisMeasureBeginsLineRepetition()){const e=this.currentSystemParams.IsSystemStartMeasure(),i=this.measureListIndex===0;if(this.previousMeasureEndsLineRepetition()&&!e)return Et.DotsBoldBoldDots;if(!i)return Et.BoldThinDots}return Et.None}getMeasureEndLine(){var r,o;let t;try{if(t=this.measureList[this.measureListIndex][0].parentSourceMeasure,this.rules.RenderMultipleRestMeasures&&t.multipleRestMeasures>1){const a=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,t.measureListIndex+t.multipleRestMeasures-1);t=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[a]}}finally{}const e=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures,i=e[this.measureListIndex];let s=!1;return i.allRests&&(s=(o=(r=e[this.measureListIndex+i.multipleRestMeasures-1])==null?void 0:r.endsWithLineRepetition)==null?void 0:o.call(r)),this.nextMeasureBeginsLineRepetition()&&this.thisMeasureEndsLineRepetition()?Et.DotsBoldBoldDots:this.thisMeasureEndsLineRepetition()||s?Et.DotsThinBold:this.nextMeasureHasKeyInstructionChange()||this.thisMeasureEndsWordRepetition()||this.nextMeasureBeginsWordRepetition()?Et.DoubleThin:t&&t.endingBarStyleEnum!==void 0?t.endingBarStyleEnum:Et.SingleThin}getLineWidth(t,e,i){let s=t.getLineWidth(e);return e===Et.DotsBoldBoldDots&&(s/=2),i&&e===Et.BoldThinDots&&(s+=this.rules.DistanceBetweenLastInstructionAndRepetitionBarline),s}previousMeasureEndsLineRepetition(){if(this.measureListIndex===0)return!1;for(let t=0,e=this.measureList[this.measureListIndex-1].length;t<e;++t)if(this.measureList[this.measureListIndex-1][t].endsWithLineRepetition())return!0;return!1}thisMeasureBeginsLineRepetition(){for(let t=0,e=this.measureList[this.measureListIndex].length;t<e;++t)if(this.measureList[this.measureListIndex][t].beginsWithLineRepetition())return!0;return!1}nextMeasureBeginsLineRepetition(){const t=this.measureListIndex+1;if(t>=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||!this.measureList[t])return!1;for(let e=0,i=this.measureList[t].length;e<i;++e)if(this.measureList[t][e].beginsWithLineRepetition())return!0;return!1}thisMeasureEndsLineRepetition(){for(let t=0,e=this.measureList[this.measureListIndex].length;t<e;++t)if(this.measureList[this.measureListIndex][t].endsWithLineRepetition())return!0;return!1}nextMeasureBeginsWordRepetition(){const t=this.measureListIndex+1;if(t>=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||t>this.measureList.length-1)return!1;for(let e=0,i=this.measureList[t].length;e<i;++e)if(this.measureList[t][e].beginsWithWordRepetition())return!0;return!1}thisMeasureEndsWordRepetition(){for(let t=0,e=this.measureList[this.measureListIndex].length;t<e;++t)if(this.measureList[this.measureListIndex][t].endsWithWordRepetition())return!0;return!1}nextMeasureHasKeyInstructionChange(){return this.getNextMeasureKeyInstruction()!==void 0}getNextMeasureKeyInstruction(){var t;if(this.measureListIndex<this.measureList.length-1)for(let e=0;e<this.measureList[this.measureListIndex].length;e++){const i=(t=this.measureList[this.measureListIndex+1][e])==null?void 0:t.parentSourceMeasure;return i?i.getKeyInstruction(this.visibleStaffIndices[e]):void 0}}calculateXScalingFactor(t,e){return Math.abs(e-0)<1e-5||Math.abs(t-0)<1e-5?1:(this.currentSystemParams.currentSystem.StaffLines[0].PositionAndShape.Size.width-t)/e}stretchMusicSystem(t){let e=this.calculateXScalingFactor(this.currentSystemParams.currentSystemFixWidth,this.currentSystemParams.currentSystemVarWidth);t&&(e=Math.min(e,this.rules.LastSystemMaxScalingFactor));const i=this.currentSystemParams.currentSystem;for(let s=0,r=i.StaffLines.length;s<r;++s){const o=i.StaffLines[s];let a=0;for(let l=0;l<o.Measures.length;l++){const h=o.Measures[l];h.setPositionInStaffline(a);const c=h.beginInstructionsWidth;if(h.setWidth(c+h.minimumStaffEntriesWidth*e+h.endInstructionsWidth),l<this.currentSystemParams.systemMeasures.length){const f=this.currentSystemParams.systemMeasures[l].beginLine,d=h.getLineWidth(Et.BoldThinDots);switch(f){case Et.BoldThinDots:let p=a;l===0&&(p=a+h.beginInstructionsWidth-d),i.createVerticalLineForMeasure(p,d,f,ns.MeasureBegin,l,h);break}}if(h.staffEntriesScaleFactor=e,h.layoutSymbols(),!(l+1<this.currentSystemParams.systemMeasures.length&&this.currentSystemParams.systemMeasures[l+1].beginLine===Et.BoldThinDots)){let f=Et.SingleThin;l<this.currentSystemParams.systemMeasures.length&&(f=this.currentSystemParams.systemMeasures[l].endLine);const d=h.getLineWidth(f);let p=h.PositionAndShape.RelativePosition.x+h.PositionAndShape.BorderRight-d;f===Et.DotsBoldBoldDots&&(p-=d/2),i.createVerticalLineForMeasure(p,d,f,ns.MeasureEnd,l,h)}a=h.PositionAndShape.RelativePosition.x+h.PositionAndShape.BorderRight}}t&&this.decreaseMusicSystemBorders()}decreaseMusicSystemBorders(){const t=this.currentSystemParams.currentSystem,e=Ti.last(t.StaffLines[0].Measures).PositionAndShape,i=e.RelativePosition.x+e.Size.width;for(let s=0,r=t.StaffLines.length;s<r;++s){const o=t.StaffLines[s];o.PositionAndShape.BorderRight=i;for(let a=0,l=o.StaffLines.length;a<l;++a){const h=o.StaffLines[a];h.End=new O(i,h.End.y)}}t.PositionAndShape.BorderRight=i+this.currentSystemParams.maxLabelLength+this.rules.SystemLabelsRightMargin}updateStaffLinesRelativePosition(t,e,i){for(let s=e;s<t.StaffLines.length;s++)t.StaffLines[s].PositionAndShape.RelativePosition.y=i;t.PositionAndShape.BorderBottom+=i}createMusicPage(){const t=new vr(this.graphicalMusicSheet);return this.graphicalMusicSheet.MusicPages.push(t),t.PageNumber=this.graphicalMusicSheet.MusicPages.length,t.PositionAndShape.BorderLeft=0,t.PositionAndShape.BorderRight=this.graphicalMusicSheet.ParentMusicSheet.pageWidth,t.PositionAndShape.BorderTop=0,t.PositionAndShape.BorderBottom=this.rules.PageHeight,t.PositionAndShape.RelativePosition=new O(0,0),t}addSystemToPage(t,e){t.MusicSystems.push(e),e.Parent=t}optimizeDistanceBetweenStaffLines(t){if(!t.checkStaffEntriesForStaffEntryLink())for(let s=0;s<t.StaffLines.length-1;s++){const r=t.StaffLines[s].BottomLine,o=t.StaffLines[s+1].SkyLine;let a=0;for(let h=0;h<r.length;h++){const c=r[h],u=Math.max(0,h-6),f=Math.min(o.length-1,h+6);let d=0;for(let g=u;g<=f;g++)d=Math.min(d,o[g]);const p=c-d;a=Math.max(p,a)}a+=this.rules.MinSkyBottomDistBetweenStaves,a=Math.max(a,this.rules.StaffHeight+this.rules.MinimumStaffLineDistance);const l=a+t.StaffLines[s].PositionAndShape.RelativePosition.y;this.updateStaffLinesRelativePosition(t,s+1,l)}const e=t.StaffLines[0];t.PositionAndShape.BorderTop=e.PositionAndShape.RelativePosition.y+e.PositionAndShape.BorderTop;const i=t.StaffLines[t.StaffLines.length-1];t.PositionAndShape.BorderBottom=i.PositionAndShape.RelativePosition.y+i.PositionAndShape.BorderBottom}hasExpressionCounts(t){var s;let e=0,i=!1;for(const r of t.GraphicalMeasures)for(const o of r){for(const a of o.parentSourceMeasure.TempoExpressions)if(((s=a.InstantaneousTempo)==null?void 0:s.Enum)===bt.metronomeMark){i=!0;break}for(const a of o.parentSourceMeasure.StaffLinkedExpressions)e+=a.length}return{TempoCount:i?1:0,OtherCount:e}}calculateMusicSystemsRelativePositions(){var o;let t=this.createMusicPage(),e=0,i=this.musicSystems[0],s=0,r=0;if(this.musicSystems.length>1)for(let a=1;a<this.musicSystems.length;a++){const l=this.musicSystems[a-1],h=this.musicSystems[a];let c=this.findRequiredDistanceWithSkyBottomLine(l,h);c>r&&(r=c)}for(let a=0;a<this.musicSystems.length;a++)if(i=this.musicSystems[a],t.MusicSystems.length===0){this.addSystemToPage(t,i),this.rules.CompactMode?e=this.rules.PageTopMarginNarrow:e=this.rules.PageTopMargin,this.graphicalMusicSheet.MusicPages.length===1&&this.rules.RenderTitle&&(e+=this.rules.TitleTopDistance+this.rules.SheetTitleHeight+this.rules.TitleBottomDistance);const l=new O(this.rules.PageLeftMargin+this.rules.SystemLeftMargin,e);i.PositionAndShape.RelativePosition=l,e+i.PositionAndShape.BorderBottom>this.rules.PageHeight-this.rules.PageBottomMargin&&(s++,s<=4&&console.log(`warning: could not fit a single system on page ${t.PageNumber} and measure number ${i.GraphicalMeasures[0][0].MeasureNumber}.
  4. The PageFormat may be too small for this sheet."
  5. Will not give further warnings for all pages, only total.`))}else{const l=this.musicSystems[a-1],h=l.StaffLines[l.StaffLines.length-1],c=h.PositionAndShape;let u=this.findRequiredDistanceWithSkyBottomLine(l,i);u=Math.max(r,u),u+=this.rules.MinSkyBottomDistBetweenSystems,((o=window==null?void 0:window.appName)==null?void 0:o.toLocaleUpperCase())==="GYM"&&(u=u<16?16:u);const f=this.hasExpressionCounts(i);f.TempoCount>0&&this.rules.MetronomeMarksDrawn&&(u+=2),f.OtherCount>0&&this.rules.MetronomeMarksDrawn&&(u+=2),u=Math.max(u,this.rules.MinimumDistanceBetweenSystems+h.StaffHeight);const d=e+c.RelativePosition.y+u,p=d+i.PositionAndShape.BorderMarginBottom;if(!(this.rules.NewPageAtXMLNewPageAttribute&&l.breaksPage)&&p<this.rules.PageHeight-this.rules.PageBottomMargin){this.addSystemToPage(t,i),e=d;const m=new O(this.rules.PageLeftMargin+this.rules.SystemLeftMargin,e);i.PositionAndShape.RelativePosition=m}else{t=this.createMusicPage(),a-=1;continue}}s>0&&console.log(`total amount of pages that couldn't fit a single music system: ${s} of ${t.PageNumber}`)}findRequiredDistanceWithSkyBottomLine(t,e){const i=t.StaffLines[t.StaffLines.length-1],s=e.StaffLines[0],r=i.BottomLine,o=s.SkyLine,a=i.PositionAndShape,l=s.PositionAndShape,h=1/this.rules.SamplingUnit;let c=0;for(let u=0;u<r.length;u++){const f=r[u],d=u+Math.round((a.RelativePosition.x-l.RelativePosition.x)*h);if(d<0)continue;if(d>=o.length)break;const p=Math.max(0,d-6),g=Math.min(o.length-1,d+6);let m=0;for(let b=p;b<=g;b++)m=Math.min(m,o[b]);const S=f-m;c=Math.max(S,c)}return c===0&&(c=a.BorderBottom-l.BorderTop),c}}class In{constructor(){this.systemMeasures=[],this.systemMeasureIndex=0,this.currentWidth=0,this.currentSystemFixWidth=0,this.currentSystemVarWidth=0,this.maxLabelLength=0}IsSystemStartMeasure(){return this.systemMeasureIndex===0}}class hu{constructor(t,e,i){this.getOpenOctaveShift=t,this.getAbsoluteStartTimestamp=e,this.getAbsoluteEndTimestamp=i}}class cu{constructor(){this.keySignatureNoteAlterationsDict=new Ye,this.currentAlterationsComparedToKeyInstructionList=[],this.currentInMeasureNoteAlterationsDict=new Ye}get ActiveKeyInstruction(){return this.activeKeyInstruction}set ActiveKeyInstruction(t){this.activeKeyInstruction=t,this.reactOnKeyInstructionChange()}doCalculationsAtEndOfMeasure(){this.currentInMeasureNoteAlterationsDict.clear(),this.currentAlterationsComparedToKeyInstructionList.clear();for(const t of this.keySignatureNoteAlterationsDict.keys())this.currentInMeasureNoteAlterationsDict.setValue(t,this.keySignatureNoteAlterationsDict.getValue(t))}checkAccidental(t,e){if(!e)return;const i=e.FundamentalNote+e.Octave*12,s=this.currentAlterationsComparedToKeyInstructionList.indexOf(i)>=0;if(this.currentInMeasureNoteAlterationsDict.containsKey(i)){if(s&&this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(i),1),this.currentInMeasureNoteAlterationsDict.getValue(i)!==e.AccidentalHalfTones){this.keySignatureNoteAlterationsDict.containsKey(i)&&this.keySignatureNoteAlterationsDict.getValue(i)!==e.AccidentalHalfTones?(this.currentAlterationsComparedToKeyInstructionList.push(i),this.currentInMeasureNoteAlterationsDict.setValue(i,e.AccidentalHalfTones)):e.Accidental!==yt.NONE&&this.currentInMeasureNoteAlterationsDict.remove(i);const r=this.currentInMeasureNoteAlterationsDict.getValue(i);if(e.Accidental===yt.NONE&&(Math.abs(r)===.5?e=new Kt(e.FundamentalNote,e.Octave,yt.NONE):e=new Kt(e.FundamentalNote,e.Octave,yt.NATURAL)),this.isAlterAmbiguousAccidental(e.Accidental)&&!e.AccidentalXml)return;Lt.symbolFactory.addGraphicalAccidental(t,e)}}else if(e.Accidental!==yt.NONE){if(s||this.currentAlterationsComparedToKeyInstructionList.push(i),this.currentInMeasureNoteAlterationsDict.setValue(i,e.AccidentalHalfTones),this.isAlterAmbiguousAccidental(e.Accidental)&&!e.AccidentalXml)return;Lt.symbolFactory.addGraphicalAccidental(t,e)}else s&&(e=new Kt(e.FundamentalNote,e.Octave,yt.NATURAL),this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(i),1),Lt.symbolFactory.addGraphicalAccidental(t,e))}isAlterAmbiguousAccidental(t){return t===yt.SLASHFLAT||t===yt.QUARTERTONEFLAT}reactOnKeyInstructionChange(){const t=this.activeKeyInstruction.AlteratedNotes;let e;this.activeKeyInstruction.Key>0?e=yt.SHARP:e=yt.FLAT,this.keySignatureNoteAlterationsDict.clear(),this.currentAlterationsComparedToKeyInstructionList.length=0;for(let i=-9;i<9;i++)for(let s=0;s<t.length;s++)this.keySignatureNoteAlterationsDict.setValue(t[s]+i*12,Kt.HalfTonesFromAccidental(e));this.doCalculationsAtEndOfMeasure()}}class uu extends ja{buildMusicSystems(){var l;this.currentSystemParams=new In;const t=[];let e=0,i=-1;for(let h=0,c=this.measureList.length;h<c;++h){this.measureListIndex=h;const u=this.measureList[h];if(!u||!u[0])continue;for(let g=0,m=u.length;g<m;++g)u[g].resetLayout();const f=u[0].parentSourceMeasure,d=this.rules.NewPageAtXMLNewPageAttribute&&f.printNewPageXml;(this.rules.NewSystemAtXMLNewSystemAttribute&&f.printNewSystemXml||d)&&h>0?(i=h-1,t.push({startIndex:e,endIndex:i}),e=h):f.HasEndLine&&this.rules.NewPartAndSystemAfterFinalBarline&&(i=h,t.push({startIndex:e,endIndex:i}),e=h+1)}e<this.measureList.length&&i<e&&t.push({startIndex:e,endIndex:this.measureList.length-1});const s=[];let r=[];const o=[],a=[];for(const h of t){let c=0;for(let w=h.startIndex;w<=h.endIndex;++w){this.measureListIndex=w;const T=this.measureList[w];if(!T||!T[0]){o.push(0),a.push(0);continue}for(let G=0,et=T.length;G<et;++G)T[G].resetLayout();const C=T[0].parentSourceMeasure===this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();let P=this.rules.MeasureLeftMargin,I=0;const F=this.getMeasureStartLine();P+=this.getLineWidth(T[0],F,!1),this.leadSheet||(P+=this.addBeginInstructions(T,!1,C),I+=this.addEndInstructions(T));let L=0;for(let G=0;G<this.numberOfVisibleStaffLines;G++){const et=(((l=T[G].vfVoices["1"])==null?void 0:l.tickables.length)||1)*this.rules.DYMinNoteWidth;L=Math.max(L,T[G].minimumStaffEntriesWidth,et)}const k=this.getMeasureEndLine();I+=this.getLineWidth(T[0],k,!1);const v=P+I+L;o.push(v),a.push(c+v/2),c+=v}const u=c,p=this.getFullPageSystemWidth()-8,m=Math.ceil(u/p)*p/u;let S=1,b=0,y=0,x=0;for(let w=h.startIndex;w<=h.endIndex;++w){const T=a[w];if(T===0)continue;const E=o[w],C=o[w+1]||0;let P=T*m/p;y+=E;const I=(window==null?void 0:window.appName)||"";(I==null?void 0:I.toLocaleUpperCase())==="GYM"?x===6||y+C>p&&x%2===0?(r.push(x),y=E,x=1):x++:y>p?(r.push(x),y=E,x=1):x++,E>p?P=w+1:P=Math.ceil(P),S===P?b+=1:(s.push(b),S=P,b=1)}s.push(b),r.push(x),r=r.filter(Boolean),console.log(r,s)}return this.buildPreparedMusicSystems(r)}buildPreparedMusicSystems(t){let e=!1;this.currentSystemParams=new In,this.currentSystemParams.currentSystem=this.initMusicSystem();for(let i=0,s=this.measureList.length;i<s;++i){this.measureListIndex=i;const r=this.measureList[i];if(!r||!r[0])continue;const o=this.rules.NewPageAtXMLNewPageAttribute&&r[0].parentSourceMeasure.printNewPageXml;this.currentSystemParams.currentSystem.GraphicalMeasures.length===t[this.musicSystems.length-1]&&this.finalizeCurrentAndCreateNewSystem(r,!1,!e,o);for(let S=0,b=r.length;S<b;++S)r[S].resetLayout();const a=r[0].parentSourceMeasure,l=a.HasEndLine,h=this.currentSystemParams.IsSystemStartMeasure(),c=a===this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();let u=this.rules.MeasureLeftMargin,f=0;const d=this.getMeasureStartLine();if(u+=this.getLineWidth(r[0],d,h),!this.leadSheet){let S=!1;e&&this.rules.ShowRhythmAgainAfterPartEndOrFinalBarline&&(S=!0),u+=this.addBeginInstructions(r,h,c||S),f+=this.addEndInstructions(r)}let p=0;for(let S=0;S<this.numberOfVisibleStaffLines;S++)p=Math.max(p,r[S].minimumStaffEntriesWidth);const g=this.getMeasureEndLine();f+=this.getLineWidth(r[0],g,h);const m=u+f+p;this.addMeasureToSystem(r,d,g,m,u,p,f),this.updateActiveClefs(a,r),e=l}return this.finalizeCurrentAndCreateNewSystem(void 0,!1,!1),this.musicSystems}}let mr={};class Lt{constructor(){this.staffEntriesWithGraphicalTies=[],this.staffEntriesWithOrnaments=[],this.staffEntriesWithChordSymbols=[],this.staffLinesWithLyricWords=[],this.graphicalLyricWords=[],this.abstractNotImplementedErrorMessage="abstract, not implemented",this.dynamicExpressionMap=new Map}static get TextMeasurer(){return Lt.textMeasurer}static set TextMeasurer(t){Lt.textMeasurer=t}get leadSheet(){return this.graphicalMusicSheet.LeadSheet}static setMeasuresMinStaffEntriesWidth(t,e){for(let i=0,s=t.length;i<s;++i){const r=t[i];r&&(r.minimumStaffEntriesWidth=e)}}initialize(t){this.graphicalMusicSheet=t,this.rules=t.ParentMusicSheet.Rules,this.rules.clearMusicSheetObjects(),this.prepareGraphicalMusicSheet()}prepareGraphicalMusicSheet(){const t=this.graphicalMusicSheet.ParentMusicSheet;this.staffEntriesWithGraphicalTies=[],this.staffEntriesWithOrnaments=[],this.staffEntriesWithChordSymbols=[],this.staffLinesWithLyricWords=[],this.graphicalMusicSheet.Initialize();const e=this.graphicalMusicSheet.MeasureList,i=this.createAccidentalCalculators(),s=this.graphicalMusicSheet.initializeActiveClefs(),r=[],o=t.getCompleteNumberOfStaves(),a=[];for(let h=0;h<o;h++)a.push(void 0);for(let h=0,c=t.SourceMeasures.length;h<c;++h){const u=t.SourceMeasures[h],f=this.createGraphicalMeasuresForSourceMeasure(u,i,r,a,s);if(e.push(f),u.multipleRestMeasures>0&&this.rules.RenderMultipleRestMeasures){u.isReducedToMultiRest=!0,u.multipleRestMeasureNumber=1;const d=u.multipleRestMeasures-1;h+=d;for(let p=1;p<=d;p++){const g=t.SourceMeasures[u.MeasureNumber-1+p];g.multipleRestMeasureNumber=p+1,g.isReducedToMultiRest=!0,e.push([void 0])}}}if(this.rules.AutoGenerateMutipleRestMeasuresFromRestMeasures&&this.rules.RenderMultipleRestMeasures){let h,c=0;for(let u=0,f=t.SourceMeasures.length;u<f;++u){const d=t.SourceMeasures[u];if(!d.isReducedToMultiRest&&d.canBeReducedToMultiRest())if(c>0){h.isReducedToMultiRest=!0,h.multipleRestMeasureNumber=1,c++,d.multipleRestMeasureNumber=c,d.isReducedToMultiRest=!0;for(let p=0;p<e[u].length;p++)e[u][p]=void 0}else h=d,c=1;else if(c>1){h.multipleRestMeasures=c;const p=this.createGraphicalMeasuresForSourceMeasure(h,i,r,a,s);e[h.measureListIndex]=p,c=0,h=void 0}else c=0,h=void 0}if(c>1){h.multipleRestMeasures=c,h.isReducedToMultiRest=!0;const u=this.createGraphicalMeasuresForSourceMeasure(h,i,r,a,s);e[h.measureListIndex]=u,c=0,h=void 0}}const l=s.map(h=>h.ClefType===Pt.percussion);this.handleStaffEntries(l),this.calculateVerticalContainersList(),this.setIndicesToVerticalGraphicalContainers()}calculate(){this.musicSystems=[],this.clearSystemsAndMeasures(),this.clearRecreatedObjects(),this.createGraphicalTies(),this.calculateSheetLabelBoundingBoxes(),this.calculateXLayout(this.graphicalMusicSheet,this.maxInstrNameLabelLength()),this.graphicalMusicSheet.MusicPages.length=0,this.calculateMusicSystems(),La.transformRelativeToAbsolutePosition(this.graphicalMusicSheet)}calculateXLayout(t,e){let i=0;const s=this.rules.MaxInstructionsConstValue;if(this.graphicalMusicSheet.MeasureList.length>0){let r=this.graphicalMusicSheet.MeasureList[0],o=this.calculateMeasureXLayout(r);o=this.calculateMeasureWidthFromStaffEntries(r,o),Lt.setMeasuresMinStaffEntriesWidth(r,o),i=o*1.2+e+s;for(let a=1;a<this.graphicalMusicSheet.MeasureList.length;a++)r=this.graphicalMusicSheet.MeasureList[a],o=this.calculateMeasureXLayout(r),o=this.calculateMeasureWidthFromStaffEntries(r,o),Lt.setMeasuresMinStaffEntriesWidth(r,o),i=Math.max(i,o*1.2+s)}this.graphicalMusicSheet.MinAllowedSystemWidth=i}calculateMeasureWidthFromStaffEntries(t,e){throw new Error(this.abstractNotImplementedErrorMessage)}formatMeasures(){throw new Error(this.abstractNotImplementedErrorMessage)}calculateMeasureXLayout(t){throw new Error(this.abstractNotImplementedErrorMessage)}initGraphicalMeasuresCreation(){throw new Error(this.abstractNotImplementedErrorMessage)}handleBeam(t,e,i){throw new Error(this.abstractNotImplementedErrorMessage)}handleTiedGraphicalNote(t,e,i,s,r,o,a,l){throw new Error(this.abstractNotImplementedErrorMessage)}handleVoiceEntryLyrics(t,e,i){throw new Error(this.abstractNotImplementedErrorMessage)}handleVoiceEntryOrnaments(t,e,i){throw new Error(this.abstractNotImplementedErrorMessage)}handleVoiceEntryArticulations(t,e,i){throw new Error(this.abstractNotImplementedErrorMessage)}handleVoiceEntryTechnicalInstructions(t,e,i){throw new Error(this.abstractNotImplementedErrorMessage)}handleTuplet(t,e,i){throw new Error(this.abstractNotImplementedErrorMessage)}layoutVoiceEntry(t,e,i,s){throw new Error(this.abstractNotImplementedErrorMessage)}layoutStaffEntry(t){throw new Error(this.abstractNotImplementedErrorMessage)}createGraphicalTie(t,e,i,s,r){throw new Error(this.abstractNotImplementedErrorMessage)}updateStaffLineBorders(t){throw new Error(this.abstractNotImplementedErrorMessage)}calculateMeasureNumberPlacement(t){const e=t.StaffLines[0];if(!e||!e.Measures[0]){j.warn("calculateMeasureNumberPlacement: measure undefined for system.Id "+t.Id);return}let i=e.Measures[0].MeasureNumber,s=0;for(let r=0;r<e.Measures.length;r++){if(this.rules.RenderMeasureNumbersOnlyAtSystemStart&&r>0)return;const o=e.Measures[r];(o.MeasureNumber===0||o.MeasureNumber===1)&&(i=o.MeasureNumber),o!==e.Measures[0]&&this.rules.MeasureNumberLabelXOffset?s=this.rules.MeasureNumberLabelXOffset:s=0;const a=this.rules.UseXMLMeasureNumbers&&o.MeasureNumber===1&&o.parentSourceMeasure.getPrintedMeasureNumber()!==1;((o.MeasureNumber===i||o.MeasureNumber>=i+this.rules.MeasureNumberLabelOffset)&&!o.parentSourceMeasure.ImplicitMeasure||a)&&((o.MeasureNumber!==1||o.MeasureNumber===1&&o!==e.Measures[0]||a)&&this.calculateSingleMeasureNumberPlacement(o,e,t,s),i=o.MeasureNumber)}}calculateSingleMeasureNumberPlacement(t,e,i,s=0){const r=t.parentSourceMeasure.getPrintedMeasureNumber().toString(),o=new jt(r),a=new Se(o,this.rules.MeasureNumberLabelHeight,vt.LeftBottom,this.rules),l=e.SkyBottomLineCalculator;a.setLabelPositionAndShapeBorders(),a.PositionAndShape.Parent=i.PositionAndShape;const h=e.PositionAndShape.RelativePosition.x+t.PositionAndShape.RelativePosition.x-a.PositionAndShape.BorderMarginLeft+s;let c,u=h,f=h-a.PositionAndShape.BorderLeft+a.PositionAndShape.BorderRight;u-=e.PositionAndShape.RelativePosition.x,f-=e.PositionAndShape.RelativePosition.x;const d=u+.5,p=f-.5,g=l.getSkyLineMinInRange(d,p);if(t===e.Measures[0]){let m=0;if(i.GroupBrackets.length>0)for(const S of i.GroupBrackets)m=Math.min(m,S.PositionAndShape.BorderTop);c=Math.min(g,m)}else c=g;c=Math.min(0,c),a.PositionAndShape.RelativePosition=new O(h,c),i.MeasureNumberLabels.push(a)}calculateMeasureNumberSkyline(t){const e=t.StaffLines[0];for(const i of t.MeasureNumberLabels){let s=i.PositionAndShape.RelativePosition.x,r=s-i.PositionAndShape.BorderLeft+i.PositionAndShape.BorderRight;s-=e.PositionAndShape.RelativePosition.x,r-=e.PositionAndShape.RelativePosition.x,e.SkyBottomLineCalculator.updateSkyLineInRange(s,r,i.PositionAndShape.RelativePosition.y+i.PositionAndShape.BorderMarginTop)}}layoutGraphicalTie(t,e,i){throw new Error(this.abstractNotImplementedErrorMessage)}calculateSingleStaffLineLyricsPosition(t,e){let i=0,s=this.rules.StaffHeight;const r=[],o=t.SkyBottomLineCalculator;let a=t.Measures.length;for(let h=0;h<a;++h){const c=t.Measures[h],u=c.PositionAndShape.RelativePosition,f=c.staffEntries.length;for(let d=0;d<f;++d){const p=c.staffEntries[d];if(p.LyricsEntries.length>0){r.push(p),i=Math.max(i,p.LyricsEntries.length);const g=p.PositionAndShape.RelativePosition.x+u.x;let m=Number.MAX_VALUE,S=Number.MIN_VALUE;for(let y=0;y<p.LyricsEntries.length;y++){const x=p.LyricsEntries[y].GraphicalLabel;m=Math.min(m,g+x.PositionAndShape.BorderMarginLeft),S=Math.max(S,g+x.PositionAndShape.BorderMarginRight)}const b=o.getBottomLineMaxInRange(m,S);s=Math.max(s,b)}}}let l=0;a=r.length;for(const h of r)for(let c=0;c<h.LyricsEntries.length;c++){const u=h.LyricsEntries[c],f=u.GraphicalLabel,d=u.LyricsEntry.VerseNumber,p=e.indexOf(d);let m=s+this.rules.LyricsHeight+this.rules.VerticalBetweenLyricsDistance+this.rules.LyricsYOffsetToStaffHeight+(this.rules.VerticalBetweenLyricsDistance+this.rules.LyricsHeight)*p;this.leadSheet&&(m=3.4+(this.rules.VerticalBetweenLyricsDistance+this.rules.LyricsHeight)*p);const S=f.PositionAndShape.RelativePosition.x;f.PositionAndShape.RelativePosition=new O(S,m),l=Math.max(l,m)}if(r.length>0){const h=t.PositionAndShape.Size.width;let c=r[0].PositionAndShape.RelativePosition.x+r[0].PositionAndShape.BorderMarginLeft+r[0].parentMeasure.PositionAndShape.RelativePosition.x;c=c>h?h:c,o.updateBottomLineInRange(c,h,l)}return r}calculateLyricsExtendsAndDashes(t){for(let e=0,i=t.length;e<i;++e){const s=t[e];for(let r=0;r<s.LyricsEntries.length;r++){const o=s.LyricsEntries[r];o.ParentLyricWord&&o.ParentLyricWord.GraphicalLyricsEntries[o.ParentLyricWord.GraphicalLyricsEntries.length-1]!==o&&this.calculateSingleLyricWord(o),o.LyricsEntry.extend&&this.calculateLyricExtend(o)}}}calculateSingleOctaveShift(t,e,i,s){throw new Error(this.abstractNotImplementedErrorMessage)}calculateWordRepetitionInstruction(t,e){throw new Error(this.abstractNotImplementedErrorMessage)}calculateMoodAndUnknownExpression(t,e,i){var a;const s=t.AbsoluteTimestamp,r=this.graphicalMusicSheet.MeasureList[e];let o=new O;if(t.MoodList.length>0||t.UnknownList.length>0){let l="";for(let d=0,p=t.EntriesList.length;d<p;++d){const g=t.EntriesList[d];g.prefix!==""&&(l===""?l+=g.prefix:l+=" "+g.prefix),l===""?l+=g.label:l+=" "+g.label}const h=r[i].ParentStaffLine;if(!h){j.debug("MusicSheetCalculator.calculateMoodAndUnknownExpression: staffLine undefined. Returning.");return}o=this.getRelativePositionInStaffLineFromTimestamp(s,i,h,h==null?void 0:h.isPartOfMultiStaffInstrument()),Math.abs(o.x-0)<1e-4&&(o.x=r[i].beginInstructionsWidth+this.rules.RhythmRightMargin);const c=this.rules.UnknownTextHeight,u=t.getPlacementOfFirstEntry(),f=this.calculateLabel(h,o,l,t.getFontstyleOfFirstEntry(),u,c);new Us(h,f,u,(a=r[i])==null?void 0:a.parentSourceMeasure,t)}}clearRecreatedObjects(){for(let t=0,e=this.staffEntriesWithGraphicalTies.length;t<e;++t){const i=this.staffEntriesWithGraphicalTies[t];i.GraphicalTies.length=0}this.staffEntriesWithGraphicalTies.length=0}handleStaffEntryLink(t,e){j.debug("handleStaffEntryLink not implemented")}calculateMusicSystems(){if(!this.graphicalMusicSheet.MeasureList)return;const t=this.graphicalMusicSheet.MeasureList;if(!t)return;this.rules.MinMeasureToDrawIndex>t.length-1&&(j.debug("minimum measure to draw index out of range. resetting min measure index to limit."),this.rules.MinMeasureToDrawIndex=t.length-1);const e=[];for(let o=this.rules.MinMeasureToDrawIndex,a=t.length;o<a&&o<=this.rules.MaxMeasureToDrawIndex;++o){const l=t[o],h=[];for(let c=0,u=l.length;c<u;++c){const f=t[o][c];if(f!=null&&f.isVisible()&&(h.push(f),this.rules.ColoringEnabled))for(const d of f.staffEntries)for(const p of d.graphicalVoiceEntries)p.color()}e.push(h)}let i=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];i=Math.max(l.length,i);break}if(i===0)return;let s;if(t.length===1||this.rules.RenderSingleHorizontalStaffline?s=new ja:s=new uu,s.initialize(this.graphicalMusicSheet,e,i),this.musicSystems=s.buildMusicSystems(),this.formatMeasures(),this.leadSheet||(this.optimizeRestPlacement(),this.calculateStaffEntryArticulationMarks(),this.rules.RenderSlurs&&this.calculateTieCurves()),this.calculateSkyBottomLines(),this.calculateTupletNumbers(),this.rules.RenderMeasureNumbers)for(let o=0,a=this.musicSystems.length;o<a;++o){const l=this.musicSystems[o];this.calculateMeasureNumberPlacement(l)}if(this.calculateFingerings(),!this.leadSheet&&this.rules.RenderSlurs&&this.calculateSlurs(),this.rules.RenderMeasureNumbers)for(let o=0,a=this.musicSystems.length;o<a;++o){const l=this.musicSystems[o];this.calculateMeasureNumberSkyline(l)}this.leadSheet||this.calculateOrnaments(),this.calculateChordSymbols(),this.leadSheet||(this.calculateDynamicExpressions(),this.calculateMoodAndUnknownExpressions(),this.calculateExpressionAlignements(),this.calculateOctaveShifts(),this.calculatePedals(),this.calculateWavyLines(),this.calculateWordRepetitionInstructions()),this.calculateRepetitionEndings(),this.leadSheet||this.calculateTempoExpressions(),this.calculateRehearsalMarks(),this.calculateLyricsPosition();for(let o=0,a=this.musicSystems.length;o<a;++o){const l=this.musicSystems[o];for(let h=0,c=l.StaffLines.length;h<c;++h){const u=l.StaffLines[h];this.updateStaffLineBorders(u)}}s.calculateSystemYLayout(),this.calculateMarkedAreas();for(let o=0,a=this.graphicalMusicSheet.MusicPages.length;o<a;++o){const l=this.graphicalMusicSheet.MusicPages[o];for(let c=0,u=l.MusicSystems.length;c<u;++c){const f=o===0&&c===0,d=l.MusicSystems[c];d.setMusicSystemLabelsYPosition(),this.leadSheet?d===d.Parent.MusicSystems[0]&&d.createSystemLeftLine(this.rules.SystemThinLineWidth,this.rules.SystemLabelsRightMargin,f):(d.setYPositionsToVerticalLineObjectsAndCreateLines(this.rules),d.createSystemLeftLine(this.rules.SystemThinLineWidth,this.rules.SystemLabelsRightMargin,f),d.createInstrumentBrackets(this.graphicalMusicSheet.ParentMusicSheet.Instruments,this.rules.StaffHeight),d.createGroupBrackets(this.graphicalMusicSheet.ParentMusicSheet.InstrumentalGroups,this.rules.StaffHeight,0),d.alignBeginInstructions()),d.calculateBorders(this.rules)}const h=l.MusicSystems[0].PositionAndShape.BorderTop;for(let c=0,u=l.MusicSystems.length;c<u;++c){const f=l.MusicSystems[c];f.PositionAndShape.RelativePosition=new O(f.PositionAndShape.RelativePosition.x,f.PositionAndShape.RelativePosition.y-h)}for(let c=0,u=l.MusicSystems.length;c<u;++c){const f=l.MusicSystems[c];for(let d=0,p=f.StaffLines.length;d<p;++d)f.StaffLines[d].addActivitySymbolClickArea()}l.PositionAndShape.calculateTopBottomBorders(),l===this.graphicalMusicSheet.MusicPages[0]&&this.calculatePageLabels(l),l.PositionAndShape.calculateTopBottomBorders()}}calculateMarkedAreas(){}calculateChordSymbols(){for(const t of this.musicSystems)for(const e of t.StaffLines){const i=e.SkyBottomLineCalculator;let s=Number.MAX_SAFE_INTEGER;if(this.rules.ChordSymbolYAlignment&&this.rules.ChordSymbolYAlignmentScope==="staffline"){const r=[];for(const o of e.Measures)r.push(...o.staffEntries);s=this.calculateAlignedChordSymbolsOffset(r,i)}for(const r of e.Measures){this.rules.ChordSymbolYAlignment&&this.rules.ChordSymbolYAlignmentScope==="measure"&&(s=this.calculateAlignedChordSymbolsOffset(r.staffEntries,i));for(const o of r.staffEntries)if(!(!o.graphicalChordContainers||o.graphicalChordContainers.length===0))for(let a=0;a<o.graphicalChordContainers.length;a++){const l=o.graphicalChordContainers[a],h=o.PositionAndShape,c=l.PositionAndShape,u=c.BorderMarginLeft+h.AbsolutePosition.x,f=c.BorderMarginRight+h.AbsolutePosition.x;(!this.rules.ChordSymbolYAlignment||s>0)&&(s=i.getSkyLineMinInRange(u,f));let d=0;a===0?(d+=this.rules.ChordSymbolYOffset,d+=.1):d+=this.rules.ChordSymbolYPadding,d*=-1;const p=l.GraphicalLabel;p.PositionAndShape.RelativePosition.y=s+d,p.setLabelPositionAndShapeBorders(),p.PositionAndShape.calculateBoundingBox(),i.updateSkyLineInRange(u,f,s+p.PositionAndShape.BorderMarginTop)}}}}calculateAlignedChordSymbolsOffset(t,e){let i=Number.MAX_SAFE_INTEGER;for(const s of t)for(const r of s.graphicalChordContainers){const o=s.PositionAndShape,a=r.PositionAndShape,l=a.BorderMarginLeft+o.AbsolutePosition.x,h=a.BorderMarginRight+o.AbsolutePosition.x;i=Math.min(i,e.getSkyLineMinInRange(l,h))}return i}layoutMeasureWithWholeRest(t,e,i){}layoutBeams(t){}layoutArticulationMarks(t,e,i){}layoutOrnament(t,e,i){}calculateRestNotePlacementWithinGraphicalBeam(t,e,i,s,r){}calculateTupletNumbers(){}calculateSlurs(){}calculateDynamicExpressionsForMultiExpression(t,e,i){}calculateGraphicalVerbalContinuousDynamic(t,e){const i=t.Label,s=e.x+i.PositionAndShape.BorderMarginLeft,r=e.x+i.PositionAndShape.BorderMarginRight,o=t.ContinuousDynamic.Placement,l=t.ParentStaffLine.SkyBottomLineCalculator;let h;o===z.Below?(h=l.getBottomLineMaxInRange(s,r),i.PositionAndShape.RelativePosition=new O(e.x,h-i.PositionAndShape.BorderMarginTop)):(h=l.getSkyLineMinInRange(s,r),i.PositionAndShape.RelativePosition=new O(e.x,h-i.PositionAndShape.BorderMarginBottom))}calculateGraphicalContinuousDynamic(t,e){var v,G,et;const i=t.ParentStaffLine.ParentStaff.idInMusicSheet,s=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(t.ContinuousDynamic.EndMultiExpression.SourceMeasureParent,i);if(!s){j.warn("MusicSheetCalculator.calculateGraphicalContinuousDynamic: No endMeasure found");return}t.EndMeasure=s;const r=t.ParentStaffLine,o=s.ParentStaffLine,a=o&&r===o;let l=!1;o?l=o==null?void 0:o.isPartOfMultiStaffInstrument():r&&(l=r==null?void 0:r.isPartOfMultiStaffInstrument());const h=W.createFromFraction(t.ContinuousDynamic.EndMultiExpression.AbsoluteTimestamp),c=this.graphicalMusicSheet.GetVerticalContainerFromTimestamp(h),u=c.getFirstNonNullStaffEntry().parentMeasure,f=u.PositionAndShape.AbsolutePosition.x+u.PositionAndShape.BorderRight;let d=new W(0,0,0);for(const H of c.StaffEntries){const nt=(v=H==null?void 0:H.sourceStaffEntry)==null?void 0:v.calculateMaxNoteLength();nt!=null&&nt.gt(d)&&(d=nt)}const p=this.getRelativePositionInStaffLineFromTimestamp(h,i,o,l,0),g=W.plus(h,d),m=this.getRelativePositionInStaffLineFromTimestamp(g,i,o,l,0);m.x>p.x&&m.x<f?p.x+=(m.x-p.x)/this.rules.WedgeEndDistanceBetweenTimestampsFactor:p.x=f-this.rules.WedgeHorizontalMargin;const S=this.dynamicExpressionMap.get(t.ContinuousDynamic.StartMultiExpression.AbsoluteTimestamp.RealValue);S&&(e.x=S.RelativePosition.x+S.BorderMarginRight+this.rules.WedgeHorizontalMargin);const b=r.ParentMusicSystem,y=b.StaffLines.indexOf(r),x=r.SkyBottomLineCalculator;let w=t.ContinuousDynamic.Placement;const T=t.ContinuousDynamic.DynamicType;(T===0||T===1)&&(w=1);let E;a&&p.x-e.x<this.rules.WedgeMinLength&&(p.x=e.x+this.rules.WedgeMinLength);const C=e.x,P=o.Measures[0].beginInstructionsWidth-this.rules.WedgeHorizontalMargin-2;let I=0,F=0;a?I=p.x:(I=r.PositionAndShape.Size.width,F=p.x,E=new xo(t.ContinuousDynamic,o,s.parentSourceMeasure),E.IsSplittedPart=!0,t.IsSplittedPart=!0);let L=0,k=0;if(w===z.Below){let H=0;if(y<b.StaffLines.length-1&&(H=y+1),H>y){const lt=b.StaffLines[H].PositionAndShape.RelativePosition.y-r.PositionAndShape.RelativePosition.y-this.rules.StaffHeight;L=this.rules.StaffHeight+lt/2}else L=this.rules.WedgePlacementBelowY;L-=this.rules.WedgeOpeningLength/2,a||(k=L);let nt=x.getBottomLineMaxInRange(C,I);if(nt>L&&(L=nt),y<b.StaffLines.length-1){const K=r.findClosestStaffEntry(I),lt=r.findClosestStaffEntry(C);lt&&K&&lt.parentVerticalContainer}a||(nt=o.SkyBottomLineCalculator.getBottomLineMaxInRange(P,F),nt>k&&(k=nt),k+=this.rules.WedgeOpeningLength/2,k+=this.rules.WedgeVerticalMargin),L+=this.rules.WedgeOpeningLength/2,L+=this.rules.WedgeVerticalMargin}else if(w===z.Above){if(r.ParentStaff.ParentInstrument.Staves.length===1)L=this.rules.WedgePlacementAboveY;else{let nt=0;y>0&&(nt=y-1);const K=b.StaffLines[nt];L=-(r.PositionAndShape.RelativePosition.y-K.PositionAndShape.RelativePosition.y-this.rules.StaffHeight)/2}L+=this.rules.WedgeOpeningLength/2,a||(k=L);let H=x.getSkyLineMinInRange(C,I);if(H<L&&(L=H),r.ParentStaff.ParentInstrument.Staves.length>1&&y>0){const nt=r.findClosestStaffEntry(C),K=r.findClosestStaffEntry(I);nt&&K&&nt.parentVerticalContainer}a||(H=o.SkyBottomLineCalculator.getSkyLineMinInRange(P,F),H<k&&(k=H),k-=this.rules.WedgeOpeningLength/2),L-=this.rules.WedgeOpeningLength/2,L-=this.rules.WedgeVerticalMargin,a||(k-=this.rules.WedgeVerticalMargin)}t.Lines.clear(),((et=(G=t==null?void 0:t.ParentStaffLine)==null?void 0:G.ParentStaff)==null?void 0:et.StafflineCount)===2&&(L+=1,k+=3),t.ContinuousDynamic.DynamicType===Re.crescendo?a?(t.createCrescendoLines(C,I,L),t.calcPsi()):(t.createFirstHalfCrescendoLines(C,I,L),t.calcPsi(),E.createSecondHalfCrescendoLines(P,F,k),E.calcPsi()):t.ContinuousDynamic.DynamicType===Re.diminuendo&&(a?(t.createDiminuendoLines(C,I,L),t.calcPsi()):(t.createFirstHalfDiminuendoLines(C,I,L),t.calcPsi(),E.createSecondHalfDiminuendoLines(P,F,k),E.calcPsi())),this.dynamicExpressionMap.set(h.RealValue,t.PositionAndShape)}calculateGraphicalInstantaneousDynamicExpression(t,e,i){const s=t.ParentStaffLine;if(!s)return;const r=e.x+t.PositionAndShape.BorderMarginLeft,o=e.x+t.PositionAndShape.BorderMarginRight,a=s.SkyBottomLineCalculator;let l=0;if(t.Placement===z.Above){const h=a.getSkyLineMinInRange(r,o);if(s.isPartOfMultiStaffInstrument()&&s.ParentStaff!==s.ParentStaff.ParentInstrument.Staves[0]){const c=s.ParentMusicSystem.StaffLines[s.ParentMusicSystem.StaffLines.indexOf(s)-1],u=s.PositionAndShape.RelativePosition.y-c.PositionAndShape.RelativePosition.y-this.rules.StaffHeight;h>-u/2?l=-u/2:l=h-t.PositionAndShape.BorderMarginBottom}else l=h-t.PositionAndShape.BorderMarginBottom;t.PositionAndShape.RelativePosition=new O(e.x,l)}else if(t.Placement===z.Below){const h=a.getBottomLineMaxInRange(r,o),c=s.ParentStaff.ParentInstrument.Staves[s.ParentStaff.ParentInstrument.Staves.length-1];if(s.isPartOfMultiStaffInstrument()&&s.ParentStaff!==c){const f=s.ParentMusicSystem.StaffLines[s.ParentMusicSystem.StaffLines.indexOf(s)+1].PositionAndShape.RelativePosition.y-s.PositionAndShape.RelativePosition.y-this.rules.StaffHeight,d=t.PositionAndShape.BorderMarginBottom;h+d<this.rules.StaffHeight+f/2?l=this.rules.StaffHeight+f/2:l=h-t.PositionAndShape.BorderMarginTop}else l=h-t.PositionAndShape.BorderMarginTop;t.PositionAndShape.RelativePosition=new O(e.x,l)}t.updateSkyBottomLine()}calcGraphicalRepetitionEndingsRecursively(t){}layoutSingleRepetitionEnding(t,e,i,s,r,o){}calculateLabel(t,e,i,s,r,o,a=vt.CenterBottom){const l=new jt(i,a);l.fontStyle=s,l.fontHeight=o;const h=new Se(l,o,l.textAlignment,this.rules,t.PositionAndShape),c=1.1;r===z.Below&&(h.Label.textAlignment=vt.LeftTop),h.setLabelPositionAndShapeBorders(),h.PositionAndShape.BorderMarginBottom*=c,h.PositionAndShape.BorderMarginTop*=c,h.PositionAndShape.BorderMarginLeft*=c,h.PositionAndShape.BorderMarginRight*=c;let u=e.x+h.PositionAndShape.BorderMarginLeft,f=e.x+h.PositionAndShape.BorderMarginRight;f>t.PositionAndShape.Size.width&&(f=t.PositionAndShape.Size.width-this.rules.MeasureRightMargin,u=f-h.PositionAndShape.MarginSize.width,e.x=u-h.PositionAndShape.BorderMarginLeft);let d;const p=t.SkyBottomLineCalculator;return r===z.Below?d=p.getBottomLineMaxInRange(u,f):d=p.getSkyLineMinInRange(u,f),h.PositionAndShape.RelativePosition=new O(e.x,d),r===z.Below?p.updateBottomLineInRange(u,f,h.PositionAndShape.BorderMarginBottom+d):p.updateSkyLineInRange(u,f,h.PositionAndShape.BorderMarginTop+d),h}calculateTempoExpressionsForMultiTempoExpression(t,e,i,s){mr={};const r=W.plus(t.AbsoluteTimestamp,e.Timestamp),o=this.graphicalMusicSheet.MeasureList[i];let a=new O;if(e.ContinuousTempo||e.InstantaneousTempo){if(this.rules.MinMeasureToDrawIndex>0||!o[0])return;let l=o[0].ParentStaffLine,h=o[0].PositionAndShape.RelativePosition.x,c=0;for(let u=0;u<o.length;u++)if(!(!o[u].ParentStaffLine||o[u].ParentStaffLine.Measures.length===0)&&o[u].ParentStaffLine.Measures.length>0){l=o[u].ParentStaffLine,h=o[u].PositionAndShape.RelativePosition.x,c=u;break}if(a=this.getRelativePositionInStaffLineFromTimestamp(r,c,l,l.isPartOfMultiStaffInstrument(),h),e.EntriesList.length>0&&e.EntriesList[0].Expression instanceof qt){const u=e.EntriesList[0].Expression;if(u.Placement=z.Above,l.Measures[0].staffEntries.length>0&&Math.abs(a.x-l.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x)===0&&l.ParentMusicSystem===this.musicSystems[0]){const f=l.Measures[0].FirstInstructionStaffEntry;if(f){const d=f.GraphicalInstructions.last();a.x=d.PositionAndShape.RelativePosition.x}this.rules.CompactMode&&(a.x=l.PositionAndShape.RelativePosition.x+l.Measures[0].PositionAndShape.RelativePosition.x)}}for(const u of e.EntriesList){let f=vt.CenterBottom;this.rules.CompactMode&&(f=vt.LeftBottom);const d=this.calculateLabel(l,a,u.label,e.getFontstyleOfFirstEntry(),u.Expression.Placement,this.rules.UnknownTextHeight,f);if(u.Expression instanceof qt){for(const g of l.AbstractExpressions)g instanceof Tr&&(g.SourceExpression.Label,u.Expression.Label);new Tr(u.Expression,d).ParentStaffLine||j.warn("Adding staffline didn't work"),u.Expression.Enum===bt.metronomeMark&&(mr[i]=u.Expression)}else u.Expression instanceof Ni;if(s===t.TempoExpressions.length-1)for(const p of Object.values(mr))this.createMetronomeMark(p,i)}}}createMetronomeMark(t,e){throw new Error(this.abstractNotImplementedErrorMessage)}graphicalMeasureCreatedCalculations(t){}clearSystemsAndMeasures(){for(let t=0,e=this.graphicalMusicSheet.MusicPages.length;t<e;++t){const i=this.graphicalMusicSheet.MusicPages[t];for(let s=0,r=i.MusicSystems.length;s<r;++s){const o=i.MusicSystems[s];for(let a=0,l=o.StaffLines.length;a<l;++a){const h=o.StaffLines[a];for(let c=0,u=h.Measures.length;c<u;++c){const f=h.Measures[c];if(f.FirstInstructionStaffEntry){const d=f.PositionAndShape.ChildElements.indexOf(f.FirstInstructionStaffEntry.PositionAndShape);d>-1&&f.PositionAndShape.ChildElements.splice(d,1),f.FirstInstructionStaffEntry=void 0,f.beginInstructionsWidth=0}if(f.LastInstructionStaffEntry){const d=f.PositionAndShape.ChildElements.indexOf(f.LastInstructionStaffEntry.PositionAndShape);d>-1&&f.PositionAndShape.ChildElements.splice(d,1),f.LastInstructionStaffEntry=void 0,f.endInstructionsWidth=0}}h.Measures=[],h.PositionAndShape.ChildElements=[]}o.StaffLines.length=0,o.PositionAndShape.ChildElements=[]}i.MusicSystems=[],i.PositionAndShape.ChildElements=[]}this.graphicalMusicSheet.MusicPages=[]}handleVoiceEntry(t,e,i,s,r,o,a,l,h,c=void 0,u=void 0){t.StemDirectionXml!==Ft.Undefined&&this.rules.SetWantedStemDirectionByXml&&t.StemDirectionXml!==void 0?t.WantedStemDirection=t.StemDirectionXml:this.calculateStemDirectionFromVoices(t);const f=e.findOrCreateGraphicalVoiceEntry(t);f.octaveShiftValue=l;const d=e.tabStaffEntry;let p;d&&(p=d.findOrCreateGraphicalVoiceEntry(t));for(let g=0,m=t.Notes.length;g<m;++g){const S=t.Notes[g];if(!S||u!==void 0&&u.Link!==void 0&&c!==void 0&&c.indexOf(S)>-1)continue;let b;if(t.IsGrace?b=Lt.symbolFactory.createGraceNote(S,f,r,this.rules,l):(b=Lt.symbolFactory.createNote(S,f,r,l,this.rules,void 0),Lt.stafflineNoteCalculator.trackNote(b)),S.Pitch&&this.checkNoteForAccidental(b,i,r,l),this.resetYPositionForLeadSheet(b.PositionAndShape),e.addGraphicalNoteToListAtCorrectYPosition(f,b),b.PositionAndShape.calculateBoundingBox(),this.leadSheet||(S.NoteBeam!==void 0&&S.PrintObject&&this.handleBeam(b,S.NoteBeam,a),S.NoteTuplet!==void 0&&S.PrintObject&&this.handleTuplet(b,S.NoteTuplet,o)),p){const y=Lt.symbolFactory.createNote(S,p,r,l,this.rules,void 0);d.addGraphicalNoteToListAtCorrectYPosition(p,y),y.PositionAndShape.calculateBoundingBox(),this.leadSheet||S.NoteTuplet&&this.handleTuplet(y,S.NoteTuplet,o)}}return t.Articulations.length>0&&this.handleVoiceEntryArticulations(t.Articulations,t,e),t.TechnicalInstructions.length>0&&this.handleVoiceEntryTechnicalInstructions(t.TechnicalInstructions,t,e),t.LyricsEntries.size()>0&&this.handleVoiceEntryLyrics(t,e,s),t.OrnamentContainer&&this.handleVoiceEntryOrnaments(t.OrnamentContainer,t,e),l}resetYPositionForLeadSheet(t){this.leadSheet&&(t.RelativePosition=new O(t.RelativePosition.x,0))}layoutVoiceEntries(t,e){if(t.PositionAndShape.RelativePosition=new O(0,0),!this.leadSheet)for(const i of t.graphicalVoiceEntries){const s=i.notes;if(s.length===0)continue;const r=s[0].sourceNote.ParentVoiceEntry,o=s[0].sourceNote.Pitch!==void 0;this.layoutVoiceEntry(r,s,t,o)}}maxInstrNameLabelLength(){var e;let t=0;for(const i of this.graphicalMusicSheet.ParentMusicSheet.Instruments)if(((e=i.NameLabel)==null?void 0:e.print)&&i.Voices.length>0&&i.Voices[0].Visible){let s=i.NameLabel;this.rules.RenderPartNames||(s=new jt("",s.textAlignment,s.font));const r=new Se(s,this.rules.InstrumentLabelTextHeight,vt.LeftCenter,this.rules);r.setLabelPositionAndShapeBorders(),t=Math.max(t,r.PositionAndShape.MarginSize.width)}return this.rules.RenderPartNames?t:0}calculateSheetLabelBoundingBoxes(){var s;const t=this.graphicalMusicSheet.ParentMusicSheet,e=this.rules.DefaultColorTitle;if(t.Title!==void 0&&this.rules.RenderTitle){const r=new Se(t.Title,this.rules.SheetTitleHeight,vt.CenterBottom,this.rules);r.Label.IsCreditLabel=!0,r.Label.colorDefault=e,this.graphicalMusicSheet.Title=r,r.setLabelPositionAndShapeBorders()}else this.rules.RenderTitle||(this.graphicalMusicSheet.Title=void 0);if(t.Subtitle!==void 0&&this.rules.RenderSubtitle){const r=new Se(t.Subtitle,this.rules.SheetSubtitleHeight,vt.CenterCenter,this.rules);r.Label.IsCreditLabel=!0,r.Label.colorDefault=e,this.graphicalMusicSheet.Subtitle=r,r.setLabelPositionAndShapeBorders()}else this.rules.RenderSubtitle||(this.graphicalMusicSheet.Subtitle=void 0);if(t.Composer!==void 0&&this.rules.RenderComposer){const r=new Se(t.Composer,this.rules.SheetComposerHeight,vt.RightCenter,this.rules);r.Label.IsCreditLabel=!0,r.Label.colorDefault=e,this.graphicalMusicSheet.Composer=r,r.setLabelPositionAndShapeBorders()}else this.rules.RenderComposer||(this.graphicalMusicSheet.Composer=void 0);if(t.Lyricist!==void 0&&this.rules.RenderLyricist){const r=new Se(t.Lyricist,this.rules.SheetAuthorHeight,vt.LeftCenter,this.rules);r.Label.IsCreditLabel=!0,r.Label.colorDefault=e,this.graphicalMusicSheet.Lyricist=r,r.setLabelPositionAndShapeBorders()}else this.rules.RenderLyricist||(this.graphicalMusicSheet.Lyricist=void 0);const i=(s=this.graphicalMusicSheet.musicSheet.sourceMeasures)==null?void 0:s[0];if(i&&i.FirstInstructionsStaffEntries.length>0){const r=i.FirstInstructionsStaffEntries[0];let o,a;for(let l=0,h=r.Instructions.length;l<h;++l){const c=r.Instructions[l];c instanceof Wt||(c instanceof xe?o=c:c instanceof Ae&&(a=c))}if(o){t.CurrentKeyInstruction=o;const l=Yt.keySignature(o),h=new jt("1="+l),c=new jt(`${a.Rhythm.Numerator}
  6. ${a.Rhythm.Denominator}`),u=new Se(h,this.rules.SheetAuthorHeight,vt.LeftCenter,this.rules),f=new Se(c,this.rules.SheetAuthorHeight,vt.LeftCenter,this.rules),d=new jt("\u1173"),p=new Se(d,this.rules.SheetAuthorHeight,vt.LeftCenter,this.rules);h.fontFamily="Arial",h.IsCreditLabel=!0,h.colorDefault=e,c.fontFamily="Arial",c.IsCreditLabel=!0,c.colorDefault=e,d.fontFamily="Arial",d.IsCreditLabel=!0,d.colorDefault=e,this.graphicalMusicSheet.JianpuKeySignature=u,this.graphicalMusicSheet.jianpuTimeSignature=f,this.graphicalMusicSheet.jianpuLine=p,u.setLabelPositionAndShapeBorders(),f.setLabelPositionAndShapeBorders(),p.setLabelPositionAndShapeBorders()}}}checkMeasuresForWholeRestNotes(){for(let t=0,e=this.musicSystems.length;t<e;++t){const i=this.musicSystems[t];for(let s=0,r=i.StaffLines.length;s<r;++s){const o=i.StaffLines[s];for(let a=0,l=o.Measures.length;a<l;++a){const h=o.Measures[a];if(h.staffEntries.length===1){const c=h.staffEntries[0];if(c.graphicalVoiceEntries.length>0&&c.graphicalVoiceEntries[0].notes.length===1){const u=c.graphicalVoiceEntries[0].notes[0];!u.sourceNote.Pitch&&new W(1,2).lt(u.sourceNote.Length)&&this.layoutMeasureWithWholeRest(u,c,h)}}}}}}optimizeRestNotePlacement(t,e){if(t.graphicalVoiceEntries.length===0)return;const i=t.graphicalVoiceEntries[0].notes;if(i.length===0)return;const s=i[0],r=s.sourceNote.isRest();if(t.graphicalVoiceEntries.length===2){let o=!1;const a=t.graphicalVoiceEntries[1].notes;a.length>0&&(o=a[0].sourceNote.isRest()),r&&o?this.calculateTwoRestNotesPlacementWithCollisionDetection(t):(r||o)&&this.calculateRestNotePlacementWithCollisionDetectionFromGraphicalNote(t)}else if(r&&t!==e.staffEntries[0]&&t!==e.staffEntries[e.staffEntries.length-1]){const o=e.staffEntries.indexOf(t),a=e.staffEntries[o-1],l=e.staffEntries[o+1];if(a.graphicalVoiceEntries.length===1){const h=a.graphicalVoiceEntries[0].notes[0];if(h.sourceNote.NoteBeam!==void 0&&l.graphicalVoiceEntries.length===1){const c=l.graphicalVoiceEntries[0].notes[0];c.sourceNote.NoteBeam!==void 0&&h.sourceNote.NoteBeam===c.sourceNote.NoteBeam&&(this.calculateRestNotePlacementWithinGraphicalBeam(t,s,h,l,c),t.PositionAndShape.calculateBoundingBox())}}}}getRelativePositionInStaffLineFromTimestamp(t,e,i,s,r=0){let o=new O,a,l;const h=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,c=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(t),u=Math.min(Math.floor(c),h-1),f=Math.min(Math.ceil(c),h-1);if(u<0||e<0)return o;if(a=this.getFirstLeftNotNullStaffEntryFromContainer(u,e,s),l=this.getFirstRightNotNullStaffEntryFromContainer(f,e,s),a&&l){let d=a.parentMeasure.PositionAndShape.RelativePosition.x;r>0&&(d=r);let p=a.PositionAndShape.RelativePosition.x+d,g=l.PositionAndShape.RelativePosition.x+l.parentMeasure.PositionAndShape.RelativePosition.x;r>0&&(g=l.PositionAndShape.RelativePosition.x+d);let m=0;if(a!==l){const S=a.getAbsoluteTimestamp(),b=l.getAbsoluteTimestamp();m=W.minus(t,S).RealValue/W.minus(b,S).RealValue}a.parentMeasure.ParentStaffLine!==l.parentMeasure.ParentStaffLine&&(a.parentMeasure.ParentStaffLine===i?g=i.PositionAndShape.Size.width:p=i.PositionAndShape.RelativePosition.x),o=new O(p+(g-p)*m,0)}return o}getRelativeXPositionFromTimestamp(t){const e=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,i=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(t),s=Math.max(0,Math.min(Math.round(i),e-1)),r=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[s].getFirstNonNullStaffEntry();return r.PositionAndShape.RelativePosition.x+r.parentMeasure.PositionAndShape.RelativePosition.x}calculatePageLabels(t){var o;this.rules.RenderSingleHorizontalStaffline&&(t.PositionAndShape.BorderRight=t.PositionAndShape.Size.width,t.PositionAndShape.calculateBoundingBox(),this.graphicalMusicSheet.ParentMusicSheet.pageWidth=t.PositionAndShape.Size.width);let e=10;if(t.MusicSystems.length>0){const a=t.MusicSystems[0];e=a.PositionAndShape.RelativePosition.y+a.PositionAndShape.BorderTop}if(this.graphicalMusicSheet.Title){const a=this.graphicalMusicSheet.Title;a.PositionAndShape.Parent=t.PositionAndShape;const l=new O;l.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth/2,l.y=this.rules.TitleTopDistance+this.rules.SheetTitleHeight,a.PositionAndShape.RelativePosition=l,t.Labels.push(a)}if(this.graphicalMusicSheet.Subtitle){const a=this.graphicalMusicSheet.Subtitle;a.PositionAndShape.Parent=t.PositionAndShape;const l=new O;l.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth/2,l.y=this.rules.TitleTopDistance+this.rules.SheetTitleHeight+this.rules.SheetMinimumDistanceBetweenTitleAndSubtitle,a.PositionAndShape.RelativePosition=l,t.Labels.push(a)}const i=this.graphicalMusicSheet.Composer;let s;if(i){i.PositionAndShape.Parent=t.PositionAndShape,i.setLabelPositionAndShapeBorders();const a=new O;a.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth-this.rules.PageRightMargin,a.y=e,a.y-=this.rules.SystemComposerDistance;const l=(o=i.TextLines)==null?void 0:o.length;l>1&&(a.y-=i.PositionAndShape.BorderBottom*(l-1)/l),s=a.y,i.PositionAndShape.RelativePosition=a,t.Labels.push(i)}const r=this.graphicalMusicSheet.Lyricist;if(r){r.PositionAndShape.Parent=t.PositionAndShape,r.setLabelPositionAndShapeBorders();const a=new O;a.x=this.rules.PageLeftMargin,a.y=e,a.y+=r.PositionAndShape.BorderBottom,a.y=Math.min(a.y,s!=null?s:Number.MAX_SAFE_INTEGER),r.PositionAndShape.RelativePosition=a,t.Labels.push(r)}}createGraphicalTies(){for(let t=0;t<this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length;t++){const e=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[t];for(let i=0;i<e.CompleteNumberOfStaves;i++)for(let s=0;s<e.VerticalSourceStaffEntryContainers.length;s++){const r=e.VerticalSourceStaffEntryContainers[s].StaffEntries[i];if(r){const o=this.graphicalMusicSheet.findGraphicalStaffEntryFromMeasureList(i,t,r);o&&(o.GraphicalTies.clear(),o.ties.clear());for(let a=0,l=r.VoiceEntries.length;a<l;++a){const h=r.VoiceEntries[a];for(let c=0,u=h.Notes.length;c<u;++c){const f=h.Notes[c];if(f.NoteTie){const d=f.NoteTie;if(f===f.NoteTie.Notes.last())continue;for(const p of o.GraphicalTies)p.Tie;this.handleTie(d,o,i,t)}}}this.setTieDirections(o)}}}}handleTie(t,e,i,s){if(!e)return;e.ties.push(t);let r=e,o,a,l;for(let h=1;h<t.Notes.length;h++)if(o=r.findTieGraphicalNoteFromNote(t.Notes[h-1]),a=this.graphicalMusicSheet.GetGraphicalFromSourceStaffEntry(t.Notes[h].ParentStaffEntry),!!a){if(l=a.findTieGraphicalNoteFromNote(t.Notes[h]),o!==void 0&&l!==void 0&&a){if(!o.sourceNote.PrintObject||!l.sourceNote.PrintObject)continue;const c=this.createGraphicalTie(t,r,a,o,l);r.GraphicalTies.push(c),this.staffEntriesWithGraphicalTies.indexOf(r)>=0&&this.staffEntriesWithGraphicalTies.push(r)}r=a}}setTieDirections(t){if(!t)return;const e=t.ties;if(e.length>1){let i;for(const s of e){const r=s.Notes[0];(!i||r.Pitch.getHalfTone()>i.Pitch.getHalfTone())&&(i=r)}for(const s of e)s.TieDirection===z.NotYetDefined&&(s.Notes[0]===i?s.TieDirection=z.Above:s.TieDirection=z.Below)}}createAccidentalCalculators(){const t=[],e=this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();if(e)for(let i=0;i<e.CompleteNumberOfStaves;i++){const s=new cu;if(t.push(s),e.FirstInstructionsStaffEntries[i])for(let r=0,o=e.FirstInstructionsStaffEntries[i].Instructions.length;r<o;++r){const a=e.FirstInstructionsStaffEntries[i].Instructions[r];if(a instanceof xe){const l=a;s.ActiveKeyInstruction=l}}}return t}calculateVerticalContainersList(){const t=this.graphicalMusicSheet.MeasureList[0].length;for(let e=0;e<this.graphicalMusicSheet.MeasureList.length;e++)for(let i=0;i<t;i++){const s=this.graphicalMusicSheet.MeasureList[e][i];if(!!s)for(let r=0,o=s.staffEntries.length;r<o;++r){const a=s.staffEntries[r],l=this.graphicalMusicSheet.getOrCreateVerticalContainer(a.getAbsoluteTimestamp());l&&(l.StaffEntries[i]=a,a.parentVerticalContainer=l)}}}setIndicesToVerticalGraphicalContainers(){for(let t=0;t<this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length;t++)this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[t].Index=t}createGraphicalMeasuresForSourceMeasure(t,e,i,s,r){this.initGraphicalMeasuresCreation();const o=[],a=[],l=[],h=[];let c=!0;for(let u=0;u<t.CompleteNumberOfStaves;u++){const f=this.createGraphicalMeasure(t,l,a,e[u],r,s,i,u,h);c=c&&f.hasOnlyRests,o.push(f)}return t.allRests=c,t.VerticalMeasureList=o,o}createGraphicalMeasure(t,e,i,s,r,o,a,l,h){var d,p,g,m,S,b;const c=this.graphicalMusicSheet.ParentMusicSheet.getStaffFromIndex(l);let u;if(r[l].ClefType===Pt.TAB)c.isTab=!0,u=Lt.symbolFactory.createTabStaffMeasure(t,c);else if(t.multipleRestMeasures&&this.rules.RenderMultipleRestMeasures)u=Lt.symbolFactory.createMultiRestMeasure(t,c);else{if(t.multipleRestMeasureNumber>1)return;u=Lt.symbolFactory.createGraphicalMeasure(t,c)}if(u.hasError=t.getErrorInMeasure(l),t.FirstInstructionsStaffEntries[l])for(let y=0,x=t.FirstInstructionsStaffEntries[l].Instructions.length;y<x;++y){const w=t.FirstInstructionsStaffEntries[l].Instructions[y];if(w instanceof xe){const T=xe.copy(w),E=u.getTransposedHalftones();E!==0&&u.ParentStaff.ParentInstrument.MidiInstrumentId!==st.Percussion&&Lt.transposeCalculator&&Lt.transposeCalculator.transposeKey(T,E),s.ActiveKeyInstruction=T}}const f=[];for(let y=0,x=t.StaffLinkedExpressions[l].length;y<x;++y){const w=t.StaffLinkedExpressions[l][y];if(w.OctaveShiftStart){f.push(w);const T=w.OctaveShiftStart;let E=(d=T==null?void 0:T.ParentEndMultiExpression)==null?void 0:d.AbsoluteTimestamp;T!=null&&T.ParentEndMultiExpression||(E=W.plus(t.AbsoluteTimestamp,t.Duration)),o[l]=new hu(T,w==null?void 0:w.AbsoluteTimestamp,E)}}for(let y=0;y<t.VerticalSourceStaffEntryContainers.length;y++){const x=t.VerticalSourceStaffEntryContainers[y].StaffEntries[l];if(x){for(let C=0,P=x.Instructions.length;C<P;++C){const I=x.Instructions[C];I instanceof Wt&&(r[l]=I)}const w=Lt.symbolFactory.createStaffEntry(x,u);y<u.staffEntries.length?u.addGraphicalStaffEntryAtTimestamp(w):u.addGraphicalStaffEntry(w);const T=[];x.Link&&(x.findLinkedNotes(T),this.handleStaffEntryLink(w,h));let E=oe.NONE;if(o[l]&&o[l].getAbsoluteStartTimestamp.lte(x.AbsoluteTimestamp)&&x.AbsoluteTimestamp.lte(o[l].getAbsoluteEndTimestamp)&&(E=o[l].getOpenOctaveShift.Type),E===oe.NONE){for(const C of f)if(((g=(p=C.OctaveShiftStart)==null?void 0:p.ParentStartMultiExpression)==null?void 0:g.AbsoluteTimestamp.lte(x.AbsoluteTimestamp))&&!((S=(m=C.OctaveShiftStart)==null?void 0:m.ParentEndMultiExpression)!=null&&S.AbsoluteTimestamp.lt(x.AbsoluteTimestamp))){E=C.OctaveShiftStart.Type;break}}for(let C=0,P=x.VoiceEntries.length;C<P;++C){const I=x.VoiceEntries[C];E=this.handleVoiceEntry(I,w,s,a,r[l],e,i,E,l,T,x)}if(x.Instructions.length>0){const C=x.Instructions[0];Lt.symbolFactory.createInStaffClef(w,C)}this.rules.RenderChordSymbols&&((b=x.ChordContainers)==null?void 0:b.length)>0&&(x.ParentStaff.ParentInstrument.HasChordSymbols=!0,Lt.symbolFactory.createChordSymbols(x,w,s.ActiveKeyInstruction,this.graphicalMusicSheet.ParentMusicSheet.Transpose))}}if(s.doCalculationsAtEndOfMeasure(),t.LastInstructionsStaffEntries[l]){const y=t.LastInstructionsStaffEntries[l];for(let x=0,w=y.Instructions.length;x<w;++x){const T=y.Instructions[x];T instanceof Wt&&(r[l]=T)}}for(let y=0,x=t.StaffLinkedExpressions[l].length;y<x;++y){const w=t.StaffLinkedExpressions[l][y];w.OctaveShiftEnd!==void 0&&o[l]!==void 0&&w.OctaveShiftEnd===o[l].getOpenOctaveShift&&(o[l]=void 0)}for(const y of u.staffEntries)for(const x of y.graphicalVoiceEntries)this.setBeamNotesWantedStemDirections(x.parentVoiceEntry);if(this.rules.FillEmptyMeasuresWithWholeRest>=1&&u.staffEntries.length===0){const y=new we(new yn(u.parentSourceMeasure,u.parentSourceMeasure.AbsoluteTimestamp,u.parentSourceMeasure.CompleteNumberOfStaves),c),x=new ir(new W(0,1),c.Voices[0],y),w=new Cn(x,y,W.createFromFraction(t.Duration),void 0,t);w.PrintObject=this.rules.FillEmptyMeasuresWithWholeRest===_o.YesVisible,x.addNote(w);const T=Lt.symbolFactory.createStaffEntry(y,u);u.addGraphicalStaffEntry(T),T.relInMeasureTimestamp=x.Timestamp;const E=Lt.symbolFactory.createVoiceEntry(x,T);T.graphicalVoiceEntries.push(E);const C=Lt.symbolFactory.createNote(w,E,new Wt,oe.NONE,void 0);Lt.stafflineNoteCalculator.trackNote(C),E.notes.push(C)}u.hasOnlyRests=!0;for(const y of u.staffEntries)if(u.hasOnlyRests=y.hasOnlyRests(),!u.hasOnlyRests)break;return u}checkNoteForAccidental(t,e,i,s){let r=t.sourceNote.Pitch;const o=t.parentVoiceEntry.parentStaffEntry.parentMeasure.getTransposedHalftones();o!==0&&t.sourceNote.ParentStaffEntry.ParentStaff.ParentInstrument.MidiInstrumentId!==st.Percussion&&(r=t.Transpose(e.ActiveKeyInstruction,i,o,s),t.sourceNote.TransposedPitch=r),t.sourceNote.halfTone=r.getHalfTone(),e.checkAccidental(t,r)}handleStaffEntries(t){for(let e=0,i=this.graphicalMusicSheet.MeasureList.length;e<i;++e){const s=this.graphicalMusicSheet.MeasureList[e];for(let r=0,o=s.length;r<o;++r){const a=s[r];if(!!a){this.rules.PercussionOneLineCutoff!==void 0&&this.rules.PercussionOneLineCutoff!==0&&t[r]&&(this.rules.PercussionOneLineCutoff===-1||Lt.stafflineNoteCalculator.getStafflineUniquePositionCount(r)<this.rules.PercussionOneLineCutoff);for(const l of a.staffEntries)l.parentMeasure!==void 0&&l.graphicalVoiceEntries.length>0&&l.graphicalVoiceEntries[0].notes.length>0&&(this.layoutVoiceEntries(l,r),this.layoutStaffEntry(l));this.graphicalMeasureCreatedCalculations(a)}}}}calculateSkyBottomLines(){for(const t of this.musicSystems)for(const e of t.StaffLines)e.SkyBottomLineCalculator.calculateLines()}calculateExpressionAlignements(){}calculateStaffEntryArticulationMarks(){for(let t=0,e=this.musicSystems.length;t<e;++t){const i=this.musicSystems[t];for(let s=0,r=i.StaffLines.length;s<r;++s){const o=i.StaffLines[s];for(let a=0,l=o.Measures.length;a<l;++a){const h=o.Measures[a];for(let c=0,u=h.staffEntries.length;c<u;++c){const f=h.staffEntries[c];for(let d=0,p=f.sourceStaffEntry.VoiceEntries.length;d<p;++d){const g=f.sourceStaffEntry.VoiceEntries[d];g.Articulations.length>0&&this.layoutArticulationMarks(g.Articulations,g,f)}}}}}}calculateOrnaments(){for(let t=0,e=this.musicSystems.length;t<e;++t){const i=this.musicSystems[t];for(let s=0,r=i.StaffLines.length;s<r;++s){const o=i.StaffLines[s];for(let a=0,l=o.Measures.length;a<l;++a){const h=o.Measures[a];for(let c=0,u=h.staffEntries.length;c<u;++c){const f=h.staffEntries[c];for(let d=0,p=f.sourceStaffEntry.VoiceEntries.length;d<p;++d){const g=f.sourceStaffEntry.VoiceEntries[d];if(g.OrnamentContainer){if(g.hasTie()&&!f.relInMeasureTimestamp.Equals(g.Timestamp))continue;this.layoutOrnament(g.OrnamentContainer,g,f),this.staffEntriesWithOrnaments.indexOf(f)===-1&&this.staffEntriesWithOrnaments.push(f)}}}}}}}calculateFingerings(){if(!(this.rules.FingeringPosition===z.Left||this.rules.FingeringPosition===z.Right))for(const t of this.musicSystems)for(const e of t.StaffLines)for(const i of e.Measures){const s=i.isUpperStaffOfInstrument()?z.Above:z.Below;for(const r of i.staffEntries){r.FingeringEntries=[];const o=e.SkyBottomLineCalculator,a=r.PositionAndShape.RelativePosition.x+i.PositionAndShape.RelativePosition.x,l=[];for(const h of r.graphicalVoiceEntries)for(const c of h.notes){const u=c.sourceNote;u.Fingering&&!u.IsGraceNote&&l.push(u.Fingering)}s===z.Below&&l.reverse();for(let h=0;h<l.length;h++){const c=l[h],u=s===z.Above?vt.CenterBottom:vt.CenterTop,f=new jt(c.value,u),d=new Se(f,this.rules.FingeringTextSize,f.textAlignment,this.rules,e.PositionAndShape),p=a+d.PositionAndShape.BorderMarginLeft,g=a+d.PositionAndShape.BorderMarginRight;let m;s===z.Above?m=o.getSkyLineMinInRange(p,g):m=o.getBottomLineMaxInRange(p,g);let S=0;h===0?(S+=this.rules.FingeringOffsetY,s===z.Above&&(S+=.1)):S+=this.rules.FingeringPaddingY,s===z.Above&&(S*=-1),d.PositionAndShape.RelativePosition.y+=m+S,d.PositionAndShape.RelativePosition.x=a,d.setLabelPositionAndShapeBorders(),d.PositionAndShape.calculateBoundingBox(),r.FingeringEntries.push(d);const b=d.PositionAndShape.RelativePosition.x+d.PositionAndShape.BorderLeft,y=b-d.PositionAndShape.BorderLeft+d.PositionAndShape.BorderRight;s===z.Above?o.updateSkyLineInRange(b,y,d.PositionAndShape.RelativePosition.y+d.PositionAndShape.BorderTop):s===z.Below&&o.updateBottomLineInRange(b,y,d.PositionAndShape.RelativePosition.y+d.PositionAndShape.BorderBottom)}}}}optimizeRestPlacement(){for(let t=0,e=this.musicSystems.length;t<e;++t){const i=this.musicSystems[t];for(let s=0,r=i.StaffLines.length;s<r;++s){const o=i.StaffLines[s];for(let a=0,l=o.Measures.length;a<l;++a){const h=o.Measures[a];for(let c=0,u=h.staffEntries.length;c<u;++c){const f=h.staffEntries[c];this.optimizeRestNotePlacement(f,h)}}}}}calculateTwoRestNotesPlacementWithCollisionDetection(t){const e=t.graphicalVoiceEntries[0].notes[0],i=t.graphicalVoiceEntries[1].notes[0];i.PositionAndShape.RelativePosition=new O(0,2.5),t.PositionAndShape.calculateAbsolutePositionsRecursiveWithoutTopelement(),e.PositionAndShape.computeNonOverlappingPositionWithMargin(t.PositionAndShape,ve.Up,new O(0,i.PositionAndShape.RelativePosition.y));const s=e.PositionAndShape.RelativePosition;s.y-=1,e.PositionAndShape.RelativePosition=s,t.PositionAndShape.calculateBoundingBox()}calculateRestNotePlacementWithCollisionDetectionFromGraphicalNote(t){let e,i;t.graphicalVoiceEntries[0].notes[0].sourceNote.isRest()?(e=t.graphicalVoiceEntries[0].notes[0],i=t.graphicalVoiceEntries[1].notes):(i=t.graphicalVoiceEntries[0].notes,e=t.graphicalVoiceEntries[1].notes[0]);let s=!1;t.PositionAndShape.calculateAbsolutePositionsRecursiveWithoutTopelement();for(let r=0,o=i.length;r<o;++r){const a=i[r];if(e.PositionAndShape.marginCollisionDetection(a.PositionAndShape)){s=!0;break}}if(s)if(e.sourceNote.ParentVoiceEntry.ParentVoice instanceof bs){const r=i[0].PositionAndShape.BorderMarginBottom+i[0].PositionAndShape.RelativePosition.y;e.PositionAndShape.RelativePosition=new O(0,r-e.PositionAndShape.BorderMarginTop+.5)}else{const r=i[i.length-1],o=r.PositionAndShape.BorderMarginTop+r.PositionAndShape.RelativePosition.y;if(i[0].sourceNote.ParentVoiceEntry.ParentVoice instanceof bs)e.PositionAndShape.RelativePosition=new O(0,o-e.PositionAndShape.BorderMarginBottom-.5);else{const a=i[0].PositionAndShape.BorderMarginBottom+i[0].PositionAndShape.RelativePosition.y;a<2?e.PositionAndShape.RelativePosition=new O(0,a-e.PositionAndShape.BorderMarginTop+.5):e.PositionAndShape.RelativePosition=new O(0,o-e.PositionAndShape.BorderMarginBottom-0)}}t.PositionAndShape.calculateBoundingBox()}calculateTieCurves(){for(const t of this.musicSystems)for(const e of t.StaffLines)for(const i of e.Measures)for(const s of i.staffEntries)for(const r of s.GraphicalTies)if(r.StartNote!==void 0&&r.StartNote.parentVoiceEntry.parentStaffEntry===s){const o=r.StartNote.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentStaffLine!==r.EndNote.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentStaffLine;this.layoutGraphicalTie(r,o,i.ParentStaff.isTab)}}calculateLyricsPosition(){const t=new Ye;for(let e=0,i=this.graphicalMusicSheet.ParentMusicSheet.Instruments.length;e<i;++e){const s=this.graphicalMusicSheet.ParentMusicSheet.Instruments[e];s.HasLyrics&&s.LyricVersesNumbers.length>0&&s.LyricVersesNumbers.sort()}for(let e=0,i=this.musicSystems.length;e<i;++e){const s=this.musicSystems[e];for(let r=0,o=s.StaffLines.length;r<o;++r){const a=s.StaffLines[r],l=this.calculateSingleStaffLineLyricsPosition(a,a.ParentStaff.ParentInstrument.LyricVersesNumbers);t.setValue(a,l),this.calculateLyricsExtendsAndDashes(t.getValue(a))}}for(let e=0,i=this.musicSystems.length;e<i;++e){const s=this.musicSystems[e];for(let r=0,o=s.StaffLines.length;r<o;++r){const a=s.StaffLines[r];this.calculateLyricsExtendsAndDashes(t.getValue(a))}}}calculateSingleLyricWord(t){const e=t.ParentLyricWord,i=e.GraphicalLyricsEntries.indexOf(t);let s;if(i>=0&&(s=e.GraphicalLyricsEntries[i+1]),!s)return;const r=t.StaffEntryParent.parentMeasure.ParentStaffLine,o=s.StaffEntryParent.parentMeasure.ParentStaffLine,a=t.StaffEntryParent,l=s.StaffEntryParent;if(t.StaffEntryParent.parentMeasure.ParentStaffLine===s.StaffEntryParent.parentMeasure.ParentStaffLine){const h=a.parentMeasure.PositionAndShape.RelativePosition.x+a.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.BorderMarginRight,c=l.parentMeasure.PositionAndShape.RelativePosition.x+l.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.RelativePosition.x+s.GraphicalLabel.PositionAndShape.BorderMarginLeft,u=t.GraphicalLabel.PositionAndShape.RelativePosition.y;let f=1;c-h>this.rules.MinimumDistanceBetweenDashes*3&&(f=Math.floor((c-h)/this.rules.MinimumDistanceBetweenDashes)-1),f===1?this.calculateSingleDashForLyricWord(r,h,c,u):this.calculateDashes(r,h,c,u)}else{const h=a.parentMeasure.PositionAndShape.RelativePosition.x+a.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.BorderMarginRight,c=r.Measures[r.Measures.length-1],u=c.PositionAndShape.RelativePosition.x+c.PositionAndShape.Size.width;let f=t.GraphicalLabel.PositionAndShape.RelativePosition.y;if(this.calculateDashes(r,h,u,f),o&&o.Measures[0]&&l.parentMeasure.ParentStaffLine&&!(l===l.parentMeasure.staffEntries[0]&&l.parentMeasure===l.parentMeasure.ParentStaffLine.Measures[0])){const d=o.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,p=l.parentMeasure.PositionAndShape.RelativePosition.x+l.PositionAndShape.RelativePosition.x+s.GraphicalLabel.PositionAndShape.BorderMarginLeft;f=s.GraphicalLabel.PositionAndShape.RelativePosition.y,this.calculateDashes(o,d,p,f)}}}calculateDashes(t,e,i,s){let r=i-e;if(r<this.rules.MinimumDistanceBetweenDashes*3)this.calculateSingleDashForLyricWord(t,e,i,s);else{const o=Math.floor(r/this.rules.MinimumDistanceBetweenDashes)-1,a=r/(o+1);let l=0;for(e+=a,i-=a;l<=Math.floor(o/2)&&i>e;)r=this.calculateRightAndLeftDashesForLyricWord(t,e,i,s),e+=a,i-=a,l++;r>a*2&&this.calculateSingleDashForLyricWord(t,e,i,s)}}calculateSingleDashForLyricWord(t,e,i,s){const r=new jt("-"),o=new Se(r,this.rules.LyricsHeight,vt.CenterBottom,this.rules);o.setLabelPositionAndShapeBorders(),t.LyricsDashes.push(o),this.staffLinesWithLyricWords.indexOf(t)===-1&&this.staffLinesWithLyricWords.push(t),o.PositionAndShape.Parent=t.PositionAndShape;const a=new O(e+(i-e)/2,s);o.PositionAndShape.RelativePosition=a}calculateLyricExtend(t){let e=t.GraphicalLabel.PositionAndShape.RelativePosition.y;const i=t.StaffEntryParent,s=i.parentMeasure.ParentStaffLine;let r,o;const a=i.parentMeasure.ParentStaff.idInMusicSheet;for(let l=i.parentVerticalContainer.Index+1;l<this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length;++l){const h=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[l].StaffEntries[a];if(!!h){if(h.hasOnlyRests()||h.LyricsEntries.length>0)break;r=h,o=r.parentMeasure.ParentStaffLine,o||(o=i.parentMeasure.ParentStaffLine)}}if(!(!r||!o))if(s===o&&r.parentMeasure.ParentStaffLine){const l=i.parentMeasure.PositionAndShape.RelativePosition.x+i.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.BorderMarginRight,h=r.parentMeasure.PositionAndShape.RelativePosition.x+r.PositionAndShape.RelativePosition.x+r.PositionAndShape.BorderMarginRight;e-=t.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(s,l,h,e)}else{const l=s.Measures[s.Measures.length-1].PositionAndShape,h=i.parentMeasure.PositionAndShape.RelativePosition.x+i.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.BorderMarginRight,c=l.RelativePosition.x+l.Size.width;if(e-=t.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(s,h,c,e),!r)return;if(r.parentMeasure.ParentStaffLine&&r.parentMeasure.staffEntries&&!(r===r.parentMeasure.staffEntries[0]&&r.parentMeasure===r.parentMeasure.ParentStaffLine.Measures[0])){const u=o.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,f=r.parentMeasure.PositionAndShape.RelativePosition.x+r.PositionAndShape.RelativePosition.x+r.PositionAndShape.BorderMarginRight;this.calculateSingleLyricWordWithUnderscore(o,u,f,e)}}}calculateSingleLyricWordWithUnderscore(t,e,i,s){const r=new O(e,s),o=new O(i,s),a=new ci(r,o,this.rules.LyricUnderscoreLineWidth);t.LyricLines.push(a),this.staffLinesWithLyricWords.indexOf(t)===-1&&this.staffLinesWithLyricWords.push(t)}calculateRightAndLeftDashesForLyricWord(t,e,i,s){const r=new jt("-"),o=new Se(r,this.rules.LyricsHeight,vt.CenterBottom,this.rules);o.setLabelPositionAndShapeBorders(),t.LyricsDashes.push(o),this.staffLinesWithLyricWords.indexOf(t)===-1&&this.staffLinesWithLyricWords.push(t),o.PositionAndShape.Parent=t.PositionAndShape;const a=new O(e,s);o.PositionAndShape.RelativePosition=a;const l=new jt("-"),h=new Se(l,this.rules.LyricsHeight,vt.CenterBottom,this.rules);h.setLabelPositionAndShapeBorders(),t.LyricsDashes.push(h),h.PositionAndShape.Parent=t.PositionAndShape;const c=new O(i,s);return h.PositionAndShape.RelativePosition=c,h.PositionAndShape.RelativePosition.x-o.PositionAndShape.RelativePosition.x}calculateDynamicExpressions(){const t=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,this.rules.MaxMeasureToDrawIndex),e=Math.min(this.rules.MinMeasureToDrawIndex,this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length);for(let i=e;i<=t;i++){const s=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[i];this.dynamicExpressionMap.clear();for(let r=0;r<s.StaffLinkedExpressions.length;r++)if(!(!this.graphicalMusicSheet.MeasureList[i]||!this.graphicalMusicSheet.MeasureList[i][r])&&this.graphicalMusicSheet.MeasureList[i][r].ParentStaff.ParentInstrument.Visible)for(let o=0;o<s.StaffLinkedExpressions[r].length;o++)(s.StaffLinkedExpressions[r][o].InstantaneousDynamic!==void 0||s.StaffLinkedExpressions[r][o].StartingContinuousDynamic!==void 0&&s.StaffLinkedExpressions[r][o].StartingContinuousDynamic.StartMultiExpression===s.StaffLinkedExpressions[r][o]&&s.StaffLinkedExpressions[r][o].UnknownList.length===0)&&this.calculateDynamicExpressionsForMultiExpression(s.StaffLinkedExpressions[r][o],i,r)}this.dynamicExpressionMap.clear()}calculateOctaveShifts(){for(let t=0;t<this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length;t++){const e=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[t];for(let i=0;i<e.StaffLinkedExpressions.length;i++)if(!(!this.graphicalMusicSheet.MeasureList[t]||!this.graphicalMusicSheet.MeasureList[t][i])&&this.graphicalMusicSheet.MeasureList[t][i].ParentStaff.ParentInstrument.Visible)for(let s=0;s<e.StaffLinkedExpressions[i].length;s++)e.StaffLinkedExpressions[i][s].OctaveShiftStart&&this.calculateSingleOctaveShift(e,e.StaffLinkedExpressions[i][s],t,i)}}calculatePedals(){for(let t=0;t<this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length;t++){const e=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[t];for(let i=0;i<e.StaffLinkedExpressions.length;i++)if(!(!this.graphicalMusicSheet.MeasureList[t]||!this.graphicalMusicSheet.MeasureList[t][i])&&this.graphicalMusicSheet.MeasureList[t][i].ParentStaff.ParentInstrument.Visible)for(let s=0;s<e.StaffLinkedExpressions[i].length;s++)e.StaffLinkedExpressions[i][s].PedalStart&&this.calculateSinglePedal(e,e.StaffLinkedExpressions[i][s],t,i)}}calculateWavyLines(){for(let t=0;t<this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length;t++){const e=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[t];for(let i=0;i<e.StaffLinkedExpressions.length;i++)if(!(!this.graphicalMusicSheet.MeasureList[t]||!this.graphicalMusicSheet.MeasureList[t][i])&&this.graphicalMusicSheet.MeasureList[t][i].ParentStaff.ParentInstrument.Visible)for(let s=0;s<e.StaffLinkedExpressions[i].length;s++)e.StaffLinkedExpressions[i][s].WavyLineStart&&this.calculateSingleWavyLine(e,e.StaffLinkedExpressions[i][s],t,i)}}getFirstLeftNotNullStaffEntryFromContainer(t,e,i){var s,r;if((s=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[t])!=null&&s.StaffEntries[e])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[t].StaffEntries[e];for(let o=t-1;o>=0;o--)if((r=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[o])!=null&&r.StaffEntries[e])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[o].StaffEntries[e]}getFirstRightNotNullStaffEntryFromContainer(t,e,i){var s,r;if((s=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[t])!=null&&s.StaffEntries[e])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[t].StaffEntries[e];for(let o=t+1;o<this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length;o++)if((r=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[o])!=null&&r.StaffEntries[e])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[o].StaffEntries[e]}calculateWordRepetitionInstructions(){for(let t=0;t<this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length;t++){const e=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[t];for(let i=0,s=e.FirstRepetitionInstructions.length;i<s;++i){const r=e.FirstRepetitionInstructions[i];this.calculateWordRepetitionInstruction(r,t)}for(let i=0,s=e.LastRepetitionInstructions.length;i<s;++i){const r=e.LastRepetitionInstructions[i];this.calculateWordRepetitionInstruction(r,t)}}}calculateRepetitionEndings(){const t=this.graphicalMusicSheet.ParentMusicSheet;for(let e=0,i=t.Repetitions.length;e<i;++e){const s=t.Repetitions[e];this.calcGraphicalRepetitionEndingsRecursively(s)}}calculateTempoExpressions(){const t=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,this.rules.MaxMeasureToDrawIndex),e=this.rules.MinMeasureToDrawIndex;for(let i=e;i<=t;i++){const s=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[i];for(let r=0;r<s.TempoExpressions.length;r++)this.calculateTempoExpressionsForMultiTempoExpression(s,s.TempoExpressions[r],i,r)}}calculateRehearsalMarks(){if(!!this.rules.RenderRehearsalMarks)for(const t of this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures)this.calculateRehearsalMark(t)}calculateRehearsalMark(t){throw new Error(this.abstractNotImplementedErrorMessage)}calculateMoodAndUnknownExpressions(){for(let t=0;t<this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length;t++){const e=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[t];for(let i=0;i<e.StaffLinkedExpressions.length;i++)if(!(!this.graphicalMusicSheet.MeasureList[t]||!this.graphicalMusicSheet.MeasureList[t][i])&&this.graphicalMusicSheet.MeasureList[t][i].ParentStaff.ParentInstrument.Visible)for(let s=0;s<e.StaffLinkedExpressions[i].length;s++)(e.StaffLinkedExpressions[i][s].MoodList.length>0||e.StaffLinkedExpressions[i][s].UnknownList.length>0)&&this.calculateMoodAndUnknownExpression(e.StaffLinkedExpressions[i][s],t,i)}}calculateStemDirectionFromVoices(t){if(t.ParentSourceStaffEntry.Link!==void 0)if(t===t.ParentSourceStaffEntry.VoiceEntries[0]){t.WantedStemDirection=Ft.Up;return}else{t.WantedStemDirection=Ft.Down;return}else t.ParentVoice instanceof bs?t.WantedStemDirection=Ft.Down:t.ParentSourceStaffEntry.VoiceEntries.length>1&&(t.WantedStemDirection=Ft.Up)}setBeamNotesWantedStemDirections(t){if(!(t.Notes.length>0))return;const e=t.Notes[0].NoteBeam;if(e){for(const i of e.Notes)if(i.ParentVoiceEntry.WantedStemDirection!==Ft.Undefined&&i.ParentVoiceEntry.ParentSourceStaffEntry.ParentStaff.Id===t.ParentSourceStaffEntry.ParentStaff.Id){t.WantedStemDirection=i.ParentVoiceEntry.WantedStemDirection;break}}}}class Ka{constructor(t,e,i,s,r){this.rootPitch=t,this.chordKind=e,this.bassPitch=i,this.degrees=s,this.rules=r}get RootPitch(){return this.rootPitch}get ChordKind(){return this.chordKind}get BassPitch(){return this.bassPitch}get ChordDegrees(){return this.degrees}static calculateChordText(t,e,i){let s=t.RootPitch;if(Lt.transposeCalculator&&(s=Lt.transposeCalculator.transposePitch(t.RootPitch,i,e)),t.ChordKind===Jt.none)return t.getTextFromChordKindEnum(t.ChordKind);let r=Kt.getNoteEnumString(s.FundamentalNote);s.Accidental!==yt.NONE&&(r+=this.getTextForAccidental(s.Accidental));const o={adds:[],alts:[],subs:[]};for(const c of t.ChordDegrees)if(c){let u="";switch(c.alteration!==yt.NONE&&(u+=this.getTextForAccidental(c.alteration)),u+=c.value,c.text){case zs.add:o.adds.push(u);break;case zs.alter:o.alts.push(u);break;case zs.subtract:o.subs.push(u);break}}let a=t.getTextFromChordKindEnum(t.ChordKind);const l=["adds","alts","subs"],h=t.rules.CustomChords;for(const c of h){if(c.chordKind!==t.chordKind)continue;let u=!0;for(const f of l){for(const d of c.degrees[f]||[])if(o[f].indexOf(d)<0){u=!1;break}if(!u)break}if(u){for(const f of l)for(const d of c.degrees[f]||[])o[f].splice(o[f].indexOf(d),1);a=c.alternateName}}if(r+=a,o.adds.length>0&&(r+="("+o.adds.join(",")+")"),o.alts.length>0&&(r+="(alt "+o.alts.join(",")+")"),o.subs.length>0&&(r+="(omit "+o.subs.join(",")+")"),t.BassPitch){let c=t.BassPitch;Lt.transposeCalculator&&(c=Lt.transposeCalculator.transposePitch(t.BassPitch,i,e)),r+="/",r+=Kt.getNoteEnumString(c.FundamentalNote),r+=this.getTextForAccidental(c.Accidental)}return r}static getTextForAccidental(t){let e="";switch(t){case yt.DOUBLEFLAT:e+="bb";break;case yt.FLAT:e+="b";break;case yt.SHARP:e+="#";break;case yt.DOUBLESHARP:e+="x";break}return e}getTextFromChordKindEnum(t){var e;return(e=this.rules.ChordSymbolLabelTexts.getValue(t))!=null?e:""}}class fu{constructor(t,e,i){this.value=t,this.alteration=e,this.text=i}}class kn{constructor(t,e,i){this.alternateName=t,this.chordKind=e,this.degrees=i}static createCustomChord(t,e,i){return new kn(t,e,i)}static renameCustomChord(t,e,i){for(const s of i)s.alternateName===t&&(s.alternateName=e)}}var zs=(n=>(n[n.add=0]="add",n[n.alter=1]="alter",n[n.subtract=2]="subtract",n))(zs||{}),Jt=(n=>(n[n.major=0]="major",n[n.minor=1]="minor",n[n.augmented=2]="augmented",n[n.diminished=3]="diminished",n[n.dominant=4]="dominant",n[n.majorseventh=5]="majorseventh",n[n.minorseventh=6]="minorseventh",n[n.diminishedseventh=7]="diminishedseventh",n[n.augmentedseventh=8]="augmentedseventh",n[n.halfdiminished=9]="halfdiminished",n[n.majorminor=10]="majorminor",n[n.majorsixth=11]="majorsixth",n[n.minorsixth=12]="minorsixth",n[n.dominantninth=13]="dominantninth",n[n.majorninth=14]="majorninth",n[n.minorninth=15]="minorninth",n[n.dominant11th=16]="dominant11th",n[n.major11th=17]="major11th",n[n.minor11th=18]="minor11th",n[n.dominant13th=19]="dominant13th",n[n.major13th=20]="major13th",n[n.minor13th=21]="minor13th",n[n.suspendedsecond=22]="suspendedsecond",n[n.suspendedfourth=23]="suspendedfourth",n[n.Neapolitan=24]="Neapolitan",n[n.Italian=25]="Italian",n[n.French=26]="French",n[n.German=27]="German",n[n.pedal=28]="pedal",n[n.power=29]="power",n[n.Tristan=30]="Tristan",n[n.none=31]="none",n))(Jt||{});class qa extends Pe{constructor(t,e,i,s=void 0){super(),this.DrawnAccidental=yt.NONE,this.lineShift=0,this.sourceNote=t,this.parentVoiceEntry=e,this.PositionAndShape=new le(this,e.PositionAndShape),s?this.graphicalNoteLength=s:this.graphicalNoteLength=t.Length,this.numberOfDots=this.calculateNumberOfNeededDots(this.graphicalNoteLength),this.rules=i,this.rules.addGraphicalNoteToNoteMap(t,this)}Transpose(t,e,i,s){let r=this.sourceNote.Pitch;return Lt.transposeCalculator&&(r=Lt.transposeCalculator.transposePitch(this.sourceNote.Pitch,t,i)),r}calculateNumberOfNeededDots(t){return!this.sourceNote||!this.sourceNote.NoteTuplet?t.calculateNumberOfNeededDots():0}get ParentMusicPage(){return this.parentVoiceEntry.parentStaffEntry.parentMeasure.ParentMusicSystem.Parent}static FromNote(t,e){return e.NoteToGraphicalNoteMap.getValue(t.NoteToGraphicalNoteObjectId)}}const Je=class{constructor(){this.DYSlursStartingAtSameStaffEntryYOffset=0,this.DYMinNoteWidth=0,this.DYWorkId=0,this.DYWorkSpecial=!1,this.DYContainerId="osmdCanvasPage",this.DYSVGContainerId="osmdSvgPage",this.DYMusicScoreType="staff",this.NoteDistances=[1,1,1.3,1.6,2,2.5,3,4],this.NoteDistancesScalingFactors=[1,2,4,8,16,32,64,128],this.DurationDistanceDict={},this.DurationScalingDistanceDict={},this.NoteToGraphicalNoteMapObjectCount=0,this.PlayAlreadyStartedNotesFromCursorPosition=!1,this.PlaybackSkipNotesSafetyInterval=.02,this.UseDefaultVoiceInteractionListener=!0,this.loadDefaultValues()}loadDefaultValues(){this.SamplingUnit=Je.unit*3,this.MpatMode=!0,this.SheetTitleHeight=4,this.SheetSubtitleHeight=2,this.SheetMinimumDistanceBetweenTitleAndSubtitle=1,this.SheetComposerHeight=2,this.SheetAuthorHeight=2,this.CompactMode=!1,this.PagePlacementEnum=Ea.Down,this.PageHeight=100001,this.PageTopMargin=5,this.PageTopMarginNarrow=0,this.PageBottomMargin=5,this.PageLeftMargin=5,this.PageRightMargin=5,this.TitleTopDistance=5,this.TitleBottomDistance=1,this.StaffDistance=7,this.BetweenStaffDistance=5,this.MinimumStaffLineDistance=4,this.MinSkyBottomDistBetweenStaves=1,this.StaffHeight=4,this.TabStaffInterlineHeight=1.1111,this.BetweenStaffLinesDistance=Je.unit,this.SystemLeftMargin=0,this.SystemRightMargin=0,this.SystemLabelsRightMargin=2,this.SystemComposerDistance=2,this.InstrumentLabelTextHeight=2,this.MinimumDistanceBetweenSystems=7,this.MinSkyBottomDistBetweenSystems=5,this.LastSystemMaxScalingFactor=1.4,this.AutoBeamNotes=!1,this.AutoBeamOptions={beam_middle_rests_only:!1,beam_rests:!1,maintain_stem_directions:!1},this.AutoBeamTabs=!1,this.BeamWidth=Je.unit/2,this.BeamSpaceWidth=Je.unit/3,this.BeamForwardLength=1.25*Je.unit,this.FlatBeams=!1,this.FlatBeamOffset=20,this.FlatBeamOffsetPerBeam=10,this.ClefLeftMargin=.5,this.ClefRightMargin=.75,this.PercussionOneLineCutoff=3,this.PercussionForceVoicesOneLineCutoff=1,this.PercussionUseXMLDisplayStep=!0,this.PercussionXMLDisplayStepNoteValueShift=0,this.PercussionOneLineXMLDisplayStepOctaveOffset=0,this.BetweenKeySymbolsDistance=.2,this.KeyRightMargin=.75,this.RhythmRightMargin=1.25,this.ShowRhythmAgainAfterPartEndOrFinalBarline=!0,this.NewPartAndSystemAfterFinalBarline=!1,this.InStaffClefScalingFactor=.8,this.DistanceBetweenNaturalAndSymbolWhenCancelling=.4,this.NoteHelperLinesOffset=.25,this.MeasureLeftMargin=.7,this.MeasureRightMargin=0,this.DistanceBetweenLastInstructionAndRepetitionBarline=1,this.ArpeggioDistance=.6,this.StaccatoShorteningFactor=2,this.IdealStemLength=3,this.StemNoteHeadBorderYOffset=.2,this.StemMargin=.2,this.StemMinLength=2.5,this.StemMaxLength=4.5,this.BeamSlopeMaxAngle=10,this.StemMinAllowedDistanceBetweenNoteHeadAndBeamLine=1,this.SetWantedStemDirectionByXml=!0,this.GraceNoteScalingFactor=.6,this.GraceNoteXOffset=.2,this.WedgeOpeningLength=1.2,this.WedgeMeasureEndOpeningLength=.75,this.WedgeMeasureBeginOpeningLength=.75,this.WedgePlacementAboveY=-1.5,this.WedgePlacementBelowY=1.5,this.WedgeHorizontalMargin=.6,this.WedgeVerticalMargin=.5,this.DistanceOffsetBetweenTwoHorizontallyCrossedWedges=.3,this.WedgeMinLength=2,this.WedgeEndDistanceBetweenTimestampsFactor=1.75,this.DistanceBetweenAdjacentDynamics=.75,this.TempoChangeMeasureValidity=4,this.TempoContinousFactor=.7,this.StaccatoScalingFactor=.8,this.BetweenDotsDistance=.8,this.OrnamentAccidentalScalingFactor=.65,this.ChordSymbolTextHeight=2,this.ChordSymbolTextAlignment=vt.LeftBottom,this.ChordSymbolRelativeXOffset=-1,this.ChordSymbolXSpacing=1,this.ChordOverlapAllowedIntoNextMeasure=0,this.ChordSymbolYOffset=.1,this.ChordSymbolYPadding=0,this.ChordSymbolYAlignment=!0,this.ChordSymbolYAlignmentScope="staffline",this.ChordSymbolLabelTexts=new Ye,this.resetChordSymbolLabelTexts(this.ChordSymbolLabelTexts),this.CustomChords=[],this.resetChordNames(),this.RepetitionSymbolsYOffset=0,this.RehearsalMarkXOffsetDefault=10,this.RehearsalMarkXOffset=0,this.RehearsalMarkXOffsetSystemStartMeasure=-20,this.RehearsalMarkYOffsetDefault=-15,this.RehearsalMarkYOffset=0,this.RehearsalMarkFontSize=10,this.MeasureNumberLabelHeight=1.5*Je.unit,this.MeasureNumberLabelOffset=2,this.MeasureNumberLabelXOffset=-.5,this.TupletsRatioed=!1,this.TupletsBracketed=!1,this.TripletsBracketed=!1,this.TupletNumberLabelHeight=1.5*Je.unit,this.TupletNumberYOffset=.5,this.LabelMarginBorderFactor=.1,this.TupletVerticalLineLength=.5,this.TupletNumbersInTabs=!1,this.SlurPlacementFromXML=!0,this.BezierCurveStepSize=1e3,this.calculateCurveParametersArrays(),this.TieGhostObjectWidth=.75,this.TieYPositionOffsetFactor=.3,this.MinimumNeededXspaceForTieGhostObject=1,this.TieHeightMinimum=.28,this.TieHeightMaximum=1.2,this.TieHeightInterpolationK=.0288,this.TieHeightInterpolationD=.136,this.SlurNoteHeadYOffset=.5,this.SlurStemXOffset=.3,this.SlurSlopeMaxAngle=15,this.SlurTangentMinAngle=30,this.SlurTangentMaxAngle=80,this.SlurHeightFactor=1,this.SlurHeightFlattenLongSlursFactorByWidth=.24,this.SlurHeightFlattenLongSlursFactorByAngle=.36,this.SlurHeightFlattenLongSlursCutoffAngle=47,this.SlurHeightFlattenLongSlursCutoffWidth=16,this.SlursStartingAtSameStaffEntryYOffset=.8,this.SlurMaximumYControlPointDistance=void 0,this.RepetitionEndingLabelHeight=2,this.RepetitionEndingLabelXOffset=.5,this.RepetitionEndingLabelYOffset=.3,this.RepetitionEndingLineYLowerOffset=.5,this.RepetitionEndingLineYUpperOffset=.3,this.VoltaOffset=2.5,this.LyricsAlignmentStandard=vt.LeftBottom,this.LyricsHeight=2,this.LyricsYOffsetToStaffHeight=0,this.VerticalBetweenLyricsDistance=.5,this.HorizontalBetweenLyricsDistance=.2,this.BetweenSyllableMaximumDistance=10,this.BetweenSyllableMinimumDistance=.5,this.LyricOverlapAllowedIntoNextMeasure=3.4,this.MinimumDistanceBetweenDashes=10,this.MaximumLyricsElongationFactor=2.5,this.InstantaneousTempoTextHeight=2.3,this.ContinuousDynamicTextHeight=2.3,this.MoodTextHeight=2.3,this.UnknownTextHeight=2,this.ContinuousTempoTextHeight=2.3,this.DynamicExpressionMaxDistance=2,this.DynamicExpressionSpacer=.5,this.VexFlowDefaultNotationFontScale=39,this.VexFlowDefaultTabFontScale=39,this.TremoloStrokeScale=1,this.TremoloYSpacingScale=1,this.StemWidth=.15,this.StaffLineWidth=.1,this.StaffLineColor=void 0,this.LedgerLineWidth=1,this.LedgerLineStrokeStyle=void 0,this.LedgerLineColorDefault="#000000",this.WedgeLineWidth=.12,this.TupletLineWidth=.12,this.LyricUnderscoreLineWidth=.12,this.SystemThinLineWidth=.12,this.SystemBoldLineWidth=Je.unit/2,this.SystemRepetitionEndingLineWidth=.12,this.SystemDotWidth=Je.unit/2,this.DistanceBetweenVerticalSystemLines=.35,this.DistanceBetweenDotAndLine=.7,this.RepeatEndStartPadding=2,this.OctaveShiftLineWidth=.12,this.OctaveShiftVerticalLineLength=Je.unit,this.GraceLineWidth=this.StaffLineWidth*this.GraceNoteScalingFactor,this.MultipleRestMeasureDefaultWidth=4,this.MinimumCrossedBeamDifferenceMargin=1e-4,this.SheetMaximumWidth=32767,this.VoiceSpacingMultiplierVexflow=.85,this.VoiceSpacingAddendVexflow=3,this.PickupMeasureWidthMultiplier=1,this.DisplacedNoteMargin=.1,this.MinNoteDistance=2,this.SubMeasureXSpacingThreshold=35,this.MeasureDynamicsMaxScalingFactor=2.5,this.WholeRestXShiftVexflow=-1.5,this.MetronomeMarksDrawn=!0,this.MetronomeMarkXShift=-6,this.MetronomeMarkYShift=-.5,this.SoftmaxFactorVexFlow=15,this.StaggerSameWholeNotes=!0,this.AlignRests=Hs.Never,this.RestCollisionYPadding=0,this.FillEmptyMeasuresWithWholeRest=_o.No,this.ArpeggiosGoAcrossVoices=!1,this.RenderArpeggios=!0,this.RenderSlurs=!0,this.ColoringMode=Ci.XML,this.ColoringEnabled=!0,this.ColorStemsLikeNoteheads=!1,this.ColorBeams=!0,this.ColorFlags=!0,this.applyDefaultColorMusic("#000000"),this.DefaultColorCursor="#33e02f",this.DefaultFontFamily="Times New Roman",this.DefaultFontStyle=ue.Regular,this.DefaultVexFlowNoteFont="gonville",this.MaxMeasureToDrawIndex=Number.MAX_VALUE,this.MinMeasureToDrawIndex=0,this.MaxSystemToDrawNumber=Number.MAX_VALUE,this.MaxPageToDrawNumber=Number.MAX_VALUE,this.RenderComposer=!0,this.RenderTitle=!0,this.RenderSubtitle=!0,this.RenderLyricist=!0,this.RenderPartNames=!0,this.RenderPartAbbreviations=!0,this.RenderFingerings=!0,this.RenderMeasureNumbers=!0,this.RenderMeasureNumbersOnlyAtSystemStart=!1,this.UseXMLMeasureNumbers=!0,this.RenderLyrics=!0,this.RenderChordSymbols=!0,this.RenderMultipleRestMeasures=!0,this.AutoGenerateMutipleRestMeasuresFromRestMeasures=!0,this.RenderRehearsalMarks=!0,this.RenderClefsAtBeginningOfStaffline=!0,this.RenderKeySignatures=!0,this.RenderTimeSignatures=!0,this.ArticulationPlacementFromXML=!0,this.FingeringPosition=z.AboveOrBelow,this.FingeringPositionFromXML=!0,this.FingeringPositionGrace=z.Left,this.FingeringInsideStafflines=!1,this.FingeringLabelFontHeight=1.7,this.FingeringOffsetX=0,this.FingeringOffsetY=0,this.FingeringPaddingY=-.2,this.FingeringTextSize=1.5,this.RenderStringNumbersClassical=!0,this.StringNumberOffsetY=0,this.NewSystemAtXMLNewSystemAttribute=!1,this.NewPageAtXMLNewPageAttribute=!1,this.RestoreCursorAfterRerender=!0,this.StretchLastSystemLine=!1,Je.FixStafflineBoundingBox=!1,this.PageFormat=Ce.UndefinedPageFormat,this.PageBackgroundColor=void 0,this.PerformanceMode=!1,this.RenderSingleHorizontalStaffline=!1,this.SpacingBetweenTextLines=0,this.NoteToGraphicalNoteMap=new Ye,this.NoteToGraphicalNoteMapObjectCount=0;try{this.MaxInstructionsConstValue=this.ClefLeftMargin+this.ClefRightMargin+this.KeyRightMargin+this.RhythmRightMargin+11}catch(n){j.info("EngravingRules()",n)}this.MpatMode&&(this.NewPartAndSystemAfterFinalBarline=!0)}applyDefaultColorMusic(n){this.DefaultColorMusic=n,this.DefaultColorNotehead=this.DefaultColorMusic,this.DefaultColorRest=this.DefaultColorNotehead,this.DefaultColorStem=this.DefaultColorNotehead,this.DefaultColorLabel=this.DefaultColorNotehead,this.DefaultColorTitle=this.DefaultColorNotehead,this.LedgerLineColorDefault=this.DefaultColorNotehead}addGraphicalNoteToNoteMap(n,t){n.NoteToGraphicalNoteObjectId=this.NoteToGraphicalNoteMapObjectCount,this.NoteToGraphicalNoteMap.setValue(n.NoteToGraphicalNoteObjectId,t),this.NoteToGraphicalNoteMapObjectCount++}GNote(n){return qa.FromNote(n,this)}clearMusicSheetObjects(){this.NoteToGraphicalNoteMap=new Ye,this.NoteToGraphicalNoteMapObjectCount=0}setChordSymbolLabelText(n,t){this.ChordSymbolLabelTexts.setValue(n,t)}resetChordSymbolLabelTexts(n){return n.setValue(Jt.minor,"m"),n.setValue(Jt.augmented,"aug"),n.setValue(Jt.diminished,"dim"),n.setValue(Jt.dominant,"7"),n.setValue(Jt.majorseventh,"maj7"),n.setValue(Jt.minorseventh,"m7"),n.setValue(Jt.diminishedseventh,"dim7"),n.setValue(Jt.augmentedseventh,"aug7"),n.setValue(Jt.halfdiminished,"m7b5"),n.setValue(Jt.majorminor,"m(maj7)"),n.setValue(Jt.majorsixth,"maj6"),n.setValue(Jt.minorsixth,"m6"),n.setValue(Jt.dominantninth,"9"),n.setValue(Jt.majorninth,"maj9"),n.setValue(Jt.minorninth,"m9"),n.setValue(Jt.dominant11th,"11"),n.setValue(Jt.major11th,"maj11"),n.setValue(Jt.minor11th,"m11"),n.setValue(Jt.dominant13th,"13"),n.setValue(Jt.major13th,"maj13"),n.setValue(Jt.minor13th,"m13"),n.setValue(Jt.suspendedsecond,"sus2"),n.setValue(Jt.suspendedfourth,"sus4"),n.setValue(Jt.power,"5"),n.setValue(Jt.none,"N.C."),n}addChordName(n,t,e,i,s){if(Jt[t]!==void 0){const r={adds:e,alts:i,subs:s};this.CustomChords.push(kn.createCustomChord(n,Jt[t],r))}}renameChord(n,t){kn.renameCustomChord(n,t,this.CustomChords)}resetChordNames(){this.addChordName("alt","major",["#5","b9","#9"],["b5"],[]),this.addChordName("7alt","dominant",["#5","b9","#9"],["b5"],[]),this.addChordName("7sus4","dominant",["4"],[],["3"]),this.addChordName("7sus4","suspendedfourth",["7"],[],[]),this.addChordName("9sus4","dominantninth",["4"],[],["3"]),this.addChordName("9sus4","suspendedfourth",["9"],[],[]),this.addChordName("11sus4","dominant11th",["4"],[],["3"]),this.addChordName("11sus4","suspendedfourth",["11"],[],[]),this.addChordName("13sus4","dominant13th",["4"],[],["3"]),this.addChordName("13sus4","suspendedfourth",["13"],[],[]),this.addChordName("7sus2","dominant",["2"],[],["3"]),this.addChordName("7sus2","suspendedsecond",["7"],[],[]),this.addChordName("m7b5","minorseventh",[],["b5"],[]),this.addChordName("9sus2","dominantninth",["2"],[],["3"]),this.addChordName("9sus2","suspendedsecond",["9"],[],[]),this.addChordName("11sus2","dominant11th",["2"],[],["3"]),this.addChordName("11sus2","suspendedsecond",["11"],[],[]),this.addChordName("13sus2","dominant13th",["2"],[],["3"]),this.addChordName("13sus2","suspendedsecond",["13"],[],[]),this.addChordName("m(maj9)","majorminor",["9"],[],[]),this.addChordName("m(maj11)","majorminor",["11"],[],[]),this.addChordName("m(maj13)","majorminor",["13"],[],[]),this.addChordName("69","majorsixth",["9"],[],[]),this.addChordName("mi69","minorsixth",["9"],[],[])}calculateCurveParametersArrays(){this.TPower3=new Array(this.BezierCurveStepSize),this.OneMinusTPower3=new Array(this.BezierCurveStepSize),this.FactorOne=new Array(this.BezierCurveStepSize),this.FactorTwo=new Array(this.BezierCurveStepSize);for(let n=0;n<this.BezierCurveStepSize;n++){const t=n/this.BezierCurveStepSize;this.TPower3[n]=Math.pow(t,3),this.OneMinusTPower3[n]=Math.pow(1-t,3),this.FactorOne[n]=3*Math.pow(1-t,2)*t,this.FactorTwo[n]=3*(1-t)*Math.pow(t,2)}}};let Ui=Je;Ui.unit=1;class Ce{constructor(t,e,i="noIdStringGiven"){this.width=t,this.height=e,this.idString=i}get aspectRatio(){return this.IsUndefined?0:this.width/this.height}get IsUndefined(){return this.width===void 0||this.height===void 0||this.height===0||this.width===0}static get UndefinedPageFormat(){return new Ce(0,0)}Equals(t){return t?t.width===this.width&&t.height===this.height:!1}}var Ci=(n=>(n[n.XML=0]="XML",n[n.AutoColoring=1]="AutoColoring",n[n.CustomColorSet=2]="CustomColorSet",n))(Ci||{}),vo=(n=>(n.allon="allon",n.compact="compact",n.compacttight="compacttight",n.default="default",n.leadsheet="leadsheet",n.preview="preview",n.thumbnail="thumbnail",n))(vo||{});class Ja{constructor(t="default"){this.rules=new Ui,this.drawCursors=!0,this.drawTitle=!0,this.drawSubtitle=!0,this.drawLyricist=!0,this.drawComposer=!0,this.drawCredits=!0,this.drawPartNames=!0,this.fingeringPosition=z.Left,this.drawHiddenNotes=!1,this.DrawingParametersEnum=t}set DrawingParametersEnum(t){switch(this.drawingParametersEnum=t,t){case"allon":this.setForAllOn();break;case"thumbnail":this.setForThumbnail();break;case"leadsheet":this.setForLeadsheet();break;case"compact":this.setForCompactMode();break;case"compacttight":this.setForCompactTightMode();break;case"default":default:this.setForDefault()}}get DrawingParametersEnum(){return this.drawingParametersEnum}setForAllOn(){this.drawHighlights=!0,this.drawErrors=!0,this.drawSelectionStartSymbol=!0,this.drawSelectionEndSymbol=!0,this.drawCursors=!0,this.drawActivitySymbols=!0,this.drawScrollIndicator=!0,this.drawAnnotations=!0,this.drawComments=!0,this.drawMarkedAreas=!0,this.DrawTitle=!0,this.DrawSubtitle=!0,this.DrawComposer=!0,this.DrawLyricist=!0,this.drawCredits=!0,this.DrawPartNames=!0,this.drawHiddenNotes=!0,this.rules.CompactMode=!1}setForDefault(){this.rules.loadDefaultValues(),this.setForAllOn(),this.drawHiddenNotes=!1}setForThumbnail(){this.drawHighlights=!1,this.drawErrors=!1,this.drawSelectionStartSymbol=!1,this.drawSelectionStartSymbol=!1,this.drawCursors=!1,this.drawActivitySymbols=!1,this.drawScrollIndicator=!1,this.drawAnnotations=!0,this.drawComments=!0,this.drawMarkedAreas=!0,this.drawHiddenNotes=!1}setForCompactMode(){this.rules.CompactMode=!0,this.DrawCredits=!1,this.drawHiddenNotes=!1}setForCompactTightMode(){this.setForCompactMode(),this.DrawPartNames=!1,this.rules.VoiceSpacingMultiplierVexflow=.65,this.rules.VoiceSpacingAddendVexflow=2,this.rules.MinSkyBottomDistBetweenStaves=1,this.rules.MinSkyBottomDistBetweenSystems=1,this.rules.BetweenStaffDistance=2.5,this.rules.StaffDistance=3.5,this.rules.MinimumDistanceBetweenSystems=1,this.rules.PageBottomMargin=0,this.rules.PageLeftMargin=2,this.rules.PageRightMargin=2}setForLeadsheet(){this.drawHighlights=!1,this.drawErrors=!1,this.drawSelectionStartSymbol=!0,this.drawSelectionEndSymbol=!0,this.drawCursors=!0,this.drawActivitySymbols=!1,this.drawScrollIndicator=!0,this.drawAnnotations=!0,this.drawComments=!0,this.drawMarkedAreas=!0}get DrawCredits(){return this.drawCredits}set DrawCredits(t){this.drawCredits=t,this.DrawComposer=t,this.DrawTitle=t,this.DrawSubtitle=t,this.DrawLyricist=t}get DrawTitle(){return this.drawTitle}set DrawTitle(t){this.drawTitle=t,this.rules.RenderTitle=t,t||(this.DrawSubtitle=!1)}get DrawSubtitle(){return this.drawSubtitle}set DrawSubtitle(t){this.drawSubtitle=t,this.rules.RenderSubtitle=t,t&&(this.DrawTitle=!0)}get DrawComposer(){return this.drawComposer}set DrawComposer(t){this.drawComposer=t,this.rules.RenderComposer=t}get DrawLyricist(){return this.drawLyricist}set DrawLyricist(t){this.drawLyricist=t,this.rules.RenderLyricist=t}get DrawPartNames(){return this.drawPartNames}set DrawPartNames(t){this.drawPartNames=t,this.rules.RenderPartNames=t,this.rules.RenderPartNames||(this.rules.RenderPartAbbreviations=!1)}get FingeringPosition(){return this.fingeringPosition}set FingeringPosition(t){this.fingeringPosition=t,this.rules.FingeringPosition=t}get Rules(){return this.rules}set Rules(t){this.rules=t}}var Hs=(n=>(n[n.Never=0]="Never",n[n.Always=1]="Always",n[n.Auto=2]="Auto",n))(Hs||{}),_o=(n=>(n[n.No=0]="No",n[n.YesVisible=1]="YesVisible",n[n.YesInvisible=2]="YesInvisible",n))(_o||{}),$i=(n=>(n[n.SVG=0]="SVG",n[n.Canvas=1]="Canvas",n))($i||{});class ea{static OSMDOptionsStandard(){return{autoResize:!0,backend:"svg",drawingParameters:vo.default}}static BackendTypeFromString(t){return t&&t.toLowerCase()==="canvas"?1:0}}class Ks{constructor(t){if(this.hasAttributes=!1,!t)throw new Error("IXmlElement: expected Element, got undefined");this.elem=t,this.name=t.nodeName.toLowerCase(),t.hasAttributes()&&(this.hasAttributes=!0,this.firstAttribute=t.attributes[0]),this.hasElements=t.hasChildNodes(),t.childNodes.length===1&&t.childNodes[0].nodeType===Node.TEXT_NODE?this.value=t.childNodes[0].nodeValue:this.value=""}attribute(t){return this.elem.attributes.getNamedItem(t)}attributes(){if(!this.attrs){const t=this.elem.attributes,e=[];for(let i=0;i<t.length;i+=1)e.push(t[i]);this.attrs=e}return this.attrs}element(t){const e=this.elem.childNodes;for(let i=0,s=e.length;i<s;i+=1){const r=e[i];if(r.nodeType===Node.ELEMENT_NODE&&r.nodeName.toLowerCase()===t)return new Ks(r)}}elements(t){const e=this.elem.childNodes,i=[],s=!t;s||(t=t.toLowerCase());for(let r=0;r<e.length;r+=1){const o=e[r];o.nodeType===Node.ELEMENT_NODE&&(s||o.nodeName.toLowerCase()===t)&&i.push(new Ks(o))}return i}}class Za{constructor(t,e,i){this.instrumentalGroups=[],this.name=t,this.musicSheet=e,this.parent=i}get InstrumentalGroups(){return this.instrumentalGroups}get Parent(){return this.parent}get Name(){return this.name}set Name(t){this.name=t}get GetMusicSheet(){return this.musicSheet}}class Cr extends Za{constructor(t,e,i,s){super(void 0,i,s),this.Transpose=0,this.voices=[],this.staves=[],this.hasLyrics=!1,this.hasChordSymbols=!1,this.playbackTranspose=0,this.lyricVersesNumbers=[],this.subInstruments=[],this.id=t,this.idString=e,this.nameLabel=new jt(e)}get Voices(){return this.voices}get Staves(){return this.staves}get NameLabel(){return this.nameLabel}get HasLyrics(){return this.hasLyrics}set HasLyrics(t){this.hasLyrics=t}get HasChordSymbols(){return this.hasChordSymbols}set HasChordSymbols(t){this.hasChordSymbols=t}get LyricVersesNumbers(){return this.lyricVersesNumbers}set LyricVersesNumbers(t){this.lyricVersesNumbers=t}get Name(){return this.nameLabel.text}set Name(t){this.nameLabel.text=t}get IdString(){return this.idString}get Id(){return this.id}get MidiInstrumentId(){return this.subInstruments[0].midiInstrumentID}set MidiInstrumentId(t){this.subInstruments[0].midiInstrumentID=t}get Volume(){return this.subInstruments[0].volume}set Volume(t){for(let e=0,i=this.subInstruments.length;e<i;++e){const s=this.subInstruments[e];s.volume=t}}get PlaybackTranspose(){return this.playbackTranspose}set PlaybackTranspose(t){this.playbackTranspose=t}get SubInstruments(){return this.subInstruments}getSubInstrument(t){for(let e=0,i=this.subInstruments.length;e<i;++e){const s=this.subInstruments[e];if(s.idString===t)return s}}get PartAbbreviation(){return this.partAbbreviation}set PartAbbreviation(t){this.partAbbreviation=t}get Visible(){return this.voices.length>0?this.Voices[0].Visible:!1}set Visible(t){for(let e=0,i=this.Voices.length;e<i;++e){const s=this.Voices[e];s.Visible=t}}get Audible(){let t=!1;for(let e=0,i=this.Voices.length;e<i;++e){const s=this.Voices[e];t=t||s.Audible}return t}set Audible(t){for(let e=0,i=this.Voices.length;e<i;++e){const s=this.Voices[e];s.Audible=t}for(let e=0,i=this.staves.length;e<i;++e){const s=this.staves[e];s.audible=t}}get Solo(){let t=!1;for(let e=0,i=this.Voices.length;e<i;++e){const s=this.Voices[e];t=t||s.Solo}return t}set Solo(t){for(let e=0,i=this.Voices.length;e<i;++e){const s=this.Voices[e];s.Solo=t}for(let e=0,i=this.Staves.length;e<i;++e){const s=this.Staves[e];s.Solo=t}}get Following(){let t=!1;for(let e=0,i=this.Voices.length;e<i;++e){const s=this.Voices[e];t=t||s.Following}return t}set Following(t){for(let e=0,i=this.Voices.length;e<i;++e){const s=this.Voices[e];s.Following=t}for(let e=0,i=this.staves.length;e<i;++e){const s=this.staves[e];s.following=t}}SetVoiceAudible(t,e){for(let i=0,s=this.Voices.length;i<s;++i){const r=this.Voices[i];if(r.VoiceId===t){r.Audible=e;break}}}SetVoiceFollowing(t,e){for(let i=0,s=this.Voices.length;i<s;++i){const r=this.Voices[i];if(r.VoiceId===t){r.Following=e;break}}}SetStaffAudible(t,e){const i=this.staves[t-1];if(i.audible=e,e)for(let s=0,r=i.Voices.length;s<r;++s){const o=i.Voices[s];o.Audible=!0}else for(let s=0,r=i.Voices.length;s<r;++s){const o=i.Voices[s];let a=!1;for(let l=0,h=this.Staves.length;l<h;++l){const c=this.Staves[l];if(!(c.Id===t||!c.audible))for(let u=0,f=c.Voices.length;u<f;++u)c.Voices[u]===o&&(a=!0)}a||(o.Audible=!1)}}SetStaffFollow(t,e){const i=this.staves[t-1];if(i.following=e,e)for(let s=0,r=i.Voices.length;s<r;++s){const o=i.Voices[s];o.Following=!0}else for(let s=0,r=i.Voices.length;s<r;++s){const o=i.Voices[s];let a=!1;for(let l=0,h=this.Staves.length;l<h;++l){const c=this.Staves[l];if(!(c.Id===t||!c.following))for(let u=0,f=c.Voices.length;u<f;++u)c.Voices[u]===o&&(a=!0)}a||(o.Following=!1)}}areAllVoiceVisible(){for(const t of this.Voices)if(!t.Visible)return!1;return!0}createStaves(t){for(let e=0;e<t;e++)this.staves.push(new jc(this,e+1))}toString(){return`${this.Name} , id: ${this.id}, idstring: ${this.idString}`}}class du extends Pe{constructor(t){super(),this.needsToBeRedrawn=!0,this.staffLines=[],this.graphicalMeasures=[],this.labels=new Jl,this.measureNumberLabels=[],this.objectsToRedraw=[],this.instrumentBrackets=[],this.groupBrackets=[],this.graphicalMarkedAreas=[],this.systemLines=[],this.breaksPage=!1,this.id=t,this.boundingBox=new le(this),this.maxLabelLength=0}get Parent(){return this.parent}set Parent(t){if(this.parent){const e=this.parent.MusicSystems.indexOf(this,0);e>-1&&this.parent.MusicSystems.splice(e,1)}this.parent=t,this.boundingBox.Parent=t.PositionAndShape}get NextSystem(){const t=this.Parent.MusicSystems.indexOf(this);return t!==this.Parent.MusicSystems.length?this.Parent.MusicSystems[t+1]:void 0}get StaffLines(){return this.staffLines}get GraphicalMeasures(){return this.graphicalMeasures}get MeasureNumberLabels(){return this.measureNumberLabels}get Labels(){return this.labels.values()}get ObjectsToRedraw(){return this.objectsToRedraw}get InstrumentBrackets(){return this.instrumentBrackets}get GroupBrackets(){return this.groupBrackets}get GraphicalMarkedAreas(){return this.graphicalMarkedAreas}get SystemLines(){return this.systemLines}get Id(){return this.id}createSystemLeftLine(t,e,i){let s=-t/2;i&&(s=this.maxLabelLength+e-t/2);const r=this.staffLines[0].Measures[0];let o;this.staffLines.length>1&&(o=this.staffLines[this.staffLines.length-1].Measures[0]);const a=this.createSystemLine(s,t,Et.SingleThin,ns.MeasureBegin,this,r,o);this.SystemLines.push(a),a.PositionAndShape.RelativePosition=new O(s,0),a.PositionAndShape.BorderLeft=0,a.PositionAndShape.BorderRight=t,a.PositionAndShape.BorderTop=0,a.PositionAndShape.BorderBottom=this.boundingBox.Size.height,this.createLinesForSystemLine(a)}createVerticalLineForMeasure(t,e,i,s,r,o){const a=o.ParentStaffLine,l=new O(a.PositionAndShape.RelativePosition.x,a.PositionAndShape.RelativePosition.y),h=a.ParentStaff.ParentInstrument.Staves;if(a.ParentStaff===h[0]){let c;h.length>1&&(c=this.getBottomStaffLine(a).Measures[r]);const u=this.createSystemLine(t,e,i,s,this,o,c),f=l.x+t;u.PositionAndShape.RelativePosition=new O(f,0),u.PositionAndShape.BorderLeft=0,u.PositionAndShape.BorderRight=e,this.SystemLines.push(u)}}setYPositionsToVerticalLineObjectsAndCreateLines(t){}calculateBorders(t){}alignBeginInstructions(){}GetLeftBorderAbsoluteXPosition(){return this.StaffLines[0].PositionAndShape.AbsolutePosition.x+this.StaffLines[0].Measures[0].beginInstructionsWidth}GetRightBorderAbsoluteXPosition(){return this.StaffLines[0].PositionAndShape.AbsolutePosition.x+this.StaffLines[0].StaffLines[0].End.x}AddGraphicalMeasures(t){for(let e=0,i=t.length;e<i;++e){const s=t[e];s.ParentMusicSystem=this}this.graphicalMeasures.push(t)}GetSystemsFirstTimeStamp(){return this.graphicalMeasures[0][0].parentSourceMeasure.AbsoluteTimestamp}GetSystemsLastTimeStamp(){const t=this.graphicalMeasures[this.graphicalMeasures.length-1][0].parentSourceMeasure;return W.plus(t.AbsoluteTimestamp,t.Duration)}createInstrumentBrackets(t,e){for(let i=0,s=t.length;i<s;++i){const r=t[i];if(r.Staves.length>1){let o,a;for(let l=0,h=this.staffLines.length;l<h;++l){const c=this.staffLines[l];c.ParentStaff===r.Staves[0]&&(o=c),c.ParentStaff===r.Staves[r.Staves.length-1]&&(a=c)}o&&a&&this.createInstrumentBracket(o,a)}}}createGroupBrackets(t,e,i){for(let s=0,r=t.length;s<r;++s){const o=t[s];if(o.InstrumentalGroups.length<1)continue;const a=this.findFirstVisibleInstrumentInInstrumentalGroup(o),l=this.findLastVisibleInstrumentInInstrumentalGroup(o);if(!a||!l)continue;let h,c;for(let u=0,f=this.staffLines.length;u<f;++u){const d=this.staffLines[u];d.ParentStaff===a.Staves[0]&&(h=d),d.ParentStaff===l.Staves[0]&&(c=d)}h&&c&&this.createGroupBracket(h,c,i),!(o.InstrumentalGroups.length<1)&&this.createGroupBrackets(o.InstrumentalGroups,e,i+1)}}createMusicSystemLabel(t,e,i,s=!1){var a;const r=e;for(let l=0,h=this.staffLines.length;l<h;++l){const c=this.staffLines[l].ParentStaff.ParentInstrument;let u;if(s)u=c.NameLabel,(!this.rules.RenderPartNames||!(u!=null&&u.print))&&(u=new jt("",c.NameLabel.textAlignment,c.NameLabel.font),e=0);else{if(!this.rules.RenderPartAbbreviations||!this.rules.RenderPartNames||this.staffLines.length===1||!c.PartAbbreviation||c.PartAbbreviation==="")return;const f=c.PartAbbreviation;u=new jt(f,c.NameLabel.textAlignment,c.NameLabel.font)}if((a=c==null?void 0:c.NameLabel)!=null&&a.print){const f=new Se(u,t,vt.LeftCenter,this.rules,this.boundingBox);f.setLabelPositionAndShapeBorders(),this.labels.setValue(c,f)}else e=0}this.maxLabelLength=0;const o=this.labels.values();for(let l=0,h=o.length;l<h;++l){const c=o[l];!c.Label.print||c.PositionAndShape.Size.width>this.maxLabelLength&&(this.maxLabelLength=c.PositionAndShape.Size.width,e=r)}this.updateMusicSystemStaffLineXPosition(e)}setMusicSystemLabelsYPosition(){this.labels.forEach((t,e)=>{let i=0,s=0;for(let r=0;r<this.staffLines.length;r++)if(this.staffLines[r].ParentStaff.ParentInstrument===t){for(let o=r;o<this.staffLines.length;o++){const a=this.staffLines[o];if(a.ParentStaff.ParentInstrument!==t)break;i+=a.PositionAndShape.RelativePosition.y,s++}break}s>0&&(e.PositionAndShape.RelativePosition=new O(0,i/s+2))})}checkStaffEntriesForStaffEntryLink(){let t=!1,e=!1;for(let i=0;i<this.staffLines.length-1;i++){for(let s=0,r=this.staffLines[i].Measures.length;s<r;++s){const o=this.staffLines[i].Measures[s];for(let a=0,l=o.staffEntries.length;a<l;++a)o.staffEntries[a].sourceStaffEntry.Link&&(t=!0)}for(let s=0,r=this.staffLines[i+1].Measures.length;s<r;++s){const o=this.staffLines[i+1].Measures[s];for(let a=0,l=o.staffEntries.length;a<l;++a)o.staffEntries[a].sourceStaffEntry.Link&&(e=!0)}}return!!(t&&e)}getBottomStaffLine(t){const e=t.ParentStaff.ParentInstrument.Staves,i=e[e.length-1];for(const s of t.ParentMusicSystem.staffLines)if(s.ParentStaff===i)return s}createSystemLine(t,e,i,s,r,o,a=void 0){throw new Error("not implemented")}createLinesForSystemLine(t){}calcBracketsWidth(){let t=0;for(let e=0,i=this.GroupBrackets.length;e<i;++e){const s=this.GroupBrackets[e];t=Math.max(t,s.PositionAndShape.Size.width)}for(let e=0,i=this.InstrumentBrackets.length;e<i;++e){const s=this.InstrumentBrackets[e];t=Math.max(t,s.PositionAndShape.Size.width)}return t}createInstrumentBracket(t,e){}createGroupBracket(t,e,i){}findFirstVisibleInstrumentInInstrumentalGroup(t){for(let e=0,i=t.InstrumentalGroups.length;e<i;++e){const s=t.InstrumentalGroups[e];if(s instanceof Cr){if(s.Visible===!0)return s;continue}return this.findFirstVisibleInstrumentInInstrumentalGroup(s)}}findLastVisibleInstrumentInInstrumentalGroup(t){let e;for(let i=t.InstrumentalGroups.length-1;i>=0;i--){if(e=t.InstrumentalGroups[i],e instanceof Cr){if(e.Visible===!0)return e;continue}return this.findLastVisibleInstrumentInInstrumentalGroup(e)}}updateMusicSystemStaffLineXPosition(t){for(let e=0,i=this.StaffLines.length;e<i;++e){const s=this.StaffLines[e],r=s.PositionAndShape.RelativePosition;r.x=this.maxLabelLength+t,s.PositionAndShape.RelativePosition=r,s.PositionAndShape.BorderRight=this.boundingBox.Size.width-this.maxLabelLength-t;for(let o=0;o<s.StaffLines.length;o++){const a=new O(s.PositionAndShape.Size.width,s.StaffLines[o].End.y);s.StaffLines[o].End=a}}}}class pu extends Pe{constructor(t,e,i,s,r=void 0){super(),this.lineType=t,this.linePosition=e,this.parentMusicSystem=i,this.topMeasure=s,this.bottomMeasure=r,this.parentTopStaffLine=s==null?void 0:s.ParentStaffLine,this.boundingBox=new le(this,i.PositionAndShape)}static getObjectWidthForLineType(t,e){switch(e){case Et.SingleThin:return t.SystemThinLineWidth;case Et.DoubleThin:return t.SystemThinLineWidth*2+t.DistanceBetweenVerticalSystemLines;case Et.ThinBold:return t.SystemThinLineWidth+t.SystemBoldLineWidth+t.DistanceBetweenVerticalSystemLines;case Et.BoldThinDots:return t.SystemThinLineWidth+t.SystemBoldLineWidth+t.DistanceBetweenVerticalSystemLines+t.SystemDotWidth+t.DistanceBetweenDotAndLine;case Et.DotsThinBold:return t.SystemThinLineWidth+t.SystemBoldLineWidth+t.DistanceBetweenVerticalSystemLines+t.SystemDotWidth+t.DistanceBetweenDotAndLine;case Et.DotsBoldBoldDots:return 2*t.SystemBoldLineWidth+2*t.SystemDotWidth+2*t.DistanceBetweenDotAndLine+t.DistanceBetweenVerticalSystemLines;default:return 0}}}const ia=M.Flow;class Qa extends Pe{constructor(t,e,i=0){super(),this.Visible=!0,this.PositionAndShape=new le(this,t.ParentMusicSystem.PositionAndShape);const s=t.Measures[0],r=e.Measures[0];this.addConnector(s.getVFStave(),r.getVFStave(),ia.StaveConnector.type.BRACKET,i)}draw(t){this.Visible&&this.vexflowConnector.setContext(t).draw();const e=this.vexflowConnector,i=e.top_stave.getYForLine(0),s=e.bottom_stave.getYForLine(e.bottom_stave.getNumLines()-1)+e.thickness;this.PositionAndShape.AbsolutePosition.x=(e.top_stave.getX()-2+e.x_shift)/_t,this.PositionAndShape.AbsolutePosition.y=i/_t,this.PositionAndShape.Size.height=(s-i)/_t,this.PositionAndShape.Size.width=12/_t}addConnector(t,e,i,s){this.vexflowConnector=new ia.StaveConnector(t,e).setType(i).setXShift(s*-5)}}const mu=M.Flow;class sa extends Qa{constructor(t,e,i=0){super(t,e,i),this.vexflowConnector.setType(mu.StaveConnector.type.BRACE)}}class gu extends du{constructor(t,e){super(t),this.rules=e}calculateBorders(t){if(this.staffLines.length===0)return;const e=this.calcBracketsWidth();this.boundingBox.BorderLeft=-e,this.boundingBox.BorderMarginLeft=-e,this.boundingBox.XBordersHaveBeenSet=!0;const s=this.staffLines[0].SkyBottomLineCalculator.getSkyLineMin();this.boundingBox.BorderTop=s,this.boundingBox.BorderMarginTop=s;const r=this.staffLines[this.staffLines.length-1],a=r.SkyBottomLineCalculator.getBottomLineMax()+r.PositionAndShape.RelativePosition.y;this.boundingBox.BorderBottom=a,this.boundingBox.BorderMarginBottom=a,this.boundingBox.XBordersHaveBeenSet=!0,this.boundingBox.YBordersHaveBeenSet=!0}createSystemLine(t,e,i,s,r,o,a=void 0){const l=o;let h=!1;if(a&&(h=!0,a.lineTo(o,Yt.line(i,s)),a.addMeasureLine(i,s),i===Et.DotsBoldBoldDots)){const c=a.ParentStaffLine.Measures.indexOf(a)+1,u=a.ParentStaffLine.Measures[c],f=o.ParentStaffLine.Measures[c];u&&f&&(u.lineTo(f,Yt.line(Et.BoldThinDots,s)),u.addMeasureLine(Et.BoldThinDots,s))}return l&&l.addMeasureLine(i,s,h),new pu(i,s,this,o,a)}createInstrumentBracket(t,e){const i=t,s=e,r=new sa(i,s);this.InstrumentBrackets.push(r)}createGroupBracket(t,e,i){const s=t,r=e;if(i===0){const o=new Qa(s,r,i);this.GroupBrackets.push(o)}else{const o=new sa(s,r,i);this.GroupBrackets.push(o)}}}class bu extends Pe{constructor(t=void 0,e=void 0,i=void 0){super(),this.hasOnlyRests=!1,this.measureNumber=-1,this.ShowTimeSignature=!0,this.parentStaff=t,this.parentSourceMeasure=e,this.parentStaffLine=i,i?(this.parentStaff=i.ParentStaff,this.PositionAndShape=new le(this,i.PositionAndShape)):this.PositionAndShape=new le(this),this.PositionAndShape.BorderBottom=4,this.parentSourceMeasure&&(this.measureNumber=this.parentSourceMeasure.MeasureNumber),this.staffEntries=[]}get ParentStaff(){return this.parentStaff}get ParentMusicSystem(){return this.parentMusicSystem}set ParentMusicSystem(t){this.parentMusicSystem=t}get MeasureNumber(){return this.measureNumber}get FirstInstructionStaffEntry(){return this.firstInstructionStaffEntry}set FirstInstructionStaffEntry(t){this.firstInstructionStaffEntry=t}get LastInstructionStaffEntry(){return this.lastInstructionStaffEntry}set LastInstructionStaffEntry(t){this.lastInstructionStaffEntry=t}get ParentStaffLine(){return this.parentStaffLine}set ParentStaffLine(t){this.parentStaffLine=t,this.parentStaffLine&&(this.PositionAndShape.Parent=this.parentStaffLine.PositionAndShape)}resetLayout(){throw new Error("not implemented")}getLineWidth(t){throw new Error("not implemented")}addClefAtBegin(t){throw new Error("not implemented")}addKeyAtBegin(t,e,i){throw new Error("not implemented")}addRhythmAtBegin(t){throw new Error("not implemented")}addClefAtEnd(t,e=!0){throw new Error("not implemented")}setPositionInStaffline(t){this.PositionAndShape.RelativePosition=new O(t,0)}setWidth(t){this.PositionAndShape.BorderRight=t}layoutSymbols(){throw new Error("not implemented")}findGraphicalStaffEntryFromTimestamp(t){var e;for(let i=0,s=this.staffEntries.length;i<s;++i){const r=this.staffEntries[i];if((e=r.relInMeasureTimestamp)!=null&&e.Equals(t))return r}}findGraphicalStaffEntryFromVerticalContainerTimestamp(t){for(let e=0,i=this.staffEntries.length;e<i;++e){const s=this.staffEntries[e];if(s.sourceStaffEntry.VerticalContainerParent.getAbsoluteTimestamp().Equals(t))return s}}hasSameDurationWithSourceMeasureParent(){const t=new W(0,1);for(let e=0,i=this.staffEntries.length;e<i;++e){const s=this.staffEntries[e];t.Add(s.findStaffEntryMinNoteLength())}return t.Equals(this.parentSourceMeasure.Duration)}hasMultipleVoices(){if(this.staffEntries.length===0)return!1;const t=[];for(let e=0,i=this.staffEntries.length;e<i;++e){const s=this.staffEntries[e];for(let r=0,o=s.sourceStaffEntry.VoiceEntries.length;r<o;++r){const a=s.sourceStaffEntry.VoiceEntries[r];t.indexOf(a.ParentVoice)<0&&t.push(a.ParentVoice)}}return t.length>1}isVisible(){return this.ParentStaff.ParentInstrument.Visible}getGraphicalMeasureDurationFromStaffEntries(){let t=new W(0,1);const e=[];for(let i=0,s=this.staffEntries.length;i<s;++i){const r=this.staffEntries[i];for(let o=0,a=r.sourceStaffEntry.VoiceEntries.length;o<a;++o){const l=r.sourceStaffEntry.VoiceEntries[o];e.indexOf(l.ParentVoice)<0&&e.push(l.ParentVoice)}}for(let i=0,s=e.length;i<s;++i){const r=e[i],o=new W(0,1);for(const a of this.staffEntries)for(const l of a.graphicalVoiceEntries)l.parentVoiceEntry.ParentVoice===r&&l.notes.length>0&&o.Add(l.notes[0].graphicalNoteLength);t.lt(o)&&(t=W.createFromFraction(o))}return t}addGraphicalStaffEntry(t){this.staffEntries.push(t)}addGraphicalStaffEntryAtTimestamp(t){if(t)if(this.staffEntries.length===0||this.staffEntries[this.staffEntries.length-1].relInMeasureTimestamp.lt(t.relInMeasureTimestamp))this.staffEntries.push(t);else for(let e=this.staffEntries.length-1;e>=0;e--){if(this.staffEntries[e].relInMeasureTimestamp.lt(t.relInMeasureTimestamp)){this.staffEntries.splice(e+1,0,t);break}e===0&&this.staffEntries.splice(e,0,t)}}isPianoRightHand(){return this.isUpperStaffOfInstrument()}isPianoLeftHand(){return this.isLowerStaffOfInstrument()}isUpperStaffOfInstrument(){return this.parentStaff.ParentInstrument.Staves.length===1?!0:this.ParentStaff===this.parentStaff.ParentInstrument.Staves[0]}isLowerStaffOfInstrument(){return this.parentStaff.ParentInstrument.Staves.length===1?!1:this.ParentStaff===this.ParentStaff.ParentInstrument.Staves.last()}beginsWithLineRepetition(){const t=this.parentSourceMeasure;return t?t.beginsWithLineRepetition():!1}endsWithLineRepetition(){const t=this.parentSourceMeasure;return t?t.endsWithLineRepetition():!1}beginsWithWordRepetition(){const t=this.parentSourceMeasure;return t?t.beginsWithWordRepetition():!1}endsWithWordRepetition(){const t=this.parentSourceMeasure;return t?t.endsWithWordRepetition():!1}getTransposedHalftones(){return this.parentStaff.ParentInstrument.GetMusicSheet.Transpose+this.parentStaff.ParentInstrument.Transpose}}class $a extends Pa{constructor(t,e){super(t,e)}applyBordersFromVexflow(){const t=this.vfStaveNote;if(!t.getNoteHeadBeginX)return;const e=t.getBoundingBox(),i=t.getNoteHeadBeginX()-e.x;this.PositionAndShape.RelativePosition.y=e.y/_t,this.PositionAndShape.BorderTop=0,this.PositionAndShape.BorderBottom=e.h/_t,this.PositionAndShape.BorderLeft=-(i+t.width/2)/_t,this.PositionAndShape.BorderRight=(e.w-i)/_t}set vfStaveNote(t){this.mVexFlowStaveNote=t}get vfStaveNote(){return this.mVexFlowStaveNote}color(){var f;const t=this.rules.DefaultColorNotehead,e=this.rules.DefaultColorRest,i=this.rules.DefaultColorStem,s="#00000000";let r,o;const a=this.vfStaveNote;for(let d=0;d<this.notes.length;d++){const p=this.notes[d];if(o=p.sourceNote.NoteheadColor,r=o,this.rules.ColoringMode===Ci.AutoColoring||this.rules.ColoringMode===Ci.CustomColorSet)if(p.sourceNote.isRest())r=this.rules.ColoringSetCurrent.getValue(-1);else{const g=p.sourceNote.Pitch.FundamentalNote;r=this.rules.ColoringSetCurrent.getValue(g)}if(p.sourceNote.PrintObject?(!r||r==="#000000")&&(r=this.rules.DefaultColorNotehead):r=s,!o&&this.rules.ColoringMode===Ci.XML&&p.sourceNote.PrintObject&&(!p.sourceNote.isRest()&&t?r=t:p.sourceNote.isRest()&&e&&(r=e)),r&&p.sourceNote.PrintObject)p.sourceNote.NoteheadColorCurrentlyRendered=r;else if(!r)continue;if(this.rules.ColoringEnabled&&p.sourceNote.NoteBeam&&this.rules.ColorBeams){const g=p.sourceNote.NoteBeam.Notes;let m=!0;for(let S=0;S<g.length;S++)g[S].NoteheadColorCurrentlyRendered!==r&&(m=!1);m&&(f=a==null?void 0:a.beam)!=null&&f.setStyle&&a.beam.setStyle({fillStyle:r,strokeStyle:r})}if(a){if(a.note_heads){const g=a.note_heads[d];g&&g.setStyle({fillStyle:r,strokeStyle:r})}a.setLedgerLineStyle&&(r===s?a.setLedgerLineStyle({fillStyle:r,strokeStyle:r,lineWidth:this.rules.LedgerLineWidth}):a.setLedgerLineStyle({fillStyle:this.rules.LedgerLineColorDefault,lineWidth:this.rules.LedgerLineWidth,strokeStyle:this.rules.LedgerLineColorDefault}))}}let l=i,h=!1;this.rules.ColoringEnabled&&(l=this.parentVoiceEntry.StemColor,(!l||l==="#000000")&&(l=i),this.rules.ColorStemsLikeNoteheads&&r&&(l=r,h=!0));let c=!0;for(const d of this.parentVoiceEntry.Notes)if(d.PrintObject){c=!1;break}c&&(l=s);const u={fillStyle:l,strokeStyle:l};a&&a.setStemStyle&&(!c&&h&&(this.parentVoiceEntry.StemColor=l),a.setStemStyle(u),a.flag&&a.setFlagStyle&&this.rules.ColorFlags&&a.setFlagStyle(u))}}const gt=M.Flow,Su=gt.NoteSubGroup;class Es extends bu{constructor(t,e=void 0,i=void 0){super(t,e,i),this.isTabMeasure=!1,this.octaveOffset=3,this.vfVoices={},this.vfTies=[],this.vfRepetitionWords=[],this.connectors=[],this.beams={},this.tuplets={},this.vftuplets={},this.minimumStaffEntriesWidth=-1,i?this.rules=i.ParentMusicSystem.rules:e&&(this.rules=e.Rules),this.resetLayout()}setAbsoluteCoordinates(t,e){this.stave.setX(t).setY(e)}resetLayout(){this.stave=new gt.Stave(0,0,0,{fill_style:this.rules.StaffLineColor,space_above_staff_ln:0,space_below_staff_ln:0,DYMusicScoreType:this.rules.DYMusicScoreType}),this.stave.MeasureNumber=this.MeasureNumber,this.ParentStaff&&this.setLineNumber(this.ParentStaff.StafflineCount),this.stave.setBegBarType(gt.Barline.type.NONE),this.parentSourceMeasure&&this.parentSourceMeasure.endingBarStyleEnum===Et.None&&this.stave.setEndBarType(gt.Barline.type.NONE),this.updateInstructionWidth()}clean(){this.vfTies.length=0,this.connectors=[],this.resetLayout()}getLineWidth(t){switch(t){case Et.SingleThin:return 5/_t;case Et.DoubleThin:return 5/_t;case Et.ThinBold:return 5/_t;case Et.BoldThinDots:case Et.DotsThinBold:return 10/_t;case Et.DotsBoldBoldDots:return 10/_t+this.rules.RepeatEndStartPadding;default:return 0}}addClefAtBegin(t){if(!!this.rules.RenderClefsAtBeginningOfStaffline){if(this.octaveOffset=t.OctaveOffset,this.rules.DYMusicScoreType!=="jianpu")if(t.ClefType===Pt.TAB)this.stave.addClef("tab",void 0,void 0,void 0);else{const e=Yt.Clef(t,"default");this.stave.addClef(e.type,e.size,e.annotation,gt.StaveModifier.Position.BEGIN)}this.updateInstructionWidth()}}setLineNumber(t){t!==5&&(t===0?(this.stave.setNumLines(0),this.stave.getBottomLineY=function(){return this.getYForLine(this.options.num_lines)}):t===1?(this.stave.options.line_config=[{visible:!1},{visible:!1},{visible:!0},{visible:!1},{visible:!1}],this.stave.getBottomLineY=function(){return this.getYForLine(2)}):t===2?(this.stave.options.line_config=[{visible:!1},{visible:!1},{visible:!0},{visible:!0},{visible:!1}],this.stave.getBottomLineY=function(){return this.getYForLine(3)}):t===3?(this.stave.options.line_config=[{visible:!1},{visible:!0},{visible:!0},{visible:!0},{visible:!1}],this.stave.getBottomLineY=function(){return this.getYForLine(2)}):(this.stave.setNumLines(t),this.stave.getBottomLineY=function(){return this.getYForLine(this.options.num_lines)}))}addKeyAtBegin(t,e,i){!this.rules.RenderKeySignatures||(this.stave.setKeySignature(Yt.keySignature(t),Yt.keySignature(e),void 0),this.updateInstructionWidth())}addRhythmAtBegin(t){const e=Yt.TimeSignature(t);this.stave.addModifier(e,gt.StaveModifier.Position.BEGIN,{numerator:t.Rhythm.Numerator,denominator:t.Rhythm.Denominator}),this.ShowTimeSignature||e.setStyle({fillStyle:"#00000000"}),this.updateInstructionWidth()}addClefAtEnd(t,e=!0){const i=Yt.Clef(t,"small");if(!(!e&&this.stave.endClef)){this.stave.setEndClef(i.type,i.size,i.annotation);for(const s of this.stave.getModifiers())if(e){const r=s.originalStrokeStyle,o=s.originalFillStyle;s.getStyle()&&(r&&o?(s.getStyle().strokeStyle=r,s.getStyle().fillStyle=o):(s.getStyle().strokeStyle=null,s.getStyle().fillStyle=null))}else if(s.getCategory()==="clefs"&&s.getPosition()===gt.StaveModifier.Position.END&&s.type===i.type){const r="#12345600",o=s.getStyle();o&&(s.originalStrokeStyle=o.strokeStyle,s.originalFillStyle=o.fillStyle),s.setStyle({strokeStyle:r,fillStyle:r})}return this.parentSourceMeasure.hasEndClef=!0,this.updateInstructionWidth()}}addMeasureLine(t,e,i=!0){switch(e){case ns.MeasureBegin:switch(t){case Et.BoldThinDots:i||(this.stave.modifiers[0].draw=function(s){switch(s.checkContext(),this.setRendered(),this.type){case gt.Barline.type.SINGLE:this.drawVerticalBar(s,this.x,!1);break;case gt.Barline.type.DOUBLE:this.drawVerticalBar(s,this.x,!0);break;case gt.Barline.type.END:this.drawVerticalEndBar(s,this.x);break;case gt.Barline.type.REPEAT_BEGIN:this.drawRepeatBar(s,this.x,!0);break;case gt.Barline.type.REPEAT_END:this.drawRepeatBar(s,this.x,!1);break;case gt.Barline.type.REPEAT_BOTH:this.drawRepeatBar(s,this.x,!1),this.drawRepeatBar(s,this.x,!0);break}}),this.stave.setBegBarType(gt.Barline.type.REPEAT_BEGIN);break}break;case ns.MeasureEnd:switch(t){case Et.DotsBoldBoldDots:this.stave.setEndBarType(gt.Barline.type.REPEAT_BOTH);break;case Et.DotsThinBold:this.stave.setEndBarType(gt.Barline.type.REPEAT_END);break;case Et.DoubleThin:this.stave.setEndBarType(gt.Barline.type.DOUBLE);break;case Et.ThinBold:this.stave.setEndBarType(gt.Barline.type.END);break;case Et.None:this.stave.setEndBarType(gt.Barline.type.NONE);break}break}}addMeasureNumber(){const t=this.MeasureNumber.toString(),e=wn.ABOVE,i={justification:1,shift_x:0,shift_y:0};this.stave.setText(t,e,i)}addWordRepetition(t){let e,i=gt.StaveModifier.Position.END;const s=this.beginInstructionsWidth;switch(t.type){case q.Segno:e=gt.Repetition.type.SEGNO_LEFT,i=gt.StaveModifier.Position.LEFT;break;case q.Coda:e=gt.Repetition.type.CODA_LEFT,i=gt.StaveModifier.Position.LEFT;break;case q.DaCapo:e=gt.Repetition.type.DC;break;case q.DalSegno:e=gt.Repetition.type.DS;break;case q.Fine:e=gt.Repetition.type.FINE;break;case q.ToCoda:e=gt.Repetition.type.TO_CODA;break;case q.DaCapoAlFine:e=gt.Repetition.type.DC_AL_FINE;break;case q.DaCapoAlCoda:e=gt.Repetition.type.DC_AL_CODA;break;case q.DalSegnoAlFine:e=gt.Repetition.type.DS_AL_FINE;break;case q.DalSegnoAlCoda:e=gt.Repetition.type.DS_AL_CODA;break}if(e){if(this.stave.getModifiers().find(l=>l.symbol_type===e))return;const a=new gt.Repetition(e,s,-this.rules.RepetitionSymbolsYOffset);this.stave.addModifier(a,i);return}this.addVolta(t)}addVolta(t){var i;let e=gt.Volta.type.BEGIN;if(t.type===q.Ending){switch(t.alignment){case Dt.Begin:this.parentSourceMeasure.endsRepetitionEnding()?e=gt.Volta.type.BEGIN_END:e=gt.Volta.type.BEGIN;break;case Dt.End:if(this.parentSourceMeasure.beginsRepetitionEnding())return;e=gt.Volta.type.END;break}const s=this.ParentStaffLine.SkyBottomLineCalculator,r=this.PositionAndShape.AbsolutePosition.x+this.PositionAndShape.BorderMarginLeft+.4,o=Math.max(this.PositionAndShape.AbsolutePosition.x+this.PositionAndShape.BorderMarginRight,r+.4),a=s.getSkyLineMinInRange(r,o)-2;let l=-6.1+this.rules.VoltaOffset,h=this.rules.VoltaOffset;a<l&&(h+=a-l,l=a);let c;const u=this.parentSourceMeasure.MeasureNumber;for(let f=0;f<this.ParentStaffLine.Measures.length;f++){const d=this.ParentStaffLine.Measures[f];d instanceof Es&&(d.MeasureNumber===u-1||d.MeasureNumber+((i=d.parentSourceMeasure)==null?void 0:i.multipleRestMeasures)===u)&&(c=d)}if(c){const f=c.stave.getModifiers();for(let d=0;d<f.length;d++){const p=f[d];if(p.hasOwnProperty("volta")){const g=c.ParentStaffLine.SkyBottomLineCalculator,m=c.PositionAndShape.AbsolutePosition.x+c.PositionAndShape.BorderMarginLeft+.4,S=Math.max(c.PositionAndShape.AbsolutePosition.x+c.PositionAndShape.BorderMarginRight,m+.4),b=g.getSkyLineMinInRange(m,S);b<=l?(h+=b-l,l=b):(p.y_shift=h*_t,c.ParentStaffLine.SkyBottomLineCalculator.updateSkyLineInRange(m,S,l))}}}h*=10,this.stave.setVoltaType(e,t.endingIndices[0],h),s.updateSkyLineInRange(r,o,l)}}setWidth(t){super.setWidth(t),this.stave.setWidth(t*_t)}layoutSymbols(){}draw(t){var a,l,h,c,u,f,d;const e=t.openGroup();(a=e==null?void 0:e.classList)==null||a.add("vf-measure");const i=t.openGroup();(l=i==null?void 0:i.classList)==null||l.add("vf-stave"),i==null||i.setAttribute("id",(c=(h=this.stave)==null?void 0:h.attrs)==null?void 0:c.id),this.stave.setContext(t).draw(),t.closeGroup();const s=t.openGroup();(u=s==null?void 0:s.classList)==null||u.add("vf-voices");for(const p in this.vfVoices)this.vfVoices.hasOwnProperty(p)&&(t.save(),this.vfVoices[p].draw(t,this.stave),t.restore());t.closeGroup();const r=t.openGroup();if((f=r==null?void 0:r.classList)==null||f.add("vf-beams"),this.rules.DYMusicScoreType!=="jianpu"){for(const p in this.vfbeams)if(this.vfbeams.hasOwnProperty(p))for(const g of this.vfbeams[p])g.setContext(t).draw()}if(this.autoVfBeams)for(const p of this.autoVfBeams)p.setContext(t).draw();if(!this.isTabMeasure||this.rules.TupletNumbersInTabs){if(this.autoTupletVfBeams)for(const p of this.autoTupletVfBeams)p.setContext(t).draw();for(const p in this.vftuplets)if(this.vftuplets.hasOwnProperty(p))for(const g of this.vftuplets[p])if(this.rules.DYMusicScoreType==="jianpu"){let m=g.getNotes();const S=new gt.StaveTie({first_note:m[0],last_note:m[m.length-1]},m.length+"");this.vfTies.push(S),g.setTupletLocation(1)}else g.setContext(t).draw()}t.closeGroup(),t.closeGroup();const o=t.openGroup();(d=o==null?void 0:o.classList)==null||d.add("vf-ties");for(const p of this.vfTies)p.setContext(t).draw();t.closeGroup();for(const p of this.connectors)p.setContext(t).draw();return this.correctNotePositions(),e}format(){this.formatVoices&&this.formatVoices((this.PositionAndShape.Size.width-this.beginInstructionsWidth-this.endInstructionsWidth)*_t,this)}correctNotePositions(){if(!this.isTabMeasure)for(const t of this.getVoicesWithinMeasure())for(const e of t.VoiceEntries)for(const i of e.Notes){const s=this.rules.GNote(i);if(!(s!=null&&s.vfnote))return;const r=s.vfnote[0];let o=0;s.parentVoiceEntry.parentVoiceEntry.StemDirection===Ft.Up?o+=3.5:o+=.5,o+=-s.notehead(r).line+s.parentVoiceEntry.notes.last().notehead().line,s.PositionAndShape.RelativePosition.y=o}}getVoicesWithinMeasure(){const t=[];for(const e of this.staffEntries)for(const i of e.graphicalVoiceEntries)t.indexOf(i.parentVoiceEntry.ParentVoice)===-1&&t.push(i.parentVoiceEntry.ParentVoice);return t}getGraphicalVoiceEntriesPerVoice(t){const e=[];for(const i of this.staffEntries)for(const s of i.graphicalVoiceEntries)s.parentVoiceEntry.ParentVoice===t&&e.push(s);return e}getRestFilledVexFlowStaveNotesPerVoice(t){let e,i=this.getGraphicalVoiceEntriesPerVoice(t);for(let o=0;o<i.length;o++){const a=i[o],l=a.notes[0].sourceNote.getAbsoluteTimestamp();let h=new W;for(const c of a.notes){const u=W.plus(c.sourceNote.getAbsoluteTimestamp(),c.sourceNote.Length);h.lt(u)&&(h=u)}if(e){const c=W.minus(l,e);if(c.RealValue>0){j.trace(`Ghost Found in between (measure ${this.MeasureNumber})`);const u=this.createGhostGves(c);i.splice(o,0,...u),o+=u.length}}else{const c=W.minus(l,this.parentSourceMeasure.AbsoluteTimestamp);if(c.RealValue>0){j.trace(`Ghost Found at start (measure ${this.MeasureNumber})`);const u=this.createGhostGves(c);i.splice(0,0,...u),o+=u.length}}e=h}const s=W.plus(this.parentSourceMeasure.AbsoluteTimestamp,this.parentSourceMeasure.Duration),r=W.minus(s,e);if(r.RealValue>0){j.trace(`Ghost Found at end (measure ${this.MeasureNumber})`);const o=this.createGhostGves(r);i=i.concat(o)}return i}createGhostGves(t){const e=Yt.GhostNotes(t),i=[];for(const s of e){const r=new $a(void 0,void 0);r.vfStaveNote=s,i.push(r)}return i}handleBeam(t,e){const i=t.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;let s=this.beams[i];s||(s=this.beams[i]=[]);let r;for(const a of s)a[0]===e&&(r=a);r||(r=[e,[]],s.push(r));const o=t.parentVoiceEntry;r[1].indexOf(o)<0&&r[1].push(o)}handleTuplet(t,e){const i=t.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;e=t.sourceNote.NoteTuplet;let s=this.tuplets[i];s||(s=this.tuplets[i]=[]);let r;for(const a of s)a[0]===e&&(r=a);r||(r=[e,[]],s.push(r));const o=t.parentVoiceEntry;r[1].indexOf(o)<0&&r[1].push(o)}finalizeBeams(){this.vfbeams={};const t=[];for(const e in this.beams)if(this.beams.hasOwnProperty(e)){let i=this.vfbeams[e];i||(i=this.vfbeams[e]=[]);for(const s of this.beams[e]){let r=!1;for(const d of s[0].Notes)if(d.Length.RealValue>=new W(1,4).RealValue&&(!d.TypeLength||d.TypeLength.RealValue>.125)){r=!0;break}if(r){j.debug("Beam between note >= quarter, likely tremolo, currently unsupported. continuing.");continue}const o=[],a=s[0],l=s[1];let h=!0;for(const d of l)d.parentVoiceEntry.ParentVoice===a.Notes[0].ParentVoiceEntry.ParentVoice&&(h=d.parentVoiceEntry.WantedStemDirection===Ft.Undefined);let c=!1,u;const f=[];for(const d of l){const p=d.vfStaveNote;p&&(o.push(p),t.push(p)),d.parentVoiceEntry.IsGrace&&(c=!0),d.parentVoiceEntry.StemColor&&this.rules.ColoringEnabled&&f.push(d.parentVoiceEntry.StemColor)}if(o.length>1){const d=new gt.Beam(o,h);if(c&&(d.render_options.beam_width=3,d.render_options.partial_beam_length=4),f.length>=2&&this.rules.ColorBeams){u=f[0];for(const p of f)if(p!==u){u=void 0;break}d.setStyle({fillStyle:u,strokeStyle:u})}this.rules.FlatBeams&&(d.render_options.flat_beams=!0,d.render_options.flat_beam_offset=this.rules.FlatBeamOffset,d.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),i.push(d)}else j.debug("Warning! Beam with no notes!")}}this.rules.AutoBeamNotes&&this.autoBeamNotes(t)}autoBeamNotes(t){if(!this.rules.AutoBeamTabs&&this.isTabMeasure)return;let e=[],i=[],s,r=[];this.autoTupletVfBeams=[];const o=[];this.autoVfBeams=[];let a=this.parentSourceMeasure.ActiveTimeSignature;a||(a=this.parentSourceMeasure.Duration);for(const c of this.staffEntries)for(const u of c.graphicalVoiceEntries){const f=u.vfStaveNote,d=u.notes[0],p=c.relInMeasureTimestamp.isOnBeat(a),g=i.length>=2,m=d.sourceNote.Length.RealValue-new W(1,4).RealValue>-W.FloatInaccuracyTolerance,S=u.parentVoiceEntry.IsGrace||m||t.contains(f);if(S||p){if(g){for(const y of i)e.push(y);o.push(e.slice()),e=[]}if(i=[],S)continue}const b=u.notes[0].sourceNote.NoteTuplet;if(b){let y=!1;for(const x of b.Notes){for(const w of x)if(w.NoteTypeXml>=yo.QUARTER||w.ParentVoiceEntry.IsGrace||w.isRest()&&!this.rules.AutoBeamOptions.beam_rests){y=!0;break}if(y)break}if(!s)s=b;else if(s!==b){if(r.length>1){const x=new gt.Beam(r,!0);this.rules.FlatBeams&&(x.render_options.flat_beams=!0,x.render_options.flat_beam_offset=this.rules.FlatBeamOffset,x.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoTupletVfBeams.push(x)}r=[],s=b}y||r.push(f);continue}else s=void 0;i.push(f)}if(r.length>=2){const c=new gt.Beam(r,!0);this.rules.FlatBeams&&(c.render_options.flat_beams=!0,c.render_options.flat_beam_offset=this.rules.FlatBeamOffset,c.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoTupletVfBeams.push(c)}if(i.length>=2){for(const c of i)e.push(c);o.push(e)}const l=this.rules.AutoBeamOptions,h={beam_middle_only:l.beam_middle_rests_only,beam_rests:l.beam_rests,maintain_stem_directions:l.maintain_stem_directions};if(l.groups&&l.groups.length){const c=[];for(const u of l.groups)c.push(new gt.Fraction(u[0],u[1]));h.groups=c}for(const c of o){const u=gt.Beam.generateBeams(c,h);for(const f of u)this.rules.FlatBeams&&(f.render_options.flat_beams=!0,f.render_options.flat_beam_offset=this.rules.FlatBeamOffset,f.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoVfBeams.push(f)}}finalizeTuplets(){this.vftuplets={};for(const t in this.tuplets)if(this.tuplets.hasOwnProperty(t)){let e=this.vftuplets[t];e||(e=this.vftuplets[t]=[]);for(const i of this.tuplets[t]){const s=[],r=i[1];for(const o of r)s.push(o.vfStaveNote);if(s.length>1){const o=i[0],a=o.Notes[0][0].NormalNotes,l=o.Bracket||o.TupletLabelNumber===3&&this.rules.TripletsBracketed||o.TupletLabelNumber!==3&&this.rules.TupletsBracketed;let h=gt.Tuplet.LOCATION_TOP;o.tupletLabelNumberPlacement===z.Below&&(h=gt.Tuplet.LOCATION_BOTTOM),e.push(new gt.Tuplet(s,{bracketed:l,location:h,notes_occupied:a,num_notes:o.TupletLabelNumber,ratioed:this.rules.TupletsRatioed}))}else j.debug("Warning! Tuplet with no notes! Trying to ignore, but this is a serious problem.")}}}layoutStaffEntry(t){}graphicalMeasureCreatedCalculations(){let t,e=[];const i=[];for(const r of this.staffEntries){t=!1,e=[];for(const o of r.graphicalVoiceEntries){if(o.parentVoiceEntry.IsGrace){e.push(o),i.push(o),t||(t=o.parentVoiceEntry.GraceSlur);continue}if(o.vfStaveNote=Yt.StaveNote(o),e.length>0){const a=[];for(let h=0;h<e.length;h++){const c=e[h];c.GraceSlash=c.parentVoiceEntry.GraceNoteSlash,h>0&&(c.GraceSlash=!1);const u=Yt.StaveNote(c);c.vfStaveNote=u,a.push(u)}const l=new gt.GraceNoteGroup(a,t);o.vfStaveNote.addModifier(0,l),e=[]}}}if(e.length>0)for(const r of e)r.vfStaveNote=Yt.StaveNote(r),r.parentVoiceEntry.GraceAfterMainNote=!0;this.finalizeBeams(),this.finalizeTuplets();const s=this.getVoicesWithinMeasure();if(this.rules.RenderFingerings)for(const r of this.staffEntries)r.setModifierXOffsets();for(const r of s){if(!r)continue;this.vfVoices[r.VoiceId]=new gt.Voice({beat_value:this.parentSourceMeasure.Duration.Denominator,num_beats:this.parentSourceMeasure.Duration.Numerator,resolution:gt.RESOLUTION}).setMode(gt.Voice.Mode.SOFT);const o=this.getRestFilledVexFlowStaveNotesPerVoice(r);for(const a of o){if(a.parentVoiceEntry&&a.parentVoiceEntry.IsGrace&&!a.parentVoiceEntry.GraceAfterMainNote)continue;const l=a;if(l.vfStaveNote.ticks.denominator===0)continue;if(a.notes.length===0||!a.notes[0]||!a.notes[0].sourceNote.PrintObject){this.vfVoices[r.VoiceId].addTickable(l.vfStaveNote);continue}const h=l.parentStaffEntry;if(h&&h.vfClefBefore){const c=new Su([h.vfClefBefore]);l.vfStaveNote.getCategory&&l.vfStaveNote.getCategory()==="stavenotes"&&l.vfStaveNote.addModifier(0,c)}a.parentVoiceEntry&&this.rules.RenderFingerings&&((this.rules.FingeringPosition===z.Left||this.rules.FingeringPosition===z.Right)&&this.createFingerings(a),this.createStringNumber(a)),this.createArpeggio(a),this.vfVoices[r.VoiceId].addTickable(l.vfStaveNote)}}this.setStemDirectionFromVexFlow();for(const r of i)this.createFingerings(r),this.createStringNumber(r),this.createArpeggio(r);this.createArticulations(),this.createOrnaments()}createArpeggio(t){if(t.parentVoiceEntry&&t.parentVoiceEntry.Arpeggio){const e=t.parentVoiceEntry.Arpeggio;if(t.notes&&t.notes.length>1){const i=Yt.StrokeTypeFromArpeggioType(e.type),s=new gt.Stroke(i,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&t.vfStaveNote.addStroke(0,s)}else j.debug(`[OSMD] arpeggio in measure ${this.MeasureNumber} could not be drawn.
  7. voice entry had less than two notes, arpeggio is likely between voice entries, not currently supported in Vexflow.`)}}setStemDirectionFromVexFlow(){for(const t of this.staffEntries)for(const e of t.graphicalVoiceEntries)for(const i of e.notes){const s=i.vfnote;if(!s||!s[0])continue;switch(s[0].getStemDirection()){case gt.Stem.UP:e.parentVoiceEntry.StemDirection=Ft.Up;break;case gt.Stem.DOWN:e.parentVoiceEntry.StemDirection=Ft.Down;break}}}createArticulations(){for(let t=0,e=this.staffEntries.length;t<e;++t){const s=this.staffEntries[t].graphicalVoiceEntries;for(const r of s){const o=r.vfStaveNote;Yt.generateArticulations(o,r.notes[0].sourceNote.ParentVoiceEntry.Articulations,this.rules)}}}createOrnaments(){for(let t=0,e=this.staffEntries.length;t<e;++t){const s=this.staffEntries[t].graphicalVoiceEntries;for(const r in s)if(s.hasOwnProperty(r)){const o=s[r].vfStaveNote,a=s[r].notes[0].sourceNote.ParentVoiceEntry.OrnamentContainer;a&&Yt.generateOrnaments(o,a)}}}createFingerings(t){const e=t;let i=0;for(const r of t.notes)r.sourceNote.Fingering&&i++;let s=-1;for(const r of t.notes){const o=r.sourceNote.Fingering;if(!o){s++;continue}s++;let a=this.rules.FingeringPosition;this.rules.FingeringPositionGrace===z.AboveOrBelow&&(this.isUpperStaffOfInstrument()?a=z.Above:this.isLowerStaffOfInstrument()&&(a=z.Below)),o.placement!==z.NotYetDefined&&(a=o.placement);let l=this.rules.FingeringOffsetX,h;switch(a){default:case z.Left:h=gt.StaveModifier.Position.LEFT,l-=r.baseFingeringXOffset*_t;break;case z.Right:h=gt.StaveModifier.Position.RIGHT,l+=r.baseFingeringXOffset*_t;break;case z.Above:h=gt.StaveModifier.Position.ABOVE;break;case z.Below:h=gt.StaveModifier.Position.BELOW;break;case z.NotYetDefined:const u=t.parentStaffEntry.sourceStaffEntry.ParentStaff;t.notes.length>1||t.parentStaffEntry.graphicalVoiceEntries.length>1?h=gt.StaveModifier.Position.LEFT:u.idInMusicSheet===0?(h=gt.StaveModifier.Position.ABOVE,a=z.Above):(h=gt.StaveModifier.Position.BELOW,a=z.Below)}const c=new gt.FretHandFinger(o.value);if(c.setPosition(h),c.setOffsetX(l),a===z.Above||a===z.Below){const u=a===z.Above?-1:1,f=a===z.Above?s:i-1-s;if(this.rules.FingeringInsideStafflines&&i>1){const d=c.getWidth()/2,p=i*2.5;c.setOffsetY(u*(f+p)*d)}else if(!this.rules.FingeringInsideStafflines){const d=new gt.StringNumber(o.value);d.radius=0,d.setPosition(h),d.setOffsetY(u*f*d.getWidth()*2/3),e.vfStaveNote.addModifier(s,d);continue}}e.vfStaveNote.addModifier(s,c)}}createStringNumber(t){if(!this.rules.RenderStringNumbersClassical)return;const e=t;t.notes.forEach((i,s)=>{const r=i.sourceNote.StringInstruction;if(r){let o=r.value;switch(o){case"1":o="I";break;case"2":o="II";break;case"3":o="III";break;case"4":o="IV";break;case"5":o="V";break;case"6":o="VI";break}const a=new gt.StringNumber(o);a.radius=0;const l=-this.rules.StringNumberOffsetY;t.notes.length>1||t.parentStaffEntry.graphicalVoiceEntries.length>1?(a.setOffsetX(i.baseStringNumberXOffset*13),a.setPosition(gt.Modifier.Position.RIGHT)):a.setPosition(gt.Modifier.Position.ABOVE),a.setOffsetY(l),e.vfStaveNote.addModifier(s,a)}})}lineTo(t,e){const i=new gt.StaveConnector(t.getVFStave(),this.stave);i.setType(e),this.connectors.push(i)}getVFStave(){return this.stave}updateInstructionWidth(){let t=0,e=0;const i=this.stave.getModifiers();for(const s of i)s.getPosition()===wn.BEGIN?t+=s.getWidth()+s.getPadding(void 0):s.getPosition()===wn.END&&(e+=s.getWidth()+s.getPadding(void 0));this.beginInstructionsWidth=(t!=null?t:0)/_t,this.endInstructionsWidth=(e!=null?e:0)/_t}addStaveTie(t,e){this.vfTies.push(t),e.vfTie=t}}var wn=(n=>(n[n.LEFT=1]="LEFT",n[n.RIGHT=2]="RIGHT",n[n.ABOVE=3]="ABOVE",n[n.BELOW=4]="BELOW",n[n.BEGIN=5]="BEGIN",n[n.END=6]="END",n))(wn||{});class yu extends Pe{constructor(t,e=void 0,i=void 0){super(),this.graphicalChordContainers=[],this.tabStaffEntry=void 0,this.MaxAccidentals=0,this.graphicalInstructions=[],this.ties=[],this.graphicalTies=[],this.lyricsEntries=[],this.parentMeasure=t,this.graphicalVoiceEntries=[],this.sourceStaffEntry=e,i?(this.staffEntryParent=i,this.parentVerticalContainer=i.parentVerticalContainer,this.PositionAndShape=new le(this,i.PositionAndShape)):this.PositionAndShape=new le(this,t.PositionAndShape),e&&(this.relInMeasureTimestamp=e.Timestamp),this.FingeringEntries=[]}get GraphicalInstructions(){return this.graphicalInstructions}get GraphicalTies(){return this.graphicalTies}get LyricsEntries(){return this.lyricsEntries}set LyricsEntries(t){this.lyricsEntries=t}getAbsoluteTimestamp(){const t=this.parentMeasure.parentSourceMeasure.AbsoluteTimestamp.clone();return this.relInMeasureTimestamp&&t.Add(this.relInMeasureTimestamp),t}findTieGraphicalNoteFromNote(t){for(const e of this.graphicalVoiceEntries)for(const i of e.notes){const s=i.sourceNote;if(!s.isRest()&&s.Pitch.FundamentalNote===t.Pitch.FundamentalNote&&s.Pitch.Octave===t.Pitch.Octave&&s.getAbsoluteTimestamp().Equals(t.getAbsoluteTimestamp()))return i}}findEndTieGraphicalNoteFromNoteWithStartingSlur(t,e){if(!!t){for(const i of this.graphicalVoiceEntries)if(i.parentVoiceEntry===t.ParentVoiceEntry)for(const s of i.notes){const r=s.sourceNote;if(r.NoteTie&&r.NoteSlurs.indexOf(e)!==-1)return s}}}findGraphicalNoteFromGraceNote(t){if(!!t){for(const e of this.graphicalVoiceEntries)if(e.parentVoiceEntry===t.ParentVoiceEntry){for(const i of e.notes)if(i.sourceNote===t)return i}}}findGraphicalNoteFromNote(t){if(!!t){for(const e of this.graphicalVoiceEntries)if(e.parentVoiceEntry===t.ParentVoiceEntry){for(const i of e.notes)if(i.sourceNote===t&&this.getAbsoluteTimestamp().Equals(t.getAbsoluteTimestamp()))return i}}}getGraphicalNoteDurationFromVoice(t){for(const e of this.graphicalVoiceEntries)if(e.parentVoiceEntry.ParentVoice===t)return e.notes[0].graphicalNoteLength;return new W(0,1)}findVoiceEntryGraphicalNotes(t){for(const e of this.graphicalVoiceEntries)if(e.parentVoiceEntry===t)return e.notes}isVoiceEntryPartOfLinkedVoiceEntry(t){if(this.sourceStaffEntry.Link)for(let e=0,i=this.sourceStaffEntry.Link.LinkStaffEntries.length;e<i;++e){const s=this.sourceStaffEntry.Link.LinkStaffEntries[e];if(s.VoiceEntries.indexOf(t)!==-1&&s!==this.sourceStaffEntry)return!0}return!1}findStaffEntryMinNoteLength(){let t=new W(Number.MAX_VALUE,1);for(const e of this.graphicalVoiceEntries)for(const i of e.notes){const s=i.graphicalNoteLength;s.lt(t)&&s.GetExpandedNumerator()>0&&(t=s)}return t}findStaffEntryMaxNoteLength(){let t=new W(0,1);for(const e of this.graphicalVoiceEntries)for(const i of e.notes){const s=i.graphicalNoteLength;t.lt(s)&&s.GetExpandedNumerator()>0&&(t=s)}return t}findOrCreateGraphicalVoiceEntry(t){for(const i of this.graphicalVoiceEntries)if(i.parentVoiceEntry===t)return i;const e=Lt.symbolFactory.createVoiceEntry(t,this);return this.graphicalVoiceEntries.push(e),e}findOrCreateGraphicalVoiceEntryFromGraphicalNote(t){for(const i of this.graphicalVoiceEntries)if(i===t.parentVoiceEntry)return i;const e=Lt.symbolFactory.createVoiceEntry(t.sourceNote.ParentVoiceEntry,this);return this.graphicalVoiceEntries.push(e),e}addGraphicalNoteToListAtCorrectYPosition(t,e){const i=t.notes;if(i.length===0||e.PositionAndShape.RelativePosition.y<Ti.last(i).PositionAndShape.RelativePosition.y)i.push(e);else for(let s=i.length-1;s>=0;s--){if(i[s].PositionAndShape.RelativePosition.y>e.PositionAndShape.RelativePosition.y){i.splice(s+1,0,e);break}if(s===0){i.splice(0,0,e);break}}}hasOnlyRests(){for(const e of this.graphicalVoiceEntries)for(const i of e.notes)if(!i.sourceNote.isRest())return!1;return!0}getSkylineMin(){var s;const t=(s=this.parentMeasure)==null?void 0:s.ParentStaffLine.SkyBottomLineCalculator;if(!t)return;const[e,i]=this.getAbsoluteStartAndEnd();return t.getSkyLineMinInRange(e,i)}getHighestYAtEntry(){return this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.y+this.getSkylineMin()}getLowestYAtEntry(){return this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.y+this.getBottomlineMax()}getBottomlineMax(){var s;const t=(s=this.parentMeasure)==null?void 0:s.ParentStaffLine.SkyBottomLineCalculator;if(!t)return;const[e,i]=this.getAbsoluteStartAndEnd();return t.getBottomLineMaxInRange(e,i)}getAbsoluteStartAndEnd(){let t=this.PositionAndShape.AbsolutePosition.x;t-=this.parentMeasure.ParentStaffLine.PositionAndShape.AbsolutePosition.x;const e=t+this.PositionAndShape.Size.width;return[t,e]}}const xu=M.Flow;class vu extends yu{constructor(t,e,i){super(t,e,i)}calculateXPosition(){const t=this.parentMeasure.getVFStave();let e=0;for(const i of this.graphicalVoiceEntries)if(i.vfStaveNote){if(i.vfStaveNote.setStave(t),t&&t.getLines&&t.getLines()===1&&i.vfStaveNote.getStemDirection()<0&&(i.vfStaveNote.setStemDirection(xu.Stem.UP),i.parentVoiceEntry.StemDirection=Ft.Up),!i.vfStaveNote.preFormatted)continue;i.applyBordersFromVexflow(),this.parentMeasure.ParentStaff.isTab?this.PositionAndShape.RelativePosition.x=(i.vfStaveNote.getAbsoluteX()+i.vfStaveNote.glyph.getWidth())/_t:this.PositionAndShape.RelativePosition.x=i.vfStaveNote.getBoundingBox().getX()/_t;const s=i.notes[0].sourceNote;s.isRest()&&s.Length.RealValue===this.parentMeasure.parentSourceMeasure.ActiveTimeSignature.RealValue&&(this.PositionAndShape.RelativePosition.x+=this.parentMeasure.parentSourceMeasure.Rules.WholeRestXShiftVexflow-.1,i.PositionAndShape.BorderLeft=-.7,i.PositionAndShape.BorderRight=.7),i.PositionAndShape.BorderLeft<e&&(e=i.PositionAndShape.BorderLeft)}this.PositionAndShape.RelativePosition.x-=e,this.PositionAndShape.calculateBoundingBox()}setMaxAccidentals(){for(const t of this.graphicalVoiceEntries)for(const e of t.notes)if(e.DrawnAccidental!==yt.NONE)return this.MaxAccidentals=1;return this.MaxAccidentals=0}setModifierXOffsets(){let t=[];for(const r of this.graphicalVoiceEntries)t=t.concat(r.notes);const e=t.map(r=>r.staffLine),i=this.calculateModifierXOffsets(e,1),s=this.calculateModifierXOffsets(e,.5);t.forEach((r,o)=>{r.baseFingeringXOffset=s[o],r.baseStringNumberXOffset=i[o]})}calculateModifierXOffsets(t,e){const i=[];for(let s=0;s<t.length;s++){let r=0,o=!0;for(;o;)for(let a=s;a>=0;a--){if(Math.abs(t[s]-t[a])<=e&&r===i[a]){r++,o=!0;break}o=!1}i.push(r)}return i}}class Bn extends qa{constructor(t,e,i,s=oe.NONE,r,o=void 0){if(super(t,e,r,o),this.clef=i,this.octaveShift=s,t.Pitch){const a=t.isRest()?t.Pitch:_n.getPitchFromOctaveShift(t.Pitch,s);this.vfpitch=Yt.pitch(a,t.isRest(),this.clef,this.sourceNote.Notehead),this.vfpitch[1]=void 0}}setAccidental(t){const e=this.drawPitch(t);this.vfpitch=Yt.pitch(e,this.sourceNote.isRest(),this.clef,this.sourceNote.Notehead),this.DrawnAccidental=e.Accidental}drawPitch(t){return _n.getPitchFromOctaveShift(t,this.octaveShift)}Transpose(t,e,i,s){const r=super.Transpose(t,e,i,s),o=_n.getPitchFromOctaveShift(r,this.octaveShift);return this.vfpitch=Yt.pitch(o,this.sourceNote.isRest(),this.clef,this.sourceNote.Notehead),this.vfpitch[1]=void 0,o}setIndex(t,e){this.vfnote=[t,e],this.vfnoteIndex=e}notehead(t=void 0){let e=t;e||(e=this.vfnote[0]);const i=e.note_heads;return i&&i.length>this.vfnoteIndex&&i[this.vfnoteIndex]?e.note_heads[this.vfnoteIndex]:{line:0}}Clef(){return this.clef}getSVGId(){if(!!this.vfnote)return this.vfnote[0].getAttribute("id")}getSVGGElement(){if(!!this.vfnote)return this.vfnote[0].getAttribute("el")}getStemSVG(){return document.getElementById("vf-"+this.getSVGId()+"-stem")}getBeamSVGs(){const t=[];for(let e=0;;e++){const i=document.getElementById(`vf-${this.getSVGId()}-beam${e}`);if(!i)break;t.push(i)}return t}}class _u extends Pe{constructor(t,e,i,s,r,o){super(),this.chordSymbolContainer=t,this.boundingBox=new le(this,e),this.rules=o,this.calculateLabel(i,r,s)}get GetChordSymbolContainer(){return this.chordSymbolContainer}get GraphicalLabel(){return this.graphicalLabel}calculateLabel(t,e,i){const s=Ka.calculateChordText(this.chordSymbolContainer,e,i);this.graphicalLabel=new Se(new jt(s),t,this.rules.ChordSymbolTextAlignment,this.rules,this.boundingBox),this.graphicalLabel.PositionAndShape.RelativePosition=new O(this.rules.ChordSymbolRelativeXOffset,0),this.graphicalLabel.Label.colorDefault=this.rules.DefaultColorChordSymbol}}const As=M.Flow;class wu extends Es{constructor(t,e=void 0,i=void 0){super(t,e,i),this.isTabMeasure=!0}resetLayout(){var e;const t=(e=this.ParentStaff.StafflineCount)!=null?e:6;this.stave=new As.TabStave(0,0,0,{space_above_staff_ln:0,space_below_staff_ln:0,num_lines:t}),this.updateInstructionWidth()}graphicalMeasureCreatedCalculations(){for(let e=0,i=this.staffEntries.length;e<i;++e){const s=this.staffEntries[e];for(const r of s.graphicalVoiceEntries)r.notes[0].sourceNote.isRest()?r.vfStaveNote=Yt.GhostNotes(r.notes[0].sourceNote.Length)[0]:r.vfStaveNote=Yt.CreateTabNote(r)}this.rules.TupletNumbersInTabs&&this.finalizeTuplets();const t=this.getVoicesWithinMeasure();for(const e of t){if(!e)continue;this.vfVoices[e.VoiceId]=new As.Voice({beat_value:this.parentSourceMeasure.Duration.Denominator,num_beats:this.parentSourceMeasure.Duration.Numerator,resolution:As.RESOLUTION}).setMode(As.Voice.Mode.SOFT);const i=this.getRestFilledVexFlowStaveNotesPerVoice(e);for(const s of i){if(s.parentVoiceEntry&&s.parentVoiceEntry.IsGrace&&!s.parentVoiceEntry.GraceAfterMainNote)continue;const r=s;if(s.notes.length===0||!s.notes[0]||!s.notes[0].sourceNote.PrintObject){this.vfVoices[e.VoiceId].addTickable(r.vfStaveNote);continue}if(s.parentVoiceEntry&&s.parentVoiceEntry.Arpeggio){const o=s.parentVoiceEntry.Arpeggio;if(s.notes&&s.notes.length>1){const a=Yt.StrokeTypeFromArpeggioType(o.type),l=new As.Stroke(a,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&r.vfStaveNote.addStroke(0,l)}else j.debug(`[OSMD] arpeggio in measure ${this.MeasureNumber} could not be drawn.
  8. voice entry had less than two notes, arpeggio is likely between voice entries, not currently supported in Vexflow.`)}this.vfVoices[e.VoiceId].addTickable(r.vfStaveNote)}}}}class Eu extends Pe{constructor(t,e){super(),this.measures=[],this.staffLines=new Array(5),this.octaveShifts=[],this.lyricLines=[],this.lyricsDashes=[],this.abstractExpressions=[],this.graphicalSlurs=[],this.Pedals=[],this.WavyLines=[],this.parentMusicSystem=t,this.parentStaff=e,this.boundingBox=new le(this,t.PositionAndShape),this.skyBottomLine=Lt.symbolFactory.createSkyBottomLineCalculator(this),this.staffHeight=this.parentMusicSystem.rules.StaffHeight,this.topLineOffset=0,this.bottomLineOffset=4,this.calculateStaffLineOffsets()}calculateStaffLineOffsets(){if(this.ParentStaff.isTab)switch(this.ParentStaff.StafflineCount){case 5:this.staffHeight=this.bottomLineOffset=this.ParentStaff.ParentInstrument.GetMusicSheet.Rules.TabStaffInterlineHeight*6;break;default:this.staffHeight=this.bottomLineOffset=this.ParentStaff.ParentInstrument.GetMusicSheet.Rules.TabStaffInterlineHeight*this.ParentStaff.StafflineCount;break}else switch(this.ParentStaff.StafflineCount){case 4:this.bottomLineOffset=1;break;case 3:this.topLineOffset=1,this.bottomLineOffset=1;break;case 2:this.topLineOffset=2,this.bottomLineOffset=1;break;case 1:this.topLineOffset=2,this.bottomLineOffset=2;break}}get Measures(){return this.measures}set Measures(t){this.measures=t}get StaffLines(){return this.staffLines}set StaffLines(t){this.staffLines=t}get Index(){return this.parentMusicSystem.StaffLines.indexOf(this)}get NextStaffLine(){const t=this.Index;return t!==this.parentMusicSystem.StaffLines.length?this.parentMusicSystem.StaffLines[t+1]:void 0}get LyricLines(){return this.lyricLines}get AbstractExpressions(){return this.abstractExpressions}set AbstractExpressions(t){this.abstractExpressions=t}set LyricLines(t){this.lyricLines=t}get LyricsDashes(){return this.lyricsDashes}set LyricsDashes(t){this.lyricsDashes=t}get ParentMusicSystem(){return this.parentMusicSystem}set ParentMusicSystem(t){this.parentMusicSystem=t}get ParentStaff(){return this.parentStaff}set ParentStaff(t){this.parentStaff=t}get SkyBottomLineCalculator(){return this.skyBottomLine}get SkyLine(){return this.skyBottomLine.SkyLine}get BottomLine(){return this.skyBottomLine.BottomLine}get OctaveShifts(){return this.octaveShifts}set OctaveShifts(t){this.octaveShifts=t}get StaffHeight(){return this.staffHeight}get TopLineOffset(){return this.topLineOffset}get BottomLineOffset(){return this.bottomLineOffset}get GraphicalSlurs(){return this.graphicalSlurs}addSlurToStaffline(t){this.graphicalSlurs.push(t)}addActivitySymbolClickArea(){const t=new wa(this),e=this.PositionAndShape;t.PositionAndShape.RelativePosition=new O(e.RelativePosition.x+e.BorderRight+.5,e.RelativePosition.y+.5),t.PositionAndShape.Parent=this.parentMusicSystem.PositionAndShape}isPartOfMultiStaffInstrument(){return this.parentStaff.ParentInstrument.Staves.length>1}findClosestStaffEntry(t){let e;for(let i=0,s=this.Measures.length;i<s;++i){const r=this.Measures[i];for(let o=0,a=r.staffEntries.length;o<a;++o){const l=r.staffEntries[o];Math.abs(l.PositionAndShape.RelativePosition.x-t+r.PositionAndShape.RelativePosition.x)<10&&(e=l)}}return e}}class tl extends xo{constructor(t,e,i,s){if(super(t,e,i),this.IsVerbal){const r=new jt(t.Label);this.label=new Se(r,s||this.rules.ContinuousDynamicTextHeight,vt.LeftCenter,this.rules,this.PositionAndShape),this.label.Label.fontStyle=ue.Italic,this.label.setLabelPositionAndShapeBorders(),this.PositionAndShape.calculateBoundingBox()}}}class Mu{constructor(t){this.parentStaffline=t,this.rules=this.parentStaffline.ParentMusicSystem.rules}alignDynamicExpressions(){var i,s;const t=[];let e=new Array;for(let r=0;r<this.parentStaffline.AbstractExpressions.length-1;r++){const o=this.parentStaffline.AbstractExpressions[r],a=this.parentStaffline.AbstractExpressions[r+1],l=(i=o==null?void 0:o.SourceExpression)==null?void 0:i.Placement,h=(s=a==null?void 0:a.SourceExpression)==null?void 0:s.Placement;if(l===h){const c=this.getDistance(o.PositionAndShape,a.PositionAndShape);Math.abs(c.x)<this.rules.DynamicExpressionMaxDistance?(e.indexOf(o)===-1&&e.push(o),e.push(a)):(t.push(e),e=new Array)}}t.push(e);for(const r of t)if(r.length>0){const o=r.map(l=>l.PositionAndShape.Center.y),a=Math.max(...o);for(let l=0;l<r.length;l++){const h=r[l],c=o[l]-a;if(h instanceof tl?(h.shiftYPosition(-c),h.calcPsi()):(h.PositionAndShape.RelativePosition.y-=c*.8,h.PositionAndShape.calculateBoundingBox()),h.squeeze){const u=l<r.length-1?r[l+1]:void 0,f=l>0?r[l-1]:void 0;if(u){const d=this.getOverlap(h.PositionAndShape,u.PositionAndShape);h.squeeze(-(d.x+this.rules.DynamicExpressionSpacer))}if(f){const d=this.getOverlap(f.PositionAndShape,h.PositionAndShape);h.squeeze(d.x+this.rules.DynamicExpressionSpacer)}}}}}getDistance(t,e){const i=t.RelativePosition.x+t.BorderMarginRight,s=e.RelativePosition.x+e.BorderMarginLeft,r=t.RelativePosition.y+t.BorderMarginBottom,o=e.RelativePosition.y+e.BorderMarginTop;return new O(s-i,o-r)}getOverlap(t,e){return new O(t.RelativePosition.x+t.BorderMarginRight-(e.RelativePosition.x+e.BorderMarginLeft),t.RelativePosition.y+t.BorderMarginBottom-(e.RelativePosition.y+e.BorderMarginTop))}}class Pu extends Eu{constructor(t,e){super(t,e),this.slursInVFStaffLine=[],this.alignmentManager=new Mu(this)}get SlursInVFStaffLine(){return this.slursInVFStaffLine}addVFSlurToVFStaffline(t){this.slursInVFStaffLine.push(t)}get AlignmentManager(){return this.alignmentManager}}const Lu=M.Flow;class Tu extends Es{constructor(t,e=void 0,i=void 0){super(t,e,i),this.minimumStaffEntriesWidth=-1,i?this.rules=i.ParentMusicSystem.rules:e&&(this.rules=e.Rules),this.resetLayout(),this.multiRestElement=new Lu.MultiMeasureRest(e.multipleRestMeasures,{})}draw(t){var r,o,a,l,h;const e=t.openGroup();(r=e==null?void 0:e.classList)==null||r.add("vf-measure");const i=t.openGroup();(o=i==null?void 0:i.classList)==null||o.add("vf-stave"),i==null||i.setAttribute("id",(l=(a=this.stave)==null?void 0:a.attrs)==null?void 0:l.id),this.stave.setContext(t).draw(),t.closeGroup();const s=t.openGroup();(h=s==null?void 0:s.classList)==null||h.add("vf-voices"),this.multiRestElement.setStave(this.stave),this.multiRestElement.setContext(t),this.multiRestElement.draw(),t.closeGroup();for(const c of this.connectors)c.setContext(t).draw();return t.closeGroup(),e}format(){}getVoicesWithinMeasure(){return[]}getGraphicalVoiceEntriesPerVoice(t){return[]}getRestFilledVexFlowStaveNotesPerVoice(t){return[]}handleBeam(t,e){}handleTuplet(t,e){}finalizeBeams(){}finalizeTuplets(){}layoutStaffEntry(t){}graphicalMeasureCreatedCalculations(){}createArticulations(){}createOrnaments(){}createFingerings(t){}getVFStave(){return this.stave}}const Cu=M.Flow;class el{getInnerElement(){return this.inner}getCanvas(){return this.canvas}getRenderElement(){let t=this.canvas;return this.getVexflowBackendType()===Cu.Renderer.Backends.CANVAS&&(t=this.inner),t}getRenderer(){return this.renderer}removeAllChildrenFromContainer(t){for(;t.children.length!==0;)t.removeChild(t.children.item(0))}removeFromContainer(t){const e=this.getRenderElement();for(let i=0;i<t.children.length;i++)if(t.children.item(i)===e){t.removeChild(e);break}}resize(t,e){this.renderer.resize(t,e),this.width=t,this.height=e}}const gr=M.Flow;class il extends el{constructor(t){super(),this.rules=t}getVexflowBackendType(){return gr.Renderer.Backends.CANVAS}getOSMDBackendType(){return $i.Canvas}getCanvasSize(){var t;return(t=document.getElementById(this.rules.DYContainerId+this.graphicalMusicPage.PageNumber))==null?void 0:t.offsetHeight}initialize(t,e){this.zoom=e,this.canvas=document.createElement("canvas"),this.graphicalMusicPage||(this.graphicalMusicPage=new vr(void 0),this.graphicalMusicPage.PageNumber=1),this.canvas.id="osmdCanvasVexFlowBackendCanvas"+this.graphicalMusicPage.PageNumber,this.inner=document.createElement("div"),this.inner.id=this.rules.DYContainerId+this.graphicalMusicPage.PageNumber,this.inner.style.position="relative",this.canvas.style.zIndex="0",this.inner.appendChild(this.canvas),t.appendChild(this.inner),this.renderer=new gr.Renderer(this.canvas,this.getVexflowBackendType()),this.ctx=this.renderer.getContext()}initializeHeadless(t=300,e=300){this.graphicalMusicPage||(this.graphicalMusicPage=new vr(void 0),this.graphicalMusicPage.PageNumber=1),this.canvas=document.createElement("canvas"),this.canvas.width=t,this.canvas.height=e,this.renderer=new gr.Renderer(this.canvas,this.getVexflowBackendType()),this.ctx=this.renderer.getContext()}getContext(){return this.ctx}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.rules.PageBackgroundColor&&(this.ctx.save(),this.ctx.setFillStyle(this.rules.PageBackgroundColor),this.zoom=1,this.ctx.fillRect(0,0,this.canvas.width/this.zoom,this.canvas.height/this.zoom),this.ctx.restore())}scale(t){this.ctx.scale(t,t)}translate(t,e){this.CanvasRenderingCtx.translate(t,e)}renderText(t,e,i,s,r,o,a=void 0,l=void 0){const h=this.CanvasRenderingCtx.font;this.CanvasRenderingCtx.save(),this.CanvasRenderingCtx.font=Yt.font(t,e,i,this.rules,l),this.CanvasRenderingCtx.fillStyle=a,this.CanvasRenderingCtx.strokeStyle=a,this.CanvasRenderingCtx.fillText(s,o.x,o.y+r),this.CanvasRenderingCtx.restore(),this.CanvasRenderingCtx.font=h}renderRectangle(t,e,i,s=1){const r=this.CanvasRenderingCtx.fillStyle;i?this.CanvasRenderingCtx.fillStyle=i:this.CanvasRenderingCtx.fillStyle=Yt.style(e),this.CanvasRenderingCtx.globalAlpha=s,this.ctx.fillRect(t.x,t.y,t.width,t.height),this.CanvasRenderingCtx.fillStyle=r,this.CanvasRenderingCtx.globalAlpha=1}renderLine(t,e,i="#FF0000FF",s=2){const r=this.CanvasRenderingCtx.strokeStyle;this.CanvasRenderingCtx.strokeStyle=i,this.CanvasRenderingCtx.beginPath(),this.CanvasRenderingCtx.moveTo(t.x,t.y),this.CanvasRenderingCtx.lineTo(e.x,e.y),this.CanvasRenderingCtx.stroke(),this.CanvasRenderingCtx.strokeStyle=r}renderCurve(t){this.ctx.beginPath(),this.ctx.moveTo(t[0].x,t[0].y),this.ctx.bezierCurveTo(t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y),this.ctx.lineTo(t[7].x,t[7].y),this.ctx.bezierCurveTo(t[6].x,t[6].y,t[5].x,t[5].y,t[4].x,t[4].y),this.ctx.lineTo(t[0].x,t[0].y),this.ctx.closePath(),this.ctx.fill()}get CanvasRenderingCtx(){return this.ctx.vexFlowCanvasContext}}const Ru=M.Flow;class Rr extends el{constructor(t){super(),this.rules=t}getVexflowBackendType(){return Ru.Renderer.Backends.SVG}getOSMDBackendType(){return $i.SVG}getCanvasSize(){var t;return(t=document.getElementById(this.rules.DYContainerId+this.graphicalMusicPage.PageNumber))==null?void 0:t.offsetHeight}initialize(t,e,i=void 0){this.zoom=e,this.canvas=document.createElement("div"),i||(i=this.graphicalMusicPage?this.graphicalMusicPage.PageNumber.toString():"1"),this.canvas.id=this.rules.DYContainerId+i,this.inner=this.canvas,this.inner.style.position="relative",this.canvas.style.zIndex="0",t.appendChild(this.inner),this.renderer=new M.Flow.Renderer(this.canvas,this.getVexflowBackendType()),this.ctx=this.renderer.getContext(),this.ctx.svg.id=this.rules.DYSVGContainerId+i}getContext(){return this.ctx}getSvgElement(){return this.ctx.svg}removeNode(t){var i;const e=(i=this.ctx)==null?void 0:i.svg;if(!e)return!1;try{e.removeChild(t)}catch(s){return j.error(s),!1}return!0}clear(){if(!this.ctx)return;const t=this.ctx.svg;for(;t.lastChild;)t.removeChild(t.lastChild);this.rules.PageBackgroundColor&&(this.ctx.svg.style["background-color"]=this.rules.PageBackgroundColor)}scale(t){this.ctx.scale(t,t)}translate(t,e){}renderText(t,e,i,s,r,o,a=void 0,l=void 0){this.ctx.save();const h=this.ctx.openGroup("text");a&&(this.ctx.attributes.fill=a,this.ctx.attributes.stroke=a);let c=l;(!l||l==="default")&&(c=this.rules.DefaultFontFamily),this.ctx.setFont(c,t,Yt.fontStyle(e)),this.ctx.attributes["font-size"]=`${t}px`,this.ctx.state["font-size"]=`${t}px`;let u="normal",f="normal";switch(e){case ue.Bold:u="bold";break;case ue.Italic:f="italic";break;case ue.BoldItalic:u="bold",f="italic";break;default:u="normal"}return this.ctx.attributes["font-weight"]=u,this.ctx.state["font-weight"]=u,this.ctx.attributes["font-style"]=f,this.ctx.state["font-style"]=f,this.ctx.fillText(s,o.x,o.y+r),this.ctx.closeGroup(),this.ctx.restore(),h}renderRectangle(t,e,i,s=1){this.ctx.save();const r=this.ctx.openGroup("rect");return i?this.ctx.attributes.fill=i:this.ctx.attributes.fill=Yt.style(e),this.ctx.attributes["fill-opacity"]=s,this.ctx.fillRect(t.x,t.y,t.width,t.height),this.ctx.restore(),this.ctx.attributes["fill-opacity"]=1,this.ctx.closeGroup(),r}renderLine(t,e,i="#FF0000FF",s=2){this.ctx.save();const r=this.ctx.openGroup("line");return this.ctx.beginPath(),this.ctx.moveTo(t.x,t.y),this.ctx.lineTo(e.x,e.y),this.ctx.attributes.stroke=i,this.ctx.lineWidth=s,this.ctx.stroke(),this.ctx.closeGroup(),this.ctx.restore(),r}renderCurve(t){const e=this.ctx.openGroup("curve");return this.ctx.beginPath(),this.ctx.moveTo(t[0].x,t[0].y),this.ctx.bezierCurveTo(t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y),this.ctx.lineTo(t[7].x,t[7].y),this.ctx.bezierCurveTo(t[6].x,t[6].y,t[5].x,t[5].y,t[4].x,t[4].y),this.ctx.lineTo(t[0].x,t[0].y),this.ctx.closePath(),this.ctx.fill(),this.ctx.closeGroup(),e}export(){const t=this.ctx.svg.cloneNode(!0),e=document.implementation.createDocumentType("svg","-//W3C//DTD SVG 1.1//EN","http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"),i=document.implementation.createDocument("http://www.w3.org/2000/svg","svg",e);i.replaceChild(t,i.documentElement);const s=new XMLSerializer().serializeToString(i),r=document.createElement("a");r.href="data:image/svg+xml; charset=utf8, "+encodeURIComponent(s.replace(/></g,`>
  9. \r<`)),r.download="opensheetmusicdisplay_download.svg",r.innerHTML=window.location.href+"/download",document.body.appendChild(r)}}class Nu extends Ya{constructor(t,e,i){super(t,e,i);const s=new jt(this.Expression);this.label=new Se(s,this.rules.ContinuousDynamicTextHeight,vt.CenterCenter,this.rules,this.PositionAndShape),this.label.Label.fontStyle=ue.BoldItalic,this.label.setLabelPositionAndShapeBorders(),this.PositionAndShape.calculateBoundingBox()}get InstantaneousDynamic(){return this.mInstantaneousDynamicExpression}get Expression(){return ie[this.mInstantaneousDynamicExpression.DynEnum]}}class Au extends Pe{constructor(t,e){super(),this.getOctaveShift=t,this.setSymbol(),this.PositionAndShape=new le(this,e)}setSymbol(){switch(this.getOctaveShift.Type){case oe.VA8:this.octaveSymbol=Ge.VA8;break;case oe.VB8:this.octaveSymbol=Ge.VB8;break;case oe.MA15:this.octaveSymbol=Ge.MA15;break;case oe.MB15:this.octaveSymbol=Ge.MB15;break;default:throw new Li("")}}}const Is=M.Flow;class na extends Au{constructor(t,e){switch(super(t,e),t.Type){case oe.VA8:this.position=Is.TextBracket.Positions.TOP,this.supscript="va",this.text="8";break;case oe.MA15:this.position=Is.TextBracket.Positions.TOP,this.supscript="ma",this.text="15";break;case oe.VB8:this.position=Is.TextBracket.Positions.BOTTOM,this.supscript="vb",this.text="8";break;case oe.MB15:this.position=Is.TextBracket.Positions.BOTTOM,this.supscript="mb",this.text="15";break;default:j.error("Unknown or NONE octaveshift. This should not be called!");break}}setStartNote(t){for(const e of t.graphicalVoiceEntries){const i=e;if(i!=null&&i.vfStaveNote)return this.startNote=i.vfStaveNote,!0}return!1}setEndNote(t){for(const e of t.graphicalVoiceEntries){const i=e;if(i!=null&&i.vfStaveNote)return this.endNote=i.vfStaveNote,!0}return!1}getTextBracket(){return new Is.TextBracket({position:this.position,start:this.startNote,stop:this.endNote,superscript:this.supscript,text:this.text})}}class qs{constructor(t){this.staffPitchListMapping=new Ye,this.baseLineNote=ut.B,this.baseLineOctave=1,this.rules=t}trackNote(t){if(!(t instanceof Bn)||t.Clef().ClefType!==Pt.percussion||t.sourceNote.isRest()||this.rules.PercussionOneLineCutoff===0||this.rules.PercussionForceVoicesOneLineCutoff===-1)return;const e=t.parentVoiceEntry.parentStaffEntry.sourceStaffEntry.ParentStaff.idInMusicSheet;let i;this.staffPitchListMapping.containsKey(e)||this.staffPitchListMapping.setValue(e,new Array),i=this.staffPitchListMapping.getValue(e);const s=t.sourceNote.Pitch;qs.findOrInsert(i,s)}static PitchIndexOf(t,e,i=0){if(i>t.length-1)return-1;for(let s=i;s<t.length;s++){const r=t[s];if(e.OperatorEquals(r))return s}return-1}static findOrInsert(t,e){for(let i=0;i<t.length;i++){const s=t[i];if(e.OperatorEquals(s))return i;if(e.OperatorFundamentalLessThan(s))return t.splice(i,0,e),i}return t.push(e),t.length-1}positionNote(t){const e=t.parentVoiceEntry.parentStaffEntry.sourceStaffEntry.ParentStaff.idInMusicSheet;if(!(t instanceof Bn)||t.sourceNote.isRest()||!this.staffPitchListMapping.containsKey(e))return t;const i=this.staffPitchListMapping.getValue(e),s=this.rules.PercussionUseXMLDisplayStep&&t.sourceNote.displayStepUnpitched!==void 0;if(i.length>this.rules.PercussionOneLineCutoff&&!s)return t;const r=t,o=t.sourceNote.Pitch;let a=this.baseLineNote,l=this.baseLineOctave;if(this.rules.PercussionUseXMLDisplayStep&&t.sourceNote.displayStepUnpitched!==void 0&&(a=t.sourceNote.displayStepUnpitched,l=t.sourceNote.displayOctaveUnpitched+this.rules.PercussionOneLineXMLDisplayStepOctaveOffset),i.length<=this.rules.PercussionForceVoicesOneLineCutoff)r.setAccidental(new Kt(a,l,o.Accidental));else{const h=qs.PitchIndexOf(i,o);if(h>-1){const c=Math.ceil(i.length/2);if(!this.rules.PercussionUseXMLDisplayStep)if(h>=c)switch(l=2,(h-c)%5){case 1:a=ut.E;break;case 2:a=ut.G;break;case 3:a=ut.B;break;case 4:a=ut.D,l=3;break;default:a=ut.C;break}else switch(h%5){case 1:a=ut.F;break;case 2:a=ut.D;break;case 3:a=ut.B,l=0;break;case 4:a=ut.G,l=0;break;default:a=ut.A;break}const u=new Kt(a,l,o.Accidental);r.setAccidental(u);const f=r.parentVoiceEntry.parentVoiceEntry;!this.rules.SetWantedStemDirectionByXml&&f.Notes.length<2&&(u.Octave>this.baseLineOctave||u.FundamentalNote===this.baseLineNote&&u.Octave===this.baseLineOctave?r.parentVoiceEntry.parentVoiceEntry.WantedStemDirection=Ft.Up:r.parentVoiceEntry.parentVoiceEntry.WantedStemDirection=Ft.Down)}}return r}getStafflineUniquePositionCount(t){return this.staffPitchListMapping.containsKey(t)?this.staffPitchListMapping.getValue(t).length:0}}class sl{constructor(t){this.mStaffLineParent=t,this.mRules=t.ParentMusicSystem.rules}calculateLines(){const t=Math.max(Math.ceil(this.StaffLineParent.PositionAndShape.Size.width*this.SamplingUnit),1);this.mSkyLine=[],this.mBottomLine=[];const e=new il(this.StaffLineParent.ParentMusicSystem.rules);for(const o of this.StaffLineParent.Measures){o.PositionAndShape.calculateAbsolutePositionsRecursive(0,0);const a=o.getVFStave();let l=a.getWidth();if(!(l>0)&&!o.IsExtraGraphicalMeasure&&(j.warn("SkyBottomLineCalculator: width not > 0 in measure "+o.MeasureNumber),l=50),!(l>=50)&&o.IsExtraGraphicalMeasure)continue;e.initializeHeadless(l);const h=e.getContext(),c=e.getCanvas();l=c.width;const u=c.height;this.mRules.DYMusicScoreType==="jianpu"?a.setY(a.y-50):a.setY(a.y+100);const f=a.getWidth();a.setWidth(l),o.format(),a.setWidth(f);try{o.draw(h)}catch(b){j.warn("SkyBottomLineCalculator.calculateLines.draw",b)}const d=h.getImageData(0,0,l,u),p=4,g=Math.max(Math.ceil(o.PositionAndShape.Size.width*this.mRules.SamplingUnit),1),m=new Array(g),S=new Array(g);for(let b=0;b<l;b++){for(let y=0;y<u;y++){const w=y*l*p+b*p;if(d.data[w+3]>0){m[b]=y;break}}for(let y=u;y>0;y--){const w=y*l*p+b*p;if(d.data[w+3]>0){S[b]=y;break}}}for(let b=0;b<m.length;b++)m[b]===void 0&&(m[b]=Math.max(this.findPreviousValidNumber(b,m),this.findNextValidNumber(b,m)));for(let b=0;b<S.length;b++)S[b]===void 0&&(S[b]=Math.max(this.findPreviousValidNumber(b,S),this.findNextValidNumber(b,S)));this.mSkyLine.push(...m),this.mBottomLine.push(...S),e.clear()}const i=this.mSkyLine.length/t,s=[],r=[];for(let o=0;o<this.mSkyLine.length&&s.length!==t;o+=i){const a=Math.min(this.mSkyLine.length,o+i);let l=this.mSkyLine.slice(o,a+1);s.push(Math.min(...l)),l=this.mBottomLine.slice(o,a+1),r.push(Math.max(...l))}this.mSkyLine=s,this.mBottomLine=r,this.mSkyLine.length!==t&&j.debug(`SkyLine calculation was not correct (${this.mSkyLine.length} instead of ${t})`),this.mSkyLine=this.mSkyLine.map(o=>(o-Math.max(...this.mSkyLine))/_t+this.StaffLineParent.TopLineOffset),this.mBottomLine=this.mBottomLine.map(o=>(o-Math.min(...this.mBottomLine))/_t+this.StaffLineParent.BottomLineOffset)}findPreviousValidNumber(t,e){for(let i=t;i>=0;i--)if(!isNaN(e[i]))return e[i];return 0}findNextValidNumber(t,e){if(t>=e.length)return e[t-1];for(let i=t;i<e.length;i++)if(!isNaN(e[i]))return e[i];return 0}drawPixel(t,e,i="#FF0000FF"){const s=e.getContext(),r=s.fillStyle;s.fillStyle=i,s.fillRect(t.x,t.y,2,2),s.fillStyle=r}updateSkyLineWithWedge(t,e){let i=Math.floor(t.x*this.SamplingUnit),s=Math.ceil(e.x*this.SamplingUnit),r=(e.y-t.y)/(e.x-t.x);s-i<=1&&(s++,r=0),i<0&&(i=0),i>=this.BottomLine.length&&(i=this.BottomLine.length-1),s<0&&(s=0),s>=this.BottomLine.length&&(s=this.BottomLine.length),this.SkyLine[i]=t.y;for(let o=i+1;o<Math.min(s,this.SkyLine.length);o++)this.SkyLine[o]=this.SkyLine[o-1]+r/this.SamplingUnit}updateBottomLineWithWedge(t,e){let i=Math.floor(t.x*this.SamplingUnit),s=Math.ceil(e.x*this.SamplingUnit),r=(e.y-t.y)/(e.x-t.x);s-i<=1&&(s++,r=0),i<0&&(i=0),i>=this.BottomLine.length&&(i=this.BottomLine.length-1),s<0&&(s=0),s>=this.BottomLine.length&&(s=this.BottomLine.length),this.BottomLine[i]=t.y;for(let o=i+1;o<s;o++)this.BottomLine[o]=this.BottomLine[o-1]+r/this.SamplingUnit}updateSkyLineInRange(t,e,i){this.updateInRange(this.mSkyLine,t,e,i)}updateBottomLineInRange(t,e,i){this.updateInRange(this.BottomLine,t,e,i)}resetSkyLineInRange(t,e){this.updateInRange(this.SkyLine,t,e)}resetBottomLineInRange(t,e){this.setInRange(this.BottomLine,t,e)}setSkyLineWithValue(t){this.SkyLine.forEach(e=>t)}setBottomLineWithValue(t){this.BottomLine.forEach(e=>t)}getLeftIndexForPointX(t,e){const i=Math.floor(t*this.SamplingUnit);return i<0?0:i>=e?e-1:i}getRightIndexForPointX(t,e){const i=Math.ceil(t*this.SamplingUnit);return i<0?0:i>=e?e-1:i}updateStaffLineBorders(){this.mStaffLineParent.PositionAndShape.BorderTop=this.getSkyLineMin(),this.mStaffLineParent.PositionAndShape.BorderMarginTop=this.getSkyLineMin(),this.mStaffLineParent.PositionAndShape.BorderBottom=this.getBottomLineMax(),this.mStaffLineParent.PositionAndShape.BorderMarginBottom=this.getBottomLineMax()}getSkyLineMin(){return Math.min(...this.SkyLine.filter(t=>!isNaN(t)))}getSkyLineMinAtPoint(t){const e=Math.round(t*this.SamplingUnit);return this.mSkyLine[e]}getSkyLineMinInRange(t,e){return this.getMinInRange(this.SkyLine,t,e)}getBottomLineMax(){return Math.max(...this.BottomLine.filter(t=>!isNaN(t)))}getBottomLineMaxAtPoint(t){const e=Math.round(t*this.SamplingUnit);return this.mBottomLine[e]}getBottomLineMaxInRange(t,e){return this.getMaxInRange(this.BottomLine,t,e)}getBottomLineMaxInBoundingBox(t){const e=Math.floor(t.AbsolutePosition.x+t.BorderLeft),i=Math.ceil(t.AbsolutePosition.x+t.BorderRight);return this.getMaxInRange(this.mBottomLine,e,i)}updateWithBoundingBoxRecursively(t){if(t.ChildElements&&t.ChildElements.length>0)for(const e of t.ChildElements)this.updateWithBoundingBoxRecursively(e);else{const e=t.BorderTop+t.AbsolutePosition.y,i=t.BorderBottom+t.AbsolutePosition.y;if(e<0){const s=Math.floor(t.AbsolutePosition.x+t.BorderLeft),r=Math.ceil(t.AbsolutePosition.x+t.BorderRight);this.updateInRange(this.mSkyLine,s,r,e)}else if(i>this.StaffLineParent.StaffHeight){const s=Math.floor(t.AbsolutePosition.x+t.BorderLeft),r=Math.ceil(t.AbsolutePosition.x+t.BorderRight);this.updateInRange(this.mBottomLine,s,r,i)}}}updateInRange(t,e=0,i=t.length,s=0){if(e=Math.floor(e*this.SamplingUnit),i=Math.ceil(i*this.SamplingUnit),i<e)throw new Error("start index of line is greater than the end index");e<0&&(e=0),i>t.length&&(i=t.length);for(let r=e;r<i;r++)t[r]=Math.abs(s)>Math.abs(t[r])?s:t[r]}setInRange(t,e=0,i=t.length,s=0){if(e=Math.floor(e*this.SamplingUnit),i=Math.ceil(i*this.SamplingUnit),i<e)throw new Error("start index of line is greater then the end index");e<0&&(e=0),i>t.length&&(i=t.length);for(let r=e;r<i;r++)t[r]=s}getMinInRange(t,e,i){if(e=Math.floor(e*this.SamplingUnit),i=Math.ceil(i*this.SamplingUnit),!t)return Number.MAX_VALUE;if(e<0&&(e=0),e>=t.length&&(e=t.length-1),i<0&&(i=0),i>=t.length&&(i=t.length),e>=0&&i<=t.length)return Math.min(...t.slice(e,i+1))}getMaxInRange(t,e,i){if(e=Math.floor(e*this.SamplingUnit),i=Math.ceil(i*this.SamplingUnit),!t)return Number.MIN_VALUE;if(e<0&&(e=0),e>=t.length&&(e=t.length-1),i<0&&(i=0),i>=t.length&&(i=t.length),e>=0&&i<=t.length)return Math.max(...t.slice(e,i+1))}get SamplingUnit(){return this.mRules.SamplingUnit}get StaffLineParent(){return this.mStaffLineParent}get SkyLine(){return this.mSkyLine}get BottomLine(){return this.mBottomLine}}var nl={exports:{}};/*!
  10. * d-path-parser - v1.0.0
  11. * by Massimo Artizzu (MaxArt2501)
  12. *
  13. * https://github.com/MaxArt2501/d-path-parser
  14. *
  15. * Licensed under the MIT License
  16. * See LICENSE for details
  17. */(function(n,t){(function(e,i){n.exports=i()})(We,function(){return function(i){for(var s={command:/\s*([achlmqstvz])/gi,number:/\s*([+-]?\d*\.?\d+(?:e[+-]?\d+)?)/gi,comma:/\s*(?:(,)|\s)/g,flag:/\s*([01])/g},r={number:function(g){return+d("number",g)},"coordinate pair":function(g){var m=d("number",g);if(m===null&&!g)return null;d("comma");var S=d("number",!0);return{x:+m,y:+S}},"arc definition":function(g){var m=r["coordinate pair"](g);if(!m&&!g)return null;d("comma");var S=+d("number",!0);d("comma",!0);var b=!!+d("flag",!0);d("comma");var y=!!+d("flag",!0);d("comma");var x=r["coordinate pair"](!0);return{radii:m,rotation:S,large:b,clockwise:y,end:x}}},o=0,a=[];o<i.length;){var l=d("command"),h=l.toUpperCase(),c=l!==h,u;switch(h){case"M":u=p("coordinate pair").map(function(g,m){return m===1&&(l=c?"l":"L"),f({end:g})});break;case"L":case"T":u=p("coordinate pair").map(function(g){return f({end:g})});break;case"C":if(u=p("coordinate pair"),u.length%3)throw Error("Expected coordinate pair triplet at position "+o);u=u.reduce(function(g,m,S){var b=S%3;if(!b)g.push(f({cp1:m}));else{var y=g[g.length-1];y[b===1?"cp2":"end"]=m}return g},[]);break;case"Q":case"S":if(u=p("coordinate pair"),u.length&1)throw Error("Expected coordinate pair couple at position "+o);u=u.reduce(function(g,m,S){var b=S&1;if(!b)g.push(f({cp:m}));else{var y=g[g.length-1];y.end=m}return g},[]);break;case"H":case"V":u=p("number").map(function(g){return f({value:g})});break;case"A":u=p("arc definition").map(f);break;case"Z":u=[{code:"Z"}];break}a.push.apply(a,u)}return a;function f(g){return g.code=l,g.relative=c,g}function d(g,m){s[g].lastIndex=o;var S=s[g].exec(i);if(!S||S.index!==o){if(!m)return null;throw Error("Expected "+g+" at position "+o)}return o=s[g].lastIndex,S[1]}function p(g){for(var m=[],S,b=!0;S=r[g](b);)m.push(S),b=!!d("comma");return m}}})})(nl);var Iu=nl.exports;class ku extends sl{recursiveUpdate(t,e,i,s){const r=t.getBBox(),o=r.y/_t,a=r.height/_t+o,[l,h]=s;if(o<e.top||a>e.bottom)switch(t.tagName.toLowerCase()){case"g":for(const f of t.children)this.recursiveUpdate(f,e,i,s);break;case"circle":case"rect":case"line":case"path":let c=Math.floor((r.x-i.x)/_t*this.mRules.SamplingUnit);const u=c+Math.ceil(r.width/_t*this.mRules.SamplingUnit);if(t.parentElement.classList.contains("vf-beams")&&t.hasAttribute("d")){const f=Iu(t.getAttribute("d"));if(f.length===5){const d=f[0],p=f[3],g=(p.end.y-d.end.y)/(p.end.x-d.end.x);let m=d.end.y/_t;for(c;c<=u;c++)m<l[c]&&(l[c]=m),m>h[c]&&(h[c]=m),m+=g/this.mRules.SamplingUnit}}else for(c;c<=u;c++)o<l[c]&&(l[c]=o),a>h[c]&&(h[c]=a);break}}calculateLinesForMeasure(t,e){var T,E,C;const i=e.getBBox(),s=Math.max(Math.round(t.PositionAndShape.Size.width*this.mRules.SamplingUnit),1),r=i.height/_t,a=e.getElementsByClassName("vf-stave")[0].getBBox();let l=(a==null?void 0:a.height)/_t,h=(a==null?void 0:a.y)/_t;const c=t.getVFStave();let u=((T=c.options)!=null&&T.num_lines?c.options.num_lines:5)-1,f=-1,d=0;const p=[u];for(const P of(E=c.options)==null?void 0:E.line_config)P.visible?(f===-1&&(f=d),p.push(d)):u--,d++;const g=p.pop();f===-1&&(f=0),u=g-f;const m=(C=c.options)==null?void 0:C.spacing_between_lines_px,S=u*m/_t;l-S>.2&&(l=S,h=f*m/_t);const b=h+l,y=new Array(s).fill(h),x=new Array(s).fill(b),w=[y,x];if(r>l)for(const P of e.children)this.recursiveUpdate(P,{top:h,bottom:b},i,[y,x]);return w}calculateLines(){this.mSkyLine=[],this.mBottomLine=[];const t=document.createElement("div");document.body.append(t);const e=new Rr(this.mRules);e.initialize(t,1,"0");const i=e.getContext(),s=i.openGroup();s.classList.add("staffline");for(const r of this.StaffLineParent.Measures){r.PositionAndShape.calculateAbsolutePositionsRecursive(0,0),r.setAbsoluteCoordinates(r.PositionAndShape.AbsolutePosition.x*_t,r.PositionAndShape.AbsolutePosition.y*_t);const o=r.draw(i),[a,l]=this.calculateLinesForMeasure(r,o);this.mSkyLine.push(...a),this.mBottomLine.push(...l)}i.closeGroup();for(const r of s.getElementsByClassName("vf-ties"))for(const o of r.childNodes)if(o.nodeName.toLowerCase()==="path"){const a=o.getBBox();let l=Math.floor(a.x/_t*this.mRules.SamplingUnit);const h=l+Math.ceil(a.width/_t*this.mRules.SamplingUnit),c=a.y/_t,u=a.height/_t+c;for(l;l<=h;l++)c<this.mSkyLine[l]&&(this.mSkyLine[l]=c),u>this.mBottomLine[l]&&(this.mBottomLine[l]=u)}e.clear(),t.remove()}}const Bu=M.Flow;class Du{constructor(){this.hasBBox=!1,document.createElementNS("http://www.w3.org/2000/svg","g").getBBox!==void 0&&(this.hasBBox=!0)}createMusicSystem(t,e){return new gu(t,e)}createStaffLine(t,e){return new Pu(t,e)}createSkyBottomLineCalculator(t){return t.ParentMusicSystem.rules.PerformanceMode&&this.hasBBox?new ku(t):new sl(t)}createGraphicalMeasure(t,e,i=!1){return new Es(e,t,void 0)}createMultiRestMeasure(t,e,i){return new Tu(e,t,i)}createTabStaffMeasure(t,e){return new wu(e,t)}createExtraGraphicalMeasure(t){const e=new Es(t.ParentStaff,void 0,t);return e.IsExtraGraphicalMeasure=!0,e.ExtraGraphicalMeasurePreviousMeasure=t.Measures.last(),e}createStaffEntry(t,e){return new vu(e,t,void 0)}createVoiceEntry(t,e){return new $a(t,e)}createNote(t,e,i,s=oe.NONE,r,o=void 0){return new Bn(t,e,i,s,r,o)}createGraceNote(t,e,i,s,r=oe.NONE){return new Bn(t,e,i,r,s)}addGraphicalAccidental(t,e){t.setAccidental(e)}addFermataAtTiedEndNote(t,e){}createInStaffClef(t,e){const i=t,s=Yt.Clef(e,"small");i.vfClefBefore=new Bu.ClefNote(s.type,s.size,s.annotation)}createChordSymbols(t,e,i,s){const r=e.parentMeasure.parentSourceMeasure.Rules;let o=0;const a=r.ChordSymbolXSpacing;for(const l of t.ChordContainers){const h=new _u(l,e.PositionAndShape,r.ChordSymbolTextHeight,i,s,e.parentMeasure.parentSourceMeasure.Rules),c=h.GraphicalLabel;c.PositionAndShape.RelativePosition.y-=r.ChordSymbolYOffset,c.PositionAndShape.RelativePosition.x+=o,c.setLabelPositionAndShapeBorders(),h.PositionAndShape.calculateBoundingBox(),e.graphicalChordContainers.push(h),o+=c.PositionAndShape.Size.width+a}}createGraphicalTechnicalInstruction(t,e){}}class Fu{constructor(t,e=void 0,i=void 0){this.tie=t,this.startNote=e,this.endNote=i}get SVGElement(){return this.vfTie.getAttribute("el")}get GetTie(){return this.tie}get StartNote(){return this.startNote}get Tie(){return this.tie}set StartNote(t){this.startNote=t}get EndNote(){return this.endNote}set EndNote(t){this.endNote=t}}class Yi{constructor(t,e,i,s){this.lyricsEntry=t,this.graphicalStaffEntry=e;const r=e.parentMeasure.parentSourceMeasure.Rules.LyricsAlignmentStandard;t.Text.length>=4&&t.Parent.Notes[0].Length.Denominator>4&&vt.LeftBottom;const o=new jt(t.Text);this.graphicalLabel=new Se(o,i,r,this.graphicalStaffEntry.parentMeasure.parentSourceMeasure.Rules,e.PositionAndShape),this.graphicalLabel.PositionAndShape.RelativePosition=new O(0,s),r===vt.LeftBottom&&(this.graphicalLabel.PositionAndShape.RelativePosition.x-=1)}get LyricsEntry(){return this.lyricsEntry}get ParentLyricWord(){return this.graphicalLyricWord}set ParentLyricWord(t){this.graphicalLyricWord=t}get GraphicalLabel(){return this.graphicalLabel}set GraphicalLabel(t){this.graphicalLabel=t}get StaffEntryParent(){return this.graphicalStaffEntry}set StaffEntryParent(t){this.graphicalStaffEntry=t}}class Ou{constructor(t){this.graphicalLyricsEntries=[],this.lyricWord=t,this.initialize()}get GetLyricWord(){return this.lyricWord}get GraphicalLyricsEntries(){return this.graphicalLyricsEntries}set GraphicalLyricsEntries(t){this.graphicalLyricsEntries=t}isFilled(){for(let t=0;t<this.graphicalLyricsEntries.length;t++)if(!this.graphicalLyricsEntries[t])return!1;return!0}initialize(){for(let t=0;t<this.lyricWord.Syllables.length;t++)this.graphicalLyricsEntries.push(void 0)}}const re=class{constructor(){re.tPow3=new Array(re.bezierCurveStepSize),re.oneMinusTPow3=new Array(re.bezierCurveStepSize),re.bezierFactorOne=new Array(re.bezierCurveStepSize),re.bezierFactorTwo=new Array(re.bezierCurveStepSize);for(let n=0;n<re.bezierCurveStepSize;n++){const t=n/re.bezierCurveStepSize;re.tPow3[n]=Math.pow(t,3),re.oneMinusTPow3[n]=Math.pow(1-t,3),re.bezierFactorOne[n]=3*Math.pow(1-t,2)*t,re.bezierFactorTwo[n]=3*(1-t)*Math.pow(t,2)}}calculateCurvePointAtIndex(n){const t=Math.round(n*re.bezierCurveStepSize);return t<0||t>=re.bezierCurveStepSize?new O:new O(re.oneMinusTPow3[t]*this.bezierStartPt.x+re.bezierFactorOne[t]*this.bezierStartControlPt.x+re.bezierFactorTwo[t]*this.bezierEndControlPt.x+re.tPow3[t]*this.bezierEndPt.x,re.oneMinusTPow3[t]*this.bezierStartPt.y+re.bezierFactorOne[t]*this.bezierStartControlPt.y+re.bezierFactorTwo[t]*this.bezierEndControlPt.y+re.tPow3[t]*this.bezierEndPt.y)}};let rl=re;rl.bezierCurveStepSize=1e3;const qi=class extends rl{constructor(n,t){super(),this.staffEntries=[],this.slur=n,this.rules=t}static Compare(n,t){if(n.staffEntries.length<1)return-1;if(t.staffEntries.length<1)return 1;const e=W.minus(n.staffEntries[n.staffEntries.length-1].getAbsoluteTimestamp(),n.staffEntries[0].getAbsoluteTimestamp()),i=W.minus(t.staffEntries[t.staffEntries.length-1].getAbsoluteTimestamp(),t.staffEntries[0].getAbsoluteTimestamp());return e.RealValue>i.RealValue?1:i.RealValue>e.RealValue?-1:0}calculateCurve(n){const t=this.staffEntries[0],e=this.staffEntries[this.staffEntries.length-1];let i=t.findGraphicalNoteFromNote(this.slur.StartNote);!i&&this.graceStart&&(i=t.findGraphicalNoteFromGraceNote(this.slur.StartNote)),i||(i=t.findEndTieGraphicalNoteFromNoteWithStartingSlur(this.slur.StartNote,this.slur));let s=e.findGraphicalNoteFromNote(this.slur.EndNote);!s&&this.graceEnd&&(s=e.findGraphicalNoteFromGraceNote(this.slur.EndNote));const r=t.parentMeasure.ParentStaffLine,o=r.SkyBottomLineCalculator;this.calculatePlacement(o,r);const a=this.calculateStartAndEnd(i,s,r,n,o),l=a.startX,h=a.endX;let c=a.startY,u=a.endY;const f=n.SlurTangentMinAngle,d=n.SlurTangentMaxAngle;let p;if(this.placement===z.Above){c-=n.SlurNoteHeadYOffset,u-=n.SlurNoteHeadYOffset;const g=new O(this.staffEntries[0].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[0].PositionAndShape.RelativePosition.x,c);i?g.x+=this.staffEntries[0].PositionAndShape.BorderRight:g.x=this.staffEntries[0].parentMeasure.beginInstructionsWidth,this.graceStart&&(g.x+=e.PositionAndShape.RelativePosition.x);const m=new O(this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].PositionAndShape.RelativePosition.x,u);if(s?m.x+=this.staffEntries[this.staffEntries.length-1].PositionAndShape.BorderLeft:m.x=this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.Size.width,this.graceEnd&&(m.x+=e.staffEntryParent.PositionAndShape.RelativePosition.x),p=this.calculateTopPoints(g,m,r,o),p.length===0){const ct=new O((m.x-g.x)/2+g.x,(m.y-g.y)/2+g.y);p.push(ct)}const S=Math.atan((u-c)/(h-l)),b=new O(0,0);let y=new O(h-l,-(u-c));const x=js.getRotationMatrix(S),w=x.getTransposeMatrix();y=x.vectorMultiplication(y);const T=this.calculateTranslatedAndRotatedPointListAbove(p,l,c,x);let E=this.calculateMaxLeftSlope(T,b,y),C=this.calculateMaxRightSlope(T,b,y);const P=b.y-b.x*E,I=y.y-y.x*C,F=new O;let L=!1;Math.abs(Math.abs(E)-Math.abs(C))<1e-4?(F.x=y.x/2,F.y=0,L=!0):(F.x=(I-P)/(E-C),F.y=E*F.x+P);const k=this.calculateHeightWidthRatio(y.x,T);let v=0,G=0;if(Math.abs(k)>.001){const ct=Math.abs(E/(k*2)),Nt=Math.abs(E);v=Math.max(0,Nt*(Math.min(10,ct-1)/10)),E-=v;const pt=Math.abs(C/(k*2)),dt=Math.abs(C);G=Math.max(0,dt*(Math.min(10,pt-1)/10)),C+=G}let et=f,H=-f;if(!L){const ct=this.calculateAngles(f,E,C,d);et=ct.startAngle,H=ct.endAngle}const nt=this.calculateControlPoints(y.x,et,H,T,k,c,u);let K=nt.startControlPoint,lt=nt.endControlPoint;K=w.vectorMultiplication(K),K.x+=l,K.y=-K.y+c,lt=w.vectorMultiplication(lt),lt.x+=l,lt.y=-lt.y+c,this.bezierStartPt=new O(l,c-v),this.bezierStartControlPt=new O(K.x,K.y-v),this.bezierEndControlPt=new O(lt.x,lt.y-G),this.bezierEndPt=new O(h,u-G);const A=r.SkyLine.length,B=o.getLeftIndexForPointX(this.bezierStartPt.x,A),ot=o.getLeftIndexForPointX(this.bezierEndPt.x,A),rt=this.bezierEndPt.x-this.bezierStartPt.x,J=o.SamplingUnit;for(let ct=B;ct<ot;ct++){const Nt=ct/J-this.bezierStartPt.x,pt=this.calculateCurvePointAtIndex(Math.abs(Nt)/rt);let dt=o.getLeftIndexForPointX(pt.x,A);dt>=B&&(r.SkyLine[dt]=Math.min(r.SkyLine[dt],pt.y)),dt++,dt<A&&(r.SkyLine[dt]=Math.min(r.SkyLine[dt],pt.y))}}else{c+=n.SlurNoteHeadYOffset,u+=n.SlurNoteHeadYOffset;const g=new O(this.staffEntries[0].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[0].PositionAndShape.RelativePosition.x,c);i?g.x+=this.staffEntries[0].PositionAndShape.BorderRight:g.x=this.staffEntries[0].parentMeasure.beginInstructionsWidth,this.graceStart&&(g.x+=e.PositionAndShape.RelativePosition.x);const m=new O(this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].PositionAndShape.RelativePosition.x,u);if(s?m.x+=this.staffEntries[this.staffEntries.length-1].PositionAndShape.BorderLeft:m.x=this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.Size.width,this.graceEnd&&(m.x+=e.staffEntryParent.PositionAndShape.RelativePosition.x),p=this.calculateBottomPoints(g,m,r,o),p.length===0){const ct=new O((m.x-g.x)/2+g.x,(m.y-g.y)/2+g.y);p.push(ct)}const S=Math.atan((u-c)/(h-l)),b=new O(0,0);let y=new O(h-l,u-c);const x=js.getRotationMatrix(-S),w=x.getTransposeMatrix();y=x.vectorMultiplication(y);const T=this.calculateTranslatedAndRotatedPointListBelow(p,l,c,x);let E=this.calculateMaxLeftSlope(T,b,y),C=this.calculateMaxRightSlope(T,b,y);const P=b.y-b.x*E,I=y.y-y.x*C,F=new O;let L=!1;Math.abs(Math.abs(E)-Math.abs(C))<1e-4?(F.x=y.x/2,F.y=0,L=!0):(F.x=(I-P)/(E-C),F.y=E*F.x+P);const k=this.calculateHeightWidthRatio(y.x,T);let v=0,G=0;if(Math.abs(k)>.001){const ct=Math.abs(E/(k*2)),Nt=Math.abs(E);v=Math.max(0,Nt*(Math.min(10,ct-1)/10)),E-=v;const pt=Math.abs(C/(k*2)),dt=Math.abs(C);G=Math.max(0,dt*(Math.min(10,pt-1)/10)),C+=G}let et=f,H=-f;if(!L){const ct=this.calculateAngles(f,E,C,d);et=ct.startAngle,H=ct.endAngle}const nt=this.calculateControlPoints(y.x,et,H,T,k,c,u);let K=nt.startControlPoint,lt=nt.endControlPoint;K=w.vectorMultiplication(K),K.x+=l,K.y+=c,lt=w.vectorMultiplication(lt),lt.x+=l,lt.y+=c,this.bezierStartPt=new O(l,c+v),this.bezierStartControlPt=new O(K.x,K.y+v),this.bezierEndControlPt=new O(lt.x,lt.y+G),this.bezierEndPt=new O(h,u+G);const A=r.BottomLine.length,B=o.getLeftIndexForPointX(this.bezierStartPt.x,A),ot=o.getLeftIndexForPointX(this.bezierEndPt.x,A),rt=this.bezierEndPt.x-this.bezierStartPt.x,J=o.SamplingUnit;for(let ct=B;ct<ot;ct++){const Nt=ct/J-this.bezierStartPt.x,pt=this.calculateCurvePointAtIndex(Math.abs(Nt)/rt);let dt=o.getLeftIndexForPointX(pt.x,A);dt>=B&&(r.BottomLine[dt]=Math.max(r.BottomLine[dt],pt.y)),dt++,dt<A&&(r.BottomLine[dt]=Math.max(r.BottomLine[dt],pt.y))}}}calculateStartAndEnd(n,t,e,i,s){let r=0,o=0,a=0,l=0;if(n){r=n.PositionAndShape.RelativePosition.x+n.parentVoiceEntry.parentStaffEntry.PositionAndShape.RelativePosition.x+n.parentVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x,this.graceStart&&(r+=n.parentVoiceEntry.parentStaffEntry.staffEntryParent.PositionAndShape.RelativePosition.x);const h=n.parentVoiceEntry;this.placement===z.Above?o=h.PositionAndShape.RelativePosition.y+h.PositionAndShape.BorderTop:o=h.PositionAndShape.RelativePosition.y+h.PositionAndShape.BorderBottom,h.parentVoiceEntry.StemDirection===Ft.Down&&this.placement===z.Below&&(r-=.5),h.parentVoiceEntry.StemDirection===Ft.Up&&this.placement===z.Above&&(r+=.5)}else r=0;if(t){a=t.PositionAndShape.RelativePosition.x+t.parentVoiceEntry.parentStaffEntry.PositionAndShape.RelativePosition.x+t.parentVoiceEntry.parentStaffEntry.parentMeasure.PositionAndShape.RelativePosition.x,this.graceEnd&&(a+=t.parentVoiceEntry.parentStaffEntry.staffEntryParent.PositionAndShape.RelativePosition.x);const h=t.parentVoiceEntry;this.placement===z.Above?l=h.PositionAndShape.RelativePosition.y+h.PositionAndShape.BorderTop:l=h.PositionAndShape.RelativePosition.y+h.PositionAndShape.BorderBottom,h.parentVoiceEntry.StemDirection===Ft.Down&&this.placement===z.Below&&(a-=.5),h.parentVoiceEntry.StemDirection===Ft.Up&&this.placement===z.Above&&(a+=.5)}else a=e.PositionAndShape.Size.width;return!n&&!t&&(o=-1.5,l=-1.5),n||(this.placement===z.Above?o=l-1:o=l+1),t||(this.placement===z.Above?l=o-1:l=o+1),this.slur.startNoteHasMoreStartingSlurs()&&this.slur.isSlurLonger()&&(this.placement===z.Above?o-=i.SlursStartingAtSameStaffEntryYOffset:o+=i.SlursStartingAtSameStaffEntryYOffset),this.slur.endNoteHasMoreEndingSlurs()&&this.slur.isSlurLonger()&&(this.placement===z.Above?l-=i.SlursStartingAtSameStaffEntryYOffset:l+=i.SlursStartingAtSameStaffEntryYOffset),this.placement===z.Above?(o=Math.min(o,1.5),l=Math.min(l,1.5)):(o=Math.max(o,e.StaffHeight-1.5),l=Math.max(l,e.StaffHeight-1.5)),{startX:r,startY:o,endX:a,endY:l}}calculatePlacement(n,t){if(this.rules.SlurPlacementFromXML){this.placement=this.slur.PlacementXml;return}for(let o=0,a=this.staffEntries.length;o<a;++o)if(this.staffEntries[o].parentMeasure.hasMultipleVoices()){this.slur.StartNote.ParentVoiceEntry.ParentVoice instanceof bs||this.slur.EndNote.ParentVoiceEntry.ParentVoice instanceof bs?this.placement=z.Below:this.placement=z.Above;return}for(let o=0,a=this.staffEntries.length;o<a;++o)if(this.staffEntries[o].LyricsEntries.length>0){this.placement=z.Above;return}const e=this.staffEntries[0],i=this.staffEntries[this.staffEntries.length-1],s=e.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection,r=i.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection;if(s===r)this.placement=s===Ft.Up?z.Below:z.Above;else{let o=e.PositionAndShape.BorderLeft+e.PositionAndShape.RelativePosition.x+e.parentMeasure.PositionAndShape.RelativePosition.x,a=i.PositionAndShape.BorderRight+i.PositionAndShape.RelativePosition.x+i.parentMeasure.PositionAndShape.RelativePosition.x;this.graceStart&&(o+=i.PositionAndShape.RelativePosition.x),this.graceEnd&&(a+=i.staffEntryParent.PositionAndShape.RelativePosition.x);const l=n.getSkyLineMinInRange(o,a)*-1;n.getBottomLineMaxInRange(o,a)-t.StaffHeight>l?this.placement=z.Above:this.placement=z.Below}}calculateTopPoints(n,t,e,i){const s=[];let r=i.getRightIndexForPointX(n.x,e.SkyLine.length),o=i.getLeftIndexForPointX(t.x,e.SkyLine.length);r<0&&(r=0),o>=e.SkyLine.length&&(o=e.SkyLine.length-1);for(let a=r;a<o;a++){const l=e.SkyLine[a];if(l!==0){const h=new O((.5+a)/i.SamplingUnit,l);s.push(h)}}return s}calculateBottomPoints(n,t,e,i){const s=[];let r=i.getRightIndexForPointX(n.x,e.BottomLine.length),o=i.getLeftIndexForPointX(t.x,e.BottomLine.length);r<0&&(r=0),o>=e.BottomLine.length&&(o=e.BottomLine.length-1);for(let a=r;a<o;a++){const l=e.BottomLine[a];if(l!==0){const h=new O((.5+a)/i.SamplingUnit,l);s.push(h)}}return s}calculateMaxLeftSlope(n,t,e){let i=-Number.MAX_VALUE;const s=t.x,r=t.y;for(let o=0;o<n.length;o++)Math.abs(n[o].y-Number.MAX_VALUE)<1e-4||Math.abs(n[o].y- -Number.MAX_VALUE)<1e-4||(i=Math.max(i,(n[o].y-r)/(n[o].x-s)));return i=Math.max(i,Math.abs(e.y-r)/(e.x-s)),i=Math.min(i,5.6713),i}calculateMaxRightSlope(n,t,e){let i=Number.MAX_VALUE;const s=e.x,r=e.y;for(let o=0;o<n.length;o++)Math.abs(n[o].y-Number.MAX_VALUE)<1e-4||Math.abs(n[o].y- -Number.MAX_VALUE)<1e-4||(i=Math.min(i,(r-n[o].y)/(s-n[o].x)));return i=Math.min(i,(r-t.y)/(s-t.x)),i=Math.max(i,-5.6713),i}getPointListMaxY(n){let t=-Number.MAX_VALUE;for(let e=0,i=n.length;e<i;++e){const s=n[e];Math.abs(s.y- -Number.MAX_VALUE)<1e-4||Math.abs(s.y-Number.MAX_VALUE)<1e-4||(t=Math.max(t,s.y))}return t}calculateTranslatedAndRotatedPointListAbove(n,t,e,i){const s=[];for(let r=0;r<n.length;r++){if(Math.abs(n[r].y-Number.MAX_VALUE)<1e-4||Math.abs(n[r].y- -Number.MAX_VALUE)<1e-4)continue;let o=new O(n[r].x-t,-(n[r].y-e));o=i.vectorMultiplication(o),s.push(o)}return s}calculateTranslatedAndRotatedPointListBelow(n,t,e,i){const s=[];for(let r=0;r<n.length;r++){if(Math.abs(n[r].y-Number.MAX_VALUE)<1e-4||Math.abs(n[r].y- -Number.MAX_VALUE)<1e-4)continue;let o=new O(n[r].x-t,n[r].y-e);o=i.vectorMultiplication(o),s.push(o)}return s}calculateHeightWidthRatio(n,t){return t.length===0?0:Math.max(0,this.getPointListMaxY(t))/n}calculateControlPoints(n,t,e,i,s,r,o){let a=this.rules.SlurHeightFactor,l=1;const h=this.rules.SlurHeightFlattenLongSlursCutoffAngle,c=this.rules.SlurHeightFlattenLongSlursCutoffWidth;t>h&&n>c&&(l+=n/70*this.rules.SlurHeightFlattenLongSlursFactorByWidth,l*=1+t/30*this.rules.SlurHeightFlattenLongSlursFactorByAngle,a/=l);const u=Math.min(.5,Math.max(.1,1.7*t/80*a*Math.pow(Math.max(s,.05),.4))),f=Math.min(.5,Math.max(.1,1.7*-e/80*a*Math.pow(Math.max(s,.05),.4))),d=new O;d.x=n*u*Math.cos(t*qi.degreesToRadiansFactor),d.y=n*u*Math.sin(t*qi.degreesToRadiansFactor);const p=new O;p.x=n-n*f*Math.cos(e*qi.degreesToRadiansFactor),p.y=-(n*f*Math.sin(e*qi.degreesToRadiansFactor));let g=d.y-p.y;for(;this.rules.SlurMaximumYControlPointDistance&&Math.abs(g)>this.rules.SlurMaximumYControlPointDistance;)g<0?(d.y+=1,p.y-=1):(d.y-=1,p.y+=1),g=d.y-p.y;return{startControlPoint:d,endControlPoint:p}}calculateAngles(n,t,e,i){let r=Math.atan(t)/qi.degreesToRadiansFactor;t>0?r+=20:r-=20;let o=Math.atan(e)/qi.degreesToRadiansFactor;e<0?o-=20:o+=20;const a=Math.min(Math.max(n,r),i),l=Math.max(Math.min(-n,o),-i);return{startAngle:a,endAngle:l}}};let En=qi;En.degreesToRadiansFactor=Math.PI/180;class Vu extends Pe{constructor(t,e){super(),this.getPedal=t,this.setSymbol(),this.PositionAndShape=new le(this,e)}setSymbol(){!this.getPedal.IsLine&&this.getPedal.IsSign?this.pedalSymbol=Ge.PEDAL_SYMBOL:this.getPedal.IsLine&&this.getPedal.IsSign?this.pedalSymbol=Ge.PEDAL_MIXED:this.pedalSymbol=Ge.PEDAL_BRACKET}}class br extends Vu{constructor(t,e,i=!1,s=!1){switch(super(t,e),this.vfStyle=M.Flow.PedalMarking.Styles.BRACKET,this.ChangeBegin=!1,this.ChangeEnd=!1,this.line=-3,this.EndSymbolPositionAndShape=void 0,this.ChangeBegin=t.ChangeBegin,this.ChangeEnd=t.ChangeEnd,this.pedalSymbol){case Ge.PEDAL_SYMBOL:this.vfStyle=M.Flow.PedalMarking.Styles.TEXT,this.EndSymbolPositionAndShape=new le(this,e);break;case Ge.PEDAL_MIXED:i&&s?this.vfStyle=M.Flow.PedalMarking.Styles.BRACKET_OPEN_BOTH:i?this.vfStyle=M.Flow.PedalMarking.Styles.BRACKET_OPEN_BEGIN:s?this.vfStyle=M.Flow.PedalMarking.Styles.MIXED_OPEN_END:this.vfStyle=M.Flow.PedalMarking.Styles.MIXED;break;case Ge.PEDAL_BRACKET:default:i&&s?this.vfStyle=M.Flow.PedalMarking.Styles.BRACKET_OPEN_BOTH:i?this.vfStyle=M.Flow.PedalMarking.Styles.BRACKET_OPEN_BEGIN:s?this.vfStyle=M.Flow.PedalMarking.Styles.BRACKET_OPEN_END:this.vfStyle=M.Flow.PedalMarking.Styles.BRACKET;break}}setStartNote(t){if(!t)return!1;for(const e of t.graphicalVoiceEntries){const i=e;if(i!=null&&i.vfStaveNote)return this.startNote=i.vfStaveNote,this.startVfVoiceEntry=i,!0}return!1}setEndNote(t){if(!t)return!1;for(const e of t.graphicalVoiceEntries){const i=e;if(i!=null&&i.vfStaveNote)return this.endNote=i.vfStaveNote,this.endVfVoiceEntry=i,!0}return!1}setEndMeasure(t){this.endMeasure=t}CalculateBoundingBox(){}setLine(t){this.line=t}getPedalMarking(){var e,i,s,r;const t=new M.Flow.PedalMarking([this.startNote,this.endNote]);return this.endMeasure&&t.setEndStave(this.endMeasure.getVFStave()),t.setStyle(this.vfStyle),t.setLine(this.line),t.setCustomText(this.DepressText,this.ReleaseText),(((e=this.endVfVoiceEntry)==null?void 0:e.parentStaffEntry)===((r=(s=(i=this.endVfVoiceEntry)==null?void 0:i.parentStaffEntry)==null?void 0:s.parentMeasure)==null?void 0:r.staffEntries.last())||!this.endVfVoiceEntry)&&(t.EndsStave=!0),t.ChangeBegin=this.ChangeBegin,t.ChangeEnd=this.ChangeEnd,t}}class Gu extends Pe{constructor(t,e){super(),this.getWavyLine=t,this.PositionAndShape=new le(this,e)}}class ra extends Gu{constructor(t,e,i=!1){super(t,e),this.line=1,this.isVibrato=!1,this.toEndOfStopStave=!1,this.isVibrato=i}get ToEndOfStopStave(){return this.toEndOfStopStave}setStartNote(t){for(const e of t.graphicalVoiceEntries){const i=e;if(i!=null&&i.vfStaveNote)return this.startNote=i.vfStaveNote,this.startVfVoiceEntry=i,!0}return!1}setEndNote(t){for(const e of t.graphicalVoiceEntries){const i=e;if(i!=null&&i.vfStaveNote){this.endNote=i.vfStaveNote,this.endVfVoiceEntry=i;const s=this.endVfVoiceEntry.parentStaffEntry.parentMeasure.staffEntries,r=s[s.length-1];return this.toEndOfStopStave=r===this.endVfVoiceEntry.parentStaffEntry,!0}}return!1}CalculateBoundingBox(){const t=this.getVibratoBracket();this.boundingBox.Size.height=t.render_options.wave_height*.2}getVibratoBracket(){const t=new M.Flow.VibratoBracket({start:this.startNote,stop:this.endNote,toEndOfStopStave:this.toEndOfStopStave});return t.setLine(this.line),this.isVibrato?t.render_options.vibrato_width=20:t.render_options.wave_girth=4,t}}const ji=M.Flow;class Sr extends Lt{constructor(t){var e,i,s,r,o,a,l,h;super(),this.beamsNeedUpdate=!1,this.rules=t,Lt.symbolFactory=new Du,Lt.TextMeasurer=new Xa(this.rules),Lt.stafflineNoteCalculator=new qs(this.rules),((e=this.rules.DefaultVexFlowNoteFont)==null?void 0:e.toLowerCase())==="gonville"?M.Flow.DEFAULT_FONT_STACK=[(i=M.Flow.Fonts)==null?void 0:i.Gonville,(s=M.Flow.Fonts)==null?void 0:s.Bravura,(r=M.Flow.Fonts)==null?void 0:r.Custom]:((o=this.rules.DefaultVexFlowNoteFont)==null?void 0:o.toLowerCase())==="petaluma"&&(M.Flow.DEFAULT_FONT_STACK=[(a=M.Flow.Fonts)==null?void 0:a.Petaluma,(l=M.Flow.Fonts)==null?void 0:l.Gonville,(h=M.Flow.Fonts)==null?void 0:h.Bravura])}clearRecreatedObjects(){super.clearRecreatedObjects(),Lt.stafflineNoteCalculator=new qs(this.rules);for(const t of this.graphicalMusicSheet.MeasureList)for(const e of t)e==null||e.clean()}formatMeasures(){for(const t of this.graphicalMusicSheet.MeasureList){if(!t||!t[0])continue;t[0].format();for(const i of t){for(const s of i.staffEntries)s.calculateXPosition();i.finalizeBeams()}}this.beamsNeedUpdate=!1}calculateMeasureXLayout(t){const e=[];for(const c of t)c&&e.push(c);if(e.length===0)return 0;t=e;const i=[],s=new ji.Formatter({softmaxFactor:this.rules.SoftmaxFactorVexFlow});let r=t[0].staffEntries.length,o=1;for(const c of t){if(!c)continue;let u=0;for(const p of c.staffEntries)u+=p.setMaxAccidentals();c.parentSourceMeasure.ImplicitMeasure&&(r=Math.max(c.staffEntries.length,r),o=Math.max(c.staffEntries.length+u,o));const f=c.vfVoices,d=[];for(const p in f)f.hasOwnProperty(p)&&(d.push(f[p]),i.push(f[p]));if(d.length===0){j.debug("Found a measure with no voices. Continuing anyway.",f);continue}s.joinVoices(d)}let a=12;const l=t[0].parentSourceMeasure,h=.3;if(i.length>0){a=s.preCalculateMinTotalWidth(i)/_t*this.rules.VoiceSpacingMultiplierVexflow+this.rules.VoiceSpacingAddendVexflow+r*h,l!=null&&l.ImplicitMeasure&&(a=l.Duration.RealValue/l.ActiveTimeSignature.RealValue*a,r>1&&(a+=o*h*1.5),a*=this.rules.PickupMeasureWidthMultiplier),Lt.setMeasuresMinStaffEntriesWidth(t,a);const c=(f,d)=>{s.formatToStave(i,d.getVFStave())},u=(f,d)=>{s.formatToStave(i,d.getVFStave(),{align_rests:!0,context:void 0})};for(const f of t){if(this.rules.AlignRests===Hs.Never)f.formatVoices=c;else if(this.rules.AlignRests===Hs.Always)f.formatVoices=u;else if(this.rules.AlignRests===Hs.Auto){let d=!1;for(const p of f.staffEntries){let g=0,m=0;for(const S of p.graphicalVoiceEntries)if(S.parentVoiceEntry.IsGrace||S&&S.notes&&S.notes[0]&&S.notes[0].sourceNote&&S.notes[0].sourceNote.PrintObject&&g++,S&&S.notes&&S.notes[0]&&S.notes[0].sourceNote&&S.notes[0].sourceNote.isRest()&&S.notes[0].sourceNote.PrintObject&&m++,g>1&&m>=1){d=!0;break}if(d)break}d?f.formatVoices=u:f.formatVoices=c}if(f===t[0]){const d=f;d.formatVoices(a*_t,d)}}}for(const c of t)if(!!c)for(const u of c.staffEntries)u.calculateXPosition();for(const c of t){if(!c)continue;const u=c.vfVoices,f=[];for(const d in u)u.hasOwnProperty(d)&&f.push(u[d]);if(f.length===0){j.debug("Found a measure with no voices. Continuing anyway.",u);continue}s.joinVoices(f)}return a}calculateElongationFactor(t,e,i,s,r,o,a,l){let h=r,c=0;for(const u of t){const f=u.GraphicalLabel.Label.textAlignment;let d=a,p=l;if(u instanceof Yi&&u.ParentLyricWord){u.LyricsEntry.SyllableIndex>0&&(d=this.rules.BetweenSyllableMinimumDistance,cr.IsCenterAligned(f)&&(d+=1));const L=u.ParentLyricWord.GetLyricWord.Syllables;L.length>1&&u.LyricsEntry.SyllableIndex<L.length-1&&(this.dashSpace===void 0&&(this.dashSpace=1.5),p-=this.dashSpace)}const g=u instanceof Yi?u.GraphicalLabel.PositionAndShape:u.PositionAndShape,m=g.Size.width,b=e.PositionAndShape.RelativePosition.x+g.BorderMarginLeft;i[c]!==void 0&&i[c].extend;let y,x;i[c]&&(x=b-i[c].xPosition);let w,T;const E=s*r;cr.IsCenterAligned(f)?(p/=4,w=E-b,T=m/2-p,i[c]&&(y=i[c].labelWidth/2+m/2+d)):cr.IsLeft(f)&&(w=E-b,T=m-p,i[c]&&(y=i[c].labelWidth+d));let C=1;const P=T/w;let I=1;if(u instanceof Yi&&u.LyricsEntry){if(i[c]){const L=i[c].sourceNoteDuration;I=y/x,L.Denominator>4&&(I*=1.1)}}else i[c]&&(I=y/x);C=Math.max(P,I),h=Math.max(h,C);let F=Math.max(y-x||0,0);i[c]&&(F+=i[c].cumulativeOverlap),i[c]={cumulativeOverlap:F,extend:u instanceof Yi?u.LyricsEntry.extend:!1,labelWidth:m,measureNumber:o,sourceNoteDuration:u instanceof Yi?u.LyricsEntry&&u.LyricsEntry.Parent.Notes[0].Length:!1,text:u instanceof Yi?u.LyricsEntry.Text:u.GraphicalLabel.Label.text,xPosition:b},c++}return h}calculateElongationFactorFromStaffEntries(t,e,i,s){let r=i;const o={},a={};for(const l of t)l.LyricsEntries.length>0&&(r=this.calculateElongationFactor(l.LyricsEntries,l,o,e,r,s,this.rules.HorizontalBetweenLyricsDistance,this.rules.LyricOverlapAllowedIntoNextMeasure)),l.graphicalChordContainers.length>0&&(r=this.calculateElongationFactor(l.graphicalChordContainers,l,a,e,r,s,this.rules.ChordSymbolXSpacing,this.rules.ChordOverlapAllowedIntoNextMeasure));return r}calculateMeasureWidthFromStaffEntries(t,e){let i=1;for(const r of t)!r||r.staffEntries.length===0||(i=this.calculateElongationFactorFromStaffEntries(r.staffEntries,e,i,r.MeasureNumber));return i=Math.min(i,this.rules.MaximumLyricsElongationFactor),e*i}createGraphicalTie(t,e,i,s,r){return new Fu(t,s,r)}updateStaffLineBorders(t){t.SkyBottomLineCalculator.updateStaffLineBorders()}graphicalMeasureCreatedCalculations(t){t.rules=this.rules,t.graphicalMeasureCreatedCalculations()}layoutVoiceEntry(t,e,i,s){for(let r=0;r<e.length;r++)e[r]=Lt.stafflineNoteCalculator.positionNote(e[r])}layoutStaffEntry(t){t.parentMeasure.layoutStaffEntry(t)}initGraphicalMeasuresCreation(){}layoutArticulationMarks(t,e,i){}layoutGraphicalTie(t,e,i){const s=t.StartNote,r=t.EndNote;let o,a=0;s&&s.vfnote&&s.vfnote.length>=2&&(o=s.vfnote[0],a=s.vfnote[1]);let l,h=0;if(r&&r.vfnote&&r.vfnote.length>=2&&(l=r.vfnote[0],h=r.vfnote[1]),e){if(o){const c=new ji.StaveTie({first_indices:[a],first_note:o});s.parentVoiceEntry.parentStaffEntry.parentMeasure.addStaveTie(c,t)}if(l){const c=new ji.StaveTie({last_indices:[h],last_note:l});r.parentVoiceEntry.parentStaffEntry.parentMeasure.addStaveTie(c,t)}}else if(o||l){let c;if(i)if(t.Tie.Type==="S"){const f=t.StartNote.sourceNote,d=t.EndNote.sourceNote;let p=1;f.FretNumber>d.FretNumber&&(p=-1),c=new ji.TabSlide({first_indices:[a],first_note:o,last_indices:[h],last_note:l},p)}else c=new ji.TabTie({first_indices:[a],first_note:o,last_indices:[h],last_note:l},t.Tie.Type);else{c=new ji.StaveTie({first_indices:[a],first_note:o,last_indices:[h],last_note:l});const f=t.Tie.getTieDirection(s.sourceNote);f===z.Below?c.setDirection(1):f===z.Above&&c.setDirection(-1);try{Math.abs((o==null?void 0:o.getTieRightX())-(l==null?void 0:l.getTieLeftX()))<10&&(c.render_options.first_x_shift=-3,c.render_options.last_x_shift=3)}catch(d){console.log(d)}}r.parentVoiceEntry.parentStaffEntry.parentMeasure.addStaveTie(c,t)}}calculateDynamicExpressionsForMultiExpression(t,e,i){if(e<this.rules.MinMeasureToDrawIndex||e>this.rules.MaxMeasureToDrawIndex)return;const s=t.AbsoluteTimestamp,r=this.graphicalMusicSheet.MeasureList[e],o=r[i].ParentStaffLine,a=r[i];if(!o)return;const l=this.getRelativePositionInStaffLineFromTimestamp(s,i,o,o==null?void 0:o.isPartOfMultiStaffInstrument());if(l.x<=0&&(l.x=a.beginInstructionsWidth+this.rules.RhythmRightMargin),t.InstantaneousDynamic){const h=new Nu(t.InstantaneousDynamic,o,a);this.calculateGraphicalInstantaneousDynamicExpression(h,l,s),this.dynamicExpressionMap.set(s.RealValue,h.PositionAndShape)}if(t.StartingContinuousDynamic){const h=t.StartingContinuousDynamic,c=new tl(t.StartingContinuousDynamic,o,a.parentSourceMeasure);if(c.StartMeasure=a,!c.IsVerbal&&h.EndMultiExpression)try{this.calculateGraphicalContinuousDynamic(c,l),c.updateSkyBottomLine()}catch{}else c.IsVerbal?this.calculateGraphicalVerbalContinuousDynamic(c,l):j.warn("This continuous dynamic is not covered. measure"+t.SourceMeasureParent.MeasureNumber)}}createMetronomeMark(t,e){var b,y,x,w,T,E,C,P,I;const i=Math.max(t.ParentMultiTempoExpression.SourceMeasureParent.MeasureNumber-1,0),s=e||i,r=Math.max(t.StaffNumber-1,0),o=this.graphicalMusicSheet.MeasureList[s][r].getVFStave();let a="q";if(t.beatUnit){const F=ws.getNoteDurationFromType(t.beatUnit);a=Yt.durations(F,!1)[0]}let l=this.rules.MetronomeMarkYShift,h=!1;const c=[];if(t.parentMeasure){for(const F of t.parentMeasure.StaffLinkedExpressions)for(const L of F)L&&L instanceof ms&&c.push(L);for(const F of t.parentMeasure.TempoExpressions){const L=((b=F.InstantaneousTempo)==null?void 0:b.Enum)===bt.metronomeMark;if(!t.beatUnit&&F.InstantaneousTempo.beatUnit){const k=ws.getNoteDurationFromType(t.beatUnit);a=Yt.durations(k,!1)[0]}if(F.getPlacementOfFirstEntry()===z.Above&&!L){h=!0;break}}}h&&(l-=1.4);const u=(y=this.graphicalMusicSheet.MeasureList[0][0].ParentStaffLine)==null?void 0:y.SkyLine;let f=t.TempoInBpm,d="",p="",g="";for(const F of this.graphicalMusicSheet.MeasureList[s][r].parentSourceMeasure.TempoExpressions){if(p=F.CombinedExpressionsText,Ha(F.CombinedExpressionsText)){d=F.CombinedExpressionsText;break}if(ps(F.CombinedExpressionsText)||An(F.CombinedExpressionsText)){d=eu(F.CombinedExpressionsText),f=F.sourceMeasure.TempoInBPM,ps(F.CombinedExpressionsText)&&(g=a);break}}const m={bpm:t.TempoInBpm,dots:t.dotted,duration:a,name:d};d&&(m.bpm=f/(m.dots?1.5:1),ps(p)?m.duration=g:(f===Lr[d]||!Lr[d])&&(m.duration=""));const S=((w=(x=this.graphicalMusicSheet.MeasureList[s][r].vfVoices)==null?void 0:x[1])==null?void 0:w.boundingBox.y)||0;if(this.rules.MetronomeMarksDrawn){if(u){const v=((E=(T=this.graphicalMusicSheet.MeasureList[0])==null?void 0:T[r])==null?void 0:E.ParentStaffLine).Measures.map(G=>G.MeasureNumber-1);if(S&&v.includes(s)&&(ps(p)||An(p))){const G=u.slice(0,9);let et=Math.min(...G);et=et<0?et-1:et,l+=et}v.includes(s)&&c.length?u[0]=Math.min(u[0],-4.5+l-4):u[0]=Math.min(u[0],-4.5+l)}o.options.line_config.reduce((k,v)=>(v.visible&&k++,k),0)<5&&(l-=2),o.setTempo(m,l*_t);let L=0;try{L+=((I=(P=(C=this.graphicalMusicSheet.MeasureList[s][r])==null?void 0:C.vfVoices)==null?void 0:P[1])==null?void 0:I.getTickables())[t.parentMeasure.metronomeNoteIndex].getBoundingBox().getX()-o.getNoteStartX()}catch{}o.getModifiers()[o.getModifiers().length-1].setShiftX(L)}}calculateRehearsalMark(t){var f,d,p,g,m;const e=t.rehearsalExpression;if(!e)return;const i=this.graphicalMusicSheet.MeasureList[0][0].MeasureNumber,s=Math.max(t.measureListIndex+1-i,0),r=0,o=(f=this.graphicalMusicSheet.MeasureList[s][r])==null?void 0:f.getVFStave();if(!o)return;const a=-this.rules.RehearsalMarkYOffsetDefault-this.rules.RehearsalMarkYOffset;let l=this.rules.RehearsalMarkXOffsetDefault+this.rules.RehearsalMarkXOffset;t.IsSystemStartMeasure&&(l+=this.rules.RehearsalMarkXOffsetSystemStartMeasure);const h=this.rules.RehearsalMarkFontSize,c=o.getModifiers(),u=c.find(S=>S.getCategory().toLocaleLowerCase()==="repetitions");if(u&&u.setShiftY(u.y_shift-10),o.setSection(e.label,a,l,h),(d=this.graphicalMusicSheet.MeasureList[s][r])!=null&&d.ParentStaffLine.AbstractExpressions){const S=c.find(b=>b.getCategory().toLocaleLowerCase()==="stavesection");for(let b of((m=(g=(p=t==null?void 0:t.VerticalMeasureList)==null?void 0:p[0])==null?void 0:g.ParentStaffLine)==null?void 0:m.AbstractExpressions)||[])b instanceof Us&&(S&&(b.Label.PositionAndShape.RelativePosition.y-=.5),u&&(b.Label.PositionAndShape.RelativePosition.y-=1.7))}}calculateSingleOctaveShift(t,e,i,s){var p;const r=e.OctaveShiftStart,o=r.ParentStartMultiExpression.Timestamp,a=(p=r.ParentEndMultiExpression)==null?void 0:p.Timestamp,l=this.rules.MinMeasureToDrawIndex,h=this.rules.MaxMeasureToDrawIndex;let c=this.graphicalMusicSheet.MeasureList[i][s].ParentStaffLine;c||(c=this.graphicalMusicSheet.MeasureList[l][s].ParentStaffLine);let u;r.ParentEndMultiExpression?u=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(r.ParentEndMultiExpression.SourceMeasureParent,s):u=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(s,!0),u.MeasureNumber>h+1&&(u=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(s,!0));let f;if(r.ParentEndMultiExpression?f=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(r.ParentStartMultiExpression.SourceMeasureParent,s):f=this.graphicalMusicSheet.MeasureList[l][s],f.MeasureNumber<l+1&&(f=this.graphicalMusicSheet.MeasureList[l][s]),f.parentSourceMeasure.measureListIndex<l||f.parentSourceMeasure.measureListIndex>h||u.parentSourceMeasure.measureListIndex<l||u.parentSourceMeasure.measureListIndex>h)return;let d=u.ParentStaffLine;if(d||(d=c),u&&c&&d){const g=new na(r,c.PositionAndShape);if(!g.startNote){let b;for(const y of f.staffEntries)if(y){b=y;break}if(!b||(g.setStartNote(b),!g.startNote))return}if(!g.endNote){let b;for(let y=u.staffEntries.length-1;y>=0;y++)if(u.staffEntries[y]){b=u.staffEntries[y];break}if(g.setEndNote(b),!g.endNote)return}let m=f.findGraphicalStaffEntryFromTimestamp(o);m||(m=f.staffEntries[0]);let S=u.findGraphicalStaffEntryFromTimestamp(a);if(S||(S=u.staffEntries[u.staffEntries.length-1]),g.setStartNote(m),d!==c){g.endsOnDifferentStaffLine=!0;let b=c.Measures[c.Measures.length-1];b===void 0&&(b=u);const y=b.staffEntries[b.staffEntries.length-1];g.setEndNote(y);const x=d.ParentMusicSystem.Id-c.ParentMusicSystem.Id;if(x>0)for(let w=c.ParentMusicSystem.Id;w<d.ParentMusicSystem.Id;w++){const T=w+1,C=this.musicSystems[T].StaffLines[s],P=C.Measures[0],I=new na(r,P.PositionAndShape);w<x&&(I.endsOnDifferentStaffLine=!0);let F=C.Measures[C.Measures.length-1];F.IsExtraGraphicalMeasure&&(F=C.Measures[C.Measures.length-2]);const L=P.staffEntries[0];let k=F.staffEntries[F.staffEntries.length-1];u.ParentStaffLine===C&&(F=u,k=S);const v="VexFlowMusicSheetCalculator.calculateSingleOctaveShift: ";L||j.warn(v+"no firstNote found"),k||j.warn(v+"no lastNote found"),I.setStartNote(L),I.setEndNote(k),C.OctaveShifts.push(I),this.calculateOctaveShiftSkyBottomLine(L,k,I,C)}this.calculateOctaveShiftSkyBottomLine(m,y,g,c)}else g.setEndNote(S),this.calculateOctaveShiftSkyBottomLine(m,S,g,c);c.OctaveShifts.push(g)}else j.warn("End measure or staffLines for octave shift are undefined! This should not happen!")}calculateSinglePedal(t,e,i,s){var p;const r=e.PedalStart,o=r.ParentStartMultiExpression.Timestamp,a=(p=r.ParentEndMultiExpression)==null?void 0:p.Timestamp,l=this.rules.MinMeasureToDrawIndex,h=this.rules.MaxMeasureToDrawIndex;let c=this.graphicalMusicSheet.MeasureList[i][s].ParentStaffLine;c||(c=this.graphicalMusicSheet.MeasureList[l][s].ParentStaffLine);let u;r.ParentEndMultiExpression?u=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(r.ParentEndMultiExpression.SourceMeasureParent,s):u=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(s,!0),u.MeasureNumber>h+1&&(u=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(s,!0));let f;if(r.ParentEndMultiExpression?f=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(r.ParentStartMultiExpression.SourceMeasureParent,s):(f=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(r.ParentStartMultiExpression.SourceMeasureParent,s),f||(f=this.graphicalMusicSheet.MeasureList[l][s])),f.MeasureNumber<l+1&&(f=this.graphicalMusicSheet.MeasureList[l][s]),f.parentSourceMeasure.measureListIndex<l||f.parentSourceMeasure.measureListIndex>h||u.parentSourceMeasure.measureListIndex<l||u.parentSourceMeasure.measureListIndex>h)return;let d=u.ParentStaffLine;if(d||(d=c),u&&c&&d){let g=!1;c!==d&&(g=!0);const m=new br(r,c.PositionAndShape,!1,g);let S=f.findGraphicalStaffEntryFromTimestamp(o);S||(S=f.staffEntries[0]);let b=u.findGraphicalStaffEntryFromTimestamp(a);if(b||(b=u.staffEntries[u.staffEntries.length-1]),!m.setStartNote(S))return;if(d!==c)if(m.pedalSymbol===Ge.PEDAL_SYMBOL){m.setEndNote(b),m.setEndMeasure(u),m.ReleaseText=" ",m.CalculateBoundingBox(),this.calculatePedalSkyBottomLine(m.startVfVoiceEntry,m.endVfVoiceEntry,m,c);const y=d.Measures[0],x=new br(r,y.PositionAndShape),w=y.staffEntries[0];if(!x.setStartNote(w))return;x.setEndNote(b),m.setEndMeasure(u),d.Pedals.push(x),x.CalculateBoundingBox(),x.DepressText=" ",this.calculatePedalSkyBottomLine(x.startVfVoiceEntry,x.endVfVoiceEntry,x,d)}else{let y=c.Measures[c.Measures.length-1];y===void 0&&(y=u);const x=y.staffEntries[y.staffEntries.length-1];m.setEndNote(x),m.setEndMeasure(u),m.ChangeEnd=!1;const w=d.ParentMusicSystem.Id-c.ParentMusicSystem.Id;if(w>0){let T=1;for(let E=c.ParentMusicSystem.Id;E<d.ParentMusicSystem.Id;E++){const P=this.musicSystems[E+1].StaffLines[s],I=P.Measures[0];let F=!1,L=!1;T<w?F=!0:L=!0,T++;const k=new br(r,I.PositionAndShape,!0,F);k.ChangeBegin=!1,L?k.ChangeEnd=r.ChangeEnd:k.ChangeEnd=!1;let v=P.Measures[P.Measures.length-1];const G=I.staffEntries[0];let et=v.staffEntries[v.staffEntries.length-1];if(u.ParentStaffLine===P&&(v=u,et=b),!k.setStartNote(G))break;k.setEndNote(et),m.setEndMeasure(u),P.Pedals.push(k),k.CalculateBoundingBox(),this.calculatePedalSkyBottomLine(k.startVfVoiceEntry,k.endVfVoiceEntry,k,P)}}m.CalculateBoundingBox(),this.calculatePedalSkyBottomLine(m.startVfVoiceEntry,m.endVfVoiceEntry,m,c)}else m.setEndNote(b),m.setEndMeasure(u),m.CalculateBoundingBox(),this.calculatePedalSkyBottomLine(m.startVfVoiceEntry,m.endVfVoiceEntry,m,c);c.Pedals.push(m)}else j.warn("End measure or staffLines for pedal are undefined! This should not happen!")}calculateSingleWavyLine(t,e,i,s){var p,g;const r=e.WavyLineStart,o=r.ParentStartMultiExpression.Timestamp,a=(p=r.ParentEndMultiExpression)==null?void 0:p.Timestamp,l=this.rules.MinMeasureToDrawIndex,h=this.rules.MaxMeasureToDrawIndex;let c=this.graphicalMusicSheet.MeasureList[i][s].ParentStaffLine;c||(c=this.graphicalMusicSheet.MeasureList[l][s].ParentStaffLine);let u;r.ParentEndMultiExpression?u=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(r.ParentEndMultiExpression.SourceMeasureParent,s):u=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(s,!0),u.MeasureNumber>h+1&&(u=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(s,!0));let f;if(r.ParentEndMultiExpression?f=this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(r.ParentStartMultiExpression.SourceMeasureParent,s):f=this.graphicalMusicSheet.MeasureList[l][s],f.MeasureNumber<l+1&&(f=this.graphicalMusicSheet.MeasureList[l][s]),f.parentSourceMeasure.measureListIndex<l||f.parentSourceMeasure.measureListIndex>h||u.parentSourceMeasure.measureListIndex<l||u.parentSourceMeasure.measureListIndex>h)return;let d=u.ParentStaffLine;if(d||(d=c),u&&c&&d){const m=new ra(r,c.PositionAndShape,f.ParentStaff.isTab);let S=f.findGraphicalStaffEntryFromTimestamp(o);S||(S=f.staffEntries[0]);let b=u.findGraphicalStaffEntryFromTimestamp(a);if(b||(b=u.staffEntries[u.staffEntries.length-1]),m.setStartNote(S),d!==c){let y=c.Measures[c.Measures.length-1];y===void 0&&(y=u);const x=y.staffEntries[y.staffEntries.length-1];if(m.setEndNote(x),d.ParentMusicSystem.Id-c.ParentMusicSystem.Id>0)for(let T=c.ParentMusicSystem.Id;T<d.ParentMusicSystem.Id;T++){const C=this.musicSystems[T+1].StaffLines[s],P=(g=C==null?void 0:C.Measures)==null?void 0:g[0];if(!P)return;const I=new ra(r,P.PositionAndShape,C.ParentStaff.isTab);let F=C.Measures[C.Measures.length-1];const L=P.staffEntries[0];let k=F.staffEntries[F.staffEntries.length-1];u.ParentStaffLine===C&&(F=u,k=b),I.setStartNote(L),I.setEndNote(k),C.WavyLines.push(I),I.CalculateBoundingBox(),this.calculateWavyLineSkyBottomLine(I.startVfVoiceEntry,I.endVfVoiceEntry,I,C)}m.CalculateBoundingBox(),this.calculateWavyLineSkyBottomLine(m.startVfVoiceEntry,m.endVfVoiceEntry,m,c)}else m.setEndNote(b),m.CalculateBoundingBox(),this.calculateWavyLineSkyBottomLine(m.startVfVoiceEntry,m.endVfVoiceEntry,m,c);c.WavyLines.push(m)}else j.warn("End measure or staffLines for wavy line are undefined! This should not happen!")}calculateWavyLineSkyBottomLine(t,e,i,s){var m,S;const r=i.startNote.getStave(),o=i.endNote.getStave(),a=Math.max(r.options.top_text_position,o.options.top_text_position);r.options.top_text_position=a,o.options.top_text_position=a;let l=-a,h=0,c=0,u=1/0,f=1/0;const d=1.85;let p=t.PositionAndShape.AbsolutePosition.x+t.PositionAndShape.BorderLeft;((S=(m=t.parentVoiceEntry)==null?void 0:m.OrnamentContainer)==null?void 0:S.GetOrnament)===Ne.Trill&&(h=p,p+=2,c=p,u=s.SkyBottomLineCalculator.getSkyLineMinInRange(h,c),f=u+d);let g;if(i.ToEndOfStopStave)g=e.parentStaffEntry.parentMeasure.PositionAndShape.AbsolutePosition.x+e.parentStaffEntry.parentMeasure.PositionAndShape.BorderRight-1;else{g=e.PositionAndShape.AbsolutePosition.x+e.PositionAndShape.BorderRight;const b=e.parentStaffEntry.vfClefBefore;b&&(g+=b.getWidth()/10)}l=s.SkyBottomLineCalculator.getSkyLineMinInRange(p,g),l!==1/0&&(l<u?(r.options.top_text_position=-l,o.options.top_text_position=-l,s.SkyBottomLineCalculator.updateSkyLineInRange(h,c,l-d)):(i.line=-f,l=f),l-=i.PositionAndShape.Size.height,s.SkyBottomLineCalculator.updateSkyLineInRange(p,g,l))}calculatePedalSkyBottomLine(t,e,i,s){var d,p,g,m;let r=e==null?void 0:e.PositionAndShape;r||(r=i.endMeasure.PositionAndShape);const o=M.Flow.PedalMarking.Styles,a=i.getPedalMarking(),l=a.line+3+(s.StaffLines.length-1),h=a.render_options.text_margin_right/10;let c=t.PositionAndShape.AbsolutePosition.x-h;(a.style===o.MIXED||a.style===o.MIXED_OPEN_END||a.style===o.TEXT)&&(c-=1);let u,f=s.StaffLines.length-1;for(const S of s.Pedals){const x=S.getPedalMarking().line+3+(s.StaffLines.length-1);f=Math.max(x,f)}if(i.EndSymbolPositionAndShape){const S=a.render_options.glyph_point_size/20;u=c+3.4;const b=r.AbsolutePosition.x-h,y=b+1.5;f=Math.max(s.SkyBottomLineCalculator.getBottomLineMaxInRange(c,u),f),f=Math.max(l+S*2,f);const x=s.SkyBottomLineCalculator.getBottomLineMaxInRange(b,y);i.DepressText||(f=Math.max(f,x)),i.setLine(f-3-(s.StaffLines.length-1)),s.SkyBottomLineCalculator.updateBottomLineInRange(c,u,f+S),s.SkyBottomLineCalculator.updateBottomLineInRange(b,y,f+S)}else{const S=a.render_options.bracket_height/10;if(a.EndsStave)e?u=e.parentStaffEntry.parentMeasure.PositionAndShape.AbsolutePosition.x+e.parentStaffEntry.parentMeasure.PositionAndShape.Size.width-h:u=r.AbsolutePosition.x+r.Size.width;else switch(a.style){case o.BRACKET_OPEN_END:case o.BRACKET_OPEN_BOTH:case o.MIXED_OPEN_END:u=r.AbsolutePosition.x+r.BorderRight-h;break;default:u=r.AbsolutePosition.x+r.BorderLeft-h;break}const b=(d=e==null?void 0:e.parentStaffEntry)==null?void 0:d.vfClefBefore;if(b&&(u+=b.getWidth()/10),f=Math.max(s.SkyBottomLineCalculator.getBottomLineMaxInRange(c,u),f),f===1/0)return;if(f=Math.max(f,l+S),i.setLine(f-3-(s.StaffLines.length-1)),c>u){const y=u;u=c,c=y}s.SkyBottomLineCalculator.updateBottomLineInRange(c,u,f+S)}for(const S of s.Pedals){const b=S,y=b.getPedalMarking(),x=y.line+3+(s.StaffLines.length-1);if(f>x){const w=y.render_options.text_margin_right/10;let T=b.startVfVoiceEntry.PositionAndShape.AbsolutePosition.x-w,E;b.setLine(f-3-(s.StaffLines.length-1));let C=(p=b.endVfVoiceEntry)==null?void 0:p.PositionAndShape;if(C||(C=b.endMeasure.PositionAndShape),b.EndSymbolPositionAndShape){const P=a.render_options.glyph_point_size/20;E=T+3.4;const I=C.AbsolutePosition.x-w,F=I+1.5;s.SkyBottomLineCalculator.updateBottomLineInRange(T,E,f+P),s.SkyBottomLineCalculator.updateBottomLineInRange(I,F,f+P)}else{const P=y.render_options.bracket_height/10;if(y.EndsStave)E=C.AbsolutePosition.x+C.Size.width-w;else switch(a.style){case o.BRACKET_OPEN_END:case o.BRACKET_OPEN_BOTH:case o.MIXED_OPEN_END:E=C.AbsolutePosition.x+C.BorderRight-w;break;default:E=C.AbsolutePosition.x+C.BorderLeft-w;break}const I=(m=(g=b.endVfVoiceEntry)==null?void 0:g.parentStaffEntry)==null?void 0:m.vfClefBefore;if(I&&(E+=I.getWidth()/10),T>E){const F=T;T=E,E=F}s.SkyBottomLineCalculator.updateBottomLineInRange(T,E,f+P)}}}}calculateOctaveShiftSkyBottomLine(t,e,i,s){if(!e){j.warn("octaveshift: no endStaffEntry");return}let r=t.PositionAndShape.Size.width,o=e.PositionAndShape.Size.width;t.hasOnlyRests()?r=-r:r/=2,e.hasOnlyRests()?o*=2:o/=2,t===e&&(o*=2);const a=t.PositionAndShape.AbsolutePosition.x-r,l=e.PositionAndShape.AbsolutePosition.x+o;i.PositionAndShape.Size.width=a-l;const h=i.getTextBracket(),c=h.font.size/10;if(h.position===ji.TextBracket.Positions.TOP){const u=Math.ceil(s.SkyBottomLineCalculator.getSkyLineMinInRange(a,l));if(u===1/0)return;h.start.getStave().options.top_text_position=Math.abs(u),s.SkyBottomLineCalculator.updateSkyLineInRange(a,l,u-c*2)}else{const u=s.SkyBottomLineCalculator.getBottomLineMaxInRange(a,l);if(u===1/0)return;h.start.getStave().options.bottom_text_position=u,t.parentMeasure!==e.parentMeasure&&(h.stop.getStave().options.bottom_text_position=u),s.SkyBottomLineCalculator.updateBottomLineInRange(a,l,u+c*1.5)}}calculateWordRepetitionInstruction(t,e){let i;const s=this.graphicalMusicSheet.MeasureList[e];for(let r=0,o=s.length;r<o;++r){const a=s[r];if(a&&a.ParentStaffLine&&a.ParentStaff.ParentInstrument.Visible){i=a;break}}i&&i.addWordRepetition(t)}calculateExpressionAlignements(){for(const t of this.musicSystems)for(const e of t.StaffLines)try{e.AlignmentManager.alignDynamicExpressions(),e.AbstractExpressions.forEach(i=>{i.updateSkyBottomLine()})}catch{}}handleTiedGraphicalNote(t,e,i,s,r,o,a,l){}handleBeam(t,e,i){t.parentVoiceEntry.parentStaffEntry.parentMeasure.handleBeam(t,e)}handleVoiceEntryLyrics(t,e,i){t.LyricsEntries.forEach((s,r)=>{const o=new Yi(r,e,this.rules.LyricsHeight,this.rules.StaffHeight);if(e.LyricsEntries.push(o),o.GraphicalLabel.setLabelPositionAndShapeBorders(),r.Word){const l=r.Word.Syllables.indexOf(r);let h=i.indexOf(r.Word);if(h===-1&&(i.push(r.Word),h=i.indexOf(r.Word)),this.graphicalLyricWords.length===0||h>this.graphicalLyricWords.length-1){const c=new Ou(r.Word);o.ParentLyricWord=c,c.GraphicalLyricsEntries[l]=o,this.graphicalLyricWords.push(c)}else{const c=this.graphicalLyricWords[h];o.ParentLyricWord=c,c.GraphicalLyricsEntries[l]=o,c.isFilled()&&(i.splice(h,1),this.graphicalLyricWords.splice(this.graphicalLyricWords.indexOf(c),1))}}})}handleVoiceEntryOrnaments(t,e,i){}handleVoiceEntryArticulations(t,e,i){}handleVoiceEntryTechnicalInstructions(t,e,i){}handleTuplet(t,e,i){t.parentVoiceEntry.parentStaffEntry.parentMeasure.handleTuplet(t,e)}findIndexGraphicalSlurFromSlur(t,e){for(let i=0;i<t.length;i++)if(t[i].slur===e)return i;return-1}calculateSlurs(){const t={};for(const e of this.graphicalMusicSheet.MeasureList[0])t[e.ParentStaff.idInMusicSheet]=[];for(const e of this.musicSystems)for(const i of e.StaffLines){const s=t[i.ParentStaff.idInMusicSheet];for(let r=0;r<s.length;r++){const o=s[r],a=new En(o.slur,this.rules);i.addSlurToStaffline(a),s[r]=a}for(const r of i.Measures)for(const o of r.staffEntries){for(const a of o.graphicalVoiceEntries)for(const l of a.notes)for(const h of l.sourceNote.NoteSlurs)if(!(!h.EndNote||!h.StartNote)){if(h.StartNote===l.sourceNote){const c=new En(h,this.rules);s.push(c),i.addSlurToStaffline(c)}if(h.EndNote===l.sourceNote){const c=this.findIndexGraphicalSlurFromSlur(s,h);if(c>=0){const u=s[c];u.staffEntries.indexOf(o)===-1&&u.staffEntries.push(o),s.splice(c,1)}}}for(const a of s)a.staffEntries.indexOf(o)===-1&&a.staffEntries.push(o)}}for(const e of this.musicSystems)for(const i of e.StaffLines){const s=i.GraphicalSlurs.sort(En.Compare);for(const r of s)r.slur.isCrossed()||r.calculateCurve(this.rules)}}}class Wu{constructor(t){this.musicSheet=t}reInit(){this.init()}init(){this.parts=this.musicSheet.Repetitions.slice(),this.sheetStart=this.musicSheet.SelectionStart=new W(0,1),this.sheetEnd=this.musicSheet.SelectionEnd=this.musicSheet.SheetEndTimestamp,this.calcMapping()}getCurrentRepetitionTimestampTransform(t){let e;for(let i=this.timestamps.length-1;i>=0;i--)if(e=this.timestamps[i],t.gte(e.from))return e;return this.timestamps[0]}absoluteEnrolledToSheetTimestamp(t){if(this.timestamps.length===0)return t;const e=this.getCurrentRepetitionTimestampTransform(t);return W.plus(t,W.minus(e.to,e.from))}get Parts(){return this.parts}get MusicSheet(){return this.musicSheet}getIterator(t){return t?new Ss(this.musicSheet,t,void 0):new Ss(this.musicSheet,this.musicSheet.SelectionStart,this.musicSheet.SelectionEnd)}setSelectionStart(t){this.musicSheet.SelectionStart=t,this.musicSheet.SelectionEnd=void 0}setSelectionRange(t,e){this.musicSheet.SelectionStart=t!=null?t:this.sheetStart,this.musicSheet.SelectionEnd=e!=null?e:this.sheetEnd}calcMapping(){this.timestamps=[];const t=this.getIterator();let e=t.CurrentRepetition,i=new oa(t.CurrentEnrolledTimestamp.clone(),t.CurrentSourceTimestamp.clone(),void 0,0);for(this.timestamps.push(i);!t.EndReached;){if(t.JumpOccurred||e!==t.CurrentRepetition){if(e=t.CurrentRepetition,t.backJumpOccurred){const s=t.JumpResponsibleRepetition;i.nextBackJump=t.CurrentEnrolledTimestamp,i.curRepetition=s,i.curRepetitionIteration=t.CurrentJumpResponsibleRepetitionIterationBeforeJump;for(let r=this.timestamps.length-2;r>=0&&!(s.AbsoluteTimestamp.gt(this.timestamps[r].to)||this.timestamps[r].curRepetition);r--)this.timestamps[r].nextBackJump=i.nextBackJump,this.timestamps[r].curRepetition=s,this.timestamps[r].curRepetitionIteration=i.curRepetitionIteration}i=new oa(t.CurrentEnrolledTimestamp.clone(),t.CurrentSourceTimestamp.clone(),void 0,0),this.timestamps.push(i)}t.moveToNext()}}}class oa{constructor(t,e,i,s){this.from=t,this.to=e,this.curRepetition=i,this.curRepetitionIteration=s,this.nextBackJump=void 0,this.nextForwardJump=void 0}}class ol{constructor(t){this.enrolledTimestamps=[],this.visible=!0,this.musicSheet=t}get Visible(){return this.visible}set Visible(t){this.visible=t}getFirstSourceMeasure(){return this.musicSheet.SourceMeasures[this.startIndex]}getLastSourceMeasure(){return this.musicSheet.SourceMeasures[this.endIndex]}}class aa extends ol{constructor(t,e,i){super(t),this.musicSheet=t,this.startIndex=e,this.endIndex=i}get MeasuresCount(){return this.endIndex-this.startIndex+1}get StartIndex(){return this.startIndex}get EndIndex(){return this.endIndex}get ParentRepetition(){return this.parentRepetition}set ParentRepetition(t){this.parentRepetition=t}get AbsoluteTimestamp(){return W.createFromFraction(this.musicSheet.SourceMeasures[this.startIndex].AbsoluteTimestamp)}setStartIndex(t){this.startIndex=t}setEndIndex(t){this.endIndex=t}}class Dn extends ol{constructor(t,e=!1){super(t),this.backwardJumpInstructions=[],this.endingParts=[],this.endingIndexDict={},this.userNumberOfRepetitions=0,this.visibles=[],this.fromWords=!1,this.repetitonIterationOrder=[],this.numberOfEndings=1,this.musicSheet2=t,this.virtualOverallRepetition=e}get BackwardJumpInstructions(){return this.backwardJumpInstructions}get EndingIndexDict(){return this.endingIndexDict}get EndingParts(){return this.endingParts}get Visibles(){return this.visibles}set Visibles(t){this.visibles=t}get DefaultNumberOfRepetitions(){let t=2;return this.virtualOverallRepetition&&(t=1),Math.max(t,Object.keys(this.endingIndexDict).length,this.checkRepetitionForMultipleLyricVerses())}get UserNumberOfRepetitions(){return this.userNumberOfRepetitions}set UserNumberOfRepetitions(t){this.userNumberOfRepetitions=t,this.repetitonIterationOrder=[];const e=this.userNumberOfRepetitions-this.NumberOfEndings;for(let i=1;i<=this.userNumberOfRepetitions;i++)i<=e?this.repetitonIterationOrder.push(1):this.repetitonIterationOrder.push(i-e)}getForwardJumpTargetForIteration(t){const e=this.repetitonIterationOrder[t-1];return this.endingIndexDict[e]?this.endingIndexDict[e].part.StartIndex:-1}getBackwardJumpTarget(){return this.startMarker.measureIndex}setEndingsStartIndex(t,e){const i=new la(new aa(this.musicSheet2,e,e));this.endingParts.push(i);for(const s of t)try{this.endingIndexDict[s]=i,i.endingIndices.push(s),this.numberOfEndings<s&&(this.numberOfEndings=s)}catch(r){j.error("Repetition: Exception.",r)}}setEndingStartIndex(t,e){const i=new la(new aa(this.musicSheet2,e,e));this.EndingIndexDict[t]=i,this.endingParts.push(i),i.endingIndices.push(t),this.numberOfEndings<t&&(this.numberOfEndings=t)}setEndingEndIndex(t,e){this.endingIndexDict[t]&&this.endingIndexDict[t].part.setEndIndex(e)}get NumberOfEndings(){return this.numberOfEndings}get FromWords(){return this.fromWords}set FromWords(t){this.fromWords=t}get AbsoluteTimestamp(){return W.createFromFraction(this.musicSheet2.SourceMeasures[this.startMarker.measureIndex].AbsoluteTimestamp)}get StartIndex(){return this.startMarker.measureIndex}get EndIndex(){if(this.BackwardJumpInstructions.length===0)return this.StartIndex;let t=this.backwardJumpInstructions[this.backwardJumpInstructions.length-1].measureIndex;return this.endingIndexDict[this.NumberOfEndings]&&(t=Math.max(this.endingIndexDict[this.NumberOfEndings].part.EndIndex,t)),t}checkRepetitionForMultipleLyricVerses(){let t=0;const e=this.StartIndex,i=this.EndIndex;for(let s=e;s<=i;s++){const r=this.musicSheet2.SourceMeasures[s];for(let o=0;o<r.CompleteNumberOfStaves;o++)if(r.VerticalSourceStaffEntryContainers[o]){for(const a of r.VerticalSourceStaffEntryContainers[o].StaffEntries)if(a){let l=0;for(const h of a.VoiceEntries)l+=h.LyricsEntries.keys.length;t=Math.max(t,l)}}}return t}get FirstSourceMeasureNumber(){return this.getFirstSourceMeasure().MeasureNumber}get LastSourceMeasureNumber(){return this.getLastSourceMeasure().MeasureNumber}coversIdenticalMeasures(t){return this.StartIndex===t.StartIndex&&this.EndIndex===t.EndIndex}removeFromRepetitionInstructions(){this.startMarker!==void 0&&(this.startMarker.parentRepetition=void 0),this.endMarker!==void 0&&(this.endMarker.parentRepetition=void 0);for(const t of this.BackwardJumpInstructions)t.parentRepetition=void 0}}class la{constructor(t){this.endingIndices=[],this.part=t}ToString(){return this.endingIndices.join(", ")}}class wo{constructor(t=new W,e=0){this.rhythm=t,this.beatsPerMinute=e,this.beatLengthInMilliseconds=6e4/e,this.beatRealValue=1/4}static createFrom(t){return new wo(t.Rhythm,t.BeatsPerMinute)}get BeatsPerMinute(){return this.beatsPerMinute}set BeatsPerMinute(t){this.beatsPerMinute=t,this.beatLengthInMilliseconds=6e4/this.beatsPerMinute}get Rhythm(){return this.rhythm}set Rhythm(t){this.rhythm=t}get BeatRealValue(){return this.beatRealValue}get BeatLengthInMilliseconds(){return this.beatLengthInMilliseconds}getDurationInMilliseconds(t){return(typeof t=="number"?t:t.RealValue)*this.BeatLengthInMilliseconds/this.beatRealValue}getDurationAsNoteDuration(t,e=1024){const i=t/this.BeatLengthInMilliseconds;let s=Math.floor(i);const r=new W(s,4),o=i-s;return s=Math.round(o/(1/e)/4),s===0&&t>0&&(s=1),r.Add(new W(s,e)),r}}class al{constructor(){this.idString="random idString, not initialized",this.sourceMeasures=[],this.repetitions=[],this.dynListStaves=[],this.timestampSortedDynamicExpressionsList=[],this.timestampSortedTempoExpressionsList=[],this.instrumentalGroups=[],this.instruments=[],this.musicPartManager=void 0,this.musicSheetErrors=new Uc,this.staves=[],this.playbackDataDict=new Ye,this.transpose=0,this.defaultStartTempoInBpm=0,this.drawErroneousMeasures=!1,this.hasBeenOpenedForTheFirstTime=!1,this.currentEnrolledPosition=new W(0,1),this.soundTempos=new Map,this.playbackSettings=new wo,this.playbackSettings.rhythm=new W(4,4,0,!1),this.userStartTempoInBPM=100,this.pageWidth=120,this.MusicPartManager=new Wu(this),this.hasBPMInfo=!1}get SoundTempos(){return this.soundTempos}set SoundTempos(t){this.soundTempos=t}static getIndexFromStaff(t){return t.idInMusicSheet}get CurrentKeyInstruction(){return this.currentKeyInstruction}set CurrentKeyInstruction(t){this.currentKeyInstruction=t}get SourceMeasures(){return this.sourceMeasures}set SourceMeasures(t){this.sourceMeasures=t}get Repetitions(){return this.repetitions}set Repetitions(t){this.repetitions=t}get DynListStaves(){return this.dynListStaves}get TimestampSortedTempoExpressionsList(){return this.timestampSortedTempoExpressionsList}get TimestampSortedDynamicExpressionsList(){return this.timestampSortedDynamicExpressionsList}get InstrumentalGroups(){return this.instrumentalGroups}get Parts(){return this.instruments}get Instruments(){return this.instruments}get SheetPlaybackSetting(){return this.playbackSettings}set SheetPlaybackSetting(t){this.playbackSettings=t}get DrawErroneousMeasures(){return this.drawErroneousMeasures}set DrawErroneousMeasures(t){this.drawErroneousMeasures=t}get HasBeenOpenedForTheFirstTime(){return this.hasBeenOpenedForTheFirstTime}set HasBeenOpenedForTheFirstTime(t){this.hasBeenOpenedForTheFirstTime=t}InitializeStartTempoInBPM(t){this.playbackSettings.BeatsPerMinute=t,this.userStartTempoInBPM=t}get DefaultStartTempoInBpm(){return this.defaultStartTempoInBpm}set DefaultStartTempoInBpm(t){this.defaultStartTempoInBpm=t,this.InitializeStartTempoInBPM(t)}get Path(){return this.path}set Path(t){this.path=t}get Staves(){return this.staves}get TitleString(){return this.title?this.title.text:""}set TitleString(t){this.Title=new jt(t)}get SubtitleString(){return this.subtitle?this.subtitle.text:""}set SubtitleString(t){this.Subtitle=new jt(t)}get ComposerString(){return this.composer?this.composer.text:""}set ComposerString(t){this.Composer=new jt(t)}get LyricistString(){return this.lyricist?this.lyricist.text:""}set LyricistString(t){this.Lyricist=new jt(t)}get Title(){return this.title}set Title(t){this.title=t}get Subtitle(){return this.subtitle}set Subtitle(t){this.subtitle=t}get Composer(){return this.composer}set Composer(t){this.composer=t}get Lyricist(){return this.lyricist}set Lyricist(t){this.lyricist=t}get Rules(){return this.rules||(j.debug("warning: sheet.Rules was undefined. Creating new EngravingRules."),this.rules=new Ui),this.rules}set Rules(t){this.rules=t}get SheetErrors(){return this.musicSheetErrors}get PlaybackDataDict(){return this.playbackDataDict}get SelectionStart(){return this.selectionStart}set SelectionStart(t){this.selectionStart=t.clone(),this.currentEnrolledPosition=t.clone()}get SelectionEnd(){return this.selectionEnd}set SelectionEnd(t){this.selectionEnd=t}set HasBPMInfo(t){this.hasBPMInfo=t}get HasBPMInfo(){return this.hasBPMInfo}addMeasure(t){this.sourceMeasures.push(t),t.measureListIndex=this.sourceMeasures.length-1}checkForInstrumentWithNoVoice(){for(let t=0,e=this.instruments.length;t<e;++t){const i=this.instruments[t];if(i.Voices.length===0){const s=new bo(i,1);i.Voices.push(s)}}}getStaffFromIndex(t){return this.staves[t]}fillStaffList(){let t=0;for(let e=0,i=this.instruments.length;e<i;++e){const s=this.instruments[e];for(let r=0,o=s.Staves.length;r<o;++r){const a=s.Staves[r];a.idInMusicSheet=t,this.staves.push(a),t++}}}get MusicPartManager(){return this.musicPartManager}set MusicPartManager(t){this.musicPartManager=t}getCompleteNumberOfStaves(){let t=0;for(let e=0,i=this.instruments.length;e<i;++e)t+=this.instruments[e].Staves.length;return t}getListOfMeasuresFromIndeces(t,e){const i=[];for(let s=t;s<=e;s++)i.push(this.sourceMeasures[s]);return i}getNextSourceMeasure(t){const e=this.sourceMeasures.indexOf(t);return e===this.sourceMeasures.length-1?t:this.sourceMeasures[e+1]}getFirstSourceMeasure(){return this.sourceMeasures[0]}getLastSourceMeasure(){return this.sourceMeasures[this.sourceMeasures.length-1]}resetAllNoteStates(){const t=this.MusicPartManager.getIterator();for(;!t.EndReached&&t.CurrentVoiceEntries;){for(let e=0,i=t.CurrentVoiceEntries.length;e<i;++e){const s=t.CurrentVoiceEntries[e];for(let r=0,o=s.Notes.length;r<o;++r){const a=s.Notes[r];a.state=Ma.Normal}}t.moveToNext()}}getMusicSheetInstrumentIndex(t){return this.Instruments.indexOf(t)}getGlobalStaffIndexOfFirstStaff(t){const e=this.getMusicSheetInstrumentIndex(t);let i=0;for(let s=0;s<e;s++)i+=this.Instruments[s].Staves.length;return i}setRepetitionNewUserNumberOfRepetitions(t,e){let i=0;for(let s=0;s<this.repetitions.length;s++)if(this.repetitions[s]instanceof Dn)if(t===i){this.repetitions[s].UserNumberOfRepetitions=e;break}else i++}getRepetitionByIndex(t){let e=0;for(let i=0;i<this.repetitions.length;i++)if(this.repetitions[i]instanceof Dn){if(t===e)return this.repetitions[i];e++}}CompareTo(t){return this.Title.text.localeCompare(t.Title.text)}getExpressionsStartTempoInBPM(){if(this.TimestampSortedTempoExpressionsList.length>0){const t=this.TimestampSortedTempoExpressionsList[0];if(t.InstantaneousTempo)return t.InstantaneousTempo.TempoInBpm;if(t.ContinuousTempo)return t.ContinuousTempo.StartTempo}return this.userStartTempoInBPM}get Errors(){return this.musicSheetErrors.measureErrors}get FirstMeasureNumber(){try{return this.getFirstSourceMeasure().MeasureNumber}catch(t){return j.info("MusicSheet.FirstMeasureNumber: ",t),0}}get LastMeasureNumber(){try{return this.getLastSourceMeasure().MeasureNumber}catch(t){return j.info("MusicSheet.LastMeasureNumber: ",t),0}}get CurrentEnrolledPosition(){return this.currentEnrolledPosition.clone()}set CurrentEnrolledPosition(t){this.currentEnrolledPosition=t.clone()}get Transpose(){return this.transpose}set Transpose(t){this.transpose=t}get FullNameString(){return this.ComposerString+" "+this.TitleString}get IdString(){return this.idString}set IdString(t){this.idString=t}getEnrolledSelectionStartTimeStampWorkaround(){const t=this.MusicPartManager.getIterator(this.SelectionStart);return W.createFromFraction(t.CurrentEnrolledTimestamp)}get SheetEndTimestamp(){const t=this.getLastSourceMeasure();return W.plus(t.AbsoluteTimestamp,t.Duration)}getSourceMeasureFromTimeStamp(t){for(let e=0,i=this.sourceMeasures.length;e<i;++e){const s=this.sourceMeasures[e];for(let r=0,o=s.VerticalSourceStaffEntryContainers.length;r<o;++r){const a=s.VerticalSourceStaffEntryContainers[r];if(t.Equals(a.getAbsoluteTimestamp()))return s}}return this.findSourceMeasureFromTimeStamp(t)}findSourceMeasureFromTimeStamp(t){for(const e of this.sourceMeasures)if(e.AbsoluteTimestamp.lte(t)&&t.lt(W.plus(e.AbsoluteTimestamp,e.Duration)))return e}getVisibleInstruments(){const t=[];for(let e=0,i=this.Instruments.length;e<i;++e){const s=this.Instruments[e];s.Voices.length>0&&s.Voices[0].Visible&&t.push(s)}return t}}al.defaultTitle="[no title given]";class Uu{constructor(){this.syllables=[]}get Syllables(){return this.syllables}containsVoiceEntry(t){for(let e=0,i=this.Syllables.length;e<i;++e)if(this.Syllables[e].Parent===t)return!0;return!1}findLyricEntryInVoiceEntry(t){for(let e=0,i=this.Syllables.length;e<i;++e){const s=this.Syllables[e];if(s.Parent===t)return s}}}class ks{constructor(t,e,i,s,r=-1){this.text=t,this.word=i,this.parent=s,this.verseNumber=e,r>=0&&(this.syllableIndex=r)}get Text(){return this.text}set Text(t){this.text=t}get Word(){return this.word}get Parent(){return this.parent}set Parent(t){this.parent=t}get VerseNumber(){return this.verseNumber}get SyllableIndex(){return this.syllableIndex}}class zu{constructor(t){this.openLyricWords={},this.musicSheet=t}addLyricEntry(t,e){var i,s;if(t){const r=t;for(let o=0,a=r.length;o<a;++o){const l=r[o];try{let h="single";if(l.element("text")){let c=l.element("text");if(l.element("syllabic")&&(h=l.element("syllabic").value),c){let u="";const f=l.elements();for(const m of f)(m.name==="text"||m.name==="elision")&&(u+=m.value);if(u=u.replace(" "," "),l.element("elision")!==void 0&&u==="-"){const m=l.elements();let S=0;for(let x=0;x<m.length;x++)if(m[x].name==="elision"){S=x;break}let b,y;if(S>0)for(let x=S;x<m.length;x++){const w=m[x];w.name==="text"&&(b=w),w.name==="syllabic"&&(y=w)}b!==void 0&&y&&(c=b,h="middle")}let d=1,p=!1;if(l.attributes()!==void 0&&l.attribute("number")){try{d=parseInt(l.attribute("number").value,10)}catch{p=!0}if(p=p||isNaN(d),p)try{const m=l.attribute("number").value.toLowerCase().split("verse");m.length>1&&(d=parseInt(m[1],10))}catch{const S=Tt.translateText("ReaderErrorMessages/LyricVerseNumberError","Invalid lyric verse number");this.musicSheet.SheetErrors.pushMeasureError(S);continue}}let g;if(h==="single"||h==="end"){if(this.openLyricWords[d]){this.currentLyricWord=this.openLyricWords[d];const m=this.currentLyricWord.Syllables.length;g=new ks(u,d,this.currentLyricWord,e,m),this.currentLyricWord.Syllables.push(g),delete this.openLyricWords[d],this.currentLyricWord=void 0}else g=new ks(u,d,void 0,e);g.extend=l.element("extend")!==void 0}else if(h==="begin")this.openLyricWords[d]&&(delete this.openLyricWords[d],this.currentLyricWord=void 0),this.currentLyricWord=new Uu,this.openLyricWords[d]=this.currentLyricWord,g=new ks(u,d,this.currentLyricWord,e,0),this.currentLyricWord.Syllables.push(g);else if(h==="middle")if(this.openLyricWords[d]){this.currentLyricWord=this.openLyricWords[d];const m=this.currentLyricWord.Syllables.length;g=new ks(u,d,this.currentLyricWord,e,m),this.currentLyricWord.Syllables.push(g)}else g=new ks(u,d,void 0,e);g&&(e.LyricsEntries[d]||(e.LyricsEntries.setValue(d,g),(s=(i=e.ParentSourceStaffEntry)==null?void 0:i.VerticalContainerParent)!=null&&s.ParentMeasure&&(e.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.hasLyrics=!0)),e.ParentVoice.Parent.LyricVersesNumbers[d]||e.ParentVoice.Parent.LyricVersesNumbers.push(d))}}}catch{const c=Tt.translateText("ReaderErrorMessages/LyricError","Error while reading lyric entry.");this.musicSheet.SheetErrors.pushMeasureError(c);continue}}e.ParentVoice.Parent.LyricVersesNumbers=e.ParentVoice.Parent.LyricVersesNumbers.filter((o,a,l)=>l.indexOf(o)===a)}}}class Bs{constructor(t,e){this.articulationEnum=t,this.placement=e}Equals(t){return t.articulationEnum===this.articulationEnum&&t.placement===this.placement}}class Hu{constructor(t){this.rules=t}getAccEnumFromString(t){switch(t){case"sharp":return yt.SHARP;case"flat":return yt.FLAT;case"natural":return yt.NATURAL;case"double-sharp":case"sharp-sharp":return yt.DOUBLESHARP;case"double-flat":case"flat-flat":return yt.DOUBLEFLAT;case"triple-sharp":return yt.TRIPLESHARP;case"triple-flat":return yt.TRIPLEFLAT;case"quarter-sharp":return yt.QUARTERTONESHARP;case"quarter-flat":return yt.QUARTERTONEFLAT;case"three-quarters-sharp":return yt.THREEQUARTERSSHARP;case"three-quarters-flat":return yt.THREEQUARTERSFLAT;case"slash-quarter-sharp":return yt.SLASHQUARTERSHARP;case"slash-sharp":return yt.SLASHSHARP;case"double-slash-flat":return yt.DOUBLESLASHFLAT;case"sori":return yt.SORI;case"koron":return yt.KORON;default:return yt.NONE}}addArticulationExpression(t,e){var i,s;if(t!==void 0&&t.elements().length>0){const r=t.elements();for(let o=0,a=r.length;o<a;++o){const l=r[o];let h=l.name;try{h=h.replace("-","");const c=wt[h];if(ir.isSupportedArticulation(c)){let u=z.NotYetDefined;const f=(i=l.attribute("placement"))==null?void 0:i.value;f==="above"?u=z.Above:f==="below"&&(u=z.Below);const d=new Bs(c,u);if(h==="staccato"&&e.Articulations.length>0&&e.Articulations[0].articulationEnum!==wt.staccato&&e.Articulations.splice(0,0,d),h==="strongaccent"){const p=(s=l==null?void 0:l.attribute("type"))==null?void 0:s.value;p==="up"?d.articulationEnum=wt.marcatoup:p==="down"&&(d.articulationEnum=wt.marcatodown)}if(h==="detachedlegato"){const p=new Bs(wt.staccato,u),g=new Bs(wt.tenuto,u);e.Articulations.push(p,g)}if(!e.hasArticulation(d))switch(e.Articulations.push(d),d.articulationEnum){case wt.staccato:case wt.staccatissimo:e.DurationModifier=d;break;case wt.accent:case wt.strongaccent:e.VolumeModifier=d;break;default:break}}}catch(c){const u="Invalid note articulation.";j.debug("addArticulationExpression",u,c);return}}}}addFermata(t,e){var r;let i=wt.fermata;t.attributes().length>0&&t.attribute("type")&&t.attribute("type").value==="inverted"&&(i=wt.invertedfermata);let s=z.Above;((r=t.attribute("placement"))==null?void 0:r.value)==="below"&&(s=z.Below),e.Articulations.push(new Bs(i,s))}addTechnicalArticulations(t,e,i){var a,l;const s={bend:wt.bend,"down-bow":wt.downbow,"open-string":wt.naturalharmonic,"snap-pizzicato":wt.snappizzicato,stopped:wt.lefthandpizzicato,"up-bow":wt.upbow};for(const h in s){if(!s.hasOwnProperty(h))continue;const c=s[h],u=t.element(h);if(u){let f;((a=u.attribute("placement"))==null?void 0:a.value)==="above"&&(f=z.Above),((l=u.attribute("placement"))==null?void 0:l.value)==="below"&&(f=z.Below);const d=new Bs(c,f);e.hasArticulation(d)||e.Articulations.push(d)}}const r=t.element("fingering");if(r){const h=this.createTechnicalInstruction(r,i);h.type=Pr.Fingering,i.Fingering=h,e.TechnicalInstructions.push(h)}const o=t.element("string");if(o){const h=this.createTechnicalInstruction(o,i);h.type=Pr.String,i.StringInstruction=h,e.TechnicalInstructions.push(h)}}createTechnicalInstruction(t,e){const i=new Jc;i.sourceNote=e,i.value=t.value;const s=t.attribute("placement");return this.rules.FingeringPositionFromXML&&(i.placement=this.getPlacement(s)),i}getPlacement(t,e=z.NotYetDefined){if(e!==z.NotYetDefined)return e;if(t)switch(t.value){case"above":return z.Above;case"below":return z.Below;case"left":return z.Left;case"right":return z.Right;default:return z.NotYetDefined}else return z.NotYetDefined}addOrnament(t,e){if(t){let i;const s={"delayed-inverted-turn":Ne.DelayedInvertedTurn,"delayed-turn":Ne.DelayedTurn,"inverted-mordent":Ne.InvertedMordent,"inverted-turn":Ne.InvertedTurn,mordent:Ne.Mordent,"trill-mark":Ne.Trill,turn:Ne.Turn};for(const r in s){if(!s.hasOwnProperty(r))continue;const o=t.element(r);if(o){i=new Xc(s[r]);const a=o.attribute("placement");a&&a.value==="below"&&(i.placement=z.Below)}}if(i){const r=t.elements("accidental-mark");if(r){let o=z.Below,a=yt.NONE;const l=r;for(let h=0,c=l.length;h<c;++h){const u=l[h];let f=u.value;a=this.getAccEnumFromString(f);const d=u.attribute("placement");u.hasAttributes&&d&&(f=d.value,f==="above"?o=z.Above:f==="below"&&(o=z.Below)),o===z.Above?i.AccidentalAbove=a:o===z.Below&&(i.AccidentalBelow=a)}}e.OrnamentContainer=i}}}}class Xu extends Cn{constructor(t,e,i,s,r,o,a,l){super(t,e,i,s,r),this.stringNumberTab=o,this.fretNumber=a,this.bendArray=l}get StringNumberTab(){return this.stringNumberTab}get FretNumber(){return this.fretNumber}get BendArray(){return this.bendArray}}class ha{constructor(t,e,i,s,r=void 0){this.openBeams=[],this.beamNumberOffset=0,this.currentOctaveShift=0,this.tupletDict={},this.openTupletNumber=0,this.currMeasureVoiceEntries=[],this.graceVoiceEntriesTempList=[],this.staff=e,this.instrument=e.ParentInstrument,this.musicSheet=this.instrument.GetMusicSheet,this.slurReader=s,this.pluginManager=t,r?this.voice=new bs(this.instrument,i,r):this.voice=new bo(this.instrument,i),this.instrument.Voices.push(this.voice),this.staff.Voices.push(this.voice),this.lyricsReader=new zu(this.musicSheet),this.articulationReader=new Hu(this.musicSheet.Rules)}get openTieDict(){return this.staff.openTieDict}get GetVoice(){return this.voice}get OctaveShift(){return this.currentOctaveShift}set OctaveShift(t){this.currentOctaveShift=t}createVoiceEntry(t,e,i,s,r=!1,o=!1,a=!1){this.activeKey=i,this.activeRhythm=s,this.currentVoiceEntry=new ir(W.createFromFraction(t),this.voice,e,!0,r,o,a),r?this.graceVoiceEntriesTempList.push(this.currentVoiceEntry):(this.currentNormalVoiceEntry=this.currentVoiceEntry,this.currMeasureVoiceEntries.push(this.currentNormalVoiceEntry),this.graceVoiceEntriesTempList.length>0&&(this.currentVoiceEntry.GraceVoiceEntriesBefore=this.graceVoiceEntriesTempList,this.graceVoiceEntriesTempList=[]))}finalizeReadingMeasure(){this.graceVoiceEntriesTempList.length>0&&this.currentNormalVoiceEntry!==void 0&&this.currentNormalVoiceEntry.GraceVoiceEntriesAfter.concat(this.graceVoiceEntriesTempList),this.graceVoiceEntriesTempList=[],this.pluginManager.processVoiceMeasureReadPlugins(this.currMeasureVoiceEntries,this.activeKey,this.activeRhythm),this.currMeasureVoiceEntries.length=0,this.openBeams.length>1&&this.handleOpenBeam()}read(t,e,i,s,r,o,a,l,h,c,u,f,d,p,g,m,S,b,y,x,w,T){this.currentStaffEntry=a,this.currentMeasure=l;try{this.currentNote=o?this.addRestNote(t.element("rest"),e,s,r,d,p,y):this.addSingleNote(t,e,s,i,r,u,f,d,p,g,m,S,b,y,w,T),this.currentNote.DotsXml=x;const E=t.elements("lyric");this.lyricsReader!==void 0&&E&&(this.lyricsReader.addLyricEntry(E,this.currentVoiceEntry),this.voice.Parent.HasLyrics=!0);let C=!1;const P=t.element("notations");if(P){this.articulationReader&&this.readArticulations(P,this.currentVoiceEntry,this.currentNote);const I=P.elements("slur");this.slurReader!==void 0&&I.length>0&&!this.currentNote.ParentVoiceEntry.IsGrace&&this.slurReader.addSlur(I,this.currentNote);const F=P.elements("tuplet");F.length>0&&(this.openTupletNumber=this.addTuplet(t,F),C=!0);const L=P.element("arpeggiate");if(L!==void 0){let et;if(this.currentVoiceEntry.Arpeggio)et=this.currentVoiceEntry.Arpeggio;else{let H=!1;for(const nt of this.currentStaffEntry.VoiceEntries)if(nt.Arpeggio){H=!0,et=nt.Arpeggio;break}if(!H){let nt=Xe.ARPEGGIO_DIRECTIONLESS;const K=L.attribute("direction");if(K)switch(K.value){case"up":nt=Xe.ROLL_UP;break;case"down":nt=Xe.ROLL_DOWN;break;default:nt=Xe.ARPEGGIO_DIRECTIONLESS}et=new zc(this.currentVoiceEntry,nt),this.currentVoiceEntry.Arpeggio=et}}et.addNote(this.currentNote)}const k=P.elements("tied");k.length>0&&this.addTie(k,h,c,Fs.SIMPLE);const v=P.elements("slide");v.length>0&&this.addTie(v,h,c,Fs.SLIDE);const G=P.element("technical");if(G){const et=G.elements("hammer-on");et.length>0&&this.addTie(et,h,c,Fs.HAMMERON);const H=G.elements("pull-off");H.length>0&&this.addTie(H,h,c,Fs.PULLOFF)}}t.element("time-modification")!==void 0&&!C&&this.handleTimeModificationNode(t)}catch(E){j.warn(E);const C=Tt.translateText("ReaderErrorMessages/NoteError","Ignored erroneous Note.");this.musicSheet.SheetErrors.pushMeasureError(C),this.musicSheet.SheetErrors.pushMeasureError(E)}return this.currentNote}checkForStaffEntryLink(t,e,i,s){const r=new Kc(this.currentVoiceEntry);r.LinkStaffEntries.push(i),i.Link=r;const o=this.currentVoiceEntry.Timestamp.clone(),a=s.getVerticalContainerByTimestamp(o);return i=a.StaffEntries[t],i||(i=new we(a,e),a.StaffEntries[t]=i),i.VoiceEntries.push(this.currentVoiceEntry),r.LinkStaffEntries.push(i),i.Link=r,i}checkForOpenBeam(){this.openBeams.length>0&&this.currentNote&&this.handleOpenBeam()}checkOpenTies(){const t=this.openTieDict;for(const e in t)if(t.hasOwnProperty(e)){const i=t[e];W.plus(i.StartNote.ParentStaffEntry.Timestamp,i.Duration).lt(i.StartNote.SourceMeasure.Duration)&&delete t[e]}}hasVoiceEntry(){return this.currentVoiceEntry!==void 0}readArticulations(t,e,i){const s=t.element("articulations");s&&this.articulationReader.addArticulationExpression(s,e);const r=t.element("fermata");r&&this.articulationReader.addFermata(r,e);const o=t.element("technical");o&&this.articulationReader.addTechnicalArticulations(o,e,i);const a=t.element("ornaments");a&&this.articulationReader.addOrnament(a,e)}addSingleNote(t,e,i,s,r,o,a,l,h,c,u,f,d,p,g,m){let S=0,b,y=yt.NONE,x=ut.C,w=ut.C,T=0,E=0,C,P,I;const F=t.elements();for(let K=0,lt=F.length;K<lt;++K){const A=F[K];try{if(A.name==="pitch"){const B=A.elements();for(let ot=0,rt=B.length;ot<rt;++ot){const J=B[ot];P=void 0,I=void 0;try{if(J.name==="step"){if(x=ut[J.value],x===void 0){const ct=Tt.translateText("ReaderErrorMessages/NotePitchError","Invalid pitch while reading note.");throw this.musicSheet.SheetErrors.pushMeasureError(ct),new Ee(ct,void 0)}}else if(J.name==="alter"){if(S=parseFloat(J.value),isNaN(S)){const ct=Tt.translateText("ReaderErrorMessages/NoteAlterationError","Invalid alteration while reading note.");throw this.musicSheet.SheetErrors.pushMeasureError(ct),new Ee(ct,void 0)}y=Kt.AccidentalFromHalfTones(S)}else if(J.name==="octave"&&(T=parseInt(J.value,10),isNaN(T))){const ct=Tt.translateText("ReaderErrorMessages/NoteOctaveError","Invalid octave value while reading note.");throw this.musicSheet.SheetErrors.pushMeasureError(ct),new Ee(ct,void 0)}}catch(ct){j.info("VoiceGenerator.addSingleNote read Step: ",ct.message)}}}else if(A.name==="accidental")b=A.value,b==="natural"?y=yt.NATURAL:b==="slash-flat"?y=yt.SLASHFLAT:b==="slash-quarter-sharp"?y=yt.SLASHQUARTERSHARP:b==="slash-sharp"?y=yt.SLASHSHARP:b==="double-slash-flat"?y=yt.DOUBLESLASHFLAT:b==="sori"?y=yt.SORI:b==="koron"&&(y=yt.KORON);else if(A.name==="unpitched"){const B=A.element("display-step"),ot=A.element("display-octave");if(ot&&(T=parseInt(ot.value,10),E=T-3,a&&(T+=1),this.instrument.Staves[0].StafflineCount===1&&(E+=1)),B){x=ut[B.value.toUpperCase()];let rt=0,J=this.musicSheet.Rules.PercussionXMLDisplayStepNoteValueShift;this.instrument.Staves[0].StafflineCount===1&&(J-=3),[w,rt]=Kt.lineShiftFromNoteEnum(x,J),E+=rt}}else A.name==="instrument"?A.firstAttribute&&(C=A.firstAttribute.value):A.name==="notehead"&&(P=A.value,A.attribute("filled")&&(I=A.attribute("filled").value==="yes"))}catch(B){j.info("VoiceGenerator.addSingleNote: ",B)}}T-=Kt.OctaveXmlDifference;const L=new Kt(x,T,y,b),k=W.createFromFraction(e);let v,G=-1,et=-1;const H=[],nt=t.element("notations");if(nt){const K=nt.element("technical");if(K){const lt=K.element("string");lt&&(G=parseInt(lt.value,10));const A=K.element("fret");A&&(et=parseInt(A.value,10)),K.elements("bend").forEach(function(ot){const rt=ot.element("bend-alter");ot.element("release")!==void 0?H.push({bendalter:parseInt(rt.value,10),direction:"down"}):H.push({bendalter:parseInt(rt.value,10),direction:"up"})})}}return G<0||et<0?v=new Cn(this.currentVoiceEntry,this.currentStaffEntry,k,L,this.currentMeasure):v=new Xu(this.currentVoiceEntry,this.currentStaffEntry,k,L,this.currentMeasure,G,et,H),this.addNoteInfo(v,i,l,h,r,w,E,p,p),v.TypeLength=s,v.IsGraceNote=c,v.StemDirectionXml=u,v.TremoloStrokes=f,v.PlaybackInstrumentId=C,(P!==void 0&&P!=="normal"||I!==void 0)&&(v.Notehead=new So(v,P,I)),v.NoteheadColorXml=p,v.NoteheadColor=p,v.PlaybackInstrumentId=C,v.TremoloType=g,v.glissandoType=m,this.currentVoiceEntry.addNote(v),u===Ft.None&&(d="#00000000"),this.currentVoiceEntry.StemDirectionXml=u,d&&(this.currentVoiceEntry.StemColorXml=d,this.currentVoiceEntry.StemColor=d,v.StemColorXml=d),t.elements("beam")&&!o&&this.createBeam(t,v),v}addRestNote(t,e,i,s,r,o,a){const l=W.createFromFraction(e),h=t.element("display-step"),c=t.element("display-octave");let u,f,d;h&&c&&(u=ut[h.value.toUpperCase()],f=parseInt(c.value,10),d=new Kt(u,f,yt.NONE));const p=new Cn(this.currentVoiceEntry,this.currentStaffEntry,l,d,this.currentMeasure,!0);return this.addNoteInfo(p,i,r,o,s,u,f,a,a),this.currentVoiceEntry.Notes.push(p),this.openBeams.length>0&&this.openBeams.last().ExtendedNoteList.push(p),p}addNoteInfo(t,e,i,s,r,o,a,l,h){t.NoteTypeXml=e,t.PrintObject=i,t.IsCueNote=s,t.NormalNotes=r,t.displayStepUnpitched=o,t.displayOctaveUnpitched=a,t.NoteheadColorXml=l,t.NoteheadColor=l}createBeam(t,e){var i;try{const s=t.element("beam");let r;if(s!==void 0&&s.hasAttributes&&(r=s.attribute("number")),r){let o=parseInt(r.value,10);const a=t.elements("beam"),l=a[0].value;a&&(l==="begin"?(o===((i=this.openBeams.last())==null?void 0:i.BeamNumber)?(this.beamNumberOffset++,o+=this.beamNumberOffset):this.openBeams.last()&&this.handleOpenBeam(),this.openBeams.push(new Hc(o,this.beamNumberOffset))):o+=this.beamNumberOffset);let h=!1;if(!(o>0&&o<=this.openBeams.length)||!this.openBeams[o-1]){j.debug("[OSMD] invalid beamnumber");return}for(let c=0,u=this.openBeams[o-1].Notes.length;c<u;++c){const f=this.openBeams[o-1].Notes[c];this.currentVoiceEntry===f.ParentVoiceEntry&&(h=!0)}h||(this.openBeams[o-1].addNoteToBeam(e),l==="end"&&this.endBeam())}}catch(s){const r=Tt.translateText("ReaderErrorMessages/BeamError","Error while reading beam.");throw this.musicSheet.SheetErrors.pushMeasureError(r),new Ee("",s)}}endBeam(){this.openBeams.pop(),this.beamNumberOffset=Math.max(0,this.beamNumberOffset-1)}handleOpenBeam(){const t=this.openBeams.last();if(t.Notes.length===0){this.endBeam();return}if(t.Notes.length===1){const e=t.Notes[0];e.NoteBeam=void 0,this.endBeam();return}if(this.currentNote===Ti.last(t.Notes))this.endBeam();else{const i=Ti.last(t.Notes).ParentStaffEntry,s=this.currentMeasure.getVerticalContainerIndexByTimestamp(i.Timestamp),r=i.VerticalContainerParent.StaffEntries.indexOf(i);if(s<this.currentMeasure.VerticalSourceStaffEntryContainers.length-1){const o=this.currentMeasure.VerticalSourceStaffEntryContainers[s+1].StaffEntries[r];if(o)for(let a=0,l=o.VoiceEntries.length;a<l;++a){const h=o.VoiceEntries[a];if(h.ParentVoice===this.voice){const c=h.Notes[0];c.Length.lte(new W(1,8))?(this.openBeams.last().addNoteToBeam(c),this.endBeam()):this.endBeam()}}}else this.endBeam()}}addTuplet(t,e){let i=!1;if(e!==void 0&&e.length>1){let s=t.element("time-modification");s&&(s=s.element("actual-notes"));const r=e;for(let o=0,a=r.length;o<a;++o){const l=r[o];if(l!==void 0&&l.attributes()){const h=l.attribute("bracket");h&&h.value==="yes"&&(i=!0);const c=l.attribute("type");if(c&&c.value==="start"){let u=1;l.attribute("number")&&(u=parseInt(l.attribute("number").value,10));let f=0;if(s&&(f=parseInt(s.value,10),isNaN(f))){const m=Tt.translateText("ReaderErrorMessages/TupletNoteDurationError","Invalid tuplet note duration.");throw this.musicSheet.SheetErrors.pushMeasureError(m),new Ee(m,void 0)}const d=new Qo(f,i);d.tupletLabelNumberPlacement=z.Above;const p=l.attribute("placement");p&&(p.value==="below"&&(d.tupletLabelNumberPlacement=z.Below),d.PlacementFromXml=!0),this.tupletDict[u]&&(delete this.tupletDict[u],Object.keys(this.tupletDict).length===0?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--),this.tupletDict[u]=d;const g=[];g.push(this.currentNote),d.Notes.push(g),d.Fractions.push(this.getTupletNoteDurationFromType(t)),this.currentNote.NoteTuplet=d,this.openTupletNumber=u}else if(c.value==="stop"){let u=1;l.attribute("number")&&(u=parseInt(l.attribute("number").value,10));const f=this.tupletDict[u];if(f){const d=l.attribute("placement");d&&(d.value==="below"?f.tupletLabelNumberPlacement=z.Below:f.tupletLabelNumberPlacement=z.Above,f.PlacementFromXml=!0);const p=[];if(p.push(this.currentNote),f.Notes.push(p),!f.PlacementFromXml){let g=!1;for(const m of f.Notes){for(const S of m)if(!S.isRest()){S.StemDirectionXml===Ft.Down?f.tupletLabelNumberPlacement=z.Below:f.tupletLabelNumberPlacement=z.Above,g=!0;break}if(g)break}}f.Fractions.push(this.getTupletNoteDurationFromType(t)),this.currentNote.NoteTuplet=f,delete this.tupletDict[u],Object.keys(this.tupletDict).length===0?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--}}}}}else if(e[0]){const s=e[0];if(s.hasAttributes){const r=s.attribute("type").value;let o=1;s.attribute("number")&&(o=parseInt(s.attribute("number").value,10));const a=isNaN(o),l=s.attribute("bracket");if(l&&l.value==="yes"&&(i=!0),r==="start"){let h=0,c=t.element("time-modification");if(c&&(c=c.element("actual-notes")),c&&(h=parseInt(c.value,10),isNaN(h))){const p=Tt.translateText("ReaderErrorMessages/TupletNoteDurationError","Invalid tuplet note duration.");throw this.musicSheet.SheetErrors.pushMeasureError(p),new Ee(p)}a&&(this.openTupletNumber++,o=this.openTupletNumber);let u=this.tupletDict[o];u||(u=this.tupletDict[o]=new Qo(h,i),u.tupletLabelNumberPlacement=z.Above);const f=s.attribute("placement");f&&(f.value==="below"?u.tupletLabelNumberPlacement=z.Below:u.tupletLabelNumberPlacement=z.Above,u.PlacementFromXml=!0);const d=[];d.push(this.currentNote),u.Notes.push(d),u.Fractions.push(this.getTupletNoteDurationFromType(t)),this.currentNote.NoteTuplet=u,this.openTupletNumber=o}else if(r==="stop"){a&&(o=this.openTupletNumber);const h=this.tupletDict[this.openTupletNumber];if(h){const c=s.attribute("placement");c&&(c.value==="below"?h.tupletLabelNumberPlacement=z.Below:h.tupletLabelNumberPlacement=z.Above,h.PlacementFromXml=!0);const u=[];if(u.push(this.currentNote),h.Notes.push(u),!h.PlacementFromXml){let f=!1;for(const d of h.Notes){for(const p of d)if(!p.isRest()){p.StemDirectionXml===Ft.Down?h.tupletLabelNumberPlacement=z.Below:h.tupletLabelNumberPlacement=z.Above,f=!0;break}if(f)break}}h.Fractions.push(this.getTupletNoteDurationFromType(t)),this.currentNote.NoteTuplet=h,Object.keys(this.tupletDict).length===0?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--,delete this.tupletDict[o]}}}}return this.openTupletNumber}handleTimeModificationNode(t){if(this.tupletDict[this.openTupletNumber])try{const e=this.tupletDict[this.openTupletNumber],i=Ti.last(e.Notes),s=i[0].ParentVoiceEntry;let r;s.Timestamp.Equals(this.currentVoiceEntry.Timestamp)?r=i:(r=[],e.Notes.push(r),e.Fractions.push(this.getTupletNoteDurationFromType(t))),r.push(this.currentNote),this.currentNote.NoteTuplet=e}catch(e){const i=Tt.translateText("ReaderErrorMessages/TupletNumberError","Invalid tuplet number.");throw this.musicSheet.SheetErrors.pushMeasureError(i),e}else if(this.currentVoiceEntry.Notes.length>0){const e=this.currentVoiceEntry.Notes[0];if(e.NoteTuplet){const i=e.NoteTuplet;Ti.last(i.Notes).push(this.currentNote),this.currentNote.NoteTuplet=i}}}addTie(t,e,i,s){if(t){if(t.length===1){const r=t[0];if(r!==void 0&&r.attributes()){const o=this.getTieDirection(r),a=r.attribute("type").value;try{if(a==="start"){const l=this.findCurrentNoteInTieDict(this.currentNote);l<0&&delete this.openTieDict[l];const h=this.getNextAvailableNumberForTie(),c=new qc(this.currentNote,s);this.openTieDict[h]=c,c.TieNumber=h,c.TieDirection=o}else if(a==="stop"){const l=this.findCurrentNoteInTieDict(this.currentNote),h=this.openTieDict[l];h&&(h.AddNote(this.currentNote),delete this.openTieDict[l])}}catch{const h=Tt.translateText("ReaderErrorMessages/TieError","Error while reading tie.");this.musicSheet.SheetErrors.pushMeasureError(h)}}}else if(t.length===2){const r=this.findCurrentNoteInTieDict(this.currentNote);if(r>=0){const o=this.openTieDict[r];o.AddNote(this.currentNote);for(const a of t)if(a.attribute("type").value==="start"){const h=this.getTieDirection(a);o.NoteIndexToTieDirection[o.Notes.length-1]=h}}}}}getTieDirection(t){let e=z.NotYetDefined;const i=t.attribute("placement");i&&(i.value==="above"?e=z.Above:i.value==="below"&&(e=z.Below));const s=t.attribute("orientation");return s&&(s.value==="over"?e=z.Above:s.value==="under"&&(e=z.Below)),e}getNextAvailableNumberForTie(){const t=Object.keys(this.openTieDict);if(t.length===0)return 1;t.sort((e,i)=>+e-+i);for(let e=0;e<t.length;e++)if(""+(e+1)!==t[e])return e+1;return+t[t.length-1]+1}findCurrentNoteInTieDict(t){const e=this.openTieDict;for(const i in e)if(e.hasOwnProperty(i)){const s=e[i],r=s.Notes[0],o=t;if(s.Pitch.FundamentalNote===t.Pitch.FundamentalNote&&s.Pitch.Octave===t.Pitch.Octave)return parseInt(i,10);if(r.StringNumberTab!==void 0&&r.StringNumberTab===o.StringNumberTab)return parseInt(i,10)}return-1}getTupletNoteDurationFromType(t){if(t.element("type")){const e=t.element("type");if(e){const i=e.value;try{return ws.getNoteDurationFromType(i)}catch(s){const r=Tt.translateText("ReaderErrorMessages/NoteDurationError","Invalid note duration.");throw this.musicSheet.SheetErrors.pushMeasureError(r),new Ee("",s)}}}}}class Yu{static readChordSymbol(t,e,i){const s=t.element("root"),r=t.element("kind"),o=r.attribute("text");if(!s||!r)return;const a=s.element("root-step"),l=s.element("root-alter");if(!a)return;let h;try{h=ut[a.value.trim()]}catch(b){const y=Tt.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");e.SheetErrors.pushMeasureError(y),j.debug("InstrumentReader.readChordSymbol",y,b);return}let c=yt.NONE;if(l)try{c=Kt.AccidentalFromHalfTones(parseInt(l.value,10))}catch(b){const y=Tt.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");e.SheetErrors.pushMeasureError(y),j.debug("InstrumentReader.readChordSymbol",y,b)}const u=new Kt(h,1,c);let f=r.value.trim().replace("-","");if(o)switch(o.value){case"aug":f="augmented";break;case"dim":f="diminished";break}let d;try{d=Jt[f]}catch(b){const y=Tt.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");e.SheetErrors.pushMeasureError(y),j.debug("InstrumentReader.readChordSymbol",y,b);return}let p;const g=t.element("bass");if(g){const b=g.element("bass-step"),y=g.element("bass-alter");let x=ut.C;if(b)try{x=ut[b.value.trim()]}catch(T){const E=Tt.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");e.SheetErrors.pushMeasureError(E),j.debug("InstrumentReader.readChordSymbol",E,T);return}let w=yt.NONE;if(y)try{w=Kt.AccidentalFromHalfTones(parseInt(y.value,10))}catch(T){const E=Tt.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");e.SheetErrors.pushMeasureError(E),j.debug("InstrumentReader.readChordSymbol",E,T)}p=new Kt(x,1,w)}const m=[],S=t.elements("degree");for(const b of S)if(b){const y=b.element("degree-value"),x=b.element("degree-alter"),w=b.element("degree-type");if(!y||!x||!w)return;let T;try{T=parseInt(y.value.trim(),10)}catch(P){const I=Tt.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");e.SheetErrors.pushMeasureError(I),j.debug("InstrumentReader.readChordSymbol",I,P);return}let E;try{E=Kt.AccidentalFromHalfTones(parseInt(x.value,10))}catch(P){const I=Tt.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");e.SheetErrors.pushMeasureError(I),j.debug("InstrumentReader.readChordSymbol",I,P);return}let C;try{C=zs[w.value.trim().toLowerCase()]}catch(P){const I=Tt.translateText("ReaderErrorMessages/ChordSymbolError","Invalid chord symbol");e.SheetErrors.pushMeasureError(I),j.debug("InstrumentReader.readChordSymbol",I,P);return}m.push(new fu(T,E,C))}return new Ka(u,d,p,m,e.Rules)}}class ca{constructor(t=!1,e=!0){this.ChangeEnd=!1,this.ChangeBegin=!1,this.line=t,this.sign=e}get IsLine(){return this.line}get IsSign(){return this.sign}}class ju extends Ii{constructor(t){super(t)}}class Ku{constructor(t,e,i){this.openContinuousDynamicExpressions=[],this.musicSheet=t,this.staffNumber=i,this.globalStaffIndex=t.getGlobalStaffIndexOfFirstStaff(e)+(i-1),this.initialize()}readExpressionParameters(t,e,i,s,r,o,a){this.initialize();const l=t.element("offset");if(l!==void 0&&!a)try{this.offsetDivisions=parseInt(l.value,10)}catch(u){const f="ReaderErrorMessages/ExpressionOffsetError, Invalid expression offset -> set to default.";j.debug("ExpressionReader.readExpressionParameters",f,u),this.musicSheet.SheetErrors.pushMeasureError(f),this.offsetDivisions=0}this.directionTimestamp=W.createFromFraction(s);let h=new W(Math.abs(this.offsetDivisions),i*4);this.offsetDivisions>0?s.RealValue>0?(h=W.multiply(W.minus(s,r),h),this.directionTimestamp=W.plus(h,s)):this.directionTimestamp=W.createFromFraction(h):this.offsetDivisions<0&&(s.RealValue>0?(h=W.multiply(W.minus(s,r),h),this.directionTimestamp=W.minus(s,h)):this.directionTimestamp=W.createFromFraction(h));const c=t.attribute("placement");if(c)try{const u=c.value;u==="below"?this.placement=z.Below:u==="above"&&(this.placement=z.Above)}catch(u){const f=Tt.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement -> set to default.");j.debug("ExpressionReader.readExpressionParameters",f,u),this.musicSheet.SheetErrors.pushMeasureError(f),this.placement=z.Below}if(this.placement===z.NotYetDefined)try{const u=t.element("direction-type");if(u){const f=u.element("dynamics");if(f){const m=f.attribute("default-y");m&&this.readExpressionPlacement(m,"read dynamics y pos")}const d=u.element("wedge");if(d){const m=d.attribute("default-y");m&&this.readExpressionPlacement(m,"read wedge y pos")}const p=u.element("words");if(p){const m=p.attribute("default-y");m&&this.readExpressionPlacement(m,"read words y pos")}const g=u.element("rehearsal");if(g){const m=g.attribute("default-y");m&&this.readExpressionPlacement(m,"read rehearsal pos")}}}catch(u){const f=Tt.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement -> set to default.");j.debug("ExpressionReader.readExpressionParameters",f,u),this.musicSheet.SheetErrors.pushMeasureError(f),this.placement=z.Below}this.placement===z.NotYetDefined&&(e.Staves.length>1?this.placement=z.Below:e.HasLyrics?this.placement=z.Above:this.placement=z.Below)}read(t,e,i,s=void 0,r=0){let o=!1,a=!1;const l=t.element("sound");if(l){const u=l.attribute("tempo"),f=l.attribute("dynamics");if(u){const d=u.value.match(/^(\d+)(\.\d+)?$/);(d==null?void 0:d.length)>0?this.soundTempo=Math.round(Number.parseFloat(u.value)):(j.info("invalid xml tempo: "+u.value),this.soundTempo=100),e.TempoInBPM=this.soundTempo,this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,o=!0}if(f){const d=f.value.match(/\d+/);this.soundDynamic=d!==void 0?parseInt(d[0],10):100,a=!0}}const h=t.element("direction-type");if(!h)return;let c=h.element("metronome");if(c){e.metronomeNoteIndex=r;const u=c.element("beat-unit"),f=c.element("beat-unit-dot")!==void 0,d=c.element("per-minute");if(u!==void 0&&d){c.hasAttributes&&c.attribute("default-x")!==void 0&&(this.directionTimestamp=W.createFromFraction(i));const g=parseFloat(d.value);this.createNewTempoExpressionIfNeeded(e);const m=new qt(void 0,this.placement,this.staffNumber,g,this.currentMultiTempoExpression,!0);m.parentMeasure=e,this.soundTempo=g,e.TempoInBPM=this.soundTempo*(f?1.5:1),this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),e.MeasureNumberXML===1&&this.musicSheet.SourceMeasures.length===0&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,m.dotted=f,m.beatUnit=u.value,this.currentMultiTempoExpression.addExpression(m,""),this.currentMultiTempoExpression.CombinedExpressionsText="test"}return}if(c=h.element("dynamics"),c){const u=t.element("notations")!==void 0;this.interpretInstantaneousDynamics(c,e,i,u);return}if(c=h.element("words"),c){const u=h.elements("words");let f="";for(const d of u)f+=d.value;if(c.value=f,o||ps(c.value)||An(c.value)){this.createNewTempoExpressionIfNeeded(e),this.currentMultiTempoExpression.CombinedExpressionsText=c.value,(ps(c.value)||An(c.value))&&(c.value=void 0);const d=new qt(c.value,this.placement,this.staffNumber,this.soundTempo,this.currentMultiTempoExpression);this.currentMultiTempoExpression.addExpression(d,"")}else a||this.interpretWords(c,e,i);return}if(c=h.element("wedge"),c){this.interpretWedge(c,e,s,e.MeasureNumber);return}if(c=h.element("rehearsal"),c){this.interpretRehearsalMark(c,e,i,e.MeasureNumber);return}}closeOpenExpressions(t,e){for(const i of this.openContinuousDynamicExpressions)this.createNewMultiExpressionIfNeeded(t,i.NumberXml,e),this.closeOpenContinuousDynamic(i,t,e);this.openContinuousTempoExpression&&this.closeOpenContinuousTempo(W.plus(t.AbsoluteTimestamp,e))}addOctaveShift(t,e,i){var a;let s=1;const r=t.element("staff");if(r)try{s=parseInt(r.value,10)}catch(l){const h=Tt.translateText("ReaderErrorMessages/OctaveShiftStaffError","Invalid octave shift staff number -> set to default");this.musicSheet.SheetErrors.pushMeasureError(h),s=1,j.debug("ExpressionReader.addOctaveShift",h,l)}const o=t.element("direction-type");if(o){const l=o.element("octave-shift"),h=this.readPlacement(t);if(l!==void 0&&l.hasAttributes)try{const c=this.readNumber(l);if(l.attribute("size")){const u=parseInt(l.attribute("size").value,10);let f=0;u===8?f=1:u===15&&(f=2);let d=(a=l.attribute("type"))==null?void 0:a.value;if(d||(h===z.Above?d="down":h===z.Below&&(d="up")),d==="up"||d==="down"){const p=new _n(d,f);p.StaffNumber=s,this.getMultiExpression=this.createNewMultiExpressionIfNeeded(e,c),this.getMultiExpression.OctaveShiftStart=p,p.ParentStartMultiExpression=this.getMultiExpression,this.openOctaveShift=p}else if(d==="stop"){if(this.openOctaveShift){this.getMultiExpression=this.createNewMultiExpressionIfNeeded(e,this.openOctaveShift.numberXml,i);const p=this.getMultiExpression;p.OctaveShiftEnd=this.openOctaveShift,this.openOctaveShift.ParentEndMultiExpression=this.getMultiExpression,this.openOctaveShift=void 0}}else d||j.debug("octave-shift missing type in xml")}}catch(c){const u=Tt.translateText("ReaderErrorMessages/OctaveShiftError","Error while reading octave shift.");this.musicSheet.SheetErrors.pushMeasureError(u),j.debug("ExpressionReader.addOctaveShift",u,c)}}}addPedalMarking(t,e,i){var r,o,a,l;const s=t.element("direction-type");if(s){const h=s.element("pedal");if(h!==void 0&&h.hasAttributes){let c=!1,u=!1;try{switch(((r=h.attribute("line"))==null?void 0:r.value)==="yes"?u=!0:((o=h.attribute("line"))==null?void 0:o.value)==="no"&&(u=!1,c=!0),((a=h.attribute("sign"))==null?void 0:a.value)==="yes"?c=!0:((l=h.attribute("sign"))==null?void 0:l.value)==="no"&&(c=!1,u=!0),h.attribute("type").value){case"start":this.openPedal&&this.openPedal.IsLine&&this.endOpenPedal(e),this.createNewMultiExpressionIfNeeded(e,-1),this.openPedal=new ca(u,c),this.getMultiExpression.PedalStart=this.openPedal,this.openPedal.ParentStartMultiExpression=this.getMultiExpression;break;case"stop":this.openPedal&&this.endOpenPedal(e);break;case"change":this.openPedal&&this.openPedal.IsLine&&(this.openPedal.ChangeEnd=!0,this.createNewMultiExpressionIfNeeded(e,-1),this.getMultiExpression.PedalEnd=this.openPedal,this.openPedal.ParentEndMultiExpression=this.getMultiExpression,this.createNewMultiExpressionIfNeeded(e,-1),this.openPedal=new ca(u,c),this.openPedal.ChangeBegin=!0,this.getMultiExpression.PedalStart=this.openPedal,this.openPedal.ParentStartMultiExpression=this.getMultiExpression);break;case"continue":break;default:break}}catch(f){const d=Tt.translateText("ReaderErrorMessages/PedalError","Error while reading pedal.");this.musicSheet.SheetErrors.pushMeasureError(d),j.debug("ExpressionReader.addPedalMarking",d,f)}}}}endOpenPedal(t){this.createNewMultiExpressionIfNeeded(t,-1),this.getMultiExpression.PedalEnd=this.openPedal,this.openPedal.ParentEndMultiExpression=this.getMultiExpression,this.openPedal=void 0}addWavyLine(t,e,i,s){if(t&&t.hasAttributes)try{switch(t.attribute("type").value){case"start":this.createNewMultiExpressionIfNeeded(e,-1),this.openWavyLine=new ju(this.placement),this.getMultiExpression.WavyLineStart=this.openWavyLine,this.openWavyLine.ParentStartMultiExpression=this.getMultiExpression;break;case"stop":this.openWavyLine&&(this.createNewMultiExpressionIfNeeded(e,-1,i),this.getMultiExpression.WavyLineEnd=this.openWavyLine,this.openWavyLine.ParentEndMultiExpression=this.getMultiExpression,this.openWavyLine=void 0);break;case"continue":break;default:break}}catch(r){const o=Tt.translateText("ReaderErrorMessages/WavyLineError","Error while reading wavy-line.");this.musicSheet.SheetErrors.pushMeasureError(o),j.debug("ExpressionReader.addWavyLine",o,r)}}initialize(){this.placement=z.NotYetDefined,this.soundTempo=0,this.soundDynamic=0,this.offsetDivisions=0}readPlacement(t){var i;const e=(i=t.attribute("placement"))==null?void 0:i.value;return e==="above"?z.Above:e==="below"?z.Below:z.NotYetDefined}readExpressionPlacement(t,e){try{const i=parseInt(t.value,10);i<0?this.placement=z.Below:i>0&&(this.placement=z.Above)}catch(i){j.debug("ExpressionReader.readExpressionParameters",e,i)}}interpretInstantaneousDynamics(t,e,i,s){if(t.hasElements){t.hasAttributes&&t.attribute("default-x")&&(this.directionTimestamp=W.createFromFraction(i));const r=this.readNumber(t);let o=t.elements()[0].name;if(o==="other-dynamics"&&(o=t.elements()[0].value),o){s?this.createNewMultiExpressionIfNeeded(e,r,W.createFromFraction(i)):this.createNewMultiExpressionIfNeeded(e,r);const a=new Ai(o,this.soundDynamic,this.placement,this.staffNumber,e);a.InMeasureTimestamp=i.clone(),this.getMultiExpression.addExpression(a,""),this.initialize(),this.activeInstantaneousDynamic?this.activeInstantaneousDynamic.DynEnum=a.DynEnum:this.activeInstantaneousDynamic=new Ai(o,0,z.NotYetDefined,1,e)}}}interpretWords(t,e,i){const s=t.value;let r;const o=t.attribute("font-style");if(o&&o.value==="italic"&&(r=ue.Italic),s.length>0){if(t.hasAttributes&&t.attribute("default-x")&&(this.directionTimestamp=W.createFromFraction(i)),this.checkIfWordsNodeIsRepetitionInstruction(s))return;this.fillMultiOrTempoExpression(s,e,i,r),this.initialize()}}readNumber(t){var s;let e=1;const i=(s=t.attribute("number"))==null?void 0:s.value;return i&&(e=Number.parseInt(i,10)),e}interpretWedge(t,e,i,s){var o,a;t!==void 0&&t.hasAttributes&&t.attribute("default-x")&&(this.directionTimestamp=W.createFromFraction(i));const r=this.readNumber(t);((a=(o=t.attribute("type"))==null?void 0:o.value)==null?void 0:a.toLowerCase())==="stop"?this.createNewMultiExpressionIfNeeded(e,r,i):this.createNewMultiExpressionIfNeeded(e,r),this.addWedge(t,e,i),this.initialize()}interpretRehearsalMark(t,e,i,s){e.rehearsalExpression=new lu(t.value,this.placement)}createNewMultiExpressionIfNeeded(t,e,i=void 0){i||(i=this.directionTimestamp);let s=this.getMultiExpression;return(!s||s&&(s.SourceMeasureParent!==t||s.numberXml!==e||s.SourceMeasureParent===t&&s.Timestamp!==i))&&(this.getMultiExpression=s=new nu(t,W.createFromFraction(i)),t.StaffLinkedExpressions[this.globalStaffIndex].push(s)),s}createNewTempoExpressionIfNeeded(t){(!this.currentMultiTempoExpression||this.currentMultiTempoExpression.SourceMeasureParent!==t||this.currentMultiTempoExpression.Timestamp!==this.directionTimestamp)&&(this.currentMultiTempoExpression=new ou(t,W.createFromFraction(this.directionTimestamp)),t.TempoExpressions.push(this.currentMultiTempoExpression))}addWedge(t,e,i){if(t!==void 0&&t.hasAttributes){const s=this.readNumber(t),r=t.attribute("type").value.toLowerCase();try{if(r==="crescendo"||r==="diminuendo"){const o=new ei(Re[r],this.placement,this.staffNumber,e,this.activeInstantaneousDynamic,s);this.openContinuousDynamicExpressions.push(o);let a=this.getMultiExpression;a||(a=this.createNewMultiExpressionIfNeeded(e,s)),a.StartingContinuousDynamic=o,o.StartMultiExpression=a,this.activeInstantaneousDynamic!==void 0&&this.activeInstantaneousDynamic.StaffNumber===o.StaffNumber&&(this.activeInstantaneousDynamic=void 0)}else if(r==="stop")for(const o of this.openContinuousDynamicExpressions)o.NumberXml===s&&o.NumberXml===s&&this.closeOpenContinuousDynamic(o,e,i)}catch(o){const a="ReaderErrorMessages/WedgeError, Error while reading Crescendo / Diminuendo.";this.musicSheet.SheetErrors.pushMeasureError(a),j.debug("ExpressionReader.addWedge",a,o)}}}fillMultiOrTempoExpression(t,e,i,s){if(!t)return;const r=t.trim();this.createExpressionFromString("",r,e,i,t,s)}createExpressionFromString(t,e,i,s,r,o){if(qt.isInputStringInstantaneousTempo(e)||Ni.isInputStringContinuousTempo(e)){if(i.TempoExpressions.length>0)for(let c=0,u=i.TempoExpressions.length;c<u;++c){const f=i.TempoExpressions[c];if(f.Timestamp===this.directionTimestamp&&f.InstantaneousTempo!==void 0&&f.InstantaneousTempo.Label.indexOf(e)!==-1)return!1}if(this.createNewTempoExpressionIfNeeded(i),this.currentMultiTempoExpression.CombinedExpressionsText=r,qt.isInputStringInstantaneousTempo(e)){const c=new qt(e,this.placement,this.staffNumber,this.soundTempo,this.currentMultiTempoExpression);return this.currentMultiTempoExpression.addExpression(c,t),!0}if(Ni.isInputStringContinuousTempo(e)){const c=new Ni(e,this.placement,this.staffNumber,this.currentMultiTempoExpression);return this.currentMultiTempoExpression.addExpression(c,t),!0}}if(ei.isInputStringContinuousDynamic(e)){const c=new ei(void 0,this.placement,this.staffNumber,i,this.activeInstantaneousDynamic,-1,e),u=this.getMultiExpression;return u&&this.closeOpenContinuousDynamic(u.StartingContinuousDynamic,i,s),this.createNewMultiExpressionIfNeeded(i,-1),this.activeInstantaneousDynamic!==void 0&&this.activeInstantaneousDynamic.StaffNumber===c.StaffNumber&&(this.activeInstantaneousDynamic=void 0),this.openContinuousDynamicExpressions.push(c),c.StartMultiExpression=this.getMultiExpression,this.getMultiExpression.addExpression(c,t),!0}if(kt.isInputStringMood(e)){const c=this.createNewMultiExpressionIfNeeded(i,-1);i.hasMoodExpressions=!0;const u=new kt(e,this.placement,this.staffNumber);return u.fontStyle=o,c.addExpression(u,t),!0}const a=this.createNewMultiExpressionIfNeeded(i,-1);if(i.TempoExpressions.length>0)for(let c=0,u=i.TempoExpressions.length;c<u;++c){const f=i.TempoExpressions[c];if(f.Timestamp===this.directionTimestamp&&f.InstantaneousTempo!==void 0&&f.EntriesList.length>0&&!this.hasDigit(e)&&this.globalStaffIndex>0){if(f.EntriesList[0].label.indexOf(e)>=0)return!1;break}}let l=vt.CenterBottom;this.musicSheet.Rules.CompactMode&&(l=vt.LeftBottom);const h=new ms(e,this.placement,l,this.staffNumber);return h.fontStyle=o,a.addExpression(h,t),!1}closeOpenContinuousDynamic(t,e,i){if(!t)return;const s=t.NumberXml;t.EndMultiExpression=this.createNewMultiExpressionIfNeeded(e,s,i),t.StartMultiExpression.EndingContinuousDynamic=t,this.openContinuousDynamicExpressions=this.openContinuousDynamicExpressions.filter(r=>r!==t)}closeOpenContinuousTempo(t){this.openContinuousTempoExpression.AbsoluteEndTimestamp=t,this.openContinuousTempoExpression=void 0}checkIfWordsNodeIsRepetitionInstruction(t){return t=t.trim().toLowerCase(),t==="coda"||t==="tocoda"||t==="to coda"||t==="fine"||t==="d.c."||t==="dacapo"||t==="da capo"||t==="d.s."||t==="dalsegno"||t==="dal segno"||t==="d.c. al fine"||t==="d.s. al fine"||t==="d.c. al coda"||t==="d.s. al coda"}hasDigit(t){return/\d/.test(t)}}class qu{constructor(){}get StartNote(){return this.startNote}set StartNote(t){this.startNote=t}get EndNote(){return this.endNote}set EndNote(t){this.endNote=t}startNoteHasMoreStartingSlurs(){if(!this.startNote)return!1;for(let t=0,e=this.startNote.NoteSlurs.length;t<e;++t){const i=this.startNote.NoteSlurs[t];if(i!==this&&i.StartNote===this.startNote)return!0}return!1}endNoteHasMoreEndingSlurs(){if(!this.endNote)return!1;for(let t=0,e=this.endNote.NoteSlurs.length;t<e;++t){const i=this.endNote.NoteSlurs[t];if(i!==this&&i.EndNote===this.endNote)return!0}return!1}isCrossed(){return this.startNote.ParentStaffEntry.ParentStaff!==this.endNote.ParentStaffEntry.ParentStaff}isSlurLonger(){if(!this.endNote||!this.startNote)return!1;const t=W.minus(this.endNote.getAbsoluteTimestamp(),this.startNote.getAbsoluteTimestamp());for(let e=0,i=this.startNote.NoteSlurs.length;e<i;++e){const s=this.startNote.NoteSlurs[e];if(s!==this&&s.EndNote!==void 0&&s.StartNote!==void 0&&W.minus(s.EndNote.getAbsoluteTimestamp(),s.StartNote.getAbsoluteTimestamp()).CompareTo(t)===-1)return!0}for(let e=0,i=this.endNote.NoteSlurs.length;e<i;++e){const s=this.endNote.NoteSlurs[e];if(s!==this&&s.EndNote!==void 0&&s.StartNote!==void 0&&W.minus(s.EndNote.getAbsoluteTimestamp(),s.StartNote.getAbsoluteTimestamp()).CompareTo(t))return!0}return!1}}class Ju{constructor(t){this.openSlurDict={},this.musicSheet=t}addSlur(t,e){try{if(t){for(const i of t)if(i.attributes().length>0){const s=i.attribute("type").value;let r=1;try{i.attribute("number")&&(r=parseInt(i.attribute("number").value,10))}catch(h){j.debug("VoiceGenerator.addSlur number: ",h)}let o=z.NotYetDefined;const a=i.attribute("placement");a&&a.value&&(a.value==="above"?o=z.Above:a.value==="below"&&(o=z.Below));const l=i.attribute("orientation");if(l&&l.value&&(l.value==="over"?o=z.Above:l.value==="under"&&(o=z.Below)),s==="start"){let h=this.openSlurDict[r];h||(h=new qu,this.openSlurDict[r]=h),h.StartNote=e,h.PlacementXml=o}else if(s==="stop"){const h=this.openSlurDict[r];h&&(h.EndNote=e,e.checkForDoubleSlur(h)||(e.NoteSlurs.push(h),h.StartNote.NoteSlurs.push(h)),delete this.openSlurDict[r])}}}}catch{const s=Tt.translateText("ReaderErrorMessages/SlurError","Error while reading slur.");this.musicSheet.SheetErrors.pushMeasureError(s)}}}class Zu{constructor(t,e,i,s){this.voiceGeneratorsDict={},this.staffMainVoiceGeneratorDict={},this.divisions=0,this.currentClefNumber=1,this.currentXmlMeasureIndex=0,this.activeKeyHasBeenInitialized=!1,this.abstractInstructions=[],this.openChordSymbolContainers=[],this.soundTempos=new Map,this.xmlNotes=[],this.repetitionInstructionReader=e,this.xmlMeasureList=i,this.musicSheet=s.GetMusicSheet,this.instrument=s,this.activeClefs=new Array(s.Staves.length),this.activeClefsHaveBeenInitialized=new Array(s.Staves.length);for(let r=0;r<s.Staves.length;r++)this.activeClefsHaveBeenInitialized[r]=!1;this.createExpressionGenerators(s.Staves.length),this.slurReader=new Ju(this.musicSheet),this.pluginManager=t}get SoundTempos(){return this.soundTempos}get ActiveKey(){return this.activeKey}get MaxTieNoteFraction(){return this.maxTieNoteFraction}get ActiveRhythm(){return this.activeRhythm}set ActiveRhythm(t){this.activeRhythm=t}readNextXmlMeasure(t,e,i){var h,c,u,f,d,p,g,m,S,b;if(this.currentXmlMeasureIndex>=this.xmlMeasureList.length)return!1;this.currentMeasure=t,this.followingMultirestMeasures=Math.max(this.followingMultirestMeasures-1,0),this.inSourceMeasureInstrumentIndex=this.musicSheet.getGlobalStaffIndexOfFirstStaff(this.instrument),this.repetitionInstructionReader&&this.repetitionInstructionReader.prepareReadingMeasure(t,this.currentXmlMeasureIndex);let s=new W(0,1),r=new W(0,1),o=!1;this.maxTieNoteFraction=new W(0,1);let a=!1;const l=[];try{const y=this.xmlMeasureList[this.currentXmlMeasureIndex],x=y.elements();if(t.Rules.UseXMLMeasureNumbers&&!Number.isInteger(t.MeasureNumberXML)){const T=parseInt((h=y.attribute("number"))==null?void 0:h.value,10);Number.isInteger(T)&&(t.MeasureNumberXML=T)}let w;for(let T=0;T<x.length;T++){const E=x[T];if(T>0&&(w=x[T-1]),E.name==="print"){const C=E.attribute("new-system");(C==null?void 0:C.value)==="yes"&&(t.printNewSystemXml=!0);const P=E.attribute("new-page");(P==null?void 0:P.value)==="yes"&&(t.printNewPageXml=!0)}else if(E.name==="note"){E.element("grace")||(this.xmlNotes.push(E),l.push(E));let C=!0;((c=E.attribute("print-object"))==null?void 0:c.value)==="no"&&(C=!1);let P=1;this.instrument.Staves.length>1&&E.element("staff")&&(P=parseInt(E.element("staff").value,10),isNaN(P)&&(j.debug("InstrumentReader.readNextXmlMeasure.get staff number"),P=1)),this.currentStaff=this.instrument.Staves[P-1];const I=E.element("chord")!==void 0;if(E.element("voice")){const R=parseInt(E.element("voice").value,10);this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(R,P-1)}else(!I||!this.currentVoiceGenerator)&&(this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(1,P-1));let F=0,L=new W(0,1),k=2,v,G=!1;if(E.element("duration")){if(F=parseInt(E.element("duration").value,10),isNaN(F)){const R=Tt.translateText("ReaderErrorMessages/NoteDurationError","Invalid Note Duration.");this.musicSheet.SheetErrors.pushMeasureError(R),j.debug("InstrumentReader.readNextXmlMeasure",R);continue}else if(L=new W(F,4*this.divisions),F===0?L=this.getNoteDurationFromTypeNode(E):v=this.getNoteDurationFromTypeNode(E),E.element("time-modification")){L=this.getNoteDurationForTuplet(E);const R=E.element("time-modification");R!=null&&R.element("normal-notes")&&(k=parseInt(R.element("normal-notes").value,10)),G=!0}}const et=E.element("rest")!==void 0,H=E.element("notations"),nt=E.element("grace")!==void 0||F===0||I&&a;let K=!1,lt=!1;if(nt){const R=E.element("duration"),D=E.element("grace");D&&D.attributes()&&D.attribute("slash")&&D.attribute("slash").value==="yes"&&(K=!0),R||(L=this.getNoteDurationFromTypeNode(E));const Q=E.element("notations");Q&&Q.element("slur")&&(lt=!0)}let A=!1;E.element("cue")&&(A=!0);const ot=E.element("type");let rt=yo.UNDEFINED;if(ot){const R=ot.attribute("size");(R==null?void 0:R.value)==="cue"&&(A=!0),rt=ws.StringToNoteType(ot.value)}let J=Ft.Undefined,ct;const Nt=E.element("stem");if(Nt){switch(Nt.value){case"down":J=Ft.Down;break;case"up":J=Ft.Up;break;case"double":J=Ft.Double;break;case"none":J=Ft.None;break;default:J=Ft.Undefined}const R=Nt.attribute("color");R&&(ct=this.parseXmlColor(R.value))}let pt=0,dt="",Ct="";if(H){const R=H.element("ornaments");if(R){const Q=R.element("tremolo");if(Q){const U=Q.attribute("type");if(dt=U.value,U){const it=parseInt(Q.value,10);it>0&&(pt=it),(U.value==="start"||U.value==="stop")&&(L=new W(parseInt(E.element("duration").value,10),4*this.divisions))}}const $=R.elements("wavy-line");if($!==void 0)for(const U of $){const it=this.expressionReaders[this.readExpressionStaffNumber(E)-1];it&&(it.readExpressionParameters(U,this.instrument,this.divisions,s,r,this.currentMeasure.MeasureNumber,!1),it.addWavyLine(U,this.currentMeasure,s,r))}}const D=H.element("glissando");D&&D.attribute("type").value==="start"&&(Ct="start")}let Ht;const me=E.element("notehead");if(me){const R=me.attribute("color");R&&(Ht=this.parseXmlColor(R.value))}let ce;const _=E.attribute("color");_&&(ce=this.parseXmlColor(_.value),Ht||(Ht=ce),ct||(ct=ce));let Z=s.clone();I&&(Z=r.clone()),this.currentStaffEntry=this.currentMeasure.findOrCreateStaffEntry(Z,this.inSourceMeasureInstrumentIndex+P-1,this.currentStaff).staffEntry,(!this.currentVoiceGenerator.hasVoiceEntry()||!I&&!nt&&!a||nt&&!a||nt&&!I||!nt&&a)&&this.currentVoiceGenerator.createVoiceEntry(Z,this.currentStaffEntry,this.activeKey,this.ActiveRhythm,nt,K,lt),!nt&&!I&&(r=s.clone(),s.Add(L)),I&&this.currentStaffEntry!==void 0&&this.currentStaffEntry.ParentStaff!==this.currentStaff&&(this.currentStaffEntry=this.currentVoiceGenerator.checkForStaffEntryLink(this.inSourceMeasureInstrumentIndex+P-1,this.currentStaff,this.currentStaffEntry,this.currentMeasure));const Y=this.currentStaffEntry!==void 0&&this.currentStaffEntry.Timestamp!==void 0&&this.currentStaffEntry.Timestamp.Equals(new W(0,1))&&!this.currentStaffEntry.hasNotes();this.saveAbstractInstructionList(this.instrument.Staves.length,Y),this.openChordSymbolContainers.length!==0&&(this.currentStaffEntry.ChordContainers=this.openChordSymbolContainers,this.openChordSymbolContainers=[]),this.activeRhythm,!G&&!nt&&(L=new W(F,4*this.divisions));const N=E.elements("dot").length;if(this.currentVoiceGenerator.read(E,L,v,rt,k,et,this.currentStaffEntry,this.currentMeasure,e,this.maxTieNoteFraction,I,i,C,A,nt,J,pt,ct,Ht,N,dt,Ct),H!==void 0&&H.element("dynamics")){const R=this.expressionReaders[this.readExpressionStaffNumber(E)-1];R&&(R.readExpressionParameters(E,this.instrument,this.divisions,s,r,this.currentMeasure.MeasureNumber,!1),R.read(E,this.currentMeasure,r,void 0,l.length))}a=nt}else if(E.name==="attributes"){const C=E.element("divisions");if(C&&(this.divisions=parseInt(C.value,10),isNaN(this.divisions))){const F=Tt.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(j.debug("InstrumentReader.readNextXmlMeasure",F),this.divisions=this.readDivisionsFromNotes(),this.divisions>0)this.musicSheet.SheetErrors.push(F+this.instrument.Name);else throw o=!0,new Ee(F+this.instrument.Name)}if(!E.element("divisions")&&this.divisions===0&&this.currentXmlMeasureIndex===0){const F=Tt.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(this.divisions=this.readDivisionsFromNotes(),this.divisions>0)this.musicSheet.SheetErrors.push(F+this.instrument.Name);else throw o=!0,new Ee(F+this.instrument.Name)}this.addAbstractInstruction(E,i,w,s.clone()),s.Equals(new W(0,1))&&this.isAttributesNodeAtBeginOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],E)&&this.saveAbstractInstructionList(this.instrument.Staves.length,!0),this.isAttributesNodeAtEndOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],E)&&this.saveClefInstructionAtEndOfMeasure();const P=E.elements("staff-details");for(const F of P){const L=F.element("staff-lines");if(L){let k=1;const v=F.attribute("number");v&&(k=parseInt(v.value,10)),this.instrument.Staves[k-1].StafflineCount=parseInt(L.value,10)}}const I=E.element("measure-style");if(I){const F=I.element("multiple-rest");if(F){const L=F.value;let k=0;try{k=Number.parseInt(L,10),t.multipleRestMeasures!==void 0&&k!==t.multipleRestMeasures?t.multipleRestMeasures=0:(t.multipleRestMeasures=k,this.currentMultirestStartMeasure=t,this.followingMultirestMeasures=k+1)}catch(v){console.log("multirest parse error: "+v)}}}}else if(E.name==="forward"){const C=parseInt(E.element("duration").value,10);s.Add(new W(C,4*this.divisions))}else if(E.name==="backup"){const C=parseInt(E.element("duration").value,10);s.Sub(new W(C,4*this.divisions)),s.IsNegative()&&(s=new W(0,1)),r.Sub(new W(C,4*this.divisions)),r.IsNegative()&&(r=new W(0,1))}else if(E.name==="direction"){const C=E.elements("direction-type"),P=E.element("direction-type");let I=Math.min(1,s.RealValue);this.activeRhythm!==void 0&&this.activeRhythm.Rhythm&&(I/=this.activeRhythm.Rhythm.RealValue);let F=!1;if(this.repetitionInstructionReader&&(F=this.repetitionInstructionReader.handleRepetitionInstructionsFromWordsOrSymbols(P,I)),!F){let L=this.expressionReaders[0];const k=this.readExpressionStaffNumber(E)-1;if(k<this.expressionReaders.length&&(L=this.expressionReaders[k]),L){P.element("octave-shift")&&(L.readExpressionParameters(E,this.instrument,this.divisions,s,r,this.currentMeasure.MeasureNumber,!0),L.addOctaveShift(E,this.currentMeasure,r.clone())),P.element("pedal")&&(L.readExpressionParameters(E,this.instrument,this.divisions,s,r,this.currentMeasure.MeasureNumber,!0),L.addPedalMarking(E,this.currentMeasure,r.clone()));const v=P.element("words");if(v&&(Ga.map(et=>et==null?void 0:et.toLocaleLowerCase()).includes((u=v.value)==null?void 0:u.toLocaleLowerCase())&&(this.currentGradualChangeMeasure=this.currentMeasure,this.currentMeasure.speedInfo={startWord:(f=v.value)==null?void 0:f.toLocaleLowerCase(),startXmlNoteIndex:l.length,endXmlNoteIndex:0,resetXmlNoteIndex:0,startMeasureListIndex:this.currentXmlMeasureIndex,endMeasureListIndex:0,resetMeasureListIndex:0},this.xmlNotes=[]),v.value.startsWith(Wa)&&((d=this.currentGradualChangeMeasure)==null?void 0:d.speedInfo)&&(this.currentGradualChangeMeasure.speedInfo=os(be({},this.currentGradualChangeMeasure.speedInfo),{endXmlNoteIndex:this.xmlNotes.length,endMeasureListIndex:this.currentXmlMeasureIndex})),((p=v.value)==null?void 0:p.toLocaleLowerCase())==="a tempo".toLocaleLowerCase()&&((g=this.currentGradualChangeMeasure)==null?void 0:g.speedInfo))){const{endXmlNoteIndex:et,resetXmlNoteIndex:H,endMeasureListIndex:nt}=this.currentGradualChangeMeasure.speedInfo;H===0&&(this.currentGradualChangeMeasure.speedInfo=os(be({},this.currentGradualChangeMeasure.speedInfo),{endXmlNoteIndex:et||this.xmlNotes.length,endMeasureListIndex:nt||this.currentXmlMeasureIndex,resetXmlNoteIndex:this.xmlNotes.length,resetMeasureListIndex:this.currentXmlMeasureIndex})),this.xmlNotes=[]}if(C.find(G=>G.element("metronome"))&&((m=this.currentGradualChangeMeasure)==null?void 0:m.speedInfo)){const{endXmlNoteIndex:G,resetXmlNoteIndex:et,endMeasureListIndex:H}=this.currentGradualChangeMeasure.speedInfo;et===0&&(this.currentGradualChangeMeasure.speedInfo=os(be({},this.currentGradualChangeMeasure.speedInfo),{endXmlNoteIndex:G||this.xmlNotes.length,endMeasureListIndex:H||this.currentXmlMeasureIndex,resetXmlNoteIndex:this.xmlNotes.length,resetMeasureListIndex:this.currentXmlMeasureIndex})),this.xmlNotes=[]}L.readExpressionParameters(E,this.instrument,this.divisions,s,r,this.currentMeasure.MeasureNumber,!1),L.read(E,this.currentMeasure,s,r.clone(),l.length)}}}else if(E.name==="barline"){this.repetitionInstructionReader&&this.repetitionInstructionReader.handleLineRepetitionInstructions(E)&&(this.currentMeasure.HasEndLine=!0);const C=E.attribute("location");if(T===x.length-1||C&&C.value==="right"){const I=(S=E.element("bar-style"))==null?void 0:S.value;if(I&&(this.currentMeasure.endingBarStyleXml=I,this.currentMeasure.endingBarStyleEnum=Wc.xmlBarlineStyleToSystemLinesEnum(I),(b=this.currentGradualChangeMeasure)!=null&&b.speedInfo)){const{endXmlNoteIndex:F,resetXmlNoteIndex:L,endMeasureListIndex:k}=this.currentGradualChangeMeasure.speedInfo;L===0&&(this.currentGradualChangeMeasure.speedInfo=os(be({},this.currentGradualChangeMeasure.speedInfo),{endXmlNoteIndex:F||this.xmlNotes.length,endMeasureListIndex:k||this.currentXmlMeasureIndex,resetXmlNoteIndex:this.xmlNotes.length,resetMeasureListIndex:this.currentXmlMeasureIndex})),this.currentGradualChangeMeasure=void 0,this.xmlNotes=[]}}}else if(E.name==="sound")try{if(E.attribute("tempo")){const C=parseFloat(E.attribute("tempo").value);E.element("offset")&&(this.soundTempos.has(this.currentXmlMeasureIndex)||this.soundTempos.set(this.currentXmlMeasureIndex,[]),this.soundTempos.get(this.currentXmlMeasureIndex).push(C)),this.currentXmlMeasureIndex===0&&(this.musicSheet.DefaultStartTempoInBpm=C,this.musicSheet.HasBPMInfo=!0)}}catch(C){j.debug("InstrumentReader.readTempoInstruction",C)}else E.name==="harmony"&&this.openChordSymbolContainers.push(Yu.readChordSymbol(E,this.musicSheet,this.activeKey))}for(const T in this.voiceGeneratorsDict)this.voiceGeneratorsDict.hasOwnProperty(T)&&this.voiceGeneratorsDict[T].checkForOpenBeam();if(this.currentXmlMeasureIndex===this.xmlMeasureList.length-1){for(let T=0;T<this.instrument.Staves.length;T++)this.activeClefsHaveBeenInitialized[T]||this.createDefaultClefInstruction(this.musicSheet.getGlobalStaffIndexOfFirstStaff(this.instrument)+T);this.activeKeyHasBeenInitialized||this.createDefaultKeyInstruction();for(let T=0;T<this.expressionReaders.length;T++){const E=this.expressionReaders[T];E&&E.closeOpenExpressions(this.currentMeasure,s)}}Object.keys(this.voiceGeneratorsDict).forEach(T=>{this.voiceGeneratorsDict[T].finalizeReadingMeasure()}),this.musicSheet.HasBPMInfo?t.TempoInBPM===0&&this.previousMeasure&&(this.currentMeasure.TempoInBPM=this.previousMeasure.TempoInBPM):this.currentMeasure.TempoInBPM=120,this.currentMeasure.TempoInBPM||(this.currentMeasure.TempoInBPM=this.musicSheet.DefaultStartTempoInBpm)}catch(y){if(o)throw new Ee(y.Message);const x=Tt.translateText("ReaderErrorMessages/MeasureError","Error while reading Measure.");this.musicSheet.SheetErrors.pushMeasureError(x),j.debug("InstrumentReader.readNextXmlMeasure",x,y)}return this.previousMeasure=this.currentMeasure,this.currentXmlMeasureIndex+=1,!0}parseXmlColor(t){if(!!t)return t.length===7?t:t.length===9?"#"+t.substr(3):void 0}doCalculationsAfterDurationHasBeenSet(){for(const t in this.voiceGeneratorsDict)this.voiceGeneratorsDict.hasOwnProperty(t)&&this.voiceGeneratorsDict[t].checkOpenTies()}getOrCreateVoiceGenerator(t,e){const i=this.instrument.Staves[e];let s=this.voiceGeneratorsDict[t];if(s)i.Voices.indexOf(s.GetVoice)===-1&&i.Voices.push(s.GetVoice);else{const r=this.staffMainVoiceGeneratorDict[e];r?(s=new ha(this.pluginManager,i,t,this.slurReader,r.GetVoice),i.Voices.push(s.GetVoice),this.voiceGeneratorsDict[t]=s):(s=new ha(this.pluginManager,i,t,this.slurReader),i.Voices.push(s.GetVoice),this.voiceGeneratorsDict[t]=s,this.staffMainVoiceGeneratorDict[e]=s)}return s}createExpressionGenerators(t){this.expressionReaders=new Array(t);for(let e=0;e<t;e++)this.expressionReaders[e]=new Ku(this.musicSheet,this.instrument,e+1)}createDefaultClefInstruction(t){let e;this.musicSheet.SourceMeasures.length>0?e=this.musicSheet.SourceMeasures[0]:e=this.currentMeasure;const i=new Wt(Pt.G,0,2);let s;e.FirstInstructionsStaffEntries[t]?(s=e.FirstInstructionsStaffEntries[t],s.removeFirstInstructionOfTypeClefInstruction()):(s=new we(void 0,void 0),e.FirstInstructionsStaffEntries[t]=s),i.Parent=s,s.Instructions.splice(0,0,i)}createDefaultKeyInstruction(){let t;this.musicSheet.SourceMeasures.length>0?t=this.musicSheet.SourceMeasures[0]:t=this.currentMeasure;const e=new xe(void 0,0,bi.major);for(let i=this.inSourceMeasureInstrumentIndex;i<this.inSourceMeasureInstrumentIndex+this.instrument.Staves.length;i++)if(t.FirstInstructionsStaffEntries[i]){const s=t.FirstInstructionsStaffEntries[i];e.Parent=s,s.removeFirstInstructionOfTypeKeyInstruction(),s.Instructions[0]instanceof Wt?s.Instructions.splice(1,0,e):s.Instructions.splice(0,0,e)}else{const s=new we(void 0,void 0);t.FirstInstructionsStaffEntries[i]=s,e.Parent=s,s.Instructions.push(e)}}isAttributesNodeAtBeginOfMeasure(t,e){const i=t.elements(),s=i.indexOf(e);if(s>0&&i[s-1].name==="backup")return!0;let r=-1;for(let o=0;o<i.length;o++)if(i[o].name==="note"){r=o;break}return s<r&&r>0||r<0}isAttributesNodeAtEndOfMeasure(t,e){const i=t.elements().slice();let s=0;for(let o=0;o<i.length;o++)if(i[o]===e){s=o;break}let r=0;for(let o=s;o<i.length;o++)if(i[o].name==="note"){r=o;break}return s>r}getNoteDurationFromTypeNode(t){const e=t.element("type");if(e){const i=e.value;return ws.getNoteDurationFromType(i)}return new W(0,4*this.divisions)}addAbstractInstruction(t,e,i,s){if(t.element("divisions")&&t.elements().length===1)return;const r=t.element("transpose");if(r){const l=r.element("chromatic");l&&(this.instrument.PlaybackTranspose=parseInt(l.value,10))}const o=t.elements("clef");let a;if(o.length>0)for(let l=0,h=o.length;l<h;++l){const c=o[l];let u=Pt.G,f=2,d=1,p=0;const g=c.element("line");if(g)try{f=parseInt(g.value,10)}catch(y){a=Tt.translateText("ReaderErrorMessages/ClefLineError","Invalid clef line given -> using default clef line."),this.musicSheet.SheetErrors.pushMeasureError(a),f=2,j.debug("InstrumentReader.addAbstractInstruction",a,y)}const m=c.element("sign");if(m)try{u=Pt[m.value],Wt.isSupportedClef(u)||(a=Tt.translateText("ReaderErrorMessages/ClefError","Unsupported clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(a),u=Pt.G,f=2),u===Pt.TAB&&(p=-1)}catch(y){a=Tt.translateText("ReaderErrorMessages/ClefError","Invalid clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(a),u=Pt.G,f=2,j.debug("InstrumentReader.addAbstractInstruction",a,y)}const S=c.element("clef-octave-change");if(S)try{p=parseInt(S.value,10)}catch{a=Tt.translateText("ReaderErrorMessages/ClefOctaveError","Invalid clef octave found -> using default clef octave."),this.musicSheet.SheetErrors.pushMeasureError(a),p=0}if(c.hasAttributes&&c.attribute("number"))try{d=parseInt(c.attribute("number").value,10),d>this.currentClefNumber&&(d=this.currentClefNumber),this.currentClefNumber=d+1}catch{a=Tt.translateText("ReaderErrorMessages/ClefError","Invalid clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(a),d=1,this.currentClefNumber=d+1}const b=new Wt(u,p,f);this.abstractInstructions.push([d,b,s])}if(t.element("key")!==void 0&&this.instrument.MidiInstrumentId!==st.Percussion){let l=0;const h=t.element("key").element("fifths");if(h)try{l=parseInt(h.value,10)}catch(d){a=Tt.translateText("ReaderErrorMessages/KeyError","Invalid key found -> set to default."),this.musicSheet.SheetErrors.pushMeasureError(a),l=0,j.debug("InstrumentReader.addAbstractInstruction",a,d)}let c=bi.none,u=t.element("key");if(u&&(u=u.element("mode")),u)try{c=bi[u.value]}catch(d){a=Tt.translateText("ReaderErrorMessages/KeyError","Invalid key found -> set to default."),this.musicSheet.SheetErrors.pushMeasureError(a),c=bi.major,j.debug("InstrumentReader.addAbstractInstruction",a,d)}const f=new xe(void 0,l,c);this.abstractInstructions.push([1,f,s])}if(t.element("time")){const l=t.element("time");let h=ii.NONE,c=!0;if(l!==void 0&&l.hasAttributes){const S=l.attribute("symbol");S&&(S.value==="common"?h=ii.COMMON:S.value==="cut"&&(h=ii.CUT));const b=l.attribute("print-object");b&&b.value==="no"&&(c=!1)}let u=0,f=0;const d=l&&l.element("senza-misura")!==void 0,p=t.elements("time"),g=[],m=[];for(let S=0,b=p.length;S<b;++S){const y=p[S];g.push.apply(g,y.elements("beats")),m.push.apply(m,y.elements("beat-type"))}if(d)this.abstractInstructions.push([1,new Ae(new W(4,4,0,!1),ii.NONE),s]);else{try{if(g!==void 0&&g.length>0&&m!==void 0&&g.length===m.length){const b=g.length,y=new Array(b);let x=0;for(let w=0;w<b;w++){const T=g[w].value;let E=0,C=0;if(T.indexOf("+")!==-1){const P=T.split("+");for(let I=0,F=P.length;I<F;++I)E+=parseInt(P[I],10)}else E=parseInt(T,10);C=parseInt(m[w].value,10),x=Math.max(x,C),y[w]=new W(E,C,0,!1)}for(let w=0;w<b;w++)y[w].Denominator===x?u+=y[w].Numerator:u+=x/y[w].Denominator*y[w].Numerator;f=x}else u=parseInt(t.element("time").element("beats").value,10),f=parseInt(t.element("time").element("beat-type").value,10)}catch(b){a=Tt.translateText("ReaderErrorMessages/RhythmError","Invalid rhythm found -> set to default."),this.musicSheet.SheetErrors.pushMeasureError(a),u=4,f=4,j.debug("InstrumentReader.addAbstractInstruction",a,b)}const S=new Ae(new W(u,f,0,!1),h);S.PrintObject=c,this.abstractInstructions.push([1,S,s])}}}saveAbstractInstructionList(t,e){for(let i=this.abstractInstructions.length-1;i>=0;i--){const s=this.abstractInstructions[i],r=s[0],o=s[1],a=s[2];if(o instanceof Wt){const l=o;if(this.currentXmlMeasureIndex===0||r<=this.activeClefs.length&&l!==this.activeClefs[r-1])if(!e&&this.currentStaffEntry!==void 0&&!this.currentStaffEntry.hasNotes()&&r-1===this.instrument.Staves.indexOf(this.currentStaffEntry.ParentStaff)){const h=l,c=this.currentStaffEntry;if(a&&Math.abs(a.RealValue-c.Timestamp.RealValue)>.01)continue;h.Parent=c,c.removeFirstInstructionOfTypeClefInstruction(),c.Instructions.push(h),this.activeClefs[r-1]=l,this.abstractInstructions.splice(i,1)}else if(e){if(a.RealValue!==0)continue;let h;if(this.currentMeasure){const c=l,u=this.inSourceMeasureInstrumentIndex+r-1,f=this.currentMeasure.FirstInstructionsStaffEntries[u];if(this.currentXmlMeasureIndex===0)if(!f)h=new we(void 0,void 0),this.currentMeasure.FirstInstructionsStaffEntries[u]=h,c.Parent=h,h.Instructions.push(c),this.activeClefsHaveBeenInitialized[r-1]=!0;else if(this.currentMeasure.FirstInstructionsStaffEntries[u]!==void 0&&!(f.Instructions[0]instanceof Wt))h=f,c.Parent=h,h.removeFirstInstructionOfTypeClefInstruction(),h.Instructions.splice(0,0,c),this.activeClefsHaveBeenInitialized[r-1]=!0;else{const d=new we(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[u]=d,c.Parent=d,d.Instructions.push(c)}else if(this.activeClefsHaveBeenInitialized[r-1]){let d=this.previousMeasure;this.followingMultirestMeasures>0&&this.currentMeasure.Rules.RenderMultipleRestMeasures&&(d=this.currentMultirestStartMeasure);const p=new we(void 0,void 0);d.LastInstructionsStaffEntries[u]=p,c.Parent=p,p.Instructions.push(c)}else{const d=this.musicSheet.SourceMeasures[0];d.FirstInstructionsStaffEntries[u]?(h=d.FirstInstructionsStaffEntries[u],h.removeFirstInstructionOfTypeClefInstruction()):h=new we(void 0,void 0),c.Parent=h,h.Instructions.splice(0,0,c),this.activeClefsHaveBeenInitialized[r-1]=!0}this.activeClefs[r-1]=l,this.abstractInstructions.splice(i,1)}}else{let h;const c=this.activeRhythm.Rhythm;c.RealValue>0&&a.RealValue/c.RealValue>.9&&(this.currentMeasure.LastInstructionsStaffEntries[r-1]||(this.currentMeasure.LastInstructionsStaffEntries[r-1]=new we(void 0,this.instrument.Staves[r-1])),h=this.currentMeasure.LastInstructionsStaffEntries[r-1]),h&&(l.Parent=h,h.Instructions.push(l),this.activeClefs[r-1]=l,this.abstractInstructions.splice(i,1))}else r<=this.activeClefs.length&&l===this.activeClefs[r-1]&&this.abstractInstructions.splice(i,1)}if(o instanceof xe){const l=o;if(!this.activeKey||this.activeKey.Key!==l.Key){this.activeKey=l,this.abstractInstructions.splice(i,1);let h;if(this.activeKeyHasBeenInitialized?h=this.currentMeasure:(this.activeKeyHasBeenInitialized=!0,this.currentXmlMeasureIndex>0?h=this.musicSheet.SourceMeasures[0]:h=this.currentMeasure),h)for(let c=this.inSourceMeasureInstrumentIndex;c<this.inSourceMeasureInstrumentIndex+t;c++){const u=l;if(h.FirstInstructionsStaffEntries[c]){const f=h.FirstInstructionsStaffEntries[c];u.Parent=f,f.removeFirstInstructionOfTypeKeyInstruction(),f.Instructions.length===0?f.Instructions.push(u):f.Instructions[0]instanceof Wt?f.Instructions.splice(1,0,u):f.Instructions.splice(0,0,u)}else{const f=new we(void 0,void 0);h.FirstInstructionsStaffEntries[c]=f,u.Parent=f,f.Instructions.push(u)}}}else this.abstractInstructions.splice(i,1)}if(o instanceof Ae){const l=o;if(!this.activeRhythm||this.activeRhythm!==l){if(this.activeRhythm=l,this.abstractInstructions.splice(i,1),this.currentMeasure)for(let h=this.inSourceMeasureInstrumentIndex;h<this.inSourceMeasureInstrumentIndex+t;h++){const c=l;let u;this.currentMeasure.FirstInstructionsStaffEntries[h]?(u=this.currentMeasure.FirstInstructionsStaffEntries[h],u.removeFirstInstructionOfTypeRhythmInstruction()):(u=new we(void 0,void 0),this.currentMeasure.FirstInstructionsStaffEntries[h]=u),c.Parent=u,u.Instructions.push(c)}}else this.abstractInstructions.splice(i,1)}}}saveClefInstructionAtEndOfMeasure(){for(let t=this.abstractInstructions.length-1;t>=0;t--){const e=this.abstractInstructions[t][0],i=this.abstractInstructions[t][1];if(i instanceof Wt){const s=i;if(!this.activeClefs[e-1]||s.ClefType!==this.activeClefs[e-1].ClefType||s.ClefType===this.activeClefs[e-1].ClefType&&s.Line!==this.activeClefs[e-1].Line){const r=new we(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[this.inSourceMeasureInstrumentIndex+e-1]=r;const o=s;o.Parent=r,r.Instructions.push(o),this.activeClefs[e-1]=s,this.abstractInstructions.splice(t,1)}}}}getNoteDurationForTuplet(t){let e=new W(0,1);const i=this.getNoteDurationFromTypeNode(t);if(t.element("time-modification")){const s=t.element("time-modification");if(s&&s.element("actual-notes")!==void 0&&s.element("normal-notes")){const r=s.element("actual-notes"),o=s.element("normal-notes");if(r!==void 0&&o){const a=parseInt(r.value,10),l=parseInt(o.value,10);e=new W(l*i.Numerator,a*i.Denominator)}}}return e}readExpressionStaffNumber(t){let e=1;if(t.element("staff")){const i=t.element("staff");if(i)try{e=parseInt(i.value,10)}catch(s){const r=Tt.translateText("ReaderErrorMessages/ExpressionStaffError","Invalid Expression staff number -> set to default.");this.musicSheet.SheetErrors.pushMeasureError(r),e=1,j.debug("InstrumentReader.readExpressionStaffNumber",r,s)}}return e}readDivisionsFromNotes(){let t=0,e=this.currentXmlMeasureIndex,i=!1;for(;!i;){const s=this.xmlMeasureList[e].elements();for(let r=0,o=s.length;r<o;++r){const a=s[r];if(a.name==="note"&&!a.element("time-modification")){const l=a.element("duration"),h=a.element("type");if(l!==void 0&&h){const c=h.value;let u=0;try{u=parseInt(l.value,10)}catch(f){j.debug("InstrumentReader.readDivisionsFromNotes",f);continue}switch(c){case"1024th":t=u/4*1024;break;case"512th":t=u/4*512;break;case"256th":t=u/4*256;break;case"128th":t=u/4*128;break;case"64th":t=u/4*64;break;case"32nd":t=u/4*32;break;case"16th":t=u/4*16;break;case"eighth":t=u/4*8;break;case"quarter":t=u/4*4;break;case"half":t=u/4*2;break;case"whole":t=u/4;break;case"breve":t=u/4/2;break;case"long":t=u/4/4;break;case"maxima":t=u/4/8;break}}}if(t>0){i=!0;break}}if(t===0&&(e++,e===this.xmlMeasureList.length)){const r=Tt.translateText("ReaderErrorMEssages/DivisionsError","Invalid divisions value at Instrument: ");throw new Ee(r+this.instrument.Name)}}return t}}const Gs=class{constructor(n){this.parentInstrument=n,this.fixedKey=-1,this.name=this.parseMidiInstrument(this.parentInstrument.Name),this.midiInstrumentID=Gs.midiInstrument[this.name],this.volume=1}get ParentInstrument(){return this.parentInstrument}static isPianoInstrument(n){return n===st.Acoustic_Grand_Piano||n===st.Bright_Acoustic_Piano||n===st.Electric_Grand_Piano||n===st.Electric_Piano_1||n===st.Electric_Piano_2}setMidiInstrument(n){this.midiInstrumentID=Gs.midiInstrument[this.parseMidiInstrument(n)]}parseMidiInstrument(n){try{if(n){let t=n.toLowerCase().trim();t=t.replace(/\s+/g,"_");for(const e in Gs.midiInstrument)if(t.indexOf(e)!==-1)return e}if(this.parentInstrument.Name){let t=this.parentInstrument.Name.toLowerCase().trim();t=t.replace(/\s+/g,"_");for(const e in Gs.midiInstrument)if(t.indexOf(e)!==-1)return e}}catch{j.error("Error parsing MIDI Instrument. Default to Grand Piano.")}return"unnamed"}};let Nr=Gs;Nr.midiInstrument={alto_saxophone:st.Alto_Sax,baritone_saxophone:st.Baritone_Sax,horn_in_f:st.French_Horn,english_horn:st.English_Horn,euphonium:st.Euphonium,clarinet_in_bb:st.clarinet_in_bb,clarinet_in_eb:st.clarinet_in_eb,clarinet:st.Clarinet,alto_clarinet:st.Alto_Clarinet,bass_clarinet:st.Bass_Clarinet,bassoon:st.Bassoon,bass_trombone:st.Bass_Trombone,alt:st.Synth_Voice,alto:st.Synth_Voice,banjo:st.Banjo,bariton:st.Synth_Voice,baritone:st.Synth_Voice,bass:st.Synth_Voice,blockfl\u00F6te:st.Recorder,brass:st.Trombone,bratsche:st.Viola,cello:st.Cello,contrabass:st.Contrabass,drums:st.Percussion,flute:st.Flute,fl\u00F6te:st.Flute,frenchhorn:st.French_Horn,gitarre:st.Acoustic_Guitar_nylon,guitar:st.Acoustic_Guitar_nylon,harfe:st.Orchestral_Harp,harp:st.Orchestral_Harp,klarinette:st.Clarinet,klavier:st.Acoustic_Grand_Piano,kontrabass:st.Contrabass,oboe:st.Oboe,organ:st.Church_Organ,orgel:st.Church_Organ,orgue:st.Church_Organ,percussion:st.Synth_Drum,\u5C0F\u519B\u9F13:st.Synth_Drum,snare_drum:st.Synth_Drum,bass_drum:st.Synth_Drum,side_drum:st.Synth_Drum,piano:st.Acoustic_Grand_Piano,piccolo:st.Piccolo,posaune:st.Trombone,recorder:st.Recorder,sax:st.Tenor_Sax,schlagwerk:st.Percussion,schlagzeug:st.Percussion,sopran:st.Synth_Voice,steeldrum:st.Steel_Drums,streicher:st.String_Ensemble_1,strings:st.String_Ensemble_1,tenor:st.Synth_Voice,tpt:st.Trumpet,trombone:st.Trombone,trompete:st.Trumpet,trumpet:st.Trumpet,tuba:st.Tuba,unnamed:st.Acoustic_Grand_Piano,viola:st.Viola,violin:st.Violin,"violon-c":st.Cello,"violon.":st.Violin,voice:st.Synth_Voice,woodblock:st.Woodblock,alto_clarinet_in_eb:st.AltoClarinetInEb,trumpet_in_bb:st.TrumpetInBb,tenor_saxophone:st.TenorSaxophone};class Ue{static StringContainsSeparatedWord(t,e,i=!1){return new RegExp("( |^)"+e+"([ .]|$)",i?"i":void 0).test(t)}}class Qu{set MusicSheet(t){this.musicSheet=t,this.xmlMeasureList=new Array(this.musicSheet.Instruments.length),this.repetitionInstructions=[]}prepareReadingMeasure(t,e){this.currentMeasureIndex=e}handleLineRepetitionInstructions(t){let e=!1;if(t.elements().length>0){let i="",s=!1,r="",o="",a="";const l=[],h=t.element("bar-style");h&&(a=h.value),t.attributes().length>0&&t.attribute("location")?i=t.attribute("location").value:i="right";const c=t.elements();for(let u=0,f=c.length;u<f;++u){const d=c[u];if(d.name==="repeat"&&d.hasAttributes)s=!0,r=d.attribute("direction").value;else if(d.name==="ending"&&d.hasAttributes&&d.attribute("type")!==void 0&&d.attribute("number")){o=d.attribute("type").value;const g=d.attribute("number").value.split("[,+]");for(let m=0,S=g.length;m<S;++m){const b=g[m],y=b.match("[0-9]");if(b.search("-")!==-1&&y.length===2){const x=parseInt(y[0],10),w=parseInt(y[1],10);for(let T=x;T<=w;T++)l.push(T)}else for(let x=0,w=y.length;x<w;++x){const T=y[x];l.push(parseInt(T,10))}}}}if(a==="light-heavy"&&l.length===0&&!s&&(e=!0),s||l.length>0)if(i==="left"){if(o==="start"){const u=new It(this.currentMeasureIndex,q.Ending,Dt.Begin,void 0,l);this.addInstruction(this.repetitionInstructions,u)}if(r==="forward"){const u=new It(this.currentMeasureIndex,q.StartLine);this.addInstruction(this.repetitionInstructions,u)}}else{if(o==="stop"){const u=new It(this.currentMeasureIndex,q.Ending,Dt.End,void 0,l);this.addInstruction(this.repetitionInstructions,u)}if(r==="backward"){const u=new It(this.currentMeasureIndex,q.BackJumpLine);this.addInstruction(this.repetitionInstructions,u)}}}return e}handleRepetitionInstructionsFromWordsOrSymbols(t,e){const i=t.element("words"),s=this.currentMeasureIndex;if(i){const r="d\\s?\\.s\\.",o=i.value.trim().toLowerCase();if(Ue.StringContainsSeparatedWord(o,r+" al fine",!0)){const l=new It(s,q.DalSegnoAlFine);return this.addInstruction(this.repetitionInstructions,l),!0}if(Ue.StringContainsSeparatedWord(o,r+" al coda",!0)){const l=new It(s,q.DalSegnoAlCoda);return this.addInstruction(this.repetitionInstructions,l),!0}const a="d\\.\\s?c\\.";if(Ue.StringContainsSeparatedWord(o,a+" al fine",!0)){const l=new It(s,q.DaCapoAlFine);return this.addInstruction(this.repetitionInstructions,l),!0}if(Ue.StringContainsSeparatedWord(o,a+" al coda",!0)){const l=new It(s,q.DaCapoAlCoda);return this.addInstruction(this.repetitionInstructions,l),!0}if(Ue.StringContainsSeparatedWord(o,a)||Ue.StringContainsSeparatedWord(o,"da\\s?capo",!0)){const l=new It(s,q.DaCapo);return this.addInstruction(this.repetitionInstructions,l),!0}if(Ue.StringContainsSeparatedWord(o,r,!0)||Ue.StringContainsSeparatedWord(o,"dal\\s?segno",!0)){let l;return Ue.StringContainsSeparatedWord(o,"al\\s?coda",!0)?l=new It(s,q.DalSegnoAlCoda):l=new It(s,q.DalSegno),this.addInstruction(this.repetitionInstructions,l),!0}if(Ue.StringContainsSeparatedWord(o,"to\\s?coda",!0)||Ue.StringContainsSeparatedWord(o,"a (la )?coda",!0)){const l=new It(s,q.ToCoda);return this.addInstruction(this.repetitionInstructions,l),!0}if(Ue.StringContainsSeparatedWord(o,"fine",!0)){const l=new It(s,q.Fine);return this.addInstruction(this.repetitionInstructions,l),!0}if(Ue.StringContainsSeparatedWord(o,"coda",!0)){const l=new It(s,q.Coda);return this.addInstruction(this.repetitionInstructions,l),!0}if(Ue.StringContainsSeparatedWord(o,"segno",!0)){const l=new It(s,q.Segno);return this.addInstruction(this.repetitionInstructions,l),!0}}else if(t.element("segno")){const r=new It(s,q.Segno);return this.addInstruction(this.repetitionInstructions,r),!0}else if(t.element("coda")){const r=new It(s,q.Coda);return this.addInstruction(this.repetitionInstructions,r),!0}return!1}removeRedundantInstructions(){let t=0,e=0,i=0,s=0;for(let r=0;r<this.repetitionInstructions.length;r++){const o=this.repetitionInstructions[r];switch(o.type){case q.Coda:i>0&&this.findInstructionInPreviousMeasure(r,o.measureIndex,q.ToCoda)&&(o.type=q.None),e===0&&i===0&&(o.type=q.ToCoda,o.alignment=Dt.End,o.measureIndex--);break;case q.Segno:if(t-s>0){let a=!1;for(let l=0,h=this.repetitionInstructions.length;l<h;++l){const c=this.repetitionInstructions[l];if(o.measureIndex-c.measureIndex===1)switch(c.type){case q.BackJumpLine:i-e>0?c.type=q.DalSegnoAlCoda:c.type=q.DalSegno,o.type=q.None,a=!0;break;case q.DalSegno:case q.DalSegnoAlFine:case q.DalSegnoAlCoda:o.type=q.None,a=!0;break}if(a)break}if(a)break;i-e>0?o.type=q.DalSegnoAlCoda:o.type=q.DalSegno,o.alignment=Dt.End,o.measureIndex--}break}if(this.backwardSearchForPreviousIdenticalInstruction(r,o)||o.type===q.None)this.repetitionInstructions.splice(r,1),r--;else switch(o.type){case q.Fine:break;case q.ToCoda:i++;break;case q.Coda:e++;break;case q.Segno:t++;break;case q.DalSegnoAlFine:case q.DalSegnoAlCoda:s++;break}}this.repetitionInstructions.sort(Mr.Compare)}findInstructionInPreviousMeasure(t,e,i){for(let s=t-1;s>=0;s--){const r=this.repetitionInstructions[s];if(e-r.measureIndex===1&&r.type===i)return!0}return!1}backwardSearchForPreviousIdenticalInstruction(t,e){for(let i=t-1;i>=0;i--)if(this.repetitionInstructions[i].equals(e))return!0;return!1}addInstruction(t,e){let i=!0;for(let s=0,r=t.length;s<r;++s){const o=t[s];if(e.equals(o)){i=!1;break}}i&&t.push(e)}}class $u{constructor(){this.repetitionInstructions=[],this.openRepetitions=[],this.lastRepetitionCommonPartStartIndex=0}calculateRepetitions(t,e){this.musicSheet=t,this.repetitionInstructions=e,this.openRepetitions.length=0,this.lastRepetitionCommonPartStartIndex=0;const i=this.musicSheet.SourceMeasures;for(const a of this.repetitionInstructions){this.currentMeasureIndex=a.measureIndex;try{this.currentMeasure=i[this.currentMeasureIndex],this.handleRepetitionInstructions(a)}catch(l){j.error("RepetitionCalculator: calculateRepetitions",l)}}for(;this.openRepetitions.length>0;)try{const a=this.openRepetitions.last();if(a.RepetitonUnderConstruction.FromWords){if(a.WaitingForCoda){let l=a.RepetitonUnderConstruction.BackwardJumpInstructions.last().measureIndex+1;l>=this.musicSheet.SourceMeasures.length&&(l=-1),a.RepetitonUnderConstruction.setEndingStartIndex(2,l)}else if(a.RepetitonUnderConstruction.BackwardJumpInstructions.length===0){this.openRepetitions.splice(this.openRepetitions.length-1,1);continue}}else if(a.RepetitonUnderConstruction.BackwardJumpInstructions.length===0){const l=i.length-1,h=new It(l,q.BackJumpLine,Dt.End,a.RepetitonUnderConstruction);a.RepetitonUnderConstruction.BackwardJumpInstructions.push(h),i[l].LastRepetitionInstructions.push(h)}this.finalizeRepetition(this.openRepetitions.last())}catch{try{const l=this.openRepetitions.last().RepetitonUnderConstruction;for(const h of this.repetitionInstructions)h.parentRepetition===l&&(h.parentRepetition=void 0);this.openRepetitions.splice(this.openRepetitions.length-1,1)}catch(l){j.error("RepetitionCalculator: calculateRepetitions2",l)}}let s=!1;const r=0,o=this.musicSheet.SourceMeasures.length-1;for(const a of this.musicSheet.Repetitions)if(a.StartIndex===r&&a.EndIndex===o){s=!0;break}if(!s){const a=new Dn(this.musicSheet,!0);a.FromWords=!0,a.startMarker=new It(r,q.StartLine),a.startMarker.parentRepetition=a,this.musicSheet.SourceMeasures[r].FirstRepetitionInstructions.push(a.startMarker),a.endMarker=new It(o,q.BackJumpLine),a.endMarker.parentRepetition=a,a.BackwardJumpInstructions.push(a.endMarker),a.UserNumberOfRepetitions=a.DefaultNumberOfRepetitions,this.musicSheet.Repetitions.push(a)}for(let a=0,l=this.musicSheet.SourceMeasures.length;a<l;++a){const h=this.musicSheet.SourceMeasures[a];h.FirstRepetitionInstructions.length>1&&h.FirstRepetitionInstructions.sort(Mr.Compare),h.LastRepetitionInstructions.length>1&&h.LastRepetitionInstructions.sort(Mr.Compare)}}handleRepetitionInstructions(t){let e;switch(t.type){case q.StartLine:e=this.createNewRepetition(this.currentMeasureIndex),t.parentRepetition=e.RepetitonUnderConstruction,e.RepetitonUnderConstruction.FromWords=!1,e.RepetitonUnderConstruction.startMarker=t,this.currentMeasure.FirstRepetitionInstructions.push(t);break;case q.BackJumpLine:e=this.getOrCreateCurrentRepetition2(!1),t.parentRepetition=e.RepetitonUnderConstruction,e.RepetitonUnderConstruction.BackwardJumpInstructions.push(t),this.currentMeasure.LastRepetitionInstructions.push(t),e.RepetitonUnderConstruction.EndingParts.length===0&&this.finalizeRepetition(e);break;case q.Ending:if(e=this.getOrCreateCurrentRepetition(),t.parentRepetition=e.RepetitonUnderConstruction,t.endingIndices.contains(1)&&t.alignment===Dt.Begin){if(e.RepetitonUnderConstruction.BackwardJumpInstructions.length>0||e.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)){e=void 0;for(let s=this.openRepetitions.length-1;s>=0;s--){const r=this.openRepetitions[s];if(r.RepetitonUnderConstruction.BackwardJumpInstructions.length===0)for(e=r;this.openRepetitions.length-1>s;){const o=this.openRepetitions.last();this.finalizeRepetition(o)}}e===void 0&&(e=this.createNewRepetition(0),e.RepetitonUnderConstruction.startMarker=new It(0,q.None))}e.RepetitonUnderConstruction.forwardJumpInstruction===void 0&&(e.RepetitonUnderConstruction.forwardJumpInstruction=new It(this.currentMeasureIndex-1,q.ForwardJump,Dt.End,e.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[this.currentMeasureIndex-1].LastRepetitionInstructions.push(e.RepetitonUnderConstruction.forwardJumpInstruction))}if(t.alignment===Dt.Begin)e.RepetitonUnderConstruction.setEndingsStartIndex(t.endingIndices,this.currentMeasureIndex),this.currentMeasure.FirstRepetitionInstructions.push(t);else for(let s=0,r=t.endingIndices.length;s<r;++s){const o=t.endingIndices[s];e.RepetitonUnderConstruction.setEndingEndIndex(o,this.currentMeasureIndex),this.currentMeasure.LastRepetitionInstructions.push(t)}break;case q.Segno:if(e=this.getCurrentRepetition(!0),e!==void 0&&e.SegnoFound&&e.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&Math.abs(e.RepetitonUnderConstruction.BackwardJumpInstructions.last().measureIndex-this.currentMeasureIndex)<=1||this.openRepetitions.length&&this.openRepetitions.find(s=>s.RepetitonUnderConstruction.startMarker.type===q.StartLine).RepetitonUnderConstruction.StartIndex===this.currentMeasureIndex)break;e=this.createNewRepetition(this.currentMeasureIndex),t.parentRepetition=e.RepetitonUnderConstruction,e.RepetitonUnderConstruction.FromWords=!0,e.SegnoFound=!0,e.RepetitonUnderConstruction.startMarker=t,this.currentMeasure.FirstRepetitionInstructions.push(t);break;case q.Fine:if(this.openRepetitions.length===0||(e=this.getCurrentRepetition(!0),e===void 0))break;t.parentRepetition=e.RepetitonUnderConstruction,e.RepetitonUnderConstruction.FromWords=!0,e.RepetitonUnderConstruction.forwardJumpInstruction===void 0?(e.FineFound=!0,e.RepetitonUnderConstruction.forwardJumpInstruction=t,e.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.currentMeasure.LastRepetitionInstructions.push(t)):this.currentMeasure.LastRepetitionInstructions.push(new It(this.currentMeasureIndex,q.Fine,Dt.End,void 0));break;case q.ToCoda:if(this.openRepetitions.length===0||(e=this.getCurrentRepetition(!0),e===void 0))break;e.RepetitonUnderConstruction.forwardJumpInstruction===void 0&&(t.parentRepetition=e.RepetitonUnderConstruction,e.RepetitonUnderConstruction.FromWords=!0,e.ToCodaFound=!0,e.RepetitonUnderConstruction.forwardJumpInstruction=t,this.currentMeasure.LastRepetitionInstructions.push(t));break;case q.Coda:if(this.openRepetitions.length===0)break;e=this.getOrCreateCurrentRepetition2(!0),t.parentRepetition=e.RepetitonUnderConstruction,e.WaitingForCoda?(e.CodaFound=!0,e.RepetitonUnderConstruction.setEndingStartIndex(2,this.currentMeasureIndex),this.currentMeasure.LastRepetitionInstructions.push(t),this.finalizeRepetition(e),this.currentMeasureIndex>0&&(this.musicSheet.SourceMeasures[this.currentMeasureIndex-1].printNewSystemXml=!0)):e.ToCodaFound||(e.RepetitonUnderConstruction.BackwardJumpInstructions.length===0?(e.ToCodaFound=!0,e.RepetitonUnderConstruction.forwardJumpInstruction=new It(this.currentMeasureIndex,q.ToCoda,Dt.End,e.RepetitonUnderConstruction),this.currentMeasure.LastRepetitionInstructions.push(e.RepetitonUnderConstruction.forwardJumpInstruction)):this.currentMeasure.LastRepetitionInstructions.push(new It(this.currentMeasureIndex,q.Coda,Dt.Begin,void 0)));break;case q.DaCapo:e=this.getOrCreateCurrentRepetition(),e.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&this.finalizeRepetition(e),e.RepetitonUnderConstruction.StartIndex!==0&&(e=this.createNewRepetition(0)),t.parentRepetition=e.RepetitonUnderConstruction,e.RepetitonUnderConstruction.FromWords=!0,e.RepetitonUnderConstruction.startMarker=new It(0,q.None,Dt.Begin,e.RepetitonUnderConstruction),e.RepetitonUnderConstruction.BackwardJumpInstructions.push(t),this.currentMeasure.LastRepetitionInstructions.push(t),e.RepetitonUnderConstruction.EndingParts.length===0&&this.finalizeRepetition(e);break;case q.DalSegno:if(e=this.getOrCreateCurrentRepetition2(!0),e.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&(this.finalizeRepetition(e),e=this.createNewRepetition(0),e.RepetitonUnderConstruction.FromWords=!0,e.RepetitonUnderConstruction.startMarker=new It(0,q.None,Dt.Begin,e.RepetitonUnderConstruction)),t.parentRepetition=e.RepetitonUnderConstruction,!e.SegnoFound){const s=this.findInstructionInMainListBackwards(q.Segno,t.measureIndex);s>=0&&(e.SegnoFound=!0,e.RepetitonUnderConstruction.startMarker=new It(s,q.Segno,Dt.Begin,e.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[s].FirstRepetitionInstructions.splice(0,0,e.RepetitonUnderConstruction.startMarker))}e.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)&&e.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),e.RepetitonUnderConstruction.BackwardJumpInstructions.push(t),this.currentMeasure.LastRepetitionInstructions.push(t);break;case q.DalSegnoAlFine:if(this.openRepetitions.length===0)break;if(e=this.getOrCreateCurrentRepetition2(!0),t.parentRepetition=e.RepetitonUnderConstruction,!e.SegnoFound){const s=this.findInstructionInMainListBackwards(q.Segno,t.measureIndex);s>=0&&(e.SegnoFound=!0,e.RepetitonUnderConstruction.startMarker=new It(s,q.Segno,Dt.Begin,e.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[s].FirstRepetitionInstructions.splice(0,0,e.RepetitonUnderConstruction.startMarker))}if(!e.FineFound){const s=this.findInstructionInMainListBackwards(q.Fine,t.measureIndex);s>=0&&(e.FineFound=!0,e.RepetitonUnderConstruction.forwardJumpInstruction=new It(s,q.Fine,Dt.Begin,e.RepetitonUnderConstruction),e.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.musicSheet.SourceMeasures[s].LastRepetitionInstructions.splice(0,0,e.RepetitonUnderConstruction.forwardJumpInstruction))}e.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||e.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),e.RepetitonUnderConstruction.BackwardJumpInstructions.push(t),this.currentMeasure.LastRepetitionInstructions.push(t);break;case q.DaCapoAlFine:if(e=this.getOrCreateCurrentRepetition(),e.RepetitonUnderConstruction.BackwardJumpInstructions.length>0&&(this.finalizeRepetition(e),e=this.createNewRepetition(0)),e.RepetitonUnderConstruction.startMarker!==void 0&&e.RepetitonUnderConstruction.StartIndex!==0&&(e=this.createNewRepetition(0)),e.RepetitonUnderConstruction.startMarker=new It(0,q.None,Dt.Begin,e.RepetitonUnderConstruction),e.RepetitonUnderConstruction.FromWords=!0,t.parentRepetition=e.RepetitonUnderConstruction,!e.FineFound){const s=this.findInstructionInMainListBackwards(q.Fine,t.measureIndex);s>=0&&(e.FineFound=!0,e.RepetitonUnderConstruction.forwardJumpInstruction=new It(s,q.Fine,Dt.Begin,e.RepetitonUnderConstruction),e.RepetitonUnderConstruction.setEndingStartIndex(2,-2),this.musicSheet.SourceMeasures[s].LastRepetitionInstructions.splice(0,0,e.RepetitonUnderConstruction.forwardJumpInstruction))}e.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||e.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),e.RepetitonUnderConstruction.BackwardJumpInstructions.push(t),this.currentMeasure.LastRepetitionInstructions.push(t);break;case q.DalSegnoAlCoda:if(this.openRepetitions.length===0)break;if(e=this.getOrCreateCurrentRepetition2(!0),t.parentRepetition=e.RepetitonUnderConstruction,!e.SegnoFound){const s=this.findInstructionInMainListBackwards(q.Segno,t.measureIndex);s>=0&&(e.SegnoFound=!0,e.RepetitonUnderConstruction.startMarker=new It(s,q.Segno,Dt.Begin,e.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[s].FirstRepetitionInstructions.splice(0,0,e.RepetitonUnderConstruction.startMarker))}if(!e.ToCodaFound){const s=this.findInstructionInMainListBackwards(q.ToCoda,t.measureIndex);if(s>=0)e.RepetitonUnderConstruction.forwardJumpInstruction=new It(s,q.ToCoda,Dt.Begin,e.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[s].LastRepetitionInstructions.splice(0,0,e.RepetitonUnderConstruction.forwardJumpInstruction),e.ToCodaFound=!0;else{const r=this.findInstructionInMainListBackwards(q.Coda,t.measureIndex);r>=0&&(e.RepetitonUnderConstruction.forwardJumpInstruction=new It(r,q.ToCoda,Dt.Begin,e.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[r].LastRepetitionInstructions.splice(0,0,e.RepetitonUnderConstruction.forwardJumpInstruction),e.ToCodaFound=!0)}}e.ToCodaFound&&(e.WaitingForCoda=!0),e.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||e.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),e.RepetitonUnderConstruction.BackwardJumpInstructions.push(t),this.currentMeasure.LastRepetitionInstructions.push(t);break;case q.DaCapoAlCoda:if(e=this.getOrCreateCurrentRepetition(),e.RepetitonUnderConstruction.BackwardJumpInstructions.length>0?(this.finalizeRepetition(e),e=this.createNewRepetition(0)):e.RepetitonUnderConstruction.EndingParts.length===0&&(this.finalizeRepetition(e),e=this.createNewRepetition(0)),e.RepetitonUnderConstruction.startMarker!==void 0&&e.RepetitonUnderConstruction.StartIndex!==0&&(e=this.createNewRepetition(0)),e.RepetitonUnderConstruction.startMarker=new It(0,q.None,Dt.Begin,e.RepetitonUnderConstruction),e.RepetitonUnderConstruction.FromWords=!0,t.parentRepetition=e.RepetitonUnderConstruction,!e.ToCodaFound){const s=this.findInstructionInMainListBackwards(q.ToCoda,t.measureIndex);if(s>=0)e.RepetitonUnderConstruction.forwardJumpInstruction=new It(s,q.ToCoda,Dt.Begin,e.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[s].LastRepetitionInstructions.splice(0,0,e.RepetitonUnderConstruction.forwardJumpInstruction),e.ToCodaFound=!0;else{const r=this.findInstructionInMainListBackwards(q.Coda,t.measureIndex);r>=0&&(e.RepetitonUnderConstruction.forwardJumpInstruction=new It(r,q.ToCoda,Dt.Begin,e.RepetitonUnderConstruction),this.musicSheet.SourceMeasures[r].LastRepetitionInstructions.splice(0,0,e.RepetitonUnderConstruction.forwardJumpInstruction),e.ToCodaFound=!0)}}e.ToCodaFound&&(e.WaitingForCoda=!0),e.RepetitonUnderConstruction.EndingIndexDict.hasOwnProperty(1)||e.RepetitonUnderConstruction.setEndingEndIndex(1,this.currentMeasureIndex),e.RepetitonUnderConstruction.BackwardJumpInstructions.push(t),this.currentMeasure.LastRepetitionInstructions.push(t);break;case q.None:break;default:throw new Li("currentRepetitionInstruction")}return!0}findInstructionInMainListBackwards(t,e){for(let i=this.repetitionInstructions.length-1;i>=0;i--){const s=this.repetitionInstructions[i];if(s.measureIndex<=e&&s.type===t)return s.measureIndex}return-1}finalizeRepetition(t){const e=t.RepetitonUnderConstruction;if(e.BackwardJumpInstructions.length>0){let i=!0;const s=this.getLastFinalizedRepetition();if(s!==void 0&&e.coversIdenticalMeasures(s)){if(e.NumberOfEndings>s.NumberOfEndings){const r=this.musicSheet.Repetitions.indexOf(s,0);r>-1&&this.musicSheet.Repetitions.splice(r,1),s.removeFromRepetitionInstructions(),this.musicSheet.Repetitions.push(e)}i=!1,e.removeFromRepetitionInstructions()}else this.musicSheet.Repetitions.push(e);i&&(e.startMarker.type===q.None&&this.musicSheet.SourceMeasures[e.StartIndex].FirstRepetitionInstructions.push(e.startMarker),e.UserNumberOfRepetitions=e.DefaultNumberOfRepetitions)}this.openRepetitions.splice(this.openRepetitions.length-1,1)}getCurrentRepetition(t){let e;for(let i=this.openRepetitions.length-1;i>=0;i--)if(this.openRepetitions[i].RepetitonUnderConstruction.FromWords===t){for(e=this.openRepetitions[i];i<this.openRepetitions.length-1;)this.finalizeRepetition(this.openRepetitions.last());return e}return e}getOrCreateCurrentRepetition(){if(this.openRepetitions.length>0)return this.openRepetitions.last();const t=this.createNewRepetition(0);return t.RepetitonUnderConstruction.startMarker=new It(0,q.None,Dt.Begin,t.RepetitonUnderConstruction),t}getOrCreateCurrentRepetition2(t){let e;if(this.openRepetitions.length&&this.openRepetitions.last().RepetitonUnderConstruction.EndingParts.length<2){for(let s=this.openRepetitions.length-1;s>=0;s--)if(e=this.openRepetitions[s],e.RepetitonUnderConstruction.FromWords===t){for(;s<this.openRepetitions.length-1;)this.finalizeRepetition(this.openRepetitions.last());return e}}return e=this.createNewRepetition(this.lastRepetitionCommonPartStartIndex),e.RepetitonUnderConstruction.startMarker=new It(this.lastRepetitionCommonPartStartIndex,q.None,Dt.Begin,e.RepetitonUnderConstruction),e.RepetitonUnderConstruction.FromWords=t,e}createNewRepetition(t){if(this.openRepetitions.length>0){const i=this.openRepetitions.last(),s=i.RepetitonUnderConstruction;if(s.BackwardJumpInstructions.length>0){const r=Object.keys(s.EndingIndexDict);(r.length===0||s.EndingIndexDict[r[r.length-1]].part.EndIndex>=0)&&this.finalizeRepetition(i)}}const e=new tf(this.musicSheet);return this.lastRepetitionCommonPartStartIndex=t,this.openRepetitions.push(e),e}getLastFinalizedRepetition(){if(this.musicSheet.Repetitions.length>0)return this.musicSheet.Repetitions.last()}}class tf{constructor(t){this.RepetitonUnderConstruction=new Dn(t)}}class ua{static createRepetitionInstructionReader(){return new Qu}static createRepetitionCalculator(){return new $u}}class ef{constructor(){this.voiceMeasureReadPlugins=[]}addVoiceMeasureReadPlugin(t){this.voiceMeasureReadPlugins.push(t)}processVoiceMeasureReadPlugins(t,e,i){for(const s of this.voiceMeasureReadPlugins)try{s.measureReadCalculations(t,e,i)}catch(r){j.info("VoiceGenerator.addSingleNote: ",r)}}}class Eo{constructor(t=void 0,e=new Ui){this.completeNumberOfStaves=0,this.pluginManager=new ef,t?this.afterSheetReadingModules=t:this.afterSheetReadingModules=[],this.repetitionInstructionReader=ua.createRepetitionInstructionReader(),this.repetitionCalculator=ua.createRepetitionCalculator(),this.rules=e}get PluginManager(){return this.pluginManager}get CompleteNumberOfStaves(){return this.completeNumberOfStaves}static doCalculationsAfterDurationHasBeenSet(t){for(const e of t)e.doCalculationsAfterDurationHasBeenSet()}createMusicSheet(t,e){try{return this._createMusicSheet(t,e)}catch(i){j.error("MusicSheetReader.CreateMusicSheet",i);return}}_removeFromArray(t,e){const i=t.indexOf(e);i!==-1&&t.splice(i,1)}trimString(t){return t.replace(/^\s+|\s+$/g,"")}_lastElement(t){return t[t.length-1]}_createMusicSheet(t,e){var u;const i=[];let s=0;if(this.musicSheet=new al,this.musicSheet.Path=e,this.musicSheet.Rules=this.rules,!t)throw new Ee("Undefined root element");this.pushSheetLabels(t,e);const r=t.element("part-list");if(!r)throw new Ee("Undefined partListNode");const o=t.elements("part"),a=r.elements();this.initializeReading(a,o,i);let l=!0;this.currentFraction=new W(0,1);let h=!1,c=t.element("identification");for(c&&(c=c.element("encoding")),c&&(c=c.element("software")),c!==void 0&&c.value==="Guitar Pro 5"&&(h=!0);l;){this.currentMeasure!==void 0&&this.currentMeasure.HasEndLine&&this.rules.NewPartAndSystemAfterFinalBarline&&(s=0),this.currentMeasure=new Yc(this.completeNumberOfStaves,this.musicSheet.Rules);for(const f of i)try{l=l&&f.readNextXmlMeasure(this.currentMeasure,this.currentFraction,h)}catch(d){const p=Tt.translateText("ReaderErrorMessages/InstrumentError","Error while reading instruments.");throw new Ee(p,d)}l&&(this.musicSheet.addMeasure(this.currentMeasure),this.checkIfRhythmInstructionsAreSetAndEqual(i),this.checkSourceMeasureForNullEntries(),s=this.setSourceMeasureDuration(i,s),Eo.doCalculationsAfterDurationHasBeenSet(i),this.currentMeasure.AbsoluteTimestamp=this.currentFraction.clone(),this.musicSheet.SheetErrors.finalizeMeasure(this.currentMeasure.MeasureNumber),this.currentFraction.Add(this.currentMeasure.Duration),this.previousMeasure=this.currentMeasure,this.musicSheet.SoundTempos=(u=i[0])==null?void 0:u.SoundTempos)}this.repetitionInstructionReader&&(this.repetitionInstructionReader.removeRedundantInstructions(),this.repetitionCalculator&&this.repetitionCalculator.calculateRepetitions(this.musicSheet,this.repetitionInstructionReader.repetitionInstructions)),this.musicSheet.DefaultStartTempoInBpm===0&&(this.musicSheet.DefaultStartTempoInBpm=100),this.musicSheet.checkForInstrumentWithNoVoice(),this.musicSheet.fillStaffList();for(let f=0,d=this.afterSheetReadingModules.length;f<d;++f)this.afterSheetReadingModules[f].calculate(this.musicSheet);return this.musicSheet.userStartTempoInBPM=this.musicSheet.userStartTempoInBPM||this.musicSheet.DefaultStartTempoInBpm,this.musicSheet.InitializeStartTempoInBPM(this.musicSheet.userStartTempoInBPM),this.musicSheet.MusicPartManager.init(),this.musicSheet}initializeReading(t,e,i){const s=this.createInstrumentGroups(t);this.completeNumberOfStaves=this.getCompleteNumberOfStavesFromXml(e),e.length!==0&&(this.repetitionInstructionReader.MusicSheet=this.musicSheet,this.currentFraction=new W(0,1),this.currentMeasure=void 0,this.previousMeasure=void 0);let r=0;for(const o of e){const a=o.attribute("id");if(a){const l=s[a.value],h=o.elements("measure");let c=1;try{c=this.getInstrumentNumberOfStavesFromXml(o)}catch{const f=Tt.translateText("ReaderErrorMessages/InstrumentStavesNumberError","Invalid number of staves at instrument: ");this.musicSheet.SheetErrors.push(f+l.Name);continue}l.createStaves(c),i.push(new Zu(this.pluginManager,this.repetitionInstructionReader,h,l)),this.repetitionInstructionReader&&(this.repetitionInstructionReader.xmlMeasureList[r]=h),r++}}}checkIfRhythmInstructionsAreSetAndEqual(t){const e=[];for(let r=0;r<this.completeNumberOfStaves;r++)if(this.currentMeasure.FirstInstructionsStaffEntries[r]){const o=this.currentMeasure.FirstInstructionsStaffEntries[r].Instructions[this.currentMeasure.FirstInstructionsStaffEntries[r].Instructions.length-1];o instanceof Ae&&e.push(o)}let i=0,s=-1;for(let r=0,o=e.length;r<o;++r){const a=e[r];if(a.Rhythm.RealValue>i){if(this.areRhythmInstructionsMixed(e)&&a.SymbolEnum!==ii.NONE)continue;i=a.Rhythm.RealValue,s=e.indexOf(a)}}if(e.length>0&&e.length<this.completeNumberOfStaves){const r=e[s].clone();for(let o=0;o<this.completeNumberOfStaves;o++)this.currentMeasure.FirstInstructionsStaffEntries[o]!==void 0&&!(this._lastElement(this.currentMeasure.FirstInstructionsStaffEntries[o].Instructions)instanceof Ae)&&(this.currentMeasure.FirstInstructionsStaffEntries[o].removeAllInstructionsOfTypeRhythmInstruction(),this.currentMeasure.FirstInstructionsStaffEntries[o].Instructions.push(r.clone())),this.currentMeasure.FirstInstructionsStaffEntries[o]||(this.currentMeasure.FirstInstructionsStaffEntries[o]=new we(void 0,void 0),this.currentMeasure.FirstInstructionsStaffEntries[o].Instructions.push(r.clone()));for(let o=0,a=t.length;o<a;++o){const l=t[o];l.ActiveRhythm=r}}if(e.length===0&&this.currentMeasure===this.musicSheet.SourceMeasures[0]){const r=new Ae(new W(4,4,0,!1),ii.NONE);for(let o=0;o<this.completeNumberOfStaves;o++)this.currentMeasure.FirstInstructionsStaffEntries[o]?this.currentMeasure.FirstInstructionsStaffEntries[o].removeAllInstructionsOfTypeRhythmInstruction():this.currentMeasure.FirstInstructionsStaffEntries[o]=new we(void 0,void 0),this.currentMeasure.FirstInstructionsStaffEntries[o].Instructions.push(r);for(let o=0,a=t.length;o<a;++o){const l=t[o];l.ActiveRhythm=r}}for(let r=0,o=e.length;r<o;++r){const a=e[r];if(a.Rhythm.RealValue<i&&this._lastElement(this.currentMeasure.FirstInstructionsStaffEntries[e.indexOf(a)].Instructions)instanceof Ae){const l=this.currentMeasure.FirstInstructionsStaffEntries[e.indexOf(a)].Instructions;l[l.length-1]=e[s].clone()}Math.abs(a.Rhythm.RealValue-i)<1e-6&&a.SymbolEnum!==ii.NONE&&this.areRhythmInstructionsMixed(e)&&(a.SymbolEnum=ii.NONE)}}areRhythmInstructionsMixed(t){for(let e=1;e<t.length;e++)if(Math.abs(t[e].Rhythm.RealValue-t[0].Rhythm.RealValue)<1e-6&&t[e].SymbolEnum!==t[0].SymbolEnum)return!0;return!1}setSourceMeasureDuration(t,e){let i=new W(0,1);const s=[];for(const a of t){s.push(a.MaxTieNoteFraction);const l=a.ActiveRhythm.Rhythm;i.lt(l)&&(i=new W(l.Numerator,l.Denominator,0,!1))}const r=this.currentMeasure.calculateInstrumentsDuration(this.musicSheet,s);let o=new W(0,1);for(const a of r)o.lt(a)&&(o=a);W.Equal(o,i)?this.checkFractionsForEquivalence(o,i):o.lt(i)&&(o=this.currentMeasure.reverseCheck(this.musicSheet,o),this.checkFractionsForEquivalence(o,i)),this.currentMeasure.ImplicitMeasure=this.checkIfMeasureIsImplicit(o,i),this.currentMeasure.ImplicitMeasure||e++,this.currentMeasure.Duration=o,this.currentMeasure.ActiveTimeSignature=i,this.currentMeasure.MeasureNumber=e;for(let a=0;a<r.length;a++){const l=r[a];if(this.currentMeasure.ImplicitMeasure&&l!==o||!W.Equal(l,i)&&!this.allInstrumentsHaveSameDuration(r,o)){const h=this.musicSheet.getGlobalStaffIndexOfFirstStaff(this.musicSheet.Instruments[a]);for(let c=0;c<this.musicSheet.Instruments[a].Staves.length;c++)if(!this.graphicalMeasureIsEmpty(h+c)){this.currentMeasure.setErrorInGraphicalMeasure(h+c,!0);const u=Tt.translateText("ReaderErrorMessages/MissingNotesError","Given Notes don't correspond to measure duration.");this.musicSheet.SheetErrors.pushMeasureError(u)}}}return e}checkFractionsForEquivalence(t,e){if(e.Denominator>t.Denominator){const i=e.Denominator/t.Denominator;t.expand(i)}}checkIfMeasureIsImplicit(t,e){return!this.previousMeasure&&t.lt(e)?!0:this.previousMeasure?W.plus(this.previousMeasure.Duration,t).Equals(e):!1}allInstrumentsHaveSameDuration(t,e){let i=0;for(let s=0,r=t.length;s<r;++s)t[s].Equals(e)&&i++;return i===t.length&&e!==new W(0,1)}graphicalMeasureIsEmpty(t){let e=0;for(let i=0;i<this.currentMeasure.VerticalSourceStaffEntryContainers.length;i++)this.currentMeasure.VerticalSourceStaffEntryContainers[i].StaffEntries[t]||e++;return e===this.currentMeasure.VerticalSourceStaffEntryContainers.length}checkSourceMeasureForNullEntries(){for(let t=this.currentMeasure.VerticalSourceStaffEntryContainers.length-1;t>=0;t--)for(let e=this.currentMeasure.VerticalSourceStaffEntryContainers[t].StaffEntries.length-1;e>=0;e--){const i=this.currentMeasure.VerticalSourceStaffEntryContainers[t].StaffEntries[e];if(i)for(let s=i.VoiceEntries.length-1;s>=0;s--){const r=i.VoiceEntries[s];r.Notes.length===0&&(this._removeFromArray(r.ParentVoice.VoiceEntries,r),this._removeFromArray(i.VoiceEntries,r))}i!==void 0&&i.VoiceEntries.length===0&&(this.currentMeasure.VerticalSourceStaffEntryContainers[t].StaffEntries[e]=void 0)}for(let t=this.currentMeasure.VerticalSourceStaffEntryContainers.length-1;t>=0;t--){let e=0;for(let i=0,s=this.currentMeasure.VerticalSourceStaffEntryContainers[t].StaffEntries.length;i<s;++i)this.currentMeasure.VerticalSourceStaffEntryContainers[t].StaffEntries[i]||e++;e===this.currentMeasure.VerticalSourceStaffEntryContainers[t].StaffEntries.length&&this._removeFromArray(this.currentMeasure.VerticalSourceStaffEntryContainers,this.currentMeasure.VerticalSourceStaffEntryContainers[t])}}pushSheetLabels(t,e){this.readComposer(t),this.readTitle(t);try{(!this.musicSheet.Title||!this.musicSheet.Composer)&&this.readTitleAndComposerFromCredits(t)}catch(i){j.info("MusicSheetReader.pushSheetLabels","readTitleAndComposerFromCredits",i)}try{if(!this.musicSheet.Title){const i=Math.max(0,e.lastIndexOf("/"),e.lastIndexOf("\\")),r=e.substr(i).split(".",1);this.musicSheet.Title=new jt(r[0])}}catch(i){j.info("MusicSheetReader.pushSheetLabels","read title from file name",i)}}presentAttrsWithValue(t,e){for(const i of t.attributes())if(i.value===e)return!0;return!1}readComposer(t){const e=t.element("identification");if(e){const i=e.elements("creator");for(let s=0,r=i.length;s<r;++s){const o=i[s];if(o.hasAttributes){if(this.presentAttrsWithValue(o,"composer")){this.musicSheet.Composer=new jt(this.trimString(o.value));continue}(this.presentAttrsWithValue(o,"lyricist")||this.presentAttrsWithValue(o,"poet"))&&(this.musicSheet.Lyricist=new jt(this.trimString(o.value)))}}}}readTitleAndComposerFromCredits(t){var h,c;const e=this.computeSystemYCoordinates(t);if(e===0)return;let i=1,s,r=0,o,a;const l=t.elements("credit");for(let u=0,f=l.length;u<f;++u){const d=l[u];if(!d.attribute("page"))return;if(d.attribute("page").value==="1"){let p;if(d){if(p=d.element("credit-words"),!p.attribute("justify"))break;const g=(h=p.attribute("justify"))==null?void 0:h.value,m=(c=p.attribute("default-y"))==null?void 0:c.value,S=m!=null,b=S?parseFloat(m):Number.MIN_VALUE;if(S&&b>e){if(!this.musicSheet.Title){const y=p.attribute("font-size").value,x=parseFloat(y);i<x&&(i=x,s=p.value)}if(this.musicSheet.Subtitle||g!=="right"&&g!=="left"&&r<b&&(r=b,a&&(o=a),a=p.value),!(this.musicSheet.Composer!==void 0&&this.musicSheet.Lyricist))switch(g){case"right":this.musicSheet.Composer=new jt(this.trimString(p.value));break;case"left":this.musicSheet.Lyricist=new jt(this.trimString(p.value));break}}}}}!this.musicSheet.Title&&s&&(this.musicSheet.Title=new jt(this.trimString(s))),!this.musicSheet.Subtitle&&o&&(this.musicSheet.Subtitle=new jt(this.trimString(o)))}computeSystemYCoordinates(t){if(!t.element("defaults"))return 0;let e=0,i=0;try{const o=t.element("defaults").element("page-layout").element("page-height").value;e=parseFloat(o)}catch{return j.info("MusicSheetReader.computeSystemYCoordinates(): couldn't find page height, not reading title/composer."),0}let s=!1;const r=t.elements("part");for(let o=0,a=r.length;o<a;++o){const l=r[o].elements("measure");for(let h=0,c=l.length;h<c;++h){const u=l[h];if(u.element("print")){const f=u.element("print").elements("system-layout");for(let d=0,p=f.length;d<p;++d){const g=f[d];if(g.element("top-system-distance")){const m=g.element("top-system-distance").value;i=parseFloat(m),s=!0;break}}break}}if(s)break}if(t.element("defaults").element("system-layout")&&t.element("defaults").element("system-layout").element("top-system-distance")){const a=t.element("defaults").element("system-layout").element("top-system-distance").value;i=parseFloat(a)}return i===0?0:e-i}readTitle(t){const e=t.element("work");let i;e&&(i=e.element("work-title"),i&&i.value&&(this.musicSheet.Title=new jt(this.trimString(i.value))));const s=t.element("movement-title");let r="";if(s&&(this.musicSheet.Title?r=this.trimString(s.value):this.musicSheet.Title=new jt(this.trimString(s.value))),e){const o=e.element("work-number");if(o){const a=o.value;a&&(r===""?r=a:r=r+", "+a)}}r&&(this.musicSheet.Subtitle=new jt(r))}createInstrumentGroups(t){let e=0;const i={};let s;try{const r=t;for(let o=0,a=r.length;o<a;++o){const l=r[o];if(l.name==="score-part"){const h=l.attribute("id").value,c=new Cr(e,h,this.musicSheet,s);e++;const u=l.elements();for(let f=0,d=u.length;f<d;++f){const p=u[f];try{if(p.name==="part-name")c.Name=p.value,p.attribute("print-object")&&p.attribute("print-object").value==="no"&&(c.NameLabel.print=!1);else if(p.name==="part-abbreviation")c.PartAbbreviation=p.value;else if(p.name==="score-instrument"){const g=new Nr(c);g.idString=p.firstAttribute.value,c.SubInstruments.push(g);const m=p.element("instrument-name");m&&(g.name=m.value,g.setMidiInstrument(m.value))}else if(p.name==="midi-instrument"){let g=c.getSubInstrument(p.firstAttribute.value);for(let S=0,b=c.SubInstruments.length;S<b;++S){const y=c.SubInstruments[S];if(y.idString===p.value){g=y;break}}const m=p.elements();for(let S=0,b=m.length;S<b;++S){const y=m[S];try{if(y.name==="midi-channel")parseInt(y.value,10)===10&&(c.MidiInstrumentId=st.Percussion);else if(y.name==="midi-program")c.SubInstruments.length>0&&c.MidiInstrumentId!==st.Percussion&&(g.midiInstrumentID=Math.max(0,parseInt(y.value,10)-1));else if(y.name==="midi-unpitched")g.fixedKey=Math.max(0,parseInt(y.value,10));else if(y.name==="volume")try{const x=parseFloat(y.value);g.volume=x/127}catch(x){j.debug("ExpressionReader.readExpressionParameters","read volume",x)}else if(y.name==="pan")try{const x=parseFloat(y.value);g.pan=x/64}catch(x){j.debug("ExpressionReader.readExpressionParameters","read pan",x)}}catch(x){j.info("MusicSheetReader.createInstrumentGroups midi settings: ",x)}}}}catch(g){j.info("MusicSheetReader.createInstrumentGroups: ",g)}}if(c.SubInstruments.length===0){const f=new Nr(c);c.SubInstruments.push(f)}i[h]=c,s?(s.InstrumentalGroups.push(c),this.musicSheet.Instruments.push(c)):(this.musicSheet.InstrumentalGroups.push(c),this.musicSheet.Instruments.push(c))}else if(l.name==="part-group"&&l.attribute("type").value==="start"){const h=new Za("group",this.musicSheet,s);s?s.InstrumentalGroups.push(h):this.musicSheet.InstrumentalGroups.push(h),s=h}else if(l.name==="part-group"&&l.attribute("type").value==="stop"&&s){if(s.InstrumentalGroups.length===1){const h=s.InstrumentalGroups[0];s.Parent?(s.Parent.InstrumentalGroups.push(h),this._removeFromArray(s.Parent.InstrumentalGroups,s)):(this.musicSheet.InstrumentalGroups.push(h),this._removeFromArray(this.musicSheet.InstrumentalGroups,s))}s=s.Parent}}}catch(r){const o=Tt.translateText("ReaderErrorMessages/InstrumentError","Error while reading Instruments");throw new Ee(o,r)}for(let r=0,o=this.musicSheet.Instruments.length;r<o;++r){const a=this.musicSheet.Instruments[r];a.Name||(a.Name="Instr. "+a.IdString)}return i}getCompleteNumberOfStavesFromXml(t){let e=0;for(const i of t){const s=i.elements("measure");if(s.length>0){const r=s[0];if(r){let o=r.element("attributes");o&&(o=o.element("staves")),o?e+=parseInt(o.value,10):e++}}}if(isNaN(e)||e<=0){const i=Tt.translateText("ReaderErrorMessages/StaffError","Invalid number of staves.");throw new Ee(i)}return e}getInstrumentNumberOfStavesFromXml(t){let e=0;const i=t.element("measure");if(i){const s=i.element("attributes");let r;s&&(r=s.element("staves")),!s||!r?e=1:e=parseInt(r.value,10)}if(isNaN(e)||e<=0){const s=Tt.translateText("ReaderErrorMessages/StaffError","Invalid number of Staves.");throw new Ee(s)}return e}}var ll={exports:{}};/*!
  18. JSZip v3.7.1 - A JavaScript class for generating and reading zip files
  19. <http://stuartk.com/jszip>
  20. (c) 2009-2016 Stuart Knightley <stuart [at] stuartk.com>
  21. Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown.
  22. JSZip uses the library pako released under the MIT license :
  23. https://github.com/nodeca/pako/blob/master/LICENSE
  24. */(function(n,t){(function(e){n.exports=e()})(function(){return function e(i,s,r){function o(h,c){if(!s[h]){if(!i[h]){var u=typeof Oi=="function"&&Oi;if(!c&&u)return u(h,!0);if(a)return a(h,!0);var f=new Error("Cannot find module '"+h+"'");throw f.code="MODULE_NOT_FOUND",f}var d=s[h]={exports:{}};i[h][0].call(d.exports,function(p){var g=i[h][1][p];return o(g||p)},d,d.exports,e,i,s,r)}return s[h].exports}for(var a=typeof Oi=="function"&&Oi,l=0;l<r.length;l++)o(r[l]);return o}({1:[function(e,i,s){var r=e("./utils"),o=e("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";s.encode=function(l){for(var h,c,u,f,d,p,g,m=[],S=0,b=l.length,y=b,x=r.getTypeOf(l)!=="string";S<l.length;)y=b-S,u=x?(h=l[S++],c=S<b?l[S++]:0,S<b?l[S++]:0):(h=l.charCodeAt(S++),c=S<b?l.charCodeAt(S++):0,S<b?l.charCodeAt(S++):0),f=h>>2,d=(3&h)<<4|c>>4,p=1<y?(15&c)<<2|u>>6:64,g=2<y?63&u:64,m.push(a.charAt(f)+a.charAt(d)+a.charAt(p)+a.charAt(g));return m.join("")},s.decode=function(l){var h,c,u,f,d,p,g=0,m=0,S="data:";if(l.substr(0,S.length)===S)throw new Error("Invalid base64 input, it looks like a data url.");var b,y=3*(l=l.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&y--,l.charAt(l.length-2)===a.charAt(64)&&y--,y%1!=0)throw new Error("Invalid base64 input, bad content length.");for(b=o.uint8array?new Uint8Array(0|y):new Array(0|y);g<l.length;)h=a.indexOf(l.charAt(g++))<<2|(f=a.indexOf(l.charAt(g++)))>>4,c=(15&f)<<4|(d=a.indexOf(l.charAt(g++)))>>2,u=(3&d)<<6|(p=a.indexOf(l.charAt(g++))),b[m++]=h,d!==64&&(b[m++]=c),p!==64&&(b[m++]=u);return b}},{"./support":30,"./utils":32}],2:[function(e,i,s){var r=e("./external"),o=e("./stream/DataWorker"),a=e("./stream/Crc32Probe"),l=e("./stream/DataLengthProbe");function h(c,u,f,d,p){this.compressedSize=c,this.uncompressedSize=u,this.crc32=f,this.compression=d,this.compressedContent=p}h.prototype={getContentWorker:function(){var c=new o(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),u=this;return c.on("end",function(){if(this.streamInfo.data_length!==u.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),c},getCompressedWorker:function(){return new o(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},h.createWorkerFrom=function(c,u,f){return c.pipe(new a).pipe(new l("uncompressedSize")).pipe(u.compressWorker(f)).pipe(new l("compressedSize")).withStreamInfo("compression",u)},i.exports=h},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,i,s){var r=e("./stream/GenericWorker");s.STORE={magic:"\0\0",compressWorker:function(o){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},s.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,i,s){var r=e("./utils"),o=function(){for(var a,l=[],h=0;h<256;h++){a=h;for(var c=0;c<8;c++)a=1&a?3988292384^a>>>1:a>>>1;l[h]=a}return l}();i.exports=function(a,l){return a!==void 0&&a.length?r.getTypeOf(a)!=="string"?function(h,c,u,f){var d=o,p=f+u;h^=-1;for(var g=f;g<p;g++)h=h>>>8^d[255&(h^c[g])];return-1^h}(0|l,a,a.length,0):function(h,c,u,f){var d=o,p=f+u;h^=-1;for(var g=f;g<p;g++)h=h>>>8^d[255&(h^c.charCodeAt(g))];return-1^h}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(e,i,s){s.base64=!1,s.binary=!1,s.dir=!1,s.createFolders=!0,s.date=null,s.compression=null,s.compressionOptions=null,s.comment=null,s.unixPermissions=null,s.dosPermissions=null},{}],6:[function(e,i,s){var r=null;r=typeof Promise!="undefined"?Promise:e("lie"),i.exports={Promise:r}},{lie:37}],7:[function(e,i,s){var r=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Uint32Array!="undefined",o=e("pako"),a=e("./utils"),l=e("./stream/GenericWorker"),h=r?"uint8array":"array";function c(u,f){l.call(this,"FlateWorker/"+u),this._pako=null,this._pakoAction=u,this._pakoOptions=f,this.meta={}}s.magic="\b\0",a.inherits(c,l),c.prototype.processChunk=function(u){this.meta=u.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(h,u.data),!1)},c.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var u=this;this._pako.onData=function(f){u.push({data:f,meta:u.meta})}},s.compressWorker=function(u){return new c("Deflate",u)},s.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,i,s){function r(d,p){var g,m="";for(g=0;g<p;g++)m+=String.fromCharCode(255&d),d>>>=8;return m}function o(d,p,g,m,S,b){var y,x,w=d.file,T=d.compression,E=b!==h.utf8encode,C=a.transformTo("string",b(w.name)),P=a.transformTo("string",h.utf8encode(w.name)),I=w.comment,F=a.transformTo("string",b(I)),L=a.transformTo("string",h.utf8encode(I)),k=P.length!==w.name.length,v=L.length!==I.length,G="",et="",H="",nt=w.dir,K=w.date,lt={crc32:0,compressedSize:0,uncompressedSize:0};p&&!g||(lt.crc32=d.crc32,lt.compressedSize=d.compressedSize,lt.uncompressedSize=d.uncompressedSize);var A=0;p&&(A|=8),E||!k&&!v||(A|=2048);var B=0,ot=0;nt&&(B|=16),S==="UNIX"?(ot=798,B|=function(J,ct){var Nt=J;return J||(Nt=ct?16893:33204),(65535&Nt)<<16}(w.unixPermissions,nt)):(ot=20,B|=function(J){return 63&(J||0)}(w.dosPermissions)),y=K.getUTCHours(),y<<=6,y|=K.getUTCMinutes(),y<<=5,y|=K.getUTCSeconds()/2,x=K.getUTCFullYear()-1980,x<<=4,x|=K.getUTCMonth()+1,x<<=5,x|=K.getUTCDate(),k&&(et=r(1,1)+r(c(C),4)+P,G+="up"+r(et.length,2)+et),v&&(H=r(1,1)+r(c(F),4)+L,G+="uc"+r(H.length,2)+H);var rt="";return rt+=`
  25. \0`,rt+=r(A,2),rt+=T.magic,rt+=r(y,2),rt+=r(x,2),rt+=r(lt.crc32,4),rt+=r(lt.compressedSize,4),rt+=r(lt.uncompressedSize,4),rt+=r(C.length,2),rt+=r(G.length,2),{fileRecord:u.LOCAL_FILE_HEADER+rt+C+G,dirRecord:u.CENTRAL_FILE_HEADER+r(ot,2)+rt+r(F.length,2)+"\0\0\0\0"+r(B,4)+r(m,4)+C+G+F}}var a=e("../utils"),l=e("../stream/GenericWorker"),h=e("../utf8"),c=e("../crc32"),u=e("../signature");function f(d,p,g,m){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=g,this.encodeFileName=m,this.streamFiles=d,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(f,l),f.prototype.push=function(d){var p=d.meta.percent||0,g=this.entriesCount,m=this._sources.length;this.accumulate?this.contentBuffer.push(d):(this.bytesWritten+=d.data.length,l.prototype.push.call(this,{data:d.data,meta:{currentFile:this.currentFile,percent:g?(p+100*(g-m-1))/g:100}}))},f.prototype.openedSource=function(d){this.currentSourceOffset=this.bytesWritten,this.currentFile=d.file.name;var p=this.streamFiles&&!d.file.dir;if(p){var g=o(d,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:g.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(d){this.accumulate=!1;var p=this.streamFiles&&!d.file.dir,g=o(d,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(g.dirRecord),p)this.push({data:function(m){return u.DATA_DESCRIPTOR+r(m.crc32,4)+r(m.compressedSize,4)+r(m.uncompressedSize,4)}(d),meta:{percent:100}});else for(this.push({data:g.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var d=this.bytesWritten,p=0;p<this.dirRecords.length;p++)this.push({data:this.dirRecords[p],meta:{percent:100}});var g=this.bytesWritten-d,m=function(S,b,y,x,w){var T=a.transformTo("string",w(x));return u.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(S,2)+r(S,2)+r(b,4)+r(y,4)+r(T.length,2)+T}(this.dirRecords.length,g,d,this.zipComment,this.encodeFileName);this.push({data:m,meta:{percent:100}})},f.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},f.prototype.registerPrevious=function(d){this._sources.push(d);var p=this;return d.on("data",function(g){p.processChunk(g)}),d.on("end",function(){p.closedSource(p.previous.streamInfo),p._sources.length?p.prepareNextSource():p.end()}),d.on("error",function(g){p.error(g)}),this},f.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},f.prototype.error=function(d){var p=this._sources;if(!l.prototype.error.call(this,d))return!1;for(var g=0;g<p.length;g++)try{p[g].error(d)}catch{}return!0},f.prototype.lock=function(){l.prototype.lock.call(this);for(var d=this._sources,p=0;p<d.length;p++)d[p].lock()},i.exports=f},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,i,s){var r=e("../compressions"),o=e("./ZipFileWorker");s.generateWorker=function(a,l,h){var c=new o(l.streamFiles,h,l.platform,l.encodeFileName),u=0;try{a.forEach(function(f,d){u++;var p=function(b,y){var x=b||y,w=r[x];if(!w)throw new Error(x+" is not a valid compression method !");return w}(d.options.compression,l.compression),g=d.options.compressionOptions||l.compressionOptions||{},m=d.dir,S=d.date;d._compressWorker(p,g).withStreamInfo("file",{name:f,dir:m,date:S,comment:d.comment||"",unixPermissions:d.unixPermissions,dosPermissions:d.dosPermissions}).pipe(c)}),c.entriesCount=u}catch(f){c.error(f)}return c}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,i,s){function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var o=new r;for(var a in this)typeof this[a]!="function"&&(o[a]=this[a]);return o}}(r.prototype=e("./object")).loadAsync=e("./load"),r.support=e("./support"),r.defaults=e("./defaults"),r.version="3.7.1",r.loadAsync=function(o,a){return new r().loadAsync(o,a)},r.external=e("./external"),i.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,i,s){var r=e("./utils"),o=e("./external"),a=e("./utf8"),l=e("./zipEntries"),h=e("./stream/Crc32Probe"),c=e("./nodejsUtils");function u(f){return new o.Promise(function(d,p){var g=f.decompressed.getContentWorker().pipe(new h);g.on("error",function(m){p(m)}).on("end",function(){g.streamInfo.crc32!==f.decompressed.crc32?p(new Error("Corrupted zip : CRC32 mismatch")):d()}).resume()})}i.exports=function(f,d){var p=this;return d=r.extend(d||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),c.isNode&&c.isStream(f)?o.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",f,!0,d.optimizedBinaryString,d.base64).then(function(g){var m=new l(d);return m.load(g),m}).then(function(g){var m=[o.Promise.resolve(g)],S=g.files;if(d.checkCRC32)for(var b=0;b<S.length;b++)m.push(u(S[b]));return o.Promise.all(m)}).then(function(g){for(var m=g.shift(),S=m.files,b=0;b<S.length;b++){var y=S[b];p.file(y.fileNameStr,y.decompressed,{binary:!0,optimizedBinaryString:!0,date:y.date,dir:y.dir,comment:y.fileCommentStr.length?y.fileCommentStr:null,unixPermissions:y.unixPermissions,dosPermissions:y.dosPermissions,createFolders:d.createFolders})}return m.zipComment.length&&(p.comment=m.zipComment),p})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,i,s){var r=e("../utils"),o=e("../stream/GenericWorker");function a(l,h){o.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(h)}r.inherits(a,o),a.prototype._bindStream=function(l){var h=this;(this._stream=l).pause(),l.on("data",function(c){h.push({data:c,meta:{percent:0}})}).on("error",function(c){h.isPaused?this.generatedError=c:h.error(c)}).on("end",function(){h.isPaused?h._upstreamEnded=!0:h.end()})},a.prototype.pause=function(){return!!o.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},i.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,i,s){var r=e("readable-stream").Readable;function o(a,l,h){r.call(this,l),this._helper=a;var c=this;a.on("data",function(u,f){c.push(u)||c._helper.pause(),h&&h(f)}).on("error",function(u){c.emit("error",u)}).on("end",function(){c.push(null)})}e("../utils").inherits(o,r),o.prototype._read=function(){this._helper.resume()},i.exports=o},{"../utils":32,"readable-stream":16}],14:[function(e,i,s){i.exports={isNode:typeof Buffer!="undefined",newBufferFrom:function(r,o){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(r,o);if(typeof r=="number")throw new Error('The "data" argument must not be a number');return new Buffer(r,o)},allocBuffer:function(r){if(Buffer.alloc)return Buffer.alloc(r);var o=new Buffer(r);return o.fill(0),o},isBuffer:function(r){return Buffer.isBuffer(r)},isStream:function(r){return r&&typeof r.on=="function"&&typeof r.pause=="function"&&typeof r.resume=="function"}}},{}],15:[function(e,i,s){function r(w,T,E){var C,P=a.getTypeOf(T),I=a.extend(E||{},c);I.date=I.date||new Date,I.compression!==null&&(I.compression=I.compression.toUpperCase()),typeof I.unixPermissions=="string"&&(I.unixPermissions=parseInt(I.unixPermissions,8)),I.unixPermissions&&16384&I.unixPermissions&&(I.dir=!0),I.dosPermissions&&16&I.dosPermissions&&(I.dir=!0),I.dir&&(w=S(w)),I.createFolders&&(C=m(w))&&b.call(this,C,!0);var F=P==="string"&&I.binary===!1&&I.base64===!1;E&&E.binary!==void 0||(I.binary=!F),(T instanceof u&&T.uncompressedSize===0||I.dir||!T||T.length===0)&&(I.base64=!1,I.binary=!0,T="",I.compression="STORE",P="string");var L=null;L=T instanceof u||T instanceof l?T:p.isNode&&p.isStream(T)?new g(w,T):a.prepareContent(w,T,I.binary,I.optimizedBinaryString,I.base64);var k=new f(w,L,I);this.files[w]=k}var o=e("./utf8"),a=e("./utils"),l=e("./stream/GenericWorker"),h=e("./stream/StreamHelper"),c=e("./defaults"),u=e("./compressedObject"),f=e("./zipObject"),d=e("./generate"),p=e("./nodejsUtils"),g=e("./nodejs/NodejsStreamInputAdapter"),m=function(w){w.slice(-1)==="/"&&(w=w.substring(0,w.length-1));var T=w.lastIndexOf("/");return 0<T?w.substring(0,T):""},S=function(w){return w.slice(-1)!=="/"&&(w+="/"),w},b=function(w,T){return T=T!==void 0?T:c.createFolders,w=S(w),this.files[w]||r.call(this,w,null,{dir:!0,createFolders:T}),this.files[w]};function y(w){return Object.prototype.toString.call(w)==="[object RegExp]"}var x={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(w){var T,E,C;for(T in this.files)C=this.files[T],(E=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&w(E,C)},filter:function(w){var T=[];return this.forEach(function(E,C){w(E,C)&&T.push(C)}),T},file:function(w,T,E){if(arguments.length!==1)return w=this.root+w,r.call(this,w,T,E),this;if(y(w)){var C=w;return this.filter(function(I,F){return!F.dir&&C.test(I)})}var P=this.files[this.root+w];return P&&!P.dir?P:null},folder:function(w){if(!w)return this;if(y(w))return this.filter(function(P,I){return I.dir&&w.test(P)});var T=this.root+w,E=b.call(this,T),C=this.clone();return C.root=E.name,C},remove:function(w){w=this.root+w;var T=this.files[w];if(T||(w.slice(-1)!=="/"&&(w+="/"),T=this.files[w]),T&&!T.dir)delete this.files[w];else for(var E=this.filter(function(P,I){return I.name.slice(0,w.length)===w}),C=0;C<E.length;C++)delete this.files[E[C].name];return this},generate:function(w){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(w){var T,E={};try{if((E=a.extend(w||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:o.utf8encode})).type=E.type.toLowerCase(),E.compression=E.compression.toUpperCase(),E.type==="binarystring"&&(E.type="string"),!E.type)throw new Error("No output type specified.");a.checkSupport(E.type),E.platform!=="darwin"&&E.platform!=="freebsd"&&E.platform!=="linux"&&E.platform!=="sunos"||(E.platform="UNIX"),E.platform==="win32"&&(E.platform="DOS");var C=E.comment||this.comment||"";T=d.generateWorker(this,E,C)}catch(P){(T=new l("error")).error(P)}return new h(T,E.type||"string",E.mimeType)},generateAsync:function(w,T){return this.generateInternalStream(w).accumulate(T)},generateNodeStream:function(w,T){return(w=w||{}).type||(w.type="nodebuffer"),this.generateInternalStream(w).toNodejsStream(T)}};i.exports=x},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,i,s){i.exports=e("stream")},{stream:void 0}],17:[function(e,i,s){var r=e("./DataReader");function o(a){r.call(this,a);for(var l=0;l<this.data.length;l++)a[l]=255&a[l]}e("../utils").inherits(o,r),o.prototype.byteAt=function(a){return this.data[this.zero+a]},o.prototype.lastIndexOfSignature=function(a){for(var l=a.charCodeAt(0),h=a.charCodeAt(1),c=a.charCodeAt(2),u=a.charCodeAt(3),f=this.length-4;0<=f;--f)if(this.data[f]===l&&this.data[f+1]===h&&this.data[f+2]===c&&this.data[f+3]===u)return f-this.zero;return-1},o.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),h=a.charCodeAt(1),c=a.charCodeAt(2),u=a.charCodeAt(3),f=this.readData(4);return l===f[0]&&h===f[1]&&c===f[2]&&u===f[3]},o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},i.exports=o},{"../utils":32,"./DataReader":18}],18:[function(e,i,s){var r=e("../utils");function o(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}o.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(a){},readInt:function(a){var l,h=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)h=(h<<8)+this.byteAt(l);return this.index+=a,h},readString:function(a){return r.transformTo("string",this.readData(a))},readData:function(a){},lastIndexOfSignature:function(a){},readAndCheckSignature:function(a){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},i.exports=o},{"../utils":32}],19:[function(e,i,s){var r=e("./Uint8ArrayReader");function o(a){r.call(this,a)}e("../utils").inherits(o,r),o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},i.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,i,s){var r=e("./DataReader");function o(a){r.call(this,a)}e("../utils").inherits(o,r),o.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},o.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},o.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},o.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},i.exports=o},{"../utils":32,"./DataReader":18}],21:[function(e,i,s){var r=e("./ArrayReader");function o(a){r.call(this,a)}e("../utils").inherits(o,r),o.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},i.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(e,i,s){var r=e("../utils"),o=e("../support"),a=e("./ArrayReader"),l=e("./StringReader"),h=e("./NodeBufferReader"),c=e("./Uint8ArrayReader");i.exports=function(u){var f=r.getTypeOf(u);return r.checkSupport(f),f!=="string"||o.uint8array?f==="nodebuffer"?new h(u):o.uint8array?new c(r.transformTo("uint8array",u)):new a(r.transformTo("array",u)):new l(u)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,i,s){s.LOCAL_FILE_HEADER="PK",s.CENTRAL_FILE_HEADER="PK",s.CENTRAL_DIRECTORY_END="PK",s.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",s.ZIP64_CENTRAL_DIRECTORY_END="PK",s.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(e,i,s){var r=e("./GenericWorker"),o=e("../utils");function a(l){r.call(this,"ConvertWorker to "+l),this.destType=l}o.inherits(a,r),a.prototype.processChunk=function(l){this.push({data:o.transformTo(this.destType,l.data),meta:l.meta})},i.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,i,s){var r=e("./GenericWorker"),o=e("../crc32");function a(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(a,r),a.prototype.processChunk=function(l){this.streamInfo.crc32=o(l.data,this.streamInfo.crc32||0),this.push(l)},i.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,i,s){var r=e("../utils"),o=e("./GenericWorker");function a(l){o.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}r.inherits(a,o),a.prototype.processChunk=function(l){if(l){var h=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=h+l.data.length}o.prototype.processChunk.call(this,l)},i.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,i,s){var r=e("../utils"),o=e("./GenericWorker");function a(l){o.call(this,"DataWorker");var h=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(c){h.dataIsReady=!0,h.data=c,h.max=c&&c.length||0,h.type=r.getTypeOf(c),h.isPaused||h._tickAndRepeat()},function(c){h.error(c)})}r.inherits(a,o),a.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,h=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,h);break;case"uint8array":l=this.data.subarray(this.index,h);break;case"array":case"nodebuffer":l=this.data.slice(this.index,h)}return this.index=h,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},i.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,i,s){function r(o){this.name=o||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,a){return this._listeners[o].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,a){if(this._listeners[o])for(var l=0;l<this._listeners[o].length;l++)this._listeners[o][l].call(this,a)},pipe:function(o){return o.registerPrevious(this)},registerPrevious:function(o){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=o.streamInfo,this.mergeStreamInfo(),this.previous=o;var a=this;return o.on("data",function(l){a.processChunk(l)}),o.on("end",function(){a.end()}),o.on("error",function(l){a.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var o=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),o=!0),this.previous&&this.previous.resume(),!o},flush:function(){},processChunk:function(o){this.push(o)},withStreamInfo:function(o,a){return this.extraStreamInfo[o]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var o in this.extraStreamInfo)this.extraStreamInfo.hasOwnProperty(o)&&(this.streamInfo[o]=this.extraStreamInfo[o])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var o="Worker "+this.name;return this.previous?this.previous+" -> "+o:o}},i.exports=r},{}],29:[function(e,i,s){var r=e("../utils"),o=e("./ConvertWorker"),a=e("./GenericWorker"),l=e("../base64"),h=e("../support"),c=e("../external"),u=null;if(h.nodestream)try{u=e("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(p,g){return new c.Promise(function(m,S){var b=[],y=p._internalType,x=p._outputType,w=p._mimeType;p.on("data",function(T,E){b.push(T),g&&g(E)}).on("error",function(T){b=[],S(T)}).on("end",function(){try{var T=function(E,C,P){switch(E){case"blob":return r.newBlob(r.transformTo("arraybuffer",C),P);case"base64":return l.encode(C);default:return r.transformTo(E,C)}}(x,function(E,C){var P,I=0,F=null,L=0;for(P=0;P<C.length;P++)L+=C[P].length;switch(E){case"string":return C.join("");case"array":return Array.prototype.concat.apply([],C);case"uint8array":for(F=new Uint8Array(L),P=0;P<C.length;P++)F.set(C[P],I),I+=C[P].length;return F;case"nodebuffer":return Buffer.concat(C);default:throw new Error("concat : unsupported type '"+E+"'")}}(y,b),w);m(T)}catch(E){S(E)}b=[]}).resume()})}function d(p,g,m){var S=g;switch(g){case"blob":case"arraybuffer":S="uint8array";break;case"base64":S="string"}try{this._internalType=S,this._outputType=g,this._mimeType=m,r.checkSupport(S),this._worker=p.pipe(new o(S)),p.lock()}catch(b){this._worker=new a("error"),this._worker.error(b)}}d.prototype={accumulate:function(p){return f(this,p)},on:function(p,g){var m=this;return p==="data"?this._worker.on(p,function(S){g.call(m,S.data,S.meta)}):this._worker.on(p,function(){r.delay(g,arguments,m)}),this},resume:function(){return r.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(p){if(r.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new u(this,{objectMode:this._outputType!=="nodebuffer"},p)}},i.exports=d},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,i,s){if(s.base64=!0,s.array=!0,s.string=!0,s.arraybuffer=typeof ArrayBuffer!="undefined"&&typeof Uint8Array!="undefined",s.nodebuffer=typeof Buffer!="undefined",s.uint8array=typeof Uint8Array!="undefined",typeof ArrayBuffer=="undefined")s.blob=!1;else{var r=new ArrayBuffer(0);try{s.blob=new Blob([r],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(r),s.blob=o.getBlob("application/zip").size===0}catch{s.blob=!1}}}try{s.nodestream=!!e("readable-stream").Readable}catch{s.nodestream=!1}},{"readable-stream":16}],31:[function(e,i,s){for(var r=e("./utils"),o=e("./support"),a=e("./nodejsUtils"),l=e("./stream/GenericWorker"),h=new Array(256),c=0;c<256;c++)h[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;h[254]=h[254]=1;function u(){l.call(this,"utf-8 decode"),this.leftOver=null}function f(){l.call(this,"utf-8 encode")}s.utf8encode=function(d){return o.nodebuffer?a.newBufferFrom(d,"utf-8"):function(p){var g,m,S,b,y,x=p.length,w=0;for(b=0;b<x;b++)(64512&(m=p.charCodeAt(b)))==55296&&b+1<x&&(64512&(S=p.charCodeAt(b+1)))==56320&&(m=65536+(m-55296<<10)+(S-56320),b++),w+=m<128?1:m<2048?2:m<65536?3:4;for(g=o.uint8array?new Uint8Array(w):new Array(w),b=y=0;y<w;b++)(64512&(m=p.charCodeAt(b)))==55296&&b+1<x&&(64512&(S=p.charCodeAt(b+1)))==56320&&(m=65536+(m-55296<<10)+(S-56320),b++),m<128?g[y++]=m:(m<2048?g[y++]=192|m>>>6:(m<65536?g[y++]=224|m>>>12:(g[y++]=240|m>>>18,g[y++]=128|m>>>12&63),g[y++]=128|m>>>6&63),g[y++]=128|63&m);return g}(d)},s.utf8decode=function(d){return o.nodebuffer?r.transformTo("nodebuffer",d).toString("utf-8"):function(p){var g,m,S,b,y=p.length,x=new Array(2*y);for(g=m=0;g<y;)if((S=p[g++])<128)x[m++]=S;else if(4<(b=h[S]))x[m++]=65533,g+=b-1;else{for(S&=b===2?31:b===3?15:7;1<b&&g<y;)S=S<<6|63&p[g++],b--;1<b?x[m++]=65533:S<65536?x[m++]=S:(S-=65536,x[m++]=55296|S>>10&1023,x[m++]=56320|1023&S)}return x.length!==m&&(x.subarray?x=x.subarray(0,m):x.length=m),r.applyFromCharCode(x)}(d=r.transformTo(o.uint8array?"uint8array":"array",d))},r.inherits(u,l),u.prototype.processChunk=function(d){var p=r.transformTo(o.uint8array?"uint8array":"array",d.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var g=p;(p=new Uint8Array(g.length+this.leftOver.length)).set(this.leftOver,0),p.set(g,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var m=function(b,y){var x;for((y=y||b.length)>b.length&&(y=b.length),x=y-1;0<=x&&(192&b[x])==128;)x--;return x<0||x===0?y:x+h[b[x]]>y?x:y}(p),S=p;m!==p.length&&(o.uint8array?(S=p.subarray(0,m),this.leftOver=p.subarray(m,p.length)):(S=p.slice(0,m),this.leftOver=p.slice(m,p.length))),this.push({data:s.utf8decode(S),meta:d.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:s.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},s.Utf8DecodeWorker=u,r.inherits(f,l),f.prototype.processChunk=function(d){this.push({data:s.utf8encode(d.data),meta:d.meta})},s.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,i,s){var r=e("./support"),o=e("./base64"),a=e("./nodejsUtils"),l=e("set-immediate-shim"),h=e("./external");function c(m){return m}function u(m,S){for(var b=0;b<m.length;++b)S[b]=255&m.charCodeAt(b);return S}s.newBlob=function(m,S){s.checkSupport("blob");try{return new Blob([m],{type:S})}catch{try{var b=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return b.append(m),b.getBlob(S)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(m,S,b){var y=[],x=0,w=m.length;if(w<=b)return String.fromCharCode.apply(null,m);for(;x<w;)S==="array"||S==="nodebuffer"?y.push(String.fromCharCode.apply(null,m.slice(x,Math.min(x+b,w)))):y.push(String.fromCharCode.apply(null,m.subarray(x,Math.min(x+b,w)))),x+=b;return y.join("")},stringifyByChar:function(m){for(var S="",b=0;b<m.length;b++)S+=String.fromCharCode(m[b]);return S},applyCanBeUsed:{uint8array:function(){try{return r.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}}(),nodebuffer:function(){try{return r.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}}()}};function d(m){var S=65536,b=s.getTypeOf(m),y=!0;if(b==="uint8array"?y=f.applyCanBeUsed.uint8array:b==="nodebuffer"&&(y=f.applyCanBeUsed.nodebuffer),y)for(;1<S;)try{return f.stringifyByChunk(m,b,S)}catch{S=Math.floor(S/2)}return f.stringifyByChar(m)}function p(m,S){for(var b=0;b<m.length;b++)S[b]=m[b];return S}s.applyFromCharCode=d;var g={};g.string={string:c,array:function(m){return u(m,new Array(m.length))},arraybuffer:function(m){return g.string.uint8array(m).buffer},uint8array:function(m){return u(m,new Uint8Array(m.length))},nodebuffer:function(m){return u(m,a.allocBuffer(m.length))}},g.array={string:d,array:c,arraybuffer:function(m){return new Uint8Array(m).buffer},uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(m)}},g.arraybuffer={string:function(m){return d(new Uint8Array(m))},array:function(m){return p(new Uint8Array(m),new Array(m.byteLength))},arraybuffer:c,uint8array:function(m){return new Uint8Array(m)},nodebuffer:function(m){return a.newBufferFrom(new Uint8Array(m))}},g.uint8array={string:d,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return m.buffer},uint8array:c,nodebuffer:function(m){return a.newBufferFrom(m)}},g.nodebuffer={string:d,array:function(m){return p(m,new Array(m.length))},arraybuffer:function(m){return g.nodebuffer.uint8array(m).buffer},uint8array:function(m){return p(m,new Uint8Array(m.length))},nodebuffer:c},s.transformTo=function(m,S){if(S=S||"",!m)return S;s.checkSupport(m);var b=s.getTypeOf(S);return g[b][m](S)},s.getTypeOf=function(m){return typeof m=="string"?"string":Object.prototype.toString.call(m)==="[object Array]"?"array":r.nodebuffer&&a.isBuffer(m)?"nodebuffer":r.uint8array&&m instanceof Uint8Array?"uint8array":r.arraybuffer&&m instanceof ArrayBuffer?"arraybuffer":void 0},s.checkSupport=function(m){if(!r[m.toLowerCase()])throw new Error(m+" is not supported by this platform")},s.MAX_VALUE_16BITS=65535,s.MAX_VALUE_32BITS=-1,s.pretty=function(m){var S,b,y="";for(b=0;b<(m||"").length;b++)y+="\\x"+((S=m.charCodeAt(b))<16?"0":"")+S.toString(16).toUpperCase();return y},s.delay=function(m,S,b){l(function(){m.apply(b||null,S||[])})},s.inherits=function(m,S){function b(){}b.prototype=S.prototype,m.prototype=new b},s.extend=function(){var m,S,b={};for(m=0;m<arguments.length;m++)for(S in arguments[m])arguments[m].hasOwnProperty(S)&&b[S]===void 0&&(b[S]=arguments[m][S]);return b},s.prepareContent=function(m,S,b,y,x){return h.Promise.resolve(S).then(function(w){return r.blob&&(w instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(w))!==-1)&&typeof FileReader!="undefined"?new h.Promise(function(T,E){var C=new FileReader;C.onload=function(P){T(P.target.result)},C.onerror=function(P){E(P.target.error)},C.readAsArrayBuffer(w)}):w}).then(function(w){var T=s.getTypeOf(w);return T?(T==="arraybuffer"?w=s.transformTo("uint8array",w):T==="string"&&(x?w=o.decode(w):b&&y!==!0&&(w=function(E){return u(E,r.uint8array?new Uint8Array(E.length):new Array(E.length))}(w))),w):h.Promise.reject(new Error("Can't read the data of '"+m+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,"set-immediate-shim":54}],33:[function(e,i,s){var r=e("./reader/readerFor"),o=e("./utils"),a=e("./signature"),l=e("./zipEntry"),h=(e("./utf8"),e("./support"));function c(u){this.files=[],this.loadOptions=u}c.prototype={checkSignature:function(u){if(!this.reader.readAndCheckSignature(u)){this.reader.index-=4;var f=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+o.pretty(f)+", expected "+o.pretty(u)+")")}},isSignature:function(u,f){var d=this.reader.index;this.reader.setIndex(u);var p=this.reader.readString(4)===f;return this.reader.setIndex(d),p},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var u=this.reader.readData(this.zipCommentLength),f=h.uint8array?"uint8array":"array",d=o.transformTo(f,u);this.zipComment=this.loadOptions.decodeFileName(d)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var u,f,d,p=this.zip64EndOfCentralSize-44;0<p;)u=this.reader.readInt(2),f=this.reader.readInt(4),d=this.reader.readData(f),this.zip64ExtensibleData[u]={id:u,length:f,value:d}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var u,f;for(u=0;u<this.files.length;u++)f=this.files[u],this.reader.setIndex(f.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),f.readLocalPart(this.reader),f.handleUTF8(),f.processAttributes()},readCentralDir:function(){var u;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(u=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(u);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var u=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(u<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(u);var f=u;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===o.MAX_VALUE_16BITS||this.diskWithCentralDirStart===o.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===o.MAX_VALUE_16BITS||this.centralDirRecords===o.MAX_VALUE_16BITS||this.centralDirSize===o.MAX_VALUE_32BITS||this.centralDirOffset===o.MAX_VALUE_32BITS){if(this.zip64=!0,(u=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(u),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var d=this.centralDirOffset+this.centralDirSize;this.zip64&&(d+=20,d+=12+this.zip64EndOfCentralSize);var p=f-d;if(0<p)this.isSignature(f,a.CENTRAL_FILE_HEADER)||(this.reader.zero=p);else if(p<0)throw new Error("Corrupted zip: missing "+Math.abs(p)+" bytes.")},prepareReader:function(u){this.reader=r(u)},load:function(u){this.prepareReader(u),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},i.exports=c},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utf8":31,"./utils":32,"./zipEntry":34}],34:[function(e,i,s){var r=e("./reader/readerFor"),o=e("./utils"),a=e("./compressedObject"),l=e("./crc32"),h=e("./utf8"),c=e("./compressions"),u=e("./support");function f(d,p){this.options=d,this.loadOptions=p}f.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(d){var p,g;if(d.skip(22),this.fileNameLength=d.readInt(2),g=d.readInt(2),this.fileName=d.readData(this.fileNameLength),d.skip(g),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((p=function(m){for(var S in c)if(c.hasOwnProperty(S)&&c[S].magic===m)return c[S];return null}(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+o.pretty(this.compressionMethod)+" unknown (inner file : "+o.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,p,d.readData(this.compressedSize))},readCentralPart:function(d){this.versionMadeBy=d.readInt(2),d.skip(2),this.bitFlag=d.readInt(2),this.compressionMethod=d.readString(2),this.date=d.readDate(),this.crc32=d.readInt(4),this.compressedSize=d.readInt(4),this.uncompressedSize=d.readInt(4);var p=d.readInt(2);if(this.extraFieldsLength=d.readInt(2),this.fileCommentLength=d.readInt(2),this.diskNumberStart=d.readInt(2),this.internalFileAttributes=d.readInt(2),this.externalFileAttributes=d.readInt(4),this.localHeaderOffset=d.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");d.skip(p),this.readExtraFields(d),this.parseZIP64ExtraField(d),this.fileComment=d.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var d=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),d==0&&(this.dosPermissions=63&this.externalFileAttributes),d==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(d){if(this.extraFields[1]){var p=r(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=p.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=p.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=p.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=p.readInt(4))}},readExtraFields:function(d){var p,g,m,S=d.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});d.index+4<S;)p=d.readInt(2),g=d.readInt(2),m=d.readData(g),this.extraFields[p]={id:p,length:g,value:m};d.setIndex(S)},handleUTF8:function(){var d=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=h.utf8decode(this.fileName),this.fileCommentStr=h.utf8decode(this.fileComment);else{var p=this.findExtraFieldUnicodePath();if(p!==null)this.fileNameStr=p;else{var g=o.transformTo(d,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(g)}var m=this.findExtraFieldUnicodeComment();if(m!==null)this.fileCommentStr=m;else{var S=o.transformTo(d,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(S)}}},findExtraFieldUnicodePath:function(){var d=this.extraFields[28789];if(d){var p=r(d.value);return p.readInt(1)!==1||l(this.fileName)!==p.readInt(4)?null:h.utf8decode(p.readData(d.length-5))}return null},findExtraFieldUnicodeComment:function(){var d=this.extraFields[25461];if(d){var p=r(d.value);return p.readInt(1)!==1||l(this.fileComment)!==p.readInt(4)?null:h.utf8decode(p.readData(d.length-5))}return null}},i.exports=f},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,i,s){function r(p,g,m){this.name=p,this.dir=m.dir,this.date=m.date,this.comment=m.comment,this.unixPermissions=m.unixPermissions,this.dosPermissions=m.dosPermissions,this._data=g,this._dataBinary=m.binary,this.options={compression:m.compression,compressionOptions:m.compressionOptions}}var o=e("./stream/StreamHelper"),a=e("./stream/DataWorker"),l=e("./utf8"),h=e("./compressedObject"),c=e("./stream/GenericWorker");r.prototype={internalStream:function(p){var g=null,m="string";try{if(!p)throw new Error("No output type specified.");var S=(m=p.toLowerCase())==="string"||m==="text";m!=="binarystring"&&m!=="text"||(m="string"),g=this._decompressWorker();var b=!this._dataBinary;b&&!S&&(g=g.pipe(new l.Utf8EncodeWorker)),!b&&S&&(g=g.pipe(new l.Utf8DecodeWorker))}catch(y){(g=new c("error")).error(y)}return new o(g,m,"")},async:function(p,g){return this.internalStream(p).accumulate(g)},nodeStream:function(p,g){return this.internalStream(p||"nodebuffer").toNodejsStream(g)},_compressWorker:function(p,g){if(this._data instanceof h&&this._data.compression.magic===p.magic)return this._data.getCompressedWorker();var m=this._decompressWorker();return this._dataBinary||(m=m.pipe(new l.Utf8EncodeWorker)),h.createWorkerFrom(m,p,g)},_decompressWorker:function(){return this._data instanceof h?this._data.getContentWorker():this._data instanceof c?this._data:new a(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],f=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},d=0;d<u.length;d++)r.prototype[u[d]]=f;i.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,i,s){(function(r){var o,a,l=r.MutationObserver||r.WebKitMutationObserver;if(l){var h=0,c=new l(p),u=r.document.createTextNode("");c.observe(u,{characterData:!0}),o=function(){u.data=h=++h%2}}else if(r.setImmediate||r.MessageChannel===void 0)o="document"in r&&"onreadystatechange"in r.document.createElement("script")?function(){var g=r.document.createElement("script");g.onreadystatechange=function(){p(),g.onreadystatechange=null,g.parentNode.removeChild(g),g=null},r.document.documentElement.appendChild(g)}:function(){setTimeout(p,0)};else{var f=new r.MessageChannel;f.port1.onmessage=p,o=function(){f.port2.postMessage(0)}}var d=[];function p(){var g,m;a=!0;for(var S=d.length;S;){for(m=d,d=[],g=-1;++g<S;)m[g]();S=d.length}a=!1}i.exports=function(g){d.push(g)!==1||a||o()}}).call(this,typeof We!="undefined"?We:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],37:[function(e,i,s){var r=e("immediate");function o(){}var a={},l=["REJECTED"],h=["FULFILLED"],c=["PENDING"];function u(S){if(typeof S!="function")throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,S!==o&&g(this,S)}function f(S,b,y){this.promise=S,typeof b=="function"&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),typeof y=="function"&&(this.onRejected=y,this.callRejected=this.otherCallRejected)}function d(S,b,y){r(function(){var x;try{x=b(y)}catch(w){return a.reject(S,w)}x===S?a.reject(S,new TypeError("Cannot resolve promise with itself")):a.resolve(S,x)})}function p(S){var b=S&&S.then;if(S&&(typeof S=="object"||typeof S=="function")&&typeof b=="function")return function(){b.apply(S,arguments)}}function g(S,b){var y=!1;function x(E){y||(y=!0,a.reject(S,E))}function w(E){y||(y=!0,a.resolve(S,E))}var T=m(function(){b(w,x)});T.status==="error"&&x(T.value)}function m(S,b){var y={};try{y.value=S(b),y.status="success"}catch(x){y.status="error",y.value=x}return y}(i.exports=u).prototype.finally=function(S){if(typeof S!="function")return this;var b=this.constructor;return this.then(function(y){return b.resolve(S()).then(function(){return y})},function(y){return b.resolve(S()).then(function(){throw y})})},u.prototype.catch=function(S){return this.then(null,S)},u.prototype.then=function(S,b){if(typeof S!="function"&&this.state===h||typeof b!="function"&&this.state===l)return this;var y=new this.constructor(o);return this.state!==c?d(y,this.state===h?S:b,this.outcome):this.queue.push(new f(y,S,b)),y},f.prototype.callFulfilled=function(S){a.resolve(this.promise,S)},f.prototype.otherCallFulfilled=function(S){d(this.promise,this.onFulfilled,S)},f.prototype.callRejected=function(S){a.reject(this.promise,S)},f.prototype.otherCallRejected=function(S){d(this.promise,this.onRejected,S)},a.resolve=function(S,b){var y=m(p,b);if(y.status==="error")return a.reject(S,y.value);var x=y.value;if(x)g(S,x);else{S.state=h,S.outcome=b;for(var w=-1,T=S.queue.length;++w<T;)S.queue[w].callFulfilled(b)}return S},a.reject=function(S,b){S.state=l,S.outcome=b;for(var y=-1,x=S.queue.length;++y<x;)S.queue[y].callRejected(b);return S},u.resolve=function(S){return S instanceof this?S:a.resolve(new this(o),S)},u.reject=function(S){var b=new this(o);return a.reject(b,S)},u.all=function(S){var b=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=S.length,x=!1;if(!y)return this.resolve([]);for(var w=new Array(y),T=0,E=-1,C=new this(o);++E<y;)P(S[E],E);return C;function P(I,F){b.resolve(I).then(function(L){w[F]=L,++T!==y||x||(x=!0,a.resolve(C,w))},function(L){x||(x=!0,a.reject(C,L))})}},u.race=function(S){var b=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=S.length,x=!1;if(!y)return this.resolve([]);for(var w=-1,T=new this(o);++w<y;)E=S[w],b.resolve(E).then(function(C){x||(x=!0,a.resolve(T,C))},function(C){x||(x=!0,a.reject(T,C))});var E;return T}},{immediate:36}],38:[function(e,i,s){var r={};(0,e("./lib/utils/common").assign)(r,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),i.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,i,s){var r=e("./zlib/deflate"),o=e("./utils/common"),a=e("./utils/strings"),l=e("./zlib/messages"),h=e("./zlib/zstream"),c=Object.prototype.toString,u=0,f=-1,d=0,p=8;function g(S){if(!(this instanceof g))return new g(S);this.options=o.assign({level:f,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:d,to:""},S||{});var b=this.options;b.raw&&0<b.windowBits?b.windowBits=-b.windowBits:b.gzip&&0<b.windowBits&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new h,this.strm.avail_out=0;var y=r.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(y!==u)throw new Error(l[y]);if(b.header&&r.deflateSetHeader(this.strm,b.header),b.dictionary){var x;if(x=typeof b.dictionary=="string"?a.string2buf(b.dictionary):c.call(b.dictionary)==="[object ArrayBuffer]"?new Uint8Array(b.dictionary):b.dictionary,(y=r.deflateSetDictionary(this.strm,x))!==u)throw new Error(l[y]);this._dict_set=!0}}function m(S,b){var y=new g(b);if(y.push(S,!0),y.err)throw y.msg||l[y.err];return y.result}g.prototype.push=function(S,b){var y,x,w=this.strm,T=this.options.chunkSize;if(this.ended)return!1;x=b===~~b?b:b===!0?4:0,typeof S=="string"?w.input=a.string2buf(S):c.call(S)==="[object ArrayBuffer]"?w.input=new Uint8Array(S):w.input=S,w.next_in=0,w.avail_in=w.input.length;do{if(w.avail_out===0&&(w.output=new o.Buf8(T),w.next_out=0,w.avail_out=T),(y=r.deflate(w,x))!==1&&y!==u)return this.onEnd(y),!(this.ended=!0);w.avail_out!==0&&(w.avail_in!==0||x!==4&&x!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(o.shrinkBuf(w.output,w.next_out))):this.onData(o.shrinkBuf(w.output,w.next_out)))}while((0<w.avail_in||w.avail_out===0)&&y!==1);return x===4?(y=r.deflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===u):x!==2||(this.onEnd(u),!(w.avail_out=0))},g.prototype.onData=function(S){this.chunks.push(S)},g.prototype.onEnd=function(S){S===u&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=S,this.msg=this.strm.msg},s.Deflate=g,s.deflate=m,s.deflateRaw=function(S,b){return(b=b||{}).raw=!0,m(S,b)},s.gzip=function(S,b){return(b=b||{}).gzip=!0,m(S,b)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,i,s){var r=e("./zlib/inflate"),o=e("./utils/common"),a=e("./utils/strings"),l=e("./zlib/constants"),h=e("./zlib/messages"),c=e("./zlib/zstream"),u=e("./zlib/gzheader"),f=Object.prototype.toString;function d(g){if(!(this instanceof d))return new d(g);this.options=o.assign({chunkSize:16384,windowBits:0,to:""},g||{});var m=this.options;m.raw&&0<=m.windowBits&&m.windowBits<16&&(m.windowBits=-m.windowBits,m.windowBits===0&&(m.windowBits=-15)),!(0<=m.windowBits&&m.windowBits<16)||g&&g.windowBits||(m.windowBits+=32),15<m.windowBits&&m.windowBits<48&&(15&m.windowBits)==0&&(m.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var S=r.inflateInit2(this.strm,m.windowBits);if(S!==l.Z_OK)throw new Error(h[S]);this.header=new u,r.inflateGetHeader(this.strm,this.header)}function p(g,m){var S=new d(m);if(S.push(g,!0),S.err)throw S.msg||h[S.err];return S.result}d.prototype.push=function(g,m){var S,b,y,x,w,T,E=this.strm,C=this.options.chunkSize,P=this.options.dictionary,I=!1;if(this.ended)return!1;b=m===~~m?m:m===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof g=="string"?E.input=a.binstring2buf(g):f.call(g)==="[object ArrayBuffer]"?E.input=new Uint8Array(g):E.input=g,E.next_in=0,E.avail_in=E.input.length;do{if(E.avail_out===0&&(E.output=new o.Buf8(C),E.next_out=0,E.avail_out=C),(S=r.inflate(E,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&P&&(T=typeof P=="string"?a.string2buf(P):f.call(P)==="[object ArrayBuffer]"?new Uint8Array(P):P,S=r.inflateSetDictionary(this.strm,T)),S===l.Z_BUF_ERROR&&I===!0&&(S=l.Z_OK,I=!1),S!==l.Z_STREAM_END&&S!==l.Z_OK)return this.onEnd(S),!(this.ended=!0);E.next_out&&(E.avail_out!==0&&S!==l.Z_STREAM_END&&(E.avail_in!==0||b!==l.Z_FINISH&&b!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(y=a.utf8border(E.output,E.next_out),x=E.next_out-y,w=a.buf2string(E.output,y),E.next_out=x,E.avail_out=C-x,x&&o.arraySet(E.output,E.output,y,x,0),this.onData(w)):this.onData(o.shrinkBuf(E.output,E.next_out)))),E.avail_in===0&&E.avail_out===0&&(I=!0)}while((0<E.avail_in||E.avail_out===0)&&S!==l.Z_STREAM_END);return S===l.Z_STREAM_END&&(b=l.Z_FINISH),b===l.Z_FINISH?(S=r.inflateEnd(this.strm),this.onEnd(S),this.ended=!0,S===l.Z_OK):b!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(E.avail_out=0))},d.prototype.onData=function(g){this.chunks.push(g)},d.prototype.onEnd=function(g){g===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=o.flattenChunks(this.chunks)),this.chunks=[],this.err=g,this.msg=this.strm.msg},s.Inflate=d,s.inflate=p,s.inflateRaw=function(g,m){return(m=m||{}).raw=!0,p(g,m)},s.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,i,s){var r=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";s.assign=function(l){for(var h=Array.prototype.slice.call(arguments,1);h.length;){var c=h.shift();if(c){if(typeof c!="object")throw new TypeError(c+"must be non-object");for(var u in c)c.hasOwnProperty(u)&&(l[u]=c[u])}}return l},s.shrinkBuf=function(l,h){return l.length===h?l:l.subarray?l.subarray(0,h):(l.length=h,l)};var o={arraySet:function(l,h,c,u,f){if(h.subarray&&l.subarray)l.set(h.subarray(c,c+u),f);else for(var d=0;d<u;d++)l[f+d]=h[c+d]},flattenChunks:function(l){var h,c,u,f,d,p;for(h=u=0,c=l.length;h<c;h++)u+=l[h].length;for(p=new Uint8Array(u),h=f=0,c=l.length;h<c;h++)d=l[h],p.set(d,f),f+=d.length;return p}},a={arraySet:function(l,h,c,u,f){for(var d=0;d<u;d++)l[f+d]=h[c+d]},flattenChunks:function(l){return[].concat.apply([],l)}};s.setTyped=function(l){l?(s.Buf8=Uint8Array,s.Buf16=Uint16Array,s.Buf32=Int32Array,s.assign(s,o)):(s.Buf8=Array,s.Buf16=Array,s.Buf32=Array,s.assign(s,a))},s.setTyped(r)},{}],42:[function(e,i,s){var r=e("./common"),o=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{o=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new r.Buf8(256),h=0;h<256;h++)l[h]=252<=h?6:248<=h?5:240<=h?4:224<=h?3:192<=h?2:1;function c(u,f){if(f<65537&&(u.subarray&&a||!u.subarray&&o))return String.fromCharCode.apply(null,r.shrinkBuf(u,f));for(var d="",p=0;p<f;p++)d+=String.fromCharCode(u[p]);return d}l[254]=l[254]=1,s.string2buf=function(u){var f,d,p,g,m,S=u.length,b=0;for(g=0;g<S;g++)(64512&(d=u.charCodeAt(g)))==55296&&g+1<S&&(64512&(p=u.charCodeAt(g+1)))==56320&&(d=65536+(d-55296<<10)+(p-56320),g++),b+=d<128?1:d<2048?2:d<65536?3:4;for(f=new r.Buf8(b),g=m=0;m<b;g++)(64512&(d=u.charCodeAt(g)))==55296&&g+1<S&&(64512&(p=u.charCodeAt(g+1)))==56320&&(d=65536+(d-55296<<10)+(p-56320),g++),d<128?f[m++]=d:(d<2048?f[m++]=192|d>>>6:(d<65536?f[m++]=224|d>>>12:(f[m++]=240|d>>>18,f[m++]=128|d>>>12&63),f[m++]=128|d>>>6&63),f[m++]=128|63&d);return f},s.buf2binstring=function(u){return c(u,u.length)},s.binstring2buf=function(u){for(var f=new r.Buf8(u.length),d=0,p=f.length;d<p;d++)f[d]=u.charCodeAt(d);return f},s.buf2string=function(u,f){var d,p,g,m,S=f||u.length,b=new Array(2*S);for(d=p=0;d<S;)if((g=u[d++])<128)b[p++]=g;else if(4<(m=l[g]))b[p++]=65533,d+=m-1;else{for(g&=m===2?31:m===3?15:7;1<m&&d<S;)g=g<<6|63&u[d++],m--;1<m?b[p++]=65533:g<65536?b[p++]=g:(g-=65536,b[p++]=55296|g>>10&1023,b[p++]=56320|1023&g)}return c(b,p)},s.utf8border=function(u,f){var d;for((f=f||u.length)>u.length&&(f=u.length),d=f-1;0<=d&&(192&u[d])==128;)d--;return d<0||d===0?f:d+l[u[d]]>f?d:f}},{"./common":41}],43:[function(e,i,s){i.exports=function(r,o,a,l){for(var h=65535&r|0,c=r>>>16&65535|0,u=0;a!==0;){for(a-=u=2e3<a?2e3:a;c=c+(h=h+o[l++]|0)|0,--u;);h%=65521,c%=65521}return h|c<<16|0}},{}],44:[function(e,i,s){i.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,i,s){var r=function(){for(var o,a=[],l=0;l<256;l++){o=l;for(var h=0;h<8;h++)o=1&o?3988292384^o>>>1:o>>>1;a[l]=o}return a}();i.exports=function(o,a,l,h){var c=r,u=h+l;o^=-1;for(var f=h;f<u;f++)o=o>>>8^c[255&(o^a[f])];return-1^o}},{}],46:[function(e,i,s){var r,o=e("../utils/common"),a=e("./trees"),l=e("./adler32"),h=e("./crc32"),c=e("./messages"),u=0,f=4,d=0,p=-2,g=-1,m=4,S=2,b=8,y=9,x=286,w=30,T=19,E=2*x+1,C=15,P=3,I=258,F=I+P+1,L=42,k=113,v=1,G=2,et=3,H=4;function nt(_,Z){return _.msg=c[Z],Z}function K(_){return(_<<1)-(4<_?9:0)}function lt(_){for(var Z=_.length;0<=--Z;)_[Z]=0}function A(_){var Z=_.state,Y=Z.pending;Y>_.avail_out&&(Y=_.avail_out),Y!==0&&(o.arraySet(_.output,Z.pending_buf,Z.pending_out,Y,_.next_out),_.next_out+=Y,Z.pending_out+=Y,_.total_out+=Y,_.avail_out-=Y,Z.pending-=Y,Z.pending===0&&(Z.pending_out=0))}function B(_,Z){a._tr_flush_block(_,0<=_.block_start?_.block_start:-1,_.strstart-_.block_start,Z),_.block_start=_.strstart,A(_.strm)}function ot(_,Z){_.pending_buf[_.pending++]=Z}function rt(_,Z){_.pending_buf[_.pending++]=Z>>>8&255,_.pending_buf[_.pending++]=255&Z}function J(_,Z){var Y,N,R=_.max_chain_length,D=_.strstart,Q=_.prev_length,$=_.nice_match,U=_.strstart>_.w_size-F?_.strstart-(_.w_size-F):0,it=_.window,mt=_.w_mask,at=_.prev,Mt=_.strstart+I,ee=it[D+Q-1],Ut=it[D+Q];_.prev_length>=_.good_match&&(R>>=2),$>_.lookahead&&($=_.lookahead);do if(it[(Y=Z)+Q]===Ut&&it[Y+Q-1]===ee&&it[Y]===it[D]&&it[++Y]===it[D+1]){D+=2,Y++;do;while(it[++D]===it[++Y]&&it[++D]===it[++Y]&&it[++D]===it[++Y]&&it[++D]===it[++Y]&&it[++D]===it[++Y]&&it[++D]===it[++Y]&&it[++D]===it[++Y]&&it[++D]===it[++Y]&&D<Mt);if(N=I-(Mt-D),D=Mt-I,Q<N){if(_.match_start=Z,$<=(Q=N))break;ee=it[D+Q-1],Ut=it[D+Q]}}while((Z=at[Z&mt])>U&&--R!=0);return Q<=_.lookahead?Q:_.lookahead}function ct(_){var Z,Y,N,R,D,Q,$,U,it,mt,at=_.w_size;do{if(R=_.window_size-_.lookahead-_.strstart,_.strstart>=at+(at-F)){for(o.arraySet(_.window,_.window,at,at,0),_.match_start-=at,_.strstart-=at,_.block_start-=at,Z=Y=_.hash_size;N=_.head[--Z],_.head[Z]=at<=N?N-at:0,--Y;);for(Z=Y=at;N=_.prev[--Z],_.prev[Z]=at<=N?N-at:0,--Y;);R+=at}if(_.strm.avail_in===0)break;if(Q=_.strm,$=_.window,U=_.strstart+_.lookahead,it=R,mt=void 0,mt=Q.avail_in,it<mt&&(mt=it),Y=mt===0?0:(Q.avail_in-=mt,o.arraySet($,Q.input,Q.next_in,mt,U),Q.state.wrap===1?Q.adler=l(Q.adler,$,mt,U):Q.state.wrap===2&&(Q.adler=h(Q.adler,$,mt,U)),Q.next_in+=mt,Q.total_in+=mt,mt),_.lookahead+=Y,_.lookahead+_.insert>=P)for(D=_.strstart-_.insert,_.ins_h=_.window[D],_.ins_h=(_.ins_h<<_.hash_shift^_.window[D+1])&_.hash_mask;_.insert&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[D+P-1])&_.hash_mask,_.prev[D&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=D,D++,_.insert--,!(_.lookahead+_.insert<P)););}while(_.lookahead<F&&_.strm.avail_in!==0)}function Nt(_,Z){for(var Y,N;;){if(_.lookahead<F){if(ct(_),_.lookahead<F&&Z===u)return v;if(_.lookahead===0)break}if(Y=0,_.lookahead>=P&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+P-1])&_.hash_mask,Y=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),Y!==0&&_.strstart-Y<=_.w_size-F&&(_.match_length=J(_,Y)),_.match_length>=P)if(N=a._tr_tally(_,_.strstart-_.match_start,_.match_length-P),_.lookahead-=_.match_length,_.match_length<=_.max_lazy_match&&_.lookahead>=P){for(_.match_length--;_.strstart++,_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+P-1])&_.hash_mask,Y=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart,--_.match_length!=0;);_.strstart++}else _.strstart+=_.match_length,_.match_length=0,_.ins_h=_.window[_.strstart],_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+1])&_.hash_mask;else N=a._tr_tally(_,0,_.window[_.strstart]),_.lookahead--,_.strstart++;if(N&&(B(_,!1),_.strm.avail_out===0))return v}return _.insert=_.strstart<P-1?_.strstart:P-1,Z===f?(B(_,!0),_.strm.avail_out===0?et:H):_.last_lit&&(B(_,!1),_.strm.avail_out===0)?v:G}function pt(_,Z){for(var Y,N,R;;){if(_.lookahead<F){if(ct(_),_.lookahead<F&&Z===u)return v;if(_.lookahead===0)break}if(Y=0,_.lookahead>=P&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+P-1])&_.hash_mask,Y=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),_.prev_length=_.match_length,_.prev_match=_.match_start,_.match_length=P-1,Y!==0&&_.prev_length<_.max_lazy_match&&_.strstart-Y<=_.w_size-F&&(_.match_length=J(_,Y),_.match_length<=5&&(_.strategy===1||_.match_length===P&&4096<_.strstart-_.match_start)&&(_.match_length=P-1)),_.prev_length>=P&&_.match_length<=_.prev_length){for(R=_.strstart+_.lookahead-P,N=a._tr_tally(_,_.strstart-1-_.prev_match,_.prev_length-P),_.lookahead-=_.prev_length-1,_.prev_length-=2;++_.strstart<=R&&(_.ins_h=(_.ins_h<<_.hash_shift^_.window[_.strstart+P-1])&_.hash_mask,Y=_.prev[_.strstart&_.w_mask]=_.head[_.ins_h],_.head[_.ins_h]=_.strstart),--_.prev_length!=0;);if(_.match_available=0,_.match_length=P-1,_.strstart++,N&&(B(_,!1),_.strm.avail_out===0))return v}else if(_.match_available){if((N=a._tr_tally(_,0,_.window[_.strstart-1]))&&B(_,!1),_.strstart++,_.lookahead--,_.strm.avail_out===0)return v}else _.match_available=1,_.strstart++,_.lookahead--}return _.match_available&&(N=a._tr_tally(_,0,_.window[_.strstart-1]),_.match_available=0),_.insert=_.strstart<P-1?_.strstart:P-1,Z===f?(B(_,!0),_.strm.avail_out===0?et:H):_.last_lit&&(B(_,!1),_.strm.avail_out===0)?v:G}function dt(_,Z,Y,N,R){this.good_length=_,this.max_lazy=Z,this.nice_length=Y,this.max_chain=N,this.func=R}function Ct(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=b,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new o.Buf16(2*E),this.dyn_dtree=new o.Buf16(2*(2*w+1)),this.bl_tree=new o.Buf16(2*(2*T+1)),lt(this.dyn_ltree),lt(this.dyn_dtree),lt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new o.Buf16(C+1),this.heap=new o.Buf16(2*x+1),lt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new o.Buf16(2*x+1),lt(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Ht(_){var Z;return _&&_.state?(_.total_in=_.total_out=0,_.data_type=S,(Z=_.state).pending=0,Z.pending_out=0,Z.wrap<0&&(Z.wrap=-Z.wrap),Z.status=Z.wrap?L:k,_.adler=Z.wrap===2?0:1,Z.last_flush=u,a._tr_init(Z),d):nt(_,p)}function me(_){var Z=Ht(_);return Z===d&&function(Y){Y.window_size=2*Y.w_size,lt(Y.head),Y.max_lazy_match=r[Y.level].max_lazy,Y.good_match=r[Y.level].good_length,Y.nice_match=r[Y.level].nice_length,Y.max_chain_length=r[Y.level].max_chain,Y.strstart=0,Y.block_start=0,Y.lookahead=0,Y.insert=0,Y.match_length=Y.prev_length=P-1,Y.match_available=0,Y.ins_h=0}(_.state),Z}function ce(_,Z,Y,N,R,D){if(!_)return p;var Q=1;if(Z===g&&(Z=6),N<0?(Q=0,N=-N):15<N&&(Q=2,N-=16),R<1||y<R||Y!==b||N<8||15<N||Z<0||9<Z||D<0||m<D)return nt(_,p);N===8&&(N=9);var $=new Ct;return(_.state=$).strm=_,$.wrap=Q,$.gzhead=null,$.w_bits=N,$.w_size=1<<$.w_bits,$.w_mask=$.w_size-1,$.hash_bits=R+7,$.hash_size=1<<$.hash_bits,$.hash_mask=$.hash_size-1,$.hash_shift=~~(($.hash_bits+P-1)/P),$.window=new o.Buf8(2*$.w_size),$.head=new o.Buf16($.hash_size),$.prev=new o.Buf16($.w_size),$.lit_bufsize=1<<R+6,$.pending_buf_size=4*$.lit_bufsize,$.pending_buf=new o.Buf8($.pending_buf_size),$.d_buf=1*$.lit_bufsize,$.l_buf=3*$.lit_bufsize,$.level=Z,$.strategy=D,$.method=Y,me(_)}r=[new dt(0,0,0,0,function(_,Z){var Y=65535;for(Y>_.pending_buf_size-5&&(Y=_.pending_buf_size-5);;){if(_.lookahead<=1){if(ct(_),_.lookahead===0&&Z===u)return v;if(_.lookahead===0)break}_.strstart+=_.lookahead,_.lookahead=0;var N=_.block_start+Y;if((_.strstart===0||_.strstart>=N)&&(_.lookahead=_.strstart-N,_.strstart=N,B(_,!1),_.strm.avail_out===0)||_.strstart-_.block_start>=_.w_size-F&&(B(_,!1),_.strm.avail_out===0))return v}return _.insert=0,Z===f?(B(_,!0),_.strm.avail_out===0?et:H):(_.strstart>_.block_start&&(B(_,!1),_.strm.avail_out),v)}),new dt(4,4,8,4,Nt),new dt(4,5,16,8,Nt),new dt(4,6,32,32,Nt),new dt(4,4,16,16,pt),new dt(8,16,32,32,pt),new dt(8,16,128,128,pt),new dt(8,32,128,256,pt),new dt(32,128,258,1024,pt),new dt(32,258,258,4096,pt)],s.deflateInit=function(_,Z){return ce(_,Z,b,15,8,0)},s.deflateInit2=ce,s.deflateReset=me,s.deflateResetKeep=Ht,s.deflateSetHeader=function(_,Z){return _&&_.state?_.state.wrap!==2?p:(_.state.gzhead=Z,d):p},s.deflate=function(_,Z){var Y,N,R,D;if(!_||!_.state||5<Z||Z<0)return _?nt(_,p):p;if(N=_.state,!_.output||!_.input&&_.avail_in!==0||N.status===666&&Z!==f)return nt(_,_.avail_out===0?-5:p);if(N.strm=_,Y=N.last_flush,N.last_flush=Z,N.status===L)if(N.wrap===2)_.adler=0,ot(N,31),ot(N,139),ot(N,8),N.gzhead?(ot(N,(N.gzhead.text?1:0)+(N.gzhead.hcrc?2:0)+(N.gzhead.extra?4:0)+(N.gzhead.name?8:0)+(N.gzhead.comment?16:0)),ot(N,255&N.gzhead.time),ot(N,N.gzhead.time>>8&255),ot(N,N.gzhead.time>>16&255),ot(N,N.gzhead.time>>24&255),ot(N,N.level===9?2:2<=N.strategy||N.level<2?4:0),ot(N,255&N.gzhead.os),N.gzhead.extra&&N.gzhead.extra.length&&(ot(N,255&N.gzhead.extra.length),ot(N,N.gzhead.extra.length>>8&255)),N.gzhead.hcrc&&(_.adler=h(_.adler,N.pending_buf,N.pending,0)),N.gzindex=0,N.status=69):(ot(N,0),ot(N,0),ot(N,0),ot(N,0),ot(N,0),ot(N,N.level===9?2:2<=N.strategy||N.level<2?4:0),ot(N,3),N.status=k);else{var Q=b+(N.w_bits-8<<4)<<8;Q|=(2<=N.strategy||N.level<2?0:N.level<6?1:N.level===6?2:3)<<6,N.strstart!==0&&(Q|=32),Q+=31-Q%31,N.status=k,rt(N,Q),N.strstart!==0&&(rt(N,_.adler>>>16),rt(N,65535&_.adler)),_.adler=1}if(N.status===69)if(N.gzhead.extra){for(R=N.pending;N.gzindex<(65535&N.gzhead.extra.length)&&(N.pending!==N.pending_buf_size||(N.gzhead.hcrc&&N.pending>R&&(_.adler=h(_.adler,N.pending_buf,N.pending-R,R)),A(_),R=N.pending,N.pending!==N.pending_buf_size));)ot(N,255&N.gzhead.extra[N.gzindex]),N.gzindex++;N.gzhead.hcrc&&N.pending>R&&(_.adler=h(_.adler,N.pending_buf,N.pending-R,R)),N.gzindex===N.gzhead.extra.length&&(N.gzindex=0,N.status=73)}else N.status=73;if(N.status===73)if(N.gzhead.name){R=N.pending;do{if(N.pending===N.pending_buf_size&&(N.gzhead.hcrc&&N.pending>R&&(_.adler=h(_.adler,N.pending_buf,N.pending-R,R)),A(_),R=N.pending,N.pending===N.pending_buf_size)){D=1;break}D=N.gzindex<N.gzhead.name.length?255&N.gzhead.name.charCodeAt(N.gzindex++):0,ot(N,D)}while(D!==0);N.gzhead.hcrc&&N.pending>R&&(_.adler=h(_.adler,N.pending_buf,N.pending-R,R)),D===0&&(N.gzindex=0,N.status=91)}else N.status=91;if(N.status===91)if(N.gzhead.comment){R=N.pending;do{if(N.pending===N.pending_buf_size&&(N.gzhead.hcrc&&N.pending>R&&(_.adler=h(_.adler,N.pending_buf,N.pending-R,R)),A(_),R=N.pending,N.pending===N.pending_buf_size)){D=1;break}D=N.gzindex<N.gzhead.comment.length?255&N.gzhead.comment.charCodeAt(N.gzindex++):0,ot(N,D)}while(D!==0);N.gzhead.hcrc&&N.pending>R&&(_.adler=h(_.adler,N.pending_buf,N.pending-R,R)),D===0&&(N.status=103)}else N.status=103;if(N.status===103&&(N.gzhead.hcrc?(N.pending+2>N.pending_buf_size&&A(_),N.pending+2<=N.pending_buf_size&&(ot(N,255&_.adler),ot(N,_.adler>>8&255),_.adler=0,N.status=k)):N.status=k),N.pending!==0){if(A(_),_.avail_out===0)return N.last_flush=-1,d}else if(_.avail_in===0&&K(Z)<=K(Y)&&Z!==f)return nt(_,-5);if(N.status===666&&_.avail_in!==0)return nt(_,-5);if(_.avail_in!==0||N.lookahead!==0||Z!==u&&N.status!==666){var $=N.strategy===2?function(U,it){for(var mt;;){if(U.lookahead===0&&(ct(U),U.lookahead===0)){if(it===u)return v;break}if(U.match_length=0,mt=a._tr_tally(U,0,U.window[U.strstart]),U.lookahead--,U.strstart++,mt&&(B(U,!1),U.strm.avail_out===0))return v}return U.insert=0,it===f?(B(U,!0),U.strm.avail_out===0?et:H):U.last_lit&&(B(U,!1),U.strm.avail_out===0)?v:G}(N,Z):N.strategy===3?function(U,it){for(var mt,at,Mt,ee,Ut=U.window;;){if(U.lookahead<=I){if(ct(U),U.lookahead<=I&&it===u)return v;if(U.lookahead===0)break}if(U.match_length=0,U.lookahead>=P&&0<U.strstart&&(at=Ut[Mt=U.strstart-1])===Ut[++Mt]&&at===Ut[++Mt]&&at===Ut[++Mt]){ee=U.strstart+I;do;while(at===Ut[++Mt]&&at===Ut[++Mt]&&at===Ut[++Mt]&&at===Ut[++Mt]&&at===Ut[++Mt]&&at===Ut[++Mt]&&at===Ut[++Mt]&&at===Ut[++Mt]&&Mt<ee);U.match_length=I-(ee-Mt),U.match_length>U.lookahead&&(U.match_length=U.lookahead)}if(U.match_length>=P?(mt=a._tr_tally(U,1,U.match_length-P),U.lookahead-=U.match_length,U.strstart+=U.match_length,U.match_length=0):(mt=a._tr_tally(U,0,U.window[U.strstart]),U.lookahead--,U.strstart++),mt&&(B(U,!1),U.strm.avail_out===0))return v}return U.insert=0,it===f?(B(U,!0),U.strm.avail_out===0?et:H):U.last_lit&&(B(U,!1),U.strm.avail_out===0)?v:G}(N,Z):r[N.level].func(N,Z);if($!==et&&$!==H||(N.status=666),$===v||$===et)return _.avail_out===0&&(N.last_flush=-1),d;if($===G&&(Z===1?a._tr_align(N):Z!==5&&(a._tr_stored_block(N,0,0,!1),Z===3&&(lt(N.head),N.lookahead===0&&(N.strstart=0,N.block_start=0,N.insert=0))),A(_),_.avail_out===0))return N.last_flush=-1,d}return Z!==f?d:N.wrap<=0?1:(N.wrap===2?(ot(N,255&_.adler),ot(N,_.adler>>8&255),ot(N,_.adler>>16&255),ot(N,_.adler>>24&255),ot(N,255&_.total_in),ot(N,_.total_in>>8&255),ot(N,_.total_in>>16&255),ot(N,_.total_in>>24&255)):(rt(N,_.adler>>>16),rt(N,65535&_.adler)),A(_),0<N.wrap&&(N.wrap=-N.wrap),N.pending!==0?d:1)},s.deflateEnd=function(_){var Z;return _&&_.state?(Z=_.state.status)!==L&&Z!==69&&Z!==73&&Z!==91&&Z!==103&&Z!==k&&Z!==666?nt(_,p):(_.state=null,Z===k?nt(_,-3):d):p},s.deflateSetDictionary=function(_,Z){var Y,N,R,D,Q,$,U,it,mt=Z.length;if(!_||!_.state||(D=(Y=_.state).wrap)===2||D===1&&Y.status!==L||Y.lookahead)return p;for(D===1&&(_.adler=l(_.adler,Z,mt,0)),Y.wrap=0,mt>=Y.w_size&&(D===0&&(lt(Y.head),Y.strstart=0,Y.block_start=0,Y.insert=0),it=new o.Buf8(Y.w_size),o.arraySet(it,Z,mt-Y.w_size,Y.w_size,0),Z=it,mt=Y.w_size),Q=_.avail_in,$=_.next_in,U=_.input,_.avail_in=mt,_.next_in=0,_.input=Z,ct(Y);Y.lookahead>=P;){for(N=Y.strstart,R=Y.lookahead-(P-1);Y.ins_h=(Y.ins_h<<Y.hash_shift^Y.window[N+P-1])&Y.hash_mask,Y.prev[N&Y.w_mask]=Y.head[Y.ins_h],Y.head[Y.ins_h]=N,N++,--R;);Y.strstart=N,Y.lookahead=P-1,ct(Y)}return Y.strstart+=Y.lookahead,Y.block_start=Y.strstart,Y.insert=Y.lookahead,Y.lookahead=0,Y.match_length=Y.prev_length=P-1,Y.match_available=0,_.next_in=$,_.input=U,_.avail_in=Q,Y.wrap=D,d},s.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,i,s){i.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,i,s){i.exports=function(r,o){var a,l,h,c,u,f,d,p,g,m,S,b,y,x,w,T,E,C,P,I,F,L,k,v,G;a=r.state,l=r.next_in,v=r.input,h=l+(r.avail_in-5),c=r.next_out,G=r.output,u=c-(o-r.avail_out),f=c+(r.avail_out-257),d=a.dmax,p=a.wsize,g=a.whave,m=a.wnext,S=a.window,b=a.hold,y=a.bits,x=a.lencode,w=a.distcode,T=(1<<a.lenbits)-1,E=(1<<a.distbits)-1;t:do{y<15&&(b+=v[l++]<<y,y+=8,b+=v[l++]<<y,y+=8),C=x[b&T];e:for(;;){if(b>>>=P=C>>>24,y-=P,(P=C>>>16&255)===0)G[c++]=65535&C;else{if(!(16&P)){if((64&P)==0){C=x[(65535&C)+(b&(1<<P)-1)];continue e}if(32&P){a.mode=12;break t}r.msg="invalid literal/length code",a.mode=30;break t}I=65535&C,(P&=15)&&(y<P&&(b+=v[l++]<<y,y+=8),I+=b&(1<<P)-1,b>>>=P,y-=P),y<15&&(b+=v[l++]<<y,y+=8,b+=v[l++]<<y,y+=8),C=w[b&E];i:for(;;){if(b>>>=P=C>>>24,y-=P,!(16&(P=C>>>16&255))){if((64&P)==0){C=w[(65535&C)+(b&(1<<P)-1)];continue i}r.msg="invalid distance code",a.mode=30;break t}if(F=65535&C,y<(P&=15)&&(b+=v[l++]<<y,(y+=8)<P&&(b+=v[l++]<<y,y+=8)),d<(F+=b&(1<<P)-1)){r.msg="invalid distance too far back",a.mode=30;break t}if(b>>>=P,y-=P,(P=c-u)<F){if(g<(P=F-P)&&a.sane){r.msg="invalid distance too far back",a.mode=30;break t}if(k=S,(L=0)===m){if(L+=p-P,P<I){for(I-=P;G[c++]=S[L++],--P;);L=c-F,k=G}}else if(m<P){if(L+=p+m-P,(P-=m)<I){for(I-=P;G[c++]=S[L++],--P;);if(L=0,m<I){for(I-=P=m;G[c++]=S[L++],--P;);L=c-F,k=G}}}else if(L+=m-P,P<I){for(I-=P;G[c++]=S[L++],--P;);L=c-F,k=G}for(;2<I;)G[c++]=k[L++],G[c++]=k[L++],G[c++]=k[L++],I-=3;I&&(G[c++]=k[L++],1<I&&(G[c++]=k[L++]))}else{for(L=c-F;G[c++]=G[L++],G[c++]=G[L++],G[c++]=G[L++],2<(I-=3););I&&(G[c++]=G[L++],1<I&&(G[c++]=G[L++]))}break}}break}}while(l<h&&c<f);l-=I=y>>3,b&=(1<<(y-=I<<3))-1,r.next_in=l,r.next_out=c,r.avail_in=l<h?h-l+5:5-(l-h),r.avail_out=c<f?f-c+257:257-(c-f),a.hold=b,a.bits=y}},{}],49:[function(e,i,s){var r=e("../utils/common"),o=e("./adler32"),a=e("./crc32"),l=e("./inffast"),h=e("./inftrees"),c=1,u=2,f=0,d=-2,p=1,g=852,m=592;function S(L){return(L>>>24&255)+(L>>>8&65280)+((65280&L)<<8)+((255&L)<<24)}function b(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function y(L){var k;return L&&L.state?(k=L.state,L.total_in=L.total_out=k.total=0,L.msg="",k.wrap&&(L.adler=1&k.wrap),k.mode=p,k.last=0,k.havedict=0,k.dmax=32768,k.head=null,k.hold=0,k.bits=0,k.lencode=k.lendyn=new r.Buf32(g),k.distcode=k.distdyn=new r.Buf32(m),k.sane=1,k.back=-1,f):d}function x(L){var k;return L&&L.state?((k=L.state).wsize=0,k.whave=0,k.wnext=0,y(L)):d}function w(L,k){var v,G;return L&&L.state?(G=L.state,k<0?(v=0,k=-k):(v=1+(k>>4),k<48&&(k&=15)),k&&(k<8||15<k)?d:(G.window!==null&&G.wbits!==k&&(G.window=null),G.wrap=v,G.wbits=k,x(L))):d}function T(L,k){var v,G;return L?(G=new b,(L.state=G).window=null,(v=w(L,k))!==f&&(L.state=null),v):d}var E,C,P=!0;function I(L){if(P){var k;for(E=new r.Buf32(512),C=new r.Buf32(32),k=0;k<144;)L.lens[k++]=8;for(;k<256;)L.lens[k++]=9;for(;k<280;)L.lens[k++]=7;for(;k<288;)L.lens[k++]=8;for(h(c,L.lens,0,288,E,0,L.work,{bits:9}),k=0;k<32;)L.lens[k++]=5;h(u,L.lens,0,32,C,0,L.work,{bits:5}),P=!1}L.lencode=E,L.lenbits=9,L.distcode=C,L.distbits=5}function F(L,k,v,G){var et,H=L.state;return H.window===null&&(H.wsize=1<<H.wbits,H.wnext=0,H.whave=0,H.window=new r.Buf8(H.wsize)),G>=H.wsize?(r.arraySet(H.window,k,v-H.wsize,H.wsize,0),H.wnext=0,H.whave=H.wsize):(G<(et=H.wsize-H.wnext)&&(et=G),r.arraySet(H.window,k,v-G,et,H.wnext),(G-=et)?(r.arraySet(H.window,k,v-G,G,0),H.wnext=G,H.whave=H.wsize):(H.wnext+=et,H.wnext===H.wsize&&(H.wnext=0),H.whave<H.wsize&&(H.whave+=et))),0}s.inflateReset=x,s.inflateReset2=w,s.inflateResetKeep=y,s.inflateInit=function(L){return T(L,15)},s.inflateInit2=T,s.inflate=function(L,k){var v,G,et,H,nt,K,lt,A,B,ot,rt,J,ct,Nt,pt,dt,Ct,Ht,me,ce,_,Z,Y,N,R=0,D=new r.Buf8(4),Q=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!L||!L.state||!L.output||!L.input&&L.avail_in!==0)return d;(v=L.state).mode===12&&(v.mode=13),nt=L.next_out,et=L.output,lt=L.avail_out,H=L.next_in,G=L.input,K=L.avail_in,A=v.hold,B=v.bits,ot=K,rt=lt,Z=f;t:for(;;)switch(v.mode){case p:if(v.wrap===0){v.mode=13;break}for(;B<16;){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}if(2&v.wrap&&A===35615){D[v.check=0]=255&A,D[1]=A>>>8&255,v.check=a(v.check,D,2,0),B=A=0,v.mode=2;break}if(v.flags=0,v.head&&(v.head.done=!1),!(1&v.wrap)||(((255&A)<<8)+(A>>8))%31){L.msg="incorrect header check",v.mode=30;break}if((15&A)!=8){L.msg="unknown compression method",v.mode=30;break}if(B-=4,_=8+(15&(A>>>=4)),v.wbits===0)v.wbits=_;else if(_>v.wbits){L.msg="invalid window size",v.mode=30;break}v.dmax=1<<_,L.adler=v.check=1,v.mode=512&A?10:12,B=A=0;break;case 2:for(;B<16;){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}if(v.flags=A,(255&v.flags)!=8){L.msg="unknown compression method",v.mode=30;break}if(57344&v.flags){L.msg="unknown header flags set",v.mode=30;break}v.head&&(v.head.text=A>>8&1),512&v.flags&&(D[0]=255&A,D[1]=A>>>8&255,v.check=a(v.check,D,2,0)),B=A=0,v.mode=3;case 3:for(;B<32;){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}v.head&&(v.head.time=A),512&v.flags&&(D[0]=255&A,D[1]=A>>>8&255,D[2]=A>>>16&255,D[3]=A>>>24&255,v.check=a(v.check,D,4,0)),B=A=0,v.mode=4;case 4:for(;B<16;){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}v.head&&(v.head.xflags=255&A,v.head.os=A>>8),512&v.flags&&(D[0]=255&A,D[1]=A>>>8&255,v.check=a(v.check,D,2,0)),B=A=0,v.mode=5;case 5:if(1024&v.flags){for(;B<16;){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}v.length=A,v.head&&(v.head.extra_len=A),512&v.flags&&(D[0]=255&A,D[1]=A>>>8&255,v.check=a(v.check,D,2,0)),B=A=0}else v.head&&(v.head.extra=null);v.mode=6;case 6:if(1024&v.flags&&(K<(J=v.length)&&(J=K),J&&(v.head&&(_=v.head.extra_len-v.length,v.head.extra||(v.head.extra=new Array(v.head.extra_len)),r.arraySet(v.head.extra,G,H,J,_)),512&v.flags&&(v.check=a(v.check,G,J,H)),K-=J,H+=J,v.length-=J),v.length))break t;v.length=0,v.mode=7;case 7:if(2048&v.flags){if(K===0)break t;for(J=0;_=G[H+J++],v.head&&_&&v.length<65536&&(v.head.name+=String.fromCharCode(_)),_&&J<K;);if(512&v.flags&&(v.check=a(v.check,G,J,H)),K-=J,H+=J,_)break t}else v.head&&(v.head.name=null);v.length=0,v.mode=8;case 8:if(4096&v.flags){if(K===0)break t;for(J=0;_=G[H+J++],v.head&&_&&v.length<65536&&(v.head.comment+=String.fromCharCode(_)),_&&J<K;);if(512&v.flags&&(v.check=a(v.check,G,J,H)),K-=J,H+=J,_)break t}else v.head&&(v.head.comment=null);v.mode=9;case 9:if(512&v.flags){for(;B<16;){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}if(A!==(65535&v.check)){L.msg="header crc mismatch",v.mode=30;break}B=A=0}v.head&&(v.head.hcrc=v.flags>>9&1,v.head.done=!0),L.adler=v.check=0,v.mode=12;break;case 10:for(;B<32;){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}L.adler=v.check=S(A),B=A=0,v.mode=11;case 11:if(v.havedict===0)return L.next_out=nt,L.avail_out=lt,L.next_in=H,L.avail_in=K,v.hold=A,v.bits=B,2;L.adler=v.check=1,v.mode=12;case 12:if(k===5||k===6)break t;case 13:if(v.last){A>>>=7&B,B-=7&B,v.mode=27;break}for(;B<3;){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}switch(v.last=1&A,B-=1,3&(A>>>=1)){case 0:v.mode=14;break;case 1:if(I(v),v.mode=20,k!==6)break;A>>>=2,B-=2;break t;case 2:v.mode=17;break;case 3:L.msg="invalid block type",v.mode=30}A>>>=2,B-=2;break;case 14:for(A>>>=7&B,B-=7&B;B<32;){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}if((65535&A)!=(A>>>16^65535)){L.msg="invalid stored block lengths",v.mode=30;break}if(v.length=65535&A,B=A=0,v.mode=15,k===6)break t;case 15:v.mode=16;case 16:if(J=v.length){if(K<J&&(J=K),lt<J&&(J=lt),J===0)break t;r.arraySet(et,G,H,J,nt),K-=J,H+=J,lt-=J,nt+=J,v.length-=J;break}v.mode=12;break;case 17:for(;B<14;){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}if(v.nlen=257+(31&A),A>>>=5,B-=5,v.ndist=1+(31&A),A>>>=5,B-=5,v.ncode=4+(15&A),A>>>=4,B-=4,286<v.nlen||30<v.ndist){L.msg="too many length or distance symbols",v.mode=30;break}v.have=0,v.mode=18;case 18:for(;v.have<v.ncode;){for(;B<3;){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}v.lens[Q[v.have++]]=7&A,A>>>=3,B-=3}for(;v.have<19;)v.lens[Q[v.have++]]=0;if(v.lencode=v.lendyn,v.lenbits=7,Y={bits:v.lenbits},Z=h(0,v.lens,0,19,v.lencode,0,v.work,Y),v.lenbits=Y.bits,Z){L.msg="invalid code lengths set",v.mode=30;break}v.have=0,v.mode=19;case 19:for(;v.have<v.nlen+v.ndist;){for(;dt=(R=v.lencode[A&(1<<v.lenbits)-1])>>>16&255,Ct=65535&R,!((pt=R>>>24)<=B);){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}if(Ct<16)A>>>=pt,B-=pt,v.lens[v.have++]=Ct;else{if(Ct===16){for(N=pt+2;B<N;){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}if(A>>>=pt,B-=pt,v.have===0){L.msg="invalid bit length repeat",v.mode=30;break}_=v.lens[v.have-1],J=3+(3&A),A>>>=2,B-=2}else if(Ct===17){for(N=pt+3;B<N;){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}B-=pt,_=0,J=3+(7&(A>>>=pt)),A>>>=3,B-=3}else{for(N=pt+7;B<N;){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}B-=pt,_=0,J=11+(127&(A>>>=pt)),A>>>=7,B-=7}if(v.have+J>v.nlen+v.ndist){L.msg="invalid bit length repeat",v.mode=30;break}for(;J--;)v.lens[v.have++]=_}}if(v.mode===30)break;if(v.lens[256]===0){L.msg="invalid code -- missing end-of-block",v.mode=30;break}if(v.lenbits=9,Y={bits:v.lenbits},Z=h(c,v.lens,0,v.nlen,v.lencode,0,v.work,Y),v.lenbits=Y.bits,Z){L.msg="invalid literal/lengths set",v.mode=30;break}if(v.distbits=6,v.distcode=v.distdyn,Y={bits:v.distbits},Z=h(u,v.lens,v.nlen,v.ndist,v.distcode,0,v.work,Y),v.distbits=Y.bits,Z){L.msg="invalid distances set",v.mode=30;break}if(v.mode=20,k===6)break t;case 20:v.mode=21;case 21:if(6<=K&&258<=lt){L.next_out=nt,L.avail_out=lt,L.next_in=H,L.avail_in=K,v.hold=A,v.bits=B,l(L,rt),nt=L.next_out,et=L.output,lt=L.avail_out,H=L.next_in,G=L.input,K=L.avail_in,A=v.hold,B=v.bits,v.mode===12&&(v.back=-1);break}for(v.back=0;dt=(R=v.lencode[A&(1<<v.lenbits)-1])>>>16&255,Ct=65535&R,!((pt=R>>>24)<=B);){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}if(dt&&(240&dt)==0){for(Ht=pt,me=dt,ce=Ct;dt=(R=v.lencode[ce+((A&(1<<Ht+me)-1)>>Ht)])>>>16&255,Ct=65535&R,!(Ht+(pt=R>>>24)<=B);){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}A>>>=Ht,B-=Ht,v.back+=Ht}if(A>>>=pt,B-=pt,v.back+=pt,v.length=Ct,dt===0){v.mode=26;break}if(32&dt){v.back=-1,v.mode=12;break}if(64&dt){L.msg="invalid literal/length code",v.mode=30;break}v.extra=15&dt,v.mode=22;case 22:if(v.extra){for(N=v.extra;B<N;){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}v.length+=A&(1<<v.extra)-1,A>>>=v.extra,B-=v.extra,v.back+=v.extra}v.was=v.length,v.mode=23;case 23:for(;dt=(R=v.distcode[A&(1<<v.distbits)-1])>>>16&255,Ct=65535&R,!((pt=R>>>24)<=B);){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}if((240&dt)==0){for(Ht=pt,me=dt,ce=Ct;dt=(R=v.distcode[ce+((A&(1<<Ht+me)-1)>>Ht)])>>>16&255,Ct=65535&R,!(Ht+(pt=R>>>24)<=B);){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}A>>>=Ht,B-=Ht,v.back+=Ht}if(A>>>=pt,B-=pt,v.back+=pt,64&dt){L.msg="invalid distance code",v.mode=30;break}v.offset=Ct,v.extra=15&dt,v.mode=24;case 24:if(v.extra){for(N=v.extra;B<N;){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}v.offset+=A&(1<<v.extra)-1,A>>>=v.extra,B-=v.extra,v.back+=v.extra}if(v.offset>v.dmax){L.msg="invalid distance too far back",v.mode=30;break}v.mode=25;case 25:if(lt===0)break t;if(J=rt-lt,v.offset>J){if((J=v.offset-J)>v.whave&&v.sane){L.msg="invalid distance too far back",v.mode=30;break}ct=J>v.wnext?(J-=v.wnext,v.wsize-J):v.wnext-J,J>v.length&&(J=v.length),Nt=v.window}else Nt=et,ct=nt-v.offset,J=v.length;for(lt<J&&(J=lt),lt-=J,v.length-=J;et[nt++]=Nt[ct++],--J;);v.length===0&&(v.mode=21);break;case 26:if(lt===0)break t;et[nt++]=v.length,lt--,v.mode=21;break;case 27:if(v.wrap){for(;B<32;){if(K===0)break t;K--,A|=G[H++]<<B,B+=8}if(rt-=lt,L.total_out+=rt,v.total+=rt,rt&&(L.adler=v.check=v.flags?a(v.check,et,rt,nt-rt):o(v.check,et,rt,nt-rt)),rt=lt,(v.flags?A:S(A))!==v.check){L.msg="incorrect data check",v.mode=30;break}B=A=0}v.mode=28;case 28:if(v.wrap&&v.flags){for(;B<32;){if(K===0)break t;K--,A+=G[H++]<<B,B+=8}if(A!==(4294967295&v.total)){L.msg="incorrect length check",v.mode=30;break}B=A=0}v.mode=29;case 29:Z=1;break t;case 30:Z=-3;break t;case 31:return-4;case 32:default:return d}return L.next_out=nt,L.avail_out=lt,L.next_in=H,L.avail_in=K,v.hold=A,v.bits=B,(v.wsize||rt!==L.avail_out&&v.mode<30&&(v.mode<27||k!==4))&&F(L,L.output,L.next_out,rt-L.avail_out)?(v.mode=31,-4):(ot-=L.avail_in,rt-=L.avail_out,L.total_in+=ot,L.total_out+=rt,v.total+=rt,v.wrap&&rt&&(L.adler=v.check=v.flags?a(v.check,et,rt,L.next_out-rt):o(v.check,et,rt,L.next_out-rt)),L.data_type=v.bits+(v.last?64:0)+(v.mode===12?128:0)+(v.mode===20||v.mode===15?256:0),(ot==0&&rt===0||k===4)&&Z===f&&(Z=-5),Z)},s.inflateEnd=function(L){if(!L||!L.state)return d;var k=L.state;return k.window&&(k.window=null),L.state=null,f},s.inflateGetHeader=function(L,k){var v;return L&&L.state?(2&(v=L.state).wrap)==0?d:((v.head=k).done=!1,f):d},s.inflateSetDictionary=function(L,k){var v,G=k.length;return L&&L.state?(v=L.state).wrap!==0&&v.mode!==11?d:v.mode===11&&o(1,k,G,0)!==v.check?-3:F(L,k,G,G)?(v.mode=31,-4):(v.havedict=1,f):d},s.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,i,s){var r=e("../utils/common"),o=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],h=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];i.exports=function(c,u,f,d,p,g,m,S){var b,y,x,w,T,E,C,P,I,F=S.bits,L=0,k=0,v=0,G=0,et=0,H=0,nt=0,K=0,lt=0,A=0,B=null,ot=0,rt=new r.Buf16(16),J=new r.Buf16(16),ct=null,Nt=0;for(L=0;L<=15;L++)rt[L]=0;for(k=0;k<d;k++)rt[u[f+k]]++;for(et=F,G=15;1<=G&&rt[G]===0;G--);if(G<et&&(et=G),G===0)return p[g++]=20971520,p[g++]=20971520,S.bits=1,0;for(v=1;v<G&&rt[v]===0;v++);for(et<v&&(et=v),L=K=1;L<=15;L++)if(K<<=1,(K-=rt[L])<0)return-1;if(0<K&&(c===0||G!==1))return-1;for(J[1]=0,L=1;L<15;L++)J[L+1]=J[L]+rt[L];for(k=0;k<d;k++)u[f+k]!==0&&(m[J[u[f+k]]++]=k);if(E=c===0?(B=ct=m,19):c===1?(B=o,ot-=257,ct=a,Nt-=257,256):(B=l,ct=h,-1),L=v,T=g,nt=k=A=0,x=-1,w=(lt=1<<(H=et))-1,c===1&&852<lt||c===2&&592<lt)return 1;for(;;){for(C=L-nt,I=m[k]<E?(P=0,m[k]):m[k]>E?(P=ct[Nt+m[k]],B[ot+m[k]]):(P=96,0),b=1<<L-nt,v=y=1<<H;p[T+(A>>nt)+(y-=b)]=C<<24|P<<16|I|0,y!==0;);for(b=1<<L-1;A&b;)b>>=1;if(b!==0?(A&=b-1,A+=b):A=0,k++,--rt[L]==0){if(L===G)break;L=u[f+m[k]]}if(et<L&&(A&w)!==x){for(nt===0&&(nt=et),T+=v,K=1<<(H=L-nt);H+nt<G&&!((K-=rt[H+nt])<=0);)H++,K<<=1;if(lt+=1<<H,c===1&&852<lt||c===2&&592<lt)return 1;p[x=A&w]=et<<24|H<<16|T-g|0}}return A!==0&&(p[T+A]=L-nt<<24|64<<16|0),S.bits=et,0}},{"../utils/common":41}],51:[function(e,i,s){i.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,i,s){var r=e("../utils/common"),o=0,a=1;function l(R){for(var D=R.length;0<=--D;)R[D]=0}var h=0,c=29,u=256,f=u+1+c,d=30,p=19,g=2*f+1,m=15,S=16,b=7,y=256,x=16,w=17,T=18,E=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],C=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],P=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],I=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],F=new Array(2*(f+2));l(F);var L=new Array(2*d);l(L);var k=new Array(512);l(k);var v=new Array(256);l(v);var G=new Array(c);l(G);var et,H,nt,K=new Array(d);function lt(R,D,Q,$,U){this.static_tree=R,this.extra_bits=D,this.extra_base=Q,this.elems=$,this.max_length=U,this.has_stree=R&&R.length}function A(R,D){this.dyn_tree=R,this.max_code=0,this.stat_desc=D}function B(R){return R<256?k[R]:k[256+(R>>>7)]}function ot(R,D){R.pending_buf[R.pending++]=255&D,R.pending_buf[R.pending++]=D>>>8&255}function rt(R,D,Q){R.bi_valid>S-Q?(R.bi_buf|=D<<R.bi_valid&65535,ot(R,R.bi_buf),R.bi_buf=D>>S-R.bi_valid,R.bi_valid+=Q-S):(R.bi_buf|=D<<R.bi_valid&65535,R.bi_valid+=Q)}function J(R,D,Q){rt(R,Q[2*D],Q[2*D+1])}function ct(R,D){for(var Q=0;Q|=1&R,R>>>=1,Q<<=1,0<--D;);return Q>>>1}function Nt(R,D,Q){var $,U,it=new Array(m+1),mt=0;for($=1;$<=m;$++)it[$]=mt=mt+Q[$-1]<<1;for(U=0;U<=D;U++){var at=R[2*U+1];at!==0&&(R[2*U]=ct(it[at]++,at))}}function pt(R){var D;for(D=0;D<f;D++)R.dyn_ltree[2*D]=0;for(D=0;D<d;D++)R.dyn_dtree[2*D]=0;for(D=0;D<p;D++)R.bl_tree[2*D]=0;R.dyn_ltree[2*y]=1,R.opt_len=R.static_len=0,R.last_lit=R.matches=0}function dt(R){8<R.bi_valid?ot(R,R.bi_buf):0<R.bi_valid&&(R.pending_buf[R.pending++]=R.bi_buf),R.bi_buf=0,R.bi_valid=0}function Ct(R,D,Q,$){var U=2*D,it=2*Q;return R[U]<R[it]||R[U]===R[it]&&$[D]<=$[Q]}function Ht(R,D,Q){for(var $=R.heap[Q],U=Q<<1;U<=R.heap_len&&(U<R.heap_len&&Ct(D,R.heap[U+1],R.heap[U],R.depth)&&U++,!Ct(D,$,R.heap[U],R.depth));)R.heap[Q]=R.heap[U],Q=U,U<<=1;R.heap[Q]=$}function me(R,D,Q){var $,U,it,mt,at=0;if(R.last_lit!==0)for(;$=R.pending_buf[R.d_buf+2*at]<<8|R.pending_buf[R.d_buf+2*at+1],U=R.pending_buf[R.l_buf+at],at++,$===0?J(R,U,D):(J(R,(it=v[U])+u+1,D),(mt=E[it])!==0&&rt(R,U-=G[it],mt),J(R,it=B(--$),Q),(mt=C[it])!==0&&rt(R,$-=K[it],mt)),at<R.last_lit;);J(R,y,D)}function ce(R,D){var Q,$,U,it=D.dyn_tree,mt=D.stat_desc.static_tree,at=D.stat_desc.has_stree,Mt=D.stat_desc.elems,ee=-1;for(R.heap_len=0,R.heap_max=g,Q=0;Q<Mt;Q++)it[2*Q]!==0?(R.heap[++R.heap_len]=ee=Q,R.depth[Q]=0):it[2*Q+1]=0;for(;R.heap_len<2;)it[2*(U=R.heap[++R.heap_len]=ee<2?++ee:0)]=1,R.depth[U]=0,R.opt_len--,at&&(R.static_len-=mt[2*U+1]);for(D.max_code=ee,Q=R.heap_len>>1;1<=Q;Q--)Ht(R,it,Q);for(U=Mt;Q=R.heap[1],R.heap[1]=R.heap[R.heap_len--],Ht(R,it,1),$=R.heap[1],R.heap[--R.heap_max]=Q,R.heap[--R.heap_max]=$,it[2*U]=it[2*Q]+it[2*$],R.depth[U]=(R.depth[Q]>=R.depth[$]?R.depth[Q]:R.depth[$])+1,it[2*Q+1]=it[2*$+1]=U,R.heap[1]=U++,Ht(R,it,1),2<=R.heap_len;);R.heap[--R.heap_max]=R.heap[1],function(Ut,qe){var Ts,ui,Cs,ge,cn,rr,yi=qe.dyn_tree,Io=qe.max_code,Cl=qe.stat_desc.static_tree,Rl=qe.stat_desc.has_stree,Nl=qe.stat_desc.extra_bits,ko=qe.stat_desc.extra_base,Rs=qe.stat_desc.max_length,un=0;for(ge=0;ge<=m;ge++)Ut.bl_count[ge]=0;for(yi[2*Ut.heap[Ut.heap_max]+1]=0,Ts=Ut.heap_max+1;Ts<g;Ts++)Rs<(ge=yi[2*yi[2*(ui=Ut.heap[Ts])+1]+1]+1)&&(ge=Rs,un++),yi[2*ui+1]=ge,Io<ui||(Ut.bl_count[ge]++,cn=0,ko<=ui&&(cn=Nl[ui-ko]),rr=yi[2*ui],Ut.opt_len+=rr*(ge+cn),Rl&&(Ut.static_len+=rr*(Cl[2*ui+1]+cn)));if(un!==0){do{for(ge=Rs-1;Ut.bl_count[ge]===0;)ge--;Ut.bl_count[ge]--,Ut.bl_count[ge+1]+=2,Ut.bl_count[Rs]--,un-=2}while(0<un);for(ge=Rs;ge!==0;ge--)for(ui=Ut.bl_count[ge];ui!==0;)Io<(Cs=Ut.heap[--Ts])||(yi[2*Cs+1]!==ge&&(Ut.opt_len+=(ge-yi[2*Cs+1])*yi[2*Cs],yi[2*Cs+1]=ge),ui--)}}(R,D),Nt(it,ee,R.bl_count)}function _(R,D,Q){var $,U,it=-1,mt=D[1],at=0,Mt=7,ee=4;for(mt===0&&(Mt=138,ee=3),D[2*(Q+1)+1]=65535,$=0;$<=Q;$++)U=mt,mt=D[2*($+1)+1],++at<Mt&&U===mt||(at<ee?R.bl_tree[2*U]+=at:U!==0?(U!==it&&R.bl_tree[2*U]++,R.bl_tree[2*x]++):at<=10?R.bl_tree[2*w]++:R.bl_tree[2*T]++,it=U,ee=(at=0)===mt?(Mt=138,3):U===mt?(Mt=6,3):(Mt=7,4))}function Z(R,D,Q){var $,U,it=-1,mt=D[1],at=0,Mt=7,ee=4;for(mt===0&&(Mt=138,ee=3),$=0;$<=Q;$++)if(U=mt,mt=D[2*($+1)+1],!(++at<Mt&&U===mt)){if(at<ee)for(;J(R,U,R.bl_tree),--at!=0;);else U!==0?(U!==it&&(J(R,U,R.bl_tree),at--),J(R,x,R.bl_tree),rt(R,at-3,2)):at<=10?(J(R,w,R.bl_tree),rt(R,at-3,3)):(J(R,T,R.bl_tree),rt(R,at-11,7));it=U,ee=(at=0)===mt?(Mt=138,3):U===mt?(Mt=6,3):(Mt=7,4)}}l(K);var Y=!1;function N(R,D,Q,$){rt(R,(h<<1)+($?1:0),3),function(U,it,mt,at){dt(U),at&&(ot(U,mt),ot(U,~mt)),r.arraySet(U.pending_buf,U.window,it,mt,U.pending),U.pending+=mt}(R,D,Q,!0)}s._tr_init=function(R){Y||(function(){var D,Q,$,U,it,mt=new Array(m+1);for(U=$=0;U<c-1;U++)for(G[U]=$,D=0;D<1<<E[U];D++)v[$++]=U;for(v[$-1]=U,U=it=0;U<16;U++)for(K[U]=it,D=0;D<1<<C[U];D++)k[it++]=U;for(it>>=7;U<d;U++)for(K[U]=it<<7,D=0;D<1<<C[U]-7;D++)k[256+it++]=U;for(Q=0;Q<=m;Q++)mt[Q]=0;for(D=0;D<=143;)F[2*D+1]=8,D++,mt[8]++;for(;D<=255;)F[2*D+1]=9,D++,mt[9]++;for(;D<=279;)F[2*D+1]=7,D++,mt[7]++;for(;D<=287;)F[2*D+1]=8,D++,mt[8]++;for(Nt(F,f+1,mt),D=0;D<d;D++)L[2*D+1]=5,L[2*D]=ct(D,5);et=new lt(F,E,u+1,f,m),H=new lt(L,C,0,d,m),nt=new lt(new Array(0),P,0,p,b)}(),Y=!0),R.l_desc=new A(R.dyn_ltree,et),R.d_desc=new A(R.dyn_dtree,H),R.bl_desc=new A(R.bl_tree,nt),R.bi_buf=0,R.bi_valid=0,pt(R)},s._tr_stored_block=N,s._tr_flush_block=function(R,D,Q,$){var U,it,mt=0;0<R.level?(R.strm.data_type===2&&(R.strm.data_type=function(at){var Mt,ee=4093624447;for(Mt=0;Mt<=31;Mt++,ee>>>=1)if(1&ee&&at.dyn_ltree[2*Mt]!==0)return o;if(at.dyn_ltree[18]!==0||at.dyn_ltree[20]!==0||at.dyn_ltree[26]!==0)return a;for(Mt=32;Mt<u;Mt++)if(at.dyn_ltree[2*Mt]!==0)return a;return o}(R)),ce(R,R.l_desc),ce(R,R.d_desc),mt=function(at){var Mt;for(_(at,at.dyn_ltree,at.l_desc.max_code),_(at,at.dyn_dtree,at.d_desc.max_code),ce(at,at.bl_desc),Mt=p-1;3<=Mt&&at.bl_tree[2*I[Mt]+1]===0;Mt--);return at.opt_len+=3*(Mt+1)+5+5+4,Mt}(R),U=R.opt_len+3+7>>>3,(it=R.static_len+3+7>>>3)<=U&&(U=it)):U=it=Q+5,Q+4<=U&&D!==-1?N(R,D,Q,$):R.strategy===4||it===U?(rt(R,2+($?1:0),3),me(R,F,L)):(rt(R,4+($?1:0),3),function(at,Mt,ee,Ut){var qe;for(rt(at,Mt-257,5),rt(at,ee-1,5),rt(at,Ut-4,4),qe=0;qe<Ut;qe++)rt(at,at.bl_tree[2*I[qe]+1],3);Z(at,at.dyn_ltree,Mt-1),Z(at,at.dyn_dtree,ee-1)}(R,R.l_desc.max_code+1,R.d_desc.max_code+1,mt+1),me(R,R.dyn_ltree,R.dyn_dtree)),pt(R),$&&dt(R)},s._tr_tally=function(R,D,Q){return R.pending_buf[R.d_buf+2*R.last_lit]=D>>>8&255,R.pending_buf[R.d_buf+2*R.last_lit+1]=255&D,R.pending_buf[R.l_buf+R.last_lit]=255&Q,R.last_lit++,D===0?R.dyn_ltree[2*Q]++:(R.matches++,D--,R.dyn_ltree[2*(v[Q]+u+1)]++,R.dyn_dtree[2*B(D)]++),R.last_lit===R.lit_bufsize-1},s._tr_align=function(R){rt(R,2,3),J(R,y,F),function(D){D.bi_valid===16?(ot(D,D.bi_buf),D.bi_buf=0,D.bi_valid=0):8<=D.bi_valid&&(D.pending_buf[D.pending++]=255&D.bi_buf,D.bi_buf>>=8,D.bi_valid-=8)}(R)}},{"../utils/common":41}],53:[function(e,i,s){i.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,i,s){i.exports=typeof setImmediate=="function"?setImmediate:function(){var r=[].slice.apply(arguments);r.splice(1,0,0),setTimeout.apply(null,r)}},{}]},{},[10])(10)})})(ll);var fa=ll.exports;class sf{static MXLtoIXmlElement(t){const e=new fa;return e.loadAsync(t).then(r=>e.file("META-INF/container.xml").async("text"),r=>{throw r}).then(r=>{const l=new DOMParser().parseFromString(r,"text/xml").getElementsByTagName("rootfile")[0].getAttribute("full-path");return e.file(l).async("text")},r=>{throw r}).then(r=>{const a=new DOMParser().parseFromString(r,"text/xml"),l=new Ks(a.documentElement);return Promise.resolve(l)},r=>{throw r}).then(r=>r,r=>{throw new Error("extractSheetFromMxl: "+r.message)})}static MXLtoXMLstring(t){const e=new fa;return e.loadAsync(t).then(i=>e.file("META-INF/container.xml").async("text"),i=>{throw j.error(i),i}).then(i=>{const o=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("rootfile")[0].getAttribute("full-path");return e.file(o).async("text")},i=>{throw i})}}class Mo{calculate(t){const e=new Ss(t);for(;!e.EndReached;){const i=e.CurrentEnrolledTimestamp,s=e.CurrentAudibleVoiceEntries();for(const r of s)this.handleVoiceEntry(t,r,i);e.moveToNext()}}handleVoiceEntry(t,e,i){if(e.IsGrace)return;const s=e.ParentVoice;let r;t.PlaybackDataDict.containsKey(s)?r=t.PlaybackDataDict.getValue(s):(r=[],t.PlaybackDataDict.setValue(s,r));for(const o of e.PlaybackEntries)if(o.HasNotes){for(const l of o.Notes)l.setLength();const a=W.plus(i,o.TimestampShift);Mo.addEntrySorted(r,o,a)}}static addEntrySorted(t,e,i){if(t.length===0)t.push({enrolledTimestamp:i,playbackEntry:e});else for(let s=t.length-1;s>=0;s--){const r=t[s];if(i.RealValue>r.enrolledTimestamp.RealValue)if(s===t.length-1){t.push({enrolledTimestamp:i,playbackEntry:e});break}else{t.splice(s+1,0,{enrolledTimestamp:i,playbackEntry:e});break}}}}class Fn{constructor(t,e,i,s){this.psi=new le(void 0),this.displaySizeInPixel=t,this.RelativeDisplaySize=e,this.RelativeDisplayPosition=i,this.WidthInUnits=s}static createWithRelativeDefaults(t,e){return new Fn(t,new $e(1,1),new O(0,0),e)}static createWithDefaults(){return new Fn(new $e(1,1),new $e(1,1),new O(0,0),1)}get UpperLeftPositionInUnits(){return this.psi.AbsolutePosition}set UpperLeftPositionInUnits(t){this.psi.AbsolutePosition=t}get DisplaySizeInPixel(){return this.displaySizeInPixel}set DisplaySizeInPixel(t){this.displaySizeInPixel=t,this.regionSizeInPixel=new $e(this.displaySizeInPixel.width*this.relativeRegionSize.width,this.displaySizeInPixel.height*this.relativeRegionSize.height),this.recalculateDependentVariables()}get RelativeDisplaySize(){return this.relativeRegionSize}set RelativeDisplaySize(t){this.relativeRegionSize=t,this.regionSizeInPixel=new $e(this.displaySizeInPixel.width*this.relativeRegionSize.width,this.displaySizeInPixel.height*this.relativeRegionSize.height),this.recalculateDependentVariables()}get RegionSizeInPixel(){return this.regionSizeInPixel}get WidthInUnits(){return this.psi.BorderRight}set WidthInUnits(t){this.psi.BorderRight=t,this.recalculateDependentVariables()}get ViewRegionInUnits(){return new $e(this.psi.BorderRight,this.psi.BorderBottom)}isVisible(t,e){const i=this.psi.collisionDetection(t);return this.psi.liesInsideBorders(t),i}isInsideDisplayArea(t,e){return this.RelativeDisplayPosition.x<=t&&t<=this.RelativeDisplayPosition.x+this.RelativeDisplaySize.width&&this.RelativeDisplayPosition.y<=e&&e<=this.RelativeDisplayPosition.y+this.RelativeDisplaySize.height}transformToUnitCoordinates(t){return new O(this.UpperLeftPositionInUnits.x+this.ViewRegionInUnits.width*((t.x-this.RelativeDisplayPosition.x)/this.RelativeDisplaySize.width),this.UpperLeftPositionInUnits.y+this.ViewRegionInUnits.height*((t.y-this.RelativeDisplayPosition.y)/this.RelativeDisplaySize.height))}transformLengthXToUnitCoordinates(t){return t/this.horizontalUnitToPixelRatio}transformLengthYToUnitCoordinates(t){return t/this.verticalUnitToPixelRatio}recalculateDependentVariables(){const t=this.regionSizeInPixel.width/this.regionSizeInPixel.height;this.psi.BorderBottom=this.psi.BorderRight/t,this.horizontalUnitToPixelRatio=this.regionSizeInPixel.width/this.ViewRegionInUnits.width,this.verticalUnitToPixelRatio=this.regionSizeInPixel.height/this.ViewRegionInUnits.height}}class nf{constructor(t){this.aspectRatio=1,this.zoomViews=[],this.mouseZoomMode=!1,this.autoScrollY=!0,this.displayInteractionManager=t,this.displayInteractionManager.addListener(this),this.offsetXMin=Number.MIN_VALUE,this.offsetYMin=Number.MIN_VALUE,this.rangeXMin=1,this.rangeYMin=1,this.offsetXMax=Number.MAX_VALUE,this.offsetYMax=Number.MAX_VALUE,this.rangeXMax=1e9,this.rangeYMax=1e9,this.XScrollingEnabled=!1,this.YScrollingEnabled=!0}positionTouched(t,e){if(!this.convertToUnitsReady())return;const i=this.getPositionInUnits(t,e);this.unitPosTouched(i,t,e)}get TouchActive(){return this.displayInteractionManager.TouchActive}get TouchMoving(){return this.displayInteractionManager.TouchMoving}positionDoubleTouched(t,e){if(!this.convertToUnitsReady())return;const i=this.getPositionInUnits(t,e);this.unitPosDoubleTouched(i,t,e)}get UsesManuallyControlledZoomMode(){return this.usesManuallyControlledZoomMode}set UsesManuallyControlledZoomMode(t){this.usesManuallyControlledZoomMode=t}mouseDown(t,e,i=!1){if(!this.convertToUnitsReady())return;this.selectScrollControllerY(!1),this.lastRangeX=Math.max(1,this.RangeX),this.lastRangeY=Math.max(1,this.RangeY),this.lastOffsetX=this.OffsetX,this.lastOffsetY=this.OffsetY;const s=this.getPositionInUnits(t,e);this.unitPosTouchDown(s,t,e),this.usesManuallyControlledZoomMode||(i?this.mouseZoomMode=!0:this.mouseZoomMode=!1)}mouseUp(t,e){const i=this.getPositionInUnits(t,e);this.unitPosTouchUp(i,t,e)}mouseMove(t,e,i,s){this.mouseZoomMode?(Math.abs(i-0)>1e-8&&(this.RangeX=Math.abs(this.lastRangeX/(1+i))),!this.lockRanges&&Math.abs(s-0)>1e-8&&(this.RangeY=Math.abs(this.lastRangeY/(1-s)))):(Math.abs(i-0)>1e-8&&(this.OffsetX=this.lastOffsetX-i*this.RangeX),Math.abs(s-0)>1e-8&&(this.OffsetY=this.lastOffsetY-s*this.RangeY));const r=this.getPositionInUnits(t,e);this.unitPosMove(r,t,e)}zoom(t){this.RangeX=Math.abs(this.lastRangeX/t)}addZoomView(t){this.zoomViews.push(t)}get OffsetX(){return this.offsetX}set OffsetX(t){this.offsetX=Math.min(this.offsetXMax,Math.max(this.offsetXMin,t));for(const e of this.zoomViews)e.viewportXChanged(this.offsetX,this.RangeX)}get OffsetY(){return this.offsetY}set OffsetY(t){this.offsetY=t,this.offsetY>this.offsetYMax?this.offsetY=this.offsetYMax:this.offsetY<this.offsetYMin&&(this.offsetY=this.offsetYMin);for(const e of this.zoomViews)e.viewportYChanged(this.offsetY,this.RangeY)}get RangeX(){return this.rangeX}set RangeX(t){if(this.rangeX=Math.min(this.rangeXMax,Math.max(this.rangeXMin,t)),this.lockRanges){this.RangeY=this.RangeX/this.aspectRatio;for(const e of this.zoomViews)e.viewportXChanged(this.OffsetX,this.RangeX),e.viewportYChanged(this.OffsetY,this.RangeY)}else for(const e of this.zoomViews)e.viewportXChanged(this.OffsetX,this.RangeX)}get RangeY(){return this.rangeY}set RangeY(t){this.rangeY=Math.min(this.rangeYMax,Math.max(this.rangeYMin,t));for(const e of this.zoomViews)e.viewportYChanged(this.OffsetY,this.RangeY)}set AspectRatio(t){this.aspectRatio=t}initialize(t,e,i,s){this.setVerticalViewport(i,s),this.setHorizontalViewport(t,e)}setHorizontalViewport(t,e){this.RangeX=e,this.OffsetX=t,this.lastRangeX=this.RangeX,this.lastOffsetX=this.OffsetX}setVerticalViewport(t,e){this.RangeY=e,this.OffsetY=t,this.lastRangeY=this.RangeY,this.lastOffsetY=this.OffsetY}viewSizeChanged(t,e){this.lockRanges&&(this.aspectRatio=t/e,this.RangeY=this.RangeX/this.aspectRatio,this.lastRangeY=this.RangeY)}outputChanged(t,e,i){this.OffsetY=e}setOffsetXValueOnly(t){this.offsetX=Math.min(this.offsetXMax,Math.max(this.offsetXMin,t))}setXOffset(t,e){this.displayInteractionManager.TouchActive||this.XScrollingEnabled}setOffsetYValueOnly(t){this.offsetY=Math.min(this.offsetYMax,Math.max(this.offsetYMin,t))}setYOffset(t,e){this.displayInteractionManager.TouchActive||!this.YScrollingEnabled||e&&this.selectScrollControllerY(!0)}selectScrollControllerY(t){this.autoScrollY!==t&&(this.autoScrollY=t)}displaySizeChanged(t,e){throw new Error("Method not implemented.")}}var Ve=(n=>(n[n.SingleTouch=0]="SingleTouch",n[n.DoubleTouch=1]="DoubleTouch",n[n.TouchUp=2]="TouchUp",n[n.TouchDown=3]="TouchDown",n[n.Move=4]="Move",n))(Ve||{});class rf{constructor(t){this.renderingManager=t}userDisplayInteraction(t,e,i){var s,r;switch(i){case Ve.TouchDown:case Ve.SingleTouch:case Ve.DoubleTouch:{const o=this.renderingManager.GraphicalMusicSheet.GetNearestVoiceEntry(e);o&&o.parentStaffEntry.parentVerticalContainer!==void 0&&((s=o.notes[0])==null?void 0:s.sourceNote.Pitch)!==void 0&&((r=this.renderingManager.PlaybackManager)==null||r.playVoiceEntry(o.parentVoiceEntry));break}}}}class of extends nf{constructor(t,e){super(t),this.mainViewingRegion=Fn.createWithDefaults(),this.tryAgainToRenderCount=0,this.yOffsetMouseDown=Number.MIN_VALUE,this.unlockCursorDistancePixel=50,this.relativeTopPosition=.06,this.internalPreviewImageScale=3,this.listeners=[],this.LockDisplayToCursor=!0,this.ZoomActive=!1,this.rules=e,this.addZoomView(this),this.lockRanges=!0,this.TopBarHeightInPixel=70,this.BottomBarHeightInPixel=0,this.rules.UseDefaultVoiceInteractionListener&&this.listeners.push(new rf(this))}addListener(t){this.listeners.push(t)}get Listeners(){return this.listeners}convertToUnitsReady(){return this.graphicalMusicSheet!==void 0}unitPosTouched(t,e,i){if(!this.SingleTouchDisabled){const s=new O(e,i);this.handleUserDisplayInteraction(s,t,Ve.SingleTouch)}}unitPosDoubleTouched(t,e,i){if(!this.DoubleTouchDisabled){const s=new O(e,i);this.handleUserDisplayInteraction(s,t,Ve.DoubleTouch)}}unitPosTouchDown(t,e,i){const s=new O(e,i);this.handleUserDisplayInteraction(s,t,Ve.TouchDown),this.yOffsetMouseDown=t.y}unitPosTouchUp(t,e,i){const s=new O(e,i);this.handleUserDisplayInteraction(s,t,Ve.TouchUp),this.displayInteractionManager.WasZoomGestureActive===!1&&this.unlockFromCursorIfNecessary(t),this.yOffsetMouseDown=Number.MIN_VALUE}unitPosMove(t,e,i){const s=new O(e,i);this.handleUserDisplayInteraction(s,t,Ve.Move),this.unlockFromCursorIfNecessary(t)}get MainViewingRegion(){return this.mainViewingRegion}setMusicSheet(t){this.graphicalMusicSheet=t,this.adaptDisplayLimitsToSheet(),this.setYOffset(0,!0)}viewportXChanged(t,e){this.graphicalMusicSheet!==void 0&&this.horizontalViewportChanged(t,e)}viewportYChanged(t,e){this.graphicalMusicSheet!==void 0&&(this.yOffsetMouseDown<=Number.MIN_VALUE+.5&&(this.yOffsetMouseDown=t),this.verticalViewportChanged(t,e))}displaySizeChanged(t,e){super.viewSizeChanged(t,e),!(Math.abs(t-0)<1e-7||Math.abs(e-0)<1e-7)&&(this.graphicalMusicSheet!==void 0&&this.graphicalMusicSheet.EnforceRedrawOfMusicSystems(),this.mainViewingRegion.DisplaySizeInPixel=new $e(t,e),this.adaptDisplayLimitsToSheet())}calcDisplayYPosition(t){return t.PositionAndShape.AbsolutePosition.y+t.PositionAndShape.BorderMarginTop-this.topBarHeightInUnits()-this.relativeTopPosition*this.heightWithoutTopBottomBarsInUnits()}yPositionForLastSystem(t){return t.PositionAndShape.AbsolutePosition.y+t.PositionAndShape.BorderMarginBottom-this.topBarHeightInUnits()-(1-this.relativeTopPosition)*this.heightWithoutTopBottomBarsInUnits()}scorePositionChanged(t,e,i,s,r,o){const a=this.calcDisplayYPosition(s);this.setYPosition(a,o)}setXPosition(t,e){this.LockDisplayToCursor&&this.setXOffset(t,e)}setYPosition(t,e){this.LockDisplayToCursor&&this.setYOffset(t,e)}get DrawingParameters(){return this.musicSheetDrawer.drawingParameters}topBarHeightInUnits(){return this.mainViewingRegion.transformLengthYToUnitCoordinates(this.TopBarHeightInPixel)}bottomBarHeightInUnits(){return this.mainViewingRegion.transformLengthYToUnitCoordinates(this.BottomBarHeightInPixel)}heightWithoutTopBottomBarsInUnits(){return this.mainViewingRegion.ViewRegionInUnits.height-this.topBarHeightInUnits()-this.bottomBarHeightInUnits()}activePositionToBottomBarHeight(){return(this.mainViewingRegion.ViewRegionInUnits.height-this.topBarHeightInUnits()-this.bottomBarHeightInUnits())*(1-2*this.relativeTopPosition)}getClickPosition(t,e){return this.mainViewingRegion.transformToUnitCoordinates(new O(t,e))}graphicalObjectIsVisible(t){return this.mainViewingRegion.isVisible(t,!1)}adaptDisplayLimitsToSheet(){if(this.graphicalMusicSheet===void 0||this.graphicalMusicSheet.MusicPages.length===0||this.graphicalMusicSheet.MusicPages[0].MusicSystems.length===0)return;this.offsetXMin=0,this.rangeXMin=this.graphicalMusicSheet.MinAllowedSystemWidth,this.rangeXMax=300,this.offsetYMin=-.3*this.RangeY;const t=this.graphicalMusicSheet.MusicPages.last().PositionAndShape;this.offsetYMax=Math.max(0,t.BorderMarginBottom-.7*this.RangeY),this.OffsetY>this.offsetYMax&&this.setYOffset(this.offsetYMax,!0)}horizontalViewportChanged(t,e){this.mainViewingRegion.WidthInUnits!==e&&(this.mainViewingRegion.WidthInUnits=e)}verticalViewportChanged(t,e){this.mainViewingRegion.UpperLeftPositionInUnits=new O(this.mainViewingRegion.UpperLeftPositionInUnits.x,t)}unlockFromCursorIfNecessary(t){if(this.LockDisplayToCursor===!1||this.ZoomActive||this.displayInteractionManager.ZoomGestureActive||this.displayInteractionManager.WasZoomGestureActive)return;Math.abs((t.y-this.yOffsetMouseDown)*this.mainViewingRegion.RegionSizeInPixel.height/this.mainViewingRegion.ViewRegionInUnits.height)>this.unlockCursorDistancePixel&&(this.LockDisplayToCursor=!1)}getPositionInUnits(t,e){return this.mainViewingRegion.transformToUnitCoordinates(new O(t,e))}handleUserDisplayInteraction(t,e,i){switch(i){case Ve.TouchDown:case Ve.SingleTouch:case Ve.DoubleTouch:{const s=this.graphicalMusicSheet.GetNearestVoiceEntry(e);if(s){const r=new CustomEvent("note-click",{detail:os(be({},s),{setAvtivePlay:()=>{var o,a;if(s.parentStaffEntry.parentVerticalContainer!==void 0){const l=s.parentStaffEntry.parentVerticalContainer.AbsoluteTimestamp;this.setStartPosition(l),((o=s.notes[0])==null?void 0:o.sourceNote.Pitch)!==void 0&&(console.log("playback clicked note",s.parentVoiceEntry),(a=this.PlaybackManager)==null||a.playVoiceEntry(s.parentVoiceEntry))}}})});window.dispatchEvent(r)}}case Ve.TouchUp:case Ve.TouchDown:case Ve.Move:for(const s of this.listeners)s.userDisplayInteraction(t,e,i);break;default:throw new Error("type")}}setStartPosition(t){var e;this.graphicalMusicSheet!==void 0&&(this.graphicalMusicSheet.ParentMusicSheet.SelectionStart=t,(e=this.PlaybackManager)==null||e.reset())}get GraphicalMusicSheet(){return this.graphicalMusicSheet}}class af extends of{mouseMove(t,e,i,s){const r=this.getPositionInUnits(t,e);this.unitPosMove(r,t,e)}}class lf{constructor(){this.listeners=[],this.zoomGestureActive=!1,this.touchCount=0,this.touchActive=!1,this.touchMoving=!1,this.displayWidth=1,this.displayHeight=1,this.displayDpi=96,this.maxNumerOfFingers=2,this.movementThreshInch=.075,this.interactionWasZoomGesture=!1}addListener(t){this.listeners.push(t)}get ZoomGestureActive(){return this.zoomGestureActive}get WasZoomGestureActive(){return this.interactionWasZoomGesture}displaySizeChanged(t,e){this.displayWidth=t,this.displayHeight=e;for(const i of this.listeners)i.displaySizeChanged(this.displayWidth,this.displayHeight)}Dispose(){this.dispose()}Initialize(){this.initialize()}get DisplayDpi(){return this.displayDpi}get TouchActive(){return this.touchActive}get TouchMoving(){return this.touchMoving}touchDown(t,e,i){this.interactionWasZoomGesture=!1;const s=t/this.displayWidth,r=e/this.displayHeight;this.lastRelPosX=s,this.lastRelPosY=r,this.lastPixelX=t,this.lastPixelY=e,this.touchActive=!0,this.touchMoving=!1,this.touchCount=Math.min(this.touchCount+1,this.maxNumerOfFingers);for(const o of this.listeners)o.mouseDown(s,r,!i)}move(t,e){if(this.touchActive&&!this.zoomGestureActive){const i=t/this.displayWidth,s=e/this.displayHeight,r=i-this.lastRelPosX,o=s-this.lastRelPosY;this.touchMoving=!0;for(const a of this.listeners)a.mouseMove(i,s,r,o)}}zoomGestureStarted(){this.zoomGestureActive=!0}zoomGestureCompleted(){this.zoomGestureActive=!1,this.interactionWasZoomGesture=!0}zoomGestureMove(t){this.zoomGestureActive&&this.listeners.forEach(function(e){e.zoom(t)})}touchUp(t,e){this.touchActive=!1,this.touchMoving=!1,this.touchCount=Math.max(0,this.touchCount-1);const i=t/this.displayWidth,s=e/this.displayHeight;for(const r of this.listeners)r.mouseUp(i,s)}click(t,e){if(!this.mouseDidMove(this.lastPixelX,t,this.lastPixelY,e)&&!this.ZoomGestureActive){const i=t/this.displayWidth,s=e/this.displayHeight;for(const r of this.listeners)r.positionTouched(i,s)}}doubleClick(t,e){if(!this.mouseDidMove(this.lastPixelX,t,this.lastPixelY,e)&&!this.ZoomGestureActive){const i=t/this.displayWidth,s=e/this.displayHeight;for(const r of this.listeners)r.positionDoubleTouched(i,s)}}mouseDidMove(t,e,i,s){const r=Math.abs(t-e)/this.displayDpi,o=Math.abs(i-s)/this.displayDpi;return r>this.movementThreshInch||o>this.movementThreshInch}}class On extends lf{constructor(t){super(),this.fullOffsetLeft=0,this.fullOffsetTop=0,this.fullScrollTop=0,this.fullScrollLeft=0,this.parentScrollMap=new Map,this.scrollCallbackMap=new Map,this.timeout=void 0,this.resizeObserver=void 0,this.EventCallbackMap=new Ye,this.DOUBLE_CLICK_WINDOW=200,this.lastClick=0,this.osmdSheetMusicContainer=t,this.listenForInteractions()}get FullOffsetTop(){return this.fullOffsetTop}get FullScrollTop(){return this.fullScrollTop}get FullOffsetLeft(){return this.fullOffsetLeft}get FullScrollLeft(){return this.fullScrollLeft}static resizeCallback(t,e){clearTimeout(e.timeout),e.timeout=setTimeout(()=>{e.fullOffsetLeft=0,e.fullOffsetTop=0;let i=e.osmdSheetMusicContainer;for(;i;)e.fullOffsetLeft+=i.offsetLeft,e.fullOffsetTop+=i.offsetTop,i=i.offsetParent;e.resizeEventListener(),e.deregisterScrollOffsets(),e.registerScrollOffsets()},500)}registerScrollOffsets(){let t=this.osmdSheetMusicContainer;this.fullScrollTop=0,this.fullScrollLeft=0;const e=this;for(;t&&t!==document.documentElement;){if(this.parentScrollMap.set(t,[t.scrollTop,t.scrollLeft]),this.fullScrollLeft+=t.scrollLeft,this.fullScrollTop+=t.scrollTop,t.scrollHeight>t.clientHeight){const i=function(s){const r=e.parentScrollMap.get(this),o=r[0],a=r[1];e.fullScrollTop=e.fullScrollTop-o+this.scrollTop,e.fullScrollLeft=e.fullScrollLeft-a+this.scrollLeft,e.parentScrollMap.set(this,[this.scrollTop,this.scrollLeft])};this.scrollCallbackMap.set(t,i),t.addEventListener("scroll",i)}t=t.parentElement}}deregisterScrollOffsets(){for(const t of this.scrollCallbackMap.keys())t.removeEventListener("scroll",this.scrollCallbackMap.get(t));this.scrollCallbackMap.clear()}initialize(){this.fullOffsetLeft=0,this.fullOffsetTop=0;let t=this.osmdSheetMusicContainer;const e=[],i=this;for(window.ResizeObserver&&(this.resizeObserver=new ResizeObserver(s=>{On.resizeCallback(s,i)}));t;)this.fullOffsetLeft+=t.offsetLeft,this.fullOffsetTop+=t.offsetTop,this.resizeObserver?this.resizeObserver.observe(t):e.push(t),t=t.offsetParent;if(this.resizeObserver)this.disposeResizeListener=()=>{i.resizeObserver.disconnect(),i.resizeObserver=void 0};else{let s=()=>{On.resizeCallback(e,i)};window.addEventListener("resize",s),this.disposeResizeListener=()=>{window.removeEventListener("resize",s),s=void 0}}i.registerScrollOffsets()}dispose(){this.disposeResizeListener();for(const t of this.EventCallbackMap.keys()){const e=this.EventCallbackMap.getValue(t);e[0].removeEventListener(t,e[1])}this.EventCallbackMap.clear(),this.deregisterScrollOffsets(),this.scrollCallbackMap.clear(),this.parentScrollMap.clear()}isTouch(){if("ontouchstart"in window||window.DocumentTouch)return!0;if(!window.matchMedia)return!1;const e=["(",["-webkit-","-moz-","-o-","-ms-"].join("touch-enabled),("),"heartz",")"].join("");return window.matchMedia(e).matches}get downEventName(){return this.isTouch()?"touchstart":"mousedown"}get moveEventName(){return this.isTouch()?"touchmove":"mousemove"}listenForInteractions(){const t=this.downEventListener.bind(this),e=this.touchEndEventListener.bind(this),i=this.moveEventListener.bind(this);this.osmdSheetMusicContainer.addEventListener("mousedown",t),this.osmdSheetMusicContainer.addEventListener("touchend",e),document.addEventListener(this.moveEventName,i),this.EventCallbackMap.setValue("mousedown",[this.osmdSheetMusicContainer,t]),this.EventCallbackMap.setValue("touchend",[this.osmdSheetMusicContainer,e]),this.EventCallbackMap.setValue(this.moveEventName,[document,i])}downEventListener(t){const e=new Date().getTime(),i=e-this.lastClick;clearTimeout(this.clickTimeout);let s=0,r=0;this.isTouch()&&t instanceof TouchEvent?(s=t.touches[0].pageX,r=t.touches[0].pageY):t instanceof MouseEvent&&(s=t.pageX,r=t.pageY);const o=this.getOffsetCoordinates(s,r);if(i<this.DOUBLE_CLICK_WINDOW&&i>0)this.doubleClick(o.x,o.y);else{const a=this;this.clickTimeout=setTimeout(function(){clearTimeout(this.clickTimeout),a.isTouch()?a.touchDown(o.x,o.y,void 0):a.click(o.x,o.y)},this.DOUBLE_CLICK_WINDOW)}this.lastClick=e}moveEventListener(t){let e=0,i=0;if(this.isTouch()&&t instanceof TouchEvent){let r;t.touches&&t.touches.length>0?r=t.touches[0]:t.changedTouches&&t.changedTouches.length>0&&(r=t.changedTouches[0]),e=r==null?void 0:r.clientX,i=r==null?void 0:r.clientY}else t instanceof MouseEvent&&(e=t.clientX,i=t.clientY);const s=this.getOffsetCoordinates(e,i);this.move(s.x,s.y)}touchEndEventListener(t){let e;t.touches&&t.touches.length>0?e=t.touches[0]:t.changedTouches&&t.changedTouches.length>0&&(e=t.changedTouches[0]);const i=this.getOffsetCoordinates(e==null?void 0:e.pageX,e==null?void 0:e.pageY);this.touchUp(i.x,i.y)}resizeEventListener(){this.displaySizeChanged(this.osmdSheetMusicContainer.clientWidth,this.osmdSheetMusicContainer.clientHeight)}getOffsetCoordinates(t,e){const i=t-this.fullOffsetLeft+this.fullScrollLeft,s=e-this.fullOffsetTop+this.fullScrollTop;return new O(i,s)}}class Vn{static fillDynamicsList(t,e,i){for(let s=0;s<e.StaffLinkedExpressions.length;s++)for(let r=0,o=e.StaffLinkedExpressions[s].length;r<o;++r){const a=e.StaffLinkedExpressions[s][r];if(!(a.InstantaneousDynamic===void 0&&a.StartingContinuousDynamic===void 0)){if(a.StaffNumber=s,a.StartingContinuousDynamic!==void 0&&a.StartingContinuousDynamic.isWedge()&&a.StartingContinuousDynamic.EndMultiExpression!==void 0){const l=a.AbsoluteTimestamp,h=a.StartingContinuousDynamic.EndMultiExpression.AbsoluteTimestamp;if(l.Equals(h))continue}if(a.InstantaneousDynamic!==void 0){i[s].push(new Pi(a.InstantaneousDynamic,a.StaffNumber));const l=this.getOtherStaffIndexIfLinkedStavesAreDetected(t,s,a.InstantaneousDynamic.Placement);l>=0&&i[l].push(new Pi(a.InstantaneousDynamic,l))}if(a.StartingContinuousDynamic!==void 0){i[s].push(new Pi(a.StartingContinuousDynamic,a.StaffNumber));const l=this.getOtherStaffIndexIfLinkedStavesAreDetected(t,s,a.StartingContinuousDynamic.Placement);l>=0&&i[l].push(new Pi(a.StartingContinuousDynamic,l))}}}}static getOtherStaffIndexIfLinkedStavesAreDetected(t,e,i){const s=t.getStaffFromIndex(e),r=s.ParentInstrument.Staves.indexOf(s),o=s.ParentInstrument.Staves.length;return o>1&&r===0&&i===z.Below?e+1:o>1&&r===1&&i===z.Above?e-1:-1}static fillDynamicExpressions(t){const e=t.DynListStaves,i=t.getCompleteNumberOfStaves(),s=t.TimestampSortedDynamicExpressionsList;for(let r=0;r<i;r++)e.push([]);for(let r=0,o=t.SourceMeasures.length;r<o;++r){const a=t.SourceMeasures[r];Vn.fillDynamicsList(t,a,e)}for(let r=0;r<e.length;r++)for(let o=0,a=e[r].length;o<a;++o){const l=e[r][o];l.instantaneousDynamicExpression!==void 0&&!Ai.dynamicToRelativeVolumeDict.containsKey(l.instantaneousDynamicExpression.DynEnum)||s.push(l)}s.sort(Pi.Compare)}calculate(t){Vn.fillDynamicExpressions(t)}}const Mn=class{constructor(n,t=ea.OSMDOptionsStandard(),e=new Ui){if(this.version="1.4.5-audio-extended",this.cursorsOptions=[],this.cursors=[],this.zoom=1,this.zoomUpdated=!1,this.loadUrlTimeout=5e3,this.rules=e,typeof n=="string"?this.container=document.getElementById(n):n&&"appendChild"in n&&(this.container=n),!this.container)throw new Error("Please pass a valid div container to OpenSheetMusicDisplay");t.autoResize===void 0&&(t.autoResize=!0),this.backendType=$i.SVG,this.setOptions(t),this.interactionManager=new On(this.container),this.renderingManager=new af(this.interactionManager,this.rules)}get cursor(){return this.cursors[0]}get RenderingManager(){return this.renderingManager}set PlaybackManager(n){this.renderingManager&&(this.renderingManager.PlaybackManager=n)}get PlaybackManager(){var n;return(n=this.renderingManager)==null?void 0:n.PlaybackManager}isUrl(n){return n.length<2083}isMxl(n){return n.substr(0,4)==="PK"}processMxl(n,t,e){sf.MXLtoXMLstring(n).then(i=>{t(this.processStringXml(i))},i=>{j.error(new Error("[OSMD] Invalid MXL file: "+i)),e(new Error("[OSMD] Invalid MXL file: "+i))})}processStringXml(n){const t=new DOMParser;if(n.substr(0,3)==="\uF7EF\uF7BB\uF7BF")return j.debug("[OSMD] UTF with BOM detected, truncate first three bytes and pass along: "+n),t.parseFromString(n.substr(3),"application/xml");if(n.substr(0,6).includes("<?xml")){const e=this.OnXMLRead(n);return j.debug("[OSMD] Finally parsing XML content, length: "+e.length),t.parseFromString(e,"application/xml")}}load(n,t){this.reset();const e=this;return new Promise(function(s,r){new Promise(function(a,l){if(typeof n=="string"){const h=n.trim();if(e.isMxl(h))j.debug("[OSMD] This is a zip file, unpack it first: "+h),e.processMxl(h,a,l);else{const c=e.processStringXml(h);if(c)a(c);else if(e.isUrl(h))Ol.ajax(h).then(u=>{e.isMxl(u)?e.processMxl(u,a,l):a(e.processStringXml(u))},u=>{throw l(u),u});else{const u=new Error("[OSMD] osmd.load(string): Could not process string. Did not find <?xml at beginning.");console.error(u.message),l(u)}}}else if(n instanceof Document)a(n);else{const h=new Error("[OSMD] osmd.load(): content is not string or Document. Could not load.");console.error(h.message),l(h)}}).then(function(a){(!a||!a.nodeName)&&r(new Error("OpenSheetMusicDisplay: The document which was provided is invalid"));const l=a.childNodes;j.debug("[OSMD] load(), Document url: "+a.URL);let h;for(let p=0,g=l.length;p<g;p+=1){const m=l[p];if(m.nodeType===Node.ELEMENT_NODE&&m.nodeName.toLowerCase()==="score-partwise"){h=m;break}}h||(console.error("Could not parse MusicXML, no valid partwise element found"),r(new Error("OpenSheetMusicDisplay: Document is not a valid 'partwise' MusicXML")));const c=new Ks(h),u=new Vn,f=new Mo,d=new Eo([u,f],e.rules);e.sheet=d.createMusicSheet(c,"Untitled Score"),e.sheet===void 0&&r(new Error("given music sheet was incomplete or could not be loaded.")),j.info(`[OSMD] Loaded sheet ${e.sheet.TitleString} successfully.`),e.needBackendUpdate=!0,e.updateGraphic(),s()}).catch(function(a){j.debug("Content XML Promise was rejected"),r(a)})})}updateGraphic(){const n=new Sr(this.rules);this.graphic=new La(this.sheet,n),this.drawingParameters.drawCursors&&this.cursors.forEach(t=>{t.init(this.sheet.MusicPartManager,this.graphic)}),this.renderingManager.setMusicSheet(this.graphic),this.interactionManager.Initialize()}render(){var t;if(!this.graphic)throw new Error("OpenSheetMusicDisplay: Before rendering a music sheet, please load a MusicXML file");(t=this.drawer)==null||t.clear();let n=this.container.offsetWidth;this.rules.RenderSingleHorizontalStaffline&&(n=this.rules.SheetMaximumWidth),this.sheet.pageWidth=n/this.zoom/10,this.renderingManager.MainViewingRegion.WidthInUnits=this.sheet.pageWidth,this.rules.PageFormat&&!this.rules.PageFormat.IsUndefined?(this.rules.PageHeight=this.sheet.pageWidth/this.rules.PageFormat.aspectRatio,j.debug("[OSMD] PageHeight: "+this.rules.PageHeight)):(j.debug("[OSMD] endless/undefined pageformat, id: "+this.rules.PageFormat.idString),this.rules.PageHeight=100001),this.graphic.reCalculate(),this.drawingParameters.drawCursors&&(this.graphic.Cursors.length=0),this.createOrRefreshRenderBackend(),this.needBackendUpdate=!1,this.drawer.setZoom(this.zoom),this.drawer.drawSheet(this.graphic),this.enableOrDisableCursors(this.drawingParameters.drawCursors),this.drawingParameters.drawCursors&&this.cursors.forEach(e=>{e.update()}),this.zoomUpdated=!1,this.interactionManager.displaySizeChanged(this.container.clientWidth,this.container.clientHeight)}createOrRefreshRenderBackend(){this.drawer&&this.drawer.Backends&&(this.drawer.Backends[0]&&this.drawer.Backends[0].removeAllChildrenFromContainer(this.container),this.drawer.Backends.clear()),this.drawingParameters.Rules=this.rules,this.drawer=new su(this.drawingParameters),this.drawer.drawableBoundingBoxElement=this.DrawBoundingBox,this.drawer.bottomLineVisible=this.drawBottomLine,this.drawer.skyLineVisible=this.drawSkyLine;let n=this.container.offsetWidth;this.rules.RenderSingleHorizontalStaffline&&(n=this.graphic.MusicPages[0].PositionAndShape.Size.width*10*this.zoom);let t;const e=32767;for(const i of this.graphic.MusicPages){if(i.PageNumber>this.rules.MaxPageToDrawNumber)break;const s=this.createBackend(this.backendType,i),r=" exceeds CanvasBackend limit of 32767. Cutting off score.";s.getOSMDBackendType()===$i.Canvas&&n>e&&(j.warn("[OSMD] Warning: width of "+n+r),n=e),this.rules.PageFormat&&!this.rules.PageFormat.IsUndefined?t=n/this.rules.PageFormat.aspectRatio:(t=i.PositionAndShape.Size.height,t+=this.rules.PageBottomMargin,t+=this.rules.CompactMode?this.rules.PageTopMarginNarrow:this.rules.PageTopMargin,this.rules.RenderTitle&&(t+=this.rules.TitleTopDistance),t*=this.zoom*10),s.getOSMDBackendType()===$i.Canvas&&t>e&&(j.warn("[OSMD] Warning: height of "+t+r),t=Math.min(t,e)),s.resize(n,t),s.clear(),this.drawer.Backends.push(s),this.graphic.drawer=this.drawer}}exportSVG(){var n;for(const t of(n=this.drawer)==null?void 0:n.Backends)t instanceof Rr&&t.export()}IsReadyToRender(){return this.graphic!==void 0}clear(){var n;(n=this.drawer)==null||n.clear(),this.reset()}dispose(){this.disposeResizeListener&&this.disposeResizeListener(),this.InteractionManager&&this.InteractionManager.Dispose()}setOptions(n){if(this.rules||(this.rules=new Ui),this.drawingParameters||(this.drawingParameters=new Ja,this.drawingParameters.Rules=this.rules),n==null){j.warn(`warning: osmd.setOptions() called without an options parameter, has no effect.
  26. example usage: osmd.setOptions({drawCredits: false, drawPartNames: false})`);return}this.OnXMLRead=function(s){return s},n.onXMLRead&&(this.OnXMLRead=n.onXMLRead),n.drawingParameters&&(this.drawingParameters.DrawingParametersEnum=vo[n.drawingParameters.toLowerCase()]);let e=!this.drawer||!this.drawer.Backends||this.drawer.Backends.length<1;if(n.backend!==void 0){const s=ea.BackendTypeFromString(n.backend);e=e||this.backendType!==s,this.backendType=s}this.needBackendUpdate=e,n.autoBeam!==void 0&&(this.rules.AutoBeamNotes=n.autoBeam);const i=n.autoBeamOptions;if(i&&(i.maintain_stem_directions===void 0&&(i.maintain_stem_directions=!1),this.rules.AutoBeamOptions=i,i.groups&&i.groups.length)){for(const s of i.groups)if(s.length!==2)throw new Error("Each fraction in autoBeamOptions.groups must be of length 2, e.g. [3,4] for beaming three fourths")}n.percussionOneLineCutoff!==void 0&&(this.rules.PercussionOneLineCutoff=n.percussionOneLineCutoff),this.rules.PercussionOneLineCutoff!==0&&n.percussionForceVoicesOneLineCutoff!==void 0&&(this.rules.PercussionForceVoicesOneLineCutoff=n.percussionForceVoicesOneLineCutoff),n.alignRests!==void 0&&(this.rules.AlignRests=n.alignRests),n.coloringMode!==void 0&&this.setColoringMode(n),n.coloringEnabled!==void 0&&(this.rules.ColoringEnabled=n.coloringEnabled),n.colorStemsLikeNoteheads!==void 0&&(this.rules.ColorStemsLikeNoteheads=n.colorStemsLikeNoteheads),n.disableCursor&&(this.drawingParameters.drawCursors=!1),n.drawHiddenNotes&&(this.drawingParameters.drawHiddenNotes=!0),n.drawCredits!==void 0&&(this.drawingParameters.DrawCredits=n.drawCredits),n.drawComposer!==void 0&&(this.drawingParameters.DrawComposer=n.drawComposer),n.drawTitle!==void 0&&(this.drawingParameters.DrawTitle=n.drawTitle),n.drawSubtitle!==void 0&&(this.drawingParameters.DrawSubtitle=n.drawSubtitle),n.drawLyricist!==void 0&&(this.drawingParameters.DrawLyricist=n.drawLyricist),n.drawMetronomeMarks!==void 0&&(this.rules.MetronomeMarksDrawn=n.drawMetronomeMarks),n.drawPartNames!==void 0&&(this.drawingParameters.DrawPartNames=n.drawPartNames,n.drawPartAbbreviations||(this.rules.RenderPartAbbreviations=n.drawPartNames)),n.drawPartAbbreviations!==void 0&&(this.rules.RenderPartAbbreviations=n.drawPartAbbreviations),n.drawFingerings===!1&&(this.rules.RenderFingerings=!1),n.drawMeasureNumbers!==void 0&&(this.rules.RenderMeasureNumbers=n.drawMeasureNumbers),n.drawMeasureNumbersOnlyAtSystemStart&&(this.rules.RenderMeasureNumbersOnlyAtSystemStart=n.drawMeasureNumbersOnlyAtSystemStart),n.drawLyrics!==void 0&&(this.rules.RenderLyrics=n.drawLyrics),n.drawTimeSignatures!==void 0&&(this.rules.RenderTimeSignatures=n.drawTimeSignatures),n.drawSlurs!==void 0&&(this.rules.RenderSlurs=n.drawSlurs),n.measureNumberInterval!==void 0&&(this.rules.MeasureNumberLabelOffset=n.measureNumberInterval),n.useXMLMeasureNumbers!==void 0&&(this.rules.UseXMLMeasureNumbers=n.useXMLMeasureNumbers),n.fingeringPosition!==void 0&&(this.rules.FingeringPosition=Ii.PlacementEnumFromString(n.fingeringPosition)),n.fingeringInsideStafflines!==void 0&&(this.rules.FingeringInsideStafflines=n.fingeringInsideStafflines),n.newSystemFromXML!==void 0&&(this.rules.NewSystemAtXMLNewSystemAttribute=n.newSystemFromXML),n.newPageFromXML!==void 0&&(this.rules.NewPageAtXMLNewPageAttribute=n.newPageFromXML),n.fillEmptyMeasuresWithWholeRest!==void 0&&(this.rules.FillEmptyMeasuresWithWholeRest=n.fillEmptyMeasuresWithWholeRest),n.followCursor!==void 0&&(this.FollowCursor=n.followCursor),n.setWantedStemDirectionByXml!==void 0&&(this.rules.SetWantedStemDirectionByXml=n.setWantedStemDirectionByXml),n.darkMode?(this.rules.applyDefaultColorMusic("#FFFFFF"),this.rules.PageBackgroundColor="#000000"):n.darkMode===!1&&(this.rules.applyDefaultColorMusic("#000000"),this.rules.PageBackgroundColor=void 0),n.defaultColorMusic&&this.rules.applyDefaultColorMusic(n.defaultColorMusic),n.defaultColorNotehead&&(this.rules.DefaultColorNotehead=n.defaultColorNotehead),n.defaultColorRest&&(this.rules.DefaultColorRest=n.defaultColorRest),n.defaultColorStem&&(this.rules.DefaultColorStem=n.defaultColorStem),n.defaultColorLabel&&(this.rules.DefaultColorLabel=n.defaultColorLabel),n.defaultColorTitle&&(this.rules.DefaultColorTitle=n.defaultColorTitle),n.defaultFontFamily&&(this.rules.DefaultFontFamily=n.defaultFontFamily),n.defaultFontStyle&&(this.rules.DefaultFontStyle=n.defaultFontStyle),n.drawUpToMeasureNumber&&(this.rules.MaxMeasureToDrawIndex=n.drawUpToMeasureNumber-1),n.drawFromMeasureNumber&&(this.rules.MinMeasureToDrawIndex=n.drawFromMeasureNumber-1),n.drawUpToPageNumber&&(this.rules.MaxPageToDrawNumber=n.drawUpToPageNumber),n.drawUpToSystemNumber&&(this.rules.MaxSystemToDrawNumber=n.drawUpToSystemNumber),n.tupletsRatioed&&(this.rules.TupletsRatioed=!0),n.tupletsBracketed&&(this.rules.TupletsBracketed=!0),n.tripletsBracketed&&(this.rules.TripletsBracketed=!0),n.autoResize?(this.resizeHandlerAttached||this.autoResize(),this.autoResizeEnabled=!0):n.autoResize===!1&&(this.autoResizeEnabled=!1),n.pageFormat!==void 0&&this.setPageFormat(n.pageFormat),n.pageBackgroundColor!==void 0&&(this.rules.PageBackgroundColor=n.pageBackgroundColor),n.performanceMode!==void 0&&(this.rules.PerformanceMode=n.performanceMode),n.renderSingleHorizontalStaffline!==void 0&&(this.rules.RenderSingleHorizontalStaffline=n.renderSingleHorizontalStaffline),n.spacingFactorSoftmax!==void 0&&(this.rules.SoftmaxFactorVexFlow=n.spacingFactorSoftmax),n.spacingBetweenTextLines!==void 0&&(this.rules.SpacingBetweenTextLines=n.spacingBetweenTextLines),n.stretchLastSystemLine!==void 0&&(this.rules.StretchLastSystemLine=n.stretchLastSystemLine),n.autoGenerateMutipleRestMeasuresFromRestMeasures!==void 0&&(this.rules.AutoGenerateMutipleRestMeasuresFromRestMeasures=n.autoGenerateMutipleRestMeasuresFromRestMeasures),n.cursorsOptions!==void 0?this.cursorsOptions=n.cursorsOptions:this.cursorsOptions=[{type:0,color:this.EngravingRules.DefaultColorCursor,alpha:.5,follow:!0}]}setColoringMode(n){if(n.coloringMode===Ci.XML){this.rules.ColoringMode=Ci.XML;return}const t=[ut.C,ut.D,ut.E,ut.F,ut.G,ut.A,ut.B,-1];let e;if(n.coloringMode===Ci.CustomColorSet){if(!n.coloringSetCustom||n.coloringSetCustom.length!==8)throw new Error("Invalid amount of colors: With coloringModes.customColorSet, you have to provide a coloringSetCustom parameter with 8 strings (C to B, rest note).");for(const s of n.coloringSetCustom)if(!/^\#[0-9a-fA-F]{6}$/.test(s))throw new Error(`One of the color strings in options.coloringSetCustom was not a valid HTML Hex color:
  27. `+s);e=n.coloringSetCustom}else if(n.coloringMode===Ci.AutoColoring){e=[];const s=Object.keys(wr);for(let r=0;r<s.length;r++)e.push(wr[s[r]])}const i=new Ye;for(let s=0;s<t.length;s++)i.setValue(t[s],e[s]);i.setValue(-1,e[7]),this.rules.ColoringSetCurrent=i,this.rules.ColoringMode=n.coloringMode}setLogLevel(n){switch(n){case"trace":j.setLevel(j.levels.TRACE);break;case"debug":j.setLevel(j.levels.DEBUG);break;case"info":j.setLevel(j.levels.INFO);break;case"warn":j.setLevel(j.levels.WARN);break;case"error":j.setLevel(j.levels.ERROR);break;case"silent":j.setLevel(j.levels.SILENT);break;default:j.warn(`Could not set log level to ${n}. Using warn instead.`),j.setLevel(j.levels.WARN);break}}getLogLevel(){return j.getLevel()}reset(){this.drawingParameters.drawCursors&&this.cursors.forEach(n=>{n.hide()}),this.sheet=void 0,this.graphic=void 0,this.zoom=1}autoResize(){const n=this;this.handleResize(()=>{},()=>{var t;((t=this.graphic)==null?void 0:t.GetCalculator)instanceof Sr&&(this.graphic.GetCalculator.beamsNeedUpdate=!0),n.IsReadyToRender()&&n.render()})}handleResize(n,t){let e,i;const r=this;function o(){!r.AutoResizeEnabled||(e=new Date().getTime(),i||(n(),e=new Date().getTime(),i=window.setTimeout(a,200)))}function a(){i=void 0,window.clearTimeout(i),new Date().getTime()-e<200?i=window.setTimeout(a,200):t()}window.attachEvent?window.attachEvent("onresize",o):window.addEventListener("resize",o),this.disposeResizeListener=()=>{window.detachEvent?window.detachEvent("onresize",o):window.removeEventListener("resize",o),this.resizeHandlerAttached=!1},this.resizeHandlerAttached=!0,window.setTimeout(n,0),window.setTimeout(t,1)}enableOrDisableCursors(n){var t,e,i,s,r,o;if(this.drawingParameters.drawCursors=n,n){for(let a=0;a<this.cursorsOptions.length;a++){const l=(e=(t=this.cursors[a])==null?void 0:t.Hidden)!=null?e:!1,h=(i=this.cursors[a])==null?void 0:i.Iterator;(s=this.cursors[a])==null||s.hide();let c=(r=this.drawer)==null?void 0:r.Backends[0];if(c&&this.rules.RestoreCursorAfterRerender&&this.cursors[a]){const u=this.cursors[a].updateCurrentPage();c=this.drawer.Backends[u-1]}c&&c.getRenderElement()&&(this.cursors[a]=new Kh(c.getRenderElement(),this,this.cursorsOptions[a])),this.sheet&&this.graphic&&this.cursors[a]&&this.cursors[a].init(this.sheet.MusicPartManager,this.graphic),this.rules.RestoreCursorAfterRerender&&(h&&(this.cursors[a].iterator=h),l?this.cursors[a].hide():this.cursors[a].show())}(o=this.renderingManager.PlaybackManager)==null||o.addListener(this.cursor)}else this.cursors.forEach(a=>{a.hide()})}createBackend(n,t){let e;return n===void 0||n===$i.SVG?e=new Rr(this.rules):e=new il(this.rules),e.graphicalMusicPage=t,e.initialize(this.container,this.zoom),e.getContext().setFillStyle(this.rules.DefaultColorMusic),e.getContext().setStrokeStyle(this.rules.DefaultColorMusic),e}static StringToPageFormat(n){let t=Ce.UndefinedPageFormat;if(n.match("^[0-9]+x[0-9]+$")){const e=n.split("x"),i=Number.parseInt(e[0],10),s=Number.parseInt(e[1],10);i>0&&i<32768&&s>0&&s<32768&&(t=new Ce(i,s,`customPageFormat${n}`))}return n=n.replace(" ","_"),n=n.replace("Landscape","L"),n=n.replace("Portrait","P"),Mn.PageFormatStandards.hasOwnProperty(n)&&(t=Mn.PageFormatStandards[n]),t}setPageFormat(n){const t=Mn.StringToPageFormat(n);this.needBackendUpdate=!t.Equals(this.rules.PageFormat),this.rules.PageFormat=t}setCustomPageFormat(n,t){if(n>0&&t>0){const e=new Ce(n,t);this.rules.PageFormat=e}}set DrawSkyLine(n){this.drawSkyLine=n,this.drawer&&(this.drawer.skyLineVisible=n)}get DrawSkyLine(){return this.drawer.skyLineVisible}set DrawBottomLine(n){this.drawBottomLine=n,this.drawer&&(this.drawer.bottomLineVisible=n)}get DrawBottomLine(){return this.drawer.bottomLineVisible}set DrawBoundingBox(n){this.setDrawBoundingBox(n,!0)}get DrawBoundingBox(){return this.drawBoundingBox}setDrawBoundingBox(n,t=!1){this.drawBoundingBox=n,this.drawer&&(this.drawer.drawableBoundingBoxElement=n),t&&this.render()}get AutoResizeEnabled(){return this.autoResizeEnabled}set AutoResizeEnabled(n){this.autoResizeEnabled=n}get Zoom(){return this.zoom}set Zoom(n){var t;this.zoom=n,this.zoomUpdated=!0,((t=this.graphic)==null?void 0:t.GetCalculator)instanceof Sr&&(this.graphic.GetCalculator.beamsNeedUpdate=this.zoomUpdated)}set FollowCursor(n){this.followCursor=n}get FollowCursor(){return this.followCursor}set TransposeCalculator(n){Lt.transposeCalculator=n}get TransposeCalculator(){return Lt.transposeCalculator}get Sheet(){return this.sheet}get Drawer(){return this.drawer}get GraphicSheet(){return this.graphic}get DrawingParameters(){return this.drawingParameters}get EngravingRules(){return this.rules}get InteractionManager(){return this.interactionManager}get Version(){return this.version}};let hf=Mn;hf.PageFormatStandards={A3_L:new Ce(420,297,"A3_L"),A3_P:new Ce(297,420,"A3_P"),A4_L:new Ce(297,210,"A4_L"),A4_P:new Ce(210,297,"A4_P"),A5_L:new Ce(210,148,"A5_L"),A5_P:new Ce(148,210,"A5_P"),A6_L:new Ce(148,105,"A6_L"),A6_P:new Ce(105,148,"A6_P"),Endless:Ce.UndefinedPageFormat,Letter_L:new Ce(279.4,215.9,"Letter_L"),Letter_P:new Ce(215.9,279.4,"Letter_P")};var da={exports:{}},Ar={exports:{}},ni={},ne={};ne.__esModule=!0;ne.extend=hl;ne.indexOf=pf;ne.escapeExpression=mf;ne.isEmpty=gf;ne.createFrame=bf;ne.blockParams=Sf;ne.appendContextPath=yf;var cf={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;","=":"&#x3D;"},uf=/[&<>"'`=]/g,ff=/[&<>"'`=]/;function df(n){return cf[n]}function hl(n){for(var t=1;t<arguments.length;t++)for(var e in arguments[t])Object.prototype.hasOwnProperty.call(arguments[t],e)&&(n[e]=arguments[t][e]);return n}var Po=Object.prototype.toString;ne.toString=Po;var Ir=function(t){return typeof t=="function"};Ir(/x/)&&(ne.isFunction=Ir=function(n){return typeof n=="function"&&Po.call(n)==="[object Function]"});ne.isFunction=Ir;var cl=Array.isArray||function(n){return n&&typeof n=="object"?Po.call(n)==="[object Array]":!1};ne.isArray=cl;function pf(n,t){for(var e=0,i=n.length;e<i;e++)if(n[e]===t)return e;return-1}function mf(n){if(typeof n!="string"){if(n&&n.toHTML)return n.toHTML();if(n==null)return"";if(!n)return n+"";n=""+n}return ff.test(n)?n.replace(uf,df):n}function gf(n){return!n&&n!==0?!0:!!(cl(n)&&n.length===0)}function bf(n){var t=hl({},n);return t._parent=n,t}function Sf(n,t){return n.path=t,n}function yf(n,t){return(n?n+".":"")+t}var je={exports:{}};(function(n,t){t.__esModule=!0;var e=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function i(s,r){var o=r&&r.loc,a=void 0,l=void 0,h=void 0,c=void 0;o&&(a=o.start.line,l=o.end.line,h=o.start.column,c=o.end.column,s+=" - "+a+":"+h);for(var u=Error.prototype.constructor.call(this,s),f=0;f<e.length;f++)this[e[f]]=u[e[f]];Error.captureStackTrace&&Error.captureStackTrace(this,i);try{o&&(this.lineNumber=a,this.endLineNumber=l,Object.defineProperty?(Object.defineProperty(this,"column",{value:h,enumerable:!0}),Object.defineProperty(this,"endColumn",{value:c,enumerable:!0})):(this.column=h,this.endColumn=c))}catch{}}i.prototype=new Error,t.default=i,n.exports=t.default})(je,je.exports);var on={},kr={exports:{}};(function(n,t){t.__esModule=!0;var e=ne;t.default=function(i){i.registerHelper("blockHelperMissing",function(s,r){var o=r.inverse,a=r.fn;if(s===!0)return a(this);if(s===!1||s==null)return o(this);if(e.isArray(s))return s.length>0?(r.ids&&(r.ids=[r.name]),i.helpers.each(s,r)):o(this);if(r.data&&r.ids){var l=e.createFrame(r.data);l.contextPath=e.appendContextPath(r.data.contextPath,r.name),r={data:l}}return a(s,r)})},n.exports=t.default})(kr,kr.exports);var Br={exports:{}};(function(n,t){t.__esModule=!0;function e(o){return o&&o.__esModule?o:{default:o}}var i=ne,s=je.exports,r=e(s);t.default=function(o){o.registerHelper("each",function(a,l){if(!l)throw new r.default("Must pass iterator to #each");var h=l.fn,c=l.inverse,u=0,f="",d=void 0,p=void 0;l.data&&l.ids&&(p=i.appendContextPath(l.data.contextPath,l.ids[0])+"."),i.isFunction(a)&&(a=a.call(this)),l.data&&(d=i.createFrame(l.data));function g(x,w,T){d&&(d.key=x,d.index=w,d.first=w===0,d.last=!!T,p&&(d.contextPath=p+x)),f=f+h(a[x],{data:d,blockParams:i.blockParams([a[x],x],[p+x,null])})}if(a&&typeof a=="object")if(i.isArray(a))for(var m=a.length;u<m;u++)u in a&&g(u,u,u===a.length-1);else if(We.Symbol&&a[We.Symbol.iterator]){for(var S=[],b=a[We.Symbol.iterator](),y=b.next();!y.done;y=b.next())S.push(y.value);a=S;for(var m=a.length;u<m;u++)g(u,u,u===a.length-1)}else(function(){var x=void 0;Object.keys(a).forEach(function(w){x!==void 0&&g(x,u-1),x=w,u++}),x!==void 0&&g(x,u-1,!0)})();return u===0&&(f=c(this)),f})},n.exports=t.default})(Br,Br.exports);var Dr={exports:{}};(function(n,t){t.__esModule=!0;function e(r){return r&&r.__esModule?r:{default:r}}var i=je.exports,s=e(i);t.default=function(r){r.registerHelper("helperMissing",function(){if(arguments.length!==1)throw new s.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})},n.exports=t.default})(Dr,Dr.exports);var Fr={exports:{}};(function(n,t){t.__esModule=!0;function e(o){return o&&o.__esModule?o:{default:o}}var i=ne,s=je.exports,r=e(s);t.default=function(o){o.registerHelper("if",function(a,l){if(arguments.length!=2)throw new r.default("#if requires exactly one argument");return i.isFunction(a)&&(a=a.call(this)),!l.hash.includeZero&&!a||i.isEmpty(a)?l.inverse(this):l.fn(this)}),o.registerHelper("unless",function(a,l){if(arguments.length!=2)throw new r.default("#unless requires exactly one argument");return o.helpers.if.call(this,a,{fn:l.inverse,inverse:l.fn,hash:l.hash})})},n.exports=t.default})(Fr,Fr.exports);var Or={exports:{}};(function(n,t){t.__esModule=!0,t.default=function(e){e.registerHelper("log",function(){for(var i=[void 0],s=arguments[arguments.length-1],r=0;r<arguments.length-1;r++)i.push(arguments[r]);var o=1;s.hash.level!=null?o=s.hash.level:s.data&&s.data.level!=null&&(o=s.data.level),i[0]=o,e.log.apply(e,i)})},n.exports=t.default})(Or,Or.exports);var Vr={exports:{}};(function(n,t){t.__esModule=!0,t.default=function(e){e.registerHelper("lookup",function(i,s,r){return i&&r.lookupProperty(i,s)})},n.exports=t.default})(Vr,Vr.exports);var Gr={exports:{}};(function(n,t){t.__esModule=!0;function e(o){return o&&o.__esModule?o:{default:o}}var i=ne,s=je.exports,r=e(s);t.default=function(o){o.registerHelper("with",function(a,l){if(arguments.length!=2)throw new r.default("#with requires exactly one argument");i.isFunction(a)&&(a=a.call(this));var h=l.fn;if(i.isEmpty(a))return l.inverse(this);var c=l.data;return l.data&&l.ids&&(c=i.createFrame(l.data),c.contextPath=i.appendContextPath(l.data.contextPath,l.ids[0])),h(a,{data:c,blockParams:i.blockParams([a],[c&&c.contextPath])})})},n.exports=t.default})(Gr,Gr.exports);on.__esModule=!0;on.registerDefaultHelpers=kf;on.moveHelperToHooks=Bf;function rs(n){return n&&n.__esModule?n:{default:n}}var xf=kr.exports,vf=rs(xf),_f=Br.exports,wf=rs(_f),Ef=Dr.exports,Mf=rs(Ef),Pf=Fr.exports,Lf=rs(Pf),Tf=Or.exports,Cf=rs(Tf),Rf=Vr.exports,Nf=rs(Rf),Af=Gr.exports,If=rs(Af);function kf(n){vf.default(n),wf.default(n),Mf.default(n),Lf.default(n),Cf.default(n),Nf.default(n),If.default(n)}function Bf(n,t,e){n.helpers[t]&&(n.hooks[t]=n.helpers[t],e||delete n.helpers[t])}var Lo={},Wr={exports:{}};(function(n,t){t.__esModule=!0;var e=ne;t.default=function(i){i.registerDecorator("inline",function(s,r,o,a){var l=s;return r.partials||(r.partials={},l=function(h,c){var u=o.partials;o.partials=e.extend({},u,r.partials);var f=s(h,c);return o.partials=u,f}),r.partials[a.args[0]]=a.fn,l})},n.exports=t.default})(Wr,Wr.exports);Lo.__esModule=!0;Lo.registerDefaultDecorators=Vf;function Df(n){return n&&n.__esModule?n:{default:n}}var Ff=Wr.exports,Of=Df(Ff);function Vf(n){Of.default(n)}var Gn={exports:{}};(function(n,t){t.__esModule=!0;var e=ne,i={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function(r){if(typeof r=="string"){var o=e.indexOf(i.methodMap,r.toLowerCase());o>=0?r=o:r=parseInt(r,10)}return r},log:function(r){if(r=i.lookupLevel(r),typeof console!="undefined"&&i.lookupLevel(i.level)<=r){var o=i.methodMap[r];console[o]||(o="log");for(var a=arguments.length,l=Array(a>1?a-1:0),h=1;h<a;h++)l[h-1]=arguments[h];console[o].apply(console,l)}}};t.default=i,n.exports=t.default})(Gn,Gn.exports);var Ls={},To={};To.__esModule=!0;To.createNewLookupObject=Wf;var Gf=ne;function Wf(){for(var n=arguments.length,t=Array(n),e=0;e<n;e++)t[e]=arguments[e];return Gf.extend.apply(void 0,[Object.create(null)].concat(t))}Ls.__esModule=!0;Ls.createProtoAccessControl=Xf;Ls.resultIsAllowed=Yf;Ls.resetLoggedProperties=Kf;function Uf(n){if(n&&n.__esModule)return n;var t={};if(n!=null)for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e]);return t.default=n,t}var pa=To,zf=Gn.exports,Hf=Uf(zf),Wn=Object.create(null);function Xf(n){var t=Object.create(null);t.constructor=!1,t.__defineGetter__=!1,t.__defineSetter__=!1,t.__lookupGetter__=!1;var e=Object.create(null);return e.__proto__=!1,{properties:{whitelist:pa.createNewLookupObject(e,n.allowedProtoProperties),defaultValue:n.allowProtoPropertiesByDefault},methods:{whitelist:pa.createNewLookupObject(t,n.allowedProtoMethods),defaultValue:n.allowProtoMethodsByDefault}}}function Yf(n,t,e){return ma(typeof n=="function"?t.methods:t.properties,e)}function ma(n,t){return n.whitelist[t]!==void 0?n.whitelist[t]===!0:n.defaultValue!==void 0?n.defaultValue:(jf(t),!1)}function jf(n){Wn[n]!==!0&&(Wn[n]=!0,Hf.log("error",'Handlebars: Access has been denied to resolve the property "'+n+`" because it is not an "own property" of its parent.
  28. You can add a runtime option to disable the check or this warning:
  29. See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details`))}function Kf(){Object.keys(Wn).forEach(function(n){delete Wn[n]})}ni.__esModule=!0;ni.HandlebarsEnvironment=Ur;function ul(n){return n&&n.__esModule?n:{default:n}}var Ji=ne,qf=je.exports,yr=ul(qf),Jf=on,Zf=Lo,Qf=Gn.exports,Un=ul(Qf),$f=Ls,td="4.7.7";ni.VERSION=td;var ed=8;ni.COMPILER_REVISION=ed;var id=7;ni.LAST_COMPATIBLE_COMPILER_REVISION=id;var sd={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};ni.REVISION_CHANGES=sd;var xr="[object Object]";function Ur(n,t,e){this.helpers=n||{},this.partials=t||{},this.decorators=e||{},Jf.registerDefaultHelpers(this),Zf.registerDefaultDecorators(this)}Ur.prototype={constructor:Ur,logger:Un.default,log:Un.default.log,registerHelper:function(t,e){if(Ji.toString.call(t)===xr){if(e)throw new yr.default("Arg not supported with multiple helpers");Ji.extend(this.helpers,t)}else this.helpers[t]=e},unregisterHelper:function(t){delete this.helpers[t]},registerPartial:function(t,e){if(Ji.toString.call(t)===xr)Ji.extend(this.partials,t);else{if(typeof e=="undefined")throw new yr.default('Attempting to register a partial called "'+t+'" as undefined');this.partials[t]=e}},unregisterPartial:function(t){delete this.partials[t]},registerDecorator:function(t,e){if(Ji.toString.call(t)===xr){if(e)throw new yr.default("Arg not supported with multiple decorators");Ji.extend(this.decorators,t)}else this.decorators[t]=e},unregisterDecorator:function(t){delete this.decorators[t]},resetLoggedPropertyAccesses:function(){$f.resetLoggedProperties()}};var nd=Un.default.log;ni.log=nd;ni.createFrame=Ji.createFrame;ni.logger=Un.default;var zr={exports:{}};(function(n,t){t.__esModule=!0;function e(i){this.string=i}e.prototype.toString=e.prototype.toHTML=function(){return""+this.string},t.default=e,n.exports=t.default})(zr,zr.exports);var Hi={},Co={};Co.__esModule=!0;Co.wrapHelper=rd;function rd(n,t){if(typeof n!="function")return n;var e=function(){var s=arguments[arguments.length-1];return arguments[arguments.length-1]=t(s),n.apply(this,arguments)};return e}Hi.__esModule=!0;Hi.checkRevision=ud;Hi.template=fd;Hi.wrapProgram=Pn;Hi.resolvePartial=dd;Hi.invokePartial=pd;Hi.noop=fl;function od(n){return n&&n.__esModule?n:{default:n}}function ad(n){if(n&&n.__esModule)return n;var t={};if(n!=null)for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e]);return t.default=n,t}var ld=ne,wi=ad(ld),hd=je.exports,Ei=od(hd),Mi=ni,ga=on,cd=Co,ba=Ls;function ud(n){var t=n&&n[0]||1,e=Mi.COMPILER_REVISION;if(!(t>=Mi.LAST_COMPATIBLE_COMPILER_REVISION&&t<=Mi.COMPILER_REVISION))if(t<Mi.LAST_COMPATIBLE_COMPILER_REVISION){var i=Mi.REVISION_CHANGES[e],s=Mi.REVISION_CHANGES[t];throw new Ei.default("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+i+") or downgrade your runtime to an older version ("+s+").")}else throw new Ei.default("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+n[1]+").")}function fd(n,t){if(!t)throw new Ei.default("No environment passed to template");if(!n||!n.main)throw new Ei.default("Unknown template object: "+typeof n);n.main.decorator=n.main_d,t.VM.checkRevision(n.compiler);var e=n.compiler&&n.compiler[0]===7;function i(o,a,l){l.hash&&(a=wi.extend({},a,l.hash),l.ids&&(l.ids[0]=!0)),o=t.VM.resolvePartial.call(this,o,a,l);var h=wi.extend({},l,{hooks:this.hooks,protoAccessControl:this.protoAccessControl}),c=t.VM.invokePartial.call(this,o,a,h);if(c==null&&t.compile&&(l.partials[l.name]=t.compile(o,n.compilerOptions,t),c=l.partials[l.name](a,h)),c!=null){if(l.indent){for(var u=c.split(`
  30. `),f=0,d=u.length;f<d&&!(!u[f]&&f+1===d);f++)u[f]=l.indent+u[f];c=u.join(`
  31. `)}return c}else throw new Ei.default("The partial "+l.name+" could not be compiled when running in runtime-only mode")}var s={strict:function(a,l,h){if(!a||!(l in a))throw new Ei.default('"'+l+'" not defined in '+a,{loc:h});return s.lookupProperty(a,l)},lookupProperty:function(a,l){var h=a[l];if(h==null||Object.prototype.hasOwnProperty.call(a,l)||ba.resultIsAllowed(h,s.protoAccessControl,l))return h},lookup:function(a,l){for(var h=a.length,c=0;c<h;c++){var u=a[c]&&s.lookupProperty(a[c],l);if(u!=null)return a[c][l]}},lambda:function(a,l){return typeof a=="function"?a.call(l):a},escapeExpression:wi.escapeExpression,invokePartial:i,fn:function(a){var l=n[a];return l.decorator=n[a+"_d"],l},programs:[],program:function(a,l,h,c,u){var f=this.programs[a],d=this.fn(a);return l||u||c||h?f=Pn(this,a,d,l,h,c,u):f||(f=this.programs[a]=Pn(this,a,d)),f},data:function(a,l){for(;a&&l--;)a=a._parent;return a},mergeIfNeeded:function(a,l){var h=a||l;return a&&l&&a!==l&&(h=wi.extend({},l,a)),h},nullContext:Object.seal({}),noop:t.VM.noop,compilerInfo:n.compiler};function r(o){var a=arguments.length<=1||arguments[1]===void 0?{}:arguments[1],l=a.data;r._setup(a),!a.partial&&n.useData&&(l=md(o,l));var h=void 0,c=n.useBlockParams?[]:void 0;n.useDepths&&(a.depths?h=o!=a.depths[0]?[o].concat(a.depths):a.depths:h=[o]);function u(f){return""+n.main(s,f,s.helpers,s.partials,l,c,h)}return u=dl(n.main,u,s,a.depths||[],l,c),u(o,a)}return r.isTop=!0,r._setup=function(o){if(o.partial)s.protoAccessControl=o.protoAccessControl,s.helpers=o.helpers,s.partials=o.partials,s.decorators=o.decorators,s.hooks=o.hooks;else{var a=wi.extend({},t.helpers,o.helpers);gd(a,s),s.helpers=a,n.usePartial&&(s.partials=s.mergeIfNeeded(o.partials,t.partials)),(n.usePartial||n.useDecorators)&&(s.decorators=wi.extend({},t.decorators,o.decorators)),s.hooks={},s.protoAccessControl=ba.createProtoAccessControl(o);var l=o.allowCallsToHelperMissing||e;ga.moveHelperToHooks(s,"helperMissing",l),ga.moveHelperToHooks(s,"blockHelperMissing",l)}},r._child=function(o,a,l,h){if(n.useBlockParams&&!l)throw new Ei.default("must pass block params");if(n.useDepths&&!h)throw new Ei.default("must pass parent depths");return Pn(s,o,n[o],a,0,l,h)},r}function Pn(n,t,e,i,s,r,o){function a(l){var h=arguments.length<=1||arguments[1]===void 0?{}:arguments[1],c=o;return o&&l!=o[0]&&!(l===n.nullContext&&o[0]===null)&&(c=[l].concat(o)),e(n,l,n.helpers,n.partials,h.data||i,r&&[h.blockParams].concat(r),c)}return a=dl(e,a,n,o,i,r),a.program=t,a.depth=o?o.length:0,a.blockParams=s||0,a}function dd(n,t,e){return n?!n.call&&!e.name&&(e.name=n,n=e.partials[n]):e.name==="@partial-block"?n=e.data["partial-block"]:n=e.partials[e.name],n}function pd(n,t,e){var i=e.data&&e.data["partial-block"];e.partial=!0,e.ids&&(e.data.contextPath=e.ids[0]||e.data.contextPath);var s=void 0;if(e.fn&&e.fn!==fl&&function(){e.data=Mi.createFrame(e.data);var r=e.fn;s=e.data["partial-block"]=function(a){var l=arguments.length<=1||arguments[1]===void 0?{}:arguments[1];return l.data=Mi.createFrame(l.data),l.data["partial-block"]=i,r(a,l)},r.partials&&(e.partials=wi.extend({},e.partials,r.partials))}(),n===void 0&&s&&(n=s),n===void 0)throw new Ei.default("The partial "+e.name+" could not be found");if(n instanceof Function)return n(t,e)}function fl(){return""}function md(n,t){return(!t||!("root"in t))&&(t=t?Mi.createFrame(t):{},t.root=n),t}function dl(n,t,e,i,s,r){if(n.decorator){var o={};t=n.decorator(t,o,e,i&&i[0],s,r,i),wi.extend(t,o)}return t}function gd(n,t){Object.keys(n).forEach(function(e){var i=n[e];n[e]=bd(i,t)})}function bd(n,t){var e=t.lookupProperty;return cd.wrapHelper(n,function(i){return wi.extend({lookupProperty:e},i)})}var zn={exports:{}};(function(n,t){t.__esModule=!0,t.default=function(e){var i=typeof We!="undefined"?We:window,s=i.Handlebars;e.noConflict=function(){return i.Handlebars===e&&(i.Handlebars=s),e}},n.exports=t.default})(zn,zn.exports);(function(n,t){t.__esModule=!0;function e(b){return b&&b.__esModule?b:{default:b}}function i(b){if(b&&b.__esModule)return b;var y={};if(b!=null)for(var x in b)Object.prototype.hasOwnProperty.call(b,x)&&(y[x]=b[x]);return y.default=b,y}var s=ni,r=i(s),o=zr.exports,a=e(o),l=je.exports,h=e(l),c=ne,u=i(c),f=Hi,d=i(f),p=zn.exports,g=e(p);function m(){var b=new r.HandlebarsEnvironment;return u.extend(b,r),b.SafeString=a.default,b.Exception=h.default,b.Utils=u,b.escapeExpression=u.escapeExpression,b.VM=d,b.template=function(y){return d.template(y,b)},b}var S=m();S.create=m,g.default(S),S.default=S,t.default=S,n.exports=t.default})(Ar,Ar.exports);var Hn={exports:{}};(function(n,t){t.__esModule=!0;var e={helpers:{helperExpression:function(s){return s.type==="SubExpression"||(s.type==="MustacheStatement"||s.type==="BlockStatement")&&!!(s.params&&s.params.length||s.hash)},scopedId:function(s){return/^\.|this\b/.test(s.original)},simpleId:function(s){return s.parts.length===1&&!e.helpers.scopedId(s)&&!s.depth}}};t.default=e,n.exports=t.default})(Hn,Hn.exports);var an={},Hr={exports:{}};(function(n,t){t.__esModule=!0;var e=function(){var i={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,partialBlock:12,content:13,COMMENT:14,CONTENT:15,openRawBlock:16,rawBlock_repetition0:17,END_RAW_BLOCK:18,OPEN_RAW_BLOCK:19,helperName:20,openRawBlock_repetition0:21,openRawBlock_option0:22,CLOSE_RAW_BLOCK:23,openBlock:24,block_option0:25,closeBlock:26,openInverse:27,block_option1:28,OPEN_BLOCK:29,openBlock_repetition0:30,openBlock_option0:31,openBlock_option1:32,CLOSE:33,OPEN_INVERSE:34,openInverse_repetition0:35,openInverse_option0:36,openInverse_option1:37,openInverseChain:38,OPEN_INVERSE_CHAIN:39,openInverseChain_repetition0:40,openInverseChain_option0:41,openInverseChain_option1:42,inverseAndProgram:43,INVERSE:44,inverseChain:45,inverseChain_option0:46,OPEN_ENDBLOCK:47,OPEN:48,mustache_repetition0:49,mustache_option0:50,OPEN_UNESCAPED:51,mustache_repetition1:52,mustache_option1:53,CLOSE_UNESCAPED:54,OPEN_PARTIAL:55,partialName:56,partial_repetition0:57,partial_option0:58,openPartialBlock:59,OPEN_PARTIAL_BLOCK:60,openPartialBlock_repetition0:61,openPartialBlock_option0:62,param:63,sexpr:64,OPEN_SEXPR:65,sexpr_repetition0:66,sexpr_option0:67,CLOSE_SEXPR:68,hash:69,hash_repetition_plus0:70,hashSegment:71,ID:72,EQUALS:73,blockParams:74,OPEN_BLOCK_PARAMS:75,blockParams_repetition_plus0:76,CLOSE_BLOCK_PARAMS:77,path:78,dataName:79,STRING:80,NUMBER:81,BOOLEAN:82,UNDEFINED:83,NULL:84,DATA:85,pathSegments:86,SEP:87,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"COMMENT",15:"CONTENT",18:"END_RAW_BLOCK",19:"OPEN_RAW_BLOCK",23:"CLOSE_RAW_BLOCK",29:"OPEN_BLOCK",33:"CLOSE",34:"OPEN_INVERSE",39:"OPEN_INVERSE_CHAIN",44:"INVERSE",47:"OPEN_ENDBLOCK",48:"OPEN",51:"OPEN_UNESCAPED",54:"CLOSE_UNESCAPED",55:"OPEN_PARTIAL",60:"OPEN_PARTIAL_BLOCK",65:"OPEN_SEXPR",68:"CLOSE_SEXPR",72:"ID",73:"EQUALS",75:"OPEN_BLOCK_PARAMS",77:"CLOSE_BLOCK_PARAMS",80:"STRING",81:"NUMBER",82:"BOOLEAN",83:"UNDEFINED",84:"NULL",85:"DATA",87:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[13,1],[10,3],[16,5],[9,4],[9,4],[24,6],[27,6],[38,6],[43,2],[45,3],[45,1],[26,3],[8,5],[8,5],[11,5],[12,3],[59,5],[63,1],[63,1],[64,5],[69,1],[71,3],[74,3],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[20,1],[56,1],[56,1],[79,2],[78,1],[86,3],[86,1],[6,0],[6,2],[17,0],[17,2],[21,0],[21,2],[22,0],[22,1],[25,0],[25,1],[28,0],[28,1],[30,0],[30,2],[31,0],[31,1],[32,0],[32,1],[35,0],[35,2],[36,0],[36,1],[37,0],[37,1],[40,0],[40,2],[41,0],[41,1],[42,0],[42,1],[46,0],[46,1],[49,0],[49,2],[50,0],[50,1],[52,0],[52,2],[53,0],[53,1],[57,0],[57,2],[58,0],[58,1],[61,0],[61,2],[62,0],[62,1],[66,0],[66,2],[67,0],[67,1],[70,1],[70,2],[76,1],[76,2]],performAction:function(a,l,h,c,u,f,d){var p=f.length-1;switch(u){case 1:return f[p-1];case 2:this.$=c.prepareProgram(f[p]);break;case 3:this.$=f[p];break;case 4:this.$=f[p];break;case 5:this.$=f[p];break;case 6:this.$=f[p];break;case 7:this.$=f[p];break;case 8:this.$=f[p];break;case 9:this.$={type:"CommentStatement",value:c.stripComment(f[p]),strip:c.stripFlags(f[p],f[p]),loc:c.locInfo(this._$)};break;case 10:this.$={type:"ContentStatement",original:f[p],value:f[p],loc:c.locInfo(this._$)};break;case 11:this.$=c.prepareRawBlock(f[p-2],f[p-1],f[p],this._$);break;case 12:this.$={path:f[p-3],params:f[p-2],hash:f[p-1]};break;case 13:this.$=c.prepareBlock(f[p-3],f[p-2],f[p-1],f[p],!1,this._$);break;case 14:this.$=c.prepareBlock(f[p-3],f[p-2],f[p-1],f[p],!0,this._$);break;case 15:this.$={open:f[p-5],path:f[p-4],params:f[p-3],hash:f[p-2],blockParams:f[p-1],strip:c.stripFlags(f[p-5],f[p])};break;case 16:this.$={path:f[p-4],params:f[p-3],hash:f[p-2],blockParams:f[p-1],strip:c.stripFlags(f[p-5],f[p])};break;case 17:this.$={path:f[p-4],params:f[p-3],hash:f[p-2],blockParams:f[p-1],strip:c.stripFlags(f[p-5],f[p])};break;case 18:this.$={strip:c.stripFlags(f[p-1],f[p-1]),program:f[p]};break;case 19:var g=c.prepareBlock(f[p-2],f[p-1],f[p],f[p],!1,this._$),m=c.prepareProgram([g],f[p-1].loc);m.chained=!0,this.$={strip:f[p-2].strip,program:m,chain:!0};break;case 20:this.$=f[p];break;case 21:this.$={path:f[p-1],strip:c.stripFlags(f[p-2],f[p])};break;case 22:this.$=c.prepareMustache(f[p-3],f[p-2],f[p-1],f[p-4],c.stripFlags(f[p-4],f[p]),this._$);break;case 23:this.$=c.prepareMustache(f[p-3],f[p-2],f[p-1],f[p-4],c.stripFlags(f[p-4],f[p]),this._$);break;case 24:this.$={type:"PartialStatement",name:f[p-3],params:f[p-2],hash:f[p-1],indent:"",strip:c.stripFlags(f[p-4],f[p]),loc:c.locInfo(this._$)};break;case 25:this.$=c.preparePartialBlock(f[p-2],f[p-1],f[p],this._$);break;case 26:this.$={path:f[p-3],params:f[p-2],hash:f[p-1],strip:c.stripFlags(f[p-4],f[p])};break;case 27:this.$=f[p];break;case 28:this.$=f[p];break;case 29:this.$={type:"SubExpression",path:f[p-3],params:f[p-2],hash:f[p-1],loc:c.locInfo(this._$)};break;case 30:this.$={type:"Hash",pairs:f[p],loc:c.locInfo(this._$)};break;case 31:this.$={type:"HashPair",key:c.id(f[p-2]),value:f[p],loc:c.locInfo(this._$)};break;case 32:this.$=c.id(f[p-1]);break;case 33:this.$=f[p];break;case 34:this.$=f[p];break;case 35:this.$={type:"StringLiteral",value:f[p],original:f[p],loc:c.locInfo(this._$)};break;case 36:this.$={type:"NumberLiteral",value:Number(f[p]),original:Number(f[p]),loc:c.locInfo(this._$)};break;case 37:this.$={type:"BooleanLiteral",value:f[p]==="true",original:f[p]==="true",loc:c.locInfo(this._$)};break;case 38:this.$={type:"UndefinedLiteral",original:void 0,value:void 0,loc:c.locInfo(this._$)};break;case 39:this.$={type:"NullLiteral",original:null,value:null,loc:c.locInfo(this._$)};break;case 40:this.$=f[p];break;case 41:this.$=f[p];break;case 42:this.$=c.preparePath(!0,f[p],this._$);break;case 43:this.$=c.preparePath(!1,f[p],this._$);break;case 44:f[p-2].push({part:c.id(f[p]),original:f[p],separator:f[p-1]}),this.$=f[p-2];break;case 45:this.$=[{part:c.id(f[p]),original:f[p]}];break;case 46:this.$=[];break;case 47:f[p-1].push(f[p]);break;case 48:this.$=[];break;case 49:f[p-1].push(f[p]);break;case 50:this.$=[];break;case 51:f[p-1].push(f[p]);break;case 58:this.$=[];break;case 59:f[p-1].push(f[p]);break;case 64:this.$=[];break;case 65:f[p-1].push(f[p]);break;case 70:this.$=[];break;case 71:f[p-1].push(f[p]);break;case 78:this.$=[];break;case 79:f[p-1].push(f[p]);break;case 82:this.$=[];break;case 83:f[p-1].push(f[p]);break;case 86:this.$=[];break;case 87:f[p-1].push(f[p]);break;case 90:this.$=[];break;case 91:f[p-1].push(f[p]);break;case 94:this.$=[];break;case 95:f[p-1].push(f[p]);break;case 98:this.$=[f[p]];break;case 99:f[p-1].push(f[p]);break;case 100:this.$=[f[p]];break;case 101:f[p-1].push(f[p]);break}},table:[{3:1,4:2,5:[2,46],6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:11,14:[1,12],15:[1,20],16:17,19:[1,23],24:15,27:16,29:[1,21],34:[1,22],39:[2,2],44:[2,2],47:[2,2],48:[1,13],51:[1,14],55:[1,18],59:19,60:[1,24]},{1:[2,1]},{5:[2,47],14:[2,47],15:[2,47],19:[2,47],29:[2,47],34:[2,47],39:[2,47],44:[2,47],47:[2,47],48:[2,47],51:[2,47],55:[2,47],60:[2,47]},{5:[2,3],14:[2,3],15:[2,3],19:[2,3],29:[2,3],34:[2,3],39:[2,3],44:[2,3],47:[2,3],48:[2,3],51:[2,3],55:[2,3],60:[2,3]},{5:[2,4],14:[2,4],15:[2,4],19:[2,4],29:[2,4],34:[2,4],39:[2,4],44:[2,4],47:[2,4],48:[2,4],51:[2,4],55:[2,4],60:[2,4]},{5:[2,5],14:[2,5],15:[2,5],19:[2,5],29:[2,5],34:[2,5],39:[2,5],44:[2,5],47:[2,5],48:[2,5],51:[2,5],55:[2,5],60:[2,5]},{5:[2,6],14:[2,6],15:[2,6],19:[2,6],29:[2,6],34:[2,6],39:[2,6],44:[2,6],47:[2,6],48:[2,6],51:[2,6],55:[2,6],60:[2,6]},{5:[2,7],14:[2,7],15:[2,7],19:[2,7],29:[2,7],34:[2,7],39:[2,7],44:[2,7],47:[2,7],48:[2,7],51:[2,7],55:[2,7],60:[2,7]},{5:[2,8],14:[2,8],15:[2,8],19:[2,8],29:[2,8],34:[2,8],39:[2,8],44:[2,8],47:[2,8],48:[2,8],51:[2,8],55:[2,8],60:[2,8]},{5:[2,9],14:[2,9],15:[2,9],19:[2,9],29:[2,9],34:[2,9],39:[2,9],44:[2,9],47:[2,9],48:[2,9],51:[2,9],55:[2,9],60:[2,9]},{20:25,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:36,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:37,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{4:38,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{15:[2,48],17:39,18:[2,48]},{20:41,56:40,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:44,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{5:[2,10],14:[2,10],15:[2,10],18:[2,10],19:[2,10],29:[2,10],34:[2,10],39:[2,10],44:[2,10],47:[2,10],48:[2,10],51:[2,10],55:[2,10],60:[2,10]},{20:45,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:46,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:47,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:41,56:48,64:42,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[2,78],49:49,65:[2,78],72:[2,78],80:[2,78],81:[2,78],82:[2,78],83:[2,78],84:[2,78],85:[2,78]},{23:[2,33],33:[2,33],54:[2,33],65:[2,33],68:[2,33],72:[2,33],75:[2,33],80:[2,33],81:[2,33],82:[2,33],83:[2,33],84:[2,33],85:[2,33]},{23:[2,34],33:[2,34],54:[2,34],65:[2,34],68:[2,34],72:[2,34],75:[2,34],80:[2,34],81:[2,34],82:[2,34],83:[2,34],84:[2,34],85:[2,34]},{23:[2,35],33:[2,35],54:[2,35],65:[2,35],68:[2,35],72:[2,35],75:[2,35],80:[2,35],81:[2,35],82:[2,35],83:[2,35],84:[2,35],85:[2,35]},{23:[2,36],33:[2,36],54:[2,36],65:[2,36],68:[2,36],72:[2,36],75:[2,36],80:[2,36],81:[2,36],82:[2,36],83:[2,36],84:[2,36],85:[2,36]},{23:[2,37],33:[2,37],54:[2,37],65:[2,37],68:[2,37],72:[2,37],75:[2,37],80:[2,37],81:[2,37],82:[2,37],83:[2,37],84:[2,37],85:[2,37]},{23:[2,38],33:[2,38],54:[2,38],65:[2,38],68:[2,38],72:[2,38],75:[2,38],80:[2,38],81:[2,38],82:[2,38],83:[2,38],84:[2,38],85:[2,38]},{23:[2,39],33:[2,39],54:[2,39],65:[2,39],68:[2,39],72:[2,39],75:[2,39],80:[2,39],81:[2,39],82:[2,39],83:[2,39],84:[2,39],85:[2,39]},{23:[2,43],33:[2,43],54:[2,43],65:[2,43],68:[2,43],72:[2,43],75:[2,43],80:[2,43],81:[2,43],82:[2,43],83:[2,43],84:[2,43],85:[2,43],87:[1,50]},{72:[1,35],86:51},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{52:52,54:[2,82],65:[2,82],72:[2,82],80:[2,82],81:[2,82],82:[2,82],83:[2,82],84:[2,82],85:[2,82]},{25:53,38:55,39:[1,57],43:56,44:[1,58],45:54,47:[2,54]},{28:59,43:60,44:[1,58],47:[2,56]},{13:62,15:[1,20],18:[1,61]},{33:[2,86],57:63,65:[2,86],72:[2,86],80:[2,86],81:[2,86],82:[2,86],83:[2,86],84:[2,86],85:[2,86]},{33:[2,40],65:[2,40],72:[2,40],80:[2,40],81:[2,40],82:[2,40],83:[2,40],84:[2,40],85:[2,40]},{33:[2,41],65:[2,41],72:[2,41],80:[2,41],81:[2,41],82:[2,41],83:[2,41],84:[2,41],85:[2,41]},{20:64,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:65,47:[1,66]},{30:67,33:[2,58],65:[2,58],72:[2,58],75:[2,58],80:[2,58],81:[2,58],82:[2,58],83:[2,58],84:[2,58],85:[2,58]},{33:[2,64],35:68,65:[2,64],72:[2,64],75:[2,64],80:[2,64],81:[2,64],82:[2,64],83:[2,64],84:[2,64],85:[2,64]},{21:69,23:[2,50],65:[2,50],72:[2,50],80:[2,50],81:[2,50],82:[2,50],83:[2,50],84:[2,50],85:[2,50]},{33:[2,90],61:70,65:[2,90],72:[2,90],80:[2,90],81:[2,90],82:[2,90],83:[2,90],84:[2,90],85:[2,90]},{20:74,33:[2,80],50:71,63:72,64:75,65:[1,43],69:73,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{72:[1,79]},{23:[2,42],33:[2,42],54:[2,42],65:[2,42],68:[2,42],72:[2,42],75:[2,42],80:[2,42],81:[2,42],82:[2,42],83:[2,42],84:[2,42],85:[2,42],87:[1,50]},{20:74,53:80,54:[2,84],63:81,64:75,65:[1,43],69:82,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{26:83,47:[1,66]},{47:[2,55]},{4:84,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],39:[2,46],44:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{47:[2,20]},{20:85,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{4:86,6:3,14:[2,46],15:[2,46],19:[2,46],29:[2,46],34:[2,46],47:[2,46],48:[2,46],51:[2,46],55:[2,46],60:[2,46]},{26:87,47:[1,66]},{47:[2,57]},{5:[2,11],14:[2,11],15:[2,11],19:[2,11],29:[2,11],34:[2,11],39:[2,11],44:[2,11],47:[2,11],48:[2,11],51:[2,11],55:[2,11],60:[2,11]},{15:[2,49],18:[2,49]},{20:74,33:[2,88],58:88,63:89,64:75,65:[1,43],69:90,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{65:[2,94],66:91,68:[2,94],72:[2,94],80:[2,94],81:[2,94],82:[2,94],83:[2,94],84:[2,94],85:[2,94]},{5:[2,25],14:[2,25],15:[2,25],19:[2,25],29:[2,25],34:[2,25],39:[2,25],44:[2,25],47:[2,25],48:[2,25],51:[2,25],55:[2,25],60:[2,25]},{20:92,72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,31:93,33:[2,60],63:94,64:75,65:[1,43],69:95,70:76,71:77,72:[1,78],75:[2,60],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,66],36:96,63:97,64:75,65:[1,43],69:98,70:76,71:77,72:[1,78],75:[2,66],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,22:99,23:[2,52],63:100,64:75,65:[1,43],69:101,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{20:74,33:[2,92],62:102,63:103,64:75,65:[1,43],69:104,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,105]},{33:[2,79],65:[2,79],72:[2,79],80:[2,79],81:[2,79],82:[2,79],83:[2,79],84:[2,79],85:[2,79]},{33:[2,81]},{23:[2,27],33:[2,27],54:[2,27],65:[2,27],68:[2,27],72:[2,27],75:[2,27],80:[2,27],81:[2,27],82:[2,27],83:[2,27],84:[2,27],85:[2,27]},{23:[2,28],33:[2,28],54:[2,28],65:[2,28],68:[2,28],72:[2,28],75:[2,28],80:[2,28],81:[2,28],82:[2,28],83:[2,28],84:[2,28],85:[2,28]},{23:[2,30],33:[2,30],54:[2,30],68:[2,30],71:106,72:[1,107],75:[2,30]},{23:[2,98],33:[2,98],54:[2,98],68:[2,98],72:[2,98],75:[2,98]},{23:[2,45],33:[2,45],54:[2,45],65:[2,45],68:[2,45],72:[2,45],73:[1,108],75:[2,45],80:[2,45],81:[2,45],82:[2,45],83:[2,45],84:[2,45],85:[2,45],87:[2,45]},{23:[2,44],33:[2,44],54:[2,44],65:[2,44],68:[2,44],72:[2,44],75:[2,44],80:[2,44],81:[2,44],82:[2,44],83:[2,44],84:[2,44],85:[2,44],87:[2,44]},{54:[1,109]},{54:[2,83],65:[2,83],72:[2,83],80:[2,83],81:[2,83],82:[2,83],83:[2,83],84:[2,83],85:[2,83]},{54:[2,85]},{5:[2,13],14:[2,13],15:[2,13],19:[2,13],29:[2,13],34:[2,13],39:[2,13],44:[2,13],47:[2,13],48:[2,13],51:[2,13],55:[2,13],60:[2,13]},{38:55,39:[1,57],43:56,44:[1,58],45:111,46:110,47:[2,76]},{33:[2,70],40:112,65:[2,70],72:[2,70],75:[2,70],80:[2,70],81:[2,70],82:[2,70],83:[2,70],84:[2,70],85:[2,70]},{47:[2,18]},{5:[2,14],14:[2,14],15:[2,14],19:[2,14],29:[2,14],34:[2,14],39:[2,14],44:[2,14],47:[2,14],48:[2,14],51:[2,14],55:[2,14],60:[2,14]},{33:[1,113]},{33:[2,87],65:[2,87],72:[2,87],80:[2,87],81:[2,87],82:[2,87],83:[2,87],84:[2,87],85:[2,87]},{33:[2,89]},{20:74,63:115,64:75,65:[1,43],67:114,68:[2,96],69:116,70:76,71:77,72:[1,78],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{33:[1,117]},{32:118,33:[2,62],74:119,75:[1,120]},{33:[2,59],65:[2,59],72:[2,59],75:[2,59],80:[2,59],81:[2,59],82:[2,59],83:[2,59],84:[2,59],85:[2,59]},{33:[2,61],75:[2,61]},{33:[2,68],37:121,74:122,75:[1,120]},{33:[2,65],65:[2,65],72:[2,65],75:[2,65],80:[2,65],81:[2,65],82:[2,65],83:[2,65],84:[2,65],85:[2,65]},{33:[2,67],75:[2,67]},{23:[1,123]},{23:[2,51],65:[2,51],72:[2,51],80:[2,51],81:[2,51],82:[2,51],83:[2,51],84:[2,51],85:[2,51]},{23:[2,53]},{33:[1,124]},{33:[2,91],65:[2,91],72:[2,91],80:[2,91],81:[2,91],82:[2,91],83:[2,91],84:[2,91],85:[2,91]},{33:[2,93]},{5:[2,22],14:[2,22],15:[2,22],19:[2,22],29:[2,22],34:[2,22],39:[2,22],44:[2,22],47:[2,22],48:[2,22],51:[2,22],55:[2,22],60:[2,22]},{23:[2,99],33:[2,99],54:[2,99],68:[2,99],72:[2,99],75:[2,99]},{73:[1,108]},{20:74,63:125,64:75,65:[1,43],72:[1,35],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,23],14:[2,23],15:[2,23],19:[2,23],29:[2,23],34:[2,23],39:[2,23],44:[2,23],47:[2,23],48:[2,23],51:[2,23],55:[2,23],60:[2,23]},{47:[2,19]},{47:[2,77]},{20:74,33:[2,72],41:126,63:127,64:75,65:[1,43],69:128,70:76,71:77,72:[1,78],75:[2,72],78:26,79:27,80:[1,28],81:[1,29],82:[1,30],83:[1,31],84:[1,32],85:[1,34],86:33},{5:[2,24],14:[2,24],15:[2,24],19:[2,24],29:[2,24],34:[2,24],39:[2,24],44:[2,24],47:[2,24],48:[2,24],51:[2,24],55:[2,24],60:[2,24]},{68:[1,129]},{65:[2,95],68:[2,95],72:[2,95],80:[2,95],81:[2,95],82:[2,95],83:[2,95],84:[2,95],85:[2,95]},{68:[2,97]},{5:[2,21],14:[2,21],15:[2,21],19:[2,21],29:[2,21],34:[2,21],39:[2,21],44:[2,21],47:[2,21],48:[2,21],51:[2,21],55:[2,21],60:[2,21]},{33:[1,130]},{33:[2,63]},{72:[1,132],76:131},{33:[1,133]},{33:[2,69]},{15:[2,12],18:[2,12]},{14:[2,26],15:[2,26],19:[2,26],29:[2,26],34:[2,26],47:[2,26],48:[2,26],51:[2,26],55:[2,26],60:[2,26]},{23:[2,31],33:[2,31],54:[2,31],68:[2,31],72:[2,31],75:[2,31]},{33:[2,74],42:134,74:135,75:[1,120]},{33:[2,71],65:[2,71],72:[2,71],75:[2,71],80:[2,71],81:[2,71],82:[2,71],83:[2,71],84:[2,71],85:[2,71]},{33:[2,73],75:[2,73]},{23:[2,29],33:[2,29],54:[2,29],65:[2,29],68:[2,29],72:[2,29],75:[2,29],80:[2,29],81:[2,29],82:[2,29],83:[2,29],84:[2,29],85:[2,29]},{14:[2,15],15:[2,15],19:[2,15],29:[2,15],34:[2,15],39:[2,15],44:[2,15],47:[2,15],48:[2,15],51:[2,15],55:[2,15],60:[2,15]},{72:[1,137],77:[1,136]},{72:[2,100],77:[2,100]},{14:[2,16],15:[2,16],19:[2,16],29:[2,16],34:[2,16],44:[2,16],47:[2,16],48:[2,16],51:[2,16],55:[2,16],60:[2,16]},{33:[1,138]},{33:[2,75]},{33:[2,32]},{72:[2,101],77:[2,101]},{14:[2,17],15:[2,17],19:[2,17],29:[2,17],34:[2,17],39:[2,17],44:[2,17],47:[2,17],48:[2,17],51:[2,17],55:[2,17],60:[2,17]}],defaultActions:{4:[2,1],54:[2,55],56:[2,20],60:[2,57],73:[2,81],82:[2,85],86:[2,18],90:[2,89],101:[2,53],104:[2,93],110:[2,19],111:[2,77],116:[2,97],119:[2,63],122:[2,69],135:[2,75],136:[2,32]},parseError:function(a,l){throw new Error(a)},parse:function(a){var l=this,h=[0],c=[null],u=[],f=this.table,d="",p=0,g=0;this.lexer.setInput(a),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,typeof this.lexer.yylloc=="undefined"&&(this.lexer.yylloc={});var m=this.lexer.yylloc;u.push(m);var S=this.lexer.options&&this.lexer.options.ranges;typeof this.yy.parseError=="function"&&(this.parseError=this.yy.parseError);function b(){var k;return k=l.lexer.lex()||1,typeof k!="number"&&(k=l.symbols_[k]||k),k}for(var y,x,w,T,E={},C,P,I,F;;){if(x=h[h.length-1],this.defaultActions[x]?w=this.defaultActions[x]:((y===null||typeof y=="undefined")&&(y=b()),w=f[x]&&f[x][y]),typeof w=="undefined"||!w.length||!w[0]){var L="";{F=[];for(C in f[x])this.terminals_[C]&&C>2&&F.push("'"+this.terminals_[C]+"'");this.lexer.showPosition?L="Parse error on line "+(p+1)+`:
  32. `+this.lexer.showPosition()+`
  33. Expecting `+F.join(", ")+", got '"+(this.terminals_[y]||y)+"'":L="Parse error on line "+(p+1)+": Unexpected "+(y==1?"end of input":"'"+(this.terminals_[y]||y)+"'"),this.parseError(L,{text:this.lexer.match,token:this.terminals_[y]||y,line:this.lexer.yylineno,loc:m,expected:F})}}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+x+", token: "+y);switch(w[0]){case 1:h.push(y),c.push(this.lexer.yytext),u.push(this.lexer.yylloc),h.push(w[1]),y=null,g=this.lexer.yyleng,d=this.lexer.yytext,p=this.lexer.yylineno,m=this.lexer.yylloc;break;case 2:if(P=this.productions_[w[1]][1],E.$=c[c.length-P],E._$={first_line:u[u.length-(P||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(P||1)].first_column,last_column:u[u.length-1].last_column},S&&(E._$.range=[u[u.length-(P||1)].range[0],u[u.length-1].range[1]]),T=this.performAction.call(E,d,g,p,this.yy,w[1],c,u),typeof T!="undefined")return T;P&&(h=h.slice(0,-1*P*2),c=c.slice(0,-1*P),u=u.slice(0,-1*P)),h.push(this.productions_[w[1]][0]),c.push(E.$),u.push(E._$),I=f[h[h.length-2]][h[h.length-1]],h.push(I);break;case 3:return!0}}return!0}},s=function(){var o={EOF:1,parseError:function(l,h){if(this.yy.parser)this.yy.parser.parseError(l,h);else throw new Error(l)},setInput:function(l){return this._input=l,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var l=this._input[0];this.yytext+=l,this.yyleng++,this.offset++,this.match+=l,this.matched+=l;var h=l.match(/(?:\r\n?|\n).*/g);return h?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),l},unput:function(l){var h=l.length,c=l.split(/(?:\r\n?|\n)/g);this._input=l+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-h-1),this.offset-=h;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var f=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===u.length?this.yylloc.first_column:0)+u[u.length-c.length].length-c[0].length:this.yylloc.first_column-h},this.options.ranges&&(this.yylloc.range=[f[0],f[0]+this.yyleng-h]),this},more:function(){return this._more=!0,this},less:function(l){this.unput(this.match.slice(l))},pastInput:function(){var l=this.matched.substr(0,this.matched.length-this.match.length);return(l.length>20?"...":"")+l.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var l=this.match;return l.length<20&&(l+=this._input.substr(0,20-l.length)),(l.substr(0,20)+(l.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var l=this.pastInput(),h=new Array(l.length+1).join("-");return l+this.upcomingInput()+`
  34. `+h+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var l,h,c,u,f;this._more||(this.yytext="",this.match="");for(var d=this._currentRules(),p=0;p<d.length&&(c=this._input.match(this.rules[d[p]]),!(c&&(!h||c[0].length>h[0].length)&&(h=c,u=p,!this.options.flex)));p++);return h?(f=h[0].match(/(?:\r\n?|\n).*/g),f&&(this.yylineno+=f.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:f?f[f.length-1].length-f[f.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+h[0].length},this.yytext+=h[0],this.match+=h[0],this.matches=h,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(h[0].length),this.matched+=h[0],l=this.performAction.call(this,this.yy,this,d[u],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),l||void 0):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
  35. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var l=this.next();return typeof l!="undefined"?l:this.lex()},begin:function(l){this.conditionStack.push(l)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(l){this.begin(l)}};return o.options={},o.performAction=function(l,h,c,u){function f(d,p){return h.yytext=h.yytext.substring(d,h.yyleng-p+d)}switch(c){case 0:if(h.yytext.slice(-2)==="\\\\"?(f(0,1),this.begin("mu")):h.yytext.slice(-1)==="\\"?(f(0,1),this.begin("emu")):this.begin("mu"),h.yytext)return 15;break;case 1:return 15;case 2:return this.popState(),15;case 3:return this.begin("raw"),15;case 4:return this.popState(),this.conditionStack[this.conditionStack.length-1]==="raw"?15:(f(5,9),"END_RAW_BLOCK");case 5:return 15;case 6:return this.popState(),14;case 7:return 65;case 8:return 68;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;case 11:return 55;case 12:return 60;case 13:return 29;case 14:return 47;case 15:return this.popState(),44;case 16:return this.popState(),44;case 17:return 34;case 18:return 39;case 19:return 51;case 20:return 48;case 21:this.unput(h.yytext),this.popState(),this.begin("com");break;case 22:return this.popState(),14;case 23:return 48;case 24:return 73;case 25:return 72;case 26:return 72;case 27:return 87;case 28:break;case 29:return this.popState(),54;case 30:return this.popState(),33;case 31:return h.yytext=f(1,2).replace(/\\"/g,'"'),80;case 32:return h.yytext=f(1,2).replace(/\\'/g,"'"),80;case 33:return 85;case 34:return 82;case 35:return 82;case 36:return 83;case 37:return 84;case 38:return 81;case 39:return 75;case 40:return 77;case 41:return 72;case 42:return h.yytext=h.yytext.replace(/\\([\\\]])/g,"$1"),72;case 43:return"INVALID";case 44:return 5}},o.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^\/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],o.conditions={mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}},o}();i.lexer=s;function r(){this.yy={}}return r.prototype=i,i.Parser=r,new r}();t.default=e,n.exports=t.default})(Hr,Hr.exports);var Xr={exports:{}},Xn={exports:{}};(function(n,t){t.__esModule=!0;function e(h){return h&&h.__esModule?h:{default:h}}var i=je.exports,s=e(i);function r(){this.parents=[]}r.prototype={constructor:r,mutating:!1,acceptKey:function(c,u){var f=this.accept(c[u]);if(this.mutating){if(f&&!r.prototype[f.type])throw new s.default('Unexpected node type "'+f.type+'" found when accepting '+u+" on "+c.type);c[u]=f}},acceptRequired:function(c,u){if(this.acceptKey(c,u),!c[u])throw new s.default(c.type+" requires "+u)},acceptArray:function(c){for(var u=0,f=c.length;u<f;u++)this.acceptKey(c,u),c[u]||(c.splice(u,1),u--,f--)},accept:function(c){if(!!c){if(!this[c.type])throw new s.default("Unknown type: "+c.type,c);this.current&&this.parents.unshift(this.current),this.current=c;var u=this[c.type](c);if(this.current=this.parents.shift(),!this.mutating||u)return u;if(u!==!1)return c}},Program:function(c){this.acceptArray(c.body)},MustacheStatement:o,Decorator:o,BlockStatement:a,DecoratorBlock:a,PartialStatement:l,PartialBlockStatement:function(c){l.call(this,c),this.acceptKey(c,"program")},ContentStatement:function(){},CommentStatement:function(){},SubExpression:o,PathExpression:function(){},StringLiteral:function(){},NumberLiteral:function(){},BooleanLiteral:function(){},UndefinedLiteral:function(){},NullLiteral:function(){},Hash:function(c){this.acceptArray(c.pairs)},HashPair:function(c){this.acceptRequired(c,"value")}};function o(h){this.acceptRequired(h,"path"),this.acceptArray(h.params),this.acceptKey(h,"hash")}function a(h){o.call(this,h),this.acceptKey(h,"program"),this.acceptKey(h,"inverse")}function l(h){this.acceptRequired(h,"name"),this.acceptArray(h.params),this.acceptKey(h,"hash")}t.default=r,n.exports=t.default})(Xn,Xn.exports);(function(n,t){t.__esModule=!0;function e(c){return c&&c.__esModule?c:{default:c}}var i=Xn.exports,s=e(i);function r(){var c=arguments.length<=0||arguments[0]===void 0?{}:arguments[0];this.options=c}r.prototype=new s.default,r.prototype.Program=function(c){var u=!this.options.ignoreStandalone,f=!this.isRootSeen;this.isRootSeen=!0;for(var d=c.body,p=0,g=d.length;p<g;p++){var m=d[p],S=this.accept(m);if(!!S){var b=o(d,p,f),y=a(d,p,f),x=S.openStandalone&&b,w=S.closeStandalone&&y,T=S.inlineStandalone&&b&&y;S.close&&l(d,p,!0),S.open&&h(d,p,!0),u&&T&&(l(d,p),h(d,p)&&m.type==="PartialStatement"&&(m.indent=/([ \t]+$)/.exec(d[p-1].original)[1])),u&&x&&(l((m.program||m.inverse).body),h(d,p)),u&&w&&(l(d,p),h((m.inverse||m.program).body))}}return c},r.prototype.BlockStatement=r.prototype.DecoratorBlock=r.prototype.PartialBlockStatement=function(c){this.accept(c.program),this.accept(c.inverse);var u=c.program||c.inverse,f=c.program&&c.inverse,d=f,p=f;if(f&&f.chained)for(d=f.body[0].program;p.chained;)p=p.body[p.body.length-1].program;var g={open:c.openStrip.open,close:c.closeStrip.close,openStandalone:a(u.body),closeStandalone:o((d||u).body)};if(c.openStrip.close&&l(u.body,null,!0),f){var m=c.inverseStrip;m.open&&h(u.body,null,!0),m.close&&l(d.body,null,!0),c.closeStrip.open&&h(p.body,null,!0),!this.options.ignoreStandalone&&o(u.body)&&a(d.body)&&(h(u.body),l(d.body))}else c.closeStrip.open&&h(u.body,null,!0);return g},r.prototype.Decorator=r.prototype.MustacheStatement=function(c){return c.strip},r.prototype.PartialStatement=r.prototype.CommentStatement=function(c){var u=c.strip||{};return{inlineStandalone:!0,open:u.open,close:u.close}};function o(c,u,f){u===void 0&&(u=c.length);var d=c[u-1],p=c[u-2];if(!d)return f;if(d.type==="ContentStatement")return(p||!f?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(d.original)}function a(c,u,f){u===void 0&&(u=-1);var d=c[u+1],p=c[u+2];if(!d)return f;if(d.type==="ContentStatement")return(p||!f?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(d.original)}function l(c,u,f){var d=c[u==null?0:u+1];if(!(!d||d.type!=="ContentStatement"||!f&&d.rightStripped)){var p=d.value;d.value=d.value.replace(f?/^\s+/:/^[ \t]*\r?\n?/,""),d.rightStripped=d.value!==p}}function h(c,u,f){var d=c[u==null?c.length-1:u-1];if(!(!d||d.type!=="ContentStatement"||!f&&d.leftStripped)){var p=d.value;return d.value=d.value.replace(f?/\s+$/:/[ \t]+$/,""),d.leftStripped=d.value!==p,d.leftStripped}}t.default=r,n.exports=t.default})(Xr,Xr.exports);var ri={};ri.__esModule=!0;ri.SourceLocation=xd;ri.id=vd;ri.stripFlags=_d;ri.stripComment=wd;ri.preparePath=Ed;ri.prepareMustache=Md;ri.prepareRawBlock=Pd;ri.prepareBlock=Ld;ri.prepareProgram=Td;ri.preparePartialBlock=Cd;function Sd(n){return n&&n.__esModule?n:{default:n}}var yd=je.exports,Ro=Sd(yd);function No(n,t){if(t=t.path?t.path.original:t,n.path.original!==t){var e={loc:n.path.loc};throw new Ro.default(n.path.original+" doesn't match "+t,e)}}function xd(n,t){this.source=n,this.start={line:t.first_line,column:t.first_column},this.end={line:t.last_line,column:t.last_column}}function vd(n){return/^\[.*\]$/.test(n)?n.substring(1,n.length-1):n}function _d(n,t){return{open:n.charAt(2)==="~",close:t.charAt(t.length-3)==="~"}}function wd(n){return n.replace(/^\{\{~?!-?-?/,"").replace(/-?-?~?\}\}$/,"")}function Ed(n,t,e){e=this.locInfo(e);for(var i=n?"@":"",s=[],r=0,o=0,a=t.length;o<a;o++){var l=t[o].part,h=t[o].original!==l;if(i+=(t[o].separator||"")+l,!h&&(l===".."||l==="."||l==="this")){if(s.length>0)throw new Ro.default("Invalid path: "+i,{loc:e});l===".."&&r++}else s.push(l)}return{type:"PathExpression",data:n,depth:r,parts:s,original:i,loc:e}}function Md(n,t,e,i,s,r){var o=i.charAt(3)||i.charAt(2),a=o!=="{"&&o!=="&",l=/\*/.test(i);return{type:l?"Decorator":"MustacheStatement",path:n,params:t,hash:e,escaped:a,strip:s,loc:this.locInfo(r)}}function Pd(n,t,e,i){No(n,e),i=this.locInfo(i);var s={type:"Program",body:t,strip:{},loc:i};return{type:"BlockStatement",path:n.path,params:n.params,hash:n.hash,program:s,openStrip:{},inverseStrip:{},closeStrip:{},loc:i}}function Ld(n,t,e,i,s,r){i&&i.path&&No(n,i);var o=/\*/.test(n.open);t.blockParams=n.blockParams;var a=void 0,l=void 0;if(e){if(o)throw new Ro.default("Unexpected inverse block on decorator",e);e.chain&&(e.program.body[0].closeStrip=i.strip),l=e.strip,a=e.program}return s&&(s=a,a=t,t=s),{type:o?"DecoratorBlock":"BlockStatement",path:n.path,params:n.params,hash:n.hash,program:t,inverse:a,openStrip:n.strip,inverseStrip:l,closeStrip:i&&i.strip,loc:this.locInfo(r)}}function Td(n,t){if(!t&&n.length){var e=n[0].loc,i=n[n.length-1].loc;e&&i&&(t={source:e.source,start:{line:e.start.line,column:e.start.column},end:{line:i.end.line,column:i.end.column}})}return{type:"Program",body:n,strip:{},loc:t}}function Cd(n,t,e,i){return No(n,e),{type:"PartialBlockStatement",name:n.path,params:n.params,hash:n.hash,program:t,openStrip:n.strip,closeStrip:e&&e.strip,loc:this.locInfo(i)}}an.__esModule=!0;an.parseWithoutProcessing=ml;an.parse=Fd;function Rd(n){if(n&&n.__esModule)return n;var t={};if(n!=null)for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e]);return t.default=n,t}function pl(n){return n&&n.__esModule?n:{default:n}}var Nd=Hr.exports,Yr=pl(Nd),Ad=Xr.exports,Id=pl(Ad),kd=ri,Bd=Rd(kd),Dd=ne;an.parser=Yr.default;var Ln={};Dd.extend(Ln,Bd);function ml(n,t){if(n.type==="Program")return n;Yr.default.yy=Ln,Ln.locInfo=function(i){return new Ln.SourceLocation(t&&t.srcName,i)};var e=Yr.default.parse(n);return e}function Fd(n,t){var e=ml(n,t),i=new Id.default(t);return i.accept(e)}var ln={};ln.__esModule=!0;ln.Compiler=jr;ln.precompile=Wd;ln.compile=Ud;function gl(n){return n&&n.__esModule?n:{default:n}}var Od=je.exports,Xs=gl(Od),Js=ne,Vd=Hn.exports,Ds=gl(Vd),Gd=[].slice;function jr(){}jr.prototype={compiler:jr,equals:function(t){var e=this.opcodes.length;if(t.opcodes.length!==e)return!1;for(var i=0;i<e;i++){var s=this.opcodes[i],r=t.opcodes[i];if(s.opcode!==r.opcode||!bl(s.args,r.args))return!1}e=this.children.length;for(var i=0;i<e;i++)if(!this.children[i].equals(t.children[i]))return!1;return!0},guid:0,compile:function(t,e){return this.sourceNode=[],this.opcodes=[],this.children=[],this.options=e,this.stringParams=e.stringParams,this.trackIds=e.trackIds,e.blockParams=e.blockParams||[],e.knownHelpers=Js.extend(Object.create(null),{helperMissing:!0,blockHelperMissing:!0,each:!0,if:!0,unless:!0,with:!0,log:!0,lookup:!0},e.knownHelpers),this.accept(t)},compileProgram:function(t){var e=new this.compiler,i=e.compile(t,this.options),s=this.guid++;return this.usePartial=this.usePartial||i.usePartial,this.children[s]=i,this.useDepths=this.useDepths||i.useDepths,s},accept:function(t){if(!this[t.type])throw new Xs.default("Unknown type: "+t.type,t);this.sourceNode.unshift(t);var e=this[t.type](t);return this.sourceNode.shift(),e},Program:function(t){this.options.blockParams.unshift(t.blockParams);for(var e=t.body,i=e.length,s=0;s<i;s++)this.accept(e[s]);return this.options.blockParams.shift(),this.isSimple=i===1,this.blockParams=t.blockParams?t.blockParams.length:0,this},BlockStatement:function(t){Sa(t);var e=t.program,i=t.inverse;e=e&&this.compileProgram(e),i=i&&this.compileProgram(i);var s=this.classifySexpr(t);s==="helper"?this.helperSexpr(t,e,i):s==="simple"?(this.simpleSexpr(t),this.opcode("pushProgram",e),this.opcode("pushProgram",i),this.opcode("emptyHash"),this.opcode("blockValue",t.path.original)):(this.ambiguousSexpr(t,e,i),this.opcode("pushProgram",e),this.opcode("pushProgram",i),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},DecoratorBlock:function(t){var e=t.program&&this.compileProgram(t.program),i=this.setupFullMustacheParams(t,e,void 0),s=t.path;this.useDecorators=!0,this.opcode("registerDecorator",i.length,s.original)},PartialStatement:function(t){this.usePartial=!0;var e=t.program;e&&(e=this.compileProgram(t.program));var i=t.params;if(i.length>1)throw new Xs.default("Unsupported number of partial arguments: "+i.length,t);i.length||(this.options.explicitPartialContext?this.opcode("pushLiteral","undefined"):i.push({type:"PathExpression",parts:[],depth:0}));var s=t.name.original,r=t.name.type==="SubExpression";r&&this.accept(t.name),this.setupFullMustacheParams(t,e,void 0,!0);var o=t.indent||"";this.options.preventIndent&&o&&(this.opcode("appendContent",o),o=""),this.opcode("invokePartial",r,s,o),this.opcode("append")},PartialBlockStatement:function(t){this.PartialStatement(t)},MustacheStatement:function(t){this.SubExpression(t),t.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},Decorator:function(t){this.DecoratorBlock(t)},ContentStatement:function(t){t.value&&this.opcode("appendContent",t.value)},CommentStatement:function(){},SubExpression:function(t){Sa(t);var e=this.classifySexpr(t);e==="simple"?this.simpleSexpr(t):e==="helper"?this.helperSexpr(t):this.ambiguousSexpr(t)},ambiguousSexpr:function(t,e,i){var s=t.path,r=s.parts[0],o=e!=null||i!=null;this.opcode("getContext",s.depth),this.opcode("pushProgram",e),this.opcode("pushProgram",i),s.strict=!0,this.accept(s),this.opcode("invokeAmbiguous",r,o)},simpleSexpr:function(t){var e=t.path;e.strict=!0,this.accept(e),this.opcode("resolvePossibleLambda")},helperSexpr:function(t,e,i){var s=this.setupFullMustacheParams(t,e,i),r=t.path,o=r.parts[0];if(this.options.knownHelpers[o])this.opcode("invokeKnownHelper",s.length,o);else{if(this.options.knownHelpersOnly)throw new Xs.default("You specified knownHelpersOnly, but used the unknown helper "+o,t);r.strict=!0,r.falsy=!0,this.accept(r),this.opcode("invokeHelper",s.length,r.original,Ds.default.helpers.simpleId(r))}},PathExpression:function(t){this.addDepth(t.depth),this.opcode("getContext",t.depth);var e=t.parts[0],i=Ds.default.helpers.scopedId(t),s=!t.depth&&!i&&this.blockParamIndex(e);s?this.opcode("lookupBlockParam",s,t.parts):e?t.data?(this.options.data=!0,this.opcode("lookupData",t.depth,t.parts,t.strict)):this.opcode("lookupOnContext",t.parts,t.falsy,t.strict,i):this.opcode("pushContext")},StringLiteral:function(t){this.opcode("pushString",t.value)},NumberLiteral:function(t){this.opcode("pushLiteral",t.value)},BooleanLiteral:function(t){this.opcode("pushLiteral",t.value)},UndefinedLiteral:function(){this.opcode("pushLiteral","undefined")},NullLiteral:function(){this.opcode("pushLiteral","null")},Hash:function(t){var e=t.pairs,i=0,s=e.length;for(this.opcode("pushHash");i<s;i++)this.pushParam(e[i].value);for(;i--;)this.opcode("assignToHash",e[i].key);this.opcode("popHash")},opcode:function(t){this.opcodes.push({opcode:t,args:Gd.call(arguments,1),loc:this.sourceNode[0].loc})},addDepth:function(t){!t||(this.useDepths=!0)},classifySexpr:function(t){var e=Ds.default.helpers.simpleId(t.path),i=e&&!!this.blockParamIndex(t.path.parts[0]),s=!i&&Ds.default.helpers.helperExpression(t),r=!i&&(s||e);if(r&&!s){var o=t.path.parts[0],a=this.options;a.knownHelpers[o]?s=!0:a.knownHelpersOnly&&(r=!1)}return s?"helper":r?"ambiguous":"simple"},pushParams:function(t){for(var e=0,i=t.length;e<i;e++)this.pushParam(t[e])},pushParam:function(t){var e=t.value!=null?t.value:t.original||"";if(this.stringParams)e.replace&&(e=e.replace(/^(\.?\.\/)*/g,"").replace(/\//g,".")),t.depth&&this.addDepth(t.depth),this.opcode("getContext",t.depth||0),this.opcode("pushStringParam",e,t.type),t.type==="SubExpression"&&this.accept(t);else{if(this.trackIds){var i=void 0;if(t.parts&&!Ds.default.helpers.scopedId(t)&&!t.depth&&(i=this.blockParamIndex(t.parts[0])),i){var s=t.parts.slice(1).join(".");this.opcode("pushId","BlockParam",i,s)}else e=t.original||e,e.replace&&(e=e.replace(/^this(?:\.|$)/,"").replace(/^\.\//,"").replace(/^\.$/,"")),this.opcode("pushId",t.type,e)}this.accept(t)}},setupFullMustacheParams:function(t,e,i,s){var r=t.params;return this.pushParams(r),this.opcode("pushProgram",e),this.opcode("pushProgram",i),t.hash?this.accept(t.hash):this.opcode("emptyHash",s),r},blockParamIndex:function(t){for(var e=0,i=this.options.blockParams.length;e<i;e++){var s=this.options.blockParams[e],r=s&&Js.indexOf(s,t);if(s&&r>=0)return[e,r]}}};function Wd(n,t,e){if(n==null||typeof n!="string"&&n.type!=="Program")throw new Xs.default("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+n);t=t||{},"data"in t||(t.data=!0),t.compat&&(t.useDepths=!0);var i=e.parse(n,t),s=new e.Compiler().compile(i,t);return new e.JavaScriptCompiler().compile(s,t)}function Ud(n,t,e){if(t===void 0&&(t={}),n==null||typeof n!="string"&&n.type!=="Program")throw new Xs.default("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+n);t=Js.extend({},t),"data"in t||(t.data=!0),t.compat&&(t.useDepths=!0);var i=void 0;function s(){var o=e.parse(n,t),a=new e.Compiler().compile(o,t),l=new e.JavaScriptCompiler().compile(a,t,void 0,!0);return e.template(l)}function r(o,a){return i||(i=s()),i.call(this,o,a)}return r._setup=function(o){return i||(i=s()),i._setup(o)},r._child=function(o,a,l,h){return i||(i=s()),i._child(o,a,l,h)},r}function bl(n,t){if(n===t)return!0;if(Js.isArray(n)&&Js.isArray(t)&&n.length===t.length){for(var e=0;e<n.length;e++)if(!bl(n[e],t[e]))return!1;return!0}}function Sa(n){if(!n.path.parts){var t=n.path;n.path={type:"PathExpression",data:!1,depth:0,parts:[t.original+""],original:t.original+"",loc:t.loc}}}var Kr={exports:{}},qr={exports:{}};(function(n,t){t.__esModule=!0;var e=ne,i=void 0;try{var s=require("source-map");i=s.SourceNode}catch{}i||(i=function(a,l,h,c){this.src="",c&&this.add(c)},i.prototype={add:function(l){e.isArray(l)&&(l=l.join("")),this.src+=l},prepend:function(l){e.isArray(l)&&(l=l.join("")),this.src=l+this.src},toStringWithSourceMap:function(){return{code:this.toString()}},toString:function(){return this.src}});function r(a,l,h){if(e.isArray(a)){for(var c=[],u=0,f=a.length;u<f;u++)c.push(l.wrap(a[u],h));return c}else if(typeof a=="boolean"||typeof a=="number")return a+"";return a}function o(a){this.srcFile=a,this.source=[]}o.prototype={isEmpty:function(){return!this.source.length},prepend:function(l,h){this.source.unshift(this.wrap(l,h))},push:function(l,h){this.source.push(this.wrap(l,h))},merge:function(){var l=this.empty();return this.each(function(h){l.add([" ",h,`
  36. `])}),l},each:function(l){for(var h=0,c=this.source.length;h<c;h++)l(this.source[h])},empty:function(){var l=this.currentLocation||{start:{}};return new i(l.start.line,l.start.column,this.srcFile)},wrap:function(l){var h=arguments.length<=1||arguments[1]===void 0?this.currentLocation||{start:{}}:arguments[1];return l instanceof i?l:(l=r(l,this,h),new i(h.start.line,h.start.column,this.srcFile,l))},functionCall:function(l,h,c){return c=this.generateList(c),this.wrap([l,h?"."+h+"(":"(",c,")"])},quotedString:function(l){return'"'+(l+"").replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function(l){var h=this,c=[];Object.keys(l).forEach(function(f){var d=r(l[f],h);d!=="undefined"&&c.push([h.quotedString(f),":",d])});var u=this.generateList(c);return u.prepend("{"),u.add("}"),u},generateList:function(l){for(var h=this.empty(),c=0,u=l.length;c<u;c++)c&&h.add(","),h.add(r(l[c],this));return h},generateArray:function(l){var h=this.generateList(l);return h.prepend("["),h.add("]"),h}},t.default=o,n.exports=t.default})(qr,qr.exports);(function(n,t){t.__esModule=!0;function e(f){return f&&f.__esModule?f:{default:f}}var i=ni,s=je.exports,r=e(s),o=ne,a=qr.exports,l=e(a);function h(f){this.value=f}function c(){}c.prototype={nameLookup:function(d,p){return this.internalNameLookup(d,p)},depthedLookup:function(d){return[this.aliasable("container.lookup"),"(depths, ",JSON.stringify(d),")"]},compilerInfo:function(){var d=i.COMPILER_REVISION,p=i.REVISION_CHANGES[d];return[d,p]},appendToBuffer:function(d,p,g){return o.isArray(d)||(d=[d]),d=this.source.wrap(d,p),this.environment.isSimple?["return ",d,";"]:g?["buffer += ",d,";"]:(d.appendToBuffer=!0,d)},initializeBuffer:function(){return this.quotedString("")},internalNameLookup:function(d,p){return this.lookupPropertyFunctionIsUsed=!0,["lookupProperty(",d,",",JSON.stringify(p),")"]},lookupPropertyFunctionIsUsed:!1,compile:function(d,p,g,m){this.environment=d,this.options=p,this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!m,this.name=this.environment.name,this.isChild=!!g,this.context=g||{decorators:[],programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.blockParams=[],this.compileChildren(d,p),this.useDepths=this.useDepths||d.useDepths||d.useDecorators||this.options.compat,this.useBlockParams=this.useBlockParams||d.useBlockParams;var S=d.opcodes,b=void 0,y=void 0,x=void 0,w=void 0;for(x=0,w=S.length;x<w;x++)b=S[x],this.source.currentLocation=b.loc,y=y||b.loc,this[b.opcode].apply(this,b.args);if(this.source.currentLocation=y,this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new r.default("Compile completed with content left on stack");this.decorators.isEmpty()?this.decorators=void 0:(this.useDecorators=!0,this.decorators.prepend(["var decorators = container.decorators, ",this.lookupPropertyFunctionVarDeclaration(),`;
  37. `]),this.decorators.push("return fn;"),m?this.decorators=Function.apply(this,["fn","props","container","depth0","data","blockParams","depths",this.decorators.merge()]):(this.decorators.prepend(`function(fn, props, container, depth0, data, blockParams, depths) {
  38. `),this.decorators.push(`}
  39. `),this.decorators=this.decorators.merge()));var T=this.createFunctionContext(m);if(this.isChild)return T;var E={compiler:this.compilerInfo(),main:T};this.decorators&&(E.main_d=this.decorators,E.useDecorators=!0);var C=this.context,P=C.programs,I=C.decorators;for(x=0,w=P.length;x<w;x++)P[x]&&(E[x]=P[x],I[x]&&(E[x+"_d"]=I[x],E.useDecorators=!0));return this.environment.usePartial&&(E.usePartial=!0),this.options.data&&(E.useData=!0),this.useDepths&&(E.useDepths=!0),this.useBlockParams&&(E.useBlockParams=!0),this.options.compat&&(E.compat=!0),m?E.compilerOptions=this.options:(E.compiler=JSON.stringify(E.compiler),this.source.currentLocation={start:{line:1,column:0}},E=this.objectLiteral(E),p.srcName?(E=E.toStringWithSourceMap({file:p.destName}),E.map=E.map&&E.map.toString()):E=E.toString()),E},preamble:function(){this.lastContext=0,this.source=new l.default(this.options.srcName),this.decorators=new l.default(this.options.srcName)},createFunctionContext:function(d){var p=this,g="",m=this.stackVars.concat(this.registers.list);m.length>0&&(g+=", "+m.join(", "));var S=0;Object.keys(this.aliases).forEach(function(x){var w=p.aliases[x];w.children&&w.referenceCount>1&&(g+=", alias"+ ++S+"="+x,w.children[0]="alias"+S)}),this.lookupPropertyFunctionIsUsed&&(g+=", "+this.lookupPropertyFunctionVarDeclaration());var b=["container","depth0","helpers","partials","data"];(this.useBlockParams||this.useDepths)&&b.push("blockParams"),this.useDepths&&b.push("depths");var y=this.mergeSource(g);return d?(b.push(y),Function.apply(this,b)):this.source.wrap(["function(",b.join(","),`) {
  40. `,y,"}"])},mergeSource:function(d){var p=this.environment.isSimple,g=!this.forceBuffer,m=void 0,S=void 0,b=void 0,y=void 0;return this.source.each(function(x){x.appendToBuffer?(b?x.prepend(" + "):b=x,y=x):(b&&(S?b.prepend("buffer += "):m=!0,y.add(";"),b=y=void 0),S=!0,p||(g=!1))}),g?b?(b.prepend("return "),y.add(";")):S||this.source.push('return "";'):(d+=", buffer = "+(m?"":this.initializeBuffer()),b?(b.prepend("return buffer + "),y.add(";")):this.source.push("return buffer;")),d&&this.source.prepend("var "+d.substring(2)+(m?"":`;
  41. `)),this.source.merge()},lookupPropertyFunctionVarDeclaration:function(){return`
  42. lookupProperty = container.lookupProperty || function(parent, propertyName) {
  43. if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
  44. return parent[propertyName];
  45. }
  46. return undefined
  47. }
  48. `.trim()},blockValue:function(d){var p=this.aliasable("container.hooks.blockHelperMissing"),g=[this.contextName(0)];this.setupHelperArgs(d,0,g);var m=this.popStack();g.splice(1,0,m),this.push(this.source.functionCall(p,"call",g))},ambiguousBlockValue:function(){var d=this.aliasable("container.hooks.blockHelperMissing"),p=[this.contextName(0)];this.setupHelperArgs("",0,p,!0),this.flushInline();var g=this.topStack();p.splice(1,0,g),this.pushSource(["if (!",this.lastHelper,") { ",g," = ",this.source.functionCall(d,"call",p),"}"])},appendContent:function(d){this.pendingContent?d=this.pendingContent+d:this.pendingLocation=this.source.currentLocation,this.pendingContent=d},append:function(){if(this.isInline())this.replaceStack(function(p){return[" != null ? ",p,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var d=this.popStack();this.pushSource(["if (",d," != null) { ",this.appendToBuffer(d,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},appendEscaped:function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},getContext:function(d){this.lastContext=d},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(d,p,g,m){var S=0;!m&&this.options.compat&&!this.lastContext?this.push(this.depthedLookup(d[S++])):this.pushContext(),this.resolvePath("context",d,S,p,g)},lookupBlockParam:function(d,p){this.useBlockParams=!0,this.push(["blockParams[",d[0],"][",d[1],"]"]),this.resolvePath("context",p,1)},lookupData:function(d,p,g){d?this.pushStackLiteral("container.data(data, "+d+")"):this.pushStackLiteral("data"),this.resolvePath("data",p,0,!0,g)},resolvePath:function(d,p,g,m,S){var b=this;if(this.options.strict||this.options.assumeObjects){this.push(u(this.options.strict&&S,this,p,d));return}for(var y=p.length;g<y;g++)this.replaceStack(function(x){var w=b.nameLookup(x,p[g],d);return m?[" && ",w]:[" != null ? ",w," : ",x]})},resolvePossibleLambda:function(){this.push([this.aliasable("container.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},pushStringParam:function(d,p){this.pushContext(),this.pushString(p),p!=="SubExpression"&&(typeof d=="string"?this.pushString(d):this.pushStackLiteral(d))},emptyHash:function(d){this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}")),this.pushStackLiteral(d?"undefined":"{}")},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:{},types:[],contexts:[],ids:[]}},popHash:function(){var d=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push(this.objectLiteral(d.ids)),this.stringParams&&(this.push(this.objectLiteral(d.contexts)),this.push(this.objectLiteral(d.types))),this.push(this.objectLiteral(d.values))},pushString:function(d){this.pushStackLiteral(this.quotedString(d))},pushLiteral:function(d){this.pushStackLiteral(d)},pushProgram:function(d){d!=null?this.pushStackLiteral(this.programExpression(d)):this.pushStackLiteral(null)},registerDecorator:function(d,p){var g=this.nameLookup("decorators",p,"decorator"),m=this.setupHelperArgs(p,d);this.decorators.push(["fn = ",this.decorators.functionCall(g,"",["fn","props","container",m])," || fn;"])},invokeHelper:function(d,p,g){var m=this.popStack(),S=this.setupHelper(d,p),b=[];g&&b.push(S.name),b.push(m),this.options.strict||b.push(this.aliasable("container.hooks.helperMissing"));var y=["(",this.itemsSeparatedBy(b,"||"),")"],x=this.source.functionCall(y,"call",S.callParams);this.push(x)},itemsSeparatedBy:function(d,p){var g=[];g.push(d[0]);for(var m=1;m<d.length;m++)g.push(p,d[m]);return g},invokeKnownHelper:function(d,p){var g=this.setupHelper(d,p);this.push(this.source.functionCall(g.name,"call",g.callParams))},invokeAmbiguous:function(d,p){this.useRegister("helper");var g=this.popStack();this.emptyHash();var m=this.setupHelper(0,d,p),S=this.lastHelper=this.nameLookup("helpers",d,"helper"),b=["(","(helper = ",S," || ",g,")"];this.options.strict||(b[0]="(helper = ",b.push(" != null ? helper : ",this.aliasable("container.hooks.helperMissing"))),this.push(["(",b,m.paramsInit?["),(",m.paramsInit]:[],"),","(typeof helper === ",this.aliasable('"function"')," ? ",this.source.functionCall("helper","call",m.callParams)," : helper))"])},invokePartial:function(d,p,g){var m=[],S=this.setupParams(p,1,m);d&&(p=this.popStack(),delete S.name),g&&(S.indent=JSON.stringify(g)),S.helpers="helpers",S.partials="partials",S.decorators="container.decorators",d?m.unshift(p):m.unshift(this.nameLookup("partials",p,"partial")),this.options.compat&&(S.depths="depths"),S=this.objectLiteral(S),m.push(S),this.push(this.source.functionCall("container.invokePartial","",m))},assignToHash:function(d){var p=this.popStack(),g=void 0,m=void 0,S=void 0;this.trackIds&&(S=this.popStack()),this.stringParams&&(m=this.popStack(),g=this.popStack());var b=this.hash;g&&(b.contexts[d]=g),m&&(b.types[d]=m),S&&(b.ids[d]=S),b.values[d]=p},pushId:function(d,p,g){d==="BlockParam"?this.pushStackLiteral("blockParams["+p[0]+"].path["+p[1]+"]"+(g?" + "+JSON.stringify("."+g):"")):d==="PathExpression"?this.pushString(p):d==="SubExpression"?this.pushStackLiteral("true"):this.pushStackLiteral("null")},compiler:c,compileChildren:function(d,p){for(var g=d.children,m=void 0,S=void 0,b=0,y=g.length;b<y;b++){m=g[b],S=new this.compiler;var x=this.matchExistingProgram(m);if(x==null){this.context.programs.push("");var w=this.context.programs.length;m.index=w,m.name="program"+w,this.context.programs[w]=S.compile(m,p,this.context,!this.precompile),this.context.decorators[w]=S.decorators,this.context.environments[w]=m,this.useDepths=this.useDepths||S.useDepths,this.useBlockParams=this.useBlockParams||S.useBlockParams,m.useDepths=this.useDepths,m.useBlockParams=this.useBlockParams}else m.index=x.index,m.name="program"+x.index,this.useDepths=this.useDepths||x.useDepths,this.useBlockParams=this.useBlockParams||x.useBlockParams}},matchExistingProgram:function(d){for(var p=0,g=this.context.environments.length;p<g;p++){var m=this.context.environments[p];if(m&&m.equals(d))return m}},programExpression:function(d){var p=this.environment.children[d],g=[p.index,"data",p.blockParams];return(this.useBlockParams||this.useDepths)&&g.push("blockParams"),this.useDepths&&g.push("depths"),"container.program("+g.join(", ")+")"},useRegister:function(d){this.registers[d]||(this.registers[d]=!0,this.registers.list.push(d))},push:function(d){return d instanceof h||(d=this.source.wrap(d)),this.inlineStack.push(d),d},pushStackLiteral:function(d){this.push(new h(d))},pushSource:function(d){this.pendingContent&&(this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent),this.pendingLocation)),this.pendingContent=void 0),d&&this.source.push(d)},replaceStack:function(d){var p=["("],g=void 0,m=void 0,S=void 0;if(!this.isInline())throw new r.default("replaceStack on non-inline");var b=this.popStack(!0);if(b instanceof h)g=[b.value],p=["(",g],S=!0;else{m=!0;var y=this.incrStack();p=["((",this.push(y)," = ",b,")"],g=this.topStack()}var x=d.call(this,g);S||this.popStack(),m&&this.stackSlot--,this.push(p.concat(x,")"))},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var d=this.inlineStack;this.inlineStack=[];for(var p=0,g=d.length;p<g;p++){var m=d[p];if(m instanceof h)this.compileStack.push(m);else{var S=this.incrStack();this.pushSource([S," = ",m,";"]),this.compileStack.push(S)}}},isInline:function(){return this.inlineStack.length},popStack:function(d){var p=this.isInline(),g=(p?this.inlineStack:this.compileStack).pop();if(!d&&g instanceof h)return g.value;if(!p){if(!this.stackSlot)throw new r.default("Invalid stack pop");this.stackSlot--}return g},topStack:function(){var d=this.isInline()?this.inlineStack:this.compileStack,p=d[d.length-1];return p instanceof h?p.value:p},contextName:function(d){return this.useDepths&&d?"depths["+d+"]":"depth"+d},quotedString:function(d){return this.source.quotedString(d)},objectLiteral:function(d){return this.source.objectLiteral(d)},aliasable:function(d){var p=this.aliases[d];return p?(p.referenceCount++,p):(p=this.aliases[d]=this.source.wrap(d),p.aliasable=!0,p.referenceCount=1,p)},setupHelper:function(d,p,g){var m=[],S=this.setupHelperArgs(p,d,m,g),b=this.nameLookup("helpers",p,"helper"),y=this.aliasable(this.contextName(0)+" != null ? "+this.contextName(0)+" : (container.nullContext || {})");return{params:m,paramsInit:S,name:b,callParams:[y].concat(m)}},setupParams:function(d,p,g){var m={},S=[],b=[],y=[],x=!g,w=void 0;x&&(g=[]),m.name=this.quotedString(d),m.hash=this.popStack(),this.trackIds&&(m.hashIds=this.popStack()),this.stringParams&&(m.hashTypes=this.popStack(),m.hashContexts=this.popStack());var T=this.popStack(),E=this.popStack();(E||T)&&(m.fn=E||"container.noop",m.inverse=T||"container.noop");for(var C=p;C--;)w=this.popStack(),g[C]=w,this.trackIds&&(y[C]=this.popStack()),this.stringParams&&(b[C]=this.popStack(),S[C]=this.popStack());return x&&(m.args=this.source.generateArray(g)),this.trackIds&&(m.ids=this.source.generateArray(y)),this.stringParams&&(m.types=this.source.generateArray(b),m.contexts=this.source.generateArray(S)),this.options.data&&(m.data="data"),this.useBlockParams&&(m.blockParams="blockParams"),m},setupHelperArgs:function(d,p,g,m){var S=this.setupParams(d,p,g);return S.loc=JSON.stringify(this.source.currentLocation),S=this.objectLiteral(S),m?(this.useRegister("options"),g.push("options"),["options=",S]):g?(g.push(S),""):S}},function(){for(var f="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield await null true false".split(" "),d=c.RESERVED_WORDS={},p=0,g=f.length;p<g;p++)d[f[p]]=!0}(),c.isValidJavaScriptVariableName=function(f){return!c.RESERVED_WORDS[f]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(f)};function u(f,d,p,g){var m=d.popStack(),S=0,b=p.length;for(f&&b--;S<b;S++)m=d.nameLookup(m,p[S],g);return f?[d.aliasable("container.strict"),"(",m,", ",d.quotedString(p[S]),", ",JSON.stringify(d.source.currentLocation)," )"]:m}t.default=c,n.exports=t.default})(Kr,Kr.exports);(function(n,t){t.__esModule=!0;function e(b){return b&&b.__esModule?b:{default:b}}var i=Ar.exports,s=e(i),r=Hn.exports,o=e(r),a=an,l=ln,h=Kr.exports,c=e(h),u=Xn.exports,f=e(u),d=zn.exports,p=e(d),g=s.default.create;function m(){var b=g();return b.compile=function(y,x){return l.compile(y,x,b)},b.precompile=function(y,x){return l.precompile(y,x,b)},b.AST=o.default,b.Compiler=l.Compiler,b.JavaScriptCompiler=c.default,b.Parser=a.parser,b.parse=a.parse,b.parseWithoutProcessing=a.parseWithoutProcessing,b}var S=m();S.create=m,p.default(S),S.Visitor=f.default,S.default=S,t.default=S,n.exports=t.default})(da,da.exports);const zd=n=>n!==null&&n.isSecureContext,Hd=n=>n===null?null:n.hasOwnProperty("AudioBuffer")?n.AudioBuffer:null,Xd=n=>n===null?null:n.hasOwnProperty("AudioContext")?n.AudioContext:n.hasOwnProperty("webkitAudioContext")?n.webkitAudioContext:null,Yd=n=>n===null?null:n.hasOwnProperty("AudioWorkletNode")?n.AudioWorkletNode:null,jd=n=>n===null?null:n.hasOwnProperty("OfflineAudioContext")?n.OfflineAudioContext:n.hasOwnProperty("webkitOfflineAudioContext")?n.webkitOfflineAudioContext:null,Kd=()=>typeof window=="undefined"?null:window,hn=Kd();jd(hn);Xd(hn);Yd(hn);Hd(hn);zd(hn);var qd={exports:{}},Sl={exports:{}};function Jd(n){return n>64&&n<91?n-65:n>96&&n<123?n-71:n>47&&n<58?n+4:n===43?62:n===47?63:0}function Zd(n,t){for(var e=n.replace(/[^A-Za-z0-9\+\/]/g,""),i=e.length,s=t?Math.ceil((i*3+1>>2)/t)*t:i*3+1>>2,r=new Uint8Array(s),o,a,l=0,h=0,c=0;c<i;c++)if(a=c&3,l|=Jd(e.charCodeAt(c))<<18-6*a,a===3||i-c===1){for(o=0;o<3&&h<s;o++,h++)r[h]=l>>>(16>>>o&24)&255;l=0}return r}var Qd={decode:Zd},$d=function(n,t){return new Promise(function(e,i){var s=new XMLHttpRequest;t&&(s.responseType=t),s.open("GET",n),s.onload=function(){s.status===200?e(s.response):i(Error(s.statusText))},s.onerror=function(){i(Error("Network Error"))},s.send()})};(function(n){var t=Qd,e=$d;function i(E){return function(C){return typeof C=="string"&&E.test(C)}}function s(E,C){return typeof E=="string"?E+C:typeof E=="function"?E(C):C}function r(E,C,P,I){var F=o(C)?a:l(C)?h:c(C)?u:f(C)?d:p(C)?g:m(C)?S:b(C)?y:x(C)?w:null,L=P||{};return F?F(E,C,L):I?Promise.resolve(I):Promise.reject("Source not valid ("+C+")")}r.fetch=e;function o(E){return E instanceof ArrayBuffer}function a(E,C,P){return new Promise(function(I,F){E.decodeAudioData(C,function(L){I(L)},function(){F("Can't decode audio data ("+C.slice(0,30)+"...)")})})}var l=i(/\.(mp3|wav|ogg)(\?.*)?$/i);function h(E,C,P){var I=s(P.from,C);return r(E,r.fetch(I,"arraybuffer"),P)}function c(E){return E&&typeof E.then=="function"}function u(E,C,P){return C.then(function(I){return r(E,I,P)})}var f=Array.isArray;function d(E,C,P){return Promise.all(C.map(function(I){return r(E,I,P,I)}))}function p(E){return E&&typeof E=="object"}function g(E,C,P){var I={},F=Object.keys(C).map(function(L){if(P.only&&P.only.indexOf(L)===-1)return null;var k=C[L];return r(E,k,P,k).then(function(v){I[L]=v})});return Promise.all(F).then(function(){return I})}var m=i(/\.json(\?.*)?$/i);function S(E,C,P){var I=s(P.from,C);return r(E,r.fetch(I,"text").then(JSON.parse),P)}var b=i(/^data:audio/);function y(E,C,P){var I=C.indexOf(",");return r(E,t.decode(C.slice(I+1)).buffer,P)}var x=i(/\.js(\?.*)?$/i);function w(E,C,P){var I=s(P.from,C);return r(E,r.fetch(I,"text").then(T),P)}function T(E){var C=E.indexOf("MIDI.Soundfont.");if(C<0)throw Error("Invalid MIDI.js Soundfont format");C=E.indexOf("=",C)+2;var P=E.lastIndexOf(",");return JSON.parse(E.slice(C,P)+"}")}n.exports&&(n.exports=r),typeof window!="undefined"&&(window.loadAudio=r)})(Sl);var yl={exports:{}},t1=e1;function e1(n){var t=n.createGain(),e=t._voltage=n1(n),i=hs(e),s=hs(e),r=hs(e);return t._startAmount=hs(s),t._endAmount=hs(r),t._multiplier=hs(i),t._multiplier.connect(t),t._startAmount.connect(t),t._endAmount.connect(t),t.value=i.gain,t.startValue=s.gain,t.endValue=r.gain,t.startValue.value=0,t.endValue.value=0,Object.defineProperties(t,i1),t}var i1={attack:{value:0,writable:!0},decay:{value:0,writable:!0},sustain:{value:1,writable:!0},release:{value:0,writable:!0},getReleaseDuration:{value:function(){return this.release}},start:{value:function(n){var t=this._multiplier.gain,e=this._startAmount.gain,i=this._endAmount.gain;this._voltage.start(n),this._decayFrom=this._decayFrom=n+this.attack,this._startedAt=n;var s=this.sustain;t.cancelScheduledValues(n),e.cancelScheduledValues(n),i.cancelScheduledValues(n),i.setValueAtTime(0,n),this.attack?(t.setValueAtTime(0,n),t.linearRampToValueAtTime(1,n+this.attack),e.setValueAtTime(1,n),e.linearRampToValueAtTime(0,n+this.attack)):(t.setValueAtTime(1,n),e.setValueAtTime(0,n)),this.decay&&t.setTargetAtTime(s,this._decayFrom,ya(this.decay))}},stop:{value:function(n,t){t&&(n=n-this.release);var e=n+this.release;if(this.release){var i=this._multiplier.gain,s=this._startAmount.gain,r=this._endAmount.gain;i.cancelScheduledValues(n),s.cancelScheduledValues(n),r.cancelScheduledValues(n);var o=ya(this.release);if(this.attack&&n<this._decayFrom){var a=r1(0,1,this._startedAt,this._decayFrom,n);i.linearRampToValueAtTime(a,n),s.linearRampToValueAtTime(1-a,n),s.setTargetAtTime(0,n,o)}r.setTargetAtTime(1,n,o),i.setTargetAtTime(0,n,o)}return this._voltage.stop(e),e}},onended:{get:function(){return this._voltage.onended},set:function(n){this._voltage.onended=n}}},s1=new Float32Array([1,1]);function n1(n){var t=n.createBufferSource(),e=n.createBuffer(1,2,n.sampleRate);return e.getChannelData(0).set(s1),t.buffer=e,t.loop=!0,t}function hs(n){var t=n.context.createGain();return n.connect(t),t}function ya(n){return Math.log(n+1)/Math.log(100)}function r1(n,t,e,i,s){var r=t-n,o=i-e,a=s-e,l=a/o,h=n+l*r;return h<=n&&(h=n),h>=t&&(h=t),h}var o1=t1,a1={},l1={gain:1,attack:.01,decay:.1,sustain:.9,release:.3,loop:!1,cents:0,loopStart:0,loopEnd:0};function h1(n,t,e){var i=!1,s=0,r={},o=n.createGain();o.gain.value=1;var a=Object.assign({},l1,e),l={context:n,out:o,opts:a};return t instanceof AudioBuffer?l.buffer=t:l.buffers=t,l.start=function(u,f,d){if(l.buffer&&u!==null)return l.start(null,u,f);var p=u?l.buffers[u]:l.buffer;if(p){if(!i){console.warn("SamplePlayer not connected to any node.");return}}else{console.warn("Buffer "+u+" not found.");return}var g=d||a1;f=Math.max(n.currentTime,f||0),l.emit("start",f,u,g);var m=c(u,p,g);return m.id=h(u,m),m.env.start(f),m.source.start(f),l.emit("started",f,m.id,m),g.duration&&m.stop(f+g.duration),m},l.play=function(u,f,d){return l.start(u,f,d)},l.stop=function(u,f){var d;return f=f||Object.keys(r),f.map(function(p){return d=r[p],d?(d.stop(u),d.id):null})},l.connect=function(u){return i=!0,o.connect(u),l},l.emit=function(u,f,d,p){l.onevent&&l.onevent(u,f,d,p);var g=l["on"+u];g&&g(f,d,p)},l;function h(u,f){return f.id=s++,r[f.id]=f,f.source.onended=function(){var d=n.currentTime;f.source.disconnect(),f.env.disconnect(),f.disconnect(),l.emit("ended",d,f.id,f)},f.id}function c(u,f,d){var p=n.createGain();return p.gain.value=0,p.connect(o),p.env=u1(n,d,a),p.env.connect(p.gain),p.source=n.createBufferSource(),p.source.buffer=f,p.source.connect(p),p.source.loop=d.loop||a.loop,p.source.playbackRate.value=f1(d.cents||a.cents),p.source.loopStart=d.loopStart||a.loopStart,p.source.loopEnd=d.loopEnd||a.loopEnd,p.stop=function(g){var m=g||n.currentTime;l.emit("stop",m,u);var S=p.env.stop(m);p.source.stop(S)},p}}function xa(n){return typeof n=="number"}var c1=["attack","decay","sustain","release"];function u1(n,t,e){var i=o1(n),s=t.adsr||e.adsr;return c1.forEach(function(r,o){s?i[r]=s[o]:i[r]=t[r]||e[r]}),i.value.value=xa(t.gain)?t.gain:xa(e.gain)?e.gain:1,i}function f1(n){return n?Math.pow(2,n/1200):1}var d1=h1,p1=function(n){return n.on=function(t,e){if(arguments.length===1&&typeof t=="function")return n.on("event",t);var i="on"+t,s=n[i];return n[i]=s?m1(s,e):e,n},n};function m1(n,t){return function(e,i,s,r){n(e,i,s,r),t(e,i,s,r)}}var xl=/^([a-gA-G])(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)\s*$/;function g1(){return xl}var b1=[0,2,4,5,7,9,11];function vl(n,t,e){if(typeof n!="string")return null;var i=xl.exec(n);if(!i||!t&&i[4])return null;var s={letter:i[1].toUpperCase(),acc:i[2].replace(/x/g,"##")};return s.pc=s.letter+s.acc,s.step=(s.letter.charCodeAt(0)+3)%7,s.alt=s.acc[0]==="b"?-s.acc.length:s.acc.length,s.chroma=b1[s.step]+s.alt,i[3]&&(s.oct=+i[3],s.midi=s.chroma+12*(s.oct+1),s.freq=_l(s.midi,e)),t&&(s.tonicOf=i[4]),s}function _l(n,t){return Math.pow(2,(n-69)/12)*(t||440)}var wl={parse:vl,regex:g1,midiToFreq:_l},S1=["letter","acc","pc","step","alt","chroma","oct","midi","freq"];S1.forEach(function(n){wl[n]=function(t){var e=vl(t);return e&&typeof e[n]!="undefined"?e[n]:null}});var y1=wl,x1=y1,v1=function(n){return n!==null&&n!==[]&&n>=0&&n<129},_1=function(n){return v1(n)?+n:x1.midi(n)},w1=function(n){if(n.buffers){var t=n.opts.map,e=typeof t=="function"?t:_1,i=function(r){return r?e(r)||r:null};n.buffers=E1(n.buffers,i);var s=n.start;n.start=function(r,o,a){var l=i(r),h=l%1;return h&&(l=Math.floor(l),a=Object.assign(a||{},{cents:Math.floor(h*100)})),s(l,o,a)}}return n};function E1(n,t){return Object.keys(n).reduce(function(e,i){return e[t(i)]=n[i],e},{})}var M1=Array.isArray,P1=function(n){return n&&typeof n=="object"},L1={},T1=function(n){return n.schedule=function(t,e){var i=n.context.currentTime,s=t<i?i:t;n.emit("schedule",s,e);var r,o,a,l;return e.map(function(h){if(h)M1(h)?(r=h[0],o=h[1]):(r=h.time,o=h);else return null;return P1(o)?(a=o.name||o.key||o.note||o.midi||null,l=o):(a=o,l=L1),n.start(a,s+(r||0),l)})},n},El={exports:{}};(function(n,t){(function(e){n.exports=e()})(function(){return function e(i,s,r){function o(h,c){if(!s[h]){if(!i[h]){var u=typeof Oi=="function"&&Oi;if(!c&&u)return u(h,!0);if(a)return a(h,!0);var f=new Error("Cannot find module '"+h+"'");throw f.code="MODULE_NOT_FOUND",f}var d=s[h]={exports:{}};i[h][0].call(d.exports,function(p){var g=i[h][1][p];return o(g||p)},d,d.exports,e,i,s,r)}return s[h].exports}for(var a=typeof Oi=="function"&&Oi,l=0;l<r.length;l++)o(r[l]);return o}({1:[function(e,i,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=function(r){function o(a){if(this._event=a,this._data=a.data,this.receivedTime=a.receivedTime,this._data&&this._data.length<2){console.warn("Illegal MIDI message of length",this._data.length);return}switch(this._messageCode=a.data[0]&240,this.channel=a.data[0]&15,this._messageCode){case 128:this.messageType="noteoff",this.key=a.data[1]&127,this.velocity=a.data[2]&127;break;case 144:this.messageType="noteon",this.key=a.data[1]&127,this.velocity=a.data[2]&127;break;case 160:this.messageType="keypressure",this.key=a.data[1]&127,this.pressure=a.data[2]&127;break;case 176:this.messageType="controlchange",this.controllerNumber=a.data[1]&127,this.controllerValue=a.data[2]&127,this.controllerNumber===120&&this.controllerValue===0?this.channelModeMessage="allsoundoff":this.controllerNumber===121?this.channelModeMessage="resetallcontrollers":this.controllerNumber===122?this.controllerValue===0?this.channelModeMessage="localcontroloff":this.channelModeMessage="localcontrolon":this.controllerNumber===123&&this.controllerValue===0?this.channelModeMessage="allnotesoff":this.controllerNumber===124&&this.controllerValue===0?this.channelModeMessage="omnimodeoff":this.controllerNumber===125&&this.controllerValue===0?this.channelModeMessage="omnimodeon":this.controllerNumber===126?this.channelModeMessage="monomodeon":this.controllerNumber===127&&(this.channelModeMessage="polymodeon");break;case 192:this.messageType="programchange",this.program=a.data[1];break;case 208:this.messageType="channelpressure",this.pressure=a.data[1]&127;break;case 224:this.messageType="pitchbendchange";var l=a.data[2]&127,h=a.data[1]&127;this.pitchBend=(l<<8)+h;break}}return new o(r)},i.exports=s.default},{}]},{},[1])(1)})})(El);var C1=El.exports,R1=function(n){return n.listenToMidi=function(t,e){var i={},s=e||{},r=s.gain||function(o){return o/127};return t.onmidimessage=function(o){var a=o.messageType?o:C1(o);if(a.messageType==="noteon"&&a.velocity===0&&(a.messageType="noteoff"),!(s.channel&&a.channel!==s.channel))switch(a.messageType){case"noteon":i[a.key]=n.play(a.key,0,{gain:r(a.velocity)});break;case"noteoff":i[a.key]&&(i[a.key].stop(),delete i[a.key]);break}},n},n};(function(n){var t=d1,e=p1,i=w1,s=T1,r=R1;function o(a,l,h){return r(s(i(e(t(a,l,h)))))}n.exports&&(n.exports=o),typeof window!="undefined"&&(window.SamplePlayer=o)})(yl);function va(n,t){return Array(t+1).join(n)}function Ao(n){return typeof n=="number"}function N1(n){return typeof n=="string"}function A1(n){return typeof n!="undefined"}function Ml(n,t){return Math.pow(2,(n-69)/12)*(t||440)}var Pl=/^([a-gA-G])(#{1,}|b{1,}|x{1,}|)(-?\d*)\s*(.*)\s*$/;function I1(){return Pl}var k1=[0,2,4,5,7,9,11];function ki(n,t,e){if(typeof n!="string")return null;var i=Pl.exec(n);if(!i||!t&&i[4])return null;var s={letter:i[1].toUpperCase(),acc:i[2].replace(/x/g,"##")};s.pc=s.letter+s.acc,s.step=(s.letter.charCodeAt(0)+3)%7,s.alt=s.acc[0]==="b"?-s.acc.length:s.acc.length;var r=k1[s.step]+s.alt;return s.chroma=r<0?12+r:r%12,i[3]&&(s.oct=+i[3],s.midi=r+12*(s.oct+1),s.freq=Ml(s.midi,e)),t&&(s.tonicOf=i[4]),s}var B1="CDEFGAB";function D1(n){return Ao(n)?n<0?va("b",-n):va("#",n):""}function F1(n){return Ao(n)?""+n:""}function Ll(n,t,e){return n===null||typeof n=="undefined"?null:n.step?Ll(n.step,n.alt,n.oct):n<0||n>6?null:B1.charAt(n)+D1(t)+F1(e)}function Tl(n){if((Ao(n)||N1(n))&&n>=0&&n<128)return+n;var t=ki(n);return t&&A1(t.midi)?t.midi:null}function O1(n,t){var e=Tl(n);return e===null?null:Ml(e,t)}function V1(n){return(ki(n)||{}).letter}function G1(n){return(ki(n)||{}).acc}function W1(n){return(ki(n)||{}).pc}function U1(n){return(ki(n)||{}).step}function z1(n){return(ki(n)||{}).alt}function H1(n){return(ki(n)||{}).chroma}function X1(n){return(ki(n)||{}).oct}var Y1=Object.freeze(Object.defineProperty({__proto__:null,regex:I1,parse:ki,build:Ll,midi:Tl,freq:O1,letter:V1,acc:G1,pc:W1,step:U1,alt:z1,chroma:H1,oct:X1},Symbol.toStringTag,{value:"Module"})),j1=Fl(Y1),Jr=j1;function Si(n,t){if(console.warn("new Soundfont() is deprected"),console.log("Please use Soundfont.instrument() instead of new Soundfont().instrument()"),!(this instanceof Si))return new Si(n);this.nameToUrl=t||Si.nameToUrl,this.ctx=n,this.instruments={},this.promises=[]}Si.prototype.onready=function(n){console.warn("deprecated API"),console.log("Please use Promise.all(Soundfont.instrument(), Soundfont.instrument()).then() instead of new Soundfont().onready()"),Promise.all(this.promises).then(n)};Si.prototype.instrument=function(n,t){console.warn("new Soundfont().instrument() is deprecated."),console.log("Please use Soundfont.instrument() instead.");var e=this.ctx;if(n=n||"default",n in this.instruments)return this.instruments[n];var i={name:n,play:q1(e,t)};if(this.instruments[n]=i,n!=="default"){var s=Si.instrument(e,n,t).then(function(r){return i.play=r.play,i});this.promises.push(s),i.onready=function(r){console.warn("onready is deprecated. Use Soundfont.instrument().then()"),s.then(r)}}else i.onready=function(r){console.warn("onready is deprecated. Use Soundfont.instrument().then()"),r()};return i};function K1(n,t,e){return console.warn("Soundfont.loadBuffers is deprecate."),console.log("Use Soundfont.instrument(..) and get buffers properties from the result."),Si.instrument(n,t,e).then(function(i){return i.buffers})}Si.loadBuffers=K1;function q1(n,t){return t=t||{},function(e,i,s,r){console.warn("The oscillator player is deprecated."),console.log("Starting with version 0.9.0 you will have to wait until the soundfont is loaded to play sounds.");var o=e>0&&e<129?+e:Jr.midi(e),a=o?Jr.midiToFreq(o,440):null;if(!!a){s=s||.2,r=r||{};var l=r.destination||t.destination||n.destination,h=r.vcoType||t.vcoType||"sine",c=r.gain||t.gain||.4,u=n.createOscillator();u.type=h,u.frequency.value=a;var f=n.createGain();return f.gain.value=c,u.connect(f),f.connect(l),u.start(i),s>0&&u.stop(i+s),u}}}Si.noteToMidi=Jr.midi;var J1=Si;(function(n){var t=Sl.exports,e=yl.exports;function i(a,l,h){if(arguments.length===1)return function(p,g){return i(a,p,g)};var c=h||{},u=c.isSoundfontURL||s,f=c.nameToUrl||r,d=u(l)?l:f(l,c.soundfont,c.format);return t(a,d,{only:c.only||c.notes}).then(function(p){var g=e(a,p,c).connect(c.destination?c.destination:a.destination);return g.url=d,g.name=l,g})}function s(a){return/\.js(\?.*)?$/i.test(a)}function r(a,l,h){return h=h==="ogg"?h:"mp3",l=l==="FluidR3_GM"?l:"MusyngKite","https://gleitz.github.io/midi-js-soundfonts/"+l+"/"+a+"-"+h+".js"}var o=J1;o.instrument=i,o.nameToUrl=r,n.exports&&(n.exports=o),typeof window!="undefined"&&(window.Soundfont=o)})(qd);ut.C,ut.D,ut.E,ut.F,ut.G,ut.A,ut.B;export{Ui as E,W as F,$1 as G,hf as O,Ce as P,Ue as S,M as V,ps as a,tp as b,Ha as i};