var t=Object.assign;function e(t,e){const i=Object.create(null),n=t.split(",");for(let s=0;s!!i[t.toLowerCase()]:t=>!!i[t]}const i=e("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt"),n=e("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function s(t){if(E(t)){const e={};for(let i=0;i{if(t){const i=t.split(o);i.length>1&&(e[i[0].trim()]=i[1].trim())}})),e}function l(t){let e="";if(T(t))e=t;else if(E(t))for(let i=0;i{},p=()=>!1,m=/^on[^a-z]/,b=t=>m.test(t),g=t=>t.startsWith("onUpdate:"),y=Object.assign,S=(t,e)=>{const i=t.indexOf(e);i>-1&&t.splice(i,1)},v=Object.prototype.hasOwnProperty,x=(t,e)=>v.call(t,e),E=Array.isArray,_=t=>"[object Map]"===C(t),w=t=>"function"==typeof t,T=t=>"string"==typeof t,M=t=>"symbol"==typeof t,P=t=>null!==t&&"object"==typeof t,L=t=>P(t)&&w(t.then)&&w(t.catch),A=Object.prototype.toString,C=t=>A.call(t),I=t=>C(t).slice(8,-1),R=t=>T(t)&&"NaN"!==t&&"-"!==t[0]&&""+parseInt(t,10)===t,N=e(",key,ref,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),F=t=>{const e=Object.create(null);return i=>e[i]||(e[i]=t(i))},B=/-(\w)/g,O=F((t=>t.replace(B,((t,e)=>e?e.toUpperCase():"")))),D=/\B([A-Z])/g,k=F((t=>t.replace(D,"-$1").toLowerCase())),V=F((t=>t.charAt(0).toUpperCase()+t.slice(1))),G=F((t=>t?`on${V(t)}`:"")),W=(t,e)=>t!==e&&(t==t||e==e),U=(t,e)=>{for(let i=0;i{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,value:i})},j=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let H;const X=new WeakMap,Y=[];let K;const q=Symbol("iterate"),$=Symbol("Map key iterate");function J(t,e=u){(function(t){return t&&!0===t._isEffect})(t)&&(t=t.raw);const i=function(t,e){const i=function(){if(!i.active)return e.scheduler?void 0:t();if(!Y.includes(i)){tt(i);try{return it.push(et),et=!0,Y.push(i),K=i,t()}finally{Y.pop(),st(),K=Y[Y.length-1]}}};return i.id=Q++,i.allowRecurse=!!e.allowRecurse,i._isEffect=!0,i.active=!0,i.raw=t,i.deps=[],i.options=e,i}(t,e);return e.lazy||i(),i}function Z(t){t.active&&(tt(t),t.options.onStop&&t.options.onStop(),t.active=!1)}let Q=0;function tt(t){const{deps:e}=t;if(e.length){for(let i=0;i{t&&t.forEach((t=>{(t!==K||t.allowRecurse)&&a.add(t)}))};if("clear"===e)o.forEach(l);else if("length"===i&&E(t))o.forEach(((t,e)=>{("length"===e||e>=n)&&l(t)}));else switch(void 0!==i&&l(o.get(i)),e){case"add":E(t)?R(i)&&l(o.get("length")):(l(o.get(q)),_(t)&&l(o.get($)));break;case"delete":E(t)||(l(o.get(q)),_(t)&&l(o.get($)));break;case"set":_(t)&&l(o.get(q))}a.forEach((o=>{o.options.onTrigger&&o.options.onTrigger({effect:o,target:t,key:i,type:e,newValue:n,oldValue:s,oldTarget:r}),o.options.scheduler?o.options.scheduler(o):o()}))}const at=e("__proto__,__v_isRef,__isVue"),lt=new Set(Object.getOwnPropertyNames(Symbol).map((t=>Symbol[t])).filter(M)),ht=pt(),ct=pt(!1,!0),ut=pt(!0),dt=pt(!0,!0),ft={};function pt(t=!1,e=!1){return function(i,n,s){if("__v_isReactive"===n)return!t;if("__v_isReadonly"===n)return t;if("__v_raw"===n&&s===(t?zt:Ut).get(i))return i;const r=E(i);if(!t&&r&&x(ft,n))return Reflect.get(ft,n,s);const o=Reflect.get(i,n,s);if(M(n)?lt.has(n):at(n))return o;if(t||rt(i,"get",n),e)return o;if(Qt(o)){return!r||!R(n)?o.value:o}return P(o)?t?Ht(o):jt(o):o}}["includes","indexOf","lastIndexOf"].forEach((t=>{const e=Array.prototype[t];ft[t]=function(...t){const i=Jt(this);for(let e=0,s=this.length;e{const e=Array.prototype[t];ft[t]=function(...t){nt();const i=e.apply(this,t);return st(),i}}));function mt(t=!1){return function(e,i,n,s){const r=e[i];if(!t&&(n=Jt(n),!E(e)&&Qt(r)&&!Qt(n)))return r.value=n,!0;const o=E(e)&&R(i)?Number(i)(console.warn(`Set operation on key "${String(e)}" failed: target is readonly.`,t),!0),deleteProperty:(t,e)=>(console.warn(`Delete operation on key "${String(e)}" failed: target is readonly.`,t),!0)},yt=y({},bt,{get:ct,set:mt(!0)}),St=y({},gt,{get:dt}),vt=t=>P(t)?jt(t):t,xt=t=>P(t)?Ht(t):t,Et=t=>t,_t=t=>Reflect.getPrototypeOf(t);function wt(t,e,i=!1,n=!1){const s=Jt(t=t.__v_raw),r=Jt(e);e!==r&&!i&&rt(s,"get",e),!i&&rt(s,"get",r);const{has:o}=_t(s),a=i?xt:n?Et:vt;return o.call(s,e)?a(t.get(e)):o.call(s,r)?a(t.get(r)):void 0}function Tt(t,e=!1){const i=this.__v_raw,n=Jt(i),s=Jt(t);return t!==s&&!e&&rt(n,"has",t),!e&&rt(n,"has",s),t===s?i.has(t):i.has(t)||i.has(s)}function Mt(t,e=!1){return t=t.__v_raw,!e&&rt(Jt(t),"iterate",q),Reflect.get(t,"size",t)}function Pt(t){t=Jt(t);const e=Jt(this),i=_t(e).has.call(e,t);return e.add(t),i||ot(e,"add",t,t),this}function Lt(t,e){e=Jt(e);const i=Jt(this),{has:n,get:s}=_t(i);let r=n.call(i,t);r?Wt(i,n,t):(t=Jt(t),r=n.call(i,t));const o=s.call(i,t);return i.set(t,e),r?W(e,o)&&ot(i,"set",t,e,o):ot(i,"add",t,e),this}function At(t){const e=Jt(this),{has:i,get:n}=_t(e);let s=i.call(e,t);s?Wt(e,i,t):(t=Jt(t),s=i.call(e,t));const r=n?n.call(e,t):void 0,o=e.delete(t);return s&&ot(e,"delete",t,void 0,r),o}function Ct(){const t=Jt(this),e=0!==t.size,i=_(t)?new Map(t):new Set(t),n=t.clear();return e&&ot(t,"clear",void 0,void 0,i),n}function It(t,e){return function(i,n){const s=this,r=s.__v_raw,o=Jt(r),a=t?xt:e?Et:vt;return!t&&rt(o,"iterate",q),r.forEach(((t,e)=>i.call(n,a(t),a(e),s)))}}function Rt(t,e,i){return function(...n){const s=this.__v_raw,r=Jt(s),o=_(r),a="entries"===t||t===Symbol.iterator&&o,l="keys"===t&&o,h=s[t](...n),c=e?xt:i?Et:vt;return!e&&rt(r,"iterate",l?$:q),{next(){const{value:t,done:e}=h.next();return e?{value:t,done:e}:{value:a?[c(t[0]),c(t[1])]:c(t),done:e}},[Symbol.iterator](){return this}}}}function Nt(t){return function(...e){{const i=e[0]?`on key "${e[0]}" `:"";console.warn(`${V(t)} operation ${i}failed: target is readonly.`,Jt(this))}return"delete"!==t&&this}}const Ft={get(t){return wt(this,t)},get size(){return Mt(this)},has:Tt,add:Pt,set:Lt,delete:At,clear:Ct,forEach:It(!1,!1)},Bt={get(t){return wt(this,t,!1,!0)},get size(){return Mt(this)},has:Tt,add:Pt,set:Lt,delete:At,clear:Ct,forEach:It(!1,!0)},Ot={get(t){return wt(this,t,!0)},get size(){return Mt(this,!0)},has(t){return Tt.call(this,t,!0)},add:Nt("add"),set:Nt("set"),delete:Nt("delete"),clear:Nt("clear"),forEach:It(!0,!1)};function Dt(t,e){const i=e?Bt:t?Ot:Ft;return(e,n,s)=>"__v_isReactive"===n?!t:"__v_isReadonly"===n?t:"__v_raw"===n?e:Reflect.get(x(i,n)&&n in e?i:e,n,s)}["keys","values","entries",Symbol.iterator].forEach((t=>{Ft[t]=Rt(t,!1,!1),Ot[t]=Rt(t,!0,!1),Bt[t]=Rt(t,!1,!0)}));const kt={get:Dt(!1,!1)},Vt={get:Dt(!1,!0)},Gt={get:Dt(!0,!1)};function Wt(t,e,i){const n=Jt(i);if(n!==i&&e.call(t,n)){const e=I(t);console.warn(`Reactive ${e} contains both the raw and reactive versions of the same object${"Map"===e?" as keys":""}, which can lead to inconsistencies. Avoid differentiating between the raw and reactive versions of an object and only use the reactive version if possible.`)}}const Ut=new WeakMap,zt=new WeakMap;function jt(t){return t&&t.__v_isReadonly?t:Yt(t,!1,bt,kt)}function Ht(t){return Yt(t,!0,gt,Gt)}function Xt(t){return Yt(t,!0,St,Gt)}function Yt(t,e,i,n){if(!P(t))return console.warn(`value cannot be made reactive: ${String(t)}`),t;if(t.__v_raw&&(!e||!t.__v_isReactive))return t;const s=e?zt:Ut,r=s.get(t);if(r)return r;const o=(a=t).__v_skip||!Object.isExtensible(a)?0:function(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}(I(a));var a;if(0===o)return t;const l=new Proxy(t,2===o?n:i);return s.set(t,l),l}function Kt(t){return qt(t)?Kt(t.__v_raw):!(!t||!t.__v_isReactive)}function qt(t){return!(!t||!t.__v_isReadonly)}function $t(t){return Kt(t)||qt(t)}function Jt(t){return t&&Jt(t.__v_raw)||t}const Zt=t=>P(t)?jt(t):t;function Qt(t){return Boolean(t&&!0===t.__v_isRef)}function te(t){return function(t,e=!1){if(Qt(t))return t;return new ee(t,e)}(t)}class ee{constructor(t,e=!1){this._rawValue=t,this._shallow=e,this.__v_isRef=!0,this._value=e?t:Zt(t)}get value(){return rt(Jt(this),"get","value"),this._value}set value(t){W(Jt(t),this._rawValue)&&(this._rawValue=t,this._value=this._shallow?t:Zt(t),ot(Jt(this),"set","value",t))}}function ie(t){return Qt(t)?t.value:t}const ne={get:(t,e,i)=>ie(Reflect.get(t,e,i)),set:(t,e,i,n)=>{const s=t[e];return Qt(s)&&!Qt(i)?(s.value=i,!0):Reflect.set(t,e,i,n)}};function se(t){return Kt(t)?t:new Proxy(t,ne)}class re{constructor(t,e){this._object=t,this._key=e,this.__v_isRef=!0}get value(){return this._object[this._key]}set value(t){this._object[this._key]=t}}class oe{constructor(t,e,i){this._setter=e,this._dirty=!0,this.__v_isRef=!0,this.effect=J(t,{lazy:!0,scheduler:()=>{this._dirty||(this._dirty=!0,ot(Jt(this),"set","value"))}}),this.__v_isReadonly=i}get value(){return this._dirty&&(this._value=this.effect(),this._dirty=!1),rt(Jt(this),"get","value"),this._value}set value(t){this._setter(t)}}const ae=[];function le(t){ae.push(t)}function he(){ae.pop()}function ce(t,...e){nt();const i=ae.length?ae[ae.length-1].component:null,n=i&&i.appContext.config.warnHandler,s=function(){let t=ae[ae.length-1];if(!t)return[];const e=[];for(;t;){const i=e[0];i&&i.vnode===t?i.recurseCount++:e.push({vnode:t,recurseCount:0});const n=t.component&&t.component.parent;t=n&&n.vnode}return e}();if(n)pe(n,i,11,[t+e.join(""),i&&i.proxy,s.map((({vnode:t})=>`at <${Ts(i,t.type)}>`)).join("\n"),s]);else{const i=[`[Vue warn]: ${t}`,...e];s.length&&i.push("\n",...function(t){const e=[];return t.forEach(((t,i)=>{e.push(...0===i?[]:["\n"],...function({vnode:t,recurseCount:e}){const i=e>0?`... (${e} recursive calls)`:"",n=!!t.component&&null==t.component.parent,s=` at <${Ts(t.component,t.type,n)}`,r=">"+i;return t.props?[s,...ue(t.props),r]:[s+r]}(t))})),e}(s)),console.warn(...i)}st()}function ue(t){const e=[],i=Object.keys(t);return i.slice(0,3).forEach((i=>{e.push(...de(i,t[i]))})),i.length>3&&e.push(" ..."),e}function de(t,e,i){return T(e)?(e=JSON.stringify(e),i?e:[`${t}=${e}`]):"number"==typeof e||"boolean"==typeof e||null==e?i?e:[`${t}=${e}`]:Qt(e)?(e=de(t,Jt(e.value),!0),i?e:[`${t}=Ref<`,e,">"]):w(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=Jt(e),i?e:[`${t}=`,e])}const fe={bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/vue-next"};function pe(t,e,i,n){let s;try{s=n?t(...n):t()}catch(r){be(r,e,i)}return s}function me(t,e,i,n){if(w(t)){const s=pe(t,e,i,n);return s&&L(s)&&s.catch((t=>{be(t,e,i)})),s}const s=[];for(let r=0;rDe(t)-De(e))),Me=0;Menull==t.id?1/0:t.id;function ke(t){ye=!1,ge=!0,Be(t=t||new Map),Se.sort(((t,e)=>De(t)-De(e)));try{for(ve=0;ve100)throw new Error("Maximum recursive updates exceeded. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.");t.set(e,i+1)}else t.set(e,1)}let Ge=!1;const We=new Set;("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}).__VUE_HMR_RUNTIME__={createRecord:je(ze),rerender:je((function(t,e){const i=Ue.get(t);if(!i)return;e&&(i.component.render=e);Array.from(i.instances).forEach((t=>{e&&(t.render=e),t.renderCache=[],Ge=!0,t.update(),Ge=!1}))})),reload:je((function(t,e){const i=Ue.get(t);if(!i)return;const{component:n,instances:s}=i;if(!We.has(n)){e=Ms(e)?e.__vccOpts:e,y(n,e);for(const t in n)t in e||delete n[t];We.add(n),Fe((()=>{We.delete(n)}))}Array.from(s).forEach((t=>{t.parent?Ie(t.parent.update):t.appContext.reload?t.appContext.reload():"undefined"!=typeof window?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required.")}))}))};const Ue=new Map;function ze(t,e){return e||(ce("HMR API usage is out of date.\nPlease upgrade vue-loader/vite/rollup-plugin-vue or other relevant dependency that handles Vue SFC compilation."),e={}),!Ue.has(t)&&(Ue.set(t,{component:Ms(e)?e.__vccOpts:e,instances:new Set}),!0)}function je(t){return(e,i)=>{try{return t(e,i)}catch(n){console.error(n),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let He;const Xe=qe("component:added"),Ye=qe("component:updated"),Ke=qe("component:removed");function qe(t){return e=>{He&&He.emit(t,e.appContext.app,e.uid,e.parent?e.parent.uid:void 0,e)}}function $e(t,e,...i){const n=t.vnode.props||u;{const{emitsOptions:n,propsOptions:[s]}=t;if(n)if(e in n){const t=n[e];if(w(t)){t(...i)||ce(`Invalid event arguments: event validation failed for event "${e}".`)}}else s&&G(e)in s||ce(`Component emitted event "${e}" but it is neither declared in the emits option nor as an "${G(e)}" prop.`)}let s=i;const r=e.startsWith("update:"),o=r&&e.slice(7);if(o&&o in n){const t=`${"modelValue"===o?"model":o}Modifiers`,{number:e,trim:r}=n[t]||u;r?s=i.map((t=>t.trim())):e&&(s=i.map(j))}!function(t,e,i){He&&He.emit("component:emit",t.appContext.app,t,e,i)}(t,e,s);{const i=e.toLowerCase();i!==e&&n[G(i)]&&ce(`Event "${i}" is emitted in component ${Ts(t,t.type)} but the handler is registered for "${e}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${k(e)}" instead of "${e}".`)}let a=G(O(e)),l=n[a];!l&&r&&(a=G(k(e)),l=n[a]),l&&me(l,t,6,s);const h=n[a+"Once"];if(h){if(t.emitted){if(t.emitted[a])return}else(t.emitted={})[a]=!0;me(h,t,6,s)}}function Je(t,e,i=!1){if(!e.deopt&&void 0!==t.__emits)return t.__emits;const n=t.emits;let s={},r=!1;if(!w(t)){const n=t=>{r=!0,y(s,Je(t,e,!0))};!i&&e.mixins.length&&e.mixins.forEach(n),t.extends&&n(t.extends),t.mixins&&t.mixins.forEach(n)}return n||r?(E(n)?n.forEach((t=>s[t]=null)):y(s,n),t.__emits=s):t.__emits=null}function Ze(t,e){return!(!t||!b(e))&&(e=e.slice(2).replace(/Once$/,""),x(t,e[0].toLowerCase()+e.slice(1))||x(t,k(e))||x(t,e))}let Qe=null;function ti(t){Qe=t}let ei=!1;function ii(){ei=!0}function ni(t){const{type:e,vnode:i,proxy:n,withProxy:s,props:r,propsOptions:[o],slots:a,attrs:l,emit:h,render:c,renderCache:u,data:d,setupState:f,ctx:p}=t;let m;Qe=t,ei=!1;try{let t;if(4&i.shapeFlag){const e=s||n;m=Yn(c.call(e,e,u,r,f,d,p)),t=l}else{const i=e;l===r&&ii(),m=Yn(i.length>1?i(r,{get attrs(){return ii(),l},slots:a,emit:h}):i(r,null)),t=e.props?l:oi(l)}let y,S=m;if(m.patchFlag>0&&2048&m.patchFlag&&([S,y]=si(m)),!1!==e.inheritAttrs&&t){const e=Object.keys(t),{shapeFlag:i}=S;if(e.length)if(1&i||6&i)o&&e.some(g)&&(t=ai(t,o)),S=jn(S,t);else if(!ei&&S.type!==Fn){const t=Object.keys(l),e=[],i=[];for(let n=0,s=t.length;n renders non-element root node that cannot be animated."),S.transition=i.transition),y?y(S):m=S}catch(y){be(y,t,1),m=zn(Fn)}return Qe=null,m}const si=t=>{const e=t.children,i=t.dynamicChildren,n=ri(e);if(!n)return[t,void 0];const s=e.indexOf(n),r=i?i.indexOf(n):-1;return[Yn(n),n=>{e[s]=n,i&&(r>-1?i[r]=n:n.patchFlag>0&&(t.dynamicChildren=[...i,n]))}]};function ri(t){let e;for(let i=0;i{let e;for(const i in t)("class"===i||"style"===i||b(i))&&((e||(e={}))[i]=t[i]);return e},ai=(t,e)=>{const i={};for(const n in t)g(n)&&n.slice(9)in e||(i[n]=t[n]);return i},li=t=>6&t.shapeFlag||1&t.shapeFlag||t.type===Fn;function hi(t,e,i){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!0;for(let s=0;s slots expect a single root node."),t=e}return Yn(t)}let ui=0;const di=t=>ui+=t;function fi(t,e=Qe){if(!e)return t;const i=(...i)=>{ui||function(t=!1){On.push(Dn=t?null:[])}(!0);const n=Qe;ti(e);const s=t(...i);return ti(n),ui||(On.pop(),Dn=On[On.length-1]||null),s};return i._c=!0,i}function pi(t,e,i,n=!1){const s={},r={};z(r,Gn,1),mi(t,e,s,r),Ei(s,t),i?t.props=n?s:Yt(s,!1,yt,Vt):t.type.props?t.props=s:t.props=r,t.attrs=r}function mi(t,e,i,n){const[s,r]=t.propsOptions;if(e)for(const o in e){const r=e[o];if(N(o))continue;let a;s&&x(s,a=O(o))?i[a]=r:Ze(t.emitsOptions,o)||(n[o]=r)}if(r){const e=Jt(i);for(let n=0;n{o=!0;const[i,n]=gi(t,e,!0);y(s,i),n&&r.push(...n)};!i&&e.mixins.length&&e.mixins.forEach(n),t.extends&&n(t.extends),t.mixins&&t.mixins.forEach(n)}if(!n&&!o)return t.__props=d;if(E(n))for(let a=0;a-1,o[1]=i<0||t-1||x(o,"default"))&&r.push(e)}}}}return t.__props=[s,r]}function yi(t){return"$"!==t[0]||(ce(`Invalid prop name: "${t}" is a reserved property.`),!1)}function Si(t){const e=t&&t.toString().match(/^\s*function (\w+)/);return e?e[1]:""}function vi(t,e){return Si(t)===Si(e)}function xi(t,e){if(E(e)){for(let i=0,n=e.length;i"boolean"===t.toLowerCase()))}(s,r)&&(n+=` with value ${o}`);n+=`, got ${r} `,Pi(r)&&(n+=`with value ${a}.`);return n}(t,e,r))}o&&!o(e)&&ce('Invalid prop: custom validator check failed for prop "'+t+'".')}}const wi=e("String,Number,Boolean,Function,Symbol,BigInt");function Ti(t,e){let i;const n=Si(e);if(wi(n)){const s=typeof t;i=s===n.toLowerCase(),i||"object"!==s||(i=t instanceof e)}else i="Object"===n?P(t):"Array"===n?E(t):t instanceof e;return{valid:i,expectedType:n}}function Mi(t,e){return"String"===e?`"${t}"`:"Number"===e?`${Number(t)}`:`${t}`}function Pi(t){return["string","number","boolean"].some((e=>t.toLowerCase()===e))}function Li(t,e,i=fs,n=!1){if(i){const s=i[t]||(i[t]=[]),r=e.__weh||(e.__weh=(...n)=>{if(i.isUnmounted)return;nt(),ms(i);const s=me(e,i,t,n);return ms(null),st(),s});return n?s.unshift(r):s.push(r),r}ce(`${G(fe[t].replace(/ hook$/,""))} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`)}const Ai=t=>(e,i=fs)=>!Ss&&Li(t,e,i),Ci=Ai("bm"),Ii=Ai("m"),Ri=Ai("bu"),Ni=Ai("u"),Fi=Ai("bum"),Bi=Ai("um"),Oi=Ai("rtg"),Di=Ai("rtc"),ki={};function Vi(t,e,i){return w(e)||ce("`watch(fn, options?)` signature has been moved to a separate API. Use `watchEffect(fn, options?)` instead. `watch` now only supports `watch(source, cb, options?) signature."),Gi(t,e,i)}function Gi(t,e,{immediate:i,deep:n,flush:s,onTrack:r,onTrigger:o}=u,a=fs){e||(void 0!==i&&ce('watch() "immediate" option is only respected when using the watch(source, callback, options?) signature.'),void 0!==n&&ce('watch() "deep" option is only respected when using the watch(source, callback, options?) signature.'));const l=t=>{ce("Invalid watch source: ",t,"A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.")};let h,c,d=!1;if(Qt(t)?(h=()=>t.value,d=!!t._shallow):Kt(t)?(h=()=>t,n=!0):E(t)?h=()=>t.map((t=>Qt(t)?t.value:Kt(t)?Ui(t):w(t)?pe(t,a,2,[a&&a.proxy]):void l(t))):w(t)?h=e?()=>pe(t,a,2,[a&&a.proxy]):()=>{if(!a||!a.isUnmounted)return c&&c(),pe(t,a,3,[p])}:(h=f,l(t)),e&&n){const t=h;h=()=>Ui(t())}const p=t=>{c=y.options.onStop=()=>{pe(t,a,4)}};let m=E(t)?[]:ki;const b=()=>{if(y.active)if(e){const t=y();(n||d||W(t,m))&&(c&&c(),me(e,a,3,[t,m===ki?void 0:m,p]),m=t)}else y()};let g;b.allowRecurse=!!e,g="sync"===s?b:"post"===s?()=>xn(b,a&&a.suspense):()=>{!a||a.isMounted?function(t){Ne(t,Ee,xe,_e)}(b):b()};const y=J(h,{lazy:!0,onTrack:r,onTrigger:o,scheduler:g});return _s(y,a),e?i?b():m=y():"post"===s?xn(y,a&&a.suspense):y(),()=>{Z(y),a&&S(a.effects,y)}}function Wi(t,e,i){const n=this.proxy;return Gi(T(t)?()=>n[t]:t.bind(n),e.bind(n),i,this)}function Ui(t,e=new Set){if(!P(t)||e.has(t))return t;if(e.add(t),Qt(t))Ui(t.value,e);else if(E(t))for(let i=0;i{Ui(t,e)}));else for(const i in t)Ui(t[i],e);return t}const zi=[Function,Array],ji={name:"BaseTransition",props:{mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:zi,onEnter:zi,onAfterEnter:zi,onEnterCancelled:zi,onBeforeLeave:zi,onLeave:zi,onAfterLeave:zi,onLeaveCancelled:zi,onBeforeAppear:zi,onAppear:zi,onAfterAppear:zi,onAppearCancelled:zi},setup(t,{slots:e}){const i=ps(),n=function(){const t={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Ii((()=>{t.isMounted=!0})),Fi((()=>{t.isUnmounting=!0})),t}();let s;return()=>{const r=e.default&&$i(e.default(),!0);if(!r||!r.length)return;r.length>1&&ce(" can only be used on a single element or component. Use for lists.");const o=Jt(t),{mode:a}=o;a&&!["in-out","out-in","default"].includes(a)&&ce(`invalid mode: ${a}`);const l=r[0];if(n.isLeaving)return Yi(l);const h=Ki(l);if(!h)return Yi(l);const c=Xi(h,o,n,i);qi(h,c);const u=i.subTree,d=u&&Ki(u);let f=!1;const{getTransitionKey:p}=h.type;if(p){const t=p();void 0===s?s=t:t!==s&&(s=t,f=!0)}if(d&&d.type!==Fn&&(!Vn(h,d)||f)){const t=Xi(d,o,n,i);if(qi(d,t),"out-in"===a)return n.isLeaving=!0,t.afterLeave=()=>{n.isLeaving=!1,i.update()},Yi(l);"in-out"===a&&(t.delayLeave=(t,e,i)=>{Hi(n,d)[String(d.key)]=d,t._leaveCb=()=>{e(),t._leaveCb=void 0,delete c.delayedLeave},c.delayedLeave=i})}return l}}};function Hi(t,e){const{leavingVNodes:i}=t;let n=i.get(e.type);return n||(n=Object.create(null),i.set(e.type,n)),n}function Xi(t,e,i,n){const{appear:s,mode:r,persisted:o=!1,onBeforeEnter:a,onEnter:l,onAfterEnter:h,onEnterCancelled:c,onBeforeLeave:u,onLeave:d,onAfterLeave:f,onLeaveCancelled:p,onBeforeAppear:m,onAppear:b,onAfterAppear:g,onAppearCancelled:y}=e,S=String(t.key),v=Hi(i,t),x=(t,e)=>{t&&me(t,n,9,e)},E={mode:r,persisted:o,beforeEnter(e){let n=a;if(!i.isMounted){if(!s)return;n=m||a}e._leaveCb&&e._leaveCb(!0);const r=v[S];r&&Vn(t,r)&&r.el._leaveCb&&r.el._leaveCb(),x(n,[e])},enter(t){let e=l,n=h,r=c;if(!i.isMounted){if(!s)return;e=b||l,n=g||h,r=y||c}let o=!1;const a=t._enterCb=e=>{o||(o=!0,x(e?r:n,[t]),E.delayedLeave&&E.delayedLeave(),t._enterCb=void 0)};e?(e(t,a),e.length<=1&&a()):a()},leave(e,n){const s=String(t.key);if(e._enterCb&&e._enterCb(!0),i.isUnmounting)return n();x(u,[e]);let r=!1;const o=e._leaveCb=i=>{r||(r=!0,n(),x(i?p:f,[e]),e._leaveCb=void 0,v[s]===t&&delete v[s])};v[s]=t,d?(d(e,o),d.length<=1&&o()):o()},clone:t=>Xi(t,e,i,n)};return E}function Yi(t){if(Ji(t))return(t=jn(t)).children=null,t}function Ki(t){return Ji(t)?t.children?t.children[0]:void 0:t}function qi(t,e){6&t.shapeFlag&&t.component?qi(t.component.subTree,e):128&t.shapeFlag?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function $i(t,e=!1){let i=[],n=0;for(let s=0;s1)for(let s=0;st.type.__isKeepAlive;function Zi(t,e){tn(t,"a",e)}function Qi(t,e){tn(t,"da",e)}function tn(t,e,i=fs){const n=t.__wdc||(t.__wdc=()=>{let e=i;for(;e;){if(e.isDeactivated)return;e=e.parent}t()});if(Li(e,n,i),i){let t=i.parent;for(;t&&t.parent;)Ji(t.parent.vnode)&&en(n,e,i,t),t=t.parent}}function en(t,e,i,n){const s=Li(e,t,n,!0);Bi((()=>{S(n[e],s)}),i)}const nn=t=>"_"===t[0]||"$stable"===t,sn=t=>E(t)?t.map(Yn):[Yn(t)],rn=(t,e,i)=>fi((i=>(fs&&ce(`Slot "${t}" invoked outside of the render function: this will not track dependencies used in the slot. Invoke the slot function inside the render function instead.`),sn(e(i)))),i),on=(t,e)=>{const i=t._ctx;for(const n in t){if(nn(n))continue;const s=t[n];if(w(s))e[n]=rn(n,s,i);else if(null!=s){ce(`Non-function value encountered for slot "${n}". Prefer function slots for better performance.`);const t=sn(s);e[n]=()=>t}}},an=(t,e)=>{Ji(t.vnode)||ce("Non-function value encountered for default slot. Prefer function slots for better performance.");const i=sn(e);t.slots.default=()=>i},ln=e("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text");function hn(t){ln(t)&&ce("Do not use built-in directive ids as custom directive id: "+t)}function cn(t,e){const i=Qe;if(null===i)return ce("withDirectives can only be used inside render functions."),t;const n=i.proxy,s=t.dirs||(t.dirs=[]);for(let r=0;r(r.has(t)?ce("Plugin has already been applied to target app."):t&&w(t.install)?(r.add(t),t.install(a,...e)):w(t)?(r.add(t),t(a,...e)):ce('A plugin must either be a function or an object with an "install" function.'),a),mixin:t=>(s.mixins.includes(t)?ce("Mixin has already been applied to target app"+(t.name?`: ${t.name}`:"")):(s.mixins.push(t),(t.props||t.emits)&&(s.deopt=!0)),a),component:(t,e)=>(gs(t,s.config),e?(s.components[t]&&ce(`Component "${t}" has already been registered in target app.`),s.components[t]=e,a):s.components[t]),directive:(t,e)=>(hn(t),e?(s.directives[t]&&ce(`Directive "${t}" has already been registered in target app.`),s.directives[t]=e,a):s.directives[t]),mount(r,l){if(!o){const h=zn(i,n);return h.appContext=s,s.reload=()=>{t(jn(h),r)},l&&e?e(h,r):t(h,r),o=!0,a._container=r,r.__vue_app__=a,function(t,e){He&&He.emit("app:init",t,e,{Fragment:Rn,Text:Nn,Comment:Fn,Static:Bn})}(a,Ls),h.component.proxy}ce("App has already been mounted.\nIf you want to remount the same app, move your app creation logic into a factory function and create fresh app instances for each mount - e.g. `const createMyApp = () => createApp(App)`")},unmount(){o?(t(null,a._container),function(t){He&&He.emit("app:unmount",t)}(a),delete a._container.__vue_app__):ce("Cannot unmount an app that is not mounted.")},provide:(t,e)=>(t in s.provides&&ce(`App already provides property with key "${String(t)}". It will be overwritten with the new value.`),s.provides[t]=e,a)};return a}}function gn(t,e){t.appContext.config.performance&&Sn()&&pn.mark(`vue-${e}-${t.uid}`)}function yn(t,e){if(t.appContext.config.performance&&Sn()){const i=`vue-${e}-${t.uid}`,n=i+":end";pn.mark(n),pn.measure(`<${Ts(t,t.type)}> ${e}`,i,n),pn.clearMarks(i),pn.clearMarks(n)}}function Sn(){return void 0!==fn||("undefined"!=typeof window&&window.performance?(fn=!0,pn=window.performance):fn=!1),fn}function vn(t){return w(t)?{setup:t,name:t.name}:t}const xn=function(t,e){e&&e.pendingBranch?E(t)?e.effects.push(...t):e.effects.push(t):Fe(t)},En=(t,e,i,n)=>{if(E(t))return void t.forEach(((t,s)=>En(t,e&&(E(e)?e[s]:e),i,n)));let s;s=!n||(t=>!!t.type.__asyncLoader)(n)?null:4&n.shapeFlag?n.component.exposed||n.component.proxy:n.el;const{i:r,r:o}=t;if(!r)return void ce("Missing ref owner context. ref cannot be used on hoisted vnodes. A vnode with ref must be created inside the render function.");const a=e&&e.r,l=r.refs===u?r.refs={}:r.refs,h=r.setupState;if(null!=a&&a!==o&&(T(a)?(l[a]=null,x(h,a)&&(h[a]=null)):Qt(a)&&(a.value=null)),T(o)){const t=()=>{l[o]=s,x(h,o)&&(h[o]=s)};s?(t.id=-1,xn(t,i)):t()}else if(Qt(o)){const t=()=>{o.value=s};s?(t.id=-1,xn(t,i)):t()}else w(o)?pe(o,r,12,[s,l]):ce("Invalid template ref type:",s,`(${typeof s})`)};function _n(t){return function(t,e){const{insert:i,remove:n,patchProp:s,forcePatchProp:r,createElement:o,createText:a,createComment:l,setText:h,setElementText:c,parentNode:p,nextSibling:m,setScopeId:b=f,cloneNode:g,insertStaticContent:S}=t,v=(t,e,i,n=null,s=null,r=null,o=!1,a=!1)=>{t&&!Vn(t,e)&&(n=at(t),Q(t,s,r,!0),t=null),-2===e.patchFlag&&(a=!1,e.dynamicChildren=null);const{type:l,ref:h,shapeFlag:c}=e;switch(l){case Nn:E(t,e,i,n);break;case Fn:_(t,e,i,n);break;case Bn:null==t?w(e,i,n,o):T(t,e,i,o);break;case Rn:V(t,e,i,n,s,r,o,a);break;default:1&c?A(t,e,i,n,s,r,o,a):6&c?G(t,e,i,n,s,r,o,a):64&c||128&c?l.process(t,e,i,n,s,r,o,a,ht):ce("Invalid VNode type:",l,`(${typeof l})`)}null!=h&&s&&En(h,t&&t.ref,r,e)},E=(t,e,n,s)=>{if(null==t)i(e.el=a(e.children),n,s);else{const i=e.el=t.el;e.children!==t.children&&h(i,e.children)}},_=(t,e,n,s)=>{null==t?i(e.el=l(e.children||""),n,s):e.el=t.el},w=(t,e,i,n)=>{[t.el,t.anchor]=S(t.children,e,i,n)},T=(t,e,i,n)=>{if(e.children!==t.children){const s=m(t.anchor);P(t),[e.el,e.anchor]=S(e.children,i,s,n)}else e.el=t.el,e.anchor=t.anchor},M=({el:t,anchor:e},n,s)=>{let r;for(;t&&t!==e;)r=m(t),i(t,n,s),t=r;i(e,n,s)},P=({el:t,anchor:e})=>{let i;for(;t&&t!==e;)i=m(t),n(t),t=i;n(e)},A=(t,e,i,n,s,r,o,a)=>{o=o||"svg"===e.type,null==t?C(e,i,n,s,r,o,a):F(t,e,s,r,o,a)},C=(t,e,n,r,a,l,h)=>{let u,d;const{type:f,props:p,shapeFlag:m,transition:b,scopeId:g,patchFlag:y,dirs:S}=t;if(u=t.el=o(t.type,l,p&&p.is),8&m?c(u,t.children):16&m&&R(t.children,u,null,r,a,l&&"foreignObject"!==f,h||!!t.dynamicChildren),S&&un(t,null,r,"created"),p){for(const e in p)N(e)||s(u,e,null,p[e],l,t.children,r,a,rt);(d=p.onVnodeBeforeMount)&&wn(d,r,t)}I(u,g,t,r),Object.defineProperty(u,"__vnode",{value:t,enumerable:!1}),Object.defineProperty(u,"__vueParentComponent",{value:r,enumerable:!1}),S&&un(t,null,r,"beforeMount");const v=(!a||a&&!a.pendingBranch)&&b&&!b.persisted;v&&b.beforeEnter(u),i(u,e,n),((d=p&&p.onVnodeMounted)||v||S)&&xn((()=>{d&&wn(d,r,t),v&&b.enter(u),S&&un(t,null,r,"mounted")}),a)},I=(t,e,i,n)=>{if(e&&b(t,e),n){const s=n.type.__scopeId;s&&s!==e&&b(t,s+"-s");let r=n.subTree;r.type===Rn&&(r=ri(r.children)||r),i===r&&I(t,n.vnode.scopeId,n.vnode,n.parent)}},R=(t,e,i,n,s,r,o,a=0)=>{for(let l=a;l{const l=e.el=t.el;let{patchFlag:h,dynamicChildren:d,dirs:f}=e;h|=16&t.patchFlag;const p=t.props||u,m=e.props||u;let b;if((b=m.onVnodeBeforeUpdate)&&wn(b,i,e,t),f&&un(e,t,i,"beforeUpdate"),Ge&&(h=0,a=!1,d=null),h>0){if(16&h)D(l,e,p,m,i,n,o);else if(2&h&&p.class!==m.class&&s(l,"class",null,m.class,o),4&h&&s(l,"style",p.style,m.style,o),8&h){const a=e.dynamicProps;for(let e=0;e{b&&wn(b,i,e,t),f&&un(e,t,i,"updated")}),n)},B=(t,e,i,n,s,r)=>{for(let o=0;o{if(i!==n){for(const h in n){if(N(h))continue;const c=n[h],u=i[h];(c!==u||r&&r(t,h))&&s(t,h,u,c,l,e.children,o,a,rt)}if(i!==u)for(const r in i)N(r)||r in n||s(t,r,i[r],null,l,e.children,o,a,rt)}},V=(t,e,n,s,r,o,l,h)=>{const c=e.el=t?t.el:a(""),u=e.anchor=t?t.anchor:a("");let{patchFlag:d,dynamicChildren:f}=e;d>0&&(h=!0),Ge&&(d=0,h=!1,f=null),null==t?(i(c,n,s),i(u,n,s),R(e.children,n,u,r,o,l,h)):d>0&&64&d&&f&&t.dynamicChildren?(B(t.dynamicChildren,f,n,r,o,l),r&&r.type.__hmrId?Tn(t,e):(null!=e.key||r&&e===r.subTree)&&Tn(t,e,!0)):Y(t,e,n,u,r,o,l,h)},G=(t,e,i,n,s,r,o,a)=>{null==t?512&e.shapeFlag?s.ctx.activate(e,i,n,o,a):W(e,i,n,s,r,o,a):j(t,e,a)},W=(t,e,i,n,s,r,o)=>{const a=t.component=function(t,e,i){const n=t.type,s=(e?e.appContext:t.appContext)||us,r={uid:ds++,vnode:t,type:n,parent:e,appContext:s,root:null,next:null,subTree:null,update:null,render:null,proxy:null,exposed:null,withProxy:null,effects:null,provides:e?e.provides:Object.create(s.provides),accessCache:null,renderCache:[],components:null,directives:null,propsOptions:gi(n,s),emitsOptions:Je(n,s),emit:null,emitted:null,ctx:u,data:u,props:u,attrs:u,slots:u,refs:u,setupState:u,setupContext:null,suspense:i,suspenseId:i?i.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null};return r.ctx=function(t){const e={};Object.defineProperty(e,"_",{configurable:!0,enumerable:!1,get:()=>t}),Object.keys(ls).forEach((i=>{Object.defineProperty(e,i,{configurable:!0,enumerable:!1,get:()=>ls[i](t),set:f})}));const{globalProperties:i}=t.appContext.config;return Object.keys(i).forEach((t=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get:()=>i[t],set:f})})),e}(r),r.root=e?e.root:r,r.emit=$e.bind(null,r),r}(t,n,s);if(a.type.__hmrId&&function(t){const e=t.type.__hmrId;let i=Ue.get(e);i||(ze(e,t.type),i=Ue.get(e)),i.instances.add(t)}(a),le(t),gn(a,"mount"),Ji(t)&&(a.ctx.renderer=ht),gn(a,"init"),function(t,e=!1){Ss=e;const{props:i,children:n}=t.vnode,s=ys(t);pi(t,i,s,e),((t,e)=>{if(32&t.vnode.shapeFlag){const i=e._;i?(t.slots=e,z(e,"_",i)):on(e,t.slots={})}else t.slots={},e&&an(t,e);z(t.slots,Gn,1)})(t,n);const r=s?function(t,e){const i=t.type;i.name&&gs(i.name,t.appContext.config);if(i.components){const e=Object.keys(i.components);for(let i=0;i{Object.defineProperty(e,i,{enumerable:!0,configurable:!0,get:()=>t.props[i],set:f})}))}(t);const{setup:n}=i;if(n){const i=t.setupContext=n.length>1?function(t){const e=e=>{t.exposed&&ce("expose() should be called only once per setup()."),t.exposed=se(e)};return Object.freeze({get props(){return t.props},get attrs(){return new Proxy(t.attrs,Es)},get slots(){return Xt(t.slots)},get emit(){return(e,...i)=>t.emit(e,...i)},expose:e})}(t):null;fs=t,nt();const s=pe(n,t,0,[Xt(t.props),i]);if(st(),fs=null,L(s)){if(e)return s.then((e=>{vs(t,e)}));t.asyncDep=s}else vs(t,s)}else xs(t)}(t,e):void 0;Ss=!1}(a),yn(a,"init"),a.asyncDep){if(s&&s.registerDep(a,H),!t.el){const t=a.subTree=zn(Fn);_(null,t,e,i)}}else H(a,t,e,i,s,r,o),he(),yn(a,"mount")},j=(t,e,i)=>{const n=e.component=t.component;if(function(t,e,i){const{props:n,children:s,component:r}=t,{props:o,children:a,patchFlag:l}=e,h=r.emitsOptions;if((s||a)&&Ge)return!0;if(e.dirs||e.transition)return!0;if(!(i&&l>=0))return!(!s&&!a||a&&a.$stable)||n!==o&&(n?!o||hi(n,o,h):!!o);if(1024&l)return!0;if(16&l)return n?hi(n,o,h):!!o;if(8&l){const t=e.dynamicProps;for(let e=0;e-1&&Se.splice(e,1)}(n.update),n.update()}else e.component=t.component,e.el=t.el,n.vnode=e},H=(t,e,i,n,s,r,o)=>{t.update=J((function(){if(t.isMounted){let e,{next:i,bu:n,u:a,parent:l,vnode:h}=t,c=i;le(i||t.vnode),i?(i.el=h.el,X(t,i,o)):i=h,n&&U(n),(e=i.props&&i.props.onVnodeBeforeUpdate)&&wn(e,l,i,h),gn(t,"render");const u=ni(t);yn(t,"render");const d=t.subTree;t.subTree=u,gn(t,"patch"),v(d,u,p(d.el),at(d),t,s,r),yn(t,"patch"),i.el=u.el,null===c&&function({vnode:t,parent:e},i){for(;e&&e.subTree===t;)(t=e.vnode).el=i,e=e.parent}(t,u.el),a&&xn(a,s),(e=i.props&&i.props.onVnodeUpdated)&&xn((()=>{wn(e,l,i,h)}),s),Ye(t),he()}else{let o;const{el:a,props:l}=e,{bm:h,m:c,parent:u}=t;h&&U(h),(o=l&&l.onVnodeBeforeMount)&&wn(o,u,e),gn(t,"render");const d=t.subTree=ni(t);if(yn(t,"render"),a&&ut?(gn(t,"hydrate"),ut(e.el,d,t,s),yn(t,"hydrate")):(gn(t,"patch"),v(null,d,i,n,t,s,r),yn(t,"patch"),e.el=d.el),c&&xn(c,s),o=l&&l.onVnodeMounted){const t=e;xn((()=>{wn(o,u,t)}),s)}const{a:f}=t;f&&256&e.shapeFlag&&xn(f,s),t.isMounted=!0,Xe(t),e=i=n=null}}),function(t){return{scheduler:Ie,allowRecurse:!0,onTrack:t.rtc?e=>U(t.rtc,e):void 0,onTrigger:t.rtg?e=>U(t.rtg,e):void 0}}(t))},X=(t,e,i)=>{e.component=t;const n=t.vnode.props;t.vnode=e,t.next=null,function(t,e,i,n){const{props:s,attrs:r,vnode:{patchFlag:o}}=t,a=Jt(s),[l]=t.propsOptions;if(t.type.__hmrId||t.parent&&t.parent.type.__hmrId||!(n||o>0)||16&o){let n;mi(t,e,s,r);for(const r in a)e&&(x(e,r)||(n=k(r))!==r&&x(e,n))||(l?!i||void 0===i[r]&&void 0===i[n]||(s[r]=bi(l,e||u,r,void 0,t)):delete s[r]);if(r!==a)for(const t in r)e&&x(e,t)||delete r[t]}else if(8&o){const i=t.vnode.dynamicProps;for(let n=0;n{const{vnode:i,slots:n}=t;let s=!0,r=u;if(32&i.shapeFlag){const t=e._;t?Ge?y(n,e):1===t?s=!1:y(n,e):(s=!e.$stable,on(e,n)),r=e}else e&&(an(t,e),r={default:1});if(s)for(const o in n)nn(o)||o in r||delete n[o]})(t,e.children),Be(void 0,t.update)},Y=(t,e,i,n,s,r,o,a=!1)=>{const l=t&&t.children,h=t?t.shapeFlag:0,u=e.children,{patchFlag:d,shapeFlag:f}=e;if(d>0){if(128&d)return void q(l,u,i,n,s,r,o,a);if(256&d)return void K(l,u,i,n,s,r,o,a)}8&f?(16&h&&rt(l,s,r),u!==l&&c(i,u)):16&h?16&f?q(l,u,i,n,s,r,o,a):rt(l,s,r,!0):(8&h&&c(i,""),16&f&&R(u,i,n,s,r,o,a))},K=(t,e,i,n,s,r,o,a)=>{e=e||d;const l=(t=t||d).length,h=e.length,c=Math.min(l,h);let u;for(u=0;uh?rt(t,s,r,!0,!1,c):R(e,i,n,s,r,o,a,c)},q=(t,e,i,n,s,r,o,a)=>{let l=0;const h=e.length;let c=t.length-1,u=h-1;for(;l<=c&&l<=u;){const n=t[l],h=e[l]=a?Kn(e[l]):Yn(e[l]);if(!Vn(n,h))break;v(n,h,i,null,s,r,o,a),l++}for(;l<=c&&l<=u;){const n=t[c],l=e[u]=a?Kn(e[u]):Yn(e[u]);if(!Vn(n,l))break;v(n,l,i,null,s,r,o,a),c--,u--}if(l>c){if(l<=u){const t=u+1,c=tu)for(;l<=c;)Q(t[l],s,r,!0),l++;else{const f=l,p=l,m=new Map;for(l=p;l<=u;l++){const t=e[l]=a?Kn(e[l]):Yn(e[l]);null!=t.key&&(m.has(t.key)&&ce("Duplicate keys found during update:",JSON.stringify(t.key),"Make sure keys are unique."),m.set(t.key,l))}let b,g=0;const y=u-p+1;let S=!1,x=0;const E=new Array(y);for(l=0;l=y){Q(n,s,r,!0);continue}let h;if(null!=n.key)h=m.get(n.key);else for(b=p;b<=u;b++)if(0===E[b-p]&&Vn(n,e[b])){h=b;break}void 0===h?Q(n,s,r,!0):(E[h-p]=l+1,h>=x?x=h:S=!0,v(n,e[h],i,null,s,r,o,a),g++)}const _=S?function(t){const e=t.slice(),i=[0];let n,s,r,o,a;const l=t.length;for(n=0;n0&&(e[n]=i[r-1]),i[r]=n)}}r=i.length,o=i[r-1];for(;r-- >0;)i[r]=o,o=e[o];return i}(E):d;for(b=_.length-1,l=y-1;l>=0;l--){const t=p+l,a=e[t],c=t+1{const{el:o,type:a,transition:l,children:h,shapeFlag:c}=t;if(6&c)return void $(t.component.subTree,e,n,s);if(128&c)return void t.suspense.move(e,n,s);if(64&c)return void a.move(t,e,n,ht);if(a===Rn){i(o,e,n);for(let t=0;tl.enter(o)),r);else{const{leave:t,delayLeave:s,afterLeave:r}=l,a=()=>i(o,e,n),h=()=>{t(o,(()=>{a(),r&&r()}))};s?s(o,a,h):h()}else i(o,e,n)},Q=(t,e,i,n=!1,s=!1)=>{const{type:r,props:o,ref:a,children:l,dynamicChildren:h,shapeFlag:c,patchFlag:u,dirs:d}=t;if(null!=a&&En(a,null,i,null),256&c)return void e.ctx.deactivate(t);const f=1&c&&d;let p;if((p=o&&o.onVnodeBeforeUnmount)&&wn(p,e,t),6&c)it(t.component,i,n);else{if(128&c)return void t.suspense.unmount(i,n);f&&un(t,null,e,"beforeUnmount"),h&&(r!==Rn||u>0&&64&u)?rt(h,e,i,!1,!0):(r===Rn&&(128&u||256&u)||!s&&16&c)&&rt(l,e,i),64&c&&(n||!Mn(t.props))&&t.type.remove(t,ht),n&&tt(t)}((p=o&&o.onVnodeUnmounted)||f)&&xn((()=>{p&&wn(p,e,t),f&&un(t,null,e,"unmounted")}),i)},tt=t=>{const{type:e,el:i,anchor:s,transition:r}=t;if(e===Rn)return void et(i,s);if(e===Bn)return void P(t);const o=()=>{n(i),r&&!r.persisted&&r.afterLeave&&r.afterLeave()};if(1&t.shapeFlag&&r&&!r.persisted){const{leave:e,delayLeave:n}=r,s=()=>e(i,o);n?n(t.el,o,s):s()}else o()},et=(t,e)=>{let i;for(;t!==e;)i=m(t),n(t),t=i;n(e)},it=(t,e,i)=>{t.type.__hmrId&&function(t){Ue.get(t.type.__hmrId).instances.delete(t)}(t);const{bum:n,effects:s,update:r,subTree:o,um:a}=t;if(n&&U(n),s)for(let l=0;l{t.isUnmounted=!0}),e),e&&e.pendingBranch&&!e.isUnmounted&&t.asyncDep&&!t.asyncResolved&&t.suspenseId===e.pendingId&&(e.deps--,0===e.deps&&e.resolve()),Ke(t)},rt=(t,e,i,n=!1,s=!1,r=0)=>{for(let o=r;o6&t.shapeFlag?at(t.component.subTree):128&t.shapeFlag?t.suspense.next():m(t.anchor||t.el),lt=(t,e)=>{null==t?e._vnode&&Q(e._vnode,null,null,!0):v(e._vnode||null,t,e),Oe(),e._vnode=t},ht={p:v,um:Q,m:$,r:tt,mt:W,mc:R,pc:Y,pbc:B,n:at,o:t};let ct,ut;e&&([ct,ut]=e(ht));return{render:lt,hydrate:ct,createApp:bn(lt,ct)}}(t)}function wn(t,e,i,n=null){me(t,e,7,[i,n])}function Tn(t,e,i=!1){const n=t.children,s=e.children;if(E(n)&&E(s))for(let r=0;rt&&(t.disabled||""===t.disabled),Pn=t=>"undefined"!=typeof SVGElement&&t instanceof SVGElement,Ln=(t,e)=>{const i=t&&t.to;if(T(i)){if(e){const t=e(i);return t||ce(`Failed to locate Teleport target with selector "${i}". Note the target element must exist before the component is mounted - i.e. the target cannot be rendered by the component itself, and ideally should be outside of the entire Vue component tree.`),t}return ce("Current renderer does not support string target for Teleports. (missing querySelector renderer option)"),null}return i||Mn(t)||ce(`Invalid Teleport target: ${i}`),i};function An(t,e,i,{o:{insert:n},m:s},r=2){0===r&&n(t.targetAnchor,e,i);const{el:o,anchor:a,shapeFlag:l,children:h,props:c}=t,u=2===r;if(u&&n(o,e,i),(!u||Mn(c))&&16&l)for(let d=0;d{16&g&&h(y,t,e,s,r,o,a)};b?S(i,l):c&&S(c,u)}else{e.el=t.el;const n=e.anchor=t.anchor,h=e.target=t.target,d=e.targetAnchor=t.targetAnchor,p=Mn(t.props),m=p?i:h,g=p?n:d;if(o=o||Pn(h),e.dynamicChildren?(u(t.dynamicChildren,e.dynamicChildren,m,s,r,o),Tn(t,e,!0)):a||c(t,e,m,g,s,r,o),b)p||An(e,i,n,l,1);else if((e.props&&e.props.to)!==(t.props&&t.props.to)){const t=e.target=Ln(e.props,f);t?An(e,t,null,l,0):ce("Invalid Teleport target on update:",h,`(${typeof h})`)}else p&&An(e,h,d,l,1)}},remove(t,{r:e,o:{remove:i}}){const{shapeFlag:n,children:s,anchor:r}=t;if(i(r),16&n)for(let o=0;onull!=t?t:null,Un=({ref:t})=>null!=t?T(t)||Qt(t)||w(t)?{i:Qe,r:t}:t:null,zn=(...t)=>function(t,e=null,i=null,n=0,r=null,o=!1){t&&t!==In||(t||ce(`Invalid vnode type when creating vnode: ${t}.`),t=Fn);if(kn(t)){const n=jn(t,e,!0);return i&&qn(n,i),n}Ms(t)&&(t=t.__vccOpts);if(e){($t(e)||Gn in e)&&(e=y({},e));let{class:t,style:i}=e;t&&!T(t)&&(e.class=l(t)),P(i)&&($t(i)&&!E(i)&&(i=y({},i)),e.style=s(i))}const a=T(t)?1:(t=>t.__isSuspense)(t)?128:(t=>t.__isTeleport)(t)?64:P(t)?4:w(t)?2:0;4&a&&$t(t)&&ce("Vue received a Component which was made a reactive object. This can lead to unnecessary performance overhead, and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.","\nComponent that was made reactive: ",t=Jt(t));const h={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Wn(e),ref:e&&Un(e),scopeId:null,children:null,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:n,dynamicProps:r,dynamicChildren:null,appContext:null};h.key!=h.key&&ce("VNode created with invalid key (NaN). VNode type:",h.type);if(qn(h,i),128&a){const{content:t,fallback:e}=function(t){const{shapeFlag:e,children:i}=t;let n,s;return 32&e?(n=ci(i.default),s=ci(i.fallback)):(n=ci(i),s=Yn(null)),{content:n,fallback:s}}(h);h.ssContent=t,h.ssFallback=e}!o&&Dn&&(n>0||6&a)&&32!==n&&Dn.push(h);return h}(...t);function jn(t,e,i=!1){const{props:n,ref:s,patchFlag:r,children:o}=t,a=e?$n(n||{},e):n;return{__v_isVNode:!0,__v_skip:!0,type:t.type,props:a,key:a&&Wn(a),ref:e&&e.ref?i&&s?E(s)?s.concat(Un(e)):[s,Un(e)]:Un(e):s,scopeId:t.scopeId,children:-1===r&&E(o)?o.map(Hn):o,target:t.target,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Rn?-1===r?16:16|r:r,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:t.transition,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&jn(t.ssContent),ssFallback:t.ssFallback&&jn(t.ssFallback),el:t.el,anchor:t.anchor}}function Hn(t){const e=jn(t);return E(t.children)&&(e.children=t.children.map(Hn)),e}function Xn(t=" ",e=0){return zn(Nn,null,t,e)}function Yn(t){return null==t||"boolean"==typeof t?zn(Fn):E(t)?zn(Rn,null,t):"object"==typeof t?null===t.el?t:jn(t):zn(Nn,null,String(t))}function Kn(t){return null===t.el?t:jn(t)}function qn(t,e){let i=0;const{shapeFlag:n}=t;if(null==e)e=null;else if(E(e))i=16;else if("object"==typeof e){if(1&n||64&n){const i=e.default;return void(i&&(i._c&&di(1),qn(t,i()),i._c&&di(-1)))}{i=32;const n=e._;n||Gn in e?3===n&&Qe&&(1024&Qe.vnode.patchFlag?(e._=2,t.patchFlag|=1024):e._=1):e._ctx=Qe}}else w(e)?(e={default:e,_ctx:Qe},i=32):(e=String(e),64&n?(i=16,e=[Xn(e)]):i=8);t.children=e,t.shapeFlag|=i}function $n(...t){const e=y({},t[0]);for(let i=1;i1)return i&&w(e)?e():e;ce(`injection "${String(t)}" not found.`)}else ce("inject() can only be used inside setup() or functional components.")}let Zn=!1;function Qn(t,e,i=[],n=[],s=[],r=!1){const{mixins:o,extends:a,data:l,computed:h,methods:c,watch:d,provide:p,inject:m,components:b,directives:g,beforeMount:S,mounted:v,beforeUpdate:x,updated:_,activated:T,deactivated:M,beforeDestroy:L,beforeUnmount:A,destroyed:C,unmounted:I,render:R,renderTracked:N,renderTriggered:F,errorCaptured:B,expose:O}=e,D=t.proxy,k=t.ctx,V=t.appContext.mixins;r&&R&&t.render===f&&(t.render=R),r||(Zn=!0,ts("beforeCreate","bc",e,t,V),Zn=!1,ns(t,V,i,n,s)),a&&Qn(t,a,i,n,s,!0),o&&ns(t,o,i,n,s);const G=function(){const t=Object.create(null);return(e,i)=>{t[i]?ce(`${e} property "${i}" is already defined in ${t[i]}.`):t[i]=e}}();{const[e]=t.propsOptions;if(e)for(const t in e)G("Props",t)}if(m)if(E(m))for(let u=0;uss(t,e,D))),l&&ss(t,l,D);{const e=Jt(t.data);for(const t in e)G("Data",t),"$"!==t[0]&&"_"!==t[0]&&Object.defineProperty(k,t,{configurable:!0,enumerable:!0,get:()=>e[t],set:f})}}if(h)for(const u in h){const t=h[u],e=w(t)?t.bind(D,D):w(t.get)?t.get.bind(D,D):f;e===f&&ce(`Computed property "${u}" has no getter.`);const i=Ps({get:e,set:!w(t)&&w(t.set)?t.set.bind(D):()=>{ce(`Write operation failed: computed property "${u}" is readonly.`)}});Object.defineProperty(k,u,{enumerable:!0,configurable:!0,get:()=>i.value,set:t=>i.value=t}),G("Computed",u)}if(d&&n.push(d),!r&&n.length&&n.forEach((t=>{for(const e in t)rs(t[e],k,D,e)})),p&&s.push(p),!r&&s.length&&s.forEach((t=>{const e=w(t)?t.call(D):t;Reflect.ownKeys(e).forEach((t=>{!function(t,e){if(fs){let i=fs.provides;const n=fs.parent&&fs.parent.provides;n===i&&(i=fs.provides=Object.create(n)),i[t]=e}else ce("provide() can only be used inside setup().")}(t,e[t])}))})),r&&(b&&y(t.components||(t.components=y({},t.type.components)),b),g&&y(t.directives||(t.directives=y({},t.type.directives)),g)),r||ts("created","c",e,t,V),S&&Ci(S.bind(D)),v&&Ii(v.bind(D)),x&&Ri(x.bind(D)),_&&Ni(_.bind(D)),T&&Zi(T.bind(D)),M&&Qi(M.bind(D)),B&&((t,e=fs)=>{Li("ec",t,e)})(B.bind(D)),N&&Di(N.bind(D)),F&&Oi(F.bind(D)),L&&ce("`beforeDestroy` has been renamed to `beforeUnmount`."),A&&Fi(A.bind(D)),C&&ce("`destroyed` has been renamed to `unmounted`."),I&&Bi(I.bind(D)),E(O))if(r)ce("The `expose` option is ignored when used in mixins.");else if(O.length){const e=t.exposed||(t.exposed=se({}));O.forEach((t=>{e[t]=function(t,e){return Qt(t[e])?t[e]:new re(t,e)}(D,t)}))}else t.exposed||(t.exposed=u)}function ts(t,e,i,n,s){is(t,e,s,n);const{extends:r,mixins:o}=i;r&&es(t,e,r,n),o&&is(t,e,o,n);const a=i[t];a&&me(a.bind(n.proxy),n,e)}function es(t,e,i,n){i.extends&&es(t,e,i.extends,n);const s=i[t];s&&me(s.bind(n.proxy),n,e)}function is(t,e,i,n){for(let s=0;s."),P(n)?t.data===u?t.data=jt(n):y(t.data,n):ce("data() should return an object.")}function rs(t,e,i,n){const s=n.includes(".")?function(t,e){const i=e.split(".");return()=>{let e=t;for(let t=0;ti[n];if(T(t)){const i=e[t];w(i)?Vi(s,i):ce(`Invalid watch handler specified by key "${t}"`,i)}else if(w(t))Vi(s,t.bind(i));else if(P(t))if(E(t))t.forEach((t=>rs(t,e,i,n)));else{const n=w(t.handler)?t.handler.bind(i):e[t.handler];w(n)?Vi(s,n,t):ce(`Invalid watch handler specified by key "${t.handler}"`,n)}else ce(`Invalid watch option: "${n}"`,t)}function os(t,e,i){const n=i.appContext.config.optionMergeStrategies,{mixins:s,extends:r}=e;r&&os(t,r,i),s&&s.forEach((e=>os(t,e,i)));for(const o in e)n&&x(n,o)?t[o]=n[o](t[o],e[o],i.proxy,o):t[o]=e[o]}const as=t=>t?ys(t)?t.exposed?t.exposed:t.proxy:as(t.parent):null,ls=y(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>Xt(t.props),$attrs:t=>Xt(t.attrs),$slots:t=>Xt(t.slots),$refs:t=>Xt(t.refs),$parent:t=>as(t.parent),$root:t=>as(t.root),$emit:t=>t.emit,$options:t=>function(t){const e=t.type,{__merged:i,mixins:n,extends:s}=e;if(i)return i;const r=t.appContext.mixins;if(!r.length&&!n&&!s)return e;const o={};return r.forEach((e=>os(o,e,t))),os(o,e,t),e.__merged=o}(t),$forceUpdate:t=>()=>Ie(t.update),$nextTick:t=>Ce.bind(t.proxy),$watch:t=>Wi.bind(t)}),hs={get({_:t},e){const{ctx:i,setupState:n,data:s,props:r,accessCache:o,type:a,appContext:l}=t;if("__v_skip"===e)return!0;if("__isVue"===e)return!0;let h;if("$"!==e[0]){const a=o[e];if(void 0!==a)switch(a){case 0:return n[e];case 1:return s[e];case 3:return i[e];case 2:return r[e]}else{if(n!==u&&x(n,e))return o[e]=0,n[e];if(s!==u&&x(s,e))return o[e]=1,s[e];if((h=t.propsOptions[0])&&x(h,e))return o[e]=2,r[e];if(i!==u&&x(i,e))return o[e]=3,i[e];Zn||(o[e]=4)}}const c=ls[e];let d,f;return c?("$attrs"===e&&(rt(t,"get",e),ii()),c(t)):(d=a.__cssModules)&&(d=d[e])?d:i!==u&&x(i,e)?(o[e]=3,i[e]):(f=l.config.globalProperties,x(f,e)?f[e]:void(!Qe||T(e)&&0===e.indexOf("__v")||(s===u||"$"!==e[0]&&"_"!==e[0]||!x(s,e)?t===Qe&&ce(`Property ${JSON.stringify(e)} was accessed during render but is not defined on instance.`):ce(`Property ${JSON.stringify(e)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`))))},set({_:t},e,i){const{data:n,setupState:s,ctx:r}=t;if(s!==u&&x(s,e))s[e]=i;else if(n!==u&&x(n,e))n[e]=i;else if(x(t.props,e))return ce(`Attempting to mutate prop "${e}". Props are readonly.`,t),!1;return"$"===e[0]&&e.slice(1)in t?(ce(`Attempting to mutate public property "${e}". Properties starting with $ are reserved and readonly.`,t),!1):(e in t.appContext.config.globalProperties?Object.defineProperty(r,e,{enumerable:!0,configurable:!0,value:i}):r[e]=i,!0)},has({_:{data:t,setupState:e,accessCache:i,ctx:n,appContext:s,propsOptions:r}},o){let a;return void 0!==i[o]||t!==u&&x(t,o)||e!==u&&x(e,o)||(a=r[0])&&x(a,o)||x(n,o)||x(ls,o)||x(s.config.globalProperties,o)},ownKeys:t=>(ce("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(t))},cs=y({},hs,{get(t,e){if(e!==Symbol.unscopables)return hs.get(t,e,t)},has(t,e){const n="_"!==e[0]&&!i(e);return!n&&hs.has(t,e)&&ce(`Property ${JSON.stringify(e)} should not start with _ which is a reserved prefix for Vue internals.`),n}});const us=dn();let ds=0;let fs=null;const ps=()=>fs||Qe,ms=t=>{fs=t},bs=e("slot,component");function gs(t,e){const i=e.isNativeTag||p;(bs(t)||i(t))&&ce("Do not use built-in or reserved HTML elements as component id: "+t)}function ys(t){return 4&t.vnode.shapeFlag}let Ss=!1;function vs(t,e,i){w(e)?t.render=e:P(e)?(kn(e)&&ce("setup() should not return VNodes directly - return a render function instead."),t.devtoolsRawSetupState=e,t.setupState=se(e),function(t){const{ctx:e,setupState:i}=t;Object.keys(Jt(i)).forEach((t=>{"$"!==t[0]&&"_"!==t[0]?Object.defineProperty(e,t,{enumerable:!0,configurable:!0,get:()=>i[t],set:f}):ce(`setup() return property ${JSON.stringify(t)} should not start with "$" or "_" which are reserved prefixes for Vue internals.`)}))}(t)):void 0!==e&&ce("setup() should return an object. Received: "+(null===e?"null":typeof e)),xs(t)}function xs(t,e){const i=t.type;t.render||(t.render=i.render||f,t.render._rc&&(t.withProxy=new Proxy(t.ctx,cs))),fs=t,nt(),Qn(t,i),st(),fs=null,i.render||t.render!==f||(i.template?ce('Component provided template option but runtime compilation is not supported in this build of Vue. Configure your bundler to alias "vue" to "vue/dist/vue.esm-bundler.js".'):ce("Component is missing template or render function."))}const Es={get:(t,e)=>(ii(),t[e]),set:()=>(ce("setupContext.attrs is readonly."),!1),deleteProperty:()=>(ce("setupContext.attrs is readonly."),!1)};function _s(t,e=fs){e&&(e.effects||(e.effects=[])).push(t)}const ws=/(?:^|[-_])(\w)/g;function Ts(t,e,i=!1){let n=function(t){return w(t)&&t.displayName||t.name}(e);if(!n&&e.__file){const t=e.__file.match(/([^/\\]+)\.\w+$/);t&&(n=t[1])}if(!n&&t&&t.parent){const i=t=>{for(const i in t)if(t[i]===e)return i};n=i(t.components||t.parent.type.components)||i(t.appContext.components)}return n?n.replace(ws,(t=>t.toUpperCase())).replace(/[-_]/g,""):i?"App":"Anonymous"}function Ms(t){return w(t)&&"__vccOpts"in t}function Ps(t){const e=function(t){let e,i;return w(t)?(e=t,i=()=>{console.warn("Write operation failed: computed value is readonly")}):(e=t.get,i=t.set),new oe(e,i,w(t)||!t.set)}(t);return _s(e.effect),e}const Ls="3.0.6",As="http://www.w3.org/2000/svg",Cs="undefined"!=typeof document?document:null;let Is,Rs;const Ns={insert:(t,e,i)=>{e.insertBefore(t,i||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,i)=>e?Cs.createElementNS(As,t):Cs.createElement(t,i?{is:i}:void 0),createText:t=>Cs.createTextNode(t),createComment:t=>Cs.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Cs.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},cloneNode:t=>t.cloneNode(!0),insertStaticContent(t,e,i,n){const s=n?Rs||(Rs=Cs.createElementNS(As,"svg")):Is||(Is=Cs.createElement("div"));s.innerHTML=t;const r=s.firstChild;let o=r,a=o;for(;o;)a=o,Ns.insert(o,e,i),o=s.firstChild;return[r,a]}};const Fs=/\s*!important$/;function Bs(t,e,i){if(E(i))i.forEach((i=>Bs(t,e,i)));else if(e.startsWith("--"))t.setProperty(e,i);else{const n=function(t,e){const i=Ds[e];if(i)return i;let n=O(e);if("filter"!==n&&n in t)return Ds[e]=n;n=V(n);for(let s=0;sdocument.createEvent("Event").timeStamp&&(Vs=()=>performance.now());let Gs=0;const Ws=Promise.resolve(),Us=()=>{Gs=0};function zs(t,e,i,n,s=null){const r=t._vei||(t._vei={}),o=r[e];if(n&&o)o.value=n;else{const[i,a]=function(t){let e;if(js.test(t)){let i;for(e={};i=t.match(js);)t=t.slice(0,t.length-i[0].length),e[i[0].toLowerCase()]=!0}return[k(t.slice(2)),e]}(e);if(n){!function(t,e,i,n){t.addEventListener(e,i,n)}(t,i,r[e]=function(t,e){const i=t=>{(t.timeStamp||Vs())>=i.attached-1&&me(function(t,e){if(E(e)){const i=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{i.call(t),t._stopped=!0},e.map((t=>e=>!e._stopped&&t(e)))}return e}(t,i.value),e,5,[t])};return i.value=t,i.attached=(()=>Gs||(Ws.then(Us),Gs=Vs()))(),i}(n,s),a)}else o&&(!function(t,e,i,n){t.removeEventListener(e,i,n)}(t,i,o,a),r[e]=void 0)}}const js=/(?:Once|Passive|Capture)$/;const Hs=/^on[a-z]/;const Xs="transition",Ys=(t,{slots:e})=>function(t,e,i){const n=arguments.length;return 2===n?P(e)&&!E(e)?kn(e)?zn(t,null,[e]):zn(t,e):zn(t,null,e):(n>3?i=Array.prototype.slice.call(arguments,2):3===n&&kn(i)&&(i=[i]),zn(t,e,i))}(ji,function(t){let{name:e="v",type:i,css:n=!0,duration:s,enterFromClass:r=`${e}-enter-from`,enterActiveClass:o=`${e}-enter-active`,enterToClass:a=`${e}-enter-to`,appearFromClass:l=r,appearActiveClass:h=o,appearToClass:c=a,leaveFromClass:u=`${e}-leave-from`,leaveActiveClass:d=`${e}-leave-active`,leaveToClass:f=`${e}-leave-to`}=t;const p={};for(const y in t)y in Ks||(p[y]=t[y]);if(!n)return p;const m=function(t){if(null==t)return null;if(P(t))return[qs(t.enter),qs(t.leave)];{const e=qs(t);return[e,e]}}(s),b=m&&m[0],g=m&&m[1],{onBeforeEnter:S,onEnter:v,onEnterCancelled:x,onLeave:E,onLeaveCancelled:_,onBeforeAppear:w=S,onAppear:T=v,onAppearCancelled:M=x}=p,L=(t,e,i)=>{Js(t,e?c:a),Js(t,e?h:o),i&&i()},A=(t,e)=>{Js(t,f),Js(t,d),e&&e()},C=t=>(e,n)=>{const s=t?T:v,o=()=>L(e,t,n);s&&s(e,o),Zs((()=>{Js(e,t?l:r),$s(e,t?c:a),s&&s.length>1||tr(e,i,b,o)}))};return y(p,{onBeforeEnter(t){S&&S(t),$s(t,r),$s(t,o)},onBeforeAppear(t){w&&w(t),$s(t,l),$s(t,h)},onEnter:C(!1),onAppear:C(!0),onLeave(t,e){const n=()=>A(t,e);$s(t,u),document.body.offsetHeight,$s(t,d),Zs((()=>{Js(t,u),$s(t,f),E&&E.length>1||tr(t,i,g,n)})),E&&E(t,n)},onEnterCancelled(t){L(t,!1),x&&x(t)},onAppearCancelled(t){L(t,!0),M&&M(t)},onLeaveCancelled(t){A(t),_&&_(t)}})}(t),e);Ys.displayName="Transition";const Ks={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String};function qs(t){const e=j(t);return function(t){"number"!=typeof t?ce(` explicit duration is not a valid number - got ${JSON.stringify(t)}.`):isNaN(t)&&ce(" explicit duration is NaN - the duration expression might be incorrect.")}(e),e}function $s(t,e){e.split(/\s+/).forEach((e=>e&&t.classList.add(e))),(t._vtc||(t._vtc=new Set)).add(e)}function Js(t,e){e.split(/\s+/).forEach((e=>e&&t.classList.remove(e)));const{_vtc:i}=t;i&&(i.delete(e),i.size||(t._vtc=void 0))}function Zs(t){requestAnimationFrame((()=>{requestAnimationFrame(t)}))}Ys.props=y({},ji.props,Ks);let Qs=0;function tr(t,e,i,n){const s=t._endId=++Qs,r=()=>{s===t._endId&&n()};if(i)return setTimeout(r,i);const{type:o,timeout:a,propCount:l}=function(t,e){const i=window.getComputedStyle(t),n=t=>(i[t]||"").split(", "),s=n("transitionDelay"),r=n("transitionDuration"),o=er(s,r),a=n("animationDelay"),l=n("animationDuration"),h=er(a,l);let c=null,u=0,d=0;e===Xs?o>0&&(c=Xs,u=o,d=r.length):"animation"===e?h>0&&(c="animation",u=h,d=l.length):(u=Math.max(o,h),c=u>0?o>h?Xs:"animation":null,d=c?c===Xs?r.length:l.length:0);const f=c===Xs&&/\b(transform|all)(,|$)/.test(i.transitionProperty);return{type:c,timeout:u,propCount:d,hasTransform:f}}(t,e);if(!o)return n();const h=o+"end";let c=0;const u=()=>{t.removeEventListener(h,d),r()},d=e=>{e.target===t&&++c>=l&&u()};setTimeout((()=>{cir(e)+ir(t[i]))))}function ir(t){return 1e3*Number(t.slice(0,-1).replace(",","."))}const nr={beforeMount(t,{value:e},{transition:i}){t._vod="none"===t.style.display?"":t.style.display,i&&e?i.beforeEnter(t):sr(t,e)},mounted(t,{value:e},{transition:i}){i&&e&&i.enter(t)},updated(t,{value:e,oldValue:i},{transition:n}){n&&e!==i?e?(n.beforeEnter(t),sr(t,!0),n.enter(t)):n.leave(t,(()=>{sr(t,!1)})):sr(t,e)},beforeUnmount(t,{value:e}){sr(t,e)}};function sr(t,e){t.style.display=e?t._vod:"none"}const rr=y({patchProp:(t,e,i,s,r=!1,o,a,l,h)=>{switch(e){case"class":!function(t,e,i){if(null==e&&(e=""),i)t.setAttribute("class",e);else{const i=t._vtc;i&&(e=(e?[e,...i]:[...i]).join(" ")),t.className=e}}(t,s,r);break;case"style":!function(t,e,i){const n=t.style;if(i)if(T(i))e!==i&&(n.cssText=i);else{for(const t in i)Bs(n,t,i[t]);if(e&&!T(e))for(const t in e)null==i[t]&&Bs(n,t,"")}else t.removeAttribute("style")}(t,i,s);break;default:b(e)?g(e)||zs(t,e,0,s,a):function(t,e,i,n){if(n)return"innerHTML"===e||!!(e in t&&Hs.test(e)&&w(i));if("spellcheck"===e||"draggable"===e)return!1;if("form"===e)return!1;if("list"===e&&"INPUT"===t.tagName)return!1;if("type"===e&&"TEXTAREA"===t.tagName)return!1;if(Hs.test(e)&&T(i))return!1;return e in t}(t,e,s,r)?function(t,e,i,n,s,r,o){if("innerHTML"===e||"textContent"===e)return n&&o(n,s,r),void(t[e]=null==i?"":i);if("value"!==e||"PROGRESS"===t.tagName){if(""===i||null==i){const n=typeof t[e];if(""===i&&"boolean"===n)return void(t[e]=!0);if(null==i&&"string"===n)return t[e]="",void t.removeAttribute(e);if("number"===n)return t[e]=0,void t.removeAttribute(e)}try{t[e]=i}catch(a){ce(`Failed setting prop "${e}" on <${t.tagName.toLowerCase()}>: value ${i} is invalid.`,a)}}else{t._value=i;const e=null==i?"":i;t.value!==e&&(t.value=e)}}(t,e,s,o,a,l,h):("true-value"===e?t._trueValue=s:"false-value"===e&&(t._falseValue=s),function(t,e,i,s){if(s&&e.startsWith("xlink:"))null==i?t.removeAttributeNS(ks,e.slice(6,e.length)):t.setAttributeNS(ks,e,i);else{const s=n(e);null==i||s&&!1===i?t.removeAttribute(e):t.setAttribute(e,s?"":i)}}(t,e,s,r))}},forcePatchProp:(t,e)=>"value"===e},Ns);let or;const ar=(...t)=>{const e=(or||(or=_n(rr))).createApp(...t);!function(t){Object.defineProperty(t.config,"isNativeTag",{value:t=>h(t)||c(t),writable:!1})}(e);const{mount:i}=e;return e.mount=t=>{const n=function(t){if(T(t)){const e=document.querySelector(t);return e||ce(`Failed to mount app: mount target selector "${t}" returned null.`),e}t instanceof window.ShadowRoot&&"closed"===t.mode&&ce('mounting on a ShadowRoot with `{mode: "closed"}` may lead to unpredictable bugs');return t}(t);if(!n)return;const s=e._component;w(s)||s.render||s.template||(s.template=n.innerHTML),n.innerHTML="";const r=i(n);return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),r},e};function lr(t){var e={exports:{}};return t(e,e.exports),e.exports}!function(){const t=H||(H="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{});var e;t.__VUE__=!0,e=t.__VUE_DEVTOOLS_GLOBAL_HOOK__,He=e,function(){if("undefined"==typeof window)return;const t={style:"color:#3ba776"},e={style:"color:#0b1bc9"},i={style:"color:#b62e24"},n={style:"color:#9d288c"},s={header:e=>P(e)?e.__isVue?["div",t,"VueInstance"]:Qt(e)?["div",{},["span",t,c(e)],"<",a(e.value),">"]:Kt(e)?["div",{},["span",t,"Reactive"],"<",a(e),">"+(qt(e)?" (readonly)":"")]:qt(e)?["div",{},["span",t,"Readonly"],"<",a(e),">"]:null:null,hasBody:t=>t&&t.__isVue,body(t){if(t&&t.__isVue)return["div",{},...r(t.$)]}};function r(t){const e=[];t.type.props&&t.props&&e.push(o("props",Jt(t.props))),t.setupState!==u&&e.push(o("setup",t.setupState)),t.data!==u&&e.push(o("data",Jt(t.data)));const i=l(t,"computed");i&&e.push(o("computed",i));const s=l(t,"inject");return s&&e.push(o("injected",s)),e.push(["div",{},["span",{style:n.style+";opacity:0.66"},"$ (internal): "],["object",{object:t}]]),e}function o(t,e){return e=y({},e),Object.keys(e).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},t],["div",{style:"padding-left:1.25em"},...Object.keys(e).map((t=>["div",{},["span",n,t+": "],a(e[t],!1)]))]]:["span",{}]}function a(t,s=!0){return"number"==typeof t?["span",e,t]:"string"==typeof t?["span",i,JSON.stringify(t)]:"boolean"==typeof t?["span",n,t]:P(t)?["object",{object:s?Jt(t):t}]:["span",i,String(t)]}function l(t,e){const i=t.type;if(w(i))return;const n={};for(const s in t.ctx)h(i,s,e)&&(n[s]=t.ctx[s]);return n}function h(t,e,i){const n=t[i];return!!(E(n)&&n.includes(e)||P(n)&&e in n)||!(!t.extends||!h(t.extends,e,i))||!(!t.mixins||!t.mixins.some((t=>h(t,e,i))))||void 0}function c(t){return t._shallow?"ShallowRef":t.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(s):window.devtoolsFormatters=[s]}()}(),function(t,e){var i,n=t.document,s=n.documentElement,r=n.querySelector('meta[name="viewport"]'),o=n.querySelector('meta[name="flexible"]'),a=0,l=0,h=e.flexible||(e.flexible={});if(r){console.warn("将根据已有的meta标签来设置缩放比例");var c=r.getAttribute("content").match(/initial\-scale=([\d\.]+)/);c&&(l=parseFloat(c[1]),a=parseInt(1/l))}else if(o){var u=o.getAttribute("content");if(u){var d=u.match(/initial\-dpr=([\d\.]+)/),f=u.match(/maximum\-dpr=([\d\.]+)/);d&&(a=parseFloat(d[1]),l=parseFloat((1/a).toFixed(2))),f&&(a=parseFloat(f[1]),l=parseFloat((1/a).toFixed(2)))}}if(!a&&!l){t.navigator.appVersion.match(/android/gi);var p=t.navigator.appVersion.match(/iphone/gi),m=t.devicePixelRatio;l=1/(a=p?m>=3&&(!a||a>=3)?3:m>=2&&(!a||a>=2)?2:1:1)}if(s.setAttribute("data-dpr",a),!r)if((r=n.createElement("meta")).setAttribute("name","viewport"),r.setAttribute("content","initial-scale="+l+", maximum-scale="+l+", minimum-scale="+l+", user-scalable=no"),s.firstElementChild)s.firstElementChild.appendChild(r);else{var b=n.createElement("div");b.appendChild(r),n.write(b.innerHTML)}function g(){var e=s.getBoundingClientRect().width;e/a>540&&(e=540*a);var i=e/10;s.style.fontSize=i+"px",h.rem=t.rem=i}t.addEventListener("resize",(function(){clearTimeout(i),i=setTimeout(g,300)}),!1),t.addEventListener("pageshow",(function(t){t.persisted&&(clearTimeout(i),i=setTimeout(g,300))}),!1),"complete"===n.readyState?n.body.style.fontSize=12*a+"px":n.addEventListener("DOMContentLoaded",(function(t){n.body.style.fontSize=12*a+"px"}),!1),g(),h.dpr=t.dpr=a,h.refreshRem=g,h.rem2px=function(t){var e=parseFloat(t)*this.rem;return"string"==typeof t&&t.match(/rem$/)&&(e+="px"),e},h.px2rem=function(t){var e=parseFloat(t)/this.rem;return"string"==typeof t&&t.match(/px$/)&&(e+="rem"),e}}(window,window.lib||(window.lib={}));var hr=lr((function(e,i){window,e.exports=function(t){var e={};function i(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(n,s,function(e){return t[e]}.bind(null,s));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=184)}([function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Fraction=void 0;class n{constructor(t=0,e=1,i=0,n=!0){this.numerator=0,this.denominator=1,this.wholeValue=0,this.numerator=t,this.denominator=e,this.wholeValue=i,n&&this.simplify(),this.setRealValue()}static max(t,e){return t.RealValue>e.RealValue?t:e}static Equal(t,e){return t.wholeValue===e.wholeValue&&t.Denominator===e.Denominator&&t.Numerator===e.Numerator}static createFromFraction(t){return new n(t.numerator,t.denominator,t.wholeValue,!1)}static plus(t,e){const i=t.clone();return i.Add(e),i}static minus(t,e){const i=t.clone();return i.Sub(e),i}static multiply(t,e){return new n((t.wholeValue*t.denominator+t.numerator)*(e.wholeValue*e.denominator+e.numerator),t.denominator*e.denominator)}static greatestCommonDenominator(t,e){if(0===t)return e;if(1===e)return 1;for(;Math.abs(e)>1e-8;)t>e?t-=e:e-=t;return Math.round(t)}toString(){let t=this.numerator+"/"+this.denominator;return 0!==this.wholeValue&&(t=this.wholeValue+" "+t),t}clone(){return new n(this.numerator,this.denominator,this.wholeValue,!1)}get Numerator(){return this.numerator}set Numerator(t){this.numerator!==t&&(this.numerator=t,this.simplify(),this.setRealValue())}get Denominator(){return this.denominator}set Denominator(t){this.denominator!==t&&(this.denominator=t,0!==this.numerator&&this.simplify(),this.setRealValue())}get WholeValue(){return this.wholeValue}set WholeValue(t){this.wholeValue!==t&&(this.wholeValue=t,this.setRealValue())}GetExpandedNumerator(){return this.wholeValue*this.denominator+this.numerator}IsNegative(){return this.realValue<0}get RealValue(){return this.realValue}expand(t){this.numerator*=t,this.denominator*=t,0!==this.wholeValue&&(this.numerator+=this.wholeValue*this.denominator,this.wholeValue=0)}Add(t){return this.numerator=(this.wholeValue*this.denominator+this.numerator)*t.denominator+(t.wholeValue*t.denominator+t.numerator)*this.denominator,this.denominator=this.denominator*t.denominator,this.wholeValue=0,this.simplify(),this.setRealValue(),this}Sub(t){return this.numerator=(this.wholeValue*this.denominator+this.numerator)*t.denominator-(t.wholeValue*t.denominator+t.numerator)*this.denominator,this.denominator=this.denominator*t.denominator,this.wholeValue=0,this.simplify(),this.setRealValue(),this}Quantize(t){if(this.denominator<=t)return this;const e=new n(this.numerator+1,this.denominator,this.wholeValue);for(;e.Denominator>t;)e.Numerator++;if(this.numerator>this.denominator){const i=new n(this.numerator-1,this.denominator,this.wholeValue);for(;i.Denominator>t;)i.Numerator--;if(i.Denominatorn.maximumAllowedNumber){const t=this.denominator/n.maximumAllowedNumber;this.numerator=Math.round(this.numerator/t),this.denominator=Math.round(this.denominator/t)}if(this.numerator>n.maximumAllowedNumber){const t=this.numerator/n.maximumAllowedNumber;this.numerator=Math.round(this.numerator/t),this.denominator=Math.round(this.denominator/t)}}isOnBeat(t){const e=this.distanceFromBeat(t);return Math.abs(e)=0&&e<=r.levels.SILENT))throw"log.setLevel() called with invalid level: "+e;if(s=e,!1!==n&&function(t){var e=(i[t]||"silent").toUpperCase();if("undefined"!=typeof window){try{return void(window.localStorage[a]=e)}catch(n){}try{window.document.cookie=encodeURIComponent(a)+"="+e+";"}catch(n){}}}(e),o.call(r,e,t),"undefined"==typeof console&&ei.length-1&&(s=1),r<0&&(r=i.length+r,s=-1),[i[r],s]}static CalculateTransposedHalfTone(t,e){const i=t.fundamentalNote+t.AccidentalHalfTones+e;return o.WrapAroundCheck(i,12)}static WrapAroundCheck(t,e){let i=0;for(;t<0;)t+=e,i--;for(;t>=e;)t-=e,i++;return{overflow:i,halftone:t}}static calcFrequency(t){let e,i=0;if(t instanceof o){const s=t;i=s.octave-1,e=s.fundamentalNote-n.A+s.AccidentalHalfTones}else"number"==typeof t&&(e=t-57);return 440*Math.pow(2,i)*Math.pow(2,e/12)}static calcFractionalKey(t){return Math.log(t/440)/Math.LN10*o.halftoneFactor+57}static fromFrequency(t){const e=o.calcFractionalKey(t)+.5,i=Math.floor(e/12)-o.octXmlDiff,n=Math.floor(e)%12;let r=n,a=s.NONE;return-1===this.pitchEnumValues.indexOf(r)&&(r=n-1,a=s.SHARP),new o(r,i,a)}static fromHalftone(t){const e=Math.floor(t/12)-o.octXmlDiff,i=t%12;let n=i,r=s.NONE;return-1===this.pitchEnumValues.indexOf(n)&&(n=i-1,r=s.SHARP),new o(n,e,r)}static ceiling(t){let e=t%=12;return-1===this.pitchEnumValues.indexOf(e)&&(e=t+1),e}static floor(t){let e=t%=12;return-1===this.pitchEnumValues.indexOf(e)&&(e=t-1),e}static HalfTonesFromAccidental(t){switch(t){case s.NONE:return 0;case s.SHARP:return 1;case s.FLAT:return-1;case s.NATURAL:return 0;case s.DOUBLESHARP:return 2;case s.DOUBLEFLAT:return-2;case s.QUARTERTONESHARP:return.5;case s.QUARTERTONEFLAT:return-.5;case s.TRIPLESHARP:return 3;case s.TRIPLEFLAT:return-3;default:throw new Error("Unhandled AccidentalEnum value")}}static AccidentalFromHalfTones(t){switch(t){case 0:return s.NONE;case 1:return s.SHARP;case-1:return s.FLAT;case 2:return s.DOUBLESHARP;case-2:return s.DOUBLEFLAT;case.5:return s.QUARTERTONESHARP;case-.5:return s.QUARTERTONEFLAT;case 3:return s.TRIPLESHARP;case-3:return s.TRIPLEFLAT;default:return t>0&&t<1?s.QUARTERTONESHARP:t<0&&t>-1?s.QUARTERTONEFLAT:s.QUARTERTONESHARP}}static accidentalVexflow(t){let e;switch(t){case s.NATURAL:e="n";break;case s.FLAT:e="b";break;case s.SHARP:e="#";break;case s.DOUBLESHARP:e="##";break;case s.TRIPLESHARP:e="++";break;case s.DOUBLEFLAT:e="bb";break;case s.TRIPLEFLAT:e="bbs";break;case s.QUARTERTONESHARP:e="+";break;case s.QUARTERTONEFLAT:e="d"}return e}get AccidentalHalfTones(){return o.HalfTonesFromAccidental(this.accidental)}get Octave(){return this.octave}get FundamentalNote(){return this.fundamentalNote}get Accidental(){return this.accidental}get Frequency(){return this.frequency}static get OctaveXmlDifference(){return o.octXmlDiff}getHalfTone(){return this.halfTone}getTransposedPitch(t){if(t>12)throw new Error("rewrite this method to handle bigger octave changes or don't use is with bigger octave changes!");return t>0?this.getHigherPitchByTransposeFactor(t):t<0?this.getLowerPitchByTransposeFactor(-t):this}DoEnharmonicChange(){switch(this.accidental){case s.FLAT:case s.DOUBLEFLAT:this.fundamentalNote=this.getPreviousFundamentalNote(this.fundamentalNote),this.accidental=o.AccidentalFromHalfTones(this.halfTone-(this.fundamentalNote+12*(this.octave+o.octXmlDiff)));break;case s.SHARP:case s.DOUBLESHARP:this.fundamentalNote=this.getNextFundamentalNote(this.fundamentalNote),this.accidental=o.AccidentalFromHalfTones(this.halfTone-(this.fundamentalNote+12*(this.octave+o.octXmlDiff)));break;default:return}}ToString(){let t=o.accidentalVexflow(this.accidental);return t||(t=""),"Key: "+o.getNoteEnumString(this.fundamentalNote)+t+", Note: "+this.fundamentalNote+", octave: "+this.octave.toString()}OperatorEquals(t){return!(!this||!t)&&this.FundamentalNote===t.FundamentalNote&&this.Octave===t.Octave&&this.Accidental===t.Accidental}OperatorNotEqual(t){return!(this===t)}OperatorFundamentalGreaterThan(t){const e=this;return e.Octave===t.Octave?e.FundamentalNote>t.FundamentalNote:e.Octave>t.Octave}OperatorFundamentalLessThan(t){const e=this;return e.Octave===t.Octave?e.FundamentalNoteo.pitchEnumValues.length-1?(i=o.pitchEnumValues[e+t-o.pitchEnumValues.length],n++):i=o.pitchEnumValues[e+t],new o(i,n,s.NONE)}getLowerPitchByTransposeFactor(t){const e=o.pitchEnumValues.indexOf(this.fundamentalNote);let i,n=this.octave;return e-t<0?(i=o.pitchEnumValues[o.pitchEnumValues.length+e-t],n--):i=o.pitchEnumValues[e-t],new o(i,n,s.NONE)}getNextFundamentalNote(t){let e=o.pitchEnumValues.indexOf(t);return e=(e+1)%o.pitchEnumValues.length,o.pitchEnumValues[e]}getPreviousFundamentalNote(t){const e=o.pitchEnumValues.indexOf(t);return e>0?o.pitchEnumValues[e-1]:o.pitchEnumValues[o.pitchEnumValues.length-1]}}e.Pitch=o,o.pitchEnumValues=[n.C,n.D,n.E,n.F,n.G,n.A,n.B],o.halftoneFactor=12/(Math.LN2/Math.LN10),o.octXmlDiff=3},function(t,e,i){var n,s;Object.defineProperty(e,"__esModule",{value:!0}),e.PlacementEnum=e.AbstractExpression=void 0,e.AbstractExpression=class{constructor(t){this.placement=t}static isStringInStringList(t,e){for(let i=0,n=t.length;ithis.borderLeft?this.borderLeft:this.borderMarginLeft}set BorderMarginLeft(t){this.borderMarginLeft=t,this.calculateMarginRectangle()}get BorderMarginRight(){return this.borderMarginRightthis.borderTop?this.borderTop:this.borderMarginTop}set BorderMarginTop(t){this.borderMarginTop=t,this.calculateMarginRectangle()}get BorderMarginBottom(){return this.borderMarginBottom-1&&this.parent.ChildElements.splice(t,1)}this.parent=t,this.parent.ChildElements.indexOf(this)>-1?s.default.error("BoundingBox of "+this.dataObject.constructor.name+" already in children list of "+this.parent.dataObject.constructor.name+"'s BoundingBox"):this.parent.ChildElements.push(this)}get DataObject(){return this.dataObject}get Center(){return new o.PointF2D(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.001;break;case d.Up:case d.Down:n=this.relativePosition.y,t.calculateMarginPositionAlongDirection(this,e),s=Math.abs(n-this.relativePosition.y)>.001;break;default:throw new r.ArgumentOutOfRangeException("direction")}}while(s)}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 e=this.AbsolutePosition.y+this.borderTop<=t.absolutePosition.y+t.borderTop&&t.absolutePosition.y+t.borderTop<=this.AbsolutePosition.y+this.borderBottom,i=this.AbsolutePosition.y+this.borderTop<=t.absolutePosition.y+t.borderBottom&&t.absolutePosition.y+t.borderBottom<=this.AbsolutePosition.y+this.borderBottom;if(e&&i)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 e=this.AbsolutePosition.y+this.borderMarginTop<=t.absolutePosition.y+t.borderMarginTop&&t.absolutePosition.y+t.borderMarginTop<=this.AbsolutePosition.y+this.borderMarginBottom,i=this.AbsolutePosition.y+this.borderMarginTop<=t.absolutePosition.y+t.borderMarginBottom&&t.absolutePosition.y+t.borderMarginBottom<=this.AbsolutePosition.y+this.borderMarginBottom;if(e&&i)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.PointF2D(i.x,i.y),this.setAbsolutePositionFromParent();let n=0,s=!1;do{switch(e){case d.Left:case d.Right:n=this.relativePosition.x,t.calculatePositionAlongDirection(this,e),s=Math.abs(n-this.relativePosition.x)>1e-4;break;case d.Up:case d.Down:n=this.relativePosition.y,t.calculatePositionAlongDirection(this,e),s=Math.abs(n-this.relativePosition.y)>1e-4;break;default:throw new r.ArgumentOutOfRangeException("direction")}}while(s)}getClickedObjectOfType(t){const e=this.dataObject;if(this.pointLiesInsideBorders(t)&&e)return e;for(let i=0,n=this.childElements.length;i{};s.L=(t,e)=>{if(!e)return;const i=Array.prototype.slice.call(e).join(" ");window. (t+": "+i)},s.MakeException=t=>class extends Error{constructor(e,i){super(e),this.name=t,this.message=e,this.data=i}},s.RERR=s.RuntimeError=class{constructor(t,e){this.code=t,this.message=e}toString(){return"[RuntimeError] "+this.code+":"+this.message}},s.Merge=(t,e)=>{for(const i in e)t[i]=e[i];return t},s.Min=Math.min,s.Max=Math.max,s.forEach=(t,e)=>{for(let i=0;it%e>=e/2?parseInt(t/e,10)*e+e:parseInt(t/e,10)*e,s.MidLine=(t,e)=>{let i=e+(t-e)/2;return i%2>0&&(i=s.RoundN(10*i,5)/10),i},s.SortAndUnique=(t,e,i)=>{if(t.length>1){const n=[];let s;t.sort(e);for(let e=0;e{let i=t.length;for(;i--;)if(t[i]===e)return!0;return!1},s.getCanvasContext=t=>{if(!t)throw new s.RERR("BadArgument","Invalid canvas selector: "+t);const e=document.getElementById(t);if(!e||!e.getContext)throw new s.RERR("UnsupportedBrowserError","This browser does not support HTML5 Canvas");return e.getContext("2d")},s.drawDot=(t,e,i,n="#55")=>{t.save(),t.setFillStyle(n),t.beginPath(),t.arc(e,i,3,0,2*Math.PI,!0),t.closePath(),t.fill(),t.restore()},s.BM=(t,e)=>{const i=(new Date).getTime();e();const n=(new Date).getTime()-i;s.L(t+n+"ms")},s.StackTrace=()=>(new Error).stack,s.W=(...t)=>{const e=t.join(" ");window. ("Warning: ",e,s.StackTrace())},(s.Prefix=t=>s.Prefix.prefix+t).prefix="vf-";class r{static GCD(t,e){if("number"!=typeof t||"number"!=typeof e)throw new s.RERR("BadArgument",`Invalid numbers: ${t}, ${e}`);let i;for(;0!==e;)i=e,e=t%e,t=i;return t}static LCM(t,e){return t*e/r.GCD(t,e)}static LCMM(t){if(0===t.length)return 0;if(1===t.length)return t[0];if(2===t.length)return r.LCM(t[0],t[1]);{const e=t[0];return t.shift(),r.LCM(e,r.LCMM(t))}}constructor(t,e){this.set(t,e)}set(t,e){return this.numerator=void 0===t?1:t,this.denominator=void 0===e?1:e,this}value(){return this.numerator/this.denominator}simplify(){let t=this.numerator,e=this.denominator;const i=r.GCD(t,e);return t/=i,e/=i,e<0&&(e=-e,t=-t),this.set(t,e)}add(t,e){let i,n;t instanceof r?(i=t.numerator,n=t.denominator):(i=void 0!==t?t:0,n=void 0!==e?e:1);const s=r.LCM(this.denominator,n),o=s/this.denominator,a=s/n,l=this.numerator*o+i*a;return this.set(l,s)}subtract(t,e){let i,n;t instanceof r?(i=t.numerator,n=t.denominator):(i=void 0!==t?t:0,n=void 0!==e?e:1);const s=r.LCM(this.denominator,n),o=s/this.denominator,a=s/n,l=this.numerator*o-i*a;return this.set(l,s)}multiply(t,e){let i,n;return t instanceof r?(i=t.numerator,n=t.denominator):(i=void 0!==t?t:1,n=void 0!==e?e:1),this.set(this.numerator*i,this.denominator*n)}divide(t,e){let i,n;return t instanceof r?(i=t.numerator,n=t.denominator):(i=void 0!==t?t:1,n=void 0!==e?e:1),this.set(this.numerator*n,this.denominator*i)}equals(t){const e=r.__compareA.copy(t).simplify(),i=r.__compareB.copy(this).simplify();return e.numerator===i.numerator&&e.denominator===i.denominator}greaterThan(t){const e=r.__compareB.copy(this);return e.subtract(t),e.numerator>0}greaterThanEquals(t){const e=r.__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 r(this.numerator,this.denominator)}copy(t){return"number"==typeof t?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 r.__tmp.copy(this).simplify().toString()}toMixedString(){let t="";const e=this.quotient(),i=r.__tmp.copy(this);return e<0?i.abs().fraction():i.fraction(),0!==e?(t+=e,0!==i.numerator&&(t+=" "+i.toSimplifiedString())):t=0===i.numerator?"0":i.toSimplifiedString(),t}parse(t){const e=t.split("/"),i=parseInt(e[0],10),n=e[1]?parseInt(e[1],10):1;return this.set(i,n)}}r.__compareA=new r,r.__compareB=new r,r.__tmp=new r;const o=s.MakeException("RegistryError");function a(t,e,i,n,s){t[e][i]||(t[e][i]={}),t[e][i][n]=s}class l{static get INDEXES(){return["type"]}constructor(){this.clear()}static enableDefaultRegistry(t){l.defaultRegistry=t}static getDefaultRegistry(){return l.defaultRegistry}static disableDefaultRegistry(){l.defaultRegistry=null}clear(){return this.index={id:{},type:{},class:{}},this}updateIndex({id:t,name:e,value:i,oldValue:n}){const s=this.getElementById(t);null!==n&&this.index[e][n]&&delete this.index[e][n][t],null!==i&&a(this.index,e,i,s.getAttribute("id"),s)}register(t,e){if(!(e=e||t.getAttribute("id")))throw new o("Can't add element without `id` attribute to registry",t);return t.setAttribute("id",e),a(this.index,"id",e,e,t),l.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((t=>i[e][t])):[]}getElementsByType(t){return this.getElementsByAttribute("type",t)}getElementsByClass(t){return this.getElementsByAttribute("class",t)}onUpdate({id:t,name:e,value:i,oldValue:n}){return s=l.INDEXES.concat(["id","class"]),r=e,s.filter((t=>t===r)).length>0?(this.updateIndex({id:t,name:e,value:i,oldValue:n}),this):this;var s,r}}l.defaultRegistry=null;class h{static newID(){return"auto"+h.ID++}constructor({type:t}={}){this.attrs={id:h.newID(),el:null,type:t||"Base",classes:{}},this.boundingBox=null,this.context=null,this.rendered=!1,l.getDefaultRegistry()&&l.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!0===this.attrs.classes[t]}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,n=this.attrs[t];return this.attrs[t]=e,this.registry&&this.registry.onUpdate({id:i,name:t,value:e,oldValue:n}),this}getContext(){return this.context}setContext(t){return this.context=t,this}getBoundingBox(){return this.boundingBox}checkContext(){if(!this.context)throw new s.RERR("NoContext","No rendering context attached to instance");return this.context}}h.ID=1e3;class c{constructor(t,e,i,n){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN,this.addPoint(t,e),this.addPoint(i,n)}width(){return this.x2-this.x1}height(){return this.y2-this.y1}addPoint(t,e){null!=t&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=t,this.x2=t),tthis.x2&&(this.x2=t)),null!=e&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=e,this.y2=e),ethis.y2&&(this.y2=e))}addX(t){this.addPoint(t,null)}addY(t){this.addPoint(null,t)}addQuadraticCurve(t,e,i,n,s,r){const o=t+2/3*(i-t),a=e+2/3*(n-e),l=o+1/3*(s-t),h=a+1/3*(r-e);this.addBezierCurve(t,e,o,a,l,h,s,r)}addBezierCurve(t,e,i,n,s,r,o,a){const l=[t,e],h=[i,n],c=[s,r],u=[o,a];let d;this.addPoint(l[0],l[1]),this.addPoint(u[0],u[1]);const f=(t,e)=>Math.pow(1-t,3)*l[e]+3*Math.pow(1-t,2)*t*h[e]+3*(1-t)*Math.pow(t,2)*c[e]+Math.pow(t,3)*u[e];for(d=0;d<=1;d++){const t=6*l[d]-12*h[d]+6*c[d],e=-3*l[d]+9*h[d]-9*c[d]+3*u[d],i=3*h[d]-3*l[d];if(0===e){if(0===t)continue;const e=-i/t;0{if(!t)throw new s.RERR("BadArgument","Invalid clef: "+t);const e=m.clefProperties.values[t];if(!e)throw new s.RERR("BadArgument","Invalid clef: "+t);return e}};m.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}},m.keyProperties=(e,i,n)=>{void 0===i&&(i="treble");const r={octave_shift:0};"object"==typeof n&&s.Merge(r,n);const o=e.split("/");if(o.length<2)throw new s.RERR("BadArguments",`Key must have note + octave and an optional glyph: ${e}`);const a=o[0].toUpperCase(),l=m.keyProperties.note_values[a];if(!l)throw new s.RERR("BadArguments","Invalid key name: "+a);l.octave&&(o[1]=l.octave);let h=parseInt(o[1],10);h+=-1*r.octave_shift;let c=(7*h-28+l.index)/2;c+=m.clefProperties(i).line_shift;let u=0;c<=0&&2*c%2==0&&(u=1),c>=6&&2*c%2==0&&(u=-1);const d=void 0!==l.int_val?12*h+l.int_val:null,f=l.code,p=l.shift_right;let b={};if(o.length>2&&o[2]){const t=o[2].toUpperCase();b=m.keyProperties.customNoteHeads[t]||{}}return t({key:a,octave:h,line:c,int_value:d,accidental:l.accidental,code:f,stroke:u,shift_right:p,displaced:!1},b)},m.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}},m.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}},m.integerToNote=t=>{if(void 0===t)throw new s.RERR("BadArguments","Undefined integer for integerToNote");if(t<-2)throw new s.RERR("BadArguments",`integerToNote requires integer > -2: ${t}`);const e=m.integerToNote.table[t];if(!e)throw new s.RERR("BadArguments",`Unknown note value for integer: ${t}`);return e},m.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"},m.tabToGlyph=(t,e=1)=>{let i=null,n=0,s=0;if("X"===t.toString().toUpperCase()){const t=new p("v7f",m.DEFAULT_TABLATURE_FONT_SCALE).getMetrics();i="v7f",n=t.width,s=-t.height/2}else n=m.textWidth(t.toString());return{text:t,code:i,getWidth:()=>n*e,shift_y:s}},m.textWidth=t=>7*t.toString().length,m.articulationCodes=t=>m.articulationCodes.articulations[t],m.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}},m.accidentalCodes=t=>m.accidentalCodes.accidentals[t],m.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}},m.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]}},m.ornamentCodes=t=>m.ornamentCodes.ornaments[t],m.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"}},m.keySignature=t=>{const e=m.keySignature.keySpecs[t];if(!e)throw new s.RERR("BadKeySignature",`Bad key signature spec: '${t}'`);if(!e.acc)return[];const i=m.keySignature.accidentalList(e.acc),n=[];for(let s=0;s({b:[2,.5,2.5,1,3,1.5,3.5],"#":[0,1.5,-.5,1,2.5,.5,2]}[t]),m.parseNoteDurationString=t=>{if("string"!=typeof t)return null;const e=/(\d*\/?\d+|[a-z])(d*)([nrhms]|$)/.exec(t);if(!e)return null;const i=e[1],n=e[2].length;let s=e[3];return 0===s.length&&(s="n"),{duration:i,dots:n,type:s}},m.parseNoteStruct=t=>{const e=t.duration,i=m.parseNoteDurationString(e);if(!i)return null;let n=m.durationToTicks(i.duration);if(null==n)return null;let s=t.type;const r=[];if(s){if(!m.getGlyphProps.validTypes[s])return null}else s=i.type||"n",void 0!==t.keys&&t.keys.forEach(((t,e)=>{const i=t.split("/");i&&3===i.length&&(r[e]=i[2])}));const o=t.dots?t.dots:i.dots;if("number"!=typeof o)return null;let a=n;for(let l=0;l{const e=m.durationAliases[t];if(void 0!==e&&(t=e),void 0===m.durationToTicks.durations[t])throw new s.RERR("BadArguments",`The provided duration is not valid: ${t}`);return t},m.durationToFraction=t=>(new r).parse(m.sanitizeDuration(t)),m.durationToNumber=t=>m.durationToFraction(t).value(),m.durationToTicks=t=>{t=m.sanitizeDuration(t);const e=m.durationToTicks.durations[t];return void 0===e?null:e},m.durationToTicks.durations={"1/2":2*m.RESOLUTION,1:m.RESOLUTION/1,2:m.RESOLUTION/2,4:m.RESOLUTION/4,8:m.RESOLUTION/8,16:m.RESOLUTION/16,32:m.RESOLUTION/32,64:m.RESOLUTION/64,128:m.RESOLUTION/128,256:m.RESOLUTION/256},m.durationAliases={w:"1",h:"2",q:"4",b:"256"},m.getGlyphProps=(e,i)=>{e=m.sanitizeDuration(e);const n=m.getGlyphProps.duration_codes[e];if(void 0===n)return null;i||(i="n");let s=n.type[i];if(void 0===s){const e=m.keyProperties.customNoteHeads[i.toUpperCase()];if(void 0===e)return null;s=t({code_head:e.code},e)}return t(t({},n.common),s)},m.getGlyphProps.validTypes={n:{name:"note"},r:{name:"rest"},h:{name:"harmonic"},m:{name:"muted"},s:{name:"slash"}},m.getGlyphProps.duration_codes={"1/2":{common:{getWidth(t=m.DEFAULT_NOTATION_FONT_SCALE){return new p(this.code_head||"v53",t).getMetrics().width},stem:!1,stem_offset:0,flag:!1,stem_up_extension:-m.STEM_HEIGHT,stem_down_extension:-m.STEM_HEIGHT,tabnote_stem_up_extension:-m.STEM_HEIGHT,tabnote_stem_down_extension:-m.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:()=>m.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},1:{common:{getWidth(t=m.DEFAULT_NOTATION_FONT_SCALE){return new p(this.code_head||"v1d",t).getMetrics().width},stem:!1,stem_offset:0,flag:!1,stem_up_extension:-m.STEM_HEIGHT,stem_down_extension:-m.STEM_HEIGHT,tabnote_stem_up_extension:-m.STEM_HEIGHT,tabnote_stem_down_extension:-m.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:()=>m.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},2:{common:{getWidth(t=m.DEFAULT_NOTATION_FONT_SCALE){return new p(this.code_head||"v81",t).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:()=>m.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},4:{common:{getWidth(t=m.DEFAULT_NOTATION_FONT_SCALE){return new p(this.code_head||"vb",t).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:()=>m.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},8:{common:{getWidth(t=m.DEFAULT_NOTATION_FONT_SCALE){return new p(this.code_head||"vb",t).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:()=>m.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},16:{common:{beam_count:2,getWidth(t=m.DEFAULT_NOTATION_FONT_SCALE){return new p(this.code_head||"vb",t).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:()=>m.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},32:{common:{beam_count:3,getWidth(t=m.DEFAULT_NOTATION_FONT_SCALE){return new p(this.code_head||"vb",t).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:()=>m.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},64:{common:{beam_count:4,getWidth(t=m.DEFAULT_NOTATION_FONT_SCALE){return new p(this.code_head||"vb",t).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:()=>m.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}},128:{common:{beam_count:5,getWidth(t=m.DEFAULT_NOTATION_FONT_SCALE){return new p(this.code_head||"vb",t).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:()=>m.SLASH_NOTEHEAD_WIDTH,position:"B/4"}}}},m.smufl={},m.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"},m.TIME4_4={num_beats:4,beat_value:4,resolution:m.RESOLUTION};class b{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&&(s.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:b.WIDTH,height:b.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,n){return this.vexFlowCanvasContext.rect(t,e,i,n)}fillRect(t,e,i,n){return this.vexFlowCanvasContext.fillRect(t,e,i,n)}clearRect(t,e,i,n){return this.vexFlowCanvasContext.clearRect(t,e,i,n)}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,n,s,r){return this.vexFlowCanvasContext.bezierCurveTo(t,e,i,n,s,r)}quadraticCurveTo(t,e,i,n){return this.vexFlowCanvasContext.quadraticCurveTo(t,e,i,n)}arc(t,e,i,n,s,r){return this.vexFlowCanvasContext.arc(t,e,i,n,s,r)}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 g{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,n){return n<0&&(e+=n,n=-n),this.paper.rect(t,e,i-.5,n-.5).attr(this.attributes).attr("fill","none").attr("stroke-width",this.lineWidth),this}fillRect(t,e,i,n){return n<0&&(e+=n,n=-n),this.paper.rect(t,e,i-.5,n-.5).attr(this.attributes),this}clearRect(t,e,i,n){return n<0&&(e+=n,n=-n),this.paper.rect(t,e,i-.5,n-.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,n,s,r){return this.path+="C"+t+","+e+","+i+","+n+","+s+","+r,this.pen.x=s,this.pen.y=r,this}quadraticCurveTo(t,e,i,n){return this.path+="Q"+t+","+e+","+i+","+n,this.pen.x=i,this.pen.y=n,this}arc(t,e,i,n,s,r){function o(t){for(;t<0;)t+=2*Math.PI;for(;t>2*Math.PI;)t-=2*Math.PI;return t}if((n=o(n))>(s=o(s))){const t=n;n=s,s=t,r=!r}const a=s-n;return a>Math.PI?(this.arcHelper(t,e,i,n,n+a/2,r),this.arcHelper(t,e,i,n+a/2,s,r)):this.arcHelper(t,e,i,n,s,r),this}arcHelper(t,e,i,n,s,r){const o=t+i*Math.cos(n),a=e+i*Math.sin(n),l=t+i*Math.cos(s),h=e+i*Math.sin(s);let c=0,u=0;r?(u=1,s-nMath.PI&&(c=1),this.path+="M"+o+","+a+",A"+i+","+i+",0,"+c+","+u+","+l+","+h+"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 n=1;n<=i;n++)t.push(this.paper.path(this.path).attr({stroke:e.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(e.width/i*n).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 y={path:{x:!0,y:!0,width:!0,height:!0},rect:{},text:{width:!0,height:!0}};{const t={"font-family":!0,"font-weight":!0,"font-style":!0,"font-size":!0};s.Merge(y.rect,t),s.Merge(y.path,t)}class S{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 n=this.create("g");return this.groups.push(n),this.parent.appendChild(n),this.parent=n,t&&n.setAttribute("class",s.Prefix(t)),e&&n.setAttribute("id",s.Prefix(e)),i&&i.pointerBBox&&n.setAttribute("pointer-events","bounding-box"),n}closeGroup(){this.groups.pop(),this.parent=this.groups[this.groups.length-1]}add(t){this.parent.appendChild(t)}iePolyfill(){"undefined"!=typeof navigator&&(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 n=!1,r=!1,o="normal";"string"==typeof i&&(-1!==i.indexOf("italic")&&(i=i.replace(/italic/g,""),r=!0),-1!==i.indexOf("bold")&&(i=i.replace(/bold/g,""),n=!0),i=i.replace(/ /g,"")),o=r?"italic":o;const a={"font-family":t,"font-size":e+"pt","font-weight":i=void 0===(i=n?"bold":i)||""===i?"normal":i,"font-style":o};return this.fontSize=Number(e),s.Merge(this.attributes,a),s.Merge(this.state,a),this}setRawFont(t){const e=(t=t.trim()).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 Array]"===Object.prototype.toString.call(t))return t=t.join(", "),this.attributes["stroke-dasharray"]=t,this;throw new s.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,n=this.height/e;return this.setViewBox(0,0,i,n),this}setViewBox(...t){if(1===t.length){const[e]=t;this.svg.setAttribute("viewBox",e)}else{const[e,i,n,s]=t,r=e+" "+i+" "+n+" "+s;this.svg.setAttribute("viewBox",r)}}applyAttributes(t,e){const i=y[t.nodeName];return Object.keys(e).forEach((n=>{i&&i[n]||t.setAttributeNS(null,n,e[n])})),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,n,r){n<0&&(e+=n,n*=-1);const o=this.create("rect");return void 0===r&&(r={fill:"none","stroke-width":this.lineWidth,stroke:"black"}),s.Merge(r,{x:t,y:e,width:i,height:n}),this.applyAttributes(o,r),this.add(o),this}fillRect(t,e,i,n){return n<0&&(e+=n,n*=-1),this.rect(t,e,i,n,this.attributes),this}clearRect(t,e,i,n){return this.rect(t,e,i,n,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,n,s,r){return this.path+="C"+t+" "+e+","+i+" "+n+","+s+" "+r,this.pen.x=s,this.pen.y=r,this}quadraticCurveTo(t,e,i,n){return this.path+="Q"+t+" "+e+","+i+" "+n,this.pen.x=i,this.pen.y=n,this}arc(t,e,i,n,s,r){function o(t){for(;t<0;)t+=2*Math.PI;for(;t>2*Math.PI;)t-=2*Math.PI;return t}if((n=o(n))>(s=o(s))){const t=n;n=s,s=t,r=!r}const a=s-n;return a>Math.PI?(this.arcHelper(t,e,i,n,n+a/2,r),this.arcHelper(t,e,i,n+a/2,s,r)):this.arcHelper(t,e,i,n,s,r),this}arcHelper(t,e,i,n,s,r){const o=t+i*Math.cos(n),a=e+i*Math.sin(n),l=t+i*Math.cos(s),h=e+i*Math.sin(s);let c=0,u=0;r?(u=1,s-nMath.PI&&(c=1),this.path+="M"+o+" "+a+" A"+i+" "+i+" 0 "+c+" "+u+" "+l+" "+h,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 n={stroke:t.color,"stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(.4*t.width/e*i).toFixed(3),opacity:+((t.opacity||.3)/e).toFixed(3)},s=this.create("path");n.d=this.path,this.applyAttributes(s,n),this.add(s)}}return this}fill(t){this.glow();const e=this.create("path");return void 0===t&&(s.Merge(t={},this.attributes),t.stroke="none"),t.d=this.path,this.applyAttributes(e,t),this.add(e),this}stroke(){this.glow();const t=this.create("path"),e={};return s.Merge(e,this.attributes),e.fill="none",e["stroke-width"]=this.lineWidth,e.d=this.path,this.applyAttributes(t,e),this.add(t),this}measureText(t){const e=this.create("text");if("function"!=typeof e.getBBox)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&&"italic"===this.attributes["font-style"]&&(i=this.ieMeasureTextFix(i,t)),this.svg.removeChild(e),i}ieMeasureTextFix(t){const e=1.196*Number(this.fontSize)+1.9598,i=t.width-e,n=t.height-1.5;return{x:t.x,y:t.y,width:i,height:n}}fillText(t,e,i){if(!t||t.length<=0)return;const n={};s.Merge(n,this.attributes),n.stroke="none",n.x=e,n.y=i;const r=this.create("text");r.textContent=t,this.applyAttributes(r,n),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 v=null;class x{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 v}static set lastContext(t){v=t}static buildContext(t,e,i,n,s){const r=new x(t,e);i&&n&&r.resize(i,n),s||(s="#FFF");const o=r.getContext();return o.setBackgroundFillStyle(s),x.lastContext=o,o}static getCanvasContext(t,e,i,n){return x.buildContext(t,x.Backends.CANVAS,e,i,n)}static getRaphaelContext(t,e,i,n){return x.buildContext(t,x.Backends.RAPHAEL,e,i,n)}static getSVGContext(t,e,i,n){return x.buildContext(t,x.Backends.SVG,e,i,n)}static bolsterCanvasContext(t){return x.USE_CANVAS_PROXY?new b(t):(t.vexFlowCanvasContext=t,["clear","setFont","setRawFont","setFillStyle","setBackgroundFillStyle","setStrokeStyle","setShadowColor","setShadowBlur","setLineWidth","setLineCap","setLineDash","openGroup","closeGroup","getGroup"].forEach((e=>{t[e]=t[e]||b.prototype[e]})),t)}static drawDashedLine(t,e,i,n,s,r){t.beginPath();const o=n-e,a=s-i,l=Math.atan2(a,o);let h=e,c=i;t.moveTo(e,i);let u=0,d=!0;for(;!(o<0?h<=n:h>=n)||!(a<0?c<=s:c>=s);){const e=r[u++%r.length],i=h+Math.cos(l)*e;h=o<0?Math.max(n,i):Math.min(n,i);const f=c+Math.sin(l)*e;c=a<0?Math.max(s,f):Math.min(s,f),d?t.lineTo(h,c):t.moveTo(h,c),d=!d}t.closePath(),t.stroke()}constructor(t,e){if(this.elementId=t,!this.elementId)throw new s.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===x.Backends.CANVAS){if(!this.element.getContext)throw new s.RERR("BadElement",`Can't get canvas context from element: ${t}`);this.ctx=x.bolsterCanvasContext(this.element.getContext("2d"))}else if(this.backend===x.Backends.RAPHAEL)this.ctx=new g(this.element);else{if(this.backend!==x.Backends.SVG)throw new s.RERR("InvalidBackend",`No support for backend: ${this.backend}`);this.ctx=new S(this.element)}}resize(t,e){if(this.backend===x.Backends.CANVAS){if(!this.element.getContext)throw new s.RERR("BadElement",`Can't get canvas context from element: ${this.elementId}`);[t,e]=b.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=x.bolsterCanvasContext(this.element.getContext("2d")),this.ctx.scale(i,i)}else this.ctx.resize(t,e);return this}getContext(){return this.ctx}}class E extends h{static get CATEGORY(){return"stem"}static get UP(){return 1}static get DOWN(){return-1}static get WIDTH(){return m.STEM_WIDTH}static get HEIGHT(){return m.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.renderHeightAdjustment=0,this.setOptions(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 E.CATEGORY}getHeight(){const t=this.stem_direction===E.UP?this.stem_up_y_offset:this.stem_down_y_offset;return(this.y_bottom-this.y_top)*this.stem_direction+(E.HEIGHT-t+this.stem_extension)*this.stem_direction}getBoundingBox(){throw new s.RERR("NotImplemented","getBoundingBox() not implemented.")}getExtents(){const t=this.stem_direction===E.UP,e=[this.y_top,this.y_bottom],i=E.HEIGHT+this.stem_extension,n=(t?Math.min:Math.max)(...e),s=(t?Math.max:Math.min)(...e);return{topY:n+i*-this.stem_direction,baseY:s}}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 n=this.stem_direction;n===E.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();!function(...t){E.DEBUG&&s.L("Vex.Flow.Stem",t)}("Rendering stem - ","Top Y: ",this.y_top,"Bottom Y: ",this.y_bottom);const o=this.isStemlet?r-this.stemletHeight*this.stem_direction:0;t.save(),this.applyStyle(t),t.beginPath(),t.setLineWidth(E.WIDTH),t.moveTo(e,i-o),t.lineTo(e,i-r-this.renderHeightAdjustment*n),t.stroke(),this.restoreStyle(t),t.restore()}}class _ extends h{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 s.RuntimeError("BadArguments","No notes provided for tuplet.");this.options=s.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((t=>null===t.beam)),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||_.LOCATION_TOP,dt.AlignRestsToNotes(t,!0,!0),this.resolveGlyphs(),this.attach()}attach(){for(let t=0;t=1;)this.numerator_glyphs.unshift(new p("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 p("v"+t%10,this.point)),t=parseInt(t/10,10)}getNestedTupletCount(){const t=this.location,e=this.notes[0];let i=s(e,t),n=s(e,t);function s(t,e){return t.tupletStack.filter((t=>t.location===e)).length}return this.notes.forEach((e=>{const r=s(e,t);i=r>i?r:i,n=rn&&(n=e)}}return n+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=(t,e)=>t+e.getMetrics().width;let n=this.numerator_glyphs.reduce(i,0);this.ratioed&&(n=this.denom_glyphs.reduce(i,n),n+=.32*this.point);const s=this.x_pos+this.width/2-n/2;if(this.bracketed){const t=this.width/2-n/2-5;t>0&&(this.context.fillRect(this.x_pos,this.y_pos,t,1),this.context.fillRect(this.x_pos+this.width/2+n/2+5,this.y_pos,t,1),this.context.fillRect(this.x_pos,this.y_pos+(this.location===_.LOCATION_BOTTOM),1,10*this.location),this.context.fillRect(this.x_pos+this.width,this.y_pos+(this.location===_.LOCATION_BOTTOM),1,10*this.location))}let r=0;if(this.numerator_glyphs.forEach((t=>{t.render(this.context,s+r,this.y_pos+this.point/3-2),r+=t.getMetrics().width})),this.ratioed){const t=s+r+.16*this.point,e=.06*this.point;this.context.beginPath(),this.context.arc(t,this.y_pos-.08*this.point,e,0,2*Math.PI,!0),this.context.closePath(),this.context.fill(),this.context.beginPath(),this.context.arc(t,this.y_pos+.12*this.point,e,0,2*Math.PI,!0),this.context.closePath(),this.context.fill(),r+=.32*this.point,this.denom_glyphs.forEach((t=>{t.render(this.context,s+r,this.y_pos+this.point/3-2),r+=t.getMetrics().width}))}}}function w(t){let e=0;return t.forEach((t=>{t.keyProps&&t.keyProps.forEach((t=>{e+=t.line-3}))})),e>=0?E.DOWN:E.UP}const T="L",M="B";class P extends h{static getDefaultBeamGroups(t){t&&"c"!==t||(t="4/4");const e={"1/2":["1/2"],"2/2":["1/2"],"3/2":["1/2"],"4/2":["1/2"],"1/4":["1/4"],"2/4":["1/4"],"3/4":["1/4"],"4/4":["1/4"],"1/8":["1/8"],"2/8":["2/8"],"3/8":["3/8"],"4/8":["2/8"],"1/16":["1/16"],"2/16":["2/16"],"3/16":["3/16"],"4/16":["2/16"]}[t];if(void 0!==e)return e.map((t=>(new r).parse(t)));{const e=parseInt(t.split("/")[0],10),i=parseInt(t.split("/")[1],10);if(e%3==0)return[new r(3,i)];if(i>4)return[new r(2,i)];if(i<=4)return[new r(1,i)]}return[new r(1,4)]}static applyAndGetBeams(t,e,i){return P.generateBeams(t.getTickables(),{groups:i,stem_direction:e})}static generateBeams(t,e){e||(e={}),e.groups&&e.groups.length||(e.groups=[new r(2,8)]);const i=e.groups.map((t=>{if(!t.multiply)throw new s.RuntimeError("InvalidBeamGroups","The beam groups must be an array of Vex.Flow.Fractions");return t.clone().multiply(m.RESOLUTION,1)})),n=t;let o=0,a=[],l=[];function h(){i.length-1>o?o+=1:o=0}!function(){let t=[];n.forEach((e=>{if(t=[],e.shouldIgnoreTicks())return a.push(l),void(l=t);l.push(e);const n=i[o].clone(),s=l.reduce(((t,e)=>e.getTicks().clone().add(t)),new r(0,1)),c=m.durationToNumber(e.duration)<8;c&&e.tuplet&&(n.numerator*=2),s.greaterThan(n)?(c||t.push(l.pop()),a.push(l),l=t,h()):s.equals(n)&&(a.push(l),l=t,h())})),l.length>0&&a.push(l)}(),function(){const t=[];a.forEach((i=>{let n=[];i.forEach(((i,s,r)=>{const o=0===s||s===r.length-1,a=r[s-1],l=!e.beam_rests&&i.isRest(),h=e.beam_rests&&e.beam_middle_only&&i.isRest()&&o;let c=!1;if(e.maintain_stem_directions&&a&&!i.isRest()&&!a.isRest()){const t=a.getStemDirection();c=i.getStemDirection()!==t}const u=parseInt(i.duration,10)<8;l||h||c||u?(n.length>0&&t.push(n),n=c?[i]:[]):n.push(i)})),n.length>0&&t.push(n)})),a=t}(),a.forEach((t=>{let i;if(e.maintain_stem_directions){const e=function(t){for(let e=0;e{t.setStemDirection(n)}))}));const c=a.filter((t=>{if(t.length>1){let e=!0;return t.forEach((t=>{t.getIntrinsicTicks()>=m.durationToTicks("4")&&(e=!1)})),e}return!1})),u=function(){const t=[];return a.forEach((e=>{let i=null;e.forEach((e=>{e.tuplet&&i!==e.tuplet&&(i=e.tuplet,t.push(i))}))})),t}(),d=[];return c.forEach((t=>{const i=new P(t);e.show_stemlets&&(i.render_options.show_stemlets=!0),e.secondary_breaks&&(i.render_options.secondary_break_ticks=m.durationToTicks(e.secondary_breaks)),!0===e.flat_beams&&(i.render_options.flat_beams=!0,i.render_options.flat_beam_offset=e.flat_beam_offset),d.push(i)})),u.forEach((t=>{const e=t.notes[0].stem_direction===E.DOWN?_.LOCATION_BOTTOM:_.LOCATION_TOP;t.setTupletLocation(e);let i=!1;for(let n=0;n=m.durationToTicks("4"))throw new s.RuntimeError("BadArguments","Beams can only be applied to notes shorter than a quarter note.");let i,n;for(this.stem_direction=E.UP,i=0;it+e.stem_direction),0)>-1?E.UP:E.DOWN),i=0;it.getGlyph().beam_count)).reduce(((t,e)=>e>t?e:t))}breakSecondaryAt(t){return this.break_on_indices=t,this}getSlopeY(t,e,i,n){return i+(t-e)*n}calculateSlope(){const{notes:t,stem_direction:e,render_options:{max_slope:i,min_slope:n,slope_iterations:s,slope_cost:r}}=this,o=t[0],a=((t,e)=>{const i=t.getStemExtents().topY,n=t.getStemX();return(e.getStemExtents().topY-i)/(e.getStemX()-n)})(o,t[t.length-1]),l=(i-n)/s;let h=Number.MAX_VALUE,c=0,u=0;for(let d=n;d<=i;d+=l){let i=0,n=0;for(let r=1;rn)&&(l=n,o=Math.min(...i.getYs()),a=i.getBeamCount())}let h=r/t.length;const c=n+a*(1.5*i),u=o+c*-e;e===E.DOWN&&hu&&(h=o-c),s+this.render_options.flat_beam_offset_per_beam>0?(e===E.DOWN&&h>s&&!this.render_options.flat_beams||e===E.UP&&h0){let e=this.render_options.flat_beam_offset;this.render_options.flat_beam_offset_per_beam&&(e+=this.render_options.flat_beam_offset_per_beam*this.getBeamCount());let i=this.notes[0].note_heads[0].y;const n=this.stem_direction>0?Math.min:Math.max;for(const t of this.notes)for(const e of t.note_heads)i=n(i,e.y);t=i+e*-this.stem_direction}return t}applyStemExtensions(){const{notes:t,slope:e,y_shift:i,stem_direction:n,beam_count:s,render_options:{show_stemlets:r,stemlet_extension:o,beam_width:a}}=this,l=t[0],h=this.getBeamYToDraw(),c=l.getStemX();for(let u=0;u=8&&(c=-1!==this.break_on_indices.indexOf(h),this.render_options.secondary_break_ticks&&a>=this.render_options.secondary_break_ticks&&(a=0,c=!0));const u=l.getIntrinsicTicks(){t.getStem()&&t.getStem().setContext(this.context).draw()}),this)}drawBeamLines(){this.checkContext();const t=["4","8","16","32","64"],e=this.notes[0];let i=this.getBeamYToDraw();const n=e.getStemX(),s=this.render_options.beam_width*this.stem_direction;for(let r=0;r{t.getStave()||t.setStave(this.stave)})),this.preFormatted=!0),this}draw(t=this.context,e=this.stave){this.setRendered();let i=null;for(let n=0;n0&&i){const t=r.getBoundingBox();t&&i.mergeWith(t)}r.setContext(t),r.drawWithStyle()}this.boundingBox=i}}function A(t,e,i,n,r){if(e!==C.type.BOLD_DOUBLE_LEFT&&e!==C.type.BOLD_DOUBLE_RIGHT)throw new s.RERR("InvalidConnector","A REPEAT_BEGIN or REPEAT_END type must be provided.");let o=3,a=3.5;e===C.type.BOLD_DOUBLE_RIGHT&&(o=-5,a=3),t.fillRect(i+o,n,1,r-n),t.fillRect(i-2,n,a,r-n)}class C extends h{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:C.type.SINGLE_RIGHT,singleLeft:C.type.SINGLE_LEFT,single:C.type.SINGLE,double:C.type.DOUBLE,brace:C.type.BRACE,bracket:C.type.BRACKET,boldDoubleLeft:C.type.BOLD_DOUBLE_LEFT,boldDoubleRight:C.type.BOLD_DOUBLE_RIGHT,thinDouble:C.type.THIN_DOUBLE,none:C.type.NONE}}constructor(t,e){super(),this.setAttribute("type","StaveConnector"),this.thickness=m.STAVE_LINE_THICKNESS,this.width=3,this.top_stave=t,this.bottom_stave=e,this.type=C.type.DOUBLE,this.font={family:"times",size:16,weight:"normal"},this.x_shift=0,this.texts=[]}setType(t){return(t="string"==typeof t?C.typeString[t]:t)>=C.type.SINGLE_RIGHT&&t<=C.type.NONE&&(this.type=t),this}setText(t,e){return this.texts.push({content:t,options:s.Merge({shift_x:0,shift_y:0},e)}),this}setFont(t){s.Merge(this.font,t)}setXShift(t){if("number"!=typeof t)throw s.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,n=this.width,r=this.top_stave.getX();(this.type===C.type.SINGLE_RIGHT||this.type===C.type.BOLD_DOUBLE_RIGHT||this.type===C.type.THIN_DOUBLE)&&(r=this.top_stave.getX()+this.top_stave.width);let o=i-e;switch(this.type){case C.type.SINGLE:case C.type.SINGLE_LEFT:case C.type.SINGLE_RIGHT:n=1;break;case C.type.DOUBLE:r-=this.width+2;break;case C.type.BRACE:{n=12;const s=this.top_stave.getX()-2+this.x_shift,r=e,a=s,l=i,h=s-n,c=r+o/2,u=h-.9*n,d=r+.2*o,f=s+1.1*n,p=c-.135*o,m=f,b=c+.135*o,g=u,y=l-.2*o,S=h-n,v=y,x=s+.4*n,E=c+.135*o,_=x,w=c-.135*o,T=S,M=d;t.beginPath(),t.moveTo(s,r),t.bezierCurveTo(u,d,f,p,h,c),t.bezierCurveTo(m,b,g,y,a,l),t.bezierCurveTo(S,v,x,E,h,c),t.bezierCurveTo(_,w,T,M,s,r),t.fill(),t.stroke();break}case C.type.BRACKET:e-=4,i+=4,o=i-e,p.renderGlyph(t,r-5,e-3,40,"v1b",!0),p.renderGlyph(t,r-5,i+3,40,"v10",!0),r-=this.width+2;break;case C.type.BOLD_DOUBLE_LEFT:A(t,this.type,r+this.x_shift,e,i);break;case C.type.BOLD_DOUBLE_RIGHT:A(t,this.type,r,e,i);break;case C.type.THIN_DOUBLE:n=1;break;case C.type.NONE:break;default:throw new s.RERR("InvalidType",`The provided StaveConnector.type (${this.type}) is invalid`)}this.type!==C.type.BRACE&&this.type!==C.type.BOLD_DOUBLE_LEFT&&this.type!==C.type.BOLD_DOUBLE_RIGHT&&this.type!==C.type.NONE&&t.fillRect(r,e,n,o),this.type===C.type.THIN_DOUBLE&&t.fillRect(r-3,e,n,o),t.save(),t.lineWidth=2,t.setFont(this.font.family,this.font.size,this.font.weight);for(let s=0;s0){const n=m.space.deviation,s=n>=0?"+":"";t.setFillStyle("red"),t.fillText(s+Math.round(n),a+e.getXShift(),i-10)}t.restore()}constructor(t){if(super(),this.setAttribute("type","Note"),!t)throw new s.RuntimeError("BadArguments","Note must have valid initialization data to identify duration and type.");const e=m.parseNoteStruct(t);if(!e)throw new s.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,t.duration_override?this.setDuration(t.duration_override):this.setIntrinsicTicks(e.ticks),this.modifiers=[],this.glyph=m.getGlyphProps(this.duration,this.noteType),this.customGlyphs=this.customTypes.map((t=>m.getGlyphProps(this.duration,t))),this.positions&&("object"!=typeof this.positions||!this.positions.length))throw new s.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:R.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 R.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.render_options.glyph_font_scale)}setYs(t){return this.ys=t,this}getYs(){if(0===this.ys.length)throw new s.RERR("NoYValues","No Y-values calculated for this note.");return this.ys}getYForTopText(t){if(!this.stave)throw new s.RERR("NoStave","No stave attached to this note.");return this.stave.getYForTopText(t)}getBoundingBox(){return null}getVoice(){if(!this.voice)throw new s.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 s.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");return{x:this.getAbsoluteX(),y:this.ys[0]}}getMetrics(){if(!this.preFormatted)throw new s.RERR("UnformattedNote","Can't call getMetrics on an unformatted note.");let t=0,e=0;null!=this.modifierContext&&(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 s.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 s.RERR("NoTickContext","Note needs a TickContext assigned for an X-Value");return this.tickContext.getX()+this.x_shift}getAbsoluteX(){if(!this.tickContext)throw new s.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()&&(t+=this.getCenterXShift()),t}setPreFormatted(t){if(this.preFormatted=t,this.preFormatted){const t=this.tickContext.getExtraPx();this.left_modPx=Math.max(this.left_modPx,t.left),this.right_modPx=Math.max(this.right_modPx,t.right)}}}class N extends R{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||k.STEM_UP,this.line=t.line,this.glyph=m.getGlyphProps(this.duration,this.note_type),!this.glyph)throw new s.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,s.Merge(this.render_options,{glyph_font_scale:t.glyph_font_scale||m.DEFAULT_NOTATION_FONT_SCALE,stroke_px:3}),this.setWidth(this.glyph.getWidth(this.render_options.glyph_font_scale))}getCategory(){return N.CATEGORY}getWidth(){return this.width}isDisplaced(){return!0===this.displaced}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=E.WIDTH/2;return t+(this.displaced?(this.width-e)*this.stem_direction:0)}getBoundingBox(){if(!this.preFormatted)throw new s.RERR("UnformattedNote","Can't call getBoundingBox on an unformatted note.");const t=this.stave.getSpacingBetweenLines(),e=t/2,i=this.y-e;return new m.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===E.UP?this.stem_up_x_offset:this.stem_down_x_offset);const i=this.y;!function(...t){N.DEBUG&&s.L("Vex.Flow.NoteHead",t)}("Drawing note head '",this.note_type,this.duration,"' at",e,i);const n=this.stem_direction,r=this.render_options.glyph_font_scale;if(this.style&&this.applyStyle(t),"s"===this.note_type){const s=this.stave.getSpacingBetweenLines();!function(t,e,i,n,s,r){const o=m.SLASH_NOTEHEAD_WIDTH;t.save(),t.setLineWidth(m.STEM_WIDTH);let a=!1;if(m.durationToNumber(e)>2&&(a=!0),a||(i-=m.STEM_WIDTH/2*s),t.beginPath(),t.moveTo(i,n+r),t.lineTo(i,n+1),t.lineTo(i+o,n-r),t.lineTo(i+o,n),t.lineTo(i,n+r),t.closePath(),a?t.fill():t.stroke(),m.durationToFraction(e).equals(.5)){const e=[-3,-1,o+1,o+3];for(let s=0;s{const i=t.getTickContext();t.setStave(e.stave),i.setXOffset(s)}))}}class O extends B{static get CATEGORY(){return"dots"}static format(t,e){const i=e.right_shift;if(!t||0===t.length)return!1;const n=[],s={};for(let u=0;ue.line-t.line));let r=i,o=0,a=null,l=null,h=null,c=0;for(let u=0;uo?r:o,a=d,l=e}return e.right_shift+=o,!0}constructor(){super(),this.setAttribute("type","Dot"),this.note=null,this.index=null,this.position=B.Position.RIGHT,this.radius=2,this.setWidth(5),this.dot_shiftY=0}getCategory(){return O.CATEGORY}setNote(t){this.note=t,"gracenotes"===this.note.getCategory()&&(this.radius*=.5,this.setWidth(3))}setDotShiftY(t){return this.dot_shiftY=t,this}draw(){if(this.checkContext(),this.setRendered(),!this.note||null===this.index)throw new s.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});"tabnotes"===this.note.getCategory()&&(e.y=this.note.getStemExtents().baseY);const i=e.x+this.x_shift+this.width-this.radius,n=e.y+this.y_shift+this.dot_shiftY*t,r=this.context;r.beginPath(),r.arc(i,n,this.radius,0,2*Math.PI,!1),r.fill()}}function D(t,e,i){const n=(e.isrest?0:1)*i;t.line+=n,t.maxLine+=n,t.minLine+=n,t.note.setKeyLine(0,t.note.getKeyLine(0)+n)}class k extends F{static get CATEGORY(){return"stavenotes"}static get STEM_UP(){return E.UP}static get STEM_DOWN(){return E.DOWN}static get DEFAULT_LEDGER_LINE_OFFSET(){return 3}static format(t,e){if(!t||t.length<2)return!1;if(t[0].getStave())return k.formatByY(t,e);const i=[];for(let s=0;s2?i[1]:null;let a=n>2?i[2]:i[1];2===n&&-1===r.stemDirection&&1===a.stemDirection&&(r=i[1],a=i[0]);const l=Math.max(r.voice_shift,a.voice_shift);let h,c=0;if(2===n){const t=r.stemDirection===a.stemDirection?0:.5;return r.stemDirection===a.stemDirection&&r.minLine<=a.maxLine&&(r.isrest||(h=Math.abs(r.line-(a.maxLine+.5)),h=Math.max(h,r.stemMin),r.minLine=r.line-h,r.note.setStemLength(10*h))),r.minLine<=a.maxLine+t&&(r.isrest?D(r,a,1):a.isrest?D(a,r,-1):(c=l,r.stemDirection===a.stemDirection?r.note.setXShift(c+3):a.note.setXShift(c))),!0}return null!==o&&o.minLinet.postFormat())),!0)}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.glyph=m.getGlyphProps(this.duration,this.noteType),!this.glyph)throw new s.RuntimeError("BadArguments",`Invalid note initialization data (No glyph found): ${JSON.stringify(t)}`);this.displaced=!1,this.dot_shiftY=0,this.keyProps=[],this.use_default_head_x=!1,this.note_heads=[],this.modifiers=[],s.Merge(this.render_options,{glyph_font_scale:t.glyph_font_scale||m.DEFAULT_NOTATION_FONT_SCALE,stroke_px:t.stroke_px||k.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((t=>t.getStyle()));this.buildNoteHeads(),this.note_heads.forEach(((e,i)=>e.setStyle(t[i]))),this.stave&&this.note_heads.forEach((t=>t.setStave(this.stave))),this.calcExtraPx()}setBeam(t){return this.beam=t,this.calcExtraPx(),this}getCategory(){return k.CATEGORY}buildStem(){this.setStem(new E({hide:!!this.isRest()}))}buildNoteHeads(){this.note_heads=[];const t=this.getStemDirection(),e=this.getKeys();let i,n,s,r=null,o=null,a=!1;t===E.UP?(i=0,n=e.length,s=1):t===E.DOWN&&(i=e.length-1,n=-1,s=-1);for(let l=i;l!==n;l+=s){const e=this.keyProps[l],i=e.line;null===r?r=i:(o=Math.abs(r-i),0===o||.5===o?a=!a:(a=!1,this.use_default_head_x=!0)),r=i;const n=new N({duration:this.duration,note_type:this.noteType,displaced:a,stem_direction:t,custom_glyph_code:e.code,glyph_font_scale:this.render_options.glyph_font_scale,x_shift:e.shift_right,stem_up_x_offset:e.stem_up_x_offset,stem_down_x_offset:e.stem_down_x_offset,line:e.line});this.note_heads[l]=n}}autoStem(){this.minLine=this.keyProps[0].line,this.maxLine=this.keyProps[this.keyProps.length-1].line;const t=(this.minLine+this.maxLine)/2<3?E.UP:E.DOWN;this.setStemDirection(t)}calculateKeyProps(){let t=null;for(let e=0;e0&&(this.keyProps[e-1].displaced=!0)),t=o,this.keyProps.push(r)}t=-1/0,this.keyProps.forEach((e=>{e.linet.line-e.line))}getBoundingBox(){if(!this.preFormatted)throw new s.RERR("UnformattedNote","Can't call getBoundingBox on an unformatted note.");const{width:t,modLeftPx:e,extraLeftPx:i}=this.getMetrics(),n=this.getAbsoluteX()-e-i;let r=0,o=0;const a=this.getStave().getSpacingBetweenLines()/2,l=2*a;if(this.isRest()){const t=this.ys[0],e=m.durationToFraction(this.duration);e.equals(1)||e.equals(2)?(r=t-a,o=t+a):(r=t-this.glyph.line_above*l,o=t+this.glyph.line_below*l)}else if(this.glyph.stem){const t=this.getStemExtents();t.baseY+=a*this.stem_direction,r=Math.min(t.topY,t.baseY),o=Math.max(t.topY,t.baseY)}else{r=null,o=null;for(let t=0;te&&(e=n):n1}hasStem(){return this.glyph.stem}hasFlag(){return super.hasFlag()&&!this.isRest()}getStemX(){return"r"===this.noteType?this.getCenterGlyphX():super.getStemX()+(t=this,E.WIDTH/(2*-t.getStemDirection()));var t}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((e=>(e.setStave(t),e.getY())));if(this.setYs(e),this.stem){const{y_top:t,y_bottom:e}=this.getNoteHeadBounds();this.stem.setYBounds(t,e)}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),n=Math.min(t,e);t=s.MidLine(i,n)}return t}getModifierStartXY(t,e,i){if(i=i||{},!this.preFormatted)throw new s.RERR("UnformattedNote","Can't call GetModifierStartXY on an unformatted note");if(0===this.ys.length)throw new s.RERR("NoYValues","No Y-Values calculated for this note.");const{ABOVE:n,BELOW:r,LEFT:o,RIGHT:a}=B.Position;let l=0;return t===o?l=-2:t===a?(l=this.getGlyphWidth()+this.x_shift+2,this.stem_direction===E.UP&&this.hasFlag()&&(i.forceFlagRight||e===((h=this).getStemDirection()===E.UP?h.keyProps.length-1:0))&&(l+=this.flag.getMetrics().width)):t!==r&&t!==n||(l=this.getGlyphWidth()/2),{x:this.getAbsoluteX()+l,y:this.ys[e]};var h}setStyle(t){super.setStyle(t),this.note_heads.forEach((e=>e.setStyle(t))),this.stem.setStyle(t)}setStemStyle(t){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.keyProps[t].line=e,this.reset(),this}getKeyLine(t){return this.keyProps[t].line}addToModifierContext(t){this.setModifierContext(t);for(let e=0;e{const u=c.getLine(),d=c.getY();(null===t||de)&&(e=d),null===n&&c.isDisplaced()&&(n=c.getAbsoluteX()),null!==i||c.isDisplaced()||(i=c.getAbsoluteX()),s=u>s?u:s,r=u{let s;s=i&&e?b-n:e?m-n:p-n;const l=e&&i?a:o;r.beginPath(),r.moveTo(s,t),r.lineTo(s+l,t),r.stroke()},y=t(t({},e.getStyle()||{}),this.getLedgerLineStyle()||{});this.applyStyle(r,y);for(let t=6;t<=l;++t){const i=null!==m&&t<=u,n=null!==p&&t<=c;g(e.getYForNote(t),i,n)}for(let t=0;t>=h;--t){const i=null!==m&&t>=f,n=null!==p&&t>=d;g(e.getYForNote(t),i,n)}this.restoreStyle(r,y)}drawModifiers(){if(!this.context)throw new s.RERR("NoCanvasContext","Can't draw without a canvas context.");const t=this.context;t.openGroup("modifiers");for(let e=0;e{this.context.openGroup("notehead",null,{pointerBBox:!0}),t.setContext(this.context).draw(),this.context.closeGroup()}))}drawStem(t){if(!this.context)throw new s.RERR("NoCanvasContext","Can't draw without a canvas context.");t&&this.setStem(new E(t)),this.context.openGroup("stem",null,{pointerBBox:!0}),this.stem.setContext(this.context).draw(),this.context.closeGroup()}draw(){if(!this.context)throw new s.RERR("NoCanvasContext","Can't draw without a canvas context.");if(!this.stave)throw new s.RERR("NoStave","Can't draw without a stave.");if(0===this.ys.length)throw new s.RERR("NoYValues","Can't draw note without Y values.");const t=this.getNoteHeadBeginX(),e=this.hasStem()&&!this.beam;this.note_heads.forEach((e=>e.setX(t)));const i=this.getStemX();this.stem.setNoteHeadXBounds(i,i),function(...t){k.DEBUG&&s.L("Vex.Flow.StaveNote",t)}("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}),e&&this.drawStem(),this.drawNoteHeads(),this.drawFlag(),this.context.closeGroup(),this.drawModifiers(),this.context.closeGroup(),this.restoreStyle(),this.setRendered()}}class V extends B{static get CATEGORY(){return"frethandfinger"}static format(t,e){const{left_shift:i,right_shift:n}=e;if(!t||0===t.length)return!1;const s=[];let r=null,o=0,a=0;for(let p=0;pe.line-t.line));let l=0,h=0,c=0,u=0,d=null,f=null;for(let p=0;pc?t:c):r===B.Position.RIGHT&&(o.setXShift(h),t=a+y,u=t>u?t:u),d=m,f=e}return e.left_shift+=c,e.right_shift+=u,!0}constructor(t){super(),this.setAttribute("type","FretHandFinger"),this.note=null,this.index=null,this.finger=t,this.width=7,this.position=B.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 V.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||null==this.index)throw new s.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,n=e.y+this.y_shift+this.y_offset+5;switch(this.position){case B.Position.ABOVE:i-=4,n-=12;break;case B.Position.BELOW:i-=2,n+=10;break;case B.Position.LEFT:i-=this.width;break;case B.Position.RIGHT:i+=1;break;default:throw new s.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,n),t.restore()}}class G{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:G.scales.major,m:G.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!(null==t||t<0||t>=G.NUM_TONES)}isValidIntervalValue(t){return this.isValidNoteValue(t)}getNoteParts(t){if(!t||t.length<1)throw new s.RERR("BadArguments","Invalid note name: "+t);if(t.length>3)throw new s.RERR("BadArguments","Invalid note name: "+t);const e=t.toLowerCase(),i=/^([cdefgab])(b|bb|n|#|##)?$/.exec(e);if(null!=i)return{root:i[1],accidental:i[2]};throw new s.RERR("BadArguments","Invalid note name: "+t)}getKeyParts(t){if(!t||t.length<1)throw new s.RERR("BadArguments","Invalid key: "+t);const e=t.toLowerCase(),i=/^([cdefgab])(b|#)?(mel|harm|m|M)?$/.exec(e);if(null!=i){const t=i[1],e=i[2];let n=i[3];return n||(n="M"),{root:t,accidental:e,type:n}}throw new s.RERR("BadArguments",`Invalid key: ${t}`)}getNoteValue(t){const e=G.noteValues[t];if(null==e)throw new s.RERR("BadArguments",`Invalid note name: ${t}`);return e.int_val}getIntervalValue(t){const e=G.intervals[t];if(null==e)throw new s.RERR("BadArguments",`Invalid interval name: ${t}`);return e}getCanonicalNoteName(t){if(!this.isValidNoteValue(t))throw new s.RERR("BadArguments",`Invalid note value: ${t}`);return G.canonical_notes[t]}getCanonicalIntervalName(t){if(!this.isValidIntervalValue(t))throw new s.RERR("BadArguments",`Invalid interval value: ${t}`);return G.diatonic_intervals[t]}getRelativeNoteValue(t,e,i){if(null==i&&(i=1),1!==i&&-1!==i)throw new s.RERR("BadArguments",`Invalid direction: ${i}`);let n=(t+i*e)%G.NUM_TONES;return n<0&&(n+=G.NUM_TONES),n}getRelativeNoteName(t,e){const i=this.getNoteParts(t),n=this.getNoteValue(i.root);let r=e-n;if(Math.abs(r)>G.NUM_TONES-3){let i=1;r>0&&(i=-1);const o=(e+1+(n+1))%G.NUM_TONES*i;if(Math.abs(o)>2)throw new s.RERR("BadArguments",`Notes not related: ${t}, ${e})`);r=o}if(Math.abs(r)>2)throw new s.RERR("BadArguments",`Notes not related: ${t}, ${e})`);let o=i.root;if(r>0)for(let s=1;s<=r;++s)o+="#";else if(r<0)for(let s=-1;s>=r;--s)o+="b";return o}getScaleTones(t,e){const i=[t];let n=t;for(let s=0;st.getMetrics().width;class z extends B{static get CATEGORY(){return"accidentals"}static format(t,e){const i=e.left_shift+1;if(!t||0===t.length)return;const n=[];let s,r=null,o=0;for(let m=0;me.line-t.line));const a=[];let l=0,h=null;for(let m=0;ml?t.shift:l,h=t.line}let c=0;for(let b=0;ba[e+t],s=t=>t.map(n),r=(t,e)=>{const[i,n]=s([t,e]).map((t=>t.line));return i-n},o=(...t)=>t.map(s).every((t=>!this.checkCollision(...t))),l=i-e+1;let h,u,d=this.checkCollision(a[e],a[i])?"a":"b";switch(l){case 3:"a"===d&&.5===r(1,2)&&.5!==r(0,1)&&(d="second_on_bottom");break;case 4:o([0,2],[1,3])&&(d="spaced_out_tetrachord");break;case 5:"b"===d&&o([1,3])&&(d="spaced_out_pentachord",o([0,2],[2,4])&&(d="very_spaced_out_pentachord"));break;case 6:o([0,3],[1,4],[2,5])&&(d="spaced_out_hexachord"),o([0,2],[2,4],[1,3],[3,5])&&(d="very_spaced_out_hexachord")}if(l>=7){let t=2,e=!0;for(;!0===e;){e=!1;for(let i=0;i+tu?c:u}else for(h=b;h<=i;h++)u=m.accidentalColumnsTable[l][d][h-b],a[h].column=u,c=c>u?c:u;b=i}const u=[],d=[];for(let m=0;m<=c;m++)u[m]=0,d[m]=0;u[0]=l+i,d[0]=l+i,a.forEach((t=>{t.width>u[t.column]&&(u[t.column]=t.width)}));for(let m=1;m{let e=0;const i=p+t.numAcc;for(;p0?(n=e.flatLine||e.dblSharpLine?2.5:3,t.dblSharpLine&&(i-=.5)):(n=t.flatLine||t.dblSharpLine?2.5:3,e.dblSharpLine&&(i-=.5));const s=Math.abs(i){const e=new r(0,1);t.getTickables().forEach((t=>{if(t.shouldIgnoreTicks())return;const s=n[e.value()];s?s.push(t):(i.push(e.value()),n[e.value()]=[t]),e.add(t.getTicks())}))}));const s=new G;e||(e="C");const o=s.createScaleMap(e);i.forEach((t=>{const e=n[t],i=[],r=t=>{t.isRest()||t.shouldIgnoreTicks()||(t.keys.forEach(((e,n)=>{const r=s.getNoteParts(e.split("/")[0]),a=r.accidental||"n",l=r.root+a,h=o[r.root]===l,c=i.indexOf(l)>-1;if(!h||h&&c){o[r.root]=l;const e=new z(a);t.addAccidental(n,e),i.push(l)}})),t.getModifiers().forEach((t=>{"gracenotegroups"===t.getCategory()&&t.getGraceNotes().forEach(r)})))};e.forEach(r)}))}constructor(t=null){if(super(),this.setAttribute("type","Accidental"),W("New accidental: ",t),this.note=null,this.index=null,this.type=t,this.position=B.Position.LEFT,this.render_options={font_scale:38,stroke_px:3,parenLeftPadding:2,parenRightPadding:2},this.accidental=m.accidentalCodes(this.type),!this.accidental)throw new s.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 p(this.accidental.code,t),this.glyph.setOriginX(1),this.cautionary&&(this.parenLeft=new p(m.accidentalCodes("{").code,t),this.parenRight=new p(m.accidentalCodes("}").code,t),this.parenLeft.setOriginX(1),this.parenRight.setOriginX(1))}getCategory(){return z.CATEGORY}getWidth(){const t=this.cautionary?U(this.parenLeft)+U(this.parenRight)+this.render_options.parenLeftPadding+this.render_options.parenRightPadding:0;return U(this.glyph)+t}setNote(t){if(!t)throw new s.RERR("ArgumentError",`Bad note value: ${t}`);this.note=t,"gracenotes"===this.note.getCategory()&&(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:n,index:r,cautionary:o,x_shift:a,y_shift:l,glyph:h,parenLeft:c,parenRight:u,render_options:{parenLeftPadding:d,parenRightPadding:f}}=this;if(this.checkContext(),!n||null==r)throw new s.RERR("NoAttachedNote","Can't draw accidental without a note and index.");const p=n.getModifierStartXY(i,r);let m=p.x+a;const b=p.y+l;W("Rendering: ",e,m,b),o?(u.render(t,m,b),m-=U(u),m-=f,m-=this.accidental.parenRightPaddingAdjustment,h.render(t,m,b),m-=U(h),m-=d,c.render(t,m,b)):h.render(t,m,b),this.setRendered()}}class j extends B{static get CATEGORY(){return"notesubgroup"}static format(t,e){if(!t||0===t.length)return!1;let i=0;for(let n=0;n{t.ignore_ticks=!1})),this.width=0,this.preFormatted=!1,this.formatter=new dt,this.voice=new L({num_beats:4,beat_value:4,resolution:m.RESOLUTION}).setStrict(!1),this.voice.addTickables(this.subNotes),this}getCategory(){return j.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||null===this.index)throw new s.RuntimeError("NoAttachedNote","Can't draw notes without a parent note and parent note index.");this.setRendered(),this.alignSubNotesWithNote(this.subNotes,t),this.subNotes.forEach((t=>t.setContext(this.context).drawWithStyle()))}}class H extends h{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:10,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 s.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 s.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(0===t.first_ys.length||0===t.last_ys.length)throw new s.RERR("BadArguments","No Y-values to render");const e=this.context;let i=this.render_options.cp1,n=this.render_options.cp2;Math.abs(t.last_x_px-t.first_x_px)<10&&(i=2,n=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;l1){const e=new P(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(function(...t){Y.DEBUG&&s.L("Vex.Flow.GraceNoteGroup",t)}("Drawing grace note group for:",t),!t||null===this.index)throw new s.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((t=>{t.setContext(this.context).draw()})),this.beams.forEach((t=>{t.setContext(this.context).draw()})),this.show_slur){const e=this.getNote().getCategory()===k.CATEGORY,i=e?H:X;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 K extends B{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;if(!t||0===t.length)return this;const n=t.map((t=>{const e=t.getNote();if(e instanceof k){const{line:i,displaced:n}=e.getKeyProps()[t.getIndex()];return{line:i,shift:n?e.getExtraLeftPx():0,stroke:t}}{const{str:i}=e.getPositions()[t.getIndex()];return{line:i,shift:0,stroke:t}}})),s=i,r=n.reduce(((t,{stroke:e,shift:i})=>(e.setXShift(s+i),Math.max(e.getWidth()+0,t))),0);return e.left_shift+=r,!0}constructor(t,e){super(),this.setAttribute("type","Stroke"),this.note=null,this.options=s.Merge({},e),this.all_voices=!("all_voices"in this.options)||this.options.all_voices,this.note_end=null,this.index=null,this.type=t,this.position=B.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 K.CATEGORY}getPosition(){return this.position}addEndNote(t){return this.note_end=t,this}draw(){if(this.checkContext(),this.setRendered(),!this.note||null==this.index)throw new s.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,n=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 f=0;fe.line-t.line));let f=0,p=0,m=0,b=null,g=null;for(r=0;rp?t:p):l===B.Position.RIGHT&&(o.setXShift(f),t+=c,m=t>m?t:m),b=e,g=a}return e.left_shift+=p,e.right_shift+=m,!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=B.Position.ABOVE,this.x_shift=0,this.y_shift=0,this.x_offset=0,this.y_offset=0,this.dashed=!0,this.leg=x.LineEndType.NONE,this.radius=8,this.font={family:"sans-serif",size:10,weight:"bold"}}getCategory(){return q.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>=x.LineEndType.NONE&&t<=x.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||null==this.index)throw new s.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 n=i.x+this.x_shift+this.x_offset,r=i.y+this.y_shift+this.y_offset;switch(this.position){case B.Position.ABOVE:case B.Position.BELOW:{const t=this.note.getStemExtents();let n=t.topY,s=t.baseY+2;this.note.stem_direction===k.STEM_DOWN&&(n=t.baseY,s=t.topY-2),r=this.position===B.Position.ABOVE?this.note.hasStem()?n-1.75*e:i.y-1.75*e:this.note.hasStem()?s+1.5*e:i.y+1.75*e,r+=this.y_shift+this.y_offset;break}case B.Position.LEFT:n-=this.radius/2+5;break;case B.Position.RIGHT:n+=this.radius/2+6;break;default:throw new s.RERR("InvalidPosition",`The position ${this.position} is invalid`)}t.save(),t.beginPath(),t.arc(n,r,this.radius,0,2*Math.PI,!1),t.lineWidth=1.5,t.stroke(),t.setFont(this.font.family,this.font.size,this.font.weight);const o=n-t.measureText(this.string_number).width/2;if(t.fillText(""+this.string_number,o,r+4.5),null!=this.last_note){const e=this.last_note.getStemX()-this.note.getX()+5;let i,s;switch(t.strokeStyle="#000000",t.lineCap="round",t.lineWidth=.6,this.dashed?x.drawDashedLine(t,n+10,r,n+e,r,[3,3]):x.drawDashedLine(t,n+10,r,n+e,r,[3,0]),this.leg){case x.LineEndType.UP:i=-10,s=this.dashed?[3,3]:[3,0],x.drawDashedLine(t,n+e,r,n+e,r+i,s);break;case x.LineEndType.DOWN:i=10,s=this.dashed?[3,3]:[3,0],x.drawDashedLine(t,n+e,r,n+e,r+i,s)}}t.restore()}}const{ABOVE:$,BELOW:J}=B.Position,Z=(t,e)=>.5*t(e/.5),Q=(t,e)=>e===$?t<=5:t>=1,tt=(t,e)=>Q(t,e)?e===$?Math.ceil:Math.floor:Math.round,et=t=>{const e=t.getCategory();return"stavenotes"===e||"gracenotes"===e};class it extends B{static get CATEGORY(){return"articulations"}static get INITIAL_OFFSET(){return-.5}static format(t,e){if(!t||0===t.length)return!1;const i=(t,e,i)=>Z(tt(e,i),t.glyph.getMetrics().height/10+.5);t.filter((t=>t.getPosition()===$)).forEach((t=>{t.setTextLine(e.top_text_line),e.top_text_line+=i(t,e.top_text_line,$)})),t.filter((t=>t.getPosition()===J)).forEach((t=>{t.setTextLine(e.text_line),e.text_line+=i(t,e.text_line,J)}));const n=t.map((t=>t.getWidth())).reduce(((t,e)=>Math.max(e,t)));return e.left_shift+=n/2,e.right_shift+=n/2,!0}static easyScoreHook({articulations:t},e,i){if(!t)return;const n={staccato:"a.",tenuto:"a-"};t.split(",").map((t=>t.trim().split("."))).map((([t,e])=>{const s={type:n[t]};return e&&(s.position=B.PositionString[e]),i.getFactory().Articulation(s)})).map((t=>e.addModifier(0,t)))}constructor(t){if(super(),this.setAttribute("type","Articulation"),this.note=null,this.index=null,this.type=t,this.position=J,this.render_options={font_scale:38},this.articulation=m.articulationCodes(this.type),!this.articulation)throw new s.RERR("ArgumentError",`Articulation not found: ${this.type}`);this.glyph=new p(this.articulation.code,this.render_options.font_scale),this.setWidth(this.glyph.getMetrics().width)}getCategory(){return it.CATEGORY}draw(){const{note:t,index:e,position:i,glyph:n,articulation:{between_lines:r},text_line:o,context:a}=this;if(this.checkContext(),!t||null==e)throw new s.RERR("NoAttachedNote","Can't draw Articulation without a note and index.");this.setRendered();const l=t.getStave(),h=l.getSpacingBetweenLines(),c="tabnotes"===t.getCategory(),{x:u}=t.getModifierStartXY(i,e),d=!r||c,f=((t,e)=>{const i=e===$&&t.getStemDirection()===E.UP||e===J&&t.getStemDirection()===E.DOWN;return et(t)?t.hasStem()&&i?.5:1:t.hasStem()&&i?1:0})(t,i);let p={[$]:()=>{n.setOrigin(.5,1);const e=((t,e)=>{const i=t.getStave(),n=t.getStemDirection(),{topY:r,baseY:o}=t.getStemExtents();if(et(t))return t.hasStem()?n===E.UP?r:o:Math.min(...t.getYs());if("tabnotes"===t.getCategory())return t.hasStem()&&n===E.UP?r:i.getYForTopText(e);throw new s.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")})(t,o)-(o+f)*h;return d?Math.min(l.getYForTopText(it.INITIAL_OFFSET),e):e},[J]:()=>{n.setOrigin(.5,0);const e=((t,e)=>{const i=t.getStave(),n=t.getStemDirection(),{topY:r,baseY:o}=t.getStemExtents();if(et(t))return t.hasStem()?n===E.UP?o:r:Math.max(...t.getYs());if("tabnotes"===t.getCategory())return t.hasStem()?n===E.UP?i.getYForBottomText(e):r:i.getYForBottomText(e);throw new s.RERR("UnknownCategory","Only can get the top and bottom ys of stavenotes and tabnotes")})(t,o)+(o+f)*h;return d?Math.max(l.getYForBottomText(it.INITIAL_OFFSET),e):e}}[i]();if(!c){const s=i===$?-1:1,o=c?t.positions[e].str:t.getKeyProps()[e].line,a=(t.getYs()[e]-p)/h+o,l=((t,e,i,n)=>{const s=Z(tt(e,i),e);return t&&Q(s,i)&&s%1==0?s+.5*-n:s})(r,a,i,s);Q(l,i)&&n.setOrigin(.5,.5),p+=Math.abs(l-a)*h*s}!function(...t){it.DEBUG&&s.L("Vex.Flow.Articulation",t)}(`Rendering articulation at (x: ${u}, y: ${p})`),n.render(a,u,p)}}class nt extends I{static getNextContext(t){const e=t.tContexts,i=e.indexOf(t);return e[i+1]}constructor(){super(),this.setAttribute("type","TickContext"),this.currentTick=new r(0,1),this.maxTicks=new r(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+2*this.padding}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:n}=this;return{width:t,notePx:e,extraLeftPx:i,extraRightPx:n}}getCurrentTick(){return this.currentTick}setCurrentTick(t){this.currentTick=t,this.preFormatted=!1}getExtraPx(){let t=0,e=0,i=0,n=0;for(let s=0;s0&&n--;for(let a=0;a{lt("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=>{lt("Postformatting ModifierContext: ",t.CATEGORY),t.postFormat(this.getModifiers(t.CATEGORY),this)}))}}function ct(t,e,i,n){let r=e;for(i+=1;i{if(!e.getTotalTicks().equals(n))throw new s.RERR("TickMismatch","Voices should have same total note duration in ticks.");if(e.getMode()===L.Mode.STRICT&&!e.isComplete())throw new s.RERR("IncompleteVoice","Voice does not have enough notes.");return Math.max(t,r.LCM(t,e.getResolutionMultiplier()))}),1),a={},l=[],h=[];return t.forEach((t=>{const n=new r(0,o);t.getTickables().forEach((t=>{const s=n.numerator;if(!a[s]){const t=new e;h.push(t),a[s]=t}i(t,a[s]),l.push(s),n.add(t.getTicks())}))})),{map:a,array:h,list:s.SortAndUnique(l,((t,e)=>t-e),((t,e)=>t===e)),resolutionMultiplier:o}}class dt{static SimpleFormat(t,e=0,{paddingBetween:i=10}={}){t.reduce(((t,e)=>{e.addToModifierContext(new ht);const n=(new nt).addTickable(e).preFormat(),s=n.getExtraPx();return n.setX(t+s.left),t+n.getWidth()+s.right+i}),e)}static plotDebugging(t,e,i,n,s){const r=i+R.STAVEPADDING,o=e.contextGaps;t.save(),t.setFont("Arial",8,""),o.gaps.forEach((e=>{var i,o,a;i=r+e.x1,o=r+e.x2,a="#aaa",t.beginPath(),t.setStrokeStyle(a),t.setFillStyle(a),t.setLineWidth(1),t.fillRect(i,n,o-i,s-n),t.fillText(Math.round(e.x2-e.x1),r+e.x1,s+12)})),t.fillText(Math.round(o.total)+"px",r-20,s+12),t.setFillStyle("red"),t.fillText("Loss: "+e.lossHistory.map((t=>Math.round(t))),r-20,s+22),t.restore()}static FormatAndDraw(t,e,i,n){const r={auto_beam:!1,align_rests:!1};"object"==typeof n?s.Merge(r,n):"boolean"==typeof n&&(r.auto_beam=n);const o=new L(m.TIME4_4).setMode(L.Mode.SOFT).addTickables(i),a=r.auto_beam?P.applyAndGetBeams(o):[];return(new dt).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((e=>e.setContext(t).draw())),o.getBoundingBox()}static FormatAndDrawTab(t,e,i,n,r,o,a){const l={auto_beam:o,align_rests:!1};"object"==typeof a?s.Merge(l,a):"boolean"==typeof a&&(l.auto_beam=a);const h=new L(m.TIME4_4).setMode(L.Mode.SOFT).addTickables(r),c=new L(m.TIME4_4).setMode(L.Mode.SOFT).addTickables(n),u=l.auto_beam?P.applyAndGetBeams(h):[];(new dt).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((e=>e.setContext(t).draw())),new C(i,e).setContext(t).draw()}static AlignRestsToNotes(t,e,i){return t.forEach(((n,s)=>{if(n instanceof k&&n.isRest()){if(n.tuplet&&!i)return;const r=n.getGlyph().position.toUpperCase();if("R/4"!==r&&"B/4"!==r)return;if(e||null!=n.beam){const e=n.getKeyProps()[0];if(0===s)e.line=ct(t,e.line,s,!1),n.setKeyLine(0,e.line);else if(s>0&&sdt.AlignRestsToNotes(t.getTickables(),e)))}preCalculateMinTotalWidth(t){if(this.hasMinTotalWidth)return this.minTotalWidth;if(!this.tickContexts){if(!t)throw new s.RERR("BadArgument","'voices' required to run preCalculateMinTotalWidth");this.createTickContexts(t)}const{list:e,map:i}=this.tickContexts;return this.minTotalWidth=e.map((t=>{const e=i[t];return e.preFormat(),e.getWidth()})).reduce(((t,e)=>t+e),0),this.hasMinTotalWidth=!0,this.minTotalWidth}getMinTotalWidth(){if(!this.hasMinTotalWidth)throw new s.RERR("NoMinTotalWidth","Call 'preCalculateMinTotalWidth' or 'preFormat' before calling 'getMinTotalWidth'");return this.minTotalWidth}createModifierContexts(t){const e=ut(t,ht,((t,e)=>t.addToModifierContext(e)));return this.modiferContexts=e,e}createTickContexts(t){const e=ut(t,nt,((t,e)=>e.addTickable(t)));return e.array.forEach((t=>{t.tContexts=e.array})),this.totalTicks=t[0].getTicksUsed().clone(),this.tickContexts=e,e}preFormat(t=0,e,i,n){const s=this.tickContexts,{list:r,map:o,resolutionMultiplier:a}=s;i&&n&&i.forEach((t=>t.setStave(n).preFormat()));let l=0,h=0;const c=t/2;if(this.minTotalWidth=0,r.forEach((t=>{const i=o[t];e&&i.setContext(e),i.preFormat();const n=i.getWidth();this.minTotalWidth+=n;const s=i.getMetrics();l=l+h+s.extraLeftPx,i.setX(l),h=n-s.extraLeftPx})),this.minTotalWidth=l+h,this.hasMinTotalWidth=!0,t<=0)return;const u=(t-this.minTotalWidth)/(this.totalTicks.value()*a);let d=0;r.forEach(((t,e)=>{const i=r[e-1]||0,n=o[t];d+=(t-i)*u,n.setX(n.getX()+d),n.getCenterAlignedTickables().forEach((t=>{t.center_x_shift=c-n.getX()}))})),1!==r.length&&(this.justifyWidth=t,this.lossHistory=[],this.evaluate())}evaluate(){const t=this.justifyWidth;this.contextGaps={total:0,gaps:[]},this.tickContexts.list.forEach(((t,e)=>{if(0===e)return;const i=this.tickContexts.list[e-1],n=this.tickContexts.map[i],s=this.tickContexts.map[t],r=n.getMetrics(),o=n.getX()+r.width,a=s.getX(),l=a-o;this.contextGaps.total+=l,this.contextGaps.gaps.push({x1:o,x2:a}),s.getFormatterMetrics().freedom.left=l,n.getFormatterMetrics().freedom.right=l}));const e=this.durationStats={};this.voices.forEach((i=>{i.getTickables().forEach(((i,n,s)=>{const r=i.getTicks().clone().simplify().toString(),o=i.getMetrics(),a=i.getFormatterMetrics(),l=i.getX()+o.noteWidth+o.modRightPx+o.extraRightPx;let h=0;if(n{t.getTickables().forEach((t=>{const n=t.getTicks().clone().simplify().toString(),s=t.getFormatterMetrics();s.iterations+=1,s.space.deviation=s.space.used-e[n].mean,s.duration=n,s.space.mean=e[n].mean,i+=Math.pow(e[n].mean,2)}))})),this.totalCost=Math.sqrt(i),this.lossHistory.push(this.totalCost),this}tune(){let t=0;return this.tickContexts.list.forEach(((e,i,n)=>{const s=this.tickContexts.map[e],r=i>0?this.tickContexts.map[n[i-1]]:null,o=it.getFormatterMetrics().space.deviation)).reduce(((t,e)=>t+e));u>0?t=-Math.min(s.getFormatterMetrics().freedom.right,Math.abs(u)):u<0&&(t=o?Math.min(o.getFormatterMetrics().freedom.right,Math.abs(u)):0);const d=Math.min(5,Math.abs(t));t=t>0?d:-d})),this.evaluate()}postFormat(){const t=t=>t.list.forEach((e=>t.map[e].postFormat()));return t(this.modiferContexts),t(this.tickContexts),this}joinVoices(t){return this.createModifierContexts(t),this.hasMinTotalWidth=!1,this}format(t,e,i){const n={align_rests:!1,context:null,stave:null};return s.Merge(n,i),this.voices=t,this.alignRests(t,n.align_rests),this.createTickContexts(t),this.preFormat(e,n.context,t,n.stave),n.stave&&this.postFormat(),this}formatToStave(t,e,i){const n=e.getNoteEndX()-e.getNoteStartX()-10;!function(...t){dt.DEBUG&&s.L("Vex.Flow.Formatter",t)}("Formatting voices to width: ",n);const r={context:e.getContext()};return s.Merge(r,i),this.format(t,n,r)}}class ft extends h{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=ft.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:()=>!0,setStave(){},renderToStave(){},getMetrics:()=>({width:t})}}placeGlyphOnLine(t,e,i){t.setYShift(e.getYForLine(i)-e.getYForGlyphs())}getPadding(t){return void 0!==t&&t<2?0:this.padding}setPadding(t){return this.padding=t,this}setLayoutMetrics(t){return this.layoutMetrics=t,this}getLayoutMetrics(){return this.layoutMetrics}}class pt extends ft{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:pt.type.SINGLE,double:pt.type.DOUBLE,end:pt.type.END,repeatBegin:pt.type.REPEAT_BEGIN,repeatEnd:pt.type.REPEAT_END,repeatBoth:pt.type.REPEAT_BOTH,none:pt.type.NONE}}constructor(t){super(),this.setAttribute("type","Barline"),this.thickness=m.STAVE_LINE_THICKNESS;const e=pt.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(ft.Position.BEGIN),this.setType(t)}getCategory(){return pt.CATEGORY}getType(){return this.type}setType(t){return this.type="string"==typeof t?pt.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 pt.type.SINGLE:this.drawVerticalBar(t,this.x,!1);break;case pt.type.DOUBLE:this.drawVerticalBar(t,this.x,!0);break;case pt.type.END:this.drawVerticalEndBar(t,this.x);break;case pt.type.REPEAT_BEGIN:this.drawRepeatBar(t,this.x,!0),t.getX()!==this.x&&this.drawVerticalBar(t,t.getX());break;case pt.type.REPEAT_END:this.drawRepeatBar(t,this.x,!1);break;case pt.type.REPEAT_BOTH:this.drawRepeatBar(t,this.x,!1),this.drawRepeatBar(t,this.x,!0)}}drawVerticalBar(t,e,i){t.checkContext();const n=t.getTopLineTopY(),s=t.getBottomLineBottomY();i&&t.context.fillRect(e-3,n,1,s-n),t.context.fillRect(e,n,1,s-n)}drawVerticalEndBar(t,e){t.checkContext();const i=t.getTopLineTopY(),n=t.getBottomLineBottomY();t.context.fillRect(e-5,i,1,n-i),t.context.fillRect(e-2,i,3,n-i)}drawRepeatBar(t,e,i){t.checkContext();const n=t.getTopLineTopY(),s=t.getBottomLineBottomY();let r=3;i||(r=-5),t.context.fillRect(e+r,n,1,s-n),t.context.fillRect(e-2,n,3,s-n),i?r+=4:r-=4;const o=e+r+1;let a=(t.getNumLines()-1)*t.getSpacingBetweenLines();a=a/2-t.getSpacingBetweenLines()/2;let l=n+a+1;t.context.beginPath(),t.context.arc(o,l,2,0,2*Math.PI,!1),t.context.fill(),l+=t.getSpacingBetweenLines(),t.context.beginPath(),t.context.arc(o,l,2,0,2*Math.PI,!1),t.context.fill()}}class mt extends ft{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 mt.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 mt.type.CODA_RIGHT:this.drawCodaFixed(t,e+t.width);break;case mt.type.CODA_LEFT:this.drawSymbolText(t,e,"Coda",!0);break;case mt.type.SEGNO_LEFT:this.drawSignoFixed(t,e);break;case mt.type.SEGNO_RIGHT:this.drawSignoFixed(t,e+t.width);break;case mt.type.DC:this.drawSymbolText(t,e,"D.C.",!1);break;case mt.type.DC_AL_CODA:this.drawSymbolText(t,e,"D.C. al",!0);break;case mt.type.DC_AL_FINE:this.drawSymbolText(t,e,"D.C. al Fine",!1);break;case mt.type.DS:this.drawSymbolText(t,e,"D.S.",!1);break;case mt.type.DS_AL_CODA:this.drawSymbolText(t,e,"D.S. al",!0);break;case mt.type.DS_AL_FINE:this.drawSymbolText(t,e,"D.S. al Fine",!1);break;case mt.type.FINE:this.drawSymbolText(t,e,"Fine",!1);break;case mt.type.TO_CODA:this.drawSymbolText(t,e,"To",!0)}return this}drawCodaFixed(t,e){const i=t.getYForTopText(t.options.num_lines)+this.y_shift;return p.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 p.renderGlyph(t.context,this.x+e+this.x_shift,i+25,30,"v8c",!0),this}drawSymbolText(t,e,i,n){const s=t.checkContext();s.save(),s.setFont(this.font.family,this.font.size,this.font.weight);let r=0+this.x_shift,o=e+this.x_shift;this.symbol_type===mt.type.CODA_LEFT?(r=this.x+t.options.vertical_bar_width,o=r+s.measureText(i).width+12):this.symbol_type===mt.type.TO_CODA||this.symbol_type===mt.type.DS_AL_CODA?(this.x_shift=-(r+s.measureText(i).width+12+t.options.vertical_bar_width+12),r=this.x+this.x_shift+t.options.vertical_bar_width,o=r+s.measureText(i).width+12):(o=this.x+e+t.width-5+this.x_shift,r=o-+s.measureText(i).width-12);const a=t.getYForTopText(t.options.num_lines)+this.y_shift+25;return n&&p.renderGlyph(s,o,a,40,"v4d",!0),s.fillText(i,r,a+5),s.restore(),this}}class bt extends ft{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 bt.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 n=i.measureText(""+this.section),s=n.width,r=n.height;let o=s+6;o<18&&(o=18);const a=r,l=t.getYForTopText(3)+this.shift_y;let h=this.x+e;return i.beginPath(),i.lineWidth=2,i.rect(h,l+r/4,o,a),i.stroke(),h+=(o-s)/2,i.fillText(""+this.section,h,l+16),i.restore(),this}}class gt extends ft{static get CATEGORY(){return"stavetempo"}constructor(t,e,i){super(),this.setAttribute("type","StaveTempo"),this.tempo=t,this.position=B.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 gt.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 n=this.render_options,s=n.glyph_font_scale/38,r=this.tempo.name,o=this.tempo.duration,a=this.tempo.dots,l=this.tempo.bpm,h=this.font;let c=this.x+this.shift_x+e;const u=t.getYForTopText(1)+this.shift_y;if(i.save(),r&&(i.setFont(h.family,h.size,h.weight),i.fillText(r,c,u),c+=i.measureText(r).width),o&&l){i.setFont(h.family,h.size,"normal"),r&&(c+=i.measureText(" ").width,i.fillText("(",c,u),c+=i.measureText("(").width);const t=m.getGlyphProps(o);if(c+=3*s,p.renderGlyph(i,c,u,n.glyph_font_scale,t.code_head),c+=t.getWidth()*s,t.stem){let e=30;t.beam_count&&(e+=3*(t.beam_count-1)),e*=s;const r=u-e;i.fillRect(c-s,r,s,e),t.flag&&(p.renderGlyph(i,c,r,n.glyph_font_scale,t.code_flag_upstem),a||(c+=6*s))}for(let e=0;e=t.line?i.above:i.below)}this.placeGlyphOnLine(n,this.stave,t.line),this.glyphs.push(n);const r=this.xPositions[this.xPositions.length-1],o=n.getMetrics().width+s;this.xPositions.push(r+o),this.width+=o}cancelKey(t){return this.formatted=!1,this.cancelKeySpec=t,this}convertToCancelAccList(t){const e=m.keySignature(t),i=this.accList.length>0&&e.length>0&&e[0].type!==this.accList[0].type,n=i?e.length:e.length-this.accList.length;if(n<1)return;const s=[];for(let r=0;r0?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 n=(this.position===ft.Position.END?this.stave.endClef:this.stave.clef)||this.stave.clef;i&&this.convertAccLines(n,i.type,i.accList),this.convertAccLines(n,e,t);for(let t=0;t{const e=t.split("/").filter((t=>""!==t));if(2!==e.length)throw new s.RERR("BadTimeSignature",`Invalid time spec: ${t}. Must be in the form "/"`);e.forEach((e=>{if(isNaN(Number(e)))throw new s.RERR("BadTimeSignature",`Invalid time spec: ${t}. Must contain two valid numbers.`)}))})(t);const[e,i]=t.split("/").map((t=>t.split("")));return{num:!0,glyph:this.makeTimeSignatureGlyph(e,i)}}makeTimeSignatureGlyph(t,e){const i=new p("v0",this.point);i.topGlyphs=[],i.botGlyphs=[];let n=0;for(let c=0;cs?n:s,o=i.getMetrics().x_min;i.getMetrics=()=>({x_min:o,x_max:o+r,width:r});const a=(r-n)/2,l=(r-s)/2,h=this;return i.renderToStave=function(t){let e=t+a;for(let i=0;ii.getWidth()&&(e-=i.getWidth()),e}setRepetitionTypeLeft(t,e){return this.modifiers.push(new mt(t,this.x,e)),this}setRepetitionTypeRight(t,e){return this.modifiers.push(new mt(t,this.x,e)),this}setVoltaType(t,e,i){return this.modifiers.push(new _t(t,e,this.x,i)),this}setSection(t,e,i=0,n=12){const s=new bt(t,this.x+i,e);return s.font.size=n,this.modifiers.push(s),this}setTempo(t,e){return this.modifiers.push(new gt(t,this.x,e)),this}setText(t,e,i){return this.modifiers.push(new St(t,e,i)),this}getHeight(){return this.height}getSpacingBetweenLines(){return this.options.spacing_between_lines_px}getBoundingBox(){return new u(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,n=e.space_above_staff_ln;return this.y+t*i+n*i}getLineForY(t){const e=this.options,i=e.spacing_between_lines_px,n=e.space_above_staff_ln;return(t-this.y)/i-n}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,n=e.space_above_staff_ln;return this.y+n*i+5*i-t*i}getYForGlyphs(){return this.getYForLine(3)}addModifier(t,e){return void 0!==e&&t.setPosition(e),t.setStave(this),this.formatted=!1,this.modifiers.push(t),this}addEndModifier(t){return this.addModifier(t,ft.Position.END),this}setBegBarType(t){const{SINGLE:e,REPEAT_BEGIN:i,NONE:n}=pt.type;return t!==e&&t!==i&&t!==n||(this.modifiers[0].setType(t),this.formatted=!1),this}setEndBarType(t){return t!==pt.type.REPEAT_BEGIN&&(this.modifiers[1].setType(t),this.formatted=!1),this}setClef(t,e,i,n){void 0===n&&(n=ft.Position.BEGIN),n===ft.Position.END?this.endClef=t:this.clef=t;const s=this.getModifiers(n,vt.CATEGORY);return 0===s.length?this.addClef(t,e,i,n):s[0].setType(t,e,i),this}setEndClef(t,e,i){return this.setClef(t,e,i,ft.Position.END),this}setKeySignature(t,e,i){void 0===i&&(i=ft.Position.BEGIN);const n=this.getModifiers(i,xt.CATEGORY);return 0===n.length?this.addKeySignature(t,e,i):n[0].setKeySig(t,e),this}setEndKeySignature(t,e){return this.setKeySignature(t,e,ft.Position.END),this}setTimeSignature(t,e,i){void 0===i&&(i=ft.Position.BEGIN);const n=this.getModifiers(i,Et.CATEGORY);return 0===n.length?this.addTimeSignature(t,e,i):n[0].setTimeSig(t),this}setEndTimeSignature(t,e){return this.setTimeSignature(t,e,ft.Position.END),this}addKeySignature(t,e,i){return void 0===i&&(i=ft.Position.BEGIN),this.addModifier(new xt(t,e).setPosition(i),i),this}addClef(t,e,i,n){return void 0===n||n===ft.Position.BEGIN?this.clef=t:n===ft.Position.END&&(this.endClef=t),this.addModifier(new vt(t,e,i),n),this}addEndClef(t,e,i){return this.addClef(t,e,i,ft.Position.END),this}addTimeSignature(t,e,i){return this.addModifier(new Et(t,e),i),this}addEndTimeSignature(t,e){return this.addTimeSignature(t,e,ft.Position.END),this}addTrebleGlyph(){return this.addClef("treble"),this}getModifiers(t,e){return void 0===t&&void 0===e?this.modifiers:this.modifiers.filter((i=>!(void 0!==t&&t!==i.getPosition()||void 0!==e&&e!==i.getCategory())))}sortByCategory(t,e){for(let i=t.length-1;i>=0;i--)for(let n=0;ne[t[n+1].getCategory()]){const e=t[n];t[n]=t[n+1],t[n+1]=e}}format(){const t=this.modifiers[0],e=this.modifiers[1],i=this.getModifiers(ft.Position.BEGIN),n=this.getModifiers(ft.Position.END);let s,r,o;this.sortByCategory(i,{barlines:0,clefs:1,keysignatures:2,timesignatures:3}),this.sortByCategory(n,{timesignatures:0,keysignatures:1,barlines:2,clefs:3}),i.length>1&&t.getType()===pt.type.REPEAT_BEGIN&&(i.push(i.splice(0,1)[0]),i.splice(0,0,new pt(pt.type.SINGLE))),n.indexOf(e)>0&&n.splice(0,0,new pt(pt.type.NONE));let a=0,l=this.x;for(let u=0;u0){this.context.save(),this.context.setFont(this.font.family,this.font.size,this.font.weight);const t=this.context.measureText(""+this.measure).width;n=this.getYForTopText(0)+3,this.context.fillText(""+this.measure,this.x-t/2,n),this.context.restore()}return this}drawVertical(t,e){this.drawVerticalFixed(this.x+t,e)}drawVerticalFixed(t,e){this.checkContext();const i=this.getYForLine(0),n=this.getYForLine(this.options.num_lines-1);e&&this.context.fillRect(t-3,i,1,n-i+1),this.context.fillRect(t,i,1,n-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 s.RERR("StaveConfigError","The line number must be within the range of the number of lines in the Stave.");if(void 0===e.visible)throw new s.RERR("StaveConfigError","The line configuration object is missing the 'visible' property.");if("boolean"!=typeof e.visible)throw new s.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 s.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]),s.Merge(this.options.line_config[e],t[e]);return this.options.line_config=t,this}}class Tt extends wt{constructor(t,e,i,n){const r={spacing_between_lines_px:13,num_lines:6,top_text_position:1};s.Merge(r,n),super(t,e,i,r),this.setAttribute("type","TabStave")}getYForGlyphs(){return this.getYForLine(2.5)}addTabGlyph(){return this.addClef("tab"),this}}class Mt extends F{static get CATEGORY(){return"tabnotes"}constructor(t,e){if(super(t),this.setAttribute("type","TabNote"),this.ghost=!1,this.positions=t.positions,s.Merge(this.render_options,{glyph_font_scale:m.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=m.getGlyphProps(this.duration,this.noteType),!this.glyph)throw new s.RuntimeError("BadArguments",`Invalid note initialization data (No glyph found): ${JSON.stringify(t)}`);this.buildStem(),t.stem_direction?this.setStemDirection(t.stem_direction):this.setStemDirection(E.UP),this.ghost=!1,this.updateWidth()}reset(){this.stave&&this.setStave(this.stave)}getCategory(){return Mt.CATEGORY}setGhost(t){return this.ghost=t,this.updateWidth(),this}hasStem(){return this.render_options.draw_stem}getStemExtension(){const t=this.getGlyph();return null!=this.stem_extension_override?this.stem_extension_override:t?1===this.getStemDirection()?t.tabnote_stem_up_extension:t.tabnote_stem_down_extension:0}addDot(){const t=new O;return this.dots+=1,this.addModifier(t,0)}updateWidth(){this.glyphs=[],this.width=0;for(let t=0;tthis.width}setStave(t){let e;if(super.setStave(t),this.context=t.context,this.context){const t=this.context;for(this.width=0,e=0;ei.width),this.width=Math.max(i.getWidth(),this.width)}this.glyph.getWidth=()=>this.width}const i=this.positions.map((({str:e})=>t.getYForLine(e-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{("dots"!==t.getCategory()||this.render_options.draw_dots)&&(t.setContext(this.context),t.drawWithStyle())}))}drawStemThrough(){const t=this.getStemX(),e=this.getStemY(),i=this.context,n=this.render_options.draw_stem_through_stave;if(this.render_options.draw_stem&&n){const n=function(t,e,i,n){const s=1!==n,r=-1!==n,o=i.getSpacingBetweenLines(),a=i.getNumLines(),l=[];return e.forEach((e=>{const h=e.indexOf(a)>-1,c=e.indexOf(1)>-1;if(s&&c||r&&h)return;1===e.length&&e.push(e[0]);const u=[];e.forEach(((e,s,r)=>{const l=1===e,h=e===a;let c=i.getYForLine(e-1);0!==s||l?s!==r.length-1||h||(c+=o/2-1):c-=o/2-1,u.push(c),1===n&&l?u.push(t-2):-1===n&&h&&u.push(t+2)})),l.push(u.sort(((t,e)=>t-e)))})),l}(e,function(t,e){const i=[];let n=[];for(let s=1;s<=t;s++)e.indexOf(s)>-1?(i.push(n),n=[]):n.push(s);return n.length>0&&i.push(n),i}(this.stave.getNumLines(),this.positions.map((t=>t.str))),this.getStave(),this.getStemDirection());i.save(),i.setLineWidth(E.WIDTH),n.forEach((e=>{0!==e.length&&(i.beginPath(),i.moveTo(t,e[0]),i.lineTo(t,e[e.length-1]),i.stroke(),i.closePath())})),i.restore()}}drawPositions(){const t=this.context,e=this.getAbsoluteX(),i=this.ys;for(let n=0;nparseInt(n,10)?Nt.SLIDE_DOWN:Nt.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(0===t.first_ys.length||0===t.last_ys.length)throw new s.RERR("BadArguments","No Y-values to render");const e=this.context,i=t.first_x_px,n=t.first_ys,r=t.last_x_px,o=this.slide_direction;if(o!==Nt.SLIDE_UP&&o!==Nt.SLIDE_DOWN)throw new s.RERR("BadSlide","Invalid slide direction");for(let a=0;athis.numStrings)throw new s.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),n=parseInt(t,10);if(n<0)throw new s.RERR("BadArguments","Fret number must be 0 or higher: "+t);return i+n}getNoteForFret(t,e){const i=this.getValueForFret(t,e),n=Math.floor(i/12),s=i%12;return m.integerToNote(s)+"/"+n}}class Dt extends h{static get type(){return{CRESC:1,DECRESC:2}}static FormatByTicksAndDraw(t,e,i,n,r,o){const a=e.pixelsPerTick;if(null==a)throw new s.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 Dt({first_note:i.first_note,last_note:i.last_note},n).setContext(t).setRenderOptions(c).setPosition(r).draw()}constructor(t,e){super(),this.setAttribute("type","StaveHairpin"),this.notes=t,this.hairpin=e,this.position=B.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!==B.Position.ABOVE&&t!==B.Position.BELOW||(this.position=t),this}setRenderOptions(t){return null!=t.height&&null!=t.y_shift&&null!=t.left_shift_px&&null!=t.right_shift_px&&(this.render_options=t),this}setNotes(t){if(!t.first_note&&!t.last_note)throw new s.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,n=t.first_y;this.position===B.Position.ABOVE&&(i=30-i,n=t.first_y-t.staff_height);const s=this.render_options.left_shift_px,r=this.render_options.right_shift_px;switch(e.beginPath(),this.hairpin){case Dt.type.CRESC:e.moveTo(t.last_x+r,n+i),e.lineTo(t.first_x+s,n+this.render_options.height/2+i),e.lineTo(t.last_x+r,n+this.render_options.height+i);break;case Dt.type.DECRESC:e.moveTo(t.first_x+s,n+i),e.lineTo(t.last_x+r,n+this.render_options.height/2+i),e.lineTo(t.first_x+s,n+this.render_options.height+i)}e.stroke(),e.closePath()}draw(){this.checkContext(),this.setRendered();const t=this.first_note,e=this.last_note,i=t.getModifierStartXY(this.position,0),n=e.getModifierStartXY(this.position,0);return this.renderHairpin({first_x:i.x,last_x:n.x,first_y:t.getStave().y+t.getStave().height,last_y:e.getStave().y+e.getStave().height,staff_height:t.getStave().height}),!0}}class kt extends h{static get Position(){return{NEAR_HEAD:1,NEAR_TOP:2}}static get PositionString(){return{nearHead:kt.Position.NEAR_HEAD,nearTop:kt.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:kt.Position.NEAR_HEAD,position_end:kt.Position.NEAR_HEAD,invert:!1,cps:[{x:0,y:10},{x:0,y:10}]},s.Merge(this.render_options,i),this.setNotes(t,e)}setNotes(t,e){if(!t&&!e)throw new s.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,n=this.render_options.x_shift,s=this.render_options.y_shift*t.direction,r=t.first_x+n,o=t.first_y+s,a=t.last_x-n,l=t.last_y+s,h=this.render_options.thickness,c=(a-r)/(i.length+2);e.beginPath(),e.moveTo(r,o),e.bezierCurveTo(r+c+i[0].x,o+i[0].y*t.direction,a-c+i[1].x,l+i[1].y*t.direction,a,l),e.bezierCurveTo(a-c+i[1].x,l+(i[1].y+h)*t.direction,r+c+i[0].x,o+(i[0].y+h)*t.direction,r,o),e.stroke(),e.closePath(),e.fill()}draw(){this.checkContext(),this.setRendered();const t=this.from,e=this.to;let i,n,s,r,o,a="baseY",l="baseY";function h(t){return"string"==typeof t?kt.PositionString[t]:t}const c=h(this.render_options.position),u=h(this.render_options.position_end);return c===kt.Position.NEAR_TOP&&(a="topY",l="topY"),u===kt.Position.NEAR_HEAD?l="baseY":u===kt.Position.NEAR_TOP&&(l="topY"),t?(i=t.getTieRightX(),o=t.getStemDirection(),s=t.getStemExtents()[a]):(i=e.getStave().getTieStartX(),s=e.getStemExtents()[a]),e?(n=e.getTieLeftX(),o=e.getStemDirection(),r=e.getStemExtents()[l]):(n=t.getStave().getTieEndX(),r=t.getStemExtents()[l]),this.renderCurve({first_x:i,last_x:n,first_y:s,last_y:r,direction:o*(!0===this.render_options.invert?-1:1)}),!0}}function Vt(...t){Gt.DEBUG&&s.L("Vex.Flow.TextDynamics",t)}class Gt extends R{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=[],s.Merge(this.render_options,{glyph_font_size:40}),Vt("New Dynamics Text: ",this.sequence)}setLine(t){return this.line=t,this}preFormat(){let t=0;return this.sequence.split("").forEach((e=>{const i=Gt.GLYPHS[e];if(!i)throw new s.RERR("Invalid dynamics character: "+e);const n=this.render_options.glyph_font_size,r=new p(i.code,n);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);Vt("Rendering Dynamics: ",this.sequence);let i=t;this.glyphs.forEach(((t,n)=>{const s=this.sequence[n];t.render(this.context,i,e),i+=Gt.GLYPHS[s].width}))}}function Wt(t,e,i,n,s,r,o){t.beginPath(),t.moveTo(e,i),t.lineTo(n,s),t.lineTo(r,o),t.lineTo(e,i),t.closePath(),t.fill()}class Ut extends h{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:Ut.TextVerticalPosition.TOP,text_justification:Ut.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 s.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 s.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,n=this.render_options;let s,r;t.save(),this.applyLineStyle(),this.first_indices.forEach(((o,a)=>{const l=this.last_indices[a];s=e.getModifierStartXY(2,o),r=i.getModifierStartXY(1,l);const h=s.y>r.y;s.x+=e.getMetrics().modRightPx+n.padding_left,r.x-=i.getMetrics().modLeftPx+n.padding_right;const c=e.getGlyph().getWidth();e.getKeyProps()[o].displaced&&1===e.getStemDirection()&&(s.x+=c+n.padding_left),i.getKeyProps()[l].displaced&&-1===i.getStemDirection()&&(r.x-=c+n.padding_right),s.y+=h?-3:1,r.y+=h?2:0,function(t,e,i,n){const s=n.draw_start_arrow&&n.draw_end_arrow,r=e.x,o=e.y,a=i.x,l=i.y,h=Math.sqrt((a-r)*(a-r)+(l-o)*(l-o)),c=(h-n.arrowhead_length/3)/h;let u,d,f,p;n.draw_end_arrow||s?(u=Math.round(r+(a-r)*c),d=Math.round(o+(l-o)*c)):(u=a,d=l),n.draw_start_arrow||s?(f=r+(a-r)*(1-c),p=o+(l-o)*(1-c)):(f=r,p=o),n.color&&(t.setStrokeStyle(n.color),t.setFillStyle(n.color)),t.beginPath(),t.moveTo(f,p),t.lineTo(u,d),t.stroke(),t.closePath();const m=Math.atan2(l-o,a-r),b=Math.abs(n.arrowhead_length/Math.cos(n.arrowhead_angle));let g,y,S,v,x,E;(n.draw_end_arrow||s)&&(g=m+Math.PI+n.arrowhead_angle,S=a+Math.cos(g)*b,v=l+Math.sin(g)*b,y=m+Math.PI-n.arrowhead_angle,x=a+Math.cos(y)*b,E=l+Math.sin(y)*b,Wt(t,S,v,a,l,x,E)),(n.draw_start_arrow||s)&&(g=m+n.arrowhead_angle,S=r+Math.cos(g)*b,v=o+Math.sin(g)*b,y=m-n.arrowhead_angle,x=r+Math.cos(y)*b,E=o+Math.sin(y)*b,Wt(t,S,v,r,o,x,E))}(t,s,r,this.render_options)})),t.restore();const o=t.measureText(this.text).width,a=n.text_justification;let l,h=0;a===Ut.TextJustification.LEFT?h=s.x:a===Ut.TextJustification.CENTER?h=(r.x-s.x)/2+s.x-o/2:a===Ut.TextJustification.RIGHT&&(h=r.x-o);const c=n.text_position_vertical;return c===Ut.TextVerticalPosition.TOP?l=e.getStave().getYForTopText():c===Ut.TextVerticalPosition.BOTTOM&&(l=e.getStave().getYForBottomText(m.TEXT_HEIGHT_OFFSET_HACK)),t.save(),this.applyFontStyle(),t.fillText(this.text,h,l),t.restore(),this}}function zt(t,e,i,n,s){const r=jt.GLYPHS[t];new p(r.code,s).render(e,i+r.x_shift,n+r.y_shift)}class jt extends h{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}}static get StylesString(){return{text:jt.Styles.TEXT,bracket:jt.Styles.BRACKET,mixed:jt.Styles.MIXED}}static createSustain(t){return new jt(t)}static createSostenuto(t){const e=new jt(t);return e.setStyle(jt.Styles.MIXED),e.setCustomText("Sost. Ped."),e}static createUnaCorda(t){const e=new jt(t);return e.setStyle(jt.Styles.TEXT),e.setCustomText("una corda","tre corda"),e}constructor(t){super(),this.setAttribute("type","PedalMarking"),this.notes=t,this.style=jt.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"}}setCustomText(t,e){return this.custom_depress_text=t||"",this.custom_release_text=e||"",this}setStyle(t){if(t<1&&t>3)throw new s.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,i,n=!1;const r=this;this.notes.forEach(((o,a,l)=>{n=!n;const h=o.getAbsoluteX(),c=o.getStave().getYForBottomText(r.line+3);if(h{e=!e;const r=s.getStave(),o=s.getAbsoluteX(),a=r.getYForBottomText(i.line+3);let l=0;e?i.custom_depress_text?(l=t.measureText(i.custom_depress_text).width,t.fillText(i.custom_depress_text,o-l/2,a)):zt("pedal_depress",t,o,a,n):i.custom_release_text?(l=t.measureText(i.custom_release_text).width,t.fillText(i.custom_release_text,o-l/2,a)):zt("pedal_release",t,o,a,n)}))}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),function(...t){jt.DEBUG&&s.L("Vex.Flow.PedalMarking",t)}("Rendering Pedal Marking"),this.style===jt.Styles.BRACKET||this.style===jt.Styles.MIXED?(t.setLineWidth(this.render_options.bracket_line_width),this.drawBracketed()):this.style===jt.Styles.TEXT&&this.drawText(),t.restore()}}class Ht extends h{static get Positions(){return{TOP:1,BOTTOM:-1}}static get PositionString(){return{top:Ht.Positions.TOP,bottom:Ht.Positions.BOTTOM}}constructor({start:t,stop:e,text:i="",superscript:n="",position:s=Ht.Positions.TOP}){super(),this.setAttribute("type","TextBracket"),this.start=t,this.stop=e,this.text=i,this.superscript=n,this.position="string"==typeof s?Ht.PositionString[s]:s,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(e){return this.font=t(t({},this.font),e),this}setLine(t){return this.line=t,this}draw(){const t=this.context;this.setRendered();let e=0;switch(this.position){case Ht.Positions.TOP:e=this.start.getStave().getYForTopText(this.line);break;case Ht.Positions.BOTTOM:e=this.start.getStave().getYForBottomText(this.line+m.TEXT_HEIGHT_OFFSET_HACK);break;default:throw new s.RERR("InvalidPosition",`The position ${this.position} is invalid`)}const i={x:this.start.getAbsoluteX(),y:e},n={x:this.stop.getAbsoluteX(),y:e};!function(...t){Ht.DEBUG&&s.L("Vex.Flow.TextBracket",t)}("Rendering TextBracket: start:",i,"stop:",n,"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,d=l;const f=n.x+this.stop.getGlyph().getWidth();this.position===Ht.Positions.TOP?(u+=o+h+5,d-=c/2.7):this.position===Ht.Positions.BOTTOM&&(d+=c/2.7,u+=o+2,this.render_options.underline_superscript||(u+=h)),this.render_options.dashed?(x.drawDashedLine(t,u,d,f,d,this.render_options.dash),this.render_options.show_bracket&&x.drawDashedLine(t,f,d+1*this.position,f,d+r,this.render_options.dash)):(t.beginPath(),t.moveTo(u,d),t.lineTo(f,d),this.render_options.show_bracket&&t.lineTo(f,d+r),t.stroke(),t.closePath()),t.restore()}}class Xt extends R{constructor(t=pt.type.SINGLE){super({duration:"b"}),this.setAttribute("type","BarNote"),this.metrics={widths:{}};const e=pt.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="string"==typeof t?pt.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 s.RERR("NoStave","Can't draw without a stave.");!function(...t){Xt.DEBUG&&s.L("Vex.Flow.BarNote",t)}("Rendering bar line at: ",this.getAbsoluteX());const t=new pt(this.type);t.setX(this.getAbsoluteX()),t.draw(this.stave),this.setRendered()}}class Yt extends F{constructor(t){if(!t)throw new s.RuntimeError("BadArguments","Ghost note must have valid initialization data to identify duration.");let e;if("string"==typeof t)e={duration:t};else{if("object"!=typeof t)throw new s.RuntimeError("BadArguments","Ghost note must have valid initialization data to identify duration.");e=t}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 s.RERR("NoStave","Can't draw without a stave.");this.setRendered();for(let t=0;t0||!0===e;return!e||s>0||(this.pos=n),o?this.matchSuccess():this.matchFail(n),{success:o,results:i,numMatches:s}}expectZeroOrMore(t){return this.expectOneOrMore(t,!0)}expect(t){let e;if(function(...t){Zt.DEBUG&&s.L("Vex.Flow.Parser",t)}("Evaluating rules:",t),!t)throw new $t("Invalid Rule: "+t,t);const i=t.bind(this.grammar)();if(i.token)e=this.matchToken(i.token,!0===i.noSpace),e.success&&(this.pos+=e.incrementPos);else{if(!i.expect)throw new $t("Bad grammar! No `token` or `expect` property",i);e=i.oneOrMore?this.expectOneOrMore(i):i.zeroOrMore?this.expectZeroOrMore(i):this.expectOne(i)}return e.matches=[],e.results&&e.results.forEach((t=>e.matches.push(Jt(t)))),i.run&&e.success&&i.run(e),e}}function Qt(...t){re.DEBUG&&s.L("Vex.Flow.EasyScore",t)}const te=s.MakeException("EasyScoreError");class ee{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(){return{expect:[this.KEY,this.EQUALS,this.VAL],run:t=>this.builder.addNoteOption(t.matches[0],t.matches[2].slice(1,-1))}}VAL(){return{expect:[this.SVAL,this.DVAL],or:!0}}KEY(){return{token:"[a-zA-Z][a-zA-Z0-9]*"}}DVAL(){return{token:'["][^"]*["]'}}SVAL(){return{token:"['][^']*[']"}}NOTENAME(){return{token:"[a-gA-G]"}}OCTAVE(){return{token:"[0-9]+"}}ACCIDENTALS(){return{token:"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 ie{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(){Qt("resetPiece"),this.piece={chord:[],duration:this.rollingDuration,dots:0,type:void 0,options:{}}}setNoteDots(t){Qt("setNoteDots:",t),t&&(this.piece.dots=t.length)}setNoteDuration(t){Qt("setNoteDuration:",t),this.rollingDuration=this.piece.duration=t||this.rollingDuration}setNoteType(t){Qt("setNoteType:",t),t&&(this.piece.type=t)}addNoteOption(t,e){Qt("addNoteOption: key:",t,"value:",e),this.piece.options[t]=e}addNote(t,e,i){Qt("addNote:",t,e,i),this.piece.chord.push({key:t,accid:e,octave:i})}addSingleNote(t,e,i){Qt("addSingleNote:",t,e,i),this.addNote(t,e,i)}addChord(t){Qt("startChord"),"object"!=typeof t[0]?this.addSingleNote(t[0]):t.forEach((t=>{t&&this.addNote(...t)})),Qt("endChord")}commitPiece(){Qt("commitPiece");const{factory:e}=this;if(!e)return;const i=t(t({},this.options),this.piece.options),{stem:n,clef:s}=i,r="auto"===n.toLowerCase(),o=r||"up"!==n.toLowerCase()?k.STEM_DOWN:k.STEM_UP,{chord:a,duration:l,dots:h,type:c}=this.piece,u=a.map((t=>t.key+"/"+t.octave)),d=e.StaveNote({keys:u,duration:l,dots:h,type:c,clef:s,auto_stem:r});r||d.setStemDirection(o);const f=a.map((t=>t.accid||null));f.forEach(((t,i)=>{t&&d.addAccidental(i,e.Accidental({type:t}))}));for(let t=0;tt(i,d,this))),this.elements.notes.push(d),this.elements.accidentals.concat(f),this.resetPiece()}}function ne({id:t},e){void 0!==t&&e.setAttribute("id",t)}function se(t,e){t.class&&t.class.split(/\s*,\s*/).forEach((t=>e.addClass(t)))}class re{constructor(t={}){this.setOptions(t),this.defaults={clef:"treble",time:"4/4",stem:"auto"}}set(t){return Object.assign(this.defaults,t),this}setOptions(e){return this.options=t({factory:null,builder:null,commitHooks:[ne,se,it.easyScoreHook],throwOnError:!1},e),this.factory=this.options.factory,this.builder=this.options.builder||new ie(this.factory),this.grammar=new ee(this.builder),this.parser=new Zt(this.grammar),this.options.commitHooks.forEach((t=>this.addCommitHook(t))),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 te("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(e,i={}){return i=t({clef:this.defaults.clef,stem:this.defaults.stem},i),this.parse(e,i),this.builder.getElements().notes}voice(e,i){return i=t({time:this.defaults.time},i),this.factory.Voice(i).addTickables(e)}addCommitHook(t){return this.builder.addCommitHook(t)}}const oe=s.MakeException("FactoryError");function ae(t={},e){const i=e.options;return(t=Object.assign(e,t)).options=Object.assign(i,t.options),t}class le{constructor(t){!function(...t){le.DEBUG&&s.L("Vex.Flow.Factory",t)}("New factory: ",t);const e={stave:{space:10},renderer:{context:null,elementId:"",backend:x.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 le({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]);(null!==this.options.renderer.elementId||this.options.renderer.context)&&this.initRenderer(),this.reset()}initRenderer(){const{elementId:t,backend:e,width:i,height:n,background:s}=this.options.renderer;if(""===t)throw new oe("HTML DOM element not set in Factory");this.context=x.buildContext(t,e,i,n,s)}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=ae(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 wt(t.x,t.y,t.width,t.options);return this.staves.push(e),e.setContext(this.context),this.stave=e,e}TabStave(t){t=ae(t,{x:0,y:0,width:this.options.renderer.width-this.space(1),options:{spacing_between_lines_px:1.3*this.options.stave.space}});const e=new Tt(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 k(t);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}GhostNote(t){const e=new Yt(t);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}TextNote(t){const e=new yt(t);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}BarNote(t){t=ae(t,{type:"single",options:{}});const e=new Xt(t.type);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}ClefNote(t){t=ae(t,{type:"treble",options:{size:"default"}});const e=new Ct(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=ae(t,{time:"4/4",options:{}});const e=new Rt(t.time);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}KeySigNote(t){const e=new It(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 Mt(t);return this.stave&&e.setStave(this.stave),e.setContext(this.context),this.renderQ.push(e),e}GraceNote(t){const e=new Ft(t);return this.stave&&e.setStave(this.stave),e.setContext(this.context),e}GraceNoteGroup(t){const e=new Y(t.notes,t.slur);return e.setContext(this.context),e}Accidental(t){t=ae(t,{type:null,options:{}});const e=new z(t.type);return e.setContext(this.context),e}Annotation(t){t=ae(t,{text:"p",vJustify:"below",hJustify:"center",fontFamily:"Times",fontSize:14,fontWeight:"bold italic",options:{}});const e=new rt(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=ae(t,{type:"a.",position:"above",options:{}});const e=new it(t.type);return e.setPosition(t.position),e.setContext(this.context),e}TextDynamics(t){t=ae(t,{text:"p",duration:"q",dots:0,line:0,options:{}});const e=new Gt({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=ae(t,{number:"0",position:"left",options:{}});const e=new V(t.number);return e.setPosition(t.position),e.setContext(this.context),e}StringNumber(t){t=ae(t,{number:"0",position:"left",options:{}});const e=new q(t.number);return e.setPosition(t.position),e.setContext(this.context),e}TickContext(){return(new nt).setContext(this.context)}ModifierContext(){return new ht}MultiMeasureRest(t){const e=new At(t.number_of_measures,t);return e.setContext(this.context),this.renderQ.push(e),e}Voice(t){t=ae(t,{time:"4/4",options:{}});const e=new L(t.time);return this.voices.push(e),e}StaveConnector(t){t=ae(t,{top_stave:null,bottom_stave:null,type:"double",options:{}});const e=new C(t.top_stave,t.bottom_stave);return e.setType(t.type).setContext(this.context),this.renderQ.push(e),e}Formatter(){return new dt}Tuplet(t){t=ae(t,{notes:[],options:{}});const e=new _(t.notes,t.options).setContext(this.context);return this.renderQ.push(e),e}Beam(t){t=ae(t,{notes:[],options:{autoStem:!1,secondaryBeamBreaks:[]}});const e=new P(t.notes,t.options.autoStem).setContext(this.context);return e.breakSecondaryAt(t.options.secondaryBeamBreaks),this.renderQ.push(e),e}Curve(t){t=ae(t,{from:null,to:null,options:{}});const e=new kt(t.from,t.to,t.options).setContext(this.context);return this.renderQ.push(e),e}StaveTie(t){t=ae(t,{from:null,to:null,first_indices:[0],last_indices:[0],text:null,options:{direction:void 0}});const e=new H({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=ae(t,{from:null,to:null,first_indices:[0],last_indices:[0],options:{}});const e=new Ut({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=ae(t,{from:null,to:null,options:{harsh:!1}});const e=new Pt({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=ae(t,{from:null,to:null,text:"",options:{superscript:"",position:1}});const e=new Ht({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 ce(t).setContext(this.context);return this.systems.push(e),e}EasyScore(t={}){return t.factory=this,new re(t)}PedalMarking(t={}){t=ae(t,{notes:[],options:{style:"mixed"}});const e=new jt(t.notes);return e.setStyle(jt.StylesString[t.options.style]),e.setContext(this.context),this.renderQ.push(e),e}NoteSubGroup(t={}){t=ae(t,{notes:[],options:{}});const e=new j(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 he(t,e){const i=e.options;return(t=Object.assign(e,t)).options=Object.assign(i,t.options),t}class ce extends h{constructor(t={}){super(),this.setAttribute("type","System"),this.setOptions(t),this.parts=[]}setOptions(t={}){this.options=he(t,{x:10,y:10,width:500,connector:null,spaceBetweenStaves:12,factory:null,debugFormatter:!1,formatIterations:0,options:{}}),this.factory=this.options.factory||new le({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=he(t,{stave:null,voices:[],spaceAbove:0,spaceBelow:0,debugNoteMetrics:!1,options:{left_bar:!1}})).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((e=>e.setStave(t.stave))))),this.parts.push(t),t.stave}format(){const t=new dt;this.formatter=t;let e=this.options.y,i=0,n=[];const s=[];this.parts.forEach((r=>{e+=r.stave.space(r.spaceAbove),r.stave.setY(e),t.joinVoices(r.voices),e+=r.stave.space(r.spaceBelow),e+=r.stave.space(this.options.spaceBetweenStaves),r.debugNoteMetrics&&(s.push({y:e,voice:r.voices[0]}),e+=15),n=n.concat(r.voices),i=Math.max(i,r.stave.getNoteStartX())})),this.parts.forEach((t=>t.stave.setNoteStartX(i)));const r=this.options.width-(i-this.options.x)-R.STAVEPADDING;t.format(n,r);for(let o=0;o{e.voice.getTickables().forEach((i=>R.plotMetrics(t,i,e.y)))}))}}(s.Flow=m).Element=h,s.Flow.Fraction=r,s.Flow.Renderer=x,s.Flow.Formatter=dt,s.Flow.Music=G,s.Flow.Glyph=p,s.Flow.Stave=wt,s.Flow.StaveNote=k,s.Flow.StaveModifier=ft,s.Flow.StaveTempo=gt,s.Flow.Voice=L,s.Flow.Accidental=z,s.Flow.Beam=P,s.Flow.StaveTie=H,s.Flow.TabStave=Tt,s.Flow.TabNote=Mt,s.Flow.Bend=ot,s.Flow.Vibrato=at,s.Flow.VibratoBracket=Pt,s.Flow.Note=R,s.Flow.ModifierContext=ht,s.Flow.MultiMeasureRest=At,s.Flow.TickContext=nt,s.Flow.Articulation=it,s.Flow.Annotation=rt,s.Flow.Barline=pt,s.Flow.NoteHead=N,s.Flow.StaveConnector=C,s.Flow.ClefNote=Ct,s.Flow.KeySignature=xt,s.Flow.KeySigNote=It,s.Flow.TimeSignature=Et,s.Flow.TimeSigNote=Rt,s.Flow.Stem=E,s.Flow.TabTie=X,s.Flow.Clef=vt,s.Flow.Dot=O,s.Flow.Modifier=B,s.Flow.TabSlide=Nt,s.Flow.Tuplet=_,s.Flow.GraceNote=Ft,s.Flow.GraceTabNote=Bt,s.Flow.Tuning=Ot,s.Flow.KeyManager=class{constructor(t){this.music=new G,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),!G.scaleTypes[this.keyParts.type])throw new s.RERR("BadArguments",`Unsupported key type: ${this.key}`);this.scale=this.music.getScaleTones(this.music.getNoteValue(this.keyString),G.scaleTypes[this.keyParts.type]),this.scaleMap={},this.scaleMapByValue={},this.originalScaleMapByValue={};const t=G.root_indices[this.keyParts.root];for(let e=0;e=1?"w":i<1&&i>=.5?e&&i>.5?"w":"h":i<.5&&i>=.25?e&&i>.25?"h":"q":i<.25&&i>=.125?e&&i>.125?"q":"8":i<.125&&i>=.0625?e&&i>.0625?"8":"16":i<.0625&&i>=.03125?e&&i>.03125?"16":"32":i<.03125&&i>=.015625?e&&i>.015625?"32":"64":e?"64":"128"}static pitch(t,e,i,n){let s=3;e&&(s=0,i.ClefType===r.ClefEnum.F&&(s=2),i.ClefType===r.ClefEnum.C&&(s=2));const a=c.NoteEnum[t.FundamentalNote].toLowerCase(),l=o.Pitch.accidentalVexflow(t.Accidental),h=t.Octave-i.OctaveOffset+s;let u="";return n&&(u=this.NoteHeadCode(n)),[a+"n/"+h+u,l,i]}static restToNotePitch(t,e){let i=t.Octave;switch(e){case r.ClefEnum.C:case r.ClefEnum.F:i+=2;break;case r.ClefEnum.G:}return new o.Pitch(t.FundamentalNote,i,h.AccidentalEnum.NONE)}static NoteHeadCode(t){const e=t.Filled?"2":"1";switch(t.Shape){case S.NoteHeadShape.NORMAL:return"";case S.NoteHeadShape.DIAMOND:return"/D"+e;case S.NoteHeadShape.TRIANGLE:return"/T"+e;case S.NoteHeadShape.X:return"/X"+e;case S.NoteHeadShape.CIRCLEX:return"/X3";case S.NoteHeadShape.RECTANGLE:return"/R"+e;case S.NoteHeadShape.SQUARE:return"/S"+e;case S.NoteHeadShape.SLASH:default:return""}}static GhostNote(t){return new s.default.Flow.GhostNote({duration:_.duration(t,!1)})}static StaveNote(t){var e,i,n,r,o,a,l,h,c,u;t.sortForVexflow();const d=t.notes,f=t.parentStaffEntry.parentMeasure.parentSourceMeasure.Rules,p=d[0];let m=[];const g=[],y=p.graphicalNoteLength,x=void 0!==p.sourceNote.NoteTuplet;let E=_.duration(y,x);void 0!==p.sourceNote.TypeLength&&p.sourceNote.TypeLength!==y&&(E=_.duration(p.sourceNote.TypeLength,x));let w,T,M=p.numberOfDots,P=!1,L=0,A=!1,C=!1;for(const s of d){if(M=1&&e.length-1>=d+1&&(c=null===(o=null===(r=e[d-1])||void 0===r?void 0:r.graphicalVoiceEntries[0])||void 0===o?void 0:o.parentVoiceEntry,u=null===(l=null===(a=e[d+1])||void 0===a?void 0:a.graphicalVoiceEntries[0])||void 0===l?void 0:l.parentVoiceEntry,c&&u)){const t=c.Notes[0],e=u.Notes[0];if(null===(h=t.NoteBeam)||void 0===h?void 0:h.Notes.includes(e)){const t=c.Notes.last().Pitch,e=s.Clef();m=[_.pitch(_.restToNotePitch(t.getTransposedPitch(-2),e.ClefType),!1,e,void 0)[0]]}}}}if(y.RealValue===s.sourceNote.SourceMeasure.ActiveTimeSignature.RealValue&&(m=["d/5"],E="w",M=0,P=!0,L=f.WholeRestXShiftVexflow*v.unitInPixels),s.sourceNote.ParentStaff.Voices.length>1){let t=0;for(let e=0;e1)switch(null===(u=null===(c=s.sourceNote.ParentVoiceEntry)||void 0===c?void 0:c.ParentVoice)||void 0===u?void 0:u.VoiceId){case 1:m=["e/5"];break;case 2:m=["f/4"]}}break}s.sourceNote.Notehead&&s.sourceNote.Notehead.Shape===S.NoteHeadShape.SLASH&&(A=!0);const t=s.vfpitch;m.push(t[0]),g.push(t[1]),T||(T=_.Clef(t[2]).type)}for(let s=0,b=M;st.notes[i].staffLine=e)),(f.LedgerLineWidth||f.LedgerLineStrokeStyle)&&(w.ledgerLineStyle||(w.ledgerLineStyle={}),f.LedgerLineWidth&&(w.ledgerLineStyle.lineWidth=f.LedgerLineWidth),f.LedgerLineStrokeStyle&&(w.ledgerLineStyle.strokeStyle=f.LedgerLineStrokeStyle)),f.ColoringEnabled){const e=f.DefaultColorStem;let i=t.parentVoiceEntry.StemColor;!i&&e&&(i=e);const n={fillStyle:i,strokeStyle:i};i&&(t.parentVoiceEntry.StemColor=i,w.setStemStyle(n),w.flag&&f.ColorFlags&&w.setFlagStyle(n))}if(w.x_shift=L,t.parentVoiceEntry.IsGrace&&t.notes[0].sourceNote.NoteBeam&&(t.parentVoiceEntry.WantedStemDirection=t.notes[0].sourceNote.NoteBeam.Notes[0].ParentVoiceEntry.WantedStemDirection),t.parentVoiceEntry)switch(t.parentVoiceEntry.WantedStemDirection){case b.StemDirectionType.Up:w.setStemDirection(s.default.Flow.Stem.UP),t.parentVoiceEntry.StemDirection=b.StemDirectionType.Up;break;case b.StemDirectionType.Down:w.setStemDirection(s.default.Flow.Stem.DOWN),t.parentVoiceEntry.StemDirection=b.StemDirectionType.Down}for(let b=0,S=d.length;b0){const e=new s.default.Flow.Tremolo(t);e.extra_stroke_scale=f.TremoloStrokeScale,e.y_spacing_scale=f.TremoloYSpacingScale,w.addModifier(b,e)}}if(.25===R.Length.RealValue&&R.Notehead&&!1===R.Notehead.Filled){const t=w.getKeyProps();for(let e=0;e");break;case b.ArticulationEnum.downbow:e=new s.default.Flow.Articulation("am"),void 0===n.placement&&(r=s.default.Flow.Modifier.Position.ABOVE);break;case b.ArticulationEnum.fermata:e=new s.default.Flow.Articulation("a@a"),r=s.default.Flow.Modifier.Position.ABOVE;break;case b.ArticulationEnum.marcatodown:e=new s.default.Flow.Articulation("a|");break;case b.ArticulationEnum.marcatoup:e=new s.default.Flow.Articulation("a^");break;case b.ArticulationEnum.invertedfermata:e=new s.default.Flow.Articulation("a@u"),r=s.default.Flow.Modifier.Position.BELOW;break;case b.ArticulationEnum.lefthandpizzicato:e=new s.default.Flow.Articulation("a+");break;case b.ArticulationEnum.naturalharmonic:e=new s.default.Flow.Articulation("ah");break;case b.ArticulationEnum.snappizzicato:e=new s.default.Flow.Articulation("ao");break;case b.ArticulationEnum.staccatissimo:e=new s.default.Flow.Articulation("av");break;case b.ArticulationEnum.staccato:e=new s.default.Flow.Articulation("a.");break;case b.ArticulationEnum.tenuto:e=new s.default.Flow.Articulation("a-");break;case b.ArticulationEnum.upbow:e=new s.default.Flow.Articulation("a|"),void 0===n.placement&&(r=s.default.Flow.Modifier.Position.ABOVE);break;case b.ArticulationEnum.strongaccent:e=new s.default.Flow.Articulation("a^")}e&&(e.setPosition(r),t.addModifier(0,e))}}static generateOrnaments(t,e){let i,n=s.default.Flow.Modifier.Position.ABOVE;switch(e.placement===E.PlacementEnum.Below&&(n=s.default.Flow.Modifier.Position.BELOW),e.GetOrnament){case y.OrnamentEnum.DelayedInvertedTurn:i=new s.default.Flow.Ornament("turn_inverted"),i.setDelayed(!0);break;case y.OrnamentEnum.DelayedTurn:i=new s.default.Flow.Ornament("turn"),i.setDelayed(!0);break;case y.OrnamentEnum.InvertedMordent:i=new s.default.Flow.Ornament("mordent"),i.setDelayed(!1);break;case y.OrnamentEnum.InvertedTurn:i=new s.default.Flow.Ornament("turn_inverted"),i.setDelayed(!1);break;case y.OrnamentEnum.Mordent:i=new s.default.Flow.Ornament("mordent_inverted"),i.setDelayed(!1);break;case y.OrnamentEnum.Trill:i=new s.default.Flow.Ornament("tr"),i.setDelayed(!1);break;case y.OrnamentEnum.Turn:i=new s.default.Flow.Ornament("turn"),i.setDelayed(!1);break;default:return void m.default.warn("unhandled OrnamentEnum type: "+e.GetOrnament)}i&&(e.AccidentalBelow!==h.AccidentalEnum.NONE&&i.setLowerAccidental(o.Pitch.accidentalVexflow(e.AccidentalBelow)),e.AccidentalAbove!==h.AccidentalEnum.NONE&&i.setUpperAccidental(o.Pitch.accidentalVexflow(e.AccidentalAbove)),i.setPosition(n),t.addModifier(0,i))}static StrokeTypeFromArpeggioType(t){switch(t){case x.ArpeggioType.ARPEGGIO_DIRECTIONLESS:return s.default.Flow.Stroke.Type.ARPEGGIO_DIRECTIONLESS;case x.ArpeggioType.BRUSH_DOWN:return s.default.Flow.Stroke.Type.BRUSH_UP;case x.ArpeggioType.BRUSH_UP:return s.default.Flow.Stroke.Type.BRUSH_DOWN;case x.ArpeggioType.RASQUEDO_DOWN:return s.default.Flow.Stroke.Type.RASQUEDO_UP;case x.ArpeggioType.RASQUEDO_UP:return s.default.Flow.Stroke.Type.RASQUEDO_DOWN;case x.ArpeggioType.ROLL_DOWN:return s.default.Flow.Stroke.Type.ROLL_UP;case x.ArpeggioType.ROLL_UP:return s.default.Flow.Stroke.Type.ROLL_DOWN;default:return s.default.Flow.Stroke.Type.ARPEGGIO_DIRECTIONLESS}}static CreateTabNote(t){const e=[],i=t.notes.reverse(),n=[],r=t.notes[0].graphicalNoteLength,o=void 0!==t.notes[0].sourceNote.NoteTuplet;let a=_.duration(r,o),l=0,h=!1;for(const u of t.notes){const t=u.sourceNote,i={str:t.StringNumberTab,fret:t.FretNumber};e.push(i),t.BendArray&&t.BendArray.forEach((function(t){let e;const r=t.bendalter-i.fret;e=r>1?"Full":1===r?"1/2":"1/4","up"===t.direction?n.push({type:s.default.Flow.Bend.UP,text:e,width:10}):n.push({type:s.default.Flow.Bend.DOWN,text:e,width:10})})),t.VibratoStroke&&(h=!0),l0)return!0;return!1}isStaccato(){for(const t of this.Articulations)if(t.articulationEnum===c.staccato)return!0;return!1}isAccent(){for(const t of this.Articulations)if(t.articulationEnum===c.accent||t.articulationEnum===c.strongaccent)return!0;return!1}getVerseNumberForLyricEntry(t){let e=1;return this.lyricsEntries.forEach(((i,n)=>{t===n&&(e=i)})),e}createVoiceEntriesForOrnament(t,e){t||(t=this);const i=[];if(!t.ornamentContainer)return;const s=this.notes[0],r=s.Length,l=t.ParentVoice,h=t.Timestamp;let c=n.Fraction.createFromFraction(h);switch(t.ornamentContainer.GetOrnament){case o.OrnamentEnum.Trill:{const o=new n.Fraction(r.Numerator,8*r.Denominator),u=s.Pitch.getTransposedPitch(1);let d=e.getAlterationForPitch(u);t.OrnamentContainer.AccidentalAbove!==a.AccidentalEnum.NONE&&(d=t.ornamentContainer.AccidentalAbove);for(let t=0;t<8;t++)c=n.Fraction.plus(h,new n.Fraction(t*o.Numerator,o.Denominator)),t%2==0?this.createBaseVoiceEntry(c,o,l,s,i):this.createAlteratedVoiceEntry(c,o,l,s.SourceMeasure,u,d,i);break}case o.OrnamentEnum.Turn:{const t=new n.Fraction(r.Numerator,4*r.Denominator),o=s.Pitch.getTransposedPitch(-1),a=e.getAlterationForPitch(o),h=s.Pitch.getTransposedPitch(1),u=e.getAlterationForPitch(h);this.createAlteratedVoiceEntry(c,t,l,s.SourceMeasure,h,u,i),c.Add(t),this.createBaseVoiceEntry(c,t,l,s,i),c.Add(t),this.createAlteratedVoiceEntry(c,t,l,s.SourceMeasure,o,a,i),c.Add(t),this.createBaseVoiceEntry(c,t,l,s,i);break}case o.OrnamentEnum.InvertedTurn:{const t=new n.Fraction(r.Numerator,4*r.Denominator),o=s.Pitch.getTransposedPitch(-1),a=e.getAlterationForPitch(o),h=s.Pitch.getTransposedPitch(1),u=e.getAlterationForPitch(h);this.createAlteratedVoiceEntry(c,t,l,s.SourceMeasure,o,a,i),c.Add(t),this.createBaseVoiceEntry(c,t,l,s,i),c.Add(t),this.createAlteratedVoiceEntry(c,t,l,s.SourceMeasure,h,u,i),c.Add(t),this.createBaseVoiceEntry(c,t,l,s,i);break}case o.OrnamentEnum.DelayedTurn:{const t=new n.Fraction(r.Numerator,2*r.Denominator),o=s.Pitch.getTransposedPitch(-1),a=e.getAlterationForPitch(o),u=s.Pitch.getTransposedPitch(1),d=e.getAlterationForPitch(u);this.createBaseVoiceEntry(c,t,l,s,i),c=n.Fraction.plus(h,t),t.Denominator=8*r.Denominator,this.createAlteratedVoiceEntry(c,t,l,s.SourceMeasure,u,d,i),c.Add(t),this.createBaseVoiceEntry(c,t,l,s,i),c.Add(t),this.createAlteratedVoiceEntry(c,t,l,s.SourceMeasure,o,a,i),c.Add(t),this.createBaseVoiceEntry(c,t,l,s,i);break}case o.OrnamentEnum.DelayedInvertedTurn:{const t=new n.Fraction(r.Numerator,2*r.Denominator),o=s.Pitch.getTransposedPitch(-1),a=e.getAlterationForPitch(o),u=s.Pitch.getTransposedPitch(1),d=e.getAlterationForPitch(u);this.createBaseVoiceEntry(c,t,l,s,i),c=n.Fraction.plus(h,t),t.Denominator=8*r.Denominator,this.createAlteratedVoiceEntry(c,t,l,s.SourceMeasure,o,a,i),c.Add(t),this.createBaseVoiceEntry(c,t,l,s,i),c.Add(t),this.createAlteratedVoiceEntry(c,t,l,s.SourceMeasure,u,d,i),c.Add(t),this.createBaseVoiceEntry(c,t,l,s,i);break}case o.OrnamentEnum.Mordent:{const t=new n.Fraction(r.Numerator,4*r.Denominator),o=s.Pitch.getTransposedPitch(1),a=e.getAlterationForPitch(o);this.createBaseVoiceEntry(c,t,l,s,i),c.Add(t),this.createAlteratedVoiceEntry(c,t,l,s.SourceMeasure,o,a,i),t.Denominator=2*r.Denominator,c=n.Fraction.plus(h,t),this.createBaseVoiceEntry(c,t,l,s,i);break}case o.OrnamentEnum.InvertedMordent:{const t=new n.Fraction(r.Numerator,4*r.Denominator),o=s.Pitch.getTransposedPitch(-1),a=e.getAlterationForPitch(o);this.createBaseVoiceEntry(c,t,l,s,i),c.Add(t),this.createAlteratedVoiceEntry(c,t,l,s.SourceMeasure,o,a,i),t.Denominator=2*r.Denominator,c=n.Fraction.plus(h,t),this.createBaseVoiceEntry(c,t,l,s,i);break}default:throw new RangeError}return i}createBaseVoiceEntry(t,e,i,n,o){const a=new h(t,i,n.ParentStaffEntry),l=new r.Pitch(n.Pitch.FundamentalNote,n.Pitch.Octave,n.Pitch.Accidental),c=new s.Note(a,void 0,e,l,n.SourceMeasure);a.Notes.push(c),o.push(a)}createAlteratedVoiceEntry(t,e,i,n,o,a,l){const c=new h(t,i,void 0),u=new r.Pitch(o.FundamentalNote,o.Octave,a),d=new s.Note(c,void 0,e,u,n);c.Notes.push(d),l.push(c)}}var c,u,d;e.VoiceEntry=h,(d=c=e.ArticulationEnum||(e.ArticulationEnum={}))[d.accent=0]="accent",d[d.strongaccent=1]="strongaccent",d[d.marcatoup=2]="marcatoup",d[d.marcatodown=3]="marcatodown",d[d.invertedstrongaccent=4]="invertedstrongaccent",d[d.staccato=5]="staccato",d[d.staccatissimo=6]="staccatissimo",d[d.spiccato=7]="spiccato",d[d.tenuto=8]="tenuto",d[d.fermata=9]="fermata",d[d.invertedfermata=10]="invertedfermata",d[d.breathmark=11]="breathmark",d[d.caesura=12]="caesura",d[d.lefthandpizzicato=13]="lefthandpizzicato",d[d.naturalharmonic=14]="naturalharmonic",d[d.snappizzicato=15]="snappizzicato",d[d.upbow=16]="upbow",d[d.downbow=17]="downbow",d[d.scoop=18]="scoop",d[d.plop=19]="plop",d[d.doit=20]="doit",d[d.falloff=21]="falloff",d[d.stress=22]="stress",d[d.unstress=23]="unstress",d[d.detachedlegato=24]="detachedlegato",d[d.otherarticulation=25]="otherarticulation",d[d.bend=26]="bend",function(t){t[t.Undefined=-1]="Undefined",t[t.Up=0]="Up",t[t.Down=1]="Down",t[t.None=2]="None",t[t.Double=3]="Double"}(u=e.StemDirectionType||(e.StemDirectionType={}))},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var n=i(35);e.arrays=n;var s=i(157);e.Bag=s.default;var r=i(158);e.BSTree=r.default;var o=i(83);e.BSTreeKV=o.default;var a=i(29);e.Dictionary=a.default;var l=i(85);e.Heap=l.default;var h=i(159);e.LinkedDictionary=h.default;var c=i(53);e.LinkedList=c.default;var u=i(160);e.MultiDictionary=u.default;var d=i(86);e.FactoryDictionary=d.default;var f=i(86);e.DefaultDictionary=f.default;var p=i(84);e.Queue=p.default;var m=i(161);e.PriorityQueue=m.default;var b=i(82);e.Set=b.default;var g=i(162);e.Stack=g.default;var y=i(163);e.MultiRootTree=y.default;var S=i(10);e.util=S},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowMusicSheetDrawer=e.unitInPixels=void 0;const s=n(i(8)),r=i(119),o=i(46),a=i(4),l=i(63),h=i(22),c=i(3),u=i(70),d=i(79),f=n(i(1)),p=i(52),m=i(33),b=i(88);e.unitInPixels=10;class g extends r.MusicSheetDrawer{constructor(t=new m.DrawingParameters){super(new l.VexFlowTextMeasurer(t.Rules),t),this.backends=[],this.zoom=1,this.pageIdx=0}get Backends(){return this.backends}drawSheet(t){var i,n,r;"gonville"===this.rules.DefaultVexFlowNoteFont&&(s.default.Flow.DEFAULT_FONT_STACK=[null===(i=s.default.Flow.Fonts)||void 0===i?void 0:i.Gonville,null===(n=s.default.Flow.Fonts)||void 0===n?void 0:n.Bravura,null===(r=s.default.Flow.Fonts)||void 0===r?void 0:r.Custom]),s.default.Flow.STAVE_LINE_THICKNESS=this.rules.StaffLineWidth*e.unitInPixels,s.default.Flow.STEM_WIDTH=this.rules.StemWidth*e.unitInPixels,s.default.Flow.DEFAULT_NOTATION_FONT_SCALE=this.rules.VexFlowDefaultNotationFontScale,s.default.Flow.DEFAULT_TAB_FONT_SCALE=this.rules.VexFlowDefaultTabFontScale,this.pageIdx=0;for(const e of t.MusicPages){if(e.PageNumber>this.rules.MaxPageToDrawNumber)break;const t=this.backends[this.pageIdx];t.graphicalMusicPage=e,t.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*e.unitInPixels}drawStaffLine(t){super.drawStaffLine(t);const e=t.PositionAndShape.AbsolutePosition;this.rules.RenderSlurs&&this.drawSlurs(t,e)}drawSlurs(t,e){for(const i of t.GraphicalSlurs)i.slur.isCrossed()||this.drawSlur(i,e)}drawSlur(t,e){const i=[],n=new a.PointF2D(t.bezierStartPt.x+e.x,t.bezierStartPt.y+e.y),s=new a.PointF2D(t.bezierStartControlPt.x+e.x,t.bezierStartControlPt.y+e.y),r=new a.PointF2D(t.bezierEndControlPt.x+e.x,t.bezierEndControlPt.y+e.y),o=new a.PointF2D(t.bezierEndPt.x+e.x,t.bezierEndPt.y+e.y);i.push(this.applyScreenTransformation(n)),i.push(this.applyScreenTransformation(s)),i.push(this.applyScreenTransformation(r)),i.push(this.applyScreenTransformation(o)),t.placement===c.PlacementEnum.Above?(n.y-=.05,s.y-=.3,r.y-=.3,o.y-=.05):(n.y+=.05,s.y+=.3,r.y+=.3,o.y+=.05),i.push(this.applyScreenTransformation(n)),i.push(this.applyScreenTransformation(s)),i.push(this.applyScreenTransformation(r)),i.push(this.applyScreenTransformation(o)),this.backend.renderCurve(i)}drawMeasure(t){t.setAbsoluteCoordinates(t.PositionAndShape.AbsolutePosition.x*e.unitInPixels,t.PositionAndShape.AbsolutePosition.y*e.unitInPixels);try{t.draw(this.backend.getContext())}catch(i){f.default.warn("VexFlowMusicSheetDrawer.drawMeasure",i)}for(const e of t.staffEntries)this.drawStaffEntry(e)}drawLine(t,i,n="#FF0000FF",s=.2){return t=this.applyScreenTransformation(t),i=this.applyScreenTransformation(i),this.backend.renderLine(t,i,n,s*e.unitInPixels)}DrawOverlayLine(t,i,n,s="#FF0000FF",r=.2){if(!n.PageNumber||n.PageNumber>this.backends.length||n.PageNumber<1)return void ("VexFlowMusicSheetDrawer.drawOverlayLine: invalid page number / music page number doesn't correspond to an existing backend.");const o=n.PageNumber-1,a=this.backends[o];return t=this.applyScreenTransformation(t),i=this.applyScreenTransformation(i),a.renderLine(t,i,s,r*e.unitInPixels)}drawSkyLine(t){const e=t.PositionAndShape.AbsolutePosition,i=t.PositionAndShape.Size.width;this.drawSampledLine(t.SkyLine,e,i)}drawBottomLine(t){const e=new a.PointF2D(t.PositionAndShape.AbsolutePosition.x,t.PositionAndShape.AbsolutePosition.y),i=t.PositionAndShape.Size.width;this.drawSampledLine(t.BottomLine,e,i,"#0000FFFF")}drawSampledLine(t,e,i,n="#FF0000FF"){const s=[];let r=0;for(let a=0;a0){const e=this.rules.SamplingUnit;let r,l,h=new a.PointF2D(o.x,o.y),c=new a.PointF2D(s[0]/e+o.x,o.y);this.drawLine(h,c,n),t[0]>=0&&(r=new a.PointF2D(s[0]/e+o.x,o.y),l=new a.PointF2D(s[0]/e+o.x,o.y+t[s[0]]),this.drawLine(r,l,n));for(let i=1;i0)for(const e of t.graphicalChordContainers)this.drawLabel(e.GraphicalLabel,h.GraphicalLayers.Notes);this.rules.RenderLyrics&&t.LyricsEntries.length>0&&this.drawLyrics(t.LyricsEntries,h.GraphicalLayers.Notes)}drawLyrics(t,e){t.forEach((t=>this.drawLabel(t.GraphicalLabel,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 t=e,i=this.backend.getContext(),n=t.getTextBracket();n.setContext(i),n.draw()}}drawExpressions(t){for(const e of t.AbstractExpressions)e instanceof d.GraphicalInstantaneousDynamicExpression?this.drawInstantaneousDynamic(e):e instanceof u.GraphicalInstantaneousTempoExpression?this.drawLabel(e.GraphicalLabel,h.GraphicalLayers.Notes):e instanceof p.GraphicalContinuousDynamicExpression?this.drawContinuousDynamic(e):e instanceof b.GraphicalUnknownExpression?this.drawLabel(e.Label,h.GraphicalLayers.Notes):f.default.warn("Unkown type of expression!")}drawInstantaneousDynamic(t){this.drawLabel(t.Label,h.GraphicalLayers.Notes)}drawContinuousDynamic(t){if(t.IsVerbal)this.drawLabel(t.Label,h.GraphicalLayers.Notes);else for(const e of t.Lines){const i=new a.PointF2D(t.ParentStaffLine.PositionAndShape.AbsolutePosition.x+e.Start.x,t.ParentStaffLine.PositionAndShape.AbsolutePosition.y+e.Start.y),n=new a.PointF2D(t.ParentStaffLine.PositionAndShape.AbsolutePosition.x+e.End.x,t.ParentStaffLine.PositionAndShape.AbsolutePosition.y+e.End.y);this.drawLine(i,n,"black",e.Width)}}renderLabel(t,i,n,s,r,o){var l;if(!t.Label.print)return[];const h=[],c=t.Label.fontHeight*e.unitInPixels,{font:u}=t.Label;let d;this.rules.ColoringEnabled&&(d=t.Label.colorDefault,d||(d=this.rules.DefaultColorLabel));let{fontStyle:f,fontFamily:p}=t.Label;f||(f=this.rules.DefaultFontStyle),p||(p=this.rules.DefaultFontFamily);for(let e=0;e<(null===(l=t.TextLines)||void 0===l?void 0:l.length);e++){const i=t.TextLines[e],n=this.calculatePixelDistance(i.xOffset),s=new a.PointF2D(o.x+n,o.y);h.push(this.backend.renderText(c,f,u,i.text,r,s,d,t.Label.fontFamily)),o.y=o.y+r,t.TextLines.length>1&&(o.y+=this.rules.SpacingBetweenTextLines)}return h}renderRectangle(t,e,i,n,s){return this.backend.renderRectangle(t,i,n,s)}applyScreenTransformation(t){return new a.PointF2D(t.x*e.unitInPixels,t.y*e.unitInPixels)}applyScreenTransformationForRect(t){return new o.RectangleF2D(t.x*e.unitInPixels,t.y*e.unitInPixels,t.width*e.unitInPixels,t.height*e.unitInPixels)}}e.VexFlowMusicSheetDrawer=g},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MusicSheetCalculator=void 0;const s=i(68),r=i(0),o=i(36),a=i(7),l=i(30),h=i(14),c=i(113),u=i(4),d=i(31),f=i(24),p=i(9),m=i(18),b=i(41),g=i(5),y=i(115),S=i(116),v=i(7),x=n(i(1)),E=i(15),_=i(27),w=i(12),T=i(54),M=i(3),P=i(70),L=i(37),A=i(56),C=i(32),I=i(52),R=i(25),N=i(88);class F{constructor(){this.staffEntriesWithGraphicalTies=[],this.staffEntriesWithOrnaments=[],this.staffEntriesWithChordSymbols=[],this.staffLinesWithLyricWords=[],this.graphicalLyricWords=[],this.abstractNotImplementedErrorMessage="abstract, not implemented"}static get TextMeasurer(){return F.textMeasurer}static set TextMeasurer(t){F.textMeasurer=t}get leadSheet(){return this.graphicalMusicSheet.LeadSheet}static setMeasuresMinStaffEntriesWidth(t,e){for(let i=0,n=t.length;i0&&this.rules.RenderMultipleRestMeasures){r.isReducedToMultiRest=!0,r.multipleRestMeasureNumber=1;const i=r.multipleRestMeasures-1;a+=i;for(let n=1;n<=i;n++){const i=t.SourceMeasures[r.MeasureNumber-1+n];i.multipleRestMeasureNumber=n+1,i.isReducedToMultiRest=!0,e.push([void 0])}}}if(this.rules.AutoGenerateMutipleRestMeasuresFromRestMeasures&&this.rules.RenderMultipleRestMeasures){let r,a=0;for(let l=0,h=t.SourceMeasures.length;l0){r.isReducedToMultiRest=!0,r.multipleRestMeasureNumber=1,a++,h.multipleRestMeasureNumber=a,h.isReducedToMultiRest=!0;for(let t=0;t1){r.multipleRestMeasures=a;const t=this.createGraphicalMeasuresForSourceMeasure(r,i,s,o,n);e[r.measureListIndex]=t,a=0,r=void 0}else a=0,r=void 0}if(a>1){r.multipleRestMeasures=a,r.isReducedToMultiRest=!0;const t=this.createGraphicalMeasuresForSourceMeasure(r,i,s,o,n);e[r.measureListIndex]=t,a=0,r=void 0}}const l=n.map((t=>t.ClefType===a.ClefEnum.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(),s.GraphicalMusicSheet.transformRelativeToAbsolutePosition(this.graphicalMusicSheet)}calculateXLayout(t,e){if(this.graphicalMusicSheet.MeasureList.length>0){let t=this.graphicalMusicSheet.MeasureList[0],e=this.calculateMeasureXLayout(t);e=this.calculateMeasureWidthFromStaffEntries(t,e),F.setMeasuresMinStaffEntriesWidth(t,e);for(let i=1;i0)return;const r=e.Measures[s];0!==r.MeasureNumber&&1!==r.MeasureNumber||(i=r.MeasureNumber),n=r!==e.Measures[0]&&this.rules.MeasureNumberLabelXOffset?this.rules.MeasureNumberLabelXOffset:0;const o=this.rules.UseXMLMeasureNumbers&&1===r.MeasureNumber&&1!==r.parentSourceMeasure.getPrintedMeasureNumber();((r.MeasureNumber===i||r.MeasureNumber>=i+this.rules.MeasureNumberLabelOffset)&&!r.parentSourceMeasure.ImplicitMeasure||o)&&((1!==r.MeasureNumber||1===r.MeasureNumber&&r!==e.Measures[0]||o)&&this.calculateSingleMeasureNumberPlacement(r,e,t,n),i=r.MeasureNumber)}}calculateSingleMeasureNumberPlacement(t,e,i,n=0){const s=t.parentSourceMeasure.getPrintedMeasureNumber().toString(),r=new w.Label(s),o=new f.GraphicalLabel(r,this.rules.MeasureNumberLabelHeight,p.TextAlignmentEnum.LeftBottom,this.rules),a=e.SkyBottomLineCalculator;o.setLabelPositionAndShapeBorders(),o.PositionAndShape.Parent=i.PositionAndShape;const l=e.PositionAndShape.RelativePosition.x+t.PositionAndShape.RelativePosition.x-o.PositionAndShape.BorderMarginLeft+n;let h,c=l,d=l-o.PositionAndShape.BorderLeft+o.PositionAndShape.BorderRight;c-=e.PositionAndShape.RelativePosition.x,d-=e.PositionAndShape.RelativePosition.x;const m=c+.5,b=d-.5,g=a.getSkyLineMinInRange(m,b);if(t===e.Measures[0]){let t=0;if(i.GroupBrackets.length>0)for(const e of i.GroupBrackets)t=Math.min(t,e.PositionAndShape.BorderTop);h=Math.min(g,t)}else h=g;h=Math.min(0,h),o.PositionAndShape.RelativePosition=new u.PointF2D(l,h),a.updateSkyLineInRange(c,d,h+o.PositionAndShape.BorderMarginTop),i.MeasureNumberLabels.push(o)}layoutGraphicalTie(t,e,i){throw new Error(this.abstractNotImplementedErrorMessage)}calculateSingleStaffLineLyricsPosition(t,e){let i=0,n=this.rules.StaffHeight;const s=[],r=t.SkyBottomLineCalculator;let o=t.Measures.length;for(let l=0;l0){s.push(a),i=Math.max(i,a.LyricsEntries.length);const t=a.PositionAndShape.RelativePosition.x+o.x;let e=Number.MAX_VALUE,l=Number.MIN_VALUE;for(let i=0;i0){const e=t.PositionAndShape.Size.width;let i=s[0].PositionAndShape.RelativePosition.x+s[0].PositionAndShape.BorderMarginLeft+s[0].parentMeasure.PositionAndShape.RelativePosition.x;i=i>e?e:i,r.updateBottomLineInRange(i,e,a)}return s}calculateLyricsExtendsAndDashes(t){for(let e=0,i=t.length;e0||t.UnknownList.length>0){let e="";for(let i=0,n=t.EntriesList.length;it.length-1&&(x.default.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 s=this.rules.MinMeasureToDrawIndex,r=t.length;sd){const e=u.StaffLines[t].PositionAndShape.RelativePosition.y-s.PositionAndShape.RelativePosition.y-this.rules.StaffHeight;v=this.rules.StaffHeight+e/2}else v=this.rules.WedgePlacementBelowY;v-=this.rules.WedgeOpeningLength/2,a||(E=v);let e=f.getBottomLineMaxInRange(b,y);if(e>v&&(v=e),dE&&(E=e),E+=this.rules.WedgeOpeningLength/2,E+=this.rules.WedgeVerticalMargin),v+=this.rules.WedgeOpeningLength/2,v+=this.rules.WedgeVerticalMargin}else if(p===M.PlacementEnum.Above){if(1===s.ParentStaff.ParentInstrument.Staves.length)v=this.rules.WedgePlacementAboveY;else{let t=0;d>0&&(t=d-1);const e=u.StaffLines[t];v=-(s.PositionAndShape.RelativePosition.y-e.PositionAndShape.RelativePosition.y-this.rules.StaffHeight)/2}v+=this.rules.WedgeOpeningLength/2,a||(E=v);let t=f.getSkyLineMinInRange(b,y);if(t1&&d>0){const t=s.findClosestStaffEntry(b),e=s.findClosestStaffEntry(y);t&&e&&t.parentVerticalContainer}a||(t=o.SkyBottomLineCalculator.getSkyLineMinInRange(g,S),t-n/2?-n/2:a-t.PositionAndShape.BorderMarginBottom}else o=a-t.PositionAndShape.BorderMarginBottom;t.PositionAndShape.RelativePosition=new u.PointF2D(e.x,o)}else if(t.Placement===M.PlacementEnum.Below){const a=r.getBottomLineMaxInRange(n,s),l=i.ParentStaff.ParentInstrument.Staves[i.ParentStaff.ParentInstrument.Staves.length-1];if(i.isPartOfMultiStaffInstrument()&&i.ParentStaff!==l){const e=i.ParentMusicSystem.StaffLines[i.ParentMusicSystem.StaffLines.indexOf(i)+1].PositionAndShape.RelativePosition.y-i.PositionAndShape.RelativePosition.y-this.rules.StaffHeight;o=a+t.PositionAndShape.BorderMarginBottomt.PositionAndShape.Size.width&&(d=t.PositionAndShape.Size.width-this.rules.MeasureRightMargin,c=d-l.PositionAndShape.MarginSize.width,e.x=c-l.PositionAndShape.BorderMarginLeft);const m=t.SkyBottomLineCalculator;return h=s===M.PlacementEnum.Below?m.getBottomLineMaxInRange(c,d):m.getSkyLineMinInRange(c,d),l.PositionAndShape.RelativePosition=new u.PointF2D(e.x,h),s===M.PlacementEnum.Below?m.updateBottomLineInRange(c,d,l.PositionAndShape.BorderMarginBottom+h):m.updateSkyLineInRange(c,d,l.PositionAndShape.BorderMarginTop+h),l}calculateTempoExpressionsForMultiTempoExpression(t,e,i){const n=r.Fraction.plus(t.AbsoluteTimestamp,e.Timestamp),s=this.graphicalMusicSheet.MeasureList[i];let o=new u.PointF2D;if(e.ContinuousTempo||e.InstantaneousTempo){if(this.rules.MinMeasureToDrawIndex>0)return;if(!s[0])return;let t=s[0].ParentStaffLine,i=s[0].PositionAndShape.RelativePosition.x,r=0;for(let e=0;e0){t=s[e].ParentStaffLine,i=s[e].PositionAndShape.RelativePosition.x,r=e;break}if(o=this.getRelativePositionInStaffLineFromTimestamp(n,r,t,t.isPartOfMultiStaffInstrument(),i),e.EntriesList.length>0&&e.EntriesList[0].Expression instanceof L.InstantaneousTempoExpression&&(e.EntriesList[0].Expression.Placement=M.PlacementEnum.Above,t.Measures[0].staffEntries.length>0&&0===Math.abs(o.x-t.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x)&&t.ParentMusicSystem===this.musicSystems[0])){const e=t.Measures[0].FirstInstructionStaffEntry;if(e){const t=e.GraphicalInstructions.last();o.x=t.PositionAndShape.RelativePosition.x}this.rules.CompactMode&&(o.x=t.PositionAndShape.RelativePosition.x+t.Measures[0].PositionAndShape.RelativePosition.x)}for(const n of e.EntriesList){let i=p.TextAlignmentEnum.CenterBottom;this.rules.CompactMode&&(i=p.TextAlignmentEnum.LeftBottom);const s=this.calculateLabel(t,o,n.label,e.getFontstyleOfFirstEntry(),n.Expression.Placement,this.rules.UnknownTextHeight,i);if(n.Expression instanceof L.InstantaneousTempoExpression){for(const e of t.AbstractExpressions)e instanceof P.GraphicalInstantaneousTempoExpression&&(e.SourceExpression.Label,n.Expression.Label);if(new P.GraphicalInstantaneousTempoExpression(n.Expression,s).ParentStaffLine||x.default.warn("Adding staffline didn't work"),this.rules.MetronomeMarksDrawn&&n.Expression.Enum===L.TempoEnum.metronomeMark){this.createMetronomeMark(n.Expression);continue}}else n.Expression,A.ContinuousTempoExpression}}}createMetronomeMark(t){throw new Error(this.abstractNotImplementedErrorMessage)}graphicalMeasureCreatedCalculations(t){}clearSystemsAndMeasures(){for(let t=0,e=this.graphicalMusicSheet.MusicPages.length;t-1&&i.PositionAndShape.ChildElements.splice(t,1),i.FirstInstructionStaffEntry=void 0,i.beginInstructionsWidth=0}if(i.LastInstructionStaffEntry){const t=i.PositionAndShape.ChildElements.indexOf(i.LastInstructionStaffEntry.PositionAndShape);t>-1&&i.PositionAndShape.ChildElements.splice(t,1),i.LastInstructionStaffEntry=void 0,i.endInstructionsWidth=0}}e.Measures=[],e.PositionAndShape.ChildElements=[]}i.StaffLines.length=0,i.PositionAndShape.ChildElements=[]}e.MusicSystems=[],e.PositionAndShape.ChildElements=[]}this.graphicalMusicSheet.MusicPages=[]}handleVoiceEntry(t,e,i,n,s,r,o,a,l,c,u){t.StemDirectionXml!==h.StemDirectionType.Undefined&&this.rules.SetWantedStemDirectionByXml&&void 0!==t.StemDirectionXml?t.WantedStemDirection=t.StemDirectionXml:this.calculateStemDirectionFromVoices(t);const d=e.findOrCreateGraphicalVoiceEntry(t);d.octaveShiftValue=a;const f=e.tabStaffEntry;let p;f&&(p=f.findOrCreateGraphicalVoiceEntry(t));for(let h=0,m=t.Notes.length;h-1)continue;let l;if(t.IsGrace?l=F.symbolFactory.createGraceNote(n,d,s,this.rules,a):(l=F.symbolFactory.createNote(n,d,s,a,this.rules,void 0),F.stafflineNoteCalculator.trackNote(l)),n.Pitch&&this.checkNoteForAccidental(l,i,s,a),this.resetYPositionForLeadSheet(l.PositionAndShape),e.addGraphicalNoteToListAtCorrectYPosition(d,l),l.PositionAndShape.calculateBoundingBox(),this.leadSheet||(void 0!==n.NoteBeam&&n.PrintObject&&this.handleBeam(l,n.NoteBeam,o),void 0!==n.NoteTuplet&&n.PrintObject&&this.handleTuplet(l,n.NoteTuplet,r)),p){const t=F.symbolFactory.createNote(n,p,s,a,this.rules,void 0);f.addGraphicalNoteToListAtCorrectYPosition(p,t),t.PositionAndShape.calculateBoundingBox(),this.leadSheet||n.NoteTuplet&&this.handleTuplet(t,n.NoteTuplet,r)}}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,n),t.OrnamentContainer&&this.handleVoiceEntryOrnaments(t.OrnamentContainer,t,e),a}resetYPositionForLeadSheet(t){this.leadSheet&&(t.RelativePosition=new u.PointF2D(t.RelativePosition.x,0))}layoutVoiceEntries(t,e){if(t.PositionAndShape.RelativePosition=new u.PointF2D(0,0),!this.leadSheet)for(const i of t.graphicalVoiceEntries){const e=i.notes;if(0===e.length)continue;const n=e[0].sourceNote.ParentVoiceEntry,s=void 0!==e[0].sourceNote.Pitch;this.layoutVoiceEntry(n,e,t,s)}}maxInstrNameLabelLength(){var t;let e=0;for(const i of this.graphicalMusicSheet.ParentMusicSheet.Instruments)if((null===(t=i.NameLabel)||void 0===t?void 0:t.print)&&i.Voices.length>0&&i.Voices[0].Visible){let t=i.NameLabel;this.rules.RenderPartNames||(t=new w.Label("",t.textAlignment,t.font));const n=new f.GraphicalLabel(t,this.rules.InstrumentLabelTextHeight,p.TextAlignmentEnum.LeftCenter,this.rules);n.setLabelPositionAndShapeBorders(),e=Math.max(e,n.PositionAndShape.MarginSize.width)}return this.rules.RenderPartNames?e:0}calculateSheetLabelBoundingBoxes(){const t=this.graphicalMusicSheet.ParentMusicSheet,e=this.rules.DefaultColorTitle;if(void 0!==t.Title&&this.rules.RenderTitle){const i=new f.GraphicalLabel(t.Title,this.rules.SheetTitleHeight,p.TextAlignmentEnum.CenterBottom,this.rules);i.Label.IsCreditLabel=!0,i.Label.colorDefault=e,this.graphicalMusicSheet.Title=i,i.setLabelPositionAndShapeBorders()}else this.rules.RenderTitle||(this.graphicalMusicSheet.Title=void 0);if(void 0!==t.Subtitle&&this.rules.RenderSubtitle){const i=new f.GraphicalLabel(t.Subtitle,this.rules.SheetSubtitleHeight,p.TextAlignmentEnum.CenterCenter,this.rules);i.Label.IsCreditLabel=!0,i.Label.colorDefault=e,this.graphicalMusicSheet.Subtitle=i,i.setLabelPositionAndShapeBorders()}else this.rules.RenderSubtitle||(this.graphicalMusicSheet.Subtitle=void 0);if(void 0!==t.Composer&&this.rules.RenderComposer){const i=new f.GraphicalLabel(t.Composer,this.rules.SheetComposerHeight,p.TextAlignmentEnum.RightCenter,this.rules);i.Label.IsCreditLabel=!0,i.Label.colorDefault=e,this.graphicalMusicSheet.Composer=i,i.setLabelPositionAndShapeBorders()}else this.rules.RenderComposer||(this.graphicalMusicSheet.Composer=void 0);if(void 0!==t.Lyricist&&this.rules.RenderLyricist){const i=new f.GraphicalLabel(t.Lyricist,this.rules.SheetAuthorHeight,p.TextAlignmentEnum.LeftCenter,this.rules);i.Label.IsCreditLabel=!0,i.Label.colorDefault=e,this.graphicalMusicSheet.Lyricist=i,i.setLabelPositionAndShapeBorders()}else this.rules.RenderLyricist||(this.graphicalMusicSheet.Lyricist=void 0)}checkMeasuresForWholeRestNotes(){for(let t=0,e=this.musicSystems.length;t0&&1===t.graphicalVoiceEntries[0].notes.length){const i=t.graphicalVoiceEntries[0].notes[0];!i.sourceNote.Pitch&&new r.Fraction(1,2).lt(i.sourceNote.Length)&&this.layoutMeasureWithWholeRest(i,t,e)}}}}}}optimizeRestNotePlacement(t,e){if(0===t.graphicalVoiceEntries.length)return;const i=t.graphicalVoiceEntries[0].notes;if(0===i.length)return;const n=i[0],s=n.sourceNote.isRest();if(2===t.graphicalVoiceEntries.length){let e=!1;const i=t.graphicalVoiceEntries[1].notes;i.length>0&&(e=i[0].sourceNote.isRest()),s&&e?this.calculateTwoRestNotesPlacementWithCollisionDetection(t):(s||e)&&this.calculateRestNotePlacementWithCollisionDetectionFromGraphicalNote(t)}else if(s&&t!==e.staffEntries[0]&&t!==e.staffEntries[e.staffEntries.length-1]){const i=e.staffEntries.indexOf(t),s=e.staffEntries[i-1],r=e.staffEntries[i+1];if(1===s.graphicalVoiceEntries.length){const e=s.graphicalVoiceEntries[0].notes[0];if(void 0!==e.sourceNote.NoteBeam&&1===r.graphicalVoiceEntries.length){const i=r.graphicalVoiceEntries[0].notes[0];void 0!==i.sourceNote.NoteBeam&&e.sourceNote.NoteBeam===i.sourceNote.NoteBeam&&(this.calculateRestNotePlacementWithinGraphicalBeam(t,n,e,r,i),t.PositionAndShape.calculateBoundingBox())}}}}getRelativePositionInStaffLineFromTimestamp(t,e,i,n,s=0){let o,a,l=new u.PointF2D;const h=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,c=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(t),d=Math.min(Math.floor(c),h-1),f=Math.min(Math.ceil(c),h-1);if(d<0||e<0)return l;if(o=this.getFirstLeftNotNullStaffEntryFromContainer(d,e,n),a=this.getFirstRightNotNullStaffEntryFromContainer(f,e,n),o&&a){let e=o.parentMeasure.PositionAndShape.RelativePosition.x;s>0&&(e=s);let n=o.PositionAndShape.RelativePosition.x+e,h=a.PositionAndShape.RelativePosition.x+a.parentMeasure.PositionAndShape.RelativePosition.x;s>0&&(h=a.PositionAndShape.RelativePosition.x+e);let c=0;if(o!==a){const e=o.getAbsoluteTimestamp(),i=a.getAbsoluteTimestamp();c=r.Fraction.minus(t,e).RealValue/r.Fraction.minus(i,e).RealValue}o.parentMeasure.ParentStaffLine!==a.parentMeasure.ParentStaffLine&&(o.parentMeasure.ParentStaffLine===i?h=i.PositionAndShape.Size.width:n=i.PositionAndShape.RelativePosition.x),l=new u.PointF2D(n+(h-n)*c,0)}return l}getRelativeXPositionFromTimestamp(t){const e=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers.length,i=this.graphicalMusicSheet.GetInterpolatedIndexInVerticalContainers(t),n=Math.max(0,Math.min(Math.round(i),e-1)),s=this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[n].getFirstNonNullStaffEntry();return s.PositionAndShape.RelativePosition.x+s.parentMeasure.PositionAndShape.RelativePosition.x}calculatePageLabels(t){var e;this.rules.RenderSingleHorizontalStaffline&&(t.PositionAndShape.BorderRight=t.PositionAndShape.Size.width,t.PositionAndShape.calculateBoundingBox(),this.graphicalMusicSheet.ParentMusicSheet.pageWidth=t.PositionAndShape.Size.width);let i=10;if(t.MusicSystems.length>0){const e=t.MusicSystems[0];i=e.PositionAndShape.RelativePosition.y+e.PositionAndShape.BorderTop}if(this.graphicalMusicSheet.Title){const e=this.graphicalMusicSheet.Title;e.PositionAndShape.Parent=t.PositionAndShape;const i=new u.PointF2D;i.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth/2,i.y=this.rules.TitleTopDistance+this.rules.SheetTitleHeight,e.PositionAndShape.RelativePosition=i,t.Labels.push(e)}if(this.graphicalMusicSheet.Subtitle){const e=this.graphicalMusicSheet.Subtitle;e.PositionAndShape.Parent=t.PositionAndShape;const i=new u.PointF2D;i.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth/2,i.y=this.rules.TitleTopDistance+this.rules.SheetTitleHeight+this.rules.SheetMinimumDistanceBetweenTitleAndSubtitle,e.PositionAndShape.RelativePosition=i,t.Labels.push(e)}const n=this.graphicalMusicSheet.Composer;let s;if(n){n.PositionAndShape.Parent=t.PositionAndShape,n.setLabelPositionAndShapeBorders();const r=new u.PointF2D;r.x=this.graphicalMusicSheet.ParentMusicSheet.pageWidth-this.rules.PageRightMargin,r.y=i,r.y-=this.rules.SystemComposerDistance;const o=null===(e=n.TextLines)||void 0===e?void 0:e.length;o>1&&(r.y-=n.PositionAndShape.BorderBottom*(o-1)/o),s=r.y,n.PositionAndShape.RelativePosition=r,t.Labels.push(n)}const r=this.graphicalMusicSheet.Lyricist;if(r){r.PositionAndShape.Parent=t.PositionAndShape,r.setLabelPositionAndShapeBorders();const e=new u.PointF2D;e.x=this.rules.PageLeftMargin,e.y=i,e.y+=r.PositionAndShape.BorderBottom,e.y=Math.min(e.y,s),r.PositionAndShape.RelativePosition=e,t.Labels.push(r)}}createGraphicalTies(){for(let t=0;t=0&&this.staffEntriesWithGraphicalTies.push(a)}a=r}}createAccidentalCalculators(){const t=[],e=this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();if(e)for(let i=0;i1)return;x=F.symbolFactory.createGraphicalMeasure(t,S)}if(x.hasError=t.getErrorInMeasure(f),t.FirstInstructionsStaffEntries[f])for(let r=0,o=t.FirstInstructionsStaffEntries[f].Instructions.length;r0){const e=o.Instructions[0];F.symbolFactory.createInStaffClef(t,e)}this.rules.RenderChordSymbols&&(null===(g=o.ChordContainers)||void 0===g?void 0:g.length)>0&&(o.ParentStaff.ParentInstrument.HasChordSymbols=!0,F.symbolFactory.createChordSymbols(o,t,n.ActiveKeyInstruction,this.graphicalMusicSheet.ParentMusicSheet.Transpose))}}if(n.doCalculationsAtEndOfMeasure(),t.LastInstructionsStaffEntries[f]){const e=t.LastInstructionsStaffEntries[f];for(let t=0,i=e.Instructions.length;t=1&&0===x.staffEntries.length){const e=new d.SourceStaffEntry(new T.VerticalSourceStaffEntryContainer(x.parentSourceMeasure,x.parentSourceMeasure.AbsoluteTimestamp,x.parentSourceMeasure.CompleteNumberOfStaves),S),i=new h.VoiceEntry(new r.Fraction(0,1),S.Voices[0],e),n=new o.Note(i,e,r.Fraction.createFromFraction(t.Duration),void 0,t);n.PrintObject=this.rules.FillEmptyMeasuresWithWholeRest===R.FillEmptyMeasuresWithWholeRests.YesVisible,i.Notes.push(n);const s=F.symbolFactory.createStaffEntry(e,x);x.addGraphicalStaffEntry(s),s.relInMeasureTimestamp=i.Timestamp;const c=F.symbolFactory.createVoiceEntry(i,s);s.graphicalVoiceEntries.push(c);const u=F.symbolFactory.createNote(n,c,new a.ClefInstruction,l.OctaveEnum.NONE,void 0);F.stafflineNoteCalculator.trackNote(u),c.notes.push(u)}x.hasOnlyRests=!0;for(const r of x.staffEntries)if(x.hasOnlyRests=r.hasOnlyRests(),!x.hasOnlyRests)break;return x}checkNoteForAccidental(t,e,i,n){let s=t.sourceNote.Pitch;const r=this.graphicalMusicSheet.ParentMusicSheet.Transpose;0!==r&&t.sourceNote.ParentStaffEntry.ParentStaff.ParentInstrument.MidiInstrumentId!==v.MidiInstrument.Percussion&&(s=t.Transpose(e.ActiveKeyInstruction,i,r,n)),t.sourceNote.halfTone=s.getHalfTone(),e.checkAccidental(t,s)}handleStaffEntries(t){for(let e=0,i=this.graphicalMusicSheet.MeasureList.length;e0&&t.graphicalVoiceEntries[0].notes.length>0&&(this.layoutVoiceEntries(t,e),this.layoutStaffEntry(t));this.graphicalMeasureCreatedCalculations(n)}}}}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;t0&&this.layoutArticulationMarks(e.Articulations,e,i)}}}}}}calculateOrnaments(){for(let t=0,e=this.musicSystems.length;t0&&t.LyricVersesNumbers.sort()}for(let e=0,i=this.musicSystems.length;e=0&&(n=e.GraphicalLyricsEntries[i+1]),!n)return;const s=t.StaffEntryParent.parentMeasure.ParentStaffLine,r=n.StaffEntryParent.parentMeasure.ParentStaffLine,o=t.StaffEntryParent,a=n.StaffEntryParent;if(t.StaffEntryParent.parentMeasure.ParentStaffLine===n.StaffEntryParent.parentMeasure.ParentStaffLine){const e=o.parentMeasure.PositionAndShape.RelativePosition.x+o.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.BorderMarginRight,i=a.parentMeasure.PositionAndShape.RelativePosition.x+a.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.RelativePosition.x+n.GraphicalLabel.PositionAndShape.BorderMarginLeft,r=t.GraphicalLabel.PositionAndShape.RelativePosition.y;let l=1;i-e>3*this.rules.MinimumDistanceBetweenDashes&&(l=Math.floor((i-e)/this.rules.MinimumDistanceBetweenDashes)-1),1===l?this.calculateSingleDashForLyricWord(s,e,i,r):this.calculateDashes(s,e,i,r)}else{const e=o.parentMeasure.PositionAndShape.RelativePosition.x+o.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.BorderMarginRight,i=s.Measures[s.Measures.length-1],l=i.PositionAndShape.RelativePosition.x+i.PositionAndShape.Size.width;let h=t.GraphicalLabel.PositionAndShape.RelativePosition.y;if(this.calculateDashes(s,e,l,h),r&&r.Measures[0]&&a.parentMeasure.ParentStaffLine&&(a!==a.parentMeasure.staffEntries[0]||a.parentMeasure!==a.parentMeasure.ParentStaffLine.Measures[0])){const t=r.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,e=a.parentMeasure.PositionAndShape.RelativePosition.x+a.PositionAndShape.RelativePosition.x+n.GraphicalLabel.PositionAndShape.BorderMarginLeft;h=n.GraphicalLabel.PositionAndShape.RelativePosition.y,this.calculateDashes(r,t,e,h)}}}calculateDashes(t,e,i,n){let s=i-e;if(s<3*this.rules.MinimumDistanceBetweenDashes)this.calculateSingleDashForLyricWord(t,e,i,n);else{const r=Math.floor(s/this.rules.MinimumDistanceBetweenDashes)-1,o=s/(r+1);let a=0;for(e+=o,i-=o;a<=Math.floor(r/2)&&i>e;)s=this.calculateRightAndLeftDashesForLyricWord(t,e,i,n),e+=o,i-=o,a++;s>2*o&&this.calculateSingleDashForLyricWord(t,e,i,n)}}calculateSingleDashForLyricWord(t,e,i,n){const s=new w.Label("-"),r=new f.GraphicalLabel(s,this.rules.LyricsHeight,p.TextAlignmentEnum.CenterBottom,this.rules);r.setLabelPositionAndShapeBorders(),t.LyricsDashes.push(r),-1===this.staffLinesWithLyricWords.indexOf(t)&&this.staffLinesWithLyricWords.push(t),r.PositionAndShape.Parent=t.PositionAndShape;const o=new u.PointF2D(e+(i-e)/2,n);r.PositionAndShape.RelativePosition=o}calculateLyricExtend(t){let e=t.GraphicalLabel.PositionAndShape.RelativePosition.y;const i=t.StaffEntryParent,n=i.parentMeasure.ParentStaffLine;let s,r;const o=i.parentMeasure.ParentStaff.idInMusicSheet;for(let a=i.parentVerticalContainer.Index+1;a0)break;s=t,r=s.parentMeasure.ParentStaffLine,r||(r=i.parentMeasure.ParentStaffLine)}}if(s&&r)if(n===r&&s.parentMeasure.ParentStaffLine){const r=i.parentMeasure.PositionAndShape.RelativePosition.x+i.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.BorderMarginRight,o=s.parentMeasure.PositionAndShape.RelativePosition.x+s.PositionAndShape.RelativePosition.x+s.PositionAndShape.BorderMarginRight;e-=t.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(n,r,o,e)}else{const o=n.Measures[n.Measures.length-1].PositionAndShape,a=i.parentMeasure.PositionAndShape.RelativePosition.x+i.PositionAndShape.RelativePosition.x+t.GraphicalLabel.PositionAndShape.BorderMarginRight,l=o.RelativePosition.x+o.Size.width;if(e-=t.GraphicalLabel.PositionAndShape.Size.height/4,this.calculateSingleLyricWordWithUnderscore(n,a,l,e),!s)return;if(s.parentMeasure.ParentStaffLine&&s.parentMeasure.staffEntries&&(s!==s.parentMeasure.staffEntries[0]||s.parentMeasure!==s.parentMeasure.ParentStaffLine.Measures[0])){const t=r.Measures[0].staffEntries[0].PositionAndShape.RelativePosition.x,i=s.parentMeasure.PositionAndShape.RelativePosition.x+s.PositionAndShape.RelativePosition.x+s.PositionAndShape.BorderMarginRight;this.calculateSingleLyricWordWithUnderscore(r,t,i,e)}}}calculateSingleLyricWordWithUnderscore(t,e,i,n){const s=new u.PointF2D(e,n),r=new u.PointF2D(i,n),o=new _.GraphicalLine(s,r,this.rules.LyricUnderscoreLineWidth);t.LyricLines.push(o),-1===this.staffLinesWithLyricWords.indexOf(t)&&this.staffLinesWithLyricWords.push(t)}calculateRightAndLeftDashesForLyricWord(t,e,i,n){const s=new w.Label("-"),r=new f.GraphicalLabel(s,this.rules.LyricsHeight,p.TextAlignmentEnum.CenterBottom,this.rules);r.setLabelPositionAndShapeBorders(),t.LyricsDashes.push(r),-1===this.staffLinesWithLyricWords.indexOf(t)&&this.staffLinesWithLyricWords.push(t),r.PositionAndShape.Parent=t.PositionAndShape;const o=new u.PointF2D(e,n);r.PositionAndShape.RelativePosition=o;const a=new w.Label("-"),l=new f.GraphicalLabel(a,this.rules.LyricsHeight,p.TextAlignmentEnum.CenterBottom,this.rules);l.setLabelPositionAndShapeBorders(),t.LyricsDashes.push(l),l.PositionAndShape.Parent=t.PositionAndShape;const h=new u.PointF2D(i,n);return l.PositionAndShape.RelativePosition=h,l.PositionAndShape.RelativePosition.x-r.PositionAndShape.RelativePosition.x}calculateDynamicExpressions(){const t=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,this.rules.MaxMeasureToDrawIndex);for(let e=Math.min(this.rules.MinMeasureToDrawIndex,this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length);e<=t;e++){const t=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[e];for(let i=0;i=0;n--)if(this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[n].StaffEntries[e])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[n].StaffEntries[e]}getFirstRightNotNullStaffEntryFromContainer(t,e,i){if(this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[t].StaffEntries[e])return this.graphicalMusicSheet.VerticalGraphicalStaffEntryContainers[t].StaffEntries[e];for(let n=t+1;n0||e.StaffLinkedExpressions[i][n].UnknownList.length>0)&&this.calculateMoodAndUnknownExpression(e.StaffLinkedExpressions[i][n],t,i)}}calculateStemDirectionFromVoices(t){if(void 0!==t.ParentSourceStaffEntry.Link)return t===t.ParentSourceStaffEntry.VoiceEntries[0]?void(t.WantedStemDirection=h.StemDirectionType.Up):void(t.WantedStemDirection=h.StemDirectionType.Down);t.ParentVoice instanceof b.LinkedVoice?t.WantedStemDirection=h.StemDirectionType.Down:t.ParentSourceStaffEntry.VoiceEntries.length>1&&(t.WantedStemDirection=h.StemDirectionType.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!==h.StemDirectionType.Undefined&&i.ParentVoiceEntry.ParentSourceStaffEntry.ParentStaff.Id===t.ParentSourceStaffEntry.ParentStaff.Id){t.WantedStemDirection=i.ParentVoiceEntry.WantedStemDirection;break}}}e.MusicSheetCalculator=F},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.KeyEnum=e.NoteEnumToHalfToneLink=e.KeyInstruction=void 0;const n=i(49),s=i(2),r=i(2);class o extends n.AbstractNotationInstruction{constructor(t,e=0,i=a.major){super(t),this.isTransposedBy=0,this.Key=e,this.keyTypeOriginal=e,this.mode=i,this.alteratedNotes=this.calcAlteratedNotes()}static copy(t){const e=new o(t.parent,t.Key,t.Mode);return e.keyTypeOriginal=t.keyTypeOriginal,e}static getAllPossibleMajorKeyInstructions(){const t=[];for(let e=-7;e<7;e++){const i=new o(void 0,e,a.major);t.push(i)}return t}get Key(){return this.keyType}set Key(t){this.keyType=t,this.alteratedNotes=this.calcAlteratedNotes()}get Mode(){return this.mode}set Mode(t){this.mode=t}get AlteratedNotes(){return this.alteratedNotes}calcAlteratedNotes(){const t=[];if(this.keyType>0)for(let e=0;e=0}getAlterationForPitch(t){return this.keyType>0&&this.alteratedNotes.indexOf(t.FundamentalNote)<=this.keyType?r.AccidentalEnum.SHARP:this.keyType<0&&this.alteratedNotes.indexOf(t.FundamentalNote)<=Math.abs(this.keyType)?r.AccidentalEnum.FLAT:r.AccidentalEnum.NONE}ToString(){return"Key: "+this.keyType+this.mode}OperatorEquals(t){return this===t||!(!this||!t)&&this.Key===t.Key&&this.Mode===t.Mode}OperatorNotEqual(t){return!this.OperatorEquals(t)}}var a,l;e.KeyInstruction=o,o.sharpPositionList=[s.NoteEnum.F,s.NoteEnum.C,s.NoteEnum.G,s.NoteEnum.D,s.NoteEnum.A,s.NoteEnum.E,s.NoteEnum.B],o.flatPositionList=[s.NoteEnum.B,s.NoteEnum.E,s.NoteEnum.A,s.NoteEnum.D,s.NoteEnum.G,s.NoteEnum.C,s.NoteEnum.F],e.NoteEnumToHalfToneLink=class{constructor(t,e){this.note=t,this.halfTone=e}},(l=a=e.KeyEnum||(e.KeyEnum={}))[l.major=0]="major",l[l.minor=1]="minor",l[l.none=2]="none",l[l.dorian=3]="dorian",l[l.phrygian=4]="phrygian",l[l.lydian=5]="lydian",l[l.mixolydian=6]="mixolydian",l[l.aeolian=7]="aeolian",l[l.ionian=8]="ionian",l[l.locrian=9]="locrian"},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.RhythmSymbolEnum=e.RhythmInstruction=void 0;const n=i(49);class s extends n.AbstractNotationInstruction{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 s(this.rhythm.clone(),this.symbolEnum)}OperatorEquals(t){return this===t||!(!this||!t)&&this.numerator===t.numerator&&this.denominator===t.denominator}OperatorNotEqual(t){return!(this===t)}ToString(){return"Rhythm: "+this.rhythm.toString()}}var r;e.RhythmInstruction=s,(r=e.RhythmSymbolEnum||(e.RhythmSymbolEnum={}))[r.NONE=0]="NONE",r[r.COMMON=1]="COMMON",r[r.CUT=2]="CUT"},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.ITextTranslation=void 0,e.ITextTranslation=class{static translateText(t,e){if(!this.defaultTextTranslation)return e}}},function(t,e,i){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.FontStyles=void 0,(n=e.FontStyles||(e.FontStyles={}))[n.Regular=0]="Regular",n[n.Bold=1]="Bold",n[n.Italic=2]="Italic",n[n.BoldItalic=3]="BoldItalic",n[n.Underlined=4]="Underlined"},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.AutoColorSet=e.NoteState=e.GraphicalLayers=e.StyleSets=e.OUTLINE_AND_FILL_STYLE_DICT=e.OutlineAndFillStyleEnum=void 0;const n=i(15);var s,r;(r=s=e.OutlineAndFillStyleEnum||(e.OutlineAndFillStyleEnum={}))[r.BaseWritingColor=0]="BaseWritingColor",r[r.FollowingCursor=1]="FollowingCursor",r[r.AlternativeFollowingCursor=2]="AlternativeFollowingCursor",r[r.PlaybackCursor=3]="PlaybackCursor",r[r.Highlighted=4]="Highlighted",r[r.ErrorUnderlay=5]="ErrorUnderlay",r[r.Selected=6]="Selected",r[r.SelectionSymbol=7]="SelectionSymbol",r[r.DebugColor1=8]="DebugColor1",r[r.DebugColor2=9]="DebugColor2",r[r.DebugColor3=10]="DebugColor3",r[r.SplitScreenDivision=11]="SplitScreenDivision",r[r.GreyTransparentOverlay=12]="GreyTransparentOverlay",r[r.MarkedArea1=13]="MarkedArea1",r[r.MarkedArea2=14]="MarkedArea2",r[r.MarkedArea3=15]="MarkedArea3",r[r.MarkedArea4=16]="MarkedArea4",r[r.MarkedArea5=17]="MarkedArea5",r[r.MarkedArea6=18]="MarkedArea6",r[r.MarkedArea7=19]="MarkedArea7",r[r.MarkedArea8=20]="MarkedArea8",r[r.MarkedArea9=21]="MarkedArea9",r[r.MarkedArea10=22]="MarkedArea10",r[r.Comment1=23]="Comment1",r[r.Comment2=24]="Comment2",r[r.Comment3=25]="Comment3",r[r.Comment4=26]="Comment4",r[r.Comment5=27]="Comment5",r[r.Comment6=28]="Comment6",r[r.Comment7=29]="Comment7",r[r.Comment8=30]="Comment8",r[r.Comment9=31]="Comment9",r[r.Comment10=32]="Comment10",e.OUTLINE_AND_FILL_STYLE_DICT=new n.Dictionary,e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.BaseWritingColor,"Thistle"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.FollowingCursor,"Aqua"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.AlternativeFollowingCursor,"Azure"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.PlaybackCursor,"Bisque"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Highlighted,"CadetBlue"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.ErrorUnderlay,"DarkBlue"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Selected,"DarkGoldenRod"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.SelectionSymbol,"BlanchedAlmond"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.DebugColor1,"Chartreuse"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.DebugColor2,"DarkGreen"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.DebugColor3,"DarkOrange"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.SplitScreenDivision,"FireBrick"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.GreyTransparentOverlay,"DarkSalmon"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.MarkedArea1,"DarkSeaGreen"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.MarkedArea2,"DarkOrchid"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.MarkedArea3,"Aquamarine"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.MarkedArea4,"DarkKhaki"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.MarkedArea5,"ForestGreen"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.MarkedArea6,"AliceBlue"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.MarkedArea7,"DeepPink"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.MarkedArea8,"Coral"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.MarkedArea9,"DarkOliveGreen"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.MarkedArea10,"Chocolate"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Comment1,"DodgerBlue"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Comment2,"Blue"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Comment3,"Beige"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Comment4,"Crimson"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Comment5,"Fuchsia"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Comment6,"Brown"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Comment7,"BlanchedAlmond"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Comment8,"CornflowerBlue"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Comment9,"Cornsilk"),e.OUTLINE_AND_FILL_STYLE_DICT.setValue(s.Comment10,"DarkGrey"),function(t){t[t.MarkedArea=0]="MarkedArea",t[t.Comment=1]="Comment"}(e.StyleSets||(e.StyleSets={})),function(t){t[t.Background=0]="Background",t[t.Highlight=1]="Highlight",t[t.MeasureError=2]="MeasureError",t[t.SelectionSymbol=3]="SelectionSymbol",t[t.Cursor=4]="Cursor",t[t.PSI_Debug=5]="PSI_Debug",t[t.Notes=6]="Notes",t[t.Comment=7]="Comment",t[t.Debug_above=8]="Debug_above"}(e.GraphicalLayers||(e.GraphicalLayers={})),function(t){t[t.Normal=0]="Normal",t[t.Selected=1]="Selected",t[t.Follow_Confirmed=2]="Follow_Confirmed",t[t.QFeedback_NotFound=3]="QFeedback_NotFound",t[t.QFeedback_OK=4]="QFeedback_OK",t[t.QFeedback_Perfect=5]="QFeedback_Perfect",t[t.Debug1=6]="Debug1",t[t.Debug2=7]="Debug2",t[t.Debug3=8]="Debug3"}(e.NoteState||(e.NoteState={})),function(t){t.C="#d82c6b",t.D="#F89D15",t.E="#FFE21A",t.F="#4dbd5c",t.G="#009D96",t.A="#43469d",t.B="#76429c",t.Rest="#000000"}(e.AutoColorSet||(e.AutoColorSet={}))},function(t,e,i){var n,s;Object.defineProperty(e,"__esModule",{value:!0}),e.SystemLinesEnumHelper=e.SystemLinesEnum=void 0,(s=n=e.SystemLinesEnum||(e.SystemLinesEnum={}))[s.SingleThin=0]="SingleThin",s[s.DoubleThin=1]="DoubleThin",s[s.ThinBold=2]="ThinBold",s[s.BoldThinDots=3]="BoldThinDots",s[s.DotsThinBold=4]="DotsThinBold",s[s.DotsBoldBoldDots=5]="DotsBoldBoldDots",s[s.None=6]="None",s[s.Dotted=7]="Dotted",s[s.Dashed=8]="Dashed",s[s.Bold=9]="Bold",s[s.BoldThin=10]="BoldThin",s[s.DoubleBold=11]="DoubleBold",s[s.Tick=12]="Tick",s[s.Short=13]="Short",e.SystemLinesEnumHelper=class{static xmlBarlineStyleToSystemLinesEnum(t){return"regular"===t?n.SingleThin:"dotted"===t?n.Dotted:"dashed"===t?n.Dashed:"heavy"===t?n.Bold:"light-light"===t?n.DoubleThin:"light-heavy"===t?n.ThinBold:"heavy-light"===t?n.BoldThin:"heavy-heavy"===t?n.DoubleBold:"tick"===t?n.Tick:"short"===t?n.Short:"none"===t?n.None:n.SingleThin}}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalLabel=void 0;const n=i(9),s=i(5),r=i(114),o=i(17);class a extends r.Clickable{constructor(t,e,i,n,r){super(),this.label=t,this.boundingBox=new s.BoundingBox(this,r),this.label.fontHeight=e,this.label.textAlignment=i,this.rules=n}get Label(){return this.label}toString(){return`${this.label.text} (${this.boundingBox.RelativePosition.x},${this.boundingBox.RelativePosition.y})`}setLabelPositionAndShapeBorders(){var t,e;if(""===this.Label.text.trim())return;this.TextLines=[];const i=null!==(e=null===(t=this.rules)||void 0===t?void 0:t.LabelMarginBorderFactor)&&void 0!==e?e:.1,s=this.Label.text.split(/[\n\r]+/g),r=s.length;let a=0;for(let n=0;n0&&this.TextLines.length>1&&(l+=this.rules.SpacingBetweenTextLines*r/10);const h=this.PositionAndShape;switch(this.Label.textAlignment){case n.TextAlignmentEnum.CenterBottom:h.BorderTop=-l,h.BorderLeft=-a/2,h.BorderBottom=0,h.BorderRight=a/2;break;case n.TextAlignmentEnum.CenterCenter:h.BorderTop=-l/2,h.BorderLeft=-a/2,h.BorderBottom=l/2,h.BorderRight=a/2;break;case n.TextAlignmentEnum.CenterTop:h.BorderTop=0,h.BorderLeft=-a/2,h.BorderBottom=l,h.BorderRight=a/2;break;case n.TextAlignmentEnum.LeftBottom:h.BorderTop=-l,h.BorderLeft=0,h.BorderBottom=0,h.BorderRight=a;break;case n.TextAlignmentEnum.LeftCenter:h.BorderTop=-l/2,h.BorderLeft=0,h.BorderBottom=l/2,h.BorderRight=a;break;case n.TextAlignmentEnum.LeftTop:h.BorderTop=0,h.BorderLeft=0,h.BorderBottom=l,h.BorderRight=a;break;case n.TextAlignmentEnum.RightBottom:h.BorderTop=-l,h.BorderLeft=-a,h.BorderBottom=0,h.BorderRight=0;break;case n.TextAlignmentEnum.RightCenter:h.BorderTop=-l/2,h.BorderLeft=-a,h.BorderBottom=l/2,h.BorderRight=0;break;case n.TextAlignmentEnum.RightTop:h.BorderTop=0,h.BorderLeft=-a,h.BorderBottom=l,h.BorderRight=0}h.BorderMarginTop=h.BorderTop-l*i,h.BorderMarginLeft=h.BorderLeft-l*i,h.BorderMarginBottom=h.BorderBottom+l*i,h.BorderMarginRight=h.BorderRight+l*i}}e.GraphicalLabel=a},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.OSMDOptions=e.BackendType=e.FillEmptyMeasuresWithWholeRests=e.AlignRestOption=void 0;const n=i(33);var s,r;(r=e.AlignRestOption||(e.AlignRestOption={}))[r.Never=0]="Never",r[r.Always=1]="Always",r[r.Auto=2]="Auto",function(t){t[t.No=0]="No",t[t.YesVisible=1]="YesVisible",t[t.YesInvisible=2]="YesInvisible"}(e.FillEmptyMeasuresWithWholeRests||(e.FillEmptyMeasuresWithWholeRests={})),function(t){t[t.SVG=0]="SVG",t[t.Canvas=1]="Canvas"}(s=e.BackendType||(e.BackendType={})),e.OSMDOptions=class{static OSMDOptionsStandard(){return{autoResize:!0,backend:"svg",drawingParameters:n.DrawingParametersEnum.default}}static BackendTypeFromString(t){return t&&"canvas"===t.toLowerCase()?s.Canvas:s.SVG}}},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.PageFormat=e.EngravingRules=void 0;const s=i(45),r=n(i(1)),o=i(9),a=i(3),l=i(25),h=i(33),c=i(15),u=i(67),d=i(48),f=i(71);class p{constructor(){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.loadDefaultValues()}loadDefaultValues(){this.SamplingUnit=3*p.unit,this.SheetTitleHeight=4,this.SheetSubtitleHeight=2,this.SheetMinimumDistanceBetweenTitleAndSubtitle=1,this.SheetComposerHeight=2,this.SheetAuthorHeight=2,this.CompactMode=!1,this.PagePlacementEnum=s.PagePlacementEnum.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=p.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.BeamWidth=p.unit/2,this.BeamSpaceWidth=p.unit/3,this.BeamForwardLength=1.25*p.unit,this.FlatBeams=!1,this.FlatBeamOffset=20,this.FlatBeamOffsetPerBeam=10,this.ClefLeftMargin=.5,this.ClefRightMargin=.75,this.PercussionOneLineCutoff=3,this.PercussionForceVoicesOneLineCutoff=1,this.PercussionOneLineUseXMLDisplayStep=!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.DistanceBetweenAdjacentDynamics=.75,this.TempoChangeMeasureValidity=4,this.TempoContinousFactor=.7,this.StaccatoScalingFactor=.8,this.BetweenDotsDistance=.8,this.OrnamentAccidentalScalingFactor=.65,this.ChordSymbolTextHeight=2,this.ChordSymbolTextAlignment=o.TextAlignmentEnum.LeftBottom,this.ChordSymbolRelativeXOffset=-1,this.ChordSymbolXSpacing=1,this.ChordOverlapAllowedIntoNextMeasure=0,this.ChordSymbolYOffset=2,this.ChordSymbolLabelTexts=new c.Dictionary,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*p.unit,this.MeasureNumberLabelOffset=2,this.MeasureNumberLabelXOffset=-.5,this.TupletsRatioed=!1,this.TupletsBracketed=!1,this.TripletsBracketed=!1,this.TupletNumberLabelHeight=1.5*p.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.RepetitionEndingLabelHeight=2,this.RepetitionEndingLabelXOffset=.5,this.RepetitionEndingLabelYOffset=.3,this.RepetitionEndingLineYLowerOffset=.5,this.RepetitionEndingLineYUpperOffset=.3,this.VoltaOffset=2.5,this.LyricsAlignmentStandard=o.TextAlignmentEnum.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=p.unit/2,this.SystemRepetitionEndingLineWidth=.12,this.SystemDotWidth=p.unit/5,this.DistanceBetweenVerticalSystemLines=.35,this.DistanceBetweenDotAndLine=.7,this.OctaveShiftLineWidth=.12,this.OctaveShiftVerticalLineLength=p.unit,this.GraceLineWidth=this.StaffLineWidth*this.GraceNoteScalingFactor,this.MultipleRestMeasureDefaultWidth=4,this.MinimumCrossedBeamDifferenceMargin=1e-4,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.AlignRests=l.AlignRestOption.Never,this.FillEmptyMeasuresWithWholeRest=l.FillEmptyMeasuresWithWholeRests.No,this.ArpeggiosGoAcrossVoices=!1,this.RenderArpeggios=!0,this.RenderSlurs=!0,this.ColoringMode=h.ColoringModes.XML,this.ColoringEnabled=!0,this.ColorStemsLikeNoteheads=!1,this.ColorBeams=!0,this.ColorFlags=!0,this.DefaultColorNotehead="#000000",this.DefaultColorRest=this.DefaultColorNotehead,this.DefaultColorStem=this.DefaultColorNotehead,this.DefaultColorLabel=this.DefaultColorNotehead,this.DefaultColorTitle=this.DefaultColorNotehead,this.DefaultColorCursor="#33e02f",this.DefaultFontFamily="Times New Roman",this.DefaultFontStyle=u.FontStyles.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.RenderKeySignatures=!0,this.RenderTimeSignatures=!0,this.ArticulationPlacementFromXML=!0,this.FingeringPosition=a.PlacementEnum.Left,this.FingeringInsideStafflines=!1,this.FingeringLabelFontHeight=1.7,this.FingeringOffsetX=0,this.RenderStringNumbersClassical=!0,this.StringNumberOffsetY=0,this.NewSystemAtXMLNewSystemAttribute=!1,this.NewPageAtXMLNewPageAttribute=!1,this.RestoreCursorAfterRerender=!0,this.StretchLastSystemLine=!1,p.FixStafflineBoundingBox=!1,this.PageFormat=m.UndefinedPageFormat,this.PageBackgroundColor=void 0,this.RenderSingleHorizontalStaffline=!1,this.SpacingBetweenTextLines=0,this.NoteToGraphicalNoteMap=new c.Dictionary,this.NoteToGraphicalNoteMapObjectCount=0;try{this.MaxInstructionsConstValue=this.ClefLeftMargin+this.ClefRightMargin+this.KeyRightMargin+this.RhythmRightMargin+11}catch(t){r.default.info("EngravingRules()",t)}}addGraphicalNoteToNoteMap(t,e){t.NoteToGraphicalNoteObjectId=this.NoteToGraphicalNoteMapObjectCount,this.NoteToGraphicalNoteMap.setValue(t.NoteToGraphicalNoteObjectId,e),this.NoteToGraphicalNoteMapObjectCount++}GNote(t){return f.GraphicalNote.FromNote(t,this)}clearMusicSheetObjects(){this.NoteToGraphicalNoteMap=new c.Dictionary,this.NoteToGraphicalNoteMapObjectCount=0}setChordSymbolLabelText(t,e){this.ChordSymbolLabelTexts.setValue(t,e)}resetChordSymbolLabelTexts(t){return t.setValue(d.ChordSymbolEnum.minor,"m"),t.setValue(d.ChordSymbolEnum.augmented,"aug"),t.setValue(d.ChordSymbolEnum.diminished,"dim"),t.setValue(d.ChordSymbolEnum.dominant,"7"),t.setValue(d.ChordSymbolEnum.majorseventh,"maj7"),t.setValue(d.ChordSymbolEnum.minorseventh,"m7"),t.setValue(d.ChordSymbolEnum.diminishedseventh,"dim7"),t.setValue(d.ChordSymbolEnum.augmentedseventh,"aug7"),t.setValue(d.ChordSymbolEnum.halfdiminished,"m7b5"),t.setValue(d.ChordSymbolEnum.majorminor,"m(maj7)"),t.setValue(d.ChordSymbolEnum.majorsixth,"maj6"),t.setValue(d.ChordSymbolEnum.minorsixth,"m6"),t.setValue(d.ChordSymbolEnum.dominantninth,"9"),t.setValue(d.ChordSymbolEnum.majorninth,"maj9"),t.setValue(d.ChordSymbolEnum.minorninth,"m9"),t.setValue(d.ChordSymbolEnum.dominant11th,"11"),t.setValue(d.ChordSymbolEnum.major11th,"maj11"),t.setValue(d.ChordSymbolEnum.minor11th,"m11"),t.setValue(d.ChordSymbolEnum.dominant13th,"13"),t.setValue(d.ChordSymbolEnum.major13th,"maj13"),t.setValue(d.ChordSymbolEnum.minor13th,"m13"),t.setValue(d.ChordSymbolEnum.suspendedsecond,"sus2"),t.setValue(d.ChordSymbolEnum.suspendedfourth,"sus4"),t.setValue(d.ChordSymbolEnum.power,"5"),t.setValue(d.ChordSymbolEnum.none,"N.C."),t}addChordName(t,e,i,n,s){if(void 0!==d.ChordSymbolEnum[e]){const r={adds:i,alts:n,subs:s};this.CustomChords.push(d.CustomChord.createCustomChord(t,d.ChordSymbolEnum[e],r))}}renameChord(t,e){d.CustomChord.renameCustomChord(t,e,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 t=0;te.parentRepetition.StartIndex)return-1}if(t.alignment===s.Begin&&e.alignment===s.Begin){if(t.parentRepetition.EndIndexe.parentRepetition.EndIndex)return-1}}return 0}},e.RepetitionInstruction=class{constructor(t,e,i=s.End,n,r){this.endingIndices=void 0,this.measureIndex=t,r&&(this.endingIndices=r.slice()),this.type=e,this.alignment=i,this.parentRepetition=n}CompareTo(t){const e=t;if(this.measureIndex>e.measureIndex)return 1;if(this.measureIndex0)return!0;return!1}hasTie(){for(let t=0,e=this.VoiceEntries.length;t=0;r--)if(s(t[r],e))return r;return-1},e.contains=function(t,e,i){return s(t,e,i)>=0},e.remove=function(t,e,i){var n=s(t,e,i);return!(n<0||(t.splice(n,1),0))},e.frequency=function(t,e,i){for(var s=i||n.defaultEquals,r=t.length,o=0,a=0;a=t.length||i<0||i>=t.length)return!1;var n=t[e];return t[e]=t[i],t[i]=n,!0},e.toString=function(t){return"["+t.toString()+"]"},e.forEach=function(t,e){for(var i=0,n=t;i0){c.default.trace(`Ghost Found in between (measure ${this.MeasureNumber})`);const e=l.VexFlowConverter.GhostNote(t),n=new m.VexFlowVoiceEntry(void 0,void 0);n.vfStaveNote=e,i.splice(r,0,n),r++}}else{const t=b.Fraction.minus(n,this.parentSourceMeasure.AbsoluteTimestamp);if(t.RealValue>0){c.default.trace(`Ghost Found at start (measure ${this.MeasureNumber})`);const e=l.VexFlowConverter.GhostNote(t),n=new m.VexFlowVoiceEntry(void 0,void 0);n.vfStaveNote=e,i.splice(0,0,n),r++}}e=s}const n=b.Fraction.plus(this.parentSourceMeasure.AbsoluteTimestamp,this.parentSourceMeasure.Duration),s=b.Fraction.minus(n,e);if(s.RealValue>0){c.default.trace(`Ghost Found at end (measure ${this.MeasureNumber})`);const t=l.VexFlowConverter.GhostNote(s),e=new m.VexFlowVoiceEntry(void 0,void 0);e.vfStaveNote=t,i.push(e)}return i}handleBeam(t,e){const i=t.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;let n,s=this.beams[i];s||(s=this.beams[i]=[]);for(const o of s)o[0]===e&&(n=o);n||(n=[e,[]],s.push(n));const r=t.parentVoiceEntry;n[1].indexOf(r)<0&&n[1].push(r)}handleTuplet(t,e){const i=t.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;e=t.sourceNote.NoteTuplet;let n,s=this.tuplets[i];s||(s=this.tuplets[i]=[]);for(const o of s)o[0]===e&&(n=o);n||(n=[e,[]],s.push(n));const r=t.parentVoiceEntry;n[1].indexOf(r)<0&&n[1].push(r)}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 n of this.beams[e]){let e=!1;for(const t of n[0].Notes)if(t.Length.RealValue>=new b.Fraction(1,4).RealValue&&(!t.TypeLength||t.TypeLength.RealValue>.125)){e=!0;break}if(e){c.default.debug("Beam between note >= quarter, likely tremolo, currently unsupported. continuing.");continue}const r=[],o=n[0],a=n[1];let l=!0;for(const t of a)t.parentVoiceEntry.ParentVoice===o.Notes[0].ParentVoiceEntry.ParentVoice&&(l=t.parentVoiceEntry.WantedStemDirection===p.StemDirectionType.Undefined);let h,u=!1;const d=[];for(const i of a){const e=i.vfStaveNote;e&&(r.push(e),t.push(e)),i.parentVoiceEntry.IsGrace&&(u=!0),i.parentVoiceEntry.StemColor&&this.rules.ColoringEnabled&&d.push(i.parentVoiceEntry.StemColor)}if(r.length>1){const t=new s.default.Flow.Beam(r,l);if(u&&(t.render_options.beam_width=3,t.render_options.partial_beam_length=4),d.length>=2&&this.rules.ColorBeams){h=d[0];for(const t of d)if(t!==h){h=void 0;break}t.setStyle({fillStyle:h,strokeStyle:h})}this.rules.FlatBeams&&(t.render_options.flat_beams=!0,t.render_options.flat_beam_offset=this.rules.FlatBeamOffset,t.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),i.push(t)}else c.default.debug("Warning! Beam with no notes!")}}this.rules.AutoBeamNotes&&this.autoBeamNotes(t)}autoBeamNotes(t){let e,i=[],n=[],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 l of c.graphicalVoiceEntries){const h=l.vfStaveNote,u=l.notes[0],d=c.relInMeasureTimestamp.isOnBeat(a),f=n.length>=2,p=u.sourceNote.Length.RealValue-new b.Fraction(1,4).RealValue>-b.Fraction.FloatInaccuracyTolerance,m=l.parentVoiceEntry.IsGrace||p||t.contains(h);if(m||d){if(f){for(const t of n)i.push(t);o.push(i.slice()),i=[]}if(n=[],m)continue}const g=l.notes[0].sourceNote.NoteTuplet;if(g){let t=!1;for(const e of g.Notes){for(const i of e)if(i.NoteTypeXml>=S.NoteType.QUARTER||i.ParentVoiceEntry.IsGrace||i.isRest()&&!this.rules.AutoBeamOptions.beam_rests){t=!0;break}if(t)break}if(e){if(e!==g){if(r.length>1){const t=new s.default.Flow.Beam(r,!0);this.rules.FlatBeams&&(t.render_options.flat_beams=!0,t.render_options.flat_beam_offset=this.rules.FlatBeamOffset,t.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoTupletVfBeams.push(t)}r=[],e=g}}else e=g;t||r.push(h)}else e=void 0,n.push(h)}if(r.length>=2){const t=new s.default.Flow.Beam(r,!0);this.rules.FlatBeams&&(t.render_options.flat_beams=!0,t.render_options.flat_beam_offset=this.rules.FlatBeamOffset,t.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoTupletVfBeams.push(t)}if(n.length>=2){for(const t of n)i.push(t);o.push(i)}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 t=[];for(const e of l.groups)t.push(new s.default.Flow.Fraction(e[0],e[1]));h.groups=t}for(const c of o){const t=s.default.Flow.Beam.generateBeams(c,h);for(const e of t)this.rules.FlatBeams&&(e.render_options.flat_beams=!0,e.render_options.flat_beam_offset=this.rules.FlatBeamOffset,e.render_options.flat_beam_offset_per_beam=this.rules.FlatBeamOffsetPerBeam),this.autoVfBeams.push(e)}}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 t=[],n=i[1];for(const e of n)t.push(e.vfStaveNote);if(t.length>1){const n=i[0],r=n.Notes[0][0].NormalNotes,o=n.Bracket||3===n.TupletLabelNumber&&this.rules.TripletsBracketed||3!==n.TupletLabelNumber&&this.rules.TupletsBracketed;let a=s.default.Flow.Tuplet.LOCATION_TOP;n.tupletLabelNumberPlacement===y.PlacementEnum.Below&&(a=s.default.Flow.Tuplet.LOCATION_BOTTOM),e.push(new s.default.Flow.Tuplet(t,{bracketed:o,location:a,notes_occupied:r,num_notes:n.TupletLabelNumber,ratioed:this.rules.TupletsRatioed}))}else c.default.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 n of r.graphicalVoiceEntries)if(n.parentVoiceEntry.IsGrace)e.push(n),i.push(n),t||(t=n.parentVoiceEntry.GraceSlur);else if(n.notes[0].sourceNote.PrintObject,n.vfStaveNote=l.VexFlowConverter.StaveNote(n),e.length>0){const i=[];for(let t=0;t0)for(const s of e)s.vfStaveNote=l.VexFlowConverter.StaveNote(s),s.parentVoiceEntry.GraceAfterMainNote=!0;this.finalizeBeams(),this.finalizeTuplets();const n=this.getVoicesWithinMeasure();if(this.rules.RenderFingerings)for(const s of this.staffEntries)s.setModifierXOffsets();for(const r of n){if(!r)continue;const t=!(r instanceof g.LinkedVoice);this.vfVoices[r.VoiceId]=new s.default.Flow.Voice({beat_value:this.parentSourceMeasure.Duration.Denominator,num_beats:this.parentSourceMeasure.Duration.Numerator,resolution:s.default.Flow.RESOLUTION}).setMode(s.default.Flow.Voice.Mode.SOFT);const e=this.getRestFilledVexFlowStaveNotesPerVoice(r);for(const i of e){if(i.parentVoiceEntry&&i.parentVoiceEntry.IsGrace&&!i.parentVoiceEntry.GraceAfterMainNote)continue;const e=i;if(0!==i.notes.length&&i.notes[0]&&i.notes[0].sourceNote.PrintObject){if(t){const t=e.parentStaffEntry;if(t&&t.vfClefBefore){const i=new h([t.vfClefBefore]);e.vfStaveNote.getCategory&&"stavenotes"===e.vfStaveNote.getCategory()&&e.vfStaveNote.addModifier(0,i)}}i.parentVoiceEntry&&this.rules.RenderFingerings&&(this.createFingerings(i),this.createStringNumber(i)),this.createArpeggio(i),this.vfVoices[r.VoiceId].addTickable(e.vfStaveNote)}else this.vfVoices[r.VoiceId].addTickable(e.vfStaveNote)}}for(const s of i)this.createFingerings(s),this.createStringNumber(s),this.createArpeggio(s);this.createArticulations(),this.createOrnaments(),this.setStemDirectionFromVexFlow()}createArpeggio(t){if(t.parentVoiceEntry&&t.parentVoiceEntry.Arpeggio){const e=t.parentVoiceEntry.Arpeggio;if(t.notes&&t.notes.length>1){const i=l.VexFlowConverter.StrokeTypeFromArpeggioType(e.type),n=new s.default.Flow.Stroke(i,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&t.vfStaveNote.addStroke(0,n)}else c.default.debug(`[OSMD] arpeggio in measure ${this.MeasureNumber} could not be drawn.\n 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 t of e.notes){const i=t.vfnote;if(i&&i[0])switch(i[0].getStemDirection()){case s.default.Flow.Stem.UP:e.parentVoiceEntry.StemDirection=p.StemDirectionType.Up;break;case s.default.Flow.Stem.DOWN:e.parentVoiceEntry.StemDirection=p.StemDirectionType.Down}}}createArticulations(){for(let t=0,e=this.staffEntries.length;t1||t.parentStaffEntry.graphicalVoiceEntries.length>1?l=s.default.Flow.StaveModifier.Position.LEFT:0===e.idInMusicSheet?(l=s.default.Flow.StaveModifier.Position.ABOVE,a=y.PlacementEnum.Above):(l=s.default.Flow.StaveModifier.Position.BELOW,a=y.PlacementEnum.Below)}const c=new s.default.Flow.FretHandFinger(o.value);if(c.setPosition(l),c.setOffsetX(h),a===y.PlacementEnum.Above||a===y.PlacementEnum.Below){const t=a===y.PlacementEnum.Above?-1:1,r=a===y.PlacementEnum.Above?n:i-1-n;if(this.rules.FingeringInsideStafflines&&i>1){const e=c.getWidth()/2,n=2.5*i;c.setOffsetY(t*(r+n)*e)}else if(!this.rules.FingeringInsideStafflines){const i=new s.default.Flow.StringNumber(o.value);i.radius=0,i.setPosition(l),i.setOffsetY(t*r*i.getWidth()*2/3),e.vfStaveNote.addModifier(n,i);continue}}e.vfStaveNote.addModifier(n,c)}}createStringNumber(t){if(!this.rules.RenderStringNumbersClassical)return;const e=t;t.notes.forEach(((i,n)=>{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"}const a=new s.default.Flow.StringNumber(o);a.radius=0;const l=-this.rules.StringNumberOffsetY;t.notes.length>1||t.parentStaffEntry.graphicalVoiceEntries.length>1?(a.setOffsetX(13*i.baseStringNumberXOffset),a.setPosition(s.default.Flow.Modifier.Position.RIGHT)):a.setPosition(s.default.Flow.Modifier.Position.ABOVE),a.setOffsetY(l),e.vfStaveNote.addModifier(n,a)}}))}lineTo(t,e){const i=new s.default.Flow.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 n of i)n.getPosition()===x.BEGIN?t+=n.getWidth()+n.getPadding(void 0):n.getPosition()===x.END&&(e+=n.getWidth()+n.getPadding(void 0));this.beginInstructionsWidth=(null!=t?t:0)/u.unitInPixels,this.endInstructionsWidth=(null!=e?e:0)/u.unitInPixels}}var x,E;e.VexFlowMeasure=v,(E=x=e.StavePositionEnum||(e.StavePositionEnum={}))[E.LEFT=1]="LEFT",E[E.RIGHT=2]="RIGHT",E[E.ABOVE=3]="ABOVE",E[E.BELOW=4]="BELOW",E[E.BEGIN=5]="BEGIN",E[E.END=6]="END"},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.PagePlacementEnum=e.GraphicalMusicPage=void 0;const n=i(5),s=i(6),r=i(4);class o extends s.GraphicalObject{constructor(t){super(),this.musicSystems=[],this.labels=[],this.parent=t,this.boundingBox=new n.BoundingBox(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 r.PointF2D(0,0)}}var a;e.GraphicalMusicPage=o,(a=e.PagePlacementEnum||(e.PagePlacementEnum={}))[a.Down=0]="Down",a[a.Right=1]="Right",a[a.RightDown=2]="RightDown"},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.RectangleF2D=void 0;const n=i(66),s=i(4);class r{constructor(t,e,i,n){this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=e,this.width=i,this.height=n}static createFromLocationAndSize(t,e){return new r(t.x,t.y,e.width,e.height)}get Location(){return new s.PointF2D(this.x,this.y)}get Size(){return new n.SizeF2D(this.width,this.height)}}e.RectangleF2D=r},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.StaffLineActivitySymbol=void 0;const n=i(6),s=i(5);class r extends n.GraphicalObject{constructor(t){super(),this.parentStaffLine=t;const e=t.PositionAndShape;this.boundingBox=new s.BoundingBox(this,e),this.boundingBox.BorderRight=6,this.boundingBox.BorderBottom=4.5,this.boundingBox.BorderLeft=-1.5,this.boundingBox.BorderTop=-1.5}}e.StaffLineActivitySymbol=r},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.ChordSymbolEnum=e.ChordDegreeText=e.CustomChord=e.Degree=e.ChordSymbolContainer=void 0;const n=i(2),s=i(17),r=i(2);e.ChordSymbolContainer=class{constructor(t,e,i,n,s){this.rootPitch=t,this.chordKind=e,this.bassPitch=i,this.degrees=n,this.rules=s}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 o=t.RootPitch;if(s.MusicSheetCalculator.transposeCalculator&&(o=s.MusicSheetCalculator.transposeCalculator.transposePitch(t.RootPitch,i,e)),t.ChordKind===l.none)return t.getTextFromChordKindEnum(t.ChordKind);let h=n.Pitch.getNoteEnumString(o.FundamentalNote);o.Accidental!==r.AccidentalEnum.NONE&&(h+=this.getTextForAccidental(o.Accidental));const c={adds:[],alts:[],subs:[]};for(const n of t.ChordDegrees)if(n){let t="";switch(n.alteration!==r.AccidentalEnum.NONE&&(t+=this.getTextForAccidental(n.alteration)),t+=n.value,n.text){case a.add:c.adds.push(t);break;case a.alter:c.alts.push(t);break;case a.subtract:c.subs.push(t)}}let u=t.getTextFromChordKindEnum(t.ChordKind);const d=["adds","alts","subs"],f=t.rules.CustomChords;for(const n of f){if(n.chordKind!==t.chordKind)continue;let e=!0;for(const t of d){for(const i of n.degrees[t]||[])if(c[t].indexOf(i)<0){e=!1;break}if(!e)break}if(e){for(const t of d)for(const e of n.degrees[t]||[])c[t].splice(c[t].indexOf(e),1);u=n.alternateName}}if(h+=u,c.adds.length>0&&(h+="("+c.adds.join(",")+")"),c.alts.length>0&&(h+="(alt "+c.alts.join(",")+")"),c.subs.length>0&&(h+="(omit "+c.subs.join(",")+")"),t.BassPitch){let r=t.BassPitch;s.MusicSheetCalculator.transposeCalculator&&(r=s.MusicSheetCalculator.transposeCalculator.transposePitch(t.BassPitch,i,e)),h+="/",h+=n.Pitch.getNoteEnumString(r.FundamentalNote),h+=this.getTextForAccidental(r.Accidental)}return h}static getTextForAccidental(t){let e="";switch(t){case r.AccidentalEnum.DOUBLEFLAT:e+="bb";break;case r.AccidentalEnum.FLAT:e+="b";break;case r.AccidentalEnum.SHARP:e+="#";break;case r.AccidentalEnum.DOUBLESHARP:e+="x"}return e}getTextFromChordKindEnum(t){var e;return null!==(e=this.rules.ChordSymbolLabelTexts.getValue(t))&&void 0!==e?e:""}},e.Degree=class{constructor(t,e,i){this.value=t,this.alteration=e,this.text=i}};class o{constructor(t,e,i){this.alternateName=t,this.chordKind=e,this.degrees=i}static createCustomChord(t,e,i){return new o(t,e,i)}static renameCustomChord(t,e,i){for(const n of i)n.alternateName===t&&(n.alternateName=e)}}var a,l,h;e.CustomChord=o,(h=a=e.ChordDegreeText||(e.ChordDegreeText={}))[h.add=0]="add",h[h.alter=1]="alter",h[h.subtract=2]="subtract",function(t){t[t.major=0]="major",t[t.minor=1]="minor",t[t.augmented=2]="augmented",t[t.diminished=3]="diminished",t[t.dominant=4]="dominant",t[t.majorseventh=5]="majorseventh",t[t.minorseventh=6]="minorseventh",t[t.diminishedseventh=7]="diminishedseventh",t[t.augmentedseventh=8]="augmentedseventh",t[t.halfdiminished=9]="halfdiminished",t[t.majorminor=10]="majorminor",t[t.majorsixth=11]="majorsixth",t[t.minorsixth=12]="minorsixth",t[t.dominantninth=13]="dominantninth",t[t.majorninth=14]="majorninth",t[t.minorninth=15]="minorninth",t[t.dominant11th=16]="dominant11th",t[t.major11th=17]="major11th",t[t.minor11th=18]="minor11th",t[t.dominant13th=19]="dominant13th",t[t.major13th=20]="major13th",t[t.minor13th=21]="minor13th",t[t.suspendedsecond=22]="suspendedsecond",t[t.suspendedfourth=23]="suspendedfourth",t[t.Neapolitan=24]="Neapolitan",t[t.Italian=25]="Italian",t[t.French=26]="French",t[t.German=27]="German",t[t.pedal=28]="pedal",t[t.power=29]="power",t[t.Tristan=30]="Tristan",t[t.none=31]="none"}(l=e.ChordSymbolEnum||(e.ChordSymbolEnum={}))},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractNotationInstruction=void 0,e.AbstractNotationInstruction=class{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}}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.OrnamentEnum=e.OrnamentContainer=void 0;const n=i(2),s=i(3);var r;e.OrnamentContainer=class{constructor(t){this.placement=s.PlacementEnum.Above,this.accidentalAbove=n.AccidentalEnum.NONE,this.accidentalBelow=n.AccidentalEnum.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}},(r=e.OrnamentEnum||(e.OrnamentEnum={}))[r.Trill=0]="Trill",r[r.Turn=1]="Turn",r[r.InvertedTurn=2]="InvertedTurn",r[r.DelayedTurn=3]="DelayedTurn",r[r.DelayedInvertedTurn=4]="DelayedInvertedTurn",r[r.Mordent=5]="Mordent",r[r.InvertedMordent=6]="InvertedMordent"},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Voice=void 0,e.Voice=class{constructor(t,e){this.voiceEntries=[],this.volume=1,this.parent=t,this.visible=!0,this.audible=!0,this.following=!0,this.voiceId=e}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 VoiceId(){return this.voiceId}get Volume(){return this.volume}set Volume(t){this.volume=t}}},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalContinuousDynamicExpression=void 0;const s=i(27),r=i(32),o=i(4),a=i(42),l=i(3),h=n(i(1));class c extends a.AbstractGraphicalExpression{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 t;const e=this.parentStaffLine.SkyBottomLineCalculator,i=this.IsVerbal?this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginLeft:0,n=this.IsVerbal?this.label.PositionAndShape.RelativePosition.x+this.label.PositionAndShape.BorderMarginRight:0;switch(!this.IsVerbal&&this.lines.length<2&&h.default.warn("Not enough lines for SkyBottomLine calculation"),this.IsVerbal||this.ContinuousDynamic.DynamicType!==r.ContDynamicEnum.crescendo&&this.ContinuousDynamic.DynamicType!==r.ContDynamicEnum.diminuendo&&h.default.warn("GraphicalContinuousDynamicExpression.updateSkyBottomLine(): unhandled continuous dynamic type. start measure: "+(null===(t=this.startMeasure)||void 0===t?void 0:t.MeasureNumber)),this.Placement){case l.PlacementEnum.Above:if(this.IsVerbal){const t=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;e.updateSkyLineInRange(i,n,t)}else this.ContinuousDynamic.DynamicType===r.ContDynamicEnum.crescendo?e.updateSkyLineWithWedge(this.lines[0].Start,this.lines[0].End):this.ContinuousDynamic.DynamicType===r.ContDynamicEnum.diminuendo&&e.updateSkyLineWithWedge(this.lines[0].End,this.lines[0].Start);break;case l.PlacementEnum.Below:if(this.IsVerbal){const t=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;e.updateBottomLineInRange(i,n,t)}else this.ContinuousDynamic.DynamicType===r.ContDynamicEnum.crescendo?e.updateBottomLineWithWedge(this.lines[1].Start,this.lines[1].End):this.ContinuousDynamic.DynamicType===r.ContDynamicEnum.diminuendo&&e.updateBottomLineWithWedge(this.lines[1].End,this.lines[1].Start);break;default:h.default.error("Placement for GraphicalContinuousDynamicExpression is unknown")}}createCrescendoLines(t,e,i,n=this.rules.WedgeOpeningLength,s=this.rules.WedgeLineWidth){const r=new o.PointF2D(t,i),a=new o.PointF2D(e,i-n/2),l=new o.PointF2D(e,i+n/2);this.addWedgeLines(r,a,l,s)}createFirstHalfCrescendoLines(t,e,i,n=this.rules.WedgeMeasureEndOpeningLength,s=this.rules.WedgeLineWidth){const r=new o.PointF2D(t,i),a=new o.PointF2D(e,i-n/2),l=new o.PointF2D(e,i+n/2);this.addWedgeLines(r,a,l,s)}createSecondHalfCrescendoLines(t,e,i,n=this.rules.WedgeMeasureBeginOpeningLength,s=this.rules.WedgeOpeningLength,r=this.rules.WedgeLineWidth){const a=new o.PointF2D(t,i-n/2),l=new o.PointF2D(t,i+n/2),h=new o.PointF2D(e,i-s/2),c=new o.PointF2D(e,i+s/2);this.addDoubleLines(a,h,l,c,r)}recalculateCrescendoLines(t,e,i){const n=Math.abs(this.lines[0].Start.y-this.lines[1].Start.y)>1e-4;this.lines.clear(),n?this.createSecondHalfCrescendoLines(t,e,i):this.isSplittedPart?this.createFirstHalfCrescendoLines(t,e,i):this.createCrescendoLines(t,e,i)}createDiminuendoLines(t,e,i,n=this.rules.WedgeOpeningLength,s=this.rules.WedgeLineWidth){const r=new o.PointF2D(t,i-n/2),a=new o.PointF2D(t,i+n/2),l=new o.PointF2D(e,i);this.addWedgeLines(l,r,a,s)}createFirstHalfDiminuendoLines(t,e,i,n=this.rules.WedgeOpeningLength,s=this.rules.WedgeMeasureEndOpeningLength,r=this.rules.WedgeLineWidth){const a=new o.PointF2D(t,i-n/2),l=new o.PointF2D(t,i+n/2),h=new o.PointF2D(e,i-s/2),c=new o.PointF2D(e,i+s/2);this.addDoubleLines(a,h,l,c,r)}createSecondHalfDiminuendoLines(t,e,i,n=this.rules.WedgeMeasureBeginOpeningLength,s=this.rules.WedgeLineWidth){const r=new o.PointF2D(t,i-n/2),a=new o.PointF2D(t,i+n/2),l=new o.PointF2D(e,i);this.addWedgeLines(l,r,a,s)}recalculateDiminuendoLines(t,e,i){const n=Math.abs(this.lines[0].End.y-this.lines[1].End.y)>1e-4;this.lines.clear(),n?this.createFirstHalfDiminuendoLines(t,e,i):this.isSplittedPart?this.createSecondHalfDiminuendoLines(t,e,i):this.createDiminuendoLines(t,e,i)}calcPsi(){this.IsVerbal?this.PositionAndShape.calculateBoundingBox():(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===r.ContDynamicEnum.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)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,n){const r=new s.GraphicalLine(t,e,n),o=new s.GraphicalLine(t,i,n);this.lines.push(r),this.lines.push(o)}addDoubleLines(t,e,i,n,r){const o=new s.GraphicalLine(t,e,r),a=new s.GraphicalLine(i,n,r);this.lines.push(o),this.lines.push(a)}}e.GraphicalContinuousDynamicExpression=c},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var n=i(10),s=i(35),r=function(){function t(){this.firstNode=null,this.lastNode=null,this.nElements=0}return t.prototype.add=function(t,e){if(n.isUndefined(e)&&(e=this.nElements),e<0||e>this.nElements||n.isUndefined(t))return!1;var i=this.createNode(t);if(0===this.nElements||null===this.lastNode)this.firstNode=i,this.lastNode=i;else if(e===this.nElements)this.lastNode.next=i,this.lastNode=i;else if(0===e)i.next=this.firstNode,this.firstNode=i;else{var s=this.nodeAtIndex(e-1);if(null===s)return!1;i.next=s.next,s.next=i}return this.nElements++,!0},t.prototype.first=function(){if(null!==this.firstNode)return this.firstNode.element},t.prototype.last=function(){if(null!==this.lastNode)return this.lastNode.element},t.prototype.elementAtIndex=function(t){var e=this.nodeAtIndex(t);if(null!==e)return e.element},t.prototype.indexOf=function(t,e){var i=e||n.defaultEquals;if(n.isUndefined(t))return-1;for(var s=this.firstNode,r=0;null!==s;){if(i(s.element,t))return r;r++,s=s.next}return-1},t.prototype.contains=function(t,e){return this.indexOf(t,e)>=0},t.prototype.remove=function(t,e){var i=e||n.defaultEquals;if(this.nElements<1||n.isUndefined(t))return!1;for(var s=null,r=this.firstNode;null!==r;){if(i(r.element,t))return null===s?(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},t.prototype.clear=function(){this.firstNode=null,this.lastNode=null,this.nElements=0},t.prototype.equals=function(e,i){var s=i||n.defaultEquals;return e instanceof t&&this.size()===e.size()&&this.equalsAux(this.firstNode,e.firstNode,s)},t.prototype.equalsAux=function(t,e,i){for(;null!==t&&null!==e;){if(!i(t.element,e.element))return!1;t=t.next,e=e.next}return!0},t.prototype.removeElementAtIndex=function(t){if(!(t<0||t>=this.nElements||null===this.firstNode||null===this.lastNode)){var e;if(1===this.nElements)e=this.firstNode.element,this.firstNode=null,this.lastNode=null;else{var i=this.nodeAtIndex(t-1);null===i?(e=this.firstNode.element,this.firstNode=this.firstNode.next):i.next===this.lastNode&&(e=this.lastNode.element,this.lastNode=i),null!==i&&null!==i.next&&(e=i.next.element,i.next=i.next.next)}return this.nElements--,e}},t.prototype.forEach=function(t){for(var e=this.firstNode;null!==e&&!1!==t(e.element);)e=e.next},t.prototype.reverse=function(){for(var t=null,e=this.firstNode,i=null;null!==e;)i=e.next,e.next=t,t=e,e=i;i=this.firstNode,this.firstNode=this.lastNode,this.lastNode=i},t.prototype.toArray=function(){for(var t=[],e=this.firstNode;null!==e;)t.push(e.element),e=e.next;return t},t.prototype.size=function(){return this.nElements},t.prototype.isEmpty=function(){return this.nElements<=0},t.prototype.toString=function(){return s.toString(this.toArray())},t.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=o.allargando&&t<=o.ritenuto}get TempoType(){return this.tempoType}set TempoType(t){this.tempoType=t}get StartTempo(){return this.startTempo}set StartTempo(t){this.startTempo=t}get EndTempo(){return this.endTempo}set EndTempo(t){this.endTempo=t}get AbsoluteEndTimestamp(){return this.absoluteEndTimestamp}set AbsoluteEndTimestamp(t){this.absoluteEndTimestamp=t}get AbsoluteTimestamp(){return this.ParentMultiTempoExpression.AbsoluteTimestamp}getAbsoluteFloatTimestamp(){return this.ParentMultiTempoExpression.AbsoluteTimestamp.RealValue}getInterpolatedTempo(t){const e=n.Fraction.plus(this.parentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp,this.parentMultiTempoExpression.Timestamp);if(t.lt(e))return-1;if(this.absoluteEndTimestamp.lt(t))return-2;const i=n.Fraction.minus(t,e).RealValue/n.Fraction.minus(this.absoluteEndTimestamp,e).RealValue;return Math.max(0,Math.min(250,this.startTempo+(this.endTempo-this.startTempo)*i))}setTempoType(){r.isStringInStringList(r.listContinuousTempoFaster,this.label)?this.tempoType=o.accelerando:r.isStringInStringList(r.listContinuousTempoSlower,this.label)&&(this.tempoType=o.ritardando)}}var o,a;e.ContinuousTempoExpression=r,r.listContinuousTempoFaster=["accelerando","piu mosso","poco piu","stretto"],r.listContinuousTempoSlower=["poco meno","meno mosso","piu lento","calando","allargando","rallentando","ritardando","ritenuto","ritard.","ritard","rit.","rit","riten.","riten"],(a=o=e.ContinuousTempoType||(e.ContinuousTempoType={}))[a.accelerando=0]="accelerando",a[a.stretto=1]="stretto",a[a.stringendo=2]="stringendo",a[a.mosso=3]="mosso",a[a.piuMosso=4]="piuMosso",a[a.allargando=5]="allargando",a[a.calando=6]="calando",a[a.menoMosso=7]="menoMosso",a[a.rallentando=8]="rallentando",a[a.ritardando=9]="ritardando",a[a.ritard=10]="ritard",a[a.rit=11]="rit",a[a.ritenuto=12]="ritenuto",a[a.rubato=13]="rubato",a[a.precipitando=14]="precipitando"},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowContinuousDynamicExpression=void 0;const n=i(52),s=i(24),r=i(12),o=i(9),a=i(21);class l extends n.GraphicalContinuousDynamicExpression{constructor(t,e,i,n){if(super(t,e,i),this.IsVerbal){const e=new r.Label(t.Label);this.label=new s.GraphicalLabel(e,n||this.rules.ContinuousDynamicTextHeight,o.TextAlignmentEnum.LeftCenter,this.rules,this.PositionAndShape),this.label.Label.fontStyle=a.FontStyles.Italic,this.label.setLabelPositionAndShapeBorders(),this.PositionAndShape.calculateBoundingBox()}}}e.VexFlowContinuousDynamicExpression=l},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.CanvasVexFlowBackend=void 0;const s=n(i(8)),r=i(59),o=i(13),a=i(25),l=i(45);class h extends r.VexFlowBackend{constructor(t){super(),this.rules=t}getVexflowBackendType(){return s.default.Flow.Renderer.Backends.CANVAS}getOSMDBackendType(){return a.BackendType.Canvas}getCanvasSize(){var t;return null===(t=document.getElementById("osmdCanvasPage"+this.graphicalMusicPage.PageNumber))||void 0===t?void 0:t.offsetHeight}initialize(t,e){this.zoom=e,this.canvas=document.createElement("canvas"),this.graphicalMusicPage||(this.graphicalMusicPage=new l.GraphicalMusicPage(void 0),this.graphicalMusicPage.PageNumber=1),this.canvas.id="osmdCanvasVexFlowBackendCanvas"+this.graphicalMusicPage.PageNumber,this.inner=document.createElement("div"),this.inner.id="osmdCanvasPage"+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 s.default.Flow.Renderer(this.canvas,this.getVexflowBackendType()),this.ctx=this.renderer.getContext()}initializeHeadless(t=300,e=300){this.graphicalMusicPage||(this.graphicalMusicPage=new l.GraphicalMusicPage(void 0),this.graphicalMusicPage.PageNumber=1),this.canvas=document.createElement("canvas"),this.canvas.width=t,this.canvas.height=e,this.renderer=new s.default.Flow.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,n,s,r,a,l){const h=this.CanvasRenderingCtx.font;this.CanvasRenderingCtx.save(),this.CanvasRenderingCtx.font=o.VexFlowConverter.font(t,e,i,this.rules,l),this.CanvasRenderingCtx.fillStyle=a,this.CanvasRenderingCtx.strokeStyle=a,this.CanvasRenderingCtx.fillText(n,r.x,r.y+s),this.CanvasRenderingCtx.restore(),this.CanvasRenderingCtx.font=h}renderRectangle(t,e,i,n=1){const s=this.CanvasRenderingCtx.fillStyle;this.CanvasRenderingCtx.fillStyle=i||o.VexFlowConverter.style(e),this.CanvasRenderingCtx.globalAlpha=n,this.ctx.fillRect(t.x,t.y,t.width,t.height),this.CanvasRenderingCtx.fillStyle=s,this.CanvasRenderingCtx.globalAlpha=1}renderLine(t,e,i="#FF0000FF",n=2){const s=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=s}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}}e.CanvasVexFlowBackend=h},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowBackend=e.VexFlowBackends=void 0;const s=n(i(8));e.VexFlowBackends=class{},e.VexFlowBackend=class{getInnerElement(){return this.inner}getCanvas(){return this.canvas}getRenderElement(){let t=this.canvas;return this.getVexflowBackendType()===s.default.Flow.Renderer.Backends.CANVAS&&(t=this.inner),t}getRenderer(){return this.renderer}removeAllChildrenFromContainer(t){for(;0!==t.children.length;)t.removeChild(t.children.item(0))}removeFromContainer(t){const e=this.getRenderElement();for(let i=0;ithis.vfnoteIndex&&i[this.vfnoteIndex]?e.note_heads[this.vfnoteIndex]:{line:0}}Clef(){return this.clef}getSVGId(){return this.vfnote[0].getAttribute("id")}getSVGGElement(){return this.vfnote[0].getAttribute("el")}}e.VexFlowGraphicalNote=o},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowInstrumentBracket=void 0;const s=n(i(8)),r=i(6),o=i(5),a=i(16);class l extends r.GraphicalObject{constructor(t,e,i=0){super(),this.PositionAndShape=new o.BoundingBox(this,t.ParentMusicSystem.PositionAndShape);const n=t.Measures[0],r=e.Measures[0];this.addConnector(n.getVFStave(),r.getVFStave(),s.default.Flow.StaveConnector.type.BRACKET,i)}draw(t){this.vexflowConnector.setContext(t).draw();const e=this.vexflowConnector,i=e.top_stave.getYForLine(0),n=e.bottom_stave.getYForLine(e.bottom_stave.getNumLines()-1)+e.thickness;this.PositionAndShape.AbsolutePosition.x=(e.top_stave.getX()-2+e.x_shift)/a.unitInPixels,this.PositionAndShape.AbsolutePosition.y=i/a.unitInPixels,this.PositionAndShape.Size.height=(n-i)/a.unitInPixels,this.PositionAndShape.Size.width=12/a.unitInPixels}addConnector(t,e,i,n){this.vexflowConnector=new s.default.Flow.StaveConnector(t,e).setType(i).setXShift(-5*n)}}e.VexFlowInstrumentBracket=l},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowVoiceEntry=void 0;const n=i(69),s=i(16),r=i(33);class o extends n.GraphicalVoiceEntry{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/s.unitInPixels,this.PositionAndShape.BorderTop=0,this.PositionAndShape.BorderBottom=e.h/s.unitInPixels,this.PositionAndShape.BorderLeft=-(i+t.width/2)/s.unitInPixels,this.PositionAndShape.BorderRight=(e.w-i)/s.unitInPixels}set vfStaveNote(t){this.mVexFlowStaveNote=t}get vfStaveNote(){return this.mVexFlowStaveNote}color(){var t;const e=this.rules.DefaultColorNotehead,i=this.rules.DefaultColorRest,n=this.rules.DefaultColorStem;let s,o;const a=this.vfStaveNote;for(let u=0;u=0;i--){const t=this.measureList[i][e];if(t)return t}}findGraphicalStaffEntryFromMeasureList(t,e,i){for(let n=e;n0)return i.staffEntries[0]}}getFirstVisibleMeasuresListFromIndices(t,e){const i=[],n=this.measureList[0].length;for(let s=t;s<=e;s++)for(let t=0;t=0;e--){if(this.verticalGraphicalStaffEntryContainers[e].AbsoluteTimestamp.lt(t)){const i=new s.VerticalGraphicalStaffEntryContainer(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=d.CollectionUtil.binarySearch(this.verticalGraphicalStaffEntryContainers,new s.VerticalGraphicalStaffEntryContainer(0,t),s.VerticalGraphicalStaffEntryContainer.compareByTimestamp,e);if(i>=0)return this.verticalGraphicalStaffEntryContainers[i]}GetInterpolatedIndexInVerticalContainers(t){const e=this.verticalGraphicalStaffEntryContainers;let i,n,s=0,r=e.length-1;if(t.lte(e[e.length-1].AbsoluteTimestamp)){for(;r-s>1;){const i=Math.floor((r+s)/2);if(e[s].AbsoluteTimestamp.Equals(t)){r=s;break}if(e[r].AbsoluteTimestamp.Equals(t)){s=r;break}if(e[i].AbsoluteTimestamp.Equals(t))return this.verticalGraphicalStaffEntryContainers.indexOf(e[i]);t.lt(e[i].AbsoluteTimestamp)?r=i:s=i}if(s===r)return this.verticalGraphicalStaffEntryContainers.indexOf(e[s]);i=e[s].AbsoluteTimestamp,n=e[r].AbsoluteTimestamp}else i=e[e.length-1].AbsoluteTimestamp,n=h.Fraction.plus(this.getLongestStaffEntryDuration(e.length-1),i),r=e.length;const o=n.RealValue-i.RealValue,a=r-(n.RealValue-t.RealValue)/o;return Math.min(a,this.verticalGraphicalStaffEntryContainers.length)}getVisibleStavesIndicesFromSourceMeasure(t){const e=[],i=[];for(let n=0,s=t.length;nvoid 0!==t.parentStaffEntry.relInMeasureTimestamp))}GetNearestNote(t,e){const i=this.GetNearestVoiceEntry(t);if(!i)return;let n,s=Number.MAX_SAFE_INTEGER;for(const r of i.notes){const e=r.PositionAndShape.AbsolutePosition.y,i=Math.abs(r.PositionAndShape.AbsolutePosition.x-t.x),o=Math.abs(e-t.y);i+on.PositionAndShape.RelativePosition.x&&(i=n):i=n)}}catch(n){u.default.info("GraphicalMusicSheet.getStaffEntry",n)}return i}GetPreviousVisibleContainerIndex(t){for(let e=t-1;e>=0;e--){const t=this.verticalGraphicalStaffEntryContainers[e].StaffEntries;for(let i=0,n=t.length;i=0;s--)if(i=this.getStaffEntry(s),i){if(!e)return i;if(i.sourceStaffEntry.ParentStaff.ParentInstrument.Visible)return i}}findClosestRightStaffEntry(t,e){let i;for(let n=Math.max(0,Math.ceil(t));ne.sourceNote.Pitch.getHalfTone()-t.sourceNote.Pitch.getHalfTone())),this.notes}sortForVexflow(){return this.notes.sort(((t,e)=>t.sourceNote.Pitch.getHalfTone()-e.sourceNote.Pitch.getHalfTone())),this.notes}color(){}}e.GraphicalVoiceEntry=o},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalInstantaneousTempoExpression=void 0;const n=i(42);class s extends n.AbstractGraphicalExpression{constructor(t,e){super(e.PositionAndShape.Parent.DataObject,t,t.parentMeasure),this.label=e}get GraphicalLabel(){return this.label}updateSkyBottomLine(){}}e.GraphicalInstantaneousTempoExpression=s},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalNote=void 0;const n=i(2),s=i(6),r=i(17),o=i(5);class a extends s.GraphicalObject{constructor(t,e,i,s){super(),this.DrawnAccidental=n.AccidentalEnum.NONE,this.sourceNote=t,this.parentVoiceEntry=e,this.PositionAndShape=new o.BoundingBox(this,e.PositionAndShape),this.graphicalNoteLength=s||t.Length,this.numberOfDots=this.calculateNumberOfNeededDots(this.graphicalNoteLength),this.rules=i,this.rules.addGraphicalNoteToNoteMap(t,this)}Transpose(t,e,i,n){let s=this.sourceNote.Pitch;return r.MusicSheetCalculator.transposeCalculator&&(s=r.MusicSheetCalculator.transposeCalculator.transposePitch(this.sourceNote.Pitch,t,i)),s}calculateNumberOfNeededDots(t){let e=1,i=2;const n=t.GetExpandedNumerator();if(!this.sourceNote||!this.sourceNote.NoteTuplet)for(;i0&&this.Voices[0].Visible}set Visible(t){for(let e=0,i=this.Voices.length;e2:(s.default.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 o.NORMAL;case"x":return o.X;case"slash":return o.SLASH;case"diamond":return o.DIAMOND;case"square":case"la":return o.SQUARE;case"do":case"triangle":return o.TRIANGLE;case"rectangle":return o.RECTANGLE;case"circle-x":return o.CIRCLEX;default:return s.default.info("unsupported/unhandled xml notehead '"+t+"'. Using normal notehead."),o.NORMAL}}}var o,a;e.Notehead=r,(a=o=e.NoteHeadShape||(e.NoteHeadShape={}))[a.CIRCLEX=0]="CIRCLEX",a[a.DIAMOND=1]="DIAMOND",a[a.NORMAL=2]="NORMAL",a[a.RECTANGLE=3]="RECTANGLE",a[a.SLASH=4]="SLASH",a[a.SQUARE=5]="SQUARE",a[a.TRIANGLE=6]="TRIANGLE",a[a.X=7]="X"},function(t,e,i){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.MusicSymbol=void 0,(n=e.MusicSymbol||(e.MusicSymbol={}))[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"},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.AlignmentManager=void 0;const n=i(57),s=i(4);e.AlignmentManager=class{constructor(t){this.parentStaffline=t,this.rules=this.parentStaffline.ParentMusicSystem.rules}alignDynamicExpressions(){var t,e;const i=[];let s=new Array;for(let n=0;n0){const t=r.map((t=>t.PositionAndShape.Center.y)),e=Math.max(...t);for(let i=0;i0?r[i-1]:void 0;if(t){const e=this.getOverlap(s.PositionAndShape,t.PositionAndShape);s.squeeze(-(e.x+this.rules.DynamicExpressionSpacer))}if(e){const t=this.getOverlap(e.PositionAndShape,s.PositionAndShape);s.squeeze(t.x+this.rules.DynamicExpressionSpacer)}}}}}getDistance(t,e){const i=t.RelativePosition.x+t.BorderMarginRight,n=e.RelativePosition.x+e.BorderMarginLeft,r=t.RelativePosition.y+t.BorderMarginBottom,o=e.RelativePosition.y+e.BorderMarginTop;return new s.PointF2D(n-i,o-r)}getOverlap(t,e){return new s.PointF2D(t.RelativePosition.x+t.BorderMarginRight-(e.RelativePosition.x+e.BorderMarginLeft),t.RelativePosition.y+t.BorderMarginBottom-(e.RelativePosition.y+e.BorderMarginTop))}}},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalInstantaneousDynamicExpression=void 0;const s=i(42),r=i(3),o=n(i(1));class a extends s.AbstractGraphicalExpression{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 n=0;switch(this.Placement){case r.PlacementEnum.Above:n=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginTop,t.updateSkyLineInRange(e,i,n);break;case r.PlacementEnum.Below:n=this.PositionAndShape.RelativePosition.y+this.PositionAndShape.BorderMarginBottom,t.updateBottomLineInRange(e,i,n);break;default:o.default.error("Placement for GraphicalInstantaneousDynamicExpression is unknown")}}}e.GraphicalInstantaneousDynamicExpression=a},function(t,e,i){var n,s;Object.defineProperty(e,"__esModule",{value:!0}),e.ArpeggioType=e.Arpeggio=void 0,e.Arpeggio=class{constructor(t,e=n.ARPEGGIO_DIRECTIONLESS){this.parentVoiceEntry=t,this.type=e,this.notes=[]}addNote(t){this.notes.push(t),t.Arpeggio=this}},(s=n=e.ArpeggioType||(e.ArpeggioType={}))[s.BRUSH_DOWN=1]="BRUSH_DOWN",s[s.BRUSH_UP=2]="BRUSH_UP",s[s.ROLL_DOWN=3]="ROLL_DOWN",s[s.ROLL_UP=4]="ROLL_UP",s[s.RASQUEDO_DOWN=5]="RASQUEDO_DOWN",s[s.RASQUEDO_UP=6]="RASQUEDO_UP",s[s.ARPEGGIO_DIRECTIONLESS=7]="ARPEGGIO_DIRECTIONLESS"},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.PartListEntry=void 0,e.PartListEntry=class{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]}}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var n=i(10),s=i(35),r=i(29),o=function(){function t(t){this.dictionary=new r.default(t)}return t.prototype.contains=function(t){return this.dictionary.containsKey(t)},t.prototype.add=function(t){return!this.contains(t)&&!n.isUndefined(t)&&(this.dictionary.setValue(t,t),!0)},t.prototype.intersection=function(t){var e=this;this.forEach((function(i){return t.contains(i)||e.remove(i),!0}))},t.prototype.union=function(t){var e=this;t.forEach((function(t){return e.add(t),!0}))},t.prototype.difference=function(t){var e=this;t.forEach((function(t){return e.remove(t),!0}))},t.prototype.isSubsetOf=function(t){if(this.size()>t.size())return!1;var e=!0;return this.forEach((function(i){return!!t.contains(i)||(e=!1,!1)})),e},t.prototype.remove=function(t){return!!this.contains(t)&&(this.dictionary.remove(t),!0)},t.prototype.forEach=function(t){this.dictionary.forEach((function(e,i){return t(i)}))},t.prototype.toArray=function(){return this.dictionary.values()},t.prototype.isEmpty=function(){return this.dictionary.isEmpty()},t.prototype.size=function(){return this.dictionary.size()},t.prototype.clear=function(){this.dictionary.clear()},t.prototype.toString=function(){return s.toString(this.toArray())},t}();e.default=o},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var n=i(10),s=i(84),r=function(){function t(t){this.root=null,this.compare=t||n.defaultCompare,this.nElements=0}return t.prototype.add=function(t){return!n.isUndefined(t)&&null!==this.insertNode(this.createNode(t))&&(this.nElements++,!0)},t.prototype.clear=function(){this.root=null,this.nElements=0},t.prototype.isEmpty=function(){return 0===this.nElements},t.prototype.size=function(){return this.nElements},t.prototype.contains=function(t){return!n.isUndefined(t)&&null!==this.searchNode(this.root,t)},t.prototype.search=function(t){var e=this.searchNode(this.root,t);if(null!==e)return e.element},t.prototype.remove=function(t){var e=this.searchNode(this.root,t);return null!==e&&(this.removeNode(e),this.nElements--,!0)},t.prototype.inorderTraversal=function(t){this.inorderTraversalAux(this.root,t,{stop:!1})},t.prototype.preorderTraversal=function(t){this.preorderTraversalAux(this.root,t,{stop:!1})},t.prototype.postorderTraversal=function(t){this.postorderTraversalAux(this.root,t,{stop:!1})},t.prototype.levelTraversal=function(t){this.levelTraversalAux(this.root,t)},t.prototype.minimum=function(){if(!this.isEmpty()&&null!==this.root)return this.minimumAux(this.root).element},t.prototype.maximum=function(){if(!this.isEmpty()&&null!==this.root)return this.maximumAux(this.root).element},t.prototype.forEach=function(t){this.inorderTraversal(t)},t.prototype.toArray=function(){var t=[];return this.inorderTraversal((function(e){return t.push(e),!0})),t},t.prototype.height=function(){return this.heightAux(this.root)},t.prototype.searchNode=function(t,e){for(var i=1;null!==t&&0!==i;)(i=this.compare(e,t.element))<0?t=t.leftCh:i>0&&(t=t.rightCh);return t},t.prototype.transplant=function(t,e){null===t.parent?this.root=e:t===t.parent.leftCh?t.parent.leftCh=e:t.parent.rightCh=e,null!==e&&(e.parent=t.parent)},t.prototype.removeNode=function(t){if(null===t.leftCh)this.transplant(t,t.rightCh);else if(null===t.rightCh)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}},t.prototype.inorderTraversalAux=function(t,e,i){null===t||i.stop||(this.inorderTraversalAux(t.leftCh,e,i),i.stop||(i.stop=!1===e(t.element),i.stop||this.inorderTraversalAux(t.rightCh,e,i)))},t.prototype.levelTraversalAux=function(t,e){var i=new s.default;for(null!==t&&i.enqueue(t),t=i.dequeue()||null;null!=t;){if(!1===e(t.element))return;null!==t.leftCh&&i.enqueue(t.leftCh),null!==t.rightCh&&i.enqueue(t.rightCh),t=i.dequeue()||null}},t.prototype.preorderTraversalAux=function(t,e,i){null===t||i.stop||(i.stop=!1===e(t.element),i.stop||(this.preorderTraversalAux(t.leftCh,e,i),i.stop||this.preorderTraversalAux(t.rightCh,e,i)))},t.prototype.postorderTraversalAux=function(t,e,i){null===t||i.stop||(this.postorderTraversalAux(t.leftCh,e,i),i.stop||(this.postorderTraversalAux(t.rightCh,e,i),i.stop||(i.stop=!1===e(t.element))))},t.prototype.minimumAux=function(t){for(;null!=t&&null!==t.leftCh;)t=t.leftCh;return t},t.prototype.maximumAux=function(t){for(;null!=t&&null!==t.rightCh;)t=t.rightCh;return t},t.prototype.heightAux=function(t){return null===t?-1:Math.max(this.heightAux(t.leftCh),this.heightAux(t.rightCh))+1},t.prototype.insertNode=function(t){for(var e=null,i=this.root;null!==i;){var n=this.compare(t.element,i.element);if(0===n)return null;n<0?(e=i,i=i.leftCh):(e=i,i=i.rightCh)}return t.parent=e,null===e?this.root=t:this.compare(t.element,e.element)<0?e.leftCh=t:e.rightCh=t,t},t.prototype.createNode=function(t){return{element:t,leftCh:null,rightCh:null,parent:null}},t}();e.default=r},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var n=i(53),s=function(){function t(){this.list=new n.default}return t.prototype.enqueue=function(t){return this.list.add(t)},t.prototype.add=function(t){return this.list.add(t)},t.prototype.dequeue=function(){if(0!==this.list.size()){var t=this.list.first();return this.list.removeElementAtIndex(0),t}},t.prototype.peek=function(){if(0!==this.list.size())return this.list.first()},t.prototype.size=function(){return this.list.size()},t.prototype.contains=function(t,e){return this.list.contains(t,e)},t.prototype.isEmpty=function(){return this.list.size()<=0},t.prototype.clear=function(){this.list.clear()},t.prototype.forEach=function(t){this.list.forEach(t)},t}();e.default=s},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0});var n=i(10),s=i(35),r=function(){function t(t){this.data=[],this.compare=t||n.defaultCompare}return t.prototype.leftChildIndex=function(t){return 2*t+1},t.prototype.rightChildIndex=function(t){return 2*t+2},t.prototype.parentIndex=function(t){return Math.floor((t-1)/2)},t.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},t.prototype.siftUp=function(t){for(var e=this.parentIndex(t);t>0&&this.compare(this.data[e],this.data[t])>0;)s.swap(this.data,e,t),t=e,e=this.parentIndex(t)},t.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;)s.swap(this.data,e,t),t=e,e=this.minIndex(this.leftChildIndex(t),this.rightChildIndex(t))},t.prototype.peek=function(){return this.data.length>0?this.data[0]:void 0},t.prototype.add=function(t){return!n.isUndefined(t)&&(this.data.push(t),this.siftUp(this.data.length-1),!0)},t.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}},t.prototype.contains=function(t){var e=n.compareToEquals(this.compare);return s.contains(this.data,t,e)},t.prototype.size=function(){return this.data.length},t.prototype.isEmpty=function(){return this.data.length<=0},t.prototype.clear=function(){this.data.length=0},t.prototype.forEach=function(t){s.forEach(this.data,t)},t}();e.default=r},function(t,e,i){var n,s=this&&this.__extends||(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])},function(t,e){function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0});var r=i(29),o=i(10),a=function(t){function e(e,i){var n=t.call(this,i)||this;return n.defaultFactoryFunction=e,n}return s(e,t),e.prototype.setDefault=function(e,i){var n=t.prototype.getValue.call(this,e);return o.isUndefined(n)?(this.setValue(e,i),i):n},e.prototype.getValue=function(t){return this.setDefault(t,this.defaultFactoryFunction())},e}(r.default);e.default=a},function(t,e,i){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.Fonts=void 0,(n=e.Fonts||(e.Fonts={}))[n.TimesNewRoman=0]="TimesNewRoman",n[n.Kokila=1]="Kokila"},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalUnknownExpression=void 0;const s=i(42),r=i(3),o=n(i(1));class a extends s.AbstractGraphicalExpression{constructor(t,e,i,n,s){super(t,new r.AbstractExpression(i),n),this.label=e,this.sourceMultiExpression=s}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 r.PlacementEnum.Above:const n=this.label.PositionAndShape.BorderMarginTop+this.label.PositionAndShape.RelativePosition.y;t.updateSkyLineInRange(e,i,n);break;case r.PlacementEnum.Below:const s=this.label.PositionAndShape.BorderMarginBottom+this.label.PositionAndShape.RelativePosition.y;t.updateBottomLineInRange(e,i,s);break;default:o.default.error("Placement for GraphicalUnknownExpression is unknown")}}}e.GraphicalUnknownExpression=a},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowMusicSheetCalculator=void 0;const s=i(17),r=i(90),o=i(128),a=i(63),l=n(i(8)),h=n(i(1)),c=i(16),u=i(129),d=i(130),f=i(97),p=i(93),m=i(9),b=i(131),g=i(57),y=i(37),S=i(25),v=i(100),x=i(39),E=i(13),_=i(102);class w extends s.MusicSheetCalculator{constructor(t){var e,i,n,o,h,c,u,d;super(),this.beamsNeedUpdate=!1,this.rules=t,s.MusicSheetCalculator.symbolFactory=new r.VexFlowGraphicalSymbolFactory,s.MusicSheetCalculator.TextMeasurer=new a.VexFlowTextMeasurer(this.rules),s.MusicSheetCalculator.stafflineNoteCalculator=new v.VexflowStafflineNoteCalculator(this.rules),"gonville"===(null===(e=this.rules.DefaultVexFlowNoteFont)||void 0===e?void 0:e.toLowerCase())?l.default.Flow.DEFAULT_FONT_STACK=[null===(i=l.default.Flow.Fonts)||void 0===i?void 0:i.Gonville,null===(n=l.default.Flow.Fonts)||void 0===n?void 0:n.Bravura,null===(o=l.default.Flow.Fonts)||void 0===o?void 0:o.Custom]:"petaluma"===(null===(h=this.rules.DefaultVexFlowNoteFont)||void 0===h?void 0:h.toLowerCase())&&(l.default.Flow.DEFAULT_FONT_STACK=[null===(c=l.default.Flow.Fonts)||void 0===c?void 0:c.Petaluma,null===(u=l.default.Flow.Fonts)||void 0===u?void 0:u.Gonville,null===(d=l.default.Flow.Fonts)||void 0===d?void 0:d.Bravura])}clearRecreatedObjects(){var t;super.clearRecreatedObjects(),s.MusicSheetCalculator.stafflineNoteCalculator=new v.VexflowStafflineNoteCalculator(this.rules);for(const e of this.graphicalMusicSheet.MeasureList)for(const i of e)null===(t=i)||void 0===t||t.clean()}formatMeasures(){for(const t of this.graphicalMusicSheet.MeasureList)if(t&&t[0]){t[0].format();for(const e of t){for(const t of e.staffEntries)t.calculateXPosition();e.finalizeBeams()}}this.beamsNeedUpdate=!1}calculateMeasureXLayout(t){const e=[];for(const s of t)s&&e.push(s);if(0===e.length)return 0;t=e;const i=[],n=new l.default.Flow.Formatter({softmaxFactor:this.rules.SoftmaxFactorVexFlow});let r=t[0].staffEntries.length,o=1;for(const s of t){if(!s)continue;let t=0;for(const i of s.staffEntries)t+=i.setMaxAccidentals();s.parentSourceMeasure.ImplicitMeasure&&(r=Math.max(s.staffEntries.length,r),o=Math.max(s.staffEntries.length+t,o));const e=s.vfVoices,a=[];for(const n in e)e.hasOwnProperty(n)&&(a.push(e[n]),i.push(e[n]));0!==a.length?n.joinVoices(a):h.default.debug("Found a measure with no voices. Continuing anyway.",e)}let a=12;const u=t[0].parentSourceMeasure;if(i.length>0){const e=.3;a=n.preCalculateMinTotalWidth(i)/c.unitInPixels*this.rules.VoiceSpacingMultiplierVexflow+this.rules.VoiceSpacingAddendVexflow+r*e,(null==u?void 0:u.ImplicitMeasure)&&(a=u.Duration.RealValue/u.ActiveTimeSignature.RealValue*a,r>1&&(a+=o*e*1.5),a*=this.rules.PickupMeasureWidthMultiplier),s.MusicSheetCalculator.setMeasuresMinStaffEntriesWidth(t,a);const l=(t,e)=>{n.formatToStave(i,e.getVFStave())},h=(t,e)=>{n.formatToStave(i,e.getVFStave(),{align_rests:!0,context:void 0})};for(const i of t){if(this.rules.AlignRests===S.AlignRestOption.Never)i.formatVoices=l;else if(this.rules.AlignRests===S.AlignRestOption.Always)i.formatVoices=h;else if(this.rules.AlignRests===S.AlignRestOption.Auto){let t=!1;for(const e of i.staffEntries){let i=0,n=0;for(const s of e.graphicalVoiceEntries)if(s.parentVoiceEntry.IsGrace||s&&s.notes&&s.notes[0]&&s.notes[0].sourceNote&&s.notes[0].sourceNote.PrintObject&&i++,s&&s.notes&&s.notes[0]&&s.notes[0].sourceNote&&s.notes[0].sourceNote.isRest()&&s.notes[0].sourceNote.PrintObject&&n++,i>1&&n>=1){t=!0;break}if(t)break}i.formatVoices=t?h:l}if(i===t[0]){const t=i;t.formatVoices(a*c.unitInPixels,t)}}}for(const s of t)if(s)for(const t of s.staffEntries)t.calculateXPosition();return a}calculateElongationFactor(t,e,i,n,s,r,o,a){let l=s,h=0;for(const c of t){const t=c.GraphicalLabel.Label.textAlignment;let d=o,f=a;if(c instanceof u.GraphicalLyricEntry&&c.ParentLyricWord){c.LyricsEntry.SyllableIndex>0&&(d=this.rules.BetweenSyllableMinimumDistance,m.TextAlignment.IsCenterAligned(t)&&(d+=1));const e=c.ParentLyricWord.GetLyricWord.Syllables;e.length>1&&c.LyricsEntry.SyllableIndex4&&(T*=1.1)}}else i[h]&&(T=y/S);_=Math.max(w,T),l=Math.max(l,_);let M=Math.max(y-S||0,0);i[h]&&(M+=i[h].cumulativeOverlap),i[h]={cumulativeOverlap:M,extend:c instanceof u.GraphicalLyricEntry&&c.LyricsEntry.extend,labelWidth:b,measureNumber:r,sourceNoteDuration:c instanceof u.GraphicalLyricEntry&&c.LyricsEntry&&c.LyricsEntry.Parent.Notes[0].Length,text:c instanceof u.GraphicalLyricEntry?c.LyricsEntry.Text:c.GraphicalLabel.Label.text,xPosition:g},h++}return l}calculateElongationFactorFromStaffEntries(t,e,i,n){let s=i;const r={},o={};for(const a of t)a.LyricsEntries.length>0&&(s=this.calculateElongationFactor(a.LyricsEntries,a,r,e,s,n,this.rules.HorizontalBetweenLyricsDistance,this.rules.LyricOverlapAllowedIntoNextMeasure)),a.graphicalChordContainers.length>0&&(s=this.calculateElongationFactor(a.graphicalChordContainers,a,o,e,s,n,this.rules.ChordSymbolXSpacing,this.rules.ChordOverlapAllowedIntoNextMeasure));return s}calculateMeasureWidthFromStaffEntries(t,e){let i=1;for(const n of t)n&&0!==n.staffEntries.length&&(i=this.calculateElongationFactorFromStaffEntries(n.staffEntries,e,i,n.MeasureNumber));return i=Math.min(i,this.rules.MaximumLyricsElongationFactor),e*i}createGraphicalTie(t,e,i,n,s){return new o.GraphicalTie(t,n,s)}updateStaffLineBorders(t){t.SkyBottomLineCalculator.updateStaffLineBorders()}graphicalMeasureCreatedCalculations(t){t.rules=this.rules,t.graphicalMeasureCreatedCalculations()}layoutVoiceEntry(t,e,i,n){for(let r=0;r=2&&(r=n.vfnote[0],o=n.vfnote[1]);let a,h=0;if(s&&s.vfnote&&s.vfnote.length>=2&&(a=s.vfnote[0],h=s.vfnote[1]),e){if(r){const t=new l.default.Flow.StaveTie({first_indices:[o],first_note:r});n.parentVoiceEntry.parentStaffEntry.parentMeasure.vfTies.push(t)}if(a){const t=new l.default.Flow.StaveTie({last_indices:[h],last_note:a});s.parentVoiceEntry.parentStaffEntry.parentMeasure.vfTies.push(t)}}else if(r||a){let e;if(i)if("S"===t.Tie.Type){const i=t.StartNote.sourceNote,n=t.EndNote.sourceNote;let s=1;i.FretNumber>n.FretNumber&&(s=-1),e=new l.default.Flow.TabSlide({first_indices:[o],first_note:r,last_indices:[h],last_note:a},s)}else e=new l.default.Flow.TabTie({first_indices:[o],first_note:r,last_indices:[h],last_note:a},t.Tie.Type);else e=new l.default.Flow.StaveTie({first_indices:[o],first_note:r,last_indices:[h],last_note:a});s.parentVoiceEntry.parentStaffEntry.parentMeasure.vfTies.push(e)}}calculateDynamicExpressionsForMultiExpression(t,e,i){if(ethis.rules.MaxMeasureToDrawIndex)return;const n=t.AbsoluteTimestamp,s=this.graphicalMusicSheet.MeasureList[e],r=s[i].ParentStaffLine,o=s[i],a=this.getRelativePositionInStaffLineFromTimestamp(n,i,r,null==r?void 0:r.isPartOfMultiStaffInstrument()),l=a;if(a.x<=0&&(l.x=o.beginInstructionsWidth+this.rules.RhythmRightMargin),t.InstantaneousDynamic){const e=new p.VexFlowInstantaneousDynamicExpression(t.InstantaneousDynamic,r,o);this.calculateGraphicalInstantaneousDynamicExpression(e,l)}if(t.StartingContinuousDynamic){const e=t.StartingContinuousDynamic,i=new g.VexFlowContinuousDynamicExpression(t.StartingContinuousDynamic,r,o.parentSourceMeasure);if(i.StartMeasure=o,!i.IsVerbal&&e.EndMultiExpression)try{this.calculateGraphicalContinuousDynamic(i,l)}catch(c){}else i.IsVerbal?this.calculateGraphicalVerbalContinuousDynamic(i,l):h.default.warn("This continuous dynamic is not covered")}}createMetronomeMark(t){var e;const i=Math.max(t.ParentMultiTempoExpression.SourceMeasureParent.MeasureNumber-1,0),n=Math.max(t.StaffNumber-1,0),s=0===i&&0===n,r=this.graphicalMusicSheet.MeasureList[i][n].getVFStave();let o="q";if(t.beatUnit){const e=x.NoteTypeHandler.getNoteDurationFromType(t.beatUnit);o=E.VexFlowConverter.duration(e,!1)}let a=this.rules.MetronomeMarkYShift,l=!1;for(const c of t.parentMeasure.TempoExpressions){const t=(null===(e=c.InstantaneousTempo)||void 0===e?void 0:e.Enum)===y.TempoEnum.metronomeMark;if(c.getPlacementOfFirstEntry()===_.PlacementEnum.Above&&!t){l=!0;break}}l&&(a-=1.4);const h=this.graphicalMusicSheet.MeasureList[0][0].ParentStaffLine.SkyLine;r.setTempo({bpm:t.TempoInBpm,dots:t.dotted,duration:o},a*c.unitInPixels);const u=s?this.rules.MetronomeMarkXShift*c.unitInPixels:0;r.getModifiers()[r.getModifiers().length-1].setShiftX(u),h[0]=Math.min(h[0],-4.5+a)}calculateRehearsalMark(t){const e=t.rehearsalExpression;if(!e)return;const i=Math.max(t.MeasureNumber-1,0),n=this.graphicalMusicSheet.MeasureList[i][0].getVFStave(),s=-this.rules.RehearsalMarkYOffsetDefault-this.rules.RehearsalMarkYOffset;let r=this.rules.RehearsalMarkXOffsetDefault+this.rules.RehearsalMarkXOffset;t.IsSystemStartMeasure&&(r+=this.rules.RehearsalMarkXOffsetSystemStartMeasure);const o=this.rules.RehearsalMarkFontSize;n.setSection(e.label,s,r,o)}calculateSingleOctaveShift(t,e,i,n){var s;const r=e.OctaveShiftStart,o=r.ParentStartMultiExpression.Timestamp,a=null===(s=r.ParentEndMultiExpression)||void 0===s?void 0:s.Timestamp,l=this.rules.MinMeasureToDrawIndex,c=this.rules.MaxMeasureToDrawIndex;let u,d,p=this.graphicalMusicSheet.MeasureList[i][n].ParentStaffLine;if(p||(p=this.graphicalMusicSheet.MeasureList[l][n].ParentStaffLine),u=r.ParentEndMultiExpression?this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(r.ParentEndMultiExpression.SourceMeasureParent,n):this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(n,!0),u.MeasureNumber>c+1&&(u=this.graphicalMusicSheet.getLastGraphicalMeasureFromIndex(n,!0)),d=r.ParentEndMultiExpression?this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(r.ParentStartMultiExpression.SourceMeasureParent,n):this.graphicalMusicSheet.MeasureList[l][n],d.MeasureNumberc+1||u.MeasureNumberc+1)return;let m=u.ParentStaffLine;if(m||(m=p),u&&p&&m){const t=new f.VexFlowOctaveShift(r,p.PositionAndShape);if(!t.startNote){let e;for(const t of d.staffEntries)if(t){e=t;break}if(!e)return;if(t.setStartNote(e),!t.startNote)return}if(!t.endNote){let e;for(let t=u.staffEntries.length-1;t>=0;t++)if(u.staffEntries[t]){e=u.staffEntries[t];break}if(t.setEndNote(e),!t.endNote)return}let e=d.findGraphicalStaffEntryFromTimestamp(o);e||(e=d.staffEntries[0]);let i=u.findGraphicalStaffEntryFromTimestamp(a);if(i||(i=u.staffEntries[u.staffEntries.length-1]),t.setStartNote(e),m!==p){t.endsOnDifferentStaffLine=!0;let s=p.Measures[p.Measures.length-1];void 0===s&&(s=u);const o=s.staffEntries[s.staffEntries.length-1];t.setEndNote(o);const a=m.ParentMusicSystem.Id-p.ParentMusicSystem.Id;if(a>0)for(let t=p.ParentMusicSystem.Id;t{t.updateSkyBottomLine()}))}catch(t){}}handleTiedGraphicalNote(t,e,i,n,s,r,o,a){}handleBeam(t,e,i){t.parentVoiceEntry.parentStaffEntry.parentMeasure.handleBeam(t,e)}handleVoiceEntryLyrics(t,e,i){t.LyricsEntries.forEach(((t,n)=>{const s=new u.GraphicalLyricEntry(n,e,this.rules.LyricsHeight,this.rules.StaffHeight);if(e.LyricsEntries.push(s),s.GraphicalLabel.setLabelPositionAndShapeBorders(),n.Word){const t=n.Word.Syllables.indexOf(n);let e=i.indexOf(n.Word);if(-1===e&&(i.push(n.Word),e=i.indexOf(n.Word)),0===this.graphicalLyricWords.length||e>this.graphicalLyricWords.length-1){const e=new d.GraphicalLyricWord(n.Word);s.ParentLyricWord=e,e.GraphicalLyricsEntries[t]=s,this.graphicalLyricWords.push(e)}else{const n=this.graphicalLyricWords[e];s.ParentLyricWord=n,n.GraphicalLyricsEntries[t]=s,n.isFilled()&&(i.splice(e,1),this.graphicalLyricWords.splice(this.graphicalLyricWords.indexOf(n),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=0){const t=e[i];-1===t.staffEntries.indexOf(n)&&t.staffEntries.push(n),e.splice(i,1)}}}for(const t of e)-1===t.staffEntries.indexOf(n)&&t.staffEntries.push(n)}}for(const e of this.musicSystems)for(const t of e.StaffLines){const e=t.GraphicalSlurs.sort(b.GraphicalSlur.Compare);for(const t of e)t.slur.isCrossed()||t.calculateCurve(this.rules)}}}e.VexFlowMusicSheetCalculator=w},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowGraphicalSymbolFactory=void 0;const s=n(i(8)),r=i(91),o=i(44),a=i(98),l=i(30),h=i(60),c=i(127),u=i(62),d=i(13),f=i(101),p=i(99),m=i(96);e.VexFlowGraphicalSymbolFactory=class{createMusicSystem(t,e){return new r.VexFlowMusicSystem(t,e)}createStaffLine(t,e){return new p.VexFlowStaffLine(t,e)}createGraphicalMeasure(t,e,i=!1){return new o.VexFlowMeasure(e,t,void 0)}createMultiRestMeasure(t,e,i){return new m.VexFlowMultiRestMeasure(e,t,i)}createTabStaffMeasure(t,e){return new f.VexFlowTabMeasure(e,t)}createExtraGraphicalMeasure(t){return new o.VexFlowMeasure(t.ParentStaff,void 0,t)}createStaffEntry(t,e){return new a.VexFlowStaffEntry(e,t,void 0)}createVoiceEntry(t,e){return new u.VexFlowVoiceEntry(t,e)}createNote(t,e,i,n=l.OctaveEnum.NONE,s,r){return new h.VexFlowGraphicalNote(t,e,i,n,s,r)}createGraceNote(t,e,i,n,s=l.OctaveEnum.NONE){return new h.VexFlowGraphicalNote(t,e,i,s,n)}addGraphicalAccidental(t,e){t.setAccidental(e)}addFermataAtTiedEndNote(t,e){}createInStaffClef(t,e){const i=t,n=d.VexFlowConverter.Clef(e,"small");i.vfClefBefore=new s.default.Flow.ClefNote(n.type,n.size,n.annotation)}createChordSymbols(t,e,i,n){const s=e.parentMeasure.parentSourceMeasure.Rules;let r=0;const o=s.ChordSymbolXSpacing;for(const a of t.ChordContainers){const t=new c.GraphicalChordSymbolContainer(a,e.PositionAndShape,s.ChordSymbolTextHeight,i,n,e.parentMeasure.parentSourceMeasure.Rules),l=t.GraphicalLabel;l.PositionAndShape.RelativePosition.y-=s.ChordSymbolYOffset,l.PositionAndShape.RelativePosition.x+=r,l.setLabelPositionAndShapeBorders(),t.PositionAndShape.calculateBoundingBox(),e.graphicalChordContainers.push(t),r+=l.PositionAndShape.Size.width+o}}createGraphicalTechnicalInstruction(t,e){}}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowMusicSystem=void 0;const n=i(117),s=i(75),r=i(13),o=i(61),a=i(95);class l extends n.MusicSystem{constructor(t,e){super(t),this.rules=e}calculateBorders(t){if(0===this.staffLines.length)return;const e=this.calcBracketsWidth();this.boundingBox.BorderLeft=-e,this.boundingBox.BorderMarginLeft=-e,this.boundingBox.XBordersHaveBeenSet=!0;const i=this.staffLines[0].SkyBottomLineCalculator.getSkyLineMin();this.boundingBox.BorderTop=i,this.boundingBox.BorderMarginTop=i;const n=this.staffLines[this.staffLines.length-1],s=n.SkyBottomLineCalculator.getBottomLineMax()+n.PositionAndShape.RelativePosition.y;this.boundingBox.BorderBottom=s,this.boundingBox.BorderMarginBottom=s,this.boundingBox.XBordersHaveBeenSet=!0,this.boundingBox.YBordersHaveBeenSet=!0}createSystemLine(t,e,i,n,o,a,l){const h=a;let c=!1;return l&&(c=!0,l.lineTo(a,r.VexFlowConverter.line(i,n)),l.addMeasureLine(i,n)),h&&h.addMeasureLine(i,n,c),new s.SystemLine(i,n,this,a,l)}createInstrumentBracket(t,e){const i=t,n=e,s=new a.VexFlowInstrumentBrace(i,n);this.InstrumentBrackets.push(s)}createGroupBracket(t,e,i){const n=t,s=e;if(0===i){const t=new o.VexFlowInstrumentBracket(n,s,i);this.GroupBrackets.push(t)}else{const t=new a.VexFlowInstrumentBrace(n,s,i);this.GroupBrackets.push(t)}}}e.VexFlowMusicSystem=l},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.SvgVexFlowBackend=void 0;const s=n(i(8)),r=i(59),o=i(13),a=i(21),l=i(25),h=n(i(1));class c extends r.VexFlowBackend{constructor(t){super(),this.rules=t}getVexflowBackendType(){return s.default.Flow.Renderer.Backends.SVG}getOSMDBackendType(){return l.BackendType.SVG}getCanvasSize(){var t;return null===(t=document.getElementById("osmdCanvasPage"+this.graphicalMusicPage.PageNumber))||void 0===t?void 0:t.offsetHeight}initialize(t,e){this.zoom=e,this.canvas=document.createElement("div"),this.canvas.id="osmdCanvasPage"+this.graphicalMusicPage.PageNumber,this.inner=this.canvas,this.inner.style.position="relative",this.canvas.style.zIndex="0",t.appendChild(this.inner),this.renderer=new s.default.Flow.Renderer(this.canvas,this.getVexflowBackendType()),this.ctx=this.renderer.getContext(),this.ctx.svg.id="osmdSvgPage"+this.graphicalMusicPage.PageNumber}getContext(){return this.ctx}getSvgElement(){return this.ctx.svg}removeNode(t){var e;const i=null===(e=this.ctx)||void 0===e?void 0:e.svg;if(!i)return!1;try{i.removeChild(t)}catch(n){return h.default.error(n),!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.save(),this.ctx.setFillStyle(this.rules.PageBackgroundColor),this.ctx.setStrokeStyle("#12345600"),this.ctx.fillRect(0,0,this.canvas.offsetWidth/this.zoom,this.canvas.offsetHeight/this.zoom),this.ctx.restore())}scale(t){this.ctx.scale(t,t)}translate(t,e){}renderText(t,e,i,n,s,r,l,h){this.ctx.save();const c=this.ctx.openGroup();l&&(this.ctx.attributes.fill=l,this.ctx.attributes.stroke=l);let u=h;h&&"default"!==h||(u=this.rules.DefaultFontFamily),this.ctx.setFont(u,t,o.VexFlowConverter.fontStyle(e)),this.ctx.attributes["font-size"]=`${t}px`,this.ctx.state["font-size"]=`${t}px`;let d="normal",f="normal";switch(e){case a.FontStyles.Bold:d="bold";break;case a.FontStyles.Italic:f="italic";break;case a.FontStyles.BoldItalic:d="bold",f="italic";break;default:d="normal"}return this.ctx.attributes["font-weight"]=d,this.ctx.state["font-weight"]=d,this.ctx.attributes["font-style"]=f,this.ctx.state["font-style"]=f,this.ctx.fillText(n,r.x,r.y+s),this.ctx.closeGroup(),this.ctx.restore(),c}renderRectangle(t,e,i,n=1){this.ctx.save();const s=this.ctx.openGroup();return this.ctx.attributes.fill=i||o.VexFlowConverter.style(e),this.ctx.attributes["fill-opacity"]=n,this.ctx.fillRect(t.x,t.y,t.width,t.height),this.ctx.restore(),this.ctx.attributes["fill-opacity"]=1,this.ctx.closeGroup(),s}renderLine(t,e,i="#FF0000FF",n=2){this.ctx.save();const s=this.ctx.openGroup();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=n,this.ctx.stroke(),this.ctx.closeGroup(),this.ctx.restore(),s}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()}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 n=(new XMLSerializer).serializeToString(i),s=document.createElement("a");s.href="data:image/svg+xml; charset=utf8, "+encodeURIComponent(n.replace(/>\n\r<")),s.download="opensheetmusicdisplay_download.svg",s.innerHTML=window.location.href+"/download",document.body.appendChild(s)}}e.SvgVexFlowBackend=c},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowInstantaneousDynamicExpression=void 0;const n=i(79),s=i(38),r=i(24),o=i(12),a=i(9),l=i(21);class h extends n.GraphicalInstantaneousDynamicExpression{constructor(t,e,i){super(t,e,i);const n=new o.Label(this.Expression);this.label=new r.GraphicalLabel(n,this.rules.ContinuousDynamicTextHeight,a.TextAlignmentEnum.CenterCenter,this.rules,this.PositionAndShape),this.label.Label.fontStyle=l.FontStyles.BoldItalic,this.label.setLabelPositionAndShapeBorders(),this.PositionAndShape.calculateBoundingBox()}get InstantaneousDynamic(){return this.mInstantaneousDynamicExpression}get Expression(){return s.DynamicEnum[this.mInstantaneousDynamicExpression.DynEnum]}}e.VexFlowInstantaneousDynamicExpression=h},function(t,e,i){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.DynamicExpressionSymbolEnum=void 0,(n=e.DynamicExpressionSymbolEnum||(e.DynamicExpressionSymbolEnum={}))[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"},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowInstrumentBrace=void 0;const s=n(i(8)),r=i(61);class o extends r.VexFlowInstrumentBracket{constructor(t,e,i=0){super(t,e,i),this.vexflowConnector.setType(s.default.Flow.StaveConnector.type.BRACE)}}e.VexFlowInstrumentBrace=o},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowMultiRestMeasure=void 0;const s=n(i(8)),r=i(44);class o extends r.VexFlowMeasure{constructor(t,e,i){super(t,e,i),this.minimumStaffEntriesWidth=-1,i?this.rules=i.ParentMusicSystem.rules:e&&(this.rules=e.Rules),this.resetLayout(),this.multiRestElement=new s.default.Flow.MultiMeasureRest(e.multipleRestMeasures,{})}draw(t){this.stave.setContext(t).draw(),this.multiRestElement.setStave(this.stave),this.multiRestElement.setContext(t),this.multiRestElement.draw();for(const e of this.connectors)e.setContext(t).draw()}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}}e.VexFlowMultiRestMeasure=o},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowOctaveShift=void 0;const s=n(i(8)),r=i(123),o=i(30),a=n(i(1));class l extends r.GraphicalOctaveShift{constructor(t,e){switch(super(t,e),t.Type){case o.OctaveEnum.VA8:this.position=s.default.Flow.TextBracket.Positions.TOP,this.supscript="va",this.text="8";break;case o.OctaveEnum.MA15:this.position=s.default.Flow.TextBracket.Positions.TOP,this.supscript="ma",this.text="15";break;case o.OctaveEnum.VB8:this.position=s.default.Flow.TextBracket.Positions.BOTTOM,this.supscript="vb",this.text="8";break;case o.OctaveEnum.MB15:this.position=s.default.Flow.TextBracket.Positions.BOTTOM,this.supscript="mb",this.text="15";break;default:a.default.error("Unknown or NONE octaveshift. This should not be called!")}}setStartNote(t){for(const e of t.graphicalVoiceEntries){const t=e;if(null==t?void 0:t.vfStaveNote)return this.startNote=t.vfStaveNote,!0}return!1}setEndNote(t){for(const e of t.graphicalVoiceEntries){const t=e;if(null==t?void 0:t.vfStaveNote)return this.endNote=t.vfStaveNote,!0}return!1}getTextBracket(){return new s.default.Flow.TextBracket({position:this.position,start:this.startNote,stop:this.endNote,superscript:this.supscript,text:this.text})}}e.VexFlowOctaveShift=l},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowStaffEntry=void 0;const n=i(124),s=i(16),r=i(2);class o extends n.GraphicalStaffEntry{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),!i.vfStaveNote.preFormatted)continue;i.applyBordersFromVexflow(),this.parentMeasure.ParentStaff.isTab?this.PositionAndShape.RelativePosition.x=(i.vfStaveNote.getAbsoluteX()+i.vfStaveNote.glyph.getWidth())/s.unitInPixels:this.PositionAndShape.RelativePosition.x=i.vfStaveNote.getBoundingBox().getX()/s.unitInPixels;const n=i.notes[0].sourceNote;n.isRest()&&n.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.BorderLeftt.staffLine)),i=this.calculateModifierXOffsets(e,1),n=this.calculateModifierXOffsets(e,.5);t.forEach(((t,e)=>{t.baseFingeringXOffset=n[e],t.baseStringNumberXOffset=i[e]}))}calculateModifierXOffsets(t,e){const i=[];for(let n=0;n=0;o--){if(Math.abs(t[n]-t[o])<=e&&s===i[o]){s++,r=!0;break}r=!1}i.push(s)}return i}}e.VexFlowStaffEntry=o},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowStaffLine=void 0;const n=i(125),s=i(78);class r extends n.StaffLine{constructor(t,e){super(t,e),this.slursInVFStaffLine=[],this.alignmentManager=new s.AlignmentManager(this)}get SlursInVFStaffLine(){return this.slursInVFStaffLine}addVFSlurToVFStaffline(t){this.slursInVFStaffLine.push(t)}get AlignmentManager(){return this.alignmentManager}}e.VexFlowStaffLine=r},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.VexflowStafflineNoteCalculator=void 0;const n=i(2),s=i(60),r=i(15),o=i(7),a=i(14);class l{constructor(t){this.staffPitchListMapping=new r.Dictionary,this.baseLineNote=n.NoteEnum.B,this.baseLineOctave=1,this.rules=t}trackNote(t){if(!(t instanceof s.VexFlowGraphicalNote)||t.Clef().ClefType!==o.ClefEnum.percussion||t.sourceNote.isRest()||0===this.rules.PercussionOneLineCutoff||-1===this.rules.PercussionForceVoicesOneLineCutoff)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 n=t.sourceNote.Pitch;l.findOrInsert(i,n)}static PitchIndexOf(t,e,i=0){if(i>t.length-1)return-1;for(let n=i;nthis.rules.PercussionOneLineCutoff&&!o)return t;const h=t,c=t.sourceNote.Pitch;let u=this.baseLineNote,d=this.baseLineOctave;if(this.rules.PercussionOneLineUseXMLDisplayStep&&void 0!==t.sourceNote.displayStepUnpitched&&r&&(u=t.sourceNote.displayStepUnpitched,d=t.sourceNote.displayOctaveUnpitched+this.rules.PercussionOneLineXMLDisplayStepOctaveOffset),i.length<=this.rules.PercussionForceVoicesOneLineCutoff)h.setAccidental(new n.Pitch(u,d,c.Accidental));else{const t=l.PitchIndexOf(i,c);if(t>-1){const e=Math.ceil(i.length/2);if(!this.rules.PercussionOneLineUseXMLDisplayStep)if(t>=e)switch(d=2,(t-e)%5){case 1:u=n.NoteEnum.E;break;case 2:u=n.NoteEnum.G;break;case 3:u=n.NoteEnum.B;break;case 4:u=n.NoteEnum.D,d=3;break;default:u=n.NoteEnum.C}else switch(t%5){case 1:u=n.NoteEnum.F;break;case 2:u=n.NoteEnum.D;break;case 3:u=n.NoteEnum.B,d=0;break;case 4:u=n.NoteEnum.G,d=0;break;default:u=n.NoteEnum.A}const s=new n.Pitch(u,d,c.Accidental);h.setAccidental(s);const r=h.parentVoiceEntry.parentVoiceEntry;!this.rules.SetWantedStemDirectionByXml&&r.Notes.length<2&&(s.Octave>this.baseLineOctave||s.FundamentalNote===this.baseLineNote&&s.Octave===this.baseLineOctave?h.parentVoiceEntry.parentVoiceEntry.WantedStemDirection=a.StemDirectionType.Up:h.parentVoiceEntry.parentVoiceEntry.WantedStemDirection=a.StemDirectionType.Down)}}return h}getStafflineUniquePositionCount(t){return this.staffPitchListMapping.containsKey(t)?this.staffPitchListMapping.getValue(t).length:0}}e.VexflowStafflineNoteCalculator=l},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VexFlowTabMeasure=void 0;const s=n(i(8)),r=i(44),o=i(13),a=n(i(1));class l extends r.VexFlowMeasure{constructor(t,e,i){super(t,e,i),this.isTabMeasure=!0}resetLayout(){this.stave=new s.default.Flow.TabStave(0,0,0,{space_above_staff_ln:0,space_below_staff_ln:0}),this.updateInstructionWidth()}graphicalMeasureCreatedCalculations(){for(let e=0,i=this.staffEntries.length;e1){const i=o.VexFlowConverter.StrokeTypeFromArpeggioType(e.type),n=new s.default.Flow.Stroke(i,{all_voices:this.rules.ArpeggiosGoAcrossVoices});this.rules.RenderArpeggios&&t.vfStaveNote.addStroke(0,n)}else a.default.debug(`[OSMD] arpeggio in measure ${this.MeasureNumber} could not be drawn.\n voice entry had less than two notes, arpeggio is likely between voice entries, not currently supported in Vexflow.`)}this.vfVoices[e.VoiceId].addTickable(t.vfStaveNote)}else this.vfVoices[e.VoiceId].addTickable(t.vfStaveNote)}}}}e.VexFlowTabMeasure=l},function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[i]}})}:function(t,e,i,n){void 0===n&&(n=i),t[n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||e.hasOwnProperty(i)||n(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),s(i(3),e),s(i(55),e),s(i(94),e),s(i(38),e),s(i(37),e),s(i(64),e),s(i(103),e),s(i(104),e),s(i(105),e),s(i(65),e)},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.MultiExpressionEntry=e.MultiExpression=void 0;const n=i(0),s=i(38),r=i(32),o=i(64),a=i(65),l=i(3),h=i(21);e.MultiExpression=class{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 n.Fraction.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=l.PlacementEnum.Above;return this.expressions.length>0&&(this.expressions[0].expression instanceof s.InstantaneousDynamicExpression||this.expressions[0].expression instanceof r.ContinuousDynamicExpression||this.expressions[0].expression instanceof o.MoodExpression||this.expressions[0].expression instanceof a.UnknownExpression)&&(t=this.expressions[0].expression.Placement),t}getFontstyleOfFirstEntry(){var t;let e=h.FontStyles.Regular;return this.expressions.length>0&&(this.expressions[0].expression instanceof r.ContinuousDynamicExpression||this.expressions[0].expression instanceof o.MoodExpression?e=h.FontStyles.Italic:this.expressions[0].expression instanceof a.UnknownExpression&&(e=null!==(t=this.expressions[0].expression.fontStyle)&&void 0!==t?t:h.FontStyles.Regular)),e}addExpression(t,e){t instanceof s.InstantaneousDynamicExpression?(this.instantaneousDynamic&&this.removeExpressionFromEntryList(this.InstantaneousDynamic),this.instantaneousDynamic=t,this.instantaneousDynamic.ParentMultiExpression=this):t instanceof r.ContinuousDynamicExpression?this.startingContinuousDynamic=t:t instanceof o.MoodExpression?this.moodList.push(t):t instanceof a.UnknownExpression&&this.unknownList.push(t),this.addExpressionToEntryList(t,e)}CompareTo(t){return this.Timestamp.RealValue>t.Timestamp.RealValue?1:this.Timestamp.RealValue0&&(this.expressions[0].Expression instanceof s.InstantaneousTempoExpression||this.expressions[0].Expression instanceof a.ContinuousTempoExpression)&&(t=this.expressions[0].Expression.Placement),t}getFontstyleOfFirstEntry(){let t=o.FontStyles.Regular;return this.expressions[0].Expression instanceof s.InstantaneousTempoExpression?t=o.FontStyles.Bold:this.expressions[0].Expression instanceof a.ContinuousTempoExpression&&(t=o.FontStyles.Italic),t}addExpression(t,e){if(this.checkIfAlreadyExists(t))return;t instanceof s.InstantaneousTempoExpression?this.instantaneousTempo=t:t instanceof a.ContinuousTempoExpression&&(this.continuousTempo=t);const i=new l;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.RealValue1)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 n,o;for(const s of this.verticalSourceStaffEntryContainers)if(s.Timestamp.Equals(t)){n=s;break}if(n)return n.StaffEntries[e]?o=n.StaffEntries[e]:(o=new r.SourceStaffEntry(n,i),n.StaffEntries[e]=o),{createdNewContainer:!1,staffEntry:o};const a=this.verticalSourceStaffEntryContainers[this.verticalSourceStaffEntryContainers.length-1];if(0===this.verticalSourceStaffEntryContainers.length||a.Timestamp.lt(t)){const n=new s.VerticalSourceStaffEntryContainer(this,t.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.push(n),o=new r.SourceStaffEntry(n,i),n.StaffEntries[e]=o}else for(let l=this.verticalSourceStaffEntryContainers.length-1;l>=0;l--){if(this.verticalSourceStaffEntryContainers[l].Timestamp.lt(t)){const n=new s.VerticalSourceStaffEntryContainer(this,t.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(l+1,0,n),o=new r.SourceStaffEntry(n,i),n.StaffEntries[e]=o;break}if(0===l){const n=new s.VerticalSourceStaffEntryContainer(this,t.clone(),this.completeNumberOfStaves);this.verticalSourceStaffEntryContainers.splice(l,0,n),o=new r.SourceStaffEntry(n,i),n.StaffEntries[e]=o;break}}return{createdNewContainer:!0,staffEntry:o}}findOrCreateVoiceEntry(t,e){let i,n=!1;for(const s of t.VoiceEntries)if(s.ParentVoice===e){i=s;break}return i||(i=new a.VoiceEntry(t.Timestamp,e,t),n=!0),{createdVoiceEntry:n,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=0;r--){const t=this.verticalSourceStaffEntryContainers[r][i+s];if(void 0!==t&&t.hasTie()&&e.lt(n.Fraction.plus(t.Timestamp,t.calculateMaxNoteLength()))){e=n.Fraction.plus(t.Timestamp,t.calculateMaxNoteLength());break}}}s.push(e)}for(let n=0,r=s.length;n0)return!0}return!1}beginsWithLineRepetition(){for(let t=0,e=this.FirstRepetitionInstructions.length;t=0&&(e=this.verticalSourceStaffEntryContainers[i].StaffEntries[t],!e);i--);return e}canBeReducedToMultiRest(){var t,e;if(!this.allRests||this.hasLyrics||this.hasMoodExpressions||this.tempoExpressions.length>0)return!1;for(const i of this.staffLinkedExpressions)if(i.length>0)return!1;for(const i of this.lastInstructionsStaffEntries)for(let t=0,e=null==i?void 0:i.Instructions.length;ti.load(t)),(t=>{throw m.default.debug(t),new Error("OpenSheetMusicDisplay: Invalid MXL file")}));if(""===e.substr(0,3))return m.default.debug("[OSMD] UTF with BOM detected, truncate first three bytes and pass along: "+e),i.load(e.substr(3));let n=e;if(/^\s/.test(n)&&(n=n.trim()),n.substr(0,6).includes("i.load(t)),(t=>{throw t}));console.error("[OSMD] osmd.load(string): Could not process string. Did not find this.rules.MaxPageToDrawNumber)break;const n=this.createBackend(this.backendType,i),s=" exceeds CanvasBackend limit of 32767. Cutting off score.";n.getOSMDBackendType()===g.BackendType.Canvas&&e>32767&&(m.default.warn("[OSMD] Warning: width of "+e+s),e=32767),this.rules.PageFormat&&!this.rules.PageFormat.IsUndefined?t=e/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*=10*this.zoom),n.getOSMDBackendType()===g.BackendType.Canvas&&t>32767&&(m.default.warn("[OSMD] Warning: height of "+t+s),t=Math.min(t,32767)),n.resize(e,t),n.clear(),this.drawer.Backends.push(n),this.graphic.drawer=this.drawer}}exportSVG(){var t;for(const e of null===(t=this.drawer)||void 0===t?void 0:t.Backends)e instanceof c.SvgVexFlowBackend&&e.export()}IsReadyToRender(){return void 0!==this.graphic}clear(){this.drawer.clear(),this.reset()}setOptions(t){if(this.rules||(this.rules=new y.EngravingRules),this.drawingParameters||(this.drawingParameters=new b.DrawingParameters,this.drawingParameters.Rules=this.rules),null==t)return void m.default.warn("warning: osmd.setOptions() called without an options parameter, has no effect.\nexample usage: osmd.setOptions({drawCredits: false, drawPartNames: false})");t.drawingParameters&&(this.drawingParameters.DrawingParametersEnum=b.DrawingParametersEnum[t.drawingParameters.toLowerCase()]);let e=!this.drawer||!this.drawer.Backends||this.drawer.Backends.length<1;if(void 0!==t.backend){const i=g.OSMDOptions.BackendTypeFromString(t.backend);e=e||this.backendType!==i,this.backendType=i}this.needBackendUpdate=e,void 0!==t.autoBeam&&(this.rules.AutoBeamNotes=t.autoBeam);const i=t.autoBeamOptions;if(i&&(void 0===i.maintain_stem_directions&&(i.maintain_stem_directions=!1),this.rules.AutoBeamOptions=i,i.groups&&i.groups.length))for(const n of i.groups)if(2!==n.length)throw new Error("Each fraction in autoBeamOptions.groups must be of length 2, e.g. [3,4] for beaming three fourths");void 0!==t.percussionOneLineCutoff&&(this.rules.PercussionOneLineCutoff=t.percussionOneLineCutoff),0!==this.rules.PercussionOneLineCutoff&&void 0!==t.percussionForceVoicesOneLineCutoff&&(this.rules.PercussionForceVoicesOneLineCutoff=t.percussionForceVoicesOneLineCutoff),void 0!==t.alignRests&&(this.rules.AlignRests=t.alignRests),void 0!==t.coloringMode&&this.setColoringMode(t),void 0!==t.coloringEnabled&&(this.rules.ColoringEnabled=t.coloringEnabled),void 0!==t.colorStemsLikeNoteheads&&(this.rules.ColorStemsLikeNoteheads=t.colorStemsLikeNoteheads),t.disableCursor&&(this.drawingParameters.drawCursors=!1),t.drawHiddenNotes&&(this.drawingParameters.drawHiddenNotes=!0),void 0!==t.drawCredits&&(this.drawingParameters.DrawCredits=t.drawCredits),void 0!==t.drawComposer&&(this.drawingParameters.DrawComposer=t.drawComposer),void 0!==t.drawTitle&&(this.drawingParameters.DrawTitle=t.drawTitle),void 0!==t.drawSubtitle&&(this.drawingParameters.DrawSubtitle=t.drawSubtitle),void 0!==t.drawLyricist&&(this.drawingParameters.DrawLyricist=t.drawLyricist),void 0!==t.drawMetronomeMarks&&(this.rules.MetronomeMarksDrawn=t.drawMetronomeMarks),void 0!==t.drawPartNames&&(this.drawingParameters.DrawPartNames=t.drawPartNames,t.drawPartAbbreviations||(this.rules.RenderPartAbbreviations=t.drawPartNames)),void 0!==t.drawPartAbbreviations&&(this.rules.RenderPartAbbreviations=t.drawPartAbbreviations),!1===t.drawFingerings&&(this.rules.RenderFingerings=!1),void 0!==t.drawMeasureNumbers&&(this.rules.RenderMeasureNumbers=t.drawMeasureNumbers),t.drawMeasureNumbersOnlyAtSystemStart&&(this.rules.RenderMeasureNumbersOnlyAtSystemStart=t.drawMeasureNumbersOnlyAtSystemStart),void 0!==t.drawLyrics&&(this.rules.RenderLyrics=t.drawLyrics),void 0!==t.drawTimeSignatures&&(this.rules.RenderTimeSignatures=t.drawTimeSignatures),void 0!==t.drawSlurs&&(this.rules.RenderSlurs=t.drawSlurs),void 0!==t.measureNumberInterval&&(this.rules.MeasureNumberLabelOffset=t.measureNumberInterval),void 0!==t.useXMLMeasureNumbers&&(this.rules.UseXMLMeasureNumbers=t.useXMLMeasureNumbers),void 0!==t.fingeringPosition&&(this.rules.FingeringPosition=S.AbstractExpression.PlacementEnumFromString(t.fingeringPosition)),void 0!==t.fingeringInsideStafflines&&(this.rules.FingeringInsideStafflines=t.fingeringInsideStafflines),void 0!==t.newSystemFromXML&&(this.rules.NewSystemAtXMLNewSystemAttribute=t.newSystemFromXML),void 0!==t.newPageFromXML&&(this.rules.NewPageAtXMLNewPageAttribute=t.newPageFromXML),void 0!==t.fillEmptyMeasuresWithWholeRest&&(this.rules.FillEmptyMeasuresWithWholeRest=t.fillEmptyMeasuresWithWholeRest),void 0!==t.followCursor&&(this.FollowCursor=t.followCursor),void 0!==t.setWantedStemDirectionByXml&&(this.rules.SetWantedStemDirectionByXml=t.setWantedStemDirectionByXml),t.defaultColorNotehead&&(this.rules.DefaultColorNotehead=t.defaultColorNotehead),t.defaultColorRest&&(this.rules.DefaultColorRest=t.defaultColorRest),t.defaultColorStem&&(this.rules.DefaultColorStem=t.defaultColorStem),t.defaultColorLabel&&(this.rules.DefaultColorLabel=t.defaultColorLabel),t.defaultColorTitle&&(this.rules.DefaultColorTitle=t.defaultColorTitle),t.defaultFontFamily&&(this.rules.DefaultFontFamily=t.defaultFontFamily),t.defaultFontStyle&&(this.rules.DefaultFontStyle=t.defaultFontStyle),t.drawUpToMeasureNumber&&(this.rules.MaxMeasureToDrawIndex=t.drawUpToMeasureNumber-1),t.drawFromMeasureNumber&&(this.rules.MinMeasureToDrawIndex=t.drawFromMeasureNumber-1),t.drawUpToPageNumber&&(this.rules.MaxPageToDrawNumber=t.drawUpToPageNumber),t.drawUpToSystemNumber&&(this.rules.MaxSystemToDrawNumber=t.drawUpToSystemNumber),t.tupletsRatioed&&(this.rules.TupletsRatioed=!0),t.tupletsBracketed&&(this.rules.TupletsBracketed=!0),t.tripletsBracketed&&(this.rules.TripletsBracketed=!0),t.autoResize?(this.resizeHandlerAttached||this.autoResize(),this.autoResizeEnabled=!0):!1===t.autoResize&&(this.autoResizeEnabled=!1),void 0!==t.pageFormat&&this.setPageFormat(t.pageFormat),void 0!==t.pageBackgroundColor&&(this.rules.PageBackgroundColor=t.pageBackgroundColor),void 0!==t.renderSingleHorizontalStaffline&&(this.rules.RenderSingleHorizontalStaffline=t.renderSingleHorizontalStaffline),void 0!==t.spacingFactorSoftmax&&(this.rules.SoftmaxFactorVexFlow=t.spacingFactorSoftmax),void 0!==t.spacingBetweenTextLines&&(this.rules.SpacingBetweenTextLines=t.spacingBetweenTextLines),void 0!==t.stretchLastSystemLine&&(this.rules.StretchLastSystemLine=t.stretchLastSystemLine),void 0!==t.autoGenerateMutipleRestMeasuresFromRestMeasures&&(this.rules.AutoGenerateMutipleRestMeasuresFromRestMeasures=t.autoGenerateMutipleRestMeasuresFromRestMeasures)}setColoringMode(t){if(t.coloringMode===b.ColoringModes.XML)return void(this.rules.ColoringMode=b.ColoringModes.XML);const e=[E.NoteEnum.C,E.NoteEnum.D,E.NoteEnum.E,E.NoteEnum.F,E.NoteEnum.G,E.NoteEnum.A,E.NoteEnum.B,-1];let i;if(t.coloringMode===b.ColoringModes.CustomColorSet){if(!t.coloringSetCustom||8!==t.coloringSetCustom.length)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 e of t.coloringSetCustom)if(!/^\#[0-9a-fA-F]{6}$/.test(e))throw new Error("One of the color strings in options.coloringSetCustom was not a valid HTML Hex color:\n"+e);i=t.coloringSetCustom}else if(t.coloringMode===b.ColoringModes.AutoColoring){i=[];const t=Object.keys(x.AutoColorSet);for(let e=0;e{}),(()=>{var e;(null===(e=this.graphic)||void 0===e?void 0:e.GetCalculator)instanceof r.VexFlowMusicSheetCalculator&&(this.graphic.GetCalculator.beamsNeedUpdate=!0),t.IsReadyToRender()&&t.render()}))}handleResize(t,e){let i,n;const s=this;function r(){s.AutoResizeEnabled&&(i=(new Date).getTime(),n||(t(),i=(new Date).getTime(),n=window.setTimeout(o,200)))}function o(){n=void 0,window.clearTimeout(n),(new Date).getTime()-i<200?n=window.setTimeout(o,200):e()}window.attachEvent?window.attachEvent("onresize",r):window.addEventListener("resize",r),this.resizeHandlerAttached=!0,window.setTimeout(t,0),window.setTimeout(e,1)}enableOrDisableCursor(t){var e,i,n,s;if(this.drawingParameters.drawCursors=t,t){const t=null===(e=this.cursor)||void 0===e?void 0:e.Hidden,r=null===(i=this.cursor)||void 0===i?void 0:i.Iterator;null===(n=this.cursor)||void 0===n||n.hide();let o=null===(s=this.drawer)||void 0===s?void 0:s.Backends[0];if(o&&this.rules.RestoreCursorAfterRerender&&this.cursor){const t=this.cursor.updateCurrentPage();o=this.drawer.Backends[t-1]}o&&o.getRenderElement()&&(this.cursor=new d.Cursor(o.getRenderElement(),this)),this.sheet&&this.graphic&&this.cursor&&this.cursor.init(this.sheet.MusicPartManager,this.graphic),this.rules.RestoreCursorAfterRerender&&(this.cursor.hidden=t,r&&(this.cursor.iterator=r,this.cursor.update()))}else{if(!this.cursor)return;this.cursor.hide()}}createBackend(t,e){let i;return i=void 0===t||t===g.BackendType.SVG?new c.SvgVexFlowBackend(this.rules):new u.CanvasVexFlowBackend(this.rules),i.graphicalMusicPage=e,i.initialize(this.container,this.zoom),i}static StringToPageFormat(t){let e=y.PageFormat.UndefinedPageFormat;if(t.match("^[0-9]+x[0-9]+$")){const i=t.split("x"),n=Number.parseInt(i[0],10),s=Number.parseInt(i[1],10);n>0&&n<32768&&s>0&&s<32768&&(e=new y.PageFormat(n,s,`customPageFormat${t}`))}return t=(t=(t=t.replace(" ","_")).replace("Landscape","L")).replace("Portrait","P"),_.PageFormatStandards.hasOwnProperty(t)?(e=_.PageFormatStandards[t],e):e}setPageFormat(t){const e=_.StringToPageFormat(t);this.needBackendUpdate=!e.Equals(this.rules.PageFormat),this.rules.PageFormat=e}setCustomPageFormat(t,e){if(t>0&&e>0){const i=new y.PageFormat(t,e);this.rules.PageFormat=i}}set DrawSkyLine(t){this.drawSkyLine=t,this.drawer&&(this.drawer.skyLineVisible=t)}get DrawSkyLine(){return this.drawer.skyLineVisible}set DrawBottomLine(t){this.drawBottomLine=t,this.drawer&&(this.drawer.bottomLineVisible=t)}get DrawBottomLine(){return this.drawer.bottomLineVisible}set DrawBoundingBox(t){this.setDrawBoundingBox(t,!0)}get DrawBoundingBox(){return this.drawBoundingBox}setDrawBoundingBox(t,e=!1){this.drawBoundingBox=t,this.drawer&&(this.drawer.drawableBoundingBoxElement=t),e&&this.render()}get AutoResizeEnabled(){return this.autoResizeEnabled}set AutoResizeEnabled(t){this.autoResizeEnabled=t}get Zoom(){return this.zoom}set Zoom(t){var e;this.zoom=t,this.zoomUpdated=!0,(null===(e=this.graphic)||void 0===e?void 0:e.GetCalculator)instanceof r.VexFlowMusicSheetCalculator&&(this.graphic.GetCalculator.beamsNeedUpdate=this.zoomUpdated)}set FollowCursor(t){this.followCursor=t}get FollowCursor(){return this.followCursor}set TransposeCalculator(t){l.MusicSheetCalculator.transposeCalculator=t}get TransposeCalculator(){return l.MusicSheetCalculator.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 Version(){return this.version}}e.OpenSheetMusicDisplay=_,_.PageFormatStandards={A3_L:new y.PageFormat(420,297,"A3_L"),A3_P:new y.PageFormat(297,420,"A3_P"),A4_L:new y.PageFormat(297,210,"A4_L"),A4_P:new y.PageFormat(210,297,"A4_P"),A5_L:new y.PageFormat(210,148,"A5_L"),A5_P:new y.PageFormat(148,210,"A5_P"),A6_L:new y.PageFormat(148,105,"A6_L"),A6_P:new y.PageFormat(105,148,"A6_P"),Endless:y.PageFormat.UndefinedPageFormat,Letter_L:new y.PageFormat(279.4,215.9,"Letter_L"),Letter_P:new y.PageFormat(215.9,279.4,"Letter_P")}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.AJAX=void 0,e.AJAX=class{static ajax(t,e=9e3){let i;const n=t.indexOf(".mxl")>-1?"text/plain; charset=x-user-defined":"application/xml";if(XMLHttpRequest)i=new XMLHttpRequest;else{if(!ActiveXObject)return Promise.reject(new Error("XMLHttp not supported."));i=new ActiveXObject("Microsoft.XMLHTTP")}return i.timeout=e,new Promise(((e,s)=>{i.onreadystatechange=()=>{i.readyState===XMLHttpRequest.DONE&&(200===i.status||0===i.status&&i.responseText?e(i.responseText):s(new Error("Could not retrieve requested URL "+i.status)))},i.ontimeout=t=>{s(new Error("Server request Timeout"))},i.overrideMimeType(n),i.open("GET",t,!0),i.send()}))}}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Cursor=void 0;const n=i(0);e.Cursor=class{constructor(t,e){this.hidden=!0,this.currentPageNumber=1,this.container=t,this.openSheetMusicDisplay=e,this.rules=this.openSheetMusicDisplay.EngravingRules;let i=0;for(this.cursorElementId="cursorImg-0";document.getElementById(this.cursorElementId);)i++,this.cursorElementId=`cursorImg-${i}`;const n=document.createElement("img");n.id=this.cursorElementId,n.style.position="absolute",n.style.zIndex="-1",this.cursorElement=n,this.container.appendChild(n)}init(t,e){this.manager=t,this.graphic=e,this.reset(),this.hidden=!0,this.hide()}show(){this.hidden=!1,this.resetIterator(),this.update()}resetIterator(){if(!this.openSheetMusicDisplay.Sheet||!this.openSheetMusicDisplay.Sheet.SourceMeasures)return void ("OSMD.Cursor.resetIterator(): sheet or measures were null/undefined.");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.SourceMeasures.length>e&&(this.openSheetMusicDisplay.Sheet.SelectionStart=this.openSheetMusicDisplay.Sheet.SourceMeasures[e].AbsoluteTimestamp),this.openSheetMusicDisplay.Sheet&&this.openSheetMusicDisplay.Sheet.SourceMeasures.length>i){const t=this.openSheetMusicDisplay.Sheet.SourceMeasures[i];this.openSheetMusicDisplay.Sheet.SelectionEnd=n.Fraction.plus(t.AbsoluteTimestamp,t.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)}update(){if(this.hidden||void 0===this.hidden||null===this.hidden)return;this.updateCurrentPage();const t=this.iterator,e=t.CurrentVisibleVoiceEntries();if(t.EndReached||!t.CurrentVoiceEntries||0===e.length)return;let i,n=0,s=0,r=0;if(t.CurrentMeasure.isReducedToMultiRest){const e=this.graphic.findGraphicalMeasure(t.CurrentMeasureIndex,0),s=e.parentSourceMeasure.multipleRestMeasures,r=t.CurrentMeasure.multipleRestMeasureNumber/(s+1),o=e.PositionAndShape.Size.width-e.beginInstructionsWidth;n=e.PositionAndShape.AbsolutePosition.x+e.beginInstructionsWidth+r*o,i=e.ParentMusicSystem}else{const t=e.map((t=>this.getStaffEntryFromVoiceEntry(t))).sort(((t,e)=>{var i,n,s,r;return(null===(n=null===(i=null==t?void 0:t.PositionAndShape)||void 0===i?void 0:i.AbsolutePosition)||void 0===n?void 0:n.x)<=(null===(r=null===(s=null==e?void 0:e.PositionAndShape)||void 0===s?void 0:s.AbsolutePosition)||void 0===r?void 0:r.x)?-1:1}))[0];n=t.PositionAndShape.AbsolutePosition.x,i=t.parentMeasure.ParentMusicSystem}if(!i)return;s=i.PositionAndShape.AbsolutePosition.y+i.StaffLines[0].PositionAndShape.RelativePosition.y;const o=i.StaffLines[i.StaffLines.length-1];r=i.PositionAndShape.AbsolutePosition.y+o.PositionAndShape.RelativePosition.y+o.StaffHeight-s;const a=this.cursorElement;a.style.top=10*s*this.openSheetMusicDisplay.zoom+"px",a.style.left=10*(n-1.5)*this.openSheetMusicDisplay.zoom+"px",a.height=10*r*this.openSheetMusicDisplay.zoom;const l=30*this.openSheetMusicDisplay.zoom;if(l!==a.width&&(a.width=l,this.updateStyle(l)),this.openSheetMusicDisplay.FollowCursor){const t=this.cursorElement.getBoundingClientRect().top;this.cursorElement.scrollIntoView({behavior:t<1e3?"smooth":"auto",block:"center"})}this.cursorElement.style.display=""}hide(){this.cursorElement.style.display="none",this.hidden=!0}next(){this.iterator.moveToNextVisibleVoiceEntry(!1),this.update()}reset(){this.resetIterator(),this.update()}updateStyle(t,e){e||(e=this.rules.DefaultColorCursor);const i=document.createElement("canvas");i.width=this.cursorElement.width,i.height=1;const n=i.getContext("2d");n.globalAlpha=.5;const s=n.createLinearGradient(0,0,this.cursorElement.width,0);s.addColorStop(0,"white"),s.addColorStop(.2,e),s.addColorStop(.8,e),s.addColorStop(1,"white"),n.fillStyle=s,n.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((t=>{i.push.apply(i,t.Notes)})),i}updateCurrentPage(){const t=this.iterator.currentTimeStamp;for(const e of this.graphic.MusicPages)if(e.MusicSystems.last().GetSystemsLastTimeStamp().gt(t)){const t=e.PageNumber;return t!==this.currentPageNumber&&(this.container.removeChild(this.cursorElement),this.container=document.getElementById("osmdCanvasPage"+t),this.container.appendChild(this.cursorElement)),this.currentPageNumber=t}return 1}}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.AClassHierarchyTrackable=void 0,e.AClassHierarchyTrackable=class{isInstanceOfClass(t){let e=this.constructor.prototype;for(;e;){if(t===e.constructor.name)return!0;e=e.__proto__}return!1}}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.VerticalGraphicalStaffEntryContainer=void 0,e.VerticalGraphicalStaffEntryContainer=class{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,n=e.absoluteTimestamp.RealValue;return in?1:0}getFirstNonNullStaffEntry(){for(let t=0,e=this.staffEntries.length;t0){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,n){for(let s=0,r=t.length;s0&&(r.beginInstructionsWidth=i),n>0&&(r.endInstructionsWidth=n)}}finalizeCurrentAndCreateNewSystem(t,e=!1,i=!0,n=!1){this.finalizeCurrentSystem(t,e,i,n),this.currentSystemParams=new p,void 0!==t&&this.measureListIndex=1){const e=this.currentSystemParams.currentSystem.GraphicalMeasures[this.currentSystemParams.currentSystem.GraphicalMeasures.length-1],i=t[t.length-1];let n=0;i.endLine===h.SystemLinesEnum.DotsBoldBoldDots&&(i.endLine=h.SystemLinesEnum.DotsThinBold,n=e[0].getLineWidth(h.SystemLinesEnum.DotsBoldBoldDots)/2-e[0].getLineWidth(h.SystemLinesEnum.DotsThinBold)),this.currentSystemParams.currentSystemFixWidth-=n;for(let t=0,s=e.length;t1){r=!0;break}let o=0;for(let a=0;a=0){const e=null===(l=this.measureList[i][0])||void 0===l?void 0:l.parentSourceMeasure;(null==e?void 0:e.ImplicitMeasure)&&(null==e?void 0:e.RhythmPrinted)&&(t=!1)}t&&(e.addRhythmAtBegin(u),e.parentSourceMeasure.RhythmPrinted=!0,m=!0)}return(f||p||m)&&(d+=e.beginInstructionsWidth,m&&(d+=this.rules.RhythmRightMargin)),d}addInstructionsAtMeasureEnd(t,e,i){if(!t||!t.Instructions||0===t.Instructions.length)return 0;for(let n=0,s=t.Instructions.length;n0&&(this.currentSystemParams.systemMeasures.push({beginLine:h.SystemLinesEnum.None,endLine:h.SystemLinesEnum.None}),this.currentSystemParams.currentWidth+=n,this.currentSystemParams.currentSystemFixWidth+=n)}addExtraInstructionMeasure(t,e,i){const n=this.currentSystemParams.currentSystem,s=c.MusicSheetCalculator.symbolFactory.createExtraGraphicalMeasure(n.StaffLines[t]);e&&s.addKeyAtBegin(e,this.activeKeys[t],this.activeClefs[t]),void 0!==i&&i.PrintObject&&s.addRhythmAtBegin(i),s.PositionAndShape.BorderLeft=0,s.PositionAndShape.BorderTop=0,s.PositionAndShape.BorderBottom=this.rules.StaffHeight;const r=this.rules.MeasureLeftMargin+s.beginInstructionsWidth+this.rules.MeasureRightMargin;return s.PositionAndShape.BorderRight=r,n.StaffLines[t].Measures.push(s),r}addStaveMeasuresToSystem(t){if(t[0]){const e=[];for(let n=0;n1){const e=Math.min(this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length-1,t.measureListIndex+t.multipleRestMeasures-1);t=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures[e]}}finally{}return this.nextMeasureBeginsLineRepetition()&&this.thisMeasureEndsLineRepetition()?h.SystemLinesEnum.DotsBoldBoldDots:this.thisMeasureEndsLineRepetition()?h.SystemLinesEnum.DotsThinBold:this.nextMeasureHasKeyInstructionChange()||this.thisMeasureEndsWordRepetition()||this.nextMeasureBeginsWordRepetition()?h.SystemLinesEnum.DoubleThin:t&&void 0!==t.endingBarStyleEnum?t.endingBarStyleEnum:h.SystemLinesEnum.SingleThin}getLineWidth(t,e,i){let n=t.getLineWidth(e);return e===h.SystemLinesEnum.DotsBoldBoldDots&&(n/=2),i&&e===h.SystemLinesEnum.BoldThinDots&&(n+=this.rules.DistanceBetweenLastInstructionAndRepetitionBarline),n}previousMeasureEndsLineRepetition(){if(0===this.measureListIndex)return!1;for(let t=0,e=this.measureList[this.measureListIndex-1].length;t=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||!this.measureList[t])return!1;for(let e=0,i=this.measureList[t].length;e=this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length||t>this.measureList.length-1)return!1;for(let e=0,i=this.measureList[t].length;ethis.rules.PageHeight-this.rules.PageBottomMargin&&(n++,n<=4&& (`warning: could not fit a single system on page ${t.PageNumber} and measure number ${i.GraphicalMeasures[0][0].MeasureNumber}.\n The PageFormat may be too small for this sheet."\n Will not give further warnings for all pages, only total.`))}else{const n=this.musicSystems[s-1],r=n.StaffLines[n.StaffLines.length-1],o=r.PositionAndShape;let l=this.findRequiredDistanceWithSkyBottomLine(n,i);l+=this.rules.MinSkyBottomDistBetweenSystems,l=Math.max(l,this.rules.MinimumDistanceBetweenSystems+r.StaffHeight);const h=e+o.RelativePosition.y+l,c=h+i.PositionAndShape.BorderMarginBottom;if(this.rules.NewPageAtXMLNewPageAttribute&&n.breaksPage||!(c0&& (`total amount of pages that couldn't fit a single music system: ${n} of ${t.PageNumber}`)}findRequiredDistanceWithSkyBottomLine(t,e){const i=t.StaffLines[t.StaffLines.length-1],n=e.StaffLines[0],s=i.BottomLine,r=n.SkyLine,o=i.PositionAndShape,a=n.PositionAndShape,l=1/this.rules.SamplingUnit;let h=0;for(let c=0;c=r.length)break;const i=Math.max(0,e-6),n=Math.min(r.length-1,e+6);let u=0;for(let s=i;s<=n;s++)u=Math.min(u,r[s]);const d=t-u;h=Math.max(d,h)}return 0===h&&(h=o.BorderBottom-a.BorderTop),h}};class p{constructor(){this.systemMeasures=[],this.systemMeasureIndex=0,this.currentWidth=0,this.currentSystemFixWidth=0,this.currentSystemVarWidth=0,this.maxLabelLength=0}IsSystemStartMeasure(){return 0===this.systemMeasureIndex}}e.SystemBuildParameters=p,e.MeasureBuildParameters=class{}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Clickable=void 0;const n=i(6);class s extends n.GraphicalObject{}e.Clickable=s},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.OctaveShiftParams=void 0,e.OctaveShiftParams=class{constructor(t,e,i){this.getOpenOctaveShift=t,this.getAbsoluteStartTimestamp=e,this.getAbsoluteEndTimestamp=i}}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.AccidentalCalculator=void 0;const n=i(2),s=i(2),r=i(15),o=i(17);e.AccidentalCalculator=class{constructor(){this.keySignatureNoteAlterationsDict=new r.Dictionary,this.currentAlterationsComparedToKeyInstructionList=[],this.currentInMeasureNoteAlterationsDict=new r.Dictionary}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+12*e.Octave,r=this.currentAlterationsComparedToKeyInstructionList.indexOf(i)>=0;if(this.currentInMeasureNoteAlterationsDict.containsKey(i)){if(r&&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!==n.AccidentalEnum.NONE&&this.currentInMeasureNoteAlterationsDict.remove(i);const r=this.currentInMeasureNoteAlterationsDict.getValue(i);e.Accidental===n.AccidentalEnum.NONE&&(e=.5===Math.abs(r)?new s.Pitch(e.FundamentalNote,e.Octave,n.AccidentalEnum.NONE):new s.Pitch(e.FundamentalNote,e.Octave,n.AccidentalEnum.NATURAL)),o.MusicSheetCalculator.symbolFactory.addGraphicalAccidental(t,e)}}else e.Accidental!==n.AccidentalEnum.NONE?(r||this.currentAlterationsComparedToKeyInstructionList.push(i),this.currentInMeasureNoteAlterationsDict.setValue(i,e.AccidentalHalfTones),o.MusicSheetCalculator.symbolFactory.addGraphicalAccidental(t,e)):r&&(e=new s.Pitch(e.FundamentalNote,e.Octave,n.AccidentalEnum.NATURAL),this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(i),1),o.MusicSheetCalculator.symbolFactory.addGraphicalAccidental(t,e))}reactOnKeyInstructionChange(){const t=this.activeKeyInstruction.AlteratedNotes;let e;e=this.activeKeyInstruction.Key>0?n.AccidentalEnum.SHARP:n.AccidentalEnum.FLAT,this.keySignatureNoteAlterationsDict.clear(),this.currentAlterationsComparedToKeyInstructionList.length=0;for(let i=-9;i<9;i++)for(let n=0;n-1&&this.parent.MusicSystems.splice(t,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 GraphicalComments(){return this.graphicalComments}get SystemLines(){return this.systemLines}get Id(){return this.id}createSystemLeftLine(t,e,i){let n=-t/2;i&&(n=this.maxLabelLength+e-t/2);const s=this.staffLines[0].Measures[0];let r;this.staffLines.length>1&&(r=this.staffLines[this.staffLines.length-1].Measures[0]);const o=this.createSystemLine(n,t,c.SystemLinesEnum.SingleThin,d.SystemLinePosition.MeasureBegin,this,s,r);this.SystemLines.push(o),o.PositionAndShape.RelativePosition=new h.PointF2D(n,0),o.PositionAndShape.BorderLeft=0,o.PositionAndShape.BorderRight=t,o.PositionAndShape.BorderTop=0,o.PositionAndShape.BorderBottom=this.boundingBox.Size.height,this.createLinesForSystemLine(o)}createVerticalLineForMeasure(t,e,i,n,s,r){const o=r.ParentStaffLine,a=new h.PointF2D(o.PositionAndShape.RelativePosition.x,o.PositionAndShape.RelativePosition.y),l=o.ParentStaff.ParentInstrument.Staves;if(o.ParentStaff===l[0]){let c;l.length>1&&(c=this.getBottomStaffLine(o).Measures[s]);const u=this.createSystemLine(t,e,i,n,this,r,c),d=a.x+t;u.PositionAndShape.RelativePosition=new h.PointF2D(d,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;e1){let t,i;for(let n=0,s=this.staffLines.length;nthis.maxLabelLength&&(this.maxLabelLength=t.PositionAndShape.Size.width,e=r)}this.updateMusicSystemStaffLineXPosition(e)}setMusicSystemLabelsYPosition(){this.labels.forEach(((t,e)=>{let i=0,n=0;for(let s=0;s0&&(e.PositionAndShape.RelativePosition=new h.PointF2D(0,i/n+2))}))}checkStaffEntriesForStaffEntryLink(){let t=!1,e=!1;for(let i=0;i=0;i--){if(e=t.InstrumentalGroups[i],!(e instanceof n.Instrument))return this.findLastVisibleInstrumentInInstrumentalGroup(e);if(!0===e.Visible)return e}}updateMusicSystemStaffLineXPosition(t){for(let e=0,i=this.StaffLines.length;e0&&this.drawDashes(s.LyricsDashes),s.LyricLines.length>0&&this.drawLyricLines(s.LyricLines,s));for(const s of t.SystemLines)this.drawSystemLineObject(s);if(t.Parent===t.Parent.Parent.MusicPages[0])for(const o of t.Labels)this.drawLabel(o,s.GraphicalLayers.Notes);for(const s of t.InstrumentBrackets)this.drawInstrumentBrace(s,t);for(const s of t.GroupBrackets)this.drawGroupBracket(s,t);if(!this.leadSheet)for(const o of t.MeasureNumberLabels)this.drawLabel(o,s.GraphicalLayers.Notes);for(const s of t.StaffLines)this.drawStaffLineSymbols(s);this.drawingParameters.drawMarkedAreas&&this.drawMarkedAreas(t),this.drawingParameters.drawComments&&this.drawComment(t)}activateSystemRendering(t,e,i,n){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.drawExpressions(t),this.skyLineVisible&&this.drawSkyLine(t),this.bottomLineVisible&&this.drawBottomLine(t)}drawLyricLines(t,e){e.LyricLines.forEach((t=>{t.Start.y+=e.PositionAndShape.AbsolutePosition.y,t.End.y+=e.PositionAndShape.AbsolutePosition.y,t.Start.x+=e.PositionAndShape.AbsolutePosition.x,t.End.x+=e.PositionAndShape.AbsolutePosition.x,this.drawGraphicalLine(t,this.rules.LyricUnderscoreLineWidth)}))}drawExpressions(t){}drawGraphicalLine(t,e,i="black"){return this.drawLine(t.Start,t.End,i,e)}drawLine(t,e,i="#FF0000FF",n){}drawDashes(t){t.forEach((t=>this.drawLabel(t,s.GraphicalLayers.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,s.GraphicalLayers.Notes)}}drawInstantaneousDynamic(t){throw new Error("not implemented")}drawContinuousDynamic(t){throw new Error("not implemented")}drawSymbol(t,e,i,n=1,r=s.GraphicalLayers.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)this.drawLabel(e,s.GraphicalLayers.Notes);this.drawableBoundingBoxElement&&this.drawBoundingBoxes(t.PositionAndShape,0,this.drawableBoundingBoxElement)}}drawBoundingBoxes(t,e=0,i="all"){const n=t.DataObject.constructor.name;let s=!1;"all"===i?s=!0:"VexFlowStaffEntry"===i?s=t.DataObject instanceof m.VexFlowStaffEntry:"VexFlowMeasure"===i?s=t.DataObject instanceof m.VexFlowMeasure:"VexFlowGraphicalNote"===i?s=t.DataObject instanceof m.VexFlowGraphicalNote:"VexFlowVoiceEntry"===i?s=t.DataObject instanceof m.VexFlowVoiceEntry:"GraphicalLabel"===i?s=t.DataObject instanceof l.GraphicalLabel:"VexFlowStaffLine"===i?s=t.DataObject instanceof m.VexFlowStaffLine:"SystemLine"===i?s=t.DataObject instanceof d.SystemLine:"StaffLineActivitySymbol"===i?s=t.DataObject instanceof b.StaffLineActivitySymbol:"VexFlowContinuousDynamicExpression"===i&&(s=t.DataObject instanceof m.VexFlowContinuousDynamicExpression),(s||n===i)&&this.drawBoundingBox(t,void 0,!0,n,e),e++,t.ChildElements.forEach((t=>this.drawBoundingBoxes(t,e,i)))}drawBoundingBox(t,e,i=!1,n,u=0){let d=new o.RectangleF2D(t.AbsolutePosition.x+t.BorderMarginLeft,t.AbsolutePosition.y+t.BorderMarginTop,t.BorderMarginRight-t.BorderMarginLeft,t.BorderMarginBottom-t.BorderMarginTop);i&&(this.drawLineAsHorizontalRectangle(new r.GraphicalLine(new a.PointF2D(t.AbsolutePosition.x-1,t.AbsolutePosition.y),new a.PointF2D(t.AbsolutePosition.x+1,t.AbsolutePosition.y),.1,s.OutlineAndFillStyleEnum.BaseWritingColor,e),u-1),this.drawLineAsVerticalRectangle(new r.GraphicalLine(new a.PointF2D(t.AbsolutePosition.x,t.AbsolutePosition.y-1),new a.PointF2D(t.AbsolutePosition.x,t.AbsolutePosition.y+1),.1,s.OutlineAndFillStyleEnum.BaseWritingColor,e),u-1)),d=this.applyScreenTransformationForRect(d);const f=this.renderRectangle(d,s.GraphicalLayers.Background,u,e,.5);if(n){const t=new h.Label(n);this.renderLabel(new l.GraphicalLabel(t,.8,c.TextAlignmentEnum.CenterCenter,this.rules),u,d.width,d.height,d.height,new a.PointF2D(d.x,d.y+12))}return f}drawMarkedAreas(t){for(const e of t.GraphicalMarkedAreas)e&&(e.systemRectangle&&this.drawRectangle(e.systemRectangle,s.GraphicalLayers.Background),e.settings&&this.drawLabel(e.settings,s.GraphicalLayers.Comment),e.labelRectangle&&this.drawRectangle(e.labelRectangle,s.GraphicalLayers.Background),e.label&&this.drawLabel(e.label,s.GraphicalLayers.Comment))}drawComment(t){for(const e of t.GraphicalComments)e&&(e.settings&&this.drawLabel(e.settings,s.GraphicalLayers.Comment),e.label&&this.drawLabel(e.label,s.GraphicalLayers.Comment))}drawStaffLineSymbols(t){const e=t.ParentStaff.ParentInstrument,i=t.PositionAndShape.AbsolutePosition.x,n=t.PositionAndShape.AbsolutePosition.y+2,o=t.PositionAndShape.BorderRight;e.highlight&&this.drawingParameters.drawHighlights&&this.drawLineAsHorizontalRectangle(new r.GraphicalLine(new a.PointF2D(i,n),new a.PointF2D(i+o,n),4,s.OutlineAndFillStyleEnum.Highlighted),s.GraphicalLayers.Highlight);let l=p.MusicSymbolDrawingStyle.Disabled,h=f.MusicSymbol.PLAY,c=this.drawingParameters.drawActivitySymbols;switch(this.phonicScoreMode){case p.PhonicScoreModes.Midi:h=f.MusicSymbol.PLAY,this.midiPlaybackAvailable&&t.ParentStaff.audible&&(l=p.MusicSymbolDrawingStyle.PlaybackSymbols);break;case p.PhonicScoreModes.Following:h=f.MusicSymbol.MIC,t.ParentStaff.following&&(l=p.MusicSymbolDrawingStyle.FollowSymbols);break;default:c=!1}if(c){const t=new a.PointF2D(i+o+2,n);this.drawSymbol(h,l,t)}if(this.drawingParameters.drawErrors)for(const u of t.Measures){const t=u.PositionAndShape,e=t.AbsolutePosition.x,i=t.AbsolutePosition.y+2;u.hasError&&this.graphicalMusicSheet.ParentMusicSheet.DrawErroneousMeasures&&this.drawLineAsHorizontalRectangle(new r.GraphicalLine(new a.PointF2D(e,i),new a.PointF2D(e+t.BorderRight,i),4,s.OutlineAndFillStyleEnum.ErrorUnderlay),s.GraphicalLayers.MeasureError)}}}},function(t,e,i){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.PhonicScoreModes=e.MusicSymbolDrawingStyle=e.DrawingMode=void 0,(n=e.DrawingMode||(e.DrawingMode={}))[n.All=0]="All",n[n.NoOverlays=1]="NoOverlays",n[n.Leadsheet=2]="Leadsheet",function(t){t[t.Normal=0]="Normal",t[t.Disabled=1]="Disabled",t[t.Selected=2]="Selected",t[t.Clickable=3]="Clickable",t[t.PlaybackSymbols=4]="PlaybackSymbols",t[t.FollowSymbols=5]="FollowSymbols",t[t.QFeedbackNotFound=6]="QFeedbackNotFound",t[t.QFeedbackOk=7]="QFeedbackOk",t[t.QFeedbackPerfect=8]="QFeedbackPerfect",t[t.Debug1=9]="Debug1",t[t.Debug2=10]="Debug2",t[t.Debug3=11]="Debug3"}(e.MusicSymbolDrawingStyle||(e.MusicSymbolDrawingStyle={})),function(t){t[t.Following=0]="Following",t[t.Midi=1]="Midi",t[t.Manual=2]="Manual"}(e.PhonicScoreModes||(e.PhonicScoreModes={}))},function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[i]}})}:function(t,e,i,n){void 0===n&&(n=i),t[n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||e.hasOwnProperty(i)||n(e,t,i)};Object.defineProperty(e,"__esModule",{value:!0}),s(i(78),e),s(i(58),e),s(i(92),e),s(i(59),e),s(i(57),e),s(i(13),e),s(i(60),e),s(i(90),e),s(i(93),e),s(i(95),e),s(i(61),e),s(i(44),e),s(i(96),e),s(i(89),e),s(i(16),e),s(i(91),e),s(i(97),e),s(i(165),e),s(i(98),e),s(i(99),e),s(i(100),e),s(i(101),e),s(i(63),e),s(i(62),e)},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalMeasure=void 0;const n=i(6),s=i(0),r=i(5),o=i(4);class a extends n.GraphicalObject{constructor(t,e,i){super(),this.hasOnlyRests=!1,this.measureNumber=-1,this.parentStaff=t,this.parentSourceMeasure=e,this.parentStaffLine=i,i?(this.parentStaff=i.ParentStaff,this.PositionAndShape=new r.BoundingBox(this,i.PositionAndShape)):this.PositionAndShape=new r.BoundingBox(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.PointF2D(t,0)}setWidth(t){this.PositionAndShape.BorderRight=t}layoutSymbols(){throw new Error("not implemented")}findGraphicalStaffEntryFromTimestamp(t){var e;for(let i=0,n=this.staffEntries.length;i1}isVisible(){return this.ParentStaff.ParentInstrument.Visible}getGraphicalMeasureDurationFromStaffEntries(){let t=new s.Fraction(0,1);const e=[];for(let i=0,n=this.staffEntries.length;i0&&r.Add(e.notes[0].graphicalNoteLength);t.lt(r)&&(t=s.Fraction.createFromFraction(r))}return t}addGraphicalStaffEntry(t){this.staffEntries.push(t)}addGraphicalStaffEntryAtTimestamp(t){if(t)if(0===this.staffEntries.length||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}0===e&&this.staffEntries.splice(e,0,t)}}beginsWithLineRepetition(){const t=this.parentSourceMeasure;return!!t&&t.beginsWithLineRepetition()}endsWithLineRepetition(){const t=this.parentSourceMeasure;return!!t&&t.endsWithLineRepetition()}beginsWithWordRepetition(){const t=this.parentSourceMeasure;return!!t&&t.beginsWithWordRepetition()}endsWithWordRepetition(){const t=this.parentSourceMeasure;return!!t&&t.endsWithWordRepetition()}}e.GraphicalMeasure=a},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalOctaveShift=void 0;const n=i(6),s=i(30),r=i(5),o=i(77),a=i(11);class l extends n.GraphicalObject{constructor(t,e){super(),this.getOctaveShift=t,this.setSymbol(),this.PositionAndShape=new r.BoundingBox(this,e)}setSymbol(){switch(this.getOctaveShift.Type){case s.OctaveEnum.VA8:this.octaveSymbol=o.MusicSymbol.VA8;break;case s.OctaveEnum.VB8:this.octaveSymbol=o.MusicSymbol.VB8;break;case s.OctaveEnum.MA15:this.octaveSymbol=o.MusicSymbol.MA15;break;case s.OctaveEnum.MB15:this.octaveSymbol=o.MusicSymbol.MB15;break;default:throw new a.ArgumentOutOfRangeException("")}}}e.GraphicalOctaveShift=l},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalStaffEntry=void 0;const n=i(5),s=i(0),r=i(6),o=i(34),a=i(17);class l extends r.GraphicalObject{constructor(t,e,i){super(),this.graphicalChordContainers=[],this.tabStaffEntry=void 0,this.MaxAccidentals=0,this.graphicalInstructions=[],this.graphicalTies=[],this.lyricsEntries=[],this.parentMeasure=t,this.graphicalVoiceEntries=[],this.sourceStaffEntry=e,i?(this.staffEntryParent=i,this.parentVerticalContainer=i.parentVerticalContainer,this.PositionAndShape=new n.BoundingBox(this,i.PositionAndShape)):this.PositionAndShape=new n.BoundingBox(this,t.PositionAndShape),e&&(this.relInMeasureTimestamp=e.Timestamp)}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 e=i.sourceNote;if(!e.isRest()&&e.Pitch.FundamentalNote===t.Pitch.FundamentalNote&&e.Pitch.Octave===t.Pitch.Octave&&e.getAbsoluteTimestamp().Equals(t.getAbsoluteTimestamp()))return i}}findEndTieGraphicalNoteFromNoteWithStartingSlur(t,e){if(t)for(const i of this.graphicalVoiceEntries)if(i.parentVoiceEntry===t.ParentVoiceEntry)for(const t of i.notes){const i=t.sourceNote;if(i.NoteTie&&-1!==i.NoteSlurs.indexOf(e))return t}}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 s.Fraction(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;e0&&(t=e)}return t}findStaffEntryMaxNoteLength(){let t=new s.Fraction(0,1);for(const e of this.graphicalVoiceEntries)for(const i of e.notes){const e=i.graphicalNoteLength;t.lt(e)&&e.GetExpandedNumerator()>0&&(t=e)}return t}findOrCreateGraphicalVoiceEntry(t){for(const i of this.graphicalVoiceEntries)if(i.parentVoiceEntry===t)return i;const e=a.MusicSheetCalculator.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=a.MusicSheetCalculator.symbolFactory.createVoiceEntry(t.sourceNote.ParentVoiceEntry,this);return this.graphicalVoiceEntries.push(e),e}addGraphicalNoteToListAtCorrectYPosition(t,e){const i=t.notes;if(0===i.length||e.PositionAndShape.RelativePosition.y=0;n--){if(i[n].PositionAndShape.RelativePosition.y>e.PositionAndShape.RelativePosition.y){i.splice(n+1,0,e);break}if(0===n){i.splice(0,0,e);break}}}hasOnlyRests(){for(const t of this.graphicalVoiceEntries)for(const e of t.notes)if(!e.sourceNote.isRest())return!1;return!0}}e.GraphicalStaffEntry=l},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.StaffLine=void 0;const n=i(5),s=i(6),r=i(47),o=i(4),a=i(126);class l extends s.GraphicalObject{constructor(t,e){super(),this.measures=[],this.staffLines=new Array(5),this.octaveShifts=[],this.lyricLines=[],this.lyricsDashes=[],this.abstractExpressions=[],this.graphicalSlurs=[],this.parentMusicSystem=t,this.parentStaff=e,this.boundingBox=new n.BoundingBox(this,t.PositionAndShape),this.skyBottomLine=new a.SkyBottomLineCalculator(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=6*this.ParentStaff.ParentInstrument.GetMusicSheet.Rules.TabStaffInterlineHeight;break;default:this.staffHeight=this.bottomLineOffset=this.ParentStaff.ParentInstrument.GetMusicSheet.Rules.TabStaffInterlineHeight*this.ParentStaff.StafflineCount}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}}get Measures(){return this.measures}set Measures(t){this.measures=t}get StaffLines(){return this.staffLines}set StaffLines(t){this.staffLines=t}get NextStaffLine(){const t=this.parentMusicSystem.StaffLines.indexOf(this);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 r.StaffLineActivitySymbol(this),e=this.PositionAndShape;t.PositionAndShape.RelativePosition=new o.PointF2D(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,n=this.Measures.length;i0||(o.default.warn("SkyBottomLineCalculator: width not > 0 in measure "+s.MeasureNumber),i=50),e.initializeHeadless(i);const n=e.getContext(),r=e.getCanvas();i=r.width;const a=r.height;t.setY(t.y+100);const h=t.getWidth();t.setWidth(i),s.format(),t.setWidth(h);try{s.draw(n)}catch(l){o.default.warn("SkyBottomLineCalculator.calculateLines.draw",l)}const c=n.getImageData(0,0,i,a),u=4,d=Math.max(Math.ceil(s.PositionAndShape.Size.width*this.mRules.SamplingUnit),1),f=new Array(d),p=new Array(d);for(let e=0;e0){f[e]=t;break}}for(let t=a;t>0;t--){const n=t*i*u+e*u;if(c.data[n+3]>0){p[e]=t;break}}}for(let e=0;e(t-Math.max(...this.mSkyLine))/r.unitInPixels+this.StaffLineParent.TopLineOffset)),this.mBottomLine=this.mBottomLine.map((t=>(t-Math.min(...this.mBottomLine))/r.unitInPixels+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=this.BottomLine.length&&(i=this.BottomLine.length-1),n<0&&(n=0),n>=this.BottomLine.length&&(n=this.BottomLine.length),this.SkyLine[i]=t.y;for(let r=i+1;r=this.BottomLine.length&&(i=this.BottomLine.length-1),n<0&&(n=0),n>=this.BottomLine.length&&(n=this.BottomLine.length),this.BottomLine[i]=t.y;for(let r=i+1;rt))}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)this.updateWithBoundingBoxRecursively(t);else{const e=t.BorderTop+t.AbsolutePosition.y,i=t.BorderBottom+t.AbsolutePosition.y;if(e<0){const i=Math.floor(t.AbsolutePosition.x+t.BorderLeft),n=Math.ceil(t.AbsolutePosition.x+t.BorderRight);this.updateInRange(this.mSkyLine,i,n,e)}else if(i>this.StaffLineParent.StaffHeight){const e=Math.floor(t.AbsolutePosition.x+t.BorderLeft),n=Math.ceil(t.AbsolutePosition.x+t.BorderRight);this.updateInRange(this.mBottomLine,e,n,i)}}}updateInRange(t,e=0,i=t.length,n=0){if(e=Math.floor(e*this.SamplingUnit),(i=Math.ceil(i*this.SamplingUnit))t.length&&(i=t.length);for(let s=e;sMath.abs(t[s])?n:t[s]}setInRange(t,e=0,i=t.length,n=0){if(e=Math.floor(e*this.SamplingUnit),(i=Math.ceil(i*this.SamplingUnit))t.length&&(i=t.length);for(let s=e;s=t.length&&(e=t.length-1),i<0&&(i=0),i>=t.length&&(i=t.length),e>=0&&i<=t.length?Math.min(...t.slice(e,i+1)):void 0):Number.MAX_VALUE}getMaxInRange(t,e,i){return e=Math.floor(e*this.SamplingUnit),i=Math.ceil(i*this.SamplingUnit),t?(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?Math.max(...t.slice(e,i+1)):void 0):Number.MIN_VALUE}get SamplingUnit(){return this.mRules.SamplingUnit}get StaffLineParent(){return this.mStaffLineParent}get SkyLine(){return this.mSkyLine}get BottomLine(){return this.mBottomLine}}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalChordSymbolContainer=void 0;const n=i(12),s=i(24),r=i(48),o=i(5),a=i(6),l=i(4);class h extends a.GraphicalObject{constructor(t,e,i,n,s,r){super(),this.chordSymbolContainer=t,this.boundingBox=new o.BoundingBox(this,e),this.rules=r,this.calculateLabel(i,s,n)}get GetChordSymbolContainer(){return this.chordSymbolContainer}get GraphicalLabel(){return this.graphicalLabel}calculateLabel(t,e,i){const o=r.ChordSymbolContainer.calculateChordText(this.chordSymbolContainer,e,i);this.graphicalLabel=new s.GraphicalLabel(new n.Label(o),t,this.rules.ChordSymbolTextAlignment,this.rules,this.boundingBox),this.graphicalLabel.PositionAndShape.RelativePosition=new l.PointF2D(this.rules.ChordSymbolRelativeXOffset,0)}}e.GraphicalChordSymbolContainer=h},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalTie=void 0,e.GraphicalTie=class{constructor(t,e,i){this.tie=t,this.startNote=e,this.endNote=i}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}}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalLyricEntry=void 0;const n=i(24),s=i(12),r=i(4),o=i(9);e.GraphicalLyricEntry=class{constructor(t,e,i,a){this.lyricsEntry=t,this.graphicalStaffEntry=e;const l=e.parentMeasure.parentSourceMeasure.Rules.LyricsAlignmentStandard;t.Text.length>=4&&t.Parent.Notes[0].Length.Denominator>4&&o.TextAlignmentEnum.LeftBottom;const h=new s.Label(t.Text);this.graphicalLabel=new n.GraphicalLabel(h,i,l,this.graphicalStaffEntry.parentMeasure.parentSourceMeasure.Rules,e.PositionAndShape),this.graphicalLabel.PositionAndShape.RelativePosition=new r.PointF2D(0,a),l===o.TextAlignmentEnum.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}}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalLyricWord=void 0,e.GraphicalLyricWord=class{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;tn.RealValue?1:n.RealValue>i.RealValue?-1:0}calculateCurve(t){const e=this.staffEntries[0],i=this.staffEntries[this.staffEntries.length-1];let s=e.findGraphicalNoteFromNote(this.slur.StartNote);!s&&this.graceStart&&(s=e.findGraphicalNoteFromGraceNote(this.slur.StartNote)),s||(s=e.findEndTieGraphicalNoteFromNoteWithStartingSlur(this.slur.StartNote,this.slur));let a=i.findGraphicalNoteFromNote(this.slur.EndNote);!a&&this.graceEnd&&(a=i.findGraphicalNoteFromGraceNote(this.slur.EndNote));const l=e.parentMeasure.ParentStaffLine,h=l.SkyBottomLineCalculator;this.calculatePlacement(h,l);const c=this.calculateStartAndEnd(s,a,l,t,h),u=c.startX,d=c.endX;let f=c.startY,p=c.endY;const m=t.SlurTangentMinAngle,b=t.SlurTangentMaxAngle;let g;if(this.placement===r.PlacementEnum.Above){f-=t.SlurNoteHeadYOffset,p-=t.SlurNoteHeadYOffset;const e=new n.PointF2D(this.staffEntries[0].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[0].PositionAndShape.RelativePosition.x,f);s?e.x+=this.staffEntries[0].PositionAndShape.BorderRight:e.x=this.staffEntries[0].parentMeasure.beginInstructionsWidth,this.graceStart&&(e.x+=i.PositionAndShape.RelativePosition.x);const r=new n.PointF2D(this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].PositionAndShape.RelativePosition.x,p);if(a?r.x+=this.staffEntries[this.staffEntries.length-1].PositionAndShape.BorderLeft:r.x=this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.RelativePosition.x+this.staffEntries[this.staffEntries.length-1].parentMeasure.PositionAndShape.Size.width,this.graceEnd&&(r.x+=i.staffEntryParent.PositionAndShape.RelativePosition.x),g=this.calculateTopPoints(e,r,l,h),0===g.length){const t=new n.PointF2D((r.x-e.x)/2+e.x,(r.y-e.y)/2+e.y);g.push(t)}const c=Math.atan((p-f)/(d-u)),y=new n.PointF2D(0,0);let S=new n.PointF2D(d-u,-(p-f));const v=o.Matrix2D.getRotationMatrix(c),x=v.getTransposeMatrix();S=v.vectorMultiplication(S);const E=this.calculateTranslatedAndRotatedPointListAbove(g,u,f,v),_=this.calculateMaxLeftSlope(E,y,S),w=this.calculateMaxRightSlope(E,y,S),T=y.y-y.x*_,M=S.y-S.x*w,P=new n.PointF2D;let L=!1;Math.abs(Math.abs(_)-Math.abs(w))<1e-4?(P.x=S.x/2,P.y=0,L=!0):(P.x=(M-T)/(_-w),P.y=_*P.x+T);const A=this.calculateHeightWidthRatio(S.x,E),C=0,I=0;let R=m,N=-m;if(!L){const t=this.calculateAngles(m,_,w,b);R=t.startAngle,N=t.endAngle}const F=this.calculateControlPoints(S.x,R,N,E,A);let B=F.startControlPoint,O=F.endControlPoint;B=x.vectorMultiplication(B),B.x+=u,B.y=-B.y+f,O=x.vectorMultiplication(O),O.x+=u,O.y=-O.y+f,this.bezierStartPt=new n.PointF2D(u,f-C),this.bezierStartControlPt=new n.PointF2D(B.x,B.y-C),this.bezierEndControlPt=new n.PointF2D(O.x,O.y-I),this.bezierEndPt=new n.PointF2D(d,p-I);const D=l.SkyLine.length,k=h.getLeftIndexForPointX(this.bezierStartPt.x,D),V=h.getLeftIndexForPointX(this.bezierEndPt.x,D),G=this.bezierEndPt.x-this.bezierStartPt.x,W=h.SamplingUnit;for(let t=k;t=k&&(l.SkyLine[n]=Math.min(l.SkyLine[n],i.y)),n++,n=k&&(l.BottomLine[n]=Math.max(l.BottomLine[n],i.y)),n++,n0)return void(this.placement=r.PlacementEnum.Above);const i=this.staffEntries[0],n=this.staffEntries[this.staffEntries.length-1],s=i.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection;if(s===n.graphicalVoiceEntries[0].parentVoiceEntry.StemDirection)this.placement=s===h.StemDirectionType.Up?r.PlacementEnum.Below:r.PlacementEnum.Above;else{let s=i.PositionAndShape.BorderLeft+i.PositionAndShape.RelativePosition.x+i.parentMeasure.PositionAndShape.RelativePosition.x,o=n.PositionAndShape.BorderRight+n.PositionAndShape.RelativePosition.x+n.parentMeasure.PositionAndShape.RelativePosition.x;this.graceStart&&(s+=n.PositionAndShape.RelativePosition.x),this.graceEnd&&(o+=n.staffEntryParent.PositionAndShape.RelativePosition.x);const a=-1*t.getSkyLineMinInRange(s,o),l=t.getBottomLineMaxInRange(s,o)-e.StaffHeight;this.placement=l>a?r.PlacementEnum.Above:r.PlacementEnum.Below}}calculateTopPoints(t,e,i,s){const r=[];let o=s.getRightIndexForPointX(t.x,i.SkyLine.length),a=s.getLeftIndexForPointX(e.x,i.SkyLine.length);o<0&&(o=0),a>=i.SkyLine.length&&(a=i.SkyLine.length-1);for(let l=o;l=i.BottomLine.length&&(a=i.BottomLine.length-1);for(let l=o;ll&&t>h&&(a+=t/70*this.rules.SlurHeightFlattenLongSlursFactorByWidth,a*=1+e/30*this.rules.SlurHeightFlattenLongSlursFactorByAngle,o/=a);const u=Math.min(.5,Math.max(.1,1.7*e/80*o*Math.pow(Math.max(r,.05),.4))),d=Math.min(.5,Math.max(.1,1.7*-i/80*o*Math.pow(Math.max(r,.05),.4))),f=new n.PointF2D;f.x=t*u*Math.cos(e*c.degreesToRadiansFactor),f.y=t*u*Math.sin(e*c.degreesToRadiansFactor);const p=new n.PointF2D;return p.x=t-t*d*Math.cos(i*c.degreesToRadiansFactor),p.y=-t*d*Math.sin(i*c.degreesToRadiansFactor),{startControlPoint:f,endControlPoint:p}}calculateAngles(t,e,i,n){let s=Math.atan(e)/c.degreesToRadiansFactor;e>0?s+=20:s-=20;let r=Math.atan(i)/c.degreesToRadiansFactor;return i<0?r-=20:r+=20,{startAngle:Math.min(Math.max(t,s),n),endAngle:Math.max(Math.min(-t,r),-n)}}}e.GraphicalSlur=c,c.degreesToRadiansFactor=Math.PI/180},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphicalCurve=void 0;const n=i(4);class s{constructor(){s.tPow3=new Array(s.bezierCurveStepSize),s.oneMinusTPow3=new Array(s.bezierCurveStepSize),s.bezierFactorOne=new Array(s.bezierCurveStepSize),s.bezierFactorTwo=new Array(s.bezierCurveStepSize);for(let t=0;t=s.bezierCurveStepSize?new n.PointF2D:new n.PointF2D(s.oneMinusTPow3[e]*this.bezierStartPt.x+s.bezierFactorOne[e]*this.bezierStartControlPt.x+s.bezierFactorTwo[e]*this.bezierEndControlPt.x+s.tPow3[e]*this.bezierEndPt.x,s.oneMinusTPow3[e]*this.bezierStartPt.y+s.bezierFactorOne[e]*this.bezierStartControlPt.y+s.bezierFactorTwo[e]*this.bezierEndControlPt.y+s.tPow3[e]*this.bezierEndPt.y)}}e.GraphicalCurve=s,s.bezierCurveStepSize=1e3},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Matrix2D=void 0;const n=i(4);class s{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 s,i=Math.cos(t),n=Math.sin(t);return e.matrix[0][0]=i,e.matrix[0][1]=-n,e.matrix[1][0]=n,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 s;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 n.PointF2D;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}}e.Matrix2D=s},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MusicSheetReader=void 0;const s=i(135),r=i(106),o=i(0),a=i(139),l=i(73),h=i(20),c=i(11),u=n(i(1)),d=i(19),f=i(19),p=i(31),m=i(74),b=i(150),g=i(7),y=i(12),S=i(151),v=i(26),x=i(154);class E{constructor(t,e=new v.EngravingRules){this.completeNumberOfStaves=0,this.pluginManager=new x.ReaderPluginManager,this.afterSheetReadingModules=t||[],this.repetitionInstructionReader=S.MusicSymbolModuleFactory.createRepetitionInstructionReader(),this.repetitionCalculator=S.MusicSymbolModuleFactory.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){return void u.default.error("MusicSheetReader.CreateMusicSheet",i)}}_removeFromArray(t,e){const i=t.indexOf(e);-1!==i&&t.splice(i,1)}trimString(t){return t.replace(/^\s+|\s+$/g,"")}_lastElement(t){return t[t.length-1]}_createMusicSheet(t,e){const i=[];let n=0;if(this.musicSheet=new s.MusicSheet,this.musicSheet.Path=e,this.musicSheet.Rules=this.rules,!t)throw new c.MusicSheetReadingException("Undefined root element");this.pushSheetLabels(t,e);const a=t.element("part-list");if(!a)throw new c.MusicSheetReadingException("Undefined partListNode");const l=t.elements("part"),u=a.elements();this.initializeReading(u,l,i);let d=!0;this.currentFraction=new o.Fraction(0,1);let f=!1,p=t.element("identification");for(p&&(p=p.element("encoding")),p&&(p=p.element("software")),void 0!==p&&"Guitar Pro 5"===p.value&&(f=!0);d;){void 0!==this.currentMeasure&&this.currentMeasure.HasEndLine&&this.rules.NewPartAndSystemAfterFinalBarline&&(n=0),this.currentMeasure=new r.SourceMeasure(this.completeNumberOfStaves,this.musicSheet.Rules);for(const t of i)try{d=d&&t.readNextXmlMeasure(this.currentMeasure,this.currentFraction,f)}catch(m){const t=h.ITextTranslation.translateText("ReaderErrorMessages/InstrumentError","Error while reading instruments.");throw new c.MusicSheetReadingException(t,m)}d&&(this.musicSheet.addMeasure(this.currentMeasure),this.checkIfRhythmInstructionsAreSetAndEqual(i),this.checkSourceMeasureForNullEntries(),n=this.setSourceMeasureDuration(i,n),E.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.repetitionInstructionReader&&(this.repetitionInstructionReader.removeRedundantInstructions(),this.repetitionCalculator&&this.repetitionCalculator.calculateRepetitions(this.musicSheet,this.repetitionInstructionReader.repetitionInstructions)),this.musicSheet.checkForInstrumentWithNoVoice(),this.musicSheet.fillStaffList();for(let s=0,r=this.afterSheetReadingModules.length;si){if(this.areRhythmInstructionsMixed(e)&&t.SymbolEnum!==f.RhythmSymbolEnum.NONE)continue;i=t.Rhythm.RealValue,n=e.indexOf(t)}}if(e.length>0&&e.lengtht.Denominator){const i=e.Denominator/t.Denominator;t.expand(i)}}checkIfMeasureIsImplicit(t,e){return!(this.previousMeasure||!t.lt(e))||!!this.previousMeasure&&o.Fraction.plus(this.previousMeasure.Duration,t).Equals(e)}allInstrumentsHaveSameDuration(t,e){let i=0;for(let n=0,s=t.length;n=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 t=i.VoiceEntries.length-1;t>=0;t--){const e=i.VoiceEntries[t];0===e.Notes.length&&(this._removeFromArray(e.ParentVoice.VoiceEntries,e),this._removeFromArray(i.VoiceEntries,e))}void 0!==i&&0===i.VoiceEntries.length&&(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,n=this.currentMeasure.VerticalSourceStaffEntryContainers[t].StaffEntries.length;in){if(!this.musicSheet.Title){const t=h.attribute("font-size").value,e=parseFloat(t);a0&&o.MidiInstrumentId!==g.MidiInstrument.Percussion&&(e.midiInstrumentID=Math.max(0,parseInt(n.value,10)-1));else if("midi-unpitched"===n.name)e.fixedKey=Math.max(0,parseInt(n.value,10));else if("volume"===n.name)try{const t=parseFloat(n.value);e.volume=t/127}catch(s){u.default.debug("ExpressionReader.readExpressionParameters","read volume",s)}else if("pan"===n.name)try{const t=parseFloat(n.value);e.pan=t/64}catch(s){u.default.debug("ExpressionReader.readExpressionParameters","read pan",s)}}catch(s){u.default.info("MusicSheetReader.createInstrumentGroups midi settings: ",s)}}}}catch(r){u.default.info("MusicSheetReader.createInstrumentGroups: ",r)}}if(0===o.SubInstruments.length){const t=new b.SubInstrument(o);o.SubInstruments.push(t)}i[t]=o,n?(n.InstrumentalGroups.push(o),this.musicSheet.Instruments.push(o)):(this.musicSheet.InstrumentalGroups.push(o),this.musicSheet.Instruments.push(o))}else if("part-group"===a.name&&"start"===a.attribute("type").value){const t=new m.InstrumentalGroup("group",this.musicSheet,n);n?n.InstrumentalGroups.push(t):this.musicSheet.InstrumentalGroups.push(t),n=t}else if("part-group"===a.name&&"stop"===a.attribute("type").value&&n){if(1===n.InstrumentalGroups.length){const t=n.InstrumentalGroups[0];n.Parent?(n.Parent.InstrumentalGroups.push(t),this._removeFromArray(n.Parent.InstrumentalGroups,n)):(this.musicSheet.InstrumentalGroups.push(t),this._removeFromArray(this.musicSheet.InstrumentalGroups,n))}n=n.Parent}}}catch(o){const t=h.ITextTranslation.translateText("ReaderErrorMessages/InstrumentError","Error while reading Instruments");throw new c.MusicSheetReadingException(t,o)}for(let a=0,l=this.musicSheet.Instruments.length;a0){const i=t[0];if(i){let t=i.element("attributes");t&&(t=t.element("staves")),t?e+=parseInt(t.value,10):e++}}}if(isNaN(e)||e<=0){const t=h.ITextTranslation.translateText("ReaderErrorMessages/StaffError","Invalid number of staves.");throw new c.MusicSheetReadingException(t)}return e}getInstrumentNumberOfStavesFromXml(t){let e=0;const i=t.element("measure");if(i){const t=i.element("attributes");let n;t&&(n=t.element("staves")),e=t&&n?parseInt(n.value,10):1}if(isNaN(e)||e<=0){const t=h.ITextTranslation.translateText("ReaderErrorMessages/StaffError","Invalid number of Staves.");throw new c.MusicSheetReadingException(t)}return e}}e.MusicSheetReader=E},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MusicSheet=e.PlaybackSettings=void 0;const s=i(0),r=i(166),o=i(136),a=i(12),l=i(51),h=i(138),c=i(26),u=i(22),d=n(i(1));class f{}e.PlaybackSettings=f;class p{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 h.MusicSheetErrors,this.staves=[],this.transpose=0,this.defaultStartTempoInBpm=0,this.drawErroneousMeasures=!1,this.hasBeenOpenedForTheFirstTime=!1,this.currentEnrolledPosition=new s.Fraction(0,1),this.playbackSettings=new f,this.playbackSettings.rhythm=new s.Fraction(4,4,0,!1),this.userStartTempoInBPM=100,this.pageWidth=120,this.MusicPartManager=new r.MusicPartManager(this),this.hasBPMInfo=!1}static getIndexFromStaff(t){return t.idInMusicSheet}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.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 a.Label(t)}get SubtitleString(){return this.subtitle?this.subtitle.text:""}set SubtitleString(t){this.Subtitle=new a.Label(t)}get ComposerString(){return this.composer?this.composer.text:""}set ComposerString(t){this.Composer=new a.Label(t)}get LyricistString(){return this.lyricist?this.lyricist.text:""}set LyricistString(t){this.Lyricist=new a.Label(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||(d.default.debug("warning: sheet.Rules was undefined. Creating new EngravingRules."),this.rules=new c.EngravingRules),this.rules}set Rules(t){this.rules=t}get SheetErrors(){return this.musicSheetErrors}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;t0){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 d.default.info("MusicSheet.FirstMeasureNumber: ",t),0}}get LastMeasureNumber(){try{return this.getLastSourceMeasure().MeasureNumber}catch(t){return d.default.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 s.Fraction.createFromFraction(t.CurrentEnrolledTimestamp)}get SheetEndTimestamp(){const t=this.getLastSourceMeasure();return s.Fraction.plus(t.AbsoluteTimestamp,t.Duration)}getSourceMeasureFromTimeStamp(t){for(let e=0,i=this.sourceMeasures.length;e0&&i.Voices[0].Visible&&t.push(i)}return t}}e.MusicSheet=p,p.defaultTitle="[no title given]"},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.RepetitionEndingPart=e.Repetition=void 0;const s=i(137),r=i(0),o=i(81),a=n(i(1));class l extends o.PartListEntry{constructor(t,e){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}SetEndingStartIndex(t,e){const i=new h(new s.SourceMusicPart(this.musicSheet2,e,e));this.endingParts.push(i);for(const s of t)try{this.endingIndexDict[s]=i,i.endingIndices.push(s),this.numberOfEndings=this.xmlMeasureList.length)return!1;this.currentMeasure=t,this.inSourceMeasureInstrumentIndex=this.musicSheet.getGlobalStaffIndexOfFirstStaff(this.instrument),this.repetitionInstructionReader&&this.repetitionInstructionReader.prepareReadingMeasure(t,this.currentXmlMeasureIndex);let o=new h.Fraction(0,1),a=new h.Fraction(0,1),l=!1;this.maxTieNoteFraction=new h.Fraction(0,1);let d=!1;try{const p=this.xmlMeasureList[this.currentXmlMeasureIndex],b=p.elements();if(t.Rules.UseXMLMeasureNumbers&&!Number.isInteger(t.MeasureNumberXML)){const e=parseInt(null===(n=p.attribute("number"))||void 0===n?void 0:n.value,10);Number.isInteger(e)&&(t.MeasureNumberXML=e)}let y;for(let n=0;n0&&(y=b[n-1]),"print"===p.name){const e=p.attribute("new-system");"yes"===(null==e?void 0:e.value)&&(t.printNewSystemXml=!0);const i=p.attribute("new-page");"yes"===(null==i?void 0:i.value)&&(t.printNewPageXml=!0)}else if("note"===p.name){let t=!0;"no"===(null===(s=p.attribute("print-object"))||void 0===s?void 0:s.value)&&(t=!1);let n=1;this.instrument.Staves.length>1&&p.element("staff")&&(n=parseInt(p.element("staff").value,10),isNaN(n)&&(m.default.debug("InstrumentReader.readNextXmlMeasure.get staff number"),n=1)),this.currentStaff=this.instrument.Staves[n-1];const r=void 0!==p.element("chord");if(p.element("voice")){const t=parseInt(p.element("voice").value,10);this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(t,n-1)}else r&&this.currentVoiceGenerator||(this.currentVoiceGenerator=this.getOrCreateVoiceGenerator(1,n-1));let l,u=0,f=new h.Fraction(0,1),b=2,g=!1;if(p.element("duration")){if(u=parseInt(p.element("duration").value,10),isNaN(u)){const t=c.ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError","Invalid Note Duration.");this.musicSheet.SheetErrors.pushMeasureError(t),m.default.debug("InstrumentReader.readNextXmlMeasure",t);continue}if(f=new h.Fraction(u,4*this.divisions),0===u?f=this.getNoteDurationFromTypeNode(p):l=this.getNoteDurationFromTypeNode(p),p.element("time-modification")){f=this.getNoteDurationForTuplet(p);const t=p.element("time-modification");(null==t?void 0:t.element("normal-notes"))&&(b=parseInt(t.element("normal-notes").value,10)),g=!0}}const y=void 0!==p.element("rest"),S=p.element("notations"),E=void 0!==p.element("grace")||0===u||r&&d;let _=!1,w=!1;if(E){const t=p.element("grace");t&&t.attributes()&&t.attribute("slash")&&"yes"===t.attribute("slash").value&&(_=!0),f=this.getNoteDurationFromTypeNode(p);const e=p.element("notations");e&&e.element("slur")&&(w=!0)}let T=!1;p.element("cue")&&(T=!0);const M=p.element("type");let P=x.NoteType.UNDEFINED;if(M){const t=M.attribute("size");"cue"===(null==t?void 0:t.value)&&(T=!0),P=x.NoteTypeHandler.StringToNoteType(M.value)}let L,A=v.StemDirectionType.Undefined;const C=p.element("stem");if(C){switch(C.value){case"down":A=v.StemDirectionType.Down;break;case"up":A=v.StemDirectionType.Up;break;case"double":A=v.StemDirectionType.Double;break;case"none":A=v.StemDirectionType.None;break;default:A=v.StemDirectionType.Undefined}const t=C.attribute("color");t&&(L=this.parseXmlColor(t.value))}let I,R=0,N=!1;if(S){const t=S.element("ornaments");if(t){const e=t.element("tremolo");if(e){const t=e.attribute("type");if(t&&"single"===t.value){const t=parseInt(e.value,10);t>0&&(R=t)}}const i=t.element("wavy-line");if(void 0!==i){const t=i.attribute("type");t&&"start"===t.value&&(N=!0)}}}const F=p.element("notehead");if(F){const t=F.attribute("color");t&&(I=this.parseXmlColor(t.value))}let B;const O=p.attribute("color");O&&(B=this.parseXmlColor(O.value),I||(I=B),L||(L=B));let D=o.clone();r&&(D=a.clone()),this.currentStaffEntry=this.currentMeasure.findOrCreateStaffEntry(D,this.inSourceMeasureInstrumentIndex+n-1,this.currentStaff).staffEntry,(!this.currentVoiceGenerator.hasVoiceEntry()||!r&&!E&&!d||E&&!d||E&&!r||!E&&d)&&this.currentVoiceGenerator.createVoiceEntry(D,this.currentStaffEntry,!y&&!E,E,_,w),E||r||(a=o.clone(),o.Add(f)),r&&void 0!==this.currentStaffEntry&&this.currentStaffEntry.ParentStaff!==this.currentStaff&&(this.currentStaffEntry=this.currentVoiceGenerator.checkForStaffEntryLink(this.inSourceMeasureInstrumentIndex+n-1,this.currentStaff,this.currentStaffEntry,this.currentMeasure));const k=void 0!==this.currentStaffEntry&&void 0!==this.currentStaffEntry.Timestamp&&this.currentStaffEntry.Timestamp.Equals(new h.Fraction(0,1))&&!this.currentStaffEntry.hasNotes();if(this.saveAbstractInstructionList(this.instrument.Staves.length,k),0!==this.openChordSymbolContainers.length&&(this.currentStaffEntry.ChordContainers=this.openChordSymbolContainers,this.openChordSymbolContainers=[]),this.activeRhythm,g||E||(f=new h.Fraction(u,4*this.divisions)),this.currentVoiceGenerator.read(p,f,l,P,b,y,this.currentStaffEntry,this.currentMeasure,e,this.maxTieNoteFraction,r,i,t,T,E,A,R,L,I,N),void 0!==S&&S.element("dynamics")){const t=this.expressionReaders[this.readExpressionStaffNumber(p)-1];t&&(t.readExpressionParameters(p,this.instrument,this.divisions,o,a,this.currentMeasure.MeasureNumber,!1),t.read(p,this.currentMeasure,a))}d=E}else if("attributes"===p.name){const e=p.element("divisions");if(e&&(this.divisions=parseInt(e.value,10),isNaN(this.divisions))){const t=c.ITextTranslation.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(m.default.debug("InstrumentReader.readNextXmlMeasure",t),this.divisions=this.readDivisionsFromNotes(),!(this.divisions>0))throw l=!0,new u.MusicSheetReadingException(t+this.instrument.Name);this.musicSheet.SheetErrors.push(t+this.instrument.Name)}if(!p.element("divisions")&&0===this.divisions&&0===this.currentXmlMeasureIndex){const t=c.ITextTranslation.translateText("ReaderErrorMessages/DivisionError","Invalid divisions value at Instrument: ");if(this.divisions=this.readDivisionsFromNotes(),!(this.divisions>0))throw l=!0,new u.MusicSheetReadingException(t+this.instrument.Name);this.musicSheet.SheetErrors.push(t+this.instrument.Name)}this.addAbstractInstruction(p,i,y),o.Equals(new h.Fraction(0,1))&&this.isAttributesNodeAtBeginOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],p)&&this.saveAbstractInstructionList(this.instrument.Staves.length,!0),this.isAttributesNodeAtEndOfMeasure(this.xmlMeasureList[this.currentXmlMeasureIndex],p)&&this.saveClefInstructionAtEndOfMeasure();const n=p.element("staff-details");if(n){const t=n.element("staff-lines");if(t){let e=1;const i=n.attribute("number");i&&(e=parseInt(i.value,10)),this.instrument.Staves[e-1].StafflineCount=parseInt(t.value,10)}}const s=p.element("measure-style");if(s){const e=s.element("multiple-rest");if(e){const i=e.value;let n=0;try{n=Number.parseInt(i,10),void 0!==t.multipleRestMeasures&&n!==t.multipleRestMeasures?t.multipleRestMeasures=0:t.multipleRestMeasures=n}catch(f){ ("multirest parse error: "+f)}}}}else if("forward"===p.name){const t=parseInt(p.element("duration").value,10);o.Add(new h.Fraction(t,4*this.divisions))}else if("backup"===p.name){const t=parseInt(p.element("duration").value,10);o.Sub(new h.Fraction(t,4*this.divisions)),o.IsNegative()&&(o=new h.Fraction(0,1)),a.Sub(new h.Fraction(t,4*this.divisions)),a.IsNegative()&&(a=new h.Fraction(0,1))}else if("direction"===p.name){const t=p.element("direction-type");let e=Math.min(1,o.RealValue);void 0!==this.activeRhythm&&this.activeRhythm.Rhythm&&(e/=this.activeRhythm.Rhythm.RealValue);let i=!1;if(this.repetitionInstructionReader&&(i=this.repetitionInstructionReader.handleRepetitionInstructionsFromWordsOrSymbols(t,e)),!i){let e=this.expressionReaders[0];const i=this.readExpressionStaffNumber(p)-1;i0?this.musicSheet.SourceMeasures[0]:this.currentMeasure;const i=new o.ClefInstruction(d.ClefEnum.G,0,2);let n;e.FirstInstructionsStaffEntries[t]?(n=e.FirstInstructionsStaffEntries[t],n.removeFirstInstructionOfTypeClefInstruction()):(n=new r.SourceStaffEntry(void 0,void 0),e.FirstInstructionsStaffEntries[t]=n),i.Parent=n,n.Instructions.splice(0,0,i)}createDefaultKeyInstruction(){let t;t=this.musicSheet.SourceMeasures.length>0?this.musicSheet.SourceMeasures[0]:this.currentMeasure;const e=new a.KeyInstruction(void 0,0,p.KeyEnum.major);for(let i=this.inSourceMeasureInstrumentIndex;i0&&"backup"===i[n-1].name)return!0;let s=-1;for(let r=0;r0||s<0}isAttributesNodeAtEndOfMeasure(t,e){const i=t.elements().slice();let n=0;for(let r=0;rs}getNoteDurationFromTypeNode(t){const e=t.element("type");if(e){const t=e.value;return x.NoteTypeHandler.getNoteDurationFromType(t)}return new h.Fraction(0,4*this.divisions)}addAbstractInstruction(t,e,i){if(t.element("divisions")&&1===t.elements().length)return;const n=t.element("transpose");if(n){const t=n.element("chromatic");t&&(this.instrument.PlaybackTranspose=parseInt(t.value,10))}const s=t.elements("clef");let r;if(s.length>0)for(let a=0,l=s.length;a using default clef line."),this.musicSheet.SheetErrors.pushMeasureError(r),n=2,m.default.debug("InstrumentReader.addAbstractInstruction",r,u)}const p=t.element("sign");if(p)try{e=d.ClefEnum[p.value],o.ClefInstruction.isSupportedClef(e)||(r=c.ITextTranslation.translateText("ReaderErrorMessages/ClefError","Unsupported clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(r),e=d.ClefEnum.G,n=2),e===d.ClefEnum.TAB&&(h=-1)}catch(u){r=c.ITextTranslation.translateText("ReaderErrorMessages/ClefError","Invalid clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(r),e=d.ClefEnum.G,n=2,m.default.debug("InstrumentReader.addAbstractInstruction",r,u)}const b=t.element("clef-octave-change");if(b)try{h=parseInt(b.value,10)}catch(u){r=c.ITextTranslation.translateText("ReaderErrorMessages/ClefOctaveError","Invalid clef octave found -> using default clef octave."),this.musicSheet.SheetErrors.pushMeasureError(r),h=0}if(t.hasAttributes&&"number"===t.attributes()[0].name)try{l=parseInt(t.attributes()[0].value,10),l>this.currentClefNumber&&(l=this.currentClefNumber),this.currentClefNumber=l+1}catch(u){r=c.ITextTranslation.translateText("ReaderErrorMessages/ClefError","Invalid clef found -> using default clef."),this.musicSheet.SheetErrors.pushMeasureError(r),l=1,this.currentClefNumber=l+1}if("forward"!==(null==i?void 0:i.name)){const t=new o.ClefInstruction(e,h,n);this.abstractInstructions.push([l,t])}}if(void 0!==t.element("key")&&this.instrument.MidiInstrumentId!==b.MidiInstrument.Percussion){let e=0;const i=t.element("key").element("fifths");if(i)try{e=parseInt(i.value,10)}catch(g){r=c.ITextTranslation.translateText("ReaderErrorMessages/KeyError","Invalid key found -> set to default."),this.musicSheet.SheetErrors.pushMeasureError(r),e=0,m.default.debug("InstrumentReader.addAbstractInstruction",r,g)}let n=p.KeyEnum.none,s=t.element("key");if(s&&(s=s.element("mode")),s)try{n=p.KeyEnum[s.value]}catch(g){r=c.ITextTranslation.translateText("ReaderErrorMessages/KeyError","Invalid key found -> set to default."),this.musicSheet.SheetErrors.pushMeasureError(r),n=p.KeyEnum.major,m.default.debug("InstrumentReader.addAbstractInstruction",r,g)}const o=new a.KeyInstruction(void 0,e,n);this.abstractInstructions.push([1,o])}if(t.element("time")){const e=t.element("time");let i=f.RhythmSymbolEnum.NONE,n=!0;if(void 0!==e&&e.hasAttributes){const t=e.attribute("symbol");t&&("common"===t.value?i=f.RhythmSymbolEnum.COMMON:"cut"===t.value&&(i=f.RhythmSymbolEnum.CUT));const s=e.attribute("print-object");s&&"no"===s.value&&(n=!1)}let s=0,o=0;const a=e&&void 0!==e.element("senza-misura"),u=t.elements("time"),d=[],p=[];for(let t=0,r=u.length;t0&&void 0!==p&&d.length===p.length){const t=d.length,e=new Array(t);let i=0;for(let n=0;n set to default."),this.musicSheet.SheetErrors.pushMeasureError(r),s=4,o=4,m.default.debug("InstrumentReader.addAbstractInstruction",r,g)}const e=new l.RhythmInstruction(new h.Fraction(s,o,0,!1),i);e.PrintObject=n,this.abstractInstructions.push([1,e])}}}saveAbstractInstructionList(t,e){for(let i=this.abstractInstructions.length-1;i>=0;i--){const n=this.abstractInstructions[i],s=n[0],h=n[1];if(h instanceof o.ClefInstruction){const t=h;if(0===this.currentXmlMeasureIndex||s<=this.activeClefs.length&&t!==this.activeClefs[s-1])if(e||void 0===this.currentStaffEntry||this.currentStaffEntry.hasNotes()||s-1!==this.instrument.Staves.indexOf(this.currentStaffEntry.ParentStaff)){if(e){let e;if(this.currentMeasure){const n=t,a=this.inSourceMeasureInstrumentIndex+s-1,l=this.currentMeasure.FirstInstructionsStaffEntries[a];if(0===this.currentXmlMeasureIndex)if(l)if(void 0===this.currentMeasure.FirstInstructionsStaffEntries[a]||l.Instructions[0]instanceof o.ClefInstruction){const t=new r.SourceStaffEntry(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[a]=t,n.Parent=t,t.Instructions.push(n)}else e=l,n.Parent=e,e.removeFirstInstructionOfTypeClefInstruction(),e.Instructions.splice(0,0,n),this.activeClefsHaveBeenInitialized[s-1]=!0;else e=new r.SourceStaffEntry(void 0,void 0),this.currentMeasure.FirstInstructionsStaffEntries[a]=e,n.Parent=e,e.Instructions.push(n),this.activeClefsHaveBeenInitialized[s-1]=!0;else if(this.activeClefsHaveBeenInitialized[s-1]){const t=new r.SourceStaffEntry(void 0,void 0);this.previousMeasure.LastInstructionsStaffEntries[a]=t,n.Parent=t,t.Instructions.push(n)}else{const t=this.musicSheet.SourceMeasures[0];t.FirstInstructionsStaffEntries[a]?(e=t.FirstInstructionsStaffEntries[a],e.removeFirstInstructionOfTypeClefInstruction()):e=new r.SourceStaffEntry(void 0,void 0),n.Parent=e,e.Instructions.splice(0,0,n),this.activeClefsHaveBeenInitialized[s-1]=!0}this.activeClefs[s-1]=t,this.abstractInstructions.splice(i,1)}}}else{const e=t;e.Parent=this.currentStaffEntry,this.currentStaffEntry.removeFirstInstructionOfTypeClefInstruction(),this.currentStaffEntry.Instructions.push(e),this.activeClefs[s-1]=t,this.abstractInstructions.splice(i,1)}else s<=this.activeClefs.length&&t===this.activeClefs[s-1]&&this.abstractInstructions.splice(i,1)}if(h instanceof a.KeyInstruction){const e=h;if(this.activeKey&&this.activeKey.Key===e.Key)this.abstractInstructions.splice(i,1);else{let n;if(this.activeKey=e,this.abstractInstructions.splice(i,1),this.activeKeyHasBeenInitialized?n=this.currentMeasure:(this.activeKeyHasBeenInitialized=!0,n=this.currentXmlMeasureIndex>0?this.musicSheet.SourceMeasures[0]:this.currentMeasure),n)for(let i=this.inSourceMeasureInstrumentIndex;i=0;t--){const e=this.abstractInstructions[t][0],i=this.abstractInstructions[t][1];if(i instanceof o.ClefInstruction){const n=i;if(!this.activeClefs[e-1]||n.ClefType!==this.activeClefs[e-1].ClefType||n.ClefType===this.activeClefs[e-1].ClefType&&n.Line!==this.activeClefs[e-1].Line){const i=new r.SourceStaffEntry(void 0,void 0);this.currentMeasure.LastInstructionsStaffEntries[this.inSourceMeasureInstrumentIndex+e-1]=i;const s=n;s.Parent=i,i.Instructions.push(s),this.activeClefs[e-1]=n,this.abstractInstructions.splice(t,1)}}}}getNoteDurationForTuplet(t){let e=new h.Fraction(0,1);const i=this.getNoteDurationFromTypeNode(t);if(t.element("time-modification")){const n=t.element("time-modification");if(n&&void 0!==n.element("actual-notes")&&n.element("normal-notes")){const t=n.element("actual-notes"),s=n.element("normal-notes");if(void 0!==t&&s){const n=parseInt(t.value,10),r=parseInt(s.value,10);e=new h.Fraction(r*i.Numerator,n*i.Denominator)}}}return e}readExpressionStaffNumber(t){let e=1;if(t.element("staff")){const n=t.element("staff");if(n)try{e=parseInt(n.value,10)}catch(i){const t=c.ITextTranslation.translateText("ReaderErrorMessages/ExpressionStaffError","Invalid Expression staff number -> set to default.");this.musicSheet.SheetErrors.pushMeasureError(t),e=1,m.default.debug("InstrumentReader.readExpressionStaffNumber",t,i)}}return e}readDivisionsFromNotes(){let t=0,e=this.currentXmlMeasureIndex,i=!1;for(;!i;){const s=this.xmlMeasureList[e].elements();for(let e=0,r=s.length;e0){i=!0;break}}if(0===t&&(e++,e===this.xmlMeasureList.length)){const t=c.ITextTranslation.translateText("ReaderErrorMEssages/DivisionsError","Invalid divisions value at Instrument: ");throw new u.MusicSheetReadingException(t+this.instrument.Name)}}return t}}},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.VoiceGenerator=void 0;const s=i(41),r=i(51),o=i(14),a=i(36),l=i(31),h=i(141),c=i(107),u=i(67),d=i(142),f=i(0),p=i(20),m=i(143),b=i(11),g=i(2),y=i(2),S=i(144),v=n(i(1)),x=i(2),E=i(34),_=i(145),w=i(76),T=i(80),M=i(39),P=i(172),L=i(3);e.VoiceGenerator=class{constructor(t,e,i,n,o){this.openBeams=[],this.beamNumberOffset=0,this.openTieDict={},this.currentOctaveShift=0,this.tupletDict={},this.openTupletNumber=0,this.staff=e,this.instrument=e.ParentInstrument,this.musicSheet=this.instrument.GetMusicSheet,this.slurReader=n,this.pluginManager=t,this.voice=o?new s.LinkedVoice(this.instrument,i,o):new r.Voice(this.instrument,i),this.instrument.Voices.push(this.voice),this.staff.Voices.push(this.voice),this.lyricsReader=new m.LyricsReader(this.musicSheet),this.articulationReader=new _.ArticulationReader}get GetVoice(){return this.voice}get OctaveShift(){return this.currentOctaveShift}set OctaveShift(t){this.currentOctaveShift=t}createVoiceEntry(t,e,i,n=!1,s=!1,r=!1){this.currentVoiceEntry=new o.VoiceEntry(t.clone(),this.voice,e,n,s,r),i&&this.voice.VoiceEntries.push(this.currentVoiceEntry)}read(t,e,i,n,s,r,o,a,l,h,c,d,m,b,g,y,S,v,x,E){this.currentStaffEntry=o,this.currentMeasure=a;try{this.currentNote=r?this.addRestNote(t.element("rest"),e,n,s,m,b,x):this.addSingleNote(t,e,n,i,s,c,d,m,b,g,y,S,v,x,E);const o=t.elements("lyric");void 0!==this.lyricsReader&&o&&(this.lyricsReader.addLyricEntry(o,this.currentVoiceEntry),this.voice.Parent.HasLyrics=!0);let a=!1;const p=t.element("notations");if(p){this.articulationReader&&this.readArticulations(p,this.currentVoiceEntry,this.currentNote);const e=p.elements("slur");void 0!==this.slurReader&&e.length>0&&!this.currentNote.ParentVoiceEntry.IsGrace&&this.slurReader.addSlur(e,this.currentNote);const i=p.elements("tuplet");i.length>0&&(this.openTupletNumber=this.addTuplet(t,i),a=!0);const n=p.element("arpeggiate");if(void 0!==n){let t;if(this.currentVoiceEntry.Arpeggio)t=this.currentVoiceEntry.Arpeggio;else{let e=!1;for(const i of this.currentStaffEntry.VoiceEntries)if(i.Arpeggio){e=!0,t=i.Arpeggio;break}if(!e){let e=T.ArpeggioType.ARPEGGIO_DIRECTIONLESS;const i=n.attribute("direction");if(i)switch(i.value){case"up":e=T.ArpeggioType.ROLL_UP;break;case"down":e=T.ArpeggioType.ROLL_DOWN;break;default:e=T.ArpeggioType.ARPEGGIO_DIRECTIONLESS}t=new T.Arpeggio(this.currentVoiceEntry,e),this.currentVoiceEntry.Arpeggio=t}}t.addNote(this.currentNote)}const s=p.elements("tied");s.length>0&&this.addTie(s,l,h,u.TieTypes.SIMPLE);const r=p.elements("slide");r.length>0&&this.addTie(r,l,h,u.TieTypes.SLIDE);const o=p.element("technical");if(o){const t=o.elements("hammer-on");t.length>0&&this.addTie(t,l,h,u.TieTypes.HAMMERON);const e=o.elements("pull-off");e.length>0&&this.addTie(e,l,h,u.TieTypes.PULLOFF)}const c=this.openTieDict;for(const t in c)if(c.hasOwnProperty(t)){const e=c[t];f.Fraction.plus(e.StartNote.ParentStaffEntry.Timestamp,e.Duration).lt(this.currentStaffEntry.Timestamp)&&delete c[t]}}void 0===t.element("time-modification")||a||this.handleTimeModificationNode(t)}catch(_){const t=p.ITextTranslation.translateText("ReaderErrorMessages/NoteError","Ignored erroneous Note.");this.musicSheet.SheetErrors.pushMeasureError(t)}return this.currentNote}checkForStaffEntryLink(t,e,i,n){const s=new S.StaffEntryLink(this.currentVoiceEntry);s.LinkStaffEntries.push(i),i.Link=s;const r=this.currentVoiceEntry.Timestamp.clone(),o=n.getVerticalContainerByTimestamp(r);return(i=o.StaffEntries[t])||(i=new l.SourceStaffEntry(o,e),o.StaffEntries[t]=i),i.VoiceEntries.push(this.currentVoiceEntry),s.LinkStaffEntries.push(i),i.Link=s,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];f.Fraction.plus(i.StartNote.ParentStaffEntry.Timestamp,i.Duration).lt(i.StartNote.SourceMeasure.Duration)&&delete t[e]}}hasVoiceEntry(){return void 0!==this.currentVoiceEntry}readArticulations(t,e,i){const n=t.element("articulations");n&&this.articulationReader.addArticulationExpression(n,e);const s=t.element("fermata");s&&this.articulationReader.addFermata(s,e);const r=t.element("technical");r&&this.articulationReader.addTechnicalArticulations(r,e,i);const o=t.element("ornaments");o&&this.articulationReader.addOrnament(o,e)}addSingleNote(t,e,i,n,s,r,l,h,c,u,d,m,S,E,_){let T,M,L,A=0,C=g.AccidentalEnum.NONE,I=y.NoteEnum.C,R=y.NoteEnum.C,N=0,F=0;const B=t.elements();for(let o=0,a=B.length;o0&&this.openBeams.last().ExtendedNoteList.push(m),m}addNoteInfo(t,e,i,n,s,r,o,a,l){t.NoteTypeXml=e,t.PrintObject=i,t.IsCueNote=n,t.NormalNotes=s,t.displayStepUnpitched=r,t.displayOctaveUnpitched=o,t.NoteheadColorXml=a,t.NoteheadColor=a}createBeam(t,e){var i;try{const n=t.element("beam");let s;if(void 0!==n&&n.hasAttributes&&(s=n.attribute("number")),s){let n=parseInt(s.value,10);const r=t.elements("beam"),o=r[0].value;r&&("begin"===o?(n===(null===(i=this.openBeams.last())||void 0===i?void 0:i.BeamNumber)?(this.beamNumberOffset++,n+=this.beamNumberOffset):this.openBeams.last()&&this.handleOpenBeam(),this.openBeams.push(new h.Beam(n,this.beamNumberOffset))):n+=this.beamNumberOffset);let a=!1;if(!(n>0&&n<=this.openBeams.length&&this.openBeams[n-1]))return void v.default.debug("[OSMD] invalid beamnumber");for(let t=0,e=this.openBeams[n-1].Notes.length;t1){let n=t.element("time-modification");n&&(n=n.element("actual-notes"));const s=e;for(let e=0,r=s.length;e1&&this.openTupletNumber--),this.tupletDict[e]=a;const l=[];l.push(this.currentNote),a.Notes.push(l),a.Fractions.push(this.getTupletNoteDurationFromType(t)),this.currentNote.NoteTuplet=a,this.openTupletNumber=e}else if("stop"===a.value){let e=1;r.attribute("number")&&(e=parseInt(r.attribute("number").value,10));const i=this.tupletDict[e];if(i){const n=[];n.push(this.currentNote),i.Notes.push(n),i.Fractions.push(this.getTupletNoteDurationFromType(t)),this.currentNote.NoteTuplet=i,delete this.tupletDict[e],0===Object.keys(this.tupletDict).length?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--}}}}}else if(e[0]){const n=e[0];if(n.hasAttributes){const e=n.attribute("type").value;let s=1;n.attribute("number")&&(s=parseInt(n.attribute("number").value,10));const r=isNaN(s),o=n.attribute("bracket");o&&"yes"===o.value&&(i=!0);const a=n.attribute("placement"),l=a&&"below"===a.value;if("start"===e){let e=0,n=t.element("time-modification");if(n&&(n=n.element("actual-notes")),n&&(e=parseInt(n.value,10),isNaN(e))){const t=p.ITextTranslation.translateText("ReaderErrorMessages/TupletNoteDurationError","Invalid tuplet note duration.");throw this.musicSheet.SheetErrors.pushMeasureError(t),new b.MusicSheetReadingException(t)}r&&(this.openTupletNumber++,s=this.openTupletNumber);let o=this.tupletDict[s];o||(o=this.tupletDict[s]=new d.Tuplet(e,i),o.tupletLabelNumberPlacement=l?L.PlacementEnum.Below:L.PlacementEnum.Above);const a=[];a.push(this.currentNote),o.Notes.push(a),o.Fractions.push(this.getTupletNoteDurationFromType(t)),this.currentNote.NoteTuplet=o,this.openTupletNumber=s}else if("stop"===e){r&&(s=this.openTupletNumber);const e=this.tupletDict[this.openTupletNumber];if(e){const i=[];i.push(this.currentNote),e.Notes.push(i),e.Fractions.push(this.getTupletNoteDurationFromType(t)),this.currentNote.NoteTuplet=e,0===Object.keys(this.tupletDict).length?this.openTupletNumber=0:Object.keys(this.tupletDict).length>1&&this.openTupletNumber--,delete this.tupletDict[s]}}}}return this.openTupletNumber}handleTimeModificationNode(t){if(this.tupletDict[this.openTupletNumber])try{const e=this.tupletDict[this.openTupletNumber],i=E.CollectionUtil.last(e.Notes);let n;i[0].ParentVoiceEntry.Timestamp.Equals(this.currentVoiceEntry.Timestamp)?n=i:(n=[],e.Notes.push(n),e.Fractions.push(this.getTupletNoteDurationFromType(t))),n.push(this.currentNote),this.currentNote.NoteTuplet=e}catch(e){const t=p.ITextTranslation.translateText("ReaderErrorMessages/TupletNumberError","Invalid tuplet number.");throw this.musicSheet.SheetErrors.pushMeasureError(t),e}else if(this.currentVoiceEntry.Notes.length>0){const t=this.currentVoiceEntry.Notes[0];if(t.NoteTuplet){const e=t.NoteTuplet;E.CollectionUtil.last(e.Notes).push(this.currentNote),this.currentNote.NoteTuplet=e}}}addTie(t,e,i,n){if(t)if(1===t.length){const e=t[0];if(void 0!==e&&e.attributes()){const t=e.attribute("type").value;try{if("start"===t){const t=this.findCurrentNoteInTieDict(this.currentNote);t<0&&delete this.openTieDict[t];const e=this.getNextAvailableNumberForTie(),i=new c.Tie(this.currentNote,n);this.openTieDict[e]=i}else if("stop"===t){const t=this.findCurrentNoteInTieDict(this.currentNote),e=this.openTieDict[t];e&&(e.AddNote(this.currentNote),delete this.openTieDict[t])}}catch(s){const t=p.ITextTranslation.translateText("ReaderErrorMessages/TieError","Error while reading tie.");this.musicSheet.SheetErrors.pushMeasureError(t)}}}else if(2===t.length){const t=this.findCurrentNoteInTieDict(this.currentNote);t>=0&&this.openTieDict[t].AddNote(this.currentNote)}}getNextAvailableNumberForTie(){const t=Object.keys(this.openTieDict);if(0===t.length)return 1;t.sort(((t,e)=>+t-+e));for(let e=0;e=0;e--)for(let i=0;i0)for(let t=s;t1&&(f=parseInt(t[1],10))}catch(a){const t=r.ITextTranslation.translateText("ReaderErrorMessages/LyricVerseNumberError","Invalid lyric verse number");this.musicSheet.SheetErrors.pushMeasureError(t);continue}}if("single"===t||"end"===t){if(this.openLyricWords[f]){this.currentLyricWord=this.openLyricWords[f];const t=this.currentLyricWord.Syllables.length;d=new s.LyricsEntry(h,f,this.currentLyricWord,e,t),this.currentLyricWord.Syllables.push(d),delete this.openLyricWords[f],this.currentLyricWord=void 0}else d=new s.LyricsEntry(h,f,void 0,e);d.extend=void 0!==c.element("extend")}else if("begin"===t)this.openLyricWords[f]&&(delete this.openLyricWords[f],this.currentLyricWord=void 0),this.currentLyricWord=new n.LyricWord,this.openLyricWords[f]=this.currentLyricWord,d=new s.LyricsEntry(h,f,this.currentLyricWord,e,0),this.currentLyricWord.Syllables.push(d);else if("middle"===t)if(this.openLyricWords[f]){this.currentLyricWord=this.openLyricWords[f];const t=this.currentLyricWord.Syllables.length;d=new s.LyricsEntry(h,f,this.currentLyricWord,e,t),this.currentLyricWord.Syllables.push(d)}else d=new s.LyricsEntry(h,f,void 0,e);d&&(e.LyricsEntries[f]||(e.LyricsEntries.setValue(f,d),(null===(o=null===(i=e.ParentSourceStaffEntry)||void 0===i?void 0:i.VerticalContainerParent)||void 0===o?void 0:o.ParentMeasure)&&(e.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.hasLyrics=!0)),e.ParentVoice.Parent.LyricVersesNumbers[f]||e.ParentVoice.Parent.LyricVersesNumbers.push(f))}}}catch(l){const t=r.ITextTranslation.translateText("ReaderErrorMessages/LyricError","Error while reading lyric entry.");this.musicSheet.SheetErrors.pushMeasureError(t);continue}}e.ParentVoice.Parent.LyricVersesNumbers=e.ParentVoice.Parent.LyricVersesNumbers.filter(((t,e,i)=>i.indexOf(t)===e))}}}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.StaffEntryLink=void 0,e.StaffEntryLink=class{constructor(t){this.linkStaffEntries=[],this.voiceEntry=t}get GetVoiceEntry(){return this.voiceEntry}get LinkStaffEntries(){return this.linkStaffEntries}set LinkStaffEntries(t){this.linkStaffEntries=t}}},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.ArticulationReader=void 0;const s=i(14),r=n(i(1)),o=i(146),a=i(50),l=i(3),h=i(2),c=i(171);e.ArticulationReader=class{getAccEnumFromString(t){switch(t){case"sharp":return h.AccidentalEnum.SHARP;case"flat":return h.AccidentalEnum.FLAT;case"natural":return h.AccidentalEnum.NATURAL;case"double-sharp":case"sharp-sharp":return h.AccidentalEnum.DOUBLESHARP;case"double-flat":case"flat-flat":return h.AccidentalEnum.DOUBLEFLAT;case"quarter-sharp":return h.AccidentalEnum.QUARTERTONESHARP;case"quarter-flat":return h.AccidentalEnum.QUARTERTONEFLAT;case"triple-sharp":return h.AccidentalEnum.TRIPLESHARP;case"triple-flat":return h.AccidentalEnum.TRIPLEFLAT;default:return h.AccidentalEnum.NONE}}addArticulationExpression(t,e){var i,n;if(void 0!==t&&t.elements().length>0){const a=t.elements();for(let t=0,h=a.length;t0&&e.Articulations[0].articulationEnum!==s.ArticulationEnum.staccato&&e.Articulations.splice(0,0,a),"strongaccent"===u){const t=null===(n=null==h?void 0:h.attribute("type"))||void 0===n?void 0:n.value;"up"===t?a.articulationEnum=s.ArticulationEnum.marcatoup:"down"===t&&(a.articulationEnum=s.ArticulationEnum.marcatodown)}e.hasArticulation(a)||e.Articulations.push(a)}}catch(o){const t="Invalid note articulation.";return void r.default.debug("addArticulationExpression",t,o)}}}}addFermata(t,e){var i;let n=s.ArticulationEnum.fermata;t.attributes().length>0&&t.attribute("type")&&"inverted"===t.attribute("type").value&&(n=s.ArticulationEnum.invertedfermata);let r=l.PlacementEnum.Above;"below"===(null===(i=t.attribute("placement"))||void 0===i?void 0:i.value)&&(r=l.PlacementEnum.Below),e.Articulations.push(new c.Articulation(n,r))}addTechnicalArticulations(t,e,i){var n,r;const a={bend:s.ArticulationEnum.bend,"down-bow":s.ArticulationEnum.downbow,"open-string":s.ArticulationEnum.naturalharmonic,"snap-pizzicato":s.ArticulationEnum.snappizzicato,stopped:s.ArticulationEnum.lefthandpizzicato,"up-bow":s.ArticulationEnum.upbow};for(const s in a){if(!a.hasOwnProperty(s))continue;const i=a[s],o=t.element(s);if(o){let t;"above"===(null===(n=o.attribute("placement"))||void 0===n?void 0:n.value)&&(t=l.PlacementEnum.Above),"below"===(null===(r=o.attribute("placement"))||void 0===r?void 0:r.value)&&(t=l.PlacementEnum.Below);const s=new c.Articulation(i,t);e.hasArticulation(s)||e.Articulations.push(s)}}const h=t.element("fingering");if(h){const t=this.createTechnicalInstruction(h,i);t.type=o.TechnicalInstructionType.Fingering,i.Fingering=t,e.TechnicalInstructions.push(t)}const u=t.element("string");if(u){const t=this.createTechnicalInstruction(u,i);t.type=o.TechnicalInstructionType.String,i.StringInstruction=t,e.TechnicalInstructions.push(t)}}createTechnicalInstruction(t,e){const i=new o.TechnicalInstruction;i.sourceNote=e,i.value=t.value;const n=t.attribute("placement");return i.placement=this.getPlacement(n),i}getPlacement(t,e=l.PlacementEnum.NotYetDefined){if(e!==l.PlacementEnum.NotYetDefined)return e;if(!t)return l.PlacementEnum.NotYetDefined;switch(t.value){case"above":return l.PlacementEnum.Above;case"below":return l.PlacementEnum.Below;case"left":return l.PlacementEnum.Left;case"right":return l.PlacementEnum.Right;default:return l.PlacementEnum.NotYetDefined}}addOrnament(t,e){if(t){let i;const n={"delayed-inverted-turn":a.OrnamentEnum.DelayedInvertedTurn,"delayed-turn":a.OrnamentEnum.DelayedTurn,"inverted-mordent":a.OrnamentEnum.InvertedMordent,"inverted-turn":a.OrnamentEnum.InvertedTurn,mordent:a.OrnamentEnum.Mordent,"trill-mark":a.OrnamentEnum.Trill,turn:a.OrnamentEnum.Turn};for(const e in n){if(!n.hasOwnProperty(e))continue;const s=t.element(e);if(s){i=new a.OrnamentContainer(n[e]);const t=s.attribute("placement");t&&"below"===t.value&&(i.placement=l.PlacementEnum.Below)}}if(i){const n=t.elements("accidental-mark");if(n){let t=l.PlacementEnum.Below,e=h.AccidentalEnum.NONE;const s=n;for(let n=0,r=s.length;n0?n.RealValue>0?(h=s.Fraction.multiply(s.Fraction.minus(n,r),h),this.directionTimestamp=s.Fraction.plus(h,n)):this.directionTimestamp=s.Fraction.createFromFraction(h):this.offsetDivisions<0&&(n.RealValue>0?(h=s.Fraction.multiply(s.Fraction.minus(n,r),h),this.directionTimestamp=s.Fraction.minus(n,h)):this.directionTimestamp=s.Fraction.createFromFraction(h));const c=t.attribute("placement");if(c)try{const t=c.value;"below"===t?this.placement=p.PlacementEnum.Below:"above"===t&&(this.placement=p.PlacementEnum.Above)}catch(u){const t=b.ITextTranslation.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement -> set to default.");g.default.debug("ExpressionReader.readExpressionParameters",t,u),this.musicSheet.SheetErrors.pushMeasureError(t),this.placement=p.PlacementEnum.Below}if(this.placement===p.PlacementEnum.NotYetDefined)try{const e=t.element("direction-type");if(e){const t=e.element("dynamics");if(t){const e=t.attribute("default-y");e&&this.readExpressionPlacement(e,"read dynamics y pos")}const i=e.element("wedge");if(i){const t=i.attribute("default-y");t&&this.readExpressionPlacement(t,"read wedge y pos")}const n=e.element("words");if(n){const t=n.attribute("default-y");t&&this.readExpressionPlacement(t,"read words y pos")}const s=e.element("rehearsal");if(s){const t=s.attribute("default-y");t&&this.readExpressionPlacement(t,"read rehearsal pos")}}}catch(u){const t=b.ITextTranslation.translateText("ReaderErrorMessages/ExpressionPlacementError","Invalid expression placement -> set to default.");g.default.debug("ExpressionReader.readExpressionParameters",t,u),this.musicSheet.SheetErrors.pushMeasureError(t),this.placement=p.PlacementEnum.Below}this.placement===p.PlacementEnum.NotYetDefined&&(e.Staves.length>1?this.placement=p.PlacementEnum.Below:e.HasLyrics?this.placement=p.PlacementEnum.Above:this.placement=p.PlacementEnum.Below)}read(t,e,i){let n=!1,r=!1;const o=t.element("sound");if(o){const t=o.attribute("tempo"),i=o.attribute("dynamics");if(t){const i=t.value.match(/\d+/);this.soundTempo=void 0!==i?parseInt(i[0],10):100,e.TempoInBPM=this.soundTempo,0===this.musicSheet.DefaultStartTempoInBpm&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,n=!0}if(i){const t=i.value.match(/\d+/);this.soundDynamic=void 0!==t?parseInt(t[0],10):100,r=!0}}const a=t.element("direction-type");if(!a)return;let l=a.element("metronome");if(l){const t=l.element("beat-unit"),n=void 0!==l.element("beat-unit-dot"),r=l.element("per-minute");if(void 0!==t&&r){l.hasAttributes&&void 0!==l.attribute("default-x")&&(this.directionTimestamp=s.Fraction.createFromFraction(i));const o=parseInt(r.value,10);this.createNewTempoExpressionIfNeeded(e);const a=new u.InstantaneousTempoExpression(void 0,this.placement,this.staffNumber,o,this.currentMultiTempoExpression,!0);a.parentMeasure=e,this.soundTempo=o,e.TempoInBPM=this.soundTempo,0===this.musicSheet.DefaultStartTempoInBpm&&(this.musicSheet.DefaultStartTempoInBpm=this.soundTempo),this.musicSheet.HasBPMInfo=!0,a.dotted=n,a.beatUnit=t.value,this.currentMultiTempoExpression.addExpression(a,""),this.currentMultiTempoExpression.CombinedExpressionsText="test"}}else if(l=a.element("dynamics"),l){const n=void 0!==t.element("notations");this.interpretInstantaneousDynamics(l,e,i,n)}else if(l=a.element("words"),l)if(n){this.createNewTempoExpressionIfNeeded(e),this.currentMultiTempoExpression.CombinedExpressionsText=l.value;const t=new u.InstantaneousTempoExpression(l.value,this.placement,this.staffNumber,this.soundTempo,this.currentMultiTempoExpression);this.currentMultiTempoExpression.addExpression(t,"")}else r||this.interpretWords(l,e,i);else l=a.element("wedge"),l?this.interpretWedge(l,e,i,e.MeasureNumber):(l=a.element("rehearsal"),l&&this.interpretRehearsalMark(l,e,i,e.MeasureNumber))}checkForOpenExpressions(t,e){this.openContinuousDynamicExpression&&(this.createNewMultiExpressionIfNeeded(t,e),this.closeOpenContinuousDynamic()),this.openContinuousTempoExpression&&this.closeOpenContinuousTempo(s.Fraction.plus(t.AbsoluteTimestamp,e))}addOctaveShift(t,e,i){let n=1;const s=t.element("staff");if(s)try{n=parseInt(s.value,10)}catch(o){const t=b.ITextTranslation.translateText("ReaderErrorMessages/OctaveShiftStaffError","Invalid octave shift staff number -> set to default");this.musicSheet.SheetErrors.pushMeasureError(t),n=1,g.default.debug("ExpressionReader.addOctaveShift",t,o)}const r=t.element("direction-type");if(r){const t=r.element("octave-shift");if(void 0!==t&&t.hasAttributes)try{if(t.attribute("size")){const s=parseInt(t.attribute("size").value,10);let r=0;if(8===s?r=1:15===s&&(r=2),t.attribute("type")){const s=t.attribute("type").value;if("up"===s||"down"===s){const t=new h.OctaveShift(s,r);t.StaffNumber=n,this.createNewMultiExpressionIfNeeded(e),this.getMultiExpression.OctaveShiftStart=t,t.ParentStartMultiExpression=this.getMultiExpression,this.openOctaveShift=t}else"stop"===s&&this.openOctaveShift&&(this.createNewMultiExpressionIfNeeded(e,i),this.getMultiExpression.OctaveShiftEnd=this.openOctaveShift,this.openOctaveShift.ParentEndMultiExpression=this.getMultiExpression,this.openOctaveShift=void 0)}}}catch(a){const t=b.ITextTranslation.translateText("ReaderErrorMessages/OctaveShiftError","Error while reading octave shift.");this.musicSheet.SheetErrors.pushMeasureError(t),g.default.debug("ExpressionReader.addOctaveShift",t,a)}}}initialize(){this.placement=p.PlacementEnum.NotYetDefined,this.soundTempo=0,this.soundDynamic=0,this.offsetDivisions=0}readExpressionPlacement(t,e){try{const e=parseInt(t.value,10);e<0?this.placement=p.PlacementEnum.Below:e>0&&(this.placement=p.PlacementEnum.Above)}catch(i){g.default.debug("ExpressionReader.readExpressionParameters",e,i)}}interpretInstantaneousDynamics(t,e,i,n){if(t.hasElements){t.hasAttributes&&t.attribute("default-x")&&(this.directionTimestamp=s.Fraction.createFromFraction(i));let r=t.elements()[0].name;if("other-dynamics"===r&&(r=t.elements()[0].value),r){n?this.createNewMultiExpressionIfNeeded(e,s.Fraction.createFromFraction(i)):this.createNewMultiExpressionIfNeeded(e),void 0!==this.openContinuousDynamicExpression&&this.openContinuousDynamicExpression.StartMultiExpression!==this.getMultiExpression&&this.closeOpenContinuousDynamic();const t=new l.InstantaneousDynamicExpression(r,this.soundDynamic,this.placement,this.staffNumber,e);this.getMultiExpression.addExpression(t,""),this.initialize(),this.activeInstantaneousDynamic?this.activeInstantaneousDynamic.DynEnum=t.DynEnum:this.activeInstantaneousDynamic=new l.InstantaneousDynamicExpression(r,0,p.PlacementEnum.NotYetDefined,1,e)}}}interpretWords(t,e,i){const n=t.value;let r;const o=t.attribute("font-style");if(o&&"italic"===o.value&&(r=y.FontStyles.Italic),n.length>0){if(t.hasAttributes&&t.attribute("default-x")&&(this.directionTimestamp=s.Fraction.createFromFraction(i)),this.checkIfWordsNodeIsRepetitionInstruction(n))return;this.fillMultiOrTempoExpression(n,e,r),this.initialize()}}interpretWedge(t,e,i,n){void 0!==t&&t.hasAttributes&&t.attribute("default-x")&&(this.directionTimestamp=s.Fraction.createFromFraction(i)),this.createNewMultiExpressionIfNeeded(e),this.addWedge(t,e),this.initialize()}interpretRehearsalMark(t,e,i,n){e.rehearsalExpression=new S.RehearsalExpression(t.value,this.placement)}createNewMultiExpressionIfNeeded(t,e){e||(e=this.directionTimestamp),(!this.getMultiExpression||this.getMultiExpression&&(this.getMultiExpression.SourceMeasureParent!==t||this.getMultiExpression.SourceMeasureParent===t&&this.getMultiExpression.Timestamp!==e))&&(this.getMultiExpression=new c.MultiExpression(t,s.Fraction.createFromFraction(e)),t.StaffLinkedExpressions[this.globalStaffIndex].push(this.getMultiExpression))}createNewTempoExpressionIfNeeded(t){this.currentMultiTempoExpression&&this.currentMultiTempoExpression.SourceMeasureParent===t&&this.currentMultiTempoExpression.Timestamp===this.directionTimestamp||(this.currentMultiTempoExpression=new r.MultiTempoExpression(t,s.Fraction.createFromFraction(this.directionTimestamp)),t.TempoExpressions.push(this.currentMultiTempoExpression))}addWedge(t,e){if(void 0!==t&&t.hasAttributes){const n=t.attribute("type").value.toLowerCase();try{if("crescendo"===n||"diminuendo"===n){const t=new o.ContinuousDynamicExpression(o.ContDynamicEnum[n],this.placement,this.staffNumber,e);this.openContinuousDynamicExpression&&this.closeOpenContinuousDynamic(),this.openContinuousDynamicExpression=t,this.getMultiExpression.StartingContinuousDynamic=t,t.StartMultiExpression=this.getMultiExpression,void 0!==this.activeInstantaneousDynamic&&this.activeInstantaneousDynamic.StaffNumber===t.StaffNumber&&(this.activeInstantaneousDynamic=void 0)}else"stop"===n&&this.openContinuousDynamicExpression&&this.closeOpenContinuousDynamic()}catch(i){const t="ReaderErrorMessages/WedgeError, Error while reading Crescendo / Diminuendo.";this.musicSheet.SheetErrors.pushMeasureError(t),g.default.debug("ExpressionReader.addWedge",t,i)}}}fillMultiOrTempoExpression(t,e,i){if(!t)return;const n=t.trim();this.createExpressionFromString("",n,e,t,i)}createExpressionFromString(t,e,i,n,s){if(u.InstantaneousTempoExpression.isInputStringInstantaneousTempo(e)||a.ContinuousTempoExpression.isInputStringContinuousTempo(e)){if(i.TempoExpressions.length>0)for(let t=0,n=i.TempoExpressions.length;t0)for(let o=0,a=i.TempoExpressions.length;o0&&!this.hasDigit(e)&&this.globalStaffIndex>0){if(t.EntriesList[0].label.indexOf(e)>=0)return!1;break}}let r=m.TextAlignmentEnum.CenterBottom;this.musicSheet.Rules.CompactMode&&(r=m.TextAlignmentEnum.LeftBottom);const h=new f.UnknownExpression(e,this.placement,r,this.staffNumber);return h.fontStyle=s,this.getMultiExpression.addExpression(h,t),!1}closeOpenContinuousDynamic(){this.openContinuousDynamicExpression.EndMultiExpression=this.getMultiExpression,this.getMultiExpression.EndingContinuousDynamic=this.openContinuousDynamicExpression,this.openContinuousDynamicExpression=void 0}closeOpenContinuousTempo(t){this.openContinuousTempoExpression.AbsoluteEndTimestamp=t,this.openContinuousTempoExpression=void 0}checkIfWordsNodeIsRepetitionInstruction(t){return"coda"===(t=t.trim().toLowerCase())||"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"===t}hasDigit(t){return/\d/.test(t)}}},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.SlurReader=void 0;const s=i(173),r=n(i(1)),o=i(20),a=i(102);e.SlurReader=class{constructor(t){this.openSlurDict={},this.musicSheet=t}addSlur(t,e){try{if(t)for(const n of t)if(n.attributes().length>0){const t=n.attribute("type").value;let o=1;try{n.attribute("number")&&(o=parseInt(n.attribute("number").value,10))}catch(i){r.default.debug("VoiceGenerator.addSlur number: ",i)}let l=a.PlacementEnum.NotYetDefined;const h=n.attribute("placement");h&&h.value&&("above"===h.value?l=a.PlacementEnum.Above:"below"===h.value&&(l=a.PlacementEnum.Below));const c=n.attribute("orientation");if(c&&c.value&&("over"===c.value?l=a.PlacementEnum.Above:"under"===c.value&&(l=a.PlacementEnum.Below)),"start"===t){let t=this.openSlurDict[o];t||(t=new s.Slur,this.openSlurDict[o]=t),t.StartNote=e,t.PlacementXml=l}else if("stop"===t){const t=this.openSlurDict[o];t&&(t.EndNote=e,e.checkForDoubleSlur(t)||(e.NoteSlurs.push(t),t.StartNote.NoteSlurs.push(t)),delete this.openSlurDict[o])}}}catch(n){const t=o.ITextTranslation.translateText("ReaderErrorMessages/SlurError","Error while reading slur.");this.musicSheet.SheetErrors.pushMeasureError(t)}}}},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.SubInstrument=void 0;const s=i(7),r=n(i(1));class o{constructor(t){this.parentInstrument=t,this.fixedKey=-1,this.name=this.parseMidiInstrument(this.parentInstrument.Name),this.midiInstrumentID=o.midiInstrument[this.name],this.volume=1}get ParentInstrument(){return this.parentInstrument}static isPianoInstrument(t){return t===s.MidiInstrument.Acoustic_Grand_Piano||t===s.MidiInstrument.Bright_Acoustic_Piano||t===s.MidiInstrument.Electric_Grand_Piano||t===s.MidiInstrument.Electric_Piano_1||t===s.MidiInstrument.Electric_Piano_2}setMidiInstrument(t){this.midiInstrumentID=o.midiInstrument[this.parseMidiInstrument(t)]}parseMidiInstrument(t){try{if(t){const e=t.toLowerCase().trim();for(const t in o.midiInstrument)if(-1!==e.indexOf(t))return t}if(this.parentInstrument.Name){const t=this.parentInstrument.Name.toLowerCase().trim();for(const e in o.midiInstrument)if(-1!==t.indexOf(e))return e}}catch(e){r.default.error("Error parsing MIDI Instrument. Default to Grand Piano.")}return"unnamed"}}e.SubInstrument=o,o.midiInstrument={alt:s.MidiInstrument.Synth_Voice,alto:s.MidiInstrument.Synth_Voice,banjo:s.MidiInstrument.Banjo,bariton:s.MidiInstrument.Synth_Voice,baritone:s.MidiInstrument.Synth_Voice,bass:s.MidiInstrument.Synth_Voice,"blockflöte":s.MidiInstrument.Recorder,brass:s.MidiInstrument.Trombone,bratsche:s.MidiInstrument.Viola,cello:s.MidiInstrument.Cello,clarinet:s.MidiInstrument.Clarinet,contrabass:s.MidiInstrument.Contrabass,drums:s.MidiInstrument.Percussion,flute:s.MidiInstrument.Flute,"flöte":s.MidiInstrument.Flute,frenchhorn:s.MidiInstrument.French_Horn,gitarre:s.MidiInstrument.Acoustic_Guitar_nylon,guitar:s.MidiInstrument.Acoustic_Guitar_nylon,harfe:s.MidiInstrument.Orchestral_Harp,harp:s.MidiInstrument.Orchestral_Harp,klarinette:s.MidiInstrument.Clarinet,klavier:s.MidiInstrument.Acoustic_Grand_Piano,kontrabass:s.MidiInstrument.Contrabass,oboe:s.MidiInstrument.Oboe,organ:s.MidiInstrument.Church_Organ,orgel:s.MidiInstrument.Church_Organ,orgue:s.MidiInstrument.Church_Organ,percussion:s.MidiInstrument.Percussion,piano:s.MidiInstrument.Acoustic_Grand_Piano,piccolo:s.MidiInstrument.Piccolo,posaune:s.MidiInstrument.Trombone,recorder:s.MidiInstrument.Recorder,sax:s.MidiInstrument.Tenor_Sax,schlagwerk:s.MidiInstrument.Percussion,schlagzeug:s.MidiInstrument.Percussion,sopran:s.MidiInstrument.Synth_Voice,steeldrum:s.MidiInstrument.Steel_Drums,streicher:s.MidiInstrument.String_Ensemble_1,strings:s.MidiInstrument.String_Ensemble_1,tenor:s.MidiInstrument.Synth_Voice,tpt:s.MidiInstrument.Trumpet,trombone:s.MidiInstrument.Trombone,trompete:s.MidiInstrument.Trumpet,trumpet:s.MidiInstrument.Trumpet,tuba:s.MidiInstrument.Tuba,unnamed:s.MidiInstrument.Acoustic_Grand_Piano,viola:s.MidiInstrument.Viola,violin:s.MidiInstrument.Violin,"violon-c":s.MidiInstrument.Cello,"violon.":s.MidiInstrument.Violin,voice:s.MidiInstrument.Synth_Voice,woodblock:s.MidiInstrument.Woodblock}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.MusicSymbolModuleFactory=void 0;const n=i(152),s=i(153);e.MusicSymbolModuleFactory=class{static createRepetitionInstructionReader(){return new n.RepetitionInstructionReader}static createRepetitionCalculator(){return new s.RepetitionCalculator}}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.RepetitionInstructionReader=void 0;const n=i(28),s=i(28),r=i(174);e.RepetitionInstructionReader=class{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),i=t.attributes().length>0&&t.attribute("location")?t.attribute("location").value:"right";const c=t.elements();for(let t=0,e=c.length;t0)if("left"===i){if("start"===o){const t=new n.RepetitionInstruction(this.currentMeasureIndex,n.RepetitionInstructionEnum.Ending,n.AlignmentType.Begin,void 0,l);this.addInstruction(this.repetitionInstructions,t)}if("forward"===r){const t=new n.RepetitionInstruction(this.currentMeasureIndex,n.RepetitionInstructionEnum.StartLine);this.addInstruction(this.repetitionInstructions,t)}}else{if("stop"===o){const t=new n.RepetitionInstruction(this.currentMeasureIndex,n.RepetitionInstructionEnum.Ending,n.AlignmentType.End,void 0,l);this.addInstruction(this.repetitionInstructions,t)}if("backward"===r){const t=new n.RepetitionInstruction(this.currentMeasureIndex,n.RepetitionInstructionEnum.BackJumpLine);this.addInstruction(this.repetitionInstructions,t)}}}return e}handleRepetitionInstructionsFromWordsOrSymbols(t,e){const i=t.element("words"),s=this.currentMeasureIndex;if(i){const t="d\\s?\\.s\\.",e=i.value.trim().toLowerCase();if(r.StringUtil.StringContainsSeparatedWord(e,t+" al fine",!0)){const t=new n.RepetitionInstruction(s,n.RepetitionInstructionEnum.DalSegnoAlFine);return this.addInstruction(this.repetitionInstructions,t),!0}const o="d\\.\\s?c\\.";if(r.StringUtil.StringContainsSeparatedWord(e,o+" al coda",!0)){const t=new n.RepetitionInstruction(s,n.RepetitionInstructionEnum.DalSegnoAlCoda);return this.addInstruction(this.repetitionInstructions,t),!0}if(r.StringUtil.StringContainsSeparatedWord(e,o+" al fine",!0)){const t=new n.RepetitionInstruction(s,n.RepetitionInstructionEnum.DaCapoAlFine);return this.addInstruction(this.repetitionInstructions,t),!0}if(r.StringUtil.StringContainsSeparatedWord(e,o+" al coda",!0)){const t=new n.RepetitionInstruction(s,n.RepetitionInstructionEnum.DaCapoAlCoda);return this.addInstruction(this.repetitionInstructions,t),!0}if(r.StringUtil.StringContainsSeparatedWord(e,o)||r.StringUtil.StringContainsSeparatedWord(e,"da\\s?capo",!0)){const t=new n.RepetitionInstruction(s,n.RepetitionInstructionEnum.DaCapo);return this.addInstruction(this.repetitionInstructions,t),!0}if(r.StringUtil.StringContainsSeparatedWord(e,t,!0)||r.StringUtil.StringContainsSeparatedWord(e,"dal\\s?segno",!0)){let t;return t=r.StringUtil.StringContainsSeparatedWord(e,"al\\s?coda",!0)?new n.RepetitionInstruction(s,n.RepetitionInstructionEnum.DalSegnoAlCoda):new n.RepetitionInstruction(s,n.RepetitionInstructionEnum.DalSegno),this.addInstruction(this.repetitionInstructions,t),!0}if(r.StringUtil.StringContainsSeparatedWord(e,"to\\s?coda",!0)||r.StringUtil.StringContainsSeparatedWord(e,"a (la )?coda",!0)){const t=new n.RepetitionInstruction(s,n.RepetitionInstructionEnum.ToCoda);return this.addInstruction(this.repetitionInstructions,t),!0}if(r.StringUtil.StringContainsSeparatedWord(e,"fine",!0)){const t=new n.RepetitionInstruction(s,n.RepetitionInstructionEnum.Fine);return this.addInstruction(this.repetitionInstructions,t),!0}if(r.StringUtil.StringContainsSeparatedWord(e,"coda",!0)){const t=new n.RepetitionInstruction(s,n.RepetitionInstructionEnum.Coda);return this.addInstruction(this.repetitionInstructions,t),!0}if(r.StringUtil.StringContainsSeparatedWord(e,"segno",!0)){const t=new n.RepetitionInstruction(s,n.RepetitionInstructionEnum.Segno);return this.addInstruction(this.repetitionInstructions,t),!0}}else{if(t.element("segno")){const t=new n.RepetitionInstruction(s,n.RepetitionInstructionEnum.Segno);return this.addInstruction(this.repetitionInstructions,t),!0}if(t.element("coda")){const t=new n.RepetitionInstruction(s,n.RepetitionInstructionEnum.Coda);return this.addInstruction(this.repetitionInstructions,t),!0}}return!1}removeRedundantInstructions(){let t=0,e=0,i=0,r=0;for(let s=0;s0&&this.findInstructionInPreviousMeasure(s,o.measureIndex,n.RepetitionInstructionEnum.ToCoda)&&(o.type=n.RepetitionInstructionEnum.None),0===e&&0===i&&(o.type=n.RepetitionInstructionEnum.ToCoda,o.alignment=n.AlignmentType.End,o.measureIndex--);break;case n.RepetitionInstructionEnum.Segno:if(t-r>0){let t=!1;for(let s=0,r=this.repetitionInstructions.length;s0?n.RepetitionInstructionEnum.DalSegnoAlCoda:n.RepetitionInstructionEnum.DalSegno,o.type=n.RepetitionInstructionEnum.None,t=!0;break;case n.RepetitionInstructionEnum.DalSegno:case n.RepetitionInstructionEnum.DalSegnoAlFine:case n.RepetitionInstructionEnum.DalSegnoAlCoda:o.type=n.RepetitionInstructionEnum.None,t=!0}if(t)break}if(t)break;o.type=i-e>0?n.RepetitionInstructionEnum.DalSegnoAlCoda:n.RepetitionInstructionEnum.DalSegno,o.alignment=n.AlignmentType.End,o.measureIndex--}}if(this.backwardSearchForPreviousIdenticalInstruction(s,o)||o.type===n.RepetitionInstructionEnum.None)this.repetitionInstructions.splice(s,1),s--;else switch(o.type){case n.RepetitionInstructionEnum.Fine:break;case n.RepetitionInstructionEnum.ToCoda:i++;break;case n.RepetitionInstructionEnum.Coda:e++;break;case n.RepetitionInstructionEnum.Segno:t++;break;case n.RepetitionInstructionEnum.DalSegnoAlFine:case n.RepetitionInstructionEnum.DalSegnoAlCoda:r++}}this.repetitionInstructions.sort(s.RepetitionInstructionComparer.Compare)}findInstructionInPreviousMeasure(t,e,i){for(let n=t-1;n>=0;n--){const t=this.repetitionInstructions[n];if(e-t.measureIndex==1&&t.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 n=0,s=t.length;n1&&t.FirstRepetitionInstructions.sort(s.RepetitionInstructionComparer.Compare),t.LastRepetitionInstructions.length>1&&t.LastRepetitionInstructions.sort(s.RepetitionInstructionComparer.Compare)}}handleRepetitionInstructions(t){if(!this.currentMeasure)return!1;switch(t.type){case n.RepetitionInstructionEnum.StartLine:this.currentMeasure.FirstRepetitionInstructions.push(t);break;case n.RepetitionInstructionEnum.BackJumpLine:this.currentMeasure.LastRepetitionInstructions.push(t);break;case n.RepetitionInstructionEnum.Ending:if(t.alignment===n.AlignmentType.Begin)this.currentMeasure.FirstRepetitionInstructions.push(t);else for(let e=0,i=t.endingIndices.length;ee.file("META-INF/container.xml").async("text")),(t=>{throw t})).then((t=>{const i=(new DOMParser).parseFromString(t,"text/xml").getElementsByTagName("rootfile")[0].getAttribute("full-path");return e.file(i).async("text")}),(t=>{throw t})).then((t=>{const e=(new DOMParser).parseFromString(t,"text/xml"),i=new s.IXmlElement(e.documentElement);return Promise.resolve(i)}),(t=>{throw t})).then((t=>t),(t=>{throw new Error("extractSheetFromMxl: "+t.message)}))}static MXLtoXMLstring(t){const e=new r.default;return e.loadAsync(t).then((t=>e.file("META-INF/container.xml").async("text")),(t=>{throw t})).then((t=>{const i=(new DOMParser).parseFromString(t,"text/xml").getElementsByTagName("rootfile")[0].getAttribute("full-path");return e.file(i).async("text")}),(t=>{throw t}))}}},function(t,e){var i,n,s=t.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(t){if(i===setTimeout)return setTimeout(t,0);if((i===r||!i)&&setTimeout)return i=setTimeout,setTimeout(t,0);try{return i(t,0)}catch(e){try{return i.call(null,t,0)}catch(n){return i.call(this,t,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:r}catch(t){i=r}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(t){n=o}}();var l,h=[],c=!1,u=-1;function d(){c&&l&&(c=!1,l.length?h=l.concat(h):u=-1,h.length&&f())}function f(){if(!c){var t=a(d);c=!0;for(var e=h.length;e;){for(l=h,h=[];++u1)for(var i=1;ii.copies?this.nElements-=i.copies:this.nElements-=e,i.copies-=e,i.copies<=0&&this.dictionary.remove(t),!0}return!1},t.prototype.toArray=function(){for(var t=[],e=0,i=this.dictionary.values();e-1&&this.insertIdIntoRoot(e,i),this.nodes)if(this.nodes.hasOwnProperty(n)){var s=this.findNodeId(n,t);s>-1&&this.insertIdIntoNode(n,e,s)}},t.prototype.insertIdAfterId=function(t,e){var i=this.findRootId(t);for(var n in i>-1&&this.insertIdIntoRoot(e,i+1),this.nodes)if(this.nodes.hasOwnProperty(n)){var s=this.findNodeId(n,t);s>-1&&this.insertIdIntoNode(n,e,s+1)}},t.prototype.insertIdIntoId=function(t,e){this.nodeInsertAtEnd(t,e),this.nodes[e]=[]},t.prototype.insertIdIntoRoot=function(t,e){if(void 0===e)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]||[]},t.prototype.insertIdIntoNode=function(t,e,i){if(this.nodes[t]=this.nodes[t]||[],this.nodes[e]=this.nodes[e]||[],void 0===i)this.nodeInsertAtEnd(t,e);else if(i<0){var n=this.nodes[t].length;this.nodes[t].splice(i+n+1,0,e)}else this.nodes[t].splice(i,0,e)},t.prototype.moveId=function(t,e,i){var s=t,r=this.findRootId(s);for(var o in this.nodes[e],this.nodes)if(this.nodes.hasOwnProperty(o)){this.findNodeId(o,e);break}var a=e,l=this.findRootId(a);for(var o in this.nodes[e],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 n.BEFORE:this.insertIdIntoRoot(s,l);break;case n.AFTER:this.insertIdIntoRoot(s,l+1);break;case n.INSIDE_AT_START:this.nodeInsertAtStart(a,s);break;case n.INSIDE_AT_END:this.nodeInsertAtEnd(a,s)}else for(var o in this.rootDelete(r),this.nodes)if(this.nodes.hasOwnProperty(o)&&(h=this.findNodeId(o,a))>-1){switch(i){case n.BEFORE:this.insertIdIntoNode(o,s,h);break;case n.AFTER:this.insertIdIntoNode(o,s,h+1);break;case n.INSIDE_AT_START:this.nodeInsertAtStart(a,s);break;case n.INSIDE_AT_END:this.nodeInsertAtEnd(a,s)}break}}else if(l>-1){for(var o in this.nodes)if(this.nodes.hasOwnProperty(o)&&(h=this.findNodeId(o,s))>-1){this.nodeDeleteAtIndex(o,h);break}switch(i){case n.BEFORE:this.insertIdIntoRoot(s,l);break;case n.AFTER:this.insertIdIntoRoot(s,l+1);break;case n.INSIDE_AT_START:this.nodeInsertAtStart(a,s);break;case n.INSIDE_AT_END:this.nodeInsertAtEnd(a,s)}}else{for(var o in this.nodes)if(this.nodes.hasOwnProperty(o)&&(h=this.findNodeId(o,s))>-1){this.nodeDeleteAtIndex(o,h);break}for(var o in this.nodes){var h;if(this.nodes.hasOwnProperty(o)&&(h=this.findNodeId(o,a))>-1){switch(i){case n.BEFORE:this.insertIdIntoNode(o,s,h);break;case n.AFTER:this.insertIdIntoNode(o,s,h+1);break;case n.INSIDE_AT_START:this.nodeInsertAtStart(a,s);break;case n.INSIDE_AT_END:this.nodeInsertAtEnd(a,s)}break}}}},t.prototype.swapArrayElements=function(t,e,i){var n=t[e];return t[e]=t[i],t[i]=n,t},t.prototype.rootDeleteId=function(t){var e=this.findRootId(t);e>-1&&this.rootDelete(e)},t.prototype.nodeAndSubNodesDelete=function(t){for(var e=[],i=0;i=0;i--)if(e=this.timestamps[i],t.gte(e.$from))return e;return this.timestamps[0]}absoluteEnrolledToSheetTimestamp(t){if(0===this.timestamps.length)return t;const e=this.getCurrentRepetitionTimestampTransform(t);return n.Fraction.plus(t,n.Fraction.minus(e.to,e.$from))}get Parts(){return this.parts}get MusicSheet(){return this.musicSheet}getIterator(t){return t?new s.MusicPartManagerIterator(this.musicSheet,t,void 0):new s.MusicPartManagerIterator(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=null!=t?t:this.sheetStart,this.musicSheet.SelectionEnd=null!=e?e:this.sheetEnd}calcMapping(){const t=[],e=this.getIterator();let i=e.CurrentRepetition,n=new r(e.CurrentEnrolledTimestamp.clone(),e.CurrentSourceTimestamp.clone(),void 0,0);for(t.push(n);!e.EndReached;){if(e.JumpOccurred||i!==e.CurrentRepetition){if(i=e.CurrentRepetition,e.backJumpOccurred){const i=e.JumpResponsibleRepetition;n.nextBackJump=e.CurrentEnrolledTimestamp,n.curRepetition=i,n.curRepetitionIteration=e.CurrentJumpResponsibleRepetitionIterationBeforeJump;for(let e=this.timestamps.length-2;e>=0&&!t[e].to.lt(i.AbsoluteTimestamp)&&!t[e].curRepetition;e--)t[e].nextBackJump=n.nextBackJump,t[e].curRepetition=i,t[e].curRepetitionIteration=n.curRepetitionIteration}n=new r(e.CurrentEnrolledTimestamp.clone(),e.CurrentSourceTimestamp.clone(),void 0,0),t.push(n)}e.moveToNext()}this.timestamps=t}};class r{constructor(t,e,i,n){this.$from=t,this.to=e,this.curRepetition=i,this.curRepetitionIteration=n,this.nextBackJump=void 0,this.nextForwardJump=void 0}}e.TimestampTransform=r},function(t,e,i){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.MusicPartManagerIterator=void 0;const s=i(0),r=i(168),o=i(19),a=i(32),l=n(i(1));class h{constructor(t,e,i){this.currentMeasureIndex=0,this.currentPartIndex=0,this.currentVoiceEntryIndex=-1,this.currentDynamicEntryIndex=0,this.currentTempoEntryIndex=0,this.currentDynamicChangingExpressions=[],this.currentRepetition=void 0,this.endReached=!1,this.frontReached=!1,this.currentTimeStamp=new s.Fraction(0,1),this.currentEnrolledMeasureTimestamp=new s.Fraction(0,1),this.currentRelativeInMeasureTimestamp=new s.Fraction(0,1),this.currentVerticalContainerInMeasureTimestamp=new s.Fraction(0,1),this.jumpResponsibleRepetition=void 0,this.activeDynamicExpressions=[];try{this.frontReached=!0,this.musicSheet=t,this.currentVoiceEntries=void 0,this.frontReached=!1;for(const t of this.musicSheet.Repetitions)this.setRepetitionIterationCount(t,1);if(this.activeDynamicExpressions=new Array(this.musicSheet.getCompleteNumberOfStaves()),this.currentMeasure=this.musicSheet.SourceMeasures[0],!e)return;do{this.moveToNext()}while((!this.currentVoiceEntries||this.currentTimeStamp.lt(e))&&!this.endReached);for(let t=0;t=this.JumpResponsibleRepetition.StartIndex&&i.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(i)}}handleRepetitionsAtMeasureEnd(){for(let t=0,e=this.currentMeasure.LastRepetitionInstructions.length;t-1&&this.getRepetitionIterationCount(i)=this.JumpResponsibleRepetition.StartIndex&&i.EndIndex<=this.JumpResponsibleRepetition.EndIndex&&this.resetRepetitionIterationCount(i);const t=i.getForwardJumpTargetForIteration(this.getRepetitionIterationCount(i));if(t>=0)return this.currentMeasureIndex=t,this.currentMeasure=this.musicSheet.SourceMeasures[this.currentMeasureIndex],this.currentVoiceEntryIndex=-1,this.jumpResponsibleRepetition=i,void(this.forwardJumpOccurred=!0);-2===t&&(this.endReached=!0)}}}this.currentMeasureIndex++,void 0!==this.JumpResponsibleRepetition&&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}activateCurrentRhythmInstructions(){if(void 0!==this.currentMeasure&&this.currentMeasure.FirstInstructionsStaffEntries.length>0&&void 0!==this.currentMeasure.FirstInstructionsStaffEntries[0]){const t=this.currentMeasure.FirstInstructionsStaffEntries[0].Instructions;for(let e=0,i=t.length;e0&&(this.currentDynamicEntryIndex>=t.length||this.CurrentSourceTimestamp.lte(t[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp));)this.currentDynamicEntryIndex--;for(;this.currentDynamicEntryIndex0&&(this.currentTempoEntryIndex>=e.length||this.CurrentSourceTimestamp.lte(e[this.currentTempoEntryIndex].AbsoluteTimestamp));)this.currentTempoEntryIndex--;for(;this.currentTempoEntryIndex=0&&this.currentVoiceEntryIndex=0&&this.currentMeasureIndex0){if(!t)return!0;for(let t=0,i=e.length;t=0&&(this.syllableIndex=s)}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}}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Articulation=void 0,e.Articulation=class{constructor(t,e){this.articulationEnum=t,this.placement=e}Equals(t){return t.articulationEnum===this.articulationEnum&&t.placement===this.placement}}},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.TabNote=void 0;const n=i(36);class s extends n.Note{constructor(t,e,i,n,s,r,o,a,l){super(t,e,i,n,s),this.stringNumberTab=r,this.fretNumber=o,this.bendArray=a,this.vibratoStroke=l}get StringNumberTab(){return this.stringNumberTab}get FretNumber(){return this.fretNumber}get BendArray(){return this.bendArray}get VibratoStroke(){return this.vibratoStroke}}e.TabNote=s},function(t,e,i){Object.defineProperty(e,"__esModule",{value:!0}),e.Slur=void 0;const n=i(0);e.Slur=class{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>2,a=(3&e)<<4|i>>4,l=1>6:64,h=2>4,i=(15&o)<<4|(a=r.indexOf(t.charAt(h++)))>>2,n=(3&a)<<6|(l=r.indexOf(t.charAt(h++))),d[c++]=e,64!==a&&(d[c++]=i),64!==l&&(d[c++]=n);return d}},{"./support":30,"./utils":32}],2:[function(t,e,i){var n=t("./external"),s=t("./stream/DataWorker"),r=t("./stream/DataLengthProbe"),o=t("./stream/Crc32Probe");function a(t,e,i,n,s){this.compressedSize=t,this.uncompressedSize=e,this.crc32=i,this.compression=n,this.compressedContent=s}r=t("./stream/DataLengthProbe"),a.prototype={getContentWorker:function(){var t=new s(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new r("data_length")),e=this;return t.on("end",(function(){if(this.streamInfo.data_length!==e.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),t},getCompressedWorker:function(){return new s(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(t,e,i){return t.pipe(new o).pipe(new r("uncompressedSize")).pipe(e.compressWorker(i)).pipe(new r("compressedSize")).withStreamInfo("compression",e)},e.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,e,i){var n=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(t){return new n("STORE compression")},uncompressWorker:function(){return new n("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,e,i){var n=t("./utils"),s=function(){for(var t,e=[],i=0;i<256;i++){t=i;for(var n=0;n<8;n++)t=1&t?3988292384^t>>>1:t>>>1;e[i]=t}return e}();e.exports=function(t,e){return void 0!==t&&t.length?"string"!==n.getTypeOf(t)?function(t,e,i,n){var r=s,o=0+i;t^=-1;for(var a=0;a>>8^r[255&(t^e[a])];return-1^t}(0|e,t,t.length):function(t,e,i,n){var r=s,o=0+i;t^=-1;for(var a=0;a>>8^r[255&(t^e.charCodeAt(a))];return-1^t}(0|e,t,t.length):0}},{"./utils":32}],5:[function(t,e,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(t,e,i){var n;n="undefined"!=typeof Promise?Promise:t("lie"),e.exports={Promise:n}},{lie:37}],7:[function(t,e,i){var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,s=t("pako"),r=t("./utils"),o=t("./stream/GenericWorker"),a=n?"uint8array":"array";function l(t,e){o.call(this,"FlateWorker/"+t),this._pako=null,this._pakoAction=t,this._pakoOptions=e,this.meta={}}i.magic="\b\0",r.inherits(l,o),l.prototype.processChunk=function(t){this.meta=t.meta,null===this._pako&&this._createPako(),this._pako.push(r.transformTo(a,t.data),!1)},l.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var t=this;this._pako.onData=function(e){t.push({data:e,meta:t.meta})}},i.compressWorker=function(t){return new l("Deflate",t)},i.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,e,i){function n(t,e){var i,n="";for(i=0;i>>=8;return n}function s(t,e,i,s,o,c){var u,d,f=t.file,p=t.compression,m=c!==a.utf8encode,b=r.transformTo("string",c(f.name)),g=r.transformTo("string",a.utf8encode(f.name)),y=f.comment,S=r.transformTo("string",c(y)),v=r.transformTo("string",a.utf8encode(y)),x=g.length!==f.name.length,E=v.length!==y.length,_="",w="",T="",M=f.dir,P=f.date,L={crc32:0,compressedSize:0,uncompressedSize:0};e&&!i||(L.crc32=t.crc32,L.compressedSize=t.compressedSize,L.uncompressedSize=t.uncompressedSize);var A=0;e&&(A|=8),m||!x&&!E||(A|=2048);var C,I,R,N=0,F=0;M&&(N|=16),"UNIX"===o?(F=798,N|=(C=f.unixPermissions,I=M,R=C,C||(R=I?16893:33204),(65535&R)<<16)):(F=20,N|=function(t){return 63&(t||0)}(f.dosPermissions)),u=P.getUTCHours(),u<<=6,u|=P.getUTCMinutes(),u<<=5,u|=P.getUTCSeconds()/2,d=P.getUTCFullYear()-1980,d<<=4,d|=P.getUTCMonth()+1,d<<=5,d|=P.getUTCDate(),x&&(w=n(1,1)+n(l(b),4)+g,_+="up"+n(w.length,2)+w),E&&(T=n(1,1)+n(l(S),4)+v,_+="uc"+n(T.length,2)+T);var B="";return B+="\n\0",B+=n(A,2),B+=p.magic,B+=n(u,2),B+=n(d,2),B+=n(L.crc32,4),B+=n(L.compressedSize,4),B+=n(L.uncompressedSize,4),B+=n(b.length,2),B+=n(_.length,2),{fileRecord:h.LOCAL_FILE_HEADER+B+b+_,dirRecord:h.CENTRAL_FILE_HEADER+n(F,2)+B+n(S.length,2)+"\0\0\0\0"+n(N,4)+n(s,4)+b+_+S}}var r=t("../utils"),o=t("../stream/GenericWorker"),a=t("../utf8"),l=t("../crc32"),h=t("../signature");function c(t,e,i,n){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=e,this.zipPlatform=i,this.encodeFileName=n,this.streamFiles=t,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}r.inherits(c,o),c.prototype.push=function(t){var e=t.meta.percent||0,i=this.entriesCount,n=this._sources.length;this.accumulate?this.contentBuffer.push(t):(this.bytesWritten+=t.data.length,o.prototype.push.call(this,{data:t.data,meta:{currentFile:this.currentFile,percent:i?(e+100*(i-n-1))/i:100}}))},c.prototype.openedSource=function(t){this.currentSourceOffset=this.bytesWritten,this.currentFile=t.file.name;var e=this.streamFiles&&!t.file.dir;if(e){var i=s(t,e,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:i.fileRecord,meta:{percent:0}})}else this.accumulate=!0},c.prototype.closedSource=function(t){this.accumulate=!1;var e,i=this.streamFiles&&!t.file.dir,r=s(t,i,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),i)this.push({data:(e=t,h.DATA_DESCRIPTOR+n(e.crc32,4)+n(e.compressedSize,4)+n(e.uncompressedSize,4)),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},c.prototype.flush=function(){for(var t=this.bytesWritten,e=0;e=this.index;e--)i=(i<<8)+this.byteAt(e);return this.index+=t,i},readString:function(t){return n.transformTo("string",this.readData(t))},readData:function(t){},lastIndexOfSignature:function(t){},readAndCheckSignature:function(t){},readDate:function(){var t=this.readInt(4);return new Date(Date.UTC(1980+(t>>25&127),(t>>21&15)-1,t>>16&31,t>>11&31,t>>5&63,(31&t)<<1))}},e.exports=s},{"../utils":32}],19:[function(t,e,i){var n=t("./Uint8ArrayReader");function s(t){n.call(this,t)}t("../utils").inherits(s,n),s.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,e,i){var n=t("./DataReader");function s(t){n.call(this,t)}t("../utils").inherits(s,n),s.prototype.byteAt=function(t){return this.data.charCodeAt(this.zero+t)},s.prototype.lastIndexOfSignature=function(t){return this.data.lastIndexOf(t)-this.zero},s.prototype.readAndCheckSignature=function(t){return t===this.readData(4)},s.prototype.readData=function(t){this.checkOffset(t);var e=this.data.slice(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=s},{"../utils":32,"./DataReader":18}],21:[function(t,e,i){var n=t("./ArrayReader");function s(t){n.call(this,t)}t("../utils").inherits(s,n),s.prototype.readData=function(t){if(this.checkOffset(t),0===t)return new Uint8Array(0);var e=this.data.subarray(this.zero+this.index,this.zero+this.index+t);return this.index+=t,e},e.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(t,e,i){var n=t("../utils"),s=t("../support"),r=t("./ArrayReader"),o=t("./StringReader"),a=t("./NodeBufferReader"),l=t("./Uint8ArrayReader");e.exports=function(t){var e=n.getTypeOf(t);return n.checkSupport(e),"string"!==e||s.uint8array?"nodebuffer"===e?new a(t):s.uint8array?new l(n.transformTo("uint8array",t)):new r(n.transformTo("array",t)):new o(t)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,e,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\b"},{}],24:[function(t,e,i){var n=t("./GenericWorker"),s=t("../utils");function r(t){n.call(this,"ConvertWorker to "+t),this.destType=t}s.inherits(r,n),r.prototype.processChunk=function(t){this.push({data:s.transformTo(this.destType,t.data),meta:t.meta})},e.exports=r},{"../utils":32,"./GenericWorker":28}],25:[function(t,e,i){var n=t("./GenericWorker"),s=t("../crc32");function r(){n.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(r,n),r.prototype.processChunk=function(t){this.streamInfo.crc32=s(t.data,this.streamInfo.crc32||0),this.push(t)},e.exports=r},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,e,i){var n=t("../utils"),s=t("./GenericWorker");function r(t){s.call(this,"DataLengthProbe for "+t),this.propName=t,this.withStreamInfo(t,0)}n.inherits(r,s),r.prototype.processChunk=function(t){if(t){var e=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=e+t.data.length}s.prototype.processChunk.call(this,t)},e.exports=r},{"../utils":32,"./GenericWorker":28}],27:[function(t,e,i){var n=t("../utils"),s=t("./GenericWorker");function r(t){s.call(this,"DataWorker");var e=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,t.then((function(t){e.dataIsReady=!0,e.data=t,e.max=t&&t.length||0,e.type=n.getTypeOf(t),e.isPaused||e._tickAndRepeat()}),(function(t){e.error(t)}))}n.inherits(r,s),r.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},r.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0)},r.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},r.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var t=null,e=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,e);break;case"uint8array":t=this.data.subarray(this.index,e);break;case"array":case"nodebuffer":t=this.data.slice(this.index,e)}return this.index=e,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})},e.exports=r},{"../utils":32,"./GenericWorker":28}],28:[function(t,e,i){function n(t){this.name=t||"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}n.prototype={push:function(t){this.emit("data",t)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(t){this.emit("error",t)}return!0},error:function(t){return!this.isFinished&&(this.isPaused?this.generatedError=t:(this.isFinished=!0,this.emit("error",t),this.previous&&this.previous.error(t),this.cleanUp()),!0)},on:function(t,e){return this._listeners[t].push(e),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(t,e){if(this._listeners[t])for(var i=0;i "+t:t}},e.exports=n},{}],29:[function(t,i,n){var s=t("../utils"),r=t("./ConvertWorker"),o=t("./GenericWorker"),a=t("../base64"),l=t("../support"),h=t("../external"),c=null;if(l.nodestream)try{c=t("../nodejs/NodejsStreamOutputAdapter")}catch(d){}function u(t,e,i){var n=e;switch(e){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string"}try{this._internalType=n,this._outputType=e,this._mimeType=i,s.checkSupport(n),this._worker=t.pipe(new r(n)),t.lock()}catch(a){this._worker=new o("error"),this._worker.error(a)}}u.prototype={accumulate:function(t){return i=this,n=t,new h.Promise((function(t,r){var o=[],l=i._internalType,h=i._outputType,c=i._mimeType;i.on("data",(function(t,e){o.push(t),n&&n(e)})).on("error",(function(t){o=[],r(t)})).on("end",(function(){try{var i=function(t,e,i){switch(t){case"blob":return s.newBlob(s.transformTo("arraybuffer",e),i);case"base64":return a.encode(e);default:return s.transformTo(t,e)}}(h,function(t,i){var n,s=0,r=null,o=0;for(n=0;n>>6:(i<65536?e[o++]=224|i>>>12:(e[o++]=240|i>>>18,e[o++]=128|i>>>12&63),e[o++]=128|i>>>6&63),e[o++]=128|63&i);return e}(t)},i.utf8decode=function(t){return s.nodebuffer?n.transformTo("nodebuffer",t).toString("utf-8"):function(t){var e,i,s,r,o=t.length,l=new Array(2*o);for(e=i=0;e>10&1023,l[i++]=56320|1023&s)}return l.length!==i&&(l.subarray?l=l.subarray(0,i):l.length=i),n.applyFromCharCode(l)}(t=n.transformTo(s.uint8array?"uint8array":"array",t))},n.inherits(h,o),h.prototype.processChunk=function(t){var e=n.transformTo(s.uint8array?"uint8array":"array",t.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var r=e;(e=new Uint8Array(r.length+this.leftOver.length)).set(this.leftOver,0),e.set(r,this.leftOver.length)}else e=this.leftOver.concat(e);this.leftOver=null}var o=function(t,e){var i;for((e=e||t.length)>t.length&&(e=t.length),i=e-1;0<=i&&128==(192&t[i]);)i--;return i<0||0===i?e:i+a[t[i]]>e?i:e}(e),l=e;o!==e.length&&(s.uint8array?(l=e.subarray(0,o),this.leftOver=e.subarray(o,e.length)):(l=e.slice(0,o),this.leftOver=e.slice(o,e.length))),this.push({data:i.utf8decode(l),meta:t.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=h,n.inherits(c,o),c.prototype.processChunk=function(t){this.push({data:i.utf8encode(t.data),meta:t.meta})},i.Utf8EncodeWorker=c},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,e,i){var n=t("./support"),s=t("./base64"),r=t("./nodejsUtils"),o=t("set-immediate-shim"),a=t("./external");function l(t){return t}function h(t,e){for(var i=0;i>8;this.dir=!!(16&this.externalFileAttributes),0==t&&(this.dosPermissions=63&this.externalFileAttributes),3==t&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(t){if(this.extraFields[1]){var e=n(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(t){var e,i,n,s=t.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});t.index>>6:(i<65536?e[o++]=224|i>>>12:(e[o++]=240|i>>>18,e[o++]=128|i>>>12&63),e[o++]=128|i>>>6&63),e[o++]=128|63&i);return e},i.buf2binstring=function(t){return l(t,t.length)},i.binstring2buf=function(t){for(var e=new n.Buf8(t.length),i=0,s=e.length;i>10&1023,h[n++]=56320|1023&s)}return l(h,n)},i.utf8border=function(t,e){var i;for((e=e||t.length)>t.length&&(e=t.length),i=e-1;0<=i&&128==(192&t[i]);)i--;return i<0||0===i?e:i+o[t[i]]>e?i:e}},{"./common":41}],43:[function(t,e,i){e.exports=function(t,e,i,n){for(var s=65535&t|0,r=t>>>16&65535|0,o=0;0!==i;){for(i-=o=2e3>>1:t>>>1;e[i]=t}return e}();e.exports=function(t,e,i,s){var r=n,o=s+i;t^=-1;for(var a=s;a>>8^r[255&(t^e[a])];return-1^t}},{}],46:[function(t,e,i){var n,s=t("../utils/common"),r=t("./trees"),o=t("./adler32"),a=t("./crc32"),l=t("./messages"),h=-2,c=258,u=262,d=113;function f(t,e){return t.msg=l[e],e}function p(t){return(t<<1)-(4t.avail_out&&(i=t.avail_out),0!==i&&(s.arraySet(t.output,e.pending_buf,e.pending_out,i,t.next_out),t.next_out+=i,e.pending_out+=i,t.total_out+=i,t.avail_out-=i,e.pending-=i,0===e.pending&&(e.pending_out=0))}function g(t,e){r._tr_flush_block(t,0<=t.block_start?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,b(t.strm)}function y(t,e){t.pending_buf[t.pending++]=e}function S(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function v(t,e){var i,n,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match,l=t.strstart>t.w_size-u?t.strstart-(t.w_size-u):0,h=t.window,d=t.w_mask,f=t.prev,p=t.strstart+c,m=h[r+o-1],b=h[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do{if(h[(i=e)+o]===b&&h[i+o-1]===m&&h[i]===h[r]&&h[++i]===h[r+1]){r+=2,i++;do{}while(h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&h[++r]===h[++i]&&rl&&0!=--s);return o<=t.lookahead?o:t.lookahead}function x(t){var e,i,n,r,l,h,c,d,f,p,m=t.w_size;do{if(r=t.window_size-t.lookahead-t.strstart,t.strstart>=m+(m-u)){for(s.arraySet(t.window,t.window,m,m,0),t.match_start-=m,t.strstart-=m,t.block_start-=m,e=i=t.hash_size;n=t.head[--e],t.head[e]=m<=n?n-m:0,--i;);for(e=i=m;n=t.prev[--e],t.prev[e]=m<=n?n-m:0,--i;);r+=m}if(0===t.strm.avail_in)break;if(h=t.strm,c=t.window,d=t.strstart+t.lookahead,p=void 0,(f=r)<(p=h.avail_in)&&(p=f),i=0===p?0:(h.avail_in-=p,s.arraySet(c,h.input,h.next_in,p,d),1===h.state.wrap?h.adler=o(h.adler,c,p,d):2===h.state.wrap&&(h.adler=a(h.adler,c,p,d)),h.next_in+=p,h.total_in+=p,p),t.lookahead+=i,t.lookahead+t.insert>=3)for(l=t.strstart-t.insert,t.ins_h=t.window[l],t.ins_h=(t.ins_h<=3&&(t.ins_h=(t.ins_h<=3)if(n=r._tr_tally(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){for(t.match_length--;t.strstart++,t.ins_h=(t.ins_h<=3&&(t.ins_h=(t.ins_h<=3&&t.match_length<=t.prev_length){for(s=t.strstart+t.lookahead-3,n=r._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;++t.strstart<=s&&(t.ins_h=(t.ins_h<t.pending_buf_size-5&&(i=t.pending_buf_size-5);;){if(t.lookahead<=1){if(x(t),0===t.lookahead&&0===e)return 1;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var n=t.block_start+i;if((0===t.strstart||t.strstart>=n)&&(t.lookahead=t.strstart-n,t.strstart=n,g(t,!1),0===t.strm.avail_out))return 1;if(t.strstart-t.block_start>=t.w_size-u&&(g(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(g(t,!0),0===t.strm.avail_out?3:4):(t.strstart>t.block_start&&(g(t,!1),t.strm.avail_out),1)})),new w(4,4,8,4,E),new w(4,5,16,8,E),new w(4,6,32,32,E),new w(4,4,16,16,_),new w(8,16,32,32,_),new w(8,16,128,128,_),new w(8,32,128,256,_),new w(32,128,258,1024,_),new w(32,258,258,4096,_)],i.deflateInit=function(t,e){return L(t,e,8,15,8,0)},i.deflateInit2=L,i.deflateReset=P,i.deflateResetKeep=M,i.deflateSetHeader=function(t,e){return t&&t.state?2!==t.state.wrap?h:(t.state.gzhead=e,0):h},i.deflate=function(t,e){var i,s,o,l;if(!t||!t.state||5>8&255),y(s,s.gzhead.time>>16&255),y(s,s.gzhead.time>>24&255),y(s,9===s.level?2:2<=s.strategy||s.level<2?4:0),y(s,255&s.gzhead.os),s.gzhead.extra&&s.gzhead.extra.length&&(y(s,255&s.gzhead.extra.length),y(s,s.gzhead.extra.length>>8&255)),s.gzhead.hcrc&&(t.adler=a(t.adler,s.pending_buf,s.pending,0)),s.gzindex=0,s.status=69):(y(s,0),y(s,0),y(s,0),y(s,0),y(s,0),y(s,9===s.level?2:2<=s.strategy||s.level<2?4:0),y(s,3),s.status=d);else{var u=8+(s.w_bits-8<<4)<<8;u|=(2<=s.strategy||s.level<2?0:s.level<6?1:6===s.level?2:3)<<6,0!==s.strstart&&(u|=32),u+=31-u%31,s.status=d,S(s,u),0!==s.strstart&&(S(s,t.adler>>>16),S(s,65535&t.adler)),t.adler=1}if(69===s.status)if(s.gzhead.extra){for(o=s.pending;s.gzindex<(65535&s.gzhead.extra.length)&&(s.pending!==s.pending_buf_size||(s.gzhead.hcrc&&s.pending>o&&(t.adler=a(t.adler,s.pending_buf,s.pending-o,o)),b(t),o=s.pending,s.pending!==s.pending_buf_size));)y(s,255&s.gzhead.extra[s.gzindex]),s.gzindex++;s.gzhead.hcrc&&s.pending>o&&(t.adler=a(t.adler,s.pending_buf,s.pending-o,o)),s.gzindex===s.gzhead.extra.length&&(s.gzindex=0,s.status=73)}else s.status=73;if(73===s.status)if(s.gzhead.name){o=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>o&&(t.adler=a(t.adler,s.pending_buf,s.pending-o,o)),b(t),o=s.pending,s.pending===s.pending_buf_size)){l=1;break}l=s.gzindexo&&(t.adler=a(t.adler,s.pending_buf,s.pending-o,o)),0===l&&(s.gzindex=0,s.status=91)}else s.status=91;if(91===s.status)if(s.gzhead.comment){o=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>o&&(t.adler=a(t.adler,s.pending_buf,s.pending-o,o)),b(t),o=s.pending,s.pending===s.pending_buf_size)){l=1;break}l=s.gzindexo&&(t.adler=a(t.adler,s.pending_buf,s.pending-o,o)),0===l&&(s.status=103)}else s.status=103;if(103===s.status&&(s.gzhead.hcrc?(s.pending+2>s.pending_buf_size&&b(t),s.pending+2<=s.pending_buf_size&&(y(s,255&t.adler),y(s,t.adler>>8&255),t.adler=0,s.status=d)):s.status=d),0!==s.pending){if(b(t),0===t.avail_out)return s.last_flush=-1,0}else if(0===t.avail_in&&p(e)<=p(i)&&4!==e)return f(t,-5);if(666===s.status&&0!==t.avail_in)return f(t,-5);if(0!==t.avail_in||0!==s.lookahead||0!==e&&666!==s.status){var v=2===s.strategy?function(t,e){for(var i;;){if(0===t.lookahead&&(x(t),0===t.lookahead)){if(0===e)return 1;break}if(t.match_length=0,i=r._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,i&&(g(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(g(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(g(t,!1),0===t.strm.avail_out)?1:2}(s,e):3===s.strategy?function(t,e){for(var i,n,s,o,a=t.window;;){if(t.lookahead<=c){if(x(t),t.lookahead<=c&&0===e)return 1;if(0===t.lookahead)break}if(t.match_length=0,t.lookahead>=3&&0t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=3?(i=r._tr_tally(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(i=r._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),i&&(g(t,!1),0===t.strm.avail_out))return 1}return t.insert=0,4===e?(g(t,!0),0===t.strm.avail_out?3:4):t.last_lit&&(g(t,!1),0===t.strm.avail_out)?1:2}(s,e):n[s.level].func(s,e);if(3!==v&&4!==v||(s.status=666),1===v||3===v)return 0===t.avail_out&&(s.last_flush=-1),0;if(2===v&&(1===e?r._tr_align(s):5!==e&&(r._tr_stored_block(s,0,0,!1),3===e&&(m(s.head),0===s.lookahead&&(s.strstart=0,s.block_start=0,s.insert=0))),b(t),0===t.avail_out))return s.last_flush=-1,0}return 4!==e?0:s.wrap<=0?1:(2===s.wrap?(y(s,255&t.adler),y(s,t.adler>>8&255),y(s,t.adler>>16&255),y(s,t.adler>>24&255),y(s,255&t.total_in),y(s,t.total_in>>8&255),y(s,t.total_in>>16&255),y(s,t.total_in>>24&255)):(S(s,t.adler>>>16),S(s,65535&t.adler)),b(t),0=i.w_size&&(0===a&&(m(i.head),i.strstart=0,i.block_start=0,i.insert=0),d=new s.Buf8(i.w_size),s.arraySet(d,e,f-i.w_size,i.w_size,0),e=d,f=i.w_size),l=t.avail_in,c=t.next_in,u=t.input,t.avail_in=f,t.next_in=0,t.input=e,x(i);i.lookahead>=3;){for(n=i.strstart,r=i.lookahead-2;i.ins_h=(i.ins_h<>>=v=S>>>24,p-=v,0==(v=S>>>16&255))M[r++]=65535&S;else{if(!(16&v)){if(0==(64&v)){S=m[(65535&S)+(f&(1<>>=v,p-=v),p<15&&(f+=T[n++]<>>=v=S>>>24,p-=v,!(16&(v=S>>>16&255))){if(0==(64&v)){S=b[(65535&S)+(f&(1<>>=v,p-=v,(v=r-o)>3,f&=(1<<(p-=x<<3))-1,t.next_in=n,t.next_out=r,t.avail_in=n>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function c(){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 n.Buf16(320),this.work=new n.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function u(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=1,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new n.Buf32(852),e.distcode=e.distdyn=new n.Buf32(592),e.sane=1,e.back=-1,0):l}function d(t){var e;return t&&t.state?((e=t.state).wsize=0,e.whave=0,e.wnext=0,u(t)):l}function f(t,e){var i,n;return t&&t.state?(n=t.state,e<0?(i=0,e=-e):(i=1+(e>>4),e<48&&(e&=15)),e&&(e<8||15=o.wsize?(n.arraySet(o.window,e,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(s<(r=o.wsize-o.wnext)&&(r=s),n.arraySet(o.window,e,i-s,r,o.wnext),(s-=r)?(n.arraySet(o.window,e,i-s,s,0),o.wnext=s,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,i.check=r(i.check,O,2,0),g=b=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&b)<<8)+(b>>8))%31){t.msg="incorrect header check",i.mode=30;break}if(8!=(15&b)){t.msg="unknown compression method",i.mode=30;break}if(g-=4,I=8+(15&(b>>>=4)),0===i.wbits)i.wbits=I;else if(I>i.wbits){t.msg="invalid window size",i.mode=30;break}i.dmax=1<>8&1),512&i.flags&&(O[0]=255&b,O[1]=b>>>8&255,i.check=r(i.check,O,2,0)),g=b=0,i.mode=3;case 3:for(;g<32;){if(0===p)break t;p--,b+=c[d++]<>>8&255,O[2]=b>>>16&255,O[3]=b>>>24&255,i.check=r(i.check,O,4,0)),g=b=0,i.mode=4;case 4:for(;g<16;){if(0===p)break t;p--,b+=c[d++]<>8),512&i.flags&&(O[0]=255&b,O[1]=b>>>8&255,i.check=r(i.check,O,2,0)),g=b=0,i.mode=5;case 5:if(1024&i.flags){for(;g<16;){if(0===p)break t;p--,b+=c[d++]<>>8&255,i.check=r(i.check,O,2,0)),g=b=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&(p<(E=i.length)&&(E=p),E&&(i.head&&(I=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),n.arraySet(i.head.extra,c,d,E,I)),512&i.flags&&(i.check=r(i.check,c,E,d)),p-=E,d+=E,i.length-=E),i.length))break t;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===p)break t;for(E=0;I=c[d+E++],i.head&&I&&i.length<65536&&(i.head.name+=String.fromCharCode(I)),I&&E>9&1,i.head.done=!0),t.adler=i.check=0,i.mode=12;break;case 10:for(;g<32;){if(0===p)break t;p--,b+=c[d++]<>>=7&g,g-=7&g,i.mode=27;break}for(;g<3;){if(0===p)break t;p--,b+=c[d++]<>>=1)){case 0:i.mode=14;break;case 1:if(y(i),i.mode=20,6!==e)break;b>>>=2,g-=2;break t;case 2:i.mode=17;break;case 3:t.msg="invalid block type",i.mode=30}b>>>=2,g-=2;break;case 14:for(b>>>=7&g,g-=7&g;g<32;){if(0===p)break t;p--,b+=c[d++]<>>16^65535)){t.msg="invalid stored block lengths",i.mode=30;break}if(i.length=65535&b,g=b=0,i.mode=15,6===e)break t;case 15:i.mode=16;case 16:if(E=i.length){if(p>>=5,g-=5,i.ndist=1+(31&b),b>>>=5,g-=5,i.ncode=4+(15&b),b>>>=4,g-=4,286>>=3,g-=3}for(;i.have<19;)i.lens[D[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,N={bits:i.lenbits},R=a(0,i.lens,0,19,i.lencode,0,i.work,N),i.lenbits=N.bits,R){t.msg="invalid code lengths set",i.mode=30;break}i.have=0,i.mode=19;case 19:for(;i.have>>16&255,P=65535&B,!((T=B>>>24)<=g);){if(0===p)break t;p--,b+=c[d++]<>>=T,g-=T,i.lens[i.have++]=P;else{if(16===P){for(F=T+2;g>>=T,g-=T,0===i.have){t.msg="invalid bit length repeat",i.mode=30;break}I=i.lens[i.have-1],E=3+(3&b),b>>>=2,g-=2}else if(17===P){for(F=T+3;g>>=T)),b>>>=3,g-=3}else{for(F=T+7;g>>=T)),b>>>=7,g-=7}if(i.have+E>i.nlen+i.ndist){t.msg="invalid bit length repeat",i.mode=30;break}for(;E--;)i.lens[i.have++]=I}}if(30===i.mode)break;if(0===i.lens[256]){t.msg="invalid code -- missing end-of-block",i.mode=30;break}if(i.lenbits=9,N={bits:i.lenbits},R=a(1,i.lens,0,i.nlen,i.lencode,0,i.work,N),i.lenbits=N.bits,R){t.msg="invalid literal/lengths set",i.mode=30;break}if(i.distbits=6,i.distcode=i.distdyn,N={bits:i.distbits},R=a(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,N),i.distbits=N.bits,R){t.msg="invalid distances set",i.mode=30;break}if(i.mode=20,6===e)break t;case 20:i.mode=21;case 21:if(6<=p&&258<=m){t.next_out=f,t.avail_out=m,t.next_in=d,t.avail_in=p,i.hold=b,i.bits=g,o(t,x),f=t.next_out,u=t.output,m=t.avail_out,d=t.next_in,c=t.input,p=t.avail_in,b=i.hold,g=i.bits,12===i.mode&&(i.back=-1);break}for(i.back=0;M=(B=i.lencode[b&(1<>>16&255,P=65535&B,!((T=B>>>24)<=g);){if(0===p)break t;p--,b+=c[d++]<>L)])>>>16&255,P=65535&B,!(L+(T=B>>>24)<=g);){if(0===p)break t;p--,b+=c[d++]<>>=L,g-=L,i.back+=L}if(b>>>=T,g-=T,i.back+=T,i.length=P,0===M){i.mode=26;break}if(32&M){i.back=-1,i.mode=12;break}if(64&M){t.msg="invalid literal/length code",i.mode=30;break}i.extra=15&M,i.mode=22;case 22:if(i.extra){for(F=i.extra;g>>=i.extra,g-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;M=(B=i.distcode[b&(1<>>16&255,P=65535&B,!((T=B>>>24)<=g);){if(0===p)break t;p--,b+=c[d++]<>L)])>>>16&255,P=65535&B,!(L+(T=B>>>24)<=g);){if(0===p)break t;p--,b+=c[d++]<>>=L,g-=L,i.back+=L}if(b>>>=T,g-=T,i.back+=T,64&M){t.msg="invalid distance code",i.mode=30;break}i.offset=P,i.extra=15&M,i.mode=24;case 24:if(i.extra){for(F=i.extra;g>>=i.extra,g-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){t.msg="invalid distance too far back",i.mode=30;break}i.mode=25;case 25:if(0===m)break t;if(E=x-m,i.offset>E){if((E=i.offset-E)>i.whave&&i.sane){t.msg="invalid distance too far back",i.mode=30;break}_=E>i.wnext?(E-=i.wnext,i.wsize-E):i.wnext-E,E>i.length&&(E=i.length),w=i.window}else w=u,_=f-i.offset,E=i.length;for(my?(v=D[k+u[w]],N[F+u[w]]):(v=96,0),f=1<<_-A,T=p=1<>A)+(p-=f)]=S<<24|v<<16|x|0,0!==p;);for(f=1<<_-1;R&f;)f>>=1;if(0!==f?(R&=f-1,R+=f):R=0,w++,0==--B[_]){if(_===M)break;_=e[i+u[w]]}if(P<_&&(R&b)!==m){for(0===A&&(A=P),g+=T,C=1<<(L=_-A);L+A>>7)]}function T(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function M(t,e,i){t.bi_valid>16-i?(t.bi_buf|=e<>16-t.bi_valid,t.bi_valid+=i-16):(t.bi_buf|=e<>>=1,i<<=1,0<--e;);return i>>>1}function A(t,e,i){var n,s,r=new Array(16),o=0;for(n=1;n<=l;n++)r[n]=o=o+i[n-1]<<1;for(s=0;s<=e;s++){var a=t[2*s+1];0!==a&&(t[2*s]=L(r[a]++,a))}}function C(t){var e;for(e=0;e>1;1<=i;i--)N(t,r,i);for(s=h;i=t.heap[1],t.heap[1]=t.heap[t.heap_len--],N(t,r,1),n=t.heap[1],t.heap[--t.heap_max]=i,t.heap[--t.heap_max]=n,r[2*s]=r[2*i]+r[2*n],t.depth[s]=(t.depth[i]>=t.depth[n]?t.depth[i]:t.depth[n])+1,r[2*i+1]=r[2*n+1]=s,t.heap[1]=s++,N(t,r,1),2<=t.heap_len;);t.heap[--t.heap_max]=t.heap[1],function(t,e){var i,n,s,r,o,a,h=e.dyn_tree,c=e.max_code,u=e.stat_desc.static_tree,d=e.stat_desc.has_stree,f=e.stat_desc.extra_bits,p=e.stat_desc.extra_base,m=e.stat_desc.max_length,b=0;for(r=0;r<=l;r++)t.bl_count[r]=0;for(h[2*t.heap[t.heap_max]+1]=0,i=t.heap_max+1;i<573;i++)m<(r=h[2*h[2*(n=t.heap[i])+1]+1]+1)&&(r=m,b++),h[2*n+1]=r,c>=7;n>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e>>3,(o=t.static_len+3+7>>>3)<=s&&(s=o)):s=o=i+5,i+4<=s&&-1!==e?V(t,e,i,n):4===t.strategy||o===s?(M(t,2+(n?1:0),3),F(t,f,p)):(M(t,4+(n?1:0),3),function(t,e,i,n){var s;for(M(t,e-257,5),M(t,i-1,5),M(t,n-4,4),s=0;s>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&i,t.last_lit++,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(b[i]+r+1)]++,t.dyn_dtree[2*w(e)]++),t.last_lit===t.lit_bufsize-1},i._tr_align=function(t){var e;M(t,2,3),P(t,256,f),16===(e=t).bi_valid?(T(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}},{"../utils/common":41}],53:[function(t,e,i){e.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(t,e,i){e.exports="function"==typeof n?n:function(){var t=[].slice.apply(arguments);t.splice(1,0,0),setTimeout.apply(null,t)}},{}]},{},[10])(10)}).call(this,i(176).Buffer,i(43),i(180).setImmediate)},function(t,e,i){(function(t){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ var n=i(177),s=i(178),r=i(179);function o(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(o()=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function p(t,e){if(l.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var i=t.length;if(0===i)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return i;case"utf8":case"utf-8":case void 0:return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*i;case"hex":return i>>>1;case"base64":return W(t).length;default:if(n)return G(t).length;e=(""+e).toLowerCase(),n=!0}}function m(t,e,i){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if((i>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return A(this,e,i);case"utf8":case"utf-8":return M(this,e,i);case"ascii":return P(this,e,i);case"latin1":case"binary":return L(this,e,i);case"base64":return T(this,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,i);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function b(t,e,i){var n=t[e];t[e]=t[i],t[i]=n}function g(t,e,i,n,s){if(0===t.length)return-1;if("string"==typeof i?(n=i,i=0):i>2147483647?i=2147483647:i<-2147483648&&(i=-2147483648),i=+i,isNaN(i)&&(i=s?0:t.length-1),i<0&&(i=t.length+i),i>=t.length){if(s)return-1;i=t.length-1}else if(i<0){if(!s)return-1;i=0}if("string"==typeof e&&(e=l.from(e,n)),l.isBuffer(e))return 0===e.length?-1:y(t,e,i,n,s);if("number"==typeof e)return e&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(t,e,i):Uint8Array.prototype.lastIndexOf.call(t,e,i):y(t,[e],i,n,s);throw new TypeError("val must be string, number or Buffer")}function y(t,e,i,n,s){var r,o=1,a=t.length,l=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,a/=2,l/=2,i/=2}function h(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(s){var c=-1;for(r=i;ra&&(i=a-l),r=i;r>=0;r--){for(var u=!0,d=0;ds&&(n=s):n=s;var r=e.length;if(r%2!=0)throw new TypeError("Invalid hex string");n>r/2&&(n=r/2);for(var o=0;o>8,s=i%256,r.push(s),r.push(n);return r}(e,t.length-i),t,i,n)}function T(t,e,i){return 0===e&&i===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,i))}function M(t,e,i){i=Math.min(t.length,i);for(var n=[],s=e;s239?4:h>223?3:h>191?2:1;if(s+u<=i)switch(u){case 1:h<128&&(c=h);break;case 2:128==(192&(r=t[s+1]))&&(l=(31&h)<<6|63&r)>127&&(c=l);break;case 3:r=t[s+1],o=t[s+2],128==(192&r)&&128==(192&o)&&(l=(15&h)<<12|(63&r)<<6|63&o)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:r=t[s+1],o=t[s+2],a=t[s+3],128==(192&r)&&128==(192&o)&&128==(192&a)&&(l=(15&h)<<18|(63&r)<<12|(63&o)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,u=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),s+=u}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);for(var i="",n=0;nn)&&(i=n);for(var s="",r=e;ri)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,i,n,s,r){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>s||et.length)throw new RangeError("Index out of range")}function N(t,e,i,n){e<0&&(e=65535+e+1);for(var s=0,r=Math.min(t.length-i,2);s>>8*(n?s:1-s)}function F(t,e,i,n){e<0&&(e=4294967295+e+1);for(var s=0,r=Math.min(t.length-i,4);s>>8*(n?s:3-s)&255}function B(t,e,i,n,s,r){if(i+n>t.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function O(t,e,i,n,r){return r||B(t,0,i,4),s.write(t,e,i,n,23,4),i+4}function D(t,e,i,n,r){return r||B(t,0,i,8),s.write(t,e,i,n,52,8),i+8}e.Buffer=l,e.SlowBuffer=function(t){return+t!=t&&(t=0),l.alloc(+t)},e.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(e){return!1}}(),e.kMaxLength=o(),l.poolSize=8192,l._augment=function(t){return t.__proto__=l.prototype,t},l.from=function(t,e,i){return h(null,t,e,i)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(t,e,i){return n=null,r=e,o=i,c(s=t),s<=0?a(n,s):void 0!==r?"string"==typeof o?a(n,s).fill(r,o):a(n,s).fill(r):a(n,s);var n,s,r,o},l.allocUnsafe=function(t){return u(null,t)},l.allocUnsafeSlow=function(t){return u(null,t)},l.isBuffer=function(t){return!(null==t||!t._isBuffer)},l.compare=function(t,e){if(!l.isBuffer(t)||!l.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var i=t.length,n=e.length,s=0,r=Math.min(i,n);s0&&(t=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(t+=" ... ")),""},l.prototype.compare=function(t,e,i,n,s){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===i&&(i=t?t.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),e<0||i>t.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&e>=i)return 0;if(n>=s)return-1;if(e>=i)return 1;if(this===t)return 0;for(var r=(s>>>=0)-(n>>>=0),o=(i>>>=0)-(e>>>=0),a=Math.min(r,o),h=this.slice(n,s),c=t.slice(e,i),u=0;us)&&(i=s),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var r=!1;;)switch(n){case"hex":return S(this,t,e,i);case"utf8":case"utf-8":return v(this,t,e,i);case"ascii":return x(this,t,e,i);case"latin1":case"binary":return E(this,t,e,i);case"base64":return _(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,i);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),r=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},l.prototype.slice=function(t,e){var i,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e0&&(s*=256);)n+=this[t+--e]*s;return n},l.prototype.readUInt8=function(t,e){return e||I(t,1,this.length),this[t]},l.prototype.readUInt16LE=function(t,e){return e||I(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUInt16BE=function(t,e){return e||I(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUInt32LE=function(t,e){return e||I(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUInt32BE=function(t,e){return e||I(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function(t,e,i){t|=0,e|=0,i||I(t,e,this.length);for(var n=this[t],s=1,r=0;++r=(s*=128)&&(n-=Math.pow(2,8*e)),n},l.prototype.readIntBE=function(t,e,i){t|=0,e|=0,i||I(t,e,this.length);for(var n=e,s=1,r=this[t+--n];n>0&&(s*=256);)r+=this[t+--n]*s;return r>=(s*=128)&&(r-=Math.pow(2,8*e)),r},l.prototype.readInt8=function(t,e){return e||I(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){e||I(t,2,this.length);var i=this[t]|this[t+1]<<8;return 32768&i?4294901760|i:i},l.prototype.readInt16BE=function(t,e){e||I(t,2,this.length);var i=this[t+1]|this[t]<<8;return 32768&i?4294901760|i:i},l.prototype.readInt32LE=function(t,e){return e||I(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return e||I(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function(t,e){return e||I(t,4,this.length),s.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return e||I(t,4,this.length),s.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return e||I(t,8,this.length),s.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return e||I(t,8,this.length),s.read(this,t,!1,52,8)},l.prototype.writeUIntLE=function(t,e,i,n){t=+t,e|=0,i|=0,n||R(this,t,e,i,Math.pow(2,8*i)-1,0);var s=1,r=0;for(this[e]=255&t;++r=0&&(r*=256);)this[e+s]=t/r&255;return e+i},l.prototype.writeUInt8=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,1,255,0),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},l.prototype.writeUInt16LE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):N(this,t,e,!0),e+2},l.prototype.writeUInt16BE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):N(this,t,e,!1),e+2},l.prototype.writeUInt32LE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):F(this,t,e,!0),e+4},l.prototype.writeUInt32BE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):F(this,t,e,!1),e+4},l.prototype.writeIntLE=function(t,e,i,n){if(t=+t,e|=0,!n){var s=Math.pow(2,8*i-1);R(this,t,e,i,s-1,-s)}var r=0,o=1,a=0;for(this[e]=255&t;++r>0)-a&255;return e+i},l.prototype.writeIntBE=function(t,e,i,n){if(t=+t,e|=0,!n){var s=Math.pow(2,8*i-1);R(this,t,e,i,s-1,-s)}var r=i-1,o=1,a=0;for(this[e+r]=255&t;--r>=0&&(o*=256);)t<0&&0===a&&0!==this[e+r+1]&&(a=1),this[e+r]=(t/o>>0)-a&255;return e+i},l.prototype.writeInt8=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,1,127,-128),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):N(this,t,e,!0),e+2},l.prototype.writeInt16BE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):N(this,t,e,!1),e+2},l.prototype.writeInt32LE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):F(this,t,e,!0),e+4},l.prototype.writeInt32BE=function(t,e,i){return t=+t,e|=0,i||R(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):F(this,t,e,!1),e+4},l.prototype.writeFloatLE=function(t,e,i){return O(this,t,e,!0,i)},l.prototype.writeFloatBE=function(t,e,i){return O(this,t,e,!1,i)},l.prototype.writeDoubleLE=function(t,e,i){return D(this,t,e,!0,i)},l.prototype.writeDoubleBE=function(t,e,i){return D(this,t,e,!1,i)},l.prototype.copy=function(t,e,i,n){if(i||(i=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--s)t[s+e]=this[s+i];else if(r<1e3||!l.TYPED_ARRAY_SUPPORT)for(s=0;s>>=0,i=void 0===i?this.length:i>>>0,t||(t=0),"number"==typeof t)for(r=e;r55295&&i<57344){if(!s){if(i>56319){(e-=3)>-1&&r.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&r.push(239,191,189);continue}s=i;continue}if(i<56320){(e-=3)>-1&&r.push(239,191,189),s=i;continue}i=65536+(s-55296<<10|i-56320)}else s&&(e-=3)>-1&&r.push(239,191,189);if(s=null,i<128){if((e-=1)<0)break;r.push(i)}else if(i<2048){if((e-=2)<0)break;r.push(i>>6|192,63&i|128)}else if(i<65536){if((e-=3)<0)break;r.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;r.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return r}function W(t){return n.toByteArray(function(t){if((t=(e=t,e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")).replace(k,"")).length<2)return"";for(var e;t.length%4!=0;)t+="=";return t}(t))}function U(t,e,i,n){for(var s=0;s=e.length||s>=t.length);++s)e[s+i]=t[s];return s}}).call(this,i(43))},function(t,e,i){e.byteLength=function(t){var e=h(t),i=e[0],n=e[1];return 3*(i+n)/4-n},e.toByteArray=function(t){var e,i,n,o=h(t),a=o[0],l=o[1],c=new r(3*(a+(n=l))/4-n),u=0,d=l>0?a-4:a;for(i=0;i>16&255,c[u++]=e>>8&255,c[u++]=255&e;return 2===l&&(e=s[t.charCodeAt(i)]<<2|s[t.charCodeAt(i+1)]>>4,c[u++]=255&e),1===l&&(e=s[t.charCodeAt(i)]<<10|s[t.charCodeAt(i+1)]<<4|s[t.charCodeAt(i+2)]>>2,c[u++]=e>>8&255,c[u++]=255&e),c},e.fromByteArray=function(t){for(var e,i=t.length,s=i%3,r=[],o=0,a=i-s;oa?a:o+16383));return 1===s?(e=t[i-1],r.push(n[e>>2]+n[e<<4&63]+"==")):2===s&&(e=(t[i-2]<<8)+t[i-1],r.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"=")),r.join("")};for(var n=[],s=[],r="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=o.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.indexOf("=");return-1===i&&(i=e),[i,i===e?0:4-i%4]}function c(t,e,i){for(var s,r,o=[],a=e;a>18&63]+n[r>>12&63]+n[r>>6&63]+n[63&r]);return o.join("")}s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63},function(t,e){e.read=function(t,e,i,n,s){var r,o,a=8*s-n-1,l=(1<>1,c=-7,u=i?s-1:0,d=i?-1:1,f=t[e+u];for(u+=d,r=f&(1<<-c)-1,f>>=-c,c+=a;c>0;r=256*r+t[e+u],u+=d,c-=8);for(o=r&(1<<-c)-1,r>>=-c,c+=n;c>0;o=256*o+t[e+u],u+=d,c-=8);if(0===r)r=1-h;else{if(r===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),r-=h}return(f?-1:1)*o*Math.pow(2,r-n)},e.write=function(t,e,i,n,s,r){var o,a,l,h=8*r-s-1,c=(1<>1,d=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:r-1,p=n?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),(e+=o+u>=1?d/l:d*Math.pow(2,1-u))*l>=2&&(o++,l/=2),o+u>=c?(a=0,o=c):o+u>=1?(a=(e*l-1)*Math.pow(2,s),o+=u):(a=e*Math.pow(2,u-1)*Math.pow(2,s),o=0));s>=8;t[i+f]=255&a,f+=p,a/=256,s-=8);for(o=o<0;t[i+f]=255&o,f+=p,o/=256,h-=8);t[i+f-p]|=128*m}},function(t,e){var i={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==i.call(t)}},function(t,e,i){(function(t){var n=void 0!==t&&t||"undefined"!=typeof self&&self||window,s=Function.prototype.apply;function r(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new r(s.call(setTimeout,n,arguments),clearTimeout)},e.setInterval=function(){return new r(s.call(setInterval,n,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(n,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},i(181),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,i(43))},function(t,e,i){(function(t,e){!function(t,i){if(!t.setImmediate){var n,s,r,o,a,l=1,h={},c=!1,u=t.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(t);d=d&&d.setTimeout?d:t,"[object process]"==={}.toString.call(t.process)?n=function(t){e.nextTick((function(){p(t)}))}:function(){if(t.postMessage&&!t.importScripts){var e=!0,i=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=i,e}}()?(o="setImmediate$"+Math.random()+"$",a=function(e){e.source===t&&"string"==typeof e.data&&0===e.data.indexOf(o)&&p(+e.data.slice(o.length))},t.addEventListener?t.addEventListener("message",a,!1):t.attachEvent("onmessage",a),n=function(e){t.postMessage(o+e,"*")}):t.MessageChannel?((r=new MessageChannel).port1.onmessage=function(t){p(t.data)},n=function(t){r.port2.postMessage(t)}):u&&"onreadystatechange"in u.createElement("script")?(s=u.documentElement,n=function(t){var e=u.createElement("script");e.onreadystatechange=function(){p(t),e.onreadystatechange=null,s.removeChild(e),e=null},s.appendChild(e)}):n=function(t){setTimeout(p,0,t)},d.setImmediate=function(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),i=0;i1?s-1:0),o=1;os?s+"+":r},r=function(){if(n()||t.dot){var e={background:t.color};if(t.offset){var r=t.offset,o=r[0],a=r[1];i.default?(e.top=a+"px",e.right=-o+"px"):(e.marginTop=a+"px",e.marginLeft=o+"px")}return zn("div",{class:Ur({dot:t.dot,fixed:!!i.default}),style:e},[s()])}};return function(){if(i.default){var e=t.tag;return zn(e,{class:Ur("wrapper")},{default:function(){return[i.default(),r()]}})}return r()}}}),jr=_r("icon"),Hr=jr[0],Xr=jr[1];for(var Yr=Hr({props:{dot:Boolean,name:String,size:[Number,String],badge:[Number,String],color:String,tag:{type:String,default:"i"},classPrefix:{type:String,default:Xr()}},setup:function(t,e){var i=e.slots;return function(){var e=t.tag,n=t.dot,s=t.name,r=t.size,o=t.badge,a=t.color,l=t.classPrefix,h=function(t){return!!t&&-1!==t.indexOf("/")}(s);return zn(zr,{dot:n,tag:e,content:o,class:[l,h?"":l+"-"+s],style:{color:a,fontSize:Tr(r)}},{default:function(){return[null==i.default?void 0:i.default(),h&&zn("img",{class:Xr("image"),src:s},null)]}})}}}),Kr=_r("loading"),qr=Kr[0],$r=Kr[1],Jr=[],Zr=0;Zr<12;Zr++)Jr.push(zn("i",null,null));var Qr=zn("svg",{class:$r("circular"),viewBox:"25 25 50 50"},[zn("circle",{cx:"50",cy:"50",r:"20",fill:"none"},null)]),to=qr({props:{size:[Number,String],color:String,vertical:Boolean,textSize:[Number,String],textColor:String,type:{type:String,default:"circular"}},setup:function(t,e){var i=e.slots,n=Ps((function(){return Rr({color:t.color},Mr(t.size))})),s=function(){var e;if(i.default)return zn("span",{class:$r("text"),style:{fontSize:Tr(t.textSize),color:null!=(e=t.textColor)?e:t.color}},[i.default()])};return function(){var e=t.type,i=t.vertical;return zn("div",{class:$r([e,{vertical:i}])},[zn("span",{class:$r("spinner",e),style:n.value},["spinner"===e?Jr:Qr]),s()])}}});function eo(t){return"function"==typeof t||"[object Object]"===Object.prototype.toString.call(t)&&!kn(t)}var io=_r("button"),no=io[0],so=io[1],ro=no({props:Rr({},kr,{text:String,icon:String,color:String,block:Boolean,plain:Boolean,round:Boolean,square:Boolean,loading:Boolean,hairline:Boolean,disabled:Boolean,iconPrefix:String,loadingText:String,loadingType:String,tag:{type:String,default:"button"},type:{type:String,default:"default"},size:{type:String,default:"normal"},nativeType:{type:String,default:"button"},loadingSize:{type:String,default:"20px"},iconPosition:{type:String,default:"left"}}),emits:["click"],setup:function(t,e){var i=e.emit,n=e.slots,s=Vr(),r=function(){return t.loading?n.loading?n.loading():zn(to,{class:so("loading"),size:t.loadingSize,type:t.loadingType,color:"currentColor"},null):t.icon?zn(Yr,{name:t.icon,class:so("icon"),classPrefix:t.iconPrefix},null):void 0},o=function(){var e;if(e=t.loading?t.loadingText:n.default?n.default():t.text)return zn("span",{class:so("text")},eo(e)?e:{default:function(){return[e]}})},a=function(){var e=t.color,i=t.plain;if(e){var n={};return n.color=i?e:"white",i||(n.background=e),-1!==e.indexOf("gradient")?n.border=0:n.borderColor=e,n}},l=function(e){t.loading&&e.preventDefault(),t.loading||t.disabled||(i("click",e),s())};return function(){var e,i,n=t.tag,s=t.type,h=t.size,c=t.block,u=t.round,d=t.plain,f=t.square,p=t.loading,m=t.disabled,b=t.hairline,g=t.nativeType,y=t.iconPosition,S=[so([s,h,{plain:d,block:c,round:u,square:f,loading:p,disabled:m,hairline:b}]),(i={},i["van-hairline--surround"]=b,i)];return zn(n,{type:g,class:S,style:a(),disabled:m,onClick:l},eo(e=zn("div",{class:so("content")},["left"===y&&r(),o(),"right"===y&&r()]))?e:{default:function(){return[e]}})}}});function oo(){var t=te(0),e=te(0),i=te(0),n=te(0),s=te(0),r=te(0),o=te(""),a=function(){i.value=0,n.value=0,s.value=0,r.value=0,o.value=""};return{move:function(a){var l,h,c=a.touches[0];i.value=c.clientX-t.value,n.value=c.clientY-e.value,s.value=Math.abs(i.value),r.value=Math.abs(n.value),o.value||(o.value=(l=s.value,h=r.value,l>h&&l>10?"horizontal":h>l&&h>10?"vertical":""))},start:function(i){a(),t.value=i.touches[0].clientX,e.value=i.touches[0].clientY},reset:a,startX:t,startY:e,deltaX:i,deltaY:n,offsetX:s,offsetY:r,direction:o,isVertical:function(){return"vertical"===o.value},isHorizontal:function(){return"horizontal"===o.value}}}var ao=0;function lo(t,e){var i=oo(),n=function(e){i.move(e);var n=i.deltaY.value>0?"10":"01",s=function(t,e){void 0===e&&(e=window);for(var i=t;i&&i!==e&&Dr(i);){var n=window.getComputedStyle(i).overflowY;if(Or.test(n))return i;i=i.parentNode}return e}(e.target,t.value),r=s.scrollHeight,o=s.offsetHeight,a=s.scrollTop,l="11";0===a?l=o>=r?"00":"01":a+o>=r&&(l="10"),"11"===l||!i.isVertical()||parseInt(l,2)&parseInt(n,2)||Lr(e,!0)};return[function(){e()&&(document.addEventListener("touchstart",i.start),document.addEventListener("touchmove",n,!!Nr&&{passive:!1}),ao||document.body.classList.add("van-overflow-hidden"),ao++)},function(){e()&&ao&&(document.removeEventListener("touchstart",i.start),document.removeEventListener("touchmove",n),--ao||document.body.classList.remove("van-overflow-hidden"))}]}function ho(t){var e=te(!1);return Vi(t,(function(t){t&&(e.value=t)}),{immediate:!0}),function(t){return function(){return e.value?t():null}}}var co=_r("overlay"),uo=co[0],fo=co[1],po=uo({props:{show:Boolean,zIndex:[Number,String],duration:[Number,String],className:null,customStyle:Object,lockScroll:{type:Boolean,default:!0}},setup:function(t,e){var i=e.slots,n=ho((function(){return t.show})),s=function(t){Lr(t,!0)},r=n((function(){var e=Rr({zIndex:void 0!==t.zIndex?+t.zIndex:void 0},t.customStyle);return ur(t.duration)&&(e.animationDuration=t.duration+"s"),cn(zn("div",{style:e,class:[fo(),t.className],onTouchmove:t.lockScroll?s:cr},[null==i.default?void 0:i.default()]),[[nr,t.show]])}));return function(){var t,e;return zn(Ys,{name:"van-fade"},"function"==typeof(e=t=r())||"[object Object]"===Object.prototype.toString.call(e)&&!kn(e)?t:{default:function(){return[t]}})}}});var mo=_r("popup"),bo=mo[0],go=mo[1],yo={zIndex:2e3,lockCount:0,stack:[],find:function(t){return this.stack.filter((function(e){return e.vm===t}))[0]}},So=bo({inheritAttrs:!1,props:Rr({},{show:Boolean,zIndex:[Number,String],duration:[Number,String],teleport:[String,Object],overlayStyle:Object,overlayClass:null,transitionAppear:Boolean,overlay:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},lazyRender:{type:Boolean,default:!0},closeOnClickOverlay:{type:Boolean,default:!0}},{round:Boolean,closeable:Boolean,transition:String,closeOnPopstate:Boolean,safeAreaInsetBottom:Boolean,position:{type:String,default:"center"},closeIcon:{type:String,default:"cross"},closeIconPosition:{type:String,default:"top-right"}}),emits:["open","close","click","opened","closed","update:show","click-overlay","click-close-icon"],setup:function(t,e){var i,n,s,r,o=e.emit,a=e.attrs,l=e.slots,h=te(),c=te(),u=lo(c,(function(){return t.lockScroll})),d=u[0],f=u[1],p=ho((function(){return t.show||!t.lazyRender})),m=Ps((function(){var e={zIndex:h.value};ur(t.duration)&&(e["center"===t.position?"animationDuration":"transitionDuration"]=t.duration+"s");return e})),b=function(){i||(void 0!==t.zIndex&&(yo.zIndex=t.zIndex),i=!0,d(),h.value=++yo.zIndex)},g=function(){i&&(i=!1,f(),o("update:show",!1))},y=function(){o("click-overlay"),t.closeOnClickOverlay&&g()},S=function(){if(t.overlay)return zn(po,{show:t.show,class:t.overlayClass,zIndex:h.value,duration:t.duration,customStyle:t.overlayStyle,onClick:y},null)},v=function(t){o("click-close-icon",t),g()},x=function(){if(t.closeable)return zn(Yr,{role:"button",tabindex:"0",name:t.closeIcon,class:go("close-icon",t.closeIconPosition),onClick:v},null)},E=function(t){return o("click",t)},_=function(){return o("opened")},w=function(){return o("closed")},T=p((function(){var e,i=t.round,n=t.position,s=t.safeAreaInsetBottom;return cn(zn("div",$n({ref:c,style:m.value,class:go((e={round:i},e[n]=n,e["safe-area-inset-bottom"]=s,e)),onClick:E},a),[null==l.default?void 0:l.default(),x()]),[[nr,t.show]])})),M=function(){var e,i,n=t.position,s=t.transition,r=t.transitionAppear;return zn(Ys,{name:s||("center"===n?"van-fade":"van-popup-slide-"+n),appear:r,onAfterEnter:_,onAfterLeave:w},"function"==typeof(i=e=T())||"[object Object]"===Object.prototype.toString.call(i)&&!kn(i)?e:{default:function(){return[e]}})};return Vi((function(){return t.show}),(function(t){t?(b(),o("open")):(g(),o("close"))})),s={popupRef:c},(r=ps())&&Rr(r.proxy,s),Br("popstate",(function(){t.closeOnPopstate&&(g(),n=!1)})),Ii((function(){t.show&&b()})),Zi((function(){n&&(o("update:show",!0),n=!1)})),Qi((function(){t.show&&(g(),n=!0)})),Fi((function(){i&&f()})),function(){return t.teleport?zn(Cn,{to:t.teleport},{default:function(){return[S(),M()]}}):zn(Rn,null,[S(),M()])}}});var vo=_r("skeleton"),xo=vo[0],Eo=vo[1],_o=xo({props:{title:Boolean,round:Boolean,avatar:Boolean,avatarSize:[Number,String],titleWidth:[Number,String],row:{type:[Number,String],default:0},loading:{type:Boolean,default:!0},animate:{type:Boolean,default:!0},avatarShape:{type:String,default:"round"},rowWidth:{type:[Number,String,Array],default:"100%"}},setup:function(t,e){var i=e.slots,n=function(){if(t.avatar)return zn("div",{class:Eo("avatar",t.avatarShape),style:Mr(t.avatarSize)},null)},s=function(){if(t.title)return zn("h3",{class:Eo("title"),style:{width:Tr(t.titleWidth)}},null)},r=function(){for(var e,i,n=[],s=0;st[1]?t.slice(0).reverse():t}(e).map(g):g(e),y(e,t.modelValue)||a("update:modelValue",e),i&&!y(e,n)&&a("change",e)},v=function(e){if(e.stopPropagation(),!t.disabled&&!t.readonly){var i=t.min,n=t.vertical,s=t.modelValue,r=Ir(h),o=n?e.clientY-r.top:e.clientX-r.left,a=n?r.height:r.width,l=Number(i)+o/a*d.value;if(p(s)){var c=s[0],u=s[1];S(l<=(c+u)/2?[l,u]:[c,l],!0)}else S(l,!0)}},x=function(e){if(!t.disabled&&!t.readonly){"start"===c.value&&a("drag-start"),Lr(e,!0),u.move(e),c.value="draging";var r=Ir(h),o=(t.vertical?u.deltaY.value:u.deltaX.value)/(t.vertical?r.height:r.width)*d.value;p(n)?s[i]=n[i]+o:s=n+o,S(s)}},E=function(){t.disabled||t.readonly||("draging"===c.value&&(S(s,!0),a("drag-end")),c.value="")},_=function(e){var r="number"==typeof e?t.modelValue[e]:t.modelValue;return zn("div",{role:"slider",class:Mo(function(){if("number"==typeof e){return"button-wrapper-"+["left","right"][e]}return"button-wrapper"}()),tabindex:t.disabled||t.readonly?-1:0,"aria-valuemin":+t.min,"aria-valuenow":r,"aria-valuemax":+t.max,"aria-orientation":t.vertical?"vertical":"horizontal",onTouchstart:function(r){var o;"number"==typeof e&&(i=e),o=r,t.disabled||t.readonly||(u.start(o),s=t.modelValue,n=p(s)?s.map(g):g(s),c.value="start")},onTouchmove:x,onTouchend:E,onTouchcancel:E,onClick:Pr},[l.button?l.button():zn("div",{class:Mo("button"),style:Mr(t.buttonSize)},null)])};return S(t.modelValue),r=function(){return t.modelValue},(o=Jn("vanField",null))&&!o.childFieldValue.value&&(o.childFieldValue.value=r,Vi(r,(function(){o.resetValidation(),o.validateWithTrigger("onChange")}))),function(){return zn("div",{ref:h,style:f.value,class:Mo({vertical:t.vertical,disabled:t.disabled}),onClick:v},[zn("div",{class:Mo("bar"),style:b.value},[t.range?[_(0),_(1)]:_()])])}}}),Lo=String.prototype.replace,Ao=/%20/g,Co="RFC3986",Io={default:Co,formatters:{RFC1738:function(t){return Lo.call(t,Ao,"+")},RFC3986:function(t){return String(t)}},RFC1738:"RFC1738",RFC3986:Co},Ro=Object.prototype.hasOwnProperty,No=Array.isArray,Fo=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}(),Bo=function(t,e){for(var i=e&&e.plainObjects?Object.create(null):{},n=0;n1;){var e=t.pop(),i=e.obj[e.prop];if(No(i)){for(var n=[],s=0;s=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||s===Io.RFC1738&&(40===l||41===l)?o+=r.charAt(a):l<128?o+=Fo[l]:l<2048?o+=Fo[192|l>>6]+Fo[128|63&l]:l<55296||l>=57344?o+=Fo[224|l>>12]+Fo[128|l>>6&63]+Fo[128|63&l]:(a+=1,l=65536+((1023&l)<<10|1023&r.charCodeAt(a)),o+=Fo[240|l>>18]+Fo[128|l>>12&63]+Fo[128|l>>6&63]+Fo[128|63&l])}return o},isBuffer:function(t){return!(!t||"object"!=typeof t)&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))},isRegExp:function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},maybeMap:function(t,e){if(No(t)){for(var i=[],n=0;n0?b.join(",")||null:void 0}];else if(Vo(a))g=a;else{var S=Object.keys(b);g=l?S.sort(l):S}for(var v=0;v-1?t.split(","):t},Jo=function(t,e,i,n){if(t){var s=i.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,r=/(\[[^[\]]*])/g,o=i.depth>0&&/(\[[^[\]]*])/.exec(s),a=o?s.slice(0,o.index):s,l=[];if(a){if(!i.plainObjects&&Xo.call(Object.prototype,a)&&!i.allowPrototypes)return;l.push(a)}for(var h=0;i.depth>0&&null!==(o=r.exec(s))&&h=0;--r){var o,a=t[r];if("[]"===a&&i.parseArrays)o=[].concat(s);else{o=i.plainObjects?Object.create(null):{};var l="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,h=parseInt(l,10);i.parseArrays||""!==l?!isNaN(h)&&a!==l&&String(h)===l&&h>=0&&i.parseArrays&&h<=i.arrayLimit?(o=[])[h]=s:o[l]=s:o={0:s}}s=o}return s}(l,e,i,n)}},Zo=function(t,e){var i=function(t){if(!t)return Ko;if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var e=void 0===t.charset?Ko.charset:t.charset;return{allowDots:void 0===t.allowDots?Ko.allowDots:!!t.allowDots,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:Ko.allowPrototypes,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:Ko.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:Ko.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:Ko.comma,decoder:"function"==typeof t.decoder?t.decoder:Ko.decoder,delimiter:"string"==typeof t.delimiter||Oo.isRegExp(t.delimiter)?t.delimiter:Ko.delimiter,depth:"number"==typeof t.depth||!1===t.depth?+t.depth:Ko.depth,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:Ko.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:Ko.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:Ko.plainObjects,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:Ko.strictNullHandling}}(e);if(""===t||null==t)return i.plainObjects?Object.create(null):{};for(var n="string"==typeof t?function(t,e){var i,n={},s=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,r=e.parameterLimit===1/0?void 0:e.parameterLimit,o=s.split(e.delimiter,r),a=-1,l=e.charset;if(e.charsetSentinel)for(i=0;i-1&&(c=Yo(c)?[c]:c),Xo.call(n,h)?n[h]=Oo.combine(n[h],c):n[h]=c}return n}(t,i):t,s=i.plainObjects?Object.create(null):{},r=Object.keys(n),o=0;o0?u+c:""},ta="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==ta&&ta,ea="URLSearchParams"in ta,ia="Symbol"in ta&&"iterator"in Symbol,na="FileReader"in ta&&"Blob"in ta&&function(){try{return new Blob,!0}catch(xl){return!1}}(),sa="FormData"in ta,ra="ArrayBuffer"in ta;if(ra)var oa=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],aa=ArrayBuffer.isView||function(t){return t&&oa.indexOf(Object.prototype.toString.call(t))>-1};function la(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t.toLowerCase()}function ha(t){return"string"!=typeof t&&(t=String(t)),t}function ca(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return ia&&(e[Symbol.iterator]=function(){return e}),e}function ua(t){this.map={},t instanceof ua?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function da(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function fa(t){return new Promise((function(e,i){t.onload=function(){e(t.result)},t.onerror=function(){i(t.error)}}))}function pa(t){var e=new FileReader,i=fa(e);return e.readAsArrayBuffer(t),i}function ma(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function ba(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:na&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:sa&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:ea&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():ra&&na&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=ma(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):ra&&(ArrayBuffer.prototype.isPrototypeOf(t)||aa(t))?this._bodyArrayBuffer=ma(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="";var i=this.headers.get("content-type");i?i.indexOf("json")>=0&&"string"!=typeof this._bodyInit&&(this._bodyInit=this._bodyText):"string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):ea&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8")},na&&(this.blob=function(){var t=da(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=da(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(pa)}),this.text=function(){var t,e,i,n=da(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,i=fa(e),e.readAsText(t),i;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),i=new Array(e.length),n=0;n-1?n:i),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&s)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(s),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var r=/([?&])_=[^&]*/;if(r.test(this.url))this.url=this.url.replace(r,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function Sa(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var i=t.split("="),n=i.shift().replace(/\+/g," "),s=i.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(s))}})),e}function va(t,e){if(!(this instanceof va))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===e.statusText?"":""+e.statusText,this.headers=new ua(e.headers),this.url=e.url||"",this._initBody(t)}ya.prototype.clone=function(){return new ya(this,{body:this._bodyInit})},ba.call(ya.prototype),ba.call(va.prototype),va.prototype.clone=function(){return new va(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new ua(this.headers),url:this.url})},va.error=function(){var t=new va(null,{status:0,statusText:""});return t.type="error",t};var xa=[301,302,303,307,308];va.redirect=function(t,e){if(-1===xa.indexOf(e))throw new RangeError("Invalid status code");return new va(null,{status:e,headers:{location:t}})};var Ea=ta.DOMException;try{new Ea}catch(El){(Ea=function(t,e){this.message=t,this.name=e;var i=Error(t);this.stack=i.stack}).prototype=Object.create(Error.prototype),Ea.prototype.constructor=Ea}function _a(t,e){return new Promise((function(i,n){var s=new ya(t,e);if(s.signal&&s.signal.aborted)return n(new Ea("Aborted","AbortError"));var r=new XMLHttpRequest;function o(){r.abort()}r.onload=function(){var t,e,n={status:r.status,statusText:r.statusText,headers:(t=r.getAllResponseHeaders()||"",e=new ua,t.replace(/\r?\n[\t ]+/g," ").split("\r").map((function(t){return 0===t.indexOf("\n")?t.substr(1,t.length):t})).forEach((function(t){var i=t.split(":"),n=i.shift().trim();if(n){var s=i.join(":").trim();e.append(n,s)}})),e)};n.url="responseURL"in r?r.responseURL:n.headers.get("X-Request-URL");var s="response"in r?r.response:r.responseText;setTimeout((function(){i(new va(s,n))}),0)},r.onerror=function(){setTimeout((function(){n(new TypeError("Network request failed"))}),0)},r.ontimeout=function(){setTimeout((function(){n(new TypeError("Network request failed"))}),0)},r.onabort=function(){setTimeout((function(){n(new Ea("Aborted","AbortError"))}),0)},r.open(s.method,function(t){try{return""===t&&ta.location.href?ta.location.href:t}catch(xl){return t}}(s.url),!0),"include"===s.credentials?r.withCredentials=!0:"omit"===s.credentials&&(r.withCredentials=!1),"responseType"in r&&(na?r.responseType="blob":ra&&s.headers.get("Content-Type")&&-1!==s.headers.get("Content-Type").indexOf("application/octet-stream")&&(r.responseType="arraybuffer")),!e||"object"!=typeof e.headers||e.headers instanceof ua?s.headers.forEach((function(t,e){r.setRequestHeader(e,t)})):Object.getOwnPropertyNames(e.headers).forEach((function(t){r.setRequestHeader(t,ha(e.headers[t]))})),s.signal&&(s.signal.addEventListener("abort",o),r.onreadystatechange=function(){4===r.readyState&&s.signal.removeEventListener("abort",o)}),r.send(void 0===s._bodyInit?null:s._bodyInit)}))}_a.polyfill=!0,ta.fetch||(ta.fetch=_a,ta.Headers=ua,ta.Request=ya,ta.Response=va),self.fetch.bind(self);var wa=function(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t};var Ta=function(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{global:!1,core:!1,defaultInstance:!1},n=!1,s=!1,r=!1;"number"==typeof i?(process&&process.env&&console.warn('use() options should be object, number property would be deprecated in future,please update use() options to "{ core: true }".'),n=!0,s=!1):"object"===Fa(i)&&i&&(s=i.global||!1,n=i.core||!1,r=i.defaultInstance||!1),s?t.globalMiddlewares.splice(t.globalMiddlewares.length-t.defaultGlobalMiddlewaresLength,0,e):n?t.coreMiddlewares.splice(t.coreMiddlewares.length-t.defaultCoreMiddlewaresLength,0,e):r?this.defaultMiddlewares.push(e):this.middlewares.push(e)}},{key:"execute",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=Ba([].concat(Aa(this.middlewares),Aa(this.defaultMiddlewares),Aa(t.globalMiddlewares),Aa(t.coreMiddlewares)));return i(e)}}]),t}();Oa.globalMiddlewares=[],Oa.defaultGlobalMiddlewaresLength=0,Oa.coreMiddlewares=[],Oa.defaultCoreMiddlewaresLength=0;var Da=function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t};var ka=function(t,e){return!e||"object"!==Fa(e)&&"function"!=typeof e?Da(t):e},Va=Na((function(t){function e(i){return t.exports=e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},e(i)}t.exports=e})),Ga=Na((function(t){function e(i,n){return t.exports=e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},e(i,n)}t.exports=e}));var Wa=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Ga(t,e)};var Ua=function(t){return-1!==Function.toString.call(t).indexOf("[native code]")},za=Na((function(t){function e(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(xl){return!1}}function i(n,s,r){return e()?t.exports=i=Reflect.construct:t.exports=i=function(t,e,i){var n=[null];n.push.apply(n,e);var s=new(Function.bind.apply(t,n));return i&&Ga(s,i.prototype),s},i.apply(null,arguments)}t.exports=i})),ja=Na((function(t){function e(i){var n="function"==typeof Map?new Map:void 0;return t.exports=e=function(t){if(null===t||!Ua(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,e)}function e(){return za(t,arguments,Va(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),Ga(e,t)},e(i)}t.exports=e})),Ha=function(){function t(e){Ca(this,t),this.cache=new Map,this.timer={},this.extendOptions(e)}return Ra(t,[{key:"extendOptions",value:function(t){this.maxCache=t.maxCache||0}},{key:"get",value:function(t){return this.cache.get(JSON.stringify(t))}},{key:"set",value:function(t,e){var i=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:6e4;if(this.maxCache>0&&this.cache.size>=this.maxCache){var s=Aa(this.cache.keys())[0];this.cache.delete(s),this.timer[s]&&clearTimeout(this.timer[s])}var r=JSON.stringify(t);this.cache.set(r,e),n>0&&(this.timer[r]=setTimeout((function(){i.cache.delete(r),delete i.timer[r]}),n))}},{key:"delete",value:function(t){var e=JSON.stringify(t);return delete this.timer[e],this.cache.delete(e)}},{key:"clear",value:function(){return this.timer={},this.cache.clear()}}]),t}(),Xa=function(t){function e(t,i){var n,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"RequestError";return Ca(this,e),(n=ka(this,Va(e).call(this,t))).name="RequestError",n.request=i,n.type=s,n}return Wa(e,t),e}(ja(Error)),Ya=function(t){function e(t,i,n,s){var r,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"ResponseError";return Ca(this,e),(r=ka(this,Va(e).call(this,i||t.statusText))).name="ResponseError",r.data=n,r.response=t,r.request=s,r.type=o,r}return Wa(e,t),e}(ja(Error));function Ka(t){return new Promise((function(e,i){var n=new FileReader;n.onload=function(){e(n.result)},n.onerror=i,n.readAsText(t,"GBK")}))}function qa(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;try{return JSON.parse(t)}catch(xl){if(e)throw new Ya(i,"JSON.parse fail",t,n,"ParseError")}return t}function $a(t){return new Promise((function(e,i){t.cancelToken&&t.cancelToken.promise.then((function(t){i(t)}))}))}var Ja=Object.prototype.toString;function Za(){var t;return"undefined"!=typeof process&&"[object process]"===Ja.call(process)&&(t="NODE"),"undefined"!=typeof XMLHttpRequest&&(t="BROWSER"),t}function Qa(t){return"object"===Fa(t)&&"[object Array]"===Object.prototype.toString.call(t)}function tl(t){return"undefined"!=typeof URLSearchParams&&t instanceof URLSearchParams}function el(t){return null!==t&&"object"===Fa(t)}function il(t,e){if(t)if("object"!==Fa(t)&&(t=[t]),Qa(t))for(var i=0;i=200&&i.status<300)return a?void(t.res={data:e,response:i}):void(t.res=e);throw new Ya(i,"http error",e,s,"HttpError")}}})).catch((function(e){if(e instanceof Xa||e instanceof Ya)throw e;var i=t.req,n=t.res;throw e.request=e.request||i,e.response=e.response||n,e.type=e.type||e.name,e.data=e.data||void 0,e}))}],cl=[function(t,e){if(!t)return e();var i=t.req,n=(i=void 0===i?{}:i).options,s=void 0===n?{}:n,r=i.url,o=void 0===r?"":r,a=t.cache,l=t.responseInterceptors,h=s.timeout,c=void 0===h?0:h,u=s.__umiRequestCoreType__,d=void 0===u?"normal":u,f=s.useCache,p=void 0!==f&&f,m=s.method,b=void 0===m?"get":m,g=s.params,y=s.ttl,S=s.validateCache,v=void 0===S?al:S;if("normal"!==d)return process&&process.env&&!1===ol&&(ol=!0,console.warn("__umiRequestCoreType__ is a internal property that use in umi-request, change its value would affect the behavior of request! It only use when you want to extend or use request core.")),e();var x=fetch;if(!x)throw new Error("Global fetch not exist!");var E,_,w,T="BROWSER"===Za(),M=v(o,s)&&p&&T;if(M){var P=a.get({url:o,params:g,method:b});if(P)return(P=P.clone()).useCache=!0,t.res=P,e()}return E=c>0?Promise.race([$a(s),x(o,s),(_=c,w=t.req,new Promise((function(t,e){setTimeout((function(){e(new Xa("timeout of ".concat(_,"ms exceeded"),w,"Timeout"))}),_)})))]):Promise.race([$a(s),x(o,s)]),l.forEach((function(t){E=E.then((function(e){var i="function"==typeof e.clone?e.clone():e;return t(i,s)}))})),E.then((function(i){if(M&&200===i.status){var n=i.clone();n.useCache=!0,a.set({url:o,params:g,method:b},n,y)}return t.res=i,e()}))}];Oa.globalMiddlewares=hl,Oa.defaultGlobalMiddlewaresLength=hl.length,Oa.coreMiddlewares=cl,Oa.defaultCoreMiddlewaresLength=cl.length;var ul=function(){function t(e){Ca(this,t),this.onion=new Oa([]),this.fetchIndex=0,this.mapCache=new Ha(e),this.initOptions=e,this.instanceRequestInterceptors=[],this.instanceResponseInterceptors=[]}return Ra(t,[{key:"use",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{global:!1,core:!1};return this.onion.use(t,e),this}},{key:"extendOptions",value:function(t){this.initOptions=rl(this.initOptions,t),this.mapCache.extendOptions(t)}},{key:"dealRequestInterceptors",value:function(e){return[].concat(Aa(t.requestInterceptors),Aa(this.instanceRequestInterceptors)).reduce((function(t,i){return t.then((function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.req.url=t.url||e.req.url,e.req.options=t.options||e.req.options,i(e.req.url,e.req.options)}))}),Promise.resolve()).then((function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.req.url=t.url||e.req.url,e.req.options=t.options||e.req.options,Promise.resolve()}))}},{key:"request",value:function(e,i){var n=this,s=this.onion,r={req:{url:e,options:i},res:null,cache:this.mapCache,responseInterceptors:[].concat(Aa(t.responseInterceptors),Aa(this.instanceResponseInterceptors))};if("string"!=typeof e)throw new Error("url MUST be a string");return new Promise((function(t,e){n.dealRequestInterceptors(r).then((function(){return s.execute(r)})).then((function(){t(r.res)})).catch((function(i){var n=r.req.options.errorHandler;if(n)try{var s=n(i);t(s)}catch(xl){e(xl)}else e(i)}))}))}}],[{key:"requestUse",value:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{global:!0};if("function"!=typeof e)throw new TypeError("Interceptor must be function!");i.global?t.requestInterceptors.push(e):this.instanceRequestInterceptors.push(e)}},{key:"responseUse",value:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{global:!0};if("function"!=typeof e)throw new TypeError("Interceptor must be function!");i.global?t.responseInterceptors.push(e):this.instanceResponseInterceptors.push(e)}}]),t}();function dl(t){this.message=t}function fl(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var i=this;t((function(t){i.reason||(i.reason=new dl(t),e(i.reason))}))}function pl(t){return!(!t||!t.__CANCEL__)}ul.requestInterceptors=[function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.prefix,n=e.suffix;return i&&(t="".concat(i).concat(t)),n&&(t="".concat(t).concat(n)),{url:t,options:e}}],ul.responseInterceptors=[],dl.prototype.toString=function(){return this.message?"Cancel: ".concat(this.message):"Cancel"},dl.prototype.__CANCEL__=!0,fl.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},fl.source=function(){var t;return{token:new fl((function(e){t=e})),cancel:t}};var ml=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=new ul(t),i=function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=rl(e.initOptions,i);return e.request(t,n)};i.use=e.use.bind(e),i.fetchIndex=e.fetchIndex,i.interceptors={request:{use:ul.requestUse.bind(e)},response:{use:ul.responseUse.bind(e)}};var n=["get","post","delete","put","patch","head","options","rpc"];return n.forEach((function(t){i[t]=function(e,n){return i(e,Ta({},n,{method:t}))}})),i.Cancel=dl,i.CancelToken=fl,i.isCancel=pl,i.extendOptions=e.extendOptions.bind(e),i.middlewares={instance:e.onion.middlewares,defaultInstance:e.onion.defaultMiddlewares,global:Oa.globalMiddlewares,core:Oa.coreMiddlewares},i};ml({parseResponse:!1});var bl=ml({}),gl=lr((function(t){var e=Object.prototype.hasOwnProperty,i="~";function n(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,n,r,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new s(n,r||t,o),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],a]:t._events[l].push(a):(t._events[l]=a,t._eventsCount++),t}function o(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(i=!1)),a.prototype.eventNames=function(){var t,n,s=[];if(0===this._eventsCount)return s;for(n in t=this._events)e.call(t,n)&&s.push(i?n.slice(1):n);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(t)):s},a.prototype.listeners=function(t){var e=i?i+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var s=0,r=n.length,o=new Array(r);s{let s;(n=t({delayRejection:!0},n)).delayRejection&&(e=e.catch((t=>{s=t})));const[r]=await Promise.all([e,(o=i,new Promise((t=>setTimeout(t,o))))]);var o;return s?Promise.reject(s):r};var Sl=yl,vl=yl;Sl.default=vl;export{ro as B,So as P,Po as S,Xn as a,te as b,zn as c,vn as d,gl as e,_o as f,bl as g,ar as h,hr as o,Sl as p,jt as r};